@danielsimonjr/sciengjs 0.1.1 → 0.3.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.
Files changed (94) hide show
  1. package/README.md +24 -4
  2. package/THIRD_PARTY_NOTICES.md +17 -1
  3. package/assets/licenses/MIT-mermaid.txt +21 -0
  4. package/assets/licenses/MIT-viz-js.txt +21 -0
  5. package/assets/licenses/mermaid-bundle.txt +2128 -0
  6. package/assets/mermaid.min.js +3636 -0
  7. package/dist/browser/backend-pdf.d.ts +3 -0
  8. package/dist/browser/backend-pdf.js +15 -0
  9. package/dist/browser/backend-pdf.js.map +1 -0
  10. package/dist/browser/backend-png.d.ts +3 -0
  11. package/dist/browser/backend-png.js +18 -0
  12. package/dist/browser/backend-png.js.map +1 -0
  13. package/dist/browser/cdp.d.ts +37 -0
  14. package/dist/browser/cdp.js +161 -0
  15. package/dist/browser/cdp.js.map +1 -0
  16. package/dist/browser/flags.d.ts +10 -0
  17. package/dist/browser/flags.js +33 -0
  18. package/dist/browser/flags.js.map +1 -0
  19. package/dist/browser/index.d.ts +5 -0
  20. package/dist/browser/index.js +6 -0
  21. package/dist/browser/index.js.map +1 -0
  22. package/dist/browser/input.d.ts +38 -0
  23. package/dist/browser/input.js +97 -0
  24. package/dist/browser/input.js.map +1 -0
  25. package/dist/browser/page.d.ts +10 -0
  26. package/dist/browser/page.js +33 -0
  27. package/dist/browser/page.js.map +1 -0
  28. package/dist/browser/pinned.d.ts +16 -0
  29. package/dist/browser/pinned.js +13 -0
  30. package/dist/browser/pinned.js.map +1 -0
  31. package/dist/browser/profile.d.ts +9 -0
  32. package/dist/browser/profile.js +33 -0
  33. package/dist/browser/profile.js.map +1 -0
  34. package/dist/browser/proxy.d.ts +14 -0
  35. package/dist/browser/proxy.js +64 -0
  36. package/dist/browser/proxy.js.map +1 -0
  37. package/dist/browser/render.d.ts +58 -0
  38. package/dist/browser/render.js +421 -0
  39. package/dist/browser/render.js.map +1 -0
  40. package/dist/core.js +10 -2
  41. package/dist/core.js.map +1 -1
  42. package/dist/graph/backend-pdf.d.ts +3 -0
  43. package/dist/graph/backend-pdf.js +14 -0
  44. package/dist/graph/backend-pdf.js.map +1 -0
  45. package/dist/graph/backend-png.d.ts +7 -0
  46. package/dist/graph/backend-png.js +30 -12
  47. package/dist/graph/backend-png.js.map +1 -1
  48. package/dist/mermaid/backend-pdf.d.ts +6 -0
  49. package/dist/mermaid/backend-pdf.js +19 -0
  50. package/dist/mermaid/backend-pdf.js.map +1 -0
  51. package/dist/mermaid/backend-png.d.ts +7 -0
  52. package/dist/mermaid/backend-png.js +27 -0
  53. package/dist/mermaid/backend-png.js.map +1 -0
  54. package/dist/mermaid/backend-svg.d.ts +6 -0
  55. package/dist/mermaid/backend-svg.js +18 -0
  56. package/dist/mermaid/backend-svg.js.map +1 -0
  57. package/dist/mermaid/browser.d.ts +30 -0
  58. package/dist/mermaid/browser.js +52 -0
  59. package/dist/mermaid/browser.js.map +1 -0
  60. package/dist/mermaid/class.d.ts +37 -0
  61. package/dist/mermaid/class.js +190 -0
  62. package/dist/mermaid/class.js.map +1 -0
  63. package/dist/mermaid/common.d.ts +50 -0
  64. package/dist/mermaid/common.js +144 -0
  65. package/dist/mermaid/common.js.map +1 -0
  66. package/dist/mermaid/index.d.ts +10 -0
  67. package/dist/mermaid/index.js +11 -0
  68. package/dist/mermaid/index.js.map +1 -0
  69. package/dist/mermaid/render.d.ts +10 -0
  70. package/dist/mermaid/render.js +24 -0
  71. package/dist/mermaid/render.js.map +1 -0
  72. package/dist/mermaid/sequence-layout.d.ts +6 -0
  73. package/dist/mermaid/sequence-layout.js +268 -0
  74. package/dist/mermaid/sequence-layout.js.map +1 -0
  75. package/dist/mermaid/sequence.d.ts +62 -0
  76. package/dist/mermaid/sequence.js +199 -0
  77. package/dist/mermaid/sequence.js.map +1 -0
  78. package/dist/mermaid/state.d.ts +24 -0
  79. package/dist/mermaid/state.js +132 -0
  80. package/dist/mermaid/state.js.map +1 -0
  81. package/dist/pairs.d.ts +2 -1
  82. package/dist/pairs.js +8 -6
  83. package/dist/pairs.js.map +1 -1
  84. package/dist/registry.js +6 -0
  85. package/dist/registry.js.map +1 -1
  86. package/dist/types.d.ts +2 -0
  87. package/dist/version.d.ts +1 -1
  88. package/dist/version.js +1 -1
  89. package/dist/worker/entry.js +1 -1
  90. package/dist/worker/entry.js.map +1 -1
  91. package/dist/worker/protocol.d.ts +7 -0
  92. package/dist/worker/run.js +1 -1
  93. package/dist/worker/run.js.map +1 -1
  94. package/package.json +10 -1
