@webstudio-is/react-sdk 0.91.0 → 0.93.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,4 +1,4 @@
1
- import type { DataSources, Instance, Instances, Page, Props } from "@webstudio-is/project-build";
1
+ import type { DataSources, Instance, Instances, Page, Props } from "@webstudio-is/sdk";
2
2
  import type { WsComponentMeta } from "./components/component-meta";
3
3
  import { type IndexesWithinAncestors } from "./instance-utils";
4
4
  import type { DataSourceValues } from "./context";
@@ -1,4 +1,4 @@
1
- import type { Instance, Prop } from "@webstudio-is/project-build";
1
+ import type { Instance, Prop } from "@webstudio-is/sdk";
2
2
  import type { IndexesWithinAncestors } from "./instance-utils";
3
3
  /**
4
4
  * Hooks are subscriptions to builder events
@@ -30,11 +30,11 @@ export declare const getClosestInstance: (instancePath: InstancePath, currentIns
30
30
  id: string;
31
31
  component: string;
32
32
  children: ({
33
- type: "text";
34
33
  value: string;
34
+ type: "text";
35
35
  } | {
36
- type: "id";
37
36
  value: string;
37
+ type: "id";
38
38
  })[];
39
39
  label?: string | undefined;
40
40
  } | undefined;
@@ -3,6 +3,7 @@ export * from "./tree";
3
3
  export * from "./pubsub";
4
4
  export * from "./app";
5
5
  export * from "./components/components-utils";
6
+ export { PropMeta } from "./prop-meta";
6
7
  export { type WsComponentPropsMeta, type WsComponentMeta, type ComponentState, type PresetStyle, componentCategories, stateCategories, defaultStates, } from "./components/component-meta";
7
8
  export * from "./embed-template";
8
9
  export { useInstanceProps, usePropUrl, usePropAsset, getInstanceIdFromComponentProps, getIndexWithinAncestorFromComponentProps, } from "./props";
@@ -1,4 +1,4 @@
1
- import type { Instance } from "@webstudio-is/project-build";
1
+ import type { Instance } from "@webstudio-is/sdk";
2
2
  import type { WsComponentMeta } from "./components/component-meta";
3
3
  export type IndexesWithinAncestors = Map<Instance["id"], number>;
4
4
  export declare const getIndexesWithinAncestors: (metas: Map<Instance["component"], WsComponentMeta>, instances: Map<string, {
@@ -6,11 +6,11 @@ export declare const getIndexesWithinAncestors: (metas: Map<Instance["component"
6
6
  id: string;
7
7
  component: string;
8
8
  children: ({
9
- type: "text";
10
9
  value: string;
10
+ type: "text";
11
11
  } | {
12
- type: "id";
13
12
  value: string;
13
+ type: "id";
14
14
  })[];
15
15
  label?: string | undefined;
16
16
  }>, rootIds: Instance["id"][]) => IndexesWithinAncestors;
@@ -0,0 +1,396 @@
1
+ import { z } from "zod";
2
+ export declare const PropMeta: z.ZodUnion<[z.ZodObject<{
3
+ control: z.ZodLiteral<"number">;
4
+ type: z.ZodLiteral<"number">;
5
+ defaultValue: z.ZodOptional<z.ZodNumber>;
6
+ label: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodOptional<z.ZodString>;
8
+ required: z.ZodBoolean;
9
+ }, "strip", z.ZodTypeAny, {
10
+ type: "number";
11
+ required: boolean;
12
+ control: "number";
13
+ defaultValue?: number | undefined;
14
+ label?: string | undefined;
15
+ description?: string | undefined;
16
+ }, {
17
+ type: "number";
18
+ required: boolean;
19
+ control: "number";
20
+ defaultValue?: number | undefined;
21
+ label?: string | undefined;
22
+ description?: string | undefined;
23
+ }>, z.ZodObject<{
24
+ control: z.ZodLiteral<"range">;
25
+ type: z.ZodLiteral<"number">;
26
+ defaultValue: z.ZodOptional<z.ZodNumber>;
27
+ label: z.ZodOptional<z.ZodString>;
28
+ description: z.ZodOptional<z.ZodString>;
29
+ required: z.ZodBoolean;
30
+ }, "strip", z.ZodTypeAny, {
31
+ type: "number";
32
+ required: boolean;
33
+ control: "range";
34
+ defaultValue?: number | undefined;
35
+ label?: string | undefined;
36
+ description?: string | undefined;
37
+ }, {
38
+ type: "number";
39
+ required: boolean;
40
+ control: "range";
41
+ defaultValue?: number | undefined;
42
+ label?: string | undefined;
43
+ description?: string | undefined;
44
+ }>, z.ZodObject<{
45
+ control: z.ZodLiteral<"text">;
46
+ type: z.ZodLiteral<"string">;
47
+ defaultValue: z.ZodOptional<z.ZodString>;
48
+ /**
49
+ * The number of rows in <textarea>. If set to 0 an <input> will be used instead.
50
+ * In line with Storybook team's plan: https://github.com/storybookjs/storybook/issues/21100
51
+ */
52
+ rows: z.ZodOptional<z.ZodNumber>;
53
+ label: z.ZodOptional<z.ZodString>;
54
+ description: z.ZodOptional<z.ZodString>;
55
+ required: z.ZodBoolean;
56
+ }, "strip", z.ZodTypeAny, {
57
+ type: "string";
58
+ required: boolean;
59
+ control: "text";
60
+ defaultValue?: string | undefined;
61
+ rows?: number | undefined;
62
+ label?: string | undefined;
63
+ description?: string | undefined;
64
+ }, {
65
+ type: "string";
66
+ required: boolean;
67
+ control: "text";
68
+ defaultValue?: string | undefined;
69
+ rows?: number | undefined;
70
+ label?: string | undefined;
71
+ description?: string | undefined;
72
+ }>, z.ZodObject<{
73
+ control: z.ZodLiteral<"code">;
74
+ type: z.ZodLiteral<"string">;
75
+ defaultValue: z.ZodOptional<z.ZodString>;
76
+ /**
77
+ * The number of rows in <textarea>. If set to 0 an <input> will be used instead.
78
+ * In line with Storybook team's plan: https://github.com/storybookjs/storybook/issues/21100
79
+ */
80
+ rows: z.ZodOptional<z.ZodNumber>;
81
+ label: z.ZodOptional<z.ZodString>;
82
+ description: z.ZodOptional<z.ZodString>;
83
+ required: z.ZodBoolean;
84
+ }, "strip", z.ZodTypeAny, {
85
+ type: "string";
86
+ required: boolean;
87
+ control: "code";
88
+ defaultValue?: string | undefined;
89
+ rows?: number | undefined;
90
+ label?: string | undefined;
91
+ description?: string | undefined;
92
+ }, {
93
+ type: "string";
94
+ required: boolean;
95
+ control: "code";
96
+ defaultValue?: string | undefined;
97
+ rows?: number | undefined;
98
+ label?: string | undefined;
99
+ description?: string | undefined;
100
+ }>, z.ZodObject<{
101
+ control: z.ZodLiteral<"color">;
102
+ type: z.ZodLiteral<"string">;
103
+ defaultValue: z.ZodOptional<z.ZodString>;
104
+ label: z.ZodOptional<z.ZodString>;
105
+ description: z.ZodOptional<z.ZodString>;
106
+ required: z.ZodBoolean;
107
+ }, "strip", z.ZodTypeAny, {
108
+ type: "string";
109
+ required: boolean;
110
+ control: "color";
111
+ defaultValue?: string | undefined;
112
+ label?: string | undefined;
113
+ description?: string | undefined;
114
+ }, {
115
+ type: "string";
116
+ required: boolean;
117
+ control: "color";
118
+ defaultValue?: string | undefined;
119
+ label?: string | undefined;
120
+ description?: string | undefined;
121
+ }>, z.ZodObject<{
122
+ control: z.ZodLiteral<"boolean">;
123
+ type: z.ZodLiteral<"boolean">;
124
+ defaultValue: z.ZodOptional<z.ZodBoolean>;
125
+ label: z.ZodOptional<z.ZodString>;
126
+ description: z.ZodOptional<z.ZodString>;
127
+ required: z.ZodBoolean;
128
+ }, "strip", z.ZodTypeAny, {
129
+ type: "boolean";
130
+ required: boolean;
131
+ control: "boolean";
132
+ defaultValue?: boolean | undefined;
133
+ label?: string | undefined;
134
+ description?: string | undefined;
135
+ }, {
136
+ type: "boolean";
137
+ required: boolean;
138
+ control: "boolean";
139
+ defaultValue?: boolean | undefined;
140
+ label?: string | undefined;
141
+ description?: string | undefined;
142
+ }>, z.ZodObject<{
143
+ control: z.ZodLiteral<"radio">;
144
+ type: z.ZodLiteral<"string">;
145
+ defaultValue: z.ZodOptional<z.ZodString>;
146
+ options: z.ZodArray<z.ZodString, "many">;
147
+ label: z.ZodOptional<z.ZodString>;
148
+ description: z.ZodOptional<z.ZodString>;
149
+ required: z.ZodBoolean;
150
+ }, "strip", z.ZodTypeAny, {
151
+ options: string[];
152
+ type: "string";
153
+ required: boolean;
154
+ control: "radio";
155
+ defaultValue?: string | undefined;
156
+ label?: string | undefined;
157
+ description?: string | undefined;
158
+ }, {
159
+ options: string[];
160
+ type: "string";
161
+ required: boolean;
162
+ control: "radio";
163
+ defaultValue?: string | undefined;
164
+ label?: string | undefined;
165
+ description?: string | undefined;
166
+ }>, z.ZodObject<{
167
+ control: z.ZodLiteral<"inline-radio">;
168
+ type: z.ZodLiteral<"string">;
169
+ defaultValue: z.ZodOptional<z.ZodString>;
170
+ options: z.ZodArray<z.ZodString, "many">;
171
+ label: z.ZodOptional<z.ZodString>;
172
+ description: z.ZodOptional<z.ZodString>;
173
+ required: z.ZodBoolean;
174
+ }, "strip", z.ZodTypeAny, {
175
+ options: string[];
176
+ type: "string";
177
+ required: boolean;
178
+ control: "inline-radio";
179
+ defaultValue?: string | undefined;
180
+ label?: string | undefined;
181
+ description?: string | undefined;
182
+ }, {
183
+ options: string[];
184
+ type: "string";
185
+ required: boolean;
186
+ control: "inline-radio";
187
+ defaultValue?: string | undefined;
188
+ label?: string | undefined;
189
+ description?: string | undefined;
190
+ }>, z.ZodObject<{
191
+ control: z.ZodLiteral<"select">;
192
+ type: z.ZodLiteral<"string">;
193
+ defaultValue: z.ZodOptional<z.ZodString>;
194
+ options: z.ZodArray<z.ZodString, "many">;
195
+ label: z.ZodOptional<z.ZodString>;
196
+ description: z.ZodOptional<z.ZodString>;
197
+ required: z.ZodBoolean;
198
+ }, "strip", z.ZodTypeAny, {
199
+ options: string[];
200
+ type: "string";
201
+ required: boolean;
202
+ control: "select";
203
+ defaultValue?: string | undefined;
204
+ label?: string | undefined;
205
+ description?: string | undefined;
206
+ }, {
207
+ options: string[];
208
+ type: "string";
209
+ required: boolean;
210
+ control: "select";
211
+ defaultValue?: string | undefined;
212
+ label?: string | undefined;
213
+ description?: string | undefined;
214
+ }>, z.ZodObject<{
215
+ control: z.ZodLiteral<"multi-select">;
216
+ type: z.ZodLiteral<"string[]">;
217
+ defaultValue: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
218
+ options: z.ZodArray<z.ZodString, "many">;
219
+ label: z.ZodOptional<z.ZodString>;
220
+ description: z.ZodOptional<z.ZodString>;
221
+ required: z.ZodBoolean;
222
+ }, "strip", z.ZodTypeAny, {
223
+ options: string[];
224
+ type: "string[]";
225
+ required: boolean;
226
+ control: "multi-select";
227
+ defaultValue?: string[] | undefined;
228
+ label?: string | undefined;
229
+ description?: string | undefined;
230
+ }, {
231
+ options: string[];
232
+ type: "string[]";
233
+ required: boolean;
234
+ control: "multi-select";
235
+ defaultValue?: string[] | undefined;
236
+ label?: string | undefined;
237
+ description?: string | undefined;
238
+ }>, z.ZodObject<{
239
+ control: z.ZodLiteral<"check">;
240
+ type: z.ZodLiteral<"string[]">;
241
+ defaultValue: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
242
+ options: z.ZodArray<z.ZodString, "many">;
243
+ label: z.ZodOptional<z.ZodString>;
244
+ description: z.ZodOptional<z.ZodString>;
245
+ required: z.ZodBoolean;
246
+ }, "strip", z.ZodTypeAny, {
247
+ options: string[];
248
+ type: "string[]";
249
+ required: boolean;
250
+ control: "check";
251
+ defaultValue?: string[] | undefined;
252
+ label?: string | undefined;
253
+ description?: string | undefined;
254
+ }, {
255
+ options: string[];
256
+ type: "string[]";
257
+ required: boolean;
258
+ control: "check";
259
+ defaultValue?: string[] | undefined;
260
+ label?: string | undefined;
261
+ description?: string | undefined;
262
+ }>, z.ZodObject<{
263
+ control: z.ZodLiteral<"inline-check">;
264
+ type: z.ZodLiteral<"string[]">;
265
+ defaultValue: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
266
+ options: z.ZodArray<z.ZodString, "many">;
267
+ label: z.ZodOptional<z.ZodString>;
268
+ description: z.ZodOptional<z.ZodString>;
269
+ required: z.ZodBoolean;
270
+ }, "strip", z.ZodTypeAny, {
271
+ options: string[];
272
+ type: "string[]";
273
+ required: boolean;
274
+ control: "inline-check";
275
+ defaultValue?: string[] | undefined;
276
+ label?: string | undefined;
277
+ description?: string | undefined;
278
+ }, {
279
+ options: string[];
280
+ type: "string[]";
281
+ required: boolean;
282
+ control: "inline-check";
283
+ defaultValue?: string[] | undefined;
284
+ label?: string | undefined;
285
+ description?: string | undefined;
286
+ }>, z.ZodObject<{
287
+ control: z.ZodLiteral<"file">;
288
+ type: z.ZodLiteral<"string">;
289
+ defaultValue: z.ZodOptional<z.ZodString>;
290
+ /** https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept */
291
+ accept: z.ZodOptional<z.ZodString>;
292
+ label: z.ZodOptional<z.ZodString>;
293
+ description: z.ZodOptional<z.ZodString>;
294
+ required: z.ZodBoolean;
295
+ }, "strip", z.ZodTypeAny, {
296
+ type: "string";
297
+ required: boolean;
298
+ control: "file";
299
+ defaultValue?: string | undefined;
300
+ accept?: string | undefined;
301
+ label?: string | undefined;
302
+ description?: string | undefined;
303
+ }, {
304
+ type: "string";
305
+ required: boolean;
306
+ control: "file";
307
+ defaultValue?: string | undefined;
308
+ accept?: string | undefined;
309
+ label?: string | undefined;
310
+ description?: string | undefined;
311
+ }>, z.ZodObject<{
312
+ control: z.ZodLiteral<"url">;
313
+ type: z.ZodLiteral<"string">;
314
+ defaultValue: z.ZodOptional<z.ZodString>;
315
+ label: z.ZodOptional<z.ZodString>;
316
+ description: z.ZodOptional<z.ZodString>;
317
+ required: z.ZodBoolean;
318
+ }, "strip", z.ZodTypeAny, {
319
+ type: "string";
320
+ required: boolean;
321
+ control: "url";
322
+ defaultValue?: string | undefined;
323
+ label?: string | undefined;
324
+ description?: string | undefined;
325
+ }, {
326
+ type: "string";
327
+ required: boolean;
328
+ control: "url";
329
+ defaultValue?: string | undefined;
330
+ label?: string | undefined;
331
+ description?: string | undefined;
332
+ }>, z.ZodObject<{
333
+ control: z.ZodLiteral<"object">;
334
+ type: z.ZodLiteral<"Record<string, string>">;
335
+ defaultValue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
336
+ label: z.ZodOptional<z.ZodString>;
337
+ description: z.ZodOptional<z.ZodString>;
338
+ required: z.ZodBoolean;
339
+ }, "strip", z.ZodTypeAny, {
340
+ type: "Record<string, string>";
341
+ required: boolean;
342
+ control: "object";
343
+ defaultValue?: Record<string, string> | undefined;
344
+ label?: string | undefined;
345
+ description?: string | undefined;
346
+ }, {
347
+ type: "Record<string, string>";
348
+ required: boolean;
349
+ control: "object";
350
+ defaultValue?: Record<string, string> | undefined;
351
+ label?: string | undefined;
352
+ description?: string | undefined;
353
+ }>, z.ZodObject<{
354
+ control: z.ZodLiteral<"date">;
355
+ type: z.ZodLiteral<"string">;
356
+ defaultValue: z.ZodOptional<z.ZodString>;
357
+ label: z.ZodOptional<z.ZodString>;
358
+ description: z.ZodOptional<z.ZodString>;
359
+ required: z.ZodBoolean;
360
+ }, "strip", z.ZodTypeAny, {
361
+ type: "string";
362
+ required: boolean;
363
+ control: "date";
364
+ defaultValue?: string | undefined;
365
+ label?: string | undefined;
366
+ description?: string | undefined;
367
+ }, {
368
+ type: "string";
369
+ required: boolean;
370
+ control: "date";
371
+ defaultValue?: string | undefined;
372
+ label?: string | undefined;
373
+ description?: string | undefined;
374
+ }>, z.ZodObject<{
375
+ control: z.ZodLiteral<"action">;
376
+ type: z.ZodLiteral<"action">;
377
+ defaultValue: z.ZodOptional<z.ZodUndefined>;
378
+ label: z.ZodOptional<z.ZodString>;
379
+ description: z.ZodOptional<z.ZodString>;
380
+ required: z.ZodBoolean;
381
+ }, "strip", z.ZodTypeAny, {
382
+ type: "action";
383
+ required: boolean;
384
+ control: "action";
385
+ defaultValue?: undefined;
386
+ label?: string | undefined;
387
+ description?: string | undefined;
388
+ }, {
389
+ type: "action";
390
+ required: boolean;
391
+ control: "action";
392
+ defaultValue?: undefined;
393
+ label?: string | undefined;
394
+ description?: string | undefined;
395
+ }>]>;
396
+ export type PropMeta = z.infer<typeof PropMeta>;
@@ -1,37 +1,35 @@
1
- import type { Instance, Page, Prop } from "@webstudio-is/project-build";
2
- import type { Asset, Assets } from "@webstudio-is/asset-uploader";
1
+ import type { Instance, Page, Prop, Asset, Assets } from "@webstudio-is/sdk";
3
2
  export type PropsByInstanceId = Map<Instance["id"], Prop[]>;
