@webstudio-is/sdk 0.0.0-588fe22 → 0.0.0-a5970cb
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.
- package/lib/__generated__/normalize.css.js +245 -158
- package/lib/core-templates.js +963 -59
- package/lib/index.js +1497 -424
- package/lib/runtime.js +17 -1
- package/lib/types/__generated__/normalize.css.d.ts +2 -2
- package/lib/types/__generated__/tags.d.ts +1 -0
- package/lib/types/core-metas.d.ts +5 -733
- package/lib/types/core-templates.d.ts +1 -0
- package/lib/types/css.d.ts +31 -0
- package/lib/types/css.test.d.ts +1 -0
- package/lib/types/expression.d.ts +7 -5
- package/lib/types/index.d.ts +4 -1
- package/lib/types/instances-utils.d.ts +3 -0
- package/lib/types/runtime.d.ts +5 -0
- package/lib/types/schema/animation-schema.d.ts +53844 -0
- package/lib/types/schema/assets.d.ts +12 -84
- package/lib/types/schema/breakpoints.d.ts +8 -8
- package/lib/types/schema/component-meta.d.ts +11403 -1259
- package/lib/types/schema/data-sources.d.ts +18 -18
- package/lib/types/schema/deployment.d.ts +4 -4
- package/lib/types/schema/instances.d.ts +14 -217
- package/lib/types/schema/pages.d.ts +147 -146
- package/lib/types/schema/prop-meta.d.ts +105 -39
- package/lib/types/schema/props.d.ts +36858 -20
- package/lib/types/schema/resources.d.ts +4 -4
- package/lib/types/schema/styles.d.ts +4903 -1239
- package/lib/types/schema/webstudio.d.ts +22954 -594
- package/package.json +11 -10
- package/lib/types/schema/embed-template.d.ts +0 -2250
package/lib/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/schema/assets.ts
|
|
2
8
|
import { z } from "zod";
|
|
3
9
|
import { FontFormat, FontMeta } from "@webstudio-is/fonts";
|
|
@@ -57,7 +63,7 @@ var commonPageFields = {
|
|
|
57
63
|
title: PageTitle,
|
|
58
64
|
history: z2.optional(z2.array(z2.string())),
|
|
59
65
|
rootInstanceId: z2.string(),
|
|
60
|
-
systemDataSourceId: z2.string(),
|
|
66
|
+
systemDataSourceId: z2.string().optional(),
|
|
61
67
|
meta: z2.object({
|
|
62
68
|
description: z2.string().optional(),
|
|
63
69
|
title: z2.string().optional(),
|
|
@@ -88,7 +94,7 @@ var HomePage = z2.object({
|
|
|
88
94
|
...commonPageFields,
|
|
89
95
|
path: HomePagePath
|
|
90
96
|
});
|
|
91
|
-
var
|
|
97
|
+
var DefaultPagePage = z2.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine((path) => path.endsWith("/") === false, "Can't end with a /").refine((path) => path.includes("//") === false, "Can't contain repeating /").refine(
|
|
92
98
|
(path) => /^[-_a-z0-9*:?\\/.]*$/.test(path),
|
|
93
99
|
"Only a-z, 0-9, -, _, /, :, ?, . and * are allowed"
|
|
94
100
|
).refine(
|
|
@@ -101,6 +107,14 @@ var PagePath = z2.string().refine((path) => path !== "", "Can't be empty").refin
|
|
|
101
107
|
(path) => path !== "/build" && path.startsWith("/build/") === false,
|
|
102
108
|
"/build prefix is reserved for the system"
|
|
103
109
|
);
|
|
110
|
+
var PagePath = DefaultPagePage.refine(
|
|
111
|
+
(path) => path === "" || path.startsWith("/"),
|
|
112
|
+
"Must start with a / or a full URL e.g. https://website.org"
|
|
113
|
+
);
|
|
114
|
+
var OldPagePath = DefaultPagePage.refine(
|
|
115
|
+
(path) => path === "" || path.startsWith("/"),
|
|
116
|
+
"Must start with a / and it must be full path e.g. /project/id"
|
|
117
|
+
);
|
|
104
118
|
var Page = z2.object({
|
|
105
119
|
...commonPageFields,
|
|
106
120
|
path: PagePath
|
|
@@ -164,29 +178,11 @@ var Instance = z3.object({
|
|
|
164
178
|
type: z3.literal("instance"),
|
|
165
179
|
id: InstanceId,
|
|
166
180
|
component: z3.string(),
|
|
181
|
+
tag: z3.string().optional(),
|
|
167
182
|
label: z3.string().optional(),
|
|
168
183
|
children: z3.array(InstanceChild)
|
|
169
184
|
});
|
|
170
185
|
var Instances = z3.map(InstanceId, Instance);
|
|
171
|
-
var MatcherRelation = z3.union([
|
|
172
|
-
z3.literal("ancestor"),
|
|
173
|
-
z3.literal("parent"),
|
|
174
|
-
z3.literal("self"),
|
|
175
|
-
z3.literal("child"),
|
|
176
|
-
z3.literal("descendant")
|
|
177
|
-
]);
|
|
178
|
-
var MatcherOperation = z3.object({
|
|
179
|
-
$eq: z3.string().optional(),
|
|
180
|
-
$neq: z3.string().optional(),
|
|
181
|
-
$in: z3.array(z3.string()).optional(),
|
|
182
|
-
$nin: z3.array(z3.string()).optional()
|
|
183
|
-
});
|
|
184
|
-
var Matcher = z3.object({
|
|
185
|
-
relation: MatcherRelation,
|
|
186
|
-
component: MatcherOperation.optional(),
|
|
187
|
-
tag: MatcherOperation.optional()
|
|
188
|
-
});
|
|
189
|
-
var Matchers = z3.union([Matcher, z3.array(Matcher)]);
|
|
190
186
|
|
|
191
187
|
// src/schema/data-sources.ts
|
|
192
188
|
import { z as z4 } from "zod";
|
|
@@ -218,20 +214,25 @@ var DataSource = z4.union([
|
|
|
218
214
|
z4.object({
|
|
219
215
|
type: z4.literal("variable"),
|
|
220
216
|
id: DataSourceId,
|
|
221
|
-
|
|
217
|
+
// The instance should always be specified for variables,
|
|
218
|
+
// however, there was a bug in the embed template
|
|
219
|
+
// which produced variables without an instance
|
|
220
|
+
// and these variables will fail validation
|
|
221
|
+
// if we make it required
|
|
222
|
+
scopeInstanceId: z4.string().optional(),
|
|
222
223
|
name: z4.string(),
|
|
223
224
|
value: DataSourceVariableValue
|
|
224
225
|
}),
|
|
225
226
|
z4.object({
|
|
226
227
|
type: z4.literal("parameter"),
|
|
227
228
|
id: DataSourceId,
|
|
228
|
-
scopeInstanceId: z4.string(),
|
|
229
|
+
scopeInstanceId: z4.string().optional(),
|
|
229
230
|
name: z4.string()
|
|
230
231
|
}),
|
|
231
232
|
z4.object({
|
|
232
233
|
type: z4.literal("resource"),
|
|
233
234
|
id: DataSourceId,
|
|
234
|
-
scopeInstanceId: z4.string(),
|
|
235
|
+
scopeInstanceId: z4.string().optional(),
|
|
235
236
|
name: z4.string(),
|
|
236
237
|
resourceId: z4.string()
|
|
237
238
|
})
|
|
@@ -274,98 +275,280 @@ var ResourceRequest = z5.object({
|
|
|
274
275
|
var Resources = z5.map(ResourceId, Resource);
|
|
275
276
|
|
|
276
277
|
// src/schema/props.ts
|
|
278
|
+
import { z as z7 } from "zod";
|
|
279
|
+
|
|
280
|
+
// src/schema/animation-schema.ts
|
|
281
|
+
import { StyleValue } from "@webstudio-is/css-engine";
|
|
277
282
|
import { z as z6 } from "zod";
|
|
278
|
-
var
|
|
283
|
+
var literalUnion = (arr) => z6.union(
|
|
284
|
+
arr.map((val) => z6.literal(val))
|
|
285
|
+
);
|
|
286
|
+
var RANGE_UNITS = [
|
|
287
|
+
"%",
|
|
288
|
+
"px",
|
|
289
|
+
"cm",
|
|
290
|
+
"mm",
|
|
291
|
+
"q",
|
|
292
|
+
"in",
|
|
293
|
+
"pt",
|
|
294
|
+
"pc",
|
|
295
|
+
"em",
|
|
296
|
+
"rem",
|
|
297
|
+
"ex",
|
|
298
|
+
"rex",
|
|
299
|
+
"cap",
|
|
300
|
+
"rcap",
|
|
301
|
+
"ch",
|
|
302
|
+
"rch",
|
|
303
|
+
"lh",
|
|
304
|
+
"rlh",
|
|
305
|
+
"vw",
|
|
306
|
+
"svw",
|
|
307
|
+
"lvw",
|
|
308
|
+
"dvw",
|
|
309
|
+
"vh",
|
|
310
|
+
"svh",
|
|
311
|
+
"lvh",
|
|
312
|
+
"dvh",
|
|
313
|
+
"vi",
|
|
314
|
+
"svi",
|
|
315
|
+
"lvi",
|
|
316
|
+
"dvi",
|
|
317
|
+
"vb",
|
|
318
|
+
"svb",
|
|
319
|
+
"lvb",
|
|
320
|
+
"dvb",
|
|
321
|
+
"vmin",
|
|
322
|
+
"svmin",
|
|
323
|
+
"lvmin",
|
|
324
|
+
"dvmin",
|
|
325
|
+
"vmax",
|
|
326
|
+
"svmax",
|
|
327
|
+
"lvmax",
|
|
328
|
+
"dvmax"
|
|
329
|
+
];
|
|
330
|
+
var rangeUnitSchema = literalUnion(RANGE_UNITS);
|
|
331
|
+
var rangeUnitValueSchema = z6.union([
|
|
332
|
+
z6.object({
|
|
333
|
+
type: z6.literal("unit"),
|
|
334
|
+
value: z6.number(),
|
|
335
|
+
unit: rangeUnitSchema
|
|
336
|
+
}),
|
|
337
|
+
z6.object({
|
|
338
|
+
type: z6.literal("unparsed"),
|
|
339
|
+
value: z6.string()
|
|
340
|
+
}),
|
|
341
|
+
z6.object({
|
|
342
|
+
type: z6.literal("var"),
|
|
343
|
+
value: z6.string()
|
|
344
|
+
})
|
|
345
|
+
]);
|
|
346
|
+
var TIME_UNITS = ["ms", "s"];
|
|
347
|
+
var timeUnitSchema = literalUnion(TIME_UNITS);
|
|
348
|
+
var durationUnitValueSchema = z6.union([
|
|
349
|
+
z6.object({
|
|
350
|
+
type: z6.literal("unit"),
|
|
351
|
+
value: z6.number(),
|
|
352
|
+
unit: timeUnitSchema
|
|
353
|
+
}),
|
|
354
|
+
z6.object({
|
|
355
|
+
type: z6.literal("var"),
|
|
356
|
+
value: z6.string()
|
|
357
|
+
})
|
|
358
|
+
]);
|
|
359
|
+
var insetUnitValueSchema = z6.union([
|
|
360
|
+
rangeUnitValueSchema,
|
|
361
|
+
z6.object({
|
|
362
|
+
type: z6.literal("keyword"),
|
|
363
|
+
value: z6.literal("auto")
|
|
364
|
+
})
|
|
365
|
+
]);
|
|
366
|
+
var keyframeStylesSchema = z6.record(StyleValue);
|
|
367
|
+
var animationKeyframeSchema = z6.object({
|
|
368
|
+
offset: z6.number().optional(),
|
|
369
|
+
styles: keyframeStylesSchema
|
|
370
|
+
});
|
|
371
|
+
var keyframeEffectOptionsSchema = z6.object({
|
|
372
|
+
easing: z6.string().optional(),
|
|
373
|
+
fill: z6.union([
|
|
374
|
+
z6.literal("none"),
|
|
375
|
+
z6.literal("forwards"),
|
|
376
|
+
z6.literal("backwards"),
|
|
377
|
+
z6.literal("both")
|
|
378
|
+
]).optional(),
|
|
379
|
+
// FillMode
|
|
380
|
+
duration: durationUnitValueSchema.optional()
|
|
381
|
+
});
|
|
382
|
+
var scrollNamedRangeSchema = z6.union([
|
|
383
|
+
z6.literal("start"),
|
|
384
|
+
z6.literal("end")
|
|
385
|
+
]);
|
|
386
|
+
var scrollRangeValueSchema = z6.tuple([
|
|
387
|
+
scrollNamedRangeSchema,
|
|
388
|
+
rangeUnitValueSchema
|
|
389
|
+
]);
|
|
390
|
+
var scrollRangeOptionsSchema = z6.object({
|
|
391
|
+
rangeStart: scrollRangeValueSchema.optional(),
|
|
392
|
+
rangeEnd: scrollRangeValueSchema.optional()
|
|
393
|
+
});
|
|
394
|
+
var animationAxisSchema = z6.union([
|
|
395
|
+
z6.literal("block"),
|
|
396
|
+
z6.literal("inline"),
|
|
397
|
+
z6.literal("x"),
|
|
398
|
+
z6.literal("y")
|
|
399
|
+
]);
|
|
400
|
+
var viewNamedRangeSchema = z6.union([
|
|
401
|
+
z6.literal("contain"),
|
|
402
|
+
z6.literal("cover"),
|
|
403
|
+
z6.literal("entry"),
|
|
404
|
+
z6.literal("exit"),
|
|
405
|
+
z6.literal("entry-crossing"),
|
|
406
|
+
z6.literal("exit-crossing")
|
|
407
|
+
]);
|
|
408
|
+
var viewRangeValueSchema = z6.tuple([
|
|
409
|
+
viewNamedRangeSchema,
|
|
410
|
+
rangeUnitValueSchema
|
|
411
|
+
]);
|
|
412
|
+
var viewRangeOptionsSchema = z6.object({
|
|
413
|
+
rangeStart: viewRangeValueSchema.optional(),
|
|
414
|
+
rangeEnd: viewRangeValueSchema.optional()
|
|
415
|
+
});
|
|
416
|
+
var baseAnimation = z6.object({
|
|
417
|
+
name: z6.string().optional(),
|
|
418
|
+
description: z6.string().optional(),
|
|
419
|
+
enabled: z6.array(z6.tuple([z6.string().describe("breakpointId"), z6.boolean()])).optional(),
|
|
420
|
+
keyframes: z6.array(animationKeyframeSchema)
|
|
421
|
+
});
|
|
422
|
+
var scrollAnimationSchema = baseAnimation.merge(
|
|
423
|
+
z6.object({
|
|
424
|
+
timing: keyframeEffectOptionsSchema.merge(scrollRangeOptionsSchema)
|
|
425
|
+
})
|
|
426
|
+
);
|
|
427
|
+
var scrollActionSchema = z6.object({
|
|
428
|
+
type: z6.literal("scroll"),
|
|
429
|
+
source: z6.union([z6.literal("closest"), z6.literal("nearest"), z6.literal("root")]).optional(),
|
|
430
|
+
axis: animationAxisSchema.optional(),
|
|
431
|
+
animations: z6.array(scrollAnimationSchema),
|
|
432
|
+
isPinned: z6.boolean().optional(),
|
|
433
|
+
debug: z6.boolean().optional()
|
|
434
|
+
});
|
|
435
|
+
var viewAnimationSchema = baseAnimation.merge(
|
|
436
|
+
z6.object({
|
|
437
|
+
timing: keyframeEffectOptionsSchema.merge(viewRangeOptionsSchema)
|
|
438
|
+
})
|
|
439
|
+
);
|
|
440
|
+
var viewActionSchema = z6.object({
|
|
441
|
+
type: z6.literal("view"),
|
|
442
|
+
subject: z6.string().optional(),
|
|
443
|
+
axis: animationAxisSchema.optional(),
|
|
444
|
+
animations: z6.array(viewAnimationSchema),
|
|
445
|
+
insetStart: insetUnitValueSchema.optional(),
|
|
446
|
+
insetEnd: insetUnitValueSchema.optional(),
|
|
447
|
+
isPinned: z6.boolean().optional(),
|
|
448
|
+
debug: z6.boolean().optional()
|
|
449
|
+
});
|
|
450
|
+
var animationActionSchema = z6.discriminatedUnion("type", [
|
|
451
|
+
scrollActionSchema,
|
|
452
|
+
viewActionSchema
|
|
453
|
+
]);
|
|
454
|
+
|
|
455
|
+
// src/schema/props.ts
|
|
456
|
+
var PropId = z7.string();
|
|
279
457
|
var baseProp = {
|
|
280
458
|
id: PropId,
|
|
281
|
-
instanceId:
|
|
282
|
-
name:
|
|
283
|
-
required:
|
|
459
|
+
instanceId: z7.string(),
|
|
460
|
+
name: z7.string(),
|
|
461
|
+
required: z7.optional(z7.boolean())
|
|
284
462
|
};
|
|
285
|
-
var Prop =
|
|
286
|
-
|
|
463
|
+
var Prop = z7.union([
|
|
464
|
+
z7.object({
|
|
287
465
|
...baseProp,
|
|
288
|
-
type:
|
|
289
|
-
value:
|
|
466
|
+
type: z7.literal("number"),
|
|
467
|
+
value: z7.number()
|
|
290
468
|
}),
|
|
291
|
-
|
|
469
|
+
z7.object({
|
|
292
470
|
...baseProp,
|
|
293
|
-
type:
|
|
294
|
-
value:
|
|
471
|
+
type: z7.literal("string"),
|
|
472
|
+
value: z7.string()
|
|
295
473
|
}),
|
|
296
|
-
|
|
474
|
+
z7.object({
|
|
297
475
|
...baseProp,
|
|
298
|
-
type:
|
|
299
|
-
value:
|
|
476
|
+
type: z7.literal("boolean"),
|
|
477
|
+
value: z7.boolean()
|
|
300
478
|
}),
|
|
301
|
-
|
|
479
|
+
z7.object({
|
|
302
480
|
...baseProp,
|
|
303
|
-
type:
|
|
304
|
-
value:
|
|
481
|
+
type: z7.literal("json"),
|
|
482
|
+
value: z7.unknown()
|
|
305
483
|
}),
|
|
306
|
-
|
|
484
|
+
z7.object({
|
|
307
485
|
...baseProp,
|
|
308
|
-
type:
|
|
309
|
-
value:
|
|
486
|
+
type: z7.literal("asset"),
|
|
487
|
+
value: z7.string()
|
|
310
488
|
// asset id
|
|
311
489
|
}),
|
|
312
|
-
|
|
490
|
+
z7.object({
|
|
313
491
|
...baseProp,
|
|
314
|
-
type:
|
|
315
|
-
value:
|
|
316
|
-
|
|
492
|
+
type: z7.literal("page"),
|
|
493
|
+
value: z7.union([
|
|
494
|
+
z7.string(),
|
|
317
495
|
// page id
|
|
318
|
-
|
|
319
|
-
pageId:
|
|
320
|
-
instanceId:
|
|
496
|
+
z7.object({
|
|
497
|
+
pageId: z7.string(),
|
|
498
|
+
instanceId: z7.string()
|
|
321
499
|
})
|
|
322
500
|
])
|
|
323
501
|
}),
|
|
324
|
-
|
|
502
|
+
z7.object({
|
|
325
503
|
...baseProp,
|
|
326
|
-
type:
|
|
327
|
-
value:
|
|
504
|
+
type: z7.literal("string[]"),
|
|
505
|
+
value: z7.array(z7.string())
|
|
328
506
|
}),
|
|
329
|
-
|
|
507
|
+
z7.object({
|
|
330
508
|
...baseProp,
|
|
331
|
-
type:
|
|
509
|
+
type: z7.literal("parameter"),
|
|
332
510
|
// data source id
|
|
333
|
-
value:
|
|
511
|
+
value: z7.string()
|
|
334
512
|
}),
|
|
335
|
-
|
|
513
|
+
z7.object({
|
|
336
514
|
...baseProp,
|
|
337
|
-
type:
|
|
515
|
+
type: z7.literal("resource"),
|
|
338
516
|
// resource id
|
|
339
|
-
value:
|
|
517
|
+
value: z7.string()
|
|
340
518
|
}),
|
|
341
|
-
|
|
519
|
+
z7.object({
|
|
342
520
|
...baseProp,
|
|
343
|
-
type:
|
|
521
|
+
type: z7.literal("expression"),
|
|
344
522
|
// expression code
|
|
345
|
-
value:
|
|
523
|
+
value: z7.string()
|
|
346
524
|
}),
|
|
347
|
-
|
|
525
|
+
z7.object({
|
|
348
526
|
...baseProp,
|
|
349
|
-
type:
|
|
350
|
-
value:
|
|
351
|
-
|
|
352
|
-
type:
|
|
353
|
-
args:
|
|
354
|
-
code:
|
|
527
|
+
type: z7.literal("action"),
|
|
528
|
+
value: z7.array(
|
|
529
|
+
z7.object({
|
|
530
|
+
type: z7.literal("execute"),
|
|
531
|
+
args: z7.array(z7.string()),
|
|
532
|
+
code: z7.string()
|
|
355
533
|
})
|
|
356
534
|
)
|
|
535
|
+
}),
|
|
536
|
+
z7.object({
|
|
537
|
+
...baseProp,
|
|
538
|
+
type: z7.literal("animationAction"),
|
|
539
|
+
value: animationActionSchema
|
|
357
540
|
})
|
|
358
541
|
]);
|
|
359
|
-
var Props =
|
|
542
|
+
var Props = z7.map(PropId, Prop);
|
|
360
543
|
|
|
361
544
|
// src/schema/breakpoints.ts
|
|
362
|
-
import { z as
|
|
363
|
-
var BreakpointId =
|
|
364
|
-
var Breakpoint =
|
|
545
|
+
import { z as z8 } from "zod";
|
|
546
|
+
var BreakpointId = z8.string();
|
|
547
|
+
var Breakpoint = z8.object({
|
|
365
548
|
id: BreakpointId,
|
|
366
|
-
label:
|
|
367
|
-
minWidth:
|
|
368
|
-
maxWidth:
|
|
549
|
+
label: z8.string(),
|
|
550
|
+
minWidth: z8.number().optional(),
|
|
551
|
+
maxWidth: z8.number().optional()
|
|
369
552
|
}).refine(({ minWidth, maxWidth }) => {
|
|
370
553
|
return (
|
|
371
554
|
// Either min or max width have to be defined
|
|
@@ -373,7 +556,7 @@ var Breakpoint = z7.object({
|
|
|
373
556
|
minWidth === void 0 && maxWidth === void 0
|
|
374
557
|
);
|
|
375
558
|
}, "Either minWidth or maxWidth should be defined");
|
|
376
|
-
var Breakpoints =
|
|
559
|
+
var Breakpoints = z8.map(BreakpointId, Breakpoint);
|
|
377
560
|
var initialBreakpoints = [
|
|
378
561
|
{ id: "placeholder", label: "Base" },
|
|
379
562
|
{ id: "placeholder", label: "Tablet", maxWidth: 991 },
|
|
@@ -382,236 +565,255 @@ var initialBreakpoints = [
|
|
|
382
565
|
];
|
|
383
566
|
|
|
384
567
|
// src/schema/style-sources.ts
|
|
385
|
-
import { z as
|
|
386
|
-
var StyleSourceId =
|
|
387
|
-
var StyleSourceToken =
|
|
388
|
-
type:
|
|
568
|
+
import { z as z9 } from "zod";
|
|
569
|
+
var StyleSourceId = z9.string();
|
|
570
|
+
var StyleSourceToken = z9.object({
|
|
571
|
+
type: z9.literal("token"),
|
|
389
572
|
id: StyleSourceId,
|
|
390
|
-
name:
|
|
573
|
+
name: z9.string()
|
|
391
574
|
});
|
|
392
|
-
var StyleSourceLocal =
|
|
393
|
-
type:
|
|
575
|
+
var StyleSourceLocal = z9.object({
|
|
576
|
+
type: z9.literal("local"),
|
|
394
577
|
id: StyleSourceId
|
|
395
578
|
});
|
|
396
|
-
var StyleSource =
|
|
397
|
-
var StyleSources =
|
|
579
|
+
var StyleSource = z9.union([StyleSourceToken, StyleSourceLocal]);
|
|
580
|
+
var StyleSources = z9.map(StyleSourceId, StyleSource);
|
|
398
581
|
|
|
399
582
|
// src/schema/style-source-selections.ts
|
|
400
|
-
import { z as
|
|
401
|
-
var InstanceId2 =
|
|
402
|
-
var StyleSourceId2 =
|
|
403
|
-
var StyleSourceSelection =
|
|
583
|
+
import { z as z10 } from "zod";
|
|
584
|
+
var InstanceId2 = z10.string();
|
|
585
|
+
var StyleSourceId2 = z10.string();
|
|
586
|
+
var StyleSourceSelection = z10.object({
|
|
404
587
|
instanceId: InstanceId2,
|
|
405
|
-
values:
|
|
588
|
+
values: z10.array(StyleSourceId2)
|
|
406
589
|
});
|
|
407
|
-
var StyleSourceSelections =
|
|
590
|
+
var StyleSourceSelections = z10.map(InstanceId2, StyleSourceSelection);
|
|
408
591
|
|
|
409
592
|
// src/schema/styles.ts
|
|
410
|
-
import { z as
|
|
411
|
-
import { StyleValue } from "@webstudio-is/css-engine";
|
|
412
|
-
var StyleDeclRaw =
|
|
413
|
-
styleSourceId:
|
|
414
|
-
breakpointId:
|
|
415
|
-
state:
|
|
593
|
+
import { z as z11 } from "zod";
|
|
594
|
+
import { StyleValue as StyleValue2 } from "@webstudio-is/css-engine";
|
|
595
|
+
var StyleDeclRaw = z11.object({
|
|
596
|
+
styleSourceId: z11.string(),
|
|
597
|
+
breakpointId: z11.string(),
|
|
598
|
+
state: z11.optional(z11.string()),
|
|
416
599
|
// @todo can't figure out how to make property to be enum
|
|
417
|
-
property:
|
|
418
|
-
value:
|
|
419
|
-
listed:
|
|
600
|
+
property: z11.string(),
|
|
601
|
+
value: StyleValue2,
|
|
602
|
+
listed: z11.boolean().optional().describe("Whether the style is from the Advanced panel")
|
|
420
603
|
});
|
|
421
604
|
var StyleDecl = StyleDeclRaw;
|
|
422
605
|
var getStyleDeclKey = (styleDecl) => {
|
|
423
606
|
return `${styleDecl.styleSourceId}:${styleDecl.breakpointId}:${styleDecl.property}:${styleDecl.state ?? ""}`;
|
|
424
607
|
};
|
|
425
|
-
var Styles =
|
|
608
|
+
var Styles = z11.map(z11.string(), StyleDecl);
|
|
426
609
|
|
|
427
610
|
// src/schema/deployment.ts
|
|
428
|
-
import { z as
|
|
429
|
-
var Templates =
|
|
430
|
-
"vanilla",
|
|
611
|
+
import { z as z12 } from "zod";
|
|
612
|
+
var Templates = z12.enum([
|
|
431
613
|
"docker",
|
|
432
614
|
"vercel",
|
|
433
|
-
"netlify
|
|
434
|
-
"netlify-edge-functions",
|
|
615
|
+
"netlify",
|
|
435
616
|
"ssg",
|
|
436
617
|
"ssg-netlify",
|
|
437
618
|
"ssg-vercel"
|
|
438
619
|
]);
|
|
439
|
-
var Deployment =
|
|
440
|
-
|
|
441
|
-
destination:
|
|
442
|
-
name:
|
|
443
|
-
assetsDomain:
|
|
620
|
+
var Deployment = z12.union([
|
|
621
|
+
z12.object({
|
|
622
|
+
destination: z12.literal("static"),
|
|
623
|
+
name: z12.string(),
|
|
624
|
+
assetsDomain: z12.string(),
|
|
444
625
|
// Must be validated very strictly
|
|
445
|
-
templates:
|
|
626
|
+
templates: z12.array(Templates)
|
|
446
627
|
}),
|
|
447
|
-
|
|
448
|
-
destination:
|
|
449
|
-
domains:
|
|
450
|
-
assetsDomain:
|
|
628
|
+
z12.object({
|
|
629
|
+
destination: z12.literal("saas").optional(),
|
|
630
|
+
domains: z12.array(z12.string()),
|
|
631
|
+
assetsDomain: z12.string().optional(),
|
|
451
632
|
/**
|
|
452
633
|
* @deprecated This field is deprecated, use `domains` instead.
|
|
453
634
|
*/
|
|
454
|
-
projectDomain:
|
|
455
|
-
excludeWstdDomainFromSearch:
|
|
635
|
+
projectDomain: z12.string().optional(),
|
|
636
|
+
excludeWstdDomainFromSearch: z12.boolean().optional()
|
|
456
637
|
})
|
|
457
638
|
]);
|
|
458
639
|
|
|
459
640
|
// src/schema/webstudio.ts
|
|
460
|
-
import { z as
|
|
461
|
-
var WebstudioFragment =
|
|
462
|
-
children:
|
|
463
|
-
instances:
|
|
464
|
-
assets:
|
|
465
|
-
dataSources:
|
|
466
|
-
resources:
|
|
467
|
-
props:
|
|
468
|
-
breakpoints:
|
|
469
|
-
styleSourceSelections:
|
|
470
|
-
styleSources:
|
|
471
|
-
styles:
|
|
641
|
+
import { z as z13 } from "zod";
|
|
642
|
+
var WebstudioFragment = z13.object({
|
|
643
|
+
children: z13.array(InstanceChild),
|
|
644
|
+
instances: z13.array(Instance),
|
|
645
|
+
assets: z13.array(Asset),
|
|
646
|
+
dataSources: z13.array(DataSource),
|
|
647
|
+
resources: z13.array(Resource),
|
|
648
|
+
props: z13.array(Prop),
|
|
649
|
+
breakpoints: z13.array(Breakpoint),
|
|
650
|
+
styleSourceSelections: z13.array(StyleSourceSelection),
|
|
651
|
+
styleSources: z13.array(StyleSource),
|
|
652
|
+
styles: z13.array(StyleDecl)
|
|
472
653
|
});
|
|
473
654
|
|
|
474
655
|
// src/schema/prop-meta.ts
|
|
475
|
-
import { z as
|
|
656
|
+
import { z as z14 } from "zod";
|
|
476
657
|
var common = {
|
|
477
|
-
label:
|
|
478
|
-
description:
|
|
479
|
-
required:
|
|
658
|
+
label: z14.string().optional(),
|
|
659
|
+
description: z14.string().optional(),
|
|
660
|
+
required: z14.boolean()
|
|
480
661
|
};
|
|
481
|
-
var
|
|
662
|
+
var Tag = z14.object({
|
|
663
|
+
...common,
|
|
664
|
+
control: z14.literal("tag"),
|
|
665
|
+
type: z14.literal("string"),
|
|
666
|
+
defaultValue: z14.undefined().optional(),
|
|
667
|
+
options: z14.array(z14.string())
|
|
668
|
+
});
|
|
669
|
+
var Number = z14.object({
|
|
482
670
|
...common,
|
|
483
|
-
control:
|
|
484
|
-
type:
|
|
485
|
-
defaultValue:
|
|
671
|
+
control: z14.literal("number"),
|
|
672
|
+
type: z14.literal("number"),
|
|
673
|
+
defaultValue: z14.number().optional()
|
|
486
674
|
});
|
|
487
|
-
var Range =
|
|
675
|
+
var Range = z14.object({
|
|
488
676
|
...common,
|
|
489
|
-
control:
|
|
490
|
-
type:
|
|
491
|
-
defaultValue:
|
|
677
|
+
control: z14.literal("range"),
|
|
678
|
+
type: z14.literal("number"),
|
|
679
|
+
defaultValue: z14.number().optional()
|
|
492
680
|
});
|
|
493
|
-
var Text =
|
|
681
|
+
var Text = z14.object({
|
|
494
682
|
...common,
|
|
495
|
-
control:
|
|
496
|
-
type:
|
|
497
|
-
defaultValue:
|
|
683
|
+
control: z14.literal("text"),
|
|
684
|
+
type: z14.literal("string"),
|
|
685
|
+
defaultValue: z14.string().optional(),
|
|
498
686
|
/**
|
|
499
687
|
* The number of rows in <textarea>. If set to 0 an <input> will be used instead.
|
|
500
688
|
* In line with Storybook team's plan: https://github.com/storybookjs/storybook/issues/21100
|
|
501
689
|
*/
|
|
502
|
-
rows:
|
|
690
|
+
rows: z14.number().optional()
|
|
503
691
|
});
|
|
504
|
-
var
|
|
692
|
+
var Resource2 = z14.object({
|
|
505
693
|
...common,
|
|
506
|
-
control:
|
|
507
|
-
type:
|
|
508
|
-
|
|
509
|
-
defaultValue: z13.string().optional()
|
|
694
|
+
control: z14.literal("resource"),
|
|
695
|
+
type: z14.literal("resource"),
|
|
696
|
+
defaultValue: z14.string().optional()
|
|
510
697
|
});
|
|
511
|
-
var
|
|
698
|
+
var Code = z14.object({
|
|
512
699
|
...common,
|
|
513
|
-
control:
|
|
514
|
-
type:
|
|
515
|
-
|
|
700
|
+
control: z14.literal("code"),
|
|
701
|
+
type: z14.literal("string"),
|
|
702
|
+
language: z14.union([z14.literal("html"), z14.literal("markdown")]),
|
|
703
|
+
defaultValue: z14.string().optional()
|
|
516
704
|
});
|
|
517
|
-
var
|
|
705
|
+
var CodeText = z14.object({
|
|
518
706
|
...common,
|
|
519
|
-
control:
|
|
520
|
-
type:
|
|
521
|
-
defaultValue:
|
|
707
|
+
control: z14.literal("codetext"),
|
|
708
|
+
type: z14.literal("string"),
|
|
709
|
+
defaultValue: z14.string().optional()
|
|
522
710
|
});
|
|
523
|
-
var
|
|
711
|
+
var Color = z14.object({
|
|
524
712
|
...common,
|
|
525
|
-
control:
|
|
526
|
-
type:
|
|
527
|
-
defaultValue:
|
|
713
|
+
control: z14.literal("color"),
|
|
714
|
+
type: z14.literal("string"),
|
|
715
|
+
defaultValue: z14.string().optional()
|
|
528
716
|
});
|
|
529
|
-
var
|
|
717
|
+
var Boolean = z14.object({
|
|
530
718
|
...common,
|
|
531
|
-
control:
|
|
532
|
-
type:
|
|
533
|
-
defaultValue:
|
|
534
|
-
options: z13.array(z13.string())
|
|
719
|
+
control: z14.literal("boolean"),
|
|
720
|
+
type: z14.literal("boolean"),
|
|
721
|
+
defaultValue: z14.boolean().optional()
|
|
535
722
|
});
|
|
536
|
-
var
|
|
723
|
+
var Radio = z14.object({
|
|
537
724
|
...common,
|
|
538
|
-
control:
|
|
539
|
-
type:
|
|
540
|
-
defaultValue:
|
|
541
|
-
options:
|
|
725
|
+
control: z14.literal("radio"),
|
|
726
|
+
type: z14.literal("string"),
|
|
727
|
+
defaultValue: z14.string().optional(),
|
|
728
|
+
options: z14.array(z14.string())
|
|
542
729
|
});
|
|
543
|
-
var
|
|
730
|
+
var InlineRadio = z14.object({
|
|
544
731
|
...common,
|
|
545
|
-
control:
|
|
546
|
-
type:
|
|
547
|
-
defaultValue:
|
|
548
|
-
options:
|
|
732
|
+
control: z14.literal("inline-radio"),
|
|
733
|
+
type: z14.literal("string"),
|
|
734
|
+
defaultValue: z14.string().optional(),
|
|
735
|
+
options: z14.array(z14.string())
|
|
549
736
|
});
|
|
550
|
-
var
|
|
737
|
+
var Select = z14.object({
|
|
551
738
|
...common,
|
|
552
|
-
control:
|
|
553
|
-
type:
|
|
554
|
-
defaultValue:
|
|
555
|
-
options:
|
|
739
|
+
control: z14.literal("select"),
|
|
740
|
+
type: z14.literal("string"),
|
|
741
|
+
defaultValue: z14.string().optional(),
|
|
742
|
+
options: z14.array(z14.string())
|
|
556
743
|
});
|
|
557
|
-
var
|
|
744
|
+
var Check = z14.object({
|
|
558
745
|
...common,
|
|
559
|
-
control:
|
|
560
|
-
type:
|
|
561
|
-
defaultValue:
|
|
562
|
-
options:
|
|
746
|
+
control: z14.literal("check"),
|
|
747
|
+
type: z14.literal("string[]"),
|
|
748
|
+
defaultValue: z14.array(z14.string()).optional(),
|
|
749
|
+
options: z14.array(z14.string())
|
|
563
750
|
});
|
|
564
|
-
var
|
|
751
|
+
var InlineCheck = z14.object({
|
|
565
752
|
...common,
|
|
566
|
-
control:
|
|
567
|
-
type:
|
|
568
|
-
defaultValue:
|
|
569
|
-
options:
|
|
753
|
+
control: z14.literal("inline-check"),
|
|
754
|
+
type: z14.literal("string[]"),
|
|
755
|
+
defaultValue: z14.array(z14.string()).optional(),
|
|
756
|
+
options: z14.array(z14.string())
|
|
570
757
|
});
|
|
571
|
-
var
|
|
758
|
+
var MultiSelect = z14.object({
|
|
572
759
|
...common,
|
|
573
|
-
control:
|
|
574
|
-
type:
|
|
575
|
-
defaultValue:
|
|
760
|
+
control: z14.literal("multi-select"),
|
|
761
|
+
type: z14.literal("string[]"),
|
|
762
|
+
defaultValue: z14.array(z14.string()).optional(),
|
|
763
|
+
options: z14.array(z14.string())
|
|
764
|
+
});
|
|
765
|
+
var File = z14.object({
|
|
766
|
+
...common,
|
|
767
|
+
control: z14.literal("file"),
|
|
768
|
+
type: z14.literal("string"),
|
|
769
|
+
defaultValue: z14.string().optional(),
|
|
576
770
|
/** https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept */
|
|
577
|
-
accept:
|
|
771
|
+
accept: z14.string().optional()
|
|
578
772
|
});
|
|
579
|
-
var Url =
|
|
773
|
+
var Url = z14.object({
|
|
580
774
|
...common,
|
|
581
|
-
control:
|
|
582
|
-
type:
|
|
583
|
-
defaultValue:
|
|
775
|
+
control: z14.literal("url"),
|
|
776
|
+
type: z14.literal("string"),
|
|
777
|
+
defaultValue: z14.string().optional()
|
|
584
778
|
});
|
|
585
|
-
var Json =
|
|
779
|
+
var Json = z14.object({
|
|
586
780
|
...common,
|
|
587
|
-
control:
|
|
588
|
-
type:
|
|
589
|
-
defaultValue:
|
|
781
|
+
control: z14.literal("json"),
|
|
782
|
+
type: z14.literal("json"),
|
|
783
|
+
defaultValue: z14.unknown().optional()
|
|
590
784
|
});
|
|
591
|
-
var Date =
|
|
785
|
+
var Date = z14.object({
|
|
592
786
|
...common,
|
|
593
|
-
control:
|
|
787
|
+
control: z14.literal("date"),
|
|
594
788
|
// @todo not sure what type should be here
|
|
595
789
|
// (we don't support Date yet, added for completeness)
|
|
596
|
-
type:
|
|
597
|
-
defaultValue:
|
|
790
|
+
type: z14.literal("string"),
|
|
791
|
+
defaultValue: z14.string().optional()
|
|
792
|
+
});
|
|
793
|
+
var Action = z14.object({
|
|
794
|
+
...common,
|
|
795
|
+
control: z14.literal("action"),
|
|
796
|
+
type: z14.literal("action"),
|
|
797
|
+
defaultValue: z14.undefined().optional()
|
|
598
798
|
});
|
|
599
|
-
var
|
|
799
|
+
var TextContent = z14.object({
|
|
600
800
|
...common,
|
|
601
|
-
control:
|
|
602
|
-
type:
|
|
603
|
-
defaultValue:
|
|
801
|
+
control: z14.literal("textContent"),
|
|
802
|
+
type: z14.literal("string"),
|
|
803
|
+
defaultValue: z14.string().optional()
|
|
604
804
|
});
|
|
605
|
-
var
|
|
805
|
+
var AnimationAction = z14.object({
|
|
606
806
|
...common,
|
|
607
|
-
control:
|
|
608
|
-
type:
|
|
609
|
-
defaultValue:
|
|
807
|
+
control: z14.literal("animationAction"),
|
|
808
|
+
type: z14.literal("animationAction"),
|
|
809
|
+
defaultValue: z14.undefined().optional()
|
|
610
810
|
});
|
|
611
|
-
var PropMeta =
|
|
811
|
+
var PropMeta = z14.union([
|
|
812
|
+
Tag,
|
|
612
813
|
Number,
|
|
613
814
|
Range,
|
|
614
815
|
Text,
|
|
816
|
+
Resource2,
|
|
615
817
|
Code,
|
|
616
818
|
CodeText,
|
|
617
819
|
Color,
|
|
@@ -627,109 +829,24 @@ var PropMeta = z13.union([
|
|
|
627
829
|
Json,
|
|
628
830
|
Date,
|
|
629
831
|
Action,
|
|
630
|
-
TextContent
|
|
832
|
+
TextContent,
|
|
833
|
+
AnimationAction
|
|
631
834
|
]);
|
|
632
835
|
|
|
633
|
-
// src/schema/embed-template.ts
|
|
634
|
-
import { z as z14 } from "zod";
|
|
635
|
-
import { StyleValue as StyleValue2 } from "@webstudio-is/css-engine";
|
|
636
|
-
var EmbedTemplateText = z14.object({
|
|
637
|
-
type: z14.literal("text"),
|
|
638
|
-
value: z14.string(),
|
|
639
|
-
placeholder: z14.boolean().optional()
|
|
640
|
-
});
|
|
641
|
-
var EmbedTemplateExpression = z14.object({
|
|
642
|
-
type: z14.literal("expression"),
|
|
643
|
-
value: z14.string()
|
|
644
|
-
});
|
|
645
|
-
var EmbedTemplateVariable = z14.object({
|
|
646
|
-
alias: z14.optional(z14.string()),
|
|
647
|
-
initialValue: z14.unknown()
|
|
648
|
-
});
|
|
649
|
-
var EmbedTemplateProp = z14.union([
|
|
650
|
-
z14.object({
|
|
651
|
-
type: z14.literal("number"),
|
|
652
|
-
name: z14.string(),
|
|
653
|
-
value: z14.number()
|
|
654
|
-
}),
|
|
655
|
-
z14.object({
|
|
656
|
-
type: z14.literal("string"),
|
|
657
|
-
name: z14.string(),
|
|
658
|
-
value: z14.string()
|
|
659
|
-
}),
|
|
660
|
-
z14.object({
|
|
661
|
-
type: z14.literal("boolean"),
|
|
662
|
-
name: z14.string(),
|
|
663
|
-
value: z14.boolean()
|
|
664
|
-
}),
|
|
665
|
-
z14.object({
|
|
666
|
-
type: z14.literal("string[]"),
|
|
667
|
-
name: z14.string(),
|
|
668
|
-
value: z14.array(z14.string())
|
|
669
|
-
}),
|
|
670
|
-
z14.object({
|
|
671
|
-
type: z14.literal("json"),
|
|
672
|
-
name: z14.string(),
|
|
673
|
-
value: z14.unknown()
|
|
674
|
-
}),
|
|
675
|
-
z14.object({
|
|
676
|
-
type: z14.literal("expression"),
|
|
677
|
-
name: z14.string(),
|
|
678
|
-
code: z14.string()
|
|
679
|
-
}),
|
|
680
|
-
z14.object({
|
|
681
|
-
type: z14.literal("parameter"),
|
|
682
|
-
name: z14.string(),
|
|
683
|
-
variableName: z14.string(),
|
|
684
|
-
variableAlias: z14.optional(z14.string())
|
|
685
|
-
}),
|
|
686
|
-
z14.object({
|
|
687
|
-
type: z14.literal("action"),
|
|
688
|
-
name: z14.string(),
|
|
689
|
-
value: z14.array(
|
|
690
|
-
z14.object({
|
|
691
|
-
type: z14.literal("execute"),
|
|
692
|
-
args: z14.optional(z14.array(z14.string())),
|
|
693
|
-
code: z14.string()
|
|
694
|
-
})
|
|
695
|
-
)
|
|
696
|
-
})
|
|
697
|
-
]);
|
|
698
|
-
var EmbedTemplateStyleDeclRaw = z14.object({
|
|
699
|
-
// State selector, e.g. :hover
|
|
700
|
-
state: z14.optional(z14.string()),
|
|
701
|
-
property: z14.string(),
|
|
702
|
-
value: StyleValue2
|
|
703
|
-
});
|
|
704
|
-
var EmbedTemplateStyleDecl = EmbedTemplateStyleDeclRaw;
|
|
705
|
-
var EmbedTemplateInstance = z14.lazy(
|
|
706
|
-
() => z14.object({
|
|
707
|
-
type: z14.literal("instance"),
|
|
708
|
-
component: z14.string(),
|
|
709
|
-
label: z14.optional(z14.string()),
|
|
710
|
-
variables: z14.optional(z14.record(z14.string(), EmbedTemplateVariable)),
|
|
711
|
-
props: z14.optional(z14.array(EmbedTemplateProp)),
|
|
712
|
-
styles: z14.optional(z14.array(EmbedTemplateStyleDecl)),
|
|
713
|
-
children: WsEmbedTemplate
|
|
714
|
-
})
|
|
715
|
-
);
|
|
716
|
-
var WsEmbedTemplate = z14.lazy(
|
|
717
|
-
() => z14.array(
|
|
718
|
-
z14.union([EmbedTemplateInstance, EmbedTemplateText, EmbedTemplateExpression])
|
|
719
|
-
)
|
|
720
|
-
);
|
|
721
|
-
|
|
722
836
|
// src/schema/component-meta.ts
|
|
723
837
|
import { z as z15 } from "zod";
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
//
|
|
727
|
-
|
|
838
|
+
import { StyleValue as StyleValue3 } from "@webstudio-is/css-engine";
|
|
839
|
+
var PresetStyleDecl = z15.object({
|
|
840
|
+
// State selector, e.g. :hover
|
|
841
|
+
state: z15.optional(z15.string()),
|
|
842
|
+
property: z15.string(),
|
|
843
|
+
value: StyleValue3
|
|
728
844
|
});
|
|
729
845
|
var componentCategories = [
|
|
730
846
|
"general",
|
|
731
847
|
"typography",
|
|
732
848
|
"media",
|
|
849
|
+
"animations",
|
|
733
850
|
"data",
|
|
734
851
|
"forms",
|
|
735
852
|
"localization",
|
|
@@ -738,27 +855,29 @@ var componentCategories = [
|
|
|
738
855
|
"hidden",
|
|
739
856
|
"internal"
|
|
740
857
|
];
|
|
741
|
-
var stateCategories = ["states", "component-states"];
|
|
742
858
|
var ComponentState = z15.object({
|
|
743
|
-
category: z15.enum(stateCategories).optional(),
|
|
744
859
|
selector: z15.string(),
|
|
745
860
|
label: z15.string()
|
|
746
861
|
});
|
|
747
|
-
var
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
]
|
|
862
|
+
var ComponentContent = z15.string();
|
|
863
|
+
var ContentModel = z15.object({
|
|
864
|
+
/*
|
|
865
|
+
* instance - accepted by any parent with "instance" in children categories
|
|
866
|
+
* none - accepted by parents with this component name in children categories
|
|
867
|
+
*/
|
|
868
|
+
category: z15.union([z15.literal("instance"), z15.literal("none")]),
|
|
869
|
+
/**
|
|
870
|
+
* enforce direct children of category or components
|
|
871
|
+
*/
|
|
872
|
+
children: z15.array(ComponentContent),
|
|
873
|
+
/**
|
|
874
|
+
* enforce descendants of category or components
|
|
875
|
+
*/
|
|
876
|
+
descendants: z15.array(ComponentContent).optional()
|
|
877
|
+
});
|
|
754
878
|
var WsComponentMeta = z15.object({
|
|
755
879
|
category: z15.enum(componentCategories).optional(),
|
|
756
|
-
|
|
757
|
-
// control - usually form controls like inputs, without children
|
|
758
|
-
// embed - images, videos or other embeddable components, without children
|
|
759
|
-
// rich-text-child - formatted text fragment, not listed in components list
|
|
760
|
-
type: z15.enum(["container", "control", "embed", "rich-text-child"]),
|
|
761
|
-
constraints: Matchers.optional(),
|
|
880
|
+
contentModel: ContentModel.optional(),
|
|
762
881
|
// when this field is specified component receives
|
|
763
882
|
// prop with index of same components withiin specified ancestor
|
|
764
883
|
// important to automatically enumerate collections without
|
|
@@ -766,13 +885,13 @@ var WsComponentMeta = z15.object({
|
|
|
766
885
|
indexWithinAncestor: z15.optional(z15.string()),
|
|
767
886
|
label: z15.optional(z15.string()),
|
|
768
887
|
description: z15.string().optional(),
|
|
769
|
-
icon: z15.string(),
|
|
770
|
-
presetStyle: z15.optional(
|
|
771
|
-
z15.record(z15.string(), z15.array(EmbedTemplateStyleDecl))
|
|
772
|
-
),
|
|
888
|
+
icon: z15.string().optional(),
|
|
889
|
+
presetStyle: z15.optional(z15.record(z15.string(), z15.array(PresetStyleDecl))),
|
|
773
890
|
states: z15.optional(z15.array(ComponentState)),
|
|
774
|
-
|
|
775
|
-
|
|
891
|
+
order: z15.number().optional(),
|
|
892
|
+
// properties and html attributes that will be always visible in properties panel
|
|
893
|
+
initialProps: z15.array(z15.string()).optional(),
|
|
894
|
+
props: z15.record(PropMeta).optional()
|
|
776
895
|
});
|
|
777
896
|
|
|
778
897
|
// src/core-metas.ts
|
|
@@ -785,67 +904,763 @@ import {
|
|
|
785
904
|
} from "@webstudio-is/icons/svg";
|
|
786
905
|
|
|
787
906
|
// src/__generated__/normalize.css.ts
|
|
907
|
+
var normalize_css_exports = {};
|
|
908
|
+
__export(normalize_css_exports, {
|
|
909
|
+
a: () => a,
|
|
910
|
+
address: () => address,
|
|
911
|
+
article: () => article,
|
|
912
|
+
aside: () => aside,
|
|
913
|
+
b: () => b,
|
|
914
|
+
body: () => body,
|
|
915
|
+
button: () => button,
|
|
916
|
+
checkbox: () => checkbox,
|
|
917
|
+
code: () => code,
|
|
918
|
+
div: () => div,
|
|
919
|
+
figure: () => figure,
|
|
920
|
+
footer: () => footer,
|
|
921
|
+
form: () => form,
|
|
922
|
+
h1: () => h1,
|
|
923
|
+
h2: () => h2,
|
|
924
|
+
h3: () => h3,
|
|
925
|
+
h4: () => h4,
|
|
926
|
+
h5: () => h5,
|
|
927
|
+
h6: () => h6,
|
|
928
|
+
header: () => header,
|
|
929
|
+
hr: () => hr,
|
|
930
|
+
html: () => html,
|
|
931
|
+
i: () => i,
|
|
932
|
+
img: () => img,
|
|
933
|
+
input: () => input,
|
|
934
|
+
kbd: () => kbd,
|
|
935
|
+
label: () => label,
|
|
936
|
+
legend: () => legend,
|
|
937
|
+
li: () => li,
|
|
938
|
+
main: () => main,
|
|
939
|
+
nav: () => nav,
|
|
940
|
+
ol: () => ol,
|
|
941
|
+
optgroup: () => optgroup,
|
|
942
|
+
p: () => p,
|
|
943
|
+
pre: () => pre,
|
|
944
|
+
progress: () => progress,
|
|
945
|
+
radio: () => radio,
|
|
946
|
+
samp: () => samp,
|
|
947
|
+
section: () => section,
|
|
948
|
+
select: () => select,
|
|
949
|
+
small: () => small,
|
|
950
|
+
span: () => span,
|
|
951
|
+
strong: () => strong,
|
|
952
|
+
sub: () => sub,
|
|
953
|
+
summary: () => summary,
|
|
954
|
+
sup: () => sup,
|
|
955
|
+
table: () => table,
|
|
956
|
+
textarea: () => textarea,
|
|
957
|
+
time: () => time,
|
|
958
|
+
ul: () => ul
|
|
959
|
+
});
|
|
960
|
+
var div = [
|
|
961
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
962
|
+
{
|
|
963
|
+
property: "border-top-width",
|
|
964
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
property: "border-right-width",
|
|
968
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
property: "border-bottom-width",
|
|
972
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
property: "border-left-width",
|
|
976
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
977
|
+
},
|
|
978
|
+
{ property: "outline-width", value: { type: "unit", unit: "px", value: 1 } }
|
|
979
|
+
];
|
|
980
|
+
var address = div;
|
|
981
|
+
var article = div;
|
|
982
|
+
var aside = div;
|
|
983
|
+
var figure = div;
|
|
984
|
+
var footer = div;
|
|
985
|
+
var header = div;
|
|
986
|
+
var main = div;
|
|
987
|
+
var nav = div;
|
|
988
|
+
var section = div;
|
|
989
|
+
var form = div;
|
|
990
|
+
var label = div;
|
|
991
|
+
var time = div;
|
|
992
|
+
var h1 = div;
|
|
993
|
+
var h2 = div;
|
|
994
|
+
var h3 = div;
|
|
995
|
+
var h4 = div;
|
|
996
|
+
var h5 = div;
|
|
997
|
+
var h6 = div;
|
|
998
|
+
var i = div;
|
|
999
|
+
var img = div;
|
|
1000
|
+
var a = div;
|
|
1001
|
+
var li = div;
|
|
1002
|
+
var ul = div;
|
|
1003
|
+
var ol = div;
|
|
1004
|
+
var p = div;
|
|
1005
|
+
var span = div;
|
|
788
1006
|
var html = [
|
|
789
1007
|
{ property: "display", value: { type: "keyword", value: "grid" } },
|
|
790
|
-
{ property: "
|
|
1008
|
+
{ property: "min-height", value: { type: "unit", unit: "%", value: 100 } },
|
|
791
1009
|
{
|
|
792
|
-
property: "
|
|
1010
|
+
property: "font-family",
|
|
793
1011
|
value: { type: "fontFamily", value: ["Arial", "Roboto", "sans-serif"] }
|
|
794
1012
|
},
|
|
795
|
-
{ property: "
|
|
1013
|
+
{ property: "font-size", value: { type: "unit", unit: "px", value: 16 } },
|
|
796
1014
|
{
|
|
797
|
-
property: "
|
|
1015
|
+
property: "line-height",
|
|
798
1016
|
value: { type: "unit", unit: "number", value: 1.2 }
|
|
799
1017
|
},
|
|
800
1018
|
{
|
|
801
|
-
property: "
|
|
1019
|
+
property: "white-space-collapse",
|
|
802
1020
|
value: { type: "keyword", value: "preserve" }
|
|
803
1021
|
}
|
|
804
1022
|
];
|
|
1023
|
+
var body = [
|
|
1024
|
+
{ property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
|
|
1025
|
+
{
|
|
1026
|
+
property: "margin-right",
|
|
1027
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
property: "margin-bottom",
|
|
1031
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
property: "margin-left",
|
|
1035
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1036
|
+
},
|
|
1037
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1038
|
+
{
|
|
1039
|
+
property: "border-top-width",
|
|
1040
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
property: "border-right-width",
|
|
1044
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
property: "border-bottom-width",
|
|
1048
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
property: "border-left-width",
|
|
1052
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
property: "-webkit-font-smoothing",
|
|
1056
|
+
value: { type: "keyword", value: "antialiased" }
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
property: "-moz-osx-font-smoothing",
|
|
1060
|
+
value: { type: "keyword", value: "grayscale" }
|
|
1061
|
+
}
|
|
1062
|
+
];
|
|
1063
|
+
var hr = [
|
|
1064
|
+
{ property: "height", value: { type: "unit", unit: "number", value: 0 } },
|
|
1065
|
+
{ property: "color", value: { type: "keyword", value: "inherit" } }
|
|
1066
|
+
];
|
|
1067
|
+
var b = [
|
|
1068
|
+
{
|
|
1069
|
+
property: "font-weight",
|
|
1070
|
+
value: { type: "unit", unit: "number", value: 700 }
|
|
1071
|
+
},
|
|
1072
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1073
|
+
{
|
|
1074
|
+
property: "border-top-width",
|
|
1075
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
property: "border-right-width",
|
|
1079
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
property: "border-bottom-width",
|
|
1083
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
property: "border-left-width",
|
|
1087
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1088
|
+
}
|
|
1089
|
+
];
|
|
1090
|
+
var strong = b;
|
|
1091
|
+
var code = [
|
|
1092
|
+
{
|
|
1093
|
+
property: "font-family",
|
|
1094
|
+
value: {
|
|
1095
|
+
type: "fontFamily",
|
|
1096
|
+
value: [
|
|
1097
|
+
"ui-monospace",
|
|
1098
|
+
"SFMono-Regular",
|
|
1099
|
+
"Consolas",
|
|
1100
|
+
"Liberation Mono",
|
|
1101
|
+
"Menlo",
|
|
1102
|
+
"monospace"
|
|
1103
|
+
]
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
{ property: "font-size", value: { type: "unit", unit: "em", value: 1 } },
|
|
1107
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1108
|
+
{
|
|
1109
|
+
property: "border-top-width",
|
|
1110
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
property: "border-right-width",
|
|
1114
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
property: "border-bottom-width",
|
|
1118
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
property: "border-left-width",
|
|
1122
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1123
|
+
}
|
|
1124
|
+
];
|
|
1125
|
+
var kbd = code;
|
|
1126
|
+
var samp = code;
|
|
1127
|
+
var pre = code;
|
|
1128
|
+
var small = [
|
|
1129
|
+
{ property: "font-size", value: { type: "unit", unit: "%", value: 80 } },
|
|
1130
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1131
|
+
{
|
|
1132
|
+
property: "border-top-width",
|
|
1133
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
property: "border-right-width",
|
|
1137
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
property: "border-bottom-width",
|
|
1141
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
property: "border-left-width",
|
|
1145
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1146
|
+
}
|
|
1147
|
+
];
|
|
1148
|
+
var sub = [
|
|
1149
|
+
{ property: "font-size", value: { type: "unit", unit: "%", value: 75 } },
|
|
1150
|
+
{
|
|
1151
|
+
property: "line-height",
|
|
1152
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1153
|
+
},
|
|
1154
|
+
{ property: "position", value: { type: "keyword", value: "relative" } },
|
|
1155
|
+
{ property: "vertical-align", value: { type: "keyword", value: "baseline" } },
|
|
1156
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1157
|
+
{
|
|
1158
|
+
property: "border-top-width",
|
|
1159
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
property: "border-right-width",
|
|
1163
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
property: "border-bottom-width",
|
|
1167
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
property: "border-left-width",
|
|
1171
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1172
|
+
},
|
|
1173
|
+
{ property: "bottom", value: { type: "unit", unit: "em", value: -0.25 } }
|
|
1174
|
+
];
|
|
1175
|
+
var sup = [
|
|
1176
|
+
{ property: "font-size", value: { type: "unit", unit: "%", value: 75 } },
|
|
1177
|
+
{
|
|
1178
|
+
property: "line-height",
|
|
1179
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1180
|
+
},
|
|
1181
|
+
{ property: "position", value: { type: "keyword", value: "relative" } },
|
|
1182
|
+
{ property: "vertical-align", value: { type: "keyword", value: "baseline" } },
|
|
1183
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1184
|
+
{
|
|
1185
|
+
property: "border-top-width",
|
|
1186
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
property: "border-right-width",
|
|
1190
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
property: "border-bottom-width",
|
|
1194
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
property: "border-left-width",
|
|
1198
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1199
|
+
},
|
|
1200
|
+
{ property: "top", value: { type: "unit", unit: "em", value: -0.5 } }
|
|
1201
|
+
];
|
|
1202
|
+
var table = [
|
|
1203
|
+
{
|
|
1204
|
+
property: "text-indent",
|
|
1205
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
property: "border-top-width",
|
|
1209
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
property: "border-right-width",
|
|
1213
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
property: "border-bottom-width",
|
|
1217
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
property: "border-left-width",
|
|
1221
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
property: "border-top-color",
|
|
1225
|
+
value: { type: "keyword", value: "inherit" }
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
property: "border-right-color",
|
|
1229
|
+
value: { type: "keyword", value: "inherit" }
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
property: "border-bottom-color",
|
|
1233
|
+
value: { type: "keyword", value: "inherit" }
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
property: "border-left-color",
|
|
1237
|
+
value: { type: "keyword", value: "inherit" }
|
|
1238
|
+
},
|
|
1239
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } }
|
|
1240
|
+
];
|
|
1241
|
+
var input = [
|
|
1242
|
+
{ property: "font-family", value: { type: "keyword", value: "inherit" } },
|
|
1243
|
+
{ property: "font-size", value: { type: "unit", unit: "%", value: 100 } },
|
|
1244
|
+
{
|
|
1245
|
+
property: "line-height",
|
|
1246
|
+
value: { type: "unit", unit: "number", value: 1.15 }
|
|
1247
|
+
},
|
|
1248
|
+
{ property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
|
|
1249
|
+
{
|
|
1250
|
+
property: "margin-right",
|
|
1251
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
property: "margin-bottom",
|
|
1255
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
property: "margin-left",
|
|
1259
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1260
|
+
},
|
|
1261
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1262
|
+
{
|
|
1263
|
+
property: "border-top-width",
|
|
1264
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
property: "border-right-width",
|
|
1268
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
property: "border-bottom-width",
|
|
1272
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
property: "border-left-width",
|
|
1276
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1277
|
+
},
|
|
1278
|
+
{ property: "border-top-style", value: { type: "keyword", value: "solid" } },
|
|
1279
|
+
{
|
|
1280
|
+
property: "border-right-style",
|
|
1281
|
+
value: { type: "keyword", value: "solid" }
|
|
1282
|
+
},
|
|
1283
|
+
{
|
|
1284
|
+
property: "border-bottom-style",
|
|
1285
|
+
value: { type: "keyword", value: "solid" }
|
|
1286
|
+
},
|
|
1287
|
+
{ property: "border-left-style", value: { type: "keyword", value: "solid" } }
|
|
1288
|
+
];
|
|
1289
|
+
var textarea = input;
|
|
1290
|
+
var optgroup = [
|
|
1291
|
+
{ property: "font-family", value: { type: "keyword", value: "inherit" } },
|
|
1292
|
+
{ property: "font-size", value: { type: "unit", unit: "%", value: 100 } },
|
|
1293
|
+
{
|
|
1294
|
+
property: "line-height",
|
|
1295
|
+
value: { type: "unit", unit: "number", value: 1.15 }
|
|
1296
|
+
},
|
|
1297
|
+
{ property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
|
|
1298
|
+
{
|
|
1299
|
+
property: "margin-right",
|
|
1300
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
property: "margin-bottom",
|
|
1304
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
property: "margin-left",
|
|
1308
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1309
|
+
},
|
|
1310
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1311
|
+
{
|
|
1312
|
+
property: "border-top-width",
|
|
1313
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
property: "border-right-width",
|
|
1317
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
property: "border-bottom-width",
|
|
1321
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
property: "border-left-width",
|
|
1325
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1326
|
+
}
|
|
1327
|
+
];
|
|
1328
|
+
var radio = [
|
|
1329
|
+
{ property: "font-family", value: { type: "keyword", value: "inherit" } },
|
|
1330
|
+
{ property: "font-size", value: { type: "unit", unit: "%", value: 100 } },
|
|
1331
|
+
{
|
|
1332
|
+
property: "line-height",
|
|
1333
|
+
value: { type: "unit", unit: "number", value: 1.15 }
|
|
1334
|
+
},
|
|
1335
|
+
{ property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
|
|
1336
|
+
{
|
|
1337
|
+
property: "margin-right",
|
|
1338
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
property: "margin-bottom",
|
|
1342
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
property: "margin-left",
|
|
1346
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1347
|
+
},
|
|
1348
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1349
|
+
{
|
|
1350
|
+
property: "border-top-width",
|
|
1351
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
property: "border-right-width",
|
|
1355
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
property: "border-bottom-width",
|
|
1359
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
property: "border-left-width",
|
|
1363
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1364
|
+
},
|
|
1365
|
+
{ property: "border-top-style", value: { type: "keyword", value: "none" } },
|
|
1366
|
+
{ property: "border-right-style", value: { type: "keyword", value: "none" } },
|
|
1367
|
+
{
|
|
1368
|
+
property: "border-bottom-style",
|
|
1369
|
+
value: { type: "keyword", value: "none" }
|
|
1370
|
+
},
|
|
1371
|
+
{ property: "border-left-style", value: { type: "keyword", value: "none" } }
|
|
1372
|
+
];
|
|
1373
|
+
var checkbox = radio;
|
|
1374
|
+
var button = [
|
|
1375
|
+
{ property: "font-family", value: { type: "keyword", value: "inherit" } },
|
|
1376
|
+
{ property: "font-size", value: { type: "unit", unit: "%", value: 100 } },
|
|
1377
|
+
{
|
|
1378
|
+
property: "line-height",
|
|
1379
|
+
value: { type: "unit", unit: "number", value: 1.15 }
|
|
1380
|
+
},
|
|
1381
|
+
{ property: "margin-top", value: { type: "unit", unit: "number", value: 0 } },
|
|
1382
|
+
{
|
|
1383
|
+
property: "margin-right",
|
|
1384
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
property: "margin-bottom",
|
|
1388
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
property: "margin-left",
|
|
1392
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1393
|
+
},
|
|
1394
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1395
|
+
{
|
|
1396
|
+
property: "border-top-width",
|
|
1397
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
property: "border-right-width",
|
|
1401
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
property: "border-bottom-width",
|
|
1405
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
property: "border-left-width",
|
|
1409
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1410
|
+
},
|
|
1411
|
+
{ property: "border-top-style", value: { type: "keyword", value: "solid" } },
|
|
1412
|
+
{
|
|
1413
|
+
property: "border-right-style",
|
|
1414
|
+
value: { type: "keyword", value: "solid" }
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
property: "border-bottom-style",
|
|
1418
|
+
value: { type: "keyword", value: "solid" }
|
|
1419
|
+
},
|
|
1420
|
+
{ property: "border-left-style", value: { type: "keyword", value: "solid" } },
|
|
1421
|
+
{ property: "text-transform", value: { type: "keyword", value: "none" } }
|
|
1422
|
+
];
|
|
1423
|
+
var select = button;
|
|
1424
|
+
var legend = [
|
|
1425
|
+
{
|
|
1426
|
+
property: "padding-top",
|
|
1427
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
property: "padding-right",
|
|
1431
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
property: "padding-bottom",
|
|
1435
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
property: "padding-left",
|
|
1439
|
+
value: { type: "unit", unit: "number", value: 0 }
|
|
1440
|
+
},
|
|
1441
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1442
|
+
{
|
|
1443
|
+
property: "border-top-width",
|
|
1444
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
property: "border-right-width",
|
|
1448
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
property: "border-bottom-width",
|
|
1452
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1453
|
+
},
|
|
1454
|
+
{
|
|
1455
|
+
property: "border-left-width",
|
|
1456
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1457
|
+
}
|
|
1458
|
+
];
|
|
1459
|
+
var progress = [
|
|
1460
|
+
{ property: "vertical-align", value: { type: "keyword", value: "baseline" } },
|
|
1461
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1462
|
+
{
|
|
1463
|
+
property: "border-top-width",
|
|
1464
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
property: "border-right-width",
|
|
1468
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
property: "border-bottom-width",
|
|
1472
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
property: "border-left-width",
|
|
1476
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1477
|
+
}
|
|
1478
|
+
];
|
|
1479
|
+
var summary = [
|
|
1480
|
+
{ property: "display", value: { type: "keyword", value: "list-item" } },
|
|
1481
|
+
{ property: "box-sizing", value: { type: "keyword", value: "border-box" } },
|
|
1482
|
+
{
|
|
1483
|
+
property: "border-top-width",
|
|
1484
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
property: "border-right-width",
|
|
1488
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
property: "border-bottom-width",
|
|
1492
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
property: "border-left-width",
|
|
1496
|
+
value: { type: "unit", unit: "px", value: 1 }
|
|
1497
|
+
}
|
|
1498
|
+
];
|
|
1499
|
+
|
|
1500
|
+
// src/runtime.ts
|
|
1501
|
+
var tagProperty = "data-ws-tag";
|
|
1502
|
+
|
|
1503
|
+
// src/__generated__/tags.ts
|
|
1504
|
+
var tags = [
|
|
1505
|
+
"div",
|
|
1506
|
+
"span",
|
|
1507
|
+
"a",
|
|
1508
|
+
"abbr",
|
|
1509
|
+
"address",
|
|
1510
|
+
"area",
|
|
1511
|
+
"article",
|
|
1512
|
+
"aside",
|
|
1513
|
+
"audio",
|
|
1514
|
+
"b",
|
|
1515
|
+
"bdi",
|
|
1516
|
+
"bdo",
|
|
1517
|
+
"blockquote",
|
|
1518
|
+
"body",
|
|
1519
|
+
"br",
|
|
1520
|
+
"button",
|
|
1521
|
+
"canvas",
|
|
1522
|
+
"caption",
|
|
1523
|
+
"cite",
|
|
1524
|
+
"code",
|
|
1525
|
+
"col",
|
|
1526
|
+
"colgroup",
|
|
1527
|
+
"data",
|
|
1528
|
+
"datalist",
|
|
1529
|
+
"dd",
|
|
1530
|
+
"del",
|
|
1531
|
+
"details",
|
|
1532
|
+
"dfn",
|
|
1533
|
+
"dialog",
|
|
1534
|
+
"dl",
|
|
1535
|
+
"dt",
|
|
1536
|
+
"em",
|
|
1537
|
+
"embed",
|
|
1538
|
+
"fieldset",
|
|
1539
|
+
"figcaption",
|
|
1540
|
+
"figure",
|
|
1541
|
+
"footer",
|
|
1542
|
+
"form",
|
|
1543
|
+
"h1",
|
|
1544
|
+
"h2",
|
|
1545
|
+
"h3",
|
|
1546
|
+
"h4",
|
|
1547
|
+
"h5",
|
|
1548
|
+
"h6",
|
|
1549
|
+
"head",
|
|
1550
|
+
"header",
|
|
1551
|
+
"hgroup",
|
|
1552
|
+
"hr",
|
|
1553
|
+
"html",
|
|
1554
|
+
"i",
|
|
1555
|
+
"iframe",
|
|
1556
|
+
"img",
|
|
1557
|
+
"input",
|
|
1558
|
+
"ins",
|
|
1559
|
+
"kbd",
|
|
1560
|
+
"label",
|
|
1561
|
+
"legend",
|
|
1562
|
+
"li",
|
|
1563
|
+
"main",
|
|
1564
|
+
"map",
|
|
1565
|
+
"mark",
|
|
1566
|
+
"menu",
|
|
1567
|
+
"meter",
|
|
1568
|
+
"nav",
|
|
1569
|
+
"object",
|
|
1570
|
+
"ol",
|
|
1571
|
+
"optgroup",
|
|
1572
|
+
"option",
|
|
1573
|
+
"output",
|
|
1574
|
+
"p",
|
|
1575
|
+
"picture",
|
|
1576
|
+
"pre",
|
|
1577
|
+
"progress",
|
|
1578
|
+
"q",
|
|
1579
|
+
"rp",
|
|
1580
|
+
"rt",
|
|
1581
|
+
"ruby",
|
|
1582
|
+
"s",
|
|
1583
|
+
"samp",
|
|
1584
|
+
"search",
|
|
1585
|
+
"section",
|
|
1586
|
+
"select",
|
|
1587
|
+
"slot",
|
|
1588
|
+
"small",
|
|
1589
|
+
"source",
|
|
1590
|
+
"strong",
|
|
1591
|
+
"sub",
|
|
1592
|
+
"summary",
|
|
1593
|
+
"sup",
|
|
1594
|
+
"table",
|
|
1595
|
+
"tbody",
|
|
1596
|
+
"td",
|
|
1597
|
+
"textarea",
|
|
1598
|
+
"tfoot",
|
|
1599
|
+
"th",
|
|
1600
|
+
"thead",
|
|
1601
|
+
"time",
|
|
1602
|
+
"tr",
|
|
1603
|
+
"track",
|
|
1604
|
+
"u",
|
|
1605
|
+
"ul",
|
|
1606
|
+
"var",
|
|
1607
|
+
"video",
|
|
1608
|
+
"wbr"
|
|
1609
|
+
];
|
|
805
1610
|
|
|
806
1611
|
// src/core-metas.ts
|
|
807
1612
|
var rootComponent = "ws:root";
|
|
808
1613
|
var rootMeta = {
|
|
809
|
-
type: "container",
|
|
810
1614
|
label: "Global Root",
|
|
811
1615
|
icon: SettingsIcon,
|
|
812
1616
|
presetStyle: {
|
|
813
1617
|
html
|
|
814
1618
|
}
|
|
815
1619
|
};
|
|
816
|
-
var
|
|
817
|
-
|
|
1620
|
+
var elementComponent = "ws:element";
|
|
1621
|
+
var elementMeta = {
|
|
1622
|
+
label: "Element",
|
|
1623
|
+
// convert [object Module] to [object Object] to enable structured cloning
|
|
1624
|
+
presetStyle: { ...normalize_css_exports },
|
|
1625
|
+
initialProps: [tagProperty, "id", "class"],
|
|
1626
|
+
props: {
|
|
1627
|
+
[tagProperty]: {
|
|
1628
|
+
type: "string",
|
|
1629
|
+
control: "tag",
|
|
1630
|
+
required: true,
|
|
1631
|
+
options: tags
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
818
1634
|
};
|
|
819
1635
|
var portalComponent = "Slot";
|
|
820
1636
|
var collectionComponent = "ws:collection";
|
|
821
1637
|
var collectionMeta = {
|
|
822
|
-
type: "container",
|
|
823
1638
|
label: "Collection",
|
|
824
|
-
icon: ListViewIcon
|
|
825
|
-
|
|
826
|
-
|
|
1639
|
+
icon: ListViewIcon,
|
|
1640
|
+
contentModel: {
|
|
1641
|
+
category: "instance",
|
|
1642
|
+
children: ["instance"]
|
|
1643
|
+
},
|
|
1644
|
+
initialProps: ["data"],
|
|
827
1645
|
props: {
|
|
828
1646
|
data: {
|
|
829
1647
|
required: true,
|
|
830
1648
|
control: "json",
|
|
831
1649
|
type: "json"
|
|
832
1650
|
}
|
|
833
|
-
}
|
|
834
|
-
initialProps: ["data"]
|
|
1651
|
+
}
|
|
835
1652
|
};
|
|
836
1653
|
var descendantComponent = "ws:descendant";
|
|
837
1654
|
var descendantMeta = {
|
|
838
|
-
type: "control",
|
|
839
1655
|
label: "Descendant",
|
|
840
1656
|
icon: PaintBrushIcon,
|
|
1657
|
+
contentModel: {
|
|
1658
|
+
category: "none",
|
|
1659
|
+
children: []
|
|
1660
|
+
},
|
|
841
1661
|
// @todo infer possible presets
|
|
842
1662
|
presetStyle: {},
|
|
843
|
-
|
|
844
|
-
relation: "parent",
|
|
845
|
-
component: { $in: ["HtmlEmbed", "MarkdownEmbed"] }
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
var descendantPropsMeta = {
|
|
1663
|
+
initialProps: ["selector"],
|
|
849
1664
|
props: {
|
|
850
1665
|
selector: {
|
|
851
1666
|
required: true,
|
|
@@ -870,55 +1685,35 @@ var descendantPropsMeta = {
|
|
|
870
1685
|
" hr"
|
|
871
1686
|
]
|
|
872
1687
|
}
|
|
873
|
-
}
|
|
874
|
-
initialProps: ["selector"]
|
|
1688
|
+
}
|
|
875
1689
|
};
|
|
876
1690
|
var blockComponent = "ws:block";
|
|
877
1691
|
var blockTemplateComponent = "ws:block-template";
|
|
878
1692
|
var blockTemplateMeta = {
|
|
879
|
-
type: "container",
|
|
880
1693
|
icon: AddTemplateInstanceIcon,
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
1694
|
+
contentModel: {
|
|
1695
|
+
category: "none",
|
|
1696
|
+
children: ["instance"]
|
|
884
1697
|
}
|
|
885
1698
|
};
|
|
886
|
-
var blockTemplatePropsMeta = {
|
|
887
|
-
props: {}
|
|
888
|
-
};
|
|
889
1699
|
var blockMeta = {
|
|
890
|
-
type: "container",
|
|
891
1700
|
label: "Content Block",
|
|
892
1701
|
icon: ContentBlockIcon,
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
},
|
|
898
|
-
{
|
|
899
|
-
relation: "child",
|
|
900
|
-
component: { $eq: blockTemplateComponent }
|
|
901
|
-
}
|
|
902
|
-
]
|
|
903
|
-
};
|
|
904
|
-
var blockPropsMeta = {
|
|
905
|
-
props: {}
|
|
1702
|
+
contentModel: {
|
|
1703
|
+
category: "instance",
|
|
1704
|
+
children: [blockTemplateComponent, "instance"]
|
|
1705
|
+
}
|
|
906
1706
|
};
|
|
907
1707
|
var coreMetas = {
|
|
908
1708
|
[rootComponent]: rootMeta,
|
|
1709
|
+
[elementComponent]: elementMeta,
|
|
909
1710
|
[collectionComponent]: collectionMeta,
|
|
910
1711
|
[descendantComponent]: descendantMeta,
|
|
911
1712
|
[blockComponent]: blockMeta,
|
|
912
1713
|
[blockTemplateComponent]: blockTemplateMeta
|
|
913
1714
|
};
|
|
914
|
-
var
|
|
915
|
-
|
|
916
|
-
[collectionComponent]: collectionPropsMeta,
|
|
917
|
-
[descendantComponent]: descendantPropsMeta,
|
|
918
|
-
[blockComponent]: blockPropsMeta,
|
|
919
|
-
[blockTemplateComponent]: blockTemplatePropsMeta
|
|
920
|
-
};
|
|
921
|
-
var isCoreComponent = (component) => component === rootComponent || component === collectionComponent || component === descendantComponent || component === blockComponent || component === blockTemplateComponent;
|
|
1715
|
+
var isCoreComponent = (component) => component === rootComponent || component === elementComponent || component === collectionComponent || component === descendantComponent || component === blockComponent || component === blockTemplateComponent;
|
|
1716
|
+
var isComponentDetachable = (component) => component !== rootComponent && component !== blockTemplateComponent && component !== descendantComponent;
|
|
922
1717
|
|
|
923
1718
|
// src/instances-utils.ts
|
|
924
1719
|
var ROOT_INSTANCE_ID = ":root";
|
|
@@ -965,10 +1760,65 @@ var parseComponentName = (componentName) => {
|
|
|
965
1760
|
}
|
|
966
1761
|
return [namespace, name];
|
|
967
1762
|
};
|
|
1763
|
+
var getIndexesWithinAncestors = (metas, instances, rootIds) => {
|
|
1764
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
1765
|
+
for (const meta of metas.values()) {
|
|
1766
|
+
if (meta.indexWithinAncestor !== void 0) {
|
|
1767
|
+
ancestors.add(meta.indexWithinAncestor);
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
const indexes = /* @__PURE__ */ new Map();
|
|
1771
|
+
const traverseInstances2 = (instances2, instanceId, latestIndexes2 = /* @__PURE__ */ new Map()) => {
|
|
1772
|
+
const instance = instances2.get(instanceId);
|
|
1773
|
+
if (instance === void 0) {
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
const meta = metas.get(instance.component);
|
|
1777
|
+
if (ancestors.has(instance.component)) {
|
|
1778
|
+
latestIndexes2 = new Map(latestIndexes2);
|
|
1779
|
+
latestIndexes2.set(instance.component, /* @__PURE__ */ new Map());
|
|
1780
|
+
}
|
|
1781
|
+
if (instance.component === blockTemplateComponent) {
|
|
1782
|
+
latestIndexes2 = new Map(latestIndexes2);
|
|
1783
|
+
for (const key of latestIndexes2.keys()) {
|
|
1784
|
+
latestIndexes2.set(key, /* @__PURE__ */ new Map());
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
if (meta?.indexWithinAncestor !== void 0) {
|
|
1788
|
+
const ancestorIndexes = latestIndexes2.get(meta.indexWithinAncestor);
|
|
1789
|
+
if (ancestorIndexes) {
|
|
1790
|
+
let index = ancestorIndexes.get(instance.component) ?? -1;
|
|
1791
|
+
index += 1;
|
|
1792
|
+
ancestorIndexes.set(instance.component, index);
|
|
1793
|
+
indexes.set(instance.id, index);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
for (const child of instance.children) {
|
|
1797
|
+
if (child.type === "id") {
|
|
1798
|
+
traverseInstances2(instances2, child.value, latestIndexes2);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
const latestIndexes = /* @__PURE__ */ new Map();
|
|
1803
|
+
for (const instanceId of rootIds) {
|
|
1804
|
+
traverseInstances2(instances, instanceId, latestIndexes);
|
|
1805
|
+
}
|
|
1806
|
+
return indexes;
|
|
1807
|
+
};
|
|
968
1808
|
|
|
969
1809
|
// src/expression.ts
|
|
970
|
-
import {
|
|
1810
|
+
import {
|
|
1811
|
+
parse,
|
|
1812
|
+
parseExpressionAt
|
|
1813
|
+
} from "acorn";
|
|
971
1814
|
import { simple } from "acorn-walk";
|
|
1815
|
+
var SYSTEM_VARIABLE_ID = ":system";
|
|
1816
|
+
var systemParameter = {
|
|
1817
|
+
id: SYSTEM_VARIABLE_ID,
|
|
1818
|
+
scopeInstanceId: ROOT_INSTANCE_ID,
|
|
1819
|
+
type: "parameter",
|
|
1820
|
+
name: "system"
|
|
1821
|
+
};
|
|
972
1822
|
var lintExpression = ({
|
|
973
1823
|
expression,
|
|
974
1824
|
availableVariables = /* @__PURE__ */ new Set(),
|
|
@@ -996,7 +1846,7 @@ var lintExpression = ({
|
|
|
996
1846
|
return diagnostics;
|
|
997
1847
|
}
|
|
998
1848
|
try {
|
|
999
|
-
const root =
|
|
1849
|
+
const root = parse(`(${expression})`, {
|
|
1000
1850
|
ecmaVersion: "latest",
|
|
1001
1851
|
// support parsing import to forbid explicitly
|
|
1002
1852
|
sourceType: "module"
|
|
@@ -1079,6 +1929,9 @@ var lintExpression = ({
|
|
|
1079
1929
|
return diagnostics;
|
|
1080
1930
|
};
|
|
1081
1931
|
var isLiteralNode = (node) => {
|
|
1932
|
+
if (node.type === "Identifier" && node.name === "undefined") {
|
|
1933
|
+
return true;
|
|
1934
|
+
}
|
|
1082
1935
|
if (node.type === "Literal") {
|
|
1083
1936
|
return true;
|
|
1084
1937
|
}
|
|
@@ -1220,11 +2073,17 @@ var generateObjectExpression = (map) => {
|
|
|
1220
2073
|
return generated;
|
|
1221
2074
|
};
|
|
1222
2075
|
var dataSourceVariablePrefix = "$ws$dataSource$";
|
|
1223
|
-
var
|
|
2076
|
+
var encodeDataVariableId = (id) => {
|
|
2077
|
+
if (id === SYSTEM_VARIABLE_ID) {
|
|
2078
|
+
return "$ws$system";
|
|
2079
|
+
}
|
|
1224
2080
|
const encoded = id.replaceAll("-", "__DASH__");
|
|
1225
2081
|
return `${dataSourceVariablePrefix}${encoded}`;
|
|
1226
2082
|
};
|
|
1227
|
-
var
|
|
2083
|
+
var decodeDataVariableId = (name) => {
|
|
2084
|
+
if (name === "$ws$system") {
|
|
2085
|
+
return SYSTEM_VARIABLE_ID;
|
|
2086
|
+
}
|
|
1228
2087
|
if (name.startsWith(dataSourceVariablePrefix)) {
|
|
1229
2088
|
const encoded = name.slice(dataSourceVariablePrefix.length);
|
|
1230
2089
|
return encoded.replaceAll("__DASH__", "-");
|
|
@@ -1241,8 +2100,11 @@ var generateExpression = ({
|
|
|
1241
2100
|
expression,
|
|
1242
2101
|
executable: true,
|
|
1243
2102
|
replaceVariable: (identifier) => {
|
|
1244
|
-
const depId =
|
|
1245
|
-
|
|
2103
|
+
const depId = decodeDataVariableId(identifier);
|
|
2104
|
+
let dep = depId ? dataSources.get(depId) : void 0;
|
|
2105
|
+
if (depId === SYSTEM_VARIABLE_ID) {
|
|
2106
|
+
dep = systemParameter;
|
|
2107
|
+
}
|
|
1246
2108
|
if (dep) {
|
|
1247
2109
|
usedDataSources?.set(dep.id, dep);
|
|
1248
2110
|
return scope.getName(dep.id, dep.name);
|
|
@@ -1399,26 +2261,26 @@ var generateResources = ({
|
|
|
1399
2261
|
`;
|
|
1400
2262
|
generatedRequest += ` headers: [
|
|
1401
2263
|
`;
|
|
1402
|
-
for (const
|
|
2264
|
+
for (const header2 of resource.headers) {
|
|
1403
2265
|
const value = generateExpression({
|
|
1404
|
-
expression:
|
|
2266
|
+
expression: header2.value,
|
|
1405
2267
|
dataSources,
|
|
1406
2268
|
usedDataSources,
|
|
1407
2269
|
scope
|
|
1408
2270
|
});
|
|
1409
|
-
generatedRequest += ` { name: "${
|
|
2271
|
+
generatedRequest += ` { name: "${header2.name}", value: ${value} },
|
|
1410
2272
|
`;
|
|
1411
2273
|
}
|
|
1412
2274
|
generatedRequest += ` ],
|
|
1413
2275
|
`;
|
|
1414
2276
|
if (resource.body !== void 0 && resource.body.length > 0) {
|
|
1415
|
-
const
|
|
2277
|
+
const body2 = generateExpression({
|
|
1416
2278
|
expression: resource.body,
|
|
1417
2279
|
dataSources,
|
|
1418
2280
|
usedDataSources,
|
|
1419
2281
|
scope
|
|
1420
2282
|
});
|
|
1421
|
-
generatedRequest += ` body: ${
|
|
2283
|
+
generatedRequest += ` body: ${body2},
|
|
1422
2284
|
`;
|
|
1423
2285
|
}
|
|
1424
2286
|
generatedRequest += ` }
|
|
@@ -1434,12 +2296,11 @@ var generateResources = ({
|
|
|
1434
2296
|
`;
|
|
1435
2297
|
}
|
|
1436
2298
|
if (dataSource.type === "parameter") {
|
|
1437
|
-
if (dataSource.id
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
const name = scope.getName(dataSource.id, dataSource.name);
|
|
1441
|
-
generatedVariables += ` const ${name} = _props.system
|
|
2299
|
+
if (dataSource.id === page.systemDataSourceId || dataSource.id === SYSTEM_VARIABLE_ID) {
|
|
2300
|
+
const name = scope.getName(dataSource.id, dataSource.name);
|
|
2301
|
+
generatedVariables += ` const ${name} = _props.system
|
|
1442
2302
|
`;
|
|
2303
|
+
}
|
|
1443
2304
|
}
|
|
1444
2305
|
}
|
|
1445
2306
|
let generated = "";
|
|
@@ -1528,7 +2389,9 @@ var replaceFormActionsWithResources = ({
|
|
|
1528
2389
|
name: "action",
|
|
1529
2390
|
method: getMethod(method),
|
|
1530
2391
|
url: JSON.stringify(action),
|
|
1531
|
-
headers: [
|
|
2392
|
+
headers: [
|
|
2393
|
+
{ name: "Content-Type", value: JSON.stringify("application/json") }
|
|
2394
|
+
]
|
|
1532
2395
|
});
|
|
1533
2396
|
}
|
|
1534
2397
|
}
|
|
@@ -1636,7 +2499,7 @@ var generatePageMeta = ({
|
|
|
1636
2499
|
continue;
|
|
1637
2500
|
}
|
|
1638
2501
|
if (dataSource.type === "parameter") {
|
|
1639
|
-
if (dataSource.id === page.systemDataSourceId) {
|
|
2502
|
+
if (dataSource.id === page.systemDataSourceId || dataSource.id === SYSTEM_VARIABLE_ID) {
|
|
1640
2503
|
const valueName = localScope.getName(dataSource.id, dataSource.name);
|
|
1641
2504
|
generated += ` let ${valueName} = system
|
|
1642
2505
|
`;
|
|
@@ -1680,6 +2543,208 @@ var generatePageMeta = ({
|
|
|
1680
2543
|
`;
|
|
1681
2544
|
return generated;
|
|
1682
2545
|
};
|
|
2546
|
+
|
|
2547
|
+
// src/css.ts
|
|
2548
|
+
import { kebabCase } from "change-case";
|
|
2549
|
+
import {
|
|
2550
|
+
createRegularStyleSheet,
|
|
2551
|
+
generateAtomic
|
|
2552
|
+
} from "@webstudio-is/css-engine";
|
|
2553
|
+
import { getFontFaces } from "@webstudio-is/fonts";
|
|
2554
|
+
var addFontRules = ({
|
|
2555
|
+
sheet,
|
|
2556
|
+
assets,
|
|
2557
|
+
assetBaseUrl
|
|
2558
|
+
}) => {
|
|
2559
|
+
const fontAssets = [];
|
|
2560
|
+
for (const asset of assets.values()) {
|
|
2561
|
+
if (asset.type === "font") {
|
|
2562
|
+
fontAssets.push(asset);
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
const fontFaces = getFontFaces(fontAssets, { assetBaseUrl });
|
|
2566
|
+
for (const fontFace of fontFaces) {
|
|
2567
|
+
sheet.addFontFaceRule(fontFace);
|
|
2568
|
+
}
|
|
2569
|
+
};
|
|
2570
|
+
var createImageValueTransformer = (assets, { assetBaseUrl }) => (styleValue) => {
|
|
2571
|
+
if (styleValue.type === "image" && styleValue.value.type === "asset") {
|
|
2572
|
+
const asset = assets.get(styleValue.value.value);
|
|
2573
|
+
if (asset === void 0) {
|
|
2574
|
+
return { type: "keyword", value: "none" };
|
|
2575
|
+
}
|
|
2576
|
+
const url = `${assetBaseUrl}${asset.name}`;
|
|
2577
|
+
return {
|
|
2578
|
+
type: "image",
|
|
2579
|
+
value: {
|
|
2580
|
+
type: "url",
|
|
2581
|
+
url
|
|
2582
|
+
},
|
|
2583
|
+
hidden: styleValue.hidden
|
|
2584
|
+
};
|
|
2585
|
+
}
|
|
2586
|
+
};
|
|
2587
|
+
var normalizeClassName = (name) => kebabCase(name);
|
|
2588
|
+
var generateCss = ({
|
|
2589
|
+
assets,
|
|
2590
|
+
instances,
|
|
2591
|
+
props,
|
|
2592
|
+
breakpoints,
|
|
2593
|
+
styles,
|
|
2594
|
+
styleSourceSelections,
|
|
2595
|
+
componentMetas,
|
|
2596
|
+
assetBaseUrl,
|
|
2597
|
+
atomic
|
|
2598
|
+
}) => {
|
|
2599
|
+
const fontSheet = createRegularStyleSheet({ name: "ssr" });
|
|
2600
|
+
const presetSheet = createRegularStyleSheet({ name: "ssr" });
|
|
2601
|
+
const userSheet = createRegularStyleSheet({ name: "ssr" });
|
|
2602
|
+
addFontRules({ sheet: fontSheet, assets, assetBaseUrl });
|
|
2603
|
+
presetSheet.addMediaRule("presets");
|
|
2604
|
+
const presetClasses = /* @__PURE__ */ new Map();
|
|
2605
|
+
const scope = createScope([], normalizeClassName, "-");
|
|
2606
|
+
const tagsByComponent = /* @__PURE__ */ new Map();
|
|
2607
|
+
tagsByComponent.set(rootComponent, /* @__PURE__ */ new Set(["html"]));
|
|
2608
|
+
const tagByInstanceId = /* @__PURE__ */ new Map();
|
|
2609
|
+
for (const prop of props.values()) {
|
|
2610
|
+
if (prop.type === "string" && prop.name === "tag") {
|
|
2611
|
+
tagByInstanceId.set(prop.instanceId, prop.value);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
for (const instance of instances.values()) {
|
|
2615
|
+
const propTag = tagByInstanceId.get(instance.id);
|
|
2616
|
+
const meta = componentMetas.get(instance.component);
|
|
2617
|
+
const metaTag = Object.keys(meta?.presetStyle ?? {}).at(0);
|
|
2618
|
+
let componentTags = tagsByComponent.get(instance.component);
|
|
2619
|
+
if (componentTags === void 0) {
|
|
2620
|
+
componentTags = /* @__PURE__ */ new Set();
|
|
2621
|
+
tagsByComponent.set(instance.component, componentTags);
|
|
2622
|
+
}
|
|
2623
|
+
const tag = instance.tag ?? propTag ?? metaTag;
|
|
2624
|
+
if (tag) {
|
|
2625
|
+
componentTags.add(tag);
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
for (const [component, meta] of componentMetas) {
|
|
2629
|
+
const componentTags = tagsByComponent.get(component);
|
|
2630
|
+
const [_namespace, componentName] = parseComponentName(component);
|
|
2631
|
+
const className = `w-${scope.getName(component, meta.label ?? componentName)}`;
|
|
2632
|
+
const presetStyle = Object.entries(meta.presetStyle ?? {});
|
|
2633
|
+
if (presetStyle.length > 0) {
|
|
2634
|
+
presetClasses.set(component, className);
|
|
2635
|
+
}
|
|
2636
|
+
for (const [tag, styles2] of presetStyle) {
|
|
2637
|
+
if (!componentTags?.has(tag)) {
|
|
2638
|
+
continue;
|
|
2639
|
+
}
|
|
2640
|
+
const selector = component === rootComponent ? ":root" : `${tag}.${className}`;
|
|
2641
|
+
const rule = presetSheet.addNestingRule(selector);
|
|
2642
|
+
for (const declaration of styles2) {
|
|
2643
|
+
rule.setDeclaration({
|
|
2644
|
+
breakpoint: "presets",
|
|
2645
|
+
selector: declaration.state ?? "",
|
|
2646
|
+
property: declaration.property,
|
|
2647
|
+
value: declaration.value
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
for (const breakpoint of breakpoints.values()) {
|
|
2653
|
+
userSheet.addMediaRule(breakpoint.id, breakpoint);
|
|
2654
|
+
}
|
|
2655
|
+
const imageValueTransformer = createImageValueTransformer(assets, {
|
|
2656
|
+
assetBaseUrl
|
|
2657
|
+
});
|
|
2658
|
+
userSheet.setTransformer(imageValueTransformer);
|
|
2659
|
+
for (const styleDecl of styles.values()) {
|
|
2660
|
+
const rule = userSheet.addMixinRule(styleDecl.styleSourceId);
|
|
2661
|
+
rule.setDeclaration({
|
|
2662
|
+
breakpoint: styleDecl.breakpointId,
|
|
2663
|
+
selector: styleDecl.state ?? "",
|
|
2664
|
+
property: styleDecl.property,
|
|
2665
|
+
value: styleDecl.value
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
const classes = /* @__PURE__ */ new Map();
|
|
2669
|
+
const parentIdByInstanceId = /* @__PURE__ */ new Map();
|
|
2670
|
+
for (const instance of instances.values()) {
|
|
2671
|
+
const presetClass = presetClasses.get(instance.component);
|
|
2672
|
+
if (presetClass) {
|
|
2673
|
+
classes.set(instance.id, [presetClass]);
|
|
2674
|
+
}
|
|
2675
|
+
for (const child of instance.children) {
|
|
2676
|
+
if (child.type === "id") {
|
|
2677
|
+
parentIdByInstanceId.set(child.value, instance.id);
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
const descendantSelectorByInstanceId = /* @__PURE__ */ new Map();
|
|
2682
|
+
for (const prop of props.values()) {
|
|
2683
|
+
if (prop.name === "selector" && prop.type === "string") {
|
|
2684
|
+
descendantSelectorByInstanceId.set(prop.instanceId, prop.value);
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
const instanceByRule = /* @__PURE__ */ new Map();
|
|
2688
|
+
for (const selection of styleSourceSelections.values()) {
|
|
2689
|
+
let { instanceId } = selection;
|
|
2690
|
+
const { values } = selection;
|
|
2691
|
+
if (instanceId === ROOT_INSTANCE_ID) {
|
|
2692
|
+
const rule2 = userSheet.addNestingRule(`:root`);
|
|
2693
|
+
rule2.applyMixins(values);
|
|
2694
|
+
continue;
|
|
2695
|
+
}
|
|
2696
|
+
let descendantSuffix = "";
|
|
2697
|
+
const instance = instances.get(instanceId);
|
|
2698
|
+
if (instance === void 0) {
|
|
2699
|
+
continue;
|
|
2700
|
+
}
|
|
2701
|
+
if (instance.component === descendantComponent) {
|
|
2702
|
+
const parentId = parentIdByInstanceId.get(instanceId);
|
|
2703
|
+
const descendantSelector = descendantSelectorByInstanceId.get(instanceId);
|
|
2704
|
+
if (parentId && descendantSelector) {
|
|
2705
|
+
descendantSuffix = descendantSelector;
|
|
2706
|
+
instanceId = parentId;
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
const meta = componentMetas.get(instance.component);
|
|
2710
|
+
const [_namespace, shortName] = parseComponentName(instance.component);
|
|
2711
|
+
const baseName = instance.label ?? meta?.label ?? shortName;
|
|
2712
|
+
const className = `w-${scope.getName(instanceId, baseName)}`;
|
|
2713
|
+
if (atomic === false) {
|
|
2714
|
+
let classList = classes.get(instanceId);
|
|
2715
|
+
if (classList === void 0) {
|
|
2716
|
+
classList = [];
|
|
2717
|
+
classes.set(instanceId, classList);
|
|
2718
|
+
}
|
|
2719
|
+
classList.push(className);
|
|
2720
|
+
}
|
|
2721
|
+
const rule = userSheet.addNestingRule(`.${className}`, descendantSuffix);
|
|
2722
|
+
rule.applyMixins(values);
|
|
2723
|
+
instanceByRule.set(rule, instanceId);
|
|
2724
|
+
}
|
|
2725
|
+
const fontCss = fontSheet.cssText;
|
|
2726
|
+
const presetCss = presetSheet.cssText.replaceAll(
|
|
2727
|
+
"@media all ",
|
|
2728
|
+
"@layer presets "
|
|
2729
|
+
);
|
|
2730
|
+
if (atomic) {
|
|
2731
|
+
const { cssText } = generateAtomic(userSheet, {
|
|
2732
|
+
getKey: (rule) => instanceByRule.get(rule),
|
|
2733
|
+
transformValue: imageValueTransformer,
|
|
2734
|
+
classes
|
|
2735
|
+
});
|
|
2736
|
+
return {
|
|
2737
|
+
cssText: `${fontCss}${presetCss}
|
|
2738
|
+
${cssText}`,
|
|
2739
|
+
classes
|
|
2740
|
+
};
|
|
2741
|
+
}
|
|
2742
|
+
return {
|
|
2743
|
+
cssText: `${fontCss}${presetCss}
|
|
2744
|
+
${userSheet.cssText}`,
|
|
2745
|
+
classes
|
|
2746
|
+
};
|
|
2747
|
+
};
|
|
1683
2748
|
export {
|
|
1684
2749
|
Asset,
|
|
1685
2750
|
Assets,
|
|
@@ -1687,14 +2752,11 @@ export {
|
|
|
1687
2752
|
Breakpoints,
|
|
1688
2753
|
CompilerSettings,
|
|
1689
2754
|
ComponentState,
|
|
2755
|
+
ContentModel,
|
|
1690
2756
|
DataSource,
|
|
1691
2757
|
DataSourceVariableValue,
|
|
1692
2758
|
DataSources,
|
|
1693
2759
|
Deployment,
|
|
1694
|
-
EmbedTemplateInstance,
|
|
1695
|
-
EmbedTemplateProp,
|
|
1696
|
-
EmbedTemplateStyleDecl,
|
|
1697
|
-
EmbedTemplateVariable,
|
|
1698
2760
|
ExpressionChild,
|
|
1699
2761
|
Folder,
|
|
1700
2762
|
FolderName,
|
|
@@ -1706,24 +2768,24 @@ export {
|
|
|
1706
2768
|
Instance,
|
|
1707
2769
|
InstanceChild,
|
|
1708
2770
|
Instances,
|
|
1709
|
-
|
|
1710
|
-
MatcherOperation,
|
|
1711
|
-
MatcherRelation,
|
|
1712
|
-
Matchers,
|
|
2771
|
+
OldPagePath,
|
|
1713
2772
|
PageName,
|
|
1714
2773
|
PagePath,
|
|
1715
2774
|
PageRedirect,
|
|
1716
2775
|
PageTitle,
|
|
1717
2776
|
Pages,
|
|
2777
|
+
PresetStyleDecl,
|
|
1718
2778
|
ProjectNewRedirectPath,
|
|
1719
2779
|
Prop,
|
|
1720
2780
|
PropMeta,
|
|
1721
2781
|
Props,
|
|
2782
|
+
RANGE_UNITS,
|
|
1722
2783
|
ROOT_FOLDER_ID,
|
|
1723
2784
|
ROOT_INSTANCE_ID,
|
|
1724
2785
|
Resource,
|
|
1725
2786
|
ResourceRequest,
|
|
1726
2787
|
Resources,
|
|
2788
|
+
SYSTEM_VARIABLE_ID,
|
|
1727
2789
|
StyleDecl,
|
|
1728
2790
|
StyleSource,
|
|
1729
2791
|
StyleSourceSelection,
|
|
@@ -1734,36 +2796,43 @@ export {
|
|
|
1734
2796
|
TextChild,
|
|
1735
2797
|
WebstudioFragment,
|
|
1736
2798
|
WsComponentMeta,
|
|
1737
|
-
|
|
2799
|
+
addFontRules,
|
|
2800
|
+
animationActionSchema,
|
|
2801
|
+
animationKeyframeSchema,
|
|
1738
2802
|
blockComponent,
|
|
1739
2803
|
blockTemplateComponent,
|
|
1740
2804
|
blockTemplateMeta,
|
|
1741
2805
|
collectionComponent,
|
|
1742
2806
|
componentCategories,
|
|
1743
2807
|
coreMetas,
|
|
1744
|
-
|
|
2808
|
+
createImageValueTransformer,
|
|
1745
2809
|
createScope,
|
|
1746
|
-
decodeDataSourceVariable,
|
|
1747
|
-
|
|
1748
|
-
defaultStates,
|
|
2810
|
+
decodeDataVariableId as decodeDataSourceVariable,
|
|
2811
|
+
decodeDataVariableId,
|
|
1749
2812
|
descendantComponent,
|
|
1750
2813
|
documentTypes,
|
|
1751
|
-
|
|
1752
|
-
|
|
2814
|
+
durationUnitValueSchema,
|
|
2815
|
+
elementComponent,
|
|
2816
|
+
encodeDataVariableId as encodeDataSourceVariable,
|
|
2817
|
+
encodeDataVariableId,
|
|
1753
2818
|
executeExpression,
|
|
1754
2819
|
findPageByIdOrPath,
|
|
1755
2820
|
findParentFolderByChildId,
|
|
1756
2821
|
findTreeInstanceIds,
|
|
1757
2822
|
findTreeInstanceIdsExcludingSlotDescendants,
|
|
2823
|
+
generateCss,
|
|
1758
2824
|
generateExpression,
|
|
1759
2825
|
generateObjectExpression,
|
|
1760
2826
|
generatePageMeta,
|
|
1761
2827
|
generateResources,
|
|
1762
2828
|
getExpressionIdentifiers,
|
|
2829
|
+
getIndexesWithinAncestors,
|
|
1763
2830
|
getPagePath,
|
|
1764
2831
|
getStaticSiteMapXml,
|
|
1765
2832
|
getStyleDeclKey,
|
|
1766
2833
|
initialBreakpoints,
|
|
2834
|
+
insetUnitValueSchema,
|
|
2835
|
+
isComponentDetachable,
|
|
1767
2836
|
isCoreComponent,
|
|
1768
2837
|
isLiteralExpression,
|
|
1769
2838
|
isPathnamePattern,
|
|
@@ -1773,8 +2842,12 @@ export {
|
|
|
1773
2842
|
parseComponentName,
|
|
1774
2843
|
parseObjectExpression,
|
|
1775
2844
|
portalComponent,
|
|
2845
|
+
rangeUnitValueSchema,
|
|
1776
2846
|
replaceFormActionsWithResources,
|
|
1777
2847
|
rootComponent,
|
|
1778
|
-
|
|
1779
|
-
|
|
2848
|
+
scrollAnimationSchema,
|
|
2849
|
+
systemParameter,
|
|
2850
|
+
tags,
|
|
2851
|
+
transpileExpression,
|
|
2852
|
+
viewAnimationSchema
|
|
1780
2853
|
};
|