@svadmin/ui 0.23.0 → 0.23.2
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/package.json +7 -8
- package/src/components/Toast.svelte +27 -2
- package/src/index.ts +1 -1
- package/src/components/ui/drawer/drawer-content.svelte +0 -21
- package/src/components/ui/drawer/drawer-description.svelte +0 -11
- package/src/components/ui/drawer/drawer-footer.svelte +0 -11
- package/src/components/ui/drawer/drawer-header.svelte +0 -11
- package/src/components/ui/drawer/drawer-title.svelte +0 -11
- package/src/components/ui/drawer/drawer.svelte +0 -18
- package/src/components/ui/drawer/index.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -20,17 +20,13 @@
|
|
|
20
20
|
"./components/*": "./src/components/*"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@svadmin/core": "^0.
|
|
23
|
+
"@svadmin/core": "^0.19.3",
|
|
24
24
|
"@tanstack/svelte-query": "^6.0.0",
|
|
25
|
-
"bits-ui": "^2.0.0",
|
|
26
|
-
"clsx": "^2.0.0",
|
|
27
25
|
"highlight.js": "^11.0.0",
|
|
28
26
|
"isomorphic-dompurify": "^2.0.0",
|
|
29
27
|
"marked": "^15.0.0",
|
|
30
28
|
"marked-highlight": "^2.2.0",
|
|
31
|
-
"svelte": "^5.0.0"
|
|
32
|
-
"tailwind-merge": "^3.0.0",
|
|
33
|
-
"tailwind-variants": "^3.0.0"
|
|
29
|
+
"svelte": "^5.0.0"
|
|
34
30
|
},
|
|
35
31
|
"peerDependenciesMeta": {
|
|
36
32
|
"marked": {
|
|
@@ -52,10 +48,13 @@
|
|
|
52
48
|
"dependencies": {
|
|
53
49
|
"@lucide/svelte": "^0.577.0",
|
|
54
50
|
"@tanstack/svelte-table": "^9.0.0-alpha.10",
|
|
51
|
+
"bits-ui": "^2.0.0",
|
|
52
|
+
"clsx": "^2.0.0",
|
|
55
53
|
"cmdk-sv": "^0.0.19",
|
|
56
54
|
"lucide-svelte": "^0.577.0",
|
|
57
55
|
"sonner-svelte": "^0.3.3",
|
|
58
|
-
"
|
|
56
|
+
"tailwind-merge": "^3.0.0",
|
|
57
|
+
"tailwind-variants": "^3.0.0"
|
|
59
58
|
},
|
|
60
59
|
"license": "MIT",
|
|
61
60
|
"author": "zuohuadong",
|
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Toaster } from 'sonner-svelte';
|
|
3
|
-
import { getResolvedTheme } from '@svadmin/core';
|
|
2
|
+
import { Toaster, toast as sonner } from 'sonner-svelte';
|
|
3
|
+
import { getResolvedTheme, getToastQueue, consumeToastQueue, getPromiseQueue, consumePromiseQueue } from '@svadmin/core';
|
|
4
4
|
|
|
5
5
|
const theme = $derived(getResolvedTheme() === 'dark' ? 'dark' : 'light');
|
|
6
|
+
|
|
7
|
+
$effect(() => {
|
|
8
|
+
const queue = getToastQueue();
|
|
9
|
+
if (queue.length > 0) {
|
|
10
|
+
for (const t of queue) {
|
|
11
|
+
switch (t.type) {
|
|
12
|
+
case 'success': sonner.success(t.message, { duration: t.duration }); break;
|
|
13
|
+
case 'error': sonner.error(t.message, { duration: t.duration }); break;
|
|
14
|
+
case 'warning': sonner.warning(t.message, { duration: t.duration }); break;
|
|
15
|
+
case 'info': sonner.info(t.message, { duration: t.duration }); break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
consumeToastQueue();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
$effect(() => {
|
|
23
|
+
const pQueue = getPromiseQueue();
|
|
24
|
+
if (pQueue.length > 0) {
|
|
25
|
+
for (const p of pQueue) {
|
|
26
|
+
sonner.promise(p.promise, p.opts);
|
|
27
|
+
}
|
|
28
|
+
consumePromiseQueue();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
6
31
|
</script>
|
|
7
32
|
|
|
8
33
|
<Toaster
|
package/src/index.ts
CHANGED
|
@@ -130,7 +130,7 @@ export * as DropdownMenu from './components/ui/dropdown-menu/index.js';
|
|
|
130
130
|
export * as Breadcrumb from './components/ui/breadcrumb/index.js';
|
|
131
131
|
export * as Pagination from './components/ui/pagination/index.js';
|
|
132
132
|
export * as ContextMenu from './components/ui/context-menu/index.js';
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
export * as Collapsible from './components/ui/collapsible/index.js';
|
|
135
135
|
export { Label } from './components/ui/label/index.js';
|
|
136
136
|
export { Command } from './components/ui/command/index.js';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer as DrawerPrimitive } from 'vaul-svelte';
|
|
3
|
-
import { cn } from '../../../utils.js';
|
|
4
|
-
import type { Snippet } from 'svelte';
|
|
5
|
-
|
|
6
|
-
let { class: className, children, ...restProps }: { class?: string; children?: Snippet; [key: string]: unknown } = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<DrawerPrimitive.Portal>
|
|
10
|
-
<DrawerPrimitive.Overlay class="fixed inset-0 z-50 bg-black/80" />
|
|
11
|
-
<DrawerPrimitive.Content
|
|
12
|
-
class={cn(
|
|
13
|
-
"bg-background fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...restProps}
|
|
17
|
-
>
|
|
18
|
-
<div class="bg-muted mx-auto mt-4 h-2 w-[100px] rounded-full"></div>
|
|
19
|
-
{@render children?.()}
|
|
20
|
-
</DrawerPrimitive.Content>
|
|
21
|
-
</DrawerPrimitive.Portal>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer as DrawerPrimitive } from 'vaul-svelte';
|
|
3
|
-
import { cn } from '../../../utils.js';
|
|
4
|
-
import type { Snippet } from 'svelte';
|
|
5
|
-
|
|
6
|
-
let { class: className, children, ...restProps }: { class?: string; children?: Snippet; [key: string]: unknown } = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<DrawerPrimitive.Description class={cn("text-muted-foreground text-sm", className)} {...restProps}>
|
|
10
|
-
{@render children?.()}
|
|
11
|
-
</DrawerPrimitive.Description>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn } from '../../../utils.js';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
-
|
|
6
|
-
let { class: className, children, ...restProps }: HTMLAttributes<HTMLDivElement> & { children?: Snippet } = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<div data-slot="drawer-footer" class={cn("mt-auto flex flex-col gap-2 p-4", className)} {...restProps}>
|
|
10
|
-
{@render children?.()}
|
|
11
|
-
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn } from '../../../utils.js';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
-
|
|
6
|
-
let { class: className, children, ...restProps }: HTMLAttributes<HTMLDivElement> & { children?: Snippet } = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<div data-slot="drawer-header" class={cn("grid gap-1.5 p-4 text-center sm:text-left", className)} {...restProps}>
|
|
10
|
-
{@render children?.()}
|
|
11
|
-
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer as DrawerPrimitive } from 'vaul-svelte';
|
|
3
|
-
import { cn } from '../../../utils.js';
|
|
4
|
-
import type { Snippet } from 'svelte';
|
|
5
|
-
|
|
6
|
-
let { class: className, children, ...restProps }: { class?: string; children?: Snippet; [key: string]: unknown } = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<DrawerPrimitive.Title class={cn("text-lg font-semibold leading-none tracking-tight", className)} {...restProps}>
|
|
10
|
-
{@render children?.()}
|
|
11
|
-
</DrawerPrimitive.Title>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer as DrawerPrimitive } from 'vaul-svelte';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
open = $bindable(false),
|
|
7
|
-
children,
|
|
8
|
-
...restProps
|
|
9
|
-
}: {
|
|
10
|
-
open?: boolean;
|
|
11
|
-
children?: Snippet;
|
|
12
|
-
[key: string]: unknown;
|
|
13
|
-
} = $props();
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<DrawerPrimitive.Root bind:open {...restProps}>
|
|
17
|
-
{@render children?.()}
|
|
18
|
-
</DrawerPrimitive.Root>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as Root } from './drawer.svelte';
|
|
2
|
-
export { default as Content } from './drawer-content.svelte';
|
|
3
|
-
export { default as Header } from './drawer-header.svelte';
|
|
4
|
-
export { default as Footer } from './drawer-footer.svelte';
|
|
5
|
-
export { default as Title } from './drawer-title.svelte';
|
|
6
|
-
export { default as Description } from './drawer-description.svelte';
|