dishui 0.0.49 → 0.0.50

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 (52) hide show
  1. package/dist/components/pro/Flow/Flow.js +419 -407
  2. package/dist/components/pro/Flow/Flow.js.map +1 -1
  3. package/dist/components/pro/Flow/archify/build.d.ts +74 -0
  4. package/dist/components/pro/Flow/archify/build.js +103 -0
  5. package/dist/components/pro/Flow/archify/build.js.map +1 -0
  6. package/dist/components/pro/Flow/archify/convert.d.ts +14 -0
  7. package/dist/components/pro/Flow/archify/convert.js +534 -0
  8. package/dist/components/pro/Flow/archify/convert.js.map +1 -0
  9. package/dist/components/pro/Flow/archify/index.d.ts +12 -0
  10. package/dist/components/pro/Flow/archify/palette.d.ts +64 -0
  11. package/dist/components/pro/Flow/archify/palette.js +112 -0
  12. package/dist/components/pro/Flow/archify/palette.js.map +1 -0
  13. package/dist/components/pro/Flow/archify/presets.d.ts +26 -0
  14. package/dist/components/pro/Flow/archify/presets.js +43 -0
  15. package/dist/components/pro/Flow/archify/presets.js.map +1 -0
  16. package/dist/components/pro/Flow/archify/spec.d.ts +283 -0
  17. package/dist/components/pro/Flow/archify/spec.js +10 -0
  18. package/dist/components/pro/Flow/archify/spec.js.map +1 -0
  19. package/dist/components/pro/Flow/constants.js +14 -0
  20. package/dist/components/pro/Flow/constants.js.map +1 -1
  21. package/dist/components/pro/Flow/hooks/useClipboard.d.ts +5 -0
  22. package/dist/components/pro/Flow/hooks/useClipboard.js +129 -73
  23. package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
  24. package/dist/components/pro/Flow/hooks/useFlowImportExport.d.ts +1 -0
  25. package/dist/components/pro/Flow/hooks/useFlowImportExport.js +108 -93
  26. package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
  27. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.d.ts +1 -0
  28. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js +7 -7
  29. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
  30. package/dist/components/pro/Flow/index.d.ts +2 -0
  31. package/dist/components/pro/Flow/nodes/DataNodeView.d.ts +4 -1
  32. package/dist/components/pro/Flow/nodes/DataNodeView.js +127 -115
  33. package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
  34. package/dist/components/pro/Flow/nodes/MediaContent.js +72 -67
  35. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  36. package/dist/components/pro/Flow/nodes/NodeRenderer.d.ts +5 -0
  37. package/dist/components/pro/Flow/nodes/NodeRenderer.js +216 -115
  38. package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
  39. package/dist/components/pro/Flow/panels/FlowToolbar.js +208 -169
  40. package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
  41. package/dist/components/pro/Flow/panels/InspectorPanel.js +602 -369
  42. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  43. package/dist/components/pro/Flow/panels/ShapePalette.js +50 -39
  44. package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
  45. package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +1 -0
  46. package/dist/components/pro/Flow/panels/toolbarIcons.js +36 -8
  47. package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
  48. package/dist/components/pro/Flow/types.d.ts +30 -0
  49. package/dist/components/pro/Flow/types.js.map +1 -1
  50. package/dist/dishui.css +1 -1
  51. package/dist/flow.js +73 -56
  52. package/package.json +18 -17
