@nifrajs/web-solid 5.9.0 → 5.11.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.
- package/CHANGELOG.md +58 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +4 -2
- package/dist/compose.js.map +1 -1
- package/dist/image.d.ts +4 -3
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +16 -6
- package/dist/image.js.map +1 -1
- package/dist/keep-alive-view.js +1 -1
- package/dist/keep-alive-view.js.map +1 -1
- package/dist/ppr.d.ts +1 -1
- package/dist/ppr.js +1 -1
- package/dist/query.d.ts +43 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +73 -5
- package/dist/query.js.map +1 -1
- package/dist/route-slot.d.ts +29 -0
- package/dist/route-slot.d.ts.map +1 -0
- package/dist/route-slot.jsx +75 -0
- package/dist/route-slot.jsx.map +1 -0
- package/dist/router-context.d.ts +5 -0
- package/dist/router-context.d.ts.map +1 -0
- package/dist/router-context.js +14 -0
- package/dist/router-context.js.map +1 -0
- package/dist/router.d.ts +8 -5
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +6 -12
- package/dist/router.js.map +1 -1
- package/package.json +5 -5
- package/src/client.ts +2 -0
- package/src/compose.ts +4 -2
- package/src/image.ts +28 -7
- package/src/keep-alive-view.ts +1 -1
- package/src/ppr.ts +1 -1
- package/src/query.ts +145 -6
- package/src/route-slot.tsx +137 -0
- package/src/router-context.ts +20 -0
- package/src/router.ts +8 -28
package/src/router.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { InferOutput, StandardSchemaV1 } from "@nifrajs/core/server"
|
|
2
2
|
// `import type` + a local re-export, NOT `export type { … } from "@nifrajs/web"`: that form leaves a
|
|
3
3
|
// bare `import "@nifrajs/web"` in the output, which pulls the server graph into the browser under
|
|
4
|
-
// Vite's dev server. Sourced from the ROOT so the generated `
|
|
4
|
+
// Vite's dev server. Sourced from the ROOT so the generated `RouteTable` augmentation applies.
|
|
5
5
|
import type {
|
|
6
6
|
Blocker,
|
|
7
7
|
BlockerFunction,
|
|
8
8
|
BlockerState,
|
|
9
9
|
NavigateFunction,
|
|
10
|
-
RenderProps,
|
|
11
10
|
UIMatch,
|
|
12
11
|
} from "@nifrajs/web"
|
|
13
12
|
// `/client`, not the root - these are DOM values, and the root's graph carries the
|
|
@@ -23,19 +22,16 @@ import { navigateNow } from "@nifrajs/web/internal/navigate-runtime"
|
|
|
23
22
|
* DOM-free bridges (`getBrowserNavigate` / `registerBlocker`, populated by `installHistory`); `useSearch`
|
|
24
23
|
* reads the accessor `compose` provides on SSR + client mount alike. Imports only `solid-js`. No JSX.
|
|
25
24
|
*/
|
|
26
|
-
import {
|
|
27
|
-
type Accessor,
|
|
28
|
-
type Context,
|
|
29
|
-
createContext,
|
|
30
|
-
createMemo,
|
|
31
|
-
createSignal,
|
|
32
|
-
onCleanup,
|
|
33
|
-
useContext,
|
|
34
|
-
} from "solid-js"
|
|
25
|
+
import { type Accessor, createMemo, createSignal, onCleanup, useContext } from "solid-js"
|
|
35
26
|
import { PageContext } from "./page-visibility.ts"
|
|
27
|
+
import { RenderPropsContext, SearchContext } from "./router-context.ts"
|
|
36
28
|
|
|
29
|
+
export { href, rawHref } from "@nifrajs/web/client"
|
|
37
30
|
export { onPageHide, onPageShow, usePageVisibility } from "./page-visibility.ts"
|
|
31
|
+
export type { RouteSlotController, RouteSlotProps } from "./route-slot.tsx"
|
|
32
|
+
export { RouteSlot, useRouteSlot } from "./route-slot.tsx"
|
|
38
33
|
export type { Blocker, BlockerFunction, BlockerState, NavigateFunction, UIMatch }
|
|
34
|
+
export { RenderPropsContext, SearchContext }
|
|
39
35
|
|
|
40
36
|
// Frozen empty search + a stable accessor for a `useSearch` used outside a nifra route tree.
|
|
41
37
|
const EMPTY_SEARCH: Readonly<Record<string, unknown>> = Object.freeze({})
|
|
@@ -48,22 +44,6 @@ const EMPTY_SEARCH_ACCESSOR: Accessor<Record<string, unknown>> = () => EMPTY_SEA
|
|
|
48
44
|
* code under Bun provides; route modules through Vite's SSR runner read), and Solid matches provider
|
|
49
45
|
* to reader by context object identity - two `createContext` results make `useSearch` SSR-render its
|
|
50
46
|
* empty default in dev. */
|
|
51
|
-
const SEARCH_CONTEXT_SLOT = Symbol.for("nifra.web-solid.search-context")
|
|
52
|
-
const searchContextSlot = globalThis as {
|
|
53
|
-
[SEARCH_CONTEXT_SLOT]?: Context<Accessor<Record<string, unknown>> | undefined>
|
|
54
|
-
}
|
|
55
|
-
export const SearchContext =
|
|
56
|
-
searchContextSlot[SEARCH_CONTEXT_SLOT] ?? createContext<Accessor<Record<string, unknown>>>()
|
|
57
|
-
searchContextSlot[SEARCH_CONTEXT_SLOT] = SearchContext
|
|
58
|
-
|
|
59
|
-
/** The props `compose` rendered the chain with - getters over the router snapshot on the client - which
|
|
60
|
-
* {@link useMatches} reads. A `globalThis` singleton for the same reason as {@link SearchContext}. */
|
|
61
|
-
const PROPS_CONTEXT_SLOT = Symbol.for("nifra.web-solid.props-context")
|
|
62
|
-
const propsContextSlot = globalThis as { [PROPS_CONTEXT_SLOT]?: Context<RenderProps | undefined> }
|
|
63
|
-
export const RenderPropsContext =
|
|
64
|
-
propsContextSlot[PROPS_CONTEXT_SLOT] ?? createContext<RenderProps>()
|
|
65
|
-
propsContextSlot[PROPS_CONTEXT_SLOT] = RenderPropsContext
|
|
66
|
-
|
|
67
47
|
const NO_MATCHES: readonly UIMatch[] = Object.freeze([])
|
|
68
48
|
|
|
69
49
|
/**
|
|
@@ -104,7 +84,7 @@ export function useSearch<Schema extends StandardSchemaV1 | undefined = undefine
|
|
|
104
84
|
>
|
|
105
85
|
}
|
|
106
86
|
|
|
107
|
-
/** Get the {@link NavigateFunction} (
|
|
87
|
+
/** Get the {@link NavigateFunction} (an `Href` from `href()` or `rawHref()`, or a history delta).
|
|
108
88
|
* Resolves the browser navigate at call time, so it works as soon as `installHistory` has run and no-ops
|
|
109
89
|
* before then / on the server. */
|
|
110
90
|
export function useNavigate(): NavigateFunction {
|