schematex 0.2.0 → 0.2.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.
Files changed (106) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +19 -19
  3. package/dist/browser.js +17 -17
  4. package/dist/{chunk-TIGP2OEJ.js → chunk-2VNMKOUO.js} +20 -5
  5. package/dist/chunk-2VNMKOUO.js.map +1 -0
  6. package/dist/{chunk-TPA36ULU.js → chunk-4KYW63IK.js} +3 -3
  7. package/dist/{chunk-TPA36ULU.js.map → chunk-4KYW63IK.js.map} +1 -1
  8. package/dist/{chunk-HKRYKEOV.cjs → chunk-4S2WILLW.cjs} +4 -4
  9. package/dist/{chunk-HKRYKEOV.cjs.map → chunk-4S2WILLW.cjs.map} +1 -1
  10. package/dist/{chunk-YO4GU6JX.js → chunk-5UV5VQ7J.js} +3 -3
  11. package/dist/{chunk-YO4GU6JX.js.map → chunk-5UV5VQ7J.js.map} +1 -1
  12. package/dist/{chunk-SPIW4VWP.js → chunk-5YYAYW67.js} +3 -3
  13. package/dist/{chunk-SPIW4VWP.js.map → chunk-5YYAYW67.js.map} +1 -1
  14. package/dist/{chunk-IQIJ6WW6.js → chunk-6YMQSTFF.js} +3 -3
  15. package/dist/{chunk-IQIJ6WW6.js.map → chunk-6YMQSTFF.js.map} +1 -1
  16. package/dist/{chunk-VP54YPOX.cjs → chunk-7HKXU7J2.cjs} +456 -162
  17. package/dist/chunk-7HKXU7J2.cjs.map +1 -0
  18. package/dist/{chunk-IY52OWPG.cjs → chunk-7IRT3LOY.cjs} +4 -4
  19. package/dist/{chunk-IY52OWPG.cjs.map → chunk-7IRT3LOY.cjs.map} +1 -1
  20. package/dist/{chunk-RQX53J6M.js → chunk-CJ2A3UEQ.js} +3 -3
  21. package/dist/{chunk-RQX53J6M.js.map → chunk-CJ2A3UEQ.js.map} +1 -1
  22. package/dist/{chunk-HAIBAF6J.cjs → chunk-CXHPP5BL.cjs} +4 -4
  23. package/dist/{chunk-HAIBAF6J.cjs.map → chunk-CXHPP5BL.cjs.map} +1 -1
  24. package/dist/{chunk-S6VPECM3.cjs → chunk-D7EHZFK4.cjs} +20 -5
  25. package/dist/chunk-D7EHZFK4.cjs.map +1 -0
  26. package/dist/{chunk-LKHWBDWZ.cjs → chunk-ISACNVFE.cjs} +4 -4
  27. package/dist/{chunk-LKHWBDWZ.cjs.map → chunk-ISACNVFE.cjs.map} +1 -1
  28. package/dist/{chunk-MXJ6FHSY.js → chunk-JDTB7IKL.js} +3 -3
  29. package/dist/{chunk-MXJ6FHSY.js.map → chunk-JDTB7IKL.js.map} +1 -1
  30. package/dist/{chunk-7WXAAVR3.js → chunk-LCR3KOJV.js} +3 -3
  31. package/dist/{chunk-7WXAAVR3.js.map → chunk-LCR3KOJV.js.map} +1 -1
  32. package/dist/{chunk-IMHR3S5H.cjs → chunk-LKOBOVNL.cjs} +5 -5
  33. package/dist/{chunk-IMHR3S5H.cjs.map → chunk-LKOBOVNL.cjs.map} +1 -1
  34. package/dist/{chunk-MRGS54WN.js → chunk-M5B2UUNW.js} +3 -3
  35. package/dist/{chunk-MRGS54WN.js.map → chunk-M5B2UUNW.js.map} +1 -1
  36. package/dist/{chunk-2OIW3MAE.js → chunk-PGALHQFF.js} +3 -3
  37. package/dist/{chunk-2OIW3MAE.js.map → chunk-PGALHQFF.js.map} +1 -1
  38. package/dist/{chunk-ULERCTGS.cjs → chunk-QR7VTCI4.cjs} +27 -27
  39. package/dist/chunk-QR7VTCI4.cjs.map +1 -0
  40. package/dist/{chunk-3M7QWADF.cjs → chunk-QSQX77S2.cjs} +4 -4
  41. package/dist/{chunk-3M7QWADF.cjs.map → chunk-QSQX77S2.cjs.map} +1 -1
  42. package/dist/{chunk-M6AMNXQ7.js → chunk-UUPYTUGR.js} +438 -144
  43. package/dist/chunk-UUPYTUGR.js.map +1 -0
  44. package/dist/{chunk-4HPT4BOI.cjs → chunk-WYFXOXVK.cjs} +4 -4
  45. package/dist/{chunk-4HPT4BOI.cjs.map → chunk-WYFXOXVK.cjs.map} +1 -1
  46. package/dist/{chunk-A74ZCP5I.js → chunk-X2BQKXMA.js} +27 -27
  47. package/dist/chunk-X2BQKXMA.js.map +1 -0
  48. package/dist/{chunk-YKO7DY2F.cjs → chunk-X7RPFTTR.cjs} +13 -13
  49. package/dist/{chunk-YKO7DY2F.cjs.map → chunk-X7RPFTTR.cjs.map} +1 -1
  50. package/dist/{chunk-ZGKEFVJQ.cjs → chunk-XHZ7GXP2.cjs} +12 -12
  51. package/dist/{chunk-ZGKEFVJQ.cjs.map → chunk-XHZ7GXP2.cjs.map} +1 -1
  52. package/dist/{chunk-AMP2FFES.cjs → chunk-XVCAOGFL.cjs} +10 -10
  53. package/dist/{chunk-AMP2FFES.cjs.map → chunk-XVCAOGFL.cjs.map} +1 -1
  54. package/dist/{chunk-HLYA4QBB.js → chunk-YN467EEQ.js} +3 -3
  55. package/dist/{chunk-HLYA4QBB.js.map → chunk-YN467EEQ.js.map} +1 -1
  56. package/dist/{chunk-4TS5NB7L.js → chunk-YQANC7HQ.js} +3 -3
  57. package/dist/{chunk-4TS5NB7L.js.map → chunk-YQANC7HQ.js.map} +1 -1
  58. package/dist/{chunk-DTMCQXXC.cjs → chunk-YXIIWLLB.cjs} +12 -12
  59. package/dist/{chunk-DTMCQXXC.cjs.map → chunk-YXIIWLLB.cjs.map} +1 -1
  60. package/dist/{chunk-JZGFSRVT.js → chunk-Z3WOHHG3.js} +3 -3
  61. package/dist/{chunk-JZGFSRVT.js.map → chunk-Z3WOHHG3.js.map} +1 -1
  62. package/dist/{chunk-CEV3GZA3.cjs → chunk-Z63XPA2V.cjs} +11 -11
  63. package/dist/{chunk-CEV3GZA3.cjs.map → chunk-Z63XPA2V.cjs.map} +1 -1
  64. package/dist/{chunk-PIQG2Z5N.cjs → chunk-ZNOD4VZT.cjs} +4 -4
  65. package/dist/{chunk-PIQG2Z5N.cjs.map → chunk-ZNOD4VZT.cjs.map} +1 -1
  66. package/dist/{chunk-L6IHSTPP.js → chunk-ZNZIL244.js} +3 -3
  67. package/dist/{chunk-L6IHSTPP.js.map → chunk-ZNZIL244.js.map} +1 -1
  68. package/dist/diagrams/circuit/index.cjs +8 -8
  69. package/dist/diagrams/circuit/index.js +2 -2
  70. package/dist/diagrams/ecomap/index.cjs +7 -7
  71. package/dist/diagrams/ecomap/index.js +2 -2
  72. package/dist/diagrams/entity/index.cjs +6 -6
  73. package/dist/diagrams/entity/index.js +2 -2
  74. package/dist/diagrams/fishbone/index.cjs +8 -8
  75. package/dist/diagrams/fishbone/index.js +2 -2
  76. package/dist/diagrams/flowchart/index.cjs +8 -8
  77. package/dist/diagrams/flowchart/index.js +2 -2
  78. package/dist/diagrams/genogram/index.cjs +9 -9
  79. package/dist/diagrams/genogram/index.js +2 -2
  80. package/dist/diagrams/ladder/index.cjs +6 -6
  81. package/dist/diagrams/ladder/index.js +2 -2
  82. package/dist/diagrams/logic/index.cjs +6 -6
  83. package/dist/diagrams/logic/index.js +2 -2
  84. package/dist/diagrams/orgchart/index.cjs +7 -7
  85. package/dist/diagrams/orgchart/index.js +2 -2
  86. package/dist/diagrams/pedigree/index.cjs +7 -7
  87. package/dist/diagrams/pedigree/index.js +2 -2
  88. package/dist/diagrams/phylo/index.cjs +7 -7
  89. package/dist/diagrams/phylo/index.js +2 -2
  90. package/dist/diagrams/sld/index.cjs +6 -6
  91. package/dist/diagrams/sld/index.js +2 -2
  92. package/dist/diagrams/sociogram/index.cjs +6 -6
  93. package/dist/diagrams/sociogram/index.js +2 -2
  94. package/dist/diagrams/venn/index.cjs +9 -9
  95. package/dist/diagrams/venn/index.js +2 -2
  96. package/dist/index.cjs +45 -45
  97. package/dist/index.js +16 -16
  98. package/dist/react.cjs +17 -17
  99. package/dist/react.js +16 -16
  100. package/package.json +4 -3
  101. package/dist/chunk-A74ZCP5I.js.map +0 -1
  102. package/dist/chunk-M6AMNXQ7.js.map +0 -1
  103. package/dist/chunk-S6VPECM3.cjs.map +0 -1
  104. package/dist/chunk-TIGP2OEJ.js.map +0 -1
  105. package/dist/chunk-ULERCTGS.cjs.map +0 -1
  106. package/dist/chunk-VP54YPOX.cjs.map +0 -1
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunkIY52OWPG_cjs = require('./chunk-IY52OWPG.cjs');
4
- var chunkHKRYKEOV_cjs = require('./chunk-HKRYKEOV.cjs');
3
+ var chunk7IRT3LOY_cjs = require('./chunk-7IRT3LOY.cjs');
4
+ var chunk4S2WILLW_cjs = require('./chunk-4S2WILLW.cjs');
5
5
  var chunkLXNFVHDT_cjs = require('./chunk-LXNFVHDT.cjs');
