@charisol/plexo-sdk 1.4.39 → 1.4.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/index.js +13431 -17791
  2. package/dist/plexo-sdk.css +1 -1
  3. package/dist/toReact-BBzjWoFG.js +595 -0
  4. package/dist/v2/ai/commands.d.ts +616 -0
  5. package/dist/v2/ai/dispatch.d.ts +24 -0
  6. package/dist/v2/ai/nodeSchema.d.ts +196 -0
  7. package/dist/v2/brand/BrandColorSwatches.d.ts +4 -0
  8. package/dist/v2/brand/BrandPanel.d.ts +4 -0
  9. package/dist/v2/brand/ChangeSetGallery.d.ts +10 -0
  10. package/dist/v2/brand/StyleSetEditor.d.ts +22 -0
  11. package/dist/v2/canvas/CatalogDragContext.d.ts +27 -0
  12. package/dist/v2/canvas/ContextMenuContext.d.ts +16 -0
  13. package/dist/v2/canvas/DeviceModeContext.d.ts +20 -0
  14. package/dist/v2/canvas/DragEngineContext.d.ts +13 -0
  15. package/dist/v2/canvas/LayoutGuideContext.d.ts +22 -0
  16. package/dist/v2/canvas/PreviewModeContext.d.ts +15 -0
  17. package/dist/v2/canvas/SidebarContext.d.ts +21 -0
  18. package/dist/v2/canvas/StylePainterContext.d.ts +19 -0
  19. package/dist/v2/canvas/WorkspaceThemeContext.d.ts +19 -0
  20. package/dist/v2/canvas/aiTextTransforms.d.ts +24 -0
  21. package/dist/v2/canvas/animationPresets.d.ts +12 -0
  22. package/dist/v2/canvas/constants.d.ts +6 -0
  23. package/dist/v2/canvas/layoutRoles.d.ts +12 -0
  24. package/dist/v2/canvas/modelRect.d.ts +4 -0
  25. package/dist/v2/canvas/rectMath.d.ts +34 -0
  26. package/dist/v2/canvas/reorderMath.d.ts +8 -0
  27. package/dist/v2/canvas/resizeMath.d.ts +16 -0
  28. package/dist/v2/canvas/resolveBoxStyle.d.ts +12 -0
  29. package/dist/v2/canvas/resolveTargetSection.d.ts +10 -0
  30. package/dist/v2/canvas/sectionDividerShapes.d.ts +12 -0
  31. package/dist/v2/canvas/snapping.d.ts +28 -0
  32. package/dist/v2/canvas/useAlignNode.d.ts +10 -0
  33. package/dist/v2/canvas/useClipboardKeyBinding.d.ts +7 -0
  34. package/dist/v2/canvas/useDeleteKeyBinding.d.ts +3 -0
  35. package/dist/v2/canvas/useDragEngine.d.ts +44 -0
  36. package/dist/v2/canvas/useDraggableNode.d.ts +30 -0
  37. package/dist/v2/canvas/useInlineTextEdit.d.ts +29 -0
  38. package/dist/v2/canvas/usePointerEngine.d.ts +22 -0
  39. package/dist/v2/canvas/useResizeHandle.d.ts +12 -0
  40. package/dist/v2/canvas/useResolvedTextStyles.d.ts +13 -0
  41. package/dist/v2/canvas/useSelectionRects.d.ts +13 -0
  42. package/dist/v2/canvas/useUndoRedoKeyBinding.d.ts +8 -0
  43. package/dist/v2/catalog/elementCatalog.d.ts +31 -0
  44. package/dist/v2/catalog/imagePreset.d.ts +7 -0
  45. package/dist/v2/compile/index.d.ts +15 -0
  46. package/dist/v2/compile/toReact.d.ts +32 -0
  47. package/dist/v2/components/AdornmentLayer.d.ts +20 -0
  48. package/dist/v2/components/AskSolPanel.d.ts +19 -0
  49. package/dist/v2/components/CatalogDragGhost.d.ts +6 -0
  50. package/dist/v2/components/CellBoundary.d.ts +14 -0
  51. package/dist/v2/components/CenterCanvas.d.ts +3 -0
  52. package/dist/v2/components/ContentTabPanel.d.ts +12 -0
  53. package/dist/v2/components/ContextMenu.d.ts +5 -0
  54. package/dist/v2/components/ContextualToolbar.d.ts +25 -0
  55. package/dist/v2/components/ImagesTabPanel.d.ts +15 -0
  56. package/dist/v2/components/LayoutGuidePanel.d.ts +10 -0
  57. package/dist/v2/components/ManageLayersPanel.d.ts +13 -0
  58. package/dist/v2/components/NodeRenderer.d.ts +8 -0
  59. package/dist/v2/components/PreviewOverlay.d.ts +11 -0
  60. package/dist/v2/components/ResizeHandle.d.ts +6 -0
  61. package/dist/v2/components/RightRail.d.ts +13 -0
  62. package/dist/v2/components/SectionDividerOverlay.d.ts +8 -0
  63. package/dist/v2/components/SectionEdgeAddZone.d.ts +17 -0
  64. package/dist/v2/components/SectionGridOverlay.d.ts +10 -0
  65. package/dist/v2/components/SectionNamePill.d.ts +6 -0
  66. package/dist/v2/components/SectionNode.d.ts +5 -0
  67. package/dist/v2/components/SectionSideRail.d.ts +17 -0
  68. package/dist/v2/components/SelectionToolbar.d.ts +11 -0
  69. package/dist/v2/components/StylePainterToast.d.ts +5 -0
  70. package/dist/v2/components/V2Canvas.d.ts +56 -0
  71. package/dist/v2/components/nodes/ButtonNode.d.ts +4 -0
  72. package/dist/v2/components/nodes/ContainerNode.d.ts +11 -0
  73. package/dist/v2/components/nodes/EmbedNode.d.ts +4 -0
  74. package/dist/v2/components/nodes/ImageNode.d.ts +4 -0
  75. package/dist/v2/components/nodes/InputNode.d.ts +4 -0
  76. package/dist/v2/components/nodes/MenuNode.d.ts +18 -0
  77. package/dist/v2/components/nodes/TextNode.d.ts +4 -0
  78. package/dist/v2/index.d.ts +12 -0
  79. package/dist/v2/inspector/AiQuickEditPanel.d.ts +12 -0
  80. package/dist/v2/inspector/AnimationPanel.d.ts +11 -0
  81. package/dist/v2/inspector/DesignAccordions.d.ts +7 -0
  82. package/dist/v2/inspector/FieldRenderer.d.ts +9 -0
  83. package/dist/v2/inspector/IconPopoverButton.d.ts +9 -0
  84. package/dist/v2/inspector/MenuIconPanel.d.ts +7 -0
  85. package/dist/v2/inspector/MenuManagePanel.d.ts +8 -0
  86. package/dist/v2/inspector/Popover.d.ts +21 -0
  87. package/dist/v2/inspector/SectionDividerPanel.d.ts +9 -0
  88. package/dist/v2/inspector/fieldStyles.d.ts +15 -0
  89. package/dist/v2/inspector/fields/ColorField.d.ts +7 -0
  90. package/dist/v2/inspector/fields/NumberField.d.ts +7 -0
  91. package/dist/v2/inspector/fields/SelectField.d.ts +7 -0
  92. package/dist/v2/inspector/fields/TextField.d.ts +7 -0
  93. package/dist/v2/inspector/fields/TextStyleField.d.ts +11 -0
  94. package/dist/v2/inspector/fields/TextareaField.d.ts +7 -0
  95. package/dist/v2/inspector/schema.d.ts +25 -0
  96. package/dist/v2/inspector/useFieldCommit.d.ts +12 -0
  97. package/dist/v2/store/brandDefaults.d.ts +4 -0
  98. package/dist/v2/store/brandTypes.d.ts +40 -0
  99. package/dist/v2/store/cloneSubtree.d.ts +12 -0
  100. package/dist/v2/store/createBrandStore.d.ts +2 -0
  101. package/dist/v2/store/createCanvasStore.d.ts +2 -0
  102. package/dist/v2/store/seed.d.ts +17 -0
  103. package/dist/v2/store/types.d.ts +163 -0
  104. package/dist/v2/ui/theme.d.ts +85 -0
  105. package/dist/v2-compile.js +9 -0
  106. package/dist/v2.js +8508 -0
  107. package/dist/zoom-in-DL4pfiLG.js +4461 -0
  108. package/package.json +11 -1
