@svadmin/ui 0.133.0 → 0.135.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.
Files changed (44) hide show
  1. package/dist/app.css +265 -15
  2. package/dist/app.theme.css +265 -15
  3. package/dist/components/AboutSettings.svelte +1 -1
  4. package/dist/components/Affix.svelte +16 -5
  5. package/dist/components/Affix.svelte.d.ts +3 -0
  6. package/dist/components/Anchor.svelte +7 -3
  7. package/dist/components/Anchor.svelte.d.ts +2 -0
  8. package/dist/components/Breadcrumbs.svelte +24 -4
  9. package/dist/components/Breadcrumbs.svelte.d.ts +6 -0
  10. package/dist/components/EmptyState.svelte +2 -2
  11. package/dist/components/OtpInput.svelte +5 -0
  12. package/dist/components/OtpInput.svelte.d.ts +1 -0
  13. package/dist/components/RadioGroup.svelte +9 -1
  14. package/dist/components/RangeSlider.svelte +12 -7
  15. package/dist/components/Slider.svelte +12 -4
  16. package/dist/components/Statistic.svelte +2 -1
  17. package/dist/components/Steps.svelte +75 -2
  18. package/dist/components/Steps.svelte.d.ts +2 -0
  19. package/dist/components/Tag.svelte +50 -12
  20. package/dist/components/Tag.svelte.d.ts +7 -3
  21. package/dist/components/TagsInput.svelte +35 -18
  22. package/dist/components/Timeline.svelte +63 -5
  23. package/dist/components/Timeline.svelte.d.ts +2 -1
  24. package/dist/components/Toast.svelte +1 -1
  25. package/dist/components/content/DescriptionList.svelte +90 -64
  26. package/dist/components/content/DescriptionList.svelte.d.ts +5 -1
  27. package/dist/components/ui/avatar/avatar-variants.d.ts +3 -1
  28. package/dist/components/ui/avatar/avatar-variants.js +7 -1
  29. package/dist/components/ui/avatar/avatar.svelte +7 -4
  30. package/dist/components/ui/avatar/avatar.svelte.d.ts +3 -2
  31. package/dist/components/ui/avatar/index.d.ts +2 -2
  32. package/dist/components/ui/avatar/index.js +2 -2
  33. package/dist/components/ui/dialog/dialog-content.svelte +1 -1
  34. package/dist/components/ui/dialog/dialog-content.svelte.d.ts +1 -1
  35. package/dist/components/ui/input/input.svelte +6 -11
  36. package/dist/components/ui/textarea/textarea.svelte +21 -25
  37. package/dist/components.css +4 -1
  38. package/dist/icon-registry.d.ts +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/intent-preload.d.ts +1 -1
  41. package/dist/intent-preload.js +1 -1
  42. package/dist/notifications.svelte.d.ts +1 -0
  43. package/dist/notifications.svelte.js +2 -0
  44. package/package.json +4 -4
@@ -55,8 +55,8 @@
55
55
  }
56
56
  </script>
57
57
 
58
- <div class={cn('svadmin-slider flex flex-col w-full gap-1', className)} data-invalid={invalid ? 'true' : undefined}>
59
- <div class="flex items-center gap-2 w-full">
58
+ <div class={cn('svadmin-slider', className)} data-invalid={invalid ? 'true' : undefined}>
59
+ <div class="svadmin-slider__control">
60
60
  <input
61
61
  {id}
62
62
  {name}
