3121 Commits
Author SHA1 Message Date
Ivan Starkov b05a36defe Update versions (#920)
## 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
0.25.0
2023-02-02 13:02:49 +04:00
0ee5d13efc Figma tokens (#918)
Co-authored-by: Taylor Nowotny <86495896+taylornowotny@users.noreply.github.com>
Co-authored-by: Bot (build-figma-tokens.yml) <bot@localhost>
Co-authored-by: markxtang <122043657+markxtang@users.noreply.github.com>
2023-02-02 11:45:02 +03:00
Oleg Isonen 438697f2cb Add share dialog to dashboard (#916)
To add it to dashboard I had to move things around

https://user-images.githubusercontent.com/52824/216138251-260a8a7e-fc86-424b-aaff-bb11c79c307d.mp4

## Steps for reproduction

1. click on share in menu in dashboard and in topbar from builder
2023-02-02 11:43:43 +03:00
Bogdan Chadkin 118e07aeb0 Migrate styles to style sources variant (#917)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

Styles are resolved based on style sources of every instance. Here
finally migrated whole logic to new variant.

For now the only local style source is used as default for style
updates. In the next PR will add support for tokens.
2023-02-02 01:22:46 +03:00
Roman Pominov d110075af0 Fix font in project card (#914)
Used a wrong token in #912
2023-02-01 21:24:52 +03:00
Bogdan Chadkin 174b7124f2 Add style sources stores (#913)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

Here added style sources and style source selections stores, added
updates along styles and covered with tests. Patch utilities for rest
endpoint are not used to avoid collision with temporary logic in styles.

Next step will be integration styles with style sources on client.
2023-02-01 20:55:19 +03:00
Ivan Starkov 8eb14be0c8 Sync preview mode through sync-stores (#915)
## 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-01 19:26:54 +03:00
Roman Pominov 0e173ec85e Text fixes (#912)
1. New `Text` component, existing is deprecated. Closes #825
2. Deprecated `Paragraph` component (the replacement is `<Text as="p">`)
3. Added `textVariants` that can be used like this `css({
...textVariants.regular })`
4. Removed `typography`, now `textVariants` or `textStyles` can be used
instead
5. Added `theme.fontSize`, `theme.lineHeight`, `theme.fontWeight`,
`theme.letterSpacing` that use values from Figma
6. Deprecated existing `theme.fontSize`, `theme.lineHeight`
7. Installed `Roboto Mono` font
2023-02-01 16:54:00 +03:00
Oleg Isonen 27a00fdc79 Dashboard remaining dialogs (#907)
## Description

1. Rename and delete dialogs + cleanup

## Steps for reproduction

1. click project item menu to rename 
2. click project item menu to delete 

## 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-01 13:32:35 +01:00
Bogdan Chadkin 22e54f8167 Fix copy paste styles and props of descendants (#911)
Found we do not copy styles and props for descendant instances. Here
also removed copy/paste data from react and added a few new tree
utilities.
2023-02-01 13:52:53 +03:00
Bogdan Chadkin abee2f1cf4 Make copy paste data agnostic (#909)
Copy paste of instances was implemented closly coupled to our schema.
Here I make I implement it with simpler interface without dependency on
types. Type and version are instead passed as configuration.

Next step will be decoupling instance copy paste from react and
simplifying data management with nanostores.
2023-02-01 12:45:15 +03:00
Ivan Starkov 47aa6d88be Remove framer-motion for a link list add collapsible (#910)
## Description

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

Share list uses Collapsible instead of Framer motion

## Steps for reproduction

Click Share button, see expand of list items

## 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-01 13:24:25 +04:00
Ivan Starkov 8e5d0a2186 Shared tokens UI + Api (#894)
## Description

ref #548

Add shared links with builder/viewer permissions.

`editor` permission is now disabled as we don't know a simple way to
allow editing images and text only cc @TrySound would need your opinion
on this.

createTrpcRemixProxy now wraps input in `JSON.stringify` and unwraps
before the TRPC call. Otherwise, all params are FormData string entries
and may cause errors.

createTrpcRemixProxy useQuery/useMutation now returns Remix useFetcher
state parameter.


**`patch` auth call added, we must do any Auth mutate operations in a
single call, otherwise if some call failed we are in troubles.**
Example on token relation update.
Remove viewer relation.
Add editor relation. <- If the call failed here user just loses all
permissions.
In case of patch both operations are completed in a single transaction -
(delete+insert)





## Steps for reproduction

Having migrations works locally only with 
`isFeatureEnabled("share2")` flag.

Click the share button then add/rename/update/copy share links.

The previous Share button is removed.

**TODO In Next PR:**

Different UI for builder and viewer links i.e.
[this](https://github.com/webstudio-is/webstudio-designer/issues/548#issuecomment-1406947059).

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

## Before requesting a review

- [x] made a self-review
- [x] 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-01 10:51:20 +03:00
Bogdan Chadkin f6f368898b Switch to utils for style management (#906)
Replaced manual array manipulations with array utils and reused styles
index to compute style info.

This will let to do less work when switch to build styles.
2023-02-01 00:52:50 +03:00
Bogdan Chadkin 4d3e7836b6 Fix lost pixel snapshots (#908)
Was missed in
https://github.com/webstudio-is/webstudio-designer/pull/901
2023-01-31 22:49:35 +03:00
Bogdan Chadkin 02654371b5 Support multiple style sources in preview (#905)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

Designer data still rely on legacy style format though here I migrated
preview styles to combination of style source selections and styles from
build.
2023-01-31 18:02:25 +03:00
Oleg Isonen c4ae76c4bb Dashboard dialogs (#901)
## Description

1. This PR implements  a create project dialog
<img width="579" alt="Screenshot 2023-01-31 at 13 17 45"
src="https://user-images.githubusercontent.com/52824/215771142-7694a048-ba54-4d6e-94bf-befbdc94268c.png">



## Steps for reproduction

1. go to /dashboard
2. click create project

## 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-01-31 16:01:14 +01:00
Bogdan Chadkin 59e164fb81 Migrate styles from Tree to Build (#904)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

We are gonna store styles on Build table to be able to share them via
tokens within project. Here I migrated styles data from Tree table to
Build and combined all trees styles on a project into single array.

Rest interface did not changed, the logic is hidden in endpoints for
now. Next step will be to move the logic on client side and make rest
api thin again.
2023-01-31 14:37:55 +03:00
Roman Pominov 4ad1a3f4b2 Floating panel refactor & new Popover & MenuItemButton (#902)
1. Fixed review comments from #857 (as discussed in dm)
2. Deprecated existing Popover 
3. Implemented new Popover (closes #824)
4. Added MenuItemButton (closes #866)
2023-01-31 12:27:46 +03:00
Ivan Starkov 26e8343851 Update remix (#903)
## Description

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

Seems like this killed my dev expierence

https://github.com/remix-run/remix/issues/3123

Fixed in 1.12 gonna try, as otherwise I have 100% cpu load, and need to
stop `pnpm dev` before any changes

## 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-01-31 12:13:37 +04:00
5d8fc645c1 Figma tokens (#900)
Co-authored-by: markxtang <122043657+markxtang@users.noreply.github.com>
Co-authored-by: Bot (build-figma-tokens.yml) <bot@localhost>
Co-authored-by: Roman Pominov <rpominov+github@gmail.com>
2023-01-31 08:30:23 +03:00
Roman Pominov e4b96bc50b Dialog component & other updates to design-system components (#857)
1. Implemented Radix/Dialog with styles of Figma / Floating Panel:
[Demo](https://dialog-and-button--638245578b47d4399fba191a.chromatic.com/?path=/story/library-floating-panel-dialog--dialog).
Closes #831
2. Implemented Radix/Popover with styles of Figma / Floating Panel:
[Demo](https://dialog-and-button--638245578b47d4399fba191a.chromatic.com/?path=/story/library-floating-panel-popover--popover)
3. Aligned Separator with Figma
4. Aligned Title with Figma
5. Fixed some issues in Button. Closes #829
6. Cleaned up how demos under Library look visually
2023-01-30 20:02:08 +03:00
Oleg Isonen 90ce5a06b1 Connection/queue status (#893)
Fixes https://github.com/webstudio-is/webstudio-designer/issues/863

## Description

Icon used is temporary, until we have a better one. We can merge this
because we only show it when offline, so most people won't see it
anyways.

- [x] check if the sync was successful, if not - don't remove it from
the queue (or put it back) . Right now we are optimistically removing
from the queue when syncing
- [x] after 3 unsuccessful attempts to sync - show the disconnected icon
- [x] add a tooltip (like in figma) that explains that we will sync as
soon as we are online again
- [x] use `addEventListener('offline'` event listener to explain in text
of the tooltip that internet is not available, otherwise assume by
default server is not available.
- [x] When there are unsaved changes and user tries to close the window
- use onbeforeunload to tell them about it and that they will loose the
unsynced changes otherwise (until we add offline capability to save
those and sync them once online)



https://user-images.githubusercontent.com/52824/215371856-2d76a364-3918-42b6-a4eb-9693c54d5690.mp4



## Steps for reproduction

1. go to chrome network and set connection to offline or go to the wifi
and turn it off (if you are not locally running the server)


## 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-01-30 16:56:45 +01:00
Bogdan Chadkin 6c4ea46521 Add buildId and projectId relations to Tree table (#895)
Ref https://github.com/webstudio-is/webstudio-designer/issues/742
https://github.com/webstudio-is/webstudio-designer/issues/807

Here I added build and project relations to Tree to have to improve auth
security and simplify access without parsing pages.

This is necessary to migrate styles into new style sources format.
2023-01-30 14:54:41 +03:00
Ivan Starkov df580ce304 Update remix (#892)
## Description

```bash
pnpm up -r -L '@remix-run/*' 
pnpm up -r -L 'react-router-dom'
```

`react-router-dom` removed.


## 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-01-30 08:23:08 +03:00
Bogdan Chadkin 6c9ae8594f Upgrade @types/node (#891)
The latest version supports types for websubtle so no need for our types
shim.
2023-01-29 18:05:13 +03:00
Bogdan Chadkin df08c45e95 Upgrade to turbo 1.7 (#834)
We use very old version of turborepo which often fails. Here latest one
with persistent tasks for watch mode support.

We also need to enable remote caching to get turbo benefits on CI.

While the size of turbo repo grew. Since 1.3 a lot of artifacts for
unpopular systems were removed so we still get smaller node_modules.

```
du -ckd1 node_modules
-797528
+788132
```
2023-01-29 18:04:48 +03:00
Bogdan Chadkin 351f46c882 Revert lockfile reformat (#890)
Ivan accidentally formatted lockfile with prettier. I added
.prettierignore to prevent this in the future. Ideally prettier should
ignore pnpm lockfile like it does with other package managers (at least
with npm).
2023-01-29 17:17:53 +03:00
Ivan Starkov 6b2c50a183 Authorization (#836)
## Description

Add authorization layer to a project.

1. It introduces AppContext type inside `trpc-interface` project. As
this type can be shared across all projects.

2. `createContext(request):AppContext` is placed inside the designer app
it creates context and passes all params known on `remix/server` side
into authorization context.

3. Depending on env variables or SAAS trpc can be used or local so
`authorizationRouter` is a small wrapper around Zanzibar Ory Keto at
SaaS, and implements some subset of ORY operations here.

4. Checks are done on `db` level scripts.

5. On the saas side trpc wrapper around ory is already implemented and
can be checked after this will be merged.

Not everything is checked right now. Should be added later with some
caching at least during single request.

Also not this for this PR.

UI should be different for users with read/edit permissions. Also non
owners can't share links etc



TODO:
- [ ] - Migration - preview token creation for existing projects.

OSS Permission emulates following ORY schema, but without implementing
adding viewers editors etc.

```ts
/**
 * !!! THIS IS NOT typescript code !!!
 * This is Ory permission language (small subset of typescript)
 * https://www.ory.sh/docs/keto/guides/userset-rewrites
 * https://www.ory.sh/docs/keto/reference/ory-permission-language
 *
 * See .prettierrc semicolons are disabled, as it breaks ory language parser (fixed but not in cloud)
 **/

import { Namespace, SubjectSet, Context } from "@ory/keto-namespace-types"

class User implements Namespace {}

class Token implements Namespace {}

class Email implements Namespace {
  related: {
    owner: User[]
  }
}

class Project implements Namespace {
  related: {
    owner: User[]
    editors: (Token | User | SubjectSet<Email, "owner">)[]
    viewers: (Token | User | SubjectSet<Email, "owner">)[]
  }

  /**
   * Relation rewrites:
   * For example if User:AliceUUID is owner of Project:AliceProjectUUID, then
   * we return Allowed for all 3 checks
   * `keto check User:"AliceUUID" own Project "AliceProjectUUID"`
   * `keto check User:"AliceUUID" edit Project "AliceProjectUUID"`
   * `keto check User:"AliceUUID" view Project "AliceProjectUUID"`
   * But if User:"BobUUID" is viewers of Project:AliceProjectUUID, then
   * `keto check User:"BobUUID" view Project "AliceProjectUUID"` returns Allowed
   *
   * `keto check User:"BobUUID" edit Project "AliceProjectUUID"` returns Denied
   * `keto check User:"BobUUID" own Project "AliceProjectUUID"` returns Denied
   **/
  permits = {
    view: (ctx: Context): boolean =>
      this.related.viewers.includes(ctx.subject) ||
      this.related.editors.includes(ctx.subject) ||
      this.related.owner.includes(ctx.subject),

    edit: (ctx: Context): boolean =>
      this.related.editors.includes(ctx.subject) ||
      this.related.owner.includes(ctx.subject),

    own: (ctx: Context): boolean => this.related.owner.includes(ctx.subject),
  }
}
```




## Steps for reproduction

1. click button
6. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)

## Before requesting a review

- [x] made a self-review
- [x] 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-01-29 16:57:01 +03:00
Bogdan Chadkin 1b3365e9ba Drop unused schema (#889)
DesignTokens was removed from schema but without migration. Removed
everything else unused too.

- Tree.presetStyles
- InstanceProps
- DesignTokens
2023-01-29 15:27:11 +03:00
Bogdan Chadkin b99d4bb308 Fix undo/redo when input is focused (#888)
Ref https://github.com/webstudio-is/webstudio-designer/issues/755

react-hotkeys by default prevents reacting when native elements are
focused. Here I globally enabled input, select and textarea for both
designer and canvas to catch undo/redo while focused.
2023-01-29 14:02:56 +03:00
Bogdan Chadkin 9221c23234 Delete instance styles and props (#887)
Ref https://github.com/webstudio-is/webstudio-designer/issues/828

Delete instance along with own and descendants styles and props.
This will let us to avoid bloating db with unused data.
2023-01-29 14:02:36 +03:00
Oleg Isonen e925d26bc9 Delete design tokens prototype (#873)
## Description

1. With all the new ideas and directions we don't need that initial
implementation

## 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-01-28 18:05:53 +01:00
Bogdan Chadkin 8d95c14f28 Fix copy paste of props and styles (#885)
Copy/paste of props and styles was broken while converting to normalized
data. Here fixed both by providing new instanceId.
2023-01-28 19:28:07 +03:00
Oleg Isonen dbaa617dca Ensure tab works on the flex grid control as a single control (#874)
Closes https://github.com/webstudio-is/webstudio-designer/issues/736

## Description

Before that you would have to tab through every knob from inside the
flex grid control to get to the next element. For now we are making it
just tabbable as a single thing. Later we can add arrow keys.

Also aligned colors with figma.

## Steps for reproduction

1. Make some element to flex container
2. Focus search on style panel
3. start tabbing, make sure you can tab through all controls in the flex
UI, like you would expect

## 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-01-28 16:23:21 +01:00
Bogdan Chadkin 8635dc6755 Switch to normalized props on server (#883)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Now all props is migrated on client side, we can drop legacy store and
switch to new format server side.
2023-01-28 15:24:23 +03:00
Bogdan Chadkin ff049a000c Inject props store to sdk (#871)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

We use store to render props in sdk components. Though it's easier to
maintain actual store in designer and provide necessary data to sdk.

Here I added utilities to inject computed store on module level. Now we
can get rid of legacy store and rewrite rest api to use normalized
props.
2023-01-28 10:48:13 +03:00
Bogdan Chadkin 56222a2759 Get rid of lib folder in designer app (#870)
This folder is killing me because I ignored lib globally because fzf/ag
(fuzzy search in my editor) cannot parse `packages/*/lib` in gitignore.
2023-01-28 10:43:39 +03:00
Oleg Isonen cba726a58f Share UI (#867)
## Description

Share UI implemented as a story



https://user-images.githubusercontent.com/52824/215069285-0ee7b214-8218-4ead-a468-07a22f65e433.mp4



## Steps for reproduction

1. open stories in designer
2. share project section

## Code Review

- [ ] hi @rpominov , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview
- [ ] hi @istarkov, please check if the interface I made fits the data
layer you built

## 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-01-27 18:38:58 +01:00
Bogdan Chadkin 3f4cc69976 Migrate designer to normalized props (#868)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Here added normalized props logic to transactions and replaced
useAllUserProps with computed store.
2023-01-27 17:02:53 +03:00
Bogdan Chadkin 95e13f9bdf Fix props with assets loading (#869)
Db data with asset ids was parsed as client data with resolved assets.
Fixed by reusing props parsing/serializing logic in tree.

Asset inlining complicates code so we need to have two versions of types
and transformations.
0.24.0
2023-01-27 16:33:46 +03:00
Bogdan Chadkin 0f9043fc54 Add style sources schema (#850)
Ref https://github.com/webstudio-is/webstudio-designer/issues/807

We are gonna consolidate design token styles and local styles. On build
(project) level there will be list of styles and list of style sources
which are basically a group of styles to be referenced.

These style sources can be local with mandatory tree id or token with
optional tree id to scope a token on specific page instead of whole
project.

Tree will get new list of references to style sources.

Here resulting types

```ts
// Stored as Build.styles
type StylesItem = {
  // same as before but instead of instanceId style is referenced through style source
  styleSourceId: string,
  breakpointId,
  property,
  value
}

type StyleSourcesToken = {
  type: token
  id: string
  treeId?: string
  name: string
}

type StyleSourcesLocal = {
  type: local
  id: string
  treeId: string
  name: string
}

// Stored as Build.styleSources
type StyleSourcesItem = StyleSourcesToken | StyleSourcesLocal

// Stored as Tree.styleRefs
type StyleRefsItem = {
  instanceId: string,
  values: StyleSourcesItem['id']
}
```
0.23.0
2023-01-27 12:34:28 +03:00
Andras Bacsai a9b2fdb7ed Merge pull request #862 from webstudio-is/cf-pages-integration
Bump designer version to be in sync with other components
2023-01-27 10:11:26 +01:00
Bogdan Chadkin 2d798069f7 Replace lint-staged with nano-staged (#865)
Ref https://github.com/usmanyunusov/nano-staged

Lint-staged has a lot of dependencies and a few versions of the same
dependencies.

Nano-staged is smaller alternative used in many "nano" packages.

```diff
du -ckd1 node_modules
-766128
+763924

-900ms
+200ms
```
2023-01-27 11:43:41 +03:00
Bogdan Chadkin bf50c0c547 Move project build schema into separate package (#864)
The new package will be responsible for schema and db access to all
build and tree data.

Decoupling will let us make sdk and project thinner.
2023-01-26 21:03:17 +03:00
Bogdan Chadkin 185fb27c85 Treat component name as generic string (#861)
We want to decouple schema stored in db from sdk which generates a list
of components. Components will be added dynamically later so better
avoid component name enum.
2023-01-26 17:33:26 +03:00
Andras Bacsai 16fcce1a68 Merge branch 'main' into cf-pages-integration 2023-01-26 14:56:53 +01:00
Oleg Isonen 6fbc8813e5 More dashboard tweaks (#855)
## Description

Styling in dashboard card

## Steps for reproduction

1. go to /dashboard

## 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-01-26 13:16:07 +01:00
Bogdan Chadkin a075ee0cc0 Replace husky with simple-git-hooks (#854)
Husky have a few downsides

- requires additional .husky folder in the root
- configuration should be written to .husky folder
- changes default git config core.hooksPath to custom .husky

simple-git-hooks is simpler alternative used by many "nano" projects

- configurable with package.json
- use default .git/hooks
2023-01-26 14:37:15 +03:00
Bogdan Chadkin 2e10e164f5 Bump shallow-equal (#853)
Ref https://github.com/moroshko/shallow-equal

New release got types and builtin generic form for both objects and
arrays.
2023-01-26 13:06:38 +03:00