yuhwa 1.0.0 → 1.0.2

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.
@@ -590,8 +590,28 @@ function resolveColor(v, theme, fallbackLevel) {
590
590
  const lvl = m[2] ? Number(m[2]) : fallbackLevel;
591
591
  return ramp(m[1], lvl in L ? lvl : fallbackLevel);
592
592
  }
593
- return v;
593
+ return isSafeCss(v) ? v : void 0;
594
594
  }
595
+ /**
596
+ * True when a value can sit inside an SVG attribute or a style rule as is:
597
+ * any CSS colour or font list passes, quotes, angle brackets, `;`, braces,
598
+ * `&` and backslashes do not. Colours outside the palette go through this.
599
+ */
600
+ const isSafeCss = (v) => /^[\w\s#(),.%/+-]*$/.test(v);
601
+ /**
602
+ * True for a link a diagram may carry: http(s), mailto, an anchor or a
603
+ * relative path. Other schemes (`javascript:`, `data:`, …) run code when the
604
+ * SVG is inlined in a page. Browsers drop whitespace and control characters
605
+ * inside a scheme, so the check does too.
606
+ */
607
+ const isSafeLink = (v) => {
608
+ const scheme = v.replace(/[\u0000-\u0020\u007f]/g, "").match(/^([a-z][a-z0-9+.-]*):/i);
609
+ return !scheme || [
610
+ "http",
611
+ "https",
612
+ "mailto"
613
+ ].includes(scheme[1].toLowerCase());
614
+ };
595
615
  // src/core/inline.ts
596
616
  const COLOR_RE = /^(#[0-9a-fA-F]{3,8}|[a-z]+(?:-\d{2,3})?)$/;
597
617
  const INLINE_RE = /\*\*(.+?)\*\*|~~(.+?)~~|`([^`]+)`|\[\[(.+?)\]\]|\{(#[0-9a-fA-F]{3,8}|[a-z]+(?:-\d{2,3})?):[ ]?(.+?)\}|\*(.+?)\*/g;
@@ -1951,6 +1971,7 @@ function checkProps(props, allowed, what, line0, warn, propLines) {
1951
1971
  warn(line, `Unknown ${k} "${v}"${didYouMean(v, opts) || ` (use one of: ${shown.join(", ")})`}`);
1952
1972
  } else if (BOOLS.includes(k) && !["true", "false"].includes(v)) warn(line, `${k} expects true or false, got "${v}"`);
1953
1973
  else if (NUMBERS.includes(k) && !Number.isFinite(parseFloat(v))) warn(line, `${k} expects a number, got "${v}"`);
1974
+ else if (k === "link" && !isSafeLink(v)) warn(line, `link "${v}" is not rendered: use http(s), mailto, an #anchor or a relative path`);
1954
1975
  }
1955
1976
  }