@@ -76,13 +76,13 @@
76
76
  {#if showValue}<output for={id}>{normalizedValue}</output>{/if}
77
77
  </div>
78
78
  {#if marks && Object.keys(marks).length > 0}
79
- <div class="relative w-full h-5 text-[11px] text-muted-foreground select-none" data-slot="slider-marks">
79
+ <div data-slot="slider-marks">
80
80
  {#each Object.entries(marks) as [markVal, label] (markVal)}
81
81
  {@const valNum = Number(markVal)}
82
82
  {@const pct = boundsValid ? Math.min(100, Math.max(0, ((valNum - min) / (max - min)) * 100)) : 0}
83
83
  <button
84
84
  type="button"
85
- class="absolute -translate-x-1/2 cursor-pointer hover:text-foreground transition-colors border-0 bg-transparent p-0 font-inherit text-inherit"
85
+ class="svadmin-slider__mark"
86
86
  style={`left: ${pct}%;`}
87
87
  disabled={disabled}
88
88
  onclick={() => { if (!disabled) { value = valNum; onchange?.(valNum); } }}
@@ -96,6 +96,14 @@
96
96
 
97
97
  <style>
98
98
  .svadmin-slider {
99
+ display: flex;
100
+ flex-direction: column;
101
+ align-items: stretch;
102
+ gap: 4px;
103
+ inline-size: 100%;
104
+ }
105
+
106
+ .svadmin-slider__control {
99
107
  display: flex;
100
108
  align-items: center;
101
109
  gap: 8px;
@@ -63,7 +63,7 @@
63
63
  </p>
64
64
  {/if}
65
65
  {#if extra}
66
- <div class="svadmin-statistic__extra text-xs text-muted-foreground mt-2">
66
+ <div class="svadmin-statistic__extra">
67
67
  {#if typeof extra === 'string'}{extra}{:else}{@render extra()}{/if}
68
68
  </div>
69
69
  {/if}
@@ -78,6 +78,7 @@
78
78
  .svadmin-statistic__trend { display: flex; align-items: center; gap: var(--svadmin-space-1); margin: 0; color: var(--muted-foreground); font-size: var(--svadmin-text-caption); }
79
79
  .svadmin-statistic__trend[data-trend='up'] { color: var(--success, var(--primary)); }
80
80
  .svadmin-statistic__trend[data-trend='down'] { color: var(--destructive); }
81
+ .svadmin-statistic__extra { margin-top: 8px; color: var(--muted-foreground); font-size: var(--svadmin-text-body); }
81
82
  .svadmin-statistic__skeleton { width: 4.5rem; height: 1.5rem; border-radius: var(--radius-sm); background: var(--muted); animation: svadmin-statistic-pulse 1.4s ease-in-out infinite; }
82
83
  .svadmin-statistic__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
83
84
  @keyframes svadmin-statistic-pulse { 50% { opacity: 0.5; } }
@@ -16,6 +16,8 @@
16
16
  items: StepItem[];
17
17
  direction?: 'horizontal' | 'vertical';
18
18
  labelPlacement?: 'horizontal' | 'vertical';
19
+ type?: 'default' | 'dot';
20
+ size?: 'default' | 'small';
19
21
  status?: 'wait' | 'process' | 'finish' | 'error';
20
22
  clickable?: boolean;
21
23
  class?: string;
@@ -27,6 +29,8 @@
27
29
  items,
28
30
  direction = 'horizontal',
29
31
  labelPlacement = 'horizontal',
32
+ type = 'default',
33
+ size = 'default',
30
34
  status = 'process',
31
35
  clickable = false,
32
36
  class: className = '',
@@ -46,7 +50,14 @@
46
50
  }
47
51
  </script>
48
52
 
49
- <ol class={cn('svadmin-steps', className)} data-direction={direction} data-label-placement={labelPlacement} aria-label="Steps">
53
+ <ol
54
+ class={cn('svadmin-steps', className)}
55
+ data-direction={direction}
56
+ data-label-placement={labelPlacement}
57
+ data-type={type}
58
+ data-size={size}
59
+ aria-label="Steps"
60
+ >
50
61
  {#each items as item, index (item.id ?? `${item.title}-${index}`)}
51
62
  {@const stateValue = state(index)}
52
63
  <li class="svadmin-steps__item" data-status={stateValue} data-disabled={item.disabled || undefined}>
@@ -58,7 +69,17 @@
58
69
  aria-current={index === current ? 'step' : undefined}
59
70
  >
60
71
  <span class="svadmin-steps__indicator" aria-hidden="true">
61
- {#if stateValue === 'finish'}<Check size={14} />{:else if stateValue === 'error'}<X size={14} />{:else if item.icon}{@render item.icon()}{:else}{index + 1}{/if}
72
+ {#if type === 'dot'}
73
+ <span class="svadmin-steps__dot"></span>
74
+ {:else if stateValue === 'finish'}
75
+ <Check size={size === 'small' ? 12 : 14} />
76
+ {:else if stateValue === 'error'}
77
+ <X size={size === 'small' ? 12 : 14} />
78
+ {:else if item.icon}
79
+ {@render item.icon()}
80
+ {:else}
81
+ {index + 1}
82
+ {/if}
62
83
  </span>
63
84
  <span class="svadmin-steps__text">
64
85
  <span class="svadmin-steps__title">{item.title}</span>
@@ -151,6 +172,58 @@
151
172
  }
152
173
  .svadmin-steps[data-label-placement='vertical'] .svadmin-steps__action { flex-direction: column; }
153
174
  .svadmin-steps__item[data-disabled='true'] { opacity: 1; color: var(--svadmin-text-4); }
175
+
176
+ /* Small size adjustments */
177
+ .svadmin-steps[data-size='small'] .svadmin-steps__indicator {
178
+ width: 1.5rem;
179
+ height: 1.5rem;
180
+ font-size: 0.75rem;
181
+ }
182
+ .svadmin-steps[data-size='small'] .svadmin-steps__title {
183
+ font-size: var(--svadmin-text-body);
184
+ line-height: 1.5rem;
185
+ }
186
+ .svadmin-steps[data-size='small'] .svadmin-steps__connector {
187
+ margin-block-start: 0.75rem;
188
+ }
189
+ .svadmin-steps[data-size='small'][data-direction='vertical'] .svadmin-steps__connector {
190
+ margin: 0 0 0 0.75rem;
191
+ }
192
+
193
+ /* Dot type adjustments */
194
+ .svadmin-steps[data-type='dot'] .svadmin-steps__indicator {
195
+ width: 0.75rem;
196
+ height: 0.75rem;
197
+ margin-block-start: 0.375rem;
198
+ background: transparent;
199
+ border: 0;
200
+ }
201
+ .svadmin-steps[data-type='dot'] .svadmin-steps__dot {
202
+ width: 0.5rem;
203
+ height: 0.5rem;
204
+ border-radius: 999px;
205
+ background: var(--svadmin-fill-3, var(--muted));
206
+ transition: all 200ms cubic-bezier(0, 0, 0.2, 1);
207
+ }
208
+ .svadmin-steps[data-type='dot'] .svadmin-steps__item[data-status='process'] .svadmin-steps__dot {
209
+ width: 0.625rem;
210
+ height: 0.625rem;
211
+ background: var(--primary);
212
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
213
+ }
214
+ .svadmin-steps[data-type='dot'] .svadmin-steps__item[data-status='finish'] .svadmin-steps__dot {
215
+ background: var(--primary);
216
+ }
217
+ .svadmin-steps[data-type='dot'] .svadmin-steps__item[data-status='error'] .svadmin-steps__dot {
218
+ background: var(--destructive);
219
+ }
220
+ .svadmin-steps[data-type='dot'] .svadmin-steps__connector {
221
+ margin-block-start: 0.75rem;
222
+ }
223
+ .svadmin-steps[data-type='dot'][data-direction='vertical'] .svadmin-steps__connector {
224
+ margin: 0 0 0 0.375rem;
225
+ }
226
+
154
227
  @media (max-width: 40rem) {
155
228
  .svadmin-steps[data-direction='horizontal'] { flex-direction: column; }
156
229
  .svadmin-steps[data-direction='horizontal'] .svadmin-steps__connector { width: 1px; height: 1rem; margin-inline-start: 0.875rem; }
@@ -11,6 +11,8 @@ interface Props {
11
11
  items: StepItem[];
12
12
  direction?: 'horizontal' | 'vertical';
13
13
  labelPlacement?: 'horizontal' | 'vertical';
14
+ type?: 'default' | 'dot';
15
+ size?: 'default' | 'small';
14
16
  status?: 'wait' | 'process' | 'finish' | 'error';
15
17
  clickable?: boolean;
16
18
  class?: string;
@@ -1,18 +1,23 @@
1
1
  <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import X from '@lucide/svelte/icons/x';
4
- import { cn } from '../utils.js';
5
- import { badgeVariants, type BadgeVariant } from './ui/badge/index.js';
6
- import { useComponentConfig } from './ConfigProvider.svelte';
2
+ import type { Snippet } from "svelte";
3
+ import X from "@lucide/svelte/icons/x";
4
+ import { cn } from "../utils.js";
5
+ import { badgeVariants, type BadgeVariant } from "./ui/badge/index.js";
6
+ import { useComponentConfig } from "./ConfigProvider.svelte";
7
+
8
+ export type TagColor = "blue" | "green" | "orange" | "red" | "purple" | "cyan" | "gray" | string;
7
9
 
8
10
  interface Props {
9
11
  variant?: BadgeVariant;
10
- size?: 'default' | 'compact';
12
+ color?: TagColor;
13
+ size?: "default" | "compact";
14
+ bordered?: boolean;
11
15
  closable?: boolean;
12
16
  checkable?: boolean;
13
17
  checked?: boolean;
14
18
  disabled?: boolean;
15
19
  closeLabel?: string;
20
+ icon?: Snippet;
16
21
  class?: string;
17
22
  children?: Snippet;
18
23
  onclose?: (event: MouseEvent) => void;
@@ -20,13 +25,16 @@
20
25
  }
21
26
 
22
27
  let {
23
- variant = 'secondary',
28
+ variant = "secondary",
29
+ color,
24
30
  size: sizeProp,
31
+ bordered = true,
25
32
  closable = false,
26
33
  checkable = false,
27
34
  checked = false,
28
35
  disabled = false,
29
- closeLabel = 'Remove tag',
36
+ closeLabel = "Remove tag",
37
+ icon,
30
38
  class: className,
31
39
  children,
32
40
  onclose,
@@ -34,8 +42,24 @@
34
42
  }: Props = $props();
35
43
 
36
44
  const config = useComponentConfig();
37
- const size = $derived(sizeProp ?? (config.density === 'compact' || config.componentSize === 'sm' ? 'compact' : 'default'));
38
- const resolvedVariant = $derived(checkable && checked && variant === 'secondary' ? 'default' : variant);
45
+ const size = $derived(sizeProp ?? (config.density === "compact" || config.componentSize === "sm" ? "compact" : "default"));
46
+ const resolvedVariant = $derived(checkable && checked && variant === "secondary" ? "default" : variant);
47
+
48
+ const presetColorClasses: Record<string, string> = {
49
+ blue: "bg-primary/10 text-primary border-primary/20",
50
+ green: "bg-success/10 text-success border-success/20",
51
+ orange: "bg-warning/10 text-warning border-warning/20",
52
+ red: "bg-destructive/10 text-destructive border-destructive/20",
53
+ purple: "bg-accent text-accent-foreground border-border",
54
+ cyan: "bg-info/10 text-info border-info/20",
55
+ gray: "bg-muted text-muted-foreground border-border",
56
+ };
57
+
58
+ const isPresetColor = $derived(Boolean(color && presetColorClasses[color]));
59
+ const customColorStyle = $derived.by(() => {
60
+ if (!color || isPresetColor) return undefined;
61
+ return `background-color: color-mix(in srgb, ${color} 10%, transparent); color: ${color}; border-color: color-mix(in srgb, ${color} 25%, transparent);`;
62
+ });
39
63
 
40
64
  function handleCheck(): void {
41
65
  if (disabled) return;
@@ -49,12 +73,26 @@
49
73
  </script>
50
74
 
51
75
  <span
52
- class={cn(badgeVariants({ variant: resolvedVariant }), 'svadmin-tag', className)}
76
+ class={cn(
77
+ !color && badgeVariants({ variant: resolvedVariant }),
78
+ color && isPresetColor && presetColorClasses[color],
79
+ color && !isPresetColor && "border",
80
+ !bordered && "border-transparent",
81
+ "svadmin-tag inline-flex items-center",
82
+ className
83
+ )}
84
+ style={customColorStyle}
53
85
  class:is-disabled={disabled}
54
86
  data-slot="tag"
55
87
  data-size={size}
88
+ data-color={color}
56
89
  data-checked={checkable ? String(checked) : undefined}
57
90
  >
91
+ {#if icon}
92
+ <span class="svadmin-tag__icon shrink-0 mr-1 flex items-center" aria-hidden="true">
93
+ {@render icon()}
94
+ </span>
95
+ {/if}
58
96
  {#if checkable}
59
97
  <button
60
98
  type="button"
@@ -83,7 +121,7 @@
83
121
 
84
122
  <style>
85
123
  .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; }
124
+ .svadmin-tag[data-size="compact"] { min-height: 20px; }
87
125
  .svadmin-tag.is-disabled { opacity: 1; color: var(--svadmin-text-4); }
88
126
  .svadmin-tag__label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
89
127
  .svadmin-tag__control,
@@ -1,13 +1,17 @@
1
- import type { Snippet } from 'svelte';
2
- import { type BadgeVariant } from './ui/badge/index.js';
1
+ import type { Snippet } from "svelte";
2
+ import { type BadgeVariant } from "./ui/badge/index.js";
3
+ export type TagColor = "blue" | "green" | "orange" | "red" | "purple" | "cyan" | "gray" | string;
3
4
  interface Props {
4
5
  variant?: BadgeVariant;
5
- size?: 'default' | 'compact';
6
+ color?: TagColor;
7
+ size?: "default" | "compact";
8
+ bordered?: boolean;
6
9
  closable?: boolean;
7
10
  checkable?: boolean;
8
11
  checked?: boolean;
9
12
  disabled?: boolean;
10
13
  closeLabel?: string;
14
+ icon?: Snippet;
11
15
  class?: string;
12
16
  children?: Snippet;
13
17
  onclose?: (event: MouseEvent) => void;
@@ -101,7 +101,7 @@
101
101
  disabled={disabled}
102
102
  onclick={() => remove(index)}
103
103
  >
104
- <X size={14} aria-hidden="true" />
104
+ <X size={12} aria-hidden="true" />
105
105
  </button>
106
106
  </span>
107
107
  {/each}
@@ -130,7 +130,7 @@
130
130
  aria-label="Clear all tags"
131
131
  onclick={clearAll}
132
132
  >
133
- <CircleX size={14} aria-hidden="true" />
133
+ <CircleX size={12} aria-hidden="true" />
134
134
  </button>
135
135
  {/if}
136
136
  </div>
@@ -141,11 +141,14 @@
141
141
  flex-wrap: wrap;
142
142
  align-items: center;
143
143
  gap: 4px;
144
- min-block-size: 36px;
145
- padding: 4px 8px;
144
+ box-sizing: border-box;
145
+ min-block-size: var(--svadmin-control-h);
146
+ padding: 1px 4px;
146
147
  border: 1px solid var(--border);
147
- border-radius: 6px;
148
- background: var(--background);
148
+ border-radius: var(--border-radius-small, 2px);
149
+ background: var(--card);
150
+ color: var(--foreground);
151
+ font-size: var(--svadmin-text-body);
149
152
  }
150
153
 
151
154
  .svadmin-tags-input:focus-within {
@@ -161,12 +164,18 @@
161
164
  display: inline-flex;
162
165
  align-items: center;
163
166
  gap: 4px;
167
+ box-sizing: border-box;
164
168
  max-inline-size: 100%;
165
- padding: 2px 4px 2px 8px;
166
- border: 1px solid var(--border);
167
- border-radius: 4px;
168
- background: var(--muted);
169
+ height: 24px;
170
+ padding: 0 4px 0 8px;
171
+ border: 1px solid transparent;
172
+ border-radius: var(--border-radius-small, 2px);
173
+ background: var(--svadmin-fill-2, var(--muted));
169
174
  color: var(--foreground);
175
+ font-size: var(--svadmin-text-caption);
176
+ font-weight: 500;
177
+ /* 12px 字号下的官方 22px 行高,避免组件样式里写裸像素字号。 */
178
+ line-height: calc(22 / 12);
170
179
  }
171
180
 
172
181
  .svadmin-tags-input__tag span {
@@ -176,10 +185,13 @@
176
185
  .svadmin-tags-input__tag button {
177
186
  display: inline-grid;
178
187
  place-items: center;
179
- min-block-size: 24px;
180
- min-inline-size: 24px;
188
+ width: 16px;
189
+ height: 16px;
190
+ min-block-size: 16px;
191
+ min-inline-size: 16px;
192
+ padding: 0;
181
193
  border: 0;
182
- border-radius: 4px;
194
+ border-radius: var(--border-radius-small, 2px);
183
195
  background: transparent;
184
196
  color: var(--muted-foreground);
185
197
  cursor: pointer;
@@ -192,14 +204,19 @@
192
204
  }
193
205
 
194
206
  .svadmin-tags-input__clear {
195
- display: inline-grid;
207
+ display: none;
196
208
  place-items: center;
197
209
  border: 0;
198
210
  background: transparent;
199
- color: var(--muted-foreground);
211
+ color: var(--color-text-2, var(--muted-foreground));
212
+ font-size: var(--svadmin-text-caption);
213
+ line-height: 1;
200
214
  cursor: pointer;
201
- padding: 2px;
202
- border-radius: 999px;
215
+ padding: 0;
216
+ }
217
+ .svadmin-tags-input:hover .svadmin-tags-input__clear,
218
+ .svadmin-tags-input:focus-within .svadmin-tags-input__clear {
219
+ display: inline-grid;
203
220
  }
204
221
  .svadmin-tags-input__clear:hover {
205
222
  color: var(--foreground);
@@ -213,7 +230,7 @@
213
230
  .svadmin-tags-input input {
214
231
  min-inline-size: 8rem;
215
232
  flex: 1 1 8rem;
216
- min-block-size: 28px;
233
+ min-block-size: 24px;
217
234
  border: 0;
218
235
  outline: 0;
219
236
  background: transparent;
@@ -14,19 +14,36 @@
14
14
 
15
15
  interface Props {
16
16
  items: TimelineEntry[];
17
- mode?: 'vertical' | 'horizontal';
17
+ mode?: 'vertical' | 'horizontal' | 'alternate';
18
+ reverse?: boolean;
18
19
  label?: string;
19
20
  class?: string;
20
21
  dot?: Snippet<[TimelineEntry]>;
21
22
  children?: Snippet<[TimelineEntry]>;
22
23
  }
23
24
 
24
- let { items, mode = 'vertical', label = 'Timeline', class: className = '', dot, children }: Props = $props();
25
+ let {
26
+ items,
27
+ mode = 'vertical',
28
+ reverse = false,
29
+ label = 'Timeline',
30
+ class: className = '',
31
+ dot,
32
+ children,
33
+ }: Props = $props();
34
+
35
+ const displayItems = $derived(reverse ? [...items].reverse() : items);
25
36
  </script>
26
37
 
27
38
  <ol class={cn('svadmin-timeline', className)} data-mode={mode} aria-label={label}>
28
- {#each items as item (item.id)}
29
- <li class="svadmin-timeline__item" data-tone={item.tone ?? 'neutral'} data-active={item.active ? 'true' : undefined}>
39
+ {#each displayItems as item, index (item.id)}
40
+ {@const side = mode === 'alternate' ? (index % 2 === 0 ? 'left' : 'right') : undefined}
41
+ <li
42
+ class="svadmin-timeline__item"
43
+ data-tone={item.tone ?? 'neutral'}
44
+ data-active={item.active ? 'true' : undefined}
45
+ data-side={side}
46
+ >
30
47
  {#if item.dot}
31
48
  <span class="svadmin-timeline__custom-dot" aria-hidden="true">{@render item.dot()}</span>
32
49
  {:else if dot}
@@ -64,7 +81,7 @@
64
81
  color: var(--foreground);
65
82
  font-size: var(--svadmin-text-body);
66
83
  }
67
- .svadmin-timeline__item:not(:last-child)::before {
84
+ .svadmin-timeline:not([data-mode='alternate']) .svadmin-timeline__item:not(:last-child)::before {
68
85
  position: absolute;
69
86
  inset-block: 1rem calc(-1 * var(--svadmin-space-4));
70
87
  inset-inline-start: 0.3125rem;
@@ -99,4 +116,45 @@
99
116
  width: auto;
100
117
  height: 1px;
101
118
  }
119
+
120
+ /* Alternate mode */
121
+ .svadmin-timeline[data-mode='alternate'] {
122
+ position: relative;
123
+ display: block;
124
+ width: 100%;
125
+ }
126
+ .svadmin-timeline[data-mode='alternate']::before {
127
+ position: absolute;
128
+ inset-block: 0.5rem 1rem;
129
+ left: 50%;
130
+ transform: translateX(-50%);
131
+ width: 1px;
132
+ background: var(--border);
133
+ content: '';
134
+ }
135
+ .svadmin-timeline[data-mode='alternate'] .svadmin-timeline__item {
136
+ display: flex;
137
+ box-sizing: border-box;
138
+ width: 50%;
139
+ min-height: 70px;
140
+ }
141
+ .svadmin-timeline[data-mode='alternate'] .svadmin-timeline__item[data-side='left'] {
142
+ margin-right: auto;
143
+ flex-direction: row-reverse;
144
+ text-align: right;
145
+ padding-right: var(--svadmin-space-4);
146
+ }
147
+ .svadmin-timeline[data-mode='alternate'] .svadmin-timeline__item[data-side='left'] .svadmin-timeline__marker,
148
+ .svadmin-timeline[data-mode='alternate'] .svadmin-timeline__item[data-side='left'] .svadmin-timeline__custom-dot {
149
+ transform: translateX(calc(var(--svadmin-space-4) + 0.34375rem));
150
+ }
151
+ .svadmin-timeline[data-mode='alternate'] .svadmin-timeline__item[data-side='right'] {
152
+ margin-left: 50%;
153
+ text-align: left;
154
+ padding-left: var(--svadmin-space-4);
155
+ }
156
+ .svadmin-timeline[data-mode='alternate'] .svadmin-timeline__item[data-side='right'] .svadmin-timeline__marker,
157
+ .svadmin-timeline[data-mode='alternate'] .svadmin-timeline__item[data-side='right'] .svadmin-timeline__custom-dot {
158
+ transform: translateX(calc(-1 * (var(--svadmin-space-4) + 0.34375rem)));
159
+ }
102
160
  </style>
@@ -10,7 +10,8 @@ export interface TimelineEntry {
10
10
  }
11
11
  interface Props {
12
12
  items: TimelineEntry[];
13
- mode?: 'vertical' | 'horizontal';
13
+ mode?: 'vertical' | 'horizontal' | 'alternate';
14
+ reverse?: boolean;
14
15
  label?: string;
15
16
  class?: string;
16
17
  dot?: Snippet<[TimelineEntry]>;
@@ -21,7 +21,7 @@
21
21
  const isActiveHost = $derived(host?.isActive() ?? false);
22
22
  const theme = $derived(getResolvedTheme() === 'dark' ? 'dark' : 'light');
23
23
  // 默认仍是 top-right,抽屉打开时改到 bottom-left,避开底部居中的撤销条。
24
- // 显式 placement 才用 Arco 的顶部 / 底部居中。
24
+ // 显式 placement 才用顶部 / 底部居中。
25
25
  const toastPosition = $derived<'top-right' | 'bottom-left' | 'top-center' | 'bottom-center'>(
26
26
  placement === 'top' ? 'top-center' : placement === 'bottom' ? 'bottom-center' : sheetOpen ? 'bottom-left' : 'top-right',
27
27
  );