@diagrammo/dgmo 0.25.2 → 0.25.4

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 (51) hide show
  1. package/README.md +69 -884
  2. package/package.json +1 -1
  3. package/src/cli.ts +0 -9
  4. package/src/d3.ts +180 -46
  5. package/src/render.ts +80 -39
  6. package/src/utils/svg-embed.ts +12 -3
  7. package/dist/advanced.cjs +0 -62454
  8. package/dist/advanced.d.cts +0 -5684
  9. package/dist/advanced.d.ts +0 -5684
  10. package/dist/advanced.js +0 -62207
  11. package/dist/auto.cjs +0 -59764
  12. package/dist/auto.css +0 -214
  13. package/dist/auto.d.cts +0 -39
  14. package/dist/auto.d.ts +0 -39
  15. package/dist/auto.js +0 -437
  16. package/dist/auto.mjs +0 -59774
  17. package/dist/cli.cjs +0 -465
  18. package/dist/editor.cjs +0 -432
  19. package/dist/editor.d.cts +0 -26
  20. package/dist/editor.d.ts +0 -26
  21. package/dist/editor.js +0 -401
  22. package/dist/highlight.cjs +0 -720
  23. package/dist/highlight.d.cts +0 -32
  24. package/dist/highlight.d.ts +0 -32
  25. package/dist/highlight.js +0 -690
  26. package/dist/index.cjs +0 -58947
  27. package/dist/index.d.cts +0 -375
  28. package/dist/index.d.ts +0 -375
  29. package/dist/index.js +0 -58951
  30. package/dist/internal.cjs +0 -62456
  31. package/dist/internal.d.cts +0 -5684
  32. package/dist/internal.d.ts +0 -5684
  33. package/dist/internal.js +0 -62207
  34. package/dist/map-data/PROVENANCE.json +0 -1
  35. package/dist/map-data/gazetteer.json +0 -1
  36. package/dist/map-data/lakes.json +0 -1
  37. package/dist/map-data/mountain-ranges.json +0 -1
  38. package/dist/map-data/na-lakes.json +0 -1
  39. package/dist/map-data/na-land.json +0 -1
  40. package/dist/map-data/region-names.json +0 -1
  41. package/dist/map-data/rivers.json +0 -1
  42. package/dist/map-data/us-states.json +0 -1
  43. package/dist/map-data/water-bodies.json +0 -1
  44. package/dist/map-data/world-coarse.json +0 -1
  45. package/dist/map-data/world-detail.json +0 -1
  46. package/dist/pert.cjs +0 -325
  47. package/dist/pert.d.cts +0 -554
  48. package/dist/pert.d.ts +0 -554
  49. package/dist/pert.js +0 -294
  50. package/src/editor/dgmo.grammar.js +0 -18
  51. package/src/editor/dgmo.grammar.terms.js +0 -35
