@charisol/plexo-sdk 1.4.42 → 2.0.1

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 (254) hide show
  1. package/README.md +72 -0
  2. package/dist/InlineColorPicker-8ewm1Asx.js +2912 -0
  3. package/dist/client-DlVJt_6V.js +339 -0
  4. package/dist/colorUtils-ohNG3v1i.js +222 -0
  5. package/dist/columnOrder-f5-VOg2T.js +11 -0
  6. package/dist/{compiler-BvseEhDC.js → compiler-Dhpsq71h.js} +121 -120
  7. package/dist/compiler.js +1 -1
  8. package/dist/{compilerClient-BIrZIgfG.js → compilerClient-BC4TGAr9.js} +93 -92
  9. package/dist/compilerClient.js +1 -1
  10. package/dist/{iconSvgStatic-CGue7nyp.js → iconSvgStatic-Lnpg27U9.js} +66 -75
  11. package/dist/index.js +14042 -15423
  12. package/dist/legacy-71dHsiAM.js +16088 -0
  13. package/dist/lint-D-2x-Yeb.js +225 -0
  14. package/dist/{mjmlBrowser-DWk0mRD6.js → mjmlBrowser-wlHcAT8n.js} +2 -2
  15. package/dist/plexo-sdk.css +1 -1
  16. package/dist/rolldown-runtime-B1bRi_D7.js +27 -0
  17. package/dist/sanitize.js +1 -1
  18. package/dist/{sanitizeCompiledHtml-CNjUXlMK.js → sanitizeCompiledHtml-GgGsetm3.js} +673 -698
  19. package/dist/{zoom-in-DL4pfiLG.js → schemas-Bq5o5MfF.js} +916 -2120
  20. package/dist/utilities/colorUtils.d.ts +35 -0
  21. package/dist/utilities/playground.interfaces.d.ts +19 -1
  22. package/dist/v2/V2Editor.d.ts +25 -0
  23. package/dist/v2/compile/build.d.ts +38 -0
  24. package/dist/v2/compile/html.d.ts +18 -0
  25. package/dist/v2/compile/index.d.ts +28 -15
  26. package/dist/v2/compile/react.d.ts +17 -0
  27. package/dist/v2/compile/schema.d.ts +16 -0
  28. package/dist/v2/components/canvas/AlignmentGuidesOverlay.d.ts +7 -0
  29. package/dist/v2/components/canvas/CanvasArea.d.ts +2 -0
  30. package/dist/v2/components/canvas/CanvasControls.d.ts +2 -0
  31. package/dist/v2/components/canvas/ContextualToolbar.d.ts +7 -0
  32. package/dist/v2/components/canvas/DropIndicator.d.ts +6 -0
  33. package/dist/v2/components/canvas/IrView.d.ts +12 -0
  34. package/dist/v2/components/canvas/NodeRenderer.d.ts +12 -0
  35. package/dist/v2/components/canvas/PageFrame.d.ts +9 -0
  36. package/dist/v2/components/canvas/ResizeHandles.d.ts +8 -0
  37. package/dist/v2/components/canvas/SectionToolbar.d.ts +6 -0
  38. package/dist/v2/components/canvas/SpacingOverlay.d.ts +7 -0
  39. package/dist/v2/components/design/AutoUpdateWatcher.d.ts +7 -0
  40. package/dist/v2/components/design/DesignSystemPanel.d.ts +7 -0
  41. package/dist/v2/components/design/ReviewView.d.ts +7 -0
  42. package/dist/v2/components/design/StrataCard.d.ts +8 -0
  43. package/dist/v2/components/design/TidyView.d.ts +15 -0
  44. package/dist/v2/components/design/bits.d.ts +20 -0
  45. package/dist/v2/components/design/useStrataSync.d.ts +51 -0
  46. package/dist/v2/components/layout/ContextMenu.d.ts +2 -0
  47. package/dist/v2/components/layout/EditorShell.d.ts +2 -0
  48. package/dist/v2/components/layout/LeftToolRail.d.ts +2 -0
  49. package/dist/v2/components/layout/PreviewOverlay.d.ts +6 -0
  50. package/dist/v2/components/layout/TopToolbar.d.ts +2 -0
  51. package/dist/v2/components/modals/SettingsModal.d.ts +7 -0
  52. package/dist/v2/components/modals/ShortcutsModal.d.ts +7 -0
  53. package/dist/v2/components/properties/ColorField.d.ts +14 -0
  54. package/dist/v2/components/properties/ElementSettings.d.ts +39 -0
  55. package/dist/v2/components/properties/LinkField.d.ts +26 -0
  56. package/dist/v2/components/properties/PageInspector.d.ts +2 -0
  57. package/dist/v2/components/properties/PropertiesPanel.d.ts +2 -0
  58. package/dist/v2/components/properties/SectionSettings.d.ts +6 -0
  59. package/dist/v2/components/properties/sections/ConstraintsSection.d.ts +7 -0
  60. package/dist/v2/components/properties/sections/LayoutDiagnostics.d.ts +7 -0
  61. package/dist/v2/components/sections/BlockInspector.d.ts +9 -0
  62. package/dist/v2/components/sections/FieldForm.d.ts +14 -0
  63. package/dist/v2/components/sections/ManagedChildNotice.d.ts +7 -0
  64. package/dist/v2/components/sections/SectionThumb.d.ts +11 -0
  65. package/dist/v2/components/sidebar/FlyoutDrawer.d.ts +2 -0
  66. package/dist/v2/components/sidebar/InsertPanel.d.ts +2 -0
  67. package/dist/v2/components/sidebar/LayersPanel.d.ts +2 -0
  68. package/dist/v2/components/sidebar/LibraryPanel.d.ts +3 -0
  69. package/dist/v2/components/sidebar/PagesPanel.d.ts +2 -0
  70. package/dist/v2/components/sidebar/SectionsPanel.d.ts +6 -0
  71. package/dist/v2/components/sidebar/SolPanel.d.ts +3 -0
  72. package/dist/v2/components/sidebar/TemplateChooser.d.ts +13 -0
  73. package/dist/v2/context/BlockContext.d.ts +7 -0
  74. package/dist/v2/context/EditorContext.d.ts +213 -0
  75. package/dist/v2/context/FrameContext.d.ts +3 -0
  76. package/dist/v2/context/ParentLayoutContext.d.ts +10 -0
  77. package/dist/v2/context/PlacementContext.d.ts +4 -0
  78. package/dist/v2/data/blankPage.d.ts +3 -0
  79. package/dist/v2/data/insertableComponents.d.ts +17 -0
  80. package/dist/v2/data/samplePageData.d.ts +3 -0
  81. package/dist/v2/design/audit.d.ts +78 -0
  82. package/dist/v2/design/baseline.d.ts +3 -0
  83. package/dist/v2/design/baselineData.d.ts +3 -0
  84. package/dist/v2/design/components.d.ts +9 -0
  85. package/dist/v2/design/css.d.ts +16 -0
  86. package/dist/v2/design/fonts.d.ts +10 -0
  87. package/dist/v2/design/index.d.ts +11 -0
  88. package/dist/v2/design/lint.d.ts +22 -0
  89. package/dist/v2/design/shades.d.ts +15 -0
  90. package/dist/v2/design/textStyles.d.ts +29 -0
  91. package/dist/v2/design/themes.d.ts +35 -0
  92. package/dist/v2/design/tokens.d.ts +24 -0
  93. package/dist/v2/design/types.d.ts +81 -0
  94. package/dist/v2/host/HostContext.d.ts +176 -0
  95. package/dist/v2/host/SolMark.d.ts +8 -0
  96. package/dist/v2/index.d.ts +19 -11
  97. package/dist/v2/migrate/legacy.d.ts +26 -0
  98. package/dist/v2/render/adapt.d.ts +12 -0
  99. package/dist/v2/render/anchors.d.ts +7 -0
  100. package/dist/v2/render/elementCss.d.ts +7 -0
  101. package/dist/v2/render/elementProps.d.ts +92 -0
  102. package/dist/v2/render/elements.d.ts +32 -0
  103. package/dist/v2/render/formAction.d.ts +33 -0
  104. package/dist/v2/render/frames.d.ts +10 -0
  105. package/dist/v2/render/iconSet.d.ts +5 -0
  106. package/dist/v2/render/ir.d.ts +20 -0
  107. package/dist/v2/render/nodeStyle.d.ts +24 -0
  108. package/dist/v2/render/placement.d.ts +12 -0
  109. package/dist/v2/render/resolve.d.ts +3 -0
  110. package/dist/v2/render/runtime.d.ts +18 -0
  111. package/dist/v2/render/sanitize.d.ts +15 -0
  112. package/dist/v2/render/socialIcons.d.ts +83 -0
  113. package/dist/v2/sections/catalog/about.d.ts +2 -0
  114. package/dist/v2/sections/catalog/announcement.d.ts +2 -0
  115. package/dist/v2/sections/catalog/contact.d.ts +2 -0
  116. package/dist/v2/sections/catalog/cta.d.ts +2 -0
  117. package/dist/v2/sections/catalog/faq.d.ts +2 -0
  118. package/dist/v2/sections/catalog/features.d.ts +2 -0
  119. package/dist/v2/sections/catalog/footer.d.ts +5 -0
  120. package/dist/v2/sections/catalog/gallery.d.ts +2 -0
  121. package/dist/v2/sections/catalog/header.d.ts +2 -0
  122. package/dist/v2/sections/catalog/hero.d.ts +2 -0
  123. package/dist/v2/sections/catalog/logos.d.ts +2 -0
  124. package/dist/v2/sections/catalog/pricing.d.ts +2 -0
  125. package/dist/v2/sections/catalog/stats.d.ts +2 -0
  126. package/dist/v2/sections/catalog/steps.d.ts +2 -0
  127. package/dist/v2/sections/catalog/team.d.ts +2 -0
  128. package/dist/v2/sections/catalog/testimonials.d.ts +2 -0
  129. package/dist/v2/sections/catalog/video.d.ts +2 -0
  130. package/dist/v2/sections/kit.d.ts +64 -0
  131. package/dist/v2/sections/materialize.d.ts +72 -0
  132. package/dist/v2/sections/pageTemplates.d.ts +52 -0
  133. package/dist/v2/sections/registry.d.ts +5 -0
  134. package/dist/v2/sections/types.d.ts +103 -0
  135. package/dist/v2/sol/catalogSchema.d.ts +43 -0
  136. package/dist/v2/sol/commands.d.ts +21 -0
  137. package/dist/v2/sol/describe.d.ts +32 -0
  138. package/dist/v2/sol/index.d.ts +7 -0
  139. package/dist/v2/sol/parse.d.ts +10 -0
  140. package/dist/v2/sol/prompt.d.ts +5 -0
  141. package/dist/v2/sol/schema.d.ts +177 -0
  142. package/dist/v2/sol/summarize.d.ts +4 -0
  143. package/dist/v2/strata/autoUpdate.d.ts +37 -0
  144. package/dist/v2/strata/client.d.ts +38 -0
  145. package/dist/v2/strata/index.d.ts +8 -0
  146. package/dist/v2/strata/merge.d.ts +27 -0
  147. package/dist/v2/strata/types.d.ts +115 -0
  148. package/dist/v2/types/editor.d.ts +175 -0
  149. package/dist/v2/utils/css.d.ts +3 -0
  150. package/dist/v2/utils/id.d.ts +3 -0
  151. package/dist/v2-compile.js +138 -7
  152. package/dist/v2-strata.js +2 -0
  153. package/dist/v2.js +10993 -8186
  154. package/package.json +6 -1
  155. package/dist/toReact-BBzjWoFG.js +0 -595
  156. package/dist/v2/ai/commands.d.ts +0 -616
  157. package/dist/v2/ai/dispatch.d.ts +0 -24
  158. package/dist/v2/ai/nodeSchema.d.ts +0 -196
  159. package/dist/v2/brand/BrandColorSwatches.d.ts +0 -4
  160. package/dist/v2/brand/BrandPanel.d.ts +0 -4
  161. package/dist/v2/brand/ChangeSetGallery.d.ts +0 -10
  162. package/dist/v2/brand/StyleSetEditor.d.ts +0 -22
  163. package/dist/v2/canvas/CatalogDragContext.d.ts +0 -27
  164. package/dist/v2/canvas/ContextMenuContext.d.ts +0 -16
  165. package/dist/v2/canvas/DeviceModeContext.d.ts +0 -20
  166. package/dist/v2/canvas/DragEngineContext.d.ts +0 -13
  167. package/dist/v2/canvas/LayoutGuideContext.d.ts +0 -22
  168. package/dist/v2/canvas/PreviewModeContext.d.ts +0 -15
  169. package/dist/v2/canvas/SidebarContext.d.ts +0 -21
  170. package/dist/v2/canvas/StylePainterContext.d.ts +0 -19
  171. package/dist/v2/canvas/WorkspaceThemeContext.d.ts +0 -19
  172. package/dist/v2/canvas/aiTextTransforms.d.ts +0 -24
  173. package/dist/v2/canvas/animationPresets.d.ts +0 -12
  174. package/dist/v2/canvas/constants.d.ts +0 -6
  175. package/dist/v2/canvas/layoutRoles.d.ts +0 -12
  176. package/dist/v2/canvas/modelRect.d.ts +0 -4
  177. package/dist/v2/canvas/rectMath.d.ts +0 -34
  178. package/dist/v2/canvas/reorderMath.d.ts +0 -8
  179. package/dist/v2/canvas/resizeMath.d.ts +0 -16
  180. package/dist/v2/canvas/resolveBoxStyle.d.ts +0 -12
  181. package/dist/v2/canvas/resolveTargetSection.d.ts +0 -10
  182. package/dist/v2/canvas/sectionDividerShapes.d.ts +0 -12
  183. package/dist/v2/canvas/snapping.d.ts +0 -28
  184. package/dist/v2/canvas/useAlignNode.d.ts +0 -10
  185. package/dist/v2/canvas/useClipboardKeyBinding.d.ts +0 -7
  186. package/dist/v2/canvas/useDeleteKeyBinding.d.ts +0 -3
  187. package/dist/v2/canvas/useDragEngine.d.ts +0 -44
  188. package/dist/v2/canvas/useDraggableNode.d.ts +0 -30
  189. package/dist/v2/canvas/useInlineTextEdit.d.ts +0 -29
  190. package/dist/v2/canvas/usePointerEngine.d.ts +0 -22
  191. package/dist/v2/canvas/useResizeHandle.d.ts +0 -12
  192. package/dist/v2/canvas/useResolvedTextStyles.d.ts +0 -13
  193. package/dist/v2/canvas/useSelectionRects.d.ts +0 -13
  194. package/dist/v2/canvas/useUndoRedoKeyBinding.d.ts +0 -8
  195. package/dist/v2/catalog/elementCatalog.d.ts +0 -31
  196. package/dist/v2/catalog/imagePreset.d.ts +0 -7
  197. package/dist/v2/compile/toReact.d.ts +0 -32
  198. package/dist/v2/components/AdornmentLayer.d.ts +0 -20
  199. package/dist/v2/components/AskSolPanel.d.ts +0 -25
  200. package/dist/v2/components/CatalogDragGhost.d.ts +0 -6
  201. package/dist/v2/components/CellBoundary.d.ts +0 -14
  202. package/dist/v2/components/CenterCanvas.d.ts +0 -3
  203. package/dist/v2/components/ContentTabPanel.d.ts +0 -12
  204. package/dist/v2/components/ContextMenu.d.ts +0 -5
  205. package/dist/v2/components/ContextualToolbar.d.ts +0 -25
  206. package/dist/v2/components/ImagesTabPanel.d.ts +0 -15
  207. package/dist/v2/components/LayoutGuidePanel.d.ts +0 -10
  208. package/dist/v2/components/ManageLayersPanel.d.ts +0 -13
  209. package/dist/v2/components/NodeRenderer.d.ts +0 -8
  210. package/dist/v2/components/PreviewOverlay.d.ts +0 -11
  211. package/dist/v2/components/ResizeHandle.d.ts +0 -6
  212. package/dist/v2/components/RightRail.d.ts +0 -13
  213. package/dist/v2/components/SectionDividerOverlay.d.ts +0 -8
  214. package/dist/v2/components/SectionEdgeAddZone.d.ts +0 -17
  215. package/dist/v2/components/SectionGridOverlay.d.ts +0 -10
  216. package/dist/v2/components/SectionNamePill.d.ts +0 -6
  217. package/dist/v2/components/SectionNode.d.ts +0 -5
  218. package/dist/v2/components/SectionSideRail.d.ts +0 -17
  219. package/dist/v2/components/SelectionToolbar.d.ts +0 -11
  220. package/dist/v2/components/StylePainterToast.d.ts +0 -5
  221. package/dist/v2/components/V2Canvas.d.ts +0 -59
  222. package/dist/v2/components/nodes/ButtonNode.d.ts +0 -4
  223. package/dist/v2/components/nodes/ContainerNode.d.ts +0 -11
  224. package/dist/v2/components/nodes/EmbedNode.d.ts +0 -4
  225. package/dist/v2/components/nodes/ImageNode.d.ts +0 -4
  226. package/dist/v2/components/nodes/InputNode.d.ts +0 -4
  227. package/dist/v2/components/nodes/MenuNode.d.ts +0 -18
  228. package/dist/v2/components/nodes/TextNode.d.ts +0 -4
  229. package/dist/v2/inspector/AiQuickEditPanel.d.ts +0 -12
  230. package/dist/v2/inspector/AnimationPanel.d.ts +0 -11
  231. package/dist/v2/inspector/DesignAccordions.d.ts +0 -7
  232. package/dist/v2/inspector/FieldRenderer.d.ts +0 -9
  233. package/dist/v2/inspector/IconPopoverButton.d.ts +0 -9
  234. package/dist/v2/inspector/MenuIconPanel.d.ts +0 -7
  235. package/dist/v2/inspector/MenuManagePanel.d.ts +0 -8
  236. package/dist/v2/inspector/Popover.d.ts +0 -21
  237. package/dist/v2/inspector/SectionDividerPanel.d.ts +0 -9
  238. package/dist/v2/inspector/fieldStyles.d.ts +0 -15
  239. package/dist/v2/inspector/fields/ColorField.d.ts +0 -7
  240. package/dist/v2/inspector/fields/NumberField.d.ts +0 -7
  241. package/dist/v2/inspector/fields/SelectField.d.ts +0 -7
  242. package/dist/v2/inspector/fields/TextField.d.ts +0 -7
  243. package/dist/v2/inspector/fields/TextStyleField.d.ts +0 -11
  244. package/dist/v2/inspector/fields/TextareaField.d.ts +0 -7
  245. package/dist/v2/inspector/schema.d.ts +0 -25
  246. package/dist/v2/inspector/useFieldCommit.d.ts +0 -12
  247. package/dist/v2/store/brandDefaults.d.ts +0 -4
  248. package/dist/v2/store/brandTypes.d.ts +0 -40
  249. package/dist/v2/store/cloneSubtree.d.ts +0 -12
  250. package/dist/v2/store/createBrandStore.d.ts +0 -2
  251. package/dist/v2/store/createCanvasStore.d.ts +0 -2
  252. package/dist/v2/store/seed.d.ts +0 -17
  253. package/dist/v2/store/types.d.ts +0 -163
  254. package/dist/v2/ui/theme.d.ts +0 -85
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@charisol/plexo-sdk",
3
3
  "private": false,
4
- "version": "1.4.42",
4
+ "version": "2.0.1",
5
5
  "description": "Plexo visual email and landing page builder SDK — drag-and-drop template editor with AI integration.",
6
6
  "keywords": [
7
7
  "email-builder",
@@ -51,6 +51,11 @@
51
51
  "import": "./dist/v2-compile.js",
52
52
  "require": "./dist/v2-compile.js"
53
53
  },
54
+ "./v2/strata": {
55
+ "types": "./dist/v2/strata/index.d.ts",
56
+ "import": "./dist/v2-strata.js",
57
+ "require": "./dist/v2-strata.js"
58
+ },
54
59
  "./dist/*": "./dist/*"
55
60
  },
56
61
  "files": [
@@ -1,595 +0,0 @@
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 };