@svadmin/ui 0.26.1 → 0.26.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ui",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -49,15 +49,15 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@lucide/svelte": "^0.577.0",
52
+ "@lucide/svelte": "^1.7.0",
53
53
  "@tanstack/svelte-table": "^9.0.0-alpha.10",
54
- "bits-ui": "^2.0.0",
55
- "clsx": "^2.0.0",
54
+ "bits-ui": "^2.16.5",
55
+ "clsx": "^2.1.1",
56
56
  "cmdk-sv": "^0.0.19",
57
- "lucide-svelte": "^0.577.0",
57
+ "lucide-svelte": "^1.0.1",
58
58
  "sonner-svelte": "^0.3.3",
59
- "tailwind-merge": "^3.0.0",
60
- "tailwind-variants": "^3.0.0"
59
+ "tailwind-merge": "^3.5.0",
60
+ "tailwind-variants": "^3.2.2"
61
61
  },
62
62
  "license": "MIT",
63
63
  "author": "zuohuadong",
@@ -63,7 +63,7 @@
63
63
  <AutoTable
64
64
  {resourceName}
65
65
  {selectable}
66
- {cellRenderer}
66
+ defaultCellRenderer={cellRenderer}
67
67
  {rowActions}
68
68
  {emptyState}
69
69
  {expandedRowRender}
@@ -13,6 +13,7 @@
13
13
 
14
14
  // Only safely import css if hljs exists
15
15
  if (hljsModule && Object.keys(hljsModule).length > 0) {
16
+ // @ts-ignore
16
17
  import("highlight.js/styles/github-dark.css").catch(() => {});
17
18
  }
18
19
 
@@ -27,7 +28,7 @@
27
28
 
28
29
  let { content, streaming = false, class: className = "" }: Props = $props();
29
30
 
30
- const hasMarkdownDeps = !!(Marked && markedHighlight && DOMPurify && Object.keys(DOMPurify).length > 0);
31
+ const hasMarkdownDeps = !!(Marked && Object.keys(DOMPurify || {}).length > 0);
31
32
 
32
33
  // Configure marked with syntax highlighting if available
33
34
  const markedObj = hasMarkdownDeps ? new Marked(
@@ -43,7 +44,7 @@
43
44
  // Render HTML safely
44
45
  const html = $derived(
45
46
  hasMarkdownDeps
46
- ? DOMPurify.sanitize(markedObj.parse(content || "") as string)
47
+ ? DOMPurify.sanitize(markedObj!.parse(content || "") as string)
47
48
  : `<div style="white-space: pre-wrap">${String(content || "").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</div>`
48
49
  );
49
50
 
@@ -2,8 +2,10 @@
2
2
  import { t } from '@svadmin/core/i18n';
3
3
  import { getAuthProvider, getResources } from '@svadmin/core';
4
4
  import type { Role } from '@svadmin/core';
5
- import PermissionMatrix, { type RoleInfo, type ResourceInfo, type ActionInfo } from './PermissionMatrix.svelte';
5
+ import PermissionMatrix from './PermissionMatrix.svelte';
6
+ import type { RoleInfo, ResourceInfo, ActionInfo } from '../types.js';
6
7
  import { toast } from '@svadmin/core/toast';
8
+ import { AlertCircle } from 'lucide-svelte';
7
9
 
8
10
  const authProvider = getAuthProvider();
9
11
  const rawResources = getResources();
@@ -42,7 +44,7 @@
42
44
  }
43
45
  try {
44
46
  const fetchedRoles = await authProvider.getRoles();
45
- roles = fetchedRoles.map(r => ({ code: r.id, name: r.name, ...r }));
47
+ roles = fetchedRoles.map(r => ({ code: r.id, ...r }));
46
48
  if (roles.length > 0 && !selectedRoleCode) {
47
49
  selectedRoleCode = roles[0].code;
48
50
  }
@@ -28,17 +28,19 @@
28
28
  consumePromiseQueue();
29
29
  }
30
30
  });
31
+
32
+ const toasterProps = $derived({
33
+ position: "top-right",
34
+ richColors: true,
35
+ closeButton: true,
36
+ expand: true,
37
+ theme,
38
+ toastOptions: {
39
+ classes: {
40
+ toast: 'font-sans',
41
+ },
42
+ }
43
+ } as any);
31
44
  </script>
32
45
 
33
- <Toaster
34
- position="top-right"
35
- richColors
36
- closeButton
37
- expand
38
- {theme}
39
- toastOptions={{
40
- classes: {
41
- toast: 'font-sans',
42
- },
43
- }}
44
- />
46
+ <Toaster {...toasterProps} />
@@ -32,18 +32,8 @@
32
32
  <Tooltip.Root>
33
33
  <Tooltip.Trigger>
34
34
  {#snippet child({ props })}
35
- <Button
36
- {...props}
37
- {...restProps}
38
- {variant}
39
- {size}
40
- {type}
41
- class={className}
42
- aria-label={restProps['aria-label'] ?? tooltip}
43
- {onclick}
44
- {disabled}
45
- {tabindex}
46
- >
35
+ {@const buttonProps = { ...props, ...restProps, variant, size, type, class: className, 'aria-label': restProps['aria-label'] ?? tooltip, onclick, disabled, tabindex } as any}
36
+ <Button {...buttonProps}>
47
37
  {@render children()}
48
38
  </Button>
49
39
  {/snippet}