@diagrammo/dgmo 0.21.1 → 0.22.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 (73) hide show
  1. package/README.md +16 -6
  2. package/dist/advanced.cjs +2003 -466
  3. package/dist/advanced.d.cts +5714 -0
  4. package/dist/advanced.d.ts +5714 -0
  5. package/dist/advanced.js +1999 -466
  6. package/dist/auto.cjs +2048 -449
  7. package/dist/auto.d.cts +39 -0
  8. package/dist/auto.d.ts +39 -0
  9. package/dist/auto.js +121 -121
  10. package/dist/auto.mjs +2050 -450
  11. package/dist/cli.cjs +170 -170
  12. package/dist/editor.cjs +13 -16
  13. package/dist/editor.js +13 -16
  14. package/dist/highlight.cjs +15 -13
  15. package/dist/highlight.js +15 -13
  16. package/dist/index.cjs +2032 -435
  17. package/dist/index.d.cts +339 -0
  18. package/dist/index.d.ts +339 -0
  19. package/dist/index.js +2034 -436
  20. package/dist/internal.cjs +2003 -466
  21. package/dist/internal.d.cts +5714 -0
  22. package/dist/internal.d.ts +5714 -0
  23. package/dist/internal.js +1999 -466
  24. package/dist/map-data/water-bodies.json +1 -0
  25. package/docs/language-reference.md +20 -9
  26. package/gallery/fixtures/map-categorical-world.dgmo +16 -0
  27. package/gallery/fixtures/map-categorical.dgmo +0 -1
  28. package/gallery/fixtures/map-choropleth.dgmo +0 -1
  29. package/gallery/fixtures/map-coastline.dgmo +7 -0
  30. package/gallery/fixtures/map-colorize.dgmo +11 -0
  31. package/gallery/fixtures/map-direct-color.dgmo +0 -1
  32. package/gallery/fixtures/map-reference-world.dgmo +11 -0
  33. package/gallery/fixtures/map-region-scope.dgmo +0 -3
  34. package/gallery/fixtures/map-route.dgmo +0 -1
  35. package/package.json +1 -1
  36. package/src/advanced.ts +12 -1
  37. package/src/boxes-and-lines/renderer.ts +39 -12
  38. package/src/cli.ts +1 -1
  39. package/src/completion.ts +32 -25
  40. package/src/cycle/renderer.ts +14 -1
  41. package/src/d3.ts +8 -2
  42. package/src/editor/highlight-api.ts +4 -0
  43. package/src/editor/keywords.ts +13 -16
  44. package/src/infra/renderer.ts +35 -7
  45. package/src/map/colorize.ts +54 -0
  46. package/src/map/context-labels.ts +429 -0
  47. package/src/map/data/types.ts +34 -0
  48. package/src/map/data/water-bodies.json +1 -0
  49. package/src/map/dimensions.ts +117 -0
  50. package/src/map/geo-query.ts +21 -3
  51. package/src/map/geo.ts +47 -1
  52. package/src/map/layout.ts +1300 -251
  53. package/src/map/load-data.ts +10 -2
  54. package/src/map/parser.ts +42 -116
  55. package/src/map/renderer.ts +512 -13
  56. package/src/map/resolved-types.ts +16 -2
  57. package/src/map/resolver.ts +208 -59
  58. package/src/map/types.ts +30 -32
  59. package/src/mindmap/renderer.ts +10 -1
  60. package/src/palettes/atlas.ts +77 -0
  61. package/src/palettes/blueprint.ts +73 -0
  62. package/src/palettes/color-utils.ts +58 -1
  63. package/src/palettes/index.ts +12 -3
  64. package/src/palettes/slate.ts +73 -0
  65. package/src/palettes/tidewater.ts +73 -0
  66. package/src/render.ts +8 -1
  67. package/src/tech-radar/renderer.ts +3 -0
  68. package/src/tech-radar/types.ts +3 -0
  69. package/src/utils/d3-types.ts +5 -0
  70. package/src/utils/legend-layout.ts +21 -4
  71. package/src/utils/legend-types.ts +7 -0
  72. package/src/utils/reserved-key-registry.ts +3 -0
  73. 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 };