archimaid 0.0.0-stage → 0.1.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/CHANGELOG.md +32 -0
- package/FOUNDATION.md +108 -0
- package/LICENSE +21 -0
- package/README.md +271 -2
- package/dist/archimate/catalogue.d.ts +106 -0
- package/dist/archimate/catalogue.js +219 -0
- package/dist/archimate/catalogue.js.map +1 -0
- package/dist/archimate/diagnostics.d.ts +48 -0
- package/dist/archimate/diagnostics.js +64 -0
- package/dist/archimate/diagnostics.js.map +1 -0
- package/dist/archimate/frontmatter.d.ts +13 -0
- package/dist/archimate/frontmatter.js +62 -0
- package/dist/archimate/frontmatter.js.map +1 -0
- package/dist/archimate/grammar.d.ts +60 -0
- package/dist/archimate/grammar.js +273 -0
- package/dist/archimate/grammar.js.map +1 -0
- package/dist/archimate/lexer.d.ts +91 -0
- package/dist/archimate/lexer.js +215 -0
- package/dist/archimate/lexer.js.map +1 -0
- package/dist/archimate/model.d.ts +46 -0
- package/dist/archimate/model.js +2 -0
- package/dist/archimate/model.js.map +1 -0
- package/dist/archimate/nesting.d.ts +14 -0
- package/dist/archimate/nesting.js +84 -0
- package/dist/archimate/nesting.js.map +1 -0
- package/dist/archimate/parser.d.ts +14 -0
- package/dist/archimate/parser.js +53 -0
- package/dist/archimate/parser.js.map +1 -0
- package/dist/archimate/suggestions.d.ts +1 -0
- package/dist/archimate/suggestions.js +44 -0
- package/dist/archimate/suggestions.js.map +1 -0
- package/dist/archimate/validate.d.ts +4 -0
- package/dist/archimate/validate.js +402 -0
- package/dist/archimate/validate.js.map +1 -0
- package/dist/bundle/archimaid.esm.min.mjs +1 -0
- package/dist/bundle/chunks/archimateDiagram-WUCF6KHR.mjs +132 -0
- package/dist/bundle/chunks/chunk-QBMRZFD3.mjs +1 -0
- package/dist/bundle/chunks/elk.bundled-2VSLVJGB.mjs +26 -0
- package/dist/cli/render.d.ts +10 -0
- package/dist/cli/render.js +102 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/report.d.ts +20 -0
- package/dist/cli/report.js +39 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/sources.d.ts +19 -0
- package/dist/cli/sources.js +86 -0
- package/dist/cli/sources.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +137 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/language.d.ts +5 -0
- package/dist/language.js +3 -0
- package/dist/language.js.map +1 -0
- package/dist/mermaid/archimateDetector.d.ts +12 -0
- package/dist/mermaid/archimateDetector.js +29 -0
- package/dist/mermaid/archimateDetector.js.map +1 -0
- package/dist/mermaid/archimateDiagram.d.ts +9 -0
- package/dist/mermaid/archimateDiagram.js +75 -0
- package/dist/mermaid/archimateDiagram.js.map +1 -0
- package/dist/mermaid/archimateRenderer.d.ts +6 -0
- package/dist/mermaid/archimateRenderer.js +40 -0
- package/dist/mermaid/archimateRenderer.js.map +1 -0
- package/dist/mermaid/architectureLayout.d.ts +50 -0
- package/dist/mermaid/architectureLayout.js +144 -0
- package/dist/mermaid/architectureLayout.js.map +1 -0
- package/dist/mermaid/geometry.d.ts +3 -0
- package/dist/mermaid/geometry.js +20 -0
- package/dist/mermaid/geometry.js.map +1 -0
- package/dist/mermaid/hierarchy.d.ts +1 -0
- package/dist/mermaid/hierarchy.js +8 -0
- package/dist/mermaid/hierarchy.js.map +1 -0
- package/dist/mermaid/invariant.d.ts +1 -0
- package/dist/mermaid/invariant.js +7 -0
- package/dist/mermaid/invariant.js.map +1 -0
- package/dist/mermaid/orthogonalRouter.d.ts +4 -0
- package/dist/mermaid/orthogonalRouter.js +249 -0
- package/dist/mermaid/orthogonalRouter.js.map +1 -0
- package/dist/mermaid/relationshipPlacement.d.ts +3 -0
- package/dist/mermaid/relationshipPlacement.js +350 -0
- package/dist/mermaid/relationshipPlacement.js.map +1 -0
- package/dist/mermaid/render/draw.d.ts +17 -0
- package/dist/mermaid/render/draw.js +275 -0
- package/dist/mermaid/render/draw.js.map +1 -0
- package/dist/mermaid/render/elkRoutes.d.ts +6 -0
- package/dist/mermaid/render/elkRoutes.js +216 -0
- package/dist/mermaid/render/elkRoutes.js.map +1 -0
- package/dist/mermaid/render/graph.d.ts +17 -0
- package/dist/mermaid/render/graph.js +200 -0
- package/dist/mermaid/render/graph.js.map +1 -0
- package/dist/mermaid/render/labels.d.ts +12 -0
- package/dist/mermaid/render/labels.js +148 -0
- package/dist/mermaid/render/labels.js.map +1 -0
- package/dist/mermaid/render/layout.d.ts +12 -0
- package/dist/mermaid/render/layout.js +60 -0
- package/dist/mermaid/render/layout.js.map +1 -0
- package/dist/mermaid/render/measure.d.ts +16 -0
- package/dist/mermaid/render/measure.js +96 -0
- package/dist/mermaid/render/measure.js.map +1 -0
- package/dist/mermaid/render/place.d.ts +20 -0
- package/dist/mermaid/render/place.js +63 -0
- package/dist/mermaid/render/place.js.map +1 -0
- package/dist/mermaid/render/route.d.ts +29 -0
- package/dist/mermaid/render/route.js +113 -0
- package/dist/mermaid/render/route.js.map +1 -0
- package/dist/mermaid/render/shared.d.ts +83 -0
- package/dist/mermaid/render/shared.js +52 -0
- package/dist/mermaid/render/shared.js.map +1 -0
- package/dist/mermaid/render/svg.d.ts +6 -0
- package/dist/mermaid/render/svg.js +33 -0
- package/dist/mermaid/render/svg.js.map +1 -0
- package/dist/mermaid/render/viewport.d.ts +14 -0
- package/dist/mermaid/render/viewport.js +58 -0
- package/dist/mermaid/render/viewport.js.map +1 -0
- package/dist/mermaid/routing/anchors.d.ts +14 -0
- package/dist/mermaid/routing/anchors.js +134 -0
- package/dist/mermaid/routing/anchors.js.map +1 -0
- package/dist/mermaid/routing/bundles.d.ts +14 -0
- package/dist/mermaid/routing/bundles.js +94 -0
- package/dist/mermaid/routing/bundles.js.map +1 -0
- package/dist/mermaid/routing/congestion.d.ts +8 -0
- package/dist/mermaid/routing/congestion.js +70 -0
- package/dist/mermaid/routing/congestion.js.map +1 -0
- package/dist/mermaid/routing/constants.d.ts +13 -0
- package/dist/mermaid/routing/constants.js +17 -0
- package/dist/mermaid/routing/constants.js.map +1 -0
- package/dist/mermaid/routing/primitives.d.ts +33 -0
- package/dist/mermaid/routing/primitives.js +110 -0
- package/dist/mermaid/routing/primitives.js.map +1 -0
- package/dist/mermaid/routing/search.d.ts +4 -0
- package/dist/mermaid/routing/search.js +171 -0
- package/dist/mermaid/routing/search.js.map +1 -0
- package/dist/mermaid/routing/shapes.d.ts +8 -0
- package/dist/mermaid/routing/shapes.js +82 -0
- package/dist/mermaid/routing/shapes.js.map +1 -0
- package/dist/mermaid/routing/types.d.ts +37 -0
- package/dist/mermaid/routing/types.js +14 -0
- package/dist/mermaid/routing/types.js.map +1 -0
- package/dist/mermaid/styles.d.ts +89 -0
- package/dist/mermaid/styles.js +166 -0
- package/dist/mermaid/styles.js.map +1 -0
- package/docs/reference.md +86 -0
- package/examples/cross-layer-relationships.mmd +79 -0
- package/examples/cross-layer-relationships.svg +33 -0
- package/examples/element-preview.svg +1 -0
- package/examples/nested-components.mmd +21 -0
- package/examples/nested-components.svg +4 -0
- package/examples/order-fulfilment.mmd +10 -0
- package/examples/order-management.mmd +15 -0
- package/examples/order-management.svg +2 -0
- package/package.json +91 -4
- package/skills/archimaid/SKILL.md +123 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { parseArchiMate } from '../archimate/parser.js';
|
|
2
|
+
import { renderArchiMate } from './archimateRenderer.js';
|
|
3
|
+
import { archimatePalettes, archimateStyles } from './styles.js';
|
|
4
|
+
// The markers Mermaid wraps around the name or number of a #name; or #123; sequence.
|
|
5
|
+
const mermaidEntityMarker = /fl°°?(\w+)¶ß/gu;
|
|
6
|
+
export function toLogger(log) {
|
|
7
|
+
if (typeof log !== 'object' || log === null || !('warn' in log))
|
|
8
|
+
return undefined;
|
|
9
|
+
const { warn } = log;
|
|
10
|
+
return typeof warn === 'function'
|
|
11
|
+
? {
|
|
12
|
+
warn: (message) => {
|
|
13
|
+
warn.call(log, message);
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
: undefined;
|
|
17
|
+
}
|
|
18
|
+
export function createArchimateDiagram(options) {
|
|
19
|
+
if (!Object.hasOwn(archimatePalettes, options.palette)) {
|
|
20
|
+
throw new RangeError(`Unknown ArchiMate palette "${options.palette}".`);
|
|
21
|
+
}
|
|
22
|
+
let model;
|
|
23
|
+
let diagramTitle;
|
|
24
|
+
let frontmatterLineOffset = 0;
|
|
25
|
+
let getConfig;
|
|
26
|
+
let logger;
|
|
27
|
+
return {
|
|
28
|
+
db: {
|
|
29
|
+
preserveCommentsWhenParsing: true,
|
|
30
|
+
setFrontmatterLineOffset(offset) {
|
|
31
|
+
frontmatterLineOffset = offset;
|
|
32
|
+
},
|
|
33
|
+
clear() {
|
|
34
|
+
model = undefined;
|
|
35
|
+
diagramTitle = undefined;
|
|
36
|
+
frontmatterLineOffset = 0;
|
|
37
|
+
},
|
|
38
|
+
setDiagramTitle(title) {
|
|
39
|
+
diagramTitle = title;
|
|
40
|
+
},
|
|
41
|
+
getDiagramTitle() {
|
|
42
|
+
return model?.title ?? diagramTitle ?? '';
|
|
43
|
+
},
|
|
44
|
+
getAccTitle() {
|
|
45
|
+
return model?.accTitle ?? model?.title ?? diagramTitle ?? '';
|
|
46
|
+
},
|
|
47
|
+
getAccDescription() {
|
|
48
|
+
return model?.accDescription ?? '';
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
parser: {
|
|
52
|
+
parse(source) {
|
|
53
|
+
model = undefined;
|
|
54
|
+
// Mermaid encodes #name; and #123; before dispatch. Quoted ArchiMate
|
|
55
|
+
// text treats these sequences literally, so restore them before parsing.
|
|
56
|
+
const literalSource = source.replace(mermaidEntityMarker, '#$1;');
|
|
57
|
+
model = parseArchiMate(literalSource, { lineOffset: frontmatterLineOffset });
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
renderer: {
|
|
61
|
+
async draw(_text, id, _version, diagram) {
|
|
62
|
+
if (!model) {
|
|
63
|
+
throw new Error('Parse an ArchiMate diagram before rendering it.');
|
|
64
|
+
}
|
|
65
|
+
await renderArchiMate(model, id, diagram.db.getDiagramTitle?.() ?? '', options, getConfig?.(), logger);
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
styles: archimateStyles,
|
|
69
|
+
injectUtils(log, _setLogLevel, readConfig) {
|
|
70
|
+
logger = toLogger(log);
|
|
71
|
+
getConfig = readConfig;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=archimateDiagram.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archimateDiagram.js","sourceRoot":"","sources":["../../src/mermaid/archimateDiagram.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAIjE,qFAAqF;AACrF,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAM5C,MAAM,UAAU,QAAQ,CAAC,GAAY;IACnC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAClF,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IACrB,OAAO,OAAO,IAAI,KAAK,UAAU;QAC/B,CAAC,CAAC;YACE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;gBAChB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC1B,CAAC;SACF;QACH,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAyC;IAC9E,IAAI,CAAC,MAAM,CAAC,M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,QAAQ,EAAE,OAAO;gBACrC,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;gBACrE,CAAC;gBAED,MAAM,eAAe,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;YACzG,CAAC;SACF;QACD,MAAM,EAAE,eAAe;QACvB,WAAW,CAAC,GAAY,EAAE,YAAY,EAAE,UAA+B;YACrE,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;YACvB,SAAS,GAAG,UAAU,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { ExternalDiagramDefinition, MermaidConfig } from 'mermaid';\nimport type { ArchiMateModel } from '../archimate/model.js';\nimport { parseArchiMate } from '../archimate/parser.js';\nimport type { ArchiMatePluginOptions } from './archimateDetector.js';\nimport { renderArchiMate } from './archimateRenderer.js';\nimport { archimatePalettes, archimateStyles } from './styles.js';\n\ntype DiagramDefinition = Awaited<ReturnType<ExternalDiagramDefinition['loader']>>['diagram'];\n\n// The markers Mermaid wraps around the name or number of a #name; or #123; sequence.\nconst mermaidEntityMarker = /fl°°?(\\w+)¶ß/gu;\n\nexport interface ArchiMateLogger {\n readonly warn: (message: string) => void;\n}\n\nexport function toLogger(log: unknown): ArchiMateLogger | undefined {\n if (typeof log !== 'object' || log === null || !('warn' in log)) return undefined;\n const { warn } = log;\n return typeof warn === 'function'\n ? {\n warn: (message) => {\n warn.call(log, message);\n },\n }\n : undefined;\n}\n\nexport function createArchimateDiagram(options: Required<ArchiMatePluginOptions>): DiagramDefinition {\n if (!Object.hasOwn(archimatePalettes, options.palette)) {\n throw new RangeError(`Unknown ArchiMate palette \"${options.palette}\".`);\n }\n let model: ArchiMateModel | undefined;\n let diagramTitle: string | undefined;\n let frontmatterLineOffset = 0;\n let getConfig: (() => MermaidConfig) | undefined;\n let logger: ArchiMateLogger | undefined;\n\n return {\n db: {\n preserveCommentsWhenParsing: true,\n setFrontmatterLineOffset(offset) {\n frontmatterLineOffset = offset;\n },\n clear() {\n model = undefined;\n diagramTitle = undefined;\n frontmatterLineOffset = 0;\n },\n setDiagramTitle(title) {\n diagramTitle = title;\n },\n getDiagramTitle() {\n return model?.title ?? diagramTitle ?? '';\n },\n getAccTitle() {\n return model?.accTitle ?? model?.title ?? diagramTitle ?? '';\n },\n getAccDescription() {\n return model?.accDescription ?? '';\n },\n },\n parser: {\n parse(source) {\n model = undefined;\n // Mermaid encodes #name; and #123; before dispatch. Quoted ArchiMate\n // text treats these sequences literally, so restore them before parsing.\n const literalSource = source.replace(mermaidEntityMarker, '#$1;');\n model = parseArchiMate(literalSource, { lineOffset: frontmatterLineOffset });\n },\n },\n renderer: {\n async draw(_text, id, _version, diagram) {\n if (!model) {\n throw new Error('Parse an ArchiMate diagram before rendering it.');\n }\n\n await renderArchiMate(model, id, diagram.db.getDiagramTitle?.() ?? '', options, getConfig?.(), logger);\n },\n },\n styles: archimateStyles,\n injectUtils(log: unknown, _setLogLevel, readConfig: () => MermaidConfig) {\n logger = toLogger(log);\n getConfig = readConfig;\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MermaidConfig } from 'mermaid';
|
|
2
|
+
import type { ArchiMateModel } from '../archimate/model.js';
|
|
3
|
+
import type { ArchiMatePluginOptions } from './archimateDetector.js';
|
|
4
|
+
import type { ArchiMateLogger } from './archimateDiagram.js';
|
|
5
|
+
export { resolveElkConstructor } from './render/layout.js';
|
|
6
|
+
export declare function renderArchiMate(model: ArchiMateModel, id: string, title: string, options: Required<ArchiMatePluginOptions>, config?: MermaidConfig, logger?: ArchiMateLogger): Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { drawDiagram } from './render/draw.js';
|
|
2
|
+
import { buildLayoutGraph } from './render/graph.js';
|
|
3
|
+
import { placeLabels } from './render/labels.js';
|
|
4
|
+
import { layoutDiagram } from './render/layout.js';
|
|
5
|
+
import { measureDiagram } from './render/measure.js';
|
|
6
|
+
import { placeDiagram } from './render/place.js';
|
|
7
|
+
import { routeDiagram } from './render/route.js';
|
|
8
|
+
import { usesArchitectureLayout } from './render/shared.js';
|
|
9
|
+
import { browserColour, getSvg } from './render/svg.js';
|
|
10
|
+
import { applyViewport, computeViewport } from './render/viewport.js';
|
|
11
|
+
import { archimatePalettes, resolveDiagramColours, resolveTypography } from './styles.js';
|
|
12
|
+
export { resolveElkConstructor } from './render/layout.js';
|
|
13
|
+
export async function renderArchiMate(model, id, title, options, config, logger) {
|
|
14
|
+
const svg = getSvg(id, config);
|
|
15
|
+
const colours = resolveDiagramColours(config, (colour) => browserColour(svg, colour), logger &&
|
|
16
|
+
((message) => {
|
|
17
|
+
logger.warn(message);
|
|
18
|
+
}));
|
|
19
|
+
const typography = resolveTypography(config?.theme, config?.themeVariables);
|
|
20
|
+
const parents = new Map(model.nesting?.map(({ child, parent }) => [child, parent]));
|
|
21
|
+
const measured = measureDiagram(svg, model, title, typography);
|
|
22
|
+
const graph = buildLayoutGraph(model, measured, parents);
|
|
23
|
+
const layout = await layoutDiagram(model, graph, options.maxRowWidth);
|
|
24
|
+
const placement = placeDiagram(model, layout.root, graph);
|
|
25
|
+
const routed = routeDiagram({ model, graph, layout, placement, parents, logger });
|
|
26
|
+
const edges = placeLabels(routed, placement, usesArchitectureLayout(model));
|
|
27
|
+
const viewport = computeViewport(layout, edges, measured.title, options.diagramPadding);
|
|
28
|
+
drawDiagram(svg, {
|
|
29
|
+
id,
|
|
30
|
+
viewport,
|
|
31
|
+
placement,
|
|
32
|
+
edges,
|
|
33
|
+
title: measured.title,
|
|
34
|
+
palette: archimatePalettes[options.palette],
|
|
35
|
+
colours,
|
|
36
|
+
background: options.background,
|
|
37
|
+
});
|
|
38
|
+
applyViewport(svg, viewport, options.useMaxWidth);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=archimateRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archimateRenderer.js","sourceRoot":"","sources":["../../src/mermaid/archimateRenderer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAqB,EACrB,EAAU,EACV,KAAa,EACb,OAAyC,EACzC,MAAsB,EACtB,MAAwB;IAExB,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,OAAO,GAAG,qBAAqB,CACnC,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,EACtC,MAAM;QACJ,CAAC,CAAC,OAAO,EAAE,EAAE;YACX,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC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ACH,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { MermaidConfig } from 'mermaid';\nimport type { ArchiMateModel } from '../archimate/model.js';\nimport type { ArchiMatePluginOptions } from './archimateDetector.js';\nimport type { ArchiMateLogger } from './archimateDiagram.js';\nimport { drawDiagram } from './render/draw.js';\nimport { buildLayoutGraph } from './render/graph.js';\nimport { placeLabels } from './render/labels.js';\nimport { layoutDiagram } from './render/layout.js';\nimport { measureDiagram } from './render/measure.js';\nimport { placeDiagram } from './render/place.js';\nimport { routeDiagram } from './render/route.js';\nimport { usesArchitectureLayout } from './render/shared.js';\nimport { browserColour, getSvg } from './render/svg.js';\nimport { applyViewport, computeViewport } from './render/viewport.js';\nimport { archimatePalettes, resolveDiagramColours, resolveTypography } from './styles.js';\n\nexport { resolveElkConstructor } from './render/layout.js';\n\nexport async function renderArchiMate(\n model: ArchiMateModel,\n id: string,\n title: string,\n options: Required<ArchiMatePluginOptions>,\n config?: MermaidConfig,\n logger?: ArchiMateLogger,\n): Promise<void> {\n const svg = getSvg(id, config);\n const colours = resolveDiagramColours(\n config,\n (colour) => browserColour(svg, colour),\n logger &&\n ((message) => {\n logger.warn(message);\n }),\n );\n const typography = resolveTypography(config?.theme, config?.themeVariables);\n const parents = new Map(model.nesting?.map(({ child, parent }) => [child, parent]));\n const measured = measureDiagram(svg, model, title, typography);\n const graph = buildLayoutGraph(model, measured, parents);\n const layout = await layoutDiagram(model, graph, options.maxRowWidth);\n const placement = placeDiagram(model, layout.root, graph);\n const routed = routeDiagram({ model, graph, layout, placement, parents, logger });\n const edges = placeLabels(routed, placement, usesArchitectureLayout(model));\n const viewport = computeViewport(layout, edges, measured.title, options.diagramPadding);\n drawDiagram(svg, {\n id,\n viewport,\n placement,\n edges,\n title: measured.title,\n palette: archimatePalettes[options.palette],\n colours,\n background: options.background,\n });\n applyViewport(svg, viewport, options.useMaxWidth);\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface MeasuredNode {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly width: number;
|
|
4
|
+
readonly height: number;
|
|
5
|
+
readonly children?: readonly MeasuredNode[];
|
|
6
|
+
}
|
|
7
|
+
export interface Point {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}
|
|
11
|
+
export interface Box extends Point {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PlacedNode extends Box {
|
|
16
|
+
id: string;
|
|
17
|
+
children?: PlacedNode[];
|
|
18
|
+
}
|
|
19
|
+
export interface Placement {
|
|
20
|
+
readonly row: string | null;
|
|
21
|
+
readonly column: Column;
|
|
22
|
+
readonly headerHeight: number;
|
|
23
|
+
}
|
|
24
|
+
export interface LayoutRelationship {
|
|
25
|
+
readonly source: string;
|
|
26
|
+
readonly target: string;
|
|
27
|
+
readonly type: string;
|
|
28
|
+
}
|
|
29
|
+
declare const columns: readonly ["passiveStructure", "behavior", "activeStructure"];
|
|
30
|
+
type Column = (typeof columns)[number] | null;
|
|
31
|
+
interface Cell {
|
|
32
|
+
row: string;
|
|
33
|
+
column: Column;
|
|
34
|
+
}
|
|
35
|
+
export interface SizedNode extends Cell {
|
|
36
|
+
node: PlacedNode;
|
|
37
|
+
}
|
|
38
|
+
export interface Arrangement {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
children: PlacedNode[];
|
|
42
|
+
}
|
|
43
|
+
export declare function placeArchitecture(nodes: readonly MeasuredNode[], placements: ReadonlyMap<string, Placement>, relationships: readonly LayoutRelationship[], { rowOrder, padding, labelHeight, framework, maxRowWidth, }: {
|
|
44
|
+
rowOrder: readonly string[];
|
|
45
|
+
padding: number;
|
|
46
|
+
labelHeight: number;
|
|
47
|
+
framework?: boolean;
|
|
48
|
+
maxRowWidth: number;
|
|
49
|
+
}): Arrangement;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { placeConnectedLayers, sequence } from './relationshipPlacement.js';
|
|
2
|
+
const columns = ['passiveStructure', 'behavior', 'activeStructure'];
|
|
3
|
+
const nodeGap = 46;
|
|
4
|
+
const cellGap = 72;
|
|
5
|
+
function extent(nodes, dimension) {
|
|
6
|
+
return nodes.reduce((maximum, node) => Math.max(maximum, node[dimension]), 0);
|
|
7
|
+
}
|
|
8
|
+
function stack(nodes, horizontal, gap) {
|
|
9
|
+
const crossSize = extent(nodes, horizontal ? 'height' : 'width');
|
|
10
|
+
let offset = 0;
|
|
11
|
+
for (const node of nodes) {
|
|
12
|
+
node.x = horizontal ? offset : (crossSize - node.width) / 2;
|
|
13
|
+
node.y = horizontal ? (crossSize - node.height) / 2 : offset;
|
|
14
|
+
offset += (horizontal ? node.width : node.height) + gap;
|
|
15
|
+
}
|
|
16
|
+
const size = Math.max(0, offset - gap);
|
|
17
|
+
return {
|
|
18
|
+
width: horizontal ? size : crossSize,
|
|
19
|
+
height: horizontal ? crossSize : size,
|
|
20
|
+
children: [...nodes],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function grid(nodes, rows, gap) {
|
|
24
|
+
const widths = new Map();
|
|
25
|
+
const stacks = new Map();
|
|
26
|
+
for (const row of [...rows, 'motivation']) {
|
|
27
|
+
const cells = new Map();
|
|
28
|
+
for (const column of [...columns, null]) {
|
|
29
|
+
const members = nodes.filter((node) => node.row === row && node.column === column);
|
|
30
|
+
if (members.length === 0)
|
|
31
|
+
continue;
|
|
32
|
+
const arrangement = stack(members.map(({ node }) => node), false, gap);
|
|
33
|
+
cells.set(column, arrangement);
|
|
34
|
+
if (row !== 'motivation')
|
|
35
|
+
widths.set(column, Math.max(widths.get(column) ?? 0, arrangement.width));
|
|
36
|
+
}
|
|
37
|
+
stacks.set(row, cells);
|
|
38
|
+
}
|
|
39
|
+
const offsets = new Map();
|
|
40
|
+
let width = 0;
|
|
41
|
+
for (const column of columns) {
|
|
42
|
+
const size = widths.get(column);
|
|
43
|
+
if (size === undefined)
|
|
44
|
+
continue;
|
|
45
|
+
offsets.set(column, width);
|
|
46
|
+
width += size + cellGap;
|
|
47
|
+
}
|
|
48
|
+
width = Math.max(0, width - cellGap, widths.get(null) ?? 0);
|
|
49
|
+
let height = 0;
|
|
50
|
+
for (const row of rows) {
|
|
51
|
+
const cells = stacks.get(row);
|
|
52
|
+
if (!cells?.size)
|
|
53
|
+
continue;
|
|
54
|
+
let rowHeight = 0;
|
|
55
|
+
for (const [column, offset] of offsets) {
|
|
56
|
+
const cell = cells.get(column);
|
|
57
|
+
if (!cell)
|
|
58
|
+
continue;
|
|
59
|
+
const left = offset + ((widths.get(column) ?? 0) - cell.width) / 2;
|
|
60
|
+
for (const node of cell.children) {
|
|
61
|
+
node.x += left;
|
|
62
|
+
node.y += height;
|
|
63
|
+
}
|
|
64
|
+
rowHeight = Math.max(rowHeight, cell.height);
|
|
65
|
+
}
|
|
66
|
+
const neutral = cells.get(null);
|
|
67
|
+
if (neutral) {
|
|
68
|
+
if (rowHeight)
|
|
69
|
+
rowHeight += gap;
|
|
70
|
+
for (const node of neutral.children)
|
|
71
|
+
node.y += height + rowHeight;
|
|
72
|
+
rowHeight += neutral.height;
|
|
73
|
+
}
|
|
74
|
+
height += rowHeight + cellGap;
|
|
75
|
+
}
|
|
76
|
+
height = Math.max(0, height - cellGap);
|
|
77
|
+
const motivation = stacks.get('motivation')?.get(null);
|
|
78
|
+
if (motivation) {
|
|
79
|
+
const offset = width > 0 ? width + cellGap : 0;
|
|
80
|
+
for (const node of motivation.children)
|
|
81
|
+
node.x += offset;
|
|
82
|
+
width = offset + motivation.width;
|
|
83
|
+
height = Math.max(height, motivation.height);
|
|
84
|
+
}
|
|
85
|
+
return { width, height, children: nodes.map(({ node }) => node) };
|
|
86
|
+
}
|
|
87
|
+
function classify(placement, children) {
|
|
88
|
+
if (placement?.row)
|
|
89
|
+
return { row: placement.row, column: placement.column };
|
|
90
|
+
const first = children[0];
|
|
91
|
+
if (!first || children.some(({ row }) => row !== first.row))
|
|
92
|
+
return { row: 'neutral', column: null };
|
|
93
|
+
return {
|
|
94
|
+
row: first.row,
|
|
95
|
+
column: children.every(({ column }) => column === first.column) ? first.column : null,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function placeArchitecture(nodes, placements, relationships, { rowOrder, padding, labelHeight, framework = false, maxRowWidth, }) {
|
|
99
|
+
const successors = new Map();
|
|
100
|
+
for (const { source, target, type } of relationships) {
|
|
101
|
+
if (type !== 'triggering' && type !== 'flow')
|
|
102
|
+
continue;
|
|
103
|
+
const existing = successors.get(source);
|
|
104
|
+
if (existing)
|
|
105
|
+
existing.push(target);
|
|
106
|
+
else
|
|
107
|
+
successors.set(source, [target]);
|
|
108
|
+
}
|
|
109
|
+
const rows = [...rowOrder, 'neutral'];
|
|
110
|
+
const gap = Math.max(nodeGap, labelHeight + 16);
|
|
111
|
+
const arrange = (members) => framework
|
|
112
|
+
? grid(members, rows, gap)
|
|
113
|
+
: placeConnectedLayers(members, ['motivation', ...rows], relationships, gap, cellGap, maxRowWidth);
|
|
114
|
+
function size(node) {
|
|
115
|
+
const placement = placements.get(node.id);
|
|
116
|
+
const children = (node.children ?? []).map(size);
|
|
117
|
+
const cell = classify(placement, children);
|
|
118
|
+
const measured = { id: node.id, width: node.width, height: node.height, x: 0, y: 0 };
|
|
119
|
+
if (!children.length)
|
|
120
|
+
return { ...cell, node: measured };
|
|
121
|
+
const local = placement?.column === 'behavior' ? stack(sequence(children, successors), true, gap) : arrange(children);
|
|
122
|
+
const header = placement?.headerHeight ?? node.height;
|
|
123
|
+
const width = Math.max(node.width, local.width + 2 * padding);
|
|
124
|
+
const height = Math.max(node.height, header + local.height + 2 * padding);
|
|
125
|
+
for (const child of local.children) {
|
|
126
|
+
child.x += (width - local.width) / 2;
|
|
127
|
+
child.y += header + padding;
|
|
128
|
+
}
|
|
129
|
+
// Keep the SVG traversal in declaration order even when flow changed placement order.
|
|
130
|
+
return { ...cell, node: { ...measured, width, height, children: children.map(({ node }) => node) } };
|
|
131
|
+
}
|
|
132
|
+
const arranged = arrange(nodes.map(size));
|
|
133
|
+
function translate(children, x, y) {
|
|
134
|
+
for (const child of children) {
|
|
135
|
+
child.x += x;
|
|
136
|
+
child.y += y;
|
|
137
|
+
if (child.children)
|
|
138
|
+
translate(child.children, child.x, child.y);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
translate(arranged.children, padding, padding);
|
|
142
|
+
return { ...arranged, width: arranged.width + 2 * padding, height: arranged.height + 2 * padding };
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=architectureLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architectureLayout.js","sourceRoot":"","sources":["../../src/mermaid/architectureLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAoC5E,MAAM,OAAO,GAAG,CAAC,kBAAkB,EAAE,UAAU,EAAE,iBAAiB,CAAU,CAAC;AAkB7E,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,OAAO,GAAG,EAAE,CAAC;AAEnB,SAAS,MAAM,CAAC,KAA4B,EAAE,SAA6B;IACzE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,KAAK,CAAC,KAA4B,EAAE,UAAmB,EAAE,GAAW;IAC3E,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACjE,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI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AAI,CAAC,EAAE,EAAE,CAAC;IACvG,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,SAAS,SAAS,CAAC,QAA+B,EAAE,CAAS,EAAE,CAAS;QACtE,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;YACb,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;YACb,IAAI,KAAK,CAAC,QAAQ;gBAAE,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IACD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,GAAG,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,EAAE,CAAC;AACrG,CAAC","sourcesContent":["import { placeConnectedLayers, sequence } from './relationshipPlacement.js';\n\nexport interface MeasuredNode {\n readonly id: string;\n readonly width: number;\n readonly height: number;\n readonly children?: readonly MeasuredNode[];\n}\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface Box extends Point {\n width: number;\n height: number;\n}\n\nexport interface PlacedNode extends Box {\n id: string;\n children?: PlacedNode[];\n}\n\nexport interface Placement {\n readonly row: string | null;\n readonly column: Column;\n readonly headerHeight: number;\n}\n\nexport interface LayoutRelationship {\n readonly source: string;\n readonly target: string;\n readonly type: string;\n}\n\nconst columns = ['passiveStructure', 'behavior', 'activeStructure'] as const;\ntype Column = (typeof columns)[number] | null;\n\ninterface Cell {\n row: string;\n column: Column;\n}\n\nexport interface SizedNode extends Cell {\n node: PlacedNode;\n}\n\nexport interface Arrangement {\n width: number;\n height: number;\n children: PlacedNode[];\n}\n\nconst nodeGap = 46;\nconst cellGap = 72;\n\nfunction extent(nodes: readonly PlacedNode[], dimension: 'height' | 'width'): number {\n return nodes.reduce((maximum, node) => Math.max(maximum, node[dimension]), 0);\n}\n\nfunction stack(nodes: readonly PlacedNode[], horizontal: boolean, gap: number): Arrangement {\n const crossSize = extent(nodes, horizontal ? 'height' : 'width');\n let offset = 0;\n for (const node of nodes) {\n node.x = horizontal ? offset : (crossSize - node.width) / 2;\n node.y = horizontal ? (crossSize - node.height) / 2 : offset;\n offset += (horizontal ? node.width : node.height) + gap;\n }\n const size = Math.max(0, offset - gap);\n return {\n width: horizontal ? size : crossSize,\n height: horizontal ? crossSize : size,\n children: [...nodes],\n };\n}\n\nfunction grid(nodes: readonly SizedNode[], rows: readonly string[], gap: number): Arrangement {\n const widths = new Map<Column, number>();\n const stacks = new Map<string, Map<Column, Arrangement>>();\n for (const row of [...rows, 'motivation']) {\n const cells = new Map<Column, Arrangement>();\n for (const column of [...columns, null]) {\n const members = nodes.filter((node) => node.row === row && node.column === column);\n if (members.length === 0) continue;\n const arrangement = stack(\n members.map(({ node }) => node),\n false,\n gap,\n );\n cells.set(column, arrangement);\n if (row !== 'motivation') widths.set(column, Math.max(widths.get(column) ?? 0, arrangement.width));\n }\n stacks.set(row, cells);\n }\n\n const offsets = new Map<Column, number>();\n let width = 0;\n for (const column of columns) {\n const size = widths.get(column);\n if (size === undefined) continue;\n offsets.set(column, width);\n width += size + cellGap;\n }\n width = Math.max(0, width - cellGap, widths.get(null) ?? 0);\n\n let height = 0;\n for (const row of rows) {\n const cells = stacks.get(row);\n if (!cells?.size) continue;\n let rowHeight = 0;\n for (const [column, offset] of offsets) {\n const cell = cells.get(column);\n if (!cell) continue;\n const left = offset + ((widths.get(column) ?? 0) - cell.width) / 2;\n for (const node of cell.children) {\n node.x += left;\n node.y += height;\n }\n rowHeight = Math.max(rowHeight, cell.height);\n }\n const neutral = cells.get(null);\n if (neutral) {\n if (rowHeight) rowHeight += gap;\n for (const node of neutral.children) node.y += height + rowHeight;\n rowHeight += neutral.height;\n }\n height += rowHeight + cellGap;\n }\n height = Math.max(0, height - cellGap);\n\n const motivation = stacks.get('motivation')?.get(null);\n if (motivation) {\n const offset = width > 0 ? width + cellGap : 0;\n for (const node of motivation.children) node.x += offset;\n width = offset + motivation.width;\n height = Math.max(height, motivation.height);\n }\n return { width, height, children: nodes.map(({ node }) => node) };\n}\n\nfunction classify(placement: Placement | undefined, children: readonly SizedNode[]): Cell {\n if (placement?.row) return { row: placement.row, column: placement.column };\n const first = children[0];\n if (!first || children.some(({ row }) => row !== first.row)) return { row: 'neutral', column: null };\n return {\n row: first.row,\n column: children.every(({ column }) => column === first.column) ? first.column : null,\n };\n}\n\nexport function placeArchitecture(\n nodes: readonly MeasuredNode[],\n placements: ReadonlyMap<string, Placement>,\n relationships: readonly LayoutRelationship[],\n {\n rowOrder,\n padding,\n labelHeight,\n framework = false,\n maxRowWidth,\n }: {\n rowOrder: readonly string[];\n padding: number;\n labelHeight: number;\n framework?: boolean;\n maxRowWidth: number;\n },\n): Arrangement {\n const successors = new Map<string, string[]>();\n for (const { source, target, type } of relationships) {\n if (type !== 'triggering' && type !== 'flow') continue;\n const existing = successors.get(source);\n if (existing) existing.push(target);\n else successors.set(source, [target]);\n }\n const rows = [...rowOrder, 'neutral'];\n const gap = Math.max(nodeGap, labelHeight + 16);\n const arrange = (members: readonly SizedNode[]) =>\n framework\n ? grid(members, rows, gap)\n : placeConnectedLayers(members, ['motivation', ...rows], relationships, gap, cellGap, maxRowWidth);\n\n function size(node: MeasuredNode): SizedNode {\n const placement = placements.get(node.id);\n const children = (node.children ?? []).map(size);\n const cell = classify(placement, children);\n const measured = { id: node.id, width: node.width, height: node.height, x: 0, y: 0 };\n if (!children.length) return { ...cell, node: measured };\n\n const local =\n placement?.column === 'behavior' ? stack(sequence(children, successors), true, gap) : arrange(children);\n const header = placement?.headerHeight ?? node.height;\n const width = Math.max(node.width, local.width + 2 * padding);\n const height = Math.max(node.height, header + local.height + 2 * padding);\n for (const child of local.children) {\n child.x += (width - local.width) / 2;\n child.y += header + padding;\n }\n // Keep the SVG traversal in declaration order even when flow changed placement order.\n return { ...cell, node: { ...measured, width, height, children: children.map(({ node }) => node) } };\n }\n\n const arranged = arrange(nodes.map(size));\n function translate(children: readonly PlacedNode[], x: number, y: number): void {\n for (const child of children) {\n child.x += x;\n child.y += y;\n if (child.children) translate(child.children, child.x, child.y);\n }\n }\n translate(arranged.children, padding, padding);\n return { ...arranged, width: arranged.width + 2 * padding, height: arranged.height + 2 * padding };\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The longest marker is 12 px and its outline adds 2 px, so 14 px holds any marker with its outline.
|
|
2
|
+
export const markerExtent = 14;
|
|
3
|
+
export function simplify(points) {
|
|
4
|
+
const result = [];
|
|
5
|
+
for (const point of points) {
|
|
6
|
+
const last = result.at(-1);
|
|
7
|
+
if (last?.x === point.x && last.y === point.y)
|
|
8
|
+
continue;
|
|
9
|
+
const previous = result.at(-2);
|
|
10
|
+
// A collinear middle point is either a straight continuation or a lead that doubles back.
|
|
11
|
+
if (last &&
|
|
12
|
+
previous &&
|
|
13
|
+
((previous.x === last.x && last.x === point.x) || (previous.y === last.y && last.y === point.y))) {
|
|
14
|
+
result.pop();
|
|
15
|
+
}
|
|
16
|
+
result.push(point);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/mermaid/geometry.ts"],"names":[],"mappings":"AAEA,qGAAqG;AACrG,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,MAAM,UAAU,QAAQ,CAAkB,MAAoB;IAC5D,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;YAAE,SAAS;QACxD,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,0FAA0F;QAC1F,IACE,IAAI;YACJ,QAAQ;YACR,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAChG,CAAC;YACD,MAAM,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Point } from './architectureLayout.js';\n\n// The longest marker is 12 px and its outline adds 2 px, so 14 px holds any marker with its outline.\nexport const markerExtent = 14;\n\nexport function simplify<P extends Point>(points: readonly P[]): P[] {\n const result: P[] = [];\n for (const point of points) {\n const last = result.at(-1);\n if (last?.x === point.x && last.y === point.y) continue;\n const previous = result.at(-2);\n // A collinear middle point is either a straight continuation or a lead that doubles back.\n if (\n last &&\n previous &&\n ((previous.x === last.x && last.x === point.x) || (previous.y === last.y && last.y === point.y))\n ) {\n result.pop();\n }\n result.push(point);\n }\n return result;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ancestors(id: string, parents: Pick<ReadonlyMap<string, string>, 'get'>): string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Outward from the direct parent; containment is acyclic, which the parser enforces.
|
|
2
|
+
export function ancestors(id, parents) {
|
|
3
|
+
const found = [];
|
|
4
|
+
for (let parent = parents.get(id); parent !== undefined; parent = parents.get(parent))
|
|
5
|
+
found.push(parent);
|
|
6
|
+
return found;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=hierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.js","sourceRoot":"","sources":["../../src/mermaid/hierarchy.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,UAAU,SAAS,CAAC,EAAU,EAAE,OAAiD;IACrF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1G,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Outward from the direct parent; containment is acyclic, which the parser enforces.\nexport function ancestors(id: string, parents: Pick<ReadonlyMap<string, string>, 'get'>): string[] {\n const found: string[] = [];\n for (let parent = parents.get(id); parent !== undefined; parent = parents.get(parent)) found.push(parent);\n return found;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function required<T>(value: T | undefined, what: string): T;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// For values the surrounding code guarantees. A missing one is a bug here, not a problem with the diagram.
|
|
2
|
+
export function required(value, what) {
|
|
3
|
+
if (value === undefined)
|
|
4
|
+
throw new Error(`ArchiMate internal error: ${what} is missing.`);
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=invariant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.js","sourceRoot":"","sources":["../../src/mermaid/invariant.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,UAAU,QAAQ,CAAI,KAAoB,EAAE,IAAY;IAC5D,IAAI,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,cAAc,CAAC,CAAC;IAC1F,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// For values the surrounding code guarantees. A missing one is a bug here, not a problem with the diagram.\nexport function required<T>(value: T | undefined, what: string): T {\n if (value === undefined) throw new Error(`ArchiMate internal error: ${what} is missing.`);\n return value;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ArchitectureRoutes, type RoutingEdge, type RoutingNode, type RoutingOptions } from './routing/types.js';
|
|
2
|
+
export { bundleKind } from './routing/types.js';
|
|
3
|
+
export type { ArchitectureRoutes, BundleKind, RouteBundle, RoutingEdge, RoutingNode, RoutingOptions, } from './routing/types.js';
|
|
4
|
+
export declare function routeArchitecture(nodes: ReadonlyMap<string, RoutingNode>, edges: readonly RoutingEdge[], { warn }?: RoutingOptions): ArchitectureRoutes;
|