@nowline/layout 0.0.0-dev.20260601071750.g04bdff9

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 (193) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +103 -0
  3. package/dist/band-scale.d.ts +56 -0
  4. package/dist/band-scale.d.ts.map +1 -0
  5. package/dist/band-scale.js +86 -0
  6. package/dist/band-scale.js.map +1 -0
  7. package/dist/calendar.d.ts +79 -0
  8. package/dist/calendar.d.ts.map +1 -0
  9. package/dist/calendar.js +210 -0
  10. package/dist/calendar.js.map +1 -0
  11. package/dist/capacity.d.ts +72 -0
  12. package/dist/capacity.d.ts.map +1 -0
  13. package/dist/capacity.js +163 -0
  14. package/dist/capacity.js.map +1 -0
  15. package/dist/dsl-utils.d.ts +5 -0
  16. package/dist/dsl-utils.d.ts.map +1 -0
  17. package/dist/dsl-utils.js +28 -0
  18. package/dist/dsl-utils.js.map +1 -0
  19. package/dist/edge-routing.d.ts +89 -0
  20. package/dist/edge-routing.d.ts.map +1 -0
  21. package/dist/edge-routing.js +435 -0
  22. package/dist/edge-routing.js.map +1 -0
  23. package/dist/frame-tab-geometry.d.ts +78 -0
  24. package/dist/frame-tab-geometry.d.ts.map +1 -0
  25. package/dist/frame-tab-geometry.js +115 -0
  26. package/dist/frame-tab-geometry.js.map +1 -0
  27. package/dist/header-card-geometry.d.ts +29 -0
  28. package/dist/header-card-geometry.d.ts.map +1 -0
  29. package/dist/header-card-geometry.js +41 -0
  30. package/dist/header-card-geometry.js.map +1 -0
  31. package/dist/i18n.d.ts +48 -0
  32. package/dist/i18n.d.ts.map +1 -0
  33. package/dist/i18n.js +114 -0
  34. package/dist/i18n.js.map +1 -0
  35. package/dist/include-chrome-geometry.d.ts +86 -0
  36. package/dist/include-chrome-geometry.d.ts.map +1 -0
  37. package/dist/include-chrome-geometry.js +104 -0
  38. package/dist/include-chrome-geometry.js.map +1 -0
  39. package/dist/index.d.ts +11 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +10 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/inline-date-pin-geometry.d.ts +46 -0
  44. package/dist/inline-date-pin-geometry.d.ts.map +1 -0
  45. package/dist/inline-date-pin-geometry.js +149 -0
  46. package/dist/inline-date-pin-geometry.js.map +1 -0
  47. package/dist/item-bar-geometry.d.ts +157 -0
  48. package/dist/item-bar-geometry.d.ts.map +1 -0
  49. package/dist/item-bar-geometry.js +214 -0
  50. package/dist/item-bar-geometry.js.map +1 -0
  51. package/dist/lane-utilization.d.ts +90 -0
  52. package/dist/lane-utilization.d.ts.map +1 -0
  53. package/dist/lane-utilization.js +206 -0
  54. package/dist/lane-utilization.js.map +1 -0
  55. package/dist/layout-context.d.ts +143 -0
  56. package/dist/layout-context.d.ts.map +1 -0
  57. package/dist/layout-context.js +8 -0
  58. package/dist/layout-context.js.map +1 -0
  59. package/dist/layout.d.ts +18 -0
  60. package/dist/layout.d.ts.map +1 -0
  61. package/dist/layout.js +1298 -0
  62. package/dist/layout.js.map +1 -0
  63. package/dist/nodes/anchor-node.d.ts +16 -0
  64. package/dist/nodes/anchor-node.d.ts.map +1 -0
  65. package/dist/nodes/anchor-node.js +68 -0
  66. package/dist/nodes/anchor-node.js.map +1 -0
  67. package/dist/nodes/footnote-node.d.ts +10 -0
  68. package/dist/nodes/footnote-node.d.ts.map +1 -0
  69. package/dist/nodes/footnote-node.js +41 -0
  70. package/dist/nodes/footnote-node.js.map +1 -0
  71. package/dist/nodes/group-node.d.ts +29 -0
  72. package/dist/nodes/group-node.d.ts.map +1 -0
  73. package/dist/nodes/group-node.js +195 -0
  74. package/dist/nodes/group-node.js.map +1 -0
  75. package/dist/nodes/include-node.d.ts +16 -0
  76. package/dist/nodes/include-node.d.ts.map +1 -0
  77. package/dist/nodes/include-node.js +117 -0
  78. package/dist/nodes/include-node.js.map +1 -0
  79. package/dist/nodes/item-node.d.ts +51 -0
  80. package/dist/nodes/item-node.d.ts.map +1 -0
  81. package/dist/nodes/item-node.js +108 -0
  82. package/dist/nodes/item-node.js.map +1 -0
  83. package/dist/nodes/marker-geometry.d.ts +22 -0
  84. package/dist/nodes/marker-geometry.d.ts.map +1 -0
  85. package/dist/nodes/marker-geometry.js +38 -0
  86. package/dist/nodes/marker-geometry.js.map +1 -0
  87. package/dist/nodes/milestone-node.d.ts +48 -0
  88. package/dist/nodes/milestone-node.d.ts.map +1 -0
  89. package/dist/nodes/milestone-node.js +210 -0
  90. package/dist/nodes/milestone-node.js.map +1 -0
  91. package/dist/nodes/parallel-node.d.ts +21 -0
  92. package/dist/nodes/parallel-node.d.ts.map +1 -0
  93. package/dist/nodes/parallel-node.js +88 -0
  94. package/dist/nodes/parallel-node.js.map +1 -0
  95. package/dist/nodes/roadmap-node.d.ts +76 -0
  96. package/dist/nodes/roadmap-node.d.ts.map +1 -0
  97. package/dist/nodes/roadmap-node.js +788 -0
  98. package/dist/nodes/roadmap-node.js.map +1 -0
  99. package/dist/nodes/swimlane-node.d.ts +38 -0
  100. package/dist/nodes/swimlane-node.d.ts.map +1 -0
  101. package/dist/nodes/swimlane-node.js +308 -0
  102. package/dist/nodes/swimlane-node.js.map +1 -0
  103. package/dist/renderable.d.ts +44 -0
  104. package/dist/renderable.d.ts.map +1 -0
  105. package/dist/renderable.js +21 -0
  106. package/dist/renderable.js.map +1 -0
  107. package/dist/row-packer.d.ts +125 -0
  108. package/dist/row-packer.d.ts.map +1 -0
  109. package/dist/row-packer.js +169 -0
  110. package/dist/row-packer.js.map +1 -0
  111. package/dist/style-resolution.d.ts +14 -0
  112. package/dist/style-resolution.d.ts.map +1 -0
  113. package/dist/style-resolution.js +191 -0
  114. package/dist/style-resolution.js.map +1 -0
  115. package/dist/themes/dark.d.ts +4 -0
  116. package/dist/themes/dark.d.ts.map +1 -0
  117. package/dist/themes/dark.js +241 -0
  118. package/dist/themes/dark.js.map +1 -0
  119. package/dist/themes/grayscale.d.ts +4 -0
  120. package/dist/themes/grayscale.d.ts.map +1 -0
  121. package/dist/themes/grayscale.js +237 -0
  122. package/dist/themes/grayscale.js.map +1 -0
  123. package/dist/themes/index.d.ts +19 -0
  124. package/dist/themes/index.d.ts.map +1 -0
  125. package/dist/themes/index.js +57 -0
  126. package/dist/themes/index.js.map +1 -0
  127. package/dist/themes/light.d.ts +4 -0
  128. package/dist/themes/light.d.ts.map +1 -0
  129. package/dist/themes/light.js +248 -0
  130. package/dist/themes/light.js.map +1 -0
  131. package/dist/themes/shape.d.ts +194 -0
  132. package/dist/themes/shape.d.ts.map +1 -0
  133. package/dist/themes/shape.js +6 -0
  134. package/dist/themes/shape.js.map +1 -0
  135. package/dist/themes/shared.d.ts +145 -0
  136. package/dist/themes/shared.d.ts.map +1 -0
  137. package/dist/themes/shared.js +310 -0
  138. package/dist/themes/shared.js.map +1 -0
  139. package/dist/time-scale.d.ts +39 -0
  140. package/dist/time-scale.d.ts.map +1 -0
  141. package/dist/time-scale.js +62 -0
  142. package/dist/time-scale.js.map +1 -0
  143. package/dist/types.d.ts +516 -0
  144. package/dist/types.d.ts.map +1 -0
  145. package/dist/types.js +6 -0
  146. package/dist/types.js.map +1 -0
  147. package/dist/view-preset.d.ts +23 -0
  148. package/dist/view-preset.d.ts.map +1 -0
  149. package/dist/view-preset.js +146 -0
  150. package/dist/view-preset.js.map +1 -0
  151. package/dist/working-calendar.d.ts +14 -0
  152. package/dist/working-calendar.d.ts.map +1 -0
  153. package/dist/working-calendar.js +74 -0
  154. package/dist/working-calendar.js.map +1 -0
  155. package/package.json +43 -0
  156. package/src/band-scale.ts +115 -0
  157. package/src/calendar.ts +244 -0
  158. package/src/capacity.ts +191 -0
  159. package/src/dsl-utils.ts +30 -0
  160. package/src/edge-routing.ts +550 -0
  161. package/src/frame-tab-geometry.ts +165 -0
  162. package/src/header-card-geometry.ts +48 -0
  163. package/src/i18n.ts +124 -0
  164. package/src/include-chrome-geometry.ts +156 -0
  165. package/src/index.ts +118 -0
  166. package/src/inline-date-pin-geometry.ts +196 -0
  167. package/src/item-bar-geometry.ts +271 -0
  168. package/src/lane-utilization.ts +259 -0
  169. package/src/layout-context.ts +182 -0
  170. package/src/layout.ts +1530 -0
  171. package/src/nodes/anchor-node.ts +77 -0
  172. package/src/nodes/footnote-node.ts +60 -0
  173. package/src/nodes/group-node.ts +260 -0
  174. package/src/nodes/include-node.ts +168 -0
  175. package/src/nodes/item-node.ts +171 -0
  176. package/src/nodes/marker-geometry.ts +43 -0
  177. package/src/nodes/milestone-node.ts +263 -0
  178. package/src/nodes/parallel-node.ts +110 -0
  179. package/src/nodes/roadmap-node.ts +957 -0
  180. package/src/nodes/swimlane-node.ts +423 -0
  181. package/src/renderable.ts +68 -0
  182. package/src/row-packer.ts +271 -0
  183. package/src/style-resolution.ts +243 -0
  184. package/src/themes/dark.ts +244 -0
  185. package/src/themes/grayscale.ts +240 -0
  186. package/src/themes/index.ts +66 -0
  187. package/src/themes/light.ts +251 -0
  188. package/src/themes/shape.ts +230 -0
  189. package/src/themes/shared.ts +369 -0
  190. package/src/time-scale.ts +78 -0
  191. package/src/types.ts +641 -0
  192. package/src/view-preset.ts +180 -0
  193. package/src/working-calendar.ts +91 -0
