@vertz/ui 0.2.15 → 0.2.16
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/README.md +49 -0
- package/dist/shared/chunk-14eqne2a.js +10 -0
- package/dist/shared/{chunk-dksg08fq.js → chunk-1rxa2fz4.js} +2 -8
- package/dist/shared/{chunk-8hsz5y4a.js → chunk-4fwcwxn6.js} +14 -4
- package/dist/shared/{chunk-hw67ckr3.js → chunk-4mtn7af6.js} +230 -19
- package/dist/shared/{chunk-4txc67nd.js → chunk-6jyt4ycw.js} +67 -2
- package/dist/shared/{chunk-83g4h38e.js → chunk-6wd36w21.js} +1 -0
- package/dist/shared/{chunk-h89w580h.js → chunk-afawz764.js} +1 -1
- package/dist/shared/{chunk-nn9v1zmk.js → chunk-b0qqqk03.js} +86 -21
- package/dist/shared/{chunk-1wby7nex.js → chunk-dhehvmj0.js} +161 -9
- package/dist/shared/{chunk-wymw818z.js → chunk-fkbgbf3n.js} +48 -9
- package/dist/shared/{chunk-5dbq8jp9.js → chunk-j09yyh34.js} +72 -6
- package/dist/shared/chunk-mtsvrj9e.js +23 -0
- package/dist/shared/chunk-pnv25zep.js +7 -0
- package/dist/shared/{chunk-j6qyxfdc.js → chunk-vndfjfdy.js} +3 -3
- package/dist/src/auth/public.d.ts +56 -9
- package/dist/src/auth/public.js +189 -13
- package/dist/src/css/public.d.ts +110 -2
- package/dist/src/css/public.js +8 -4
- package/dist/src/form/public.d.ts +29 -6
- package/dist/src/form/public.js +2 -2
- package/dist/src/index.d.ts +284 -13
- package/dist/src/index.js +161 -14
- package/dist/src/internals.d.ts +141 -5
- package/dist/src/internals.js +17 -9
- package/dist/src/query/public.js +4 -3
- package/dist/src/router/public.d.ts +17 -4
- package/dist/src/router/public.js +17 -11
- package/dist/src/test/index.d.ts +5 -0
- package/dist/src/test/index.js +4 -3
- package/package.json +3 -3
- package/reactivity.json +1 -11
package/dist/src/form/public.js
CHANGED
package/dist/src/index.d.ts
CHANGED
|
@@ -262,6 +262,101 @@ declare function getInjectedCSS(): string[];
|
|
|
262
262
|
* @returns Object with block names as keys (class name strings) and non-enumerable `css` property.
|
|
263
263
|
*/
|
|
264
264
|
declare function css<T extends CSSInput>(input: T & { [K in keyof T & "css"]? : never }, filePath?: string): CSSOutput<T>;
|
|
265
|
+
interface FontSrc {
|
|
266
|
+
path: string;
|
|
267
|
+
weight?: string | number;
|
|
268
|
+
style?: "normal" | "italic";
|
|
269
|
+
}
|
|
270
|
+
type FallbackFontName = "Arial" | "Times New Roman" | "Courier New";
|
|
271
|
+
interface FontFallbackMetrics {
|
|
272
|
+
/** CSS ascent-override value, e.g., '94.52%' */
|
|
273
|
+
ascentOverride: string;
|
|
274
|
+
/** CSS descent-override value, e.g., '24.60%' */
|
|
275
|
+
descentOverride: string;
|
|
276
|
+
/** CSS line-gap-override value, e.g., '0.00%' */
|
|
277
|
+
lineGapOverride: string;
|
|
278
|
+
/** CSS size-adjust value, e.g., '104.88%' */
|
|
279
|
+
sizeAdjust: string;
|
|
280
|
+
/** System font used as fallback base. */
|
|
281
|
+
fallbackFont: FallbackFontName;
|
|
282
|
+
}
|
|
283
|
+
interface CompileFontsOptions {
|
|
284
|
+
/** Pre-computed fallback metrics per font key. Provided by @vertz/ui-server at build/SSR time. */
|
|
285
|
+
fallbackMetrics?: Record<string, FontFallbackMetrics>;
|
|
286
|
+
}
|
|
287
|
+
interface FontOptions {
|
|
288
|
+
/** Font weight: '100..1000' (variable) or 400 (fixed). */
|
|
289
|
+
weight: string | number;
|
|
290
|
+
/** Font style. @default 'normal' */
|
|
291
|
+
style?: "normal" | "italic";
|
|
292
|
+
/** Font-display strategy. @default 'swap' */
|
|
293
|
+
display?: "auto" | "block" | "swap" | "fallback" | "optional";
|
|
294
|
+
/** URL path(s) for local/self-hosted fonts. */
|
|
295
|
+
src?: string | FontSrc[];
|
|
296
|
+
/** Fallback font stack. */
|
|
297
|
+
fallback?: string[];
|
|
298
|
+
/** Font subsets (metadata only — subsetting is deferred to a future phase). @default ['latin'] */
|
|
299
|
+
subsets?: string[];
|
|
300
|
+
/** Unicode range for subsetting. */
|
|
301
|
+
unicodeRange?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Control automatic fallback font metric adjustment for zero-CLS font loading.
|
|
304
|
+
* - true: auto-detect fallback base from `fallback` array (default)
|
|
305
|
+
* - false: disable
|
|
306
|
+
* - 'Arial' | 'Times New Roman' | 'Courier New': explicit base
|
|
307
|
+
* @default true
|
|
308
|
+
*/
|
|
309
|
+
adjustFontFallback?: boolean | FallbackFontName;
|
|
310
|
+
}
|
|
311
|
+
type FontStyle = "normal" | "italic";
|
|
312
|
+
type FontDisplay = "auto" | "block" | "swap" | "fallback" | "optional";
|
|
313
|
+
interface FontDescriptor {
|
|
314
|
+
readonly __brand: "FontDescriptor";
|
|
315
|
+
readonly family: string;
|
|
316
|
+
readonly weight: string;
|
|
317
|
+
readonly style: FontStyle;
|
|
318
|
+
readonly display: FontDisplay;
|
|
319
|
+
readonly src?: string | FontSrc[];
|
|
320
|
+
readonly fallback: string[];
|
|
321
|
+
readonly subsets: string[];
|
|
322
|
+
readonly unicodeRange?: string;
|
|
323
|
+
readonly adjustFontFallback: boolean | FallbackFontName;
|
|
324
|
+
}
|
|
325
|
+
/** Structured description of a resource to preload. */
|
|
326
|
+
interface PreloadItem {
|
|
327
|
+
href: string;
|
|
328
|
+
as: "font" | "image" | "style" | "script";
|
|
329
|
+
type?: string;
|
|
330
|
+
crossorigin?: boolean;
|
|
331
|
+
}
|
|
332
|
+
interface CompiledFonts {
|
|
333
|
+
/** @font-face declarations. */
|
|
334
|
+
fontFaceCss: string;
|
|
335
|
+
/** :root { --font-<key>: ...; } block (for standalone use). */
|
|
336
|
+
cssVarsCss: string;
|
|
337
|
+
/** Individual CSS var lines (e.g., ' --font-sans: ...;') for merging into an existing :root. */
|
|
338
|
+
cssVarLines: string[];
|
|
339
|
+
/** <link rel="preload"> HTML tags for font files. */
|
|
340
|
+
preloadTags: string;
|
|
341
|
+
/** Structured preload data for generating HTTP Link headers. */
|
|
342
|
+
preloadItems: PreloadItem[];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Create a font descriptor for use in theme definitions.
|
|
346
|
+
*
|
|
347
|
+
* @param family - The font family name (e.g., 'DM Sans').
|
|
348
|
+
* @param options - Font configuration.
|
|
349
|
+
* @returns A FontDescriptor.
|
|
350
|
+
*/
|
|
351
|
+
declare function font(family: string, options: FontOptions): FontDescriptor;
|
|
352
|
+
/**
|
|
353
|
+
* Compile font descriptors into CSS and preload tags.
|
|
354
|
+
*
|
|
355
|
+
* @param fonts - A map of token key → FontDescriptor.
|
|
356
|
+
* @param options - Optional compilation settings (e.g., pre-computed fallback metrics).
|
|
357
|
+
* @returns Compiled @font-face CSS, CSS var lines, and preload link tags.
|
|
358
|
+
*/
|
|
359
|
+
declare function compileFonts(fonts: Record<string, FontDescriptor>, options?: CompileFontsOptions): CompiledFonts;
|
|
265
360
|
/** Input to globalCss(): selector → property-value map. */
|
|
266
361
|
type GlobalCSSInput = Record<string, Record<string, string>>;
|
|
267
362
|
/** Output of globalCss(): extracted CSS string. */
|
|
@@ -348,6 +443,8 @@ interface ThemeInput {
|
|
|
348
443
|
colors: ColorTokens;
|
|
349
444
|
/** Spacing scale tokens. */
|
|
350
445
|
spacing?: SpacingTokens;
|
|
446
|
+
/** Font descriptors keyed by token name (e.g., sans, mono, display). */
|
|
447
|
+
fonts?: Record<string, FontDescriptor>;
|
|
351
448
|
}
|
|
352
449
|
/** The structured theme object returned by defineTheme(). */
|
|
353
450
|
interface Theme {
|
|
@@ -355,6 +452,8 @@ interface Theme {
|
|
|
355
452
|
colors: ColorTokens;
|
|
356
453
|
/** Spacing scale tokens. */
|
|
357
454
|
spacing?: SpacingTokens;
|
|
455
|
+
/** Font descriptors keyed by token name. */
|
|
456
|
+
fonts?: Record<string, FontDescriptor>;
|
|
358
457
|
}
|
|
359
458
|
/** Output of compileTheme(). */
|
|
360
459
|
interface CompiledTheme {
|
|
@@ -362,6 +461,15 @@ interface CompiledTheme {
|
|
|
362
461
|
css: string;
|
|
363
462
|
/** Flat list of token dot-paths (e.g., 'primary.500', 'background'). */
|
|
364
463
|
tokens: string[];
|
|
464
|
+
/** Font preload link tags for injection into <head>. */
|
|
465
|
+
preloadTags: string;
|
|
466
|
+
/** Structured preload data for generating HTTP Link headers. */
|
|
467
|
+
preloadItems: PreloadItem[];
|
|
468
|
+
}
|
|
469
|
+
/** Options for compileTheme(). */
|
|
470
|
+
interface CompileThemeOptions {
|
|
471
|
+
/** Pre-computed font fallback metrics for zero-CLS font loading. */
|
|
472
|
+
fallbackMetrics?: CompileFontsOptions["fallbackMetrics"];
|
|
365
473
|
}
|
|
366
474
|
/**
|
|
367
475
|
* Define a theme with raw and contextual design tokens.
|
|
@@ -380,7 +488,7 @@ declare function defineTheme(input: ThemeInput): Theme;
|
|
|
380
488
|
* @param theme - A theme object from defineTheme().
|
|
381
489
|
* @returns Compiled CSS and token list.
|
|
382
490
|
*/
|
|
383
|
-
declare function compileTheme(theme: Theme): CompiledTheme;
|
|
491
|
+
declare function compileTheme(theme: Theme, options?: CompileThemeOptions): CompiledTheme;
|
|
384
492
|
/** A child node: either a DOM Node or a string (text content). */
|
|
385
493
|
type ThemeChild = Node | string;
|
|
386
494
|
/** Props for ThemeProvider. */
|
|
@@ -551,6 +659,17 @@ declare function __enterChildren(el: Element): void;
|
|
|
551
659
|
* Compiler output target — emitted after all children are appended.
|
|
552
660
|
*/
|
|
553
661
|
declare function __exitChildren(): void;
|
|
662
|
+
/**
|
|
663
|
+
* Returns true when running in a real browser environment.
|
|
664
|
+
* Returns false on the server, even if `window` exists (DOM shim).
|
|
665
|
+
*
|
|
666
|
+
* Uses `hasSSRResolver()` — which returns true when an SSR resolver
|
|
667
|
+
* has been registered — instead of `getSSRContext()` which only returns
|
|
668
|
+
* a value inside `ssrStorage.run()`. This correctly identifies server
|
|
669
|
+
* module-scope code (e.g., HMR re-imports where `createRouter()` runs
|
|
670
|
+
* at import time, outside any SSR render context).
|
|
671
|
+
*/
|
|
672
|
+
declare function isBrowser(): boolean;
|
|
554
673
|
interface FieldState<T = unknown> {
|
|
555
674
|
error: Signal<string | undefined>;
|
|
556
675
|
dirty: Signal<boolean>;
|
|
@@ -621,8 +740,27 @@ interface SdkMethodWithMeta<
|
|
|
621
740
|
}
|
|
622
741
|
/** Reserved property names that cannot be used as field names on FormInstance. */
|
|
623
742
|
type ReservedFormNames = "submitting" | "dirty" | "valid" | "action" | "method" | "onSubmit" | "reset" | "setFieldError" | "submit" | "fields" | "__bindElement";
|
|
624
|
-
/**
|
|
625
|
-
type
|
|
743
|
+
/** Built-in object types that should NOT recurse into NestedFieldAccessors. */
|
|
744
|
+
type BuiltInObjects = Date | RegExp | File | Blob | Map<unknown, unknown> | Set<unknown>;
|
|
745
|
+
/** FieldState signal/method property names that conflict with nested field names. */
|
|
746
|
+
type FieldSignalReservedNames = "error" | "dirty" | "touched" | "value" | "setValue" | "reset";
|
|
747
|
+
/** Check if any key of T collides with FieldState property names. */
|
|
748
|
+
type HasReservedFieldName<T> = keyof T & FieldSignalReservedNames extends never ? false : true;
|
|
749
|
+
/** Recursive field accessors for nested schemas. */
|
|
750
|
+
type NestedFieldAccessors<T> = { [K in keyof T] : T[K] extends BuiltInObjects ? FieldState<T[K]> : T[K] extends Array<infer U> ? FieldState<T[K]> & ArrayFieldAccessors<U> : T[K] extends Record<string, unknown> ? HasReservedFieldName<T[K]> extends true ? {
|
|
751
|
+
__error: `Nested field name conflicts with FieldState property: ${keyof T[K] & FieldSignalReservedNames & string}`;
|
|
752
|
+
} : FieldState<T[K]> & NestedFieldAccessors<T[K]> : FieldState<T[K]> };
|
|
753
|
+
/** Array field accessors — numeric index access to element-level fields. */
|
|
754
|
+
type ArrayFieldAccessors<U> = {
|
|
755
|
+
[index: number]: U extends BuiltInObjects ? FieldState<U> : U extends Record<string, unknown> ? FieldState<U> & NestedFieldAccessors<U> : FieldState<U>;
|
|
756
|
+
};
|
|
757
|
+
/** Deep partial utility for initial values. */
|
|
758
|
+
type DeepPartial<T> = { [K in keyof T]? : T[K] extends Array<infer U> ? Array<DeepPartial<U>> : T[K] extends Record<string, unknown> ? DeepPartial<T[K]> : T[K] };
|
|
759
|
+
/** Union of all valid dot-paths through a nested type. */
|
|
760
|
+
type FieldPath<
|
|
761
|
+
T,
|
|
762
|
+
Prefix extends string = ""
|
|
763
|
+
> = `${Prefix}${keyof T & string}` | { [K in keyof T & string] : T[K] extends Record<string, unknown> ? FieldPath<T[K], `${Prefix}${K}.`> : never }[keyof T & string];
|
|
626
764
|
/** Mapped type providing typed field name strings for compile-time input validation. */
|
|
627
765
|
type FieldNames<TBody> = { readonly [K in keyof TBody & string] : K };
|
|
628
766
|
/** Base properties available on every form instance. */
|
|
@@ -631,7 +769,7 @@ interface FormBaseProperties<TBody> {
|
|
|
631
769
|
method: string;
|
|
632
770
|
onSubmit: (e: Event) => Promise<void>;
|
|
633
771
|
reset: () => void;
|
|
634
|
-
setFieldError: (field:
|
|
772
|
+
setFieldError: (field: FieldPath<TBody>, message: string) => void;
|
|
635
773
|
submit: (formData?: FormData) => Promise<void>;
|
|
636
774
|
submitting: Signal<boolean>;
|
|
637
775
|
dirty: ReadonlySignal<boolean>;
|
|
@@ -648,7 +786,7 @@ interface FormBaseProperties<TBody> {
|
|
|
648
786
|
type FormInstance<
|
|
649
787
|
TBody,
|
|
650
788
|
_TResult
|
|
651
|
-
> = keyof TBody & ReservedFormNames extends never ? FormBaseProperties<TBody> &
|
|
789
|
+
> = keyof TBody & ReservedFormNames extends never ? FormBaseProperties<TBody> & NestedFieldAccessors<TBody> : {
|
|
652
790
|
__error: `Field name conflicts with reserved form property: ${keyof TBody & ReservedFormNames & string}`;
|
|
653
791
|
};
|
|
654
792
|
/** Options for creating a form instance. */
|
|
@@ -658,8 +796,8 @@ interface FormOptions<
|
|
|
658
796
|
> {
|
|
659
797
|
/** Explicit schema for client-side validation before submission. */
|
|
660
798
|
schema?: FormSchema<TBody>;
|
|
661
|
-
/** Initial values for form fields. */
|
|
662
|
-
initial?:
|
|
799
|
+
/** Initial values for form fields. Supports nested partial values. */
|
|
800
|
+
initial?: DeepPartial<TBody> | (() => DeepPartial<TBody>);
|
|
663
801
|
/** Callback invoked after a successful submission. */
|
|
664
802
|
onSuccess?: (result: TResult) => void;
|
|
665
803
|
/** Callback invoked when validation or submission fails. */
|
|
@@ -688,6 +826,8 @@ declare function form<
|
|
|
688
826
|
interface FormDataOptions {
|
|
689
827
|
/** When true, coerces numeric strings to numbers and "true"/"false" to booleans. */
|
|
690
828
|
coerce?: boolean;
|
|
829
|
+
/** When true, parses dot-separated keys into nested objects (e.g., "address.street" → { address: { street: ... } }). */
|
|
830
|
+
nested?: boolean;
|
|
691
831
|
}
|
|
692
832
|
/**
|
|
693
833
|
* Convert FormData to a plain object.
|
|
@@ -702,8 +842,8 @@ declare function formDataToObject(formData: FormData, options?: FormDataOptions)
|
|
|
702
842
|
type ComponentLoader = () => Promise<{
|
|
703
843
|
default: ComponentFunction;
|
|
704
844
|
}>;
|
|
705
|
-
/** A component function that takes props and an element to mount into. */
|
|
706
|
-
type ComponentFunction = (props: Record<string, unknown>, el
|
|
845
|
+
/** A component function that takes props and optionally an element to mount into. May return a Node. */
|
|
846
|
+
type ComponentFunction = (props: Record<string, unknown>, el?: Element) => Node | void;
|
|
707
847
|
/** Maps component IDs to their dynamic import loaders. */
|
|
708
848
|
type ComponentRegistry = Record<string, ComponentLoader>;
|
|
709
849
|
/**
|
|
@@ -721,6 +861,55 @@ type ComponentRegistry = Record<string, ComponentLoader>;
|
|
|
721
861
|
*/
|
|
722
862
|
declare function hydrate(registry: ComponentRegistry): void;
|
|
723
863
|
/**
|
|
864
|
+
* Registry mapping island IDs to lazy component loaders.
|
|
865
|
+
* Each key must match the `id` prop of an `<Island>` component in the SSR output.
|
|
866
|
+
*/
|
|
867
|
+
type IslandRegistry = Record<string, ComponentLoader>;
|
|
868
|
+
/**
|
|
869
|
+
* Client entry point for island-mode hydration.
|
|
870
|
+
*
|
|
871
|
+
* Scans the DOM for elements with `data-v-island` markers placed by the
|
|
872
|
+
* `<Island>` component during SSR. For each, deserializes props and hydrates
|
|
873
|
+
* the component using viewport-based lazy hydration (IntersectionObserver).
|
|
874
|
+
*
|
|
875
|
+
* This is an alternative to `mount()` for pages that are mostly static
|
|
876
|
+
* with a few interactive islands. Never call both `mount()` and
|
|
877
|
+
* `hydrateIslands()` on the same page.
|
|
878
|
+
*/
|
|
879
|
+
declare function hydrateIslands(registry: IslandRegistry): void;
|
|
880
|
+
declare function configureImageOptimizer(baseUrl: string): void;
|
|
881
|
+
declare function buildOptimizedUrl(src: string, width: number, height: number, quality: number, fit: "cover" | "contain" | "fill"): string | null;
|
|
882
|
+
interface ImageProps {
|
|
883
|
+
src: string;
|
|
884
|
+
width: number;
|
|
885
|
+
height: number;
|
|
886
|
+
alt: string;
|
|
887
|
+
class?: string;
|
|
888
|
+
pictureClass?: string;
|
|
889
|
+
style?: string;
|
|
890
|
+
loading?: "lazy" | "eager";
|
|
891
|
+
decoding?: "async" | "sync" | "auto";
|
|
892
|
+
fetchpriority?: "high" | "low" | "auto";
|
|
893
|
+
priority?: boolean;
|
|
894
|
+
quality?: number;
|
|
895
|
+
fit?: "cover" | "contain" | "fill";
|
|
896
|
+
[key: string]: unknown;
|
|
897
|
+
}
|
|
898
|
+
declare function Image(props: ImageProps): HTMLImageElement;
|
|
899
|
+
interface IslandProps {
|
|
900
|
+
/**
|
|
901
|
+
* Unique identifier matching the client-side registry key.
|
|
902
|
+
* Auto-generated by the compiler from the file path and component name.
|
|
903
|
+
* Can be manually specified to override the generated ID.
|
|
904
|
+
*/
|
|
905
|
+
id?: string;
|
|
906
|
+
/** The component function to render */
|
|
907
|
+
component: (props: Record<string, unknown>) => unknown;
|
|
908
|
+
/** Props to pass to the component (must be JSON-serializable) */
|
|
909
|
+
props?: Record<string, unknown>;
|
|
910
|
+
}
|
|
911
|
+
declare function Island({ id, component: Component, props }: IslandProps): HTMLDivElement;
|
|
912
|
+
/**
|
|
724
913
|
* Options for mounting an app to the DOM.
|
|
725
914
|
*/
|
|
726
915
|
interface MountOptions {
|
|
@@ -966,6 +1155,8 @@ interface RouteConfig<
|
|
|
966
1155
|
searchParams?: SearchParamSchema<TSearch>;
|
|
967
1156
|
/** Nested child routes. */
|
|
968
1157
|
children?: RouteDefinitionMap;
|
|
1158
|
+
/** Whether to pre-render this route at build time (default: true for static routes). */
|
|
1159
|
+
prerender?: boolean;
|
|
969
1160
|
}
|
|
970
1161
|
/** A map of path patterns to route configs (user input format). */
|
|
971
1162
|
interface RouteDefinitionMap {
|
|
@@ -995,6 +1186,7 @@ interface RouteConfigLike {
|
|
|
995
1186
|
params?: ParamSchema<unknown>;
|
|
996
1187
|
searchParams?: SearchParamSchema<unknown>;
|
|
997
1188
|
children?: Record<string, RouteConfigLike>;
|
|
1189
|
+
prerender?: boolean;
|
|
998
1190
|
}
|
|
999
1191
|
/**
|
|
1000
1192
|
* Phantom branded array that carries the route map type `T`.
|
|
@@ -1028,6 +1220,8 @@ interface CompiledRoute {
|
|
|
1028
1220
|
searchParams?: RouteConfig["searchParams"];
|
|
1029
1221
|
/** Compiled children. */
|
|
1030
1222
|
children?: CompiledRoute[];
|
|
1223
|
+
/** Whether to pre-render this route at build time (default: true for static routes). */
|
|
1224
|
+
prerender?: boolean;
|
|
1031
1225
|
}
|
|
1032
1226
|
/** A single matched route entry in the matched chain. */
|
|
1033
1227
|
interface MatchedRoute {
|
|
@@ -1072,8 +1266,8 @@ declare function defineRoutes<const T extends Record<string, RouteConfigLike>>(m
|
|
|
1072
1266
|
interface LinkProps<T extends Record<string, RouteConfigLike> = RouteDefinitionMap> {
|
|
1073
1267
|
/** The target URL path. */
|
|
1074
1268
|
href: RoutePaths<T>;
|
|
1075
|
-
/** Text or content for the link.
|
|
1076
|
-
children: string | (() => string | Node);
|
|
1269
|
+
/** Text or content for the link. Accepts string, Node, or a thunk returning either. */
|
|
1270
|
+
children: string | Node | (() => string | Node);
|
|
1077
1271
|
/** Class applied when the link's href matches the current path. */
|
|
1078
1272
|
activeClass?: string;
|
|
1079
1273
|
/** Static class name for the anchor element. */
|
|
@@ -1094,6 +1288,13 @@ interface LinkFactoryOptions {
|
|
|
1094
1288
|
* @returns A Link component function
|
|
1095
1289
|
*/
|
|
1096
1290
|
declare function createLink(currentPath: ReadonlySignal<string>, navigate: (url: string) => void, factoryOptions?: LinkFactoryOptions): (props: LinkProps) => HTMLAnchorElement;
|
|
1291
|
+
/**
|
|
1292
|
+
* Context-based Link component for client-side navigation.
|
|
1293
|
+
*
|
|
1294
|
+
* Reads the router from `RouterContext` automatically — no manual wiring needed.
|
|
1295
|
+
* Just use `<Link href="/about">About</Link>` inside a router-provided tree.
|
|
1296
|
+
*/
|
|
1297
|
+
declare function Link({ href, children, activeClass, className }: LinkProps): HTMLAnchorElement;
|
|
1097
1298
|
type NavigateSearchValue = string | number | boolean | null | undefined;
|
|
1098
1299
|
type NavigateSearch = string | URLSearchParams | Record<string, NavigateSearchValue | readonly NavigateSearchValue[]>;
|
|
1099
1300
|
/** Options for router.navigate(). */
|
|
@@ -1175,7 +1376,8 @@ type TypedRouter<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>
|
|
|
1175
1376
|
* @param initialUrl - The initial URL to match (optional; auto-detects from window.location or SSR context)
|
|
1176
1377
|
* @returns Router instance with reactive state and navigation methods
|
|
1177
1378
|
*/
|
|
1178
|
-
declare function createRouter<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>(routes: TypedRoutes<T>, initialUrl
|
|
1379
|
+
declare function createRouter<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>(routes: TypedRoutes<T>, initialUrl: string, options?: RouterOptions): Router<T>;
|
|
1380
|
+
declare function createRouter<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>(routes: TypedRoutes<T>, options?: RouterOptions): Router<T>;
|
|
1179
1381
|
/** Context value for the Outlet. */
|
|
1180
1382
|
interface OutletContextValue {
|
|
1181
1383
|
/** Reactive child component factory (may return async module). */
|
|
@@ -1313,11 +1515,22 @@ interface SerializedStore {
|
|
|
1313
1515
|
}>;
|
|
1314
1516
|
}
|
|
1315
1517
|
/**
|
|
1518
|
+
* Options for mergeWithSelect — metadata about field selection.
|
|
1519
|
+
*/
|
|
1520
|
+
interface MergeSelectOptions {
|
|
1521
|
+
/** Fields that were part of the query's select set */
|
|
1522
|
+
fields: string[];
|
|
1523
|
+
/** Query source identifier for diagnostics (e.g., 'GET:/users') */
|
|
1524
|
+
querySource: string;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1316
1527
|
* Options for EntityStore constructor.
|
|
1317
1528
|
*/
|
|
1318
1529
|
interface EntityStoreOptions {
|
|
1319
1530
|
/** Initial data to hydrate from (SSR). */
|
|
1320
1531
|
initialData?: SerializedStore;
|
|
1532
|
+
/** Enable dev-mode field selection tracking (zero overhead when false). */
|
|
1533
|
+
devMode?: boolean;
|
|
1321
1534
|
}
|
|
1322
1535
|
/**
|
|
1323
1536
|
* EntityStore - Normalized, signal-backed entity cache for @vertz/ui.
|
|
@@ -1329,6 +1542,7 @@ declare class EntityStore {
|
|
|
1329
1542
|
private _entities;
|
|
1330
1543
|
private _typeListeners;
|
|
1331
1544
|
private _queryIndices;
|
|
1545
|
+
private _fieldTracker;
|
|
1332
1546
|
/** Public accessor for query indices — used by optimistic handlers and tests. */
|
|
1333
1547
|
get queryIndices(): QueryResultIndex;
|
|
1334
1548
|
constructor(options?: EntityStoreOptions);
|
|
@@ -1352,6 +1566,14 @@ declare class EntityStore {
|
|
|
1352
1566
|
id: string;
|
|
1353
1567
|
}>(type: string, data: T | T[]): void;
|
|
1354
1568
|
/**
|
|
1569
|
+
* Merge entities with field selection metadata.
|
|
1570
|
+
* Registers the select set for dev-mode access warnings.
|
|
1571
|
+
* In production (devMode: false), behaves identically to merge().
|
|
1572
|
+
*/
|
|
1573
|
+
mergeWithSelect<T extends {
|
|
1574
|
+
id: string;
|
|
1575
|
+
}>(type: string, data: T | T[], selectOptions: MergeSelectOptions): void;
|
|
1576
|
+
/**
|
|
1355
1577
|
* Remove an entity from the store.
|
|
1356
1578
|
* Triggers type change listeners and removes from query indices.
|
|
1357
1579
|
*/
|
|
@@ -1437,8 +1659,15 @@ declare class EntityStore {
|
|
|
1437
1659
|
private _mergeOne;
|
|
1438
1660
|
/**
|
|
1439
1661
|
* Recompute the visible signal value from base + all layers.
|
|
1662
|
+
* Uses lastPlainVisible for equality check to avoid triggering
|
|
1663
|
+
* field selection Proxy warnings during internal store operations.
|
|
1440
1664
|
*/
|
|
1441
1665
|
private _recomputeVisible;
|
|
1666
|
+
/**
|
|
1667
|
+
* Wrap entity in dev-mode Proxy for field selection warnings.
|
|
1668
|
+
* No-op when devMode is off or no tracking exists.
|
|
1669
|
+
*/
|
|
1670
|
+
private _wrapWithFieldProxy;
|
|
1442
1671
|
private _getOrCreateTypeMap;
|
|
1443
1672
|
private _getOrCreateListeners;
|
|
1444
1673
|
private _notifyTypeChange;
|
|
@@ -1467,6 +1696,48 @@ declare class QueryEnvelopeStore {
|
|
|
1467
1696
|
declare function getEntityStore(): EntityStore;
|
|
1468
1697
|
/** Get the global QueryEnvelopeStore singleton. */
|
|
1469
1698
|
declare function getQueryEnvelopeStore(): QueryEnvelopeStore;
|
|
1699
|
+
type FieldMissCallback = (type: string, id: string, field: string, querySource: string) => void;
|
|
1700
|
+
interface FieldSelectionTrackerOptions {
|
|
1701
|
+
onMiss?: FieldMissCallback;
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Tracks field selection metadata per entity for dev-mode access warnings.
|
|
1705
|
+
*/
|
|
1706
|
+
declare class FieldSelectionTracker {
|
|
1707
|
+
private _selectInfo;
|
|
1708
|
+
/** Dedup: tracks which field warnings have already been emitted */
|
|
1709
|
+
private _warned;
|
|
1710
|
+
private _onMiss;
|
|
1711
|
+
constructor(options?: FieldSelectionTrackerOptions);
|
|
1712
|
+
/**
|
|
1713
|
+
* Register that a query with field selection fetched this entity.
|
|
1714
|
+
* Fields are unioned across all queries.
|
|
1715
|
+
*/
|
|
1716
|
+
registerSelect(type: string, id: string, fields: string[], querySource: string): void;
|
|
1717
|
+
/**
|
|
1718
|
+
* Register that a query without field selection fetched this entity.
|
|
1719
|
+
* Disables warnings for this entity (full fetch = all fields known).
|
|
1720
|
+
*/
|
|
1721
|
+
registerFullFetch(type: string, id: string): void;
|
|
1722
|
+
/**
|
|
1723
|
+
* Check if a field access should trigger a warning.
|
|
1724
|
+
*/
|
|
1725
|
+
shouldWarn(type: string, id: string, field: string): boolean;
|
|
1726
|
+
/**
|
|
1727
|
+
* Remove tracking data for an entity (called when entity is removed/evicted).
|
|
1728
|
+
*/
|
|
1729
|
+
removeEntity(type: string, id: string): void;
|
|
1730
|
+
/**
|
|
1731
|
+
* Wrap an entity object in a dev-mode Proxy that warns on non-selected field access.
|
|
1732
|
+
* Returns the original object if no select tracking exists for this entity.
|
|
1733
|
+
* Each unique (type, id, field) combination warns only once.
|
|
1734
|
+
*/
|
|
1735
|
+
createDevProxy<T extends Record<string, unknown>>(entity: T, type: string, id: string): T;
|
|
1736
|
+
/**
|
|
1737
|
+
* Clear all tracking data.
|
|
1738
|
+
*/
|
|
1739
|
+
clear(): void;
|
|
1740
|
+
}
|
|
1470
1741
|
/**
|
|
1471
1742
|
* MutationEventBus — simple pub/sub for same-type query revalidation.
|
|
1472
1743
|
*
|
|
@@ -1523,4 +1794,4 @@ declare function resetRelationSchemas_TEST_ONLY(): void;
|
|
|
1523
1794
|
* ```
|
|
1524
1795
|
*/
|
|
1525
1796
|
declare function createTestStore(data: Record<string, Record<string, unknown>>): EntityStore;
|
|
1526
|
-
export { zoomOut, zoomIn, variants, validate, useSearchParams, useRouter, useParams, useDialogStack, useContext, untrack, slideOutToTop, slideOutToRight, slideOutToLeft, slideOutToBottom, slideInFromTop, slideInFromRight, slideInFromLeft, slideInFromBottom, signal, setAdapter, s, resolveChildren, resetRelationSchemas_TEST_ONLY, resetInjectedStyles, registerRelationSchema, ref, queryMatch, query, parseSearchParams, palettes, onMount2 as onMount, mount, keyframes, isRenderNode, isQueryDescriptor, invalidate, injectCSS, hydrate, globalCss, getRelationSchema, getQueryEnvelopeStore, getInjectedCSS, getEntityStore, getAdapter, formDataToObject, form, fadeOut, fadeIn, defineTheme, defineRoutes, css, createTestStore, createRouter, createOptimisticHandler, createLink, createFieldState, createDialogStack, createDOMAdapter, createContext, computed, compileTheme, children, batch, accordionUp, accordionDown, __staticText, __exitChildren, __enterChildren, __element, __append, VariantsConfig, VariantProps, VariantFunction, ValidationResult, UnwrapSignals, TypedRoutes, TypedRouter, ThemeProviderProps, ThemeProvider, ThemeInput, Theme, SuspenseProps, Suspense, StyleValue, StyleEntry, Signal, SerializedStore, SearchParamSchema, SdkMethodWithMeta, SdkMethod, RouterViewProps, RouterView, RouterOptions, RouterContext, Router, RoutePattern, RoutePaths, RouteMatch, RouteDefinitionMap, RouteConfig, RenderText, RenderNode, RenderElement, RenderAdapter, RelationSchema, RelationFieldDef, Ref, ReadonlySignal, RawDeclaration, RENDER_NODE_BRAND, QueryResult, QueryOptions, QueryMatchHandlers, QueryEnvelopeStore, QueryEnvelope, QueryDescriptor3 as QueryDescriptor, PresenceProps, Presence, PathWithParams, ParamSchema, OutletContextValue, OutletContext, Outlet, NavigateOptions, NavigateInput, MountOptions, MountHandle, MatchedRoute, LoaderData, ListTransitionProps, ListTransition, LinkProps, LinkFactoryOptions, InferRouteMap, GlobalCSSOutput, GlobalCSSInput, FormSchema, FormOptions, FormInstance, FormDataOptions, FieldState, ExtractParams, ErrorBoundaryProps, ErrorBoundary, EntityStoreOptions, EntityStore, DisposeFn, DisposalScopeError, DialogStackContext, DialogStack, DialogHandle, DialogDismissedError, DialogComponent, Context, Computed, ComponentRegistry, ComponentLoader, ComponentFunction, CompiledTheme, CompiledRoute, ColorPalette, ChildrenAccessor, ChildValue, CacheStore, CSSOutput, CSSInput, ANIMATION_EASING, ANIMATION_DURATION };
|
|
1797
|
+
export { zoomOut, zoomIn, variants, validate, useSearchParams, useRouter, useParams, useDialogStack, useContext, untrack, slideOutToTop, slideOutToRight, slideOutToLeft, slideOutToBottom, slideInFromTop, slideInFromRight, slideInFromLeft, slideInFromBottom, signal, setAdapter, s, resolveChildren, resetRelationSchemas_TEST_ONLY, resetInjectedStyles, registerRelationSchema, ref, queryMatch, query, parseSearchParams, palettes, onMount2 as onMount, mount, keyframes, isRenderNode, isQueryDescriptor, isBrowser, invalidate, injectCSS, hydrateIslands, hydrate, globalCss, getRelationSchema, getQueryEnvelopeStore, getInjectedCSS, getEntityStore, getAdapter, formDataToObject, form, font, fadeOut, fadeIn, defineTheme, defineRoutes, css, createTestStore, createRouter, createOptimisticHandler, createLink, createFieldState, createDialogStack, createDOMAdapter, createContext, configureImageOptimizer, computed, compileTheme, compileFonts, children, buildOptimizedUrl, batch, accordionUp, accordionDown, __staticText, __exitChildren, __enterChildren, __element, __append, VariantsConfig, VariantProps, VariantFunction, ValidationResult, UnwrapSignals, TypedRoutes, TypedRouter, ThemeProviderProps, ThemeProvider, ThemeInput, Theme, SuspenseProps, Suspense, StyleValue, StyleEntry, Signal, SerializedStore, SearchParamSchema, SdkMethodWithMeta, SdkMethod, RouterViewProps, RouterView, RouterOptions, RouterContext, Router, RoutePattern, RoutePaths, RouteMatch, RouteDefinitionMap, RouteConfig, RenderText, RenderNode, RenderElement, RenderAdapter, RelationSchema, RelationFieldDef, Ref, ReadonlySignal, RawDeclaration, RENDER_NODE_BRAND, QueryResult, QueryOptions, QueryMatchHandlers, QueryEnvelopeStore, QueryEnvelope, QueryDescriptor3 as QueryDescriptor, PresenceProps, Presence, PreloadItem, PathWithParams, ParamSchema, OutletContextValue, OutletContext, Outlet, NavigateOptions, NavigateInput, MountOptions, MountHandle, MergeSelectOptions, MatchedRoute, LoaderData, ListTransitionProps, ListTransition, LinkProps, LinkFactoryOptions, Link, IslandRegistry, IslandProps, Island, InferRouteMap, ImageProps, Image, GlobalCSSOutput, GlobalCSSInput, FormSchema, FormOptions, FormInstance, FormDataOptions, FontSrc, FontOptions, FontFallbackMetrics, FontDescriptor, FieldState, FieldSelectionTracker, FallbackFontName, ExtractParams, ErrorBoundaryProps, ErrorBoundary, EntityStoreOptions, EntityStore, DisposeFn, DisposalScopeError, DialogStackContext, DialogStack, DialogHandle, DialogDismissedError, DialogComponent, Context, Computed, ComponentRegistry, ComponentLoader, ComponentFunction, CompiledTheme, CompiledRoute, CompiledFonts, CompileThemeOptions, CompileFontsOptions, ColorPalette, ChildrenAccessor, ChildValue, CacheStore, CSSOutput, CSSInput, ANIMATION_EASING, ANIMATION_DURATION };
|