@diagrammo/dgmo 0.65.0 → 0.66.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.
@@ -1,12 +1,14 @@
1
- import { a as DgmoError, P as PaletteConfig, T as TagGroup, f as PaletteColors, C as CompactViewState, k as TagEntry } from './dgmo-router-Dd5PTjxl.js';
2
- export { l as CHART_TYPE_DESCRIPTIONS, b as ChartTypeId, c as ChartTypeMeta, m as DecodedDiagramUrl, d as DgmoSeverity, n as EncodeDiagramUrlOptions, o as EncodeDiagramUrlResult, R as RenderCategory, q as autoTagColorCycle, s as chartTypeParsers, g as chartTypes, t as decodeDiagramUrl, u as decodeViewState, v as encodeDiagramUrl, w as encodeViewState, i as formatDgmoError, x as getAllChartTypes, y as getAvailablePalettes, j as getPalette, z as getRenderCategory, A as isExtendedChartType, B as isValidHex, F as knownChartTypeIds, G as makeDgmoError, p as parseDgmo, H as parseDgmoChartType, I as registerPalette, J as tagAttrKey, p as validate } from './dgmo-router-Dd5PTjxl.js';
3
- import { M as MapDataSource, P as ParsedMap, c as MapData, j as ResolvedMap, k as MapLayoutLegend, l as GeoExtent } from './themes-DiUAG4Bf.js';
4
- export { A as AirportData, B as BoundaryTopology, G as Gazetteer, a as GazetteerEntry, b as MapCompletionOptions, m as MapDirectives, n as MapEdge, d as MapLocationMatch, e as MapPlaceCompletion, o as MapPoi, q as MapRegion, f as MapRegionCompletion, r as MapRoute, u as PoiPos, v as ProjectionFamily, R as RegionName, g as RegionNames, w as ResolvedEdge, x as ResolvedPoi, y as ResolvedRegion, z as ResolvedRoute, T as Theme, h as completeMapPlaces, i as completeMapRegions, p as palettes, C as renderForExport, s as searchMapLocations, t as themes } from './themes-DiUAG4Bf.js';
1
+ import { D as DgmoError, P as PaletteConfig, T as TagGroup, a as PaletteColors, C as CompactViewState, g as TagEntry } from './tag-groups-NUA2F1I5.js';
2
+ export { h as DecodedDiagramUrl, c as DgmoSeverity, i as EncodeDiagramUrlOptions, j as EncodeDiagramUrlResult, k as autoTagColorCycle, l as decodeDiagramUrl, m as decodeViewState, n as encodeDiagramUrl, o as encodeViewState, f as formatDgmoError, p as makeDgmoError, t as tagAttrKey } from './tag-groups-NUA2F1I5.js';
3
+ import { M as MapDataSource, P as ParsedMap, b as MapData, d as ResolvedMap, e as MapLayoutLegend, f as GeoExtent } from './d3-Bfhj-XBX.js';
4
+ export { A as AirportData, B as BoundaryTopology, G as Gazetteer, a as GazetteerEntry, g as MapDirectives, h as MapEdge, i as MapPoi, j as MapRegion, k as MapRoute, l as PoiPos, m as ProjectionFamily, R as RegionName, c as RegionNames, n as ResolvedEdge, o as ResolvedPoi, p as ResolvedRegion, q as ResolvedRoute, r as renderForExport } from './d3-Bfhj-XBX.js';
5
+ export { b as CHART_TYPE_DESCRIPTIONS, C as ChartTypeId, a as ChartTypeMeta, R as RenderCategory, d as chartTypeParsers, c as chartTypes, e as getAllChartTypes, f as getAvailablePalettes, g as getPalette, h as getRenderCategory, i as isExtendedChartType, j as isValidHex, k as knownChartTypeIds, p as parseDgmo, l as parseDgmoChartType, m as registerPalette, p as validate } from './dgmo-router-EAW7XiBE.js';
5
6
  import { Selection } from 'd3-selection';
6
7
  import * as d3Scale from 'd3-scale';
7
- import { P as ParsedOrg, F as FillMode, R as RaciMarker, a as ParsedRaci, b as RaciVariant, c as RaciTask } from './chart-meta-D98NbYDp.js';
8
- export { A as ALL_CHART_TYPES, I as ImportSource, O as OrgNode, d as RaciPhase, e as RaciRoleAssignment, f as ReadFileFn, g as ResolveImportsResult, h as contrastText, i as getSeriesColors, j as hexToHSL, k as hexToHSLString, l as hslToHex, m as mix, n as normalizePertSourceForShare, p as parseFirstLine, o as parseOrg, q as parseRaci, r as resolveOrgImports, s as shade, t as shapeFill, u as tint } from './chart-meta-D98NbYDp.js';
8
+ import { P as ParsedOrg, F as FillMode, R as RaciMarker, a as ParsedRaci, b as RaciVariant, c as RaciTask } from './chart-meta-CpicJ1kj.js';
9
+ export { A as ALL_CHART_TYPES, I as ImportSource, O as OrgNode, d as RaciPhase, e as RaciRoleAssignment, f as ReadFileFn, g as ResolveImportsResult, h as contrastText, i as getSeriesColors, j as hexToHSL, k as hexToHSLString, l as hslToHex, m as mix, n as normalizePertSourceForShare, p as parseFirstLine, o as parseOrg, q as parseRaci, r as resolveOrgImports, s as shade, t as shapeFill, u as tint } from './chart-meta-CpicJ1kj.js';
9
10
  import { GeoProjection } from 'd3-geo';
11
+ export { M as MapCompletionOptions, a as MapLocationMatch, b as MapPlaceCompletion, c as MapRegionCompletion, T as Theme, d as completeMapPlaces, e as completeMapRegions, p as palettes, s as searchMapLocations, t as themes } from './themes-Dem5xalq.js';
10
12
 
11
13
  /**
12
14
  * Stable diagnostic codes for in-arrow label parsing errors.
package/dist/advanced.js CHANGED
@@ -79,18 +79,18 @@ import {
79
79
  import {
80
80
  renderMap,
81
81
  renderMapForExport
82
- } from "./chunk-QRWY5QTA.js";
82
+ } from "./chunk-O274UTXH.js";
83
83
  import "./chunk-FWVKPEG3.js";
84
84
  import {
85
85
  mapContentAspect,
86
86
  mapExportDimensions
87
- } from "./chunk-PZOFMBF3.js";
87
+ } from "./chunk-X26BF4T2.js";
88
88
  import {
89
89
  albersSkewFallback,
90
90
  layoutMap,
91
91
  mapBackgroundColor,
92
92
  mapNeutralLandColor
93
- } from "./chunk-6E5YZR4S.js";
93
+ } from "./chunk-R7S5542V.js";
94
94
  import {
95
95
  decodeFeatures,
96
96
  regionAt
@@ -313,7 +313,7 @@ import {
313
313
  renderSlopeChart,
314
314
  renderVenn,
315
315
  renderWordCloud
316
- } from "./chunk-ZZXPYVS4.js";
316
+ } from "./chunk-3OT63FS4.js";
317
317
  import "./chunk-7L53J53J.js";
318
318
  import "./chunk-EOYPX6SF.js";
319
319
  import {
package/dist/block.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { M as MapDataSource } from './d3-Bfhj-XBX.js';
2
+ import './tag-groups-NUA2F1I5.js';
3
+
1
4
  /**
2
5
  * Canonical stylesheet for the standard DGMO embed block (BL-114).
3
6
  *
@@ -106,6 +109,20 @@ interface DgmoBlockOptions {
106
109
  * trusted, since these end up in markup verbatim.
107
110
  */
