@webstudio-is/react-sdk 0.144.1-710b1d2.0 → 0.145.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.
@@ -3,325 +3,22 @@ import type { IndexesWithinAncestors } from "./instance-utils";
3
3
  export declare const generateJsxElement: ({ scope, instance, props, dataSources, usedDataSources, indexesWithinAncestors, children, classesMap, }: {
4
4
  scope: Scope;
5
5
  instance: Instance;
6
- props: Map<string, {
7
- value: number;
8
- type: "number";
9
- name: string;
10
- id: string;
11
- instanceId: string;
12
- required?: boolean | undefined;
13
- } | {
14
- value: string;
15
- type: "string";
16
- name: string;
17
- id: string;
18
- instanceId: string;
19
- required?: boolean | undefined;
20
- } | {
21
- value: boolean;
22
- type: "boolean";
23
- name: string;
24
- id: string;
25
- instanceId: string;
26
- required?: boolean | undefined;
27
- } | {
28
- type: "json";
29
- name: string;
30
- id: string;
31
- instanceId: string;
32
- value?: unknown;
33
- required?: boolean | undefined;
34
- } | {
35
- value: string;
36
- type: "asset";
37
- name: string;
38
- id: string;
39
- instanceId: string;
40
- required?: boolean | undefined;
41
- } | {
42
- value: (string | {
43
- instanceId: string;
44
- pageId: string;
45
- }) & (string | {
46
- instanceId: string;
47
- pageId: string;
48
- } | undefined);
49
- type: "page";
50
- name: string;
51
- id: string;
52
- instanceId: string;
53
- required?: boolean | undefined;
54
- } | {
55
- value: string[];
56
- type: "string[]";
57
- name: string;
58
- id: string;
59
- instanceId: string;
60
- required?: boolean | undefined;
61
- } | {
62
- value: string;
63
- type: "parameter";
64
- name: string;
65
- id: string;
66
- instanceId: string;
67
- required?: boolean | undefined;
68
- } | {
69
- value: string;
70
- type: "expression";
71
- name: string;
72
- id: string;
73
- instanceId: string;
74
- required?: boolean | undefined;
75
- } | {
76
- value: {
77
- code: string;
78
- type: "execute";
79
- args: string[];
80
- }[];
81
- type: "action";
82
- name: string;
83
- id: string;
84
- instanceId: string;
85
- required?: boolean | undefined;
86
- }>;
87
- dataSources: Map<string, {
88
- value: {
89
- value: number;
90
- type: "number";
91
- } | {
92
- value: string;
93
- type: "string";
94
- } | {
95
- value: boolean;
96
- type: "boolean";
97
- } | {
98
- value: string[];
99
- type: "string[]";
100
- } | {
101
- type: "json";
102
- value?: unknown;
103
- };
104
- type: "variable";
105
- name: string;
106
- id: string;
107
- scopeInstanceId?: string | undefined;
108
- } | {
109
- type: "parameter";
110
- name: string;
111
- id: string;
112
- scopeInstanceId?: string | undefined;
113
- } | {
114
- type: "resource";
115
- name: string;
116
- id: string;
117
- resourceId: string;
118
- scopeInstanceId?: string | undefined;
119
- }>;
120
- usedDataSources: Map<string, {
121
- value: {
122
- value: number;
123
- type: "number";
124
- } | {
125
- value: string;
126
- type: "string";
127
- } | {
128
- value: boolean;
129
- type: "boolean";
130
- } | {
131
- value: string[];
132
- type: "string[]";
133
- } | {
134
- type: "json";
135
- value?: unknown;
136
- };
137
- type: "variable";
138
- name: string;
139
- id: string;
140
- scopeInstanceId?: string | undefined;
141
- } | {
142
- type: "parameter";
143
- name: string;
144
- id: string;
145
- scopeInstanceId?: string | undefined;
146
- } | {
147
- type: "resource";
148
- name: string;
149
- id: string;
150
- resourceId: string;
151
- scopeInstanceId?: string | undefined;
152
- }>;
6
+ props: Props;
7
+ dataSources: DataSources;
8
+ usedDataSources: DataSources;
153
9
  indexesWithinAncestors: IndexesWithinAncestors;
154
10
  children: string;
155
- classesMap?: Map<string, string[]> | undefined;
11
+ classesMap?: Map<string, Array<string>>;
156
12
  }) => string;
