@diagrammo/dgmo 0.92.0 → 0.93.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 (166) hide show
  1. package/dist/advanced.d.ts +85 -21
  2. package/dist/advanced.js +455 -422
  3. package/dist/block.d.ts +2 -2
  4. package/dist/block.js +75 -70
  5. package/dist/{chart-meta-BBqLnv5q.d.ts → chart-meta-BbjsRY7o.d.ts} +2 -2
  6. package/dist/chart-meta.d.ts +3 -3
  7. package/dist/chart-meta.js +25 -19
  8. package/dist/{chart-types-CbXlZFLd.d.ts → chart-types-Cppnp31G.d.ts} +173 -4
  9. package/dist/{charts-d3-QUUDVETP.js → charts-d3-ERYYVGP6.js} +7 -6
  10. package/dist/{chunk-HIWHIYLD.js → chunk-2TFXRBCD.js} +19 -19
  11. package/dist/{chunk-F7326NVM.js → chunk-3GCASUWA.js} +58 -25
  12. package/dist/{chunk-ZJAK6C7Y.js → chunk-3PP746YM.js} +6 -1
  13. package/dist/{chunk-WLLO3PZ3.js → chunk-472EOHVW.js} +17 -17
  14. package/dist/{chunk-LMP6Y7QO.js → chunk-4WQX55VX.js} +56 -24
  15. package/dist/{chunk-JLU52ZDT.js → chunk-5CBX66KB.js} +10 -10
  16. package/dist/{chunk-DEFBUZWV.js → chunk-5HAYT43L.js} +70 -54
  17. package/dist/{chunk-S7W75MIM.js → chunk-65GPEV5V.js} +21 -3
  18. package/dist/{chunk-Q6W2K33N.js → chunk-6XLMTAEX.js} +1 -1
  19. package/dist/{chunk-JKST4RTT.js → chunk-7OWK5K5C.js} +6 -6
  20. package/dist/{chunk-73EYNV4O.js → chunk-A5WIAMCT.js} +4 -6
  21. package/dist/{chunk-X5BUX2GK.js → chunk-ADVGV3P7.js} +1 -1
  22. package/dist/{chunk-45QUTYPD.js → chunk-CYDM2XII.js} +17 -17
  23. package/dist/chunk-CYTFO2LF.js +209 -0
  24. package/dist/{chunk-JRWUHLRP.js → chunk-D6PVMUCX.js} +51 -8
  25. package/dist/{chunk-BRSM6Z34.js → chunk-DAHQL57W.js} +14 -14
  26. package/dist/{chunk-RBFJT23E.js → chunk-EQWC76GQ.js} +6 -6
  27. package/dist/{chunk-ADNIO3XY.js → chunk-FIYW7JW4.js} +5 -5
  28. package/dist/{chunk-7ENDOHAA.js → chunk-FMAVHTYB.js} +919 -927
  29. package/dist/{chunk-3PFMGNOM.js → chunk-GJXMG4S3.js} +26 -11
  30. package/dist/chunk-GXCDD6NG.js +24 -0
  31. package/dist/{chunk-RJ2JW3FG.js → chunk-IESUM4N5.js} +2331 -2236
  32. package/dist/{chunk-62BP7AJU.js → chunk-IIV4SMJL.js} +18 -18
  33. package/dist/{chunk-5EBYPETE.js → chunk-J43OCO22.js} +3 -5
  34. package/dist/{chunk-L5NW3PVL.js → chunk-J6AEKIRQ.js} +1 -1
  35. package/dist/{chunk-2BJW7FSF.js → chunk-KBEWVCK3.js} +1 -1
  36. package/dist/{chunk-LRP5FXST.js → chunk-KCHQVED5.js} +18 -17
  37. package/dist/{chunk-Q6ZQX2HX.js → chunk-KCMGIYPO.js} +4 -6
  38. package/dist/{chunk-MDVJYRJT.js → chunk-KPGPK4SK.js} +22 -22
  39. package/dist/{chunk-Q2UFOKPB.js → chunk-KPSSNGAE.js} +22 -22
  40. package/dist/{chunk-V4D2ZQBE.js → chunk-KRPLP5LP.js} +6 -1
  41. package/dist/{chunk-BZX7QCXJ.js → chunk-KRU2LCIP.js} +15 -15
  42. package/dist/{chunk-HXULJZA2.js → chunk-LDDDKWL6.js} +6 -1
  43. package/dist/{chunk-NREU4JFE.js → chunk-LNVB75QU.js} +6 -8
  44. package/dist/{chunk-MX4SZLSV.js → chunk-LUDUDBO6.js} +16 -8
  45. package/dist/{chunk-2YAFDND3.js → chunk-M4NV5PPU.js} +4 -6
  46. package/dist/{chunk-26BBJUBW.js → chunk-M6ZQAFPD.js} +4 -6
  47. package/dist/{chunk-NPWVOFB3.js → chunk-MB2SQF7N.js} +1 -1
  48. package/dist/{chunk-6ZL2XYM7.js → chunk-MLY5ALOV.js} +6 -6
  49. package/dist/chunk-NJJCTEBM.js +416 -0
  50. package/dist/{chunk-OQW4ETJX.js → chunk-NM5V5EKY.js} +6 -1
  51. package/dist/{chunk-ONYO5WJW.js → chunk-NMK7KJZZ.js} +21 -21
  52. package/dist/{chunk-6BNNLVAR.js → chunk-NPDVWFAQ.js} +6 -1
  53. package/dist/{chunk-FTUMRSGT.js → chunk-P5FUWXPW.js} +4 -286
  54. package/dist/chunk-P7TRFL4P.js +54 -0
  55. package/dist/{chunk-A4PNWAUW.js → chunk-PGSGJLUR.js} +6 -1
  56. package/dist/{chunk-DRFGIOZ6.js → chunk-Q7Y6JQ3R.js} +4 -6
  57. package/dist/{chunk-J2E7EUER.js → chunk-QDRCWVV3.js} +17 -17
  58. package/dist/{chunk-MXAP37W6.js → chunk-TNV4F5WA.js} +16 -7
  59. package/dist/{chunk-EBSFSOJC.js → chunk-U7U64UUN.js} +22 -22
  60. package/dist/chunk-UCHZJJIT.js +421 -0
  61. package/dist/{chunk-FSJ3ZA6N.js → chunk-UG7AQQNR.js} +12 -12
  62. package/dist/{chunk-WFA6IULY.js → chunk-URRAWU5D.js} +5 -0
  63. package/dist/{chunk-VOR32OHN.js → chunk-USAGHYRD.js} +13 -15
  64. package/dist/{chunk-QUGC7GWB.js → chunk-UVX3IYXF.js} +15 -15
  65. package/dist/{chunk-B5PEKSRH.js → chunk-VSAKEMDD.js} +6 -1
  66. package/dist/{chunk-YRYKTYMQ.js → chunk-VSOZZYLK.js} +106 -12
  67. package/dist/{chunk-5SSTVFPX.js → chunk-WK5QEYFA.js} +5 -7
  68. package/dist/{chunk-KTGZDMDX.js → chunk-XUTR7GNT.js} +76 -28
  69. package/dist/{chunk-6WVX4KNP.js → chunk-YDZIVDVR.js} +97 -297
  70. package/dist/{chunk-URQIWIKX.js → chunk-YXXIRM4C.js} +3 -3
  71. package/dist/{chunk-H5UEVW6Q.js → chunk-ZD3QCNB7.js} +1 -1
  72. package/dist/{chunk-DUPZ2BBY.js → chunk-ZTLMEBAC.js} +66 -4
  73. package/dist/clock.js +168 -0
  74. package/dist/completion-registry.js +3 -1
  75. package/dist/countdown.js +36 -395
  76. package/dist/{dgmo-router-4UAPPIKN.js → dgmo-router-CZN36TR3.js} +50 -43
  77. package/dist/{dimensions-SCNVYLRF.js → dimensions-7HHKO5BS.js} +3 -3
  78. package/dist/{d3-BThYBTQk.d.ts → export-context-Ceh3wr0E.d.ts} +2 -8
  79. package/dist/{flowchart-parser-NA75YQ77.js → flowchart-parser-4MZPWYK6.js} +8 -3
  80. package/dist/{flowchart-renderer-6MGGX4RC.js → flowchart-renderer-5XDN575E.js} +13 -17
  81. package/dist/index.d.ts +8 -7
  82. package/dist/index.js +80 -74
  83. package/dist/{layout-S3RLVPH4.js → layout-33FHGDEV.js} +10 -12
  84. package/dist/{layout-MBVBAMPA.js → layout-3TSVAGWH.js} +2 -2
  85. package/dist/{layout-WRG4APSJ.js → layout-5GHV7HNM.js} +9 -13
  86. package/dist/layout-FTOGDNUL.js +23 -0
  87. package/dist/{layout-BNLFQHSB.js → layout-QXGPY7KA.js} +7 -9
  88. package/dist/{layout-search-PMYL3VWS.js → layout-search-EMTCDC3C.js} +8 -10
  89. package/dist/{palettes-IN7ZFRJM.js → palettes-4Y7CL2QL.js} +4 -2
  90. package/dist/{parser-3MK56JZC.js → parser-4Y6PODW6.js} +2 -2
  91. package/dist/{parser-2NWH5JUS.js → parser-A3AN76RQ.js} +2 -1
  92. package/dist/{parser-LCJ76UXS.js → parser-BT4NI6JY.js} +5 -1
  93. package/dist/{parser-FXDS4JDK.js → parser-F7NDRPMA.js} +2 -2
  94. package/dist/{parser-BES6LV3G.js → parser-GDLKUBTO.js} +5 -1
  95. package/dist/{parser-SEUTXN6U.js → parser-KJPPUN4D.js} +2 -2
  96. package/dist/{parser-SIKL4PLF.js → parser-KMKVFET2.js} +5 -1
  97. package/dist/{parser-5LW5JDYG.js → parser-NL73FSFI.js} +5 -1
  98. package/dist/{parser-VA7ZQQTA.js → parser-NUU3DVW4.js} +5 -1
  99. package/dist/{parser-L6RWDXQN.js → parser-OGF2CDA6.js} +8 -3
  100. package/dist/{parser-XZUKNZPB.js → parser-R3LPEQIT.js} +7 -1
  101. package/dist/{parser-X23GRTQJ.js → parser-RCIEKN7Y.js} +5 -1
  102. package/dist/{parser-GX5YLRIP.js → parser-VKYUAT4Y.js} +8 -3
  103. package/dist/{parser-QYISOAGR.js → parser-YX72VLDZ.js} +8 -3
  104. package/dist/redraw-MSXU4ZD2.js +73 -0
  105. package/dist/redraw-T324XAF3.js +1698 -0
  106. package/dist/{renderer-5VKPB4LL.js → renderer-37PLQHVB.js} +5 -5
  107. package/dist/{renderer-ISSDGK54.js → renderer-3F47TPZ2.js} +3 -3
  108. package/dist/{renderer-3QAFDXEY.js → renderer-5ITLW7MX.js} +14 -12
  109. package/dist/{renderer-ZZ6MWVB7.js → renderer-6GJWADLO.js} +4 -4
  110. package/dist/{renderer-MM27BSBO.js → renderer-7Y3LR4R2.js} +3 -4
  111. package/dist/{renderer-2FVUPBGV.js → renderer-AM7P4LN7.js} +1 -1
  112. package/dist/{renderer-ZHGHTSNG.js → renderer-BO73LSVT.js} +13 -12
  113. package/dist/{renderer-3IHQI4A4.js → renderer-CNRQFIEI.js} +11 -10
  114. package/dist/{renderer-OAR5VPH4.js → renderer-DAZWHNLI.js} +2 -2
  115. package/dist/{renderer-NDA2FFYB.js → renderer-DD6T3C4J.js} +5 -5
  116. package/dist/{renderer-WIU5BJUK.js → renderer-DDWDCM2K.js} +2 -2
  117. package/dist/{renderer-7ZZG5HR3.js → renderer-EVKWGUGT.js} +8 -9
  118. package/dist/{renderer-3JY6JAQJ.js → renderer-FL7EOSBU.js} +5 -6
  119. package/dist/{renderer-NIE5IW24.js → renderer-GFALLIYT.js} +8 -7
  120. package/dist/{renderer-O6DY46AV.js → renderer-GFGFHYWY.js} +7 -7
  121. package/dist/{renderer-5TZVFQ7K.js → renderer-GOXAP2IE.js} +7 -8
  122. package/dist/{renderer-NHTR7IRR.js → renderer-GPAVVUET.js} +4 -5
  123. package/dist/{renderer-TO2NVJP3.js → renderer-HJ54YXT3.js} +50 -45
  124. package/dist/{renderer-LM4ICK6I.js → renderer-HYGTMBHT.js} +4 -5
  125. package/dist/{renderer-S3YCLJKL.js → renderer-IHCWBFPI.js} +17 -20
  126. package/dist/{renderer-XO57LTU4.js → renderer-ISDKO3DI.js} +5 -5
  127. package/dist/{renderer-LQP3AGEJ.js → renderer-J3QWK6IM.js} +3 -4
  128. package/dist/{renderer-J666LZXJ.js → renderer-J6H4Q3RM.js} +7 -8
  129. package/dist/{renderer-ALWVK3EJ.js → renderer-JJ4QW3SK.js} +6 -6
  130. package/dist/{renderer-DC7C5Q3G.js → renderer-NOYLNVTI.js} +2 -2
  131. package/dist/{renderer-ZGY7P4BM.js → renderer-PBKTAWQV.js} +16 -20
  132. package/dist/{renderer-XGG2UNXT.js → renderer-POBGKIUT.js} +3 -4
  133. package/dist/{renderer-QGIHLZOJ.js → renderer-RDI2RYUP.js} +9 -10
  134. package/dist/{renderer-JEJT3YET.js → renderer-TSCSZ6CL.js} +2 -3
  135. package/dist/{renderer-VPIELEE5.js → renderer-VDBNC7A6.js} +8 -9
  136. package/dist/{renderer-J67LMOD5.js → renderer-VI34SD5V.js} +15 -15
  137. package/dist/{renderer-J5FKF423.js → renderer-W4MUMXJE.js} +7 -4
  138. package/dist/{renderer-RSK6QFWN.js → renderer-XJMVG2WJ.js} +7 -9
  139. package/dist/{state-parser-TIR2ORJY.js → state-parser-NPYTMRXP.js} +8 -3
  140. package/dist/{state-renderer-G6SUXU4J.js → state-renderer-44K2KDX7.js} +15 -19
  141. package/dist/{tag-groups-DsoVpAY-.d.ts → tag-groups-DydewK3D.d.ts} +2 -173
  142. package/dist/{themes-DRNjxX7Q.d.ts → themes-DzIH3Hjv.d.ts} +3 -2
  143. package/docs/ai-integration.md +1 -1
  144. package/docs/language-reference.md +23 -2
  145. package/gallery/fixtures/map-undirected-edges.dgmo +5 -5
  146. package/gallery/fixtures/whiteboard.dgmo +3 -0
  147. package/package.json +4 -6
  148. package/dist/chunk-3Y63RFJL.js +0 -75
  149. package/dist/chunk-5DH3KYFH.js +0 -20
  150. package/dist/chunk-O753JUEZ.js +0 -67
  151. package/dist/chunk-RJNZHFNG.js +0 -51
  152. package/dist/chunk-Z6DXWULM.js +0 -23
  153. package/dist/layout-5USEVQBY.js +0 -25
  154. package/dist/{chunk-YITHYQCL.js → chunk-4FT5KQ7H.js} +7 -7
  155. package/dist/{chunk-GE7ICBX6.js → chunk-4RY5D5RE.js} +4 -4
  156. package/dist/{chunk-DGUGE67L.js → chunk-CDYV46JE.js} +3 -3
  157. package/dist/{chunk-IGKFOHBG.js → chunk-CQYFZOUC.js} +13 -13
  158. package/dist/{chunk-TKAB3FTK.js → chunk-DRQSB72S.js} +11 -11
  159. package/dist/{chunk-ZKP77MB3.js → chunk-FVTYJUXR.js} +5 -5
  160. package/dist/{chunk-MA42PIGJ.js → chunk-H5NVCOEJ.js} +4 -4
  161. package/dist/{chunk-BEA4D7OS.js → chunk-IXHWS2HI.js} +3 -3
  162. package/dist/{chunk-QKY6W4NA.js → chunk-KHL652SX.js} +25 -25
  163. package/dist/{chunk-6OIMUSDX.js → chunk-MUJVNSEW.js} +9 -9
  164. package/dist/{chunk-YO6AQU4A.js → chunk-QJOVZ4TC.js} +12 -12
  165. package/dist/{chunk-SOHZDW6N.js → chunk-UXNA2H2V.js} +3 -3
  166. package/dist/{chunk-NO3UX6AP.js → chunk-V2NQV7VL.js} +4 -4
