@diagrammo/dgmo 0.92.1 → 0.94.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 (174) hide show
  1. package/dist/advanced.d.ts +103 -38
  2. package/dist/advanced.js +457 -423
  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-SZV2SFTM.js} +7 -6
  10. package/dist/{chunk-ADNIO3XY.js → chunk-2FDQEQID.js} +5 -5
  11. package/dist/{chunk-QUGC7GWB.js → chunk-2HSHWPTO.js} +15 -15
  12. package/dist/{chunk-L5NW3PVL.js → chunk-2I4UQG7W.js} +1 -1
  13. package/dist/{chunk-2YAFDND3.js → chunk-2MS623GW.js} +4 -6
  14. package/dist/{chunk-73EYNV4O.js → chunk-2XMTZ5JR.js} +4 -6
  15. package/dist/{chunk-ZJAK6C7Y.js → chunk-3PP746YM.js} +6 -1
  16. package/dist/{chunk-MDVJYRJT.js → chunk-3TWBMU7K.js} +22 -22
  17. package/dist/{chunk-FTUMRSGT.js → chunk-3ZP3QC47.js} +8 -288
  18. package/dist/{chunk-J2E7EUER.js → chunk-4EX4OKGZ.js} +86 -23
  19. package/dist/{chunk-Y2V5AEVG.js → chunk-4SP6OUO7.js} +1952 -1824
  20. package/dist/{chunk-HIWHIYLD.js → chunk-4TEPDQHJ.js} +19 -19
  21. package/dist/{chunk-DEFBUZWV.js → chunk-5HAYT43L.js} +70 -54
  22. package/dist/{chunk-6WVX4KNP.js → chunk-5ZUZZDW5.js} +97 -297
  23. package/dist/{chunk-X5BUX2GK.js → chunk-6JCTW74W.js} +7 -5
  24. package/dist/{chunk-Q6W2K33N.js → chunk-6XLMTAEX.js} +1 -1
  25. package/dist/{chunk-ONYO5WJW.js → chunk-7IOZ6JE4.js} +21 -21
  26. package/dist/chunk-7SXV7NUS.js +416 -0
  27. package/dist/{chunk-NPWVOFB3.js → chunk-7WEYXYLC.js} +1 -1
  28. package/dist/{chunk-GE7ICBX6.js → chunk-AM42TLSZ.js} +102 -97
  29. package/dist/{chunk-WLLO3PZ3.js → chunk-AYUSD4Z6.js} +45 -19
  30. package/dist/{chunk-45QUTYPD.js → chunk-B25IWGDH.js} +69 -20
  31. package/dist/{chunk-JKST4RTT.js → chunk-BH2SF4TT.js} +6 -6
  32. package/dist/{chunk-6OIMUSDX.js → chunk-C6G36F5S.js} +9 -9
  33. package/dist/{chunk-DRFGIOZ6.js → chunk-CIHHTS5B.js} +4 -6
  34. package/dist/chunk-CYTFO2LF.js +209 -0
  35. package/dist/{chunk-Q2UFOKPB.js → chunk-DDIOWNHS.js} +22 -22
  36. package/dist/{chunk-Q6ZQX2HX.js → chunk-DLJJOCIT.js} +4 -6
  37. package/dist/{chunk-26BBJUBW.js → chunk-DNM3XZCK.js} +4 -6
  38. package/dist/{chunk-AUS7V54P.js → chunk-ERT7XDQW.js} +1 -1
  39. package/dist/{chunk-7ENDOHAA.js → chunk-FMAVHTYB.js} +919 -927
  40. package/dist/{chunk-URQIWIKX.js → chunk-FWVE373X.js} +4 -4
  41. package/dist/{chunk-VOR32OHN.js → chunk-G3HZ4PGE.js} +13 -15
  42. package/dist/{chunk-RBFJT23E.js → chunk-GWQRTA5W.js} +6 -6
  43. package/dist/chunk-GXCDD6NG.js +24 -0
  44. package/dist/{chunk-3PFMGNOM.js → chunk-HHVIE45A.js} +26 -11
  45. package/dist/{chunk-MXAP37W6.js → chunk-HI6R27YA.js} +16 -7
  46. package/dist/{chunk-QQPNCXAO.js → chunk-I37S3EZE.js} +18 -18
  47. package/dist/{chunk-YITHYQCL.js → chunk-IGJEKO2P.js} +8 -8
  48. package/dist/{chunk-BZX7QCXJ.js → chunk-IHN6WDEY.js} +15 -15
  49. package/dist/{chunk-QT3KDDXK.js → chunk-IN7XI6NO.js} +0 -7
  50. package/dist/{chunk-4QLGGQNO.js → chunk-IZHGT5HD.js} +44 -18
  51. package/dist/{chunk-5SSTVFPX.js → chunk-JT2BG7LM.js} +5 -7
  52. package/dist/{chunk-2BJW7FSF.js → chunk-KBEWVCK3.js} +1 -1
  53. package/dist/{chunk-DUPZ2BBY.js → chunk-KBHT5XEY.js} +143 -6
  54. package/dist/{chunk-V4D2ZQBE.js → chunk-KRPLP5LP.js} +6 -1
  55. package/dist/{chunk-QKY6W4NA.js → chunk-KSZB7TIY.js} +25 -25
  56. package/dist/{chunk-6ZL2XYM7.js → chunk-MLY5ALOV.js} +6 -6
  57. package/dist/{chunk-VSOZZYLK.js → chunk-NERQSSYD.js} +20 -9
  58. package/dist/{chunk-OQW4ETJX.js → chunk-NM5V5EKY.js} +6 -1
  59. package/dist/{chunk-EBSFSOJC.js → chunk-NOQB4KMV.js} +22 -22
  60. package/dist/{chunk-6BNNLVAR.js → chunk-NPDVWFAQ.js} +6 -1
  61. package/dist/{chunk-FSJ3ZA6N.js → chunk-OSSTOSXU.js} +12 -12
  62. package/dist/chunk-P7TRFL4P.js +54 -0
  63. package/dist/{chunk-A4PNWAUW.js → chunk-PGSGJLUR.js} +6 -1
  64. package/dist/{chunk-S7W75MIM.js → chunk-QKPOIJBT.js} +23 -5
  65. package/dist/{chunk-YO6AQU4A.js → chunk-QPQWY5RU.js} +12 -12
  66. package/dist/{chunk-NREU4JFE.js → chunk-RBVFNUAL.js} +6 -8
  67. package/dist/{chunk-5EBYPETE.js → chunk-RESEJSCV.js} +3 -5
  68. package/dist/{chunk-BRSM6Z34.js → chunk-RITTLIDJ.js} +14 -14
  69. package/dist/{chunk-MX4SZLSV.js → chunk-S5Y3OO3V.js} +16 -8
  70. package/dist/{chunk-O5WUZGPV.js → chunk-TASRGDYP.js} +18 -18
  71. package/dist/{chunk-HXULJZA2.js → chunk-TDAGJJPZ.js} +6 -1
  72. package/dist/chunk-UCHZJJIT.js +421 -0
  73. package/dist/{chunk-42UJ23H3.js → chunk-UIEKW4SG.js} +1 -0
  74. package/dist/{chunk-WFA6IULY.js → chunk-URRAWU5D.js} +5 -0
  75. package/dist/{chunk-IGKFOHBG.js → chunk-VBMRZCMQ.js} +13 -13
  76. package/dist/{chunk-JRWUHLRP.js → chunk-VDY2GR6U.js} +51 -8
  77. package/dist/{chunk-EJS3K44P.js → chunk-VGAMBOOC.js} +5 -3
  78. package/dist/{chunk-B5PEKSRH.js → chunk-VSAKEMDD.js} +6 -1
  79. package/dist/chunk-WTTIODDV.js +9 -0
  80. package/dist/{chunk-JLU52ZDT.js → chunk-XJQ6Z3FO.js} +10 -10
  81. package/dist/{chunk-KTGZDMDX.js → chunk-XKCRKD2B.js} +140 -53
  82. package/dist/{chunk-LRP5FXST.js → chunk-YQMIKX54.js} +61 -24
  83. package/dist/{chunk-H5UEVW6Q.js → chunk-ZD3QCNB7.js} +1 -1
  84. package/dist/clock.js +168 -0
  85. package/dist/completion-registry.js +3 -1
  86. package/dist/countdown.js +36 -395
  87. package/dist/{dgmo-router-4UAPPIKN.js → dgmo-router-E5O7RJSW.js} +50 -43
  88. package/dist/{dimensions-SCNVYLRF.js → dimensions-DS6FWLRY.js} +3 -3
  89. package/dist/{d3-BThYBTQk.d.ts → export-context-Ceh3wr0E.d.ts} +2 -8
  90. package/dist/{flowchart-parser-NA75YQ77.js → flowchart-parser-NZXASOZG.js} +8 -3
  91. package/dist/{flowchart-renderer-6MGGX4RC.js → flowchart-renderer-PTCRIANF.js} +17 -19
  92. package/dist/index.d.ts +8 -7
  93. package/dist/index.js +80 -74
  94. package/dist/{layout-MBVBAMPA.js → layout-3TSVAGWH.js} +2 -2
  95. package/dist/layout-ISSBWBH7.js +24 -0
  96. package/dist/layout-IT4ZTV6C.js +24 -0
  97. package/dist/{layout-BNLFQHSB.js → layout-U3AH6M7J.js} +9 -10
  98. package/dist/layout-VC3MXRB4.js +29 -0
  99. package/dist/layout-VDCJOZSH.js +11 -0
  100. package/dist/{layout-search-PMYL3VWS.js → layout-search-BBX2BMEF.js} +11 -12
  101. package/dist/{palettes-IN7ZFRJM.js → palettes-4Y7CL2QL.js} +4 -2
  102. package/dist/{parser-QYISOAGR.js → parser-4RFY7D52.js} +8 -3
  103. package/dist/{parser-3MK56JZC.js → parser-4Y6PODW6.js} +2 -2
  104. package/dist/{parser-GX5YLRIP.js → parser-7QKQ4P4P.js} +8 -3
  105. package/dist/{parser-2NWH5JUS.js → parser-A3AN76RQ.js} +2 -1
  106. package/dist/{parser-LCJ76UXS.js → parser-BT4NI6JY.js} +5 -1
  107. package/dist/{parser-FXDS4JDK.js → parser-F7NDRPMA.js} +2 -2
  108. package/dist/{parser-BES6LV3G.js → parser-GDLKUBTO.js} +5 -1
  109. package/dist/{parser-SEUTXN6U.js → parser-KJPPUN4D.js} +2 -2
  110. package/dist/{parser-SIKL4PLF.js → parser-KMKVFET2.js} +5 -1
  111. package/dist/{parser-5LW5JDYG.js → parser-NL73FSFI.js} +5 -1
  112. package/dist/{parser-VA7ZQQTA.js → parser-NUU3DVW4.js} +5 -1
  113. package/dist/{parser-XZUKNZPB.js → parser-R3LPEQIT.js} +7 -1
  114. package/dist/{parser-X23GRTQJ.js → parser-RCIEKN7Y.js} +5 -1
  115. package/dist/{parser-L6RWDXQN.js → parser-TAYRTCPR.js} +8 -3
  116. package/dist/redraw-AHW7EUUF.js +1698 -0
  117. package/dist/redraw-STZ4WJAI.js +73 -0
  118. package/dist/{renderer-LM4ICK6I.js → renderer-2LYX6NHN.js} +4 -5
  119. package/dist/{renderer-NHTR7IRR.js → renderer-3NLDX7DQ.js} +4 -5
  120. package/dist/{renderer-TO2NVJP3.js → renderer-4SE7R22T.js} +50 -45
  121. package/dist/{renderer-3IHQI4A4.js → renderer-53B523PM.js} +11 -10
  122. package/dist/{renderer-3JY6JAQJ.js → renderer-7OGGV327.js} +5 -6
  123. package/dist/{renderer-2FVUPBGV.js → renderer-AM7P4LN7.js} +1 -1
  124. package/dist/{renderer-5VKPB4LL.js → renderer-BXD5KVSR.js} +5 -5
  125. package/dist/{renderer-OAR5VPH4.js → renderer-DAZWHNLI.js} +2 -2
  126. package/dist/{renderer-WIU5BJUK.js → renderer-DDWDCM2K.js} +2 -2
  127. package/dist/{renderer-3QAFDXEY.js → renderer-FMTLSOCX.js} +16 -12
  128. package/dist/{renderer-JEJT3YET.js → renderer-HX6ICPDX.js} +2 -3
  129. package/dist/{renderer-NDA2FFYB.js → renderer-ISQJ2ELA.js} +5 -5
  130. package/dist/{renderer-XGG2UNXT.js → renderer-IXBOT6DU.js} +3 -4
  131. package/dist/{renderer-S3YCLJKL.js → renderer-J3GPDK73.js} +20 -22
  132. package/dist/{renderer-DVNMCYHZ.js → renderer-J7ZSTJUE.js} +15 -15
  133. package/dist/{renderer-ALWVK3EJ.js → renderer-JJ4QW3SK.js} +6 -6
  134. package/dist/{renderer-RUSFL7WU.js → renderer-JYHA6R2D.js} +8 -7
  135. package/dist/{renderer-5TZVFQ7K.js → renderer-KJ3V5BYP.js} +7 -8
  136. package/dist/{renderer-RSK6QFWN.js → renderer-LNP23NSM.js} +7 -9
  137. package/dist/{renderer-ZHGHTSNG.js → renderer-M5DUMITP.js} +13 -12
  138. package/dist/{renderer-O6DY46AV.js → renderer-MWZC7TMD.js} +7 -7
  139. package/dist/{renderer-DC7C5Q3G.js → renderer-NOYLNVTI.js} +2 -2
  140. package/dist/{renderer-ISSDGK54.js → renderer-O6RP52CQ.js} +3 -3
  141. package/dist/{renderer-ZGY7P4BM.js → renderer-OUDHH5MV.js} +19 -22
  142. package/dist/{renderer-QGIHLZOJ.js → renderer-PHLCYVSN.js} +9 -10
  143. package/dist/{renderer-VPIELEE5.js → renderer-QTPWRRJ7.js} +8 -9
  144. package/dist/{renderer-LQP3AGEJ.js → renderer-RUSQJFFC.js} +3 -4
  145. package/dist/{renderer-MM27BSBO.js → renderer-TINHO2IO.js} +3 -4
  146. package/dist/{renderer-7ZZG5HR3.js → renderer-UTEEJDGB.js} +9 -9
  147. package/dist/{renderer-J5FKF423.js → renderer-W4MUMXJE.js} +7 -4
  148. package/dist/{renderer-XO57LTU4.js → renderer-WPN2SXGT.js} +5 -5
  149. package/dist/{renderer-ZZ6MWVB7.js → renderer-XCLARXCK.js} +4 -4
  150. package/dist/{renderer-J666LZXJ.js → renderer-XOWDERU2.js} +8 -8
  151. package/dist/{state-parser-TIR2ORJY.js → state-parser-KPVW5CRI.js} +8 -3
  152. package/dist/{state-renderer-G6SUXU4J.js → state-renderer-ZVEI265C.js} +18 -21
  153. package/dist/{tag-groups-DsoVpAY-.d.ts → tag-groups-DydewK3D.d.ts} +2 -173
  154. package/dist/{themes-DRNjxX7Q.d.ts → themes-DzIH3Hjv.d.ts} +3 -2
  155. package/docs/ai-integration.md +1 -1
  156. package/docs/language-reference.md +23 -2
  157. package/gallery/fixtures/whiteboard.dgmo +3 -0
  158. package/package.json +2 -6
  159. package/dist/chunk-3Y63RFJL.js +0 -75
  160. package/dist/chunk-5DH3KYFH.js +0 -20
  161. package/dist/chunk-O753JUEZ.js +0 -67
  162. package/dist/chunk-RJNZHFNG.js +0 -51
  163. package/dist/chunk-Z6DXWULM.js +0 -23
  164. package/dist/layout-5USEVQBY.js +0 -25
  165. package/dist/layout-J3AGFZZ7.js +0 -10
  166. package/dist/layout-S3RLVPH4.js +0 -25
  167. package/dist/layout-WRG4APSJ.js +0 -32
  168. package/dist/{chunk-DGUGE67L.js → chunk-CDYV46JE.js} +3 -3
  169. package/dist/{chunk-TKAB3FTK.js → chunk-DRQSB72S.js} +11 -11
  170. package/dist/{chunk-ZKP77MB3.js → chunk-FVTYJUXR.js} +5 -5
  171. package/dist/{chunk-MA42PIGJ.js → chunk-H5NVCOEJ.js} +4 -4
  172. package/dist/{chunk-BEA4D7OS.js → chunk-IXHWS2HI.js} +3 -3
  173. package/dist/{chunk-SOHZDW6N.js → chunk-UXNA2H2V.js} +3 -3
  174. package/dist/{chunk-NO3UX6AP.js → chunk-V2NQV7VL.js} +4 -4
