@webstudio-is/react-sdk 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/lib/app/custom-components/index.js +2 -3
  2. package/lib/cjs/app/custom-components/index.cjs +2 -3
  3. package/lib/cjs/components/body.ws.cjs +2 -3
  4. package/lib/cjs/components/bold.ws.cjs +2 -3
  5. package/lib/cjs/components/box.ws.cjs +2 -3
  6. package/lib/cjs/components/button.ws.cjs +2 -3
  7. package/lib/cjs/components/component-type.cjs +0 -8
  8. package/lib/cjs/components/form.ws.cjs +2 -3
  9. package/lib/cjs/components/heading.ws.cjs +2 -3
  10. package/lib/cjs/components/image.ws.cjs +2 -3
  11. package/lib/cjs/components/input.ws.cjs +2 -3
  12. package/lib/cjs/components/italic.ws.cjs +2 -3
  13. package/lib/cjs/components/link.ws.cjs +2 -3
  14. package/lib/cjs/components/paragraph.ws.cjs +2 -3
  15. package/lib/cjs/components/rich-text-link.ws.cjs +2 -3
  16. package/lib/cjs/components/span.ws.cjs +2 -3
  17. package/lib/cjs/components/subscript.ws.cjs +2 -3
  18. package/lib/cjs/components/superscript.ws.cjs +2 -3
  19. package/lib/cjs/components/text-block.ws.cjs +2 -3
  20. package/lib/cjs/css/index.cjs +0 -1
  21. package/lib/cjs/tree/create-elements-tree.cjs +6 -13
  22. package/lib/cjs/tree/wrapper-component.cjs +2 -1
  23. package/lib/components/body.ws.js +2 -3
  24. package/lib/components/bold.ws.js +2 -3
  25. package/lib/components/box.ws.js +2 -3
  26. package/lib/components/button.ws.js +2 -3
  27. package/lib/components/component-type.js +0 -4
  28. package/lib/components/form.ws.js +2 -3
  29. package/lib/components/heading.ws.js +2 -3
  30. package/lib/components/image.ws.js +2 -3
  31. package/lib/components/input.ws.js +2 -3
  32. package/lib/components/italic.ws.js +2 -3
  33. package/lib/components/link.ws.js +2 -3
  34. package/lib/components/paragraph.ws.js +2 -3
  35. package/lib/components/rich-text-link.ws.js +2 -3
  36. package/lib/components/span.ws.js +2 -3
  37. package/lib/components/subscript.ws.js +2 -3
  38. package/lib/components/superscript.ws.js +2 -3
  39. package/lib/components/text-block.ws.js +2 -3
  40. package/lib/css/index.js +0 -1
  41. package/lib/tree/create-elements-tree.js +6 -13
  42. package/lib/tree/wrapper-component.js +2 -1
  43. package/package.json +9 -9
  44. package/src/app/custom-components/index.ts +3 -3
  45. package/src/components/body.ws.tsx +3 -3
  46. package/src/components/bold.ws.tsx +3 -3
  47. package/src/components/box.ws.ts +3 -3
  48. package/src/components/button.ws.tsx +3 -3
  49. package/src/components/component-type.ts +2 -2
  50. package/src/components/form.ws.tsx +3 -3
  51. package/src/components/heading.ws.tsx +3 -3
  52. package/src/components/image.ws.tsx +3 -3
  53. package/src/components/input.ws.tsx +3 -3
  54. package/src/components/italic.ws.tsx +3 -3
  55. package/src/components/link.ws.tsx +3 -3
  56. package/src/components/paragraph.ws.tsx +3 -3
  57. package/src/components/rich-text-link.ws.tsx +3 -3
  58. package/src/components/span.ws.tsx +3 -3
  59. package/src/components/subscript.ws.tsx +3 -3
  60. package/src/components/superscript.ws.tsx +3 -3
  61. package/src/components/text-block.ws.tsx +3 -3
  62. package/src/css/index.ts +0 -1
  63. package/src/tree/create-elements-tree.tsx +0 -28
  64. package/src/tree/wrapper-component.tsx +1 -3
  65. package/lib/cjs/css/breakpoints.cjs +0 -29
  66. package/lib/css/breakpoints.js +0 -9
  67. package/src/components/index.test.ts +0 -7
  68. package/src/css/breakpoints.ts +0 -10
