@diagrammo/dgmo 0.46.0 → 0.48.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 (534) hide show
  1. package/dist/advanced.d.ts +3 -855
  2. package/dist/advanced.js +541 -70107
  3. package/dist/analyzer-UYKBXAKR.js +15 -0
  4. package/dist/auto.js +1 -1
  5. package/dist/auto.mjs +1 -1
  6. package/dist/block.js +83 -69417
  7. package/dist/calculator-LDYQCDDY.js +11 -0
  8. package/dist/charts-d3-QOZHKTCT.js +25 -0
  9. package/dist/chunk-2DXMZRWJ.js +800 -0
  10. package/dist/chunk-2LACINWN.js +786 -0
  11. package/dist/chunk-33LCUH4H.js +893 -0
  12. package/dist/chunk-3CIOJ5YJ.js +35 -0
  13. package/dist/chunk-3HDBAXF5.js +86 -0
  14. package/dist/chunk-3JLKYGBQ.js +290 -0
  15. package/dist/chunk-3MQQNXPD.js +415 -0
  16. package/dist/chunk-3R5POCTZ.js +967 -0
  17. package/dist/chunk-3SMGIJDD.js +112 -0
  18. package/dist/chunk-44CM72SQ.js +409 -0
  19. package/dist/chunk-4GRI7MEB.js +1604 -0
  20. package/dist/chunk-4OHACBGX.js +606 -0
  21. package/dist/chunk-5DH3KYFH.js +21 -0
  22. package/dist/chunk-5MLYVTYM.js +76 -0
  23. package/dist/chunk-5QXL4NYS.js +553 -0
  24. package/dist/chunk-5WRI5ZAA.js +31 -0
  25. package/dist/chunk-6EK55ART.js +117 -0
  26. package/dist/chunk-6FZYCKXB.js +2065 -0
  27. package/dist/chunk-6HO5ZTXK.js +277 -0
  28. package/dist/chunk-6KFWC4CO.js +7 -0
  29. package/dist/chunk-6MTWIQVO.js +121 -0
  30. package/dist/chunk-6NYWYNBI.js +329 -0
  31. package/dist/chunk-6SM5NJQH.js +620 -0
  32. package/dist/chunk-725LDASD.js +422 -0
  33. package/dist/chunk-76OWZ3BA.js +130 -0
  34. package/{src/block/parser.ts → dist/chunk-7JEGTRLD.js} +100 -189
  35. package/dist/chunk-A44USUV7.js +923 -0
  36. package/dist/chunk-A4GOY3PE.js +25 -0
  37. package/dist/chunk-A4VFQH5G.js +251 -0
  38. package/dist/chunk-AELOBFW5.js +375 -0
  39. package/dist/chunk-AN2MOO5T.js +522 -0
  40. package/dist/chunk-BMR4CIEO.js +41 -0
  41. package/dist/chunk-BS7SV7C3.js +51 -0
  42. package/dist/chunk-BUPDIHML.js +613 -0
  43. package/dist/chunk-BUVJFRPY.js +887 -0
  44. package/dist/chunk-C3Z4DX3V.js +112 -0
  45. package/dist/chunk-CI2G3OEB.js +1818 -0
  46. package/dist/chunk-CKNVO24D.js +54 -0
  47. package/dist/chunk-CUVHQHZ7.js +391 -0
  48. package/dist/chunk-CXK4DZH3.js +114 -0
  49. package/dist/{editor.cjs → chunk-DKEPS5LH.js} +14 -225
  50. package/dist/chunk-DU7W62N5.js +487 -0
  51. package/dist/chunk-DZAQBW35.js +751 -0
  52. package/dist/chunk-EB6FPQUP.js +316 -0
  53. package/dist/chunk-EMS2SK26.js +376 -0
  54. package/dist/chunk-ERLBPDGU.js +510 -0
  55. package/dist/chunk-EVCVDTXE.js +732 -0
  56. package/dist/chunk-FCIIHT24.js +384 -0
  57. package/dist/chunk-FFUN5D66.js +97 -0
  58. package/dist/chunk-FITOLXSX.js +714 -0
  59. package/dist/chunk-FMDSF3OV.js +68 -0
  60. package/dist/chunk-FNB3PNGF.js +410 -0
  61. package/dist/chunk-G2H74XJZ.js +2104 -0
  62. package/dist/chunk-GMR5MFHJ.js +339 -0
  63. package/dist/chunk-H6PI3KJT.js +305 -0
  64. package/dist/chunk-I46X5VUA.js +59 -0
  65. package/dist/chunk-I5IGB56C.js +255 -0
  66. package/dist/chunk-IH6ZMVQ5.js +3950 -0
  67. package/dist/chunk-IJZFN3HM.js +463 -0
  68. package/dist/chunk-IPWPWM6R.js +3079 -0
  69. package/dist/chunk-IYULMRBE.js +23 -0
  70. package/dist/chunk-IZMRON6C.js +167 -0
  71. package/dist/chunk-J5FIXQRT.js +813 -0
  72. package/dist/chunk-JED6ZDEE.js +73 -0
  73. package/dist/chunk-JEUJOX5X.js +136 -0
  74. package/dist/chunk-JM4LEPY3.js +436 -0
  75. package/dist/chunk-L3UHP6TD.js +101 -0
  76. package/dist/chunk-L66GEFB6.js +524 -0
  77. package/dist/chunk-LIOHW36Z.js +469 -0
  78. package/dist/chunk-LP7EC4MI.js +16 -0
  79. package/dist/chunk-MITI6NOL.js +548 -0
  80. package/dist/chunk-MO5YHHMQ.js +168 -0
  81. package/dist/chunk-MZSBFAPJ.js +885 -0
  82. package/dist/chunk-NNAAJVBU.js +9 -0
  83. package/dist/chunk-NOTA6TEI.js +47 -0
  84. package/dist/chunk-NURGB5Z4.js +335 -0
  85. package/dist/chunk-NX4EQS3U.js +1062 -0
  86. package/dist/chunk-NXMESY4J.js +1 -0
  87. package/dist/chunk-OJR3MQYV.js +1458 -0
  88. package/dist/chunk-OURHMODR.js +454 -0
  89. package/dist/chunk-P235SVAH.js +1057 -0
  90. package/dist/chunk-P4RH4OSP.js +1038 -0
  91. package/dist/chunk-P6T66CCZ.js +226 -0
  92. package/dist/chunk-PBAHEPLQ.js +223 -0
  93. package/dist/chunk-PBHE5UG6.js +1530 -0
  94. package/dist/chunk-PDKUANDZ.js +35 -0
  95. package/dist/chunk-PWIHZ6NJ.js +296 -0
  96. package/{src/c4/layout.ts → dist/chunk-QEBUY5NY.js} +384 -1140
  97. package/dist/chunk-QLCCJEJI.js +253 -0
  98. package/dist/chunk-QOOUC2J5.js +52 -0
  99. package/dist/chunk-QYTPPDAO.js +402 -0
  100. package/dist/chunk-R3XI2VC7.js +801 -0
  101. package/dist/chunk-RCERWOJR.js +154 -0
  102. package/dist/chunk-RJE5JTVK.js +362 -0
  103. package/dist/chunk-RTLBSQ3G.js +1155 -0
  104. package/dist/chunk-RUNNI6VE.js +448 -0
  105. package/dist/chunk-RVMRZAPB.js +354 -0
  106. package/dist/chunk-RYEGFMUO.js +955 -0
  107. package/dist/chunk-RZCF2VVM.js +528 -0
  108. package/dist/chunk-SML67VPV.js +1025 -0
  109. package/dist/chunk-SQ7IY53Q.js +44 -0
  110. package/dist/chunk-SQAG3UXH.js +161 -0
  111. package/dist/chunk-SRTU6HMQ.js +1851 -0
  112. package/dist/chunk-T2OE3YQB.js +550 -0
  113. package/dist/chunk-T3UBLACL.js +299 -0
  114. package/dist/chunk-TLVIHFRO.js +296 -0
  115. package/dist/chunk-TYS6CSS5.js +52 -0
  116. package/dist/chunk-U6EQI3U6.js +130 -0
  117. package/dist/chunk-UJ4FJLBF.js +86 -0
  118. package/dist/chunk-ULOEATBZ.js +347 -0
  119. package/dist/chunk-UNCCZ3NU.js +127 -0
  120. package/dist/chunk-USZW2HHU.js +197 -0
  121. package/dist/chunk-UWN33VNX.js +1610 -0
  122. package/dist/chunk-UZ7EZW3B.js +40 -0
  123. package/dist/chunk-VOKGH627.js +37 -0
  124. package/dist/chunk-WBRZJOEC.js +204 -0
  125. package/dist/chunk-WCSOJFU3.js +380 -0
  126. package/dist/chunk-WCT3NYCV.js +160 -0
  127. package/dist/chunk-WVAJFAIA.js +529 -0
  128. package/dist/chunk-X5LCYCL5.js +394 -0
  129. package/dist/chunk-XAKEUMEJ.js +1256 -0
  130. package/dist/chunk-Y2ZE3MSG.js +590 -0
  131. package/dist/chunk-Y3J7VR52.js +646 -0
  132. package/dist/chunk-Y5QGVTVC.js +33 -0
  133. package/dist/chunk-YAA6IID3.js +548 -0
  134. package/dist/chunk-YGJTDXVR.js +692 -0
  135. package/{src/utils/time-ticks.ts → dist/chunk-YRYKTYMQ.js} +45 -112
  136. package/dist/chunk-YYVTBZZC.js +61 -0
  137. package/dist/chunk-Z5CGSFJB.js +647 -0
  138. package/{src/gantt/calculator.ts → dist/chunk-Z72XRXD4.js} +236 -428
  139. package/dist/chunk-ZGR7ULFJ.js +978 -0
  140. package/dist/chunk-ZJEL4H2R.js +851 -0
  141. package/dist/chunk-ZO27FGJS.js +554 -0
  142. package/dist/collapse-CLPJD2RL.js +11 -0
  143. package/dist/collapse-SLINJQW6.js +9 -0
  144. package/dist/collapse-ZWUFFCK2.js +9 -0
  145. package/dist/compute-G55RG53N.js +8 -0
  146. package/dist/dgmo-router-DZCIDUO5.js +73 -0
  147. package/dist/dimensions-J3FHIMJ6.js +22 -0
  148. package/dist/element.js +1 -1
  149. package/dist/element.mjs +1 -1
  150. package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
  151. package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
  152. package/dist/index.d.ts +3 -469
  153. package/dist/index.js +137 -69685
  154. package/dist/layout-46N4JJYK.js +17 -0
  155. package/dist/layout-5RA6QWR6.js +26 -0
  156. package/dist/layout-5T6RH5M6.js +14 -0
  157. package/dist/layout-7QXCNOVS.js +13 -0
  158. package/dist/layout-EE6GE46Y.js +17 -0
  159. package/dist/layout-G23F7LDH.js +9 -0
  160. package/dist/layout-HRBZPFCN.js +23 -0
  161. package/dist/layout-HWDSRX5E.js +20 -0
  162. package/dist/layout-HYZPWAK5.js +18 -0
  163. package/dist/layout-N76NR4ZO.js +19 -0
  164. package/dist/layout-OB3RI63S.js +14 -0
  165. package/dist/layout-S2QBYSK2.js +15 -0
  166. package/dist/layout-UM5F4DJB.js +15 -0
  167. package/dist/layout-search-OYV77HHS.js +1655 -0
  168. package/dist/load-data-EHDDZ5ZS.js +8 -0
  169. package/dist/palettes-PRJ2RI6D.js +56 -0
  170. package/dist/parser-2MFP2H2E.js +11 -0
  171. package/dist/parser-3STE62GB.js +21 -0
  172. package/dist/parser-4FL2CMDG.js +18 -0
  173. package/dist/parser-4OGOBJJ4.js +13 -0
  174. package/dist/parser-6BTRLKRZ.js +15 -0
  175. package/dist/parser-AQETEVRW.js +21 -0
  176. package/dist/parser-CFZD5IBL.js +12 -0
  177. package/dist/parser-FUSKFGZN.js +16 -0
  178. package/dist/parser-I6KXEYFK.js +13 -0
  179. package/dist/parser-IXSZZQHY.js +18 -0
  180. package/dist/parser-JAL2HD4I.js +13 -0
  181. package/dist/parser-KNSQSKQO.js +20 -0
  182. package/dist/parser-N5O4IHUN.js +13 -0
  183. package/dist/parser-NGU3ETO6.js +16 -0
  184. package/dist/parser-NRAI6O25.js +19 -0
  185. package/dist/parser-O5J4VBII.js +11 -0
  186. package/dist/parser-OV7NOBW6.js +21 -0
  187. package/dist/parser-PQ3POX45.js +23 -0
  188. package/dist/parser-TFZFBVWN.js +11 -0
  189. package/dist/parser-TRTHDFPP.js +18 -0
  190. package/dist/parser-VQP2UJ6W.js +11 -0
  191. package/dist/parser-XDVELHRK.js +13 -0
  192. package/dist/parser-XKRP7QKP.js +11 -0
  193. package/dist/parser-Y6WTBU76.js +14 -0
  194. package/dist/parser-ZSDPZYQP.js +12 -0
  195. package/dist/renderer-2XQQQ6QR.js +28 -0
  196. package/dist/renderer-5NDVNDAZ.js +26 -0
  197. package/dist/renderer-6EEZHMH4.js +26 -0
  198. package/dist/renderer-6W5462RB.js +43 -0
  199. package/dist/renderer-7MVLWWQD.js +22 -0
  200. package/dist/renderer-AWWAF6XD.js +33 -0
  201. package/dist/renderer-BYCNMBF7.js +34 -0
  202. package/dist/renderer-CLJHQPBJ.js +29 -0
  203. package/dist/renderer-GHPZMFU2.js +15 -0
  204. package/dist/renderer-JGBKUCZD.js +16 -0
  205. package/dist/renderer-KQB7UGDS.js +19 -0
  206. package/dist/renderer-PGX2TKVS.js +24 -0
  207. package/dist/renderer-QIWVHWZO.js +15 -0
  208. package/dist/renderer-RPOA5YPZ.js +35 -0
  209. package/dist/renderer-SMIBCRVB.js +24 -0
  210. package/dist/renderer-T7YKC5VP.js +28 -0
  211. package/dist/renderer-TOCOVLHS.js +37 -0
  212. package/dist/renderer-UWA5XS74.js +39 -0
  213. package/dist/renderer-VACVQYML.js +25 -0
  214. package/dist/renderer-W4M6QLIJ.js +37 -0
  215. package/dist/renderer-WZRREQ2P.js +23 -0
  216. package/dist/renderer-YY2OSF6E.js +27 -0
  217. package/dist/renderer-Z7I3W2PP.js +24 -0
  218. package/dist/renderer-ZGNTUWC4.js +22 -0
  219. package/dist/renderer-ZTR3DER3.js +19 -0
  220. package/dist/renderer-radial-C32GPJQ7.js +21 -0
  221. package/dist/resolver-NOAA7ID7.js +13 -0
  222. package/dist/state-collapse-HCGD6IVJ.js +8 -0
  223. package/dist/state-parser-Z2V23ATR.js +18 -0
  224. package/dist/state-renderer-RFYHSP4K.js +34 -0
  225. package/dist/themes-1-CuKpeH.d.ts +908 -0
  226. package/package.json +19 -70
  227. package/dist/advanced.cjs +0 -71648
  228. package/dist/advanced.d.cts +0 -6571
  229. package/dist/auto.cjs +0 -70648
  230. package/dist/auto.d.cts +0 -54
  231. package/dist/block.cjs +0 -70208
  232. package/dist/block.d.cts +0 -115
  233. package/dist/editor.d.cts +0 -26
  234. package/dist/element.cjs +0 -70530
  235. package/dist/element.d.cts +0 -62
  236. package/dist/highlight.cjs +0 -852
  237. package/dist/highlight.d.cts +0 -49
  238. package/dist/index.cjs +0 -70491
  239. package/dist/index.d.cts +0 -626
  240. package/dist/pert.cjs +0 -325
  241. package/dist/pert.d.cts +0 -559
  242. package/src/advanced.ts +0 -873
  243. package/src/arc/parser.ts +0 -15
  244. package/src/arc/renderer.ts +0 -633
  245. package/src/auto/index.ts +0 -621
  246. package/src/auto/shared.ts +0 -370
  247. package/src/auto/styles.ts +0 -73
  248. package/src/block/layout.ts +0 -198
  249. package/src/block/renderer.ts +0 -484
  250. package/src/block/types.ts +0 -67
  251. package/src/boxes-and-lines/collapse.ts +0 -96
  252. package/src/boxes-and-lines/focus.ts +0 -257
  253. package/src/boxes-and-lines/label-placement.ts +0 -339
  254. package/src/boxes-and-lines/layout-grouped.ts +0 -912
  255. package/src/boxes-and-lines/layout-layered.ts +0 -722
  256. package/src/boxes-and-lines/layout-search.ts +0 -1678
  257. package/src/boxes-and-lines/layout.ts +0 -398
  258. package/src/boxes-and-lines/parser.ts +0 -1181
  259. package/src/boxes-and-lines/renderer.ts +0 -1465
  260. package/src/boxes-and-lines/types.ts +0 -66
  261. package/src/c4/parser.ts +0 -1158
  262. package/src/c4/renderer.ts +0 -2008
  263. package/src/c4/types.ts +0 -89
  264. package/src/chart-type-registry.ts +0 -529
  265. package/src/chart-types.ts +0 -225
  266. package/src/chart.ts +0 -685
  267. package/src/charts-d3/bar.ts +0 -338
  268. package/src/charts-d3/chord.ts +0 -140
  269. package/src/charts-d3/function.ts +0 -147
  270. package/src/charts-d3/funnel.ts +0 -104
  271. package/src/charts-d3/heatmap.ts +0 -145
  272. package/src/charts-d3/index.ts +0 -337
  273. package/src/charts-d3/interactions.ts +0 -477
  274. package/src/charts-d3/line.ts +0 -344
  275. package/src/charts-d3/mount.ts +0 -151
  276. package/src/charts-d3/pie.ts +0 -117
  277. package/src/charts-d3/polar.ts +0 -89
  278. package/src/charts-d3/radar.ts +0 -0
  279. package/src/charts-d3/sankey.ts +0 -0
  280. package/src/charts-d3/scatter.ts +0 -185
  281. package/src/charts-d3/shared.ts +0 -208
  282. package/src/class/layout.ts +0 -326
  283. package/src/class/parser.ts +0 -635
  284. package/src/class/renderer.ts +0 -793
  285. package/src/class/types.ts +0 -58
  286. package/src/cli-banner.ts +0 -106
  287. package/src/cli.ts +0 -1080
  288. package/src/colors-diagnostics.ts +0 -35
  289. package/src/colors.ts +0 -379
  290. package/src/completion-types.ts +0 -27
  291. package/src/completion.ts +0 -2668
  292. package/src/cycle/layout.ts +0 -1026
  293. package/src/cycle/parser.ts +0 -387
  294. package/src/cycle/renderer.ts +0 -653
  295. package/src/cycle/types.ts +0 -101
  296. package/src/d3.ts +0 -1434
  297. package/src/data-chart-parser.ts +0 -1007
  298. package/src/dgmo-router.ts +0 -296
  299. package/src/diagnostics-registry.ts +0 -108
  300. package/src/diagnostics.ts +0 -0
  301. package/src/dimensions.ts +0 -20
  302. package/src/directives-registry.ts +0 -396
  303. package/src/editor/dgmo.grammar +0 -76
  304. package/src/editor/dgmo.grammar.d.ts +0 -2
  305. package/src/editor/dgmo.grammar.js +0 -18
  306. package/src/editor/dgmo.grammar.terms.d.ts +0 -5
  307. package/src/editor/dgmo.grammar.terms.js +0 -35
  308. package/src/editor/highlight-api.ts +0 -596
  309. package/src/editor/highlight.ts +0 -36
  310. package/src/editor/index.ts +0 -27
  311. package/src/editor/keywords.ts +0 -128
  312. package/src/editor/tokens.ts +0 -30
  313. package/src/element/index.ts +0 -432
  314. package/src/embed/css.ts +0 -312
  315. package/src/embed/escape.ts +0 -15
  316. package/src/embed/index.ts +0 -280
  317. package/src/er/classify.ts +0 -228
  318. package/src/er/layout.ts +0 -530
  319. package/src/er/parser.ts +0 -750
  320. package/src/er/renderer.ts +0 -725
  321. package/src/er/types.ts +0 -52
  322. package/src/error-card.ts +0 -269
  323. package/src/event-line/diagnostics.ts +0 -117
  324. package/src/event-line/parser.ts +0 -643
  325. package/src/event-line/renderer.ts +0 -1742
  326. package/src/event-line/types.ts +0 -74
  327. package/src/fonts.ts +0 -3
  328. package/src/gantt/parser.ts +0 -1641
  329. package/src/gantt/renderer.ts +0 -3787
  330. package/src/gantt/resolver.ts +0 -172
  331. package/src/gantt/types.ts +0 -206
  332. package/src/graph/diagnostics.ts +0 -64
  333. package/src/graph/edge-spline.ts +0 -29
  334. package/src/graph/flowchart-parser.ts +0 -759
  335. package/src/graph/flowchart-renderer.ts +0 -817
  336. package/src/graph/layout.ts +0 -472
  337. package/src/graph/notes.ts +0 -21
  338. package/src/graph/state-collapse.ts +0 -78
  339. package/src/graph/state-parser.ts +0 -574
  340. package/src/graph/state-renderer.ts +0 -653
  341. package/src/graph/types.ts +0 -65
  342. package/src/index.ts +0 -261
  343. package/src/infra/compute.ts +0 -1385
  344. package/src/infra/layout.ts +0 -888
  345. package/src/infra/parser.ts +0 -1234
  346. package/src/infra/renderer.ts +0 -2534
  347. package/src/infra/roles.ts +0 -75
  348. package/src/infra/types.ts +0 -216
  349. package/src/infra/validation.ts +0 -201
  350. package/src/journey-map/layout.ts +0 -490
  351. package/src/journey-map/parser.ts +0 -557
  352. package/src/journey-map/renderer.ts +0 -1580
  353. package/src/journey-map/types.ts +0 -47
  354. package/src/kanban/mutations.ts +0 -175
  355. package/src/kanban/parser.ts +0 -509
  356. package/src/kanban/renderer.ts +0 -1449
  357. package/src/kanban/types.ts +0 -39
  358. package/src/label-layout.ts +0 -368
  359. package/src/map/colorize.ts +0 -54
  360. package/src/map/completion.ts +0 -316
  361. package/src/map/context-labels.ts +0 -609
  362. package/src/map/data/PROVENANCE.json +0 -1
  363. package/src/map/data/README.md +0 -40
  364. package/src/map/data/airport-collisions.json +0 -1
  365. package/src/map/data/airports.json +0 -1
  366. package/src/map/data/gazetteer.json +0 -1
  367. package/src/map/data/lakes.json +0 -1
  368. package/src/map/data/mountain-ranges.json +0 -1
  369. package/src/map/data/na-lakes.json +0 -1
  370. package/src/map/data/na-land.json +0 -1
  371. package/src/map/data/region-names.json +0 -1
  372. package/src/map/data/rivers.json +0 -1
  373. package/src/map/data/types.ts +0 -121
  374. package/src/map/data/us-states.json +0 -1
  375. package/src/map/data/water-bodies.json +0 -1
  376. package/src/map/data/world-coarse.json +0 -1
  377. package/src/map/data/world-detail.json +0 -1
  378. package/src/map/diagnostics.ts +0 -134
  379. package/src/map/dimensions.ts +0 -150
  380. package/src/map/geo-query.ts +0 -295
  381. package/src/map/geo.ts +0 -438
  382. package/src/map/invert.ts +0 -111
  383. package/src/map/layout.ts +0 -5069
  384. package/src/map/legend-band.ts +0 -127
  385. package/src/map/load-data.ts +0 -186
  386. package/src/map/parser.ts +0 -783
  387. package/src/map/renderer.ts +0 -1445
  388. package/src/map/resolved-types.ts +0 -160
  389. package/src/map/resolver.ts +0 -1146
  390. package/src/map/types.ts +0 -194
  391. package/src/mindmap/collapse.ts +0 -67
  392. package/src/mindmap/layout.ts +0 -649
  393. package/src/mindmap/parser.ts +0 -430
  394. package/src/mindmap/renderer.ts +0 -637
  395. package/src/mindmap/text-wrap.ts +0 -218
  396. package/src/mindmap/types.ts +0 -56
  397. package/src/org/collapse.ts +0 -151
  398. package/src/org/layout.ts +0 -1262
  399. package/src/org/parser.ts +0 -519
  400. package/src/org/renderer.ts +0 -866
  401. package/src/org/resolver.ts +0 -636
  402. package/src/palettes/atlas.ts +0 -77
  403. package/src/palettes/blueprint.ts +0 -73
  404. package/src/palettes/catppuccin.ts +0 -84
  405. package/src/palettes/color-utils.ts +0 -443
  406. package/src/palettes/index.ts +0 -67
  407. package/src/palettes/nord.ts +0 -67
  408. package/src/palettes/registry.ts +0 -114
  409. package/src/palettes/slate.ts +0 -73
  410. package/src/palettes/tidewater.ts +0 -73
  411. package/src/palettes/tokyo-night.ts +0 -86
  412. package/src/palettes/types.ts +0 -88
  413. package/src/pert/analyzer.ts +0 -1183
  414. package/src/pert/diagnostics.ts +0 -110
  415. package/src/pert/index.ts +0 -43
  416. package/src/pert/internal.ts +0 -252
  417. package/src/pert/layout.ts +0 -971
  418. package/src/pert/monte-carlo.ts +0 -446
  419. package/src/pert/parser.ts +0 -1606
  420. package/src/pert/renderer.ts +0 -4009
  421. package/src/pert/share-normalize.ts +0 -62
  422. package/src/pert/types.ts +0 -604
  423. package/src/pyramid/parser.ts +0 -185
  424. package/src/pyramid/renderer.ts +0 -768
  425. package/src/pyramid/types.ts +0 -28
  426. package/src/quadrant/parser.ts +0 -18
  427. package/src/quadrant/renderer.ts +0 -638
  428. package/src/raci/diagnostics.ts +0 -213
  429. package/src/raci/index.ts +0 -23
  430. package/src/raci/mutations.ts +0 -321
  431. package/src/raci/parser.ts +0 -699
  432. package/src/raci/renderer.ts +0 -1627
  433. package/src/raci/types.ts +0 -82
  434. package/src/raci/variants.ts +0 -320
  435. package/src/render.ts +0 -268
  436. package/src/ring/parser.ts +0 -212
  437. package/src/ring/renderer.ts +0 -490
  438. package/src/ring/types.ts +0 -27
  439. package/src/sequence/collapse.ts +0 -174
  440. package/src/sequence/parser.ts +0 -1596
  441. package/src/sequence/participant-inference.ts +0 -152
  442. package/src/sequence/renderer.ts +0 -3168
  443. package/src/sequence/tag-resolution.ts +0 -164
  444. package/src/sharing.ts +0 -211
  445. package/src/sitemap/collapse.ts +0 -100
  446. package/src/sitemap/layout.ts +0 -925
  447. package/src/sitemap/parser.ts +0 -755
  448. package/src/sitemap/renderer.ts +0 -828
  449. package/src/sitemap/types.ts +0 -42
  450. package/src/slope/parser.ts +0 -18
  451. package/src/slope/renderer.ts +0 -378
  452. package/src/swimlane/diagnostics.ts +0 -94
  453. package/src/swimlane/layout.ts +0 -597
  454. package/src/swimlane/parser.ts +0 -613
  455. package/src/swimlane/renderer.ts +0 -681
  456. package/src/swimlane/types.ts +0 -151
  457. package/src/tech-radar/interactive.ts +0 -1129
  458. package/src/tech-radar/layout.ts +0 -197
  459. package/src/tech-radar/parser.ts +0 -436
  460. package/src/tech-radar/renderer.ts +0 -1239
  461. package/src/tech-radar/shared.ts +0 -151
  462. package/src/tech-radar/types.ts +0 -86
  463. package/src/themes.ts +0 -22
  464. package/src/timeline/parser.ts +0 -472
  465. package/src/timeline/renderer.ts +0 -3024
  466. package/src/timeline/types.ts +0 -33
  467. package/src/timeline/viz-parser.ts +0 -21
  468. package/src/treemap/diagnostics.ts +0 -62
  469. package/src/treemap/layout-radial.ts +0 -233
  470. package/src/treemap/layout.ts +0 -189
  471. package/src/treemap/parser.ts +0 -463
  472. package/src/treemap/renderer-radial.ts +0 -438
  473. package/src/treemap/renderer.ts +0 -572
  474. package/src/treemap/treemap-shared.ts +0 -309
  475. package/src/treemap/types.ts +0 -60
  476. package/src/utils/arrow-markers.ts +0 -51
  477. package/src/utils/arrows-diagnostics.ts +0 -62
  478. package/src/utils/arrows.ts +0 -227
  479. package/src/utils/brand.ts +0 -61
  480. package/src/utils/card.ts +0 -183
  481. package/src/utils/collapse-engine/tree-edges.ts +0 -115
  482. package/src/utils/collapse-engine/tree.ts +0 -117
  483. package/src/utils/d3-helpers.ts +0 -219
  484. package/src/utils/d3-types.ts +0 -9
  485. package/src/utils/description-helpers.ts +0 -38
  486. package/src/utils/duration.ts +0 -312
  487. package/src/utils/export-container.ts +0 -41
  488. package/src/utils/expr-eval.ts +0 -27
  489. package/src/utils/fit-canvas.ts +0 -64
  490. package/src/utils/hover-styles.ts +0 -673
  491. package/src/utils/inline-markdown.ts +0 -96
  492. package/src/utils/legend-constants.ts +0 -48
  493. package/src/utils/legend-d3.ts +0 -618
  494. package/src/utils/legend-integration.ts +0 -107
  495. package/src/utils/legend-layout.ts +0 -776
  496. package/src/utils/legend-svg.ts +0 -214
  497. package/src/utils/legend-types.ts +0 -272
  498. package/src/utils/name-normalize.ts +0 -163
  499. package/src/utils/note-box/constants.ts +0 -25
  500. package/src/utils/note-box/index.ts +0 -11
  501. package/src/utils/note-box/metrics.ts +0 -90
  502. package/src/utils/note-box/svg.ts +0 -331
  503. package/src/utils/notes/bounds.ts +0 -30
  504. package/src/utils/notes/build.ts +0 -131
  505. package/src/utils/notes/index.ts +0 -18
  506. package/src/utils/notes/model.ts +0 -19
  507. package/src/utils/notes/parse.ts +0 -131
  508. package/src/utils/notes/place.ts +0 -177
  509. package/src/utils/notes/resolve.ts +0 -88
  510. package/src/utils/number-format.ts +0 -36
  511. package/src/utils/parsing.ts +0 -953
  512. package/src/utils/reserved-key-registry.ts +0 -239
  513. package/src/utils/safe-href.ts +0 -38
  514. package/src/utils/scaling.ts +0 -97
  515. package/src/utils/svg-embed.ts +0 -251
  516. package/src/utils/tag-groups.ts +0 -607
  517. package/src/utils/text-measure.ts +0 -122
  518. package/src/utils/title-constants.ts +0 -24
  519. package/src/utils/visual-conventions.ts +0 -61
  520. package/src/utils/wrapped-desc.ts +0 -87
  521. package/src/venn/parser.ts +0 -18
  522. package/src/venn/renderer.ts +0 -1047
  523. package/src/version-control/diagnostics.ts +0 -67
  524. package/src/version-control/parser.ts +0 -544
  525. package/src/version-control/renderer.ts +0 -724
  526. package/src/version-control/types.ts +0 -100
  527. package/src/visualizations/parse.ts +0 -1560
  528. package/src/visualizations/types.ts +0 -262
  529. package/src/wireframe/layout.ts +0 -479
  530. package/src/wireframe/parser.ts +0 -1114
  531. package/src/wireframe/renderer.ts +0 -1318
  532. package/src/wireframe/types.ts +0 -110
  533. package/src/wordcloud/parser.ts +0 -18
  534. package/src/wordcloud/renderer.ts +0 -357
