@webstudio-is/react-sdk 0.60.0 → 0.61.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 (83) hide show
  1. package/lib/cjs/components/blockquote.ws.js +36 -48
  2. package/lib/cjs/components/body.ws.js +20 -17
  3. package/lib/cjs/components/button.ws.js +1 -1
  4. package/lib/cjs/components/code.ws.js +20 -28
  5. package/lib/cjs/components/component-meta.js +2 -1
  6. package/lib/cjs/components/form.ws.js +14 -7
  7. package/lib/cjs/components/heading.ws.js +1 -1
  8. package/lib/cjs/components/image.ws.js +8 -9
  9. package/lib/cjs/components/italic.ws.js +5 -5
  10. package/lib/cjs/components/link-block.ws.js +5 -5
  11. package/lib/cjs/components/link.ws.js +9 -10
  12. package/lib/cjs/components/list-item.ws.js +1 -1
  13. package/lib/cjs/components/list.ws.js +22 -22
  14. package/lib/cjs/components/paragraph.ws.js +1 -1
  15. package/lib/cjs/components/separator.ws.js +20 -20
  16. package/lib/cjs/components/text-block.ws.js +6 -7
  17. package/lib/cjs/css/css.js +6 -9
  18. package/lib/cjs/css/normalize.js +166 -185
  19. package/lib/cjs/css/presets.js +14 -34
  20. package/lib/cjs/css/style-rules.js +17 -0
  21. package/lib/cjs/embed-template.js +160 -0
  22. package/lib/cjs/index.js +1 -0
  23. package/lib/components/blockquote.ws.js +36 -48
  24. package/lib/components/body.ws.js +20 -17
  25. package/lib/components/button.ws.js +1 -1
  26. package/lib/components/code.ws.js +20 -28
  27. package/lib/components/component-meta.js +2 -1
  28. package/lib/components/form.ws.js +14 -7
  29. package/lib/components/heading.ws.js +1 -1
  30. package/lib/components/image.ws.js +8 -9
  31. package/lib/components/italic.ws.js +5 -5
  32. package/lib/components/link-block.ws.js +5 -5
  33. package/lib/components/link.ws.js +9 -10
  34. package/lib/components/list-item.ws.js +1 -1
  35. package/lib/components/list.ws.js +22 -22
  36. package/lib/components/paragraph.ws.js +1 -1
  37. package/lib/components/separator.ws.js +20 -20
  38. package/lib/components/text-block.ws.js +6 -7
  39. package/lib/css/css.js +8 -11
  40. package/lib/css/normalize.js +166 -185
  41. package/lib/css/presets.js +14 -34
  42. package/lib/css/style-rules.js +17 -0
  43. package/lib/embed-template.js +140 -0
  44. package/lib/index.js +1 -0
  45. package/lib/types/components/box.stories.d.ts +2 -2
  46. package/lib/types/components/component-meta.d.ts +20 -5
  47. package/lib/types/components/components-utils.d.ts +1 -1
  48. package/lib/types/css/normalize.d.ts +8786 -2286
  49. package/lib/types/css/presets.d.ts +2 -38
  50. package/lib/types/css/style-rules.d.ts +11 -9
  51. package/lib/types/embed-template.d.ts +1725 -0
  52. package/lib/types/embed-template.test.d.ts +1 -0
  53. package/lib/types/index.d.ts +1 -0
  54. package/package.json +14 -13
  55. package/src/components/blockquote.ws.tsx +42 -52
  56. package/src/components/body.ws.tsx +26 -23
  57. package/src/components/bold.ws.tsx +6 -3
  58. package/src/components/box.ws.ts +6 -3
  59. package/src/components/button.ws.tsx +7 -4
  60. package/src/components/code.ws.tsx +26 -32
  61. package/src/components/component-meta.ts +5 -3
  62. package/src/components/form.ws.tsx +19 -9
  63. package/src/components/heading.ws.tsx +7 -4
  64. package/src/components/image.ws.tsx +14 -12
  65. package/src/components/input.ws.tsx +6 -3
  66. package/src/components/italic.ws.tsx +11 -8
  67. package/src/components/link-block.ws.tsx +11 -8
  68. package/src/components/link.ws.tsx +15 -13
  69. package/src/components/list-item.ws.tsx +7 -4
  70. package/src/components/list.ws.tsx +28 -25
  71. package/src/components/paragraph.ws.tsx +7 -4
  72. package/src/components/separator.ws.tsx +26 -25
  73. package/src/components/span.ws.tsx +6 -3
  74. package/src/components/subscript.ws.tsx +6 -3
  75. package/src/components/superscript.ws.tsx +6 -3
  76. package/src/components/text-block.ws.tsx +12 -11
  77. package/src/css/css.ts +8 -11
  78. package/src/css/normalize.ts +165 -188
  79. package/src/css/presets.ts +15 -37
  80. package/src/css/style-rules.ts +24 -0
  81. package/src/embed-template.test.ts +210 -0
  82. package/src/embed-template.ts +187 -0
  83. package/src/index.ts +1 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -7,3 +7,4 @@ export * from "./components/components";
