@webstudio-is/sdk 0.173.0 → 0.175.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.
@@ -0,0 +1,522 @@
1
+ // src/__generated__/normalize.css.ts
2
+ var div = [
3
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
4
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
5
+ {
6
+ property: "borderRightWidth",
7
+ value: { type: "unit", unit: "px", value: 1 }
8
+ },
9
+ {
10
+ property: "borderBottomWidth",
11
+ value: { type: "unit", unit: "px", value: 1 }
12
+ },
13
+ {
14
+ property: "borderLeftWidth",
15
+ value: { type: "unit", unit: "px", value: 1 }
16
+ },
17
+ { property: "outlineWidth", value: { type: "unit", unit: "px", value: 1 } }
18
+ ];
19
+ var address = div;
20
+ var article = div;
21
+ var aside = div;
22
+ var figure = div;
23
+ var footer = div;
24
+ var header = div;
25
+ var main = div;
26
+ var nav = div;
27
+ var section = div;
28
+ var form = div;
29
+ var label = div;
30
+ var time = div;
31
+ var h1 = div;
32
+ var h2 = div;
33
+ var h3 = div;
34
+ var h4 = div;
35
+ var h5 = div;
36
+ var h6 = div;
37
+ var i = div;
38
+ var img = div;
39
+ var a = div;
40
+ var li = div;
41
+ var ul = div;
42
+ var ol = div;
43
+ var p = div;
44
+ var span = div;
45
+ var html = [
46
+ {
47
+ property: "lineHeight",
48
+ value: { type: "unit", unit: "number", value: 1.15 }
49
+ },
50
+ {
51
+ property: "textSizeAdjust",
52
+ value: { type: "unit", unit: "%", value: 100 }
53
+ },
54
+ { property: "tabSize", value: { type: "unit", unit: "number", value: 4 } },
55
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
56
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
57
+ {
58
+ property: "borderRightWidth",
59
+ value: { type: "unit", unit: "px", value: 1 }
60
+ },
61
+ {
62
+ property: "borderBottomWidth",
63
+ value: { type: "unit", unit: "px", value: 1 }
64
+ },
65
+ {
66
+ property: "borderLeftWidth",
67
+ value: { type: "unit", unit: "px", value: 1 }
68
+ }
69
+ ];
70
+ var body = [
71
+ { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
72
+ {
73
+ property: "marginRight",
74
+ value: { type: "unit", unit: "number", value: 0 }
75
+ },
76
+ {
77
+ property: "marginBottom",
78
+ value: { type: "unit", unit: "number", value: 0 }
79
+ },
80
+ { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
81
+ {
82
+ property: "fontFamily",
83
+ value: { type: "fontFamily", value: ["Arial", "Roboto", "sans-serif"] }
84
+ },
85
+ { property: "fontSize", value: { type: "unit", unit: "px", value: 16 } },
86
+ {
87
+ property: "lineHeight",
88
+ value: { type: "unit", unit: "number", value: 1.2 }
89
+ },
90
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
91
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
92
+ {
93
+ property: "borderRightWidth",
94
+ value: { type: "unit", unit: "px", value: 1 }
95
+ },
96
+ {
97
+ property: "borderBottomWidth",
98
+ value: { type: "unit", unit: "px", value: 1 }
99
+ },
100
+ {
101
+ property: "borderLeftWidth",
102
+ value: { type: "unit", unit: "px", value: 1 }
103
+ }
104
+ ];
105
+ var hr = [
106
+ { property: "height", value: { type: "unit", unit: "number", value: 0 } },
107
+ { property: "color", value: { type: "keyword", value: "inherit" } },
108
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
109
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
110
+ {
111
+ property: "borderRightWidth",
112
+ value: { type: "unit", unit: "px", value: 1 }
113
+ },
114
+ {
115
+ property: "borderBottomWidth",
116
+ value: { type: "unit", unit: "px", value: 1 }
117
+ },
118
+ {
119
+ property: "borderLeftWidth",
120
+ value: { type: "unit", unit: "px", value: 1 }
121
+ }
122
+ ];
123
+ var b = [
124
+ {
125
+ property: "fontWeight",
126
+ value: { type: "unit", unit: "number", value: 700 }
127
+ },
128
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
129
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
130
+ {
131
+ property: "borderRightWidth",
132
+ value: { type: "unit", unit: "px", value: 1 }
133
+ },
134
+ {
135
+ property: "borderBottomWidth",
136
+ value: { type: "unit", unit: "px", value: 1 }
137
+ },
138
+ {
139
+ property: "borderLeftWidth",
140
+ value: { type: "unit", unit: "px", value: 1 }
141
+ }
142
+ ];
143
+ var strong = b;
144
+ var code = [
145
+ {
146
+ property: "fontFamily",
147
+ value: {
148
+ type: "fontFamily",
149
+ value: [
150
+ "ui-monospace",
151
+ "SFMono-Regular",
152
+ "Consolas",
153
+ "Liberation Mono",
154
+ "Menlo",
155
+ "monospace"
156
+ ]
157
+ }
158
+ },
159
+ { property: "fontSize", value: { type: "unit", unit: "em", value: 1 } },
160
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
161
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
162
+ {
163
+ property: "borderRightWidth",
164
+ value: { type: "unit", unit: "px", value: 1 }
165
+ },
166
+ {
167
+ property: "borderBottomWidth",
168
+ value: { type: "unit", unit: "px", value: 1 }
169
+ },
170
+ {
171
+ property: "borderLeftWidth",
172
+ value: { type: "unit", unit: "px", value: 1 }
173
+ }
174
+ ];
175
+ var kbd = code;
176
+ var samp = code;
177
+ var pre = code;
178
+ var small = [
179
+ { property: "fontSize", value: { type: "unit", unit: "%", value: 80 } },
180
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
181
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
182
+ {
183
+ property: "borderRightWidth",
184
+ value: { type: "unit", unit: "px", value: 1 }
185
+ },
186
+ {
187
+ property: "borderBottomWidth",
188
+ value: { type: "unit", unit: "px", value: 1 }
189
+ },
190
+ {
191
+ property: "borderLeftWidth",
192
+ value: { type: "unit", unit: "px", value: 1 }
193
+ }
194
+ ];
195
+ var sub = [
196
+ { property: "fontSize", value: { type: "unit", unit: "%", value: 75 } },
197
+ { property: "lineHeight", value: { type: "unit", unit: "number", value: 0 } },
198
+ { property: "position", value: { type: "keyword", value: "relative" } },
199
+ { property: "verticalAlign", value: { type: "keyword", value: "baseline" } },
200
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
201
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
202
+ {
203
+ property: "borderRightWidth",
204
+ value: { type: "unit", unit: "px", value: 1 }
205
+ },
206
+ {
207
+ property: "borderBottomWidth",
208
+ value: { type: "unit", unit: "px", value: 1 }
209
+ },
210
+ {
211
+ property: "borderLeftWidth",
212
+ value: { type: "unit", unit: "px", value: 1 }
213
+ },
214
+ { property: "bottom", value: { type: "unit", unit: "em", value: -0.25 } }
215
+ ];
216
+ var sup = [
217
+ { property: "fontSize", value: { type: "unit", unit: "%", value: 75 } },
218
+ { property: "lineHeight", value: { type: "unit", unit: "number", value: 0 } },
219
+ { property: "position", value: { type: "keyword", value: "relative" } },
220
+ { property: "verticalAlign", value: { type: "keyword", value: "baseline" } },
221
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
222
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
223
+ {
224
+ property: "borderRightWidth",
225
+ value: { type: "unit", unit: "px", value: 1 }
226
+ },
227
+ {
228
+ property: "borderBottomWidth",
229
+ value: { type: "unit", unit: "px", value: 1 }
230
+ },
231
+ {
232
+ property: "borderLeftWidth",
233
+ value: { type: "unit", unit: "px", value: 1 }
234
+ },
235
+ { property: "top", value: { type: "unit", unit: "em", value: -0.5 } }
236
+ ];
237
+ var table = [
238
+ { property: "textIndent", value: { type: "unit", unit: "number", value: 0 } },
239
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
240
+ {
241
+ property: "borderRightWidth",
242
+ value: { type: "unit", unit: "px", value: 1 }
243
+ },
244
+ {
245
+ property: "borderBottomWidth",
246
+ value: { type: "unit", unit: "px", value: 1 }
247
+ },
248
+ {
249
+ property: "borderLeftWidth",
250
+ value: { type: "unit", unit: "px", value: 1 }
251
+ },
252
+ { property: "borderTopColor", value: { type: "keyword", value: "inherit" } },
253
+ {
254
+ property: "borderRightColor",
255
+ value: { type: "keyword", value: "inherit" }
256
+ },
257
+ {
258
+ property: "borderBottomColor",
259
+ value: { type: "keyword", value: "inherit" }
260
+ },
261
+ { property: "borderLeftColor", value: { type: "keyword", value: "inherit" } },
262
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } }
263
+ ];
264
+ var input = [
265
+ { property: "fontFamily", value: { type: "keyword", value: "inherit" } },
266
+ { property: "fontSize", value: { type: "unit", unit: "%", value: 100 } },
267
+ {
268
+ property: "lineHeight",
269
+ value: { type: "unit", unit: "number", value: 1.15 }
270
+ },
271
+ { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
272
+ {
273
+ property: "marginRight",
274
+ value: { type: "unit", unit: "number", value: 0 }
275
+ },
276
+ {
277
+ property: "marginBottom",
278
+ value: { type: "unit", unit: "number", value: 0 }
279
+ },
280
+ { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
281
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
282
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
283
+ {
284
+ property: "borderRightWidth",
285
+ value: { type: "unit", unit: "px", value: 1 }
286
+ },
287
+ {
288
+ property: "borderBottomWidth",
289
+ value: { type: "unit", unit: "px", value: 1 }
290
+ },
291
+ {
292
+ property: "borderLeftWidth",
293
+ value: { type: "unit", unit: "px", value: 1 }
294
+ },
295
+ { property: "borderTopStyle", value: { type: "keyword", value: "solid" } },
296
+ { property: "borderRightStyle", value: { type: "keyword", value: "solid" } },
297
+ { property: "borderBottomStyle", value: { type: "keyword", value: "solid" } },
298
+ { property: "borderLeftStyle", value: { type: "keyword", value: "solid" } }
299
+ ];
300
+ var textarea = input;
301
+ var optgroup = [
302
+ { property: "fontFamily", value: { type: "keyword", value: "inherit" } },
303
+ { property: "fontSize", value: { type: "unit", unit: "%", value: 100 } },
304
+ {
305
+ property: "lineHeight",
306
+ value: { type: "unit", unit: "number", value: 1.15 }
307
+ },
308
+ { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
309
+ {
310
+ property: "marginRight",
311
+ value: { type: "unit", unit: "number", value: 0 }
312
+ },
313
+ {
314
+ property: "marginBottom",
315
+ value: { type: "unit", unit: "number", value: 0 }
316
+ },
317
+ { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
318
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
319
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
320
+ {
321
+ property: "borderRightWidth",
322
+ value: { type: "unit", unit: "px", value: 1 }
323
+ },
324
+ {
325
+ property: "borderBottomWidth",
326
+ value: { type: "unit", unit: "px", value: 1 }
327
+ },
328
+ {
329
+ property: "borderLeftWidth",
330
+ value: { type: "unit", unit: "px", value: 1 }
331
+ }
332
+ ];
333
+ var radio = [
334
+ { property: "fontFamily", value: { type: "keyword", value: "inherit" } },
335
+ { property: "fontSize", value: { type: "unit", unit: "%", value: 100 } },
336
+ {
337
+ property: "lineHeight",
338
+ value: { type: "unit", unit: "number", value: 1.15 }
339
+ },
340
+ { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
341
+ {
342
+ property: "marginRight",
343
+ value: { type: "unit", unit: "number", value: 0 }
344
+ },
345
+ {
346
+ property: "marginBottom",
347
+ value: { type: "unit", unit: "number", value: 0 }
348
+ },
349
+ { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
350
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
351
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
352
+ {
353
+ property: "borderRightWidth",
354
+ value: { type: "unit", unit: "px", value: 1 }
355
+ },
356
+ {
357
+ property: "borderBottomWidth",
358
+ value: { type: "unit", unit: "px", value: 1 }
359
+ },
360
+ {
361
+ property: "borderLeftWidth",
362
+ value: { type: "unit", unit: "px", value: 1 }
363
+ },
364
+ { property: "borderTopStyle", value: { type: "keyword", value: "none" } },
365
+ { property: "borderRightStyle", value: { type: "keyword", value: "none" } },
366
+ { property: "borderBottomStyle", value: { type: "keyword", value: "none" } },
367
+ { property: "borderLeftStyle", value: { type: "keyword", value: "none" } }
368
+ ];
369
+ var checkbox = radio;
370
+ var button = [
371
+ { property: "fontFamily", value: { type: "keyword", value: "inherit" } },
372
+ { property: "fontSize", value: { type: "unit", unit: "%", value: 100 } },
373
+ {
374
+ property: "lineHeight",
375
+ value: { type: "unit", unit: "number", value: 1.15 }
376
+ },
377
+ { property: "marginTop", value: { type: "unit", unit: "number", value: 0 } },
378
+ {
379
+ property: "marginRight",
380
+ value: { type: "unit", unit: "number", value: 0 }
381
+ },
382
+ {
383
+ property: "marginBottom",
384
+ value: { type: "unit", unit: "number", value: 0 }
385
+ },
386
+ { property: "marginLeft", value: { type: "unit", unit: "number", value: 0 } },
387
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
388
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
389
+ {
390
+ property: "borderRightWidth",
391
+ value: { type: "unit", unit: "px", value: 1 }
392
+ },
393
+ {
394
+ property: "borderBottomWidth",
395
+ value: { type: "unit", unit: "px", value: 1 }
396
+ },
397
+ {
398
+ property: "borderLeftWidth",
399
+ value: { type: "unit", unit: "px", value: 1 }
400
+ },
401
+ { property: "borderTopStyle", value: { type: "keyword", value: "solid" } },
402
+ { property: "borderRightStyle", value: { type: "keyword", value: "solid" } },
403
+ { property: "borderBottomStyle", value: { type: "keyword", value: "solid" } },
404
+ { property: "borderLeftStyle", value: { type: "keyword", value: "solid" } },
405
+ { property: "textTransform", value: { type: "keyword", value: "none" } }
406
+ ];
407
+ var select = button;
408
+ var legend = [
409
+ { property: "paddingTop", value: { type: "unit", unit: "number", value: 0 } },
410
+ {
411
+ property: "paddingRight",
412
+ value: { type: "unit", unit: "number", value: 0 }
413
+ },
414
+ {
415
+ property: "paddingBottom",
416
+ value: { type: "unit", unit: "number", value: 0 }
417
+ },
418
+ {
419
+ property: "paddingLeft",
420
+ value: { type: "unit", unit: "number", value: 0 }
421
+ },
422
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
423
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
424
+ {
425
+ property: "borderRightWidth",
426
+ value: { type: "unit", unit: "px", value: 1 }
427
+ },
428
+ {
429
+ property: "borderBottomWidth",
430
+ value: { type: "unit", unit: "px", value: 1 }
431
+ },
432
+ {
433
+ property: "borderLeftWidth",
434
+ value: { type: "unit", unit: "px", value: 1 }
435
+ }
436
+ ];
437
+ var progress = [
438
+ { property: "verticalAlign", value: { type: "keyword", value: "baseline" } },
439
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
440
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
441
+ {
442
+ property: "borderRightWidth",
443
+ value: { type: "unit", unit: "px", value: 1 }
444
+ },
445
+ {
446
+ property: "borderBottomWidth",
447
+ value: { type: "unit", unit: "px", value: 1 }
448
+ },
449
+ {
450
+ property: "borderLeftWidth",
451
+ value: { type: "unit", unit: "px", value: 1 }
452
+ }
453
+ ];
454
+ var summary = [
455
+ { property: "display", value: { type: "keyword", value: "list-item" } },
456
+ { property: "boxSizing", value: { type: "keyword", value: "border-box" } },
457
+ { property: "borderTopWidth", value: { type: "unit", unit: "px", value: 1 } },
458
+ {
459
+ property: "borderRightWidth",
460
+ value: { type: "unit", unit: "px", value: 1 }
461
+ },
462
+ {
463
+ property: "borderBottomWidth",
464
+ value: { type: "unit", unit: "px", value: 1 }
465
+ },
466
+ {
467
+ property: "borderLeftWidth",
468
+ value: { type: "unit", unit: "px", value: 1 }
469
+ }
470
+ ];
471
+ export {
472
+ a,
473
+ address,
474
+ article,
475
+ aside,
476
+ b,
477
+ body,
478
+ button,
479
+ checkbox,
480
+ code,
481
+ div,
482
+ figure,
483
+ footer,
484
+ form,
485
+ h1,
486
+ h2,
487
+ h3,
488
+ h4,
489
+ h5,
490
+ h6,
491
+ header,
492
+ hr,
493
+ html,
494
+ i,
495
+ img,
496
+ input,
497
+ kbd,
498
+ label,
499
+ legend,
500
+ li,
501
+ main,
502
+ nav,
503
+ ol,
504
+ optgroup,
505
+ p,
506
+ pre,
507
+ progress,
508
+ radio,
509
+ samp,
510
+ section,
511
+ select,
512
+ small,
513
+ span,
514
+ strong,
515
+ sub,
516
+ summary,
517
+ sup,
518
+ table,
519
+ textarea,
520
+ time,
521
+ ul
522
+ };
package/lib/index.js CHANGED
@@ -416,10 +416,29 @@ var Styles = z10.map(z10.string(), StyleDecl);
416
416
 
417
417
  // src/schema/deployment.ts
418
418
  import { z as z11 } from "zod";
419
- var Deployment = z11.object({
420
- domains: z11.array(z11.string()),
421
- projectDomain: z11.string()
422
- });
419
+ var Templates = z11.enum([
420
+ "vanilla",
421
+ "vercel",
422
+ "netlify-functions",
423
+ "netlify-edge-functions",
424
+ "ssg",
425
+ "ssg-netlify",
426
+ "ssg-vercel"
427
+ ]);
428
+ var Deployment = z11.union([
429
+ z11.object({
430
+ destination: z11.literal("static"),
431
+ name: z11.string(),
432
+ assetsDomain: z11.string(),
433
+ // Must be validated very strictly
434
+ templates: z11.array(Templates)
435
+ }),
436
+ z11.object({
437
+ destination: z11.literal("saas").optional(),
438
+ domains: z11.array(z11.string()),
439
+ projectDomain: z11.string()
440
+ })
441
+ ]);
423
442
 
424
443
  // src/schema/webstudio.ts
425
444
  import { z as z12 } from "zod";
@@ -777,7 +796,7 @@ var matchPathnameParams = (pathname) => {
777
796
 
778
797
  // src/page-utils.ts
779
798
  var ROOT_FOLDER_ID = "root";
780
- var isRoot = (folder) => folder.id === ROOT_FOLDER_ID;
799
+ var isRootFolder = ({ id }) => id === ROOT_FOLDER_ID;
781
800
  var findPageByIdOrPath = (idOrPath, pages) => {
782
801
  if (idOrPath === "" || idOrPath === "/" || idOrPath === pages.homePage.id) {
783
802
  return pages.homePage;
@@ -844,24 +863,25 @@ var normalizeJsName = (name) => {
844
863
  return name;
845
864
  };
846
865
  var createScope = (occupiedIdentifiers = [], normalizeName = normalizeJsName, separator = "_") => {
847
- const freeIndexByPreferredName = /* @__PURE__ */ new Map();
848
- const scopedNameByIdMap = /* @__PURE__ */ new Map();
866
+ const nameById = /* @__PURE__ */ new Map();
867
+ const usedNames = /* @__PURE__ */ new Set();
849
868
  for (const identifier of occupiedIdentifiers) {
850
- freeIndexByPreferredName.set(identifier, 1);
869
+ usedNames.add(identifier);
851
870
  }
852
871
  const getName = (id, preferredName) => {
853
- const cachedName = scopedNameByIdMap.get(id);
872
+ const cachedName = nameById.get(id);
854
873
  if (cachedName !== void 0) {
855
874
  return cachedName;
856
875
  }
857
876
  preferredName = normalizeName(preferredName);
858
- const index = freeIndexByPreferredName.get(preferredName);
859
- freeIndexByPreferredName.set(preferredName, (index ?? 0) + 1);
877
+ let index = 0;
860
878
  let scopedName = preferredName;
861
- if (index !== void 0) {
879
+ while (usedNames.has(scopedName)) {
880
+ index += 1;
862
881
  scopedName = `${preferredName}${separator}${index}`;
863
882
  }
864
- scopedNameByIdMap.set(id, scopedName);
883
+ nameById.set(id, scopedName);
884
+ usedNames.add(scopedName);
865
885
  return scopedName;
866
886
  };
867
887
  return {
@@ -1060,7 +1080,7 @@ var replaceFormActionsWithResources = ({
1060
1080
  data.method = prop.value;
1061
1081
  props.delete(prop.id);
1062
1082
  }
1063
- if (prop.name === "action" && prop.type === "string" && instances.get(prop.instanceId)?.component === "Form") {
1083
+ if (prop.name === "action" && prop.type === "string" && prop.value && instances.get(prop.instanceId)?.component === "Form") {
1064
1084
  let data = formProps.get(prop.instanceId);
1065
1085
  if (data === void 0) {
1066
1086
  data = {};
@@ -1235,6 +1255,31 @@ var generatePageMeta = ({
1235
1255
  `;
1236
1256
  return generated;
1237
1257
  };
1258
+
1259
+ // src/form-fields.ts
1260
+ var formIdFieldName = `ws--form-id`;
1261
+ var formBotFieldName = `ws--form-bot`;
1262
+
1263
+ // src/to-string.ts
1264
+ var createJsonStringifyProxy = (target) => {
1265
+ return new Proxy(target, {
1266
+ get(target2, prop, receiver) {
1267
+ if (prop === "toString") {
1268
+ return function() {
1269
+ return JSON.stringify(target2);
1270
+ };
1271
+ }
1272
+ const value = Reflect.get(target2, prop, receiver);
1273
+ if (typeof value === "object" && value !== null) {
1274
+ return createJsonStringifyProxy(value);
1275
+ }
1276
+ return value;
1277
+ }
1278
+ });
1279
+ };
1280
+ var isPlainObject = (value) => {
1281
+ return Object.prototype.toString.call(value) === "[object Object]" && (Object.getPrototypeOf(value) === null || Object.getPrototypeOf(value) === Object.prototype);
1282
+ };
1238
1283
  export {
1239
1284
  Asset,
1240
1285
  Assets,
@@ -1274,8 +1319,10 @@ export {
1274
1319
  StyleSourceSelections,
1275
1320
  StyleSources,
1276
1321
  Styles,
1322
+ Templates,
1277
1323
  TextChild,
1278
1324
  WebstudioFragment,
1325
+ createJsonStringifyProxy,
1279
1326
  createScope,
1280
1327
  decodeDataSourceVariable,
1281
1328
  documentTypes,
@@ -1285,6 +1332,8 @@ export {
1285
1332
  findParentFolderByChildId,
1286
1333
  findTreeInstanceIds,
1287
1334
  findTreeInstanceIdsExcludingSlotDescendants,
1335
+ formBotFieldName,
1336
+ formIdFieldName,
1288
1337
  generateExpression,
1289
1338
  generateObjectExpression,
1290
1339
  generatePageMeta,
@@ -1297,7 +1346,8 @@ export {
1297
1346
  isLiteralExpression,
1298
1347
  isLocalResource,
1299
1348
  isPathnamePattern,
1300
- isRoot,
1349
+ isPlainObject,
1350
+ isRootFolder,
1301
1351
  lintExpression,
1302
1352
  loadResource,
1303
1353
  loadResources,
@@ -0,0 +1,57 @@
1
+ import type { StyleProperty, StyleValue } from "@webstudio-is/css-engine";
2
+ type StyleDecl = {
3
+ state?: string;
4
+ property: StyleProperty;
5
+ value: StyleValue;
6
+ };
7
+ export declare const div: StyleDecl[];
8
+ export declare const address: StyleDecl[];
9
+ export declare const article: StyleDecl[];
10
+ export declare const aside: StyleDecl[];
11
+ export declare const figure: StyleDecl[];
12
+ export declare const footer: StyleDecl[];
13
+ export declare const header: StyleDecl[];
14
+ export declare const main: StyleDecl[];
15
+ export declare const nav: StyleDecl[];
16
+ export declare const section: StyleDecl[];
17
+ export declare const form: StyleDecl[];
18
+ export declare const label: StyleDecl[];
19
+ export declare const time: StyleDecl[];
20
+ export declare const h1: StyleDecl[];
21
+ export declare const h2: StyleDecl[];
22
+ export declare const h3: StyleDecl[];
23
+ export declare const h4: StyleDecl[];
24
+ export declare const h5: StyleDecl[];
25
+ export declare const h6: StyleDecl[];
26
+ export declare const i: StyleDecl[];
27
+ export declare const img: StyleDecl[];
28
+ export declare const a: StyleDecl[];
29
+ export declare const li: StyleDecl[];
30
+ export declare const ul: StyleDecl[];
31
+ export declare const ol: StyleDecl[];
32
+ export declare const p: StyleDecl[];
33
+ export declare const span: StyleDecl[];
34
+ export declare const html: StyleDecl[];
35
+ export declare const body: StyleDecl[];
36
+ export declare const hr: StyleDecl[];
37
+ export declare const b: StyleDecl[];
38
+ export declare const strong: StyleDecl[];
39
+ export declare const code: StyleDecl[];
40
+ export declare const kbd: StyleDecl[];
41
+ export declare const samp: StyleDecl[];
42
+ export declare const pre: StyleDecl[];
43
+ export declare const small: StyleDecl[];
44
+ export declare const sub: StyleDecl[];
45
+ export declare const sup: StyleDecl[];
46
+ export declare const table: StyleDecl[];
47
+ export declare const input: StyleDecl[];
48
+ export declare const textarea: StyleDecl[];
49
+ export declare const optgroup: StyleDecl[];
50
+ export declare const radio: StyleDecl[];
51
+ export declare const checkbox: StyleDecl[];
52
+ export declare const button: StyleDecl[];
53
+ export declare const select: StyleDecl[];
54
+ export declare const legend: StyleDecl[];
55
+ export declare const progress: StyleDecl[];
56
+ export declare const summary: StyleDecl[];
57
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Used to identify form inside server handler
3
+ */
4
+ export declare const formIdFieldName = "ws--form-id";
5
+ /**
6
+ * Used for simlpe protection against non js bots
7
+ */
8
+ export declare const formBotFieldName = "ws--form-bot";
@@ -18,3 +18,5 @@ export * from "./expression";
18
18
  export * from "./resources-generator";
19
19
  export * from "./page-meta-generator";
20
20
  export * from "./url-pattern";
21
+ export * from "./form-fields";
22
+ export * from "./to-string";
@@ -3,7 +3,9 @@ export declare const ROOT_FOLDER_ID = "root";
3
3
  /**
4
4
  * Returns true if folder is the root folder.
5
5
  */
6
- export declare const isRoot: (folder: Folder) => boolean;
6
+ export declare const isRootFolder: ({ id }: {
7
+ id: Folder["id"];
8
+ }) => boolean;
7
9
  /**
8
10
  * Find a page by id or path.
9
11
  */
@@ -1,12 +1,32 @@
1
1
  import { z } from "zod";
2
- export declare const Deployment: z.ZodObject<{
2
+ export declare const Templates: z.ZodEnum<["vanilla", "vercel", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>;
3
+ export type Templates = z.infer<typeof Templates>;
4
+ export declare const Deployment: z.ZodUnion<[z.ZodObject<{
5
+ destination: z.ZodLiteral<"static">;
6
+ name: z.ZodString;
7
+ assetsDomain: z.ZodString;
8
+ templates: z.ZodArray<z.ZodEnum<["vanilla", "vercel", "netlify-functions", "netlify-edge-functions", "ssg", "ssg-netlify", "ssg-vercel"]>, "many">;
9
+ }, "strip", z.ZodTypeAny, {
10
+ name: string;
11
+ destination: "static";
12
+ assetsDomain: string;
13
+ templates: ("vanilla" | "vercel" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
14
+ }, {
15
+ name: string;
16
+ destination: "static";
17
+ assetsDomain: string;
18
+ templates: ("vanilla" | "vercel" | "netlify-functions" | "netlify-edge-functions" | "ssg" | "ssg-netlify" | "ssg-vercel")[];
19
+ }>, z.ZodObject<{
20
+ destination: z.ZodOptional<z.ZodLiteral<"saas">>;
3
21
  domains: z.ZodArray<z.ZodString, "many">;
4
22
  projectDomain: z.ZodString;
5
23
  }, "strip", z.ZodTypeAny, {
6
24
  domains: string[];
7
25
  projectDomain: string;
26
+ destination?: "saas" | undefined;
8
27
  }, {
9
28
  domains: string[];
10
29
  projectDomain: string;
11
- }>;
30
+ destination?: "saas" | undefined;
31
+ }>]>;
12
32
  export type Deployment = z.infer<typeof Deployment>;
@@ -0,0 +1,2 @@
1
+ export declare const createJsonStringifyProxy: <T extends object>(target: T) => T;
2
+ export declare const isPlainObject: (value: unknown) => value is object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/sdk",
3
- "version": "0.173.0",
3
+ "version": "0.175.0",
4
4
  "description": "Webstudio project data schema",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -12,6 +12,11 @@
12
12
  "types": "./lib/types/index.d.ts",
13
13
  "import": "./lib/index.js"
14
14
  },
15
+ "./normalize.css": {
16
+ "webstudio": "./src/__generated__/normalize.css.ts",
17
+ "types": "./lib/types/__generated__/normalize.css.d.ts",
18
+ "import": "./lib/__generated__/normalize.css.js"
19
+ },
15
20
  "./testing": {
16
21
  "webstudio": "./src/testing.ts"
17
22
  }
@@ -24,21 +29,24 @@
24
29
  "dependencies": {
25
30
  "acorn": "^8.11.3",
26
31
  "acorn-walk": "^8.3.2",
27
- "type-fest": "^4.3.1",
32
+ "type-fest": "^4.24.0",
28
33
  "zod": "^3.22.4",
29
- "@webstudio-is/fonts": "0.173.0",
30
- "@webstudio-is/css-engine": "0.173.0"
34
+ "@webstudio-is/css-engine": "0.175.0",
35
+ "@webstudio-is/fonts": "0.175.0"
31
36
  },
32
37
  "devDependencies": {
33
38
  "@jest/globals": "^29.7.0",
39
+ "html-tags": "^4.0.0",
34
40
  "strip-indent": "^4.0.0",
41
+ "@webstudio-is/css-data": "0.0.0",
35
42
  "@webstudio-is/tsconfig": "1.0.7",
36
43
  "@webstudio-is/jest-config": "1.0.7"
37
44
  },
38
45
  "scripts": {
39
46
  "typecheck": "tsc",
40
47
  "test": "NODE_OPTIONS=--experimental-vm-modules jest",
41
- "build": "rm -rf lib && esbuild src/index.ts --outdir=lib --bundle --format=esm --packages=external",
48
+ "build:normalize.css": "tsx --conditions=webstudio ./scripts/normalize.css.ts && prettier --write src/__generated__/normalize.css.ts",
49
+ "build": "rm -rf lib && esbuild src/index.ts src/__generated__/normalize.css.ts --outdir=lib --bundle --format=esm --packages=external",
42
50
  "dts": "tsc --project tsconfig.dts.json"
43
51
  }
44
52
  }