157
13
  export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, }: {
158
14
  scope: Scope;
159
15
  children: Instance["children"];
160
- instances: Map<string, {
161
- type: "instance";
162
- id: string;
163
- children: ({
164
- value: string;
165
- type: "text";
166
- } | {
167
- value: string;
168
- type: "id";
169
- } | {
170
- value: string;
171
- type: "expression";
172
- })[];
173
- component: string;
174
- label?: string | undefined;
175
- }>;
176
- props: Map<string, {
177
- value: number;
178
- type: "number";
179
- name: string;
180
- id: string;
181
- instanceId: string;
182
- required?: boolean | undefined;
183
- } | {
184
- value: string;
185
- type: "string";
186
- name: string;
187
- id: string;
188
- instanceId: string;
189
- required?: boolean | undefined;
190
- } | {
191
- value: boolean;
192
- type: "boolean";
193
- name: string;
194
- id: string;
195
- instanceId: string;
196
- required?: boolean | undefined;
197
- } | {
198
- type: "json";
199
- name: string;
200
- id: string;
201
- instanceId: string;
202
- value?: unknown;
203
- required?: boolean | undefined;
204
- } | {
205
- value: string;
206
- type: "asset";
207
- name: string;
208
- id: string;
209
- instanceId: string;
210
- required?: boolean | undefined;
211
- } | {
212
- value: (string | {
213
- instanceId: string;
214
- pageId: string;
215
- }) & (string | {
216
- instanceId: string;
217
- pageId: string;
218
- } | undefined);
219
- type: "page";
220
- name: string;
221
- id: string;
222
- instanceId: string;
223
- required?: boolean | undefined;
224
- } | {
225
- value: string[];
226
- type: "string[]";
227
- name: string;
228
- id: string;
229
- instanceId: string;
230
- required?: boolean | undefined;
231
- } | {
232
- value: string;
233
- type: "parameter";
234
- name: string;
235
- id: string;
236
- instanceId: string;
237
- required?: boolean | undefined;
238
- } | {
239
- value: string;
240
- type: "expression";
241
- name: string;
242
- id: string;
243
- instanceId: string;
244
- required?: boolean | undefined;
245
- } | {
246
- value: {
247
- code: string;
248
- type: "execute";
249
- args: string[];
250
- }[];
251
- type: "action";
252
- name: string;
253
- id: string;
254
- instanceId: string;
255
- required?: boolean | undefined;
256
- }>;
257
- dataSources: Map<string, {
258
- value: {
259
- value: number;
260
- type: "number";
261
- } | {
262
- value: string;
263
- type: "string";
264
- } | {
265
- value: boolean;
266
- type: "boolean";
267
- } | {
268
- value: string[];
269
- type: "string[]";
270
- } | {
271
- type: "json";
272
- value?: unknown;
273
- };
274
- type: "variable";
275
- name: string;
276
- id: string;
277
- scopeInstanceId?: string | undefined;
278
- } | {
279
- type: "parameter";
280
- name: string;
281
- id: string;
282
- scopeInstanceId?: string | undefined;
283
- } | {
284
- type: "resource";
285
- name: string;
286
- id: string;
287
- resourceId: string;
288
- scopeInstanceId?: string | undefined;
289
- }>;
290
- usedDataSources: Map<string, {
291
- value: {
292
- value: number;
293
- type: "number";
294
- } | {
295
- value: string;
296
- type: "string";
297
- } | {
298
- value: boolean;
299
- type: "boolean";
300
- } | {
301
- value: string[];
302
- type: "string[]";
303
- } | {
304
- type: "json";
305
- value?: unknown;
306
- };
307
- type: "variable";
308
- name: string;
309
- id: string;
310
- scopeInstanceId?: string | undefined;
311
- } | {
312
- type: "parameter";
313
- name: string;
314
- id: string;
315
- scopeInstanceId?: string | undefined;
316
- } | {
317
- type: "resource";
318
- name: string;
319
- id: string;
320
- resourceId: string;
321
- scopeInstanceId?: string | undefined;
322
- }>;
16
+ instances: Instances;
17
+ props: Props;
18
+ dataSources: DataSources;
19
+ usedDataSources: DataSources;
323
20
  indexesWithinAncestors: IndexesWithinAncestors;
324
- classesMap?: Map<string, string[]> | undefined;
21
+ classesMap?: Map<string, Array<string>>;
325
22
  }) => string;
