@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.
- package/LICENSE +190 -0
- package/README.md +103 -0
- package/dist/band-scale.d.ts +56 -0
- package/dist/band-scale.d.ts.map +1 -0
- package/dist/band-scale.js +86 -0
- package/dist/band-scale.js.map +1 -0
- package/dist/calendar.d.ts +79 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +210 -0
- package/dist/calendar.js.map +1 -0
- package/dist/capacity.d.ts +72 -0
- package/dist/capacity.d.ts.map +1 -0
- package/dist/capacity.js +163 -0
- package/dist/capacity.js.map +1 -0
- package/dist/dsl-utils.d.ts +5 -0
- package/dist/dsl-utils.d.ts.map +1 -0
- package/dist/dsl-utils.js +28 -0
- package/dist/dsl-utils.js.map +1 -0
- package/dist/edge-routing.d.ts +89 -0
- package/dist/edge-routing.d.ts.map +1 -0
- package/dist/edge-routing.js +435 -0
- package/dist/edge-routing.js.map +1 -0
- package/dist/frame-tab-geometry.d.ts +78 -0
- package/dist/frame-tab-geometry.d.ts.map +1 -0
- package/dist/frame-tab-geometry.js +115 -0
- package/dist/frame-tab-geometry.js.map +1 -0
- package/dist/header-card-geometry.d.ts +29 -0
- package/dist/header-card-geometry.d.ts.map +1 -0
- package/dist/header-card-geometry.js +41 -0
- package/dist/header-card-geometry.js.map +1 -0
- package/dist/i18n.d.ts +48 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +114 -0
- package/dist/i18n.js.map +1 -0
- package/dist/include-chrome-geometry.d.ts +86 -0
- package/dist/include-chrome-geometry.d.ts.map +1 -0
- package/dist/include-chrome-geometry.js +104 -0
- package/dist/include-chrome-geometry.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/inline-date-pin-geometry.d.ts +46 -0
- package/dist/inline-date-pin-geometry.d.ts.map +1 -0
- package/dist/inline-date-pin-geometry.js +149 -0
- package/dist/inline-date-pin-geometry.js.map +1 -0
- package/dist/item-bar-geometry.d.ts +157 -0
- package/dist/item-bar-geometry.d.ts.map +1 -0
- package/dist/item-bar-geometry.js +214 -0
- package/dist/item-bar-geometry.js.map +1 -0
- package/dist/lane-utilization.d.ts +90 -0
- package/dist/lane-utilization.d.ts.map +1 -0
- package/dist/lane-utilization.js +206 -0
- package/dist/lane-utilization.js.map +1 -0
- package/dist/layout-context.d.ts +143 -0
- package/dist/layout-context.d.ts.map +1 -0
- package/dist/layout-context.js +8 -0
- package/dist/layout-context.js.map +1 -0
- package/dist/layout.d.ts +18 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +1298 -0
- package/dist/layout.js.map +1 -0
- package/dist/nodes/anchor-node.d.ts +16 -0
- package/dist/nodes/anchor-node.d.ts.map +1 -0
- package/dist/nodes/anchor-node.js +68 -0
- package/dist/nodes/anchor-node.js.map +1 -0
- package/dist/nodes/footnote-node.d.ts +10 -0
- package/dist/nodes/footnote-node.d.ts.map +1 -0
- package/dist/nodes/footnote-node.js +41 -0
- package/dist/nodes/footnote-node.js.map +1 -0
- package/dist/nodes/group-node.d.ts +29 -0
- package/dist/nodes/group-node.d.ts.map +1 -0
- package/dist/nodes/group-node.js +195 -0
- package/dist/nodes/group-node.js.map +1 -0
- package/dist/nodes/include-node.d.ts +16 -0
- package/dist/nodes/include-node.d.ts.map +1 -0
- package/dist/nodes/include-node.js +117 -0
- package/dist/nodes/include-node.js.map +1 -0
- package/dist/nodes/item-node.d.ts +51 -0
- package/dist/nodes/item-node.d.ts.map +1 -0
- package/dist/nodes/item-node.js +108 -0
- package/dist/nodes/item-node.js.map +1 -0
- package/dist/nodes/marker-geometry.d.ts +22 -0
- package/dist/nodes/marker-geometry.d.ts.map +1 -0
- package/dist/nodes/marker-geometry.js +38 -0
- package/dist/nodes/marker-geometry.js.map +1 -0
- package/dist/nodes/milestone-node.d.ts +48 -0
- package/dist/nodes/milestone-node.d.ts.map +1 -0
- package/dist/nodes/milestone-node.js +210 -0
- package/dist/nodes/milestone-node.js.map +1 -0
- package/dist/nodes/parallel-node.d.ts +21 -0
- package/dist/nodes/parallel-node.d.ts.map +1 -0
- package/dist/nodes/parallel-node.js +88 -0
- package/dist/nodes/parallel-node.js.map +1 -0
- package/dist/nodes/roadmap-node.d.ts +76 -0
- package/dist/nodes/roadmap-node.d.ts.map +1 -0
- package/dist/nodes/roadmap-node.js +788 -0
- package/dist/nodes/roadmap-node.js.map +1 -0
- package/dist/nodes/swimlane-node.d.ts +38 -0
- package/dist/nodes/swimlane-node.d.ts.map +1 -0
- package/dist/nodes/swimlane-node.js +308 -0
- package/dist/nodes/swimlane-node.js.map +1 -0
- package/dist/renderable.d.ts +44 -0
- package/dist/renderable.d.ts.map +1 -0
- package/dist/renderable.js +21 -0
- package/dist/renderable.js.map +1 -0
- package/dist/row-packer.d.ts +125 -0
- package/dist/row-packer.d.ts.map +1 -0
- package/dist/row-packer.js +169 -0
- package/dist/row-packer.js.map +1 -0
- package/dist/style-resolution.d.ts +14 -0
- package/dist/style-resolution.d.ts.map +1 -0
- package/dist/style-resolution.js +191 -0
- package/dist/style-resolution.js.map +1 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +241 -0
- package/dist/themes/dark.js.map +1 -0
- package/dist/themes/grayscale.d.ts +4 -0
- package/dist/themes/grayscale.d.ts.map +1 -0
- package/dist/themes/grayscale.js +237 -0
- package/dist/themes/grayscale.js.map +1 -0
- package/dist/themes/index.d.ts +19 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +57 -0
- package/dist/themes/index.js.map +1 -0
- package/dist/themes/light.d.ts +4 -0
- package/dist/themes/light.d.ts.map +1 -0
- package/dist/themes/light.js +248 -0
- package/dist/themes/light.js.map +1 -0
- package/dist/themes/shape.d.ts +194 -0
- package/dist/themes/shape.d.ts.map +1 -0
- package/dist/themes/shape.js +6 -0
- package/dist/themes/shape.js.map +1 -0
- package/dist/themes/shared.d.ts +145 -0
- package/dist/themes/shared.d.ts.map +1 -0
- package/dist/themes/shared.js +310 -0
- package/dist/themes/shared.js.map +1 -0
- package/dist/time-scale.d.ts +39 -0
- package/dist/time-scale.d.ts.map +1 -0
- package/dist/time-scale.js +62 -0
- package/dist/time-scale.js.map +1 -0
- package/dist/types.d.ts +516 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/view-preset.d.ts +23 -0
- package/dist/view-preset.d.ts.map +1 -0
- package/dist/view-preset.js +146 -0
- package/dist/view-preset.js.map +1 -0
- package/dist/working-calendar.d.ts +14 -0
- package/dist/working-calendar.d.ts.map +1 -0
- package/dist/working-calendar.js +74 -0
- package/dist/working-calendar.js.map +1 -0
- package/package.json +43 -0
- package/src/band-scale.ts +115 -0
- package/src/calendar.ts +244 -0
- package/src/capacity.ts +191 -0
- package/src/dsl-utils.ts +30 -0
- package/src/edge-routing.ts +550 -0
- package/src/frame-tab-geometry.ts +165 -0
- package/src/header-card-geometry.ts +48 -0
- package/src/i18n.ts +124 -0
- package/src/include-chrome-geometry.ts +156 -0
- package/src/index.ts +118 -0
- package/src/inline-date-pin-geometry.ts +196 -0
- package/src/item-bar-geometry.ts +271 -0
- package/src/lane-utilization.ts +259 -0
- package/src/layout-context.ts +182 -0
- package/src/layout.ts +1530 -0
- package/src/nodes/anchor-node.ts +77 -0
- package/src/nodes/footnote-node.ts +60 -0
- package/src/nodes/group-node.ts +260 -0
- package/src/nodes/include-node.ts +168 -0
- package/src/nodes/item-node.ts +171 -0
- package/src/nodes/marker-geometry.ts +43 -0
- package/src/nodes/milestone-node.ts +263 -0
- package/src/nodes/parallel-node.ts +110 -0
- package/src/nodes/roadmap-node.ts +957 -0
- package/src/nodes/swimlane-node.ts +423 -0
- package/src/renderable.ts +68 -0
- package/src/row-packer.ts +271 -0
- package/src/style-resolution.ts +243 -0
- package/src/themes/dark.ts +244 -0
- package/src/themes/grayscale.ts +240 -0
- package/src/themes/index.ts +66 -0
- package/src/themes/light.ts +251 -0
- package/src/themes/shape.ts +230 -0
- package/src/themes/shared.ts +369 -0
- package/src/time-scale.ts +78 -0
- package/src/types.ts +641 -0
- package/src/view-preset.ts +180 -0
- package/src/working-calendar.ts +91 -0
|
@@ -0,0 +1,206 @@
|
|
|
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
|
+
import { propValue } from './dsl-utils.js';
|
|
15
|
+
/**
|
|
16
|
+
* Built-in defaults used when neither the lane nor its `default swimlane`
|
|
17
|
+
* declares a threshold. Mirrors specs/dsl.md rule 17d.
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_UTILIZATION_WARN_FRACTION = 0.8; // 80%
|
|
20
|
+
export const DEFAULT_UTILIZATION_OVER_FRACTION = 1.0; // 100%
|
|
21
|
+
/**
|
|
22
|
+
* Walk the lane's positioned children and return one `LoadContributor` per
|
|
23
|
+
* item that contributes load. Items inside `parallel` and `group` blocks are
|
|
24
|
+
* descended into recursively; the block envelopes themselves contribute
|
|
25
|
+
* nothing (they are pure containers).
|
|
26
|
+
*
|
|
27
|
+
* `inferItemLoad` mirrors the spec's "Default capacity" table:
|
|
28
|
+
* - Explicit `capacity:N` → that value.
|
|
29
|
+
* - Sized item without explicit `capacity:` → 1 (the default for sized
|
|
30
|
+
* items, matching the duration-derivation default).
|
|
31
|
+
* - Duration-literal item without `capacity:` → 0 (the bar paints normally
|
|
32
|
+
* but does not contribute load — this is the legacy "uncounted" item
|
|
33
|
+
* family from before the size system existed).
|
|
34
|
+
*/
|
|
35
|
+
export function collectLoadContributors(children) {
|
|
36
|
+
const out = [];
|
|
37
|
+
walk(children, out);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
function walk(children, out) {
|
|
41
|
+
for (const child of children) {
|
|
42
|
+
if (child.kind === 'item') {
|
|
43
|
+
const load = inferItemLoad(child);
|
|
44
|
+
if (load > 0 && child.box.width > 0) {
|
|
45
|
+
out.push({
|
|
46
|
+
startX: child.box.x,
|
|
47
|
+
endX: child.box.x + child.box.width,
|
|
48
|
+
load,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (child.kind === 'parallel' || child.kind === 'group') {
|
|
53
|
+
walk(child.children, out);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function inferItemLoad(item) {
|
|
58
|
+
if (item.capacity)
|
|
59
|
+
return item.capacity.value;
|
|
60
|
+
if (item.size)
|
|
61
|
+
return 1;
|
|
62
|
+
return 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Compute a lane's utilization model. Returns `null` when there is no
|
|
66
|
+
* meaningful underline to paint:
|
|
67
|
+
* - Lane has no `capacity:` (no denominator → undefined utilization).
|
|
68
|
+
* - Lane has no items contributing load (collectLoadContributors returns
|
|
69
|
+
* an empty list).
|
|
70
|
+
* - Both thresholds resolve to `none` (caller has opted out of every
|
|
71
|
+
* color band; nothing to paint).
|
|
72
|
+
*
|
|
73
|
+
* The returned `PositionedLaneUtilization` carries the resolved thresholds
|
|
74
|
+
* (in fraction form, or `null` for opt-out) alongside the segments so the
|
|
75
|
+
* renderer can render legends / tooltips without re-resolving anything.
|
|
76
|
+
*/
|
|
77
|
+
export function computeLaneUtilization(opts) {
|
|
78
|
+
if (opts.capacityValue <= 0)
|
|
79
|
+
return null;
|
|
80
|
+
if (opts.warnFraction === null && opts.overFraction === null)
|
|
81
|
+
return null;
|
|
82
|
+
const contributors = collectLoadContributors(opts.children);
|
|
83
|
+
if (contributors.length === 0)
|
|
84
|
+
return null;
|
|
85
|
+
// Build sorted unique x coordinates from every event boundary.
|
|
86
|
+
const xSet = new Set();
|
|
87
|
+
for (const c of contributors) {
|
|
88
|
+
xSet.add(c.startX);
|
|
89
|
+
xSet.add(c.endX);
|
|
90
|
+
}
|
|
91
|
+
const xs = Array.from(xSet).sort((a, b) => a - b);
|
|
92
|
+
if (xs.length < 2)
|
|
93
|
+
return null;
|
|
94
|
+
// Per half-open interval [xs[j], xs[j+1]) compute the active load by
|
|
95
|
+
// summing every contributor whose span covers the interval midpoint.
|
|
96
|
+
// O(n²) but n is small (typically <20 items per lane); avoids the
|
|
97
|
+
// bookkeeping of an event-stream sweep without a measurable cost.
|
|
98
|
+
const raw = [];
|
|
99
|
+
for (let j = 0; j < xs.length - 1; j++) {
|
|
100
|
+
const a = xs[j];
|
|
101
|
+
const b = xs[j + 1];
|
|
102
|
+
const mid = (a + b) / 2;
|
|
103
|
+
let load = 0;
|
|
104
|
+
for (const c of contributors) {
|
|
105
|
+
if (c.startX <= mid && mid < c.endX)
|
|
106
|
+
load += c.load;
|
|
107
|
+
}
|
|
108
|
+
raw.push({
|
|
109
|
+
startX: a,
|
|
110
|
+
endX: b,
|
|
111
|
+
load,
|
|
112
|
+
classification: classifyLoad(load, opts.capacityValue, opts.warnFraction, opts.overFraction),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// Coalesce adjacent same-classification segments so the renderer paints
|
|
116
|
+
// one rectangle per visible color band rather than per event boundary.
|
|
117
|
+
const segments = [];
|
|
118
|
+
for (const s of raw) {
|
|
119
|
+
const last = segments[segments.length - 1];
|
|
120
|
+
if (last && last.classification === s.classification && last.endX === s.startX) {
|
|
121
|
+
last.endX = s.endX;
|
|
122
|
+
// Keep the first interval's `load` as a representative; the
|
|
123
|
+
// coalesced span may have varying load within a single color
|
|
124
|
+
// band but renderers paint by class, not by exact load.
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
segments.push({ ...s });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
segments,
|
|
132
|
+
capacityValue: opts.capacityValue,
|
|
133
|
+
warnFraction: opts.warnFraction,
|
|
134
|
+
overFraction: opts.overFraction,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Classify a single load value against the lane's resolved capacity and
|
|
139
|
+
* thresholds. Spec § "Load function and segmentation":
|
|
140
|
+
* - `u < warn-at` → green (healthy; includes `u = 0` so the underline
|
|
141
|
+
* stays continuous).
|
|
142
|
+
* - `warn-at ≤ u < over-at` → yellow.
|
|
143
|
+
* - `u ≥ over-at` → red.
|
|
144
|
+
*
|
|
145
|
+
* `null` thresholds disable that color band: a `null` warnFraction collapses
|
|
146
|
+
* to a binary green / red indicator; a `null` overFraction collapses to
|
|
147
|
+
* green / yellow; both `null` is unreachable here (caller short-circuits
|
|
148
|
+
* upstream).
|
|
149
|
+
*/
|
|
150
|
+
export function classifyLoad(load, capacity, warnFraction, overFraction) {
|
|
151
|
+
const u = load / capacity;
|
|
152
|
+
if (overFraction !== null && u >= overFraction)
|
|
153
|
+
return 'red';
|
|
154
|
+
if (warnFraction !== null && u >= warnFraction)
|
|
155
|
+
return 'yellow';
|
|
156
|
+
return 'green';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Resolve the lane's effective utilization thresholds, applying the spec's
|
|
160
|
+
* resolution order:
|
|
161
|
+
*
|
|
162
|
+
* 1. Lane's own `utilization-warn-at:` / `utilization-over-at:` properties.
|
|
163
|
+
* 2. The applicable `default swimlane` declaration's properties.
|
|
164
|
+
* 3. Built-in defaults (`warn-at:80%`, `over-at:100%`).
|
|
165
|
+
*
|
|
166
|
+
* Each side resolves independently — a lane can pin only one threshold and
|
|
167
|
+
* inherit the other from defaults / built-ins. The returned `null` means
|
|
168
|
+
* "opted out via `none`" and disables that color band downstream.
|
|
169
|
+
*
|
|
170
|
+
* Malformed values (already reported by the validator) are treated as
|
|
171
|
+
* "unset" — the resolver falls through to the next layer rather than
|
|
172
|
+
* double-reporting.
|
|
173
|
+
*/
|
|
174
|
+
export function resolveLaneUtilizationThresholds(lane, defaults) {
|
|
175
|
+
const dflt = defaults.get('swimlane');
|
|
176
|
+
const warn = resolveThreshold(propValue(lane.properties, 'utilization-warn-at'), dflt ? propValue(dflt.properties, 'utilization-warn-at') : undefined, DEFAULT_UTILIZATION_WARN_FRACTION);
|
|
177
|
+
const over = resolveThreshold(propValue(lane.properties, 'utilization-over-at'), dflt ? propValue(dflt.properties, 'utilization-over-at') : undefined, DEFAULT_UTILIZATION_OVER_FRACTION);
|
|
178
|
+
return { warn, over };
|
|
179
|
+
}
|
|
180
|
+
function resolveThreshold(laneVal, defaultVal, builtinFraction) {
|
|
181
|
+
const raw = laneVal ?? defaultVal;
|
|
182
|
+
const parsed = parseThresholdRaw(raw);
|
|
183
|
+
if (parsed.kind === 'unset')
|
|
184
|
+
return builtinFraction;
|
|
185
|
+
if (parsed.kind === 'none')
|
|
186
|
+
return null;
|
|
187
|
+
return parsed.value;
|
|
188
|
+
}
|
|
189
|
+
const PERCENT_RE = /^\d+(?:\.\d+)?%$/;
|
|
190
|
+
const DECIMAL_FRACTION_RE = /^\d+\.\d+$/;
|
|
191
|
+
function parseThresholdRaw(val) {
|
|
192
|
+
if (val === undefined)
|
|
193
|
+
return { kind: 'unset' };
|
|
194
|
+
if (val === 'none')
|
|
195
|
+
return { kind: 'none' };
|
|
196
|
+
if (PERCENT_RE.test(val)) {
|
|
197
|
+
const n = parseFloat(val) / 100;
|
|
198
|
+
return Number.isFinite(n) && n > 0 ? { kind: 'number', value: n } : { kind: 'unset' };
|
|
199
|
+
}
|
|
200
|
+
if (DECIMAL_FRACTION_RE.test(val)) {
|
|
201
|
+
const n = parseFloat(val);
|
|
202
|
+
return Number.isFinite(n) && n > 0 ? { kind: 'number', value: n } : { kind: 'unset' };
|
|
203
|
+
}
|
|
204
|
+
return { kind: 'unset' };
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=lane-utilization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lane-utilization.js","sourceRoot":"","sources":["../src/lane-utilization.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,aAAa;AACb,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,mEAAmE;AACnE,6EAA6E;AAC7E,6EAA6E;AAC7E,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,aAAa;AAGb,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAS3C;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC,CAAC,MAAM;AAC5D,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC,CAAC,OAAO;AAe7D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAgC;IACpE,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACpB,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,IAAI,CAAC,QAAgC,EAAE,GAAsB;IAClE,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;gBAClC,GAAG,CAA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,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC1F,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { EntityProperty, GroupBlock, ItemDeclaration, LabelDeclaration, ParallelBlock, SymbolDeclaration } from '@nowline/core';
|
|
2
|
+
import type { BandScale } from './band-scale.js';
|
|
3
|
+
import type { resolveCalendar } from './calendar.js';
|
|
4
|
+
import type { StyleContext } from './style-resolution.js';
|
|
5
|
+
import type { TimeScale } from './time-scale.js';
|
|
6
|
+
import type { MarkerRowPlacement, Point, PositionedItem, PositionedTimelineScale, PositionedTrackChild, ResolvedSize, SlackCorridor } from './types.js';
|
|
7
|
+
import type { WorkingCalendar } from './working-calendar.js';
|
|
8
|
+
/** Slim accumulator used while sequencing items into a track. */
|
|
9
|
+
export interface TrackCursor {
|
|
10
|
+
/** Left edge where the next item begins. */
|
|
11
|
+
x: number;
|
|
12
|
+
/** Top edge of the current row. */
|
|
13
|
+
y: number;
|
|
14
|
+
/** Accumulated height of the track. */
|
|
15
|
+
height: number;
|
|
16
|
+
/** Rightmost edge reached. */
|
|
17
|
+
maxX: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function newCursor(x: number, y: number): TrackCursor;
|
|
20
|
+
/**
|
|
21
|
+
* Shared layout state passed through the per-entity sequencers and
|
|
22
|
+
* Renderable nodes. Owns the resolved calendar/timeline/style scope plus
|
|
23
|
+
* the running entity-edge maps that `after:` / `before:` references read.
|
|
24
|
+
*/
|
|
25
|
+
export interface LayoutContext {
|
|
26
|
+
cal: ReturnType<typeof resolveCalendar>;
|
|
27
|
+
styleCtx: StyleContext;
|
|
28
|
+
sizes: Map<string, ResolvedSize>;
|
|
29
|
+
labels: Map<string, LabelDeclaration>;
|
|
30
|
+
teams: Map<string, import('@nowline/core').TeamDeclaration>;
|
|
31
|
+
persons: Map<string, import('@nowline/core').PersonDeclaration>;
|
|
32
|
+
/**
|
|
33
|
+
* Custom `symbol` declarations from `ResolvedConfig.symbols`. Used by
|
|
34
|
+
* `resolveCapacityIcon` (in `capacity.ts`) to dereference custom symbol
|
|
35
|
+
* ids like `capacity-icon:budget` to the symbol's `unicode:` payload.
|
|
36
|
+
* Empty when the file declares no symbols.
|
|
37
|
+
*/
|
|
38
|
+
symbols: Map<string, SymbolDeclaration>;
|
|
39
|
+
footnoteIndex: Map<string, number>;
|
|
40
|
+
/** For each footnote id, the list of `on:` host ids it references. */
|
|
41
|
+
footnoteHosts: Map<string, string[]>;
|
|
42
|
+
timeline: PositionedTimelineScale;
|
|
43
|
+
scale: TimeScale;
|
|
44
|
+
calendar: WorkingCalendar;
|
|
45
|
+
bandScale: BandScale;
|
|
46
|
+
entityLeftEdges: Map<string, number>;
|
|
47
|
+
entityRightEdges: Map<string, number>;
|
|
48
|
+
entityMidpoints: Map<string, Point>;
|
|
49
|
+
/**
|
|
50
|
+
* Visual edges for items (entries with a painted bar). Differs
|
|
51
|
+
* from `entityLeftEdges`/`entityRightEdges` (logical column
|
|
52
|
+
* boundaries) by `ITEM_INSET_PX` on each side so dependency
|
|
53
|
+
* arrows attach to the painted bar edge instead of landing in
|
|
54
|
+
* the inter-column gutter. Anchors and milestones are absent —
|
|
55
|
+
* their attach geometry uses `(center.x, target.row.midY)` on
|
|
56
|
+
* the cut line, computed inline by `buildDependencies`.
|
|
57
|
+
*/
|
|
58
|
+
entityVisualLeftX: Map<string, number>;
|
|
59
|
+
entityVisualRightX: Map<string, number>;
|
|
60
|
+
/**
|
|
61
|
+
* Per-item exit point for `after:` dependency arrows leaving
|
|
62
|
+
* this entity. Default = `(visualRight, midY)`. When the
|
|
63
|
+
* caption spills past the bar's right edge (`textSpills`), the
|
|
64
|
+
* exit drops to `(box.x + box.width / 2, box.y + box.height)`
|
|
65
|
+
* — the bottom-middle of the progress strip — so the arrow
|
|
66
|
+
* doesn't visually pierce the spilled title/meta text to the
|
|
67
|
+
* right of the bar.
|
|
68
|
+
*/
|
|
69
|
+
itemArrowSource: Map<string, Point>;
|
|
70
|
+
/**
|
|
71
|
+
* Flow key for each item, used to dedupe milestone slack arrows.
|
|
72
|
+
* A "flow" is the deepest enclosing single-track container —
|
|
73
|
+
* swimlane root, sequential group, or one parallel sub-track.
|
|
74
|
+
* Two items share a flowKey iff they share that container path
|
|
75
|
+
* (file order already encodes their ordering, so only the
|
|
76
|
+
* latest predecessor in each flow contributes a slack arrow).
|
|
77
|
+
*/
|
|
78
|
+
itemFlowKey: Map<string, string>;
|
|
79
|
+
/**
|
|
80
|
+
* The flow key currently being built by the swimlane walk.
|
|
81
|
+
* Container nodes (`SwimlaneNode`, `GroupNode`, `ParallelNode`)
|
|
82
|
+
* push their own segment onto this string before recursing into
|
|
83
|
+
* children and restore it afterward. `sequenceItem` reads this
|
|
84
|
+
* value to populate `itemFlowKey`.
|
|
85
|
+
*/
|
|
86
|
+
currentFlowKey: string;
|
|
87
|
+
/**
|
|
88
|
+
* Y coordinate where milestone slack arrows attach for each item id.
|
|
89
|
+
* Defaults to the item's row midpoint; when an item's caption spills
|
|
90
|
+
* past the bar's right edge, drops to the progress-strip's vertical
|
|
91
|
+
* center (`box.y + box.height - PROGRESS_STRIP_HEIGHT_PX / 2`) so the
|
|
92
|
+
* arrow stays clear of the spilled title/meta line and visually
|
|
93
|
+
* aligns with the bottom-edge progress bar instead.
|
|
94
|
+
*/
|
|
95
|
+
itemSlackAttachY: Map<string, number>;
|
|
96
|
+
/**
|
|
97
|
+
* Horizontal arrow corridors that the swimlane row-packer must avoid.
|
|
98
|
+
* Empty during the first layout pass; populated from the first
|
|
99
|
+
* pass's milestones and consulted on the second pass so the binding
|
|
100
|
+
* predecessor (and any unrelated overlapping item) drops to a row
|
|
101
|
+
* whose Y does not match the corridor.
|
|
102
|
+
*/
|
|
103
|
+
slackCorridors: SlackCorridor[];
|
|
104
|
+
/**
|
|
105
|
+
* Pre-computed marker-row placement (row index + label box + side)
|
|
106
|
+
* for every anchor and date-pinned milestone. After-only milestones
|
|
107
|
+
* pack against this map at build time; date-pinned entries are
|
|
108
|
+
* snapshot upstream so their (Y, label) survives swimlane reflows.
|
|
109
|
+
*/
|
|
110
|
+
markerRowPlacements: Map<string, MarkerRowPlacement>;
|
|
111
|
+
chartTopY: number;
|
|
112
|
+
chartBottomY: number;
|
|
113
|
+
/**
|
|
114
|
+
* Y coordinate at the bottom of the last swimlane / include region.
|
|
115
|
+
* Distinct from `chartBottomY`, which extends through any mirrored
|
|
116
|
+
* bottom timeline tick panel. Marker cut-lines (anchors, milestones)
|
|
117
|
+
* stop here so they never invade the bottom date strip; the now-line
|
|
118
|
+
* uses the wider `chartBottomY` (or the bottom panel's bottom edge)
|
|
119
|
+
* to thread the entire timeline strip.
|
|
120
|
+
*/
|
|
121
|
+
swimlaneBottomY: number;
|
|
122
|
+
chartRightX: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Bundle of layout-internal helper callbacks injected from `layout.ts`
|
|
126
|
+
* into the per-entity Renderable nodes. Keeping the helpers in
|
|
127
|
+
* `layout.ts` (rather than splitting them across many tiny files) means
|
|
128
|
+
* the nodes stay small and importable without a runtime cycle: they
|
|
129
|
+
* receive the helpers at construction time via this struct.
|
|
130
|
+
*/
|
|
131
|
+
export interface LayoutHelpers {
|
|
132
|
+
sequenceItem: (child: ItemDeclaration, cursor: TrackCursor, ctx: LayoutContext, ownerOverride?: string) => PositionedItem;
|
|
133
|
+
sequenceOne: (child: ItemDeclaration | GroupBlock | ParallelBlock, cursor: TrackCursor, ctx: LayoutContext) => PositionedTrackChild;
|
|
134
|
+
resolveChildStart: (props: EntityProperty[], seqDefault: number, laneLeftX: number, ctx: LayoutContext) => number;
|
|
135
|
+
newCursor: (x: number, y: number) => TrackCursor;
|
|
136
|
+
estimateTextWidth: (text: string, fontSize: number) => number;
|
|
137
|
+
/** Predict the extra height an item's wrapped label-chip rows will
|
|
138
|
+
* add, so callers can size the row pitch BEFORE handing off to
|
|
139
|
+
* `sequenceItem`. Returns 0 when the item's labels all fit on a
|
|
140
|
+
* single chip row. */
|
|
141
|
+
predictItemChipExtraHeight: (item: ItemDeclaration, ctx: LayoutContext) => number;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=layout-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-context.d.ts","sourceRoot":"","sources":["../src/layout-context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACR,kBAAkB,EAClB,KAAK,EACL,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,iEAAiE;AACjE,MAAM,WAAW,WAAW;IACxB,4CAA4C;IAC5C,CAAC,EAAE,MAAM,CAAC;IACV,mCAAmC;IACnC,CAAC,EAAE,MAAM,CAAC;IACV,uCAAuC;IACvC,MAAM,EAAE,MAAM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AE,eAAe,EAAE,GAAG,EAAE,aAAa,KAAK,MAAM,CAAC;CACrF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
export function newCursor(x, y) {
|
|
6
|
+
return { x, y, height: 0, maxX: x };
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=layout-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-context.js","sourceRoot":"","sources":["../src/layout-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,iEAAiE;AACjE,uEAAuE;AACvE,4DAA4D;AAqC5D,MAAM,UAAU,SAAS,CAAC,CAAS,EAAE,CAAS;IAC1C,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NowlineFile, ResolveResult } from '@nowline/core';
|
|
2
|
+
import type { ThemeName } from './themes/index.js';
|
|
3
|
+
import type { PositionedRoadmap } from './types.js';
|
|
4
|
+
export interface LayoutOptions {
|
|
5
|
+
theme?: ThemeName;
|
|
6
|
+
today?: Date;
|
|
7
|
+
width?: number;
|
|
8
|
+
/**
|
|
9
|
+
* BCP-47 tag controlling axis labels, the now-pill string, and the
|
|
10
|
+
* quarter prefix. Resolved by the caller (CLI flag → env vars). When
|
|
11
|
+
* undefined, layout falls back to the file's `nowline v1 locale:` and
|
|
12
|
+
* then to `en-US`. See `specs/localization.md`.
|
|
13
|
+
*/
|
|
14
|
+
locale?: string;
|
|
15
|
+
}
|
|
16
|
+
export type LayoutResult = PositionedRoadmap;
|
|
17
|
+
export declare function layoutRoadmap(file: NowlineFile, resolved: ResolveResult, options?: LayoutOptions): LayoutResult;
|
|
18
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKR,WAAW,EAEX,aAAa,EAEhB,MAAM,eAAe,CAAC;AA2DvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAanD,OAAO,KAAK,EAYR,iBAAiB,EAIpB,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,aAAa;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAq3C7C,wBAAgB,aAAa,CACzB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE,aAAkB,GAC5B,YAAY,CAcd"}
|