@nowline/layout 0.8.5 → 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 (339) 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/band-scale.d.ts.map +1 -1
  6. package/dist/calendar-resolver.d.ts +27 -0
  7. package/dist/calendar-resolver.d.ts.map +1 -0
  8. package/dist/calendar-resolver.js +132 -0
  9. package/dist/calendar-resolver.js.map +1 -0
  10. package/dist/calendar.d.ts +0 -19
  11. package/dist/calendar.d.ts.map +1 -1
  12. package/dist/calendar.js +4 -44
  13. package/dist/calendar.js.map +1 -1
  14. package/dist/canvas-width.d.ts +23 -0
  15. package/dist/canvas-width.d.ts.map +1 -0
  16. package/dist/canvas-width.js +26 -0
  17. package/dist/canvas-width.js.map +1 -0
  18. package/dist/capacity.d.ts +28 -0
  19. package/dist/capacity.d.ts.map +1 -1
  20. package/dist/capacity.js +64 -29
  21. package/dist/capacity.js.map +1 -1
  22. package/dist/chart-translation.d.ts +22 -0
  23. package/dist/chart-translation.d.ts.map +1 -0
  24. package/dist/chart-translation.js +83 -0
  25. package/dist/chart-translation.js.map +1 -0
  26. package/dist/container-header-geometry.d.ts +64 -0
  27. package/dist/container-header-geometry.d.ts.map +1 -0
  28. package/dist/container-header-geometry.js +89 -0
  29. package/dist/container-header-geometry.js.map +1 -0
  30. package/dist/dsl-utils.d.ts +3 -4
  31. package/dist/dsl-utils.d.ts.map +1 -1
  32. package/dist/dsl-utils.js +8 -25
  33. package/dist/dsl-utils.js.map +1 -1
  34. package/dist/edge-routing.d.ts +69 -78
  35. package/dist/edge-routing.d.ts.map +1 -1
  36. package/dist/edge-routing.js +271 -401
  37. package/dist/edge-routing.js.map +1 -1
  38. package/dist/frame-tab-geometry.d.ts +24 -14
  39. package/dist/frame-tab-geometry.d.ts.map +1 -1
  40. package/dist/frame-tab-geometry.js +69 -23
  41. package/dist/frame-tab-geometry.js.map +1 -1
  42. package/dist/header-card-geometry.d.ts +12 -0
  43. package/dist/header-card-geometry.d.ts.map +1 -1
  44. package/dist/header-card-geometry.js +14 -2
  45. package/dist/header-card-geometry.js.map +1 -1
  46. package/dist/header-logo.d.ts +28 -0
  47. package/dist/header-logo.d.ts.map +1 -0
  48. package/dist/header-logo.js +51 -0
  49. package/dist/header-logo.js.map +1 -0
  50. package/dist/i18n.d.ts +11 -0
  51. package/dist/i18n.d.ts.map +1 -1
  52. package/dist/i18n.js +11 -1
  53. package/dist/i18n.js.map +1 -1
  54. package/dist/index.d.ts +20 -8
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +17 -7
  57. package/dist/index.js.map +1 -1
  58. package/dist/inline-date-pin-geometry.d.ts +19 -11
  59. package/dist/inline-date-pin-geometry.d.ts.map +1 -1
  60. package/dist/inline-date-pin-geometry.js +45 -46
  61. package/dist/inline-date-pin-geometry.js.map +1 -1
  62. package/dist/item-bar-geometry.d.ts +192 -4
  63. package/dist/item-bar-geometry.d.ts.map +1 -1
  64. package/dist/item-bar-geometry.js +258 -5
  65. package/dist/item-bar-geometry.js.map +1 -1
  66. package/dist/item-port-geometry.d.ts +13 -0
  67. package/dist/item-port-geometry.d.ts.map +1 -0
  68. package/dist/item-port-geometry.js +63 -0
  69. package/dist/item-port-geometry.js.map +1 -0
  70. package/dist/layout-context.d.ts +115 -51
  71. package/dist/layout-context.d.ts.map +1 -1
  72. package/dist/layout-context.js +96 -5
  73. package/dist/layout-context.js.map +1 -1
  74. package/dist/layout-insights.d.ts.map +1 -1
  75. package/dist/layout-insights.js +73 -1
  76. package/dist/layout-insights.js.map +1 -1
  77. package/dist/layout.d.ts +35 -0
  78. package/dist/layout.d.ts.map +1 -1
  79. package/dist/layout.js +18 -1315
  80. package/dist/layout.js.map +1 -1
  81. package/dist/nodes/anchor-node.d.ts.map +1 -1
  82. package/dist/nodes/anchor-node.js +11 -4
  83. package/dist/nodes/anchor-node.js.map +1 -1
  84. package/dist/nodes/content-extent.d.ts +24 -0
  85. package/dist/nodes/content-extent.d.ts.map +1 -0
  86. package/dist/nodes/content-extent.js +100 -0
  87. package/dist/nodes/content-extent.js.map +1 -0
  88. package/dist/nodes/dependency-edges.d.ts +6 -0
  89. package/dist/nodes/dependency-edges.d.ts.map +1 -0
  90. package/dist/nodes/dependency-edges.js +148 -0
  91. package/dist/nodes/dependency-edges.js.map +1 -0
  92. package/dist/nodes/footnote-node.d.ts +24 -3
  93. package/dist/nodes/footnote-node.d.ts.map +1 -1
  94. package/dist/nodes/footnote-node.js +129 -25
  95. package/dist/nodes/footnote-node.js.map +1 -1
  96. package/dist/nodes/group-node.d.ts +10 -21
  97. package/dist/nodes/group-node.d.ts.map +1 -1
  98. package/dist/nodes/group-node.js +79 -154
  99. package/dist/nodes/group-node.js.map +1 -1
  100. package/dist/nodes/header-node.d.ts +56 -0
  101. package/dist/nodes/header-node.d.ts.map +1 -0
  102. package/dist/nodes/header-node.js +163 -0
  103. package/dist/nodes/header-node.js.map +1 -0
  104. package/dist/nodes/include-node.d.ts +22 -12
  105. package/dist/nodes/include-node.d.ts.map +1 -1
  106. package/dist/nodes/include-node.js +95 -62
  107. package/dist/nodes/include-node.js.map +1 -1
  108. package/dist/nodes/item-measure.d.ts +135 -0
  109. package/dist/nodes/item-measure.d.ts.map +1 -0
  110. package/dist/nodes/item-measure.js +514 -0
  111. package/dist/nodes/item-measure.js.map +1 -0
  112. package/dist/nodes/item-node.d.ts +162 -9
  113. package/dist/nodes/item-node.d.ts.map +1 -1
  114. package/dist/nodes/item-node.js +256 -69
  115. package/dist/nodes/item-node.js.map +1 -1
  116. package/dist/nodes/marker-band.d.ts +118 -0
  117. package/dist/nodes/marker-band.d.ts.map +1 -0
  118. package/dist/nodes/marker-band.js +303 -0
  119. package/dist/nodes/marker-band.js.map +1 -0
  120. package/dist/nodes/marker-geometry.js +1 -1
  121. package/dist/nodes/marker-geometry.js.map +1 -1
  122. package/dist/nodes/milestone-node.d.ts +112 -15
  123. package/dist/nodes/milestone-node.d.ts.map +1 -1
  124. package/dist/nodes/milestone-node.js +246 -95
  125. package/dist/nodes/milestone-node.js.map +1 -1
  126. package/dist/nodes/nowline-node.d.ts +8 -0
  127. package/dist/nodes/nowline-node.d.ts.map +1 -0
  128. package/dist/nodes/nowline-node.js +74 -0
  129. package/dist/nodes/nowline-node.js.map +1 -0
  130. package/dist/nodes/parallel-node.d.ts +7 -12
  131. package/dist/nodes/parallel-node.d.ts.map +1 -1
  132. package/dist/nodes/parallel-node.js +66 -32
  133. package/dist/nodes/parallel-node.js.map +1 -1
  134. package/dist/nodes/region-markers.d.ts +41 -0
  135. package/dist/nodes/region-markers.d.ts.map +1 -0
  136. package/dist/nodes/region-markers.js +130 -0
  137. package/dist/nodes/region-markers.js.map +1 -0
  138. package/dist/nodes/roadmap-node.d.ts +9 -72
  139. package/dist/nodes/roadmap-node.d.ts.map +1 -1
  140. package/dist/nodes/roadmap-node.js +38 -788
  141. package/dist/nodes/roadmap-node.js.map +1 -1
  142. package/dist/nodes/row-track.d.ts +33 -0
  143. package/dist/nodes/row-track.d.ts.map +1 -0
  144. package/dist/nodes/row-track.js +170 -0
  145. package/dist/nodes/row-track.js.map +1 -0
  146. package/dist/nodes/sequence-item.d.ts +25 -0
  147. package/dist/nodes/sequence-item.d.ts.map +1 -0
  148. package/dist/nodes/sequence-item.js +396 -0
  149. package/dist/nodes/sequence-item.js.map +1 -0
  150. package/dist/nodes/sequence-one.d.ts +5 -0
  151. package/dist/nodes/sequence-one.d.ts.map +1 -0
  152. package/dist/nodes/sequence-one.js +26 -0
  153. package/dist/nodes/sequence-one.js.map +1 -0
  154. package/dist/nodes/swimlane-node.d.ts +5 -17
  155. package/dist/nodes/swimlane-node.d.ts.map +1 -1
  156. package/dist/nodes/swimlane-node.js +62 -147
  157. package/dist/nodes/swimlane-node.js.map +1 -1
  158. package/dist/nodes/wave-node.d.ts +52 -0
  159. package/dist/nodes/wave-node.d.ts.map +1 -0
  160. package/dist/nodes/wave-node.js +483 -0
  161. package/dist/nodes/wave-node.js.map +1 -0
  162. package/dist/non-working-display.d.ts +14 -0
  163. package/dist/non-working-display.d.ts.map +1 -0
  164. package/dist/non-working-display.js +28 -0
  165. package/dist/non-working-display.js.map +1 -0
  166. package/dist/phases/date-window.d.ts +48 -0
  167. package/dist/phases/date-window.d.ts.map +1 -0
  168. package/dist/phases/date-window.js +130 -0
  169. package/dist/phases/date-window.js.map +1 -0
  170. package/dist/phases/finalize.d.ts +198 -0
  171. package/dist/phases/finalize.d.ts.map +1 -0
  172. package/dist/phases/finalize.js +1058 -0
  173. package/dist/phases/finalize.js.map +1 -0
  174. package/dist/phases/measure.d.ts +77 -0
  175. package/dist/phases/measure.d.ts.map +1 -0
  176. package/dist/phases/measure.js +222 -0
  177. package/dist/phases/measure.js.map +1 -0
  178. package/dist/phases/place.d.ts +28 -0
  179. package/dist/phases/place.d.ts.map +1 -0
  180. package/dist/phases/place.js +225 -0
  181. package/dist/phases/place.js.map +1 -0
  182. package/dist/renderable.d.ts.map +1 -1
  183. package/dist/renderable.js +23 -3
  184. package/dist/renderable.js.map +1 -1
  185. package/dist/resolve-today.d.ts +11 -1
  186. package/dist/resolve-today.d.ts.map +1 -1
  187. package/dist/resolve-today.js +26 -12
  188. package/dist/resolve-today.js.map +1 -1
  189. package/dist/row-packer.d.ts +42 -16
  190. package/dist/row-packer.d.ts.map +1 -1
  191. package/dist/row-packer.js +51 -78
  192. package/dist/row-packer.js.map +1 -1
  193. package/dist/schedule.d.ts +58 -1
  194. package/dist/schedule.d.ts.map +1 -1
  195. package/dist/schedule.js +280 -106
  196. package/dist/schedule.js.map +1 -1
  197. package/dist/start-rules.d.ts +27 -0
  198. package/dist/start-rules.d.ts.map +1 -0
  199. package/dist/start-rules.js +91 -0
  200. package/dist/start-rules.js.map +1 -0
  201. package/dist/start-terms.d.ts +23 -0
  202. package/dist/start-terms.d.ts.map +1 -0
  203. package/dist/start-terms.js +27 -0
  204. package/dist/start-terms.js.map +1 -0
  205. package/dist/status-dot.d.ts +46 -0
  206. package/dist/status-dot.d.ts.map +1 -0
  207. package/dist/status-dot.js +78 -0
  208. package/dist/status-dot.js.map +1 -0
  209. package/dist/style-resolution.d.ts.map +1 -1
  210. package/dist/style-resolution.js +23 -43
  211. package/dist/style-resolution.js.map +1 -1
  212. package/dist/text-measure.d.ts +28 -0
  213. package/dist/text-measure.d.ts.map +1 -0
  214. package/dist/text-measure.js +70 -0
  215. package/dist/text-measure.js.map +1 -0
  216. package/dist/themes/contrast.d.ts +4 -0
  217. package/dist/themes/contrast.d.ts.map +1 -0
  218. package/dist/themes/contrast.js +32 -0
  219. package/dist/themes/contrast.js.map +1 -0
  220. package/dist/themes/dark.d.ts.map +1 -1
  221. package/dist/themes/dark.js +28 -1
  222. package/dist/themes/dark.js.map +1 -1
  223. package/dist/themes/grayscale.d.ts.map +1 -1
  224. package/dist/themes/grayscale.js +28 -1
  225. package/dist/themes/grayscale.js.map +1 -1
  226. package/dist/themes/index.d.ts +4 -11
  227. package/dist/themes/index.d.ts.map +1 -1
  228. package/dist/themes/index.js +6 -4
  229. package/dist/themes/index.js.map +1 -1
  230. package/dist/themes/light.d.ts.map +1 -1
  231. package/dist/themes/light.js +28 -1
  232. package/dist/themes/light.js.map +1 -1
  233. package/dist/themes/shape.d.ts +31 -0
  234. package/dist/themes/shape.d.ts.map +1 -1
  235. package/dist/themes/shared.d.ts +44 -50
  236. package/dist/themes/shared.d.ts.map +1 -1
  237. package/dist/themes/shared.js +79 -83
  238. package/dist/themes/shared.js.map +1 -1
  239. package/dist/time-scale.d.ts +42 -6
  240. package/dist/time-scale.d.ts.map +1 -1
  241. package/dist/time-scale.js +109 -17
  242. package/dist/time-scale.js.map +1 -1
  243. package/dist/types.d.ts +528 -11
  244. package/dist/types.d.ts.map +1 -1
  245. package/dist/view-preset.d.ts +61 -6
  246. package/dist/view-preset.d.ts.map +1 -1
  247. package/dist/view-preset.js +439 -24
  248. package/dist/view-preset.js.map +1 -1
  249. package/dist/wave-barrier.d.ts +107 -0
  250. package/dist/wave-barrier.d.ts.map +1 -0
  251. package/dist/wave-barrier.js +174 -0
  252. package/dist/wave-barrier.js.map +1 -0
  253. package/dist/wave-hatch.d.ts +4 -0
  254. package/dist/wave-hatch.d.ts.map +1 -0
  255. package/dist/wave-hatch.js +21 -0
  256. package/dist/wave-hatch.js.map +1 -0
  257. package/dist/wave-layout.d.ts +99 -0
  258. package/dist/wave-layout.d.ts.map +1 -0
  259. package/dist/wave-layout.js +130 -0
  260. package/dist/wave-layout.js.map +1 -0
  261. package/dist/working-calendar.d.ts +128 -4
  262. package/dist/working-calendar.d.ts.map +1 -1
  263. package/dist/working-calendar.js +725 -51
  264. package/dist/working-calendar.js.map +1 -1
  265. package/dist/working-span.d.ts +11 -0
  266. package/dist/working-span.d.ts.map +1 -0
  267. package/dist/working-span.js +18 -0
  268. package/dist/working-span.js.map +1 -0
  269. package/package.json +7 -7
  270. package/src/axis-columns.ts +140 -0
  271. package/src/calendar-resolver.ts +161 -0
  272. package/src/calendar.ts +4 -45
  273. package/src/canvas-width.ts +36 -0
  274. package/src/capacity.ts +71 -30
  275. package/src/chart-translation.ts +88 -0
  276. package/src/container-header-geometry.ts +116 -0
  277. package/src/dsl-utils.ts +8 -26
  278. package/src/edge-routing.ts +347 -491
  279. package/src/frame-tab-geometry.ts +78 -25
  280. package/src/header-card-geometry.ts +17 -2
  281. package/src/header-logo.ts +67 -0
  282. package/src/i18n.ts +22 -1
  283. package/src/index.ts +97 -12
  284. package/src/inline-date-pin-geometry.ts +55 -58
  285. package/src/item-bar-geometry.ts +341 -5
  286. package/src/item-port-geometry.ts +69 -0
  287. package/src/layout-context.ts +210 -72
  288. package/src/layout-insights.ts +109 -2
  289. package/src/layout.ts +57 -1530
  290. package/src/nodes/anchor-node.ts +11 -4
  291. package/src/nodes/content-extent.ts +107 -0
  292. package/src/nodes/dependency-edges.ts +171 -0
  293. package/src/nodes/footnote-node.ts +171 -31
  294. package/src/nodes/group-node.ts +92 -215
  295. package/src/nodes/header-node.ts +255 -0
  296. package/src/nodes/include-node.ts +124 -110
  297. package/src/nodes/item-measure.ts +723 -0
  298. package/src/nodes/item-node.ts +358 -80
  299. package/src/nodes/marker-band.ts +406 -0
  300. package/src/nodes/marker-geometry.ts +1 -1
  301. package/src/nodes/milestone-node.ts +321 -136
  302. package/src/nodes/nowline-node.ts +87 -0
  303. package/src/nodes/parallel-node.ts +69 -39
  304. package/src/nodes/region-markers.ts +194 -0
  305. package/src/nodes/roadmap-node.ts +46 -950
  306. package/src/nodes/row-track.ts +217 -0
  307. package/src/nodes/sequence-item.ts +433 -0
  308. package/src/nodes/sequence-one.ts +40 -0
  309. package/src/nodes/swimlane-node.ts +66 -206
  310. package/src/nodes/wave-node.ts +609 -0
  311. package/src/non-working-display.ts +32 -0
  312. package/src/phases/date-window.ts +191 -0
  313. package/src/phases/finalize.ts +1303 -0
  314. package/src/phases/measure.ts +329 -0
  315. package/src/phases/place.ts +318 -0
  316. package/src/renderable.ts +23 -3
  317. package/src/resolve-today.ts +28 -25
  318. package/src/row-packer.ts +85 -84
  319. package/src/schedule.ts +362 -114
  320. package/src/start-rules.ts +113 -0
  321. package/src/start-terms.ts +38 -0
  322. package/src/status-dot.ts +81 -0
  323. package/src/style-resolution.ts +27 -57
  324. package/src/text-measure.ts +71 -0
  325. package/src/themes/contrast.ts +34 -0
  326. package/src/themes/dark.ts +28 -1
  327. package/src/themes/grayscale.ts +28 -1
  328. package/src/themes/index.ts +10 -7
  329. package/src/themes/light.ts +28 -1
  330. package/src/themes/shape.ts +38 -0
  331. package/src/themes/shared.ts +85 -93
  332. package/src/time-scale.ts +117 -19
  333. package/src/types.ts +529 -20
  334. package/src/view-preset.ts +520 -27
  335. package/src/wave-barrier.ts +242 -0
  336. package/src/wave-hatch.ts +25 -0
  337. package/src/wave-layout.ts +203 -0
  338. package/src/working-calendar.ts +875 -57
  339. package/src/working-span.ts +19 -0
