@charisol/plexo-sdk 1.1.16 → 1.2.0

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 (36) hide show
  1. package/dist/PlexoRenderer.d.ts +8 -0
  2. package/dist/{compiler-Dr4lNAM3.js → compiler-nmaKKdLq.js} +194 -188
  3. package/dist/compiler.js +2 -2
  4. package/dist/compilerClient-DW7b0Ifk.js +215 -0
  5. package/dist/compilerClient.js +2 -168
  6. package/dist/components/CodeViewer.d.ts +7 -0
  7. package/dist/components/editor/frame/AccordionHeaderOverlay.d.ts +15 -0
  8. package/dist/components/editor/frame/CompiledCanvasEditorOverlay.d.ts +30 -0
  9. package/dist/components/editor/frame/CompiledCanvasFrame.d.ts +16 -0
  10. package/dist/components/editor/frame/DndOverlayNode.d.ts +59 -0
  11. package/dist/components/editor/frame/FrameTextToolbar.d.ts +29 -0
  12. package/dist/components/editor/frame/TableCellOverlay.d.ts +23 -0
  13. package/dist/components/editor/frame/useAccordionHeaderRects.d.ts +21 -0
  14. package/dist/components/editor/frame/useCanvasEngine.d.ts +25 -0
  15. package/dist/components/editor/frame/useCompiledCanvasHtml.d.ts +41 -0
  16. package/dist/components/editor/frame/useFrameNodeRects.d.ts +18 -0
  17. package/dist/components/editor/frame/useFrameTextEditing.d.ts +47 -0
  18. package/dist/components/editor/frame/useMeasuredFrameNodes.d.ts +13 -0
  19. package/dist/components/editor/frame/useTableCellRects.d.ts +29 -0
  20. package/dist/{iconSvgStatic-D04qA352.js → iconSvgStatic-CGue7nyp.js} +64 -48
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +47234 -46851
  23. package/dist/mjmlBrowser-DFgIYJ2a.js +39283 -0
  24. package/dist/plexo-sdk.css +1 -1
  25. package/dist/sanitize.js +2 -0
  26. package/dist/sanitizeCompiledHtml-C_sPjL3B.js +5079 -0
  27. package/dist/utilities/compiler.d.ts +4 -1
  28. package/dist/utilities/compilerClient.d.ts +4 -1
  29. package/dist/utilities/elementResolvers.d.ts +26 -7
  30. package/dist/utilities/instrumentation.d.ts +54 -0
  31. package/dist/utilities/mjmlBrowser.d.ts +19 -0
  32. package/dist/utilities/playground.helpers.d.ts +0 -18
  33. package/dist/utilities/playground.interfaces.d.ts +13 -0
  34. package/dist/utilities/sanitizeCompiledHtml.d.ts +10 -0
  35. package/dist/utilities/useApiKeyValidation.d.ts +6 -0
  36. package/package.json +17 -2
