@nowline/layout 0.8.6 → 0.10.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/src/layout.ts CHANGED
@@ -1,108 +1,27 @@
1
- import type {
2
- EntityProperty,
3
- GroupBlock,
4
- ItemDeclaration,
5
- LabelDeclaration,
6
- NowlineFile,
7
- ParallelBlock,
8
- ResolveResult,
9
- SwimlaneDeclaration,
10
- } from '@nowline/core';
11
- import { isGroupBlock, isItemDeclaration, isParallelBlock } from '@nowline/core';
12
- import {
13
- addDays,
14
- daysBetween,
15
- deriveItemDurationDays,
16
- deriveTotalEffortDays,
17
- resolveDuration,
18
- } from './calendar.js';
19
- import {
20
- estimateCapacitySuffixWidth,
21
- formatCapacityNumber,
22
- parseCapacityValue,
23
- resolveCapacityIcon,
24
- } from './capacity.js';
25
- import { parseDate, propValue, propValues } from './dsl-utils.js';
26
- import {
27
- ChannelGrid,
28
- collectRoutingObstacles,
29
- type EdgeRouteRequest,
30
- routeChannelEdges,
31
- } from './edge-routing.js';
32
- import {
33
- HEADER_AUTHOR_FONT_SIZE_PX,
34
- HEADER_AUTHOR_LINE_HEIGHT_PX,
35
- HEADER_CARD_PADDING_BOTTOM,
36
- HEADER_CARD_PADDING_TOP,
37
- HEADER_CARD_PADDING_X,
38
- HEADER_TITLE_FONT_SIZE_PX,
39
- HEADER_TITLE_LINE_HEIGHT_PX,
40
- HEADER_TITLE_TO_AUTHOR_GAP_PX,
41
- } from './header-card-geometry.js';
42
- import { localeStrings } from './i18n.js';
43
- import { computeItemInlineDatePins, pickInlineDate } from './inline-date-pin-geometry.js';
44
- import {
45
- ITEM_CAPTION_INSET_X_PX,
46
- ITEM_CAPTION_META_BASELINE_OFFSET_PX,
47
- ITEM_CAPTION_SPILL_GAP_PX,
48
- ITEM_CAPTION_TITLE_FONT_SIZE_PX,
49
- ITEM_DECORATION_SPILL_GAP_PX,
50
- ITEM_FOOTNOTE_INDICATOR_STEP_PX,
51
- ITEM_LINK_ICON_TILE_SIZE_PX,
52
- ITEM_STATUS_DOT_RADIUS_PX,
53
- LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX,
54
- LABEL_CHIP_GAP_BETWEEN_PX,
55
- LABEL_CHIP_HEIGHT_PX,
56
- LABEL_CHIP_ROW_STEP_PX,
57
- MIN_BAR_WIDTH_FOR_DOT_PX,
58
- MIN_BAR_WIDTH_FOR_FOOTNOTE_PX,
59
- MIN_BAR_WIDTH_FOR_LINK_AND_DOT_PX,
60
- packSpillChips,
61
- } from './item-bar-geometry.js';
62
- import { type LayoutContext, newCursor, type TrackCursor } from './layout-context.js';
63
- import { GroupNode } from './nodes/group-node.js';
64
- import { ItemNode } from './nodes/item-node.js';
65
- import { ParallelNode } from './nodes/parallel-node.js';
1
+ // layoutRoadmap — the package's layout entry point: builds (or reuses) the
2
+ // day schedule and hands the roadmap to `RoadmapNode`, which runs the four
3
+ // layout phases (specs/layout-phases.md §3.1).
4
+
5
+ import type { NowlineFile, ResolveResult } from '@nowline/core';
6
+ import { buildWavePlan } from '@nowline/core';
7
+ import type { LogoDimensions } from './header-logo.js';
66
8
  import { RoadmapNode } from './nodes/roadmap-node.js';
67
- import { SwimlaneNode } from './nodes/swimlane-node.js';
68
- import { resolveLabelChipStyle, resolveStyle, type StyleContext } from './style-resolution.js';
9
+ import type { NonWorkingDisplay } from './non-working-display.js';
10
+ import { type RoadmapSchedule, scheduleRoadmap } from './schedule.js';
69
11
  import type { ThemeName } from './themes/index.js';
70
- import {
71
- GUTTER_PX,
72
- HEADER_BESIDE_MAX_WIDTH_PX,
73
- HEADER_BESIDE_MIN_WIDTH_PX,
74
- ITEM_INSET_PX,
75
- MIN_ITEM_WIDTH,
76
- NOW_PILL_LABEL_FONT_SIZE_PX,
77
- NOW_PILL_LABEL_INSET_X_PX,
78
- NOW_PILL_WIDTH_PX,
79
- PADDING_PX,
80
- PROGRESS_STRIP_HEIGHT_PX,
81
- } from './themes/shared.js';
82
- import type {
83
- BoundingBox,
84
- LinkIconKind,
85
- Point,
86
- PositionedCapacity,
87
- PositionedDependencyEdge,
88
- PositionedGroup,
89
- PositionedIncludeRegion,
90
- PositionedItem,
91
- PositionedLabelChip,
92
- PositionedNowline,
93
- PositionedParallel,
94
- PositionedRoadmap,
95
- PositionedSwimlane,
96
- PositionedTrackChild,
97
- StatusKind,
98
- } from './types.js';
99
- import type { ViewPreset } from './view-preset.js';
100
- import { daysPerUnit } from './working-calendar.js';
12
+ import type { PositionedRoadmap } from './types.js';
101
13
 
102
14
  export interface LayoutOptions {
103
15
  theme?: ThemeName;
104
16
  today?: Date;
105
- width?: number; // total SVG width in px; default 1280
17
+ /**
18
+ * Best-effort maximum canvas width in px. Unset (the default) sizes the
19
+ * canvas to its content. When the content is wider, pixels-per-day
20
+ * shrinks to fit, down to `MIN_PIXELS_PER_DAY`; spilled captions and
21
+ * run labels can still widen the canvas past it. See
22
+ * `specs/rendering.md` § Canvas width.
23
+ */
24
+ width?: number;
106
25
  /**
107
26
  * BCP-47 tag controlling axis labels, the now-pill string, and the
108
27
  * quarter prefix. Resolved by the caller (CLI flag → env vars). When
@@ -110,1444 +29,52 @@ export interface LayoutOptions {
110
29
  * then to `en-US`. See `specs/localization.md`.
111
30
  */
112
31
  locale?: string;
32
+ /**
33
+ * How a calendar's non-working days are drawn (specs/working-calendar.md
34
+ * §4.2). Overrides the file's `default roadmap non-working:` key; when
35
+ * undefined the key applies, then `hide`.
36
+ */
37
+ nonWorking?: NonWorkingDisplay;
38
+ /**
39
+ * Intrinsic size of the roadmap's `logo:` asset, read by the caller
40
+ * before layout (`loadLogo` in @nowline/renderer). Layout scales it to
41
+ * the `logo-size:` slot inside the header card. Leave it undefined when
42
+ * the file declares no logo or the asset could not be loaded: the
43
+ * header then lays out as if no logo were declared.
44
+ */
45
+ logo?: LogoDimensions;
46
+ /**
47
+ * A day schedule the caller already built for this roadmap
48
+ * (`scheduleRoadmap`, with the wave plan as `schedule.plan`). Layout
49
+ * reuses it when `schedule.resolved` is the very `ResolveResult` passed
50
+ * to `layoutRoadmap`, so a staging step that builds the plan and the
51
+ * schedule once hands them on (specs/scheduler-unification.md §3.6).
52
+ * A schedule built from another `ResolveResult` is ignored and rebuilt.
53
+ * Build it with the same `today` as this call's `today`: the window and
54
+ * the default start date come from it.
55
+ */
56
+ schedule?: RoadmapSchedule;
113
57
  }
114
58
 
115
59
  export type LayoutResult = PositionedRoadmap;
116
60
 
