@svadmin/ui 0.60.1 → 0.63.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.
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
let selectedResource = $state('');
|
|
20
20
|
let inferResult = $state<InferResult | null>(null);
|
|
21
|
+
let codeTarget = $state<'resource' | 'typebox' | 'list' | 'create' | 'edit' | 'show'>('resource');
|
|
21
22
|
let loading = $state(false);
|
|
22
23
|
let error = $state<string | null>(null);
|
|
23
24
|
let copied = $state(false);
|
|
@@ -78,9 +79,19 @@
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
const activeCode = $derived.by(() => {
|
|
83
|
+
if (!inferResult) return '';
|
|
84
|
+
if (codeTarget === 'typebox') return inferResult.typeboxCode;
|
|
85
|
+
if (codeTarget === 'list') return inferResult.componentCode.list;
|
|
86
|
+
if (codeTarget === 'create') return inferResult.componentCode.create;
|
|
87
|
+
if (codeTarget === 'edit') return inferResult.componentCode.edit;
|
|
88
|
+
if (codeTarget === 'show') return inferResult.componentCode.show;
|
|
89
|
+
return inferResult.code;
|
|
90
|
+
});
|
|
91
|
+
|
|
81
92
|
function copyCode() {
|
|
82
|
-
if (!
|
|
83
|
-
navigator.clipboard.writeText(
|
|
93
|
+
if (!activeCode) return;
|
|
94
|
+
navigator.clipboard.writeText(activeCode);
|
|
84
95
|
copied = true;
|
|
85
96
|
if (copyTimer) clearTimeout(copyTimer);
|
|
86
97
|
copyTimer = setTimeout(() => { copied = false; }, 2000);
|
|
@@ -190,8 +201,57 @@
|
|
|
190
201
|
|
|
191
202
|
<!-- Generated code -->
|
|
192
203
|
<div class="rounded-lg border overflow-hidden">
|
|
193
|
-
<div class="flex items-center justify-between bg-muted px-3 py-1.5 text-xs text-muted-foreground">
|
|
194
|
-
<
|
|
204
|
+
<div class="flex flex-wrap items-center justify-between gap-1 bg-muted px-3 py-1.5 text-xs text-muted-foreground border-b">
|
|
205
|
+
<div class="flex items-center gap-1">
|
|
206
|
+
<Button
|
|
207
|
+
variant={codeTarget === 'resource' ? 'secondary' : 'ghost'}
|
|
208
|
+
size="sm"
|
|
209
|
+
class="h-6 text-xs px-2"
|
|
210
|
+
onclick={() => { codeTarget = 'resource'; }}
|
|
211
|
+
>
|
|
212
|
+
Resource (TS)
|
|
213
|
+
</Button>
|
|
214
|
+
<Button
|
|
215
|
+
variant={codeTarget === 'typebox' ? 'secondary' : 'ghost'}
|
|
216
|
+
size="sm"
|
|
217
|
+
class="h-6 text-xs px-2"
|
|
218
|
+
onclick={() => { codeTarget = 'typebox'; }}
|
|
219
|
+
>
|
|
220
|
+
TypeBox Schema
|
|
221
|
+
</Button>
|
|
222
|
+
<Button
|
|
223
|
+
variant={codeTarget === 'list' ? 'secondary' : 'ghost'}
|
|
224
|
+
size="sm"
|
|
225
|
+
class="h-6 text-xs px-2"
|
|
226
|
+
onclick={() => { codeTarget = 'list'; }}
|
|
227
|
+
>
|
|
228
|
+
List Page
|
|
229
|
+
</Button>
|
|
230
|
+
<Button
|
|
231
|
+
variant={codeTarget === 'create' ? 'secondary' : 'ghost'}
|
|
232
|
+
size="sm"
|
|
233
|
+
class="h-6 text-xs px-2"
|
|
234
|
+
onclick={() => { codeTarget = 'create'; }}
|
|
235
|
+
>
|
|
236
|
+
Create Form
|
|
237
|
+
</Button>
|
|
238
|
+
<Button
|
|
239
|
+
variant={codeTarget === 'edit' ? 'secondary' : 'ghost'}
|
|
240
|
+
size="sm"
|
|
241
|
+
class="h-6 text-xs px-2"
|
|
242
|
+
onclick={() => { codeTarget = 'edit'; }}
|
|
243
|
+
>
|
|
244
|
+
Edit Form
|
|
245
|
+
</Button>
|
|
246
|
+
<Button
|
|
247
|
+
variant={codeTarget === 'show' ? 'secondary' : 'ghost'}
|
|
248
|
+
size="sm"
|
|
249
|
+
class="h-6 text-xs px-2"
|
|
250
|
+
onclick={() => { codeTarget = 'show'; }}
|
|
251
|
+
>
|
|
252
|
+
Show Page
|
|
253
|
+
</Button>
|
|
254
|
+
</div>
|
|
195
255
|
<Button variant="ghost" size="sm" class="h-6 text-xs gap-1" onclick={copyCode}>
|
|
196
256
|
{#if copied}
|
|
197
257
|
<Check class="h-3 w-3 text-success" />
|
|
@@ -202,11 +262,11 @@
|
|
|
202
262
|
{/if}
|
|
203
263
|
</Button>
|
|
204
264
|
</div>
|
|
205
|
-
<pre class="max-h-64 overflow-auto bg-muted/30 p-3 text-xs text-foreground font-mono">{
|
|
265
|
+
<pre class="max-h-64 overflow-auto bg-muted/30 p-3 text-xs text-foreground font-mono">{activeCode}</pre>
|
|
206
266
|
</div>
|
|
207
267
|
|
|
208
268
|
<p class="text-xs text-muted-foreground">
|
|
209
|
-
Inferred {inferResult.fields.length} fields from sample data. Copy the code above into your
|
|
269
|
+
Inferred {inferResult.fields.length} fields from sample data. Copy the code above into your Svelte 5 application files.
|
|
210
270
|
</p>
|
|
211
271
|
{/if}
|
|
212
272
|
</Card.CardContent>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"./components/*": "./dist/components/*"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@svadmin/core": "^0.
|
|
43
|
-
"@tanstack/svelte-query": "^6.1.
|
|
44
|
-
"highlight.js": "^11.
|
|
45
|
-
"isomorphic-dompurify": "^3.
|
|
46
|
-
"marked": "^18.0.
|
|
42
|
+
"@svadmin/core": "^0.45.0",
|
|
43
|
+
"@tanstack/svelte-query": "^6.1.48",
|
|
44
|
+
"highlight.js": "^11.12.0",
|
|
45
|
+
"isomorphic-dompurify": "^3.23.0",
|
|
46
|
+
"marked": "^18.0.11",
|
|
47
47
|
"marked-highlight": "^2.2.4",
|
|
48
|
-
"svelte": "^5.56.
|
|
48
|
+
"svelte": "^5.56.10"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"marked": {
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@floating-ui/dom": "^1.8.0",
|
|
78
|
-
"@lucide/svelte": "^1.
|
|
78
|
+
"@lucide/svelte": "^1.35.0",
|
|
79
79
|
"@tanstack/svelte-store": "^0.12.1",
|
|
80
|
-
"@tanstack/svelte-table": "9.
|
|
81
|
-
"@tanstack/table-core": "9.
|
|
82
|
-
"bits-ui": "^2.
|
|
80
|
+
"@tanstack/svelte-table": "^9.2.3",
|
|
81
|
+
"@tanstack/table-core": "^9.2.3",
|
|
82
|
+
"bits-ui": "^2.19.0",
|
|
83
83
|
"clsx": "^2.1.1",
|
|
84
|
-
"svelte-sonner": "^1.
|
|
84
|
+
"svelte-sonner": "^1.2.1",
|
|
85
85
|
"tailwind-merge": "^3.6.0",
|
|
86
86
|
"tailwind-variants": "^3.3.1"
|
|
87
87
|
},
|
|
@@ -100,13 +100,13 @@
|
|
|
100
100
|
"access": "public"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@happy-dom/global-registrator": "^20.11.
|
|
103
|
+
"@happy-dom/global-registrator": "^20.11.12",
|
|
104
104
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
105
105
|
"@testing-library/dom": "^10.4.1",
|
|
106
106
|
"@testing-library/svelte": "^5.4.2",
|
|
107
|
-
"@testing-library/user-event": "^14.6.
|
|
108
|
-
"happy-dom": "^20.11.
|
|
109
|
-
"vitest": "^4.1.
|
|
107
|
+
"@testing-library/user-event": "^14.6.6",
|
|
108
|
+
"happy-dom": "^20.11.12",
|
|
109
|
+
"vitest": "^4.1.11"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|
|
112
112
|
"build": "node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && node scripts/postbuild-css.mjs",
|