@webstudio-is/react-sdk 0.60.0 → 0.62.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 (233) hide show
  1. package/lib/app/custom-components/__generated__/form.props.js +412 -0
  2. package/lib/app/custom-components/__generated__/image.props.js +442 -0
  3. package/lib/app/custom-components/__generated__/link-block.props.js +432 -0
  4. package/lib/app/custom-components/__generated__/link.props.js +432 -0
  5. package/lib/app/custom-components/__generated__/rich-text-link.props.js +432 -0
  6. package/lib/app/custom-components/form.js +54 -0
  7. package/lib/app/custom-components/form.ws.js +81 -0
  8. package/lib/app/custom-components/index.js +10 -4
  9. package/lib/cjs/app/custom-components/__generated__/form.props.js +432 -0
  10. package/lib/cjs/app/custom-components/__generated__/image.props.js +462 -0
  11. package/lib/cjs/app/custom-components/__generated__/link-block.props.js +452 -0
  12. package/lib/cjs/app/custom-components/__generated__/link.props.js +452 -0
  13. package/lib/cjs/app/custom-components/__generated__/rich-text-link.props.js +452 -0
  14. package/lib/cjs/app/custom-components/form.js +70 -0
  15. package/lib/cjs/app/custom-components/form.ws.js +101 -0
  16. package/lib/cjs/app/custom-components/index.js +12 -6
  17. package/lib/cjs/components/__generated__/checkbox-field.props.js +419 -0
  18. package/lib/cjs/components/__generated__/checkbox.props.js +459 -0
  19. package/lib/cjs/components/__generated__/error-message.props.js +418 -0
  20. package/lib/cjs/components/__generated__/input.props.js +8 -3
  21. package/lib/cjs/components/__generated__/label.props.js +420 -0
  22. package/lib/cjs/components/__generated__/radio-button-field.props.js +419 -0
  23. package/lib/cjs/components/__generated__/radio-button.props.js +459 -0
  24. package/lib/cjs/components/__generated__/success-message.props.js +418 -0
  25. package/lib/cjs/components/__generated__/textarea.props.js +432 -0
  26. package/lib/cjs/components/blockquote.ws.js +36 -48
  27. package/lib/cjs/components/body.ws.js +20 -17
  28. package/lib/cjs/components/button.ws.js +8 -3
  29. package/lib/cjs/components/checkbox-field.js +29 -0
  30. package/lib/cjs/components/checkbox-field.ws.js +53 -0
  31. package/lib/cjs/components/checkbox.js +29 -0
  32. package/lib/cjs/components/checkbox.ws.js +55 -0
  33. package/lib/cjs/components/code.ws.js +20 -28
  34. package/lib/cjs/components/component-meta.js +3 -1
  35. package/lib/cjs/components/components-utils.js +9 -1
  36. package/lib/cjs/components/components.js +17 -1
  37. package/lib/cjs/components/error-message.js +29 -0
  38. package/lib/cjs/components/error-message.ws.js +40 -0
  39. package/lib/cjs/components/form.js +1 -1
  40. package/lib/cjs/components/form.ws.js +35 -9
  41. package/lib/cjs/components/heading.ws.js +1 -1
  42. package/lib/cjs/components/image.ws.js +8 -9
  43. package/lib/cjs/components/index.js +43 -2
  44. package/lib/cjs/components/input.ws.js +15 -3
  45. package/lib/cjs/components/italic.ws.js +5 -5
  46. package/lib/cjs/components/label.js +29 -0
  47. package/lib/cjs/components/label.ws.js +54 -0
  48. package/lib/cjs/components/link-block.ws.js +6 -6
  49. package/lib/cjs/components/link.ws.js +9 -10
  50. package/lib/cjs/components/list-item.ws.js +2 -1
  51. package/lib/cjs/components/list.ws.js +22 -22
  52. package/lib/cjs/components/paragraph.ws.js +1 -1
  53. package/lib/cjs/components/radio-button-field.js +29 -0
  54. package/lib/cjs/components/radio-button-field.ws.js +53 -0
  55. package/lib/cjs/components/radio-button.js +29 -0
  56. package/lib/cjs/components/radio-button.ws.js +55 -0
  57. package/lib/cjs/components/separator.ws.js +20 -20
  58. package/lib/cjs/components/success-message.js +29 -0
  59. package/lib/cjs/components/success-message.ws.js +40 -0
  60. package/lib/cjs/components/text-block.ws.js +6 -7
  61. package/lib/cjs/components/textarea.js +29 -0
  62. package/lib/cjs/components/textarea.ws.js +56 -0
  63. package/lib/cjs/css/css.js +6 -9
  64. package/lib/cjs/css/normalize.js +168 -185
  65. package/lib/cjs/css/presets.js +14 -34
  66. package/lib/cjs/css/style-rules.js +17 -0
  67. package/lib/cjs/embed-template.js +160 -0
  68. package/lib/cjs/index.js +1 -0
  69. package/lib/components/__generated__/checkbox-field.props.js +399 -0
  70. package/lib/components/__generated__/checkbox.props.js +439 -0
  71. package/lib/components/__generated__/error-message.props.js +398 -0
  72. package/lib/components/__generated__/input.props.js +8 -3
  73. package/lib/components/__generated__/label.props.js +400 -0
  74. package/lib/components/__generated__/radio-button-field.props.js +399 -0
  75. package/lib/components/__generated__/radio-button.props.js +439 -0
  76. package/lib/components/__generated__/success-message.props.js +398 -0
  77. package/lib/components/__generated__/textarea.props.js +412 -0
  78. package/lib/components/blockquote.ws.js +36 -48
  79. package/lib/components/body.ws.js +20 -17
  80. package/lib/components/button.ws.js +8 -3
  81. package/lib/components/checkbox-field.js +9 -0
  82. package/lib/components/checkbox-field.ws.js +33 -0
  83. package/lib/components/checkbox.js +9 -0
  84. package/lib/components/checkbox.ws.js +35 -0
  85. package/lib/components/code.ws.js +20 -28
  86. package/lib/components/component-meta.js +3 -1
  87. package/lib/components/components-utils.js +9 -1
  88. package/lib/components/components.js +17 -1
  89. package/lib/components/error-message.js +9 -0
  90. package/lib/components/error-message.ws.js +20 -0
  91. package/lib/components/form.js +1 -1
  92. package/lib/components/form.ws.js +35 -9
  93. package/lib/components/heading.ws.js +1 -1
  94. package/lib/components/image.ws.js +8 -9
  95. package/lib/components/index.js +43 -2
  96. package/lib/components/input.ws.js +15 -3
  97. package/lib/components/italic.ws.js +5 -5
  98. package/lib/components/label.js +9 -0
  99. package/lib/components/label.ws.js +34 -0
  100. package/lib/components/link-block.ws.js +7 -7
  101. package/lib/components/link.ws.js +9 -10
  102. package/lib/components/list-item.ws.js +2 -1
  103. package/lib/components/list.ws.js +22 -22
  104. package/lib/components/paragraph.ws.js +1 -1
  105. package/lib/components/radio-button-field.js +9 -0
  106. package/lib/components/radio-button-field.ws.js +33 -0
  107. package/lib/components/radio-button.js +9 -0
  108. package/lib/components/radio-button.ws.js +35 -0
  109. package/lib/components/separator.ws.js +20 -20
  110. package/lib/components/success-message.js +9 -0
  111. package/lib/components/success-message.ws.js +20 -0
  112. package/lib/components/text-block.ws.js +6 -7
  113. package/lib/components/textarea.js +9 -0
  114. package/lib/components/textarea.ws.js +36 -0
  115. package/lib/css/css.js +8 -11
  116. package/lib/css/normalize.js +168 -185
  117. package/lib/css/presets.js +14 -34
  118. package/lib/css/style-rules.js +17 -0
  119. package/lib/embed-template.js +140 -0
  120. package/lib/index.js +1 -0
  121. package/lib/types/app/custom-components/__generated__/form.props.d.ts +2 -0
  122. package/lib/types/app/custom-components/__generated__/image.props.d.ts +2 -0
  123. package/lib/types/app/custom-components/__generated__/link-block.props.d.ts +2 -0
  124. package/lib/types/app/custom-components/__generated__/link.props.d.ts +2 -0
  125. package/lib/types/app/custom-components/__generated__/rich-text-link.props.d.ts +2 -0
  126. package/lib/types/app/custom-components/form.d.ts +5 -0
  127. package/lib/types/app/custom-components/form.ws.d.ts +3 -0
  128. package/lib/types/app/custom-components/index.d.ts +6 -1
  129. package/lib/types/components/__generated__/checkbox-field.props.d.ts +2 -0
  130. package/lib/types/components/__generated__/checkbox.props.d.ts +2 -0
  131. package/lib/types/components/__generated__/error-message.props.d.ts +2 -0
  132. package/lib/types/components/__generated__/label.props.d.ts +2 -0
  133. package/lib/types/components/__generated__/radio-button-field.props.d.ts +2 -0
  134. package/lib/types/components/__generated__/radio-button.props.d.ts +2 -0
  135. package/lib/types/components/__generated__/success-message.props.d.ts +2 -0
  136. package/lib/types/components/__generated__/textarea.props.d.ts +2 -0
  137. package/lib/types/components/box.stories.d.ts +2 -2
  138. package/lib/types/components/checkbox-field.d.ts +3 -0
  139. package/lib/types/components/checkbox-field.ws.d.ts +3 -0
  140. package/lib/types/components/checkbox.d.ts +3 -0
  141. package/lib/types/components/checkbox.ws.d.ts +3 -0
  142. package/lib/types/components/component-meta.d.ts +23 -5
  143. package/lib/types/components/components-utils.d.ts +5 -20
  144. package/lib/types/components/components.d.ts +8 -0
  145. package/lib/types/components/error-message.d.ts +3 -0
  146. package/lib/types/components/error-message.ws.d.ts +3 -0
  147. package/lib/types/components/index.d.ts +1 -0
  148. package/lib/types/components/input.d.ts +3 -1
  149. package/lib/types/components/input.stories.d.ts +6 -2
  150. package/lib/types/components/label.d.ts +3 -0
  151. package/lib/types/components/label.ws.d.ts +3 -0
  152. package/lib/types/components/radio-button-field.d.ts +3 -0
  153. package/lib/types/components/radio-button-field.ws.d.ts +3 -0
  154. package/lib/types/components/radio-button.d.ts +3 -0
  155. package/lib/types/components/radio-button.ws.d.ts +3 -0
  156. package/lib/types/components/success-message.d.ts +3 -0
  157. package/lib/types/components/success-message.ws.d.ts +3 -0
  158. package/lib/types/components/textarea.d.ts +3 -0
  159. package/lib/types/components/textarea.ws.d.ts +3 -0
  160. package/lib/types/css/normalize.d.ts +8977 -2286
  161. package/lib/types/css/presets.d.ts +2 -38
  162. package/lib/types/css/style-rules.d.ts +11 -9
  163. package/lib/types/embed-template.d.ts +1725 -0
  164. package/lib/types/embed-template.test.d.ts +1 -0
  165. package/lib/types/index.d.ts +1 -0
  166. package/package.json +15 -14
  167. package/src/app/custom-components/__generated__/form.props.ts +457 -0
  168. package/src/app/custom-components/__generated__/image.props.ts +487 -0
  169. package/src/app/custom-components/__generated__/link-block.props.ts +477 -0
  170. package/src/app/custom-components/__generated__/link.props.ts +477 -0
  171. package/src/app/custom-components/__generated__/rich-text-link.props.ts +477 -0
  172. package/src/app/custom-components/form.tsx +94 -0
  173. package/src/app/custom-components/form.ws.tsx +86 -0
  174. package/src/app/custom-components/index.ts +9 -4
  175. package/src/components/__generated__/checkbox-field.props.ts +444 -0
  176. package/src/components/__generated__/checkbox.props.ts +484 -0
  177. package/src/components/__generated__/error-message.props.ts +443 -0
  178. package/src/components/__generated__/input.props.ts +8 -3
  179. package/src/components/__generated__/label.props.ts +445 -0
  180. package/src/components/__generated__/radio-button-field.props.ts +444 -0
  181. package/src/components/__generated__/radio-button.props.ts +484 -0
  182. package/src/components/__generated__/success-message.props.ts +443 -0
  183. package/src/components/__generated__/textarea.props.ts +457 -0
  184. package/src/components/blockquote.ws.tsx +42 -52
  185. package/src/components/body.ws.tsx +26 -23
  186. package/src/components/bold.ws.tsx +6 -3
  187. package/src/components/box.ws.ts +6 -3
  188. package/src/components/button.ws.tsx +13 -5
  189. package/src/components/checkbox-field.tsx +10 -0
  190. package/src/components/checkbox-field.ws.tsx +38 -0
  191. package/src/components/checkbox.tsx +13 -0
  192. package/src/components/checkbox.ws.tsx +40 -0
  193. package/src/components/code.ws.tsx +26 -32
  194. package/src/components/component-meta.ts +6 -3
  195. package/src/components/components-utils.ts +16 -10
  196. package/src/components/components.ts +8 -0
  197. package/src/components/error-message.tsx +10 -0
  198. package/src/components/error-message.ws.tsx +24 -0
  199. package/src/components/form.tsx +5 -1
  200. package/src/components/form.ws.tsx +39 -10
  201. package/src/components/heading.ws.tsx +7 -4
  202. package/src/components/image.ws.tsx +14 -12
  203. package/src/components/index.ts +47 -0
  204. package/src/components/input.tsx +3 -1
  205. package/src/components/input.ws.tsx +19 -4
  206. package/src/components/italic.ws.tsx +11 -8
  207. package/src/components/label.tsx +10 -0
  208. package/src/components/label.ws.tsx +39 -0
  209. package/src/components/link-block.ws.tsx +13 -10
  210. package/src/components/link.ws.tsx +15 -13
  211. package/src/components/list-item.ws.tsx +8 -4
  212. package/src/components/list.ws.tsx +28 -25
  213. package/src/components/paragraph.ws.tsx +7 -4
  214. package/src/components/radio-button-field.tsx +10 -0
  215. package/src/components/radio-button-field.ws.tsx +38 -0
  216. package/src/components/radio-button.tsx +13 -0
  217. package/src/components/radio-button.ws.tsx +40 -0
  218. package/src/components/separator.ws.tsx +26 -25
  219. package/src/components/span.ws.tsx +6 -3
  220. package/src/components/subscript.ws.tsx +6 -3
  221. package/src/components/success-message.tsx +10 -0
  222. package/src/components/success-message.ws.tsx +24 -0
  223. package/src/components/superscript.ws.tsx +6 -3
  224. package/src/components/text-block.ws.tsx +12 -11
  225. package/src/components/textarea.tsx +13 -0
  226. package/src/components/textarea.ws.tsx +41 -0
  227. package/src/css/css.ts +8 -11
  228. package/src/css/normalize.ts +166 -188
  229. package/src/css/presets.ts +15 -37
  230. package/src/css/style-rules.ts +24 -0
  231. package/src/embed-template.test.ts +210 -0
  232. package/src/embed-template.ts +187 -0
  233. package/src/index.ts +1 -0