117
- function statusFromProp(raw: string | undefined): StatusKind {
118
- switch (raw) {
119
- case 'done':
120
- case 'completed':
121
- return 'done';
122
- case 'in-progress':
123
- case 'active':
124
- return 'in-progress';
125
- case 'at-risk':
126
- case 'blocked':
127
- case 'planned':
128
- return raw;
129
- case undefined:
130
- return 'planned';
131
- default:
132
- return 'neutral';
133
- }
134
- }
135
-
136
- function parseProgressFraction(raw: string | undefined): number {
137
- if (!raw) return 0;
138
- const m = /^(\d{1,3})%$/.exec(raw);
139
- if (!m) return 0;
140
- return Math.max(0, Math.min(100, parseInt(m[1], 10))) / 100;
141
- }
142
-
143
- // Resolve a `size:NAME` value to its size declaration's effort literal, used
144
- // by displays that want the literal duration string (not days). Returns the
145
- // original string for raw literals (`1w`, `3d`) and undefined for missing
146
- // values. m5 will adjust callers to apply capacity-aware derivation when the
147
- // caller wants the calendar duration; this helper continues to expose the
148
- // raw effort/duration literal for chips, captions, and tooltips.
149
- function resolveDurationLiteral(
150
- raw: string | undefined,
151
- ctx: { sizes: Map<string, import('./types.js').ResolvedSize> },
152
- ): string | undefined {
153
- if (!raw) return undefined;
154
- if (/^\d+(?:\.\d+)?[dwmqy]$/.test(raw) || /^\d+%$/.test(raw)) return raw;
155
- return ctx.sizes.get(raw)?.effortLiteral ?? raw;
156
- }
157
-
158
- // Resolve a person/team id to its declared title when present (id otherwise).
159
- function resolveActorDisplay(
160
- raw: string | undefined,
161
- ctx: {
162
- teams: Map<string, import('@nowline/core').TeamDeclaration>;
163
- persons: Map<string, import('@nowline/core').PersonDeclaration>;
164
- },
165
- ): string | undefined {
166
- if (!raw) return undefined;
167
- return ctx.teams.get(raw)?.title ?? ctx.persons.get(raw)?.title ?? raw;
168
- }
169
-
170
- function parseLinkIcon(link: string | undefined): { icon: LinkIconKind; href?: string } {
171
- if (!link) return { icon: 'none' };
172
- const lower = link.toLowerCase();
173
- if (lower.includes('linear.app')) return { icon: 'linear', href: link };
174
- if (lower.includes('github.com')) return { icon: 'github', href: link };
175
- if (lower.includes('atlassian.net') || lower.includes('jira.')) {
176
- return { icon: 'jira', href: link };
177
- }
178
- return { icon: 'generic', href: link };
179
- }
180
-
181
- // Bake a named/hex color from a label's `bg:` or `fg:` into the chip style.
182
- function buildLabelChip(
183
- label: LabelDeclaration,
184
- ctx: StyleContext,
185
- x: number,
186
- y: number,
187
- maxWidth?: number,
188
- ): PositionedLabelChip {
189
- const style = resolveLabelChipStyle(label, ctx);
190
- // Prefer the short name (id) when it exists — chips inside an item bar
191
- // are tight; the long title risks overflowing.
192
- const text = label.name ?? label.title ?? '';
193
- const padKey = style.padding === 'none' ? 'xs' : style.padding;
194
- const pad = PADDING_PX[padKey as keyof typeof PADDING_PX];
195
- let width = Math.max(20, Math.round(text.length * 5.5 + pad * 2));
196
- if (maxWidth !== undefined) width = Math.min(width, maxWidth);
197
- return {
198
- text,
199
- style,
200
- box: { x, y, width, height: LABEL_CHIP_HEIGHT_PX },
201
- };
202
- }
203
-
204
- // Sequence a set of nodes into a single horizontal track. `parallelInside`
205
- // indicates the caller is inside a ParallelBlock and each child occupies a
206
- // fresh sub-track (caller passes a new cursor per call).
207
- function sequenceItem(
208
- node: ItemDeclaration,
209
- cursor: TrackCursor,
210
- ctx: LayoutContext,
211
- ownerOverride?: string,
212
- ): PositionedItem {
213
- const props = node.properties;
214
- const style = resolveStyle('item', props, ctx.styleCtx);
215
- // Sizing precedence (specs/dsl.md § "Sizing precedence"):
216
- // 1. `duration:LITERAL` wins as the calendar duration — `size:NAME`
217
- // becomes a pure annotation (chip only).
218
- // 2. Otherwise, `size:NAME` derives `effort ÷ capacity` (default
219
- // capacity = 1).
220
- // The validator requires one of the two on every item.
221
- const sizeRef = propValue(props, 'size');
222
- const sizeResolved = sizeRef ? (ctx.sizes.get(sizeRef) ?? null) : null;
223
- const durationDays = deriveItemDurationDays(props, ctx.sizes, ctx.cal);
224
- // Total work in single-engineer days, used below to normalize a literal
225
- // `remaining:` value into a progress fraction. Stays per-engineer
226
- // regardless of the item's `capacity:` so a `remaining:1w` always means
227
- // "one engineer-week of work left".
228
- const totalEffortDays = deriveTotalEffortDays(props, ctx.sizes, ctx.cal);
229
- const afterRaw = propValues(props, 'after');
230
- const beforeRaw = propValues(props, 'before');
231
- const dateRaw = propValue(props, 'date');
232
- const remainingDays = resolveDuration(propValue(props, 'remaining'), ctx.sizes, ctx.cal);
233
-
234
- // Resolve start x: explicit date > after-chain > cursor position.
235
- // `after:` accepts both entity ids (looked up in entityRightEdges) and
236
- // inline ISO date literals (resolved through the time scale). The
237
- // validator enforces "at most one inline date per direction" so at most
238
- // one element will hit the date path per item.
239
- let startX = cursor.x;
240
- const explicitDate = parseDate(dateRaw);
241
- if (explicitDate) {
242
- const xd = ctx.scale.forwardWithinDomain(explicitDate);
243
- if (xd !== null) startX = xd;
244
- } else if (afterRaw.length > 0) {
245
- let maxEnd = cursor.x;
246
- for (const ref of afterRaw) {
247
- const inlineDate = parseDate(ref);
248
- if (inlineDate) {
249
- const xd = ctx.scale.forwardWithinDomain(inlineDate);
250
- if (xd !== null) maxEnd = Math.max(maxEnd, xd);
251
- continue;
252
- }
253
- const endX = ctx.entityRightEdges.get(ref);
254
- if (endX !== undefined) maxEnd = Math.max(maxEnd, endX);
255
- }
256
- startX = Math.max(cursor.x, maxEnd);
257
- }
258
-
259
- const naturalWidth = Math.max(MIN_ITEM_WIDTH, durationDays * ctx.timeline.pixelsPerDay);
260
- // Logical extent — what the item "owns" in time (used for chaining,
261
- // `after:` lookups, dependency-arrow attach points).
262
- const logicalLeft = startX;
263
- const logicalRight = startX + naturalWidth;
264
-
265
- const linkRaw = propValue(props, 'link');
266
- const linkInfo = parseLinkIcon(linkRaw);
267
- const hasLinkIcon = linkInfo.icon !== 'none';
268
-
269
- // Pre-compute the chip row geometry — every chip renders at its
270
- // NATURAL text-fit width on a single horizontal row, never
271
- // truncated. We only need the total row width here so we can
272
- // decide whether the row fits inside the bar; concrete chip
273
- // (x, y) placement comes after ItemNode resolves the visible
274
- // bar box below.
275
- //
276
- // Chips sit at the bar's bottom (just above the progress strip)
277
- // and the link icon (when present) sits in the bar's UPPER-LEFT
278
- // corner, so they no longer share a vertical band — chips have
279
- // the full caption-inset-bounded inner width regardless of
280
- // whether a link icon is rendered. The link-icon column's
281
- // horizontal cost is borne by the caption (title/meta) inset
282
- // instead, see `ItemNode`.
283
- const visualWidthPredict = Math.max(MIN_ITEM_WIDTH, naturalWidth - 2 * ITEM_INSET_PX);
284
- const labelIds = propValues(props, 'labels');
285
- const chipSamples: { id: LabelDeclaration; width: number }[] = [];
286
- for (const labelId of labelIds) {
287
- const label = ctx.labels.get(labelId);
288
- if (!label) continue;
289
- const sample = buildLabelChip(label, ctx.styleCtx, 0, 0);
290
- chipSamples.push({ id: label, width: sample.box.width });
291
- }
292
- let chipRowWidth = 0;
293
- for (let i = 0; i < chipSamples.length; i += 1) {
294
- if (i > 0) chipRowWidth += LABEL_CHIP_GAP_BETWEEN_PX;
295
- chipRowWidth += chipSamples[i].width;
296
- }
297
- const chipInsideAvailWidth = Math.max(0, visualWidthPredict - 2 * ITEM_CAPTION_INSET_X_PX);
298
- const chipsOutside = chipSamples.length > 0 && chipRowWidth > chipInsideAvailWidth;
299
-
300
- // Handle `before:` — item must end by the earliest cap. Each cap is
301
- // either an entity id (looked up in entityLeftEdges) or an inline ISO
302
- // date literal (resolved through the time scale). The validator enforces
303
- // "at most one inline date per direction" so at most one element per
304
- // before-list will hit the date path.
305
- let hasOverflow = false;
306
- let overflowBox: BoundingBox | undefined;
307
- let overflowAnchorId: string | undefined;
308
- if (beforeRaw.length > 0) {
309
- let earliestCapX: number | undefined;
310
- let earliestCapRef: string | undefined;
311
- for (const ref of beforeRaw) {
312
- const inlineDate = parseDate(ref);
313
- const capX = inlineDate
314
- ? (ctx.scale.forwardWithinDomain(inlineDate) ?? undefined)
315
- : ctx.entityLeftEdges.get(ref);
316
- if (capX === undefined) continue;
317
- if (earliestCapX === undefined || capX < earliestCapX) {
318
- earliestCapX = capX;
319
- earliestCapRef = ref;
320
- }
321
- }
322
- if (earliestCapX !== undefined && logicalRight > earliestCapX) {
323
- hasOverflow = true;
324
- overflowBox = {
325
- x: earliestCapX,
326
- y: cursor.y,
327
- width: logicalRight - earliestCapX,
328
- height: ctx.bandScale.bandwidth(),
329
- };
330
- overflowAnchorId = earliestCapRef;
331
- }
332
- }
333
-
334
- // Progress fraction
335
- const statusRaw = propValue(props, 'status');
336
- const status = statusFromProp(statusRaw);
337
- let progress = parseProgressFraction(statusRaw);
338
- if (progress === 0 && status === 'done') progress = 1;
339
- const remainingPctMatch = /^(\d{1,3})%$/.exec(propValue(props, 'remaining') ?? '');
340
- if (progress === 0 && status === 'in-progress' && remainingPctMatch) {
341
- const pct = Math.max(0, Math.min(100, parseInt(remainingPctMatch[1], 10))) / 100;
342
- progress = 1 - pct;
343
- }
344
- if (progress === 0 && status === 'in-progress' && remainingDays > 0 && totalEffortDays > 0) {
345
- // `remaining:` literal is single-engineer days; `totalEffortDays`
346
- // is also single-engineer days, so the ratio is unit-correct.
347
- // Clamp to [0, 1] — the renderer paints 100% remaining when the
348
- // author overshot, matching the spec's "warn-and-clamp" overflow
349
- // behavior. (Validation defers the warn to layout-time today; a
350
- // future diagnostics channel can surface it back to the user.)
351
- progress = Math.max(0, Math.min(1, 1 - remainingDays / totalEffortDays));
352
- }
353
-
354
- // Apply the status-tinted item background when the resolved bg is still
355
- // theme-default. Authors who set explicit `bg:` keep their override.
356
- // Per m2d handoff Resolution 3: layout owns this so the renderer stays
357
- // palette-dumb.
358
- const STATUS_TINT_LIGHT: Record<StatusKind, string> = {
359
- done: '#ecfdf5',
360
- 'in-progress': '#eff6ff',
361
- 'at-risk': '#fffbeb',
362
- blocked: '#fee2e2',
363
- planned: '#f8fafc',
364
- neutral: '#f8fafc',
365
- };
366
- const STATUS_TINT_DARK: Record<StatusKind, string> = {
367
- done: '#052e16',
368
- 'in-progress': '#172554',
369
- 'at-risk': '#422006',
370
- blocked: '#7f1d1d',
371
- planned: '#1e293b',
372
- neutral: '#1e293b',
373
- };
374
- const STATUS_TINT_GREY: Record<StatusKind, string> = {
375
- done: '#ebebeb',
376
- 'in-progress': '#e4e4e4',
377
- 'at-risk': '#eeeeee',
378
- blocked: '#dcdcdc',
379
- planned: '#f5f5f5',
380
- neutral: '#f5f5f5',
381
- };
382
- const STATUS_BORDER: Record<StatusKind, string> = {
383
- done: ctx.styleCtx.theme.status.done,
384
- 'in-progress': ctx.styleCtx.theme.status.inProgress,
385
- 'at-risk': ctx.styleCtx.theme.status.atRisk,
386
- blocked: ctx.styleCtx.theme.status.blocked,
387
- planned: ctx.styleCtx.theme.status.planned,
388
- neutral: ctx.styleCtx.theme.status.neutral,
389
- };
390
- const themeName = ctx.styleCtx.theme.name;
391
- const isDark = themeName === 'dark';
392
- const themeDefaultBg = isDark ? '#0f172a' : '#ffffff';
393
- const themeDefaultFg = themeName === 'grayscale' ? '#9e9e9e' : '#94a3b8';
394
- if (style.bg === themeDefaultBg) {
395
- style.bg =
396
- themeName === 'grayscale'
397
- ? STATUS_TINT_GREY[status]
398
- : isDark
399
- ? STATUS_TINT_DARK[status]
400
- : STATUS_TINT_LIGHT[status];
401
- }
402
- if (style.fg === themeDefaultFg) {
403
- style.fg = STATUS_BORDER[status];
404
- }
405
-
406
- // Pre-format the secondary line shown inside the item bar.
407
- //
408
- // Driver-only meta line (`rendering.md` § Item size chip): exactly one
409
- // leading token — the explicit non-empty `duration:LITERAL` when set,
410
- // otherwise the size chip when `size:` drives. Never both; bar width
411
- // already encodes derived calendar span for sized items.
412
- const explicitDurationLiteral = propValue(props, 'duration');
413
- const durationDrives =
414
- !!explicitDurationLiteral && /^\d+(?:\.\d+)?[dwmqy]$/.test(explicitDurationLiteral);
415
- const sizeChipText = sizeResolved ? (sizeResolved.title ?? sizeResolved.name) : '';
416
- const driverToken: string | undefined = durationDrives
417
- ? explicitDurationLiteral
418
- : sizeChipText || undefined;
419
- const remainingRaw = propValue(props, 'remaining');
420
- const remainingLiteral = resolveDurationLiteral(remainingRaw, ctx);
421
- const ownerDisplay = resolveActorDisplay(ownerOverride ?? propValue(props, 'owner'), ctx);
422
- const metaHead = (): string => [driverToken, ownerDisplay].filter(Boolean).join(' ');
423
- let metaText: string | undefined;
424
- if (status === 'in-progress' && remainingLiteral) {
425
- const head = metaHead();
426
- metaText = head
427
- ? `${head} — ${remainingLiteral} remaining`
428
- : `${remainingLiteral} remaining`;
429
- } else if (status === 'in-progress' && progress > 0 && progress < 1) {
430
- const pct = Math.round((1 - progress) * 100);
431
- const head = metaHead();
432
- metaText = head ? `${head} — ${pct}% remaining` : `${pct}% remaining`;
433
- } else if (ownerDisplay || driverToken) {
434
- metaText = metaHead() || undefined;
435
- }
436
-
437
- // Capacity suffix — appended after metaText at render time. Layout's
438
- // job here is to (a) parse the value out of `capacity:`, (b) format
439
- // the display number, (c) resolve `capacity-icon` to either a
440
- // built-in name or a literal string the renderer can paint directly,
441
- // and (d) feed the suffix's estimated width into ItemNode so spill
442
- // detection accounts for `2w 5×` rather than just `2w`. The suffix
443
- // disappears entirely when capacity is missing or non-positive.
444
- const capacityRaw = propValue(props, 'capacity');
445
- const capacityValue = parseCapacityValue(capacityRaw);
446
- let capacity: PositionedCapacity | null = null;
447
- let capacityTrailingWidth = 0;
448
- if (capacityValue !== null) {
449
- const capacityText = formatCapacityNumber(capacityValue);
450
- const capacityIcon = resolveCapacityIcon(style.capacityIcon, ctx.symbols);
451
- capacity = { value: capacityValue, text: capacityText, icon: capacityIcon };
452
- const META_FONT_SIZE_PX_LOCAL = 11;
453
- // Add a small leading separator (a single space's worth) only when
454
- // the suffix sits next to existing meta text, so `m 5×` has air
455
- // between the driver token and the count. Standalone suffix needs no
456
- // leading separator.
457
- const separatorWidth = metaText ? estimateTextWidth(' ', META_FONT_SIZE_PX_LOCAL) : 0;
458
- capacityTrailingWidth =
459
- separatorWidth +
460
- estimateCapacitySuffixWidth(capacityText, capacityIcon, META_FONT_SIZE_PX_LOCAL);
461
- }
462
-
463
- // Visual bar + caption-spill decision delegated to ItemNode. Logical
464
- // extent (used by chaining and `after:` lookups) stays on
465
- // logicalLeft/logicalRight; ItemNode computes the inset visual box and
466
- // whether the title+meta line overflows the bar's inner padded width.
467
- const titleStr = node.title ?? node.name ?? '';
468
- const placed = new ItemNode({
469
- id: node.name ?? '',
470
- title: titleStr,
471
- logicalLeftX: logicalLeft,
472
- logicalRightX: logicalRight,
473
- metaText,
474
- metaTrailingWidth: capacityTrailingWidth,
475
- hasLinkIcon,
476
- }).place({ x: logicalLeft, y: cursor.y }, { time: ctx.scale, bands: ctx.bandScale, style });
477
- const itemBox = placed.box;
478
- const bandwidth = ctx.bandScale.bandwidth();
479
-
480
- // Narrow-bar decoration spill — when a bar is too narrow to host
481
- // the dot, link icon, or footnote with its full inset, those
482
- // glyphs render in the same spill column as the (already-
483
- // spilling) caption text, in reading order
484
- // `[bar][dot][icon][title][footnote#…][meta]`. Each decoration's
485
- // threshold is independent (a 20-px-wide bar can host the dot
486
- // but not the icon, etc.); see the `MIN_BAR_WIDTH_FOR_*`
487
- // constants in `item-bar-geometry`.
488
- //
489
- // Forcing `textSpills` when `iconSpills` keeps the icon and
490
- // title visually adjacent — otherwise a spilled icon would
491
- // float at `bar.right + 6` while the title stayed inside the
492
- // bar, breaking the icon→title affordance.
493
- const dotSpills = itemBox.width < MIN_BAR_WIDTH_FOR_DOT_PX;
494
- const iconSpills = hasLinkIcon && itemBox.width < MIN_BAR_WIDTH_FOR_LINK_AND_DOT_PX;
495
- const footnoteSpillsForNarrow = itemBox.width < MIN_BAR_WIDTH_FOR_FOOTNOTE_PX;
496
- const textSpills = placed.textSpills || iconSpills;
497
-
498
- // Label chips lay out left → right at natural text width.
499
- //
500
- // INSIDE the bar (chipsOutside === false): single row,
501
- // left-aligned at the caption inset, anchored just above the
502
- // bottom progress strip.
503
- //
504
- // OUTSIDE the bar (chipsOutside === true): the whole chip set
505
- // moves to the spill column at `bar.right + 6`. Within the
506
- // column, chips pack into rows capped at the bar's visual
507
- // width — see `packSpillChips`. Row 0 sits at the same y the
508
- // single-row would have used; subsequent rows stack DOWNWARD by
509
- // one `LABEL_CHIP_ROW_STEP_PX`.
510
- //
511
- // When chips spill, the BAR ITSELF GROWS DOWNWARD so the chip
512
- // column reads as enclosed by the bar — the painted footprint
513
- // of the bar is `bandwidth + chipBarExtra` and the bottom
514
- // progress strip moves with the new bottom edge. Chip Y is
515
- // anchored to the ORIGINAL bandwidth (relative to the bar's
516
- // top), not to the grown box.height, so row 0 stays where a
517
- // single-row chip would naturally render and rows 1..N grow
518
- // downward into the new bar area.
519
- //
520
- // When the caption ALSO spills (`textSpills && chipsOutside`),
521
- // row 0's y drops below the meta baseline so the spilled stack
522
- // reads `title → meta → chip-row-0 → chip-row-1 → ...` at a
523
- // single column inside the (now-taller) bar.
524
- let chipPack: ReturnType<typeof packSpillChips<LabelDeclaration>> | null = null;
525
- if (chipsOutside) {
526
- chipPack = packSpillChips(chipSamples, itemBox.width);
527
- }
528
- const chipRowCount = chipPack ? chipPack.rows.length : chipSamples.length > 0 ? 1 : 0;
529
- // Capacity suffix renders on the same line as metaText. Treat the meta
530
- // line as present whenever EITHER metaText OR a capacity suffix will
531
- // paint, so chip-row pitch reserves the right amount of vertical space.
532
- const hasMeta = metaText !== undefined || capacity !== null;
533
- const chipBarExtra = computeChipBarExtra(
534
- chipsOutside,
535
- textSpills,
536
- chipRowCount,
537
- bandwidth,
538
- hasMeta,
539
- );
540
- if (chipBarExtra > 0) {
541
- itemBox.height = bandwidth + chipBarExtra;
542
- }
543
-
544
- const labelChips: PositionedLabelChip[] = [];
545
- const baseChipY =
546
- itemBox.y +
547
- bandwidth -
548
- PROGRESS_STRIP_HEIGHT_PX -
549
- LABEL_CHIP_HEIGHT_PX -
550
- LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX;
551
- const captionStackChipY =
552
- itemBox.y + ITEM_CAPTION_META_BASELINE_OFFSET_PX + LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX;
553
- // Inside-bar chips with meta need to clear the meta baseline —
554
- // the natural `baseChipY` (anchored to bar bottom) sits above
555
- // the meta line at typical bandwidths, so the chip rect would
556
- // overlap the meta text vertically. Use whichever Y is lower.
557
- // Outside-bar chips already reuse `captionStackChipY` when the
558
- // caption ALSO spills; with caption inside we don't need to
559
- // shift them since they're horizontally separated from the meta.
560
- const stackBelowMeta =
561
- (chipsOutside && textSpills) || (!chipsOutside && hasMeta && chipSamples.length > 0);
562
- const chipRow0Y = stackBelowMeta ? Math.max(baseChipY, captionStackChipY) : baseChipY;
563
- const chipStartX = chipsOutside
564
- ? itemBox.x + itemBox.width + ITEM_CAPTION_SPILL_GAP_PX
565
- : itemBox.x + ITEM_CAPTION_INSET_X_PX;
566
-
567
- let chipsRightX = chipStartX;
568
- if (chipPack) {
569
- for (let r = 0; r < chipPack.rows.length; r += 1) {
570
- const rowY = chipRow0Y + r * LABEL_CHIP_ROW_STEP_PX;
571
- let rowCursorX = chipStartX;
572
- for (const sample of chipPack.rows[r]) {
573
- const chip = buildLabelChip(sample.id, ctx.styleCtx, rowCursorX, rowY);
574
- labelChips.push(chip);
575
- rowCursorX += chip.box.width + LABEL_CHIP_GAP_BETWEEN_PX;
576
- }
577
- const rowRight = rowCursorX - LABEL_CHIP_GAP_BETWEEN_PX;
578
- if (rowRight > chipsRightX) chipsRightX = rowRight;
579
- }
580
- } else {
581
- let rowCursorX = chipStartX;
582
- for (const sample of chipSamples) {
583
- const chip = buildLabelChip(sample.id, ctx.styleCtx, rowCursorX, chipRow0Y);
584
- labelChips.push(chip);
585
- rowCursorX += chip.box.width + LABEL_CHIP_GAP_BETWEEN_PX;
586
- }
587
- chipsRightX = chipSamples.length > 0 ? rowCursorX - LABEL_CHIP_GAP_BETWEEN_PX : chipStartX;
588
- }
589
-
590
- // Footnote superscript indicators. Per `specs/dsl.md`, footnotes
591
- // attach via the `on:` property on the footnote declaration only —
592
- // there is no forward `footnote:` property on the host entity. Walk
593
- // `footnoteHosts` (built from each footnote's `on:` list) and emit
594
- // a superscript for every footnote that names this item.
595
- const footnoteIndicatorSet = new Set<number>();
596
- if (node.name) {
597
- for (const [fid, hosts] of ctx.footnoteHosts.entries()) {
598
- if (hosts.includes(node.name)) {
599
- const n = ctx.footnoteIndex.get(fid);
600
- if (n !== undefined) footnoteIndicatorSet.add(n);
601
- }
602
- }
603
- }
604
- const footnoteIndicators = [...footnoteIndicatorSet].sort((a, b) => a - b);
605
-
606
- const owner = ownerDisplay ?? ownerOverride ?? propValue(props, 'owner');
607
- const description = node.description?.text;
608
-
609
- // Footnote glyphs only need to spill when there's at least one
610
- // indicator AND the bar is too narrow to host them at the inset-
611
- // right anchor. Compute the final boolean here once we know the
612
- // indicator count.
613
- const footnoteSpills = footnoteIndicators.length > 0 && footnoteSpillsForNarrow;
614
-
615
- // Spill-column x positions for the decorations. The cluster
616
- // mirrors the in-bar reading order so users see the same visual
617
- // hierarchy whether everything fits inside or trails off to the
618
- // right:
619
- //
620
- // In-bar (default): [icon] [title] [¹²] [dot]
621
- // Spilled (narrow): [bar] [icon?] [title][¹²?] [dot?]
622
- //
623
- // The dot lives at the trailing edge in BOTH cases — pushing it
624
- // to the LEFT of the title (with the title trailing it) read as
625
- // the dot belonging to the next item, not this one. A missing
626
- // decoration just collapses out of the row; e.g. an item with
627
- // no link AND a too-narrow bar gives `[bar] [title] [dot]`.
628
- //
629
- // `decorationsRightX` is the furthest right edge any spilled
630
- // glyph reaches; the row-packer uses it (alongside spilled-chip
631
- // width) to reserve x-extent so the next chained item bumps to
632
- // a fresh row instead of landing under the spilled cluster.
633
- const SPILL_COLUMN_X0 = itemBox.x + itemBox.width + ITEM_CAPTION_SPILL_GAP_PX;
634
- let spillCursor = SPILL_COLUMN_X0;
635
- // Advance the cursor by `gap` IFF something has already been
636
- // placed in the column — keeps the cluster from leaving a
637
- // dangling gap past its final glyph (which would over-reserve
638
- // x-extent and shift downstream items).
639
- let needGap = false;
640
- let iconSpillX: number | null = null;
641
- if (iconSpills) {
642
- if (needGap) spillCursor += ITEM_DECORATION_SPILL_GAP_PX;
643
- iconSpillX = spillCursor;
644
- spillCursor = iconSpillX + ITEM_LINK_ICON_TILE_SIZE_PX;
645
- needGap = true;
646
- }
647
- let captionSpillWidth = 0;
648
- if (textSpills) {
649
- if (needGap) spillCursor += ITEM_DECORATION_SPILL_GAP_PX;
650
- const titleW = estimateTextWidth(titleStr, ITEM_CAPTION_TITLE_FONT_SIZE_PX);
651
- // Spill column width is the wider of the title and the *full* meta
652
- // line (text + capacity suffix). `capacityTrailingWidth` is 0 when
653
- // no capacity suffix is rendered, so this stays a no-op for items
654
- // without `capacity:`.
655
- const metaW = (metaText ? estimateTextWidth(metaText, 11) : 0) + capacityTrailingWidth;
656
- captionSpillWidth = Math.max(titleW, metaW);
657
- spillCursor += captionSpillWidth;
658
- needGap = true;
659
- }
660
- let footnoteSpillStartX: number | null = null;
661
- if (footnoteSpills) {
662
- if (needGap) spillCursor += ITEM_DECORATION_SPILL_GAP_PX;
663
- footnoteSpillStartX = spillCursor;
664
- spillCursor += footnoteIndicators.length * ITEM_FOOTNOTE_INDICATOR_STEP_PX;
665
- needGap = true;
666
- }
667
- let dotSpillCx: number | null = null;
668
- if (dotSpills) {
669
- if (needGap) spillCursor += ITEM_DECORATION_SPILL_GAP_PX;
670
- dotSpillCx = spillCursor + ITEM_STATUS_DOT_RADIUS_PX;
671
- spillCursor = dotSpillCx + ITEM_STATUS_DOT_RADIUS_PX;
672
- needGap = true;
673
- }
674
- const decorationsRightX = Math.max(itemBox.x + itemBox.width, spillCursor);
675
-
676
- const id = node.name;
677
- // Reference-target edges resolve `after:` / `before:` lookups, so only
678
- // EXPLICIT ids register here — an id-less item never becomes a
679
- // referenceable target. Entity edges live in LOGICAL space so chained
680
- // items / `after:` references sit on the column boundary, not on the
681
- // visually inset bar edge. The visible 12 px gutter between bars then
682
- // becomes a clean attach corridor.
683
- if (id) {
684
- ctx.entityLeftEdges.set(id, logicalLeft);
685
- ctx.entityRightEdges.set(id, logicalRight);
686
- }
687
- // Drawing / flow maps key on a registration handle EVERY item has: the
688
- // explicit id when present, else a synthetic, non-referenceable handle
689
- // (see `syntheticItemKey`). This lets a title-only item register its own
690
- // dependency-arrow target geometry and join flow-key dedup without
691
- // entering the human-referenceable namespace above.
692
- const drawKey = id ?? syntheticItemKey(node);
693
- ctx.entityMidpoints.set(drawKey, {
694
- x: (logicalLeft + logicalRight) / 2,
695
- y: itemBox.y + itemBox.height / 2,
696
- });
697
- // Visual edges — where dependency arrows actually attach. These sit
698
- // ITEM_INSET_PX inside the column boundaries so the arrows emerge from
699
- // the painted bar edge instead of the inter-column gutter. See
700
- // LayoutContext.entityVisualLeftX/RightX.
701
- ctx.entityVisualLeftX.set(drawKey, itemBox.x);
702
- ctx.entityVisualRightX.set(drawKey, itemBox.x + itemBox.width);
703
- // Dependency-arrow source point. Default = the bar's right edge at row
704
- // midpoint. When the caption spills past the bar's right edge
705
- // (`textSpills`), the spilled title / meta occupy the area immediately
706
- // right of the bar at row midline. Keep X on the bar's right edge so the
707
- // arrow visually leaves the bar's side, but drop Y to the vertical center
708
- // of the bottom progress strip so the arrow runs UNDERNEATH the spilled
709
- // text rather than through it. Mirrors the slack-arrow attach below.
710
- const arrowSource: Point = textSpills
711
- ? {
712
- x: itemBox.x + itemBox.width,
713
- y: itemBox.y + itemBox.height - PROGRESS_STRIP_HEIGHT_PX / 2,
714
- }
715
- : {
716
- x: itemBox.x + itemBox.width,
717
- y: itemBox.y + itemBox.height / 2,
718
- };
719
- ctx.itemArrowSource.set(drawKey, arrowSource);
720
- ctx.itemFlowKey.set(drawKey, ctx.currentFlowKey);
721
- // Slack-arrow attach Y. Defaults to the bar's row midpoint; when the
722
- // caption spills past the bar's right edge, drop to the progress-strip's
723
- // vertical center so the arrow aligns with the bottom-edge progress bar
724
- // instead of running through the adjacent title/meta text. The `/ 2`
725
- // keeps the attach point on the strip's vertical center if
726
- // `PROGRESS_STRIP_HEIGHT_PX` is ever bumped.
727
- const slackAttachY = textSpills
728
- ? itemBox.y + itemBox.height - PROGRESS_STRIP_HEIGHT_PX / 2
729
- : itemBox.y + itemBox.height / 2;
730
- ctx.itemSlackAttachY.set(drawKey, slackAttachY);
731
-
732
- cursor.x = logicalRight;
733
- cursor.maxX = Math.max(cursor.maxX, cursor.x);
734
- // The next row in a parallel/group/lane starts at
735
- // `cursor.y + cursor.height`. Default pitch is `bandScale.step()`
736
- // (bandwidth + inter-row gap). When the bar grew to enclose a
737
- // spilled chip column, the pitch grows by the SAME amount so the
738
- // inter-row gap stays constant — the next row's bar starts
739
- // `step − bandwidth` px below the (now-taller) bar bottom.
740
- cursor.height = Math.max(cursor.height, ctx.bandScale.step() + chipBarExtra);
741
-
742
- const inlineDatePins = computeItemInlineDatePins({
743
- box: itemBox,
744
- afterDate: pickInlineDate(afterRaw),
745
- beforeDate: pickInlineDate(beforeRaw),
746
- hasLinkIcon,
747
- footnoteCount: footnoteIndicators.length,
748
- });
749
-
750
- const result: PositionedItem = {
751
- kind: 'item',
752
- id,
753
- title: titleStr,
754
- box: itemBox,
755
- status,
756
- progressFraction: progress,
757
- footnoteIndicators,
758
- labelChips,
759
- chipsOutside,
760
- chipsRightX,
761
- linkIcon: linkInfo.icon,
762
- linkHref: linkInfo.href,
763
- hasOverflow,
764
- overflowBox,
765
- overflowAnchorId,
766
- owner,
767
- description,
768
- metaText,
769
- textSpills,
770
- dotSpills,
771
- iconSpills,
772
- footnoteSpills,
773
- dotSpillCx,
774
- iconSpillX,
775
- footnoteSpillStartX,
776
- decorationsRightX,
777
- capacity,
778
- size: sizeResolved,
779
- style,
780
- inlineDatePins: inlineDatePins.length > 0 ? inlineDatePins : undefined,
781
- };
782
- return result;
783
- }
784
-
785
- function sequenceParallel(
786
- node: ParallelBlock,
787
- cursor: TrackCursor,
788
- ctx: LayoutContext,
789
- ): PositionedParallel {
790
- return new ParallelNode(node, { sequenceOne, newCursor }).place(cursor, ctx);
791
- }
792
-
793
- function sequenceGroup(node: GroupBlock, cursor: TrackCursor, ctx: LayoutContext): PositionedGroup {
794
- return new GroupNode(node, {
795
- sequenceItem,
796
- sequenceOne,
797
- resolveChildStart,
798
- newCursor,
799
- estimateTextWidth,
800
- predictItemChipExtraHeight,
801
- }).place(cursor, ctx);
802
- }
803
-
804
- function sequenceOne(
805
- node: ItemDeclaration | GroupBlock | ParallelBlock,
806
- cursor: TrackCursor,
807
- ctx: LayoutContext,
808
- ): PositionedTrackChild {
809
- if (isItemDeclaration(node)) return sequenceItem(node, cursor, ctx);
810
- if (isParallelBlock(node)) return sequenceParallel(node, cursor, ctx);
811
- if (isGroupBlock(node)) return sequenceGroup(node, cursor, ctx);
812
- throw new Error(
813
- `Unknown swimlane child type: ${(node as { $type?: string }).$type ?? 'unknown'}`,
814
- );
815
- }
816
-
817
- // Rough px-width estimate for sans-serif text. Intentionally pessimistic
818
- // (uses ~0.58 em per char) so we err toward "doesn't fit" and trigger a
819
- // row bump rather than draw an item with a clipped title.
820
- function estimateTextWidth(text: string, fontSize: number): number {
821
- return text.length * fontSize * 0.58;
822
- }
823
-
824
- /**
825
- * Internal drawing handle for an id-less item. Title-only items have no
826
- * `node.name`, yet they still need a stable key to register their own
827
- * dependency-arrow target geometry and join flow-key dedup. The handle is
828
- * derived from the item's source position so it is deterministic and
829
- * byte-stable, and the `#item@line:col` form cannot be produced by the
830
- * grammar's id rule — so `after:` / `before:` / `on:` can never resolve to it
831
- * (an id-less item stays non-referenceable; declare an explicit id to
832
- * reference it). Distinct items always start at distinct positions, so the
833
- * handle is unique within a file.
834
- */
835
- function syntheticItemKey(node: ItemDeclaration): string {
836
- const start = node.$cstNode?.range.start;
837
- return `#item@${start ? start.line + 1 : 0}:${start ? start.character + 1 : 0}`;
838
- }
839
-
840
- /**
841
- * Compute the extra vertical px the bar grows when its spilled chip
842
- * column would otherwise extend below the (single-row) bottom. The
843
- * bar's painted footprint becomes `bandwidth + chipBarExtra`, the
844
- * progress strip rides the new bottom, and chip rows pack inside
845
- * the taller bar (anchored from the bar TOP so row 0 doesn't shift
846
- * when the bar grows).
847
- *
848
- * Returns 0 when chips fit inside the bar, when there are no chips,
849
- * or when the spilled column happens to fit inside `bandwidth` (a
850
- * single row with the caption inside, for instance).
851
- *
852
- * The same number is the row-pitch increase the swimlane / group
853
- * row-packer needs to reserve so the next row clears the taller
854
- * bar — `cursor.height = step + chipBarExtra` and the predict
855
- * helper returns this verbatim.
856
- */
857
- function computeChipBarExtra(
858
- chipsOutside: boolean,
859
- captionSpills: boolean,
860
- chipRowCount: number,
861
- bandwidth: number,
862
- hasMeta: boolean,
863
- ): number {
864
- if (chipRowCount === 0) return 0;
865
- // Row 0 anchor relative to the bar's TOP — three regimes:
866
- //
867
- // 1. chipsOutside + captionSpills → chips stack below the
868
- // spilled meta line (`captionStackTop`).
869
- // 2. chips INSIDE the bar AND meta is present → chip top must
870
- // clear the meta baseline; the natural `baseTop` sits
871
- // ABOVE the meta line at default bandwidth (=56), so we
872
- // take whichever is lower of base/captionStack.
873
- // 3. otherwise (in-bar w/o meta, or chipsOutside w/o caption
874
- // spill) → row 0 hugs the bar bottom at `baseTop`.
875
- //
876
- // Cases (2) and (3-with-multi-row-spill) can both grow the bar;
877
- // case (3-with-single-row-inside-no-meta) never grows.
878
- const baseTop =
879
- bandwidth -
880
- PROGRESS_STRIP_HEIGHT_PX -
881
- LABEL_CHIP_HEIGHT_PX -
882
- LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX;
883
- const captionStackTop =
884
- ITEM_CAPTION_META_BASELINE_OFFSET_PX + LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX;
885
- let chipRow0Top: number;
886
- if (chipsOutside && captionSpills) {
887
- chipRow0Top = captionStackTop;
888
- } else if (!chipsOutside && hasMeta) {
889
- chipRow0Top = Math.max(baseTop, captionStackTop);
890
- } else {
891
- chipRow0Top = baseTop;
892
- }
893
- const lastRowBottomTop =
894
- chipRow0Top + (chipRowCount - 1) * LABEL_CHIP_ROW_STEP_PX + LABEL_CHIP_HEIGHT_PX;
895
- // The bar must be tall enough to fit `lastRowBottomTop` plus a
896
- // GAP above the progress strip plus the progress strip itself.
897
- const requiredHeight =
898
- lastRowBottomTop + LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX + PROGRESS_STRIP_HEIGHT_PX;
899
- return Math.max(0, requiredHeight - bandwidth);
900
- }
901
-
902
- /**
903
- * Predict an item's bar growth (and therefore row-pitch growth) for
904
- * a multi-row spilled chip column BEFORE the bar is sequenced. Used
905
- * by the swimlane / group row-packer so neighboring rows on later
906
- * rows are positioned correctly without a retroactive shift.
907
- *
908
- * Mirrors the chip-pack + caption-spill arithmetic in
909
- * `sequenceItem` so prediction and placement agree byte-for-byte.
910
- */
911
- function predictItemChipExtraHeight(item: ItemDeclaration, ctx: LayoutContext): number {
912
- const props = item.properties;
913
- const labelIds = propValues(props, 'labels');
914
- if (labelIds.length === 0) return 0;
915
- const durationDays = deriveItemDurationDays(props, ctx.sizes, ctx.cal);
916
- const naturalWidth = Math.max(MIN_ITEM_WIDTH, durationDays * ctx.timeline.pixelsPerDay);
917
- const visualWidth = Math.max(MIN_ITEM_WIDTH, naturalWidth - 2 * ITEM_INSET_PX);
918
- const samples: { id: LabelDeclaration; width: number }[] = [];
919
- for (const labelId of labelIds) {
920
- const label = ctx.labels.get(labelId);
921
- if (!label) continue;
922
- const sample = buildLabelChip(label, ctx.styleCtx, 0, 0);
923
- samples.push({ id: label, width: sample.box.width });
924
- }
925
- if (samples.length === 0) return 0;
926
- let chipRowWidth = 0;
927
- for (let i = 0; i < samples.length; i += 1) {
928
- if (i > 0) chipRowWidth += LABEL_CHIP_GAP_BETWEEN_PX;
929
- chipRowWidth += samples[i].width;
930
- }
931
- const insideAvail = Math.max(0, visualWidth - 2 * ITEM_CAPTION_INSET_X_PX);
932
- const chipsOutside = chipRowWidth > insideAvail;
933
-
934
- // `hasMeta` mirrors `metaText !== undefined` in `sequenceItem`,
935
- // plus the capacity suffix (which renders on the same meta line).
936
- // metaText is set whenever an item declares a duration, owner,
937
- // or remaining — so we just check those four props. Status
938
- // strings (in-progress) only matter when paired with one of
939
- // these, so this is an upper bound (false-positives still grow
940
- // the bar by exactly the same amount as the renderer would, so
941
- // they stay byte-stable).
942
- const hasMeta =
943
- propValue(props, 'duration') !== undefined ||
944
- propValue(props, 'size') !== undefined ||
945
- propValue(props, 'owner') !== undefined ||
946
- propValue(props, 'remaining') !== undefined ||
947
- propValue(props, 'capacity') !== undefined;
948
-
949
- const titleStr = item.title ?? item.name ?? '';
950
- const titleW = titleStr ? estimateTextWidth(titleStr, ITEM_CAPTION_TITLE_FONT_SIZE_PX) : 0;
951
- const captionSpills = titleW > insideAvail;
952
- const pack = chipsOutside ? packSpillChips(samples, visualWidth) : null;
953
- const chipRowCount = pack ? pack.rows.length : samples.length > 0 ? 1 : 0;
954
- return computeChipBarExtra(
955
- chipsOutside,
956
- captionSpills,
957
- chipRowCount,
958
- ctx.bandScale.bandwidth(),
959
- hasMeta,
960
- );
961
- }
962
-
963
- // Resolve the desired startX for a swimlane child, honoring `date:` (fixed
964
- // pin) > `start:` (fixed pin) > `after:` (chain after refs) > sequential
965
- // default (continue from `seqDefault`, which is the lane's rightmost time
966
- // cursor across all rows).
967
- //
968
- // `after:` accepts both entity ids (looked up in `ctx.entityRightEdges`) and
969
- // inline ISO date literals (looked up via `ctx.scale.forwardWithinDomain`).
970
- // The validator already enforces "at most one inline date per direction" so
971
- // at most one element in the list will hit the date path.
972
- function resolveChildStart(
973
- props: EntityProperty[],
974
- seqDefault: number,
975
- laneLeftX: number,
976
- ctx: LayoutContext,
977
- ): number {
978
- const explicitDate =
979
- parseDate(propValue(props, 'date')) ?? parseDate(propValue(props, 'start'));
980
- if (explicitDate) {
981
- const xd = ctx.scale.forwardWithinDomain(explicitDate);
982
- if (xd !== null) return xd;
983
- }
984
- const afterRefs = propValues(props, 'after');
985
- if (afterRefs.length > 0) {
986
- let maxEnd = laneLeftX;
987
- for (const ref of afterRefs) {
988
- const inlineDate = parseDate(ref);
989
- if (inlineDate) {
990
- const xd = ctx.scale.forwardWithinDomain(inlineDate);
991
- if (xd !== null) maxEnd = Math.max(maxEnd, xd);
992
- continue;
993
- }
994
- const endX = ctx.entityRightEdges.get(ref);
995
- if (endX !== undefined) maxEnd = Math.max(maxEnd, endX);
996
- }
997
- return Math.max(laneLeftX, maxEnd);
998
- }
999
- return seqDefault;
1000
- }
1001
-
1002
- function _buildSwimlane(
1003
- lane: SwimlaneDeclaration,
1004
- y: number,
1005
- bandIndex: number,
1006
- ctx: LayoutContext,
1007
- ): { positioned: PositionedSwimlane; usedHeight: number } {
1008
- return new SwimlaneNode(
1009
- { lane, bandIndex },
1010
- {
1011
- sequenceItem,
1012
- sequenceOne,
1013
- resolveChildStart,
1014
- newCursor,
1015
- estimateTextWidth,
1016
- predictItemChipExtraHeight,
1017
- },
1018
- ).place({ x: ctx.timeline.originX, y }, ctx);
1019
- }
1020
-
1021
- // Card-sizing constants for beside-mode headers live in
1022
- // `header-card-geometry.ts` so the renderer can paint with the same
1023
- // numbers the layout sized against. Title and author both wrap at
1024
- // MAX_CONTENT_WIDTH (= MAX header width minus 2 * padding). The card
1025
- // hugs its content in the MIN..MAX range and grows vertically when
1026
- // wrapping is needed.
1027
- //
1028
- // Left margin between the canvas's left edge and the visible card. The
1029
- // matching right-side breathing room is owned by `GUTTER_PX` (the canonical
1030
- // content gutter, applied between `chartLeftX` and `originX`), so the gap
1031
- // from the card's right edge to the timeline strip is the same as the gap
1032
- // between two adjacent items.
1033
- const HEADER_CARD_OUTER_PAD = 6;
1034
-
1035
- interface SizedHeader {
1036
- titleLines: string[];
1037
- authorLines: string[];
1038
- cardWidth: number;
1039
- cardHeight: number;
1040
- boxWidth: number;
1041
- }
1042
-
1043
- // Word-wrap `text` so that no line wider than `maxWidth` (in px). Long single
1044
- // words are kept on their own line even if they overflow — we never split a
1045
- // word in the middle.
1046
- function wrapText(text: string, maxWidth: number, fontSize: number): string[] {
1047
- if (!text) return [];
1048
- const words = text.split(/\s+/).filter((w) => w.length > 0);
1049
- if (words.length === 0) return [];
1050
- const lines: string[] = [];
1051
- let cur = '';
1052
- for (const word of words) {
1053
- const trial = cur ? `${cur} ${word}` : word;
1054
- if (cur && estimateTextWidth(trial, fontSize) > maxWidth) {
1055
- lines.push(cur);
1056
- cur = word;
1057
- } else {
1058
- cur = trial;
1059
- }
1060
- }
1061
- if (cur) lines.push(cur);
1062
- return lines;
1063
- }
1064
-
1065
- function sizeBesideHeader(title: string, author: string | undefined): SizedHeader {
1066
- const maxContentWidth = HEADER_BESIDE_MAX_WIDTH_PX - 2 * HEADER_CARD_PADDING_X;
1067
- const titleLines = wrapText(title, maxContentWidth, HEADER_TITLE_FONT_SIZE_PX);
1068
- const authorLines = wrapText(author ?? '', maxContentWidth, HEADER_AUTHOR_FONT_SIZE_PX);
1069
-
1070
- let widest = 0;
1071
- for (const line of titleLines)
1072
- widest = Math.max(widest, estimateTextWidth(line, HEADER_TITLE_FONT_SIZE_PX));
1073
- for (const line of authorLines)
1074
- widest = Math.max(widest, estimateTextWidth(line, HEADER_AUTHOR_FONT_SIZE_PX));
1075
-
1076
- const naturalCardWidth = widest + 2 * HEADER_CARD_PADDING_X;
1077
- // `HEADER_BESIDE_{MIN,MAX}_WIDTH_PX` bound the **boxWidth** (= cardWidth
1078
- // + left outer pad). Subtract one outer pad to derive the cardWidth
1079
- // bounds.
1080
- const cardWidth = Math.max(
1081
- HEADER_BESIDE_MIN_WIDTH_PX - HEADER_CARD_OUTER_PAD,
1082
- Math.min(HEADER_BESIDE_MAX_WIDTH_PX - HEADER_CARD_OUTER_PAD, naturalCardWidth),
1083
- );
1084
-
1085
- const titleBlockHeight =
1086
- titleLines.length > 0 ? (titleLines.length - 1) * HEADER_TITLE_LINE_HEIGHT_PX : 0;
1087
- const authorBlockHeight =
1088
- authorLines.length > 0
1089
- ? HEADER_TITLE_TO_AUTHOR_GAP_PX +
1090
- (authorLines.length - 1) * HEADER_AUTHOR_LINE_HEIGHT_PX
1091
- : 0;
1092
- const cardHeight =
1093
- HEADER_CARD_PADDING_TOP + titleBlockHeight + authorBlockHeight + HEADER_CARD_PADDING_BOTTOM;
1094
-
1095
- // `boxWidth` only includes the LEFT outer pad — the right-side breathing
1096
- // room between the card and the chart is owned by `GUTTER_PX` in
1097
- // `RoadmapNode`. So `boxWidth` doubles as `chartLeftX` (the card's right
1098
- // edge in canvas coordinates).
1099
- const boxWidth = cardWidth + HEADER_CARD_OUTER_PAD;
1100
- return { titleLines, authorLines, cardWidth, cardHeight, boxWidth };
1101
- }
1102
-
1103
- // Compute a sensible [startDate, endDate] window.
1104
- //
1105
- // Precedence:
1106
- // 1. Explicit `length:` on the roadmap declaration wins.
1107
- // 2. Otherwise we derive the end day from the actual content extent
1108
- // (latest item end, anchor date, milestone date/after, and today's
1109
- // now-line if it falls past the content). This keeps the rendered
1110
- // chart from defaulting to a 180-day desert when the content only
1111
- // spans a few weeks.
1112
- // 3. As a last resort (no content + no length), fall back to a small
1113
- // 4-week placeholder so an empty roadmap still draws a sensible axis.
1114
- function computeDateWindow(
1115
- file: NowlineFile,
1116
- ctx: {
1117
- cal: import('./calendar.js').CalendarConfig;
1118
- sizes: Map<string, import('./types.js').ResolvedSize>;
1119
- },
1120
- resolved: ResolveResult,
1121
- today: Date | undefined,
1122
- scale: ViewPreset,
1123
- ): { startDate: Date; endDate: Date } {
1124
- const roadmap = file.roadmapDecl;
1125
- const props = roadmap?.properties ?? [];
1126
- const startRaw = propValue(props, 'start');
1127
- // Spec (`specs/dsl.md`): "A roadmap with no `start:` and no dates is
1128
- // purely relative — renderers choose their own reference date (e.g.
1129
- // the day of rendering)." Use the caller's `today` (the resolved
1130
- // `--now`) when present so the start lines up with the now-line, and
1131
- // fall back to actual today's UTC midnight otherwise. Either default
1132
- // is dangerous — output drifts day-to-day — but it's strictly better
1133
- // than the legacy "Jan 1 of the current year" fallback that drifted
1134
- // every January 1 by 365 days at once. Authors should set `start:`
1135
- // for any roadmap they want to be reproducible.
1136
- const startDate = parseDate(startRaw) ?? defaultStartDate(today);
1137
- const lengthRaw = propValue(props, 'length');
1138
- if (lengthRaw) {
1139
- const days = literalDays(lengthRaw, ctx.cal);
1140
- if (days > 0) {
1141
- return { startDate, endDate: addDays(startDate, days) };
1142
- }
1143
- }
1144
- const contentDays = computeContentEndDay(resolved, ctx, startDate, today);
1145
- const tickDays = daysPerUnit(scale.unit, ctx.cal);
1146
- // Round up to the smallest tick boundary that is `>= contentDays`. When
1147
- // the latest content lands exactly on a tick boundary the chart ends
1148
- // exactly there (no extra trailing tick); otherwise we extend to the
1149
- // next tick so the right edge always sits on a labelled column.
1150
- const padded =
1151
- contentDays > 0 ? Math.ceil(contentDays / tickDays) * tickDays : 4 * ctx.cal.daysPerWeek;
1152
- return { startDate, endDate: addDays(startDate, Math.max(1, padded)) };
1153
- }
1154
-
1155
- /**
1156
- * Reference date used when a roadmap omits `start:`. Prefers the
1157
- * caller-supplied `today` (UTC midnight already, when it comes from
1158
- * the CLI); falls back to actual today's UTC midnight so the layout
1159
- * still produces a valid window for direct API callers that don't pass
1160
- * a `today`. Date components are taken in UTC to match `parseDate`.
1161
- */
1162
- function defaultStartDate(today: Date | undefined): Date {
1163
- const ref = today ?? new Date();
1164
- return new Date(Date.UTC(ref.getUTCFullYear(), ref.getUTCMonth(), ref.getUTCDate()));
1165
- }
1166
-
1167
- function literalDays(literal: string, cal: import('./calendar.js').CalendarConfig): number {
1168
- const m = /^(\d+(?:\.\d+)?)([dwmqy])$/.exec(literal);
1169
- if (!m) return 0;
1170
- const n = parseFloat(m[1]);
1171
- switch (m[2]) {
1172
- case 'd':
1173
- return n;
1174
- case 'w':
1175
- return n * cal.daysPerWeek;
1176
- case 'm':
1177
- return n * cal.daysPerMonth;
1178
- case 'q':
1179
- return n * cal.daysPerQuarter;
1180
- case 'y':
1181
- return n * cal.daysPerYear;
1182
- default:
1183
- return 0;
1184
- }
1185
- }
1186
-
1187
- // Walk every dated/sequenced entity in the resolved content and return the
1188
- // latest day-offset from `startDate`. Mirrors the sequencer's start-rules
1189
- // (date: > start: > after: > previous-in-lane) without producing positions.
1190
- function computeContentEndDay(
1191
- resolved: ResolveResult,
1192
- ctx: {
1193
- cal: import('./calendar.js').CalendarConfig;
1194
- sizes: Map<string, import('./types.js').ResolvedSize>;
1195
- },
1196
- startDate: Date,
1197
- today: Date | undefined,
1198
- ): number {
1199
- const itemEnd = new Map<string, number>();
1200
- const anchorEnd = new Map<string, number>();
1201
- const milestoneEnd = new Map<string, number>();
1202
- let maxDay = 0;
1203
-
1204
- // Resolve a single `after:` element to a day-offset from `startDate`.
1205
- // The element is either an entity id (looked up in itemEnd / anchorEnd /
1206
- // milestoneEnd) or an inline ISO date literal (converted directly via
1207
- // `daysBetween`). The validator already enforces "at most one inline date
1208
- // per direction", so at most one element per list will hit the date path.
1209
- const resolveAfterDay = (ref: string): number => {
1210
- const inlineDate = parseDate(ref);
1211
- if (inlineDate) return daysBetween(startDate, inlineDate);
1212
- if (itemEnd.has(ref)) return itemEnd.get(ref)!;
1213
- if (anchorEnd.has(ref)) return anchorEnd.get(ref)!;
1214
- if (milestoneEnd.has(ref)) return milestoneEnd.get(ref)!;
1215
- return 0;
1216
- };
1217
-
1218
- // Pre-seed anchors fixed by `date:` so items that reference them get a
1219
- // valid end-day during the lane walk.
1220
- for (const anchor of resolved.content.anchors.values()) {
1221
- const d = parseDate(propValue(anchor.properties, 'date'));
1222
- if (d && anchor.name) {
1223
- const day = daysBetween(startDate, d);
1224
- anchorEnd.set(anchor.name, day);
1225
- maxDay = Math.max(maxDay, day);
1226
- }
1227
- }
1228
-
1229
- const walkLane = (children: SwimlaneDeclaration['content'], baselineEnd: number): number => {
1230
- let prevEnd = baselineEnd;
1231
- for (const child of children) {
1232
- if (child.$type === 'DescriptionDirective') continue;
1233
- prevEnd = walkNode(child as ItemDeclaration | GroupBlock | ParallelBlock, prevEnd);
1234
- maxDay = Math.max(maxDay, prevEnd);
1235
- }
1236
- return prevEnd;
1237
- };
1238
-
1239
- const walkNode = (
1240
- node: ItemDeclaration | GroupBlock | ParallelBlock,
1241
- prevEnd: number,
1242
- ): number => {
1243
- if (isItemDeclaration(node)) {
1244
- const dur = deriveItemDurationDays(node.properties, ctx.sizes, ctx.cal);
1245
- const dateProp = parseDate(propValue(node.properties, 'date'));
1246
- const startProp = parseDate(propValue(node.properties, 'start'));
1247
- const afterRefs = propValues(node.properties, 'after');
1248
- let start = prevEnd;
1249
- if (dateProp) {
1250
- start = daysBetween(startDate, dateProp);
1251
- } else if (startProp) {
1252
- start = daysBetween(startDate, startProp);
1253
- } else if (afterRefs.length > 0) {
1254
- start = Math.max(prevEnd, ...afterRefs.map(resolveAfterDay));
1255
- }
1256
- const end = start + dur;
1257
- if (node.name) itemEnd.set(node.name, end);
1258
- return end;
1259
- }
1260
- if (isParallelBlock(node)) {
1261
- // All children share the parallel's start; the block's effective
1262
- // end is the maximum child end. The parallel's own `after:`
1263
- // (including inline-date pins) widens that shared start.
1264
- const afterRefs = propValues(node.properties, 'after');
1265
- const containerStart =
1266
- afterRefs.length > 0
1267
- ? Math.max(prevEnd, ...afterRefs.map(resolveAfterDay))
1268
- : prevEnd;
1269
- let parallelEnd = containerStart;
1270
- for (const child of node.content) {
1271
- if (child.$type === 'DescriptionDirective') continue;
1272
- const childEnd = walkNode(child as ItemDeclaration | GroupBlock, containerStart);
1273
- parallelEnd = Math.max(parallelEnd, childEnd);
1274
- }
1275
- return parallelEnd;
1276
- }
1277
- if (isGroupBlock(node)) {
1278
- // The group's own `after:` (including inline-date pins) widens
1279
- // the baseline before walking the inner sequential lane.
1280
- const afterRefs = propValues(node.properties, 'after');
1281
- const containerStart =
1282
- afterRefs.length > 0
1283
- ? Math.max(prevEnd, ...afterRefs.map(resolveAfterDay))
1284
- : prevEnd;
1285
- return walkLane(node.content as SwimlaneDeclaration['content'], containerStart);
1286
- }
1287
- return prevEnd;
1288
- };
1289
-
1290
- for (const lane of resolved.content.swimlanes.values()) {
1291
- walkLane(lane.content, 0);
1292
- }
1293
-
1294
- // Milestones (after items so `after:` references can resolve).
1295
- for (const ms of resolved.content.milestones.values()) {
1296
- const d = parseDate(propValue(ms.properties, 'date'));
1297
- if (d) {
1298
- const day = daysBetween(startDate, d);
1299
- if (ms.name) milestoneEnd.set(ms.name, day);
1300
- maxDay = Math.max(maxDay, day);
1301
- continue;
1302
- }
1303
- const after = propValues(ms.properties, 'after');
1304
- if (after.length > 0) {
1305
- // Milestones disallow inline date literals at the validator
1306
- // level (rule 24a — milestones already have `date:`). The
1307
- // shared `resolveAfterDay` helper still handles such input
1308
- // gracefully if it slips past, treating the date as the
1309
- // milestone's effective day.
1310
- const day = Math.max(0, ...after.map(resolveAfterDay));
1311
- if (ms.name) milestoneEnd.set(ms.name, day);
1312
- maxDay = Math.max(maxDay, day);
1313
- }
1314
- }
1315
-
1316
- // Isolated includes contribute their own content extent against the
1317
- // shared timeline.
1318
- for (const region of resolved.content.isolatedRegions) {
1319
- const nestedMax = computeContentEndDay(
1320
- {
1321
- config: region.config,
1322
- content: region.content,
1323
- diagnostics: [],
1324
- processedFiles: new Set(),
1325
- },
1326
- ctx,
1327
- startDate,
1328
- undefined,
1329
- );
1330
- maxDay = Math.max(maxDay, nestedMax);
1331
- }
1332
-
1333
- if (today) {
1334
- const t = daysBetween(startDate, today);
1335
- if (t > 0) maxDay = Math.max(maxDay, t);
1336
- }
1337
-
1338
- return maxDay;
1339
- }
1340
-
1341
- function buildDependencies(
1342
- items: Map<string, ItemDeclaration>,
1343
- swimlanes: PositionedSwimlane[],
1344
- includes: PositionedIncludeRegion[],
1345
- ctx: LayoutContext,
1346
- ): PositionedDependencyEdge[] {
1347
- // m2g+: collect every painted item bar + every visible parallel /
1348
- // group bracket once, hand to the channel router so it can drop
1349
- // vertical legs in clean inter-column gutters and nudge away from
1350
- // bracket strokes that would otherwise be hugged.
1351
- const grid = new ChannelGrid(collectRoutingObstacles(swimlanes, includes));
1352
-
1353
- interface Pending {
1354
- fromId: string;
1355
- toId: string;
1356
- }
1357
- const requests: EdgeRouteRequest[] = [];
1358
- const pending: Pending[] = [];
1359
-
1360
- for (const [id, item] of items) {
1361
- const afters = propValues(item.properties, 'after');
1362
- const targetMid = ctx.entityMidpoints.get(id);
1363
- const targetVisualLeftX = ctx.entityVisualLeftX.get(id);
1364
- if (!targetMid || targetVisualLeftX === undefined) continue;
1365
- // The arrow always TERMINATES at the target item's left
1366
- // visual edge, vertically centered on the bar.
1367
- const targetPoint: Point = { x: targetVisualLeftX, y: targetMid.y };
1368
- for (const pred of afters) {
1369
- // Source point depends on what kind of predecessor `pred`
1370
- // is. For ITEMS we use the per-item arrow source point
1371
- // — (visualRight, midY) by default, dropping to
1372
- // (visualRight, bar.bottom - PROGRESS_STRIP_HEIGHT/2) when
1373
- // the caption spilled past the right edge so the arrow
1374
- // exits below the spilled title / meta text. For ANCHORS
1375
- // / MILESTONES we attach to the marker's vertical CUT
1376
- // LINE at the TARGET item's row mid-Y — the dashed/solid
1377
- // cut line already drops through the chart and reads as
1378
- // the arrow's stem, so a short horizontal stub from the
1379
- // line into the bar's left edge is the cleanest
1380
- // connection.
1381
- const itemSource = ctx.itemArrowSource.get(pred);
1382
- let from: Point;
1383
- const isMarkerPred = itemSource === undefined;
1384
- if (itemSource) {
1385
- from = itemSource;
1386
- } else {
1387
- const markerMid = ctx.entityMidpoints.get(pred);
1388
- if (!markerMid) continue;
1389
- from = { x: markerMid.x, y: targetMid.y };
1390
- }
1391
- // Skip same-row contiguous chains for ITEM → ITEM only:
1392
- // when the target sits immediately to the right of the
1393
- // source on the same row, the spatial flow already
1394
- // conveys ordering and an arrow is redundant noise.
1395
- // MARKER → ITEM stubs always draw (the cut line is the
1396
- // stem; the short stub completes the visual connection
1397
- // even when the bar is right next to the cut line).
1398
- if (
1399
- !isMarkerPred &&
1400
- Math.abs(from.y - targetPoint.y) < 0.5 &&
1401
- targetPoint.x - from.x < 20
1402
- ) {
1403
- continue;
1404
- }
1405
- requests.push({
1406
- fromId: pred,
1407
- toId: id,
1408
- from,
1409
- to: targetPoint,
1410
- isMarkerSource: isMarkerPred,
1411
- });
1412
- pending.push({ fromId: pred, toId: id });
1413
- }
1414
- }
1415
-
1416
- const routed = routeChannelEdges(requests, grid);
1417
- const out: PositionedDependencyEdge[] = [];
1418
- for (let i = 0; i < routed.length; i++) {
1419
- const r = routed[i];
1420
- out.push({
1421
- fromId: pending[i].fromId,
1422
- toId: pending[i].toId,
1423
- waypoints: r.waypoints,
1424
- kind: r.underBar ? 'underBar' : 'normal',
1425
- style: resolveStyle('item', [], ctx.styleCtx),
1426
- });
1427
- }
1428
- return out;
1429
- }
1430
-
1431
- function buildNowline(
1432
- today: Date | undefined,
1433
- ctx: LayoutContext,
1434
- locale: string,
1435
- ): PositionedNowline | null {
1436
- if (!today) return null;
1437
- const x = ctx.scale.forwardWithinDomain(today);
1438
- if (x === null) return null;
1439
- // Pill row is the band reserved at the very top of the timeline area.
1440
- // The line drops from the bottom of the pill (top of the date headers)
1441
- // through any marker row and into the chart, so the pill and line stay
1442
- // visually connected.
1443
- const pillTopY = ctx.timeline.box.y;
1444
- const lineTopY = ctx.timeline.tickPanelY;
1445
- // Pill width is locale-aware: en-US's `'now'` (3 chars) fits the
1446
- // 36 px default trivially; longer strings like fr's `'maint.'`
1447
- // (6 chars) need a wider pill to avoid clipping. Floor at the
1448
- // default so en-US output stays byte-stable; grow when the
1449
- // measured label needs it. The 2× inset matches the renderer's
1450
- // flag-mode label inset (`NOW_PILL_LABEL_INSET_X_PX`) and gives
1451
- // the same visual padding to centered-mode strings.
1452
- const label = localeStrings(locale).nowLabel;
1453
- const labelTextWidth = estimateTextWidth(label, NOW_PILL_LABEL_FONT_SIZE_PX);
1454
- const pillWidth = Math.max(
1455
- NOW_PILL_WIDTH_PX,
1456
- Math.ceil(labelTextWidth + 2 * NOW_PILL_LABEL_INSET_X_PX),
1457
- );
1458
- // The "chart's left edge" the pill must clear is `chartLeftX` (in
1459
- // beside-mode, the right edge of the header card; in above-mode,
1460
- // the canvas left edge at x=0). originX = chartLeftX + GUTTER_PX,
1461
- // so we recover chartLeftX as `originX - GUTTER_PX`.
1462
- const chartLeftX = ctx.timeline.originX - GUTTER_PX;
1463
- const halfPill = pillWidth / 2;
1464
- let pillMode: 'center' | 'flag-right' | 'flag-left';
1465
- if (x - halfPill < chartLeftX) {
1466
- // Centered pill would intrude into the header card / past the
1467
- // canvas left edge — anchor the pill's LEFT side to the line
1468
- // and let it extend right into the chart.
1469
- pillMode = 'flag-right';
1470
- } else if (x + halfPill > ctx.chartRightX) {
1471
- // Centered pill would clip past the canvas right edge — anchor
1472
- // the pill's RIGHT side to the line and let it extend left.
1473
- pillMode = 'flag-left';
1474
- } else {
1475
- pillMode = 'center';
1476
- }
1477
- // Bottom-most Y the now-line should reach. When a mirrored bottom
1478
- // tick panel exists, thread the line through it (so the line ties
1479
- // the two date strips together visually). Otherwise stop at the
1480
- // last swimlane — never extend into the footnote area below.
1481
- const bottomTickPanelY = ctx.timeline.bottomTickPanelY;
1482
- const bottomTickPanelHeight = ctx.timeline.bottomTickPanelHeight ?? 0;
1483
- const lineBottomY =
1484
- bottomTickPanelY !== undefined && bottomTickPanelHeight > 0
1485
- ? bottomTickPanelY + bottomTickPanelHeight
1486
- : ctx.swimlaneBottomY;
1487
- return {
1488
- x,
1489
- topY: lineTopY,
1490
- bottomY: lineBottomY,
1491
- pillTopY,
1492
- pillMode,
1493
- label,
1494
- pillWidth,
1495
- style: resolveStyle('item', [], ctx.styleCtx),
1496
- };
1497
- }
1498
-
1499
- // Mutable layout-time context shared across helpers.
1500
-
1501
- // Traverse the full content tree to build an `items` map keyed by id.
1502
- function collectItems(swimlanes: SwimlaneDeclaration[]): Map<string, ItemDeclaration> {
1503
- const out = new Map<string, ItemDeclaration>();
1504
- const walk = (node: ItemDeclaration | GroupBlock | ParallelBlock): void => {
1505
- if (isItemDeclaration(node)) {
1506
- // Title-only items register under a synthetic, non-referenceable
1507
- // handle so they still appear as dependency-edge targets.
1508
- out.set(node.name ?? syntheticItemKey(node), node);
1509
- return;
1510
- }
1511
- if (isParallelBlock(node)) {
1512
- for (const child of node.content) {
1513
- if (child.$type === 'DescriptionDirective') continue;
1514
- walk(child as ItemDeclaration | GroupBlock);
1515
- }
1516
- return;
1517
- }
1518
- if (isGroupBlock(node)) {
1519
- for (const child of node.content) {
1520
- if (child.$type === 'DescriptionDirective') continue;
1521
- walk(child as ItemDeclaration | GroupBlock | ParallelBlock);
1522
- }
1523
- return;
1524
- }
1525
- };
1526
- for (const lane of swimlanes) {
1527
- for (const child of lane.content) {
1528
- if (child.$type === 'DescriptionDirective') continue;
1529
- walk(child as ItemDeclaration | GroupBlock | ParallelBlock);
1530
- }
1531
- }
1532
- return out;
1533
- }
1534
-
1535
61
  export function layoutRoadmap(
1536
62
  file: NowlineFile,
1537
63
  resolved: ResolveResult,
1538
64
  options: LayoutOptions = {},
1539
65
  ): LayoutResult {
1540
- return new RoadmapNode().place(file, resolved, options, {
1541
- sequenceItem,
1542
- sequenceOne,
1543
- resolveChildStart,
1544
- newCursor,
1545
- estimateTextWidth,
1546
- predictItemChipExtraHeight,
1547
- computeDateWindow,
1548
- sizeBesideHeader,
1549
- collectItems,
1550
- buildDependencies,
1551
- buildNowline,
1552
- });
66
+ // The wave plan and the day schedule (engine C) are built once per
67
+ // layout, unless the caller already built them for this very
68
+ // `ResolveResult` (specs/scheduler-unification.md §3.6). The schedule
69
+ // carries the plan (`schedule.plan`, undefined without waves); engine A
70
+ // reads it for the barrier passes and the date window is a projection of
71
+ // the schedule.
72
+ const schedule =
73
+ options.schedule?.resolved === resolved
74
+ ? options.schedule
75
+ : scheduleRoadmap(file, resolved, {
76
+ today: options.today,
77
+ plan: buildWavePlan(resolved) ?? null,
78
+ });
79
+ return new RoadmapNode().place(file, resolved, options, schedule);
1553
80
  }