@@ -1,8 +1,9 @@
1
1
  // Frame-tab chiclet geometry — the rounded label tab that overhangs a
2
- // swimlane's frame. Both the layout (collision math) and the renderer
3
- // (drawing) call `frameTabGeometry` so the chiclet's painted footprint
4
- // matches the bounding box layout reserves for it, and so the same
5
- // helper computes WHERE inside the chiclet each text element lands.
2
+ // swimlane's frame. Layout calls `frameTabGeometry` once per lane, with
3
+ // the owner's display title, uses it for the collision math and carries
4
+ // it on `PositionedSwimlane.tab`; the renderer draws from that, so the
5
+ // chiclet's painted footprint is the box layout reserved for it, and the
6
+ // same helper computes WHERE inside the chiclet each text element lands.
6
7
  //
7
8
  // Design note: this helper separates two concerns that used to be
8
9
  // conflated in a single set of "column widths":
@@ -18,25 +19,64 @@
18
19
  // chip. This means short labels naturally shrink-wrap their
19
20
  // chiclet rather than reserving a wide whitespace column.
20
21
  //
21
- // The per-char width factors are calibrated to actual avg-char-width
22
- // of the system sans-serif stack at the relevant font sizes / weights.
23
- // They lean slightly conservative (~5 % over actual) so the chiclet
24
- // never visually clips its label even when the runtime font's metrics
25
- // exceed the calibration target.
22
+ // The width factors are calibrated to the system sans-serif stack at
23
+ // the relevant font sizes / weights. Title and owner use per-character
24
+ // width classes rather than one average: a flat average let wide text
25
+ // ("Headcount", "Sam Chen") overrun its estimate by most of the inner
26
+ // gap while narrow text ("Sprint pts") reserved a wide hole.
27
+
28
+ /** Font size (px) of the 600-weight title in `FONT_STACK.sans`. */
29
+ export const FRAME_TAB_TITLE_FONT_SIZE_PX = 12;
30
+
31
+ /** Font size (px) of the regular-weight owner name in `FONT_STACK.sans`. */
32
+ export const FRAME_TAB_OWNER_FONT_SIZE_PX = 10;
33
+
34
+ // Width classes, in em. Calibrated against system-ui (Inter) at 12px
35
+ // semibold, the widest common resolution of the stack, so other system
36
+ // fonts land at or slightly inside the estimate.
37
+ const NARROW_EM = 0.28;
38
+ const SEMI_NARROW_EM = 0.4;
39
+ const WIDE_EM = 0.9;
40
+ const CAPITAL_OR_DIGIT_EM = 0.7;
41
+ const DEFAULT_EM = 0.6;
42
+ const NARROW_CHARS = new Set(" ijlI.,:;!'|`");
43
+ const SEMI_NARROW_CHARS = new Set('frt()[]{}/\\1-_"');
44
+ const WIDE_CHARS = new Set('mwMW@%');
45
+
46
+ // Regular weight draws about 5 % narrower per em than semibold, which
47
+ // the classes are calibrated to (Inter at 10px regular).
48
+ const REGULAR_WEIGHT_SCALE = 0.95;
49
+
50
+ function estimateClassedEm(text: string): number {
51
+ let em = 0;
52
+ for (const ch of text) {
53
+ if (NARROW_CHARS.has(ch)) em += NARROW_EM;
54
+ else if (SEMI_NARROW_CHARS.has(ch)) em += SEMI_NARROW_EM;
55
+ else if (WIDE_CHARS.has(ch)) em += WIDE_EM;
56
+ else if (/[A-Z0-9]/.test(ch)) em += CAPITAL_OR_DIGIT_EM;
57
+ else em += DEFAULT_EM;
58
+ }
59
+ return em;
60
+ }
26
61
 
