@nowline/layout 0.8.6 → 0.9.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 (338) hide show
  1. package/dist/axis-columns.d.ts +70 -0
  2. package/dist/axis-columns.d.ts.map +1 -0
  3. package/dist/axis-columns.js +104 -0
  4. package/dist/axis-columns.js.map +1 -0
  5. package/dist/calendar-resolver.d.ts +27 -0
  6. package/dist/calendar-resolver.d.ts.map +1 -0
  7. package/dist/calendar-resolver.js +132 -0
  8. package/dist/calendar-resolver.js.map +1 -0
  9. package/dist/calendar.d.ts +0 -19
  10. package/dist/calendar.d.ts.map +1 -1
  11. package/dist/calendar.js +4 -44
  12. package/dist/calendar.js.map +1 -1
  13. package/dist/canvas-width.d.ts +23 -0
  14. package/dist/canvas-width.d.ts.map +1 -0
  15. package/dist/canvas-width.js +26 -0
  16. package/dist/canvas-width.js.map +1 -0
  17. package/dist/capacity.d.ts +28 -0
  18. package/dist/capacity.d.ts.map +1 -1
  19. package/dist/capacity.js +64 -29
  20. package/dist/capacity.js.map +1 -1
  21. package/dist/chart-translation.d.ts +22 -0
  22. package/dist/chart-translation.d.ts.map +1 -0
  23. package/dist/chart-translation.js +83 -0
  24. package/dist/chart-translation.js.map +1 -0
  25. package/dist/container-header-geometry.d.ts +64 -0
  26. package/dist/container-header-geometry.d.ts.map +1 -0
  27. package/dist/container-header-geometry.js +89 -0
  28. package/dist/container-header-geometry.js.map +1 -0
  29. package/dist/dsl-utils.d.ts +3 -4
  30. package/dist/dsl-utils.d.ts.map +1 -1
  31. package/dist/dsl-utils.js +8 -25
  32. package/dist/dsl-utils.js.map +1 -1
  33. package/dist/edge-routing.d.ts +69 -78
  34. package/dist/edge-routing.d.ts.map +1 -1
  35. package/dist/edge-routing.js +271 -401
  36. package/dist/edge-routing.js.map +1 -1
  37. package/dist/frame-tab-geometry.d.ts +24 -14
  38. package/dist/frame-tab-geometry.d.ts.map +1 -1
  39. package/dist/frame-tab-geometry.js +69 -23
  40. package/dist/frame-tab-geometry.js.map +1 -1
  41. package/dist/header-card-geometry.d.ts +12 -0
  42. package/dist/header-card-geometry.d.ts.map +1 -1
  43. package/dist/header-card-geometry.js +14 -2
  44. package/dist/header-card-geometry.js.map +1 -1
  45. package/dist/header-logo.d.ts +28 -0
  46. package/dist/header-logo.d.ts.map +1 -0
  47. package/dist/header-logo.js +51 -0
  48. package/dist/header-logo.js.map +1 -0
  49. package/dist/i18n.d.ts +11 -0
  50. package/dist/i18n.d.ts.map +1 -1
  51. package/dist/i18n.js +11 -1
  52. package/dist/i18n.js.map +1 -1
  53. package/dist/index.d.ts +20 -8
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +17 -7
  56. package/dist/index.js.map +1 -1
  57. package/dist/inline-date-pin-geometry.d.ts +19 -11
  58. package/dist/inline-date-pin-geometry.d.ts.map +1 -1
  59. package/dist/inline-date-pin-geometry.js +45 -46
  60. package/dist/inline-date-pin-geometry.js.map +1 -1
  61. package/dist/item-bar-geometry.d.ts +192 -4
  62. package/dist/item-bar-geometry.d.ts.map +1 -1
  63. package/dist/item-bar-geometry.js +258 -5
  64. package/dist/item-bar-geometry.js.map +1 -1
  65. package/dist/item-port-geometry.d.ts +13 -0
  66. package/dist/item-port-geometry.d.ts.map +1 -0
  67. package/dist/item-port-geometry.js +63 -0
  68. package/dist/item-port-geometry.js.map +1 -0
  69. package/dist/layout-context.d.ts +115 -51
  70. package/dist/layout-context.d.ts.map +1 -1
  71. package/dist/layout-context.js +96 -5
  72. package/dist/layout-context.js.map +1 -1
  73. package/dist/layout-insights.d.ts.map +1 -1
  74. package/dist/layout-insights.js +73 -1
  75. package/dist/layout-insights.js.map +1 -1
  76. package/dist/layout.d.ts +35 -0
  77. package/dist/layout.d.ts.map +1 -1
  78. package/dist/layout.js +18 -1315
  79. package/dist/layout.js.map +1 -1
  80. package/dist/nodes/anchor-node.d.ts.map +1 -1
  81. package/dist/nodes/anchor-node.js +11 -4
  82. package/dist/nodes/anchor-node.js.map +1 -1
  83. package/dist/nodes/content-extent.d.ts +24 -0
  84. package/dist/nodes/content-extent.d.ts.map +1 -0
  85. package/dist/nodes/content-extent.js +100 -0
  86. package/dist/nodes/content-extent.js.map +1 -0
  87. package/dist/nodes/dependency-edges.d.ts +6 -0
  88. package/dist/nodes/dependency-edges.d.ts.map +1 -0
  89. package/dist/nodes/dependency-edges.js +148 -0
  90. package/dist/nodes/dependency-edges.js.map +1 -0
  91. package/dist/nodes/footnote-node.d.ts +24 -3
  92. package/dist/nodes/footnote-node.d.ts.map +1 -1
  93. package/dist/nodes/footnote-node.js +129 -25
  94. package/dist/nodes/footnote-node.js.map +1 -1
  95. package/dist/nodes/group-node.d.ts +10 -21
  96. package/dist/nodes/group-node.d.ts.map +1 -1
  97. package/dist/nodes/group-node.js +79 -152
  98. package/dist/nodes/group-node.js.map +1 -1
  99. package/dist/nodes/header-node.d.ts +56 -0
  100. package/dist/nodes/header-node.d.ts.map +1 -0
  101. package/dist/nodes/header-node.js +163 -0
  102. package/dist/nodes/header-node.js.map +1 -0
  103. package/dist/nodes/include-node.d.ts +22 -12
  104. package/dist/nodes/include-node.d.ts.map +1 -1
  105. package/dist/nodes/include-node.js +95 -62
  106. package/dist/nodes/include-node.js.map +1 -1
  107. package/dist/nodes/item-measure.d.ts +135 -0
  108. package/dist/nodes/item-measure.d.ts.map +1 -0
  109. package/dist/nodes/item-measure.js +514 -0
  110. package/dist/nodes/item-measure.js.map +1 -0
  111. package/dist/nodes/item-node.d.ts +162 -9
  112. package/dist/nodes/item-node.d.ts.map +1 -1
  113. package/dist/nodes/item-node.js +256 -69
  114. package/dist/nodes/item-node.js.map +1 -1
  115. package/dist/nodes/marker-band.d.ts +118 -0
  116. package/dist/nodes/marker-band.d.ts.map +1 -0
  117. package/dist/nodes/marker-band.js +303 -0
  118. package/dist/nodes/marker-band.js.map +1 -0
  119. package/dist/nodes/marker-geometry.js +1 -1
  120. package/dist/nodes/marker-geometry.js.map +1 -1
  121. package/dist/nodes/milestone-node.d.ts +112 -15
  122. package/dist/nodes/milestone-node.d.ts.map +1 -1
  123. package/dist/nodes/milestone-node.js +246 -95
  124. package/dist/nodes/milestone-node.js.map +1 -1
  125. package/dist/nodes/nowline-node.d.ts +8 -0
  126. package/dist/nodes/nowline-node.d.ts.map +1 -0
  127. package/dist/nodes/nowline-node.js +74 -0
  128. package/dist/nodes/nowline-node.js.map +1 -0
  129. package/dist/nodes/parallel-node.d.ts +7 -12
  130. package/dist/nodes/parallel-node.d.ts.map +1 -1
  131. package/dist/nodes/parallel-node.js +66 -30
  132. package/dist/nodes/parallel-node.js.map +1 -1
  133. package/dist/nodes/region-markers.d.ts +41 -0
  134. package/dist/nodes/region-markers.d.ts.map +1 -0
  135. package/dist/nodes/region-markers.js +130 -0
  136. package/dist/nodes/region-markers.js.map +1 -0
  137. package/dist/nodes/roadmap-node.d.ts +9 -72
  138. package/dist/nodes/roadmap-node.d.ts.map +1 -1
  139. package/dist/nodes/roadmap-node.js +38 -788
  140. package/dist/nodes/roadmap-node.js.map +1 -1
  141. package/dist/nodes/row-track.d.ts +33 -0
  142. package/dist/nodes/row-track.d.ts.map +1 -0
  143. package/dist/nodes/row-track.js +170 -0
  144. package/dist/nodes/row-track.js.map +1 -0
  145. package/dist/nodes/sequence-item.d.ts +25 -0
  146. package/dist/nodes/sequence-item.d.ts.map +1 -0
  147. package/dist/nodes/sequence-item.js +396 -0
  148. package/dist/nodes/sequence-item.js.map +1 -0
  149. package/dist/nodes/sequence-one.d.ts +5 -0
  150. package/dist/nodes/sequence-one.d.ts.map +1 -0
  151. package/dist/nodes/sequence-one.js +26 -0
  152. package/dist/nodes/sequence-one.js.map +1 -0
  153. package/dist/nodes/swimlane-node.d.ts +5 -17
  154. package/dist/nodes/swimlane-node.d.ts.map +1 -1
  155. package/dist/nodes/swimlane-node.js +62 -145
  156. package/dist/nodes/swimlane-node.js.map +1 -1
  157. package/dist/nodes/wave-node.d.ts +52 -0
  158. package/dist/nodes/wave-node.d.ts.map +1 -0
  159. package/dist/nodes/wave-node.js +483 -0
  160. package/dist/nodes/wave-node.js.map +1 -0
  161. package/dist/non-working-display.d.ts +14 -0
  162. package/dist/non-working-display.d.ts.map +1 -0
  163. package/dist/non-working-display.js +28 -0
  164. package/dist/non-working-display.js.map +1 -0
  165. package/dist/phases/date-window.d.ts +48 -0
  166. package/dist/phases/date-window.d.ts.map +1 -0
  167. package/dist/phases/date-window.js +130 -0
  168. package/dist/phases/date-window.js.map +1 -0
  169. package/dist/phases/finalize.d.ts +198 -0
  170. package/dist/phases/finalize.d.ts.map +1 -0
  171. package/dist/phases/finalize.js +1058 -0
  172. package/dist/phases/finalize.js.map +1 -0
  173. package/dist/phases/measure.d.ts +77 -0
  174. package/dist/phases/measure.d.ts.map +1 -0
  175. package/dist/phases/measure.js +222 -0
  176. package/dist/phases/measure.js.map +1 -0
  177. package/dist/phases/place.d.ts +28 -0
  178. package/dist/phases/place.d.ts.map +1 -0
  179. package/dist/phases/place.js +225 -0
  180. package/dist/phases/place.js.map +1 -0
  181. package/dist/renderable.d.ts.map +1 -1
  182. package/dist/renderable.js +23 -3
  183. package/dist/renderable.js.map +1 -1
  184. package/dist/resolve-today.d.ts +11 -1
  185. package/dist/resolve-today.d.ts.map +1 -1
  186. package/dist/resolve-today.js +26 -12
  187. package/dist/resolve-today.js.map +1 -1
  188. package/dist/row-packer.d.ts +42 -16
  189. package/dist/row-packer.d.ts.map +1 -1
  190. package/dist/row-packer.js +51 -78
  191. package/dist/row-packer.js.map +1 -1
  192. package/dist/schedule.d.ts +58 -1
  193. package/dist/schedule.d.ts.map +1 -1
  194. package/dist/schedule.js +280 -106
  195. package/dist/schedule.js.map +1 -1
  196. package/dist/start-rules.d.ts +27 -0
  197. package/dist/start-rules.d.ts.map +1 -0
  198. package/dist/start-rules.js +91 -0
  199. package/dist/start-rules.js.map +1 -0
  200. package/dist/start-terms.d.ts +23 -0
  201. package/dist/start-terms.d.ts.map +1 -0
  202. package/dist/start-terms.js +27 -0
  203. package/dist/start-terms.js.map +1 -0
  204. package/dist/status-dot.d.ts +46 -0
  205. package/dist/status-dot.d.ts.map +1 -0
  206. package/dist/status-dot.js +78 -0
  207. package/dist/status-dot.js.map +1 -0
  208. package/dist/style-resolution.d.ts.map +1 -1
  209. package/dist/style-resolution.js +23 -43
  210. package/dist/style-resolution.js.map +1 -1
  211. package/dist/text-measure.d.ts +28 -0
  212. package/dist/text-measure.d.ts.map +1 -0
  213. package/dist/text-measure.js +70 -0
  214. package/dist/text-measure.js.map +1 -0
  215. package/dist/themes/contrast.d.ts +4 -0
  216. package/dist/themes/contrast.d.ts.map +1 -0
  217. package/dist/themes/contrast.js +32 -0
  218. package/dist/themes/contrast.js.map +1 -0
  219. package/dist/themes/dark.d.ts.map +1 -1
  220. package/dist/themes/dark.js +28 -1
  221. package/dist/themes/dark.js.map +1 -1
  222. package/dist/themes/grayscale.d.ts.map +1 -1
  223. package/dist/themes/grayscale.js +28 -1
  224. package/dist/themes/grayscale.js.map +1 -1
  225. package/dist/themes/index.d.ts +4 -11
  226. package/dist/themes/index.d.ts.map +1 -1
  227. package/dist/themes/index.js +6 -4
  228. package/dist/themes/index.js.map +1 -1
  229. package/dist/themes/light.d.ts.map +1 -1
  230. package/dist/themes/light.js +28 -1
  231. package/dist/themes/light.js.map +1 -1
  232. package/dist/themes/shape.d.ts +31 -0
  233. package/dist/themes/shape.d.ts.map +1 -1
  234. package/dist/themes/shared.d.ts +44 -50
  235. package/dist/themes/shared.d.ts.map +1 -1
  236. package/dist/themes/shared.js +79 -83
  237. package/dist/themes/shared.js.map +1 -1
  238. package/dist/time-scale.d.ts +42 -6
  239. package/dist/time-scale.d.ts.map +1 -1
  240. package/dist/time-scale.js +109 -17
  241. package/dist/time-scale.js.map +1 -1
  242. package/dist/types.d.ts +528 -11
  243. package/dist/types.d.ts.map +1 -1
  244. package/dist/view-preset.d.ts +61 -6
  245. package/dist/view-preset.d.ts.map +1 -1
  246. package/dist/view-preset.js +439 -24
  247. package/dist/view-preset.js.map +1 -1
  248. package/dist/wave-barrier.d.ts +107 -0
  249. package/dist/wave-barrier.d.ts.map +1 -0
  250. package/dist/wave-barrier.js +174 -0
  251. package/dist/wave-barrier.js.map +1 -0
  252. package/dist/wave-hatch.d.ts +4 -0
  253. package/dist/wave-hatch.d.ts.map +1 -0
  254. package/dist/wave-hatch.js +21 -0
  255. package/dist/wave-hatch.js.map +1 -0
  256. package/dist/wave-layout.d.ts +99 -0
  257. package/dist/wave-layout.d.ts.map +1 -0
  258. package/dist/wave-layout.js +130 -0
  259. package/dist/wave-layout.js.map +1 -0
  260. package/dist/working-calendar.d.ts +128 -4
  261. package/dist/working-calendar.d.ts.map +1 -1
  262. package/dist/working-calendar.js +725 -51
  263. package/dist/working-calendar.js.map +1 -1
  264. package/dist/working-span.d.ts +11 -0
  265. package/dist/working-span.d.ts.map +1 -0
  266. package/dist/working-span.js +18 -0
  267. package/dist/working-span.js.map +1 -0
  268. package/package.json +4 -4
  269. package/src/axis-columns.ts +140 -0
  270. package/src/calendar-resolver.ts +161 -0
  271. package/src/calendar.ts +4 -45
  272. package/src/canvas-width.ts +36 -0
  273. package/src/capacity.ts +71 -30
  274. package/src/chart-translation.ts +88 -0
  275. package/src/container-header-geometry.ts +116 -0
  276. package/src/dsl-utils.ts +8 -26
  277. package/src/edge-routing.ts +347 -491
  278. package/src/frame-tab-geometry.ts +78 -25
  279. package/src/header-card-geometry.ts +17 -2
  280. package/src/header-logo.ts +67 -0
  281. package/src/i18n.ts +22 -1
  282. package/src/index.ts +97 -12
  283. package/src/inline-date-pin-geometry.ts +55 -58
  284. package/src/item-bar-geometry.ts +341 -5
  285. package/src/item-port-geometry.ts +69 -0
  286. package/src/layout-context.ts +210 -72
  287. package/src/layout-insights.ts +109 -2
  288. package/src/layout.ts +57 -1530
  289. package/src/nodes/anchor-node.ts +11 -4
  290. package/src/nodes/content-extent.ts +107 -0
  291. package/src/nodes/dependency-edges.ts +171 -0
  292. package/src/nodes/footnote-node.ts +171 -31
  293. package/src/nodes/group-node.ts +92 -214
  294. package/src/nodes/header-node.ts +255 -0
  295. package/src/nodes/include-node.ts +124 -110
  296. package/src/nodes/item-measure.ts +723 -0
  297. package/src/nodes/item-node.ts +358 -80
  298. package/src/nodes/marker-band.ts +406 -0
  299. package/src/nodes/marker-geometry.ts +1 -1
  300. package/src/nodes/milestone-node.ts +321 -136
  301. package/src/nodes/nowline-node.ts +87 -0
  302. package/src/nodes/parallel-node.ts +69 -38
  303. package/src/nodes/region-markers.ts +194 -0
  304. package/src/nodes/roadmap-node.ts +46 -950
  305. package/src/nodes/row-track.ts +217 -0
  306. package/src/nodes/sequence-item.ts +433 -0
  307. package/src/nodes/sequence-one.ts +40 -0
  308. package/src/nodes/swimlane-node.ts +66 -205
  309. package/src/nodes/wave-node.ts +609 -0
  310. package/src/non-working-display.ts +32 -0
  311. package/src/phases/date-window.ts +191 -0
  312. package/src/phases/finalize.ts +1303 -0
  313. package/src/phases/measure.ts +329 -0
  314. package/src/phases/place.ts +318 -0
  315. package/src/renderable.ts +23 -3
  316. package/src/resolve-today.ts +28 -25
  317. package/src/row-packer.ts +85 -84
  318. package/src/schedule.ts +362 -114
  319. package/src/start-rules.ts +113 -0
  320. package/src/start-terms.ts +38 -0
  321. package/src/status-dot.ts +81 -0
  322. package/src/style-resolution.ts +27 -57
  323. package/src/text-measure.ts +71 -0
  324. package/src/themes/contrast.ts +34 -0
  325. package/src/themes/dark.ts +28 -1
  326. package/src/themes/grayscale.ts +28 -1
  327. package/src/themes/index.ts +10 -7
  328. package/src/themes/light.ts +28 -1
  329. package/src/themes/shape.ts +38 -0
  330. package/src/themes/shared.ts +85 -93
  331. package/src/time-scale.ts +117 -19
  332. package/src/types.ts +529 -20
  333. package/src/view-preset.ts +520 -27
  334. package/src/wave-barrier.ts +242 -0
  335. package/src/wave-hatch.ts +25 -0
  336. package/src/wave-layout.ts +203 -0
  337. package/src/working-calendar.ts +875 -57
  338. package/src/working-span.ts +19 -0
