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.
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']
}
```
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
```
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.
## 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
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
## Description
Styling tweaks
## Steps for reproduction
1. open /dashboard
## 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
## Description
This is not a complete dashboard implementation, but it can now list,
create and open projects, so it can be deployed to production and
replace the old version while we work on the remaining features.
In addition implemented: renaming, duplicating, deletion (mark as
deleted), keyboard accessibility
## Steps for reproduction
1. click on card to open the project in the designer
1. click on a link at the card bottom if project is published to open
published version
1. click on new project and create new project
2. click on rename over menu to rename
3. click on duplicate
4. click on delete
5. Use tab to switch between projects, use arrow keys to switch between
focusable elements inside the project card
## 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, we need to discuss how we want to build the future
APIs with TRPC and probably rewrite what I did here right away
## 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
Co-authored-by: istarkov <istarkov@gmail.com>
After discussing with @kof figured we do not need to store preset styles
in db as after sdk upgrade components may still break.
Sdk versioning along with its hardcoded values will solve the problem
better.
Closes#798.
I've implemented "Menu" and "Menu item" from Figma and updated our
components that use menus.
TODO at some later point:
- Component: "Menu Item Large"
- Type of "Menu" component: "Dropdown w/large items"
- Type of "Menu" component: "Context menu"
Recently added support for synchronization of non-immerhin stores. Here
refactored instance hovering from pubsub to such stores.
Designer and canvas can both set hovered instance id and instance
connector subscribes to these changes and sends to designer outline
rect.
selectedInstanceData update is sent from canvas after every render in
effect. The latency can be avoided by subscribing to selectedInstanceId
directly. For styles added new store selectedInstanceBrowserStyle and
synchronized it the same way. Works without flashing in UI even without
reset.
## Description
1. deleted inner glow tokens since no one is using them.
2. Organized text styles and atomic text styles such as font-weight and
line-height
3. modified some colors related to the project card component used in
the dashboard.
Co-authored-by: Roman Pominov <rpominov+github@gmail.com>
Co-authored-by: Taylor Nowotny <86495896+taylornowotny@users.noreply.github.com>
Co-authored-by: Bot (build-figma-tokens.yml) <bot@localhost>
We often need to sync states between canvas and designer without sending
to server. Here added logic to synchronize whole states between frames.
Almost same as immerhin logic.
Here synchronized selectedInstanceId store.
Because we tracked the tree and selected instance, traversed and updated
the value on every change which usually lead to running same code twice
in a row.
Here I added computed index for instances which can be reused in other
parts. It is generated by traversing tree. Later will be replaced with
for loop.
This allows us to store only selected id and compute instance with
`instancesById.get(selectedInstanceId)`.
This store need to be synchronized with designer to use it instead of
selected instance data in almost all cases.
Found zod allows to pass anything in transform without type checking.
This means we can easily get unexpected result. In this case we could
get undefined as asset.
As a solution I defined two versions of types, client side and stored in
db. Conversion is implemented on db routes side.
This makes data flow more clear and let us describe only two versions of
types instead of tree (in, out, client side).
Here is migration to new props type with more safe conversion to db
format. Added two versions StoredPropsItem for and PropsItem for client
and got rid of "as" casting.
The new utility allows us to subscribe to filtered array and give the
same reference when all items are the same. This prevents unnecessary
rerenders in react because getSnapshot considers value unchanged.
This is necessary for styles and we'll need same for props.
The downside is filter and shallow compare will be called on every
change for every instance. We will see if this give us performance
issues.
## Description
Not complete, everything that needs adjustments supposed to have a todo
comment
1. Added project cards
2. Variable Inter font
3. Flex space-between
https://user-images.githubusercontent.com/52824/213592204-ffb2ee3b-b613-4561-a808-31b05889bf39.mp4
## Steps for reproduction
1. open /dashboard2
## Code Review
- [ ] hi @rpominov , 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-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
1. Added `@font-face`s to `designer` and `design-system` storybooks
2. Shadow tokens are now available via `theme.shadows.somthing`
3. Typography tokens are now available like this:
```ts
import { typography, styled } from '@webstudio-is/design-system';
const Something = styled("div", typography.something)
<div className={typography.something()} />
```
## Description
just updated the color of foreground/success
Co-authored-by: markxtang <122043657+markxtang@users.noreply.github.com>
Co-authored-by: Bot (build-figma-tokens.yml) <bot@localhost>
InstanceProps is designed to store props per each instance which
requires a lot of sql updates on every props change.
Here moved per instance props into array with props for whole tree. This
way patches are safer to apply on large trees.
```
type PropsItem = {
id: string,
instanceId: string,
name: string,
required?: boolean,
type: 'number' | 'string' | 'boolean' | 'asset',
value: number | string | boolean
}
```
Renamed some styles to make it more clear which styles are brand styles
as opposed to builder styles. E.g. before the brand color styles were
distributed with the other color styles, now they are all under brand.
grouping. Also renamed the atomic typography tokens such as font-size so
they are in order (smallest value to highest value corresponds to first
to last in the array)
## Description
The first piece of the new dashboard - empty state for the projects
section.
Lots of design system values are not coming from Figma yet because Mark
is still on it.
Its not live, only visible over /dashboard2
<img width="960" alt="Screenshot 2023-01-19 at 00 33 19"
src="https://user-images.githubusercontent.com/52824/213328060-c84a18d5-3dd2-43d6-a70d-cdf8cd504108.png">
## Steps for reproduction
1. go to /dashboard2
## Code Review
- [ ] hi @rpominov , 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-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
For security reasons it's important to prevent canvas from having write
access to db.
Here I moved old sync logic to designer folder and got rid of one more
event in pubsub, used atom directly.
2 Issues.
- Absense of unique index caused huge update times like 100ms.
- updateMany creates implicit transaction which in prisma has very small
timeouts
Forgot to migrate it to our build-package script before. Now we got rid
of tsup.
```diff
du -ckd1 node_modules
-804060
+794324
```
```diff
root> pnpm build
-16s
+10s
```
## Description
1. Styling all states
<img width="353" alt="Screenshot 2023-01-14 at 15 40 54"
src="https://user-images.githubusercontent.com/52824/212480260-b37ba7c4-7fde-45c7-beba-5e79980aadd7.png">
2. Functionality overview
- Type a new input with autocomplete
- Select an existing source from a list
- Enter a new source
- Hover the source to see the menu
- Menu provides: Remove, Duplicate, Disable, Edit name
- Drag and drop to reorder
- Click to toggle select/unselect
- Double click to edit name
- Local source can only be disabled, nothing else should be possible
- Hit Backspace to delete the last Source item when you are in the input
https://user-images.githubusercontent.com/52824/212717241-eb694803-ee50-4054-bdd6-faaa6ffb197b.mp4
## Steps for reproduction
1. open stories in the designer
3. check all possible states are according to
[figma](https://www.figma.com/file/sfCE7iLS0k25qCxiifQNLE/%F0%9F%93%9A-Webstudio-Library?node-id=947%3A3701&t=GviFHhyBu6zfoxRk-4)
## Code Review
- [ ] hi @rpominov , I need you to do
- conceptual review (architecture, feature-correctness)
- check how I exposed buttonStyle from design system
- [ ] hi @taylornowotny
- please try in storybook and see if you find mistakes. Autocomplete
list/menu is not done, only the style sources.
## 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
Co-authored-by: Roman Pominov <rpominov+github@gmail.com>
Extracted from
https://github.com/webstudio-is/webstudio-designer/pull/797 for upcoming
dashboard split into separate app
## Code Review
- [ ] hi @kof, 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-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
I've replaced all `"$something$something"` CSS variables with
`variables.something.something`. Now we have autocomplete and
type-safety: if a variable is removed or renamed w/o fixing the usage
the build will fail.
This will allow designers to change design tokens and either make sure
nothing is broken or if something is broken we'll know exactly what and
it will be easy to fix.
Discussed here:
https://discord.com/channels/955905230107738152/1061992022665334837
We no longer need to use pubsub to notify canvas to change something and
duplicate logic in designer.
Here updated syncrhonized state directly and replaced tokens utils with
generic array utils.
## Description
Cleanup unused rest endpoints
## 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
## Description
closes#790
1. This PR adds `returnTo` search parameter to `/login` page _now we can
return logged user to the page he visited initially_
2. This PR enforces user to login in case of project clone
`/rest/project/clone/webstudiois`
_returnTo is in cookie because no way I found to put it into oauth state
etc parameter, and seems like its recommended way for remix auth_
## Steps for reproduction
### Test A
Visit any of your projects.
Copy pathname.
Logout.
Create URL `https://{SITE_URL}/login?returnTo={YOUR_PROJECT_PATH}`
Visit it.
After login you will be redirected to
`https://{SITE_URL}/login?returnTo={YOUR_PROJECT_PATH}`
### Test B
Delete all projects you have.
Logout.
Visit `http://{SITE_URL}/rest/project/clone/webstudiois`
You will be asked to login, and then redirected to cloned project.
## Code Review
- [ ] 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
- [ ] 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
## Description
ref #548
New `trpc-interface` package.
It's intended to implement various TRPC services we are going to use.
But it can act as a proxy for TRPC services implemented at SAAS and at
open source.
Exposes: `createTRPCProxyServiceClient` method, and `SharedRouter` type.
`createTRPCProxyServiceClient` creates
[createTRPCProxyClient](https://trpc.io/docs/vanilla#initialize-a-trpc-client)
for the local TRCP router, or for a remote TRPC server.
`SharedRouter` type information would be used at SAAS to check that SAAS
services have the same API interface as open-source TRPC.
The current implementation has just an example call `authorize.check`,
without any logic. And used just to check that everything works.
## Steps for reproduction
## 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
- [ ] 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
## Description
Login looks terrible, we need a proper design, so I just removed
unnecessary elements and made the buttons neutral
<img width="506" alt="Screenshot 2023-01-16 at 14 38 25"
src="https://user-images.githubusercontent.com/52824/212703640-af16ad13-e8b4-4a8e-aca0-ff735d0f4d79.png">
## Steps for reproduction
1. open login
## 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-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