@@ -0,0 +1,534 @@
1
+ import { ROOT_CANVAS_ID as B } from "../constants.js";
2
+ import { ARCHIFY_LANE_STROKE as X, ARCHIFY_TEXT_MUTED as H, componentStyle as _, messageEdgeStyle as A, stateStyle as E, variantEdgeStyle as k } from "./palette.js";
3
+ import { card as I, edge as z, frame as W, sideHandle as v, uid as M } from "./build.js";
4
+ function T(n) {
5
+ return n.meta?.animation === "trace";
6
+ }
7
+ var R = {
8
+ origin: [40, 80],
9
+ cols: 4,
10
+ gapX: 30,
11
+ gapY: 40,
12
+ cellW: 130,
13
+ cellH: 64
14
+ };
15
+ function O(n) {
16
+ const m = T(n), r = {
17
+ ...R,
18
+ ...n.layout ?? {}
19
+ }, h = [], x = [], y = /* @__PURE__ */ new Map();
20
+ for (const o of n.components) {
21
+ let i, e;
22
+ if (Array.isArray(o.pos)) [i, e] = o.pos;
23
+ else if (Number.isInteger(o.row) && Number.isInteger(o.col)) {
24
+ const d = r.cellW + r.gapX, b = r.cellH + r.gapY;
25
+ i = r.origin[0] + (o.col ?? 0) * d, e = r.origin[1] + (o.row ?? 0) * b;
26
+ } else
27
+ i = r.origin[0], e = r.origin[1];
28
+ const l = o.size?.[0] ?? r.cellW, t = o.size?.[1] ?? r.cellH;
29
+ y.set(o.id, {
30
+ x: i,
31
+ y: e,
32
+ w: l,
33
+ h: t
34
+ });
35
+ const s = _(o.type);
36
+ h.push(I({
37
+ id: o.id,
38
+ x: i,
39
+ y: e,
40
+ width: l,
41
+ height: t,
42
+ label: o.label,
43
+ sublabel: o.sublabel,
44
+ tag: o.tag,
45
+ fill: s.fill,
46
+ stroke: s.stroke,
47
+ text: s.text,
48
+ sub: s.sub
49
+ }));
50
+ }
51
+ for (const [o, i] of (n.boundaries ?? []).entries()) {
52
+ const e = i.wraps.map((a) => y.get(a)).filter(Boolean);
53
+ if (e.length === 0) continue;
54
+ const l = i.pad ?? 26, t = Math.min(...e.map((a) => a.x)) - l, s = Math.min(...e.map((a) => a.y)) - l - 14, d = Math.max(...e.map((a) => a.x + a.w)) + l, b = Math.max(...e.map((a) => a.y + a.h)) + l;
55
+ h.push(W({
56
+ id: `boundary_${o}_${M("b")}`,
57
+ x: t,
58
+ y: s,
59
+ width: d - t,
60
+ height: b - s,
61
+ label: i.label,
62
+ stroke: i.kind === "security-group" ? "#fb7185" : X,
63
+ borderStyle: "dashed",
64
+ labelColor: i.kind === "security-group" ? "#fb7185" : H,
65
+ zIndex: -10 + o
66
+ }));
67
+ }
68
+ for (const o of n.connections ?? []) {
69
+ const i = k(o.variant);
70
+ x.push(z({
71
+ id: o.id,
72
+ source: o.from,
73
+ target: o.to,
74
+ sourceHandle: v(o.fromSide),
75
+ targetHandle: v(o.toSide),
76
+ label: o.label,
77
+ color: i.color,
78
+ width: o.width ?? i.width,
79
+ lineStyle: i.lineStyle,
80
+ animated: m,
81
+ waypoints: o.via?.map(([e, l]) => ({
82
+ x: e,
83
+ y: l
84
+ }))
85
+ }));
86
+ }
87
+ return $(h, x, [], n.meta.title);
88
+ }
89
+ var c = {
90
+ laneX: 40,
91
+ laneY: 52,
92
+ laneW: 640,
93
+ laneH: 104,
94
+ laneGap: 20,
95
+ laneTitleH: 30,
96
+ colXs: [
97
+ 88,
98
+ 220,
99
+ 300,
100
+ 430,
101
+ 500,
102
+ 625
103
+ ],
104
+ nodeW: 92,
105
+ nodeH: 52
106
+ };
107
+ function P(n) {
108
+ const m = T(n), r = [], h = [], x = new Map(n.lanes.map((e, l) => [e.id, l])), y = (e) => c.laneY + (x.get(e) ?? 0) * (c.laneH + c.laneGap);
109
+ for (const e of n.lanes) {
110
+ const l = y(e.id);
111
+ r.push(W({
112
+ id: `lane_${e.id}`,
113
+ x: c.laneX,
114
+ y: l,
115
+ width: c.laneW,
116
+ height: c.laneH,
117
+ label: e.label,
118
+ stroke: e.variant === "exception" ? "#fb7185" : X,
119
+ labelColor: e.variant === "exception" ? "#fb7185" : H,
120
+ zIndex: -20
121
+ }));
122
+ }
123
+ for (const [e, l] of (n.phases ?? []).entries()) {
124
+ const t = c.colXs[l.fromCol] - c.nodeW / 2 - 12, s = c.colXs[l.toCol] + c.nodeW / 2 + 12;
125
+ r.push(W({
126
+ id: `phase_${l.id}`,
127
+ x: t,
128
+ y: c.laneY - 34,
129
+ width: s - t,
130
+ height: 26,
131
+ label: l.label,
132
+ stroke: k(l.variant).color,
133
+ labelColor: H,
134
+ borderStyle: "none",
135
+ zIndex: -15 + e
136
+ }));
137
+ }
138
+ for (const [e, l] of (n.groups ?? []).entries()) {
139
+ const t = y(l.lane), s = c.colXs[l.fromCol] - c.nodeW / 2 - 8, d = c.colXs[l.toCol] + c.nodeW / 2 + 8;
140
+ r.push(W({
141
+ id: `wfgroup_${l.id}`,
142
+ x: s,
143
+ y: t + c.laneTitleH - 6,
144
+ width: d - s,
145
+ height: c.laneH - c.laneTitleH,
146
+ label: l.label,
147
+ stroke: k(l.variant).color,
148
+ labelColor: H,
149
+ borderStyle: "dashed",
150
+ zIndex: -12 + e
151
+ }));
152
+ }
153
+ for (const e of n.nodes) {
154
+ const l = e.width ?? c.nodeW, t = e.height ?? (e.tag ? 68 : c.nodeH), s = c.colXs[e.col] ?? c.colXs[c.colXs.length - 1], d = c.laneH - c.laneTitleH, b = y(e.lane) + c.laneTitleH + (d - t) / 2 + (e.yOffset ?? 0), a = _(e.type);
155
+ r.push(I({
156
+ id: e.id,
157
+ x: s - l / 2,
158
+ y: b,
159
+ width: l,
160
+ height: t,
161
+ label: e.label,
162
+ sublabel: e.sublabel,
163
+ tag: e.tag,
164
+ fill: a.fill,
165
+ stroke: a.stroke,
166
+ text: a.text,
167
+ sub: a.sub,
168
+ fontSize: 12
169
+ }));
170
+ }
171
+ const o = /* @__PURE__ */ new Set(), i = n.mainPath ?? [];
172
+ for (let e = 0; e < i.length - 1; e++) o.add(`${i[e]}->${i[e + 1]}`);
173
+ for (const e of n.edges) {
174
+ const l = o.has(`${e.from}->${e.to}`), t = k(e.variant ?? (l ? "emphasis" : "default"));
175
+ h.push(z({
176
+ id: e.id,
177
+ source: e.from,
178
+ target: e.to,
179
+ sourceHandle: v(e.fromSide),
180
+ targetHandle: v(e.toSide),
181
+ label: e.label,
182
+ color: e.role === "error" ? "#fb7185" : t.color,
183
+ width: e.width ?? t.width,
184
+ lineStyle: e.role === "error" ? "dashed" : t.lineStyle,
185
+ animated: m && l,
186
+ waypoints: e.via?.map(([s, d]) => ({
187
+ x: s,
188
+ y: d
189
+ }))
190
+ }));
191
+ }
192
+ return $(r, h, [], n.meta.title);
193
+ }
194
+ function D(n) {
195
+ const m = [], r = [], h = [], x = n.meta.viewBox ?? [920, 760], y = 62, o = 86, i = 108, e = 72, l = 54, t = 142, s = x[1] - 65, d = (a) => y + a * i, b = /* @__PURE__ */ new Map();
196
+ n.participants.forEach((a, f) => {
197
+ const g = d(f);
198
+ b.set(a.id, g);
199
+ const p = _(a.type);
200
+ m.push(I({
201
+ id: a.id,
202
+ x: g - o / 2,
203
+ y: e,
204
+ width: o,
205
+ height: l,
206
+ label: a.label,
207
+ sublabel: a.sublabel,
208
+ fill: p.fill,
209
+ stroke: p.stroke,
210
+ text: p.text,
211
+ sub: p.sub,
212
+ fontSize: 11,
213
+ zIndex: 5
214
+ })), h.push({
215
+ id: `lifeline_${a.id}`,
216
+ type: "straight",
217
+ points: [{
218
+ x: g,
219
+ y: t
220
+ }, {
221
+ x: g,
222
+ y: s
223
+ }],
224
+ strokeColor: X,
225
+ strokeWidth: 1,
226
+ lineStyle: "dashed",
227
+ markerEnd: "none",
228
+ zIndex: -5
229
+ });
230
+ });
231
+ for (const [a, f] of (n.segments ?? []).entries()) m.push(W({
232
+ id: `segment_${a}`,
233
+ x: 48,
234
+ y: f.from,
235
+ width: x[0] - 96,
236
+ height: f.to - f.from,
237
+ label: f.label,
238
+ stroke: X,
239
+ labelColor: H,
240
+ borderStyle: "dashed",
241
+ zIndex: -10
242
+ }));
243
+ for (const [a, f] of (n.activations ?? []).entries()) {
244
+ const g = b.get(f.participant);
245
+ if (g === void 0) continue;
246
+ const p = _(f.type ?? "backend");
247
+ m.push({
248
+ id: `activation_${a}_${f.participant}`,
249
+ type: "shapeRect",
250
+ position: {
251
+ x: g - 5,
252
+ y: f.from
253
+ },
254
+ width: 10,
255
+ height: Math.max(6, f.to - f.from),
256
+ zIndex: 1,
257
+ data: {
258
+ label: "",
259
+ fill: p.fill,
260
+ stroke: p.stroke,
261
+ strokeWidth: 1,
262
+ color: p.text,
263
+ fontSize: 10,
264
+ borderStyle: "solid",
265
+ attributes: []
266
+ }
267
+ });
268
+ }
269
+ for (const a of n.messages) {
270
+ const f = b.get(a.from), g = b.get(a.to);
271
+ if (f === void 0 || g === void 0) continue;
272
+ const p = g > f ? 1 : -1, C = f + p * 7, S = g - p * 7, Y = A(a.variant);
273
+ h.push({
274
+ id: a.id ?? M("msg"),
275
+ type: "arrow",
276
+ points: [{
277
+ x: C,
278
+ y: a.y
279
+ }, {
280
+ x: S,
281
+ y: a.y
282
+ }],
283
+ strokeColor: Y.color,
284
+ strokeWidth: Y.width,
285
+ lineStyle: Y.lineStyle,
286
+ markerEnd: a.variant === "return" ? "arrow" : "arrowclosed",
287
+ zIndex: 3
288
+ }), m.push({
289
+ id: `mlabel_${a.id ?? M("m")}`,
290
+ type: "textLabel",
291
+ position: {
292
+ x: (C + S) / 2 - 70,
293
+ y: a.y - 22
294
+ },
295
+ width: 140,
296
+ height: 16,
297
+ zIndex: 4,
298
+ data: {
299
+ label: a.label,
300
+ fill: "transparent",
301
+ stroke: "transparent",
302
+ strokeWidth: 0,
303
+ color: Y.color,
304
+ labelColor: Y.color,
305
+ fontSize: 11,
306
+ attributes: []
307
+ }
308
+ });
309
+ }
310
+ return $(m, r, h, n.meta.title);
311
+ }
312
+ var w = {
313
+ stageY: 46,
314
+ stageH: 36,
315
+ stageBottomPad: 74,
316
+ leftX: 100,
317
+ colGap: 215,
318
+ stageW: 168,
319
+ nodeW: 112,
320
+ nodeH: 58,
321
+ rowYs: [
322
+ 128,
323
+ 242,
324
+ 356,
325
+ 470,
326
+ 584
327
+ ]
328
+ };
329
+ function G(n) {
330
+ const m = T(n), r = [], h = [], x = n.meta.viewBox ?? [940, 720], y = (o) => w.leftX + o * w.colGap;
331
+ for (const [o, i] of n.stages.entries()) r.push(W({
332
+ id: `stage_${o}`,
333
+ x: y(o) - w.stageW / 2,
334
+ y: w.stageY,
335
+ width: w.stageW,
336
+ height: x[1] - w.stageY - w.stageBottomPad,
337
+ label: i.label,
338
+ stroke: X,
339
+ labelColor: H,
340
+ borderStyle: "dashed",
341
+ zIndex: -10
342
+ }));
343
+ for (const o of n.nodes) {
344
+ const i = o.width ?? w.nodeW, e = o.height ?? w.nodeH, l = y(o.stage), t = (w.rowYs[o.row] ?? w.rowYs[w.rowYs.length - 1]) + (o.yOffset ?? 0), s = _(o.type);
345
+ r.push(I({
346
+ id: o.id,
347
+ x: l - i / 2,
348
+ y: t,
349
+ width: i,
350
+ height: e,
351
+ label: o.label,
352
+ sublabel: o.sublabel,
353
+ tag: o.tag,
354
+ fill: s.fill,
355
+ stroke: s.stroke,
356
+ text: s.text,
357
+ sub: s.sub,
358
+ fontSize: 12
359
+ }));
360
+ }
361
+ for (const o of n.flows) {
362
+ const i = k(o.variant);
363
+ h.push(z({
364
+ id: o.id,
365
+ source: o.from,
366
+ target: o.to,
367
+ sourceHandle: v(o.fromSide),
368
+ targetHandle: v(o.toSide),
369
+ label: o.label,
370
+ color: i.color,
371
+ width: o.width ?? i.width,
372
+ lineStyle: i.lineStyle,
373
+ animated: m && o.variant === "emphasis",
374
+ waypoints: o.via?.map(([e, l]) => ({
375
+ x: e,
376
+ y: l
377
+ }))
378
+ }));
379
+ }
380
+ return $(r, h, [], n.meta.title);
381
+ }
382
+ var u = {
383
+ phaseY: 126,
384
+ eventY: 278,
385
+ outcomeY: 450,
386
+ phaseW: 118,
387
+ phaseH: 62,
388
+ eventW: 126,
389
+ eventH: 58,
390
+ outcomeW: 118,
391
+ outcomeH: 58,
392
+ phaseXs: [
393
+ 94,
394
+ 248,
395
+ 402,
396
+ 556,
397
+ 710
398
+ ],
399
+ eventXs: [
400
+ 402,
401
+ 556,
402
+ 710
403
+ ],
404
+ outcomeXs: [
405
+ 402,
406
+ 556,
407
+ 710
408
+ ]
409
+ };
410
+ function L(n) {
411
+ return n === "main" ? "phase" : n === "terminal" ? "outcome" : "event";
412
+ }
413
+ function F(n) {
414
+ const m = T(n), r = [], h = [], x = n.meta.viewBox ?? [980, 660], y = new Map(n.lanes.map((t) => [t.id, t.label])), o = [
415
+ {
416
+ band: "phase",
417
+ y: u.phaseY - 26,
418
+ h: u.phaseH + 40,
419
+ label: y.get("main") ?? "Lifecycle phases"
420
+ },
421
+ {
422
+ band: "event",
423
+ y: u.eventY - 26,
424
+ h: u.eventH + 40,
425
+ label: "Interruptions + Recovery"
426
+ },
427
+ {
428
+ band: "outcome",
429
+ y: u.outcomeY - 26,
430
+ h: u.outcomeH + 40,
431
+ label: y.get("terminal") ?? "Terminal exits"
432
+ }
433
+ ];
434
+ for (const [t, s] of o.entries()) r.push(W({
435
+ id: `band_${s.band}`,
436
+ x: 40,
437
+ y: s.y,
438
+ width: x[0] - 80,
439
+ height: s.h,
440
+ label: `0${t + 1} / ${s.label}`,
441
+ stroke: X,
442
+ labelColor: H,
443
+ borderStyle: "dashed",
444
+ zIndex: -10
445
+ }));
446
+ for (const t of n.states) {
447
+ const s = L(t.lane), d = s === "phase", b = s === "outcome", a = t.width ?? (d ? u.phaseW : b ? u.outcomeW : u.eventW), f = t.height ?? (d ? u.phaseH : b ? u.outcomeH : u.eventH), g = d ? u.phaseXs : b ? u.outcomeXs : u.eventXs, p = g[t.col] ?? g[g.length - 1], C = (d ? u.phaseY : b ? u.outcomeY : u.eventY) + (t.yOffset ?? 0), S = E(t.type);
448
+ r.push(I({
449
+ id: t.id,
450
+ x: p - a / 2,
451
+ y: C,
452
+ width: a,
453
+ height: f,
454
+ label: t.label,
455
+ sublabel: t.sublabel,
456
+ tag: t.tag ?? t.step,
457
+ fill: S.fill,
458
+ stroke: S.stroke,
459
+ text: S.text,
460
+ sub: S.sub,
461
+ fontSize: 12
462
+ }));
463
+ }
464
+ const i = n.states.filter((t) => t.lane === "main").sort((t, s) => t.col - s.col), e = new Set(n.transitions.map((t) => `${t.from}->${t.to}`));
465
+ for (let t = 0; t < i.length - 1; t++) {
466
+ const s = i[t], d = i[t + 1];
467
+ e.has(`${s.id}->${d.id}`) || h.push(z({
468
+ id: `mainrail_${s.id}_${d.id}`,
469
+ source: s.id,
470
+ target: d.id,
471
+ sourceHandle: v("right"),
472
+ targetHandle: v("left"),
473
+ label: void 0,
474
+ color: k("emphasis").color,
475
+ width: 2.2,
476
+ lineStyle: "solid",
477
+ animated: m
478
+ }));
479
+ }
480
+ const l = /* @__PURE__ */ new Set();
481
+ for (let t = 0; t < i.length - 1; t++) l.add(`${i[t].id}->${i[t + 1].id}`);
482
+ for (const t of n.transitions) {
483
+ const s = k(t.variant), d = l.has(`${t.from}->${t.to}`);
484
+ h.push(z({
485
+ id: t.id,
486
+ source: t.from,
487
+ target: t.to,
488
+ sourceHandle: v(t.fromSide),
489
+ targetHandle: v(t.toSide),
490
+ label: t.label,
491
+ color: s.color,
492
+ width: t.width ?? s.width,
493
+ lineStyle: s.lineStyle,
494
+ animated: m && d,
495
+ waypoints: t.via?.map(([b, a]) => ({
496
+ x: b,
497
+ y: a
498
+ }))
499
+ }));
500
+ }
501
+ return $(r, h, [], n.meta.title);
502
+ }
503
+ function $(n, m, r, h) {
504
+ return {
505
+ canvases: { [B]: {
506
+ nodes: n,
507
+ edges: m,
508
+ lines: r
509
+ } },
510
+ stack: [B],
511
+ title: h
512
+ };
513
+ }
514
+ function U(n) {
515
+ switch (n.diagram_type) {
516
+ case "architecture":
517
+ return O(n);
518
+ case "workflow":
519
+ return P(n);
520
+ case "sequence":
521
+ return D(n);
522
+ case "dataflow":
523
+ return G(n);
524
+ case "lifecycle":
525
+ return F(n);
526
+ default:
527
+ return $([], [], []);
528
+ }
529
+ }
530
+ export {
531
+ U as archifyToFlowDocument
532
+ };
533
+
534
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.js","names":[],"sources":["../../../../../src/components/pro/Flow/archify/convert.ts"],"sourcesContent":["/**\n * Convert an Archify spec into a native Flow `FlowDocument`.\n *\n * One converter per diagram type reproduces Archify's fixed layout geometry\n * (constants copied from the reference renderers) so the imported diagram\n * matches the reference artifact, then emits editable Flow nodes/edges/lines.\n *\n * When `meta.animation === \"trace\"`, edges are marked `animated` so the Flow\n * presentation / preview mode plays the traveling gradient pulse.\n */\n\nimport type { FlowDocument, FlowNode, FlowEdge, FlowLine } from '../types';\nimport { ROOT_CANVAS_ID } from '../constants';\nimport type {\n ArchifySpec,\n ArchifyArchitectureSpec,\n ArchifyWorkflowSpec,\n ArchifySequenceSpec,\n ArchifyDataflowSpec,\n ArchifyLifecycleSpec,\n} from './spec';\nimport {\n ARCHIFY_LANE_STROKE,\n ARCHIFY_TEXT_MUTED,\n componentStyle,\n stateStyle,\n variantEdgeStyle,\n messageEdgeStyle,\n} from './palette';\nimport { card, frame, edge, sideHandle, uid } from './build';\n\nfunction isTrace(spec: ArchifySpec): boolean {\n return spec.meta?.animation === 'trace';\n}\n\n/* ========================================================================== */\n/* Architecture */\n/* ========================================================================== */\n\nconst ARCH_GRID = { origin: [40, 80], cols: 4, gapX: 30, gapY: 40, cellW: 130, cellH: 64 };\n\nfunction convertArchitecture(spec: ArchifyArchitectureSpec): FlowDocument {\n const trace = isTrace(spec);\n const grid = { ...ARCH_GRID, ...(spec.layout ?? {}) };\n const nodes: FlowNode[] = [];\n const edges: FlowEdge[] = [];\n\n const rect = new Map<string, { x: number; y: number; w: number; h: number }>();\n\n for (const c of spec.components) {\n let x: number;\n let y: number;\n if (Array.isArray(c.pos)) {\n [x, y] = c.pos;\n } else if (Number.isInteger(c.row) && Number.isInteger(c.col)) {\n const stepX = grid.cellW + grid.gapX;\n const stepY = grid.cellH + grid.gapY;\n x = grid.origin[0] + (c.col ?? 0) * stepX;\n y = grid.origin[1] + (c.row ?? 0) * stepY;\n } else {\n x = grid.origin[0];\n y = grid.origin[1];\n }\n const w = c.size?.[0] ?? grid.cellW;\n const h = c.size?.[1] ?? grid.cellH;\n rect.set(c.id, { x, y, w, h });\n const style = componentStyle(c.type);\n nodes.push(\n card({\n id: c.id,\n x,\n y,\n width: w,\n height: h,\n label: c.label,\n sublabel: c.sublabel,\n tag: c.tag,\n fill: style.fill,\n stroke: style.stroke,\n text: style.text,\n sub: style.sub,\n }),\n );\n }\n\n // Boundaries wrap their member components with padding, rendered behind.\n for (const [i, b] of (spec.boundaries ?? []).entries()) {\n const members = b.wraps.map((id) => rect.get(id)).filter(Boolean) as Array<{\n x: number;\n y: number;\n w: number;\n h: number;\n }>;\n if (members.length === 0) continue;\n const pad = b.pad ?? 26;\n const minX = Math.min(...members.map((m) => m.x)) - pad;\n const minY = Math.min(...members.map((m) => m.y)) - pad - 14;\n const maxX = Math.max(...members.map((m) => m.x + m.w)) + pad;\n const maxY = Math.max(...members.map((m) => m.y + m.h)) + pad;\n nodes.push(\n frame({\n id: `boundary_${i}_${uid('b')}`,\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY,\n label: b.label,\n stroke: b.kind === 'security-group' ? '#fb7185' : ARCHIFY_LANE_STROKE,\n borderStyle: 'dashed',\n labelColor: b.kind === 'security-group' ? '#fb7185' : ARCHIFY_TEXT_MUTED,\n zIndex: -10 + i,\n }),\n );\n }\n\n for (const conn of spec.connections ?? []) {\n const style = variantEdgeStyle(conn.variant);\n edges.push(\n edge({\n id: conn.id,\n source: conn.from,\n target: conn.to,\n sourceHandle: sideHandle(conn.fromSide),\n targetHandle: sideHandle(conn.toSide),\n label: conn.label,\n color: style.color,\n width: conn.width ?? style.width,\n lineStyle: style.lineStyle,\n animated: trace,\n waypoints: conn.via?.map(([x, y]) => ({ x, y })),\n }),\n );\n }\n\n return wrap(nodes, edges, [], spec.meta.title);\n}\n\n/* ========================================================================== */\n/* Workflow */\n/* ========================================================================== */\n\nconst WF = {\n laneX: 40,\n laneY: 52,\n laneW: 640,\n laneH: 104,\n laneGap: 20,\n laneTitleH: 30,\n colXs: [88, 220, 300, 430, 500, 625],\n nodeW: 92,\n nodeH: 52,\n};\n\nfunction convertWorkflow(spec: ArchifyWorkflowSpec): FlowDocument {\n const trace = isTrace(spec);\n const nodes: FlowNode[] = [];\n const edges: FlowEdge[] = [];\n\n const laneIndex = new Map(spec.lanes.map((l, i) => [l.id, i]));\n const laneTop = (id: string) =>\n WF.laneY + (laneIndex.get(id) ?? 0) * (WF.laneH + WF.laneGap);\n\n // Lane frames (behind everything).\n for (const lane of spec.lanes) {\n const top = laneTop(lane.id);\n nodes.push(\n frame({\n id: `lane_${lane.id}`,\n x: WF.laneX,\n y: top,\n width: WF.laneW,\n height: WF.laneH,\n label: lane.label,\n stroke: lane.variant === 'exception' ? '#fb7185' : ARCHIFY_LANE_STROKE,\n labelColor: lane.variant === 'exception' ? '#fb7185' : ARCHIFY_TEXT_MUTED,\n zIndex: -20,\n }),\n );\n }\n\n // Phase bands (thin frames spanning columns, drawn just above lanes).\n for (const [i, phase] of (spec.phases ?? []).entries()) {\n const x0 = WF.colXs[phase.fromCol] - WF.nodeW / 2 - 12;\n const x1 = WF.colXs[phase.toCol] + WF.nodeW / 2 + 12;\n nodes.push(\n frame({\n id: `phase_${phase.id}`,\n x: x0,\n y: WF.laneY - 34,\n width: x1 - x0,\n height: 26,\n label: phase.label,\n stroke: variantEdgeStyle(phase.variant).color,\n labelColor: ARCHIFY_TEXT_MUTED,\n borderStyle: 'none',\n zIndex: -15 + i,\n }),\n );\n }\n\n // Workflow groups (nested emphasis frames inside a lane).\n for (const [i, g] of (spec.groups ?? []).entries()) {\n const top = laneTop(g.lane);\n const x0 = WF.colXs[g.fromCol] - WF.nodeW / 2 - 8;\n const x1 = WF.colXs[g.toCol] + WF.nodeW / 2 + 8;\n nodes.push(\n frame({\n id: `wfgroup_${g.id}`,\n x: x0,\n y: top + WF.laneTitleH - 6,\n width: x1 - x0,\n height: WF.laneH - WF.laneTitleH,\n label: g.label,\n stroke: variantEdgeStyle(g.variant).color,\n labelColor: ARCHIFY_TEXT_MUTED,\n borderStyle: 'dashed',\n zIndex: -12 + i,\n }),\n );\n }\n\n for (const n of spec.nodes) {\n const width = n.width ?? WF.nodeW;\n const height = n.height ?? (n.tag ? 68 : WF.nodeH);\n const cx = WF.colXs[n.col] ?? WF.colXs[WF.colXs.length - 1];\n const contentH = WF.laneH - WF.laneTitleH;\n const y = laneTop(n.lane) + WF.laneTitleH + (contentH - height) / 2 + (n.yOffset ?? 0);\n const style = componentStyle(n.type);\n nodes.push(\n card({\n id: n.id,\n x: cx - width / 2,\n y,\n width,\n height,\n label: n.label,\n sublabel: n.sublabel,\n tag: n.tag,\n fill: style.fill,\n stroke: style.stroke,\n text: style.text,\n sub: style.sub,\n fontSize: 12,\n }),\n );\n }\n\n const mainPath = new Set<string>();\n const mp = spec.mainPath ?? [];\n for (let i = 0; i < mp.length - 1; i++) mainPath.add(`${mp[i]}->${mp[i + 1]}`);\n\n for (const e of spec.edges) {\n const onMain = mainPath.has(`${e.from}->${e.to}`);\n const style = variantEdgeStyle(e.variant ?? (onMain ? 'emphasis' : 'default'));\n edges.push(\n edge({\n id: e.id,\n source: e.from,\n target: e.to,\n sourceHandle: sideHandle(e.fromSide),\n targetHandle: sideHandle(e.toSide),\n label: e.label,\n color: e.role === 'error' ? '#fb7185' : style.color,\n width: e.width ?? style.width,\n lineStyle: e.role === 'error' ? 'dashed' : style.lineStyle,\n animated: trace && onMain,\n waypoints: e.via?.map(([x, y]) => ({ x, y })),\n }),\n );\n }\n\n return wrap(nodes, edges, [], spec.meta.title);\n}\n\n/* ========================================================================== */\n/* Sequence */\n/* ========================================================================== */\n\nfunction convertSequence(spec: ArchifySequenceSpec): FlowDocument {\n const nodes: FlowNode[] = [];\n const edges: FlowEdge[] = [];\n const lines: FlowLine[] = [];\n\n const viewBox = spec.meta.viewBox ?? [920, 760];\n const sideMargin = 62;\n const participantW = 86;\n const colGap = 108;\n const topY = 72;\n const participantH = 54;\n const lifelineTop = 142;\n const lifelineBottom = viewBox[1] - 65;\n\n const cx = (i: number) => sideMargin + i * colGap;\n const partX = new Map<string, number>();\n\n spec.participants.forEach((p, i) => {\n const x = cx(i);\n partX.set(p.id, x);\n const style = componentStyle(p.type);\n nodes.push(\n card({\n id: p.id,\n x: x - participantW / 2,\n y: topY,\n width: participantW,\n height: participantH,\n label: p.label,\n sublabel: p.sublabel,\n fill: style.fill,\n stroke: style.stroke,\n text: style.text,\n sub: style.sub,\n fontSize: 11,\n zIndex: 5,\n }),\n );\n // Lifeline (dashed vertical guide beneath each participant).\n lines.push({\n id: `lifeline_${p.id}`,\n type: 'straight',\n points: [\n { x, y: lifelineTop },\n { x, y: lifelineBottom },\n ],\n strokeColor: ARCHIFY_LANE_STROKE,\n strokeWidth: 1,\n lineStyle: 'dashed',\n markerEnd: 'none',\n zIndex: -5,\n });\n });\n\n // Segment frames (labelled bands over ranges of the timeline).\n for (const [i, seg] of (spec.segments ?? []).entries()) {\n nodes.push(\n frame({\n id: `segment_${i}`,\n x: 48,\n y: seg.from,\n width: viewBox[0] - 96,\n height: seg.to - seg.from,\n label: seg.label,\n stroke: ARCHIFY_LANE_STROKE,\n labelColor: ARCHIFY_TEXT_MUTED,\n borderStyle: 'dashed',\n zIndex: -10,\n }),\n );\n }\n\n // Activation bars (thin vertical rects on a participant lifeline).\n for (const [i, act] of (spec.activations ?? []).entries()) {\n const x = partX.get(act.participant);\n if (x === undefined) continue;\n const style = componentStyle(act.type ?? 'backend');\n nodes.push({\n id: `activation_${i}_${act.participant}`,\n type: 'shapeRect',\n position: { x: x - 5, y: act.from },\n width: 10,\n height: Math.max(6, act.to - act.from),\n zIndex: 1,\n data: {\n label: '',\n fill: style.fill,\n stroke: style.stroke,\n strokeWidth: 1,\n color: style.text,\n fontSize: 10,\n borderStyle: 'solid',\n attributes: [],\n },\n });\n }\n\n // Messages become horizontal arrow lines at their y with a label above.\n for (const m of spec.messages) {\n const fromX = partX.get(m.from);\n const toX = partX.get(m.to);\n if (fromX === undefined || toX === undefined) continue;\n const dir = toX > fromX ? 1 : -1;\n const start = fromX + dir * 7;\n const end = toX - dir * 7;\n const style = messageEdgeStyle(m.variant);\n lines.push({\n id: m.id ?? uid('msg'),\n type: 'arrow',\n points: [\n { x: start, y: m.y },\n { x: end, y: m.y },\n ],\n strokeColor: style.color,\n strokeWidth: style.width,\n lineStyle: style.lineStyle,\n markerEnd: m.variant === 'return' ? 'arrow' : 'arrowclosed',\n zIndex: 3,\n });\n // Label as a tiny transparent text node centered above the arrow.\n nodes.push({\n id: `mlabel_${m.id ?? uid('m')}`,\n type: 'textLabel',\n position: { x: (start + end) / 2 - 70, y: m.y - 22 },\n width: 140,\n height: 16,\n zIndex: 4,\n data: {\n label: m.label,\n fill: 'transparent',\n stroke: 'transparent',\n strokeWidth: 0,\n color: style.color,\n labelColor: style.color,\n fontSize: 11,\n attributes: [],\n },\n });\n }\n\n return wrap(nodes, edges, lines, spec.meta.title);\n}\n\n/* ========================================================================== */\n/* Dataflow */\n/* ========================================================================== */\n\nconst DF = {\n stageY: 46,\n stageH: 36,\n stageBottomPad: 74,\n leftX: 100,\n colGap: 215,\n stageW: 168,\n nodeW: 112,\n nodeH: 58,\n rowYs: [128, 242, 356, 470, 584],\n};\n\nfunction convertDataflow(spec: ArchifyDataflowSpec): FlowDocument {\n const trace = isTrace(spec);\n const nodes: FlowNode[] = [];\n const edges: FlowEdge[] = [];\n\n const viewBox = spec.meta.viewBox ?? [940, 720];\n const stageX = (i: number) => DF.leftX + i * DF.colGap;\n\n // Stage frames (tall vertical bands).\n for (const [i, stage] of spec.stages.entries()) {\n nodes.push(\n frame({\n id: `stage_${i}`,\n x: stageX(i) - DF.stageW / 2,\n y: DF.stageY,\n width: DF.stageW,\n height: viewBox[1] - DF.stageY - DF.stageBottomPad,\n label: stage.label,\n stroke: ARCHIFY_LANE_STROKE,\n labelColor: ARCHIFY_TEXT_MUTED,\n borderStyle: 'dashed',\n zIndex: -10,\n }),\n );\n }\n\n for (const n of spec.nodes) {\n const width = n.width ?? DF.nodeW;\n const height = n.height ?? DF.nodeH;\n const cx = stageX(n.stage);\n const y = (DF.rowYs[n.row] ?? DF.rowYs[DF.rowYs.length - 1]) + (n.yOffset ?? 0);\n const style = componentStyle(n.type);\n nodes.push(\n card({\n id: n.id,\n x: cx - width / 2,\n y,\n width,\n height,\n label: n.label,\n sublabel: n.sublabel,\n tag: n.tag,\n fill: style.fill,\n stroke: style.stroke,\n text: style.text,\n sub: style.sub,\n fontSize: 12,\n }),\n );\n }\n\n for (const f of spec.flows) {\n const style = variantEdgeStyle(f.variant);\n edges.push(\n edge({\n id: f.id,\n source: f.from,\n target: f.to,\n sourceHandle: sideHandle(f.fromSide),\n targetHandle: sideHandle(f.toSide),\n label: f.label,\n color: style.color,\n width: f.width ?? style.width,\n lineStyle: style.lineStyle,\n animated: trace && f.variant === 'emphasis',\n waypoints: f.via?.map(([x, y]) => ({ x, y })),\n }),\n );\n }\n\n return wrap(nodes, edges, [], spec.meta.title);\n}\n\n/* ========================================================================== */\n/* Lifecycle */\n/* ========================================================================== */\n\nconst LC = {\n phaseY: 126,\n eventY: 278,\n outcomeY: 450,\n phaseW: 118,\n phaseH: 62,\n eventW: 126,\n eventH: 58,\n outcomeW: 118,\n outcomeH: 58,\n phaseXs: [94, 248, 402, 556, 710],\n eventXs: [402, 556, 710],\n outcomeXs: [402, 556, 710],\n};\n\nfunction lifecycleBand(lane: string): 'phase' | 'event' | 'outcome' {\n if (lane === 'main') return 'phase';\n if (lane === 'terminal') return 'outcome';\n return 'event';\n}\n\nfunction convertLifecycle(spec: ArchifyLifecycleSpec): FlowDocument {\n const trace = isTrace(spec);\n const nodes: FlowNode[] = [];\n const edges: FlowEdge[] = [];\n\n const viewBox = spec.meta.viewBox ?? [980, 660];\n\n // Band frames give the three horizontal groupings some structure.\n const laneLabel = new Map(spec.lanes.map((l) => [l.id, l.label]));\n const bandRows: Array<{ band: 'phase' | 'event' | 'outcome'; y: number; h: number; label: string }> = [\n { band: 'phase', y: LC.phaseY - 26, h: LC.phaseH + 40, label: laneLabel.get('main') ?? 'Lifecycle phases' },\n { band: 'event', y: LC.eventY - 26, h: LC.eventH + 40, label: 'Interruptions + Recovery' },\n { band: 'outcome', y: LC.outcomeY - 26, h: LC.outcomeH + 40, label: laneLabel.get('terminal') ?? 'Terminal exits' },\n ];\n for (const [i, b] of bandRows.entries()) {\n nodes.push(\n frame({\n id: `band_${b.band}`,\n x: 40,\n y: b.y,\n width: viewBox[0] - 80,\n height: b.h,\n label: `0${i + 1} / ${b.label}`,\n stroke: ARCHIFY_LANE_STROKE,\n labelColor: ARCHIFY_TEXT_MUTED,\n borderStyle: 'dashed',\n zIndex: -10,\n }),\n );\n }\n\n for (const s of spec.states) {\n const band = lifecycleBand(s.lane);\n const isPhase = band === 'phase';\n const isOutcome = band === 'outcome';\n const width = s.width ?? (isPhase ? LC.phaseW : isOutcome ? LC.outcomeW : LC.eventW);\n const height = s.height ?? (isPhase ? LC.phaseH : isOutcome ? LC.outcomeH : LC.eventH);\n const xs = isPhase ? LC.phaseXs : isOutcome ? LC.outcomeXs : LC.eventXs;\n const cx = xs[s.col] ?? xs[xs.length - 1];\n const y = (isPhase ? LC.phaseY : isOutcome ? LC.outcomeY : LC.eventY) + (s.yOffset ?? 0);\n const style = stateStyle(s.type);\n nodes.push(\n card({\n id: s.id,\n x: cx - width / 2,\n y,\n width,\n height,\n label: s.label,\n sublabel: s.sublabel,\n tag: s.tag ?? s.step,\n fill: style.fill,\n stroke: style.stroke,\n text: style.text,\n sub: style.sub,\n fontSize: 12,\n }),\n );\n }\n\n // Order states along the main lane to build the primary rail. Archify draws\n // this rail decoratively (not as explicit transitions), so synthesize edges\n // between consecutive phase states, connecting right-to-left across columns.\n const mainStates = spec.states\n .filter((s) => s.lane === 'main')\n .sort((a, b) => a.col - b.col);\n const explicitPairs = new Set(spec.transitions.map((t) => `${t.from}->${t.to}`));\n for (let i = 0; i < mainStates.length - 1; i++) {\n const from = mainStates[i];\n const to = mainStates[i + 1];\n // Skip if the author already provided this exact transition.\n if (explicitPairs.has(`${from.id}->${to.id}`)) continue;\n edges.push(\n edge({\n id: `mainrail_${from.id}_${to.id}`,\n source: from.id,\n target: to.id,\n sourceHandle: sideHandle('right'),\n targetHandle: sideHandle('left'),\n label: undefined,\n color: variantEdgeStyle('emphasis').color,\n width: 2.2,\n lineStyle: 'solid',\n animated: trace,\n }),\n );\n }\n\n const mainPairs = new Set<string>();\n for (let i = 0; i < mainStates.length - 1; i++) {\n mainPairs.add(`${mainStates[i].id}->${mainStates[i + 1].id}`);\n }\n\n for (const t of spec.transitions) {\n const style = variantEdgeStyle(t.variant);\n const onMain = mainPairs.has(`${t.from}->${t.to}`);\n edges.push(\n edge({\n id: t.id,\n source: t.from,\n target: t.to,\n sourceHandle: sideHandle(t.fromSide),\n targetHandle: sideHandle(t.toSide),\n label: t.label,\n color: style.color,\n width: t.width ?? style.width,\n lineStyle: style.lineStyle,\n animated: trace && onMain,\n waypoints: t.via?.map(([x, y]) => ({ x, y })),\n }),\n );\n }\n\n return wrap(nodes, edges, [], spec.meta.title);\n}\n\n/* ========================================================================== */\n\nfunction wrap(\n nodes: FlowNode[],\n edges: FlowEdge[],\n lines: FlowLine[],\n title?: string,\n): FlowDocument {\n return {\n canvases: {\n [ROOT_CANVAS_ID]: { nodes, edges, lines },\n },\n stack: [ROOT_CANVAS_ID],\n title,\n };\n}\n\n/** Convert any supported Archify spec into a Flow document. */\nexport function archifyToFlowDocument(spec: ArchifySpec): FlowDocument {\n switch (spec.diagram_type) {\n case 'architecture':\n return convertArchitecture(spec);\n case 'workflow':\n return convertWorkflow(spec);\n case 'sequence':\n return convertSequence(spec);\n case 'dataflow':\n return convertDataflow(spec);\n case 'lifecycle':\n return convertLifecycle(spec);\n default:\n return wrap([], [], []);\n }\n}\n"],"mappings":";;;AA+BA,SAAS,EAAQ,GAA4B;AAC3C,SAAO,EAAK,MAAM,cAAc;AAClC;AAMA,IAAM,IAAY;AAAA,EAAE,QAAQ,CAAC,IAAI,EAAE;AAAA,EAAG,MAAM;AAAA,EAAG,MAAM;AAAA,EAAI,MAAM;AAAA,EAAI,OAAO;AAAA,EAAK,OAAO;AAAG;AAEzF,SAAS,EAAoB,GAA6C;AACxE,QAAM,IAAQ,EAAQ,CAAI,GACpB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AK;AACH,aAAO,EAAgB,CAAI;AAAA,IAC7B,KAAK;AACH,aAAO,EAAgB,CAAI;AAAA,IAC7B,KAAK;AACH,aAAO,EAAiB,CAAI;AAAA,IAC9B;AACE,aAAO,EAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAAA,EAC1B;AACF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Archify diagram support for the Flow canvas.
3
+ *
4
+ * Import an Archify spec (architecture / workflow / sequence / dataflow /
5
+ * lifecycle) and render it natively on the Flow canvas with Archify styling and
6
+ * optional trace motion (played in presentation / preview mode).
7
+ */
8
+ export type { ArchifySpec, ArchifyDiagramType, ArchifyArchitectureSpec, ArchifyWorkflowSpec, ArchifySequenceSpec, ArchifyDataflowSpec, ArchifyLifecycleSpec, ArchifyComponentType, ArchifyStateType, ArchifyVariant, } from './spec';
9
+ export { isArchifySpec } from './spec';
10
+ export { archifyToFlowDocument } from './convert';
11
+ export { COMPONENT_STYLES, STATE_STYLES, ARCHIFY_BG, ARCHIFY_GRID, ARCHIFY_ARROW, ARCHIFY_ARROW_EMPHASIS, ARCHIFY_LANE_STROKE, ARCHIFY_TEXT_MUTED, componentStyle, stateStyle, variantEdgeStyle, } from './palette';
12
+ export { ARCHIFY_COMPONENT_ORDER, ARCHIFY_COMPONENT_LABELS, archifyStylePatch, inferComponentType, } from './presets';
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Archify color palette + styling helpers.
3
+ *
4
+ * Mirrors the `classic` dark theme in archify's `assets/template.html` so an
5
+ * imported spec looks like the reference artifact: dark navy canvas, semantic
6
+ * component cards (frontend/backend/database/cloud/security/messagebus/external),
7
+ * and relationship variants (emphasis = green rail, security = rose dashed,
8
+ * dashed = muted). Lifecycle state kinds are mapped onto the same accents.
9
+ *
10
+ * Colors are stored as literal hex on the produced FlowDocument (not theme
11
+ * tokens) so the imported diagram keeps the archify look regardless of the
12
+ * active DishUI theme.
13
+ */
14
+ import type { ArchifyComponentType, ArchifyStateType, ArchifyVariant } from './spec';
15
+ import type { FlowEdgeLineStyle } from '../types';
16
+ /** The dark canvas backdrop archify uses (`--bg`). */
17
+ export declare const ARCHIFY_BG = "#020617";
18
+ /** Grid dot / lane stroke color (`--grid`). */
19
+ export declare const ARCHIFY_GRID = "#1e293b";
20
+ export declare const ARCHIFY_TEXT = "#ffffff";
21
+ export declare const ARCHIFY_TEXT_MUTED = "#94a3b8";
22
+ export declare const ARCHIFY_TEXT_DIM = "#64748b";
23
+ export declare const ARCHIFY_LANE_STROKE = "#334155";
24
+ export declare const ARCHIFY_LANE_FILL = "transparent";
25
+ export declare const ARCHIFY_ARROW = "#64748b";
26
+ export declare const ARCHIFY_ARROW_EMPHASIS = "#34d399";
27
+ export declare const ARCHIFY_ARROW_SECURITY = "#fb7185";
28
+ export interface SemanticStyle {
29
+ /** Card fill (opaque approximation of archify's translucent fill on #020617). */
30
+ fill: string;
31
+ /** Card border / accent stroke. */
32
+ stroke: string;
33
+ /** Title text color (archify keeps titles near-white). */
34
+ text: string;
35
+ /** Muted sub-label / tag text. */
36
+ sub: string;
37
+ }
38
+ /**
39
+ * Semantic component styling. archify fills are translucent over #020617; the
40
+ * hexes below are those fills pre-composited on the dark backdrop so PixiJS can
41
+ * paint them as solid colors while looking identical.
42
+ */
43
+ export declare const COMPONENT_STYLES: Record<ArchifyComponentType, SemanticStyle>;
44
+ /**
45
+ * Lifecycle state kinds mapped onto semantic accents so the state machine reads
46
+ * with the same color grammar as the other diagram types.
47
+ */
48
+ export declare const STATE_STYLES: Record<ArchifyStateType, SemanticStyle>;
49
+ export declare function componentStyle(type: ArchifyComponentType): SemanticStyle;
50
+ export declare function stateStyle(type: ArchifyStateType): SemanticStyle;
51
+ export interface EdgeStyle {
52
+ color: string;
53
+ width: number;
54
+ lineStyle: FlowEdgeLineStyle;
55
+ }
56
+ /** Resolve a relationship variant to an edge stroke color / width / dash. */
57
+ export declare function variantEdgeStyle(variant?: ArchifyVariant, baseWidth?: number): EdgeStyle;
58
+ /**
59
+ * Sequence messages have an extra `return` variant (a quiet dashed reply). Map
60
+ * it here; everything else reuses the shared variant styling.
61
+ */
62
+ export declare function messageEdgeStyle(variant?: string): EdgeStyle;
63
+ /** Card accent dot colors (used when we surface archify `cards` as legend). */
64
+ export declare const CARD_DOT_COLORS: Record<string, string>;