@timber-js/app 0.1.23 → 0.1.25
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/_chunks/{ssr-data-B2yikEEB.js → ssr-data-DLnbYpj1.js} +2 -4
- package/dist/_chunks/{ssr-data-B2yikEEB.js.map → ssr-data-DLnbYpj1.js.map} +1 -1
- package/dist/_chunks/{use-cookie-D5aS4slY.js → use-cookie-dDbpCTx-.js} +2 -2
- package/dist/_chunks/{use-cookie-D5aS4slY.js.map → use-cookie-dDbpCTx-.js.map} +1 -1
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +4 -3
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/browser-dev.d.ts +29 -0
- package/dist/client/browser-dev.d.ts.map +1 -0
- package/dist/client/browser-links.d.ts +32 -0
- package/dist/client/browser-links.d.ts.map +1 -0
- package/dist/client/error-boundary.js +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +150 -122
- package/dist/client/index.js.map +1 -1
- package/dist/client/navigation-context.d.ts +52 -0
- package/dist/client/navigation-context.d.ts.map +1 -0
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/transition-root.d.ts +54 -0
- package/dist/client/transition-root.d.ts.map +1 -0
- package/dist/client/use-params.d.ts +35 -25
- package/dist/client/use-params.d.ts.map +1 -1
- package/dist/client/use-pathname.d.ts +11 -4
- package/dist/client/use-pathname.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +14 -0
- package/dist/client/use-router.d.ts.map +1 -1
- package/dist/cookies/index.js +2 -2
- package/dist/server/index.js +264 -218
- package/dist/server/index.js.map +1 -1
- package/dist/server/metadata-platform.d.ts +34 -0
- package/dist/server/metadata-platform.d.ts.map +1 -0
- package/dist/server/metadata-render.d.ts.map +1 -1
- package/dist/server/metadata-social.d.ts +24 -0
- package/dist/server/metadata-social.d.ts.map +1 -0
- package/dist/server/pipeline-interception.d.ts +32 -0
- package/dist/server/pipeline-interception.d.ts.map +1 -0
- package/dist/server/pipeline-metadata.d.ts +31 -0
- package/dist/server/pipeline-metadata.d.ts.map +1 -0
- package/dist/server/pipeline.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/nitro.ts +9 -7
- package/src/cli.ts +9 -2
- package/src/client/browser-dev.ts +142 -0
- package/src/client/browser-entry.ts +73 -223
- package/src/client/browser-links.ts +90 -0
- package/src/client/index.ts +4 -0
- package/src/client/navigation-context.ts +118 -0
- package/src/client/router.ts +37 -33
- package/src/client/transition-root.tsx +86 -0
- package/src/client/use-params.ts +50 -54
- package/src/client/use-pathname.ts +31 -24
- package/src/client/use-router.ts +17 -15
- package/src/server/metadata-platform.ts +229 -0
- package/src/server/metadata-render.ts +9 -363
- package/src/server/metadata-social.ts +184 -0
- package/src/server/pipeline-interception.ts +76 -0
- package/src/server/pipeline-metadata.ts +90 -0
- package/src/server/pipeline.ts +2 -148
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
* (populated by ssr-entry.ts) to ensure correct per-request isolation
|
|
19
19
|
* across concurrent requests with streaming Suspense.
|
|
20
20
|
*
|
|
21
|
-
* Reactivity: useParams()
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* Reactivity: On the client, useParams() reads from NavigationContext
|
|
22
|
+
* which is updated atomically with the RSC tree render. This replaces
|
|
23
|
+
* the previous useSyncExternalStore approach that suffered from a
|
|
24
|
+
* timing gap between tree render and store notification — causing
|
|
25
|
+
* preserved layout components to briefly show stale active state.
|
|
25
26
|
*
|
|
26
27
|
* All mutable state is delegated to client/state.ts for singleton guarantees.
|
|
27
28
|
* See design/18-build-system.md §"Singleton State Registry"
|
|
@@ -30,37 +31,40 @@
|
|
|
30
31
|
*/
|
|
31
32
|
import type { Routes } from '#/index.js';
|
|
32
33
|
/**
|
|
33
|
-
* Subscribe to params changes.
|
|
34
|
-
*
|
|
34
|
+
* Subscribe to params changes.
|
|
35
|
+
* Retained for backward compatibility with tests that verify the
|
|
36
|
+
* subscribe/notify contract. On the client, useParams() reads from
|
|
37
|
+
* NavigationContext instead.
|
|
35
38
|
*/
|
|
36
39
|
export declare function subscribe(callback: () => void): () => void;
|
|
37
40
|
/**
|
|
38
|
-
* Get the current params snapshot (
|
|
39
|
-
*
|
|
41
|
+
* Get the current params snapshot (module-level fallback).
|
|
42
|
+
* Used by tests and by the hook when called outside a React component.
|
|
40
43
|
*/
|
|
41
44
|
export declare function getSnapshot(): Record<string, string | string[]>;
|
|
42
45
|
/**
|
|
43
|
-
* Set the current route params
|
|
44
|
-
* Called by the router before renderPayload() so that new components
|
|
45
|
-
* in the RSC tree see the updated params via getSnapshot(), but
|
|
46
|
-
* preserved layout components don't re-render prematurely with
|
|
47
|
-
* {old tree, new params}.
|
|
46
|
+
* Set the current route params in the module-level store.
|
|
48
47
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* Called by the router on each navigation. This updates the fallback
|
|
49
|
+
* snapshot used by tests and by the hook when called outside a React
|
|
50
|
+
* component (no NavigationContext available).
|
|
51
|
+
*
|
|
52
|
+
* On the client, the primary reactivity path is NavigationContext —
|
|
53
|
+
* the router calls setNavigationState() then renderRoot() which wraps
|
|
54
|
+
* the element in NavigationProvider. setCurrentParams is still called
|
|
55
|
+
* for the module-level fallback.
|
|
51
56
|
*
|
|
52
|
-
* On the client, the segment router calls this on each navigation.
|
|
53
57
|
* During SSR, params are also available via getSsrData().params
|
|
54
|
-
* (ALS-backed)
|
|
55
|
-
* module-level fallback path.
|
|
58
|
+
* (ALS-backed).
|
|
56
59
|
*/
|
|
57
60
|
export declare function setCurrentParams(params: Record<string, string | string[]>): void;
|
|
58
61
|
/**
|
|
59
|
-
* Notify all
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* Notify all legacy subscribers that params have changed.
|
|
63
|
+
*
|
|
64
|
+
* Retained for backward compatibility with tests. On the client,
|
|
65
|
+
* the NavigationContext + renderRoot pattern replaces this — params
|
|
66
|
+
* update atomically with the tree render, so explicit notification
|
|
67
|
+
* is no longer needed.
|
|
64
68
|
*/
|
|
65
69
|
export declare function notifyParamsListeners(): void;
|
|
66
70
|
/**
|
|
@@ -69,9 +73,15 @@ export declare function notifyParamsListeners(): void;
|
|
|
69
73
|
* The optional `_route` argument exists only for TypeScript narrowing —
|
|
70
74
|
* it does not affect the runtime return value.
|
|
71
75
|
*
|
|
76
|
+
* On the client, reads from NavigationContext (provided by
|
|
77
|
+
* NavigationProvider in renderRoot). This ensures params update
|
|
78
|
+
* atomically with the RSC tree — no timing gap.
|
|
79
|
+
*
|
|
72
80
|
* During SSR, reads from the ALS-backed SSR data context to ensure
|
|
73
|
-
* per-request isolation
|
|
74
|
-
*
|
|
81
|
+
* per-request isolation across concurrent requests with streaming Suspense.
|
|
82
|
+
*
|
|
83
|
+
* When called outside a React component (e.g., in test assertions),
|
|
84
|
+
* falls back to the module-level snapshot.
|
|
75
85
|
*
|
|
76
86
|
* @overload Typed — when a known route path is passed, returns the
|
|
77
87
|
* exact params shape from the generated Routes interface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-params.d.ts","sourceRoot":"","sources":["../../src/client/use-params.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-params.d.ts","sourceRoot":"","sources":["../../src/client/use-params.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AASzC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAG1D;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAE/D;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAEhF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACjF,wBAAgB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC"}
|
|
@@ -4,17 +4,24 @@
|
|
|
4
4
|
* Returns the pathname portion of the current URL (e.g. '/dashboard/settings').
|
|
5
5
|
* Updates when client-side navigation changes the URL.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* On the client, reads from NavigationContext which is updated atomically
|
|
8
|
+
* with the RSC tree render. This replaces the previous useSyncExternalStore
|
|
9
|
+
* approach which only subscribed to popstate events — meaning usePathname()
|
|
10
|
+
* did NOT re-render on forward navigation (pushState). The context approach
|
|
11
|
+
* fixes this: pathname updates in the same render pass as the new tree.
|
|
10
12
|
*
|
|
11
13
|
* During SSR, reads the request pathname from the SSR ALS context
|
|
12
14
|
* (populated by ssr-entry.ts) instead of window.location.
|
|
15
|
+
*
|
|
16
|
+
* Compatible with Next.js's `usePathname()` from `next/navigation`.
|
|
13
17
|
*/
|
|
14
18
|
/**
|
|
15
19
|
* Read the current URL pathname.
|
|
16
20
|
*
|
|
17
|
-
*
|
|
21
|
+
* On the client, reads from NavigationContext (provided by
|
|
22
|
+
* NavigationProvider in renderRoot). During SSR, reads from the
|
|
23
|
+
* ALS-backed SSR data context. Falls back to window.location.pathname
|
|
24
|
+
* when called outside a React component (e.g., in tests).
|
|
18
25
|
*/
|
|
19
26
|
export declare function usePathname(): string;
|
|
20
27
|
//# sourceMappingURL=use-pathname.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-pathname.d.ts","sourceRoot":"","sources":["../../src/client/use-pathname.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-pathname.d.ts","sourceRoot":"","sources":["../../src/client/use-pathname.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;;;;;GAOG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAoBpC"}
|
|
@@ -7,6 +7,20 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This wraps timber's internal RouterInstance in the Next.js-compatible
|
|
9
9
|
* AppRouterInstance shape that ecosystem libraries expect.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: Unlike Next.js, these methods do NOT wrap navigation in
|
|
12
|
+
* startTransition. In Next.js, router state is React state (useReducer)
|
|
13
|
+
* so startTransition defers the update and provides isPending tracking.
|
|
14
|
+
* In timber, navigation calls reactRoot.render() which is a root-level
|
|
15
|
+
* render — startTransition has no effect on root renders.
|
|
16
|
+
*
|
|
17
|
+
* Navigation state (params, pathname) is delivered atomically via
|
|
18
|
+
* NavigationContext embedded in the element tree passed to
|
|
19
|
+
* reactRoot.render(). See design/19-client-navigation.md §"NavigationContext".
|
|
20
|
+
*
|
|
21
|
+
* For loading UI during navigation, use:
|
|
22
|
+
* - useLinkStatus() — per-link pending indicator (inside <Link>)
|
|
23
|
+
* - useNavigationPending() — global navigation pending state
|
|
10
24
|
*/
|
|
11
25
|
export interface AppRouterInstance {
|
|
12
26
|
/** Navigate to a URL, pushing a new history entry */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-router.d.ts","sourceRoot":"","sources":["../../src/client/use-router.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-router.d.ts","sourceRoot":"","sources":["../../src/client/use-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACzD,6DAA6D;IAC7D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5D,sDAAsD;IACtD,OAAO,IAAI,IAAI,CAAC;IAChB,+BAA+B;IAC/B,IAAI,IAAI,IAAI,CAAC;IACb,kCAAkC;IAClC,OAAO,IAAI,IAAI,CAAC;IAChB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,IAAI,iBAAiB,CA4C7C"}
|
package/dist/cookies/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../_chunks/als-registry-c0AGnbqS.js";
|
|
2
2
|
import { n as cookies } from "../_chunks/request-context-C69VW4xS.js";
|
|
3
|
-
import "../_chunks/ssr-data-
|
|
4
|
-
import { t as useCookie } from "../_chunks/use-cookie-
|
|
3
|
+
import "../_chunks/ssr-data-DLnbYpj1.js";
|
|
4
|
+
import { t as useCookie } from "../_chunks/use-cookie-dDbpCTx-.js";
|
|
5
5
|
//#region src/cookies/define-cookie.ts
|
|
6
6
|
/**
|
|
7
7
|
* defineCookie — typed cookie definitions.
|