Commit Graph
1354 Commits
Author SHA1 Message Date
Bogdan Chadkin 9e8bbffaa9 Check authenticated user against db (#542)
Ref https://github.com/webstudio-is/webstudio-designer/issues/92

We store user session in storage and checked its existance to check if
user is logged in. Though where we clear db or for example delete user
this session becomes stale so we should check if user exists in db too.
2022-12-08 15:28:39 +03:00
Ivan Starkov b39e6a6376 Fix switch display (#569)
Switching display from flex on block caused error in input field

We were not able to parse display block etc

As this is not fixed for display props.
```
setProperty should be called with a style object, string is deprecated
```

So we got that "parsed not valid behavior" which we decided to be
invalid.
2022-12-08 12:07:05 +04:00
Ivan Starkov bb6a1d28e3 [progress] Naive aspectRatio (#556)
## 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-07 22:05:49 +04:00
Ivan Starkov f67e12035a Fix scrub uses other instance value (#563)
The issue is if we select on canvas instance of one Box for example, and
then other box, scrub had in the state value of first selected Box.



https://user-images.githubusercontent.com/5077042/206211694-19124e0b-5b90-4aef-8848-7ebe7f1d7bae.mov
2022-12-07 20:52:55 +04:00
Oleg Isonen adc268e7af disable dark theme for now until we got it up-to-date 2022-12-07 14:49:02 +00:00
Oleg Isonen d24766f30d fix dependency mapping for blockLevelElements
For example property clear  was  not showing up in position section because of that
2022-12-07 14:05:36 +00:00
Bogdan Chadkin 05e69ac016 Give body separate type in sdk (#560)
Body is the only container which should not be listed. After discussing
with Oleg decided to give it separate body type.
2022-12-07 16:17:33 +03:00
Ivan Starkov ffae4bd403 Make CSSValueInput controllable, (#551)
CSSValueInput used useEffect and executed onChange etc events on its
own. What in case of any small changes caused loops and strange
behavior. Now should execute everything only as a result of user input.

`parseCssValue` - now stupid parse CSS value and someday will be used
only inside text-control.
setProperty - now accepts StyleValue, the string param is deprecated,
warning set.

CSSValueInput now not update styles during editing.

unit menu now not hiding during formulas etc

fixed bug with updating style on newly created items

fixed scrub bugs with unsubscribing

css-tree Adds 52101 gzip bytes. 
A lot of size is coming from here 

https://github.com/csstree/csstree/blob/97d7f3b95a3efd8f431af39986acc149dceefa59/lib/data.js
more than 1/3 of `esm` size (20+kb gz), and most huge are properties
json we need and use.

Doesn't look tree-shakeable, anyway can be loaded lazily as until
editing we don't need to validate CSS vars.

Investigating: 
- [x] - Changing any style Combobox with mouse cause multiple value
updates to previous and current value (was a blur event issue)
2022-12-07 14:32:34 +04:00
Oleg Isonen 5c01b4baa1 replace useState hack by a helper utility that is using ref and explaining what's happening 2022-12-05 16:32:44 +00:00
Oleg Isonen 42292b2930 rewrite validation using zod 2022-12-05 16:19:54 +00:00
Oleg Isonen c33368a113 forgotten files after they were moved 2022-12-05 10:25:44 +00:00
Oleg Isonen b3c095e2f6 use immer for clarity 2022-12-05 10:17:19 +00:00
Oleg Isonen 0b5cd3dcb9 ignore changes when closing with errors 2022-12-04 11:28:10 +00:00
Oleg Isonen cb0abf4d27 move logic into a hook 2022-12-04 11:13:03 +00:00
Oleg Isonen 0c0b495ff3 split token editor into separate file 2022-12-03 20:41:27 +00:00
Oleg Isonen 662bfa580a fix schema types 2022-12-03 17:16:12 +00:00
Oleg Isonen 23a0dd5172 move casting to where we parse data 2022-12-03 17:09:53 +00:00
Oleg Isonen 26ea46de5e separate seed from token 2022-12-03 17:01:50 +00:00
Oleg Isonen 20fd50e970 useState with callback instead of ref as a way to set something once 2022-12-03 14:32:43 +00:00
Oleg Isonen 8d26bf781b move shared design tokens logic to a separate package 2022-12-03 12:09:22 +00:00
Oleg Isonen 0d07f9a27c Merge branch 'main' into 494-primitive-tokens 2022-12-03 11:41:08 +00:00
Oleg Isonen 6fd2d15ae3 scrollable tokens manager 2022-12-02 23:34:16 +00:00
Oleg Isonen 112ba9be89 tests 2022-12-02 21:01:53 +00:00
Oleg Isonen a3d9a68ee4 editing token 2022-12-02 20:36:49 +00:00
Ivan Starkov b6c6f57f2c Fix that images with asset had value inside db (#549)
ref #196

- [x] UserProps now [discriminated union by
type](https://github.com/webstudio-is/webstudio-designer/blob/img_asset/packages/react-sdk/src/user-props/schema.ts#L10-L31)

- [x] Data migrations done
2022-12-02 14:53:30 +04:00
Oleg Isonen a06a3db058 Merge branch 'main' into 494-primitive-tokens 2022-12-02 00:27:51 +00:00
Roman Pominov 55280b8348 use RemixLink in Link (#488)
Fixes #457
2022-11-29 13:42:40 +03:00
Bogdan Chadkin 6b761bb000 Replace tsc with esbuild to build packages (#543)
Build of whole monorepo without cache takes 1min or more on my laptop.
tsc is very slow tool for this. Also having rootDir in tsconfig prevents
checking outside of src folder.

Here I added "scripts" package with "build-package" bin. It does both
esm and cjs builds. --watch flag support completely replaces tsup for
us.

Now full rebuild of monorepo without cache takes only 10s including
prisma-client, http-client and designer builds.
2022-11-29 10:04:25 +03:00
Bogdan Chadkin 3e96357a2c Use sources as type deifnitions (#539)
Right now our build and CI take a lot of time. 1:40min - 2min on CI and
1min locally. We spend time on vercel, on main CI, on publish and
locally.

At the moment in packages anything outside of src folder is not checked
because of rootDir.

We have to generate "references" field on precommit.

All these issues can be avoided if remove .d.ts generation completely
and specify sources in "types" field. This way we get zero build time
for types and can switch to other build tool (like esbuild) for .js
generation and get almost instant build on vercel, on main CI and on
publish.

Downsides

- it can be slower (actually not really caz we delete .tsbuildinfo cache
anyway and we can still generate it with incremental flag)
- it contraditcs recommended practices for published packages (we can
generate .d.ts in publish script only and use "types" as source
internally)
2022-11-28 22:27:56 +03:00
Ivan Starkov fe3811a373 Move defaults into ws (#541)
meta props are moved to *.ws.ts
Component removed from *.ws.ts

This allows to merge ws props with registered components props
`registerComponents` now are 
-   registerComponents(customComponents);
-   registerComponentsMeta(customComponentsMeta);

_(Splitting will allow for code splitting to work.)_

Removal of `Component` (and then `Icon` prop) would allow serializing
*.ws.ts metadata between iframe and app designer

Next PR:

Move Icon into base64 or like.

publish/subscribe ws meta of registered components, so it can be reused
on the Designer side
I need this to pass props of registered components to Designer.
2022-11-28 21:14:35 +04:00
Bogdan Chadkin b4bf640dcc Replace flags with component type (#532)
Boolean flags may have a lot of combinations which can lead to
unexpected bugs. Better approach is to categorize nodes with specific
behaviours.

Here I added 5 types

- container - can accept other components with dnd
- control - usually form controls like inputs, without children
- embed - images, videos or other embeddable components, without
children
- rich-text - can be edited on double click
- rich-text-child - formatted text fragment, not listed in components
list
2022-11-28 15:04:53 +03:00
Roman Pominov e7658e394a fix Jest 2022-11-28 14:05:39 +04:00
Roman Pominov 89e737e3d4 fix jest (almost) 2022-11-28 13:32:51 +04:00
Roman Pominov 26f0990347 fix UserProp schema 2022-11-28 12:53:56 +04:00
Roman Pominov a50913d9cc review comments 2022-11-28 11:44:15 +04:00
Roman Pominov da1e8d5056 fix rebase 2022-11-28 11:44:15 +04:00
Roman Pominov 7153febe49 typo 2022-11-28 11:44:15 +04:00
Roman Pominov 1aa59d4c71 extract everything from hook 2022-11-28 11:44:15 +04:00
Roman Pominov 88600562f2 v0.1 2022-11-28 11:44:15 +04:00
Roman Pominov add344a8bd add a link to the issue to the commented out code 2022-11-28 11:44:15 +04:00
Roman Pominov ba2549cfd2 fix impoirt 2022-11-28 11:44:15 +04:00
Roman Pominov 08cc9afe08 delete / comment out old code 2022-11-28 11:44:15 +04:00
Roman Pominov 21befdd3c3 use clipboard api 2022-11-28 11:44:15 +04:00
Roman Pominov 652a323db2 avoid empty props objects 2022-11-28 11:44:15 +04:00
Roman Pominov fbf8f7db87 cross page copy-paste 2022-11-28 11:44:15 +04:00
Roman Pominov ec6b335403 fix a bug where copy/paste doesn't work for inputs 2022-11-28 11:44:15 +04:00
Oleg Isonen 9ed4d4a18b temp disable ImageControl for background images, since it wasn't implemented yet and forgotten 2022-11-27 22:53:04 +01:00
Oleg Isonen 4fcbf1d108 Merge branch 'main' into 494-primitive-tokens 2022-11-27 18:41:41 +01:00
Ivan Starkov a7125fe695 [release-fix] Fix adding new prop (#531)
- [x] - New property creation was broken
- [x] - Switch on `tag` was seriosly broken

<img width="403" alt="image"
src="https://user-images.githubusercontent.com/5077042/204138926-2ca2e13c-6e46-4ca1-9233-ffdc6475dad8.png">
2022-11-27 21:32:03 +04:00
Bogdan Chadkin 6e5c0f9c1d Split Link and RichTextLink components (#530)
Droppable link an link created in text editor have different
requirements. We should split them. In the next PR they will get
different types so we will avoid similar issues in the future.
2022-11-27 17:25:24 +03:00