@svadmin/ui 0.108.6 → 0.110.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.
package/dist/app.css CHANGED
@@ -5622,6 +5622,9 @@
5622
5622
  .-top-0\.5 {
5623
5623
  top: calc(var(--spacing) * -0.5);
5624
5624
  }
5625
+ .-top-7 {
5626
+ top: calc(var(--spacing) * -7);
5627
+ }
5625
5628
  .top-0 {
5626
5629
  top: 0px;
5627
5630
  }
@@ -5661,6 +5664,9 @@
5661
5664
  .right-4 {
5662
5665
  right: calc(var(--spacing) * 4);
5663
5666
  }
5667
+ .right-6 {
5668
+ right: calc(var(--spacing) * 6);
5669
+ }
5664
5670
  .right-\[4\.75rem\] {
5665
5671
  right: 4.75rem;
5666
5672
  }
@@ -5673,6 +5679,9 @@
5673
5679
  .bottom-5 {
5674
5680
  bottom: calc(var(--spacing) * 5);
5675
5681
  }
5682
+ .bottom-16 {
5683
+ bottom: calc(var(--spacing) * 16);
5684
+ }
5676
5685
  .bottom-full {
5677
5686
  bottom: 100%;
5678
5687
  }
@@ -5724,6 +5733,9 @@
5724
5733
  .z-\[9999\] {
5725
5734
  z-index: 9999;
5726
5735
  }
5736
+ .z-\[999999\] {
5737
+ z-index: 999999;
5738
+ }
5727
5739
  .col-span-full {
5728
5740
  grid-column: 1 / -1;
5729
5741
  }
@@ -8296,6 +8308,10 @@
8296
8308
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
8297
8309
  transition-duration: var(--tw-duration, var(--default-transition-duration));
8298
8310
  }
