@svadmin/ui 0.121.0 → 0.122.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/app.css +204 -11
- package/dist/app.theme.css +204 -11
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AnnouncementBanner.svelte +314 -0
- package/dist/components/AnnouncementBanner.svelte.d.ts +45 -0
- package/dist/components/AsyncExportModal.svelte +551 -0
- package/dist/components/AsyncExportModal.svelte.d.ts +50 -0
- package/dist/components/AudioFeedbackProvider.svelte +131 -0
- package/dist/components/AudioFeedbackProvider.svelte.d.ts +11 -0
- package/dist/components/AuditLogViewer.svelte +1 -1
- package/dist/components/CanvasAnnotation.svelte +1 -1
- package/dist/components/ColumnFilterBuilder.svelte +135 -0
- package/dist/components/ColumnFilterBuilder.svelte.d.ts +20 -0
- package/dist/components/ColumnSettings.svelte +1 -1
- package/dist/components/ColumnVisibilityDrawer.svelte +541 -0
- package/dist/components/ColumnVisibilityDrawer.svelte.d.ts +16 -0
- package/dist/components/ConcurrentConflictModal.svelte +7 -7
- package/dist/components/ConversionFunnel.svelte +154 -0
- package/dist/components/ConversionFunnel.svelte.d.ts +22 -0
- package/dist/components/CronExpressionBuilder.svelte +1 -1
- package/dist/components/DecisionTable.svelte +1 -1
- package/dist/components/DevTools.svelte +1 -1
- package/dist/components/DraggableRowTable.svelte +1 -1
- package/dist/components/DualApprovalGate.svelte +418 -0
- package/dist/components/DualApprovalGate.svelte.d.ts +39 -0
- package/dist/components/EditableTable.svelte +1 -1
- package/dist/components/ExcelImportWizard.svelte +2 -2
- package/dist/components/GlobalShortcuts.svelte +1 -1
- package/dist/components/ImageCropper.svelte +1 -1
- package/dist/components/ImportWizard.svelte +1 -1
- package/dist/components/JsonSchemaForm.svelte +1 -1
- package/dist/components/JsonViewer.svelte +11 -11
- package/dist/components/KeyboardShortcutsModal.svelte +362 -0
- package/dist/components/KeyboardShortcutsModal.svelte.d.ts +22 -0
- package/dist/components/KpiCard.svelte +5 -5
- package/dist/components/MasterDetailView.svelte +1 -1
- package/dist/components/MetricGrid.svelte +2 -2
- package/dist/components/MicroAppBridge.svelte +59 -0
- package/dist/components/MicroAppBridge.svelte.d.ts +11 -0
- package/dist/components/OfflineSyncBanner.svelte +1 -1
- package/dist/components/OrgChart.svelte +1 -1
- package/dist/components/OrgTreePicker.svelte +1 -1
- package/dist/components/OtpInput.svelte +5 -5
- package/dist/components/PdfDocumentViewer.svelte +2 -2
- package/dist/components/PivotDrilldownModal.svelte +6 -6
- package/dist/components/PivotTable.svelte +1 -1
- package/dist/components/PricingCard.svelte +1 -1
- package/dist/components/PricingTable.svelte +1 -1
- package/dist/components/PrintableBill.svelte +2 -2
- package/dist/components/PrintableReportLayout.svelte +259 -0
- package/dist/components/PrintableReportLayout.svelte.d.ts +32 -0
- package/dist/components/ProSkeleton.svelte +6 -6
- package/dist/components/ResultPage.svelte +2 -2
- package/dist/components/SafeDeleteConfirm.svelte +5 -5
- package/dist/components/SankeyChart.svelte +111 -0
- package/dist/components/SankeyChart.svelte.d.ts +22 -0
- package/dist/components/SchemaVisualModeler.svelte +336 -0
- package/dist/components/SchemaVisualModeler.svelte.d.ts +17 -0
- package/dist/components/SensitiveDataMask.svelte +81 -22
- package/dist/components/SensitiveDataMask.svelte.d.ts +15 -10
- package/dist/components/SessionTimeoutGuard.svelte +154 -0
- package/dist/components/SessionTimeoutGuard.svelte.d.ts +25 -0
- package/dist/components/SignaturePad.svelte +1 -1
- package/dist/components/SliderCaptcha.svelte +1 -1
- package/dist/components/SplitPaneLayout.svelte +1 -1
- package/dist/components/SpreadsheetView.svelte +1 -1
- package/dist/components/StepForm.svelte +1 -1
- package/dist/components/StepWizard.svelte +513 -0
- package/dist/components/StepWizard.svelte.d.ts +49 -0
- package/dist/components/TableClipboardManager.svelte +307 -0
- package/dist/components/TableClipboardManager.svelte.d.ts +13 -0
- package/dist/components/TaskCenter.svelte +9 -9
- package/dist/components/TextDiffViewer.svelte +613 -0
- package/dist/components/TextDiffViewer.svelte.d.ts +39 -0
- package/dist/components/TreeTransfer.svelte +1 -1
- package/dist/components/UnsavedChangesGuard.svelte +5 -5
- package/dist/components/UsageCard.svelte +1 -1
- package/dist/components/VersionDiffViewer.svelte +1 -1
- package/dist/components/VirtualTable.svelte +1 -1
- package/dist/components/VirtualTreeSelect.svelte +1 -1
- package/dist/components/WorkflowDesigner.svelte +3 -3
- package/dist/components/WorkflowProcessCard.svelte +1 -1
- package/dist/components/WorkflowStepper.svelte +250 -0
- package/dist/components/WorkflowStepper.svelte.d.ts +27 -0
- package/dist/components/charts/GaugeChart.svelte +1 -1
- package/dist/components/useAudioAlert.d.svelte.ts +1 -0
- package/dist/components/useAudioAlert.svelte.d.ts +13 -0
- package/dist/components/useAudioAlert.svelte.js +90 -0
- package/dist/components/useHotkeys.d.svelte.ts +1 -0
- package/dist/components/useHotkeys.svelte.d.ts +44 -0
- package/dist/components/useHotkeys.svelte.js +190 -0
- package/dist/components/useMicroAppEvent.d.svelte.ts +1 -0
- package/dist/components/useMicroAppEvent.svelte.d.ts +16 -0
- package/dist/components/useMicroAppEvent.svelte.js +61 -0
- package/dist/components/usePrintExport.d.svelte.ts +1 -0
- package/dist/components/usePrintExport.svelte.d.ts +11 -0
- package/dist/components/usePrintExport.svelte.js +45 -0
- package/dist/components/useSessionTimeout.d.svelte.ts +1 -0
- package/dist/components/useSessionTimeout.svelte.d.ts +28 -0
- package/dist/components/useSessionTimeout.svelte.js +182 -0
- package/dist/components/useTableClipboard.d.svelte.ts +1 -0
- package/dist/components/useTableClipboard.svelte.d.ts +28 -0
- package/dist/components/useTableClipboard.svelte.js +116 -0
- package/dist/index.d.ts +28 -9
- package/dist/index.js +35 -0
- package/package.json +1 -1
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
|
|
89
89
|
<!-- Alert Modal Box -->
|
|
90
90
|
<div
|
|
91
|
-
class="relative z-50 w-full max-w-md rounded-
|
|
91
|
+
class="relative z-50 w-full max-w-md rounded-md border border-border bg-card p-6 text-card-foreground shadow-[var(--shadow-overlay)] transition-all animate-in fade-in zoom-in-95 duration-150"
|
|
92
92
|
>
|
|
93
93
|
<div class="flex items-start gap-4">
|
|
94
|
-
<div class="flex h-
|
|
94
|
+
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-sm bg-warning/15 text-warning border border-warning/20">
|
|
95
95
|
<AlertTriangle class="h-6 w-6" />
|
|
96
96
|
</div>
|
|
97
97
|
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
<button
|
|
108
108
|
type="button"
|
|
109
109
|
onclick={guard.cancel}
|
|
110
|
-
class="
|
|
110
|
+
class="flex h-7 w-7 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground transition-colors"
|
|
111
111
|
aria-label="Close"
|
|
112
112
|
>
|
|
113
113
|
<X class="h-4 w-4" />
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
<button
|
|
119
119
|
type="button"
|
|
120
120
|
onclick={guard.cancel}
|
|
121
|
-
class="rounded-
|
|
121
|
+
class="h-8 rounded-sm border border-border bg-background px-4 text-xs font-medium text-foreground hover:bg-muted transition-colors cursor-pointer"
|
|
122
122
|
>
|
|
123
123
|
{stayText}
|
|
124
124
|
</button>
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
<button
|
|
127
127
|
type="button"
|
|
128
128
|
onclick={guard.proceed}
|
|
129
|
-
class="rounded-
|
|
129
|
+
class="h-8 rounded-sm bg-destructive px-4 text-xs font-medium text-destructive-foreground hover:bg-destructive/90 transition-colors shadow-xs cursor-pointer"
|
|
130
130
|
>
|
|
131
131
|
{leaveText}
|
|
132
132
|
</button>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
42
|
<div
|
|
43
|
-
class={cn('rounded-
|
|
43
|
+
class={cn('rounded-md border border-border bg-card p-6 text-card-foreground shadow-sm', className)}
|
|
44
44
|
data-svadmin-component="UsageCard"
|
|
45
45
|
>
|
|
46
46
|
<div class="flex items-start justify-between gap-4 border-b border-border/60 pb-5">
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
</script>
|
|
82
82
|
|
|
83
|
-
<div class={cn('rounded-
|
|
83
|
+
<div class={cn('rounded-md border border-border bg-card shadow-xs overflow-hidden', className)}>
|
|
84
84
|
<!-- Header & Toolbar -->
|
|
85
85
|
<div class="flex items-center justify-between p-3.5 border-b border-border/60 bg-muted/20 flex-wrap">
|
|
86
86
|
<div class="flex items-center gap-2 min-w-0">
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
|
|
126
126
|
<div role="table" aria-label={ariaLabel ?? i18n.t('virtualTable.label')}
|
|
127
127
|
aria-rowcount={(available ? items.length : 0) + 1} aria-colcount={columns.length} aria-busy={loading}
|
|
128
|
-
class={cn('svadmin-virtual-table w-full rounded-
|
|
128
|
+
class={cn('svadmin-virtual-table w-full rounded-md border border-border bg-card shadow-xs overflow-hidden flex flex-col text-xs', className)}>
|
|
129
129
|
<!-- Sticky Header -->
|
|
130
130
|
<div role="row" aria-rowindex="1" class="border-b border-border/80 bg-muted/40 font-semibold text-muted-foreground flex items-center h-10 px-4 select-none shrink-0">
|
|
131
131
|
{#each columns as col (col.key)}
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
{:else}
|
|
298
298
|
{#each displayLabels as tag, idx (idx)}
|
|
299
299
|
{@const tagVal = Array.isArray(value) ? value[idx] : undefined}
|
|
300
|
-
<span class="inline-flex items-center gap-1 rounded bg-secondary/80 text-secondary-foreground px-1.5 py-0.5 text-
|
|
300
|
+
<span class="inline-flex items-center gap-1 rounded bg-secondary/80 text-secondary-foreground px-1.5 py-0.5 text-xs font-medium border border-border/40">
|
|
301
301
|
<span class="truncate max-w-[120px]">{tag}</span>
|
|
302
302
|
{#if !disabled && tagVal !== undefined}
|
|
303
303
|
<span
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
|
|
169
169
|
<div class="flex items-center gap-1">
|
|
170
170
|
{#if node.status}
|
|
171
|
-
<span class={cn('rounded-[2px] border px-1.5 py-0.2 text-
|
|
171
|
+
<span class={cn('rounded-[2px] border px-1.5 py-0.2 text-xs font-normal leading-tight', getStatusTone(node.status))}>
|
|
172
172
|
{node.status}
|
|
173
173
|
</span>
|
|
174
174
|
{/if}
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
{#if node.assignees && node.assignees.length > 0}
|
|
206
206
|
<div class="mt-2 flex flex-wrap gap-1">
|
|
207
207
|
{#each node.assignees as assignee (assignee)}
|
|
208
|
-
<span class="rounded-[2px] bg-muted px-1.5 py-0.5 text-
|
|
208
|
+
<span class="rounded-[2px] bg-muted px-1.5 py-0.5 text-xs text-muted-foreground">
|
|
209
209
|
{assignee}
|
|
210
210
|
</span>
|
|
211
211
|
{/each}
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
{/if}
|
|
214
214
|
|
|
215
215
|
{#if node.error}
|
|
216
|
-
<span class="mt-1 text-
|
|
216
|
+
<span class="mt-1 text-xs text-destructive">
|
|
217
217
|
{node.error}
|
|
218
218
|
</span>
|
|
219
219
|
{/if}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<div
|
|
50
50
|
data-svadmin-component="WorkflowProcessCard"
|
|
51
51
|
class={cn(
|
|
52
|
-
'rounded-
|
|
52
|
+
'rounded-md border border-border bg-card p-6 text-card-foreground shadow-sm transition-all space-y-6',
|
|
53
53
|
className,
|
|
54
54
|
)}
|
|
55
55
|
>
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import {
|
|
4
|
+
AlertTriangle,
|
|
5
|
+
Check,
|
|
6
|
+
Clock,
|
|
7
|
+
Loader2,
|
|
8
|
+
RotateCcw,
|
|
9
|
+
SkipForward,
|
|
10
|
+
XCircle,
|
|
11
|
+
} from '@lucide/svelte';
|
|
12
|
+
import { useTranslation } from '@svadmin/core/i18n';
|
|
13
|
+
import { cn } from '../utils.js';
|
|
14
|
+
import { Button } from './ui/button/index.js';
|
|
15
|
+
import { Progress } from './ui/progress/index.js';
|
|
16
|
+
|
|
17
|
+
export type WorkflowStepStatus =
|
|
18
|
+
| 'wait'
|
|
19
|
+
| 'pending'
|
|
20
|
+
| 'process'
|
|
21
|
+
| 'running'
|
|
22
|
+
| 'finish'
|
|
23
|
+
| 'completed'
|
|
24
|
+
| 'error'
|
|
25
|
+
| 'failed'
|
|
26
|
+
| 'blocked'
|
|
27
|
+
| 'skipped';
|
|
28
|
+
|
|
29
|
+
export interface WorkflowStepItem {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
description?: string | undefined;
|
|
33
|
+
status: WorkflowStepStatus;
|
|
34
|
+
durationMs?: number | undefined;
|
|
35
|
+
startedAt?: string | undefined;
|
|
36
|
+
errorMessage?: string | undefined;
|
|
37
|
+
retryable?: boolean | undefined;
|
|
38
|
+
meta?: Record<string, string | number> | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface WorkflowStepperProps {
|
|
42
|
+
steps: WorkflowStepItem[];
|
|
43
|
+
activeId?: string | undefined;
|
|
44
|
+
direction?: 'horizontal' | 'vertical' | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
46
|
+
showProgress?: boolean | undefined;
|
|
47
|
+
onSelect?: ((step: WorkflowStepItem) => void) | undefined;
|
|
48
|
+
onRetry?: ((step: WorkflowStepItem) => void) | undefined;
|
|
49
|
+
stepDetail?: Snippet<[WorkflowStepItem]> | undefined;
|
|
50
|
+
class?: string | undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let {
|
|
54
|
+
steps,
|
|
55
|
+
activeId = $bindable<string | undefined>(undefined),
|
|
56
|
+
direction = 'vertical',
|
|
57
|
+
title,
|
|
58
|
+
showProgress = true,
|
|
59
|
+
onSelect,
|
|
60
|
+
onRetry,
|
|
61
|
+
stepDetail,
|
|
62
|
+
class: className = '',
|
|
63
|
+
}: WorkflowStepperProps = $props();
|
|
64
|
+
|
|
65
|
+
const i18n = useTranslation();
|
|
66
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
67
|
+
|
|
68
|
+
type NormalizedState = 'wait' | 'process' | 'finish' | 'error' | 'blocked' | 'skipped';
|
|
69
|
+
|
|
70
|
+
function normalizeState(status: WorkflowStepStatus): NormalizedState {
|
|
71
|
+
switch (status) {
|
|
72
|
+
case 'finish':
|
|
73
|
+
case 'completed':
|
|
74
|
+
return 'finish';
|
|
75
|
+
case 'process':
|
|
76
|
+
case 'running':
|
|
77
|
+
return 'process';
|
|
78
|
+
case 'error':
|
|
79
|
+
case 'failed':
|
|
80
|
+
return 'error';
|
|
81
|
+
case 'blocked':
|
|
82
|
+
return 'blocked';
|
|
83
|
+
case 'skipped':
|
|
84
|
+
return 'skipped';
|
|
85
|
+
default:
|
|
86
|
+
return 'wait';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function formatDuration(ms: number | undefined): string | null {
|
|
91
|
+
if (ms === undefined || !Number.isFinite(ms)) return null;
|
|
92
|
+
if (ms < 1000) return `${ms}ms`;
|
|
93
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const completedCount = $derived(
|
|
97
|
+
steps.filter((s) => {
|
|
98
|
+
const n = normalizeState(s.status);
|
|
99
|
+
return n === 'finish' || n === 'skipped';
|
|
100
|
+
}).length,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const progressPercentage = $derived(
|
|
104
|
+
steps.length > 0 ? Math.round((completedCount / steps.length) * 100) : 0,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
function selectStep(step: WorkflowStepItem) {
|
|
108
|
+
activeId = step.id;
|
|
109
|
+
onSelect?.(step);
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<div
|
|
114
|
+
data-svadmin-component="WorkflowStepper"
|
|
115
|
+
data-direction={direction}
|
|
116
|
+
class={cn(
|
|
117
|
+
'rounded-xl border border-border bg-card text-card-foreground shadow-xs p-5 space-y-4',
|
|
118
|
+
className,
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
{#if title || showProgress}
|
|
122
|
+
<div class="space-y-2 border-b border-border/60 pb-3">
|
|
123
|
+
<div class="flex items-center justify-between gap-2">
|
|
124
|
+
{#if title}
|
|
125
|
+
<h3 class="text-sm font-semibold text-foreground">{title}</h3>
|
|
126
|
+
{:else}
|
|
127
|
+
<span class="text-xs font-medium text-muted-foreground">
|
|
128
|
+
{chinese ? '任务执行进度' : 'Workflow Progress'}
|
|
129
|
+
</span>
|
|
130
|
+
{/if}
|
|
131
|
+
<span class="text-xs font-mono text-muted-foreground">
|
|
132
|
+
{completedCount}/{steps.length} ({progressPercentage}%)
|
|
133
|
+
</span>
|
|
134
|
+
</div>
|
|
135
|
+
{#if showProgress}
|
|
136
|
+
<Progress value={progressPercentage} class="h-1.5" />
|
|
137
|
+
{/if}
|
|
138
|
+
</div>
|
|
139
|
+
{/if}
|
|
140
|
+
|
|
141
|
+
<ol
|
|
142
|
+
class={cn(
|
|
143
|
+
'flex m-0 p-0 list-none',
|
|
144
|
+
direction === 'vertical' ? 'flex-col gap-3' : 'flex-row gap-2 overflow-x-auto pb-2',
|
|
145
|
+
)}
|
|
146
|
+
>
|
|
147
|
+
{#each steps as step, index (step.id)}
|
|
148
|
+
{@const state = normalizeState(step.status)}
|
|
149
|
+
{@const duration = formatDuration(step.durationMs)}
|
|
150
|
+
{@const isSelected = activeId === step.id}
|
|
151
|
+
<li
|
|
152
|
+
data-step-id={step.id}
|
|
153
|
+
data-step-status={state}
|
|
154
|
+
class={cn(
|
|
155
|
+
'relative flex',
|
|
156
|
+
direction === 'vertical' ? 'flex-col' : 'flex-1 min-w-44 items-start gap-2',
|
|
157
|
+
)}
|
|
158
|
+
>
|
|
159
|
+
<div
|
|
160
|
+
class={cn(
|
|
161
|
+
'flex items-start justify-between gap-3 rounded-lg border p-3 transition-all',
|
|
162
|
+
isSelected ? 'border-primary bg-primary/5 ring-1 ring-primary/20' : 'border-border/60 bg-background hover:bg-muted/30',
|
|
163
|
+
direction === 'horizontal' && 'w-full',
|
|
164
|
+
)}
|
|
165
|
+
>
|
|
166
|
+
<button
|
|
167
|
+
type="button"
|
|
168
|
+
onclick={() => selectStep(step)}
|
|
169
|
+
aria-current={state === 'process' ? 'step' : undefined}
|
|
170
|
+
class="flex items-start gap-3 text-left flex-1 min-w-0 bg-transparent border-0 p-0 cursor-pointer"
|
|
171
|
+
>
|
|
172
|
+
<span
|
|
173
|
+
class={cn(
|
|
174
|
+
'flex h-7 w-7 shrink-0 items-center justify-center rounded-full border mt-0.5',
|
|
175
|
+
state === 'finish' && 'border-success/30 bg-success/15 text-success',
|
|
176
|
+
state === 'process' && 'border-primary/40 bg-primary/15 text-primary',
|
|
177
|
+
state === 'error' && 'border-destructive/30 bg-destructive/15 text-destructive',
|
|
178
|
+
state === 'blocked' && 'border-warning/40 bg-warning/15 text-warning',
|
|
179
|
+
state === 'skipped' && 'border-border bg-muted text-muted-foreground',
|
|
180
|
+
state === 'wait' && 'border-border bg-card text-muted-foreground',
|
|
181
|
+
)}
|
|
182
|
+
>
|
|
183
|
+
{#if state === 'finish'}
|
|
184
|
+
<Check class="h-3.5 w-3.5" />
|
|
185
|
+
{:else if state === 'process'}
|
|
186
|
+
<Loader2 class="h-3.5 w-3.5 animate-spin" />
|
|
187
|
+
{:else if state === 'error'}
|
|
188
|
+
<XCircle class="h-3.5 w-3.5" />
|
|
189
|
+
{:else if state === 'blocked'}
|
|
190
|
+
<AlertTriangle class="h-3.5 w-3.5" />
|
|
191
|
+
{:else if state === 'skipped'}
|
|
192
|
+
<SkipForward class="h-3.5 w-3.5" />
|
|
193
|
+
{:else}
|
|
194
|
+
<Clock class="h-3.5 w-3.5" />
|
|
195
|
+
{/if}
|
|
196
|
+
</span>
|
|
197
|
+
|
|
198
|
+
<div class="min-w-0 flex-1 space-y-0.5">
|
|
199
|
+
<div class="flex items-center gap-2">
|
|
200
|
+
<span class="text-xs font-semibold text-foreground truncate">{step.label}</span>
|
|
201
|
+
{#if duration}
|
|
202
|
+
<span class="text-[10px] font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded">
|
|
203
|
+
{duration}
|
|
204
|
+
</span>
|
|
205
|
+
{/if}
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
{#if step.description}
|
|
209
|
+
<p class="text-[11px] text-muted-foreground line-clamp-2">{step.description}</p>
|
|
210
|
+
{/if}
|
|
211
|
+
|
|
212
|
+
{#if step.errorMessage && state === 'error'}
|
|
213
|
+
<p class="text-[11px] text-destructive mt-1 font-medium">{step.errorMessage}</p>
|
|
214
|
+
{/if}
|
|
215
|
+
|
|
216
|
+
{#if stepDetail}
|
|
217
|
+
<div class="pt-1.5">
|
|
218
|
+
{@render stepDetail(step)}
|
|
219
|
+
</div>
|
|
220
|
+
{/if}
|
|
221
|
+
</div>
|
|
222
|
+
</button>
|
|
223
|
+
|
|
224
|
+
{#if state === 'error' && step.retryable !== false && onRetry}
|
|
225
|
+
<Button
|
|
226
|
+
type="button"
|
|
227
|
+
variant="outline"
|
|
228
|
+
size="sm"
|
|
229
|
+
class="h-7 px-2 text-[11px] gap-1 shrink-0"
|
|
230
|
+
onclick={() => onRetry(step)}
|
|
231
|
+
>
|
|
232
|
+
<RotateCcw class="h-3 w-3" />
|
|
233
|
+
{chinese ? '重试' : 'Retry'}
|
|
234
|
+
</Button>
|
|
235
|
+
{/if}
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
{#if direction === 'vertical' && index < steps.length - 1}
|
|
239
|
+
<div
|
|
240
|
+
class={cn(
|
|
241
|
+
'ml-6 my-1 w-0.5 h-3 rounded-full',
|
|
242
|
+
state === 'finish' ? 'bg-success/60' : 'bg-border',
|
|
243
|
+
)}
|
|
244
|
+
aria-hidden="true"
|
|
245
|
+
></div>
|
|
246
|
+
{/if}
|
|
247
|
+
</li>
|
|
248
|
+
{/each}
|
|
249
|
+
</ol>
|
|
250
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type WorkflowStepStatus = 'wait' | 'pending' | 'process' | 'running' | 'finish' | 'completed' | 'error' | 'failed' | 'blocked' | 'skipped';
|
|
3
|
+
export interface WorkflowStepItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
status: WorkflowStepStatus;
|
|
8
|
+
durationMs?: number | undefined;
|
|
9
|
+
startedAt?: string | undefined;
|
|
10
|
+
errorMessage?: string | undefined;
|
|
11
|
+
retryable?: boolean | undefined;
|
|
12
|
+
meta?: Record<string, string | number> | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkflowStepperProps {
|
|
15
|
+
steps: WorkflowStepItem[];
|
|
16
|
+
activeId?: string | undefined;
|
|
17
|
+
direction?: 'horizontal' | 'vertical' | undefined;
|
|
18
|
+
title?: string | undefined;
|
|
19
|
+
showProgress?: boolean | undefined;
|
|
20
|
+
onSelect?: ((step: WorkflowStepItem) => void) | undefined;
|
|
21
|
+
onRetry?: ((step: WorkflowStepItem) => void) | undefined;
|
|
22
|
+
stepDetail?: Snippet<[WorkflowStepItem]> | undefined;
|
|
23
|
+
class?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
declare const WorkflowStepper: import("svelte").Component<WorkflowStepperProps, {}, "activeId">;
|
|
26
|
+
type WorkflowStepper = ReturnType<typeof WorkflowStepper>;
|
|
27
|
+
export default WorkflowStepper;
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
data-tone={activeTone}
|
|
304
304
|
data-gauge-type={type}
|
|
305
305
|
class={cn(
|
|
306
|
-
'relative flex flex-col items-center justify-between rounded-
|
|
306
|
+
'relative flex flex-col items-center justify-between rounded-md border border-border bg-card p-4 text-card-foreground shadow-sm transition-all',
|
|
307
307
|
className,
|
|
308
308
|
)}
|
|
309
309
|
style="width: {widthPx}px;"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useAudioAlert.svelte.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type AudioAlertType = 'success' | 'error' | 'warning' | 'beep' | 'notify';
|
|
2
|
+
export interface AudioAlertOptions {
|
|
3
|
+
volume?: number | undefined;
|
|
4
|
+
muted?: boolean | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function playAudioAlert(alertType: AudioAlertType): void;
|
|
7
|
+
export declare function useAudioAlert(options?: AudioAlertOptions): {
|
|
8
|
+
readonly isMuted: boolean;
|
|
9
|
+
readonly volume: number;
|
|
10
|
+
setMuted: (val: boolean) => void;
|
|
11
|
+
setVolume: (val: number) => void;
|
|
12
|
+
play: (type: AudioAlertType) => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Global singleton audio state shared across the app
|
|
2
|
+
let globalAudioCtx = null;
|
|
3
|
+
let isMutedState = false;
|
|
4
|
+
let globalVolume = 0.7;
|
|
5
|
+
function getAudioContext() {
|
|
6
|
+
if (typeof window === 'undefined')
|
|
7
|
+
return null;
|
|
8
|
+
const AudioCtx = window.AudioContext || window.webkitAudioContext;
|
|
9
|
+
if (!AudioCtx)
|
|
10
|
+
return null;
|
|
11
|
+
if (!globalAudioCtx) {
|
|
12
|
+
globalAudioCtx = new AudioCtx();
|
|
13
|
+
}
|
|
14
|
+
if (globalAudioCtx.state === 'suspended') {
|
|
15
|
+
void globalAudioCtx.resume().catch(() => { });
|
|
16
|
+
}
|
|
17
|
+
return globalAudioCtx;
|
|
18
|
+
}
|
|
19
|
+
function playTone(freqs, durationSeconds, type = 'sine', gainPeak = 0.3) {
|
|
20
|
+
if (isMutedState || globalVolume <= 0)
|
|
21
|
+
return;
|
|
22
|
+
const ctx = getAudioContext();
|
|
23
|
+
if (!ctx)
|
|
24
|
+
return;
|
|
25
|
+
const now = ctx.currentTime;
|
|
26
|
+
const masterGain = ctx.createGain();
|
|
27
|
+
masterGain.gain.setValueAtTime(globalVolume * gainPeak, now);
|
|
28
|
+
masterGain.connect(ctx.destination);
|
|
29
|
+
freqs.forEach((freq, idx) => {
|
|
30
|
+
const osc = ctx.createOscillator();
|
|
31
|
+
const noteGain = ctx.createGain();
|
|
32
|
+
osc.type = type;
|
|
33
|
+
osc.frequency.setValueAtTime(freq, now + idx * 0.08);
|
|
34
|
+
noteGain.gain.setValueAtTime(1, now + idx * 0.08);
|
|
35
|
+
noteGain.gain.exponentialRampToValueAtTime(0.001, now + idx * 0.08 + durationSeconds);
|
|
36
|
+
osc.connect(noteGain);
|
|
37
|
+
noteGain.connect(masterGain);
|
|
38
|
+
osc.start(now + idx * 0.08);
|
|
39
|
+
osc.stop(now + idx * 0.08 + durationSeconds);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function playAudioAlert(alertType) {
|
|
43
|
+
switch (alertType) {
|
|
44
|
+
case 'success':
|
|
45
|
+
// C5 (523.25Hz) -> E5 (659.25Hz) -> G5 (783.99Hz)
|
|
46
|
+
playTone([523.25, 659.25, 783.99], 0.22, 'sine', 0.25);
|
|
47
|
+
break;
|
|
48
|
+
case 'error':
|
|
49
|
+
// Low punchy buzz: 180Hz -> 130Hz sawtooth
|
|
50
|
+
playTone([180, 130], 0.18, 'sawtooth', 0.3);
|
|
51
|
+
break;
|
|
52
|
+
case 'warning':
|
|
53
|
+
// Double pulse: 440Hz -> 880Hz
|
|
54
|
+
playTone([440, 880], 0.15, 'triangle', 0.25);
|
|
55
|
+
break;
|
|
56
|
+
case 'beep':
|
|
57
|
+
// Standard 1000Hz scanner chirp (80ms)
|
|
58
|
+
playTone([1000], 0.08, 'sine', 0.2);
|
|
59
|
+
break;
|
|
60
|
+
case 'notify':
|
|
61
|
+
// Gentle marimba chord: 880Hz -> 1174.66Hz (A5 -> D6)
|
|
62
|
+
playTone([880, 1174.66], 0.18, 'sine', 0.2);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function useAudioAlert(options = {}) {
|
|
67
|
+
let muted = $state(options.muted ?? false);
|
|
68
|
+
let volume = $state(options.volume ?? 0.7);
|
|
69
|
+
isMutedState = options.muted ?? false;
|
|
70
|
+
globalVolume = options.volume ?? 0.7;
|
|
71
|
+
return {
|
|
72
|
+
get isMuted() {
|
|
73
|
+
return muted;
|
|
74
|
+
},
|
|
75
|
+
get volume() {
|
|
76
|
+
return volume;
|
|
77
|
+
},
|
|
78
|
+
setMuted: (val) => {
|
|
79
|
+
muted = val;
|
|
80
|
+
isMutedState = val;
|
|
81
|
+
},
|
|
82
|
+
setVolume: (val) => {
|
|
83
|
+
volume = Math.max(0, Math.min(1, val));
|
|
84
|
+
globalVolume = volume;
|
|
85
|
+
},
|
|
86
|
+
play: (type) => {
|
|
87
|
+
playAudioAlert(type);
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useHotkeys.svelte.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface HotkeyItem {
|
|
2
|
+
id: string;
|
|
3
|
+
combo: string;
|
|
4
|
+
keys: string[];
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
category?: ('navigation' | 'table' | 'action' | 'view' | 'system' | string) | undefined;
|
|
8
|
+
action?: ((event?: KeyboardEvent) => void) | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface UseHotkeysOptions {
|
|
11
|
+
/** Whether to prevent default browser behavior when triggered (default: true) */
|
|
12
|
+
preventDefault?: boolean | undefined;
|
|
13
|
+
/** Whether to stop event propagation (default: true) */
|
|
14
|
+
stopPropagation?: boolean | undefined;
|
|
15
|
+
/** Whether hotkey is actively enabled (default: true or getter) */
|
|
16
|
+
enabled?: (boolean | (() => boolean)) | undefined;
|
|
17
|
+
/** Allow triggering even when input, textarea, or contenteditable is focused (default: false for bare keys, true for modifiers) */
|
|
18
|
+
enableOnInputs?: boolean | undefined;
|
|
19
|
+
/** Optional human-readable label */
|
|
20
|
+
label?: string | undefined;
|
|
21
|
+
/** Optional human-readable description for shortcut modal */
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
/** Category for shortcut modal (default: 'action') */
|
|
24
|
+
category?: ('navigation' | 'table' | 'action' | 'view' | 'system' | string) | undefined;
|
|
25
|
+
/** Target element to bind (default: window) */
|
|
26
|
+
target?: (Window | Document | HTMLElement | null) | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare function getRegisteredHotkeys(): HotkeyItem[];
|
|
29
|
+
export declare function clearRegisteredHotkeys(): void;
|
|
30
|
+
export declare function isMac(): boolean;
|
|
31
|
+
export interface ParsedCombo {
|
|
32
|
+
raw: string;
|
|
33
|
+
displayKeys: string[];
|
|
34
|
+
mod: boolean;
|
|
35
|
+
ctrl: boolean;
|
|
36
|
+
meta: boolean;
|
|
37
|
+
alt: boolean;
|
|
38
|
+
shift: boolean;
|
|
39
|
+
key: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function parseHotkeyCombo(combo: string): ParsedCombo;
|
|
42
|
+
export declare function useHotkeys(combos: string | string[], handler: (event: KeyboardEvent) => void, options?: UseHotkeysOptions): {
|
|
43
|
+
destroy: () => void;
|
|
44
|
+
};
|