@svadmin/ui 0.34.0 → 0.34.1

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.
@@ -7,7 +7,7 @@
7
7
  import { t } from '@svadmin/core/i18n';
8
8
  import { navigate } from '@svadmin/core/router';
9
9
  import { currentPath } from '@svadmin/core/router';
10
- import { QueryClient, QueryClientProvider } from '@tanstack/svelte-query';
10
+ import { QueryClient, QueryClientProvider, type DefaultOptions } from '@tanstack/svelte-query';
11
11
  import { setComponentRegistry, getComponentRegistry, type ComponentRegistry } from '../component-registry.svelte.js';
12
12
  import Layout from './Layout.svelte';
13
13
  import AutoTable from './AutoTable.svelte';
@@ -51,6 +51,10 @@
51
51
  siteUrl?: string;
52
52
  /** Routing strategy for Sidebar links ('hash' | 'path' | 'auto') */
53
53
  routeMode?: 'hash' | 'path' | 'auto';
54
+ /** Optional TanStack Query client override. */
55
+ queryClient?: QueryClient;
56
+ /** Optional TanStack Query default options override when QueryClient is not supplied. */
57
+ queryClientDefaultOptions?: DefaultOptions;
54
58
  }
55
59
 
56
60
  let {
@@ -69,6 +73,8 @@
69
73
  menu,
70
74
  siteUrl,
71
75
  routeMode,
76
+ queryClient: providedQueryClient,
77
+ queryClientDefaultOptions,
72
78
  }: Props = $props();
73
79
 
74
80
  // Default component registry
@@ -113,11 +119,12 @@
113
119
  if (defaultTheme) setTheme(defaultTheme);
114
120
  });
115
121
 
116
- const queryClient = new QueryClient({
122
+ const queryClient = $derived(providedQueryClient ?? new QueryClient({
117
123
  defaultOptions: {
118
124
  queries: { staleTime: 30_000, retry: 1 },
125
+ ...queryClientDefaultOptions,
119
126
  },
120
- });
127
+ }));
121
128
 
122
129
  // Initialize router with provider synchronously
123
130
  initRouter(resolvedRouter);
@@ -1,6 +1,7 @@
1
1
  import '../app.css';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { DataProvider, AuthProvider, ResourceDefinition, ThemeMode, RouterProvider, ThemeConfig, MenuItem, TaskProvider } from '@svadmin/core';
4
+ import { QueryClient, type DefaultOptions } from '@tanstack/svelte-query';
4
5
  import { type ComponentRegistry } from '../component-registry.svelte.js';
5
6
  interface Props {
6
7
  dataProvider: DataProvider;
@@ -23,6 +24,10 @@ interface Props {
23
24
  siteUrl?: string;
24
25
  /** Routing strategy for Sidebar links ('hash' | 'path' | 'auto') */
25
26
  routeMode?: 'hash' | 'path' | 'auto';
27
+ /** Optional TanStack Query client override. */
28
+ queryClient?: QueryClient;
29
+ /** Optional TanStack Query default options override when QueryClient is not supplied. */
30
+ queryClientDefaultOptions?: DefaultOptions;
26
31
  }
27
32
  declare const AdminApp: import("svelte").Component<Props, {}, "">;
28
33
  type AdminApp = ReturnType<typeof AdminApp>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ui",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@lucide/svelte": "^1.7.0",
65
- "@tanstack/svelte-table": "^9.0.0-alpha.32",
65
+ "@tanstack/svelte-table": "9.0.0-alpha.32",
66
66
  "bits-ui": "^2.17.1",
67
67
  "clsx": "^2.1.1",
68
68
  "cmdk-sv": "^0.0.19",