8311
+ .duration-75 {
8312
+ --tw-duration: 75ms;
8313
+ transition-duration: 75ms;
8314
+ }
8299
8315
  .duration-150 {
8300
8316
  --tw-duration: 150ms;
8301
8317
  transition-duration: 150ms;
@@ -11593,7 +11609,7 @@ main {
11593
11609
  }
11594
11610
 
11595
11611
  [data-svadmin-form-field],
11596
- [data-svadmin-field] {
11612
+ [data-svadmin-field]:not([data-slot="table-head"]):not([data-slot="table-cell"]) {
11597
11613
  display: flex;
11598
11614
  flex-direction: column;
11599
11615
  align-items: stretch;
@@ -5622,6 +5622,9 @@
5622
5622
  .-top-0\.5 {
5623
5623
  top: calc(var(--spacing) * -0.5);
5624
5624
  }
5625
+ .-top-7 {
5626
+ top: calc(var(--spacing) * -7);
5627
+ }
5625
5628
  .top-0 {
5626
5629
  top: 0px;
5627
5630
  }
@@ -5661,6 +5664,9 @@
5661
5664
  .right-4 {
5662
5665
  right: calc(var(--spacing) * 4);
5663
5666
  }
5667
+ .right-6 {
5668
+ right: calc(var(--spacing) * 6);
5669
+ }
5664
5670
  .right-\[4\.75rem\] {
5665
5671
  right: 4.75rem;
5666
5672
  }
@@ -5673,6 +5679,9 @@
5673
5679
  .bottom-5 {
5674
5680
  bottom: calc(var(--spacing) * 5);
5675
5681
  }
5682
+ .bottom-16 {
5683
+ bottom: calc(var(--spacing) * 16);
5684
+ }
5676
5685
  .bottom-full {
5677
5686
  bottom: 100%;
5678
5687
  }
@@ -5724,6 +5733,9 @@
5724
5733
  .z-\[9999\] {
5725
5734
  z-index: 9999;
5726
5735
  }
5736
+ .z-\[999999\] {
5737
+ z-index: 999999;
5738
+ }
5727
5739
  .col-span-full {
5728
5740
  grid-column: 1 / -1;
5729
5741
  }
@@ -8296,6 +8308,10 @@
8296
8308
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
8297
8309
  transition-duration: var(--tw-duration, var(--default-transition-duration));
8298
8310
  }
8311
+ .duration-75 {
8312
+ --tw-duration: 75ms;
8313
+ transition-duration: 75ms;
8314
+ }
8299
8315
  .duration-150 {
8300
8316
  --tw-duration: 150ms;
8301
8317
  transition-duration: 150ms;
@@ -11593,7 +11609,7 @@ main {
11593
11609
  }
11594
11610
 
11595
11611
  [data-svadmin-form-field],
11596
- [data-svadmin-field] {
11612
+ [data-svadmin-field]:not([data-slot="table-head"]):not([data-slot="table-cell"]) {
11597
11613
  display: flex;
11598
11614
  flex-direction: column;
11599
11615
  align-items: stretch;
@@ -0,0 +1 @@
1
+ export * from './component-registry.svelte.js';
@@ -11,7 +11,7 @@
11
11
  const resources = $derived(adminContext.resources.filter((resource) => resource.meta?.['aboutVisible'] !== false));
12
12
  const providerNames = $derived(adminContext.getDataProviderNames());
13
13
  let { version: suppliedVersion, headingLevel = 'h1' }: { version?: string; headingLevel?: 'h1' | 'h2' } = $props();
14
- const buildVersion = "0.108.6";
14
+ const buildVersion = "0.110.0";
15
15
  const version = $derived(suppliedVersion ?? (
16
16
  buildVersion.startsWith('__')
17
17
  ? (i18n.locale === 'zh-CN' ? '开发构建(未提供版本)' : 'Development build (version unavailable)')
@@ -38,6 +38,17 @@
38
38
  columns?: 1 | 2 | 3 | 4;
39
39
  showHeader?: boolean;
40
40
  fieldRenderer?: Snippet<[{ field: FieldDefinition; value: unknown; onchange: (v: unknown) => void }]>;
41
+ /** Custom field renderers mapped by field key (Escape Hatch Level 2) */
42
+ fields?: Record<
43
+ string,
44
+ Snippet<[{
45
+ field: FieldDefinition;
46
+ value: unknown;
47
+ onchange: (v: unknown) => void;
48
+ disabled: boolean;
49
+ invalid: boolean;
50
+ }]>
51
+ >;
41
52
  formActions?: Snippet<[{ isLoading: boolean; isDisabled: boolean; onSubmit: () => void }]>;
42
53
  headerContent?: Snippet;
43
54
  onSuccess?: () => void;
@@ -69,6 +80,7 @@
69
80
  columns = 1,
70
81
  showHeader = true,
71
82
  fieldRenderer,
83
+ fields,
72
84
  formActions,
73
85
  headerContent,
74
86
  onSuccess,
@@ -549,7 +561,13 @@
549
561
  });
550
562
  </script>
551
563
 
552
- <div class="space-y-6" data-svadmin-rendering-resource={activeRendering?.resource.name} data-svadmin-rendering-kind={activeRendering ? 'form' : undefined}>
564
+ <div
565
+ class="space-y-6"
566
+ data-svadmin-component="AutoForm"
567
+ data-svadmin-resource={resourceName}
568
+ data-svadmin-rendering-resource={activeRendering?.resource.name}
569
+ data-svadmin-rendering-kind={activeRendering ? 'form' : undefined}
570
+ >
553
571
  {#if showHeader}
554
572
  <div class="flex items-center gap-4">
555
573
  <TooltipButton
@@ -626,8 +644,23 @@
626
644
  <Card.Content class="px-4 sm:px-6 pb-4 sm:pb-6 pt-0">
627
645
  <div class={gridClass}>
628
646
  {#each group.fields as field (field.key)}
629
- <div data-svadmin-form-field data-svadmin-field-key={field.key} class={cn(columns > 1 && isFullWidthField(field) && 'col-span-full', !!form.errors[field.key] && 'border-destructive')}>
630
- {#if fieldRenderer}
647
+ {@const customField = fields?.[field.key]}
648
+ <div
649
+ data-svadmin-form-field
650
+ data-svadmin-field-key={field.key}
651
+ data-svadmin-field={field.key}
652
+ data-svadmin-field-type={field.type}
653
+ class={cn(columns > 1 && isFullWidthField(field) && 'col-span-full', !!form.errors[field.key] && 'border-destructive')}
654
+ >
655
+ {#if customField}
656
+ {@render customField({
657
+ field,
658
+ value: renderedDraft.values[field.key],
659
+ onchange: fieldChange(field.key),
660
+ disabled: isReadonly,
661
+ invalid: !!form.errors[field.key],
662
+ })}
663
+ {:else if fieldRenderer}
631
664
  {@render fieldRenderer({ field, value: renderedDraft.values[field.key], onchange: fieldChange(field.key) })}
632
665
  {:else}
633
666
  <FieldRenderer
@@ -657,8 +690,23 @@
657
690
  <Card.Content class="px-4 pt-5 pb-4 sm:px-6 sm:pt-6 sm:pb-6">
658
691
  <div class={gridClass} data-svadmin-form-grid data-columns={columns}>
659
692
  {#each formFields as field (field.key)}
660
- <div data-svadmin-form-field data-svadmin-field-key={field.key} class={cn(columns > 1 && isFullWidthField(field) && 'col-span-full', !!form.errors[field.key] && 'border-destructive')}>
661
- {#if fieldRenderer}
693
+ {@const customField = fields?.[field.key]}
694
+ <div
695
+ data-svadmin-form-field
696
+ data-svadmin-field-key={field.key}
697
+ data-svadmin-field={field.key}
698
+ data-svadmin-field-type={field.type}
699
+ class={cn(columns > 1 && isFullWidthField(field) && 'col-span-full', !!form.errors[field.key] && 'border-destructive')}
700
+ >
701
+ {#if customField}
702
+ {@render customField({
703
+ field,
704
+ value: renderedDraft.values[field.key],
705
+ onchange: fieldChange(field.key),
706
+ disabled: isReadonly,
707
+ invalid: !!form.errors[field.key],
708
+ })}
709
+ {:else if fieldRenderer}
662
710
  {@render fieldRenderer({ field, value: renderedDraft.values[field.key], onchange: fieldChange(field.key) })}
663
711
  {:else}
664
712
  <FieldRenderer
@@ -14,6 +14,16 @@ interface Props {
14
14
  value: unknown;
15
15
  onchange: (v: unknown) => void;
16
16
  }]>;
17
+ /** Custom field renderers mapped by field key (Escape Hatch Level 2) */
18
+ fields?: Record<string, Snippet<[
19
+ {
20
+ field: FieldDefinition;
21
+ value: unknown;
22
+ onchange: (v: unknown) => void;
23
+ disabled: boolean;
24
+ invalid: boolean;
25
+ }
26
+ ]>>;
17
27
  formActions?: Snippet<[{
18
28
  isLoading: boolean;
19
29
  isDisabled: boolean;
@@ -1091,6 +1091,7 @@
1091
1091
  {@const header = col.header}
1092
1092
  <Table.Head
1093
1093
  {...dragProps}
1094
+ data-svadmin-field={header.id}
1094
1095
  class={cn('border-b border-border bg-muted/25 font-medium tracking-normal text-muted-foreground hover:bg-muted/40', dragProps.class)}
1095
1096
  style={header_getSize(header) != null && header_getSize(header) !== 150 ? `width:${header_getSize(header)}px` : undefined}
1096
1097
  >
@@ -1189,7 +1190,13 @@
1189
1190
  </DataState>
1190
1191
  {/snippet}
1191
1192
 
1192
- <div class="space-y-3" data-svadmin-rendering-resource={activeRendering?.resource.name} data-svadmin-rendering-kind={activeRendering ? 'table' : undefined}>
1193
+ <div
1194
+ class="space-y-3"
1195
+ data-svadmin-component="AutoTable"
1196
+ data-svadmin-resource={resourceName}
1197
+ data-svadmin-rendering-resource={activeRendering?.resource.name}
1198
+ data-svadmin-rendering-kind={activeRendering ? 'table' : undefined}
1199
+ >
1193
1200
  {#if operationError}<p role="alert">{operationError}</p>{/if}
1194
1201
  {#if detailState.invalid}<p role="alert">{i18n.t('common.operationFailed')}</p>{/if}
1195
1202
  {#if showHeader}
@@ -1545,6 +1552,7 @@
1545
1552
  {@const header = col.header}
1546
1553
  <Table.Head
1547
1554
  {...dragProps}
1555
+ data-svadmin-field={header.id}
1548
1556
  class={cn('border-b border-border bg-muted/25 font-medium tracking-normal text-muted-foreground hover:bg-muted/40', dragProps.class)}
1549
1557
  style={header_getSize(header) != null && header_getSize(header) !== 150 ? `width:${header_getSize(header)}px` : undefined}
1550
1558
  >
@@ -1599,7 +1607,7 @@
1599
1607
  {#snippet child({ props })}
1600
1608
  <Table.Row {...props} class="transition-all duration-300 border-b border-border/10 {rowIsSelected(row.id) ? 'bg-primary/5' : 'hover:bg-muted/20'}">
1601
1609
  {#each visibleCells as cell, _i (_i)}
1602
- <Table.Cell>
1610
+ <Table.Cell data-svadmin-field={cell.column.id}>
1603
1611
  {#if cell.column.id === '_select'}
1604
1612
  {#if batchActions}
1605
1613
  <Checkbox
@@ -2,7 +2,7 @@
2
2
  import { onMount } from 'svelte';
3
3
  import { DEV } from 'esm-env';
4
4
  import { SvelteMap } from 'svelte/reactivity';
5
- import { fly } from 'svelte/transition';
5
+ import { fade, fly } from 'svelte/transition';
6
6
  import { useQueryClient } from '@tanstack/svelte-query';
7
7
  import {
8
8
  captureAdminContext,
@@ -10,7 +10,10 @@
10
10
  getTheme,
11
11
  parseQueryKey,
12
12
  } from '@svadmin/core';
13
- import { buildAdminDiagnostics } from '@svadmin/devtools';
13
+ import {
14
+ buildAdminDiagnostics,
15
+ buildSelfHealingReport,
16
+ } from '@svadmin/devtools';
14
17
  import { useTranslation } from '@svadmin/core/i18n';
15
18
  import {
16
19
  attachSvadminDevtoolsQueryClient,
@@ -29,9 +32,10 @@
29
32
  import TooltipButton from './TooltipButton.svelte';
30
33
  import * as Tabs from './ui/tabs/index.js';
31
34
  import { Badge } from './ui/badge/index.js';
35
+ import { Button } from './ui/button/index.js';
32
36
  import { ScrollArea } from './ui/scroll-area/index.js';
33
37
  import { Separator } from './ui/separator/index.js';
34
- import { X, Bug, ChevronDown, ChevronUp, Wand2 } from '@lucide/svelte';
38
+ import { X, Bug, ChevronDown, ChevronUp, Wand2, Crosshair, Check, AlertCircle, Copy } from '@lucide/svelte';
35
39
  import InferencerPanel from './InferencerPanel.svelte';
36
40
 
37
41
  import type {
@@ -108,11 +112,116 @@
108
112
  visible = !visible;
109
113
  }
110
114
 
115
+ let inspecting = $state(false);
116
+ let hoveredBox = $state<{
117
+ x: number;
118
+ y: number;
119
+ width: number;
120
+ height: number;
121
+ component: string;
122
+ resource?: string;
123
+ field?: string;
124
+ } | null>(null);
125
+ let toastMessage = $state<string | null>(null);
126
+
127
+ function showToast(msg: string) {
128
+ toastMessage = msg;
129
+ setTimeout(() => {
130
+ if (toastMessage === msg) toastMessage = null;
131
+ }, 2500);
132
+ }
133
+
134
+ function toggleInspector() {
135
+ inspecting = !inspecting;
136
+ if (!inspecting) hoveredBox = null;
137
+ }
138
+
139
+ function handleDocumentMouseMove(event: MouseEvent) {
140
+ if (!inspecting) return;
141
+ const target = event.target as HTMLElement | null;
142
+ if (!target) return;
143
+ if (target.closest('.svadmin-devtools-container') || target.closest('[data-svadmin-inspector-overlay]')) return;
144
+
145
+ const compEl = target.closest('[data-svadmin-component]') as HTMLElement | null;
146
+ const fieldEl = target.closest('[data-svadmin-field]') as HTMLElement | null;
147
+
148
+ if (compEl || fieldEl) {
149
+ const el = fieldEl ?? compEl;
150
+ if (!el) return;
151
+ const rect = el.getBoundingClientRect();
152
+ const resource = compEl ? compEl.getAttribute('data-svadmin-resource') : null;
153
+ const field = fieldEl ? fieldEl.getAttribute('data-svadmin-field') : null;
154
+ const nextHoveredBox: NonNullable<typeof hoveredBox> = {
155
+ x: rect.left,
156
+ y: rect.top,
157
+ width: rect.width,
158
+ height: rect.height,
159
+ component: compEl?.getAttribute('data-svadmin-component') ?? 'Component',
160
+ };
161
+ if (resource !== null) nextHoveredBox.resource = resource;
162
+ if (field !== null) nextHoveredBox.field = field;
163
+ hoveredBox = nextHoveredBox;
164
+ } else {
165
+ hoveredBox = null;
166
+ }
167
+ }
168
+
169
+ function handleDocumentClick(event: MouseEvent) {
170
+ if (!inspecting || !hoveredBox) return;
171
+ const target = event.target as HTMLElement | null;
172
+ if (target?.closest('.svadmin-devtools-container') || target?.closest('[data-svadmin-inspector-overlay]')) return;
173
+
174
+ event.preventDefault();
175
+ event.stopPropagation();
176
+
177
+ const prompt = hoveredBox.field && hoveredBox.resource
178
+ ? `在 svadmin 中修改资源 '${hoveredBox.resource}' 的 <${hoveredBox.component}> 组件:为字段 '${hoveredBox.field}' 定制显示与交互效果。`
179
+ : hoveredBox.resource
180
+ ? `在 svadmin 中定制资源 '${hoveredBox.resource}' 的 <${hoveredBox.component}> 组件。`
181
+ : `在 svadmin 中定制 <${hoveredBox.component}> 组件。`;
182
+
183
+ const patchPayload = {
184
+ resource: hoveredBox.resource,
185
+ component: hoveredBox.component,
186
+ field: hoveredBox.field,
187
+ };
188
+ const structuredPrompt = `${prompt}\n\n[SVADMIN_WRITEBACK_PATCH]\n${JSON.stringify(patchPayload, null, 2)}`;
189
+
190
+ if (navigator?.clipboard?.writeText) {
191
+ void navigator.clipboard.writeText(structuredPrompt);
192
+ }
193
+
194
+ if (typeof window !== 'undefined') {
195
+ window.dispatchEvent(
196
+ new CustomEvent('svadmin:vibe-inspect', {
197
+ detail: { ...hoveredBox, prompt: structuredPrompt, patch: patchPayload },
198
+ }),
199
+ );
200
+ window.dispatchEvent(
201
+ new CustomEvent('svadmin:vibe-patch', {
202
+ detail: { patch: patchPayload, prompt: structuredPrompt },
203
+ }),
204
+ );
205
+ }
206
+
207
+ showToast('已复制 AI Prompt 与 Writeback Patch!可在对话框中直接粘贴');
208
+ inspecting = false;
209
+ hoveredBox = null;
210
+ }
211
+
111
212
  function handleKeydown(event: KeyboardEvent) {
112
213
  if (event.ctrlKey && event.shiftKey && event.key.toLowerCase() === 'd') {
113
214
  event.preventDefault();
114
215
  toggle();
115
216
  }
217
+ if (event.ctrlKey && event.shiftKey && event.key.toLowerCase() === 'x') {
218
+ event.preventDefault();
219
+ toggleInspector();
220
+ }
221
+ if (event.key === 'Escape' && inspecting) {
222
+ inspecting = false;
223
+ hoveredBox = null;
224
+ }
116
225
  }
117
226
 
118
227
  function refreshCacheDiagnostics() {
@@ -385,9 +494,43 @@
385
494
  });
386
495
  </script>
387
496
 
388
- <svelte:window onkeydown={isDev ? handleKeydown : undefined} />
497
+ <svelte:window
498
+ onkeydown={isDev ? handleKeydown : undefined}
499
+ onmousemove={isDev && inspecting ? handleDocumentMouseMove : undefined}
500
+ onclickcapture={isDev && inspecting ? handleDocumentClick : undefined}
501
+ />
389
502
 
390
503
  {#if isDev}
504
+ {#if inspecting && hoveredBox}
505
+ <div
506
+ data-svadmin-inspector-overlay
507
+ class="pointer-events-none fixed z-[999999] border-2 border-dashed border-primary bg-primary/10 transition-all duration-75"
508
+ style="left: {hoveredBox.x}px; top: {hoveredBox.y}px; width: {hoveredBox.width}px; height: {hoveredBox.height}px;"
509
+ >
510
+ <div class="absolute -top-7 left-0 flex items-center gap-1 rounded bg-primary px-2 py-0.5 text-xs font-mono font-medium text-primary-foreground shadow">
511
+ <span>&lt;{hoveredBox.component}&gt;</span>
512
+ {#if hoveredBox.resource}
513
+ <span class="opacity-80">res: {hoveredBox.resource}</span>
514
+ {/if}
515
+ {#if hoveredBox.field}
516
+ <span class="opacity-80">field: {hoveredBox.field}</span>
517
+ {/if}
518
+ <span class="ml-1 text-[10px] opacity-75">(点击复制 AI Prompt)</span>
519
+ </div>
520
+ </div>
521
+ {/if}
522
+
523
+ {#if toastMessage}
524
+ <div
525
+ in:fly={{ y: 20, duration: 150 }}
526
+ out:fade={{ duration: 150 }}
527
+ class="fixed bottom-16 right-6 z-[999999] flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow-lg"
528
+ >
529
+ <Check class="h-4 w-4" />
530
+ <span>{toastMessage}</span>
531
+ </div>
532
+ {/if}
533
+
391
534
  {#if visible}
392
535
  <div
393
536
  class="fixed bottom-0 right-4 z-[9999] w-[560px] max-w-[95vw] rounded-t-xl border border-b-0 bg-card shadow-2xl text-[0.8125rem] overflow-hidden"
@@ -404,6 +547,15 @@
404
547
  </Badge>
405
548
  </div>
406
549
  <div class="flex gap-1">
550
+ <TooltipButton
551
+ tooltip={inspecting ? '退出点选检查 (Exit Inspect)' : '🎯 点选检查 / Vibe Inspect (Ctrl+Shift+X)'}
552
+ variant={inspecting ? 'default' : 'ghost'}
553
+ size="icon"
554
+ class="h-6 w-6 {inspecting ? 'bg-primary text-primary-foreground' : ''}"
555
+ onclick={toggleInspector}
556
+ >
557
+ <Crosshair class="h-3.5 w-3.5" />
558
+ </TooltipButton>
407
559
  <TooltipButton tooltip={collapsed ? i18n.t('common.expand') : i18n.t('common.collapse')} variant="ghost" size="icon" class="h-6 w-6" onclick={() => collapsed = !collapsed}>
408
560
  {#if collapsed}
409
561
  <ChevronUp class="h-3.5 w-3.5" />
@@ -419,13 +571,16 @@
419
571
 
420
572
  {#if !collapsed}
421
573
  <Tabs.Root value="state" class="w-full">
422
- <Tabs.List class="grid w-full grid-cols-4 h-8 rounded-none border-b">
574
+ <Tabs.List class="grid w-full grid-cols-5 h-8 rounded-none border-b">
423
575
  <Tabs.Trigger value="state" class="text-xs data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-primary">State</Tabs.Trigger>
424
576
  <Tabs.Trigger value="providers" class="text-xs data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-primary">Providers</Tabs.Trigger>
425
577
  <Tabs.Trigger value="cache" class="text-xs data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-primary">Cache</Tabs.Trigger>
426
578
  <Tabs.Trigger value="inferencer" class="text-xs data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-primary">
427
579
  <Wand2 class="h-3 w-3 mr-1" /> Inferencer
428
580
  </Tabs.Trigger>
581
+ <Tabs.Trigger value="selfhealing" class="text-xs data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-primary">
582
+ Self-Healing
583
+ </Tabs.Trigger>
429
584
  </Tabs.List>
430
585
 
431
586
  <Tabs.Content value="state" class="p-0">
@@ -676,6 +831,59 @@
676
831
  <Tabs.Content value="inferencer" class="p-0">
677
832
  <InferencerPanel />
678
833
  </Tabs.Content>
834
+
835
+ <Tabs.Content value="selfhealing" class="p-0">
836
+ <ScrollArea class="max-h-[420px]">
837
+ <div class="p-3 space-y-3">
838
+ <div class="flex items-center justify-between">
839
+ <div>
840
+ <h4 class="text-xs font-bold uppercase tracking-wider text-muted-foreground">Runtime Self-Healing</h4>
841
+ <p class="text-xs text-muted-foreground">AI 自动排障诊断报告与一键自愈</p>
842
+ </div>
843
+ <Button
844
+ variant="outline"
845
+ size="sm"
846
+ class="h-7 text-xs flex items-center gap-1.5"
847
+ onclick={() => {
848
+ const report = buildSelfHealingReport(appDiagnostics.snapshot.diagnostics);
849
+ if (navigator?.clipboard?.writeText) {
850
+ void navigator.clipboard.writeText(report.agentPrompt);
851
+ showToast('已复制 AI 自愈 Prompt!');
852
+ }
853
+ }}
854
+ >
855
+ <Copy class="h-3.5 w-3.5" />
856
+ <span>复制自愈 Prompt</span>
857
+ </Button>
858
+ </div>
859
+
860
+ <Separator />
861
+
862
+ {#if appDiagnostics.snapshot.diagnostics.filter(d => d.severity === 'error').length === 0}
863
+ <div class="flex flex-col items-center justify-center py-6 text-center text-muted-foreground space-y-1">
864
+ <Check class="h-8 w-8 text-success mb-1" />
865
+ <p class="text-xs font-medium text-foreground">当前应用状态健康,无未解决异常</p>
866
+ <p class="text-[0.6875rem]">Provider 与资源契约已正确绑定</p>
867
+ </div>
868
+ {:else}
869
+ <div class="space-y-2">
870
+ {#each appDiagnostics.snapshot.diagnostics.filter(d => d.severity === 'error') as diag, index (`${diag.code}:${diag.message}:${index}`)}
871
+ <div class="p-2.5 rounded-lg border bg-muted/30 space-y-1">
872
+ <div class="flex items-center gap-1.5 text-xs font-semibold text-foreground">
873
+ <AlertCircle class="h-3.5 w-3.5 text-destructive shrink-0" />
874
+ <span>[{diag.fix?.kind ?? 'ERROR'}] {diag.code}</span>
875
+ </div>
876
+ <p class="text-[0.6875rem] font-mono text-muted-foreground break-all">{diag.message}</p>
877
+ {#if diag.fix?.input?.['suggestedAction']}
878
+ <p class="text-xs text-foreground font-medium">💡 建议修复:{diag.fix.input['suggestedAction']}</p>
879
+ {/if}
880
+ </div>
881
+ {/each}
882
+ </div>
883
+ {/if}
884
+ </div>
885
+ </ScrollArea>
886
+ </Tabs.Content>
679
887
  </Tabs.Root>
680
888
  {/if}
681
889
  </div>
@@ -0,0 +1 @@
1
+ export * from './browser.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './list-selection.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './list-state.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './media.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './saved-list-views.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './tooltip-layer-registry.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './editor-config.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './notifications.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './ui-preferences.svelte.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ui",
3
- "version": "0.108.6",
3
+ "version": "0.110.0",
4
4
  "description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -88,7 +88,7 @@
88
88
  "@codemirror/lang-json": "^6.0.0",
89
89
  "@codemirror/lang-markdown": "^6.0.0",
90
90
  "@codemirror/lang-sql": "^6.0.0",
91
- "@svadmin/core": "^0.70.0",
91
+ "@svadmin/core": "^0.71.0",
92
92
  "@tanstack/svelte-query": "^6.1.48",
93
93
  "codemirror": "^6.0.0",
94
94
  "dashjs": "^4.7.4",
@@ -151,7 +151,7 @@
151
151
  }
152
152
  },
153
153
  "dependencies": {
154
- "@svadmin/devtools": "^0.4.4",
154
+ "@svadmin/devtools": "^0.6.0",
155
155
  "@svadmin/devtools-contract": "^0.3.1",
156
156
  "@vibeunion/devtools-devframe": "^0.1.0",
157
157
  "typebox": "^1.3.34",
@@ -189,7 +189,7 @@
189
189
  "@codemirror/lang-markdown": "^6.5.2",
190
190
  "@codemirror/lang-sql": "^6.10.0",
191
191
  "@happy-dom/global-registrator": "^20.11.12",
192
- "@svadmin/ai-elements": "^0.13.6",
192
+ "@svadmin/ai-elements": "^0.13.7",
193
193
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
194
194
  "@tailwindcss/cli": "4.3.3",
195
195
  "@testing-library/dom": "^10.4.1",
@@ -211,7 +211,7 @@
211
211
  "vitest": "^4.1.11"
212
212
  },
213
213
  "scripts": {
214
- "build": "bun run build:styles && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && node scripts/stamp-build-version.mjs && node scripts/build-static-css.mjs && node scripts/postbuild-css.mjs",
214
+ "build": "bun run build:styles && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && node scripts/generate-declaration-bridges.mjs && node scripts/stamp-build-version.mjs && node scripts/build-static-css.mjs && node scripts/postbuild-css.mjs",
215
215
  "shadcn": "shadcn-svelte --help",
216
216
  "shadcn:add": "shadcn-svelte add --cwd shadcn --no-deps-install",
217
217
  "test": "vitest run --config ./vitest.config.ts",