@@ -0,0 +1,21 @@
1
+ export interface AccordionHeaderRect {
2
+ elementId: string;
3
+ /** Index path into the accordion's `items` tree (e.g. `[0]`, `[0, 2]`) -- the exact shape
4
+ * `toggleAccordionItemOpen` (elementResolvers.ts) expects as its own `path` argument. */
5
+ path: number[];
6
+ rect: DOMRect;
7
+ el: HTMLElement;
8
+ }
9
+ /**
10
+ * Measures every accordion header currently in the compiled document, keyed by
11
+ * `"<elementId>|<path>"` -- matches `data-plexo-acc-item="<elementId>|<path>"` (compiler.ts's
12
+ * renderAccordionItemsHtml, landing_page target only -- see that file's comment on why
13
+ * accordions have no email/MJML equivalent to instrument at all, which is exactly why this
14
+ * hook simply finds nothing for an email-mode template rather than needing a mode check of
15
+ * its own).
16
+ *
17
+ * Unlike useTableCellRects, this is NOT scoped to the selected element -- every accordion's
18
+ * headers are always toggle-able on the legacy canvas regardless of selection (see
19
+ * SortableElement.tsx's handleToggle), so this measures the whole document unconditionally.
20
+ */
21
+ export declare function useAccordionHeaderRects(doc: Document | null, win: Window | null): Map<string, AccordionHeaderRect>;
@@ -0,0 +1,25 @@
1
+ export type CanvasEngine = 'legacy' | 'compiled';
2
+ export type CanvasFidelityPreference = 'legacy' | 'compiled' | 'auto';
3
+ export interface ResolveCanvasEngineArgs {
4
+ /** Host-controlled preference — a PlexoBuilder prop, ultimately driven by an env var/org
5
+ * allowlist in the consuming app, NOT a per-template DB toggle a user could flip themselves
6
+ * (a user comparing old vs new canvas on the same template would file every intentional,
7
+ * ledgered fixed-divergence as a bug). Defaults to 'auto' if the host doesn't set it. */
8
+ canvasFidelity?: CanvasFidelityPreference;
9
+ mode: 'email' | 'landing_page';
10
+ }
11
+ /**
12
+ * Resolves which canvas implementation actually renders, given the host's stated preference
13
+ * and the template's mode. Deliberately NOT resolvable per-element-type — the compiled canvas
14
+ * and the legacy React-tree canvas are different documents with different layout roots, so
15
+ * there's no seam at that granularity; per-element-type coverage gaps are tracked instead via
16
+ * the fixture/golden-snapshot parity suite (see FIX_LEDGER.md), not a runtime switch.
17
+ *
18
+ * 'auto' currently always resolves to 'legacy', regardless of mode, until the compiled canvas's
19
+ * interactive overlay (selection, drag, in-frame text editing) reaches parity with the legacy
20
+ * canvas and a real cutover decision is made — see the project plan's rollout phases. Once that
21
+ * happens, 'auto' is intended to flip to `mode === 'email' ? 'compiled' : 'legacy'` first (email
22
+ * is where the real table/VML fidelity gap lives, so it's the bigger win), then 'compiled' for
23
+ * both modes — but that change belongs in its own reviewed step, not silently bundled in here.
24
+ */
25
+ export declare function resolveCanvasEngine({ canvasFidelity }: ResolveCanvasEngineArgs): CanvasEngine;
@@ -0,0 +1,41 @@
1
+ import type { TemplateJSON } from '../../../utilities/types';
2
+ export interface CompiledCanvasHtmlResult {
3
+ html: string;
4
+ /** Non-fatal — the frame still gets whatever HTML the engine produced (mjml2html degrades
5
+ * gracefully under `validationLevel: 'soft'`); this just surfaces that something didn't
6
+ * compile cleanly, the same way the email tab's existing error banner does. */
7
+ error: string | null;
8
+ }
9
+ /**
10
+ * Computes the SAME bytes the compiled canvas frame renders, for one template snapshot.
11
+ * Landing pages: `sanitizeCompiledHtml(compileToHTML(...))` -- the actual served output,
12
+ * carrying compileToHTML's always-on `data-plexo-id` attributes through sanitization (see
13
+ * sanitizeCompiledHtml.ts's `data-*` wildcard). Email: the real MJML pipeline, compiled
14
+ * client-side via mjml-browser (see mjmlBrowser.ts's parity contract) with `instrument: true`
15
+ * so every row/column/element carries a `plexo-node-<id>` class useFrameNodeRects can find.
16
+ *
17
+ * Both pass `canvasEditorPadding: true` -- the ONE deliberate divergence from the real
18
+ * published/sent output: a genuinely empty column gets real (not just visual-overlay) height
19
+ * reserved for its "Drop content here" editor placeholder, so the actual page layout pushes
20
+ * subsequent rows down instead of an invisible-but-tall overlay hit-box merely LOOKING like
21
+ * it covers them. Every other caller of compileToHTML/parseJsonToTargetFormat (publish, send,
22
+ * the Html/Plain-text preview tabs) leaves this off, so what actually ships is unaffected.
23
+ *
24
+ * Async, and mjml-browser is loaded via a dynamic import rather than a static one, purely for
25
+ * bundle size: mjml-browser pulls in a full MJML compiler (well over 1MB unminified) that has
26
+ * no reason to load into every consumer's bundle just because PlexoBuilder is imported --
27
+ * only landing-page compiling (already cheap and already reachable from index.ts's exports)
28
+ * is needed unconditionally; the email/MJML engine is fetched lazily, on first use, and only
29
+ * by a host that's actually running email-mode templates through the compiled canvas.
30
+ */
31
+ export declare function computeCompiledCanvasHtml(template: TemplateJSON, mode: 'email' | 'landing_page'): Promise<CompiledCanvasHtmlResult>;
32
+ /**
33
+ * Debounced live version of computeCompiledCanvasHtml, for driving the compiled canvas
34
+ * while a template is actively being edited. Debounced (not memoized-per-keystroke) because
35
+ * every structural edit (drag, style change, add/delete) re-triggers a full compile -- cheap
36
+ * enough per call, but not something that needs to happen synchronously inside every render.
37
+ * Returns { html: '', error: null } when `enabled` is false, so a caller that only mounts
38
+ * this while the compiled engine is active never pays the compile cost (or the mjml-browser
39
+ * chunk fetch, for email mode) under the legacy engine.
40
+ */
41
+ export declare function useCompiledCanvasHtml(template: TemplateJSON, mode: 'email' | 'landing_page', enabled: boolean, debounceMs?: number): CompiledCanvasHtmlResult;
@@ -0,0 +1,18 @@
1
+ export type FrameNodeKind = 'row' | 'column' | 'element';
2
+ export interface FrameNodeRect {
3
+ id: string;
4
+ kind: FrameNodeKind;
5
+ /** In the iframe's own coordinate space — callers overlaying in the PARENT document need
6
+ * to add the iframe element's own getBoundingClientRect() offset (and, since this frame is
7
+ * height-locked to its content and never scrolls internally — see CompiledCanvasFrame — no
8
+ * scroll-offset term is needed on top of that). */
9
+ rect: DOMRect;
10
+ el: HTMLElement;
11
+ }
12
+ /**
13
+ * Tracks the on-screen (iframe-local) position of every identifiable row/column/element node
14
+ * in a compiled-canvas-frame's document, re-measuring whenever the document's layout could
15
+ * plausibly have changed. This is the seam a future selection/drag overlay reads from — it
16
+ * has no opinion about interaction itself, only "where is node X right now".
17
+ */
18
+ export declare function useFrameNodeRects(doc: Document | null, win: Window | null): Map<string, FrameNodeRect>;
@@ -0,0 +1,47 @@
1
+ export interface UseFrameTextEditingArgs {
2
+ frameDoc: Document | null;
3
+ frameWin: Window | null;
4
+ /** Structurally typed rather than requiring `FrameNodeRect` specifically -- this hook only
5
+ * ever reads `.el` off a map entry, so it works equally well over useTableCellRects'/
6
+ * useAccordionHeaderRects' own richer rect types without an adapter. */
7
+ rects: Map<string, {
8
+ el: HTMLElement;
9
+ }>;
10
+ /** Called once, when editing ends (blur, or switching to a different node) -- receives the
11
+ * final value of the edited node, as read by `readValue` (default: `innerHTML`, exactly
12
+ * as legacy's onTransientAttrChange('text', ...) captures it, including any merge-tag
13
+ * pill spans inserted via FrameTextToolbar). */
14
+ onCommit: (id: string, value: string) => void;
15
+ /** How to read the edited node's final value at commit time. Defaults to `innerHTML` (rich
16
+ * text elements). Table cells pass `(el) => el.textContent || ''` instead, matching
17
+ * SortableElement.tsx's own table-cell editing exactly -- `textContent` strips any markup
18
+ * a paste might have introduced, since `attributes.cells` is a plain `string[][]`, not
19
+ * HTML, and (unlike text elements) has no toolbar of its own that could legitimately have
20
+ * put markup there in the first place. */
21
+ readValue?: (el: HTMLElement) => string;
22
+ }
23
+ export interface FrameTextEditingApi {
24
+ /** The node id currently in edit mode, or null. Only ever an 'element'-kind node. */
25
+ editingId: string | null;
26
+ /** Puts `id`'s real iframe DOM node into contentEditable mode and focuses it, committing
27
+ * whatever was previously being edited first (if anything, and if it's a different node). */
28
+ beginEditing: (id: string) => void;
29
+ /** Commits and exits edit mode. Safe to call when nothing is being edited (no-op). */
30
+ endEditing: () => void;
31
+ /** Re-focuses the node being edited and restores its last known selection Range, for a
32
+ * toolbar button (rendered in the PARENT document) to run execCommand against -- clicking
33
+ * into the parent document blurs the iframe's active element, so the selection has to be
34
+ * explicitly restored immediately before every formatting command, not just read live. */
35
+ restoreSelection: () => void;
36
+ }
37
+ /**
38
+ * Owns the compiled canvas's in-frame text editing lifecycle: turning a node's real DOM
39
+ * element (the actual output node, not a shadow copy) into a live contentEditable region,
40
+ * and committing its final HTML back to the store on blur/hand-off -- never on every
41
+ * keystroke. That's deliberate, not a missing debounce: committing per-keystroke would flow
42
+ * through the template -> useCompiledCanvasHtml -> CompiledCanvasFrame chain and rewrite the
43
+ * iframe's `srcDoc` mid-edit, which reloads the frame and destroys focus/cursor/selection.
44
+ * Typing only ever touches the live DOM node directly; the store (and therefore the compiled
45
+ * HTML) only changes once, when editing ends.
46
+ */
47
+ export declare function useFrameTextEditing({ frameDoc, frameWin, rects, onCommit, readValue }: UseFrameTextEditingArgs): FrameTextEditingApi;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Generic version of useFrameNodeRects's own measuring machinery (rAF-batched remeasure,
3
+ * ResizeObserver on documentElement, childList/subtree MutationObserver, per-image load
4
+ * listeners, fonts.ready) -- parameterized by an arbitrary CSS `selector` and a `parse`
5
+ * callback that turns a matched element into a `[key, value]` pair (or `null` to skip it).
6
+ * useFrameNodeRects itself stays on its own hand-written copy rather than being rewritten
7
+ * on top of this (it's already tested and working; refactoring a working, load-bearing hook
8
+ * onto a new shared abstraction purely for DRY-ness isn't worth the regression risk) -- this
9
+ * exists for the NEW sub-node cases (table cells, accordion headers) that don't fit
10
+ * useFrameNodeRects' `FrameNodeRect{id,kind}` shape (a table cell is addressed by
11
+ * `[tableId, row, col]`, not a single template node id).
12
+ */
13
+ export declare function useMeasuredFrameNodes<T>(doc: Document | null, win: Window | null, selector: string, parse: (el: Element) => [string, T] | null): Map<string, T>;
@@ -0,0 +1,29 @@
1
+ export interface TableCellRect {
2
+ row: number;
3
+ col: number;
4
+ rect: DOMRect;
5
+ el: HTMLElement;
6
+ }
7
+ /**
8
+ * Measures every cell of ONE specific table element (`tableId`), keyed by
9
+ * `"<tableId>:<row>-<col>"` (the table id is embedded in the key, not just used to filter,
10
+ * so a commit callback keyed purely off this map's own keys never needs a separate closure
11
+ * over "which table is this" -- see useFrameTextEditing's `onCommit(id, ...)`, which only
12
+ * ever receives one of these keys back). Matches `data-plexo-cell="<tableId>|<row>-<col>"`,
13
+ * the only per-cell identity compileToHTML/parseJsonToTargetFormat's table output carries
14
+ * (see compiler.ts's renderCellsRow). `row` is the ABSOLUTE index into `attributes.cells`
15
+ * (header/body/footer are slices of one flat array, per resolveTableGrid) -- exactly what a
16
+ * write-back needs, no header/body/footer offset math required at the call site.
17
+ *
18
+ * Scoped to a single table (rather than measuring every table on the page unconditionally)
19
+ * because cell-level editing only makes sense for the currently-selected table -- see
20
+ * CompiledCanvasEditorOverlay's table-cell branch.
21
+ */
22
+ export declare function useTableCellRects(doc: Document | null, win: Window | null, tableId: string | null): Map<string, TableCellRect>;
23
+ /** Parses a key this hook produces back into its table id + row/col, for a commit callback
24
+ * that needs to know which table a given key belongs to. Returns null for any other string. */
25
+ export declare function parseTableCellKey(key: string): {
26
+ tableId: string;
27
+ row: number;
28
+ col: number;
29
+ } | null;
@@ -272,14 +272,17 @@ function d(e) {
272
272
  };