108
111
  dataAttributes?: Record<string, string>;
112
+ /**
113
+ * Map basemap assets, forwarded to `render()`. Without them a ` ```dgmo `
114
+ * fence containing a map emits the error card ("This map has no basemap
115
+ * data") — this module reads nothing from disk or the network on its own,
116
+ * and it has no environment default, because it runs in browsers as much as
117
+ * in build scripts.
118
+ *
119
+ * A Node host (a remark build, a static-site generator, a report writer)
120
+ * passes `loadMapData` from `@diagrammo/dgmo/advanced` — as the FUNCTION, so
121
+ * the eleven basemap JSON files are read only for a fence that turns out to
122
+ * be a map. A browser host supplies the data itself, or a loader that
123
+ * fetches it.
124
+ */
125
+ mapData?: MapDataSource;
109
126
  /** Receives palette-fallback warnings. Default: console.warn. */
110
127
  onWarn?: (message: string) => void;
111
128
  }
@@ -139,4 +156,4 @@ declare function buildDgmoBlockHtml(source: string, svgsHtml: string, options?:
139
156
  */
140
157
  declare function errorBlockHtml(err: unknown, source: string, options?: Pick<DgmoBlockOptions, 'className' | 'legacyClassNames'>): string;
141
158
 
142
- export { BLOCK_CSS, type BlockColorMode, type BlockMode, type DgmoBlockOptions, type DgmoBlockResult, EDITOR_BASE_URL, buildDgmoBlockHtml, errorBlockHtml, renderDgmoBlock };
159
+ export { BLOCK_CSS, type BlockColorMode, type BlockMode, type DgmoBlockOptions, type DgmoBlockResult, EDITOR_BASE_URL, MapDataSource, buildDgmoBlockHtml, errorBlockHtml, renderDgmoBlock };
package/dist/block.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-D3K4U3ZM.js";
5
5
  import {
6
6
  render
7
- } from "./chunk-ZZXPYVS4.js";
7
+ } from "./chunk-3OT63FS4.js";
8
8
  import {
9
9
  docsLink,
10
10
  renderErrorCard
@@ -1052,6 +1052,7 @@ function resolveBlockOptions(opts) {
1052
1052
  legacyClassNames: opts.legacyClassNames ?? [],
1053
1053
  dataAttributes: opts.dataAttributes ?? {},
1054
1054
  title: opts.title,
1055
+ mapData: opts.mapData,
1055
1056
  onWarn: opts.onWarn ?? ((message) => console.warn(message))
1056
1057
  };
1057
1058
  }