326
23
  export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources, indexesWithinAncestors, classesMap, }: {
327
24
  scope: Scope;
@@ -330,136 +27,9 @@ export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId,
330
27
  parameters: Extract<Prop, {
331
28
  type: "parameter";
332
29
  }>[];
333
- instances: Map<string, {
334
- type: "instance";
335
- id: string;
336
- children: ({
337
- value: string;
338
- type: "text";
339
- } | {
340
- value: string;
341
- type: "id";
342
- } | {
343
- value: string;
344
- type: "expression";
345
- })[];
346
- component: string;
347
- label?: string | undefined;
348
- }>;
349
- props: Map<string, {
350
- value: number;
351
- type: "number";
352
- name: string;
353
- id: string;
354
- instanceId: string;
355
- required?: boolean | undefined;
356
- } | {
357
- value: string;
358
- type: "string";
359
- name: string;
360
- id: string;
361
- instanceId: string;
362
- required?: boolean | undefined;
363
- } | {
364
- value: boolean;
365
- type: "boolean";
366
- name: string;
367
- id: string;
368
- instanceId: string;
369
- required?: boolean | undefined;
370
- } | {
371
- type: "json";
372
- name: string;
373
- id: string;
374
- instanceId: string;
375
- value?: unknown;
376
- required?: boolean | undefined;
377
- } | {
378
- value: string;
379
- type: "asset";
380
- name: string;
381
- id: string;
382
- instanceId: string;
383
- required?: boolean | undefined;
384
- } | {
385
- value: (string | {
386
- instanceId: string;
387
- pageId: string;
388
- }) & (string | {
389
- instanceId: string;
390
- pageId: string;
391
- } | undefined);
392
- type: "page";
393
- name: string;
394
- id: string;
395
- instanceId: string;
396
- required?: boolean | undefined;
397
- } | {
398
- value: string[];
399
- type: "string[]";
400
- name: string;
401
- id: string;
402
- instanceId: string;
403
- required?: boolean | undefined;
404
- } | {
405
- value: string;
406
- type: "parameter";
407
- name: string;
408
- id: string;
409
- instanceId: string;
410
- required?: boolean | undefined;
411
- } | {
412
- value: string;
413
- type: "expression";
414
- name: string;
415
- id: string;
416
- instanceId: string;
417
- required?: boolean | undefined;
418
- } | {
419
- value: {
420
- code: string;
421
- type: "execute";
422
- args: string[];
423
- }[];
424
- type: "action";
425
- name: string;
426
- id: string;
427
- instanceId: string;
428
- required?: boolean | undefined;
429
- }>;
430
- dataSources: Map<string, {
431
- value: {
432
- value: number;
433
- type: "number";
434
- } | {
435
- value: string;
436
- type: "string";
437
- } | {
438
- value: boolean;
439
- type: "boolean";
440
- } | {
441
- value: string[];
442
- type: "string[]";
443
- } | {
444
- type: "json";
445
- value?: unknown;
446
- };
447
- type: "variable";
448
- name: string;
449
- id: string;
450
- scopeInstanceId?: string | undefined;
451
- } | {
452
- type: "parameter";
453
- name: string;
454
- id: string;
455
- scopeInstanceId?: string | undefined;
456
- } | {
457
- type: "resource";
458
- name: string;
459
- id: string;
460
- resourceId: string;
461
- scopeInstanceId?: string | undefined;
462
- }>;
30
+ instances: Instances;
31
+ props: Props;
32
+ dataSources: DataSources;
463
33
  indexesWithinAncestors: IndexesWithinAncestors;
464
34
  classesMap: Map<string, Array<string>>;
465
35
  }) => string;