@@ -0,0 +1,41 @@
1
+ import { FormTextAreaIcon } from "@webstudio-is/icons";
2
+ import { textarea } from "../css/normalize";
3
+ import type {
4
+ WsComponentMeta,
5
+ WsComponentPropsMeta,
6
+ PresetStyle,
7
+ } from "./component-meta";
8
+ import type { defaultTag } from "./textarea";
9
+ import { props } from "./__generated__/textarea.props";
10
+
11
+ const presetStyle = {
12
+ textarea: [
13
+ ...textarea,
14
+ // resize doesn't work well while on canvas
15
+ { property: "resize", value: { type: "keyword", value: "none" } },
16
+ ],
17
+ } satisfies PresetStyle<typeof defaultTag>;
18
+
19
+ export const meta: WsComponentMeta = {
20
+ category: "forms",
21
+ type: "control",
22
+ label: "Text Area",
23
+ Icon: FormTextAreaIcon,
24
+ presetStyle,
25
+ states: [
26
+ { selector: "::placeholder", label: "Placeholder" },
27
+ { selector: ":valid", label: "Valid" },
28
+ { selector: ":invalid", label: "Invalid" },
29
+ { selector: ":required", label: "Required" },
30
+ { selector: ":optional", label: "Optional" },
31
+ { selector: ":disabled", label: "Disabled" },
32
+ { selector: ":enabled", label: "Enabled" },
33
+ { selector: ":read-only", label: "Read Only" },
34
+ { selector: ":read-write", label: "Read Write" },
35
+ ],
36
+ };
37
+
38
+ export const propsMeta: WsComponentPropsMeta = {
39
+ props,
40
+ initialProps: ["name", "placeholder", "required", "autoFocus"],
41
+ };
package/src/css/css.ts CHANGED
@@ -3,9 +3,9 @@ import type { Asset, Assets } from "@webstudio-is/asset-uploader";
3
3
  import type { Build } from "@webstudio-is/project-build";
