process-graph 1.0.6 → 1.1.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 +85 -17
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +92 -0
- package/dist/cli.d.ts +512 -0
- package/dist/cli.js +3 -0
- package/dist/control-aDk9560d.js +294 -0
- package/dist/detail-panel-B1ZmMuJT.js +341 -0
- package/dist/dist-BpCBmnMl.js +582 -0
- package/dist/dist-HLlW8vgT.js +1388 -0
- package/dist/dist-IjrgWhHQ.js +3 -0
- package/dist/errors-BZe5WzCn.js +19 -0
- package/dist/exit-codes-0ultCqdS.js +23 -0
- package/dist/graphql-C1j5wQFz.d.ts +631 -0
- package/dist/index-CCfe0csl.d.ts +353 -0
- package/dist/index-CmZOswkx.d.ts +512 -0
- package/dist/index-CoA6vXqe.d.ts +404 -0
- package/dist/index-CptUHq6F.d.ts +58 -0
- package/dist/index-CrM5qWUA.d.ts +110 -0
- package/dist/index-DhbvDgK4.d.ts +1582 -0
- package/dist/index-DricKcyl.d.ts +421 -0
- package/dist/index.d.ts +111 -4
- package/dist/index.js +929 -5
- package/dist/layout-CCM-KBdp.js +307 -0
- package/dist/layout.d.ts +8 -0
- package/dist/layout.js +2 -0
- package/dist/node-AchI1T-K.js +40 -0
- package/dist/open-CyRXJ4bt.js +29 -0
- package/dist/parse-CuipC_2K.js +41 -0
- package/dist/queries-CCexJAE2.js +2202 -0
- package/dist/react-flow/style.css +658 -0
- package/dist/react-flow.d.ts +173 -0
- package/dist/react-flow.js +450 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +107 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/router-D4gtTlXm.js +188 -0
- package/dist/schema-CVnS6HiX.js +234 -0
- package/dist/selection-BW_xXWOy.js +314 -0
- package/dist/source/github/node.d.ts +16 -0
- package/dist/source/github/node.js +2 -0
- package/dist/source/github.d.ts +49 -0
- package/dist/source/github.js +201 -0
- package/dist/source-DRDpEA8Q.js +1316 -0
- package/dist/status-Bm1CGu9C.js +11 -0
- package/dist/store/node.d.ts +24 -0
- package/dist/store/node.js +2 -0
- package/dist/store/wasm/worker.d.ts +16 -0
- package/dist/store/wasm/worker.js +98 -0
- package/dist/store/wasm.d.ts +9 -0
- package/dist/store/wasm.js +11 -0
- package/dist/store-BcR70CaO.js +1287 -0
- package/dist/store.d.ts +1328 -0
- package/dist/store.js +238 -0
- package/dist/ui/style.css +351 -0
- package/dist/ui.d.ts +235 -0
- package/dist/ui.js +2 -0
- package/dist/validate-DF3mQZww.js +125 -0
- package/package.json +150 -15
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
import { a as TransitionItem$1, i as Lane$1, n as FilterPanel$1, o as ElementCard$1, r as Legend$1, s as StatusBadge$1, t as DetailPanel$1 } from "./detail-panel-B1ZmMuJT.js";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { createRuntimeFn } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
5
|
+
//#region ../../ui/graph/ui/dist/index.js
|
|
6
|
+
var vars = {
|
|
7
|
+
colour: {
|
|
8
|
+
background: "var(--_1pqhw580)",
|
|
9
|
+
surface: "var(--_1pqhw581)",
|
|
10
|
+
text: "var(--_1pqhw582)",
|
|
11
|
+
muted: "var(--_1pqhw583)",
|
|
12
|
+
border: "var(--_1pqhw584)",
|
|
13
|
+
accent: "var(--_1pqhw585)",
|
|
14
|
+
focus: "var(--_1pqhw586)",
|
|
15
|
+
critical: "var(--_1pqhw587)",
|
|
16
|
+
handoff: "var(--_1pqhw588)",
|
|
17
|
+
status: {
|
|
18
|
+
done: "var(--_1pqhw589)",
|
|
19
|
+
ready: "var(--_1pqhw58a)",
|
|
20
|
+
blocked: "var(--_1pqhw58b)",
|
|
21
|
+
skipped: "var(--_1pqhw58c)",
|
|
22
|
+
unknown: "var(--_1pqhw58d)"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
space: {
|
|
26
|
+
small: "var(--_1pqhw58e)",
|
|
27
|
+
medium: "var(--_1pqhw58f)",
|
|
28
|
+
large: "var(--_1pqhw58g)"
|
|
29
|
+
},
|
|
30
|
+
radius: {
|
|
31
|
+
small: "var(--_1pqhw58h)",
|
|
32
|
+
medium: "var(--_1pqhw58i)"
|
|
33
|
+
},
|
|
34
|
+
font: {
|
|
35
|
+
body: "var(--_1pqhw58j)",
|
|
36
|
+
mono: "var(--_1pqhw58k)",
|
|
37
|
+
sizeSmall: "var(--_1pqhw58l)",
|
|
38
|
+
sizeBody: "var(--_1pqhw58m)",
|
|
39
|
+
sizeHeading: "var(--_1pqhw58n)",
|
|
40
|
+
weightStrong: "var(--_1pqhw58o)"
|
|
41
|
+
},
|
|
42
|
+
stroke: {
|
|
43
|
+
thin: "var(--_1pqhw58p)",
|
|
44
|
+
thick: "var(--_1pqhw58q)"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var lightTheme = "_1pqhw58r";
|
|
48
|
+
var darkTheme = "_1pqhw58s";
|
|
49
|
+
/** What both themes share: everything but colour. */
|
|
50
|
+
var shared = {
|
|
51
|
+
space: {
|
|
52
|
+
small: "0.25rem",
|
|
53
|
+
medium: "0.5rem",
|
|
54
|
+
large: "1rem"
|
|
55
|
+
},
|
|
56
|
+
radius: {
|
|
57
|
+
small: "0.25rem",
|
|
58
|
+
medium: "0.5rem"
|
|
59
|
+
},
|
|
60
|
+
font: {
|
|
61
|
+
body: "system-ui, -apple-system, \"Segoe UI\", sans-serif",
|
|
62
|
+
mono: "ui-monospace, \"SFMono-Regular\", Menlo, monospace",
|
|
63
|
+
sizeSmall: "0.75rem",
|
|
64
|
+
sizeBody: "0.875rem",
|
|
65
|
+
sizeHeading: "1rem",
|
|
66
|
+
weightStrong: "600"
|
|
67
|
+
},
|
|
68
|
+
stroke: {
|
|
69
|
+
thin: "1px",
|
|
70
|
+
thick: "3px"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/** The light theme's values. Each status colour reads as text on both `surface` and `background`. */
|
|
74
|
+
var lightValues = {
|
|
75
|
+
...shared,
|
|
76
|
+
colour: {
|
|
77
|
+
background: "#ffffff",
|
|
78
|
+
surface: "#f6f8fa",
|
|
79
|
+
text: "#1f2328",
|
|
80
|
+
muted: "#59636e",
|
|
81
|
+
border: "#d1d9e0",
|
|
82
|
+
accent: "#0969da",
|
|
83
|
+
focus: "#0969da",
|
|
84
|
+
critical: "#9a6700",
|
|
85
|
+
handoff: "#6639ba",
|
|
86
|
+
status: {
|
|
87
|
+
done: "#1a7f37",
|
|
88
|
+
ready: "#0550ae",
|
|
89
|
+
blocked: "#cf222e",
|
|
90
|
+
skipped: "#59636e",
|
|
91
|
+
unknown: "#6639ba"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
/** The dark theme's values. Each status colour reads as text on both `surface` and `background`. */
|
|
96
|
+
var darkValues = {
|
|
97
|
+
...shared,
|
|
98
|
+
colour: {
|
|
99
|
+
background: "#0d1117",
|
|
100
|
+
surface: "#161b22",
|
|
101
|
+
text: "#e6edf3",
|
|
102
|
+
muted: "#9198a1",
|
|
103
|
+
border: "#3d444d",
|
|
104
|
+
accent: "#4493f8",
|
|
105
|
+
focus: "#4493f8",
|
|
106
|
+
critical: "#d29922",
|
|
107
|
+
handoff: "#ab7df8",
|
|
108
|
+
status: {
|
|
109
|
+
done: "#3fb950",
|
|
110
|
+
ready: "#58a6ff",
|
|
111
|
+
blocked: "#f85149",
|
|
112
|
+
skipped: "#9198a1",
|
|
113
|
+
unknown: "#ab7df8"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var surfaceRoot = "xk03iz0";
|
|
118
|
+
var visuallyHidden = "xk03iz1";
|
|
119
|
+
var focusRing = "xk03iz2";
|
|
120
|
+
var badge = createRuntimeFn({
|
|
121
|
+
defaultClassName: "_1qote9c0",
|
|
122
|
+
variantClassNames: { status: {
|
|
123
|
+
done: "_1qote9c1",
|
|
124
|
+
ready: "_1qote9c2",
|
|
125
|
+
blocked: "_1qote9c3",
|
|
126
|
+
skipped: "_1qote9c4",
|
|
127
|
+
unknown: "_1qote9c5"
|
|
128
|
+
} },
|
|
129
|
+
defaultVariants: {},
|
|
130
|
+
compoundVariants: []
|
|
131
|
+
});
|
|
132
|
+
var card = createRuntimeFn({
|
|
133
|
+
defaultClassName: "_1qote9c6 xk03iz2",
|
|
134
|
+
variantClassNames: {
|
|
135
|
+
status: {
|
|
136
|
+
done: "_1qote9c7",
|
|
137
|
+
ready: "_1qote9c8",
|
|
138
|
+
blocked: "_1qote9c9",
|
|
139
|
+
skipped: "_1qote9ca",
|
|
140
|
+
unknown: "_1qote9cb"
|
|
141
|
+
},
|
|
142
|
+
kind: {
|
|
143
|
+
activity: "_1qote9cc",
|
|
144
|
+
state: "_1qote9cd",
|
|
145
|
+
decision: "_1qote9ce",
|
|
146
|
+
pseudo: "_1qote9cf",
|
|
147
|
+
message: "_1qote9cg"
|
|
148
|
+
},
|
|
149
|
+
critical: {
|
|
150
|
+
true: "_1qote9ch",
|
|
151
|
+
false: "_1qote9ci"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
defaultVariants: {},
|
|
155
|
+
compoundVariants: []
|
|
156
|
+
});
|
|
157
|
+
var cardLabel = "_1qote9cj";
|
|
158
|
+
var criticalMarker = "_1qote9ck";
|
|
159
|
+
var blockersNote = "_1qote9cl";
|
|
160
|
+
var transition = "_1qote9cm";
|
|
161
|
+
var transitionEnd = "_1qote9cn";
|
|
162
|
+
var lane = "_1qote9co";
|
|
163
|
+
var laneHeading = "_1qote9cp";
|
|
164
|
+
var laneBody = "_1qote9cq";
|
|
165
|
+
var legend = "_1qote9cr";
|
|
166
|
+
var legendItem = "_1qote9cs";
|
|
167
|
+
var swatch = "_1qote9ct";
|
|
168
|
+
var filterPanel = "_1qote9cu";
|
|
169
|
+
var filterGroup = "_1qote9cv";
|
|
170
|
+
var filterLegend = "_1qote9cw";
|
|
171
|
+
var filterOption = "_1qote9cx";
|
|
172
|
+
var checkbox = "_1qote9cy xk03iz2";
|
|
173
|
+
var button = "_1qote9cz xk03iz2";
|
|
174
|
+
var detailPanel = "_1qote9c10";
|
|
175
|
+
var detailHeading = "_1qote9c11";
|
|
176
|
+
var detailReason = "_1qote9c12";
|
|
177
|
+
var detailSectionHeading = "_1qote9c13";
|
|
178
|
+
var detailList = "_1qote9c14";
|
|
179
|
+
/** The class that assigns each shipped theme. */
|
|
180
|
+
var themes = {
|
|
181
|
+
light: lightTheme,
|
|
182
|
+
dark: darkTheme
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Applies a theme to everything inside it: assigns the theme contract's values and sets the page colours and type the components inherit. A consumer with its own theme puts its own `createTheme` class and `surfaceRoot` on an element instead.
|
|
186
|
+
* @param props - The theme and its content.
|
|
187
|
+
* @returns A `div` carrying the theme class and `data-theme`.
|
|
188
|
+
*/
|
|
189
|
+
var GraphTheme = (props) => {
|
|
190
|
+
const { theme, children } = props;
|
|
191
|
+
return /* @__PURE__ */ jsx("div", {
|
|
192
|
+
className: `${themes[theme]} ${surfaceRoot}`,
|
|
193
|
+
"data-theme": theme,
|
|
194
|
+
children
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* A status badge in the status's colour.
|
|
199
|
+
* @param props - The status.
|
|
200
|
+
* @returns The badge.
|
|
201
|
+
*/
|
|
202
|
+
var StatusBadge = (props) => {
|
|
203
|
+
const { status } = props;
|
|
204
|
+
return /* @__PURE__ */ jsx(StatusBadge$1, {
|
|
205
|
+
status,
|
|
206
|
+
className: badge({ status })
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* An element card with its status colour, its kind's shape, the critical path ring and the selection outline.
|
|
211
|
+
* @param props - As for the headless `ElementCard`, without class names.
|
|
212
|
+
* @returns The card.
|
|
213
|
+
*/
|
|
214
|
+
var ElementCard = (props) => {
|
|
215
|
+
const { element, status, critical = false } = props;
|
|
216
|
+
return /* @__PURE__ */ jsx(ElementCard$1, {
|
|
217
|
+
...props,
|
|
218
|
+
classNames: {
|
|
219
|
+
root: card({
|
|
220
|
+
status,
|
|
221
|
+
kind: element.kind,
|
|
222
|
+
critical
|
|
223
|
+
}),
|
|
224
|
+
label: cardLabel,
|
|
225
|
+
status: badge({ status }),
|
|
226
|
+
critical: criticalMarker,
|
|
227
|
+
blockers: blockersNote
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* A transition, coloured as a hand-off or on the critical path.
|
|
233
|
+
* @param props - As for the headless `TransitionItem`, without class names.
|
|
234
|
+
* @returns An `li`.
|
|
235
|
+
*/
|
|
236
|
+
var TransitionItem = (props) => /* @__PURE__ */ jsx(TransitionItem$1, {
|
|
237
|
+
...props,
|
|
238
|
+
classNames: {
|
|
239
|
+
root: transition,
|
|
240
|
+
from: transitionEnd,
|
|
241
|
+
to: transitionEnd
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
/**
|
|
245
|
+
* A bordered swimlane with a small heading.
|
|
246
|
+
* @param props - As for the headless `Lane`, without class names.
|
|
247
|
+
* @returns The lane.
|
|
248
|
+
*/
|
|
249
|
+
var Lane = (props) => /* @__PURE__ */ jsx(Lane$1, {
|
|
250
|
+
...props,
|
|
251
|
+
classNames: {
|
|
252
|
+
root: lane,
|
|
253
|
+
heading: laneHeading,
|
|
254
|
+
body: laneBody
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
/**
|
|
258
|
+
* A legend with a coloured swatch per status.
|
|
259
|
+
* @param props - As for the headless `Legend`, without class names.
|
|
260
|
+
* @returns The legend.
|
|
261
|
+
*/
|
|
262
|
+
var Legend = (props) => /* @__PURE__ */ jsx(Legend$1, {
|
|
263
|
+
...props,
|
|
264
|
+
classNames: {
|
|
265
|
+
root: legend,
|
|
266
|
+
item: legendItem,
|
|
267
|
+
swatch
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
/**
|
|
271
|
+
* A filter panel of bordered checkbox groups.
|
|
272
|
+
* @param props - As for the headless `FilterPanel`, without class names.
|
|
273
|
+
* @returns The form.
|
|
274
|
+
*/
|
|
275
|
+
var FilterPanel = (props) => /* @__PURE__ */ jsx(FilterPanel$1, {
|
|
276
|
+
...props,
|
|
277
|
+
classNames: {
|
|
278
|
+
root: filterPanel,
|
|
279
|
+
group: filterGroup,
|
|
280
|
+
legend: filterLegend,
|
|
281
|
+
option: filterOption,
|
|
282
|
+
checkbox,
|
|
283
|
+
clear: button
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
/**
|
|
287
|
+
* A detail panel on a raised surface.
|
|
288
|
+
* @param props - As for the headless `DetailPanel`, without class names.
|
|
289
|
+
* @returns The panel.
|
|
290
|
+
*/
|
|
291
|
+
var DetailPanel = (props) => {
|
|
292
|
+
const { explanation } = props;
|
|
293
|
+
return /* @__PURE__ */ jsx(DetailPanel$1, {
|
|
294
|
+
...props,
|
|
295
|
+
classNames: {
|
|
296
|
+
root: detailPanel,
|
|
297
|
+
heading: detailHeading,
|
|
298
|
+
status: badge({ status: explanation.status }),
|
|
299
|
+
reason: detailReason,
|
|
300
|
+
sectionHeading: detailSectionHeading,
|
|
301
|
+
list: detailList
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
var sequenceFigure = "_1y9ef240";
|
|
306
|
+
var sequenceCaption = "_1y9ef241";
|
|
307
|
+
var sequenceSvg = "_1y9ef242";
|
|
308
|
+
var lifelineHead = "_1y9ef243";
|
|
309
|
+
var lifelineLine = "_1y9ef244";
|
|
310
|
+
var diagramText = "_1y9ef245";
|
|
311
|
+
var messageLabel = "_1y9ef246";
|
|
312
|
+
var messageLine = "_1y9ef247";
|
|
313
|
+
var arrowFilled = "_1y9ef248";
|
|
314
|
+
var arrowOpen = "_1y9ef249";
|
|
315
|
+
var fragmentFrame = "_1y9ef24a";
|
|
316
|
+
var fragmentDivider = "_1y9ef24b";
|
|
317
|
+
var fragmentTag = "_1y9ef24c";
|
|
318
|
+
/** The unit every dimension below is a multiple of: the same grid `graph-layout` places nodes on, so a sequence diagram and a laid-out view share a scale. One unit is also the gap between a label and its arrow, the inset of each level of fragment nesting, and the size of an arrowhead. */
|
|
319
|
+
var GRID = 8;
|
|
320
|
+
/** Each dimension of the drawing, in grid units. */
|
|
321
|
+
var units = {
|
|
322
|
+
/** The space around the drawing. */
|
|
323
|
+
margin: 2,
|
|
324
|
+
/** A lifeline's head: wide enough for a participant's name on one line. */
|
|
325
|
+
headWidth: 16,
|
|
326
|
+
headHeight: 5,
|
|
327
|
+
/** The distance between neighbouring lifelines: a head's width plus room for a message label between them. */
|
|
328
|
+
lifelineGap: 20,
|
|
329
|
+
/** One message, or a fragment's heading, per row: room for a label above the arrow. */
|
|
330
|
+
row: 6,
|
|
331
|
+
/** A self-message's loop: how far it reaches to the right of its lifeline, and how far it drops before returning. */
|
|
332
|
+
selfReach: 4,
|
|
333
|
+
selfDrop: 2,
|
|
334
|
+
/** A fragment's operator tag. */
|
|
335
|
+
tagWidth: 6,
|
|
336
|
+
tagHeight: 3
|
|
337
|
+
};
|
|
338
|
+
var MARGIN = units.margin * GRID;
|
|
339
|
+
var HEAD_WIDTH = units.headWidth * GRID;
|
|
340
|
+
var HEAD_HEIGHT = units.headHeight * GRID;
|
|
341
|
+
var LIFELINE_GRID = units.lifelineGap * GRID;
|
|
342
|
+
var ROW = units.row * GRID;
|
|
343
|
+
var SELF_REACH = units.selfReach * GRID;
|
|
344
|
+
var SELF_DROP = units.selfDrop * GRID;
|
|
345
|
+
var TAG_WIDTH = units.tagWidth * GRID;
|
|
346
|
+
var TAG_HEIGHT = units.tagHeight * GRID;
|
|
347
|
+
/** A text baseline sits this far below the middle of the box it is centred in, so the glyphs look centred. */
|
|
348
|
+
var BASELINE_DROP = GRID / 2;
|
|
349
|
+
/**
|
|
350
|
+
* Gives each message a row and each fragment the rows it spans. A fragment takes a row of its own for its tag and first guard, and another for each later operand's guard, so no label overlaps an arrow.
|
|
351
|
+
*/
|
|
352
|
+
var place = (items) => {
|
|
353
|
+
const messages = [];
|
|
354
|
+
const fragments = [];
|
|
355
|
+
let row = 0;
|
|
356
|
+
const walk = (level, depth) => {
|
|
357
|
+
for (const item of level) {
|
|
358
|
+
if (item.kind === "message") {
|
|
359
|
+
row += 1;
|
|
360
|
+
messages.push({
|
|
361
|
+
message: item.message,
|
|
362
|
+
y: row * ROW
|
|
363
|
+
});
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
const top = row * ROW + ROW / 2;
|
|
367
|
+
const operands = [];
|
|
368
|
+
for (const operand of item.operands) {
|
|
369
|
+
row += 1;
|
|
370
|
+
operands.push({
|
|
371
|
+
...operand.guard === void 0 ? {} : { guard: operand.guard },
|
|
372
|
+
y: row * ROW
|
|
373
|
+
});
|
|
374
|
+
walk(operand.items, depth + 1);
|
|
375
|
+
}
|
|
376
|
+
fragments.push({
|
|
377
|
+
operator: item.operator,
|
|
378
|
+
depth,
|
|
379
|
+
top,
|
|
380
|
+
bottom: row * ROW + ROW / 2,
|
|
381
|
+
operands
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
walk(items, 0);
|
|
386
|
+
return {
|
|
387
|
+
messages,
|
|
388
|
+
fragments,
|
|
389
|
+
rows: row + 1
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
var describeMessage = (message, labelOf) => `${labelOf(message.from)} to ${labelOf(message.to)}: ${message.label}`;
|
|
393
|
+
/** The text alternative: the items as nested lists, in scenario order. */
|
|
394
|
+
var Steps = (props) => {
|
|
395
|
+
const { items, labelOf } = props;
|
|
396
|
+
return /* @__PURE__ */ jsx("ol", { children: items.map((item) => item.kind === "message" ? /* @__PURE__ */ jsx("li", { children: describeMessage(item.message, labelOf) }, item.message.transition) : /* @__PURE__ */ jsxs("li", { children: [item.operator, /* @__PURE__ */ jsx("ol", { children: item.operands.map((operand, index) => /* @__PURE__ */ jsxs("li", { children: [operand.guard === void 0 ? "" : `[${operand.guard}] `, /* @__PURE__ */ jsx(Steps, {
|
|
397
|
+
items: operand.items,
|
|
398
|
+
labelOf
|
|
399
|
+
})] }, index)) })] }, item.fragment ?? item.element)) });
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* A sequence diagram drawn as SVG: a lifeline per actor in order of first appearance, a message per row as an arrow between lifelines (a loop for a self-message, dashed for a reply, an open head for an asynchronous message), and each fragment as a frame with its operator and operand guards. React Flow has no lifeline layout, so the arrangement is fixed by the diagram's own order. The drawing is hidden from assistive technology, which reads the same steps from a visually hidden list instead.
|
|
403
|
+
* @param props - The diagram, the lifelines' names and a caption.
|
|
404
|
+
* @returns A `figure` holding the caption, the drawing and its text alternative.
|
|
405
|
+
*/
|
|
406
|
+
var SequenceDiagram = (props) => {
|
|
407
|
+
const { diagram, labelOf, title } = props;
|
|
408
|
+
const id = useId();
|
|
409
|
+
const caption = `${id}-caption`;
|
|
410
|
+
const filled = `${id}-filled`;
|
|
411
|
+
const open = `${id}-open`;
|
|
412
|
+
const { messages, fragments, rows } = place(diagram.items);
|
|
413
|
+
const xOf = new Map(diagram.lifelines.map((actor, index) => [actor, MARGIN + HEAD_WIDTH / 2 + index * LIFELINE_GRID]));
|
|
414
|
+
const at = (actor) => {
|
|
415
|
+
const x = xOf.get(actor);
|
|
416
|
+
if (x === void 0) throw new Error(`"${actor}" sends or receives a message but has no lifeline`);
|
|
417
|
+
return x;
|
|
418
|
+
};
|
|
419
|
+
const width = 2 * MARGIN + HEAD_WIDTH + Math.max(diagram.lifelines.length - 1, 0) * LIFELINE_GRID;
|
|
420
|
+
const top = MARGIN + HEAD_HEIGHT;
|
|
421
|
+
const height = top + rows * ROW + MARGIN;
|
|
422
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
423
|
+
className: sequenceFigure,
|
|
424
|
+
"aria-labelledby": caption,
|
|
425
|
+
children: [
|
|
426
|
+
/* @__PURE__ */ jsx("figcaption", {
|
|
427
|
+
id: caption,
|
|
428
|
+
className: sequenceCaption,
|
|
429
|
+
children: title
|
|
430
|
+
}),
|
|
431
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
432
|
+
"aria-hidden": "true",
|
|
433
|
+
className: sequenceSvg,
|
|
434
|
+
width,
|
|
435
|
+
height,
|
|
436
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsx("marker", {
|
|
439
|
+
id: filled,
|
|
440
|
+
viewBox: `0 0 ${GRID} ${GRID}`,
|
|
441
|
+
refX: GRID,
|
|
442
|
+
refY: GRID / 2,
|
|
443
|
+
markerWidth: GRID,
|
|
444
|
+
markerHeight: GRID,
|
|
445
|
+
orient: "auto-start-reverse",
|
|
446
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
447
|
+
className: arrowFilled,
|
|
448
|
+
d: `M 0 0 L ${GRID} ${GRID / 2} L 0 ${GRID} z`
|
|
449
|
+
})
|
|
450
|
+
}), /* @__PURE__ */ jsx("marker", {
|
|
451
|
+
id: open,
|
|
452
|
+
viewBox: `0 0 ${GRID} ${GRID}`,
|
|
453
|
+
refX: GRID,
|
|
454
|
+
refY: GRID / 2,
|
|
455
|
+
markerWidth: GRID,
|
|
456
|
+
markerHeight: GRID,
|
|
457
|
+
orient: "auto-start-reverse",
|
|
458
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
459
|
+
className: arrowOpen,
|
|
460
|
+
d: `M 0 0 L ${GRID} ${GRID / 2} L 0 ${GRID}`
|
|
461
|
+
})
|
|
462
|
+
})] }),
|
|
463
|
+
fragments.map((fragment) => {
|
|
464
|
+
const inset = MARGIN / 2 + fragment.depth * GRID;
|
|
465
|
+
const y = top + fragment.top;
|
|
466
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
467
|
+
"data-fragment": fragment.operator,
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ jsx("rect", {
|
|
470
|
+
className: fragmentFrame,
|
|
471
|
+
x: inset,
|
|
472
|
+
y,
|
|
473
|
+
width: width - 2 * inset,
|
|
474
|
+
height: fragment.bottom - fragment.top
|
|
475
|
+
}),
|
|
476
|
+
/* @__PURE__ */ jsx("rect", {
|
|
477
|
+
className: fragmentTag,
|
|
478
|
+
x: inset,
|
|
479
|
+
y,
|
|
480
|
+
width: TAG_WIDTH,
|
|
481
|
+
height: TAG_HEIGHT
|
|
482
|
+
}),
|
|
483
|
+
/* @__PURE__ */ jsx("text", {
|
|
484
|
+
className: diagramText,
|
|
485
|
+
x: inset + TAG_WIDTH / 2,
|
|
486
|
+
y: y + TAG_HEIGHT / 2 + BASELINE_DROP,
|
|
487
|
+
textAnchor: "middle",
|
|
488
|
+
children: fragment.operator
|
|
489
|
+
}),
|
|
490
|
+
fragment.operands.map((operand, index) => /* @__PURE__ */ jsxs("g", { children: [index === 0 ? null : /* @__PURE__ */ jsx("line", {
|
|
491
|
+
className: fragmentDivider,
|
|
492
|
+
x1: inset,
|
|
493
|
+
x2: width - inset,
|
|
494
|
+
y1: top + operand.y - ROW / 2,
|
|
495
|
+
y2: top + operand.y - ROW / 2
|
|
496
|
+
}), operand.guard === void 0 ? null : /* @__PURE__ */ jsxs("text", {
|
|
497
|
+
className: messageLabel,
|
|
498
|
+
x: inset + TAG_WIDTH + GRID,
|
|
499
|
+
y: top + operand.y - ROW / 2 + TAG_HEIGHT / 2 + BASELINE_DROP,
|
|
500
|
+
children: [
|
|
501
|
+
"[",
|
|
502
|
+
operand.guard,
|
|
503
|
+
"]"
|
|
504
|
+
]
|
|
505
|
+
})] }, operand.y))
|
|
506
|
+
]
|
|
507
|
+
}, `${fragment.operator}-${fragment.top}`);
|
|
508
|
+
}),
|
|
509
|
+
diagram.lifelines.map((actor) => {
|
|
510
|
+
const x = at(actor);
|
|
511
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
512
|
+
"data-lifeline": actor,
|
|
513
|
+
children: [
|
|
514
|
+
/* @__PURE__ */ jsx("line", {
|
|
515
|
+
className: lifelineLine,
|
|
516
|
+
x1: x,
|
|
517
|
+
x2: x,
|
|
518
|
+
y1: top,
|
|
519
|
+
y2: height - MARGIN
|
|
520
|
+
}),
|
|
521
|
+
/* @__PURE__ */ jsx("rect", {
|
|
522
|
+
className: lifelineHead,
|
|
523
|
+
x: x - HEAD_WIDTH / 2,
|
|
524
|
+
y: MARGIN,
|
|
525
|
+
width: HEAD_WIDTH,
|
|
526
|
+
height: HEAD_HEIGHT
|
|
527
|
+
}),
|
|
528
|
+
/* @__PURE__ */ jsx("text", {
|
|
529
|
+
className: diagramText,
|
|
530
|
+
x,
|
|
531
|
+
y: MARGIN + HEAD_HEIGHT / 2 + BASELINE_DROP,
|
|
532
|
+
textAnchor: "middle",
|
|
533
|
+
children: labelOf(actor)
|
|
534
|
+
})
|
|
535
|
+
]
|
|
536
|
+
}, actor);
|
|
537
|
+
}),
|
|
538
|
+
messages.map(({ message, y: row }) => {
|
|
539
|
+
const from = at(message.from);
|
|
540
|
+
const to = at(message.to);
|
|
541
|
+
const y = top + row;
|
|
542
|
+
const mode = message.mode ?? "sync";
|
|
543
|
+
const marker = `url(#${mode === "sync" ? filled : open})`;
|
|
544
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
545
|
+
"data-transition-id": message.transition,
|
|
546
|
+
"data-mode": mode,
|
|
547
|
+
children: [from === to ? /* @__PURE__ */ jsx("path", {
|
|
548
|
+
className: messageLine,
|
|
549
|
+
"data-mode": mode,
|
|
550
|
+
d: `M ${from} ${y} h ${SELF_REACH} v ${SELF_DROP} h ${-SELF_REACH}`,
|
|
551
|
+
markerEnd: marker
|
|
552
|
+
}) : /* @__PURE__ */ jsx("line", {
|
|
553
|
+
className: messageLine,
|
|
554
|
+
"data-mode": mode,
|
|
555
|
+
x1: from,
|
|
556
|
+
x2: to,
|
|
557
|
+
y1: y,
|
|
558
|
+
y2: y,
|
|
559
|
+
markerEnd: marker
|
|
560
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
561
|
+
className: messageLabel,
|
|
562
|
+
x: from === to ? from + SELF_REACH + GRID : (from + to) / 2,
|
|
563
|
+
y: y - GRID,
|
|
564
|
+
textAnchor: from === to ? "start" : "middle",
|
|
565
|
+
children: message.label
|
|
566
|
+
})]
|
|
567
|
+
}, message.transition);
|
|
568
|
+
})
|
|
569
|
+
]
|
|
570
|
+
}),
|
|
571
|
+
/* @__PURE__ */ jsx("div", {
|
|
572
|
+
className: visuallyHidden,
|
|
573
|
+
children: /* @__PURE__ */ jsx(Steps, {
|
|
574
|
+
items: diagram.items,
|
|
575
|
+
labelOf
|
|
576
|
+
})
|
|
577
|
+
})
|
|
578
|
+
]
|
|
579
|
+
});
|
|
580
|
+
};
|
|
581
|
+
//#endregion
|
|
582
|
+
export { surfaceRoot as _, Lane as a, visuallyHidden as b, StatusBadge as c, card as d, darkTheme as f, lightValues as g, lightTheme as h, GraphTheme as i, TransitionItem as l, focusRing as m, ElementCard as n, Legend as o, darkValues as p, FilterPanel as r, SequenceDiagram as s, DetailPanel as t, badge as u, themes as v, vars as y };
|