@@ -1,53 +1,6 @@
1
1
  import type { StyleSheetAtomic, StyleSheetRegular } from "@webstudio-is/css-engine";
2
2
  import type { Assets } from "@webstudio-is/sdk";
3
3
  export declare const addGlobalRules: (sheet: StyleSheetRegular | StyleSheetAtomic, { assets, assetBaseUrl }: {
4
- assets: Map<string, {
5
- type: "font";
6
- name: string;
7
- format: "ttf" | "woff" | "woff2" | "otf";
8
- meta: ({
9
- family: string;
10
- style: "normal" | "italic" | "oblique";
11
- weight: number;
12
- } | {
13
- family: string;
14
- variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
15
- name: string;
16
- min: number;
17
- default: number;
18
- max: number;
19
- }>>;
20
- }) & ({
21
- family: string;
22
- style: "normal" | "italic" | "oblique";
23
- weight: number;
24
- } | {
25
- family: string;
26
- variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
27
- name: string;
28
- min: number;
29
- default: number;
30
- max: number;
31
- }>>;
32
- } | undefined);
33
- id: string;
34
- projectId: string;
35
- size: number;
36
- description: string | null;
37
- createdAt: string;
38
- } | {
39
- type: "image";
40
- name: string;
41
- format: string;
42
- meta: {
43
- width: number;
44
- height: number;
45
- };
46
- id: string;
47
- projectId: string;
48
- size: number;
49
- description: string | null;
50
- createdAt: string;
51
- }>;
4
+ assets: Assets;
52
5
  assetBaseUrl: string;
53
6
  }) => void;
@@ -2,54 +2,7 @@ import { type Prop, type Assets, type Pages } from "@webstudio-is/sdk";
2
2
  export declare const normalizeProps: ({ props, assetBaseUrl, assets, pages, }: {
3
3
  props: Prop[];
4
4
  assetBaseUrl: string;
5
- assets: Map<string, {
6
- type: "font";
7
- name: string;
8
- format: "ttf" | "woff" | "woff2" | "otf";
9
- meta: ({
10
- family: string;
11
- style: "normal" | "italic" | "oblique";
12
- weight: number;
13
- } | {
14
- family: string;
15
- variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
16
- name: string;
17
- min: number;
18
- default: number;
19
- max: number;
20
- }>>;
21
- }) & ({
22
- family: string;
23
- style: "normal" | "italic" | "oblique";
24
- weight: number;
25
- } | {
26
- family: string;
27
- variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
28
- name: string;
29
- min: number;
30
- default: number;
31
- max: number;
32
- }>>;
33
- } | undefined);
34
- id: string;
35
- projectId: string;
36
- size: number;
37
- description: string | null;
38
- createdAt: string;
39
- } | {
40
- type: "image";
41
- name: string;
42
- format: string;
43
- meta: {
44
- width: number;
45
- height: number;
46
- };
47
- id: string;
48
- projectId: string;
49
- size: number;
50
- description: string | null;
51
- createdAt: string;
52
- }>;
5
+ assets: Assets;
53
6
  pages: Pages;