4
3
  export type Pages = Map<Page["id"], Page>;
5
4
  export declare const getPropsByInstanceId: (props: Map<string, {
6
- type: "number";
7
5
  value: number;
8
- id: string;
6
+ type: "number";
9
7
  name: string;
8
+ id: string;
10
9
  instanceId: string;
11
10
  required?: boolean | undefined;
12
11
  } | {
13
- type: "string";
14
12
  value: string;
15
- id: string;
13
+ type: "string";
16
14
  name: string;
15
+ id: string;
17
16
  instanceId: string;
18
17
  required?: boolean | undefined;
19
18
  } | {
20
- type: "boolean";
21
19
  value: boolean;
22
- id: string;
20
+ type: "boolean";
23
21
  name: string;
22
+ id: string;
24
23
  instanceId: string;
25
24
  required?: boolean | undefined;
26
25
  } | {
27
- type: "asset";
28
26
  value: string;
29
- id: string;
27
+ type: "asset";
30
28
  name: string;
29
+ id: string;
31
30
  instanceId: string;
32
31
  required?: boolean | undefined;
33
32
  } | {
34
- type: "page";
35
33
  value: (string | {
36
34
  instanceId: string;
37
35
  pageId: string;
@@ -39,83 +37,84 @@ export declare const getPropsByInstanceId: (props: Map<string, {
39
37
  instanceId: string;
40
38
  pageId: string;
41
39
  } | undefined);
42
- id: string;
40
+ type: "page";
43
41
  name: string;
42
+ id: string;
44
43
  instanceId: string;
45
44
  required?: boolean | undefined;
46
45
  } | {
47
- type: "string[]";
48
46
  value: string[];
49
- id: string;
47
+ type: "string[]";
50
48
  name: string;
49
+ id: string;
51
50
  instanceId: string;
52
51
  required?: boolean | undefined;
53
52
  } | {
54
- type: "dataSource";
55
53
  value: string;
56
- id: string;
54
+ type: "dataSource";
57
55
  name: string;
56
+ id: string;
58
57
  instanceId: string;
59
58
  required?: boolean | undefined;
60
59
  } | {
61
- type: "action";
62
60
  value: {
63
61
  code: string;
64
62
  type: "execute";
65
63
  args: string[];
66
64
  }[];
67
- id: string;
65
+ type: "action";
68
66
  name: string;
67
+ id: string;
69
68
  instanceId: string;
70
69
  required?: boolean | undefined;
71
70
  }>) => PropsByInstanceId;
72
71
  export declare const useInstanceProps: (instanceId: Instance["id"]) => Record<string, unknown>;
73
72
  export declare const usePropAsset: (instanceId: Instance["id"], name: string) => {
74
73
  type: "font";
75
- id: string;
76
74
  name: string;
75
+ format: "ttf" | "woff" | "woff2" | "otf";
77
76
  meta: ({
78
- weight: number;
79
- style: "normal" | "italic" | "oblique";
80
77
  family: string;
78
+ style: "normal" | "italic" | "oblique";
79
+ weight: number;
81
80
  } | {
81
+ family: string;
82
82
  variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
83
- min: number;
84
- max: number;
85
83
  name: string;
84
+ min: number;
86
85
  default: number;
86
+ max: number;
87
87
  }>>;
88
- family: string;
89
88
  }) & ({
90
- weight: number;
91
- style: "normal" | "italic" | "oblique";
92
89
  family: string;
90
+ style: "normal" | "italic" | "oblique";
91
+ weight: number;
93
92
  } | {
93
+ family: string;
94
94
  variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
95
- min: number;
96
- max: number;
97
95
  name: string;
96
+ min: number;
98
97
  default: number;
98
+ max: number;
99
99
  }>>;
100
- family: string;
101
100
  } | undefined);
101
+ id: string;
102
+ projectId: string;
102
103
  size: number;
103
104
  description: string | null;
104
- format: "ttf" | "woff" | "woff2" | "otf";
105
- projectId: string;
106
105
  createdAt: string;
107
106
  } | {
108
107
  type: "image";
109
- id: string;
110
108
  name: string;
109
+ format: string;
111
110
  meta: {
112
- height: number;
113
111
  width: number;
112
+ height: number;
114
113
  };
114
+ id: string;
115
+ projectId: string;
115
116
  size: number;
116
117
  description: string | null;
117
- format: string;
118
- projectId: string;
119
118
  createdAt: string;
120
119
  } | undefined;
