@diagrammo/dgmo 0.25.4 → 0.25.5

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 (46) hide show
  1. package/dist/advanced.cjs +62543 -0
  2. package/dist/advanced.d.cts +5684 -0
  3. package/dist/advanced.d.ts +5684 -0
  4. package/dist/advanced.js +62296 -0
  5. package/dist/auto.cjs +59850 -0
  6. package/dist/auto.css +214 -0
  7. package/dist/auto.d.cts +39 -0
  8. package/dist/auto.d.ts +39 -0
  9. package/dist/auto.js +437 -0
  10. package/dist/auto.mjs +59860 -0
  11. package/dist/cli.cjs +465 -0
  12. package/dist/editor.cjs +432 -0
  13. package/dist/editor.d.cts +26 -0
  14. package/dist/editor.d.ts +26 -0
  15. package/dist/editor.js +401 -0
  16. package/dist/highlight.cjs +720 -0
  17. package/dist/highlight.d.cts +32 -0
  18. package/dist/highlight.d.ts +32 -0
  19. package/dist/highlight.js +690 -0
  20. package/dist/index.cjs +59036 -0
  21. package/dist/index.d.cts +375 -0
  22. package/dist/index.d.ts +375 -0
  23. package/dist/index.js +59040 -0
  24. package/dist/internal.cjs +62545 -0
  25. package/dist/internal.d.cts +5684 -0
  26. package/dist/internal.d.ts +5684 -0
  27. package/dist/internal.js +62296 -0
  28. package/dist/map-data/PROVENANCE.json +1 -0
  29. package/dist/map-data/gazetteer.json +1 -0
  30. package/dist/map-data/lakes.json +1 -0
  31. package/dist/map-data/mountain-ranges.json +1 -0
  32. package/dist/map-data/na-lakes.json +1 -0
  33. package/dist/map-data/na-land.json +1 -0
  34. package/dist/map-data/region-names.json +1 -0
  35. package/dist/map-data/rivers.json +1 -0
  36. package/dist/map-data/us-states.json +1 -0
  37. package/dist/map-data/water-bodies.json +1 -0
  38. package/dist/map-data/world-coarse.json +1 -0
  39. package/dist/map-data/world-detail.json +1 -0
  40. package/dist/pert.cjs +325 -0
  41. package/dist/pert.d.cts +554 -0
  42. package/dist/pert.d.ts +554 -0
  43. package/dist/pert.js +294 -0
  44. package/package.json +1 -1
  45. package/src/editor/dgmo.grammar.js +18 -0
  46. package/src/editor/dgmo.grammar.terms.js +35 -0
package/dist/auto.css ADDED
@@ -0,0 +1,214 @@
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; }
@@ -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 };