## Description
- Adds the ability to place images on the canvas immediately during
upload, using the file blob or a provided URL.
- Enables images to use width and height from asset metadata.
- Detects duplicate assets and displays a warning message.
<img width="323" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/fe810dd8-3e3d-4cab-8669-b0d739044f49">
These changes allow images to appear on the canvas upon pasting, even if
the asset is not fully uploaded yet.
## Steps for reproduction
Start uploading few files on a slow connection, select them before
upload, see image on canvas is changed
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
## Description
This is 1st PR In a series of PR's
Next: Image URL Links upload support.
Image Manager now support files drag/drop
(Images, Fonts etc)
## Steps for reproduction
Drag files on image manager see it works.
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
## Description
closes#3021
Currently if we are in a text edit mode we sometimes can't focus on any
input inside builder.
This fixes this.
## Steps for reproduction
1. click button
2. expect xyz
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
## Description
closes#2998
Also fixes name edits etc.
The same issue with radix as we had in the past, focus lock on any
mutation inside dialog aquires focus.
And we have no good way to prevent programmatic focus inside iframe.
## Steps for reproduction
1. click button
2. expect xyz
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
## Description
- split project settings
- add marketplace settings
## Steps for reproduction
1. click button
2. expect xyz
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
---------
Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
Co-authored-by: istarkov <istarkov@gmail.com>
## Description
Pure renaming, nothing else.
## Code Review
- [ ] hi @TrySound , I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
Succeeds https://github.com/webstudio-is/webstudio/pull/2136 in more
simple way. Active states are preresolved for everything except local
styles. And local styles shown as overwritten when defined state is
active.
Fixes
https://discord.com/channels/955905230107738152/1177028091227418654
## Steps for reproduction
1. create form component
2. choose error state
3. set background red
4. go to error state in style source menu
5. should be "remote" label
6. set background green
7. go to stateless style source
8. reset background color
9. should be "overwritten" label
Found we have race condition because of handshake
which complicates synchronizatio of commands.
Here removed handshake. Instead iframe now rendered client side after
first effect and canvas sends "connect" event so builder start sending
updates.
In the future this can be simplified even more with computed updates
from current state like yjs does.
## Testing steps
- try to delete instance after selecting on canvas
- try to press enter to edit text after selecting from navigator
- allow dragging control and embed components
- fix placement indicator for style sources and backgrounds
- synchronize drag and drop state between builder and canvas
Here fixed the issue with initially missing hotkeys in builder. Add
queue in immerhin to collect
transactions until subscription. This let us create new transactions in
module scope without worrying
the event will not reach the other realm.
New version of immerhin moved global queue into store instance so we can
stop filtering and just call store.popAll().
Also replaced default store with webstudio own serverSyncStore instance.
Now auto import works much better.
Here fixed two-way synchronization of commands between builder and
canvas. Added flag to not share hotkey with other apps.
Added first two commands specific to canvas: editInstanceText and
escapeSelection. Builder is able to reuse commands by specifying inn
"externalCommands" which basically extends the union of commands.
Added new commands emitter utility to manage hotkeys across plugins and
separate a lot of logic from canvas.
Here migrated only togglePreview as an example.
Later we can build commands panel and hotkeys overrides on top of this
utility.
Nanostore react wrappers in many cases introduce additional renders
because of subscription even when only store.set is used. Searching for
references become complicated because we have both direct store access
and react wrapper.
Here migrated to use direct store access for preview mode store and
renamed it to $previewMode according to new convention.
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529
Here introduced two types of data sources into "variable" and
"expression". First stores the value, the second only executable code.
Execute expressions now output results of all expressions so we could
access values globally with "computed" store
Embed template references now allow to define both variable reference
and expression.
## Description
Changed pages synchronisation.
We had following path on link click in canvas:
- We intercept it in handleLinkClick and do publish('switchPage', {});
- We subscribe on 'switchPage' at builder and do navigate(builderPath, {
pageId});
- We subscribe on useSearchParams extract from there pageId and do
selectedPageIdStore.set(pageId)
- On Canvas we subscribe on selectedPageStore and finally render the
page
Now we just change
`selectedPageHashStore`, `selectedPageIdStore` in a single function
`switchPage`
`location.searchParams` used only for initial and popstate
synchronisation.
pageHashStore added for future use, no logic now.
## Steps for reproduction
1. click button
2. expect xyz
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529
Added data source values store which can be updated from both components
and props panel.
```js
const { setState } = useContext(ReactSdkContext)
const instanceId = getInstanceIdFromComponentProps(props)
setState(instanceId, propName, value)
```
Ref https://github.com/webstudio-is/webstudio-builder/issues/1529
- added data sources store
- added dataSource type to props
- insert data sources from template (prop.dataSourceReference allows to
bind several props to the same data source)
- convert to static prop on copying (simplification until requirements
are clear)
https://github.com/webstudio-is/webstudio-builder/issues/84#issuecomment-1522834976
## Description
1. Added new components:
- textarea
- radio-button and radio-button-field
- checkbox and checkbox-field
- success-message
- error-message
2. Added `states` like `:disabled`, `:valid`, etc. to `input`
3. Added `custom-components/form` that renders success-message and
error-message conditionally
4. Added `success` and `error` style states to `custom-components/form`
5. Style panel now shows "Select an instance on the canvas" if the
selected component is not rendered on canvas (e.g. error-message may not
be rendered)
Not in this PR:
- The mailer package
- Backend handler for forms (will be in a PR in SAAS)
- Logic in Form that actually submits to backend and shows success/error
messages
## Steps for reproduction
1. Add a "Form" to canvas
2. Add "Checkbox Field", "Radio Button Field", "Text Area" to the form
3. Try changing `initialState` property of the form
## Description
Made handshake between canvas and builder.
Now publish actions are delayed in local array until handshake message
from destination is received
Switched on hydrateRoot to enable concurrent mode
unstable_batchedUpdates are removed
## Steps for reproduction
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
## Description
closes#956
+ In case if user not edited the value but immediately clicked to unit
select we are trying to convert em px etc values
## Steps for reproduction
1. Edit `width` value, enter 10
go to unit select set `em` - see 10em as final result
2. Click on unit select of the width, change em to px see 10em converted
to 140px or like (depends on em size)
3. Enter `Auto` in width, click Enter.
Click on UnitSelect select EM, see browser style is used to set em
width.
4. Enter Auto in width, switch on Unit select, set px, see browser style
is used.
5. See that now unit selector is visible always. With some exclusions
like aspectRatio as it has keywords and numeric values.
## Code Review
- [x] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
## Description
- Canvas behavior should be exactly as in Webflow now - responsive
canvas.
- No constraints for resizing, you can switch to different breakpoints
when you change the canvas width just like in preview
## Not done in this PR
- [ ] breakpoints dropdown menu redesign
- [ ] on-canvas resizable handles
- [ ] flash-animate breakpoints list when breakpoint is switched through
resize
- [ ] flash-animate left and right borders when breakpoint is switched
- [ ] gravity of resize handle dragging when reaching next breakpoint
- [ ] vertical labels with @media example that matches current
breakpoint
- [ ] migrate min-width 0 breakpoints to base?
- [ ] hide outline while changing size
- [ ] ensure there is never both min and max in one media
## Todo
- [x] draggable positioning calc
- [x] shortcuts for zoom
- [x] sync width and selected breakpoint
- [x] remove scale
- [x] fix mobile-first breakpoints
- [x] tabbable toolbar items
- [x] icon for base
- [x] fix flicker
- [x] After breakpoint delete/add CascadeIndicator doesn't refresh
- [x] fix when there is no base, min-width 0 should have still a full
width
## Steps for reproduction
1. click button
3. expect xyz
## Code Review
- [ ] hi @TrySound, @istarkov , I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
Ref https://github.com/webstudio-is/webstudio-builder/issues/1335
Here I replaced assetContainersStore with assetsStore. Now deleting and
uploading states are maintained locally in assets provider. To preserve
the order of uploading assets assetsStore map has value as undefined.
This way assets.get(id) provides the same value. Though when iterating
we see missing asset.
## Description
closes#473
`${tag}:where([${componentAttribute}=${component}])` where is used to
not increase specificity
- [ ] todo remove from getInheritedInfo, as we don't know ancestor
tagName
## Steps for reproduction
See box-sizing etc props for newly created items
## Code Review
- [ ] hi @kof, I need you to do
- conceptual review (architecture, feature-correctness)
- [ ] hi @TrySound , I need you to do
- detailed review (read every line)
- test it on preview
## Before requesting a review
- [x] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
## Before merging
- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
The last piece to address instances by selectors
- the mode is represented as text editing instance selector
- reset editing mode along with selection on user input instead of
ssubscribing to selected store
- moved enter/esc shortcuts to shared between builder and canvas
- got rid of legacy subscriptions to stores
Label again started flickering because hovered instance and hovered
outline store changes have delay in between. Solution as before is to
provide all info with outline. Here I just passed both label and
component to get the shape for getInstanceLabel.
Removed react hook from instance hovering and refactored with instance
selectors.
With slots there can be same ids in one tree so we need new way to
address instances. Here I propose the list from target instance to the
root.
Now instead of computing parents by normalized tree (one instance of
slot can have many parents) we just access already computed list from
rendered tree.
This address can be computed when user click in dom which can be
traversed or it can be passed top-down with props.
The main con of this approach is collaboration. Reparanted instances on
by one user makes "selected address" stale. Though we have similar
situation with single id when instance is deleted.
Isolated mode for slots/components will make this problem less
noticable.
Switching between pages takes very long time though all data already
loaded. Here I added validation to not reload builder data when page is
changed and render canvas with static id which is not really used for
anything so iframe no longer reloads.
Switching pages now instant.
Canvas no longer populate stores data. Builder load project build,
populate stores and synchronize them into canvas.
This way we can simplify data flow, make builder responsible for both
initial data and patches, do less work on canvas side.
This is also necessary to move pages management to client side.
Ref https://github.com/webstudio-is/webstudio-builder/issues/1116
Before we assumed the first instance in the list of instances is the
root. Though we are gonna introduce slots and for this have to combine
instances of all pages into single array. So there can be many roots in
one list.
So now we gonna specify root instance id on page. treeId will be removed
once instances are migrated to Build table.