@webstudio-is/react-sdk 0.91.0 → 0.92.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 (108) hide show
  1. package/lib/app/index.js +1 -0
  2. package/lib/app/root.js +2 -4
  3. package/lib/component-renderer.js +3 -5
  4. package/lib/components/component-meta.js +6 -11
  5. package/lib/components/components-utils.js +1 -0
  6. package/lib/context.js +2 -4
  7. package/lib/css/css.js +4 -9
  8. package/lib/css/global-rules.js +3 -5
  9. package/lib/css/index.js +1 -0
  10. package/lib/css/normalize-type-check.js +1 -0
  11. package/lib/css/normalize.js +48 -96
  12. package/lib/css/presets.js +3 -6
  13. package/lib/css/style-rules.js +3 -6
  14. package/{src/css/style-rules.test.ts → lib/css/style-rules.test.js} +23 -28
  15. package/lib/embed-template.js +7 -22
  16. package/{src/embed-template.test.ts → lib/embed-template.test.js} +165 -176
  17. package/lib/expression.js +11 -22
  18. package/{src/expression.test.ts → lib/expression.test.js} +55 -83
  19. package/lib/generator.js +2 -4
  20. package/{src/generator.test.ts → lib/generator.test.js} +28 -31
  21. package/lib/hook.js +2 -4
  22. package/{src/hook.test.ts → lib/hook.test.js} +4 -4
  23. package/lib/index.js +9 -31
  24. package/lib/instance-utils.js +2 -4
  25. package/{src/instance-utils.test.ts → lib/instance-utils.test.js} +19 -43
  26. package/lib/prop-meta.js +150 -0
  27. package/lib/props.js +8 -16
  28. package/{src/props.test.ts → lib/props.test.js} +39 -68
  29. package/lib/pubsub/create.js +2 -4
  30. package/lib/pubsub/index.js +1 -0
  31. package/lib/pubsub/raf-queue.js +2 -4
  32. package/lib/tree/create-elements-tree.js +2 -4
  33. package/lib/tree/index.js +1 -0
  34. package/lib/tree/root.js +2 -5
  35. package/lib/tree/webstudio-component.js +10 -20
  36. package/lib/types/component-renderer.d.ts +1 -1
  37. package/lib/types/components/component-meta.d.ts +526 -526
  38. package/lib/types/context.d.ts +1 -2
  39. package/lib/types/css/css.d.ts +22 -23
  40. package/lib/types/css/global-rules.d.ts +19 -19
  41. package/lib/types/css/normalize.d.ts +2444 -2444
  42. package/lib/types/css/style-rules.d.ts +2 -2
  43. package/lib/types/embed-template.d.ts +648 -648
  44. package/lib/types/generator.d.ts +1 -1
  45. package/lib/types/hook.d.ts +3 -3
  46. package/lib/types/index.d.ts +1 -0
  47. package/lib/types/instance-utils.d.ts +3 -3
  48. package/lib/types/prop-meta.d.ts +396 -0
  49. package/lib/types/props.d.ts +52 -53
  50. package/lib/types/tree/create-elements-tree.d.ts +3 -4
  51. package/lib/types/tree/root.d.ts +8 -8
  52. package/lib/types/tree/webstudio-component.d.ts +1 -1
  53. package/package.json +14 -22
  54. package/lib/cjs/app/index.js +0 -18
  55. package/lib/cjs/app/root.js +0 -40
  56. package/lib/cjs/component-renderer.js +0 -143
  57. package/lib/cjs/components/component-meta.js +0 -87
  58. package/lib/cjs/components/components-utils.js +0 -17
  59. package/lib/cjs/context.js +0 -43
  60. package/lib/cjs/css/css.js +0 -84
  61. package/lib/cjs/css/global-rules.js +0 -37
  62. package/lib/cjs/css/index.js +0 -20
  63. package/lib/cjs/css/normalize-type-check.js +0 -26
  64. package/lib/cjs/css/normalize.js +0 -349
  65. package/lib/cjs/css/presets.js +0 -48
  66. package/lib/cjs/css/style-rules.js +0 -86
  67. package/lib/cjs/embed-template.js +0 -368
  68. package/lib/cjs/expression.js +0 -371
  69. package/lib/cjs/generator.js +0 -128
  70. package/lib/cjs/hook.js +0 -34
  71. package/lib/cjs/index.js +0 -59
  72. package/lib/cjs/instance-utils.js +0 -65
  73. package/lib/cjs/package.json +0 -1
  74. package/lib/cjs/props.js +0 -204
  75. package/lib/cjs/pubsub/create.js +0 -78
  76. package/lib/cjs/pubsub/index.js +0 -18
  77. package/lib/cjs/pubsub/raf-queue.js +0 -42
  78. package/lib/cjs/tree/create-elements-tree.js +0 -152
  79. package/lib/cjs/tree/index.js +0 -20
  80. package/lib/cjs/tree/root.js +0 -100
  81. package/lib/cjs/tree/webstudio-component.js +0 -91
  82. package/src/app/index.ts +0 -1
  83. package/src/app/root.tsx +0 -25
  84. package/src/component-renderer.tsx +0 -146
  85. package/src/components/component-meta.ts +0 -86
  86. package/src/components/components-utils.ts +0 -13
  87. package/src/context.tsx +0 -73
  88. package/src/css/css.ts +0 -88
  89. package/src/css/global-rules.ts +0 -26
  90. package/src/css/index.ts +0 -3
  91. package/src/css/normalize-type-check.ts +0 -13
  92. package/src/css/normalize.ts +0 -507
  93. package/src/css/presets.ts +0 -27
  94. package/src/css/style-rules.ts +0 -101
  95. package/src/embed-template.ts +0 -438
  96. package/src/expression.ts +0 -401
  97. package/src/generator.ts +0 -147
  98. package/src/hook.ts +0 -52
  99. package/src/index.ts +0 -39
  100. package/src/instance-utils.ts +0 -65
  101. package/src/props.ts +0 -231
  102. package/src/pubsub/create.ts +0 -77
  103. package/src/pubsub/index.ts +0 -1
  104. package/src/pubsub/raf-queue.ts +0 -25
  105. package/src/tree/create-elements-tree.tsx +0 -186
  106. package/src/tree/index.ts +0 -3
  107. package/src/tree/root.ts +0 -131
  108. package/src/tree/webstudio-component.tsx +0 -97
