@diagrammo/dgmo 0.21.1 → 0.23.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.
Files changed (87) hide show
  1. package/README.md +16 -6
  2. package/dist/advanced.cjs +2230 -503
  3. package/dist/advanced.d.cts +5731 -0
  4. package/dist/advanced.d.ts +5731 -0
  5. package/dist/advanced.js +2226 -503
  6. package/dist/auto.cjs +2272 -479
  7. package/dist/auto.d.cts +39 -0
  8. package/dist/auto.d.ts +39 -0
  9. package/dist/auto.js +124 -124
  10. package/dist/auto.mjs +2274 -480
  11. package/dist/cli.cjs +170 -170
  12. package/dist/editor.cjs +16 -16
  13. package/dist/editor.js +16 -16
  14. package/dist/highlight.cjs +18 -13
  15. package/dist/highlight.js +18 -13
  16. package/dist/index.cjs +2253 -465
  17. package/dist/index.d.cts +339 -0
  18. package/dist/index.d.ts +339 -0
  19. package/dist/index.js +2255 -466
  20. package/dist/internal.cjs +2230 -503
  21. package/dist/internal.d.cts +5731 -0
  22. package/dist/internal.d.ts +5731 -0
  23. package/dist/internal.js +2226 -503
  24. package/dist/map-data/PROVENANCE.json +1 -1
  25. package/dist/map-data/gazetteer.json +1 -1
  26. package/dist/map-data/mountain-ranges.json +1 -1
  27. package/dist/map-data/water-bodies.json +1 -0
  28. package/dist/map-data/world-coarse.json +1 -1
  29. package/dist/map-data/world-detail.json +1 -1
  30. package/docs/language-reference.md +55 -9
  31. package/gallery/fixtures/boxes-and-lines.dgmo +6 -4
  32. package/gallery/fixtures/map-categorical-world.dgmo +16 -0
  33. package/gallery/fixtures/map-categorical.dgmo +0 -1
  34. package/gallery/fixtures/map-choropleth.dgmo +0 -1
  35. package/gallery/fixtures/map-coastline.dgmo +7 -0
  36. package/gallery/fixtures/map-colorize.dgmo +11 -0
  37. package/gallery/fixtures/map-direct-color.dgmo +0 -1
  38. package/gallery/fixtures/map-reference-world.dgmo +11 -0
  39. package/gallery/fixtures/map-region-scope.dgmo +0 -3
  40. package/gallery/fixtures/map-route.dgmo +0 -1
  41. package/package.json +1 -1
  42. package/src/advanced.ts +12 -1
  43. package/src/boxes-and-lines/parser.ts +39 -0
  44. package/src/boxes-and-lines/renderer.ts +205 -20
  45. package/src/boxes-and-lines/types.ts +9 -0
  46. package/src/cli.ts +1 -1
  47. package/src/completion.ts +36 -30
  48. package/src/cycle/renderer.ts +14 -1
  49. package/src/d3.ts +20 -6
  50. package/src/editor/highlight-api.ts +4 -0
  51. package/src/editor/keywords.ts +16 -16
  52. package/src/infra/renderer.ts +35 -7
  53. package/src/map/colorize.ts +54 -0
  54. package/src/map/context-labels.ts +429 -0
  55. package/src/map/data/PROVENANCE.json +1 -1
  56. package/src/map/data/README.md +6 -0
  57. package/src/map/data/gazetteer.json +1 -1
  58. package/src/map/data/mountain-ranges.json +1 -1
  59. package/src/map/data/types.ts +34 -0
  60. package/src/map/data/water-bodies.json +1 -0
  61. package/src/map/data/world-coarse.json +1 -1
  62. package/src/map/data/world-detail.json +1 -1
  63. package/src/map/dimensions.ts +117 -0
  64. package/src/map/geo-query.ts +21 -3
  65. package/src/map/geo.ts +47 -1
  66. package/src/map/layout.ts +1408 -266
  67. package/src/map/load-data.ts +10 -2
  68. package/src/map/parser.ts +42 -116
  69. package/src/map/renderer.ts +604 -14
  70. package/src/map/resolved-types.ts +16 -2
  71. package/src/map/resolver.ts +208 -59
  72. package/src/map/types.ts +30 -32
  73. package/src/mindmap/renderer.ts +10 -1
  74. package/src/palettes/atlas.ts +77 -0
  75. package/src/palettes/blueprint.ts +73 -0
  76. package/src/palettes/color-utils.ts +58 -1
  77. package/src/palettes/index.ts +12 -3
  78. package/src/palettes/slate.ts +73 -0
  79. package/src/palettes/tidewater.ts +73 -0
  80. package/src/render.ts +8 -1
  81. package/src/tech-radar/renderer.ts +3 -0
  82. package/src/tech-radar/types.ts +3 -0
  83. package/src/utils/d3-types.ts +5 -0
  84. package/src/utils/legend-layout.ts +21 -4
  85. package/src/utils/legend-types.ts +7 -0
  86. package/src/utils/reserved-key-registry.ts +8 -3
  87. package/src/palettes/bold.ts +0 -67
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `@diagrammo/dgmo/auto` — IIFE-distributed auto-renderer for static HTML.
3
+ *
4
+ * Drop a `<script src="…/auto.js">` on any page; on `DOMContentLoaded`
5
+ * this module scans for `.dgmo, .language-dgmo`, runs `render()`, and
6
+ * replaces each match with `<div class="dgmo-rendered">` containing the
7
+ * SVG plus an optional collapsible source panel with Copy and
8
+ * "Open in editor" actions.
9
+ *
10
+ * Public API: frozen `window.dgmo` and alias `window.diagrammo` with
11
+ * `{ initialize, run, version }`. Configuration is read from the
12
+ * bundle's own `<script data-config='{…}'>` (JSON with strict
13
+ * allowlist) or via `dgmo.initialize(opts)` for `data-auto="false"`
14
+ * embedders.
15
+ */
16
+
17
+ interface AutoConfig {
18
+ theme?: 'auto' | 'light' | 'dark' | 'transparent';
19
+ palette?: string;
20
+ showSource?: boolean;
21
+ showEditorLink?: boolean;
22
+ }
23
+ interface RunOptions {
24
+ nodes?: Element[] | NodeListOf<Element>;
25
+ }
26
+ declare const VERSION: string;
27
+ declare function findScriptTag(): HTMLScriptElement | null;
28
+ declare function parseConfig(raw: string | null | undefined): Partial<AutoConfig>;
29
+ declare function selectTargets(root?: ParentNode): Element[];
30
+ declare function resolveTheme(theme: AutoConfig['theme']): 'light' | 'dark' | 'transparent';
31
+ declare function initialize(opts?: AutoConfig): void;
32
+ declare function run(opts?: RunOptions): Promise<void>;
33
+ declare const api: Readonly<{
34
+ initialize: typeof initialize;
35
+ run: typeof run;
36
+ version: string;
37
+ }>;
38
+
39
+ export { type AutoConfig, type RunOptions, VERSION, api as default, findScriptTag, initialize, parseConfig, resolveTheme, run, selectTargets };
package/dist/auto.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `@diagrammo/dgmo/auto` — IIFE-distributed auto-renderer for static HTML.
3
+ *
4
+ * Drop a `<script src="…/auto.js">` on any page; on `DOMContentLoaded`
5
+ * this module scans for `.dgmo, .language-dgmo`, runs `render()`, and
6
+ * replaces each match with `<div class="dgmo-rendered">` containing the
7
+ * SVG plus an optional collapsible source panel with Copy and
8
+ * "Open in editor" actions.
9
+ *
10
+ * Public API: frozen `window.dgmo` and alias `window.diagrammo` with
11
+ * `{ initialize, run, version }`. Configuration is read from the
12
+ * bundle's own `<script data-config='{…}'>` (JSON with strict
13
+ * allowlist) or via `dgmo.initialize(opts)` for `data-auto="false"`
14
+ * embedders.
15
+ */
16
+
17
+ interface AutoConfig {
18
+ theme?: 'auto' | 'light' | 'dark' | 'transparent';
19
+ palette?: string;
20
+ showSource?: boolean;
21
+ showEditorLink?: boolean;
22
+ }
23
+ interface RunOptions {
24
+ nodes?: Element[] | NodeListOf<Element>;
25
+ }
26
+ declare const VERSION: string;
27
+ declare function findScriptTag(): HTMLScriptElement | null;
28
+ declare function parseConfig(raw: string | null | undefined): Partial<AutoConfig>;
29
+ declare function selectTargets(root?: ParentNode): Element[];
30
+ declare function resolveTheme(theme: AutoConfig['theme']): 'light' | 'dark' | 'transparent';
31
+ declare function initialize(opts?: AutoConfig): void;
32
+ declare function run(opts?: RunOptions): Promise<void>;
33
+ declare const api: Readonly<{
34
+ initialize: typeof initialize;
35
+ run: typeof run;
36
+ version: string;
37
+ }>;
38
+
39
+ export { type AutoConfig, type RunOptions, VERSION, api as default, findScriptTag, initialize, parseConfig, resolveTheme, run, selectTargets };