27
- /**
28
- * Px-per-char for a 12 pt 600-weight title in `FONT_STACK.sans`.
29
- * Calibrated against system-ui at 12 pt bold (~6.3 px/char actual);
30
- * 6.5 leaves a small safety margin without producing a wide gap to
31
- * the owner / badge that follows.
32
- */
33
- export const FRAME_TAB_TITLE_PX_PER_CHAR = 6.5;
62
+ /** Estimated rendered width (px) of a frame-tab title. */
63
+ export function estimateFrameTabTitleWidth(title: string): number {
64
+ return estimateClassedEm(title) * FRAME_TAB_TITLE_FONT_SIZE_PX;
65
+ }
66
+
67
+ /** Estimated rendered width (px) of a frame-tab owner name, without its glyph. */
68
+ export function estimateFrameTabOwnerWidth(owner: string): number {
69
+ return estimateClassedEm(owner) * FRAME_TAB_OWNER_FONT_SIZE_PX * REGULAR_WEIGHT_SCALE;
70
+ }
34
71
 
35
72
  /**
36
- * Px-per-char for a 10 pt regular owner suffix in `FONT_STACK.sans`.
37
- * Calibrated against system-ui at 10 pt regular (~5 px/char actual).
73
+ * Size (px) of the person / people glyph that leads the owner name. One
74
+ * em of the 10 pt owner text, like the lane capacity badge's glyph.
38
75
  */
