Commit Graph
189 Commits
Author SHA1 Message Date
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
Bogdan Chadkin a8f1f407b7 Bump saas packages (#527)
Added publish script to image package and bumped everything changed
since latest bump by checking `git log -1 -- .`
2022-11-27 13:48:26 +03: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 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
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 7dbbfeb6b3 Fix sdk 2022-11-24 21:02:19 +03:00
Bogdan Chadkin 18d28b50cb Bump sass deps
We need to bump all sass deps to get esm support
and treeshake bundled code.
2022-11-24 20:59:41 +03:00
Bogdan Chadkin 16984b8bf7 Improve packages auto publish (#508)
Current solution often fails with

> You cannot publish over the previously published versions

Here I added small script which compares committed version and version
on npm and publish if do not match.

All scripts are run by turbo. So publishing new package is just changing
package script now.
2022-11-24 16:00:24 +03: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 3da21ede0e bump version 2022-11-23 09:38:03 +01:00
Bogdan Chadkin ad04473f26 Migrate packages to native ESM (#493)
Our designer bundle heavily bloated with not analyzable commonjs
generated by typescript.

The biggest problem comes from bundled icons library which esbuild
cannot tree shake because of cjs.

Another issue is broken code splitting. Packages in one piece are appear
in chunks and always loaded even with dynamic import and React.lazy.

To solve this I migrated each package to native node es modules.
Storybook and jest work almost without changes. Though it's not possible
to run remix in esm project (while still esm packages can be bundled for
ssr). And as a result designer jest failed because of cjs tests requires
from esm packages. As a solution I generated additional commonjs
artifacts in lib/cjs.

du -ck public/build
2336
1736
2022-11-23 10:12:58 +03: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
Andras Bacsai 9c2c0e6c42 fix: missing dependency (detect-font) 2022-11-21 11:30:01 +01: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 50010c7f0d Check all .ts and .tsx in packages src folder (#476)
Here "include" often have list of extensions and forgotten .tsx so such
modules are left unchecked. Replaced with just "src" which consider all
typescript extensions.

Ideally stop using tsc to build artifacts, switch to esbuild and remove
complex configuration from all tsconfig.json.
2022-11-19 21:21:38 +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 24bc6be20d bump all updated package versions 2022-11-18 16:19:50 +01:00
Oleg Isonen 385ac6983b use zod as peer and dev deps 2022-11-18 14:26:26 +01: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
Oleg Isonen 1a623b7e9d simplify css preview logic 2022-11-11 20:40:12 +01:00
Oleg Isonen bd341cd74c simplify usePreviewCss 2022-11-11 20:30:34 +01:00
Oleg Isonen a30b7ad5be set values over css vars 2022-11-11 16:48:53 +01:00
Roman Pominov ebeb78ad6c Fix a bug where outline does not update for inline elements (#438)
Fixes #433
2022-11-10 17:49:16 +03:00
Bogdan Chadkin 83aaba5f46 Allow span fragment in text editor (#426)
Ref https://github.com/webstudio-is/webstudio-designer/issues/400

- added span component to sdk
- added span support to text editor toolbar

Lexical has a great utility $patchStyleText which does exaactly what we
need, split selection into stylable element. Though there is a catch. It
requires to apply some styles. We do styling lazily and with clases so
it doesn't fit to trigger split. To workaroud it I instead patch with
css custom property which does not affect styling and considered a
trigger for lexical.

<img width="248" alt="image"
src="https://user-images.githubusercontent.com/5635476/201028529-0e5ec32e-a00a-43b0-899c-671f0edcad5b.png">
2022-11-10 17:15:47 +03:00
istarkov fbf8babd62 Update stories, fix bug 2022-11-09 06:08:02 +00:00
istarkov 5d1452928d Image component 2022-11-09 06:07:48 +00:00
Bogdan Chadkin 15972f8925 Allow text editor styles nesting (#423)
Ref https://github.com/webstudio-is/webstudio-designer/issues/289

Added support for styles inside links and styles inside each other.
Updates can have children updates and ids in updates become optional.

For now code is repetitive in some cases. Will be more general
eventually.

Though still we getting some complexity because lexical represents
italic and bold as single node when intersected.


<img width="413" alt="image"
src="https://user-images.githubusercontent.com/5635476/200588378-058d1042-a628-4f99-9c63-e18b9ecd5a8c.png">
2022-11-09 01:57:49 +03:00
Oleg Isonen 43453e07d6 Merge branch 'main' into 252-fonts-manager-and-fonts-selector 2022-11-07 16:14:57 +01:00
Oleg Isonen 45111b2bac Merge branch 'main' into andarist/fix-server-entries 2022-11-06 10:02:51 +01:00