@svadmin/ui 0.125.0 → 0.126.1
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 +20 -0
- package/dist/app.theme.css +20 -0
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/ApiPlayground.svelte +1 -1
- package/dist/components/ApiSettings.svelte +1 -1
- package/dist/components/AppearanceSettings.svelte +1 -1
- package/dist/components/ApprovalChainBuilder.svelte +2 -2
- package/dist/components/AuditLogDrawer.svelte +2 -2
- package/dist/components/AutoTable.svelte +20 -1
- package/dist/components/AutoTable.svelte.d.ts +2 -0
- package/dist/components/BatchEditModal.svelte +6 -6
- package/dist/components/CheckCard.svelte +1 -1
- package/dist/components/ColumnHeaderFilter.svelte +6 -6
- package/dist/components/ColumnMappingTable.svelte +1 -1
- package/dist/components/DataFreshnessIndicator.svelte +4 -1
- package/dist/components/DataMaskPolicyEngine.svelte +2 -2
- package/dist/components/EditableTable.svelte +2 -2
- package/dist/components/ExcelImportWizard.svelte +2 -2
- package/dist/components/FieldRenderer.svelte +1 -1
- package/dist/components/FilterTagBar.svelte +8 -5
- package/dist/components/HmacSignatureCalculator.svelte +2 -2
- package/dist/components/ImportWizard.svelte +2 -2
- package/dist/components/InputGroup.svelte +133 -0
- package/dist/components/InputGroup.svelte.d.ts +16 -0
- package/dist/components/LightFilter.svelte +2 -2
- package/dist/components/MicroAppRouteSync.svelte +185 -0
- package/dist/components/MicroAppRouteSync.svelte.d.ts +12 -0
- package/dist/components/MicroAppSandbox.svelte +200 -0
- package/dist/components/MicroAppSandbox.svelte.d.ts +16 -0
- package/dist/components/MicroAppStateBusIndicator.svelte +159 -0
- package/dist/components/MicroAppStateBusIndicator.svelte.d.ts +12 -0
- package/dist/components/PermissionMatrix.svelte +1 -1
- package/dist/components/QueryBuilder.svelte +6 -6
- package/dist/components/Rate.svelte +19 -2
- package/dist/components/Result.svelte +36 -4
- package/dist/components/Result.svelte.d.ts +4 -2
- package/dist/components/RuleExpressionBuilder.svelte +10 -10
- package/dist/components/SchemaVisualModeler.svelte +2 -2
- package/dist/components/Spin.svelte +33 -11
- package/dist/components/Spin.svelte.d.ts +7 -4
- package/dist/components/Steps.svelte +44 -3
- package/dist/components/ThemeSettingsDrawer.svelte +6 -14
- package/dist/components/Timeline.svelte +12 -3
- package/dist/components/Timeline.svelte.d.ts +2 -0
- package/dist/components/WebhookSimulator.svelte +2 -2
- package/dist/components/ui/badge/badge.svelte +3 -3
- package/dist/components/useMicroAppState.d.svelte.ts +1 -0
- package/dist/components/useMicroAppState.svelte.d.ts +17 -0
- package/dist/components/useMicroAppState.svelte.js +38 -0
- package/dist/components.css +4 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/package.json +4 -4
|
@@ -30,13 +30,16 @@
|
|
|
30
30
|
onchange,
|
|
31
31
|
}: Props = $props();
|
|
32
32
|
|
|
33
|
+
let hoverValue = $state<number | null>(null);
|
|
33
34
|
const normalizedCount = $derived(Number.isSafeInteger(count) && count > 0 && count <= 10 ? count : 5);
|
|
34
35
|
const normalizedValue = $derived(Math.min(normalizedCount, Math.max(0, Math.round(value))));
|
|
36
|
+
const displayValue = $derived(hoverValue !== null ? hoverValue : normalizedValue);
|
|
35
37
|
|
|
36
38
|
function choose(next: number): void {
|
|
37
39
|
if (disabled) return;
|
|
38
40
|
const selected = allowClear && normalizedValue === next ? 0 : next;
|
|
39
41
|
value = selected;
|
|
42
|
+
hoverValue = null;
|
|
40
43
|
onchange?.(selected);
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -61,14 +64,17 @@
|
|
|
61
64
|
<div
|
|
62
65
|
class={cn('svadmin-rate', className)}
|
|
63
66
|
role="radiogroup"
|
|
67
|
+
tabindex={-1}
|
|
64
68
|
aria-label={ariaLabel}
|
|
65
69
|
aria-invalid={invalid || undefined}
|
|
66
70
|
aria-describedby={describedby}
|
|
67
71
|
data-invalid={invalid ? 'true' : undefined}
|
|
72
|
+
onmouseleave={() => { if (!disabled) hoverValue = null; }}
|
|
68
73
|
>
|
|
69
74
|
{#if name}<input type="hidden" {name} value={normalizedValue} required={required} {disabled} />{/if}
|
|
70
75
|
{#each Array(normalizedCount) as _, index (index)}
|
|
71
76
|
{@const rating = index + 1}
|
|
77
|
+
{@const isFilled = displayValue >= rating}
|
|
72
78
|
<button
|
|
73
79
|
type="button"
|
|
74
80
|
role="radio"
|
|
@@ -77,10 +83,12 @@
|
|
|
77
83
|
aria-disabled={disabled ? 'true' : undefined}
|
|
78
84
|
tabindex={disabled ? -1 : normalizedValue === rating || (normalizedValue === 0 && index === 0) ? 0 : -1}
|
|
79
85
|
disabled={disabled}
|
|
86
|
+
class:svadmin-rate__button--filled={isFilled}
|
|
87
|
+
onmouseenter={() => { if (!disabled) hoverValue = rating; }}
|
|
80
88
|
onclick={() => choose(rating)}
|
|
81
89
|
onkeydown={(event) => handleKeydown(event, index)}
|
|
82
90
|
>
|
|
83
|
-
<Star fill={
|
|
91
|
+
<Star fill={isFilled ? 'currentColor' : 'none'} aria-hidden="true" />
|
|
84
92
|
</button>
|
|
85
93
|
{/each}
|
|
86
94
|
</div>
|
|
@@ -105,7 +113,16 @@
|
|
|
105
113
|
cursor: pointer;
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
.svadmin-rate button
|
|
116
|
+
.svadmin-rate button {
|
|
117
|
+
transition: transform var(--svadmin-motion-fast) var(--svadmin-motion-easing), color var(--svadmin-motion-fast) var(--svadmin-motion-easing);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.svadmin-rate button:hover:not(:disabled) {
|
|
121
|
+
transform: scale(1.15);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.svadmin-rate button[aria-checked='true'],
|
|
125
|
+
.svadmin-rate button.svadmin-rate__button--filled {
|
|
109
126
|
color: var(--warning);
|
|
110
127
|
}
|
|
111
128
|
|
|
@@ -1,20 +1,52 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Snippet } from
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import {
|
|
4
|
+
CheckCircle2,
|
|
5
|
+
XCircle,
|
|
6
|
+
AlertTriangle,
|
|
7
|
+
Info,
|
|
8
|
+
ShieldAlert,
|
|
9
|
+
FileQuestion,
|
|
10
|
+
ServerCrash,
|
|
11
|
+
} from "@lucide/svelte";
|
|
12
|
+
|
|
13
|
+
export type ResultStatus = "success" | "error" | "info" | "warning" | "403" | "404" | "500";
|
|
3
14
|
|
|
4
15
|
let {
|
|
5
|
-
status =
|
|
16
|
+
status = "info",
|
|
6
17
|
title,
|
|
7
|
-
subtitle =
|
|
18
|
+
subtitle = "",
|
|
19
|
+
icon,
|
|
8
20
|
children,
|
|
9
21
|
}: {
|
|
10
|
-
status?:
|
|
22
|
+
status?: ResultStatus;
|
|
11
23
|
title: string;
|
|
12
24
|
subtitle?: string;
|
|
25
|
+
icon?: Snippet;
|
|
13
26
|
children?: Snippet;
|
|
14
27
|
} = $props();
|
|
28
|
+
|
|
29
|
+
const statusIcons = {
|
|
30
|
+
success: CheckCircle2,
|
|
31
|
+
error: XCircle,
|
|
32
|
+
info: Info,
|
|
33
|
+
warning: AlertTriangle,
|
|
34
|
+
"403": ShieldAlert,
|
|
35
|
+
"404": FileQuestion,
|
|
36
|
+
"500": ServerCrash,
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
const IconComp = $derived(statusIcons[status] ?? Info);
|
|
15
40
|
</script>
|
|
16
41
|
|
|
17
42
|
<section class="svadmin-result" data-status={status}>
|
|
43
|
+
<div class="svadmin-result__icon" aria-hidden="true">
|
|
44
|
+
{#if icon}
|
|
45
|
+
{@render icon()}
|
|
46
|
+
{:else}
|
|
47
|
+
<IconComp class="size-12" />
|
|
48
|
+
{/if}
|
|
49
|
+
</div>
|
|
18
50
|
<p class="svadmin-result__status">{status}</p>
|
|
19
51
|
<h2 class="svadmin-result__title">{title}</h2>
|
|
20
52
|
{#if subtitle}<p class="svadmin-result__subtitle">{subtitle}</p>{/if}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { Snippet } from
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
export type ResultStatus = "success" | "error" | "info" | "warning" | "403" | "404" | "500";
|
|
2
3
|
type $$ComponentProps = {
|
|
3
|
-
status?:
|
|
4
|
+
status?: ResultStatus;
|
|
4
5
|
title: string;
|
|
5
6
|
subtitle?: string;
|
|
7
|
+
icon?: Snippet;
|
|
6
8
|
children?: Snippet;
|
|
7
9
|
};
|
|
8
10
|
declare const Result: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -230,10 +230,10 @@
|
|
|
230
230
|
<div class="flex items-center justify-between">
|
|
231
231
|
<div class="flex items-center gap-2 text-xs">
|
|
232
232
|
<span class="font-bold text-primary">{chinese ? '满足以下' : 'Match'}</span>
|
|
233
|
-
<select
|
|
233
|
+
<select data-size="compact"
|
|
234
234
|
bind:value={root.combinator}
|
|
235
235
|
onchange={notify}
|
|
236
|
-
class="
|
|
236
|
+
class="svadmin-select svadmin-select--inline h-7 font-semibold"
|
|
237
237
|
>
|
|
238
238
|
<option value="and">{chinese ? '全部条件 (AND)' : 'ALL conditions (AND)'}</option>
|
|
239
239
|
<option value="or">{chinese ? '任一条件 (OR)' : 'ANY condition (OR)'}</option>
|
|
@@ -262,10 +262,10 @@
|
|
|
262
262
|
{#if child.type === 'leaf'}
|
|
263
263
|
<div class="flex items-center gap-2 rounded-lg border border-border bg-card p-2 text-xs shadow-2xs">
|
|
264
264
|
<!-- Field select -->
|
|
265
|
-
<select
|
|
265
|
+
<select data-size="compact"
|
|
266
266
|
bind:value={child.field}
|
|
267
267
|
onchange={notify}
|
|
268
|
-
class="
|
|
268
|
+
class="svadmin-select svadmin-select--inline h-7 font-medium"
|
|
269
269
|
>
|
|
270
270
|
{#each fields as f (f.key)}
|
|
271
271
|
<option value={f.key}>{f.label} ({f.key})</option>
|
|
@@ -273,10 +273,10 @@
|
|
|
273
273
|
</select>
|
|
274
274
|
|
|
275
275
|
<!-- Operator select -->
|
|
276
|
-
<select
|
|
276
|
+
<select data-size="compact"
|
|
277
277
|
bind:value={child.operator}
|
|
278
278
|
onchange={notify}
|
|
279
|
-
class="
|
|
279
|
+
class="svadmin-select svadmin-select--inline h-7 font-mono font-medium"
|
|
280
280
|
>
|
|
281
281
|
<option value="eq">=</option>
|
|
282
282
|
<option value="ne">≠</option>
|
|
@@ -314,10 +314,10 @@
|
|
|
314
314
|
<div class="flex items-center justify-between text-xs">
|
|
315
315
|
<div class="flex items-center gap-2">
|
|
316
316
|
<span class="font-bold text-warning">{chinese ? '子条件组' : 'Subgroup'}</span>
|
|
317
|
-
<select
|
|
317
|
+
<select data-size="compact"
|
|
318
318
|
bind:value={child.combinator}
|
|
319
319
|
onchange={notify}
|
|
320
|
-
class="
|
|
320
|
+
class="svadmin-select svadmin-select--inline h-6"
|
|
321
321
|
>
|
|
322
322
|
<option value="and">AND</option>
|
|
323
323
|
<option value="or">OR</option>
|
|
@@ -343,12 +343,12 @@
|
|
|
343
343
|
{#each child.children as subChild (subChild.id)}
|
|
344
344
|
{#if subChild.type === 'leaf'}
|
|
345
345
|
<div class="flex items-center gap-2 rounded border border-border bg-card p-1.5 text-xs">
|
|
346
|
-
<select bind:value={subChild.field} onchange={notify} class="
|
|
346
|
+
<select data-size="compact" bind:value={subChild.field} onchange={notify} class="svadmin-select svadmin-select--inline h-6">
|
|
347
347
|
{#each fields as f (f.key)}
|
|
348
348
|
<option value={f.key}>{f.label}</option>
|
|
349
349
|
{/each}
|
|
350
350
|
</select>
|
|
351
|
-
<select bind:value={subChild.operator} onchange={notify} class="
|
|
351
|
+
<select data-size="compact" bind:value={subChild.operator} onchange={notify} class="svadmin-select svadmin-select--inline h-6">
|
|
352
352
|
<option value="eq">=</option>
|
|
353
353
|
<option value="gt">></option>
|
|
354
354
|
<option value="lt"><</option>
|
|
@@ -235,9 +235,9 @@
|
|
|
235
235
|
/>
|
|
236
236
|
</td>
|
|
237
237
|
<td class="p-2.5">
|
|
238
|
-
<select
|
|
238
|
+
<select data-size="compact"
|
|
239
239
|
bind:value={field.type}
|
|
240
|
-
class="h-7 w-full
|
|
240
|
+
class="svadmin-select h-7 w-full"
|
|
241
241
|
>
|
|
242
242
|
<option value="text">text</option>
|
|
243
243
|
<option value="number">number</option>
|
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Snippet } from
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import { cn } from "../utils.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
children,
|
|
7
|
-
}: {
|
|
5
|
+
interface Props {
|
|
6
|
+
loading?: boolean;
|
|
8
7
|
tip?: string;
|
|
8
|
+
size?: "small" | "default" | "large";
|
|
9
|
+
class?: string;
|
|
9
10
|
children?: Snippet;
|
|
10
|
-
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
loading = true,
|
|
15
|
+
tip = "",
|
|
16
|
+
size = "default",
|
|
17
|
+
class: className = "",
|
|
18
|
+
children,
|
|
19
|
+
}: Props = $props();
|
|
11
20
|
</script>
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</div>
|
|
22
|
+
{#if children}
|
|
23
|
+
<div class={cn("svadmin-spin-container relative", className)}>
|
|
24
|
+
<div class={cn("svadmin-spin-children transition-opacity duration-200", loading && "opacity-40 pointer-events-none select-none")}>
|
|
25
|
+
{@render children()}
|
|
26
|
+
</div>
|
|
27
|
+
{#if loading}
|
|
28
|
+
<div class="absolute inset-0 flex flex-col items-center justify-center gap-2 z-10" role="status" aria-live="polite">
|
|
29
|
+
<span class={cn("svadmin-spin__icon", size === "small" ? "size-3.5 border-[1.5px]" : size === "large" ? "size-6 border-2" : "size-4 border-2")} aria-hidden="true"></span>
|
|
30
|
+
{#if tip}<span class="svadmin-spin__tip text-xs font-medium">{tip}</span>{/if}
|
|
31
|
+
</div>
|
|
32
|
+
{/if}
|
|
33
|
+
</div>
|
|
34
|
+
{:else if loading}
|
|
35
|
+
<div class={cn("svadmin-spin inline-flex items-center gap-2", className)} role="status" aria-live="polite">
|
|
36
|
+
<span class={cn("svadmin-spin__icon", size === "small" ? "size-3.5 border-[1.5px]" : size === "large" ? "size-6 border-2" : "size-4 border-2")} aria-hidden="true"></span>
|
|
37
|
+
{#if tip}<span class="svadmin-spin__tip text-xs">{tip}</span>{/if}
|
|
38
|
+
</div>
|
|
39
|
+
{/if}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { Snippet } from
|
|
2
|
-
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
interface Props {
|
|
3
|
+
loading?: boolean;
|
|
3
4
|
tip?: string;
|
|
5
|
+
size?: "small" | "default" | "large";
|
|
6
|
+
class?: string;
|
|
4
7
|
children?: Snippet;
|
|
5
|
-
}
|
|
6
|
-
declare const Spin: import("svelte").Component
|
|
8
|
+
}
|
|
9
|
+
declare const Spin: import("svelte").Component<Props, {}, "">;
|
|
7
10
|
type Spin = ReturnType<typeof Spin>;
|
|
8
11
|
export default Spin;
|
|
@@ -65,7 +65,11 @@
|
|
|
65
65
|
{#if item.description}<span class="svadmin-steps__description">{item.description}</span>{/if}
|
|
66
66
|
</span>
|
|
67
67
|
</button>
|
|
68
|
-
{#if index < items.length - 1}
|
|
68
|
+
{#if index < items.length - 1}
|
|
69
|
+
<span class="svadmin-steps__connector" aria-hidden="true" data-filled={stateValue === 'finish' ? 'true' : 'false'}>
|
|
70
|
+
<span class="svadmin-steps__connector-fill"></span>
|
|
71
|
+
</span>
|
|
72
|
+
{/if}
|
|
69
73
|
</li>
|
|
70
74
|
{/each}
|
|
71
75
|
</ol>
|
|
@@ -110,13 +114,50 @@
|
|
|
110
114
|
.svadmin-steps__title { color: var(--foreground); font-size: var(--svadmin-text-label); font-weight: 600; }
|
|
111
115
|
.svadmin-steps__item[data-status='wait'] .svadmin-steps__title { color: var(--muted-foreground); font-weight: 500; }
|
|
112
116
|
.svadmin-steps__description { color: var(--muted-foreground); font-size: var(--svadmin-text-caption); }
|
|
113
|
-
.svadmin-steps__connector {
|
|
114
|
-
|
|
117
|
+
.svadmin-steps__connector {
|
|
118
|
+
position: relative;
|
|
119
|
+
flex: 1;
|
|
120
|
+
height: 1px;
|
|
121
|
+
margin-block-start: 0.875rem;
|
|
122
|
+
background: var(--border);
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
.svadmin-steps__connector-fill {
|
|
126
|
+
position: absolute;
|
|
127
|
+
inset-block: 0;
|
|
128
|
+
inset-inline-start: 0;
|
|
129
|
+
width: 0;
|
|
130
|
+
background: var(--primary);
|
|
131
|
+
transition: width 240ms var(--svadmin-motion-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
132
|
+
}
|
|
133
|
+
.svadmin-steps__connector[data-filled='true'] .svadmin-steps__connector-fill { width: 100%; }
|
|
134
|
+
.svadmin-steps__item[data-status='process'] .svadmin-steps__indicator {
|
|
135
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
|
|
136
|
+
}
|
|
115
137
|
.svadmin-steps[data-direction='vertical'] .svadmin-steps__connector { width: 1px; height: 1.5rem; margin: 0 0 0 0.875rem; }
|
|
138
|
+
.svadmin-steps[data-direction='vertical'] .svadmin-steps__connector-fill {
|
|
139
|
+
inset-inline: 0;
|
|
140
|
+
inset-block-start: 0;
|
|
141
|
+
width: 100%;
|
|
142
|
+
height: 0;
|
|
143
|
+
transition: height 240ms var(--svadmin-motion-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
144
|
+
}
|
|
145
|
+
.svadmin-steps[data-direction='vertical'] .svadmin-steps__connector[data-filled='true'] .svadmin-steps__connector-fill { height: 100%; }
|
|
146
|
+
@media (prefers-reduced-motion: reduce) {
|
|
147
|
+
.svadmin-steps__connector-fill { transition: none; }
|
|
148
|
+
}
|
|
116
149
|
.svadmin-steps[data-label-placement='vertical'] .svadmin-steps__action { flex-direction: column; }
|
|
117
150
|
.svadmin-steps__item[data-disabled='true'] { opacity: 0.5; }
|
|
118
151
|
@media (max-width: 40rem) {
|
|
119
152
|
.svadmin-steps[data-direction='horizontal'] { flex-direction: column; }
|
|
120
153
|
.svadmin-steps[data-direction='horizontal'] .svadmin-steps__connector { width: 1px; height: 1rem; margin-inline-start: 0.875rem; }
|
|
154
|
+
.svadmin-steps[data-direction='horizontal'] .svadmin-steps__connector-fill {
|
|
155
|
+
inset-inline: 0;
|
|
156
|
+
inset-block-start: 0;
|
|
157
|
+
width: 100%;
|
|
158
|
+
height: 0;
|
|
159
|
+
transition: height 240ms var(--svadmin-motion-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
160
|
+
}
|
|
161
|
+
.svadmin-steps[data-direction='horizontal'] .svadmin-steps__connector[data-filled='true'] .svadmin-steps__connector-fill { height: 100%; }
|
|
121
162
|
}
|
|
122
163
|
</style>
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
<h3>Navigation</h3>
|
|
97
97
|
<label class="svadmin-theme-settings__field">
|
|
98
98
|
<span>Navigation mode</span>
|
|
99
|
-
<select value={uiPreferences.navigation} onchange={(event) => chooseNavigation((event.currentTarget as HTMLSelectElement).value as 'side' | 'top' | 'mix' | 'split')}>
|
|
99
|
+
<select class="svadmin-select" value={uiPreferences.navigation} onchange={(event) => chooseNavigation((event.currentTarget as HTMLSelectElement).value as 'side' | 'top' | 'mix' | 'split')}>
|
|
100
100
|
<option value="side">Sidebar</option>
|
|
101
101
|
<option value="top">Top bar</option>
|
|
102
102
|
<option value="mix">Mixed</option>
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
</label>
|
|
106
106
|
<label class="svadmin-theme-settings__field">
|
|
107
107
|
<span>Navigation theme</span>
|
|
108
|
-
<select value={uiPreferences.navigationTheme} onchange={(event) => updateUiPreferences({ navigationTheme: (event.currentTarget as HTMLSelectElement).value as 'light' | 'dark' | 'system' })}>
|
|
108
|
+
<select class="svadmin-select" value={uiPreferences.navigationTheme} onchange={(event) => updateUiPreferences({ navigationTheme: (event.currentTarget as HTMLSelectElement).value as 'light' | 'dark' | 'system' })}>
|
|
109
109
|
<option value="light">Light</option>
|
|
110
110
|
<option value="dark">Dark</option>
|
|
111
111
|
<option value="system">Follow theme</option>
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
</label>
|
|
114
114
|
<label class="svadmin-theme-settings__field">
|
|
115
115
|
<span>Content width</span>
|
|
116
|
-
<select value={uiPreferences.contentWidth} onchange={(event) => updateUiPreferences({ contentWidth: (event.currentTarget as HTMLSelectElement).value as 'fluid' | 'fixed' | 'wide' })}>
|
|
116
|
+
<select class="svadmin-select" value={uiPreferences.contentWidth} onchange={(event) => updateUiPreferences({ contentWidth: (event.currentTarget as HTMLSelectElement).value as 'fluid' | 'fixed' | 'wide' })}>
|
|
117
117
|
<option value="fixed">Fixed</option>
|
|
118
118
|
<option value="fluid">Fluid</option>
|
|
119
119
|
<option value="wide">Wide</option>
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
</label>
|
|
138
138
|
<label class="svadmin-theme-settings__field">
|
|
139
139
|
<span>Motion</span>
|
|
140
|
-
<select value={uiPreferences.motion} onchange={(event) => updateUiPreferences({ motion: (event.currentTarget as HTMLSelectElement).value as 'system' | 'reduced' })}>
|
|
140
|
+
<select class="svadmin-select" value={uiPreferences.motion} onchange={(event) => updateUiPreferences({ motion: (event.currentTarget as HTMLSelectElement).value as 'system' | 'reduced' })}>
|
|
141
141
|
<option value="system">System</option>
|
|
142
142
|
<option value="reduced">Reduced motion</option>
|
|
143
143
|
</select>
|
|
@@ -192,15 +192,7 @@
|
|
|
192
192
|
}
|
|
193
193
|
.svadmin-theme-settings__swatch[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--foreground); }
|
|
194
194
|
.svadmin-theme-settings__field { display: grid; gap: var(--svadmin-space-1); color: var(--foreground); font-size: var(--svadmin-text-label); }
|
|
195
|
-
.svadmin-theme-settings__field select {
|
|
196
|
-
width: 100%;
|
|
197
|
-
height: var(--svadmin-control-h);
|
|
198
|
-
border: 1px solid var(--input);
|
|
199
|
-
border-radius: var(--radius-sm);
|
|
200
|
-
background: var(--background);
|
|
201
|
-
color: var(--foreground);
|
|
202
|
-
padding-inline: var(--svadmin-space-2);
|
|
203
|
-
}
|
|
195
|
+
.svadmin-theme-settings__field select { width: 100%; }
|
|
204
196
|
.svadmin-theme-settings__toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--svadmin-space-4); }
|
|
205
197
|
.svadmin-theme-settings__toggle span { display: grid; gap: 0.1rem; }
|
|
206
198
|
.svadmin-theme-settings__toggle strong { font-size: var(--svadmin-text-label); font-weight: 600; color: var(--foreground); }
|
|
@@ -209,4 +201,4 @@
|
|
|
209
201
|
.svadmin-theme-settings__segmented button { min-height: var(--svadmin-control-h); border: 0; border-inline-end: 1px solid var(--border); background: transparent; color: var(--muted-foreground); font-size: var(--svadmin-text-label); }
|
|
210
202
|
.svadmin-theme-settings__segmented button:last-child { border-inline-end: 0; }
|
|
211
203
|
.svadmin-theme-settings__segmented button[aria-pressed='true'] { background: var(--accent); color: var(--accent-foreground); font-weight: 600; }
|
|
212
|
-
</style>
|
|
204
|
+
</style>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
time?: string;
|
|
10
10
|
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
11
11
|
active?: boolean;
|
|
12
|
+
dot?: Snippet;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
interface Props {
|
|
@@ -16,16 +17,23 @@
|
|
|
16
17
|
mode?: 'vertical' | 'horizontal';
|
|
17
18
|
label?: string;
|
|
18
19
|
class?: string;
|
|
20
|
+
dot?: Snippet<[TimelineEntry]>;
|
|
19
21
|
children?: Snippet<[TimelineEntry]>;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
let { items, mode = 'vertical', label = 'Timeline', class: className = '', children }: Props = $props();
|
|
24
|
+
let { items, mode = 'vertical', label = 'Timeline', class: className = '', dot, children }: Props = $props();
|
|
23
25
|
</script>
|
|
24
26
|
|
|
25
27
|
<ol class={cn('svadmin-timeline', className)} data-mode={mode} aria-label={label}>
|
|
26
28
|
{#each items as item (item.id)}
|
|
27
29
|
<li class="svadmin-timeline__item" data-tone={item.tone ?? 'neutral'} data-active={item.active ? 'true' : undefined}>
|
|
28
|
-
|
|
30
|
+
{#if item.dot}
|
|
31
|
+
<span class="svadmin-timeline__custom-dot" aria-hidden="true">{@render item.dot()}</span>
|
|
32
|
+
{:else if dot}
|
|
33
|
+
<span class="svadmin-timeline__custom-dot" aria-hidden="true">{@render dot(item)}</span>
|
|
34
|
+
{:else}
|
|
35
|
+
<span class="svadmin-timeline__marker" aria-hidden="true"></span>
|
|
36
|
+
{/if}
|
|
29
37
|
<div class="svadmin-timeline__content">
|
|
30
38
|
{#if children}
|
|
31
39
|
{@render children(item)}
|
|
@@ -73,7 +81,8 @@
|
|
|
73
81
|
.svadmin-timeline__item[data-tone='success'] .svadmin-timeline__marker { border-color: var(--success, var(--primary)); }
|
|
74
82
|
.svadmin-timeline__item[data-tone='warning'] .svadmin-timeline__marker { border-color: var(--warning, var(--primary)); }
|
|
75
83
|
.svadmin-timeline__item[data-tone='danger'] .svadmin-timeline__marker { border-color: var(--destructive); }
|
|
76
|
-
.svadmin-timeline__item[data-active='true'] .svadmin-timeline__marker { background: var(--primary); border-color: var(--primary); }
|
|
84
|
+
.svadmin-timeline__item[data-active='true'] .svadmin-timeline__marker { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
|
|
85
|
+
.svadmin-timeline__custom-dot { display: inline-flex; align-items: center; justify-content: center; margin-block-start: 0.15rem; z-index: 1; color: var(--primary); }
|
|
77
86
|
.svadmin-timeline__content { min-width: 0; }
|
|
78
87
|
.svadmin-timeline__time { color: var(--muted-foreground); font-size: var(--svadmin-text-caption); }
|
|
79
88
|
.svadmin-timeline__title { margin: 0; color: var(--foreground); font-size: var(--svadmin-text-body); font-weight: 600; }
|
|
@@ -6,12 +6,14 @@ export interface TimelineEntry {
|
|
|
6
6
|
time?: string;
|
|
7
7
|
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
8
8
|
active?: boolean;
|
|
9
|
+
dot?: Snippet;
|
|
9
10
|
}
|
|
10
11
|
interface Props {
|
|
11
12
|
items: TimelineEntry[];
|
|
12
13
|
mode?: 'vertical' | 'horizontal';
|
|
13
14
|
label?: string;
|
|
14
15
|
class?: string;
|
|
16
|
+
dot?: Snippet<[TimelineEntry]>;
|
|
15
17
|
children?: Snippet<[TimelineEntry]>;
|
|
16
18
|
}
|
|
17
19
|
declare const Timeline: import("svelte").Component<Props, {}, "">;
|
|
@@ -162,9 +162,9 @@
|
|
|
162
162
|
<label for="webhook-event-type" class="block font-medium text-foreground">
|
|
163
163
|
选择事件类型 (Event Type)
|
|
164
164
|
</label>
|
|
165
|
-
<select
|
|
165
|
+
<select data-size="compact"
|
|
166
166
|
id="webhook-event-type"
|
|
167
|
-
class="w-full
|
|
167
|
+
class="svadmin-select w-full font-mono"
|
|
168
168
|
value={selectedEventType}
|
|
169
169
|
onchange={(e) => handleEventChange((e.currentTarget as HTMLSelectElement).value)}
|
|
170
170
|
>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
const config = useComponentConfig();
|
|
43
43
|
const size = $derived(sizeProp ?? (config.density === "compact" || config.componentSize === "sm" ? "compact" : "default"));
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const isStatusMode = $derived(count !== undefined || dot || status !== undefined);
|
|
46
46
|
|
|
47
47
|
const displayCount = $derived.by(() => {
|
|
48
48
|
if (count === undefined) return null;
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
<span class="svadmin-badge-status-text select-none text-xs">{text}</span>
|
|
103
103
|
{/if}
|
|
104
104
|
</svelte:element>
|
|
105
|
-
{:else if
|
|
105
|
+
{:else if isStatusMode && children}
|
|
106
106
|
<!-- 包裹宿主元素右上角角标 (Wrapped Badge) -->
|
|
107
107
|
<svelte:element
|
|
108
108
|
this={href ? "a" : "span"}
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
{/if}
|
|
139
139
|
{/if}
|
|
140
140
|
</svelte:element>
|
|
141
|
-
{:else if
|
|
141
|
+
{:else if isStatusMode && !children && hasBadge}
|
|
142
142
|
<!-- 独立数字角标或小红点 (Standalone Badge) -->
|
|
143
143
|
<svelte:element
|
|
144
144
|
this={href ? "a" : "span"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useMicroAppState.svelte.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface MicroAppStateMessage<T = unknown> {
|
|
2
|
+
channel: string;
|
|
3
|
+
type: string;
|
|
4
|
+
payload: T;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
senderAppId?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface UseMicroAppStateOptions {
|
|
9
|
+
channel?: string | undefined;
|
|
10
|
+
appId?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare function useMicroAppState(options?: UseMicroAppStateOptions): {
|
|
13
|
+
readonly messages: MicroAppStateMessage<unknown>[];
|
|
14
|
+
readonly subscribersCount: number;
|
|
15
|
+
broadcast: <T = unknown>(type: string, payload: T) => MicroAppStateMessage<T>;
|
|
16
|
+
clearMessages: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function useMicroAppState(options = {}) {
|
|
2
|
+
const channelName = options.channel ?? 'svadmin_microapp_bus';
|
|
3
|
+
const appId = options.appId ?? 'host_app';
|
|
4
|
+
let messages = $state([]);
|
|
5
|
+
const subscribersCount = $state(3);
|
|
6
|
+
function broadcast(type, payload) {
|
|
7
|
+
const msg = {
|
|
8
|
+
channel: channelName,
|
|
9
|
+
type,
|
|
10
|
+
payload,
|
|
11
|
+
timestamp: Date.now(),
|
|
12
|
+
senderAppId: appId,
|
|
13
|
+
};
|
|
14
|
+
messages = [msg, ...messages].slice(0, 50);
|
|
15
|
+
if (typeof window !== 'undefined') {
|
|
16
|
+
try {
|
|
17
|
+
window.postMessage({ svadminMicroApp: true, ...msg }, '*');
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// Fallback for sandboxed environments
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return msg;
|
|
24
|
+
}
|
|
25
|
+
function clearMessages() {
|
|
26
|
+
messages = [];
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
get messages() {
|
|
30
|
+
return messages;
|
|
31
|
+
},
|
|
32
|
+
get subscribersCount() {
|
|
33
|
+
return subscribersCount;
|
|
34
|
+
},
|
|
35
|
+
broadcast,
|
|
36
|
+
clearMessages,
|
|
37
|
+
};
|
|
38
|
+
}
|
package/dist/components.css
CHANGED
|
@@ -1328,6 +1328,10 @@ main {
|
|
|
1328
1328
|
outline: none;
|
|
1329
1329
|
transition: border-color 120ms ease, box-shadow 120ms ease;
|
|
1330
1330
|
}
|
|
1331
|
+
/* Inline variant keeps the Arco chevron and states without forcing full width. */
|
|
1332
|
+
.svadmin-select--inline {
|
|
1333
|
+
width: auto;
|
|
1334
|
+
}
|
|
1331
1335
|
.svadmin-select:focus-visible {
|
|
1332
1336
|
border-color: var(--ring);
|
|
1333
1337
|
box-shadow: 0 0 0 3px var(--ring);
|
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,8 @@ export { default as PhoneField } from './components/fields/PhoneField.svelte';
|
|
|
265
265
|
export { CreateButton, EditButton, DeleteButton, ShowButton, ListButton, RefreshButton, ExportButton, ImportButton, SaveButton, CloneButton, } from './components/buttons/index.js';
|
|
266
266
|
export { Button, buttonVariants } from './components/ui/button/index.js';
|
|
267
267
|
export { Input } from './components/ui/input/index.js';
|
|
268
|
+
export { default as InputGroup } from './components/InputGroup.svelte';
|
|
269
|
+
export type { InputGroupProps } from './components/InputGroup.svelte';
|
|
268
270
|
export { Textarea } from './components/ui/textarea/index.js';
|
|
269
271
|
export { Select } from './components/ui/select/index.js';
|
|
270
272
|
export { Switch } from './components/ui/switch/index.js';
|
|
@@ -655,3 +657,7 @@ export { default as ChartAnnotationOverlay, default as MetricEventAnnotation, ty
|
|
|
655
657
|
export { default as AbacPolicyMatrix, default as AttributeBasedAccessControlMatrix, type AbacPolicyMatrixProps, type AbacPolicyRule, type AbacCondition } from './components/AbacPolicyMatrix.svelte';
|
|
656
658
|
export { default as PermissionSimulator, default as RolePermissionSandbox, type PermissionSimulatorProps, type SimulationTargetUser, type SimulatedMenuNode, type SimulatedAction } from './components/PermissionSimulator.svelte';
|
|
657
659
|
export { default as WorkflowNodeInspector, default as ApprovalNodeDrawer, type WorkflowNodeInspectorProps, type WorkflowNodeData } from './components/WorkflowNodeInspector.svelte';
|
|
660
|
+
export { default as MicroAppSandbox, default as SubAppRuntimeSandbox, type MicroAppSandboxProps } from './components/MicroAppSandbox.svelte';
|
|
661
|
+
export { useMicroAppState, type UseMicroAppStateOptions, type MicroAppStateMessage } from './components/useMicroAppState.svelte.js';
|
|
662
|
+
export { default as MicroAppStateBusIndicator, default as CrossAppStateBus, type MicroAppStateBusIndicatorProps } from './components/MicroAppStateBusIndicator.svelte';
|
|
663
|
+
export { default as MicroAppRouteSync, default as SubAppUrlSynchronizer, type MicroAppRouteSyncProps } from './components/MicroAppRouteSync.svelte';
|
package/dist/index.js
CHANGED
|
@@ -211,6 +211,7 @@ export { CreateButton, EditButton, DeleteButton, ShowButton, ListButton, Refresh
|
|
|
211
211
|
// Base UI components (shadcn-svelte)
|
|
212
212
|
export { Button, buttonVariants } from './components/ui/button/index.js';
|
|
213
213
|
export { Input } from './components/ui/input/index.js';
|
|
214
|
+
export { default as InputGroup } from './components/InputGroup.svelte';
|
|
214
215
|
export { Textarea } from './components/ui/textarea/index.js';
|
|
215
216
|
export { Select } from './components/ui/select/index.js';
|
|
216
217
|
export { Switch } from './components/ui/switch/index.js';
|
|
@@ -605,3 +606,8 @@ export { default as ChartAnnotationOverlay, default as MetricEventAnnotation } f
|
|
|
605
606
|
export { default as AbacPolicyMatrix, default as AttributeBasedAccessControlMatrix } from './components/AbacPolicyMatrix.svelte';
|
|
606
607
|
export { default as PermissionSimulator, default as RolePermissionSandbox } from './components/PermissionSimulator.svelte';
|
|
607
608
|
export { default as WorkflowNodeInspector, default as ApprovalNodeDrawer } from './components/WorkflowNodeInspector.svelte';
|
|
609
|
+
// Enterprise micro-app isolated sandbox runtime, state bus & route sync suite
|
|
610
|
+
export { default as MicroAppSandbox, default as SubAppRuntimeSandbox } from './components/MicroAppSandbox.svelte';
|
|
611
|
+
export { useMicroAppState } from './components/useMicroAppState.svelte.js';
|
|
612
|
+
export { default as MicroAppStateBusIndicator, default as CrossAppStateBus } from './components/MicroAppStateBusIndicator.svelte';
|
|
613
|
+
export { default as MicroAppRouteSync, default as SubAppUrlSynchronizer } from './components/MicroAppRouteSync.svelte';
|