39
- export const FRAME_TAB_OWNER_PX_PER_CHAR = 5;
76
+ export const FRAME_TAB_OWNER_GLYPH_PX = 10;
77
+
78
+ /** Gap (px) between the owner glyph and the owner name. */
79
+ export const FRAME_TAB_OWNER_GLYPH_GAP_PX = 3;
40
80
 
41
81
  /**
42
82
  * Visible gap (px) between adjacent text elements inside the chiclet:
@@ -66,7 +106,10 @@ export const FRAME_TAB_OFFSET_FROM_BOX_PX = 10;
66
106
  export interface FrameTabGeometry {
67
107
  /** Estimated rendered width (px) of the title text, no min-clamp. */
68
108
  titleTextWidth: number;
69
- /** Estimated rendered width (px) of the owner suffix; 0 when no owner. */
109
+ /**
110
+ * Estimated rendered width (px) of the owner suffix, glyph and name
111
+ * together; 0 when no owner.
112
+ */
70
113
  ownerTextWidth: number;
71
114
  /** Width (px) of the capacity badge as supplied by the caller; 0 when none. */
72
115
  capacityBadgeWidth: number;
@@ -75,8 +118,10 @@ export interface FrameTabGeometry {
75
118
 
76
119
  /** Canvas X (px) where the title text is painted. */
77
120
  titleX: number;
78
- /** Canvas X (px) where the owner text is painted; 0 when no owner. */
121
+ /** Canvas X (px) where the owner glyph is painted; 0 when no owner. */
79
122
  ownerX: number;
123
+ /** Canvas X (px) where the owner name is painted, past the glyph; 0 when no owner. */
124
+ ownerTextX: number;
80
125
  /** Canvas X (px) where the capacity badge starts; 0 when no badge. */
81
126
  badgeX: number;
82
127
  /**
@@ -95,7 +140,9 @@ export interface FrameTabGeometry {
95
140
  }
96
141
 
97
142
  /**
98
- * Single source of truth for the swimlane chiclet's geometry.
143
+ * Single source of truth for the swimlane chiclet's geometry. Layout
144
+ * calls it once per lane and carries the result on
145
+ * `PositionedSwimlane.tab`; the renderer draws from that.
99
146
  *
100
147
  * `capacityBadgeWidth` and `footnoteIndicatorWidth` are supplied by
101
148
  * the caller — they depend on resolved icon shape / footnote-indicator
@@ -105,7 +152,7 @@ export interface FrameTabGeometry {
105
152
  *
106
153
  * Layout order inside the chiclet, left → right:
107
154
  *
108
- * [LEFT_INSET] title (INNER_GAP) owner (INNER_GAP) badge (INNER_GAP) footnote [RIGHT_INSET]
155
+ * [LEFT_INSET] title (INNER_GAP) glyph owner (INNER_GAP) badge (INNER_GAP) footnote [RIGHT_INSET]
109
156
  *
110
157
  * Each element is optional except title; gaps are inserted only between
111
158
  * present elements.
@@ -120,14 +167,19 @@ export function frameTabGeometry(
120
167
  const tabX = boxX + FRAME_TAB_OFFSET_FROM_BOX_PX;
121
168
  const titleX = tabX + FRAME_TAB_LEFT_INSET_PX;
122
169
 
123
- const titleTextWidth = title.length * FRAME_TAB_TITLE_PX_PER_CHAR;
170
+ const titleTextWidth = estimateFrameTabTitleWidth(title);
124
171
  let cursorX = titleX + titleTextWidth;
125
172
 
126
173
  let ownerTextWidth = 0;
127
174
  let ownerX = 0;
175
+ let ownerTextX = 0;
128
176
  if (owner) {
129
- ownerTextWidth = `owner: ${owner}`.length * FRAME_TAB_OWNER_PX_PER_CHAR;
177
+ ownerTextWidth =
178
+ FRAME_TAB_OWNER_GLYPH_PX +
179
+ FRAME_TAB_OWNER_GLYPH_GAP_PX +
180
+ estimateFrameTabOwnerWidth(owner);
130
181
  ownerX = cursorX + FRAME_TAB_INNER_GAP_PX;
182
+ ownerTextX = ownerX + FRAME_TAB_OWNER_GLYPH_PX + FRAME_TAB_OWNER_GLYPH_GAP_PX;
131
183
  cursorX = ownerX + ownerTextWidth;
132
184
  }
133
185
 
@@ -156,6 +208,7 @@ export function frameTabGeometry(
156
208
  footnoteIndicatorWidth,
157
209
  titleX,
158
210
  ownerX,
211
+ ownerTextX,
159
212
  badgeX,
160
213
  footnoteRightX,
161
214
  tabX,
@@ -1,14 +1,14 @@
1
1
  // Header card geometry — sizing and text-stack metrics for the
2
2
  // "header card" that sits beside the timeline (title + author block).
3
3
  //
4
- // Layout owns the card *size* (computed up-front in `sizeBesideHeader`
4
+ // Layout owns the card *size* (computed up-front in `HeaderNode.measure`
5
5
  // from wrapped title/author text). The renderer paints the rectangle +
6
6
  // text using the *same* paddings, line heights, and font sizes so the
7
7
  // card is laid out and drawn consistently.
8
8
  //
9
9
  // Bumping any of these constants changes the visible size of the
10
10
  // header card and the position of every text line inside it. Always
11
- // keep the layout's `sizeBesideHeader` and the renderer's
11
+ // keep the layout's `HeaderNode` and the renderer's
12
12
  // `renderHeader` aligned by going through this module.
13
13
 
14
14
  /** Horizontal padding (px) inside the card from edge to text. */
@@ -46,3 +46,18 @@ export const HEADER_TITLE_FONT_SIZE_PX = 16;
46
46
 
47
47
  /** Font size (px) of the author text (subtitle). */
48
48
  export const HEADER_AUTHOR_FONT_SIZE_PX = 11;
49
+
50
+ /** Horizontal gap (px) between a company logo and the title / author text. */
51
+ export const HEADER_LOGO_GAP_PX = 12;
52
+
53
+ /**
54
+ * Minimum clearance (px) above and below a company logo inside the card.
55
+ * A logo taller than the text block grows the card to keep it.
56
+ */
57
+ export const HEADER_LOGO_PAD_Y_PX = 10;
58
+
59
+ /**
60
+ * Widest a company logo may draw (px). A logo whose `logo-size:` height
61
+ * would make it wider scales down uniformly until it fits.
62
+ */
63
+ export const HEADER_LOGO_MAX_WIDTH_PX = 160;
@@ -0,0 +1,67 @@
1
+ // Company logo sizing for the roadmap header (`logo:` / `logo-size:`,
2
+ // specs/rendering.md § Company Logo Size Presets).
3
+ //
4
+ // Layout never reads asset bytes. The caller loads the logo before layout,
5
+ // reads its intrinsic size, and passes that in as `LayoutOptions.logo`;
6
+ // layout only scales it to the `logo-size:` slot. A roadmap that declares
7
+ // `logo:` without that input (missing file, no asset access) lays out as
8
+ // if it had no logo.
9
+
10
+ import type { NowlineFile } from '@nowline/core';
11
+ import { propValue } from './dsl-utils.js';
12
+ import { HEADER_LOGO_MAX_WIDTH_PX } from './header-card-geometry.js';
13
+ import { LOGO_SIZE_PX } from './themes/shared.js';
14
+
15
+ /** Intrinsic size of a loaded logo, in its own units (only the ratio matters). */
16
+ export interface LogoDimensions {
17
+ width: number;
18
+ height: number;
19
+ }
20
+
21
+ export type LogoSizePreset = keyof typeof LOGO_SIZE_PX;
22
+
23
+ /** A logo at its drawn size, with the asset path and the size it was loaded at. */
24
+ export type ScaledLogo = LogoDimensions & { assetRef: string; intrinsic: LogoDimensions };
25
+
26
+ /** The roadmap's `logo:` path as written, or undefined when it declares none. */
27
+ export function roadmapLogoRef(file: NowlineFile): string | undefined {
28
+ const ref = propValue(file.roadmapDecl?.properties ?? [], 'logo');
29
+ return ref ? ref : undefined;
30
+ }
31
+
32
+ function logoSizePreset(file: NowlineFile): LogoSizePreset {
33
+ const raw = propValue(file.roadmapDecl?.properties ?? [], 'logo-size');
34
+ return raw !== undefined && raw in LOGO_SIZE_PX ? (raw as LogoSizePreset) : 'md';
35
+ }
36
+
37
+ /**
38
+ * The drawn logo size: height from `logo-size:`, width from the intrinsic
39
+ * aspect ratio, so the slot always matches the logo's shape and the logo
40
+ * fills it exactly whether the source is larger or smaller. A logo wider
41
+ * than `HEADER_LOGO_MAX_WIDTH_PX` at that height scales down uniformly.
42
+ */
43
+ export function scaleLogo(intrinsic: LogoDimensions, preset: LogoSizePreset): LogoDimensions {
44
+ const aspect = intrinsic.width / intrinsic.height;
45
+ let height = LOGO_SIZE_PX[preset];
46
+ let width = height * aspect;
47
+ if (width > HEADER_LOGO_MAX_WIDTH_PX) {
48
+ width = HEADER_LOGO_MAX_WIDTH_PX;
49
+ height = width / aspect;
50
+ }
51
+ return { width, height };
52
+ }
53
+
54
+ /**
55
+ * The drawn logo size for this file, or undefined when it declares no
56
+ * `logo:` or the caller supplied no usable intrinsic size.
57
+ */
58
+ export function resolveHeaderLogo(
59
+ file: NowlineFile,
60
+ intrinsic: LogoDimensions | undefined,
61
+ ): ScaledLogo | undefined {
62
+ const assetRef = roadmapLogoRef(file);
63
+ if (!assetRef || !intrinsic) return undefined;
64
+ if (!(intrinsic.width > 0 && intrinsic.height > 0)) return undefined;
65
+ if (!Number.isFinite(intrinsic.width) || !Number.isFinite(intrinsic.height)) return undefined;
66
+ return { ...scaleLogo(intrinsic, logoSizePreset(file)), assetRef, intrinsic };
67
+ }
package/src/i18n.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Locale-aware strings used by the layout pipeline. Owns three things:
2
2
  // - The BCP-47 fallback chain (`fr-CA → fr → en-US`).
3
3
  // - A small message table for chrome strings the renderer paints
4
- // directly (now-pill, quarter prefix).
4
+ // directly (now-pill, quarter prefix, wave strip / legend / tooltips).
5
5
  // - The locale token passed to `Intl.DateTimeFormat` for axis labels.
6
6
  //
7
7
  // Today the table is inline; m-loc-d / m-loc-e (per `specs/localization.md`)
@@ -15,6 +15,17 @@ export interface LocaleStrings {
15
15
  nowLabel: string;
16
16
  /** Prefix used when the timeline scale is quarters (e.g. `Q1 2026` / `T1 2026`). */
17
17
  quarterPrefix: string;
18
+ /**
19
+ * Wave strip tooltip: names the member that sets the wave's end
20
+ * (`Launch · 2026-02-02 – 2026-02-23 · held by i2`; specs/waves.md §9.1).
21
+ */
22
+ waveHeldBy: string;
23
+ /** Marks an empty wave in its tooltip (`Hardening (TBD) · 2026-01-19 · no items`). */
24
+ waveNoItems: string;
25
+ /** Added to a background item's hover tooltip (specs/waves.md §9.3). */
26
+ waveBackgroundItem: string;
27
+ /** Legend entry beside the hatch swatch (specs/waves.md §9.5). */
28
+ waveLegendBackground: string;
18
29
  }
19
30
 
20
31
  // Bundle entries keyed by language tag. The fallback chain strips the
@@ -29,6 +40,10 @@ const BUNDLES: Record<string, Partial<LocaleStrings>> = {
29
40
  'en-US': {
30
41
  nowLabel: 'now',
31
42
  quarterPrefix: 'Q',
43
+ waveHeldBy: 'held by',
44
+ waveNoItems: 'no items',
45
+ waveBackgroundItem: 'Background (no wave)',
46
+ waveLegendBackground: 'Background work (not in a wave)',
32
47
  },
33
48
  fr: {
34
49
  // Short form of "maintenant"; keeps the pill compact while staying
@@ -37,6 +52,12 @@ const BUNDLES: Record<string, Partial<LocaleStrings>> = {
37
52
  nowLabel: 'maint.',
38
53
  // `T` for trimestre — the standard French business convention.
39
54
  quarterPrefix: 'T',
55
+ // "Vague" is feminine; the strings agree with it. Colons take a
56
+ // no-break space (U+00A0), as in `messages.fr.ts`.
57
+ waveHeldBy: 'retenue par',
58
+ waveNoItems: 'aucun élément',
59
+ waveBackgroundItem: 'Travail de fond (hors vague)',
60
+ waveLegendBackground: 'Travail de fond (dans aucune vague)',
40
61
  },
41
62
  };
42
63
 
package/src/index.ts CHANGED
@@ -1,18 +1,47 @@
1
+ export type { CalendarConfig, CalendarMode } from './calendar.js';
2
+ export { type ResolvedCalendar, resolveWorkingCalendar } from './calendar-resolver.js';
1
3
  export {
4
+ type CappedPixelsPerDayInput,
5
+ cappedPixelsPerDay,
6
+ MIN_PIXELS_PER_DAY,
7
+ } from './canvas-width.js';
8
+ export {
9
+ capacityIconDxTerms,
2
10
  estimateCapacitySuffixWidth,
3
11
  formatCapacityNumber,
12
+ META_SUFFIX_DX_EM,
4
13
  parseCapacityValue,
5
14
  type ResolvedCapacityIcon,
6
15
  resolveCapacityIcon,
7
16
  } from './capacity.js';
8
17
  export {
18
+ CONTAINER_BODY_FILL_OPACITY,
19
+ CONTAINER_BODY_PAD_PX,
20
+ CONTAINER_BRACKET_LINE_OFFSET_PX,
21
+ CONTAINER_HEADER_BAND_PX,
22
+ CONTAINER_HEADER_TITLE_BASELINE_PX,
23
+ CONTAINER_HEADER_TITLE_FONT_SIZE_PX,
24
+ CONTAINER_MAX_FILLED_DEPTH,
25
+ CONTAINER_NESTED_BODY_FILL_OPACITY,
26
+ containerHeaderTitleX,
27
+ } from './container-header-geometry.js';
28
+ export {
29
+ ARROW_HEAD_LENGTH_PX,
30
+ ARROW_HEAD_MIN_PX,
31
+ ARROW_HEAD_WIDTH_PX,
32
+ } from './edge-routing.js';
33
+ export {
34
+ estimateFrameTabOwnerWidth,
35
+ estimateFrameTabTitleWidth,
9
36
  FRAME_TAB_INNER_GAP_PX,
10
37
  FRAME_TAB_LEFT_INSET_PX,
11
38
  FRAME_TAB_MIN_WIDTH_PX,
12
39
  FRAME_TAB_OFFSET_FROM_BOX_PX,
13
- FRAME_TAB_OWNER_PX_PER_CHAR,
40
+ FRAME_TAB_OWNER_FONT_SIZE_PX,
41
+ FRAME_TAB_OWNER_GLYPH_GAP_PX,
42
+ FRAME_TAB_OWNER_GLYPH_PX,
14
43
  FRAME_TAB_RIGHT_INSET_PX,
15
- FRAME_TAB_TITLE_PX_PER_CHAR,
44
+ FRAME_TAB_TITLE_FONT_SIZE_PX,
16
45
  type FrameTabGeometry,
17
46
  frameTabGeometry,
18
47
  } from './frame-tab-geometry.js';
@@ -22,10 +51,19 @@ export {
22
51
  HEADER_CARD_PADDING_BOTTOM,
23
52
  HEADER_CARD_PADDING_TOP,
24
53
  HEADER_CARD_PADDING_X,
54
+ HEADER_LOGO_GAP_PX,
55
+ HEADER_LOGO_MAX_WIDTH_PX,
56
+ HEADER_LOGO_PAD_Y_PX,
25
57
  HEADER_TITLE_FONT_SIZE_PX,
26
58
  HEADER_TITLE_LINE_HEIGHT_PX,
27
59
  HEADER_TITLE_TO_AUTHOR_GAP_PX,
28
60
  } from './header-card-geometry.js';
61
+ export {
62
+ type LogoDimensions,
63
+ type LogoSizePreset,
64
+ roadmapLogoRef,
65
+ scaleLogo,
66
+ } from './header-logo.js';
29
67
  export {
30
68
  INCLUDE_CHROME_BADGE_GAP_PX,
31
69
  INCLUDE_CHROME_BADGE_SIZE_PX,
@@ -41,21 +79,31 @@ export {
41
79
  includeChromeGeometry,
42
80
  } from './include-chrome-geometry.js';
43
81
  export {
82
+ computeTitleBarExtra,
44
83
  ITEM_CAPTION_INSET_X_PX,
45
84
  ITEM_CAPTION_META_BASELINE_OFFSET_PX,
46
85
  ITEM_CAPTION_META_FONT_SIZE_PX,
47
86
  ITEM_CAPTION_SPILL_GAP_PX,
48
87
  ITEM_CAPTION_TITLE_BASELINE_OFFSET_PX,
49
88
  ITEM_CAPTION_TITLE_FONT_SIZE_PX,
89
+ ITEM_CAPTION_TITLE_LINE_HEIGHT_PX,
90
+ ITEM_CAPTION_TITLE_MAX_LINES,
50
91
  ITEM_DECORATION_SPILL_GAP_PX,
51
92
  ITEM_FOOTNOTE_INDICATOR_BASELINE_OFFSET_PX,
93
+ ITEM_FOOTNOTE_INDICATOR_FONT_SIZE_PX,
52
94
  ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX,
53
95
  ITEM_FOOTNOTE_INDICATOR_STEP_PX,
54
96
  ITEM_LINK_ICON_INSET_PX,
55
97
  ITEM_LINK_ICON_TILE_SIZE_PX,
98
+ ITEM_LINK_ICON_TO_CAPTION_GAP_PX,
56
99
  ITEM_STATUS_DOT_INSET_RIGHT_PX,
57
100
  ITEM_STATUS_DOT_INSET_TOP_PX,
58
101
  ITEM_STATUS_DOT_RADIUS_PX,
102
+ type ItemCaptionAfterGlyph,
103
+ itemCaptionInsetX,
104
+ itemCaptionLastBaselineOffset,
105
+ itemCaptionMetaBaselineOffset,
106
+ itemTitleFirstLineRightReservePx,
59
107
  LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX,
60
108
  LABEL_CHIP_GAP_BETWEEN_PX,
61
109
  LABEL_CHIP_HEIGHT_PX,
@@ -71,21 +119,38 @@ export {
71
119
  type LayoutInsightContext,
72
120
  type LayoutInsightSeverity,
73
121
  } from './layout-insights.js';
122
+ export { MARKER_BOLD_WIDTH_FACTOR } from './nodes/marker-geometry.js';
123
+ export {
124
+ isNonWorkingDisplay,
125
+ NON_WORKING_DISPLAYS,
126
+ type NonWorkingDisplay,
127
+ parseNonWorkingDisplay,
128
+ } from './non-working-display.js';
74
129
  export {
75
130
  civilDateInZone,
131
+ hasImpossibleNowDate,
76
132
  type NormalizedZone,
77
133
  normalizeZone,
78
134
  type ResolveTodayOptions,
79
135
  resolveToday,
80
136
  TimezoneError,
81
137
  } from './resolve-today.js';
82
- export type { RoadmapSchedule, ScheduledItem, ScheduleOptions } from './schedule.js';
138
+ export type {
139
+ RoadmapSchedule,
140
+ ScheduledItem,
141
+ ScheduledWave,
142
+ ScheduleExtent,
143
+ ScheduleOptions,
144
+ } from './schedule.js';
83
145
  export { scheduleRoadmap } from './schedule.js';
146
+ export { estimateTextWidth } from './text-measure.js';
147
+ export { contrastRatio, relativeLuminance } from './themes/contrast.js';
84
148
  export {
85
149
  darkTheme,
86
150
  grayscaleTheme,
87
151
  lightTheme,
88
152
  normalizeThemeName,
153
+ THEME_NAMES,
89
154
  type Theme,
90
155
  type ThemeName,
91
156
  themes,
@@ -110,14 +175,8 @@ export {
110
175
  FOOTNOTE_ROW_HEIGHT,
111
176
  FRAME_TAB_HEIGHT_PX,
112
177
  FRAME_TAB_LABEL_BASELINE_OFFSET_PX,
113
- GROUP_BOTTOM_PAD_PX,
114
- GROUP_BRACKET_LABEL_OVERHANG_PX,
115
- GROUP_TITLE_TAB_CHAR_WIDTH_PX,
116
- GROUP_TITLE_TAB_GUTTER_PX,
117
- GROUP_TITLE_TAB_HEIGHT_PX,
118
- GROUP_TITLE_TAB_LABEL_BASELINE_OFFSET_PX,
119
- GROUP_TITLE_TAB_LABEL_FONT_SIZE_PX,
120
- GROUP_TITLE_TAB_PAD_X_PX,
178
+ HEADER_HEIGHT_PX,
179
+ NON_WORKING_FILL_OPACITY,
121
180
  NOW_PILL_CORNER_RADIUS_PX,
122
181
  NOW_PILL_HEIGHT_PX,
123
182
  NOW_PILL_LABEL_BASELINE_OFFSET_PX,
@@ -128,7 +187,33 @@ export {
128
187
  PROGRESS_STRIP_HEIGHT_PX,
129
188
  TEXT_SIZE_PX,
130
189
  TIMELINE_TICK_LABEL_BASELINE_OFFSET_PX,
190
+ TIMELINE_TICK_LABEL_FONT_SIZE_PX,
131
191
  TIMELINE_TICK_PANEL_HEIGHT_PX,
132
- TRACK_BLOCK_TAIL_GUTTER_PX,
192
+ timelineTickLabelBaselineOffsetPx,
193
+ WAVE_BOUNDARY_WIDTH_PX,
194
+ WAVE_CELL_INSET_PX,
195
+ WAVE_CROSS_DASH,
196
+ WAVE_HATCH_OPACITY,
197
+ WAVE_HATCH_STROKE_PX,
198
+ WAVE_HATCH_TILE_PX,
199
+ WAVE_LABEL_HALO_INSET_Y_PX,
200
+ WAVE_LABEL_HALO_PAD_PX,
201
+ WAVE_LEGEND_BASELINE_OFFSET_PX,
202
+ WAVE_LEGEND_GAP_PX,
203
+ WAVE_LEGEND_LINE_PX,
204
+ WAVE_LEGEND_SWATCH_GAP_PX,
205
+ WAVE_LEGEND_SWATCH_HEIGHT_PX,
206
+ WAVE_LEGEND_SWATCH_WIDTH_PX,
207
+ WAVE_STRIP_HEIGHT_PX,
208
+ WAVE_STRIP_LABEL_FONT_SIZE_PX,
209
+ WAVE_STRIP_LABEL_PAD_PX,
210
+ WAVE_STYLED_STRIP_MIX_OPACITY,
211
+ WAVE_STYLED_TINT_OPACITY,
133
212
  } from './themes/shared.js';
134
213
  export * from './types.js';
214
+ export type {
215
+ CalendarException,
216
+ WorkingCalendar,
217
+ WorkingExceptionRun,
218
+ } from './working-calendar.js';
219
+ export { calendarExceptions } from './working-calendar.js';