Commit Graph
2922 Commits
Author SHA1 Message Date
Bogdan Chadkin dfab99b8d8 Drop selected element container (#648)
Looks like no longer used. All related logic moved to selected instance
connector.
2022-12-17 12:15:11 +03:00
Bogdan Chadkin ff7c1c923e Install missing deps with types (#647)
In https://github.com/webstudio-is/webstudio-designer/pull/646 I checked
with build. Now found more issues with typescript.

Also forgot to migrate to jest/globals "project" package.
2022-12-17 11:41:34 +03:00
Bogdan Chadkin 83060cd94a Send selected instance data from connector (#637)
Ref https://github.com/webstudio-is/webstudio-designer/issues/628

Same issue as with selected outline. Styles were sent from detached
element when tag prop is changed.

Moving it to selected instance connector just works because styles
already applied when effect is called and it's remounted on every style
change.
2022-12-17 10:44:58 +03:00
Oleg Isonen 703a9fe215 Merge pull request #639 from webstudio-is/621-smallest-breakpoint-should-start-from-0
Start the smallest breakpoint at 0
2022-12-16 18:35:38 +00:00
istarkov f64694397e revert rename files 2022-12-16 19:59:11 +03:00
istarkov dd02f2e7a0 rename files 2022-12-16 19:52:39 +03:00
Bogdan Chadkin 3d3b7e6d80 Install missing deps and restrict ranges (#646)
Pnpm helped to find a few dependencies were missing in projects. Some
root deps with "*" versions restricted to simplify upgrade and prevent
unwanted upgrade while migrating to pnpm.
2022-12-16 17:38:27 +03:00
Bogdan Chadkin 752768abbc Use explicit imports from @jest/globals (#645)
pnpm prevents access to jest and @types/jest from packages so we need to
explicitly install it. Though @types/jest is not officially maintained
and often late for months with new major which bloats node_modules with
two versions of jest transitives.

Here is alternative way to use official types. The only downside is
complains these types has less descriptions.
2022-12-16 16:35:22 +03:00
Oleg Isonen b79df63f33 Merge branch 'main' into 621-smallest-breakpoint-should-start-from-0 2022-12-16 13:33:25 +00:00
Roman Pominov dcd7d8c43a Fix performance issue with scrub when used inside popover (#633)
https://discord.com/channels/955905230107738152/1052545317922406440

> so the problem is useScrub wants to remove focus from input:
https://github.com/webstudio-is/webstudio-designer/blob/c70d9ff21a64da12a0562d046246a5e359d556e9/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx#L111

> but popover wants to keep focus inside content while it's open (not
configurable):
https://github.com/radix-ui/primitives/blob/81b25f4b40c54f72aeb106ca0e64e1e09655153e/packages/react/popover/src/Popover.tsx#L261-L263

> and they fight
2022-12-16 14:13:48 +03:00
Bogdan Chadkin d05b1bc21f Resolve tsconfig package (#643)
While migrating to pnpm I got an issue with our extends relying on
node_modules. pnpm have only symlinks and do not have hoisted
node_modules in the root.

Here I switched extends to package name as all tools can resolve it and
tweaked remix tsconfig to extend from packages folder instead of
node_modules.
2022-12-16 13:09:33 +03:00
Oleg Isonen 4cf8090a25 Merge branch 'main' into 621-smallest-breakpoint-should-start-from-0 2022-12-16 09:07:03 +00:00
Oleg Isonen b0b143a76a set minWidth to 360 for the canvas resize and use the lower bound of the media query 2022-12-16 09:05:16 +00:00
Ivan Starkov 0021874e79 Hide deleting assets immediately on delete (#640)
Now image delete is shown immediately on delete.
PR_1 of #546  (simplifies logic and types for image thumbnail)

## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [x] 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
  - [ ] 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-16 00:43:07 +03:00
Ivan Starkov 124f96ebe9 Fix images appears disappears during upload/delete. (#623)
closes #605

`useAssets` now use Provider to be sure that state (server data load)
updates will not be lost.


- [ ] Set random upload errors locally, and test that even with errors
it will work.

Changed Client types from instersected server Asset types to include
Asset i.e.
was 
```
type ReviewAsset = Asset & { status: 'uploading', ... }
```
now
```
export type UploadedClientAsset = {
  status: "uploaded";
  asset: Asset;
  preview: PreviewAsset | undefined;
};

export type UploadingClientAsset = {
  status: "uploading";
  asset: Asset | undefined;
  preview: PreviewAsset;
};

export type DeletingClientAsset = {
  status: "deleting";
  asset: Asset;
  preview: PreviewAsset | undefined;
};
```

As previous behavior was hard to manage, were mistakes like adding
client-only props to the Asset type. It was hard to add additional props
like having preview and asset simultaneously (will be needed in next PR
to avoid image flicker)
2022-12-15 22:35:32 +03:00
Oleg Isonen 37642beebe fix outline unit 2022-12-15 18:49:57 +00:00
Oleg Isonen 7f62539435 start the smallest breakpoint at 0 and use the upper bound to set the canvas size 2022-12-15 18:09:04 +00:00
Roman Pominov 90b00fc36a Scrub fixes (#636)
- Fixed #626
- Limited movement of cursor to just one coordinate. Not sure it's a
good idea, but currently in `main` we move both coordinates for
"horizontal" but only one for "vertical", so I've made it consistent.

## Before requesting a review

- [ ] if the PR is WIP - use draft mode
- [x] 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
  - [ ] 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-15 17:36:53 +03:00
Bogdan Chadkin 122bd8adb5 Track selected rect close to element (#627)
Ref https://github.com/webstudio-is/webstudio-designer/issues/598

When tracking selected element from the root it's hard to get current
element which can be changed with props.

One more issue is storing element in state doubles amount of renders and
in selected instance logic we have a chain of state -> effect -> state
-> effect cases.

Here I store element in ref so we avoid rerender when set element to
state. Then tracked element rect is not written to state and sent to
designer directly.

Since the effect is unmounted along with element we do not need to use
mutation observer to track parent changes and can just recompute rect on
remount.
2022-12-15 16:01:40 +03:00
Bogdan Chadkin 1459fd7cbd Remove treeId from props updates (#635)
Will help with
https://github.com/webstudio-is/webstudio-designer/issues/628

treeId is stored in every props update which complicates data flow and
requires passing it everywhere. Here I instead pass it inside of
transaction.

This allowed us pass undefined in props data when select instance so we
no longer need to create empty instance props. Updates will create it
lazily.
2022-12-15 15:56:27 +03:00
Oleg Isonen 02fedeb388 Merge pull request #629 from webstudio-is/preset-style
Rename defaultStyle  to presetStyle
2022-12-15 11:57:24 +00:00
Oleg Isonen 142fbda626 defaultStyle presetStyle 2022-12-14 23:51:01 +00:00
Bogdan Chadkin 984e8902ac Fix property reset glitches (#620)
Ref https://github.com/webstudio-is/webstudio-designer/issues/600
https://github.com/webstudio-is/webstudio-designer/issues/608

- wrapped getComputedStyle with requestAnimationFrame to recompute some
styles correctly
- added default to color picker to avoid hiding while styles are
recomputed
- added placeholder to select and font-weight to avoid hiding while
styles are recomputed
- removed undefined check from font-family, already falls back to empty
field

These issues comes from the fact we compute default styles from dom
instead of data.
2022-12-14 21:03:59 +03:00
Bogdan Chadkin c70d9ff21a Auto select span after toggling (#622)
Ref https://github.com/webstudio-is/webstudio-designer/issues/588
2022-12-13 23:58:04 +03:00
Oleg Isonen 030c40abe2 Merge pull request #618 from webstudio-is/refresh-assets-after-deletion
Refresh assets after deletion
2022-12-12 21:20:10 +00:00
Oleg Isonen 55f996878a reuse aftersubmit handler 2022-12-12 21:19:53 +00:00
Oleg Isonen 9dfcdad0db refresh assets after deletion 2022-12-12 21:13:37 +00:00
Ivan Starkov af90b31945 Bump versions (#616)
## 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?
  - [ ] conceptual
  - [ ] 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-12 23:56:10 +03:00
Ivan Starkov be0454fcbc Cache css (#612)
From MDN:
A modern best practice for static resources is to include version/hashes
in their URLs, while never modifying the resources — but instead, when
necessary, updating the resources with newer versions that have new
version-numbers/hashes, so that their URLs are different. That's called
the cache-busting pattern.
2022-12-12 23:54:07 +03:00
Bogdan Chadkin 7ccf6644b3 Show only important values in "display" select (#609)
Ref https://github.com/webstudio-is/webstudio-designer/issues/261
https://github.com/webstudio-is/webstudio-designer/issues/603

- filtered to show only important values
- always show display as select instead of combobox for non-flex values

<img width="260" alt="image"
src="https://user-images.githubusercontent.com/5635476/207092221-6fb40908-4696-471a-aedf-7e94808d5668.png">
2022-12-12 23:17:32 +03:00
Ivan Starkov 23a19b682e Enter has no effect if menu is open and no value selected (#607)
Fixes Enter non-working part of #603, but not fixes Check mark showing
logic.
The wrong value is used to compare the selected field,
https://github.com/webstudio-is/webstudio-designer/blob/26d0d0c2a6b3fe21c2298e451ffea5adc350290e/packages/design-system/src/components/combobox.tsx#L203
as its compares with current item but not with already selected
2022-12-12 18:25:37 +03:00
Mateusz Burzyński 35af8358e9 Move @webstudio-is/design-tokens to @webstudio-is/react-sdk prod deps (#602)
This should fix the problem reported on this line:
https://github.com/webstudio-is/webstudio-saas/actions/runs/3657427162/jobs/6181006430#step:6:52
, cc @andrasbacsai

Even though [you only reach for a
type](https://github.com/webstudio-is/webstudio-designer/blob/1a66acb79c8c560b3a54b55512c2779991a68eff/packages/react-sdk/src/tree/root.ts#L11),
you still should declare this package among your dependencies -
otherwise, it won't be installed by your consumers and thus the TS
compilation will fail for them.
2022-12-12 15:44:32 +01:00
Bogdan Chadkin aba5506e13 Add proprety reset button in popover (#583)
Ref https://github.com/webstudio-is/webstudio-designer/issues/29

<img width="281" alt="Screenshot 2022-12-10 at 12 03 54"
src="https://user-images.githubusercontent.com/5635476/206842519-5812b7d5-2c60-4941-93a7-8a980f6abae0.png">
2022-12-12 15:11:24 +03:00
Oleg Isonen 1a66acb79c fix the type 2022-12-12 11:39:54 +00:00
Oleg Isonen ef43c49bd4 Merge pull request #601 from webstudio-is/bump-versions
Bump versions
2022-12-12 11:32:10 +00:00
Ivan Starkov 12a3da3140 Bump versions 2022-12-12 14:17:23 +03:00
Oleg Isonen 594e61a91a Merge pull request #599 from webstudio-is/initial-props
Add initial props
2022-12-12 10:59:22 +00:00
Ivan Starkov 54f16748d2 Fix switch 2022-12-12 13:51:29 +03:00
Ivan Starkov 84c0e4b145 Remove delete button for required prop 2022-12-12 13:34:20 +03:00
Ivan Starkov d19c5e7aa0 Change title 2022-12-12 12:05:26 +03:00
Ivan Starkov a50199a19d Add tests 2022-12-12 12:03:29 +03:00
Ivan Starkov f4d55b8cb0 Fix overwrite issue 2022-12-12 11:40:04 +03:00
Ivan Starkov a1138b5948 Do not allow enter existing prop from input 2022-12-12 11:13:27 +03:00
Ivan Starkov 035b0c8b42 Do not allow to change/delete "required", select existing 2022-12-12 10:59:39 +03:00
Ivan Starkov 1ac167d959 Add initial props 2022-12-12 00:14:43 +03:00
Ivan Starkov 5d9f8c68b1 Fix alpha didn't changed (#597)
Absence of exact types, stupid bugs.


## 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?
  - [ ] conceptual
  - [ ] 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-11 20:32:46 +03:00
Oleg Isonen 7232fe2f9b Merge pull request #596 from webstudio-is/592-font-family-button-changes-size
Don't let an input/button grow beyond the layout constraint
2022-12-11 17:09:58 +00:00
Oleg Isonen f23c4fa73a Merge pull request #595 from webstudio-is/593-custom-fonts-not-rendering-on-canvas
Asset status can be undefined if image was not just recently uploaded
2022-12-11 16:28:39 +00:00
Oleg Isonen da692ba926 Merge branch 'main' into 593-custom-fonts-not-rendering-on-canvas 2022-12-11 14:46:05 +00:00
Oleg Isonen 83033f25b3 Merge branch 'main' into 592-font-family-button-changes-size 2022-12-11 14:45:39 +00:00