@@ -1,15 +1,19 @@
1
- import {
2
- renderInlineText
3
- } from "./chunk-S7W75MIM.js";
4
1
  import {
5
2
  renderNodeCard
6
3
  } from "./chunk-R2K5L4UA.js";
4
+ import {
5
+ serializeSvg
6
+ } from "./chunk-CYRB2JTN.js";
7
7
  import {
8
8
  ScaleContext
9
9
  } from "./chunk-24YPR5EH.js";
10
10
  import {
11
- renderIntegratedLegend
12
- } from "./chunk-NMS5XSLX.js";
11
+ layoutInlineHeader
12
+ } from "./chunk-42UJ23H3.js";
13
+ import {
14
+ TITLE_FONT_SIZE,
15
+ TITLE_FONT_WEIGHT
16
+ } from "./chunk-VLC6WNRD.js";
13
17
  import {
14
18
  ARROWHEAD_HEIGHT,
15
19
  ARROWHEAD_WIDTH,
@@ -30,25 +34,21 @@ import {
30
34
  SEPARATOR_GAP
31
35
  } from "./chunk-XCKNFFKM.js";
32
36
  import {
33
- layoutInlineHeader
34
- } from "./chunk-42UJ23H3.js";
35
- import {
36
- serializeSvg
37
- } from "./chunk-CYRB2JTN.js";
37
+ renderIntegratedLegend
38
+ } from "./chunk-NMS5XSLX.js";
38
39
  import {
39
40
  getLegendExtent,
40
41
  getMaxLegendReservedHeight
41
42
  } from "./chunk-JILEYZ2V.js";