@@ -0,0 +1,421 @@
1
+ // src/countdown/resolve.ts
2
+ var DAY_MS = 864e5;
3
+ var WEEK_MS = 7 * DAY_MS;
4
+ var ZONE_WD = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
5
+ function zoneFields(ms, tz) {
6
+ const d = new Date(ms);
7
+ if (!tz) {
8
+ return {
9
+ year: d.getFullYear(),
10
+ month: d.getMonth(),
11
+ day: d.getDate(),
12
+ hour: d.getHours(),
13
+ minute: d.getMinutes(),
14
+ second: d.getSeconds(),
15
+ weekday: d.getDay()
16
+ };
17
+ }
18
+ try {
19
+ const o = {};
20
+ new Intl.DateTimeFormat("en-US", {
21
+ timeZone: tz,
22
+ hour12: false,
23
+ year: "numeric",
24
+ month: "2-digit",
25
+ day: "2-digit",
26
+ hour: "2-digit",
27
+ minute: "2-digit",
28
+ second: "2-digit",
29
+ weekday: "short"
30
+ }).formatToParts(d).forEach((x) => {
31
+ o[x.type] = x.value;
32
+ });
33
+ return {
34
+ year: Number(o["year"]),
35
+ month: Number(o["month"]) - 1,
36
+ day: Number(o["day"]),
37
+ hour: Number(o["hour"]) % 24,
38
+ minute: Number(o["minute"]),
39
+ second: Number(o["second"]),
40
+ weekday: Math.max(0, ZONE_WD.indexOf(o["weekday"] ?? "Sun"))
41
+ };
42
+ } catch {
43
+ return {
44
+ year: d.getUTCFullYear(),
45
+ month: d.getUTCMonth(),
46
+ day: d.getUTCDate(),
47
+ hour: d.getUTCHours(),
48
+ minute: d.getUTCMinutes(),
49
+ second: d.getUTCSeconds(),
50
+ weekday: d.getUTCDay()
51
+ };
52
+ }
53
+ }
54
+ function zoneOffsetMs(tz, ms) {
55
+ const f = zoneFields(ms, tz);
56
+ const asUTC = Date.UTC(f.year, f.month, f.day, f.hour, f.minute, f.second);
57
+ return asUTC - Math.floor(ms / 1e3) * 1e3;
58
+ }
59
+ function wallToMs(y, mo, d, h, mi, tz) {
60
+ if (!tz) return new Date(y, mo, d, h, mi).getTime();
61
+ const guess = Date.UTC(y, mo, d, h, mi);
62
+ const off1 = zoneOffsetMs(tz, guess);
63
+ const ms = guess - off1;
64
+ const off2 = zoneOffsetMs(tz, ms);
65
+ return off2 === off1 ? ms : guess - off2;
66
+ }
67
+ function zoneOffsetLabel(ms, tz) {
68
+ if (!tz) return "";
69
+ try {
70
+ const off = new Intl.DateTimeFormat("en-US", {
71
+ timeZone: tz,
72
+ timeZoneName: "shortOffset"
73
+ }).formatToParts(new Date(ms)).find((x) => x.type === "timeZoneName");
74
+ return off ? off.value.replace("GMT", "UTC") : "";
75
+ } catch {
76
+ return "";
77
+ }
78
+ }
79
+ var DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
80
+ var LOCAL_DT_RE = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?$/;
81
+ function targetToMs(target, tz = null) {
82
+ const s = target.trim();
83
+ if (DATE_ONLY_RE.test(s)) {
84
+ const [y, m, d] = s.split("-").map(Number);
85
+ return wallToMs(y, m - 1, d, 0, 0, tz);
86
+ }
87
+ const dt = LOCAL_DT_RE.exec(s);
88
+ if (dt) {
89
+ return wallToMs(
90
+ Number(dt[1]),
91
+ Number(dt[2]) - 1,
92
+ Number(dt[3]),
93
+ Number(dt[4]),
94
+ Number(dt[5]),
95
+ tz
96
+ );
97
+ }
98
+ return new Date(s).getTime();
99
+ }
100
+ function ordinalWord(n) {
101
+ const abs = Math.abs(n);
102
+ const tens = abs % 100;
103
+ let suffix = "th";
104
+ if (tens < 11 || tens > 13) {
105
+ const ones = abs % 10;
106
+ suffix = ones === 1 ? "st" : ones === 2 ? "nd" : ones === 3 ? "rd" : "th";
107
+ }
108
+ return `${n}${suffix}`;
109
+ }
110
+ function applyOrdinalTemplate(template, n) {
111
+ return template.replace(/\bNth\b/g, ordinalWord(n)).replace(/\bN\b/g, String(n));
112
+ }
113
+ function dayStart(ms, tz = null) {
114
+ const f = zoneFields(ms, tz);
115
+ return wallToMs(f.year, f.month, f.day, 0, 0, tz);
116
+ }
117
+ function dayDelta(a, b, tz = null) {
118
+ return Math.round((dayStart(b, tz) - dayStart(a, tz)) / DAY_MS);
119
+ }
120
+ function dayKey(ms, tz = null) {
121
+ const f = zoneFields(ms, tz);
122
+ return `${f.year}-${f.month + 1}-${f.day}`;
123
+ }
124
+ function sameDay(a, b, tz = null) {
125
+ const x = zoneFields(a, tz);
126
+ const y = zoneFields(b, tz);
127
+ return x.year === y.year && x.month === y.month && x.day === y.day;
128
+ }
129
+ function nthWeekdayOfMonth(year, month, weekday, nth, hour, minute, tz) {
130
+ if (nth < 0) {
131
+ const last = new Date(year, month + 1, 0).getDate();
132
+ for (let d = last; d >= 1; d--) {
133
+ if (new Date(year, month, d).getDay() === weekday) {
134
+ return wallToMs(year, month, d, hour, minute, tz);
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ const firstDow = new Date(year, month, 1).getDay();
140
+ const offset = (weekday - firstDow + 7) % 7;
141
+ const day = 1 + offset + (nth - 1) * 7;
142
+ if (day > new Date(year, month + 1, 0).getDate()) return null;
143
+ return wallToMs(year, month, day, hour, minute, tz);
144
+ }
145
+ function resolveNext(rule, now2) {
146
+ const tz = rule.tz ?? null;
147
+ const nowF = zoneFields(now2, tz);
148
+ const { hour, minute } = rule;
149
+ const passes = rule.allDay ? (t) => dayStart(t, tz) >= dayStart(now2, tz) : (t) => t > now2;
150
+ const dayExists = (y, m, d) => new Date(y, m, d).getMonth() === m;
151
+ switch (rule.kind) {
152
+ case "month-day": {
153
+ const month = rule.month;
154
+ const day = rule.day;
155
+ for (let y = nowF.year; ; y++) {
156
+ if (!dayExists(y, month, day)) continue;
157
+ const t = wallToMs(y, month, day, hour, minute, tz);
158
+ if (passes(t)) return t;
159
+ }
160
+ }
161
+ case "nth-weekday":
162
+ case "last-weekday": {
163
+ const weekday = rule.weekday;
164
+ const nth = rule.kind === "last-weekday" ? -1 : rule.nth;
165
+ let y = nowF.year;
166
+ let m = nowF.month;
167
+ for (let i = 0; i < 24; i++) {
168
+ const t = nthWeekdayOfMonth(y, m, weekday, nth, hour, minute, tz);
169
+ if (t !== null && passes(t)) return t;
170
+ m++;
171
+ if (m > 11) {
172
+ m = 0;
173
+ y++;
174
+ }
175
+ }
176
+ return now2 + WEEK_MS;
177
+ }
178
+ case "weekly": {
179
+ const weekday = rule.weekday;
180
+ for (let i = 0; i < 8; i++) {
181
+ const cal = new Date(nowF.year, nowF.month, nowF.day + i);
182
+ if (cal.getDay() !== weekday) continue;
183
+ const t = wallToMs(
184
+ cal.getFullYear(),
185
+ cal.getMonth(),
186
+ cal.getDate(),
187
+ hour,
188
+ minute,
189
+ tz
190
+ );
191
+ if (passes(t)) return t;
192
+ }
193
+ return now2 + WEEK_MS;
194
+ }
195
+ case "interval": {
196
+ const n = rule.intervalN ?? 1;
197
+ const anchor = rule.anchorMs ?? now2;
198
+ if (rule.intervalUnit === "month") {
199
+ const a = zoneFields(anchor, tz);
200
+ const day = a.day;
201
+ for (let k = 0; ; k++) {
202
+ const y = a.year;
203
+ const m = a.month + k * n;
204
+ const yy = y + Math.floor(m / 12);
205
+ const mm = (m % 12 + 12) % 12;
206
+ if (!dayExists(yy, mm, day)) continue;
207
+ const t2 = wallToMs(yy, mm, day, hour, minute, tz);
208
+ if (passes(t2)) return t2;
209
+ }
210
+ }
211
+ const step = (rule.intervalUnit === "week" ? WEEK_MS : DAY_MS) * n;
212
+ let t = anchor;
213
+ if (!passes(t)) {
214
+ const k = Math.max(0, Math.floor((now2 - anchor) / step));
215
+ t = anchor + k * step;
216
+ while (!passes(t)) t += step;
217
+ }
218
+ return t;
219
+ }
220
+ }
221
+ }
222
+ function ordinalFor(resolvedMs, rule) {
223
+ const anchor = rule.anchorMs;
224
+ if (anchor === void 0) return 0;
225
+ const tz = rule.tz ?? null;
226
+ const a = zoneFields(anchor, tz);
227
+ const r = zoneFields(resolvedMs, tz);
228
+ const months = (r.year - a.year) * 12 + (r.month - a.month);
229
+ const spanDays = (dayStart(resolvedMs, tz) - dayStart(anchor, tz)) / DAY_MS;
230
+ switch (rule.kind) {
231
+ case "month-day":
232
+ return r.year - a.year;
233
+ case "nth-weekday":
234
+ case "last-weekday":
235
+ return months;
236
+ case "weekly":
237
+ return Math.round(spanDays / 7);
238
+ case "interval": {
239
+ const n = rule.intervalN ?? 1;
240
+ if (rule.intervalUnit === "month") return Math.floor(months / n);
241
+ const perStep = rule.intervalUnit === "week" ? 7 : 1;
242
+ return Math.round(spanDays / perStep / n);
243
+ }
244
+ }
245
+ }
246
+ function roundBy(value, mode) {
247
+ return mode === "down" ? Math.floor(value) : mode === "nearest" ? Math.round(value) : Math.ceil(value);
248
+ }
249
+ function pad2(n) {
250
+ return n < 10 ? "0" + n : String(n);
251
+ }
252
+ function plural(n, unit) {
253
+ return `${n} ${unit}${n === 1 ? "" : "s"}`;
254
+ }
255
+ function formatCount(remainingMs, opts) {
256
+ const { units, round, fields } = opts;
257
+ if (units === "days")
258
+ return plural(roundBy(remainingMs / DAY_MS, round), "day");
259
+ if (units === "weeks")
260
+ return plural(roundBy(remainingMs / WEEK_MS, round), "week");
261
+ const totalSec = Math.floor(remainingMs / 1e3);
262
+ if (units === "clock") {
263
+ const h2 = Math.floor(totalSec / 3600);
264
+ const m2 = Math.floor(totalSec % 3600 / 60);
265
+ const s2 = totalSec % 60;
266
+ return `${pad2(h2)}:${pad2(m2)}:${pad2(s2)}`;
267
+ }
268
+ if (units === "words") {
269
+ const days2 = Math.ceil(remainingMs / DAY_MS);
270
+ if (days2 <= 0) return "now";
271
+ if (days2 === 1) return "tomorrow";
272
+ if (days2 < 14) return `${days2} days`;
273
+ if (days2 < 60) return `${Math.round(days2 / 7)} weeks`;
274
+ return `${Math.round(days2 / 30)} months`;
275
+ }
276
+ const days = Math.floor(totalSec / 86400);
277
+ const h = Math.floor(totalSec % 86400 / 3600);
278
+ const m = Math.floor(totalSec % 3600 / 60);
279
+ const s = totalSec % 60;
280
+ const has = (f) => fields.includes(f);
281
+ const clockParts = [];
282
+ if (has("h")) clockParts.push(pad2(h));
283
+ if (has("m")) clockParts.push(pad2(m));
284
+ if (has("s")) clockParts.push(pad2(s));
285
+ const clock = clockParts.join(":");
286
+ const dayPrefix = has("d") && days > 0 ? `${days}d${clock ? " " : ""}` : "";
287
+ return dayPrefix + clock || plural(days, "day");
288
+ }
289
+ function splitClockSeconds(s) {
290
+ const m = /^(.+:\d{2}):(\d{2})$/.exec(s);
291
+ return m ? { lead: m[1], sec: ":" + m[2] } : { lead: s, sec: null };
292
+ }
293
+ function formatWordsDetail(remainingMs) {
294
+ const totalMin = Math.floor(Math.max(0, remainingMs) / 6e4);
295
+ const d = Math.floor(totalMin / 1440);
296
+ const h = Math.floor(totalMin % 1440 / 60);
297
+ const m = totalMin % 60;
298
+ const parts = [];
299
+ if (d > 0) parts.push(`${d} day${d === 1 ? "" : "s"}`);
300
+ if (d > 0 || h > 0) parts.push(`${h} hour${h === 1 ? "" : "s"}`);
301
+ parts.push(`${m} minute${m === 1 ? "" : "s"}`);
302
+ return parts.join(" ");
303
+ }
304
+ function breakdown(nowMs, targetMs, tz = null) {
305
+ const n = zoneFields(nowMs, tz);
306
+ const t = zoneFields(targetMs, tz);
307
+ let y = t.year - n.year;
308
+ let mo = t.month - n.month;
309
+ let d = t.day - n.day;
310
+ let h = t.hour - n.hour;
311
+ let mi = t.minute - n.minute;
312
+ let s = t.second - n.second;
313
+ if (s < 0) {
314
+ s += 60;
315
+ mi--;
316
+ }
317
+ if (mi < 0) {
318
+ mi += 60;
319
+ h--;
320
+ }
321
+ if (h < 0) {
322
+ h += 24;
323
+ d--;
324
+ }
325
+ if (d < 0) {
326
+ d += new Date(t.year, t.month, 0).getDate();
327
+ mo--;
328
+ }
329
+ if (mo < 0) {
330
+ mo += 12;
331
+ y--;
332
+ }
333
+ return { years: y, months: mo, days: d, hours: h, minutes: mi, seconds: s };
334
+ }
335
+ function humanUnits(nowMs, targetMs, tz = null) {
336
+ const b = breakdown(nowMs, targetMs, tz);
337
+ return [
338
+ [b.years, "year"],
339
+ [b.months, "month"],
340
+ [b.days, "day"],
341
+ [b.hours, "hour"],
342
+ [b.minutes, "minute"]
343
+ ];
344
+ }
345
+ function formatHuman(nowMs, targetMs, tz = null) {
346
+ const units = humanUnits(nowMs, targetMs, tz);
347
+ let i = 0;
348
+ while (i < units.length - 1 && units[i][0] === 0) i++;
349
+ const rest = units.slice(i);
350
+ const say = (arr) => arr.map(([n, u]) => `${n} ${u}${n === 1 ? "" : "s"}`).join(", ");
351
+ const primary = rest.slice(0, 2).filter((p, idx) => p[0] > 0 || idx === 0);
352
+ const secondary = rest.slice(2).filter((p) => p[0] > 0);
353
+ return { big: say(primary) || "now", sub: say(secondary) };
354
+ }
355
+ function formatCompound(nowMs, targetMs, maxUnits = 2, tz = null) {
356
+ const all = humanUnits(nowMs, targetMs, tz);
357
+ let i = 0;
358
+ while (i < all.length - 1 && all[i][0] === 0) i++;
359
+ const chosen = all.slice(i, i + maxUnits).filter((p, idx) => p[0] > 0 || idx === 0);
360
+ if (!chosen.length) return "now";
361
+ return chosen.map(([n, u]) => `${n} ${u}${n === 1 ? "" : "s"}`).join(", ");
362
+ }
363
+ var WEEKDAY_ABBR = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
364
+ var MONTH_ABBR = [
365
+ "Jan",
366
+ "Feb",
367
+ "Mar",
368
+ "Apr",
369
+ "May",
370
+ "Jun",
371
+ "Jul",
372
+ "Aug",
373
+ "Sep",
374
+ "Oct",
375
+ "Nov",
376
+ "Dec"
377
+ ];
378
+ function formatDate(ms, tz = null) {
379
+ const f = zoneFields(ms, tz);
380
+ return `${WEEKDAY_ABBR[f.weekday]} ${MONTH_ABBR[f.month]} ${f.day} ${f.year}`;
381
+ }
382
+ function formatDateShort(ms, tz = null) {
383
+ const f = zoneFields(ms, tz);
384
+ return `${MONTH_ABBR[f.month]} ${f.day} ${f.year}`;
385
+ }
386
+ function formatFooter(resolvedMs, hasTime, tz = null) {
387
+ const parts = [formatDate(resolvedMs, tz)];
388
+ if (hasTime) {
389
+ const f = zoneFields(resolvedMs, tz);
390
+ parts.push(`${pad2(f.hour)}:${pad2(f.minute)}`);
391
+ const label = zoneOffsetLabel(resolvedMs, tz);
392
+ if (label) parts.push(label);
393
+ }
394
+ return parts.join(" \xB7 ");
395
+ }
396
+
397
+ // src/utils/now.ts
398
+ var pinnedMs = null;
399
+ function now() {
400
+ return pinnedMs ?? Date.now();
401
+ }
402
+
403
+ export {
404
+ DAY_MS,
405
+ targetToMs,
406
+ applyOrdinalTemplate,
407
+ dayStart,
408
+ dayDelta,
409
+ dayKey,
410
+ sameDay,
411
+ resolveNext,
412
+ ordinalFor,
413
+ formatCount,
414
+ splitClockSeconds,
415
+ formatWordsDetail,
416
+ formatHuman,
417
+ formatCompound,
418
+ formatDateShort,
419
+ formatFooter,
420
+ now
421
+ };
@@ -81,5 +81,6 @@ function layoutInlineHeader(input) {
81
81
  export {
82
82
  legendInlineSupported,
83
83
  INLINE_HEADER_PAD,
84
+ measureTitleWidth,
84
85
  layoutInlineHeader
85
86
  };
@@ -172,6 +172,10 @@ function dayStart(ms, tz = null) {
172
172
  function dayDelta(a, b, tz = null) {
173
173
  return Math.round((dayStart(b, tz) - dayStart(a, tz)) / DAY_MS);
174
174
  }
175
+ function dayKey(ms, tz = null) {
176
+ const f = zoneFields(ms, tz);
177
+ return `${f.year}-${f.month + 1}-${f.day}`;
178
+ }
175
179
  function sameDay(a, b, tz = null) {
176
180
  const x = zoneFields(a, tz);
177
181
  const y = zoneFields(b, tz);
@@ -454,6 +458,7 @@ export {
454
458
  applyOrdinalTemplate,
455
459
  dayStart,
456
460
  dayDelta,
461
+ dayKey,
457
462
  sameDay,
458
463
  resolveNext,
459
464
  ordinalFor,
@@ -1,17 +1,22 @@
1
- import {
2
- appendArrowheadMarkers,
3
- appendReverseArrowheadMarkers
4
- } from "./chunk-XBJJP2HN.js";
5
1
  import {
6
2
  renderCollapseBar,
7
3
  renderNodeCard
8
4
  } from "./chunk-R2K5L4UA.js";
5
+ import {
6
+ appendArrowheadMarkers,
7
+ appendReverseArrowheadMarkers
8
+ } from "./chunk-XBJJP2HN.js";
9
9
  import {
10
10
  ScaleContext
11
11
  } from "./chunk-24YPR5EH.js";
12
12
  import {
13
- renderIntegratedLegend
14
- } from "./chunk-NMS5XSLX.js";
13
+ layoutInlineHeader
14
+ } from "./chunk-UIEKW4SG.js";
15
+ import {
16
+ TITLE_FONT_SIZE,
17
+ TITLE_FONT_WEIGHT,
18
+ TITLE_Y
19
+ } from "./chunk-VLC6WNRD.js";
15
20
  import {
16
21
  ARROWHEAD_HEIGHT,
17
22
  ARROWHEAD_WIDTH,
@@ -28,17 +33,12 @@ import {
28
33
  NODE_STROKE_WIDTH
29
34
  } from "./chunk-XCKNFFKM.js";
30
35
  import {
31
- layoutInlineHeader
32
- } from "./chunk-42UJ23H3.js";
36
+ renderIntegratedLegend
37
+ } from "./chunk-NMS5XSLX.js";
33
38
  import {
34
39
  getLegendExtent,
35
40
  getMaxLegendReservedHeight
36
41
  } from "./chunk-JILEYZ2V.js";
37
- import {
38
- TITLE_FONT_SIZE,
39
- TITLE_FONT_WEIGHT,
40
- TITLE_Y
41
- } from "./chunk-VLC6WNRD.js";
42
42
  import {
43
43
  FONT_FAMILY
44
44
  } from "./chunk-ICLB27PZ.js";
@@ -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-7WEYXYLC.js";
9
4
  import {
10
5
  renderInlineText
11
- } from "./chunk-S7W75MIM.js";
6
+ } from "./chunk-QKPOIJBT.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,10 +1,12 @@
1
+ import {
2
+ NODE_HEIGHT,
3
+ NODE_WIDTH
4
+ } from "./chunk-WTTIODDV.js";
1
5
  import {
2
6
  BOX_CLEAR_PAD,
3
7
  EDGE_LABEL_FONT_SIZE,
4
- NODE_HEIGHT,
5
- NODE_WIDTH,
6
8
  measureEdgeLabel
7
- } from "./chunk-QT3KDDXK.js";
9
+ } from "./chunk-IN7XI6NO.js";
8
10
  import {
9
11
  measureText
10
12
  } from "./chunk-KAO7JL4I.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ extractPaletteDirective
3
+ } from "./chunk-CYTFO2LF.js";
1
4
  import {
2
5
  inferParticipantType
3
6
  } from "./chunk-C3Z4DX3V.js";
@@ -247,7 +250,9 @@ function parseSequenceDgmo(content, palette) {
247
250
  if (!content?.trim()) {
248
251
  return fail(0, "Empty content");
249
252
  }
250
- const lines = content.split("\n");
253
+ const directive = extractPaletteDirective(content);
254
+ result.diagnostics.push(...directive.diagnostics);
255
+ const lines = directive.content.split("\n");
251
256
  let hasExplicitChart = false;
252
257
  let contentStarted = false;
253
258
  let activeTagOptionLine = 0;
@@ -0,0 +1,9 @@
1
+ // src/boxes-and-lines/node-metrics.ts
2
+ var PHI = 1.618;
3
+ var NODE_HEIGHT = 60;
4
+ var NODE_WIDTH = Math.round(NODE_HEIGHT * PHI);
5
+
6
+ export {
7
+ NODE_HEIGHT,
8
+ NODE_WIDTH
9
+ };
@@ -1,6 +1,3 @@
1
- import {
2
- renderInlineText
3
- } from "./chunk-S7W75MIM.js";
4
1
  import {
5
2
  BOX_H,
6
3
  BOX_W,
@@ -9,21 +6,24 @@ import {
9
6
  layoutBracket,
10
7
  wrapText
11
8
  } from "./chunk-ZI6WC24V.js";
9
+ import {
10
+ layoutInlineHeader
11
+ } from "./chunk-UIEKW4SG.js";
12
+ import {
13
+ TITLE_FONT_SIZE,
14
+ TITLE_FONT_WEIGHT,
15
+ TITLE_Y
16
+ } from "./chunk-VLC6WNRD.js";
12
17
  import {
13
18
  renderIntegratedLegend
14
19
  } from "./chunk-NMS5XSLX.js";
15
- import {
16
- layoutInlineHeader
17
- } from "./chunk-42UJ23H3.js";
18
20
  import {
19
21
  getLegendExtent,
20
22
  getMaxLegendReservedHeight
21
23
  } from "./chunk-JILEYZ2V.js";
22
24
  import {
23
- TITLE_FONT_SIZE,
24
- TITLE_FONT_WEIGHT,
25
- TITLE_Y
26
- } from "./chunk-VLC6WNRD.js";
25
+ renderInlineText
26
+ } from "./chunk-QKPOIJBT.js";
27
27
  import {
28
28
  FONT_FAMILY
29
29
  } from "./chunk-ICLB27PZ.js";