@diagrammo/dgmo 0.50.0 → 0.50.1
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/advanced.js +62 -62
- package/dist/auto.js +82 -82
- package/dist/auto.mjs +27 -20
- package/dist/block.js +29 -29
- package/dist/{charts-d3-DKUD7MQE.js → charts-d3-LR6D3D7A.js} +3 -3
- package/dist/{chunk-PJUGRJHJ.js → chunk-2KGXHFYK.js} +4 -4
- package/dist/{chunk-6X4AKWLF.js → chunk-3LH5CLP4.js} +3 -3
- package/dist/{chunk-YA7D2N2O.js → chunk-3NODSS6A.js} +4 -4
- package/dist/{chunk-DMJJ3CEQ.js → chunk-3UIKSPFB.js} +8 -3
- package/dist/{chunk-RV26LTUU.js → chunk-3XGZF2QJ.js} +4 -4
- package/dist/{chunk-I4IFRCUB.js → chunk-3Y2DRD7S.js} +2 -2
- package/dist/{chunk-RV6A2B5S.js → chunk-3YPY3OXD.js} +2 -2
- package/dist/{chunk-4S723I74.js → chunk-4MJ7M6YL.js} +5 -5
- package/dist/{chunk-6ZT4U37Q.js → chunk-4S52SK6G.js} +2 -2
- package/dist/{chunk-SGFZZAUO.js → chunk-5GJYGP5Z.js} +4 -4
- package/dist/{chunk-TWCLK2GA.js → chunk-5OWVC2A6.js} +3 -3
- package/dist/{chunk-F5UDBSJY.js → chunk-66NVRO4K.js} +4 -4
- package/dist/{chunk-XCLHOZAM.js → chunk-66RUL3XF.js} +3 -3
- package/dist/{chunk-YZLMKW4T.js → chunk-6HJBFVLO.js} +2 -2
- package/dist/{chunk-YB3FW24O.js → chunk-7L3R6I3U.js} +2 -2
- package/dist/{chunk-PLZI6KPM.js → chunk-7QKLIMRZ.js} +4 -4
- package/dist/{chunk-IA3FJYWR.js → chunk-7TV5Y53Y.js} +2 -2
- package/dist/{chunk-3TDRHT4J.js → chunk-BBGDM4NQ.js} +3 -3
- package/dist/{chunk-T4BRO3Z6.js → chunk-BH3UYK36.js} +2 -2
- package/dist/{chunk-UXOSVCLJ.js → chunk-C2CVAM3U.js} +2 -2
- package/dist/{chunk-UUS2GIJZ.js → chunk-DFTFPYUD.js} +5 -5
- package/dist/{chunk-SU2VBK4L.js → chunk-DSWVNQVS.js} +2 -2
- package/dist/{chunk-5JSWBPZZ.js → chunk-DZXYF2F5.js} +12 -2
- package/dist/{chunk-6M5PJFQG.js → chunk-EAMEADTV.js} +2 -2
- package/dist/{chunk-KJXIHOVL.js → chunk-FA6K3FWM.js} +3 -3
- package/dist/{chunk-WCUHAQKB.js → chunk-FJUNPCYI.js} +1 -1
- package/dist/{chunk-FB2WHOEQ.js → chunk-GKC3HILQ.js} +2 -2
- package/dist/{chunk-QUJGFNFN.js → chunk-HEVYAHLW.js} +2 -2
- package/dist/{chunk-3ZPC476N.js → chunk-HLJVEAOF.js} +3 -3
- package/dist/{chunk-7G2ER4CY.js → chunk-HTMN2Z6U.js} +2 -2
- package/dist/{chunk-OHQEMBLI.js → chunk-I2WKW7C7.js} +2 -2
- package/dist/{chunk-R56LASIN.js → chunk-IUMPEA64.js} +2 -2
- package/dist/{chunk-QDFNCATJ.js → chunk-J6K7RP6P.js} +4 -4
- package/dist/{chunk-PMN3Q7RJ.js → chunk-JJUOHGX2.js} +2 -2
- package/dist/{chunk-QFQ35BTO.js → chunk-KFZYNWWO.js} +2 -2
- package/dist/{chunk-ER5SCQWQ.js → chunk-KHEYDLMT.js} +2 -2
- package/dist/{chunk-X2NMFTG3.js → chunk-LE4MYMLI.js} +2 -2
- package/dist/{chunk-NFFIKVNO.js → chunk-MCZ5LBZD.js} +4 -4
- package/dist/{chunk-2JJ2KNPI.js → chunk-NU3XLTGP.js} +2 -2
- package/dist/{chunk-4BMJQFNK.js → chunk-NWED7CYO.js} +3 -3
- package/dist/{chunk-WWN566I7.js → chunk-OMNGQPEZ.js} +2 -2
- package/dist/{chunk-O76UD6VJ.js → chunk-OTQKUHRS.js} +2 -2
- package/dist/{chunk-5Z736BSU.js → chunk-P7CE7LXL.js} +2 -2
- package/dist/{chunk-CVV36CWI.js → chunk-PFHVU7UA.js} +2 -2
- package/dist/{chunk-FAL7NOK3.js → chunk-QJP6PG7F.js} +5 -5
- package/dist/{chunk-URSQLCTR.js → chunk-QROYX7TT.js} +2 -2
- package/dist/{chunk-FL4IOQ37.js → chunk-QXKWYZNR.js} +2 -2
- package/dist/{chunk-3G6TMNVF.js → chunk-RZ6YKEUJ.js} +3 -3
- package/dist/{chunk-A3WQVFBS.js → chunk-SQLNBA64.js} +2 -2
- package/dist/{chunk-S5GRONXL.js → chunk-SXRTRMEE.js} +2 -2
- package/dist/{chunk-GPWHQ5FJ.js → chunk-T4VOVZT5.js} +2 -2
- package/dist/{chunk-JZNMXEIV.js → chunk-TN35C5KM.js} +2 -2
- package/dist/{chunk-O4VUFXIH.js → chunk-VBYSIOOY.js} +2 -2
- package/dist/{chunk-2QYTMIRR.js → chunk-VDOOQZUD.js} +2 -2
- package/dist/{chunk-XMVQ5F4M.js → chunk-VUJGMJE6.js} +2 -2
- package/dist/{chunk-ASS5YYIZ.js → chunk-VVW3F3MD.js} +4 -4
- package/dist/{chunk-JFYIP7XU.js → chunk-VVZRV54S.js} +24 -24
- package/dist/{chunk-7RB5Q6MB.js → chunk-WW32K72E.js} +5 -5
- package/dist/{chunk-EJTKV7CY.js → chunk-X6EZPSW6.js} +4 -4
- package/dist/{chunk-OTP5KVLO.js → chunk-XJLKLU4D.js} +2 -2
- package/dist/{chunk-GROQGHCT.js → chunk-Y4RNXEAO.js} +9 -17
- package/dist/{chunk-L2ZTFHAY.js → chunk-YIA4LEX4.js} +15 -7
- package/dist/{chunk-NISQC5KW.js → chunk-ZAD4HV2G.js} +62 -62
- package/dist/cli.cjs +96 -96
- package/dist/{dgmo-router-QOMFCOOV.js → dgmo-router-YTU3ENAX.js} +25 -25
- package/dist/{dimensions-P5FSX2QN.js → dimensions-OTBKC5M6.js} +4 -4
- package/dist/element.js +42 -42
- package/dist/element.mjs +27 -20
- package/dist/index.js +29 -29
- package/dist/{layout-T3OZU5QW.js → layout-7MZ5NF2N.js} +3 -3
- package/dist/{layout-WZHNDT2O.js → layout-FWODLIMP.js} +3 -3
- package/dist/{layout-VYELEAW7.js → layout-J36454XU.js} +3 -3
- package/dist/{layout-TJIWF7EM.js → layout-LD6XTLD6.js} +3 -3
- package/dist/{parser-ZSOWUBML.js → parser-36HVKU5U.js} +3 -3
- package/dist/{parser-QYYM4QVW.js → parser-4NO6VZ6S.js} +3 -3
- package/dist/{parser-DOKMZXVZ.js → parser-4WQQQXCG.js} +3 -3
- package/dist/{parser-O4QFCUW7.js → parser-5OXGPNBF.js} +3 -3
- package/dist/{parser-ZTBATMLX.js → parser-AGVYTQXV.js} +3 -3
- package/dist/{parser-D3QT6GWN.js → parser-AXKBDGNO.js} +3 -3
- package/dist/{parser-FMPCVFRK.js → parser-CVMEDULU.js} +3 -3
- package/dist/{parser-C2HF2C2E.js → parser-D5VILGN2.js} +3 -3
- package/dist/{parser-KUQWRPIT.js → parser-H3XEPFPV.js} +3 -3
- package/dist/{parser-YLKYBRIT.js → parser-IJBMRXMC.js} +3 -3
- package/dist/{parser-UQE5OWZI.js → parser-JJR52VAT.js} +3 -3
- package/dist/{parser-4P36TUVD.js → parser-K3XXLMUW.js} +3 -3
- package/dist/{parser-45DENHFZ.js → parser-KCR2WS3V.js} +3 -3
- package/dist/{parser-5AURY4A6.js → parser-MPCE5JBG.js} +3 -3
- package/dist/{parser-Q4QKCIWQ.js → parser-MTOMTWTD.js} +3 -3
- package/dist/{parser-RZMQP7MM.js → parser-O4HIUN6G.js} +3 -3
- package/dist/{parser-PGMQDD4G.js → parser-PSA4UBSP.js} +3 -3
- package/dist/{parser-I2UIJKVQ.js → parser-RV4M6AS2.js} +3 -3
- package/dist/{parser-QTOB4KFL.js → parser-TGQZJ5OT.js} +3 -3
- package/dist/{parser-SOUJOEYI.js → parser-TXND652E.js} +3 -3
- package/dist/{parser-A2BEFMGK.js → parser-VKOJM7KS.js} +3 -3
- package/dist/{parser-D5637H5H.js → parser-W4PQUGX3.js} +3 -3
- package/dist/pert.d.ts +8 -0
- package/dist/{renderer-BSW7SRIZ.js → renderer-2AZ5HJFK.js} +3 -3
- package/dist/{renderer-BZSBPTZJ.js → renderer-2QPMJ2DA.js} +5 -5
- package/dist/{renderer-KY4KQBTF.js → renderer-45PSOL3E.js} +4 -4
- package/dist/{renderer-FZUKFUNZ.js → renderer-5DSEWF74.js} +4 -4
- package/dist/{renderer-TQMZGDAX.js → renderer-6OKF44KS.js} +5 -5
- package/dist/{renderer-67NPCBIS.js → renderer-7SD6MSBS.js} +5 -5
- package/dist/{renderer-ICJN2SA2.js → renderer-A5VE5BCI.js} +4 -4
- package/dist/{renderer-Q6ZKPLS6.js → renderer-AUW2BE6G.js} +5 -5
- package/dist/{renderer-35HSIDMZ.js → renderer-B5TBNZJE.js} +4 -4
- package/dist/{renderer-INEXO7B6.js → renderer-BSR2O2H6.js} +5 -5
- package/dist/{renderer-CXUC4KAD.js → renderer-CYB4LK3G.js} +5 -5
- package/dist/{renderer-O4JKUGKO.js → renderer-FF24KZCI.js} +4 -4
- package/dist/{renderer-BY533UWU.js → renderer-FPE3J5VZ.js} +5 -5
- package/dist/{renderer-TKG6LS4U.js → renderer-FYSVXL7M.js} +6 -6
- package/dist/{renderer-GO3FE3RA.js → renderer-HDCCZURL.js} +4 -4
- package/dist/{renderer-6GHYK7DX.js → renderer-JCCHNECZ.js} +4 -4
- package/dist/{renderer-OOGFODWP.js → renderer-KS7YZJE2.js} +6 -6
- package/dist/{renderer-KDYCFRBX.js → renderer-NGXZTRK6.js} +4 -4
- package/dist/{renderer-LBN65V45.js → renderer-ODUUOPVT.js} +4 -4
- package/dist/{renderer-G2NLGNKF.js → renderer-PJM35LJN.js} +2 -2
- package/dist/{renderer-SZQ326M5.js → renderer-PPIHO5FI.js} +5 -5
- package/dist/{renderer-7SWMIFMM.js → renderer-PSMMZCKH.js} +4 -4
- package/dist/{renderer-MGBWOCXG.js → renderer-QAOBLRXV.js} +6 -6
- package/dist/{renderer-HPGR6USK.js → renderer-R2WNIC2C.js} +4 -4
- package/dist/{renderer-6RNGHC5Z.js → renderer-SBS3YWU5.js} +4 -4
- package/dist/{renderer-BBCEFILK.js → renderer-UYMQQCJK.js} +5 -5
- package/dist/{renderer-radial-JELMHQ24.js → renderer-radial-F7X5F2VU.js} +5 -5
- package/gallery/fixtures/countdown.dgmo +3 -3
- package/package.json +1 -1
- package/dist/advanced.d.ts +0 -6569
- package/dist/auto.d.ts +0 -54
- package/dist/block.d.ts +0 -123
- package/dist/element.d.ts +0 -62
- package/dist/index.d.ts +0 -166
- package/dist/themes-1-CuKpeH.d.ts +0 -908
|
@@ -1,908 +0,0 @@
|
|
|
1
|
-
type DgmoSeverity = 'error' | 'warning';
|
|
2
|
-
interface DgmoError {
|
|
3
|
-
line: number;
|
|
4
|
-
column?: number;
|
|
5
|
-
message: string;
|
|
6
|
-
severity: DgmoSeverity;
|
|
7
|
-
/**
|
|
8
|
-
* Optional stable diagnostic code (e.g. 'E_ARROW_SUBSTRING_IN_LABEL').
|
|
9
|
-
* Additive; pre-existing diagnostics omit this field and existing
|
|
10
|
-
* substring-on-`.message` assertions keep working unchanged.
|
|
11
|
-
*/
|
|
12
|
-
code?: string;
|
|
13
|
-
}
|
|
14
|
-
declare function makeDgmoError(line: number, message: string, severity?: DgmoSeverity, code?: string): DgmoError;
|
|
15
|
-
/** Runtime params passed to `emit()` and forwarded to a message builder. */
|
|
16
|
-
type DiagnosticParams = Record<string, unknown>;
|
|
17
|
-
/**
|
|
18
|
-
* Parameter type for a `DiagnosticSpec.message` builder body. Typed loosely
|
|
19
|
-
* (`any`) on purpose: builders are hand-authored interpolation bags keyed by
|
|
20
|
-
* ad-hoc names, and dgmo's tsconfig enables `noPropertyAccessFromIndexSignature`
|
|
21
|
-
* (which forbids `p.name` dot-access on a `Record<string, unknown>`). Using
|
|
22
|
-
* `any` here keeps builder bodies readable (`p.name`) instead of forcing
|
|
23
|
-
* `p['name']` bracket access at every interpolation site.
|
|
24
|
-
*/
|
|
25
|
-
type DiagnosticMessageParams = any;
|
|
26
|
-
interface DiagnosticSpec {
|
|
27
|
-
/** Stable diagnostic code, e.g. `'E_MAP_UNKNOWN_PLACE'`. */
|
|
28
|
-
code: string;
|
|
29
|
-
/** Severity — must agree with the `E_`/`W_`/`I_` code prefix. */
|
|
30
|
-
severity: DgmoSeverity;
|
|
31
|
-
/** Owning chart type (`'map'`, `'swimlane'`, …) or `null` for universal/global codes. */
|
|
32
|
-
chartType: string | null;
|
|
33
|
-
/** Short human label for the catalog UI. */
|
|
34
|
-
title: string;
|
|
35
|
-
/**
|
|
36
|
-
* Canonical message wording. A plain string for static messages, or a
|
|
37
|
-
* builder `(params) => string` when the message interpolates runtime
|
|
38
|
-
* values. The builder must tolerate being called with `{}` so the
|
|
39
|
-
* catalog can show a representative message without live params.
|
|
40
|
-
*/
|
|
41
|
-
message: string | ((params: DiagnosticMessageParams) => string);
|
|
42
|
-
/** Optional fix guidance shown alongside the message. */
|
|
43
|
-
hint?: string;
|
|
44
|
-
/** Minimal `.dgmo` source that triggers this diagnostic (for docs/console). */
|
|
45
|
-
example?: string;
|
|
46
|
-
}
|
|
47
|
-
/** Optional extras when emitting (currently just an explicit column). */
|
|
48
|
-
interface EmitOptions {
|
|
49
|
-
column?: number;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Emit a diagnostic from its `DiagnosticSpec`. The code, severity, and
|
|
53
|
-
* canonical wording all come from the spec — call sites supply only the
|
|
54
|
-
* line and the interpolation params, so the code/severity can never drift
|
|
55
|
-
* out of sync with the declared spec. Replaces the per-parser
|
|
56
|
-
* `push`/`err`/`fail` wrappers that each re-declared this shape.
|
|
57
|
-
*/
|
|
58
|
-
declare function emit(spec: DiagnosticSpec, line: number, params?: DiagnosticParams, opts?: EmitOptions): DgmoError;
|
|
59
|
-
declare function formatDgmoError(err: DgmoError): string;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Color definitions for a single mode (light or dark).
|
|
63
|
-
* 10 semantic UI colors + 9 named accent colors = 19 total.
|
|
64
|
-
*
|
|
65
|
-
* `readonly` on every field (and the nested `colors` map) by design —
|
|
66
|
-
* palettes flow from the registry into every renderer; nothing in the
|
|
67
|
-
* pipeline should ever mutate a palette in place.
|
|
68
|
-
*/
|
|
69
|
-
interface PaletteColors {
|
|
70
|
-
/** Main background (#eceff4 light / #2e3440 dark for Nord) */
|
|
71
|
-
readonly bg: string;
|
|
72
|
-
/** Cards, panels (#e5e9f0 / #3b4252) */
|
|
73
|
-
readonly surface: string;
|
|
74
|
-
/** Popovers, dropdowns (#e5e9f0 / #434c5e) */
|
|
75
|
-
readonly overlay: string;
|
|
76
|
-
/** Borders, dividers, muted (#d8dee9 / #4c566a) */
|
|
77
|
-
readonly border: string;
|
|
78
|
-
/** Primary text (#2e3440 / #eceff4) */
|
|
79
|
-
readonly text: string;
|
|
80
|
-
/** Secondary/diminished text (#4c566a / #d8dee9) */
|
|
81
|
-
readonly textMuted: string;
|
|
82
|
-
/**
|
|
83
|
-
* Light-mode arg for `contrastText()` when text is rendered on a
|
|
84
|
-
* tinted shape fill (e.g. `shapeFill()` output). Must guarantee
|
|
85
|
-
* ≥ 4.5:1 WCAG AA against any `shapeFill()` the palette can produce.
|
|
86
|
-
* Distinct from `colors.white` because palette-aesthetic anchors don't
|
|
87
|
-
* always meet contrast requirements (TD-5).
|
|
88
|
-
*/
|
|
89
|
-
readonly textOnFillLight: string;
|
|
90
|
-
/** Dark-mode counterpart to `textOnFillLight`. */
|
|
91
|
-
readonly textOnFillDark: string;
|
|
92
|
-
/** Primary accent — buttons, links */
|
|
93
|
-
readonly primary: string;
|
|
94
|
-
/** Secondary accent */
|
|
95
|
-
readonly secondary: string;
|
|
96
|
-
/** Tertiary accent */
|
|
97
|
-
readonly accent: string;
|
|
98
|
-
/** Error/danger */
|
|
99
|
-
readonly destructive: string;
|
|
100
|
-
/**
|
|
101
|
-
* Used for: inline annotations (red), pie charts, cScale,
|
|
102
|
-
* series rotation, journey actors, Gantt tasks.
|
|
103
|
-
*/
|
|
104
|
-
readonly colors: {
|
|
105
|
-
readonly red: string;
|
|
106
|
-
readonly orange: string;
|
|
107
|
-
readonly yellow: string;
|
|
108
|
-
readonly green: string;
|
|
109
|
-
readonly blue: string;
|
|
110
|
-
readonly purple: string;
|
|
111
|
-
readonly teal: string;
|
|
112
|
-
readonly cyan: string;
|
|
113
|
-
readonly gray: string;
|
|
114
|
-
readonly black: string;
|
|
115
|
-
readonly white: string;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Complete palette definition. One object per color scheme.
|
|
120
|
-
* This is what palette authors create — the single artifact for NFR1.
|
|
121
|
-
*
|
|
122
|
-
* Palettes are immutable from the consumer's perspective; the registry
|
|
123
|
-
* hands out the same frozen-shape object on every `getPalette(id)`.
|
|
124
|
-
*/
|
|
125
|
-
interface PaletteConfig {
|
|
126
|
-
/** Registry key: 'nord', 'slate', 'catppuccin' */
|
|
127
|
-
readonly id: string;
|
|
128
|
-
/** Display name: 'Nord', 'Slate', 'Catppuccin' */
|
|
129
|
-
readonly name: string;
|
|
130
|
-
/** Light mode color definitions */
|
|
131
|
-
readonly light: PaletteColors;
|
|
132
|
-
/** Dark mode color definitions */
|
|
133
|
-
readonly dark: PaletteColors;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** A single entry inside a tag group: `Value color` */
|
|
137
|
-
interface TagEntry {
|
|
138
|
-
readonly value: string;
|
|
139
|
-
readonly color: string;
|
|
140
|
-
readonly lineNumber: number;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* A tag group block: heading + entries.
|
|
144
|
-
*
|
|
145
|
-
* Parser internals build via `Writable<TagGroup>` from `utils/brand.ts`;
|
|
146
|
-
* once returned to a chart-type parser, consumers see the readonly view.
|
|
147
|
-
*/
|
|
148
|
-
interface TagGroup {
|
|
149
|
-
readonly name: string;
|
|
150
|
-
readonly alias?: string;
|
|
151
|
-
readonly entries: readonly TagEntry[];
|
|
152
|
-
/** Default value for nodes without explicit metadata. First entry unless another is marked `default`. */
|
|
153
|
-
readonly defaultValue?: string;
|
|
154
|
-
readonly lineNumber: number;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* DOM-safe key for a tag group — used wherever the group name becomes a
|
|
158
|
-
* `data-tag-*` attribute suffix, an entity metadata key, or an `active-tag`
|
|
159
|
-
* match target. For a single-identifier name (the only form the parser used to
|
|
160
|
-
* accept) this is exactly `name.toLowerCase()`, so swapping it in for existing
|
|
161
|
-
* diagrams is byte-identical. A quoted multi-word name (`tag "Trust Zone" as tz`)
|
|
162
|
-
* slugs to a hyphenated identifier (`trust-zone`) so it never produces an
|
|
163
|
-
* invalid DOM attribute name; the original `name` is kept for the legend label.
|
|
164
|
-
*/
|
|
165
|
-
declare function tagAttrKey(name: string): string;
|
|
166
|
-
/**
|
|
167
|
-
* The categorical name cycle used to auto-assign colors to bare tag values,
|
|
168
|
-
* in deterministic order. Aliased to the shared {@link CATEGORICAL_COLOR_ORDER}
|
|
169
|
-
* (RGB-seeded, max-contrast, neutrals excluded) so tag swatches and data-chart
|
|
170
|
-
* series colors share one canonical rotation. If a group has more colorless
|
|
171
|
-
* entries than free categorical names, the cycle wraps.
|
|
172
|
-
*/
|
|
173
|
-
declare const autoTagColorCycle: readonly string[];
|
|
174
|
-
|
|
175
|
-
/** A POI / route-stop position: gazetteer name (+ optional ISO scope) or coords. */
|
|
176
|
-
type PoiPos = {
|
|
177
|
-
readonly kind: 'coords';
|
|
178
|
-
readonly lat: number;
|
|
179
|
-
readonly lon: number;
|
|
180
|
-
} | {
|
|
181
|
-
readonly kind: 'name';
|
|
182
|
-
readonly name: string;
|
|
183
|
-
readonly scope?: string;
|
|
184
|
-
};
|
|
185
|
-
/** One-shot directives (§24B.2/.7). Values are raw strings unless typed.
|
|
186
|
-
*
|
|
187
|
-
* COSMETIC DEFAULTS ARE ON. Every basemap feature renders by default; the only
|
|
188
|
-
* control is a bare `no-*` opt-out flag that sets the matching `noXxx` boolean.
|
|
189
|
-
* Absent (undefined) = feature ON — so render gates test `!== true`, never
|
|
190
|
-
* `=== true`. There are NO positive opt-in cosmetic flags (§24B.2). */
|
|
191
|
-
interface MapDirectives {
|
|
192
|
-
/** Legend label for the region value ramp (`region-heat <label>`). */
|
|
193
|
-
regionMetric?: string;
|
|
194
|
-
/** Recognized color NAME for the choropleth ramp HIGH endpoint, peeled off the
|
|
195
|
-
* `region-heat` trailing token (§24B.3). Defaults to red when absent. */
|
|
196
|
-
regionMetricColor?: string;
|
|
197
|
-
/** Recognized color NAME for the choropleth ramp LOW endpoint (the second,
|
|
198
|
-
* left-of-two trailing colors on `region-heat`, §24B.3). Absent ⇒ the low
|
|
199
|
-
* end is the implied floored neutral (today's single-colour behaviour). */
|
|
200
|
-
regionMetricLowColor?: string;
|
|
201
|
-
/** Legend label for the POI value (marker size) channel (`poi-size`). */
|
|
202
|
-
poiMetric?: string;
|
|
203
|
-
/** Legend label for the edge/leg value (thickness) channel (`flow-width`). */
|
|
204
|
-
flowMetric?: string;
|
|
205
|
-
/** Default ISO scope for bare-name resolution (§24B.8): a 3166-1 country
|
|
206
|
-
* (`locale US`) or 3166-2 subdivision (`locale US-GA`). The country part
|
|
207
|
-
* biases ambiguous bare cities to that nation; the subdivision part further
|
|
208
|
-
* prefers that state. Inferred from content; explicit only to steer a guess. */
|
|
209
|
-
locale?: string;
|
|
210
|
-
activeTag?: string;
|
|
211
|
-
caption?: string;
|
|
212
|
-
/** `no-title` — suppress the title banner (the subtitle/caption, if any, still
|
|
213
|
-
* render). Mirrors the `no-title` directive across the other chart types. */
|
|
214
|
-
noTitle?: boolean;
|
|
215
|
-
/** `no-legend` — suppress the legend (default-on). */
|
|
216
|
-
noLegend?: boolean;
|
|
217
|
-
/** `no-coastline` — suppress the faint nautical-chart water-lines along
|
|
218
|
-
* coasts/shorelines (default-on; geometry derived from drawn region paths). */
|
|
219
|
-
noCoastline?: boolean;
|
|
220
|
-
/** `no-relief` — suppress mountain-range relief hachures. Relief is default-on
|
|
221
|
-
* but auto-gated to dataless reference maps at continent/world zoom (§24B.2). */
|
|
222
|
-
noRelief?: boolean;
|
|
223
|
-
/** `no-context-labels` — suppress the orientation backdrop (water-body names +
|
|
224
|
-
* unreferenced notable country names), distinct from `region-labels`. */
|
|
225
|
-
noContextLabels?: boolean;
|
|
226
|
-
/** `no-region-labels` — suppress region labels (default-on, full→abbrev→hide). */
|
|
227
|
-
noRegionLabels?: boolean;
|
|
228
|
-
/** `no-region-heat-value` — suppress the metric VALUE shown under each data region's
|
|
229
|
-
* name on a `region-heat` choropleth (default-on). The region NAME still
|
|
230
|
-
* renders (governed by `no-region-labels`); only the numeric value line goes. */
|
|
231
|
-
noRegionValue?: boolean;
|
|
232
|
-
/** `no-poi-labels` — suppress POI labels (default-on, collision-managed auto). */
|
|
233
|
-
noPoiLabels?: boolean;
|
|
234
|
-
/** `no-colorize` — force the plain green-land reference dress even when regions
|
|
235
|
-
* are referenced (regions are auto-coloured by default; §24B colorize). A
|
|
236
|
-
* no-op under data — the basemap is already gray there. */
|
|
237
|
-
noColorize?: boolean;
|
|
238
|
-
/** `no-cities` — suppress the subtle gazetteer city dots scattered across the
|
|
239
|
-
* basemap for geographic orientation (default-on; population-ranked, spacing-
|
|
240
|
-
* thinned so density adapts to zoom). Explicit POIs always draw regardless. */
|
|
241
|
-
noCities?: boolean;
|
|
242
|
-
/** `no-cluster-pois` — never collapse coincident POI markers into a count badge
|
|
243
|
-
* (clustering/spiderfy is default-on in the interactive preview). With this set
|
|
244
|
-
* the markers always render fanned out with their legs — the same as a static
|
|
245
|
-
* export — so a dense map reads the same on screen as on paper. No-op for
|
|
246
|
-
* export (already always expanded). */
|
|
247
|
-
noClusterPois?: boolean;
|
|
248
|
-
}
|
|
249
|
-
/** A region-fill: a subdivision name with an optional score and/or tag values
|
|
250
|
-
* (§24B.3/.4 — BOTH may be present; bivariate seam). */
|
|
251
|
-
interface MapRegion {
|
|
252
|
-
readonly name: string;
|
|
253
|
-
/** Optional trailing ISO scope qualifier (§24B.8) — a 3166-1 country code
|
|
254
|
-
* (`Georgia US` → US context) or 3166-2 subdivision (`Georgia US-GA`).
|
|
255
|
-
* Forces the country-vs-state interpretation and silences the ambiguity warning. */
|
|
256
|
-
readonly scope?: string;
|
|
257
|
-
/** Numeric value → choropleth shade (§24B.3). Lifted out of `meta`. */
|
|
258
|
-
readonly value?: number;
|
|
259
|
-
/** §1.5 trailing-token color NAME → flat categorical override fill (§24B.4);
|
|
260
|
-
* painted regardless of the active colouring dimension, no legend entry. */
|
|
261
|
-
readonly color?: string;
|
|
262
|
-
/** Tag values keyed by lowercased tag GROUP name (alias is resolved away). */
|
|
263
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
264
|
-
/** Any remaining reserved keys captured verbatim (`label`/`style`/…). */
|
|
265
|
-
readonly meta: Readonly<Record<string, string>>;
|
|
266
|
-
readonly lineNumber: number;
|
|
267
|
-
}
|
|
268
|
-
/** A point of interest (§24B.5). `meta` holds the numeric `value` (→ marker
|
|
269
|
-
* size) and `style` verbatim; `label` is lifted out. */
|
|
270
|
-
interface MapPoi {
|
|
271
|
-
readonly pos: PoiPos;
|
|
272
|
-
readonly alias?: string;
|
|
273
|
-
readonly label?: string;
|
|
274
|
-
/** §1.5 trailing-token color NAME → flat marker fill (§24B.5); wins over a
|
|
275
|
-
* tag color and the default orange. */
|
|
276
|
-
readonly color?: string;
|
|
277
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
278
|
-
readonly meta: Readonly<Record<string, string>>;
|
|
279
|
-
readonly lineNumber: number;
|
|
280
|
-
}
|
|
281
|
-
/** One leg of a route (§24B.6): an edge from the previous stop to `dest`. Reuses
|
|
282
|
-
* the indented edge arrow idiom (same as sitemap) — in-arrow text = leg label,
|
|
283
|
-
* `width:` = leg thickness, the arrow glyph = shape (`-…->` straight, `~…~>`
|
|
284
|
-
* arc). A tag on the leg line colours the LINE (§24B.6); `label:`/`as` still
|
|
285
|
-
* name the DESTINATION stop. The arrow is required — a bare destination errors. */
|
|
286
|
-
interface MapRouteLeg {
|
|
287
|
-
readonly label?: string;
|
|
288
|
-
readonly style: 'straight' | 'arc';
|
|
289
|
-
readonly value?: string;
|
|
290
|
-
readonly dest: PoiPos;
|
|
291
|
-
readonly destAlias?: string;
|
|
292
|
-
readonly destLabel?: string;
|
|
293
|
-
/** Tag(s) on the leg line → colour the LINE itself. To categorise a STOP,
|
|
294
|
-
* tag its own `poi` line. */
|
|
295
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
296
|
-
readonly lineNumber: number;
|
|
297
|
-
}
|
|
298
|
-
/** An ordered, auto-numbered route (§24B.6): `route <origin>` + a sequence of
|
|
299
|
-
* indented arrow legs, each continuing from the previous stop. Leg shape is
|
|
300
|
-
* per-leg (the arrow glyph) — there is no header-level shape option. Repeat the
|
|
301
|
-
* origin as a leg's destination to close a loop. */
|
|
302
|
-
interface MapRoute {
|
|
303
|
-
readonly origin: PoiPos;
|
|
304
|
-
readonly originAlias?: string;
|
|
305
|
-
readonly originLabel?: string;
|
|
306
|
-
readonly originValue?: string;
|
|
307
|
-
readonly originTags: Readonly<Record<string, string>>;
|
|
308
|
-
readonly legs: readonly MapRouteLeg[];
|
|
309
|
-
readonly lineNumber: number;
|
|
310
|
-
}
|
|
311
|
-
/** A connector (§24B.6). Endpoints are RAW identifier strings (name or alias);
|
|
312
|
-
* binding to POIs/regions is the resolver's job. Token = arrowhead iff it ends
|
|
313
|
-
* in `>`, arc iff it starts with `~`: `->` straight, `~>` arc, `--`/`-label-`
|
|
314
|
-
* undirected straight, `~~`/`~label~` undirected arc. */
|
|
315
|
-
interface MapEdge {
|
|
316
|
-
readonly from: string;
|
|
317
|
-
readonly to: string;
|
|
318
|
-
readonly label?: string;
|
|
319
|
-
readonly directed: boolean;
|
|
320
|
-
readonly style: 'straight' | 'arc';
|
|
321
|
-
readonly meta: Readonly<Record<string, string>>;
|
|
322
|
-
/** Tag(s) on the edge line → colour the LINE itself (§24B.6). */
|
|
323
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
324
|
-
readonly lineNumber: number;
|
|
325
|
-
}
|
|
326
|
-
interface ParsedMap {
|
|
327
|
-
readonly title: string | null;
|
|
328
|
-
readonly titleLineNumber: number | null;
|
|
329
|
-
readonly directives: MapDirectives;
|
|
330
|
-
readonly tagGroups: readonly TagGroup[];
|
|
331
|
-
readonly regions: readonly MapRegion[];
|
|
332
|
-
readonly pois: readonly MapPoi[];
|
|
333
|
-
readonly routes: readonly MapRoute[];
|
|
334
|
-
readonly edges: readonly MapEdge[];
|
|
335
|
-
readonly options: Readonly<Record<string, string>>;
|
|
336
|
-
readonly diagnostics: readonly DgmoError[];
|
|
337
|
-
readonly error: string | null;
|
|
338
|
-
}
|
|
339
|
-
/** Legend descriptor for a rendered map (a layout-stage output, re-exported from
|
|
340
|
-
* `layout.ts`). It lives here so the `legend-band` helper can consume it without
|
|
341
|
-
* importing `layout` — `layout` already value-imports `mapLegendBand`, so the
|
|
342
|
-
* reverse type import would form a layout↔legend-band cycle. */
|
|
343
|
-
interface MapLayoutLegend {
|
|
344
|
-
readonly tagGroups: ReadonlyArray<{
|
|
345
|
-
name: string;
|
|
346
|
-
entries: ReadonlyArray<{
|
|
347
|
-
value: string;
|
|
348
|
-
color: string;
|
|
349
|
-
}>;
|
|
350
|
-
}>;
|
|
351
|
-
readonly activeGroup: string | null;
|
|
352
|
-
readonly ramp?: {
|
|
353
|
-
metric?: string;
|
|
354
|
-
min: number;
|
|
355
|
-
max: number;
|
|
356
|
-
/** Resolved hex of the LOW (t=0) endpoint — the explicit low colour, or the
|
|
357
|
-
* floored neutral the single-colour fills blend up from. */
|
|
358
|
-
low: string;
|
|
359
|
-
/** Resolved hex of the HIGH (t=1) endpoint (the named ramp hue). */
|
|
360
|
-
high: string;
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/** A TopoJSON topology (world-coarse/world-detail keyed by ISO 3166-1 alpha-2;
|
|
365
|
-
* us-states keyed by ISO 3166-2). Geometry feature `id` is the ISO code;
|
|
366
|
-
* `properties.name` is the display string. Kept loose to avoid a topojson dep. */
|
|
367
|
-
interface BoundaryTopology {
|
|
368
|
-
type: 'Topology';
|
|
369
|
-
objects: Record<string, {
|
|
370
|
-
type: string;
|
|
371
|
-
geometries: BoundaryGeometry[];
|
|
372
|
-
}>;
|
|
373
|
-
arcs: number[][][];
|
|
374
|
-
transform?: {
|
|
375
|
-
scale: [number, number];
|
|
376
|
-
translate: [number, number];
|
|
377
|
-
};
|
|
378
|
-
bbox?: number[];
|
|
379
|
-
}
|
|
380
|
-
interface BoundaryGeometry {
|
|
381
|
-
type: string;
|
|
382
|
-
/** ISO code: alpha-2 (countries) or 3166-2 `US-XX` (states). */
|
|
383
|
-
id: string;
|
|
384
|
-
properties: {
|
|
385
|
-
name: string;
|
|
386
|
-
};
|
|
387
|
-
arcs?: unknown;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* A gazetteer city entry: `[lat, lon, iso, pop, name, sub?]`.
|
|
391
|
-
* - `lat`/`lon` — rounded to 3 decimals.
|
|
392
|
-
* - `iso` — ISO 3166-1 alpha-2 country code.
|
|
393
|
-
* - `pop` — population.
|
|
394
|
-
* - `name` — canonical display name (case/accents preserved).
|
|
395
|
-
* - `sub` — ISO 3166-2 subdivision (US cities only in v1, e.g. `US-OR`); absent otherwise.
|
|
396
|
-
*/
|
|
397
|
-
type GazetteerEntry = [
|
|
398
|
-
lat: number,
|
|
399
|
-
lon: number,
|
|
400
|
-
iso: string,
|
|
401
|
-
pop: number,
|
|
402
|
-
name: string,
|
|
403
|
-
sub?: string
|
|
404
|
-
];
|
|
405
|
-
interface Gazetteer {
|
|
406
|
-
/** Every city, stored once. `byName`/`alt` reference cities by array index
|
|
407
|
-
* (normalized — no tuple duplication; geonameid is a build-time-only linker). */
|
|
408
|
-
cities: GazetteerEntry[];
|
|
409
|
-
/** Folded (NFD, diacritic-stripped, lowercased) name → indices into `cities`.
|
|
410
|
-
* Always an array; length > 1 for same-named cities (Portland US-OR / US-ME). */
|
|
411
|
-
byName: Record<string, number[]>;
|
|
412
|
-
/** Folded alias → index into `cities`. Never collides with a `byName` key. */
|
|
413
|
-
alt: Record<string, number>;
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* IATA-coded airport index (a SEPARATE optional asset — `airports.json`; ADR-1).
|
|
417
|
-
* Lets memorized airport codes resolve to coordinates through the resolver's
|
|
418
|
-
* existing fold→lookup path (`poi JFK`, `route JFK -> LAX`) — no parser change.
|
|
419
|
-
*
|
|
420
|
-
* - `airports` — `GazetteerEntry` tuples `[lat, lon, iso, 0, name]`. `pop` is
|
|
421
|
-
* always 0 (OurAirports has no enplanement column); `name` is the full airport
|
|
422
|
-
* name, used for COMPLETION DISPLAY only — airports resolve by IATA code, never
|
|
423
|
-
* by name. Coords are rounded to 2 decimals (~1km; sub-pixel at map scale).
|
|
424
|
-
* - `airportIata` — folded 3-letter IATA code → index into `airports`. Consulted
|
|
425
|
-
* LAST in resolution (after city `byName` + `alt`), so a real city always wins
|
|
426
|
-
* a shared token (ADR-2). Airports never enter `cities[]`, so the city-scatter
|
|
427
|
-
* and reverse-geocode layers never see them.
|
|
428
|
-
*/
|
|
429
|
-
interface AirportData {
|
|
430
|
-
readonly airports: GazetteerEntry[];
|
|
431
|
-
readonly airportIata: Record<string, number>;
|
|
432
|
-
}
|
|
433
|
-
/** Water-feature class (Natural Earth `featurecla`, rivers/reefs excluded). */
|
|
434
|
-
type WaterKind = 'ocean' | 'sea' | 'gulf' | 'bay' | 'strait' | 'channel' | 'sound';
|
|
435
|
-
/**
|
|
436
|
-
* A water-body label entry: `[lat, lon, name, tier, kind, alt?]`.
|
|
437
|
-
* - `lat`/`lon` — label anchor (Natural Earth inner point), rounded to 3 decimals.
|
|
438
|
-
* - `name` — full display name (no abbreviation exists for water bodies).
|
|
439
|
-
* - `tier` — Natural Earth `scalerank` (0 = most prominent → orientation priority).
|
|
440
|
-
* - `kind` — feature class (drives styling/priority bucketing).
|
|
441
|
-
* - `alt` — optional extra anchor points `[lat, lon][]`; the layout picks the
|
|
442
|
-
* one nearest the viewport center (Decision 5 multi-anchor seam). Absent today.
|
|
443
|
-
*/
|
|
444
|
-
type WaterBodyEntry = [
|
|
445
|
-
lat: number,
|
|
446
|
-
lon: number,
|
|
447
|
-
name: string,
|
|
448
|
-
tier: number,
|
|
449
|
-
kind: WaterKind,
|
|
450
|
-
alt?: ReadonlyArray<readonly [number, number]>
|
|
451
|
-
];
|
|
452
|
-
interface WaterBodies {
|
|
453
|
-
/** Deterministically ordered (tier, then name). Generated from Natural Earth
|
|
454
|
-
* marine polys by scripts/build-map-data.mjs into `water-bodies.json`. */
|
|
455
|
-
readonly entries: readonly WaterBodyEntry[];
|
|
456
|
-
}
|
|
457
|
-
/** A fill-able region (country or US state) — the display name + its ISO id +
|
|
458
|
-
* layer. Powers region-name autocomplete (completion-only; the renderer derives
|
|
459
|
-
* names from the topology directly). Extracted from the topologies by
|
|
460
|
-
* scripts/build-map-data.mjs into `region-names.json`. */
|
|
461
|
-
interface RegionName {
|
|
462
|
-
/** Display name (original casing), e.g. `California` / `Germany`. */
|
|
463
|
-
readonly name: string;
|
|
464
|
-
/** ISO 3166-1 alpha-2 (country) or 3166-2 `US-XX` (state). */
|
|
465
|
-
readonly iso: string;
|
|
466
|
-
readonly layer: 'country' | 'us-state';
|
|
467
|
-
}
|
|
468
|
-
interface RegionNames {
|
|
469
|
-
/** Deterministically ordered (layer, then name). */
|
|
470
|
-
readonly regions: readonly RegionName[];
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
/** The four static assets, injected into the pure resolver (DI). */
|
|
474
|
-
interface MapData {
|
|
475
|
-
worldCoarse: BoundaryTopology;
|
|
476
|
-
worldDetail: BoundaryTopology;
|
|
477
|
-
usStates: BoundaryTopology;
|
|
478
|
-
/** Major lakes (Natural Earth 110m) drawn as water over land — e.g. the Great
|
|
479
|
-
* Lakes. Optional so hand-built test fixtures need not supply it. */
|
|
480
|
-
lakes?: BoundaryTopology;
|
|
481
|
-
/** Major river centerlines (Natural Earth 110m) drawn as thin water lines over
|
|
482
|
-
* land — e.g. the Amazon, Nile, Mississippi. Optional, like `lakes`. */
|
|
483
|
-
rivers?: BoundaryTopology;
|
|
484
|
-
/** Notable mountain-range polygons (Natural Earth 50m geography regions) drawn
|
|
485
|
-
* as a subtle gradient relief cue over base land when the `relief` directive
|
|
486
|
-
* is on — e.g. the Rockies, Andes, Himalayas. Optional, like `lakes`. */
|
|
487
|
-
mountainRanges?: BoundaryTopology;
|
|
488
|
-
/** North-America-clipped 10m country land, used as crisp neighbour context
|
|
489
|
-
* under the albers-usa US view so Canada/Mexico match the 10m states instead
|
|
490
|
-
* of the coarser world tiers. Optional, like `lakes`. */
|
|
491
|
-
naLand?: BoundaryTopology;
|
|
492
|
-
/** North-America-clipped 10m major lakes (Great Lakes etc.), used in place of
|
|
493
|
-
* the coarse `lakes` under the albers-usa US view. Optional. */
|
|
494
|
-
naLakes?: BoundaryTopology;
|
|
495
|
-
/** Water-body orientation labels (Natural Earth marine polys) drawn when the
|
|
496
|
-
* `context-labels` directive is on — oceans/seas/gulfs/bays/etc. Optional, so
|
|
497
|
-
* hand-built test fixtures and older bundles need not supply it. */
|
|
498
|
-
waterBodies?: WaterBodies;
|
|
499
|
-
/** IATA-coded airports (`airports.json`) — lets `poi JFK` / `route JFK -> LAX`
|
|
500
|
-
* resolve. Optional so hand-built fixtures and older DI bundles need not supply
|
|
501
|
-
* it; the resolver guards `data.airports?.…` everywhere. */
|
|
502
|
-
airports?: AirportData;
|
|
503
|
-
gazetteer: Gazetteer;
|
|
504
|
-
}
|
|
505
|
-
type ProjectionFamily = 'equal-earth' | 'natural-earth' | 'equirectangular' | 'albers-usa' | 'conic-equal-area' | 'mercator';
|
|
506
|
-
/** Which geometry layers the renderer draws. */
|
|
507
|
-
interface Basemaps {
|
|
508
|
-
/** World country tier: coarse (world-scale) | detail (regional/zoom). */
|
|
509
|
-
world: 'coarse' | 'detail';
|
|
510
|
-
/** Loaded subdivision layers (v1: only 'us-states'). */
|
|
511
|
-
subdivisions: Array<'us-states'>;
|
|
512
|
-
}
|
|
513
|
-
interface ResolvedRegion {
|
|
514
|
-
/** ISO code: alpha-2 (country) or 3166-2 `US-XX` (state) — the geometry id. */
|
|
515
|
-
readonly iso: string;
|
|
516
|
-
readonly name: string;
|
|
517
|
-
readonly layer: 'country' | 'us-state';
|
|
518
|
-
readonly value?: number;
|
|
519
|
-
/** §1.5 trailing-token color NAME → flat override fill (§24B.4). */
|
|
520
|
-
readonly color?: string;
|
|
521
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
522
|
-
readonly meta: Readonly<Record<string, string>>;
|
|
523
|
-
readonly lineNumber: number;
|
|
524
|
-
}
|
|
525
|
-
interface ResolvedPoi {
|
|
526
|
-
/** Folded registry id (alias|name folded, or `@lat,lon` for coord POIs). */
|
|
527
|
-
readonly id: string;
|
|
528
|
-
/** Display name (original casing): the city/place name, alias, or endpoint
|
|
529
|
-
* string. The on-map label falls back to this when `label` is absent (the
|
|
530
|
-
* folded `id` is for binding, not display). */
|
|
531
|
-
readonly name?: string;
|
|
532
|
-
readonly lat: number;
|
|
533
|
-
readonly lon: number;
|
|
534
|
-
readonly label?: string;
|
|
535
|
-
/** §1.5 trailing-token color NAME → flat marker fill (§24B.5). */
|
|
536
|
-
readonly color?: string;
|
|
537
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
538
|
-
readonly meta: Readonly<Record<string, string>>;
|
|
539
|
-
readonly lineNumber: number;
|
|
540
|
-
/** True when created from an undeclared edge/route endpoint (§24B.10). */
|
|
541
|
-
readonly implicit?: boolean;
|
|
542
|
-
}
|
|
543
|
-
interface ResolvedEdge {
|
|
544
|
-
readonly fromId: string;
|
|
545
|
-
readonly toId: string;
|
|
546
|
-
readonly label?: string;
|
|
547
|
-
readonly directed: boolean;
|
|
548
|
-
readonly style: 'straight' | 'arc';
|
|
549
|
-
readonly meta: Readonly<Record<string, string>>;
|
|
550
|
-
/** Tag(s) on the edge line → colour the LINE (§24B.6). */
|
|
551
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
552
|
-
readonly lineNumber: number;
|
|
553
|
-
}
|
|
554
|
-
interface ResolvedRouteLeg {
|
|
555
|
-
readonly fromId: string;
|
|
556
|
-
readonly toId: string;
|
|
557
|
-
readonly label?: string;
|
|
558
|
-
readonly style: 'straight' | 'arc';
|
|
559
|
-
readonly value?: string;
|
|
560
|
-
/** Tag(s) on the leg line → colour the LINE (§24B.6). */
|
|
561
|
-
readonly tags: Readonly<Record<string, string>>;
|
|
562
|
-
readonly lineNumber: number;
|
|
563
|
-
}
|
|
564
|
-
interface ResolvedRoute {
|
|
565
|
-
/** Ordered UNIQUE stop ids (for numbering + the origin marker). A loop-closing
|
|
566
|
-
* leg whose destination is an earlier stop adds a leg but no duplicate stop. */
|
|
567
|
-
readonly stopIds: readonly string[];
|
|
568
|
-
readonly legs: readonly ResolvedRouteLeg[];
|
|
569
|
-
readonly lineNumber: number;
|
|
570
|
-
}
|
|
571
|
-
/** Geographic bounding box `[[west, south], [east, north]]` in degrees.
|
|
572
|
-
*
|
|
573
|
-
* WRAP CONVENTION (#12): for an antimeridian-crossing extent the resolver keeps
|
|
574
|
-
* `west` in [−180, 180] and returns `east` UNWRAPPED in (180, 540] (i.e.
|
|
575
|
-
* `east = west + span`, span ≤ 360). So `east > 180` signals a dateline-crossing
|
|
576
|
-
* extent; the renderer (step 4) must mod `east` back into [−180, 180] (or shift
|
|
577
|
-
* the projection's center) rather than assume `east ≤ 180`. `south`/`north` are
|
|
578
|
-
* always plain degrees in [−90, 90]. */
|
|
579
|
-
type GeoExtent = [[number, number], [number, number]];
|
|
580
|
-
interface ResolvedMap {
|
|
581
|
-
readonly title: string | null;
|
|
582
|
-
/** DEAD — the `subtitle` directive was removed (2026-06-02 defaults-on review).
|
|
583
|
-
* Never populated; the renderer's subtitle branch is now unreachable. Left for
|
|
584
|
-
* a later cleanup pass. */
|
|
585
|
-
readonly subtitle?: string;
|
|
586
|
-
readonly caption?: string;
|
|
587
|
-
readonly tagGroups: readonly TagGroup[];
|
|
588
|
-
readonly directives: MapDirectives;
|
|
589
|
-
readonly basemaps: Basemaps;
|
|
590
|
-
readonly regions: readonly ResolvedRegion[];
|
|
591
|
-
readonly pois: readonly ResolvedPoi[];
|
|
592
|
-
readonly edges: readonly ResolvedEdge[];
|
|
593
|
-
readonly routes: readonly ResolvedRoute[];
|
|
594
|
-
readonly extent: GeoExtent;
|
|
595
|
-
readonly projection: ProjectionFamily;
|
|
596
|
-
/** POI-only region framing: the region(s) that CONTAIN the POIs — us-state ids
|
|
597
|
-
* (`US-CA`) or country isos (`FR`). The frame is snapped to the union of their
|
|
598
|
-
* bboxes, and the layout labels them prominently (vs. muted neighbours). Empty
|
|
599
|
-
* for non-POI-only maps or when POIs fall outside every polygon. Optional so
|
|
600
|
-
* older/foreign ResolvedMap literals need not supply it. */
|
|
601
|
-
readonly poiFrameContainers?: readonly string[];
|
|
602
|
-
readonly diagnostics: readonly DgmoError[];
|
|
603
|
-
readonly error: string | null;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* Compact view state schema (ADR-6).
|
|
608
|
-
* All fields optional. Only non-default values are encoded.
|
|
609
|
-
* `tag: null` means "user chose none"; absent `tag` means "use DSL default" (ADR-5).
|
|
610
|
-
*/
|
|
611
|
-
interface CompactViewState {
|
|
612
|
-
tag?: string | null;
|
|
613
|
-
cs?: number[];
|
|
614
|
-
cg?: string[];
|
|
615
|
-
swim?: string | null;
|
|
616
|
-
cl?: string[];
|
|
617
|
-
cc?: string[];
|
|
618
|
-
rm?: string;
|
|
619
|
-
htv?: Record<string, string[]>;
|
|
620
|
-
ha?: string[];
|
|
621
|
-
sem?: boolean;
|
|
622
|
-
cm?: boolean;
|
|
623
|
-
c4l?: string;
|
|
624
|
-
c4s?: string;
|
|
625
|
-
c4c?: string;
|
|
626
|
-
rps?: number;
|
|
627
|
-
spd?: number;
|
|
628
|
-
io?: Record<string, number>;
|
|
629
|
-
hd?: boolean;
|
|
630
|
-
cbd?: boolean;
|
|
631
|
-
rq?: string;
|
|
632
|
-
an?: boolean;
|
|
633
|
-
fl?: boolean;
|
|
634
|
-
}
|
|
635
|
-
interface DecodedDiagramUrl {
|
|
636
|
-
dsl: string;
|
|
637
|
-
viewState: CompactViewState;
|
|
638
|
-
palette?: string;
|
|
639
|
-
theme?: 'light' | 'dark';
|
|
640
|
-
filename?: string;
|
|
641
|
-
}
|
|
642
|
-
interface EncodeDiagramUrlOptions {
|
|
643
|
-
baseUrl?: string;
|
|
644
|
-
viewState?: CompactViewState;
|
|
645
|
-
palette?: string;
|
|
646
|
-
theme?: 'light' | 'dark';
|
|
647
|
-
filename?: string;
|
|
648
|
-
}
|
|
649
|
-
type EncodeDiagramUrlResult = {
|
|
650
|
-
url: string;
|
|
651
|
-
error?: undefined;
|
|
652
|
-
} | {
|
|
653
|
-
url?: undefined;
|
|
654
|
-
error: 'too-large';
|
|
655
|
-
compressedSize: number;
|
|
656
|
-
limit: number;
|
|
657
|
-
};
|
|
658
|
-
/**
|
|
659
|
-
* Encode a CompactViewState to a compressed string for URL embedding.
|
|
660
|
-
* Returns empty string if state has no keys (ADR-4).
|
|
661
|
-
*/
|
|
662
|
-
declare function encodeViewState(state: CompactViewState): string;
|
|
663
|
-
/**
|
|
664
|
-
* Decode a compressed view state string back to CompactViewState.
|
|
665
|
-
* Returns empty object on failure (no crash).
|
|
666
|
-
*/
|
|
667
|
-
declare function decodeViewState(encoded: string): CompactViewState;
|
|
668
|
-
/**
|
|
669
|
-
* Compress a DGMO DSL string into a shareable URL.
|
|
670
|
-
* Returns `{ url }` on success, or `{ error: 'too-large', compressedSize, limit }` if the
|
|
671
|
-
* compressed payload exceeds the 8 KB limit.
|
|
672
|
-
*/
|
|
673
|
-
declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions): EncodeDiagramUrlResult;
|
|
674
|
-
/**
|
|
675
|
-
* Decode a DGMO DSL string and view state from a URL query string or hash.
|
|
676
|
-
* Accepts any of:
|
|
677
|
-
* - `?dgmo=<payload>&vs=<state>`
|
|
678
|
-
* - `#dgmo=<payload>&vs=<state>` (backwards compat)
|
|
679
|
-
* - `dgmo=<payload>`
|
|
680
|
-
* - `<bare payload>`
|
|
681
|
-
*
|
|
682
|
-
* Returns `{ dsl, viewState }`. The DSL is empty string on invalid input.
|
|
683
|
-
*/
|
|
684
|
-
declare function decodeDiagramUrl(hash: string): DecodedDiagramUrl;
|
|
685
|
-
|
|
686
|
-
interface ChartTypeMeta {
|
|
687
|
-
readonly id: string;
|
|
688
|
-
readonly description: string;
|
|
689
|
-
readonly fallback?: true;
|
|
690
|
-
}
|
|
691
|
-
declare const chartTypes: readonly ChartTypeMeta[];
|
|
692
|
-
|
|
693
|
-
/** User-visible rendering category for dispatch and routing. */
|
|
694
|
-
type RenderCategory = 'data-chart' | 'visualization' | 'diagram';
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* Extracts the chart type from raw file content.
|
|
698
|
-
* First tries the first non-empty, non-comment line as a bare chart type name
|
|
699
|
-
* (e.g., `gantt Product Launch`).
|
|
700
|
-
* Falls back to inference when no explicit chart type is found.
|
|
701
|
-
*/
|
|
702
|
-
declare function parseDgmoChartType(content: string): string | null;
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* Returns the render category for a given chart type, or `null` if unknown.
|
|
706
|
-
* Use this instead of the internal framework map for dispatch in consumers.
|
|
707
|
-
*/
|
|
708
|
-
declare function getRenderCategory(chartType: string): RenderCategory | null;
|
|
709
|
-
/**
|
|
710
|
-
* Returns true if the chart type is an extended chart type
|
|
711
|
-
* handled by parseExtendedChart (scatter, sankey, function, heatmap, funnel).
|
|
712
|
-
* Returns false for standard chart types and all other types.
|
|
713
|
-
*/
|
|
714
|
-
declare function isExtendedChartType(chartType: string): boolean;
|
|
715
|
-
/**
|
|
716
|
-
* Returns all supported chart type identifiers in canonical (tier) order,
|
|
717
|
-
* derived from `chartTypes`. Consumers that need alphabetical order should
|
|
718
|
-
* call `.sort()` explicitly.
|
|
719
|
-
*/
|
|
720
|
-
declare function getAllChartTypes(): string[];
|
|
721
|
-
/**
|
|
722
|
-
* Canonical descriptions for every supported chart type. Derived from
|
|
723
|
-
* `chartTypes` so there is exactly one place to update when adding a new
|
|
724
|
-
* type. Consumed by the CLI `dgmo types` command, the editor autocomplete
|
|
725
|
-
* popup, and the MCP `list_chart_types` tool.
|
|
726
|
-
*/
|
|
727
|
-
declare const CHART_TYPE_DESCRIPTIONS: Record<string, string>;
|
|
728
|
-
type ParseResult = {
|
|
729
|
-
diagnostics: readonly DgmoError[];
|
|
730
|
-
};
|
|
731
|
-
type ParseFn = (content: string) => ParseResult;
|
|
732
|
-
/**
|
|
733
|
-
* Maps every chart-type id to the parser that handles it, DERIVED from
|
|
734
|
-
* `CHART_TYPE_REGISTRY` (src/chart-type-registry.ts). Adding a new chart type
|
|
735
|
-
* means adding ONE descriptor there plus its `chartTypes` metadata entry; the
|
|
736
|
-
* `chart-type-registry.test.ts` cross-check asserts the registry, `chartTypes`,
|
|
737
|
-
* the render-category sites, and the export handlers all stay in sync.
|
|
738
|
-
*/
|
|
739
|
-
declare const chartTypeParsers: ReadonlyArray<readonly [string, ParseFn]>;
|
|
740
|
-
/** Ids in the same order as `chartTypeParsers`; used for cross-checks. */
|
|
741
|
-
declare const knownChartTypeIds: readonly string[];
|
|
742
|
-
/**
|
|
743
|
-
* Parse DGMO content and return diagnostics without rendering.
|
|
744
|
-
* Useful for the CLI and editor to surface all errors before attempting render.
|
|
745
|
-
*/
|
|
746
|
-
declare function parseDgmo(content: string): {
|
|
747
|
-
diagnostics: DgmoError[];
|
|
748
|
-
chartType: string | null;
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
/** Validate that a hex string is well-formed (#RGB or #RRGGBB). */
|
|
752
|
-
declare function isValidHex(value: string): boolean;
|
|
753
|
-
/**
|
|
754
|
-
* Register a palette. Called at module initialization.
|
|
755
|
-
* Validates that all 19 color fields per mode are present and valid hex.
|
|
756
|
-
* Throws on malformed palettes to catch errors at startup, not at render time.
|
|
757
|
-
*/
|
|
758
|
-
declare function registerPalette(palette: PaletteConfig): void;
|
|
759
|
-
/** Get palette by id. Silently returns the default palette if id is unrecognized. */
|
|
760
|
-
declare function getPalette(id: string): PaletteConfig;
|
|
761
|
-
/**
|
|
762
|
-
* Resolve a palette by id, falling back to the default palette when the id is
|
|
763
|
-
* unregistered. If a `warn` callback is supplied, it is invoked once with a
|
|
764
|
-
* human-readable fallback message on a miss — the single place the "resolve,
|
|
765
|
-
* fall back, warn" policy lives, so each host can surface it its own way
|
|
766
|
-
* (console.warn, Obsidian Notice, MCP response). Silent when the id resolves or
|
|
767
|
-
* when no callback is passed.
|
|
768
|
-
*/
|
|
769
|
-
declare function resolvePaletteOrFallback(id: string, warn?: (message: string) => void): PaletteConfig;
|
|
770
|
-
/** List all registered palettes alphabetically (for the selector UI). */
|
|
771
|
-
declare function getAvailablePalettes(): PaletteConfig[];
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* All built-in palettes, keyed by camelCase id. Use directly with render():
|
|
775
|
-
*
|
|
776
|
-
* await render(text, { palette: palettes.catppuccin });
|
|
777
|
-
*
|
|
778
|
-
* For preference/settings storage, the `.id` field of each entry is the
|
|
779
|
-
* canonical string (e.g. `'tokyo-night'`, `'nord'`) — that's the wire format
|
|
780
|
-
* used by share URLs and the CLI `--palette` flag.
|
|
781
|
-
*/
|
|
782
|
-
declare const palettes: {
|
|
783
|
-
readonly atlas: PaletteConfig;
|
|
784
|
-
readonly blueprint: PaletteConfig;
|
|
785
|
-
readonly slate: PaletteConfig;
|
|
786
|
-
readonly tidewater: PaletteConfig;
|
|
787
|
-
readonly nord: PaletteConfig;
|
|
788
|
-
readonly catppuccin: PaletteConfig;
|
|
789
|
-
readonly tokyoNight: PaletteConfig;
|
|
790
|
-
};
|
|
791
|
-
|
|
792
|
-
interface MapPlaceCompletion {
|
|
793
|
-
/** Canonical display name (original casing), e.g. `Portland`. */
|
|
794
|
-
readonly name: string;
|
|
795
|
-
/** Text to insert. ISO-qualified (`Portland US-OR`) iff the name is
|
|
796
|
-
* ambiguous in the gazetteer; bare otherwise (disambiguate-once, §24B.8). */
|
|
797
|
-
readonly insert: string;
|
|
798
|
-
/** Menu label (`Portland — US-OR` when ambiguous, else `Portland`). */
|
|
799
|
-
readonly label: string;
|
|
800
|
-
/** Secondary detail, e.g. `US-OR · 652,503`. */
|
|
801
|
-
readonly detail: string;
|
|
802
|
-
readonly iso: string;
|
|
803
|
-
readonly sub?: string;
|
|
804
|
-
readonly pop: number;
|
|
805
|
-
/** `'airport'` for IATA-code entries (icon/grouping affordance); absent or
|
|
806
|
-
* `'city'` for gazetteer cities. Cities rank above airports for a shared
|
|
807
|
-
* prefix so ~1500 codes never bury city names (ADR-5). */
|
|
808
|
-
readonly kind?: 'city' | 'airport';
|
|
809
|
-
}
|
|
810
|
-
interface MapCompletionOptions {
|
|
811
|
-
/** Max results (default 12). */
|
|
812
|
-
readonly limit?: number;
|
|
813
|
-
/** IATA-coded airports (`airports.json`). When supplied, airport codes
|
|
814
|
-
* matching the prefix are offered as a second (post-city) group. Optional —
|
|
815
|
-
* absent (old DI bundles / no asset) just yields city-only completions. */
|
|
816
|
-
readonly airports?: AirportData;
|
|
817
|
-
/** Resolver-inferred map scope (country `US` or subdivision `US-CA`). Biases
|
|
818
|
-
* airport ranking so in-region airports sort above out-of-region same-prefix
|
|
819
|
-
* ones (ADR-6). Pure rank, never a filter — cross-region airports still
|
|
820
|
-
* appear. App passes the document's inferred scope in (Slice 2). */
|
|
821
|
-
readonly scopeISO?: string;
|
|
822
|
-
}
|
|
823
|
-
/**
|
|
824
|
-
* Prefix-match city names + alternate-name aliases against the gazetteer,
|
|
825
|
-
* rank by population (desc; stable tie-break by gazetteer index), and emit
|
|
826
|
-
* ISO-qualified insert text only for ambiguous (same-named) places.
|
|
827
|
-
*
|
|
828
|
-
* Pure + deterministic. Empty/blank query → `[]` (the caller gates min length).
|
|
829
|
-
*/
|
|
830
|
-
declare function completeMapPlaces(query: string, gazetteer: Gazetteer, opts?: MapCompletionOptions): MapPlaceCompletion[];
|
|
831
|
-
/** A POI search hit — a city or airport the resolver can resolve, with the
|
|
832
|
-
* exact `token` to paste into DGMO (a `poi`/route endpoint). Powers the CLI
|
|
833
|
-
* `dgmo map search` command and the MCP `lookup_map_location` tool, so authors
|
|
834
|
-
* (and AI agents) can DISCOVER valid place tokens instead of guessing — e.g.
|
|
835
|
-
* learn that "New York" must be `New York City` and that `JFK` is bundled. */
|
|
836
|
-
interface MapLocationMatch {
|
|
837
|
-
/** Canonical display name (cities) or full airport name. */
|
|
838
|
-
readonly name: string;
|
|
839
|
-
/** Exact text to use in DGMO. Cities: the name, ISO-qualified when ambiguous
|
|
840
|
-
* (`Portland US-OR`). Airports: the upper-case IATA code (`JFK`). */
|
|
841
|
-
readonly token: string;
|
|
842
|
-
readonly kind: 'city' | 'airport';
|
|
843
|
-
readonly iso: string;
|
|
844
|
-
readonly sub?: string;
|
|
845
|
-
/** City population (0 for airports). */
|
|
846
|
-
readonly pop: number;
|
|
847
|
-
/** Human detail, e.g. `US-OR · 652,503` or `Airport · John F Kennedy Intl`. */
|
|
848
|
-
readonly detail: string;
|
|
849
|
-
}
|
|
850
|
-
/**
|
|
851
|
-
* Substring-search cities + airports for a discovery surface (CLI / MCP), so an
|
|
852
|
-
* author can find the exact token the resolver expects. Unlike
|
|
853
|
-
* {@link completeMapPlaces} (prefix-only, editor type-ahead), this matches
|
|
854
|
-
* anywhere in a city name OR an airport code/name, so "york" finds
|
|
855
|
-
* `New York City` and "kennedy" finds `JFK`.
|
|
856
|
-
*
|
|
857
|
-
* Ranking: exact-name (or exact-IATA) → prefix → substring; within a tier,
|
|
858
|
-
* cities by population desc (deterministic index tie-break), cities before
|
|
859
|
-
* airports. Pure + deterministic. Empty query → `[]`.
|
|
860
|
-
*/
|
|
861
|
-
declare function searchMapLocations(query: string, gazetteer: Gazetteer, opts?: {
|
|
862
|
-
readonly limit?: number;
|
|
863
|
-
readonly airports?: AirportData;
|
|
864
|
-
}): MapLocationMatch[];
|
|
865
|
-
interface MapRegionCompletion {
|
|
866
|
-
/** Display name = insert text (the resolver disambiguates cross-layer
|
|
867
|
-
* collisions like Georgia by map scope, §24B.8). */
|
|
868
|
-
readonly name: string;
|
|
869
|
-
/** ISO 3166-1/3166-2 id. */
|
|
870
|
-
readonly iso: string;
|
|
871
|
-
readonly layer: 'country' | 'us-state';
|
|
872
|
-
/** Secondary detail, e.g. `US state · US-CA` or `Country · DE`. */
|
|
873
|
-
readonly detail: string;
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Prefix-match fill-able region names (countries + US states) for region-fill
|
|
877
|
-
* lines. Matches the folded display name OR the ISO code; deterministic
|
|
878
|
-
* (alphabetical by name, then layer). Pure. Empty query → `[]`.
|
|
879
|
-
*
|
|
880
|
-
* `regions` is injected (the `region-names.json` asset, shipped in dist/map-data
|
|
881
|
-
* alongside the gazetteer). Cross-layer same-name (Georgia: country GE + state
|
|
882
|
-
* US-GA) yields both entries, distinguished by `detail`.
|
|
883
|
-
*/
|
|
884
|
-
declare function completeMapRegions(query: string, regions: readonly RegionName[], opts?: MapCompletionOptions): MapRegionCompletion[];
|
|
885
|
-
|
|
886
|
-
/**
|
|
887
|
-
* Theme — render mode flag. Selects which palette variant the renderer uses
|
|
888
|
-
* for background and text:
|
|
889
|
-
* - 'light' → palette.light colors
|
|
890
|
-
* - 'dark' → palette.dark colors
|
|
891
|
-
* - 'transparent' → no background fill (for embedding in colored containers)
|
|
892
|
-
*/
|
|
893
|
-
type Theme = 'light' | 'dark' | 'transparent';
|
|
894
|
-
/**
|
|
895
|
-
* `themes` namespace — use with render() options for a typed handle:
|
|
896
|
-
*
|
|
897
|
-
* await render(text, { theme: themes.dark });
|
|
898
|
-
*
|
|
899
|
-
* Passing the raw string `'dark'` also works (the underlying type is the
|
|
900
|
-
* string-literal union); the namespace is the conventional path.
|
|
901
|
-
*/
|
|
902
|
-
declare const themes: {
|
|
903
|
-
readonly light: "light";
|
|
904
|
-
readonly dark: "dark";
|
|
905
|
-
readonly transparent: "transparent";
|
|
906
|
-
};
|
|
907
|
-
|
|
908
|
-
export { getRenderCategory as $, type AirportData as A, type BoundaryTopology as B, type CompactViewState as C, type DgmoError as D, type EncodeDiagramUrlOptions as E, type ResolvedPoi as F, type GeoExtent as G, type ResolvedRegion as H, type ResolvedRoute as I, type Theme as J, autoTagColorCycle as K, chartTypeParsers as L, type MapData as M, chartTypes as N, completeMapPlaces as O, type PaletteColors as P, completeMapRegions as Q, type ResolvedMap as R, decodeDiagramUrl as S, type TagGroup as T, decodeViewState as U, encodeDiagramUrl as V, encodeViewState as W, formatDgmoError as X, getAllChartTypes as Y, getAvailablePalettes as Z, getPalette as _, type PaletteConfig as a, isExtendedChartType as a0, isValidHex as a1, knownChartTypeIds as a2, makeDgmoError as a3, palettes as a4, parseDgmo as a5, parseDgmoChartType as a6, registerPalette as a7, searchMapLocations as a8, tagAttrKey as a9, themes as aa, type DiagnosticSpec as ab, type DiagnosticParams as ac, type EmitOptions as ad, emit as ae, resolvePaletteOrFallback as af, type TagEntry as b, type ParsedMap as c, type MapLayoutLegend as d, CHART_TYPE_DESCRIPTIONS as e, type ChartTypeMeta as f, type DecodedDiagramUrl as g, type DgmoSeverity as h, type EncodeDiagramUrlResult as i, type Gazetteer as j, type GazetteerEntry as k, type MapCompletionOptions as l, type MapDirectives as m, type MapEdge as n, type MapLocationMatch as o, type MapPlaceCompletion as p, type MapPoi as q, type MapRegion as r, type MapRegionCompletion as s, type MapRoute as t, type PoiPos as u, type ProjectionFamily as v, type RegionName as w, type RegionNames as x, type RenderCategory as y, type ResolvedEdge as z };
|