42
43
  import {
43
- TITLE_FONT_SIZE,
44
- TITLE_FONT_WEIGHT
45
- } from "./chunk-VLC6WNRD.js";
44
+ preprocessDescriptionLine
45
+ } from "./chunk-IYULMRBE.js";
46
+ import {
47
+ renderInlineText
48
+ } from "./chunk-65GPEV5V.js";
46
49
  import {
47
50
  FONT_FAMILY
48
51
  } from "./chunk-ICLB27PZ.js";
49
- import {
50
- preprocessDescriptionLine
51
- } from "./chunk-IYULMRBE.js";
52
52
  import {
53
53
  tagAttrKey
54
54
  } from "./chunk-4SACN2C5.js";
@@ -460,7 +460,7 @@ function renderLegend(parent, legendGroups, palette, isDark, activeTagGroup, fix
460
460
  async function renderSitemapForExport(content, theme, palette) {
461
461
  const { parseSitemap } = await import("./parser-6TDWUKM5.js");
462
462
  const { layoutSitemap } = await import("./layout-ND26WVX2.js");
463
- const { getPalette, DEFAULT_PALETTE_ID } = await import("./palettes-IN7ZFRJM.js");
463
+ const { getPalette, DEFAULT_PALETTE_ID } = await import("./palettes-4Y7CL2QL.js");
464
464
  const isDark = theme === "dark";
465
465
  const defaultCfg = getPalette(DEFAULT_PALETTE_ID);
466
466
  const effectivePalette = palette ?? (isDark ? defaultCfg.dark : defaultCfg.light);
@@ -0,0 +1,209 @@
1
+ import {
2
+ COLOR_KEYS,
3
+ SEMANTIC_KEYS,
4
+ validateThemeFile
5
+ } from "./chunk-FMAVHTYB.js";
6
+ import {
7
+ BUILT_IN_PALETTE_IDS
8
+ } from "./chunk-3UR4F7FE.js";
9
+ import {
10
+ makeDgmoError
11
+ } from "./chunk-BYU54C3S.js";
12
+
13
+ // src/palettes/directive.ts
14
+ var PALETTE_LINE_RE = /^palette(?:\s+(.*))?$/;
15
+ var MODES = /* @__PURE__ */ new Set(["light", "dark"]);
16
+ var COLOR_NAMES = new Set(COLOR_KEYS);
17
+ var kebab = (key) => key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
18
+ var camel = (key) => key.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
19
+ var ROLE_KEYS = new Set(SEMANTIC_KEYS.map(kebab));
20
+ function builtInList() {
21
+ return [...BUILT_IN_PALETTE_IDS].sort().join(", ");
22
+ }
23
+ function warn(line, message, code) {
24
+ return makeDgmoError(line, message, "warning", code);
25
+ }
26
+ function readBlock(name, headerLine, block) {
27
+ const diagnostics = [];
28
+ const sections = {};
29
+ const where = /* @__PURE__ */ new Map();
30
+ let section;
31
+ for (const { line, text } of block) {
32
+ const [key = "", value, ...rest] = text.trim().split(/\s+/);
33
+ if (MODES.has(key) && value === void 0) {
34
+ section = key;
35
+ if (sections[section]) {
36
+ diagnostics.push(
37
+ warn(
38
+ line,
39
+ `The "${section}" section appears twice in palette "${name}".`,
40
+ "W_PALETTE_INVALID"
41
+ )
42
+ );
43
+ }
44
+ sections[section] = { roles: {}, colors: {} };
45
+ where.set(section, line);
46
+ continue;
47
+ }
48
+ if (key === "colors" && value === void 0) continue;
49
+ if (!section) {
50
+ diagnostics.push(
51
+ warn(
52
+ line,
53
+ `"${key}" sits outside a light or dark section of palette "${name}".`,
54
+ "W_PALETTE_INVALID"
55
+ )
56
+ );
57
+ continue;
58
+ }
59
+ if (value === void 0 || rest.length > 0) {
60
+ diagnostics.push(
61
+ warn(
62
+ line,
63
+ `Write "${key}" as one key and one hex colour, e.g. "${key} #282a36".`,
64
+ "W_PALETTE_INVALID"
65
+ )
66
+ );
67
+ continue;
68
+ }
69
+ if (COLOR_NAMES.has(key)) {
70
+ sections[section].colors[key] = value;
71
+ where.set(`${section}.colors.${key}`, line);
72
+ } else {
73
+ const field = ROLE_KEYS.has(key) ? camel(key) : key;
74
+ sections[section].roles[field] = value;
75
+ where.set(`${section}.${field}`, line);
76
+ }
77
+ }
78
+ if (diagnostics.length > 0) return diagnostics;
79
+ const modes = Object.keys(sections);
80
+ const input = {
81
+ id: name.toLowerCase(),
82
+ name,
83
+ ...modes.length === 1 && { mode: modes[0] }
84
+ };
85
+ for (const mode of modes) {
86
+ const { roles, colors } = sections[mode];
87
+ input[mode] = { ...roles, colors };
88
+ }
89
+ const result = validateThemeFile(input);
90
+ if (result.ok) return { palette: result.palette, mode: result.mode };
91
+ return result.errors.map((error) => {
92
+ const field = /^(light|dark)(?:\.colors)?\.(\w+)/.exec(error) ?? /^(light|dark)\b[^:]*: (\w+) /.exec(error);
93
+ const at = field ? where.get(`${field[1]}.colors.${field[2]}`) ?? where.get(`${field[1]}.${field[2]}`) ?? where.get(field[1]) : void 0;
94
+ return warn(
95
+ at ?? headerLine,
96
+ `Palette "${name}" is not drawn \u2014 ${error.replace(/\b(text[A-Z]\w*|[a-z]+[A-Z]\w*)\b/g, kebab)}.`,
97
+ "W_PALETTE_INVALID"
98
+ );
99
+ });
100
+ }
101
+ function extractPaletteDirective(content) {
102
+ if (!/^palette\b/m.test(content)) return { content, diagnostics: [] };
103
+ const lines = content.split("\n");
104
+ const diagnostics = [];
105
+ let paletteId;
106
+ let palette;
107
+ let mode;
108
+ for (let i = 0; i < lines.length; i++) {
109
+ const match = PALETTE_LINE_RE.exec(lines[i].replace(/\r$/, ""));
110
+ if (!match) continue;
111
+ const lineNumber = i + 1;
112
+ lines[i] = "//";
113
+ const block = [];
114
+ let blockEnd = i;
115
+ for (let j = i + 1; j < lines.length; j++) {
116
+ const next = lines[j].replace(/\r$/, "");
117
+ if (next.trim() === "") continue;
118
+ if (!/^\s/.test(next)) break;
119
+ blockEnd = j;
120
+ block.push({ line: j + 1, text: next });
121
+ }
122
+ for (let j = i + 1; j <= blockEnd; j++) lines[j] = "//";
123
+ i = blockEnd;
124
+ const words = (match[1] ?? "").trim().split(/\s+/).filter(Boolean);
125
+ const name = words[0];
126
+ if (!name) {
127
+ diagnostics.push(
128
+ warn(
129
+ lineNumber,
130
+ `"palette" needs a palette name \u2014 one of ${builtInList()}.`,
131
+ "W_PALETTE_UNKNOWN"
132
+ )
133
+ );
134
+ continue;
135
+ }
136
+ if (block.length > 0) {
137
+ if (words.length > 1) {
138
+ diagnostics.push(
139
+ warn(
140
+ lineNumber,
141
+ `An embedded palette takes its name only \u2014 its sections say which modes it has.`,
142
+ "W_PALETTE_MODE_UNKNOWN"
143
+ )
144
+ );
145
+ }
146
+ const read = readBlock(name, lineNumber, block);
147
+ if (Array.isArray(read)) {
148
+ diagnostics.push(...read);
149
+ continue;
150
+ }
151
+ paletteId = void 0;
152
+ palette = read.palette;
153
+ mode = read.mode ?? void 0;
154
+ continue;
155
+ }
156
+ const id = name.toLowerCase();
157
+ if (!BUILT_IN_PALETTE_IDS.has(id)) {
158
+ diagnostics.push(
159
+ warn(
160
+ lineNumber,
161
+ `"${name}" is not a built-in palette \u2014 this diagram uses the default palette. Built-in palettes: ${builtInList()}. An embedded palette needs its colours in an indented block.`,
162
+ "W_PALETTE_UNKNOWN"
163
+ )
164
+ );
165
+ continue;
166
+ }
167
+ const modeWord = words[1];
168
+ if (words.length > 2 || modeWord !== void 0 && !MODES.has(modeWord)) {
169
+ diagnostics.push(
170
+ warn(
171
+ lineNumber,
172
+ `"palette ${name}" takes one optional mode word, light or dark \u2014 the rest of the line is ignored.`,
173
+ "W_PALETTE_MODE_UNKNOWN"
174
+ )
175
+ );
176
+ }
177
+ paletteId = id;
178
+ palette = void 0;
179
+ mode = modeWord !== void 0 && MODES.has(modeWord) ? modeWord : void 0;
180
+ }
181
+ return {
182
+ content: lines.join("\n"),
183
+ ...paletteId !== void 0 && { paletteId },
184
+ ...palette !== void 0 && { palette },
185
+ ...mode !== void 0 && { mode },
186
+ diagnostics
187
+ };
188
+ }
189
+ function choosePalette(directive, caller) {
190
+ const callerTheme = caller.theme ?? "light";
191
+ if (caller.paletteOverride !== void 0) {
192
+ return { paletteId: caller.paletteOverride, theme: callerTheme };
193
+ }
194
+ const fileId = directive.palette?.id ?? directive.paletteId;
195
+ if (fileId !== void 0) {
196
+ const theme = directive.mode === "dark" ? "dark" : directive.mode === "light" && callerTheme !== "transparent" ? "light" : callerTheme;
197
+ return {
198
+ paletteId: fileId,
199
+ ...directive.palette && { palette: directive.palette },
200
+ theme
201
+ };
202
+ }
203
+ return { paletteId: caller.palette ?? "slate", theme: callerTheme };
204
+ }
205
+
206
+ export {
207
+ extractPaletteDirective,
208
+ choosePalette
209
+ };
@@ -1,18 +1,57 @@
1
1
  import {
2
- NOTE_BULLET_INDENT,
3
- NOTE_FOLD,
4
- NOTE_FONT_SIZE,
5
- NOTE_LINE_H,
6
- NOTE_PAD_H,
7
- NOTE_PAD_V
8
- } from "./chunk-5DH3KYFH.js";
2
+ wrapDescriptionLines
3
+ } from "./chunk-MB2SQF7N.js";
9
4
  import {
10
5
  renderInlineText
11
- } from "./chunk-S7W75MIM.js";
6
+ } from "./chunk-65GPEV5V.js";
7
+ import {
8
+ measureText
9
+ } from "./chunk-KAO7JL4I.js";
12
10
  import {
13
11
  mix
14
12
  } from "./chunk-6GXLAKUH.js";