54
7
  }) => ({
55
8
  value: number;
@@ -10,44 +10,14 @@ export type WebstudioComponentProps = {
10
10
  components: Components;
11
11
  };
12
12
  export declare const createElementsTree: ({ renderer, assetBaseUrl, imageBaseUrl, imageLoader, instances, rootInstanceId, Component, components, }: Params & {
13
- instances: Map<string, {
14
- type: "instance";
15
- id: string;
16
- children: ({
17
- value: string;
18
- type: "text";
19
- } | {
20
- value: string;
21
- type: "id";
22
- } | {
23
- value: string;
24
- type: "expression";
25
- })[];
26
- component: string;
27
- label?: string | undefined;
28
- }>;
13
+ instances: Instances;
29
14
  imageLoader: ImageLoader;
30
15
  rootInstanceId: Instance["id"];
31
16
  Component: ForwardRefExoticComponent<WebstudioComponentProps & RefAttributes<HTMLElement>>;
32
17
  components: Components;
33
18
  }) => import("react/jsx-runtime").JSX.Element | null;
34
19
  export declare const createInstanceChildrenElements: ({ instances, instanceSelector, children, Component, components, }: {
35
- instances: Map<string, {
36
- type: "instance";
37
- id: string;
38
- children: ({
39
- value: string;
40
- type: "text";
41
- } | {
42
- value: string;
43
- type: "id";
44
- } | {
45
- value: string;
46
- type: "expression";
47
- })[];
48
- component: string;
49
- label?: string | undefined;
50
- }>;
20
+ instances: Instances;
51
21
  instanceSelector: InstanceSelector;
52
22
  children: Instance["children"];
53
23
  Component: ForwardRefExoticComponent<WebstudioComponentProps & RefAttributes<HTMLElement>>;
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.144.1-710b1d2.0",
3
+ "version": "0.145.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
7
7
  "type": "module",
8
8
  "devDependencies": {
9
9
  "@jest/globals": "^29.7.0",
10
- "@types/react": "^18.2.21",
11
- "@types/react-dom": "^18.2.7",
12
- "react": "^18.2.0",
13
- "react-dom": "^18.2.0",
10
+ "@types/react": "^18.2.70",
11
+ "@types/react-dom": "^18.2.25",
12
+ "react": "18.3.0-canary-14898b6a9-20240318",
13
+ "react-dom": "18.3.0-canary-14898b6a9-20240318",
14
14
  "strip-indent": "^4.0.0",
15
15
  "type-fest": "^4.3.1",
16
- "typescript": "5.2.2",
16
+ "typescript": "5.4.5",
17
17
  "zod": "^3.22.4",
18
- "@webstudio-is/jest-config": "1.0.8-710b1d2.0",
19
- "@webstudio-is/tsconfig": "1.0.8-710b1d2.0"
18
+ "@webstudio-is/jest-config": "1.0.7",
19
+ "@webstudio-is/tsconfig": "1.0.7"
20
20
  },
21
21
  "peerDependencies": {
22
- "react": "^18.2.0",
23
- "react-dom": "^18.2.0",
22
+ "react": "18.3.0-canary-14898b6a9-20240318",
23
+ "react-dom": "18.3.0-canary-14898b6a9-20240318",
24
24
  "zod": "^3.19.1"
25
25
  },
26
26
  "dependencies": {
@@ -28,11 +28,11 @@
28
28
  "html-tags": "^3.3.1",
29
29
  "nanoid": "^5.0.1",
30
30
  "title-case": "^4.1.0",
31
- "@webstudio-is/css-engine": "0.144.1-710b1d2.0",
32
- "@webstudio-is/icons": "^0.144.1-710b1d2.0",
33
- "@webstudio-is/fonts": "0.144.1-710b1d2.0",
34
- "@webstudio-is/image": "0.144.1-710b1d2.0",
35
- "@webstudio-is/sdk": "0.144.1-710b1d2.0"
31
+ "@webstudio-is/css-engine": "0.145.0",
32
+ "@webstudio-is/fonts": "0.145.0",
33
+ "@webstudio-is/icons": "^0.145.0",
34
+ "@webstudio-is/image": "0.145.0",
35
+ "@webstudio-is/sdk": "0.145.0"
36
36
  },
37
37
  "exports": {
38
38
  ".": {