4
4
  import { getComponentNames } from "../components/components-utils";
5
5
  import { getComponentMeta } from "../components";
6
- import { componentAttribute, idAttribute } from "../tree";
6
+ import { idAttribute } from "../tree";
7
7
  import { addGlobalRules } from "./global-rules";
8
- import { getStyleRules } from "./style-rules";
8
+ import { getPresetStyleRules, getStyleRules } from "./style-rules";
9
9
 
10
10
  type Data = {
11
11
  assets: Asset[];
@@ -64,15 +64,12 @@ export const generateCssText = (data: Data, options: CssOptions) => {
64
64
  for (const component of getComponentNames()) {
65
65
  const meta = getComponentMeta(component);
66
66
  const presetStyle = meta?.presetStyle;
67
- if (presetStyle !== undefined) {
68
- for (const [tag, style] of Object.entries(presetStyle)) {
69
- engine.addStyleRule(
70
- `${tag}:where([${componentAttribute}=${component}])`,
71
- {
72
- style,
73
- }
74
- );
75
- }
67
+ if (presetStyle === undefined) {
68
+ continue;
69
+ }
70
+ const rules = getPresetStyleRules(component, presetStyle);
71
+ for (const [selector, style] of rules) {
72
+ engine.addStyleRule(selector, { style });
76
73
  }
77
74
  }
78
75
 
@@ -15,18 +15,17 @@
15
15
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
16
16
  */
17
17
 
18
- import type { Style } from "@webstudio-is/css-data";
19
-
20
18
  // webstudio custom opinionated presets
21
19
  import { borders } from "./presets";
20
+ import type { EmbedTemplateStyleDecl } from "../embed-template";
22
21
 
23
22
  /**
24
23
  Use a better box model (opinionated).
25
24
  */
26
25
  const boxSizing = {
27
- type: "keyword",
28
- value: "border-box",
29
- } as const;
26
+ property: "boxSizing",
27
+ value: { type: "keyword", value: "border-box" },
28
+ } satisfies EmbedTemplateStyleDecl;
30
29
 
31
30
  /**
32
31
  * We dont support rules like this now, implement boxSizing for each used element
@@ -36,10 +35,7 @@ const boxSizing = {
36
35
  * box-sizing: border-box;
37
36
  }
38
37
  */
39
- const baseStyle = {
40
- boxSizing,
41
- ...borders,
42
- } as const satisfies Style;
38
+ const baseStyle = [boxSizing, ...borders] satisfies EmbedTemplateStyleDecl[];
43
39
 
44
40
  export const div = baseStyle;
45
41
  export const address = baseStyle;
@@ -52,6 +48,7 @@ export const main = baseStyle;
52
48
  export const nav = baseStyle;
53
49
  export const section = baseStyle;
54
50
  export const form = baseStyle;
51
+ export const label = baseStyle;
55
52
 
56
53
  export const h1 = baseStyle;
57
54
  export const h2 = baseStyle;
@@ -78,83 +75,78 @@ export const span = baseStyle;
78
75
  2. Prevent adjustments of font size after orientation changes in iOS.
79
76
  3. Use a more readable tab size (opinionated).
80
77
  */
81
- export const html = {
78
+ export const html = [
82
79
  /* 1 */
83
- lineHeight: {
84
- type: "unit",
85
- value: 1.15,
86
- unit: "number",
80
+ {
81
+ property: "lineHeight",
82
+ value: { type: "unit", value: 1.15, unit: "number" },
87
83
  },
88
-
89
84
  /* 2 */
90
- textSizeAdjust: {
91
- type: "unit",
92
- value: 100,
93
- unit: "%",
85
+ {
86
+ property: "textSizeAdjust",
87
+ value: { type: "unit", value: 100, unit: "%" },
94
88
  },
95
-
96
89
  /* 3 */
97
- tabSize: {
98
- type: "unit",
99
- value: 4,
100
- unit: "number",
90
+ {
91
+ property: "tabSize",
92
+ value: { type: "unit", value: 4, unit: "number" },
101
93
  },
102
-
103
94
  boxSizing,
104
95
  ...borders,
105
- } as const satisfies Style;
96
+ ] satisfies EmbedTemplateStyleDecl[];
106
97
 
107
98
  /**
108
99
  1. Remove the margin in all browsers.
109
100
  2. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
110
101
  */
111
- export const body = {
102
+ export const body = [
112
103
  /* 1 */
113
- marginTop: {
114
- type: "unit",
115
- value: 0,
116
- unit: "number",
117
- },
118
- marginRight: {
119
- type: "unit",
120
- value: 0,
121
- unit: "number",
122
- },
123
- marginBottom: {
124
- type: "unit",
125
- value: 0,
126
- unit: "number",
127
- },
128
- marginLeft: {
129
- type: "unit",
130
- value: 0,
131
- unit: "number",
104
+ {
105
+ property: "marginTop",
106
+ value: { type: "unit", value: 0, unit: "number" },
107
+ },
108
+ {
109
+ property: "marginRight",
110
+ value: { type: "unit", value: 0, unit: "number" },
111
+ },
112
+ {
113
+ property: "marginBottom",
114
+ value: { type: "unit", value: 0, unit: "number" },
115
+ },
116
+ {
117
+ property: "marginLeft",
118
+ value: { type: "unit", value: 0, unit: "number" },
132
119
  },
133
120
  /* 2 */
134
- fontFamily: {
135
- type: "keyword",
136
- value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`,
121
+ {
122
+ property: "fontFamily",
123
+ value: {
124
+ type: "keyword",
125
+ value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`,
126
+ },
137
127
  },
138
128
  boxSizing,
139
129
  ...borders,
140
- } as const satisfies Style;
130
+ ] satisfies EmbedTemplateStyleDecl[];
141
131
 
142
132
  /**
143
133
  1. Add the correct height in Firefox.
144
134
  2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
145
135
  */
146
- export const hr = {
136
+ export const hr = [
147
137
  /* 1 */
148
- height: {
149
- type: "unit",
150
- value: 0,
151
- unit: "number",
138
+ {
139
+ property: "height",
140
+ value: { type: "unit", value: 0, unit: "number" },
152
141
  },
153
142
  /* 2 */
154
- color: { type: "keyword", value: "inherit" },
143
+ {
144
+ property: "color",
145
+ value: { type: "keyword", value: "inherit" },
146
+ },
155
147
  boxSizing,
156
148
  ...borders,
157
- } as const satisfies Style;
149
+ ] satisfies EmbedTemplateStyleDecl[];
158
150
 
159
151
  /**
160
152
  Add the correct text decoration in Chrome, Edge, and Safari.
@@ -169,35 +161,37 @@ abbr[title] {
169
161
  /**
170
162
  Add the correct font weight in Edge and Safari.
171
163
  */
172
- export const b = {
173
- fontWeight: {
174
- type: "keyword",
175
- value: "bolder",
164
+ export const b = [
165
+ {
166
+ property: "fontWeight",
167
+ value: { type: "keyword", value: "700" },
176
168
  },
177
169
  boxSizing,
178
170
  ...borders,
179
- } as const satisfies Style;
171
+ ] satisfies EmbedTemplateStyleDecl[];
180
172
  export const strong = b;
181
173
 
182
174
  /**
183
175
  1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
184
176
  2. Correct the odd 'em' font sizing in all browsers.
185
177
  */
186
- export const code = {
178
+ export const code = [
187
179
  /* 1 */
188
- fontFamily: {
189
- type: "keyword",
190
- value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`,
180
+ {
181
+ property: "fontFamily",
182
+ value: {
183
+ type: "keyword",
184
+ value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`,
185
+ },
191
186
  },
192
187
  /* 2 */
193
- fontSize: {
194
- type: "unit",
195
- value: 1,
196
- unit: "em",
188
+ {
189
+ property: "fontSize",
190
+ value: { type: "unit", value: 1, unit: "em" },
197
191
  },
198
192
  boxSizing,
199
193
  ...borders,
200
- } as const satisfies Style;
194
+ ] satisfies EmbedTemplateStyleDecl[];
201
195
 
202
196
  export const kbd = code;
203
197
  export const samp = code;
@@ -207,60 +201,55 @@ export const pre = code;
207
201
  Add the correct font size in all browsers.
208
202
  */
209
203
 
210
- export const small = {
211
- fontSize: {
212
- type: "unit",
213
- value: 80,
214
- unit: "%",
204
+ export const small = [
205
+ {
206
+ property: "fontSize",
207
+ value: { type: "unit", value: 80, unit: "%" },
215
208
  },
216
209
  boxSizing,
217
210
  ...borders,
218
- } as const satisfies Style;
211
+ ] satisfies EmbedTemplateStyleDecl[];
219
212
 
220
213
  /**
221
214
  Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
222
215
  */
223
216
 
224
- const subSupBase = {
225
- fontSize: {
226
- type: "unit",
227
- value: 75,
228
- unit: "%",
217
+ const subSupBase = [
218
+ {
219
+ property: "fontSize",
220
+ value: { type: "unit", value: 75, unit: "%" },
229
221
  },
230
- lineHeight: {
231
- type: "unit",
232
- value: 0,
233
- unit: "number",
222
+ {
223
+ property: "lineHeight",
224
+ value: { type: "unit", value: 0, unit: "number" },
234
225
  },
235
- position: {
236
- type: "keyword",
237
- value: "relative",
226
+ {
227
+ property: "position",
228
+ value: { type: "keyword", value: "relative" },
238
229
  },
239
- verticalAlign: {
240
- type: "keyword",
241
- value: "baseline",
230
+ {
231
+ property: "verticalAlign",
232
+ value: { type: "keyword", value: "baseline" },
242
233
  },
243
234
  boxSizing,
244
235
  ...borders,
245
- } as const satisfies Style;
236
+ ] satisfies EmbedTemplateStyleDecl[];
246
237
 
247
- export const sub = {
238
+ export const sub = [
248
239
  ...subSupBase,
249
- bottom: {
250
- type: "unit",
251
- value: -0.25,
252
- unit: "em",
240
+ {
241
+ property: "bottom",
242
+ value: { type: "unit", value: -0.25, unit: "em" },
253
243
  },
254
- } as const satisfies Style;
244
+ ] satisfies EmbedTemplateStyleDecl[];
255
245
 
256
- export const sup = {
246
+ export const sup = [
257
247
  ...subSupBase,
258
- top: {
259
- type: "unit",
260
- value: -0.5,
261
- unit: "em",
248
+ {
249
+ property: "top",
250
+ value: { type: "unit", value: -0.5, unit: "em" },
262
251
  },
263
- } as const satisfies Style;
252
+ ] satisfies EmbedTemplateStyleDecl[];
264
253
 
265
254
  /*
266
255
  Tabular data
@@ -272,33 +261,32 @@ Tabular data
272
261
  2. Correct table border color inheritance in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
273
262
  */
274
263
 
275
- export const table = {
264
+ export const table = [
276
265
  /* 1 */
277
- textIndent: {
278
- type: "unit",
279
- value: 0,
280
- unit: "number",
266
+ {
267
+ property: "textIndent",
268
+ value: { type: "unit", value: 0, unit: "number" },
281
269
  },
282
270
  ...borders,
283
271
  /* 2 */
284
- borderTopColor: {
285
- type: "keyword",
286
- value: "inherit",
272
+ {
273
+ property: "borderTopColor",
274
+ value: { type: "keyword", value: "inherit" },
287
275
  },
288
- borderRightColor: {
289
- type: "keyword",
290
- value: "inherit",
276
+ {
277
+ property: "borderRightColor",
278
+ value: { type: "keyword", value: "inherit" },
291
279
  },
292
- borderBottomColor: {
293
- type: "keyword",
294
- value: "inherit",
280
+ {
281
+ property: "borderBottomColor",
282
+ value: { type: "keyword", value: "inherit" },
295
283
  },
296
- borderLeftColor: {
297
- type: "keyword",
298
- value: "inherit",
284
+ {
285
+ property: "borderLeftColor",
286
+ value: { type: "keyword", value: "inherit" },
299
287
  },
300
288
  boxSizing,
301
- } as const satisfies Style;
289
+ ] satisfies EmbedTemplateStyleDecl[];
302
290
 
303
291
  /*
304
292
  Forms
@@ -310,46 +298,40 @@ Forms
310
298
  2. Remove the margin in Firefox and Safari.
311
299
  */
312
300
 
313
- const buttonBase = {
301
+ const buttonBase = [
314
302
  /* 1 */
315
- fontFamily: {
316
- type: "keyword",
317
- value: "inherit",
303
+ {
304
+ property: "fontFamily",
305
+ value: { type: "keyword", value: "inherit" },
318
306
  },
319
- fontSize: {
320
- type: "unit",
321
- value: 100,
322
- unit: "%",
307
+ {
308
+ property: "fontSize",
309
+ value: { type: "unit", value: 100, unit: "%" },
323
310
  },
324
- lineHeight: {
325
- type: "unit",
326
- value: 1.15,
327
- unit: "number",
311
+ {
312
+ property: "lineHeight",
313
+ value: { type: "unit", value: 1.15, unit: "number" },
328
314
  },
329
315
  /* 2 */
330
- marginTop: {
331
- type: "unit",
332
- value: 0,
333
- unit: "number",
334
- },
335
- marginRight: {
336
- type: "unit",
337
- value: 0,
338
- unit: "number",
339
- },
340
- marginBottom: {
341
- type: "unit",
342
- value: 0,
343
- unit: "number",
344
- },
345
- marginLeft: {
346
- type: "unit",
347
- value: 0,
348
- unit: "number",
316
+ {
317
+ property: "marginTop",
318
+ value: { type: "unit", value: 0, unit: "number" },
319
+ },
320
+ {
321
+ property: "marginRight",
322
+ value: { type: "unit", value: 0, unit: "number" },
323
+ },
324
+ {
325
+ property: "marginBottom",
326
+ value: { type: "unit", value: 0, unit: "number" },
327
+ },
328
+ {
329
+ property: "marginLeft",
330
+ value: { type: "unit", value: 0, unit: "number" },
349
331
  },
350
332
  boxSizing,
351
333
  ...borders,
352
- } as const satisfies Style;
334
+ ] satisfies EmbedTemplateStyleDecl[];
353
335
 
354
336
  export const input = buttonBase;
355
337
  export const optgroup = buttonBase;
@@ -358,13 +340,13 @@ export const textarea = buttonBase;
358
340
  /**
359
341
  Remove the inheritance of text transform in Edge and Firefox.
360
342
  */
361
- export const button = {
343
+ export const button = [
362
344
  ...buttonBase,
363
- textTransform: {
364
- type: "keyword",
365
- value: "none",
345
+ {
346
+ property: "textTransform",
347
+ value: { type: "keyword", value: "none" },
366
348
  },
367
- } as const satisfies Style;
349
+ ] satisfies EmbedTemplateStyleDecl[];
368
350
 
369
351
  export const select = button;
370
352
 
@@ -417,43 +399,39 @@ See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d4
417
399
  Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
418
400
  */
419
401
 
420
- export const legend = {
421
- paddingTop: {
422
- type: "unit",
423
- value: 0,
424
- unit: "number",
402
+ export const legend = [
403
+ {
404
+ property: "paddingTop",
405
+ value: { type: "unit", value: 0, unit: "number" },
425
406
  },
426
- paddingRight: {
427
- type: "unit",
428
- value: 0,
429
- unit: "number",
407
+ {
408
+ property: "paddingRight",
409
+ value: { type: "unit", value: 0, unit: "number" },
430
410
  },
431
- paddingBottom: {
432
- type: "unit",
433
- value: 0,
434
- unit: "number",
411
+ {
412
+ property: "paddingBottom",
413
+ value: { type: "unit", value: 0, unit: "number" },
435
414
  },
436
- paddingLeft: {
437
- type: "unit",
438
- value: 0,
439
- unit: "number",
415
+ {
416
+ property: "paddingLeft",
417
+ value: { type: "unit", value: 0, unit: "number" },
440
418
  },
441
419
  boxSizing,
442
420
  ...borders,
443
- } as const satisfies Style;
421
+ ] satisfies EmbedTemplateStyleDecl[];
444
422
 
445
423
  /**
446
424
  Add the correct vertical alignment in Chrome and Firefox.
447
425
  */
448
426
 
449
- export const progress = {
450
- verticalAlign: {
451
- type: "keyword",
452
- value: "baseline",
427
+ export const progress = [
428
+ {
429
+ property: "verticalAlign",
430
+ value: { type: "keyword", value: "baseline" },
453
431
  },
454
432
  boxSizing,
455
433
  ...borders,
456
- } as const satisfies Style;
434
+ ] satisfies EmbedTemplateStyleDecl[];
457
435
 
458
436
  /**
459
437
  Correct the cursor style of increment and decrement buttons in Safari.
@@ -509,11 +487,11 @@ Interactive
509
487
  Add the correct display in Chrome and Safari.
510
488
  */
511
489
 
512
- export const summary = {
513
- display: {
514
- type: "keyword",
515
- value: "list-item",
490
+ export const summary = [
491
+ {
492
+ property: "display",
493
+ value: { type: "keyword", value: "list-item" },
516
494
  },
517
495
  boxSizing,
518
496
  ...borders,
519
- } as const satisfies Style;
497
+ ] satisfies EmbedTemplateStyleDecl[];
@@ -1,42 +1,20 @@
1
- import type { Style } from "@webstudio-is/css-data";
1
+ import type { EmbedTemplateStyleDecl } from "../embed-template";
2
2
 
3
- export const borders = {
4
- borderTopColor: {
5
- type: "keyword",
6
- value: "currentColor",
3
+ export const borders: EmbedTemplateStyleDecl[] = [
4
+ {
5
+ property: "borderTopWidth",
6
+ value: { type: "unit", value: 1, unit: "px" },
7
7
  },
8
- borderRightColor: {
9
- type: "keyword",
10
- value: "currentColor",
8
+ {
9
+ property: "borderRightWidth",
10
+ value: { type: "unit", value: 1, unit: "px" },
11
11
  },
12
- borderBottomColor: {
13
- type: "keyword",
14
- value: "currentColor",
12
+ {
13
+ property: "borderBottomWidth",
14
+ value: { type: "unit", value: 1, unit: "px" },
15
15
  },
16
- borderLeftColor: {
17
- type: "keyword",
18
- value: "currentColor",
16
+ {
17
+ property: "borderLeftWidth",
18
+ value: { type: "unit", value: 1, unit: "px" },
19
19
  },
20
-
21
- borderTopWidth: {
22
- type: "unit",
23
- value: 1,
24
- unit: "px",
25
- },
26
-
27
- borderRightWidth: {
28
- type: "unit",
29
- value: 1,
30
- unit: "px",
31
- },
32
- borderBottomWidth: {
33
- type: "unit",
34
- value: 1,
35
- unit: "px",
36
- },
37
- borderLeftWidth: {
38
- type: "unit",
39
- value: 1,
40
- unit: "px",
41
- },
42
- } as const satisfies Style;
20
+ ];