@webstudio-is/react-sdk 0.59.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 (163) hide show
  1. package/lib/app/custom-components/shared/remix-link.js +2 -2
  2. package/lib/app/index.js +0 -1
  3. package/lib/cjs/app/custom-components/shared/remix-link.js +2 -2
  4. package/lib/cjs/app/index.js +0 -1
  5. package/lib/cjs/components/__generated__/blockquote.props.js +5 -0
  6. package/lib/cjs/components/__generated__/body.props.js +5 -0
  7. package/lib/cjs/components/__generated__/bold.props.js +5 -0
  8. package/lib/cjs/components/__generated__/box.props.js +5 -0
  9. package/lib/cjs/components/__generated__/button.props.js +5 -1
  10. package/lib/cjs/components/__generated__/code.props.js +5 -0
  11. package/lib/cjs/components/__generated__/form.props.js +5 -0
  12. package/lib/cjs/components/__generated__/heading.props.js +5 -0
  13. package/lib/cjs/components/__generated__/image.props.js +5 -0
  14. package/lib/cjs/components/__generated__/input.props.js +11 -2
  15. package/lib/cjs/components/__generated__/italic.props.js +5 -0
  16. package/lib/cjs/components/__generated__/link-block.props.js +5 -1
  17. package/lib/cjs/components/__generated__/link.props.js +5 -1
  18. package/lib/cjs/components/__generated__/list-item.props.js +5 -0
  19. package/lib/cjs/components/__generated__/list.props.js +5 -0
  20. package/lib/cjs/components/__generated__/paragraph.props.js +5 -0
  21. package/lib/cjs/components/__generated__/rich-text-link.props.js +5 -1
  22. package/lib/cjs/components/__generated__/separator.props.js +5 -0
  23. package/lib/cjs/components/__generated__/span.props.js +5 -0
  24. package/lib/cjs/components/__generated__/subscript.props.js +5 -0
  25. package/lib/cjs/components/__generated__/superscript.props.js +5 -0
  26. package/lib/cjs/components/__generated__/text-block.props.js +5 -0
  27. package/lib/cjs/components/blockquote.ws.js +36 -48
  28. package/lib/cjs/components/body.ws.js +19 -24
  29. package/lib/cjs/components/button.ws.js +1 -1
  30. package/lib/cjs/components/code.ws.js +20 -28
  31. package/lib/cjs/components/component-meta.js +2 -1
  32. package/lib/cjs/components/form.ws.js +14 -7
  33. package/lib/cjs/components/heading.ws.js +1 -1
  34. package/lib/cjs/components/image.ws.js +8 -9
  35. package/lib/cjs/components/italic.ws.js +5 -5
  36. package/lib/cjs/components/link-block.ws.js +5 -5
  37. package/lib/cjs/components/link.js +1 -1
  38. package/lib/cjs/components/link.ws.js +9 -10
  39. package/lib/cjs/components/list-item.ws.js +1 -1
  40. package/lib/cjs/components/list.ws.js +22 -22
  41. package/lib/cjs/components/paragraph.ws.js +1 -1
  42. package/lib/cjs/components/separator.ws.js +20 -20
  43. package/lib/cjs/components/text-block.ws.js +6 -7
  44. package/lib/cjs/css/css.js +6 -9
  45. package/lib/cjs/css/normalize.js +166 -185
  46. package/lib/cjs/css/presets.js +14 -34
  47. package/lib/cjs/css/style-rules.js +17 -0
  48. package/lib/cjs/embed-template.js +160 -0
  49. package/lib/cjs/index.js +1 -0
  50. package/lib/components/__generated__/blockquote.props.js +5 -0
  51. package/lib/components/__generated__/body.props.js +5 -0
  52. package/lib/components/__generated__/bold.props.js +5 -0
  53. package/lib/components/__generated__/box.props.js +5 -0
  54. package/lib/components/__generated__/button.props.js +5 -1
  55. package/lib/components/__generated__/code.props.js +5 -0
  56. package/lib/components/__generated__/form.props.js +5 -0
  57. package/lib/components/__generated__/heading.props.js +5 -0
  58. package/lib/components/__generated__/image.props.js +5 -0
  59. package/lib/components/__generated__/input.props.js +11 -2
  60. package/lib/components/__generated__/italic.props.js +5 -0
  61. package/lib/components/__generated__/link-block.props.js +5 -1
  62. package/lib/components/__generated__/link.props.js +5 -1
  63. package/lib/components/__generated__/list-item.props.js +5 -0
  64. package/lib/components/__generated__/list.props.js +5 -0
  65. package/lib/components/__generated__/paragraph.props.js +5 -0
  66. package/lib/components/__generated__/rich-text-link.props.js +5 -1
  67. package/lib/components/__generated__/separator.props.js +5 -0
  68. package/lib/components/__generated__/span.props.js +5 -0
  69. package/lib/components/__generated__/subscript.props.js +5 -0
  70. package/lib/components/__generated__/superscript.props.js +5 -0
  71. package/lib/components/__generated__/text-block.props.js +5 -0
  72. package/lib/components/blockquote.ws.js +36 -48
  73. package/lib/components/body.ws.js +19 -24
  74. package/lib/components/button.ws.js +1 -1
  75. package/lib/components/code.ws.js +20 -28
  76. package/lib/components/component-meta.js +2 -1
  77. package/lib/components/form.ws.js +14 -7
  78. package/lib/components/heading.ws.js +1 -1
  79. package/lib/components/image.ws.js +8 -9
  80. package/lib/components/italic.ws.js +5 -5
  81. package/lib/components/link-block.ws.js +5 -5
  82. package/lib/components/link.js +1 -1
  83. package/lib/components/link.ws.js +9 -10
  84. package/lib/components/list-item.ws.js +1 -1
  85. package/lib/components/list.ws.js +22 -22
  86. package/lib/components/paragraph.ws.js +1 -1
  87. package/lib/components/separator.ws.js +20 -20
  88. package/lib/components/text-block.ws.js +6 -7
  89. package/lib/css/css.js +8 -11
  90. package/lib/css/normalize.js +166 -185
  91. package/lib/css/presets.js +14 -34
  92. package/lib/css/style-rules.js +17 -0
  93. package/lib/embed-template.js +140 -0
  94. package/lib/index.js +1 -0
  95. package/lib/types/app/index.d.ts +0 -1
  96. package/lib/types/components/box.stories.d.ts +2 -2
  97. package/lib/types/components/component-meta.d.ts +20 -5
  98. package/lib/types/components/components-utils.d.ts +1 -1
  99. package/lib/types/css/normalize.d.ts +8786 -2286
  100. package/lib/types/css/presets.d.ts +2 -38
  101. package/lib/types/css/style-rules.d.ts +11 -9
  102. package/lib/types/embed-template.d.ts +1725 -0
  103. package/lib/types/embed-template.test.d.ts +1 -0
  104. package/lib/types/index.d.ts +1 -0
  105. package/package.json +16 -19
  106. package/src/app/custom-components/shared/remix-link.tsx +2 -2
  107. package/src/app/index.ts +0 -1
  108. package/src/components/__generated__/blockquote.props.ts +5 -0
  109. package/src/components/__generated__/body.props.ts +5 -0
  110. package/src/components/__generated__/bold.props.ts +5 -0
  111. package/src/components/__generated__/box.props.ts +5 -0
  112. package/src/components/__generated__/button.props.ts +5 -1
  113. package/src/components/__generated__/code.props.ts +5 -0
  114. package/src/components/__generated__/form.props.ts +5 -0
  115. package/src/components/__generated__/heading.props.ts +5 -0
  116. package/src/components/__generated__/image.props.ts +5 -0
  117. package/src/components/__generated__/input.props.ts +11 -2
  118. package/src/components/__generated__/italic.props.ts +5 -0
  119. package/src/components/__generated__/link-block.props.ts +5 -1
  120. package/src/components/__generated__/link.props.ts +5 -1
  121. package/src/components/__generated__/list-item.props.ts +5 -0
  122. package/src/components/__generated__/list.props.ts +5 -0
  123. package/src/components/__generated__/paragraph.props.ts +5 -0
  124. package/src/components/__generated__/rich-text-link.props.ts +5 -1
  125. package/src/components/__generated__/separator.props.ts +5 -0
  126. package/src/components/__generated__/span.props.ts +5 -0
  127. package/src/components/__generated__/subscript.props.ts +5 -0
  128. package/src/components/__generated__/superscript.props.ts +5 -0
  129. package/src/components/__generated__/text-block.props.ts +5 -0
  130. package/src/components/blockquote.ws.tsx +42 -52
  131. package/src/components/body.ws.tsx +25 -32
  132. package/src/components/bold.ws.tsx +6 -3
  133. package/src/components/box.ws.ts +6 -3
  134. package/src/components/button.ws.tsx +7 -4
  135. package/src/components/code.ws.tsx +26 -32
  136. package/src/components/component-meta.ts +5 -3
  137. package/src/components/form.ws.tsx +19 -9
  138. package/src/components/heading.ws.tsx +7 -4
  139. package/src/components/image.ws.tsx +14 -12
  140. package/src/components/input.ws.tsx +6 -3
  141. package/src/components/italic.ws.tsx +11 -8
  142. package/src/components/link-block.ws.tsx +11 -8
  143. package/src/components/link.tsx +1 -1
  144. package/src/components/link.ws.tsx +15 -13
  145. package/src/components/list-item.ws.tsx +7 -4
  146. package/src/components/list.ws.tsx +28 -25
  147. package/src/components/paragraph.ws.tsx +7 -4
  148. package/src/components/separator.ws.tsx +26 -25
  149. package/src/components/span.ws.tsx +6 -3
  150. package/src/components/subscript.ws.tsx +6 -3
  151. package/src/components/superscript.ws.tsx +6 -3
  152. package/src/components/text-block.ws.tsx +12 -11
  153. package/src/css/css.ts +8 -11
  154. package/src/css/normalize.ts +165 -188
  155. package/src/css/presets.ts +15 -37
  156. package/src/css/style-rules.ts +24 -0
  157. package/src/embed-template.test.ts +210 -0
  158. package/src/embed-template.ts +187 -0
  159. package/src/index.ts +1 -0
  160. package/lib/app/handle-request.server.js +0 -16
  161. package/lib/cjs/app/handle-request.server.js +0 -36
  162. package/lib/types/app/handle-request.server.d.ts +0 -2
  163. package/src/app/handle-request.server.tsx +0 -21
