Commit Graph
1292 Commits
Author SHA1 Message Date
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
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
Bogdan Chadkin b80b4c21f7 Remove paragraphs from text editor (#514)
Ref https://github.com/webstudio-is/webstudio-designer/issues/487

Before lexical created paragraphs when press enter which we tried to
visually represent as line break by removing margins and converted to
line break to instances.

This could lead to a few issues.

1. When paragraph block is inside `<a>` nothing can be typed in the
beginning and in the end of paragraph

2. Paragraphs can be styled by users which can break text editor
visually

Here I overwritten default Enter command and insert line break instead
of paragraph. To protect from external sources like paste from clipboard
added transform to merge all paragraphs if move than one.

We will still have one paragraph in the root with display: inline style.
Though it will cause less damage to editor with user styles.
2022-11-27 13:33:12 +03:00
Ivan Starkov 1ec17c41ec Remove assets flag (#525) 2022-11-27 14:04:59 +04: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
Bogdan Chadkin 0d40747888 Use serialized loader types (#522)
New remix enforces types to be serialized.
Prisma output dates as Date instance and this is not customizable. Had
to fix only 2 cases.
2022-11-27 10:13:16 +03: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
Bogdan Chadkin 8172b077e8 Handle loader errors in error boundary (#520)
This will allow to infer loader data instead of writing type for it as
recommended in
https://github.com/remix-run/remix/releases/tag/remix%401.6.5.
2022-11-26 23:23:37 +03:00
Oleg Isonen 4cc75b5c7a fix optional breakpoint 2022-11-26 14:17:59 +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
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
Bogdan Chadkin 9b0d7f25b2 Output cjs in font package (#506)
Designer tests fail because of missing cjs in fonts package. Also fixed
iso string timezone in one test, was failing for me.
2022-11-23 22:55:31 +03:00
Oleg Isonen e57cc96808 fix eslint 2022-11-23 20:44:20 +01:00
Oleg Isonen 63ded04e13 fix currentIndex in font manager when new fonts are added 2022-11-23 20:23:14 +01:00
natlusyht b4f981f683 don't display empty unitless dropdown (#478)
don't display chevron if there are no items to display in the dropdown
and fix the bg on chevron's/unit text-field suffix button.

## 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-11-23 17:04:07 +01:00
Andras Bacsai e12b3c0753 fix: type CanvasData 2022-11-23 14:50:38 +01: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 b2363b7e2d move cssengine dependency to package 2022-11-23 09:31:02 +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 c7c31b14f6 fixes 2022-11-22 15:53:06 +01:00
Andras Bacsai af41705e61 fix issues 2022-11-22 14:35:28 +01:00
Andras Bacsai cefd76d9b7 fix issues 2022-11-22 14:25:09 +01:00
Andras Bacsai d7db67e461 fix: BuildParams type 2022-11-22 12:08:51 +01:00
Andras Bacsai 81ee438a81 fix projects endpoint 2022-11-22 10:39:23 +01:00
Andras Bacsai 6cf7c35439 simplify http-client & single rest endpoint for publishing 2022-11-22 10:12:43 +01:00
Andras Bacsai 90019fdd63 Merge branch 'main' into feat/pages-updates 2022-11-22 08:50:44 +01:00
Oleg Isonen 42b4ceea77 Stop flicker when hovering instances (#477)
## Before


https://user-images.githubusercontent.com/52824/202865326-2d8f1c4c-8843-40c9-837d-fd678dbacdaa.mp4



## After



https://user-images.githubusercontent.com/52824/202865322-3ff488c8-eb36-4d4a-9c6f-591a84332ebc.mp4





## 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-11-22 00:40:47 +01:00
Andras Bacsai 1b72e93d3a Merge branch 'main' into feat/pages-updates 2022-11-21 21:42:10 +01:00
Andras Bacsai 82b8ceafe1 fix: remove unused import 2022-11-21 21:36:01 +01:00
istarkov c75f3e4f16 Reuse sanitize 2022-11-21 20:31:55 +04:00
istarkov 279e2ec093 Add sanitize 2022-11-21 20:31:55 +04: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
Oleg Isonen f9ed58fdec plain text css rule won't add units automatically 2022-11-21 16:34:01 +01:00
Andras Bacsai 07e81efeef fix: export type BuildParams 2022-11-21 14:07:11 +01:00
Andras Bacsai 76a89f58bd feat: add rest api for /s/css 2022-11-21 14:05:57 +01:00
Andras Bacsai 2e39bbfd27 feat: move css engine loader to shared folder 2022-11-21 14:05:08 +01:00
Andras Bacsai 43a5889481 merge main 2022-11-21 11:42:38 +01:00
Roman Pominov 559318bd22 Fix a security issue with eval() (#485)
In the current main if you enter `1+1,alert("hello")` as a value into a
CSS input, you'll see an alert. This PR fixes it.
2022-11-21 13:37:15 +03:00
Andras Bacsai 03583078cb feat: redesigner loadProject + add new rest api for CSS 2022-11-21 11:00:03 +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
Oleg Isonen a2822bcc94 fix uploading indicator position 2022-11-19 20:42:45 +01: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
Ivan Starkov 0b37ccdefe [release-fix] Change align-items onto align-self (#470)
Fixes label align-items onto align-self

Probably in the future this should be used.
`sectionStyle.alignSelf?.styleConfig.label`
2022-11-19 13:52:05 +01:00
Oleg Isonen 669416b732 Merge pull request #471 from webstudio-is/fix_align_content_vis
[release-fix] Show align-content only if wrap enabled
2022-11-19 13:51:48 +01:00
Oleg Isonen fa9129f4aa Merge pull request #472 from webstudio-is/fix_gray
[release-fix] Flex gap icon is not button
2022-11-19 13:51:33 +01:00