@@ -1062,7 +1063,11 @@ async function renderDgmoBlock(source, options = {}) {
1062
1063
  const diagnostics = [];
1063
1064
  let chartType;
1064
1065
  const renderTheme = async (theme) => {
1065
- const r = await render(trimmed, { palette: palette.id, theme });
1066
+ const r = await render(trimmed, {
1067
+ palette: palette.id,
1068
+ theme,
1069
+ ...opts.mapData !== void 0 ? { mapData: opts.mapData } : {}
1070
+ });
1066
1071
  chartType = r.chartType;
1067
1072
  diagnostics.push(...r.diagnostics);
1068
1073
  const errors = r.diagnostics.filter((d) => d.severity === "error");
@@ -1,4 +1,5 @@
1
- import { f as PaletteColors, T as TagGroup, a as DgmoError } from './dgmo-router-Dd5PTjxl.js';
1
+ import './dgmo-router-EAW7XiBE.js';
2
+ import { a as PaletteColors, T as TagGroup, D as DgmoError } from './tag-groups-NUA2F1I5.js';
2
3
 
3
4
  /** Convert hex (#RRGGBB or #RGB) to { h, s, l } with h in degrees, s/l as percentages. */
4
5
  declare function hexToHSL(hex: string): {
@@ -1,2 +1,3 @@
1
- export { b as ChartTypeId, c as ChartTypeMeta, C as CompactViewState, m as DecodedDiagramUrl, n as EncodeDiagramUrlOptions, o as EncodeDiagramUrlResult, f as PaletteColors, g as chartTypes, t as decodeDiagramUrl, u as decodeViewState, v as encodeDiagramUrl, w as encodeViewState, y as getAvailablePalettes, j as getPalette, H as parseDgmoChartType } from './dgmo-router-Dd5PTjxl.js';
2
- export { A as ALL_CHART_TYPES, O as OrgNode, P as ParsedOrg, k as hexToHSLString, n as normalizePertSourceForShare, p as parseFirstLine, o as parseOrg, q as parseRaci, r as resolveOrgImports } from './chart-meta-D98NbYDp.js';
1
+ export { C as ChartTypeId, a as ChartTypeMeta, c as chartTypes, f as getAvailablePalettes, g as getPalette, l as parseDgmoChartType } from './dgmo-router-EAW7XiBE.js';
2
+ export { A as ALL_CHART_TYPES, O as OrgNode, P as ParsedOrg, k as hexToHSLString, n as normalizePertSourceForShare, p as parseFirstLine, o as parseOrg, q as parseRaci, r as resolveOrgImports } from './chart-meta-CpicJ1kj.js';
3
+ export { C as CompactViewState, h as DecodedDiagramUrl, i as EncodeDiagramUrlOptions, j as EncodeDiagramUrlResult, a as PaletteColors, l as decodeDiagramUrl, m as decodeViewState, n as encodeDiagramUrl, o as encodeViewState } from './tag-groups-NUA2F1I5.js';
@@ -2749,8 +2749,8 @@ async function exportMap(ctx) {
2749
2749
  const { content, theme, palette, options } = ctx;
2750
2750
  const { parseMap } = await import("./parser-UKQC7N6K.js");
2751
2751
  const { resolveMap } = await import("./resolver-B3TXWNWF.js");
2752
- const { renderMapForExport } = await import("./renderer-AOFIEF2T.js");
2753
- const { mapExportDimensions } = await import("./dimensions-ILAVBRQ3.js");
2752
+ const { renderMapForExport } = await import("./renderer-T66477EQ.js");
2753
+ const { mapExportDimensions } = await import("./dimensions-RD3Y7FCF.js");
2754
2754
  const effectivePalette = await resolveExportPalette(theme, palette);
2755
2755
  const mapParsed = parseMap(content, effectivePalette);
2756
2756
  const { data: mapData, reason } = await resolveMapDataSource(
@@ -3718,4 +3718,4 @@ export {
3718
3718
  renderForExport,
3719
3719
  render
3720
3720
  };
3721
- //# sourceMappingURL=chunk-ZZXPYVS4.js.map
3721
+ //# sourceMappingURL=chunk-3OT63FS4.js.map
@@ -6,7 +6,7 @@ import {
6
6
  mapLegendConfig,
7
7
  mapLegendGroups,
8
8
  parsePathRings
9
- } from "./chunk-6E5YZR4S.js";
9
+ } from "./chunk-R7S5542V.js";
10
10
  import {
11
11
  TITLE_FONT_SIZE,
12
12
  TITLE_FONT_WEIGHT,
@@ -781,4 +781,4 @@ export {
781
781
  renderMap,
782
782
  renderMapForExport
783
783
  };
784
- //# sourceMappingURL=chunk-QRWY5QTA.js.map
784
+ //# sourceMappingURL=chunk-O274UTXH.js.map
@@ -1036,20 +1036,6 @@ function createLabelMetrics(size) {
1036
1036
  };
1037
1037
  }
1038
1038
 
1039
- // src/map/layout-constants.ts
1040
- var FIT_PAD = 24;
1041
- var WORLD_LABEL_ANCHORS = {
1042
- US: [-98.5, 39.5],
1043
- // CONUS geographic centre (near Lebanon, Kansas)
1044
- // Russia crosses the antimeridian (Chukotka at ~170°W), so on a non-global
1045
- // (e.g. Europe) projection its geometry smears across the whole frame and the
1046
- // area-weighted centroid lands mid-map (over Europe) — useless as a label
1047
- // anchor. Pin it to European Russia (~Volga) so a Europe view labels visible
1048
- // western Russia on its eastern margin; on a world view this still sits over
1049
- // Russian land. (See the curated-anchor smear-gate bypass in context-labels.)
1050
- RU: [45, 58]
1051
- };
1052
-
1053
1039
  // src/map/region-labels.ts
1054
1040
  function placeRegionLabels(args) {
1055
1041
  const {
@@ -1452,6 +1438,7 @@ function placeRegionLabels(args) {
1452
1438
  }
1453
1439
 
1454
1440
  // src/map/layout.ts
1441
+ var FIT_PAD = 24;
1455
1442
  var PATH_DIGITS = 1;
1456
1443
  var THIN_TOL = 0.6;
1457
1444
  var ALBERS_SKEW_MAX = 1.25;
@@ -1496,6 +1483,17 @@ var R_MIN = 4;
1496
1483
  var R_MAX = 22;
1497
1484
  var POI_FILL_OPACITY_MAX = 0.92;
1498
1485
  var POI_FILL_OPACITY_MIN = 0.55;
1486
+ var WORLD_LABEL_ANCHORS = {
1487
+ US: [-98.5, 39.5],
1488
+ // CONUS geographic centre (near Lebanon, Kansas)
1489
+ // Russia crosses the antimeridian (Chukotka at ~170°W), so on a non-global
1490
+ // (e.g. Europe) projection its geometry smears across the whole frame and the
1491
+ // area-weighted centroid lands mid-map (over Europe) — useless as a label
1492
+ // anchor. Pin it to European Russia (~Volga) so a Europe view labels visible
1493
+ // western Russia on its eastern margin; on a world view this still sits over
1494
+ // Russian land. (See the curated-anchor smear-gate bypass in context-labels.)
1495
+ RU: [45, 58]
1496
+ };
1499
1497
  var MAX_CLUSTER_EXTENT_FACTOR = 0.18;
1500
1498
  var MAX_COLUMN_ROWS = 7;
1501
1499
  var REGION_LABEL_HALO_RATIO = 4.5;
@@ -3365,4 +3363,4 @@ export {
3365
3363
  albersSkewFallback,
3366
3364
  layoutMap
3367
3365
  };
3368
- //# sourceMappingURL=chunk-6E5YZR4S.js.map
3366
+ //# sourceMappingURL=chunk-R7S5542V.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildMapProjection
3
- } from "./chunk-6E5YZR4S.js";
3
+ } from "./chunk-R7S5542V.js";
4
4
  import {
5
5
  TITLE_FONT_SIZE,
6
6
  TITLE_Y
@@ -51,4 +51,4 @@ export {
51
51
  mapContentAspect,
52
52
  mapExportDimensions
53
53
  };
54
- //# sourceMappingURL=chunk-PZOFMBF3.js.map
54
+ //# sourceMappingURL=chunk-X26BF4T2.js.map
@@ -1,4 +1,4 @@
1
- import { T as TagGroup, a as DgmoError, P as PaletteConfig, f as PaletteColors, C as CompactViewState } from './dgmo-router-Dd5PTjxl.js';
1
+ import { T as TagGroup, D as DgmoError, a as PaletteColors, C as CompactViewState } from './tag-groups-NUA2F1I5.js';
2
2
 
3
3
  /** A POI / route-stop position: gazetteer name (+ optional ISO scope) or coords. */
4
4
  type PoiPos = {
@@ -458,25 +458,6 @@ interface ResolvedMap {
458
458
  readonly error: string | null;
459
459
  }
460
460
 
461
- /**
462
- * All built-in palettes, keyed by camelCase id. Use directly with render():
463
- *
464
- * await render(text, { palette: palettes.catppuccin });
465
- *
466
- * For preference/settings storage, the `.id` field of each entry is the
467
- * canonical string (e.g. `'tokyo-night'`, `'nord'`) — that's the wire format
468
- * used by share URLs and the CLI `--palette` flag.
469
- */
470
- declare const palettes: {
471
- readonly atlas: PaletteConfig;
472
- readonly blueprint: PaletteConfig;
473
- readonly slate: PaletteConfig;
474
- readonly tidewater: PaletteConfig;
475
- readonly nord: PaletteConfig;
476
- readonly catppuccin: PaletteConfig;
477
- readonly tokyoNight: PaletteConfig;
478
- };
479
-
480
461
  /**
481
462
  * How a host supplies map basemap assets: the data itself, or a loader that
482
463
  * returns it. Declared here (rather than accepting only `MapData`) so a Node
@@ -512,120 +493,4 @@ type RenderForExportOptions = {
512
493
  };
513
494
  declare function renderForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors, viewState?: CompactViewState, options?: RenderForExportOptions): Promise<string>;
514
495
 
515
- interface MapPlaceCompletion {
516
- /** Canonical display name (original casing), e.g. `Portland`. */
517
- readonly name: string;
518
- /** Text to insert. ISO-qualified (`Portland US-OR`) iff the name is
519
- * ambiguous in the gazetteer; bare otherwise (disambiguate-once, §24B.8). */
520
- readonly insert: string;
521
- /** Menu label (`Portland — US-OR` when ambiguous, else `Portland`). */
522
- readonly label: string;
523
- /** Secondary detail, e.g. `US-OR · 652,503`. */
524
- readonly detail: string;
525
- readonly iso: string;
526
- readonly sub?: string;
527
- readonly pop: number;
528
- /** `'airport'` for IATA-code entries (icon/grouping affordance); absent or
529
- * `'city'` for gazetteer cities. Cities rank above airports for a shared
530
- * prefix so ~1500 codes never bury city names (ADR-5). */
531
- readonly kind?: 'city' | 'airport';
532
- }
533
- interface MapCompletionOptions {
534
- /** Max results (default 12). */
535
- readonly limit?: number;
536
- /** IATA-coded airports (`airports.json`). When supplied, airport codes
537
- * matching the prefix are offered as a second (post-city) group. Optional —
538
- * absent (old DI bundles / no asset) just yields city-only completions. */
539
- readonly airports?: AirportData;
540
- /** Resolver-inferred map scope (country `US` or subdivision `US-CA`). Biases
541
- * airport ranking so in-region airports sort above out-of-region same-prefix
542
- * ones (ADR-6). Pure rank, never a filter — cross-region airports still
543
- * appear. App passes the document's inferred scope in (Slice 2). */
544
- readonly scopeISO?: string;
545
- }
546
- /**
547
- * Prefix-match city names + alternate-name aliases against the gazetteer,
548
- * rank by population (desc; stable tie-break by gazetteer index), and emit
549
- * ISO-qualified insert text only for ambiguous (same-named) places.
550
- *
551
- * Pure + deterministic. Empty/blank query → `[]` (the caller gates min length).
552
- */
553
- declare function completeMapPlaces(query: string, gazetteer: Gazetteer, opts?: MapCompletionOptions): MapPlaceCompletion[];
554
- /** A POI search hit — a city or airport the resolver can resolve, with the
555
- * exact `token` to paste into DGMO (a `poi`/route endpoint). Powers the CLI
556
- * `dgmo map search` command and the MCP `lookup_map_location` tool, so authors
557
- * (and AI agents) can DISCOVER valid place tokens instead of guessing — e.g.
558
- * learn that "New York" must be `New York City` and that `JFK` is bundled. */
559
- interface MapLocationMatch {
560
- /** Canonical display name (cities) or full airport name. */
561
- readonly name: string;
562
- /** Exact text to use in DGMO. Cities: the name, ISO-qualified when ambiguous
563
- * (`Portland US-OR`). Airports: the upper-case IATA code (`JFK`). */
564
- readonly token: string;
565
- readonly kind: 'city' | 'airport';
566
- readonly iso: string;
567
- readonly sub?: string;
568
- /** City population (0 for airports). */
569
- readonly pop: number;
570
- /** Human detail, e.g. `US-OR · 652,503` or `Airport · John F Kennedy Intl`. */
571
- readonly detail: string;
572
- }
573
- /**
574
- * Substring-search cities + airports for a discovery surface (CLI / MCP), so an
575
- * author can find the exact token the resolver expects. Unlike
576
- * {@link completeMapPlaces} (prefix-only, editor type-ahead), this matches
577
- * anywhere in a city name OR an airport code/name, so "york" finds
578
- * `New York City` and "kennedy" finds `JFK`.
579
- *
580
- * Ranking: exact-name (or exact-IATA) → prefix → substring; within a tier,
581
- * cities by population desc (deterministic index tie-break), cities before
582
- * airports. Pure + deterministic. Empty query → `[]`.
583
- */
584
- declare function searchMapLocations(query: string, gazetteer: Gazetteer, opts?: {
585
- readonly limit?: number;
586
- readonly airports?: AirportData;
587
- }): MapLocationMatch[];
588
- interface MapRegionCompletion {
589
- /** Display name = insert text (the resolver disambiguates cross-layer
590
- * collisions like Georgia by map scope, §24B.8). */
591
- readonly name: string;
592
- /** ISO 3166-1/3166-2 id. */
593
- readonly iso: string;
594
- readonly layer: 'country' | 'us-state';
595
- /** Secondary detail, e.g. `US state · US-CA` or `Country · DE`. */
596
- readonly detail: string;
597
- }
598
- /**
599
- * Prefix-match fill-able region names (countries + US states) for region-fill
600
- * lines. Matches the folded display name OR the ISO code; deterministic
601
- * (alphabetical by name, then layer). Pure. Empty query → `[]`.
602
- *
603
- * `regions` is injected (the `region-names.json` asset, shipped in dist/map-data
604
- * alongside the gazetteer). Cross-layer same-name (Georgia: country GE + state
605
- * US-GA) yields both entries, distinguished by `detail`.
606
- */
607
- declare function completeMapRegions(query: string, regions: readonly RegionName[], opts?: MapCompletionOptions): MapRegionCompletion[];
608
-
609
- /**
610
- * Theme — render mode flag. Selects which palette variant the renderer uses
611
- * for background and text:
612
- * - 'light' → palette.light colors
613
- * - 'dark' → palette.dark colors
614
- * - 'transparent' → no background fill (for embedding in colored containers)
615
- */
616
- type Theme = 'light' | 'dark' | 'transparent';
617
- /**
618
- * `themes` namespace — use with render() options for a typed handle:
619
- *
620
- * await render(text, { theme: themes.dark });
621
- *
622
- * Passing the raw string `'dark'` also works (the underlying type is the
623
- * string-literal union); the namespace is the conventional path.
624
- */
625
- declare const themes: {
626
- readonly light: "light";
627
- readonly dark: "dark";
628
- readonly transparent: "transparent";
629
- };
630
-
631
- export { type AirportData as A, type BoundaryTopology as B, renderForExport as C, type Gazetteer as G, type MapDataSource as M, type ParsedMap as P, type RegionName as R, type Theme as T, type GazetteerEntry as a, type MapCompletionOptions as b, type MapData as c, type MapLocationMatch as d, type MapPlaceCompletion as e, type MapRegionCompletion as f, type RegionNames as g, completeMapPlaces as h, completeMapRegions as i, type ResolvedMap as j, type MapLayoutLegend as k, type GeoExtent as l, type MapDirectives as m, type MapEdge as n, type MapPoi as o, palettes as p, type MapRegion as q, type MapRoute as r, searchMapLocations as s, themes as t, type PoiPos as u, type ProjectionFamily as v, type ResolvedEdge as w, type ResolvedPoi as x, type ResolvedRegion as y, type ResolvedRoute as z };
496
+ export { type AirportData as A, type BoundaryTopology as B, type Gazetteer as G, type MapDataSource as M, type ParsedMap as P, type RegionName as R, type GazetteerEntry as a, type MapData as b, type RegionNames as c, type ResolvedMap as d, type MapLayoutLegend as e, type GeoExtent as f, type MapDirectives as g, type MapEdge as h, type MapPoi as i, type MapRegion as j, type MapRoute as k, type PoiPos as l, type ProjectionFamily as m, type ResolvedEdge as n, type ResolvedPoi as o, type ResolvedRegion as p, type ResolvedRoute as q, renderForExport as r };
@@ -1,264 +1,4 @@
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
- * Compact view state schema (ADR-6).
63
- * All fields optional. Only non-default values are encoded.
64
- * `tag: null` means "user chose none"; absent `tag` means "use DSL default" (ADR-5).
65
- */
66
- interface CompactViewState {
67
- tag?: string | null;
68
- cs?: number[];
69
- cg?: string[];
70
- swim?: string | null;
71
- cl?: string[];
72
- cc?: string[];
73
- rm?: string;
74
- htv?: Record<string, string[]>;
75
- ha?: string[];
76
- sem?: boolean;
77
- cm?: boolean;
78
- c4l?: string;
79
- c4s?: string;
80
- c4c?: string;
81
- rps?: number;
82
- spd?: number;
83
- io?: Record<string, number>;
84
- hd?: boolean;
85
- cbd?: boolean;
86
- rq?: string;
87
- an?: boolean;
88
- fl?: boolean;
89
- }
90
- interface DecodedDiagramUrl {
91
- dsl: string;
92
- viewState: CompactViewState;
93
- palette?: string;
94
- theme?: 'light' | 'dark';
95
- filename?: string;
96
- }
97
- interface EncodeDiagramUrlOptions {
98
- baseUrl?: string;
99
- viewState?: CompactViewState;
100
- palette?: string;
101
- theme?: 'light' | 'dark';
102
- filename?: string;
103
- }
104
- type EncodeDiagramUrlResult = {
105
- url: string;
106
- error?: undefined;
107
- } | {
108
- url?: undefined;
109
- error: 'too-large';
110
- compressedSize: number;
111
- limit: number;
112
- };
113
- /**
114
- * Encode a CompactViewState to a compressed string for URL embedding.
115
- * Returns empty string if state has no keys (ADR-4).
116
- */
117
- declare function encodeViewState(state: CompactViewState): string;
118
- /**
119
- * Decode a compressed view state string back to CompactViewState.
120
- * Returns empty object on failure (no crash).
121
- */
122
- declare function decodeViewState(encoded: string): CompactViewState;
123
- /**
124
- * Compress a DGMO DSL string into a shareable URL.
125
- * Returns `{ url }` on success, or `{ error: 'too-large', compressedSize, limit }` if the
126
- * compressed payload exceeds the 8 KB limit.
127
- */
128
- declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions): EncodeDiagramUrlResult;
129
- /**
130
- * Decode a DGMO DSL string and view state from a URL query string or hash.
131
- * Accepts any of:
132
- * - `?dgmo=<payload>&vs=<state>`
133
- * - `#dgmo=<payload>&vs=<state>` (backwards compat)
134
- * - `dgmo=<payload>`
135
- * - `<bare payload>`
136
- *
137
- * Returns `{ dsl, viewState }`. The DSL is empty string on invalid input.
138
- */
139
- declare function decodeDiagramUrl(hash: string): DecodedDiagramUrl;
140
-
141
- /**
142
- * Color definitions for a single mode (light or dark).
143
- * 10 semantic UI colors + 9 named accent colors = 19 total.
144
- *
145
- * `readonly` on every field (and the nested `colors` map) by design —
146
- * palettes flow from the registry into every renderer; nothing in the
147
- * pipeline should ever mutate a palette in place.
148
- */
149
- interface PaletteColors {
150
- /** Main background (#eceff4 light / #2e3440 dark for Nord) */
151
- readonly bg: string;
152
- /** Cards, panels (#e5e9f0 / #3b4252) */
153
- readonly surface: string;
154
- /** Popovers, dropdowns (#e5e9f0 / #434c5e) */
155
- readonly overlay: string;
156
- /** Borders, dividers, muted (#d8dee9 / #4c566a) */
157
- readonly border: string;
158
- /** Primary text (#2e3440 / #eceff4) */
159
- readonly text: string;
160
- /** Secondary/diminished text (#4c566a / #d8dee9) */
161
- readonly textMuted: string;
162
- /**
163
- * Light-mode arg for `contrastText()` when text is rendered on a
164
- * tinted shape fill (e.g. `shapeFill()` output). Must guarantee
165
- * ≥ 4.5:1 WCAG AA against any `shapeFill()` the palette can produce.
166
- * Distinct from `colors.white` because palette-aesthetic anchors don't
167
- * always meet contrast requirements (TD-5).
168
- */
169
- readonly textOnFillLight: string;
170
- /** Dark-mode counterpart to `textOnFillLight`. */
171
- readonly textOnFillDark: string;
172
- /** Primary accent — buttons, links */
173
- readonly primary: string;
174
- /** Secondary accent */
175
- readonly secondary: string;
176
- /** Tertiary accent */
177
- readonly accent: string;
178
- /** Error/danger */
179
- readonly destructive: string;
180
- /**
181
- * Used for: inline annotations (red), pie charts, cScale,
182
- * series rotation, journey actors, Gantt tasks.
183
- */
184
- readonly colors: {
185
- readonly red: string;
186
- readonly orange: string;
187
- readonly yellow: string;
188
- readonly green: string;
189
- readonly blue: string;
190
- readonly purple: string;
191
- readonly teal: string;
192
- readonly cyan: string;
193
- readonly gray: string;
194
- readonly black: string;
195
- readonly white: string;
196
- };
197
- }
198
- /**
199
- * Complete palette definition. One object per color scheme.
200
- * This is what palette authors create — the single artifact for NFR1.
201
- *
202
- * Palettes are immutable from the consumer's perspective; the registry
203
- * hands out the same frozen-shape object on every `getPalette(id)`.
204
- */
205
- interface PaletteConfig {
206
- /** Registry key: 'nord', 'slate', 'catppuccin' */
207
- readonly id: string;
208
- /** Display name: 'Nord', 'Slate', 'Catppuccin' */
209
- readonly name: string;
210
- /** Light mode color definitions */
211
- readonly light: PaletteColors;
212
- /** Dark mode color definitions */
213
- readonly dark: PaletteColors;
214
- }
215
-
216
- /** A single entry inside a tag group: `Value color` */
217
- interface TagEntry {
218
- readonly value: string;
219
- readonly color: string;
220
- /**
221
- * The color NAME the author wrote (one of the recognized palette names),
222
- * when the entry declared an explicit color. Absent for bare/auto-colored
223
- * entries. `color` above is always the RESOLVED hex (auto and explicit are
224
- * indistinguishable there); this preserves the authored-vs-auto distinction
225
- * so a GUI editor can round-trip an explicit color through a reparse.
226
- */
227
- readonly authoredColor?: string;
228
- readonly lineNumber: number;
229
- }
230
- /**
231
- * A tag group block: heading + entries.
232
- *
233
- * Parser internals build via `Writable<TagGroup>` from `utils/brand.ts`;
234
- * once returned to a chart-type parser, consumers see the readonly view.
235
- */
236
- interface TagGroup {
237
- readonly name: string;
238
- readonly alias?: string;
239
- readonly entries: readonly TagEntry[];
240
- /** Default value for nodes without explicit metadata. First entry unless another is marked `default`. */
241
- readonly defaultValue?: string;
242
- readonly lineNumber: number;
243
- }
244
- /**
245
- * DOM-safe key for a tag group — used wherever the group name becomes a
246
- * `data-tag-*` attribute suffix, an entity metadata key, or an `active-tag`
247
- * match target. For a single-identifier name (the only form the parser used to
248
- * accept) this is exactly `name.toLowerCase()`, so swapping it in for existing
249
- * diagrams is byte-identical. A quoted multi-word name (`tag "Trust Zone" as tz`)
250
- * slugs to a hyphenated identifier (`trust-zone`) so it never produces an
251
- * invalid DOM attribute name; the original `name` is kept for the legend label.
252
- */
253
- declare function tagAttrKey(name: string): string;
254
- /**
255
- * The categorical name cycle used to auto-assign colors to bare tag values,
256
- * in deterministic order. Aliased to the shared {@link CATEGORICAL_COLOR_ORDER}
257
- * (RGB-seeded, max-contrast, neutrals excluded) so tag swatches and data-chart
258
- * series colors share one canonical rotation. If a group has more colorless
259
- * entries than free categorical names, the cycle wraps.
260
- */
261
- declare const autoTagColorCycle: readonly string[];
1
+ import { P as PaletteConfig, D as DgmoError } from './tag-groups-NUA2F1I5.js';
262
2
 
263
3
  /** Validate that a hex string is well-formed (#RGB or #RRGGBB). */
264
4
  declare function isValidHex(value: string): boolean;
@@ -537,4 +277,4 @@ declare function parseDgmo(content: string): {
537
277
  chartType: string | null;
538
278
  };
539
279
 
540
- export { isExtendedChartType as A, isValidHex as B, type CompactViewState as C, type DiagnosticSpec as D, type EmitOptions as E, knownChartTypeIds as F, makeDgmoError as G, parseDgmoChartType as H, registerPalette as I, tagAttrKey as J, type PaletteConfig as P, type RenderCategory as R, type TagGroup as T, type DgmoError as a, type ChartTypeId as b, type ChartTypeMeta as c, type DgmoSeverity as d, type DiagnosticParams as e, type PaletteColors as f, chartTypes as g, emit as h, formatDgmoError as i, getPalette as j, type TagEntry as k, CHART_TYPE_DESCRIPTIONS as l, type DecodedDiagramUrl as m, type EncodeDiagramUrlOptions as n, type EncodeDiagramUrlResult as o, parseDgmo as p, autoTagColorCycle as q, resolvePaletteOrFallback as r, chartTypeParsers as s, decodeDiagramUrl as t, decodeViewState as u, encodeDiagramUrl as v, encodeViewState as w, getAllChartTypes as x, getAvailablePalettes as y, getRenderCategory as z };
280
+ export { type ChartTypeId as C, type RenderCategory as R, type ChartTypeMeta as a, CHART_TYPE_DESCRIPTIONS as b, chartTypes as c, chartTypeParsers as d, getAllChartTypes as e, getAvailablePalettes as f, getPalette as g, getRenderCategory as h, isExtendedChartType as i, isValidHex as j, knownChartTypeIds as k, parseDgmoChartType as l, registerPalette as m, parseDgmo as p, resolvePaletteOrFallback as r };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  mapContentAspect,
3
3
  mapExportDimensions
4
- } from "./chunk-PZOFMBF3.js";
5
- import "./chunk-6E5YZR4S.js";
4
+ } from "./chunk-X26BF4T2.js";
5
+ import "./chunk-R7S5542V.js";
6
6
  import "./chunk-4QV26TEG.js";
7
7
  import "./chunk-L65WI4HO.js";
8
8
  import "./chunk-A4GOY3PE.js";
@@ -19,4 +19,4 @@ export {
19
19
  mapContentAspect,
20
20
  mapExportDimensions
21
21
  };
22
- //# sourceMappingURL=dimensions-ILAVBRQ3.js.map
22
+ //# sourceMappingURL=dimensions-RD3Y7FCF.js.map
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
- import { D as DiagnosticSpec, P as PaletteConfig, C as CompactViewState, a as DgmoError } from './dgmo-router-Dd5PTjxl.js';
2
- export { b as ChartTypeId, c as ChartTypeMeta, d as DgmoSeverity, e as DiagnosticParams, E as EmitOptions, f as PaletteColors, g as chartTypes, h as emit, i as formatDgmoError, j as getPalette, r as resolvePaletteOrFallback, p as validate } from './dgmo-router-Dd5PTjxl.js';
3
- import { T as Theme, M as MapDataSource } from './themes-DiUAG4Bf.js';
4
- export { G as Gazetteer, a as GazetteerEntry, b as MapCompletionOptions, c as MapData, d as MapLocationMatch, e as MapPlaceCompletion, f as MapRegionCompletion, R as RegionName, g as RegionNames, h as completeMapPlaces, i as completeMapRegions, p as palettes, s as searchMapLocations, t as themes } from './themes-DiUAG4Bf.js';
1
+ import { b as DiagnosticSpec, P as PaletteConfig, C as CompactViewState, D as DgmoError } from './tag-groups-NUA2F1I5.js';
2
+ export { c as DgmoSeverity, d as DiagnosticParams, E as EmitOptions, a as PaletteColors, e as emit, f as formatDgmoError } from './tag-groups-NUA2F1I5.js';
3
+ export { C as ChartTypeId, a as ChartTypeMeta, c as chartTypes, g as getPalette, r as resolvePaletteOrFallback, p as validate } from './dgmo-router-EAW7XiBE.js';
4
+ import { T as Theme } from './themes-Dem5xalq.js';
5
+ export { M as MapCompletionOptions, a as MapLocationMatch, b as MapPlaceCompletion, c as MapRegionCompletion, d as completeMapPlaces, e as completeMapRegions, p as palettes, s as searchMapLocations, t as themes } from './themes-Dem5xalq.js';
6
+ import { M as MapDataSource } from './d3-Bfhj-XBX.js';
7
+ export { G as Gazetteer, a as GazetteerEntry, b as MapData, R as RegionName, c as RegionNames } from './d3-Bfhj-XBX.js';
5
8
 
6
9
  /**
7
10
  * Make an SVG produced by `@diagrammo/dgmo`'s static `render()` suitable for
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-SQAG3UXH.js";
12
12
  import {
13
13
  render
14
- } from "./chunk-ZZXPYVS4.js";
14
+ } from "./chunk-3OT63FS4.js";
15
15
  import {
16
16
  renderErrorCard
17
17
  } from "./chunk-7L53J53J.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  renderMap,
3
3
  renderMapForExport
4
- } from "./chunk-QRWY5QTA.js";
4
+ } from "./chunk-O274UTXH.js";
5
5
  import "./chunk-FWVKPEG3.js";
6
- import "./chunk-6E5YZR4S.js";
6
+ import "./chunk-R7S5542V.js";
7
7
  import "./chunk-4QV26TEG.js";
8
8
  import "./chunk-L65WI4HO.js";
9
9
  import "./chunk-A4GOY3PE.js";
@@ -24,4 +24,4 @@ export {
24
24
  renderMap,
25
25
  renderMapForExport
26
26
  };
27
- //# sourceMappingURL=renderer-AOFIEF2T.js.map
27
+ //# sourceMappingURL=renderer-T66477EQ.js.map
@@ -0,0 +1,263 @@
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
+ * Compact view state schema (ADR-6).
63
+ * All fields optional. Only non-default values are encoded.
64
+ * `tag: null` means "user chose none"; absent `tag` means "use DSL default" (ADR-5).
65
+ */
66
+ interface CompactViewState {
67
+ tag?: string | null;
68
+ cs?: number[];
69
+ cg?: string[];
70
+ swim?: string | null;
71
+ cl?: string[];
72
+ cc?: string[];
73
+ rm?: string;
74
+ htv?: Record<string, string[]>;
75
+ ha?: string[];
76
+ sem?: boolean;
77
+ cm?: boolean;
78
+ c4l?: string;
79
+ c4s?: string;
80
+ c4c?: string;
81
+ rps?: number;
82
+ spd?: number;
83
+ io?: Record<string, number>;
84
+ hd?: boolean;
85
+ cbd?: boolean;
86
+ rq?: string;
87
+ an?: boolean;
88
+ fl?: boolean;
89
+ }
90
+ interface DecodedDiagramUrl {
91
+ dsl: string;
92
+ viewState: CompactViewState;
93
+ palette?: string;
94
+ theme?: 'light' | 'dark';
95
+ filename?: string;
96
+ }
97
+ interface EncodeDiagramUrlOptions {
98
+ baseUrl?: string;
99
+ viewState?: CompactViewState;
100
+ palette?: string;
101
+ theme?: 'light' | 'dark';
102
+ filename?: string;
103
+ }
104
+ type EncodeDiagramUrlResult = {
105
+ url: string;
106
+ error?: undefined;
107
+ } | {
108
+ url?: undefined;
109
+ error: 'too-large';
110
+ compressedSize: number;
111
+ limit: number;
112
+ };
113
+ /**
114
+ * Encode a CompactViewState to a compressed string for URL embedding.
115
+ * Returns empty string if state has no keys (ADR-4).
116
+ */
117
+ declare function encodeViewState(state: CompactViewState): string;
118
+ /**
119
+ * Decode a compressed view state string back to CompactViewState.
120
+ * Returns empty object on failure (no crash).
121
+ */
122
+ declare function decodeViewState(encoded: string): CompactViewState;
123
+ /**
124
+ * Compress a DGMO DSL string into a shareable URL.
125
+ * Returns `{ url }` on success, or `{ error: 'too-large', compressedSize, limit }` if the
126
+ * compressed payload exceeds the 8 KB limit.
127
+ */
128
+ declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions): EncodeDiagramUrlResult;
129
+ /**
130
+ * Decode a DGMO DSL string and view state from a URL query string or hash.
131
+ * Accepts any of:
132
+ * - `?dgmo=<payload>&vs=<state>`
133
+ * - `#dgmo=<payload>&vs=<state>` (backwards compat)
134
+ * - `dgmo=<payload>`
135
+ * - `<bare payload>`
136
+ *
137
+ * Returns `{ dsl, viewState }`. The DSL is empty string on invalid input.
138
+ */
139
+ declare function decodeDiagramUrl(hash: string): DecodedDiagramUrl;
140
+
141
+ /**
142
+ * Color definitions for a single mode (light or dark).
143
+ * 10 semantic UI colors + 9 named accent colors = 19 total.
144
+ *
145
+ * `readonly` on every field (and the nested `colors` map) by design —
146
+ * palettes flow from the registry into every renderer; nothing in the
147
+ * pipeline should ever mutate a palette in place.
148
+ */
149
+ interface PaletteColors {
150
+ /** Main background (#eceff4 light / #2e3440 dark for Nord) */
151
+ readonly bg: string;
152
+ /** Cards, panels (#e5e9f0 / #3b4252) */
153
+ readonly surface: string;
154
+ /** Popovers, dropdowns (#e5e9f0 / #434c5e) */
155
+ readonly overlay: string;
156
+ /** Borders, dividers, muted (#d8dee9 / #4c566a) */
157
+ readonly border: string;
158
+ /** Primary text (#2e3440 / #eceff4) */
159
+ readonly text: string;
160
+ /** Secondary/diminished text (#4c566a / #d8dee9) */
161
+ readonly textMuted: string;
162
+ /**
163
+ * Light-mode arg for `contrastText()` when text is rendered on a
164
+ * tinted shape fill (e.g. `shapeFill()` output). Must guarantee
165
+ * ≥ 4.5:1 WCAG AA against any `shapeFill()` the palette can produce.
166
+ * Distinct from `colors.white` because palette-aesthetic anchors don't
167
+ * always meet contrast requirements (TD-5).
168
+ */
169
+ readonly textOnFillLight: string;
170
+ /** Dark-mode counterpart to `textOnFillLight`. */
171
+ readonly textOnFillDark: string;
172
+ /** Primary accent — buttons, links */
173
+ readonly primary: string;
174
+ /** Secondary accent */
175
+ readonly secondary: string;
176
+ /** Tertiary accent */
177
+ readonly accent: string;
178
+ /** Error/danger */
179
+ readonly destructive: string;
180
+ /**
181
+ * Used for: inline annotations (red), pie charts, cScale,
182
+ * series rotation, journey actors, Gantt tasks.
183
+ */
184
+ readonly colors: {
185
+ readonly red: string;
186
+ readonly orange: string;
187
+ readonly yellow: string;
188
+ readonly green: string;
189
+ readonly blue: string;
190
+ readonly purple: string;
191
+ readonly teal: string;
192
+ readonly cyan: string;
193
+ readonly gray: string;
194
+ readonly black: string;
195
+ readonly white: string;
196
+ };
197
+ }
198
+ /**
199
+ * Complete palette definition. One object per color scheme.
200
+ * This is what palette authors create — the single artifact for NFR1.
201
+ *
202
+ * Palettes are immutable from the consumer's perspective; the registry
203
+ * hands out the same frozen-shape object on every `getPalette(id)`.
204
+ */
205
+ interface PaletteConfig {
206
+ /** Registry key: 'nord', 'slate', 'catppuccin' */
207
+ readonly id: string;
208
+ /** Display name: 'Nord', 'Slate', 'Catppuccin' */
209
+ readonly name: string;
210
+ /** Light mode color definitions */
211
+ readonly light: PaletteColors;
212
+ /** Dark mode color definitions */
213
+ readonly dark: PaletteColors;
214
+ }
215
+
216
+ /** A single entry inside a tag group: `Value color` */
217
+ interface TagEntry {
218
+ readonly value: string;
219
+ readonly color: string;
220
+ /**
221
+ * The color NAME the author wrote (one of the recognized palette names),
222
+ * when the entry declared an explicit color. Absent for bare/auto-colored
223
+ * entries. `color` above is always the RESOLVED hex (auto and explicit are
224
+ * indistinguishable there); this preserves the authored-vs-auto distinction
225
+ * so a GUI editor can round-trip an explicit color through a reparse.
226
+ */
227
+ readonly authoredColor?: string;
228
+ readonly lineNumber: number;
229
+ }
230
+ /**
231
+ * A tag group block: heading + entries.
232
+ *
233
+ * Parser internals build via `Writable<TagGroup>` from `utils/brand.ts`;
234
+ * once returned to a chart-type parser, consumers see the readonly view.
235
+ */
236
+ interface TagGroup {
237
+ readonly name: string;
238
+ readonly alias?: string;
239
+ readonly entries: readonly TagEntry[];
240
+ /** Default value for nodes without explicit metadata. First entry unless another is marked `default`. */
241
+ readonly defaultValue?: string;
242
+ readonly lineNumber: number;
243
+ }
244
+ /**
245
+ * DOM-safe key for a tag group — used wherever the group name becomes a
246
+ * `data-tag-*` attribute suffix, an entity metadata key, or an `active-tag`
247
+ * match target. For a single-identifier name (the only form the parser used to
248
+ * accept) this is exactly `name.toLowerCase()`, so swapping it in for existing
249
+ * diagrams is byte-identical. A quoted multi-word name (`tag "Trust Zone" as tz`)
250
+ * slugs to a hyphenated identifier (`trust-zone`) so it never produces an
251
+ * invalid DOM attribute name; the original `name` is kept for the legend label.
252
+ */
253
+ declare function tagAttrKey(name: string): string;
254
+ /**
255
+ * The categorical name cycle used to auto-assign colors to bare tag values,
256
+ * in deterministic order. Aliased to the shared {@link CATEGORICAL_COLOR_ORDER}
257
+ * (RGB-seeded, max-contrast, neutrals excluded) so tag swatches and data-chart
258
+ * series colors share one canonical rotation. If a group has more colorless
259
+ * entries than free categorical names, the cycle wraps.
260
+ */
261
+ declare const autoTagColorCycle: readonly string[];
262
+
263
+ export { type CompactViewState as C, type DgmoError as D, type EmitOptions as E, type PaletteConfig as P, type TagGroup as T, type PaletteColors as a, type DiagnosticSpec as b, type DgmoSeverity as c, type DiagnosticParams as d, emit as e, formatDgmoError as f, type TagEntry as g, type DecodedDiagramUrl as h, type EncodeDiagramUrlOptions as i, type EncodeDiagramUrlResult as j, autoTagColorCycle as k, decodeDiagramUrl as l, decodeViewState as m, encodeDiagramUrl as n, encodeViewState as o, makeDgmoError as p, tagAttrKey as t };
@@ -0,0 +1,139 @@
1
+ import { P as PaletteConfig } from './tag-groups-NUA2F1I5.js';
2
+ import { A as AirportData, G as Gazetteer, R as RegionName } from './d3-Bfhj-XBX.js';
3
+
4
+ /**
5
+ * All built-in palettes, keyed by camelCase id. Use directly with render():
6
+ *
7
+ * await render(text, { palette: palettes.catppuccin });
8
+ *
9
+ * For preference/settings storage, the `.id` field of each entry is the
10
+ * canonical string (e.g. `'tokyo-night'`, `'nord'`) — that's the wire format
11
+ * used by share URLs and the CLI `--palette` flag.
12
+ */
13
+ declare const palettes: {
14
+ readonly atlas: PaletteConfig;
15
+ readonly blueprint: PaletteConfig;
16
+ readonly slate: PaletteConfig;
17
+ readonly tidewater: PaletteConfig;
18
+ readonly nord: PaletteConfig;
19
+ readonly catppuccin: PaletteConfig;
20
+ readonly tokyoNight: PaletteConfig;
21
+ };
22
+
23
+ interface MapPlaceCompletion {
24
+ /** Canonical display name (original casing), e.g. `Portland`. */
25
+ readonly name: string;
26
+ /** Text to insert. ISO-qualified (`Portland US-OR`) iff the name is
27
+ * ambiguous in the gazetteer; bare otherwise (disambiguate-once, §24B.8). */
28
+ readonly insert: string;
29
+ /** Menu label (`Portland — US-OR` when ambiguous, else `Portland`). */
30
+ readonly label: string;
31
+ /** Secondary detail, e.g. `US-OR · 652,503`. */
32
+ readonly detail: string;
33
+ readonly iso: string;
34
+ readonly sub?: string;
35
+ readonly pop: number;
36
+ /** `'airport'` for IATA-code entries (icon/grouping affordance); absent or
37
+ * `'city'` for gazetteer cities. Cities rank above airports for a shared
38
+ * prefix so ~1500 codes never bury city names (ADR-5). */
39
+ readonly kind?: 'city' | 'airport';
40
+ }
41
+ interface MapCompletionOptions {
42
+ /** Max results (default 12). */
43
+ readonly limit?: number;
44
+ /** IATA-coded airports (`airports.json`). When supplied, airport codes
45
+ * matching the prefix are offered as a second (post-city) group. Optional —
46
+ * absent (old DI bundles / no asset) just yields city-only completions. */
47
+ readonly airports?: AirportData;
48
+ /** Resolver-inferred map scope (country `US` or subdivision `US-CA`). Biases
49
+ * airport ranking so in-region airports sort above out-of-region same-prefix
50
+ * ones (ADR-6). Pure rank, never a filter — cross-region airports still
51
+ * appear. App passes the document's inferred scope in (Slice 2). */
52
+ readonly scopeISO?: string;
53
+ }
54
+ /**
55
+ * Prefix-match city names + alternate-name aliases against the gazetteer,
56
+ * rank by population (desc; stable tie-break by gazetteer index), and emit
57
+ * ISO-qualified insert text only for ambiguous (same-named) places.
58
+ *
59
+ * Pure + deterministic. Empty/blank query → `[]` (the caller gates min length).
60
+ */
61
+ declare function completeMapPlaces(query: string, gazetteer: Gazetteer, opts?: MapCompletionOptions): MapPlaceCompletion[];
62
+ /** A POI search hit — a city or airport the resolver can resolve, with the
63
+ * exact `token` to paste into DGMO (a `poi`/route endpoint). Powers the CLI
64
+ * `dgmo map search` command and the MCP `lookup_map_location` tool, so authors
65
+ * (and AI agents) can DISCOVER valid place tokens instead of guessing — e.g.
66
+ * learn that "New York" must be `New York City` and that `JFK` is bundled. */
67
+ interface MapLocationMatch {
68
+ /** Canonical display name (cities) or full airport name. */
69
+ readonly name: string;
70
+ /** Exact text to use in DGMO. Cities: the name, ISO-qualified when ambiguous
71
+ * (`Portland US-OR`). Airports: the upper-case IATA code (`JFK`). */
72
+ readonly token: string;
73
+ readonly kind: 'city' | 'airport';
74
+ readonly iso: string;
75
+ readonly sub?: string;
76
+ /** City population (0 for airports). */
77
+ readonly pop: number;
78
+ /** Human detail, e.g. `US-OR · 652,503` or `Airport · John F Kennedy Intl`. */
79
+ readonly detail: string;
80
+ }
81
+ /**
82
+ * Substring-search cities + airports for a discovery surface (CLI / MCP), so an
83
+ * author can find the exact token the resolver expects. Unlike
84
+ * {@link completeMapPlaces} (prefix-only, editor type-ahead), this matches
85
+ * anywhere in a city name OR an airport code/name, so "york" finds
86
+ * `New York City` and "kennedy" finds `JFK`.
87
+ *
88
+ * Ranking: exact-name (or exact-IATA) → prefix → substring; within a tier,
89
+ * cities by population desc (deterministic index tie-break), cities before
90
+ * airports. Pure + deterministic. Empty query → `[]`.
91
+ */
92
+ declare function searchMapLocations(query: string, gazetteer: Gazetteer, opts?: {
93
+ readonly limit?: number;
94
+ readonly airports?: AirportData;
95
+ }): MapLocationMatch[];
96
+ interface MapRegionCompletion {
97
+ /** Display name = insert text (the resolver disambiguates cross-layer
98
+ * collisions like Georgia by map scope, §24B.8). */
99
+ readonly name: string;
100
+ /** ISO 3166-1/3166-2 id. */
101
+ readonly iso: string;
102
+ readonly layer: 'country' | 'us-state';
103
+ /** Secondary detail, e.g. `US state · US-CA` or `Country · DE`. */
104
+ readonly detail: string;
105
+ }
106
+ /**
107
+ * Prefix-match fill-able region names (countries + US states) for region-fill
108
+ * lines. Matches the folded display name OR the ISO code; deterministic
109
+ * (alphabetical by name, then layer). Pure. Empty query → `[]`.
110
+ *
111
+ * `regions` is injected (the `region-names.json` asset, shipped in dist/map-data
112
+ * alongside the gazetteer). Cross-layer same-name (Georgia: country GE + state
113
+ * US-GA) yields both entries, distinguished by `detail`.
114
+ */
115
+ declare function completeMapRegions(query: string, regions: readonly RegionName[], opts?: MapCompletionOptions): MapRegionCompletion[];
116
+
117
+ /**
118
+ * Theme — render mode flag. Selects which palette variant the renderer uses
119
+ * for background and text:
120
+ * - 'light' → palette.light colors
121
+ * - 'dark' → palette.dark colors
122
+ * - 'transparent' → no background fill (for embedding in colored containers)
123
+ */
124
+ type Theme = 'light' | 'dark' | 'transparent';
125
+ /**
126
+ * `themes` namespace — use with render() options for a typed handle:
127
+ *
128
+ * await render(text, { theme: themes.dark });
129
+ *
130
+ * Passing the raw string `'dark'` also works (the underlying type is the
131
+ * string-literal union); the namespace is the conventional path.
132
+ */
133
+ declare const themes: {
134
+ readonly light: "light";
135
+ readonly dark: "dark";
136
+ readonly transparent: "transparent";
137
+ };
138
+
139
+ export { type MapCompletionOptions as M, type Theme as T, type MapLocationMatch as a, type MapPlaceCompletion as b, type MapRegionCompletion as c, completeMapPlaces as d, completeMapRegions as e, palettes as p, searchMapLocations as s, themes as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagrammo/dgmo",
3
- "version": "0.65.0",
3
+ "version": "0.66.0",
4
4
  "description": "DGMO diagram markup language — parser, renderer, and color system",
5
5
  "license": "MIT",
6
6
  "author": "Diagrammo LLC",