@@ -33,7 +33,7 @@ const meta = {
33
33
  type: "rich-text",
34
34
  label: "Paragraph",
35
35
  Icon: import_icons.TextAlignLeftIcon,
36
- children: ["Pragraph you can edit"],
36
+ children: [{ type: "text", value: "Pragraph you can edit" }],
37
37
  presetStyle
38
38
  };
39
39
  const propsMeta = {
@@ -26,33 +26,33 @@ var import_icons = require("@webstudio-is/icons");
26
26
  var import_separator = require("./__generated__/separator.props");
27
27
  var import_normalize = require("../css/normalize");
28
28
  const presetStyle = {
29
- hr: {
29
+ hr: [
30
30
  ...import_normalize.hr,
31
- height: {
32
- type: "keyword",
33
- value: "1px"
31
+ {
32
+ property: "height",
33
+ value: { type: "keyword", value: "1px" }
34
34
  },
35
- backgroundColor: {
36
- type: "keyword",
37
- value: "gray"
35
+ {
36
+ property: "backgroundColor",
37
+ value: { type: "keyword", value: "gray" }
38
38
  },
39
- borderTopStyle: {
40
- type: "keyword",
41
- value: "none"
39
+ {
40
+ property: "borderTopStyle",
41
+ value: { type: "keyword", value: "none" }
42
42
  },
43
- borderRightStyle: {
44
- type: "keyword",
45
- value: "none"
43
+ {
44
+ property: "borderRightStyle",
45
+ value: { type: "keyword", value: "none" }
46
46
  },
47
- borderLeftStyle: {
48
- type: "keyword",
49
- value: "none"
47
+ {
48
+ property: "borderLeftStyle",
49
+ value: { type: "keyword", value: "none" }
50
50
  },
51
- borderBottomStyle: {
52
- type: "keyword",
53
- value: "none"
51
+ {
52
+ property: "borderBottomStyle",
53
+ value: { type: "keyword", value: "none" }
54
54
  }
55
- }
55
+ ]
56
56
  };
57
57
  const meta = {
58
58
  category: "general",
@@ -26,14 +26,13 @@ var import_icons = require("@webstudio-is/icons");
26
26
  var import_text_block = require("./__generated__/text-block.props");
27
27
  var import_normalize = require("../css/normalize");
28
28
  const presetStyle = {
29
- div: {
29
+ div: [
30
30
  ...import_normalize.div,
31
- minHeight: {
32
- type: "unit",
33
- unit: "em",
34
- value: 1
31
+ {
32
+ property: "minHeight",
33
+ value: { type: "unit", unit: "em", value: 1 }
35
34
  }
36
- }
35
+ ]
37
36
  };
38
37
  const meta = {
39
38
  category: "typography",
@@ -41,7 +40,7 @@ const meta = {
41
40
  label: "Text Block",
42
41
  Icon: import_icons.TextBlockIcon,
43
42
  presetStyle,
44
- children: ["Block of text you can edit"]
43
+ children: [{ type: "text", value: "Block of text you can edit" }]
45
44
  };
46
45
  const propsMeta = {
47
46
  props: import_text_block.props
@@ -64,15 +64,12 @@ const generateCssText = (data, options) => {
64
64
  for (const component of (0, import_components_utils.getComponentNames)()) {
65
65
  const meta = (0, import_components.getComponentMeta)(component);
66
66
  const presetStyle = meta?.presetStyle;
67
- if (presetStyle !== void 0) {
68
- for (const [tag, style] of Object.entries(presetStyle)) {
69
- engine.addStyleRule(
70
- `${tag}:where([${import_tree.componentAttribute}=${component}])`,
71
- {
72
- style
73
- }
74
- );
75
- }
67
+ if (presetStyle === void 0) {
68
+ continue;
69
+ }
70
+ const rules = (0, import_style_rules.getPresetStyleRules)(component, presetStyle);
71
+ for (const [selector, style] of rules) {
72
+ engine.addStyleRule(selector, { style });
76
73
  }
77
74
  }
78
75
  const styleRules = (0, import_style_rules.getStyleRules)(styles, styleSourceSelections);
@@ -68,13 +68,10 @@ __export(normalize_exports, {
68
68
  module.exports = __toCommonJS(normalize_exports);
69
69
  var import_presets = require("./presets");
70
70
  const boxSizing = {
71
- type: "keyword",
72
- value: "border-box"
73
- };
74
- const baseStyle = {
75
- boxSizing,
76
- ...import_presets.borders
71
+ property: "boxSizing",
72
+ value: { type: "keyword", value: "border-box" }
77
73
  };
74
+ const baseStyle = [boxSizing, ...import_presets.borders];
78
75
  const div = baseStyle;
79
76
  const address = baseStyle;
80
77
  const article = baseStyle;
@@ -100,259 +97,243 @@ const ul = baseStyle;
100
97
  const ol = baseStyle;
101
98
  const p = baseStyle;
102
99
  const span = baseStyle;
103
- const html = {
100
+ const html = [
104
101
  /* 1 */
105
- lineHeight: {
106
- type: "unit",
107
- value: 1.15,
108
- unit: "number"
102
+ {
103
+ property: "lineHeight",
104
+ value: { type: "unit", value: 1.15, unit: "number" }
109
105
  },
110
106
  /* 2 */
111
- textSizeAdjust: {
112
- type: "unit",
113
- value: 100,
114
- unit: "%"
107
+ {
108
+ property: "textSizeAdjust",
109
+ value: { type: "unit", value: 100, unit: "%" }
115
110
  },
116
111
  /* 3 */
117
- tabSize: {
118
- type: "unit",
119
- value: 4,
120
- unit: "number"
112
+ {
113
+ property: "tabSize",
114
+ value: { type: "unit", value: 4, unit: "number" }
121
115
  },
122
116
  boxSizing,
123
117
  ...import_presets.borders
124
- };
125
- const body = {
118
+ ];
119
+ const body = [
126
120
  /* 1 */
127
- marginTop: {
128
- type: "unit",
129
- value: 0,
130
- unit: "number"
131
- },
132
- marginRight: {
133
- type: "unit",
134
- value: 0,
135
- unit: "number"
136
- },
137
- marginBottom: {
138
- type: "unit",
139
- value: 0,
140
- unit: "number"
141
- },
142
- marginLeft: {
143
- type: "unit",
144
- value: 0,
145
- unit: "number"
121
+ {
122
+ property: "marginTop",
123
+ value: { type: "unit", value: 0, unit: "number" }
124
+ },
125
+ {
126
+ property: "marginRight",
127
+ value: { type: "unit", value: 0, unit: "number" }
128
+ },
129
+ {
130
+ property: "marginBottom",
131
+ value: { type: "unit", value: 0, unit: "number" }
132
+ },
133
+ {
134
+ property: "marginLeft",
135
+ value: { type: "unit", value: 0, unit: "number" }
146
136
  },
147
137
  /* 2 */
148
- fontFamily: {
149
- type: "keyword",
150
- value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`
138
+ {
139
+ property: "fontFamily",
140
+ value: {
141
+ type: "keyword",
142
+ value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`
143
+ }
151
144
  },
152
145
  boxSizing,
153
146
  ...import_presets.borders
154
- };
155
- const hr = {
147
+ ];
148
+ const hr = [
156
149
  /* 1 */
157
- height: {
158
- type: "unit",
159
- value: 0,
160
- unit: "number"
150
+ {
151
+ property: "height",
152
+ value: { type: "unit", value: 0, unit: "number" }
161
153
  },
162
154
  /* 2 */
163
- color: { type: "keyword", value: "inherit" },
155
+ {
156
+ property: "color",
157
+ value: { type: "keyword", value: "inherit" }
158
+ },
164
159
  boxSizing,
165
160
  ...import_presets.borders
166
- };
167
- const b = {
168
- fontWeight: {
169
- type: "keyword",
170
- value: "bolder"
161
+ ];
162
+ const b = [
163
+ {
164
+ property: "fontWeight",
165
+ value: { type: "keyword", value: "700" }
171
166
  },
172
167
  boxSizing,
173
168
  ...import_presets.borders
174
- };
169
+ ];
175
170
  const strong = b;
176
- const code = {
171
+ const code = [
177
172
  /* 1 */
178
- fontFamily: {
179
- type: "keyword",
180
- value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`
173
+ {
174
+ property: "fontFamily",
175
+ value: {
176
+ type: "keyword",
177
+ value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`
178
+ }
181
179
  },
182
180
  /* 2 */
183
- fontSize: {
184
- type: "unit",
185
- value: 1,
186
- unit: "em"
181
+ {
182
+ property: "fontSize",
183
+ value: { type: "unit", value: 1, unit: "em" }
187
184
  },
188
185
  boxSizing,
189
186
  ...import_presets.borders
190
- };
187
+ ];
191
188
  const kbd = code;
192
189
  const samp = code;
193
190
  const pre = code;
194
- const small = {
195
- fontSize: {
196
- type: "unit",
197
- value: 80,
198
- unit: "%"
191
+ const small = [
192
+ {
193
+ property: "fontSize",
194
+ value: { type: "unit", value: 80, unit: "%" }
199
195
  },
200
196
  boxSizing,
201
197
  ...import_presets.borders
202
- };
203
- const subSupBase = {
204
- fontSize: {
205
- type: "unit",
206
- value: 75,
207
- unit: "%"
198
+ ];
199
+ const subSupBase = [
200
+ {
201
+ property: "fontSize",
202
+ value: { type: "unit", value: 75, unit: "%" }
208
203
  },
209
- lineHeight: {
210
- type: "unit",
211
- value: 0,
212
- unit: "number"
204
+ {
205
+ property: "lineHeight",
206
+ value: { type: "unit", value: 0, unit: "number" }
213
207
  },
214
- position: {
215
- type: "keyword",
216
- value: "relative"
208
+ {
209
+ property: "position",
210
+ value: { type: "keyword", value: "relative" }
217
211
  },
218
- verticalAlign: {
219
- type: "keyword",
220
- value: "baseline"
212
+ {
213
+ property: "verticalAlign",
214
+ value: { type: "keyword", value: "baseline" }
221
215
  },
222
216
  boxSizing,
223
217
  ...import_presets.borders
224
- };
225
- const sub = {
218
+ ];
219
+ const sub = [
226
220
  ...subSupBase,
227
- bottom: {
228
- type: "unit",
229
- value: -0.25,
230
- unit: "em"
221
+ {
222
+ property: "bottom",
223
+ value: { type: "unit", value: -0.25, unit: "em" }
231
224
  }
232
- };
233
- const sup = {
225
+ ];
226
+ const sup = [
234
227
  ...subSupBase,
235
- top: {
236
- type: "unit",
237
- value: -0.5,
238
- unit: "em"
228
+ {
229
+ property: "top",
230
+ value: { type: "unit", value: -0.5, unit: "em" }
239
231
  }
240
- };
241
- const table = {
232
+ ];
233
+ const table = [
242
234
  /* 1 */
243
- textIndent: {
244
- type: "unit",
245
- value: 0,
246
- unit: "number"
235
+ {
236
+ property: "textIndent",
237
+ value: { type: "unit", value: 0, unit: "number" }
247
238
  },
248
239
  ...import_presets.borders,
249
240
  /* 2 */
250
- borderTopColor: {
251
- type: "keyword",
252
- value: "inherit"
241
+ {
242
+ property: "borderTopColor",
243
+ value: { type: "keyword", value: "inherit" }
253
244
  },
254
- borderRightColor: {
255
- type: "keyword",
256
- value: "inherit"
245
+ {
246
+ property: "borderRightColor",
247
+ value: { type: "keyword", value: "inherit" }
257
248
  },
258
- borderBottomColor: {
259
- type: "keyword",
260
- value: "inherit"
249
+ {
250
+ property: "borderBottomColor",
251
+ value: { type: "keyword", value: "inherit" }
261
252
  },
262
- borderLeftColor: {
263
- type: "keyword",
264
- value: "inherit"
253
+ {
254
+ property: "borderLeftColor",
255
+ value: { type: "keyword", value: "inherit" }
265
256
  },
266
257
  boxSizing
267
- };
268
- const buttonBase = {
258
+ ];
259
+ const buttonBase = [
269
260
  /* 1 */
270
- fontFamily: {
271
- type: "keyword",
272
- value: "inherit"
261
+ {
262
+ property: "fontFamily",
263
+ value: { type: "keyword", value: "inherit" }
273
264
  },
274
- fontSize: {
275
- type: "unit",
276
- value: 100,
277
- unit: "%"
265
+ {
266
+ property: "fontSize",
267
+ value: { type: "unit", value: 100, unit: "%" }
278
268
  },
279
- lineHeight: {
280
- type: "unit",
281
- value: 1.15,
282
- unit: "number"
269
+ {
270
+ property: "lineHeight",
271
+ value: { type: "unit", value: 1.15, unit: "number" }
283
272
  },
284
273
  /* 2 */
285
- marginTop: {
286
- type: "unit",
287
- value: 0,
288
- unit: "number"
289
- },
290
- marginRight: {
291
- type: "unit",
292
- value: 0,
293
- unit: "number"
294
- },
295
- marginBottom: {
296
- type: "unit",
297
- value: 0,
298
- unit: "number"
299
- },
300
- marginLeft: {
301
- type: "unit",
302
- value: 0,
303
- unit: "number"
274
+ {
275
+ property: "marginTop",
276
+ value: { type: "unit", value: 0, unit: "number" }
277
+ },
278
+ {
279
+ property: "marginRight",
280
+ value: { type: "unit", value: 0, unit: "number" }
281
+ },
282
+ {
283
+ property: "marginBottom",
284
+ value: { type: "unit", value: 0, unit: "number" }
285
+ },
286
+ {
287
+ property: "marginLeft",
288
+ value: { type: "unit", value: 0, unit: "number" }
304
289
  },
305
290
  boxSizing,
306
291
  ...import_presets.borders
307
- };
292
+ ];
308
293
  const input = buttonBase;
309
294
  const optgroup = buttonBase;
310
295
  const textarea = buttonBase;
311
- const button = {
296
+ const button = [
312
297
  ...buttonBase,
313
- textTransform: {
314
- type: "keyword",
315
- value: "none"
298
+ {
299
+ property: "textTransform",
300
+ value: { type: "keyword", value: "none" }
316
301
  }
317
- };
302
+ ];
318
303
  const select = button;
319
- const legend = {
320
- paddingTop: {
321
- type: "unit",
322
- value: 0,
323
- unit: "number"
324
- },
325
- paddingRight: {
326
- type: "unit",
327
- value: 0,
328
- unit: "number"
329
- },
330
- paddingBottom: {
331
- type: "unit",
332
- value: 0,
333
- unit: "number"
334
- },
335
- paddingLeft: {
336
- type: "unit",
337
- value: 0,
338
- unit: "number"
304
+ const legend = [
305
+ {
306
+ property: "paddingTop",
307
+ value: { type: "unit", value: 0, unit: "number" }
308
+ },
309
+ {
310
+ property: "paddingRight",
311
+ value: { type: "unit", value: 0, unit: "number" }
312
+ },
313
+ {
314
+ property: "paddingBottom",
315
+ value: { type: "unit", value: 0, unit: "number" }
316
+ },
317
+ {
318
+ property: "paddingLeft",
319
+ value: { type: "unit", value: 0, unit: "number" }
339
320
  },
340
321
  boxSizing,
341
322
  ...import_presets.borders
342
- };
343
- const progress = {
344
- verticalAlign: {
345
- type: "keyword",
346
- value: "baseline"
323
+ ];
324
+ const progress = [
325
+ {
326
+ property: "verticalAlign",
327
+ value: { type: "keyword", value: "baseline" }
347
328
  },
348
329
  boxSizing,
349
330
  ...import_presets.borders
350
- };
351
- const summary = {
352
- display: {
353
- type: "keyword",
354
- value: "list-item"
331
+ ];
332
+ const summary = [
333
+ {
334
+ property: "display",
335
+ value: { type: "keyword", value: "list-item" }
355
336
  },
356
337
  boxSizing,
357
338
  ...import_presets.borders
358
- };
339
+ ];
@@ -21,41 +21,21 @@ __export(presets_exports, {
21
21
  borders: () => borders
22
22
  });
23
23
  module.exports = __toCommonJS(presets_exports);
24
- const borders = {
25
- borderTopColor: {
26
- type: "keyword",
27
- value: "currentColor"
24
+ const borders = [
25
+ {
26
+ property: "borderTopWidth",
27
+ value: { type: "unit", value: 1, unit: "px" }
28
28
  },
29
- borderRightColor: {
30
- type: "keyword",
31
- value: "currentColor"
29
+ {
30
+ property: "borderRightWidth",
31
+ value: { type: "unit", value: 1, unit: "px" }
32
32
  },
33
- borderBottomColor: {
34
- type: "keyword",
35
- value: "currentColor"
33
+ {
34
+ property: "borderBottomWidth",
35
+ value: { type: "unit", value: 1, unit: "px" }
36
36
  },
37
- borderLeftColor: {
38
- type: "keyword",
39
- value: "currentColor"
40
- },
41
- borderTopWidth: {
42
- type: "unit",
43
- value: 1,
44
- unit: "px"
45
- },
46
- borderRightWidth: {
47
- type: "unit",
48
- value: 1,
49
- unit: "px"
50
- },
51
- borderBottomWidth: {
52
- type: "unit",
53
- value: 1,
54
- unit: "px"
55
- },
56
- borderLeftWidth: {
57
- type: "unit",
58
- value: 1,
59
- unit: "px"
37
+ {
38
+ property: "borderLeftWidth",
39
+ value: { type: "unit", value: 1, unit: "px" }
60
40
  }
61
- };
41
+ ];
@@ -18,9 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var style_rules_exports = {};
20
20
  __export(style_rules_exports, {
21
+ getPresetStyleRules: () => getPresetStyleRules,
21
22
  getStyleRules: () => getStyleRules
22
23
  });
23
24
  module.exports = __toCommonJS(style_rules_exports);
25
+ var import_tree = require("../tree");
24
26
  const getStyleRules = (styles, styleSourceSelections) => {
25
27
  if (styles === void 0 || styleSourceSelections === void 0) {
26
28
  return [];
@@ -67,3 +69,18 @@ const getStyleRules = (styles, styleSourceSelections) => {
67
69
  }
68
70
  return styleRules;
69
71
  };
72
+ const getPresetStyleRules = (component, presetStyle) => {
73
+ const presetStyleRules = /* @__PURE__ */ new Map();
74
+ for (const [tag, styles] of Object.entries(presetStyle)) {
75
+ for (const styleDecl of styles) {
76
+ const selector = `${tag}:where([${import_tree.componentAttribute}=${component}])${styleDecl.state ?? ""}`;
77
+ let rule = presetStyleRules.get(selector);
78
+ if (rule === void 0) {
79
+ rule = {};
80
+ presetStyleRules.set(selector, rule);
81
+ }
82
+ rule[styleDecl.property] = styleDecl.value;
83
+ }
84
+ }
85
+ return presetStyleRules;
86
+ };