@webstudio-is/react-sdk 0.189.0 → 0.191.4

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/index.js DELETED
@@ -1,1528 +0,0 @@
1
- // src/remix.ts
2
- var getRemixSegment = (segment) => {
3
- if (segment === "*") {
4
- return "$";
5
- }
6
- const match = segment.match(/^:(?<name>\w+)(?<modifier>\*|\?)?$/);
7
- const name = match?.groups?.name;
8
- const modifier = match?.groups?.modifier;
9
- if (name) {
10
- if (modifier === "*") {
11
- return "$";
12
- }
13
- if (modifier === "?") {
14
- return `($${name})`;
15
- }
16
- return `$${name}`;
17
- }
18
- return `[${segment}]`;
19
- };
20
- var generateRemixRoute = (pathname) => {
21
- if (pathname.startsWith("/")) {
22
- pathname = pathname.slice(1);
23
- }
24
- if (pathname === "") {
25
- return `_index`;
26
- }
27
- const base = pathname.split("/").map(getRemixSegment).join(".");
28
- const tail = pathname.endsWith("*") ? "" : "._index";
29
- return `${base}${tail}`;
30
- };
31
- var generateRemixParams = (pathname) => {
32
- const name = pathname.match(/:(?<name>\w+)\*$/)?.groups?.name;
33
- let generated = "";
34
- generated += `type Params = Record<string, string | undefined>;
35
- `;
36
- generated += `export const getRemixParams = ({ ...params }: Params): Params => {
37
- `;
38
- if (name) {
39
- generated += ` params["${name}"] = params["*"]
40
- `;
41
- generated += ` delete params["*"]
42
- `;
43
- }
44
- if (pathname.endsWith("/*")) {
45
- generated += ` params[0] = params["*"]
46
- `;
47
- generated += ` delete params["*"]
48
- `;
49
- }
50
- generated += ` return params
51
- `;
52
- generated += `}
53
- `;
54
- return generated;
55
- };
56
-
57
- // src/css/global-rules.ts
58
- import { getFontFaces } from "@webstudio-is/fonts";
59
- var addGlobalRules = (sheet, { assets, assetBaseUrl }) => {
60
- const fontAssets = [];
61
- for (const asset of assets.values()) {
62
- if (asset.type === "font") {
63
- fontAssets.push(asset);
64
- }
65
- }
66
- const fontFaces = getFontFaces(fontAssets, { assetBaseUrl });
67
- for (const fontFace of fontFaces) {
68
- sheet.addFontFaceRule(fontFace);
69
- }
70
- };
71
-
72
- // src/css/css.ts
73
- import {
74
- createRegularStyleSheet,
75
- generateAtomic
76
- } from "@webstudio-is/css-engine";
77
- import {
78
- ROOT_INSTANCE_ID,
79
- createScope,
80
- parseComponentName
81
- } from "@webstudio-is/sdk";
82
-
83
- // src/core-components.ts
84
- import {
85
- ListViewIcon,
86
- PaintBrushIcon,
87
- SettingsIcon
88
- } from "@webstudio-is/icons/svg";
89
- import { html } from "@webstudio-is/sdk/normalize.css";
90
- var rootComponent = "ws:root";
91
- var rootMeta = {
92
- category: "hidden",
93
- type: "container",
94
- label: "Global Root",
95
- icon: SettingsIcon,
96
- presetStyle: {
97
- html
98
- }
99
- };
100
- var rootPropsMeta = {
101
- props: {}
102
- };
103
- var portalComponent = "Slot";
104
- var collectionComponent = "ws:collection";
105
- var collectionMeta = {
106
- category: "data",
107
- order: 2,
108
- type: "container",
109
- label: "Collection",
110
- icon: ListViewIcon,
111
- stylable: false,
112
- template: [
113
- {
114
- type: "instance",
115
- component: collectionComponent,
116
- props: [
117
- {
118
- name: "data",
119
- type: "json",
120
- value: [
121
- "Collection Item 1",
122
- "Collection Item 2",
123
- "Collection Item 3"
124
- ]
125
- },
126
- {
127
- name: "item",
128
- type: "parameter",
129
- variableName: "collectionItem",
130
- variableAlias: "Collection Item"
131
- }
132
- ],
133
- children: [
134
- {
135
- type: "instance",
136
- component: "Box",
137
- children: [
138
- {
139
- type: "instance",
140
- component: "Text",
141
- children: [{ type: "expression", value: "collectionItem" }]
142
- }
143
- ]
144
- }
145
- ]
146
- }
147
- ]
148
- };
149
- var collectionPropsMeta = {
150
- props: {
151
- data: {
152
- required: true,
153
- control: "json",
154
- type: "json"
155
- }
156
- },
157
- initialProps: ["data"]
158
- };
159
- var descendantComponent = "ws:descendant";
160
- var descendantMeta = {
161
- category: "internal",
162
- type: "control",
163
- label: "Descendant",
164
- icon: PaintBrushIcon,
165
- detachable: false
166
- };
167
- var descendantPropsMeta = {
168
- props: {
169
- selector: {
170
- required: true,
171
- type: "string",
172
- control: "select",
173
- options: [
174
- " p",
175
- " h1",
176
- " h2",
177
- " h3",
178
- " h4",
179
- " h5",
180
- " h6",
181
- " :where(strong, b)",
182
- " :where(em, i)",
183
- " a",
184
- " img",
185
- " blockquote",
186
- " code",
187
- " :where(ul, ol)",
188
- " li",
189
- " hr"
190
- ]
191
- }
192
- },
193
- initialProps: ["selector"]
194
- };
195
- var coreMetas = {
196
- [rootComponent]: rootMeta,
197
- [collectionComponent]: collectionMeta,
198
- [descendantComponent]: descendantMeta
199
- };
200
- var corePropsMetas = {
201
- [rootComponent]: rootPropsMeta,
202
- [collectionComponent]: collectionPropsMeta,
203
- [descendantComponent]: descendantPropsMeta
204
- };
205
- var isCoreComponent = (component) => component === rootComponent || component === collectionComponent || component === descendantComponent;
206
-
207
- // src/css/css.ts
208
- import { kebabCase } from "change-case";
209
- var createImageValueTransformer = (assets, { assetBaseUrl }) => (styleValue) => {
210
- if (styleValue.type === "image" && styleValue.value.type === "asset") {
211
- const asset = assets.get(styleValue.value.value);
212
- if (asset === void 0) {
213
- return { type: "keyword", value: "none" };
214
- }
215
- const url = `${assetBaseUrl}${asset.name}`;
216
- return {
217
- type: "image",
218
- value: {
219
- type: "url",
220
- url
221
- },
222
- hidden: styleValue.hidden
223
- };
224
- }
225
- };
226
- var normalizeClassName = (name) => kebabCase(name);
227
- var generateCss = ({
228
- assets,
229
- instances,
230
- props,
231
- breakpoints,
232
- styles,
233
- styleSourceSelections,
234
- componentMetas,
235
- assetBaseUrl,
236
- atomic
237
- }) => {
238
- const globalSheet = createRegularStyleSheet({ name: "ssr" });
239
- const sheet = createRegularStyleSheet({ name: "ssr" });
240
- addGlobalRules(globalSheet, { assets, assetBaseUrl });
241
- globalSheet.addMediaRule("presets");
242
- const presetClasses = /* @__PURE__ */ new Map();
243
- const scope = createScope([], normalizeClassName, "-");
244
- for (const [component, meta] of componentMetas) {
245
- const [_namespace, componentName] = parseComponentName(component);
246
- const className = `w-${scope.getName(component, meta.label ?? componentName)}`;
247
- const presetStyle = Object.entries(meta.presetStyle ?? {});
248
- if (presetStyle.length > 0) {
249
- presetClasses.set(component, className);
250
- }
251
- for (const [tag, styles2] of presetStyle) {
252
- const selector = component === rootComponent ? ":root" : `:where(${tag}.${className})`;
253
- const rule = globalSheet.addNestingRule(selector);
254
- for (const declaration of styles2) {
255
- rule.setDeclaration({
256
- breakpoint: "presets",
257
- selector: declaration.state ?? "",
258
- property: declaration.property,
259
- value: declaration.value
260
- });
261
- }
262
- }
263
- }
264
- for (const breakpoint of breakpoints.values()) {
265
- sheet.addMediaRule(breakpoint.id, breakpoint);
266
- }
267
- const imageValueTransformer = createImageValueTransformer(assets, {
268
- assetBaseUrl
269
- });
270
- sheet.setTransformer(imageValueTransformer);
271
- for (const styleDecl of styles.values()) {
272
- const rule = sheet.addMixinRule(styleDecl.styleSourceId);
273
- rule.setDeclaration({
274
- breakpoint: styleDecl.breakpointId,
275
- selector: styleDecl.state ?? "",
276
- property: styleDecl.property,
277
- value: styleDecl.value
278
- });
279
- }
280
- const classes = /* @__PURE__ */ new Map();
281
- const parentIdByInstanceId = /* @__PURE__ */ new Map();
282
- for (const instance of instances.values()) {
283
- const presetClass = presetClasses.get(instance.component);
284
- if (presetClass) {
285
- classes.set(instance.id, [presetClass]);
286
- }
287
- for (const child of instance.children) {
288
- if (child.type === "id") {
289
- parentIdByInstanceId.set(child.value, instance.id);
290
- }
291
- }
292
- }
293
- const descendantSelectorByInstanceId = /* @__PURE__ */ new Map();
294
- for (const prop of props.values()) {
295
- if (prop.name === "selector" && prop.type === "string") {
296
- descendantSelectorByInstanceId.set(prop.instanceId, prop.value);
297
- }
298
- }
299
- const instanceByRule = /* @__PURE__ */ new Map();
300
- for (const selection of styleSourceSelections.values()) {
301
- let { instanceId } = selection;
302
- const { values } = selection;
303
- if (instanceId === ROOT_INSTANCE_ID) {
304
- const rule2 = sheet.addNestingRule(`:root`);
305
- rule2.applyMixins(values);
306
- continue;
307
- }
308
- let descendantSuffix = "";
309
- const instance = instances.get(instanceId);
310
- if (instance?.component === descendantComponent) {
311
- const parentId = parentIdByInstanceId.get(instanceId);
312
- const descendantSelector = descendantSelectorByInstanceId.get(instanceId);
313
- if (parentId && descendantSelector) {
314
- descendantSuffix = descendantSelector;
315
- instanceId = parentId;
316
- }
317
- }
318
- const meta = instance ? componentMetas.get(instance.component) : void 0;
319
- const baseName = instance?.label ?? meta?.label ?? instance?.component ?? instanceId;
320
- const className = `w-${scope.getName(instanceId, baseName)}`;
321
- if (atomic === false) {
322
- let classList = classes.get(instanceId);
323
- if (classList === void 0) {
324
- classList = [];
325
- classes.set(instanceId, classList);
326
- }
327
- classList.push(className);
328
- }
329
- const rule = sheet.addNestingRule(`.${className}`, descendantSuffix);
330
- rule.applyMixins(values);
331
- instanceByRule.set(rule, instanceId);
332
- }
333
- if (atomic) {
334
- const { cssText } = generateAtomic(sheet, {
335
- getKey: (rule) => instanceByRule.get(rule),
336
- transformValue: imageValueTransformer,
337
- classes
338
- });
339
- return { cssText: `${globalSheet.cssText}
340
- ${cssText}`, classes };
341
- }
342
- return {
343
- cssText: `${globalSheet.cssText}
344
- ${sheet.cssText}`,
345
- classes
346
- };
347
- };
348
-
349
- // src/props.ts
350
- import {
351
- getPagePath,
352
- findPageByIdOrPath
353
- } from "@webstudio-is/sdk";
354
- var normalizeProps = ({
355
- props,
356
- assetBaseUrl,
357
- assets,
358
- uploadingImageAssets,
359
- pages,
360
- source
361
- }) => {
362
- const newProps = [];
363
- for (const prop of props) {
364
- if (prop.type === "asset") {
365
- const assetId = prop.value;
366
- const asset = assets.get(assetId) ?? uploadingImageAssets.find((asset2) => asset2.id === assetId);
367
- if (asset === void 0) {
368
- continue;
369
- }
370
- const propBase = {
371
- id: prop.id,
372
- name: prop.name,
373
- required: prop.required,
374
- instanceId: prop.instanceId
375
- };
376
- if (prop.name === "width" && asset.type === "image") {
377
- newProps.push({
378
- ...propBase,
379
- type: "number",
380
- value: asset.meta.width
381
- });
382
- continue;
383
- }
384
- if (prop.name === "height" && asset.type === "image") {
385
- newProps.push({
386
- ...propBase,
387
- type: "number",
388
- value: asset.meta.height
389
- });
390
- continue;
391
- }
392
- newProps.push({
393
- ...propBase,
394
- type: "string",
395
- value: `${assetBaseUrl}${asset.name}`
396
- });
397
- if (source === "canvas") {
398
- newProps.push({
399
- id: `${prop.instanceId}-${asset.id}-assetId`,
400
- name: "$webstudio$canvasOnly$assetId",
401
- required: false,
402
- instanceId: prop.instanceId,
403
- type: "string",
404
- value: asset.id
405
- });
406
- }
407
- continue;
408
- }
409
- if (prop.type === "page") {
410
- let idProp;
411
- const pageId = typeof prop.value === "string" ? prop.value : prop.value.pageId;
412
- const page = findPageByIdOrPath(pageId, pages);
413
- if (page === void 0) {
414
- continue;
415
- }
416
- if (typeof prop.value !== "string") {
417
- const { instanceId } = prop.value;
418
- idProp = props.find(
419
- (prop2) => prop2.instanceId === instanceId && prop2.name === "id"
420
- );
421
- }
422
- const path = getPagePath(page.id, pages);
423
- const url = new URL(path, "https://any-valid.url");
424
- let value = url.pathname;
425
- if (idProp?.type === "string") {
426
- const hash = idProp.value;
427
- url.hash = encodeURIComponent(hash);
428
- value = `${url.pathname}${url.hash}`;
429
- }
430
- newProps.push({
431
- id: prop.id,
432
- name: prop.name,
433
- required: prop.required,
434
- instanceId: prop.instanceId,
435
- type: "string",
436
- value
437
- });
438
- continue;
439
- }
440
- newProps.push(prop);
441
- }
442
- return newProps;
443
- };
444
- var idAttribute = "data-ws-id";
445
- var selectorIdAttribute = "data-ws-selector";
446
- var componentAttribute = "data-ws-component";
447
- var showAttribute = "data-ws-show";
448
- var indexAttribute = "data-ws-index";
449
- var collapsedAttribute = "data-ws-collapsed";
450
- var textContentAttribute = "data-ws-text-content";
451
- var attributeNameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
452
- var attributeNameChar = attributeNameStartChar + ":\\-0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
453
- var validAttributeNameRegex = new RegExp(
454
- // eslint-disable-next-line no-misleading-character-class
455
- "^[" + attributeNameStartChar + "][" + attributeNameChar + "]*$"
456
- );
457
- var illegalAttributeNameCache = /* @__PURE__ */ new Map();
458
- var validatedAttributeNameCache = /* @__PURE__ */ new Map();
459
- var isAttributeNameSafe = (attributeName) => {
460
- if (validatedAttributeNameCache.has(attributeName)) {
461
- return true;
462
- }
463
- if (illegalAttributeNameCache.has(attributeName)) {
464
- return false;
465
- }
466
- if (validAttributeNameRegex.test(attributeName)) {
467
- validatedAttributeNameCache.set(attributeName, true);
468
- return true;
469
- }
470
- illegalAttributeNameCache.set(attributeName, true);
471
- return false;
472
- };
473
-
474
- // src/prop-meta.ts
475
- import { z } from "zod";
476
- var common = {
477
- label: z.string().optional(),
478
- description: z.string().optional(),
479
- required: z.boolean()
480
- };
481
- var Number = z.object({
482
- ...common,
483
- control: z.literal("number"),
484
- type: z.literal("number"),
485
- defaultValue: z.number().optional()
486
- });
487
- var Range = z.object({
488
- ...common,
489
- control: z.literal("range"),
490
- type: z.literal("number"),
491
- defaultValue: z.number().optional()
492
- });
493
- var Text = z.object({
494
- ...common,
495
- control: z.literal("text"),
496
- type: z.literal("string"),
497
- defaultValue: z.string().optional(),
498
- /**
499
- * The number of rows in <textarea>. If set to 0 an <input> will be used instead.
500
- * In line with Storybook team's plan: https://github.com/storybookjs/storybook/issues/21100
501
- */
502
- rows: z.number().optional()
503
- });
504
- var Code = z.object({
505
- ...common,
506
- control: z.literal("code"),
507
- type: z.literal("string"),
508
- language: z.union([z.literal("html"), z.literal("markdown")]),
509
- defaultValue: z.string().optional()
510
- });
511
- var CodeText = z.object({
512
- ...common,
513
- control: z.literal("codetext"),
514
- type: z.literal("string"),
515
- defaultValue: z.string().optional()
516
- });
517
- var Color = z.object({
518
- ...common,
519
- control: z.literal("color"),
520
- type: z.literal("string"),
521
- defaultValue: z.string().optional()
522
- });
523
- var Boolean = z.object({
524
- ...common,
525
- control: z.literal("boolean"),
526
- type: z.literal("boolean"),
527
- defaultValue: z.boolean().optional()
528
- });
529
- var Radio = z.object({
530
- ...common,
531
- control: z.literal("radio"),
532
- type: z.literal("string"),
533
- defaultValue: z.string().optional(),
534
- options: z.array(z.string())
535
- });
536
- var InlineRadio = z.object({
537
- ...common,
538
- control: z.literal("inline-radio"),
539
- type: z.literal("string"),
540
- defaultValue: z.string().optional(),
541
- options: z.array(z.string())
542
- });
543
- var Select = z.object({
544
- ...common,
545
- control: z.literal("select"),
546
- type: z.literal("string"),
547
- defaultValue: z.string().optional(),
548
- options: z.array(z.string())
549
- });
550
- var Check = z.object({
551
- ...common,
552
- control: z.literal("check"),
553
- type: z.literal("string[]"),
554
- defaultValue: z.array(z.string()).optional(),
555
- options: z.array(z.string())
556
- });
557
- var InlineCheck = z.object({
558
- ...common,
559
- control: z.literal("inline-check"),
560
- type: z.literal("string[]"),
561
- defaultValue: z.array(z.string()).optional(),
562
- options: z.array(z.string())
563
- });
564
- var MultiSelect = z.object({
565
- ...common,
566
- control: z.literal("multi-select"),
567
- type: z.literal("string[]"),
568
- defaultValue: z.array(z.string()).optional(),
569
- options: z.array(z.string())
570
- });
571
- var File = z.object({
572
- ...common,
573
- control: z.literal("file"),
574
- type: z.literal("string"),
575
- defaultValue: z.string().optional(),
576
- /** https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept */
577
- accept: z.string().optional()
578
- });
579
- var Url = z.object({
580
- ...common,
581
- control: z.literal("url"),
582
- type: z.literal("string"),
583
- defaultValue: z.string().optional()
584
- });
585
- var Json = z.object({
586
- ...common,
587
- control: z.literal("json"),
588
- type: z.literal("json"),
589
- defaultValue: z.unknown().optional()
590
- });
591
- var Date = z.object({
592
- ...common,
593
- control: z.literal("date"),
594
- // @todo not sure what type should be here
595
- // (we don't support Date yet, added for completeness)
596
- type: z.literal("string"),
597
- defaultValue: z.string().optional()
598
- });
599
- var Action = z.object({
600
- ...common,
601
- control: z.literal("action"),
602
- type: z.literal("action"),
603
- defaultValue: z.undefined().optional()
604
- });
605
- var TextContent = z.object({
606
- ...common,
607
- control: z.literal("textContent"),
608
- type: z.literal("string"),
609
- defaultValue: z.string().optional()
610
- });
611
- var PropMeta = z.union([
612
- Number,
613
- Range,
614
- Text,
615
- Code,
616
- CodeText,
617
- Color,
618
- Boolean,
619
- Radio,
620
- InlineRadio,
621
- Select,
622
- MultiSelect,
623
- Check,
624
- InlineCheck,
625
- File,
626
- Url,
627
- Json,
628
- Date,
629
- Action,
630
- TextContent
631
- ]);
632
-
633
- // src/components/component-meta.ts
634
- import { z as z3 } from "zod";
635
-
636
- // src/embed-template.ts
637
- import { z as z2 } from "zod";
638
- import { nanoid } from "nanoid";
639
- import { titleCase } from "title-case";
640
- import { noCase } from "change-case";
641
- import {
642
- encodeDataSourceVariable,
643
- transpileExpression
644
- } from "@webstudio-is/sdk";
645
- import { StyleValue } from "@webstudio-is/css-engine";
646
- var EmbedTemplateText = z2.object({
647
- type: z2.literal("text"),
648
- value: z2.string(),
649
- placeholder: z2.boolean().optional()
650
- });
651
- var EmbedTemplateExpression = z2.object({
652
- type: z2.literal("expression"),
653
- value: z2.string()
654
- });
655
- var EmbedTemplateVariable = z2.object({
656
- alias: z2.optional(z2.string()),
657
- initialValue: z2.unknown()
658
- });
659
- var EmbedTemplateProp = z2.union([
660
- z2.object({
661
- type: z2.literal("number"),
662
- name: z2.string(),
663
- value: z2.number()
664
- }),
665
- z2.object({
666
- type: z2.literal("string"),
667
- name: z2.string(),
668
- value: z2.string()
669
- }),
670
- z2.object({
671
- type: z2.literal("boolean"),
672
- name: z2.string(),
673
- value: z2.boolean()
674
- }),
675
- z2.object({
676
- type: z2.literal("string[]"),
677
- name: z2.string(),
678
- value: z2.array(z2.string())
679
- }),
680
- z2.object({
681
- type: z2.literal("json"),
682
- name: z2.string(),
683
- value: z2.unknown()
684
- }),
685
- z2.object({
686
- type: z2.literal("expression"),
687
- name: z2.string(),
688
- code: z2.string()
689
- }),
690
- z2.object({
691
- type: z2.literal("parameter"),
692
- name: z2.string(),
693
- variableName: z2.string(),
694
- variableAlias: z2.optional(z2.string())
695
- }),
696
- z2.object({
697
- type: z2.literal("action"),
698
- name: z2.string(),
699
- value: z2.array(
700
- z2.object({
701
- type: z2.literal("execute"),
702
- args: z2.optional(z2.array(z2.string())),
703
- code: z2.string()
704
- })
705
- )
706
- })
707
- ]);
708
- var EmbedTemplateStyleDeclRaw = z2.object({
709
- // State selector, e.g. :hover
710
- state: z2.optional(z2.string()),
711
- property: z2.string(),
712
- value: StyleValue
713
- });
714
- var EmbedTemplateStyleDecl = EmbedTemplateStyleDeclRaw;
715
- var EmbedTemplateInstance = z2.lazy(
716
- () => z2.object({
717
- type: z2.literal("instance"),
718
- component: z2.string(),
719
- label: z2.optional(z2.string()),
720
- variables: z2.optional(z2.record(z2.string(), EmbedTemplateVariable)),
721
- props: z2.optional(z2.array(EmbedTemplateProp)),
722
- tokens: z2.optional(z2.array(z2.string())),
723
- styles: z2.optional(z2.array(EmbedTemplateStyleDecl)),
724
- children: WsEmbedTemplate
725
- })
726
- );
727
- var WsEmbedTemplate = z2.lazy(
728
- () => z2.array(
729
- z2.union([EmbedTemplateInstance, EmbedTemplateText, EmbedTemplateExpression])
730
- )
731
- );
732
- var getVariablValue = (value) => {
733
- if (typeof value === "string") {
734
- return { type: "string", value };
735
- }
736
- if (typeof value === "number") {
737
- return { type: "number", value };
738
- }
739
- if (typeof value === "boolean") {
740
- return { type: "boolean", value };
741
- }
742
- if (Array.isArray(value)) {
743
- return { type: "string[]", value };
744
- }
745
- return { type: "json", value };
746
- };
747
- var createInstancesFromTemplate = (treeTemplate, instances, props, dataSourceByRef, styleSourceSelections, styleSources, styles, metas, defaultBreakpointId, generateId) => {
748
- const parentChildren = [];
749
- for (const item of treeTemplate) {
750
- if (item.type === "instance") {
751
- const instanceId = generateId();
752
- if (item.variables) {
753
- for (const [name, variable] of Object.entries(item.variables)) {
754
- if (dataSourceByRef.has(name)) {
755
- throw Error(`${name} data source already defined`);
756
- }
757
- dataSourceByRef.set(name, {
758
- type: "variable",
759
- id: generateId(),
760
- scopeInstanceId: instanceId,
761
- name: variable.alias ?? name,
762
- value: getVariablValue(variable.initialValue)
763
- });
764
- }
765
- }
766
- if (item.props) {
767
- for (const prop of item.props) {
768
- const propId = generateId();
769
- if (prop.type === "expression") {
770
- props.push({
771
- id: propId,
772
- instanceId,
773
- name: prop.name,
774
- type: "expression",
775
- // replace all references with variable names
776
- value: transpileExpression({
777
- expression: prop.code,
778
- replaceVariable: (ref) => {
779
- const id = dataSourceByRef.get(ref)?.id ?? ref;
780
- return encodeDataSourceVariable(id);
781
- }
782
- })
783
- });
784
- continue;
785
- }
786
- if (prop.type === "action") {
787
- props.push({
788
- id: propId,
789
- instanceId,
790
- type: "action",
791
- name: prop.name,
792
- value: prop.value.map((value) => {
793
- const args = value.args ?? [];
794
- return {
795
- type: "execute",
796
- args,
797
- // replace all references with variable names
798
- code: transpileExpression({
799
- expression: value.code,
800
- replaceVariable: (ref) => {
801
- if (args.includes(ref)) {
802
- return;
803
- }
804
- const id = dataSourceByRef.get(ref)?.id ?? ref;
805
- return encodeDataSourceVariable(id);
806
- }
807
- })
808
- };
809
- })
810
- });
811
- continue;
812
- }
813
- if (prop.type === "parameter") {
814
- const dataSourceId = generateId();
815
- dataSourceByRef.set(prop.variableName, {
816
- type: "parameter",
817
- id: dataSourceId,
818
- scopeInstanceId: instanceId,
819
- name: prop.variableAlias ?? prop.variableName
820
- });
821
- props.push({
822
- id: propId,
823
- instanceId,
824
- name: prop.name,
825
- type: "parameter",
826
- // replace variable reference with variable id
827
- value: dataSourceId
828
- });
829
- continue;
830
- }
831
- props.push({ id: propId, instanceId, ...prop });
832
- }
833
- }
834
- const styleSourceIds = [];
835
- if (item.tokens) {
836
- const meta = metas.get(item.component);
837
- if (meta?.presetTokens) {
838
- for (const name of item.tokens) {
839
- const tokenValue = meta.presetTokens[name];
840
- if (tokenValue) {
841
- const styleSourceId = `${item.component}:${name}`;
842
- styleSourceIds.push(styleSourceId);
843
- styleSources.push({
844
- type: "token",
845
- id: styleSourceId,
846
- name: titleCase(noCase(name))
847
- });
848
- for (const styleDecl of tokenValue.styles) {
849
- styles.push({
850
- breakpointId: defaultBreakpointId,
851
- styleSourceId,
852
- state: styleDecl.state,
853
- property: styleDecl.property,
854
- value: styleDecl.value
855
- });
856
- }
857
- }
858
- }
859
- }
860
- }
861
- if (item.styles) {
862
- const styleSourceId = generateId();
863
- styleSources.push({
864
- type: "local",
865
- id: styleSourceId
866
- });
867
- styleSourceIds.push(styleSourceId);
868
- for (const styleDecl of item.styles) {
869
- styles.push({
870
- breakpointId: defaultBreakpointId,
871
- styleSourceId,
872
- state: styleDecl.state,
873
- property: styleDecl.property,
874
- value: styleDecl.value
875
- });
876
- }
877
- }
878
- if (styleSourceIds.length > 0) {
879
- styleSourceSelections.push({
880
- instanceId,
881
- values: styleSourceIds
882
- });
883
- }
884
- const instance = {
885
- type: "instance",
886
- id: instanceId,
887
- label: item.label,
888
- component: item.component,
889
- children: []
890
- };
891
- instances.push(instance);
892
- instance.children = createInstancesFromTemplate(
893
- item.children,
894
- instances,
895
- props,
896
- dataSourceByRef,
897
- styleSourceSelections,
898
- styleSources,
899
- styles,
900
- metas,
901
- defaultBreakpointId,
902
- generateId
903
- );
904
- parentChildren.push({
905
- type: "id",
906
- value: instanceId
907
- });
908
- }
909
- if (item.type === "text") {
910
- parentChildren.push({
911
- type: "text",
912
- value: item.value,
913
- placeholder: item.placeholder
914
- });
915
- }
916
- if (item.type === "expression") {
917
- parentChildren.push({
918
- type: "expression",
919
- // replace all references with variable names
920
- value: transpileExpression({
921
- expression: item.value,
922
- replaceVariable: (ref) => {
923
- const id = dataSourceByRef.get(ref)?.id ?? ref;
924
- return encodeDataSourceVariable(id);
925
- }
926
- })
927
- });
928
- }
929
- }
930
- return parentChildren;
931
- };
932
- var generateDataFromEmbedTemplate = (treeTemplate, metas, defaultBreakpointId, generateId = nanoid) => {
933
- const instances = [];
934
- const props = [];
935
- const dataSourceByRef = /* @__PURE__ */ new Map();
936
- const styleSourceSelections = [];
937
- const styleSources = [];
938
- const styles = [];
939
- const children = createInstancesFromTemplate(
940
- treeTemplate,
941
- instances,
942
- props,
943
- dataSourceByRef,
944
- styleSourceSelections,
945
- styleSources,
946
- styles,
947
- metas,
948
- defaultBreakpointId,
949
- generateId
950
- );
951
- return {
952
- children,
953
- instances,
954
- props,
955
- dataSources: Array.from(dataSourceByRef.values()),
956
- styleSourceSelections,
957
- styleSources,
958
- styles,
959
- assets: [],
960
- breakpoints: [],
961
- resources: []
962
- };
963
- };
964
- var namespaceEmbedTemplateComponents = (template, namespace, components) => {
965
- return template.map((item) => {
966
- if (item.type === "text") {
967
- return item;
968
- }
969
- if (item.type === "expression") {
970
- return item;
971
- }
972
- if (item.type === "instance") {
973
- const prefix = components.has(item.component) ? `${namespace}:` : "";
974
- return {
975
- ...item,
976
- component: `${prefix}${item.component}`,
977
- children: namespaceEmbedTemplateComponents(
978
- item.children,
979
- namespace,
980
- components
981
- )
982
- };
983
- }
984
- item;
985
- throw Error("Impossible case");
986
- });
987
- };
988
- var namespaceMeta = (meta, namespace, components) => {
989
- const newMeta = { ...meta };
990
- if (newMeta.requiredAncestors) {
991
- newMeta.requiredAncestors = newMeta.requiredAncestors.map(
992
- (component) => components.has(component) ? `${namespace}:${component}` : component
993
- );
994
- }
995
- if (newMeta.invalidAncestors) {
996
- newMeta.invalidAncestors = newMeta.invalidAncestors.map(
997
- (component) => components.has(component) ? `${namespace}:${component}` : component
998
- );
999
- }
1000
- if (newMeta.indexWithinAncestor) {
1001
- newMeta.indexWithinAncestor = components.has(newMeta.indexWithinAncestor) ? `${namespace}:${newMeta.indexWithinAncestor}` : newMeta.indexWithinAncestor;
1002
- }
1003
- if (newMeta.template) {
1004
- newMeta.template = namespaceEmbedTemplateComponents(
1005
- newMeta.template,
1006
- namespace,
1007
- components
1008
- );
1009
- }
1010
- return newMeta;
1011
- };
1012
-
1013
- // src/components/component-meta.ts
1014
- var WsComponentPropsMeta = z3.object({
1015
- props: z3.record(PropMeta),
1016
- // Props that will be always visible in properties panel.
1017
- initialProps: z3.array(z3.string()).optional()
1018
- });
1019
- var componentCategories = [
1020
- "general",
1021
- "text",
1022
- "data",
1023
- "media",
1024
- "forms",
1025
- "radix",
1026
- "xml",
1027
- "hidden",
1028
- "internal"
1029
- ];
1030
- var stateCategories = ["states", "component-states"];
1031
- var ComponentState = z3.object({
1032
- category: z3.enum(stateCategories).optional(),
1033
- selector: z3.string(),
1034
- label: z3.string()
1035
- });
1036
- var ComponentToken = z3.object({
1037
- variant: z3.optional(z3.string()),
1038
- styles: z3.array(EmbedTemplateStyleDecl)
1039
- });
1040
- var defaultStates = [
1041
- { selector: ":hover", label: "Hover" },
1042
- { selector: ":active", label: "Active" },
1043
- { selector: ":focus", label: "Focus" },
1044
- { selector: ":focus-visible", label: "Focus Visible" },
1045
- { selector: ":focus-within", label: "Focus Within" }
1046
- ];
1047
- var WsComponentMeta = z3.object({
1048
- category: z3.enum(componentCategories).optional(),
1049
- // container - can accept other components with dnd or be edited as text
1050
- // control - usually form controls like inputs, without children
1051
- // embed - images, videos or other embeddable components, without children
1052
- // rich-text-child - formatted text fragment, not listed in components list
1053
- type: z3.enum(["container", "control", "embed", "rich-text-child"]),
1054
- requiredAncestors: z3.optional(z3.array(z3.string())),
1055
- invalidAncestors: z3.optional(z3.array(z3.string())),
1056
- // when this field is specified component receives
1057
- // prop with index of same components withiin specified ancestor
1058
- // important to automatically enumerate collections without
1059
- // naming every item manually
1060
- indexWithinAncestor: z3.optional(z3.string()),
1061
- stylable: z3.optional(z3.boolean()),
1062
- // specifies whether the instance can be deleted,
1063
- // copied or dragged out of its parent instance
1064
- // true by default
1065
- detachable: z3.optional(z3.boolean()),
1066
- label: z3.optional(z3.string()),
1067
- description: z3.string().optional(),
1068
- icon: z3.string(),
1069
- presetStyle: z3.optional(
1070
- z3.record(z3.string(), z3.array(EmbedTemplateStyleDecl))
1071
- ),
1072
- presetTokens: z3.optional(z3.record(z3.string(), ComponentToken)),
1073
- states: z3.optional(z3.array(ComponentState)),
1074
- template: z3.optional(WsEmbedTemplate),
1075
- order: z3.number().optional()
1076
- });
1077
-
1078
- // src/instance-utils.ts
1079
- var getIndexesWithinAncestors = (metas, instances, rootIds) => {
1080
- const ancestors = /* @__PURE__ */ new Set();
1081
- for (const meta of metas.values()) {
1082
- if (meta.indexWithinAncestor !== void 0) {
1083
- ancestors.add(meta.indexWithinAncestor);
1084
- }
1085
- }
1086
- const indexes = /* @__PURE__ */ new Map();
1087
- const traverseInstances = (instances2, instanceId, latestIndexes2 = /* @__PURE__ */ new Map()) => {
1088
- const instance = instances2.get(instanceId);
1089
- if (instance === void 0) {
1090
- return;
1091
- }
1092
- const meta = metas.get(instance.component);
1093
- if (meta === void 0) {
1094
- return;
1095
- }
1096
- if (ancestors.has(instance.component)) {
1097
- latestIndexes2 = new Map(latestIndexes2);
1098
- latestIndexes2.set(instance.component, /* @__PURE__ */ new Map());
1099
- }
1100
- if (meta.indexWithinAncestor !== void 0) {
1101
- const ancestorIndexes = latestIndexes2.get(meta.indexWithinAncestor);
1102
- if (ancestorIndexes !== void 0) {
1103
- let index = ancestorIndexes.get(instance.component) ?? -1;
1104
- index += 1;
1105
- ancestorIndexes.set(instance.component, index);
1106
- indexes.set(instance.id, index);
1107
- }
1108
- }
1109
- for (const child of instance.children) {
1110
- if (child.type === "id") {
1111
- traverseInstances(instances2, child.value, latestIndexes2);
1112
- }
1113
- }
1114
- };
1115
- const latestIndexes = /* @__PURE__ */ new Map();
1116
- for (const instanceId of rootIds) {
1117
- traverseInstances(instances, instanceId, latestIndexes);
1118
- }
1119
- return indexes;
1120
- };
1121
-
1122
- // src/component-generator.ts
1123
- import {
1124
- parseComponentName as parseComponentName2,
1125
- generateExpression,
1126
- decodeDataSourceVariable,
1127
- transpileExpression as transpileExpression2
1128
- } from "@webstudio-is/sdk";
1129
- var generateAction = ({
1130
- scope,
1131
- prop,
1132
- dataSources,
1133
- usedDataSources
1134
- }) => {
1135
- const setters = /* @__PURE__ */ new Set();
1136
- let args = [];
1137
- let assignersCode = "";
1138
- for (const value of prop.value) {
1139
- args = value.args;
1140
- assignersCode += transpileExpression2({
1141
- expression: value.code,
1142
- executable: true,
1143
- replaceVariable: (identifier, assignee) => {
1144
- if (args?.includes(identifier)) {
1145
- return;
1146
- }
1147
- const depId = decodeDataSourceVariable(identifier);
1148
- const dep = depId ? dataSources.get(depId) : void 0;
1149
- if (dep) {
1150
- usedDataSources.set(dep.id, dep);
1151
- if (assignee) {
1152
- setters.add(dep);
1153
- }
1154
- const valueName = scope.getName(dep.id, dep.name);
1155
- return valueName;
1156
- }
1157
- console.error(`Unknown dependency "${identifier}"`);
1158
- }
1159
- });
1160
- assignersCode += `
1161
- `;
1162
- }
1163
- let settersCode = "";
1164
- for (const dataSource of setters) {
1165
- const valueName = scope.getName(dataSource.id, dataSource.name);
1166
- const setterName = scope.getName(
1167
- `set$${dataSource.id}`,
1168
- `set$${dataSource.name}`
1169
- );
1170
- settersCode += `${setterName}(${valueName})
1171
- `;
1172
- }
1173
- const argsList = args.map((arg) => `${arg}: any`).join(", ");
1174
- let generated = "";
1175
- generated += `(${argsList}) => {
1176
- `;
1177
- generated += assignersCode;
1178
- generated += settersCode;
1179
- generated += `}`;
1180
- return generated;
1181
- };
1182
- var generatePropValue = ({
1183
- scope,
1184
- prop,
1185
- dataSources,
1186
- usedDataSources
1187
- }) => {
1188
- if (prop.type === "asset" || prop.type === "page") {
1189
- return;
1190
- }
1191
- if (prop.type === "string" || prop.type === "number" || prop.type === "boolean" || prop.type === "string[]" || prop.type === "json") {
1192
- return JSON.stringify(prop.value);
1193
- }
1194
- if (prop.type === "parameter") {
1195
- const dataSource = dataSources.get(prop.value);
1196
- if (dataSource === void 0) {
1197
- return;
1198
- }
1199
- usedDataSources.set(dataSource.id, dataSource);
1200
- return scope.getName(dataSource.id, dataSource.name);
1201
- }
1202
- if (prop.type === "expression") {
1203
- return generateExpression({
1204
- expression: prop.value,
1205
- dataSources,
1206
- usedDataSources,
1207
- scope
1208
- });
1209
- }
1210
- if (prop.type === "action") {
1211
- return generateAction({ scope, prop, dataSources, usedDataSources });
1212
- }
1213
- if (prop.type === "resource") {
1214
- return JSON.stringify(scope.getName(prop.value, prop.name));
1215
- }
1216
- prop;
1217
- };
1218
- var generateJsxElement = ({
1219
- context = "jsx",
1220
- scope,
1221
- instance,
1222
- props,
1223
- dataSources,
1224
- usedDataSources,
1225
- indexesWithinAncestors,
1226
- children,
1227
- classesMap
1228
- }) => {
1229
- if (instance.component === descendantComponent) {
1230
- return "";
1231
- }
1232
- let generatedProps = "";
1233
- const index = indexesWithinAncestors.get(instance.id);
1234
- if (index !== void 0) {
1235
- generatedProps += `
1236
- ${indexAttribute}="${index}"`;
1237
- }
1238
- let conditionValue;
1239
- let collectionDataValue;
1240
- let collectionItemValue;
1241
- const classMapArray = classesMap?.get(instance.id);
1242
- const classes = classMapArray !== void 0 ? [JSON.stringify(classMapArray.join(" "))] : [];
1243
- for (const prop of props.values()) {
1244
- if (prop.instanceId !== instance.id) {
1245
- continue;
1246
- }
1247
- const propValue = generatePropValue({
1248
- scope,
1249
- prop,
1250
- dataSources,
1251
- usedDataSources
1252
- });
1253
- if (isAttributeNameSafe(prop.name) === false) {
1254
- continue;
1255
- }
1256
- if (prop.name === showAttribute) {
1257
- if (propValue === "true") {
1258
- continue;
1259
- }
1260
- if (propValue === "false") {
1261
- return "";
1262
- }
1263
- conditionValue = propValue;
1264
- continue;
1265
- }
1266
- if (instance.component === collectionComponent) {
1267
- if (prop.name === "data") {
1268
- collectionDataValue = propValue;
1269
- }
1270
- if (prop.name === "item") {
1271
- collectionItemValue = propValue;
1272
- }
1273
- continue;
1274
- }
1275
- if (prop.name === "className" && propValue !== void 0) {
1276
- classes.push(propValue);
1277
- continue;
1278
- }
1279
- if (propValue !== void 0) {
1280
- generatedProps += `
1281
- ${prop.name}={${propValue}}`;
1282
- }
1283
- }
1284
- if (classes.length !== 0) {
1285
- generatedProps += `
1286
- className={${classes.join(` + " " + `)}}`;
1287
- }
1288
- let generatedElement = "";
1289
- if (instance.component === collectionComponent) {
1290
- if (collectionDataValue === void 0 || collectionItemValue === void 0) {
1291
- return "";
1292
- }
1293
- const indexVariable = scope.getName(`${instance.id}-index`, "index");
1294
- generatedElement += `{${collectionDataValue}?.map((${collectionItemValue}: any, ${indexVariable}: number) =>
1295
- `;
1296
- generatedElement += `<Fragment key={${indexVariable}}>
1297
- `;
1298
- generatedElement += children;
1299
- generatedElement += `</Fragment>
1300
- `;
1301
- generatedElement += `)}
1302
- `;
1303
- } else {
1304
- const [_namespace, shortName] = parseComponentName2(instance.component);
1305
- const componentVariable = scope.getName(instance.component, shortName);
1306
- if (instance.children.length === 0) {
1307
- generatedElement += `<${componentVariable}${generatedProps} />
1308
- `;
1309
- } else {
1310
- generatedElement += `<${componentVariable}${generatedProps}>
1311
- `;
1312
- generatedElement += children;
1313
- generatedElement += `</${componentVariable}>
1314
- `;
1315
- }
1316
- }
1317
- if (conditionValue) {
1318
- let conditionalElement = "";
1319
- let before = "";
1320
- let after = "";
1321
- if (context === "jsx") {
1322
- before = "{";
1323
- after = "}";
1324
- }
1325
- conditionalElement += `${before}(${conditionValue}) &&
1326
- `;
1327
- if (instance.component === collectionComponent) {
1328
- conditionalElement += "<>\n";
1329
- conditionalElement += generatedElement;
1330
- conditionalElement += "</>\n";
1331
- } else {
1332
- conditionalElement += generatedElement;
1333
- }
1334
- conditionalElement += `${after}
1335
- `;
1336
- return conditionalElement;
1337
- }
1338
- return generatedElement;
1339
- };
1340
- var generateJsxChildren = ({
1341
- scope,
1342
- children,
1343
- instances,
1344
- props,
1345
- dataSources,
1346
- usedDataSources,
1347
- indexesWithinAncestors,
1348
- classesMap,
1349
- excludePlaceholders
1350
- }) => {
1351
- let generatedChildren = "";
1352
- for (const child of children) {
1353
- if (child.type === "text") {
1354
- if (excludePlaceholders && child.placeholder === true) {
1355
- continue;
1356
- }
1357
- generatedChildren += child.value.split("\n").map((line) => `{${JSON.stringify(line)}}
1358
- `).join(`<br />
1359
- `);
1360
- continue;
1361
- }
1362
- if (child.type === "expression") {
1363
- const expression = generateExpression({
1364
- expression: child.value,
1365
- dataSources,
1366
- usedDataSources,
1367
- scope
1368
- });
1369
- generatedChildren = `{${expression}}
1370
- `;
1371
- continue;
1372
- }
1373
- if (child.type === "id") {
1374
- const instanceId = child.value;
1375
- const instance = instances.get(instanceId);
1376
- if (instance === void 0) {
1377
- continue;
1378
- }
1379
- generatedChildren += generateJsxElement({
1380
- context: "jsx",
1381
- scope,
1382
- instance,
1383
- props,
1384
- dataSources,
1385
- usedDataSources,
1386
- indexesWithinAncestors,
1387
- classesMap,
1388
- children: generateJsxChildren({
1389
- classesMap,
1390
- scope,
1391
- children: instance.children,
1392
- instances,
1393
- props,
1394
- dataSources,
1395
- usedDataSources,
1396
- indexesWithinAncestors,
1397
- excludePlaceholders
1398
- })
1399
- });
1400
- continue;
1401
- }
1402
- child;
1403
- }
1404
- return generatedChildren;
1405
- };
1406
- var generateWebstudioComponent = ({
1407
- scope,
1408
- name,
1409
- rootInstanceId,
1410
- parameters,
1411
- instances,
1412
- props,
1413
- dataSources,
1414
- indexesWithinAncestors,
1415
- classesMap
1416
- }) => {
1417
- const instance = instances.get(rootInstanceId);
1418
- if (instance === void 0) {
1419
- return "";
1420
- }
1421
- const usedDataSources = /* @__PURE__ */ new Map();
1422
- const generatedJsx = generateJsxElement({
1423
- context: "expression",
1424
- scope,
1425
- instance,
1426
- props,
1427
- dataSources,
1428
- usedDataSources,
1429
- indexesWithinAncestors,
1430
- classesMap,
1431
- children: generateJsxChildren({
1432
- scope,
1433
- children: instance.children,
1434
- instances,
1435
- props,
1436
- dataSources,
1437
- usedDataSources,
1438
- indexesWithinAncestors,
1439
- classesMap
1440
- })
1441
- });
1442
- let generatedProps = "";
1443
- if (parameters.length > 0) {
1444
- let generatedPropsValue = "{ ";
1445
- let generatedPropsType = "{ ";
1446
- for (const parameter of parameters) {
1447
- const dataSource = usedDataSources.get(parameter.value);
1448
- if (dataSource) {
1449
- const valueName = scope.getName(dataSource.id, dataSource.name);
1450
- generatedPropsValue += `${parameter.name}: ${valueName}, `;
1451
- }
1452
- generatedPropsType += `${parameter.name}: any; `;
1453
- }
1454
- generatedPropsValue += `}`;
1455
- generatedPropsType += `}`;
1456
- generatedProps = `${generatedPropsValue}: ${generatedPropsType}`;
1457
- }
1458
- let generatedDataSources = "";
1459
- for (const dataSource of usedDataSources.values()) {
1460
- if (dataSource.type === "variable") {
1461
- const valueName = scope.getName(dataSource.id, dataSource.name);
1462
- const setterName = scope.getName(
1463
- `set$${dataSource.id}`,
1464
- `set$${dataSource.name}`
1465
- );
1466
- const initialValue = dataSource.value.value;
1467
- const initialValueString = JSON.stringify(initialValue);
1468
- generatedDataSources += `let [${valueName}, ${setterName}] = useVariableState<any>(${initialValueString})
1469
- `;
1470
- }
1471
- if (dataSource.type === "resource") {
1472
- const valueName = scope.getName(dataSource.id, dataSource.name);
1473
- const resourceName = scope.getName(
1474
- dataSource.resourceId,
1475
- dataSource.name
1476
- );
1477
- const resourceNameString = JSON.stringify(resourceName);
1478
- generatedDataSources += `let ${valueName} = useResource(${resourceNameString})
1479
- `;
1480
- }
1481
- }
1482
- let generatedComponent = "";
1483
- generatedComponent += `const ${name} = (${generatedProps}) => {
1484
- `;
1485
- generatedComponent += `${generatedDataSources}`;
1486
- generatedComponent += `return ${generatedJsx}`;
1487
- generatedComponent += `}
1488
- `;
1489
- return generatedComponent;
1490
- };
1491
- export {
1492
- EmbedTemplateInstance,
1493
- EmbedTemplateProp,
1494
- EmbedTemplateStyleDecl,
1495
- PropMeta,
1496
- WsComponentMeta,
1497
- WsEmbedTemplate,
1498
- addGlobalRules,
1499
- collapsedAttribute,
1500
- collectionComponent,
1501
- componentAttribute,
1502
- componentCategories,
1503
- coreMetas,
1504
- corePropsMetas,
1505
- createImageValueTransformer,
1506
- defaultStates,
1507
- descendantComponent,
1508
- generateCss,
1509
- generateDataFromEmbedTemplate,
1510
- generateJsxChildren,
1511
- generateJsxElement,
1512
- generateRemixParams,
1513
- generateRemixRoute,
1514
- generateWebstudioComponent,
1515
- getIndexesWithinAncestors,
1516
- idAttribute,
1517
- indexAttribute,
1518
- isAttributeNameSafe,
1519
- isCoreComponent,
1520
- namespaceMeta,
1521
- normalizeProps,
1522
- portalComponent,
1523
- rootComponent,
1524
- selectorIdAttribute,
1525
- showAttribute,
1526
- stateCategories,
1527
- textContentAttribute
1528
- };