@leitwerk-dev/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE +13 -0
- package/dist/assets/ChronicleMarkdown-BLgtHeEE.js +16 -0
- package/dist/assets/ChronicleMarkdown-D6hFzERy.css +1 -0
- package/dist/assets/FutureLaunchDetailPage-KrXSGzHM.js +1 -0
- package/dist/assets/FutureLaunchDetailPage-VPMBtpYc.css +1 -0
- package/dist/assets/GenericLauncher-Cv38FByt.js +1 -0
- package/dist/assets/GenericLauncher-D_GMtsQ5.css +1 -0
- package/dist/assets/HomePage-Cd3lEtwZ.js +1 -0
- package/dist/assets/HomePage-DYh_QHXv.css +1 -0
- package/dist/assets/PageHeader-6PdvYODN.css +1 -0
- package/dist/assets/PageHeader-D6pP4hIh.js +1 -0
- package/dist/assets/ProcessActionsMenu-1QySGNy9.js +1 -0
- package/dist/assets/ProcessActionsMenu-BT2r9vO8.css +1 -0
- package/dist/assets/ProcessDetailPage-BLuc7sjV.js +12 -0
- package/dist/assets/ProcessDetailPage-CSrjzajF.css +1 -0
- package/dist/assets/ProcessFlowDiagram-BAh_M_rb.js +2 -0
- package/dist/assets/ProcessFlowDiagram-Cz8wNicU.css +1 -0
- package/dist/assets/ProcessesPage-BcM38HMs.css +1 -0
- package/dist/assets/ProcessesPage-DtPweRU-.js +1 -0
- package/dist/assets/ScheduleDateTimePicker-CQGvY-Rc.js +1 -0
- package/dist/assets/ScheduleDateTimePicker-CadXN9z7.css +1 -0
- package/dist/assets/SkillsPage-B30FAFia.css +1 -0
- package/dist/assets/SkillsPage-bXuv0kEE.js +2 -0
- package/dist/assets/WatchersPage-DNyUsU1y.js +1 -0
- package/dist/assets/WatchersPage-Dnfi1zUK.css +1 -0
- package/dist/assets/api-CqECFdii.js +1 -0
- package/dist/assets/browser-storage-LbKCyf_w.js +1 -0
- package/dist/assets/dist-B7WNbObw.js +2 -0
- package/dist/assets/index-66T4Gmbl.css +1 -0
- package/dist/assets/index-C8qCggeq.js +7 -0
- package/dist/assets/index-client-BqF3_t3P.js +2 -0
- package/dist/assets/mermaid-render.worker-DAVgiVRG.js +6393 -0
- package/dist/assets/retry-config.svelte-DFKCJtCe.js +1 -0
- package/dist/assets/router.svelte-COr45o9R.js +1 -0
- package/dist/fonts/OFL-Public-Sans.txt +115 -0
- package/dist/fonts/OFL-Spectral.txt +93 -0
- package/dist/fonts/README.md +38 -0
- package/dist/fonts/fonts.css +85 -0
- package/dist/fonts/public-sans-latin-cd00287f.woff2 +0 -0
- package/dist/fonts/public-sans-latin-ext-d025d4ba.woff2 +0 -0
- package/dist/fonts/spectral-latin-89d48951.woff2 +0 -0
- package/dist/fonts/spectral-latin-b7578f14.woff2 +0 -0
- package/dist/fonts/spectral-latin-c4e0a00d.woff2 +0 -0
- package/dist/fonts/spectral-latin-ext-260738f4.woff2 +0 -0
- package/dist/fonts/spectral-latin-ext-ab18ac17.woff2 +0 -0
- package/dist/fonts/spectral-latin-ext-f58c1db3.woff2 +0 -0
- package/dist/index.html +32 -0
- package/package.json +47 -0
- package/src/App.svelte +257 -0
- package/src/chronicle/components/ChronicleActionSection.svelte +1035 -0
- package/src/chronicle/components/ChronicleExpandButton.svelte +70 -0
- package/src/chronicle/components/ChronicleFlow.svelte +289 -0
- package/src/chronicle/components/ChronicleLeafOutcomePlaceholder.svelte +44 -0
- package/src/chronicle/components/ChronicleLeafOutcomeRendererHost.svelte +408 -0
- package/src/chronicle/components/ChronicleLeafOutcomeSection.svelte +253 -0
- package/src/chronicle/components/ChronicleLiveChip.svelte +96 -0
- package/src/chronicle/components/ChronicleLiveTail.svelte +376 -0
- package/src/chronicle/components/ChronicleMarkdown.svelte +168 -0
- package/src/chronicle/components/ChronicleOperatorInputSection.svelte +41 -0
- package/src/chronicle/components/ChronicleProcessErrorSection.svelte +131 -0
- package/src/chronicle/components/ChroniclePromptSection.svelte +54 -0
- package/src/chronicle/components/ChronicleQuestionRequest.svelte +167 -0
- package/src/chronicle/components/ChronicleReasoningDetailsOverlay.svelte +893 -0
- package/src/chronicle/components/ChronicleRecoverySection.svelte +338 -0
- package/src/chronicle/components/ChronicleScheduledActionSection.svelte +192 -0
- package/src/chronicle/components/ChronicleSectionHeader.svelte +135 -0
- package/src/chronicle/components/ChronicleStartupRecoverySection.svelte +138 -0
- package/src/chronicle/components/ChronicleTerminalSummary.svelte +127 -0
- package/src/chronicle/components/ChronicleThinkingSection.svelte +191 -0
- package/src/chronicle/components/ChronicleThinkingText.svelte +46 -0
- package/src/chronicle/components/ChronicleToolCallItem.svelte +477 -0
- package/src/chronicle/components/ChronicleTurnCluster.svelte +325 -0
- package/src/chronicle/components/ChronicleTurnRail.svelte +584 -0
- package/src/chronicle/components/ChronicleUsageStats.svelte +107 -0
- package/src/chronicle/components/CompactActionComposer.svelte +417 -0
- package/src/chronicle/components/ModelProfileOptions.svelte +20 -0
- package/src/chronicle/components/ProviderOptionsEditor.svelte +171 -0
- package/src/chronicle/components/RecoveryModelControl.svelte +95 -0
- package/src/chronicle/lib/action-bindings.ts +90 -0
- package/src/chronicle/lib/action-model-display.ts +133 -0
- package/src/chronicle/lib/action-preview.ts +16 -0
- package/src/chronicle/lib/chronicle-projection.ts +1342 -0
- package/src/chronicle/lib/chronicle-selectable-items.ts +352 -0
- package/src/chronicle/lib/chronicle-view-model.ts +121 -0
- package/src/chronicle/lib/formatting.ts +18 -0
- package/src/chronicle/lib/leaf-outcome-loader.ts +214 -0
- package/src/chronicle/lib/leaf-outcome-runtime.ts +37 -0
- package/src/chronicle/lib/prompt-highlighting.ts +78 -0
- package/src/chronicle/lib/scroll-sync.ts +88 -0
- package/src/chronicle/lib/tool-call-summary.ts +64 -0
- package/src/components/BrowserUiExtensionIndicatorHost.svelte +34 -0
- package/src/components/ConversationTreeDiagram.svelte +393 -0
- package/src/components/FormFieldRenderer.svelte +359 -0
- package/src/components/GenericLauncher.svelte +1970 -0
- package/src/components/KeyboardShortcutsModal.svelte +52 -0
- package/src/components/ModalShell.svelte +105 -0
- package/src/components/PageHeader.svelte +146 -0
- package/src/components/ProcessActionsMenu.svelte +514 -0
- package/src/components/ProcessInfoOverlay.svelte +1229 -0
- package/src/components/ScheduleDateTimePicker.svelte +155 -0
- package/src/components/SkillSelector.svelte +45 -0
- package/src/components/ToastContainer.svelte +192 -0
- package/src/components/launcher-form-copy.ts +172 -0
- package/src/components/launcher-model-config.ts +263 -0
- package/src/components/launcher-schedule.ts +127 -0
- package/src/extension-ui-dev-server.ts +98 -0
- package/src/lib/api.ts +970 -0
- package/src/lib/beautiful-mermaid-elk-instance.ts +54 -0
- package/src/lib/browser-storage.ts +11 -0
- package/src/lib/cost-estimates.ts +41 -0
- package/src/lib/elk-bundled-worker.ts +41 -0
- package/src/lib/flow-layout.ts +326 -0
- package/src/lib/format.ts +96 -0
- package/src/lib/future-executions-logic.ts +12 -0
- package/src/lib/future-launch-detail.ts +145 -0
- package/src/lib/instance-tree-layout.ts +158 -0
- package/src/lib/keyboard-shortcuts-help.ts +20 -0
- package/src/lib/keyboard.ts +40 -0
- package/src/lib/launcher-recent-values.ts +68 -0
- package/src/lib/markdown.ts +94 -0
- package/src/lib/mermaid-render.worker.ts +36 -0
- package/src/lib/pi-stream.ts +3 -0
- package/src/lib/primary-path-detail.ts +337 -0
- package/src/lib/primary-path-replay.ts +27 -0
- package/src/lib/process-browser.ts +179 -0
- package/src/lib/process-initial-prompt.ts +7 -0
- package/src/lib/process-launch-notices.svelte.ts +25 -0
- package/src/lib/process-row-view.ts +60 -0
- package/src/lib/process-terminal-display.ts +17 -0
- package/src/lib/process-toast-focus.svelte.ts +18 -0
- package/src/lib/processes-logic.ts +2 -0
- package/src/lib/processes.svelte.ts +334 -0
- package/src/lib/request-guard.ts +20 -0
- package/src/lib/retry-config.svelte.ts +19 -0
- package/src/lib/rich-markdown-elements.ts +173 -0
- package/src/lib/router-logic.ts +190 -0
- package/src/lib/router.svelte.ts +56 -0
- package/src/lib/runtime-config.ts +96 -0
- package/src/lib/test-fixtures.ts +13 -0
- package/src/lib/toasts.svelte.ts +104 -0
- package/src/lib/tool-call-rendering.ts +66 -0
- package/src/lib/ui-extensions.svelte.ts +381 -0
- package/src/lib/usage-snapshot.ts +9 -0
- package/src/lib/ws-classifier.ts +80 -0
- package/src/lib/ws.svelte.ts +281 -0
- package/src/main.ts +8 -0
- package/src/pages/FutureLaunchDetailPage.svelte +479 -0
- package/src/pages/HomePage.svelte +306 -0
- package/src/pages/ProcessCard.svelte +99 -0
- package/src/pages/ProcessDetailPage.svelte +599 -0
- package/src/pages/ProcessFlowDiagram.svelte +696 -0
- package/src/pages/ProcessGallery.svelte +252 -0
- package/src/pages/ProcessesPage.svelte +994 -0
- package/src/pages/SkillsPage.svelte +665 -0
- package/src/pages/WatchersPage.svelte +330 -0
- package/src/pages/process-detail/OverlayFrame.svelte +58 -0
- package/src/pages/process-detail/ProcessDetailChronicle.svelte +460 -0
- package/src/pages/process-detail/ProcessDetailHeader.svelte +167 -0
- package/src/pages/process-detail/process-detail-action-drafts.svelte.ts +211 -0
- package/src/pages/process-detail/process-detail-actions.svelte.ts +548 -0
- package/src/pages/process-detail/process-detail-chronicle-dom.ts +102 -0
- package/src/pages/process-detail/process-detail-chronicle-scroll.svelte.ts +711 -0
- package/src/pages/process-detail/process-detail-mutations.svelte.ts +91 -0
- package/src/pages/process-detail/process-detail-view-model.ts +149 -0
- package/src/shell/AppShell.svelte +249 -0
- package/src/shell/RouteLoadBoundary.svelte +43 -0
- package/src/shell/Sidebar.svelte +1358 -0
- package/src/shell/test-fixtures/RouteLoadTestComponent.svelte +5 -0
- package/src/vite-env.d.ts +2 -0
- package/src/vite-server-config.ts +27 -0
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
let nextFlowDiagramInstanceId = 0;
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import type { ProcessFlowNode, ProcessFlowView, UiLauncherSummary } from "../lib/api.js";
|
|
7
|
+
import {
|
|
8
|
+
computeFlowLayout,
|
|
9
|
+
edgeDisplayLabel,
|
|
10
|
+
type FlowLayout,
|
|
11
|
+
type FlowLayoutEdge,
|
|
12
|
+
type FlowLayoutNode,
|
|
13
|
+
turnTypeDescription,
|
|
14
|
+
turnTypeLabel,
|
|
15
|
+
} from "../lib/flow-layout.js";
|
|
16
|
+
|
|
17
|
+
type Mode = "happy" | "full";
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
/** Provide either a launcher (gallery/setup) or a flow view directly (detail page). */
|
|
21
|
+
launcher?: UiLauncherSummary;
|
|
22
|
+
flow?: ProcessFlowView;
|
|
23
|
+
mode?: Mode;
|
|
24
|
+
compact?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* When true, render the compact happy strip by default with a disclosure
|
|
27
|
+
* toggle that expands the full directed chart in place. Keeps the initial
|
|
28
|
+
* page view light for users who already know the flow.
|
|
29
|
+
*/
|
|
30
|
+
expandable?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let { launcher, flow, mode = "happy", compact = false, expandable = false }: Props = $props();
|
|
34
|
+
|
|
35
|
+
let expanded = $state(false);
|
|
36
|
+
|
|
37
|
+
const flowView = $derived<ProcessFlowView | null>(flow ?? launcher?.processFlow ?? null);
|
|
38
|
+
|
|
39
|
+
const nodesByTurnId = $derived(
|
|
40
|
+
new Map((flowView?.nodes ?? []).map((node) => [node.turnId, node] as const)),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Happy mode shows just the spine as a compact strip.
|
|
44
|
+
const spineNodes = $derived<ProcessFlowNode[]>(
|
|
45
|
+
(flowView?.spine ?? [])
|
|
46
|
+
.map((turnId) => nodesByTurnId.get(turnId))
|
|
47
|
+
.filter((node): node is ProcessFlowNode => node !== undefined),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const completedEndState = $derived(
|
|
51
|
+
(flowView?.endStates ?? []).find((state) => state.lifecycleStatus === "completed") ?? null,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// The full chart renders when explicitly requested, or when an expandable
|
|
55
|
+
// instance is currently expanded.
|
|
56
|
+
const wantsFullChart = $derived(mode === "full" || (expandable && expanded));
|
|
57
|
+
|
|
58
|
+
// Full mode lays the whole graph out as a real directed flow chart.
|
|
59
|
+
const layout = $derived<FlowLayout | null>(
|
|
60
|
+
flowView && wantsFullChart ? computeFlowLayout(flowView) : null,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
function edgePath(edge: FlowLayoutEdge): string {
|
|
64
|
+
const points = edge.points;
|
|
65
|
+
if (points.length === 0) {
|
|
66
|
+
return "";
|
|
67
|
+
}
|
|
68
|
+
if (points.length === 1) {
|
|
69
|
+
return `M ${points[0].x} ${points[0].y}`;
|
|
70
|
+
}
|
|
71
|
+
// Smooth the routed polyline with quadratic segments through midpoints.
|
|
72
|
+
let path = `M ${points[0].x} ${points[0].y}`;
|
|
73
|
+
for (let index = 1; index < points.length - 1; index += 1) {
|
|
74
|
+
const current = points[index];
|
|
75
|
+
const next = points[index + 1];
|
|
76
|
+
const midX = (current.x + next.x) / 2;
|
|
77
|
+
const midY = (current.y + next.y) / 2;
|
|
78
|
+
path += ` Q ${current.x} ${current.y} ${midX} ${midY}`;
|
|
79
|
+
}
|
|
80
|
+
const last = points[points.length - 1];
|
|
81
|
+
path += ` L ${last.x} ${last.y}`;
|
|
82
|
+
return path;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function nodeClasses(node: FlowLayoutNode): string {
|
|
86
|
+
if (node.kind === "end") {
|
|
87
|
+
return `flow-box is-end is-${node.lifecycleStatus}`;
|
|
88
|
+
}
|
|
89
|
+
const role = node.role === "spine" ? "is-spine" : "is-branch";
|
|
90
|
+
return `flow-box is-turn ${role}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const markerPrefix = `process-flow-${nextFlowDiagramInstanceId++}`;
|
|
94
|
+
const chartId = `${markerPrefix}-chart`;
|
|
95
|
+
|
|
96
|
+
function markerId(kind: FlowLayoutEdge["kind"]): string {
|
|
97
|
+
return `${markerPrefix}-arrow-${kind}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const edgeKinds = ["forward", "loopback", "branch", "terminal"] as const;
|
|
101
|
+
|
|
102
|
+
const hasSpine = $derived(flowView !== null && spineNodes.length > 0);
|
|
103
|
+
const showFullChart = $derived(flowView !== null && (layout?.nodes.length ?? 0) > 0);
|
|
104
|
+
|
|
105
|
+
// Branch / offshoot turns (recovery, review loops) shown only in the full chart.
|
|
106
|
+
const branchNodes = $derived<ProcessFlowNode[]>(
|
|
107
|
+
(flowView?.nodes ?? []).filter((node) => node.role === "branch"),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Distinct edge kinds actually present, so the legend only explains what is drawn.
|
|
111
|
+
const presentEdgeKinds = $derived(
|
|
112
|
+
new Set((layout?.edges ?? []).map((edge) => edge.kind)),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const endStates = $derived(flowView?.endStates ?? []);
|
|
116
|
+
|
|
117
|
+
// Authoritative accessible name for a turn node: what it is, its kind, and what
|
|
118
|
+
// happens there. Surfaced to assistive tech via the node's aria-label, and to
|
|
119
|
+
// mouse users as the same sentence in a hover <title>.
|
|
120
|
+
function nodeAriaLabel(node: FlowLayoutNode): string {
|
|
121
|
+
if (node.kind === "end") {
|
|
122
|
+
return `End state: ${node.title}`;
|
|
123
|
+
}
|
|
124
|
+
if (node.turnType) {
|
|
125
|
+
return `${node.title}. ${turnTypeLabel(node.turnType)}. ${turnTypeDescription(node.turnType)}`;
|
|
126
|
+
}
|
|
127
|
+
return node.title;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const legendId = `${markerPrefix}-legend`;
|
|
131
|
+
|
|
132
|
+
// One-sentence narrative of the whole graph for assistive tech, so a screen
|
|
133
|
+
// reader user gets the same orientation the sighted user gets from the chart.
|
|
134
|
+
const accessibleSummary = $derived.by(() => {
|
|
135
|
+
if (!flowView) {
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
const parts: string[] = [];
|
|
139
|
+
const happy = spineNodes.map((node) => node.description).join(", then ");
|
|
140
|
+
if (happy) {
|
|
141
|
+
parts.push(`Happy path: ${happy}.`);
|
|
142
|
+
}
|
|
143
|
+
if (branchNodes.length > 0) {
|
|
144
|
+
parts.push(
|
|
145
|
+
`Branch and recovery steps: ${branchNodes.map((node) => node.description).join(", ")}.`,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (endStates.length > 0) {
|
|
149
|
+
const ends = endStates
|
|
150
|
+
.map((state) => (state.lifecycleStatus === "completed" ? "Completed" : "Aborted"))
|
|
151
|
+
.join(" or ");
|
|
152
|
+
parts.push(`Ends in: ${ends}.`);
|
|
153
|
+
}
|
|
154
|
+
return parts.join(" ");
|
|
155
|
+
});
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
{#snippet happyStrip()}
|
|
159
|
+
<ol
|
|
160
|
+
class={["process-flow", compact && "is-compact"]}
|
|
161
|
+
data-section="process-flow-diagram"
|
|
162
|
+
data-flow-mode="happy"
|
|
163
|
+
aria-label="Happy path"
|
|
164
|
+
>
|
|
165
|
+
{#each spineNodes as node, index (node.turnId)}
|
|
166
|
+
<li class="flow-step" data-flow-turn-id={node.turnId}>
|
|
167
|
+
<span class="step-chip" data-turn-type={node.turnType}>{node.description}</span>
|
|
168
|
+
{#if index < spineNodes.length - 1}
|
|
169
|
+
<span class="step-arrow" aria-hidden="true">→</span>
|
|
170
|
+
{/if}
|
|
171
|
+
</li>
|
|
172
|
+
{/each}
|
|
173
|
+
{#if completedEndState}
|
|
174
|
+
<li class="flow-step" data-flow-end-state="completed">
|
|
175
|
+
<span class="step-arrow" aria-hidden="true">→</span>
|
|
176
|
+
<span class="end-chip is-completed">Completed</span>
|
|
177
|
+
</li>
|
|
178
|
+
{/if}
|
|
179
|
+
</ol>
|
|
180
|
+
{/snippet}
|
|
181
|
+
|
|
182
|
+
{#snippet fullChart()}
|
|
183
|
+
{#if layout && layout.nodes.length > 0}
|
|
184
|
+
<figure
|
|
185
|
+
class="process-flow-chart"
|
|
186
|
+
data-section="process-flow-diagram"
|
|
187
|
+
data-flow-mode="full"
|
|
188
|
+
>
|
|
189
|
+
<p id={`${markerPrefix}-desc`} class="sr-only">{accessibleSummary}</p>
|
|
190
|
+
<div class="flow-svg-viewport">
|
|
191
|
+
<svg
|
|
192
|
+
viewBox={`0 0 ${layout.width} ${layout.height}`}
|
|
193
|
+
preserveAspectRatio="xMidYMid meet"
|
|
194
|
+
class="flow-svg"
|
|
195
|
+
role="group"
|
|
196
|
+
aria-label="Process flow chart"
|
|
197
|
+
aria-describedby={`${markerPrefix}-desc`}
|
|
198
|
+
>
|
|
199
|
+
<defs>
|
|
200
|
+
{#each edgeKinds as kind (kind)}
|
|
201
|
+
<marker
|
|
202
|
+
id={markerId(kind)}
|
|
203
|
+
class={`flow-marker is-${kind}`}
|
|
204
|
+
viewBox="0 0 10 10"
|
|
205
|
+
refX="9"
|
|
206
|
+
refY="5"
|
|
207
|
+
markerWidth="7"
|
|
208
|
+
markerHeight="7"
|
|
209
|
+
orient="auto-start-reverse"
|
|
210
|
+
>
|
|
211
|
+
<path d="M 0 0 L 10 5 L 0 10 z" />
|
|
212
|
+
</marker>
|
|
213
|
+
{/each}
|
|
214
|
+
</defs>
|
|
215
|
+
|
|
216
|
+
<g class="flow-edges" aria-hidden="true">
|
|
217
|
+
{#each layout.edges as edge (edge.id)}
|
|
218
|
+
{@const displayLabel = edgeDisplayLabel(edge.labels)}
|
|
219
|
+
<path
|
|
220
|
+
class={`flow-edge is-${edge.kind}`}
|
|
221
|
+
d={edgePath(edge)}
|
|
222
|
+
fill="none"
|
|
223
|
+
marker-end={`url(#${markerId(edge.kind)})`}
|
|
224
|
+
data-flow-edge-kind={edge.kind}
|
|
225
|
+
data-flow-edge-from={edge.from}
|
|
226
|
+
data-flow-edge-to={edge.to}
|
|
227
|
+
/>
|
|
228
|
+
{#if displayLabel && edge.labelX !== null && edge.labelY !== null}
|
|
229
|
+
<g
|
|
230
|
+
class={["flow-edge-label", edge.labels.length > 1 && "is-multi"]}
|
|
231
|
+
transform={`translate(${edge.labelX}, ${edge.labelY})`}
|
|
232
|
+
data-flow-edge-label-from={edge.from}
|
|
233
|
+
data-flow-edge-label-to={edge.to}
|
|
234
|
+
data-flow-edge-label-count={edge.labels.length}
|
|
235
|
+
>
|
|
236
|
+
<rect
|
|
237
|
+
class="flow-edge-label-bg"
|
|
238
|
+
x={-(displayLabel.length * 3.4 + 6)}
|
|
239
|
+
y="-9"
|
|
240
|
+
width={displayLabel.length * 6.8 + 12}
|
|
241
|
+
height="18"
|
|
242
|
+
rx="5"
|
|
243
|
+
/>
|
|
244
|
+
<text class="flow-edge-label-text" x="0" y="0" dominant-baseline="middle" text-anchor="middle">
|
|
245
|
+
{displayLabel}
|
|
246
|
+
</text>
|
|
247
|
+
{#if edge.labels.length > 1}
|
|
248
|
+
<title>{edge.labels.join("\n")}</title>
|
|
249
|
+
{/if}
|
|
250
|
+
</g>
|
|
251
|
+
{/if}
|
|
252
|
+
{/each}
|
|
253
|
+
</g>
|
|
254
|
+
|
|
255
|
+
<g class="flow-nodes" role="list" aria-label="Process steps">
|
|
256
|
+
{#each layout.nodes as node (node.id)}
|
|
257
|
+
<g
|
|
258
|
+
class={nodeClasses(node)}
|
|
259
|
+
transform={`translate(${node.x - node.width / 2}, ${node.y - node.height / 2})`}
|
|
260
|
+
data-flow-turn-id={node.kind === "turn" ? node.id : undefined}
|
|
261
|
+
data-flow-end-state={node.kind === "end" ? node.lifecycleStatus : undefined}
|
|
262
|
+
data-flow-node-role={node.role ?? undefined}
|
|
263
|
+
role="listitem"
|
|
264
|
+
aria-label={nodeAriaLabel(node)}
|
|
265
|
+
>
|
|
266
|
+
{#if node.kind === "turn" && node.turnType}
|
|
267
|
+
<title>{turnTypeDescription(node.turnType)}</title>
|
|
268
|
+
{/if}
|
|
269
|
+
<rect
|
|
270
|
+
class="flow-box-rect"
|
|
271
|
+
width={node.width}
|
|
272
|
+
height={node.height}
|
|
273
|
+
rx={node.kind === "end" ? 9 : 13}
|
|
274
|
+
/>
|
|
275
|
+
{#if node.isEntry}
|
|
276
|
+
<rect class="flow-entry-tab" x="0" y="0" width={node.width} height="3" rx="1.5" />
|
|
277
|
+
{/if}
|
|
278
|
+
<text
|
|
279
|
+
class="flow-box-title"
|
|
280
|
+
x={node.width / 2}
|
|
281
|
+
y={node.kind === "end" ? node.height / 2 : node.height / 2 - 7}
|
|
282
|
+
text-anchor="middle"
|
|
283
|
+
dominant-baseline="middle"
|
|
284
|
+
>
|
|
285
|
+
{node.title}
|
|
286
|
+
</text>
|
|
287
|
+
{#if node.kind === "turn"}
|
|
288
|
+
<text
|
|
289
|
+
class="flow-box-subtitle"
|
|
290
|
+
x={node.width / 2}
|
|
291
|
+
y={node.height / 2 + 10}
|
|
292
|
+
text-anchor="middle"
|
|
293
|
+
dominant-baseline="middle"
|
|
294
|
+
>
|
|
295
|
+
{node.subtitle}
|
|
296
|
+
</text>
|
|
297
|
+
{/if}
|
|
298
|
+
</g>
|
|
299
|
+
{/each}
|
|
300
|
+
</g>
|
|
301
|
+
</svg>
|
|
302
|
+
</div>
|
|
303
|
+
<figcaption id={legendId} class="flow-legend">
|
|
304
|
+
<span class="flow-legend-item">
|
|
305
|
+
<span class="flow-legend-swatch is-spine" aria-hidden="true"></span>
|
|
306
|
+
Happy path
|
|
307
|
+
</span>
|
|
308
|
+
{#if branchNodes.length > 0}
|
|
309
|
+
<span class="flow-legend-item">
|
|
310
|
+
<span class="flow-legend-swatch is-branch" aria-hidden="true"></span>
|
|
311
|
+
Branch step
|
|
312
|
+
</span>
|
|
313
|
+
{/if}
|
|
314
|
+
{#if presentEdgeKinds.has("loopback")}
|
|
315
|
+
<span class="flow-legend-item">
|
|
316
|
+
<span class="flow-legend-line is-loopback" aria-hidden="true"></span>
|
|
317
|
+
Loops back
|
|
318
|
+
</span>
|
|
319
|
+
{/if}
|
|
320
|
+
{#each endStates as state (state.lifecycleStatus)}
|
|
321
|
+
<span class="flow-legend-item">
|
|
322
|
+
<span
|
|
323
|
+
class={`flow-legend-swatch is-end is-${state.lifecycleStatus}`}
|
|
324
|
+
aria-hidden="true"
|
|
325
|
+
></span>
|
|
326
|
+
{state.lifecycleStatus === "completed" ? "Completed" : "Aborted"}
|
|
327
|
+
</span>
|
|
328
|
+
{/each}
|
|
329
|
+
</figcaption>
|
|
330
|
+
</figure>
|
|
331
|
+
{/if}
|
|
332
|
+
{/snippet}
|
|
333
|
+
|
|
334
|
+
{#if expandable && hasSpine}
|
|
335
|
+
<div class="flow-disclosure" data-section="process-flow-disclosure">
|
|
336
|
+
<div class="flow-disclosure-body">
|
|
337
|
+
{#if expanded && showFullChart}
|
|
338
|
+
<div id={chartId}>
|
|
339
|
+
{@render fullChart()}
|
|
340
|
+
</div>
|
|
341
|
+
{:else}
|
|
342
|
+
{@render happyStrip()}
|
|
343
|
+
{/if}
|
|
344
|
+
</div>
|
|
345
|
+
<button
|
|
346
|
+
type="button"
|
|
347
|
+
class="flow-toggle"
|
|
348
|
+
data-pressable="true"
|
|
349
|
+
aria-expanded={expanded}
|
|
350
|
+
aria-controls={chartId}
|
|
351
|
+
onclick={() => (expanded = !expanded)}
|
|
352
|
+
>
|
|
353
|
+
<span class="flow-toggle-label">{expanded ? "Hide flow" : "Show full flow"}</span>
|
|
354
|
+
<span class={["flow-toggle-caret", expanded && "is-open"]} aria-hidden="true">›</span>
|
|
355
|
+
</button>
|
|
356
|
+
</div>
|
|
357
|
+
{:else if mode === "happy" && hasSpine}
|
|
358
|
+
{@render happyStrip()}
|
|
359
|
+
{:else if mode === "full" && showFullChart}
|
|
360
|
+
{@render fullChart()}
|
|
361
|
+
{/if}
|
|
362
|
+
|
|
363
|
+
<style>
|
|
364
|
+
/* Progressive-disclosure: body plus a static caret pinned top-right */
|
|
365
|
+
.flow-disclosure {
|
|
366
|
+
display: flex;
|
|
367
|
+
align-items: flex-start;
|
|
368
|
+
gap: 12px;
|
|
369
|
+
width: 100%;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.flow-disclosure-body {
|
|
373
|
+
flex: 1 1 auto;
|
|
374
|
+
min-width: 0;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/* A lightweight text + caret affordance, not a button. */
|
|
378
|
+
.flow-toggle {
|
|
379
|
+
flex: 0 0 auto;
|
|
380
|
+
display: inline-flex;
|
|
381
|
+
align-items: center;
|
|
382
|
+
gap: 5px;
|
|
383
|
+
margin-top: 1px;
|
|
384
|
+
padding: 4px 6px;
|
|
385
|
+
border: 0;
|
|
386
|
+
border-radius: 6px;
|
|
387
|
+
background: transparent;
|
|
388
|
+
color: var(--chronicle-text-muted);
|
|
389
|
+
font: inherit;
|
|
390
|
+
font-size: 0.78rem;
|
|
391
|
+
font-weight: 640;
|
|
392
|
+
cursor: pointer;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.flow-toggle:hover,
|
|
396
|
+
.flow-toggle:focus-visible {
|
|
397
|
+
color: var(--chronicle-text);
|
|
398
|
+
background: color-mix(in srgb, var(--chronicle-text) 8%, transparent 92%);
|
|
399
|
+
outline: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.flow-toggle-label {
|
|
403
|
+
white-space: nowrap;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.flow-toggle-caret {
|
|
407
|
+
display: inline-block;
|
|
408
|
+
font-size: 1.05rem;
|
|
409
|
+
line-height: 1;
|
|
410
|
+
transition: transform 140ms ease;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.flow-toggle-caret.is-open {
|
|
414
|
+
transform: rotate(90deg);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
@media (prefers-reduced-motion: reduce) {
|
|
418
|
+
.flow-toggle-caret {
|
|
419
|
+
transition: none;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/* Happy-path compact strip */
|
|
424
|
+
.process-flow {
|
|
425
|
+
display: flex;
|
|
426
|
+
flex-wrap: wrap;
|
|
427
|
+
align-items: center;
|
|
428
|
+
gap: 8px;
|
|
429
|
+
padding: 0;
|
|
430
|
+
margin: 0;
|
|
431
|
+
list-style: none;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.flow-step {
|
|
435
|
+
display: inline-flex;
|
|
436
|
+
align-items: center;
|
|
437
|
+
gap: 8px;
|
|
438
|
+
min-width: 0;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.step-chip {
|
|
442
|
+
display: inline-flex;
|
|
443
|
+
align-items: center;
|
|
444
|
+
min-height: 30px;
|
|
445
|
+
padding: 5px 10px;
|
|
446
|
+
border: 1px solid color-mix(in srgb, var(--chronicle-border) 78%, transparent 22%);
|
|
447
|
+
border-radius: 999px;
|
|
448
|
+
background: color-mix(in srgb, var(--chronicle-card-surface) 86%, var(--chronicle-accent-soft) 14%);
|
|
449
|
+
color: var(--chronicle-text);
|
|
450
|
+
font-size: 0.78rem;
|
|
451
|
+
font-weight: 620;
|
|
452
|
+
line-height: 1.25;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.step-arrow {
|
|
456
|
+
color: color-mix(in srgb, var(--chronicle-text-muted) 84%, var(--chronicle-accent) 16%);
|
|
457
|
+
font-weight: 700;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.end-chip {
|
|
461
|
+
display: inline-flex;
|
|
462
|
+
align-items: center;
|
|
463
|
+
min-height: 30px;
|
|
464
|
+
padding: 5px 12px;
|
|
465
|
+
border-radius: 8px;
|
|
466
|
+
font-size: 0.78rem;
|
|
467
|
+
font-weight: 680;
|
|
468
|
+
line-height: 1.25;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.end-chip.is-completed {
|
|
472
|
+
background: color-mix(in srgb, var(--chronicle-success, #2f9e63) 18%, var(--chronicle-card-surface) 82%);
|
|
473
|
+
border: 1px solid color-mix(in srgb, var(--chronicle-success, #2f9e63) 42%, transparent 58%);
|
|
474
|
+
color: color-mix(in srgb, var(--chronicle-success, #2f9e63) 72%, var(--chronicle-text) 28%);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.is-compact {
|
|
478
|
+
gap: 6px;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.is-compact .flow-step {
|
|
482
|
+
gap: 6px;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.is-compact .step-chip,
|
|
486
|
+
.is-compact .end-chip {
|
|
487
|
+
min-height: 26px;
|
|
488
|
+
padding: 4px 8px;
|
|
489
|
+
font-size: 0.73rem;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/* Full SVG flow chart */
|
|
493
|
+
.process-flow-chart {
|
|
494
|
+
width: 100%;
|
|
495
|
+
margin: 0;
|
|
496
|
+
padding: 4px 0;
|
|
497
|
+
display: flex;
|
|
498
|
+
flex-direction: column;
|
|
499
|
+
gap: 10px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/*
|
|
503
|
+
* Bound the chart so expanding it orients the operator without shoving the
|
|
504
|
+
* setup form below the fold. The SVG scales to fit within this box (meet),
|
|
505
|
+
* and the box scrolls only when the graph is genuinely larger than the cap.
|
|
506
|
+
*/
|
|
507
|
+
.flow-svg-viewport {
|
|
508
|
+
width: 100%;
|
|
509
|
+
overflow: auto;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.flow-svg {
|
|
513
|
+
display: block;
|
|
514
|
+
width: 100%;
|
|
515
|
+
height: auto;
|
|
516
|
+
max-height: clamp(260px, 42vh, 520px);
|
|
517
|
+
font-family: inherit;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/* Legend / key for the chart's visual language. */
|
|
521
|
+
.flow-legend {
|
|
522
|
+
display: flex;
|
|
523
|
+
flex-wrap: wrap;
|
|
524
|
+
align-items: center;
|
|
525
|
+
gap: 8px 16px;
|
|
526
|
+
margin: 0;
|
|
527
|
+
padding: 0;
|
|
528
|
+
color: var(--chronicle-text-muted);
|
|
529
|
+
font-size: 0.72rem;
|
|
530
|
+
font-weight: 600;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.flow-legend-item {
|
|
534
|
+
display: inline-flex;
|
|
535
|
+
align-items: center;
|
|
536
|
+
gap: 6px;
|
|
537
|
+
white-space: nowrap;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.flow-legend-swatch {
|
|
541
|
+
display: inline-block;
|
|
542
|
+
width: 16px;
|
|
543
|
+
height: 12px;
|
|
544
|
+
border-radius: 4px;
|
|
545
|
+
background: color-mix(in srgb, var(--chronicle-card-surface) 92%, var(--chronicle-accent-soft) 8%);
|
|
546
|
+
border: 1px solid color-mix(in srgb, var(--chronicle-border) 78%, transparent 22%);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.flow-legend-swatch.is-spine {
|
|
550
|
+
background: color-mix(in srgb, var(--chronicle-card-surface) 76%, var(--chronicle-accent-soft) 24%);
|
|
551
|
+
border-color: color-mix(in srgb, var(--chronicle-accent) 42%, var(--chronicle-border) 58%);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.flow-legend-swatch.is-branch {
|
|
555
|
+
border-style: dashed;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.flow-legend-swatch.is-end.is-completed {
|
|
559
|
+
background: color-mix(in srgb, var(--chronicle-success, #2f9e63) 16%, var(--chronicle-card-surface) 84%);
|
|
560
|
+
border-color: color-mix(in srgb, var(--chronicle-success, #2f9e63) 48%, transparent 52%);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.flow-legend-swatch.is-end.is-aborted {
|
|
564
|
+
background: color-mix(in srgb, var(--chronicle-danger, #c4453f) 13%, var(--chronicle-card-surface) 87%);
|
|
565
|
+
border-color: color-mix(in srgb, var(--chronicle-danger, #c4453f) 46%, transparent 54%);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.flow-legend-line {
|
|
569
|
+
display: inline-block;
|
|
570
|
+
width: 18px;
|
|
571
|
+
height: 0;
|
|
572
|
+
border-top: 2px dashed color-mix(in srgb, #d08a1e 64%, var(--chronicle-text-muted) 36%);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.flow-box-rect {
|
|
576
|
+
fill: color-mix(in srgb, var(--chronicle-card-surface) 92%, var(--chronicle-accent-soft) 8%);
|
|
577
|
+
stroke: color-mix(in srgb, var(--chronicle-border) 78%, transparent 22%);
|
|
578
|
+
stroke-width: 1.2;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.is-turn {
|
|
582
|
+
cursor: help;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.is-spine .flow-box-rect {
|
|
586
|
+
fill: color-mix(in srgb, var(--chronicle-card-surface) 76%, var(--chronicle-accent-soft) 24%);
|
|
587
|
+
stroke: color-mix(in srgb, var(--chronicle-accent) 42%, var(--chronicle-border) 58%);
|
|
588
|
+
stroke-width: 1.6;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.is-branch .flow-box-rect {
|
|
592
|
+
stroke-dasharray: 4 3;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.is-end.is-completed .flow-box-rect {
|
|
596
|
+
fill: color-mix(in srgb, var(--chronicle-success, #2f9e63) 16%, var(--chronicle-card-surface) 84%);
|
|
597
|
+
stroke: color-mix(in srgb, var(--chronicle-success, #2f9e63) 48%, transparent 52%);
|
|
598
|
+
stroke-width: 1.6;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.is-end.is-aborted .flow-box-rect {
|
|
602
|
+
fill: color-mix(in srgb, var(--chronicle-danger, #c4453f) 13%, var(--chronicle-card-surface) 87%);
|
|
603
|
+
stroke: color-mix(in srgb, var(--chronicle-danger, #c4453f) 46%, transparent 54%);
|
|
604
|
+
stroke-width: 1.6;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.flow-entry-tab {
|
|
608
|
+
fill: color-mix(in srgb, var(--chronicle-accent) 70%, var(--chronicle-text) 30%);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.flow-box-title {
|
|
612
|
+
fill: var(--chronicle-text);
|
|
613
|
+
font-size: 12.5px;
|
|
614
|
+
font-weight: 640;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.is-end .flow-box-title {
|
|
618
|
+
font-weight: 700;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.is-end.is-completed .flow-box-title {
|
|
622
|
+
fill: color-mix(in srgb, var(--chronicle-success, #2f9e63) 70%, var(--chronicle-text) 30%);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.is-end.is-aborted .flow-box-title {
|
|
626
|
+
fill: color-mix(in srgb, var(--chronicle-danger, #c4453f) 68%, var(--chronicle-text) 32%);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.flow-box-subtitle {
|
|
630
|
+
fill: var(--chronicle-text-muted);
|
|
631
|
+
font-size: 9.5px;
|
|
632
|
+
font-weight: 600;
|
|
633
|
+
letter-spacing: 0.03em;
|
|
634
|
+
text-transform: uppercase;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.flow-edge {
|
|
638
|
+
stroke-width: 1.6;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.flow-edge.is-forward {
|
|
642
|
+
stroke: color-mix(in srgb, var(--chronicle-accent) 56%, var(--chronicle-text-muted) 44%);
|
|
643
|
+
stroke-width: 2;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.flow-edge.is-branch {
|
|
647
|
+
stroke: color-mix(in srgb, var(--chronicle-text-muted) 70%, transparent 30%);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.flow-edge.is-loopback {
|
|
651
|
+
stroke: color-mix(in srgb, #d08a1e 64%, var(--chronicle-text-muted) 36%);
|
|
652
|
+
stroke-dasharray: 5 4;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.flow-edge.is-terminal {
|
|
656
|
+
stroke: color-mix(in srgb, var(--chronicle-text-muted) 78%, transparent 22%);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.flow-marker path {
|
|
660
|
+
fill: var(--chronicle-text-muted);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
.flow-marker.is-forward path {
|
|
664
|
+
fill: color-mix(in srgb, var(--chronicle-accent) 56%, var(--chronicle-text-muted) 44%);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.flow-marker.is-loopback path {
|
|
668
|
+
fill: color-mix(in srgb, #d08a1e 64%, var(--chronicle-text-muted) 36%);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
.flow-edge-label-bg {
|
|
672
|
+
fill: color-mix(in srgb, var(--chronicle-card-surface) 90%, transparent 10%);
|
|
673
|
+
stroke: color-mix(in srgb, var(--chronicle-border) 70%, transparent 30%);
|
|
674
|
+
stroke-width: 0.8;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.flow-edge-label-text {
|
|
678
|
+
fill: var(--chronicle-text-muted);
|
|
679
|
+
font-size: 9.5px;
|
|
680
|
+
font-weight: 620;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
.flow-edge-label.is-multi {
|
|
684
|
+
cursor: help;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.flow-edge-label.is-multi .flow-edge-label-bg {
|
|
688
|
+
fill: color-mix(in srgb, var(--chronicle-accent-soft) 30%, var(--chronicle-card-surface) 70%);
|
|
689
|
+
stroke: color-mix(in srgb, var(--chronicle-accent) 40%, var(--chronicle-border) 60%);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.flow-edge-label.is-multi .flow-edge-label-text {
|
|
693
|
+
fill: color-mix(in srgb, var(--chronicle-accent) 60%, var(--chronicle-text) 40%);
|
|
694
|
+
font-weight: 700;
|
|
695
|
+
}
|
|
696
|
+
</style>
|