package/dist/auto.css DELETED
@@ -1,214 +0,0 @@
1
- /* anti-flash: hide source elements until either render swaps them out
2
- or the error path explicitly un-hides them */
3
- pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
4
- .dgmo:not(svg *):not(.dgmo-rendered):not(.dgmo-rendered *) {
5
- visibility: hidden;
6
- }
7
- .dgmo-rendered, .dgmo-rendered *,
8
- .dgmo-error-banner, .dgmo-error-banner * {
9
- visibility: visible !important;
10
- }
11
-
12
- .dgmo-rendered {
13
- display: block;
14
- position: relative;
15
- margin: 1em 0;
16
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
17
- Oxygen, Ubuntu, Cantarell, sans-serif;
18
- font-size: 14px;
19
- line-height: 1.4;
20
- color-scheme: light dark;
21
- }
22
- .dgmo-rendered svg {
23
- display: block;
24
- max-width: 100%;
25
- height: auto;
26
- }
27
-
28
- .dgmo-source-panel {
29
- margin-top: 4px;
30
- position: relative;
31
- }
32
-
33
- .dgmo-source-toggle {
34
- display: inline-flex;
35
- align-items: center;
36
- gap: 4px;
37
- /* Visual size is small; the 28px hit area + padding still meets
38
- the 44 × 44 minimum touch target across most stylesheets, and
39
- we widen padding on coarse pointers below. */
40
- min-height: 28px;
41
- padding: 4px 6px;
42
- background: transparent;
43
- border: 0;
44
- font: inherit;
45
- font-size: 11px;
46
- font-weight: 500;
47
- letter-spacing: 0.02em;
48
- text-align: left;
49
- cursor: pointer;
50
- color: inherit;
51
- opacity: 0.45;
52
- border-radius: 3px;
53
- transition: opacity 120ms ease, background 120ms ease;
54
- }
55
- .dgmo-source-toggle:hover {
56
- opacity: 0.85;
57
- background: rgba(127, 127, 127, 0.08);
58
- }
59
- .dgmo-source-toggle:focus-visible {
60
- opacity: 1;
61
- outline: 2px solid currentColor;
62
- outline-offset: 1px;
63
- }
64
- .dgmo-source-toggle[aria-expanded="true"] {
65
- opacity: 0.7;
66
- }
67
- .dgmo-source-toggle .dgmo-chevron {
68
- display: inline-block;
69
- width: 8px;
70
- height: 8px;
71
- font-size: 8px;
72
- line-height: 1;
73
- transition: transform 150ms ease-out;
74
- }
75
- .dgmo-source-toggle[aria-expanded="true"] .dgmo-chevron {
76
- transform: rotate(90deg);
77
- }
78
- @media (pointer: coarse) {
79
- /* Larger hit area on touch devices without making the visible
80
- toggle bigger on the desktop. */
81
- .dgmo-source-toggle {
82
- min-height: 44px;
83
- padding: 12px 10px;
84
- }
85
- }
86
-
87
- .dgmo-source-body {
88
- overflow: hidden;
89
- max-height: 0;
90
- transition: max-height 150ms ease-out;
91
- position: relative;
92
- }
93
- .dgmo-source-body.dgmo-open {
94
- max-height: 60vh;
95
- overflow: auto;
96
- margin-top: 2px;
97
- border-radius: 4px;
98
- background: rgba(127, 127, 127, 0.04);
99
- }
100
- .dgmo-rendered.dgmo-theme-dark .dgmo-source-body.dgmo-open {
101
- background: rgba(255, 255, 255, 0.03);
102
- }
103
- .dgmo-source-pre {
104
- margin: 0;
105
- /* Right padding leaves room for the floating action icons. */
106
- padding: 10px 56px 10px 14px;
107
- font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
108
- font-size: 12px;
109
- line-height: 1.45;
110
- white-space: pre;
111
- overflow: auto;
112
- background: transparent;
113
- color: inherit;
114
- }
115
-
116
- .dgmo-source-actions {
117
- position: absolute;
118
- top: 6px;
119
- right: 6px;
120
- display: flex;
121
- gap: 2px;
122
- /* Inherit visibility:hidden when collapsed; pointer-events:none keeps
123
- them off the tab order until the panel opens. */
124
- pointer-events: none;
125
- }
126
- .dgmo-source-body.dgmo-open .dgmo-source-actions {
127
- pointer-events: auto;
128
- }
129
- .dgmo-btn {
130
- display: inline-flex;
131
- align-items: center;
132
- justify-content: center;
133
- width: 26px;
134
- height: 26px;
135
- padding: 0;
136
- background: transparent;
137
- color: inherit;
138
- border: 0;
139
- border-radius: 3px;
140
- cursor: pointer;
141
- text-decoration: none;
142
- opacity: 0.4;
143
- transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
144
- }
145
- .dgmo-btn:hover {
146
- opacity: 1;
147
- background: rgba(127, 127, 127, 0.15);
148
- }
149
- .dgmo-btn:focus-visible {
150
- opacity: 1;
151
- outline: 2px solid currentColor;
152
- outline-offset: 1px;
153
- }
154
- .dgmo-btn[aria-disabled="true"] {
155
- opacity: 0.25;
156
- cursor: not-allowed;
157
- }
158
- .dgmo-btn[aria-disabled="true"]:hover {
159
- background: transparent;
160
- }
161
- .dgmo-btn-copied {
162
- opacity: 1 !important;
163
- color: rgb(120, 200, 120);
164
- }
165
- .dgmo-btn svg {
166
- width: 14px;
167
- height: 14px;
168
- display: block;
169
- }
170
-
171
- .dgmo-error-banner {
172
- display: block;
173
- margin: 0.5em 0;
174
- padding: 10px 14px;
175
- border-left: 4px solid #c44;
176
- background: rgba(204, 68, 68, 0.08);
177
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
178
- font-size: 13px;
179
- line-height: 1.4;
180
- color: inherit;
181
- border-radius: 0 4px 4px 0;
182
- }
183
- .dgmo-error-banner-title {
184
- font-weight: 600;
185
- margin-bottom: 2px;
186
- }
187
- .dgmo-error-banner-loc {
188
- opacity: 0.7;
189
- font-size: 12px;
190
- font-family: ui-monospace, monospace;
191
- }
192
-
193
- /* Token roles — fallback colors used when theme classes don't override */
194
- .dgmo-source-pre .dgmo-tok-keyword { color: #5e81ac; font-weight: 600; }
195
- .dgmo-source-pre .dgmo-tok-controlKeyword { color: #b48ead; font-weight: 600; }
196
- .dgmo-source-pre .dgmo-tok-definitionKeyword { color: #5e81ac; font-weight: 600; }
197
- .dgmo-source-pre .dgmo-tok-modifier { color: #b48ead; }
198
- .dgmo-source-pre .dgmo-tok-chartType { color: #d08770; font-weight: 600; }
199
- .dgmo-source-pre .dgmo-tok-operator { color: #bf616a; font-weight: 600; }
200
- .dgmo-source-pre .dgmo-tok-number { color: #b48ead; }
201
- .dgmo-source-pre .dgmo-tok-comment { color: #6c7a96; font-style: italic; }
202
- .dgmo-source-pre .dgmo-tok-heading { color: #d08770; font-weight: 600; }
203
- .dgmo-source-pre .dgmo-tok-bracket { color: #5e81ac; }
204
- .dgmo-source-pre .dgmo-tok-separator { color: #88c0d0; }
205
- .dgmo-source-pre .dgmo-tok-url { color: #88c0d0; text-decoration: underline; }
206
- .dgmo-source-pre .dgmo-tok-colorAnnotation { color: #d08770; font-style: italic; }
207
- .dgmo-source-pre .dgmo-tok-punctuation { color: #6c7a96; }
208
- .dgmo-source-pre .dgmo-tok-noteContent { color: #6c7a96; font-style: italic; }
209
-
210
- .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-keyword,
211
- .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-definitionKeyword { color: #81a1c1; }
212
- .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-comment,
213
- .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-noteContent,
214
- .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-punctuation { color: #616e88; }
package/dist/auto.d.cts DELETED
@@ -1,39 +0,0 @@
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 DELETED
@@ -1,39 +0,0 @@
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 };