@charisol/plexo-sdk 1.4.41 → 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.
- package/README.md +72 -0
- package/dist/InlineColorPicker-8ewm1Asx.js +2912 -0
- package/dist/client-DlVJt_6V.js +339 -0
- package/dist/colorUtils-ohNG3v1i.js +222 -0
- package/dist/columnOrder-f5-VOg2T.js +11 -0
- package/dist/{compiler-BvseEhDC.js → compiler-Dhpsq71h.js} +121 -120
- package/dist/compiler.js +1 -1
- package/dist/{compilerClient-BIrZIgfG.js → compilerClient-BC4TGAr9.js} +93 -92
- package/dist/compilerClient.js +1 -1
- package/dist/components/SolMark.d.ts +8 -0
- package/dist/{iconSvgStatic-CGue7nyp.js → iconSvgStatic-Lnpg27U9.js} +66 -75
- package/dist/index.js +13129 -14500
- package/dist/legacy-71dHsiAM.js +16088 -0
- package/dist/lint-D-2x-Yeb.js +225 -0
- package/dist/{mjmlBrowser-DWk0mRD6.js → mjmlBrowser-wlHcAT8n.js} +2 -2
- package/dist/plexo-sdk.css +1 -1
- package/dist/rolldown-runtime-B1bRi_D7.js +27 -0
- package/dist/sanitize.js +1 -1
- package/dist/{sanitizeCompiledHtml-CNjUXlMK.js → sanitizeCompiledHtml-GgGsetm3.js} +673 -698
- package/dist/{zoom-in-DL4pfiLG.js → schemas-Bq5o5MfF.js} +916 -2120
- package/dist/utilities/aiHelper.d.ts +4 -0
- package/dist/utilities/colorUtils.d.ts +35 -0
- package/dist/utilities/playground.interfaces.d.ts +24 -1
- package/dist/v2/V2Editor.d.ts +25 -0
- package/dist/v2/compile/build.d.ts +38 -0
- package/dist/v2/compile/html.d.ts +18 -0
- package/dist/v2/compile/index.d.ts +28 -15
- package/dist/v2/compile/react.d.ts +17 -0
- package/dist/v2/compile/schema.d.ts +16 -0
- package/dist/v2/components/canvas/AlignmentGuidesOverlay.d.ts +7 -0
- package/dist/v2/components/canvas/CanvasArea.d.ts +2 -0
- package/dist/v2/components/canvas/CanvasControls.d.ts +2 -0
- package/dist/v2/components/canvas/ContextualToolbar.d.ts +7 -0
- package/dist/v2/components/canvas/DropIndicator.d.ts +6 -0
- package/dist/v2/components/canvas/IrView.d.ts +12 -0
- package/dist/v2/components/canvas/NodeRenderer.d.ts +12 -0
- package/dist/v2/components/canvas/PageFrame.d.ts +9 -0
- package/dist/v2/components/canvas/ResizeHandles.d.ts +8 -0
- package/dist/v2/components/canvas/SectionToolbar.d.ts +6 -0
- package/dist/v2/components/canvas/SpacingOverlay.d.ts +7 -0
- package/dist/v2/components/design/AutoUpdateWatcher.d.ts +7 -0
- package/dist/v2/components/design/DesignSystemPanel.d.ts +7 -0
- package/dist/v2/components/design/ReviewView.d.ts +7 -0
- package/dist/v2/components/design/StrataCard.d.ts +8 -0
- package/dist/v2/components/design/TidyView.d.ts +15 -0
- package/dist/v2/components/design/bits.d.ts +20 -0
- package/dist/v2/components/design/useStrataSync.d.ts +51 -0
- package/dist/v2/components/layout/ContextMenu.d.ts +2 -0
- package/dist/v2/components/layout/EditorShell.d.ts +2 -0
- package/dist/v2/components/layout/LeftToolRail.d.ts +2 -0
- package/dist/v2/components/layout/PreviewOverlay.d.ts +6 -0
- package/dist/v2/components/layout/TopToolbar.d.ts +2 -0
- package/dist/v2/components/modals/SettingsModal.d.ts +7 -0
- package/dist/v2/components/modals/ShortcutsModal.d.ts +7 -0
- package/dist/v2/components/properties/ColorField.d.ts +14 -0
- package/dist/v2/components/properties/ElementSettings.d.ts +39 -0
- package/dist/v2/components/properties/LinkField.d.ts +26 -0
- package/dist/v2/components/properties/PageInspector.d.ts +2 -0
- package/dist/v2/components/properties/PropertiesPanel.d.ts +2 -0
- package/dist/v2/components/properties/SectionSettings.d.ts +6 -0
- package/dist/v2/components/properties/sections/ConstraintsSection.d.ts +7 -0
- package/dist/v2/components/properties/sections/LayoutDiagnostics.d.ts +7 -0
- package/dist/v2/components/sections/BlockInspector.d.ts +9 -0
- package/dist/v2/components/sections/FieldForm.d.ts +14 -0
- package/dist/v2/components/sections/ManagedChildNotice.d.ts +7 -0
- package/dist/v2/components/sections/SectionThumb.d.ts +11 -0
- package/dist/v2/components/sidebar/FlyoutDrawer.d.ts +2 -0
- package/dist/v2/components/sidebar/InsertPanel.d.ts +2 -0
- package/dist/v2/components/sidebar/LayersPanel.d.ts +2 -0
- package/dist/v2/components/sidebar/LibraryPanel.d.ts +3 -0
- package/dist/v2/components/sidebar/PagesPanel.d.ts +2 -0
- package/dist/v2/components/sidebar/SectionsPanel.d.ts +6 -0
- package/dist/v2/components/sidebar/SolPanel.d.ts +3 -0
- package/dist/v2/components/sidebar/TemplateChooser.d.ts +13 -0
- package/dist/v2/context/BlockContext.d.ts +7 -0
- package/dist/v2/context/EditorContext.d.ts +213 -0
- package/dist/v2/context/FrameContext.d.ts +3 -0
- package/dist/v2/context/ParentLayoutContext.d.ts +10 -0
- package/dist/v2/context/PlacementContext.d.ts +4 -0
- package/dist/v2/data/blankPage.d.ts +3 -0
- package/dist/v2/data/insertableComponents.d.ts +17 -0
- package/dist/v2/data/samplePageData.d.ts +3 -0
- package/dist/v2/design/audit.d.ts +78 -0
- package/dist/v2/design/baseline.d.ts +3 -0
- package/dist/v2/design/baselineData.d.ts +3 -0
- package/dist/v2/design/components.d.ts +9 -0
- package/dist/v2/design/css.d.ts +16 -0
- package/dist/v2/design/fonts.d.ts +10 -0
- package/dist/v2/design/index.d.ts +11 -0
- package/dist/v2/design/lint.d.ts +22 -0
- package/dist/v2/design/shades.d.ts +15 -0
- package/dist/v2/design/textStyles.d.ts +29 -0
- package/dist/v2/design/themes.d.ts +35 -0
- package/dist/v2/design/tokens.d.ts +24 -0
- package/dist/v2/design/types.d.ts +81 -0
- package/dist/v2/host/HostContext.d.ts +176 -0
- package/dist/v2/host/SolMark.d.ts +8 -0
- package/dist/v2/index.d.ts +19 -10
- package/dist/v2/migrate/legacy.d.ts +26 -0
- package/dist/v2/render/adapt.d.ts +12 -0
- package/dist/v2/render/anchors.d.ts +7 -0
- package/dist/v2/render/elementCss.d.ts +7 -0
- package/dist/v2/render/elementProps.d.ts +92 -0
- package/dist/v2/render/elements.d.ts +32 -0
- package/dist/v2/render/formAction.d.ts +33 -0
- package/dist/v2/render/frames.d.ts +10 -0
- package/dist/v2/render/iconSet.d.ts +5 -0
- package/dist/v2/render/ir.d.ts +20 -0
- package/dist/v2/render/nodeStyle.d.ts +24 -0
- package/dist/v2/render/placement.d.ts +12 -0
- package/dist/v2/render/resolve.d.ts +3 -0
- package/dist/v2/render/runtime.d.ts +18 -0
- package/dist/v2/render/sanitize.d.ts +15 -0
- package/dist/v2/render/socialIcons.d.ts +83 -0
- package/dist/v2/sections/catalog/about.d.ts +2 -0
- package/dist/v2/sections/catalog/announcement.d.ts +2 -0
- package/dist/v2/sections/catalog/contact.d.ts +2 -0
- package/dist/v2/sections/catalog/cta.d.ts +2 -0
- package/dist/v2/sections/catalog/faq.d.ts +2 -0
- package/dist/v2/sections/catalog/features.d.ts +2 -0
- package/dist/v2/sections/catalog/footer.d.ts +5 -0
- package/dist/v2/sections/catalog/gallery.d.ts +2 -0
- package/dist/v2/sections/catalog/header.d.ts +2 -0
- package/dist/v2/sections/catalog/hero.d.ts +2 -0
- package/dist/v2/sections/catalog/logos.d.ts +2 -0
- package/dist/v2/sections/catalog/pricing.d.ts +2 -0
- package/dist/v2/sections/catalog/stats.d.ts +2 -0
- package/dist/v2/sections/catalog/steps.d.ts +2 -0
- package/dist/v2/sections/catalog/team.d.ts +2 -0
- package/dist/v2/sections/catalog/testimonials.d.ts +2 -0
- package/dist/v2/sections/catalog/video.d.ts +2 -0
- package/dist/v2/sections/kit.d.ts +64 -0
- package/dist/v2/sections/materialize.d.ts +72 -0
- package/dist/v2/sections/pageTemplates.d.ts +52 -0
- package/dist/v2/sections/registry.d.ts +5 -0
- package/dist/v2/sections/types.d.ts +103 -0
- package/dist/v2/sol/catalogSchema.d.ts +43 -0
- package/dist/v2/sol/commands.d.ts +21 -0
- package/dist/v2/sol/describe.d.ts +32 -0
- package/dist/v2/sol/index.d.ts +7 -0
- package/dist/v2/sol/parse.d.ts +10 -0
- package/dist/v2/sol/prompt.d.ts +5 -0
- package/dist/v2/sol/schema.d.ts +177 -0
- package/dist/v2/sol/summarize.d.ts +4 -0
- package/dist/v2/strata/autoUpdate.d.ts +37 -0
- package/dist/v2/strata/client.d.ts +38 -0
- package/dist/v2/strata/index.d.ts +8 -0
- package/dist/v2/strata/merge.d.ts +27 -0
- package/dist/v2/strata/types.d.ts +115 -0
- package/dist/v2/types/editor.d.ts +175 -0
- package/dist/v2/utils/css.d.ts +3 -0
- package/dist/v2/utils/id.d.ts +3 -0
- package/dist/v2-compile.js +138 -7
- package/dist/v2-strata.js +2 -0
- package/dist/v2.js +10979 -8145
- package/package.json +6 -1
- package/dist/toReact-BBzjWoFG.js +0 -595
- package/dist/v2/ai/commands.d.ts +0 -616
- package/dist/v2/ai/dispatch.d.ts +0 -24
- package/dist/v2/ai/nodeSchema.d.ts +0 -196
- package/dist/v2/brand/BrandColorSwatches.d.ts +0 -4
- package/dist/v2/brand/BrandPanel.d.ts +0 -4
- package/dist/v2/brand/ChangeSetGallery.d.ts +0 -10
- package/dist/v2/brand/StyleSetEditor.d.ts +0 -22
- package/dist/v2/canvas/CatalogDragContext.d.ts +0 -27
- package/dist/v2/canvas/ContextMenuContext.d.ts +0 -16
- package/dist/v2/canvas/DeviceModeContext.d.ts +0 -20
- package/dist/v2/canvas/DragEngineContext.d.ts +0 -13
- package/dist/v2/canvas/LayoutGuideContext.d.ts +0 -22
- package/dist/v2/canvas/PreviewModeContext.d.ts +0 -15
- package/dist/v2/canvas/SidebarContext.d.ts +0 -21
- package/dist/v2/canvas/StylePainterContext.d.ts +0 -19
- package/dist/v2/canvas/WorkspaceThemeContext.d.ts +0 -19
- package/dist/v2/canvas/aiTextTransforms.d.ts +0 -24
- package/dist/v2/canvas/animationPresets.d.ts +0 -12
- package/dist/v2/canvas/constants.d.ts +0 -6
- package/dist/v2/canvas/layoutRoles.d.ts +0 -12
- package/dist/v2/canvas/modelRect.d.ts +0 -4
- package/dist/v2/canvas/rectMath.d.ts +0 -34
- package/dist/v2/canvas/reorderMath.d.ts +0 -8
- package/dist/v2/canvas/resizeMath.d.ts +0 -16
- package/dist/v2/canvas/resolveBoxStyle.d.ts +0 -12
- package/dist/v2/canvas/resolveTargetSection.d.ts +0 -10
- package/dist/v2/canvas/sectionDividerShapes.d.ts +0 -12
- package/dist/v2/canvas/snapping.d.ts +0 -28
- package/dist/v2/canvas/useAlignNode.d.ts +0 -10
- package/dist/v2/canvas/useClipboardKeyBinding.d.ts +0 -7
- package/dist/v2/canvas/useDeleteKeyBinding.d.ts +0 -3
- package/dist/v2/canvas/useDragEngine.d.ts +0 -44
- package/dist/v2/canvas/useDraggableNode.d.ts +0 -30
- package/dist/v2/canvas/useInlineTextEdit.d.ts +0 -29
- package/dist/v2/canvas/usePointerEngine.d.ts +0 -22
- package/dist/v2/canvas/useResizeHandle.d.ts +0 -12
- package/dist/v2/canvas/useResolvedTextStyles.d.ts +0 -13
- package/dist/v2/canvas/useSelectionRects.d.ts +0 -13
- package/dist/v2/canvas/useUndoRedoKeyBinding.d.ts +0 -8
- package/dist/v2/catalog/elementCatalog.d.ts +0 -31
- package/dist/v2/catalog/imagePreset.d.ts +0 -7
- package/dist/v2/compile/toReact.d.ts +0 -32
- package/dist/v2/components/AdornmentLayer.d.ts +0 -20
- package/dist/v2/components/AskSolPanel.d.ts +0 -19
- package/dist/v2/components/CatalogDragGhost.d.ts +0 -6
- package/dist/v2/components/CellBoundary.d.ts +0 -14
- package/dist/v2/components/CenterCanvas.d.ts +0 -3
- package/dist/v2/components/ContentTabPanel.d.ts +0 -12
- package/dist/v2/components/ContextMenu.d.ts +0 -5
- package/dist/v2/components/ContextualToolbar.d.ts +0 -25
- package/dist/v2/components/ImagesTabPanel.d.ts +0 -15
- package/dist/v2/components/LayoutGuidePanel.d.ts +0 -10
- package/dist/v2/components/ManageLayersPanel.d.ts +0 -13
- package/dist/v2/components/NodeRenderer.d.ts +0 -8
- package/dist/v2/components/PreviewOverlay.d.ts +0 -11
- package/dist/v2/components/ResizeHandle.d.ts +0 -6
- package/dist/v2/components/RightRail.d.ts +0 -13
- package/dist/v2/components/SectionDividerOverlay.d.ts +0 -8
- package/dist/v2/components/SectionEdgeAddZone.d.ts +0 -17
- package/dist/v2/components/SectionGridOverlay.d.ts +0 -10
- package/dist/v2/components/SectionNamePill.d.ts +0 -6
- package/dist/v2/components/SectionNode.d.ts +0 -5
- package/dist/v2/components/SectionSideRail.d.ts +0 -17
- package/dist/v2/components/SelectionToolbar.d.ts +0 -11
- package/dist/v2/components/StylePainterToast.d.ts +0 -5
- package/dist/v2/components/V2Canvas.d.ts +0 -56
- package/dist/v2/components/nodes/ButtonNode.d.ts +0 -4
- package/dist/v2/components/nodes/ContainerNode.d.ts +0 -11
- package/dist/v2/components/nodes/EmbedNode.d.ts +0 -4
- package/dist/v2/components/nodes/ImageNode.d.ts +0 -4
- package/dist/v2/components/nodes/InputNode.d.ts +0 -4
- package/dist/v2/components/nodes/MenuNode.d.ts +0 -18
- package/dist/v2/components/nodes/TextNode.d.ts +0 -4
- package/dist/v2/inspector/AiQuickEditPanel.d.ts +0 -12
- package/dist/v2/inspector/AnimationPanel.d.ts +0 -11
- package/dist/v2/inspector/DesignAccordions.d.ts +0 -7
- package/dist/v2/inspector/FieldRenderer.d.ts +0 -9
- package/dist/v2/inspector/IconPopoverButton.d.ts +0 -9
- package/dist/v2/inspector/MenuIconPanel.d.ts +0 -7
- package/dist/v2/inspector/MenuManagePanel.d.ts +0 -8
- package/dist/v2/inspector/Popover.d.ts +0 -21
- package/dist/v2/inspector/SectionDividerPanel.d.ts +0 -9
- package/dist/v2/inspector/fieldStyles.d.ts +0 -15
- package/dist/v2/inspector/fields/ColorField.d.ts +0 -7
- package/dist/v2/inspector/fields/NumberField.d.ts +0 -7
- package/dist/v2/inspector/fields/SelectField.d.ts +0 -7
- package/dist/v2/inspector/fields/TextField.d.ts +0 -7
- package/dist/v2/inspector/fields/TextStyleField.d.ts +0 -11
- package/dist/v2/inspector/fields/TextareaField.d.ts +0 -7
- package/dist/v2/inspector/schema.d.ts +0 -25
- package/dist/v2/inspector/useFieldCommit.d.ts +0 -12
- package/dist/v2/store/brandDefaults.d.ts +0 -4
- package/dist/v2/store/brandTypes.d.ts +0 -40
- package/dist/v2/store/cloneSubtree.d.ts +0 -12
- package/dist/v2/store/createBrandStore.d.ts +0 -2
- package/dist/v2/store/createCanvasStore.d.ts +0 -2
- package/dist/v2/store/seed.d.ts +0 -17
- package/dist/v2/store/types.d.ts +0 -163
- package/dist/v2/ui/theme.d.ts +0 -85
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { i as e } from "./colorUtils-ohNG3v1i.js";
|
|
2
|
+
//#region src/v2/design/tokens.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
let t = String(e.value), n = e.unit && e.unit !== "null" ? e.unit : "";
|
|
5
|
+
return !n || t.endsWith(n) || t.includes("var(") || t.includes("calc(") ? t : `${t}${n}`;
|
|
6
|
+
}
|
|
7
|
+
var n = (e) => `var(${e})`;
|
|
8
|
+
function r(e) {
|
|
9
|
+
let t = /^\s*var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,.*)?\)\s*$/.exec(e);
|
|
10
|
+
return t ? t[1] : null;
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return new Map(e.tokens.map((e) => [e.key, e]));
|
|
14
|
+
}
|
|
15
|
+
function a(e, t) {
|
|
16
|
+
return e.tokens.find((e) => e.key === t);
|
|
17
|
+
}
|
|
18
|
+
function o(e, t) {
|
|
19
|
+
return a(e, t)?.value;
|
|
20
|
+
}
|
|
21
|
+
var s = (e) => /^#[0-9a-f]{3,8}$/i.test(e) || /^(rgb|hsl)a?\(/i.test(e) ? "color" : /^-?\d*\.?\d+(px|rem|em|%)$/.test(e) ? "dimension" : /^-?\d*\.?\d+$/.test(e) ? "number" : "string", c = (e) => e.replace(/^--/, "").split("-").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join(" ");
|
|
22
|
+
function l(e, t, n, r = {}) {
|
|
23
|
+
let i = a(e, t);
|
|
24
|
+
if (i) return i.value === n && (r.unit === void 0 || r.unit === i.unit) ? e : {
|
|
25
|
+
...e,
|
|
26
|
+
tokens: e.tokens.map((e) => e.key === t ? {
|
|
27
|
+
...e,
|
|
28
|
+
value: n,
|
|
29
|
+
...r.unit === void 0 ? {} : { unit: r.unit }
|
|
30
|
+
} : e)
|
|
31
|
+
};
|
|
32
|
+
let o = r.layer ?? "brand", l = {
|
|
33
|
+
key: t,
|
|
34
|
+
name: r.name ?? c(t),
|
|
35
|
+
value: n,
|
|
36
|
+
type: r.type ?? s(n),
|
|
37
|
+
unit: r.unit ?? null,
|
|
38
|
+
layer: o,
|
|
39
|
+
comment: r.comment ?? null
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
...e,
|
|
43
|
+
tokens: [...e.tokens, l]
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function u(e, t) {
|
|
47
|
+
let n = e;
|
|
48
|
+
for (let [e, r] of Object.entries(t)) n = l(n, e, r);
|
|
49
|
+
return n;
|
|
50
|
+
}
|
|
51
|
+
function d(e, t) {
|
|
52
|
+
return e.tokens.some((e) => e.key === t) ? {
|
|
53
|
+
...e,
|
|
54
|
+
tokens: e.tokens.filter((e) => e.key !== t)
|
|
55
|
+
} : e;
|
|
56
|
+
}
|
|
57
|
+
function f(e, n, a = 0) {
|
|
58
|
+
let o = e instanceof Map ? e : i(e), s = r(n);
|
|
59
|
+
if (!s || a > 12) return n;
|
|
60
|
+
let c = o.get(s);
|
|
61
|
+
if (!c) {
|
|
62
|
+
let e = /^\s*var\(\s*--[A-Za-z0-9_-]+\s*,\s*(.*)\)\s*$/.exec(n)?.[1];
|
|
63
|
+
return e ? f(o, e.trim(), a + 1) : n;
|
|
64
|
+
}
|
|
65
|
+
return f(o, t(c), a + 1);
|
|
66
|
+
}
|
|
67
|
+
function p(e, n) {
|
|
68
|
+
let r = a(e, n);
|
|
69
|
+
return r ? f(e, t(r)) : void 0;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/v2/design/lint.ts
|
|
73
|
+
var m = { "--color-border-muted": "--color-border-subtle" }, h = /var\(\s*(--[A-Za-z0-9_-]+)/g, g = (e) => [...e.matchAll(h)].map((e) => e[1]);
|
|
74
|
+
function* _(e) {
|
|
75
|
+
for (let t of e ?? []) {
|
|
76
|
+
for (let e of Object.values(t.properties ?? {})) yield String(e.value);
|
|
77
|
+
for (let e of Object.values(t.variants ?? {})) for (let t of Object.values(e.properties ?? {})) yield String(t.value);
|
|
78
|
+
yield* _(t.children);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function v(t) {
|
|
82
|
+
let n = [], i = /* @__PURE__ */ new Map();
|
|
83
|
+
for (let e of t.tokens) i.set(e.key, (i.get(e.key) ?? 0) + 1);
|
|
84
|
+
for (let r of t.tokens) {
|
|
85
|
+
/^--[A-Za-z0-9_-]+$/.test(r.key) || n.push({
|
|
86
|
+
kind: "bad-key",
|
|
87
|
+
key: r.key,
|
|
88
|
+
message: `"${r.key}" isn't a valid CSS variable name (it should look like --color-brand-primary).`,
|
|
89
|
+
fixable: !1
|
|
90
|
+
}), (i.get(r.key) ?? 0) > 1 && t.tokens.findIndex((e) => e.key === r.key) === t.tokens.indexOf(r) && n.push({
|
|
91
|
+
kind: "duplicate-key",
|
|
92
|
+
key: r.key,
|
|
93
|
+
message: `${r.key} is defined more than once; only one value can win.`,
|
|
94
|
+
fixable: !0
|
|
95
|
+
});
|
|
96
|
+
let a = String(r.value), o = g(a);
|
|
97
|
+
o.length && r.unit && r.unit !== "null" && n.push({
|
|
98
|
+
kind: "unit-on-reference",
|
|
99
|
+
key: r.key,
|
|
100
|
+
message: `${r.key} points at another token but also has the unit "${r.unit}", which produces invalid CSS ("${a}${r.unit}").`,
|
|
101
|
+
fixable: !0
|
|
102
|
+
}), r.layer === "brand" && o.length && n.push({
|
|
103
|
+
kind: "brand-references-token",
|
|
104
|
+
key: r.key,
|
|
105
|
+
message: `${r.key} is a brand token, so it should hold a real value, not point at ${o[0]}.`,
|
|
106
|
+
fixable: !0
|
|
107
|
+
});
|
|
108
|
+
for (let e of o) !i.has(e) && !e.startsWith("--plx-") && n.push({
|
|
109
|
+
kind: "dangling-reference",
|
|
110
|
+
key: r.key,
|
|
111
|
+
message: `${r.key} points at ${e}, which doesn't exist, so it has no value.`,
|
|
112
|
+
fixable: !0
|
|
113
|
+
});
|
|
114
|
+
r.type === "color" && !o.length && !e(a) && !/^(currentcolor|inherit|transparent|none)$/i.test(a) && n.push({
|
|
115
|
+
kind: "invalid-color",
|
|
116
|
+
key: r.key,
|
|
117
|
+
message: `${r.key} is marked as a colour but "${a}" isn't one.`,
|
|
118
|
+
fixable: !1
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
let a = new Map(t.tokens.map((e) => [e.key, e])), o = /* @__PURE__ */ new Set();
|
|
122
|
+
for (let e of t.tokens) {
|
|
123
|
+
let t = /* @__PURE__ */ new Set(), i = e.key;
|
|
124
|
+
for (; i && !t.has(i);) {
|
|
125
|
+
t.add(i);
|
|
126
|
+
let e = r(String(a.get(i)?.value ?? ""));
|
|
127
|
+
i = e && a.has(e) ? e : void 0;
|
|
128
|
+
}
|
|
129
|
+
i && !o.has(i) && (o.add(i), n.push({
|
|
130
|
+
kind: "circular-reference",
|
|
131
|
+
key: i,
|
|
132
|
+
message: `${i} ends up pointing back at itself, so it can never resolve.`,
|
|
133
|
+
fixable: !1
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
let s = /* @__PURE__ */ new Set();
|
|
137
|
+
for (let e of t.components) for (let t of _(e.nodes)) for (let r of g(t)) !i.has(r) && !s.has(`${e.name}:${r}`) && (s.add(`${e.name}:${r}`), n.push({
|
|
138
|
+
kind: "dangling-reference",
|
|
139
|
+
key: e.name,
|
|
140
|
+
message: `The ${e.name} component uses ${r}, which doesn't exist.`,
|
|
141
|
+
fixable: r in m
|
|
142
|
+
}));
|
|
143
|
+
return n;
|
|
144
|
+
}
|
|
145
|
+
function y(e, t, n = 0) {
|
|
146
|
+
return n > 12 ? e : e.replace(/var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,[^)]*)?\)/g, (e, r) => {
|
|
147
|
+
let i = t.get(r);
|
|
148
|
+
if (!i) return e;
|
|
149
|
+
let a = i.unit && i.unit !== "null" ? i.unit : "", o = String(i.value);
|
|
150
|
+
return y(!a || o.endsWith(a) || o.includes("var(") || o.includes("calc(") ? o : `${o}${a}`, t, n + 1);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
var b = (e) => e.replace(/var\(\s*(--[A-Za-z0-9_-]+)/g, (e, t) => m[t] ? e.replace(t, m[t]) : e);
|
|
154
|
+
function x(e) {
|
|
155
|
+
let t = !1, n = (e) => {
|
|
156
|
+
if (!e) return e;
|
|
157
|
+
let n = {};
|
|
158
|
+
for (let [r, i] of Object.entries(e)) {
|
|
159
|
+
let e = b(String(i.value));
|
|
160
|
+
e !== i.value && (t = !0), n[r] = e === i.value ? i : {
|
|
161
|
+
...i,
|
|
162
|
+
value: e
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return n;
|
|
166
|
+
}, r = (e) => {
|
|
167
|
+
if (!e) return e;
|
|
168
|
+
let n = {};
|
|
169
|
+
for (let [r, i] of Object.entries(e)) {
|
|
170
|
+
let e = b(String(i));
|
|
171
|
+
e !== i && (t = !0), n[r] = e;
|
|
172
|
+
}
|
|
173
|
+
return n;
|
|
174
|
+
}, i = (e) => {
|
|
175
|
+
let t = { ...e };
|
|
176
|
+
return e.properties && (t.properties = n(e.properties)), e.styles && (t.styles = r(e.styles)), e.variants && (t.variants = Object.fromEntries(Object.entries(e.variants).map(([e, t]) => [e, t.properties ? {
|
|
177
|
+
...t,
|
|
178
|
+
properties: n(t.properties)
|
|
179
|
+
} : t]))), e.children && (t.children = e.children.map(i)), t;
|
|
180
|
+
}, a = e?.map(i);
|
|
181
|
+
return {
|
|
182
|
+
nodes: t ? a : e,
|
|
183
|
+
changed: t
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function S(e) {
|
|
187
|
+
let t = !1, n = /* @__PURE__ */ new Set(), r = e.tokens.filter((e) => n.has(e.key) ? (t = !0, !1) : (n.add(e.key), !0)).map((e) => g(String(e.value)).length && e.unit && e.unit !== "null" ? (t = !0, {
|
|
188
|
+
...e,
|
|
189
|
+
unit: null
|
|
190
|
+
}) : e), i = new Map(r.map((e) => [e.key, e]));
|
|
191
|
+
r = r.map((e) => {
|
|
192
|
+
if (e.layer === "brand" && g(String(e.value)).length) {
|
|
193
|
+
let n = y(String(e.value), i);
|
|
194
|
+
if (n !== e.value && !g(n).length) return t = !0, {
|
|
195
|
+
...e,
|
|
196
|
+
value: n
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return e;
|
|
200
|
+
});
|
|
201
|
+
let a = new Set(r.map((e) => e.key)), o = r.find((e) => e.key === "--font-family-sans");
|
|
202
|
+
for (let e of [...r]) for (let n of g(String(e.value))) a.has(n) || (n === "--font-family-heading" || n === "--font-family-body") && o && (a.add(n), t = !0, r = [...r, {
|
|
203
|
+
key: n,
|
|
204
|
+
name: n === "--font-family-heading" ? "Font Family Heading" : "Font Family Body",
|
|
205
|
+
value: o.value,
|
|
206
|
+
type: "font family",
|
|
207
|
+
unit: null,
|
|
208
|
+
layer: "brand",
|
|
209
|
+
comment: n === "--font-family-heading" ? "Heading font" : "Body font"
|
|
210
|
+
}]);
|
|
211
|
+
let s = e.components, c = e.components.map((e) => {
|
|
212
|
+
let t = x(e.nodes);
|
|
213
|
+
return t.changed ? {
|
|
214
|
+
...e,
|
|
215
|
+
nodes: t.nodes ?? e.nodes
|
|
216
|
+
} : e;
|
|
217
|
+
});
|
|
218
|
+
return c.some((t, n) => t !== e.components[n]) && (s = c, t = !0), t ? {
|
|
219
|
+
...e,
|
|
220
|
+
tokens: r,
|
|
221
|
+
components: s
|
|
222
|
+
} : e;
|
|
223
|
+
}
|
|
224
|
+
//#endregion
|
|
225
|
+
export { c as a, d as c, l as d, u as f, o as i, p as l, i as m, S as n, n as o, t as p, a as r, r as s, v as t, f as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as e,
|
|
1
|
+
import { a as e, t } from "./rolldown-runtime-B1bRi_D7.js";
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region src/utilities/mjmlBrowser.ts
|
|
4
|
-
var n = /* @__PURE__ */
|
|
4
|
+
var n = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
|
|
5
5
|
(function(n, r) {
|
|
6
6
|
typeof e == "object" && typeof t == "object" ? t.exports = r() : typeof define == "function" && define.amd ? define("mjml", [], r) : typeof e == "object" ? e.mjml = r() : n.mjml = r();
|
|
7
7
|
})(window, function() {
|