@vmz/core 0.2.7 → 0.3.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.
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Client navigation option and helper types for `@vmz/core`.
3
+ */
4
+ import type { ComponentCtorLike, DirectInstance } from './direct-api.types.js';
5
+ export type HydrateFn = (Ctor: ComponentCtorLike, root: Element, props: object) => Promise<unknown>;
6
+ export type HydrateRouteFn = (Page: ComponentCtorLike, root: Element, props: object, layouts?: ComponentCtorLike[]) => Promise<unknown>;
7
+ export type HydrateRoutePageFn = (Page: ComponentCtorLike, root: Element, props: object) => Promise<unknown>;
8
+ export type DomFallbackModule = {
9
+ hydrate?: HydrateFn;
10
+ hydrateRoute?: HydrateRouteFn;
11
+ hydrateRoutePage?: HydrateRoutePageFn;
12
+ };
13
+ export type ClientNavOpts = {
14
+ fetchImpl?: typeof fetch;
15
+ document?: Document;
16
+ history?: History;
17
+ location?: Location;
18
+ hydrate?: HydrateFn;
19
+ hydrateRoute?: HydrateRouteFn;
20
+ hydrateRoutePage?: HydrateRoutePageFn;
21
+ destroy?: (inst: DirectInstance | object) => void;
22
+ importPage?: (chunkId: string) => Promise<unknown>;
23
+ };
24
+ export type TransitionToOpts = {
25
+ replace?: boolean;
26
+ fromPop?: boolean;
27
+ softFail?: boolean;
28
+ };
29
+ export type TransitionLocaleOpts = {
30
+ replace?: boolean;
31
+ softFail?: boolean;
32
+ reload?: boolean;
33
+ [key: string]: unknown;
34
+ };
35
+ export type TransitionToOk = {
36
+ ok: true;
37
+ href: string;
38
+ chunkId: string;
39
+ retainedLayout: boolean;
40
+ scrollMode: string;
41
+ focusTarget: string | null;
42
+ localeId: string | null;
43
+ };
44
+ export type TransitionToFail = {
45
+ ok: false;
46
+ reason: string;
47
+ };
48
+ export type TransitionToResult = TransitionToOk | TransitionToFail;
49
+ export type ClientNavResult = {
50
+ ok: false;
51
+ reason: string;
52
+ } | {
53
+ ok: true;
54
+ transitionTo: (url: string | URL, opts?: TransitionToOpts) => Promise<TransitionToResult>;
55
+ transitionLocale: (toLocale: string, opts?: TransitionLocaleOpts) => Promise<unknown>;
56
+ dispose: () => void;
57
+ setFetch?: (impl: typeof fetch) => void;
58
+ };
59
+ export type ScrollPosition = {
60
+ x: number;
61
+ y: number;
62
+ };
63
+ export type ScrollRestoreResult = {
64
+ mode: string;
65
+ x: number;
66
+ y: number;
67
+ };
68
+ /** URL-like scroll restore target (pathname / search / hash). */
69
+ export type ScrollTarget = {
70
+ pathname: string;
71
+ search: string;
72
+ hash: string;
73
+ mode?: string;
74
+ x?: number;
75
+ y?: number;
76
+ };
77
+ /** In-flight SPA navigation abort handle (AbortController). */
78
+ export type InflightNav = AbortController;
79
+ export type VmzNavHost = Element & {
80
+ __vmzInst?: DirectInstance | null;
81
+ };
82
+ export type VmzAppRoot = HTMLElement & {
83
+ __vmzInst?: DirectInstance | null;
84
+ __vmzPageHost?: VmzNavHost | null;
85
+ __vmzLayoutInsts?: DirectInstance[] | null;
86
+ };
87
+ export type LocaleRouting = {
88
+ locales?: string[];
89
+ defaultLocale?: string;
90
+ strategy?: string;
91
+ defaultPrefix?: string;
92
+ [key: string]: unknown;
93
+ };
94
+ export type LocaleHrefTable = Record<string, Record<string, string>>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Client navigation option and helper types for `@vmz/core`.
3
+ */
4
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vmz/core",
3
- "version": "0.2.7",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "VMZ production runtime core — DOM / SSR / HTTP / WriteBarrier (no compiler)",
6
6
  "exports": {
@@ -70,12 +70,12 @@
70
70
  "linkedom": "^0.18.13"
71
71
  },
72
72
  "optionalDependencies": {
73
- "@vmz/vmz-win32-x64": "0.2.7",
74
- "@vmz/vmz-win32-arm64": "0.2.7",
75
- "@vmz/vmz-darwin-x64": "0.2.7",
76
- "@vmz/vmz-darwin-arm64": "0.2.7",
77
- "@vmz/vmz-linux-x64": "0.2.7",
78
- "@vmz/vmz-linux-arm64": "0.2.7"
73
+ "@vmz/vmz-win32-x64": "0.3.0",
74
+ "@vmz/vmz-win32-arm64": "0.3.0",
75
+ "@vmz/vmz-darwin-x64": "0.3.0",
76
+ "@vmz/vmz-darwin-arm64": "0.3.0",
77
+ "@vmz/vmz-linux-x64": "0.3.0",
78
+ "@vmz/vmz-linux-arm64": "0.3.0"
79
79
  },
80
80
  "publishConfig": {
81
81
  "access": "public"