Commit Graph
710 Commits
Author SHA1 Message Date
Bogdan Chadkin dca04597fb build: publish 0.173.0 (#3816) 2024-07-29 17:48:40 +02:00
Bogdan Chadkin 8a746f6594 feat: drop data-ws-* attributes (#3806)
Ref https://github.com/webstudio-is/webstudio/issues/3763

We no longer rely on data-ws-id and data-ws-component in generated apps.
Now we get a few benefits

- smaller workers to deploy
- cleaner html to inspect
- generated ssg can be modified directly by user

See generated fixtures

<img width="726" alt="image"
src="https://github.com/user-attachments/assets/59012201-0dce-47f3-aa80-387c77b8f7d6">
2024-07-28 21:30:26 +02:00
Bogdan Chadkin d7531b73b7 refactor: manage forms with resources (#3803)
Ref https://github.com/webstudio-is/webstudio/issues/3789

Here changed a few things

- replace WebhookForm action prop with resource, which is sent with
hidden field instead of instance id
- prevented generating method and action in client side code
- generate "action" resource instead of form properties for server

action prop is replaced only inside cli to not require support in
builder yet, in the future this can be part of client migrations
2024-07-27 20:20:29 +02:00
Bogdan Chadkin 34ae0411db refactor: decouple resource loader from generated requests (#3798)
Ref https://github.com/webstudio-is/webstudio/issues/3789

Unified resource generation to output computed request factory to use in
both loader and action.
2024-07-27 11:59:46 +02:00
Bogdan Chadkin 31bdec9f3b feat: use classes for regular styles (#3796)
Closes https://github.com/webstudio-is/webstudio/issues/3788

Here switched from attribute selector to classes when atomic styles are
disabled. This will let us get rid from data-ws-* attributes in
generated html.
2024-07-26 14:00:20 +02:00
Bogdan Chadkin f73680027f feat: use classes for preset styles (#3794)
Closes https://github.com/webstudio-is/webstudio/issues/3787

Replaced [data-ws-component=...] selector with classes in generated
styles. This will unlock cleaner html output in the future.
2024-07-26 10:45:29 +02:00
Bogdan Chadkin a10c9d16b3 refactor: replace constants in templates (#3770)
Here made constants path easier to access from dynamic paths by
automatically replacing __CONSTANTS__ with actual relative path.

This is necessary for vike support which has folder based routes.
2024-07-21 15:34:07 +02:00
Bogdan Chadkin 4977e82031 refactor: move social asset into page meta (#3764)
Removed social asset form top level and moved into generated page meta.
Will be less generated data and simple page head.
2024-07-19 21:32:22 +02:00
Bogdan Chadkin 50a17ebb8b refactor: move redirect into template (#3664)
Here decoupled redirect generation from cli.
Moved remix related code to template and
generated only module with url and status.
2024-07-04 11:54:57 +03:00
Bogdan Chadkin 3ba82579bc refactor: simplify placeholders in CLI templates (#3663)
Here improved replacing placeholders in our templates. Before used some
relative path to stubs. Now use explicitly named placeholders like
`__CLIENT__`, `__SERVER__`, `__CSS__` and `__SITEMAP__`.

This will give more flexibility when support other frameworks, for
example vike.
2024-07-03 20:01:50 +03:00
Bogdan Chadkin a58f2eff04 build: run all tests and typechecks in CI (#3661)
Here improved our checks. No longet rely on "checks" script but run
"test" and "typescript" scripts from each package in monorepo.

Would also make each package less boilerplaty.
2024-07-02 18:21:05 +03:00
Ivan Starkov 4d0574d573 build: Update typescript (#3637)
## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-06-28 11:46:13 +03:00
Bogdan Chadkin 7f399154de fix: prefix more css properties (#3613)
These fields should have -webkit- prefix additionally to unprefixed
version to support more browsers.

- background-clip
- user-select
- text-size-adjust
2024-06-25 13:41:02 +03:00
Bogdan Chadkin 9a39c24502 refactor: switch ai to nesting rules (#3605)
Moved ai css generation to nesting rules
and removed a bunch of utilities.

Tested locally
2024-06-23 01:13:24 +03:00
Bogdan Chadkin 14791a476b refactor: switch preset styles to nesting rules (#3604)
Ref https://github.com/webstudio-is/webstudio/issues/2647

Moved preset styles to new nesting rules in css engine. Will simplify
future prefixer solution.
2024-06-22 22:30:19 +03:00
Ivan Starkov a4d3f33bad fix: Dialog within collection issues (#3597)
## Description


https://discord.com/channels/955905230107738152/1251593079161491637/1251593079161491637

## Steps for reproduction


https://dialog-col.staging.webstudio.is/builder/be551fca-b3bc-4750-961a-c0bdc0557506?authToken=3d9f5902-0ecc-4645-ba12-9f7af2f81e09&mode=edit

https://dialog-saas-a7f4v.wstd.work/

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-06-21 20:54:04 +03:00
Bogdan Chadkin d251e998c8 refactor: use jsx in component generator tests (#3571)
Here enahnced our jsx with props support and rewrote component generator
tests with it as an example.

Props are solved in straightforward way, type of value described prop
type. Though in case of expression, parameter, asset, page, action used
classes as opaque types.
2024-06-16 12:58:10 +03:00
Bogdan Chadkin cf5c6b9f29 refactor: use jsx to represent instances in tests (#3568)
Added "@webstudio-is/sdk/testing" entry point with jsx utilities to
simplify instances representation.

React is used as runtime, then renderJsx traverse resulting tree and
converts into our data.
2024-06-15 00:06:20 +03:00
Ivan Starkov 863bb2a1bc feat: Adds the ability to place images on the canvas immediately during upload (#3546)
## Description

- Adds the ability to place images on the canvas immediately during
upload, using the file blob or a provided URL.
- Enables images to use width and height from asset metadata.
- Detects duplicate assets and displays a warning message.

<img width="323" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/fe810dd8-3e3d-4cab-8669-b0d739044f49">


These changes allow images to appear on the canvas upon pasting, even if
the asset is not fully uploaded yet.


## Steps for reproduction

Start uploading few files on a slow connection, select them before
upload, see image on canvas is changed

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2024-06-14 11:01:07 +03:00
Bogdan Chadkin be592846d1 fix: treat collection box as container (#3558)
Fixes https://github.com/webstudio-is/webstudio/issues/3473

Somehow lost this fix from other PR
2024-06-13 22:06:01 +03:00
Bogdan Chadkin 936dcd3ca8 build: publish 0.168.0 (#3556) 2024-06-13 14:57:21 +03:00
Bogdan Chadkin f9c7b7a153 refactor: merge icon modules (#3516)
Our vite setup in builder is getting slower
because of huge amount of modules.

Here I merged more than 400 icon modules into 2 modules string and
components.

This should improved vite experience and slightly reduce bundling time.
2024-06-11 00:47:27 +03:00
Bogdan Chadkin 5cd2899e81 fix: generate conditional collection (#3506)
Fixes
https://github.com/webstudio-is/webstudio-community/discussions/151

Here fixed the issue with generating conditional collection code for
published sites. Added fragment around collection when rendered inside
of condition.
2024-06-06 14:57:56 +03:00
Bogdan Chadkin c5a9a38838 build: publish 0.167.0 (#3498) 2024-06-05 11:34:59 +03:00
Oleg Isonen 59ff9c23db refactor: Move text placeholders to meta templates (#3410)
## Description

Part of https://github.com/webstudio-is/webstudio/issues/3149 this
allows us to understand if an instance has text child.
With this knowledge we can place instances into components that don't
have text children and after them if they do.

## Steps for reproduction

1. insert text or paragraph
2. see there is expected placeholder text which is editable
3. select it, tell AI to change color or something
4. see it works and see in payload it didn't send placeholder text
5. try text editing on empty body - shouldn't allow it

## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-05-24 13:53:19 +02:00
Bogdan Chadkin 0a2e870fa4 build: publish 0.163.0 (#3396) 2024-05-22 14:03:45 +03:00
Ivan Starkov 0b48e9d314 feat: Add Time Component (#3369)
## Description

Mimics https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time 
The main difference as we use it to convert datetime field into Human
readable format

Play here:

https://time.development.webstudio.is/builder/dd5668ed-76c3-4c82-aacd-4fa21411d5ae

TODO:
- [ ] - We need to think about init text see image below

## Steps for reproduction

We need to think about init text

<img width="1320" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/b5236314-1184-4561-8ca9-22d7a7824fee">


<img width="271" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/4e5a338d-35ae-412a-817c-07643e918f6f">



## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-05-16 20:10:37 +03:00
Bogdan Chadkin cacfbee307 experimental: add content embed aka rich text component (#3315)
Ref https://github.com/webstudio-is/webstudio/issues/2903

Embed Content is a component with a way to bind html from cms with
ability to style itself and all descendants generated from cms rich
text. All Content Embed children are "virtual" Descendant instances with
predefined selector.

<img width="1404" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5635476/8d7cf210-32cb-4e63-bfe7-8af8c3e2d78d">
2024-05-09 13:20:47 +04:00
Bogdan Chadkin 305436f820 experimental: add descendent component (#3313)
Ref https://github.com/webstudio-is/webstudio/issues/2903

Here added support for new `<ws:descendent />` component. It allows to
style any children or descendents of components. Primary usage is for
embed content which renders html and need to style tags.

Descendent component accepts "selector" prop which can be suffix like `
img`, ` .image` or `::first-child` pseudo-element.

Potentially it could be used as tag styling for any element.

Can be tested in any element by dropping "Descendent" component from
"internal" category.
2024-05-06 23:36:34 +04:00
Bogdan Chadkin 16296c7785 refactor: drop require export condition (#3299)
This hack was used to support classic remix compiler and no longer
necessary.
2024-05-06 22:50:07 +04:00
Bogdan Chadkin 7128bc9204 build: publish 0.151.0 (#3297) 2024-05-04 16:56:39 +04:00
Ivan Starkov cc72849a62 feat: Canvas drawing of xml element (#3245)
## Description

This is only for Canvas rendering.

<img width="829" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/b63efe11-effd-4ed7-b9ff-a19d4a19a125">

<img width="244" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/3f59819b-486a-4d75-8890-c5c14950393c">

Editable
<img width="269" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5077042/e25af3b0-0903-4390-aec8-1fc7383ec24b">

For generating it will change a little.

## Steps for reproduction

[Play Ref
https://xml-element.development.webstudio.is/builder/cab934af-8615-411a-99c1-5822a98eac74](https://xml-element.development.webstudio.is/builder/cab934af-8615-411a-99c1-5822a98eac74)

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-04-29 14:08:27 +03:00
Oleg Isonen c478e65029 fix: Prevent editing Code Text component as text (#3246)
Code Text component is designed to render code and in the future also to
add syntax highlighting. With this PR it won't be possible to treat it
like a Box any more and code will be entered using code property.

Benefit is: better UX for editing code and no unintended side effects
later with highlighting.

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-04-27 21:33:57 +02:00
Bogdan Chadkin 147a495393 refactor: reimplement atomic styles with nesting rules (#3248)
Here used new nesting rules to generate atomic styles. Replaced separate
atomic style sheet class with just a method to generate styles
atomically. Inheritance doesn't work well with private fields caz
require a lot of internals to be public.
2024-04-27 23:00:09 +04:00
Bogdan Chadkin 20a2a1ec55 refactor: add mixin rule to css engine (#3233)
Here added new mixin rule to represent reusable
parts like our tokens and maintain their cache.
In the future can be rendered as native css.
2024-04-24 02:05:29 +07:00
Bogdan Chadkin 0cdcfc562c refactor: add nesting rule to css engine (#3227)
Nesting rule is universal representation for
instance style with support for nested state selectors and nested media
queries. Css is generated css of course without css nesting and optimize
media queries but in the future may be generated with nesting for
simplicity.

This is essential to support mixins in css engine. Will support it in
atomic css in other PRs.
2024-04-24 01:37:01 +07:00
Bogdan Chadkin b2355e828f refactor: cleanup system variable (#3213)
Use sdk type for system variable and make it required in pages since it
was added to all pages with migration.
2024-04-20 17:44:01 +07:00
Bogdan Chadkin c336b6ebc7 build: publish 0.145.0 (#3192) 2024-04-18 10:43:07 +07:00
Ivan Starkov 6d5e55b892 build: Update react + typescript hotfix (#3194)
## Description

Use canary react 

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-04-17 22:23:37 +03:00
Bogdan Chadkin e75c174f75 build: release 0.144.0 (#3090) 2024-04-04 22:34:52 +07:00
Bogdan Chadkin 201ffd5fb8 refactor: generalize css api and add test (#3081)
Here just small refactoring. generateCss will accept only maps instead
of arrays of tuples. Also added one test to not break on changes.
2024-04-03 19:26:06 +07:00
Bogdan Chadkin e34aa862bb refactor: move remix root into template (#3071)
React sdk not necessary to depend on remix. It will even complicate
remix upgrade.
2024-03-30 19:13:51 +07:00
Ivan Starkov 8bad95fc16 build: release 0.143.0 (#3070)
## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-03-30 12:04:04 +03:00
Oleg Isonen d9eb1e2941 fix: keep the execution order of scripts when executing HTML Embed on the client (#3046)
https://share.descript.com/view/q8jpNCbmOxP

## Description

Originally all remote scripts in html embed were executed async, no
matter if they have async attribute or not.
Now they respect the order and only execute async if there is async
attribute.

## Steps for reproduction

This should fail on first load because first script is loaded async and
second script depends on it
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.3/gsap.min.js" async=""></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.3/ScrollTrigger.min.js"></script>
<script>
console.log('gsap', gsap)  
</script>
```

This should not fail
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.3/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.3/ScrollTrigger.min.js"></script>
<script>
console.log('gsap', gsap)  
</script>
```

## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-03-25 13:47:21 +01:00
Oleg Isonen cd0174807d chore: use console.info instead of console.log (#3049)
## Description

We allow console.info (btw we should also allow warn/error/info), we
only disallow console.log in the linter because that's what we use for
debugging.

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2024-03-24 12:52:46 +01:00
Bogdan Chadkin 20df0cef32 refactor: move forms properties into server module (#3034)
Here moved forms properties, page meta and remix params into server
module as used only in loader and never executed on client. Especially
forms properties may contain user credentials and remix does not
guarantee it to not appear in client side bundle.

Also moved those into sdk as universal generators.
2024-03-20 16:42:51 +07:00
Bogdan Chadkin dad898e6a4 refactor: move expressions into base sdk (#3032)
We need to move stuff not related to react out of react-sdk into
universal sdk package.
2024-03-19 02:02:07 +07:00
Bogdan Chadkin 99d0e53035 refactor: drop jsep parser (#3029)
We fully switched to acorn for parsing expressions and no longer need
for jsep and its plugins. User will stop getting esm false positives
when build with remix.
2024-03-18 20:47:20 +07:00
Bogdan Chadkin df579f7c72 refactor: switch to acorn expressions everywhere (#3028)
Ref https://github.com/webstudio-is/webstudio/issues/2903

Here switched the rest of usages to acorn based expressions. Added
getExpressionIdentifiers utility to extract used variables names to
avoid using transpiler replaceVariable callback for this.
2024-03-18 14:41:57 +07:00
Bogdan Chadkin 61f751adab refactor: switch to acorn for expression linting (#3026)
Ref https://github.com/webstudio-is/webstudio/issues/2903

Here added new lintExpression utility to provide diagnostics when
parsing error happens or not supported language feature is used.

Additionally it no longer forbids template literals and ternary
operators. Btw still need to get rid from legacy implementation to make
them work.

<img width="465" alt="Screenshot 2024-03-17 at 20 41 49"
src="https://github.com/webstudio-is/webstudio/assets/5635476/e208c360-7f2a-471a-aa54-983ff0a14247">
2024-03-18 11:01:40 +07:00