15
13
 
14
+ // src/utils/note-box/constants.ts
15
+ var NOTE_MAX_W = 200;
16
+ var NOTE_FOLD = 10;
17
+ var NOTE_PAD_H = 8;
18
+ var NOTE_PAD_V = 6;
19
+ var NOTE_FONT_SIZE = 10;
20
+ var NOTE_LINE_H = 14;
21
+ var NOTE_GAP = 22;
22
+ var NOTE_BULLET_INDENT = 10;
23
+
24
+ // src/utils/note-box/metrics.ts
25
+ function normalizeBulletLine(line) {
26
+ return line.replace(/^\s*[-*]\s+/, "\u2022 ");
27
+ }
28
+ function wrapNoteBody(body, textMaxWidth, fontSize = NOTE_FONT_SIZE) {
29
+ const sourceLines = body.split("\n").map(normalizeBulletLine);
30
+ return wrapDescriptionLines(
31
+ sourceLines,
32
+ textMaxWidth,
33
+ (s) => measureText(s, fontSize)
34
+ );
35
+ }
36
+ function noteBoxSize(body, opts = {}) {
37
+ const fontSize = opts.fontSize ?? NOTE_FONT_SIZE;
38
+ const maxW = opts.maxW ?? NOTE_MAX_W;
39
+ const textMaxWidth = maxW - NOTE_PAD_H * 2;
40
+ const lines = wrapNoteBody(body, textMaxWidth, fontSize);
41
+ let maxLineW = 0;
42
+ for (const line of lines) {
43
+ const indent = line.kind === "plain" ? 0 : NOTE_BULLET_INDENT;
44
+ const w = measureText(line.text, fontSize) + indent;
45
+ if (w > maxLineW) maxLineW = w;
46
+ }
47
+ const width = Math.min(
48
+ maxW,
49
+ Math.max(80, maxLineW + NOTE_PAD_H * 2 + NOTE_FOLD)
50
+ );
51
+ const height = Math.max(1, lines.length) * NOTE_LINE_H + NOTE_PAD_V * 2;
52
+ return { width, height, lines };
53
+ }
54
+
16
55
  // src/utils/note-box/svg.ts
