@nifrajs/web-preact 2.4.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 +0 -2
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +10 -2
- package/dist/router.js.map +1 -1
- package/package.json +5 -5
- package/src/router.ts +13 -2
package/dist/router.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { InferOutput, StandardSchemaV1 } from "@nifrajs/core/server";
|
|
2
2
|
import { type Blocker, type BlockerFunction, type NavigateFunction } from "@nifrajs/web";
|
|
3
3
|
export type { Blocker, BlockerFunction, BlockerState, NavigateFunction } from "@nifrajs/web";
|
|
4
|
-
/** The current route's validated search, provided by `compose` on SSR + client mount alike (derived from
|
|
5
|
-
* the URL via the shared `searchOfChain`). `{}` outside a nifra route tree. Read via {@link useSearch}. */
|
|
6
4
|
export declare const SearchContext: import("preact").Context<Record<string, unknown>>;
|
|
7
5
|
/**
|
|
8
6
|
* The route's typed, validated search params - the SAME value the loader received as `ctx.search`.
|
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;AAWrB,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;
|
|
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;AAWrB,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAgB5F,eAAO,MAAM,aAAa,mDACsE,CAAA;AAGhG;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,MAAM,SAAS,gBAAgB,GAAG,SAAS,GAAG,SAAS,KACpD,MAAM,SAAS,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAInF;AAED;;sEAEsE;AACtE,wBAAgB,WAAW,IAAI,gBAAgB,CAO9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,OAAO,GAAG,eAAe,GAAG,OAAO,CAe1E"}
|
package/dist/router.js
CHANGED
|
@@ -11,8 +11,16 @@ import { useCallback, useContext, useEffect, useRef, useState } from "preact/com
|
|
|
11
11
|
// Frozen empty search so the default context value has a stable reference.
|
|
12
12
|
const EMPTY_SEARCH = Object.freeze({});
|
|
13
13
|
/** The current route's validated search, provided by `compose` on SSR + client mount alike (derived from
|
|
14
|
-
* the URL via the shared `searchOfChain`). `{}` outside a nifra route tree. Read via {@link useSearch}.
|
|
15
|
-
|
|
14
|
+
* the URL via the shared `searchOfChain`). `{}` outside a nifra route tree. 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 Preact 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-preact.search-context");
|
|
21
|
+
const searchContextSlot = globalThis;
|
|
22
|
+
export const SearchContext = searchContextSlot[SEARCH_CONTEXT_SLOT] ?? createContext(EMPTY_SEARCH);
|
|
23
|
+
searchContextSlot[SEARCH_CONTEXT_SLOT] = SearchContext;
|
|
16
24
|
/**
|
|
17
25
|
* The route's typed, validated search params - the SAME value the loader received as `ctx.search`.
|
|
18
26
|
* SSR-correct: `compose` provides it from the URL server-side and from the identical derivation on the
|
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,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIpF,2EAA2E;AAC3E,MAAM,YAAY,GAAsC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAEzE;
|
|
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,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIpF,2EAA2E;AAC3E,MAAM,YAAY,GAAsC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAEzE;;;;;;2BAM2B;AAC3B,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;AACzE,MAAM,iBAAiB,GAAG,UAEzB,CAAA;AACD,MAAM,CAAC,MAAM,aAAa,GACxB,iBAAiB,CAAC,mBAAmB,CAAC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name": "@nifrajs/web-preact",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Preact render adapter for @nifrajs/web - streaming SSR + hydration (no build plugin).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@nifrajs/core": "2.
|
|
84
|
-
"@nifrajs/i18n": "2.
|
|
85
|
-
"@nifrajs/image": "2.
|
|
86
|
-
"@nifrajs/web": "2.
|
|
83
|
+
"@nifrajs/core": "2.5.0",
|
|
84
|
+
"@nifrajs/i18n": "2.5.0",
|
|
85
|
+
"@nifrajs/image": "2.5.0",
|
|
86
|
+
"@nifrajs/web": "2.5.0",
|
|
87
87
|
"preact-render-to-string": "^6.5.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
package/src/router.ts
CHANGED
|
@@ -26,8 +26,19 @@ export type { Blocker, BlockerFunction, BlockerState, NavigateFunction } from "@
|
|
|
26
26
|
const EMPTY_SEARCH: Readonly<Record<string, unknown>> = Object.freeze({})
|
|
27
27
|
|
|
28
28
|
/** The current route's validated search, provided by `compose` on SSR + client mount alike (derived from
|
|
29
|
-
* the URL via the shared `searchOfChain`). `{}` outside a nifra route tree. Read via {@link useSearch}.
|
|
30
|
-
|
|
29
|
+
* the URL via the shared `searchOfChain`). `{}` outside a nifra route tree. Read via {@link useSearch}.
|
|
30
|
+
*
|
|
31
|
+
* A `globalThis` singleton: in dev this module is evaluated twice in one process (the app's server
|
|
32
|
+
* code under Bun provides; route modules through Vite's SSR runner read), and Preact matches provider
|
|
33
|
+
* to reader by context object identity - two `createContext` results make `useSearch` SSR-render its
|
|
34
|
+
* empty default in dev. */
|
|
35
|
+
const SEARCH_CONTEXT_SLOT = Symbol.for("nifra.web-preact.search-context")
|
|
36
|
+
const searchContextSlot = globalThis as {
|
|
37
|
+
[SEARCH_CONTEXT_SLOT]?: ReturnType<typeof createContext<Record<string, unknown>>>
|
|
38
|
+
}
|
|
39
|
+
export const SearchContext =
|
|
40
|
+
searchContextSlot[SEARCH_CONTEXT_SLOT] ?? createContext<Record<string, unknown>>(EMPTY_SEARCH)
|
|
41
|
+
searchContextSlot[SEARCH_CONTEXT_SLOT] = SearchContext
|
|
31
42
|
|
|
32
43
|
/**
|
|
33
44
|
* The route's typed, validated search params - the SAME value the loader received as `ctx.search`.
|