1637 Commits
Author SHA1 Message Date
Ivan Starkov 0bcee28c59 Add lib to files section of package.json of generate-arg-types (#1049)
## Description

1. What is this PR about (link the issue and add a short description)

## 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
2023-02-16 16:24:07 +03:00
Bogdan Chadkin ccbcba15f3 Add token duplcate support in style sources (#1043)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

- support duplicating tokens
- removed autofocus to not block instance deleting right after instance selection
- prevent removing local style source
- refactored all operations to write generated local style source only on reorder
- select token when create
- select token when add
2023-02-16 16:13:43 +03:00
Ivan Starkov 09e1f3c46e Move generate-arg-types as dependency link of sdk (#1047)
## Description

1. What is this PR about (link the issue and add a short description)

## 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
2023-02-16 16:52:14 +04:00
Ivan Starkov 76c3c68054 Make @webstudio-is/generate-arg-types public, update versions (#1046)
## Description

1. What is this PR about (link the issue and add a short description)

## 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
2023-02-16 15:20:57 +03:00
Ivan Starkov 89a95c468b Update NPM versions (#1045)
## Description

1. What is this PR about (link the issue and add a short description)

## 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
2023-02-16 14:57:27 +03:00
Ivan Starkov d76c598090 Switch on link and generate css for all pages on server (#1041)
## Description

We are going to render CSS for all pages in production mode.
That allows us to switch on native remix links i.e. `export const links`

Also now for `published` pages we use same data as SaaS will. 
That would allow for investigating SaaS issues faster.

[x] - Also now check does ssr css is needed at all at "edit" mode.
_Checked, as of now we don't render `style` tags serverside and that
cause FOUC in designer on page switch,
cc @TrySound probably in Canvas we can render styles serverside too that
would allow us to not use /s/css path for canvas inside designer_


closes #929
closes https://github.com/webstudio-is/webstudio-saas/issues/51
closes #606

## Steps for reproduction

In local dev mode, create 2 pages in a project, and add cross-links on
both pages.
Do publish.
Go to the published page, see no fouc on link clicks.




## 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

- [ ] 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
2023-02-16 14:24:04 +03:00
Roman Pominov 343647d52a Props panel: Basics (#1031)
#992

1. Cleaned up control types
2. Control type is now chosen by component meta (including Image.src)
3. Added custom labels support
4. Some other changes mentioned in comments in diff
2023-02-16 11:18:43 +03:00
Bogdan Chadkin 7bd744c7d9 Move pages schema to project-build (#1040)
We are moving all build related code from project to project-build. Here
moved pages schema and Build type.
2023-02-15 22:46:57 +03:00
Bogdan Chadkin a68fbca047 Add rename support to style source input (#1039)
Ref https://github.com/webstudio-is/webstudio-builder/issues/807

- set min width to source source values
- added renaming support
- added user select for better dnd
- set default cursor when not renaming
- fix style source removing when press backspace while renaming
2023-02-15 18:32:33 +03:00
Oleg Isonen 82a4db1811 Hide footer in preview mode (#1035)
## Description

Currently footer is visible in preview mode for no reason


## 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-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
2023-02-15 15:08:23 +01:00
Bogdan Chadkin eb255b7dab Represent breakpoints as map (#1032)
Ref https://github.com/webstudio-is/webstudio-builder/issues/696

One more diff to support better conflict resolution in breakpoints
patches. Breakpoints is now map and patches rely on keys instead of
array indexes.
2023-02-15 17:01:06 +03:00
Bogdan Chadkin 9bf86d150d Fix trpc client setup with default .env for local dev (#1034)
We have trpc envs specified like this

TRPC_SERVER_URL=
TRPC_SERVER_API_TOKEN=

Which gives empty string in runtime though we check for undefined
expecting envs are not defined.

In this PR I covered both undefined and empty string to not break new
setups.
2023-02-15 16:59:46 +03:00
Andras Bacsai 6b49bc2128 More renames (#1030)
## Description

1. What is this PR about (link the issue and add a short description)

## 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
2023-02-14 21:59:21 +01:00
Oleg Isonen f71cc3facb Share UI improvements (#1029)
## Description

1. Close second popover after editing link label on enter
2. migrate deprecated popover



## Code Review

- [ ] hi @rpominov , I need you to do
  - conceptual review (architecture, feature-correctness)

## 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
2023-02-14 21:58:39 +01:00
Ivan Starkov cd855fe7f2 Do not select deleted projects, make clone predictable (#1024)
## Description

1. What is this PR about (link the issue and add a short description)

closes  #989
closes #988

Initially I wanted to make this with permission system, but as of now we
don't support deleting all permissions from the project, and that
probably can break some future undo operation

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-14 17:42:42 +03:00
Bogdan Chadkin a9016f3065 Improve token selelection and creation (#1026)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

- aligned combobox popup with design, addeed badges and labels
- added "create token" option when no exact matches found
- select first element by default to make "creation" explicit
- show only 5 matches while searching
- not show matches already added to value

<img width="201" alt="image"
src="https://user-images.githubusercontent.com/5635476/218684986-d7395918-8fa1-46a1-96d8-b1b9f0109906.png">
2023-02-14 16:53:27 +03:00
Bogdan Chadkin 0c506ed79e Move breakpoints schema to project-build (#1027)
Breakpoints are not really related to css data and represent project
build data so moving it before switching to map patches.
2023-02-14 16:37:33 +03:00
Andras Bacsai 7656ab0e9e rename more things 2023-02-14 11:36:33 +01:00
Andras Bacsai ac413cdd5f rename designer to builder 2023-02-14 11:15:24 +01:00
Bogdan Chadkin eeb4130d95 Compute selected breakpoint (#1023)
Before selected breakpoint stored whole object and was tracked with
effect to synchronize with breakpoints store.

Here I did the same as with instances and store only id of selected
breakpoint and use computed store to get selected breakpoint data.

Also moved breakpoint selection to shared shortcuts.
2023-02-14 02:47:17 +03:00
Ivan Starkov 2f1ba03544 Update typescript (#1025)
## Description

1. What is this PR about (link the issue and add a short description)

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-13 23:19:11 +03:00
Ivan Starkov 4848f43a07 Update NPM packages (#1022)
## Description

1. What is this PR about (link the issue and add a short description)

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-13 17:06:16 +03:00
Bogdan Chadkin 5c90148739 Add utility to generate css text from data (#1021)
Ref https://github.com/webstudio-is/webstudio-designer/issues/1019

We do a lot of changes with styles and ofte forget to keep saas up to
date. So instead whole logic to generate css will be hidden in shared
utility.
2023-02-13 17:00:58 +03:00
Bogdan Chadkin f91190be40 Fix all cmd shortcuts (#1020)
Ref https://github.com/webstudio-is/webstudio-designer/issues/1004

After react-hotkeys-hook bump I didn't notice "cmd" stopped working
because replaced with "meta" word as cross-platform variant.

Also moved undo/redo to shared shortcuts.
2023-02-13 17:00:34 +03:00
Bogdan Chadkin 97177e4cc5 Sync zoom and modify with shared shortcuts (#1006)
Ref https://github.com/webstudio-is/webstudio-designer/issues/1002

Synchronizing shortcuts with pubsub is complicated because we need to
configure each case. Here instead I synchronized zoom store and run
shortcuts on both designer and canvas. This way whole logic tied to
state instead of event.
2023-02-13 16:11:35 +03:00
Bogdan Chadkin 85f5f832aa Represent styles as map (#1008)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Here patches by styles indexes are replaced with patch by key to prevent
conflicts while collaborating.

The unusual part here is map key whiich is combined from a few fields:
"styleSourceId:breakpointId:property"

This format is enforced with typescript to always use utility
getStyleDeclKey to access specific style.
2023-02-13 16:08:19 +03:00
Ivan Starkov 034156e628 Update npm versions (#1018)
## Description

1. What is this PR about (link the issue and add a short description)

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-13 15:45:08 +03:00
Ivan Starkov 7a44059fbb Enable using css functions in CssValueInput (#1014)
## Description

1. What is this PR about (link the issue and add a short description)

Enable using css functions in CssValueInput 
closes #990 

## Steps for reproduction

Add 
`blur(2px)` or 
`drop-shadow(16px 16px 20px blue)` or 
`blur(2px) drop-shadow(16px 16px 20px blue)` to the filter field

It should work.


## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-13 14:41:32 +04:00
Bogdan Chadkin 10ea732ee2 Resolve props assets on client (#1005)
Before we checked looked for all asset ids in props, loaded assets and
replaced ids with resolved assets. This is all on server. We faced a few
problems with it.

- requires to maintain two versions of types: stored in db and resolved
for client
- easy to break project by writing to db wrong version

Here I provide to sdk both props and assets and resolve on client with
almost same amount of code.

Also replaced store setter with context, see
https://github.com/webstudio-is/webstudio-designer/issues/213
2023-02-13 12:42:02 +03:00
Oleg Isonen 525e6e384d Support for variable fonts (#1007)
Closes https://github.com/webstudio-is/webstudio-designer/issues/994

## Description

Variable fonts were treated like normal fonts, so we were only showing
one default font weight as available.
Now we not only detect variable fonts, but we also save all the meta
data we get from them, so we can add a variable font settings UI in the
future, which is a huge deal for designers, because variable fonts offer
very interesting styling options and animations

## Steps for reproduction

1. select instance
2. font family, upload variable versions fonts like Monrope, Inter or
Roboto Flex
3. see you can choose any font weight
4. use any styles on the font e.g. italic etc 

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-12 21:34:38 +01:00
Bogdan Chadkin 541f801218 Replace findInstanceById with instances index (#983)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696
https://github.com/webstudio-is/webstudio-designer/issues/651

Got rid of findInstanceById in a few places, fixed dnd to find instances
by data attribute instead of element id.

findInstanceById still used in other project utility, will get there
later.
2023-02-11 01:58:16 +03:00
Ivan Starkov 13afe43cc5 Update ussets and project (#985)
## Description

1. What is this PR about (link the issue and add a short description)

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-10 13:39:35 +03:00
Ivan Starkov 2012428327 Update ver 0.26.0 (#984)
## Description

1. What is this PR about (link the issue and add a short description)

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-10 14:12:21 +04:00
Ivan Starkov 58ae2f49b2 Update npm packages (#982)
## Description

1. What is this PR about (link the issue and add a short description)

Update npm packages

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-10 12:21:59 +03:00
Ivan Starkov ed2645292b Add support of saas edge-api trpc preview router (#971)
## Description

1. What is this PR about (link the issue and add a short description)

This branch will allow preview deployments of trpc authorization and
other saas services
Currently in this branch following variables are set:

```env
TRPC_SERVER_URL=https://wstd.work/services
TRPC_SERVER_API_TOKEN=secrettoken
```
It should use preview saas trpc service having `ory_setup` name
Here `https://wstd.work/services` is router url, router using
`x-branch-name` reroutes traffic to the right saas preview

This is for test ONLY, variables would be removed if all is ok and
testing will proceed on saas side

## Steps for reproduction

Create a new Project, create auth tokens, and check it works.
Check saas service preview logs that requests are there.



## 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
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [x] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-10 12:13:57 +03:00
Ivan Starkov 3e39df6970 Change Env usage from process.env to import (#973)
- [x] - Doesn't work locally and at server, different issues,
investigating, added comment why we use process.env at proxy
- [x] - Fix proxy  

## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

All public env variables (which can be shared to a client) are moved
into `~/env/env.public`
All other variables are moved into `~/env/env.server`

Vendor-prefixed vars like VERCEL_URL got beautiful names having that we
already had beautiful names.

Shared Proxy fixed to has access only to env.public


## 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
- [ ] 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-10 11:46:22 +03:00
Bogdan Chadkin 1e5caee26d Fix multiple local style sources (#981)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

Missed this case. We should always rely on either raw data or use
computed store within single update.
2023-02-10 11:43:03 +03:00
Oleg Isonen 77d55f2ae8 fix left sidebar tablist border 2023-02-09 23:24:25 +00:00
Bogdan Chadkin 0a5a9dc7c1 Refactor insertInstance with instances index (#978)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Got rid of unused utilities in project packages and added new
insertInstanceMutable tree utility and insertInstance command.
2023-02-09 23:46:02 +03:00
Bogdan Chadkin 7d631aaa83 Represet style source selections as map (#976)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Patches by indexes are replaced with patches by keys so we could get
almost conflict free collaboration.
2023-02-09 19:03:15 +03:00
Bogdan Chadkin abdfbf2384 Refactor instance reparenting with instances index (#977)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Index allows us to pretraverse the tree and provide utils for fast
access anything in the tree.

Also removed old implementation from project package.
2023-02-09 19:00:04 +03:00
Oleg Isonen e50fa46629 bring back aspect ratio 2023-02-08 21:56:36 +00:00
Bogdan Chadkin 8fb4c59c77 Represent style source as map (#975)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Same as props. Fast access and fast update. So we no longer need
separate store with style sources index.
2023-02-09 00:33:01 +03:00
Bogdan Chadkin 136a7bd157 Represent props on client as map (#972)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

While normalized array of props give us flexibility with atomic updates
we still cannot use it for collaboration because patches are applied
with index in this array which may leads to unexpected results when two
users collaboate on the same tree, for example both put new prop and
edit it before synchronization by the same index, we are getting
conflict.

To avoid such issues we can switch client representation to maps. Almost
all data have ids to use in map as keys. Map makes collaboration almost
conflict free.
2023-02-08 20:23:41 +03:00
Bogdan Chadkin 0200ea2c57 Implement basic style source ui (#962)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

Here basic support for styles sources in style panel

- new token creation
- existing token adding for instance
- token removing from instance
- sorting with dnd
- style source selection for styles  editing

Added feature flag to hide it on prod for now.
2023-02-08 13:13:50 +03:00
Oleg Isonen 266d62c339 Animate menu button on hover (#967)
Closes https://github.com/webstudio-is/webstudio-designer/issues/964

## Description

Animate the topbar menu button from logo to hamburger. menu on hover as
well as remove unnecessary styles

## Steps for reproduction

1. open designer
2. hover logo
3. click icon

## Code Review

- [ ] hi @rpominov , 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-08 10:26:28 +01:00
Bogdan Chadkin 3e442bb1f0 Synchronize initial state of client stores (#960)
Ref https://github.com/webstudio-is/webstudio-designer/issues/959

We usually rely on default which is the same everywhere. Though with
assets initial state comes from server so it should be synchronized.

The issue was not visible because we also load assets in runtime which
does not seem to happen on project switch.

Fixed by sending initial state to designer.
2023-02-07 18:41:33 +03:00
Bogdan Chadkin eb66eccca1 Move selected style source into separate store (#955)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

this will let to reuse the logic and newly generated local style source
with style source input.
2023-02-07 00:17:06 +03:00
Ivan Starkov d00c646b10 Disable share and publish buttons if not owner (#952)
## Description

1. What is this PR about (link the issue and add a short description)

Disable share and publish buttons if not owner

Also changed Deprecated Coponents on FloatingPanel

<img width="305" alt="image"
src="https://user-images.githubusercontent.com/5077042/216975690-8ed2bd08-c077-4b78-add9-1d10a16b0ff5.png">

## Steps for reproduction

Share the Link with View/Build permissions.
Open that link in incognito mode.
Try to share / publish project.

<img width="293" alt="image"
src="https://user-images.githubusercontent.com/5077042/216948687-d58370ba-f91c-4558-ad54-5700ee318493.png">

<img width="293" alt="image"
src="https://user-images.githubusercontent.com/5077042/216948811-3e8b33f9-bd87-4752-917c-89f1affbb08d.png">

<img width="401" alt="image"
src="https://user-images.githubusercontent.com/5077042/216975898-af52725d-ae9b-49b3-8519-e66b7cc469bf.png">

## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-06 15:56:18 +03:00
Ivan Starkov 4a5aadf5ec Assets view mode (#951)
## Description

1. What is this PR about (link the issue and add a short description)

In view mode, we need to prevent users from deleting / creating assets
in UI. (Server-side protection already done in the previous PR)

The other way can be just to hide buttons from the UI.
Also tooltip duration for disabled actions can be smaller.

## Steps for reproduction

Share the Link with View permissions.
Open that link in incognito mode.
Try to create/delete an asset

<img width="265" alt="image"
src="https://user-images.githubusercontent.com/5077042/216938724-d8e0e3b3-28fe-405e-8997-0a8dd84a105e.png">


<img width="355" alt="image"
src="https://user-images.githubusercontent.com/5077042/216938784-a1a59926-b41e-4193-8584-8387cae221f6.png">

<img width="263" alt="image"
src="https://user-images.githubusercontent.com/5077042/216939092-13d59ddd-c601-4ebb-b536-d7c0bd4a572a.png">

<img width="308" alt="image"
src="https://user-images.githubusercontent.com/5077042/216940665-f185e9b7-84c3-4ad7-8c61-43b3447a5777.png">


## 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-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-06 15:56:05 +03:00