6
- var chunkLKHWBDWZ_cjs = require('./chunk-LKHWBDWZ.cjs');
7
- var chunkULERCTGS_cjs = require('./chunk-ULERCTGS.cjs');
8
- var chunkPIQG2Z5N_cjs = require('./chunk-PIQG2Z5N.cjs');
9
- var chunkIMHR3S5H_cjs = require('./chunk-IMHR3S5H.cjs');
10
- var chunk3M7QWADF_cjs = require('./chunk-3M7QWADF.cjs');
11
- var chunkHAIBAF6J_cjs = require('./chunk-HAIBAF6J.cjs');
12
- var chunkCEV3GZA3_cjs = require('./chunk-CEV3GZA3.cjs');
13
- var chunkZGKEFVJQ_cjs = require('./chunk-ZGKEFVJQ.cjs');
14
- var chunkAMP2FFES_cjs = require('./chunk-AMP2FFES.cjs');
15
- var chunkYKO7DY2F_cjs = require('./chunk-YKO7DY2F.cjs');
16
- var chunkDTMCQXXC_cjs = require('./chunk-DTMCQXXC.cjs');
6
+ var chunkISACNVFE_cjs = require('./chunk-ISACNVFE.cjs');
7
+ var chunkQR7VTCI4_cjs = require('./chunk-QR7VTCI4.cjs');
8
+ var chunkZNOD4VZT_cjs = require('./chunk-ZNOD4VZT.cjs');
9
+ var chunkLKOBOVNL_cjs = require('./chunk-LKOBOVNL.cjs');
10
+ var chunkQSQX77S2_cjs = require('./chunk-QSQX77S2.cjs');
11
+ var chunkCXHPP5BL_cjs = require('./chunk-CXHPP5BL.cjs');
12
+ var chunkZ63XPA2V_cjs = require('./chunk-Z63XPA2V.cjs');
13
+ var chunkXHZ7GXP2_cjs = require('./chunk-XHZ7GXP2.cjs');
14
+ var chunkXVCAOGFL_cjs = require('./chunk-XVCAOGFL.cjs');
15
+ var chunkX7RPFTTR_cjs = require('./chunk-X7RPFTTR.cjs');
16
+ var chunkYXIIWLLB_cjs = require('./chunk-YXIIWLLB.cjs');
17
17
  var chunkZO77FHBF_cjs = require('./chunk-ZO77FHBF.cjs');
18
- var chunk4HPT4BOI_cjs = require('./chunk-4HPT4BOI.cjs');
19
- var chunkS6VPECM3_cjs = require('./chunk-S6VPECM3.cjs');
18
+ var chunkWYFXOXVK_cjs = require('./chunk-WYFXOXVK.cjs');
19
+ var chunkD7EHZFK4_cjs = require('./chunk-D7EHZFK4.cjs');
20
20
  var chunkHDKDQAEQ_cjs = require('./chunk-HDKDQAEQ.cjs');
21
21
 
22
22
  // src/diagrams/decisiontree/parser.ts
@@ -1074,7 +1074,7 @@ function wrapText(text2, maxChars) {
1074
1074
  return lines.slice(0, 2);
1075
1075
  }
