Commit Graph
5224 Commits
Author SHA1 Message Date
Oleg Isonen ce5cfeca0a Add object position property (#708)
## Description

Somehow we forgot to add object-position

## Steps for reproduction

1. select instance
2. go to sizes section in style panel

## Code Review

- [ ] hi @istarkov  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

- [ ] 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
2022-12-27 13:21:45 +01:00
Ivan Starkov ef5aec742d Add Background image to Designer app (without image-set) (#707)
## Description

ref  #534

PR atop of #701

Next PR: image-set support

Ability to select background image from asset

<img width="496" alt="image"
src="https://user-images.githubusercontent.com/5077042/209625480-f0b4b5a0-8ca7-438d-bbd8-3b4874f9428d.png">


## Steps for reproduction

Create a div, and select an asset for the background image.


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

- [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
2022-12-27 13:57:42 +03:00
Ivan Starkov 6150dc0599 Background image DB support (#701)
## Description

ref  #534

Next PR #705

Db support for ImageValue style.
Having that ImageValue can contain assets we need to transform assets to
`assetId` and back during save/load.

`zod + dataloader` is used for transform for simplicity, allows avoiding
tree traversal, and highly simplifies code.

_I want to merge it to not make one huge PR, it has no breaking changes,
just a new feature save/load support_

## Steps for reproduction

## Code Review

- [x] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
- [x] hi @TrySound, I need 
 - 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
2022-12-27 13:17:22 +03:00
Bogdan Chadkin 9fcaac94b3 Drop section style (#703)
It's just an additional and confusing "style" term. Also spread is often
not safe to use so better explicitly pass all needed props.
2022-12-26 21:50:59 +03:00
Bogdan Chadkin 983fb650de Access style config by property (#702)
Since style config is hardcoded in module scope we can access it by
property instead of passing style config everywhere.
2022-12-26 20:24:45 +03:00
Bogdan Chadkin 7daff34c21 Pass property to control (#700)
We might not need to pass style config everywhere and instead we can
pass only property.

In another PR will remove passing style configs everywhere.
2022-12-26 19:49:15 +03:00
Bogdan Chadkin b6a1688d44 Drop getFinalValue (#699)
This utility was added to hover control edge cases which are handled by
controls or was a hack to convert old data in db.
2022-12-26 16:48:07 +03:00
Bogdan Chadkin a82eee9c4b Switch from LoaderFunction to LoaderArgs (#697)
Ref https://github.com/remix-run/remix/releases/tag/remix%401.6.5

Now loader and action data can be inferred
2022-12-26 16:29:11 +03:00
Bogdan Chadkin ee53b09c32 Drop inherited style from style panel (#698)
The logic does not work correctly and not really used because we never
set values to "inherit".

Later new logic will be added to show the source of values.
2022-12-26 16:08:37 +03:00
Bogdan Chadkin 17f83f874d Bump to remix 1.6.8 (#695)
- https://github.com/remix-run/remix/releases/tag/remix%401.6.8
- https://github.com/remix-run/remix/releases/tag/remix%401.6.7
- https://github.com/remix-run/remix/releases/tag/remix%401.6.6
- https://github.com/remix-run/remix/releases/tag/remix%401.6.5

Gonna upgrade step by step so we could narrow troubling versions.
Here narrowed to single version of remix in designer and packages.

```diff
du -ckd1 node_modules
-813512
+795580
```
2022-12-25 16:31:45 +03:00
Bogdan Chadkin 7734458552 Bump to remix 1.6.8 (#695)
- https://github.com/remix-run/remix/releases/tag/remix%401.6.8
- https://github.com/remix-run/remix/releases/tag/remix%401.6.7
- https://github.com/remix-run/remix/releases/tag/remix%401.6.6
- https://github.com/remix-run/remix/releases/tag/remix%401.6.5

Gonna upgrade step by step so we could narrow troubling versions.
Here narrowed to single version of remix in designer and packages.

```diff
du -ckd1 node_modules
-813512
+795580
```
2022-12-25 16:28:51 +03:00
Ivan Starkov 3ef9b92126 Bump versions (#693)
## 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
2022-12-24 20:20:07 +03:00
Ivan Starkov 04a1566606 Fix onComplete event lost if was tab during opened menu and nothing selected (#690)
## Description

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

## Steps for reproduction

Click into css-input, delete everything -  menu occured
Click tab - must show red rectangle instead of just tabbing into new
control

## 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
2022-12-24 18:40:52 +03:00
Bogdan Chadkin 57bc857fe3 Fix hover outline (#689)
Found an issue when hover a few elements fast and then move cursor out
of iframe hover gets stuck on some element. This is because we use
combination of mouseover and mouseout events.

So when we move out of one instance to another it looks like this

over
out
over
out

Which may lead to race conditions. So here out is canceled by every
hover and delayed a little to always emit last.
2022-12-24 11:41:55 +03:00
Bogdan Chadkin c696078796 Hide outline when window is resizing (#688)
Ref https://github.com/webstudio-is/webstudio-designer/issues/446
https://github.com/webstudio-is/webstudio-designer/issues/638

Here I solved 2 issues.

Outline is hidden while canvas is resizing.
And after resizing outline rect is recomputed.
2022-12-24 11:39:16 +03:00
Bogdan Chadkin e7af8d0a6e Fix flex grid control states (#682)
Ref https://github.com/webstudio-is/webstudio-designer/issues/590

Solution is simple. To represent flexbox we just use flexbox.
It does not strictly follow design but follow actual flexbox behaviour.
2022-12-23 21:47:08 +03:00
Ivan Starkov 461cd91901 Add delay to spacing tooltip (#686)
## Description

Add delay to spacing control tooltip.

## Steps for reproduction

1. Hover spacing controls, see tooltip delayed

## Code Review

- [ ] hi @kof, I need you to do
  - test it on preview
- [ ] hi @rpominov just your code changed a little, FYI

## 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
2022-12-23 19:59:43 +03:00
Ivan Starkov afe90ba789 Fix ESC to work at unit menu (#680)
closes #656

Following test case at #673 didn't work:

Click unit px
Hover over items
Press ESC - instead of closing menu it resets input and only 2nd ESC
closes the menu.

*The issue is Tooltip + UnitSelect.*

UnitSelect set 'focus" on Item on hover.
So hovering over the menu causes a lot of blur/focus events dispatched
to the ancestors.
Tooltip at the top closes/opens very fast (not visible but internally it
is).
That cause
https://github.com/radix-ui/primitives/blob/e861c16f20fe8e2e440983355edf2ec78cc2a51c/packages/react/dismissable-layer/src/DismissableLayer.tsx#L105
to think that Tooltip popover is now at the top layer. And prevent
`onEscapeKeyDown` to be executed.

Current hack somehow improves the situation. But seems like better would
be to disable the tooltip in case of focus/blur of the whole control.
Not sure it's needed at all as we have the label.

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

- [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
2022-12-23 19:10:30 +03:00
Oleg Isonen 27dc15e63e Remove unused components, deprecate components consistently (#683)
## Description

1. Remove unused components, some of which will be reintroduced once we
start using them with designed styles, right now its confusing because
they were copied from modulz example repo and never adjusted with our
design system
2. Deprecated consistently

## Code Review

- [ ] hi @istarkov  , 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
- [x] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2022-12-23 15:27:51 +01:00
Bogdan Chadkin 7e19e4f7dc Hide outline when preview styles (#663)
## Description

Ref https://github.com/webstudio-is/webstudio-designer/issues/625

Frequently changed style values with for example scrub makes outline
look laggy because of latency between iframe and designer (where outline
is rendered).

Here I subscribed to previewStyle and send undefined to hide rect. We do
the same when scroll canvas and cannot update outline fast.
2022-12-23 13:49:25 +03:00
Oleg Isonen 8e727a9e47 Don't populate an instance on paste, because its already populated (#681)
Fixes https://github.com/webstudio-is/webstudio-designer/issues/631

## Description

Can't change width of a copied box 

## Steps for reproduction

1. Add a Box
2. Select the Box and copy it (cmd+c)
3. Select Body
4. Paste (cmd+v)
5. Select the copy you've just pasted
6. Try to change its width
7. Observe that even though the number in input changes the actual width
of the Box on canvas stays the same


https://user-images.githubusercontent.com/825702/207803118-5b6fedd8-ded4-4a03-97b9-d4d6cff6710a.mov


## Code Review

- [ ] 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)
- [x] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [x] added tests
- [x] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2022-12-23 10:10:01 +01:00
Oleg Isonen c4098bb756 Merge pull request #679 from webstudio-is/677-setting-custom-font-sets-the-font-weight-value-to-empty
Apply the first available weight when current weight isn't supported
2022-12-22 15:27:52 +00:00
Oleg Isonen 65f916ddd1 apply the first available weight when current weight isn't supported by the custom font 2022-12-22 14:59:23 +00:00
Bogdan Chadkin badd5e6ff5 Replace concurrently with shell emulator (#678)
Pnpm supports yarn shell emulator under flag which fixes a few shell
bugs and works the same on all operating systems.

Here it replaced huge concurrently library.

```diff
du -ck node_modules
-829592
+813384
```
2022-12-22 17:49:27 +03:00
Bogdan Chadkin 845d53981c Improve packages publish (#676)
- all workspace dependencies are use with `workspace:^` protocol which
on publish is replaced with `^VERSION`. This will let us to upgrade
transitive packages in saas without shaman dancing around package.json
and lockfile.
- publish-to-npm script is replaced with `pnpm -r publish` which
recursively publishes all packages if version does not exist in npm
- dropped yarn lockfile
2022-12-22 17:06:27 +03:00
Ivan Starkov d69b2622d7 CSSValueInput ESC support, do not save if nothing has changed (#673)
ref #656
closes #644


## 1 Case is not fixed in this PR

Click unit px
Hover over items
Press ESC - instead of closing menu it resets input and only 2nd ESC
closes the menu.

Will do in next PR




## Description

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

## Steps for reproduction

### Save behavior

**Case 1.**
Click into "resetted" input field 
Click outside - no Blue background at the input label should appear.

**Case 2.**
Start typing something in "resetted" input field.
Click ESC,
Click outside - no Blue background at the input label should appear.

**Case 3.**
Open menu in "resetted" input field. 
Hover over menu items.
Click outside - no Blue background at the input label should appear.

**Case 4.**
Start typing "au" in "resetted" input field. 
Hover over menu items.
Click ESC - menu closes.
Click ESC - value resetted.
Click outside - no Blue background at the input label should appear.

** Case 5.**
Click into the "resetted" field with `unit` value.
Delete all with delete button.
Click ESC - menu closes.
Click "ESC" - should reset to prev value
Click ouside - no Blue background at the input label should appear.

** Case 6 **
Click into the "resetted" field
Click ENTER - Blue background should appear

** Case 7 **
Click into the "resetted" field
Edit value so after Edit it will the same
Click outside - Blue background should appear



### ESC

**Case 1**
find a numeric CSS value input
change the value with some number
press ESC
number resets to the initial value

**Case 2**
find a keyword CSS value input
start typing
autocomplete list is shown
press ESC
list is closed
press ESC
value resets to initial value

**Case 3**
find a numeric CSS value input
type some number
click on unit button - list shows
press ESC - list closes
press ESC - value resets to initial value

**Case 4**
Write `autoblabla` in input
press ESC - value resets to initial value

**Case 5**
Click on menu open button
Click ESC - menu should be closed


## 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
2022-12-22 15:12:12 +03:00
Oleg Isonen 3b30097491 Merge pull request #671 from webstudio-is/662-styles-panel-layout-is-broken
Make left sidebar grow full height
2022-12-22 09:57:02 +00:00
Oleg Isonen f6ad08fe8b Merge pull request #674 from webstudio-is/632_dnd
Fix orientation detection in D&D
2022-12-22 09:28:24 +00:00
Oleg Isonen 467213c9d8 Merge branch 'main' into 632_dnd 2022-12-22 09:17:58 +00:00
Bogdan Chadkin b3c87af7c1 Migrate to pnpm for package management (#641)
- setup corepack for pnpm and forbid yarn usage with "engines" field
- converted yarn lockfile into pnpm lockfile with `pnpm import` command
- replaced yarn with pnpm in scripts and github actions, had to use
custom cache to support corepack

This PR is only migration. Will use new pnpm features in other PRs.

```diff
du -ckd1 node_modules (yarn)
- 1125032

du -ckd1 node_modules/.pnpm
+ 857456
```

Install time (including cache downloads) in github actions reduced from
42s to 23s


## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")
- [ ] what kind of review is needed?
  - [x] conceptual
  - [X] detailed
  - [ ] with testing

## Test cases

- [ ] step by step interaction description and what is expected to
happen

## 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
2022-12-22 12:16:13 +03:00
Roman Pominov 053ac6d300 fix probe 2022-12-22 12:47:56 +04:00
Oleg Isonen d961c4fa9d add grow and shrink props to Flex and set minWidth and minHeight by default to 0 2022-12-21 15:07:08 +00:00
Bogdan Chadkin 7019d50b30 Bump packages versions (#672)
Let's release
2022-12-21 17:43:33 +03:00
Oleg Isonen 50626102d1 make left sidebar grow full height 2022-12-21 14:15:48 +00:00
Roman Pominov dd33181546 Spacing UI (#550)
Implementation of new spacing UI. Closes #421
2022-12-21 14:58:13 +03:00
Roman Pominov 5576e19161 Add reason argument to onChangeComplete (#669)
## Description

Extracted this from #550 as @istarkov needs this too:
https://github.com/webstudio-is/webstudio-designer/pull/550#discussion_r1053432597

## Code Review

- [ ] hi @istarkov, 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
2022-12-21 14:47:03 +03:00
Oleg Isonen a4c0e5c070 Merge pull request #660 from webstudio-is/658-stop-overwriting-browser-cmd++-keyboard-shortcut
Use +- keys for zoom without cmd
2022-12-20 11:10:15 +00:00
Oleg Isonen a278b1d312 Merge pull request #664 from webstudio-is/662-styles-panel-layout-is-broken
Fix inspector layout when style panel sections are collapsed
2022-12-20 10:21:39 +00:00
Oleg Isonen 0e214f208e fix inspector layout when style panel sections are collapsed
it was using flex-direction raw by default which led to that space, no idea though why it worked when opened
2022-12-20 10:12:12 +00:00
Oleg Isonen a9e4c0e41f use +- keys for zoom without cmd
This enables to keep browser zoom behavior for accessilbility
2022-12-19 20:41:12 +00:00
Oleg Isonen a7127d85f2 Merge pull request #659 from webstudio-is/494-primitive-tokens
Position floating panel without hacks
2022-12-19 20:05:31 +00:00
Bogdan Chadkin 41c533271a Convert text children to nodes in tree (#654)
Ref https://github.com/webstudio-is/webstudio-designer/issues/651

We want to normalize our tree structure and need to distinct text
children with ids. Now instead of string its respresented as
```
{
  type: 'text',
  value: string
}
```

This also gives us a little type safety because typeof child ===
'string' ignores when child cannot be string.
2022-12-19 22:44:13 +03:00
Oleg Isonen 466f05f6bf consistent naming 2022-12-19 19:30:40 +00:00
Oleg Isonen 6364506509 access dom from effect 2022-12-19 19:20:16 +00:00
Oleg Isonen a21b8c5619 position floating panel without hacks 2022-12-19 18:39:19 +00:00
Oleg Isonen d4750f6a31 Merge pull request #655 from webstudio-is/kof-patch-1
Better pull request template
2022-12-19 18:37:41 +00:00
Oleg Isonen ac42cbcb43 Merge branch 'main' into kof-patch-1 2022-12-19 15:25:32 +00:00
Ivan Starkov d09ca57373 Check mark in Combo Boxes can be lost or be incorrect in case of input changes (#652)
closes #610

## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [ ] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")
- [ ] what kind of review is needed?
  - [ ] conceptual
  - [ ] detailed
  - [x] with testing

## Test cases

- [ ] step by step interaction description and what is expected to
happen

## 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
2022-12-19 18:17:36 +03:00
Oleg Isonen 9958cd9a2b Update pull_request_template.md 2022-12-19 16:17:30 +01:00
Ivan Starkov 86506a7fd3 Use resizer when we are rendering the thumbnails in image manager (#642)
closes #546
fixes image flicker on upload
fixes that uploading animation stopped and not properly centered

## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [x] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")
- [ ] what kind of review is needed?
  - [x] conceptual
  - [ ] detailed
  - [x] with testing

## Test cases

- [x] Check that images in Image manager are resized
- [x] Check that not flick of image on upload happens


## 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
2022-12-19 13:19:29 +03:00