@@ -1,14 +1,13 @@
1
1
  import { Link2Icon } from "@webstudio-is/icons";
2
- import { WsComponentPropsMeta } from "./component-type";
3
2
  import props from "./__generated__/rich-text-link.props.json";
4
3
  const meta = {
5
4
  type: "rich-text-child",
6
5
  label: "Link",
7
6
  Icon: Link2Icon
8
7
  };
9
- const propsMeta = WsComponentPropsMeta.parse({
8
+ const propsMeta = {
10
9
  props
11
- });
10
+ };
12
11
  export {
13
12
  meta,
14
13
  propsMeta
@@ -1,14 +1,13 @@
1
1
  import { BrushIcon } from "@webstudio-is/icons";
2
- import { WsComponentPropsMeta } from "./component-type";
3
2
  import props from "./__generated__/span.props.json";
4
3
  const meta = {
5
4
  type: "rich-text-child",
6
5
  label: "Styled Text",
7
6
  Icon: BrushIcon
8
7
  };
9
- const propsMeta = WsComponentPropsMeta.parse({
8
+ const propsMeta = {
10
9
  props
11
- });
10
+ };
12
11
  export {
13
12
  meta,
14
13
  propsMeta
@@ -1,14 +1,13 @@
1
1
  import { SubscriptIcon } from "@webstudio-is/icons";
2
- import { WsComponentPropsMeta } from "./component-type";
3
2
  import props from "./__generated__/subscript.props.json";
4
3
  const meta = {
5
4
  type: "rich-text-child",
6
5
  label: "Subscript Text",
7
6
  Icon: SubscriptIcon
8
7
  };
9
- const propsMeta = WsComponentPropsMeta.parse({
8
+ const propsMeta = {
10
9
  props
11
- });
10
+ };
12
11
  export {
13
12
  meta,
14
13
  propsMeta
@@ -1,14 +1,13 @@
1
1
  import { SuperscriptIcon } from "@webstudio-is/icons";
2
- import { WsComponentPropsMeta } from "./component-type";
3
2
  import props from "./__generated__/superscript.props.json";
4
3
  const meta = {
5
4
  type: "rich-text-child",
6
5
  label: "Superscript Text",
7
6
  Icon: SuperscriptIcon
8
7
  };
9
- const propsMeta = WsComponentPropsMeta.parse({
8
+ const propsMeta = {
10
9
  props
11
- });
10
+ };
12
11
  export {
13
12
  meta,
14
13
  propsMeta
@@ -1,5 +1,4 @@
1
1
  import { TextIcon } from "@webstudio-is/icons";
2
- import { WsComponentPropsMeta } from "./component-type";
3
2
  import props from "./__generated__/text-block.props.json";
4
3
  const presetStyle = {
5
4
  minHeight: {
@@ -15,9 +14,9 @@ const meta = {
15
14
  presetStyle,
16
15
  children: ["Block of text you can edit"]
17
16
  };
18
- const propsMeta = WsComponentPropsMeta.parse({
17
+ const propsMeta = {
19
18
  props
20
- });
19
+ };
21
20
  export {
22
21
  meta,
23
22
  propsMeta
package/lib/css/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from "./get-browser-style";
2
2
  export * from "./categories";
3
- export * from "./breakpoints";
@@ -8,13 +8,11 @@ const createElementsTree = ({
8
8
  instance,
9
9
  propsByInstanceIdStore,
10
10
  assetsStore,
11
- Component,
12
- onChangeChildren
11
+ Component
13
12
  }) => {
14
13
  const children = createInstanceChildrenElements({
15
14
  Component,
16
- children: instance.children,
17
- onChangeChildren
15
+ children: instance.children
18
16
  });
19
17
  const body = createInstanceElement({
20
18
  Component,
@@ -37,8 +35,7 @@ const createElementsTree = ({
37
35
  };
38
36
  const createInstanceChildrenElements = ({
39
37
  children,
40
- Component,
41
- onChangeChildren
38
+ Component
42
39
  }) => {
43
40
  const elements = [];
44
41
  for (const child of children) {
@@ -48,13 +45,11 @@ const createInstanceChildrenElements = ({
48
45
  }
49
46
  const children2 = createInstanceChildrenElements({
50
47
  children: child.children,
51
- Component,
52
- onChangeChildren
48
+ Component
53
49
  });
54
50
  const element = createInstanceElement({
55
51
  instance: child,
56
52
  Component,
57
- onChangeChildren,
58
53
  children: children2
59
54
  });
60
55
  elements.push(element);
@@ -64,14 +59,12 @@ const createInstanceChildrenElements = ({
64
59
  const createInstanceElement = ({
65
60
  Component,
66
61
  instance,
67
- children = [],
68
- onChangeChildren
62
+ children = []
69
63
  }) => {
70
64
  const props = {
71
65
  instance,
72
66
  children,
73
- key: instance.id,
74
- onChangeChildren
67
+ key: instance.id
75
68
  };
76
69
  return /* @__PURE__ */ jsx(Component, {
77
70
  ...props
@@ -21,7 +21,6 @@ const renderWrapperComponentChildren = (children) => {
21
21
  };
22
22
  const WrapperComponent = ({
23
23
  instance,
24
- onChangeChildren,
25
24
  children,
26
25
  ...rest
27
26
  }) => {
@@ -43,8 +42,10 @@ const WrapperComponent = ({
43
42
  };
44
43
  const idAttribute = "data-ws-id";
45
44
  const componentAttribute = "data-ws-component";
45
+ const collapsedAttribute = "data-ws-collapsed";
46
46
  export {
47
47
  WrapperComponent,
48
+ collapsedAttribute,
48
49
  componentAttribute,
49
50
  idAttribute,
50
51
  renderWrapperComponentChildren
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -46,13 +46,13 @@
46
46
  "mitt": "^3.0.0",
47
47
  "nanostores": "^0.7.1",
48
48
  "warn-once": "^0.1.1",
49
- "@webstudio-is/asset-uploader": "^0.33.0",
50
- "@webstudio-is/css-data": "^0.33.0",
51
- "@webstudio-is/generate-arg-types": "^0.33.0",
52
- "@webstudio-is/icons": "^0.33.0",
53
- "@webstudio-is/image": "^0.33.0",
54
- "@webstudio-is/prisma-client": "^0.33.0",
55
- "@webstudio-is/project-build": "^0.33.0"
49
+ "@webstudio-is/asset-uploader": "^0.35.0",
50
+ "@webstudio-is/css-data": "^0.35.0",
51
+ "@webstudio-is/generate-arg-types": "^0.35.0",
52
+ "@webstudio-is/icons": "^0.35.0",
53
+ "@webstudio-is/image": "^0.35.0",
54
+ "@webstudio-is/prisma-client": "^0.35.0",
55
+ "@webstudio-is/project-build": "^0.35.0"
56
56
  },
57
57
  "exports": {
58
58
  "import": "./lib/index.js",
@@ -72,7 +72,7 @@
72
72
  "build": "build-package",
73
73
  "build:args": "generate-arg-types './src/components/*.tsx !./src/**/*.stories.tsx !./src/**/*.ws.tsx' && prettier --write \"**/*.props.json\"",
74
74
  "typecheck": "tsc --noEmit",
75
- "test": "NODE_OPTIONS=--experimental-vm-modules jest",
75
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
76
76
  "lint": "eslint ./src --ext .ts,.tsx --max-warnings 0",
77
77
  "checks": "pnpm typecheck && pnpm lint && pnpm test",
78
78
  "storybook:run": "start-storybook -p 6006",
@@ -2,7 +2,7 @@ import { Image } from "./image";
2
2
  import { Link } from "./link";
3
3
  import { RichTextLink } from "./rich-text-link";
4
4
  import { imageProps } from "@webstudio-is/image";
5
- import { WsComponentPropsMeta } from "../../components/component-type";
5
+ import type { WsComponentPropsMeta } from "../../components/component-type";
6
6
 
7
7
  export const customComponents = {
8
8
  Image,
@@ -11,12 +11,12 @@ export const customComponents = {
11
11
  };
12
12
 
13
13
  export const customComponentPropsMetas = {
14
- Image: WsComponentPropsMeta.parse({
14
+ Image: {
15
15
  props: {
16
16
  ...imageProps,
17
17
  src: { ...imageProps.src, control: "file-image", name: "Source" },
18
18
  },
19
- }),
19
+ } as WsComponentPropsMeta,
20
20
  };
21
21
 
22
22
  // just for completeness, maybe we add soemthing here later
@@ -1,5 +1,5 @@
1
1
  import { BodyIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/body.props.json";
4
4
 
5
5
  const presetStyle = {
@@ -59,6 +59,6 @@ export const meta: WsComponentMeta = {
59
59
  presetStyle,
60
60
  };
61
61
 
62
- export const propsMeta = WsComponentPropsMeta.parse({
62
+ export const propsMeta = {
63
63
  props,
64
- });
64
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { FontBoldIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/bold.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -8,6 +8,6 @@ export const meta: WsComponentMeta = {
8
8
  Icon: FontBoldIcon,
9
9
  };
10
10
 
11
- export const propsMeta = WsComponentPropsMeta.parse({
11
+ export const propsMeta = {
12
12
  props,
13
- });
13
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { SquareIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/box.props.json";
4
4
 
5
5
  const presetStyle = {
@@ -16,7 +16,7 @@ export const meta: WsComponentMeta = {
16
16
  presetStyle,
17
17
  };
18
18
 
19
- export const propsMeta = WsComponentPropsMeta.parse({
19
+ export const propsMeta = {
20
20
  props,
21
21
  initialProps: ["tag"],
22
- });
22
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { ButtonIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/button.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -9,7 +9,7 @@ export const meta: WsComponentMeta = {
9
9
  children: ["Button text you can edit"],
10
10
  };
11
11
 
12
- export const propsMeta = WsComponentPropsMeta.parse({
12
+ export const propsMeta = {
13
13
  props,
14
14
  initialProps: ["type"],
15
- });
15
+ } as WsComponentPropsMeta;
@@ -6,7 +6,7 @@ import { PropMeta } from "@webstudio-is/generate-arg-types";
6
6
 
7
7
  // props are separated from the rest of the meta
8
8
  // so they can be exported separately and potentially tree-shaken
9
- export const WsComponentPropsMeta = z.object({
9
+ const WsComponentPropsMeta = z.object({
10
10
  props: z.record(PropMeta),
11
11
  initialProps: z.array(z.string()).optional(),
12
12
  });
@@ -35,7 +35,7 @@ export type WsComponentMeta = {
35
35
  children?: Array<string>;
36
36
  };
37
37
 
38
- export const WsComponentMeta = z.object({
38
+ const WsComponentMeta = z.object({
39
39
  type: z.enum([
40
40
  "body",
41
41
  "container",
@@ -1,5 +1,5 @@
1
1
  import { FormIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/form.props.json";
4
4
 
5
5
  const presetStyle = {
@@ -21,6 +21,6 @@ export const meta: WsComponentMeta = {
21
21
  presetStyle,
22
22
  };
23
23
 
24
- export const propsMeta = WsComponentPropsMeta.parse({
24
+ export const propsMeta = {
25
25
  props,
26
- });
26
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { HeadingIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/heading.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -9,7 +9,7 @@ export const meta: WsComponentMeta = {
9
9
  children: ["Heading you can edit"],
10
10
  };
11
11
 
12
- export const propsMeta = WsComponentPropsMeta.parse({
12
+ export const propsMeta = {
13
13
  props,
14
14
  initialProps: ["tag"],
15
- });
15
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { ImageIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/image.props.json";
4
4
 
5
5
  const presetStyle = {
@@ -24,10 +24,10 @@ export const meta: WsComponentMeta = {
24
24
  presetStyle,
25
25
  };
26
26
 
27
- export const propsMeta = WsComponentPropsMeta.parse({
27
+ export const propsMeta = {
28
28
  props: {
29
29
  ...props,
30
30
  src: { ...props.src, control: "file-image", name: "Source" },
31
31
  },
32
32
  initialProps: ["src", "width", "height", "alt", "loading"],
33
- });
33
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { InputIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/input.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -8,6 +8,6 @@ export const meta: WsComponentMeta = {
8
8
  Icon: InputIcon,
9
9
  };
10
10
 
11
- export const propsMeta = WsComponentPropsMeta.parse({
11
+ export const propsMeta = {
12
12
  props,
13
- });
13
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { FontItalicIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/italic.props.json";
4
4
 
5
5
  const presetStyle = {
@@ -16,6 +16,6 @@ export const meta: WsComponentMeta = {
16
16
  presetStyle,
17
17
  };
18
18
 
19
- export const propsMeta = WsComponentPropsMeta.parse({
19
+ export const propsMeta = {
20
20
  props,
21
- });
21
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { Link2Icon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/link.props.json";
4
4
 
5
5
  const presetStyle = {
@@ -22,7 +22,7 @@ export const meta: WsComponentMeta = {
22
22
  children: ["Link text you can edit"],
23
23
  };
24
24
 
25
- export const propsMeta = WsComponentPropsMeta.parse({
25
+ export const propsMeta = {
26
26
  props,
27
27
  initialProps: ["href"],
28
- });
28
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { TextAlignLeftIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/paragraph.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -9,6 +9,6 @@ export const meta: WsComponentMeta = {
9
9
  children: ["Pragraph you can edit"],
10
10
  };
11
11
 
12
- export const propsMeta = WsComponentPropsMeta.parse({
12
+ export const propsMeta = {
13
13
  props,
14
- });
14
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { Link2Icon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/rich-text-link.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -8,6 +8,6 @@ export const meta: WsComponentMeta = {
8
8
  Icon: Link2Icon,
9
9
  };
10
10
 
11
- export const propsMeta = WsComponentPropsMeta.parse({
11
+ export const propsMeta = {
12
12
  props,
13
- });
13
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { BrushIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/span.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -8,6 +8,6 @@ export const meta: WsComponentMeta = {
8
8
  Icon: BrushIcon,
9
9
  };
10
10
 
11
- export const propsMeta = WsComponentPropsMeta.parse({
11
+ export const propsMeta = {
12
12
  props,
13
- });
13
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { SubscriptIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/subscript.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -8,6 +8,6 @@ export const meta: WsComponentMeta = {
8
8
  Icon: SubscriptIcon,
9
9
  };
10
10
 
11
- export const propsMeta = WsComponentPropsMeta.parse({
11
+ export const propsMeta = {
12
12
  props,
13
- });
13
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { SuperscriptIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/superscript.props.json";
4
4
 
5
5
  export const meta: WsComponentMeta = {
@@ -8,6 +8,6 @@ export const meta: WsComponentMeta = {
8
8
  Icon: SuperscriptIcon,
9
9
  };
10
10
 
11
- export const propsMeta = WsComponentPropsMeta.parse({
11
+ export const propsMeta = {
12
12
  props,
13
- });
13
+ } as WsComponentPropsMeta;
@@ -1,5 +1,5 @@
1
1
  import { TextIcon } from "@webstudio-is/icons";
2
- import { type WsComponentMeta, WsComponentPropsMeta } from "./component-type";
2
+ import type { WsComponentMeta, WsComponentPropsMeta } from "./component-type";
3
3
  import props from "./__generated__/text-block.props.json";
4
4
 
5
5
  const presetStyle = {
@@ -18,6 +18,6 @@ export const meta: WsComponentMeta = {
18
18
  children: ["Block of text you can edit"],
19
19
  };
20
20
 
21
- export const propsMeta = WsComponentPropsMeta.parse({
21
+ export const propsMeta = {
22
22
  props,
23
- });
23
+ } as WsComponentPropsMeta;
package/src/css/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from "./get-browser-style";
2
2
  export * from "./categories";
3
- export * from "./breakpoints";
@@ -7,43 +7,22 @@ import type { Assets, PropsByInstanceId } from "../props";
7
7
  import type { WrapperComponent } from "./wrapper-component";
8
8
  import { SessionStoragePolyfill } from "./session-storage-polyfill";
9
9
 
10
- export type ChildrenUpdates = Array<
11
- | {
12
- type: "text";
13
- value: string;
14
- }
15
- | {
16
- type: "instance";
17
- id: undefined | Instance["id"];
18
- component: Instance["component"];
19
- children: ChildrenUpdates;
20
- }
21
- >;
22
-
23
- export type OnChangeChildren = (change: {
24
- instanceId: Instance["id"];
25
- updates: ChildrenUpdates;
26
- }) => void;
27
-
28
10
  export const createElementsTree = ({
29
11
  sandbox,
30
12
  instance,
31
13
  propsByInstanceIdStore,
32
14
  assetsStore,
33
15
  Component,
34
- onChangeChildren,
35
16
  }: {
36
17
  sandbox?: boolean;
37
18
  instance: Instance;
38
19
  propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;
39
20
  assetsStore: ReadableAtom<Assets>;
40
21
  Component: (props: ComponentProps<typeof WrapperComponent>) => JSX.Element;
41
- onChangeChildren?: OnChangeChildren;
42
22
  }) => {
43
23
  const children = createInstanceChildrenElements({
44
24
  Component,
45
25
  children: instance.children,
46
- onChangeChildren,
47
26
  });
48
27
  const body = createInstanceElement({
49
28
  Component,
@@ -67,11 +46,9 @@ export const createElementsTree = ({
67
46
  const createInstanceChildrenElements = ({
68
47
  children,
69
48
  Component,
70
- onChangeChildren,
71
49
  }: {
72
50
  children: Instance["children"];
73
51
  Component: (props: ComponentProps<typeof WrapperComponent>) => JSX.Element;
74
- onChangeChildren?: OnChangeChildren;
75
52
  }) => {
76
53
  const elements = [];
77
54
  for (const child of children) {
@@ -82,12 +59,10 @@ const createInstanceChildrenElements = ({
82
59
  const children = createInstanceChildrenElements({
83
60
  children: child.children,
84
61
  Component,
85
- onChangeChildren,
86
62
  });
87
63
  const element = createInstanceElement({
88
64
  instance: child,
89
65
  Component,
90
- onChangeChildren,
91
66
  children,
92
67
  });
93
68
  elements.push(element);
@@ -99,18 +74,15 @@ const createInstanceElement = ({
99
74
  Component,
100
75
  instance,
101
76
  children = [],
102
- onChangeChildren,
103
77
  }: {
104
78
  instance: Instance;
105
79
  Component: (props: ComponentProps<typeof WrapperComponent>) => JSX.Element;
106
- onChangeChildren?: OnChangeChildren;
107
80
  children?: Array<JSX.Element | string>;
108
81
  }) => {
109
82
  const props = {
110
83
  instance,
111
84
  children,
112
85
  key: instance.id,
113
- onChangeChildren,
114
86
  };
115
87
 
116
88
  return <Component {...props} />;
@@ -2,7 +2,6 @@ import { Fragment } from "react";
2
2
  import type { Instance } from "@webstudio-is/project-build";
3
3
  import { getComponent } from "../components";
4
4
  import { useInstanceProps } from "../props";
5
- import type { OnChangeChildren } from "./create-elements-tree";
6
5
 
7
6
  const renderText = (text: string): Array<JSX.Element> => {
8
7
  const lines = text.split("\n");
@@ -30,12 +29,10 @@ export const renderWrapperComponentChildren = (
30
29
  type WrapperComponentProps = {
31
30
  instance: Instance;
32
31
  children: Array<JSX.Element | string>;
33
- onChangeChildren?: OnChangeChildren;
34
32
  };
35
33
 
36
34
  export const WrapperComponent = ({
37
35
  instance,
38
- onChangeChildren, // prevent it from passing to sdk component
39
36
  children,
40
37
  ...rest
41
38
  }: WrapperComponentProps) => {
@@ -57,3 +54,4 @@ export const WrapperComponent = ({
57
54
 
58
55
  export const idAttribute = "data-ws-id";
59
56
  export const componentAttribute = "data-ws-component";
57
+ export const collapsedAttribute = "data-ws-collapsed";