@@ -0,0 +1,259 @@
1
+ // Lane utilization computation per specs/rendering.md § Lane utilization
2
+ // underline.
3
+ //
4
+ // Walks a positioned lane's children (items, plus the items inside parallel
5
+ // and group blocks), collects each contributor's pixel span and capacity load,
6
+ // then sweeps the timeline to produce a list of half-open segments
7
+ // classified `green | yellow | red` against the lane's resolved capacity and
8
+ // thresholds. Adjacent same-classification segments coalesce so the renderer
9
+ // paints one rectangle per color band rather than per event boundary.
10
+ //
11
+ // Pure data in / pure data out — no AST, no theme, no side effects. Lives
12
+ // next to `capacity.ts` (the other capacity-helper module) and is tested in
13
+ // isolation.
14
+
15
+ import type { DefaultDeclaration, SwimlaneDeclaration } from '@nowline/core';
16
+ import { propValue } from './dsl-utils.js';
17
+ import type {
18
+ PositionedItem,
19
+ PositionedLaneUtilization,
20
+ PositionedTrackChild,
21
+ PositionedUtilizationSegment,
22
+ UtilizationClassification,
23
+ } from './types.js';
24
+
25
+ /**
26
+ * Built-in defaults used when neither the lane nor its `default swimlane`
27
+ * declares a threshold. Mirrors specs/dsl.md rule 17d.
28
+ */
29
+ export const DEFAULT_UTILIZATION_WARN_FRACTION = 0.8; // 80%
30
+ export const DEFAULT_UTILIZATION_OVER_FRACTION = 1.0; // 100%
31
+
32
+ /**
33
+ * One contributor to a lane's load function: a single positioned item with
34
+ * its visual horizontal span and the load it contributes during that span.
35
+ * Children inside `parallel` / `group` blocks contribute individually so
36
+ * concurrent load reads correctly (the parallel block itself spans the union
37
+ * of its children's bars but does not itself add load — only the items do).
38
+ */
39
+ interface LoadContributor {
40
+ startX: number;
41
+ endX: number;
42
+ load: number;
43
+ }
44
+
45
+ /**
46
+ * Walk the lane's positioned children and return one `LoadContributor` per
47
+ * item that contributes load. Items inside `parallel` and `group` blocks are
48
+ * descended into recursively; the block envelopes themselves contribute
49
+ * nothing (they are pure containers).
50
+ *
51
+ * `inferItemLoad` mirrors the spec's "Default capacity" table:
52
+ * - Explicit `capacity:N` → that value.
53
+ * - Sized item without explicit `capacity:` → 1 (the default for sized
54
+ * items, matching the duration-derivation default).
55
+ * - Duration-literal item without `capacity:` → 0 (the bar paints normally
56
+ * but does not contribute load — this is the legacy "uncounted" item
57
+ * family from before the size system existed).
58
+ */
59
+ export function collectLoadContributors(children: PositionedTrackChild[]): LoadContributor[] {
60
+ const out: LoadContributor[] = [];
61
+ walk(children, out);
62
+ return out;
63
+ }
64
+
65
+ function walk(children: PositionedTrackChild[], out: LoadContributor[]): void {
66
+ for (const child of children) {
67
+ if (child.kind === 'item') {
68
+ const load = inferItemLoad(child);
69
+ if (load > 0 && child.box.width > 0) {
70
+ out.push({
71
+ startX: child.box.x,
72
+ endX: child.box.x + child.box.width,
73
+ load,
74
+ });
75
+ }
76
+ } else if (child.kind === 'parallel' || child.kind === 'group') {
77
+ walk(child.children, out);
78
+ }
79
+ }
80
+ }
81
+
82
+ function inferItemLoad(item: PositionedItem): number {
83
+ if (item.capacity) return item.capacity.value;
84
+ if (item.size) return 1;
85
+ return 0;
86
+ }
87
+
88
+ /**
89
+ * Compute a lane's utilization model. Returns `null` when there is no
90
+ * meaningful underline to paint:
91
+ * - Lane has no `capacity:` (no denominator → undefined utilization).
92
+ * - Lane has no items contributing load (collectLoadContributors returns
93
+ * an empty list).
94
+ * - Both thresholds resolve to `none` (caller has opted out of every
95
+ * color band; nothing to paint).
96
+ *
97
+ * The returned `PositionedLaneUtilization` carries the resolved thresholds
98
+ * (in fraction form, or `null` for opt-out) alongside the segments so the
99
+ * renderer can render legends / tooltips without re-resolving anything.
100
+ */
101
+ export function computeLaneUtilization(opts: {
102
+ children: PositionedTrackChild[];
103
+ capacityValue: number;
104
+ warnFraction: number | null;
105
+ overFraction: number | null;
106
+ }): PositionedLaneUtilization | null {
107
+ if (opts.capacityValue <= 0) return null;
108
+ if (opts.warnFraction === null && opts.overFraction === null) return null;
109
+
110
+ const contributors = collectLoadContributors(opts.children);
111
+ if (contributors.length === 0) return null;
112
+
113
+ // Build sorted unique x coordinates from every event boundary.
114
+ const xSet = new Set<number>();
115
+ for (const c of contributors) {
116
+ xSet.add(c.startX);
117
+ xSet.add(c.endX);
118
+ }
119
+ const xs = Array.from(xSet).sort((a, b) => a - b);
120
+ if (xs.length < 2) return null;
121
+
122
+ // Per half-open interval [xs[j], xs[j+1]) compute the active load by
123
+ // summing every contributor whose span covers the interval midpoint.
124
+ // O(n²) but n is small (typically <20 items per lane); avoids the
125
+ // bookkeeping of an event-stream sweep without a measurable cost.
126
+ const raw: PositionedUtilizationSegment[] = [];
127
+ for (let j = 0; j < xs.length - 1; j++) {
128
+ const a = xs[j];
129
+ const b = xs[j + 1];
130
+ const mid = (a + b) / 2;
131
+ let load = 0;
132
+ for (const c of contributors) {
133
+ if (c.startX <= mid && mid < c.endX) load += c.load;
134
+ }
135
+ raw.push({
136
+ startX: a,
137
+ endX: b,
138
+ load,
139
+ classification: classifyLoad(
140
+ load,
141
+ opts.capacityValue,
142
+ opts.warnFraction,
143
+ opts.overFraction,
144
+ ),
145
+ });
146
+ }
147
+
148
+ // Coalesce adjacent same-classification segments so the renderer paints
149
+ // one rectangle per visible color band rather than per event boundary.
150
+ const segments: PositionedUtilizationSegment[] = [];
151
+ for (const s of raw) {
152
+ const last = segments[segments.length - 1];
153
+ if (last && last.classification === s.classification && last.endX === s.startX) {
154
+ last.endX = s.endX;
155
+ // Keep the first interval's `load` as a representative; the
156
+ // coalesced span may have varying load within a single color
157
+ // band but renderers paint by class, not by exact load.
158
+ } else {
159
+ segments.push({ ...s });
160
+ }
161
+ }
162
+
163
+ return {
164
+ segments,
165
+ capacityValue: opts.capacityValue,
166
+ warnFraction: opts.warnFraction,
167
+ overFraction: opts.overFraction,
168
+ };
169
+ }
170
+
171
+ /**
172
+ * Classify a single load value against the lane's resolved capacity and
173
+ * thresholds. Spec § "Load function and segmentation":
174
+ * - `u < warn-at` → green (healthy; includes `u = 0` so the underline
175
+ * stays continuous).
176
+ * - `warn-at ≤ u < over-at` → yellow.
177
+ * - `u ≥ over-at` → red.
178
+ *
179
+ * `null` thresholds disable that color band: a `null` warnFraction collapses
180
+ * to a binary green / red indicator; a `null` overFraction collapses to
181
+ * green / yellow; both `null` is unreachable here (caller short-circuits
182
+ * upstream).
183
+ */
184
+ export function classifyLoad(
185
+ load: number,
186
+ capacity: number,
187
+ warnFraction: number | null,
188
+ overFraction: number | null,
189
+ ): UtilizationClassification {
190
+ const u = load / capacity;
191
+ if (overFraction !== null && u >= overFraction) return 'red';
192
+ if (warnFraction !== null && u >= warnFraction) return 'yellow';
193
+ return 'green';
194
+ }
195
+
196
+ /**
197
+ * Resolve the lane's effective utilization thresholds, applying the spec's
198
+ * resolution order:
199
+ *
200
+ * 1. Lane's own `utilization-warn-at:` / `utilization-over-at:` properties.
201
+ * 2. The applicable `default swimlane` declaration's properties.
202
+ * 3. Built-in defaults (`warn-at:80%`, `over-at:100%`).
203
+ *
204
+ * Each side resolves independently — a lane can pin only one threshold and
205
+ * inherit the other from defaults / built-ins. The returned `null` means
206
+ * "opted out via `none`" and disables that color band downstream.
207
+ *
208
+ * Malformed values (already reported by the validator) are treated as
209
+ * "unset" — the resolver falls through to the next layer rather than
210
+ * double-reporting.
211
+ */
212
+ export function resolveLaneUtilizationThresholds(
213
+ lane: SwimlaneDeclaration,
214
+ defaults: Map<string, DefaultDeclaration>,
215
+ ): { warn: number | null; over: number | null } {
216
+ const dflt = defaults.get('swimlane');
217
+ const warn = resolveThreshold(
218
+ propValue(lane.properties, 'utilization-warn-at'),
219
+ dflt ? propValue(dflt.properties, 'utilization-warn-at') : undefined,
220
+ DEFAULT_UTILIZATION_WARN_FRACTION,
221
+ );
222
+ const over = resolveThreshold(
223
+ propValue(lane.properties, 'utilization-over-at'),
224
+ dflt ? propValue(dflt.properties, 'utilization-over-at') : undefined,
225
+ DEFAULT_UTILIZATION_OVER_FRACTION,
226
+ );
227
+ return { warn, over };
228
+ }
229
+
230
+ function resolveThreshold(
231
+ laneVal: string | undefined,
232
+ defaultVal: string | undefined,
233
+ builtinFraction: number,
234
+ ): number | null {
235
+ const raw = laneVal ?? defaultVal;
236
+ const parsed = parseThresholdRaw(raw);
237
+ if (parsed.kind === 'unset') return builtinFraction;
238
+ if (parsed.kind === 'none') return null;
239
+ return parsed.value;
240
+ }
241
+
242
+ type ParsedThreshold = { kind: 'unset' } | { kind: 'none' } | { kind: 'number'; value: number };
243
+
244
+ const PERCENT_RE = /^\d+(?:\.\d+)?%$/;
245
+ const DECIMAL_FRACTION_RE = /^\d+\.\d+$/;
246
+
247
+ function parseThresholdRaw(val: string | undefined): ParsedThreshold {
248
+ if (val === undefined) return { kind: 'unset' };
249
+ if (val === 'none') return { kind: 'none' };
250
+ if (PERCENT_RE.test(val)) {
251
+ const n = parseFloat(val) / 100;
252
+ return Number.isFinite(n) && n > 0 ? { kind: 'number', value: n } : { kind: 'unset' };
253
+ }
254
+ if (DECIMAL_FRACTION_RE.test(val)) {
255
+ const n = parseFloat(val);
256
+ return Number.isFinite(n) && n > 0 ? { kind: 'number', value: n } : { kind: 'unset' };
257
+ }
258
+ return { kind: 'unset' };
259
+ }
@@ -0,0 +1,182 @@
1
+ // Layout context — shared internal types used by `layout.ts` and the
2
+ // node files under `nodes/`. Extracted so per-entity nodes (e.g.
3
+ // `swimlane-node.ts`) can type their inputs without forcing a circular
4
+ // import on the production composition root in `layout.ts`.
5
+
6
+ import type {
7
+ EntityProperty,
8
+ GroupBlock,
9
+ ItemDeclaration,
10
+ LabelDeclaration,
11
+ ParallelBlock,
12
+ SymbolDeclaration,
13
+ } from '@nowline/core';
14
+ import type { BandScale } from './band-scale.js';
15
+ import type { resolveCalendar } from './calendar.js';
16
+ import type { StyleContext } from './style-resolution.js';
17
+ import type { TimeScale } from './time-scale.js';
18
+ import type {
19
+ MarkerRowPlacement,
20
+ Point,
21
+ PositionedItem,
22
+ PositionedTimelineScale,
23
+ PositionedTrackChild,
24
+ ResolvedSize,
25
+ SlackCorridor,
26
+ } from './types.js';
27
+ import type { WorkingCalendar } from './working-calendar.js';
28
+
29
+ /** Slim accumulator used while sequencing items into a track. */
30
+ export interface TrackCursor {
31
+ /** Left edge where the next item begins. */
32
+ x: number;
33
+ /** Top edge of the current row. */
34
+ y: number;
35
+ /** Accumulated height of the track. */
36
+ height: number;
37
+ /** Rightmost edge reached. */
38
+ maxX: number;
39
+ }
40
+
41
+ export function newCursor(x: number, y: number): TrackCursor {
42
+ return { x, y, height: 0, maxX: x };
43
+ }
44
+
45
+ /**
46
+ * Shared layout state passed through the per-entity sequencers and
47
+ * Renderable nodes. Owns the resolved calendar/timeline/style scope plus
48
+ * the running entity-edge maps that `after:` / `before:` references read.
49
+ */
50
+ export interface LayoutContext {
51
+ cal: ReturnType<typeof resolveCalendar>;
52
+ styleCtx: StyleContext;
53
+ sizes: Map<string, ResolvedSize>;
54
+ labels: Map<string, LabelDeclaration>;
55
+ teams: Map<string, import('@nowline/core').TeamDeclaration>;
56
+ persons: Map<string, import('@nowline/core').PersonDeclaration>;
57
+ /**
58
+ * Custom `symbol` declarations from `ResolvedConfig.symbols`. Used by
59
+ * `resolveCapacityIcon` (in `capacity.ts`) to dereference custom symbol
60
+ * ids like `capacity-icon:budget` to the symbol's `unicode:` payload.
61
+ * Empty when the file declares no symbols.
62
+ */
63
+ symbols: Map<string, SymbolDeclaration>;
64
+ footnoteIndex: Map<string, number>;
65
+ /** For each footnote id, the list of `on:` host ids it references. */
66
+ footnoteHosts: Map<string, string[]>;
67
+ timeline: PositionedTimelineScale;
68
+ scale: TimeScale;
69
+ calendar: WorkingCalendar;
70
+ bandScale: BandScale;
71
+ entityLeftEdges: Map<string, number>;
72
+ entityRightEdges: Map<string, number>;
73
+ entityMidpoints: Map<string, Point>;
74
+ /**
75
+ * Visual edges for items (entries with a painted bar). Differs
76
+ * from `entityLeftEdges`/`entityRightEdges` (logical column
77
+ * boundaries) by `ITEM_INSET_PX` on each side so dependency
78
+ * arrows attach to the painted bar edge instead of landing in
79
+ * the inter-column gutter. Anchors and milestones are absent —
80
+ * their attach geometry uses `(center.x, target.row.midY)` on
81
+ * the cut line, computed inline by `buildDependencies`.
82
+ */
83
+ entityVisualLeftX: Map<string, number>;
84
+ entityVisualRightX: Map<string, number>;
85
+ /**
86
+ * Per-item exit point for `after:` dependency arrows leaving
87
+ * this entity. Default = `(visualRight, midY)`. When the
88
+ * caption spills past the bar's right edge (`textSpills`), the
89
+ * exit drops to `(box.x + box.width / 2, box.y + box.height)`
90
+ * — the bottom-middle of the progress strip — so the arrow
91
+ * doesn't visually pierce the spilled title/meta text to the
92
+ * right of the bar.
93
+ */
94
+ itemArrowSource: Map<string, Point>;
95
+ /**
96
+ * Flow key for each item, used to dedupe milestone slack arrows.
97
+ * A "flow" is the deepest enclosing single-track container —
98
+ * swimlane root, sequential group, or one parallel sub-track.
99
+ * Two items share a flowKey iff they share that container path
100
+ * (file order already encodes their ordering, so only the
101
+ * latest predecessor in each flow contributes a slack arrow).
102
+ */
103
+ itemFlowKey: Map<string, string>;
104
+ /**
105
+ * The flow key currently being built by the swimlane walk.
106
+ * Container nodes (`SwimlaneNode`, `GroupNode`, `ParallelNode`)
107
+ * push their own segment onto this string before recursing into
108
+ * children and restore it afterward. `sequenceItem` reads this
109
+ * value to populate `itemFlowKey`.
110
+ */
111
+ currentFlowKey: string;
112
+ /**
113
+ * Y coordinate where milestone slack arrows attach for each item id.
114
+ * Defaults to the item's row midpoint; when an item's caption spills
115
+ * past the bar's right edge, drops to the progress-strip's vertical
116
+ * center (`box.y + box.height - PROGRESS_STRIP_HEIGHT_PX / 2`) so the
117
+ * arrow stays clear of the spilled title/meta line and visually
118
+ * aligns with the bottom-edge progress bar instead.
119
+ */
120
+ itemSlackAttachY: Map<string, number>;
121
+ /**
122
+ * Horizontal arrow corridors that the swimlane row-packer must avoid.
123
+ * Empty during the first layout pass; populated from the first
124
+ * pass's milestones and consulted on the second pass so the binding
125
+ * predecessor (and any unrelated overlapping item) drops to a row
126
+ * whose Y does not match the corridor.
127
+ */
128
+ slackCorridors: SlackCorridor[];
129
+ /**
130
+ * Pre-computed marker-row placement (row index + label box + side)
131
+ * for every anchor and date-pinned milestone. After-only milestones
132
+ * pack against this map at build time; date-pinned entries are
133
+ * snapshot upstream so their (Y, label) survives swimlane reflows.
134
+ */
135
+ markerRowPlacements: Map<string, MarkerRowPlacement>;
136
+ chartTopY: number;
137
+ chartBottomY: number;
138
+ /**
139
+ * Y coordinate at the bottom of the last swimlane / include region.
140
+ * Distinct from `chartBottomY`, which extends through any mirrored
141
+ * bottom timeline tick panel. Marker cut-lines (anchors, milestones)
142
+ * stop here so they never invade the bottom date strip; the now-line
143
+ * uses the wider `chartBottomY` (or the bottom panel's bottom edge)
144
+ * to thread the entire timeline strip.
145
+ */
146
+ swimlaneBottomY: number;
147
+ chartRightX: number;
148
+ }
149
+
150
+ /**
151
+ * Bundle of layout-internal helper callbacks injected from `layout.ts`
152
+ * into the per-entity Renderable nodes. Keeping the helpers in
153
+ * `layout.ts` (rather than splitting them across many tiny files) means
154
+ * the nodes stay small and importable without a runtime cycle: they
155
+ * receive the helpers at construction time via this struct.
156
+ */
157
+ export interface LayoutHelpers {
158
+ sequenceItem: (
159
+ child: ItemDeclaration,
160
+ cursor: TrackCursor,
161
+ ctx: LayoutContext,
162
+ ownerOverride?: string,
163
+ ) => PositionedItem;
164
+ sequenceOne: (
165
+ child: ItemDeclaration | GroupBlock | ParallelBlock,
166
+ cursor: TrackCursor,
167
+ ctx: LayoutContext,
168
+ ) => PositionedTrackChild;
169
+ resolveChildStart: (
170
+ props: EntityProperty[],
171
+ seqDefault: number,
172
+ laneLeftX: number,
173
+ ctx: LayoutContext,
174
+ ) => number;
175
+ newCursor: (x: number, y: number) => TrackCursor;
176
+ estimateTextWidth: (text: string, fontSize: number) => number;
177
+ /** Predict the extra height an item's wrapped label-chip rows will
178
+ * add, so callers can size the row pitch BEFORE handing off to
179
+ * `sequenceItem`. Returns 0 when the item's labels all fit on a
180
+ * single chip row. */
181
+ predictItemChipExtraHeight: (item: ItemDeclaration, ctx: LayoutContext) => number;
182
+ }