Commit Graph
3073 Commits
Author SHA1 Message Date
Bogdan Chadkin f8fb928436 Migrate hovered outline to synchronized stores (#846)
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.
2023-01-25 12:38:29 +03:00
Bogdan Chadkin d612a33991 Migrate designer to selected instance store (#844)
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.
2023-01-25 10:18:34 +03:00
Bogdan Chadkin 83f03e2254 Synchronize non-immerhin stores (#843)
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.
2023-01-24 20:58:41 +03:00
Bogdan Chadkin 57a43cda6c Use instances index to compute selected instance (#839)
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.
2023-01-24 14:19:46 +03:00
Andras Bacsai 30f600a92c Bump designer version to by in sync with other components 2023-01-24 09:47:21 +01:00
Bogdan Chadkin 846240abc8 Add new label for style panel (#820)
Used new local/remote terms instead of set/inherited from figma for
color here.

<img width="309" alt="Screenshot 2023-01-20 at 14 06 35"
src="https://user-images.githubusercontent.com/5635476/213681171-dcc6bd6d-2d31-42fb-9e6a-49c90da3ab6f.png">
2023-01-23 11:56:36 +03:00
Bogdan Chadkin bb288f309b Replace UserProp with PropsItem (#833)
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.
2023-01-22 15:57:37 +03:00
Bogdan Chadkin 1da64faf4f Add shallowComputed nanostores utility (#827)
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.
2023-01-22 10:14:34 +03:00
Oleg Isonen 72073cb30a Dashboard redesign - project cards (#817)
## 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
2023-01-21 22:40:11 +01:00
Roman Pominov 9ff8c74692 Make shadow and typography tokens available to be used in code (#821)
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()} />
```
2023-01-21 08:53:52 +03:00
Oleg Isonen 011257f0ab Dashboard redesign (#809)
## 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
2023-01-19 16:33:35 +01:00
Bogdan Chadkin ca6bdb34a9 Deprecate label component (#810)
Gonna start over to align with design system.
2023-01-19 13:23:54 +03:00
Bogdan Chadkin e03dbecb3b Sync patches with server in designer (#813)
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.
2023-01-19 13:17:02 +03:00
Ivan Starkov d17b7a1b27 Fix Transaction already closed: Could not perform operation on InstanceProps (#811)
2 Issues.
- Absense of unique index caused huge update times like 100ms.
- updateMany creates implicit transaction which in prisma has very small
timeouts
2023-01-19 10:48:02 +03:00
Oleg IsonenandRoman Pominov e790af958a Style source input states (#785)
## 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>
2023-01-18 00:12:50 +01:00
Bogdan Chadkin 2c8395b4d0 Add feature-flags package (#800)
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
2023-01-17 20:08:35 +01:00
Roman Pominov a1edc22be1 Type-safe CSS Stitches' variables (#792)
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
2023-01-17 09:36:24 +03:00
Bogdan Chadkin 0d52c8949f Update token store directly (#796)
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.
2023-01-16 23:53:12 +03:00
Ivan Starkov 537ae78786 Cleanup rest (#795)
## 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
2023-01-16 22:35:39 +03:00
Ivan Starkov 1ad428c79a Add returnTo support for login, disable cloning without login (#794)
## 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
2023-01-16 21:32:35 +03:00
Ivan Starkov 2f171e0f42 Add initial trpc interface package (#780)
## 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
2023-01-16 21:31:58 +03:00
Oleg Isonen e0b52fb612 Login visual fixes (#793)
## 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
2023-01-16 16:02:41 +01:00
Bogdan Chadkin b40c967ee2 Use props state instead of local one (#786)
Since we have synchronization of props state. Local one can be replaced
so the logic will not longer be duplicated.

Here also fixed the issue with showing all stored props right after copy
paste. Before only required once were shown.
2023-01-15 16:16:00 +03:00
Bogdan Chadkin 1c7ba335ac Use props from synchronize state instead of selected instance (#787)
Props state is synchronized between designer and canvas. We can safely
get rid of sending props in selectInstance event.
2023-01-15 12:19:42 +03:00
Bogdan Chadkin 35354522d9 Move props updates to designer (#784)
Props have a lot of logic to synchronize values. And after moving
updates into designer we get fresh state instantly and can simplify the
logic even more.
2023-01-14 14:11:26 +03:00
Bogdan Chadkin f9052681a3 Simplify props state (#783)
Turns out we store whole db representation in each props each per
instance item. This is wasteful and increase complexity of code.

```
{
  [InstanceId]: {
    id: UUID,
    instanceId: InstanceId,
    treeId: TreeId,
    props: UserProp[]
  }
}
```

Where instance id is duplicated and tree id is provided as patch
context. Id can be replaced with combination of instance id and tree id.

```
{
  [InstanceId]:  UserProp[]
}
```
2023-01-14 12:46:49 +03:00
Bogdan Chadkin 00da9c8e86 Move breakpoints logic to designer (#782)
We have stores synchronization and can move the logic from canvas to
designer.

Here refactored this way breakpoints, got rid from direct atom changes
without store and removed breakpoints pub sub events.
2023-01-13 19:32:23 +03:00
Oleg IsonenandRoman Pominov f9f64934db Style source input (#776)
## Description

1. color coding of style sources, handling DoubleClick and ESC
<img width="376" alt="Screenshot 2023-01-13 at 00 20 18"
src="https://user-images.githubusercontent.com/52824/212208704-df1aa071-7f67-43b8-9e1a-c4986b2c80d5.png">


## Steps for reproduction

1. open storybook
3. double click to edit name
4. esc to revert editing
5. new colors and states

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

Co-authored-by: Roman Pominov <rpominov+github@gmail.com>
2023-01-13 13:35:07 +01:00
Bogdan Chadkin 3abb54a875 Migrate to nanostores (#779)
Ref https://github.com/nanostores/nanostores

Nanostores is another open source implementation of reactive states.
Supports a lot of frameworks and provides useful utilities like computed
stores. Api is slightly different

```
store.get(): Value
store.set(value: Value)
```

`useStore` resolves only value so I temporary added custom `useValue` to
not rewrite whole project. Since we gonna use computed atoms it makes
more sense to invoke useStore where atom value is used instead of
reusable hook.
2023-01-13 15:13:40 +03:00
Bogdan Chadkin 44a7083fde Drop css rules from instance (#775)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Finally got rid of legacy instance.cssRules.
Removed style utils for working with tree.
Now will be easier to normalize tree.
2023-01-13 13:04:21 +03:00
Roman Pominov 5fac01020f Update Button (#751)
New `Button` implementation based on the component in Figma. Closes #450
2023-01-13 09:43:30 +03:00
Oleg IsonenandRoman Pominov 0f90b779f7 Current item in style source UI (#774)
## Description

1. Now we can pass currentIndex and user can click on an item to make it
current.

## Steps for reproduction

1. open style source UI in stories
2. click item to make it current

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

Co-authored-by: Roman Pominov <rpominov+github@gmail.com>
2023-01-12 23:05:48 +01:00
Bogdan Chadkin 145155f12e Use normalized styles in style panel (#773)
Here rewritten style info computing with normalized styles list. Was
able to get rid of sending element css rules from canvas.
2023-01-13 00:14:54 +03:00
Bogdan Chadkin 2c3027d10b Improve size section layout according to design (#760)
Ref https://github.com/webstudio-is/webstudio-designer/issues/759

Spacing a little not clear so wrapped with common grid

<img width="237" alt="Screenshot 2023-01-10 at 16 55 40"
src="https://user-images.githubusercontent.com/5635476/211570996-0c3349ee-a4d7-4b95-9143-2afd8436da2d.png">
2023-01-12 13:00:03 +03:00
Bogdan Chadkin 9ec401f834 Update store in style panel directly (#771)
Before we sent messages from designer to canvas, patched data and sent
whole data back to designner.

This created latency so we had to keep local state and synchronize it
with effects.

Here I patched store and used its state in designer which is same as
local state. So we no longer need effect synchronization (and bugs
because of it).
2023-01-12 12:49:34 +03:00
Oleg IsonenandRoman Pominov 6a5fa7822a Sortable style source items (#770)
## Description

1. This adds ability to drag&drop style source items

## Steps for reproduction

1. open stories
2. get 2+ items
3. start dragging

## Code Review

- [ ] hi @rpominov , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
- help finish the sortable implementation: restrict drop targets, maybe
add a preview item to the draggable, can go without it though for now



## 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>
2023-01-12 10:21:58 +01:00
Bogdan Chadkin a00460fbe8 Synchronize transactions created in designer (#768)
We finally can change states connected to immerhin from designer. Here I
added subscription to designer changes and fixed cyclic events with new
"source" parameter provided on transaction creation.
2023-01-11 22:06:50 +03:00
Oleg Isonen c7d7ede59a Implement disable function for style source input (#761)
## Description

1. Added a way to disable/enable style source item

## Steps for reproduction

1. source item menu > disable
2. source item menu > enable

## Code Review

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

## 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)
- [x] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [x] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-01-11 11:26:03 +01:00
Bogdan Chadkin 6387029b3c Synchronize canvas store with designer (#762)
Here used immerhin subscribe method to send patches from canvas to
desiger instead of uploading full states when their value is changed.

Syncrhonization is still one-way. Need more changes in immerhin to make
two-way patches work.
2023-01-11 13:15:43 +03:00
Oleg Isonen 9afd279797 Style source input (#752)
## Description

Final goal is this UI
https://www.figma.com/file/EfzZ2w94KpmUviZJSBgxCd/%F0%9F%92%AD-Webstudio-Design-Work?node-id=4059%3A31089&t=OfXAB2MIAR7fyjfC-0

This is not complete by far, so far added functionality:

- [x] Menu
- [x] Rename
- [x] Duplicate
- [x] Remove
- [x] Edit directly in the style source
- [x] Allow renaming on click on style source item

## Steps for reproduction

[1. see
video](https://user-images.githubusercontent.com/52824/211120782-07d75fd0-4fcc-4676-8411-3a5966ee2e2c.mp4)


## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
- [ ] hi @rpominov , 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-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-09 17:26:59 +01:00
Bogdan Chadkin 8a691b92d1 Update normalized styles directly (#757)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Migrated updating and rendering to normalized styles. There are still a
few cases to migrate so left legacy root instance updates.

Styles are updated with immerhin consistently with whole project.

Can be tested changing styles and deleting breakpoints.
2023-01-09 12:17:20 +03:00
Bogdan Chadkin 6387accf0d Render static css from normalized styles (#750)
Ref https://github.com/webstudio-is/webstudio-designer/issues/696

Gradually starting to migrate to new styles format. Here replaced
getCssRules and getPresetStylesMap with getStyleRules and
getPresetStyleRules utilities.

Will reuse both at once on release.
2023-01-06 16:44:03 +03:00
Bogdan Chadkin f2a851cb5b Bump remix to 1.9.0 (#740)
- https://github.com/remix-run/remix/releases/tag/remix%401.8.0
- https://github.com/remix-run/remix/releases/tag/remix%401.9.0

Build issue still not fixed
(https://github.com/webstudio-is/webstudio-designer/pull/725)
2023-01-05 21:27:55 +03:00
Bogdan Chadkin d79c96566b Store preset style separately from tree (#724)
Before we populated preset style on instance creation. This does not let
us to distinct preset style from local one.

As an option we could use preset style hardcoded in meta though this may
affect user when we change defaults.

Here I added presetStyle column in Tree table with the list of styles
for component.

```
Array<{
  component: string,
  property: string,
  value: StyleValue
}>
```

Will style controls as grey for such styles.
2023-01-05 21:27:33 +03:00
Roman Pominov 91e209e974 rename Spacing to Space (#745)
Renamed Spacing section to Space in code and in UI
2023-01-05 14:59:32 +03:00
Bogdan Chadkin f076352b29 Fix linked flex gap and replace icons (#737)
Ref https://github.com/webstudio-is/webstudio-designer/issues/538
https://github.com/webstudio-is/webstudio-designer/issues/537

Refactored linked (renamed from lock) gap. Watching values with effect
is replaced with changing row/column values in inputs callbacks.

Had to use css value input directly to maintain intermediate value for
both inputs while scrubbing.
2023-01-05 13:45:21 +03:00
Bogdan Chadkin 5fe9364cb1 Improve units in style panel (#735)
Ref https://github.com/webstudio-is/webstudio-designer/issues/366

- generate grouped units for non length values
- show unit select when initial unitless

So we get all 3 points from the issue

- all properties has only supported units
- hidden but supported units still can be entered
- unsupported values are validated

<img width="243" alt="Screenshot 2023-01-04 at 14 12 29"
src="https://user-images.githubusercontent.com/5635476/210546684-ca696096-f78c-445f-bbc3-04db7326239b.png">
<img width="224" alt="Screenshot 2023-01-04 at 14 14 54"
src="https://user-images.githubusercontent.com/5635476/210546689-396c7d42-e6f0-42a9-869c-7b231baa3d71.png">
2023-01-04 18:20:15 +03:00
Roman Pominov bf75cbb664 Keyboard support in spacing control (#723)
## Description

Adds keyboard support to the Spacing control. Closes #666

## Steps for reproduction

1. Focus spacing control using TAB
2. Blue outline should appear and "Margin Top" should get highlighted
3. Arrow keys should change highlighted item
4. `Enter` should open popover for the highlighted item
6. Mouse navigation should still work when control is focused
2023-01-04 15:28:10 +03:00
Oleg Isonen 9dfef774e3 Add a stylesheet name for easier debugging (#731)
## Description

Multiple style elements are easier to differentiate when they have some
hint on the purpose

## Steps for reproduction

1. select style element on canvas, see data-webstudio attribute with a
name

## Code Review

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

## 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)
- [x] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [x] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-01-03 21:39:25 +01:00
Bogdan Chadkin 9c71929b25 Upgrade to remix 1.7.6 (#725)
https://github.com/remix-run/remix/releases/tag/remix%401.7.0
https://github.com/remix-run/remix/releases/tag/remix%401.7.4

du -ckd1 node_modules
-795648
+798524

Not much changes though I found since
[1.7.5](https://github.com/remix-run/remix/releases/tag/remix%401.7.5)
build started to hang when run with turbo or recursive pnpm run.

Looks like in this commit some stream or connection not closed when
build is finished.

https://github.com/remix-run/remix/pull/4410

Let's see if not fixed in newer versions and then file an issue.
2023-01-03 18:24:44 +03:00