7
7
  export * from "./components/components-utils";
8
8
  export { customComponents, customComponentMetas, customComponentPropsMetas, } from "./app/custom-components";
9
9
  export { type WsComponentPropsMeta, type WsComponentMeta, type ComponentState, componentCategories, } from "./components/component-meta";
10
+ export * from "./embed-template";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.60.0",
3
+ "version": "0.61.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -17,10 +17,10 @@
17
17
  "react-dom": "^18.2.0",
18
18
  "typescript": "5.0.3",
19
19
  "zod": "^3.19.1",
20
- "@webstudio-is/jest-config": "^1.0.5",
20
+ "@webstudio-is/jest-config": "^1.0.6",
21
21
  "@webstudio-is/scripts": "^0.0.0",
22
22
  "@webstudio-is/storybook-config": "^0.0.0",
23
- "@webstudio-is/tsconfig": "^1.0.5"
23
+ "@webstudio-is/tsconfig": "^1.0.6"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@remix-run/react": "^1.15.0",
@@ -33,17 +33,18 @@
33
33
  "detect-font": "^0.1.5",
34
34
  "html-tags": "^3.2.0",
35
35
  "nanoevents": "^7.0.1",
36
+ "nanoid": "^3.2.0",
36
37
  "nanostores": "^0.7.1",
37
- "@webstudio-is/asset-uploader": "^0.60.0",
38
- "@webstudio-is/css-data": "^0.60.0",
39
- "@webstudio-is/css-engine": "^0.60.0",
40
- "@webstudio-is/css-vars": "^0.60.0",
41
- "@webstudio-is/fonts": "^0.60.0",
42
- "@webstudio-is/generate-arg-types": "^0.60.0",
43
- "@webstudio-is/icons": "^0.60.0",
44
- "@webstudio-is/image": "^0.60.0",
45
- "@webstudio-is/prisma-client": "^0.60.0",
46
- "@webstudio-is/project-build": "^0.60.0"
38
+ "@webstudio-is/asset-uploader": "^0.61.0",
39
+ "@webstudio-is/css-data": "^0.61.0",
40
+ "@webstudio-is/css-engine": "^0.61.0",
41
+ "@webstudio-is/css-vars": "^0.61.0",
42
+ "@webstudio-is/fonts": "^0.61.0",
43
+ "@webstudio-is/generate-arg-types": "^0.61.0",
44
+ "@webstudio-is/icons": "^0.61.0",
45
+ "@webstudio-is/image": "^0.61.0",
46
+ "@webstudio-is/prisma-client": "^0.61.0",
47
+ "@webstudio-is/project-build": "^0.61.0"
47
48
  },
