@svadmin/ui 0.127.0 → 0.129.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 +210 -64
- package/dist/app.theme.css +210 -64
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AppFooter.svelte +1 -1
- package/dist/components/BoundRecordDetailDrawer.svelte +1 -1
- package/dist/components/CodeEditor.svelte +1 -1
- package/dist/components/ColorPicker.svelte +2 -2
- package/dist/components/ComboboxField.svelte +15 -8
- package/dist/components/CommandPalette.svelte +16 -5
- package/dist/components/FieldRenderer.svelte +2 -2
- package/dist/components/FileUpload.svelte +11 -2
- package/dist/components/FileUpload.svelte.d.ts +2 -0
- package/dist/components/FloatButton.svelte +1 -1
- package/dist/components/JsonEditor.svelte +1 -1
- package/dist/components/ListPagination.svelte +19 -12
- package/dist/components/Menu.svelte +6 -6
- package/dist/components/NotificationHost.svelte +1 -1
- package/dist/components/PhoneInput.svelte +1 -1
- package/dist/components/RadioGroup.svelte +9 -1
- package/dist/components/Rate.svelte +2 -2
- package/dist/components/RelationPicker.svelte +2 -2
- package/dist/components/ResizableGrid.svelte +1 -1
- package/dist/components/ResizeBox.svelte +1 -1
- package/dist/components/SegmentedControl.svelte +2 -2
- package/dist/components/Space.svelte +19 -3
- package/dist/components/Space.svelte.d.ts +6 -1
- package/dist/components/Steps.svelte +12 -11
- package/dist/components/SvarDataGrid.svelte +1 -1
- package/dist/components/SvarResourceTableView.svelte +3 -3
- package/dist/components/Tag.svelte +5 -4
- package/dist/components/TagsInput.svelte +2 -2
- package/dist/components/Tour.svelte +1 -1
- package/dist/components/Tree.svelte +1 -1
- package/dist/components/TreeSelect.svelte +2 -2
- package/dist/components/TypographyEllipsis.svelte +1 -1
- package/dist/components/TypographyText.svelte +2 -2
- package/dist/components/ViewModeToggle.svelte +1 -1
- package/dist/components/ui/alert/alert.svelte +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte +10 -2
- package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte.d.ts +1 -0
- package/dist/components/ui/select/select.svelte +6 -1
- package/dist/components/ui/select/select.svelte.d.ts +4 -1
- package/dist/components/ui/switch/switch.svelte +11 -2
- package/dist/components/ui/switch/switch.svelte.d.ts +2 -0
- package/dist/components/ui/textarea/textarea.svelte +61 -1
- package/dist/components/ui/textarea/textarea.svelte.d.ts +7 -1
- package/dist/components/ui/tooltip/tooltip-content.svelte +5 -1
- package/dist/components/ui/tooltip/tooltip-content.svelte.d.ts +1 -0
- package/dist/components/ui/tooltip/tooltip-context.svelte.js +1 -1
- package/dist/copy-format.d.ts +1 -1
- package/dist/copy-format.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/notifications.svelte.js +1 -1
- package/dist/styles/recipes.css +4 -4
- package/package.json +4 -4
|
@@ -88,6 +88,12 @@
|
|
|
88
88
|
const normalizedViewportHeight = $derived(
|
|
89
89
|
Number.isSafeInteger(viewportHeight) && viewportHeight >= 120 && viewportHeight <= 800 ? viewportHeight : 280,
|
|
90
90
|
);
|
|
91
|
+
// 选项溢出时,滚动面板露出最后一项大约一半,提示下面还有内容。
|
|
92
|
+
const menuViewportHeight = $derived.by(() => {
|
|
93
|
+
const item = normalizedItemHeight;
|
|
94
|
+
const full = Math.max(1, Math.floor(normalizedViewportHeight / item));
|
|
95
|
+
return full * item + Math.round(item / 2);
|
|
96
|
+
});
|
|
91
97
|
|
|
92
98
|
const binding = useResourceContract(() => resource);
|
|
93
99
|
const context = captureAdminContext();
|
|
@@ -189,11 +195,11 @@
|
|
|
189
195
|
const totalOptions = $derived(select.query.data?.total ?? availableOptions.length);
|
|
190
196
|
const shouldVirtualize = $derived(virtualized && availableOptions.length >= 200);
|
|
191
197
|
const virtualTotalHeight = $derived(availableOptions.length * normalizedItemHeight);
|
|
192
|
-
const virtualMaxScroll = $derived(Math.max(0, virtualTotalHeight -
|
|
198
|
+
const virtualMaxScroll = $derived(Math.max(0, virtualTotalHeight - menuViewportHeight));
|
|
193
199
|
const clampedListScrollTop = $derived(Math.max(0, Math.min(listScrollTop, virtualMaxScroll)));
|
|
194
200
|
const virtualStart = $derived(Math.max(0, Math.floor(clampedListScrollTop / normalizedItemHeight) - 5));
|
|
195
201
|
const virtualEnd = $derived(Math.min(availableOptions.length,
|
|
196
|
-
Math.ceil((clampedListScrollTop +
|
|
202
|
+
Math.ceil((clampedListScrollTop + menuViewportHeight) / normalizedItemHeight) + 5));
|
|
197
203
|
const renderedOptions = $derived(shouldVirtualize
|
|
198
204
|
? availableOptions.slice(virtualStart, virtualEnd) : availableOptions);
|
|
199
205
|
const activeOptionId = $derived(shouldVirtualize && activeIndex >= 0 && availableOptions[activeIndex]
|
|
@@ -351,8 +357,8 @@
|
|
|
351
357
|
const top = activeIndex * normalizedItemHeight;
|
|
352
358
|
const bottom = top + normalizedItemHeight;
|
|
353
359
|
if (top < clampedListScrollTop) listScrollTop = top;
|
|
354
|
-
else if (bottom > clampedListScrollTop +
|
|
355
|
-
listScrollTop = bottom -
|
|
360
|
+
else if (bottom > clampedListScrollTop + menuViewportHeight) {
|
|
361
|
+
listScrollTop = bottom - menuViewportHeight;
|
|
356
362
|
}
|
|
357
363
|
if (listElement) listElement.scrollTop = listScrollTop;
|
|
358
364
|
}
|
|
@@ -411,8 +417,8 @@
|
|
|
411
417
|
disabled={select.isFetching || searchInputValue !== appliedSearch}
|
|
412
418
|
value={`${typeof opt.value}:${opt.value}`}
|
|
413
419
|
onSelect={() => handleSelect(opt.value)}
|
|
414
|
-
style={
|
|
415
|
-
class="relative flex cursor-default select-none items-center rounded-sm px-2
|
|
420
|
+
style={`height:${normalizedItemHeight}px;`}
|
|
421
|
+
class="relative box-border flex cursor-default select-none items-center overflow-hidden rounded-sm px-2 text-sm outline-none data-[selected]:bg-accent data-[selected]:text-accent-foreground"
|
|
416
422
|
>
|
|
417
423
|
<Check class="mr-2 h-3.5 w-3.5 {selectedValues.includes(opt.value) ? 'opacity-100' : 'opacity-0'}" />
|
|
418
424
|
{opt.label}
|
|
@@ -486,11 +492,12 @@
|
|
|
486
492
|
aria-activedescendant={activeOptionId}
|
|
487
493
|
aria-multiselectable={multiple || undefined}
|
|
488
494
|
style={shouldVirtualize
|
|
489
|
-
? `height:${
|
|
495
|
+
? `height:${menuViewportHeight}px;max-height:${menuViewportHeight}px;overflow-y:auto;`
|
|
496
|
+
: `max-height:${menuViewportHeight}px;`}
|
|
490
497
|
onscroll={(event: Event) => {
|
|
491
498
|
if (event.currentTarget instanceof HTMLElement) listScrollTop = event.currentTarget.scrollTop;
|
|
492
499
|
}}
|
|
493
|
-
class="
|
|
500
|
+
class="overflow-y-auto px-1"
|
|
494
501
|
>
|
|
495
502
|
{#if select.isLoading}
|
|
496
503
|
{#each Array(3) as _, _i (_i)}
|
|
@@ -29,6 +29,15 @@
|
|
|
29
29
|
searchValue = '';
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function localizedFallback(zh: string, en: string): string {
|
|
33
|
+
return i18n.locale.toLowerCase().startsWith('zh') ? zh : en;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function translateOrFallback(key: string, fallback: string): string {
|
|
37
|
+
const value = i18n.t(key);
|
|
38
|
+
return value && value !== key ? value : fallback;
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
function act(fn: () => void) {
|
|
33
42
|
fn();
|
|
34
43
|
close();
|
|
@@ -49,14 +58,16 @@
|
|
|
49
58
|
<Dialog.DialogContent class="overflow-hidden p-0 sm:max-w-[560px]">
|
|
50
59
|
<Dialog.DialogTitle class="sr-only">{i18n.t('common.search')}</Dialog.DialogTitle>
|
|
51
60
|
<Command.Root class="flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground [&_[data-command-group-heading]]:text-muted-foreground [&_[data-command-group-heading]]:px-2 [&_[data-command-group-heading]]:py-1.5 [&_[data-command-group-heading]]:text-xs [&_[data-command-group-heading]]:font-semibold [&_[data-command-group-heading]]:uppercase [&_[data-command-group-heading]]:tracking-wider">
|
|
52
|
-
<div class="flex items-center border-b
|
|
61
|
+
<div class="flex items-center border-b pl-3 pr-12" data-cmdk-input-wrapper="">
|
|
53
62
|
<Search class="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
54
63
|
<Command.Input
|
|
55
64
|
bind:value={searchValue}
|
|
56
|
-
placeholder={hasAI
|
|
65
|
+
placeholder={hasAI
|
|
66
|
+
? translateOrFallback('commandPalette.searchOrAsk', localizedFallback('搜索命令或询问 AI…', 'Search commands or ask AI…'))
|
|
67
|
+
: i18n.t('common.search')}
|
|
57
68
|
class="flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50"
|
|
58
69
|
/>
|
|
59
|
-
<kbd class="ml-2 text-[10px] font-mono font-medium text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border">ESC</kbd>
|
|
70
|
+
<kbd class="ml-2 shrink-0 text-[10px] font-mono font-medium text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border">ESC</kbd>
|
|
60
71
|
</div>
|
|
61
72
|
<Command.List class="max-h-[320px] overflow-y-auto overflow-x-hidden p-1">
|
|
62
73
|
<Command.Empty class="py-6 text-center text-sm text-muted-foreground">
|
|
@@ -66,7 +77,7 @@
|
|
|
66
77
|
onclick={askAI}
|
|
67
78
|
>
|
|
68
79
|
<Sparkles class="h-3.5 w-3.5" />
|
|
69
|
-
{
|
|
80
|
+
{translateOrFallback('commandPalette.askAI', localizedFallback('询问 AI', 'Ask AI'))}: "{searchValue.trim()}"
|
|
70
81
|
</button>
|
|
71
82
|
{:else}
|
|
72
83
|
{i18n.t('common.noData')}
|
|
@@ -82,7 +93,7 @@
|
|
|
82
93
|
class={itemClass}
|
|
83
94
|
>
|
|
84
95
|
<Sparkles class="h-4 w-4 text-primary" />
|
|
85
|
-
<span class="text-primary font-medium">{
|
|
96
|
+
<span class="text-primary font-medium">{translateOrFallback('commandPalette.askAI', localizedFallback('询问 AI', 'Ask AI'))}</span>
|
|
86
97
|
<span class="text-muted-foreground truncate ml-1">"{searchValue.trim()}"</span>
|
|
87
98
|
</Command.Item>
|
|
88
99
|
</Command.Group>
|
|
@@ -145,10 +145,10 @@
|
|
|
145
145
|
data-svadmin-field-key={field.key}
|
|
146
146
|
>
|
|
147
147
|
<Label {...definedOptions({ for: !children && (['array', 'transfer'].includes(field.type) || field.type === 'richtext' && getRichTextEditor()) ? undefined : labelTarget })} id={labelId} data-svadmin-field-label>
|
|
148
|
-
{field.label}
|
|
149
148
|
{#if field.required}
|
|
150
|
-
<span class="text-destructive" data-svadmin-required>*</span>
|
|
149
|
+
<span class="text-destructive" data-svadmin-required aria-hidden="true">*</span>
|
|
151
150
|
{/if}
|
|
151
|
+
{field.label}
|
|
152
152
|
</Label>
|
|
153
153
|
|
|
154
154
|
{#if children}
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
cancelUpload?: UploadCancelHandler | undefined;
|
|
32
32
|
onChange?: ((items: UploadItem[]) => void) | undefined;
|
|
33
33
|
onReject?: ((file: File, reason: string) => void) | undefined;
|
|
34
|
+
/** 返回 false 时不移除。异步检查完成前文件仍留在列表里。 */
|
|
35
|
+
beforeRemove?: ((item: UploadItem) => boolean | Promise<boolean>) | undefined;
|
|
34
36
|
class?: string | undefined;
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
cancelUpload,
|
|
51
53
|
onChange,
|
|
52
54
|
onReject,
|
|
55
|
+
beforeRemove,
|
|
53
56
|
class: className = '',
|
|
54
57
|
}: Props = $props();
|
|
55
58
|
|
|
@@ -359,11 +362,17 @@
|
|
|
359
362
|
if (upload) target.value = '';
|
|
360
363
|
}
|
|
361
364
|
|
|
362
|
-
function remove(id: string): void {
|
|
365
|
+
async function remove(id: string): Promise<void> {
|
|
363
366
|
if (disabled) return;
|
|
367
|
+
const item = items.find(entry => entry.id === id);
|
|
368
|
+
if (!item) return;
|
|
369
|
+
if (beforeRemove) {
|
|
370
|
+
const allowed = await beforeRemove(item);
|
|
371
|
+
if (!allowed || disabled || !items.some(entry => entry.id === id)) return;
|
|
372
|
+
}
|
|
364
373
|
retire(id, 'remove');
|
|
365
374
|
latestAttempts.delete(id);
|
|
366
|
-
items = items.filter(
|
|
375
|
+
items = items.filter(entry => entry.id !== id);
|
|
367
376
|
if (input && upload) input.value = '';
|
|
368
377
|
emitChange();
|
|
369
378
|
}
|
|
@@ -16,6 +16,8 @@ interface Props {
|
|
|
16
16
|
cancelUpload?: UploadCancelHandler | undefined;
|
|
17
17
|
onChange?: ((items: UploadItem[]) => void) | undefined;
|
|
18
18
|
onReject?: ((file: File, reason: string) => void) | undefined;
|
|
19
|
+
/** 返回 false 时不移除。异步检查完成前文件仍留在列表里。 */
|
|
20
|
+
beforeRemove?: ((item: UploadItem) => boolean | Promise<boolean>) | undefined;
|
|
19
21
|
class?: string | undefined;
|
|
20
22
|
}
|
|
21
23
|
declare const FileUpload: import("svelte").Component<Props, {}, "">;
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
.svadmin-float-button[data-type='primary'] { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
|
|
95
95
|
.svadmin-float-button:hover { background: var(--accent); box-shadow: var(--svadmin-shadow-surface-hover); }
|
|
96
96
|
.svadmin-float-button[data-type='primary']:hover { background: color-mix(in srgb, var(--primary) 88%, black); }
|
|
97
|
-
.svadmin-float-button:focus-visible { outline:
|
|
97
|
+
.svadmin-float-button:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring); outline-offset: var(--svadmin-focus-offset); }
|
|
98
98
|
.svadmin-float-button[disabled], .svadmin-float-button[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
|
|
99
99
|
.svadmin-float-button__icon { display: inline-flex; align-items: center; justify-content: center; }
|
|
100
100
|
.svadmin-float-button__text { display: grid; text-align: start; }
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
color: var(--card-foreground, var(--foreground, currentColor));
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
.svadmin-json-editor:focus-within { outline:
|
|
152
|
+
.svadmin-json-editor:focus-within { outline: var(--svadmin-focus-width) solid var(--ring, currentColor); outline-offset: var(--svadmin-focus-offset); }
|
|
153
153
|
.svadmin-json-editor__surface { width: 100%; }
|
|
154
154
|
.svadmin-json-editor__fallback {
|
|
155
155
|
display: block;
|
|
@@ -184,8 +184,11 @@
|
|
|
184
184
|
cursor: pointer;
|
|
185
185
|
transition: border-color var(--svadmin-motion-fast) var(--svadmin-motion-easing);
|
|
186
186
|
}
|
|
187
|
-
.svadmin-list-pagination__size select:focus-visible
|
|
187
|
+
.svadmin-list-pagination__size select:focus-visible,
|
|
188
|
+
.svadmin-list-pagination__jumper input:focus-visible {
|
|
188
189
|
border-color: var(--ring);
|
|
190
|
+
outline: var(--svadmin-focus-width) solid color-mix(in oklch, var(--ring) 48%, transparent);
|
|
191
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
189
192
|
}
|
|
190
193
|
:is(.dark, [data-color-scheme="dark"]) .svadmin-list-pagination__size select {
|
|
191
194
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B3B3B3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
|
|
@@ -197,25 +200,29 @@
|
|
|
197
200
|
min-width: 2rem;
|
|
198
201
|
height: 2rem;
|
|
199
202
|
padding: 0 .625rem;
|
|
200
|
-
border:
|
|
201
|
-
border-radius:
|
|
202
|
-
background:
|
|
203
|
-
color:
|
|
203
|
+
border: 0;
|
|
204
|
+
border-radius: 2px;
|
|
205
|
+
background: transparent;
|
|
206
|
+
color: var(--muted-foreground);
|
|
204
207
|
cursor: pointer;
|
|
205
|
-
font-size: .
|
|
206
|
-
transition:
|
|
208
|
+
font-size: .875rem;
|
|
209
|
+
transition: background-color var(--svadmin-motion-fast) var(--svadmin-motion-easing), color var(--svadmin-motion-fast) var(--svadmin-motion-easing);
|
|
207
210
|
}
|
|
208
211
|
.svadmin-list-pagination__page { padding: 0 .5rem; }
|
|
209
212
|
.svadmin-list-pagination__control:hover:not(:disabled),
|
|
210
|
-
.svadmin-list-pagination__page:hover:not(:disabled) {
|
|
213
|
+
.svadmin-list-pagination__page:hover:not(:disabled) { background: var(--svadmin-fill-1, var(--muted)); color: var(--muted-foreground); }
|
|
211
214
|
.svadmin-list-pagination__page--active,
|
|
212
|
-
.svadmin-list-pagination__page--active:disabled {
|
|
215
|
+
.svadmin-list-pagination__page--active:disabled { background: var(--primary-light-1, var(--accent)); color: var(--primary); opacity: 1; }
|
|
213
216
|
.svadmin-list-pagination__control:disabled,
|
|
214
|
-
.svadmin-list-pagination__page:disabled { opacity:
|
|
217
|
+
.svadmin-list-pagination__page:disabled { opacity: 1; color: var(--svadmin-text-4); cursor: not-allowed; }
|
|
218
|
+
.svadmin-list-pagination__control:focus-visible,
|
|
219
|
+
.svadmin-list-pagination__page:focus-visible {
|
|
220
|
+
outline: var(--svadmin-focus-width) solid color-mix(in oklch, var(--ring) 48%, transparent);
|
|
221
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
222
|
+
}
|
|
215
223
|
.svadmin-list-pagination__ellipsis { min-width: 1.5rem; text-align: center; color: var(--muted-foreground); }
|
|
216
224
|
.svadmin-list-pagination__simple { min-width: 6rem; color: var(--muted-foreground); font-size: .8125rem; text-align: center; }
|
|
217
225
|
.svadmin-list-pagination__jumper { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted-foreground); font-size: .8125rem; }
|
|
218
|
-
.svadmin-list-pagination__jumper input { width: 3.5rem; height: 2rem; padding: 0 .4rem; border: 1px solid var(--border); border-radius:
|
|
219
|
-
.svadmin-list-pagination__jumper input:focus-visible { border-color: var(--ring); }
|
|
226
|
+
.svadmin-list-pagination__jumper input { width: 3.5rem; height: 2rem; padding: 0 .4rem; border: 1px solid var(--border); border-radius: 2px; background: var(--background); color: var(--foreground); font: inherit; font-size: .875rem; outline: none; }
|
|
220
227
|
.svadmin-list-pagination__summary { margin: 0; font-size: .8125rem; color: var(--muted-foreground); }
|
|
221
228
|
</style>
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
align-items: center;
|
|
191
191
|
gap: var(--svadmin-space-2);
|
|
192
192
|
width: 100%;
|
|
193
|
-
min-height:
|
|
193
|
+
min-height: 2.5rem;
|
|
194
194
|
padding-inline: var(--svadmin-space-3);
|
|
195
195
|
border: 0;
|
|
196
196
|
border-radius: var(--radius-sm);
|
|
@@ -201,16 +201,16 @@
|
|
|
201
201
|
text-decoration: none;
|
|
202
202
|
cursor: pointer;
|
|
203
203
|
}
|
|
204
|
-
.svadmin-menu__link:hover { background: var(--muted); color: var(--foreground); }
|
|
205
|
-
.svadmin-menu__link[data-selected='true'] { background: var(--
|
|
206
|
-
.svadmin-menu__link[data-disabled='true'] { opacity:
|
|
207
|
-
.svadmin-menu__link:focus-visible { outline:
|
|
204
|
+
.svadmin-menu__link:hover { background: var(--svadmin-fill-2, var(--muted)); color: var(--foreground); }
|
|
205
|
+
.svadmin-menu__link[data-selected='true'] { background: var(--svadmin-fill-2, var(--muted)); color: var(--primary); font-weight: 500; }
|
|
206
|
+
.svadmin-menu__link[data-disabled='true'] { opacity: 1; color: var(--svadmin-text-4); cursor: not-allowed; }
|
|
207
|
+
.svadmin-menu__link:focus-visible { outline: var(--svadmin-focus-width) solid color-mix(in oklch, var(--ring) 48%, transparent); outline-offset: var(--svadmin-focus-offset); }
|
|
208
208
|
.svadmin-menu__icon { display: inline-flex; flex: 0 0 auto; }
|
|
209
209
|
.svadmin-menu__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
210
210
|
.svadmin-menu__badge { margin-inline-start: auto; padding-inline: var(--svadmin-space-2); border-radius: 999px; background: var(--muted); color: var(--muted-foreground); font-size: var(--svadmin-text-caption); }
|
|
211
211
|
.svadmin-menu__chevron { margin-inline-start: auto; transition: transform 120ms ease; }
|
|
212
212
|
.svadmin-menu__item[data-open='true'] > .svadmin-menu__link .svadmin-menu__chevron { transform: rotate(180deg); }
|
|
213
|
-
.svadmin-menu__list[data-depth]:not([data-depth='0']) { margin-block-start: var(--svadmin-space-1); margin-inline-start:
|
|
213
|
+
.svadmin-menu__list[data-depth]:not([data-depth='0']) { margin-block-start: var(--svadmin-space-1); margin-inline-start: 1.25rem; }
|
|
214
214
|
.svadmin-menu[data-collapsed='true'] .svadmin-menu__label,
|
|
215
215
|
.svadmin-menu[data-collapsed='true'] .svadmin-menu__badge,
|
|
216
216
|
.svadmin-menu[data-collapsed='true'] .svadmin-menu__chevron { display: none; }
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
.svadmin-notification-host__action { margin-block-start: var(--svadmin-space-2); padding: 0; border: 0; background: transparent; color: var(--primary); font-size: var(--svadmin-text-label); font-weight: 600; cursor: pointer; }
|
|
51
51
|
.svadmin-notification-host__close { align-self: start; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); cursor: pointer; }
|
|
52
52
|
.svadmin-notification-host__close:hover { background: var(--muted); color: var(--foreground); }
|
|
53
|
-
.svadmin-notification-host__close:focus-visible { outline:
|
|
53
|
+
.svadmin-notification-host__close:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring); outline-offset: var(--svadmin-focus-offset); }
|
|
54
54
|
</style>
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
color: var(--foreground, currentColor);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.svadmin-phone-input:focus-within { outline:
|
|
108
|
+
.svadmin-phone-input:focus-within { outline: var(--svadmin-focus-width) solid var(--ring, currentColor); outline-offset: var(--svadmin-focus-offset); }
|
|
109
109
|
.svadmin-phone-input[data-invalid='true'] { border-color: var(--destructive, currentColor); }
|
|
110
110
|
.svadmin-phone-input[data-disabled='true'] { cursor: not-allowed; opacity: 0.6; }
|
|
111
111
|
|
|
@@ -304,9 +304,17 @@
|
|
|
304
304
|
cursor: pointer;
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
.svadmin-radio-group__option input[type='radio'] {
|
|
308
|
+
width: 14px;
|
|
309
|
+
height: 14px;
|
|
310
|
+
margin: 0;
|
|
311
|
+
flex: 0 0 auto;
|
|
312
|
+
accent-color: var(--primary);
|
|
313
|
+
}
|
|
314
|
+
|
|
307
315
|
.svadmin-radio-group__option--disabled {
|
|
308
316
|
cursor: not-allowed;
|
|
309
|
-
|
|
317
|
+
color: var(--svadmin-text-4);
|
|
310
318
|
}
|
|
311
319
|
|
|
312
320
|
.svadmin-radio-group__copy {
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
.svadmin-rate button:focus-visible {
|
|
130
|
-
outline:
|
|
131
|
-
outline-offset:
|
|
130
|
+
outline: var(--svadmin-focus-width) solid var(--ring);
|
|
131
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.svadmin-rate button:disabled {
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
max-width: 100%;
|
|
364
364
|
}
|
|
365
365
|
.svadmin-relation-picker__option:focus-visible {
|
|
366
|
-
outline:
|
|
367
|
-
outline-offset:
|
|
366
|
+
outline: var(--svadmin-focus-width) solid var(--ring);
|
|
367
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
368
368
|
}
|
|
369
369
|
</style>
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
color: var(--muted-foreground, currentColor);
|
|
229
229
|
cursor: pointer;
|
|
230
230
|
}
|
|
231
|
-
.svadmin-resizable-grid__handle:focus-visible { outline:
|
|
231
|
+
.svadmin-resizable-grid__handle:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring, currentColor); outline-offset: calc(-1 * var(--svadmin-focus-offset)); }
|
|
232
232
|
|
|
233
233
|
.svadmin-resizable-grid__handle--move {
|
|
234
234
|
top: 0;
|
|
@@ -142,5 +142,5 @@
|
|
|
142
142
|
}
|
|
143
143
|
.svadmin-resize-box[data-direction='horizontal'] .svadmin-resize-box__handle { cursor: ew-resize; }
|
|
144
144
|
.svadmin-resize-box[data-direction='vertical'] .svadmin-resize-box__handle { cursor: ns-resize; }
|
|
145
|
-
.svadmin-resize-box__handle:focus-visible { outline:
|
|
145
|
+
.svadmin-resize-box__handle:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring); outline-offset: var(--svadmin-focus-offset); }
|
|
146
146
|
</style>
|
|
@@ -136,8 +136,8 @@
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
.svadmin-segmented-control__item:focus-visible {
|
|
139
|
-
outline:
|
|
140
|
-
outline-offset:
|
|
139
|
+
outline: var(--svadmin-focus-width) solid var(--ring);
|
|
140
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
.svadmin-segmented-control__item:disabled {
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { cn } from '../utils.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* 官方间距:mini / small / medium / large = 4 / 8 / 16 / 24。
|
|
7
|
+
* xs / sm / lg / xl 保留。lg 仍是 16px,不改成官方 large 的 24px。
|
|
8
|
+
* 12px 的 md 已删除。
|
|
9
|
+
*/
|
|
10
|
+
type SpaceSize = 'xs' | 'sm' | 'lg' | 'xl' | 'mini' | 'small' | 'medium' | 'large' | number;
|
|
6
11
|
|
|
7
12
|
interface Props {
|
|
8
13
|
direction?: 'horizontal' | 'vertical';
|
|
@@ -26,7 +31,17 @@
|
|
|
26
31
|
children,
|
|
27
32
|
}: Props = $props();
|
|
28
33
|
|
|
29
|
-
const
|
|
34
|
+
const spaceStep: Record<Exclude<SpaceSize, number>, string> = {
|
|
35
|
+
xs: '1',
|
|
36
|
+
mini: '1',
|
|
37
|
+
sm: '2',
|
|
38
|
+
small: '2',
|
|
39
|
+
lg: '4',
|
|
40
|
+
medium: '4',
|
|
41
|
+
xl: '5',
|
|
42
|
+
large: '5',
|
|
43
|
+
};
|
|
44
|
+
const gap = $derived(typeof size === 'number' ? `${size}px` : `var(--svadmin-space-${spaceStep[size]})`);
|
|
30
45
|
const alignMap = { start: 'flex-start', center: 'center', end: 'flex-end', baseline: 'baseline', stretch: 'stretch' } as const;
|
|
31
46
|
const justifyMap = { start: 'flex-start', center: 'center', end: 'flex-end', between: 'space-between', around: 'space-around', evenly: 'space-evenly' } as const;
|
|
32
47
|
</script>
|
|
@@ -34,6 +49,7 @@
|
|
|
34
49
|
<div
|
|
35
50
|
class={cn('svadmin-space', className)}
|
|
36
51
|
data-direction={direction}
|
|
52
|
+
data-size={typeof size === 'number' ? undefined : size}
|
|
37
53
|
data-inline={inline ? 'true' : 'false'}
|
|
38
54
|
style:--svadmin-space-gap={gap}
|
|
39
55
|
style:align-items={alignMap[align]}
|
|
@@ -55,4 +71,4 @@
|
|
|
55
71
|
.svadmin-space[data-inline='true'] {
|
|
56
72
|
display: inline-flex;
|
|
57
73
|
}
|
|
58
|
-
</style>
|
|
74
|
+
</style>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 官方间距:mini / small / medium / large = 4 / 8 / 16 / 24。
|
|
4
|
+
* xs / sm / lg / xl 保留。lg 仍是 16px,不改成官方 large 的 24px。
|
|
5
|
+
* 12px 的 md 已删除。
|
|
6
|
+
*/
|
|
7
|
+
type SpaceSize = 'xs' | 'sm' | 'lg' | 'xl' | 'mini' | 'small' | 'medium' | 'large' | number;
|
|
3
8
|
interface Props {
|
|
4
9
|
direction?: 'horizontal' | 'vertical';
|
|
5
10
|
size?: SpaceSize;
|
|
@@ -93,6 +93,10 @@
|
|
|
93
93
|
cursor: default;
|
|
94
94
|
}
|
|
95
95
|
.svadmin-steps__action:not(:disabled) { cursor: pointer; }
|
|
96
|
+
.svadmin-steps__action:focus-visible {
|
|
97
|
+
outline: var(--svadmin-focus-width) solid color-mix(in oklch, var(--ring) 48%, transparent);
|
|
98
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
99
|
+
}
|
|
96
100
|
.svadmin-steps__indicator {
|
|
97
101
|
display: inline-flex;
|
|
98
102
|
flex: 0 0 auto;
|
|
@@ -100,18 +104,18 @@
|
|
|
100
104
|
justify-content: center;
|
|
101
105
|
width: 1.75rem;
|
|
102
106
|
height: 1.75rem;
|
|
103
|
-
border:
|
|
107
|
+
border: 0;
|
|
104
108
|
border-radius: 999px;
|
|
105
|
-
background: var(--
|
|
109
|
+
background: var(--svadmin-fill-2, var(--muted));
|
|
106
110
|
color: var(--muted-foreground);
|
|
107
111
|
font-size: var(--svadmin-text-caption);
|
|
108
|
-
font-weight:
|
|
112
|
+
font-weight: 500;
|
|
109
113
|
}
|
|
110
|
-
.svadmin-steps__item[data-status='finish'] .svadmin-steps__indicator {
|
|
111
|
-
.svadmin-steps__item[data-status='process'] .svadmin-steps__indicator {
|
|
112
|
-
.svadmin-steps__item[data-status='error'] .svadmin-steps__indicator {
|
|
114
|
+
.svadmin-steps__item[data-status='finish'] .svadmin-steps__indicator { background: var(--primary-light-1, var(--accent)); color: var(--primary); }
|
|
115
|
+
.svadmin-steps__item[data-status='process'] .svadmin-steps__indicator { background: var(--primary); color: var(--primary-foreground); }
|
|
116
|
+
.svadmin-steps__item[data-status='error'] .svadmin-steps__indicator { background: var(--destructive); color: var(--destructive-foreground); }
|
|
113
117
|
.svadmin-steps__text { display: grid; min-width: 0; gap: 0.15rem; }
|
|
114
|
-
.svadmin-steps__title { color: var(--foreground); font-size: var(--svadmin-text-
|
|
118
|
+
.svadmin-steps__title { color: var(--foreground); font-size: var(--svadmin-text-section); font-weight: 500; }
|
|
115
119
|
.svadmin-steps__item[data-status='wait'] .svadmin-steps__title { color: var(--muted-foreground); font-weight: 500; }
|
|
116
120
|
.svadmin-steps__description { color: var(--muted-foreground); font-size: var(--svadmin-text-caption); }
|
|
117
121
|
.svadmin-steps__connector {
|
|
@@ -131,9 +135,6 @@
|
|
|
131
135
|
transition: width 240ms var(--svadmin-motion-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
132
136
|
}
|
|
133
137
|
.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
|
-
}
|
|
137
138
|
.svadmin-steps[data-direction='vertical'] .svadmin-steps__connector { width: 1px; height: 1.5rem; margin: 0 0 0 0.875rem; }
|
|
138
139
|
.svadmin-steps[data-direction='vertical'] .svadmin-steps__connector-fill {
|
|
139
140
|
inset-inline: 0;
|
|
@@ -147,7 +148,7 @@
|
|
|
147
148
|
.svadmin-steps__connector-fill { transition: none; }
|
|
148
149
|
}
|
|
149
150
|
.svadmin-steps[data-label-placement='vertical'] .svadmin-steps__action { flex-direction: column; }
|
|
150
|
-
.svadmin-steps__item[data-disabled='true'] { opacity:
|
|
151
|
+
.svadmin-steps__item[data-disabled='true'] { opacity: 1; color: var(--svadmin-text-4); }
|
|
151
152
|
@media (max-width: 40rem) {
|
|
152
153
|
.svadmin-steps[data-direction='horizontal'] { flex-direction: column; }
|
|
153
154
|
.svadmin-steps[data-direction='horizontal'] .svadmin-steps__connector { width: 1px; height: 1rem; margin-inline-start: 0.875rem; }
|
|
@@ -370,7 +370,7 @@
|
|
|
370
370
|
p { margin: 0; padding: 0.75rem; }
|
|
371
371
|
button { font: inherit; color: inherit; background: var(--card, Canvas); border: var(--wx-border); border-radius: var(--radius, 6px); padding: 0.375rem 0.75rem; cursor: pointer; }
|
|
372
372
|
button:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
373
|
-
button:focus-visible { outline: 2px solid var(--ring, Highlight); outline-offset: 2px; }
|
|
373
|
+
button:focus-visible { outline: var(--svadmin-focus-width, 2px) solid var(--ring, Highlight); outline-offset: var(--svadmin-focus-offset, 2px); }
|
|
374
374
|
[role='alert'] { color: var(--destructive, CanvasText); }
|
|
375
375
|
.static-preview { overflow-x: auto; }
|
|
376
376
|
table { border-collapse: collapse; width: 100%; }
|
|
@@ -357,10 +357,10 @@
|
|
|
357
357
|
.svar-resource-table { min-width: 0; color: var(--foreground, CanvasText); }
|
|
358
358
|
header, footer, .toolbar, .confirmation { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.75rem 0; }
|
|
359
359
|
header, footer { justify-content: space-between; }
|
|
360
|
-
h2 { font-size: 1.
|
|
360
|
+
h2 { font-size: var(--svadmin-text-title, 1.25rem); margin: 0; font-weight: 500; }
|
|
361
361
|
button, input, select { max-width: 100%; font: inherit; color: inherit; background: var(--card, Canvas); border: 1px solid var(--border, GrayText); border-radius: var(--radius, 6px); padding: 0.375rem 0.75rem; }
|
|
362
|
-
button { cursor: pointer; } button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--ring, Highlight); outline-offset: 2px; }
|
|
363
|
-
button:disabled, input:disabled, select:disabled { opacity:
|
|
362
|
+
button { cursor: pointer; } button:focus-visible, input:focus-visible, select:focus-visible { outline: var(--svadmin-focus-width, 2px) solid var(--ring, Highlight); outline-offset: var(--svadmin-focus-offset, 2px); }
|
|
363
|
+
button:disabled, input:disabled, select:disabled { opacity: 1; color: var(--svadmin-text-4, GrayText); cursor: not-allowed; }
|
|
364
364
|
.confirmation { border-block: 1px solid var(--border, GrayText); } .confirmation p { width: 100%; margin: 0; }
|
|
365
365
|
details label { display: block; } [role='alert'] { color: var(--destructive, CanvasText); }
|
|
366
366
|
</style>
|
|
@@ -82,8 +82,9 @@
|
|
|
82
82
|
</span>
|
|
83
83
|
|
|
84
84
|
<style>
|
|
85
|
-
.svadmin-tag { gap: 0.25rem; max-width: 100%; }
|
|
86
|
-
.svadmin-tag
|
|
85
|
+
.svadmin-tag { gap: 0.25rem; max-width: 100%; min-height: 24px; padding-inline: 8px; border-radius: 2px; font-weight: 500; }
|
|
86
|
+
.svadmin-tag[data-size='compact'] { min-height: 20px; }
|
|
87
|
+
.svadmin-tag.is-disabled { opacity: 1; color: var(--svadmin-text-4); }
|
|
87
88
|
.svadmin-tag__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
88
89
|
.svadmin-tag__control,
|
|
89
90
|
.svadmin-tag__close {
|
|
@@ -107,8 +108,8 @@
|
|
|
107
108
|
}
|
|
108
109
|
.svadmin-tag__control:focus-visible,
|
|
109
110
|
.svadmin-tag__close:focus-visible {
|
|
110
|
-
outline:
|
|
111
|
-
outline-offset:
|
|
111
|
+
outline: var(--svadmin-focus-width) solid color-mix(in oklch, var(--ring) 48%, transparent);
|
|
112
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
112
113
|
border-radius: var(--radius-sm);
|
|
113
114
|
}
|
|
114
115
|
.svadmin-tag__control:disabled,
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
.svadmin-tags-input:focus-within {
|
|
126
|
-
outline:
|
|
127
|
-
outline-offset:
|
|
126
|
+
outline: var(--svadmin-focus-width) solid var(--ring);
|
|
127
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
.svadmin-tags-input[data-invalid='true'] {
|
|
@@ -286,5 +286,5 @@
|
|
|
286
286
|
.svadmin-tour__button { min-height: var(--svadmin-control-h-sm); padding-inline: var(--svadmin-space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background); color: var(--foreground); font-size: var(--svadmin-text-label); cursor: pointer; }
|
|
287
287
|
.svadmin-tour__button:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
288
288
|
.svadmin-tour__button.is-primary { border-color: var(--primary); background: var(--primary); color: var(--primary-foreground); }
|
|
289
|
-
.svadmin-tour__button:focus-visible { outline:
|
|
289
|
+
.svadmin-tour__button:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring); outline-offset: var(--svadmin-focus-offset); }
|
|
290
290
|
</style>
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
}
|
|
364
364
|
.svadmin-tree__row:hover { background: var(--accent); }
|
|
365
365
|
.svadmin-tree__row.is-selected { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
|
|
366
|
-
.svadmin-tree__row:focus-visible { box-shadow: inset 0 0 0
|
|
366
|
+
.svadmin-tree__row:focus-visible { box-shadow: inset 0 0 0 var(--svadmin-focus-width) var(--ring); }
|
|
367
367
|
.svadmin-tree__row.is-disabled { cursor: not-allowed; opacity: 0.5; }
|
|
368
368
|
.svadmin-tree__row.is-dragging { opacity: 0.45; }
|
|
369
369
|
.svadmin-tree__row[data-drop-position='inside'] { background: color-mix(in srgb, var(--primary) 14%, transparent); }
|
|
@@ -934,8 +934,8 @@
|
|
|
934
934
|
}
|
|
935
935
|
.tree-select-trigger:focus-visible,
|
|
936
936
|
.tree-select-action:focus-visible {
|
|
937
|
-
outline:
|
|
938
|
-
outline-offset:
|
|
937
|
+
outline: var(--svadmin-focus-width) solid var(--ring);
|
|
938
|
+
outline-offset: var(--svadmin-focus-offset);
|
|
939
939
|
}
|
|
940
940
|
.tree-select-control[data-disabled] {
|
|
941
941
|
opacity: 0.5;
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
}
|
|
120
120
|
.svadmin-typography-ellipsis__toggle:hover { text-decoration: underline; }
|
|
121
121
|
.svadmin-typography-ellipsis__toggle:focus-visible {
|
|
122
|
-
outline:
|
|
122
|
+
outline: var(--svadmin-focus-width) solid var(--ring);
|
|
123
123
|
outline-offset: var(--svadmin-focus-offset);
|
|
124
124
|
border-radius: var(--radius-sm);
|
|
125
125
|
}
|
|
@@ -216,8 +216,8 @@
|
|
|
216
216
|
}
|
|
217
217
|
.svadmin-typography-text__editor input:focus,
|
|
218
218
|
.svadmin-typography-text__editor textarea:focus {
|
|
219
|
-
outline:
|
|
220
|
-
outline-offset: var(--svadmin-focus-offset,
|
|
219
|
+
outline: var(--svadmin-focus-width) solid var(--ring);
|
|
220
|
+
outline-offset: var(--svadmin-focus-offset, 2px);
|
|
221
221
|
}
|
|
222
222
|
.svadmin-typography-text__action {
|
|
223
223
|
display: inline-flex;
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
.svadmin-view-mode-toggle { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--muted); }
|
|
43
43
|
.svadmin-view-mode-toggle button { display: inline-flex; align-items: center; gap: var(--svadmin-space-1); min-height: 1.75rem; padding-inline: var(--svadmin-space-2); border: 0; border-radius: calc(var(--radius-sm) - 1px); background: transparent; color: var(--muted-foreground); font-size: var(--svadmin-text-caption); cursor: pointer; }
|
|
44
44
|
.svadmin-view-mode-toggle button[aria-pressed='true'] { background: var(--card); color: var(--foreground); box-shadow: var(--svadmin-shadow-control); font-weight: 600; }
|
|
45
|
-
.svadmin-view-mode-toggle button:focus-visible { outline:
|
|
45
|
+
.svadmin-view-mode-toggle button:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring); outline-offset: var(--svadmin-focus-offset); }
|
|
46
46
|
.svadmin-view-mode-toggle button:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
47
47
|
</style>
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
cursor: pointer;
|
|
70
70
|
}
|
|
71
71
|
.svadmin-alert__close:hover { background: var(--muted); color: var(--foreground); }
|
|
72
|
-
.svadmin-alert__close:focus-visible { outline:
|
|
72
|
+
.svadmin-alert__close:focus-visible { outline: var(--svadmin-focus-width) solid var(--ring); outline-offset: var(--svadmin-focus-offset); }
|
|
73
73
|
</style>
|