@diagrammo/dgmo 0.14.1 → 0.15.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/dist/auto.cjs +63 -8
- package/dist/auto.js +105 -709
- package/dist/auto.mjs +63 -8
- package/dist/cli.cjs +119 -119
- package/dist/editor.cjs +1 -0
- package/dist/editor.js +1 -0
- package/dist/highlight.cjs +1 -0
- package/dist/highlight.js +1 -0
- package/dist/index.cjs +549 -3450
- package/dist/index.d.cts +70 -4482
- package/dist/index.d.ts +70 -4482
- package/dist/index.js +546 -3206
- package/dist/internal.cjs +51722 -553
- package/dist/internal.d.cts +4535 -112
- package/dist/internal.d.ts +4535 -112
- package/dist/internal.js +51514 -548
- package/docs/language-reference.md +67 -17
- package/package.json +1 -11
- package/src/editor/keywords.ts +1 -0
- package/src/index.ts +197 -690
- package/src/infra/parser.ts +38 -6
- package/src/internal.ts +714 -8
- package/src/palettes/index.ts +39 -0
- package/src/render.ts +17 -1
- package/src/themes.ts +22 -0
- package/dist/pert.cjs +0 -325
- package/dist/pert.d.cts +0 -542
- package/dist/pert.d.ts +0 -542
- package/dist/pert.js +0 -294
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { EChartsOption } from 'echarts';
|
|
2
|
-
import * as d3Selection from 'd3-selection';
|
|
3
|
-
import { Selection } from 'd3-selection';
|
|
4
|
-
import * as d3Scale from 'd3-scale';
|
|
5
|
-
|
|
6
1
|
type DgmoSeverity = 'error' | 'warning';
|
|
7
2
|
interface DgmoError {
|
|
8
3
|
line: number;
|
|
@@ -16,328 +11,8 @@ interface DgmoError {
|
|
|
16
11
|
*/
|
|
17
12
|
code?: string;
|
|
18
13
|
}
|
|
19
|
-
declare function makeDgmoError(line: number, message: string, severity?: DgmoSeverity, code?: string): DgmoError;
|
|
20
14
|
declare function formatDgmoError(err: DgmoError): string;
|
|
21
15
|
|
|
22
|
-
/**
|
|
23
|
-
* Stable diagnostic codes for in-arrow label parsing errors.
|
|
24
|
-
*
|
|
25
|
-
* **Active codes** — emitted by the parser pipeline today:
|
|
26
|
-
* - `ARROW_SUBSTRING_IN_LABEL` (TD-13)
|
|
27
|
-
* - `CONTROL_CHAR_IN_LABEL` (TD-14)
|
|
28
|
-
*
|
|
29
|
-
* **Reserved codes** — declared but NOT currently emitted. These are
|
|
30
|
-
* placeholders for future tightening of the arrow-tokenization rules
|
|
31
|
-
* described in TD-9. Today's chart parsers catch these cases through
|
|
32
|
-
* their own regex machinery with different diagnostics. A follow-up
|
|
33
|
-
* spec that introduces a dedicated tokenizer can start emitting them
|
|
34
|
-
* without changing the public code shape:
|
|
35
|
-
* - `TRAILING_ARROW_TEXT` — extra `->`/`~>` after the primary arrow
|
|
36
|
-
* - `MIXED_ARROW_DELIMITERS` — opening delim type doesn't match arrow
|
|
37
|
-
*
|
|
38
|
-
* See `docs/dgmo-language-spec-decisions.md` → TD-16 for the rationale.
|
|
39
|
-
*/
|
|
40
|
-
declare const ARROW_DIAGNOSTIC_CODES: {
|
|
41
|
-
/** Active: label contains `->` or `~>` substring (TD-13). */
|
|
42
|
-
readonly ARROW_SUBSTRING_IN_LABEL: "E_ARROW_SUBSTRING_IN_LABEL";
|
|
43
|
-
/** Active: label contains a forbidden control character (TD-14). */
|
|
44
|
-
readonly CONTROL_CHAR_IN_LABEL: "E_CONTROL_CHAR_IN_LABEL";
|
|
45
|
-
/** Reserved: not currently emitted by any parser. See JSDoc above. */
|
|
46
|
-
readonly TRAILING_ARROW_TEXT: "E_TRAILING_ARROW_TEXT";
|
|
47
|
-
/** Reserved: not currently emitted by any parser. See JSDoc above. */
|
|
48
|
-
readonly MIXED_ARROW_DELIMITERS: "E_MIXED_ARROW_DELIMITERS";
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Validate an in-arrow label against the TD-13 and TD-14 character-set
|
|
52
|
-
* contract. Returns diagnostics (possibly empty). Does NOT mutate the label —
|
|
53
|
-
* callers that want a normalized label should trim before calling.
|
|
54
|
-
*
|
|
55
|
-
* TD-13: label must not contain the substrings "->" or "~>".
|
|
56
|
-
* TD-14: label must not contain C0 control chars other than tab, and no DEL.
|
|
57
|
-
*/
|
|
58
|
-
declare function validateLabelCharacters(label: string, lineNumber: number): DgmoError[];
|
|
59
|
-
interface ParseInArrowLabelResult {
|
|
60
|
-
/** Cleaned label (trimmed; `undefined` if empty after trim per TD-10). */
|
|
61
|
-
label: string | undefined;
|
|
62
|
-
diagnostics: DgmoError[];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Normalize and validate a raw in-arrow label.
|
|
66
|
-
*
|
|
67
|
-
* Behavior:
|
|
68
|
-
* - Trims leading/trailing whitespace (TD-8: internal whitespace preserved).
|
|
69
|
-
* - Empty-after-trim → `{ label: undefined }` (TD-10 normalization).
|
|
70
|
-
* - TD-13: emits `E_ARROW_SUBSTRING_IN_LABEL` if `->` or `~>` is present.
|
|
71
|
-
* - TD-14: emits `E_CONTROL_CHAR_IN_LABEL` for forbidden control chars.
|
|
72
|
-
*
|
|
73
|
-
* This helper is intentionally chart-agnostic: it operates on an already
|
|
74
|
-
* extracted label string, leaving each chart's existing arrow-finding
|
|
75
|
-
* tokenization in place. TD-11 color-parens is handled inside the
|
|
76
|
-
* flowchart and state `parseArrowToken` functions because those are the
|
|
77
|
-
* only charts that interpret `-(color)->` as a colored edge; they use
|
|
78
|
-
* `matchColorParens()` from this module for the shared lookup.
|
|
79
|
-
*/
|
|
80
|
-
declare function parseInArrowLabel(rawLabel: string, lineNumber: number): ParseInArrowLabelResult;
|
|
81
|
-
/**
|
|
82
|
-
* Test whether a string matches the TD-11 color-parens form `(colorName)`
|
|
83
|
-
* where `colorName` is one of the 11 recognized palette color names from
|
|
84
|
-
* `src/colors.ts:RECOGNIZED_COLOR_NAMES`. Returns the lowercase color name
|
|
85
|
-
* on a match, or `null` on fall-through (whole string becomes a label).
|
|
86
|
-
*
|
|
87
|
-
* Used by flowchart and state parsers to keep the color-parens recognition
|
|
88
|
-
* rule in one place — do NOT re-implement the regex in chart parsers.
|
|
89
|
-
*/
|
|
90
|
-
declare function matchColorParens(content: string): string | null;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Compact view state schema (ADR-6).
|
|
94
|
-
* All fields optional. Only non-default values are encoded.
|
|
95
|
-
* `tag: null` means "user chose none"; absent `tag` means "use DSL default" (ADR-5).
|
|
96
|
-
*/
|
|
97
|
-
interface CompactViewState {
|
|
98
|
-
tag?: string | null;
|
|
99
|
-
cs?: number[];
|
|
100
|
-
cg?: string[];
|
|
101
|
-
swim?: string | null;
|
|
102
|
-
cl?: string[];
|
|
103
|
-
cc?: string[];
|
|
104
|
-
rm?: string;
|
|
105
|
-
htv?: Record<string, string[]>;
|
|
106
|
-
ha?: string[];
|
|
107
|
-
sem?: boolean;
|
|
108
|
-
cm?: boolean;
|
|
109
|
-
c4l?: string;
|
|
110
|
-
c4s?: string;
|
|
111
|
-
c4c?: string;
|
|
112
|
-
rps?: number;
|
|
113
|
-
spd?: number;
|
|
114
|
-
io?: Record<string, number>;
|
|
115
|
-
hd?: boolean;
|
|
116
|
-
cbd?: boolean;
|
|
117
|
-
rq?: string;
|
|
118
|
-
an?: boolean;
|
|
119
|
-
fl?: boolean;
|
|
120
|
-
}
|
|
121
|
-
interface DecodedDiagramUrl {
|
|
122
|
-
dsl: string;
|
|
123
|
-
viewState: CompactViewState;
|
|
124
|
-
palette?: string;
|
|
125
|
-
theme?: 'light' | 'dark';
|
|
126
|
-
filename?: string;
|
|
127
|
-
}
|
|
128
|
-
interface EncodeDiagramUrlOptions {
|
|
129
|
-
baseUrl?: string;
|
|
130
|
-
viewState?: CompactViewState;
|
|
131
|
-
palette?: string;
|
|
132
|
-
theme?: 'light' | 'dark';
|
|
133
|
-
filename?: string;
|
|
134
|
-
}
|
|
135
|
-
type EncodeDiagramUrlResult = {
|
|
136
|
-
url: string;
|
|
137
|
-
error?: undefined;
|
|
138
|
-
} | {
|
|
139
|
-
url?: undefined;
|
|
140
|
-
error: 'too-large';
|
|
141
|
-
compressedSize: number;
|
|
142
|
-
limit: number;
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Encode a CompactViewState to a compressed string for URL embedding.
|
|
146
|
-
* Returns empty string if state has no keys (ADR-4).
|
|
147
|
-
*/
|
|
148
|
-
declare function encodeViewState(state: CompactViewState): string;
|
|
149
|
-
/**
|
|
150
|
-
* Decode a compressed view state string back to CompactViewState.
|
|
151
|
-
* Returns empty object on failure (no crash).
|
|
152
|
-
*/
|
|
153
|
-
declare function decodeViewState(encoded: string): CompactViewState;
|
|
154
|
-
/**
|
|
155
|
-
* Compress a DGMO DSL string into a shareable URL.
|
|
156
|
-
* Returns `{ url }` on success, or `{ error: 'too-large', compressedSize, limit }` if the
|
|
157
|
-
* compressed payload exceeds the 8 KB limit.
|
|
158
|
-
*/
|
|
159
|
-
declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions): EncodeDiagramUrlResult;
|
|
160
|
-
/**
|
|
161
|
-
* Decode a DGMO DSL string and view state from a URL query string or hash.
|
|
162
|
-
* Accepts any of:
|
|
163
|
-
* - `?dgmo=<payload>&vs=<state>`
|
|
164
|
-
* - `#dgmo=<payload>&vs=<state>` (backwards compat)
|
|
165
|
-
* - `dgmo=<payload>`
|
|
166
|
-
* - `<bare payload>`
|
|
167
|
-
*
|
|
168
|
-
* Returns `{ dsl, viewState }`. The DSL is empty string on invalid input.
|
|
169
|
-
*/
|
|
170
|
-
declare function decodeDiagramUrl(hash: string): DecodedDiagramUrl;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Render DGMO source to an SVG string.
|
|
174
|
-
*
|
|
175
|
-
* Automatically detects the chart type, selects the appropriate renderer,
|
|
176
|
-
* and returns a complete SVG document string.
|
|
177
|
-
*
|
|
178
|
-
* @param content - DGMO source text
|
|
179
|
-
* @param options - Optional theme and palette settings
|
|
180
|
-
* @returns Object with `svg` (SVG string, empty on error) and `diagnostics` (parse errors/warnings)
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* import { render } from '@diagrammo/dgmo';
|
|
185
|
-
*
|
|
186
|
-
* const { svg, diagnostics } = await render(`pie Languages
|
|
187
|
-
* TypeScript: 45
|
|
188
|
-
* Python: 30
|
|
189
|
-
* Rust: 25`);
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
declare function render(content: string, options?: {
|
|
193
|
-
theme?: 'light' | 'dark' | 'transparent';
|
|
194
|
-
palette?: string;
|
|
195
|
-
c4Level?: 'context' | 'containers' | 'components' | 'deployment';
|
|
196
|
-
c4System?: string;
|
|
197
|
-
c4Container?: string;
|
|
198
|
-
tagGroup?: string;
|
|
199
|
-
/** Legend state for export — controls which tag group is shown in exported SVG. */
|
|
200
|
-
legendState?: {
|
|
201
|
-
activeGroup?: string;
|
|
202
|
-
hiddenAttributes?: string[];
|
|
203
|
-
};
|
|
204
|
-
/** View state for export — controls interactive state (collapse, swimlanes, etc.) */
|
|
205
|
-
viewState?: CompactViewState;
|
|
206
|
-
}): Promise<{
|
|
207
|
-
svg: string;
|
|
208
|
-
diagnostics: DgmoError[];
|
|
209
|
-
}>;
|
|
210
|
-
|
|
211
|
-
interface ChartTypeMeta {
|
|
212
|
-
readonly id: string;
|
|
213
|
-
readonly description: string;
|
|
214
|
-
readonly triggers: readonly string[];
|
|
215
|
-
readonly fallback?: true;
|
|
216
|
-
}
|
|
217
|
-
declare const chartTypes: readonly ChartTypeMeta[];
|
|
218
|
-
declare const BETA_CHART_IDS: ReadonlySet<string>;
|
|
219
|
-
|
|
220
|
-
/** Normalize a string to lowercase ASCII-ish tokens for matching. */
|
|
221
|
-
declare function normalize(s: string): string[];
|
|
222
|
-
/**
|
|
223
|
-
* True if `triggerTokens` appears as a contiguous slice of `promptTokens`.
|
|
224
|
-
* Token-based (not substring) — prevents "scatter plot" matching "scattered
|
|
225
|
-
* the plot", "ER diagram" matching "water diagram", and similar traps.
|
|
226
|
-
*/
|
|
227
|
-
declare function matchesContiguously(promptTokens: readonly string[], triggerTokens: readonly string[]): boolean;
|
|
228
|
-
interface ChartTypeScore {
|
|
229
|
-
readonly type: ChartTypeMeta;
|
|
230
|
-
readonly score: number;
|
|
231
|
-
readonly matched: string[];
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Score a single chart type against a prompt.
|
|
235
|
-
*
|
|
236
|
-
* Primary signal: contiguous trigger-phrase matches weighted by token count
|
|
237
|
-
* (longer phrases beat shorter ones). Secondary signal: description-word
|
|
238
|
-
* overlap at 0.25× weight — a tiebreak-only hint that rescues prompts which
|
|
239
|
-
* miss every trigger but touch description vocabulary. Triggers always win
|
|
240
|
-
* over descriptions because any trigger match is ≥1.0 and descriptions
|
|
241
|
-
* contribute ≤0.25 per token.
|
|
242
|
-
*/
|
|
243
|
-
declare function scoreChartType(prompt: string, type: ChartTypeMeta): {
|
|
244
|
-
score: number;
|
|
245
|
-
matched: string[];
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* Minimum trigger-based score for a confident match. A result below this
|
|
249
|
-
* floor means no actual trigger fired — only description-rescue tokens
|
|
250
|
-
* contributed — so the caller should drop to the fallback list instead of
|
|
251
|
-
* returning a confident-looking wrong answer.
|
|
252
|
-
*
|
|
253
|
-
* 1.0 is the weight of a single-token trigger. Anything less came entirely
|
|
254
|
-
* from 0.25× description hits.
|
|
255
|
-
*/
|
|
256
|
-
declare const MIN_PRIMARY_SCORE = 1;
|
|
257
|
-
/**
|
|
258
|
-
* Minimum absolute score gap required before calling a match
|
|
259
|
-
* non-ambiguous. 0.5 ≈ two description-rescue tokens' worth, or half a
|
|
260
|
-
* trigger-token difference. Below this, the cliff between "medium" and
|
|
261
|
-
* "ambiguous" is effectively noise.
|
|
262
|
-
*/
|
|
263
|
-
declare const AMBIGUITY_THRESHOLD = 0.5;
|
|
264
|
-
type Confidence = 'high' | 'medium' | 'ambiguous';
|
|
265
|
-
/**
|
|
266
|
-
* Confidence from the top two scores. Rules:
|
|
267
|
-
* 1. top < MIN_PRIMARY_SCORE → ambiguous (no real trigger matched)
|
|
268
|
-
* 2. second === 0 → high (nothing competes)
|
|
269
|
-
* 3. top ≥ 2 × second → high (top dominates)
|
|
270
|
-
* 4. top − second < AMBIGUITY_THRESHOLD → ambiguous (gap is noise)
|
|
271
|
-
* 5. otherwise → medium
|
|
272
|
-
*/
|
|
273
|
-
declare function confidence(top: number, second: number): Confidence;
|
|
274
|
-
interface SuggestionResult {
|
|
275
|
-
readonly ranked: readonly ChartTypeScore[];
|
|
276
|
-
readonly fallback: readonly ChartTypeMeta[];
|
|
277
|
-
readonly confidence: Confidence;
|
|
278
|
-
readonly fellBack: boolean;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Score every chart type against `prompt` and return a ranked suggestion
|
|
282
|
-
* bundle. Types with score 0 are filtered out. When the top score is below
|
|
283
|
-
* `MIN_PRIMARY_SCORE` (no real trigger fired), the caller should present
|
|
284
|
-
* the fallback list — `fellBack` is set to true in that case.
|
|
285
|
-
*
|
|
286
|
-
* Array order is preserved: scoring iterates `chartTypes` in source order
|
|
287
|
-
* and `.sort` is stable in V8, so ties go to the earlier entry — specialized
|
|
288
|
-
* types beat generic catch-alls by construction.
|
|
289
|
-
*/
|
|
290
|
-
declare function suggestChartTypes(prompt: string): SuggestionResult;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Extracts the chart type from raw file content.
|
|
294
|
-
* First tries the first non-empty, non-comment line as a bare chart type name
|
|
295
|
-
* (e.g., `gantt Product Launch`).
|
|
296
|
-
* Falls back to inference when no explicit chart type is found.
|
|
297
|
-
*/
|
|
298
|
-
declare function parseDgmoChartType(content: string): string | null;
|
|
299
|
-
/** User-visible rendering category for dispatch and routing. */
|
|
300
|
-
type RenderCategory = 'data-chart' | 'visualization' | 'diagram';
|
|
301
|
-
/**
|
|
302
|
-
* Returns the render category for a given chart type, or `null` if unknown.
|
|
303
|
-
* Use this instead of the internal framework map for dispatch in consumers.
|
|
304
|
-
*/
|
|
305
|
-
declare function getRenderCategory(chartType: string): RenderCategory | null;
|
|
306
|
-
/**
|
|
307
|
-
* Returns true if the chart type is an extended chart type
|
|
308
|
-
* handled by parseExtendedChart (scatter, sankey, chord, function, heatmap, funnel).
|
|
309
|
-
* Returns false for standard chart types and all other types.
|
|
310
|
-
*/
|
|
311
|
-
declare function isExtendedChartType(chartType: string): boolean;
|
|
312
|
-
/**
|
|
313
|
-
* Returns all supported chart type identifiers in canonical (tier) order,
|
|
314
|
-
* derived from `chartTypes`. Consumers that need alphabetical order should
|
|
315
|
-
* call `.sort()` explicitly.
|
|
316
|
-
*/
|
|
317
|
-
declare function getAllChartTypes(): string[];
|
|
318
|
-
/**
|
|
319
|
-
* Canonical descriptions for every supported chart type. Derived from
|
|
320
|
-
* `chartTypes` so there is exactly one place to update when adding a new
|
|
321
|
-
* type. Consumed by the CLI `--chart-types` flag, the editor autocomplete
|
|
322
|
-
* popup, and the MCP `list_chart_types` tool.
|
|
323
|
-
*/
|
|
324
|
-
declare const CHART_TYPE_DESCRIPTIONS: Record<string, string>;
|
|
325
|
-
type ParseResult = {
|
|
326
|
-
diagnostics: DgmoError[];
|
|
327
|
-
};
|
|
328
|
-
type ParseFn = (content: string) => ParseResult;
|
|
329
|
-
/**
|
|
330
|
-
* Maps every chart-type id to the parser that handles it. Adding a new
|
|
331
|
-
* chart type means:
|
|
332
|
-
* 1. Add an entry here.
|
|
333
|
-
* 2. Add an entry to `chartTypes` in `chart-types.ts`.
|
|
334
|
-
*
|
|
335
|
-
* The `chart-types.test.ts` cross-check asserts both sets are identical;
|
|
336
|
-
* forgetting either side trips the test.
|
|
337
|
-
*/
|
|
338
|
-
declare const chartTypeParsers: ReadonlyArray<readonly [string, ParseFn]>;
|
|
339
|
-
/** Ids in the same order as `chartTypeParsers`; used for cross-checks. */
|
|
340
|
-
declare const knownChartTypeIds: readonly string[];
|
|
341
16
|
/**
|
|
342
17
|
* Parse DGMO content and return diagnostics without rendering.
|
|
343
18
|
* Useful for the CLI and editor to surface all errors before attempting render.
|
|
@@ -415,4189 +90,102 @@ interface PaletteConfig {
|
|
|
415
90
|
dark: PaletteColors;
|
|
416
91
|
}
|
|
417
92
|
|
|
418
|
-
/** Validate that a hex string is well-formed (#RGB or #RRGGBB). */
|
|
419
|
-
declare function isValidHex(value: string): boolean;
|
|
420
|
-
/**
|
|
421
|
-
* Register a palette. Called at module initialization.
|
|
422
|
-
* Validates that all 19 color fields per mode are present and valid hex.
|
|
423
|
-
* Throws on malformed palettes to catch errors at startup, not at render time.
|
|
424
|
-
*/
|
|
425
|
-
declare function registerPalette(palette: PaletteConfig): void;
|
|
426
|
-
/** Get palette by id. Returns Nord if id is unrecognized (FR10). */
|
|
427
|
-
declare function getPalette(id: string): PaletteConfig;
|
|
428
|
-
/** List all registered palettes alphabetically (for the selector UI). */
|
|
429
|
-
declare function getAvailablePalettes(): PaletteConfig[];
|
|
430
|
-
|
|
431
|
-
/** Convert hex (#RRGGBB or #RGB) to { h, s, l } with h in degrees, s/l as percentages. */
|
|
432
|
-
declare function hexToHSL(hex: string): {
|
|
433
|
-
h: number;
|
|
434
|
-
s: number;
|
|
435
|
-
l: number;
|
|
436
|
-
};
|
|
437
|
-
/** Convert { h (degrees), s (%), l (%) } back to #RRGGBB hex string. */
|
|
438
|
-
declare function hslToHex(h: number, s: number, l: number): string;
|
|
439
|
-
/** Convert hex to "H S% L%" string for CSS custom properties. */
|
|
440
|
-
declare function hexToHSLString(hex: string): string;
|
|
441
|
-
/**
|
|
442
|
-
* Blend a color toward white (light mode quadrant fills).
|
|
443
|
-
* amount: 0 = original, 1 = white
|
|
444
|
-
*/
|
|
445
|
-
declare function tint(hex: string, amount: number): string;
|
|
446
|
-
/**
|
|
447
|
-
* Blend a color toward a dark base (dark mode quadrant fills).
|
|
448
|
-
* amount: 0 = original, 1 = base
|
|
449
|
-
*/
|
|
450
|
-
declare function shade(hex: string, base: string, amount: number): string;
|
|
451
|
-
/**
|
|
452
|
-
* Blend two hex colors by percentage.
|
|
453
|
-
* `pct` = 0 → 100% of `b`, `pct` = 100 → 100% of `a`.
|
|
454
|
-
*
|
|
455
|
-
* Used by all renderers for tinted fills and strokes.
|
|
456
|
-
*/
|
|
457
|
-
declare function mix(a: string, b: string, pct: number): string;
|
|
458
93
|
/**
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
* unreadable.
|
|
465
|
-
* 2. **Pastel fill (min RGB channel ≥ 100, luminance ≤ 0.55)** → defer to WCAG
|
|
466
|
-
* ratio. Pastels have no near-zero channel and tend to read as "soft" —
|
|
467
|
-
* dark text usually wins by ratio (catppuccin dark mauve `#cba6f7` min 166,
|
|
468
|
-
* ratio 9.35:1; tokyo-night dark red `#f7768e` min 118, ratio 7.86:1; and
|
|
469
|
-
* tokyo-night green `#9ece6a` min 106, ratio 11.4:1 all correctly pick dark).
|
|
470
|
-
* 3. **Saturated fill (min RGB < 100, luminance ≤ 0.55)** → `lightText`. At least
|
|
471
|
-
* one channel near zero signals true saturation — gruvbox dark green
|
|
472
|
-
* `#b8bb26` (min 38), one-dark blue `#4078f2` (min 64), bold red/blue
|
|
473
|
-
* (min 0), solarized blue `#268bd2` (min 38). The user consistently
|
|
474
|
-
* prefers light text on these for visual punch.
|
|
475
|
-
*
|
|
476
|
-
* `min RGB` discriminates pastel-vs-saturated more reliably than `max-min`
|
|
477
|
-
* (vibrance): tokyo-night and catppuccin dark are pastels with high max RGB,
|
|
478
|
-
* so vibrance alone misclassifies them as "saturated."
|
|
479
|
-
*
|
|
480
|
-
* Tinted fills (luminance ~0.7+ in light themes / ~0.02–0.14 in dark themes)
|
|
481
|
-
* are unambiguous in either branch; only solid-fill output shifts here.
|
|
94
|
+
* Theme — render mode flag. Selects which palette variant the renderer uses
|
|
95
|
+
* for background and text:
|
|
96
|
+
* - 'light' → palette.light colors
|
|
97
|
+
* - 'dark' → palette.dark colors
|
|
98
|
+
* - 'transparent' → no background fill (for embedding in colored containers)
|
|
482
99
|
*/
|
|
483
|
-
|
|
100
|
+
type Theme = 'light' | 'dark' | 'transparent';
|
|
484
101
|
/**
|
|
485
|
-
*
|
|
486
|
-
* Use for any "tinted intent shape" — graph nodes, kanban cards,
|
|
487
|
-
* journey-map shapes, infra severity, ECharts pie/funnel/bar/etc.
|
|
488
|
-
*
|
|
489
|
-
* NOT for subtle-neutral shapes (use the existing 5-10% inline formula
|
|
490
|
-
* for "recede when no intent" cases — infra normal-state, untagged
|
|
491
|
-
* boxes, no-color sequence participants).
|
|
102
|
+
* `themes` namespace — use with render() options for a typed handle:
|
|
492
103
|
*
|
|
493
|
-
*
|
|
104
|
+
* await render(text, { theme: themes.dark });
|
|
494
105
|
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
106
|
+
* Passing the raw string `'dark'` also works (the underlying type is the
|
|
107
|
+
* string-literal union); the namespace is the conventional path.
|
|
497
108
|
*/
|
|
498
|
-
declare
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
declare const boldPalette: PaletteConfig;
|
|
505
|
-
|
|
506
|
-
declare const catppuccinPalette: PaletteConfig;
|
|
507
|
-
|
|
508
|
-
declare const gruvboxPalette: PaletteConfig;
|
|
509
|
-
|
|
510
|
-
declare const nordPalette: PaletteConfig;
|
|
511
|
-
|
|
512
|
-
declare const oneDarkPalette: PaletteConfig;
|
|
513
|
-
|
|
514
|
-
declare const rosePinePalette: PaletteConfig;
|
|
515
|
-
|
|
516
|
-
declare const solarizedPalette: PaletteConfig;
|
|
517
|
-
|
|
518
|
-
declare const tokyoNightPalette: PaletteConfig;
|
|
519
|
-
|
|
520
|
-
declare const draculaPalette: PaletteConfig;
|
|
521
|
-
|
|
522
|
-
declare const monokaiPalette: PaletteConfig;
|
|
523
|
-
|
|
524
|
-
type ChartType$1 = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'polar-area' | 'radar' | 'bar-stacked';
|
|
525
|
-
interface ChartDataPoint {
|
|
526
|
-
label: string;
|
|
527
|
-
value: number;
|
|
528
|
-
extraValues?: number[];
|
|
529
|
-
color?: string;
|
|
530
|
-
lineNumber: number;
|
|
531
|
-
}
|
|
532
|
-
interface ChartEra {
|
|
533
|
-
start: string;
|
|
534
|
-
end: string;
|
|
535
|
-
label: string;
|
|
536
|
-
color: string | null;
|
|
537
|
-
lineNumber: number;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
interface ParsedChart {
|
|
541
|
-
type: ChartType$1;
|
|
542
|
-
title?: string;
|
|
543
|
-
titleLineNumber?: number;
|
|
544
|
-
series?: string;
|
|
545
|
-
seriesLineNumber?: number;
|
|
546
|
-
xlabel?: string;
|
|
547
|
-
xlabelLineNumber?: number;
|
|
548
|
-
ylabel?: string;
|
|
549
|
-
ylabelLineNumber?: number;
|
|
550
|
-
seriesNames?: string[];
|
|
551
|
-
seriesNameLineNumbers?: number[];
|
|
552
|
-
seriesNameColors?: (string | undefined)[];
|
|
553
|
-
orientation?: 'horizontal' | 'vertical';
|
|
554
|
-
color?: string;
|
|
555
|
-
label?: string;
|
|
556
|
-
noName?: boolean;
|
|
557
|
-
noValue?: boolean;
|
|
558
|
-
noPercent?: boolean;
|
|
559
|
-
/** Render with full intent saturation instead of the canonical 25% tint. */
|
|
560
|
-
solidFill?: boolean;
|
|
561
|
-
/** Cross-chart-type: when true, the renderer suppresses the chart title. */
|
|
562
|
-
noTitle?: boolean;
|
|
563
|
-
data: ChartDataPoint[];
|
|
564
|
-
eras?: ChartEra[];
|
|
565
|
-
diagnostics: DgmoError[];
|
|
566
|
-
error: string | null;
|
|
567
|
-
}
|
|
109
|
+
declare const themes: {
|
|
110
|
+
readonly light: "light";
|
|
111
|
+
readonly dark: "dark";
|
|
112
|
+
readonly transparent: "transparent";
|
|
113
|
+
};
|
|
568
114
|
|
|
569
115
|
/**
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
* Format (colon-free):
|
|
573
|
-
* ```
|
|
574
|
-
* bar My Chart
|
|
575
|
-
* series Revenue
|
|
576
|
-
*
|
|
577
|
-
* Jan 120
|
|
578
|
-
* Feb 200
|
|
579
|
-
* Mar 150
|
|
580
|
-
* ```
|
|
581
|
-
*/
|
|
582
|
-
declare function parseChart(content: string, palette?: PaletteColors): ParsedChart;
|
|
583
|
-
/**
|
|
584
|
-
* Parse a data row line: everything before the last numeric token(s) is the label,
|
|
585
|
-
* numeric tokens at the end are the values. Supports comma-separated multi-values,
|
|
586
|
-
* space-separated multi-values, and comma-grouped numbers (e.g., "1,087").
|
|
116
|
+
* All built-in palettes, keyed by camelCase id. Use directly with render():
|
|
587
117
|
*
|
|
588
|
-
*
|
|
589
|
-
* "Jan 120" → { label: "Jan", values: [120] }
|
|
590
|
-
* "North America 250" → { label: "North America", values: [250] }
|
|
591
|
-
* "Q1 10, 20, 30" → { label: "Q1", values: [10, 20, 30] }
|
|
592
|
-
* "Q1 10 20 30" → { label: "Q1", values: [10, 20, 30] }
|
|
593
|
-
* "Revenue 1,200" → { label: "Revenue", values: [1200] }
|
|
594
|
-
* "Revenue 3,984,078.65"→ { label: "Revenue", values: [3984078.65] }
|
|
118
|
+
* await render(text, { palette: palettes.catppuccin });
|
|
595
119
|
*
|
|
596
|
-
*
|
|
120
|
+
* For preference/settings storage, the `.id` field of each entry is the
|
|
121
|
+
* canonical string (e.g. `'tokyo-night'`, `'nord'`) — that's the wire format
|
|
122
|
+
* used by share URLs and the CLI `--palette` flag.
|
|
597
123
|
*/
|
|
598
|
-
declare
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
}
|
|
611
|
-
interface LegendCallbacks {
|
|
612
|
-
onGroupToggle?: (groupName: string) => void;
|
|
613
|
-
onVisibilityToggle?: (attribute: string) => void;
|
|
614
|
-
onStateChange?: (newState: LegendState) => void;
|
|
615
|
-
/** Called when an entry is hovered. Chart renderers can use this for cross-element highlighting. */
|
|
616
|
-
onEntryHover?: (groupName: string, entryValue: string | null) => void;
|
|
617
|
-
/** Called after each group <g> is rendered — lets chart renderers inject custom elements (swimlane icons, etc.) */
|
|
618
|
-
onGroupRendered?: (groupName: string, groupEl: D3Sel, isActive: boolean) => void;
|
|
619
|
-
/** Called when the controls group gear pill is clicked (expand/collapse) */
|
|
620
|
-
onControlsExpand?: () => void;
|
|
621
|
-
/** Called when a controls group toggle entry is clicked */
|
|
622
|
-
onControlsToggle?: (toggleId: string, active: boolean) => void;
|
|
623
|
-
}
|
|
624
|
-
interface LegendPosition {
|
|
625
|
-
placement: 'top-center';
|
|
626
|
-
titleRelation: 'below-title' | 'inline-with-title';
|
|
627
|
-
}
|
|
628
|
-
type LegendMode = 'fixed' | 'inline';
|
|
629
|
-
type LegendControlExportBehavior = 'include' | 'strip' | 'static';
|
|
630
|
-
interface LegendControl {
|
|
631
|
-
id: string;
|
|
632
|
-
/** SVG markup for the control icon, or a string label */
|
|
633
|
-
icon: string;
|
|
634
|
-
label?: string;
|
|
635
|
-
exportBehavior: LegendControlExportBehavior;
|
|
636
|
-
onClick?: () => void;
|
|
637
|
-
children?: LegendControlEntry[];
|
|
638
|
-
}
|
|
639
|
-
interface LegendControlEntry {
|
|
640
|
-
id: string;
|
|
641
|
-
label: string;
|
|
642
|
-
isActive?: boolean;
|
|
643
|
-
onClick?: () => void;
|
|
644
|
-
}
|
|
645
|
-
interface ControlsGroupToggle {
|
|
646
|
-
id: string;
|
|
647
|
-
/** Only 'toggle' is implemented in v1. 'select' and 'action' future-proof for Infra playback etc. */
|
|
648
|
-
type: 'toggle' | 'select' | 'action';
|
|
649
|
-
label: string;
|
|
650
|
-
active: boolean;
|
|
651
|
-
onToggle: (active: boolean) => void;
|
|
652
|
-
}
|
|
653
|
-
interface ControlsGroupConfig {
|
|
654
|
-
toggles: ControlsGroupToggle[];
|
|
655
|
-
}
|
|
656
|
-
interface LegendConfig {
|
|
657
|
-
groups: LegendGroupData[];
|
|
658
|
-
position: LegendPosition;
|
|
659
|
-
controls?: LegendControl[];
|
|
660
|
-
controlsGroup?: ControlsGroupConfig;
|
|
661
|
-
mode: LegendMode;
|
|
662
|
-
/** Title width in pixels — used for inline-with-title computation */
|
|
663
|
-
titleWidth?: number;
|
|
664
|
-
/** Extra width (px) reserved after the pill inside an active capsule (e.g. for eye icon addon). Entries start after this offset. */
|
|
665
|
-
capsulePillAddonWidth?: number;
|
|
666
|
-
/** When true, groups with no entries are still rendered as collapsed pills. Default: false (empty groups hidden). */
|
|
667
|
-
showEmptyGroups?: boolean;
|
|
668
|
-
}
|
|
669
|
-
interface LegendPalette {
|
|
670
|
-
bg: string;
|
|
671
|
-
surface: string;
|
|
672
|
-
text: string;
|
|
673
|
-
textMuted: string;
|
|
674
|
-
primary?: string;
|
|
675
|
-
}
|
|
676
|
-
interface LegendPillLayout {
|
|
677
|
-
groupName: string;
|
|
678
|
-
x: number;
|
|
679
|
-
y: number;
|
|
680
|
-
width: number;
|
|
681
|
-
height: number;
|
|
682
|
-
isActive: boolean;
|
|
683
|
-
}
|
|
684
|
-
interface LegendEntryLayout {
|
|
685
|
-
value: string;
|
|
686
|
-
color: string;
|
|
687
|
-
x: number;
|
|
688
|
-
y: number;
|
|
689
|
-
dotCx: number;
|
|
690
|
-
dotCy: number;
|
|
691
|
-
textX: number;
|
|
692
|
-
textY: number;
|
|
693
|
-
}
|
|
694
|
-
interface LegendCapsuleLayout {
|
|
695
|
-
groupName: string;
|
|
696
|
-
x: number;
|
|
697
|
-
y: number;
|
|
698
|
-
width: number;
|
|
699
|
-
height: number;
|
|
700
|
-
pill: LegendPillLayout;
|
|
701
|
-
entries: LegendEntryLayout[];
|
|
702
|
-
/** Overflow indicator when entries exceed max rows */
|
|
703
|
-
moreCount?: number;
|
|
704
|
-
/** X offset where addon content (e.g. eye icon) can be placed — after pill, before entries */
|
|
705
|
-
addonX?: number;
|
|
706
|
-
}
|
|
707
|
-
interface LegendControlLayout {
|
|
708
|
-
id: string;
|
|
709
|
-
x: number;
|
|
710
|
-
y: number;
|
|
711
|
-
width: number;
|
|
712
|
-
height: number;
|
|
713
|
-
icon: string;
|
|
714
|
-
label?: string;
|
|
715
|
-
exportBehavior: LegendControlExportBehavior;
|
|
716
|
-
children?: Array<{
|
|
717
|
-
id: string;
|
|
718
|
-
label: string;
|
|
719
|
-
x: number;
|
|
720
|
-
y: number;
|
|
721
|
-
width: number;
|
|
722
|
-
isActive?: boolean;
|
|
723
|
-
}>;
|
|
724
|
-
}
|
|
725
|
-
interface ControlsGroupToggleLayout {
|
|
726
|
-
id: string;
|
|
727
|
-
label: string;
|
|
728
|
-
active: boolean;
|
|
729
|
-
dotCx: number;
|
|
730
|
-
dotCy: number;
|
|
731
|
-
textX: number;
|
|
732
|
-
textY: number;
|
|
733
|
-
}
|
|
734
|
-
interface ControlsGroupLayout {
|
|
735
|
-
x: number;
|
|
736
|
-
y: number;
|
|
737
|
-
width: number;
|
|
738
|
-
height: number;
|
|
739
|
-
expanded: boolean;
|
|
740
|
-
/** The gear pill layout (collapsed or inside capsule) */
|
|
741
|
-
pill: {
|
|
742
|
-
x: number;
|
|
743
|
-
y: number;
|
|
744
|
-
width: number;
|
|
745
|
-
height: number;
|
|
746
|
-
};
|
|
747
|
-
/** Toggle entries (only present when expanded) */
|
|
748
|
-
toggles: ControlsGroupToggleLayout[];
|
|
749
|
-
}
|
|
750
|
-
interface LegendRowLayout {
|
|
751
|
-
y: number;
|
|
752
|
-
items: Array<LegendPillLayout | LegendCapsuleLayout | LegendControlLayout>;
|
|
753
|
-
}
|
|
754
|
-
interface LegendLayout {
|
|
755
|
-
/** Total computed height including all rows */
|
|
756
|
-
height: number;
|
|
757
|
-
/** Total computed width */
|
|
758
|
-
width: number;
|
|
759
|
-
/** Rows of legend elements (pills wrap to new rows on overflow) */
|
|
760
|
-
rows: LegendRowLayout[];
|
|
761
|
-
/** Active capsule layout (if any group is active) */
|
|
762
|
-
activeCapsule?: LegendCapsuleLayout;
|
|
763
|
-
/** Control layouts (right-aligned) */
|
|
764
|
-
controls: LegendControlLayout[];
|
|
765
|
-
/** All pill layouts (collapsed groups) */
|
|
766
|
-
pills: LegendPillLayout[];
|
|
767
|
-
/** Controls group layout (gear pill / capsule) */
|
|
768
|
-
controlsGroup?: ControlsGroupLayout;
|
|
769
|
-
}
|
|
770
|
-
interface LegendHandle {
|
|
771
|
-
setState: (state: LegendState) => void;
|
|
772
|
-
destroy: () => void;
|
|
773
|
-
getHeight: () => number;
|
|
774
|
-
getLayout: () => LegendLayout;
|
|
775
|
-
}
|
|
776
|
-
type D3Sel = Selection<any, unknown, any, unknown>;
|
|
124
|
+
declare const palettes: {
|
|
125
|
+
readonly nord: PaletteConfig;
|
|
126
|
+
readonly catppuccin: PaletteConfig;
|
|
127
|
+
readonly solarized: PaletteConfig;
|
|
128
|
+
readonly gruvbox: PaletteConfig;
|
|
129
|
+
readonly tokyoNight: PaletteConfig;
|
|
130
|
+
readonly oneDark: PaletteConfig;
|
|
131
|
+
readonly rosePine: PaletteConfig;
|
|
132
|
+
readonly dracula: PaletteConfig;
|
|
133
|
+
readonly monokai: PaletteConfig;
|
|
134
|
+
readonly bold: PaletteConfig;
|
|
135
|
+
};
|
|
777
136
|
|
|
778
|
-
interface
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
surface: string;
|
|
789
|
-
text: string;
|
|
790
|
-
textMuted: string;
|
|
791
|
-
};
|
|
792
|
-
isDark: boolean;
|
|
793
|
-
containerWidth: number;
|
|
794
|
-
/** Grid left offset as percentage (e.g. 12 for '12%'). Centers legend over plot area. */
|
|
795
|
-
gridLeftPct?: number;
|
|
796
|
-
/** Grid right offset as percentage (e.g. 4 for '4%'). Centers legend over plot area. */
|
|
797
|
-
gridRightPct?: number;
|
|
798
|
-
activeGroup?: string | null;
|
|
799
|
-
className?: string;
|
|
137
|
+
interface RenderOptions {
|
|
138
|
+
theme?: Theme;
|
|
139
|
+
palette?: PaletteConfig;
|
|
140
|
+
/**
|
|
141
|
+
* How to handle parse errors:
|
|
142
|
+
* 'svg' — render an inline error SVG (default)
|
|
143
|
+
* 'silent' — return empty svg + diagnostics; caller handles UI
|
|
144
|
+
* 'throw' — throw an Error with the diagnostics
|
|
145
|
+
*/
|
|
146
|
+
onError?: 'svg' | 'silent' | 'throw';
|
|
800
147
|
}
|
|
801
|
-
interface
|
|
148
|
+
interface RenderResult {
|
|
802
149
|
svg: string;
|
|
803
|
-
height: number;
|
|
804
|
-
/** Natural content width (px). Callers can use this for CSS-based centering. */
|
|
805
|
-
width: number;
|
|
806
|
-
}
|
|
807
|
-
declare function renderLegendSvg(groups: LegendGroupData[], options: LegendRenderOptions): LegendRenderResult;
|
|
808
|
-
declare function renderLegendSvgFromConfig(config: LegendConfig, state: LegendState, palette: LegendPalette & {
|
|
809
|
-
isDark: boolean;
|
|
810
|
-
}, containerWidth: number): LegendRenderResult;
|
|
811
|
-
|
|
812
|
-
type ExtendedChartType = 'sankey' | 'chord' | 'function' | 'scatter' | 'heatmap' | 'funnel';
|
|
813
|
-
interface ExtendedChartDataPoint {
|
|
814
|
-
label: string;
|
|
815
|
-
value: number;
|
|
816
|
-
color?: string;
|
|
817
|
-
lineNumber: number;
|
|
818
|
-
}
|
|
819
|
-
interface ParsedSankeyLink {
|
|
820
|
-
source: string;
|
|
821
|
-
target: string;
|
|
822
|
-
value: number;
|
|
823
|
-
color?: string;
|
|
824
|
-
directed?: boolean;
|
|
825
|
-
lineNumber: number;
|
|
826
|
-
}
|
|
827
|
-
interface ParsedFunction {
|
|
828
|
-
name: string;
|
|
829
|
-
expression: string;
|
|
830
|
-
color?: string;
|
|
831
|
-
lineNumber: number;
|
|
832
|
-
}
|
|
833
|
-
interface ParsedScatterPoint {
|
|
834
|
-
name: string;
|
|
835
|
-
x: number;
|
|
836
|
-
y: number;
|
|
837
|
-
size?: number;
|
|
838
|
-
color?: string;
|
|
839
|
-
category?: string;
|
|
840
|
-
lineNumber: number;
|
|
841
|
-
}
|
|
842
|
-
interface ParsedHeatmapRow {
|
|
843
|
-
label: string;
|
|
844
|
-
values: number[];
|
|
845
|
-
lineNumber: number;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
interface ParsedExtendedChart {
|
|
849
|
-
type: ExtendedChartType;
|
|
850
|
-
title?: string;
|
|
851
|
-
titleLineNumber?: number;
|
|
852
|
-
series?: string;
|
|
853
|
-
seriesLineNumber?: number;
|
|
854
|
-
seriesNames?: string[];
|
|
855
|
-
seriesNameLineNumbers?: number[];
|
|
856
|
-
seriesNameColors?: (string | undefined)[];
|
|
857
|
-
data: ExtendedChartDataPoint[];
|
|
858
|
-
links?: ParsedSankeyLink[];
|
|
859
|
-
functions?: ParsedFunction[];
|
|
860
|
-
scatterPoints?: ParsedScatterPoint[];
|
|
861
|
-
heatmapRows?: ParsedHeatmapRow[];
|
|
862
|
-
columns?: string[];
|
|
863
|
-
rows?: string[];
|
|
864
|
-
xRange?: {
|
|
865
|
-
min: number;
|
|
866
|
-
max: number;
|
|
867
|
-
};
|
|
868
|
-
xlabel?: string;
|
|
869
|
-
xlabelLineNumber?: number;
|
|
870
|
-
ylabel?: string;
|
|
871
|
-
ylabelLineNumber?: number;
|
|
872
|
-
sizelabel?: string;
|
|
873
|
-
noName?: boolean;
|
|
874
|
-
noValue?: boolean;
|
|
875
|
-
noPercent?: boolean;
|
|
876
|
-
shade?: boolean;
|
|
877
|
-
/** Render with full intent saturation instead of the canonical 25% tint. */
|
|
878
|
-
solidFill?: boolean;
|
|
879
|
-
/** Cross-chart-type: when true, the renderer suppresses the chart title. */
|
|
880
|
-
noTitle?: boolean;
|
|
881
|
-
categoryColors?: Record<string, string>;
|
|
882
|
-
categoryLineNumbers?: Record<string, number>;
|
|
883
|
-
nodeColors?: Record<string, string>;
|
|
884
150
|
diagnostics: DgmoError[];
|
|
885
|
-
error: string | null;
|
|
886
151
|
}
|
|
887
|
-
|
|
888
152
|
/**
|
|
889
|
-
*
|
|
153
|
+
* Render DGMO source to an SVG string.
|
|
890
154
|
*
|
|
891
|
-
*
|
|
892
|
-
* ```
|
|
893
|
-
*
|
|
894
|
-
* xlabel Weight
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { render, palettes, themes } from '@diagrammo/dgmo';
|
|
895
158
|
*
|
|
896
|
-
*
|
|
897
|
-
*
|
|
159
|
+
* const { svg } = await render(text, {
|
|
160
|
+
* palette: palettes.catppuccin,
|
|
161
|
+
* theme: themes.dark,
|
|
162
|
+
* });
|
|
163
|
+
* document.getElementById('chart').innerHTML = svg;
|
|
898
164
|
* ```
|
|
899
165
|
*/
|
|
900
|
-
declare function
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Extracts legend group data from standard chart types (multi-line, bar-stacked).
|
|
909
|
-
* Returns empty array if chart has no multi-series legend.
|
|
910
|
-
*/
|
|
911
|
-
declare function getSimpleChartLegendGroups(parsed: ParsedChart, colors: string[]): LegendGroupData[];
|
|
912
|
-
/**
|
|
913
|
-
* Extracts legend group data from extended chart types.
|
|
914
|
-
* Supports scatter (categories), chord (nodes), and function (series).
|
|
915
|
-
*/
|
|
916
|
-
declare function getExtendedChartLegendGroups(parsed: ParsedExtendedChart, colors: string[]): LegendGroupData[];
|
|
917
|
-
interface ScatterLabelPoint {
|
|
918
|
-
name: string;
|
|
919
|
-
px: number;
|
|
920
|
-
py: number;
|
|
921
|
-
color: string;
|
|
922
|
-
size?: number;
|
|
166
|
+
declare function render(text: string, options?: RenderOptions): Promise<RenderResult>;
|
|
167
|
+
|
|
168
|
+
interface EncodeDiagramUrlOptions {
|
|
169
|
+
baseUrl?: string;
|
|
170
|
+
palette?: PaletteConfig;
|
|
171
|
+
theme?: Theme;
|
|
172
|
+
filename?: string;
|
|
923
173
|
}
|
|
924
174
|
/**
|
|
925
|
-
*
|
|
926
|
-
*
|
|
927
|
-
* Pure function — no ECharts instance dependency.
|
|
928
|
-
*
|
|
929
|
-
* @param bg - chart background color, used for label background rects that mask connector lines
|
|
930
|
-
*/
|
|
931
|
-
declare function computeScatterLabelGraphics(points: ScatterLabelPoint[], chartBounds: {
|
|
932
|
-
top: number;
|
|
933
|
-
bottom: number;
|
|
934
|
-
}, fontSize: number, symbolSize: number, bg?: string): Record<string, unknown>[];
|
|
935
|
-
/**
|
|
936
|
-
* Converts a ParsedChart into an EChartsOption.
|
|
937
|
-
* Handles standard chart types: bar, line, area, pie, doughnut, radar, polar-area, bar-stacked, multi-line.
|
|
938
|
-
* @param parsed - Result of parseChart()
|
|
939
|
-
*/
|
|
940
|
-
declare function buildSimpleChartOption(parsed: ParsedChart, palette: PaletteColors, isDark: boolean, chartWidth?: number): EChartsOption;
|
|
941
|
-
/**
|
|
942
|
-
* Renders an extended chart (scatter, sankey, chord, function, heatmap, funnel) to SVG using server-side rendering.
|
|
943
|
-
* Mirrors the `renderForExport` API — returns an SVG string or empty string on failure.
|
|
175
|
+
* Encode DGMO text into a shareable URL. Returns null if the compressed
|
|
176
|
+
* payload exceeds the 8 KB URL limit.
|
|
944
177
|
*/
|
|
945
|
-
declare function
|
|
946
|
-
|
|
947
|
-
interface D3ExportDimensions {
|
|
948
|
-
width?: number;
|
|
949
|
-
height?: number;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
/** A single entry inside a tag group: `Value(color)` */
|
|
953
|
-
interface TagEntry {
|
|
954
|
-
value: string;
|
|
955
|
-
color: string;
|
|
956
|
-
lineNumber: number;
|
|
957
|
-
}
|
|
958
|
-
/** A tag group block: heading + entries */
|
|
959
|
-
interface TagGroup {
|
|
960
|
-
name: string;
|
|
961
|
-
alias?: string;
|
|
962
|
-
entries: TagEntry[];
|
|
963
|
-
/** Default value for nodes without explicit metadata. First entry unless another is marked `default`. */
|
|
964
|
-
defaultValue?: string;
|
|
965
|
-
lineNumber: number;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
type VisualizationType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence' | 'tech-radar' | 'cycle' | 'pyramid' | 'ring';
|
|
969
|
-
interface D3DataItem {
|
|
970
|
-
label: string;
|
|
971
|
-
values: number[];
|
|
972
|
-
color: string | null;
|
|
973
|
-
lineNumber: number;
|
|
974
|
-
}
|
|
975
|
-
interface WordCloudWord {
|
|
976
|
-
text: string;
|
|
977
|
-
weight: number;
|
|
978
|
-
lineNumber: number;
|
|
979
|
-
}
|
|
980
|
-
type WordCloudRotate = 'none' | 'mixed' | 'angled';
|
|
981
|
-
interface WordCloudOptions {
|
|
982
|
-
rotate: WordCloudRotate;
|
|
983
|
-
max: number;
|
|
984
|
-
minSize: number;
|
|
985
|
-
maxSize: number;
|
|
986
|
-
}
|
|
987
|
-
interface ArcLink {
|
|
988
|
-
source: string;
|
|
989
|
-
target: string;
|
|
990
|
-
value: number;
|
|
991
|
-
color: string | null;
|
|
992
|
-
lineNumber: number;
|
|
993
|
-
}
|
|
994
|
-
type ArcOrder = 'appearance' | 'name' | 'group' | 'degree';
|
|
995
|
-
interface ArcNodeGroup {
|
|
996
|
-
name: string;
|
|
997
|
-
nodes: string[];
|
|
998
|
-
color: string | null;
|
|
999
|
-
lineNumber: number;
|
|
1000
|
-
}
|
|
1001
|
-
type TimelineSort = 'time' | 'group' | 'tag';
|
|
1002
|
-
interface TimelineEvent {
|
|
1003
|
-
date: string;
|
|
1004
|
-
endDate: string | null;
|
|
1005
|
-
label: string;
|
|
1006
|
-
group: string | null;
|
|
1007
|
-
metadata: Record<string, string>;
|
|
1008
|
-
lineNumber: number;
|
|
1009
|
-
uncertain?: boolean;
|
|
1010
|
-
}
|
|
1011
|
-
interface TimelineGroup {
|
|
1012
|
-
name: string;
|
|
1013
|
-
color: string | null;
|
|
1014
|
-
lineNumber: number;
|
|
1015
|
-
}
|
|
1016
|
-
interface TimelineEra {
|
|
1017
|
-
startDate: string;
|
|
1018
|
-
endDate: string;
|
|
1019
|
-
label: string;
|
|
1020
|
-
color: string | null;
|
|
1021
|
-
lineNumber: number;
|
|
1022
|
-
}
|
|
1023
|
-
interface TimelineMarker {
|
|
1024
|
-
date: string;
|
|
1025
|
-
label: string;
|
|
1026
|
-
color: string | null;
|
|
1027
|
-
lineNumber: number;
|
|
1028
|
-
}
|
|
1029
|
-
interface VennSet {
|
|
1030
|
-
name: string;
|
|
1031
|
-
alias: string | null;
|
|
1032
|
-
color: string | null;
|
|
1033
|
-
lineNumber: number;
|
|
1034
|
-
}
|
|
1035
|
-
interface VennOverlap {
|
|
1036
|
-
sets: string[];
|
|
1037
|
-
label: string | null;
|
|
1038
|
-
lineNumber: number;
|
|
1039
|
-
}
|
|
1040
|
-
interface QuadrantLabel {
|
|
178
|
+
declare function encodeDiagramUrl(text: string, options?: EncodeDiagramUrlOptions): string | null;
|
|
179
|
+
interface DecodedDiagramUrl {
|
|
1041
180
|
text: string;
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
interface QuadrantPoint {
|
|
1046
|
-
label: string;
|
|
1047
|
-
x: number;
|
|
1048
|
-
y: number;
|
|
1049
|
-
lineNumber: number;
|
|
1050
|
-
}
|
|
1051
|
-
interface QuadrantLabels {
|
|
1052
|
-
topRight: QuadrantLabel | null;
|
|
1053
|
-
topLeft: QuadrantLabel | null;
|
|
1054
|
-
bottomLeft: QuadrantLabel | null;
|
|
1055
|
-
bottomRight: QuadrantLabel | null;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
interface ParsedVisualization {
|
|
1059
|
-
type: VisualizationType | null;
|
|
1060
|
-
title: string | null;
|
|
1061
|
-
titleLineNumber: number | null;
|
|
1062
|
-
orientation: 'horizontal' | 'vertical';
|
|
1063
|
-
periods: string[];
|
|
1064
|
-
data: D3DataItem[];
|
|
1065
|
-
words: WordCloudWord[];
|
|
1066
|
-
cloudOptions: WordCloudOptions;
|
|
1067
|
-
links: ArcLink[];
|
|
1068
|
-
arcOrder: ArcOrder;
|
|
1069
|
-
arcNodeGroups: ArcNodeGroup[];
|
|
1070
|
-
timelineEvents: TimelineEvent[];
|
|
1071
|
-
timelineGroups: TimelineGroup[];
|
|
1072
|
-
timelineEras: TimelineEra[];
|
|
1073
|
-
timelineMarkers: TimelineMarker[];
|
|
1074
|
-
timelineTagGroups: TagGroup[];
|
|
1075
|
-
timelineSort: TimelineSort;
|
|
1076
|
-
timelineDefaultSwimlaneTG?: string;
|
|
1077
|
-
timelineScale: boolean;
|
|
1078
|
-
timelineSwimlanes: boolean;
|
|
1079
|
-
vennSets: VennSet[];
|
|
1080
|
-
vennOverlaps: VennOverlap[];
|
|
1081
|
-
quadrantLabels: QuadrantLabels;
|
|
1082
|
-
quadrantPoints: QuadrantPoint[];
|
|
1083
|
-
quadrantXAxis: [string, string] | null;
|
|
1084
|
-
quadrantXAxisLineNumber: number | null;
|
|
1085
|
-
quadrantYAxis: [string, string] | null;
|
|
1086
|
-
quadrantYAxisLineNumber: number | null;
|
|
1087
|
-
quadrantTitleLineNumber: number | null;
|
|
1088
|
-
noName?: boolean;
|
|
1089
|
-
noValue?: boolean;
|
|
1090
|
-
noPercent?: boolean;
|
|
1091
|
-
/** Render with full intent saturation instead of the canonical 25% tint. */
|
|
1092
|
-
solidFill?: boolean;
|
|
1093
|
-
/** Cross-chart-type: when true, the renderer suppresses the chart title. */
|
|
1094
|
-
noTitle?: boolean;
|
|
1095
|
-
diagnostics: DgmoError[];
|
|
1096
|
-
error: string | null;
|
|
181
|
+
palette?: PaletteConfig;
|
|
182
|
+
theme?: Theme;
|
|
183
|
+
filename?: string;
|
|
1097
184
|
}
|
|
1098
|
-
|
|
1099
|
-
/**
|
|
1100
|
-
* Converts a date string (YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DD HH:MM) to a fractional year number.
|
|
1101
|
-
*/
|
|
1102
|
-
declare function parseTimelineDate(s: string): number;
|
|
1103
|
-
/**
|
|
1104
|
-
* Adds a duration to a date string and returns the resulting date string.
|
|
1105
|
-
* Supports: d (days), w (weeks), m (months), y (years), h (hours), min (minutes)
|
|
1106
|
-
* Supports decimals up to 2 places (e.g., 1.25y = 1 year 3 months)
|
|
1107
|
-
* Preserves the precision of the input date (YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DD HH:MM).
|
|
1108
|
-
*/
|
|
1109
|
-
declare function addDurationToDate(startDate: string, amount: number, unit: 'd' | 'w' | 'm' | 'y' | 'h' | 'min'): string;
|
|
1110
|
-
/**
|
|
1111
|
-
* Parses D3 chart text format into structured data.
|
|
1112
|
-
*/
|
|
1113
|
-
declare function parseVisualization(content: string, palette?: PaletteColors): ParsedVisualization;
|
|
1114
|
-
/**
|
|
1115
|
-
* Renders a slope chart into the given container using D3.
|
|
1116
|
-
*/
|
|
1117
|
-
declare function renderSlopeChart(container: HTMLDivElement, parsed: ParsedVisualization, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
|
|
1118
|
-
/**
|
|
1119
|
-
* Orders arc diagram nodes based on the selected ordering strategy.
|
|
1120
|
-
*/
|
|
1121
|
-
declare function orderArcNodes(links: ArcLink[], order: ArcOrder, groups: ArcNodeGroup[]): string[];
|
|
1122
|
-
/**
|
|
1123
|
-
* Renders an arc diagram into the given container using D3.
|
|
1124
|
-
*/
|
|
1125
|
-
declare function renderArcDiagram(container: HTMLDivElement, parsed: ParsedVisualization, palette: PaletteColors, _isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
|
|
1126
|
-
/**
|
|
1127
|
-
* Converts a DSL date string (YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DD HH:MM) to a human-readable label.
|
|
1128
|
-
* '1718' → '1718'
|
|
1129
|
-
* '1718-05' → 'May 1718'
|
|
1130
|
-
* '1718-05-22' → 'May 22, 1718'
|
|
1131
|
-
* '2024-06-15 14:30' → 'Jun 15, 2024 14:30'
|
|
1132
|
-
*/
|
|
1133
|
-
declare function formatDateLabel(dateStr: string): string;
|
|
1134
185
|
/**
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*/
|
|
1138
|
-
declare function renderTimeline(container: HTMLDivElement, parsed: ParsedVisualization, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions, activeTagGroup?: string | null, swimlaneTagGroup?: string | null, onTagStateChange?: (activeTagGroup: string | null, swimlaneTagGroup: string | null) => void, viewMode?: boolean): void;
|
|
1139
|
-
/**
|
|
1140
|
-
* Renders a word cloud into the given container using d3-cloud.
|
|
1141
|
-
*/
|
|
1142
|
-
declare function renderWordCloud(container: HTMLDivElement, parsed: ParsedVisualization, palette: PaletteColors, _isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
|
|
1143
|
-
declare function renderVenn(container: HTMLDivElement, parsed: ParsedVisualization, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
|
|
1144
|
-
/**
|
|
1145
|
-
* Renders a quadrant chart using D3.
|
|
1146
|
-
* Displays 4 colored quadrant regions, axis labels, quadrant labels, and data points.
|
|
1147
|
-
*/
|
|
1148
|
-
declare function renderQuadrant(container: HTMLDivElement, parsed: ParsedVisualization, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
|
|
1149
|
-
/**
|
|
1150
|
-
* Renders a D3 chart to an SVG string for export.
|
|
1151
|
-
* Creates a detached DOM element, renders into it, extracts the SVG, then cleans up.
|
|
1152
|
-
*/
|
|
1153
|
-
declare function renderForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors, viewState?: CompactViewState, options?: {
|
|
1154
|
-
c4Level?: 'context' | 'containers' | 'components' | 'deployment';
|
|
1155
|
-
c4System?: string;
|
|
1156
|
-
c4Container?: string;
|
|
1157
|
-
tagGroup?: string;
|
|
1158
|
-
}): Promise<string>;
|
|
1159
|
-
|
|
1160
|
-
/**
|
|
1161
|
-
* Generates adaptive tick marks along a time axis.
|
|
1162
|
-
* Picks the right granularity (years, months, weeks, days, hours, minutes)
|
|
1163
|
-
* based on the domain span.
|
|
1164
|
-
*
|
|
1165
|
-
* Optional boundary parameters add ticks at exact data start/end:
|
|
1166
|
-
* - boundaryStart/boundaryEnd: numeric date values
|
|
1167
|
-
* - boundaryStartLabel/boundaryEndLabel: formatted labels for those dates
|
|
1168
|
-
*/
|
|
1169
|
-
declare function computeTimeTicks(domainMin: number, domainMax: number, scale: d3Scale.ScaleLinear<number, number>, boundaryStart?: number, boundaryEnd?: number, boundaryStartLabel?: string, boundaryEndLabel?: string): {
|
|
1170
|
-
pos: number;
|
|
1171
|
-
label: string;
|
|
1172
|
-
}[];
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
* Participant types that can be declared via "Name is a type" syntax.
|
|
1176
|
-
*/
|
|
1177
|
-
type ParticipantType = 'default' | 'service' | 'database' | 'actor' | 'queue' | 'cache' | 'gateway' | 'external' | 'networking' | 'frontend';
|
|
1178
|
-
/**
|
|
1179
|
-
* A declared or inferred participant in the sequence diagram.
|
|
1180
|
-
*/
|
|
1181
|
-
interface SequenceParticipant {
|
|
1182
|
-
/** Internal identifier (e.g. "AuthService") */
|
|
1183
|
-
id: string;
|
|
1184
|
-
/** Display label — first-seen casing/spacing of the name */
|
|
1185
|
-
label: string;
|
|
1186
|
-
/** Participant shape type */
|
|
1187
|
-
type: ParticipantType;
|
|
1188
|
-
/** Source line number (1-based) */
|
|
1189
|
-
lineNumber: number;
|
|
1190
|
-
/** Explicit layout position override (0-based from left, negative from right) */
|
|
1191
|
-
position?: number;
|
|
1192
|
-
/** Pipe-delimited tag metadata (e.g. `| role: Gateway`) */
|
|
1193
|
-
metadata?: Record<string, string>;
|
|
1194
|
-
}
|
|
1195
|
-
/**
|
|
1196
|
-
* A message between two participants.
|
|
1197
|
-
*/
|
|
1198
|
-
interface SequenceMessage {
|
|
1199
|
-
from: string;
|
|
1200
|
-
to: string;
|
|
1201
|
-
label: string;
|
|
1202
|
-
lineNumber: number;
|
|
1203
|
-
async?: boolean;
|
|
1204
|
-
/** Pipe-delimited tag metadata (e.g. `| c: Caching`) */
|
|
1205
|
-
metadata?: Record<string, string>;
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* A conditional or loop block in the sequence diagram.
|
|
1209
|
-
*/
|
|
1210
|
-
interface ElseIfBranch {
|
|
1211
|
-
label: string;
|
|
1212
|
-
children: SequenceElement[];
|
|
1213
|
-
lineNumber: number;
|
|
1214
|
-
}
|
|
1215
|
-
interface SequenceBlock {
|
|
1216
|
-
kind: 'block';
|
|
1217
|
-
type: 'if' | 'loop' | 'parallel';
|
|
1218
|
-
label: string;
|
|
1219
|
-
children: SequenceElement[];
|
|
1220
|
-
elseChildren: SequenceElement[];
|
|
1221
|
-
elseIfBranches?: ElseIfBranch[];
|
|
1222
|
-
elseLineNumber?: number;
|
|
1223
|
-
lineNumber: number;
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* A labeled horizontal divider between message phases.
|
|
1227
|
-
*/
|
|
1228
|
-
interface SequenceSection {
|
|
1229
|
-
kind: 'section';
|
|
1230
|
-
label: string;
|
|
1231
|
-
lineNumber: number;
|
|
1232
|
-
}
|
|
1233
|
-
/**
|
|
1234
|
-
* An annotation attached to a message, rendered as a folded-corner box.
|
|
1235
|
-
*/
|
|
1236
|
-
interface SequenceNote {
|
|
1237
|
-
kind: 'note';
|
|
1238
|
-
text: string;
|
|
1239
|
-
position: 'right' | 'left';
|
|
1240
|
-
participantId: string;
|
|
1241
|
-
lineNumber: number;
|
|
1242
|
-
endLineNumber: number;
|
|
1243
|
-
}
|
|
1244
|
-
type SequenceElement = SequenceMessage | SequenceBlock | SequenceSection | SequenceNote;
|
|
1245
|
-
declare function isSequenceBlock(el: SequenceElement): el is SequenceBlock;
|
|
1246
|
-
declare function isSequenceNote(el: SequenceElement): el is SequenceNote;
|
|
1247
|
-
/**
|
|
1248
|
-
* A named group of participants rendered as a labeled box.
|
|
1249
|
-
*/
|
|
1250
|
-
interface SequenceGroup {
|
|
1251
|
-
name: string;
|
|
1252
|
-
participantIds: string[];
|
|
1253
|
-
lineNumber: number;
|
|
1254
|
-
/** Pipe-delimited tag metadata (e.g. `[Backend | t: Product]`) */
|
|
1255
|
-
metadata?: Record<string, string>;
|
|
1256
|
-
/** Whether this group is collapsed by default */
|
|
1257
|
-
collapsed?: boolean;
|
|
1258
|
-
}
|
|
1259
|
-
/**
|
|
1260
|
-
* Parsed result from a .dgmo sequence diagram.
|
|
1261
|
-
*/
|
|
1262
|
-
interface ParsedSequenceDgmo {
|
|
1263
|
-
title: string | null;
|
|
1264
|
-
titleLineNumber: number | null;
|
|
1265
|
-
participants: SequenceParticipant[];
|
|
1266
|
-
messages: SequenceMessage[];
|
|
1267
|
-
elements: SequenceElement[];
|
|
1268
|
-
groups: SequenceGroup[];
|
|
1269
|
-
sections: SequenceSection[];
|
|
1270
|
-
tagGroups: TagGroup[];
|
|
1271
|
-
options: Record<string, string>;
|
|
1272
|
-
diagnostics: DgmoError[];
|
|
1273
|
-
error: string | null;
|
|
1274
|
-
}
|
|
1275
|
-
/**
|
|
1276
|
-
* Parse a .dgmo file with `chart: sequence` into a structured representation.
|
|
1277
|
-
*/
|
|
1278
|
-
declare function parseSequenceDgmo(content: string): ParsedSequenceDgmo;
|
|
1279
|
-
/**
|
|
1280
|
-
* Detect whether raw content looks like a sequence diagram.
|
|
1281
|
-
* Used by the chart type inference logic.
|
|
1282
|
-
*/
|
|
1283
|
-
declare function looksLikeSequence(content: string): boolean;
|
|
1284
|
-
|
|
1285
|
-
/**
|
|
1286
|
-
* Infer participant type from a name using the ordered rules table.
|
|
1287
|
-
* Returns 'default' if no rule matches.
|
|
1288
|
-
*/
|
|
1289
|
-
declare function inferParticipantType(name: string): ParticipantType;
|
|
1290
|
-
/**
|
|
1291
|
-
* Number of rules in the table. Exported for test assertions.
|
|
1292
|
-
*/
|
|
1293
|
-
declare const RULE_COUNT: number;
|
|
1294
|
-
|
|
1295
|
-
type GraphShape = 'terminal' | 'process' | 'decision' | 'io' | 'subroutine' | 'document' | 'state' | 'pseudostate';
|
|
1296
|
-
type GraphDirection = 'TB' | 'LR';
|
|
1297
|
-
interface GraphNode {
|
|
1298
|
-
id: string;
|
|
1299
|
-
label: string;
|
|
1300
|
-
shape: GraphShape;
|
|
1301
|
-
color?: string;
|
|
1302
|
-
group?: string;
|
|
1303
|
-
lineNumber: number;
|
|
1304
|
-
}
|
|
1305
|
-
interface GraphEdge {
|
|
1306
|
-
source: string;
|
|
1307
|
-
target: string;
|
|
1308
|
-
label?: string;
|
|
1309
|
-
color?: string;
|
|
1310
|
-
lineNumber: number;
|
|
1311
|
-
}
|
|
1312
|
-
interface GraphGroup {
|
|
1313
|
-
id: string;
|
|
1314
|
-
label: string;
|
|
1315
|
-
color?: string;
|
|
1316
|
-
nodeIds: string[];
|
|
1317
|
-
lineNumber: number;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
interface ParsedGraph {
|
|
1321
|
-
type: 'flowchart' | 'state';
|
|
1322
|
-
title?: string;
|
|
1323
|
-
titleLineNumber?: number;
|
|
1324
|
-
direction: GraphDirection;
|
|
1325
|
-
nodes: GraphNode[];
|
|
1326
|
-
edges: GraphEdge[];
|
|
1327
|
-
groups?: GraphGroup[];
|
|
1328
|
-
options: Record<string, string>;
|
|
1329
|
-
diagnostics: DgmoError[];
|
|
1330
|
-
error: string | null;
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Diagram symbol extraction API + completion registry.
|
|
1335
|
-
*
|
|
1336
|
-
* Provides:
|
|
1337
|
-
* - DiagramSymbols interface + extractDiagramSymbols() dispatch
|
|
1338
|
-
* - COMPLETION_REGISTRY: chart-type → directives map (for editor autocomplete)
|
|
1339
|
-
* - CHART_TYPES: array of { name, description } for chart type completion
|
|
1340
|
-
* - METADATA_KEY_SET: derived set of all known directive keys
|
|
1341
|
-
*
|
|
1342
|
-
* Each diagram type registers its own extractor via registerExtractor().
|
|
1343
|
-
* All built-in extractors are registered at module init below.
|
|
1344
|
-
*/
|
|
1345
|
-
type ChartType = string;
|
|
1346
|
-
interface DiagramSymbols {
|
|
1347
|
-
kind: ChartType;
|
|
1348
|
-
entities: string[];
|
|
1349
|
-
keywords: string[];
|
|
1350
|
-
/**
|
|
1351
|
-
* Map of alias-literal → canonical entity name, collected from
|
|
1352
|
-
* `Name as <alias>` declarations in the document. Editor surfaces
|
|
1353
|
-
* both forms in autocomplete; selecting an alias inserts the alias
|
|
1354
|
-
* literal (the alias is input convenience, not a display name).
|
|
1355
|
-
*/
|
|
1356
|
-
aliases?: Record<string, string>;
|
|
1357
|
-
}
|
|
1358
|
-
type ExtractFn = (docText: string) => DiagramSymbols;
|
|
1359
|
-
declare function registerExtractor(kind: ChartType, fn: ExtractFn): void;
|
|
1360
|
-
/**
|
|
1361
|
-
* Extract diagram symbols from document text.
|
|
1362
|
-
* Returns null if the chart type is unknown or has no registered extractor.
|
|
1363
|
-
*/
|
|
1364
|
-
declare function extractDiagramSymbols(docText: string): DiagramSymbols | null;
|
|
1365
|
-
/** Specification for a single directive: description + optional enumerated values. */
|
|
1366
|
-
interface DirectiveValueSpec {
|
|
1367
|
-
description: string;
|
|
1368
|
-
values?: string[];
|
|
1369
|
-
}
|
|
1370
|
-
/** Specification for a chart type's directives. */
|
|
1371
|
-
interface DirectiveSpec {
|
|
1372
|
-
directives: Record<string, DirectiveValueSpec>;
|
|
1373
|
-
}
|
|
1374
|
-
/** Chart-type → directive specifications. Every chart type has at least palette + theme. */
|
|
1375
|
-
declare const COMPLETION_REGISTRY: Map<string, DirectiveSpec>;
|
|
1376
|
-
/** All chart types with descriptions, for chart type autocomplete. Excludes `multi-line` alias. */
|
|
1377
|
-
declare const CHART_TYPES: ReadonlyArray<{
|
|
1378
|
-
name: string;
|
|
1379
|
-
description: string;
|
|
1380
|
-
}>;
|
|
1381
|
-
/**
|
|
1382
|
-
* Entity types for `Name is a <type>` declarations, keyed by chart type.
|
|
1383
|
-
* Values are sourced from parser constants (VALID_PARTICIPANT_TYPES,
|
|
1384
|
-
* C4_IS_A_RE).
|
|
1385
|
-
*/
|
|
1386
|
-
declare const ENTITY_TYPES: Map<string, string[]>;
|
|
1387
|
-
/** Specification for a single pipe metadata key. */
|
|
1388
|
-
interface PipeKeySpec {
|
|
1389
|
-
description: string;
|
|
1390
|
-
values?: string[];
|
|
1391
|
-
}
|
|
1392
|
-
/**
|
|
1393
|
-
* Pipe metadata keys for inline `| key value` on data lines.
|
|
1394
|
-
* Keyed by chart type → { context-name: keys }.
|
|
1395
|
-
*
|
|
1396
|
-
* Contexts are open-ended. The two universal ones are:
|
|
1397
|
-
* - `node` — the default for any non-arrow line
|
|
1398
|
-
* - `edge` — lines containing an arrow (`->`, `--`)
|
|
1399
|
-
*
|
|
1400
|
-
* Charts with richer line types declare additional contexts:
|
|
1401
|
-
* - raci: `role`, `phase`, `assignment`
|
|
1402
|
-
* - ring / pyramid: `layer`
|
|
1403
|
-
* - tech-radar: `quadrant`, `blip`
|
|
1404
|
-
* - journey-map: `step`
|
|
1405
|
-
*
|
|
1406
|
-
* IMPORTANT: NEVER add 'sequence' here. The `|` character in sequence
|
|
1407
|
-
* diagrams separates display names from identifiers and tag metadata.
|
|
1408
|
-
* Adding sequence would trigger false pipe-metadata completions on every `|`.
|
|
1409
|
-
*/
|
|
1410
|
-
type PipeContextMap = Record<string, Record<string, PipeKeySpec>>;
|
|
1411
|
-
declare const PIPE_METADATA: Map<string, PipeContextMap>;
|
|
1412
|
-
/** All known directive keys, derived from COMPLETION_REGISTRY. Includes implicit keys. */
|
|
1413
|
-
declare const METADATA_KEY_SET: ReadonlySet<string>;
|
|
1414
|
-
/**
|
|
1415
|
-
* Extract tag declarations from document text.
|
|
1416
|
-
* Returns a map of alias (or full name) → array of tag values.
|
|
1417
|
-
* Keys preserve original case for display; use case-insensitive lookup.
|
|
1418
|
-
*/
|
|
1419
|
-
declare function extractTagDeclarations(docText: string): Map<string, string[]>;
|
|
1420
|
-
|
|
1421
|
-
declare function parseFlowchart(content: string, palette?: PaletteColors): ParsedGraph;
|
|
1422
|
-
/**
|
|
1423
|
-
* Detect if content looks like a flowchart (without explicit `chart: flowchart` header).
|
|
1424
|
-
* Checks for shape delimiters combined with `->` arrows.
|
|
1425
|
-
* Avoids false-positives on sequence diagrams (which use bare names with `->`)
|
|
1426
|
-
*/
|
|
1427
|
-
declare function looksLikeFlowchart(content: string): boolean;
|
|
1428
|
-
|
|
1429
|
-
declare function parseState(content: string, palette?: PaletteColors): ParsedGraph;
|
|
1430
|
-
/**
|
|
1431
|
-
* Detect if content looks like a state diagram (without explicit `chart: state` header).
|
|
1432
|
-
* Only matches if `[*]` token is present — too ambiguous to infer from bare names alone.
|
|
1433
|
-
*/
|
|
1434
|
-
declare function looksLikeState(content: string): boolean;
|
|
1435
|
-
|
|
1436
|
-
interface LayoutNode {
|
|
1437
|
-
id: string;
|
|
1438
|
-
label: string;
|
|
1439
|
-
shape: GraphShape;
|
|
1440
|
-
color?: string;
|
|
1441
|
-
group?: string;
|
|
1442
|
-
lineNumber: number;
|
|
1443
|
-
x: number;
|
|
1444
|
-
y: number;
|
|
1445
|
-
width: number;
|
|
1446
|
-
height: number;
|
|
1447
|
-
}
|
|
1448
|
-
interface LayoutEdge {
|
|
1449
|
-
source: string;
|
|
1450
|
-
target: string;
|
|
1451
|
-
points: {
|
|
1452
|
-
x: number;
|
|
1453
|
-
y: number;
|
|
1454
|
-
}[];
|
|
1455
|
-
label?: string;
|
|
1456
|
-
color?: string;
|
|
1457
|
-
lineNumber: number;
|
|
1458
|
-
}
|
|
1459
|
-
interface LayoutGroup {
|
|
1460
|
-
id: string;
|
|
1461
|
-
label: string;
|
|
1462
|
-
color?: string;
|
|
1463
|
-
lineNumber: number;
|
|
1464
|
-
collapsed?: boolean;
|
|
1465
|
-
x: number;
|
|
1466
|
-
y: number;
|
|
1467
|
-
width: number;
|
|
1468
|
-
height: number;
|
|
1469
|
-
}
|
|
1470
|
-
interface LayoutOptions {
|
|
1471
|
-
/** Map of group ID → number of child nodes (for collapsed groups) */
|
|
1472
|
-
collapsedChildCounts?: Map<string, number>;
|
|
1473
|
-
/** Original groups before collapse (includes collapsed ones) */
|
|
1474
|
-
originalGroups?: GraphGroup[];
|
|
1475
|
-
}
|
|
1476
|
-
interface LayoutResult$1 {
|
|
1477
|
-
nodes: LayoutNode[];
|
|
1478
|
-
edges: LayoutEdge[];
|
|
1479
|
-
groups: LayoutGroup[];
|
|
1480
|
-
width: number;
|
|
1481
|
-
height: number;
|
|
1482
|
-
}
|
|
1483
|
-
declare function layoutGraph(graph: ParsedGraph, options?: LayoutOptions): LayoutResult$1;
|
|
1484
|
-
|
|
1485
|
-
declare function renderState(container: HTMLDivElement, graph: ParsedGraph, layout: LayoutResult$1, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
1486
|
-
width?: number;
|
|
1487
|
-
height?: number;
|
|
1488
|
-
}): void;
|
|
1489
|
-
declare function renderStateForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
1490
|
-
|
|
1491
|
-
interface StateCollapseResult {
|
|
1492
|
-
parsed: ParsedGraph;
|
|
1493
|
-
collapsedChildCounts: Map<string, number>;
|
|
1494
|
-
originalGroups: GraphGroup[];
|
|
1495
|
-
}
|
|
1496
|
-
/**
|
|
1497
|
-
* Pure transform: returns a new ParsedGraph with collapsed groups
|
|
1498
|
-
* removed from the diagram content.
|
|
1499
|
-
*
|
|
1500
|
-
* - Children of collapsed groups removed from nodes
|
|
1501
|
-
* - Edges redirected: endpoints in collapsed groups → group ID
|
|
1502
|
-
* - Internal edges (both in same collapsed group) dropped
|
|
1503
|
-
* - Duplicate edges (same source, target, label) deduplicated
|
|
1504
|
-
* - Collapsed groups removed from groups[] (layout handles as nodes)
|
|
1505
|
-
*/
|
|
1506
|
-
declare function collapseStateGroups(parsed: ParsedGraph, collapsedGroups: Set<string>): StateCollapseResult;
|
|
1507
|
-
|
|
1508
|
-
type ClassModifier = 'abstract' | 'interface' | 'enum';
|
|
1509
|
-
type MemberVisibility = 'public' | 'private' | 'protected';
|
|
1510
|
-
type RelationshipType = 'extends' | 'implements' | 'composes' | 'aggregates' | 'depends' | 'associates';
|
|
1511
|
-
interface ClassMember {
|
|
1512
|
-
name: string;
|
|
1513
|
-
type?: string;
|
|
1514
|
-
params?: string;
|
|
1515
|
-
visibility: MemberVisibility;
|
|
1516
|
-
isStatic: boolean;
|
|
1517
|
-
isMethod: boolean;
|
|
1518
|
-
lineNumber: number;
|
|
1519
|
-
}
|
|
1520
|
-
interface ClassNode {
|
|
1521
|
-
id: string;
|
|
1522
|
-
name: string;
|
|
1523
|
-
modifier?: ClassModifier;
|
|
1524
|
-
color?: string;
|
|
1525
|
-
members: ClassMember[];
|
|
1526
|
-
lineNumber: number;
|
|
1527
|
-
}
|
|
1528
|
-
interface ClassRelationship {
|
|
1529
|
-
source: string;
|
|
1530
|
-
target: string;
|
|
1531
|
-
type: RelationshipType;
|
|
1532
|
-
label?: string;
|
|
1533
|
-
lineNumber: number;
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
interface ParsedClassDiagram {
|
|
1537
|
-
type: 'class';
|
|
1538
|
-
title?: string;
|
|
1539
|
-
titleLineNumber?: number;
|
|
1540
|
-
classes: ClassNode[];
|
|
1541
|
-
relationships: ClassRelationship[];
|
|
1542
|
-
options: Record<string, string>;
|
|
1543
|
-
diagnostics: DgmoError[];
|
|
1544
|
-
error: string | null;
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
declare function parseClassDiagram(content: string, palette?: PaletteColors): ParsedClassDiagram;
|
|
1548
|
-
/**
|
|
1549
|
-
* Detect if content looks like a class diagram without explicit `chart: class`.
|
|
1550
|
-
* Requires class-like patterns (capitalized names with modifiers or UML relationships).
|
|
1551
|
-
* Must not false-positive on flowcharts.
|
|
1552
|
-
*/
|
|
1553
|
-
declare function looksLikeClassDiagram(content: string): boolean;
|
|
1554
|
-
|
|
1555
|
-
interface ClassLayoutNode extends ClassNode {
|
|
1556
|
-
x: number;
|
|
1557
|
-
y: number;
|
|
1558
|
-
width: number;
|
|
1559
|
-
height: number;
|
|
1560
|
-
headerHeight: number;
|
|
1561
|
-
fieldsHeight: number;
|
|
1562
|
-
methodsHeight: number;
|
|
1563
|
-
}
|
|
1564
|
-
interface ClassLayoutEdge {
|
|
1565
|
-
source: string;
|
|
1566
|
-
target: string;
|
|
1567
|
-
type: RelationshipType;
|
|
1568
|
-
points: {
|
|
1569
|
-
x: number;
|
|
1570
|
-
y: number;
|
|
1571
|
-
}[];
|
|
1572
|
-
label?: string;
|
|
1573
|
-
lineNumber: number;
|
|
1574
|
-
}
|
|
1575
|
-
interface ClassLayoutResult {
|
|
1576
|
-
nodes: ClassLayoutNode[];
|
|
1577
|
-
edges: ClassLayoutEdge[];
|
|
1578
|
-
width: number;
|
|
1579
|
-
height: number;
|
|
1580
|
-
}
|
|
1581
|
-
declare function layoutClassDiagram(parsed: ParsedClassDiagram): ClassLayoutResult;
|
|
1582
|
-
|
|
1583
|
-
declare function renderClassDiagram(container: HTMLDivElement, parsed: ParsedClassDiagram, layout: ClassLayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
1584
|
-
width?: number;
|
|
1585
|
-
height?: number;
|
|
1586
|
-
}, legendActive?: boolean | null): void;
|
|
1587
|
-
declare function renderClassDiagramForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
1588
|
-
|
|
1589
|
-
type ERConstraint = 'pk' | 'fk' | 'unique' | 'nullable';
|
|
1590
|
-
type ERCardinality = '1' | '*' | '?';
|
|
1591
|
-
interface ERColumn {
|
|
1592
|
-
name: string;
|
|
1593
|
-
type?: string;
|
|
1594
|
-
constraints: ERConstraint[];
|
|
1595
|
-
lineNumber: number;
|
|
1596
|
-
}
|
|
1597
|
-
interface ERTable {
|
|
1598
|
-
id: string;
|
|
1599
|
-
name: string;
|
|
1600
|
-
color?: string;
|
|
1601
|
-
columns: ERColumn[];
|
|
1602
|
-
metadata: Record<string, string>;
|
|
1603
|
-
lineNumber: number;
|
|
1604
|
-
}
|
|
1605
|
-
interface ERRelationship {
|
|
1606
|
-
source: string;
|
|
1607
|
-
target: string;
|
|
1608
|
-
cardinality: {
|
|
1609
|
-
from: ERCardinality;
|
|
1610
|
-
to: ERCardinality;
|
|
1611
|
-
};
|
|
1612
|
-
label?: string;
|
|
1613
|
-
lineNumber: number;
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
interface ParsedERDiagram {
|
|
1617
|
-
type: 'er';
|
|
1618
|
-
title?: string;
|
|
1619
|
-
titleLineNumber?: number;
|
|
1620
|
-
options: Record<string, string>;
|
|
1621
|
-
tables: ERTable[];
|
|
1622
|
-
relationships: ERRelationship[];
|
|
1623
|
-
tagGroups: TagGroup[];
|
|
1624
|
-
diagnostics: DgmoError[];
|
|
1625
|
-
error: string | null;
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
declare function parseERDiagram(content: string, palette?: PaletteColors): ParsedERDiagram;
|
|
1629
|
-
/**
|
|
1630
|
-
* Detect if content looks like an ER diagram without explicit `er` first line.
|
|
1631
|
-
* Looks for indented lines with pk or fk constraint keywords.
|
|
1632
|
-
*/
|
|
1633
|
-
declare function looksLikeERDiagram(content: string): boolean;
|
|
1634
|
-
|
|
1635
|
-
interface ERLayoutNode extends ERTable {
|
|
1636
|
-
x: number;
|
|
1637
|
-
y: number;
|
|
1638
|
-
width: number;
|
|
1639
|
-
height: number;
|
|
1640
|
-
headerHeight: number;
|
|
1641
|
-
columnsHeight: number;
|
|
1642
|
-
}
|
|
1643
|
-
interface ERLayoutEdge {
|
|
1644
|
-
source: string;
|
|
1645
|
-
target: string;
|
|
1646
|
-
cardinality: {
|
|
1647
|
-
from: string;
|
|
1648
|
-
to: string;
|
|
1649
|
-
};
|
|
1650
|
-
points: {
|
|
1651
|
-
x: number;
|
|
1652
|
-
y: number;
|
|
1653
|
-
}[];
|
|
1654
|
-
label?: string;
|
|
1655
|
-
lineNumber: number;
|
|
1656
|
-
}
|
|
1657
|
-
interface ERLayoutResult {
|
|
1658
|
-
nodes: ERLayoutNode[];
|
|
1659
|
-
edges: ERLayoutEdge[];
|
|
1660
|
-
width: number;
|
|
1661
|
-
height: number;
|
|
1662
|
-
}
|
|
1663
|
-
declare function layoutERDiagram(parsed: ParsedERDiagram): ERLayoutResult;
|
|
1664
|
-
|
|
1665
|
-
declare function renderERDiagram(container: HTMLDivElement, parsed: ParsedERDiagram, layout: ERLayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
1666
|
-
width?: number;
|
|
1667
|
-
height?: number;
|
|
1668
|
-
}, activeTagGroup?: string | null,
|
|
1669
|
-
/** When false, semantic role colors are suppressed and entities use a neutral color. */
|
|
1670
|
-
semanticColorsActive?: boolean): void;
|
|
1671
|
-
declare function renderERDiagramForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
1672
|
-
|
|
1673
|
-
interface InlineSpan {
|
|
1674
|
-
text: string;
|
|
1675
|
-
bold?: boolean;
|
|
1676
|
-
italic?: boolean;
|
|
1677
|
-
code?: boolean;
|
|
1678
|
-
href?: string;
|
|
1679
|
-
}
|
|
1680
|
-
declare function parseInlineMarkdown(text: string): InlineSpan[];
|
|
1681
|
-
declare function truncateBareUrl(url: string): string;
|
|
1682
|
-
|
|
1683
|
-
/**
|
|
1684
|
-
* Reduce a name to its canonical key for equality comparison.
|
|
1685
|
-
*
|
|
1686
|
-
* Idempotent: `normalizeName(normalizeName(x)) === normalizeName(x)`.
|
|
1687
|
-
*
|
|
1688
|
-
* The returned key is for equality only — never display it. Callers
|
|
1689
|
-
* that need to render a name should use the `displayLabel` field of
|
|
1690
|
-
* the `NameEntry` returned by `getOrCreateName`.
|
|
1691
|
-
*/
|
|
1692
|
-
declare function normalizeName(input: string): string;
|
|
1693
|
-
/**
|
|
1694
|
-
* Reduce a name to its display form: NFC normalize and trim only.
|
|
1695
|
-
*
|
|
1696
|
-
* Casing AND internal whitespace are preserved verbatim — the spec
|
|
1697
|
-
* says "first-seen casing/spacing wins for display" (ADR-002), so a
|
|
1698
|
-
* double space typed by the user survives into the rendered label.
|
|
1699
|
-
* Renderers may collapse it for layout, but the source-of-truth is
|
|
1700
|
-
* what the user typed.
|
|
1701
|
-
*
|
|
1702
|
-
* Two inputs that share the same `normalizeName(...)` key but have
|
|
1703
|
-
* different `displayName(...)` values are a "merge" — surfaced via
|
|
1704
|
-
* the `NAME_MERGED` diagnostic.
|
|
1705
|
-
*/
|
|
1706
|
-
declare function displayName(input: string): string;
|
|
1707
|
-
/**
|
|
1708
|
-
* One entity, identified by its normalized key.
|
|
1709
|
-
*
|
|
1710
|
-
* Parsers either use this shape directly in their entity Map or
|
|
1711
|
-
* compose it into a richer per-chart node type. Equality MUST use
|
|
1712
|
-
* only `normalizedKey`; rendering MUST use only `displayLabel`.
|
|
1713
|
-
*/
|
|
1714
|
-
interface NameEntry {
|
|
1715
|
-
/** Output of `normalizeName(input)` — the lookup key. */
|
|
1716
|
-
normalizedKey: string;
|
|
1717
|
-
/** First-seen casing/spacing — what gets rendered. */
|
|
1718
|
-
displayLabel: string;
|
|
1719
|
-
/** 1-based source line where the name was first declared. */
|
|
1720
|
-
declaredLine: number;
|
|
1721
|
-
}
|
|
1722
|
-
/**
|
|
1723
|
-
* Result of an entity insertion attempt.
|
|
1724
|
-
*
|
|
1725
|
-
* `created` is true on first sighting. `merged` is present iff the
|
|
1726
|
-
* input collided with an existing entry AND the displayed forms
|
|
1727
|
-
* differ — that is the case worth reporting via `NAME_MERGED`.
|
|
1728
|
-
* Identical re-declarations produce neither `created` nor `merged`.
|
|
1729
|
-
*/
|
|
1730
|
-
interface GetOrCreateNameResult {
|
|
1731
|
-
entry: NameEntry;
|
|
1732
|
-
created: boolean;
|
|
1733
|
-
merged?: {
|
|
1734
|
-
existingLine: number;
|
|
1735
|
-
existingDisplay: string;
|
|
1736
|
-
incomingDisplay: string;
|
|
1737
|
-
};
|
|
1738
|
-
}
|
|
1739
|
-
/**
|
|
1740
|
-
* Insert-or-fetch helper for `Map<normalizedKey, NameEntry>` stores.
|
|
1741
|
-
*
|
|
1742
|
-
* Parsers that need a richer node type (e.g. flowchart's `Node`
|
|
1743
|
-
* carries shape + edges) should wrap this helper: call it for the
|
|
1744
|
-
* normalization + merge-detection bookkeeping, then store the result
|
|
1745
|
-
* in their own `Map<normalizedKey, RichNode>`.
|
|
1746
|
-
*
|
|
1747
|
-
* When an `aliasStore` is provided, alias resolution runs FIRST: an
|
|
1748
|
-
* exact-match (case-sensitive) hit returns the bound canonical entry
|
|
1749
|
-
* untouched (the alias literal does NOT contribute to display or
|
|
1750
|
-
* merge bookkeeping). Misses fall through to UNH normalization.
|
|
1751
|
-
*/
|
|
1752
|
-
declare function getOrCreateName(input: string, store: Map<string, NameEntry>, lineNumber: number, aliasStore?: AliasMap): GetOrCreateNameResult;
|
|
1753
|
-
/** alias literal → bound canonical entry. Exact-match, case-sensitive. */
|
|
1754
|
-
type AliasMap = Map<string, NameEntry>;
|
|
1755
|
-
|
|
1756
|
-
interface OrgNode {
|
|
1757
|
-
id: string;
|
|
1758
|
-
label: string;
|
|
1759
|
-
metadata: Record<string, string>;
|
|
1760
|
-
children: OrgNode[];
|
|
1761
|
-
parentId: string | null;
|
|
1762
|
-
isContainer: boolean;
|
|
1763
|
-
lineNumber: number;
|
|
1764
|
-
color?: string;
|
|
1765
|
-
}
|
|
1766
|
-
interface ParsedOrg {
|
|
1767
|
-
title: string | null;
|
|
1768
|
-
titleLineNumber: number | null;
|
|
1769
|
-
roots: OrgNode[];
|
|
1770
|
-
tagGroups: TagGroup[];
|
|
1771
|
-
options: Record<string, string>;
|
|
1772
|
-
diagnostics: DgmoError[];
|
|
1773
|
-
error: string | null;
|
|
1774
|
-
}
|
|
1775
|
-
declare function parseOrg(content: string, palette?: PaletteColors): ParsedOrg;
|
|
1776
|
-
|
|
1777
|
-
interface OrgLayoutNode {
|
|
1778
|
-
id: string;
|
|
1779
|
-
label: string;
|
|
1780
|
-
metadata: Record<string, string>;
|
|
1781
|
-
/** Original (unfiltered) metadata — used for tag-based hover dimming even when the group is hidden */
|
|
1782
|
-
tagMetadata: Record<string, string>;
|
|
1783
|
-
isContainer: boolean;
|
|
1784
|
-
lineNumber: number;
|
|
1785
|
-
color?: string;
|
|
1786
|
-
x: number;
|
|
1787
|
-
y: number;
|
|
1788
|
-
width: number;
|
|
1789
|
-
height: number;
|
|
1790
|
-
/** Count of hidden descendants when this node is collapsed */
|
|
1791
|
-
hiddenCount?: number;
|
|
1792
|
-
/** True if node has children (expanded or collapsed) — drives toggle UI */
|
|
1793
|
-
hasChildren?: boolean;
|
|
1794
|
-
}
|
|
1795
|
-
interface OrgLayoutEdge {
|
|
1796
|
-
sourceId: string;
|
|
1797
|
-
targetId: string;
|
|
1798
|
-
points: {
|
|
1799
|
-
x: number;
|
|
1800
|
-
y: number;
|
|
1801
|
-
}[];
|
|
1802
|
-
}
|
|
1803
|
-
interface OrgContainerBounds {
|
|
1804
|
-
nodeId: string;
|
|
1805
|
-
label: string;
|
|
1806
|
-
lineNumber: number;
|
|
1807
|
-
color?: string;
|
|
1808
|
-
metadata: Record<string, string>;
|
|
1809
|
-
/** Original (unfiltered) metadata — used for tag-based hover dimming even when the group is hidden */
|
|
1810
|
-
tagMetadata: Record<string, string>;
|
|
1811
|
-
x: number;
|
|
1812
|
-
y: number;
|
|
1813
|
-
width: number;
|
|
1814
|
-
height: number;
|
|
1815
|
-
labelHeight: number;
|
|
1816
|
-
/** Count of hidden descendants when this container is collapsed */
|
|
1817
|
-
hiddenCount?: number;
|
|
1818
|
-
/** True if container has children (expanded or collapsed) — drives toggle UI */
|
|
1819
|
-
hasChildren?: boolean;
|
|
1820
|
-
}
|
|
1821
|
-
interface OrgLegendEntry {
|
|
1822
|
-
value: string;
|
|
1823
|
-
color: string;
|
|
1824
|
-
}
|
|
1825
|
-
interface OrgLegendGroup {
|
|
1826
|
-
name: string;
|
|
1827
|
-
alias?: string;
|
|
1828
|
-
entries: OrgLegendEntry[];
|
|
1829
|
-
x: number;
|
|
1830
|
-
y: number;
|
|
1831
|
-
width: number;
|
|
1832
|
-
height: number;
|
|
1833
|
-
minifiedWidth: number;
|
|
1834
|
-
minifiedHeight: number;
|
|
1835
|
-
}
|
|
1836
|
-
interface OrgLayoutResult {
|
|
1837
|
-
nodes: OrgLayoutNode[];
|
|
1838
|
-
edges: OrgLayoutEdge[];
|
|
1839
|
-
containers: OrgContainerBounds[];
|
|
1840
|
-
legend: OrgLegendGroup[];
|
|
1841
|
-
width: number;
|
|
1842
|
-
height: number;
|
|
1843
|
-
}
|
|
1844
|
-
declare function layoutOrg(parsed: ParsedOrg, hiddenCounts?: Map<string, number>, activeTagGroup?: string | null, hiddenAttributes?: Set<string>, expandAllLegend?: boolean): OrgLayoutResult;
|
|
1845
|
-
|
|
1846
|
-
interface CollapsedOrgResult {
|
|
1847
|
-
/** ParsedOrg with collapsed subtrees pruned (deep-cloned, never mutates original) */
|
|
1848
|
-
parsed: ParsedOrg;
|
|
1849
|
-
/** nodeId → count of hidden descendants */
|
|
1850
|
-
hiddenCounts: Map<string, number>;
|
|
1851
|
-
}
|
|
1852
|
-
interface AncestorInfo {
|
|
1853
|
-
id: string;
|
|
1854
|
-
label: string;
|
|
1855
|
-
lineNumber: number;
|
|
1856
|
-
color?: string;
|
|
1857
|
-
metadata: Record<string, string>;
|
|
1858
|
-
isContainer: boolean;
|
|
1859
|
-
}
|
|
1860
|
-
interface FocusOrgResult {
|
|
1861
|
-
/** ParsedOrg with only the focused subtree as the single root */
|
|
1862
|
-
parsed: ParsedOrg;
|
|
1863
|
-
/** Ancestor path from original root → parent of focused node (top-down order) */
|
|
1864
|
-
ancestorPath: AncestorInfo[];
|
|
1865
|
-
}
|
|
1866
|
-
declare function collapseOrgTree(original: ParsedOrg, collapsedIds: Set<string>): CollapsedOrgResult;
|
|
1867
|
-
/**
|
|
1868
|
-
* Extract a subtree rooted at `focusNodeId`, returning the focused tree
|
|
1869
|
-
* and the ancestor breadcrumb path. Returns null if the node is not found.
|
|
1870
|
-
*/
|
|
1871
|
-
declare function focusOrgTree(original: ParsedOrg, focusNodeId: string): FocusOrgResult | null;
|
|
1872
|
-
|
|
1873
|
-
declare function renderOrg(container: HTMLDivElement, parsed: ParsedOrg, layout: OrgLayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
1874
|
-
width?: number;
|
|
1875
|
-
height?: number;
|
|
1876
|
-
}, activeTagGroup?: string | null, hiddenAttributes?: Set<string>, ancestorPath?: AncestorInfo[]): void;
|
|
1877
|
-
declare function renderOrgForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
1878
|
-
|
|
1879
|
-
/** @deprecated Use `TagEntry` from `utils/tag-groups` */
|
|
1880
|
-
type KanbanTagEntry = TagEntry;
|
|
1881
|
-
/** @deprecated Use `TagGroup` from `utils/tag-groups` */
|
|
1882
|
-
type KanbanTagGroup = TagGroup;
|
|
1883
|
-
interface KanbanCard {
|
|
1884
|
-
id: string;
|
|
1885
|
-
title: string;
|
|
1886
|
-
tags: Record<string, string>;
|
|
1887
|
-
details: string[];
|
|
1888
|
-
lineNumber: number;
|
|
1889
|
-
endLineNumber: number;
|
|
1890
|
-
color?: string;
|
|
1891
|
-
}
|
|
1892
|
-
interface KanbanColumn {
|
|
1893
|
-
id: string;
|
|
1894
|
-
name: string;
|
|
1895
|
-
wipLimit?: number;
|
|
1896
|
-
color?: string;
|
|
1897
|
-
metadata?: Record<string, string>;
|
|
1898
|
-
cards: KanbanCard[];
|
|
1899
|
-
lineNumber: number;
|
|
1900
|
-
}
|
|
1901
|
-
interface ParsedKanban {
|
|
1902
|
-
type: 'kanban';
|
|
1903
|
-
title?: string;
|
|
1904
|
-
titleLineNumber?: number;
|
|
1905
|
-
columns: KanbanColumn[];
|
|
1906
|
-
tagGroups: KanbanTagGroup[];
|
|
1907
|
-
options: Record<string, string>;
|
|
1908
|
-
diagnostics: DgmoError[];
|
|
1909
|
-
error: string | null;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
declare function parseKanban(content: string, palette?: PaletteColors): ParsedKanban;
|
|
1913
|
-
|
|
1914
|
-
/**
|
|
1915
|
-
* Compute new file content after moving a card to a different position.
|
|
1916
|
-
*
|
|
1917
|
-
* @param content - original file content string
|
|
1918
|
-
* @param parsed - parsed kanban board
|
|
1919
|
-
* @param cardId - id of the card to move
|
|
1920
|
-
* @param targetColumnId - id of the destination column
|
|
1921
|
-
* @param targetIndex - position within target column (0 = first card)
|
|
1922
|
-
* @returns new content string, or null if move is invalid
|
|
1923
|
-
*/
|
|
1924
|
-
declare function computeCardMove(content: string, parsed: ParsedKanban, cardId: string, targetColumnId: string, targetIndex: number): string | null;
|
|
1925
|
-
/**
|
|
1926
|
-
* Move a card to the Archive section at the end of the file.
|
|
1927
|
-
* Creates `== Archive ==` if it doesn't exist.
|
|
1928
|
-
*
|
|
1929
|
-
* @returns new content string, or null if the card is not found
|
|
1930
|
-
*/
|
|
1931
|
-
declare function computeCardArchive(content: string, parsed: ParsedKanban, cardId: string): string | null;
|
|
1932
|
-
/** Check if a column name is the archive column (case-insensitive). */
|
|
1933
|
-
declare function isArchiveColumn(name: string): boolean;
|
|
1934
|
-
|
|
1935
|
-
interface KanbanInteractiveOptions {
|
|
1936
|
-
onNavigateToLine?: (line: number) => void;
|
|
1937
|
-
exportDims?: {
|
|
1938
|
-
width: number;
|
|
1939
|
-
height: number;
|
|
1940
|
-
};
|
|
1941
|
-
activeTagGroup?: string | null;
|
|
1942
|
-
currentSwimlaneGroup?: string | null;
|
|
1943
|
-
onSwimlaneChange?: (group: string | null) => void;
|
|
1944
|
-
collapsedLanes?: Set<string>;
|
|
1945
|
-
collapsedColumns?: Set<string>;
|
|
1946
|
-
compactMeta?: boolean;
|
|
1947
|
-
}
|
|
1948
|
-
declare function renderKanban(container: HTMLElement, parsed: ParsedKanban, palette: PaletteColors, isDark: boolean, options?: KanbanInteractiveOptions): void;
|
|
1949
|
-
declare function renderKanbanForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
1950
|
-
|
|
1951
|
-
/** @deprecated Use `TagEntry` from `utils/tag-groups` */
|
|
1952
|
-
type C4TagEntry = TagEntry;
|
|
1953
|
-
/** @deprecated Use `TagGroup` from `utils/tag-groups` */
|
|
1954
|
-
type C4TagGroup = TagGroup;
|
|
1955
|
-
type C4ElementType = 'person' | 'system' | 'container' | 'component';
|
|
1956
|
-
type C4Shape = 'default' | 'database' | 'cache' | 'queue' | 'cloud' | 'external';
|
|
1957
|
-
type C4ArrowType = 'sync' | 'async' | 'bidirectional' | 'bidirectional-async';
|
|
1958
|
-
interface C4Relationship {
|
|
1959
|
-
target: string;
|
|
1960
|
-
label?: string;
|
|
1961
|
-
technology?: string;
|
|
1962
|
-
arrowType: C4ArrowType;
|
|
1963
|
-
lineNumber: number;
|
|
1964
|
-
}
|
|
1965
|
-
interface C4Group {
|
|
1966
|
-
name: string;
|
|
1967
|
-
children: C4Element[];
|
|
1968
|
-
lineNumber: number;
|
|
1969
|
-
}
|
|
1970
|
-
interface C4Element {
|
|
1971
|
-
name: string;
|
|
1972
|
-
type: C4ElementType;
|
|
1973
|
-
shape: C4Shape;
|
|
1974
|
-
metadata: Record<string, string>;
|
|
1975
|
-
description?: string[];
|
|
1976
|
-
children: C4Element[];
|
|
1977
|
-
groups: C4Group[];
|
|
1978
|
-
relationships: C4Relationship[];
|
|
1979
|
-
importPath?: string;
|
|
1980
|
-
lineNumber: number;
|
|
1981
|
-
sectionHeader?: 'containers' | 'components';
|
|
1982
|
-
sectionHeaderLineNumber?: number;
|
|
1983
|
-
}
|
|
1984
|
-
interface C4DeploymentNode {
|
|
1985
|
-
name: string;
|
|
1986
|
-
metadata: Record<string, string>;
|
|
1987
|
-
shape: C4Shape;
|
|
1988
|
-
children: C4DeploymentNode[];
|
|
1989
|
-
containerRefs: string[];
|
|
1990
|
-
lineNumber: number;
|
|
1991
|
-
}
|
|
1992
|
-
interface ParsedC4 {
|
|
1993
|
-
title: string | null;
|
|
1994
|
-
titleLineNumber: number | null;
|
|
1995
|
-
options: Record<string, string>;
|
|
1996
|
-
tagGroups: TagGroup[];
|
|
1997
|
-
elements: C4Element[];
|
|
1998
|
-
relationships: C4Relationship[];
|
|
1999
|
-
deployment: C4DeploymentNode[];
|
|
2000
|
-
diagnostics: DgmoError[];
|
|
2001
|
-
error: string | null;
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
declare function parseC4(content: string, palette?: PaletteColors): ParsedC4;
|
|
2005
|
-
|
|
2006
|
-
interface C4LayoutNode {
|
|
2007
|
-
id: string;
|
|
2008
|
-
name: string;
|
|
2009
|
-
type: 'person' | 'system' | 'container' | 'component';
|
|
2010
|
-
description?: string;
|
|
2011
|
-
metadata: Record<string, string>;
|
|
2012
|
-
lineNumber: number;
|
|
2013
|
-
color?: string;
|
|
2014
|
-
shape?: C4Shape;
|
|
2015
|
-
technology?: string;
|
|
2016
|
-
drillable?: boolean;
|
|
2017
|
-
importPath?: string;
|
|
2018
|
-
x: number;
|
|
2019
|
-
y: number;
|
|
2020
|
-
width: number;
|
|
2021
|
-
height: number;
|
|
2022
|
-
}
|
|
2023
|
-
interface C4LayoutEdge {
|
|
2024
|
-
source: string;
|
|
2025
|
-
target: string;
|
|
2026
|
-
arrowType: C4ArrowType;
|
|
2027
|
-
label?: string;
|
|
2028
|
-
technology?: string;
|
|
2029
|
-
lineNumber: number;
|
|
2030
|
-
points: {
|
|
2031
|
-
x: number;
|
|
2032
|
-
y: number;
|
|
2033
|
-
}[];
|
|
2034
|
-
}
|
|
2035
|
-
interface C4LegendEntry {
|
|
2036
|
-
value: string;
|
|
2037
|
-
color: string;
|
|
2038
|
-
}
|
|
2039
|
-
interface C4LegendGroup {
|
|
2040
|
-
name: string;
|
|
2041
|
-
entries: C4LegendEntry[];
|
|
2042
|
-
x: number;
|
|
2043
|
-
y: number;
|
|
2044
|
-
width: number;
|
|
2045
|
-
height: number;
|
|
2046
|
-
}
|
|
2047
|
-
interface C4LayoutBoundary {
|
|
2048
|
-
label: string;
|
|
2049
|
-
typeLabel: string;
|
|
2050
|
-
lineNumber: number;
|
|
2051
|
-
x: number;
|
|
2052
|
-
y: number;
|
|
2053
|
-
width: number;
|
|
2054
|
-
height: number;
|
|
2055
|
-
}
|
|
2056
|
-
interface C4LayoutResult {
|
|
2057
|
-
nodes: C4LayoutNode[];
|
|
2058
|
-
edges: C4LayoutEdge[];
|
|
2059
|
-
legend: C4LegendGroup[];
|
|
2060
|
-
boundary?: C4LayoutBoundary;
|
|
2061
|
-
groupBoundaries: C4LayoutBoundary[];
|
|
2062
|
-
width: number;
|
|
2063
|
-
height: number;
|
|
2064
|
-
}
|
|
2065
|
-
interface ContextRelationship {
|
|
2066
|
-
sourceName: string;
|
|
2067
|
-
targetName: string;
|
|
2068
|
-
label?: string;
|
|
2069
|
-
technology?: string;
|
|
2070
|
-
arrowType: C4ArrowType;
|
|
2071
|
-
lineNumber: number;
|
|
2072
|
-
}
|
|
2073
|
-
/**
|
|
2074
|
-
* Roll up container/component-level relationships to system-to-system edges.
|
|
2075
|
-
* - Skips internal relationships (same top-level ancestor).
|
|
2076
|
-
* - Deduplicates: same source→target pair keeps only one (first seen).
|
|
2077
|
-
* - Explicit system-level relationships override rolled-up ones.
|
|
2078
|
-
*/
|
|
2079
|
-
declare function rollUpContextRelationships(parsed: ParsedC4): ContextRelationship[];
|
|
2080
|
-
declare function layoutC4Context(parsed: ParsedC4, activeTagGroup?: string | null): C4LayoutResult;
|
|
2081
|
-
/**
|
|
2082
|
-
* Layout containers within a specific system, plus external elements
|
|
2083
|
-
* that have relationships with those containers.
|
|
2084
|
-
*/
|
|
2085
|
-
declare function layoutC4Containers(parsed: ParsedC4, systemName: string, activeTagGroup?: string | null): C4LayoutResult;
|
|
2086
|
-
/**
|
|
2087
|
-
* Layout components within a specific container, plus external elements
|
|
2088
|
-
* that have relationships with those components.
|
|
2089
|
-
*/
|
|
2090
|
-
declare function layoutC4Components(parsed: ParsedC4, systemName: string, containerName: string, activeTagGroup?: string | null): C4LayoutResult;
|
|
2091
|
-
/**
|
|
2092
|
-
* Layout a C4 deployment diagram.
|
|
2093
|
-
*
|
|
2094
|
-
* Infrastructure nodes become boundary boxes (nested).
|
|
2095
|
-
* Container refs inside them become cards.
|
|
2096
|
-
* Edges are drawn between referenced containers that have relationships.
|
|
2097
|
-
*/
|
|
2098
|
-
declare function layoutC4Deployment(parsed: ParsedC4, activeTagGroup?: string | null): C4LayoutResult;
|
|
2099
|
-
|
|
2100
|
-
declare function renderC4Context(container: HTMLDivElement, parsed: ParsedC4, layout: C4LayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
2101
|
-
width?: number;
|
|
2102
|
-
height?: number;
|
|
2103
|
-
}, activeTagGroup?: string | null): void;
|
|
2104
|
-
declare function renderC4ContextForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
2105
|
-
/**
|
|
2106
|
-
* Render a C4 container-level diagram showing containers inside a system boundary
|
|
2107
|
-
* with external elements outside.
|
|
2108
|
-
*/
|
|
2109
|
-
declare function renderC4Containers(container: HTMLDivElement, parsed: ParsedC4, layout: C4LayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
2110
|
-
width?: number;
|
|
2111
|
-
height?: number;
|
|
2112
|
-
}, activeTagGroup?: string | null): void;
|
|
2113
|
-
declare function renderC4ContainersForExport(content: string, systemName: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
2114
|
-
declare function renderC4ComponentsForExport(content: string, systemName: string, containerName: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
2115
|
-
/**
|
|
2116
|
-
* Render a C4 deployment diagram interactively.
|
|
2117
|
-
* Reuses the container renderer — infrastructure boundaries are rendered
|
|
2118
|
-
* as group boundaries and container refs as cards (same visual pattern).
|
|
2119
|
-
*/
|
|
2120
|
-
declare function renderC4Deployment(container: HTMLDivElement, parsed: ParsedC4, layout: C4LayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
2121
|
-
width?: number;
|
|
2122
|
-
height?: number;
|
|
2123
|
-
}, activeTagGroup?: string | null): void;
|
|
2124
|
-
/**
|
|
2125
|
-
* Export convenience function for deployment diagrams.
|
|
2126
|
-
*/
|
|
2127
|
-
declare function renderC4DeploymentForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
2128
|
-
|
|
2129
|
-
interface BLNode {
|
|
2130
|
-
label: string;
|
|
2131
|
-
lineNumber: number;
|
|
2132
|
-
metadata: Record<string, string>;
|
|
2133
|
-
description?: string[];
|
|
2134
|
-
}
|
|
2135
|
-
interface BLEdge {
|
|
2136
|
-
source: string;
|
|
2137
|
-
target: string;
|
|
2138
|
-
label?: string;
|
|
2139
|
-
bidirectional: boolean;
|
|
2140
|
-
lineNumber: number;
|
|
2141
|
-
metadata: Record<string, string>;
|
|
2142
|
-
}
|
|
2143
|
-
interface BLGroup {
|
|
2144
|
-
label: string;
|
|
2145
|
-
children: string[];
|
|
2146
|
-
lineNumber: number;
|
|
2147
|
-
metadata: Record<string, string>;
|
|
2148
|
-
parentGroup?: string;
|
|
2149
|
-
}
|
|
2150
|
-
interface ParsedBoxesAndLines {
|
|
2151
|
-
type: 'boxes-and-lines';
|
|
2152
|
-
title: string | null;
|
|
2153
|
-
titleLineNumber: number | null;
|
|
2154
|
-
nodes: BLNode[];
|
|
2155
|
-
edges: BLEdge[];
|
|
2156
|
-
groups: BLGroup[];
|
|
2157
|
-
tagGroups: TagGroup[];
|
|
2158
|
-
options: Record<string, string>;
|
|
2159
|
-
initialHiddenTagValues: Map<string, Set<string>>;
|
|
2160
|
-
direction: 'LR' | 'TB';
|
|
2161
|
-
diagnostics: DgmoError[];
|
|
2162
|
-
error: string | null;
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
|
-
declare function parseBoxesAndLines(content: string): ParsedBoxesAndLines;
|
|
2166
|
-
|
|
2167
|
-
interface BLLayoutNode {
|
|
2168
|
-
label: string;
|
|
2169
|
-
x: number;
|
|
2170
|
-
y: number;
|
|
2171
|
-
width: number;
|
|
2172
|
-
height: number;
|
|
2173
|
-
}
|
|
2174
|
-
interface BLLayoutEdge {
|
|
2175
|
-
source: string;
|
|
2176
|
-
target: string;
|
|
2177
|
-
label?: string;
|
|
2178
|
-
bidirectional: boolean;
|
|
2179
|
-
lineNumber: number;
|
|
2180
|
-
points: {
|
|
2181
|
-
x: number;
|
|
2182
|
-
y: number;
|
|
2183
|
-
}[];
|
|
2184
|
-
labelX?: number;
|
|
2185
|
-
labelY?: number;
|
|
2186
|
-
yOffset: number;
|
|
2187
|
-
parallelCount: number;
|
|
2188
|
-
metadata: Record<string, string>;
|
|
2189
|
-
/** True for edges deferred from dagre (group endpoints) — use linear curve */
|
|
2190
|
-
deferred?: boolean;
|
|
2191
|
-
}
|
|
2192
|
-
interface BLLayoutGroup {
|
|
2193
|
-
label: string;
|
|
2194
|
-
lineNumber: number;
|
|
2195
|
-
x: number;
|
|
2196
|
-
y: number;
|
|
2197
|
-
width: number;
|
|
2198
|
-
height: number;
|
|
2199
|
-
collapsed: boolean;
|
|
2200
|
-
childCount?: number;
|
|
2201
|
-
}
|
|
2202
|
-
interface BLLayoutResult {
|
|
2203
|
-
nodes: BLLayoutNode[];
|
|
2204
|
-
edges: BLLayoutEdge[];
|
|
2205
|
-
groups: BLLayoutGroup[];
|
|
2206
|
-
width: number;
|
|
2207
|
-
height: number;
|
|
2208
|
-
}
|
|
2209
|
-
declare function layoutBoxesAndLines(parsed: ParsedBoxesAndLines, collapseInfo?: {
|
|
2210
|
-
collapsedChildCounts: Map<string, number>;
|
|
2211
|
-
originalGroups: BLGroup[];
|
|
2212
|
-
}, layoutOptions?: {
|
|
2213
|
-
hideDescriptions?: boolean;
|
|
2214
|
-
}): BLLayoutResult;
|
|
2215
|
-
|
|
2216
|
-
interface BLRenderOptions {
|
|
2217
|
-
onClickItem?: (lineNumber: number) => void;
|
|
2218
|
-
exportDims?: {
|
|
2219
|
-
width?: number;
|
|
2220
|
-
height?: number;
|
|
2221
|
-
};
|
|
2222
|
-
activeTagGroup?: string | null;
|
|
2223
|
-
hiddenTagValues?: Map<string, Set<string>>;
|
|
2224
|
-
hideDescriptions?: boolean;
|
|
2225
|
-
controlsExpanded?: boolean;
|
|
2226
|
-
onToggleDescriptions?: (active: boolean) => void;
|
|
2227
|
-
onToggleControlsExpand?: () => void;
|
|
2228
|
-
}
|
|
2229
|
-
declare function renderBoxesAndLines(container: HTMLDivElement, parsed: ParsedBoxesAndLines, layout: BLLayoutResult, palette: PaletteColors, isDark: boolean, options?: BLRenderOptions): void;
|
|
2230
|
-
declare function renderBoxesAndLinesForExport(container: HTMLDivElement, parsed: ParsedBoxesAndLines, layout: BLLayoutResult, palette: PaletteColors, isDark: boolean, options?: {
|
|
2231
|
-
exportDims?: {
|
|
2232
|
-
width: number;
|
|
2233
|
-
height: number;
|
|
2234
|
-
};
|
|
2235
|
-
activeTagGroup?: string | null;
|
|
2236
|
-
hiddenTagValues?: Map<string, Set<string>>;
|
|
2237
|
-
}): void;
|
|
2238
|
-
|
|
2239
|
-
interface BLCollapseResult {
|
|
2240
|
-
parsed: ParsedBoxesAndLines;
|
|
2241
|
-
collapsedChildCounts: Map<string, number>;
|
|
2242
|
-
originalGroups: BLGroup[];
|
|
2243
|
-
}
|
|
2244
|
-
/**
|
|
2245
|
-
* Pure transform: returns a new ParsedBoxesAndLines with collapsed groups
|
|
2246
|
-
* removed from the diagram content.
|
|
2247
|
-
*
|
|
2248
|
-
* - Children of collapsed groups removed from nodes
|
|
2249
|
-
* - Edges redirected: endpoints in collapsed groups → group ID
|
|
2250
|
-
* - Internal edges (both in same collapsed group) dropped
|
|
2251
|
-
* - Duplicate edges (same source, target, label) deduplicated
|
|
2252
|
-
* - Collapsed groups removed from groups[] (layout handles as nodes)
|
|
2253
|
-
*/
|
|
2254
|
-
declare function collapseBoxesAndLines(parsed: ParsedBoxesAndLines, collapsedGroups: Set<string>): BLCollapseResult;
|
|
2255
|
-
|
|
2256
|
-
interface SitemapNode {
|
|
2257
|
-
id: string;
|
|
2258
|
-
label: string;
|
|
2259
|
-
metadata: Record<string, string>;
|
|
2260
|
-
children: SitemapNode[];
|
|
2261
|
-
parentId: string | null;
|
|
2262
|
-
description?: string[];
|
|
2263
|
-
/** True for [Group Name] container nodes */
|
|
2264
|
-
isContainer: boolean;
|
|
2265
|
-
lineNumber: number;
|
|
2266
|
-
color?: string;
|
|
2267
|
-
}
|
|
2268
|
-
interface SitemapEdge {
|
|
2269
|
-
sourceId: string;
|
|
2270
|
-
targetId: string;
|
|
2271
|
-
label?: string;
|
|
2272
|
-
color?: string;
|
|
2273
|
-
lineNumber: number;
|
|
2274
|
-
}
|
|
2275
|
-
type SitemapDirection = 'TB' | 'LR';
|
|
2276
|
-
interface ParsedSitemap {
|
|
2277
|
-
title: string | null;
|
|
2278
|
-
titleLineNumber: number | null;
|
|
2279
|
-
direction: SitemapDirection;
|
|
2280
|
-
/** Top-level nodes (roots of the hierarchy) */
|
|
2281
|
-
roots: SitemapNode[];
|
|
2282
|
-
/** All cross-link edges */
|
|
2283
|
-
edges: SitemapEdge[];
|
|
2284
|
-
tagGroups: TagGroup[];
|
|
2285
|
-
options: Record<string, string>;
|
|
2286
|
-
diagnostics: DgmoError[];
|
|
2287
|
-
error: string | null;
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
/**
|
|
2291
|
-
* Returns true if content looks like a sitemap diagram.
|
|
2292
|
-
* Heuristic: has `->` arrows AND `[Group]` containers but does NOT have
|
|
2293
|
-
* flowchart shape delimiters ((...), <...>, /.../) adjacent to arrows.
|
|
2294
|
-
*/
|
|
2295
|
-
declare function looksLikeSitemap(content: string): boolean;
|
|
2296
|
-
declare function parseSitemap(content: string, palette?: PaletteColors): ParsedSitemap;
|
|
2297
|
-
|
|
2298
|
-
interface SitemapLayoutNode {
|
|
2299
|
-
id: string;
|
|
2300
|
-
label: string;
|
|
2301
|
-
metadata: Record<string, string>;
|
|
2302
|
-
/** Original (unfiltered) metadata for tag-based coloring and hover dimming */
|
|
2303
|
-
tagMetadata: Record<string, string>;
|
|
2304
|
-
description?: string[];
|
|
2305
|
-
isContainer: boolean;
|
|
2306
|
-
lineNumber: number;
|
|
2307
|
-
color?: string;
|
|
2308
|
-
x: number;
|
|
2309
|
-
y: number;
|
|
2310
|
-
width: number;
|
|
2311
|
-
height: number;
|
|
2312
|
-
/** Count of hidden descendants when collapsed */
|
|
2313
|
-
hiddenCount?: number;
|
|
2314
|
-
/** True if node has children (expanded or collapsed) — drives toggle UI */
|
|
2315
|
-
hasChildren?: boolean;
|
|
2316
|
-
}
|
|
2317
|
-
interface SitemapLayoutEdge {
|
|
2318
|
-
sourceId: string;
|
|
2319
|
-
targetId: string;
|
|
2320
|
-
points: {
|
|
2321
|
-
x: number;
|
|
2322
|
-
y: number;
|
|
2323
|
-
}[];
|
|
2324
|
-
label?: string;
|
|
2325
|
-
color?: string;
|
|
2326
|
-
lineNumber: number;
|
|
2327
|
-
/** True for edges deferred from dagre (container endpoints) — use linear curve */
|
|
2328
|
-
deferred?: boolean;
|
|
2329
|
-
}
|
|
2330
|
-
interface SitemapContainerBounds {
|
|
2331
|
-
nodeId: string;
|
|
2332
|
-
label: string;
|
|
2333
|
-
lineNumber: number;
|
|
2334
|
-
color?: string;
|
|
2335
|
-
metadata: Record<string, string>;
|
|
2336
|
-
/** Original (unfiltered) metadata for tag-based coloring and hover dimming */
|
|
2337
|
-
tagMetadata: Record<string, string>;
|
|
2338
|
-
x: number;
|
|
2339
|
-
y: number;
|
|
2340
|
-
width: number;
|
|
2341
|
-
height: number;
|
|
2342
|
-
labelHeight: number;
|
|
2343
|
-
/** Count of hidden descendants when collapsed */
|
|
2344
|
-
hiddenCount?: number;
|
|
2345
|
-
/** True if container has children (expanded or collapsed) */
|
|
2346
|
-
hasChildren?: boolean;
|
|
2347
|
-
}
|
|
2348
|
-
interface SitemapLegendEntry {
|
|
2349
|
-
value: string;
|
|
2350
|
-
color: string;
|
|
2351
|
-
}
|
|
2352
|
-
interface SitemapLegendGroup {
|
|
2353
|
-
name: string;
|
|
2354
|
-
alias?: string;
|
|
2355
|
-
entries: SitemapLegendEntry[];
|
|
2356
|
-
x: number;
|
|
2357
|
-
y: number;
|
|
2358
|
-
width: number;
|
|
2359
|
-
height: number;
|
|
2360
|
-
minifiedWidth: number;
|
|
2361
|
-
minifiedHeight: number;
|
|
2362
|
-
}
|
|
2363
|
-
interface SitemapLayoutResult {
|
|
2364
|
-
nodes: SitemapLayoutNode[];
|
|
2365
|
-
edges: SitemapLayoutEdge[];
|
|
2366
|
-
containers: SitemapContainerBounds[];
|
|
2367
|
-
legend: SitemapLegendGroup[];
|
|
2368
|
-
width: number;
|
|
2369
|
-
height: number;
|
|
2370
|
-
}
|
|
2371
|
-
declare function layoutSitemap(parsed: ParsedSitemap, hiddenCounts?: Map<string, number>, activeTagGroup?: string | null, hiddenAttributes?: Set<string>, expandAllLegend?: boolean): SitemapLayoutResult;
|
|
2372
|
-
|
|
2373
|
-
declare function renderSitemap(container: HTMLDivElement, parsed: ParsedSitemap, layout: SitemapLayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
2374
|
-
width?: number;
|
|
2375
|
-
height?: number;
|
|
2376
|
-
}, activeTagGroup?: string | null, hiddenAttributes?: Set<string>): void;
|
|
2377
|
-
declare function renderSitemapForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors): Promise<string>;
|
|
2378
|
-
|
|
2379
|
-
interface CollapsedSitemapResult {
|
|
2380
|
-
/** ParsedSitemap with collapsed subtrees pruned (deep-cloned, never mutates original) */
|
|
2381
|
-
parsed: ParsedSitemap;
|
|
2382
|
-
/** nodeId → count of hidden descendants */
|
|
2383
|
-
hiddenCounts: Map<string, number>;
|
|
2384
|
-
}
|
|
2385
|
-
declare function collapseSitemapTree(original: ParsedSitemap, collapsedIds: Set<string>): CollapsedSitemapResult;
|
|
2386
|
-
|
|
2387
|
-
/** Namespaced behavior property keys recognized by the parser. */
|
|
2388
|
-
type InfraBehaviorKey = 'cache-hit' | 'firewall-block' | 'ratelimit-rps' | 'latency-ms' | 'uptime' | 'instances' | 'max-rps' | 'cb-error-threshold' | 'cb-latency-threshold-ms' | 'concurrency' | 'duration-ms' | 'cold-start-ms' | 'buffer' | 'drain-rate' | 'retention-hours' | 'partitions';
|
|
2389
|
-
/** All recognized property keys (behavior + structural). */
|
|
2390
|
-
declare const INFRA_BEHAVIOR_KEYS: Set<string>;
|
|
2391
|
-
interface InfraProperty {
|
|
2392
|
-
key: string;
|
|
2393
|
-
value: string | number;
|
|
2394
|
-
lineNumber: number;
|
|
2395
|
-
}
|
|
2396
|
-
interface InfraNode {
|
|
2397
|
-
id: string;
|
|
2398
|
-
label: string;
|
|
2399
|
-
properties: InfraProperty[];
|
|
2400
|
-
groupId: string | null;
|
|
2401
|
-
tags: Record<string, string>;
|
|
2402
|
-
isEdge: boolean;
|
|
2403
|
-
description?: string[];
|
|
2404
|
-
lineNumber: number;
|
|
2405
|
-
}
|
|
2406
|
-
interface InfraEdge {
|
|
2407
|
-
sourceId: string;
|
|
2408
|
-
targetId: string;
|
|
2409
|
-
label: string;
|
|
2410
|
-
async: boolean;
|
|
2411
|
-
split: number | null;
|
|
2412
|
-
fanout: number | null;
|
|
2413
|
-
lineNumber: number;
|
|
2414
|
-
}
|
|
2415
|
-
interface InfraGroup {
|
|
2416
|
-
id: string;
|
|
2417
|
-
label: string;
|
|
2418
|
-
/** Number of instances (or auto-scaling range "N-M") of this group as a unit. */
|
|
2419
|
-
instances?: number | string;
|
|
2420
|
-
/** Whether this group should be collapsed by default in the source. */
|
|
2421
|
-
collapsed?: boolean;
|
|
2422
|
-
/** Pipe metadata on the group header, cascaded to children. */
|
|
2423
|
-
metadata?: Record<string, string>;
|
|
2424
|
-
lineNumber: number;
|
|
2425
|
-
}
|
|
2426
|
-
interface InfraTagValue {
|
|
2427
|
-
name: string;
|
|
2428
|
-
color?: string;
|
|
2429
|
-
}
|
|
2430
|
-
interface InfraTagGroup {
|
|
2431
|
-
name: string;
|
|
2432
|
-
alias: string | null;
|
|
2433
|
-
values: InfraTagValue[];
|
|
2434
|
-
/** Value of the entry marked `default` (nodes without this tag get it automatically). */
|
|
2435
|
-
defaultValue?: string;
|
|
2436
|
-
lineNumber: number;
|
|
2437
|
-
}
|
|
2438
|
-
interface ParsedInfra {
|
|
2439
|
-
type: 'infra';
|
|
2440
|
-
title: string | null;
|
|
2441
|
-
titleLineNumber: number | null;
|
|
2442
|
-
direction: 'LR' | 'TB';
|
|
2443
|
-
nodes: InfraNode[];
|
|
2444
|
-
edges: InfraEdge[];
|
|
2445
|
-
groups: InfraGroup[];
|
|
2446
|
-
tagGroups: InfraTagGroup[];
|
|
2447
|
-
options: Record<string, string>;
|
|
2448
|
-
diagnostics: DgmoError[];
|
|
2449
|
-
error: string | null;
|
|
2450
|
-
}
|
|
2451
|
-
interface InfraComputeParams {
|
|
2452
|
-
rps?: number;
|
|
2453
|
-
instanceOverrides?: Record<string, number>;
|
|
2454
|
-
/** Per-node property overrides: nodeId -> { propertyKey: numericValue }. */
|
|
2455
|
-
propertyOverrides?: Record<string, Record<string, number>>;
|
|
2456
|
-
/** Set of group IDs that should be treated as collapsed (virtual nodes). */
|
|
2457
|
-
collapsedGroups?: Set<string>;
|
|
2458
|
-
}
|
|
2459
|
-
type InfraCbState = 'closed' | 'open' | 'half-open';
|
|
2460
|
-
interface ComputedInfraNode {
|
|
2461
|
-
id: string;
|
|
2462
|
-
label: string;
|
|
2463
|
-
groupId: string | null;
|
|
2464
|
-
isEdge: boolean;
|
|
2465
|
-
computedRps: number;
|
|
2466
|
-
overloaded: boolean;
|
|
2467
|
-
/** True when inbound RPS exceeds the node's ratelimit-rps and traffic is being shed. */
|
|
2468
|
-
rateLimited: boolean;
|
|
2469
|
-
/** Cumulative latency from edge to this node (ms). */
|
|
2470
|
-
computedLatencyMs: number;
|
|
2471
|
-
/** Latency percentiles from this node through all downstream paths (ms). */
|
|
2472
|
-
computedLatencyPercentiles: InfraLatencyPercentiles;
|
|
2473
|
-
/** Component uptime (product of uptimes along path, 0-1). */
|
|
2474
|
-
computedUptime: number;
|
|
2475
|
-
/** Local availability at this node (0-1), factoring in uptime, overload shed, and rate-limit reject. */
|
|
2476
|
-
computedAvailability: number;
|
|
2477
|
-
/** Availability percentiles through all downstream paths from this node (0-1 fractions). */
|
|
2478
|
-
computedAvailabilityPercentiles: InfraAvailabilityPercentiles;
|
|
2479
|
-
/** Circuit breaker state. */
|
|
2480
|
-
computedCbState: InfraCbState;
|
|
2481
|
-
/** Computed instance count for auto-scaling (min-max) ranges. */
|
|
2482
|
-
computedInstances: number;
|
|
2483
|
-
/** For serverless nodes: estimated concurrent invocations (Little's Law: RPS × duration_ms / 1000). */
|
|
2484
|
-
computedConcurrentInvocations: number;
|
|
2485
|
-
/** For collapsed group virtual nodes: worst health state of any child.
|
|
2486
|
-
* 'overloaded' > 'warning' > 'normal'. Undefined for regular nodes. */
|
|
2487
|
-
childHealthState?: 'normal' | 'warning' | 'overloaded';
|
|
2488
|
-
/** Queue metrics — only present when buffer property exists. */
|
|
2489
|
-
queueMetrics?: {
|
|
2490
|
-
/** Messages per second filling the buffer (inbound - drain-rate, clamped to 0). */
|
|
2491
|
-
fillRate: number;
|
|
2492
|
-
/** Seconds until buffer overflow at sustained fill rate. Infinity if not filling. */
|
|
2493
|
-
timeToOverflow: number;
|
|
2494
|
-
/** Queue wait time in ms (pending_messages / drain_rate * 1000). */
|
|
2495
|
-
waitTimeMs: number;
|
|
2496
|
-
};
|
|
2497
|
-
properties: InfraProperty[];
|
|
2498
|
-
tags: Record<string, string>;
|
|
2499
|
-
description?: string[];
|
|
2500
|
-
lineNumber: number;
|
|
2501
|
-
}
|
|
2502
|
-
interface ComputedInfraEdge {
|
|
2503
|
-
sourceId: string;
|
|
2504
|
-
targetId: string;
|
|
2505
|
-
label: string;
|
|
2506
|
-
async: boolean;
|
|
2507
|
-
computedRps: number;
|
|
2508
|
-
split: number;
|
|
2509
|
-
fanout: number | null;
|
|
2510
|
-
lineNumber: number;
|
|
2511
|
-
}
|
|
2512
|
-
interface InfraDiagnostic {
|
|
2513
|
-
type: 'SPLIT_SUM' | 'CYCLE' | 'OVERLOAD' | 'RATE_LIMITED' | 'ORPHAN' | 'SYNTAX' | 'UPTIME';
|
|
2514
|
-
line: number;
|
|
2515
|
-
message: string;
|
|
2516
|
-
}
|
|
2517
|
-
interface InfraLatencyPercentiles {
|
|
2518
|
-
p50: number;
|
|
2519
|
-
p90: number;
|
|
2520
|
-
p99: number;
|
|
2521
|
-
}
|
|
2522
|
-
interface InfraAvailabilityPercentiles {
|
|
2523
|
-
p50: number;
|
|
2524
|
-
p90: number;
|
|
2525
|
-
p99: number;
|
|
2526
|
-
}
|
|
2527
|
-
interface ComputedInfraModel {
|
|
2528
|
-
nodes: ComputedInfraNode[];
|
|
2529
|
-
edges: ComputedInfraEdge[];
|
|
2530
|
-
groups: InfraGroup[];
|
|
2531
|
-
tagGroups: InfraTagGroup[];
|
|
2532
|
-
title: string | null;
|
|
2533
|
-
direction: 'LR' | 'TB';
|
|
2534
|
-
/** Diagram-level options (e.g., default-latency-ms, default-uptime). */
|
|
2535
|
-
options: Record<string, string>;
|
|
2536
|
-
/** Latency percentiles at the edge entry point (weighted by traffic probability). */
|
|
2537
|
-
edgeLatency: InfraLatencyPercentiles;
|
|
2538
|
-
/** System uptime at edge (weighted average across all paths). */
|
|
2539
|
-
systemUptime: number;
|
|
2540
|
-
/** System availability at edge (weighted average of compound availability across all paths). */
|
|
2541
|
-
systemAvailability: number;
|
|
2542
|
-
diagnostics: InfraDiagnostic[];
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
declare function parseInfra(content: string): ParsedInfra;
|
|
2546
|
-
|
|
2547
|
-
declare function computeInfra(parsed: ParsedInfra, params?: InfraComputeParams): ComputedInfraModel;
|
|
2548
|
-
|
|
2549
|
-
declare function validateInfra(parsed: ParsedInfra): InfraDiagnostic[];
|
|
2550
|
-
/**
|
|
2551
|
-
* Validate computed model (post-computation warnings).
|
|
2552
|
-
* Call after computeInfra() to get uptime/SLA warnings.
|
|
2553
|
-
*/
|
|
2554
|
-
declare function validateComputed(computed: ComputedInfraModel): InfraDiagnostic[];
|
|
2555
|
-
|
|
2556
|
-
interface InfraLayoutNode {
|
|
2557
|
-
id: string;
|
|
2558
|
-
label: string;
|
|
2559
|
-
x: number;
|
|
2560
|
-
y: number;
|
|
2561
|
-
width: number;
|
|
2562
|
-
height: number;
|
|
2563
|
-
computedRps: number;
|
|
2564
|
-
overloaded: boolean;
|
|
2565
|
-
rateLimited: boolean;
|
|
2566
|
-
isEdge: boolean;
|
|
2567
|
-
groupId: string | null;
|
|
2568
|
-
computedLatencyMs: number;
|
|
2569
|
-
computedLatencyPercentiles: ComputedInfraNode['computedLatencyPercentiles'];
|
|
2570
|
-
computedUptime: number;
|
|
2571
|
-
computedAvailability: number;
|
|
2572
|
-
computedAvailabilityPercentiles: ComputedInfraNode['computedAvailabilityPercentiles'];
|
|
2573
|
-
computedInstances: number;
|
|
2574
|
-
computedConcurrentInvocations: number;
|
|
2575
|
-
computedCbState: ComputedInfraNode['computedCbState'];
|
|
2576
|
-
childHealthState?: ComputedInfraNode['childHealthState'];
|
|
2577
|
-
properties: ComputedInfraNode['properties'];
|
|
2578
|
-
queueMetrics?: ComputedInfraNode['queueMetrics'];
|
|
2579
|
-
tags: Record<string, string>;
|
|
2580
|
-
description?: string[];
|
|
2581
|
-
lineNumber: number;
|
|
2582
|
-
}
|
|
2583
|
-
interface InfraLayoutEdge {
|
|
2584
|
-
sourceId: string;
|
|
2585
|
-
targetId: string;
|
|
2586
|
-
label: string;
|
|
2587
|
-
async: boolean;
|
|
2588
|
-
computedRps: number;
|
|
2589
|
-
split: number;
|
|
2590
|
-
fanout: number | null;
|
|
2591
|
-
points: {
|
|
2592
|
-
x: number;
|
|
2593
|
-
y: number;
|
|
2594
|
-
}[];
|
|
2595
|
-
lineNumber: number;
|
|
2596
|
-
}
|
|
2597
|
-
interface InfraLayoutGroup {
|
|
2598
|
-
id: string;
|
|
2599
|
-
label: string;
|
|
2600
|
-
x: number;
|
|
2601
|
-
y: number;
|
|
2602
|
-
width: number;
|
|
2603
|
-
height: number;
|
|
2604
|
-
instances?: number | string;
|
|
2605
|
-
lineNumber: number;
|
|
2606
|
-
}
|
|
2607
|
-
interface InfraLayoutResult {
|
|
2608
|
-
nodes: InfraLayoutNode[];
|
|
2609
|
-
edges: InfraLayoutEdge[];
|
|
2610
|
-
groups: InfraLayoutGroup[];
|
|
2611
|
-
/** Diagram-level options (e.g., default-latency-ms, default-uptime). */
|
|
2612
|
-
options: Record<string, string>;
|
|
2613
|
-
direction: 'LR' | 'TB';
|
|
2614
|
-
width: number;
|
|
2615
|
-
height: number;
|
|
2616
|
-
}
|
|
2617
|
-
declare function layoutInfra(computed: ComputedInfraModel, expandedNodeIds?: Set<string> | null, collapsedNodes?: Set<string> | null): InfraLayoutResult;
|
|
2618
|
-
|
|
2619
|
-
interface InfraRole {
|
|
2620
|
-
name: string;
|
|
2621
|
-
color: string;
|
|
2622
|
-
}
|
|
2623
|
-
/**
|
|
2624
|
-
* Infer roles from a component's properties.
|
|
2625
|
-
* A component can have multiple roles (e.g., Cache + Rate Limiter).
|
|
2626
|
-
*/
|
|
2627
|
-
declare function inferRoles(properties: InfraProperty[]): InfraRole[];
|
|
2628
|
-
/**
|
|
2629
|
-
* Collect all unique roles present in the diagram (for legend).
|
|
2630
|
-
*/
|
|
2631
|
-
declare function collectDiagramRoles(allProperties: InfraProperty[][]): InfraRole[];
|
|
2632
|
-
|
|
2633
|
-
interface InfraLegendEntry {
|
|
2634
|
-
value: string;
|
|
2635
|
-
color: string;
|
|
2636
|
-
/** For role: kebab-case role name. For tag: lowercase tag value. */
|
|
2637
|
-
key: string;
|
|
2638
|
-
}
|
|
2639
|
-
interface InfraLegendGroup {
|
|
2640
|
-
name: string;
|
|
2641
|
-
type: 'role' | 'tag';
|
|
2642
|
-
/** For tag groups: the key used in data-tag-* attributes (alias or name). */
|
|
2643
|
-
tagKey?: string;
|
|
2644
|
-
entries: InfraLegendEntry[];
|
|
2645
|
-
width: number;
|
|
2646
|
-
minifiedWidth: number;
|
|
2647
|
-
}
|
|
2648
|
-
/** Build legend groups from roles + tags. */
|
|
2649
|
-
declare function computeInfraLegendGroups(nodes: InfraLayoutNode[], tagGroups: InfraTagGroup[], palette: PaletteColors, edges?: InfraLayoutEdge[]): InfraLegendGroup[];
|
|
2650
|
-
interface InfraPlaybackState {
|
|
2651
|
-
expanded: boolean;
|
|
2652
|
-
paused: boolean;
|
|
2653
|
-
speed: number;
|
|
2654
|
-
speedOptions: readonly number[];
|
|
2655
|
-
}
|
|
2656
|
-
declare function renderInfra(container: HTMLDivElement, layout: InfraLayoutResult, palette: PaletteColors, isDark: boolean, title: string | null, titleLineNumber: number | null, tagGroups?: InfraTagGroup[], activeGroup?: string | null, animate?: boolean, playback?: InfraPlaybackState | null, expandedNodeIds?: Set<string> | null, exportMode?: boolean, collapsedNodes?: Set<string> | null): void;
|
|
2657
|
-
declare function parseAndLayoutInfra(content: string): {
|
|
2658
|
-
parsed: ParsedInfra;
|
|
2659
|
-
computed: null;
|
|
2660
|
-
layout: null;
|
|
2661
|
-
} | {
|
|
2662
|
-
parsed: ParsedInfra;
|
|
2663
|
-
computed: ComputedInfraModel;
|
|
2664
|
-
layout: InfraLayoutResult;
|
|
2665
|
-
};
|
|
2666
|
-
|
|
2667
|
-
/** Calendar units: d (days), w (weeks), m (months), q (quarters), y (years), h (hours), min (minutes). bd = business days. s = sprints. */
|
|
2668
|
-
type DurationUnit = 'd' | 'bd' | 'w' | 'm' | 'q' | 'y' | 'h' | 'min' | 's';
|
|
2669
|
-
interface Duration {
|
|
2670
|
-
amount: number;
|
|
2671
|
-
unit: DurationUnit;
|
|
2672
|
-
}
|
|
2673
|
-
interface Offset {
|
|
2674
|
-
duration: Duration;
|
|
2675
|
-
direction: 1 | -1;
|
|
2676
|
-
}
|
|
2677
|
-
interface GanttDependency {
|
|
2678
|
-
targetName: string;
|
|
2679
|
-
label?: string;
|
|
2680
|
-
offset?: Offset;
|
|
2681
|
-
lineNumber: number;
|
|
2682
|
-
}
|
|
2683
|
-
interface GanttTask {
|
|
2684
|
-
id: string;
|
|
2685
|
-
label: string;
|
|
2686
|
-
duration: Duration | null;
|
|
2687
|
-
explicitStart?: string;
|
|
2688
|
-
uncertain: boolean;
|
|
2689
|
-
progress: number | null;
|
|
2690
|
-
offset?: Offset;
|
|
2691
|
-
dependencies: GanttDependency[];
|
|
2692
|
-
metadata: Record<string, string>;
|
|
2693
|
-
lineNumber: number;
|
|
2694
|
-
groupPath: string[];
|
|
2695
|
-
comment?: string;
|
|
2696
|
-
}
|
|
2697
|
-
interface GanttGroup {
|
|
2698
|
-
name: string;
|
|
2699
|
-
color: string | null;
|
|
2700
|
-
metadata: Record<string, string>;
|
|
2701
|
-
lineNumber: number;
|
|
2702
|
-
children: GanttNode[];
|
|
2703
|
-
}
|
|
2704
|
-
interface GanttParallelBlock {
|
|
2705
|
-
kind: 'parallel';
|
|
2706
|
-
lineNumber: number;
|
|
2707
|
-
children: GanttNode[];
|
|
2708
|
-
}
|
|
2709
|
-
/** A node in the gantt tree: either a task, group, or parallel block. */
|
|
2710
|
-
type GanttNode = ({
|
|
2711
|
-
kind: 'task';
|
|
2712
|
-
} & GanttTask) | ({
|
|
2713
|
-
kind: 'group';
|
|
2714
|
-
} & GanttGroup) | GanttParallelBlock;
|
|
2715
|
-
type Weekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
|
|
2716
|
-
interface HolidayDate {
|
|
2717
|
-
date: string;
|
|
2718
|
-
label: string;
|
|
2719
|
-
lineNumber: number;
|
|
2720
|
-
}
|
|
2721
|
-
interface HolidayRange {
|
|
2722
|
-
startDate: string;
|
|
2723
|
-
endDate: string;
|
|
2724
|
-
label: string;
|
|
2725
|
-
lineNumber: number;
|
|
2726
|
-
}
|
|
2727
|
-
interface GanttHolidays {
|
|
2728
|
-
dates: HolidayDate[];
|
|
2729
|
-
ranges: HolidayRange[];
|
|
2730
|
-
workweek: Weekday[];
|
|
2731
|
-
}
|
|
2732
|
-
interface GanttEra {
|
|
2733
|
-
startDate: string;
|
|
2734
|
-
endDate: string;
|
|
2735
|
-
label: string;
|
|
2736
|
-
color: string | null;
|
|
2737
|
-
lineNumber: number;
|
|
2738
|
-
}
|
|
2739
|
-
interface GanttMarker {
|
|
2740
|
-
date: string;
|
|
2741
|
-
label: string;
|
|
2742
|
-
color: string | null;
|
|
2743
|
-
lineNumber: number;
|
|
2744
|
-
}
|
|
2745
|
-
interface GanttOptions {
|
|
2746
|
-
start: string | null;
|
|
2747
|
-
title: string | null;
|
|
2748
|
-
titleLineNumber: number | null;
|
|
2749
|
-
todayMarker: 'off' | 'on' | string;
|
|
2750
|
-
criticalPath: boolean;
|
|
2751
|
-
dependencies: boolean;
|
|
2752
|
-
sort: 'default' | 'tag';
|
|
2753
|
-
defaultSwimlaneGroup: string | null;
|
|
2754
|
-
activeTag: string | null;
|
|
2755
|
-
/** Line numbers for option/block keywords — maps key to source line */
|
|
2756
|
-
optionLineNumbers: Record<string, number>;
|
|
2757
|
-
holidaysLineNumber: number | null;
|
|
2758
|
-
sprintLength: Duration | null;
|
|
2759
|
-
sprintNumber: number | null;
|
|
2760
|
-
sprintStart: string | null;
|
|
2761
|
-
sprintMode: 'auto' | 'explicit' | null;
|
|
2762
|
-
/** When true, render bars at full intent saturation instead of the canonical 25% tint. */
|
|
2763
|
-
solidFill: boolean;
|
|
2764
|
-
/** When true, the renderer suppresses the chart banner title. */
|
|
2765
|
-
noTitle: boolean;
|
|
2766
|
-
}
|
|
2767
|
-
interface ParsedGantt {
|
|
2768
|
-
nodes: GanttNode[];
|
|
2769
|
-
holidays: GanttHolidays;
|
|
2770
|
-
tagGroups: TagGroup[];
|
|
2771
|
-
eras: GanttEra[];
|
|
2772
|
-
markers: GanttMarker[];
|
|
2773
|
-
options: GanttOptions;
|
|
2774
|
-
diagnostics: DgmoError[];
|
|
2775
|
-
error: string | null;
|
|
2776
|
-
}
|
|
2777
|
-
interface ResolvedTask {
|
|
2778
|
-
task: GanttTask;
|
|
2779
|
-
startDate: Date;
|
|
2780
|
-
endDate: Date;
|
|
2781
|
-
isCriticalPath: boolean;
|
|
2782
|
-
isUncertain: boolean;
|
|
2783
|
-
isMilestone: boolean;
|
|
2784
|
-
groupPath: string[];
|
|
2785
|
-
effectiveMetadata: Record<string, string>;
|
|
2786
|
-
}
|
|
2787
|
-
interface ResolvedGroup$1 {
|
|
2788
|
-
name: string;
|
|
2789
|
-
color: string | null;
|
|
2790
|
-
metadata: Record<string, string>;
|
|
2791
|
-
startDate: Date;
|
|
2792
|
-
endDate: Date;
|
|
2793
|
-
progress: number | null;
|
|
2794
|
-
lineNumber: number;
|
|
2795
|
-
depth: number;
|
|
2796
|
-
}
|
|
2797
|
-
interface ResolvedSprint {
|
|
2798
|
-
number: number;
|
|
2799
|
-
startDate: Date;
|
|
2800
|
-
endDate: Date;
|
|
2801
|
-
}
|
|
2802
|
-
interface ResolvedSchedule {
|
|
2803
|
-
tasks: ResolvedTask[];
|
|
2804
|
-
groups: ResolvedGroup$1[];
|
|
2805
|
-
startDate: Date;
|
|
2806
|
-
endDate: Date;
|
|
2807
|
-
holidays: GanttHolidays;
|
|
2808
|
-
tagGroups: TagGroup[];
|
|
2809
|
-
eras: GanttEra[];
|
|
2810
|
-
markers: GanttMarker[];
|
|
2811
|
-
sprints: ResolvedSprint[];
|
|
2812
|
-
options: GanttOptions;
|
|
2813
|
-
diagnostics: DgmoError[];
|
|
2814
|
-
error: string | null;
|
|
2815
|
-
}
|
|
2816
|
-
|
|
2817
|
-
declare function parseGantt(content: string, palette?: PaletteColors): ParsedGantt;
|
|
2818
|
-
|
|
2819
|
-
declare function calculateSchedule(parsed: ParsedGantt): ResolvedSchedule;
|
|
2820
|
-
|
|
2821
|
-
interface GanttInteractiveOptions {
|
|
2822
|
-
onClickItem?: (lineNumber: number) => void;
|
|
2823
|
-
collapsedGroups?: Set<string>;
|
|
2824
|
-
onToggleGroup?: (groupName: string) => void;
|
|
2825
|
-
currentSwimlaneGroup?: string | null;
|
|
2826
|
-
onSwimlaneChange?: (group: string | null) => void;
|
|
2827
|
-
currentActiveGroup?: string | null;
|
|
2828
|
-
onActiveGroupChange?: (group: string | null) => void;
|
|
2829
|
-
collapsedLanes?: Set<string>;
|
|
2830
|
-
onToggleLane?: (laneName: string) => void;
|
|
2831
|
-
viewMode?: boolean;
|
|
2832
|
-
}
|
|
2833
|
-
declare function renderGantt(container: HTMLDivElement, resolved: ResolvedSchedule, palette: PaletteColors, isDark: boolean, options?: GanttInteractiveOptions, exportDims?: D3ExportDimensions): void;
|
|
2834
|
-
type GroupRow = {
|
|
2835
|
-
type: 'group';
|
|
2836
|
-
group: ResolvedGroup$1;
|
|
2837
|
-
};
|
|
2838
|
-
type TaskRow = {
|
|
2839
|
-
type: 'task';
|
|
2840
|
-
task: ResolvedTask;
|
|
2841
|
-
};
|
|
2842
|
-
type LaneHeaderRow = {
|
|
2843
|
-
type: 'lane-header';
|
|
2844
|
-
laneName: string;
|
|
2845
|
-
laneColor: string;
|
|
2846
|
-
aggregateProgress: number | null;
|
|
2847
|
-
tagKey: string;
|
|
2848
|
-
isCollapsed: boolean;
|
|
2849
|
-
laneStartDate: Date | null;
|
|
2850
|
-
laneEndDate: Date | null;
|
|
2851
|
-
};
|
|
2852
|
-
type Row = GroupRow | TaskRow | LaneHeaderRow;
|
|
2853
|
-
|
|
2854
|
-
declare function buildTagLaneRowList(resolved: ResolvedSchedule, swimlaneGroup: string, collapsedLanes?: Set<string>): Row[] | null;
|
|
2855
|
-
|
|
2856
|
-
interface ResolverMatch {
|
|
2857
|
-
task: GanttTask;
|
|
2858
|
-
}
|
|
2859
|
-
interface ResolverError {
|
|
2860
|
-
kind: 'not_found' | 'ambiguous';
|
|
2861
|
-
message: string;
|
|
2862
|
-
}
|
|
2863
|
-
type ResolverResult = ResolverMatch | ResolverError;
|
|
2864
|
-
/**
|
|
2865
|
-
* Collect all tasks from a tree of GanttNodes, annotating each with its
|
|
2866
|
-
* fully qualified group path (e.g., ["Backend", "API"]).
|
|
2867
|
-
*/
|
|
2868
|
-
declare function collectTasks(nodes: GanttNode[]): GanttTask[];
|
|
2869
|
-
/**
|
|
2870
|
-
* Resolve a dependency target name to a task.
|
|
2871
|
-
*
|
|
2872
|
-
* Resolution strategy (greedy right-to-left):
|
|
2873
|
-
* 1. Try the full string as an exact task label match
|
|
2874
|
-
* 2. If no match, split at the last dot → group prefix + task label
|
|
2875
|
-
* 3. Recurse for deeper paths
|
|
2876
|
-
*
|
|
2877
|
-
* Returns a match or an error with helpful suggestions.
|
|
2878
|
-
*/
|
|
2879
|
-
declare function resolveTaskName(name: string, allTasks: GanttTask[]): ResolverResult;
|
|
2880
|
-
|
|
2881
|
-
/**
|
|
2882
|
-
* A three-point duration estimate. Each component is a parsed
|
|
2883
|
-
* `Duration { amount, unit }` so mixed units (`1w 2w 3m`) are
|
|
2884
|
-
* preserved; the analyzer normalizes to `options.timeUnit` for
|
|
2885
|
-
* arithmetic.
|
|
2886
|
-
*/
|
|
2887
|
-
interface DurationEstimate {
|
|
2888
|
-
o: Duration;
|
|
2889
|
-
m: Duration;
|
|
2890
|
-
p: Duration;
|
|
2891
|
-
/**
|
|
2892
|
-
* When true, only an M token was given on the source line and the
|
|
2893
|
-
* analyzer must expand O/P from confidence factors. When false, the
|
|
2894
|
-
* user wrote an explicit O M P triple (even when all three values
|
|
2895
|
-
* are equal — zero-variance is a valid, deterministic estimate).
|
|
2896
|
-
*/
|
|
2897
|
-
mOnly: boolean;
|
|
2898
|
-
}
|
|
2899
|
-
/**
|
|
2900
|
-
* Per-activity layout-overrides shape — the diagrammo-app holds expansion
|
|
2901
|
-
* state in its own store and passes overrides to `relayoutPert`.
|
|
2902
|
-
*/
|
|
2903
|
-
type LayoutOverrides = Record<string, {
|
|
2904
|
-
width: number;
|
|
2905
|
-
height: number;
|
|
2906
|
-
}>;
|
|
2907
|
-
|
|
2908
|
-
/** Layout direction. `LR` is the default; `TB` for tall chains. */
|
|
2909
|
-
type PertDirection = 'LR' | 'TB';
|
|
2910
|
-
/** `node-detail` directive value. */
|
|
2911
|
-
type NodeDetail = 'compact' | 'full';
|
|
2912
|
-
/**
|
|
2913
|
-
* Project schedule anchor. Mutually-exclusive at parse time:
|
|
2914
|
-
* - `forward` — `start-date YYYY-MM-DD` anchors source-activity ES.
|
|
2915
|
-
* - `backward` — `end-date YYYY-MM-DD` anchors sink-activity LF.
|
|
2916
|
-
* - `null` — no anchor; ES/EF/LS/LF render as numeric offsets.
|
|
2917
|
-
*/
|
|
2918
|
-
type Anchor = {
|
|
2919
|
-
kind: 'forward';
|
|
2920
|
-
date: string;
|
|
2921
|
-
} | {
|
|
2922
|
-
kind: 'backward';
|
|
2923
|
-
date: string;
|
|
2924
|
-
} | null;
|
|
2925
|
-
/**
|
|
2926
|
-
* One row of the project-stats caption. Replaces the previous
|
|
2927
|
-
* `\n`-joined `summaryText` string with a structured shape so the
|
|
2928
|
-
* renderer doesn't have to recover bullet structure by splitting on
|
|
2929
|
-
* `\n` / `. ` and tests can assert on `isPast` directly instead of
|
|
2930
|
-
* matching the trailing `(latest-safe start has passed)` suffix.
|
|
2931
|
-
*/
|
|
2932
|
-
interface CaptionRow {
|
|
2933
|
-
/** Pre-formatted caption text for this row (no leading bullet glyph). */
|
|
2934
|
-
text: string;
|
|
2935
|
-
/** 0 = top-level row; 1 = sub-row (indented under the previous level-0 row). */
|
|
2936
|
-
level: 0 | 1;
|
|
2937
|
-
/** When true, renderer paints the text italic. */
|
|
2938
|
-
italic?: boolean;
|
|
2939
|
-
/**
|
|
2940
|
-
* Backward-mode flag — true when the row reports a latest-safe-start
|
|
2941
|
-
* date that precedes `options.today`. The text already carries a
|
|
2942
|
-
* `(latest-safe start has passed)` suffix; the flag is for downstream
|
|
2943
|
-
* styling/test assertions.
|
|
2944
|
-
*/
|
|
2945
|
-
isPast?: boolean;
|
|
2946
|
-
}
|
|
2947
|
-
/** Diagram-level options collected by the parser. */
|
|
2948
|
-
interface PertOptions {
|
|
2949
|
-
/** Time unit for μ/σ/ES/EF formatting and M-only heuristics. */
|
|
2950
|
-
timeUnit: Duration['unit'];
|
|
2951
|
-
/** `direction` directive. Defaults to `LR`. */
|
|
2952
|
-
direction: PertDirection;
|
|
2953
|
-
/** `node-detail` directive. Defaults to `compact`. */
|
|
2954
|
-
nodeDetail: NodeDetail;
|
|
2955
|
-
/**
|
|
2956
|
-
* Global confidence used to fill O/P from M-only durations.
|
|
2957
|
-
* Stored verbatim — analyzer applies `resolveConfidence()` to expand
|
|
2958
|
-
* named levels (`high`/`medium`/`low`) or `O/P` factor pairs.
|
|
2959
|
-
*/
|
|
2960
|
-
confidence: string;
|
|
2961
|
-
/** Monte-Carlo trials for the canonical run (default 10000). */
|
|
2962
|
-
trials: number;
|
|
2963
|
-
/** Monte-Carlo seed; deterministic across machines via mulberry32. */
|
|
2964
|
-
seed: number;
|
|
2965
|
-
/** Fast-MC trials for the live duration scrubber (default 300, floor 100). */
|
|
2966
|
-
scrubberTrials: number;
|
|
2967
|
-
/**
|
|
2968
|
-
* Date anchor — discriminated union enforces mutual exclusion.
|
|
2969
|
-
* `null` when no `start-date`/`end-date` directive was authored.
|
|
2970
|
-
*/
|
|
2971
|
-
anchor: Anchor;
|
|
2972
|
-
/** When true, the renderer suppresses the diagram banner title. */
|
|
2973
|
-
noTitle?: boolean;
|
|
2974
|
-
/**
|
|
2975
|
-
* `active-tag <name>` directive — selects which declared tag group
|
|
2976
|
-
* drives node fill via `resolveTagColor()`. `'none'` (case-insensitive)
|
|
2977
|
-
* suppresses tag coloring; `undefined` lets `resolveActiveTagGroup()`
|
|
2978
|
-
* auto-activate the first declared group.
|
|
2979
|
-
*/
|
|
2980
|
-
activeTag?: string;
|
|
2981
|
-
/**
|
|
2982
|
-
* Sprint mode (mirrors Gantt's surface). Activated automatically when
|
|
2983
|
-
* `time-unit s` is set, or explicitly when any `sprint-*` directive
|
|
2984
|
-
* appears. Schedule cells render as `S<n>` instead of numeric offsets
|
|
2985
|
-
* or ISO dates.
|
|
2986
|
-
*/
|
|
2987
|
-
sprintLength: Duration | null;
|
|
2988
|
-
sprintNumber: number | null;
|
|
2989
|
-
sprintStart: string | null;
|
|
2990
|
-
sprintMode: 'auto' | 'explicit' | null;
|
|
2991
|
-
/**
|
|
2992
|
-
* "Today" baked in at parse time (ISO YYYY-MM-DD). Same source as
|
|
2993
|
-
* `start-date now`, captured for every parse regardless of whether
|
|
2994
|
-
* `now` was authored. Analyzer reads this to flag past latest-safe
|
|
2995
|
-
* starts in backward mode; renderer surfaces it in the
|
|
2996
|
-
* `(as of YYYY-MM-DD)` anchor annotation. Empty string when the
|
|
2997
|
-
* parser was given no `now` and no `start-date now` directive (legacy
|
|
2998
|
-
* fixtures pre-dating this field) — consumers treat empty as
|
|
2999
|
-
* "no today known" and skip past-flagging.
|
|
3000
|
-
*/
|
|
3001
|
-
today: string;
|
|
3002
|
-
}
|
|
3003
|
-
/**
|
|
3004
|
-
* A PERT activity (node). Activities have either a three-point estimate,
|
|
3005
|
-
* an M-only estimate (parser fills O/P from confidence factors), or no
|
|
3006
|
-
* estimate at all (TBD — analyzer null-poisons descendants).
|
|
3007
|
-
*/
|
|
3008
|
-
interface PertActivity {
|
|
3009
|
-
/** Stable id — alias if `as` was given, otherwise normalized name. */
|
|
3010
|
-
id: string;
|
|
3011
|
-
/** Human-readable label as written in source. */
|
|
3012
|
-
name: string;
|
|
3013
|
-
/** Optional alias from `<name> <durs> as <id>`. */
|
|
3014
|
-
alias?: string;
|
|
3015
|
-
/**
|
|
3016
|
-
* Activity duration estimate.
|
|
3017
|
-
* - `null` → TBD (no estimate); analyzer poisons descendants with `null`.
|
|
3018
|
-
*/
|
|
3019
|
-
duration: DurationEstimate | null;
|
|
3020
|
-
/**
|
|
3021
|
-
* Per-activity confidence override from pipe metadata (`| confidence: low`).
|
|
3022
|
-
* When unset, analyzer uses `options.confidence`.
|
|
3023
|
-
*/
|
|
3024
|
-
confidence?: string;
|
|
3025
|
-
/** Group id this activity belongs to (post-resolve). */
|
|
3026
|
-
groupId?: string;
|
|
3027
|
-
/** Source line of the declaration site (1-based). */
|
|
3028
|
-
lineNumber: number;
|
|
3029
|
-
/** True for `milestone <name>` primitives (zero-duration, diamond shape). */
|
|
3030
|
-
isMilestone: boolean;
|
|
3031
|
-
/**
|
|
3032
|
-
* Resolved tag-group metadata from pipe-metadata aliases. Keys are
|
|
3033
|
-
* lowercased tag-group names (e.g. `priority`, `team`); values are the
|
|
3034
|
-
* authored tag entry names. Drives node fill via `resolveTagColor()`
|
|
3035
|
-
* when an `active-tag` group is set. Empty when no tag groups are
|
|
3036
|
-
* declared or the activity carried no tag metadata.
|
|
3037
|
-
*/
|
|
3038
|
-
tags?: Record<string, string>;
|
|
3039
|
-
}
|
|
3040
|
-
/**
|
|
3041
|
-
* Forward-style milestone shorthand. Stored as a `PertActivity` with
|
|
3042
|
-
* `isMilestone: true` and a zero-duration estimate, but kept here as a
|
|
3043
|
-
* distinct exported alias for callers that want to filter by kind.
|
|
3044
|
-
*/
|
|
3045
|
-
type PertMilestone = PertActivity & {
|
|
3046
|
-
isMilestone: true;
|
|
3047
|
-
};
|
|
3048
|
-
/**
|
|
3049
|
-
* Dependency type — defaults to FS (Finish-to-Start), the dominant case.
|
|
3050
|
-
* - FS: `B.ES ≥ A.EF + lag` (most edges)
|
|
3051
|
-
* - SS: `B.ES ≥ A.ES + lag` (parallel start)
|
|
3052
|
-
* - FF: `B.EF ≥ A.EF + lag` (synchronized finish)
|
|
3053
|
-
* - SF: `B.EF ≥ A.ES + lag` (rare; included for completeness)
|
|
3054
|
-
*/
|
|
3055
|
-
type EdgeType = 'FS' | 'SS' | 'FF' | 'SF';
|
|
3056
|
-
/**
|
|
3057
|
-
* Directed dependency edge from `source` activity to `target`.
|
|
3058
|
-
* `type` defaults to FS, `lag` to null (zero offset). Lag amount may be
|
|
3059
|
-
* negative (a lead — predecessor and successor overlap).
|
|
3060
|
-
*/
|
|
3061
|
-
interface PertEdge {
|
|
3062
|
-
source: string;
|
|
3063
|
-
target: string;
|
|
3064
|
-
lineNumber: number;
|
|
3065
|
-
type: EdgeType;
|
|
3066
|
-
lag: Duration | null;
|
|
3067
|
-
}
|
|
3068
|
-
/** Group declared via `[group-name] | metadata`. */
|
|
3069
|
-
interface PertGroup {
|
|
3070
|
-
id: string;
|
|
3071
|
-
name: string;
|
|
3072
|
-
/** Activity ids belonging to this group, populated in Pass 2. */
|
|
3073
|
-
activityIds: string[];
|
|
3074
|
-
/** Whether the user authored `| collapsed: true`. */
|
|
3075
|
-
collapsed: boolean;
|
|
3076
|
-
/** Source line of the `[group-name]` header (1-based). */
|
|
3077
|
-
lineNumber: number;
|
|
3078
|
-
/**
|
|
3079
|
-
* Resolved tag-group metadata for the cluster header — same shape as
|
|
3080
|
-
* `PertActivity.tags`. Currently informational; default-tag injection
|
|
3081
|
-
* skips groups (containers) so they appear "untagged" unless the user
|
|
3082
|
-
* authors an explicit value via pipe metadata.
|
|
3083
|
-
*/
|
|
3084
|
-
tags?: Record<string, string>;
|
|
3085
|
-
/**
|
|
3086
|
-
* Auto-detected group topology (Pass 2 result).
|
|
3087
|
-
* - `hammock`: single entry + single exit — collapses to a super-edge.
|
|
3088
|
-
* - `cluster`: multi-entry or multi-exit — collapses to a bounding rect.
|
|
3089
|
-
*/
|
|
3090
|
-
classification?: 'hammock' | 'cluster';
|
|
3091
|
-
}
|
|
3092
|
-
/** Output of `parsePert(content)`. */
|
|
3093
|
-
interface ParsedPert {
|
|
3094
|
-
/** Optional title parsed from `pert <title>`. */
|
|
3095
|
-
title: string | null;
|
|
3096
|
-
options: PertOptions;
|
|
3097
|
-
activities: PertActivity[];
|
|
3098
|
-
edges: PertEdge[];
|
|
3099
|
-
groups: PertGroup[];
|
|
3100
|
-
/**
|
|
3101
|
-
* Tag groups declared at the top of the diagram (`tag Priority as p
|
|
3102
|
-
* High(red), Low(green)`). Drive node fill via `resolveTagColor()`.
|
|
3103
|
-
* Empty when no `tag` blocks are declared.
|
|
3104
|
-
*/
|
|
3105
|
-
tagGroups: TagGroup[];
|
|
3106
|
-
/**
|
|
3107
|
-
* Map alias-or-name → canonical activity id. Useful for the analyzer
|
|
3108
|
-
* and for editor autocomplete; also populated in Pass 2.
|
|
3109
|
-
*/
|
|
3110
|
-
idMap: Record<string, string>;
|
|
3111
|
-
diagnostics: DgmoError[];
|
|
3112
|
-
/** First fatal error message; `null` when parse succeeded. */
|
|
3113
|
-
error: string | null;
|
|
3114
|
-
}
|
|
3115
|
-
/**
|
|
3116
|
-
* Fully-resolved per-activity analysis output. ES/EF/LS/LF/slack are
|
|
3117
|
-
* `null` for any activity downstream of a TBD (poison-propagation per
|
|
3118
|
-
* AC2.3).
|
|
3119
|
-
*/
|
|
3120
|
-
interface ResolvedActivity {
|
|
3121
|
-
activity: PertActivity;
|
|
3122
|
-
/** Earliest start (forward pass). `null` if upstream TBD. */
|
|
3123
|
-
es: number | null;
|
|
3124
|
-
/** Earliest finish. */
|
|
3125
|
-
ef: number | null;
|
|
3126
|
-
/** Latest start (backward pass). */
|
|
3127
|
-
ls: number | null;
|
|
3128
|
-
/** Latest finish. */
|
|
3129
|
-
lf: number | null;
|
|
3130
|
-
/** Slack = LS − ES (or LF − EF). 0 = on critical path. `null` if poisoned. */
|
|
3131
|
-
slack: number | null;
|
|
3132
|
-
/** True iff the M-world critical path passes through this activity. */
|
|
3133
|
-
isCriticalPath: boolean;
|
|
3134
|
-
/** Resolved μ in `options.timeUnit` (numeric mean of o/m/p). */
|
|
3135
|
-
mu: number | null;
|
|
3136
|
-
/** Resolved σ in `options.timeUnit` (Beta-PERT std dev). */
|
|
3137
|
-
sigma: number | null;
|
|
3138
|
-
/**
|
|
3139
|
-
* Criticality index from Monte Carlo (0–1). `null` when MC is off or
|
|
3140
|
-
* when this activity is downstream of a TBD.
|
|
3141
|
-
*/
|
|
3142
|
-
criticality: number | null;
|
|
3143
|
-
/**
|
|
3144
|
-
* True iff the source declared an explicit O/M/P triple. M-only,
|
|
3145
|
-
* TBD, and milestone activities all report `false`.
|
|
3146
|
-
*/
|
|
3147
|
-
isAuthored: boolean;
|
|
3148
|
-
}
|
|
3149
|
-
/** Resolved hammock/cluster group. */
|
|
3150
|
-
interface ResolvedGroup {
|
|
3151
|
-
group: PertGroup;
|
|
3152
|
-
/** Aggregate μ/σ along the group's internal critical path. */
|
|
3153
|
-
rolledMu: number | null;
|
|
3154
|
-
rolledSigma: number | null;
|
|
3155
|
-
/** Group entry/exit ids derived in Pass 2. */
|
|
3156
|
-
entries: string[];
|
|
3157
|
-
exits: string[];
|
|
3158
|
-
/**
|
|
3159
|
-
* Rolled-up schedule envelope across member activities.
|
|
3160
|
-
* ES = min member.es
|
|
3161
|
-
* EF = max member.ef
|
|
3162
|
-
* LS = min member.ls
|
|
3163
|
-
* LF = max member.lf
|
|
3164
|
-
* slack = LS − ES
|
|
3165
|
-
* criticality = max member.criticality (when MC is on)
|
|
3166
|
-
* Each is `null` when no member has a non-null value (e.g. all-TBD group).
|
|
3167
|
-
*/
|
|
3168
|
-
es: number | null;
|
|
3169
|
-
ef: number | null;
|
|
3170
|
-
ls: number | null;
|
|
3171
|
-
lf: number | null;
|
|
3172
|
-
slack: number | null;
|
|
3173
|
-
criticality: number | null;
|
|
3174
|
-
}
|
|
3175
|
-
/**
|
|
3176
|
-
* Bare shape for a Monte-Carlo simulation result; Phase 2 fills it.
|
|
3177
|
-
* Keeping the shape exported in v1 means analyzer consumers don't break
|
|
3178
|
-
* when MC support lands.
|
|
3179
|
-
*/
|
|
3180
|
-
interface MonteCarloResult {
|
|
3181
|
-
/** Trials run (canonical or fast). */
|
|
3182
|
-
trials: number;
|
|
3183
|
-
/** Seed used for deterministic reproduction. */
|
|
3184
|
-
seed: number;
|
|
3185
|
-
/** Project-completion percentiles. */
|
|
3186
|
-
p50: number;
|
|
3187
|
-
p80: number;
|
|
3188
|
-
p95: number;
|
|
3189
|
-
/**
|
|
3190
|
-
* Central ~68% band — empirical equivalent of a ±1σ window. Used by
|
|
3191
|
-
* the S-curve to draw a "where the project most likely lands" shaded
|
|
3192
|
-
* region without assuming the finish-time distribution is normal.
|
|
3193
|
-
*/
|
|
3194
|
-
p16: number;
|
|
3195
|
-
p84: number;
|
|
3196
|
-
/**
|
|
3197
|
-
* Empirical lower bound — minimum trial duration in canonical days.
|
|
3198
|
-
* Used by the S-curve to anchor its x-axis at the actually-observed
|
|
3199
|
-
* span rather than an analytical extrapolation. Backward-mode reads
|
|
3200
|
-
* this through `end_date − max` to land the left edge of the
|
|
3201
|
-
* candidate-start axis.
|
|
3202
|
-
*/
|
|
3203
|
-
minDurationDays: number;
|
|
3204
|
-
/**
|
|
3205
|
-
* Empirical upper bound — maximum trial duration in canonical days.
|
|
3206
|
-
* Symmetric counterpart to `minDurationDays`. Backward-mode reads
|
|
3207
|
-
* this as the latest candidate start that still has a chance of
|
|
3208
|
-
* hitting the deadline.
|
|
3209
|
-
*/
|
|
3210
|
-
maxDurationDays: number;
|
|
3211
|
-
/** Per-activity criticality index, keyed by activity id. */
|
|
3212
|
-
criticalityByActivity: Record<string, number>;
|
|
3213
|
-
/** Modal-longest-path tuple (activity ids). */
|
|
3214
|
-
modalCriticalPath: string[];
|
|
3215
|
-
/**
|
|
3216
|
-
* Per-activity tornado swings — how much the project end-date
|
|
3217
|
-
* moves when this activity comes in at its optimistic (O) or
|
|
3218
|
-
* pessimistic (P) extreme while every other activity stays at
|
|
3219
|
-
* its mean (μ). Sorted descending by total swing.
|
|
3220
|
-
*
|
|
3221
|
-
* `lowSwing` and `highSwing` are in canonical days (≥ 0).
|
|
3222
|
-
* Renderer converts to display unit.
|
|
3223
|
-
*/
|
|
3224
|
-
tornadoSwings: TornadoSwing[];
|
|
3225
|
-
}
|
|
3226
|
-
/**
|
|
3227
|
-
* One row of a true two-sided tornado: the project end-date moves
|
|
3228
|
-
* lowSwing days earlier when the activity is at its optimistic
|
|
3229
|
-
* extreme, and highSwing days later when at its pessimistic extreme.
|
|
3230
|
-
* All other activities held at their μ.
|
|
3231
|
-
*/
|
|
3232
|
-
interface TornadoSwing {
|
|
3233
|
-
id: string;
|
|
3234
|
-
name: string;
|
|
3235
|
-
/** Days the project finishes EARLIER when this activity ≈ O. */
|
|
3236
|
-
lowSwing: number;
|
|
3237
|
-
/** Days the project finishes LATER when this activity ≈ P. */
|
|
3238
|
-
highSwing: number;
|
|
3239
|
-
/** Per-activity MC criticality index, used by the renderer for bar color. */
|
|
3240
|
-
criticality: number | null;
|
|
3241
|
-
}
|
|
3242
|
-
/**
|
|
3243
|
-
* Per-activity (O, M, P) in canonical days — the analyzer's
|
|
3244
|
-
* expanded-estimate cache, populated for every activity that has an
|
|
3245
|
-
* estimate (TBDs are omitted). Workers re-running Monte Carlo on an
|
|
3246
|
-
* already-resolved PERT can read this directly instead of re-parsing
|
|
3247
|
-
* + re-expanding from source.
|
|
3248
|
-
*/
|
|
3249
|
-
interface PertExpandedActivity {
|
|
3250
|
-
id: string;
|
|
3251
|
-
o: number;
|
|
3252
|
-
m: number;
|
|
3253
|
-
p: number;
|
|
3254
|
-
}
|
|
3255
|
-
interface ResolvedPert {
|
|
3256
|
-
options: PertOptions;
|
|
3257
|
-
activities: ResolvedActivity[];
|
|
3258
|
-
edges: PertEdge[];
|
|
3259
|
-
groups: ResolvedGroup[];
|
|
3260
|
-
/**
|
|
3261
|
-
* Tag groups copied from the parsed source. The renderer reads this
|
|
3262
|
-
* + `options.activeTag` to drive node fill via `resolveTagColor()`
|
|
3263
|
-
* and to render the legend.
|
|
3264
|
-
*/
|
|
3265
|
-
tagGroups: TagGroup[];
|
|
3266
|
-
/**
|
|
3267
|
-
* Analysis mode auto-derived from data: `monte-carlo` when at least
|
|
3268
|
-
* one non-milestone activity carries an O/M/P triple AND `trials >= 100`,
|
|
3269
|
-
* otherwise `analytical`.
|
|
3270
|
-
*/
|
|
3271
|
-
mode: 'monte-carlo' | 'analytical';
|
|
3272
|
-
/**
|
|
3273
|
-
* Project-stats caption rows. Each row is one bullet in the rendered
|
|
3274
|
-
* caption box; level-1 rows render indented under the preceding
|
|
3275
|
-
* level-0 row. Null only when analysis bails out before producing
|
|
3276
|
-
* any output (e.g. cycle detection); non-null in every successful
|
|
3277
|
-
* analyze() run.
|
|
3278
|
-
*/
|
|
3279
|
-
summaryRows: CaptionRow[] | null;
|
|
3280
|
-
/**
|
|
3281
|
-
* One-line project summary rendered as a subtitle under the diagram title.
|
|
3282
|
-
* Shape per mode (see §13A.7):
|
|
3283
|
-
* - Forward: `Expected finish: <date> · ≈ <μ> <unit> of work (± <σ>)`
|
|
3284
|
-
* - Backward: `Expected start: <date> · ≈ <μ> <unit> lead time (± <σ>)`
|
|
3285
|
-
* - Unanchored: `≈ <μ> <unit> (± <σ>)`
|
|
3286
|
-
* Null when analysis bails out before producing any output.
|
|
3287
|
-
*/
|
|
3288
|
-
projectSubtitle: string | null;
|
|
3289
|
-
/** μ along the M-world critical path (max EF over all activities). */
|
|
3290
|
-
projectMu: number | null;
|
|
3291
|
-
/** σ along the M-world critical path (sqrt of variance sum). */
|
|
3292
|
-
projectSigma: number | null;
|
|
3293
|
-
/** Critical-path activity ids in topological order. */
|
|
3294
|
-
criticalPath: string[];
|
|
3295
|
-
/**
|
|
3296
|
-
* Anchored mode: the date all four schedule labels (ES/EF/LS/LF) are
|
|
3297
|
-
* computed off. Forward = start-date; backward = end-date − projectMu;
|
|
3298
|
-
* null otherwise (no anchor, or backward + TBD upstream).
|
|
3299
|
-
*/
|
|
3300
|
-
projectStart: string | null;
|
|
3301
|
-
/** Populated when `mode === 'monte-carlo'`. */
|
|
3302
|
-
monteCarloResult: MonteCarloResult | null;
|
|
3303
|
-
/**
|
|
3304
|
-
* Per-activity (O, M, P) in canonical days. Always populated; used
|
|
3305
|
-
* by Phase 3b Worker / scrubber so the simulator can re-run on a
|
|
3306
|
-
* postMessage-cloned ResolvedPert without needing the original
|
|
3307
|
-
* ParsedPert or analyzer state.
|
|
3308
|
-
*/
|
|
3309
|
-
expandedActivities: PertExpandedActivity[];
|
|
3310
|
-
diagnostics: DgmoError[];
|
|
3311
|
-
error: string | null;
|
|
3312
|
-
}
|
|
3313
|
-
interface PertLayoutNode {
|
|
3314
|
-
id: string;
|
|
3315
|
-
x: number;
|
|
3316
|
-
y: number;
|
|
3317
|
-
width: number;
|
|
3318
|
-
height: number;
|
|
3319
|
-
}
|
|
3320
|
-
interface PertLayoutEdge {
|
|
3321
|
-
source: string;
|
|
3322
|
-
target: string;
|
|
3323
|
-
points: {
|
|
3324
|
-
x: number;
|
|
3325
|
-
y: number;
|
|
3326
|
-
}[];
|
|
3327
|
-
}
|
|
3328
|
-
interface PertLayoutGroup {
|
|
3329
|
-
id: string;
|
|
3330
|
-
x: number;
|
|
3331
|
-
y: number;
|
|
3332
|
-
width: number;
|
|
3333
|
-
height: number;
|
|
3334
|
-
classification: 'hammock' | 'cluster';
|
|
3335
|
-
/**
|
|
3336
|
-
* True when the group is currently collapsed. Layout sized this rect
|
|
3337
|
-
* as a single rolled-up node and hid the group's member activities
|
|
3338
|
-
* from `nodes` / re-routed external edges to land on this rect.
|
|
3339
|
-
*/
|
|
3340
|
-
collapsed?: boolean;
|
|
3341
|
-
}
|
|
3342
|
-
interface LayoutResult {
|
|
3343
|
-
nodes: PertLayoutNode[];
|
|
3344
|
-
edges: PertLayoutEdge[];
|
|
3345
|
-
groups: PertLayoutGroup[];
|
|
3346
|
-
width: number;
|
|
3347
|
-
height: number;
|
|
3348
|
-
}
|
|
3349
|
-
|
|
3350
|
-
interface ParsePertOptions {
|
|
3351
|
-
/**
|
|
3352
|
-
* "Today" reference for `start-date now` and `options.today`. Defaults
|
|
3353
|
-
* to `new Date()` at call time; tests inject a fixed date for
|
|
3354
|
-
* deterministic snapshots and past-row assertions.
|
|
3355
|
-
*/
|
|
3356
|
-
now?: Date;
|
|
3357
|
-
/**
|
|
3358
|
-
* Active palette — used when resolving color names on `tag` entries
|
|
3359
|
-
* (e.g. `High(red)` → palette.colors.red). Optional; when omitted the
|
|
3360
|
-
* universal default color map is used.
|
|
3361
|
-
*/
|
|
3362
|
-
palette?: PaletteColors;
|
|
3363
|
-
}
|
|
3364
|
-
declare function parsePert(content: string, parseOpts?: ParsePertOptions): ParsedPert;
|
|
3365
|
-
declare function extractPertSymbols(docText: string): DiagramSymbols;
|
|
3366
|
-
/**
|
|
3367
|
-
* Returns true when content lacks an explicit chart type but reads as a
|
|
3368
|
-
* PERT diagram. Per spec § Implementation Decisions: drop the
|
|
3369
|
-
* "three-number durations" heuristic (too generic) — require any of:
|
|
3370
|
-
* (a) literal `pert` chart-type line (already handled by parseFirstLine)
|
|
3371
|
-
* (b) an `analysis monte-carlo` directive
|
|
3372
|
-
*
|
|
3373
|
-
* This function is for case (b) inference — case (a) is handled upstream.
|
|
3374
|
-
*/
|
|
3375
|
-
declare function looksLikePert(content: string): boolean;
|
|
3376
|
-
|
|
3377
|
-
declare function analyzePert(parsed: ParsedPert): ResolvedPert;
|
|
3378
|
-
|
|
3379
|
-
declare function layoutPert(resolved: ResolvedPert): LayoutResult;
|
|
3380
|
-
declare function relayoutPert(resolved: ResolvedPert, overrides: LayoutOverrides, collapsedGroupIds?: ReadonlySet<string>): LayoutResult;
|
|
3381
|
-
|
|
3382
|
-
/**
|
|
3383
|
-
* Substitute `start-date now` with the host-local resolved date.
|
|
3384
|
-
* Pass the result to `encodeDiagramUrl` so the share-link captures
|
|
3385
|
-
* the resolved date, not the literal token.
|
|
3386
|
-
*
|
|
3387
|
-
* Lines without `start-date now` (explicit-date lines, comments,
|
|
3388
|
-
* other directives, activity lines containing the word "now") pass
|
|
3389
|
-
* through verbatim.
|
|
3390
|
-
*/
|
|
3391
|
-
declare function normalizePertSourceForShare(dsl: string): string;
|
|
3392
|
-
|
|
3393
|
-
interface PertRenderOptions {
|
|
3394
|
-
/** Optional title rendered above the diagram. */
|
|
3395
|
-
title?: string | null;
|
|
3396
|
-
/**
|
|
3397
|
-
* Optional one-line project subtitle rendered under the title (or in
|
|
3398
|
-
* the title slot when the title is suppressed via `no-title`). Carries
|
|
3399
|
-
* the project-level μ ± σ + anchor-derived date(s) so the duration
|
|
3400
|
-
* stays visible even when the Analysis row is toggled off. Pass `null`
|
|
3401
|
-
* to suppress (the desktop preview does this — it draws an HTML
|
|
3402
|
-
* subtitle below the React `<h1>` instead). Typically wired from
|
|
3403
|
-
* `resolved.projectSubtitle`.
|
|
3404
|
-
*/
|
|
3405
|
-
subtitle?: string | null;
|
|
3406
|
-
/** Optional callback for click → editor sync. */
|
|
3407
|
-
onClickItem?: (lineNumber: number) => void;
|
|
3408
|
-
/**
|
|
3409
|
-
* Override container dimensions during export. Treated as a hint:
|
|
3410
|
-
* the renderer will expand height/width if needed to fit chrome
|
|
3411
|
-
* (title + backward-anchor annotation + diagram body + caption
|
|
3412
|
-
* block) so the diagram never clips. Pass `undefined` (or omit) to
|
|
3413
|
-
* use the auto-computed natural size.
|
|
3414
|
-
*/
|
|
3415
|
-
exportDims?: {
|
|
3416
|
-
width?: number;
|
|
3417
|
-
height?: number;
|
|
3418
|
-
};
|
|
3419
|
-
/**
|
|
3420
|
-
* Group ids that should render as a single collapsed surface.
|
|
3421
|
-
* When set, the renderer:
|
|
3422
|
-
* - draws the group rect with a solid fill and the rolled-up
|
|
3423
|
-
* attribute body (μ / σ / slack / ES·EF / LS·LF / criticality)
|
|
3424
|
-
* - skips every activity node whose `groupId` is in this set
|
|
3425
|
-
* - skips every edge whose source AND target are both inside a
|
|
3426
|
-
* collapsed group (i.e. internal-only edges)
|
|
3427
|
-
*/
|
|
3428
|
-
collapsedGroupIds?: readonly string[];
|
|
3429
|
-
/**
|
|
3430
|
-
* Render the 3×2 field-reference mini-card to the right of the
|
|
3431
|
-
* Summary box. Helps presenters explain what each schedule cell
|
|
3432
|
-
* (ES / dur / EF / LS / slack / LF) means while reviewing the
|
|
3433
|
-
* diagram. Off by default; the desktop app turns it on with the
|
|
3434
|
-
* "Field labels" toggle.
|
|
3435
|
-
*/
|
|
3436
|
-
showFieldLegend?: boolean;
|
|
3437
|
-
/**
|
|
3438
|
-
* Render the top legend (Critical Path / Anchor / Milestone pills)
|
|
3439
|
-
* inside the SVG, between the title and the diagram. Defaults to
|
|
3440
|
-
* true so CLI exports and share-link images include the legend; the
|
|
3441
|
-
* desktop preview flips it off and renders the legend in a sibling
|
|
3442
|
-
* native-pixel SVG instead, so the pill text stays at intended size
|
|
3443
|
-
* even when the diagram SVG gets scale-to-fit'd into the panel.
|
|
3444
|
-
*/
|
|
3445
|
-
showTopLegend?: boolean;
|
|
3446
|
-
/**
|
|
3447
|
-
* Render the project-stats Summary box below the diagram. Defaults
|
|
3448
|
-
* to true so CLI exports / share-link images keep showing it; the
|
|
3449
|
-
* desktop app's cog has a "Summary" toggle that flips this off when
|
|
3450
|
-
* readers want a cleaner chart.
|
|
3451
|
-
*/
|
|
3452
|
-
showSummary?: boolean;
|
|
3453
|
-
/**
|
|
3454
|
-
* Render the Tornado sensitivity chart below the diagram. Reads
|
|
3455
|
-
* existing Monte-Carlo output (criticality + per-activity sigma)
|
|
3456
|
-
* and ranks activities by Schedule Sensitivity Index. Off by
|
|
3457
|
-
* default; the desktop app exposes it as a cog toggle.
|
|
3458
|
-
* When MC didn't run (analytical mode), the widget renders nothing.
|
|
3459
|
-
*/
|
|
3460
|
-
showTornado?: boolean;
|
|
3461
|
-
/**
|
|
3462
|
-
* Render the S-curve (cumulative completion probability) below the
|
|
3463
|
-
* diagram. Reads the empirical CDF of Monte-Carlo trial finish times
|
|
3464
|
-
* — gives readers the full distribution shape, not just three
|
|
3465
|
-
* percentile dates. Off by default. Silently omits when MC didn't
|
|
3466
|
-
* run.
|
|
3467
|
-
*/
|
|
3468
|
-
showScurve?: boolean;
|
|
3469
|
-
/**
|
|
3470
|
-
* Programmatic override for the active tag group — wins over
|
|
3471
|
-
* `options.activeTag` from the parsed source. Used by the desktop
|
|
3472
|
-
* preview when the user clicks a tag-legend pill: that interaction
|
|
3473
|
-
* sets the override (without mutating the parsed source) and
|
|
3474
|
-
* triggers a re-render with the new coloring. Pass `null` (or
|
|
3475
|
-
* `'none'`) to explicitly suppress tag coloring; omit to fall
|
|
3476
|
-
* through to the parsed `active-tag` directive.
|
|
3477
|
-
*/
|
|
3478
|
-
activeTagOverride?: string | null;
|
|
3479
|
-
}
|
|
3480
|
-
declare function renderPert(container: HTMLDivElement, resolved: ResolvedPert, layout: LayoutResult, palette: PaletteColors, isDark: boolean, options?: PertRenderOptions): void;
|
|
3481
|
-
declare function renderPertForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors,
|
|
3482
|
-
/**
|
|
3483
|
-
* Optional parse-time "today" override. Threads through to
|
|
3484
|
-
* `parsePert({ now })` so the analyzer's backward-mode past-date
|
|
3485
|
-
* check + the anchor annotation's "(as of YYYY-MM-DD)" suffix stay
|
|
3486
|
-
* deterministic. Test snapshots pin this; production code omits it.
|
|
3487
|
-
*/
|
|
3488
|
-
now?: Date): string;
|
|
3489
|
-
/**
|
|
3490
|
-
* Measure (without painting) the natural dimensions the analysis layer
|
|
3491
|
-
* would consume at the given width. Used by callers that need to lay
|
|
3492
|
-
* out the analysis SVG alongside other content — most importantly the
|
|
3493
|
-
* desktop preview, which fits diagram + analysis into a fixed panel
|
|
3494
|
-
* height by scaling proportionally when natural sizes overflow.
|
|
3495
|
-
*/
|
|
3496
|
-
declare function measurePertAnalysisBlock(resolved: ResolvedPert, width: number, options: {
|
|
3497
|
-
showSummary?: boolean;
|
|
3498
|
-
showTornado?: boolean;
|
|
3499
|
-
showScurve?: boolean;
|
|
3500
|
-
showFieldLegend?: boolean;
|
|
3501
|
-
}): {
|
|
3502
|
-
width: number;
|
|
3503
|
-
height: number;
|
|
3504
|
-
};
|
|
3505
|
-
/**
|
|
3506
|
-
* Render the PERT analysis layer (Summary + Tornado + S-curve + Field
|
|
3507
|
-
* labels) into its own sibling SVG at native pixel size. Used by the
|
|
3508
|
-
* desktop preview so the analysis text stays at intended size even when
|
|
3509
|
-
* the main diagram SVG is scale-to-fit'd into the panel.
|
|
3510
|
-
*/
|
|
3511
|
-
declare function renderPertAnalysisBlock(container: HTMLDivElement, resolved: ResolvedPert, palette: PaletteColors, isDark: boolean, options: {
|
|
3512
|
-
width: number;
|
|
3513
|
-
showSummary?: boolean;
|
|
3514
|
-
showTornado?: boolean;
|
|
3515
|
-
showScurve?: boolean;
|
|
3516
|
-
showFieldLegend?: boolean;
|
|
3517
|
-
}): void;
|
|
3518
|
-
/**
|
|
3519
|
-
* Fade everything in the diagram that doesn't belong to the given
|
|
3520
|
-
* legend set (`'critical'`, `'anchor'`, or `'milestone'`). Auto-detects
|
|
3521
|
-
* MC vs analytical mode for the critical-path rule.
|
|
3522
|
-
*
|
|
3523
|
-
* No-op when nothing qualifies (e.g. hovering Anchor on a diagram with
|
|
3524
|
-
* no anchor — shouldn't happen because the pill wouldn't render, but
|
|
3525
|
-
* defensive). The React layer is responsible for resetting via
|
|
3526
|
-
* `resetPertHighlight` when hover/click goes away.
|
|
3527
|
-
*/
|
|
3528
|
-
declare function highlightPertSet(container: Element, kind: LegendKind): void;
|
|
3529
|
-
/**
|
|
3530
|
-
* Critical-path-specific shorthand for `highlightPertSet(container,
|
|
3531
|
-
* 'critical')`. Kept for backwards compatibility with existing callers.
|
|
3532
|
-
*/
|
|
3533
|
-
declare function highlightPertCriticalPath(container: Element): void;
|
|
3534
|
-
/**
|
|
3535
|
-
* Reset opacities applied by `highlightPertSet`. Safe to call when no
|
|
3536
|
-
* highlight is active.
|
|
3537
|
-
*/
|
|
3538
|
-
declare function resetPertHighlight(container: Element): void;
|
|
3539
|
-
/**
|
|
3540
|
-
* Backwards-compatible alias for `resetPertHighlight`.
|
|
3541
|
-
*/
|
|
3542
|
-
declare function resetPertCriticalPath(container: Element): void;
|
|
3543
|
-
/**
|
|
3544
|
-
* Render the 3×2 PERT-field reference card. A neutral-tinted rounded
|
|
3545
|
-
* rect with a "Activity card fields" header band on top (mirroring the
|
|
3546
|
-
* Summary's typographic idiom) and a 3×2 grid of labeled definitions
|
|
3547
|
-
* below — so the cells map 1-to-1 to the schedule cells of every
|
|
3548
|
-
* activity card without pretending to be a node themselves.
|
|
3549
|
-
*
|
|
3550
|
-
* The cell content is vertically centered inside each row, so the
|
|
3551
|
-
* legend looks balanced whether it's sized to a tall Summary (lots of
|
|
3552
|
-
* bullets) or its compact default height.
|
|
3553
|
-
*
|
|
3554
|
-
* Cell order follows `drawTextbookCard`:
|
|
3555
|
-
* top: [ Early Start | Duration | Early Finish ]
|
|
3556
|
-
* bottom: [ Late Start | Slack | Late Finish ]
|
|
3557
|
-
*/
|
|
3558
|
-
type LegendKind = 'critical' | 'anchor' | 'milestone';
|
|
3559
|
-
interface LegendEntry {
|
|
3560
|
-
kind: LegendKind;
|
|
3561
|
-
label: string;
|
|
3562
|
-
}
|
|
3563
|
-
/**
|
|
3564
|
-
* Returns the PERT-specific legend entries (Critical Path / Anchor /
|
|
3565
|
-
* Milestone). Tag groups are rendered separately via the shared
|
|
3566
|
-
* `renderLegendD3` helper so they get the standard collapsible-capsule
|
|
3567
|
-
* treatment used by org / kanban / gantt.
|
|
3568
|
-
*/
|
|
3569
|
-
declare function pertLegendEntries(resolved: ResolvedPert): LegendEntry[];
|
|
3570
|
-
interface LegendBlockArgs {
|
|
3571
|
-
x: number;
|
|
3572
|
-
y: number;
|
|
3573
|
-
width: number;
|
|
3574
|
-
palette: PaletteColors;
|
|
3575
|
-
isDark: boolean;
|
|
3576
|
-
}
|
|
3577
|
-
/**
|
|
3578
|
-
* Render the top-legend pill row. Each pill carries
|
|
3579
|
-
* `data-legend-entry="critical|anchor|milestone"` so the React layer
|
|
3580
|
-
* can attach hover/click wiring to fade the matching set.
|
|
3581
|
-
*
|
|
3582
|
-
* Visual style mirrors the shared `renderLegendD3` pill convention so
|
|
3583
|
-
* PERT looks consistent with Cycle / Mindmap / BoxesAndLines: 28px tall,
|
|
3584
|
-
* fully-rounded rx, mix-fill against surface, no stroke, 11pt label.
|
|
3585
|
-
*/
|
|
3586
|
-
declare const PERT_LEGEND_PILL_HEIGHT = 28;
|
|
3587
|
-
declare function pertLegendBlockWidth(entries: LegendEntry[]): number;
|
|
3588
|
-
declare function renderLegendBlock(svg: d3Selection.Selection<SVGSVGElement, unknown, null, undefined>, entries: LegendEntry[], args: LegendBlockArgs): void;
|
|
3589
|
-
|
|
3590
|
-
interface MindmapNode {
|
|
3591
|
-
id: string;
|
|
3592
|
-
label: string;
|
|
3593
|
-
description?: string[];
|
|
3594
|
-
metadata: Record<string, string>;
|
|
3595
|
-
children: MindmapNode[];
|
|
3596
|
-
parentId: string | null;
|
|
3597
|
-
lineNumber: number;
|
|
3598
|
-
color?: string;
|
|
3599
|
-
collapsed?: boolean;
|
|
3600
|
-
}
|
|
3601
|
-
interface ParsedMindmap {
|
|
3602
|
-
title: string | null;
|
|
3603
|
-
titleLineNumber: number | null;
|
|
3604
|
-
roots: MindmapNode[];
|
|
3605
|
-
tagGroups: TagGroup[];
|
|
3606
|
-
options: Record<string, string>;
|
|
3607
|
-
diagnostics: DgmoError[];
|
|
3608
|
-
error: string | null;
|
|
3609
|
-
}
|
|
3610
|
-
interface MindmapLayoutNode {
|
|
3611
|
-
id: string;
|
|
3612
|
-
label: string;
|
|
3613
|
-
description?: string[];
|
|
3614
|
-
metadata: Record<string, string>;
|
|
3615
|
-
lineNumber: number;
|
|
3616
|
-
color?: string;
|
|
3617
|
-
x: number;
|
|
3618
|
-
y: number;
|
|
3619
|
-
width: number;
|
|
3620
|
-
height: number;
|
|
3621
|
-
depth: number;
|
|
3622
|
-
angle: number;
|
|
3623
|
-
radius: number;
|
|
3624
|
-
hiddenCount?: number;
|
|
3625
|
-
hasChildren?: boolean;
|
|
3626
|
-
}
|
|
3627
|
-
interface MindmapLayoutEdge {
|
|
3628
|
-
sourceId: string;
|
|
3629
|
-
targetId: string;
|
|
3630
|
-
path: string;
|
|
3631
|
-
}
|
|
3632
|
-
interface MindmapLayoutResult {
|
|
3633
|
-
nodes: MindmapLayoutNode[];
|
|
3634
|
-
edges: MindmapLayoutEdge[];
|
|
3635
|
-
width: number;
|
|
3636
|
-
height: number;
|
|
3637
|
-
}
|
|
3638
|
-
|
|
3639
|
-
declare function parseMindmap(content: string, palette?: PaletteColors): ParsedMindmap;
|
|
3640
|
-
|
|
3641
|
-
declare function layoutMindmap(parsed: ParsedMindmap, palette: PaletteColors, options?: {
|
|
3642
|
-
interactive?: boolean;
|
|
3643
|
-
hiddenCounts?: Map<string, number>;
|
|
3644
|
-
activeTagGroup?: string | null;
|
|
3645
|
-
hideDescriptions?: boolean;
|
|
3646
|
-
}): MindmapLayoutResult;
|
|
3647
|
-
|
|
3648
|
-
declare function renderMindmap(container: HTMLDivElement, parsed: ParsedMindmap, layout: MindmapLayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
3649
|
-
width?: number;
|
|
3650
|
-
height?: number;
|
|
3651
|
-
}, onToggleNode?: (nodeId: string) => void, hideDescriptions?: boolean, activeTagGroup?: string | null, options?: {
|
|
3652
|
-
colorByDepth?: boolean;
|
|
3653
|
-
onToggleColorByDepth?: (active: boolean) => void;
|
|
3654
|
-
onToggleDescriptions?: (active: boolean) => void;
|
|
3655
|
-
controlsExpanded?: boolean;
|
|
3656
|
-
onToggleControlsExpand?: () => void;
|
|
3657
|
-
}): void;
|
|
3658
|
-
declare function renderMindmapForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
3659
|
-
|
|
3660
|
-
interface CollapsedMindmapResult {
|
|
3661
|
-
/** Roots with collapsed subtrees pruned (deep-cloned, never mutates original) */
|
|
3662
|
-
roots: MindmapNode[];
|
|
3663
|
-
/** nodeId → count of hidden descendants */
|
|
3664
|
-
hiddenCounts: Map<string, number>;
|
|
3665
|
-
}
|
|
3666
|
-
declare function collapseMindmapTree(roots: MindmapNode[], collapsedIds: Set<string>): CollapsedMindmapResult;
|
|
3667
|
-
|
|
3668
|
-
/**
|
|
3669
|
-
* All wireframe element types.
|
|
3670
|
-
* Visual-mnemonic elements are inferred from bracket syntax;
|
|
3671
|
-
* keyword elements use a small vocabulary (9 keywords).
|
|
3672
|
-
*/
|
|
3673
|
-
type WireframeElementType = 'group' | 'textInput' | 'button' | 'dropdown' | 'checkbox' | 'radio' | 'heading' | 'divider' | 'text' | 'listItem' | 'nav' | 'tabs' | 'table' | 'image' | 'modal' | 'skeleton' | 'alert' | 'progress' | 'chart';
|
|
3674
|
-
/**
|
|
3675
|
-
* Single flat interface for all wireframe elements (ADR-8).
|
|
3676
|
-
* No separate WireframeGroup — all elements carry group fields
|
|
3677
|
-
* with sensible defaults (isContainer=false, orientation='vertical', isSkeleton=false).
|
|
3678
|
-
*/
|
|
3679
|
-
interface WireframeElement {
|
|
3680
|
-
id: string;
|
|
3681
|
-
type: WireframeElementType;
|
|
3682
|
-
/** Display label / placeholder text / heading text */
|
|
3683
|
-
label: string;
|
|
3684
|
-
/** Child elements (non-empty only when isContainer=true) */
|
|
3685
|
-
children: WireframeElement[];
|
|
3686
|
-
/** Pipe metadata key-value pairs */
|
|
3687
|
-
metadata: Record<string, string>;
|
|
3688
|
-
/** State keywords: disabled, active, ghost, destructive, etc. */
|
|
3689
|
-
states: string[];
|
|
3690
|
-
/** Free-text annotations from pipe metadata */
|
|
3691
|
-
annotations: string[];
|
|
3692
|
-
/** 1-based line number in source */
|
|
3693
|
-
lineNumber: number;
|
|
3694
|
-
/** Measured indentation (column) */
|
|
3695
|
-
indent: number;
|
|
3696
|
-
/** True when element has children (set during parse via indent stack) */
|
|
3697
|
-
isContainer: boolean;
|
|
3698
|
-
/** Stacking direction for group children */
|
|
3699
|
-
orientation: 'vertical' | 'horizontal';
|
|
3700
|
-
/** True when inside a skeleton block */
|
|
3701
|
-
isSkeleton: boolean;
|
|
3702
|
-
/** Heading level: 1 for `#`, 2 for `##` */
|
|
3703
|
-
headingLevel?: number;
|
|
3704
|
-
/** Dropdown options (for type='dropdown') */
|
|
3705
|
-
options?: string[];
|
|
3706
|
-
/** Checked state (for type='checkbox') */
|
|
3707
|
-
checked?: boolean;
|
|
3708
|
-
/** Selected state (for type='radio') */
|
|
3709
|
-
selected?: boolean;
|
|
3710
|
-
/** Image hint: 'default' | 'round' | 'wide' */
|
|
3711
|
-
imageHint?: 'default' | 'round' | 'wide';
|
|
3712
|
-
/** Progress value 0-100 (for type='progress') */
|
|
3713
|
-
progressValue?: number;
|
|
3714
|
-
/** Chart hint: 'line' | 'bar' | 'pie' */
|
|
3715
|
-
chartHint?: 'line' | 'bar' | 'pie';
|
|
3716
|
-
/** Table dimensions for skeleton shorthand (for type='table') */
|
|
3717
|
-
tableRows?: number;
|
|
3718
|
-
tableCols?: number;
|
|
3719
|
-
/** Table header row labels (for type='table') */
|
|
3720
|
-
tableHeaders?: string[];
|
|
3721
|
-
/** Table data rows — each row is an array of cell content strings (for type='table') */
|
|
3722
|
-
tableData?: string[][];
|
|
3723
|
-
/** Inline elements on the same line (multi-element line) */
|
|
3724
|
-
inlineElements?: WireframeElement[];
|
|
3725
|
-
/** Label element for label-field pairing */
|
|
3726
|
-
labelFor?: WireframeElement;
|
|
3727
|
-
/** Color from tag system */
|
|
3728
|
-
color?: string;
|
|
3729
|
-
/** Field variant: password, textarea */
|
|
3730
|
-
fieldVariant?: 'password' | 'textarea';
|
|
3731
|
-
}
|
|
3732
|
-
/** Form factor / layout mode */
|
|
3733
|
-
type WireframeFormFactor = 'desktop' | 'mobile';
|
|
3734
|
-
interface ParsedWireframe {
|
|
3735
|
-
title: string | null;
|
|
3736
|
-
titleLineNumber: number | null;
|
|
3737
|
-
formFactor: WireframeFormFactor;
|
|
3738
|
-
/** Top-level elements (roots of the hierarchy) */
|
|
3739
|
-
roots: WireframeElement[];
|
|
3740
|
-
/** Modal elements (rendered separately below main) */
|
|
3741
|
-
modals: WireframeElement[];
|
|
3742
|
-
tagGroups: TagGroup[];
|
|
3743
|
-
options: Record<string, string>;
|
|
3744
|
-
diagnostics: DgmoError[];
|
|
3745
|
-
error: string | null;
|
|
3746
|
-
}
|
|
3747
|
-
|
|
3748
|
-
declare function parseWireframe(content: string): ParsedWireframe;
|
|
3749
|
-
|
|
3750
|
-
interface WireframeLayoutNode {
|
|
3751
|
-
id: string;
|
|
3752
|
-
x: number;
|
|
3753
|
-
y: number;
|
|
3754
|
-
width: number;
|
|
3755
|
-
height: number;
|
|
3756
|
-
element: WireframeElement;
|
|
3757
|
-
children: WireframeLayoutNode[];
|
|
3758
|
-
/** For label-field pairs: the x offset where fields align */
|
|
3759
|
-
fieldAlignX?: number;
|
|
3760
|
-
}
|
|
3761
|
-
interface WireframeLayout {
|
|
3762
|
-
width: number;
|
|
3763
|
-
height: number;
|
|
3764
|
-
titleHeight: number;
|
|
3765
|
-
nodes: WireframeLayoutNode[];
|
|
3766
|
-
modalNodes: WireframeLayoutNode[];
|
|
3767
|
-
}
|
|
3768
|
-
declare function layoutWireframe(parsed: ParsedWireframe, _options?: Record<string, string>, overrideWidth?: number, showGroupLabels?: boolean): WireframeLayout;
|
|
3769
|
-
|
|
3770
|
-
interface WireframeRenderOptions {
|
|
3771
|
-
exportDims?: {
|
|
3772
|
-
width?: number;
|
|
3773
|
-
height?: number;
|
|
3774
|
-
};
|
|
3775
|
-
theme?: string;
|
|
3776
|
-
onClickItem?: (lineNumber: number) => void;
|
|
3777
|
-
/** Controls group state */
|
|
3778
|
-
controlsExpanded?: boolean;
|
|
3779
|
-
fitWidth?: boolean;
|
|
3780
|
-
showGroupLabels?: boolean;
|
|
3781
|
-
onControlsExpand?: () => void;
|
|
3782
|
-
onControlsToggle?: (id: string, active: boolean) => void;
|
|
3783
|
-
}
|
|
3784
|
-
declare function renderWireframe(container: HTMLDivElement, parsed: ParsedWireframe, layout: WireframeLayout, palette: PaletteColors, isDark: boolean, _onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
3785
|
-
width?: number;
|
|
3786
|
-
height?: number;
|
|
3787
|
-
}, theme?: string, options?: WireframeRenderOptions): void;
|
|
3788
|
-
|
|
3789
|
-
type QuadrantPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3790
|
-
type BlipTrend = 'new' | 'up' | 'down' | 'stable';
|
|
3791
|
-
interface TechRadarRing {
|
|
3792
|
-
name: string;
|
|
3793
|
-
alias: string | null;
|
|
3794
|
-
lineNumber: number;
|
|
3795
|
-
}
|
|
3796
|
-
interface TechRadarBlip {
|
|
3797
|
-
name: string;
|
|
3798
|
-
ring: string;
|
|
3799
|
-
trend: BlipTrend | null;
|
|
3800
|
-
description: string[];
|
|
3801
|
-
lineNumber: number;
|
|
3802
|
-
/** Assigned after parsing — global numbering across all quadrants. */
|
|
3803
|
-
globalNumber: number;
|
|
3804
|
-
}
|
|
3805
|
-
interface TechRadarQuadrant {
|
|
3806
|
-
name: string;
|
|
3807
|
-
position: QuadrantPosition;
|
|
3808
|
-
color: string | null;
|
|
3809
|
-
lineNumber: number;
|
|
3810
|
-
blips: TechRadarBlip[];
|
|
3811
|
-
}
|
|
3812
|
-
interface ParsedTechRadar {
|
|
3813
|
-
type: 'tech-radar';
|
|
3814
|
-
title: string;
|
|
3815
|
-
titleLineNumber: number;
|
|
3816
|
-
rings: TechRadarRing[];
|
|
3817
|
-
quadrants: TechRadarQuadrant[];
|
|
3818
|
-
options: Record<string, string>;
|
|
3819
|
-
diagnostics: DgmoError[];
|
|
3820
|
-
error: string | null;
|
|
3821
|
-
}
|
|
3822
|
-
interface TechRadarLayoutPoint {
|
|
3823
|
-
blip: TechRadarBlip;
|
|
3824
|
-
x: number;
|
|
3825
|
-
y: number;
|
|
3826
|
-
quadrantIndex: number;
|
|
3827
|
-
ringIndex: number;
|
|
3828
|
-
}
|
|
3829
|
-
interface TechRadarRenderOptions {
|
|
3830
|
-
/** Whether the blip listing is visible. Default: true for export, false for interactive. */
|
|
3831
|
-
showListing?: boolean;
|
|
3832
|
-
/** Callback when the listing toggle is clicked. */
|
|
3833
|
-
onToggleListing?: (show: boolean) => void;
|
|
3834
|
-
/** Whether the controls legend capsule is expanded. */
|
|
3835
|
-
controlsExpanded?: boolean;
|
|
3836
|
-
/** Callback when the controls gear pill is clicked (expand/collapse). */
|
|
3837
|
-
onToggleControlsExpand?: () => void;
|
|
3838
|
-
/** Active legend group name (e.g. 'Trends'). */
|
|
3839
|
-
activeLegendGroup?: string | null;
|
|
3840
|
-
/** Callback when a legend group pill is toggled. */
|
|
3841
|
-
onLegendGroupToggle?: (groupName: string) => void;
|
|
3842
|
-
/** Active line from the editor cursor — triggers popover/expansion for that blip. */
|
|
3843
|
-
activeLine?: number | null;
|
|
3844
|
-
}
|
|
3845
|
-
|
|
3846
|
-
declare function parseTechRadar(content: string): ParsedTechRadar;
|
|
3847
|
-
|
|
3848
|
-
/**
|
|
3849
|
-
* Compute deterministic, non-overlapping blip positions for a tech radar.
|
|
3850
|
-
*
|
|
3851
|
-
* Each blip is positioned within its ring+quadrant slice using polar coordinates,
|
|
3852
|
-
* then converted to cartesian. The algorithm is:
|
|
3853
|
-
* - Stable: changes in one slice don't affect other slices
|
|
3854
|
-
* - Deterministic: same input always produces same output
|
|
3855
|
-
* - Collision-avoiding: nudges overlapping blips radially within their ring band
|
|
3856
|
-
*/
|
|
3857
|
-
declare function computeRadarLayout(parsed: ParsedTechRadar, width: number, height: number): TechRadarLayoutPoint[];
|
|
3858
|
-
/**
|
|
3859
|
-
* Get the center and max radius for a radar at the given dimensions.
|
|
3860
|
-
* Useful for renderers that need these values independently.
|
|
3861
|
-
*/
|
|
3862
|
-
declare function getRadarGeometry(width: number, height: number, ringCount: number): {
|
|
3863
|
-
cx: number;
|
|
3864
|
-
cy: number;
|
|
3865
|
-
maxRadius: number;
|
|
3866
|
-
ringBandWidth: number;
|
|
3867
|
-
};
|
|
3868
|
-
|
|
3869
|
-
declare function renderTechRadar(container: HTMLDivElement, parsed: ParsedTechRadar, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions, viewState?: CompactViewState, options?: TechRadarRenderOptions): void;
|
|
3870
|
-
declare function renderTechRadarForExport(container: HTMLDivElement, parsed: ParsedTechRadar, palette: PaletteColors, isDark: boolean, exportDims?: D3ExportDimensions, viewState?: CompactViewState): void;
|
|
3871
|
-
|
|
3872
|
-
declare function renderQuadrantFocus(container: HTMLDivElement, parsed: ParsedTechRadar, quadrantPosition: QuadrantPosition, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions, _options?: TechRadarRenderOptions): void;
|
|
3873
|
-
declare function renderQuadrantFocusForExport(container: HTMLDivElement, parsed: ParsedTechRadar, quadrantPosition: QuadrantPosition, palette: PaletteColors, isDark: boolean, exportDims: {
|
|
3874
|
-
width: number;
|
|
3875
|
-
height: number;
|
|
3876
|
-
}): void;
|
|
3877
|
-
|
|
3878
|
-
/**
|
|
3879
|
-
* One rendered description line. `kind` controls horizontal placement and
|
|
3880
|
-
* whether the renderer draws a bullet glyph:
|
|
3881
|
-
* - `plain` — flush left at the description's left edge
|
|
3882
|
-
* - `bullet-first` — "•" drawn at the left edge, body text at the bullet column
|
|
3883
|
-
* - `bullet-cont` — body continuation at the bullet column (no glyph)
|
|
3884
|
-
*
|
|
3885
|
-
* Splitting first-line bullet rendering into separate text elements lets
|
|
3886
|
-
* continuation lines align exactly under the first word past the bullet,
|
|
3887
|
-
* regardless of font-width estimation drift.
|
|
3888
|
-
*/
|
|
3889
|
-
interface WrappedDescLine {
|
|
3890
|
-
text: string;
|
|
3891
|
-
kind: 'plain' | 'bullet-first' | 'bullet-cont';
|
|
3892
|
-
}
|
|
3893
|
-
|
|
3894
|
-
interface CycleNode {
|
|
3895
|
-
label: string;
|
|
3896
|
-
lineNumber: number;
|
|
3897
|
-
color?: string;
|
|
3898
|
-
span: number;
|
|
3899
|
-
description: string[];
|
|
3900
|
-
metadata: Record<string, string>;
|
|
3901
|
-
}
|
|
3902
|
-
interface CycleEdge {
|
|
3903
|
-
sourceIndex: number;
|
|
3904
|
-
targetIndex: number;
|
|
3905
|
-
label?: string;
|
|
3906
|
-
color?: string;
|
|
3907
|
-
width?: number;
|
|
3908
|
-
description: string[];
|
|
3909
|
-
lineNumber?: number;
|
|
3910
|
-
metadata: Record<string, string>;
|
|
3911
|
-
}
|
|
3912
|
-
interface ParsedCycle {
|
|
3913
|
-
type: 'cycle';
|
|
3914
|
-
title: string;
|
|
3915
|
-
titleLineNumber: number;
|
|
3916
|
-
nodes: CycleNode[];
|
|
3917
|
-
edges: CycleEdge[];
|
|
3918
|
-
direction: 'clockwise' | 'counterclockwise';
|
|
3919
|
-
options: Record<string, string>;
|
|
3920
|
-
diagnostics: DgmoError[];
|
|
3921
|
-
error: string | null;
|
|
3922
|
-
}
|
|
3923
|
-
|
|
3924
|
-
interface CycleLayoutNode {
|
|
3925
|
-
label: string;
|
|
3926
|
-
x: number;
|
|
3927
|
-
y: number;
|
|
3928
|
-
angle: number;
|
|
3929
|
-
width: number;
|
|
3930
|
-
height: number;
|
|
3931
|
-
/** Pre-wrapped description lines (fit to node width). Empty if no descriptions. */
|
|
3932
|
-
wrappedDesc: WrappedDescLine[];
|
|
3933
|
-
/** Whether this node should be rendered as a circle. */
|
|
3934
|
-
isCircle: boolean;
|
|
3935
|
-
}
|
|
3936
|
-
interface CycleLayoutEdge {
|
|
3937
|
-
sourceIndex: number;
|
|
3938
|
-
targetIndex: number;
|
|
3939
|
-
path: string;
|
|
3940
|
-
labelX: number;
|
|
3941
|
-
labelY: number;
|
|
3942
|
-
/** Angle of the label position on the circle (radians), for text-anchor. */
|
|
3943
|
-
labelAngle: number;
|
|
3944
|
-
label?: string;
|
|
3945
|
-
}
|
|
3946
|
-
interface CycleLayoutResult {
|
|
3947
|
-
nodes: CycleLayoutNode[];
|
|
3948
|
-
edges: CycleLayoutEdge[];
|
|
3949
|
-
cx: number;
|
|
3950
|
-
cy: number;
|
|
3951
|
-
radius: number;
|
|
3952
|
-
width: number;
|
|
3953
|
-
height: number;
|
|
3954
|
-
/** Scale factor applied to nodes (1 = no scaling, <1 = shrunk to fit). */
|
|
3955
|
-
scale: number;
|
|
3956
|
-
}
|
|
3957
|
-
|
|
3958
|
-
/**
|
|
3959
|
-
* Parse a `.dgmo` cycle diagram document.
|
|
3960
|
-
*
|
|
3961
|
-
* Syntax:
|
|
3962
|
-
* ```
|
|
3963
|
-
* cycle Title
|
|
3964
|
-
*
|
|
3965
|
-
* direction-counterclockwise
|
|
3966
|
-
*
|
|
3967
|
-
* NodeLabel | color: blue, span: 3
|
|
3968
|
-
* Description line (indented under node)
|
|
3969
|
-
* -Label-> | color: red, width: 6
|
|
3970
|
-
* Edge description (indented under edge)
|
|
3971
|
-
* ```
|
|
3972
|
-
*/
|
|
3973
|
-
declare function parseCycle(content: string): ParsedCycle;
|
|
3974
|
-
|
|
3975
|
-
/**
|
|
3976
|
-
* Compute cycle diagram layout: positions nodes equidistant (or span-weighted)
|
|
3977
|
-
* on a circle, and generates curved edge paths between consecutive nodes.
|
|
3978
|
-
*/
|
|
3979
|
-
declare function computeCycleLayout(parsed: ParsedCycle, options?: {
|
|
3980
|
-
width?: number;
|
|
3981
|
-
height?: number;
|
|
3982
|
-
hideDescriptions?: boolean;
|
|
3983
|
-
}): CycleLayoutResult;
|
|
3984
|
-
|
|
3985
|
-
interface CycleRenderOptions {
|
|
3986
|
-
onClickItem?: (lineNumber: number) => void;
|
|
3987
|
-
exportDims?: D3ExportDimensions;
|
|
3988
|
-
viewState?: CompactViewState;
|
|
3989
|
-
hideDescriptions?: boolean;
|
|
3990
|
-
controlsExpanded?: boolean;
|
|
3991
|
-
onToggleDescriptions?: (active: boolean) => void;
|
|
3992
|
-
onToggleControlsExpand?: () => void;
|
|
3993
|
-
}
|
|
3994
|
-
/**
|
|
3995
|
-
* Render a cycle diagram into the given container.
|
|
3996
|
-
*/
|
|
3997
|
-
declare function renderCycle(container: HTMLDivElement, parsed: ParsedCycle, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions, viewState?: CompactViewState, renderOptions?: CycleRenderOptions): void;
|
|
3998
|
-
/**
|
|
3999
|
-
* Render for CLI/export (no click handlers).
|
|
4000
|
-
*/
|
|
4001
|
-
declare function renderCycleForExport(container: HTMLDivElement, parsed: ParsedCycle, palette: PaletteColors, isDark: boolean, exportDims?: D3ExportDimensions, viewState?: CompactViewState): void;
|
|
4002
|
-
|
|
4003
|
-
interface JourneyMapAnnotation {
|
|
4004
|
-
type: 'pain' | 'opportunity' | 'thought';
|
|
4005
|
-
text: string;
|
|
4006
|
-
}
|
|
4007
|
-
interface JourneyMapStep {
|
|
4008
|
-
id: string;
|
|
4009
|
-
title: string;
|
|
4010
|
-
score?: number;
|
|
4011
|
-
emotionLabel?: string;
|
|
4012
|
-
tags: Record<string, string>;
|
|
4013
|
-
annotations: JourneyMapAnnotation[];
|
|
4014
|
-
description?: string;
|
|
4015
|
-
lineNumber: number;
|
|
4016
|
-
endLineNumber: number;
|
|
4017
|
-
}
|
|
4018
|
-
interface JourneyMapPhase {
|
|
4019
|
-
id: string;
|
|
4020
|
-
name: string;
|
|
4021
|
-
steps: JourneyMapStep[];
|
|
4022
|
-
lineNumber: number;
|
|
4023
|
-
}
|
|
4024
|
-
interface JourneyMapPersona {
|
|
4025
|
-
name: string;
|
|
4026
|
-
description?: string;
|
|
4027
|
-
color?: string;
|
|
4028
|
-
lineNumber: number;
|
|
4029
|
-
}
|
|
4030
|
-
interface ParsedJourneyMap {
|
|
4031
|
-
type: 'journey-map';
|
|
4032
|
-
title?: string;
|
|
4033
|
-
titleLineNumber?: number;
|
|
4034
|
-
persona?: JourneyMapPersona;
|
|
4035
|
-
phases: JourneyMapPhase[];
|
|
4036
|
-
/** Flat-mode steps (not inside any phase) */
|
|
4037
|
-
steps: JourneyMapStep[];
|
|
4038
|
-
tagGroups: TagGroup[];
|
|
4039
|
-
options: Record<string, string>;
|
|
4040
|
-
diagnostics: DgmoError[];
|
|
4041
|
-
error: string | null;
|
|
4042
|
-
}
|
|
4043
|
-
|
|
4044
|
-
declare function parseJourneyMap(content: string, palette?: PaletteColors): ParsedJourneyMap;
|
|
4045
|
-
|
|
4046
|
-
interface CurvePoint {
|
|
4047
|
-
x: number;
|
|
4048
|
-
y: number;
|
|
4049
|
-
score: number;
|
|
4050
|
-
emotionLabel?: string;
|
|
4051
|
-
stepIndex: number;
|
|
4052
|
-
}
|
|
4053
|
-
interface StepLayout {
|
|
4054
|
-
x: number;
|
|
4055
|
-
y: number;
|
|
4056
|
-
width: number;
|
|
4057
|
-
height: number;
|
|
4058
|
-
step: JourneyMapStep;
|
|
4059
|
-
color: string;
|
|
4060
|
-
}
|
|
4061
|
-
interface PhaseLayout {
|
|
4062
|
-
x: number;
|
|
4063
|
-
y: number;
|
|
4064
|
-
width: number;
|
|
4065
|
-
height: number;
|
|
4066
|
-
phase: JourneyMapPhase;
|
|
4067
|
-
headerColor: string;
|
|
4068
|
-
stepLayouts: StepLayout[];
|
|
4069
|
-
}
|
|
4070
|
-
interface JourneyMapLayout {
|
|
4071
|
-
phases: PhaseLayout[];
|
|
4072
|
-
flatStepLayouts: StepLayout[];
|
|
4073
|
-
curvePoints: CurvePoint[];
|
|
4074
|
-
totalWidth: number;
|
|
4075
|
-
totalHeight: number;
|
|
4076
|
-
curveAreaTop: number;
|
|
4077
|
-
curveAreaBottom: number;
|
|
4078
|
-
cardAreaTop: number;
|
|
4079
|
-
personaHeight: number;
|
|
4080
|
-
titleHeight: number;
|
|
4081
|
-
/** Whether any step has thought annotations */
|
|
4082
|
-
hasThoughts: boolean;
|
|
4083
|
-
}
|
|
4084
|
-
declare function layoutJourneyMap(parsed: ParsedJourneyMap, palette: PaletteColors, options?: {
|
|
4085
|
-
exportDims?: {
|
|
4086
|
-
width: number;
|
|
4087
|
-
height: number;
|
|
4088
|
-
};
|
|
4089
|
-
collapsedPhases?: Set<string>;
|
|
4090
|
-
isDark?: boolean;
|
|
4091
|
-
}): JourneyMapLayout;
|
|
4092
|
-
|
|
4093
|
-
interface JourneyMapInteractiveOptions {
|
|
4094
|
-
onNavigateToLine?: (line: number) => void;
|
|
4095
|
-
exportDims?: {
|
|
4096
|
-
width: number;
|
|
4097
|
-
height: number;
|
|
4098
|
-
};
|
|
4099
|
-
activeTagGroup?: string | null;
|
|
4100
|
-
onActiveTagGroupChange?: (group: string | null) => void;
|
|
4101
|
-
/** Current editor cursor line — highlights the matching face + card, dims the rest */
|
|
4102
|
-
currentLine?: number | null;
|
|
4103
|
-
/** Set of collapsed phase names */
|
|
4104
|
-
collapsedPhases?: Set<string>;
|
|
4105
|
-
/** Called when a phase is toggled */
|
|
4106
|
-
onPhaseToggle?: (phaseName: string) => void;
|
|
4107
|
-
}
|
|
4108
|
-
declare function renderJourneyMap(container: HTMLElement, parsed: ParsedJourneyMap, palette: PaletteColors, isDark: boolean, options?: JourneyMapInteractiveOptions): void;
|
|
4109
|
-
declare function renderJourneyMapForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
4110
|
-
|
|
4111
|
-
interface PyramidLayer {
|
|
4112
|
-
label: string;
|
|
4113
|
-
lineNumber: number;
|
|
4114
|
-
/** Optional palette color name (red/green/blue/…). */
|
|
4115
|
-
color?: string;
|
|
4116
|
-
/** Description lines — from bare pipe shorthand or indented body. */
|
|
4117
|
-
description: string[];
|
|
4118
|
-
/** Unconsumed pipe metadata (reserved for future use). */
|
|
4119
|
-
metadata: Record<string, string>;
|
|
4120
|
-
}
|
|
4121
|
-
interface ParsedPyramid {
|
|
4122
|
-
type: 'pyramid';
|
|
4123
|
-
title: string;
|
|
4124
|
-
titleLineNumber: number;
|
|
4125
|
-
layers: PyramidLayer[];
|
|
4126
|
-
/** When true, apex points down instead of up. */
|
|
4127
|
-
inverted: boolean;
|
|
4128
|
-
options: Record<string, string>;
|
|
4129
|
-
diagnostics: DgmoError[];
|
|
4130
|
-
error: string | null;
|
|
4131
|
-
}
|
|
4132
|
-
|
|
4133
|
-
/**
|
|
4134
|
-
* Parse a `.dgmo` pyramid diagram document.
|
|
4135
|
-
*
|
|
4136
|
-
* Top of file = apex of pyramid (reads top-down).
|
|
4137
|
-
*
|
|
4138
|
-
* Syntax:
|
|
4139
|
-
* ```
|
|
4140
|
-
* pyramid Maslow's Hierarchy of Needs
|
|
4141
|
-
*
|
|
4142
|
-
* inverted // optional — flips apex to bottom
|
|
4143
|
-
*
|
|
4144
|
-
* Self-Actualization // indented body = description
|
|
4145
|
-
* Achieving one's full potential.
|
|
4146
|
-
*
|
|
4147
|
-
* Esteem | Respect, recognition // bare pipe shorthand = description
|
|
4148
|
-
*
|
|
4149
|
-
* Love & Belonging | color: blue // structured metadata
|
|
4150
|
-
* Friendship, intimacy, family.
|
|
4151
|
-
*
|
|
4152
|
-
* Physiological | Food, water, rest
|
|
4153
|
-
* ```
|
|
4154
|
-
*/
|
|
4155
|
-
declare function parsePyramid(content: string): ParsedPyramid;
|
|
4156
|
-
|
|
4157
|
-
/**
|
|
4158
|
-
* Render a pyramid diagram into the given container.
|
|
4159
|
-
*/
|
|
4160
|
-
declare function renderPyramid(container: HTMLDivElement, parsed: ParsedPyramid, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
|
|
4161
|
-
/**
|
|
4162
|
-
* Render for CLI/export (no click handlers).
|
|
4163
|
-
*/
|
|
4164
|
-
declare function renderPyramidForExport(container: HTMLDivElement, parsed: ParsedPyramid, palette: PaletteColors, isDark: boolean, exportDims?: D3ExportDimensions): void;
|
|
4165
|
-
|
|
4166
|
-
interface RingLayer {
|
|
4167
|
-
label: string;
|
|
4168
|
-
lineNumber: number;
|
|
4169
|
-
/** Optional palette color name (red/green/blue/…). */
|
|
4170
|
-
color?: string;
|
|
4171
|
-
/** Description lines — from bare pipe shorthand or indented body. */
|
|
4172
|
-
description: string[];
|
|
4173
|
-
/** Unconsumed pipe metadata (reserved for future use). */
|
|
4174
|
-
metadata: Record<string, string>;
|
|
4175
|
-
}
|
|
4176
|
-
interface ParsedRing {
|
|
4177
|
-
type: 'ring';
|
|
4178
|
-
title: string;
|
|
4179
|
-
titleLineNumber: number;
|
|
4180
|
-
/** Source order: layers[0] = innermost (filled disc); last = outermost ring. */
|
|
4181
|
-
layers: RingLayer[];
|
|
4182
|
-
options: Record<string, string>;
|
|
4183
|
-
diagnostics: DgmoError[];
|
|
4184
|
-
error: string | null;
|
|
4185
|
-
}
|
|
4186
|
-
|
|
4187
|
-
/**
|
|
4188
|
-
* Parse a `.dgmo` ring diagram document.
|
|
4189
|
-
*
|
|
4190
|
-
* Top of file = innermost ring (rendered as a filled disc).
|
|
4191
|
-
* Last layer in source = outermost ring.
|
|
4192
|
-
*/
|
|
4193
|
-
declare function parseRing(content: string): ParsedRing;
|
|
4194
|
-
|
|
4195
|
-
/**
|
|
4196
|
-
* Render a ring diagram into the given container.
|
|
4197
|
-
*/
|
|
4198
|
-
declare function renderRing(container: HTMLDivElement, parsed: ParsedRing, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
|
|
4199
|
-
/**
|
|
4200
|
-
* Render for CLI/export (no click handlers).
|
|
4201
|
-
*/
|
|
4202
|
-
declare function renderRingForExport(container: HTMLDivElement, parsed: ParsedRing, palette: PaletteColors, isDark: boolean, exportDims?: D3ExportDimensions): void;
|
|
4203
|
-
|
|
4204
|
-
/** Marker alphabet member for any variant. */
|
|
4205
|
-
type RaciMarker = 'R' | 'A' | 'S' | 'C' | 'I' | 'D';
|
|
4206
|
-
/** Variant identifier — selects alphabet + constraint rule set. */
|
|
4207
|
-
type RaciVariant = 'raci' | 'rasci' | 'daci';
|
|
4208
|
-
/**
|
|
4209
|
-
* One `Role: <markers>` line under a task.
|
|
4210
|
-
*
|
|
4211
|
-
* `id` is the normalized role key — used by mutations to look up the
|
|
4212
|
-
* cell and by validation to detect unknown roles. `displayName` is the
|
|
4213
|
-
* first-seen casing/spacing for rendering.
|
|
4214
|
-
*/
|
|
4215
|
-
interface RaciRoleAssignment {
|
|
4216
|
-
id: string;
|
|
4217
|
-
displayName: string;
|
|
4218
|
-
markers: RaciMarker[];
|
|
4219
|
-
lineNumber: number;
|
|
4220
|
-
endLineNumber: number;
|
|
4221
|
-
}
|
|
4222
|
-
/** One task — flush-left under a phase or directly under the chart. */
|
|
4223
|
-
interface RaciTask {
|
|
4224
|
-
id: string;
|
|
4225
|
-
displayName: string;
|
|
4226
|
-
description: string;
|
|
4227
|
-
roleAssignments: RaciRoleAssignment[];
|
|
4228
|
-
lineNumber: number;
|
|
4229
|
-
endLineNumber: number;
|
|
4230
|
-
}
|
|
4231
|
-
/** Optional `[Phase Label]` group header — one level deep. */
|
|
4232
|
-
interface RaciPhase {
|
|
4233
|
-
id: string;
|
|
4234
|
-
displayName: string;
|
|
4235
|
-
/** Optional palette color from a `[Label](color)` suffix on the bracket. */
|
|
4236
|
-
color?: string;
|
|
4237
|
-
tasks: RaciTask[];
|
|
4238
|
-
lineNumber: number;
|
|
4239
|
-
endLineNumber: number;
|
|
4240
|
-
}
|
|
4241
|
-
/** Top-level parse result. */
|
|
4242
|
-
interface ParsedRaci {
|
|
4243
|
-
type: 'raci';
|
|
4244
|
-
/** Optional title from the chart-type header line. */
|
|
4245
|
-
title?: string;
|
|
4246
|
-
titleLineNumber?: number;
|
|
4247
|
-
/** Variant selected by directive, or by chart-type id when absent. */
|
|
4248
|
-
variant: RaciVariant;
|
|
4249
|
-
/**
|
|
4250
|
-
* Canonical column order. Populated either from an explicit
|
|
4251
|
-
* `roles:` directive or, when absent, from first-seen role usage.
|
|
4252
|
-
*/
|
|
4253
|
-
roles: string[];
|
|
4254
|
-
/** Display name for each role (parallel to `roles`). */
|
|
4255
|
-
roleDisplayNames: string[];
|
|
4256
|
-
/**
|
|
4257
|
-
* Optional per-role palette color from `Cap(blue)` suffix in the
|
|
4258
|
-
* roles block. Parallel to `roles`; entries default to `undefined`
|
|
4259
|
-
* (renderer falls back to the neutral column tint).
|
|
4260
|
-
*/
|
|
4261
|
-
roleColors: Array<string | undefined>;
|
|
4262
|
-
phases: RaciPhase[];
|
|
4263
|
-
/** Tasks declared without a parent phase. */
|
|
4264
|
-
tasksWithoutPhase: RaciTask[];
|
|
4265
|
-
options: Record<string, string>;
|
|
4266
|
-
diagnostics: DgmoError[];
|
|
4267
|
-
error: string | null;
|
|
4268
|
-
}
|
|
4269
|
-
|
|
4270
|
-
/**
|
|
4271
|
-
* Parse RACI/RASCI/DACI source. The leading chart-type id (if a
|
|
4272
|
-
* recognized variant id) acts as a hint for default variant when the
|
|
4273
|
-
* `variant` directive is absent.
|
|
4274
|
-
*/
|
|
4275
|
-
declare function parseRaci(content: string, palette?: PaletteColors): ParsedRaci;
|
|
4276
|
-
|
|
4277
|
-
/** Drag-source identity passed to `onMarkerDragStart`. */
|
|
4278
|
-
type RaciDragSource = {
|
|
4279
|
-
kind: 'legend';
|
|
4280
|
-
marker: RaciMarker;
|
|
4281
|
-
} | {
|
|
4282
|
-
kind: 'cell';
|
|
4283
|
-
marker: RaciMarker;
|
|
4284
|
-
taskId: string;
|
|
4285
|
-
roleId: string;
|
|
4286
|
-
};
|
|
4287
|
-
interface RaciInteractionHandlers {
|
|
4288
|
-
onClickLine?: (lineNumber: number) => void;
|
|
4289
|
-
/** Fires on `pointerdown` of a legend chip OR an in-cell marker slice. */
|
|
4290
|
-
onMarkerDragStart?: (source: RaciDragSource, event: PointerEvent) => void;
|
|
4291
|
-
/**
|
|
4292
|
-
* Suppress the in-SVG legend strip. The app overlays an HTML legend
|
|
4293
|
-
* for native HTML5 drag — SVG `<g> draggable=true` is unreliable.
|
|
4294
|
-
* PNG/SVG export keeps the legend by default.
|
|
4295
|
-
*/
|
|
4296
|
-
hideLegend?: boolean;
|
|
4297
|
-
/**
|
|
4298
|
-
* Phase ids whose tasks should be hidden. The phase header still
|
|
4299
|
-
* renders with a "collapsed" chevron so the user can re-expand.
|
|
4300
|
-
*/
|
|
4301
|
-
collapsedPhases?: ReadonlySet<string>;
|
|
4302
|
-
/**
|
|
4303
|
-
* Suppress the in-SVG title. The app paints its own HTML title
|
|
4304
|
-
* above the HTML legend bar so the visual order is title → legend
|
|
4305
|
-
* → matrix. PNG/SVG export keeps the title by default.
|
|
4306
|
-
*/
|
|
4307
|
-
hideTitle?: boolean;
|
|
4308
|
-
}
|
|
4309
|
-
/**
|
|
4310
|
-
* Render a RACI / RASCI / DACI matrix into the given DOM container.
|
|
4311
|
-
* Layout is computed once and laid out as SVG; no animation.
|
|
4312
|
-
*/
|
|
4313
|
-
declare function renderRaci(container: HTMLDivElement, parsed: ParsedRaci, palette: PaletteColors, isDark: boolean, handlers?: RaciInteractionHandlers | ((lineNumber: number) => void), exportDims?: D3ExportDimensions): void;
|
|
4314
|
-
declare function renderRaciForExport(container: HTMLDivElement, parsed: ParsedRaci, palette: PaletteColors, isDark: boolean, exportDims?: D3ExportDimensions): void;
|
|
4315
|
-
|
|
4316
|
-
/**
|
|
4317
|
-
* Set the markers on a cell to exactly `[marker]`, replacing whatever
|
|
4318
|
-
* was there. If `marker` is `null`, the cell is cleared (the role
|
|
4319
|
-
* assignment line is removed if it was the only marker; otherwise the
|
|
4320
|
-
* line stays with its other markers untouched — see `cellRemove` for
|
|
4321
|
-
* specific-marker removal semantics).
|
|
4322
|
-
*
|
|
4323
|
-
* Insertion point when the role assignment doesn't exist:
|
|
4324
|
-
* - After the last existing role assignment under the task, OR
|
|
4325
|
-
* - After the task's description block, OR
|
|
4326
|
-
* - Immediately after the task line.
|
|
4327
|
-
*
|
|
4328
|
-
* Returns `null` for no-ops (the cell already contains `[marker]`).
|
|
4329
|
-
*/
|
|
4330
|
-
declare function cellReplace(content: string, parsed: ParsedRaci, taskId: string, roleId: string, marker: RaciMarker | null): string | null;
|
|
4331
|
-
/**
|
|
4332
|
-
* Append `marker` to the cell, producing a combined-marker string
|
|
4333
|
-
* like `A R`. Idempotent — if `marker` is already present, returns
|
|
4334
|
-
* `null`. If the cell is empty (no existing role assignment line),
|
|
4335
|
-
* behaves like `cellReplace(content, ..., marker)`.
|
|
4336
|
-
*/
|
|
4337
|
-
declare function cellAppendMarker(content: string, parsed: ParsedRaci, taskId: string, roleId: string, marker: RaciMarker): string | null;
|
|
4338
|
-
/**
|
|
4339
|
-
* Remove a single `marker` from the cell, OR all markers when
|
|
4340
|
-
* `marker` is `undefined`. If the cell becomes empty as a result,
|
|
4341
|
-
* the entire role-assignment line is dropped.
|
|
4342
|
-
*
|
|
4343
|
-
* Returns `null` for no-ops (e.g. removing a marker that wasn't
|
|
4344
|
-
* there).
|
|
4345
|
-
*/
|
|
4346
|
-
declare function cellRemove(content: string, parsed: ParsedRaci, taskId: string, roleId: string, marker?: RaciMarker): string | null;
|
|
4347
|
-
/**
|
|
4348
|
-
* Cycle the cell's marker through the variant alphabet. Used by the
|
|
4349
|
-
* click-to-cycle interaction in `RACIPreview`. Cycle order:
|
|
4350
|
-
*
|
|
4351
|
-
* blank → alphabet[0] → alphabet[1] → … → alphabet[n-1] → blank → …
|
|
4352
|
-
*
|
|
4353
|
-
* If the cell currently has multiple markers (e.g. `A R`), cycling
|
|
4354
|
-
* collapses to a single marker chosen as the *next* one after the
|
|
4355
|
-
* first existing marker — interpretation: "cycle from the dominant
|
|
4356
|
-
* marker." This keeps the affordance simple; combined-markers stay
|
|
4357
|
-
* the territory of drag-from-palette (per TD #10).
|
|
4358
|
-
*/
|
|
4359
|
-
declare function cellCycle(content: string, parsed: ParsedRaci, taskId: string, roleId: string, alphabet: ReadonlyArray<RaciMarker>): string | null;
|
|
4360
|
-
|
|
4361
|
-
/** Codes for variant-defining structural errors (always fire). */
|
|
4362
|
-
declare const RACI_ERROR_CODES: {
|
|
4363
|
-
readonly MULTI_ACCOUNTABLE: "E_RACI_MULTI_ACCOUNTABLE";
|
|
4364
|
-
readonly DACI_MULTI_DRIVER: "E_DACI_MULTI_DRIVER";
|
|
4365
|
-
readonly DACI_MULTI_ACCOUNTABLE: "E_DACI_MULTI_ACCOUNTABLE";
|
|
4366
|
-
readonly INVALID_MARKER: "E_RACI_INVALID_MARKER";
|
|
4367
|
-
readonly UNEXPECTED_LINE: "E_RACI_UNEXPECTED_LINE";
|
|
4368
|
-
readonly MIXED_VARIANTS: "E_RACI_MIXED_VARIANTS";
|
|
4369
|
-
readonly DUPLICATE_VARIANT: "E_RACI_DUPLICATE_VARIANT";
|
|
4370
|
-
};
|
|
4371
|
-
/** Codes for warnings (suppressible chart-wide by the `no-rule-enforcement` directive). */
|
|
4372
|
-
declare const RACI_WARNING_CODES: {
|
|
4373
|
-
readonly MISSING_ACCOUNTABLE: "W_RACI_MISSING_ACCOUNTABLE";
|
|
4374
|
-
readonly MISSING_RESPONSIBLE: "W_RACI_MISSING_RESPONSIBLE";
|
|
4375
|
-
readonly DACI_MISSING_DRIVER: "W_DACI_MISSING_DRIVER";
|
|
4376
|
-
readonly DACI_MISSING_ACCOUNTABLE: "W_DACI_MISSING_ACCOUNTABLE";
|
|
4377
|
-
readonly UNKNOWN_ROLE: "W_RACI_UNKNOWN_ROLE";
|
|
4378
|
-
readonly EMPTY_TASK: "W_RACI_EMPTY_TASK";
|
|
4379
|
-
readonly CONFLICTING_MARKERS: "W_RACI_CONFLICTING_MARKERS";
|
|
4380
|
-
readonly TOO_MANY_RESPONSIBLE: "W_RACI_TOO_MANY_RESPONSIBLE";
|
|
4381
|
-
readonly ORPHAN_ROLE: "W_RACI_ORPHAN_ROLE";
|
|
4382
|
-
};
|
|
4383
|
-
/** A constraint rule produces zero or more diagnostics for a single task. */
|
|
4384
|
-
type ConstraintRule = (task: RaciTask) => DgmoError[];
|
|
4385
|
-
interface VariantRuleSet {
|
|
4386
|
-
alphabet: ReadonlyArray<RaciMarker>;
|
|
4387
|
-
/**
|
|
4388
|
-
* Structural errors. Fire whenever `no-rule-enforcement` is off, like
|
|
4389
|
-
* the warning rules — kept as a separate bucket so callers (e.g. the
|
|
4390
|
-
* editor diagnostics panel) can style them with error severity.
|
|
4391
|
-
*/
|
|
4392
|
-
errorRules: ConstraintRule[];
|
|
4393
|
-
/** Hygiene warnings — same suppression as errors. */
|
|
4394
|
-
warningRules: ConstraintRule[];
|
|
4395
|
-
}
|
|
4396
|
-
declare const VARIANTS: Readonly<Record<RaciVariant, VariantRuleSet>>;
|
|
4397
|
-
|
|
4398
|
-
/**
|
|
4399
|
-
* Async or sync file reader. Receives an absolute path, returns content.
|
|
4400
|
-
* Throwing means "file not found".
|
|
4401
|
-
*/
|
|
4402
|
-
type ReadFileFn = (path: string) => string | Promise<string>;
|
|
4403
|
-
/** Tracks the original source file and line for an imported line. */
|
|
4404
|
-
interface ImportSource {
|
|
4405
|
-
/** Absolute path of the file this line originates from */
|
|
4406
|
-
filePath: string;
|
|
4407
|
-
/** 1-based line number in the original (pre-resolution) source file */
|
|
4408
|
-
sourceLine: number;
|
|
4409
|
-
}
|
|
4410
|
-
interface ResolveImportsResult {
|
|
4411
|
-
content: string;
|
|
4412
|
-
diagnostics: DgmoError[];
|
|
4413
|
-
/** resolvedLine (1-based index) → originalLine (1-based) or null for inserted lines */
|
|
4414
|
-
lineMap: (number | null)[];
|
|
4415
|
-
/** resolvedLine (1-based index) → import source info or null for non-imported lines */
|
|
4416
|
-
importSourceMap: (ImportSource | null)[];
|
|
4417
|
-
}
|
|
4418
|
-
/**
|
|
4419
|
-
* Pre-processes org chart content, resolving `tags` and `import` directives.
|
|
4420
|
-
*
|
|
4421
|
-
* @param content - Raw .dgmo file content
|
|
4422
|
-
* @param filePath - Absolute path of the file (for relative path resolution)
|
|
4423
|
-
* @param readFileFn - Function to read files (sync or async)
|
|
4424
|
-
* @returns Merged content with all imports resolved + diagnostics
|
|
4425
|
-
*/
|
|
4426
|
-
declare function resolveOrgImports(content: string, filePath: string, readFileFn: ReadFileFn): Promise<ResolveImportsResult>;
|
|
4427
|
-
|
|
4428
|
-
declare function renderFlowchart(container: HTMLDivElement, graph: ParsedGraph, layout: LayoutResult$1, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
|
|
4429
|
-
width?: number;
|
|
4430
|
-
height?: number;
|
|
4431
|
-
}): void;
|
|
4432
|
-
declare function renderFlowchartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
|
|
4433
|
-
|
|
4434
|
-
declare const LEGEND_HEIGHT = 28;
|
|
4435
|
-
declare const LEGEND_GEAR_PILL_W: number;
|
|
4436
|
-
|
|
4437
|
-
declare function renderLegendD3(container: D3Sel, config: LegendConfig, state: LegendState, palette: LegendPalette, isDark: boolean, callbacks?: LegendCallbacks, containerWidth?: number): LegendHandle;
|
|
4438
|
-
|
|
4439
|
-
declare function controlsGroupCapsuleWidth(toggles: Array<{
|
|
4440
|
-
label: string;
|
|
4441
|
-
}>): number;
|
|
4442
|
-
declare function computeLegendLayout(config: LegendConfig, state: LegendState, containerWidth: number): LegendLayout;
|
|
4443
|
-
declare function getLegendReservedHeight(config: LegendConfig, state: LegendState, containerWidth: number): number;
|
|
4444
|
-
|
|
4445
|
-
interface SectionMessageGroup {
|
|
4446
|
-
section: SequenceSection;
|
|
4447
|
-
messageIndices: number[];
|
|
4448
|
-
}
|
|
4449
|
-
interface SequenceRenderOptions {
|
|
4450
|
-
collapsedSections?: Set<number>;
|
|
4451
|
-
collapsedGroups?: Set<number>;
|
|
4452
|
-
exportWidth?: number;
|
|
4453
|
-
activeTagGroup?: string | null;
|
|
4454
|
-
}
|
|
4455
|
-
/**
|
|
4456
|
-
* Group messages by the top-level section that precedes them.
|
|
4457
|
-
* Messages before the first section are ungrouped (always visible).
|
|
4458
|
-
* Only top-level sections are collapsible — sections inside blocks are excluded.
|
|
4459
|
-
*/
|
|
4460
|
-
declare function groupMessagesBySection(elements: SequenceElement[], messages: SequenceMessage[]): SectionMessageGroup[];
|
|
4461
|
-
interface RenderStep {
|
|
4462
|
-
type: 'call' | 'return';
|
|
4463
|
-
from: string;
|
|
4464
|
-
to: string;
|
|
4465
|
-
label: string;
|
|
4466
|
-
messageIndex: number;
|
|
4467
|
-
async?: boolean;
|
|
4468
|
-
}
|
|
4469
|
-
/**
|
|
4470
|
-
* Build an ordered render sequence from flat messages.
|
|
4471
|
-
* Uses a call stack to infer where returns should be placed:
|
|
4472
|
-
* returns appear after all nested sub-calls complete.
|
|
4473
|
-
*/
|
|
4474
|
-
declare function buildRenderSequence(messages: SequenceMessage[]): RenderStep[];
|
|
4475
|
-
interface Activation {
|
|
4476
|
-
participantId: string;
|
|
4477
|
-
startStep: number;
|
|
4478
|
-
endStep: number;
|
|
4479
|
-
depth: number;
|
|
4480
|
-
}
|
|
4481
|
-
/**
|
|
4482
|
-
* Compute activation rectangles from render steps.
|
|
4483
|
-
* Each call pushes onto the callee's stack; each return pops it.
|
|
4484
|
-
*/
|
|
4485
|
-
declare function computeActivations(steps: RenderStep[]): Activation[];
|
|
4486
|
-
/**
|
|
4487
|
-
* Reorder participants based on explicit `position` overrides.
|
|
4488
|
-
* Positive positions are 0-based from the left; negative positions count from the right (-1 = last).
|
|
4489
|
-
* Unpositioned participants maintain their relative order, filling remaining slots.
|
|
4490
|
-
*/
|
|
4491
|
-
declare function applyPositionOverrides(participants: SequenceParticipant[]): SequenceParticipant[];
|
|
4492
|
-
/**
|
|
4493
|
-
* Reorder participants so that members of the same group are adjacent.
|
|
4494
|
-
* Groups are positioned at the point where their first member would naturally
|
|
4495
|
-
* appear based on message order (first-occurrence positioning). This prevents
|
|
4496
|
-
* groups declared at the top of the file from being placed before participants
|
|
4497
|
-
* that appear in messages earlier.
|
|
4498
|
-
*
|
|
4499
|
-
* Explicit `position` overrides are handled separately by `applyPositionOverrides`.
|
|
4500
|
-
*/
|
|
4501
|
-
declare function applyGroupOrdering(participants: SequenceParticipant[], groups: SequenceGroup[], messages?: SequenceMessage[]): SequenceParticipant[];
|
|
4502
|
-
/**
|
|
4503
|
-
* Render a sequence diagram into the given container element.
|
|
4504
|
-
*/
|
|
4505
|
-
declare function renderSequenceDiagram(container: HTMLDivElement, parsed: ParsedSequenceDgmo, palette: PaletteColors, isDark: boolean, _onNavigateToLine?: (line: number) => void, options?: SequenceRenderOptions): void;
|
|
4506
|
-
/**
|
|
4507
|
-
* Build a mapping from each note's lineNumber to the lineNumber of its
|
|
4508
|
-
* associated message (the last message before the note in document order).
|
|
4509
|
-
* Used by the app to highlight the associated message when cursor is on a note.
|
|
4510
|
-
*/
|
|
4511
|
-
declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
|
|
4512
|
-
|
|
4513
|
-
interface CollapsedView {
|
|
4514
|
-
participants: SequenceParticipant[];
|
|
4515
|
-
messages: SequenceMessage[];
|
|
4516
|
-
elements: SequenceElement[];
|
|
4517
|
-
groups: SequenceGroup[];
|
|
4518
|
-
/** Maps member participant ID → collapsed group name */
|
|
4519
|
-
collapsedGroupIds: Map<string, string>;
|
|
4520
|
-
}
|
|
4521
|
-
/**
|
|
4522
|
-
* Project a parsed sequence diagram into a collapsed view.
|
|
4523
|
-
*
|
|
4524
|
-
* @param parsed - The immutable parsed sequence diagram
|
|
4525
|
-
* @param collapsedGroups - Set of group lineNumbers that should be collapsed
|
|
4526
|
-
* @returns A new CollapsedView with remapped participants, messages, elements, and groups
|
|
4527
|
-
*/
|
|
4528
|
-
declare function applyCollapseProjection(parsed: ParsedSequenceDgmo, collapsedGroups: Set<number>): CollapsedView;
|
|
4529
|
-
|
|
4530
|
-
/** Complete 16-entry Nord palette. */
|
|
4531
|
-
declare const nord: {
|
|
4532
|
-
nord0: string;
|
|
4533
|
-
nord1: string;
|
|
4534
|
-
nord2: string;
|
|
4535
|
-
nord3: string;
|
|
4536
|
-
nord4: string;
|
|
4537
|
-
nord5: string;
|
|
4538
|
-
nord6: string;
|
|
4539
|
-
nord7: string;
|
|
4540
|
-
nord8: string;
|
|
4541
|
-
nord9: string;
|
|
4542
|
-
nord10: string;
|
|
4543
|
-
nord11: string;
|
|
4544
|
-
nord12: string;
|
|
4545
|
-
nord13: string;
|
|
4546
|
-
nord14: string;
|
|
4547
|
-
nord15: string;
|
|
4548
|
-
};
|
|
4549
|
-
/** Color name → Nord hex for inline `(color)` annotations. */
|
|
4550
|
-
declare const colorNames: Record<string, string>;
|
|
4551
|
-
/**
|
|
4552
|
-
* The canonical, closed set of color names accepted by the DGMO language.
|
|
4553
|
-
* See `docs/dgmo-language-spec.md` §1.5. Users cannot extend this list —
|
|
4554
|
-
* palettes only provide the per-theme hex values for these names.
|
|
4555
|
-
*/
|
|
4556
|
-
declare const RECOGNIZED_COLOR_NAMES: readonly ["red", "orange", "yellow", "green", "blue", "purple", "teal", "cyan", "gray", "black", "white"];
|
|
4557
|
-
/**
|
|
4558
|
-
* Returns true iff `name` is one of the 11 recognized DGMO color names.
|
|
4559
|
-
*/
|
|
4560
|
-
declare function isRecognizedColorName(name: string): boolean;
|
|
4561
|
-
/**
|
|
4562
|
-
* Resolves a recognized color name to its hex value for the active palette
|
|
4563
|
-
* (falling back to the built-in Nord defaults). Returns `null` for any
|
|
4564
|
-
* unrecognized input — including hex codes, CSS keywords like `pink`,
|
|
4565
|
-
* and typos. Callers MUST treat `null` as a parse error and emit a
|
|
4566
|
-
* diagnostic; do not silently fall back to the raw input.
|
|
4567
|
-
*/
|
|
4568
|
-
declare function resolveColor(color: string, palette?: {
|
|
4569
|
-
colors: Record<string, string>;
|
|
4570
|
-
}): string | null;
|
|
4571
|
-
|
|
4572
|
-
/**
|
|
4573
|
-
* Resolves a color name and pushes a warning diagnostic on failure.
|
|
4574
|
-
* Returns the hex string for valid names, or `undefined` for unknown
|
|
4575
|
-
* input (after pushing a diagnostic). Use this from parsers that have
|
|
4576
|
-
* a diagnostics array and a line number in scope.
|
|
4577
|
-
*/
|
|
4578
|
-
declare function resolveColorWithDiagnostic(color: string, line: number, diagnostics: DgmoError[], palette?: {
|
|
4579
|
-
colors: Record<string, string>;
|
|
4580
|
-
}): string | undefined;
|
|
4581
|
-
/** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
|
|
4582
|
-
declare const seriesColors: string[];
|
|
4583
|
-
|
|
4584
|
-
/**
|
|
4585
|
-
* Shared parser utilities — extracted from individual parsers to eliminate
|
|
4586
|
-
* duplication of measureIndent, extractColor, header regexes, and
|
|
4587
|
-
* pipe-metadata parsing.
|
|
4588
|
-
*/
|
|
4589
|
-
|
|
4590
|
-
/** Complete set of recognized chart type identifiers. */
|
|
4591
|
-
declare const ALL_CHART_TYPES: Set<string>;
|
|
4592
|
-
/**
|
|
4593
|
-
* Parse the first non-empty, non-comment line to extract chart type and optional title.
|
|
4594
|
-
* The first token is matched against `ALL_CHART_TYPES`; the remainder is the title.
|
|
4595
|
-
*
|
|
4596
|
-
* Returns `null` if the first token is not a recognized chart type.
|
|
186
|
+
* Decode a share URL back into DGMO text plus optional palette/theme/filename.
|
|
187
|
+
* Returns null if the URL contains no valid DGMO payload.
|
|
4597
188
|
*/
|
|
4598
|
-
declare function
|
|
4599
|
-
chartType: string;
|
|
4600
|
-
title: string | undefined;
|
|
4601
|
-
} | null;
|
|
189
|
+
declare function decodeDiagramUrl(url: string): DecodedDiagramUrl | null;
|
|
4602
190
|
|
|
4603
|
-
export { ALL_CHART_TYPES, AMBIGUITY_THRESHOLD, ARROW_DIAGNOSTIC_CODES, type Activation, type AncestorInfo, type ArcLink, type ArcNodeGroup, BETA_CHART_IDS, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, type BlipTrend, type C4ArrowType, type C4DeploymentNode, type C4Element, type C4ElementType, type C4Group, type C4LayoutBoundary, type C4LayoutEdge, type C4LayoutNode, type C4LayoutResult, type C4LegendEntry, type C4LegendGroup, type C4Relationship, type C4Shape, type C4TagEntry, type C4TagGroup, CHART_TYPES, CHART_TYPE_DESCRIPTIONS, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type Confidence as ChartTypeConfidence, type ChartTypeMeta, type ChartTypeScore, type SuggestionResult as ChartTypeSuggestionResult, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedMindmapResult, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type CycleEdge, type CycleLayoutEdge, type CycleLayoutNode, type CycleLayoutResult, type CycleNode, type CycleRenderOptions, type D3ExportDimensions, type DecodedDiagramUrl, type DgmoError, type DgmoSeverity, type DiagramSymbols, type DirectiveSpec, type DirectiveValueSpec, type Duration, type DurationUnit, ENTITY_TYPES, type ERCardinality, type ERColumn, type ERConstraint, type ERLayoutEdge, type ERLayoutNode, type ERLayoutResult, type ERRelationship, type ERTable, type ElseIfBranch, type EncodeDiagramUrlOptions, type EncodeDiagramUrlResult, type ExtendedChartType, type ExtractFn, type FocusOrgResult, type GanttDependency, type GanttEra, type GanttGroup, type GroupRow as GanttGroupRow, type GanttHolidays, type GanttInteractiveOptions, type LaneHeaderRow as GanttLaneHeaderRow, type GanttMarker, type GanttNode, type GanttOptions, type GanttParallelBlock, type Row as GanttRow, type GanttTask, type TaskRow as GanttTaskRow, type GetOrCreateNameResult, type GraphDirection, type GraphEdge, type GraphGroup, type GraphNode, type GraphShape, INFRA_BEHAVIOR_KEYS, type ImportSource, type InfraAvailabilityPercentiles, type InfraBehaviorKey, type InfraCbState, type InfraComputeParams, type InfraDiagnostic, type InfraEdge, type InfraGroup, type InfraLatencyPercentiles, type InfraLayoutEdge, type InfraLayoutGroup, type InfraLayoutNode, type InfraLayoutResult, type InfraLegendGroup, type InfraNode, type InfraPlaybackState, type InfraProperty, type InfraRole, type InfraTagGroup, type InlineSpan, type JourneyMapAnnotation, type JourneyMapInteractiveOptions, type JourneyMapLayout, type JourneyMapPersona, type JourneyMapPhase, type JourneyMapStep, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_GEAR_PILL_W, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutOptions, type LayoutResult$1 as LayoutResult, type LegendCallbacks, type LegendConfig, type LegendControl, type LegendGroupData, type LegendHandle, type LegendLayout, type LegendMode, type LegendPalette, type LegendPosition, type LegendState, METADATA_KEY_SET, MIN_PRIMARY_SCORE, type MemberVisibility, type MindmapLayoutEdge, type MindmapLayoutNode, type MindmapLayoutResult, type MindmapNode, type MonteCarloResult, type NameEntry, type NodeDetail, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, type OrgNode, PERT_LEGEND_PILL_HEIGHT, PIPE_METADATA, type PaletteColors, type PaletteConfig, type ParseInArrowLabelResult, type ParsedBoxesAndLines, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedCycle, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedJourneyMap, type ParsedKanban, type ParsedMindmap, type ParsedOrg, type ParsedPert, type ParsedPyramid, type ParsedRaci, type ParsedRing, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedTechRadar, type ParsedVisualization, type ParsedWireframe, type ParticipantType, type PertActivity, type Anchor as PertAnchor, type PertDirection, type PertEdge, type PertGroup, type PertLayoutEdge, type PertLayoutGroup, type PertLayoutNode, type LayoutOverrides as PertLayoutOverrides, type LayoutResult as PertLayoutResult, type PertMilestone, type PertOptions, type PertRenderOptions, type PipeKeySpec, type PyramidLayer, type QuadrantPosition, RACI_ERROR_CODES, VARIANTS as RACI_VARIANTS, RACI_WARNING_CODES, RECOGNIZED_COLOR_NAMES, RULE_COUNT, type RaciDragSource, type RaciInteractionHandlers, type RaciMarker, type RaciPhase, type RaciRoleAssignment, type RaciTask, type RaciVariant, type ReadFileFn, type RelationshipType, type RenderCategory, type RenderStep, type ResolveImportsResult, type ResolvedActivity, type ResolvedGroup$1 as ResolvedGroup, type ResolvedPert, type ResolvedGroup as ResolvedPertGroup, type ResolvedSchedule, type ResolvedTask, type RingLayer, type ScatterLabelPoint, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceNote, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, type SitemapContainerBounds, type SitemapDirection, type SitemapEdge, type SitemapLayoutEdge, type SitemapLayoutNode, type SitemapLayoutResult, type SitemapLegendEntry, type SitemapLegendGroup, type SitemapNode, type StateCollapseResult, type TagEntry, type TagGroup, type TechRadarBlip, type TechRadarLayoutPoint, type TechRadarQuadrant, type TechRadarRing, type VisualizationType, type WireframeElement, type WireframeElementType, type WireframeFormFactor, type WireframeLayout, type WireframeLayoutNode, addDurationToDate, analyzePert, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, calculateSchedule, catppuccinPalette, confidence as chartTypeConfidence, chartTypeParsers, chartTypes, collapseBoxesAndLines, collapseMindmapTree, collapseOrgTree, collapseSitemapTree, collapseStateGroups, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeCycleLayout, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeRadarLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, controlsGroupCapsuleWidth, decodeDiagramUrl, decodeViewState, displayName, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractPertSymbols, extractTagDeclarations, focusOrgTree, formatDateLabel, formatDgmoError, getAllChartTypes, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getOrCreateName, getPalette, getRadarGeometry, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, highlightPertCriticalPath, highlightPertSet, hslToHex, inferParticipantType, inferRoles, isArchiveColumn, isExtendedChartType, isRecognizedColorName, isSequenceBlock, isSequenceNote, isValidHex, knownChartTypeIds, layoutBoxesAndLines, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutJourneyMap, layoutMindmap, layoutOrg, layoutPert, layoutSitemap, layoutWireframe, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikePert, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, matchColorParens, matchesContiguously, measurePertAnalysisBlock, mix, monokaiPalette, nord, nordPalette, normalize as normalizeChartTypePrompt, normalizeName, normalizePertSourceForShare, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseCycle, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseJourneyMap, parseKanban, parseMindmap, parseOrg, parsePert, parsePyramid, parseRaci, parseRing, parseSequenceDgmo, parseSequenceDgmo as parseSequenceDiagram, parseSitemap, parseState, parseTechRadar, parseTimelineDate, parseVisualization, parseWireframe, pertLegendBlockWidth, pertLegendEntries, cellAppendMarker as raciCellAppendMarker, cellCycle as raciCellCycle, cellRemove as raciCellRemove, cellReplace as raciCellReplace, registerExtractor, registerPalette, relayoutPert, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderCycle, renderCycleForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderJourneyMap, renderJourneyMapForExport, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderMindmap, renderMindmapForExport, renderOrg, renderOrgForExport, renderPert, renderPertAnalysisBlock, renderPertForExport, renderLegendBlock as renderPertLegendBlock, renderPyramid, renderPyramidForExport, renderQuadrant, renderQuadrantFocus, renderQuadrantFocusForExport, renderRaci, renderRaciForExport, renderRing, renderRingForExport, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTechRadar, renderTechRadarForExport, renderTimeline, renderVenn, renderWireframe, renderWordCloud, resetPertCriticalPath, resetPertHighlight, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, scoreChartType, seriesColors, shade, shapeFill, solarizedPalette, suggestChartTypes, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra, validateLabelCharacters };
|
|
191
|
+
export { type DecodedDiagramUrl, type DgmoError, type DgmoSeverity, type EncodeDiagramUrlOptions, type PaletteColors, type PaletteConfig, type RenderOptions, type RenderResult, type Theme, decodeDiagramUrl, encodeDiagramUrl, formatDgmoError, palettes, render, themes, parseDgmo as validate };
|