121
120
  export declare const resolveUrlProp: (instanceId: Instance["id"], name: string, { props, pages, assets, }: {
@@ -123,52 +122,52 @@ export declare const resolveUrlProp: (instanceId: Instance["id"], name: string,
123
122
  pages: Pages;
124
123
  assets: Map<string, {
125
124
  type: "font";
126
- id: string;
127
125
  name: string;
126
+ format: "ttf" | "woff" | "woff2" | "otf";
128
127
  meta: ({
129
- weight: number;
130
- style: "normal" | "italic" | "oblique";
131
128
  family: string;
129
+ style: "normal" | "italic" | "oblique";
130
+ weight: number;
132
131
  } | {
132
+ family: string;
133
133
  variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
134
- min: number;
135
- max: number;
136
134
  name: string;
135
+ min: number;
137
136
  default: number;
137
+ max: number;
138
138
  }>>;
139
- family: string;
140
139
  }) & ({
141
- weight: number;
142
- style: "normal" | "italic" | "oblique";
143
140
  family: string;
141
+ style: "normal" | "italic" | "oblique";
142
+ weight: number;
144
143
  } | {
144
+ family: string;
145
145
  variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
146
- min: number;
147
- max: number;
148
146
  name: string;
147
+ min: number;
149
148
  default: number;
149
+ max: number;
150
150
  }>>;
151
- family: string;
152
151
  } | undefined);
152
+ id: string;
153
+ projectId: string;
153
154
  size: number;
154
155
  description: string | null;
155
- format: "ttf" | "woff" | "woff2" | "otf";
156
- projectId: string;
157
156
  createdAt: string;
158
157
  } | {
159
158
  type: "image";
160
- id: string;
161
159
  name: string;
160
+ format: string;
162
161
  meta: {
163
- height: number;
164
162
  width: number;
163
+ height: number;
165
164
  };
165
+ id: string;
166
+ projectId: string;
166
167
  size: number;
167
168
  description: string | null;
168
- format: string;
169
- projectId: string;
170
169
  createdAt: string;
171
- } | undefined>;
170
+ }>;
172
171
  }) => {
173
172
  type: "page";
174
173
  page: Page;