Commit Graph
141 Commits
Author SHA1 Message Date
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
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
Oleg Isonen 3c088b2c04 Merge branch 'main' into 494-primitive-tokens 2022-12-03 15:38:31 +01:00
Bogdan Chadkin fb946ab296 Fix span component type (#552)
Mistyped when added type to components.
2022-12-03 16:33:06 +03: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
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 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 26f0990347 fix UserProp schema 2022-11-28 12:53:56 +04:00
Roman Pominov da1e8d5056 fix rebase 2022-11-28 11:44:15 +04: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
Oleg Isonen 52a4f9af6b added aspect ratio property to sizes 2022-11-27 13:46:53 +01:00
Ivan Starkov 9e3f3c46c6 Fix accidentally commented code at #516 (#524)
https://github.com/webstudio-is/webstudio-designer/pull/516#pullrequestreview-1194934498
2022-11-27 11:44:48 +04:00
Roman Pominovandistarkov a9fede0a1d Ability to replace SDK components (#516)
Whats done:
- [x] - Added getComponent, getComponentMeta (old getComponenMeta
renamed to getComponentMetaProps)
- [x] - Added `registerComponents` (for now able only override existing
components)
- [x] - Renamed react-sd `remix` folder to `app`
- [x] - At the `app` folder added `custom-components/Image` wrapper
component, which reads assets etc, and use `webstudio/image`
- [x] `getParams`, `setParams` added at `react-sdk/app/` as they are app
level


TODO:
- [x] Create "normal" `useParams` to be able to use data.params
https://github.com/webstudio-is/webstudio-designer/blob/c05f40818beaac8a811fe0a97ba49e30f01f5045/packages/react-sdk/src/app/custom-components/image.tsx#L15-L23
- [x] Reuse props meta from imported image - created issue
https://github.com/webstudio-is/webstudio-designer/issues/521

Co-authored-by: istarkov <istarkov@gmail.com>
2022-11-27 02:47:14 +04:00
Oleg Isonen 8f64061c27 load tokens 2022-11-26 18:37:51 +01:00
Oleg Isonen 1b8b692b73 remove todos, lint 2022-11-25 20:45:29 +01:00
Oleg Isonenandistarkov 4c8989784b Primitive tokens (#507)
https://github.com/webstudio-is/webstudio-designer/issues/494

This PR Renders this UI and, when adding tokens - renders CSS variables
on the canvas: It's behind a feature flag.

<img width="411" alt="Screenshot 2022-11-25 at 15 51 00"
src="https://user-images.githubusercontent.com/52824/204009859-81ed72c4-e758-4973-be49-c8c65e6b4661.png">


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

Co-authored-by: istarkov <istarkov@gmail.com>
2022-11-25 19:51:54 +01:00
istarkov 466ae357d8 Fix errors 2022-11-25 16:01:32 +00:00
Oleg Isonen 7439926c9b Merge branch 'main' into 494-primitive-tokens 2022-11-25 14:52:56 +01:00
Oleg Isonen 48f66a0dc2 use any temporarily 2022-11-25 14:13:35 +01:00
Ivan Starkov 843467a691 Image (#502)
- [x] - Image optimization component moved into standalone package
- [x] - generate-arg-types moved into standalone package - one issue
with current yarn https://github.com/yarnpkg/yarn/issues/4964 (you need
to delete root node_modules, then yarn and yarn build to make
generate-arg-types to work)
- [x] - move json into `__generated__` folder, (allow import json from
__generated__ folders only)
- [x] - Icons moved all gen into `__generated__`
- [x] - css-data generated content moved to `__generated__`
2022-11-25 12:27:44 +04:00
Bogdan Chadkin 7f44d78279 Improve text editor styling and enable auto focus (#504)
Ref https://github.com/webstudio-is/webstudio-designer/issues/107

- fixed bold italic styling
- populate default style for instances created from text editor
- added unmount support to css engine
- auto focus text editor when start editing
2022-11-24 00:07:45 +03:00
Andras Bacsai b48d551e64 Merge pull request #491 from webstudio-is/feat/pages-updates
Pages update for Edge version
2022-11-23 13:49:44 +01:00
Ivan Starkov e08aa99c43 [designer] Assets picker (#444)
ref #196



- Image reverted to ordinary Image
- Added supports of "ordinary" Image `src` selection with the Asset
manager. (The Idea that we save asset + prop value simultaneously, so
"ordinary" controls will work without issues, i.e. in case of the image
we save `prop="src" value="/imagpath" asset={...tonof info here...}`)
- Image optimizations removed (will be created in standalone package in
next PR)
- Now UserProps has type
https://github.com/webstudio-is/webstudio-designer/blob/c36519540c9d3493acfe0dcdd1c118ac4b6196be/packages/react-sdk/src/user-props/schema.ts#L33-L39
- Db type is:
https://github.com/webstudio-is/webstudio-designer/blob/6d5cc571cb4e3bf00ec95f166a0daf9420ef50ac/packages/react-sdk/src/user-props/schema.ts#L4-L10


Next PRs:
1. Restore the Image component with optimizations at standalone package
2. Pass the Image component to SDK and use it instead of the original in
case of optimizations are needed.
2022-11-23 16:15:22 +04:00
Andras Bacsai af1fe83f77 fix types 2022-11-22 11:18:40 +01:00
Andras Bacsai 6cf7c35439 simplify http-client & single rest endpoint for publishing 2022-11-22 10:12:43 +01:00
Bogdan Chadkin 47a7bd6e4b Bump to jest 29 (#484)
The new version got more readable snapshots, no longer depends jsdom and
has much better esm support (will be enabled in next PR).

Had to switch to babel to support typescript, react and esm for now.
2022-11-21 19:10:18 +03:00
Bogdan Chadkin 6719c51f2d Remove components meta data unused in app (#481)
Generated .props.json in react-sdk added huge amount of unused data to
app bundle.

Here I loaded only what's used, validated generated data and covered
meta with strict types.

As you can see this heavily reduced app size

du -ck public/build
2800
2336
2022-11-20 19:07:54 +03:00
Bogdan Chadkin f6e92f2f1b Find unused variables with typescript (#474)
Eslint always had issues finding unused variables. And it's usually
required two more plugins beside builtin functionality to handle this
case.

Typescript has this builtin and handles all cases out of the box. Also
it works faster and more responsive in ide than eslint.
2022-11-19 18:45:49 +03:00
Oleg Isonen bda114b4e3 move tree utils again back to project
someone merged them back into app after they were moved to project
2022-11-18 14:01:19 +01:00
Oleg Isonen 33160e6632 move css-data to a package 2022-11-17 21:12:39 +01:00
Oleg Isonen 7d74fb51ef emove stitches from sdk 2022-11-17 03:39:37 +01:00
Oleg Isonen 80a30a2b20 render fonts using css engine 2022-11-17 03:13:03 +01:00
Oleg Isonen b2be37487d reuse the namespace for id 2022-11-16 21:35:15 +01:00
Oleg Isonen 66fa251fda use dynamicLinks from remix-utils to handle link tags and ssr generated css 2022-11-15 21:56:09 +01:00
Oleg Isonen 657b5186ae fix linter and tests 2022-11-15 16:24:29 +01:00
Oleg Isonen c66082ca89 remove breakpoints argument from createElements tree and wrapper component 2022-11-15 14:29:48 +01:00
Oleg Isonen dcc4de4beb more linter 2022-11-15 10:59:34 +01:00
Oleg Isonen 95a5e54292 remove unused stuff 2022-11-15 10:58:13 +01:00
Oleg Isonen 6d0940bf6f compile css from a route /s/css 2022-11-14 21:18:51 +01:00
Oleg Isonen e38d4f53cb Merge branch 'main' into css-engine 2022-11-13 21:42:38 +01:00
Oleg Isonen 2a0e920725 working version 2022-11-13 20:05:06 +01:00
Oleg Isonen e1986382e6 working version of the engine 2022-11-12 17:24:05 +01:00
Bogdan Chadkin c62d132098 Add more options to text editor (#442)
Ref https://github.com/webstudio-is/webstudio-designer/issues/400

- added superscript
- added subscript
- added clear formatting, used same trick as with span
- refactored interop to cover more options with less code
- convert newlines to linebreaks instead of paragraphs when convert
instances to lexical tree
2022-11-11 23:13:04 +03:00