@misoto22/design 0.6.1 → 0.7.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 (157) hide show
  1. package/README.md +12 -0
  2. package/dist/agent/Accordion.md +1 -1
  3. package/dist/agent/Alert.md +1 -1
  4. package/dist/agent/AppShell.md +1 -1
  5. package/dist/agent/ArchitectureFigure.md +48 -0
  6. package/dist/agent/AreaChart.md +1 -1
  7. package/dist/agent/Article.md +1 -1
  8. package/dist/agent/Avatar.md +1 -1
  9. package/dist/agent/Badge.md +1 -1
  10. package/dist/agent/BarChart.md +1 -1
  11. package/dist/agent/BarList.md +1 -1
  12. package/dist/agent/BigNumber.md +1 -1
  13. package/dist/agent/BoxPlot.md +1 -1
  14. package/dist/agent/Breadcrumb.md +1 -1
  15. package/dist/agent/BulletChart.md +1 -1
  16. package/dist/agent/Button.md +1 -1
  17. package/dist/agent/Calendar.md +1 -1
  18. package/dist/agent/Card.md +1 -1
  19. package/dist/agent/Checkbox.md +1 -1
  20. package/dist/agent/Collapsible.md +1 -1
  21. package/dist/agent/Combobox.md +1 -1
  22. package/dist/agent/Command.md +1 -1
  23. package/dist/agent/ComposedChart.md +1 -1
  24. package/dist/agent/ContextMenu.md +1 -1
  25. package/dist/agent/DataflowFigure.md +27 -0
  26. package/dist/agent/DatePicker.md +1 -1
  27. package/dist/agent/Diagram.md +1 -1
  28. package/dist/agent/DiagramCanvas.md +47 -0
  29. package/dist/agent/DiagramExportMenu.md +38 -0
  30. package/dist/agent/DiagramInspector.md +50 -0
  31. package/dist/agent/DiagramLegend.md +34 -0
  32. package/dist/agent/DiagramMinimap.md +48 -0
  33. package/dist/agent/DiagramToolbar.md +47 -0
  34. package/dist/agent/Dialog.md +1 -1
  35. package/dist/agent/DropdownMenu.md +1 -1
  36. package/dist/agent/EmptyState.md +1 -1
  37. package/dist/agent/ErrorState.md +1 -1
  38. package/dist/agent/Facet.md +1 -1
  39. package/dist/agent/Field.md +1 -1
  40. package/dist/agent/FigureBand.md +1 -1
  41. package/dist/agent/FloatingIconButton.md +1 -1
  42. package/dist/agent/FunnelChart.md +1 -1
  43. package/dist/agent/Heatmap.md +1 -1
  44. package/dist/agent/Histogram.md +1 -1
  45. package/dist/agent/Input.md +1 -1
  46. package/dist/agent/Kbd.md +1 -1
  47. package/dist/agent/LifecycleFigure.md +28 -0
  48. package/dist/agent/LineChart.md +1 -1
  49. package/dist/agent/LinkArrow.md +1 -1
  50. package/dist/agent/NativeSelect.md +1 -1
  51. package/dist/agent/NavItem.md +1 -1
  52. package/dist/agent/Pagination.md +1 -1
  53. package/dist/agent/PieChart.md +1 -1
  54. package/dist/agent/Popover.md +1 -1
  55. package/dist/agent/Progress.md +1 -1
  56. package/dist/agent/RadarChart.md +1 -1
  57. package/dist/agent/RadialChart.md +1 -1
  58. package/dist/agent/RadioGroup.md +1 -1
  59. package/dist/agent/SankeyChart.md +1 -1
  60. package/dist/agent/ScatterChart.md +1 -1
  61. package/dist/agent/ScrollArea.md +1 -1
  62. package/dist/agent/SearchableMenu.md +1 -1
  63. package/dist/agent/Select.md +1 -1
  64. package/dist/agent/Separator.md +1 -1
  65. package/dist/agent/SequenceFigure.md +28 -0
  66. package/dist/agent/Sheet.md +1 -1
  67. package/dist/agent/Skeleton.md +1 -1
  68. package/dist/agent/Slider.md +1 -1
  69. package/dist/agent/Sparkline.md +1 -1
  70. package/dist/agent/Spinner.md +1 -1
  71. package/dist/agent/StatusDot.md +1 -1
  72. package/dist/agent/StatusPill.md +1 -1
  73. package/dist/agent/Steps.md +1 -1
  74. package/dist/agent/Switch.md +1 -1
  75. package/dist/agent/Table.md +1 -1
  76. package/dist/agent/Tabs.md +1 -1
  77. package/dist/agent/Tag.md +1 -1
  78. package/dist/agent/Textarea.md +1 -1
  79. package/dist/agent/Toast.md +1 -1
  80. package/dist/agent/ToggleGroup.md +1 -1
  81. package/dist/agent/Tooltip.md +1 -1
  82. package/dist/agent/TreemapChart.md +1 -1
  83. package/dist/agent/WaterfallChart.md +1 -1
  84. package/dist/agent/WorkflowFigure.md +28 -0
  85. package/dist/agent/catalog.json +223 -3
  86. package/dist/agent/index.md +15 -1
  87. package/dist/charts/index.d.ts +2 -1
  88. package/dist/charts/lib/export.d.ts +33 -43
  89. package/dist/charts/lib/export.js +16 -158
  90. package/dist/charts/lib/export.js.map +1 -1
  91. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.d.ts +49 -0
  92. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js +135 -0
  93. package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js.map +1 -0
  94. package/dist/diagrams/DataflowFigure/DataflowFigure.d.ts +28 -0
  95. package/dist/diagrams/DataflowFigure/DataflowFigure.js +129 -0
  96. package/dist/diagrams/DataflowFigure/DataflowFigure.js.map +1 -0
  97. package/dist/diagrams/DiagramCanvas/DiagramCanvas.d.ts +64 -0
  98. package/dist/diagrams/DiagramCanvas/DiagramCanvas.js +222 -0
  99. package/dist/diagrams/DiagramCanvas/DiagramCanvas.js.map +1 -0
  100. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.d.ts +72 -0
  101. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js +125 -0
  102. package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js.map +1 -0
  103. package/dist/diagrams/DiagramInspector/DiagramInspector.d.ts +70 -0
  104. package/dist/diagrams/DiagramInspector/DiagramInspector.js +94 -0
  105. package/dist/diagrams/DiagramInspector/DiagramInspector.js.map +1 -0
  106. package/dist/diagrams/DiagramLegend/DiagramLegend.d.ts +42 -0
  107. package/dist/diagrams/DiagramLegend/DiagramLegend.js +35 -0
  108. package/dist/diagrams/DiagramLegend/DiagramLegend.js.map +1 -0
  109. package/dist/diagrams/DiagramMinimap/DiagramMinimap.d.ts +61 -0
  110. package/dist/diagrams/DiagramMinimap/DiagramMinimap.js +79 -0
  111. package/dist/diagrams/DiagramMinimap/DiagramMinimap.js.map +1 -0
  112. package/dist/diagrams/DiagramToolbar/DiagramToolbar.d.ts +48 -0
  113. package/dist/diagrams/DiagramToolbar/DiagramToolbar.js +53 -0
  114. package/dist/diagrams/DiagramToolbar/DiagramToolbar.js.map +1 -0
  115. package/dist/diagrams/LifecycleFigure/LifecycleFigure.d.ts +31 -0
  116. package/dist/diagrams/LifecycleFigure/LifecycleFigure.js +202 -0
  117. package/dist/diagrams/LifecycleFigure/LifecycleFigure.js.map +1 -0
  118. package/dist/diagrams/SequenceFigure/SequenceFigure.d.ts +38 -0
  119. package/dist/diagrams/SequenceFigure/SequenceFigure.js +231 -0
  120. package/dist/diagrams/SequenceFigure/SequenceFigure.js.map +1 -0
  121. package/dist/diagrams/WorkflowFigure/WorkflowFigure.d.ts +34 -0
  122. package/dist/diagrams/WorkflowFigure/WorkflowFigure.js +211 -0
  123. package/dist/diagrams/WorkflowFigure/WorkflowFigure.js.map +1 -0
  124. package/dist/diagrams/index.d.ts +16 -0
  125. package/dist/diagrams/index.js +19 -0
  126. package/dist/diagrams/index.js.map +1 -0
  127. package/dist/diagrams/lib/frame.d.ts +97 -0
  128. package/dist/diagrams/lib/frame.js +116 -0
  129. package/dist/diagrams/lib/frame.js.map +1 -0
  130. package/dist/diagrams/lib/geometry.d.ts +114 -0
  131. package/dist/diagrams/lib/geometry.js +113 -0
  132. package/dist/diagrams/lib/geometry.js.map +1 -0
  133. package/dist/diagrams/lib/legend.d.ts +32 -0
  134. package/dist/diagrams/lib/legend.js +84 -0
  135. package/dist/diagrams/lib/legend.js.map +1 -0
  136. package/dist/diagrams/lib/marks.d.ts +207 -0
  137. package/dist/diagrams/lib/marks.js +480 -0
  138. package/dist/diagrams/lib/marks.js.map +1 -0
  139. package/dist/diagrams/lib/route.d.ts +85 -0
  140. package/dist/diagrams/lib/route.js +178 -0
  141. package/dist/diagrams/lib/route.js.map +1 -0
  142. package/dist/diagrams/lib/wires.d.ts +59 -0
  143. package/dist/diagrams/lib/wires.js +90 -0
  144. package/dist/diagrams/lib/wires.js.map +1 -0
  145. package/dist/diagrams/spec.d.ts +353 -0
  146. package/dist/diagrams/spec.js +1 -0
  147. package/dist/diagrams/spec.js.map +1 -0
  148. package/dist/lib/svg-export.d.ts +138 -0
  149. package/dist/lib/svg-export.js +198 -0
  150. package/dist/lib/svg-export.js.map +1 -0
  151. package/dist/semantic.css +34 -0
  152. package/dist/styles.css +1 -1
  153. package/dist/tokens.d.ts +16 -0
  154. package/dist/tokens.js +82 -0
  155. package/dist/tokens.json +82 -0
  156. package/package.json +5 -1
  157. package/skills/misoto22-design/SKILL.md +21 -7
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/diagrams/LifecycleFigure/LifecycleFigure.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo } from 'react'\nimport { DiagramFrame, type FigureChrome, type FigureModel } from '../lib/frame'\nimport { inflate, round, TYPE, textWidth, union, wrapText, type Box } from '../lib/geometry'\nimport { resolveLegend, stateLegend } from '../lib/legend'\nimport { Chip, PLATE, plateHeight, StatePlate } from '../lib/marks'\nimport { renderWires, wiresFor } from '../lib/wires'\nimport type { LifecycleSpec, LifecycleStateKind } from '../spec'\n\nconst KINDS: LifecycleStateKind[] = [\n 'start',\n 'active',\n 'waiting',\n 'decision',\n 'success',\n 'failure',\n 'neutral',\n 'external',\n]\n\nconst GRID = { originX: 132, originY: 56, colW: 158, gapX: 62, laneGap: 52, stateH: 68 }\n\n/**\n * How far a secondary lane's columns are shifted along the main rail.\n *\n * archify's lifecycle contract: the first lane holds the ordered phases in\n * columns 0–4, and a secondary lane's column N sits exactly beneath main column\n * N + 2. It is a convention rather than a derivation — the alternative would be\n * making every author restate a column index they already implied — and\n * honouring it is what keeps `executing → approval` a straight vertical drop\n * instead of a dogleg across two unrelated states.\n */\nconst SECONDARY_LANE_OFFSET = 2\n\n/** How much horizontal room a state's own shape leaves for its name. */\nfunction textRoom(width: number, kind: LifecycleStateKind): number {\n return kind === 'decision' ? width * 0.56 : width - PLATE.padX * 2\n}\n\nexport interface LifecycleFigureProps extends FigureChrome {\n spec: LifecycleSpec\n}\n\n/**\n * A state machine: what something can BE, and what moves it.\n *\n * The one figure here that spends colour, and it spends exactly the two tokens\n * this system reserves for state: `--success` on a terminal success,\n * `--danger` on a terminal failure. Nothing else in the package is allowed\n * those two, and a lifecycle diagram is the case they were reserved for — the\n * whole point of the picture is which end a run came out of.\n *\n * The other six kinds are carried by shape, so a greyscale print loses the two\n * outcomes' hue and keeps every other distinction: a start is a filled cap, a\n * decision is a diamond, a wait is a dashed frame, an external is a plate with\n * a cut corner.\n *\n * A RECOVERABLE FAILURE IS A FAILURE WITH A WAY BACK. `type: \"failure\"` says\n * how a state is drawn; a transition OUT of it is what says whether the run is\n * over. A retryable error and a terminal one look identical until you follow\n * the arrows, which is correct — the difference between them is a real edge in\n * the machine, not an adjective on a box.\n */\nexport function LifecycleFigure({\n spec,\n className,\n legend = 'auto',\n cards = true,\n heading = true,\n activeIds,\n onSelectNode,\n}: LifecycleFigureProps) {\n const uid = useId().replace(/:/g, '')\n const model = useMemo(\n () => buildModel(spec, uid, activeIds, onSelectNode),\n [spec, uid, activeIds, onSelectNode],\n )\n\n return (\n <DiagramFrame\n meta={spec.meta}\n model={model}\n cards={spec.cards}\n showCards={cards}\n heading={heading}\n legend={legend}\n className={className}\n activeIds={activeIds}\n onSelectNode={onSelectNode}\n />\n )\n}\n\nfunction buildModel(\n spec: LifecycleSpec,\n uid: string,\n activeIds: string[] | undefined,\n onSelectNode: ((id: string) => void) | undefined,\n): FigureModel {\n const lanes = spec.lanes ?? [{ id: '', label: '' }]\n const laneIndex = new Map(lanes.map((lane, index) => [lane.id, index]))\n\n const boxes = new Map<string, Box>()\n const placed = spec.states.map((state) => {\n // A diamond is only half as wide as its box where the label crosses it, so\n // it gets a wider box for the same words. Sizing it like a rectangle is\n // what pushes a decision's name out past its own two sloping edges.\n const w = state.width ?? (state.type === 'decision' ? GRID.colW + 34 : GRID.colW)\n const lines = wrapText(state.label, TYPE.label, textRoom(w, state.type), 2)\n const h = plateHeight(lines.length, Boolean(state.sublabel), true, state.height ?? GRID.stateH)\n\n const lane = laneIndex.get(state.lane ?? '') ?? 0\n const col = state.col + (lane === 0 ? 0 : SECONDARY_LANE_OFFSET)\n\n // `yOffset` is deliberately NOT applied. It is an absolute nudge measured in\n // archify's own lane heights, and this renderer's lanes are a different\n // depth — so a 78-unit push that cleared a neighbour there drops a state\n // squarely on top of the lane below here. Two overlapping plates are worse\n // than a state sitting on its lane's centre line, which is where the\n // specification put it before the nudge.\n const x = GRID.originX + col * (GRID.colW + GRID.gapX)\n const y = GRID.originY + lane * (GRID.stateH + GRID.laneGap)\n\n const box: Box = { x, y, w, h }\n boxes.set(state.id, box)\n return { state, box, lane }\n })\n\n // The main rail is IMPLICIT, and has to be. archify's lifecycle contract\n // gives the first lane's columns 0..4 to the ordered phases and does not ask\n // an author to restate `queued → planning → executing` as transitions —\n // those are the diagram's spine, not its exceptions. Without them drawn, the\n // top row reads as five unconnected boxes.\n const rail = placed\n .filter((entry) => entry.lane === 0)\n .sort((a, b) => a.state.col - b.state.col)\n const declared = new Set((spec.transitions ?? []).map((t) => `${t.from}→${t.to}`))\n const implied = rail\n .slice(0, -1)\n .map((entry, index) => ({ from: entry.state.id, to: rail[index + 1]!.state.id }))\n .filter((edge) => !declared.has(`${edge.from}→${edge.to}`))\n\n const wires = [\n ...wiresFor(implied, boxes, () => ({ weight: 2.1 })),\n ...wiresFor(spec.transitions, boxes),\n ]\n const { paths, labels } = renderWires(wires, uid)\n\n const extent = inflate(union([...boxes.values()]) ?? { x: 0, y: 0, w: 500, h: 240 }, 34)\n const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null\n\n // A lane's rule spans what it actually holds. Drawing it across the figure's\n // full width would claim a band reaches columns nothing in it occupies.\n const laneRules = lanes.map((lane, index) => {\n const inside = placed.filter((entry) => entry.lane === index).map((entry) => entry.box)\n const span = union(inside)\n return span ? { lane, y: span.y - 16, x1: extent.x + 18, x2: span.x + span.w } : null\n })\n\n const artwork = (\n <>\n {laneRules.map((rule, index) =>\n rule && rule.lane.label ? (\n <g key={`lane-${index}`} aria-hidden=\"true\">\n <path\n d={`M ${round(rule.x1)} ${round(rule.y)} H ${round(rule.x2)}`}\n className=\"stroke-(--diagram-rule) [stroke-width:1]\"\n />\n <text\n x={round(rule.x1)}\n y={round(rule.y - 7)}\n className=\"fill-(--diagram-ink-3) font-mono [font-size:10.5px] [letter-spacing:0.08em] uppercase\"\n >\n {rule.lane.label}\n </text>\n </g>\n ) : null,\n )}\n\n {paths}\n\n {placed.map(({ state, box }) => {\n const lines = wrapText(state.label, TYPE.label, textRoom(box.w, state.type), 2)\n const bottomReserve = state.tag ? 20 : 0\n const blockHeight = lines.length * (TYPE.label * 1.25) + (state.sublabel ? TYPE.sub * 1.5 : 0)\n const top = box.y + (box.h - bottomReserve - blockHeight) / 2\n const reversed = state.type === 'start'\n const centreX = box.x + box.w / 2\n\n return (\n <g\n key={state.id}\n data-node={state.id}\n data-active={active?.has(state.id) ? '' : undefined}\n className={active && !active.has(state.id) ? 'opacity-25' : undefined}\n onClick={onSelectNode ? () => onSelectNode(state.id) : undefined}\n >\n <StatePlate box={box} kind={state.type}>\n {active?.has(state.id) && (\n <rect\n x={round(box.x) - 3}\n y={round(box.y) - 3}\n width={round(box.w) + 6}\n height={round(box.h) + 6}\n rx={9}\n fill=\"none\"\n className=\"stroke-(--accent) [stroke-width:1.4]\"\n />\n )}\n {state.step && (\n <text\n x={round(box.x + 10)}\n y={round(box.y + 15)}\n className={\n reversed\n ? 'fill-(--diagram-plate-ink) font-mono [font-size:9.5px] opacity-70'\n : 'fill-(--diagram-ink-3) font-mono [font-size:9.5px]'\n }\n >\n {state.step}\n </text>\n )}\n {lines.map((line, index) => (\n <text\n key={index}\n x={round(centreX)}\n y={round(top + (index + 1) * TYPE.label * 1.25 - 3.5)}\n textAnchor=\"middle\"\n className={\n reversed\n ? 'fill-(--diagram-plate-ink) font-sans [font-size:13px]'\n : 'fill-(--diagram-ink) font-sans [font-size:13px]'\n }\n >\n {line}\n </text>\n ))}\n {state.sublabel && (\n <text\n x={round(centreX)}\n y={round(top + lines.length * TYPE.label * 1.25 + TYPE.sub)}\n textAnchor=\"middle\"\n className={\n reversed\n ? 'fill-(--diagram-plate-ink) font-mono [font-size:10.5px] opacity-70'\n : 'fill-(--diagram-ink-3) font-mono [font-size:10.5px]'\n }\n >\n {state.sublabel}\n </text>\n )}\n {state.tag && <Chip x={centreX} y={box.y + box.h - 9} text={state.tag} align=\"middle\" />}\n </StatePlate>\n </g>\n )\n })}\n\n {labels}\n\n </>\n )\n\n const used = [...new Set(spec.states.map((state) => state.type))]\n const widest = Math.max(\n 0,\n ...lanes.map((lane) => textWidth(lane.label, TYPE.band)),\n )\n\n // Widening the frame to the LEFT for the lane names has to widen it, not\n // slide it: moving `x` without adding the same amount to `w` trims exactly\n // that much off the right-hand edge, which cost the last column of states.\n const railLeft = Math.min(extent.x, GRID.originX - widest - 30)\n\n return {\n extent: { ...extent, x: railLeft, w: extent.w + (extent.x - railLeft) },\n artwork,\n nodes: spec.states.map((state) => ({\n id: state.id,\n label: state.label,\n sublabel: state.sublabel,\n kind: state.type,\n })),\n edges: (spec.transitions ?? []).map((transition) => ({\n from: transition.from,\n to: transition.to,\n label: [transition.label, transition.note].filter(Boolean).join(' — ') || undefined,\n })),\n legend: stateLegend(\n resolveLegend(used, spec.meta.legend?.mode, KINDS, spec.meta.legend?.entries),\n spec.meta.legend?.entries,\n ),\n }\n}\n\nexport default LifecycleFigure\n"],"mappings":";AAgFI,SAiFA,UAjFA,KAoFM,YApFN;AA9EJ,SAAS,OAAO,eAAe;AAC/B,SAAS,oBAAyD;AAClE,SAAS,SAAS,OAAO,MAAM,WAAW,OAAO,gBAA0B;AAC3E,SAAS,eAAe,mBAAmB;AAC3C,SAAS,MAAM,OAAO,aAAa,kBAAkB;AACrD,SAAS,aAAa,gBAAgB;AAGtC,MAAM,QAA8B;AAAA,EAClC;AAAA,EACA;AAAA,EACA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ACF;AACF;AAEA,IAAO,0BAAQ;","names":[]}
@@ -0,0 +1,38 @@
1
+ import * as react from 'react';
2
+ import { FigureChrome } from '../lib/frame.js';
3
+ import { SequenceSpec } from '../spec.js';
4
+ import '../lib/geometry.js';
5
+
6
+ interface SequenceFigureProps extends FigureChrome {
7
+ spec: SequenceSpec;
8
+ }
9
+ /**
10
+ * A call chain over time: who asks whom, in what order, and what comes back.
11
+ *
12
+ * The one diagram type here whose vertical axis MEANS something. Every other
13
+ * figure's y is layout; a sequence's y is time, which is why a message carries
14
+ * an explicit `y` rather than an index — two calls 8 units apart happened
15
+ * together, and two 200 apart did not, and an evenly spaced list of messages
16
+ * would erase that distinction while looking tidier.
17
+ *
18
+ * **Lifelines** are hairlines, not solid rules, because they are the axis
19
+ * rather than the content. A lifeline drawn at the weight of a message is a
20
+ * diagram where seven vertical lines compete with twelve horizontal ones.
21
+ *
22
+ * **Activation bars** say who is BUSY, which is the fact a sequence diagram
23
+ * carries that a list of calls does not — the third participant's bar
24
+ * overlapping the second's is the reason to draw them at all.
25
+ *
26
+ * **Segments** band the axis into phases — request, fallback, response —
27
+ * printed as a rule with a mono caption rather than as a tinted panel, for the
28
+ * same reason architecture boundaries are: a second ground inside the figure
29
+ * would sit under every message label's mask.
30
+ *
31
+ * A `return` message is dashed AND takes an open arrowhead. Two signals rather
32
+ * than one, because the reply is the thing a reader most often needs to pick
33
+ * out of a dense trace, and a dash alone is doing the same work as `dashed`
34
+ * already does for an asynchronous call.
35
+ */
36
+ declare function SequenceFigure({ spec, className, legend, cards, heading, activeIds, onSelectNode, }: SequenceFigureProps): react.JSX.Element;
37
+
38
+ export { SequenceFigure, type SequenceFigureProps, SequenceFigure as default };
@@ -0,0 +1,231 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId, useMemo } from "react";
4
+ import { DiagramFrame } from "../lib/frame.js";
5
+ import { round, textWidth, TYPE } from "../lib/geometry.js";
6
+ import { resolveLegend, variantLegend } from "../lib/legend.js";
7
+ import { EdgeLabel, NodePlate } from "../lib/marks.js";
8
+ const HEAD = { y: 44, h: 62, w: 148, gap: 40 };
9
+ const VARIANTS = ["default", "emphasis", "security", "dashed", "return"];
10
+ function SequenceFigure({
11
+ spec,
12
+ className,
13
+ legend = "auto",
14
+ cards = true,
15
+ heading = true,
16
+ activeIds,
17
+ onSelectNode
18
+ }) {
19
+ const uid = useId().replace(/:/g, "");
20
+ const model = useMemo(
21
+ () => buildModel(spec, uid, activeIds, onSelectNode),
22
+ [spec, uid, activeIds, onSelectNode]
23
+ );
24
+ return /* @__PURE__ */ jsx(
25
+ DiagramFrame,
26
+ {
27
+ meta: spec.meta,
28
+ model,
29
+ cards: spec.cards,
30
+ showCards: cards,
31
+ heading,
32
+ legend,
33
+ className,
34
+ activeIds,
35
+ onSelectNode
36
+ }
37
+ );
38
+ }
39
+ function buildModel(spec, _uid, activeIds, onSelectNode) {
40
+ const natural = Math.max(
41
+ HEAD.w,
42
+ ...spec.participants.map(
43
+ (participant) => Math.max(
44
+ textWidth(participant.label, TYPE.label),
45
+ textWidth(participant.sublabel ?? "", TYPE.sub)
46
+ ) + 44
47
+ )
48
+ );
49
+ const colW = spec.meta.column_fit === "spread" ? natural : HEAD.w;
50
+ const pitch = colW + HEAD.gap;
51
+ const centre = /* @__PURE__ */ new Map();
52
+ const heads = spec.participants.map((participant, index) => {
53
+ const x = 40 + index * pitch;
54
+ centre.set(participant.id, x + colW / 2);
55
+ return { participant, box: { x, y: HEAD.y, w: colW, h: HEAD.h } };
56
+ });
57
+ const lastY = Math.max(
58
+ HEAD.y + HEAD.h + 80,
59
+ ...spec.messages.map((message) => message.y),
60
+ ...(spec.activations ?? []).map((activation) => activation.to),
61
+ ...(spec.segments ?? []).map((segment) => segment.to)
62
+ );
63
+ const lifelineBottom = lastY + 42;
64
+ const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null;
65
+ const width = 40 + spec.participants.length * pitch - HEAD.gap + 40;
66
+ const artwork = /* @__PURE__ */ jsxs(Fragment, { children: [
67
+ (spec.segments ?? []).map((segment, index) => /* @__PURE__ */ jsxs("g", { "aria-hidden": "true", children: [
68
+ /* @__PURE__ */ jsx(
69
+ "path",
70
+ {
71
+ d: `M 20 ${round(segment.from)} H ${round(width - 20)}`,
72
+ className: "stroke-(--diagram-rule) [stroke-width:1] [stroke-dasharray:2_4]"
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ "rect",
77
+ {
78
+ x: 20,
79
+ y: round(segment.from - 7),
80
+ width: round(textWidth(segment.label, TYPE.band) + 14),
81
+ height: 14,
82
+ className: "fill-(--diagram-surface)"
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(
86
+ "text",
87
+ {
88
+ x: 27,
89
+ y: round(segment.from + 3.5),
90
+ className: "fill-(--diagram-ink-3) font-mono [font-size:10.5px] [letter-spacing:0.08em] uppercase",
91
+ children: segment.label
92
+ }
93
+ )
94
+ ] }, `segment-${index}`)),
95
+ heads.map(({ participant, box }) => /* @__PURE__ */ jsx(
96
+ "path",
97
+ {
98
+ d: `M ${round(box.x + colW / 2)} ${round(box.y + box.h)} V ${round(lifelineBottom)}`,
99
+ className: "stroke-(--diagram-rule) [stroke-width:1]",
100
+ "aria-hidden": "true"
101
+ },
102
+ `life-${participant.id}`
103
+ )),
104
+ (spec.activations ?? []).map((activation, index) => {
105
+ const x = centre.get(activation.participant);
106
+ if (x === void 0) return null;
107
+ return /* @__PURE__ */ jsx(
108
+ "rect",
109
+ {
110
+ x: round(x - 5),
111
+ y: round(activation.from),
112
+ width: 10,
113
+ height: round(Math.max(6, activation.to - activation.from)),
114
+ rx: 2,
115
+ className: "fill-(--diagram-node-2) stroke-(--diagram-rule)",
116
+ strokeWidth: 1,
117
+ "aria-hidden": "true"
118
+ },
119
+ `act-${index}`
120
+ );
121
+ }),
122
+ spec.messages.map((message, index) => {
123
+ const from = centre.get(message.from);
124
+ const to = centre.get(message.to);
125
+ if (from === void 0 || to === void 0) return null;
126
+ const forward = to >= from;
127
+ const inset = 6;
128
+ const x1 = forward ? from + inset : from - inset;
129
+ const x2 = forward ? to - inset : to + inset;
130
+ return /* @__PURE__ */ jsx(
131
+ "path",
132
+ {
133
+ d: `M ${round(x1)} ${round(message.y)} H ${round(x2)}`,
134
+ fill: "none",
135
+ "data-edge": message.id,
136
+ markerEnd: `url(#${_uid}-${messageMarker(message.variant)})`,
137
+ className: messageClasses(message.variant),
138
+ ...messageStroke(message.variant)
139
+ },
140
+ message.id ?? `msg-${index}`
141
+ );
142
+ }),
143
+ heads.map(({ participant, box }) => /* @__PURE__ */ jsx(
144
+ NodePlate,
145
+ {
146
+ nodeId: participant.id,
147
+ box,
148
+ label: participant.label,
149
+ sublabel: participant.sublabel,
150
+ kind: participant.type,
151
+ active: active?.has(participant.id),
152
+ dimmed: active ? !active.has(participant.id) : false,
153
+ onSelect: onSelectNode ? () => onSelectNode(participant.id) : void 0
154
+ },
155
+ participant.id
156
+ )),
157
+ spec.messages.map((message, index) => {
158
+ const from = centre.get(message.from);
159
+ const to = centre.get(message.to);
160
+ if (from === void 0 || to === void 0 || !message.label) return null;
161
+ return /* @__PURE__ */ jsx(
162
+ EdgeLabel,
163
+ {
164
+ x: (from + to) / 2,
165
+ y: message.y,
166
+ axis: "x",
167
+ text: message.label
168
+ },
169
+ `label-${message.id ?? index}`
170
+ );
171
+ })
172
+ ] });
173
+ const used = [
174
+ ...new Set(spec.messages.map((message) => message.variant ?? "default"))
175
+ ];
176
+ return {
177
+ extent: { x: 0, y: 0, w: width, h: lifelineBottom + 24 },
178
+ artwork,
179
+ nodes: spec.participants.map((participant) => ({
180
+ id: participant.id,
181
+ label: participant.label,
182
+ sublabel: participant.sublabel,
183
+ kind: participant.type
184
+ })),
185
+ edges: spec.messages.map((message) => ({
186
+ from: message.from,
187
+ to: message.to,
188
+ label: message.label
189
+ })),
190
+ legend: variantLegend(
191
+ resolveLegend(used, spec.meta.legend?.mode, VARIANTS, spec.meta.legend?.entries),
192
+ spec.meta.legend?.entries
193
+ )
194
+ };
195
+ }
196
+ function messageMarker(variant) {
197
+ if (variant === "emphasis") return "arrow-strong";
198
+ if (variant === "return") return "arrow-open";
199
+ return "arrow";
200
+ }
201
+ function messageClasses(variant) {
202
+ switch (variant) {
203
+ case "emphasis":
204
+ return "stroke-(--diagram-line-strong)";
205
+ case "return":
206
+ case "dashed":
207
+ return "stroke-(--diagram-line-soft)";
208
+ default:
209
+ return "stroke-(--diagram-line)";
210
+ }
211
+ }
212
+ function messageStroke(variant) {
213
+ switch (variant) {
214
+ case "emphasis":
215
+ return { strokeWidth: 2 };
216
+ case "security":
217
+ return { strokeWidth: 1.4, strokeDasharray: "6 3" };
218
+ case "return":
219
+ return { strokeWidth: 1.2, strokeDasharray: "4 3.5" };
220
+ case "dashed":
221
+ return { strokeWidth: 1.2, strokeDasharray: "3 3" };
222
+ default:
223
+ return { strokeWidth: 1.4 };
224
+ }
225
+ }
226
+ var SequenceFigure_default = SequenceFigure;
227
+ export {
228
+ SequenceFigure,
229
+ SequenceFigure_default as default
230
+ };
231
+ //# sourceMappingURL=SequenceFigure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/diagrams/SequenceFigure/SequenceFigure.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo } from 'react'\nimport { DiagramFrame, type FigureChrome, type FigureModel } from '../lib/frame'\nimport { round, textWidth, TYPE, type Box } from '../lib/geometry'\nimport { resolveLegend, variantLegend } from '../lib/legend'\nimport { EdgeLabel, NodePlate } from '../lib/marks'\nimport type { SequenceSpec, Variant } from '../spec'\n\nconst HEAD = { y: 44, h: 62, w: 148, gap: 40 }\nconst VARIANTS: (Variant | 'return')[] = ['default', 'emphasis', 'security', 'dashed', 'return']\n\nexport interface SequenceFigureProps extends FigureChrome {\n spec: SequenceSpec\n}\n\n/**\n * A call chain over time: who asks whom, in what order, and what comes back.\n *\n * The one diagram type here whose vertical axis MEANS something. Every other\n * figure's y is layout; a sequence's y is time, which is why a message carries\n * an explicit `y` rather than an index — two calls 8 units apart happened\n * together, and two 200 apart did not, and an evenly spaced list of messages\n * would erase that distinction while looking tidier.\n *\n * **Lifelines** are hairlines, not solid rules, because they are the axis\n * rather than the content. A lifeline drawn at the weight of a message is a\n * diagram where seven vertical lines compete with twelve horizontal ones.\n *\n * **Activation bars** say who is BUSY, which is the fact a sequence diagram\n * carries that a list of calls does not — the third participant's bar\n * overlapping the second's is the reason to draw them at all.\n *\n * **Segments** band the axis into phases — request, fallback, response —\n * printed as a rule with a mono caption rather than as a tinted panel, for the\n * same reason architecture boundaries are: a second ground inside the figure\n * would sit under every message label's mask.\n *\n * A `return` message is dashed AND takes an open arrowhead. Two signals rather\n * than one, because the reply is the thing a reader most often needs to pick\n * out of a dense trace, and a dash alone is doing the same work as `dashed`\n * already does for an asynchronous call.\n */\nexport function SequenceFigure({\n spec,\n className,\n legend = 'auto',\n cards = true,\n heading = true,\n activeIds,\n onSelectNode,\n}: SequenceFigureProps) {\n const uid = useId().replace(/:/g, '')\n const model = useMemo(\n () => buildModel(spec, uid, activeIds, onSelectNode),\n [spec, uid, activeIds, onSelectNode],\n )\n\n return (\n <DiagramFrame\n meta={spec.meta}\n model={model}\n cards={spec.cards}\n showCards={cards}\n heading={heading}\n legend={legend}\n className={className}\n activeIds={activeIds}\n onSelectNode={onSelectNode}\n />\n )\n}\n\nfunction buildModel(\n spec: SequenceSpec,\n _uid: string,\n activeIds: string[] | undefined,\n onSelectNode: ((id: string) => void) | undefined,\n): FigureModel {\n // A participant's box has to hold its own name. `spread` lets the widest\n // label set the pitch for every column, which is the layout archify reaches\n // for when a fixed 86-unit column would clip a meaningful name — and\n // shortening the name instead is not a repair, it is a different diagram.\n const natural = Math.max(\n HEAD.w,\n ...spec.participants.map(\n (participant) =>\n Math.max(\n textWidth(participant.label, TYPE.label),\n textWidth(participant.sublabel ?? '', TYPE.sub),\n ) + 44,\n ),\n )\n const colW = spec.meta.column_fit === 'spread' ? natural : HEAD.w\n const pitch = colW + HEAD.gap\n\n const centre = new Map<string, number>()\n const heads = spec.participants.map((participant, index) => {\n const x = 40 + index * pitch\n centre.set(participant.id, x + colW / 2)\n return { participant, box: { x, y: HEAD.y, w: colW, h: HEAD.h } as Box }\n })\n\n const lastY = Math.max(\n HEAD.y + HEAD.h + 80,\n ...spec.messages.map((message) => message.y),\n ...(spec.activations ?? []).map((activation) => activation.to),\n ...(spec.segments ?? []).map((segment) => segment.to),\n )\n const lifelineBottom = lastY + 42\n\n const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null\n const width = 40 + spec.participants.length * pitch - HEAD.gap + 40\n\n const artwork = (\n <>\n {/* Segments first: they are the ground the whole exchange happens on. */}\n {(spec.segments ?? []).map((segment, index) => (\n <g key={`segment-${index}`} aria-hidden=\"true\">\n <path\n d={`M 20 ${round(segment.from)} H ${round(width - 20)}`}\n className=\"stroke-(--diagram-rule) [stroke-width:1] [stroke-dasharray:2_4]\"\n />\n <rect\n x={20}\n y={round(segment.from - 7)}\n width={round(textWidth(segment.label, TYPE.band) + 14)}\n height={14}\n className=\"fill-(--diagram-surface)\"\n />\n <text\n x={27}\n y={round(segment.from + 3.5)}\n className=\"fill-(--diagram-ink-3) font-mono [font-size:10.5px] [letter-spacing:0.08em] uppercase\"\n >\n {segment.label}\n </text>\n </g>\n ))}\n\n {/* Lifelines. */}\n {heads.map(({ participant, box }) => (\n <path\n key={`life-${participant.id}`}\n d={`M ${round(box.x + colW / 2)} ${round(box.y + box.h)} V ${round(lifelineBottom)}`}\n className=\"stroke-(--diagram-rule) [stroke-width:1]\"\n aria-hidden=\"true\"\n />\n ))}\n\n {/* Activation bars. */}\n {(spec.activations ?? []).map((activation, index) => {\n const x = centre.get(activation.participant)\n if (x === undefined) return null\n return (\n <rect\n key={`act-${index}`}\n x={round(x - 5)}\n y={round(activation.from)}\n width={10}\n height={round(Math.max(6, activation.to - activation.from))}\n rx={2}\n className=\"fill-(--diagram-node-2) stroke-(--diagram-rule)\"\n strokeWidth={1}\n aria-hidden=\"true\"\n />\n )\n })}\n\n {/* Messages. */}\n {spec.messages.map((message, index) => {\n const from = centre.get(message.from)\n const to = centre.get(message.to)\n if (from === undefined || to === undefined) return null\n const forward = to >= from\n const inset = 6\n const x1 = forward ? from + inset : from - inset\n const x2 = forward ? to - inset : to + inset\n return (\n <path\n key={message.id ?? `msg-${index}`}\n d={`M ${round(x1)} ${round(message.y)} H ${round(x2)}`}\n fill=\"none\"\n data-edge={message.id}\n markerEnd={`url(#${_uid}-${messageMarker(message.variant)})`}\n className={messageClasses(message.variant)}\n {...messageStroke(message.variant)}\n />\n )\n })}\n\n {/* Participants, over the lines that end at them. */}\n {heads.map(({ participant, box }) => (\n <NodePlate\n key={participant.id}\n nodeId={participant.id}\n box={box}\n label={participant.label}\n sublabel={participant.sublabel}\n kind={participant.type}\n active={active?.has(participant.id)}\n dimmed={active ? !active.has(participant.id) : false}\n onSelect={onSelectNode ? () => onSelectNode(participant.id) : undefined}\n />\n ))}\n\n {/* Message wording last, so its mask covers every line. */}\n {spec.messages.map((message, index) => {\n const from = centre.get(message.from)\n const to = centre.get(message.to)\n if (from === undefined || to === undefined || !message.label) return null\n return (\n <EdgeLabel\n key={`label-${message.id ?? index}`}\n x={(from + to) / 2}\n y={message.y}\n axis=\"x\"\n text={message.label}\n />\n )\n })}\n </>\n )\n\n const used = [\n ...new Set(spec.messages.map((message) => message.variant ?? 'default')),\n ] as (Variant | 'return')[]\n\n return {\n extent: { x: 0, y: 0, w: width, h: lifelineBottom + 24 },\n artwork,\n nodes: spec.participants.map((participant) => ({\n id: participant.id,\n label: participant.label,\n sublabel: participant.sublabel,\n kind: participant.type,\n })),\n edges: spec.messages.map((message) => ({\n from: message.from,\n to: message.to,\n label: message.label,\n })),\n legend: variantLegend(\n resolveLegend(used, spec.meta.legend?.mode, VARIANTS, spec.meta.legend?.entries),\n spec.meta.legend?.entries,\n ),\n }\n}\n\n/** Which arrowhead a message ends in. */\nfunction messageMarker(\n variant: SequenceSpec['messages'][number]['variant'],\n): 'arrow' | 'arrow-strong' | 'arrow-open' {\n if (variant === 'emphasis') return 'arrow-strong'\n if (variant === 'return') return 'arrow-open'\n return 'arrow'\n}\n\n/** A message's colour. Geometry goes through attributes — see `edgeClasses`. */\nfunction messageClasses(variant: SequenceSpec['messages'][number]['variant']): string {\n switch (variant) {\n case 'emphasis':\n return 'stroke-(--diagram-line-strong)'\n case 'return':\n case 'dashed':\n return 'stroke-(--diagram-line-soft)'\n default:\n return 'stroke-(--diagram-line)'\n }\n}\n\n/** A message's width and dash pattern. Heavier than a map's line: it IS the content. */\nfunction messageStroke(variant: SequenceSpec['messages'][number]['variant']): {\n strokeWidth: number\n strokeDasharray?: string\n} {\n switch (variant) {\n case 'emphasis':\n return { strokeWidth: 2 }\n case 'security':\n return { strokeWidth: 1.4, strokeDasharray: '6 3' }\n case 'return':\n return { strokeWidth: 1.2, strokeDasharray: '4 3.5' }\n case 'dashed':\n return { strokeWidth: 1.2, strokeDasharray: '3 3' }\n default:\n return { strokeWidth: 1.4 }\n }\n}\n\nexport default SequenceFigure\n"],"mappings":";AA2DI,SAwDA,UAxDA,KA2DI,YA3DJ;AAzDJ,SAAS,OAAO,eAAe;AAC/B,SAAS,oBAAyD;AAClE,SAAS,OAAO,WAAW,YAAsB;AACjD,SAAS,eAAe,qBAAqB;AAC7C,SAAS,WAAW,iBAAiB;AAGrC,MAAM,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,KAAK,GAAG;AAC7C,MAAM,WAAmC,CAAC,WAAW,YAAY,YAAY,UAAU,QAAQ;AAiCxF,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA;AACF,GAAwB;AACtB,QAAM,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE;AACpC,QAAM,QAAQ;AAAA,IACZ,MAAM,WAAW,MAAM,KAAK,WAAW,YAAY;AA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,QAAO;AACjC,SAAO;AACT;AAGA,SAAS,eAAe,SAA8D;AACpF,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAGA,SAAS,cAAc,SAGrB;AACA,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO,EAAE,aAAa,EAAE;AAAA,IAC1B,KAAK;AACH,aAAO,EAAE,aAAa,KAAK,iBAAiB,MAAM;AAAA,IACpD,KAAK;AACH,aAAO,EAAE,aAAa,KAAK,iBAAiB,QAAQ;AAAA,IACtD,KAAK;AACH,aAAO,EAAE,aAAa,KAAK,iBAAiB,MAAM;AAAA,IACpD;AACE,aAAO,EAAE,aAAa,IAAI;AAAA,EAC9B;AACF;AAEA,IAAO,yBAAQ;","names":[]}
@@ -0,0 +1,34 @@
1
+ import * as react from 'react';
2
+ import { FigureChrome } from '../lib/frame.js';
3
+ import { WorkflowSpec } from '../spec.js';
4
+ import '../lib/geometry.js';
5
+
6
+ interface WorkflowFigureProps extends FigureChrome {
7
+ spec: WorkflowSpec;
8
+ }
9
+ /**
10
+ * A process: who does what, in what order, and where it can go wrong.
11
+ *
12
+ * Three structures stacked on one grid, and they are three because they answer
13
+ * three different questions a reader brings to a runbook.
14
+ *
15
+ * **Lanes** are rows and answer WHO. A lane marked `exception` is the one band
16
+ * that gets a wash rather than a rule, and it earns the exception to the
17
+ * frames-are-rules law because nothing routes across it — it IS the ground for
18
+ * the failure path, not a frame drawn over the happy one.
19
+ *
20
+ * **Phases** are columns across every lane and answer WHEN. Printed as captions
21
+ * on one header rule, because a phase is an axis label. **Groups** are frames
22
+ * inside a single lane and answer WHAT BELONGS TOGETHER — a planning loop, an
23
+ * evidence path.
24
+ *
25
+ * THE MAIN PATH IS HEAVIER, and that is the whole hierarchy. `mainPath` lists
26
+ * the node ids a reader should be able to follow without thinking. Every edge
27
+ * between two consecutive ids on it is drawn at the emphasis weight whatever
28
+ * its own variant says, which is the one thing that turns fourteen boxes and
29
+ * nineteen arrows into a diagram with a subject. An `error` role goes the other
30
+ * way — dashed and soft — so the exception path recedes without disappearing.
31
+ */
32
+ declare function WorkflowFigure({ spec, className, legend, cards, heading, activeIds, onSelectNode, }: WorkflowFigureProps): react.JSX.Element;
33
+
34
+ export { WorkflowFigure, type WorkflowFigureProps, WorkflowFigure as default };
@@ -0,0 +1,211 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId, useMemo } from "react";
4
+ import { DiagramFrame } from "../lib/frame.js";
5
+ import { inflate, round, textWidth, TYPE, union, wrapText } from "../lib/geometry.js";
6
+ import { resolveLegend, variantLegend } from "../lib/legend.js";
7
+ import { BandFrame, NodePlate, PLATE, plateHeight } from "../lib/marks.js";
8
+ import { renderWires, wiresFor } from "../lib/wires.js";
9
+ const VARIANTS = ["default", "emphasis", "security", "dashed"];
10
+ const GRID = {
11
+ /** The gutter the lane names live in. */
12
+ railW: 118,
13
+ originY: 74,
14
+ colW: 168,
15
+ gapX: 58,
16
+ laneH: 92,
17
+ laneGap: 40
18
+ };
19
+ function WorkflowFigure({
20
+ spec,
21
+ className,
22
+ legend = "auto",
23
+ cards = true,
24
+ heading = true,
25
+ activeIds,
26
+ onSelectNode
27
+ }) {
28
+ const uid = useId().replace(/:/g, "");
29
+ const model = useMemo(
30
+ () => buildModel(spec, uid, activeIds, onSelectNode),
31
+ [spec, uid, activeIds, onSelectNode]
32
+ );
33
+ return /* @__PURE__ */ jsx(
34
+ DiagramFrame,
35
+ {
36
+ meta: spec.meta,
37
+ model,
38
+ cards: spec.cards,
39
+ showCards: cards,
40
+ heading,
41
+ legend,
42
+ className,
43
+ activeIds,
44
+ onSelectNode
45
+ }
46
+ );
47
+ }
48
+ const colX = (col) => GRID.railW + col * (GRID.colW + GRID.gapX);
49
+ const spanBox = (fromCol, toCol, y, h) => ({
50
+ x: colX(fromCol),
51
+ y,
52
+ w: colX(toCol) + GRID.colW - colX(fromCol),
53
+ h
54
+ });
55
+ function buildModel(spec, uid, activeIds, onSelectNode) {
56
+ const laneIndex = new Map(spec.lanes.map((lane, index) => [lane.id, index]));
57
+ const laneY = (index) => GRID.originY + index * (GRID.laneH + GRID.laneGap);
58
+ const boxes = /* @__PURE__ */ new Map();
59
+ const placed = spec.nodes.map((node) => {
60
+ const w = node.width ?? GRID.colW;
61
+ const lines = wrapText(node.label, TYPE.label, w - PLATE.padX * 2, 2);
62
+ const h = plateHeight(lines.length, Boolean(node.sublabel), true, node.height ?? 0);
63
+ const index = laneIndex.get(node.lane) ?? 0;
64
+ const box = {
65
+ x: colX(node.col),
66
+ y: laneY(index) + (GRID.laneH - h) / 2 + (node.yOffset ?? 0),
67
+ w,
68
+ h
69
+ };
70
+ boxes.set(node.id, box);
71
+ return { node, box, lane: index };
72
+ });
73
+ const mainPairs = /* @__PURE__ */ new Set();
74
+ for (let index = 0; index < (spec.mainPath?.length ?? 0) - 1; index += 1) {
75
+ mainPairs.add(`${spec.mainPath[index]}\u2192${spec.mainPath[index + 1]}`);
76
+ }
77
+ const wires = wiresFor(spec.edges, boxes, (edge) => {
78
+ const onMain = mainPairs.has(`${edge.from}\u2192${edge.to}`);
79
+ return {
80
+ weight: onMain ? 2.1 : void 0,
81
+ open: edge.role === "return"
82
+ };
83
+ });
84
+ const { paths, labels } = renderWires(wires, uid);
85
+ const laneBoxes = spec.lanes.map((lane, index) => {
86
+ const inside = placed.filter((entry) => entry.lane === index).map((entry) => entry.box);
87
+ const span = union(inside);
88
+ const left2 = span ? span.x - 14 : GRID.railW - 14;
89
+ return {
90
+ lane,
91
+ index,
92
+ box: {
93
+ x: left2,
94
+ y: laneY(index) - 8,
95
+ w: (span ? span.x + span.w + 14 : colX(0) + GRID.colW) - left2,
96
+ h: GRID.laneH + 16
97
+ }
98
+ };
99
+ });
100
+ const drawn = [...boxes.values(), ...laneBoxes.map((entry) => entry.box)];
101
+ const headerY = GRID.originY - 30;
102
+ const railTextW = Math.max(0, ...spec.lanes.map((lane) => textWidth(lane.label, 9)));
103
+ const raw = union(drawn) ?? { x: 0, y: 0, w: 600, h: 300 };
104
+ const left = Math.min(raw.x, GRID.railW - 26 - railTextW);
105
+ const top = Math.min(raw.y, headerY - 14);
106
+ const extent = inflate(
107
+ { x: left, y: top, w: raw.x + raw.w - left, h: raw.y + raw.h - top },
108
+ 24
109
+ );
110
+ const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null;
111
+ const artwork = /* @__PURE__ */ jsxs(Fragment, { children: [
112
+ (spec.phases ?? []).length > 0 && /* @__PURE__ */ jsx(
113
+ "path",
114
+ {
115
+ d: `M ${round(GRID.railW)} ${round(headerY + 8)} H ${round(extent.x + extent.w - 20)}`,
116
+ className: "stroke-(--diagram-rule)",
117
+ strokeWidth: 1,
118
+ "aria-hidden": "true"
119
+ }
120
+ ),
121
+ (spec.phases ?? []).map((phase) => /* @__PURE__ */ jsx(
122
+ "text",
123
+ {
124
+ x: round(colX(phase.fromCol)),
125
+ y: round(headerY),
126
+ className: "fill-(--diagram-ink-3) font-mono [font-size:9px] [letter-spacing:0.14em] uppercase",
127
+ "aria-hidden": "true",
128
+ children: phase.label
129
+ },
130
+ phase.id
131
+ )),
132
+ laneBoxes.map(({ lane, box }) => /* @__PURE__ */ jsxs("g", { "aria-hidden": "true", children: [
133
+ lane.variant === "exception" && /* @__PURE__ */ jsx(
134
+ "rect",
135
+ {
136
+ x: round(box.x),
137
+ y: round(box.y),
138
+ width: round(box.w),
139
+ height: round(box.h),
140
+ rx: 10,
141
+ className: "fill-(--diagram-band) [rx:var(--radius-lg)] [ry:var(--radius-lg)]"
142
+ }
143
+ ),
144
+ /* @__PURE__ */ jsx(
145
+ "text",
146
+ {
147
+ x: round(GRID.railW - 26),
148
+ y: round(box.y + box.h / 2 + 3),
149
+ textAnchor: "end",
150
+ className: "fill-(--diagram-ink-3) font-mono [font-size:9px] [letter-spacing:0.14em] uppercase",
151
+ children: lane.label
152
+ }
153
+ )
154
+ ] }, lane.id)),
155
+ (spec.groups ?? []).map((group) => {
156
+ const index = laneIndex.get(group.lane) ?? 0;
157
+ return /* @__PURE__ */ jsx(
158
+ BandFrame,
159
+ {
160
+ box: spanBox(group.fromCol, group.toCol, laneY(index) - 2, GRID.laneH + 4),
161
+ label: group.label,
162
+ dashed: group.variant === "security"
163
+ },
164
+ group.id
165
+ );
166
+ }),
167
+ paths,
168
+ placed.map(({ node, box }) => /* @__PURE__ */ jsx(
169
+ NodePlate,
170
+ {
171
+ nodeId: node.id,
172
+ box,
173
+ label: node.label,
174
+ sublabel: node.sublabel,
175
+ tag: node.tag,
176
+ kind: node.type,
177
+ active: active?.has(node.id),
178
+ dimmed: active ? !active.has(node.id) : false,
179
+ onSelect: onSelectNode ? () => onSelectNode(node.id) : void 0
180
+ },
181
+ node.id
182
+ )),
183
+ labels
184
+ ] });
185
+ const used = [...new Set((spec.edges ?? []).map((edge) => edge.variant ?? "default"))];
186
+ return {
187
+ extent,
188
+ artwork,
189
+ nodes: spec.nodes.map((node) => ({
190
+ id: node.id,
191
+ label: node.label,
192
+ sublabel: node.sublabel,
193
+ kind: node.type
194
+ })),
195
+ edges: (spec.edges ?? []).map((edge) => ({
196
+ from: edge.from,
197
+ to: edge.to,
198
+ label: edge.label
199
+ })),
200
+ legend: variantLegend(
201
+ resolveLegend(used, spec.meta.legend?.mode, VARIANTS, spec.meta.legend?.entries),
202
+ spec.meta.legend?.entries
203
+ )
204
+ };
205
+ }
206
+ var WorkflowFigure_default = WorkflowFigure;
207
+ export {
208
+ WorkflowFigure,
209
+ WorkflowFigure_default as default
210
+ };
211
+ //# sourceMappingURL=WorkflowFigure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/diagrams/WorkflowFigure/WorkflowFigure.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo } from 'react'\nimport { DiagramFrame, type FigureChrome, type FigureModel } from '../lib/frame'\nimport { inflate, round, textWidth, TYPE, union, wrapText, type Box } from '../lib/geometry'\nimport { resolveLegend, variantLegend } from '../lib/legend'\nimport { BandFrame, NodePlate, PLATE, plateHeight } from '../lib/marks'\nimport { renderWires, wiresFor, type Wire } from '../lib/wires'\nimport type { Variant, WorkflowEdge, WorkflowSpec } from '../spec'\n\nconst VARIANTS: (Variant | 'return')[] = ['default', 'emphasis', 'security', 'dashed']\n\nconst GRID = {\n /** The gutter the lane names live in. */\n railW: 118,\n originY: 74,\n colW: 168,\n gapX: 58,\n laneH: 92,\n laneGap: 40,\n}\n\nexport interface WorkflowFigureProps extends FigureChrome {\n spec: WorkflowSpec\n}\n\n/**\n * A process: who does what, in what order, and where it can go wrong.\n *\n * Three structures stacked on one grid, and they are three because they answer\n * three different questions a reader brings to a runbook.\n *\n * **Lanes** are rows and answer WHO. A lane marked `exception` is the one band\n * that gets a wash rather than a rule, and it earns the exception to the\n * frames-are-rules law because nothing routes across it — it IS the ground for\n * the failure path, not a frame drawn over the happy one.\n *\n * **Phases** are columns across every lane and answer WHEN. Printed as captions\n * on one header rule, because a phase is an axis label. **Groups** are frames\n * inside a single lane and answer WHAT BELONGS TOGETHER — a planning loop, an\n * evidence path.\n *\n * THE MAIN PATH IS HEAVIER, and that is the whole hierarchy. `mainPath` lists\n * the node ids a reader should be able to follow without thinking. Every edge\n * between two consecutive ids on it is drawn at the emphasis weight whatever\n * its own variant says, which is the one thing that turns fourteen boxes and\n * nineteen arrows into a diagram with a subject. An `error` role goes the other\n * way — dashed and soft — so the exception path recedes without disappearing.\n */\nexport function WorkflowFigure({\n spec,\n className,\n legend = 'auto',\n cards = true,\n heading = true,\n activeIds,\n onSelectNode,\n}: WorkflowFigureProps) {\n const uid = useId().replace(/:/g, '')\n const model = useMemo(\n () => buildModel(spec, uid, activeIds, onSelectNode),\n [spec, uid, activeIds, onSelectNode],\n )\n\n return (\n <DiagramFrame\n meta={spec.meta}\n model={model}\n cards={spec.cards}\n showCards={cards}\n heading={heading}\n legend={legend}\n className={className}\n activeIds={activeIds}\n onSelectNode={onSelectNode}\n />\n )\n}\n\n/** The x of a column's left edge, and of the whole span from `from` to `to`. */\nconst colX = (col: number) => GRID.railW + col * (GRID.colW + GRID.gapX)\nconst spanBox = (fromCol: number, toCol: number, y: number, h: number): Box => ({\n x: colX(fromCol),\n y,\n w: colX(toCol) + GRID.colW - colX(fromCol),\n h,\n})\n\nfunction buildModel(\n spec: WorkflowSpec,\n uid: string,\n activeIds: string[] | undefined,\n onSelectNode: ((id: string) => void) | undefined,\n): FigureModel {\n const laneIndex = new Map(spec.lanes.map((lane, index) => [lane.id, index]))\n const laneY = (index: number) => GRID.originY + index * (GRID.laneH + GRID.laneGap)\n\n const boxes = new Map<string, Box>()\n const placed = spec.nodes.map((node) => {\n const w = node.width ?? GRID.colW\n const lines = wrapText(node.label, TYPE.label, w - PLATE.padX * 2, 2)\n const h = plateHeight(lines.length, Boolean(node.sublabel), true, node.height ?? 0)\n const index = laneIndex.get(node.lane) ?? 0\n\n const box: Box = {\n x: colX(node.col),\n y: laneY(index) + (GRID.laneH - h) / 2 + (node.yOffset ?? 0),\n w,\n h,\n }\n boxes.set(node.id, box)\n return { node, box, lane: index }\n })\n\n // Consecutive pairs on the main path, so the edge between them can be drawn\n // at the weight that says \"follow this one\".\n const mainPairs = new Set<string>()\n for (let index = 0; index < (spec.mainPath?.length ?? 0) - 1; index += 1) {\n mainPairs.add(`${spec.mainPath![index]}→${spec.mainPath![index + 1]}`)\n }\n\n const wires = wiresFor(spec.edges, boxes, (edge: WorkflowEdge): Partial<Wire> => {\n const onMain = mainPairs.has(`${edge.from}→${edge.to}`)\n return {\n weight: onMain ? 2.1 : undefined,\n open: edge.role === 'return',\n }\n })\n const { paths, labels } = renderWires(wires, uid)\n\n // A lane's band spans what the lane actually holds. Starting it at the rail\n // instead ran the exception wash under the label gutter, which made the\n // gutter look like part of the band rather than like the axis it is.\n const laneBoxes = spec.lanes.map((lane, index) => {\n const inside = placed.filter((entry) => entry.lane === index).map((entry) => entry.box)\n const span = union(inside)\n const left = span ? span.x - 14 : GRID.railW - 14\n return {\n lane,\n index,\n box: {\n x: left,\n y: laneY(index) - 8,\n w: (span ? span.x + span.w + 14 : colX(0) + GRID.colW) - left,\n h: GRID.laneH + 16,\n } as Box,\n }\n })\n\n const drawn = [...boxes.values(), ...laneBoxes.map((entry) => entry.box)]\n const headerY = GRID.originY - 30\n\n // The frame has to hold what is printed OUTSIDE the boxes too: the lane names\n // in the gutter and the phase captions above the header rule. Sizing the\n // extent from the boxes alone clipped both — and a clipped axis label is the\n // one kind of overflow a reader reads as a broken renderer rather than as a\n // long word.\n const railTextW = Math.max(0, ...spec.lanes.map((lane) => textWidth(lane.label, 9)))\n const raw = union(drawn) ?? { x: 0, y: 0, w: 600, h: 300 }\n const left = Math.min(raw.x, GRID.railW - 26 - railTextW)\n const top = Math.min(raw.y, headerY - 14)\n const extent = inflate(\n { x: left, y: top, w: raw.x + raw.w - left, h: raw.y + raw.h - top },\n 24,\n )\n const active = activeIds && activeIds.length > 0 ? new Set(activeIds) : null\n\n const artwork = (\n <>\n {/* Phases: one header rule across the figure, with a caption per span. */}\n {(spec.phases ?? []).length > 0 && (\n <path\n d={`M ${round(GRID.railW)} ${round(headerY + 8)} H ${round(extent.x + extent.w - 20)}`}\n className=\"stroke-(--diagram-rule)\"\n strokeWidth={1}\n aria-hidden=\"true\"\n />\n )}\n {(spec.phases ?? []).map((phase) => (\n <text\n key={phase.id}\n x={round(colX(phase.fromCol))}\n y={round(headerY)}\n className=\"fill-(--diagram-ink-3) font-mono [font-size:9px] [letter-spacing:0.14em] uppercase\"\n aria-hidden=\"true\"\n >\n {phase.label}\n </text>\n ))}\n\n {/* Lanes. The exception band is the one wash in the system's diagrams. */}\n {laneBoxes.map(({ lane, box }) => (\n <g key={lane.id} aria-hidden=\"true\">\n {lane.variant === 'exception' && (\n <rect\n x={round(box.x)}\n y={round(box.y)}\n width={round(box.w)}\n height={round(box.h)}\n rx={10}\n className=\"fill-(--diagram-band) [rx:var(--radius-lg)] [ry:var(--radius-lg)]\"\n />\n )}\n <text\n x={round(GRID.railW - 26)}\n y={round(box.y + box.h / 2 + 3)}\n textAnchor=\"end\"\n className=\"fill-(--diagram-ink-3) font-mono [font-size:9px] [letter-spacing:0.14em] uppercase\"\n >\n {lane.label}\n </text>\n </g>\n ))}\n\n {/* Groups: a frame inside one lane. */}\n {(spec.groups ?? []).map((group) => {\n const index = laneIndex.get(group.lane) ?? 0\n return (\n <BandFrame\n key={group.id}\n box={spanBox(group.fromCol, group.toCol, laneY(index) - 2, GRID.laneH + 4)}\n label={group.label}\n dashed={group.variant === 'security'}\n />\n )\n })}\n\n {paths}\n\n {placed.map(({ node, box }) => (\n <NodePlate\n key={node.id}\n nodeId={node.id}\n box={box}\n label={node.label}\n sublabel={node.sublabel}\n tag={node.tag}\n kind={node.type}\n active={active?.has(node.id)}\n dimmed={active ? !active.has(node.id) : false}\n onSelect={onSelectNode ? () => onSelectNode(node.id) : undefined}\n />\n ))}\n\n {labels}\n </>\n )\n\n const used = [...new Set((spec.edges ?? []).map((edge) => edge.variant ?? 'default'))]\n\n return {\n extent,\n artwork,\n nodes: spec.nodes.map((node) => ({\n id: node.id,\n label: node.label,\n sublabel: node.sublabel,\n kind: node.type,\n })),\n edges: (spec.edges ?? []).map((edge) => ({\n from: edge.from,\n to: edge.to,\n label: edge.label,\n })),\n legend: variantLegend(\n resolveLegend(used, spec.meta.legend?.mode, VARIANTS, spec.meta.legend?.entries),\n spec.meta.legend?.entries,\n ),\n }\n}\n\nexport default WorkflowFigure\n"],"mappings":";AAiEI,SAuGA,UAvGA,KA+HI,YA/HJ;AA/DJ,SAAS,OAAO,eAAe;AAC/B,SAAS,oBAAyD;AAClE,SAAS,SAAS,OAAO,WAAW,MAAM,OAAO,gBAA0B;AAC3E,SAAS,eAAe,qBAAqB;AAC7C,SAAS,WAAW,WAAW,OAAO,mBAAmB;AACzD,SAAS,aAAa,gBAA2B;AAGjD,MAAM,WAAmC,CAAC,WAAW,YA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AAK;AAAA,QACV,MAAM,KAAK;AAAA,QACX,QAAQ,QAAQ,IAAI,KAAK,EAAE;AAAA,QAC3B,QAAQ,SAAS,CAAC,OAAO,IAAI,KAAK,EAAE,IAAI;AAAA,QACxC,UAAU,eAAe,MAAM,aAAa,KAAK,EAAE,IAAI;AAAA;AAAA,MATlD,KAAK;AAAA,IAUZ,CACD;AAAA,IAEA;AAAA,KACH;AAGF,QAAM,OAAO,CAAC,GAAG,IAAI,KAAK,KAAK,SAAS,CAAC,GAAG,IAAI,CAAC,SAAS,KAAK,WAAW,SAAS,CAAC,CAAC;AAErF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO,KAAK,MAAM,IAAI,CAAC,UAAU;AAAA,MAC/B,IAAI,KAAK;AAAA,MACT,OAAO,KAAK;AAAA,MACZ,UAAU,KAAK;AAAA,MACf,MAAM,KAAK;AAAA,IACb,EAAE;AAAA,IACF,QAAQ,KAAK,SAAS,CAAC,GAAG,IAAI,CAAC,UAAU;AAAA,MACvC,MAAM,KAAK;AAAA,MACX,IAAI,KAAK;AAAA,MACT,OAAO,KAAK;AAAA,IACd,EAAE;AAAA,IACF,QAAQ;AAAA,MACN,cAAc,MAAM,KAAK,KAAK,QAAQ,MAAM,UAAU,KAAK,KAAK,QAAQ,OAAO;AAAA,MAC/E,KAAK,KAAK,QAAQ;AAAA,IACpB;AAAA,EACF;AACF;AAEA,IAAO,yBAAQ;","names":["left"]}
@@ -0,0 +1,16 @@
1
+ export { ArchitectureBoundary, ArchitectureComponent, ArchitectureSpec, DataflowEdge, DataflowNode, DataflowSpec, DataflowStage, DiagramCard, DiagramMeta, DiagramSpecAny, DiagramView, EdgeBase, LegendMode, LifecycleLane, LifecycleSpec, LifecycleState, LifecycleStateKind, LifecycleTransition, NodeBase, NodeKind, Point, RouteMode, SequenceActivation, SequenceMessage, SequenceParticipant, SequenceSegment, SequenceSpec, Side, SourceRef, Variant, WorkflowEdge, WorkflowEdgeRole, WorkflowGroup, WorkflowLane, WorkflowNode, WorkflowPhase, WorkflowSpec } from './spec.js';
2
+ export { ArchitectureFigure, ArchitectureFigureProps } from './ArchitectureFigure/ArchitectureFigure.js';
3
+ export { WorkflowFigure, WorkflowFigureProps } from './WorkflowFigure/WorkflowFigure.js';
4
+ export { SequenceFigure, SequenceFigureProps } from './SequenceFigure/SequenceFigure.js';
5
+ export { DataflowFigure, DataflowFigureProps } from './DataflowFigure/DataflowFigure.js';
6
+ export { LifecycleFigure, LifecycleFigureProps } from './LifecycleFigure/LifecycleFigure.js';
7
+ export { CanvasView, DiagramCanvas, DiagramCanvasHandle, DiagramCanvasProps } from './DiagramCanvas/DiagramCanvas.js';
8
+ export { DiagramToolbar, DiagramToolbarGroup, DiagramToolbarProps } from './DiagramToolbar/DiagramToolbar.js';
9
+ export { DiagramExportMenu, DiagramExportMenuProps, ExportFormat, ExportResult, exportFigure } from './DiagramExportMenu/DiagramExportMenu.js';
10
+ export { DiagramInspector, DiagramInspectorProps, InspectorFact, InspectorLink } from './DiagramInspector/DiagramInspector.js';
11
+ export { DiagramMinimap, DiagramMinimapProps } from './DiagramMinimap/DiagramMinimap.js';
12
+ export { DiagramLegend, DiagramLegendEntry, DiagramLegendProps } from './DiagramLegend/DiagramLegend.js';
13
+ export { LegendEntry, kindLegend, resolveLegend, stateLegend, variantLegend } from './lib/legend.js';
14
+ export { FigureChrome } from './lib/frame.js';
15
+ import 'react';
16
+ import './lib/geometry.js';