@diagrammo/dgmo 0.14.1 → 0.15.1
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/README.md +14 -1
- package/dist/advanced.cjs +53069 -0
- package/dist/advanced.d.cts +4691 -0
- package/dist/advanced.d.ts +4691 -0
- package/dist/advanced.js +52823 -0
- package/dist/auto.cjs +1557 -1295
- package/dist/auto.js +132 -713
- package/dist/auto.mjs +1553 -1291
- package/dist/cli.cjs +173 -150
- 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 +2031 -4722
- package/dist/index.d.cts +96 -4464
- package/dist/index.d.ts +96 -4464
- package/dist/index.js +2024 -4475
- package/dist/internal.cjs +51930 -553
- package/dist/internal.d.cts +4526 -102
- package/dist/internal.d.ts +4526 -102
- package/dist/internal.js +51721 -548
- package/dist/pert.cjs +1 -1
- package/dist/pert.js +1 -1
- package/docs/language-reference.md +67 -17
- package/package.json +18 -3
- package/src/advanced.ts +731 -0
- package/src/auto/index.ts +14 -13
- package/src/boxes-and-lines/layout.ts +481 -445
- package/src/c4/parser.ts +7 -7
- package/src/chart-types.ts +0 -5
- package/src/class/parser.ts +1 -9
- package/src/cli.ts +9 -7
- package/src/completion-types.ts +28 -0
- package/src/completion.ts +15 -18
- package/src/cycle/layout.ts +2 -2
- package/src/d3.ts +1455 -1122
- package/src/echarts.ts +11 -11
- package/src/editor/keywords.ts +1 -0
- package/src/er/parser.ts +1 -9
- package/src/er/renderer.ts +1 -1
- package/src/gantt/calculator.ts +1 -11
- package/src/gantt/parser.ts +16 -16
- package/src/gantt/renderer.ts +2 -2
- package/src/graph/flowchart-parser.ts +1 -1
- package/src/graph/flowchart-renderer.ts +1 -1
- package/src/graph/state-renderer.ts +1 -1
- package/src/index.ts +213 -690
- package/src/infra/parser.ts +57 -25
- package/src/infra/renderer.ts +2 -2
- package/src/internal.ts +11 -17
- package/src/kanban/parser.ts +2 -2
- package/src/mindmap/layout.ts +1 -1
- package/src/mindmap/parser.ts +1 -1
- package/src/org/parser.ts +1 -1
- package/src/org/renderer.ts +1 -1
- package/src/palettes/index.ts +39 -0
- package/src/pert/layout.ts +1 -1
- package/src/pert/monte-carlo.ts +2 -2
- package/src/pert/parser.ts +3 -3
- package/src/raci/parser.ts +4 -4
- package/src/raci/renderer.ts +1 -1
- package/src/render.ts +17 -1
- package/src/sequence/renderer.ts +1 -4
- package/src/sitemap/parser.ts +1 -1
- package/src/tech-radar/interactive.ts +1 -1
- package/src/tech-radar/renderer.ts +1 -1
- package/src/themes.ts +22 -0
- package/src/utils/tag-groups.ts +11 -12
- package/src/wireframe/layout.ts +11 -7
- package/src/wireframe/parser.ts +2 -2
- package/src/wireframe/renderer.ts +5 -2
package/src/index.ts
CHANGED
|
@@ -1,692 +1,215 @@
|
|
|
1
1
|
// ============================================================
|
|
2
|
-
//
|
|
3
|
-
// ============================================================
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from './utils/arrows';
|
|
18
|
-
export type { ParseInArrowLabelResult } from './utils/arrows';
|
|
19
|
-
|
|
20
|
-
// ============================================================
|
|
21
|
-
// Unified API
|
|
22
|
-
// ============================================================
|
|
23
|
-
|
|
24
|
-
export { render } from './render';
|
|
25
|
-
|
|
26
|
-
// ============================================================
|
|
27
|
-
// Chart-type registry (single source of truth)
|
|
28
|
-
// ============================================================
|
|
29
|
-
|
|
30
|
-
export { chartTypes, BETA_CHART_IDS } from './chart-types';
|
|
31
|
-
export type { ChartTypeMeta } from './chart-types';
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
normalize as normalizeChartTypePrompt,
|
|
35
|
-
matchesContiguously,
|
|
36
|
-
scoreChartType,
|
|
37
|
-
confidence as chartTypeConfidence,
|
|
38
|
-
suggestChartTypes,
|
|
39
|
-
MIN_PRIMARY_SCORE,
|
|
40
|
-
AMBIGUITY_THRESHOLD,
|
|
41
|
-
} from './chart-type-scoring';
|
|
42
|
-
export type {
|
|
43
|
-
ChartTypeScore,
|
|
44
|
-
Confidence as ChartTypeConfidence,
|
|
45
|
-
SuggestionResult as ChartTypeSuggestionResult,
|
|
46
|
-
} from './chart-type-scoring';
|
|
47
|
-
|
|
48
|
-
// ============================================================
|
|
49
|
-
// Router
|
|
50
|
-
// ============================================================
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
parseDgmoChartType,
|
|
54
|
-
parseDgmo,
|
|
55
|
-
getRenderCategory,
|
|
56
|
-
isExtendedChartType,
|
|
57
|
-
getAllChartTypes,
|
|
58
|
-
CHART_TYPE_DESCRIPTIONS,
|
|
59
|
-
chartTypeParsers,
|
|
60
|
-
knownChartTypeIds,
|
|
61
|
-
} from './dgmo-router';
|
|
62
|
-
export type { RenderCategory } from './dgmo-router';
|
|
63
|
-
|
|
64
|
-
// ============================================================
|
|
65
|
-
// Parsers
|
|
66
|
-
// ============================================================
|
|
67
|
-
|
|
68
|
-
export { parseChart, parseDataRowValues } from './chart';
|
|
69
|
-
export type { ParsedChart, ChartType, ChartDataPoint, ChartEra } from './chart';
|
|
70
|
-
|
|
71
|
-
export { parseExtendedChart } from './echarts';
|
|
72
|
-
export type { ParsedExtendedChart, ExtendedChartType } from './echarts';
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
parseVisualization,
|
|
76
|
-
orderArcNodes,
|
|
77
|
-
parseTimelineDate,
|
|
78
|
-
addDurationToDate,
|
|
79
|
-
formatDateLabel,
|
|
80
|
-
} from './d3';
|
|
81
|
-
export { computeTimeTicks } from './utils/time-ticks';
|
|
82
|
-
export type {
|
|
83
|
-
ParsedVisualization,
|
|
84
|
-
VisualizationType,
|
|
85
|
-
D3ExportDimensions,
|
|
86
|
-
ArcLink,
|
|
87
|
-
ArcNodeGroup,
|
|
88
|
-
} from './d3';
|
|
89
|
-
|
|
90
|
-
export {
|
|
91
|
-
parseSequenceDgmo,
|
|
92
|
-
parseSequenceDgmo as parseSequenceDiagram,
|
|
93
|
-
looksLikeSequence,
|
|
94
|
-
isSequenceBlock,
|
|
95
|
-
isSequenceNote,
|
|
96
|
-
} from './sequence/parser';
|
|
97
|
-
export type {
|
|
98
|
-
ParsedSequenceDgmo,
|
|
99
|
-
SequenceParticipant,
|
|
100
|
-
SequenceMessage,
|
|
101
|
-
SequenceBlock,
|
|
102
|
-
ElseIfBranch,
|
|
103
|
-
SequenceSection,
|
|
104
|
-
SequenceNote,
|
|
105
|
-
SequenceElement,
|
|
106
|
-
SequenceGroup,
|
|
107
|
-
ParticipantType,
|
|
108
|
-
} from './sequence/parser';
|
|
109
|
-
|
|
110
|
-
export {
|
|
111
|
-
inferParticipantType,
|
|
112
|
-
RULE_COUNT,
|
|
113
|
-
} from './sequence/participant-inference';
|
|
114
|
-
|
|
115
|
-
export { parseFlowchart, looksLikeFlowchart } from './graph/flowchart-parser';
|
|
116
|
-
|
|
117
|
-
export { parseState, looksLikeState } from './graph/state-parser';
|
|
118
|
-
export { renderState, renderStateForExport } from './graph/state-renderer';
|
|
119
|
-
export { collapseStateGroups } from './graph/state-collapse';
|
|
120
|
-
export type { StateCollapseResult } from './graph/state-collapse';
|
|
121
|
-
|
|
122
|
-
export { parseClassDiagram, looksLikeClassDiagram } from './class/parser';
|
|
123
|
-
|
|
124
|
-
export type {
|
|
125
|
-
ParsedClassDiagram,
|
|
126
|
-
ClassNode,
|
|
127
|
-
ClassMember,
|
|
128
|
-
ClassRelationship,
|
|
129
|
-
ClassModifier,
|
|
130
|
-
MemberVisibility,
|
|
131
|
-
RelationshipType,
|
|
132
|
-
} from './class/types';
|
|
133
|
-
|
|
134
|
-
export { layoutClassDiagram } from './class/layout';
|
|
135
|
-
export type {
|
|
136
|
-
ClassLayoutResult,
|
|
137
|
-
ClassLayoutNode,
|
|
138
|
-
ClassLayoutEdge,
|
|
139
|
-
} from './class/layout';
|
|
140
|
-
|
|
141
|
-
export {
|
|
142
|
-
renderClassDiagram,
|
|
143
|
-
renderClassDiagramForExport,
|
|
144
|
-
} from './class/renderer';
|
|
145
|
-
|
|
146
|
-
export { parseERDiagram, looksLikeERDiagram } from './er/parser';
|
|
147
|
-
|
|
148
|
-
export type {
|
|
149
|
-
ParsedERDiagram,
|
|
150
|
-
ERTable,
|
|
151
|
-
ERColumn,
|
|
152
|
-
ERRelationship,
|
|
153
|
-
ERConstraint,
|
|
154
|
-
ERCardinality,
|
|
155
|
-
} from './er/types';
|
|
156
|
-
|
|
157
|
-
export { layoutERDiagram } from './er/layout';
|
|
158
|
-
export type { ERLayoutResult, ERLayoutNode, ERLayoutEdge } from './er/layout';
|
|
159
|
-
|
|
160
|
-
export { renderERDiagram, renderERDiagramForExport } from './er/renderer';
|
|
161
|
-
|
|
162
|
-
export type {
|
|
163
|
-
ParsedGraph,
|
|
164
|
-
GraphNode,
|
|
165
|
-
GraphEdge,
|
|
166
|
-
GraphGroup,
|
|
167
|
-
GraphShape,
|
|
168
|
-
GraphDirection,
|
|
169
|
-
} from './graph/types';
|
|
170
|
-
|
|
171
|
-
export type { TagGroup, TagEntry } from './utils/tag-groups';
|
|
172
|
-
|
|
173
|
-
export { parseInlineMarkdown, truncateBareUrl } from './utils/inline-markdown';
|
|
174
|
-
export type { InlineSpan } from './utils/inline-markdown';
|
|
175
|
-
|
|
176
|
-
export {
|
|
177
|
-
normalizeName,
|
|
178
|
-
displayName,
|
|
179
|
-
getOrCreateName,
|
|
180
|
-
} from './utils/name-normalize';
|
|
181
|
-
export type { NameEntry, GetOrCreateNameResult } from './utils/name-normalize';
|
|
182
|
-
|
|
183
|
-
export { parseOrg } from './org/parser';
|
|
184
|
-
export type { ParsedOrg, OrgNode } from './org/parser';
|
|
185
|
-
|
|
186
|
-
export { layoutOrg } from './org/layout';
|
|
187
|
-
export type {
|
|
188
|
-
OrgLayoutResult,
|
|
189
|
-
OrgLayoutNode,
|
|
190
|
-
OrgLayoutEdge,
|
|
191
|
-
OrgContainerBounds,
|
|
192
|
-
} from './org/layout';
|
|
193
|
-
|
|
194
|
-
export { renderOrg, renderOrgForExport } from './org/renderer';
|
|
195
|
-
|
|
196
|
-
export { parseKanban } from './kanban/parser';
|
|
197
|
-
export type {
|
|
198
|
-
ParsedKanban,
|
|
199
|
-
KanbanColumn,
|
|
200
|
-
KanbanCard,
|
|
201
|
-
KanbanTagGroup,
|
|
202
|
-
KanbanTagEntry,
|
|
203
|
-
} from './kanban/types';
|
|
204
|
-
export {
|
|
205
|
-
computeCardMove,
|
|
206
|
-
computeCardArchive,
|
|
207
|
-
isArchiveColumn,
|
|
208
|
-
} from './kanban/mutations';
|
|
209
|
-
export { renderKanban, renderKanbanForExport } from './kanban/renderer';
|
|
210
|
-
|
|
211
|
-
export { parseC4 } from './c4/parser';
|
|
212
|
-
export type {
|
|
213
|
-
ParsedC4,
|
|
214
|
-
C4Element,
|
|
215
|
-
C4ElementType,
|
|
216
|
-
C4Shape,
|
|
217
|
-
C4ArrowType,
|
|
218
|
-
C4Relationship,
|
|
219
|
-
C4Group,
|
|
220
|
-
C4DeploymentNode,
|
|
221
|
-
C4TagGroup,
|
|
222
|
-
C4TagEntry,
|
|
223
|
-
} from './c4/types';
|
|
224
|
-
|
|
225
|
-
export {
|
|
226
|
-
layoutC4Context,
|
|
227
|
-
layoutC4Containers,
|
|
228
|
-
layoutC4Components,
|
|
229
|
-
layoutC4Deployment,
|
|
230
|
-
rollUpContextRelationships,
|
|
231
|
-
} from './c4/layout';
|
|
232
|
-
export type {
|
|
233
|
-
C4LayoutResult,
|
|
234
|
-
C4LayoutNode,
|
|
235
|
-
C4LayoutEdge,
|
|
236
|
-
C4LayoutBoundary,
|
|
237
|
-
C4LegendGroup,
|
|
238
|
-
C4LegendEntry,
|
|
239
|
-
ContextRelationship,
|
|
240
|
-
} from './c4/layout';
|
|
241
|
-
|
|
242
|
-
export {
|
|
243
|
-
renderC4Context,
|
|
244
|
-
renderC4ContextForExport,
|
|
245
|
-
renderC4Containers,
|
|
246
|
-
renderC4ContainersForExport,
|
|
247
|
-
renderC4ComponentsForExport,
|
|
248
|
-
renderC4Deployment,
|
|
249
|
-
renderC4DeploymentForExport,
|
|
250
|
-
} from './c4/renderer';
|
|
251
|
-
|
|
252
|
-
export { parseBoxesAndLines } from './boxes-and-lines/parser';
|
|
253
|
-
export type {
|
|
254
|
-
ParsedBoxesAndLines,
|
|
255
|
-
BLNode,
|
|
256
|
-
BLEdge,
|
|
257
|
-
BLGroup,
|
|
258
|
-
} from './boxes-and-lines/types';
|
|
259
|
-
export { layoutBoxesAndLines } from './boxes-and-lines/layout';
|
|
260
|
-
export type {
|
|
261
|
-
BLLayoutResult,
|
|
262
|
-
BLLayoutNode,
|
|
263
|
-
BLLayoutEdge,
|
|
264
|
-
BLLayoutGroup,
|
|
265
|
-
} from './boxes-and-lines/layout';
|
|
266
|
-
export {
|
|
267
|
-
renderBoxesAndLines,
|
|
268
|
-
renderBoxesAndLinesForExport,
|
|
269
|
-
} from './boxes-and-lines/renderer';
|
|
270
|
-
|
|
271
|
-
export { collapseBoxesAndLines } from './boxes-and-lines/collapse';
|
|
272
|
-
export type { BLCollapseResult } from './boxes-and-lines/collapse';
|
|
273
|
-
|
|
274
|
-
export { parseSitemap, looksLikeSitemap } from './sitemap/parser';
|
|
275
|
-
|
|
276
|
-
export type {
|
|
277
|
-
ParsedSitemap,
|
|
278
|
-
SitemapNode,
|
|
279
|
-
SitemapEdge,
|
|
280
|
-
SitemapDirection,
|
|
281
|
-
} from './sitemap/types';
|
|
282
|
-
|
|
283
|
-
export { layoutSitemap } from './sitemap/layout';
|
|
284
|
-
export type {
|
|
285
|
-
SitemapLayoutResult,
|
|
286
|
-
SitemapLayoutNode,
|
|
287
|
-
SitemapLayoutEdge,
|
|
288
|
-
SitemapContainerBounds,
|
|
289
|
-
SitemapLegendGroup,
|
|
290
|
-
SitemapLegendEntry,
|
|
291
|
-
} from './sitemap/layout';
|
|
292
|
-
|
|
293
|
-
export { renderSitemap, renderSitemapForExport } from './sitemap/renderer';
|
|
294
|
-
|
|
295
|
-
export { collapseSitemapTree } from './sitemap/collapse';
|
|
296
|
-
|
|
297
|
-
// ── Infra Chart ────────────────────────────────────────────
|
|
298
|
-
export { parseInfra } from './infra/parser';
|
|
299
|
-
export type {
|
|
300
|
-
ParsedInfra,
|
|
301
|
-
InfraNode,
|
|
302
|
-
InfraEdge,
|
|
303
|
-
InfraGroup,
|
|
304
|
-
InfraTagGroup,
|
|
305
|
-
InfraProperty,
|
|
306
|
-
InfraDiagnostic,
|
|
307
|
-
InfraComputeParams,
|
|
308
|
-
InfraBehaviorKey,
|
|
309
|
-
} from './infra/types';
|
|
310
|
-
export { INFRA_BEHAVIOR_KEYS } from './infra/types';
|
|
311
|
-
export { computeInfra } from './infra/compute';
|
|
312
|
-
export type {
|
|
313
|
-
ComputedInfraModel,
|
|
314
|
-
ComputedInfraNode,
|
|
315
|
-
ComputedInfraEdge,
|
|
316
|
-
InfraLatencyPercentiles,
|
|
317
|
-
InfraAvailabilityPercentiles,
|
|
318
|
-
InfraCbState,
|
|
319
|
-
} from './infra/types';
|
|
320
|
-
export { validateInfra, validateComputed } from './infra/validation';
|
|
321
|
-
export { inferRoles, collectDiagramRoles } from './infra/roles';
|
|
322
|
-
export type { InfraRole } from './infra/roles';
|
|
323
|
-
export { layoutInfra } from './infra/layout';
|
|
324
|
-
export type {
|
|
325
|
-
InfraLayoutResult,
|
|
326
|
-
InfraLayoutNode,
|
|
327
|
-
InfraLayoutEdge,
|
|
328
|
-
InfraLayoutGroup,
|
|
329
|
-
} from './infra/layout';
|
|
330
|
-
export {
|
|
331
|
-
renderInfra,
|
|
332
|
-
parseAndLayoutInfra,
|
|
333
|
-
computeInfraLegendGroups,
|
|
334
|
-
} from './infra/renderer';
|
|
335
|
-
export type { InfraLegendGroup, InfraPlaybackState } from './infra/renderer';
|
|
336
|
-
export type { CollapsedSitemapResult } from './sitemap/collapse';
|
|
337
|
-
|
|
338
|
-
// ── Gantt Chart ───────────────────────────────────────────
|
|
339
|
-
export { parseGantt } from './gantt/parser';
|
|
340
|
-
export { calculateSchedule } from './gantt/calculator';
|
|
341
|
-
export { renderGantt, buildTagLaneRowList } from './gantt/renderer';
|
|
342
|
-
export type {
|
|
343
|
-
GanttInteractiveOptions,
|
|
344
|
-
GanttRow,
|
|
345
|
-
GanttGroupRow,
|
|
346
|
-
GanttTaskRow,
|
|
347
|
-
GanttLaneHeaderRow,
|
|
348
|
-
} from './gantt/renderer';
|
|
349
|
-
export { resolveTaskName, collectTasks } from './gantt/resolver';
|
|
350
|
-
export type {
|
|
351
|
-
ParsedGantt,
|
|
352
|
-
GanttTask,
|
|
353
|
-
GanttGroup,
|
|
354
|
-
GanttParallelBlock,
|
|
355
|
-
GanttNode,
|
|
356
|
-
GanttDependency,
|
|
357
|
-
GanttHolidays,
|
|
358
|
-
GanttEra,
|
|
359
|
-
GanttMarker,
|
|
360
|
-
GanttOptions,
|
|
361
|
-
Duration,
|
|
362
|
-
DurationUnit,
|
|
363
|
-
ResolvedSchedule,
|
|
364
|
-
ResolvedTask,
|
|
365
|
-
ResolvedGroup,
|
|
366
|
-
} from './gantt/types';
|
|
367
|
-
|
|
368
|
-
// ── PERT Diagram ──────────────────────────────────────────
|
|
369
|
-
export { parsePert, looksLikePert, extractPertSymbols } from './pert/parser';
|
|
370
|
-
export { analyzePert } from './pert/analyzer';
|
|
371
|
-
export { layoutPert, relayoutPert } from './pert/layout';
|
|
372
|
-
export type { LayoutOverrides as PertLayoutOverrides } from './pert/internal';
|
|
373
|
-
export { normalizePertSourceForShare } from './pert/share-normalize';
|
|
374
|
-
export {
|
|
375
|
-
renderPert,
|
|
376
|
-
renderPertForExport,
|
|
377
|
-
renderPertAnalysisBlock,
|
|
378
|
-
measurePertAnalysisBlock,
|
|
379
|
-
highlightPertCriticalPath,
|
|
380
|
-
highlightPertSet,
|
|
381
|
-
pertLegendEntries,
|
|
382
|
-
pertLegendBlockWidth,
|
|
383
|
-
PERT_LEGEND_PILL_HEIGHT,
|
|
384
|
-
renderLegendBlock as renderPertLegendBlock,
|
|
385
|
-
resetPertCriticalPath,
|
|
386
|
-
resetPertHighlight,
|
|
387
|
-
} from './pert/renderer';
|
|
388
|
-
export type { PertRenderOptions } from './pert/renderer';
|
|
389
|
-
export type {
|
|
390
|
-
Anchor as PertAnchor,
|
|
391
|
-
ParsedPert,
|
|
392
|
-
PertActivity,
|
|
393
|
-
PertEdge,
|
|
394
|
-
PertGroup,
|
|
395
|
-
PertMilestone,
|
|
396
|
-
PertOptions,
|
|
397
|
-
PertDirection,
|
|
398
|
-
NodeDetail,
|
|
399
|
-
ResolvedActivity,
|
|
400
|
-
ResolvedGroup as ResolvedPertGroup,
|
|
401
|
-
ResolvedPert,
|
|
402
|
-
MonteCarloResult,
|
|
403
|
-
PertLayoutNode,
|
|
404
|
-
PertLayoutEdge,
|
|
405
|
-
PertLayoutGroup,
|
|
406
|
-
LayoutResult as PertLayoutResult,
|
|
407
|
-
} from './pert/types';
|
|
408
|
-
|
|
409
|
-
export { collapseOrgTree, focusOrgTree } from './org/collapse';
|
|
410
|
-
export type {
|
|
411
|
-
CollapsedOrgResult,
|
|
412
|
-
FocusOrgResult,
|
|
413
|
-
AncestorInfo,
|
|
414
|
-
} from './org/collapse';
|
|
415
|
-
|
|
416
|
-
export { parseMindmap } from './mindmap/parser';
|
|
417
|
-
export type {
|
|
418
|
-
MindmapNode,
|
|
419
|
-
ParsedMindmap,
|
|
420
|
-
MindmapLayoutNode,
|
|
421
|
-
MindmapLayoutEdge,
|
|
422
|
-
MindmapLayoutResult,
|
|
423
|
-
} from './mindmap/types';
|
|
424
|
-
export { layoutMindmap } from './mindmap/layout';
|
|
425
|
-
export { renderMindmap, renderMindmapForExport } from './mindmap/renderer';
|
|
426
|
-
export { collapseMindmapTree } from './mindmap/collapse';
|
|
427
|
-
export type { CollapsedMindmapResult } from './mindmap/collapse';
|
|
428
|
-
|
|
429
|
-
export { parseWireframe } from './wireframe/parser';
|
|
430
|
-
export type {
|
|
431
|
-
ParsedWireframe,
|
|
432
|
-
WireframeElement,
|
|
433
|
-
WireframeElementType,
|
|
434
|
-
WireframeFormFactor,
|
|
435
|
-
} from './wireframe/types';
|
|
436
|
-
export { layoutWireframe } from './wireframe/layout';
|
|
437
|
-
export type { WireframeLayout, WireframeLayoutNode } from './wireframe/layout';
|
|
438
|
-
export { renderWireframe } from './wireframe/renderer';
|
|
439
|
-
|
|
440
|
-
export { parseTechRadar } from './tech-radar/parser';
|
|
441
|
-
export { computeRadarLayout, getRadarGeometry } from './tech-radar/layout';
|
|
442
|
-
export {
|
|
443
|
-
renderTechRadar,
|
|
444
|
-
renderTechRadarForExport,
|
|
445
|
-
} from './tech-radar/renderer';
|
|
446
|
-
export {
|
|
447
|
-
renderQuadrantFocus,
|
|
448
|
-
renderQuadrantFocusForExport,
|
|
449
|
-
} from './tech-radar/interactive';
|
|
450
|
-
export type {
|
|
451
|
-
ParsedTechRadar,
|
|
452
|
-
TechRadarRing,
|
|
453
|
-
TechRadarQuadrant,
|
|
454
|
-
TechRadarBlip,
|
|
455
|
-
TechRadarLayoutPoint,
|
|
456
|
-
QuadrantPosition,
|
|
457
|
-
BlipTrend,
|
|
458
|
-
} from './tech-radar/types';
|
|
459
|
-
|
|
460
|
-
export { parseCycle } from './cycle/parser';
|
|
461
|
-
export { computeCycleLayout } from './cycle/layout';
|
|
462
|
-
export { renderCycle, renderCycleForExport } from './cycle/renderer';
|
|
463
|
-
export type { CycleRenderOptions } from './cycle/renderer';
|
|
464
|
-
export type {
|
|
465
|
-
ParsedCycle,
|
|
466
|
-
CycleNode,
|
|
467
|
-
CycleEdge,
|
|
468
|
-
CycleLayoutNode,
|
|
469
|
-
CycleLayoutEdge,
|
|
470
|
-
CycleLayoutResult,
|
|
471
|
-
} from './cycle/types';
|
|
472
|
-
|
|
473
|
-
export { parseJourneyMap } from './journey-map/parser';
|
|
474
|
-
export { layoutJourneyMap } from './journey-map/layout';
|
|
475
|
-
export type { JourneyMapLayout } from './journey-map/layout';
|
|
476
|
-
export {
|
|
477
|
-
renderJourneyMap,
|
|
478
|
-
renderJourneyMapForExport,
|
|
479
|
-
} from './journey-map/renderer';
|
|
480
|
-
export type {
|
|
481
|
-
ParsedJourneyMap,
|
|
482
|
-
JourneyMapPhase,
|
|
483
|
-
JourneyMapStep,
|
|
484
|
-
JourneyMapPersona,
|
|
485
|
-
JourneyMapAnnotation,
|
|
486
|
-
} from './journey-map/types';
|
|
487
|
-
export type { JourneyMapInteractiveOptions } from './journey-map/renderer';
|
|
488
|
-
|
|
489
|
-
export { parsePyramid } from './pyramid/parser';
|
|
490
|
-
export { renderPyramid, renderPyramidForExport } from './pyramid/renderer';
|
|
491
|
-
export type { ParsedPyramid, PyramidLayer } from './pyramid/types';
|
|
492
|
-
|
|
493
|
-
export { parseRing } from './ring/parser';
|
|
494
|
-
export { renderRing, renderRingForExport } from './ring/renderer';
|
|
495
|
-
export type { ParsedRing, RingLayer } from './ring/types';
|
|
496
|
-
|
|
497
|
-
export type { RaciDragSource, RaciInteractionHandlers } from './raci';
|
|
498
|
-
export {
|
|
499
|
-
parseRaci,
|
|
500
|
-
renderRaci,
|
|
501
|
-
renderRaciForExport,
|
|
502
|
-
VARIANTS as RACI_VARIANTS,
|
|
503
|
-
RACI_ERROR_CODES,
|
|
504
|
-
RACI_WARNING_CODES,
|
|
505
|
-
cellReplace as raciCellReplace,
|
|
506
|
-
cellAppendMarker as raciCellAppendMarker,
|
|
507
|
-
cellRemove as raciCellRemove,
|
|
508
|
-
cellCycle as raciCellCycle,
|
|
509
|
-
} from './raci';
|
|
510
|
-
export type {
|
|
511
|
-
ParsedRaci,
|
|
512
|
-
RaciVariant,
|
|
513
|
-
RaciMarker,
|
|
514
|
-
RaciTask,
|
|
515
|
-
RaciPhase,
|
|
516
|
-
RaciRoleAssignment,
|
|
517
|
-
} from './raci';
|
|
518
|
-
|
|
519
|
-
export { resolveOrgImports } from './org/resolver';
|
|
520
|
-
export type {
|
|
521
|
-
ReadFileFn,
|
|
522
|
-
ResolveImportsResult,
|
|
523
|
-
ImportSource,
|
|
524
|
-
} from './org/resolver';
|
|
525
|
-
|
|
526
|
-
export { layoutGraph } from './graph/layout';
|
|
527
|
-
export type {
|
|
528
|
-
LayoutResult,
|
|
529
|
-
LayoutNode,
|
|
530
|
-
LayoutEdge,
|
|
531
|
-
LayoutGroup,
|
|
532
|
-
LayoutOptions,
|
|
533
|
-
} from './graph/layout';
|
|
534
|
-
|
|
535
|
-
export {
|
|
536
|
-
renderFlowchart,
|
|
537
|
-
renderFlowchartForExport,
|
|
538
|
-
} from './graph/flowchart-renderer';
|
|
539
|
-
|
|
540
|
-
// ============================================================
|
|
541
|
-
// Config Builders (produce framework-specific config objects)
|
|
542
|
-
// ============================================================
|
|
543
|
-
|
|
544
|
-
export {
|
|
545
|
-
buildExtendedChartOption,
|
|
546
|
-
buildSimpleChartOption,
|
|
547
|
-
renderExtendedChartForExport,
|
|
548
|
-
getExtendedChartLegendGroups,
|
|
549
|
-
getSimpleChartLegendGroups,
|
|
550
|
-
computeScatterLabelGraphics,
|
|
551
|
-
} from './echarts';
|
|
552
|
-
export type { ScatterLabelPoint } from './echarts';
|
|
553
|
-
export {
|
|
554
|
-
renderLegendSvg,
|
|
555
|
-
renderLegendSvgFromConfig,
|
|
556
|
-
type LegendGroupData,
|
|
557
|
-
} from './utils/legend-svg';
|
|
558
|
-
export { LEGEND_HEIGHT, LEGEND_GEAR_PILL_W } from './utils/legend-constants';
|
|
559
|
-
export { renderLegendD3 } from './utils/legend-d3';
|
|
560
|
-
export {
|
|
561
|
-
computeLegendLayout,
|
|
562
|
-
controlsGroupCapsuleWidth,
|
|
563
|
-
getLegendReservedHeight,
|
|
564
|
-
} from './utils/legend-layout';
|
|
565
|
-
export type {
|
|
566
|
-
LegendConfig,
|
|
567
|
-
LegendState,
|
|
568
|
-
LegendCallbacks,
|
|
569
|
-
LegendPosition,
|
|
570
|
-
LegendMode,
|
|
571
|
-
LegendControl,
|
|
572
|
-
LegendLayout,
|
|
573
|
-
LegendHandle,
|
|
574
|
-
LegendPalette,
|
|
575
|
-
} from './utils/legend-types';
|
|
576
|
-
// ============================================================
|
|
577
|
-
// Renderers (produce SVG output)
|
|
578
|
-
// ============================================================
|
|
579
|
-
|
|
580
|
-
export {
|
|
581
|
-
renderSlopeChart,
|
|
582
|
-
renderArcDiagram,
|
|
583
|
-
renderTimeline,
|
|
584
|
-
renderWordCloud,
|
|
585
|
-
renderVenn,
|
|
586
|
-
renderQuadrant,
|
|
587
|
-
renderForExport,
|
|
588
|
-
} from './d3';
|
|
589
|
-
|
|
590
|
-
export {
|
|
591
|
-
renderSequenceDiagram,
|
|
592
|
-
buildRenderSequence,
|
|
593
|
-
computeActivations,
|
|
594
|
-
applyPositionOverrides,
|
|
595
|
-
applyGroupOrdering,
|
|
596
|
-
groupMessagesBySection,
|
|
597
|
-
buildNoteMessageMap,
|
|
598
|
-
} from './sequence/renderer';
|
|
599
|
-
export type {
|
|
600
|
-
RenderStep,
|
|
601
|
-
Activation,
|
|
602
|
-
SectionMessageGroup,
|
|
603
|
-
SequenceRenderOptions,
|
|
604
|
-
} from './sequence/renderer';
|
|
605
|
-
|
|
606
|
-
export { applyCollapseProjection } from './sequence/collapse';
|
|
607
|
-
export type { CollapsedView } from './sequence/collapse';
|
|
608
|
-
|
|
609
|
-
// ============================================================
|
|
610
|
-
// Colors & Palettes
|
|
611
|
-
// ============================================================
|
|
612
|
-
|
|
613
|
-
export {
|
|
614
|
-
resolveColor,
|
|
615
|
-
resolveColorWithDiagnostic,
|
|
616
|
-
colorNames,
|
|
617
|
-
nord,
|
|
618
|
-
seriesColors,
|
|
619
|
-
RECOGNIZED_COLOR_NAMES,
|
|
620
|
-
isRecognizedColorName,
|
|
621
|
-
} from './colors';
|
|
622
|
-
|
|
623
|
-
export {
|
|
624
|
-
// Registry
|
|
625
|
-
getPalette,
|
|
626
|
-
getAvailablePalettes,
|
|
627
|
-
registerPalette,
|
|
628
|
-
isValidHex,
|
|
629
|
-
// Utilities
|
|
630
|
-
hexToHSL,
|
|
631
|
-
hslToHex,
|
|
632
|
-
hexToHSLString,
|
|
633
|
-
tint,
|
|
634
|
-
shade,
|
|
635
|
-
getSeriesColors,
|
|
636
|
-
contrastText,
|
|
637
|
-
// Palette definitions
|
|
638
|
-
nordPalette,
|
|
639
|
-
solarizedPalette,
|
|
640
|
-
catppuccinPalette,
|
|
641
|
-
rosePinePalette,
|
|
642
|
-
gruvboxPalette,
|
|
643
|
-
tokyoNightPalette,
|
|
644
|
-
oneDarkPalette,
|
|
645
|
-
boldPalette,
|
|
646
|
-
draculaPalette,
|
|
647
|
-
monokaiPalette,
|
|
648
|
-
} from './palettes';
|
|
649
|
-
|
|
650
|
-
export type { PaletteConfig, PaletteColors } from './palettes';
|
|
651
|
-
export { mix, shapeFill } from './palettes/color-utils';
|
|
652
|
-
|
|
653
|
-
// ============================================================
|
|
654
|
-
// Sharing (URL encoding/decoding)
|
|
655
|
-
// ============================================================
|
|
656
|
-
|
|
657
|
-
export {
|
|
658
|
-
encodeDiagramUrl,
|
|
659
|
-
decodeDiagramUrl,
|
|
660
|
-
encodeViewState,
|
|
661
|
-
decodeViewState,
|
|
662
|
-
} from './sharing';
|
|
663
|
-
export type {
|
|
664
|
-
EncodeDiagramUrlOptions,
|
|
665
|
-
EncodeDiagramUrlResult,
|
|
666
|
-
CompactViewState,
|
|
667
|
-
DecodedDiagramUrl,
|
|
2
|
+
// @diagrammo/dgmo — Public API
|
|
3
|
+
// ============================================================
|
|
4
|
+
//
|
|
5
|
+
// This is the frozen public surface. ~12 exports. Everything else lives in
|
|
6
|
+
// `@diagrammo/dgmo/internal` (unstable, no semver), `@diagrammo/dgmo/editor`,
|
|
7
|
+
// `@diagrammo/dgmo/highlight`, or `@diagrammo/dgmo/auto`.
|
|
8
|
+
//
|
|
9
|
+
// If you need something not exported here, import from `/internal` and
|
|
10
|
+
// accept the no-semver contract.
|
|
11
|
+
|
|
12
|
+
import { render as renderInternal } from './render';
|
|
13
|
+
import {
|
|
14
|
+
encodeDiagramUrl as encodeDiagramUrlInternal,
|
|
15
|
+
decodeDiagramUrl as decodeDiagramUrlInternal,
|
|
16
|
+
type CompactViewState,
|
|
668
17
|
} from './sharing';
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
18
|
+
import { parseDgmo as validate } from './dgmo-router';
|
|
19
|
+
import { palettes, getPalette } from './palettes';
|
|
20
|
+
import type { PaletteConfig } from './palettes/types';
|
|
21
|
+
import type { Theme } from './themes';
|
|
22
|
+
import { formatDgmoError, type DgmoError } from './diagnostics';
|
|
23
|
+
|
|
24
|
+
export type { CompactViewState } from './sharing';
|
|
25
|
+
|
|
26
|
+
// ============================================================
|
|
27
|
+
// render(text, options?)
|
|
28
|
+
// ============================================================
|
|
29
|
+
|
|
30
|
+
export interface RenderOptions {
|
|
31
|
+
theme?: Theme;
|
|
32
|
+
palette?: PaletteConfig;
|
|
33
|
+
/**
|
|
34
|
+
* How to handle parse errors:
|
|
35
|
+
* 'svg' — render an inline error SVG (default)
|
|
36
|
+
* 'silent' — return empty svg + diagnostics; caller handles UI
|
|
37
|
+
* 'throw' — throw an Error with the diagnostics
|
|
38
|
+
*/
|
|
39
|
+
onError?: 'svg' | 'silent' | 'throw';
|
|
40
|
+
/**
|
|
41
|
+
* Pre-applied interactive view state — collapsed sections/columns,
|
|
42
|
+
* active swimlane tag-group, etc. Used to render a specific view
|
|
43
|
+
* non-interactively (server-side render, share-link decode).
|
|
44
|
+
*/
|
|
45
|
+
viewState?: CompactViewState;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface RenderResult {
|
|
49
|
+
svg: string;
|
|
50
|
+
diagnostics: DgmoError[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Render DGMO source to an SVG string.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { render, palettes, themes } from '@diagrammo/dgmo';
|
|
59
|
+
*
|
|
60
|
+
* const { svg } = await render(text, {
|
|
61
|
+
* palette: palettes.catppuccin,
|
|
62
|
+
* theme: themes.dark,
|
|
63
|
+
* });
|
|
64
|
+
* document.getElementById('chart').innerHTML = svg;
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export async function render(
|
|
68
|
+
text: string,
|
|
69
|
+
options?: RenderOptions
|
|
70
|
+
): Promise<RenderResult> {
|
|
71
|
+
const palette = options?.palette ?? palettes.nord;
|
|
72
|
+
const onError = options?.onError ?? 'svg';
|
|
73
|
+
|
|
74
|
+
const result = await renderInternal(text, {
|
|
75
|
+
theme: options?.theme,
|
|
76
|
+
palette: palette.id,
|
|
77
|
+
viewState: options?.viewState,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const errors = result.diagnostics.filter((d) => d.severity === 'error');
|
|
81
|
+
|
|
82
|
+
if (errors.length === 0) {
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (onError === 'throw') {
|
|
87
|
+
throw new Error(
|
|
88
|
+
`DGMO parse error: ${errors.map(formatDgmoError).join('; ')}`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (onError === 'silent') {
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 'svg' (default): render an inline error SVG so the user sees the problem
|
|
97
|
+
return {
|
|
98
|
+
svg: result.svg || renderErrorSvg(errors, palette, options?.theme),
|
|
99
|
+
diagnostics: result.diagnostics,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function renderErrorSvg(
|
|
104
|
+
errors: DgmoError[],
|
|
105
|
+
palette: PaletteConfig,
|
|
106
|
+
theme?: Theme
|
|
107
|
+
): string {
|
|
108
|
+
const colors = palette[theme === 'dark' ? 'dark' : 'light'];
|
|
109
|
+
const bg = theme === 'transparent' ? 'transparent' : colors.bg;
|
|
110
|
+
const fg = colors.destructive ?? colors.text;
|
|
111
|
+
const muted = colors.textMuted ?? colors.text;
|
|
112
|
+
const lines = errors.slice(0, 5).map((e) => formatDgmoError(e));
|
|
113
|
+
const height = 60 + lines.length * 20;
|
|
114
|
+
const body = lines
|
|
115
|
+
.map(
|
|
116
|
+
(line, i) =>
|
|
117
|
+
`<text x="20" y="${60 + i * 20}" fill="${fg}" font-family="ui-monospace, monospace" font-size="12">${escapeXml(line)}</text>`
|
|
118
|
+
)
|
|
119
|
+
.join('');
|
|
120
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="640" height="${height}" viewBox="0 0 640 ${height}"><rect width="100%" height="100%" fill="${bg}"/><text x="20" y="34" fill="${muted}" font-family="system-ui, sans-serif" font-size="13" font-weight="600">DGMO parse error</text>${body}</svg>`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function escapeXml(s: string): string {
|
|
124
|
+
return s
|
|
125
|
+
.replace(/&/g, '&')
|
|
126
|
+
.replace(/</g, '<')
|
|
127
|
+
.replace(/>/g, '>')
|
|
128
|
+
.replace(/"/g, '"');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ============================================================
|
|
132
|
+
// validate(text)
|
|
133
|
+
// ============================================================
|
|
134
|
+
|
|
135
|
+
export { validate };
|
|
136
|
+
|
|
137
|
+
// ============================================================
|
|
138
|
+
// formatDgmoError(err)
|
|
139
|
+
// ============================================================
|
|
140
|
+
|
|
141
|
+
export { formatDgmoError };
|
|
142
|
+
|
|
143
|
+
// ============================================================
|
|
144
|
+
// Sharing — encodeDiagramUrl / decodeDiagramUrl
|
|
145
|
+
// ============================================================
|
|
146
|
+
|
|
147
|
+
export interface EncodeDiagramUrlOptions {
|
|
148
|
+
baseUrl?: string;
|
|
149
|
+
palette?: PaletteConfig;
|
|
150
|
+
theme?: Theme;
|
|
151
|
+
filename?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Initial view state to embed in the URL — re-applied when the link is
|
|
154
|
+
* decoded so recipients open the diagram in the same configuration.
|
|
155
|
+
*/
|
|
156
|
+
viewState?: CompactViewState;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Encode DGMO text into a shareable URL. Returns null if the compressed
|
|
161
|
+
* payload exceeds the 8 KB URL limit.
|
|
162
|
+
*/
|
|
163
|
+
export function encodeDiagramUrl(
|
|
164
|
+
text: string,
|
|
165
|
+
options?: EncodeDiagramUrlOptions
|
|
166
|
+
): string | null {
|
|
167
|
+
const internalTheme =
|
|
168
|
+
options?.theme === 'light' || options?.theme === 'dark'
|
|
169
|
+
? options.theme
|
|
170
|
+
: undefined;
|
|
171
|
+
const result = encodeDiagramUrlInternal(text, {
|
|
172
|
+
baseUrl: options?.baseUrl,
|
|
173
|
+
palette: options?.palette?.id,
|
|
174
|
+
theme: internalTheme,
|
|
175
|
+
filename: options?.filename,
|
|
176
|
+
viewState: options?.viewState,
|
|
177
|
+
});
|
|
178
|
+
return 'error' in result && result.error ? null : (result.url ?? null);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface DecodedDiagramUrl {
|
|
182
|
+
text: string;
|
|
183
|
+
palette?: PaletteConfig;
|
|
184
|
+
theme?: Theme;
|
|
185
|
+
filename?: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Decode a share URL back into DGMO text plus optional palette/theme/filename.
|
|
190
|
+
* Returns null if the URL contains no valid DGMO payload.
|
|
191
|
+
*/
|
|
192
|
+
export function decodeDiagramUrl(url: string): DecodedDiagramUrl | null {
|
|
193
|
+
const decoded = decodeDiagramUrlInternal(url);
|
|
194
|
+
if (!decoded.dsl) return null;
|
|
195
|
+
const palette = decoded.palette ? getPalette(decoded.palette) : undefined;
|
|
196
|
+
const out: DecodedDiagramUrl = { text: decoded.dsl };
|
|
197
|
+
if (palette) out.palette = palette;
|
|
198
|
+
if (decoded.theme) out.theme = decoded.theme;
|
|
199
|
+
if (decoded.filename) out.filename = decoded.filename;
|
|
200
|
+
return out;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// ============================================================
|
|
204
|
+
// Palettes + themes (namespaces)
|
|
205
|
+
// ============================================================
|
|
206
|
+
|
|
207
|
+
export { palettes, getPalette } from './palettes';
|
|
208
|
+
export { themes, type Theme } from './themes';
|
|
209
|
+
|
|
210
|
+
// ============================================================
|
|
211
|
+
// Public types
|
|
212
|
+
// ============================================================
|
|
213
|
+
|
|
214
|
+
export type { PaletteConfig, PaletteColors } from './palettes/types';
|
|
215
|
+
export type { DgmoError, DgmoSeverity } from './diagnostics';
|