@@ -1,1641 +0,0 @@
1
- // ============================================================
2
- // Gantt Chart Parser
3
- // ============================================================
4
-
5
- import { formatDgmoError, makeDgmoError } from '../diagnostics';
6
- import {
7
- GANTT_REGISTRY,
8
- withTagAliases,
9
- isReservedKey,
10
- } from '../utils/reserved-key-registry';
11
- import { splitNameAndMeta, warnUnknownMetaKeys } from '../utils/parsing';
12
- import { GANTT_OPTION_SET, GANTT_BOOLEAN_SET } from '../directives-registry';
13
- import type { DgmoError } from '../diagnostics';
14
- import type { TagGroup } from '../utils/tag-groups';
15
- import type { Writable } from '../utils/brand';
16
- import {
17
- matchTagBlockHeading,
18
- stripDefaultModifier,
19
- validateTagGroupNames,
20
- tagAttrKey,
21
- } from '../utils/tag-groups';
22
- import { measureIndent, extractColor, parseFirstLine } from '../utils/parsing';
23
- import {
24
- parseOffset,
25
- parseOffsetPrefix,
26
- parseDuration,
27
- } from '../utils/duration';
28
- import { normalizeName } from '../utils/name-normalize';
29
- import type { PaletteColors } from '../palettes';
30
- import { getSeriesColors } from '../palettes';
31
- import type {
32
- ParsedGantt,
33
- GanttNode,
34
- GanttTask,
35
- GanttGroup,
36
- GanttDependency,
37
- GanttParallelBlock,
38
- Duration,
39
- DurationUnit,
40
- Offset,
41
- Weekday,
42
- } from './types';
43
-
44
- // ── Regexes ─────────────────────────────────────────────────
45
-
46
- /** Group container: `[GroupName]` with optional pipe metadata */
47
- const GROUP_RE = /^\[(.+?)\]\s*(.*)$/;
48
-
49
- /** Dependency: `-> TargetName` or `-label-> TargetName` (label captured) */
50
- const DEPENDENCY_RE = /^(?:-(.+?))?->\s*(.+)$/;
51
-
52
- /** Comment line */
53
- const COMMENT_RE = /^\/\//;
54
-
55
- /** Era: `era YYYY[-MM[-DD[ HH:MM]]] -> YYYY[-MM[-DD[ HH:MM]]] Label (color?)` */
56
- const ERA_RE =
57
- /^era\s+(\d{4}(?:-\d{2}(?:-\d{2}(?: \d{2}:\d{2})?)?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2}(?:-\d{2}(?: \d{2}:\d{2})?)?)?)\s+(.+)$/i;
58
-
59
- /** Marker: `marker YYYY[-MM[-DD[ HH:MM]]] Label (color?)` */
60
- const MARKER_RE =
61
- /^marker\s+(\d{4}(?:-\d{2}(?:-\d{2}(?: \d{2}:\d{2})?)?)?)\s+(.+)$/i;
62
-
63
- /** Holiday date: `2024-01-15 Label` */
64
- const HOLIDAY_DATE_RE = /^(\d{4}-\d{2}-\d{2})\s+(.+)$/;
65
-
66
- /** Holiday range: `2024-12-24 -> 2024-12-31 Label` */
67
- const HOLIDAY_RANGE_RE =
68
- /^(\d{4}-\d{2}-\d{2})\s*(?:->|\u2013>)\s*(\d{4}-\d{2}-\d{2})\s+(.+)$/;
69
-
70
- /** Workweek override: `workweek sun-thu` */
71
- const WORKWEEK_RE = /^workweek\s+(.+)$/i;
72
-
73
- /** Era entry (inside era block, no `era` prefix): `YYYY[-MM[-DD[ HH:MM]]] -> YYYY[-MM[-DD[ HH:MM]]] Label` */
74
- const ERA_ENTRY_RE =
75
- /^(\d{4}(?:-\d{2}(?:-\d{2}(?: \d{2}:\d{2})?)?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2}(?:-\d{2}(?: \d{2}:\d{2})?)?)?)\s+(.+)$/;
76
-
77
- /** Marker entry (inside marker block, no `marker` prefix): `YYYY[-MM[-DD[ HH:MM]]] Label` */
78
- const MARKER_ENTRY_RE =
79
- /^(\d{4}(?:-\d{2}(?:-\d{2}(?: \d{2}:\d{2})?)?)?)\s+(.+)$/;
80
-
81
- // ── New-syntax regexes (v2: positional duration, arrow graph) ─
82
-
83
- /** Offset prefix at line start: `+4w Task...` or `+10bd [Group]` */
84
- const OFFSET_PREFIX_RE = /^\+(\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h|s))\s+(.*)/;
85
-
86
- /** Duration token (for right-to-left positional scan) */
87
- const DURATION_TOKEN_RE = /^(\d+(?:\.\d+)?)(min|bd|d|w|m|q|y|h|s)(\?)?$/;
88
-
89
- /** Arrow with lag: `-3w-> Rest` */
90
- const LAG_ARROW_RE = /^-(\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h|s))->\s*(.*)/;
91
-
92
- /** Arrow with lead (negative lag): `--2w-> Rest` */
93
- const LEAD_ARROW_RE = /^--(\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h|s))->\s*(.*)/;
94
-
95
- /** Basic arrow: `-> Rest` */
96
- const BASIC_ARROW_RE = /^->\s*(.*)/;
97
-
98
- /** Era with offset: `era +4w -> +8w Label [color]` */
99
- const ERA_OFFSET_RE =
100
- /^era\s+\+(\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h|s))\s*(?:->|–>)\s*\+(\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h|s))\s+(.+)$/i;
101
-
102
- /** Marker with offset: `marker +10w Label [color]` */
103
- const MARKER_OFFSET_RE =
104
- /^marker\s+\+(\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h|s))\s+(.+)$/i;
105
-
106
- // Valid weekday names
107
- const WEEKDAY_MAP: Record<string, Weekday> = {
108
- mon: 'mon',
109
- tue: 'tue',
110
- wed: 'wed',
111
- thu: 'thu',
112
- fri: 'fri',
113
- sat: 'sat',
114
- sun: 'sun',
115
- monday: 'mon',
116
- tuesday: 'tue',
117
- wednesday: 'wed',
118
- thursday: 'thu',
119
- friday: 'fri',
120
- saturday: 'sat',
121
- sunday: 'sun',
122
- };
123
-
124
- // ── Block Stack ─────────────────────────────────────────────
125
-
126
- type ContainerType = 'group' | 'parallel' | 'task';
127
-
128
- interface BlockEntry {
129
- node: Writable<GanttGroup> | Writable<GanttParallelBlock>;
130
- indent: number;
131
- containerType: ContainerType;
132
- taskRef?: Writable<GanttNode & { kind: 'task' }>;
133
- }
134
-
135
- // ── Parser ──────────────────────────────────────────────────
136
-
137
- export function parseGantt(
138
- content: string,
139
- palette?: PaletteColors
140
- ): ParsedGantt {
141
- const lines = content.split('\n');
142
- const diagnostics: DgmoError[] = [];
143
-
144
- const holidays: Writable<ParsedGantt['holidays']> = {
145
- dates: [],
146
- ranges: [],
147
- workweek: ['mon', 'tue', 'wed', 'thu', 'fri'],
148
- };
149
- const result: Writable<ParsedGantt> = {
150
- nodes: [],
151
- holidays,
152
- tagGroups: [],
153
- eras: [],
154
- markers: [],
155
- options: {
156
- start: null,
157
- title: null,
158
- titleLineNumber: null,
159
- todayMarker: 'off',
160
- criticalPath: false,
161
- dependencies: true,
162
- sort: 'default',
163
- defaultSwimlaneGroup: null,
164
- activeTag: null,
165
- optionLineNumbers: {},
166
- holidaysLineNumber: null,
167
- sprintLength: null,
168
- sprintNumber: null,
169
- sprintStart: null,
170
- sprintMode: null,
171
- solidFill: false,
172
- noTitle: false,
173
- },
174
- diagnostics,
175
- error: null,
176
- syntaxMode: 'new', // always new-mode at 1.0
177
- };
178
-
179
- // Bespoke (not the shared makeFail, Story 111.4): gantt accumulates into a
180
- // local `diagnostics` array, not `result.diagnostics`.
181
- const fail = (line: number, message: string): ParsedGantt => {
182
- const diag = makeDgmoError(line, message);
183
- diagnostics.push(diag);
184
- result.error = formatDgmoError(diag);
185
- return result;
186
- };
187
-
188
- const warn = (line: number, message: string): void => {
189
- diagnostics.push(makeDgmoError(line, message, 'warning'));
190
- };
191
-
192
- /** Red squiggly but parsing continues — line is wrong, rest of chart is fine */
193
- const softError = (line: number, message: string): void => {
194
- diagnostics.push(makeDgmoError(line, message, 'error'));
195
- };
196
-
197
- // ── Alias map for pipe metadata (per A1 convention) ─────
198
-
199
- const metaAliasMap = new Map<string, string>();
200
- // ── nameAliasMap: TD-18 entity-name aliases (per C8) ────
201
- const nameAliasMap = new Map<string, string>();
202
- function peelAlias(label: string): { label: string; alias?: string } {
203
- const trimmed = label.trim();
204
- const m = trimmed.match(/^(.*?)\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11})\s*$/);
205
- if (!m) return { label: trimmed };
206
- // Capture groups 1 and 2 are guaranteed by successful regex match.
207
- return { label: m[1]!.trim(), alias: m[2]! };
208
- }
209
- function resolveAliasTarget(token: string): string {
210
- return nameAliasMap.get(token.trim()) ?? token;
211
- }
212
-
213
- // ── Block stack ─────────────────────────────────────────
214
-
215
- const blockStack: BlockEntry[] = [];
216
-
217
- const currentContainer = (): GanttNode[] => {
218
- // Walk down from the top of the stack to find the nearest
219
- // group/parallel container. Skip task entries — tasks don't
220
- // contain other tasks in the tree (deps are via arrows, not nesting).
221
- for (let k = blockStack.length - 1; k >= 0; k--) {
222
- if (blockStack[k]!.containerType !== 'task') {
223
- return blockStack[k]!.node.children;
224
- }
225
- }
226
- return result.nodes;
227
- };
228
-
229
- const currentGroupPath = (): string[] => {
230
- const path: string[] = [];
231
- for (const entry of blockStack) {
232
- if (entry.containerType === 'group') {
233
- path.push((entry.node as GanttGroup).name);
234
- }
235
- }
236
- return path;
237
- };
238
-
239
- // ── State ───────────────────────────────────────────────
240
-
241
- let seenChartType = false;
242
- let inHolidaysBlock = false;
243
- let holidaysBlockIndent = 0;
244
- let inTagBlock = false;
245
- let currentTagGroup: Writable<TagGroup> | null = null;
246
- let tagBlockIndent = 0;
247
- let inEraBlock = false;
248
- let eraBlockIndent = 0;
249
- let inMarkerBlock = false;
250
- let markerBlockIndent = 0;
251
- let lastTaskNode: Writable<GanttNode & { kind: 'task' }> | null = null;
252
- let taskIdCounter = 0;
253
- const seriesColors = palette ? getSeriesColors(palette) : [];
254
- // 1.0: parser is always new-mode; legacy scheduling forms were removed.
255
- const syntaxMode = 'new' as const;
256
- result.syntaxMode = syntaxMode;
257
- // const definedTaskNames = new Map<string, string>(); // normalized name → scope key (Phase 6 diagnostics)
258
-
259
- // ── Main Parse Loop ─────────────────────────────────────
260
-
261
- for (let i = 0; i < lines.length; i++) {
262
- // In-bounds by loop guard.
263
- const rawLine = lines[i]!;
264
- const line = rawLine.trim();
265
- const indent = measureIndent(rawLine);
266
- const lineNumber = i + 1;
267
-
268
- // Skip empty lines
269
- if (!line) {
270
- // Empty line ends holidays/tag/era/marker blocks only if at root indent
271
- if (inHolidaysBlock && indent <= holidaysBlockIndent) {
272
- inHolidaysBlock = false;
273
- }
274
- if (inEraBlock && indent <= eraBlockIndent) {
275
- inEraBlock = false;
276
- }
277
- if (inMarkerBlock && indent <= markerBlockIndent) {
278
- inMarkerBlock = false;
279
- }
280
- if (inTagBlock && indent <= tagBlockIndent) {
281
- inTagBlock = false;
282
- if (currentTagGroup) {
283
- result.tagGroups.push(currentTagGroup);
284
- currentTagGroup = null;
285
- }
286
- }
287
- continue;
288
- }
289
-
290
- // ── Chart type ────────────────────────────────────────
291
-
292
- if (!seenChartType) {
293
- const firstLineResult = parseFirstLine(line);
294
- if (firstLineResult) {
295
- if (firstLineResult.chartType !== 'gantt') {
296
- return fail(
297
- lineNumber,
298
- `Expected chart type "gantt", got "${firstLineResult.chartType}"`
299
- );
300
- }
301
- seenChartType = true;
302
- if (firstLineResult.title) {
303
- result.options.title = firstLineResult.title;
304
- result.options.titleLineNumber = lineNumber;
305
- }
306
- continue;
307
- }
308
- }
309
-
310
- // ── Holidays block ────────────────────────────────────
311
-
312
- if (inHolidaysBlock) {
313
- if (indent <= holidaysBlockIndent) {
314
- inHolidaysBlock = false;
315
- // fall through to process this line normally
316
- } else {
317
- // Parse holiday entries
318
- const rangeMatch = line.match(HOLIDAY_RANGE_RE);
319
- if (rangeMatch) {
320
- // Capture groups 1-3 guaranteed by successful regex match.
321
- holidays.ranges.push({
322
- startDate: rangeMatch[1]!,
323
- endDate: rangeMatch[2]!,
324
- label: rangeMatch[3]!.trim(),
325
- lineNumber,
326
- });
327
- continue;
328
- }
329
-
330
- const dateMatch = line.match(HOLIDAY_DATE_RE);
331
- if (dateMatch) {
332
- // Capture groups 1-2 guaranteed by successful regex match.
333
- holidays.dates.push({
334
- date: dateMatch[1]!,
335
- label: dateMatch[2]!.trim(),
336
- lineNumber,
337
- });
338
- continue;
339
- }
340
-
341
- const workweekMatch = line.match(WORKWEEK_RE);
342
- if (workweekMatch) {
343
- // Capture group 1 guaranteed by successful regex match.
344
- const days = parseWorkweek(workweekMatch[1]!.trim());
345
- if (days) {
346
- holidays.workweek = days;
347
- } else {
348
- warn(
349
- lineNumber,
350
- `Invalid workweek format: "${workweekMatch[1]}". Use day range like "sun-thu" or comma-separated days.`
351
- );
352
- }
353
- continue;
354
- }
355
-
356
- // Skip comments inside holidays
357
- if (COMMENT_RE.test(line)) continue;
358
-
359
- warn(
360
- lineNumber,
361
- `Unrecognized holiday entry: "${line}". Use a date '2024-02-19 Presidents Day' or a range '2024-05-27 -> 2024-05-29 Memorial Weekend'. (§13.3)`
362
- );
363
- continue;
364
- }
365
- }
366
-
367
- // ── Era block entries ─────────────────────────────────
368
-
369
- if (inEraBlock) {
370
- if (indent <= eraBlockIndent) {
371
- inEraBlock = false;
372
- // fall through to process this line normally
373
- } else {
374
- if (COMMENT_RE.test(line)) continue;
375
- const eraEntryMatch = line.match(ERA_ENTRY_RE);
376
- if (eraEntryMatch) {
377
- // Capture groups 1-3 guaranteed by successful regex match.
378
- const eraLabelRaw = eraEntryMatch[3]!.trim();
379
- const eraExtracted = extractColor(
380
- eraLabelRaw,
381
- palette,
382
- diagnostics,
383
- lineNumber
384
- );
385
- result.eras.push({
386
- startDate: eraEntryMatch[1]!,
387
- endDate: eraEntryMatch[2]!,
388
- label: eraExtracted.label,
389
- color: eraExtracted.color || null,
390
- lineNumber,
391
- });
392
- } else {
393
- warn(
394
- lineNumber,
395
- `Unrecognized era entry: "${line}". Use 'YYYY-MM-DD -> YYYY-MM-DD Label [color]' (e.g. '2026-04-06 -> 2026-04-10 Conference purple'). (§13.5)`
396
- );
397
- }
398
- continue;
399
- }
400
- }
401
-
402
- // ── Marker block entries ─────────────────────────────
403
-
404
- if (inMarkerBlock) {
405
- if (indent <= markerBlockIndent) {
406
- inMarkerBlock = false;
407
- // fall through to process this line normally
408
- } else {
409
- if (COMMENT_RE.test(line)) continue;
410
- const markerEntryMatch = line.match(MARKER_ENTRY_RE);
411
- if (markerEntryMatch) {
412
- // Capture groups 1-2 guaranteed by successful regex match.
413
- const markerLabelRaw = markerEntryMatch[2]!.trim();
414
- const markerExtracted = extractColor(
415
- markerLabelRaw,
416
- palette,
417
- diagnostics,
418
- lineNumber
419
- );
420
- result.markers.push({
421
- date: markerEntryMatch[1]!,
422
- label: markerExtracted.label,
423
- color: markerExtracted.color || null,
424
- lineNumber,
425
- });
426
- } else {
427
- warn(
428
- lineNumber,
429
- `Unrecognized marker entry: "${line}". Use 'YYYY-MM-DD Label [color]' (e.g. '2026-03-27 Board Review' or '2026-06-15 Release green'). (§13.6)`
430
- );
431
- }
432
- continue;
433
- }
434
- }
435
-
436
- // ── Tag block entries ─────────────────────────────────
437
-
438
- if (inTagBlock && currentTagGroup) {
439
- if (indent <= tagBlockIndent) {
440
- // End of tag block
441
- inTagBlock = false;
442
- result.tagGroups.push(currentTagGroup);
443
- currentTagGroup = null;
444
- // fall through to process this line normally
445
- } else {
446
- // Parse tag entry: `Value color` or `Value`
447
- // First entry is the default unless another is marked `default`
448
- if (COMMENT_RE.test(line)) continue;
449
- const { text: cleanEntry, isDefault } = stripDefaultModifier(line);
450
- const extracted = extractColor(
451
- cleanEntry,
452
- palette,
453
- diagnostics,
454
- lineNumber
455
- );
456
- const color =
457
- extracted.color ||
458
- seriesColors[currentTagGroup.entries.length % seriesColors.length] ||
459
- '#888888';
460
- const isFirstEntry = currentTagGroup.entries.length === 0;
461
- currentTagGroup.entries.push({
462
- value: extracted.label,
463
- color,
464
- lineNumber,
465
- });
466
- if (isDefault) {
467
- currentTagGroup.defaultValue = extracted.label;
468
- } else if (isFirstEntry) {
469
- currentTagGroup.defaultValue = extracted.label;
470
- }
471
- continue;
472
- }
473
- }
474
-
475
- // ── Close blocks when indent decreases ────────────────
476
- // CRITICAL: close blocks BEFORE matching new elements
477
-
478
- // Track pop depth for sequential vs parallel arrow semantics.
479
- // Consecutive same-indent arrows = sequential chain.
480
- // Returning from a deeper subtree = parallel branch from parent.
481
- {
482
- let hadDeeperPop = false;
483
- let lastPoppedTaskRef: typeof lastTaskNode = null;
484
-
485
- while (blockStack.length > 0) {
486
- const top = blockStack[blockStack.length - 1]!;
487
- if (indent <= top.indent) {
488
- if (top.indent > indent) hadDeeperPop = true;
489
- if (top.containerType === 'task' && top.taskRef) {
490
- lastPoppedTaskRef = top.taskRef;
491
- }
492
- blockStack.pop();
493
- } else {
494
- break;
495
- }
496
- }
497
-
498
- if (hadDeeperPop) {
499
- // Came back from deeper subtree → parallel from parent
500
- for (let k = blockStack.length - 1; k >= 0; k--) {
501
- if (
502
- blockStack[k]!.containerType === 'task' &&
503
- blockStack[k]!.taskRef
504
- ) {
505
- lastTaskNode = blockStack[k]!.taskRef!;
506
- break;
507
- }
508
- }
509
- if (
510
- blockStack.length === 0 ||
511
- !blockStack.some((e) => e.containerType === 'task')
512
- ) {
513
- lastTaskNode = null;
514
- }
515
- } else if (lastPoppedTaskRef) {
516
- // Same-indent pop only → sequential from popped sibling
517
- lastTaskNode = lastPoppedTaskRef;
518
- }
519
- // If nothing was popped, lastTaskNode stays the same
520
- }
521
-
522
- // ── NEW-MODE: arrow / task / group / metadata parsing ──
523
-
524
- if (syntaxMode === 'new') {
525
- // 1. Arrow lines: `->`, `-3w->`, `--2w->`, `-label-> Target`
526
- const arrowResult = matchArrowLine(line);
527
- if (arrowResult) {
528
- // Parse remainder as task content (name + optional duration +
529
- // metadata).
530
- const content = parseNewTaskContent(arrowResult.rest, lineNumber);
531
-
532
- if (content.duration || content.explicitStart) {
533
- // Definition + dependency: create task AND edge
534
- const task = makeTask(
535
- content.name,
536
- content.duration,
537
- content.uncertain,
538
- lineNumber,
539
- content.explicitStart,
540
- content.preExtracted
541
- );
542
- const taskNode: GanttNode = { kind: 'task', ...task };
543
-
544
- // Add dependency ON lastTaskNode pointing TO the new task.
545
- // Convention: task.dependencies[].targetName = "the task that starts after this task finishes"
546
- if (lastTaskNode) {
547
- (lastTaskNode.dependencies as GanttDependency[]).push({
548
- targetName: content.name,
549
- ...(arrowResult.label !== undefined && {
550
- label: arrowResult.label,
551
- }),
552
- ...(arrowResult.lag !== undefined && { offset: arrowResult.lag }),
553
- lineNumber,
554
- });
555
- }
556
-
557
- currentContainer().push(taskNode);
558
- const writableTask = taskNode as Writable<
559
- GanttNode & { kind: 'task' }
560
- >;
561
- lastTaskNode = writableTask;
562
- blockStack.push({
563
- node: taskNode as unknown as Writable<GanttGroup>,
564
- indent,
565
- containerType: 'task',
566
- taskRef: writableTask,
567
- });
568
- } else {
569
- // Reference only: dependency edge from lastTaskNode to target.
570
- // The target body may carry offset metadata in the §1.4
571
- // (`Target offset: 2bd`) form.
572
- if (lastTaskNode) {
573
- const depBody = arrowResult.rest;
574
- let targetSegment: string;
575
- let meta: Record<string, string>;
576
- {
577
- const depRegistry = withTagAliases(
578
- GANTT_REGISTRY,
579
- new Set(metaAliasMap.keys())
580
- );
581
- const split = splitNameAndMeta(
582
- depBody.trim(),
583
- depRegistry,
584
- metaAliasMap
585
- );
586
- warnUnknownMetaKeys(
587
- split.meta,
588
- depRegistry,
589
- (msg) => warn(lineNumber, msg),
590
- split.name
591
- );
592
- targetSegment = split.name;
593
- meta = split.meta;
594
- }
595
- const targetName = resolveAliasTarget(targetSegment);
596
- let offset: Offset | undefined = arrowResult.lag;
597
-
598
- if (meta['lag'] || meta['lead']) {
599
- const key = meta['lag'] ? 'lag' : 'lead';
600
- softError(
601
- lineNumber,
602
- `"${key}" is no longer supported — use "offset: ${meta[key]}" instead.${key === 'lead' ? ' Negate the value for lead behavior: "offset: -...".' : ''}`
603
- );
604
- }
605
- if (meta['offset']) {
606
- const raw = meta['offset'];
607
- if (raw.trim().startsWith('+')) {
608
- warn(
609
- lineNumber,
610
- `Invalid offset: "${raw}". Explicit "+" is not supported — use "${raw.trim().slice(1)}" instead.`
611
- );
612
- } else {
613
- offset = parseOffset(raw) ?? undefined;
614
- if (!offset) {
615
- warn(
616
- lineNumber,
617
- `Invalid offset: "${raw}". Expected format like "3bd", "-5d", or "0bd".`
618
- );
619
- }
620
- }
621
- }
622
-
623
- (lastTaskNode.dependencies as GanttDependency[]).push({
624
- targetName,
625
- ...(arrowResult.label !== undefined && {
626
- label: arrowResult.label,
627
- }),
628
- ...(offset !== undefined && { offset }),
629
- lineNumber,
630
- });
631
- } else {
632
- softError(
633
- lineNumber,
634
- `Arrow '-> ${content.name}' has no source task — indent it under the task it follows (e.g. 'Design 5bd' then indented '-> ${content.name} 3bd'). (§13)`
635
- );
636
- }
637
- }
638
- continue;
639
- }
640
-
641
- // 2. Scope-based metadata: indented `key: value` under a task
642
- if (indent > 0 && lastTaskNode) {
643
- const colonIdx = line.indexOf(':');
644
- if (colonIdx > 0) {
645
- const candidateKey = line.substring(0, colonIdx).trim().toLowerCase();
646
- const registry = withTagAliases(
647
- GANTT_REGISTRY,
648
- new Set(metaAliasMap.keys())
649
- );
650
- const resolvedKey =
651
- metaAliasMap.get(normalizeName(candidateKey)) ?? candidateKey;
652
- if (isReservedKey(registry, resolvedKey)) {
653
- const value = line.substring(colonIdx + 1).trim();
654
- // Attach to the owning task (walk up block stack)
655
- const ownerTask =
656
- findOwningTask(blockStack, indent) ?? lastTaskNode;
657
- if (ownerTask) {
658
- const mutableMeta = ownerTask.metadata as Record<string, string>;
659
- if (resolvedKey === 'progress') {
660
- const p = parseFloat(value);
661
- if (!Number.isNaN(p)) {
662
- (ownerTask as Writable<GanttTask>).progress = p;
663
- }
664
- } else if (resolvedKey === 'offset') {
665
- const off = parseOffsetPrefix(value) ?? parseOffset(value);
666
- if (off) (ownerTask as Writable<GanttTask>).offset = off;
667
- } else {
668
- mutableMeta[resolvedKey] = value;
669
- }
670
- }
671
- continue;
672
- }
673
- }
674
- }
675
-
676
- // 3. Comment under a task
677
- if (lastTaskNode && indent > 0 && COMMENT_RE.test(line)) {
678
- const commentText = line.replace(/^\/\/\s?/, '');
679
- lastTaskNode.comment = lastTaskNode.comment
680
- ? lastTaskNode.comment + '\n' + commentText
681
- : commentText;
682
- continue;
683
- }
684
-
685
- // 4. Top-level comment
686
- if (COMMENT_RE.test(line)) continue;
687
-
688
- // 5. Skip to shared header options (holidays, tags, eras, markers, options)
689
- // These are handled below in the shared section. Fall through to them.
690
- // But first check for: era/marker with offsets, offset+group, offset+task, group, positional task
691
-
692
- // 6. Era with offset: `era +4w -> +8w Label [color]`
693
- const eraOffsetMatch = line.match(ERA_OFFSET_RE);
694
- if (eraOffsetMatch) {
695
- const startOff = parseOffsetPrefix('+' + eraOffsetMatch[1]!);
696
- const endOff = parseOffsetPrefix('+' + eraOffsetMatch[2]!);
697
- const eraLabelRaw = eraOffsetMatch[3]!.trim();
698
- const eraExtracted = extractColor(
699
- eraLabelRaw,
700
- palette,
701
- diagnostics,
702
- lineNumber
703
- );
704
- result.eras.push({
705
- startDate: '',
706
- endDate: '',
707
- label: eraExtracted.label,
708
- color: eraExtracted.color || null,
709
- lineNumber,
710
- ...(startOff && { offsetStart: startOff }),
711
- ...(endOff && { offsetEnd: endOff }),
712
- });
713
- continue;
714
- }
715
-
716
- // 7. Marker with offset: `marker +10w Label [color]`
717
- const markerOffsetMatch = line.match(MARKER_OFFSET_RE);
718
- if (markerOffsetMatch) {
719
- const dateOff = parseOffsetPrefix('+' + markerOffsetMatch[1]!);
720
- const markerLabelRaw = markerOffsetMatch[2]!.trim();
721
- const markerExtracted = extractColor(
722
- markerLabelRaw,
723
- palette,
724
- diagnostics,
725
- lineNumber
726
- );
727
- result.markers.push({
728
- date: '',
729
- label: markerExtracted.label,
730
- color: markerExtracted.color || null,
731
- lineNumber,
732
- ...(dateOff && { offsetDate: dateOff }),
733
- });
734
- continue;
735
- }
736
-
737
- // Fall through to shared sections (holidays, tags, date-based eras/markers,
738
- // options). They will continue if matched. If nothing matches, we reach
739
- // the new-mode task/group section below (after shared options).
740
- }
741
-
742
- // ── Top-level comment ─────────────────────────────────
743
-
744
- if (COMMENT_RE.test(line)) continue;
745
-
746
- // ── Header options ────────────────────────────────────
747
-
748
- if (line.toLowerCase() === 'holiday' || line.toLowerCase() === 'holidays') {
749
- inHolidaysBlock = true;
750
- holidaysBlockIndent = indent;
751
- result.options.holidaysLineNumber = lineNumber;
752
- continue;
753
- }
754
-
755
- // Single-line holiday: `holiday 2024-12-25 Christmas`
756
- const holidayInlineMatch = line.match(
757
- /^holiday\s+(\d{4}-\d{2}-\d{2})\s+(.+)$/i
758
- );
759
- if (holidayInlineMatch) {
760
- // Capture groups 1-2 guaranteed by successful regex match.
761
- holidays.dates.push({
762
- date: holidayInlineMatch[1]!,
763
- label: holidayInlineMatch[2]!.trim(),
764
- lineNumber,
765
- });
766
- result.options.holidaysLineNumber ??= lineNumber;
767
- continue;
768
- }
769
-
770
- // Tag block heading
771
- const tagMatch = matchTagBlockHeading(line);
772
- if (tagMatch) {
773
- inTagBlock = true;
774
- tagBlockIndent = indent;
775
- currentTagGroup = {
776
- name: tagMatch.name,
777
- ...(tagMatch.alias !== undefined && { alias: tagMatch.alias }),
778
- entries: [],
779
- lineNumber,
780
- };
781
- if (tagMatch.alias) {
782
- metaAliasMap.set(
783
- normalizeName(tagMatch.alias),
784
- tagAttrKey(tagMatch.name)
785
- );
786
- }
787
- metaAliasMap.set(normalizeName(tagMatch.name), tagAttrKey(tagMatch.name));
788
- continue;
789
- }
790
-
791
- // Top-level workweek (outside holiday block)
792
- const topWorkweekMatch = line.match(WORKWEEK_RE);
793
- if (topWorkweekMatch) {
794
- // Capture group 1 guaranteed by successful regex match.
795
- const days = parseWorkweek(topWorkweekMatch[1]!.trim());
796
- if (days) {
797
- holidays.workweek = days;
798
- } else {
799
- warn(
800
- lineNumber,
801
- `Invalid workweek format: "${topWorkweekMatch[1]}". Use day range like "sun-thu" or comma-separated days.`
802
- );
803
- }
804
- continue;
805
- }
806
-
807
- // Era block: bare `era` keyword starts a block
808
- if (line.toLowerCase() === 'era') {
809
- inEraBlock = true;
810
- eraBlockIndent = indent;
811
- continue;
812
- }
813
-
814
- // Era (inline)
815
- const eraMatch = line.match(ERA_RE);
816
- if (eraMatch) {
817
- // Capture groups 1-3 guaranteed by successful regex match.
818
- const eraLabelRaw = eraMatch[3]!.trim();
819
- const eraExtracted = extractColor(
820
- eraLabelRaw,
821
- palette,
822
- diagnostics,
823
- lineNumber
824
- );
825
- result.eras.push({
826
- startDate: eraMatch[1]!,
827
- endDate: eraMatch[2]!,
828
- label: eraExtracted.label,
829
- color: eraExtracted.color || null,
830
- lineNumber,
831
- });
832
- continue;
833
- }
834
-
835
- // Marker block: bare `marker` keyword starts a block
836
- if (line.toLowerCase() === 'marker') {
837
- inMarkerBlock = true;
838
- markerBlockIndent = indent;
839
- continue;
840
- }
841
-
842
- // Marker (inline)
843
- const markerMatch = line.match(MARKER_RE);
844
- if (markerMatch) {
845
- // Capture groups 1-2 guaranteed by successful regex match.
846
- const markerLabelRaw = markerMatch[2]!.trim();
847
- const markerExtracted = extractColor(
848
- markerLabelRaw,
849
- palette,
850
- diagnostics,
851
- lineNumber
852
- );
853
- result.markers.push({
854
- date: markerMatch[1]!,
855
- label: markerExtracted.label,
856
- color: markerExtracted.color || null,
857
- lineNumber,
858
- });
859
- continue;
860
- }
861
-
862
- // ── New-syntax task: `Name duration: Xd` or `Name start: DATE` ─
863
- {
864
- const registry = withTagAliases(
865
- GANTT_REGISTRY,
866
- new Set(metaAliasMap.keys())
867
- );
868
- const split = splitNameAndMeta(
869
- line,
870
- registry,
871
- metaAliasMap,
872
- undefined,
873
- diagnostics,
874
- lineNumber
875
- );
876
- warnUnknownMetaKeys(
877
- split.meta,
878
- registry,
879
- (msg) => warn(lineNumber, msg),
880
- split.name
881
- );
882
- const rawDur = split.meta['duration'];
883
- const rawStart = split.meta['start'];
884
-
885
- if (rawDur !== undefined || rawStart !== undefined) {
886
- let duration: Duration | null = null;
887
- let uncertain = false;
888
-
889
- if (rawDur !== undefined) {
890
- const uncertainMatch = rawDur.match(/^(.+)\?$/);
891
- const durStr = uncertainMatch ? uncertainMatch[1]! : rawDur;
892
- if (uncertainMatch) uncertain = true;
893
- duration = parseDuration(durStr);
894
- if (!duration) {
895
- softError(
896
- lineNumber,
897
- `Invalid duration: "${rawDur}". Expected format like "30bd", "5d", "1.5w".`
898
- );
899
- continue;
900
- }
901
- }
902
-
903
- let explicitStart: string | undefined;
904
- if (rawStart !== undefined) {
905
- if (!/^\d{4}-\d{2}-\d{2}(?: \d{2}:\d{2})?$/.test(rawStart)) {
906
- softError(
907
- lineNumber,
908
- `Invalid start date: "${rawStart}". Expected YYYY-MM-DD or YYYY-MM-DD HH:MM.`
909
- );
910
- continue;
911
- }
912
- explicitStart = rawStart;
913
- }
914
-
915
- const taskName = split.name.trim();
916
- if (!taskName) {
917
- softError(lineNumber, `Task name cannot be empty.`);
918
- continue;
919
- }
920
-
921
- if (split.alias) nameAliasMap.set(split.alias, taskName);
922
-
923
- const preExtracted = { ...split.meta };
924
- delete preExtracted['duration'];
925
- delete preExtracted['start'];
926
- if (split.color) preExtracted['color'] = split.color;
927
-
928
- const task = makeTask(
929
- taskName,
930
- duration,
931
- uncertain,
932
- lineNumber,
933
- explicitStart,
934
- preExtracted
935
- );
936
- const taskNode: GanttNode = { kind: 'task', ...task };
937
- currentContainer().push(taskNode);
938
- const writableTaskN = taskNode as Writable<
939
- GanttNode & { kind: 'task' }
940
- >;
941
- lastTaskNode = writableTaskN;
942
- blockStack.push({
943
- node: taskNode as unknown as Writable<GanttGroup>,
944
- indent,
945
- containerType: 'task',
946
- taskRef: writableTaskN,
947
- });
948
- continue;
949
- }
950
- }
951
-
952
- // Options — space-separated: `start 2024-04-01`, `title My Plan`
953
- // Boolean options: bare keyword = on, `no-X` = off
954
- const optNoColonMatch = line.match(/^([a-z][a-z0-9-]*)\s+(.+)$/i);
955
- const bareKeyword = line.match(/^([a-z][a-z0-9-]*)$/i);
956
-
957
- // Bare boolean keywords
958
- // Capture group 1 guaranteed by successful regex match.
959
- if (bareKeyword && KNOWN_BOOLEANS.has(bareKeyword[1]!.toLowerCase())) {
960
- const key = bareKeyword[1]!.toLowerCase();
961
- result.options.optionLineNumbers[key] = lineNumber;
962
- switch (key) {
963
- case 'critical-path':
964
- result.options.criticalPath = true;
965
- break;
966
- case 'today-marker':
967
- result.options.todayMarker = 'on';
968
- break;
969
- case 'solid-fill':
970
- result.options.solidFill = true;
971
- break;
972
- case 'no-title':
973
- result.options.noTitle = true;
974
- break;
975
- }
976
- continue;
977
- }
978
-
979
- // Negated booleans: `no-dependencies`, `no-critical-path`
980
- // Capture group 1 guaranteed by successful regex match.
981
- if (bareKeyword && bareKeyword[1]!.toLowerCase().startsWith('no-')) {
982
- const base = bareKeyword[1]!.toLowerCase().substring(3);
983
- if (KNOWN_BOOLEANS.has(base)) {
984
- result.options.optionLineNumbers[base] = lineNumber;
985
- switch (base) {
986
- case 'dependencies':
987
- result.options.dependencies = false;
988
- break;
989
- case 'critical-path':
990
- result.options.criticalPath = false;
991
- break;
992
- case 'today-marker':
993
- result.options.todayMarker = 'off';
994
- break;
995
- }
996
- continue;
997
- }
998
- }
999
-
1000
- // Capture groups 1-2 guaranteed by successful regex match.
1001
- if (optNoColonMatch && isKnownOption(optNoColonMatch[1]!.toLowerCase())) {
1002
- const key = optNoColonMatch[1]!.toLowerCase();
1003
- const value = optNoColonMatch[2]!.trim();
1004
- result.options.optionLineNumbers[key] = lineNumber;
1005
-
1006
- switch (key) {
1007
- case 'start':
1008
- result.options.start = value;
1009
- break;
1010
- case 'title':
1011
- result.options.title = value;
1012
- result.options.titleLineNumber = lineNumber;
1013
- break;
1014
- case 'today-marker':
1015
- if (/^\d{4}-\d{2}-\d{2}(?: \d{2}:\d{2})?$/.test(value)) {
1016
- result.options.todayMarker = value;
1017
- } else {
1018
- warn(
1019
- lineNumber,
1020
- `Invalid today-marker value: "${value}". Expected YYYY-MM-DD.`
1021
- );
1022
- }
1023
- break;
1024
- case 'critical-path':
1025
- result.options.criticalPath = true;
1026
- break;
1027
- case 'dependencies':
1028
- // Boolean with value — but `dependencies` is now default ON, so only `no-dependencies` turns it off
1029
- result.options.dependencies = true;
1030
- break;
1031
- case 'sort':
1032
- if (value === 'tag' || value.startsWith('tag:')) {
1033
- result.options.sort = 'tag';
1034
- const colonIdx = value.indexOf(':');
1035
- if (colonIdx !== -1) {
1036
- result.options.defaultSwimlaneGroup =
1037
- value.slice(colonIdx + 1).trim() || null;
1038
- }
1039
- } else {
1040
- warn(
1041
- lineNumber,
1042
- `Invalid sort value: "${value}". Expected "tag" or "tag:GroupName".`
1043
- );
1044
- }
1045
- break;
1046
- // `lane-by <group>`: the canonical swimlane-axis directive (view-state).
1047
- // Equivalent to `sort: tag:<group>` — enables tag swimlanes on the named
1048
- // group. `sort tag` remains a back-compat spelling.
1049
- case 'lane-by':
1050
- result.options.sort = 'tag';
1051
- result.options.defaultSwimlaneGroup = value.trim() || null;
1052
- break;
1053
- case 'active-tag':
1054
- result.options.activeTag = value;
1055
- break;
1056
- case 'sprint-length': {
1057
- const dur = parseDuration(value);
1058
- if (!dur) {
1059
- warn(
1060
- lineNumber,
1061
- `Invalid sprint-length value: "${value}". Expected a duration like "2w" or "10d".`
1062
- );
1063
- } else if (dur.unit !== 'd' && dur.unit !== 'w') {
1064
- warn(
1065
- lineNumber,
1066
- `sprint-length only accepts "d" or "w" units, got "${dur.unit}".`
1067
- );
1068
- } else if (dur.amount <= 0) {
1069
- warn(lineNumber, `sprint-length must be greater than 0.`);
1070
- } else if (
1071
- !Number.isInteger(dur.amount * (dur.unit === 'w' ? 7 : 1))
1072
- ) {
1073
- warn(
1074
- lineNumber,
1075
- `sprint-length must resolve to a whole number of days.`
1076
- );
1077
- } else {
1078
- result.options.sprintLength = dur;
1079
- }
1080
- break;
1081
- }
1082
- case 'sprint-number': {
1083
- const n = Number(value);
1084
- if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) {
1085
- warn(
1086
- lineNumber,
1087
- `sprint-number must be a positive integer, got "${value}".`
1088
- );
1089
- } else {
1090
- result.options.sprintNumber = n;
1091
- }
1092
- break;
1093
- }
1094
- case 'sprint-start': {
1095
- if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
1096
- warn(
1097
- lineNumber,
1098
- `sprint-start requires a full date (YYYY-MM-DD), got "${value}".`
1099
- );
1100
- } else if (Number.isNaN(new Date(value + 'T00:00:00').getTime())) {
1101
- warn(lineNumber, `sprint-start is not a valid date: "${value}".`);
1102
- } else {
1103
- result.options.sprintStart = value;
1104
- }
1105
- break;
1106
- }
1107
- }
1108
- continue;
1109
- }
1110
-
1111
- // ── NEW-MODE: offset prefix + group / positional task ──
1112
-
1113
- if (syntaxMode === 'new') {
1114
- // Check for offset prefix: `+4w [Group]` or `+4w Task 30bd`
1115
- let restAfterOffset = line;
1116
- let lineOffset: Offset | undefined;
1117
- const offMatch = line.match(OFFSET_PREFIX_RE);
1118
- if (offMatch) {
1119
- lineOffset = parseOffsetPrefix('+' + offMatch[1]!) ?? undefined;
1120
- restAfterOffset = offMatch[2]!;
1121
- }
1122
-
1123
- // Group: `[GroupName]` with optional offset
1124
- const gm = restAfterOffset.match(GROUP_RE);
1125
- if (gm) {
1126
- if (
1127
- blockStack.length > 0 &&
1128
- blockStack[blockStack.length - 1]!.containerType === 'task'
1129
- ) {
1130
- softError(
1131
- lineNumber,
1132
- `Cannot nest a group inside a task. Groups must be inside other groups.`
1133
- );
1134
- continue;
1135
- }
1136
- const afterBrackets = gm[2]!.trim();
1137
- let metadata: Record<string, string> = {};
1138
- if (afterBrackets) {
1139
- const groupRegistry = withTagAliases(
1140
- GANTT_REGISTRY,
1141
- new Set(metaAliasMap.keys())
1142
- );
1143
- // `afterBrackets` is the same-line metadata tail; run it through
1144
- // splitNameAndMeta with a placeholder name so only the meta region
1145
- // is parsed (§1.4 same-line `key: value`).
1146
- const split = splitNameAndMeta(
1147
- `_ ${afterBrackets}`,
1148
- groupRegistry,
1149
- metaAliasMap,
1150
- undefined,
1151
- result.diagnostics,
1152
- lineNumber
1153
- );
1154
- warnUnknownMetaKeys(
1155
- split.meta,
1156
- groupRegistry,
1157
- (msg) => warn(lineNumber, msg),
1158
- split.name
1159
- );
1160
- metadata = split.meta;
1161
- }
1162
- // `[Group] collapsed: true` view-state marker (§ mirrors sequence): a
1163
- // reserved same-line key that seeds the group collapsed. Extracted into
1164
- // a typed field so it drives render/export; dropped from metadata.
1165
- let collapsed = false;
1166
- if (metadata['collapsed']?.toLowerCase() === 'true') {
1167
- collapsed = true;
1168
- delete metadata['collapsed'];
1169
- }
1170
- const groupPeeled = peelAlias(gm[1]!);
1171
- if (groupPeeled.alias)
1172
- nameAliasMap.set(groupPeeled.alias, groupPeeled.label);
1173
- const group: Writable<GanttGroup> = {
1174
- name: groupPeeled.label,
1175
- color: null,
1176
- metadata,
1177
- ...(lineOffset && { offset: lineOffset }),
1178
- ...(collapsed && { collapsed: true }),
1179
- lineNumber,
1180
- children: [],
1181
- };
1182
- const groupNode: GanttNode = { kind: 'group', ...group };
1183
- currentContainer().push(groupNode);
1184
- blockStack.push({
1185
- node: groupNode as unknown as Writable<GanttGroup>,
1186
- indent,
1187
- containerType: 'group',
1188
- });
1189
- lastTaskNode = null;
1190
- continue;
1191
- }
1192
-
1193
- // Positional task: `[+offset] Name Duration [metadata]`
1194
- // Also handles milestones: `Launch 0d`, offset tasks: `+4w Task 30bd`
1195
- {
1196
- const content = parseNewTaskContent(restAfterOffset, lineNumber);
1197
- if (
1198
- content.name &&
1199
- !content.duration &&
1200
- !content.explicitStart &&
1201
- !lineOffset
1202
- ) {
1203
- softError(
1204
- lineNumber,
1205
- `Expected task with duration/start (e.g., "${content.name} 5d"), group brackets (e.g., "[Group]"), or keyword. Got: "${line}"`
1206
- );
1207
- continue;
1208
- }
1209
- if (content.name || content.duration || content.explicitStart) {
1210
- const task = makeTask(
1211
- content.name,
1212
- content.duration,
1213
- content.uncertain,
1214
- lineNumber,
1215
- content.explicitStart,
1216
- content.preExtracted
1217
- );
1218
- if (lineOffset) {
1219
- (task as Writable<GanttTask>).offset = lineOffset;
1220
- }
1221
- const taskNode: GanttNode = { kind: 'task', ...task };
1222
- currentContainer().push(taskNode);
1223
- const writableTask = taskNode as Writable<
1224
- GanttNode & { kind: 'task' }
1225
- >;
1226
- lastTaskNode = writableTask;
1227
- blockStack.push({
1228
- node: taskNode as unknown as Writable<GanttGroup>,
1229
- indent,
1230
- containerType: 'task',
1231
- taskRef: writableTask,
1232
- });
1233
- continue;
1234
- }
1235
- }
1236
-
1237
- // If nothing matched in new mode, emit error
1238
- softError(
1239
- lineNumber,
1240
- `Expected task (e.g., "Task Name 5d"), arrow (e.g., "-> Task 3w"), group (e.g., "[Group]"), or directive. Got: "${line}"`
1241
- );
1242
- continue;
1243
- }
1244
- }
1245
-
1246
- // ── Finalize ────────────────────────────────────────────
1247
-
1248
- // Push final tag group if still open
1249
- if (currentTagGroup) {
1250
- result.tagGroups.push(currentTagGroup);
1251
- }
1252
-
1253
- // If no chart type was declared, that's acceptable (inferred from context)
1254
-
1255
- // Validate sort: tag requires tag groups
1256
- if (result.options.sort === 'tag' && result.tagGroups.length === 0) {
1257
- warn(0, 'sort tag has no effect — no tag groups defined.');
1258
- result.options.sort = 'default';
1259
- }
1260
-
1261
- validateTagGroupNames(result.tagGroups, warn, (line, msg) => {
1262
- const diag = makeDgmoError(line, msg);
1263
- diagnostics.push(diag);
1264
- if (!result.error) result.error = formatDgmoError(diag);
1265
- });
1266
-
1267
- // ── Sprint mode detection ──────────────────────────────
1268
- const hasSprintOption =
1269
- result.options.sprintLength !== null ||
1270
- result.options.sprintNumber !== null ||
1271
- result.options.sprintStart !== null;
1272
-
1273
- const hasSprintUnit = hasSprintDurationUnit(result.nodes);
1274
-
1275
- if (hasSprintOption) {
1276
- result.options.sprintMode = 'explicit';
1277
- } else if (hasSprintUnit) {
1278
- result.options.sprintMode = 'auto';
1279
- }
1280
-
1281
- // Apply defaults when sprint mode is active
1282
- if (result.options.sprintMode) {
1283
- if (!result.options.sprintLength) {
1284
- result.options.sprintLength = { amount: 2, unit: 'w' };
1285
- }
1286
- if (result.options.sprintNumber === null) {
1287
- result.options.sprintNumber = 1;
1288
- }
1289
- // sprintStart defaults to chart start or today — handled in calculator
1290
- }
1291
-
1292
- return result;
1293
-
1294
- // ── Helper: match arrow line (new syntax) ──────────────
1295
-
1296
- interface ArrowMatch {
1297
- rest: string;
1298
- lag?: Offset | undefined;
1299
- label?: string | undefined;
1300
- }
1301
-
1302
- function matchArrowLine(trimmedLine: string): ArrowMatch | null {
1303
- // Lead arrow: `--2w-> Rest` (negative lag)
1304
- const leadMatch = trimmedLine.match(LEAD_ARROW_RE);
1305
- if (leadMatch) {
1306
- const dur = parseDuration(leadMatch[1]!);
1307
- const match: ArrowMatch = { rest: leadMatch[2]! };
1308
- if (dur) match.lag = { duration: dur, direction: -1 };
1309
- return match;
1310
- }
1311
- // Lag arrow: `-3w-> Rest` (positive lag)
1312
- const lagMatch = trimmedLine.match(LAG_ARROW_RE);
1313
- if (lagMatch) {
1314
- const dur = parseDuration(lagMatch[1]!);
1315
- const match: ArrowMatch = { rest: lagMatch[2]! };
1316
- if (dur) match.lag = { duration: dur, direction: 1 };
1317
- return match;
1318
- }
1319
- // Basic arrow: `-> Rest`
1320
- const basicMatch = trimmedLine.match(BASIC_ARROW_RE);
1321
- if (basicMatch) {
1322
- return { rest: basicMatch[1]! };
1323
- }
1324
- // Labeled arrow: `-blocks-> Rest` / `-depends on-> Rest`.
1325
- // The label is any text between the leading `-` and `->` that is
1326
- // NOT a pure lag/lead duration (those are handled above).
1327
- const labeledMatch = trimmedLine.match(DEPENDENCY_RE);
1328
- if (labeledMatch?.[1]) {
1329
- return { rest: labeledMatch[2]!, label: labeledMatch[1].trim() };
1330
- }
1331
- return null;
1332
- }
1333
-
1334
- // ── Helper: parse new task content (positional duration) ─
1335
-
1336
- interface NewTaskContent {
1337
- name: string;
1338
- duration: Duration | null;
1339
- uncertain: boolean;
1340
- explicitStart?: string | undefined;
1341
- preExtracted: Record<string, string>;
1342
- }
1343
-
1344
- function parseNewTaskContent(rawContent: string, ln: number): NewTaskContent {
1345
- const registry = withTagAliases(
1346
- GANTT_REGISTRY,
1347
- new Set(metaAliasMap.keys())
1348
- );
1349
- const split = splitNameAndMeta(
1350
- rawContent,
1351
- registry,
1352
- metaAliasMap,
1353
- undefined,
1354
- diagnostics,
1355
- ln
1356
- );
1357
- warnUnknownMetaKeys(
1358
- split.meta,
1359
- registry,
1360
- (msg) => warn(ln, msg),
1361
- split.name
1362
- );
1363
-
1364
- let name = split.name;
1365
- let duration: Duration | null = null;
1366
- let uncertain = false;
1367
- let explicitStart: string | undefined;
1368
- const metadata = { ...split.meta };
1369
-
1370
- // Check for explicit `duration:` key (fallback for ambiguous names)
1371
- if (metadata['duration']) {
1372
- const durStr = metadata['duration'];
1373
- const uncertainMatch = durStr.match(/^(.+)\?$/);
1374
- const cleanDur = uncertainMatch ? uncertainMatch[1]! : durStr;
1375
- if (uncertainMatch) uncertain = true;
1376
- duration = parseDuration(cleanDur);
1377
- if (!duration) {
1378
- softError(
1379
- ln,
1380
- `Invalid duration: "${durStr}". Expected format like "30bd", "5d", "1.5w".`
1381
- );
1382
- }
1383
- delete metadata['duration'];
1384
- }
1385
-
1386
- // Check for explicit `start:` key
1387
- if (metadata['start']) {
1388
- const raw = metadata['start'];
1389
- if (!/^\d{4}-\d{2}-\d{2}(?: \d{2}:\d{2})?$/.test(raw)) {
1390
- softError(ln, `Invalid start date: "${raw}". Expected YYYY-MM-DD.`);
1391
- } else {
1392
- explicitStart = raw;
1393
- }
1394
- delete metadata['start'];
1395
- }
1396
-
1397
- // Right-to-left scan for positional duration (only if no explicit keys)
1398
- if (!duration && !explicitStart) {
1399
- const tokens = name.split(/\s+/).filter(Boolean);
1400
- for (let j = tokens.length - 1; j >= 0; j--) {
1401
- const m = tokens[j]!.match(DURATION_TOKEN_RE);
1402
- if (m) {
1403
- duration = { amount: parseFloat(m[1]!), unit: m[2]! as DurationUnit };
1404
- uncertain = !!m[3];
1405
- name = tokens.slice(0, j).join(' ');
1406
- break;
1407
- }
1408
- }
1409
- }
1410
-
1411
- // Build pre-extracted metadata (color, remaining keys)
1412
- const preExtracted = { ...metadata };
1413
- if (split.color) preExtracted['color'] = split.color;
1414
-
1415
- return {
1416
- name: name.trim(),
1417
- duration,
1418
- uncertain,
1419
- explicitStart,
1420
- preExtracted,
1421
- };
1422
- }
1423
-
1424
- // ── Helper: find owning task for scope-based metadata ───
1425
-
1426
- function findOwningTask(
1427
- stack: BlockEntry[],
1428
- metaIndent: number
1429
- ): Writable<GanttNode & { kind: 'task' }> | null {
1430
- for (let k = stack.length - 1; k >= 0; k--) {
1431
- const entry = stack[k]!;
1432
- if (
1433
- entry.containerType === 'task' &&
1434
- entry.taskRef &&
1435
- entry.indent < metaIndent
1436
- ) {
1437
- return entry.taskRef;
1438
- }
1439
- }
1440
- return null;
1441
- }
1442
-
1443
- // ── Helper: create a task ───────────────────────────────
1444
-
1445
- function makeTask(
1446
- labelRaw: string,
1447
- duration: Duration | null,
1448
- uncertain: boolean,
1449
- ln: number,
1450
- explicitStart?: string,
1451
- preExtractedMeta?: Record<string, string>
1452
- ): GanttTask {
1453
- // TD-18: peel optional `as <alias>` from the label.
1454
- const peeled = peelAlias(labelRaw);
1455
- let label = peeled.label;
1456
- if (peeled.alias) nameAliasMap.set(peeled.alias, label);
1457
-
1458
- // Check for reserved keyword
1459
- if (label.toLowerCase() === 'parallel') {
1460
- softError(
1461
- ln,
1462
- `"parallel" is a reserved keyword and cannot be used as a task name.`
1463
- );
1464
- }
1465
-
1466
- const metadata: Record<string, string> = {};
1467
-
1468
- // §1.4 unified metadata grammar — pick up the same-line form
1469
- // (`Name key: value`) by running splitNameAndMeta on the label.
1470
- {
1471
- const registry = withTagAliases(
1472
- GANTT_REGISTRY,
1473
- new Set(metaAliasMap.keys())
1474
- );
1475
- const split = splitNameAndMeta(
1476
- label,
1477
- registry,
1478
- metaAliasMap,
1479
- undefined,
1480
- result.diagnostics,
1481
- ln
1482
- );
1483
- warnUnknownMetaKeys(
1484
- split.meta,
1485
- registry,
1486
- (msg) => warn(ln, msg),
1487
- split.name
1488
- );
1489
- if (Object.keys(split.meta).length > 0) {
1490
- label = split.name;
1491
- Object.assign(metadata, split.meta);
1492
- }
1493
- }
1494
-
1495
- if (preExtractedMeta) {
1496
- Object.assign(metadata, preExtractedMeta);
1497
- }
1498
-
1499
- // Extract progress from metadata or shorthand
1500
- let progress: number | null = null;
1501
- if (metadata['progress']) {
1502
- progress = parseFloat(metadata['progress']);
1503
- delete metadata['progress'];
1504
- }
1505
-
1506
- // Reject lag/lead — use offset instead
1507
- if (metadata['lag'] || metadata['lead']) {
1508
- const key = metadata['lag'] ? 'lag' : 'lead';
1509
- softError(
1510
- ln,
1511
- `"${key}" is no longer supported — use "offset: ${metadata[key]}" instead.${key === 'lead' ? ' Negate the value for lead behavior: "offset: -...".' : ''}`
1512
- );
1513
- }
1514
-
1515
- // Extract task-level offset from metadata
1516
- let taskOffset: Offset | undefined;
1517
- if (metadata['offset']) {
1518
- const raw = metadata['offset'];
1519
- if (raw.trim().startsWith('+')) {
1520
- warn(
1521
- ln,
1522
- `Invalid offset: "${raw}". Explicit "+" is not supported — use "${raw.trim().slice(1)}" instead.`
1523
- );
1524
- } else {
1525
- taskOffset = parseOffset(raw) ?? undefined;
1526
- if (!taskOffset) {
1527
- warn(
1528
- ln,
1529
- `Invalid offset: "${raw}". Expected format like "3bd", "-5d", or "0bd".`
1530
- );
1531
- }
1532
- }
1533
- delete metadata['offset'];
1534
- }
1535
-
1536
- // Inherit metadata from parent groups (tag inheritance)
1537
- const groupPath = currentGroupPath();
1538
- const inheritedMeta: Record<string, string> = {};
1539
- for (const entry of blockStack) {
1540
- if (entry.containerType === 'group') {
1541
- const groupNode = entry.node as GanttGroup;
1542
- Object.assign(inheritedMeta, groupNode.metadata);
1543
- }
1544
- // parallel blocks are transparent for tags — skip
1545
- }
1546
- // Task's own metadata overrides inherited
1547
- const effectiveMetadata = { ...inheritedMeta, ...metadata };
1548
-
1549
- const id = `task_${taskIdCounter++}`;
1550
-
1551
- return {
1552
- id,
1553
- label,
1554
- duration,
1555
- ...(explicitStart !== undefined && { explicitStart }),
1556
- uncertain,
1557
- progress,
1558
- ...(taskOffset !== undefined && { offset: taskOffset }),
1559
- isDefinition: duration !== null || explicitStart !== undefined,
1560
- dependencies: [],
1561
- metadata: effectiveMetadata,
1562
- lineNumber: ln,
1563
- groupPath,
1564
- };
1565
- }
1566
- }
1567
-
1568
- // ── Utility: parse workweek string ────────────────────────
1569
-
1570
- function parseWorkweek(s: string): Weekday[] | null {
1571
- // Try range format: "sun-thu"
1572
- const rangeParts = s.toLowerCase().split('-');
1573
- if (rangeParts.length === 2) {
1574
- // In-bounds by length === 2 check.
1575
- const start = WEEKDAY_MAP[rangeParts[0]!.trim()];
1576
- const end = WEEKDAY_MAP[rangeParts[1]!.trim()];
1577
- if (start && end) {
1578
- const allDays: Weekday[] = [
1579
- 'mon',
1580
- 'tue',
1581
- 'wed',
1582
- 'thu',
1583
- 'fri',
1584
- 'sat',
1585
- 'sun',
1586
- ];
1587
- const startIdx = allDays.indexOf(start);
1588
- const endIdx = allDays.indexOf(end);
1589
- const days: Weekday[] = [];
1590
- let idx = startIdx;
1591
- while (true) {
1592
- // In-bounds: allDays has length 7 and idx stays in [0..6] via % 7.
1593
- days.push(allDays[idx]!);
1594
- if (idx === endIdx) break;
1595
- idx = (idx + 1) % 7;
1596
- }
1597
- return days;
1598
- }
1599
- }
1600
-
1601
- // Try comma-separated: "mon, tue, wed, thu, fri"
1602
- const parts = s
1603
- .toLowerCase()
1604
- .split(',')
1605
- .map((p) => p.trim());
1606
- const days: Weekday[] = [];
1607
- for (const part of parts) {
1608
- const day = WEEKDAY_MAP[part];
1609
- if (!day) return null;
1610
- days.push(day);
1611
- }
1612
- return days.length > 0 ? days : null;
1613
- }
1614
-
1615
- // ── Known option keys ─────────────────────────────────────
1616
-
1617
- // Derived from the single-source directives registry; the anti-drift guard
1618
- // (tests/highlight-coverage.test.ts) cross-checks this vocab against the
1619
- // editor keyword sets. Re-exported under the historical names for callers.
1620
- export const GANTT_KNOWN_OPTIONS = GANTT_OPTION_SET;
1621
- const KNOWN_OPTIONS = GANTT_KNOWN_OPTIONS;
1622
-
1623
- /** Boolean options that can appear as bare keywords or with `no-` prefix. */
1624
- export const GANTT_KNOWN_BOOLEANS = GANTT_BOOLEAN_SET;
1625
- const KNOWN_BOOLEANS = GANTT_KNOWN_BOOLEANS;
1626
-
1627
- function isKnownOption(key: string): boolean {
1628
- return KNOWN_OPTIONS.has(key);
1629
- }
1630
-
1631
- /** Check if any task in the tree uses the `s` (sprint) duration unit. */
1632
- function hasSprintDurationUnit(nodes: readonly GanttNode[]): boolean {
1633
- for (const node of nodes) {
1634
- if (node.kind === 'task') {
1635
- if (node.duration?.unit === 's') return true;
1636
- } else if (node.kind === 'group' || node.kind === 'parallel') {
1637
- if (hasSprintDurationUnit(node.children)) return true;
1638
- }
1639
- }
1640
- return false;
1641
- }