@diagrammo/dgmo 0.20.3 → 0.21.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.
@@ -4268,8 +4268,12 @@ interface MapScale {
4268
4268
  interface MapDirectives {
4269
4269
  region?: string;
4270
4270
  projection?: string;
4271
- metric?: string;
4272
- sizeMetric?: string;
4271
+ /** Legend label for the region value ramp (`region-metric <label>`). */
4272
+ regionMetric?: string;
4273
+ /** Legend label for the POI value (marker size) channel (`poi-metric`). */
4274
+ poiMetric?: string;
4275
+ /** Legend label for the edge/leg value (thickness) channel (`flow-metric`). */
4276
+ flowMetric?: string;
4273
4277
  scale?: MapScale;
4274
4278
  regionLabels?: string;
4275
4279
  poiLabels?: string;
@@ -4279,6 +4283,12 @@ interface MapDirectives {
4279
4283
  noLegend?: boolean;
4280
4284
  subtitle?: string;
4281
4285
  caption?: string;
4286
+ /** Basemap dress override (bare flags `muted` / `natural`). Forces the
4287
+ * land/water styling regardless of whether a colouring dimension is active —
4288
+ * `muted` recedes to neutral grays, `natural` keeps the green/blue reference
4289
+ * dress. Absent → auto (muted iff a score/tag dimension is active). Lets two
4290
+ * maps in one deck share a look. */
4291
+ basemapStyle?: 'muted' | 'natural';
4282
4292
  }
4283
4293
  /** A region-fill: a subdivision name with an optional score and/or tag values
4284
4294
  * (§24B.3/.4 — BOTH may be present; bivariate seam). */
@@ -4288,15 +4298,16 @@ interface MapRegion {
4288
4298
  * (`Georgia US` → US context) or 3166-2 subdivision (`Georgia US-GA`).
4289
4299
  * Forces the country-vs-state interpretation and silences the ambiguity warning. */
4290
4300
  readonly scope?: string;
4291
- readonly score?: number;
4301
+ /** Numeric value → choropleth shade (§24B.3). Lifted out of `meta`. */
4302
+ readonly value?: number;
4292
4303
  /** Tag values keyed by lowercased tag GROUP name (alias is resolved away). */
4293
4304
  readonly tags: Readonly<Record<string, string>>;
4294
- /** Other reserved-but-inert keys (description/date/…) captured verbatim. */
4305
+ /** Any remaining reserved keys captured verbatim (`label`/`style`/…). */
4295
4306
  readonly meta: Readonly<Record<string, string>>;
4296
4307
  readonly lineNumber: number;
4297
4308
  }
4298
- /** A point of interest (§24B.5). `meta` holds reserved-but-inert keys
4299
- * (size/score/description/weight/date) verbatim; `label` is lifted out. */
4309
+ /** A point of interest (§24B.5). `meta` holds the numeric `value` (→ marker
4310
+ * size) and `style` verbatim; `label` is lifted out. */
4300
4311
  interface MapPoi {
4301
4312
  readonly pos: PoiPos;
4302
4313
  readonly alias?: string;
@@ -4305,17 +4316,31 @@ interface MapPoi {
4305
4316
  readonly meta: Readonly<Record<string, string>>;
4306
4317
  readonly lineNumber: number;
4307
4318
  }
4308
- /** A route stop (§24B.6); raw order preserved incl. a repeated first==last (loop). */
4309
- interface MapRouteStop {
4310
- readonly ref: PoiPos;
4311
- readonly alias?: string;
4312
- readonly meta: Readonly<Record<string, string>>;
4319
+ /** One leg of a route (§24B.6): an edge from the previous stop to `dest`. Reuses
4320
+ * the edge arrow idiom — in-arrow text = leg label, `value:` = leg thickness,
4321
+ * `->`/`~>` (or the header `style: arc`) = shape. Stop-targeted keys on the leg
4322
+ * line (`tag`, `label:`) decorate the DESTINATION point. */
4323
+ interface MapRouteLeg {
4324
+ readonly label?: string;
4325
+ readonly style: 'straight' | 'arc';
4326
+ readonly value?: string;
4327
+ readonly dest: PoiPos;
4328
+ readonly destAlias?: string;
4329
+ readonly destLabel?: string;
4330
+ readonly destTags: Readonly<Record<string, string>>;
4313
4331
  readonly lineNumber: number;
4314
4332
  }
4315
- /** An ordered, auto-numbered route (§24B.6). `meta.style==='arc'` curves legs. */
4333
+ /** An ordered, auto-numbered route (§24B.6): `route <origin> [style: arc]` + a
4334
+ * sequence of indented arrow legs, each continuing from the previous stop.
4335
+ * Repeat the origin as a leg's destination to close a loop. */
4316
4336
  interface MapRoute {
4317
- readonly stops: readonly MapRouteStop[];
4318
- readonly meta: Readonly<Record<string, string>>;
4337
+ readonly origin: PoiPos;
4338
+ readonly originAlias?: string;
4339
+ readonly originLabel?: string;
4340
+ readonly originValue?: string;
4341
+ readonly originTags: Readonly<Record<string, string>>;
4342
+ readonly style: 'straight' | 'arc';
4343
+ readonly legs: readonly MapRouteLeg[];
4319
4344
  readonly lineNumber: number;
4320
4345
  }
4321
4346
  /** A connector (§24B.6). Endpoints are RAW identifier strings (name or alias);
@@ -4447,7 +4472,7 @@ interface ResolvedRegion {
4447
4472
  readonly iso: string;
4448
4473
  readonly name: string;
4449
4474
  readonly layer: 'country' | 'us-state';
4450
- readonly score?: number;
4475
+ readonly value?: number;
4451
4476
  readonly tags: Readonly<Record<string, string>>;
4452
4477
  readonly meta: Readonly<Record<string, string>>;
4453
4478
  readonly lineNumber: number;
@@ -4477,9 +4502,19 @@ interface ResolvedEdge {
4477
4502
  readonly meta: Readonly<Record<string, string>>;
4478
4503
  readonly lineNumber: number;
4479
4504
  }
4505
+ interface ResolvedRouteLeg {
4506
+ readonly fromId: string;
4507
+ readonly toId: string;
4508
+ readonly label?: string;
4509
+ readonly style: 'straight' | 'arc';
4510
+ readonly value?: string;
4511
+ readonly lineNumber: number;
4512
+ }
4480
4513
  interface ResolvedRoute {
4514
+ /** Ordered UNIQUE stop ids (for numbering + the origin marker). A loop-closing
4515
+ * leg whose destination is an earlier stop adds a leg but no duplicate stop. */
4481
4516
  readonly stopIds: readonly string[];
4482
- readonly meta: Readonly<Record<string, string>>;
4517
+ readonly legs: readonly ResolvedRouteLeg[];
4483
4518
  readonly lineNumber: number;
4484
4519
  }
4485
4520
  /** Geographic bounding box `[[west, south], [east, north]]` in degrees.
@@ -4524,9 +4559,9 @@ interface MapLayoutRegion {
4524
4559
  readonly label?: string;
4525
4560
  readonly lineNumber: number;
4526
4561
  readonly layer: 'base' | 'country' | 'us-state';
4527
- /** The region's score (if any) — emitted as `data-score` so the app can
4562
+ /** The region's value (if any) — emitted as `data-value` so the app can
4528
4563
  * highlight by gradient-scrub proximity. */
4529
- readonly score?: number;
4564
+ readonly value?: number;
4530
4565
  /** The region's tag values keyed by group (lowercased) — emitted as
4531
4566
  * `data-tag-<group>` so the app can highlight on legend-entry hover. */
4532
4567
  readonly tags?: Readonly<Record<string, string>>;
@@ -4555,6 +4590,9 @@ interface MapLayoutPoi {
4555
4590
  readonly implicit: boolean;
4556
4591
  readonly isOrigin: boolean;
4557
4592
  readonly routeNumber?: number;
4593
+ /** Tag values keyed by lowercased group name — emitted as `data-tag-<group>`
4594
+ * so the app can spotlight markers on legend-entry hover (mirrors regions). */
4595
+ readonly tags?: Readonly<Record<string, string>>;
4558
4596
  }
4559
4597
  /** A drawn connector -- an edge or a route leg (same geometry contract). */
4560
4598
  interface MapLayoutLeg {
@@ -4651,13 +4689,16 @@ interface Size {
4651
4689
  }
4652
4690
  /** The map's water / backdrop colour for a palette — the single source of truth
4653
4691
  * shared by the renderer's `<rect>` fill and any host wrapper that needs to
4654
- * match it (so letterbox gaps around the SVG don't show a stray band). */
4655
- declare function mapBackgroundColor(palette: PaletteColors): string;
4656
- /** The map's neutral (unscored/untagged) LAND colour the green base every
4657
- * region blends from. Exported so a host can DIM a region to plain land
4658
- * (rather than lowering opacity, which would let the blue water show through
4659
- * and make the shape read as ocean). Matches the layout's `neutralFill`. */
4660
- declare function mapNeutralLandColor(palette: PaletteColors, isDark: boolean): string;
4692
+ * match it (so letterbox gaps around the SVG don't show a stray band). When
4693
+ * `dataActive` (a score ramp or tag group is colouring regions) the sea recedes
4694
+ * to a pale neutral so blue/green data hues don't blend into it. */
4695
+ declare function mapBackgroundColor(palette: PaletteColors, isDark?: boolean, dataActive?: boolean): string;
4696
+ /** The map's neutral (unscored/untagged) LAND colour the base every region
4697
+ * blends from. Exported so a host can DIM a region to plain land (rather than
4698
+ * lowering opacity, which would let the water show through and make the shape
4699
+ * read as ocean). Matches the layout's `neutralFill`. Green reference dress by
4700
+ * default; neutral (page bg on light, lifted gray on dark) when `dataActive`. */
4701
+ declare function mapNeutralLandColor(palette: PaletteColors, isDark: boolean, dataActive?: boolean): string;
4661
4702
  declare function layoutMap(resolved: ResolvedMap, data: MapData, size: Size, opts: LayoutOptions): MapLayout;
4662
4703
 
4663
4704
  /** Render a resolved map into `container` (d3-selection appends an `<svg>`). */
@@ -4268,8 +4268,12 @@ interface MapScale {
4268
4268
  interface MapDirectives {
4269
4269
  region?: string;
4270
4270
  projection?: string;
4271
- metric?: string;
4272
- sizeMetric?: string;
4271
+ /** Legend label for the region value ramp (`region-metric <label>`). */
4272
+ regionMetric?: string;
4273
+ /** Legend label for the POI value (marker size) channel (`poi-metric`). */
4274
+ poiMetric?: string;
4275
+ /** Legend label for the edge/leg value (thickness) channel (`flow-metric`). */
4276
+ flowMetric?: string;
4273
4277
  scale?: MapScale;
4274
4278
  regionLabels?: string;
4275
4279
  poiLabels?: string;
@@ -4279,6 +4283,12 @@ interface MapDirectives {
4279
4283
  noLegend?: boolean;
4280
4284
  subtitle?: string;
4281
4285
  caption?: string;
4286
+ /** Basemap dress override (bare flags `muted` / `natural`). Forces the
4287
+ * land/water styling regardless of whether a colouring dimension is active —
4288
+ * `muted` recedes to neutral grays, `natural` keeps the green/blue reference
4289
+ * dress. Absent → auto (muted iff a score/tag dimension is active). Lets two
4290
+ * maps in one deck share a look. */
4291
+ basemapStyle?: 'muted' | 'natural';
4282
4292
  }
4283
4293
  /** A region-fill: a subdivision name with an optional score and/or tag values
4284
4294
  * (§24B.3/.4 — BOTH may be present; bivariate seam). */
@@ -4288,15 +4298,16 @@ interface MapRegion {
4288
4298
  * (`Georgia US` → US context) or 3166-2 subdivision (`Georgia US-GA`).
4289
4299
  * Forces the country-vs-state interpretation and silences the ambiguity warning. */
4290
4300
  readonly scope?: string;
4291
- readonly score?: number;
4301
+ /** Numeric value → choropleth shade (§24B.3). Lifted out of `meta`. */
4302
+ readonly value?: number;
4292
4303
  /** Tag values keyed by lowercased tag GROUP name (alias is resolved away). */
4293
4304
  readonly tags: Readonly<Record<string, string>>;
4294
- /** Other reserved-but-inert keys (description/date/…) captured verbatim. */
4305
+ /** Any remaining reserved keys captured verbatim (`label`/`style`/…). */
4295
4306
  readonly meta: Readonly<Record<string, string>>;
4296
4307
  readonly lineNumber: number;
4297
4308
  }
4298
- /** A point of interest (§24B.5). `meta` holds reserved-but-inert keys
4299
- * (size/score/description/weight/date) verbatim; `label` is lifted out. */
4309
+ /** A point of interest (§24B.5). `meta` holds the numeric `value` (→ marker
4310
+ * size) and `style` verbatim; `label` is lifted out. */
4300
4311
  interface MapPoi {
4301
4312
  readonly pos: PoiPos;
4302
4313
  readonly alias?: string;
@@ -4305,17 +4316,31 @@ interface MapPoi {
4305
4316
  readonly meta: Readonly<Record<string, string>>;
4306
4317
  readonly lineNumber: number;
4307
4318
  }
4308
- /** A route stop (§24B.6); raw order preserved incl. a repeated first==last (loop). */
4309
- interface MapRouteStop {
4310
- readonly ref: PoiPos;
4311
- readonly alias?: string;
4312
- readonly meta: Readonly<Record<string, string>>;
4319
+ /** One leg of a route (§24B.6): an edge from the previous stop to `dest`. Reuses
4320
+ * the edge arrow idiom — in-arrow text = leg label, `value:` = leg thickness,
4321
+ * `->`/`~>` (or the header `style: arc`) = shape. Stop-targeted keys on the leg
4322
+ * line (`tag`, `label:`) decorate the DESTINATION point. */
4323
+ interface MapRouteLeg {
4324
+ readonly label?: string;
4325
+ readonly style: 'straight' | 'arc';
4326
+ readonly value?: string;
4327
+ readonly dest: PoiPos;
4328
+ readonly destAlias?: string;
4329
+ readonly destLabel?: string;
4330
+ readonly destTags: Readonly<Record<string, string>>;
4313
4331
  readonly lineNumber: number;
4314
4332
  }
4315
- /** An ordered, auto-numbered route (§24B.6). `meta.style==='arc'` curves legs. */
4333
+ /** An ordered, auto-numbered route (§24B.6): `route <origin> [style: arc]` + a
4334
+ * sequence of indented arrow legs, each continuing from the previous stop.
4335
+ * Repeat the origin as a leg's destination to close a loop. */
4316
4336
  interface MapRoute {
4317
- readonly stops: readonly MapRouteStop[];
4318
- readonly meta: Readonly<Record<string, string>>;
4337
+ readonly origin: PoiPos;
4338
+ readonly originAlias?: string;
4339
+ readonly originLabel?: string;
4340
+ readonly originValue?: string;
4341
+ readonly originTags: Readonly<Record<string, string>>;
4342
+ readonly style: 'straight' | 'arc';
4343
+ readonly legs: readonly MapRouteLeg[];
4319
4344
  readonly lineNumber: number;
4320
4345
  }
4321
4346
  /** A connector (§24B.6). Endpoints are RAW identifier strings (name or alias);
@@ -4447,7 +4472,7 @@ interface ResolvedRegion {
4447
4472
  readonly iso: string;
4448
4473
  readonly name: string;
4449
4474
  readonly layer: 'country' | 'us-state';
4450
- readonly score?: number;
4475
+ readonly value?: number;
4451
4476
  readonly tags: Readonly<Record<string, string>>;
4452
4477
  readonly meta: Readonly<Record<string, string>>;
4453
4478
  readonly lineNumber: number;
@@ -4477,9 +4502,19 @@ interface ResolvedEdge {
4477
4502
  readonly meta: Readonly<Record<string, string>>;
4478
4503
  readonly lineNumber: number;
4479
4504
  }
4505
+ interface ResolvedRouteLeg {
4506
+ readonly fromId: string;
4507
+ readonly toId: string;
4508
+ readonly label?: string;
4509
+ readonly style: 'straight' | 'arc';
4510
+ readonly value?: string;
4511
+ readonly lineNumber: number;
4512
+ }
4480
4513
  interface ResolvedRoute {
4514
+ /** Ordered UNIQUE stop ids (for numbering + the origin marker). A loop-closing
4515
+ * leg whose destination is an earlier stop adds a leg but no duplicate stop. */
4481
4516
  readonly stopIds: readonly string[];
4482
- readonly meta: Readonly<Record<string, string>>;
4517
+ readonly legs: readonly ResolvedRouteLeg[];
4483
4518
  readonly lineNumber: number;
4484
4519
  }
4485
4520
  /** Geographic bounding box `[[west, south], [east, north]]` in degrees.
@@ -4524,9 +4559,9 @@ interface MapLayoutRegion {
4524
4559
  readonly label?: string;
4525
4560
  readonly lineNumber: number;
4526
4561
  readonly layer: 'base' | 'country' | 'us-state';
4527
- /** The region's score (if any) — emitted as `data-score` so the app can
4562
+ /** The region's value (if any) — emitted as `data-value` so the app can
4528
4563
  * highlight by gradient-scrub proximity. */
4529
- readonly score?: number;
4564
+ readonly value?: number;
4530
4565
  /** The region's tag values keyed by group (lowercased) — emitted as
4531
4566
  * `data-tag-<group>` so the app can highlight on legend-entry hover. */
4532
4567
  readonly tags?: Readonly<Record<string, string>>;
@@ -4555,6 +4590,9 @@ interface MapLayoutPoi {
4555
4590
  readonly implicit: boolean;
4556
4591
  readonly isOrigin: boolean;
4557
4592
  readonly routeNumber?: number;
4593
+ /** Tag values keyed by lowercased group name — emitted as `data-tag-<group>`
4594
+ * so the app can spotlight markers on legend-entry hover (mirrors regions). */
4595
+ readonly tags?: Readonly<Record<string, string>>;
4558
4596
  }
4559
4597
  /** A drawn connector -- an edge or a route leg (same geometry contract). */
4560
4598
  interface MapLayoutLeg {
@@ -4651,13 +4689,16 @@ interface Size {
4651
4689
  }
4652
4690
  /** The map's water / backdrop colour for a palette — the single source of truth
4653
4691
  * shared by the renderer's `<rect>` fill and any host wrapper that needs to
4654
- * match it (so letterbox gaps around the SVG don't show a stray band). */
4655
- declare function mapBackgroundColor(palette: PaletteColors): string;
4656
- /** The map's neutral (unscored/untagged) LAND colour the green base every
4657
- * region blends from. Exported so a host can DIM a region to plain land
4658
- * (rather than lowering opacity, which would let the blue water show through
4659
- * and make the shape read as ocean). Matches the layout's `neutralFill`. */
4660
- declare function mapNeutralLandColor(palette: PaletteColors, isDark: boolean): string;
4692
+ * match it (so letterbox gaps around the SVG don't show a stray band). When
4693
+ * `dataActive` (a score ramp or tag group is colouring regions) the sea recedes
4694
+ * to a pale neutral so blue/green data hues don't blend into it. */
4695
+ declare function mapBackgroundColor(palette: PaletteColors, isDark?: boolean, dataActive?: boolean): string;
4696
+ /** The map's neutral (unscored/untagged) LAND colour the base every region
4697
+ * blends from. Exported so a host can DIM a region to plain land (rather than
4698
+ * lowering opacity, which would let the water show through and make the shape
4699
+ * read as ocean). Matches the layout's `neutralFill`. Green reference dress by
4700
+ * default; neutral (page bg on light, lifted gray on dark) when `dataActive`. */
4701
+ declare function mapNeutralLandColor(palette: PaletteColors, isDark: boolean, dataActive?: boolean): string;
4661
4702
  declare function layoutMap(resolved: ResolvedMap, data: MapData, size: Size, opts: LayoutOptions): MapLayout;
4662
4703
 
4663
4704
  /** Render a resolved map into `container` (d3-selection appends an `<svg>`). */