@diagrammo/dgmo 0.8.10 → 0.8.12
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/cli.cjs +245 -672
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.d.cts +2 -3
- package/dist/editor.d.ts +2 -3
- package/dist/editor.js.map +1 -1
- package/dist/index.cjs +491 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +489 -125
- package/dist/index.js.map +1 -1
- package/gallery/fixtures/er.dgmo +36 -0
- package/gallery/fixtures/kanban.dgmo +27 -0
- package/package.json +14 -17
- package/src/boxes-and-lines/parser.ts +2 -0
- package/src/boxes-and-lines/renderer.ts +13 -5
- package/src/c4/layout.ts +31 -10
- package/src/c4/parser.ts +5 -1
- package/src/completion.ts +17 -2
- package/src/d3.ts +220 -102
- package/src/echarts.ts +57 -58
- package/src/editor/index.ts +1 -2
- package/src/er/parser.ts +5 -1
- package/src/gantt/parser.ts +8 -0
- package/src/gantt/renderer.ts +6 -7
- package/src/gantt/resolver.ts +19 -14
- package/src/gantt/types.ts +1 -0
- package/src/index.ts +2 -0
- package/src/infra/parser.ts +4 -0
- package/src/kanban/parser.ts +4 -1
- package/src/kanban/renderer.ts +11 -8
- package/src/label-layout.ts +286 -0
- package/src/org/parser.ts +3 -0
- package/src/sequence/parser.ts +6 -0
- package/src/sequence/renderer.ts +24 -9
- package/src/sharing.ts +15 -5
- package/src/sitemap/parser.ts +2 -0
- package/src/utils/arrows.ts +1 -1
- package/src/utils/legend-layout.ts +8 -8
- package/src/utils/legend-svg.ts +2 -2
- package/src/utils/legend-types.ts +0 -3
- package/src/utils/parsing.ts +1 -1
- package/src/utils/tag-groups.ts +65 -1
package/src/utils/tag-groups.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface TagGroup {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** Result of matching a tag block heading */
|
|
25
|
-
|
|
25
|
+
interface TagBlockMatch {
|
|
26
26
|
name: string;
|
|
27
27
|
alias: string | undefined;
|
|
28
28
|
colorHint: string | undefined;
|
|
@@ -304,6 +304,27 @@ export function validateTagValues(
|
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
// ── Tag Group Name Validation ────────────────────────────
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Warn when a tag group uses the reserved name "none" (case-insensitive).
|
|
311
|
+
* Should be called alongside `validateTagValues()` in each parser's
|
|
312
|
+
* post-parse validation.
|
|
313
|
+
*/
|
|
314
|
+
export function validateTagGroupNames(
|
|
315
|
+
tagGroups: ReadonlyArray<{ name: string; lineNumber: number }>,
|
|
316
|
+
pushWarning: (lineNumber: number, message: string) => void
|
|
317
|
+
): void {
|
|
318
|
+
for (const group of tagGroups) {
|
|
319
|
+
if (group.name.toLowerCase() === 'none') {
|
|
320
|
+
pushWarning(
|
|
321
|
+
group.lineNumber,
|
|
322
|
+
`'none' is a reserved keyword and cannot be used as a tag group name`
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
307
328
|
// ── Default Metadata Injection ────────────────────────────
|
|
308
329
|
|
|
309
330
|
/**
|
|
@@ -340,6 +361,49 @@ export function injectDefaultTagMetadata(
|
|
|
340
361
|
}
|
|
341
362
|
}
|
|
342
363
|
|
|
364
|
+
// ── Active Tag Group Resolution ──────────────────────────────
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Determine which tag group should be active, using a priority chain:
|
|
368
|
+
*
|
|
369
|
+
* 1. Programmatic override (from render API / CLI flag) — highest priority
|
|
370
|
+
* 2. Diagram-level `active-tag` option (from parsed source)
|
|
371
|
+
* 3. Auto-activate first declared tag group
|
|
372
|
+
* 4. No coloring (null)
|
|
373
|
+
*
|
|
374
|
+
* The sentinel value `"none"` (case-insensitive) at any level means
|
|
375
|
+
* "suppress tag coloring."
|
|
376
|
+
*
|
|
377
|
+
* @param tagGroups Declared tag groups (only `.name` is used)
|
|
378
|
+
* @param explicitActiveTag Value of `active-tag` option from parsed diagram, if any
|
|
379
|
+
* @param programmaticOverride Value from render API / CLI; `undefined` = not set,
|
|
380
|
+
* `null` or `''` = explicitly no coloring
|
|
381
|
+
*/
|
|
382
|
+
export function resolveActiveTagGroup(
|
|
383
|
+
tagGroups: ReadonlyArray<{ name: string }>,
|
|
384
|
+
explicitActiveTag: string | undefined,
|
|
385
|
+
programmaticOverride?: string | null
|
|
386
|
+
): string | null {
|
|
387
|
+
// 1. Programmatic override (highest priority)
|
|
388
|
+
if (programmaticOverride !== undefined) {
|
|
389
|
+
if (!programmaticOverride) return null; // null or ''
|
|
390
|
+
if (programmaticOverride.toLowerCase() === 'none') return null;
|
|
391
|
+
return programmaticOverride;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// 2. Diagram-level active-tag option
|
|
395
|
+
if (explicitActiveTag) {
|
|
396
|
+
if (explicitActiveTag.toLowerCase() === 'none') return null;
|
|
397
|
+
return explicitActiveTag;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// 3. Auto-activate first declared group
|
|
401
|
+
if (tagGroups.length > 0) return tagGroups[0].name;
|
|
402
|
+
|
|
403
|
+
// 4. No tag groups → no coloring
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
|
|
343
407
|
// ── Matchers ────────────────────────────────────────────────
|
|
344
408
|
|
|
345
409
|
export function matchTagBlockHeading(trimmed: string): TagBlockMatch | null {
|