@@ -1,349 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var normalize_exports = {};
20
- __export(normalize_exports, {
21
- a: () => a,
22
- address: () => address,
23
- article: () => article,
24
- aside: () => aside,
25
- b: () => b,
26
- body: () => body,
27
- button: () => button,
28
- code: () => code,
29
- div: () => div,
30
- figure: () => figure,
31
- footer: () => footer,
32
- form: () => form,
33
- h1: () => h1,
34
- h2: () => h2,
35
- h3: () => h3,
36
- h4: () => h4,
37
- h5: () => h5,
38
- h6: () => h6,
39
- header: () => header,
40
- hr: () => hr,
41
- html: () => html,
42
- i: () => i,
43
- img: () => img,
44
- input: () => input,
45
- kbd: () => kbd,
46
- label: () => label,
47
- legend: () => legend,
48
- li: () => li,
49
- main: () => main,
50
- nav: () => nav,
51
- ol: () => ol,
52
- optgroup: () => optgroup,
53
- p: () => p,
54
- pre: () => pre,
55
- progress: () => progress,
56
- samp: () => samp,
57
- section: () => section,
58
- select: () => select,
59
- small: () => small,
60
- span: () => span,
61
- strong: () => strong,
62
- sub: () => sub,
63
- summary: () => summary,
64
- sup: () => sup,
65
- table: () => table,
66
- textarea: () => textarea,
67
- ul: () => ul
68
- });
69
- module.exports = __toCommonJS(normalize_exports);
70
- var import_presets = require("./presets");
71
- const boxSizing = {
72
- property: "boxSizing",
73
- value: { type: "keyword", value: "border-box" }
74
- };
75
- const baseStyle = [boxSizing, ...import_presets.borders, ...import_presets.outline];
76
- const div = baseStyle;
77
- const address = baseStyle;
78
- const article = baseStyle;
79
- const aside = baseStyle;
80
- const figure = baseStyle;
81
- const footer = baseStyle;
82
- const header = baseStyle;
83
- const main = baseStyle;
84
- const nav = baseStyle;
85
- const section = baseStyle;
86
- const form = baseStyle;
87
- const label = baseStyle;
88
- const h1 = baseStyle;
89
- const h2 = baseStyle;
90
- const h3 = baseStyle;
91
- const h4 = baseStyle;
92
- const h5 = baseStyle;
93
- const h6 = baseStyle;
94
- const i = baseStyle;
95
- const img = baseStyle;
96
- const a = baseStyle;
97
- const li = baseStyle;
98
- const ul = baseStyle;
99
- const ol = baseStyle;
100
- const p = baseStyle;
101
- const span = baseStyle;
102
- const html = [
103
- /* 1 */
104
- {
105
- property: "lineHeight",
106
- value: { type: "unit", value: 1.15, unit: "number" }
107
- },
108
- /* 2 */
109
- {
110
- property: "textSizeAdjust",
111
- value: { type: "unit", value: 100, unit: "%" }
112
- },
113
- /* 3 */
114
- {
115
- property: "tabSize",
116
- value: { type: "unit", value: 4, unit: "number" }
117
- },
118
- boxSizing,
119
- ...import_presets.borders
120
- ];
121
- const body = [
122
- /* 1 */
123
- {
124
- property: "marginTop",
125
- value: { type: "unit", value: 0, unit: "number" }
126
- },
127
- {
128
- property: "marginRight",
129
- value: { type: "unit", value: 0, unit: "number" }
130
- },
131
- {
132
- property: "marginBottom",
133
- value: { type: "unit", value: 0, unit: "number" }
134
- },
135
- {
136
- property: "marginLeft",
137
- value: { type: "unit", value: 0, unit: "number" }
138
- },
139
- /* 2 */
140
- {
141
- property: "fontFamily",
142
- value: {
143
- type: "keyword",
144
- value: "Arial, Roboto, sans-serif"
145
- }
146
- },
147
- {
148
- property: "fontSize",
149
- value: { type: "unit", unit: "px", value: 16 }
150
- },
151
- {
152
- property: "lineHeight",
153
- value: { type: "unit", unit: "number", value: 1.2 }
154
- },
155
- boxSizing,
156
- ...import_presets.borders
157
- ];
158
- const hr = [
159
- /* 1 */
160
- {
161
- property: "height",
162
- value: { type: "unit", value: 0, unit: "number" }
163
- },
164
- /* 2 */
165
- {
166
- property: "color",
167
- value: { type: "keyword", value: "inherit" }
168
- },
169
- boxSizing,
170
- ...import_presets.borders
171
- ];
172
- const b = [
173
- {
174
- property: "fontWeight",
175
- value: { type: "keyword", value: "700" }
176
- },
177
- boxSizing,
178
- ...import_presets.borders
179
- ];
180
- const strong = b;
181
- const code = [
182
- /* 1 */
183
- {
184
- property: "fontFamily",
185
- value: {
186
- type: "keyword",
187
- value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`
188
- }
189
- },
190
- /* 2 */
191
- {
192
- property: "fontSize",
193
- value: { type: "unit", value: 1, unit: "em" }
194
- },
195
- boxSizing,
196
- ...import_presets.borders
197
- ];
198
- const kbd = code;
199
- const samp = code;
200
- const pre = code;
201
- const small = [
202
- {
203
- property: "fontSize",
204
- value: { type: "unit", value: 80, unit: "%" }
205
- },
206
- boxSizing,
207
- ...import_presets.borders
208
- ];
209
- const subSupBase = [
210
- {
211
- property: "fontSize",
212
- value: { type: "unit", value: 75, unit: "%" }
213
- },
214
- {
215
- property: "lineHeight",
216
- value: { type: "unit", value: 0, unit: "number" }
217
- },
218
- {
219
- property: "position",
220
- value: { type: "keyword", value: "relative" }
221
- },
222
- {
223
- property: "verticalAlign",
224
- value: { type: "keyword", value: "baseline" }
225
- },
226
- boxSizing,
227
- ...import_presets.borders
228
- ];
229
- const sub = [
230
- ...subSupBase,
231
- {
232
- property: "bottom",
233
- value: { type: "unit", value: -0.25, unit: "em" }
234
- }
235
- ];
236
- const sup = [
237
- ...subSupBase,
238
- {
239
- property: "top",
240
- value: { type: "unit", value: -0.5, unit: "em" }
241
- }
242
- ];
243
- const table = [
244
- /* 1 */
245
- {
246
- property: "textIndent",
247
- value: { type: "unit", value: 0, unit: "number" }
248
- },
249
- ...import_presets.borders,
250
- /* 2 */
251
- {
252
- property: "borderTopColor",
253
- value: { type: "keyword", value: "inherit" }
254
- },
255
- {
256
- property: "borderRightColor",
257
- value: { type: "keyword", value: "inherit" }
258
- },
259
- {
260
- property: "borderBottomColor",
261
- value: { type: "keyword", value: "inherit" }
262
- },
263
- {
264
- property: "borderLeftColor",
265
- value: { type: "keyword", value: "inherit" }
266
- },
267
- boxSizing
268
- ];
269
- const buttonBase = [
270
- /* 1 */
271
- {
272
- property: "fontFamily",
273
- value: { type: "keyword", value: "inherit" }
274
- },
275
- {
276
- property: "fontSize",
277
- value: { type: "unit", value: 100, unit: "%" }
278
- },
279
- {
280
- property: "lineHeight",
281
- value: { type: "unit", value: 1.15, unit: "number" }
282
- },
283
- /* 2 */
284
- {
285
- property: "marginTop",
286
- value: { type: "unit", value: 0, unit: "number" }
287
- },
288
- {
289
- property: "marginRight",
290
- value: { type: "unit", value: 0, unit: "number" }
291
- },
292
- {
293
- property: "marginBottom",
294
- value: { type: "unit", value: 0, unit: "number" }
295
- },
296
- {
297
- property: "marginLeft",
298
- value: { type: "unit", value: 0, unit: "number" }
299
- },
300
- boxSizing,
301
- ...import_presets.borders
302
- ];
303
- const input = buttonBase;
304
- const optgroup = buttonBase;
305
- const textarea = buttonBase;
306
- const button = [
307
- ...buttonBase,
308
- {
309
- property: "textTransform",
310
- value: { type: "keyword", value: "none" }
311
- }
312
- ];
313
- const select = button;
314
- const legend = [
315
- {
316
- property: "paddingTop",
317
- value: { type: "unit", value: 0, unit: "number" }
318
- },
319
- {
320
- property: "paddingRight",
321
- value: { type: "unit", value: 0, unit: "number" }
322
- },
323
- {
324
- property: "paddingBottom",
325
- value: { type: "unit", value: 0, unit: "number" }
326
- },
327
- {
328
- property: "paddingLeft",
329
- value: { type: "unit", value: 0, unit: "number" }
330
- },
331
- boxSizing,
332
- ...import_presets.borders
333
- ];
334
- const progress = [
335
- {
336
- property: "verticalAlign",
337
- value: { type: "keyword", value: "baseline" }
338
- },
339
- boxSizing,
340
- ...import_presets.borders
341
- ];
342
- const summary = [
343
- {
344
- property: "display",
345
- value: { type: "keyword", value: "list-item" }
346
- },
347
- boxSizing,
348
- ...import_presets.borders
349
- ];
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var presets_exports = {};
20
- __export(presets_exports, {
21
- borders: () => borders,
22
- outline: () => outline
23
- });
24
- module.exports = __toCommonJS(presets_exports);
25
- const borders = [
26
- {
27
- property: "borderTopWidth",
28
- value: { type: "unit", value: 1, unit: "px" }
29
- },
30
- {
31
- property: "borderRightWidth",
32
- value: { type: "unit", value: 1, unit: "px" }
33
- },
34
- {
35
- property: "borderBottomWidth",
36
- value: { type: "unit", value: 1, unit: "px" }
37
- },
38
- {
39
- property: "borderLeftWidth",
40
- value: { type: "unit", value: 1, unit: "px" }
41
- }
42
- ];
43
- const outline = [
44
- {
45
- property: "outlineWidth",
46
- value: { type: "unit", value: 1, unit: "px" }
47
- }
48
- ];
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var style_rules_exports = {};
20
- __export(style_rules_exports, {
21
- getPresetStyleRules: () => getPresetStyleRules,
22
- getStyleRules: () => getStyleRules
23
- });
24
- module.exports = __toCommonJS(style_rules_exports);
25
- var import_tree = require("../tree");
26
- const getStyleRules = (styles, styleSourceSelections) => {
27
- if (styles === void 0 || styleSourceSelections === void 0) {
28
- return [];
29
- }
30
- const stylesByStyleSourceId = /* @__PURE__ */ new Map();
31
- for (const styleDecl of styles.values()) {
32
- const { styleSourceId } = styleDecl;
33
- let styleSourceStyles = stylesByStyleSourceId.get(styleSourceId);
34
- if (styleSourceStyles === void 0) {
35
- styleSourceStyles = [];
36
- stylesByStyleSourceId.set(styleSourceId, styleSourceStyles);
37
- }
38
- styleSourceStyles.push(styleDecl);
39
- }
40
- const styleRules = [];
41
- for (const { instanceId, values } of styleSourceSelections.values()) {
42
- const styleRuleByBreakpointId = /* @__PURE__ */ new Map();
43
- for (const styleSourceId of values) {
44
- const styleSourceStyles = stylesByStyleSourceId.get(styleSourceId);
45
- if (styleSourceStyles === void 0) {
46
- continue;
47
- }
48
- for (const {
49
- breakpointId,
50
- state,
51
- property,
52
- value
53
- } of styleSourceStyles) {
54
- const key = `${breakpointId}:${state ?? ""}`;
55
- let styleRule = styleRuleByBreakpointId.get(key);
56
- if (styleRule === void 0) {
57
- styleRule = {
58
- instanceId,
59
- breakpointId,
60
- state,
61
- style: {}
62
- };
63
- styleRuleByBreakpointId.set(key, styleRule);
64
- }
65
- styleRule.style[property] = value;
66
- }
67
- }
68
- styleRules.push(...styleRuleByBreakpointId.values());
69
- }
70
- return styleRules;
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
- };