1616 Commits
Author SHA1 Message Date
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
Oleg Isonen b8829fc1c6 Remaning toolbar updates (#949)
## Description

1. Added page name
2. Using now Toolbar from radix
3. Added Toolbar from radix to ds
4. Updated layout for centering the breakpoints button among other
things

<img width="961" alt="Screenshot 2023-02-05 at 21 11 47"
src="https://user-images.githubusercontent.com/52824/216846091-4b2113a4-38f7-41bf-969d-485cbe16b22c.png">


## Steps for reproduction

1. click button
5. 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-06 13:07:15 +01:00
Bogdan Chadkin 052d049073 Refactor closest droppable with instances index (#945)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

A lot of our utilities can reuse indexed instances instead of
retraversing tree. This will also simplify migration to normalized
instances.

Here I refactored droppable instance lookup.
2023-02-06 14:16:52 +03:00
Bogdan Chadkin 49e82f8f2d Rename singular props and styles names (#953)
We decided to get rid of "Item" naming, here renamed everything left.

- PropsItem -> Prop
- StylesItem -> StyleDecl
2023-02-06 14:16:14 +03:00
Bogdan Chadkin 46582c8f88 Fix double delete when focused navigator tree (#946)
Looks like calling onDelete in navigator duplicates global delete
shortcut.
2023-02-06 12:45:39 +03:00
Ivan Starkov 5af9c4e5d4 Disable sync for user/token with "view" permit and show view mode icon (#941)
## Description

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

Disable sync for user/token with "view" permit and show view mode icon

<img width="294" alt="image"
src="https://user-images.githubusercontent.com/5077042/216642624-00a75655-d8a8-49de-9818-a2bec00c637b.png">


## Steps for reproduction

Create Share view link. Copy link. Insert into the incognito window. See
the screenshot above. Any changes should not cause savings.

_Assets saving, for now, are not prevented_

## 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 12:28:13 +03:00
Ivan Starkov c0c58e23cb Add assets permissions checks (#948)
## Description

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

Add assets permissions checks serverside.
Mostly adding context 

## 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-06 12:18:54 +03:00
Bogdan Chadkin 7e494fb59a Track delete shortcut on both canvas and designer (#947)
Here's the issue. We track shortcuts on canvas and designer though
designer invoke hotkeys with shared configuration and loose edge cases.
For example delete should not be invoked on inputs though shared
configuration enforce it. If we disable inputs then undo/redo will stop
working.

So for better safety we should track shortcuts in both designer and
canvas with the same code and update synchronized stores instead of
synchronizing shortcuts.
2023-02-05 23:44:27 +03:00
Oleg Isonen 06a7c81d13 Topbar layout and buttons redesign (#943)
## Description

1. Topbar components replaced
2. Toolbar Toggle component added to the ds



https://user-images.githubusercontent.com/52824/216761913-1f801137-af36-400c-ad99-7b01c0e356d8.mp4



## Steps for reproduction

1. open designer

## Code Review

- [ ] hi @rpominov , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

- [ ] @taylornowotny I need you to 
  - check for visual 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-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-05 19:13:25 +01:00
Ivan Starkov 50e17d44ee Show preview initially for view only users (#940)
## Description

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

Show preview initially for view only users

ref #548


## Steps for reproduction

1. click button
2. expect xyz

## 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-03 18:19:55 +03:00
Oleg Isonen 1d5d736915 Optimistic rename project (#939)
## Description

1. We reuse zod schema on the client now, so if server sends and error
we crash entirely, we don't expect an error that we need to show at the
moment. In the future we will have cases where we can't fully validate
on the client and an error may come from server.
2. Once client validation has passed we immediately close the dialog
without waiting for response.

## Steps for reproduction

1. click rename in project on dashboard

## Code Review

- [ ] hi @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-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-03 15:49:05 +01:00
Bogdan Chadkin cec0e16912 Delete instance without pubsub (#937)
Synchronized stores allow us to change data anywhere we want so we can
get rid of pubsub in almost all cases.

Here removed delete instance subscription and used delete instance
command.
2023-02-03 15:36:21 +03:00
Oleg Isonen 3beb0d01e3 Optimistic project deletetion (#938)
## Description

1. optimistic delete



https://user-images.githubusercontent.com/52824/216601949-743ee55b-2f4b-42bd-9c4f-b94f4b76bce8.mp4



## Steps for reproduction

1. delete project without waiting for response

## Code Review

- [ ] hi @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-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-03 13:35:14 +01:00
Bogdan Chadkin 2b404f2864 Use synchronized store for assets (#936)
Before assets were synchronized with pubsub between canvas and designer.
Here I switched to synchronized store.
2023-02-03 13:06:25 +03:00
Ivan Starkov cc447fbc63 Update packages (#934)
## Description

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

I want to update saas based on #928

## 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-03 11:41:41 +03:00
Bogdan Chadkin aff014f4d0 Use projectId as composite id in tables (#932)
Ref https://github.com/webstudio-is/webstudio-designer/issues/896

Here changed Asset, Build and Tree tables to composite ids with
projectId to improve security and simplify project management.
2023-02-03 11:39:21 +03:00
Oleg Isonen a8e063b081 Pending state for create project in dashboard (#931)
## Description

1. Adds pending state to submit button

## Steps for reproduction

1. click create project
2. see button shows as pending

## 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-02 21:19:01 +01:00
Ivan Starkov 119f1cf78c Unify and simplify fetch and errors for endpoints and packages used in SaaS (#930)
## Description

Unify and simplify fetch and errors for endpoints and packages used in
SaaS
ref #928

## 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-02 22:40:00 +03:00
Oleg Isonen cffb6dc071 Sort dashboard projects by createdAt (#927)
## Description

Add createdAt field to projects and sort by it in dashboard

## Steps for reproduction

1. open dashboard
2. rename a project
3. project should stay in the same order, before that change it would
always jump at the end

## 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-02 20:13:36 +01:00
Bogdan Chadkin 073062a4bf Move breakpoints to Build table (#926)
Ref https://github.com/webstudio-is/webstudio-designer/issues/744

We are trying to co-locate data and simplify cloning/copying. Here I
migrated Breakpoints.values into Build.breakpoints.

This makes Build responsible to all data scoped to project build similar
to tree scope.

We get projectId defined for free and no need additional sql
maintenance.
2023-02-02 21:43:03 +03:00
Bogdan Chadkin 370718f5a2 Replace bson-objectid with nanoid (#925)
- bson-objectid is harder to use with ObjectId().toString()
- nanoid is safer alternative
(https://github.com/paralleldrive/cuid2#the-contenders)
- auto import works better
2023-02-02 18:50:26 +03:00
Ivan Starkov 505fdac672 Fix production publish (#922)
## 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-02 13:23:23 +03:00