@svadmin/ui 0.81.0 → 0.83.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.
@@ -10,6 +10,7 @@
10
10
  getTheme,
11
11
  parseQueryKey,
12
12
  } from '@svadmin/core';
13
+ import { buildAdminDiagnostics } from '@svadmin/devtools';
13
14
  import { useTranslation } from '@svadmin/core/i18n';
14
15
  import {
15
16
  attachSvadminDevtoolsQueryClient,
@@ -132,6 +133,11 @@
132
133
  const theme = $derived(getTheme());
133
134
  const colorTheme = $derived(getColorTheme());
134
135
  const locale = $derived(i18n.locale);
136
+ const appDiagnostics = $derived(buildAdminDiagnostics({
137
+ providers: adminContext.providerBundle,
138
+ resources,
139
+ basePath: path,
140
+ }));
135
141
 
136
142
  const dataProviders = $derived.by(() => {
137
143
  try {
@@ -257,6 +263,9 @@
257
263
  <div class="svadmin-u-60fbb7713999 svadmin-u-3960ffc248d9 svadmin-u-58284b4ea568 svadmin-u-e83a7042bc91 svadmin-u-359090c2d529 uppercase svadmin-u-09ace3a4d9f5 svadmin-u-d4108abe6359">
258
264
  <Bug class="svadmin-u-11e59c6d5f6b svadmin-u-dc7972ebf3f3" />
259
265
  <span>svadmin DevTools</span>
266
+ <Badge variant={appDiagnostics.health.status === 'error' ? 'destructive' : appDiagnostics.health.status === 'warning' ? 'outline' : 'secondary'}>
267
+ {appDiagnostics.health.status}
268
+ </Badge>
260
269
  </div>
261
270
  <div class="svadmin-u-60fbb7713999 svadmin-u-44ee8ba0a421">
262
271
  <TooltipButton tooltip={collapsed ? i18n.t('common.expand') : i18n.t('common.collapse')} variant="ghost" size="icon" class="svadmin-u-f6fe902450dc svadmin-u-7ec10f86d9b1" onclick={() => collapsed = !collapsed}>
@@ -170,6 +170,16 @@
170
170
  {/if}
171
171
 
172
172
  {#if inferResult}
173
+ {#if inferResult.review.needsReview}
174
+ <Alert.Root>
175
+ <AlertCircle class="svadmin-u-11e59c6d5f6b svadmin-u-dc7972ebf3f3" />
176
+ <Alert.Description>
177
+ Review recommended: {inferResult.review.confidence} confidence from {inferResult.review.sampleSize} sample records.
178
+ {inferResult.review.warnings.length} heuristic warning(s) require confirmation before using generated code.
179
+ </Alert.Description>
180
+ </Alert.Root>
181
+ {/if}
182
+
173
183
  <!-- Field table -->
174
184
  <ScrollArea class="svadmin-u-e5738cbd2714">
175
185
  <Table.Root>
@@ -1,6 +1,6 @@
1
1
  import type { Component } from 'svelte';
2
2
  import type { FieldDefinition } from '@svadmin/core';
3
- import { type Static, type TSchema } from '@sinclair/typebox';
3
+ import { type Static, type TSchema } from 'typebox';
4
4
  import { type SafeSchema } from '@svadmin/core/schema';
5
5
  export interface FieldDisplayProps {
6
6
  value: unknown;
@@ -1,4 +1,4 @@
1
- import { Type } from '@sinclair/typebox';
1
+ import { Type } from 'typebox';
2
2
  import { closeContractSchema, createExactSchemaValidator } from '@svadmin/core/schema';
3
3
  import { definedOptions } from '@svadmin/core/options';
4
4
  import ValidatedField from './ValidatedField.svelte';
@@ -39,11 +39,13 @@ function validatedDisplay(schema, component, project = input => ({ value: input.
39
39
  return (internals, input) => ValidatedField(internals, { component, resolve, input });
40
40
  }
41
41
  const nullable = (schema) => Type.Union([schema, Type.Null(), Type.Undefined()]);
42
+ /** TypeBox 1.x removed Type.Date; a Date instance is modelled with Unsafe plus a Refine guard. */
43
+ const dateType = Type.Refine(Type.Unsafe({ type: 'Date' }), (value) => value instanceof globalThis.Date && !Number.isNaN(value.getTime()), () => 'Expected Date');
42
44
  const text = nullable(Type.String());
43
45
  const numeric = nullable(Type.Number());
44
46
  const scalar = nullable(Type.Union([Type.String(), Type.Number()]));
45
- const date = nullable(Type.Union([Type.String(), Type.Number(), Type.Date()]));
46
- const dateProperty = Type.Optional(Type.Union([Type.String(), Type.Number(), Type.Date(), Type.Null()]));
47
+ const date = nullable(Type.Union([Type.String(), Type.Number(), dateType]));
48
+ const dateProperty = Type.Optional(Type.Union([Type.String(), Type.Number(), dateType, Type.Null()]));
47
49
  const choices = Type.Optional(Type.Array(Type.Object({
48
50
  label: Type.String(), value: Type.Union([Type.String(), Type.Number()]),
49
51
  }, { additionalProperties: false })));
@@ -1,4 +1,7 @@
1
- export declare const jsonValueSchema: import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNull, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>;
1
+ import { Type } from 'typebox';
2
+ export declare const jsonValueSchema: Type.TCyclic<{
3
+ JsonValue: Type.TUnion<[Type.TNull, Type.TBoolean, Type.TNumber, Type.TString, Type.TArray<Type.TRef<"JsonValue">>, Type.TRefine<Type.TRecord<"^.*$", Type.TRef<"JsonValue">>>]>;
4
+ }, "JsonValue">;
2
5
  export type JsonDisplay = {
3
6
  status: 'empty';
4
7
  } | {
@@ -1,9 +1,19 @@
1
- import { Type } from '@sinclair/typebox';
1
+ import { Type } from 'typebox';
2
2
  import { createExactSchemaValidator } from '@svadmin/core/schema';
3
- export const jsonValueSchema = Type.Recursive(Self => Type.Union([
4
- Type.Null(), Type.Boolean(), Type.Number(), Type.String(),
5
- Type.Array(Self), Type.Record(Type.String(), Self),
6
- ]));
3
+ /** TypeBox 1.x Record validation accepts class instances; keep JSON objects plain. */
4
+ function isPlainRecord(value) {
5
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
6
+ return false;
7
+ const prototype = Object.getPrototypeOf(value);
8
+ return prototype === Object.prototype || prototype === null;
9
+ }
10
+ export const jsonValueSchema = Type.Cyclic({
11
+ JsonValue: Type.Union([
12
+ Type.Null(), Type.Boolean(), Type.Number(), Type.String(),
13
+ Type.Array(Type.Ref('JsonValue')),
14
+ Type.Refine(Type.Record(Type.String(), Type.Ref('JsonValue')), isPlainRecord, () => 'Expected plain object'),
15
+ ]),
16
+ }, 'JsonValue');
7
17
  const validator = createExactSchemaValidator(jsonValueSchema);
8
18
  export function formatJsonValue(value) {
9
19
  if (value == null)
@@ -1,4 +1,4 @@
1
- import { Type } from '@sinclair/typebox';
1
+ import { Type } from 'typebox';
2
2
  import { checkExact, decodeBaseRecord, snapshotPlainData, rejectProviderResponse } from '@svadmin/core/schema';
3
3
  const recordShape = Type.Intersect([
4
4
  Type.Record(Type.String(), Type.Unknown()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ui",
3
- "version": "0.81.0",
3
+ "version": "0.83.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.58.0",
91
+ "@svadmin/core": "^0.60.0",
92
92
  "@tanstack/svelte-query": "^6.1.48",
93
93
  "codemirror": "^6.0.0",
94
94
  "isomorphic-dompurify": "^3.23.0",
@@ -139,9 +139,10 @@
139
139
  }
140
140
  },
141
141
  "dependencies": {
142
+ "@svadmin/devtools": "^0.3.0",
142
143
  "@svadmin/devtools-contract": "^0.3.0",
143
144
  "@vibeunion/devtools-devframe": "^0.1.0",
144
- "@sinclair/typebox": "^0.34.52",
145
+ "typebox": "^1.3.34",
145
146
  "@floating-ui/dom": "^1.8.0",
146
147
  "esm-env": "^1.2.2",
147
148
  "@lucide/svelte": "^1.35.0",
@@ -176,7 +177,7 @@
176
177
  "@codemirror/lang-markdown": "^6.5.2",
177
178
  "@codemirror/lang-sql": "^6.10.0",
178
179
  "@happy-dom/global-registrator": "^20.11.12",
179
- "@svadmin/ai-elements": "^0.10.3",
180
+ "@svadmin/ai-elements": "^0.11.1",
180
181
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
181
182
  "@tailwindcss/cli": "4.3.3",
182
183
  "@testing-library/dom": "^10.4.1",
@@ -186,7 +187,7 @@
186
187
  "codemirror": "^6.0.2",
187
188
  "happy-dom": "^20.11.12",
188
189
  "postcss": "^8.5.26",
189
- "postcss-selector-parser": "^7.1.1",
190
+ "postcss-selector-parser": "^7.1.6",
190
191
  "qrcode": "^1.5.4",
191
192
  "shadcn-svelte": "^1.7.0",
192
193
  "svelte-codemirror-editor": "^2.1.0",