17
56
  var NOTE_STROKE_WIDTH = 0.6;
18
57
  var NOTE_STROKE_OPACITY = 0.6;
@@ -127,6 +166,10 @@ function renderNoteBadge(parent, center, palette, opts) {
127
166
  }
128
167
 
129
168
  export {
169
+ NOTE_GAP,
170
+ NOTE_BULLET_INDENT,
171
+ wrapNoteBody,
172
+ noteBoxSize,
130
173
  renderNoteConnector,
131
174
  noteConnectorPoints,
132
175
  renderNoteBox,
@@ -1,33 +1,33 @@
1
1
  import {
2
- renderInlineText
3
- } from "./chunk-S7W75MIM.js";
2
+ parseKanban
3
+ } from "./chunk-LKZCUFOW.js";
4
+ import {
5
+ serializeSvg
6
+ } from "./chunk-CYRB2JTN.js";
4
7
  import {
5
8
  ScaleContext
6
9
  } from "./chunk-24YPR5EH.js";
7
10
  import {
8
- keepSwimlaneToggleFocus,
9
- renderIntegratedLegend,
10
- wireSwimlaneToggle
11
- } from "./chunk-NMS5XSLX.js";
11
+ TITLE_FONT_SIZE,
12
+ TITLE_FONT_WEIGHT
13
+ } from "./chunk-VLC6WNRD.js";
12
14
  import {
13
15
  CARD_RADIUS
14
16
  } from "./chunk-XCKNFFKM.js";