48
49
  "exports": {
49
50
  ".": {
@@ -1,72 +1,62 @@
1
- import type { Style } from "@webstudio-is/css-data";
2
1
  import { BlockquoteIcon } from "@webstudio-is/icons";
3
2
  import type { defaultTag } from "./blockquote";
4
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
+ import type {
4
+ PresetStyle,
5
+ WsComponentMeta,
6
+ WsComponentPropsMeta,
7
+ } from "./component-meta";
5
8
  import { props } from "./__generated__/blockquote.props";
6
9
 
7
10
  const presetStyle = {
8
- blockquote: {
9
- marginTop: {
10
- type: "unit",
11
- value: 0,
12
- unit: "number",
11
+ blockquote: [
12
+ {
13
+ property: "marginTop",
14
+ value: { type: "unit", value: 0, unit: "number" },
13
15
  },
14
- marginRight: {
15
- type: "unit",
16
- value: 0,
17
- unit: "number",
16
+ {
17
+ property: "marginRight",
18
+ value: { type: "unit", value: 0, unit: "number" },
18
19
  },
19
- marginBottom: {
20
- type: "unit",
21
- value: 10,
22
- unit: "px",
20
+ {
21
+ property: "marginBottom",
22
+ value: { type: "unit", value: 10, unit: "px" },
23
23
  },
24
- marginLeft: {
25
- type: "unit",
26
- value: 0,
27
- unit: "number",
24
+ {
25
+ property: "marginLeft",
26
+ value: { type: "unit", value: 0, unit: "number" },
28
27
  },
29
28
 
30
- paddingTop: {
31
- type: "unit",
32
- value: 10,
33
- unit: "px",
29
+ {
30
+ property: "paddingTop",
31
+ value: { type: "unit", value: 10, unit: "px" },
34
32
  },
35
- paddingBottom: {
36
- type: "unit",
37
- value: 10,
38
- unit: "px",
33
+ {
34
+ property: "paddingBottom",
35
+ value: { type: "unit", value: 10, unit: "px" },
39
36
  },
40
- paddingLeft: {
41
- type: "unit",
42
- value: 20,
43
- unit: "px",
37
+ {
38
+ property: "paddingLeft",
39
+ value: { type: "unit", value: 20, unit: "px" },
44
40
  },
45
- paddingRight: {
46
- type: "unit",
47
- value: 20,
48
- unit: "px",
41
+ {
42
+ property: "paddingRight",
43
+ value: { type: "unit", value: 20, unit: "px" },
49
44
  },
50
45
 
51
- borderLeftWidth: {
52
- type: "unit",
53
- value: 5,
54
- unit: "px",
46
+ {
47
+ property: "borderLeftWidth",
48
+ value: { type: "unit", value: 5, unit: "px" },
55
49
  },
56
- borderLeftStyle: {
57
- type: "keyword",
58
- value: "solid",
50
+ {
51
+ property: "borderLeftStyle",
52
+ value: { type: "keyword", value: "solid" },
59
53
  },
60
-
61
- borderLeftColor: {
62
- type: "rgb",
63
- r: 226,
64
- g: 226,
65
- b: 226,
66
- alpha: 1,
54
+ {
55
+ property: "borderLeftColor",
56
+ value: { type: "rgb", r: 226, g: 226, b: 226, alpha: 1 },
67
57
  },
68
- },
69
- } as const satisfies Record<typeof defaultTag, Style>;
58
+ ],
59
+ } satisfies PresetStyle<typeof defaultTag>;
70
60
 
71
61
  export const meta: WsComponentMeta = {
72
62
  category: "typography",
@@ -74,7 +64,7 @@ export const meta: WsComponentMeta = {
74
64
  label: "Blockquote",
75
65
  Icon: BlockquoteIcon,
76
66
  presetStyle,
77
- children: ["Blockquote you can edit"],
67
+ children: [{ type: "text", value: "Blockquote you can edit" }],
78
68
  };
79
69
 
80
70
  export const propsMeta: WsComponentPropsMeta = {
@@ -1,38 +1,41 @@
1
1
  import { BodyIcon } from "@webstudio-is/icons";
2
2
  import { body } from "../css/normalize";
3
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
+ import type {
4
+ PresetStyle,
5
+ WsComponentMeta,
6
+ WsComponentPropsMeta,
7
+ } from "./component-meta";
4
8
  import { props } from "./__generated__/body.props";
5
9
  import type { defaultTag } from "./body";
6
- import type { Style } from "@webstudio-is/css-data";
7
10
 
8
11
  const presetStyle = {
9
- body: {
12
+ body: [
10
13
  ...body,
11
14
 
12
- minHeight: {
13
- type: "unit",
14
- unit: "%",
15
- value: 100,
15
+ {
16
+ property: "minHeight",
17
+ value: { type: "unit", unit: "%", value: 100 },
16
18
  },
17
-
18
- fontFamily: {
19
- type: "keyword",
20
- value: "Arial",
19
+ {
20
+ property: "fontFamily",
21
+ value: { type: "keyword", value: "Arial" },
21
22
  },
22
-
23
- fontSize: {
24
- type: "unit",
25
- unit: "px",
26
- value: 14,
23
+ {
24
+ property: "fontSize",
25
+ value: { type: "unit", unit: "px", value: 14 },
27
26
  },
28
-
29
- lineHeight: {
30
- type: "unit",
31
- unit: "number",
32
- value: 1.5,
27
+ {
28
+ property: "lineHeight",
29
+ value: { type: "unit", unit: "number", value: 1.5 },
30
+ },
31
+ // temporary set root color
32
+ // until builder start to fallback "inherit" to black
33
+ {
34
+ property: "color",
35
+ value: { type: "keyword", value: "black" },
33
36
  },
34
- },
35
- } as const satisfies Record<typeof defaultTag, Style>;
37
+ ],
38
+ } satisfies PresetStyle<typeof defaultTag>;
36
39
 
37
40
  export const meta: WsComponentMeta = {
38
41
  type: "container",
@@ -1,13 +1,16 @@
1
1
  import { BoldIcon } from "@webstudio-is/icons";
2
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
2
+ import type {
3
+ PresetStyle,
4
+ WsComponentMeta,
5
+ WsComponentPropsMeta,
6
+ } from "./component-meta";
3
7
  import { props } from "./__generated__/bold.props";
4
8
  import { b } from "../css/normalize";
5
- import type { Style } from "@webstudio-is/css-data";
6
9
  import type { defaultTag } from "./bold";
7
10
 
8
11
  const presetStyle = {
9
12
  b,
10
- } as const satisfies Record<typeof defaultTag, Style>;
13
+ } satisfies PresetStyle<typeof defaultTag>;
11
14
 
12
15
  export const meta: WsComponentMeta = {
13
16
  type: "rich-text-child",
@@ -1,9 +1,12 @@
1
1
  import { BoxIcon } from "@webstudio-is/icons";
2
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
2
+ import type {
3
+ PresetStyle,
4
+ WsComponentMeta,
5
+ WsComponentPropsMeta,
6
+ } from "./component-meta";
3
7
  import { props } from "./__generated__/box.props";
4
8
  import type { Box } from "./box";
5
9
  import type { ComponentProps } from "react";
6
- import type { Style } from "@webstudio-is/css-data";
7
10
  import {
8
11
  div,
9
12
  address,
@@ -30,7 +33,7 @@ const presetStyle = {
30
33
  main,
31
34
  nav,
32
35
  section,
33
- } as const satisfies Record<BoxTags, Style>;
36
+ } satisfies PresetStyle<BoxTags>;
34
37
 
35
38
  export const meta: WsComponentMeta = {
36
39
  category: "general",
@@ -1,13 +1,16 @@
1
1
  import { ButtonElementIcon } from "@webstudio-is/icons";
2
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
- import { props } from "./__generated__/button.props";
4
2
  import { button } from "../css/normalize";
3
+ import type {
4
+ PresetStyle,
5
+ WsComponentMeta,
6
+ WsComponentPropsMeta,
7
+ } from "./component-meta";
8
+ import { props } from "./__generated__/button.props";
5
9
  import type { defaultTag } from "./button";
6
- import type { Style } from "@webstudio-is/css-data";
7
10
 
8
11
  const presetStyle = {
9
12
  button,
10
- } as const satisfies Record<typeof defaultTag, Style>;
13
+ } satisfies PresetStyle<typeof defaultTag>;
11
14
 
12
15
  export const meta: WsComponentMeta = {
13
16
  category: "forms",
@@ -1,44 +1,38 @@
1
1
  import { CodeIcon } from "@webstudio-is/icons";
2
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
2
+ import type {
3
+ PresetStyle,
4
+ WsComponentMeta,
5
+ WsComponentPropsMeta,
6
+ } from "./component-meta";
3
7
  import { type defaultTag, displayVarNamespace } from "./code";
4
8
  import { props } from "./__generated__/code.props";
5
- import type { Style, StyleValue } from "@webstudio-is/css-data";
6
9
  import { code } from "../css/normalize";
7
10
 
8
- const display: StyleValue = {
9
- type: "var",
10
- value: displayVarNamespace,
11
- fallbacks: [
12
- {
13
- type: "keyword",
14
- value: "inline-block",
15
- },
16
- ],
17
- };
18
-
19
11
  const presetStyle = {
20
- code: {
12
+ code: [
21
13
  ...code,
22
- display,
23
- paddingLeft: {
24
- type: "unit",
25
- value: 0.2,
26
- unit: "em",
14
+ {
15
+ property: "display",
16
+ value: {
17
+ type: "var",
18
+ value: displayVarNamespace,
19
+ fallbacks: [{ type: "keyword", value: "inline-block" }],
20
+ },
27
21
  },
28
- paddingRight: {
29
- type: "unit",
30
- value: 0.2,
31
- unit: "em",
22
+ {
23
+ property: "paddingLeft",
24
+ value: { type: "unit", value: 0.2, unit: "em" },
32
25
  },
33
- backgroundColor: {
34
- type: "rgb",
35
- r: 238,
36
- g: 238,
37
- b: 238,
38
- alpha: 1,
26
+ {
27
+ property: "paddingRight",
28
+ value: { type: "unit", value: 0.2, unit: "em" },
39
29
  },
40
- },
41
- } as const satisfies Record<typeof defaultTag, Style>;
30
+ {
31
+ property: "backgroundColor",
32
+ value: { type: "rgb", r: 238, g: 238, b: 238, alpha: 1 },
33
+ },
34
+ ],
35
+ } satisfies PresetStyle<typeof defaultTag>;
42
36
 
43
37
  export const meta: WsComponentMeta = {
44
38
  category: "general",
@@ -46,7 +40,7 @@ export const meta: WsComponentMeta = {
46
40
  label: "Code",
47
41
  Icon: CodeIcon,
48
42
  presetStyle,
49
- children: ["Code you can edit"],
43
+ children: [{ type: "text", value: "Code you can edit" }],
50
44
  };
51
45
 
52
46
  export const propsMeta: WsComponentPropsMeta = {
@@ -1,11 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import type { FunctionComponent } from "react";
3
3
  import type { IconProps } from "@webstudio-is/icons";
4
- import type { Style } from "@webstudio-is/css-data";
5
4
  import { PropMeta } from "@webstudio-is/generate-arg-types";
6
5
  import type { htmlTags as HtmlTags } from "html-tags";
6
+ import { EmbedTemplateStyleDecl, WsEmbedTemplate } from "../embed-template";
7
7
 
8
- type PresetStyle = Partial<Record<HtmlTags, Style>>;
8
+ export type PresetStyle<Tag extends HtmlTags = HtmlTags> = Partial<
9
+ Record<Tag, EmbedTemplateStyleDecl[]>
10
+ >;
9
11
 
10
12
  // props are separated from the rest of the meta
11
13
  // so they can be exported separately and potentially tree-shaken
@@ -48,7 +50,7 @@ const WsComponentMeta = z.object({
48
50
  Icon: z.function(),
49
51
  presetStyle: z.optional(z.any()),
50
52
  states: z.optional(z.array(ComponentState)),
51
- children: z.optional(z.array(z.string())),
53
+ children: z.optional(WsEmbedTemplate),
52
54
  });
53
55
 
54
56
  export type WsComponentMeta = Omit<
@@ -1,20 +1,22 @@
1
- import type { Style } from "@webstudio-is/css-data";
2
1
  import { FormIcon } from "@webstudio-is/icons";
3
2
  import { form } from "../css/normalize";
4
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
+ import type {
4
+ PresetStyle,
5
+ WsComponentMeta,
6
+ WsComponentPropsMeta,
7
+ } from "./component-meta";
5
8
  import type { defaultTag } from "./form";
6
9
  import { props } from "./__generated__/form.props";
7
10
 
8
11
  const presetStyle = {
9
- form: {
12
+ form: [
10
13
  ...form,
11
- minHeight: {
12
- type: "unit",
13
- unit: "px",
14
- value: 20,
14
+ {
15
+ property: "minHeight",
16
+ value: { type: "unit", unit: "px", value: 20 },
15
17
  },
16
- },
17
- } as const satisfies Record<typeof defaultTag, Style>;
18
+ ],
19
+ } satisfies PresetStyle<typeof defaultTag>;
18
20
 
19
21
  export const meta: WsComponentMeta = {
20
22
  category: "forms",
@@ -22,6 +24,14 @@ export const meta: WsComponentMeta = {
22
24
  label: "Form",
23
25
  Icon: FormIcon,
24
26
  presetStyle,
27
+ children: [
28
+ { type: "instance", component: "Input", children: [] },
29
+ {
30
+ type: "instance",
31
+ component: "Button",
32
+ children: [{ type: "text", value: "Submit" }],
33
+ },
34
+ ],
25
35
  };
26
36
 
27
37
  export const propsMeta: WsComponentPropsMeta = {
@@ -1,8 +1,11 @@
1
- import type { Style } from "@webstudio-is/css-data";
2
1
  import { HeadingIcon } from "@webstudio-is/icons";
3
2
  import type { ComponentProps } from "react";
4
3
  import { h1, h2, h3, h4, h5, h6 } from "../css/normalize";
5
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
4
+ import type {
5
+ PresetStyle,
6
+ WsComponentMeta,
7
+ WsComponentPropsMeta,
8
+ } from "./component-meta";
6
9
  import type { Heading } from "./heading";
7
10
  import { props } from "./__generated__/heading.props";
8
11
 
@@ -15,14 +18,14 @@ const presetStyle = {
15
18
  h4,
16
19
  h5,
17
20
  h6,
18
- } as const satisfies Record<HeadingTags, Style>;
21
+ } satisfies PresetStyle<HeadingTags>;
19
22
 
20
23
  export const meta: WsComponentMeta = {
21
24
  category: "typography",
22
25
  type: "rich-text",
23
26
  label: "Heading",
24
27
  Icon: HeadingIcon,
25
- children: ["Heading you can edit"],
28
+ children: [{ type: "text", value: "Heading you can edit" }],
26
29
  presetStyle,
27
30
  };
28
31
 
@@ -1,28 +1,30 @@
1
- import type { Style } from "@webstudio-is/css-data";
2
1
  import { ImageIcon } from "@webstudio-is/icons";
3
2
  import { img } from "../css/normalize";
4
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
+ import type {
4
+ PresetStyle,
5
+ WsComponentMeta,
6
+ WsComponentPropsMeta,
7
+ } from "./component-meta";
5
8
  import type { defaultTag } from "./image";
6
9
  import { props } from "./__generated__/image.props";
7
10
 
8
11
  const presetStyle = {
9
- img: {
12
+ img: [
10
13
  ...img,
11
14
 
12
15
  // Otherwise on new image insert onto canvas it can overfit screen size multiple times
13
- maxWidth: {
14
- type: "unit",
15
- unit: "%",
16
- value: 100,
16
+ {
17
+ property: "maxWidth",
18
+ value: { type: "unit", unit: "%", value: 100 },
17
19
  },
18
20
  // inline | inline-block is not suitable because without line-height: 0 on the parent you get unsuitable spaces/margins
19
21
  // see https://stackoverflow.com/questions/24771194/is-the-margin-of-inline-block-4px-is-static-for-all-browsers
20
- display: {
21
- type: "keyword",
22
- value: "block",
22
+ {
23
+ property: "display",
24
+ value: { type: "keyword", value: "block" },
23
25
  },
24
- },
25
- } as const satisfies Record<typeof defaultTag, Style>;
26
+ ],
27
+ } satisfies PresetStyle<typeof defaultTag>;
26
28
 
27
29
  export const meta: WsComponentMeta = {
28
30
  category: "media",
@@ -1,13 +1,16 @@
1
- import type { Style } from "@webstudio-is/css-data";
2
1
  import { FormTextFieldIcon } from "@webstudio-is/icons";
3
2
  import { input } from "../css/normalize";
4
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
+ import type {
4
+ PresetStyle,
5
+ WsComponentMeta,
6
+ WsComponentPropsMeta,
7
+ } from "./component-meta";
5
8
  import type { defaultTag } from "./input";
6
9
  import { props } from "./__generated__/input.props";
7
10
 
8
11
  const presetStyle = {
9
12
  input,
10
- } as const satisfies Record<typeof defaultTag, Style>;
13
+ } satisfies PresetStyle<typeof defaultTag>;
11
14
 
12
15
  export const meta: WsComponentMeta = {
13
16
  category: "forms",
@@ -1,19 +1,22 @@
1
- import type { Style } from "@webstudio-is/css-data";
2
1
  import { TextItalicIcon } from "@webstudio-is/icons";
3
2
  import type { defaultTag } from "./italic";
4
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
3
+ import type {
4
+ PresetStyle,
5
+ WsComponentMeta,
6
+ WsComponentPropsMeta,
7
+ } from "./component-meta";
5
8
  import { props } from "./__generated__/italic.props";
6
9
  import { i } from "../css/normalize";
7
10
 
8
11
  const presetStyle = {
9
- i: {
12
+ i: [
10
13
  ...i,
11
- fontStyle: {
12
- type: "keyword",
13
- value: "italic",
14
+ {
15
+ property: "fontStyle",
16
+ value: { type: "keyword", value: "italic" },
14
17
  },
15
- },
16
- } as const satisfies Record<typeof defaultTag, Style>;
18
+ ],
19
+ } satisfies PresetStyle<typeof defaultTag>;
17
20
 
18
21
  export const meta: WsComponentMeta = {
19
22
  type: "rich-text-child",
@@ -1,20 +1,23 @@
1
1
  import { BoxLinkIcon } from "@webstudio-is/icons";
2
- import type { WsComponentMeta, WsComponentPropsMeta } from "./component-meta";
2
+ import type {
3
+ PresetStyle,
4
+ WsComponentMeta,
5
+ WsComponentPropsMeta,
6
+ } from "./component-meta";
3
7
  import { props } from "./__generated__/link-block.props";
4
8
  import { meta as linkMeta, propsMeta as linkPropsMeta } from "./link.ws";
5
9
  import type { defaultTag } from "./link-block";
6
- import type { Style } from "@webstudio-is/css-data";
7
10
  import { a } from "../css/normalize";
8
11
 
9
12
  const presetStyle = {
10
- a: {
13
+ a: [
11
14
  ...a,
12
- display: {
13
- type: "keyword",
14
- value: "inline-block",
15
+ {
16
+ property: "display",
17
+ value: { type: "keyword", value: "inline-block" },
15
18
  },
16
- },
17
- } as const satisfies Record<typeof defaultTag, Style>;
19
+ ],
20
+ } satisfies PresetStyle<typeof defaultTag>;
18
21
 
19
22
  export const meta: WsComponentMeta = {
20
23
  category: "general",