@svadmin/ui 0.135.0 → 0.136.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 +6 -3
- package/dist/app.theme.css +6 -3
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/Calendar.svelte +121 -26
- package/dist/components/Calendar.svelte.d.ts +1 -0
- package/dist/components/Collapse.svelte +28 -0
- package/dist/components/Collapse.svelte.d.ts +2 -0
- package/dist/components/DatePicker.svelte +96 -13
- package/dist/components/DrawerForm.svelte +4 -1
- package/dist/components/DrawerForm.svelte.d.ts +1 -0
- package/dist/components/Image.svelte +84 -28
- package/dist/components/Image.svelte.d.ts +2 -0
- package/dist/components/InputGroup.svelte +7 -3
- package/dist/components/InputGroup.svelte.d.ts +1 -0
- package/dist/components/Menu.svelte +36 -2
- package/dist/components/Menu.svelte.d.ts +2 -0
- package/dist/components/ModalForm.svelte +4 -1
- package/dist/components/ModalForm.svelte.d.ts +1 -0
- package/dist/components/QRCode.svelte +112 -7
- package/dist/components/QRCode.svelte.d.ts +9 -0
- package/dist/components/component-messages.d.ts +20 -0
- package/dist/components/component-messages.js +5 -0
- package/dist/components/ui/alert/alert.svelte +12 -1
- package/dist/components/ui/alert/alert.svelte.d.ts +2 -0
- package/dist/components/ui/alert/index.d.ts +2 -2
- package/dist/components/ui/badge/badge.svelte +5 -1
- package/dist/components/ui/badge/badge.svelte.d.ts +1 -0
- package/dist/components/ui/card/card.svelte +35 -1
- package/dist/components/ui/card/card.svelte.d.ts +3 -0
- package/dist/components/ui/skeleton/index.d.ts +1 -2
- package/dist/components/ui/skeleton/index.js +1 -2
- package/dist/components/ui/skeleton/skeleton.svelte +18 -6
- package/dist/components/ui/skeleton/skeleton.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-context.d.svelte.ts +1 -0
- package/dist/components/ui/tabs/tabs-context.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-list.svelte +14 -2
- package/dist/components/ui/tabs/tabs.svelte +17 -1
- package/dist/components/ui/tabs/tabs.svelte.d.ts +4 -0
- package/dist/components.css +3 -0
- package/dist/index.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
2
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
4
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
5
|
import { Skeleton } from "../skeleton/index.js";
|
|
6
|
+
import CardHeader from "./card-header.svelte";
|
|
7
|
+
import CardTitle from "./card-title.svelte";
|
|
8
|
+
import CardAction from "./card-action.svelte";
|
|
9
|
+
import CardContent from "./card-content.svelte";
|
|
5
10
|
|
|
6
11
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
7
12
|
size?: "default" | "sm";
|
|
8
13
|
hoverable?: boolean;
|
|
9
14
|
bordered?: boolean;
|
|
10
15
|
loading?: boolean;
|
|
16
|
+
title?: string | Snippet;
|
|
17
|
+
extra?: Snippet;
|
|
11
18
|
};
|
|
12
19
|
|
|
13
20
|
let {
|
|
@@ -18,6 +25,8 @@
|
|
|
18
25
|
hoverable = false,
|
|
19
26
|
bordered = true,
|
|
20
27
|
loading = false,
|
|
28
|
+
title,
|
|
29
|
+
extra,
|
|
21
30
|
...restProps
|
|
22
31
|
}: Props = $props();
|
|
23
32
|
</script>
|
|
@@ -43,6 +52,31 @@
|
|
|
43
52
|
<Skeleton class="h-16 w-full mt-2" />
|
|
44
53
|
</div>
|
|
45
54
|
{:else}
|
|
46
|
-
{
|
|
55
|
+
{#if title || extra}
|
|
56
|
+
<CardHeader class="flex flex-row items-center justify-between pb-2">
|
|
57
|
+
{#if title}
|
|
58
|
+
<CardTitle>
|
|
59
|
+
{#if typeof title === "string"}
|
|
60
|
+
{title}
|
|
61
|
+
{:else}
|
|
62
|
+
<!-- string | Snippet 的联合在模板里无法自动收窄,这里显式断言。 -->
|
|
63
|
+
{@render (title as Snippet)()}
|
|
64
|
+
{/if}
|
|
65
|
+
</CardTitle>
|
|
66
|
+
{/if}
|
|
67
|
+
{#if extra}
|
|
68
|
+
<CardAction>
|
|
69
|
+
{@render extra()}
|
|
70
|
+
</CardAction>
|
|
71
|
+
{/if}
|
|
72
|
+
</CardHeader>
|
|
73
|
+
{/if}
|
|
74
|
+
{#if title || extra}
|
|
75
|
+
<CardContent>
|
|
76
|
+
{@render children?.()}
|
|
77
|
+
</CardContent>
|
|
78
|
+
{:else}
|
|
79
|
+
{@render children?.()}
|
|
80
|
+
{/if}
|
|
47
81
|
{/if}
|
|
48
82
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
1
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
2
3
|
import { type WithElementRef } from "../../../utils.js";
|
|
3
4
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
@@ -5,6 +6,8 @@ type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
|
5
6
|
hoverable?: boolean;
|
|
6
7
|
bordered?: boolean;
|
|
7
8
|
loading?: boolean;
|
|
9
|
+
title?: string | Snippet;
|
|
10
|
+
extra?: Snippet;
|
|
8
11
|
};
|
|
9
12
|
declare const Card: import("svelte").Component<Props, {}, "ref">;
|
|
10
13
|
type Card = ReturnType<typeof Card>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Root, Root as Skeleton };
|
|
1
|
+
export { default as Root, default as Skeleton } from "./skeleton.svelte";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Root, Root as Skeleton };
|
|
1
|
+
export { default as Root, default as Skeleton } from "./skeleton.svelte";
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
2
3
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
4
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
5
|
|
|
5
6
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
6
7
|
class?: string;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
animation?: boolean;
|
|
10
|
+
children?: Snippet;
|
|
7
11
|
};
|
|
8
12
|
|
|
9
13
|
let {
|
|
10
14
|
ref = $bindable(null),
|
|
11
15
|
class: className,
|
|
16
|
+
loading = true,
|
|
17
|
+
animation = true,
|
|
18
|
+
children,
|
|
12
19
|
...restProps
|
|
13
20
|
}: Props = $props();
|
|
14
21
|
</script>
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
{#if !loading && children}
|
|
24
|
+
{@render children()}
|
|
25
|
+
{:else}
|
|
26
|
+
<div
|
|
27
|
+
bind:this={ref}
|
|
28
|
+
data-slot="skeleton"
|
|
29
|
+
data-animation={animation}
|
|
30
|
+
class={cn("svadmin-skeleton", !animation && "animate-none", className)}
|
|
31
|
+
{...restProps}
|
|
32
|
+
></div>
|
|
33
|
+
{/if}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
1
2
|
import { type WithElementRef } from "../../../utils.js";
|
|
2
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
4
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
5
|
class?: string;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
animation?: boolean;
|
|
8
|
+
children?: Snippet;
|
|
5
9
|
};
|
|
6
10
|
declare const Skeleton: import("svelte").Component<Props, {}, "ref">;
|
|
7
11
|
type Skeleton = ReturnType<typeof Skeleton>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tabs-context.svelte.js';
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export type TabsVariant = "default" | "line" | "card";
|
|
2
|
+
export type TabsOrientation = "horizontal" | "vertical";
|
|
1
3
|
export interface TabsContextValue {
|
|
2
4
|
readonly value: string;
|
|
5
|
+
readonly variant?: TabsVariant | undefined;
|
|
6
|
+
readonly orientation?: TabsOrientation | undefined;
|
|
3
7
|
select: (value: string) => void;
|
|
4
8
|
}
|
|
5
9
|
export declare const getTabsContext: () => TabsContextValue, setTabsContext: (context: TabsContextValue) => TabsContextValue;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { getTabsContext } from "./tabs-context.svelte.js";
|
|
4
5
|
|
|
5
6
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
6
7
|
variant?: "default" | "line" | "card";
|
|
@@ -10,13 +11,24 @@
|
|
|
10
11
|
|
|
11
12
|
let {
|
|
12
13
|
ref = $bindable(null),
|
|
13
|
-
variant
|
|
14
|
-
orientation
|
|
14
|
+
variant: variantProp,
|
|
15
|
+
orientation: orientationProp,
|
|
15
16
|
scrollable = false,
|
|
16
17
|
class: className,
|
|
17
18
|
children,
|
|
18
19
|
...restProps
|
|
19
20
|
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
let tabs = $derived.by(() => {
|
|
23
|
+
try {
|
|
24
|
+
return getTabsContext();
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const variant = $derived(variantProp ?? tabs?.variant ?? "default");
|
|
31
|
+
const orientation = $derived(orientationProp ?? tabs?.orientation ?? "horizontal");
|
|
20
32
|
</script>
|
|
21
33
|
|
|
22
34
|
<div
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
import { setTabsContext } from "./tabs-context.svelte.js";
|
|
4
|
+
import { setTabsContext, type TabsVariant, type TabsOrientation } from "./tabs-context.svelte.js";
|
|
5
5
|
|
|
6
6
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
7
7
|
value?: string;
|
|
8
|
+
type?: TabsVariant;
|
|
9
|
+
variant?: TabsVariant;
|
|
10
|
+
orientation?: TabsOrientation;
|
|
8
11
|
onValueChange?: (value: string) => void;
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
let {
|
|
12
15
|
ref = $bindable(null),
|
|
13
16
|
value = $bindable(""),
|
|
17
|
+
type,
|
|
18
|
+
variant: variantProp,
|
|
19
|
+
orientation = "horizontal",
|
|
14
20
|
onValueChange,
|
|
15
21
|
class: className,
|
|
16
22
|
children,
|
|
17
23
|
...restProps
|
|
18
24
|
}: Props = $props();
|
|
19
25
|
|
|
26
|
+
const resolvedVariant = $derived(type ?? variantProp ?? "default");
|
|
27
|
+
|
|
20
28
|
setTabsContext({
|
|
21
29
|
get value() {
|
|
22
30
|
return value;
|
|
23
31
|
},
|
|
32
|
+
get variant() {
|
|
33
|
+
return resolvedVariant;
|
|
34
|
+
},
|
|
35
|
+
get orientation() {
|
|
36
|
+
return orientation;
|
|
37
|
+
},
|
|
24
38
|
select(nextValue) {
|
|
25
39
|
if (nextValue === value) return;
|
|
26
40
|
value = nextValue;
|
|
@@ -32,6 +46,8 @@
|
|
|
32
46
|
<div
|
|
33
47
|
bind:this={ref}
|
|
34
48
|
data-slot="tabs"
|
|
49
|
+
data-variant={resolvedVariant}
|
|
50
|
+
data-orientation={orientation}
|
|
35
51
|
class={cn("svadmin-tabs", className)}
|
|
36
52
|
{...restProps}
|
|
37
53
|
>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type WithElementRef } from "../../../utils.js";
|
|
2
2
|
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { type TabsVariant, type TabsOrientation } from "./tabs-context.svelte.js";
|
|
3
4
|
type Props = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
5
|
value?: string;
|
|
6
|
+
type?: TabsVariant;
|
|
7
|
+
variant?: TabsVariant;
|
|
8
|
+
orientation?: TabsOrientation;
|
|
5
9
|
onValueChange?: (value: string) => void;
|
|
6
10
|
};
|
|
7
11
|
declare const Tabs: import("svelte").Component<Props, {}, "value" | "ref">;
|
package/dist/components.css
CHANGED
|
@@ -1098,6 +1098,9 @@ main {
|
|
|
1098
1098
|
background: var(--muted);
|
|
1099
1099
|
animation: svadmin-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
1100
1100
|
}
|
|
1101
|
+
.svadmin-skeleton[data-animation="false"] {
|
|
1102
|
+
animation: none;
|
|
1103
|
+
}
|
|
1101
1104
|
@keyframes svadmin-pulse {
|
|
1102
1105
|
50% {
|
|
1103
1106
|
opacity: 0.5;
|
package/dist/index.d.ts
CHANGED
|
@@ -473,7 +473,7 @@ export { default as Calendar } from './components/Calendar.svelte';
|
|
|
473
473
|
export type { CalendarEvent } from './components/Calendar.svelte';
|
|
474
474
|
export { default as Carousel } from './components/Carousel.svelte';
|
|
475
475
|
export { default as ImagePreview } from './components/ImagePreview.svelte';
|
|
476
|
-
export { default as QRCode } from './components/QRCode.svelte';
|
|
476
|
+
export { default as QRCode, type QRCodeStatus } from './components/QRCode.svelte';
|
|
477
477
|
export type { PreviewImage } from './components/ImagePreview.svelte';
|
|
478
478
|
export { default as Anchor } from './components/Anchor.svelte';
|
|
479
479
|
export type { AnchorItem } from './components/Anchor.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.136.0",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@codemirror/lang-json": "^6.0.0",
|
|
89
89
|
"@codemirror/lang-markdown": "^6.0.0",
|
|
90
90
|
"@codemirror/lang-sql": "^6.0.0",
|
|
91
|
-
"@svadmin/core": "^0.84.
|
|
91
|
+
"@svadmin/core": "^0.84.2",
|
|
92
92
|
"@tanstack/svelte-query": "^6.1.48",
|
|
93
93
|
"codemirror": "^6.0.0",
|
|
94
94
|
"dashjs": "^5.3.0",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@svadmin/devtools": "^0.6.
|
|
154
|
+
"@svadmin/devtools": "^0.6.17",
|
|
155
155
|
"@svadmin/devtools-contract": "^0.3.3",
|
|
156
156
|
"@vibeunion/devtools-devframe": "^0.1.2",
|
|
157
157
|
"typebox": "^1.4.6",
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
"@codemirror/lang-markdown": "^6.5.2",
|
|
191
191
|
"@codemirror/lang-sql": "^6.10.0",
|
|
192
192
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
193
|
-
"@svadmin/ai-elements": "^0.15.
|
|
193
|
+
"@svadmin/ai-elements": "^0.15.5",
|
|
194
194
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
195
195
|
"@tailwindcss/cli": "4.3.5",
|
|
196
196
|
"@testing-library/dom": "^10.4.2",
|