1076
1076
  function renderDecisionTree(ast, config) {
1077
- const t = chunkS6VPECM3_cjs.resolveBaseTheme(config?.theme ?? "default");
1077
+ const t = chunkD7EHZFK4_cjs.resolveBaseTheme(config?.theme ?? "default");
1078
1078
  const layout = layoutDecisionTree(ast);
1079
1079
  const titleOffset = ast.title ? 36 : 10;
1080
1080
  const width = Math.ceil(layout.width);
@@ -2097,7 +2097,7 @@ var ERA_ROW_GAP = 2;
2097
2097
  function renderTimeline(src, config) {
2098
2098
  const ast = parseTimeline(src);
2099
2099
  const layout = layoutTimeline(ast);
2100
- const theme = chunkS6VPECM3_cjs.resolveTimelineTheme(config?.theme ?? "default");
2100
+ const theme = chunkD7EHZFK4_cjs.resolveTimelineTheme(config?.theme ?? "default");
2101
2101
  const styleBlock = styleForTheme(theme, config?.fontFamily);
2102
2102
  const children = [
2103
2103
  chunkHDKDQAEQ_cjs.title(ast.title ? `Timeline \u2014 ${ast.title}` : "Timeline"),
@@ -2142,7 +2142,7 @@ function renderTimeline(src, config) {
2142
2142
  function styleForTheme(theme, fontFamily) {
2143
2143
  const font = fontFamily ?? "system-ui, -apple-system, sans-serif";
2144
2144
  return `
2145
- .st-timeline { ${chunkS6VPECM3_cjs.cssCustomProperties(theme)}
2145
+ .st-timeline { ${chunkD7EHZFK4_cjs.cssCustomProperties(theme)}
2146
2146
  --st-axis: ${theme.axis};
2147
2147
  --st-axis-label: ${theme.axisLabel};
2148
2148
  --st-era-label: ${theme.eraLabel};
@@ -2620,8 +2620,181 @@ var timeline = {
2620
2620
  }
2621
2621
  };
2622
2622
 
2623
+ // src/diagrams/mindmap/inline.ts
2624
+ var RE_TASK = /^\[( |x|X)\]\s+(.*)$/;
2625
+ function tokenizeInline(raw) {
2626
+ const tokens = [];
2627
+ let text2 = raw;
2628
+ const task = text2.match(RE_TASK);
2629
+ if (task) {
2630
+ tokens.push({ kind: "checkbox", checked: task[1].toLowerCase() === "x" });
2631
+ text2 = task[2];
2632
+ }
2633
+ parseInto(text2, tokens, { bold: false, italic: false });
2634
+ return tokens;
2635
+ }
2636
+ function parseInto(src, out, style) {
2637
+ let i = 0;
2638
+ let plain = "";
2639
+ const flushPlain = () => {
2640
+ if (plain.length === 0) return;
2641
+ out.push({ kind: "text", value: plain, bold: style.bold || void 0, italic: style.italic || void 0 });
2642
+ plain = "";
2643
+ };
2644
+ while (i < src.length) {
2645
+ const ch = src[i];
2646
+ if (ch === "`") {
2647
+ const end = src.indexOf("`", i + 1);
2648
+ if (end > i) {
2649
+ flushPlain();
2650
+ out.push({ kind: "code", value: src.slice(i + 1, end) });
2651
+ i = end + 1;
2652
+ continue;
2653
+ }
2654
+ }
2655
+ if (ch === "[") {
2656
+ const closeBracket = findUnescaped(src, "]", i + 1);
2657
+ if (closeBracket > 0 && src[closeBracket + 1] === "(") {
2658
+ const closeParen = findUnescaped(src, ")", closeBracket + 2);
2659
+ if (closeParen > 0) {
2660
+ flushPlain();
2661
+ const inner = [];
2662
+ parseInto(src.slice(i + 1, closeBracket), inner, style);
2663
+ out.push({ kind: "link", href: src.slice(closeBracket + 2, closeParen), value: inner });
2664
+ i = closeParen + 1;
2665
+ continue;
2666
+ }
2667
+ }
2668
+ }
2669
+ if (ch === "*" && src[i + 1] === "*") {
2670
+ const end = src.indexOf("**", i + 2);
2671
+ if (end > i) {
2672
+ flushPlain();
2673
+ parseInto(src.slice(i + 2, end), out, { ...style, bold: true });
2674
+ i = end + 2;
2675
+ continue;
2676
+ }
2677
+ }
2678
+ if (ch === "*") {
2679
+ const end = src.indexOf("*", i + 1);
2680
+ if (end > i && src[end + 1] !== "*") {
2681
+ flushPlain();
2682
+ parseInto(src.slice(i + 1, end), out, { ...style, italic: true });
2683
+ i = end + 1;
2684
+ continue;
2685
+ }
2686
+ }
2687
+ plain += ch;
2688
+ i++;
2689
+ }
2690
+ flushPlain();
2691
+ }
2692
+ function findUnescaped(s, ch, from) {
2693
+ for (let i = from; i < s.length; i++) {
2694
+ if (s[i] === "\\") {
2695
+ i++;
2696
+ continue;
2697
+ }
2698
+ if (s[i] === ch) return i;
2699
+ }
2700
+ return -1;
2701
+ }
2702
+ var EM_REGULAR = 0.58;
2703
+ var EM_BOLD = 0.62;
2704
+ var EM_CODE = 0.62;
2705
+ var CHECKBOX_EM = 1.05;
2706
+ function measureTokens(tokens, fontSize) {
2707
+ let w = 0;
2708
+ for (const t of tokens) {
2709
+ w += tokenWidth(t, fontSize);
2710
+ }
2711
+ return w;
2712
+ }
2713
+ function tokenWidth(t, fs) {
2714
+ switch (t.kind) {
2715
+ case "text": {
2716
+ const em = t.bold ? EM_BOLD : EM_REGULAR;
2717
+ return t.value.length * fs * em;
2718
+ }
2719
+ case "code":
2720
+ return t.value.length * fs * EM_CODE + 4;
2721
+ case "link":
2722
+ return measureTokens(t.value, fs);
2723
+ case "checkbox":
2724
+ return fs * CHECKBOX_EM;
2725
+ }
2726
+ }
2727
+ function tokensToPlainText(tokens) {
2728
+ let out = "";
2729
+ for (const t of tokens) {
2730
+ switch (t.kind) {
2731
+ case "text":
2732
+ case "code":
2733
+ out += t.value;
2734
+ break;
2735
+ case "link":
2736
+ out += tokensToPlainText(t.value);
2737
+ break;
2738
+ case "checkbox":
2739
+ out += t.checked ? "[x] " : "[ ] ";
2740
+ break;
2741
+ }
2742
+ }
2743
+ return out;
2744
+ }
2745
+ function wrapTokens(tokens, maxWidth, fontSize) {
2746
+ const lines = [];
2747
+ let line2 = [];
2748
+ let lineW = 0;
2749
+ const pushLine = () => {
2750
+ lines.push({ tokens: line2, width: lineW });
2751
+ line2 = [];
2752
+ lineW = 0;
2753
+ };
2754
+ const pushAtomic = (t, w) => {
2755
+ if (lineW > 0 && lineW + w > maxWidth) pushLine();
2756
+ line2.push(t);
2757
+ lineW += w;
2758
+ };
2759
+ for (const t of tokens) {
2760
+ if (t.kind === "text") {
2761
+ const words = splitWordsWithTrailingSpace(t.value);
2762
+ for (const w of words) {
2763
+ const wt = { kind: "text", value: w, bold: t.bold, italic: t.italic };
2764
+ const ww = tokenWidth(wt, fontSize);
2765
+ if (lineW > 0 && lineW + ww > maxWidth) {
2766
+ pushLine();
2767
+ const trimmed = w.replace(/^ +/, "");
2768
+ if (trimmed.length === 0) continue;
2769
+ const tt = { kind: "text", value: trimmed, bold: t.bold, italic: t.italic };
2770
+ line2.push(tt);
2771
+ lineW = tokenWidth(tt, fontSize);
2772
+ } else {
2773
+ line2.push(wt);
2774
+ lineW += ww;
2775
+ }
2776
+ }
2777
+ } else {
2778
+ pushAtomic(t, tokenWidth(t, fontSize));
2779
+ }
2780
+ }
2781
+ pushLine();
2782
+ return lines;
2783
+ }
2784
+ function splitWordsWithTrailingSpace(s) {
2785
+ if (s.length === 0) return [];
2786
+ const out = [];
2787
+ const re = /(\S+\s*)|(\s+)/g;
2788
+ let m;
2789
+ while ((m = re.exec(s)) !== null) {
2790
+ out.push(m[0]);
2791
+ }
2792
+ return out.length > 0 ? out : [s];
2793
+ }
2794
+
2623
2795
  // src/diagrams/mindmap/parser.ts
2624
2796
  var VALID_STYLES = ["map", "logic-right"];
2797
+ var DEFAULT_MAX_LABEL_WIDTH = 240;
2625
2798
  function parseDirective(line2, out) {
2626
2799
  const body = line2.replace(/^%%\s*/, "").trim();
2627
2800
  const idx = body.indexOf(":");
@@ -2632,12 +2805,18 @@ function parseDirective(line2, out) {
2632
2805
  out.style = val;
2633
2806
  } else if (key === "theme") {
2634
2807
  out.themeOverride = val;
2808
+ } else if (key === "maxlabelwidth") {
2809
+ const n = Number(val);
2810
+ if (Number.isFinite(n) && n >= 80 && n <= 1e3) out.maxLabelWidth = n;
2635
2811
  }
2636
2812
  }
2813
+ function makeNode(id, label, depth) {
2814
+ return { id, label, tokens: tokenizeInline(label), depth, children: [] };
2815
+ }
2637
2816
  function parseMindmap(text2) {
2638
2817
  const lines = text2.split(/\r?\n/);
2639
2818
  if (lines[0]?.trim().toLowerCase() === "mindmap") lines.shift();
2640
- const directives = { style: "map" };
2819
+ const directives = { style: "map", maxLabelWidth: DEFAULT_MAX_LABEL_WIDTH };
2641
2820
  let root = null;
2642
2821
  let idCounter2 = 0;
2643
2822
  const nextId2 = () => `n${idCounter2++}`;
@@ -2663,7 +2842,7 @@ function parseMindmap(text2) {
2663
2842
  if (heading) {
2664
2843
  const depth = heading[1].length - 1;
2665
2844
  const label = heading[2].trim();
2666
- const node = { id: nextId2(), label, depth, children: [] };
2845
+ const node = makeNode(nextId2(), label, depth);
2667
2846
  if (depth === 0) {
2668
2847
  if (root) throw new Error("Mindmap: multiple `#` center nodes not allowed");
2669
2848
  root = node;
@@ -2680,7 +2859,7 @@ function parseMindmap(text2) {
2680
2859
  const indent = bullet[1].length;
2681
2860
  const depth = lastHeadingDepth + 1 + Math.floor(indent / 2);
2682
2861
  const label = bullet[2].trim();
2683
- const node = { id: nextId2(), label, depth, children: [] };
2862
+ const node = makeNode(nextId2(), label, depth);
2684
2863
  attach(node, depth);
2685
2864
  continue;
2686
2865
  }
@@ -2689,7 +2868,8 @@ function parseMindmap(text2) {
2689
2868
  const ast = {
2690
2869
  type: "mindmap",
2691
2870
  style: directives.style,
2692
- root
2871
+ root,
2872
+ maxLabelWidth: directives.maxLabelWidth
2693
2873
  };
2694
2874
  if (directives.themeOverride) ast.themeOverride = directives.themeOverride;
2695
2875
  return ast;
@@ -2697,10 +2877,10 @@ function parseMindmap(text2) {
2697
2877
 
2698
2878
  // src/diagrams/mindmap/layout.ts
2699
2879
  var PADDING = 40;
2700
- var SIBLING_GAP = 20;
2880
+ var SIBLING_GAP = 18;
2701
2881
  var MAIN_GAP = 44;
2702
- var ROOT_CAPSULE_PAD_X = 10;
2703
- var ROOT_CAPSULE_PAD_Y = 10;
2882
+ var UNDERLINE_GAP = 4;
2883
+ var LINE_GAP = 4;
2704
2884
  function bezierGapFor(childDepth) {
2705
2885
  if (childDepth <= 1) return 90;
2706
2886
  if (childDepth === 2) return 60;
@@ -2714,47 +2894,68 @@ function fontSizeOf(depth) {
2714
2894
  if (depth === 1) return FONT_MAIN;
2715
2895
  return FONT_SUB;
2716
2896
  }
2717
- function estimateLabelWidth2(label, depth) {
2718
- return Math.max(32, label.length * fontSizeOf(depth) * 0.58);
2897
+ function lineHeightOf(fs) {
2898
+ return fs + LINE_GAP;
2899
+ }
2900
+ function widthBudget(depth, maxLabelWidth) {
2901
+ if (depth === 0) return maxLabelWidth * 1.5;
2902
+ return maxLabelWidth;
2719
2903
  }
2720
- function rowHeightOf(depth) {
2721
- return fontSizeOf(depth) + 14;
2904
+ function measureLabel(node, maxWidth) {
2905
+ const fs = fontSizeOf(node.depth);
2906
+ const raw = measureTokens(node.tokens, fs);
2907
+ let lines;
2908
+ if (raw <= maxWidth) {
2909
+ lines = [{ tokens: node.tokens.slice(), width: raw }];
2910
+ } else {
2911
+ lines = wrapTokens(node.tokens, maxWidth, fs);
2912
+ }
2913
+ let maxW = 0;
2914
+ for (const ln of lines) if (ln.width > maxW) maxW = ln.width;
2915
+ const lh = lineHeightOf(fs);
2916
+ const height = lines.length * lh + UNDERLINE_GAP;
2917
+ return { lines, width: Math.max(32, maxW), height };
2722
2918
  }
2723
- function computeColumns(subtreeRoots, firstColStartX) {
2919
+ function computeMaxLW(subtreeRoots, maxLabelWidth) {
2724
2920
  const maxLW = [];
2725
2921
  const walk = (n) => {
2726
- const lw = estimateLabelWidth2(n.label, n.depth);
2727
- if (maxLW[n.depth] === void 0 || lw > maxLW[n.depth]) maxLW[n.depth] = lw;
2922
+ const m = measureLabel(n, widthBudget(n.depth, maxLabelWidth));
2923
+ if (maxLW[n.depth] === void 0 || m.width > maxLW[n.depth]) maxLW[n.depth] = m.width;
2728
2924
  for (const c of n.children) walk(c);
2729
2925
  };
2730
2926
  for (const r of subtreeRoots) walk(r);
2927
+ return maxLW;
2928
+ }
2929
+ function buildColumns(maxLW, firstColStartX, rootDepth) {
2731
2930
  const center = [];
2732
- if (subtreeRoots.length === 0) return { center };
2733
- const rootDepth = subtreeRoots[0].depth;
2931
+ if (maxLW[rootDepth] === void 0) return { center };
2734
2932
  let slotLeft = firstColStartX;
2735
2933
  center[rootDepth] = slotLeft + maxLW[rootDepth] / 2;
2736
2934
  for (let d = rootDepth + 1; d < maxLW.length; d++) {
2737
2935
  slotLeft = slotLeft + maxLW[d - 1] + bezierGapFor(d);
2738
- center[d] = slotLeft + maxLW[d] / 2;
2936
+ center[d] = slotLeft + (maxLW[d] ?? 0) / 2;
2739
2937
  }
2740
2938
  return { center };
2741
2939
  }
2742
- function tidyRight(node, yTop, branchIdx, columns, out) {
2743
- const rowH = rowHeightOf(node.depth);
2744
- const lw = estimateLabelWidth2(node.label, node.depth);
2940
+ function tidyRight(node, yTop, branchIdx, columns, maxLabelWidth, maxLW, out) {
2941
+ const m = measureLabel(node, widthBudget(node.depth, maxLabelWidth));
2745
2942
  const x = columns.center[node.depth];
2943
+ const fs = fontSizeOf(node.depth);
2944
+ const labelWidth = Math.max(m.width, maxLW[node.depth] ?? m.width);
2746
2945
  if (node.children.length === 0) {
2747
2946
  const ln2 = {
2748
2947
  node,
2749
2948
  x,
2750
- y: yTop + rowH / 2,
2949
+ y: yTop + m.height / 2,
2751
2950
  side: "right",
2752
2951
  branchIndex: branchIdx,
2753
- labelWidth: lw,
2754
- labelHeight: rowH
2952
+ labelWidth,
2953
+ labelHeight: m.height,
2954
+ fontSize: fs,
2955
+ lines: m.lines
2755
2956
  };
2756
2957
  out.push(ln2);
2757
- return { layoutNode: ln2, height: rowH };
2958
+ return { layoutNode: ln2, height: m.height };
2758
2959
  }
2759
2960
  let cursor = yTop;
2760
2961
  const childLayouts = [];
@@ -2765,12 +2966,14 @@ function tidyRight(node, yTop, branchIdx, columns, out) {
2765
2966
  cursor,
2766
2967
  branchIdx,
2767
2968
  columns,
2969
+ maxLabelWidth,
2970
+ maxLW,
2768
2971
  out
2769
2972
  );
2770
2973
  childLayouts.push(cln);
2771
2974
  cursor += height;
2772
2975
  }
2773
- const totalH = Math.max(rowH, cursor - yTop);
2976
+ const totalH = Math.max(m.height, cursor - yTop);
2774
2977
  const firstY = childLayouts[0].y;
2775
2978
  const lastY = childLayouts[childLayouts.length - 1].y;
2776
2979
  const parentY = (firstY + lastY) / 2;
@@ -2780,8 +2983,10 @@ function tidyRight(node, yTop, branchIdx, columns, out) {
2780
2983
  y: parentY,
2781
2984
  side: "right",
2782
2985
  branchIndex: branchIdx,
2783
- labelWidth: lw,
2784
- labelHeight: rowH
2986
+ labelWidth,
2987
+ labelHeight: m.height,
2988
+ fontSize: fs,
2989
+ lines: m.lines
2785
2990
  };
2786
2991
  out.push(ln);
2787
2992
  return { layoutNode: ln, height: totalH };
@@ -2796,7 +3001,15 @@ function bezierH(x1, y1, x2, y2) {
2796
3001
  return `M ${x1.toFixed(1)} ${y1.toFixed(1)} C ${(x1 + k).toFixed(1)} ${y1.toFixed(1)}, ${(x2 - k).toFixed(1)} ${y2.toFixed(1)}, ${x2.toFixed(1)} ${y2.toFixed(1)}`;
2797
3002
  }
2798
3003
  function edgeWidthFor(depth) {
2799
- return depth <= 1 ? 2.2 : 1.4;
3004
+ if (depth <= 1) return 2.2;
3005
+ if (depth === 2) return 1.6;
3006
+ return 1.2;
3007
+ }
3008
+ function underlineWidthFor(depth) {
3009
+ if (depth === 0) return 2.4;
3010
+ if (depth === 1) return 2.2;
3011
+ if (depth === 2) return 1.6;
3012
+ return 1.2;
2800
3013
  }
2801
3014
  function normalize(nodes) {
2802
3015
  let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
@@ -2807,8 +3020,8 @@ function normalize(nodes) {
2807
3020
  const rightX = n.x + lw / 2;
2808
3021
  minX = Math.min(minX, leftX);
2809
3022
  maxX = Math.max(maxX, rightX);
2810
- minY = Math.min(minY, n.y - lh);
2811
- maxY = Math.max(maxY, n.y + lh);
3023
+ minY = Math.min(minY, n.y - lh / 2);
3024
+ maxY = Math.max(maxY, n.y + lh / 2);
2812
3025
  }
2813
3026
  const dx = PADDING - minX;
2814
3027
  const dy = PADDING - minY;
@@ -2818,10 +3031,14 @@ function normalize(nodes) {
2818
3031
  }
2819
3032
  return { width: maxX - minX + PADDING * 2, height: maxY - minY + PADDING * 2 };
2820
3033
  }
3034
+ function underlineY(n) {
3035
+ return n.y + n.labelHeight / 2 - UNDERLINE_GAP / 2;
3036
+ }
2821
3037
  function buildEdges(root, byId) {
2822
3038
  const edges = [];
2823
3039
  const walk = (parent) => {
2824
3040
  const pln = byId.get(parent.id);
3041
+ const pUY = underlineY(pln);
2825
3042
  for (const c of parent.children) {
2826
3043
  const cln = byId.get(c.id);
2827
3044
  let fromX;
@@ -2835,7 +3052,7 @@ function buildEdges(root, byId) {
2835
3052
  edges.push({
2836
3053
  from: parent.id,
2837
3054
  to: c.id,
2838
- path: bezierH(fromX, pln.y, toX, cln.y),
3055
+ path: bezierH(fromX, pUY, toX, underlineY(cln)),
2839
3056
  color: "",
2840
3057
  width: edgeWidthFor(c.depth)
2841
3058
  });
@@ -2852,24 +3069,23 @@ function layoutMap(ast) {
2852
3069
  const rightMains = mains.slice(0, rightCount);
2853
3070
  const leftMains = mains.slice(rightCount);
2854
3071
  const nodes = [];
2855
- const rootLabelW = estimateLabelWidth2(root.label, 0);
2856
- const rootCapsuleW = rootLabelW + ROOT_CAPSULE_PAD_X * 2;
2857
- const rootCapsuleH = rowHeightOf(0) + ROOT_CAPSULE_PAD_Y;
2858
- const firstColLeft = rootCapsuleW / 2 + bezierGapFor(1);
2859
- const rightCols = computeColumns(rightMains, firstColLeft);
3072
+ const mw = ast.maxLabelWidth;
3073
+ const rootM = measureLabel(root, widthBudget(0, mw));
3074
+ const firstColLeft = rootM.width / 2 + bezierGapFor(1);
3075
+ const maxLW = computeMaxLW([...rightMains, ...leftMains], mw);
3076
+ const cols = buildColumns(maxLW, firstColLeft, 1);
2860
3077
  let rightCursor = 0;
2861
3078
  for (let i = 0; i < rightMains.length; i++) {
2862
3079
  if (i > 0) rightCursor += MAIN_GAP;
2863
- const { height: height2 } = tidyRight(rightMains[i], rightCursor, i, rightCols, nodes);
3080
+ const { height: height2 } = tidyRight(rightMains[i], rightCursor, i, cols, mw, maxLW, nodes);
2864
3081
  rightCursor += height2;
2865
3082
  }
2866
3083
  const rightHeight = rightCursor;
2867
- const leftCols = computeColumns(leftMains, firstColLeft);
2868
3084
  const leftStart = nodes.length;
2869
3085
  let leftCursor = 0;
2870
3086
  for (let i = 0; i < leftMains.length; i++) {
2871
3087
  if (i > 0) leftCursor += MAIN_GAP;
2872
- const { height: height2 } = tidyRight(leftMains[i], leftCursor, rightCount + i, leftCols, nodes);
3088
+ const { height: height2 } = tidyRight(leftMains[i], leftCursor, rightCount + i, cols, mw, maxLW, nodes);
2873
3089
  leftCursor += height2;
2874
3090
  }
2875
3091
  const leftHeight = leftCursor;
@@ -2884,8 +3100,10 @@ function layoutMap(ast) {
2884
3100
  y: rootY,
2885
3101
  side: "center",
2886
3102
  branchIndex: -1,
2887
- labelWidth: rootCapsuleW,
2888
- labelHeight: rootCapsuleH
3103
+ labelWidth: rootM.width,
3104
+ labelHeight: rootM.height,
3105
+ fontSize: fontSizeOf(0),
3106
+ lines: rootM.lines
2889
3107
  };
2890
3108
  nodes.push(rootNode);
2891
3109
  const { width, height } = normalize(nodes);
@@ -2896,15 +3114,15 @@ function layoutMap(ast) {
2896
3114
  function layoutLogicRight(ast) {
2897
3115
  const root = ast.root;
2898
3116
  const nodes = [];
2899
- const rootLabelW = estimateLabelWidth2(root.label, 0);
2900
- const rootCapsuleW = rootLabelW + ROOT_CAPSULE_PAD_X * 2;
2901
- const rootCapsuleH = rowHeightOf(0) + ROOT_CAPSULE_PAD_Y;
2902
- const firstColLeft = rootCapsuleW / 2 + bezierGapFor(1);
2903
- const cols = computeColumns(root.children, firstColLeft);
3117
+ const mw = ast.maxLabelWidth;
3118
+ const rootM = measureLabel(root, widthBudget(0, mw));
3119
+ const firstColLeft = rootM.width / 2 + bezierGapFor(1);
3120
+ const maxLW = computeMaxLW(root.children, mw);
3121
+ const cols = buildColumns(maxLW, firstColLeft, 1);
2904
3122
  let cursor = 0;
2905
3123
  for (let i = 0; i < root.children.length; i++) {
2906
3124
  if (i > 0) cursor += MAIN_GAP;
2907
- const { height: height2 } = tidyRight(root.children[i], cursor, i, cols, nodes);
3125
+ const { height: height2 } = tidyRight(root.children[i], cursor, i, cols, mw, maxLW, nodes);
2908
3126
  cursor += height2;
2909
3127
  }
2910
3128
  const totalHeight = cursor;
@@ -2914,8 +3132,10 @@ function layoutLogicRight(ast) {
2914
3132
  y: totalHeight / 2,
2915
3133
  side: "center",
2916
3134
  branchIndex: -1,
2917
- labelWidth: rootCapsuleW,
2918
- labelHeight: rootCapsuleH
3135
+ labelWidth: rootM.width,
3136
+ labelHeight: rootM.height,
3137
+ fontSize: fontSizeOf(0),
3138
+ lines: rootM.lines
2919
3139
  };
2920
3140
  nodes.push(rootNode);
2921
3141
  const { width, height } = normalize(nodes);
@@ -2930,95 +3150,174 @@ function layoutMindmap(ast) {
2930
3150
  }
2931
3151
 
2932
3152
  // src/diagrams/mindmap/renderer.ts
2933
- var UNDERLINE_MAIN = 2.2;
2934
- var UNDERLINE_MAIN_MONO = 1.5;
3153
+ function strokeScale(theme) {
3154
+ return theme.branchPalette.length <= 1 ? 0.7 : 1;
3155
+ }
2935
3156
  function paletteColor(theme, branchIndex) {
2936
3157
  if (branchIndex < 0) return theme.centralFill;
2937
3158
  return theme.branchPalette[branchIndex % theme.branchPalette.length];
2938
3159
  }
2939
- function underlineMain(theme) {
2940
- return theme.branchPalette.length <= 1 ? UNDERLINE_MAIN_MONO : UNDERLINE_MAIN;
3160
+ function renderLine(line2, cx, cy, fontSize, fontFamily, fontWeight, theme) {
3161
+ const leftX = cx - line2.width / 2;
3162
+ const baselineY = cy + fontSize * 0.35;
3163
+ const tspans = [];
3164
+ const decorations = [];
3165
+ let cursor = leftX;
3166
+ const emit = (tok, inheritedHref) => {
3167
+ switch (tok.kind) {
3168
+ case "text": {
3169
+ const w = measureToken(tok, fontSize);
3170
+ tspans.push(
3171
+ tspan({
3172
+ x: cursor,
3173
+ y: baselineY,
3174
+ fill: inheritedHref ? theme.linkColor : theme.text,
3175
+ "font-weight": tok.bold ? 700 : fontWeight,
3176
+ "font-style": tok.italic ? "italic" : void 0,
3177
+ "text-decoration": inheritedHref ? "underline" : void 0
3178
+ }, tok.value)
3179
+ );
3180
+ cursor += w;
3181
+ break;
3182
+ }
3183
+ case "code": {
3184
+ const w = measureToken(tok, fontSize);
3185
+ decorations.push(chunkHDKDQAEQ_cjs.rect({
3186
+ x: cursor,
3187
+ y: cy - fontSize * 0.6,
3188
+ width: w,
3189
+ height: fontSize * 1.2,
3190
+ rx: 3,
3191
+ ry: 3,
3192
+ fill: theme.codeBg
3193
+ }));
3194
+ tspans.push(
3195
+ tspan({
3196
+ x: cursor + 2,
3197
+ y: baselineY,
3198
+ fill: theme.codeFg,
3199
+ "font-family": "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
3200
+ "font-size": fontSize * 0.92
3201
+ }, tok.value)
3202
+ );
3203
+ cursor += w;
3204
+ break;
3205
+ }
3206
+ case "link": {
3207
+ const aStart = `<a href="${chunkHDKDQAEQ_cjs.escapeXml(tok.href)}" target="_blank" rel="noopener">`;
3208
+ const innerStart = tspans.length;
3209
+ for (const inner of tok.value) emit(inner, tok.href);
3210
+ const innerTspans = tspans.splice(innerStart).join("");
3211
+ tspans.push(aStart + innerTspans + "</a>");
3212
+ break;
3213
+ }
3214
+ case "checkbox": {
3215
+ const size = fontSize * 0.85;
3216
+ const boxX = cursor;
3217
+ const boxY = cy - size / 2;
3218
+ decorations.push(chunkHDKDQAEQ_cjs.rect({
3219
+ x: boxX,
3220
+ y: boxY,
3221
+ width: size,
3222
+ height: size,
3223
+ rx: 2,
3224
+ ry: 2,
3225
+ fill: tok.checked ? theme.checkboxFill : "none",
3226
+ stroke: tok.checked ? theme.checkboxFill : theme.checkboxStroke,
3227
+ "stroke-width": 1.5
3228
+ }));
3229
+ if (tok.checked) {
3230
+ const p = `M ${(boxX + size * 0.2).toFixed(1)} ${(boxY + size * 0.5).toFixed(1)} L ${(boxX + size * 0.42).toFixed(1)} ${(boxY + size * 0.72).toFixed(1)} L ${(boxX + size * 0.82).toFixed(1)} ${(boxY + size * 0.28).toFixed(1)}`;
3231
+ decorations.push(chunkHDKDQAEQ_cjs.path({
3232
+ d: p,
3233
+ fill: "none",
3234
+ stroke: "#ffffff",
3235
+ "stroke-width": 2,
3236
+ "stroke-linecap": "round",
3237
+ "stroke-linejoin": "round"
3238
+ }));
3239
+ }
3240
+ cursor += size + fontSize * 0.25;
3241
+ break;
3242
+ }
3243
+ }
3244
+ };
3245
+ for (const tok of line2.tokens) emit(tok);
3246
+ const textElement = chunkHDKDQAEQ_cjs.el("text", {
3247
+ "font-family": fontFamily,
3248
+ "font-size": fontSize,
3249
+ "font-weight": fontWeight
3250
+ }, tspans.join(""));
3251
+ return { textElement, decorations };
3252
+ }
3253
+ function measureToken(tok, fs) {
3254
+ switch (tok.kind) {
3255
+ case "text":
3256
+ return tok.value.length * fs * (tok.bold ? 0.62 : 0.58);
3257
+ case "code":
3258
+ return tok.value.length * fs * 0.62 + 4;
3259
+ case "link": {
3260
+ let w = 0;
3261
+ for (const t of tok.value) w += measureToken(t, fs);
3262
+ return w;
3263
+ }
3264
+ case "checkbox":
3265
+ return fs * 0.85 + fs * 0.25;
3266
+ }
2941
3267
  }
2942
- function renderCentral(n, theme, fontFamily) {
2943
- const fs = fontSizeOf(0);
2944
- const pillW = n.labelWidth;
2945
- const pillH = n.labelHeight;
2946
- return chunkHDKDQAEQ_cjs.group(
2947
- { class: "schematex-mindmap-central", "data-node-id": n.node.id },
2948
- [
2949
- chunkHDKDQAEQ_cjs.rect({
2950
- x: n.x - pillW / 2,
2951
- y: n.y - pillH / 2,
2952
- width: pillW,
2953
- height: pillH,
2954
- rx: pillH / 2,
2955
- ry: pillH / 2,
2956
- fill: "none",
2957
- stroke: theme.textMuted,
2958
- "stroke-width": underlineMain(theme)
2959
- }),
2960
- chunkHDKDQAEQ_cjs.text(
2961
- {
2962
- x: n.x,
2963
- y: n.y + fs * 0.35,
2964
- "text-anchor": "middle",
2965
- "font-family": fontFamily,
2966
- "font-size": fs,
2967
- "font-weight": 700,
2968
- fill: theme.text
2969
- },
2970
- n.node.label
2971
- )
2972
- ]
2973
- );
3268
+ function tspan(attrs, content) {
3269
+ const pairs = [];
3270
+ for (const [k, v] of Object.entries(attrs)) {
3271
+ if (v === void 0) continue;
3272
+ pairs.push(`${k}="${typeof v === "number" ? String(v) : chunkHDKDQAEQ_cjs.escapeXml(String(v))}"`);
3273
+ }
3274
+ return `<tspan ${pairs.join(" ")}>${chunkHDKDQAEQ_cjs.escapeXml(content)}</tspan>`;
2974
3275
  }
2975
- function renderBranchNode(n, color, theme, fontFamily) {
3276
+ function renderNode(n, color, theme, fontFamily) {
3277
+ const isRoot = n.node.depth === 0;
2976
3278
  const isMain = n.node.depth === 1;
2977
- const fs = fontSizeOf(n.node.depth);
2978
- const tx = n.x;
2979
- const ty = isMain ? n.y - 3 : n.y + fs * 0.35;
3279
+ const fs = n.fontSize;
3280
+ const lh = lineHeightOf(fs);
3281
+ const lineCount = n.lines.length;
3282
+ const topY = n.y - n.labelHeight / 2;
3283
+ const underlineY2 = n.y + n.labelHeight / 2 - UNDERLINE_GAP / 2;
3284
+ const children = [];
3285
+ const decorations = [];
3286
+ const weight = isRoot ? 700 : isMain ? 600 : 400;
3287
+ for (let i = 0; i < lineCount; i++) {
3288
+ const line2 = n.lines[i];
3289
+ const cy = topY + (i + 0.5) * lh;
3290
+ const r = renderLine(line2, n.x, cy, fs, fontFamily, weight, theme);
3291
+ decorations.push(...r.decorations);
3292
+ children.push(r.textElement);
3293
+ }
2980
3294
  const ux1 = n.x - n.labelWidth / 2;
2981
3295
  const ux2 = n.x + n.labelWidth / 2;
2982
- const uy = n.y;
2983
- const children = [
2984
- chunkHDKDQAEQ_cjs.text(
2985
- {
2986
- x: tx,
2987
- y: ty,
2988
- "text-anchor": "middle",
2989
- "font-family": fontFamily,
2990
- "font-size": fs,
2991
- "font-weight": isMain ? 600 : 400,
2992
- fill: theme.text
2993
- },
2994
- n.node.label
2995
- )
2996
- ];
2997
- if (isMain) {
2998
- children.push(
2999
- chunkHDKDQAEQ_cjs.el("line", {
3000
- x1: ux1,
3001
- y1: uy,
3002
- x2: ux2,
3003
- y2: uy,
3004
- stroke: color,
3005
- "stroke-width": underlineMain(theme),
3006
- "stroke-linecap": "round"
3007
- })
3008
- );
3009
- }
3296
+ const sw = underlineWidthFor(n.node.depth) * strokeScale(theme);
3297
+ children.push(
3298
+ chunkHDKDQAEQ_cjs.el("line", {
3299
+ x1: ux1,
3300
+ y1: underlineY2,
3301
+ x2: ux2,
3302
+ y2: underlineY2,
3303
+ stroke: color,
3304
+ "stroke-width": sw,
3305
+ "stroke-linecap": "round"
3306
+ })
3307
+ );
3308
+ const cls = isRoot ? "schematex-mindmap-central" : isMain ? "schematex-mindmap-main" : "schematex-mindmap-leaf";
3010
3309
  return chunkHDKDQAEQ_cjs.group(
3011
3310
  {
3012
- class: isMain ? "schematex-mindmap-main" : "schematex-mindmap-leaf",
3311
+ class: cls,
3013
3312
  "data-node-id": n.node.id,
3014
3313
  "data-depth": n.node.depth,
3015
3314
  "data-branch-idx": n.branchIndex
3016
3315
  },
3017
- children
3316
+ [...decorations, ...children]
3018
3317
  );
3019
3318
  }
3020
3319
  function renderMindmapAST(ast, themeName = "default", fontFamily = "system-ui, -apple-system, sans-serif") {
3021
- const theme = chunkS6VPECM3_cjs.resolveMindmapTheme(ast.themeOverride ?? themeName);
3320
+ const theme = chunkD7EHZFK4_cjs.resolveMindmapTheme(ast.themeOverride ?? themeName);
3022
3321
  const layout = layoutMindmap(ast);
3023
3322
  const byId = new Map(layout.nodes.map((n) => [n.node.id, n]));
3024
3323
  const edgeSvgs = [];
@@ -3038,15 +3337,10 @@ function renderMindmapAST(ast, themeName = "default", fontFamily = "system-ui, -
3038
3337
  }
3039
3338
  const nodeSvgs = [];
3040
3339
  for (const n of layout.nodes) {
3041
- if (n.node.depth === 0) {
3042
- nodeSvgs.push(renderCentral(n, theme, fontFamily));
3043
- } else {
3044
- nodeSvgs.push(
3045
- renderBranchNode(n, paletteColor(theme, n.branchIndex), theme, fontFamily)
3046
- );
3047
- }
3340
+ const color = n.node.depth === 0 ? theme.centralFill : paletteColor(theme, n.branchIndex);
3341
+ nodeSvgs.push(renderNode(n, color, theme, fontFamily));
3048
3342
  }
3049
- const title2 = ast.title ?? ast.root.label;
3343
+ const title2 = ast.title ?? tokensToPlainText(ast.root.tokens);
3050
3344
  return chunkHDKDQAEQ_cjs.svgRoot(
3051
3345
  {
3052
3346
  viewBox: `0 0 ${layout.width.toFixed(1)} ${layout.height.toFixed(1)}`,
@@ -4485,24 +4779,24 @@ var matrix = {
4485
4779
 
4486
4780
  // src/core/api.ts
4487
4781
  var plugins = [
4488
- chunkCEV3GZA3_cjs.genogram,
4489
- chunkZGKEFVJQ_cjs.ecomap,
4490
- chunkAMP2FFES_cjs.pedigree,
4491
- chunkYKO7DY2F_cjs.phylo,
4492
- chunkDTMCQXXC_cjs.sociogram,
4782
+ chunkZ63XPA2V_cjs.genogram,
4783
+ chunkXHZ7GXP2_cjs.ecomap,
4784
+ chunkXVCAOGFL_cjs.pedigree,
4785
+ chunkX7RPFTTR_cjs.phylo,
4786
+ chunkYXIIWLLB_cjs.sociogram,
4493
4787
  chunkZO77FHBF_cjs.timing,
4494
- chunk4HPT4BOI_cjs.logic,
4495
- chunkHKRYKEOV_cjs.circuit,
4788
+ chunkWYFXOXVK_cjs.logic,
4789
+ chunk4S2WILLW_cjs.circuit,
4496
4790
  chunkLXNFVHDT_cjs.blockdiagram,
4497
- chunkLKHWBDWZ_cjs.ladder,
4498
- chunkULERCTGS_cjs.sld,
4499
- chunkPIQG2Z5N_cjs.entity,
4500
- chunkIMHR3S5H_cjs.fishbone,
4501
- chunk3M7QWADF_cjs.venn,
4502
- chunkHAIBAF6J_cjs.flowchart,
4791
+ chunkISACNVFE_cjs.ladder,
4792
+ chunkQR7VTCI4_cjs.sld,
4793
+ chunkZNOD4VZT_cjs.entity,
4794
+ chunkLKOBOVNL_cjs.fishbone,
4795
+ chunkQSQX77S2_cjs.venn,
4796
+ chunkCXHPP5BL_cjs.flowchart,
4503
4797
  mindmap,
4504
4798
  matrix,
4505
- chunkIY52OWPG_cjs.orgchart,
4799
+ chunk7IRT3LOY_cjs.orgchart,
4506
4800
  decisiontree,
4507
4801
  timeline
4508
4802
  ];
@@ -4540,5 +4834,5 @@ exports.decisiontree = decisiontree;
4540
4834
  exports.parse = parse;
4541
4835
  exports.render = render;
4542
4836
  exports.timeline = timeline;
4543
- //# sourceMappingURL=chunk-VP54YPOX.cjs.map
4544
- //# sourceMappingURL=chunk-VP54YPOX.cjs.map
4837
+ //# sourceMappingURL=chunk-7HKXU7J2.cjs.map
4838
+ //# sourceMappingURL=chunk-7HKXU7J2.cjs.map