1956
1977
  function lint(d) {
@@ -2644,312 +2665,295 @@ function parse(source, opts = {}) {
2644
2665
  statement(raw, li);
2645
2666
  gen = was;
2646
2667
  };
2647
- const statement = (raw, li) => {
2648
- const top = stack[stack.length - 1];
2649
- if (top?.kind === "body") {
2650
- if (raw.trim() === "}") {
2651
- stack.pop();
2652
- const n = d.nodes.get(top.id);
2653
- n.body = dedent(top.lines);
2654
- n.bodyLines = [top.start, li];
2655
- } else top.lines.push(raw);
2656
- return;
2657
- }
2658
- if (top?.kind === "panel") {
2659
- if (raw.trim() === "}") {
2660
- stack.pop();
2661
- const p = top.panel;
2662
- const lead = top.lines.findIndex((l) => l.trim());
2663
- p.body = dedent(top.lines);
2664
- p.lines = [top.start, li];
2665
- p.data = PANELS.get(p.kind).parse(p.body, p.props, (i, msg) => warn(i < 0 ? top.start : top.start + 1 + Math.max(0, lead) + i, msg));
2666
- } else top.lines.push(raw.slice(0, lex(raw).codeEnd).trimEnd());
2667
- return;
2668
- }
2669
- if (top?.kind === "theme") {
2670
- const code = raw.slice(0, lex(raw).codeEnd).trim();
2671
- if (!code) return;
2672
- if (code === "}") {
2673
- stack.pop();
2674
- defineTheme(top.id, top.props, top.start);
2675
- return;
2676
- }
2677
- const m = code.match(/^([A-Za-z][\w-]*)\s*:\s*(.*)$/);
2678
- if (!m) return void warn(li, `Expected "key: value" in theme ${top.id} (keys: ${THEME_KEY_NAMES.join(", ")})`, "error");
2679
- themeProp(top.props, m[1].toLowerCase(), unquote(m[2].trim()), li);
2680
- return;
2681
- }
2682
- if (top?.kind === "layout") {
2683
- const code = raw.slice(0, lex(raw).codeEnd).trim();
2684
- if (!code) return;
2685
- if (code.startsWith("}")) {
2686
- stack.pop();
2687
- d.layoutBlock[1] = li;
2688
- return;
2689
- }
2690
- layoutLines.set(code.split(/\s+/)[0], li);
2691
- parseLayoutLine(code, li, d, warn);
2692
- return;
2693
- }
2694
- const { tokens, codeEnd } = lex(raw);
2695
- if (!tokens.length) return;
2696
- const t = tokens;
2697
- const foreign = /^\s*%%/.test(raw) ? "Comments start with # or //" : /(--|==|-\.|->|=>)\|[^|]*\|/.test(raw) ? "Edge labels go after a colon: a -> b: label" : void 0;
2698
- if (foreign) {
2699
- warn(li, foreign, "error");
2668
+ /** node body: verbatim lines until a line that is only "}" */
2669
+ const bodyLine = (top, raw, li) => {
2670
+ if (raw.trim() === "}") {
2671
+ stack.pop();
2672
+ const n = d.nodes.get(top.id);
2673
+ n.body = dedent(top.lines);
2674
+ n.bodyLines = [top.start, li];
2675
+ } else top.lines.push(raw);
2676
+ };
2677
+ /** panel body: verbatim too, handed to the panel plugin on close */
2678
+ const panelLine = (top, raw, li) => {
2679
+ if (raw.trim() === "}") {
2680
+ stack.pop();
2681
+ const p = top.panel;
2682
+ const lead = top.lines.findIndex((l) => l.trim());
2683
+ p.body = dedent(top.lines);
2684
+ p.lines = [top.start, li];
2685
+ p.data = PANELS.get(p.kind).parse(p.body, p.props, (i, msg) => warn(i < 0 ? top.start : top.start + 1 + Math.max(0, lead) + i, msg));
2686
+ } else top.lines.push(raw.slice(0, lex(raw).codeEnd).trimEnd());
2687
+ };
2688
+ /** theme body: `key: value` lines */
2689
+ const themeBodyLine = (top, raw, li) => {
2690
+ const code = raw.slice(0, lex(raw).codeEnd).trim();
2691
+ if (!code) return;
2692
+ if (code === "}") {
2693
+ stack.pop();
2694
+ defineTheme(top.id, top.props, top.start);
2700
2695
  return;
2701
2696
  }
2702
- if (t[0].kind === "punct" && t[0].value === "}") {
2703
- if (!stack.length) warn(li, "Unmatched \"}\"", "error");
2704
- else stack.pop();
2705
- lastDecl = null;
2697
+ const m = code.match(/^([A-Za-z][\w-]*)\s*:\s*(.*)$/);
2698
+ if (!m) return void warn(li, `Expected "key: value" in theme ${top.id} (keys: ${THEME_KEY_NAMES.join(", ")})`, "error");
2699
+ themeProp(top.props, m[1].toLowerCase(), unquote(m[2].trim()), li);
2700
+ };
2701
+ const layoutLine = (raw, li) => {
2702
+ const code = raw.slice(0, lex(raw).codeEnd).trim();
2703
+ if (!code) return;
2704
+ if (code.startsWith("}")) {
2705
+ stack.pop();
2706
+ d.layoutBlock[1] = li;
2706
2707
  return;
2707
2708
  }
2708
- const selective = t[1]?.value === "{" && t.some((x) => x.kind === "ident" && x.value === "from");
2709
- if (t[0].kind === "ident" && t[0].value === "import" && (t[1]?.kind === "string" || t.length === 1 || selective)) {
2710
- if (stack.length) warn(li, "import must be at the top level", "error");
2711
- else if (!t[1]) warn(li, "import needs a path: import \"./shared.yuhwa\"", "error");
2712
- else if (!selective) {
2713
- if (t.length > 2) warn(li, `Unexpected "${t[2].value}" after import path`, "error");
2714
- importFile(t[1].value, li);
2715
- } else {
2716
- const names = readImportList(t, li, warn);
2717
- if (names) importFile(names.path, li, names.names);
2718
- }
2719
- return;
2709
+ layoutLines.set(code.split(/\s+/)[0], li);
2710
+ parseLayoutLine(code, li, d, warn);
2711
+ };
2712
+ const closeBlock = (li) => {
2713
+ if (!stack.length) warn(li, "Unmatched \"}\"", "error");
2714
+ else stack.pop();
2715
+ lastDecl = null;
2716
+ };
2717
+ /** import "./shared.yuhwa" | import { api, db as store, .svc } from "./shared.yuhwa" */
2718
+ const importStmt = (t, li, selective) => {
2719
+ if (stack.length) warn(li, "import must be at the top level", "error");
2720
+ else if (!t[1]) warn(li, "import needs a path: import \"./shared.yuhwa\"", "error");
2721
+ else if (!selective) {
2722
+ if (t.length > 2) warn(li, `Unexpected "${t[2].value}" after import path`, "error");
2723
+ importFile(t[1].value, li);
2724
+ } else {
2725
+ const names = readImportList(t, li, warn);
2726
+ if (names) importFile(names.path, li, names.names);
2720
2727
  }
2721
- if (t[0].kind === "ident" && t[0].value === "export" && t.length > 1 && t[1].kind !== "arrow" && t[1].value !== ":") {
2722
- if (stack.length) warn(li, "export must be at the top level", "error");
2723
- const setting = t[1].kind === "ident" && t[2]?.value === ":" && KNOWN_SETTINGS.has(t[1].value.toLowerCase());
2724
- if (setting || t[1].value === "theme" && t[2]?.kind === "ident") {
2725
- const key = t[1].value.toLowerCase();
2726
- if (setting && !d.sharedSettings?.includes(key)) (d.sharedSettings ??= []).push(key);
2727
- return step(raw.slice(0, t[0].start) + " ".repeat(6) + raw.slice(t[0].end), li);
2728
- }
2729
- hasExport = true;
2730
- const list = t.slice(1).every((x) => x.kind === "ident" || x.kind === "class" || x.value === ",");
2731
- if (t[1].value === "def" && t[2]) exported.add(t[2].value);
2732
- else if (t[1].value.startsWith("$") && (t[2]?.value === ":" || t[2]?.value === "=")) exported.add(t[1].value);
2733
- else for (const x of t.slice(1)) if (x.kind === "ident" || x.kind === "class") exported.add(x.kind === "class" ? `.${x.value}` : x.value);
2734
- if (list && !t.slice(1).some((x) => x.kind === "ident" && PANELS.has(x.value))) return;
2728
+ };
2729
+ /** export api, .svc | export api "API" [blue] | export group g { ... } */
2730
+ const exportStmt = (t, raw, li) => {
2731
+ if (stack.length) warn(li, "export must be at the top level", "error");
2732
+ const setting = t[1].kind === "ident" && t[2]?.value === ":" && KNOWN_SETTINGS.has(t[1].value.toLowerCase());
2733
+ if (setting || t[1].value === "theme" && t[2]?.kind === "ident") {
2734
+ const key = t[1].value.toLowerCase();
2735
+ if (setting && !d.sharedSettings?.includes(key)) (d.sharedSettings ??= []).push(key);
2735
2736
  return step(raw.slice(0, t[0].start) + " ".repeat(6) + raw.slice(t[0].end), li);
2736
2737
  }
2737
- const stmt = t[0].kind === "ident" ? STATEMENTS.get(t[0].value) : void 0;
2738
- if (stmt && t[1]?.kind !== "arrow" && t[1]?.value !== ":" && t[1]?.value !== ",") {
2739
- stmt.parse(raw.slice(t[0].end, codeEnd).trim(), d, {
2740
- line: li,
2741
- warn: (msg, sev) => warn(li, msg, sev)
2742
- });
2743
- return;
2744
- }
2745
- if (t[0].kind === "ident" && t[0].value === "theme" && t[1]?.kind === "ident" && (t[2]?.kind === "props" || t[2]?.value === "{")) {
2746
- if (stack.length) warn(li, "theme must be at the top level", "error");
2747
- const props = {};
2748
- let k = 2;
2749
- if (t[k]?.kind === "props") {
2750
- for (const [key, v] of Object.entries(parseProps(t[k].value))) themeProp(props, key, v, li);
2751
- k++;
2752
- }
2753
- if (t[k]?.value === "{") {
2754
- k++;
2755
- if (t[k]?.value === "}") k++;
2756
- else if (k === t.length) return void stack.push({
2757
- kind: "theme",
2758
- id: t[1].value,
2759
- start: li,
2760
- props
2761
- });
2762
- }
2763
- if (k < t.length) warn(li, `Unexpected "${t[k].value}" in theme ${t[1].value}`, "error");
2764
- defineTheme(t[1].value, props, li);
2765
- return;
2738
+ hasExport = true;
2739
+ const list = t.slice(1).every((x) => x.kind === "ident" || x.kind === "class" || x.value === ",");
2740
+ if (t[1].value === "def" && t[2]) exported.add(t[2].value);
2741
+ else if (t[1].value.startsWith("$") && (t[2]?.value === ":" || t[2]?.value === "=")) exported.add(t[1].value);
2742
+ else for (const x of t.slice(1)) if (x.kind === "ident" || x.kind === "class") exported.add(x.kind === "class" ? `.${x.value}` : x.value);
2743
+ if (list && !t.slice(1).some((x) => x.kind === "ident" && PANELS.has(x.value))) return;
2744
+ return step(raw.slice(0, t[0].start) + " ".repeat(6) + raw.slice(t[0].end), li);
2745
+ };
2746
+ /** theme brand [base: midnight] { | theme brand [base: midnight, accent: red] */
2747
+ const themeStmt = (t, li) => {
2748
+ if (stack.length) warn(li, "theme must be at the top level", "error");
2749
+ const props = {};
2750
+ let k = 2;
2751
+ if (t[k]?.kind === "props") {
2752
+ for (const [key, v] of Object.entries(parseProps(t[k].value))) themeProp(props, key, v, li);
2753
+ k++;
2766
2754
  }
2767
- if (t.length > 2 && t[0].kind === "ident" && !PANELS.has(t[0].value) && t[1].kind === "ident" && t[t.length - 1].value === "{" && t[0].value !== "group" && t[0].value !== "layout") warn(li, `"${t[0].value} ${t[1].value} {" reads as two nodes; "${t[0].value}" is not a panel kind (${[...PANELS.keys()].join(", ")})` + (PANEL_ALIASES[t[0].value] && PANELS.has(PANEL_ALIASES[t[0].value].split(" ")[0]) ? `: write "${PANEL_ALIASES[t[0].value].replace("ID", t[1].value)} {"` : ""));
2768
- if (t[0].kind === "ident" && PANELS.has(t[0].value) && t[t.length - 1].value === "{" && (t[1]?.kind === "ident" || t[1]?.kind === "string" || t[1]?.kind === "props" || t[1]?.value === "{")) {
2769
- const kind = t[0].value;
2770
- let k = 1;
2771
- const id = t[k]?.kind === "ident" ? t[k++].value : `${kind}${d.panels.length + 1}`;
2772
- const labelRef = gen ? void 0 : t[k]?.kind === "string" ? {
2773
- line: li,
2774
- at: t[k].start,
2775
- range: [t[k].start, t[k].end]
2776
- } : {
2777
- line: li,
2778
- at: t[k - 1].end
2779
- };
2780
- const label = t[k]?.kind === "string" ? t[k++].value : void 0;
2781
- const ref = {
2782
- line: li,
2783
- insertAt: t[k - 1].end
2784
- };
2785
- let props = {};
2786
- if (t[k]?.kind === "props") {
2787
- props = parseProps(t[k].value);
2788
- ref.props = [t[k].start, t[k].end];
2789
- k++;
2790
- }
2791
- if (props.vertical !== void 0 && props.direction === void 0 && props.vertical !== "false") props.direction = "down";
2792
- delete props.vertical;
2793
- if (k !== t.length - 1) warn(li, `Unexpected "${t[k].value}" in ${kind} header`, "error");
2794
- if (stack.length) warn(li, `${kind} must be at the top level`, "error");
2795
- const panel = {
2796
- kind,
2797
- id,
2798
- label,
2799
- props,
2800
- body: [],
2801
- data: void 0,
2802
- ref: gen ? void 0 : ref,
2803
- labelRef
2804
- };
2805
- d.panels.push(panel);
2806
- stack.push({
2807
- kind: "panel",
2808
- id,
2755
+ if (t[k]?.value === "{") {
2756
+ k++;
2757
+ if (t[k]?.value === "}") k++;
2758
+ else if (k === t.length) return void stack.push({
2759
+ kind: "theme",
2760
+ id: t[1].value,
2809
2761
  start: li,
2810
- lines: [],
2811
- panel
2762
+ props
2812
2763
  });
2813
- return;
2814
2764
  }
2815
- if (t[0].kind === "ident" && t[0].value === "layout" && t[1]?.value === "{") {
2816
- if (stack.length) warn(li, "layout block must be at top level", "error");
2817
- d.layoutBlock = [li, li];
2818
- if (t[2]?.value === "}") return;
2819
- stack.push({ kind: "layout" });
2820
- return;
2765
+ if (k < t.length) warn(li, `Unexpected "${t[k].value}" in theme ${t[1].value}`, "error");
2766
+ defineTheme(t[1].value, props, li);
2767
+ };
2768
+ /** `gantt g {`: looks like a panel of a kind nobody registered */
2769
+ const unknownPanelHint = (t, li) => {
2770
+ warn(li, `"${t[0].value} ${t[1].value} {" reads as two nodes; "${t[0].value}" is not a panel kind (${[...PANELS.keys()].join(", ")})` + (PANEL_ALIASES[t[0].value] && PANELS.has(PANEL_ALIASES[t[0].value].split(" ")[0]) ? `: write "${PANEL_ALIASES[t[0].value].replace("ID", t[1].value)} {"` : ""));
2771
+ };
2772
+ /** sequence id "Title" [props] { — a panel drawn by a plugin */
2773
+ const panelStmt = (t, li) => {
2774
+ const kind = t[0].value;
2775
+ let k = 1;
2776
+ const id = t[k]?.kind === "ident" ? t[k++].value : `${kind}${d.panels.length + 1}`;
2777
+ const labelRef = gen ? void 0 : t[k]?.kind === "string" ? {
2778
+ line: li,
2779
+ at: t[k].start,
2780
+ range: [t[k].start, t[k].end]
2781
+ } : {
2782
+ line: li,
2783
+ at: t[k - 1].end
2784
+ };
2785
+ const label = t[k]?.kind === "string" ? t[k++].value : void 0;
2786
+ const ref = {
2787
+ line: li,
2788
+ insertAt: t[k - 1].end
2789
+ };
2790
+ let props = {};
2791
+ if (t[k]?.kind === "props") {
2792
+ props = parseProps(t[k].value);
2793
+ ref.props = [t[k].start, t[k].end];
2794
+ k++;
2821
2795
  }
2822
- if (t[0].kind === "ident" && t[0].value === "group" && (t[1]?.kind === "ident" || t[1]?.kind === "string" && t.some((x) => x.value === "{"))) {
2823
- let k = 2;
2824
- let id = t[1].value;
2825
- if (t[1].kind === "string") {
2826
- id = t[1].value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "group";
2827
- k = 1;
2828
- }
2829
- const g = d.groups.get(id) ?? {
2830
- id,
2831
- label: id,
2832
- props: {},
2833
- parent: currentGroup()
2834
- };
2835
- if (t[k]?.kind === "string") {
2836
- const s = t[k++];
2837
- g.label = s.value;
2838
- g.labelRef = {
2839
- line: li,
2840
- at: s.start,
2841
- range: [s.start, s.end],
2842
- id: k === 2 ? id : void 0
2843
- };
2844
- } else g.labelRef ??= {
2845
- line: li,
2846
- at: t[1].end
2847
- };
2848
- if (gen) g.labelRef.generated = true;
2849
- while (t[k]?.kind === "class") (g.classes ??= []).push(t[k++].value);
2850
- const ref = {
2796
+ if (props.vertical !== void 0 && props.direction === void 0 && props.vertical !== "false") props.direction = "down";
2797
+ delete props.vertical;
2798
+ if (k !== t.length - 1) warn(li, `Unexpected "${t[k].value}" in ${kind} header`, "error");
2799
+ if (stack.length) warn(li, `${kind} must be at the top level`, "error");
2800
+ const panel = {
2801
+ kind,
2802
+ id,
2803
+ label,
2804
+ props,
2805
+ body: [],
2806
+ data: void 0,
2807
+ ref: gen ? void 0 : ref,
2808
+ labelRef
2809
+ };
2810
+ d.panels.push(panel);
2811
+ stack.push({
2812
+ kind: "panel",
2813
+ id,
2814
+ start: li,
2815
+ lines: [],
2816
+ panel
2817
+ });
2818
+ };
2819
+ /** layout { ... } */
2820
+ const layoutStmt = (t, li) => {
2821
+ if (stack.length) warn(li, "layout block must be at top level", "error");
2822
+ d.layoutBlock = [li, li];
2823
+ if (t[2]?.value === "}") return;
2824
+ stack.push({ kind: "layout" });
2825
+ };
2826
+ /** group id "Label" [.class ...] [props] { ... } | group "Label" { ... } */
2827
+ const groupStmt = (t, raw, li) => {
2828
+ let k = 2;
2829
+ let id = t[1].value;
2830
+ if (t[1].kind === "string") {
2831
+ id = t[1].value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "group";
2832
+ k = 1;
2833
+ }
2834
+ const g = d.groups.get(id) ?? {
2835
+ id,
2836
+ label: id,
2837
+ props: {},
2838
+ parent: currentGroup()
2839
+ };
2840
+ if (t[k]?.kind === "string") {
2841
+ const s = t[k++];
2842
+ g.label = s.value;
2843
+ g.labelRef = {
2851
2844
  line: li,
2852
- insertAt: t[k - 1].end,
2853
- generated: gen || void 0
2845
+ at: s.start,
2846
+ range: [s.start, s.end],
2847
+ id: k === 2 ? id : void 0
2854
2848
  };
2855
- if (t[k]?.kind === "props") {
2856
- Object.assign(g.props, parseProps(t[k].value));
2857
- ref.props = [t[k].start, t[k].end];
2858
- k++;
2859
- }
2860
- g.ref = ref;
2861
- lastDecl = {
2862
- indent: indentOf(raw),
2863
- targets: [g]
2864
- };
2865
- d.groups.set(id, g);
2866
- if (t[k]?.value !== "{") {
2867
- warn(li, `Expected "{" after group ${id}`, "error");
2868
- return;
2869
- }
2849
+ } else g.labelRef ??= {
2850
+ line: li,
2851
+ at: t[1].end
2852
+ };
2853
+ if (gen) g.labelRef.generated = true;
2854
+ while (t[k]?.kind === "class") (g.classes ??= []).push(t[k++].value);
2855
+ const ref = {
2856
+ line: li,
2857
+ insertAt: t[k - 1].end,
2858
+ generated: gen || void 0
2859
+ };
2860
+ if (t[k]?.kind === "props") {
2861
+ Object.assign(g.props, parseProps(t[k].value));
2862
+ ref.props = [t[k].start, t[k].end];
2870
2863
  k++;
2871
- const close = t.findIndex((x, idx) => idx >= k && x.value === "}");
2872
- if (close >= 0) {
2873
- for (let j = k; j < close; j++) if (t[j].kind === "ident") {
2874
- const n = touchNode(t[j].value);
2875
- n.group = id;
2876
- }
2877
- return;
2878
- }
2879
- stack.push({
2880
- kind: "group",
2881
- id
2882
- });
2864
+ }
2865
+ g.ref = ref;
2866
+ lastDecl = {
2867
+ indent: indentOf(raw),
2868
+ targets: [g]
2869
+ };
2870
+ d.groups.set(id, g);
2871
+ if (t[k]?.value !== "{") {
2872
+ warn(li, `Expected "{" after group ${id}`, "error");
2883
2873
  return;
2884
2874
  }
2885
- const last = t[t.length - 1];
2886
- if (t[0].kind === "class" && t.slice(1, -1).every((x) => x.kind === "class") && (last.kind === "props" || last.kind === "class")) {
2887
- const base = {};
2888
- for (const x of t.slice(1)) {
2889
- if (x.kind !== "class") continue;
2890
- if (!d.classes[x.value]) warn(li, `Unknown class ".${x.value}"${didYouMean(x.value, Object.keys(d.classes))}`);
2891
- else Object.assign(base, d.classes[x.value]);
2875
+ k++;
2876
+ const close = t.findIndex((x, idx) => idx >= k && x.value === "}");
2877
+ if (close >= 0) {
2878
+ for (let j = k; j < close; j++) if (t[j].kind === "ident") {
2879
+ const n = touchNode(t[j].value);
2880
+ n.group = id;
2892
2881
  }
2893
- d.classes[t[0].value] = {
2894
- ...d.classes[t[0].value],
2895
- ...base,
2896
- ...last.kind === "props" ? parseProps(last.value) : {}
2897
- };
2898
- (d.classLines ??= {})[t[0].value] = li;
2899
- lastDecl = {
2900
- indent: indentOf(raw),
2901
- targets: [{ props: d.classes[t[0].value] }]
2902
- };
2903
2882
  return;
2904
2883
  }
2905
- if (t[0].kind === "ident" && t[1]?.kind === "punct" && t[1].value === ":") {
2906
- const key = propKey(t[0].value);
2907
- let value = raw.slice(t[1].end, codeEnd).trim();
2908
- if (/^(["']).*\1$/.test(value)) value = unescape(value.slice(1, -1));
2909
- const deeper = lastDecl && indentOf(raw) > lastDecl.indent ? lastDecl.targets : null;
2910
- const grp = top?.kind === "group" ? d.groups.get(top.id) : void 0;
2911
- const targets = deeper ?? (grp ? [grp] : null);
2912
- if (targets) {
2913
- for (const x of targets) {
2914
- x.props[key] = value || "true";
2915
- if (x.ref && !gen) (x.ref.propLines ??= {})[key] = li;
2916
- }
2917
- return;
2918
- }
2919
- if (stack.length) warn(li, `Setting "${key}" should be at the top level`);
2920
- if (!KNOWN_SETTINGS.has(key)) {
2921
- const id = t[0].value;
2922
- const node = value.startsWith("{") ? `${id} [${value.slice(1, -1).trim()}]` : `${id} "${value}"`;
2923
- warn(li, `Unknown setting "${key}"${didYouMean(key, [...KNOWN_SETTINGS]) || `. For a node write ${node}`}`);
2924
- return;
2884
+ stack.push({
2885
+ kind: "group",
2886
+ id
2887
+ });
2888
+ };
2889
+ /** .class [props] | .primary .svc [bold]: a class built on other classes | .class alone, props on lines below */
2890
+ const classStmt = (t, raw, li) => {
2891
+ const last = t[t.length - 1];
2892
+ const base = {};
2893
+ for (const x of t.slice(1)) {
2894
+ if (x.kind !== "class") continue;
2895
+ if (!d.classes[x.value]) warn(li, `Unknown class ".${x.value}"${didYouMean(x.value, Object.keys(d.classes))}`);
2896
+ else Object.assign(base, d.classes[x.value]);
2897
+ }
2898
+ d.classes[t[0].value] = {
2899
+ ...d.classes[t[0].value],
2900
+ ...base,
2901
+ ...last.kind === "props" ? parseProps(last.value) : {}
2902
+ };
2903
+ (d.classLines ??= {})[t[0].value] = li;
2904
+ lastDecl = {
2905
+ indent: indentOf(raw),
2906
+ targets: [{ props: d.classes[t[0].value] }]
2907
+ };
2908
+ };
2909
+ /** key: value — a setting, or a prop of the declaration above or the enclosing group */
2910
+ const settingStmt = (t, raw, li, codeEnd, top) => {
2911
+ const key = propKey(t[0].value);
2912
+ let value = raw.slice(t[1].end, codeEnd).trim();
2913
+ if (/^(["']).*\1$/.test(value)) value = unescape(value.slice(1, -1));
2914
+ const deeper = lastDecl && indentOf(raw) > lastDecl.indent ? lastDecl.targets : null;
2915
+ const grp = top?.kind === "group" ? d.groups.get(top.id) : void 0;
2916
+ const targets = deeper ?? (grp ? [grp] : null);
2917
+ if (targets) {
2918
+ for (const x of targets) {
2919
+ x.props[key] = value || "true";
2920
+ if (x.ref && !gen) (x.ref.propLines ??= {})[key] = li;
2925
2921
  }
2926
- if (key === "direction") value = DIRECTION_ALIASES[value.toLowerCase()] ?? value;
2927
- if (key === "theme") themeLine = li;
2928
- const allowed = key === "theme" ? void 0 : SETTING_VALUES[key];
2929
- if (allowed && value && !value.includes("$") && !allowed.includes(value)) warn(li, `Unknown ${key} "${value}"${didYouMean(value, allowed) || ` (use one of: ${allowed.join(", ")})`}`);
2930
- d.settings[key] = value;
2931
2922
  return;
2932
2923
  }
2933
- if (t.some((x) => x.kind === "arrow")) {
2934
- const ne = d.edges.length;
2935
- parseEdgeStatement(t, li, raw.slice(0, codeEnd), d, touchNode, edgeCount, warn, relabel);
2936
- lastDecl = {
2937
- indent: indentOf(raw),
2938
- targets: d.edges.slice(ne)
2939
- };
2940
- if (gen) {
2941
- for (const e of d.edges.slice(ne)) {
2942
- if (e.ref) e.ref.generated = true;
2943
- if (e.labelRef) e.labelRef.generated = true;
2944
- }
2945
- for (const x of t) if (x.kind === "ident") {
2946
- const n = d.nodes.get(x.value);
2947
- if (n?.ref?.line === li) n.ref.generated = true;
2948
- if (n?.labelRef?.line === li) n.labelRef.generated = true;
2949
- }
2950
- }
2924
+ if (stack.length) warn(li, `Setting "${key}" should be at the top level`);
2925
+ if (!KNOWN_SETTINGS.has(key)) {
2926
+ const id = t[0].value;
2927
+ const node = value.startsWith("{") ? `${id} [${value.slice(1, -1).trim()}]` : `${id} "${value}"`;
2928
+ warn(li, `Unknown setting "${key}"${didYouMean(key, [...KNOWN_SETTINGS]) || `. For a node write ${node}`}`);
2951
2929
  return;
2952
2930
  }
2931
+ if (key === "direction") value = DIRECTION_ALIASES[value.toLowerCase()] ?? value;
2932
+ if (key === "theme") themeLine = li;
2933
+ const allowed = key === "theme" ? void 0 : SETTING_VALUES[key];
2934
+ if (allowed && value && !value.includes("$") && !allowed.includes(value)) warn(li, `Unknown ${key} "${value}"${didYouMean(value, allowed) || ` (use one of: ${allowed.join(", ")})`}`);
2935
+ d.settings[key] = value;
2936
+ };
2937
+ const edgeStmt = (t, raw, li, codeEnd) => {
2938
+ const ne = d.edges.length;
2939
+ parseEdgeStatement(t, li, raw.slice(0, codeEnd), d, touchNode, edgeCount, warn, relabel);
2940
+ lastDecl = {
2941
+ indent: indentOf(raw),
2942
+ targets: d.edges.slice(ne)
2943
+ };
2944
+ if (!gen) return;
2945
+ for (const e of d.edges.slice(ne)) {
2946
+ if (e.ref) e.ref.generated = true;
2947
+ if (e.labelRef) e.labelRef.generated = true;
2948
+ }
2949
+ for (const x of t) if (x.kind === "ident") {
2950
+ const n = d.nodes.get(x.value);
2951
+ if (n?.ref?.line === li) n.ref.generated = true;
2952
+ if (n?.labelRef?.line === li) n.labelRef.generated = true;
2953
+ }
2954
+ };
2955
+ /** node declarations: id "Label" .cls [props] (several per line allowed) */
2956
+ const nodeStmt = (t, raw, li) => {
2953
2957
  let k = 0;
2954
2958
  let sep = true;
2955
2959
  while (k < t.length) {
@@ -3015,6 +3019,39 @@ function parse(source, opts = {}) {
3015
3019
  };
3016
3020
  }
3017
3021
  };
3022
+ /** one line after substitution: picks the handler; the order of the checks matters */
3023
+ const statement = (raw, li) => {
3024
+ const top = stack[stack.length - 1];
3025
+ if (top?.kind === "body") return bodyLine(top, raw, li);
3026
+ if (top?.kind === "panel") return panelLine(top, raw, li);
3027
+ if (top?.kind === "theme") return themeBodyLine(top, raw, li);
3028
+ if (top?.kind === "layout") return layoutLine(raw, li);
3029
+ const { tokens: t, codeEnd } = lex(raw);
3030
+ if (!t.length) return;
3031
+ const foreign = /^\s*%%/.test(raw) ? "Comments start with # or //" : /(--|==|-\.|->|=>)\|[^|]*\|/.test(raw) ? "Edge labels go after a colon: a -> b: label" : void 0;
3032
+ if (foreign) return void warn(li, foreign, "error");
3033
+ if (t[0].kind === "punct" && t[0].value === "}") return closeBlock(li);
3034
+ const head = t[0].kind === "ident" ? t[0].value : void 0;
3035
+ const selective = t[1]?.value === "{" && t.some((x) => x.kind === "ident" && x.value === "from");
3036
+ if (head === "import" && (t[1]?.kind === "string" || t.length === 1 || selective)) return importStmt(t, li, selective);
3037
+ if (head === "export" && t.length > 1 && t[1].kind !== "arrow" && t[1].value !== ":") return exportStmt(t, raw, li);
3038
+ const stmt = head !== void 0 ? STATEMENTS.get(head) : void 0;
3039
+ if (stmt && t[1]?.kind !== "arrow" && t[1]?.value !== ":" && t[1]?.value !== ",") return void stmt.parse(raw.slice(t[0].end, codeEnd).trim(), d, {
3040
+ line: li,
3041
+ warn: (msg, sev) => warn(li, msg, sev)
3042
+ });
3043
+ if (head === "theme" && t[1]?.kind === "ident" && (t[2]?.kind === "props" || t[2]?.value === "{")) return themeStmt(t, li);
3044
+ const opensBlock = t[t.length - 1].value === "{";
3045
+ if (head !== void 0 && t.length > 2 && !PANELS.has(head) && t[1].kind === "ident" && opensBlock && head !== "group" && head !== "layout") unknownPanelHint(t, li);
3046
+ if (head !== void 0 && PANELS.has(head) && opensBlock && (t[1]?.kind === "ident" || t[1]?.kind === "string" || t[1]?.kind === "props" || t[1]?.value === "{")) return panelStmt(t, li);
3047
+ if (head === "layout" && t[1]?.value === "{") return layoutStmt(t, li);
3048
+ if (head === "group" && (t[1]?.kind === "ident" || t[1]?.kind === "string" && t.some((x) => x.value === "{"))) return groupStmt(t, raw, li);
3049
+ const last = t[t.length - 1];
3050
+ if (t[0].kind === "class" && t.slice(1, -1).every((x) => x.kind === "class") && (last.kind === "props" || last.kind === "class")) return classStmt(t, raw, li);
3051
+ if (head !== void 0 && t[1]?.kind === "punct" && t[1].value === ":") return settingStmt(t, raw, li, codeEnd, top);
3052
+ if (t.some((x) => x.kind === "arrow")) return edgeStmt(t, raw, li, codeEnd);
3053
+ nodeStmt(t, raw, li);
3054
+ };
3018
3055
  for (let li = 0; li < lines.length; li++) step(lines[li], li);
3019
3056
  for (const ctx of stack) if (ctx.kind === "group") warn(lines.length - 1, `Group "${ctx.id}" is missing "}"`, "error");
3020
3057
  else if (ctx.kind === "body") warn(ctx.start, `Body of "${ctx.id}" is missing a closing "}" line`, "error");
@@ -6746,7 +6783,8 @@ function parseQuadrant(body, _props, warn) {
6746
6783
  { text: "" },
6747
6784
  { text: "" }
6748
6785
  ],
6749
- points: []
6786
+ points: [],
6787
+ scale: 1
6750
6788
  };
6751
6789
  const raw = [];
6752
6790
  body.forEach((line0, i) => {
@@ -6778,6 +6816,7 @@ function parseQuadrant(body, _props, warn) {
6778
6816
  });
6779
6817
  });
6780
6818
  const scale = raw.some((p) => p.x > 1 || p.y > 1) ? 100 : 1;
6819
+ out.scale = scale;
6781
6820
  const seen = /* @__PURE__ */ new Set();
6782
6821
  raw.forEach((p, k) => {
6783
6822
  let x = p.x / scale;
@@ -6795,7 +6834,8 @@ function parseQuadrant(body, _props, warn) {
6795
6834
  id,
6796
6835
  x,
6797
6836
  y,
6798
- tone: p.tone
6837
+ tone: p.tone,
6838
+ line: p.line
6799
6839
  });
6800
6840
  });
6801
6841
  return out;
@@ -6809,6 +6849,26 @@ function pointLines(body) {
6809
6849
  });
6810
6850
  return out;
6811
6851
  }
6852
+ /** Replace just the numeric tokens, retaining labels, colour, spacing and percent signs. */
6853
+ function movePoint(body, q, point, x, y) {
6854
+ const out = [...body];
6855
+ const round = (v) => Number(v.toFixed(5));
6856
+ const normalize = q.scale === 100 && round(x * 100) <= 1 && round(y * 100) <= 1 && q.points.every((p) => p === point || p.x <= .01 && p.y <= .01);
6857
+ for (const p of q.points) {
6858
+ if (p !== point && !normalize) continue;
6859
+ const line = body[p.line];
6860
+ const [core] = splitTrailingProps(line, onlyColor);
6861
+ const match = new RegExp(POINT_RE, "d").exec(core.trimEnd());
6862
+ if (!match?.indices?.[3] || !match.indices[4]) return null;
6863
+ const [a, b] = match.indices[3];
6864
+ const [c, d] = match.indices[4];
6865
+ const scale = normalize ? 1 : q.scale;
6866
+ const nx = round((p === point ? x : p.x) * scale);
6867
+ const ny = round((p === point ? y : p.y) * scale);
6868
+ out[p.line] = line.slice(0, a) + nx + line.slice(b, c) + ny + line.slice(d);
6869
+ }
6870
+ return out;
6871
+ }
6812
6872
  const geometry$1 = perPass(function geometry(q, ctx) {
6813
6873
  const { theme, measure } = ctx;
6814
6874
  const fs = ctx.fs * .88;
@@ -7031,7 +7091,8 @@ const quadrant$1 = {
7031
7091
  part: p.id,
7032
7092
  x: px + G.pts[i].x,
7033
7093
  y: box.y + G.pts[i].y,
7034
- title: `move ${p.name}`
7094
+ title: `move ${p.name}`,
7095
+ editPosition: (body, offset) => movePoint(body, q, p, Math.min(1, Math.max(0, p.x + offset.x / G.S)), Math.min(1, Math.max(0, p.y - offset.y / G.S)))
7035
7096
  })), {
7036
7097
  part: "size",
7037
7098
  x: px + G.S,
@@ -8701,6 +8762,12 @@ function placePanels(d, theme, measure, graph) {
8701
8762
  }
8702
8763
  // src/core/render.ts
8703
8764
  const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
8765
+ /** wrap a node in its `link:`; unsafe schemes are dropped (lint reports them) */
8766
+ function withLink(g, link) {
8767
+ if (!link || !isSafeLink(link)) return g;
8768
+ const external = /^https?:/i.test(link.trim());
8769
+ return `<a href="${esc(link)}"${external ? " target=\"_blank\" rel=\"noopener\"" : ""}>${g}</a>`;
8770
+ }
8704
8771
  const f = (n) => (Math.round(n * 100) / 100).toString();
8705
8772
  const attr = (name, v) => v === null || v === void 0 || v === "" ? "" : ` ${name}="${typeof v === "number" ? f(v) : esc(v)}"`;
8706
8773
  let counter = 0;
@@ -8903,7 +8970,7 @@ function renderNode(d, n, L, shadowId) {
8903
8970
  }, L.theme));
8904
8971
  parts.push("</g>");
8905
8972
  let g = parts.join("");
8906
- if (p.link) g = `<a href="${esc(p.link)}"${p.link.startsWith("http") ? " target=\"_blank\" rel=\"noopener\"" : ""}>${g}</a>`;
8973
+ g = withLink(g, p.link);
8907
8974
  return g;
8908
8975
  }
8909
8976
  const cx = n.x + n.w / 2;
@@ -8923,7 +8990,7 @@ function renderNode(d, n, L, shadowId) {
8923
8990
  }
8924
8991
  parts.push("</g>");
8925
8992
  let g = parts.join("");
8926
- if (p.link) g = `<a href="${esc(p.link)}"${p.link.startsWith("http") ? " target=\"_blank\" rel=\"noopener\"" : ""}>${g}</a>`;
8993
+ g = withLink(g, p.link);
8927
8994
  return g;
8928
8995
  }
8929
8996
  // src/convert/json.ts
@@ -11026,6 +11093,38 @@ function editPart(source, panelId, edit, d = parse(source)) {
11026
11093
  id: out === source ? void 0 : id
11027
11094
  };
11028
11095
  }
11096
+ /** Finish a panel drag. Prefer the declaration; a purely visual handle uses layout. */
11097
+ function writePanelDrag(source, d, id, handle) {
11098
+ const decl = d.panels.find((p) => p.id === id);
11099
+ const offset = d.layout.panels?.[id]?.parts?.[handle.part];
11100
+ if (!offset || !handle.editPosition || !decl?.lines || decl.ref?.generated) return writeLayout(source, d.layout, d);
11101
+ const [start, end] = decl.lines;
11102
+ const lines = source.split("\n");
11103
+ const body = lines.slice(start + 1, end);
11104
+ const code = body.map((line) => line.slice(0, lex(line).codeEnd));
11105
+ const first = code.findIndex((line) => line.trim());
11106
+ if (first < 0) return writeLayout(source, d.layout, d);
11107
+ const editable = code.slice(first, first + decl.body.length);
11108
+ const edited = handle.editPosition(editable, offset);
11109
+ if (!edited || edited.length !== editable.length) return writeLayout(source, d.layout, d);
11110
+ edited.forEach((line, i) => {
11111
+ lines[start + 1 + first + i] = line + body[first + i].slice(editable[i].length);
11112
+ });
11113
+ if (d.layoutBlock) {
11114
+ const [a, b] = d.layoutBlock;
11115
+ const key = id + ":" + handle.part;
11116
+ const entries = lines.slice(a + 1, b);
11117
+ const keep = entries.filter((line) => line.trimStart().split(/\s+/, 1)[0] !== key);
11118
+ if (keep.length !== entries.length) {
11119
+ if (keep.some((line) => line.trim())) lines.splice(a + 1, entries.length, ...keep);
11120
+ else {
11121
+ const from = a > 0 && !lines[a - 1].trim() ? a - 1 : a;
11122
+ lines.splice(from, b - from + 1);
11123
+ }
11124
+ }
11125
+ }
11126
+ return lines.join("\n");
11127
+ }
11029
11128
  /** rewrite a panel's body lines, re-indented like the old ones */
11030
11129
  function editBody(source, panelId, d, fn) {
11031
11130
  const decl = d.panels.find((p) => p.id === panelId);
@@ -11058,8 +11157,11 @@ function editBody(source, panelId, d, fn) {
11058
11157
  */
11059
11158
  const COMMENT_OPEN = /^<!--\s*yuhwa(?:\s+([\w.-]+))?\s*$/;
11060
11159
  const FENCE_OPEN = /^(```+|~~~+)\s*yuhwa(?:\s+([\w.-]+))?\s*$/;
11061
- const IMAGE_LINE = /^(!\[[^\]]*\]\([^)]*\.svg\)|<picture>.*<\/picture>)\s*$/;
11062
- function findBlocks(md, baseName = "diagram") {
11160
+ function imageRef(name, lightPath, darkPath) {
11161
+ if (darkPath) return `<picture><source media="(prefers-color-scheme: dark)" srcset="${darkPath}"><img alt="${name}" src="${lightPath}"></picture>`;
11162
+ return `![${name}](${lightPath})`;
11163
+ }
11164
+ function findBlocks(md, baseName = "diagram", outDir = "diagrams") {
11063
11165
  const lines = md.split("\n");
11064
11166
  const blocks = [];
11065
11167
  const used = /* @__PURE__ */ new Set();
@@ -11096,7 +11198,9 @@ function findBlocks(md, baseName = "diagram") {
11096
11198
  };
11097
11199
  let k = j + 1;
11098
11200
  while (k < lines.length && lines[k].trim() === "" && k <= j + 1) k++;
11099
- if (k < lines.length && IMAGE_LINE.test(lines[k].trim())) b.image = [k, k];
11201
+ const candidate = lines[k]?.trim();
11202
+ const path = joinPath(outDir, `${n}.svg`);
11203
+ if (candidate === imageRef(n, path) || candidate === imageRef(n, path, joinPath(outDir, `${n}.dark.svg`))) b.image = [k, k];
11100
11204
  blocks.push(b);
11101
11205
  i = j;
11102
11206
  }
@@ -11105,7 +11209,7 @@ function findBlocks(md, baseName = "diagram") {
11105
11209
  const joinPath = (dir, file) => dir ? dir.replace(/\/+$/, "") + "/" + file : file;
11106
11210
  function processMarkdown(md, opts = {}) {
11107
11211
  const outDir = opts.outDir ?? "diagrams";
11108
- const blocks = findBlocks(md, opts.baseName);
11212
+ const blocks = findBlocks(md, opts.baseName, outDir);
11109
11213
  const lines = md.split("\n");
11110
11214
  const files = [];
11111
11215
  const diagnostics = [];
@@ -11126,7 +11230,7 @@ function processMarkdown(md, opts = {}) {
11126
11230
  path: lightPath,
11127
11231
  svg: light.svg + "\n"
11128
11232
  });
11129
- let ref = `![${b.name}](${lightPath})`;
11233
+ let ref = imageRef(b.name, lightPath);
11130
11234
  if (opts.dark) {
11131
11235
  const dark = render(b.source, {
11132
11236
  ...io,
@@ -11137,7 +11241,7 @@ function processMarkdown(md, opts = {}) {
11137
11241
  path: darkPath,
11138
11242
  svg: dark.svg + "\n"
11139
11243
  });
11140
- ref = `<picture><source media="(prefers-color-scheme: dark)" srcset="${darkPath}"><img alt="${b.name}" src="${lightPath}"></picture>`;
11244
+ ref = imageRef(b.name, lightPath, darkPath);
11141
11245
  }
11142
11246
  const replacement = [];
11143
11247
  if (b.kind === "fence" && !opts.keepFences) replacement.push(`<!--yuhwa ${b.name}`, ...b.source.split("\n"), "-->");
@@ -11451,4 +11555,4 @@ function render(input, opts = {}) {
11451
11555
  diagnostics: diagram.diagnostics
11452
11556
  };
11453
11557
  }
11454
- export { BOOLS as $, footer as A, PANELS as B, git$1 as C, ramp as Ct, legend as D, sequence$1 as E, perPass as F, lex as G, blockBraces as H, recolor as I, parseProps as J, onlyColor as K, registry as L, tables as M, charts as N, approxMeasure as O, themes as P, splitTrailingProps as Q, use as R, builtins as S, isToneOrHex as St, timeline$1 as T, themeNames as Tt, isYuhwaPath as U, SETTING_VALUES as V, joinPath$1 as W, setLineProp as X, serializeProps as Y, setTrailingProp as Z, fromJSON as _, THEME_KEYS as _t, findBlocks as a, PANEL_PROPS as at, groupPath as b, createTheme as bt, editPart as c, renderHead as ct, setPartTone as d, parseInline as dt, EDGE_PROPS as et, setProp as f, renderSegs as ft, isMermaid as g, THEMES as gt, fromMermaid as h, RAMPS as ht, GUIDE as i, NUMBERS as it, frames as j, canvasMeasure as k, formatLayout as l, dashFor as lt, writeLayout as m, tspans as mt, render as n, GROUP_PROPS as nt, processMarkdown as o, lint as ot, setSetting as p, segsW as pt, parse as q, toSource as r, NODE_PROPS as rt, replaceBlockSource as s, SHAPES$2 as st, hash as t, ENUMS as tt, setLabel as u, lineStyle as ut, renderSvg as v, THEME_NAMES as vt, chart as w, registerTheme as wt, layout as x, getTheme as xt, GRID as y, TONES as yt, KNOWN_SETTINGS as z };
11558
+ export { splitTrailingProps as $, canvasMeasure as A, KNOWN_SETTINGS as B, builtins as C, isSafeCss as Ct, sequence$1 as D, registerTheme as Dt, timeline$1 as E, ramp as Et, themes as F, joinPath$1 as G, SETTING_VALUES as H, perPass as I, parse as J, lex as K, recolor as L, frames as M, tables as N, legend as O, themeNames as Ot, charts as P, setTrailingProp as Q, registry as R, layout as S, getTheme as St, chart as T, isToneOrHex as Tt, blockBraces as U, PANELS as V, isYuhwaPath as W, serializeProps as X, parseProps as Y, setLineProp as Z, isMermaid as _, THEMES as _t, findBlocks as a, NUMBERS as at, GRID as b, TONES as bt, editPart as c, SHAPES$2 as ct, setPartTone as d, lineStyle as dt, BOOLS as et, setProp as f, parseInline as ft, fromMermaid as g, RAMPS as gt, writePanelDrag as h, tspans as ht, GUIDE as i, NODE_PROPS as it, footer as j, approxMeasure as k, formatLayout as l, renderHead as lt, writeLayout as m, segsW as mt, render as n, ENUMS as nt, processMarkdown as o, PANEL_PROPS as ot, setSetting as p, renderSegs as pt, onlyColor as q, toSource as r, GROUP_PROPS as rt, replaceBlockSource as s, lint as st, hash as t, EDGE_PROPS as tt, setLabel as u, dashFor as ut, fromJSON as v, THEME_KEYS as vt, git$1 as w, isSafeLink as wt, groupPath as x, createTheme as xt, renderSvg as y, THEME_NAMES as yt, use as z };