@@ -0,0 +1,595 @@
1
+ //#region src/v2/store/seed.ts
2
+ function e() {
3
+ return {
4
+ nodes: {
5
+ sec1: {
6
+ id: "sec1",
7
+ type: "Section",
8
+ parentId: null,
9
+ children: [
10
+ "sec1-heading",
11
+ "sec1-body",
12
+ "sec1-btn"
13
+ ],
14
+ props: { name: "Hero" },
15
+ styles: {
16
+ backgroundColor: "#0f172a",
17
+ height: 420
18
+ }
19
+ },
20
+ "sec1-heading": {
21
+ id: "sec1-heading",
22
+ type: "Text",
23
+ parentId: "sec1",
24
+ children: [],
25
+ props: { content: "Light That Listens" },
26
+ styles: {
27
+ x: 48,
28
+ y: 48,
29
+ width: 480,
30
+ height: 110,
31
+ fontSize: 48,
32
+ color: "#e2f65a",
33
+ fontWeight: "bold"
34
+ }
35
+ },
36
+ "sec1-body": {
37
+ id: "sec1-body",
38
+ type: "Text",
39
+ parentId: "sec1",
40
+ children: [],
41
+ props: { content: "A smart ambient mood orchestrator that adapts to your life." },
42
+ styles: {
43
+ x: 48,
44
+ y: 168,
45
+ width: 440,
46
+ height: 60,
47
+ fontSize: 18,
48
+ color: "#e2e8f0"
49
+ }
50
+ },
51
+ "sec1-btn": {
52
+ id: "sec1-btn",
53
+ type: "Button",
54
+ parentId: "sec1",
55
+ children: [],
56
+ props: {
57
+ label: "Pre-order now",
58
+ href: "#"
59
+ },
60
+ styles: {
61
+ x: 48,
62
+ y: 248,
63
+ width: 180,
64
+ height: 44,
65
+ backgroundColor: "#e2f65a",
66
+ color: "#0f172a",
67
+ borderRadius: 999
68
+ }
69
+ },
70
+ sec2: {
71
+ id: "sec2",
72
+ type: "Section",
73
+ parentId: null,
74
+ children: ["sec2-container", "sec2-btn"],
75
+ props: { name: "Feature" },
76
+ styles: {
77
+ backgroundColor: "#4b5320",
78
+ height: 420
79
+ }
80
+ },
81
+ "sec2-container": {
82
+ id: "sec2-container",
83
+ type: "Container",
84
+ parentId: "sec2",
85
+ children: ["sec2-cell-image", "sec2-cell-text"],
86
+ props: {},
87
+ styles: {
88
+ y: 48,
89
+ height: 300,
90
+ gap: 32,
91
+ containerRole: "row"
92
+ }
93
+ },
94
+ "sec2-cell-image": {
95
+ id: "sec2-cell-image",
96
+ type: "Container",
97
+ parentId: "sec2-container",
98
+ children: ["sec2-image"],
99
+ props: {},
100
+ styles: { containerRole: "cell" }
101
+ },
102
+ "sec2-image": {
103
+ id: "sec2-image",
104
+ type: "Image",
105
+ parentId: "sec2-cell-image",
106
+ children: [],
107
+ props: {
108
+ src: "https://placehold.co/360x240",
109
+ alt: "Darle Lumina lighting fixture"
110
+ },
111
+ styles: { borderRadius: 12 }
112
+ },
113
+ "sec2-cell-text": {
114
+ id: "sec2-cell-text",
115
+ type: "Container",
116
+ parentId: "sec2-container",
117
+ children: ["sec2-text"],
118
+ props: {},
119
+ styles: { containerRole: "cell" }
120
+ },
121
+ "sec2-text": {
122
+ id: "sec2-text",
123
+ type: "Text",
124
+ parentId: "sec2-cell-text",
125
+ children: [],
126
+ props: { content: "Is your lighting in tune with you?" },
127
+ styles: {
128
+ fontSize: 24,
129
+ color: "#f7f7d5"
130
+ }
131
+ },
132
+ "sec2-btn": {
133
+ id: "sec2-btn",
134
+ type: "Button",
135
+ parentId: "sec2",
136
+ children: [],
137
+ props: {
138
+ label: "Learn more",
139
+ href: "#"
140
+ },
141
+ styles: {
142
+ x: 48,
143
+ y: 352,
144
+ width: 160,
145
+ height: 44,
146
+ backgroundColor: "#f7f7d5",
147
+ color: "#4b5320",
148
+ borderRadius: 999
149
+ }
150
+ }
151
+ },
152
+ pageOrder: ["sec1", "sec2"]
153
+ };
154
+ }
155
+ //#endregion
156
+ //#region src/v2/canvas/modelRect.ts
157
+ function t(e) {
158
+ let { x: t, y: n, width: r, height: i } = e.styles;
159
+ return {
160
+ x: typeof t == "number" ? t : 0,
161
+ y: typeof n == "number" ? n : 0,
162
+ width: typeof r == "number" ? r : 0,
163
+ height: typeof i == "number" ? i : 0
164
+ };
165
+ }
166
+ //#endregion
167
+ //#region src/v2/store/brandDefaults.ts
168
+ var n = [{
169
+ id: "pill",
170
+ label: "Pill",
171
+ slots: [
172
+ {
173
+ id: "primary",
174
+ label: "Primary",
175
+ styles: {
176
+ backgroundColor: "#e2f65a",
177
+ color: "#0f172a",
178
+ borderRadius: 999
179
+ }
180
+ },
181
+ {
182
+ id: "secondary",
183
+ label: "Secondary",
184
+ styles: {
185
+ backgroundColor: "#ffffff",
186
+ color: "#0f172a",
187
+ borderRadius: 999
188
+ }
189
+ },
190
+ {
191
+ id: "tertiary",
192
+ label: "Tertiary",
193
+ styles: {
194
+ backgroundColor: "transparent",
195
+ color: "#0f172a",
196
+ borderRadius: 999
197
+ }
198
+ }
199
+ ]
200
+ }, {
201
+ id: "sharp",
202
+ label: "Sharp",
203
+ slots: [
204
+ {
205
+ id: "primary",
206
+ label: "Primary",
207
+ styles: {
208
+ backgroundColor: "#e2f65a",
209
+ color: "#0f172a",
210
+ borderRadius: 2
211
+ }
212
+ },
213
+ {
214
+ id: "secondary",
215
+ label: "Secondary",
216
+ styles: {
217
+ backgroundColor: "#ffffff",
218
+ color: "#0f172a",
219
+ borderRadius: 2
220
+ }
221
+ },
222
+ {
223
+ id: "tertiary",
224
+ label: "Tertiary",
225
+ styles: {
226
+ backgroundColor: "transparent",
227
+ color: "#0f172a",
228
+ borderRadius: 2
229
+ }
230
+ }
231
+ ]
232
+ }], r = [{
233
+ id: "rounded",
234
+ label: "Rounded",
235
+ slots: [{
236
+ id: "box1",
237
+ label: "Box 1",
238
+ styles: {
239
+ backgroundColor: "#4b5320",
240
+ borderRadius: 16
241
+ }
242
+ }, {
243
+ id: "box2",
244
+ label: "Box 2",
245
+ styles: {
246
+ backgroundColor: "#0f172a",
247
+ borderRadius: 8
248
+ }
249
+ }]
250
+ }, {
251
+ id: "sharp-box",
252
+ label: "Sharp",
253
+ slots: [{
254
+ id: "box1",
255
+ label: "Box 1",
256
+ styles: {
257
+ backgroundColor: "#4b5320",
258
+ borderRadius: 0
259
+ }
260
+ }, {
261
+ id: "box2",
262
+ label: "Box 2",
263
+ styles: {
264
+ backgroundColor: "#0f172a",
265
+ borderRadius: 2
266
+ }
267
+ }]
268
+ }], i = [{
269
+ id: "default",
270
+ label: "Default",
271
+ slots: [
272
+ {
273
+ id: "heading1",
274
+ label: "Heading 1",
275
+ styles: {
276
+ fontSize: 48,
277
+ fontWeight: "bold",
278
+ lineHeight: 1.1
279
+ }
280
+ },
281
+ {
282
+ id: "heading2",
283
+ label: "Heading 2",
284
+ styles: {
285
+ fontSize: 36,
286
+ fontWeight: "bold",
287
+ lineHeight: 1.15
288
+ }
289
+ },
290
+ {
291
+ id: "heading3",
292
+ label: "Heading 3",
293
+ styles: {
294
+ fontSize: 28,
295
+ fontWeight: "bold",
296
+ lineHeight: 1.2
297
+ }
298
+ },
299
+ {
300
+ id: "heading4",
301
+ label: "Heading 4",
302
+ styles: {
303
+ fontSize: 22,
304
+ fontWeight: "bold",
305
+ lineHeight: 1.25
306
+ }
307
+ },
308
+ {
309
+ id: "heading5",
310
+ label: "Heading 5",
311
+ styles: {
312
+ fontSize: 18,
313
+ fontWeight: "bold",
314
+ lineHeight: 1.3
315
+ }
316
+ },
317
+ {
318
+ id: "heading6",
319
+ label: "Heading 6",
320
+ styles: {
321
+ fontSize: 16,
322
+ fontWeight: "bold",
323
+ lineHeight: 1.3
324
+ }
325
+ },
326
+ {
327
+ id: "paragraph1",
328
+ label: "Paragraph 1",
329
+ styles: {
330
+ fontSize: 18,
331
+ fontWeight: "normal",
332
+ lineHeight: 1.5
333
+ }
334
+ },
335
+ {
336
+ id: "paragraph2",
337
+ label: "Paragraph 2",
338
+ styles: {
339
+ fontSize: 16,
340
+ fontWeight: "normal",
341
+ lineHeight: 1.5
342
+ }
343
+ },
344
+ {
345
+ id: "paragraph3",
346
+ label: "Paragraph 3",
347
+ styles: {
348
+ fontSize: 14,
349
+ fontWeight: "normal",
350
+ lineHeight: 1.5
351
+ }
352
+ }
353
+ ]
354
+ }];
355
+ //#endregion
356
+ //#region src/v2/canvas/layoutRoles.ts
357
+ function a(e, t, n) {
358
+ return e === "Container" && t === "Section" && n?.containerRole === "row";
359
+ }
360
+ //#endregion
361
+ //#region src/v2/canvas/resolveBoxStyle.ts
362
+ var o = {
363
+ none: "none",
364
+ sm: "0 1px 3px rgba(15,23,42,0.14)",
365
+ md: "0 6px 16px rgba(15,23,42,0.18)",
366
+ lg: "0 16px 40px rgba(15,23,42,0.24)"
367
+ }, s = [
368
+ "none",
369
+ "sm",
370
+ "md",
371
+ "lg"
372
+ ], c = [
373
+ "solid",
374
+ "dashed",
375
+ "dotted"
376
+ ];
377
+ function l(e) {
378
+ let t = { overflow: "hidden" }, n = typeof e.borderWidth == "number" ? e.borderWidth : 0, r = e.borderStyle || "solid";
379
+ n > 0 && (t.border = `${n}px ${r} ${e.borderColor || "#0f172a"}`), typeof e.borderRadius == "number" && (t.borderRadius = e.borderRadius);
380
+ let i = e.boxShadowPreset || "none";
381
+ return i !== "none" && o[i] && (t.boxShadow = o[i]), t;
382
+ }
383
+ //#endregion
384
+ //#region src/v2/compile/toReact.ts
385
+ var u = 1400, d = 400, f = /^[A-Z][A-Za-z0-9_]*$/;
386
+ function p(e) {
387
+ return JSON.stringify(e);
388
+ }
389
+ function m(e) {
390
+ return `{${p(Object.fromEntries(Object.entries(e).filter(([, e]) => e != null && e !== "")))}}`;
391
+ }
392
+ function h(e, n) {
393
+ let r = t(e);
394
+ if (a(e.type, n?.type, e.styles)) return {
395
+ position: "absolute",
396
+ left: 0,
397
+ right: 0,
398
+ top: r.y,
399
+ height: r.height
400
+ };
401
+ if (n?.type === "Container") {
402
+ let t = typeof e.styles.width == "number", n = typeof e.styles.height == "number";
403
+ return {
404
+ position: "relative",
405
+ flex: t ? `0 0 ${r.width}px` : "1 1 0%",
406
+ width: t ? r.width : void 0,
407
+ height: n ? r.height : "100%"
408
+ };
409
+ }
410
+ return {
411
+ position: "absolute",
412
+ left: r.x,
413
+ top: r.y,
414
+ width: r.width,
415
+ height: r.height
416
+ };
417
+ }
418
+ function g(e, t = "#") {
419
+ if (!e) return t;
420
+ let n = e.trim();
421
+ return /^(https?:|mailto:|tel:|\/|#)/i.test(n) ? n : t;
422
+ }
423
+ function _(e, t, n, r) {
424
+ let i = e[t];
425
+ if (!i) return "";
426
+ let a = i.parentId ? e[i.parentId] : void 0, o = " ".repeat(r), s = l(i.styles), c = h(i, a), u = i.styles;
427
+ switch (i.type) {
428
+ case "Text": {
429
+ let e = [
430
+ "p",
431
+ "span",
432
+ "h1",
433
+ "h2",
434
+ "h3",
435
+ "h4",
436
+ "h5",
437
+ "h6"
438
+ ].includes(String(u.htmlTag)) ? String(u.htmlTag) : "p", t = u.textStyleRef ? n.textStyles?.[String(u.textStyleRef)] : void 0;
439
+ return `${o}<${e} style=${m({
440
+ ...c,
441
+ fontSize: t?.fontSize ?? u.fontSize,
442
+ fontWeight: t?.fontWeight ?? u.fontWeight,
443
+ lineHeight: t?.lineHeight,
444
+ color: u.color,
445
+ textAlign: u.textAlign,
446
+ margin: 0,
447
+ ...s
448
+ })}>{${p(i.props.content)}}</${e}>`;
449
+ }
450
+ case "Image": {
451
+ let e = {
452
+ ...c,
453
+ objectFit: u.objectFit || "cover",
454
+ display: "block",
455
+ ...s
456
+ };
457
+ return `${o}<img src=${p(i.props.src)} alt=${p(i.props.alt ?? "")} loading="lazy" style=${m(e)} />`;
458
+ }
459
+ case "Button": {
460
+ let e = {
461
+ ...c,
462
+ display: "inline-flex",
463
+ alignItems: "center",
464
+ justifyContent: u.textAlign === "left" ? "flex-start" : u.textAlign === "right" ? "flex-end" : "center",
465
+ backgroundColor: u.backgroundColor,
466
+ color: u.color,
467
+ fontWeight: u.fontWeight ?? 600,
468
+ textDecoration: "none",
469
+ border: "none",
470
+ cursor: "pointer",
471
+ ...s
472
+ };
473
+ return i.props.href ? `${o}<a href=${p(g(i.props.href))} style=${m(e)}>{${p(i.props.label)}}</a>` : `${o}<button type="button" style=${m(e)}>{${p(i.props.label)}}</button>`;
474
+ }
475
+ case "Container": {
476
+ let t = {
477
+ ...c,
478
+ display: "flex",
479
+ flexDirection: "row",
480
+ gap: typeof u.gap == "number" ? u.gap : void 0,
481
+ backgroundColor: u.backgroundColor,
482
+ ...s
483
+ }, a = i.children.map((t) => _(e, t, n, r + 1)).filter(Boolean);
484
+ return a.length ? `${o}<div style=${m(t)}>\n${a.join("\n")}\n${o}</div>` : `${o}<div style=${m(t)} />`;
485
+ }
486
+ case "Input": {
487
+ let e = {
488
+ width: "100%",
489
+ padding: "10px 12px",
490
+ borderRadius: 8,
491
+ border: "1px solid #cbd5e1",
492
+ font: "inherit"
493
+ }, t = i.props.fieldType === "textarea" ? `<textarea name=${p(i.props.label)} placeholder=${p(i.props.placeholder ?? "")}${i.props.required ? " required" : ""} style=${m({
494
+ ...e,
495
+ height: "100%",
496
+ resize: "none"
497
+ })} />` : `<input type=${p(i.props.fieldType)} name=${p(i.props.label)} placeholder=${p(i.props.placeholder ?? "")}${i.props.required ? " required" : ""} style=${m(e)} />`;
498
+ return `${o}<label style=${m({
499
+ ...c,
500
+ display: "flex",
501
+ flexDirection: "column",
502
+ gap: 6,
503
+ fontSize: 14,
504
+ color: u.color
505
+ })}>\n${o} <span>{${p(i.props.label)}}</span>\n${o} ${t}\n${o}</label>`;
506
+ }
507
+ case "Embed": return i.props.kind === "video" ? `${o}<video src=${p(g(i.props.url, ""))}${i.props.coverImage ? ` poster=${p(i.props.coverImage)}` : ""} controls playsInline style=${m({
508
+ ...c,
509
+ objectFit: "cover",
510
+ ...s
511
+ })} />` : `${o}<iframe title="Embedded content" sandbox="allow-scripts allow-popups allow-forms" srcDoc=${p(i.props.html ?? "")} style=${m({
512
+ ...c,
513
+ border: "none",
514
+ ...s
515
+ })} />`;
516
+ case "Menu": {
517
+ let e = i.props.layout === "vertical", t = i.props.links.map((e) => `${o} <a href=${p(g(e.href))} style=${m({
518
+ color: u.color,
519
+ textDecoration: "none",
520
+ fontSize: u.fontSize,
521
+ fontWeight: u.fontWeight
522
+ })}>{${p(e.label)}}</a>`).join("\n");
523
+ return `${o}<nav style=${m({
524
+ ...c,
525
+ display: "flex",
526
+ flexDirection: e ? "column" : "row",
527
+ alignItems: e ? "flex-start" : "center",
528
+ gap: typeof u.gap == "number" ? u.gap : 24,
529
+ ...s
530
+ })}>\n${t}\n${o}</nav>`;
531
+ }
532
+ default: return "";
533
+ }
534
+ }
535
+ function v(e, t, n) {
536
+ let r = t.styles, i = typeof r.height == "number" ? r.height : d, a = r.pinned === "true", o = {
537
+ position: a ? "sticky" : "relative",
538
+ top: a ? 0 : void 0,
539
+ zIndex: a ? 50 : void 0,
540
+ backgroundColor: r.backgroundColor,
541
+ backgroundImage: r.backgroundImage ? `url(${JSON.stringify(String(r.backgroundImage))})` : void 0,
542
+ backgroundSize: r.backgroundImage ? "cover" : void 0,
543
+ backgroundPosition: r.backgroundImage ? "center" : void 0,
544
+ ...l(r)
545
+ }, s = t.children.map((t) => _(e, t, n, 4)).filter(Boolean).join("\n");
546
+ return `${t.props.name ? ` {/* ${t.props.name.replace(/\*\//g, "* /")} */}\n` : ""} <section data-section=${p(t.props.name ?? t.id)} style=${m(o)}>
547
+ <FitToWidth height={${i}}>
548
+ ${s}
549
+ </FitToWidth>
550
+ </section>`;
551
+ }
552
+ function y(e, t, n) {
553
+ if (!f.test(n.componentName)) throw Error(`"${n.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
554
+ let r = t.map((t) => e[t]).filter((e) => !!e && e.type === "Section").map((t) => v(e, t, n)).join("\n");
555
+ return `// Generated by Plexo from a visual design. Edit it visually in the app editor's Design view
556
+ // (which regenerates this file), or turn it into regular code by editing here.
557
+ import { useEffect, useRef, useState, type ReactNode } from "react";
558
+
559
+ const DESIGN_WIDTH = ${u};
560
+
561
+ /** Lays a section out exactly as designed at ${u}px, scaled down to fit narrower screens. */
562
+ function FitToWidth({ height, children }: { height: number; children: ReactNode }) {
563
+ const ref = useRef<HTMLDivElement>(null);
564
+ const [scale, setScale] = useState(1);
565
+ useEffect(() => {
566
+ const el = ref.current;
567
+ if (!el) return;
568
+ const observer = new ResizeObserver(([entry]) => setScale(Math.min(1, entry.contentRect.width / DESIGN_WIDTH)));
569
+ observer.observe(el);
570
+ return () => observer.disconnect();
571
+ }, []);
572
+ return (
573
+ <div ref={ref} style={{ width: "100%", height: height * scale, overflow: "hidden" }}>
574
+ <div style={{ position: "relative", width: DESIGN_WIDTH, maxWidth: "none", height, margin: "0 auto", transform: \`scale(\${scale})\`, transformOrigin: "top left" }}>
575
+ {children}
576
+ </div>
577
+ </div>
578
+ );
579
+ }
580
+
581
+ export default function ${n.componentName}() {
582
+ return (
583
+ <div>
584
+ ${r}
585
+ </div>
586
+ );
587
+ }
588
+ `;
589
+ }
590
+ function b(e) {
591
+ let t = e.replace(/[^A-Za-z0-9]+/g, " ").trim().split(" ").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join("");
592
+ return /^[A-Z]/.test(t) ? t : `Design${t}`;
593
+ }
594
+ //#endregion
595
+ export { s as a, r as c, t as d, e as f, c as i, n as l, y as n, l as o, b as r, a as s, u as t, i as u };