@vertz/ui 0.2.14 → 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-2sth83bd.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-c9xxsrat.js → chunk-dhehvmj0.js} +179 -10
- package/dist/shared/{chunk-mj7b4t40.js → chunk-fkbgbf3n.js} +98 -11
- package/dist/shared/{chunk-c30eg6wn.js → chunk-j09yyh34.js} +79 -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 +69 -9
- package/dist/src/auth/public.js +217 -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 +33 -7
- package/dist/src/form/public.js +2 -2
- package/dist/src/index.d.ts +311 -20
- 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 +39 -9
- package/dist/src/router/public.js +17 -11
- package/dist/src/test/index.d.ts +26 -23
- package/dist/src/test/index.js +5 -4
- package/package.json +3 -3
- package/reactivity.json +1 -11
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>;
|
|
@@ -620,20 +739,42 @@ interface SdkMethodWithMeta<
|
|
|
620
739
|
};
|
|
621
740
|
}
|
|
622
741
|
/** Reserved property names that cannot be used as field names on FormInstance. */
|
|
623
|
-
type ReservedFormNames = "submitting" | "dirty" | "valid" | "action" | "method" | "onSubmit" | "reset" | "setFieldError" | "submit" | "__bindElement";
|
|
624
|
-
/**
|
|
625
|
-
type
|
|
742
|
+
type ReservedFormNames = "submitting" | "dirty" | "valid" | "action" | "method" | "onSubmit" | "reset" | "setFieldError" | "submit" | "fields" | "__bindElement";
|
|
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];
|
|
764
|
+
/** Mapped type providing typed field name strings for compile-time input validation. */
|
|
765
|
+
type FieldNames<TBody> = { readonly [K in keyof TBody & string] : K };
|
|
626
766
|
/** Base properties available on every form instance. */
|
|
627
767
|
interface FormBaseProperties<TBody> {
|
|
628
768
|
action: string;
|
|
629
769
|
method: string;
|
|
630
770
|
onSubmit: (e: Event) => Promise<void>;
|
|
631
771
|
reset: () => void;
|
|
632
|
-
setFieldError: (field:
|
|
772
|
+
setFieldError: (field: FieldPath<TBody>, message: string) => void;
|
|
633
773
|
submit: (formData?: FormData) => Promise<void>;
|
|
634
774
|
submitting: Signal<boolean>;
|
|
635
775
|
dirty: ReadonlySignal<boolean>;
|
|
636
776
|
valid: ReadonlySignal<boolean>;
|
|
777
|
+
fields: FieldNames<TBody>;
|
|
637
778
|
__bindElement: (el: HTMLFormElement) => void;
|
|
638
779
|
}
|
|
639
780
|
/**
|
|
@@ -645,7 +786,7 @@ interface FormBaseProperties<TBody> {
|
|
|
645
786
|
type FormInstance<
|
|
646
787
|
TBody,
|
|
647
788
|
_TResult
|
|
648
|
-
> = keyof TBody & ReservedFormNames extends never ? FormBaseProperties<TBody> &
|
|
789
|
+
> = keyof TBody & ReservedFormNames extends never ? FormBaseProperties<TBody> & NestedFieldAccessors<TBody> : {
|
|
649
790
|
__error: `Field name conflicts with reserved form property: ${keyof TBody & ReservedFormNames & string}`;
|
|
650
791
|
};
|
|
651
792
|
/** Options for creating a form instance. */
|
|
@@ -655,8 +796,8 @@ interface FormOptions<
|
|
|
655
796
|
> {
|
|
656
797
|
/** Explicit schema for client-side validation before submission. */
|
|
657
798
|
schema?: FormSchema<TBody>;
|
|
658
|
-
/** Initial values for form fields. */
|
|
659
|
-
initial?:
|
|
799
|
+
/** Initial values for form fields. Supports nested partial values. */
|
|
800
|
+
initial?: DeepPartial<TBody> | (() => DeepPartial<TBody>);
|
|
660
801
|
/** Callback invoked after a successful submission. */
|
|
661
802
|
onSuccess?: (result: TResult) => void;
|
|
662
803
|
/** Callback invoked when validation or submission fails. */
|
|
@@ -685,6 +826,8 @@ declare function form<
|
|
|
685
826
|
interface FormDataOptions {
|
|
686
827
|
/** When true, coerces numeric strings to numbers and "true"/"false" to booleans. */
|
|
687
828
|
coerce?: boolean;
|
|
829
|
+
/** When true, parses dot-separated keys into nested objects (e.g., "address.street" → { address: { street: ... } }). */
|
|
830
|
+
nested?: boolean;
|
|
688
831
|
}
|
|
689
832
|
/**
|
|
690
833
|
* Convert FormData to a plain object.
|
|
@@ -699,8 +842,8 @@ declare function formDataToObject(formData: FormData, options?: FormDataOptions)
|
|
|
699
842
|
type ComponentLoader = () => Promise<{
|
|
700
843
|
default: ComponentFunction;
|
|
701
844
|
}>;
|
|
702
|
-
/** A component function that takes props and an element to mount into. */
|
|
703
|
-
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;
|
|
704
847
|
/** Maps component IDs to their dynamic import loaders. */
|
|
705
848
|
type ComponentRegistry = Record<string, ComponentLoader>;
|
|
706
849
|
/**
|
|
@@ -718,6 +861,55 @@ type ComponentRegistry = Record<string, ComponentLoader>;
|
|
|
718
861
|
*/
|
|
719
862
|
declare function hydrate(registry: ComponentRegistry): void;
|
|
720
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
|
+
/**
|
|
721
913
|
* Options for mounting an app to the DOM.
|
|
722
914
|
*/
|
|
723
915
|
interface MountOptions {
|
|
@@ -915,6 +1107,8 @@ type ExtractParams<T extends string> = [ExtractParamsFromSegments<WithoutWildcar
|
|
|
915
1107
|
* - Fallback: `string` → `string` (backward compat)
|
|
916
1108
|
*/
|
|
917
1109
|
type PathWithParams<T extends string> = T extends `${infer Before}*` ? `${PathWithParams<Before>}${string}` : T extends `${infer Before}:${string}/${infer After}` ? `${Before}${string}/${PathWithParams<`${After}`>}` : T extends `${infer Before}:${string}` ? `${Before}${string}` : T;
|
|
1110
|
+
/** Union of route pattern keys from a route map. */
|
|
1111
|
+
type RoutePattern<TRouteMap extends Record<string, unknown>> = keyof TRouteMap & string;
|
|
918
1112
|
/**
|
|
919
1113
|
* Union of all valid URL shapes for a route map.
|
|
920
1114
|
* Maps each route pattern key through `PathWithParams` to produce the accepted URL shapes.
|
|
@@ -924,7 +1118,7 @@ type PathWithParams<T extends string> = T extends `${infer Before}*` ? `${PathWi
|
|
|
924
1118
|
* RoutePaths<{ '/': ..., '/tasks/:id': ... }> = '/' | `/tasks/${string}`
|
|
925
1119
|
* ```
|
|
926
1120
|
*/
|
|
927
|
-
type RoutePaths<TRouteMap extends Record<string, unknown>> = { [K in
|
|
1121
|
+
type RoutePaths<TRouteMap extends Record<string, unknown>> = { [K in RoutePattern<TRouteMap>] : PathWithParams<K> }[RoutePattern<TRouteMap>];
|
|
928
1122
|
/** Schema interface for parsing and validating values (search params, path params). */
|
|
929
1123
|
interface SearchParamSchema<T> {
|
|
930
1124
|
parse(data: unknown): {
|
|
@@ -961,6 +1155,8 @@ interface RouteConfig<
|
|
|
961
1155
|
searchParams?: SearchParamSchema<TSearch>;
|
|
962
1156
|
/** Nested child routes. */
|
|
963
1157
|
children?: RouteDefinitionMap;
|
|
1158
|
+
/** Whether to pre-render this route at build time (default: true for static routes). */
|
|
1159
|
+
prerender?: boolean;
|
|
964
1160
|
}
|
|
965
1161
|
/** A map of path patterns to route configs (user input format). */
|
|
966
1162
|
interface RouteDefinitionMap {
|
|
@@ -990,6 +1186,7 @@ interface RouteConfigLike {
|
|
|
990
1186
|
params?: ParamSchema<unknown>;
|
|
991
1187
|
searchParams?: SearchParamSchema<unknown>;
|
|
992
1188
|
children?: Record<string, RouteConfigLike>;
|
|
1189
|
+
prerender?: boolean;
|
|
993
1190
|
}
|
|
994
1191
|
/**
|
|
995
1192
|
* Phantom branded array that carries the route map type `T`.
|
|
@@ -1023,6 +1220,8 @@ interface CompiledRoute {
|
|
|
1023
1220
|
searchParams?: RouteConfig["searchParams"];
|
|
1024
1221
|
/** Compiled children. */
|
|
1025
1222
|
children?: CompiledRoute[];
|
|
1223
|
+
/** Whether to pre-render this route at build time (default: true for static routes). */
|
|
1224
|
+
prerender?: boolean;
|
|
1026
1225
|
}
|
|
1027
1226
|
/** A single matched route entry in the matched chain. */
|
|
1028
1227
|
interface MatchedRoute {
|
|
@@ -1067,8 +1266,8 @@ declare function defineRoutes<const T extends Record<string, RouteConfigLike>>(m
|
|
|
1067
1266
|
interface LinkProps<T extends Record<string, RouteConfigLike> = RouteDefinitionMap> {
|
|
1068
1267
|
/** The target URL path. */
|
|
1069
1268
|
href: RoutePaths<T>;
|
|
1070
|
-
/** Text or content for the link.
|
|
1071
|
-
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);
|
|
1072
1271
|
/** Class applied when the link's href matches the current path. */
|
|
1073
1272
|
activeClass?: string;
|
|
1074
1273
|
/** Static class name for the anchor element. */
|
|
@@ -1089,11 +1288,32 @@ interface LinkFactoryOptions {
|
|
|
1089
1288
|
* @returns A Link component function
|
|
1090
1289
|
*/
|
|
1091
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;
|
|
1298
|
+
type NavigateSearchValue = string | number | boolean | null | undefined;
|
|
1299
|
+
type NavigateSearch = string | URLSearchParams | Record<string, NavigateSearchValue | readonly NavigateSearchValue[]>;
|
|
1092
1300
|
/** Options for router.navigate(). */
|
|
1093
1301
|
interface NavigateOptions {
|
|
1094
1302
|
/** Use history.replaceState instead of pushState. */
|
|
1095
1303
|
replace?: boolean;
|
|
1096
|
-
|
|
1304
|
+
/** Route params used to interpolate dynamic segments in the route pattern. */
|
|
1305
|
+
params?: Record<string, string>;
|
|
1306
|
+
/** Search params appended to the final URL. */
|
|
1307
|
+
search?: NavigateSearch;
|
|
1308
|
+
}
|
|
1309
|
+
type NavigateOptionsFor<TPath extends string> = string extends TPath ? NavigateOptions : TPath extends `${string}:${string}` | `${string}*` ? Omit<NavigateOptions, "params"> & {
|
|
1310
|
+
params: ExtractParams<TPath>;
|
|
1311
|
+
} : Omit<NavigateOptions, "params"> & {
|
|
1312
|
+
params?: never;
|
|
1313
|
+
};
|
|
1314
|
+
type NavigateInput<TPath extends string = string> = {
|
|
1315
|
+
to: TPath;
|
|
1316
|
+
} & NavigateOptionsFor<TPath>;
|
|
1097
1317
|
/** Handle returned by prefetchNavData for cancellation. */
|
|
1098
1318
|
interface PrefetchHandle {
|
|
1099
1319
|
abort: () => void;
|
|
@@ -1118,13 +1338,14 @@ interface RouterOptions {
|
|
|
1118
1338
|
*
|
|
1119
1339
|
* Generic over the route map `T`. Defaults to `RouteDefinitionMap` (string
|
|
1120
1340
|
* index signature) for backward compatibility — unparameterized `Router`
|
|
1121
|
-
* accepts any string in `navigate()`.
|
|
1341
|
+
* accepts any string in `navigate().to`.
|
|
1122
1342
|
*
|
|
1123
1343
|
* Method syntax on `navigate`, `revalidate`, and `dispose` enables bivariant
|
|
1124
1344
|
* parameter checking under `strictFunctionTypes`. This means `Router<T>` is
|
|
1125
1345
|
* assignable to `Router` (the unparameterized default), which is required for
|
|
1126
1346
|
* storing typed routers in the `RouterContext` without contravariance errors.
|
|
1127
|
-
* At call sites, TypeScript still enforces the `
|
|
1347
|
+
* At call sites, TypeScript still enforces the `RoutePattern<T>` constraint and
|
|
1348
|
+
* the params required for each route pattern.
|
|
1128
1349
|
*/
|
|
1129
1350
|
interface Router<T extends Record<string, RouteConfigLike> = RouteDefinitionMap> {
|
|
1130
1351
|
/** Current matched route (reactive signal). */
|
|
@@ -1135,8 +1356,8 @@ interface Router<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>
|
|
|
1135
1356
|
loaderError: Signal<Error | null>;
|
|
1136
1357
|
/** Parsed search params from the current route (reactive signal). */
|
|
1137
1358
|
searchParams: Signal<Record<string, unknown>>;
|
|
1138
|
-
/** Navigate to a
|
|
1139
|
-
navigate(
|
|
1359
|
+
/** Navigate to a route pattern, interpolating params and search into the final URL. */
|
|
1360
|
+
navigate<TPath extends RoutePattern<T>>(input: NavigateInput<TPath>): Promise<void>;
|
|
1140
1361
|
/** Re-run all loaders for the current route. */
|
|
1141
1362
|
revalidate(): Promise<void>;
|
|
1142
1363
|
/** Remove popstate listener and clean up the router. */
|
|
@@ -1155,7 +1376,8 @@ type TypedRouter<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>
|
|
|
1155
1376
|
* @param initialUrl - The initial URL to match (optional; auto-detects from window.location or SSR context)
|
|
1156
1377
|
* @returns Router instance with reactive state and navigation methods
|
|
1157
1378
|
*/
|
|
1158
|
-
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>;
|
|
1159
1381
|
/** Context value for the Outlet. */
|
|
1160
1382
|
interface OutletContextValue {
|
|
1161
1383
|
/** Reactive child component factory (may return async module). */
|
|
@@ -1293,11 +1515,22 @@ interface SerializedStore {
|
|
|
1293
1515
|
}>;
|
|
1294
1516
|
}
|
|
1295
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
|
+
/**
|
|
1296
1527
|
* Options for EntityStore constructor.
|
|
1297
1528
|
*/
|
|
1298
1529
|
interface EntityStoreOptions {
|
|
1299
1530
|
/** Initial data to hydrate from (SSR). */
|
|
1300
1531
|
initialData?: SerializedStore;
|
|
1532
|
+
/** Enable dev-mode field selection tracking (zero overhead when false). */
|
|
1533
|
+
devMode?: boolean;
|
|
1301
1534
|
}
|
|
1302
1535
|
/**
|
|
1303
1536
|
* EntityStore - Normalized, signal-backed entity cache for @vertz/ui.
|
|
@@ -1309,6 +1542,7 @@ declare class EntityStore {
|
|
|
1309
1542
|
private _entities;
|
|
1310
1543
|
private _typeListeners;
|
|
1311
1544
|
private _queryIndices;
|
|
1545
|
+
private _fieldTracker;
|
|
1312
1546
|
/** Public accessor for query indices — used by optimistic handlers and tests. */
|
|
1313
1547
|
get queryIndices(): QueryResultIndex;
|
|
1314
1548
|
constructor(options?: EntityStoreOptions);
|
|
@@ -1332,6 +1566,14 @@ declare class EntityStore {
|
|
|
1332
1566
|
id: string;
|
|
1333
1567
|
}>(type: string, data: T | T[]): void;
|
|
1334
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
|
+
/**
|
|
1335
1577
|
* Remove an entity from the store.
|
|
1336
1578
|
* Triggers type change listeners and removes from query indices.
|
|
1337
1579
|
*/
|
|
@@ -1417,8 +1659,15 @@ declare class EntityStore {
|
|
|
1417
1659
|
private _mergeOne;
|
|
1418
1660
|
/**
|
|
1419
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.
|
|
1420
1664
|
*/
|
|
1421
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;
|
|
1422
1671
|
private _getOrCreateTypeMap;
|
|
1423
1672
|
private _getOrCreateListeners;
|
|
1424
1673
|
private _notifyTypeChange;
|
|
@@ -1447,6 +1696,48 @@ declare class QueryEnvelopeStore {
|
|
|
1447
1696
|
declare function getEntityStore(): EntityStore;
|
|
1448
1697
|
/** Get the global QueryEnvelopeStore singleton. */
|
|
1449
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
|
+
}
|
|
1450
1741
|
/**
|
|
1451
1742
|
* MutationEventBus — simple pub/sub for same-type query revalidation.
|
|
1452
1743
|
*
|
|
@@ -1503,4 +1794,4 @@ declare function resetRelationSchemas_TEST_ONLY(): void;
|
|
|
1503
1794
|
* ```
|
|
1504
1795
|
*/
|
|
1505
1796
|
declare function createTestStore(data: Record<string, Record<string, unknown>>): EntityStore;
|
|
1506
|
-
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, 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, 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 };
|