@nowline/layout 0.2.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/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/item-bar-geometry.d.ts +127 -0
- package/dist/item-bar-geometry.d.ts.map +1 -0
- package/dist/item-bar-geometry.js +173 -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 +1213 -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 +187 -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 +80 -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/index.d.ts +15 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +30 -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 +483 -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 +37 -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 +116 -0
- package/src/item-bar-geometry.ts +222 -0
- package/src/lane-utilization.ts +259 -0
- package/src/layout-context.ts +182 -0
- package/src/layout.ts +1446 -0
- package/src/nodes/anchor-node.ts +77 -0
- package/src/nodes/footnote-node.ts +60 -0
- package/src/nodes/group-node.ts +252 -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 +101 -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/index.ts +36 -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 +607 -0
- package/src/view-preset.ts +180 -0
- package/src/working-calendar.ts +91 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Horizontal padding (px) inside the card from edge to text. */
|
|
2
|
+
export declare const HEADER_CARD_PADDING_X = 16;
|
|
3
|
+
/**
|
|
4
|
+
* Top padding (px) — measured to the BASELINE of the first title
|
|
5
|
+
* line. Larger than a typical "padding top" because it includes the
|
|
6
|
+
* cap-to-baseline distance for the 16 pt title font.
|
|
7
|
+
*/
|
|
8
|
+
export declare const HEADER_CARD_PADDING_TOP = 26;
|
|
9
|
+
/**
|
|
10
|
+
* Bottom padding (px) below the descender of the last text line.
|
|
11
|
+
* Symmetric-feeling visual padding (smaller than `PADDING_TOP` since
|
|
12
|
+
* top includes the cap-to-baseline distance).
|
|
13
|
+
*/
|
|
14
|
+
export declare const HEADER_CARD_PADDING_BOTTOM = 14;
|
|
15
|
+
/** Baseline-to-baseline spacing between consecutive title lines. */
|
|
16
|
+
export declare const HEADER_TITLE_LINE_HEIGHT_PX = 20;
|
|
17
|
+
/** Baseline-to-baseline spacing between consecutive author lines. */
|
|
18
|
+
export declare const HEADER_AUTHOR_LINE_HEIGHT_PX = 14;
|
|
19
|
+
/**
|
|
20
|
+
* Vertical gap (px) between the LAST title baseline and the FIRST
|
|
21
|
+
* author baseline. Larger than a normal line height because it spans
|
|
22
|
+
* the title's descender + the author's cap height.
|
|
23
|
+
*/
|
|
24
|
+
export declare const HEADER_TITLE_TO_AUTHOR_GAP_PX = 18;
|
|
25
|
+
/** Font size (px) of the title text. */
|
|
26
|
+
export declare const HEADER_TITLE_FONT_SIZE_PX = 16;
|
|
27
|
+
/** Font size (px) of the author text (subtitle). */
|
|
28
|
+
export declare const HEADER_AUTHOR_FONT_SIZE_PX = 11;
|
|
29
|
+
//# sourceMappingURL=header-card-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header-card-geometry.d.ts","sourceRoot":"","sources":["../src/header-card-geometry.ts"],"names":[],"mappings":"AAaA,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,oEAAoE;AACpE,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,qEAAqE;AACrE,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,wCAAwC;AACxC,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,oDAAoD;AACpD,eAAO,MAAM,0BAA0B,KAAK,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Header card geometry — sizing and text-stack metrics for the
|
|
2
|
+
// "header card" that sits beside the timeline (title + author block).
|
|
3
|
+
//
|
|
4
|
+
// Layout owns the card *size* (computed up-front in `sizeBesideHeader`
|
|
5
|
+
// from wrapped title/author text). The renderer paints the rectangle +
|
|
6
|
+
// text using the *same* paddings, line heights, and font sizes so the
|
|
7
|
+
// card is laid out and drawn consistently.
|
|
8
|
+
//
|
|
9
|
+
// Bumping any of these constants changes the visible size of the
|
|
10
|
+
// header card and the position of every text line inside it. Always
|
|
11
|
+
// keep the layout's `sizeBesideHeader` and the renderer's
|
|
12
|
+
// `renderHeader` aligned by going through this module.
|
|
13
|
+
/** Horizontal padding (px) inside the card from edge to text. */
|
|
14
|
+
export const HEADER_CARD_PADDING_X = 16;
|
|
15
|
+
/**
|
|
16
|
+
* Top padding (px) — measured to the BASELINE of the first title
|
|
17
|
+
* line. Larger than a typical "padding top" because it includes the
|
|
18
|
+
* cap-to-baseline distance for the 16 pt title font.
|
|
19
|
+
*/
|
|
20
|
+
export const HEADER_CARD_PADDING_TOP = 26;
|
|
21
|
+
/**
|
|
22
|
+
* Bottom padding (px) below the descender of the last text line.
|
|
23
|
+
* Symmetric-feeling visual padding (smaller than `PADDING_TOP` since
|
|
24
|
+
* top includes the cap-to-baseline distance).
|
|
25
|
+
*/
|
|
26
|
+
export const HEADER_CARD_PADDING_BOTTOM = 14;
|
|
27
|
+
/** Baseline-to-baseline spacing between consecutive title lines. */
|
|
28
|
+
export const HEADER_TITLE_LINE_HEIGHT_PX = 20;
|
|
29
|
+
/** Baseline-to-baseline spacing between consecutive author lines. */
|
|
30
|
+
export const HEADER_AUTHOR_LINE_HEIGHT_PX = 14;
|
|
31
|
+
/**
|
|
32
|
+
* Vertical gap (px) between the LAST title baseline and the FIRST
|
|
33
|
+
* author baseline. Larger than a normal line height because it spans
|
|
34
|
+
* the title's descender + the author's cap height.
|
|
35
|
+
*/
|
|
36
|
+
export const HEADER_TITLE_TO_AUTHOR_GAP_PX = 18;
|
|
37
|
+
/** Font size (px) of the title text. */
|
|
38
|
+
export const HEADER_TITLE_FONT_SIZE_PX = 16;
|
|
39
|
+
/** Font size (px) of the author text (subtitle). */
|
|
40
|
+
export const HEADER_AUTHOR_FONT_SIZE_PX = 11;
|
|
41
|
+
//# sourceMappingURL=header-card-geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header-card-geometry.js","sourceRoot":"","sources":["../src/header-card-geometry.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,sEAAsE;AACtE,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,sEAAsE;AACtE,2CAA2C;AAC3C,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,0DAA0D;AAC1D,uDAAuD;AAEvD,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,oEAAoE;AACpE,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAE9C,qEAAqE;AACrE,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEhD,wCAAwC;AACxC,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C,oDAAoD;AACpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC"}
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const DEFAULT_LOCALE = "en-US";
|
|
2
|
+
export interface LocaleStrings {
|
|
3
|
+
/** Short label painted inside the now-line pill. Sized for ~3-6 chars. */
|
|
4
|
+
nowLabel: string;
|
|
5
|
+
/** Prefix used when the timeline scale is quarters (e.g. `Q1 2026` / `T1 2026`). */
|
|
6
|
+
quarterPrefix: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the effective locale for the rendered artifact.
|
|
10
|
+
*
|
|
11
|
+
* Precedence (highest wins):
|
|
12
|
+
* 1. `directiveLocale` — `nowline v1 locale:fr-CA` from the file itself.
|
|
13
|
+
* The file is the artifact; its declared locale is authoritative the
|
|
14
|
+
* same way `<html lang="fr">` is on a web page or `:lang:` is in
|
|
15
|
+
* AsciiDoc. This guarantees cross-machine determinism: a French
|
|
16
|
+
* roadmap renders French even when invoked from a US-locale shell.
|
|
17
|
+
* 2. `override` — the CLI `--locale` flag plus env-var fallback,
|
|
18
|
+
* already resolved by the CLI before calling layout. Used only when
|
|
19
|
+
* the file declines to declare its own locale.
|
|
20
|
+
* 3. `DEFAULT_LOCALE` (`en-US`).
|
|
21
|
+
*
|
|
22
|
+
* Returns the input string verbatim — callers downstream walk the BCP-47
|
|
23
|
+
* fallback chain to find string entries.
|
|
24
|
+
*
|
|
25
|
+
* Note: the operator's locale (CLI flag / env vars) controls a separate,
|
|
26
|
+
* independent chain for terminal output (validator diagnostics, --help,
|
|
27
|
+
* verbose logs). See `specs/localization.md` for the two-chain model.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveLocale(override: string | undefined, directiveLocale: string | undefined): string;
|
|
30
|
+
/**
|
|
31
|
+
* Look up a locale's chrome strings, walking the BCP-47 tree until a
|
|
32
|
+
* value is found. The walk strips the trailing `-SUBTAG` and retries:
|
|
33
|
+
* `fr-CA → fr → en-US`
|
|
34
|
+
* `fr-BE → fr → en-US` (no fr-BE bundle yet — works for free)
|
|
35
|
+
* `de-AT → de → en-US` (no de bundles yet — falls all the way through)
|
|
36
|
+
*
|
|
37
|
+
* Always returns a fully-populated `LocaleStrings` because the `en-US`
|
|
38
|
+
* root has every key.
|
|
39
|
+
*/
|
|
40
|
+
export declare function localeStrings(locale: string): LocaleStrings;
|
|
41
|
+
/**
|
|
42
|
+
* BCP-47 fallback chain for a locale tag. Strips trailing `-SUBTAG`s
|
|
43
|
+
* one at a time until a primary subtag remains, then appends the root
|
|
44
|
+
* locale. Case-normalized to lowercase primary + uppercase region so
|
|
45
|
+
* lookups are stable regardless of input casing.
|
|
46
|
+
*/
|
|
47
|
+
export declare function fallbackChain(locale: string): string[];
|
|
48
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,MAAM,WAAW,aAAa;IAC1B,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;CACzB;AAyBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,GAAG,SAAS,GACpC,MAAM,CAER;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAa3D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAWtD"}
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Locale-aware strings used by the layout pipeline. Owns three things:
|
|
2
|
+
// - The BCP-47 fallback chain (`fr-CA → fr → en-US`).
|
|
3
|
+
// - A small message table for chrome strings the renderer paints
|
|
4
|
+
// directly (now-pill, quarter prefix).
|
|
5
|
+
// - The locale token passed to `Intl.DateTimeFormat` for axis labels.
|
|
6
|
+
//
|
|
7
|
+
// Today the table is inline; m-loc-d / m-loc-e (per `specs/localization.md`)
|
|
8
|
+
// will move this to a proper `messages.<locale>.ts` bundle layout. The
|
|
9
|
+
// shape here is deliberately minimal so that swap is mechanical.
|
|
10
|
+
export const DEFAULT_LOCALE = 'en-US';
|
|
11
|
+
// Bundle entries keyed by language tag. The fallback chain strips the
|
|
12
|
+
// trailing `-SUBTAG` and retries; a missing key in a child bundle falls
|
|
13
|
+
// through to the parent. `en-US` is the root.
|
|
14
|
+
//
|
|
15
|
+
// Region overlays (fr-CA, fr-FR) are intentionally omitted: at launch they
|
|
16
|
+
// have nothing region-specific to override. Empty overlays are a feature,
|
|
17
|
+
// not a bug — they exist as a contract for future divergence. See
|
|
18
|
+
// `specs/localization.md` § "Locale resolution".
|
|
19
|
+
const BUNDLES = {
|
|
20
|
+
'en-US': {
|
|
21
|
+
nowLabel: 'now',
|
|
22
|
+
quarterPrefix: 'Q',
|
|
23
|
+
},
|
|
24
|
+
fr: {
|
|
25
|
+
// Short form of "maintenant"; keeps the pill compact while staying
|
|
26
|
+
// correct French. The full word is too wide for the ~3-6 char pill
|
|
27
|
+
// budget without geometry work (tracked in m-loc-c).
|
|
28
|
+
nowLabel: 'maint.',
|
|
29
|
+
// `T` for trimestre — the standard French business convention.
|
|
30
|
+
quarterPrefix: 'T',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the effective locale for the rendered artifact.
|
|
35
|
+
*
|
|
36
|
+
* Precedence (highest wins):
|
|
37
|
+
* 1. `directiveLocale` — `nowline v1 locale:fr-CA` from the file itself.
|
|
38
|
+
* The file is the artifact; its declared locale is authoritative the
|
|
39
|
+
* same way `<html lang="fr">` is on a web page or `:lang:` is in
|
|
40
|
+
* AsciiDoc. This guarantees cross-machine determinism: a French
|
|
41
|
+
* roadmap renders French even when invoked from a US-locale shell.
|
|
42
|
+
* 2. `override` — the CLI `--locale` flag plus env-var fallback,
|
|
43
|
+
* already resolved by the CLI before calling layout. Used only when
|
|
44
|
+
* the file declines to declare its own locale.
|
|
45
|
+
* 3. `DEFAULT_LOCALE` (`en-US`).
|
|
46
|
+
*
|
|
47
|
+
* Returns the input string verbatim — callers downstream walk the BCP-47
|
|
48
|
+
* fallback chain to find string entries.
|
|
49
|
+
*
|
|
50
|
+
* Note: the operator's locale (CLI flag / env vars) controls a separate,
|
|
51
|
+
* independent chain for terminal output (validator diagnostics, --help,
|
|
52
|
+
* verbose logs). See `specs/localization.md` for the two-chain model.
|
|
53
|
+
*/
|
|
54
|
+
export function resolveLocale(override, directiveLocale) {
|
|
55
|
+
return directiveLocale ?? override ?? DEFAULT_LOCALE;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Look up a locale's chrome strings, walking the BCP-47 tree until a
|
|
59
|
+
* value is found. The walk strips the trailing `-SUBTAG` and retries:
|
|
60
|
+
* `fr-CA → fr → en-US`
|
|
61
|
+
* `fr-BE → fr → en-US` (no fr-BE bundle yet — works for free)
|
|
62
|
+
* `de-AT → de → en-US` (no de bundles yet — falls all the way through)
|
|
63
|
+
*
|
|
64
|
+
* Always returns a fully-populated `LocaleStrings` because the `en-US`
|
|
65
|
+
* root has every key.
|
|
66
|
+
*/
|
|
67
|
+
export function localeStrings(locale) {
|
|
68
|
+
const result = {};
|
|
69
|
+
for (const tag of fallbackChain(locale)) {
|
|
70
|
+
const bundle = BUNDLES[tag];
|
|
71
|
+
if (!bundle)
|
|
72
|
+
continue;
|
|
73
|
+
for (const key of Object.keys(bundle)) {
|
|
74
|
+
if (result[key] === undefined && bundle[key] !== undefined) {
|
|
75
|
+
result[key] = bundle[key];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// The root bundle (`en-US`) is always populated, so this cast is safe.
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* BCP-47 fallback chain for a locale tag. Strips trailing `-SUBTAG`s
|
|
84
|
+
* one at a time until a primary subtag remains, then appends the root
|
|
85
|
+
* locale. Case-normalized to lowercase primary + uppercase region so
|
|
86
|
+
* lookups are stable regardless of input casing.
|
|
87
|
+
*/
|
|
88
|
+
export function fallbackChain(locale) {
|
|
89
|
+
const chain = [];
|
|
90
|
+
let current = normalizeTag(locale);
|
|
91
|
+
while (current.length > 0) {
|
|
92
|
+
if (!chain.includes(current))
|
|
93
|
+
chain.push(current);
|
|
94
|
+
const dash = current.lastIndexOf('-');
|
|
95
|
+
if (dash <= 0)
|
|
96
|
+
break;
|
|
97
|
+
current = current.slice(0, dash);
|
|
98
|
+
}
|
|
99
|
+
if (!chain.includes(DEFAULT_LOCALE))
|
|
100
|
+
chain.push(DEFAULT_LOCALE);
|
|
101
|
+
return chain;
|
|
102
|
+
}
|
|
103
|
+
function normalizeTag(locale) {
|
|
104
|
+
const parts = locale.split('-');
|
|
105
|
+
return parts
|
|
106
|
+
.map((part, index) => {
|
|
107
|
+
if (index === 0)
|
|
108
|
+
return part.toLowerCase();
|
|
109
|
+
// Region subtag: 2 letters → upper-case; 3 digits → keep as-is.
|
|
110
|
+
return /^[a-zA-Z]{2}$/.test(part) ? part.toUpperCase() : part;
|
|
111
|
+
})
|
|
112
|
+
.join('-');
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wDAAwD;AACxD,mEAAmE;AACnE,2CAA2C;AAC3C,wEAAwE;AACxE,E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MAAc;IACxC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,IAAI,IAAI,CAAC;YAAE,MAAM;QACrB,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChE,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAChC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,KAAK;SACP,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACjB,IAAI,KAAK,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3C,gEAAgE;QAChE,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAClE,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Horizontal offset (px) from the include region's bounding-box left
|
|
3
|
+
* edge to the label tab's left edge. Equals the region's outer pad
|
|
4
|
+
* (8 px from `renderIncludeRegion`) plus a 16 px tab inset that keeps
|
|
5
|
+
* the chiclet visually anchored inside the dashed bracket rather than
|
|
6
|
+
* straddling its rounded corner.
|
|
7
|
+
*/
|
|
8
|
+
export declare const INCLUDE_CHROME_OFFSET_FROM_BOX_PX = 24;
|
|
9
|
+
/** Horizontal inset (px) from the tab's left edge to the label text. */
|
|
10
|
+
export declare const INCLUDE_CHROME_TAB_LEFT_INSET_PX = 10;
|
|
11
|
+
/**
|
|
12
|
+
* Horizontal inset (px) from the label text's right edge to the tab's
|
|
13
|
+
* right edge. Same as the left inset so the label appears optically
|
|
14
|
+
* centered inside its chiclet.
|
|
15
|
+
*/
|
|
16
|
+
export declare const INCLUDE_CHROME_TAB_RIGHT_INSET_PX = 10;
|
|
17
|
+
/**
|
|
18
|
+
* Px-per-char for the label rendered at 11 pt 600w in `FONT_STACK.sans`.
|
|
19
|
+
* Calibrated against system-ui at 11 pt bold (~5.8 px/char actual);
|
|
20
|
+
* 6.0 leaves a small safety margin without producing wide right
|
|
21
|
+
* whitespace inside the chiclet.
|
|
22
|
+
*/
|
|
23
|
+
export declare const INCLUDE_CHROME_TAB_LABEL_PER_CHAR_PX = 6;
|
|
24
|
+
/**
|
|
25
|
+
* Minimum total chiclet width (px). A floor so tiny labels still
|
|
26
|
+
* produce a chip wide enough to read; the badge/source bookmark sit
|
|
27
|
+
* outside the chiclet so they never push it past this minimum.
|
|
28
|
+
*/
|
|
29
|
+
export declare const INCLUDE_CHROME_TAB_MIN_WIDTH_PX = 60;
|
|
30
|
+
/** Gap (px) between the chiclet's right edge and the content badge. */
|
|
31
|
+
export declare const INCLUDE_CHROME_BADGE_GAP_PX = 6;
|
|
32
|
+
/** Square content-badge tile size (px). */
|
|
33
|
+
export declare const INCLUDE_CHROME_BADGE_SIZE_PX = 18;
|
|
34
|
+
/** Gap (px) between the badge's right edge and the source-path text. */
|
|
35
|
+
export declare const INCLUDE_CHROME_SOURCE_GAP_PX = 6;
|
|
36
|
+
/**
|
|
37
|
+
* Px-per-char for the source-path rendered at 9 pt in `FONT_STACK.mono`.
|
|
38
|
+
* Calibrated against ui-monospace at 9 pt regular (~5.4 px/char actual);
|
|
39
|
+
* 5.5 leaves a small safety margin so the halo never clips the path.
|
|
40
|
+
*/
|
|
41
|
+
export declare const INCLUDE_CHROME_SOURCE_PER_CHAR_PX = 5.5;
|
|
42
|
+
/**
|
|
43
|
+
* Halo padding (px) on each side of the source-path text. The halo
|
|
44
|
+
* masks the dashed bracket border that runs through the text's
|
|
45
|
+
* baseline so the path stays legible.
|
|
46
|
+
*/
|
|
47
|
+
export declare const INCLUDE_CHROME_SOURCE_HALO_PAD_PX = 3;
|
|
48
|
+
export interface IncludeChromeGeometry {
|
|
49
|
+
/** Estimated rendered width (px) of the label text, no min-clamp. */
|
|
50
|
+
labelTextWidth: number;
|
|
51
|
+
/** Estimated rendered width (px) of the source-path text; 0 when no source. */
|
|
52
|
+
sourceTextWidth: number;
|
|
53
|
+
/** Left X (canvas px) of the chiclet rectangle. */
|
|
54
|
+
tabX: number;
|
|
55
|
+
/** Total chiclet width (px), with min-width floor applied. */
|
|
56
|
+
tabWidth: number;
|
|
57
|
+
/** Canvas X (px) where the label text is painted (left-anchored). */
|
|
58
|
+
tabLabelX: number;
|
|
59
|
+
/** Left X (canvas px) of the content-badge tile; 0 when no badge. */
|
|
60
|
+
badgeX: number;
|
|
61
|
+
/** Square content-badge tile size (px); mirrors `INCLUDE_CHROME_BADGE_SIZE_PX`. */
|
|
62
|
+
badgeSize: number;
|
|
63
|
+
/** Left X (canvas px) of the source-path halo rect; 0 when no source. */
|
|
64
|
+
sourceHaloX: number;
|
|
65
|
+
/** Width (px) of the source-path halo rect; 0 when no source. */
|
|
66
|
+
sourceHaloWidth: number;
|
|
67
|
+
/** Canvas X (px) where the source-path text is painted (left-anchored); 0 when no source. */
|
|
68
|
+
sourceTextX: number;
|
|
69
|
+
/**
|
|
70
|
+
* Right edge (canvas px) of the entire chrome strip — used by the
|
|
71
|
+
* layout to size the include region's bounding box so the dashed
|
|
72
|
+
* bracket always encloses its own chrome. Equals the badge's right
|
|
73
|
+
* edge when no source is present, or the halo's right edge when
|
|
74
|
+
* one is.
|
|
75
|
+
*/
|
|
76
|
+
chromeRightX: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Single source of truth for the include-region chrome's geometry.
|
|
80
|
+
*
|
|
81
|
+
* `boxX` is the left edge of the include region's bounding box in
|
|
82
|
+
* canvas px. `label` is the chiclet text; `sourcePath` is the
|
|
83
|
+
* breadcrumb beside the badge (pass `''` to omit the bookmark).
|
|
84
|
+
*/
|
|
85
|
+
export declare function includeChromeGeometry(boxX: number, label: string, sourcePath: string): IncludeChromeGeometry;
|
|
86
|
+
//# sourceMappingURL=include-chrome-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include-chrome-geometry.d.ts","sourceRoot":"","sources":["../src/include-chrome-geometry.ts"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD,wEAAwE;AACxE,eAAO,MAAM,gCAAgC,KAAK,CAAC;AACnD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD,uEAAuE;AACvE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,2CAA2C;AAC3C,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,wEAAwE;AACxE,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,MAAM,CAAC;AACrD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IAClC,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,eAAe,EAAE,MAAM,CAAC;IAExB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAElB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAC;IAElB,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,6FAA6F;IAC7F,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACnB,qBAAqB,CAuCvB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Include-region chrome geometry — the label tab + content badge +
|
|
2
|
+
// source-path bookmark that float across the top edge of an isolated
|
|
3
|
+
// `include {}` region's dashed bracket. Both the layout (which needs
|
|
4
|
+
// to know the chrome's right edge to shrink-wrap the bracket) and the
|
|
5
|
+
// renderer (which paints each element) call `includeChromeGeometry`,
|
|
6
|
+
// so the painted footprint and the layout's reserved footprint stay
|
|
7
|
+
// in sync. Mirrors `frameTabGeometry`'s "compute placement X for each
|
|
8
|
+
// element + derive total width from the cursor" model.
|
|
9
|
+
//
|
|
10
|
+
// Layout order, left → right:
|
|
11
|
+
//
|
|
12
|
+
// [LEFT_INSET] tab(LABEL) (BADGE_GAP) badge (SOURCE_GAP) [HALO_PAD] source [HALO_PAD]
|
|
13
|
+
//
|
|
14
|
+
// The badge and source-path are optional in spirit but always present
|
|
15
|
+
// for current `include` regions; the helper passes `0` widths through
|
|
16
|
+
// cleanly should that ever change.
|
|
17
|
+
/**
|
|
18
|
+
* Horizontal offset (px) from the include region's bounding-box left
|
|
19
|
+
* edge to the label tab's left edge. Equals the region's outer pad
|
|
20
|
+
* (8 px from `renderIncludeRegion`) plus a 16 px tab inset that keeps
|
|
21
|
+
* the chiclet visually anchored inside the dashed bracket rather than
|
|
22
|
+
* straddling its rounded corner.
|
|
23
|
+
*/
|
|
24
|
+
export const INCLUDE_CHROME_OFFSET_FROM_BOX_PX = 24;
|
|
25
|
+
/** Horizontal inset (px) from the tab's left edge to the label text. */
|
|
26
|
+
export const INCLUDE_CHROME_TAB_LEFT_INSET_PX = 10;
|
|
27
|
+
/**
|
|
28
|
+
* Horizontal inset (px) from the label text's right edge to the tab's
|
|
29
|
+
* right edge. Same as the left inset so the label appears optically
|
|
30
|
+
* centered inside its chiclet.
|
|
31
|
+
*/
|
|
32
|
+
export const INCLUDE_CHROME_TAB_RIGHT_INSET_PX = 10;
|
|
33
|
+
/**
|
|
34
|
+
* Px-per-char for the label rendered at 11 pt 600w in `FONT_STACK.sans`.
|
|
35
|
+
* Calibrated against system-ui at 11 pt bold (~5.8 px/char actual);
|
|
36
|
+
* 6.0 leaves a small safety margin without producing wide right
|
|
37
|
+
* whitespace inside the chiclet.
|
|
38
|
+
*/
|
|
39
|
+
export const INCLUDE_CHROME_TAB_LABEL_PER_CHAR_PX = 6;
|
|
40
|
+
/**
|
|
41
|
+
* Minimum total chiclet width (px). A floor so tiny labels still
|
|
42
|
+
* produce a chip wide enough to read; the badge/source bookmark sit
|
|
43
|
+
* outside the chiclet so they never push it past this minimum.
|
|
44
|
+
*/
|
|
45
|
+
export const INCLUDE_CHROME_TAB_MIN_WIDTH_PX = 60;
|
|
46
|
+
/** Gap (px) between the chiclet's right edge and the content badge. */
|
|
47
|
+
export const INCLUDE_CHROME_BADGE_GAP_PX = 6;
|
|
48
|
+
/** Square content-badge tile size (px). */
|
|
49
|
+
export const INCLUDE_CHROME_BADGE_SIZE_PX = 18;
|
|
50
|
+
/** Gap (px) between the badge's right edge and the source-path text. */
|
|
51
|
+
export const INCLUDE_CHROME_SOURCE_GAP_PX = 6;
|
|
52
|
+
/**
|
|
53
|
+
* Px-per-char for the source-path rendered at 9 pt in `FONT_STACK.mono`.
|
|
54
|
+
* Calibrated against ui-monospace at 9 pt regular (~5.4 px/char actual);
|
|
55
|
+
* 5.5 leaves a small safety margin so the halo never clips the path.
|
|
56
|
+
*/
|
|
57
|
+
export const INCLUDE_CHROME_SOURCE_PER_CHAR_PX = 5.5;
|
|
58
|
+
/**
|
|
59
|
+
* Halo padding (px) on each side of the source-path text. The halo
|
|
60
|
+
* masks the dashed bracket border that runs through the text's
|
|
61
|
+
* baseline so the path stays legible.
|
|
62
|
+
*/
|
|
63
|
+
export const INCLUDE_CHROME_SOURCE_HALO_PAD_PX = 3;
|
|
64
|
+
/**
|
|
65
|
+
* Single source of truth for the include-region chrome's geometry.
|
|
66
|
+
*
|
|
67
|
+
* `boxX` is the left edge of the include region's bounding box in
|
|
68
|
+
* canvas px. `label` is the chiclet text; `sourcePath` is the
|
|
69
|
+
* breadcrumb beside the badge (pass `''` to omit the bookmark).
|
|
70
|
+
*/
|
|
71
|
+
export function includeChromeGeometry(boxX, label, sourcePath) {
|
|
72
|
+
const tabX = boxX + INCLUDE_CHROME_OFFSET_FROM_BOX_PX;
|
|
73
|
+
const tabLabelX = tabX + INCLUDE_CHROME_TAB_LEFT_INSET_PX;
|
|
74
|
+
const labelTextWidth = label.length * INCLUDE_CHROME_TAB_LABEL_PER_CHAR_PX;
|
|
75
|
+
const tabWidth = Math.max(INCLUDE_CHROME_TAB_MIN_WIDTH_PX, labelTextWidth + INCLUDE_CHROME_TAB_LEFT_INSET_PX + INCLUDE_CHROME_TAB_RIGHT_INSET_PX);
|
|
76
|
+
const badgeX = tabX + tabWidth + INCLUDE_CHROME_BADGE_GAP_PX;
|
|
77
|
+
const badgeRightX = badgeX + INCLUDE_CHROME_BADGE_SIZE_PX;
|
|
78
|
+
let sourceTextWidth = 0;
|
|
79
|
+
let sourceTextX = 0;
|
|
80
|
+
let sourceHaloX = 0;
|
|
81
|
+
let sourceHaloWidth = 0;
|
|
82
|
+
let chromeRightX = badgeRightX;
|
|
83
|
+
if (sourcePath) {
|
|
84
|
+
sourceTextX = badgeRightX + INCLUDE_CHROME_SOURCE_GAP_PX;
|
|
85
|
+
sourceTextWidth = sourcePath.length * INCLUDE_CHROME_SOURCE_PER_CHAR_PX;
|
|
86
|
+
sourceHaloX = sourceTextX - INCLUDE_CHROME_SOURCE_HALO_PAD_PX;
|
|
87
|
+
sourceHaloWidth = sourceTextWidth + INCLUDE_CHROME_SOURCE_HALO_PAD_PX * 2;
|
|
88
|
+
chromeRightX = sourceHaloX + sourceHaloWidth;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
labelTextWidth,
|
|
92
|
+
sourceTextWidth,
|
|
93
|
+
tabX,
|
|
94
|
+
tabWidth,
|
|
95
|
+
tabLabelX,
|
|
96
|
+
badgeX,
|
|
97
|
+
badgeSize: INCLUDE_CHROME_BADGE_SIZE_PX,
|
|
98
|
+
sourceHaloX,
|
|
99
|
+
sourceHaloWidth,
|
|
100
|
+
sourceTextX,
|
|
101
|
+
chromeRightX,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=include-chrome-geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include-chrome-geometry.js","sourceRoot":"","sources":["../src/include-chrome-geometry.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qEAAqE;AACrE,qEAAqE;AACrE,sEAAsE;AACtE,qEAAqE;AACrE,oEAAoE;AACpE,sEAAsE;AACtE,uDAAuD;AACvD,EAAE;AACF,8BAA8B;AAC9B,EAAE;AACF,wFAAwF;AACxF,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,mCAAmC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAEpD,wEAAwE;AACxE,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,CAAC;AACnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GA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U,CAAC,MAAM,GAAG,iCAAiC,CAAC;QACxE,WAAW,GAAG,WAAW,GAAG,iCAAiC,CAAC;QAC9D,eAAe,GAAG,eAAe,GAAG,iCAAiC,GAAG,CAAC,CAAC;QAC1E,YAAY,GAAG,WAAW,GAAG,eAAe,CAAC;IACjD,CAAC;IAED,OAAO;QACH,cAAc;QACd,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,SAAS;QACT,MAAM;QACN,SAAS,EAAE,4BAA4B;QACvC,WAAW;QACX,eAAe;QACf,WAAW;QACX,YAAY;KACf,CAAC;AACN,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { estimateCapacitySuffixWidth, formatCapacityNumber, parseCapacityValue, type ResolvedCapacityIcon, resolveCapacityIcon, } from './capacity.js';
|
|
2
|
+
export { FRAME_TAB_INNER_GAP_PX, FRAME_TAB_LEFT_INSET_PX, FRAME_TAB_MIN_WIDTH_PX, FRAME_TAB_OFFSET_FROM_BOX_PX, FRAME_TAB_OWNER_PX_PER_CHAR, FRAME_TAB_RIGHT_INSET_PX, FRAME_TAB_TITLE_PX_PER_CHAR, type FrameTabGeometry, frameTabGeometry, } from './frame-tab-geometry.js';
|
|
3
|
+
export { HEADER_AUTHOR_FONT_SIZE_PX, HEADER_AUTHOR_LINE_HEIGHT_PX, HEADER_CARD_PADDING_BOTTOM, HEADER_CARD_PADDING_TOP, HEADER_CARD_PADDING_X, HEADER_TITLE_FONT_SIZE_PX, HEADER_TITLE_LINE_HEIGHT_PX, HEADER_TITLE_TO_AUTHOR_GAP_PX, } from './header-card-geometry.js';
|
|
4
|
+
export { INCLUDE_CHROME_BADGE_GAP_PX, INCLUDE_CHROME_BADGE_SIZE_PX, INCLUDE_CHROME_OFFSET_FROM_BOX_PX, INCLUDE_CHROME_SOURCE_GAP_PX, INCLUDE_CHROME_SOURCE_HALO_PAD_PX, INCLUDE_CHROME_SOURCE_PER_CHAR_PX, INCLUDE_CHROME_TAB_LABEL_PER_CHAR_PX, INCLUDE_CHROME_TAB_LEFT_INSET_PX, INCLUDE_CHROME_TAB_MIN_WIDTH_PX, INCLUDE_CHROME_TAB_RIGHT_INSET_PX, type IncludeChromeGeometry, includeChromeGeometry, } from './include-chrome-geometry.js';
|
|
5
|
+
export { ITEM_CAPTION_INSET_X_PX, ITEM_CAPTION_META_BASELINE_OFFSET_PX, ITEM_CAPTION_META_FONT_SIZE_PX, ITEM_CAPTION_SPILL_GAP_PX, ITEM_CAPTION_TITLE_BASELINE_OFFSET_PX, ITEM_CAPTION_TITLE_FONT_SIZE_PX, ITEM_DECORATION_SPILL_GAP_PX, ITEM_FOOTNOTE_INDICATOR_BASELINE_OFFSET_PX, ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX, ITEM_FOOTNOTE_INDICATOR_STEP_PX, ITEM_LINK_ICON_INSET_PX, ITEM_LINK_ICON_TILE_SIZE_PX, ITEM_STATUS_DOT_INSET_RIGHT_PX, ITEM_STATUS_DOT_INSET_TOP_PX, ITEM_STATUS_DOT_RADIUS_PX, LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX, LABEL_CHIP_GAP_BETWEEN_PX, LABEL_CHIP_HEIGHT_PX, MIN_BAR_WIDTH_FOR_DOT_PX, MIN_BAR_WIDTH_FOR_FOOTNOTE_PX, MIN_BAR_WIDTH_FOR_LINK_AND_DOT_PX, } from './item-bar-geometry.js';
|
|
6
|
+
export type { LayoutOptions, LayoutResult } from './layout.js';
|
|
7
|
+
export { layoutRoadmap } from './layout.js';
|
|
8
|
+
export { darkTheme, lightTheme, type Theme, type ThemeName, themes, } from './themes/index.js';
|
|
9
|
+
export { ACCENT_DASH_PATTERN, ATTRIBUTION_BAR_LOGICAL_WIDTH, ATTRIBUTION_BAR_LOGICAL_X, ATTRIBUTION_INE_LOGICAL_X, ATTRIBUTION_LINK, ATTRIBUTION_NOW_LOGICAL_X, ATTRIBUTION_PREFIX_FONT_SIZE, ATTRIBUTION_SCALE, ATTRIBUTION_TEXT, ATTRIBUTION_WORDMARK_FONT_SIZE, CORNER_RADIUS_PX, EDGE_CORNER_RADIUS, FONT_STACK, FOOTNOTE_HEADER_BASELINE_OFFSET_PX, FOOTNOTE_HEADER_HEIGHT_PX, FOOTNOTE_PANEL_PADDING_PX, FOOTNOTE_ROW_HEIGHT, FRAME_TAB_HEIGHT_PX, FRAME_TAB_LABEL_BASELINE_OFFSET_PX, GROUP_BOTTOM_PAD_PX, GROUP_BRACKET_LABEL_OVERHANG_PX, GROUP_TITLE_TAB_CHAR_WIDTH_PX, GROUP_TITLE_TAB_GUTTER_PX, GROUP_TITLE_TAB_HEIGHT_PX, GROUP_TITLE_TAB_LABEL_BASELINE_OFFSET_PX, GROUP_TITLE_TAB_LABEL_FONT_SIZE_PX, GROUP_TITLE_TAB_PAD_X_PX, NOW_PILL_CORNER_RADIUS_PX, NOW_PILL_HEIGHT_PX, NOW_PILL_LABEL_BASELINE_OFFSET_PX, NOW_PILL_LABEL_FONT_SIZE_PX, NOW_PILL_LABEL_INSET_X_PX, NOW_PILL_WIDTH_PX, NOWLINE_STROKE_WIDTH_PX, PROGRESS_STRIP_HEIGHT_PX, TEXT_SIZE_PX, TIMELINE_TICK_LABEL_BASELINE_OFFSET_PX, TIMELINE_TICK_PANEL_HEIGHT_PX, TRACK_BLOCK_TAIL_GUTTER_PX, } from './themes/shared.js';
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,mBAAmB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,2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ClC,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,kCAAkC,EAClC,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,wCAAwC,EACxC,kCAAkC,EAClC,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAClB,iCAAiC,EACjC,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,sCAAsC,EACtC,6BAA6B,EAC7B,0BAA0B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { estimateCapacitySuffixWidth, formatCapacityNumber, parseCapacityValue, resolveCapacityIcon, } from './capacity.js';
|
|
2
|
+
export { FRAME_TAB_INNER_GAP_PX, FRAME_TAB_LEFT_INSET_PX, FRAME_TAB_MIN_WIDTH_PX, FRAME_TAB_OFFSET_FROM_BOX_PX, FRAME_TAB_OWNER_PX_PER_CHAR, FRAME_TAB_RIGHT_INSET_PX, FRAME_TAB_TITLE_PX_PER_CHAR, frameTabGeometry, } from './frame-tab-geometry.js';
|
|
3
|
+
export { HEADER_AUTHOR_FONT_SIZE_PX, HEADER_AUTHOR_LINE_HEIGHT_PX, HEADER_CARD_PADDING_BOTTOM, HEADER_CARD_PADDING_TOP, HEADER_CARD_PADDING_X, HEADER_TITLE_FONT_SIZE_PX, HEADER_TITLE_LINE_HEIGHT_PX, HEADER_TITLE_TO_AUTHOR_GAP_PX, } from './header-card-geometry.js';
|
|
4
|
+
export { INCLUDE_CHROME_BADGE_GAP_PX, INCLUDE_CHROME_BADGE_SIZE_PX, INCLUDE_CHROME_OFFSET_FROM_BOX_PX, INCLUDE_CHROME_SOURCE_GAP_PX, INCLUDE_CHROME_SOURCE_HALO_PAD_PX, INCLUDE_CHROME_SOURCE_PER_CHAR_PX, INCLUDE_CHROME_TAB_LABEL_PER_CHAR_PX, INCLUDE_CHROME_TAB_LEFT_INSET_PX, INCLUDE_CHROME_TAB_MIN_WIDTH_PX, INCLUDE_CHROME_TAB_RIGHT_INSET_PX, includeChromeGeometry, } from './include-chrome-geometry.js';
|
|
5
|
+
export { ITEM_CAPTION_INSET_X_PX, ITEM_CAPTION_META_BASELINE_OFFSET_PX, ITEM_CAPTION_META_FONT_SIZE_PX, ITEM_CAPTION_SPILL_GAP_PX, ITEM_CAPTION_TITLE_BASELINE_OFFSET_PX, ITEM_CAPTION_TITLE_FONT_SIZE_PX, ITEM_DECORATION_SPILL_GAP_PX, ITEM_FOOTNOTE_INDICATOR_BASELINE_OFFSET_PX, ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX, ITEM_FOOTNOTE_INDICATOR_STEP_PX, ITEM_LINK_ICON_INSET_PX, ITEM_LINK_ICON_TILE_SIZE_PX, ITEM_STATUS_DOT_INSET_RIGHT_PX, ITEM_STATUS_DOT_INSET_TOP_PX, ITEM_STATUS_DOT_RADIUS_PX, LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX, LABEL_CHIP_GAP_BETWEEN_PX, LABEL_CHIP_HEIGHT_PX, MIN_BAR_WIDTH_FOR_DOT_PX, MIN_BAR_WIDTH_FOR_FOOTNOTE_PX, MIN_BAR_WIDTH_FOR_LINK_AND_DOT_PX, } from './item-bar-geometry.js';
|
|
6
|
+
export { layoutRoadmap } from './layout.js';
|
|
7
|
+
export { darkTheme, lightTheme, themes, } from './themes/index.js';
|
|
8
|
+
export { ACCENT_DASH_PATTERN, ATTRIBUTION_BAR_LOGICAL_WIDTH, ATTRIBUTION_BAR_LOGICAL_X, ATTRIBUTION_INE_LOGICAL_X, ATTRIBUTION_LINK, ATTRIBUTION_NOW_LOGICAL_X, ATTRIBUTION_PREFIX_FONT_SIZE, ATTRIBUTION_SCALE, ATTRIBUTION_TEXT, ATTRIBUTION_WORDMARK_FONT_SIZE, CORNER_RADIUS_PX, EDGE_CORNER_RADIUS, FONT_STACK, FOOTNOTE_HEADER_BASELINE_OFFSET_PX, FOOTNOTE_HEADER_HEIGHT_PX, FOOTNOTE_PANEL_PADDING_PX, FOOTNOTE_ROW_HEIGHT, FRAME_TAB_HEIGHT_PX, FRAME_TAB_LABEL_BASELINE_OFFSET_PX, GROUP_BOTTOM_PAD_PX, GROUP_BRACKET_LABEL_OVERHANG_PX, GROUP_TITLE_TAB_CHAR_WIDTH_PX, GROUP_TITLE_TAB_GUTTER_PX, GROUP_TITLE_TAB_HEIGHT_PX, GROUP_TITLE_TAB_LABEL_BASELINE_OFFSET_PX, GROUP_TITLE_TAB_LABEL_FONT_SIZE_PX, GROUP_TITLE_TAB_PAD_X_PX, NOW_PILL_CORNER_RADIUS_PX, NOW_PILL_HEIGHT_PX, NOW_PILL_LABEL_BASELINE_OFFSET_PX, NOW_PILL_LABEL_FONT_SIZE_PX, NOW_PILL_LABEL_INSET_X_PX, NOW_PILL_WIDTH_PX, NOWLINE_STROKE_WIDTH_PX, PROGRESS_STRIP_HEIGHT_PX, TEXT_SIZE_PX, TIMELINE_TICK_LABEL_BASELINE_OFFSET_PX, TIMELINE_TICK_PANEL_HEIGHT_PX, TRACK_BLOCK_TAIL_GUTTER_PX, } from './themes/shared.js';
|
|
9
|
+
export * from './types.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,2BAA2B,EAC3B,oBAAoB,EACpB,kBAAkB,EAElB,mBAAmB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAE3B,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,0BAA0B,EAC1B,4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EAClB,iCAAiC,EACjC,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,sCAAsC,EACtC,6BAA6B,EAC7B,0BAA0B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/** Horizontal inset (px) for the caption's left edge inside the bar. */
|
|
2
|
+
export declare const ITEM_CAPTION_INSET_X_PX = 12;
|
|
3
|
+
/**
|
|
4
|
+
* When the bar's title would overflow to the right, layout sets
|
|
5
|
+
* `textSpills` and the caption renders to the RIGHT of the bar; this
|
|
6
|
+
* is the gap (px) between the bar's right edge and the spilled
|
|
7
|
+
* caption.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ITEM_CAPTION_SPILL_GAP_PX = 6;
|
|
10
|
+
/** Baseline Y of the title text relative to the bar's top. */
|
|
11
|
+
export declare const ITEM_CAPTION_TITLE_BASELINE_OFFSET_PX = 20;
|
|
12
|
+
/** Baseline Y of the meta text (second line) relative to the bar's top. */
|
|
13
|
+
export declare const ITEM_CAPTION_META_BASELINE_OFFSET_PX = 38;
|
|
14
|
+
/** Font size (px) of the title text. */
|
|
15
|
+
export declare const ITEM_CAPTION_TITLE_FONT_SIZE_PX = 13;
|
|
16
|
+
/** Font size (px) of the meta text. */
|
|
17
|
+
export declare const ITEM_CAPTION_META_FONT_SIZE_PX = 11;
|
|
18
|
+
/** Distance (px) from the bar's right edge to the dot's center. */
|
|
19
|
+
export declare const ITEM_STATUS_DOT_INSET_RIGHT_PX = 12;
|
|
20
|
+
/** Distance (px) from the bar's top edge to the dot's center. */
|
|
21
|
+
export declare const ITEM_STATUS_DOT_INSET_TOP_PX = 12;
|
|
22
|
+
/** Radius (px) of the status dot. */
|
|
23
|
+
export declare const ITEM_STATUS_DOT_RADIUS_PX = 5;
|
|
24
|
+
/**
|
|
25
|
+
* X offset (px from bar's right edge) where the rightmost footnote
|
|
26
|
+
* digit's anchor sits. Tuned to leave room for the status dot.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ITEM_FOOTNOTE_INDICATOR_INSET_RIGHT_PX = 22;
|
|
29
|
+
/** Baseline Y (px from bar's top) for footnote indicator digits. */
|
|
30
|
+
export declare const ITEM_FOOTNOTE_INDICATOR_BASELINE_OFFSET_PX = 14;
|
|
31
|
+
/**
|
|
32
|
+
* Horizontal step (px) between consecutive footnote indicators when
|
|
33
|
+
* an item carries more than one footnote — they walk LEFT from the
|
|
34
|
+
* status dot.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ITEM_FOOTNOTE_INDICATOR_STEP_PX = 8;
|
|
37
|
+
/** Side length (px) of the square link-icon tile. */
|
|
38
|
+
export declare const ITEM_LINK_ICON_TILE_SIZE_PX = 14;
|
|
39
|
+
/** Distance (px) from the bar's right/bottom edges to the tile's edge. */
|
|
40
|
+
export declare const ITEM_LINK_ICON_INSET_PX = 6;
|
|
41
|
+
/**
|
|
42
|
+
* Horizontal gap (px) between consecutive decorations (status dot,
|
|
43
|
+
* link icon, footnote, title) when they spill into the column to
|
|
44
|
+
* the right of a bar that's too narrow to host them inside.
|
|
45
|
+
*/
|
|
46
|
+
export declare const ITEM_DECORATION_SPILL_GAP_PX = 4;
|
|
47
|
+
/**
|
|
48
|
+
* Minimum bar width (px) needed to host the status dot inside the
|
|
49
|
+
* bar with its full inset. Below this, the dot would have to
|
|
50
|
+
* extend past the bar's left edge, so the dot spills into the
|
|
51
|
+
* caption column to the right of the bar instead.
|
|
52
|
+
*/
|
|
53
|
+
export declare const MIN_BAR_WIDTH_FOR_DOT_PX: number;
|
|
54
|
+
/**
|
|
55
|
+
* Minimum bar width (px) needed to host the link-icon tile AND the
|
|
56
|
+
* status dot inside the bar with at least
|
|
57
|
+
* `ITEM_DECORATION_SPILL_GAP_PX` of breathing room between them.
|
|
58
|
+
* Below this, the link icon would visually collide with (or push
|
|
59
|
+
* into) the dot's column, so the icon spills out and renders ahead
|
|
60
|
+
* of the (also-spilled) title.
|
|
61
|
+
*/
|
|
62
|
+
export declare const MIN_BAR_WIDTH_FOR_LINK_AND_DOT_PX: number;
|
|
63
|
+
/**
|
|
64
|
+
* Minimum bar width (px) needed to host the footnote indicator at
|
|
65
|
+
* its inset-right position without overshooting the bar's left
|
|
66
|
+
* edge or colliding with a leading link icon. Approximate width
|
|
67
|
+
* for one digit is 8px (font-size 10, bold).
|
|
68
|
+
*/
|
|
69
|
+
export declare const MIN_BAR_WIDTH_FOR_FOOTNOTE_PX: number;
|
|
70
|
+
/** Height (px) of a label chip rectangle. */
|
|
71
|
+
export declare const LABEL_CHIP_HEIGHT_PX = 13;
|
|
72
|
+
/**
|
|
73
|
+
* Vertical gap (px) between the top of the bottom progress strip and
|
|
74
|
+
* the BOTTOM of a label chip. Keeps chips from touching the strip and
|
|
75
|
+
* gives a clear visual rail.
|
|
76
|
+
*/
|
|
77
|
+
export declare const LABEL_CHIP_GAP_ABOVE_PROGRESS_STRIP_PX = 3;
|
|
78
|
+
/** Horizontal gap (px) between consecutive chips in a row. */
|
|
79
|
+
export declare const LABEL_CHIP_GAP_BETWEEN_PX = 4;
|
|
80
|
+
/**
|
|
81
|
+
* Vertical gap (px) between two stacked chip rows when chips spill
|
|
82
|
+
* outside the bar and form a multi-row column to the right.
|
|
83
|
+
*/
|
|
84
|
+
export declare const LABEL_CHIP_ROW_GAP_PX = 4;
|
|
85
|
+
/**
|
|
86
|
+
* Vertical row pitch (px) for a stacked chip column — chip height +
|
|
87
|
+
* inter-row gap.
|
|
88
|
+
*/
|
|
89
|
+
export declare const LABEL_CHIP_ROW_STEP_PX: number;
|
|
90
|
+
/**
|
|
91
|
+
* Slack budget (fraction) applied ONCE per item when chips spill
|
|
92
|
+
* outside the bar. If a chip would overflow its row by less than
|
|
93
|
+
* `SPILL_ROW_SLACK_FRACTION × chip.width`, the row is allowed to
|
|
94
|
+
* stretch by the overflow amount and keep the chip on it instead of
|
|
95
|
+
* wrapping. This rescues "lonely chip" cases where one chip just
|
|
96
|
+
* barely overshoots; once the slack is consumed, no further row
|
|
97
|
+
* expansions happen for that item.
|
|
98
|
+
*/
|
|
99
|
+
export declare const SPILL_ROW_SLACK_FRACTION = 0.25;
|
|
100
|
+
export interface ChipRowSample<T> {
|
|
101
|
+
id: T;
|
|
102
|
+
width: number;
|
|
103
|
+
}
|
|
104
|
+
export interface SpillChipPack<T> {
|
|
105
|
+
/** Rows ordered top-to-bottom — `rows[0]` sits at the chip
|
|
106
|
+
* column's top y, `rows[1]` one `LABEL_CHIP_ROW_STEP_PX` below,
|
|
107
|
+
* and so on. */
|
|
108
|
+
rows: ChipRowSample<T>[][];
|
|
109
|
+
/** True when the slack rule was used to keep an extra chip on
|
|
110
|
+
* row 0 (or whichever row was being filled when the overflow
|
|
111
|
+
* happened). At most one expansion per item. */
|
|
112
|
+
expanded: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Pack `chips` into rows for the SPILL column to the right of an
|
|
116
|
+
* item bar. Each row is capped at `barVisualWidth` (with gaps
|
|
117
|
+
* between chips). When a chip would overflow:
|
|
118
|
+
*
|
|
119
|
+
* - If the row is empty, place the chip anyway (a chip wider than
|
|
120
|
+
* the cap occupies its own row).
|
|
121
|
+
* - Else if the slack rule applies (`overflow ≤ 0.25 × chip.width`)
|
|
122
|
+
* AND the slack hasn't already been used for this item, expand
|
|
123
|
+
* the current row by `overflow` and keep the chip on it.
|
|
124
|
+
* - Else wrap the chip to a fresh row.
|
|
125
|
+
*/
|
|
126
|
+
export declare function packSpillChips<T>(chips: ChipRowSample<T>[], barVisualWidth: number): SpillChipPack<T>;
|
|
127
|
+
//# sourceMappingURL=item-bar-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-bar-geometry.d.ts","sourceRoot":"","sources":["../src/item-bar-geometry.ts"],"names":[],"mappings":"AAkBA,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1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