@nifrajs/web-solid 2.3.0 → 2.5.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/dist/router.d.ts +2 -4
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +11 -3
- package/dist/router.js.map +1 -1
- package/package.json +5 -5
- package/src/router.ts +21 -3
package/dist/router.d.ts
CHANGED
|
@@ -7,11 +7,9 @@ import { type Blocker, type BlockerFunction, type NavigateFunction } from "@nifr
|
|
|
7
7
|
* DOM-free bridges (`getBrowserNavigate` / `registerBlocker`, populated by `installHistory`); `useSearch`
|
|
8
8
|
* reads the accessor `compose` provides on SSR + client mount alike. Imports only `solid-js`. No JSX.
|
|
9
9
|
*/
|
|
10
|
-
import { type Accessor } from "solid-js";
|
|
10
|
+
import { type Accessor, type Context } from "solid-js";
|
|
11
11
|
export type { Blocker, BlockerFunction, BlockerState, NavigateFunction } from "@nifrajs/web";
|
|
12
|
-
|
|
13
|
-
* (derived from the URL via the shared `searchOfChain`). Read via {@link useSearch}. */
|
|
14
|
-
export declare const SearchContext: import("solid-js").Context<Accessor<Record<string, unknown>> | undefined>;
|
|
12
|
+
export declare const SearchContext: Context<Accessor<Record<string, unknown>> | undefined>;
|
|
15
13
|
/**
|
|
16
14
|
* The route's typed, validated search params as a reactive accessor - the SAME value the loader received
|
|
17
15
|
* as `ctx.search`. SSR-correct: `compose` provides it from the URL server-side and from the identical
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EAKtB,MAAM,cAAc,CAAA;AACrB;;;;;;GAMG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACzE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EAKtB,MAAM,cAAc,CAAA;AACrB;;;;;;GAMG;AACH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,OAAO,EAKb,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAiB5F,eAAO,MAAM,aAAa,wDACoE,CAAA;AAG9F;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,gBAAgB,GAAG,SAAS,GAAG,SAAS,KAAK,QAAQ,CAC5F,MAAM,SAAS,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAChF,CAIA;AAED;;kCAEkC;AAClC,wBAAgB,WAAW,IAAI,gBAAgB,CAO9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,CASpF"}
|
package/dist/router.js
CHANGED
|
@@ -6,13 +6,21 @@ import { getBrowserNavigate, IDLE_BLOCKER, registerBlocker, resolveNavigate, } f
|
|
|
6
6
|
* DOM-free bridges (`getBrowserNavigate` / `registerBlocker`, populated by `installHistory`); `useSearch`
|
|
7
7
|
* reads the accessor `compose` provides on SSR + client mount alike. Imports only `solid-js`. No JSX.
|
|
8
8
|
*/
|
|
9
|
-
import { createContext, createSignal, onCleanup, useContext } from "solid-js";
|
|
9
|
+
import { createContext, createSignal, onCleanup, useContext, } from "solid-js";
|
|
10
10
|
// Frozen empty search + a stable accessor for a `useSearch` used outside a nifra route tree.
|
|
11
11
|
const EMPTY_SEARCH = Object.freeze({});
|
|
12
12
|
const EMPTY_SEARCH_ACCESSOR = () => EMPTY_SEARCH;
|
|
13
13
|
/** The current route's validated search accessor, provided by `compose` on SSR + client mount alike
|
|
14
|
-
* (derived from the URL via the shared `searchOfChain`). Read via {@link useSearch}.
|
|
15
|
-
|
|
14
|
+
* (derived from the URL via the shared `searchOfChain`). Read via {@link useSearch}.
|
|
15
|
+
*
|
|
16
|
+
* A `globalThis` singleton: in dev this module is evaluated twice in one process (the app's server
|
|
17
|
+
* code under Bun provides; route modules through Vite's SSR runner read), and Solid matches provider
|
|
18
|
+
* to reader by context object identity - two `createContext` results make `useSearch` SSR-render its
|
|
19
|
+
* empty default in dev. */
|
|
20
|
+
const SEARCH_CONTEXT_SLOT = Symbol.for("nifra.web-solid.search-context");
|
|
21
|
+
const searchContextSlot = globalThis;
|
|
22
|
+
export const SearchContext = searchContextSlot[SEARCH_CONTEXT_SLOT] ?? createContext();
|
|
23
|
+
searchContextSlot[SEARCH_CONTEXT_SLOT] = SearchContext;
|
|
16
24
|
/**
|
|
17
25
|
* The route's typed, validated search params as a reactive accessor - the SAME value the loader received
|
|
18
26
|
* as `ctx.search`. SSR-correct: `compose` provides it from the URL server-side and from the identical
|
package/dist/router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAClB,YAAY,EAIZ,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAA;AACrB;;;;;;GAMG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAClB,YAAY,EAIZ,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAA;AACrB;;;;;;GAMG;AACH,OAAO,EAGL,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,UAAU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U,CACX,CACF,CAAA;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nifrajs/web-solid",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Solid render adapter for @nifrajs/web - SSR + hydration + the Solid Babel build plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@babel/core": "^7.26.0",
|
|
99
99
|
"@babel/preset-typescript": "^7.26.0",
|
|
100
|
-
"@nifrajs/core": "2.
|
|
101
|
-
"@nifrajs/i18n": "2.
|
|
102
|
-
"@nifrajs/image": "2.
|
|
103
|
-
"@nifrajs/web": "2.
|
|
100
|
+
"@nifrajs/core": "2.5.0",
|
|
101
|
+
"@nifrajs/i18n": "2.5.0",
|
|
102
|
+
"@nifrajs/image": "2.5.0",
|
|
103
|
+
"@nifrajs/web": "2.5.0",
|
|
104
104
|
"babel-preset-solid": "^1.9.3"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
package/src/router.ts
CHANGED
|
@@ -17,7 +17,14 @@ import {
|
|
|
17
17
|
* DOM-free bridges (`getBrowserNavigate` / `registerBlocker`, populated by `installHistory`); `useSearch`
|
|
18
18
|
* reads the accessor `compose` provides on SSR + client mount alike. Imports only `solid-js`. No JSX.
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
type Accessor,
|
|
22
|
+
type Context,
|
|
23
|
+
createContext,
|
|
24
|
+
createSignal,
|
|
25
|
+
onCleanup,
|
|
26
|
+
useContext,
|
|
27
|
+
} from "solid-js"
|
|
21
28
|
|
|
22
29
|
export type { Blocker, BlockerFunction, BlockerState, NavigateFunction } from "@nifrajs/web"
|
|
23
30
|
|
|
@@ -26,8 +33,19 @@ const EMPTY_SEARCH: Readonly<Record<string, unknown>> = Object.freeze({})
|
|
|
26
33
|
const EMPTY_SEARCH_ACCESSOR: Accessor<Record<string, unknown>> = () => EMPTY_SEARCH
|
|
27
34
|
|
|
28
35
|
/** The current route's validated search accessor, provided by `compose` on SSR + client mount alike
|
|
29
|
-
* (derived from the URL via the shared `searchOfChain`). Read via {@link useSearch}.
|
|
30
|
-
|
|
36
|
+
* (derived from the URL via the shared `searchOfChain`). Read via {@link useSearch}.
|
|
37
|
+
*
|
|
38
|
+
* A `globalThis` singleton: in dev this module is evaluated twice in one process (the app's server
|
|
39
|
+
* code under Bun provides; route modules through Vite's SSR runner read), and Solid matches provider
|
|
40
|
+
* to reader by context object identity - two `createContext` results make `useSearch` SSR-render its
|
|
41
|
+
* empty default in dev. */
|
|
42
|
+
const SEARCH_CONTEXT_SLOT = Symbol.for("nifra.web-solid.search-context")
|
|
43
|
+
const searchContextSlot = globalThis as {
|
|
44
|
+
[SEARCH_CONTEXT_SLOT]?: Context<Accessor<Record<string, unknown>> | undefined>
|
|
45
|
+
}
|
|
46
|
+
export const SearchContext =
|
|
47
|
+
searchContextSlot[SEARCH_CONTEXT_SLOT] ?? createContext<Accessor<Record<string, unknown>>>()
|
|
48
|
+
searchContextSlot[SEARCH_CONTEXT_SLOT] = SearchContext
|
|
31
49
|
|
|
32
50
|
/**
|
|
33
51
|
* The route's typed, validated search params as a reactive accessor - the SAME value the loader received
|