@diagrammo/dgmo 0.36.0 → 0.38.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.
- package/.cursorrules +3 -0
- package/.github/copilot-instructions.md +3 -0
- package/.windsurfrules +3 -0
- package/SKILL.md +3 -0
- package/dist/advanced.cjs +1058 -135
- package/dist/advanced.d.cts +122 -8
- package/dist/advanced.d.ts +122 -8
- package/dist/advanced.js +1055 -133
- package/dist/auto.cjs +1047 -132
- package/dist/auto.js +96 -95
- package/dist/auto.mjs +1048 -130
- package/dist/cli.cjs +117 -116
- package/dist/editor.cjs +4 -1
- package/dist/editor.js +4 -1
- package/dist/highlight.cjs +3 -0
- package/dist/highlight.js +3 -0
- package/dist/index.cjs +1043 -131
- package/dist/index.js +1044 -129
- package/docs/ai-integration.md +3 -0
- package/docs/language-reference.md +106 -7
- package/gallery/fixtures/map-coastline.dgmo +2 -2
- package/gallery/fixtures/map-route.dgmo +5 -5
- package/gallery/fixtures/treemap-branch.dgmo +15 -0
- package/gallery/fixtures/treemap-heat.dgmo +12 -0
- package/gallery/fixtures/treemap-tag-heat.dgmo +21 -0
- package/gallery/fixtures/treemap-tags.dgmo +18 -0
- package/package.json +1 -1
- package/src/advanced.ts +11 -0
- package/src/boxes-and-lines/layout-search.ts +19 -1
- package/src/chart-type-registry.ts +4 -0
- package/src/chart-types.ts +5 -0
- package/src/completion.ts +64 -0
- package/src/d3.ts +30 -18
- package/src/editor/highlight-api.ts +2 -0
- package/src/editor/keywords.ts +3 -0
- package/src/infra/parser.ts +95 -38
- package/src/map/dimensions.ts +19 -2
- package/src/map/layout.ts +91 -7
- package/src/map/parser.ts +51 -29
- package/src/map/renderer.ts +10 -0
- package/src/map/types.ts +9 -8
- package/src/treemap/layout.ts +189 -0
- package/src/treemap/parser.ts +475 -0
- package/src/treemap/renderer.ts +698 -0
- package/src/treemap/types.ts +57 -0
- package/src/utils/parsing.ts +1 -0
- package/src/utils/reserved-key-registry.ts +5 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { DgmoError } from '../diagnostics';
|
|
2
|
+
import type { TagGroup } from '../utils/tag-groups';
|
|
3
|
+
|
|
4
|
+
// ============================================================
|
|
5
|
+
// Treemap — Parsed Types
|
|
6
|
+
// ============================================================
|
|
7
|
+
//
|
|
8
|
+
// A treemap is a hierarchy (indentation) where each leaf carries a size
|
|
9
|
+
// (the bare trailing number) and parents auto-sum their descendants. See the
|
|
10
|
+
// treemap § of docs/dgmo-language-spec.md for the canonical grammar.
|
|
11
|
+
|
|
12
|
+
/** Runtime color mode for a treemap. Default resolved from source; the app's
|
|
13
|
+
* legend/settings switcher overrides it live without editing source. */
|
|
14
|
+
export type TreemapColorMode = 'tag' | 'heat' | 'branch';
|
|
15
|
+
|
|
16
|
+
export interface TreemapNode {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
/**
|
|
20
|
+
* Leaf size = the bare trailing number. `undefined` for branches (the layout
|
|
21
|
+
* auto-sums descendants) and for value-less leaves (treated as 0 + a warning).
|
|
22
|
+
*/
|
|
23
|
+
value?: number;
|
|
24
|
+
/** Optional per-node heat metric (`heat:`), drives the color-by-value ramp. */
|
|
25
|
+
heat?: number;
|
|
26
|
+
readonly metadata: Record<string, string>;
|
|
27
|
+
readonly children: TreemapNode[];
|
|
28
|
+
readonly lineNumber: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TreemapOptions {
|
|
32
|
+
/** Label for the heat ramp (`heat <Label> …`). */
|
|
33
|
+
heatLabel?: string;
|
|
34
|
+
/** Explicit ramp colors peeled from the `heat` directive (0–2, named only). */
|
|
35
|
+
readonly heatColors: string[];
|
|
36
|
+
/** `depth N` — render budget (interactive only); undefined = unlimited. */
|
|
37
|
+
maxDepth?: number;
|
|
38
|
+
noValues: boolean;
|
|
39
|
+
noPercent: boolean;
|
|
40
|
+
noHeaders: boolean;
|
|
41
|
+
noLegend: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ParsedTreemap {
|
|
45
|
+
readonly type: 'treemap';
|
|
46
|
+
readonly title: string | null;
|
|
47
|
+
readonly titleLineNumber: number | null;
|
|
48
|
+
readonly roots: TreemapNode[];
|
|
49
|
+
readonly tagGroups: TagGroup[];
|
|
50
|
+
/** True when any `heat:` value or a `heat` directive was declared. */
|
|
51
|
+
readonly hasHeat: boolean;
|
|
52
|
+
/** Source-declared default color mode (tag > heat > branch). */
|
|
53
|
+
readonly defaultColorMode: TreemapColorMode;
|
|
54
|
+
readonly options: TreemapOptions;
|
|
55
|
+
readonly diagnostics: DgmoError[];
|
|
56
|
+
readonly error: string | null;
|
|
57
|
+
}
|
package/src/utils/parsing.ts
CHANGED
|
@@ -209,6 +209,11 @@ export const RING_REGISTRY: ReservedKeyRegistry = staticRegistry([
|
|
|
209
209
|
'description',
|
|
210
210
|
]);
|
|
211
211
|
|
|
212
|
+
// Treemap: only `heat` (the color-by-value metric) is a reserved attribute key.
|
|
213
|
+
// Node SIZE is the bare trailing number (not a `value:` key — §1.5 idiom), and
|
|
214
|
+
// tag application uses declared tag aliases (added dynamically via withTagAliases).
|
|
215
|
+
export const TREEMAP_REGISTRY: ReservedKeyRegistry = staticRegistry(['heat']);
|
|
216
|
+
|
|
212
217
|
/**
|
|
213
218
|
* RACI/RASCI/DACI: only `color` and `description` are reserved as
|
|
214
219
|
* attribute keys. Role names declared via `roles` block are
|