@svadmin/ui 0.38.0 → 0.38.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.
|
@@ -117,27 +117,16 @@
|
|
|
117
117
|
Skeleton: Skeleton as unknown as ComponentRegistry['Skeleton'],
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
// Merge and keep a local reference — setContext is only visible to *children*,
|
|
121
|
-
// so we must use the local variable for lookups within this component.
|
|
122
|
-
const mergedComponents: ComponentRegistry = { ...defaultComponents, ...userComponents };
|
|
123
|
-
setComponentRegistry(mergedComponents);
|
|
124
|
-
|
|
125
120
|
// Resolve router provider (default to hash)
|
|
121
|
+
const mergedComponents = $derived.by((): ComponentRegistry => ({ ...defaultComponents, ...userComponents }));
|
|
126
122
|
const resolvedRouter = $derived(routerProvider ?? createHashRouterProvider());
|
|
127
123
|
const resolvedRouteMode = $derived(routeMode ?? (routerProvider ? 'auto' : 'hash'));
|
|
128
124
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (taskProvider) setTaskProvider(taskProvider);
|
|
133
|
-
setResources(resources);
|
|
134
|
-
setRouterProvider(resolvedRouter);
|
|
135
|
-
if (locale) setLocale(locale);
|
|
136
|
-
if (userThemeConfig) configureTheme(userThemeConfig);
|
|
137
|
-
if (defaultTheme) setTheme(defaultTheme);
|
|
125
|
+
function syncComponentRegistry() {
|
|
126
|
+
setComponentRegistry(mergedComponents);
|
|
127
|
+
}
|
|
138
128
|
|
|
139
|
-
|
|
140
|
-
$effect.pre(() => {
|
|
129
|
+
function syncAppContext() {
|
|
141
130
|
setDataProvider(dataProvider);
|
|
142
131
|
if (authProvider) setAuthProvider(authProvider);
|
|
143
132
|
if (taskProvider) setTaskProvider(taskProvider);
|
|
@@ -146,7 +135,15 @@
|
|
|
146
135
|
if (locale) setLocale(locale);
|
|
147
136
|
if (userThemeConfig) configureTheme(userThemeConfig);
|
|
148
137
|
if (defaultTheme) setTheme(defaultTheme);
|
|
149
|
-
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Set up initial context synchronously so children can access resources immediately during first render.
|
|
141
|
+
syncComponentRegistry();
|
|
142
|
+
syncAppContext();
|
|
143
|
+
|
|
144
|
+
// Set up context — use $effect so prop changes are tracked
|
|
145
|
+
$effect.pre(syncComponentRegistry);
|
|
146
|
+
$effect.pre(syncAppContext);
|
|
150
147
|
|
|
151
148
|
const queryClient = $derived(providedQueryClient ?? new QueryClient({
|
|
152
149
|
defaultOptions: {
|
|
@@ -155,11 +152,13 @@
|
|
|
155
152
|
},
|
|
156
153
|
}));
|
|
157
154
|
|
|
158
|
-
|
|
159
|
-
initRouter(resolvedRouter);
|
|
160
|
-
$effect.pre(() => {
|
|
155
|
+
function syncRouter() {
|
|
161
156
|
initRouter(resolvedRouter);
|
|
162
|
-
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Initialize router with provider synchronously
|
|
160
|
+
syncRouter();
|
|
161
|
+
$effect.pre(syncRouter);
|
|
163
162
|
|
|
164
163
|
// Reactive getters for route state
|
|
165
164
|
const route = $derived(getRoute());
|
|
@@ -172,13 +172,16 @@
|
|
|
172
172
|
{/snippet}
|
|
173
173
|
</Header>
|
|
174
174
|
|
|
175
|
-
<!-- Content area
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
<!-- Content area: responsive padding + centered max-width container
|
|
176
|
+
so wide screens don't stretch content indefinitely (avoids sparse layouts) -->
|
|
177
|
+
<main class="flex-1 overflow-y-auto bg-muted/30 px-4 py-5 sm:px-5 md:px-7.5 md:py-7">
|
|
178
|
+
<div class="mx-auto w-full max-w-[1600px]">
|
|
179
|
+
{#key getPath()}
|
|
180
|
+
<div in:fly={{ x: 20, duration: 150 }} out:fade={{ duration: 80 }}>
|
|
181
|
+
{@render children()}
|
|
182
|
+
</div>
|
|
183
|
+
{/key}
|
|
184
|
+
</div>
|
|
182
185
|
</main>
|
|
183
186
|
</div>
|
|
184
187
|
</div>
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
})());
|
|
55
55
|
|
|
56
56
|
const validator = $derived(deriveValidator(flatStepsFields));
|
|
57
|
+
const stepsCount = $derived(steps.length);
|
|
57
58
|
|
|
58
59
|
// ─── useStepsForm: form state + step navigation ──────────────────
|
|
59
60
|
const form = useStepsForm({
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
get action() { return mode; },
|
|
62
63
|
get id() { return id; },
|
|
63
64
|
get defaultValues() { return defaults; },
|
|
64
|
-
stepsCount
|
|
65
|
+
get stepsCount() { return stepsCount; },
|
|
65
66
|
redirect: 'list',
|
|
66
67
|
warnWhenUnsavedChanges: true,
|
|
67
68
|
get validate() { return validator; },
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
onTimeout: () => void;
|
|
13
13
|
}>();
|
|
14
14
|
|
|
15
|
-
let remaining = $state(
|
|
15
|
+
let remaining = $state(0);
|
|
16
16
|
let dismissed = $state(false);
|
|
17
17
|
|
|
18
18
|
$effect(() => {
|
|
19
|
+
remaining = duration;
|
|
19
20
|
const startTime = Date.now();
|
|
20
21
|
const totalMs = duration;
|
|
21
22
|
const interval = setInterval(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
"style": "./dist/app.css",
|
|
26
26
|
"default": "./dist/app.css"
|
|
27
27
|
},
|
|
28
|
+
"./app.theme.css": {
|
|
29
|
+
"style": "./dist/app.theme.css",
|
|
30
|
+
"default": "./dist/app.theme.css"
|
|
31
|
+
},
|
|
28
32
|
"./components/*.svelte": {
|
|
29
33
|
"types": "./dist/components/*.svelte.d.ts",
|
|
30
34
|
"svelte": "./dist/components/*.svelte",
|
|
@@ -99,7 +103,7 @@
|
|
|
99
103
|
"vitest": "^4.1.8"
|
|
100
104
|
},
|
|
101
105
|
"scripts": {
|
|
102
|
-
"build": "svelte-package -i src -o dist",
|
|
106
|
+
"build": "svelte-package -i src -o dist && node scripts/postbuild-css.mjs",
|
|
103
107
|
"test": "vitest run --config ./vitest.config.ts"
|
|
104
108
|
}
|
|
105
109
|
}
|