package/dist/capacity.js CHANGED
@@ -18,22 +18,16 @@
18
18
  // All three helpers are pure — no AST, no theme, no side effects — so they
19
19
  // can be tested in isolation and reused by future capacity consumers (e.g.
20
20
  // the lane badge in m7 and the overload sweep in m8).
21
+ import { BUILTIN_CAPACITY_ICONS, propKey } from '@nowline/core/internal';
22
+ import { estimateTextWidth } from './text-measure.js';
21
23
  /**
22
- * Built-in `capacity-icon:` names the renderer understands directly. Stays in
23
- * sync with `BUILTIN_CAPACITY_ICONS` in `packages/core/.../nowline-validator.ts`
24
- * — the validator uses this set to decide whether a value is a known built-in;
25
- * the layout uses it to decide whether to forward the value as-is or
26
- * dereference it through the glyph map. Layout-side and validator-side can
27
- * diverge briefly during refactors but should converge before each release.
24
+ * Built-in `capacity-icon:` names the renderer understands directly
25
+ * (`BUILTIN_CAPACITY_ICONS` in core's `value-tables.ts`): the validator uses
26
+ * the list to decide whether a value is a known built-in; the layout uses it
27
+ * to decide whether to forward the value as-is or dereference it through the
28
+ * glyph map.
28
29
  */