15
17
  import {
16
- serializeSvg
17
- } from "./chunk-CYRB2JTN.js";
18
+ keepSwimlaneToggleFocus,
19
+ renderIntegratedLegend,
20
+ wireSwimlaneToggle
21
+ } from "./chunk-NMS5XSLX.js";
18
22
  import {
19
23
  getMaxLegendReservedHeight
20
24
  } from "./chunk-JILEYZ2V.js";
21
25
  import {
22
- TITLE_FONT_SIZE,
23
- TITLE_FONT_WEIGHT
24
- } from "./chunk-VLC6WNRD.js";
26
+ renderInlineText
27
+ } from "./chunk-65GPEV5V.js";
25
28
  import {
26
29
  FONT_FAMILY
27
30
  } from "./chunk-ICLB27PZ.js";
28
- import {
29
- parseKanban
30
- } from "./chunk-LKZCUFOW.js";
31
31
  import {
32
32
  tagAttrKey
33
33
  } from "./chunk-4SACN2C5.js";
@@ -1,9 +1,3 @@
1
- import {
2
- wrapDescriptionLines
3
- } from "./chunk-NPWVOFB3.js";
4
- import {
5
- renderInlineText
6
- } from "./chunk-S7W75MIM.js";
7
1
  import {
8
2
  ScaleContext
9
3
  } from "./chunk-24YPR5EH.js";
@@ -12,6 +6,12 @@ import {
12
6
  TITLE_FONT_WEIGHT,
13
7
  TITLE_Y
14
8
  } from "./chunk-VLC6WNRD.js";
9
+ import {
10
+ wrapDescriptionLines
11
+ } from "./chunk-MB2SQF7N.js";
12
+ import {
13
+ renderInlineText
14
+ } from "./chunk-65GPEV5V.js";
15
15
  import {
16
16
  FONT_FAMILY
17
17
  } from "./chunk-ICLB27PZ.js";
@@ -1,13 +1,13 @@
1
- import {
2
- FONT_FAMILY,
3
- MONO_FAMILY
4
- } from "./chunk-ICLB27PZ.js";
5
1
  import {
6
2
  encodeDiagramUrl
7
3
  } from "./chunk-6OSGENN5.js";
8
4
  import {
9
5
  parseDgmoChartType
10
- } from "./chunk-QUGC7GWB.js";
6
+ } from "./chunk-UVX3IYXF.js";
7
+ import {
8
+ FONT_FAMILY,
9
+ MONO_FAMILY
10
+ } from "./chunk-ICLB27PZ.js";
11
11
  import {
12
12
  chartTypes
13
13
  } from "./chunk-TIIZIAGS.js";