@@ -0,0 +1,144 @@
1
+ import { RenderError } from "../errors.js";
2
+ const HEADERS = new Map([
3
+ ["classDiagram", "class"],
4
+ ["classDiagram-v2", "class"],
5
+ ["stateDiagram-v2", "state"],
6
+ ["sequenceDiagram", "sequence"],
7
+ ]);
8
+ /** Mermaid types that the native layouts do not draw. They route to the browser stage. */
9
+ const OTHER_TYPES = new Set([
10
+ "flowchart", "graph", "stateDiagram", "erDiagram", "gantt", "pie", "journey", "gitGraph", "mindmap",
11
+ "timeline", "quadrantChart", "requirementDiagram", "C4Context", "C4Container", "C4Component",
12
+ "C4Dynamic", "C4Deployment", "sankey-beta", "xychart-beta", "block-beta", "packet-beta", "kanban",
13
+ "architecture-beta", "zenuml",
14
+ ]);
15
+ /**
16
+ * Reads the option `lenient` and checks the other keys. A key outside `lenient` and `extra` rejects with E_INPUT.
17
+ * An undefined value counts as an absent key.
18
+ */
19
+ export function readLenient(options, extra) {
20
+ let lenient = false;
21
+ for (const [key, value] of Object.entries(options)) {
22
+ if (value === undefined)
23
+ continue;
24
+ if (key === "lenient") {
25
+ if (typeof value !== "boolean") {
26
+ throw new RenderError("E_INPUT", "option lenient must be true or false");
27
+ }
28
+ lenient = value;
29
+ }
30
+ else if (!extra.includes(key)) {
31
+ throw new RenderError("E_INPUT", `mermaid takes no option ${key}`);
32
+ }
33
+ }
34
+ return lenient;
35
+ }
36
+ /** The text of a request. The source is text for every Mermaid request, and a byte source is read as UTF-8. */
37
+ export function sourceText(source) {
38
+ return typeof source === "string" ? source : new TextDecoder().decode(source);
39
+ }
40
+ /**
41
+ * Replaces each code point that XML 1.0 forbids with U+FFFD.
42
+ * Valid text, including surrogate pairs, stays unchanged.
43
+ */
44
+ export function xmlSafe(text) {
45
+ return text.replace(/[^\u{9}\u{A}\u{D}\u{20}-\u{D7FF}\u{E000}-\u{FFFD}\u{10000}-\u{10FFFF}]/gu, "\u{FFFD}");
46
+ }
47
+ /** An input error that names its source line. */
48
+ export function inputError(line, message) {
49
+ return new RenderError("E_INPUT", `line ${line}: ${message}`, { line });
50
+ }
51
+ /**
52
+ * Handles a construct that the grammar does not accept. Without lenient it rejects with E_INPUT on its line.
53
+ * With lenient it records a warning on its line and returns, so that the caller can skip the construct.
54
+ */
55
+ export function outside(ctx, line, text, why) {
56
+ if (!ctx.lenient) {
57
+ throw inputError(line, `${why}: "${text}"`);
58
+ }
59
+ ctx.warnings.push(`line ${line}: skipped the unsupported construct "${text}"`);
60
+ }
61
+ /**
62
+ * Prepares a source. It reads the options, removes blank lines, comment lines, directives and front matter,
63
+ * and reads the header. A whole Mermaid type that the native layouts do not draw rejects with E_UNSUPPORTED.
64
+ */
65
+ export function prepare(source, options, extra = []) {
66
+ const ctx = { lenient: readLenient(options, extra), warnings: [] };
67
+ const content = scanContent(source, ctx);
68
+ return headerOf(content, ctx);
69
+ }
70
+ /**
71
+ * Tells whether a source routes to the browser stage. A source routes there when the first word of its first
72
+ * content line is a Mermaid type of OTHER_TYPES. The scan skips blank lines, comment lines, directives and a
73
+ * leading front matter block, and it never throws: an unclosed front matter or an unknown header stays on the
74
+ * native path, which rejects it with E_INPUT.
75
+ */
76
+ export function routesToBrowser(source) {
77
+ const raw = source.split(/\r?\n/);
78
+ for (let index = 0; index < raw.length; index += 1) {
79
+ const text = (raw[index] ?? "").trim();
80
+ if (text === "" || text.startsWith("%%"))
81
+ continue;
82
+ if (text === "---") {
83
+ const close = raw.findIndex((line, at) => at > index && line.trim() === "---");
84
+ if (close < 0)
85
+ return false;
86
+ index = close;
87
+ continue;
88
+ }
89
+ return OTHER_TYPES.has(text.split(/\s+/)[0] ?? "");
90
+ }
91
+ return false;
92
+ }
93
+ /** Removes blank lines, comment lines and directives, and keeps the content lines with their line numbers. */
94
+ function scanContent(source, ctx) {
95
+ const raw = source.split(/\r?\n/);
96
+ const content = [];
97
+ for (let index = 0; index < raw.length; index += 1) {
98
+ const number = index + 1;
99
+ const text = (raw[index] ?? "").trim();
100
+ if (text === "")
101
+ continue;
102
+ if (content.length === 0 && text === "---") {
103
+ const close = raw.findIndex((line, at) => at > index && line.trim() === "---");
104
+ if (close < 0) {
105
+ throw inputError(number, "the front matter is not closed by a line of three dashes");
106
+ }
107
+ outside(ctx, number, text, "the front matter is outside the supported grammar");
108
+ index = close;
109
+ continue;
110
+ }
111
+ if (text.startsWith("%%{")) {
112
+ outside(ctx, number, text, "a directive is outside the supported grammar");
113
+ continue;
114
+ }
115
+ if (text.startsWith("%%"))
116
+ continue;
117
+ if (xmlSafe(text) !== text) {
118
+ ctx.warnings.push(`line ${number}: each character outside the XML 1.0 range is shown as U+FFFD`);
119
+ }
120
+ content.push({ number, text });
121
+ }
122
+ return content;
123
+ }
124
+ /** Reads the header of the content lines and returns the source. A type that the native layouts do not draw rejects. */
125
+ function headerOf(content, ctx) {
126
+ const head = content[0];
127
+ if (head === undefined) {
128
+ throw new RenderError("E_INPUT", "the source names no Mermaid diagram type");
129
+ }
130
+ const word = head.text.split(/\s+/)[0] ?? "";
131
+ const kind = HEADERS.get(head.text);
132
+ if (kind !== undefined) {
133
+ return { kind, headerLine: head.number, lines: content.slice(1), lenient: ctx.lenient, warnings: ctx.warnings };
134
+ }
135
+ if (OTHER_TYPES.has(word)) {
136
+ throw new RenderError("E_UNSUPPORTED", `line ${head.number}: ${word} diagrams need the browser stage; ` +
137
+ "the native layouts draw classDiagram, stateDiagram-v2 and sequenceDiagram", { line: head.number });
138
+ }
139
+ if (HEADERS.has(word)) {
140
+ throw inputError(head.number, `the header ${word} takes no other text on its line`);
141
+ }
142
+ throw inputError(head.number, `"${head.text}" does not name a Mermaid diagram type that this release draws`);
143
+ }
144
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/mermaid/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAwB3C,MAAM,OAAO,GAAqC,IAAI,GAAG,CAAC;IACxD,CAAC,cAAc,EAAE,OAAO,CAAC;IACzB,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,iBAAiB,EAAE,UAAU,CAAC;CAChC,CAAC,CAAC;AAEH,0FAA0F;AAC1F,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IAC/C,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS;IACnG,UAAU,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa;IAC5F,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ;IACjG,mBAAmB,EAAE,QAAQ;CAC9B,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgC,EAAE,KAAwB;IACpF,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC/B,MAAM,IAAI,WAAW,CAAC,S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-0,0 +1,10 @@
1
+ /**
2
+ * The public surface of the Mermaid native layouts. It holds the header and option reader, the parsers,
3
+ * the DOT builders, the sequence layout and the SVG render.
4
+ */
5
+ export { prepare, type Source } from "./common.ts";
6
+ export { parseClassDiagram, classToDot, type ClassModel, type ClassDef, type ClassRelation, type ClassArrow, type Marker, } from "./class.ts";
7
+ export { parseStateDiagram, stateToDot, type StateModel, type StateDef, type StateTransition } from "./state.ts";
8
+ export { parseSequenceDiagram, type SequenceModel, type SeqEvent, type Participant, type MessageEvent, type NoteEvent, type ActivateEvent, type DeactivateEvent, type Branch, type BlockEvent, } from "./sequence.ts";
9
+ export { layoutSequence } from "./sequence-layout.ts";
10
+ export { renderMermaidSvg, type MermaidSvg } from "./render.ts";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The public surface of the Mermaid native layouts. It holds the header and option reader, the parsers,
3
+ * the DOT builders, the sequence layout and the SVG render.
4
+ */
5
+ export { prepare } from "./common.js";
6
+ export { parseClassDiagram, classToDot, } from "./class.js";
7
+ export { parseStateDiagram, stateToDot } from "./state.js";
8
+ export { parseSequenceDiagram, } from "./sequence.js";
9
+ export { layoutSequence } from "./sequence-layout.js";
10
+ export { renderMermaidSvg } from "./render.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mermaid/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,UAAU,GAMX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAwD,MAAM,YAAY,CAAC;AACjH,OAAO,EACL,oBAAoB,GAUrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** The SVG text and the warnings of one Mermaid render. */
2
+ export interface MermaidSvg {
3
+ svg: string;
4
+ warnings: string[];
5
+ }
6
+ /**
7
+ * Renders one Mermaid source to SVG. A class or state diagram goes through DOT and the graph stage.
8
+ * A sequence diagram is laid out here. The only option is lenient.
9
+ */
10
+ export declare function renderMermaidSvg(source: string, options: Record<string, unknown>): Promise<MermaidSvg>;
@@ -0,0 +1,24 @@
1
+ import { dotToSvg } from "../graph/dot.js";
2
+ import { classToDot, parseClassDiagram } from "./class.js";
3
+ import { prepare } from "./common.js";
4
+ import { parseSequenceDiagram } from "./sequence.js";
5
+ import { layoutSequence } from "./sequence-layout.js";
6
+ import { parseStateDiagram, stateToDot } from "./state.js";
7
+ /**
8
+ * Renders one Mermaid source to SVG. A class or state diagram goes through DOT and the graph stage.
9
+ * A sequence diagram is laid out here. The only option is lenient.
10
+ */
11
+ export async function renderMermaidSvg(source, options) {
12
+ const src = prepare(source, options);
13
+ if (src.kind === "class") {
14
+ const dot = await dotToSvg(classToDot(parseClassDiagram(src)));
15
+ return { svg: dot.svg, warnings: [...src.warnings, ...dot.warnings] };
16
+ }
17
+ if (src.kind === "state") {
18
+ const dot = await dotToSvg(stateToDot(parseStateDiagram(src)));
19
+ return { svg: dot.svg, warnings: [...src.warnings, ...dot.warnings] };
20
+ }
21
+ const svg = layoutSequence(parseSequenceDiagram(src));
22
+ return { svg, warnings: [...src.warnings] };
23
+ }
24
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/mermaid/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ3D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAgC;IACrF,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxE,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxE,CAAC;IACD,MAAM,GAAG,GAAG,cAAc,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { SequenceModel } from "./sequence.ts";
2
+ /**
3
+ * Lays out one sequence model into one SVG document string.
4
+ * Returns the document with the root element first, one element per line and a final newline.
5
+ */
6
+ export declare function layoutSequence(model: SequenceModel): string;
@@ -0,0 +1,268 @@
1
+ import { xmlSafe } from "./common.js";
2
+ const MARGIN = 20;
3
+ const BOX_HEIGHT = 36;
4
+ const BOX_MIN_WIDTH = 100;
5
+ const BOX_PADDING = 20;
6
+ const CHAR_WIDTH = 8;
7
+ const COLUMN_MIN_GAP = 180;
8
+ const COLUMN_EDGE_GAP = 40;
9
+ const ROW_HEIGHT = 30;
10
+ const SELF_LOOP_WIDTH = 30;
11
+ const SELF_LOOP_HEIGHT = 20;
12
+ const ACTIVATION_WIDTH = 10;
13
+ const NOTE_MIN_WIDTH = 80;
14
+ const NOTE_PADDING = 16;
15
+ const NOTE_HEIGHT = 24;
16
+ const NOTE_GAP = 10;
17
+ const NOTE_OVER_SIDE = 30;
18
+ /** The height of one block text band: a block header or a divider label, and the space above the first row below it. */
19
+ const BLOCK_HEADER = 40;
20
+ const BLOCK_BOTTOM = 10;
21
+ const BLOCK_SIDE = 30;
22
+ const FONT_SIZE = 14;
23
+ /** Measures the laid-out width of one text run. */
24
+ function textWidth(value) {
25
+ return value.length * CHAR_WIDTH;
26
+ }
27
+ /** Makes one text value safe for XML: it replaces each forbidden character, then escapes the markup characters. */
28
+ function escapeXml(value) {
29
+ return xmlSafe(value)
30
+ .replace(/&/g, "&amp;")
31
+ .replace(/</g, "&lt;")
32
+ .replace(/>/g, "&gt;")
33
+ .replace(/"/g, "&quot;")
34
+ .replace(/'/g, "&apos;");
35
+ }
36
+ /** Widens one extent to cover two drawn x coordinates. */
37
+ function spanX(extent, first, second) {
38
+ const low = first <= second ? first : second;
39
+ const high = first <= second ? second : first;
40
+ if (low < extent.minX)
41
+ extent.minX = low;
42
+ if (high > extent.maxX)
43
+ extent.maxX = high;
44
+ }
45
+ /** Widens one extent to cover one drawn text element and its anchor. */
46
+ function spanText(extent, x, value, anchor) {
47
+ const width = textWidth(value);
48
+ if (anchor === "middle")
49
+ spanX(extent, x - width / 2, x + width / 2);
50
+ else
51
+ spanX(extent, x, x + width);
52
+ }
53
+ /** Measures the laid-out width of one participant box. */
54
+ function participantWidth(label) {
55
+ return Math.max(BOX_MIN_WIDTH, textWidth(label) + BOX_PADDING);
56
+ }
57
+ /**
58
+ * Lays out one sequence model into one SVG document string.
59
+ * Returns the document with the root element first, one element per line and a final newline.
60
+ */
61
+ export function layoutSequence(model) {
62
+ const centers = new Map();
63
+ let prevCenter = 0;
64
+ let prevHalf = 0;
65
+ for (let index = 0; index < model.participants.length; index += 1) {
66
+ const participant = model.participants[index];
67
+ const half = participantWidth(participant.label) / 2;
68
+ const center = index === 0
69
+ ? MARGIN + half
70
+ : prevCenter + Math.max(COLUMN_MIN_GAP, prevHalf + half + COLUMN_EDGE_GAP);
71
+ centers.set(participant.id, center);
72
+ prevCenter = center;
73
+ prevHalf = half;
74
+ }
75
+ let minCenter = 0;
76
+ let maxCenter = 0;
77
+ if (model.participants.length > 0) {
78
+ minCenter = centers.get(model.participants[0].id);
79
+ maxCenter = minCenter;
80
+ for (const participant of model.participants) {
81
+ const center = centers.get(participant.id);
82
+ if (center < minCenter)
83
+ minCenter = center;
84
+ if (center > maxCenter)
85
+ maxCenter = center;
86
+ }
87
+ }
88
+ const extent = { minX: Infinity, maxX: -Infinity };
89
+ let cursor = MARGIN + BOX_HEIGHT + ROW_HEIGHT;
90
+ let rowCount = 0;
91
+ const stacks = new Map();
92
+ const frames = [];
93
+ const lifelines = [];
94
+ const activations = [];
95
+ const notes = [];
96
+ const messages = [];
97
+ const boxes = [];
98
+ function centerOf(id) {
99
+ return centers.get(id);
100
+ }
101
+ function pushActivation(id, start) {
102
+ const stack = stacks.get(id);
103
+ if (!stack) {
104
+ stacks.set(id, [{ start, depth: 0 }]);
105
+ return;
106
+ }
107
+ stack.push({ start, depth: stack.length });
108
+ }
109
+ function drawActivation(id, entry, end) {
110
+ const center = centerOf(id);
111
+ const x = center + (entry.depth * ACTIVATION_WIDTH) / 2 - ACTIVATION_WIDTH / 2;
112
+ const height = Math.max(end - entry.start, ROW_HEIGHT / 2);
113
+ activations.push(`<rect x="${x}" y="${entry.start}" width="${ACTIVATION_WIDTH}" height="${height}" fill="#eeeeee" stroke="#000000" data-scieng-kind="activation" data-scieng-id="${escapeXml(id)}"/>`);
114
+ spanX(extent, x, x + ACTIVATION_WIDTH);
115
+ }
116
+ function popActivation(id, end) {
117
+ const stack = stacks.get(id);
118
+ if (!stack || stack.length === 0)
119
+ return;
120
+ drawActivation(id, stack.pop(), end);
121
+ }
122
+ function drawMessage(message, y, row) {
123
+ const dash = message.dashed ? ` stroke-dasharray="4 3"` : "";
124
+ if (message.from !== message.to) {
125
+ const from = centerOf(message.from);
126
+ const to = centerOf(message.to);
127
+ messages.push(`<line x1="${from}" y1="${y}" x2="${to}" y2="${y}" stroke="#000000"${dash} data-scieng-kind="message" data-scieng-row="${row}" data-scieng-line="${message.line}"/>`);
128
+ spanX(extent, from, to);
129
+ if (message.arrowhead) {
130
+ const direction = to > from ? 1 : -1;
131
+ const tail = to - 10 * direction;
132
+ messages.push(`<polygon points="${to},${y} ${tail},${y - 5} ${tail},${y + 5}" fill="#000000"/>`);
133
+ spanX(extent, to, tail);
134
+ }
135
+ const mid = (from + to) / 2;
136
+ messages.push(`<text x="${mid}" y="${y - 6}" text-anchor="middle" font-size="${FONT_SIZE}">${escapeXml(message.text)}</text>`);
137
+ spanText(extent, mid, message.text, "middle");
138
+ return;
139
+ }
140
+ const center = centerOf(message.from);
141
+ messages.push(`<path d="M ${center} ${y} H ${center + SELF_LOOP_WIDTH} V ${y + SELF_LOOP_HEIGHT} H ${center}" fill="none" stroke="#000000"${dash} data-scieng-kind="message" data-scieng-row="${row}" data-scieng-line="${message.line}"/>`);
142
+ spanX(extent, center, center + SELF_LOOP_WIDTH);
143
+ if (message.arrowhead) {
144
+ messages.push(`<polygon points="${center},${y + SELF_LOOP_HEIGHT} ${center + 10},${y + SELF_LOOP_HEIGHT - 5} ${center + 10},${y + SELF_LOOP_HEIGHT + 5}" fill="#000000"/>`);
145
+ spanX(extent, center, center + 10);
146
+ }
147
+ const textX = center + 36;
148
+ messages.push(`<text x="${textX}" y="${y + 4}" text-anchor="start" font-size="${FONT_SIZE}">${escapeXml(message.text)}</text>`);
149
+ spanText(extent, textX, message.text, "start");
150
+ }
151
+ function drawNote(position, ids, text, line, top) {
152
+ let x;
153
+ let width;
154
+ if (position === "over" && ids.length >= 2) {
155
+ const first = centerOf(ids[0]);
156
+ const second = centerOf(ids[1]);
157
+ x = Math.min(first, second) - NOTE_OVER_SIDE;
158
+ width = Math.max(NOTE_MIN_WIDTH, Math.abs(second - first) + 2 * NOTE_OVER_SIDE);
159
+ }
160
+ else {
161
+ width = Math.max(NOTE_MIN_WIDTH, textWidth(text) + NOTE_PADDING);
162
+ const anchor = centerOf(ids[0]);
163
+ if (position === "left")
164
+ x = anchor - NOTE_GAP - width;
165
+ else if (position === "right")
166
+ x = anchor + NOTE_GAP;
167
+ else
168
+ x = anchor - width / 2;
169
+ }
170
+ notes.push(`<rect x="${x}" y="${top}" width="${width}" height="${NOTE_HEIGHT}" fill="#ffffcc" stroke="#000000" data-scieng-kind="note" data-scieng-line="${line}"/>`);
171
+ spanX(extent, x, x + width);
172
+ const textX = x + width / 2;
173
+ notes.push(`<text x="${textX}" y="${top + 16}" text-anchor="middle" font-size="${FONT_SIZE}">${escapeXml(text)}</text>`);
174
+ spanText(extent, textX, text, "middle");
175
+ }
176
+ function drawBlock(block) {
177
+ const x = minCenter - BLOCK_SIDE;
178
+ const width = maxCenter - minCenter + 2 * BLOCK_SIDE;
179
+ const frameTop = cursor;
180
+ cursor += BLOCK_HEADER;
181
+ for (let index = 0; index < block.branches.length; index += 1) {
182
+ const branch = block.branches[index];
183
+ if (index > 0) {
184
+ const dividerY = cursor;
185
+ frames.push(`<line x1="${x}" y1="${dividerY}" x2="${x + width}" y2="${dividerY}" stroke="#000000" stroke-dasharray="6 4" data-scieng-kind="divider" data-scieng-line="${branch.line}"/>`);
186
+ spanX(extent, x, x + width);
187
+ const head = block.type === "alt" ? "else" : "and";
188
+ const heading = branch.label.length > 0 ? `${head} ${branch.label}` : head;
189
+ frames.push(`<text x="${x + 6}" y="${dividerY + 14}" font-size="${FONT_SIZE}">${escapeXml(heading)}</text>`);
190
+ spanText(extent, x + 6, heading, "start");
191
+ cursor += BLOCK_HEADER;
192
+ }
193
+ walkEvents(branch.events);
194
+ }
195
+ const frameBottom = cursor + BLOCK_BOTTOM;
196
+ frames.push(`<rect x="${x}" y="${frameTop}" width="${width}" height="${frameBottom - frameTop}" fill="none" stroke="#000000" data-scieng-kind="block" data-scieng-type="${block.type}" data-scieng-line="${block.line}"/>`);
197
+ spanX(extent, x, x + width);
198
+ const firstBranch = block.branches[0];
199
+ const heading = firstBranch && firstBranch.label.length > 0 ? `${block.type} ${firstBranch.label}` : block.type;
200
+ frames.push(`<text x="${x + 6}" y="${frameTop + 14}" font-size="${FONT_SIZE}">${escapeXml(heading)}</text>`);
201
+ spanText(extent, x + 6, heading, "start");
202
+ cursor = frameBottom + ROW_HEIGHT;
203
+ }
204
+ function walkEvents(events) {
205
+ for (const event of events) {
206
+ if (event.kind === "message") {
207
+ const y = cursor;
208
+ const row = rowCount;
209
+ rowCount += 1;
210
+ if (event.deactivateSource)
211
+ popActivation(event.from, y);
212
+ if (event.activateTarget)
213
+ pushActivation(event.to, y);
214
+ drawMessage(event, y, row);
215
+ cursor += event.from === event.to ? ROW_HEIGHT + SELF_LOOP_HEIGHT : ROW_HEIGHT;
216
+ }
217
+ else if (event.kind === "note") {
218
+ drawNote(event.position, event.ids, event.text, event.line, cursor);
219
+ cursor += ROW_HEIGHT;
220
+ }
221
+ else if (event.kind === "activate") {
222
+ pushActivation(event.id, cursor);
223
+ }
224
+ else if (event.kind === "deactivate") {
225
+ popActivation(event.id, cursor);
226
+ }
227
+ else {
228
+ drawBlock(event);
229
+ }
230
+ }
231
+ }
232
+ walkEvents(model.events);
233
+ const finalCursor = cursor;
234
+ for (const participant of model.participants) {
235
+ const stack = stacks.get(participant.id);
236
+ if (!stack)
237
+ continue;
238
+ for (const entry of stack)
239
+ drawActivation(participant.id, entry, finalCursor);
240
+ stack.length = 0;
241
+ }
242
+ for (const participant of model.participants) {
243
+ const center = centers.get(participant.id);
244
+ lifelines.push(`<line x1="${center}" y1="${MARGIN + BOX_HEIGHT}" x2="${center}" y2="${finalCursor}" stroke="#888888" stroke-dasharray="4 4" data-scieng-kind="lifeline" data-scieng-id="${escapeXml(participant.id)}"/>`);
245
+ spanX(extent, center, center);
246
+ }
247
+ for (const participant of model.participants) {
248
+ const center = centers.get(participant.id);
249
+ const width = participantWidth(participant.label);
250
+ boxes.push(`<rect x="${center - width / 2}" y="${MARGIN}" width="${width}" height="${BOX_HEIGHT}" rx="4" fill="#ffffff" stroke="#000000" data-scieng-kind="participant" data-scieng-id="${escapeXml(participant.id)}"/>`);
251
+ spanX(extent, center - width / 2, center + width / 2);
252
+ boxes.push(`<text x="${center}" y="${MARGIN + 22}" text-anchor="middle" font-size="${FONT_SIZE}">${escapeXml(participant.label)}</text>`);
253
+ spanText(extent, center, participant.label, "middle");
254
+ }
255
+ const minX = Number.isFinite(extent.minX) ? extent.minX : 0;
256
+ const maxX = Number.isFinite(extent.maxX) ? extent.maxX : 0;
257
+ const root = `<svg xmlns="http://www.w3.org/2000/svg" width="${maxX - minX + 2 * MARGIN}" height="${finalCursor + MARGIN}" viewBox="${minX - MARGIN} 0 ${maxX - minX + 2 * MARGIN} ${finalCursor + MARGIN}">`;
258
+ const lines = [root];
259
+ lines.push(...frames);
260
+ lines.push(...lifelines);
261
+ lines.push(...activations);
262
+ lines.push(...notes);
263
+ lines.push(...messages);
264
+ lines.push(...boxes);
265
+ lines.push("</svg>");
266
+ return lines.join("\n") + "\n";
267
+ }
268
+ //# sourceMappingURL=sequence-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequence-layout.js","sourceRoot":"","sources":["../../src/mermaid/sequence-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB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AAG,IAAI,CAAC;AACjC,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { type Source } from "./common.ts";
2
+ /** Describes one participant of a sequence diagram. */
3
+ export interface Participant {
4
+ id: string;
5
+ label: string;
6
+ line: number;
7
+ }
8
+ /** Describes one message that one participant sends to another. */
9
+ export interface MessageEvent {
10
+ kind: "message";
11
+ from: string;
12
+ to: string;
13
+ token: string;
14
+ dashed: boolean;
15
+ arrowhead: boolean;
16
+ text: string;
17
+ activateTarget: boolean;
18
+ deactivateSource: boolean;
19
+ line: number;
20
+ }
21
+ /** Describes one note that sits left of, right of or over participants. */
22
+ export interface NoteEvent {
23
+ kind: "note";
24
+ position: "left" | "right" | "over";
25
+ ids: string[];
26
+ text: string;
27
+ line: number;
28
+ }
29
+ /** Describes one explicit activation of a participant. */
30
+ export interface ActivateEvent {
31
+ kind: "activate";
32
+ id: string;
33
+ line: number;
34
+ }
35
+ /** Describes one explicit deactivation of a participant. */
36
+ export interface DeactivateEvent {
37
+ kind: "deactivate";
38
+ id: string;
39
+ line: number;
40
+ }
41
+ /** Describes one labelled branch that a block event holds. */
42
+ export interface Branch {
43
+ label: string;
44
+ line: number;
45
+ events: SeqEvent[];
46
+ }
47
+ /** Describes one loop, alt or par block that groups nested events. */
48
+ export interface BlockEvent {
49
+ kind: "block";
50
+ type: "loop" | "alt" | "par";
51
+ line: number;
52
+ branches: Branch[];
53
+ }
54
+ /** Unites every event that a sequence diagram can hold. */
55
+ export type SeqEvent = MessageEvent | NoteEvent | ActivateEvent | DeactivateEvent | BlockEvent;
56
+ /** Holds the participants and the events of a parsed sequence diagram. */
57
+ export interface SequenceModel {
58
+ participants: Participant[];
59
+ events: SeqEvent[];
60
+ }
61
+ /** Parses the lines of a sequence diagram into its participants and events. */
62
+ export declare function parseSequenceDiagram(src: Source): SequenceModel;