29
- const BUILTIN_CAPACITY_ICONS = new Set([
30
- 'none',
31
- 'multiplier',
32
- 'person',
33
- 'people',
34
- 'points',
35
- 'time',
36
- ]);
30
+ const BUILTIN_CAPACITY_ICON_SET = new Set(BUILTIN_CAPACITY_ICONS);
37
31
  const POSITIVE_INT_RE = /^\d+$/;
38
32
  const POSITIVE_DECIMAL_RE = /^\d+\.\d+$/;
39
33
  const POSITIVE_PERCENT_RE = /^\d+(?:\.\d+)?%$/;
@@ -82,15 +76,6 @@ export function formatCapacityNumber(value) {
82
76
  s = s.replace(/\.$/, '');
83
77
  return s;
84
78
  }
85
- /**
86
- * Read a property value off a Langium-shaped EntityProperty, normalizing the
87
- * trailing-colon form. Validator-side uses the same trick — the grammar
88
- * stores `key` as the *raw* token, including the colon for `unicode:`-style
89
- * property keys.
90
- */
91
- function propKey(prop) {
92
- return prop.key.endsWith(':') ? prop.key.slice(0, -1) : prop.key;
93
- }
94
79
  function symbolUnicode(decl) {
95
80
  for (const p of decl.properties) {
96
81
  if (propKey(p) === 'unicode' && p.value)
@@ -122,7 +107,7 @@ function symbolUnicode(decl) {
122
107
  export function resolveCapacityIcon(icon, symbols) {
123
108
  if (icon === 'none')
124
109
  return null;
125
- if (BUILTIN_CAPACITY_ICONS.has(icon)) {
110
+ if (BUILTIN_CAPACITY_ICON_SET.has(icon)) {
126
111
  return {
127
112
  kind: 'builtin',
128
113
  name: icon,
@@ -152,12 +137,62 @@ export function estimateCapacitySuffixWidth(text, icon, fontSizePx) {
152
137
  // no separator gap, glyph width approx. one character.
153
138
  return (text.length + 1) * fontSizePx * 0.58;
154
139
  }
155
- // 0.1em separator + 1em glyph. Estimating the glyph as 1em (rather than
156
- // 0.58em, the per-character width) is intentional: SVG icons render at
157
- // their full font-size square, and most Unicode literals authors use for
158
- // capacity (★, 💰, ⚙) similarly read at near-em widths.
140
+ // Gap + 1em glyph. Estimating the glyph as 1em (rather than 0.58em, the
141
+ // per-character width) is intentional: SVG icons render at their full
142
+ // font-size square, and most Unicode literals authors use for capacity
143
+ // (★, 💰, ⚙) similarly read at near-em widths. A built-in SVG icon sits
144
+ // `CAPACITY_ICON_GAP_EM` past the number; a literal flows `0.1em` after
145
+ // it inside the `<text>`.
159
146
  const glyphWidthEm = 1.0;
160
- const gapEm = 0.1;
147
+ const gapEm = icon.kind === 'builtin' ? CAPACITY_ICON_GAP_EM : 0.1;
161
148
  return text.length * fontSizePx * 0.58 + (gapEm + glyphWidthEm) * fontSizePx;
162
149
  }
150
+ /**
151
+ * Em-distance the renderer reserves between an item's metaText and its
152
+ * capacity suffix (or any inline trailing token). Half a space's worth
153
+ * — wide enough to read as a separator, narrow enough not to look like
154
+ * a stray gap. SVG `<tspan dx>` honors this exactly so we don't depend
155
+ * on per-character estimation for the gap itself.
156
+ */
157
+ export const META_SUFFIX_DX_EM = 0.6;
158
+ /**
159
+ * Gap (em) between a capacity number and its built-in SVG icon. The icon's
160
+ * x is an estimate (the number's width at 0.58 em/char) while the number is
161
+ * drawn with real font metrics, and common UI fonts draw digits at up to
162
+ * ~0.64 em, so the gap has to absorb that error and still read as space.
163
+ */
164
+ const CAPACITY_ICON_GAP_EM = 0.25;
165
+ /**
166
+ * Where a built-in SVG capacity icon (person, people, points, time) sits:
167
+ * the px terms that, added in order to the start x of the text run the
168
+ * suffix is painted in, give the icon's x, at `fontSizePx`. Undefined for
169
+ * every other glyph (`null`, the multiplier, a literal), which the
170
+ * renderer paints inside the `<text>`.
171
+ *
172
+ * The terms are kept apart rather than summed so the renderer adds them to
173
+ * its x one at a time, in this order, exactly as it did when it measured
174
+ * them itself; a pre-summed offset can round differently at the last bit.
175
+ *
176
+ * With `metaText`, the run is the item meta line: the meta text's
177
+ * `estimateTextWidth` width and the `META_SUFFIX_DX_EM` separator (the
178
+ * first two terms are where the renderer starts the number), then the
179
+ * number's width and the gap. Without it, the number starts the run (an
180
+ * item with no meta text, or a lane badge): its width, then the gap.
181
+ * Both paths place the icon from the same number estimate and gap, so an
182
+ * item suffix reads like a lane badge.
183
+ */
184
+ export function capacityIconDxTerms(text, icon, fontSizePx, metaText) {
185
+ if (icon?.kind !== 'builtin' || icon.name === 'multiplier')
186
+ return undefined;
187
+ const gapPx = fontSizePx * CAPACITY_ICON_GAP_EM;
188
+ if (metaText) {
189
+ return [
190
+ estimateTextWidth(metaText, fontSizePx),
191
+ fontSizePx * META_SUFFIX_DX_EM,
192
+ estimateTextWidth(text, fontSizePx),
193
+ gapPx,
194
+ ];
195
+ }
196
+ return [estimateTextWidth(text, fontSizePx), gapPx];
197
+ }
163
198
  //# sourceMappingURL=capacity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capacity.js","sourceRoot":"","sources":["../src/capacity.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,sEAAsE;AACtE,0EAA0E;AAC1E,2EAA2E;AAC3E,eAAe;AACf,uEAAuE;AACvE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,YAAY;QAAE,OAAO,SAAS,CAAC;IAC7E,MAAM,KAAK,GAAG,UAAU,GAAG,oBAAoB,CAAC;IAChD,IAAI,QAAQ,EAAE,CAAC;QACX,OAAO;YACH,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC;YACvC,UAAU,GAAG,iBAAiB;YAC9B,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC;YACnC,KAAK;SACR,CAAC;IACN,CAAC;IACD,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { MilestonePlacement } from './nodes/milestone-node.js';
2
+ import type { PositionedIncludeRegion, PositionedMilestone, PositionedSwimlane, PositionedTrackChild } from './types.js';
3
+ /**
4
+ * Move a positioned item, group or parallel (and everything inside it)
5
+ * down by `dy`: its box, its inline-date glyphs, and for an item its
6
+ * label chips and `before:` overflow box.
7
+ */
8
+ export declare function translateTrackChildY(child: PositionedTrackChild, dy: number): void;
9
+ /** Move a swimlane band, its children and its nested lanes down by `dy`. */
10
+ export declare function translateSwimlaneY(lane: PositionedSwimlane, dy: number): void;
11
+ /** Move an include region, its nested lanes and its own markers down by `dy`. */
12
+ export declare function translateIncludeY(region: PositionedIncludeRegion, dy: number): void;
13
+ /**
14
+ * Move the chart part of a host milestone down by `dy`: its cut line and
15
+ * the slack arrows that start on an item. Its diamond and label sit in the
16
+ * header's marker band, outside the chart, and stay; so do the arrows that
17
+ * start on a marker row, which `positionMilestones` read from the final
18
+ * pack. `placement` is the milestone's placement, whose arrows are in the
19
+ * same order as the positioned ones.
20
+ */
21
+ export declare function translateMilestoneChartY(milestone: PositionedMilestone, placement: MilestonePlacement, dy: number): void;
22
+ //# sourceMappingURL=chart-translation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-translation.d.ts","sourceRoot":"","sources":["../src/chart-translation.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EACR,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CASlF;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAI7E;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAenF;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACpC,SAAS,EAAE,mBAAmB,EAC9B,SAAS,EAAE,kBAAkB,EAC7B,EAAE,EAAE,MAAM,GACX,IAAI,CAON"}
@@ -0,0 +1,83 @@
1
+ // The chart's one vertical translation.
2
+ //
3
+ // Placement lays the chart out in local coordinates, with its top at y 0
4
+ // (`phases/place.ts`). Its top on the canvas is known only once the header
5
+ // rows above it stop growing (a now-pill row reserved on an extended axis,
6
+ // a marker band the final pack grew), so finalize translates the whole
7
+ // chart there, once, on every layout (`growHeaderRows`, f7). An isolated
8
+ // region also moves its own lanes down below its marker band, once, while
9
+ // it is placed (`include-node.ts`).
10
+ //
11
+ // Every y the chart's positioned model carries is listed exactly once,
12
+ // here. A new y-bearing field on `PositionedItem` / `PositionedGroup` /
13
+ // `PositionedParallel` has to join it or it stays at its local y, a chart
14
+ // top above where it belongs on every render.
15
+ //
16
+ // Arrow attach ports are deliberately NOT stored anywhere that needs
17
+ // translating: they are derived from each item's final box when the
18
+ // arrows are built (see `item-port-geometry.ts`).
19
+ /**
20
+ * Move a positioned item, group or parallel (and everything inside it)
21
+ * down by `dy`: its box, its inline-date glyphs, and for an item its
22
+ * label chips and `before:` overflow box.
23
+ */
24
+ export function translateTrackChildY(child, dy) {
25
+ child.box.y += dy;
26
+ for (const pin of child.inlineDatePins ?? [])
27
+ pin.glyphTopLeft.y += dy;
28
+ if (child.kind === 'item') {
29
+ for (const chip of child.labelChips)
30
+ chip.box.y += dy;
31
+ if (child.overflowBox)
32
+ child.overflowBox.y += dy;
33
+ return;
34
+ }
35
+ for (const c of child.children)
36
+ translateTrackChildY(c, dy);
37
+ }
38
+ /** Move a swimlane band, its children and its nested lanes down by `dy`. */
39
+ export function translateSwimlaneY(lane, dy) {
40
+ lane.box.y += dy;
41
+ for (const child of lane.children)
42
+ translateTrackChildY(child, dy);
43
+ for (const nested of lane.nested)
44
+ translateSwimlaneY(nested, dy);
45
+ }
46
+ /** Move an include region, its nested lanes and its own markers down by `dy`. */
47
+ export function translateIncludeY(region, dy) {
48
+ region.box.y += dy;
49
+ for (const lane of region.nestedSwimlanes)
50
+ translateSwimlaneY(lane, dy);
51
+ for (const marker of [...(region.anchors ?? []), ...(region.milestones ?? [])]) {
52
+ marker.center.y += dy;
53
+ marker.labelBox.y += dy;
54
+ marker.cutTopY += dy;
55
+ marker.cutBottomY += dy;
56
+ }
57
+ for (const milestone of region.milestones ?? []) {
58
+ for (const arrow of milestone.slackArrows ?? [])
59
+ arrow.y += dy;
60
+ }
61
+ for (const edge of region.edges ?? []) {
62
+ for (const point of edge.waypoints)
63
+ point.y += dy;
64
+ }
65
+ }
66
+ /**
67
+ * Move the chart part of a host milestone down by `dy`: its cut line and
68
+ * the slack arrows that start on an item. Its diamond and label sit in the
69
+ * header's marker band, outside the chart, and stay; so do the arrows that
70
+ * start on a marker row, which `positionMilestones` read from the final
71
+ * pack. `placement` is the milestone's placement, whose arrows are in the
72
+ * same order as the positioned ones.
73
+ */
74
+ export function translateMilestoneChartY(milestone, placement, dy) {
75
+ milestone.cutTopY += dy;
76
+ milestone.cutBottomY += dy;
77
+ milestone.slackArrows?.forEach((arrow, i) => {
78
+ const start = placement.slackArrows?.[i];
79
+ if (start && 'y' in start)
80
+ arrow.y += dy;
81
+ });
82
+ }
83
+ //# sourceMappingURL=chart-translation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-translation.js","sourceRoot":"","sources":["../src/chart-translation.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AACvE,yEAAyE;AACzE,0EAA0E;AAC1E,oCAAoC;AACpC,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,0EAA0E;AAC1E,8CAA8C;AAC9C,EAAE;AACF,qEAAqE;AACrE,oEAAoE;AACpE,kDAAkD;AAUlD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAA2B,EAAE,EAAU;IACxE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,cAAc,IAAI,EAAE;QAAE,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACxB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU;YAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACtD,IAAI,KAAK,CAAC,WAAW;YAAE,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;QACjD,OAAO;IACX,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ;QAAE,oBAAoB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,kBAAkB,CAAC,IAAwB,EAAE,EAAU;IACnE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACjB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;QAAE,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,CA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AC;IAC3B,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACxC,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK;YAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { PositionedTrackChild } from './types.js';
2
+ /** Height (px) of a container's header band: title row, then the bracket. */
3
+ export declare const CONTAINER_HEADER_BAND_PX = 18;
4
+ /** The bracket's horizontal line, measured down from the header's top. Its
5
+ * end ticks run from here down to the body's top. */
6
+ export declare const CONTAINER_BRACKET_LINE_OFFSET_PX = 13;
7
+ /** Font size (px) of a header title. */
8
+ export declare const CONTAINER_HEADER_TITLE_FONT_SIZE_PX: number;
9
+ /** Baseline of a header title, measured down from the header's top. */
10
+ export declare const CONTAINER_HEADER_TITLE_BASELINE_PX = 10;
11
+ /** Padding (px) between a container's body edge and its content, above and
12
+ * below only. */
13
+ export declare const CONTAINER_BODY_PAD_PX = 6;
14
+ /** Clear space (px) the row keeps past a header that runs beyond its
15
+ * container's end, the same buffer an item's spilled caption keeps. */
16
+ export declare const CONTAINER_HEADER_CLEARANCE_PX = 6;
17
+ /** Fill opacity of a container body directly in a lane: its `bg`, as a
18
+ * light tint over the lane band. */
19
+ export declare const CONTAINER_BODY_FILL_OPACITY = 0.12;
20
+ /** Fill opacity of a container body nested one level, inside another
21
+ * container's body: a lighter tint, so the two stack to a step darker
22
+ * rather than to a new colour (specs/true-width-layout.md §8 O4). */
23
+ export declare const CONTAINER_NESTED_BODY_FILL_OPACITY = 0.06;
24
+ /** Nesting depth (1 for a container directly in a lane) past which a body
25
+ * is outlined instead of filled, so tints never compound three deep
26
+ * (specs/true-width-layout.md §8 O4). */
27
+ export declare const CONTAINER_MAX_FILLED_DEPTH = 2;
28
+ /** Vertical chrome a container reserves around its content. */
29
+ export interface ContainerChrome {
30
+ /** Header band height: 0 when the header would be empty. */
31
+ header: number;
32
+ /** Body padding above the content, and again below it. */
33
+ pad: number;
34
+ }
35
+ /**
36
+ * The chrome a container reserves. A wave-only group draws nothing and
37
+ * reserves nothing (specs/waves.md §9.7). Any other container pads its body;
38
+ * it keeps a header band when there is a title, an inline-date glyph or a
39
+ * visible bracket to put in it.
40
+ */
41
+ export declare function containerChrome(opts: {
42
+ drawn: boolean;
43
+ hasTitle: boolean;
44
+ hasPins: boolean;
45
+ hasBracket: boolean;
46
+ }): ContainerChrome;
47
+ /**
48
+ * Left x of the header title: the container's start, or one gap past an
49
+ * `after:` glyph, which takes the header's leftmost slot.
50
+ */
51
+ export declare function containerHeaderTitleX(boxX: number, hasAfterGlyph: boolean): number;
52
+ /**
53
+ * Estimated width (px) of a header title. Same pessimistic ~0.58 em/char
54
+ * heuristic the caption-spill math uses, so the row reserves a little more
55
+ * than the text needs rather than less.
56
+ */
57
+ export declare function containerHeaderTitleWidth(title: string): number;
58
+ /**
59
+ * Rightmost x a container's own header paints: its title (at its estimated
60
+ * width) and its inline-date glyphs. `-Infinity` for an item, or a container
61
+ * with neither.
62
+ */
63
+ export declare function containerHeaderRightX(block: PositionedTrackChild): number;
64
+ //# sourceMappingURL=container-header-geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-header-geometry.d.ts","sourceRoot":"","sources":["../src/container-header-geometry.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;sDACsD;AACtD,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,wCAAwC;AACxC,eAAO,MAAM,mCAAmC,QAAkB,CAAC;AAEnE,uEAAuE;AACvE,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD;kBACkB;AAClB,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;wEACwE;AACxE,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C;qCACqC;AACrC,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD;;sEAEsE;AACtE,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAEvD;;0CAE0C;AAC1C,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC5B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACvB,GAAG,eAAe,CAIlB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,MAAM,CAElF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAazE"}
@@ -0,0 +1,89 @@
1
+ // Container geometry — a group or parallel is drawn above and around its
2
+ // content, never beside it (specs/true-width-layout.md §3.3):
3
+ //
4
+ // header the title over a bracket that spans exactly the container's
5
+ // dates; the title starts at the container's start and may run
6
+ // past the bracket's end, and inline-date glyphs sit beside it.
7
+ // body a shaded rectangle spanning exactly the container's dates, from
8
+ // the header down to below the last child, padded above and below
9
+ // the content, never left or right.
10
+ //
11
+ // A container's `box` is the whole of it: `box.y` is the header's top,
12
+ // `box.y + headerHeight` the body's top, and `box.x` / `box.width` its dates.
13
+ // Layout (the reservation, the glyph placement, the row footprint) and the
14
+ // renderer (the bracket, the title, the body) both read these helpers, so the
15
+ // painted header and the space layout keeps for it can't drift apart.
16
+ import { INLINE_DATE_GLYPH_GAP_PX, INLINE_DATE_GLYPH_TILE_SIZE_PX } from './item-bar-geometry.js';
17
+ import { TEXT_SIZE_PX } from './themes/shared.js';
18
+ /** Height (px) of a container's header band: title row, then the bracket. */
19
+ export const CONTAINER_HEADER_BAND_PX = 18;
20
+ /** The bracket's horizontal line, measured down from the header's top. Its
21
+ * end ticks run from here down to the body's top. */
22
+ export const CONTAINER_BRACKET_LINE_OFFSET_PX = 13;
23
+ /** Font size (px) of a header title. */
24
+ export const CONTAINER_HEADER_TITLE_FONT_SIZE_PX = TEXT_SIZE_PX.xs;
25
+ /** Baseline of a header title, measured down from the header's top. */
26
+ export const CONTAINER_HEADER_TITLE_BASELINE_PX = 10;
27
+ /** Padding (px) between a container's body edge and its content, above and
28
+ * below only. */
29
+ export const CONTAINER_BODY_PAD_PX = 6;
30
+ /** Clear space (px) the row keeps past a header that runs beyond its
31
+ * container's end, the same buffer an item's spilled caption keeps. */
32
+ export const CONTAINER_HEADER_CLEARANCE_PX = 6;
33
+ /** Fill opacity of a container body directly in a lane: its `bg`, as a
34
+ * light tint over the lane band. */
35
+ export const CONTAINER_BODY_FILL_OPACITY = 0.12;
36
+ /** Fill opacity of a container body nested one level, inside another
37
+ * container's body: a lighter tint, so the two stack to a step darker
38
+ * rather than to a new colour (specs/true-width-layout.md §8 O4). */
39
+ export const CONTAINER_NESTED_BODY_FILL_OPACITY = 0.06;
40
+ /** Nesting depth (1 for a container directly in a lane) past which a body
41
+ * is outlined instead of filled, so tints never compound three deep
42
+ * (specs/true-width-layout.md §8 O4). */
43
+ export const CONTAINER_MAX_FILLED_DEPTH = 2;
44
+ /**
45
+ * The chrome a container reserves. A wave-only group draws nothing and
46
+ * reserves nothing (specs/waves.md §9.7). Any other container pads its body;
47
+ * it keeps a header band when there is a title, an inline-date glyph or a
48
+ * visible bracket to put in it.
49
+ */
50
+ export function containerChrome(opts) {
51
+ if (!opts.drawn)
52
+ return { header: 0, pad: 0 };
53
+ const hasHeader = opts.hasTitle || opts.hasPins || opts.hasBracket;
54
+ return { header: hasHeader ? CONTAINER_HEADER_BAND_PX : 0, pad: CONTAINER_BODY_PAD_PX };
55
+ }
56
+ /**
57
+ * Left x of the header title: the container's start, or one gap past an
58
+ * `after:` glyph, which takes the header's leftmost slot.
59
+ */
60
+ export function containerHeaderTitleX(boxX, hasAfterGlyph) {
61
+ return hasAfterGlyph ? boxX + INLINE_DATE_GLYPH_TILE_SIZE_PX + INLINE_DATE_GLYPH_GAP_PX : boxX;
62
+ }
63
+ /**
64
+ * Estimated width (px) of a header title. Same pessimistic ~0.58 em/char
65
+ * heuristic the caption-spill math uses, so the row reserves a little more
66
+ * than the text needs rather than less.
67
+ */
68
+ export function containerHeaderTitleWidth(title) {
69
+ return title.length * CONTAINER_HEADER_TITLE_FONT_SIZE_PX * 0.58;
70
+ }
71
+ /**
72
+ * Rightmost x a container's own header paints: its title (at its estimated
73
+ * width) and its inline-date glyphs. `-Infinity` for an item, or a container
74
+ * with neither.
75
+ */
76
+ export function containerHeaderRightX(block) {
77
+ if (block.kind === 'item')
78
+ return Number.NEGATIVE_INFINITY;
79
+ let right = Number.NEGATIVE_INFINITY;
80
+ const pins = block.inlineDatePins ?? [];
81
+ for (const pin of pins)
82
+ right = Math.max(right, pin.glyphTopLeft.x + pin.glyphSize);
83
+ if (block.title && block.headerHeight > 0) {
84
+ const hasAfter = pins.some((pin) => pin.side === 'after');
85
+ right = Math.max(right, containerHeaderTitleX(block.box.x, hasAfter) + containerHeaderTitleWidth(block.title));
86
+ }
87
+ return right;
88
+ }
89
+ //# sourceMappingURL=container-header-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-header-geometry.js","sourceRoot":"","sources":["../src/container-header-geometry.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8DAA8D;AAC9D,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACz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Property[], key: string): string | undefined;
3
- export declare function propValues(props: EntityProperty[], key: string): string[];
4
- export declare function parseDate(raw: string | undefined): Date | null;
1
+ export { parseIsoDate, propValue, propValues } from '@nowline/core/internal';
2
+ /** A UTC-midnight date as `YYYY-MM-DD`, the inverse of `parseIsoDate`. */
3
+ export declare function formatIsoDate(date: Date): string;
5
4
  //# sourceMappingURL=dsl-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dsl-utils.d.ts","sourceRoot":"","sources":["../src/dsl-utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAMpD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAIzE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAM9D"}
1
+ {"version":3,"file":"dsl-utils.d.ts","sourceRoot":"","sources":["../src/dsl-utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE7E,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEhD"}
package/dist/dsl-utils.js CHANGED
@@ -1,28 +1,11 @@
1
1
  // Tiny DSL utilities shared between `layout.ts` and the per-entity nodes
2
- // under `nodes/`. Kept intentionally trivial and pure: a `:`-trim,
3
- // property lookup helpers against the AST's `EntityProperty[]`, and an
4
- // ISO-date parser. Anything that needs configuration or non-trivial
5
- // resolution (durations, calendars, styles) stays in the modules that
6
- // own those concerns.
7
- function stripColon(key) {
8
- return key.endsWith(':') ? key.slice(0, -1) : key;
9
- }
10
- export function propValue(props, key) {
11
- return props.find((p) => stripColon(p.key) === key)?.value;
12
- }
13
- export function propValues(props, key) {
14
- const p = props.find((x) => stripColon(x.key) === key);
15
- if (!p)
16
- return [];
17
- return p.value !== undefined ? [p.value] : [...p.values];
18
- }
19
- export function parseDate(raw) {
20
- if (!raw)
21
- return null;
22
- const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(raw);
23
- if (!m)
24
- return null;
25
- const d = new Date(Date.UTC(parseInt(m[1], 10), parseInt(m[2], 10) - 1, parseInt(m[3], 10)));
26
- return Number.isNaN(d.getTime()) ? null : d;
2
+ // under `nodes/`. Kept intentionally trivial and pure: core's property
3
+ // lookups and strict ISO-date parser, re-exported, and a date formatter.
4
+ // Anything that needs configuration or non-trivial resolution (durations,
5
+ // calendars, styles) stays in the modules that own those concerns.
6
+ export { parseIsoDate, propValue, propValues } from '@nowline/core/internal';
7
+ /** A UTC-midnight date as `YYYY-MM-DD`, the inverse of `parseIsoDate`. */
8
+ export function formatIsoDate(date) {
9
+ return date.toISOString().slice(0, 10);
27
10
  }
28
11
  //# sourceMappingURL=dsl-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dsl-utils.js","sourceRoot":"","sources":["../src/dsl-utils.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,mEAAmE;AACnE,uEAAuE;AACvE,oEAAoE;AACpE,sEAAsE;AACtE,sBAAsB;AAItB,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAuB,EAAE,GAAW;IAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,KAA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