@diagrammo/dgmo 0.8.18 → 0.8.19
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 +101 -101
- package/dist/index.cjs +521 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -12
- package/dist/index.d.ts +107 -12
- package/dist/index.js +518 -121
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/gantt/renderer.ts +151 -89
- package/src/index.ts +10 -2
- package/src/sequence/collapse.ts +169 -0
- package/src/sequence/parser.ts +14 -2
- package/src/sequence/renderer.ts +186 -49
- package/src/sharing.ts +86 -49
- package/src/utils/legend-constants.ts +11 -0
- package/src/utils/legend-d3.ts +171 -0
- package/src/utils/legend-layout.ts +140 -13
- package/src/utils/legend-types.ts +45 -0
package/dist/index.d.cts
CHANGED
|
@@ -298,6 +298,7 @@ declare function parseDataRowValues(line: string, options?: {
|
|
|
298
298
|
interface LegendState {
|
|
299
299
|
activeGroup: string | null;
|
|
300
300
|
hiddenAttributes?: Set<string>;
|
|
301
|
+
controlsExpanded?: boolean;
|
|
301
302
|
}
|
|
302
303
|
interface LegendCallbacks {
|
|
303
304
|
onGroupToggle?: (groupName: string) => void;
|
|
@@ -307,6 +308,10 @@ interface LegendCallbacks {
|
|
|
307
308
|
onEntryHover?: (groupName: string, entryValue: string | null) => void;
|
|
308
309
|
/** Called after each group <g> is rendered — lets chart renderers inject custom elements (swimlane icons, etc.) */
|
|
309
310
|
onGroupRendered?: (groupName: string, groupEl: D3Sel, isActive: boolean) => void;
|
|
311
|
+
/** Called when the controls group gear pill is clicked (expand/collapse) */
|
|
312
|
+
onControlsExpand?: () => void;
|
|
313
|
+
/** Called when a controls group toggle entry is clicked */
|
|
314
|
+
onControlsToggle?: (toggleId: string, active: boolean) => void;
|
|
310
315
|
}
|
|
311
316
|
interface LegendPosition {
|
|
312
317
|
placement: 'top-center';
|
|
@@ -329,10 +334,22 @@ interface LegendControlEntry {
|
|
|
329
334
|
isActive?: boolean;
|
|
330
335
|
onClick?: () => void;
|
|
331
336
|
}
|
|
337
|
+
interface ControlsGroupToggle {
|
|
338
|
+
id: string;
|
|
339
|
+
/** Only 'toggle' is implemented in v1. 'select' and 'action' future-proof for Infra playback etc. */
|
|
340
|
+
type: 'toggle' | 'select' | 'action';
|
|
341
|
+
label: string;
|
|
342
|
+
active: boolean;
|
|
343
|
+
onToggle: (active: boolean) => void;
|
|
344
|
+
}
|
|
345
|
+
interface ControlsGroupConfig {
|
|
346
|
+
toggles: ControlsGroupToggle[];
|
|
347
|
+
}
|
|
332
348
|
interface LegendConfig {
|
|
333
349
|
groups: LegendGroupData[];
|
|
334
350
|
position: LegendPosition;
|
|
335
351
|
controls?: LegendControl[];
|
|
352
|
+
controlsGroup?: ControlsGroupConfig;
|
|
336
353
|
mode: LegendMode;
|
|
337
354
|
/** Title width in pixels — used for inline-with-title computation */
|
|
338
355
|
titleWidth?: number;
|
|
@@ -397,6 +414,31 @@ interface LegendControlLayout {
|
|
|
397
414
|
isActive?: boolean;
|
|
398
415
|
}>;
|
|
399
416
|
}
|
|
417
|
+
interface ControlsGroupToggleLayout {
|
|
418
|
+
id: string;
|
|
419
|
+
label: string;
|
|
420
|
+
active: boolean;
|
|
421
|
+
dotCx: number;
|
|
422
|
+
dotCy: number;
|
|
423
|
+
textX: number;
|
|
424
|
+
textY: number;
|
|
425
|
+
}
|
|
426
|
+
interface ControlsGroupLayout {
|
|
427
|
+
x: number;
|
|
428
|
+
y: number;
|
|
429
|
+
width: number;
|
|
430
|
+
height: number;
|
|
431
|
+
expanded: boolean;
|
|
432
|
+
/** The gear pill layout (collapsed or inside capsule) */
|
|
433
|
+
pill: {
|
|
434
|
+
x: number;
|
|
435
|
+
y: number;
|
|
436
|
+
width: number;
|
|
437
|
+
height: number;
|
|
438
|
+
};
|
|
439
|
+
/** Toggle entries (only present when expanded) */
|
|
440
|
+
toggles: ControlsGroupToggleLayout[];
|
|
441
|
+
}
|
|
400
442
|
interface LegendRowLayout {
|
|
401
443
|
y: number;
|
|
402
444
|
items: Array<LegendPillLayout | LegendCapsuleLayout | LegendControlLayout>;
|
|
@@ -414,6 +456,8 @@ interface LegendLayout {
|
|
|
414
456
|
controls: LegendControlLayout[];
|
|
415
457
|
/** All pill layouts (collapsed groups) */
|
|
416
458
|
pills: LegendPillLayout[];
|
|
459
|
+
/** Controls group layout (gear pill / capsule) */
|
|
460
|
+
controlsGroup?: ControlsGroupLayout;
|
|
417
461
|
}
|
|
418
462
|
interface LegendHandle {
|
|
419
463
|
setState: (state: LegendState) => void;
|
|
@@ -895,6 +939,8 @@ interface SequenceGroup {
|
|
|
895
939
|
lineNumber: number;
|
|
896
940
|
/** Pipe-delimited tag metadata (e.g. `[Backend | t: Product]`) */
|
|
897
941
|
metadata?: Record<string, string>;
|
|
942
|
+
/** Whether this group is collapsed by default */
|
|
943
|
+
collapsed?: boolean;
|
|
898
944
|
}
|
|
899
945
|
/**
|
|
900
946
|
* Parsed result from a .dgmo sequence diagram.
|
|
@@ -2456,6 +2502,7 @@ interface SectionMessageGroup {
|
|
|
2456
2502
|
}
|
|
2457
2503
|
interface SequenceRenderOptions {
|
|
2458
2504
|
collapsedSections?: Set<number>;
|
|
2505
|
+
collapsedGroups?: Set<number>;
|
|
2459
2506
|
expandedNoteLines?: Set<number>;
|
|
2460
2507
|
exportWidth?: number;
|
|
2461
2508
|
activeTagGroup?: string | null;
|
|
@@ -2518,6 +2565,23 @@ declare function renderSequenceDiagram(container: HTMLDivElement, parsed: Parsed
|
|
|
2518
2565
|
*/
|
|
2519
2566
|
declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
|
|
2520
2567
|
|
|
2568
|
+
interface CollapsedView {
|
|
2569
|
+
participants: SequenceParticipant[];
|
|
2570
|
+
messages: SequenceMessage[];
|
|
2571
|
+
elements: SequenceElement[];
|
|
2572
|
+
groups: SequenceGroup[];
|
|
2573
|
+
/** Maps member participant ID → collapsed group name */
|
|
2574
|
+
collapsedGroupIds: Map<string, string>;
|
|
2575
|
+
}
|
|
2576
|
+
/**
|
|
2577
|
+
* Project a parsed sequence diagram into a collapsed view.
|
|
2578
|
+
*
|
|
2579
|
+
* @param parsed - The immutable parsed sequence diagram
|
|
2580
|
+
* @param collapsedGroups - Set of group lineNumbers that should be collapsed
|
|
2581
|
+
* @returns A new CollapsedView with remapped participants, messages, elements, and groups
|
|
2582
|
+
*/
|
|
2583
|
+
declare function applyCollapseProjection(parsed: ParsedSequenceDgmo, collapsedGroups: Set<number>): CollapsedView;
|
|
2584
|
+
|
|
2521
2585
|
/** Complete 16-entry Nord palette. */
|
|
2522
2586
|
declare const nord: {
|
|
2523
2587
|
nord0: string;
|
|
@@ -2572,22 +2636,43 @@ declare function resolveColorWithDiagnostic(color: string, line: number, diagnos
|
|
|
2572
2636
|
/** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
|
|
2573
2637
|
declare const seriesColors: string[];
|
|
2574
2638
|
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2639
|
+
/**
|
|
2640
|
+
* Compact view state schema (ADR-6).
|
|
2641
|
+
* All fields optional. Only non-default values are encoded.
|
|
2642
|
+
* `tag: null` means "user chose none"; absent `tag` means "use DSL default" (ADR-5).
|
|
2643
|
+
*/
|
|
2644
|
+
interface CompactViewState {
|
|
2645
|
+
tag?: string | null;
|
|
2646
|
+
cs?: number[];
|
|
2647
|
+
cg?: string[];
|
|
2648
|
+
swim?: string | null;
|
|
2649
|
+
cl?: string[];
|
|
2650
|
+
cc?: string[];
|
|
2651
|
+
rm?: string;
|
|
2652
|
+
htv?: Record<string, string[]>;
|
|
2653
|
+
ha?: string[];
|
|
2654
|
+
enl?: number[];
|
|
2655
|
+
sem?: boolean;
|
|
2656
|
+
cm?: boolean;
|
|
2657
|
+
c4l?: string;
|
|
2658
|
+
c4s?: string;
|
|
2659
|
+
c4c?: string;
|
|
2660
|
+
rps?: number;
|
|
2661
|
+
spd?: number;
|
|
2662
|
+
io?: Record<string, number>;
|
|
2582
2663
|
}
|
|
2583
2664
|
interface DecodedDiagramUrl {
|
|
2584
2665
|
dsl: string;
|
|
2585
|
-
viewState:
|
|
2666
|
+
viewState: CompactViewState;
|
|
2667
|
+
palette?: string;
|
|
2668
|
+
theme?: 'light' | 'dark';
|
|
2586
2669
|
filename?: string;
|
|
2587
2670
|
}
|
|
2588
2671
|
interface EncodeDiagramUrlOptions {
|
|
2589
2672
|
baseUrl?: string;
|
|
2590
|
-
viewState?:
|
|
2673
|
+
viewState?: CompactViewState;
|
|
2674
|
+
palette?: string;
|
|
2675
|
+
theme?: 'light' | 'dark';
|
|
2591
2676
|
filename?: string;
|
|
2592
2677
|
}
|
|
2593
2678
|
type EncodeDiagramUrlResult = {
|
|
@@ -2599,6 +2684,16 @@ type EncodeDiagramUrlResult = {
|
|
|
2599
2684
|
compressedSize: number;
|
|
2600
2685
|
limit: number;
|
|
2601
2686
|
};
|
|
2687
|
+
/**
|
|
2688
|
+
* Encode a CompactViewState to a compressed string for URL embedding.
|
|
2689
|
+
* Returns empty string if state has no keys (ADR-4).
|
|
2690
|
+
*/
|
|
2691
|
+
declare function encodeViewState(state: CompactViewState): string;
|
|
2692
|
+
/**
|
|
2693
|
+
* Decode a compressed view state string back to CompactViewState.
|
|
2694
|
+
* Returns empty object on failure (no crash).
|
|
2695
|
+
*/
|
|
2696
|
+
declare function decodeViewState(encoded: string): CompactViewState;
|
|
2602
2697
|
/**
|
|
2603
2698
|
* Compress a DGMO DSL string into a shareable URL.
|
|
2604
2699
|
* Returns `{ url }` on success, or `{ error: 'too-large', compressedSize, limit }` if the
|
|
@@ -2608,8 +2703,8 @@ declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions
|
|
|
2608
2703
|
/**
|
|
2609
2704
|
* Decode a DGMO DSL string and view state from a URL query string or hash.
|
|
2610
2705
|
* Accepts any of:
|
|
2611
|
-
* - `?dgmo=<payload>&
|
|
2612
|
-
* - `#dgmo=<payload>&
|
|
2706
|
+
* - `?dgmo=<payload>&vs=<state>`
|
|
2707
|
+
* - `#dgmo=<payload>&vs=<state>` (backwards compat)
|
|
2613
2708
|
* - `dgmo=<payload>`
|
|
2614
2709
|
* - `<bare payload>`
|
|
2615
2710
|
*
|
|
@@ -2642,4 +2737,4 @@ declare function parseFirstLine(line: string): {
|
|
|
2642
2737
|
*/
|
|
2643
2738
|
declare function injectBranding(svgHtml: string, mutedColor: string): string;
|
|
2644
2739
|
|
|
2645
|
-
export { ALL_CHART_TYPES, type Activation, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, 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, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedOrgResult, type CollapsedSitemapResult, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type D3ExportDimensions, type DecodedDiagramUrl, type DgmoError, type DgmoSeverity, type DiagramSymbols, type
|
|
2740
|
+
export { ALL_CHART_TYPES, type Activation, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, 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, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, 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 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 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 KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type LegendCallbacks, type LegendConfig, type LegendControl, type LegendGroupData, type LegendHandle, type LegendLayout, type LegendMode, type LegendPalette, type LegendPosition, type LegendState, METADATA_KEY_SET, type MemberVisibility, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, type OrgNode, PIPE_METADATA, type PaletteColors, type PaletteConfig, type ParsedBoxesAndLines, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedKanban, type ParsedOrg, type ParsedQuadrant, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedVisualization, type ParticipantType, type PipeKeySpec, RECOGNIZED_COLOR_NAMES, RULE_COUNT, type ReadFileFn, type RelationshipType, type RenderCategory, type RenderStep, type ResolveImportsResult, type ResolvedGroup, type ResolvedSchedule, type ResolvedTask, 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 TagEntry, type TagGroup, type VisualizationType, addDurationToDate, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildMermaidQuadrant, buildMermaidThemeVars, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, buildThemeCSS, calculateSchedule, catppuccinPalette, collapseBoxesAndLines, collapseOrgTree, collapseSitemapTree, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractTagDeclarations, formatDateLabel, formatDgmoError, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, injectBranding, isArchiveColumn, isExtendedChartType, isRecognizedColorName, isSequenceBlock, isSequenceNote, isValidHex, layoutBoxesAndLines, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutOrg, layoutSitemap, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, monokaiPalette, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInfra, parseInlineMarkdown, parseKanban, parseOrg, parseQuadrant, parseSequenceDgmo, parseSitemap, parseState, parseTimelineDate, parseVisualization, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderOrg, renderOrgForExport, renderQuadrant, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTimeline, renderVenn, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra };
|
package/dist/index.d.ts
CHANGED
|
@@ -298,6 +298,7 @@ declare function parseDataRowValues(line: string, options?: {
|
|
|
298
298
|
interface LegendState {
|
|
299
299
|
activeGroup: string | null;
|
|
300
300
|
hiddenAttributes?: Set<string>;
|
|
301
|
+
controlsExpanded?: boolean;
|
|
301
302
|
}
|
|
302
303
|
interface LegendCallbacks {
|
|
303
304
|
onGroupToggle?: (groupName: string) => void;
|
|
@@ -307,6 +308,10 @@ interface LegendCallbacks {
|
|
|
307
308
|
onEntryHover?: (groupName: string, entryValue: string | null) => void;
|
|
308
309
|
/** Called after each group <g> is rendered — lets chart renderers inject custom elements (swimlane icons, etc.) */
|
|
309
310
|
onGroupRendered?: (groupName: string, groupEl: D3Sel, isActive: boolean) => void;
|
|
311
|
+
/** Called when the controls group gear pill is clicked (expand/collapse) */
|
|
312
|
+
onControlsExpand?: () => void;
|
|
313
|
+
/** Called when a controls group toggle entry is clicked */
|
|
314
|
+
onControlsToggle?: (toggleId: string, active: boolean) => void;
|
|
310
315
|
}
|
|
311
316
|
interface LegendPosition {
|
|
312
317
|
placement: 'top-center';
|
|
@@ -329,10 +334,22 @@ interface LegendControlEntry {
|
|
|
329
334
|
isActive?: boolean;
|
|
330
335
|
onClick?: () => void;
|
|
331
336
|
}
|
|
337
|
+
interface ControlsGroupToggle {
|
|
338
|
+
id: string;
|
|
339
|
+
/** Only 'toggle' is implemented in v1. 'select' and 'action' future-proof for Infra playback etc. */
|
|
340
|
+
type: 'toggle' | 'select' | 'action';
|
|
341
|
+
label: string;
|
|
342
|
+
active: boolean;
|
|
343
|
+
onToggle: (active: boolean) => void;
|
|
344
|
+
}
|
|
345
|
+
interface ControlsGroupConfig {
|
|
346
|
+
toggles: ControlsGroupToggle[];
|
|
347
|
+
}
|
|
332
348
|
interface LegendConfig {
|
|
333
349
|
groups: LegendGroupData[];
|
|
334
350
|
position: LegendPosition;
|
|
335
351
|
controls?: LegendControl[];
|
|
352
|
+
controlsGroup?: ControlsGroupConfig;
|
|
336
353
|
mode: LegendMode;
|
|
337
354
|
/** Title width in pixels — used for inline-with-title computation */
|
|
338
355
|
titleWidth?: number;
|
|
@@ -397,6 +414,31 @@ interface LegendControlLayout {
|
|
|
397
414
|
isActive?: boolean;
|
|
398
415
|
}>;
|
|
399
416
|
}
|
|
417
|
+
interface ControlsGroupToggleLayout {
|
|
418
|
+
id: string;
|
|
419
|
+
label: string;
|
|
420
|
+
active: boolean;
|
|
421
|
+
dotCx: number;
|
|
422
|
+
dotCy: number;
|
|
423
|
+
textX: number;
|
|
424
|
+
textY: number;
|
|
425
|
+
}
|
|
426
|
+
interface ControlsGroupLayout {
|
|
427
|
+
x: number;
|
|
428
|
+
y: number;
|
|
429
|
+
width: number;
|
|
430
|
+
height: number;
|
|
431
|
+
expanded: boolean;
|
|
432
|
+
/** The gear pill layout (collapsed or inside capsule) */
|
|
433
|
+
pill: {
|
|
434
|
+
x: number;
|
|
435
|
+
y: number;
|
|
436
|
+
width: number;
|
|
437
|
+
height: number;
|
|
438
|
+
};
|
|
439
|
+
/** Toggle entries (only present when expanded) */
|
|
440
|
+
toggles: ControlsGroupToggleLayout[];
|
|
441
|
+
}
|
|
400
442
|
interface LegendRowLayout {
|
|
401
443
|
y: number;
|
|
402
444
|
items: Array<LegendPillLayout | LegendCapsuleLayout | LegendControlLayout>;
|
|
@@ -414,6 +456,8 @@ interface LegendLayout {
|
|
|
414
456
|
controls: LegendControlLayout[];
|
|
415
457
|
/** All pill layouts (collapsed groups) */
|
|
416
458
|
pills: LegendPillLayout[];
|
|
459
|
+
/** Controls group layout (gear pill / capsule) */
|
|
460
|
+
controlsGroup?: ControlsGroupLayout;
|
|
417
461
|
}
|
|
418
462
|
interface LegendHandle {
|
|
419
463
|
setState: (state: LegendState) => void;
|
|
@@ -895,6 +939,8 @@ interface SequenceGroup {
|
|
|
895
939
|
lineNumber: number;
|
|
896
940
|
/** Pipe-delimited tag metadata (e.g. `[Backend | t: Product]`) */
|
|
897
941
|
metadata?: Record<string, string>;
|
|
942
|
+
/** Whether this group is collapsed by default */
|
|
943
|
+
collapsed?: boolean;
|
|
898
944
|
}
|
|
899
945
|
/**
|
|
900
946
|
* Parsed result from a .dgmo sequence diagram.
|
|
@@ -2456,6 +2502,7 @@ interface SectionMessageGroup {
|
|
|
2456
2502
|
}
|
|
2457
2503
|
interface SequenceRenderOptions {
|
|
2458
2504
|
collapsedSections?: Set<number>;
|
|
2505
|
+
collapsedGroups?: Set<number>;
|
|
2459
2506
|
expandedNoteLines?: Set<number>;
|
|
2460
2507
|
exportWidth?: number;
|
|
2461
2508
|
activeTagGroup?: string | null;
|
|
@@ -2518,6 +2565,23 @@ declare function renderSequenceDiagram(container: HTMLDivElement, parsed: Parsed
|
|
|
2518
2565
|
*/
|
|
2519
2566
|
declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
|
|
2520
2567
|
|
|
2568
|
+
interface CollapsedView {
|
|
2569
|
+
participants: SequenceParticipant[];
|
|
2570
|
+
messages: SequenceMessage[];
|
|
2571
|
+
elements: SequenceElement[];
|
|
2572
|
+
groups: SequenceGroup[];
|
|
2573
|
+
/** Maps member participant ID → collapsed group name */
|
|
2574
|
+
collapsedGroupIds: Map<string, string>;
|
|
2575
|
+
}
|
|
2576
|
+
/**
|
|
2577
|
+
* Project a parsed sequence diagram into a collapsed view.
|
|
2578
|
+
*
|
|
2579
|
+
* @param parsed - The immutable parsed sequence diagram
|
|
2580
|
+
* @param collapsedGroups - Set of group lineNumbers that should be collapsed
|
|
2581
|
+
* @returns A new CollapsedView with remapped participants, messages, elements, and groups
|
|
2582
|
+
*/
|
|
2583
|
+
declare function applyCollapseProjection(parsed: ParsedSequenceDgmo, collapsedGroups: Set<number>): CollapsedView;
|
|
2584
|
+
|
|
2521
2585
|
/** Complete 16-entry Nord palette. */
|
|
2522
2586
|
declare const nord: {
|
|
2523
2587
|
nord0: string;
|
|
@@ -2572,22 +2636,43 @@ declare function resolveColorWithDiagnostic(color: string, line: number, diagnos
|
|
|
2572
2636
|
/** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
|
|
2573
2637
|
declare const seriesColors: string[];
|
|
2574
2638
|
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2639
|
+
/**
|
|
2640
|
+
* Compact view state schema (ADR-6).
|
|
2641
|
+
* All fields optional. Only non-default values are encoded.
|
|
2642
|
+
* `tag: null` means "user chose none"; absent `tag` means "use DSL default" (ADR-5).
|
|
2643
|
+
*/
|
|
2644
|
+
interface CompactViewState {
|
|
2645
|
+
tag?: string | null;
|
|
2646
|
+
cs?: number[];
|
|
2647
|
+
cg?: string[];
|
|
2648
|
+
swim?: string | null;
|
|
2649
|
+
cl?: string[];
|
|
2650
|
+
cc?: string[];
|
|
2651
|
+
rm?: string;
|
|
2652
|
+
htv?: Record<string, string[]>;
|
|
2653
|
+
ha?: string[];
|
|
2654
|
+
enl?: number[];
|
|
2655
|
+
sem?: boolean;
|
|
2656
|
+
cm?: boolean;
|
|
2657
|
+
c4l?: string;
|
|
2658
|
+
c4s?: string;
|
|
2659
|
+
c4c?: string;
|
|
2660
|
+
rps?: number;
|
|
2661
|
+
spd?: number;
|
|
2662
|
+
io?: Record<string, number>;
|
|
2582
2663
|
}
|
|
2583
2664
|
interface DecodedDiagramUrl {
|
|
2584
2665
|
dsl: string;
|
|
2585
|
-
viewState:
|
|
2666
|
+
viewState: CompactViewState;
|
|
2667
|
+
palette?: string;
|
|
2668
|
+
theme?: 'light' | 'dark';
|
|
2586
2669
|
filename?: string;
|
|
2587
2670
|
}
|
|
2588
2671
|
interface EncodeDiagramUrlOptions {
|
|
2589
2672
|
baseUrl?: string;
|
|
2590
|
-
viewState?:
|
|
2673
|
+
viewState?: CompactViewState;
|
|
2674
|
+
palette?: string;
|
|
2675
|
+
theme?: 'light' | 'dark';
|
|
2591
2676
|
filename?: string;
|
|
2592
2677
|
}
|
|
2593
2678
|
type EncodeDiagramUrlResult = {
|
|
@@ -2599,6 +2684,16 @@ type EncodeDiagramUrlResult = {
|
|
|
2599
2684
|
compressedSize: number;
|
|
2600
2685
|
limit: number;
|
|
2601
2686
|
};
|
|
2687
|
+
/**
|
|
2688
|
+
* Encode a CompactViewState to a compressed string for URL embedding.
|
|
2689
|
+
* Returns empty string if state has no keys (ADR-4).
|
|
2690
|
+
*/
|
|
2691
|
+
declare function encodeViewState(state: CompactViewState): string;
|
|
2692
|
+
/**
|
|
2693
|
+
* Decode a compressed view state string back to CompactViewState.
|
|
2694
|
+
* Returns empty object on failure (no crash).
|
|
2695
|
+
*/
|
|
2696
|
+
declare function decodeViewState(encoded: string): CompactViewState;
|
|
2602
2697
|
/**
|
|
2603
2698
|
* Compress a DGMO DSL string into a shareable URL.
|
|
2604
2699
|
* Returns `{ url }` on success, or `{ error: 'too-large', compressedSize, limit }` if the
|
|
@@ -2608,8 +2703,8 @@ declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions
|
|
|
2608
2703
|
/**
|
|
2609
2704
|
* Decode a DGMO DSL string and view state from a URL query string or hash.
|
|
2610
2705
|
* Accepts any of:
|
|
2611
|
-
* - `?dgmo=<payload>&
|
|
2612
|
-
* - `#dgmo=<payload>&
|
|
2706
|
+
* - `?dgmo=<payload>&vs=<state>`
|
|
2707
|
+
* - `#dgmo=<payload>&vs=<state>` (backwards compat)
|
|
2613
2708
|
* - `dgmo=<payload>`
|
|
2614
2709
|
* - `<bare payload>`
|
|
2615
2710
|
*
|
|
@@ -2642,4 +2737,4 @@ declare function parseFirstLine(line: string): {
|
|
|
2642
2737
|
*/
|
|
2643
2738
|
declare function injectBranding(svgHtml: string, mutedColor: string): string;
|
|
2644
2739
|
|
|
2645
|
-
export { ALL_CHART_TYPES, type Activation, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, 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, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedOrgResult, type CollapsedSitemapResult, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type D3ExportDimensions, type DecodedDiagramUrl, type DgmoError, type DgmoSeverity, type DiagramSymbols, type
|
|
2740
|
+
export { ALL_CHART_TYPES, type Activation, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, 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, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, 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 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 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 KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type LegendCallbacks, type LegendConfig, type LegendControl, type LegendGroupData, type LegendHandle, type LegendLayout, type LegendMode, type LegendPalette, type LegendPosition, type LegendState, METADATA_KEY_SET, type MemberVisibility, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, type OrgNode, PIPE_METADATA, type PaletteColors, type PaletteConfig, type ParsedBoxesAndLines, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedKanban, type ParsedOrg, type ParsedQuadrant, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedVisualization, type ParticipantType, type PipeKeySpec, RECOGNIZED_COLOR_NAMES, RULE_COUNT, type ReadFileFn, type RelationshipType, type RenderCategory, type RenderStep, type ResolveImportsResult, type ResolvedGroup, type ResolvedSchedule, type ResolvedTask, 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 TagEntry, type TagGroup, type VisualizationType, addDurationToDate, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildMermaidQuadrant, buildMermaidThemeVars, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, buildThemeCSS, calculateSchedule, catppuccinPalette, collapseBoxesAndLines, collapseOrgTree, collapseSitemapTree, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractTagDeclarations, formatDateLabel, formatDgmoError, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, injectBranding, isArchiveColumn, isExtendedChartType, isRecognizedColorName, isSequenceBlock, isSequenceNote, isValidHex, layoutBoxesAndLines, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutOrg, layoutSitemap, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, monokaiPalette, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInfra, parseInlineMarkdown, parseKanban, parseOrg, parseQuadrant, parseSequenceDgmo, parseSitemap, parseState, parseTimelineDate, parseVisualization, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderOrg, renderOrgForExport, renderQuadrant, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTimeline, renderVenn, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra };
|