Commit Graph
3073 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
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
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 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 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
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
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 1f3692b43c asset status can be undefined if image was not just recently uploaded 2022-12-11 13:59:27 +00:00
Oleg Isonen b09f6ab555 add FEATURES flag to .env example 2022-12-10 11:35:49 +00:00
Oleg Isonen ecd3bf0adc Merge branch 'main' into asterix-for-FEATURES-env 2022-12-10 12:33:43 +01:00
Oleg Isonen a93bb5dd34 support asterix for FEATURES env 2022-12-10 11:32:40 +00:00
Bogdan Chadkin 7637d486a7 Redesign text toolbar (#567)
Ref https://github.com/webstudio-is/webstudio-designer/issues/555
https://github.com/webstudio-is/webstudio-designer/issues/107

Implemented icon button according new design,
added hover and disabled states for non-default variant.

Migrated text toolbar from toggle group to icon button.
Toggle between superscript and subscript.

<img width="285" alt="image"
src="https://user-images.githubusercontent.com/5635476/206522786-28cc6b7d-6336-4c13-8eb7-b83428598dcb.png">

<img width="315" alt="image"
src="https://user-images.githubusercontent.com/5635476/206523165-1b4a080d-0c8d-41a1-b5a9-47c197b78998.png">

<img width="197" alt="image"
src="https://user-images.githubusercontent.com/5635476/206521819-14c1fbb3-6c37-4264-8f7b-cef256b4ab23.png">
2022-12-09 21:50:21 +03:00
Ivan Starkov 2be8511780 Add new RGB Style, then fix typescript errors (#578)
The reason of use opaque types, as otherwise props like `value` reused
everywhere.



Implemented same as CssValueInputLogic - during input editing nothing
changed.
Error is shown on Enter click. Value resetted on blur.
2022-12-09 20:31:20 +03:00
Oleg Isonen dfba947c33 Merge pull request #565 from webstudio-is/536-when-only-one-image-is-too-large-let-others-upload
Upload each asset separately
2022-12-09 15:12:35 +01:00
Oleg Isonen cd6afefa2f do runtime check instead of assertion 2022-12-09 13:57:51 +00:00
istarkov 5946b0ef0c Fix comments 2022-12-09 13:31:32 +00:00
Oleg Isonen 60a42421d7 fix linter 2022-12-09 13:20:11 +00:00
Oleg Isonen 4ed0a41a17 Merge branch 'main' into 536-when-only-one-image-is-too-large-let-others-upload 2022-12-09 11:28:27 +00:00
istarkov b68da38d2b remove console 2022-12-09 09:23:29 +00:00
istarkov b7d8989f63 Fix menu not closed on blur 2022-12-09 09:22:16 +00:00
Andras Bacsai a995647084 fix:eslint, bump versions 2022-12-09 09:26:52 +01:00
Andras Bacsai 475c00030c fix: eslint 2022-12-09 09:14:55 +01:00