@nowline/layout 0.8.6 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/axis-columns.d.ts +70 -0
- package/dist/axis-columns.d.ts.map +1 -0
- package/dist/axis-columns.js +104 -0
- package/dist/axis-columns.js.map +1 -0
- package/dist/calendar-resolver.d.ts +27 -0
- package/dist/calendar-resolver.d.ts.map +1 -0
- package/dist/calendar-resolver.js +132 -0
- package/dist/calendar-resolver.js.map +1 -0
- package/dist/calendar.d.ts +0 -19
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +4 -44
- package/dist/calendar.js.map +1 -1
- package/dist/canvas-width.d.ts +23 -0
- package/dist/canvas-width.d.ts.map +1 -0
- package/dist/canvas-width.js +26 -0
- package/dist/canvas-width.js.map +1 -0
- package/dist/capacity.d.ts +28 -0
- package/dist/capacity.d.ts.map +1 -1
- package/dist/capacity.js +64 -29
- package/dist/capacity.js.map +1 -1
- package/dist/chart-translation.d.ts +22 -0
- package/dist/chart-translation.d.ts.map +1 -0
- package/dist/chart-translation.js +83 -0
- package/dist/chart-translation.js.map +1 -0
- package/dist/container-header-geometry.d.ts +64 -0
- package/dist/container-header-geometry.d.ts.map +1 -0
- package/dist/container-header-geometry.js +89 -0
- package/dist/container-header-geometry.js.map +1 -0
- package/dist/dsl-utils.d.ts +3 -4
- package/dist/dsl-utils.d.ts.map +1 -1
- package/dist/dsl-utils.js +8 -25
- package/dist/dsl-utils.js.map +1 -1
- package/dist/edge-routing.d.ts +69 -78
- package/dist/edge-routing.d.ts.map +1 -1
- package/dist/edge-routing.js +271 -401
- package/dist/edge-routing.js.map +1 -1
- package/dist/frame-tab-geometry.d.ts +24 -14
- package/dist/frame-tab-geometry.d.ts.map +1 -1
- package/dist/frame-tab-geometry.js +69 -23
- package/dist/frame-tab-geometry.js.map +1 -1
- package/dist/header-card-geometry.d.ts +12 -0
- package/dist/header-card-geometry.d.ts.map +1 -1
- package/dist/header-card-geometry.js +14 -2
- package/dist/header-card-geometry.js.map +1 -1
- package/dist/header-logo.d.ts +28 -0
- package/dist/header-logo.d.ts.map +1 -0
- package/dist/header-logo.js +51 -0
- package/dist/header-logo.js.map +1 -0
- package/dist/i18n.d.ts +11 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +11 -1
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +20 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/inline-date-pin-geometry.d.ts +19 -11
- package/dist/inline-date-pin-geometry.d.ts.map +1 -1
- package/dist/inline-date-pin-geometry.js +45 -46
- package/dist/inline-date-pin-geometry.js.map +1 -1
- package/dist/item-bar-geometry.d.ts +192 -4
- package/dist/item-bar-geometry.d.ts.map +1 -1
- package/dist/item-bar-geometry.js +258 -5
- package/dist/item-bar-geometry.js.map +1 -1
- package/dist/item-port-geometry.d.ts +13 -0
- package/dist/item-port-geometry.d.ts.map +1 -0
- package/dist/item-port-geometry.js +63 -0
- package/dist/item-port-geometry.js.map +1 -0
- package/dist/layout-context.d.ts +115 -51
- package/dist/layout-context.d.ts.map +1 -1
- package/dist/layout-context.js +96 -5
- package/dist/layout-context.js.map +1 -1
- package/dist/layout-insights.d.ts.map +1 -1
- package/dist/layout-insights.js +73 -1
- package/dist/layout-insights.js.map +1 -1
- package/dist/layout.d.ts +35 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +18 -1315
- package/dist/layout.js.map +1 -1
- package/dist/nodes/anchor-node.d.ts.map +1 -1
- package/dist/nodes/anchor-node.js +11 -4
- package/dist/nodes/anchor-node.js.map +1 -1
- package/dist/nodes/content-extent.d.ts +24 -0
- package/dist/nodes/content-extent.d.ts.map +1 -0
- package/dist/nodes/content-extent.js +100 -0
- package/dist/nodes/content-extent.js.map +1 -0
- package/dist/nodes/dependency-edges.d.ts +6 -0
- package/dist/nodes/dependency-edges.d.ts.map +1 -0
- package/dist/nodes/dependency-edges.js +148 -0
- package/dist/nodes/dependency-edges.js.map +1 -0
- package/dist/nodes/footnote-node.d.ts +24 -3
- package/dist/nodes/footnote-node.d.ts.map +1 -1
- package/dist/nodes/footnote-node.js +129 -25
- package/dist/nodes/footnote-node.js.map +1 -1
- package/dist/nodes/group-node.d.ts +10 -21
- package/dist/nodes/group-node.d.ts.map +1 -1
- package/dist/nodes/group-node.js +79 -152
- package/dist/nodes/group-node.js.map +1 -1
- package/dist/nodes/header-node.d.ts +56 -0
- package/dist/nodes/header-node.d.ts.map +1 -0
- package/dist/nodes/header-node.js +163 -0
- package/dist/nodes/header-node.js.map +1 -0
- package/dist/nodes/include-node.d.ts +22 -12
- package/dist/nodes/include-node.d.ts.map +1 -1
- package/dist/nodes/include-node.js +95 -62
- package/dist/nodes/include-node.js.map +1 -1
- package/dist/nodes/item-measure.d.ts +135 -0
- package/dist/nodes/item-measure.d.ts.map +1 -0
- package/dist/nodes/item-measure.js +514 -0
- package/dist/nodes/item-measure.js.map +1 -0
- package/dist/nodes/item-node.d.ts +162 -9
- package/dist/nodes/item-node.d.ts.map +1 -1
- package/dist/nodes/item-node.js +256 -69
- package/dist/nodes/item-node.js.map +1 -1
- package/dist/nodes/marker-band.d.ts +118 -0
- package/dist/nodes/marker-band.d.ts.map +1 -0
- package/dist/nodes/marker-band.js +303 -0
- package/dist/nodes/marker-band.js.map +1 -0
- package/dist/nodes/marker-geometry.js +1 -1
- package/dist/nodes/marker-geometry.js.map +1 -1
- package/dist/nodes/milestone-node.d.ts +112 -15
- package/dist/nodes/milestone-node.d.ts.map +1 -1
- package/dist/nodes/milestone-node.js +246 -95
- package/dist/nodes/milestone-node.js.map +1 -1
- package/dist/nodes/nowline-node.d.ts +8 -0
- package/dist/nodes/nowline-node.d.ts.map +1 -0
- package/dist/nodes/nowline-node.js +74 -0
- package/dist/nodes/nowline-node.js.map +1 -0
- package/dist/nodes/parallel-node.d.ts +7 -12
- package/dist/nodes/parallel-node.d.ts.map +1 -1
- package/dist/nodes/parallel-node.js +66 -30
- package/dist/nodes/parallel-node.js.map +1 -1
- package/dist/nodes/region-markers.d.ts +41 -0
- package/dist/nodes/region-markers.d.ts.map +1 -0
- package/dist/nodes/region-markers.js +130 -0
- package/dist/nodes/region-markers.js.map +1 -0
- package/dist/nodes/roadmap-node.d.ts +9 -72
- package/dist/nodes/roadmap-node.d.ts.map +1 -1
- package/dist/nodes/roadmap-node.js +38 -788
- package/dist/nodes/roadmap-node.js.map +1 -1
- package/dist/nodes/row-track.d.ts +33 -0
- package/dist/nodes/row-track.d.ts.map +1 -0
- package/dist/nodes/row-track.js +170 -0
- package/dist/nodes/row-track.js.map +1 -0
- package/dist/nodes/sequence-item.d.ts +25 -0
- package/dist/nodes/sequence-item.d.ts.map +1 -0
- package/dist/nodes/sequence-item.js +396 -0
- package/dist/nodes/sequence-item.js.map +1 -0
- package/dist/nodes/sequence-one.d.ts +5 -0
- package/dist/nodes/sequence-one.d.ts.map +1 -0
- package/dist/nodes/sequence-one.js +26 -0
- package/dist/nodes/sequence-one.js.map +1 -0
- package/dist/nodes/swimlane-node.d.ts +5 -17
- package/dist/nodes/swimlane-node.d.ts.map +1 -1
- package/dist/nodes/swimlane-node.js +62 -145
- package/dist/nodes/swimlane-node.js.map +1 -1
- package/dist/nodes/wave-node.d.ts +52 -0
- package/dist/nodes/wave-node.d.ts.map +1 -0
- package/dist/nodes/wave-node.js +483 -0
- package/dist/nodes/wave-node.js.map +1 -0
- package/dist/non-working-display.d.ts +14 -0
- package/dist/non-working-display.d.ts.map +1 -0
- package/dist/non-working-display.js +28 -0
- package/dist/non-working-display.js.map +1 -0
- package/dist/phases/date-window.d.ts +48 -0
- package/dist/phases/date-window.d.ts.map +1 -0
- package/dist/phases/date-window.js +130 -0
- package/dist/phases/date-window.js.map +1 -0
- package/dist/phases/finalize.d.ts +198 -0
- package/dist/phases/finalize.d.ts.map +1 -0
- package/dist/phases/finalize.js +1058 -0
- package/dist/phases/finalize.js.map +1 -0
- package/dist/phases/measure.d.ts +77 -0
- package/dist/phases/measure.d.ts.map +1 -0
- package/dist/phases/measure.js +222 -0
- package/dist/phases/measure.js.map +1 -0
- package/dist/phases/place.d.ts +28 -0
- package/dist/phases/place.d.ts.map +1 -0
- package/dist/phases/place.js +225 -0
- package/dist/phases/place.js.map +1 -0
- package/dist/renderable.d.ts.map +1 -1
- package/dist/renderable.js +23 -3
- package/dist/renderable.js.map +1 -1
- package/dist/resolve-today.d.ts +11 -1
- package/dist/resolve-today.d.ts.map +1 -1
- package/dist/resolve-today.js +26 -12
- package/dist/resolve-today.js.map +1 -1
- package/dist/row-packer.d.ts +42 -16
- package/dist/row-packer.d.ts.map +1 -1
- package/dist/row-packer.js +51 -78
- package/dist/row-packer.js.map +1 -1
- package/dist/schedule.d.ts +58 -1
- package/dist/schedule.d.ts.map +1 -1
- package/dist/schedule.js +280 -106
- package/dist/schedule.js.map +1 -1
- package/dist/start-rules.d.ts +27 -0
- package/dist/start-rules.d.ts.map +1 -0
- package/dist/start-rules.js +91 -0
- package/dist/start-rules.js.map +1 -0
- package/dist/start-terms.d.ts +23 -0
- package/dist/start-terms.d.ts.map +1 -0
- package/dist/start-terms.js +27 -0
- package/dist/start-terms.js.map +1 -0
- package/dist/status-dot.d.ts +46 -0
- package/dist/status-dot.d.ts.map +1 -0
- package/dist/status-dot.js +78 -0
- package/dist/status-dot.js.map +1 -0
- package/dist/style-resolution.d.ts.map +1 -1
- package/dist/style-resolution.js +23 -43
- package/dist/style-resolution.js.map +1 -1
- package/dist/text-measure.d.ts +28 -0
- package/dist/text-measure.d.ts.map +1 -0
- package/dist/text-measure.js +70 -0
- package/dist/text-measure.js.map +1 -0
- package/dist/themes/contrast.d.ts +4 -0
- package/dist/themes/contrast.d.ts.map +1 -0
- package/dist/themes/contrast.js +32 -0
- package/dist/themes/contrast.js.map +1 -0
- package/dist/themes/dark.d.ts.map +1 -1
- package/dist/themes/dark.js +28 -1
- package/dist/themes/dark.js.map +1 -1
- package/dist/themes/grayscale.d.ts.map +1 -1
- package/dist/themes/grayscale.js +28 -1
- package/dist/themes/grayscale.js.map +1 -1
- package/dist/themes/index.d.ts +4 -11
- package/dist/themes/index.d.ts.map +1 -1
- package/dist/themes/index.js +6 -4
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/light.d.ts.map +1 -1
- package/dist/themes/light.js +28 -1
- package/dist/themes/light.js.map +1 -1
- package/dist/themes/shape.d.ts +31 -0
- package/dist/themes/shape.d.ts.map +1 -1
- package/dist/themes/shared.d.ts +44 -50
- package/dist/themes/shared.d.ts.map +1 -1
- package/dist/themes/shared.js +79 -83
- package/dist/themes/shared.js.map +1 -1
- package/dist/time-scale.d.ts +42 -6
- package/dist/time-scale.d.ts.map +1 -1
- package/dist/time-scale.js +109 -17
- package/dist/time-scale.js.map +1 -1
- package/dist/types.d.ts +528 -11
- package/dist/types.d.ts.map +1 -1
- package/dist/view-preset.d.ts +61 -6
- package/dist/view-preset.d.ts.map +1 -1
- package/dist/view-preset.js +439 -24
- package/dist/view-preset.js.map +1 -1
- package/dist/wave-barrier.d.ts +107 -0
- package/dist/wave-barrier.d.ts.map +1 -0
- package/dist/wave-barrier.js +174 -0
- package/dist/wave-barrier.js.map +1 -0
- package/dist/wave-hatch.d.ts +4 -0
- package/dist/wave-hatch.d.ts.map +1 -0
- package/dist/wave-hatch.js +21 -0
- package/dist/wave-hatch.js.map +1 -0
- package/dist/wave-layout.d.ts +99 -0
- package/dist/wave-layout.d.ts.map +1 -0
- package/dist/wave-layout.js +130 -0
- package/dist/wave-layout.js.map +1 -0
- package/dist/working-calendar.d.ts +128 -4
- package/dist/working-calendar.d.ts.map +1 -1
- package/dist/working-calendar.js +725 -51
- package/dist/working-calendar.js.map +1 -1
- package/dist/working-span.d.ts +11 -0
- package/dist/working-span.d.ts.map +1 -0
- package/dist/working-span.js +18 -0
- package/dist/working-span.js.map +1 -0
- package/package.json +4 -4
- package/src/axis-columns.ts +140 -0
- package/src/calendar-resolver.ts +161 -0
- package/src/calendar.ts +4 -45
- package/src/canvas-width.ts +36 -0
- package/src/capacity.ts +71 -30
- package/src/chart-translation.ts +88 -0
- package/src/container-header-geometry.ts +116 -0
- package/src/dsl-utils.ts +8 -26
- package/src/edge-routing.ts +347 -491
- package/src/frame-tab-geometry.ts +78 -25
- package/src/header-card-geometry.ts +17 -2
- package/src/header-logo.ts +67 -0
- package/src/i18n.ts +22 -1
- package/src/index.ts +97 -12
- package/src/inline-date-pin-geometry.ts +55 -58
- package/src/item-bar-geometry.ts +341 -5
- package/src/item-port-geometry.ts +69 -0
- package/src/layout-context.ts +210 -72
- package/src/layout-insights.ts +109 -2
- package/src/layout.ts +57 -1530
- package/src/nodes/anchor-node.ts +11 -4
- package/src/nodes/content-extent.ts +107 -0
- package/src/nodes/dependency-edges.ts +171 -0
- package/src/nodes/footnote-node.ts +171 -31
- package/src/nodes/group-node.ts +92 -214
- package/src/nodes/header-node.ts +255 -0
- package/src/nodes/include-node.ts +124 -110
- package/src/nodes/item-measure.ts +723 -0
- package/src/nodes/item-node.ts +358 -80
- package/src/nodes/marker-band.ts +406 -0
- package/src/nodes/marker-geometry.ts +1 -1
- package/src/nodes/milestone-node.ts +321 -136
- package/src/nodes/nowline-node.ts +87 -0
- package/src/nodes/parallel-node.ts +69 -38
- package/src/nodes/region-markers.ts +194 -0
- package/src/nodes/roadmap-node.ts +46 -950
- package/src/nodes/row-track.ts +217 -0
- package/src/nodes/sequence-item.ts +433 -0
- package/src/nodes/sequence-one.ts +40 -0
- package/src/nodes/swimlane-node.ts +66 -205
- package/src/nodes/wave-node.ts +609 -0
- package/src/non-working-display.ts +32 -0
- package/src/phases/date-window.ts +191 -0
- package/src/phases/finalize.ts +1303 -0
- package/src/phases/measure.ts +329 -0
- package/src/phases/place.ts +318 -0
- package/src/renderable.ts +23 -3
- package/src/resolve-today.ts +28 -25
- package/src/row-packer.ts +85 -84
- package/src/schedule.ts +362 -114
- package/src/start-rules.ts +113 -0
- package/src/start-terms.ts +38 -0
- package/src/status-dot.ts +81 -0
- package/src/style-resolution.ts +27 -57
- package/src/text-measure.ts +71 -0
- package/src/themes/contrast.ts +34 -0
- package/src/themes/dark.ts +28 -1
- package/src/themes/grayscale.ts +28 -1
- package/src/themes/index.ts +10 -7
- package/src/themes/light.ts +28 -1
- package/src/themes/shape.ts +38 -0
- package/src/themes/shared.ts +85 -93
- package/src/time-scale.ts +117 -19
- package/src/types.ts +529 -20
- package/src/view-preset.ts +520 -27
- package/src/wave-barrier.ts +242 -0
- package/src/wave-hatch.ts +25 -0
- package/src/wave-layout.ts +203 -0
- package/src/working-calendar.ts +875 -57
- package/src/working-span.ts +19 -0
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// `box`** (`box.x` for X, `box.y` for Y), with `box.height` /
|
|
14
14
|
// `box.width` used as the "right edge" / "bottom edge" anchor where
|
|
15
15
|
// noted.
|
|
16
|
+
import { estimateTextWidth } from './text-measure.js';
|
|
16
17
|
// ---- Caption (title + meta text) ---------------------------------
|
|
17
18
|
/** Horizontal inset (px) for the caption's left edge inside the bar. */
|
|
18
19
|
export const ITEM_CAPTION_INSET_X_PX = 12;
|
|
@@ -31,6 +32,55 @@ export const ITEM_CAPTION_META_BASELINE_OFFSET_PX = 38;
|
|
|
31
32
|
export const ITEM_CAPTION_TITLE_FONT_SIZE_PX = 13;
|
|
32
33
|
/** Font size (px) of the meta text. */
|
|
33
34
|
export const ITEM_CAPTION_META_FONT_SIZE_PX = 11;
|
|
35
|
+
/**
|
|
36
|
+
* Baseline-to-baseline pitch (px) between consecutive TITLE lines when
|
|
37
|
+
* a long title word-wraps inside the bar. The meta line sits one more
|
|
38
|
+
* pitch below the last title line for every extra title line, see
|
|
39
|
+
* `itemCaptionMetaBaselineOffset`.
|
|
40
|
+
*/
|
|
41
|
+
export const ITEM_CAPTION_TITLE_LINE_HEIGHT_PX = 16;
|
|
42
|
+
/**
|
|
43
|
+
* Most title lines layout will wrap a title onto inside the bar. A
|
|
44
|
+
* title that needs more than this spills to the right of the bar as a
|
|
45
|
+
* single line instead.
|
|
46
|
+
*/
|
|
47
|
+
export const ITEM_CAPTION_TITLE_MAX_LINES = 2;
|
|
48
|
+
/**
|
|
49
|
+
* Baseline Y (px from the bar's top) of the meta line when the title
|
|
50
|
+
* occupies `lineCount` lines. One line gives the classic
|
|
51
|
+
* `ITEM_CAPTION_META_BASELINE_OFFSET_PX`; each extra title line pushes
|
|
52
|
+
* the meta baseline down by `ITEM_CAPTION_TITLE_LINE_HEIGHT_PX`.
|
|
53
|
+
*/
|
|
54
|
+
export function itemCaptionMetaBaselineOffset(lineCount) {
|
|
55
|
+
return (ITEM_CAPTION_META_BASELINE_OFFSET_PX +
|
|
56
|
+
(Math.max(1, lineCount) - 1) * ITEM_CAPTION_TITLE_LINE_HEIGHT_PX);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Baseline Y (px from the bar's top) of the LAST caption line: the
|
|
60
|
+
* meta line when the item has one, otherwise the final title line.
|
|
61
|
+
* Anything stacked below the caption (label chips) must clear this.
|
|
62
|
+
*/
|
|
63
|
+
export function itemCaptionLastBaselineOffset(lineCount, hasMeta) {
|
|
64
|
+
if (hasMeta)
|
|
65
|
+
return itemCaptionMetaBaselineOffset(lineCount);
|
|
66
|
+
return (ITEM_CAPTION_TITLE_BASELINE_OFFSET_PX +
|
|
67
|
+
(Math.max(1, lineCount) - 1) * ITEM_CAPTION_TITLE_LINE_HEIGHT_PX);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Extra bar height (px) a wrapped title needs on top of the default
|
|
71
|
+
* `bandwidth`. The default bar is sized so the caption's last baseline
|
|
72
|
+
* is at most `ITEM_CAPTION_META_BASELINE_OFFSET_PX`; anything below
|
|
73
|
+
* that grows the bar by the overshoot:
|
|
74
|
+
*
|
|
75
|
+
* - 1 title line (with or without meta): 0.
|
|
76
|
+
* - 2 title lines, no meta: line 2 lands at baseline 36, so 0.
|
|
77
|
+
* - 2 title lines + meta: meta baseline 54, so 16.
|
|
78
|
+
*
|
|
79
|
+
* The same number is the row-pitch increase for the bar's row.
|
|
80
|
+
*/
|
|
81
|
+
export function computeTitleBarExtra(lineCount, hasMeta) {
|
|
82
|
+
return Math.max(0, itemCaptionLastBaselineOffset(lineCount, hasMeta) - ITEM_CAPTION_META_BASELINE_OFFSET_PX);
|
|
83
|
+
}
|
|
34
84
|
// ---- Status dot (upper-right glyph) ------------------------------
|
|
35
85
|
/** Distance (px) from the bar's right edge to the dot's center. */
|
|
36
86
|
export const ITEM_STATUS_DOT_INSET_RIGHT_PX = 12;
|
|
@@ -46,6 +96,12 @@ export const ITEM_STATUS_DOT_RADIUS_PX = 5;
|
|
|
46
96
|
export const ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX = 22;
|
|
47
97
|
/** Baseline Y (px from bar's top) for footnote indicator digits. */
|
|
48
98
|
export const ITEM_FOOTNOTE_INDICATOR_BASELINE_OFFSET_PX = 14;
|
|
99
|
+
/**
|
|
100
|
+
* Font size (px) of the footnote indicator digits. The renderer paints
|
|
101
|
+
* them at this size and layout measures them with it (to find the
|
|
102
|
+
* cluster's left edge), so both read the same constant.
|
|
103
|
+
*/
|
|
104
|
+
export const ITEM_FOOTNOTE_INDICATOR_FONT_SIZE_PX = 10;
|
|
49
105
|
/**
|
|
50
106
|
* Horizontal step (px) between consecutive footnote indicators when
|
|
51
107
|
* an item carries more than one footnote — they walk LEFT from the
|
|
@@ -57,6 +113,48 @@ export const ITEM_FOOTNOTE_INDICATOR_STEP_PX = 8;
|
|
|
57
113
|
export const ITEM_LINK_ICON_TILE_SIZE_PX = 14;
|
|
58
114
|
/** Distance (px) from the bar's right/bottom edges to the tile's edge. */
|
|
59
115
|
export const ITEM_LINK_ICON_INSET_PX = 6;
|
|
116
|
+
/**
|
|
117
|
+
* Horizontal gap (px) between the link-icon tile's right edge and the
|
|
118
|
+
* start of the caption text when both render inside the bar.
|
|
119
|
+
*/
|
|
120
|
+
export const ITEM_LINK_ICON_TO_CAPTION_GAP_PX = 4;
|
|
121
|
+
/**
|
|
122
|
+
* Left inset (px) of the in-bar caption from the bar's left edge. It is
|
|
123
|
+
* `ITEM_CAPTION_INSET_X_PX` normally, pushed right past the link-icon
|
|
124
|
+
* tile (and its gap) when the bar carries a link icon, and pushed right
|
|
125
|
+
* past the `after:` inline-date glyph (and a gap) when the bar carries
|
|
126
|
+
* one INSIDE it:
|
|
127
|
+
*
|
|
128
|
+
* - no link icon, no glyph: 12
|
|
129
|
+
* - link icon, no glyph: 24
|
|
130
|
+
* - glyph, no link icon: 22 (the glyph spans 6..18, plus a 4 px gap)
|
|
131
|
+
* - glyph and link icon: 40 (the glyph spans 24..36, plus a 4 px gap)
|
|
132
|
+
*
|
|
133
|
+
* A glyph on a bar narrower than `MIN_BAR_WIDTH_FOR_INLINE_DATE_PX`
|
|
134
|
+
* spills out of the bar to the left and reserves nothing.
|
|
135
|
+
*
|
|
136
|
+
* `hasLinkIcon` is the same flag `computeItemInlineDatePins` places the
|
|
137
|
+
* glyph with, and the glyph's right edge comes from the same helper
|
|
138
|
+
* (`itemAfterGlyphInsideLeftX`), so the inset and the glyph can't
|
|
139
|
+
* disagree. The inset applies to every caption line, not only line 1,
|
|
140
|
+
* so the caption's left edge stays straight.
|
|
141
|
+
*/
|
|
142
|
+
export function itemCaptionInsetX(hasLinkIcon, afterGlyph) {
|
|
143
|
+
let inset = ITEM_CAPTION_INSET_X_PX;
|
|
144
|
+
if (hasLinkIcon) {
|
|
145
|
+
const linkColumn = ITEM_LINK_ICON_INSET_PX +
|
|
146
|
+
ITEM_LINK_ICON_TILE_SIZE_PX +
|
|
147
|
+
ITEM_LINK_ICON_TO_CAPTION_GAP_PX -
|
|
148
|
+
ITEM_CAPTION_INSET_X_PX;
|
|
149
|
+
inset = ITEM_CAPTION_INSET_X_PX + Math.max(0, linkColumn);
|
|
150
|
+
}
|
|
151
|
+
if (afterGlyph && !inlineDateGlyphSpills(afterGlyph.barWidth)) {
|
|
152
|
+
// Offsets from a left edge of 0, so the numbers are exact integers.
|
|
153
|
+
const glyphRight = itemAfterGlyphInsideLeftX(0, hasLinkIcon) + INLINE_DATE_GLYPH_TILE_SIZE_PX;
|
|
154
|
+
inset = Math.max(inset, glyphRight + ITEM_DECORATION_SPILL_GAP_PX);
|
|
155
|
+
}
|
|
156
|
+
return inset;
|
|
157
|
+
}
|
|
60
158
|
// ---- Narrow-bar decoration spill --------------------------------
|
|
61
159
|
/**
|
|
62
160
|
* Horizontal gap (px) between consecutive decorations (status dot,
|
|
@@ -65,12 +163,14 @@ export const ITEM_LINK_ICON_INSET_PX = 6;
|
|
|
65
163
|
*/
|
|
66
164
|
export const ITEM_DECORATION_SPILL_GAP_PX = 4;
|
|
67
165
|
/**
|
|
68
|
-
* Minimum bar width (px)
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
166
|
+
* Minimum bar width (px) at which the status dot sits INSIDE the bar:
|
|
167
|
+
* the dot's centre is `ITEM_STATUS_DOT_INSET_RIGHT_PX` from the right
|
|
168
|
+
* edge, so a bar of twice that width has the same air on both sides
|
|
169
|
+
* of it (the centre sits mid-bar). A narrower bar would crowd the
|
|
170
|
+
* dot against its left edge, so the dot spills into the caption
|
|
171
|
+
* column to the right of the bar instead.
|
|
72
172
|
*/
|
|
73
|
-
export const MIN_BAR_WIDTH_FOR_DOT_PX =
|
|
173
|
+
export const MIN_BAR_WIDTH_FOR_DOT_PX = 2 * ITEM_STATUS_DOT_INSET_RIGHT_PX;
|
|
74
174
|
/**
|
|
75
175
|
* Minimum bar width (px) needed to host the link-icon tile AND the
|
|
76
176
|
* status dot inside the bar with at least
|
|
@@ -91,6 +191,49 @@ export const MIN_BAR_WIDTH_FOR_LINK_AND_DOT_PX = ITEM_LINK_ICON_INSET_PX +
|
|
|
91
191
|
* for one digit is 8px (font-size 10, bold).
|
|
92
192
|
*/
|
|
93
193
|
export const MIN_BAR_WIDTH_FOR_FOOTNOTE_PX = ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX + 1;
|
|
194
|
+
/**
|
|
195
|
+
* Lay out a bar's spill column `[icon?] [caption?] [¹²?] [dot?]` from
|
|
196
|
+
* `ITEM_CAPTION_SPILL_GAP_PX` past the bar, one `ITEM_DECORATION_SPILL_GAP_PX`
|
|
197
|
+
* between the parts that are present and none after the last. The item
|
|
198
|
+
* measure reads it to cap a caption at the chart's end, and `sequenceItem`
|
|
199
|
+
* places the parts with it.
|
|
200
|
+
*/
|
|
201
|
+
export function layoutSpillCluster(input) {
|
|
202
|
+
let cursor = input.barRightX + ITEM_CAPTION_SPILL_GAP_PX;
|
|
203
|
+
// A gap goes in only once something is already in the column, so the
|
|
204
|
+
// cluster leaves no dangling gap past its last part.
|
|
205
|
+
let needGap = false;
|
|
206
|
+
let iconSpillX = null;
|
|
207
|
+
if (input.iconSpills) {
|
|
208
|
+
iconSpillX = cursor;
|
|
209
|
+
cursor = iconSpillX + ITEM_LINK_ICON_TILE_SIZE_PX;
|
|
210
|
+
needGap = true;
|
|
211
|
+
}
|
|
212
|
+
let captionX = null;
|
|
213
|
+
if (input.captionWidth !== null) {
|
|
214
|
+
if (needGap)
|
|
215
|
+
cursor += ITEM_DECORATION_SPILL_GAP_PX;
|
|
216
|
+
captionX = cursor;
|
|
217
|
+
cursor += input.captionWidth;
|
|
218
|
+
needGap = true;
|
|
219
|
+
}
|
|
220
|
+
let footnoteSpillStartX = null;
|
|
221
|
+
if (input.footnoteCount > 0) {
|
|
222
|
+
if (needGap)
|
|
223
|
+
cursor += ITEM_DECORATION_SPILL_GAP_PX;
|
|
224
|
+
footnoteSpillStartX = cursor;
|
|
225
|
+
cursor += input.footnoteCount * ITEM_FOOTNOTE_INDICATOR_STEP_PX;
|
|
226
|
+
needGap = true;
|
|
227
|
+
}
|
|
228
|
+
let dotSpillCx = null;
|
|
229
|
+
if (input.dotSpills) {
|
|
230
|
+
if (needGap)
|
|
231
|
+
cursor += ITEM_DECORATION_SPILL_GAP_PX;
|
|
232
|
+
dotSpillCx = cursor + ITEM_STATUS_DOT_RADIUS_PX;
|
|
233
|
+
cursor = dotSpillCx + ITEM_STATUS_DOT_RADIUS_PX;
|
|
234
|
+
}
|
|
235
|
+
return { iconSpillX, captionX, footnoteSpillStartX, dotSpillCx, rightX: cursor };
|
|
236
|
+
}
|
|
94
237
|
// ---- Inline-date glyph (after:DATE / before:DATE corner badge) ---
|
|
95
238
|
//
|
|
96
239
|
// Renders the renderer's built-in `calendar` SVG at top-LEFT (`after`)
|
|
@@ -132,6 +275,116 @@ export const MIN_BAR_WIDTH_FOR_INLINE_DATE_PX = INLINE_DATE_GLYPH_INSET_LEFT_PX
|
|
|
132
275
|
INLINE_DATE_GLYPH_GAP_PX +
|
|
133
276
|
INLINE_DATE_GLYPH_TILE_SIZE_PX +
|
|
134
277
|
INLINE_DATE_GLYPH_INSET_RIGHT_PX;
|
|
278
|
+
/**
|
|
279
|
+
* True when a bar of painted width `barWidth` is too narrow to host the
|
|
280
|
+
* inline-date glyph inside, so it spills (`before:` right, `after:` left).
|
|
281
|
+
* The one threshold behind the glyph's `spilled` flag and the caption
|
|
282
|
+
* inset's decision to reserve room for it.
|
|
283
|
+
*/
|
|
284
|
+
export function inlineDateGlyphSpills(barWidth) {
|
|
285
|
+
return barWidth < MIN_BAR_WIDTH_FOR_INLINE_DATE_PX;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Left x of the `after:` inline-date glyph when it sits INSIDE the bar,
|
|
289
|
+
* for a bar whose left edge is at `leftEdge`:
|
|
290
|
+
*
|
|
291
|
+
* - no link icon: the glyph sits at the leftmost top-decoration slot,
|
|
292
|
+
* `INLINE_DATE_GLYPH_INSET_LEFT_PX` (6) from the edge
|
|
293
|
+
* - link icon: one `INLINE_DATE_GLYPH_GAP_PX` right of the tile's right
|
|
294
|
+
* edge (6 + 14 + 4 = 24 from the edge)
|
|
295
|
+
*
|
|
296
|
+
* The one formula behind both the glyph placement
|
|
297
|
+
* (`computeItemInlineDatePins`) and the caption's left inset
|
|
298
|
+
* (`itemCaptionInsetX`), so the two can never disagree. Pass
|
|
299
|
+
* `leftEdge = 0` to get the offset from the bar's left edge.
|
|
300
|
+
*/
|
|
301
|
+
export function itemAfterGlyphInsideLeftX(leftEdge, hasLinkIcon) {
|
|
302
|
+
return hasLinkIcon
|
|
303
|
+
? leftEdge +
|
|
304
|
+
ITEM_LINK_ICON_INSET_PX +
|
|
305
|
+
ITEM_LINK_ICON_TILE_SIZE_PX +
|
|
306
|
+
INLINE_DATE_GLYPH_GAP_PX
|
|
307
|
+
: leftEdge + INLINE_DATE_GLYPH_INSET_LEFT_PX;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Left x of the `before:` inline-date glyph when it sits INSIDE the bar,
|
|
311
|
+
* for a bar whose right edge is at `rightEdge`. The glyph walks LEFT
|
|
312
|
+
* from the rightmost top-decoration slot:
|
|
313
|
+
*
|
|
314
|
+
* - rightmost footnote anchors at (rightEdge - INSET_RIGHT_PX)
|
|
315
|
+
* - the leftmost footnote sits one step further left per extra digit
|
|
316
|
+
* - the status dot's left edge sits at (rightEdge - INSET_RIGHT - DOT_RADIUS)
|
|
317
|
+
* - the glyph sits one `INLINE_DATE_GLYPH_GAP_PX` further left than
|
|
318
|
+
* whichever of those is leftmost (footnotes win when present, since
|
|
319
|
+
* they are always left of the dot)
|
|
320
|
+
*
|
|
321
|
+
* The one formula behind both the glyph placement
|
|
322
|
+
* (`computeItemInlineDatePins`) and the title first-line clearance
|
|
323
|
+
* (`itemTitleFirstLineRightReservePx`), so the two can never disagree.
|
|
324
|
+
* Pass `rightEdge = 0` to get the offset from the bar's right edge
|
|
325
|
+
* (negative, inside the bar) with exact integer arithmetic.
|
|
326
|
+
*/
|
|
327
|
+
export function itemBeforeGlyphInsideLeftX(rightEdge, footnoteCount) {
|
|
328
|
+
let anchorRightX;
|
|
329
|
+
if (footnoteCount > 0) {
|
|
330
|
+
const leftmostFootnoteCenter = rightEdge -
|
|
331
|
+
ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX -
|
|
332
|
+
(footnoteCount - 1) * ITEM_FOOTNOTE_INDICATOR_STEP_PX;
|
|
333
|
+
anchorRightX = leftmostFootnoteCenter - INLINE_DATE_GLYPH_GAP_PX;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
const dotLeftEdge = rightEdge - ITEM_STATUS_DOT_INSET_RIGHT_PX - ITEM_STATUS_DOT_RADIUS_PX;
|
|
337
|
+
anchorRightX = dotLeftEdge - INLINE_DATE_GLYPH_GAP_PX;
|
|
338
|
+
}
|
|
339
|
+
return anchorRightX - INLINE_DATE_GLYPH_TILE_SIZE_PX;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Right-side space (px) the FIRST title line must leave free, measured
|
|
343
|
+
* from the bar's right edge: the larger of the plain right inset
|
|
344
|
+
* (`ITEM_CAPTION_INSET_X_PX`) and the distance to the top-right
|
|
345
|
+
* cluster's left edge plus `ITEM_DECORATION_SPILL_GAP_PX` of air.
|
|
346
|
+
*
|
|
347
|
+
* The cluster is the leftmost of three parts, each counted only when it
|
|
348
|
+
* renders INSIDE the bar (a narrow bar spills it into the column to the
|
|
349
|
+
* right instead, where it can't touch the title):
|
|
350
|
+
*
|
|
351
|
+
* - status dot: left edge at (right - 17); absent below
|
|
352
|
+
* `MIN_BAR_WIDTH_FOR_DOT_PX` (24). Dot only gives 21.
|
|
353
|
+
* - footnote digits: leftmost digit's left edge at
|
|
354
|
+
* (right - 22 - (n-1) * 8 - width); absent when they spill
|
|
355
|
+
* (`MIN_BAR_WIDTH_FOR_FOOTNOTE_PX`).
|
|
356
|
+
* - `before:` glyph: its left x, from `itemBeforeGlyphInsideLeftX`;
|
|
357
|
+
* absent when it spills (`MIN_BAR_WIDTH_FOR_INLINE_DATE_PX`).
|
|
358
|
+
*
|
|
359
|
+
* Offsets are computed from a right edge of 0 (inside the bar is
|
|
360
|
+
* negative) so the common cases are exact integers.
|
|
361
|
+
*/
|
|
362
|
+
export function itemTitleFirstLineRightReservePx(opts) {
|
|
363
|
+
const { barWidth, footnoteLabels, hasBeforeGlyph } = opts;
|
|
364
|
+
let clusterLeft = Number.POSITIVE_INFINITY;
|
|
365
|
+
if (barWidth >= MIN_BAR_WIDTH_FOR_DOT_PX) {
|
|
366
|
+
clusterLeft = Math.min(clusterLeft, -(ITEM_STATUS_DOT_INSET_RIGHT_PX + ITEM_STATUS_DOT_RADIUS_PX));
|
|
367
|
+
}
|
|
368
|
+
const footnoteCount = footnoteLabels.length;
|
|
369
|
+
const footnotesInside = footnoteCount > 0 && barWidth >= MIN_BAR_WIDTH_FOR_FOOTNOTE_PX;
|
|
370
|
+
if (footnotesInside) {
|
|
371
|
+
// Digit `k` (0 = leftmost) anchors its RIGHT end at
|
|
372
|
+
// `-22 - (n-1-k) * 8`, so its left edge is that minus its width.
|
|
373
|
+
// Normally digit 0 reaches furthest left; checking all of them
|
|
374
|
+
// also covers a wide late digit (e.g. footnote 100 next to 9).
|
|
375
|
+
for (let k = 0; k < footnoteCount; k += 1) {
|
|
376
|
+
const anchorX = -ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX -
|
|
377
|
+
(footnoteCount - 1 - k) * ITEM_FOOTNOTE_INDICATOR_STEP_PX;
|
|
378
|
+
const left = anchorX -
|
|
379
|
+
estimateTextWidth(footnoteLabels[k], ITEM_FOOTNOTE_INDICATOR_FONT_SIZE_PX);
|
|
380
|
+
clusterLeft = Math.min(clusterLeft, left);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (hasBeforeGlyph && barWidth >= MIN_BAR_WIDTH_FOR_INLINE_DATE_PX) {
|
|
384
|
+
clusterLeft = Math.min(clusterLeft, itemBeforeGlyphInsideLeftX(0, footnoteCount));
|
|
385
|
+
}
|
|
386
|
+
return Math.max(ITEM_CAPTION_INSET_X_PX, -clusterLeft + ITEM_DECORATION_SPILL_GAP_PX);
|
|
387
|
+
}
|
|
135
388
|
// ---- Label chips (along the bar's bottom) ------------------------
|
|
136
389
|
/** Height (px) of a label chip rectangle. */
|
|
137
390
|
export const LABEL_CHIP_HEIGHT_PX = 13;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-bar-geometry.js","sourceRoot":"","sources":["../src/item-bar-geometry.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,oEAAoE;AACpE,oEAAoE;AACpE,8CAA8C;AAC9C,EAAE;AACF,iEAAiE;AACjE,sEAAsE;AACtE,qEAAqE;AACrE,oEAAoE;AACpE,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,8DAA8D;AAC9D,oEAAoE;AACpE,SAAS;AAET,qEAAqE;AAErE,wEAAwE;AACxE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,CAAC;AAExD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEvD,wCAAwC;AACxC,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAElD,uCAAuC;AACvC,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAEjD,qEAAqE;AAErE,mEAAmE;AACnE,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAEjD,iEAAiE;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C,qCAAqC;AACrC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,qEAAqE;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAEzD,oEAAoE;AACpE,MAAM,CAAC,MAAM,0CAA0C,GAAG,EAAE,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,C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,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,IAAI,GAAG,OAAO,CAAC;YACf,SAAS;QACb,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;YAClB,SAAS;QACb,CAAC;QACD,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,wBAAwB,CAAC;QACpD,IAAI,CAAC,QAAQ,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,IAAI,GAAG,OAAO,CAAC;YACf,MAAM,GAAG,OAAO,CAAC;YACjB,QAAQ,GAAG,IAAI,CAAC;YAChB,SAAS;QACb,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QAClB,MAAM,GAAG,cAAc,CAAC;IAC5B,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ArrowEnd } from './edge-routing.js';
|
|
2
|
+
import type { PositionedGroup, PositionedItem, PositionedParallel } from './types.js';
|
|
3
|
+
/** An item as an arrow end. */
|
|
4
|
+
export declare function itemArrowEnd(item: PositionedItem, bandwidth: number): ArrowEnd;
|
|
5
|
+
/** A group or parallel as an arrow source: its box spans exactly its dates. */
|
|
6
|
+
export declare function containerArrowEnd(container: PositionedGroup | PositionedParallel): ArrowEnd;
|
|
7
|
+
/**
|
|
8
|
+
* Y where a milestone slack line leaves `item`: the row's nominal midline,
|
|
9
|
+
* or the progress strip's center when the caption spilled (so the line
|
|
10
|
+
* runs under the spilled title / meta text). Its x is the item's end date.
|
|
11
|
+
*/
|
|
12
|
+
export declare function itemSlackAttachY(item: PositionedItem, bandwidth: number): number;
|
|
13
|
+
//# sourceMappingURL=item-port-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-port-geometry.d.ts","sourceRoot":"","sources":["../src/item-port-geometry.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAOtF,+BAA+B;AAC/B,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,CAY9E;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,eAAe,GAAG,kBAAkB,GAAG,QAAQ,CAU3F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEhF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Arrow ends: where dependency arrows and milestone slack lines meet an
|
|
2
|
+
// item bar or a container.
|
|
3
|
+
//
|
|
4
|
+
// Every end is a pure function of the entity's FINAL geometry (its box,
|
|
5
|
+
// plus an item's `dateSpan` and the row bandwidth), read when the arrows
|
|
6
|
+
// are built, never captured while the entity is placed. Layout moves
|
|
7
|
+
// placed content down afterwards (a marker band that outgrows its sizing
|
|
8
|
+
// pushes the whole chart down), and a port captured at placement time
|
|
9
|
+
// would stay behind at the old y. Nothing moves horizontally, so the
|
|
10
|
+
// dates in x an item records at placement stay true.
|
|
11
|
+
//
|
|
12
|
+
// Rules (specs/true-width-layout.md §3.4, §3.5):
|
|
13
|
+
//
|
|
14
|
+
// - x comes from the dates: the router puts the port in the middle of
|
|
15
|
+
// the source's last day and the target's first day (`edge-routing.ts`).
|
|
16
|
+
// - y comes from the painted edges: top and bottom of the bar, or of the
|
|
17
|
+
// container (its header's top to its body's bottom).
|
|
18
|
+
// - On its own row an arrow runs at the row's NOMINAL midline,
|
|
19
|
+
// `box.y + bandwidth / 2`, so a bar grown by a wrapped title or a chip
|
|
20
|
+
// column shares the line with its un-grown row neighbours. A source
|
|
21
|
+
// whose caption spills right leaves at the centre of its bottom
|
|
22
|
+
// progress strip instead, so the leg runs under the caption; milestone
|
|
23
|
+
// slack lines leave on the same y.
|
|
24
|
+
import { PROGRESS_STRIP_HEIGHT_PX } from './themes/shared.js';
|
|
25
|
+
/** Y of the bottom progress strip's vertical center. */
|
|
26
|
+
function progressStripMidY(item) {
|
|
27
|
+
return item.box.y + item.box.height - PROGRESS_STRIP_HEIGHT_PX / 2;
|
|
28
|
+
}
|
|
29
|
+
/** An item as an arrow end. */
|
|
30
|
+
export function itemArrowEnd(item, bandwidth) {
|
|
31
|
+
const { box } = item;
|
|
32
|
+
return {
|
|
33
|
+
startX: item.dateSpan.startX,
|
|
34
|
+
endX: item.dateSpan.endX,
|
|
35
|
+
paintedX: box.x,
|
|
36
|
+
paintedWidth: box.width,
|
|
37
|
+
top: box.y,
|
|
38
|
+
bottom: box.y + box.height,
|
|
39
|
+
rowY: box.y + bandwidth / 2,
|
|
40
|
+
exitY: itemSlackAttachY(item, bandwidth),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** A group or parallel as an arrow source: its box spans exactly its dates. */
|
|
44
|
+
export function containerArrowEnd(container) {
|
|
45
|
+
const { box } = container;
|
|
46
|
+
return {
|
|
47
|
+
startX: box.x,
|
|
48
|
+
endX: box.x + box.width,
|
|
49
|
+
paintedX: box.x,
|
|
50
|
+
paintedWidth: box.width,
|
|
51
|
+
top: box.y,
|
|
52
|
+
bottom: box.y + box.height,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Y where a milestone slack line leaves `item`: the row's nominal midline,
|
|
57
|
+
* or the progress strip's center when the caption spilled (so the line
|
|
58
|
+
* runs under the spilled title / meta text). Its x is the item's end date.
|
|
59
|
+
*/
|
|
60
|
+
export function itemSlackAttachY(item, bandwidth) {
|
|
61
|
+
return item.textSpills ? progressStripMidY(item) : item.box.y + bandwidth / 2;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=item-port-geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-port-geometry.js","sourceRoot":"","sources":["../src/item-port-geometry.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2BAA2B;AAC3B,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,sEAAsE;AACtE,qEAAqE;AACrE,qDAAqD;AACrD,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,wEAAwE;AACxE,4EAA4E;AAC5E,2EAA2E;AAC3E,yDAAyD;AACzD,iEAAiE;AACjE,2EAA2E;AAC3E,wEAAwE;AACxE,oEAAoE;AACpE,2EAA2E;AAC3E,uCAAuC;AAGvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,wDAAwD;AACxD,SAAS,iBAAiB,CAAC,IAAoB;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,wBAAwB,GAAG,CAAC,CAAC;AACvE,CAAC;AAED,+BAA+B;AAC/B,MAAM,UAAU,YAAY,CAAC,IAAoB,EAAE,SAAiB;IAChE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACrB,OAAO;QACH,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;QAC5B,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;QACxB,QAAQ,EAAE,GAAG,CAAC,CAAC;QACf,YAAY,EAAE,GAAG,CAAC,KAAK;QACvB,GAAG,EAAE,GAAG,CAAC,CAAC;QACV,MAAM,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