273
273
  }
274
274
  function f(e) {
275
+ return { autoWidth: (e.attributes || {}).autoWidth === !0 };
276
+ }
277
+ function p(e) {
275
278
  let t = e.style || {};
276
279
  return (e.attributes || {}).autoHeight === !1 && t.height || "auto";
277
280
  }
278
- function p(e, t) {
281
+ function m(e, t) {
279
282
  let n = e.style || {};
280
283
  return (e.attributes || {}).autoHeight === !1 && n.height || t;
281
284
  }
282
- var m = [
285
+ var h = [
283
286
  "showLabel",
284
287
  "fontSize",
285
288
  "labelFontWeight",
@@ -290,15 +293,15 @@ var m = [
290
293
  "inputTextColor",
291
294
  "placeholderColor"
292
295
  ];
293
- function h(e) {
296
+ function g(e) {
294
297
  let t = null;
295
298
  return (Array.isArray(e) ? e : []).map((e) => {
296
299
  let n = e?.inheritStylesFromPrevious && t ? { ...e } : e;
297
- if (e?.inheritStylesFromPrevious && t) for (let e of m) n[e] = t[e];
300
+ if (e?.inheritStylesFromPrevious && t) for (let e of h) n[e] = t[e];
298
301
  return t = n, n;
299
302
  });
300
303
  }
301
- function g(e) {
304
+ function _(e) {
302
305
  let t = {};
303
306
  for (let n of e) {
304
307
  let e = n.name || n.id || "field";
@@ -316,9 +319,26 @@ function g(e) {
316
319
  };
317
320
  });
318
321
  }
319
- var _ = (e) => String(Math.max(0, e)).padStart(2, "0");
320
- function v(e, t, n = Date.now()) {
321
- let r = e ? Date.parse(e) : NaN, i = Number.isNaN(r) ? n : r, a = i - n;
322
+ var v = (e) => String(Math.max(0, e)).padStart(2, "0"), y = /[Zz]$|[+-]\d{2}:?\d{2}$/;
323
+ function b(e, t) {
324
+ let n = new Intl.DateTimeFormat("en-US", {
325
+ timeZone: t,
326
+ hourCycle: "h23",
327
+ year: "numeric",
328
+ month: "2-digit",
329
+ day: "2-digit",
330
+ hour: "2-digit",
331
+ minute: "2-digit",
332
+ second: "2-digit"
333
+ }).formatToParts(new Date(e)), r = (e) => Number(n.find((t) => t.type === e)?.value);
334
+ return Date.UTC(r("year"), r("month") - 1, r("day"), r("hour"), r("minute"), r("second")) - e;
335
+ }
336
+ function x(e, t) {
337
+ let n = y.test(e), r = Date.parse(n ? e : `${e}Z`);
338
+ return Number.isNaN(r) || n || !t ? r : r - b(r, t);
339
+ }
340
+ function S(e, t, n = Date.now()) {
341
+ let r = e ? x(e, t) : NaN, i = Number.isNaN(r) ? n : r, a = i - n;
322
342
  if (a <= 0) return {
323
343
  days: "00",
324
344
  hours: "00",
@@ -329,31 +349,31 @@ function v(e, t, n = Date.now()) {
329
349
  };
330
350
  let o = Math.floor(a / 1e3), s = Math.floor(o / 86400), c = Math.floor(o % 86400 / 3600), l = Math.floor(o % 3600 / 60), u = o % 60;
331
351
  return {
332
- days: _(s),
333
- hours: _(c),
334
- minutes: _(l),
335
- seconds: _(u),
352
+ days: v(s),
353
+ hours: v(c),
354
+ minutes: v(l),
355
+ seconds: v(u),
336
356
  isExpired: !1,
337
357
  targetTimestamp: i
338
358
  };
339
359
  }
340
- var y = [
360
+ var C = [
341
361
  "youtube.com",
342
362
  "www.youtube.com",
343
363
  "youtu.be",
344
364
  "m.youtube.com"
345
365
  ];
346
- function b(e) {
366
+ function w(e) {
347
367
  return e.hostname === "youtu.be" ? e.pathname.slice(1).split("/")[0] || null : e.pathname.startsWith("/embed/") ? e.pathname.slice(7).split("/")[0] || null : e.pathname.startsWith("/shorts/") ? e.pathname.slice(8).split("/")[0] || null : e.searchParams.get("v");
348
368
  }
349
- function x(e) {
369
+ function T(e) {
350
370
  let t = e.pathname.match(/(\d+)/);
351
371
  return t ? t[1] : null;
352
372
  }
353
- var S = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22640%22%20height%3D%22360%22%20viewBox%3D%220%200%20640%20360%22%3E%3Crect%20width%3D%22640%22%20height%3D%22360%22%20fill%3D%22%230f172a%22%2F%3E%3Ccircle%20cx%3D%22320%22%20cy%3D%22180%22%20r%3D%2248%22%20fill%3D%22%23ffffff%22%20opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M304%20156%20L356%20180%20L304%20204%20Z%22%20fill%3D%22%230f172a%22%2F%3E%3C%2Fsvg%3E";
354
- function C(e) {
373
+ var E = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22640%22%20height%3D%22360%22%20viewBox%3D%220%200%20640%20360%22%3E%3Crect%20width%3D%22640%22%20height%3D%22360%22%20fill%3D%22%230f172a%22%2F%3E%3Ccircle%20cx%3D%22320%22%20cy%3D%22180%22%20r%3D%2248%22%20fill%3D%22%23ffffff%22%20opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M304%20156%20L356%20180%20L304%20204%20Z%22%20fill%3D%22%230f172a%22%2F%3E%3C%2Fsvg%3E";
374
+ function D(e) {
355
375
  if (!e || typeof e != "string") return {
356
- thumbnailUrl: S,
376
+ thumbnailUrl: E,
357
377
  provider: "unknown"
358
378
  };
359
379
  let t;
@@ -361,34 +381,30 @@ function C(e) {
361
381
  t = new URL(e);
362
382
  } catch {
363
383
  return {
364
- thumbnailUrl: S,
384
+ thumbnailUrl: E,
365
385
  provider: "unknown"
366
386
  };
367
387
  }
368
- if (y.includes(t.hostname)) {
369
- let e = b(t);
388
+ if (C.includes(t.hostname)) {
389
+ let e = w(t);
370
390
  if (e) return {
371
391
  thumbnailUrl: `https://img.youtube.com/vi/${e}/hqdefault.jpg`,
372
392
  provider: "youtube"
373
393
  };
374
394
  }
375
395
  if (t.hostname === "vimeo.com" || t.hostname === "www.vimeo.com" || t.hostname === "player.vimeo.com") {
376
- let e = x(t);
396
+ let e = T(t);
377
397
  if (e) return {
378
398
  thumbnailUrl: `https://vumbnail.com/${e}.jpg`,
379
399
  provider: "vimeo"
380
400
  };
381
401
  }
382
402
  return {
383
- thumbnailUrl: S,
403
+ thumbnailUrl: E,
384
404
  provider: "unknown"
385
405
  };
386
406
  }
387
- function w(e, t) {
388
- let n = e || "Star", r = n.replace(/[-_]([a-z0-9])/gi, (e, t) => t.toUpperCase()).replace(/^\w/, (e) => e.toUpperCase()), i = n.toLowerCase().replace(/[-_]/g, "");
389
- return t.includes(n) ? n : t.includes(r) ? r : t.includes(`${r}Icon`) ? `${r}Icon` : t.find((e) => e.toLowerCase().replace(/[-_]/g, "") === i) || "HelpCircle";
390
- }
391
- function T(e) {
407
+ function O(e) {
392
408
  let t = e.attributes || {}, n = Math.max(1, Number(t.rowCount) || 2), r = Math.max(1, Number(t.colCount) || 2), i = Array.isArray(t.cells) ? t.cells : [], a = [];
393
409
  for (let e = 0; e < n; e++) {
394
410
  let t = Array.isArray(i[e]) ? i[e] : [], n = [];
@@ -404,29 +420,29 @@ function T(e) {
404
420
  striped: !!t.striped
405
421
  };
406
422
  }
407
- var E = 8;
408
- function D(e, t, n) {
409
- let r = n < E && Array.isArray(e?.children) ? e.children : [];
423
+ var k = 8;
424
+ function A(e, t, n) {
425
+ let r = n < k && Array.isArray(e?.children) ? e.children : [];
410
426
  return {
411
427
  id: typeof e?.id == "string" && e.id ? e.id : `item-${t}`,
412
428
  title: typeof e?.title == "string" && e.title.trim() ? e.title : `Item ${t + 1}`,
413
429
  content: typeof e?.content == "string" ? e.content : "",
414
430
  defaultOpen: !!e?.defaultOpen,
415
- children: r.map((e, t) => D(e, t, n + 1))
431
+ children: r.map((e, t) => A(e, t, n + 1))
416
432
  };
417
433
  }
418
- function O(e, t) {
434
+ function j(e, t) {
419
435
  if (t !== "multi") {
420
436
  let t = !1;
421
437
  for (let n of e) n.defaultOpen && (t ? n.defaultOpen = !1 : t = !0);
422
438
  }
423
- for (let n of e) O(n.children, t);
439
+ for (let n of e) j(n.children, t);
424
440
  }
425
- function k(e) {
426
- let t = e.attributes || {}, n = t.mode === "multi" ? "multi" : "single", r = (Array.isArray(t.items) ? t.items : []).map((e, t) => D(e, t, 0));
427
- return O(r, n), r;
441
+ function M(e) {
442
+ let t = e.attributes || {}, n = t.mode === "multi" ? "multi" : "single", r = (Array.isArray(t.items) ? t.items : []).map((e, t) => A(e, t, 0));
443
+ return j(r, n), r;
428
444
  }
429
- function A(e, t, n) {
445
+ function N(e, t, n) {
430
446
  let r = JSON.parse(JSON.stringify(Array.isArray(e) ? e : [])), i = (e, t) => {
431
447
  let [r, ...a] = t;
432
448
  if (e[r]) {
@@ -444,7 +460,7 @@ function A(e, t, n) {
444
460
  }
445
461
  //#endregion
446
462
  //#region src/utilities/iconSvgStatic.ts
447
- var j = {
463
+ var P = {
448
464
  "a-arrow-down": [
449
465
  ["path", { d: "m14 12 4 4 4-4" }],
450
466
  ["path", { d: "M18 16V7" }],
@@ -15264,18 +15280,18 @@ var j = {
15264
15280
  y2: "11"
15265
15281
  }]
15266
15282
  ]
15267
- }, M = "circle-help";
15268
- function N(e) {
15283
+ }, F = "circle-help";
15284
+ function I(e) {
15269
15285
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
15270
15286
  }
15271
- function P(e) {
15272
- let t = e || "HelpCircle", n = N(t.replace(/^\w/, (e) => e.toUpperCase()));
15273
- if (j[n]) return n;
15287
+ function L(e) {
15288
+ let t = e || "HelpCircle", n = I(t.replace(/^\w/, (e) => e.toUpperCase()));
15289
+ if (P[n]) return n;
15274
15290
  let r = t.toLowerCase().replace(/[-_\s]/g, "");
15275
- return Object.keys(j).find((e) => e.replace(/-/g, "") === r) || M;
15291
+ return Object.keys(P).find((e) => e.replace(/-/g, "") === r) || F;
15276
15292
  }
15277
- function F(e, t, n) {
15278
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${(j[P(e)] || j[M] || []).map(([e, t]) => `<${e} ${Object.entries(t).map(([e, t]) => `${e}="${String(t)}"`).join(" ")}></${e}>`).join("")}</svg>`;
15293
+ function R(e, t, n) {
15294
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${(P[L(e)] || P[F] || []).map(([e, t]) => `<${e} ${Object.entries(t).map(([e, t]) => `${e}="${String(t)}"`).join(" ")}></${e}>`).join("")}</svg>`;
15279
15295
  }
15280
15296
  //#endregion
15281
- export { t as S, A as _, u as a, i as b, h as c, w as d, c as f, C as g, v as h, k as i, p as l, T as m, g as n, d as o, s as p, o as r, f as s, F as t, l as u, r as v, e as x, n as y };
15297
+ export { t as S, N as _, u as a, i as b, g as c, c as d, s as f, D as g, S as h, M as i, m as l, f as m, _ as n, d as o, O as p, o as r, p as s, R as t, l as u, r as v, e as x, n as y };
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { PlexoBuilder } from './playground';
3
3
  export type { PlexoBuilderProps, PlexoBuilderRef, PlexoTargetType, MergeTag, CommentTarget } from './playground';
4
4
  export { compileToHTML, compileToPlainText, compileToHTMLWithStrataAuto, injectStrataBundle } from './utilities/compiler';
5
5
  export { parseJsonToTargetFormat } from './utilities/compilerClient';
6
+ export { sanitizeCompiledHtml, ALLOWED_TAGS as SANITIZE_ALLOWED_TAGS, ALLOWED_ATTR as SANITIZE_ALLOWED_ATTR } from './utilities/sanitizeCompiledHtml';
6
7
  export { createTokenMapping, applyTokensToElement, getTokensByCategory, generateTokenCSS, resolveTokenValue, createTokenSwatch, } from './utilities/strataTokenMapping';
7
8
  export type { StrataToken, StrataTokenSet } from './utilities/strataTokenMapping';
8
9
  export type { CompileTarget } from './utilities/compilerClient';