@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,155 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
buildLauncherScheduleHourOptions,
|
|
4
|
+
buildLauncherScheduleMinuteOptions,
|
|
5
|
+
} from "./launcher-schedule.js";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
dateId: string;
|
|
9
|
+
hourId: string;
|
|
10
|
+
minuteId: string;
|
|
11
|
+
dateValue: string;
|
|
12
|
+
hourValue: string;
|
|
13
|
+
minuteValue: string;
|
|
14
|
+
dataSection?: string;
|
|
15
|
+
marker?: "action" | "launcher" | null;
|
|
16
|
+
onDateChange: (value: string) => void;
|
|
17
|
+
onHourChange: (value: string) => void;
|
|
18
|
+
onMinuteChange: (value: string) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
dateId,
|
|
23
|
+
hourId,
|
|
24
|
+
minuteId,
|
|
25
|
+
dateValue,
|
|
26
|
+
hourValue,
|
|
27
|
+
minuteValue,
|
|
28
|
+
dataSection = "schedule-date-time-picker",
|
|
29
|
+
marker = null,
|
|
30
|
+
onDateChange,
|
|
31
|
+
onHourChange,
|
|
32
|
+
onMinuteChange,
|
|
33
|
+
}: Props = $props();
|
|
34
|
+
|
|
35
|
+
const scheduleHourOptions = buildLauncherScheduleHourOptions();
|
|
36
|
+
const scheduleMinuteOptions = buildLauncherScheduleMinuteOptions();
|
|
37
|
+
const markerAttrs = $derived(
|
|
38
|
+
marker === "action"
|
|
39
|
+
? { "data-action-form-field": true }
|
|
40
|
+
: marker === "launcher"
|
|
41
|
+
? { "data-launcher-form-field": true }
|
|
42
|
+
: {},
|
|
43
|
+
);
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<div class="schedule-date-time-picker" data-section={dataSection} data-time-format="24-hour">
|
|
47
|
+
<input
|
|
48
|
+
id={dateId}
|
|
49
|
+
{...markerAttrs}
|
|
50
|
+
type="date"
|
|
51
|
+
value={dateValue}
|
|
52
|
+
oninput={(event) => onDateChange((event.currentTarget as HTMLInputElement).value)}
|
|
53
|
+
/>
|
|
54
|
+
<div class="schedule-time-picker">
|
|
55
|
+
<select
|
|
56
|
+
id={hourId}
|
|
57
|
+
value={hourValue}
|
|
58
|
+
aria-label="Hour (24-hour)"
|
|
59
|
+
onchange={(event) => onHourChange((event.currentTarget as HTMLSelectElement).value)}
|
|
60
|
+
>
|
|
61
|
+
<option value="">HH</option>
|
|
62
|
+
{#each scheduleHourOptions as option (option.value)}
|
|
63
|
+
<option value={option.value}>{option.label}</option>
|
|
64
|
+
{/each}
|
|
65
|
+
</select>
|
|
66
|
+
<span class="schedule-time-separator" aria-hidden="true">:</span>
|
|
67
|
+
<select
|
|
68
|
+
id={minuteId}
|
|
69
|
+
value={minuteValue}
|
|
70
|
+
aria-label="Minute"
|
|
71
|
+
onchange={(event) => onMinuteChange((event.currentTarget as HTMLSelectElement).value)}
|
|
72
|
+
>
|
|
73
|
+
<option value="">MM</option>
|
|
74
|
+
{#each scheduleMinuteOptions as option (option.value)}
|
|
75
|
+
<option value={option.value}>{option.label}</option>
|
|
76
|
+
{/each}
|
|
77
|
+
</select>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<style>
|
|
82
|
+
.schedule-date-time-picker {
|
|
83
|
+
display: grid;
|
|
84
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
85
|
+
gap: 12px;
|
|
86
|
+
align-items: center;
|
|
87
|
+
padding: 12px 14px;
|
|
88
|
+
border: 1px solid color-mix(in srgb, var(--chronicle-border) 88%, white 12%);
|
|
89
|
+
border-radius: 16px;
|
|
90
|
+
background: color-mix(in srgb, white 88%, var(--chronicle-panel-muted) 12%);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.schedule-date-time-picker input,
|
|
94
|
+
.schedule-date-time-picker select {
|
|
95
|
+
margin: 0;
|
|
96
|
+
min-height: 42px;
|
|
97
|
+
padding: 0;
|
|
98
|
+
border: 0;
|
|
99
|
+
background: transparent;
|
|
100
|
+
box-shadow: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.schedule-date-time-picker input:hover,
|
|
104
|
+
.schedule-date-time-picker select:hover {
|
|
105
|
+
border-color: transparent;
|
|
106
|
+
background: transparent;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.schedule-time-picker {
|
|
110
|
+
display: grid;
|
|
111
|
+
grid-template-columns: minmax(72px, 88px) auto minmax(72px, 88px);
|
|
112
|
+
gap: 8px;
|
|
113
|
+
align-items: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.schedule-time-picker select {
|
|
117
|
+
text-align: center;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.schedule-time-separator {
|
|
121
|
+
font-size: 1rem;
|
|
122
|
+
font-weight: 620;
|
|
123
|
+
color: var(--chronicle-text-muted);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (max-width: 860px) {
|
|
127
|
+
.schedule-date-time-picker,
|
|
128
|
+
.schedule-time-picker {
|
|
129
|
+
grid-template-columns: 1fr;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:global(.schedule-choice) {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: 10px;
|
|
137
|
+
padding: 12px 14px;
|
|
138
|
+
border-radius: 14px;
|
|
139
|
+
border: 1px solid color-mix(in srgb, var(--chronicle-border) 84%, white 16%);
|
|
140
|
+
background: color-mix(in srgb, var(--chronicle-card-surface) 96%, white 4%);
|
|
141
|
+
color: var(--chronicle-text);
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:global(.schedule-choice[data-selected="true"]) {
|
|
146
|
+
border-color: color-mix(in srgb, var(--chronicle-accent) 28%, var(--chronicle-border) 72%);
|
|
147
|
+
background: color-mix(in srgb, white 94%, var(--chronicle-accent-soft) 6%);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:global(.schedule-choice input) {
|
|
151
|
+
width: auto;
|
|
152
|
+
height: auto;
|
|
153
|
+
margin: 0;
|
|
154
|
+
}
|
|
155
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SkillOptionSummary } from "@leitwerk-dev/protocol";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
skills: readonly SkillOptionSummary[];
|
|
6
|
+
selectedIds?: string[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { skills, selectedIds = $bindable([]) }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<fieldset class="skill-selector" data-section="launcher-skills">
|
|
13
|
+
<legend class="field-label">Skills</legend>
|
|
14
|
+
<p class="field-description">Make selected skills available to every AI step in this run.</p>
|
|
15
|
+
{#each skills as skill (skill.id)}
|
|
16
|
+
<label class="skill-option">
|
|
17
|
+
<input type="checkbox" value={skill.id} bind:group={selectedIds} />
|
|
18
|
+
<span>
|
|
19
|
+
<strong>{skill.label}</strong>
|
|
20
|
+
{#if skill.description}<small>{skill.description}</small>{/if}
|
|
21
|
+
</span>
|
|
22
|
+
</label>
|
|
23
|
+
{/each}
|
|
24
|
+
</fieldset>
|
|
25
|
+
|
|
26
|
+
<style>
|
|
27
|
+
.skill-selector {
|
|
28
|
+
border: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
margin: 1.25rem 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.skill-option {
|
|
34
|
+
display: flex;
|
|
35
|
+
gap: 0.65rem;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
margin: 0.65rem 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.skill-option small {
|
|
41
|
+
display: block;
|
|
42
|
+
color: var(--color-text-muted, #667085);
|
|
43
|
+
margin-top: 0.15rem;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { isPlainShortcut, isTextEntryTarget } from "../lib/keyboard.js";
|
|
3
|
+
import { keyboardShortcutHelpOpen } from "../lib/keyboard-shortcuts-help.js";
|
|
4
|
+
import { dismissLatestToast, dismissToast, openToast, toastStore } from "../lib/toasts.svelte";
|
|
5
|
+
|
|
6
|
+
function toastKicker(eventType: string, level: "warn" | "error"): string {
|
|
7
|
+
if (eventType === "action_required") {
|
|
8
|
+
return "Action required";
|
|
9
|
+
}
|
|
10
|
+
return level === "error" ? "Error" : "Heads up";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$effect(() => {
|
|
14
|
+
const shortcutHelpOpen = $keyboardShortcutHelpOpen;
|
|
15
|
+
|
|
16
|
+
const handleWindowKeydown = (event: KeyboardEvent) => {
|
|
17
|
+
if (
|
|
18
|
+
event.defaultPrevented ||
|
|
19
|
+
shortcutHelpOpen ||
|
|
20
|
+
!isPlainShortcut(event) ||
|
|
21
|
+
isTextEntryTarget(event.target) ||
|
|
22
|
+
event.key !== "Escape"
|
|
23
|
+
) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if ($toastStore.length === 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
dismissLatestToast();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
window.addEventListener("keydown", handleWindowKeydown);
|
|
34
|
+
return () => {
|
|
35
|
+
window.removeEventListener("keydown", handleWindowKeydown);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
{#if $toastStore.length > 0}
|
|
41
|
+
<div class="toast-container" aria-live="polite" aria-atomic="false">
|
|
42
|
+
{#each $toastStore as toast (toast.id)}
|
|
43
|
+
<div class="toast" class:warn={toast.level === "warn"} class:error={toast.level === "error"}>
|
|
44
|
+
<button
|
|
45
|
+
type="button"
|
|
46
|
+
class="toast-open"
|
|
47
|
+
data-pressable="true"
|
|
48
|
+
onclick={() => openToast(toast.id)}
|
|
49
|
+
>
|
|
50
|
+
<div class="toast-copy">
|
|
51
|
+
<p class="toast-title">
|
|
52
|
+
<span class="toast-kicker">{toastKicker(toast.eventType, toast.level)}</span>
|
|
53
|
+
<span class="toast-shortcut">Esc dismisses the newest message</span>
|
|
54
|
+
</p>
|
|
55
|
+
<p class="toast-message">{toast.message}</p>
|
|
56
|
+
</div>
|
|
57
|
+
</button>
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
class="toast-dismiss"
|
|
61
|
+
data-pressable="true"
|
|
62
|
+
onclick={() => dismissToast(toast.id)}
|
|
63
|
+
>
|
|
64
|
+
Dismiss
|
|
65
|
+
</button>
|
|
66
|
+
</div>
|
|
67
|
+
{/each}
|
|
68
|
+
</div>
|
|
69
|
+
{/if}
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.toast-container {
|
|
73
|
+
position: fixed;
|
|
74
|
+
top: 16px;
|
|
75
|
+
right: 16px;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: 10px;
|
|
79
|
+
z-index: 1000;
|
|
80
|
+
max-width: min(440px, calc(100vw - 32px));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.toast {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: flex-start;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
gap: 14px;
|
|
88
|
+
padding: 14px 16px;
|
|
89
|
+
border-radius: 16px;
|
|
90
|
+
border: 1px solid var(--chronicle-border);
|
|
91
|
+
background: color-mix(in srgb, var(--chronicle-panel-surface) 92%, var(--chronicle-panel-muted) 8%);
|
|
92
|
+
box-shadow: var(--chronicle-shadow-soft);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.toast.warn {
|
|
96
|
+
border-color: color-mix(in srgb, var(--chronicle-attention) 42%, var(--chronicle-border) 58%);
|
|
97
|
+
background: color-mix(in srgb, white 90%, var(--chronicle-attention) 10%);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.toast.error {
|
|
101
|
+
border-color: color-mix(in srgb, var(--chronicle-danger) 38%, var(--chronicle-border) 62%);
|
|
102
|
+
background: color-mix(in srgb, white 90%, var(--chronicle-danger) 10%);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.toast-open {
|
|
106
|
+
flex: 1;
|
|
107
|
+
min-width: 0;
|
|
108
|
+
padding: 0;
|
|
109
|
+
border: 0;
|
|
110
|
+
background: transparent;
|
|
111
|
+
color: inherit;
|
|
112
|
+
text-align: left;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.toast-copy {
|
|
117
|
+
display: grid;
|
|
118
|
+
gap: 6px;
|
|
119
|
+
min-width: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.toast-title {
|
|
123
|
+
margin: 0;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-wrap: wrap;
|
|
126
|
+
gap: 10px;
|
|
127
|
+
align-items: baseline;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.toast-kicker {
|
|
131
|
+
font-size: 11px;
|
|
132
|
+
font-weight: 700;
|
|
133
|
+
letter-spacing: 0.08em;
|
|
134
|
+
text-transform: uppercase;
|
|
135
|
+
color: var(--chronicle-text);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.toast-shortcut {
|
|
139
|
+
font-size: 12px;
|
|
140
|
+
line-height: 1.4;
|
|
141
|
+
color: var(--chronicle-text-muted);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.toast-message {
|
|
145
|
+
margin: 0;
|
|
146
|
+
font-size: 14px;
|
|
147
|
+
line-height: 1.55;
|
|
148
|
+
color: var(--chronicle-text);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.toast-open:hover .toast-message,
|
|
152
|
+
.toast-open:focus-visible .toast-message {
|
|
153
|
+
text-decoration: underline;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.toast-dismiss {
|
|
157
|
+
min-height: 44px;
|
|
158
|
+
padding: 0 14px;
|
|
159
|
+
border: 1px solid color-mix(in srgb, var(--chronicle-border-strong) 84%, white 16%);
|
|
160
|
+
border-radius: 999px;
|
|
161
|
+
background: color-mix(in srgb, var(--chronicle-card-surface) 92%, white 8%);
|
|
162
|
+
color: var(--chronicle-text);
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.toast-dismiss:hover {
|
|
168
|
+
transform: translateY(-1px);
|
|
169
|
+
border-color: color-mix(in srgb, var(--chronicle-accent) 22%, var(--chronicle-border-strong) 78%);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (max-width: 720px) {
|
|
173
|
+
.toast-container {
|
|
174
|
+
left: 12px;
|
|
175
|
+
right: 12px;
|
|
176
|
+
top: 12px;
|
|
177
|
+
max-width: none;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.toast {
|
|
181
|
+
padding: 12px 14px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.toast-title {
|
|
185
|
+
gap: 6px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.toast-shortcut {
|
|
189
|
+
width: 100%;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
</style>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { LauncherFieldDefinition, LauncherValidationError } from "../lib/api.js";
|
|
2
|
+
|
|
3
|
+
export interface LauncherDefaultsNotice {
|
|
4
|
+
tone: "warning";
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
fieldIds: readonly string[];
|
|
8
|
+
details: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface LauncherValidationView {
|
|
12
|
+
fieldErrors: Record<string, string[]>;
|
|
13
|
+
formErrors: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function escapeRegExp(value: string): string {
|
|
17
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function buildFieldLookup(
|
|
21
|
+
fields: readonly LauncherFieldDefinition[],
|
|
22
|
+
): Record<string, LauncherFieldDefinition> {
|
|
23
|
+
return Object.fromEntries(fields.map((field) => [field.id, field]));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getNoticeFieldLabel(field: LauncherFieldDefinition): string {
|
|
27
|
+
if (field.id === "repoLocator") {
|
|
28
|
+
return "Repository path or URL";
|
|
29
|
+
}
|
|
30
|
+
return field.label;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function replaceFieldIdsWithLabels(
|
|
34
|
+
message: string,
|
|
35
|
+
fieldLookup: Record<string, LauncherFieldDefinition>,
|
|
36
|
+
): string {
|
|
37
|
+
let nextMessage = message;
|
|
38
|
+
for (const [fieldId, field] of Object.entries(fieldLookup).sort(
|
|
39
|
+
([leftId], [rightId]) => rightId.length - leftId.length,
|
|
40
|
+
)) {
|
|
41
|
+
nextMessage = nextMessage.replace(
|
|
42
|
+
new RegExp(`\\b${escapeRegExp(fieldId)}\\b`, "g"),
|
|
43
|
+
getNoticeFieldLabel(field),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return nextMessage;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function isBlankLauncherFieldValue(value: unknown): boolean {
|
|
50
|
+
if (typeof value === "string") {
|
|
51
|
+
return value.trim() === "";
|
|
52
|
+
}
|
|
53
|
+
return value == null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function pushUnique(target: string[], value: string) {
|
|
57
|
+
if (!target.includes(value)) {
|
|
58
|
+
target.push(value);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function humanizeLauncherValidationMessage(
|
|
63
|
+
fields: readonly LauncherFieldDefinition[],
|
|
64
|
+
error: LauncherValidationError,
|
|
65
|
+
): string {
|
|
66
|
+
const fieldLookup = buildFieldLookup(fields);
|
|
67
|
+
const field = typeof error.fieldId === "string" ? fieldLookup[error.fieldId] : undefined;
|
|
68
|
+
|
|
69
|
+
if (field && error.code === "required") {
|
|
70
|
+
return "Required.";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (field?.id === "repoLocator" && error.code === "invalid_repo_locator") {
|
|
74
|
+
return "Use a local path or remote Git URL.";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const replacedMessage = replaceFieldIdsWithLabels(error.message, fieldLookup).trim();
|
|
78
|
+
if (replacedMessage === "") {
|
|
79
|
+
return "Check this field.";
|
|
80
|
+
}
|
|
81
|
+
return replacedMessage;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function normalizeLauncherValidationErrors(
|
|
85
|
+
fields: readonly LauncherFieldDefinition[],
|
|
86
|
+
errors: readonly LauncherValidationError[],
|
|
87
|
+
): LauncherValidationView {
|
|
88
|
+
const nextFieldErrors: Record<string, string[]> = {};
|
|
89
|
+
const nextFormErrors: string[] = [];
|
|
90
|
+
|
|
91
|
+
for (const error of errors) {
|
|
92
|
+
const message = humanizeLauncherValidationMessage(fields, error);
|
|
93
|
+
if (typeof error.fieldId === "string" && error.fieldId.trim() !== "") {
|
|
94
|
+
const fieldId = error.fieldId.trim();
|
|
95
|
+
nextFieldErrors[fieldId] = nextFieldErrors[fieldId] ?? [];
|
|
96
|
+
pushUnique(nextFieldErrors[fieldId], message);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
pushUnique(nextFormErrors, message);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
fieldErrors: nextFieldErrors,
|
|
104
|
+
formErrors: nextFormErrors,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function getFirstLauncherFieldIdWithErrors(
|
|
109
|
+
fields: readonly LauncherFieldDefinition[],
|
|
110
|
+
fieldErrors: Record<string, readonly string[]>,
|
|
111
|
+
): string | null {
|
|
112
|
+
for (const field of fields) {
|
|
113
|
+
if ((fieldErrors[field.id]?.length ?? 0) > 0) {
|
|
114
|
+
return field.id;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
for (const fieldId of Object.keys(fieldErrors)) {
|
|
118
|
+
if ((fieldErrors[fieldId]?.length ?? 0) > 0) {
|
|
119
|
+
return fieldId;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function buildLauncherDefaultsNotice(input: {
|
|
126
|
+
fields: readonly LauncherFieldDefinition[];
|
|
127
|
+
values: Record<string, unknown>;
|
|
128
|
+
warnings: readonly LauncherValidationError[];
|
|
129
|
+
}): LauncherDefaultsNotice | null {
|
|
130
|
+
if (input.warnings.length === 0) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const fieldLookup = buildFieldLookup(input.fields);
|
|
135
|
+
const setupFieldIds: string[] = [];
|
|
136
|
+
let isPureSetupState = true;
|
|
137
|
+
|
|
138
|
+
for (const warning of input.warnings) {
|
|
139
|
+
if (typeof warning.fieldId !== "string" || warning.fieldId.trim() === "") {
|
|
140
|
+
isPureSetupState = false;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const fieldId = warning.fieldId.trim();
|
|
144
|
+
const field = fieldLookup[fieldId];
|
|
145
|
+
if (!field || field.required !== true || !isBlankLauncherFieldValue(input.values[fieldId])) {
|
|
146
|
+
isPureSetupState = false;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
pushUnique(setupFieldIds, fieldId);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (isPureSetupState && setupFieldIds.length > 0) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const details: string[] = [];
|
|
157
|
+
const warningFieldIds: string[] = [];
|
|
158
|
+
for (const warning of input.warnings) {
|
|
159
|
+
pushUnique(details, humanizeLauncherValidationMessage(input.fields, warning));
|
|
160
|
+
if (typeof warning.fieldId === "string" && warning.fieldId.trim() !== "") {
|
|
161
|
+
pushUnique(warningFieldIds, warning.fieldId.trim());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
tone: "warning",
|
|
167
|
+
title: "We adjusted some starter values",
|
|
168
|
+
message: "Review the highlighted details before you launch.",
|
|
169
|
+
fieldIds: warningFieldIds,
|
|
170
|
+
details,
|
|
171
|
+
};
|
|
172
|
+
}
|