Ref https://github.com/webstudio-is/webstudio/issues/2647
Here fixed the issue with detecting root as first instance in the
fragment. The idea of this utility is to not rely on any root but
instead insert with new ids all instances outside of portals/components.
Roots semantics is left for outer utilities.
Closes https://github.com/webstudio-is/webstudio/issues/3149
## Description
As a user when I have Heading, Text or similar instances selected which
have a single text node instance, I expect an added component to insert
AFTER such instances.
## Steps for reproduction
1. add heading
2. select heading instance
3. 1-click box
4. see box was added after the heading
5. repeat the same with paste
6. repeat the same with any instance that has only text inside
## Code Review
- [ ] hi @TrySound , I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
- [ ] hi @johnsicili , I need you to do
- 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
Added new colors for navigator to mark slot and it's children
<img width="818" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/52824/988b991d-1fee-4cec-9c6a-920736f781de">
## 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
Ref https://github.com/webstudio-is/webstudio/issues/1536
Here added support for css custom properties in style object model.
Added guaranteed-invalid value to schema to represent initial value of
custom properties.
Ref https://github.com/webstudio-is/webstudio/issues/2903
Here switched the rest of usages to acorn based expressions. Added
getExpressionIdentifiers utility to extract used variables names to
avoid using transpiler replaceVariable callback for this.
## Description
This PR adds a new `FunctionValue` type to the `css-engine`. This helps
in defining `blur(5px)`, `drop-shadow(10px 10px 10px red)` and
`translate3d(42px, -62px, -135px)` type of functions more clearly. There
is a flag in the `FunctionValue` with the name `seperator` which defined
that type of separator to be used while passing the function arguments.
In `css-tree` they use a `Operator` node. But we don't have something
similar to that in the schema. So, using a new flag to define it.
## 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
- [x] made a self-review
## Before merging
- [x] tested locally and on preview environment (preview dev login:
5de6)
- [x] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [x] added tests
## Description
Foundation for the future marketplace where free and paid templates,
apps and other integrations can be offered. This first version is
limited to a few items that we will add there.
Generally, we call items we list on that marketplace "products" and they
can open an iframe either in the same left panel or in a dialog.
1. Product listing is effectively a webstudio website that can also be
functional standalone as well as inside the builder.
2. That website wraps individual section templates with a utility
component that handles click-to-insert
<img width="281" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/52824/0511f516-fb95-41b4-afa5-7a91f238c353">
<img width="290" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/52824/881fdee8-47ac-4d3a-ac01-7fdb9fdab236">
https://share.descript.com/view/bIgPI8aGiYA
## Steps for reproduction
1. no need to test for now
## Code Review
- [ ] hi @TrySound , I need you to do
- conceptual review (architecture, feature-correctness)
- detailed review (read every line)
## 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>
Here improved page duplicate logic to support replacing old variables in
page meta and path params variable with new references.
Also improved path duplicating to preserve path params by prefixing with
`/copy-n` subpath.
Ref https://github.com/webstudio-is/webstudio/issues/2532
Here refactored insertInstancesSliceCopy to accept webstudio data
instead of creating transaction.
This let us avoid hacky callbacks in duplicate instance and duplicate
page functionalities.
Note: review with hidden whitespaces
Here refactored delete instance to accept and mutate webstudio data
instead of accessing data stores.
Now we can avoid double transaction when delete pages.
Note: review with hidden whitespaces
Here added two new types
WebstudioFragment - reusable fragment of webstudio data which can be
generated (markdown, embed template), transferred (copied or stored in
marketplace) and inserted.
WebstudioData - all available normalized data to allow composing
multiple operations within single transaction like delete instance and
then insert into other part of the page.
Ref https://github.com/webstudio-is/webstudio/issues/2532
Important constrain on the way to custom components to not use data
sources defined in other components when copy paste.
## Steps for reproduction
1. Test covers it
## 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
Ref https://github.com/webstudio-is/webstudio/issues/2532
Here added dataSource.type = 'parameter' without initial value because
value is always provided by context. It let us fix a few issues with
variables without complicating logic.
- prevent deleting parameter variable (collection item) in variables
panel
- allow changing only name of parameter variable
- show only name in the list of variables
- fix removing expression from collection data
- hide item parameter from collection variable list
- prevent editing parameter value from props
- make collection unstylable
Use same well tested utility to slice and insert its copy for copy
paste. Moved most utilities inside of instance plugin and added more
tests for it.
## Steps for reproduction
1. play with copy paste
Fix https://github.com/webstudio-is/webstudio/issues/2516
Here added "duplicate" button to page settings and implemented logic
based on recent instances slice utilities.
## Steps for reproduction
1. open pages
2. click on page
3. click "copy" button
Ref https://github.com/webstudio-is/webstudio/issues/2532
Here added a "core" collection component to support iterating over json
arrays.
There is a lot of room for unification of all this logic though would
require building reactive tree abstraction.
Canvas automatically renders stub component for collection to make it
droppable. We can do the same for slot component.
Slot and Fragment eventually will go to "core" components too.
Added json/parameter prop types to embed template to support collection.
Fixed loosing focus while typing in json prop.
## Steps for reproduction
1. Drop collection component
2. play with it
Part of https://github.com/webstudio-is/webstudio/issues/2516
Here added new copy implementation. There are 2 differences
- it does not change existing instances and not change their children,
we will need this to copy pages
- it handles cross-project copy of portals (slots) properly, now each
portal content is inserted separately if the root does not exist and
skips otherwise
- much better covered with tests
## Steps for reproduction
1. try duplicating form and change form state prop
2. try duplicating form error message and change form state prop
Ref https://github.com/webstudio-is/webstudio/issues/2532
On the last discussion about bindings we agreed expression are always
bound to single prop and cannot be reused.
Here added new prop.type = 'expression' as a replacement to
dataSource.type = 'expression'.
This will let us unify expression/variable reference and avoid deep
dependencies. Expressions and actions become similar.
For now both expression prop and legacy expression data source are
supported until we migrate completely in db.
Ref https://github.com/webstudio-is/webstudio/issues/2532
Here improved copy/paste behavior.
Before variables outside of copied tree were inlined. For example
ErrorMessage were loosing its expression when duplicated within same
form.
Now expressions and variables are preserved
and variables are inlined into expressions when paste target do not have
such variable. For example ErrorMessage get `"initial" == "error"`. With
upcoming UI it will be more obvious. The main idea here to not loose all
expressions but only references to unavailable variables.
Ref https://github.com/webstudio-is/webstudio/issues/2532
Here changed accessing expression from data source id to prop id in
builder and data source name to prop name in generated code.
This is another step to migrate expressions from data sources to props.
See generated output for clarification.
Note: review with hidden spaces
Split instances slicer into separate utility from copy paste plugin.
Will be used to duplicate pages. Along with splitting added more tests
to better cover behavior.
Quite requested improvement. Instead of selecting parent on delete
select next or previous sibling to be able to clean items within
collections with minimal amount of actions.
For testing
- delete first item in a list
- delete last item in a list
- delete the only item in a list
- allow dragging control and embed components
- fix placement indicator for style sources and backgrounds
- synchronize drag and drop state between builder and canvas
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.
This fixes the issue with computing data sources logic.
insertTemplateData first calls propsStore.set and then
dataSourceStore.set which triggers computing 2 times and first time prop
refers to not existing data source.
Here fixed by setting data sources first and then props.
Before when start dragging we searched for closest rich editor under
cursor and did nothing when the instance is not detachable (for example
select value or switch indicator).
Here I changed the behavior to also look for closest detachable instance
and drag whole thing. This way we do not need toast like in navigator
and can canvas dnd just work.
Also fixed placeholder in "Select Value" component. Before was no way to
change it.
Here made meta.label optional to simplify adding new stuff. Most of the
time label is just a "humanized" version of component name. With radix
there is an additional action to strip namespace. But still would be
less repetition if the name is just inferred.
Here added meta.detachable flag which allows when set to true disable
copying, dragging and deleting instances of this component without ts
parent instance.
This is necessary to constrain components based on external code and
prevent deleting hidden components user cannot add again.
Here fixed the case when copy pasted form looses state and give errors
on submit.
Immerhin now converted to esm to work in tests.
Added tests for instances copy paste plugin.
The new logic is copy data sources as is if they are bound to copied
instances.
The new computeExpressionsDependencies used to detect if expression
depends on data sources outside of copied instances scope.
Fixes https://github.com/webstudio-is/webstudio-builder/issues/1950
Here added new utility to compute constraints for tree when insert embed
template, paste something or reparent. I previous implementation all
constraints were merged which gave us false positives like when paste
List>ListItem we got "requiredAncestors: [List]". Here tree layout is
considered to exclude such false positives.
For testing try to copy paste List>ListItem
Here refactored copy paste plugin system to try each plugin until it
succeeds. This way we can have multiple solutions to copy paste from
plain text. For example embed template is hand written text and should
succeed before markdown starts parsing it.
```json
{
"@webstudio/template": [
{
"type": "instance",
"component": "Box",
"children": [
{ "type": "text", "value": "Hello, I'm Box!" }
]
}
]
}
```