@real-router/vue 0.15.2 → 0.15.4
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/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +7 -8
- package/src/RouterProvider.ts +0 -162
- package/src/components/Await.ts +0 -47
- package/src/components/ClientOnly.ts +0 -16
- package/src/components/HttpStatusCode.ts +0 -74
- package/src/components/HttpStatusProvider.ts +0 -22
- package/src/components/Link.ts +0 -226
- package/src/components/RouteView/RouteView.ts +0 -233
- package/src/components/RouteView/components.ts +0 -53
- package/src/components/RouteView/helpers.ts +0 -207
- package/src/components/RouteView/index.ts +0 -8
- package/src/components/RouteView/types.ts +0 -20
- package/src/components/RouterErrorBoundary.ts +0 -61
- package/src/components/ServerOnly.ts +0 -16
- package/src/components/Streamed.ts +0 -31
- package/src/composables/useDeferred.ts +0 -37
- package/src/composables/useIsActiveRoute.ts +0 -61
- package/src/composables/useNavigator.ts +0 -15
- package/src/composables/useRoute.ts +0 -34
- package/src/composables/useRouteEnter.ts +0 -120
- package/src/composables/useRouteExit.ts +0 -116
- package/src/composables/useRouteNode.ts +0 -31
- package/src/composables/useRouteUtils.ts +0 -12
- package/src/composables/useRouter.ts +0 -15
- package/src/composables/useRouterTransition.ts +0 -14
- package/src/constants.ts +0 -9
- package/src/context.ts +0 -13
- package/src/createRouterPlugin.ts +0 -31
- package/src/directives/vLink.ts +0 -208
- package/src/index.ts +0 -64
- package/src/setupRouteProvision.ts +0 -42
- package/src/ssr.ts +0 -39
- package/src/types.ts +0 -40
- package/src/useRefFromSource.ts +0 -16
- package/src/utils/createHttpStatusSink.ts +0 -31
package/src/index.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Components
|
|
2
|
-
export { RouteView } from "./components/RouteView";
|
|
3
|
-
|
|
4
|
-
export { Link } from "./components/Link";
|
|
5
|
-
|
|
6
|
-
export { RouterErrorBoundary } from "./components/RouterErrorBoundary";
|
|
7
|
-
|
|
8
|
-
// Directives
|
|
9
|
-
export { vLink } from "./directives/vLink";
|
|
10
|
-
|
|
11
|
-
// Composables
|
|
12
|
-
export { useRouter } from "./composables/useRouter";
|
|
13
|
-
|
|
14
|
-
export { useNavigator } from "./composables/useNavigator";
|
|
15
|
-
|
|
16
|
-
export { useRouteUtils } from "./composables/useRouteUtils";
|
|
17
|
-
|
|
18
|
-
export { useRoute } from "./composables/useRoute";
|
|
19
|
-
|
|
20
|
-
export { useRouteNode } from "./composables/useRouteNode";
|
|
21
|
-
|
|
22
|
-
export { useRouterTransition } from "./composables/useRouterTransition";
|
|
23
|
-
|
|
24
|
-
export { useRouteExit } from "./composables/useRouteExit";
|
|
25
|
-
|
|
26
|
-
export { useRouteEnter } from "./composables/useRouteEnter";
|
|
27
|
-
|
|
28
|
-
// Plugin
|
|
29
|
-
export { createRouterPlugin } from "./createRouterPlugin";
|
|
30
|
-
|
|
31
|
-
// Context
|
|
32
|
-
export { RouterProvider } from "./RouterProvider";
|
|
33
|
-
|
|
34
|
-
export { RouterKey, NavigatorKey, RouteKey } from "./context";
|
|
35
|
-
|
|
36
|
-
// Types
|
|
37
|
-
export type { RouteContext, LinkProps } from "./types";
|
|
38
|
-
|
|
39
|
-
export type { RouterErrorBoundaryProps } from "./components/RouterErrorBoundary";
|
|
40
|
-
|
|
41
|
-
export type { LinkDirectiveValue } from "./directives/vLink";
|
|
42
|
-
|
|
43
|
-
export type {
|
|
44
|
-
RouteViewProps,
|
|
45
|
-
RouteViewMatchProps,
|
|
46
|
-
RouteViewSelfProps,
|
|
47
|
-
RouteViewNotFoundProps,
|
|
48
|
-
} from "./components/RouteView";
|
|
49
|
-
|
|
50
|
-
export type {
|
|
51
|
-
RouteExitContext,
|
|
52
|
-
RouteExitHandler,
|
|
53
|
-
UseRouteExitOptions,
|
|
54
|
-
} from "./composables/useRouteExit";
|
|
55
|
-
|
|
56
|
-
export type {
|
|
57
|
-
RouteEnterContext,
|
|
58
|
-
RouteEnterHandler,
|
|
59
|
-
UseRouteEnterOptions,
|
|
60
|
-
} from "./composables/useRouteEnter";
|
|
61
|
-
|
|
62
|
-
export type { Navigator } from "@real-router/core";
|
|
63
|
-
|
|
64
|
-
export type { RouterTransitionSnapshot } from "@real-router/sources";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// packages/vue/src/setupRouteProvision.ts
|
|
2
|
-
|
|
3
|
-
import { getNavigator } from "@real-router/core";
|
|
4
|
-
import { createRouteSource } from "@real-router/sources";
|
|
5
|
-
import { shallowRef } from "vue";
|
|
6
|
-
|
|
7
|
-
import type { Router, Navigator, State } from "@real-router/core";
|
|
8
|
-
import type { ShallowRef } from "vue";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Shared setup for `RouterProvider` (component-scoped) and
|
|
12
|
-
* `createRouterPlugin` (app-scoped). Builds the reactive route refs +
|
|
13
|
-
* subscription bookkeeping in one place; callers wire the result into their
|
|
14
|
-
* provide/inject mechanism and own teardown lifecycle.
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export interface RouteProvision {
|
|
19
|
-
navigator: Navigator;
|
|
20
|
-
route: ShallowRef<State | undefined>;
|
|
21
|
-
previousRoute: ShallowRef<State | undefined>;
|
|
22
|
-
/** Call when the owning scope tears down to release the router subscription. */
|
|
23
|
-
unsubscribe: () => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function setupRouteProvision(router: Router): RouteProvision {
|
|
27
|
-
const navigator = getNavigator(router);
|
|
28
|
-
const source = createRouteSource(router);
|
|
29
|
-
const initial = source.getSnapshot();
|
|
30
|
-
|
|
31
|
-
const route = shallowRef<State | undefined>(initial.route);
|
|
32
|
-
const previousRoute = shallowRef<State | undefined>(initial.previousRoute);
|
|
33
|
-
|
|
34
|
-
const unsubscribe = source.subscribe(() => {
|
|
35
|
-
const snapshot = source.getSnapshot();
|
|
36
|
-
|
|
37
|
-
route.value = snapshot.route;
|
|
38
|
-
previousRoute.value = snapshot.previousRoute;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return { navigator, route, previousRoute, unsubscribe };
|
|
42
|
-
}
|
package/src/ssr.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// SSR-feature entry — Vue 3.3+
|
|
2
|
-
//
|
|
3
|
-
// Server-side and SSR-aware components/composables. Mirror of `@real-router/react/ssr`
|
|
4
|
-
// — same exports, Vue-native idioms (defineComponent + h(), async setup()
|
|
5
|
-
// for Await, native Suspense for Streamed).
|
|
6
|
-
|
|
7
|
-
// Components
|
|
8
|
-
export { ClientOnly } from "./components/ClientOnly";
|
|
9
|
-
|
|
10
|
-
export { ServerOnly } from "./components/ServerOnly";
|
|
11
|
-
|
|
12
|
-
export { Await } from "./components/Await";
|
|
13
|
-
|
|
14
|
-
export { Streamed } from "./components/Streamed";
|
|
15
|
-
|
|
16
|
-
export { HttpStatusCode } from "./components/HttpStatusCode";
|
|
17
|
-
|
|
18
|
-
export { HttpStatusProvider } from "./components/HttpStatusProvider";
|
|
19
|
-
|
|
20
|
-
// Composables
|
|
21
|
-
export { useDeferred } from "./composables/useDeferred";
|
|
22
|
-
|
|
23
|
-
// Utilities
|
|
24
|
-
export { createHttpStatusSink } from "./utils/createHttpStatusSink";
|
|
25
|
-
|
|
26
|
-
// Types
|
|
27
|
-
export type { ClientOnlyProps } from "./components/ClientOnly";
|
|
28
|
-
|
|
29
|
-
export type { ServerOnlyProps } from "./components/ServerOnly";
|
|
30
|
-
|
|
31
|
-
export type { AwaitProps } from "./components/Await";
|
|
32
|
-
|
|
33
|
-
export type { StreamedProps } from "./components/Streamed";
|
|
34
|
-
|
|
35
|
-
export type { HttpStatusCodeProps } from "./components/HttpStatusCode";
|
|
36
|
-
|
|
37
|
-
export type { HttpStatusProviderProps } from "./components/HttpStatusProvider";
|
|
38
|
-
|
|
39
|
-
export type { HttpStatusSink } from "./utils/createHttpStatusSink";
|
package/src/types.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
NavigationOptions,
|
|
3
|
-
Params,
|
|
4
|
-
Navigator,
|
|
5
|
-
State,
|
|
6
|
-
} from "@real-router/core";
|
|
7
|
-
import type { Ref } from "vue";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* `route`/`previousRoute` are read-only reactive references. They may be
|
|
11
|
-
* implemented as `shallowRef` or `computed` depending on the composable
|
|
12
|
-
* (`useRoute` mirrors via `shallowRef`, `useRouteNode` derives via `computed`),
|
|
13
|
-
* but consumers only need `.value` read access — typed as `Readonly<Ref<…>>`.
|
|
14
|
-
*/
|
|
15
|
-
export interface RouteContext<P extends Params = Params> {
|
|
16
|
-
navigator: Navigator;
|
|
17
|
-
route: Readonly<Ref<State<P> | undefined>>;
|
|
18
|
-
previousRoute: Readonly<Ref<State | undefined>>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface LinkProps<P extends Params = Params> {
|
|
22
|
-
routeName: string;
|
|
23
|
-
routeParams?: P;
|
|
24
|
-
routeOptions?: NavigationOptions;
|
|
25
|
-
class?: string;
|
|
26
|
-
activeClassName?: string;
|
|
27
|
-
activeStrict?: boolean;
|
|
28
|
-
ignoreQueryParams?: boolean;
|
|
29
|
-
target?: string;
|
|
30
|
-
/**
|
|
31
|
-
* URL fragment (#532). Decoded, no leading `#`. Tri-state:
|
|
32
|
-
* - `undefined` (default) — preserves current `state.context.url.hash` on click.
|
|
33
|
-
* - `""` — clears the hash.
|
|
34
|
-
* - `"value"` — sets the hash; click routes through `navigateWithHash`,
|
|
35
|
-
* which auto-adds `force: true, hashChange: true` for same-route hash
|
|
36
|
-
* transitions (bypasses core's SAME_STATES check).
|
|
37
|
-
* Active state is hash-aware when `hash` is set.
|
|
38
|
-
*/
|
|
39
|
-
hash?: string;
|
|
40
|
-
}
|
package/src/useRefFromSource.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { shallowRef, onScopeDispose } from "vue";
|
|
2
|
-
|
|
3
|
-
import type { RouterSource } from "@real-router/sources";
|
|
4
|
-
import type { ShallowRef } from "vue";
|
|
5
|
-
|
|
6
|
-
export function useRefFromSource<T>(source: RouterSource<T>): ShallowRef<T> {
|
|
7
|
-
const ref = shallowRef(source.getSnapshot());
|
|
8
|
-
|
|
9
|
-
const unsub = source.subscribe(() => {
|
|
10
|
-
ref.value = source.getSnapshot();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
onScopeDispose(unsub);
|
|
14
|
-
|
|
15
|
-
return ref;
|
|
16
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render-scoped HTTP status sink. Created per request on the server, passed to
|
|
3
|
-
* `<HttpStatusProvider :sink="...">`, and read after `renderToString` /
|
|
4
|
-
* `renderToWebStream` to apply the value to the HTTP response.
|
|
5
|
-
*
|
|
6
|
-
* Last write wins: if the rendered tree mounts more than one
|
|
7
|
-
* `<HttpStatusCode />`, the value reflects the last component that ran during
|
|
8
|
-
* the render pass.
|
|
9
|
-
*
|
|
10
|
-
* No-op on the client — `<HttpStatusCode />` reads the optional injected sink
|
|
11
|
-
* and skips the write when no provider is mounted, so the same component tree
|
|
12
|
-
* can be hydrated without changing behaviour.
|
|
13
|
-
*
|
|
14
|
-
* Constraints:
|
|
15
|
-
* - **Per-request only.** Don't share a sink across requests; the rendered
|
|
16
|
-
* tree mutates `code` in place. Module-level singletons leak status
|
|
17
|
-
* between concurrent requests.
|
|
18
|
-
* - **Don't `Object.freeze` the sink.** The component writes to `.code`;
|
|
19
|
-
* freezing makes the assignment throw under ESM strict mode.
|
|
20
|
-
* - **Hydration symmetry:** mount `<HttpStatusProvider>` on both server and
|
|
21
|
-
* client (with a throwaway client sink). Vue emits `<!--[-->` / `<!--]-->`
|
|
22
|
-
* fragment markers around the provider's slot; an extra provider on one
|
|
23
|
-
* side trips Vue with "Hydration completed but contains mismatches".
|
|
24
|
-
*/
|
|
25
|
-
export interface HttpStatusSink {
|
|
26
|
-
code: number | undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function createHttpStatusSink(): HttpStatusSink {
|
|
30
|
-
return { code: undefined };
|
|
31
|
-
}
|