@timber-js/app 0.2.0-alpha.184 → 0.2.0-alpha.186
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/{actions-O_LsyCE4.js → actions-C-Rw9vPc.js} +3 -3
- package/dist/_chunks/{actions-O_LsyCE4.js.map → actions-C-Rw9vPc.js.map} +1 -1
- package/dist/_chunks/als-slots-mFweg276.js +27 -0
- package/dist/_chunks/als-slots-mFweg276.js.map +1 -0
- package/dist/_chunks/base-path-DaQrzbez.js +80 -0
- package/dist/_chunks/base-path-DaQrzbez.js.map +1 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js +86 -0
- package/dist/_chunks/build-manifest-DWppEdLB.js.map +1 -0
- package/dist/_chunks/build-output-helper-C3DrfzZR.js +369 -0
- package/dist/_chunks/build-output-helper-C3DrfzZR.js.map +1 -0
- package/dist/_chunks/{cache-api-B-lhk9p4.js → cache-api-Cd0VZ_Pd.js} +3 -3
- package/dist/_chunks/{cache-api-B-lhk9p4.js.map → cache-api-Cd0VZ_Pd.js.map} +1 -1
- package/dist/_chunks/cli-schema-sync-CKgHC2MB.js +1857 -0
- package/dist/_chunks/cli-schema-sync-CKgHC2MB.js.map +1 -0
- package/dist/_chunks/{cloudflare-CnT5Lr7U.js → cloudflare-Cs0uZXea.js} +89 -12
- package/dist/_chunks/{cloudflare-CnT5Lr7U.js.map → cloudflare-Cs0uZXea.js.map} +1 -1
- package/dist/_chunks/error-boundary-DpYRI_I1.js +330 -0
- package/dist/_chunks/error-boundary-DpYRI_I1.js.map +1 -0
- package/dist/_chunks/{fast-hash-D6hIVt1Y.js → fast-hash-C-tVYrLb.js} +6 -1
- package/dist/_chunks/fast-hash-C-tVYrLb.js.map +1 -0
- package/dist/_chunks/fs-identity-D7vb6GdI.js +208 -0
- package/dist/_chunks/fs-identity-D7vb6GdI.js.map +1 -0
- package/dist/_chunks/{logger-AWfuX-KJ.js → logger-N7e5auP0.js} +9 -13
- package/dist/_chunks/logger-N7e5auP0.js.map +1 -0
- package/dist/_chunks/navigation-root-B29qg0_T.js +274 -0
- package/dist/_chunks/navigation-root-B29qg0_T.js.map +1 -0
- package/dist/_chunks/param-value-C8TNYchQ.js +66 -0
- package/dist/_chunks/param-value-C8TNYchQ.js.map +1 -0
- package/dist/_chunks/{plugin-context---kTF5v8.js → plugin-context-DEGLSJs3.js} +2 -1
- package/dist/_chunks/plugin-context-DEGLSJs3.js.map +1 -0
- package/dist/_chunks/{router-ref-CtmF-aPv.js → router-ref-DuYuV_0Q.js} +2 -2
- package/dist/_chunks/router-ref-DuYuV_0Q.js.map +1 -0
- package/dist/_chunks/rsc-cache-key-DD0fl_-s.js +243 -0
- package/dist/_chunks/rsc-cache-key-DD0fl_-s.js.map +1 -0
- package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js +40 -0
- package/dist/_chunks/rsc-error-envelope-tT5PJs4q.js.map +1 -0
- package/dist/_chunks/rsc-payload-path-B_LBodc2.js +48 -0
- package/dist/_chunks/rsc-payload-path-B_LBodc2.js.map +1 -0
- package/dist/_chunks/{segment-classify-Byy425ng.js → segment-classify-C539Pa2O.js} +23 -2
- package/dist/_chunks/segment-classify-C539Pa2O.js.map +1 -0
- package/dist/_chunks/{canonicalize-DQHyFClh.js → segment-keys-BawYuNFO.js} +61 -2
- package/dist/_chunks/segment-keys-BawYuNFO.js.map +1 -0
- package/dist/_chunks/slot-params-BCTmZkQB.js +76 -0
- package/dist/_chunks/slot-params-BCTmZkQB.js.map +1 -0
- package/dist/_chunks/{ssr-data-BOWsq18U.js → ssr-data-14MXm7Pj.js} +17 -2
- package/dist/_chunks/ssr-data-14MXm7Pj.js.map +1 -0
- package/dist/_chunks/use-segment-params-ClyUNq4d.js +128 -0
- package/dist/_chunks/use-segment-params-ClyUNq4d.js.map +1 -0
- package/dist/_chunks/{walkers-BtTlKviE.js → walkers-BhhwI9TD.js} +21 -87
- package/dist/_chunks/walkers-BhhwI9TD.js.map +1 -0
- package/dist/adapters/build-output-helper.d.ts +37 -0
- package/dist/adapters/build-output-helper.d.ts.map +1 -1
- package/dist/adapters/cloudflare-dev.js +1 -1
- package/dist/adapters/cloudflare-kv-cache.js +1 -1
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js +1 -1
- package/dist/adapters/fs-identity.d.ts +64 -0
- package/dist/adapters/fs-identity.d.ts.map +1 -0
- package/dist/adapters/nitro.d.ts.map +1 -1
- package/dist/adapters/nitro.js +2 -3
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +57 -1
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/adapters/types.d.ts +13 -1
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cache/fast-hash.d.ts +5 -0
- package/dist/cache/fast-hash.d.ts.map +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cli.js +2 -2
- package/dist/client/browser-entry/action-dispatch.d.ts.map +1 -1
- package/dist/client/browser-entry/hydrate.d.ts +20 -9
- package/dist/client/browser-entry/hydrate.d.ts.map +1 -1
- package/dist/client/browser-entry/post-hydration.d.ts +4 -1
- package/dist/client/browser-entry/post-hydration.d.ts.map +1 -1
- package/dist/client/browser-entry/router-init.d.ts +3 -0
- package/dist/client/browser-entry/router-init.d.ts.map +1 -1
- package/dist/client/browser-entry/rsc-stream.d.ts +8 -0
- package/dist/client/browser-entry/rsc-stream.d.ts.map +1 -1
- package/dist/client/error-boundary.d.ts +1 -0
- package/dist/client/error-boundary.d.ts.map +1 -1
- package/dist/client/error-boundary.js +1 -162
- package/dist/client/history.d.ts +13 -6
- package/dist/client/history.d.ts.map +1 -1
- package/dist/client/index.js +18 -11
- package/dist/client/index.js.map +1 -1
- package/dist/client/internal.d.ts +4 -3
- package/dist/client/internal.d.ts.map +1 -1
- package/dist/client/internal.js +872 -305
- package/dist/client/internal.js.map +1 -1
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/navigation-api.d.ts +2 -2
- package/dist/client/navigation-commit.d.ts +71 -0
- package/dist/client/navigation-commit.d.ts.map +1 -0
- package/dist/client/navigation-context.d.ts +37 -20
- package/dist/client/navigation-context.d.ts.map +1 -1
- package/dist/client/navigation-root.d.ts +63 -23
- package/dist/client/navigation-root.d.ts.map +1 -1
- package/dist/client/params-context.d.ts +81 -0
- package/dist/client/params-context.d.ts.map +1 -0
- package/dist/client/router-effects.d.ts +129 -0
- package/dist/client/router-effects.d.ts.map +1 -0
- package/dist/client/router-lifecycle.d.ts +55 -0
- package/dist/client/router-lifecycle.d.ts.map +1 -0
- package/dist/client/router-pipeline.d.ts +84 -0
- package/dist/client/router-pipeline.d.ts.map +1 -0
- package/dist/client/router-ref.d.ts +1 -1
- package/dist/client/router-ref.d.ts.map +1 -1
- package/dist/client/router-skew.d.ts +21 -0
- package/dist/client/router-skew.d.ts.map +1 -0
- package/dist/client/router-types.d.ts +207 -0
- package/dist/client/router-types.d.ts.map +1 -0
- package/dist/client/router.d.ts +1 -182
- package/dist/client/router.d.ts.map +1 -1
- package/dist/client/rsc-fetch.d.ts +39 -16
- package/dist/client/rsc-fetch.d.ts.map +1 -1
- package/dist/client/segment-cache.d.ts +79 -34
- package/dist/client/segment-cache.d.ts.map +1 -1
- package/dist/client/ssr-data.d.ts +6 -0
- package/dist/client/ssr-data.d.ts.map +1 -1
- package/dist/client/stale-client.d.ts +69 -0
- package/dist/client/stale-client.d.ts.map +1 -0
- package/dist/client/state.d.ts +10 -1
- package/dist/client/state.d.ts.map +1 -1
- package/dist/client/top-loader.d.ts +2 -1
- package/dist/client/top-loader.d.ts.map +1 -1
- package/dist/client/unload-guard.d.ts +5 -0
- package/dist/client/unload-guard.d.ts.map +1 -1
- package/dist/client/use-cookie.d.ts.map +1 -1
- package/dist/client/use-router.d.ts +1 -1
- package/dist/client/use-segment-params.d.ts +18 -8
- package/dist/client/use-segment-params.d.ts.map +1 -1
- package/dist/cookies/index.js +3 -3
- package/dist/cookies/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +915 -320
- package/dist/index.js.map +1 -1
- package/dist/plugin-context.d.ts +33 -1
- package/dist/plugin-context.d.ts.map +1 -1
- package/dist/plugins/adapter-build.d.ts.map +1 -1
- package/dist/plugins/build-manifest.d.ts +1 -1
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/entries.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/plugins/request-dep/analysis.d.ts +106 -0
- package/dist/plugins/request-dep/analysis.d.ts.map +1 -0
- package/dist/plugins/request-dep/index.d.ts +75 -0
- package/dist/plugins/request-dep/index.d.ts.map +1 -0
- package/dist/plugins/request-dep/origin.d.ts +61 -0
- package/dist/plugins/request-dep/origin.d.ts.map +1 -0
- package/dist/plugins/routing.d.ts +9 -0
- package/dist/plugins/routing.d.ts.map +1 -1
- package/dist/plugins/static-build.d.ts +149 -8
- package/dist/plugins/static-build.d.ts.map +1 -1
- package/dist/routing/codegen-types.d.ts +18 -0
- package/dist/routing/codegen-types.d.ts.map +1 -1
- package/dist/routing/codegen.d.ts.map +1 -1
- package/dist/routing/collision-probe.d.ts +104 -0
- package/dist/routing/collision-probe.d.ts.map +1 -0
- package/dist/routing/collision-spaces.d.ts +26 -0
- package/dist/routing/collision-spaces.d.ts.map +1 -0
- package/dist/routing/index.js +3 -3
- package/dist/routing/interception.d.ts +235 -6
- package/dist/routing/interception.d.ts.map +1 -1
- package/dist/routing/manifest-codegen.d.ts.map +1 -1
- package/dist/routing/scanner.d.ts.map +1 -1
- package/dist/routing/segment-classify.d.ts +33 -0
- package/dist/routing/segment-classify.d.ts.map +1 -1
- package/dist/routing/segment-keys.d.ts +95 -0
- package/dist/routing/segment-keys.d.ts.map +1 -0
- package/dist/routing/slot-placement.d.ts +48 -0
- package/dist/routing/slot-placement.d.ts.map +1 -0
- package/dist/routing/types.d.ts +1 -3
- package/dist/routing/types.d.ts.map +1 -1
- package/dist/routing/walkers.d.ts +6 -0
- package/dist/routing/walkers.d.ts.map +1 -1
- package/dist/search-params/define.d.ts +0 -6
- package/dist/search-params/define.d.ts.map +1 -1
- package/dist/search-params/index.js +176 -2
- package/dist/search-params/index.js.map +1 -1
- package/dist/segment-params/define.d.ts +0 -6
- package/dist/segment-params/define.d.ts.map +1 -1
- package/dist/segment-params/index.js +69 -1
- package/dist/segment-params/index.js.map +1 -0
- package/dist/server/actions.d.ts +6 -3
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/als-registry.d.ts +2 -1
- package/dist/server/als-registry.d.ts.map +1 -1
- package/dist/server/build-manifest.d.ts +13 -1
- package/dist/server/build-manifest.d.ts.map +1 -1
- package/dist/server/chain-url-parts.d.ts +82 -0
- package/dist/server/chain-url-parts.d.ts.map +1 -0
- package/dist/server/children-interception.d.ts +49 -0
- package/dist/server/children-interception.d.ts.map +1 -0
- package/dist/server/default-status-page.d.ts +45 -0
- package/dist/server/default-status-page.d.ts.map +1 -0
- package/dist/server/deny-boundary.d.ts +4 -7
- package/dist/server/deny-boundary.d.ts.map +1 -1
- package/dist/server/deny-renderer.d.ts +14 -3
- package/dist/server/deny-renderer.d.ts.map +1 -1
- package/dist/server/head-response.d.ts +35 -0
- package/dist/server/head-response.d.ts.map +1 -0
- package/dist/server/index.js +2 -2
- package/dist/server/internal.js +528 -373
- package/dist/server/internal.js.map +1 -1
- package/dist/server/param-coercion.d.ts +10 -1
- package/dist/server/param-coercion.d.ts.map +1 -1
- package/dist/server/pipeline-helpers.d.ts +0 -18
- package/dist/server/pipeline-helpers.d.ts.map +1 -1
- package/dist/server/pipeline-interception.d.ts +59 -9
- package/dist/server/pipeline-interception.d.ts.map +1 -1
- package/dist/server/pipeline-outcome.d.ts.map +1 -1
- package/dist/server/pipeline-phases.d.ts.map +1 -1
- package/dist/server/pipeline.d.ts +11 -0
- package/dist/server/pipeline.d.ts.map +1 -1
- package/dist/server/prebuilt-builder.d.ts.map +1 -1
- package/dist/server/primitives.d.ts +0 -12
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/publish-params.d.ts +33 -0
- package/dist/server/publish-params.d.ts.map +1 -0
- package/dist/server/request-context.d.ts +48 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts +32 -2
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/route-handler.d.ts.map +1 -1
- package/dist/server/route-matcher.d.ts +13 -0
- package/dist/server/route-matcher.d.ts.map +1 -1
- package/dist/server/rsc-cache-key-guard.d.ts +78 -0
- package/dist/server/rsc-cache-key-guard.d.ts.map +1 -0
- package/dist/server/rsc-entry/api-handler.d.ts.map +1 -1
- package/dist/server/rsc-entry/error-renderer.d.ts +14 -2
- package/dist/server/rsc-entry/error-renderer.d.ts.map +1 -1
- package/dist/server/rsc-entry/helpers.d.ts +2 -10
- package/dist/server/rsc-entry/helpers.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/rsc-entry/render-route.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-payload.d.ts +3 -2
- package/dist/server/rsc-entry/rsc-payload.d.ts.map +1 -1
- package/dist/server/rsc-entry/rsc-stream.d.ts +3 -2
- package/dist/server/rsc-entry/rsc-stream.d.ts.map +1 -1
- package/dist/server/rsc-entry/ssr-renderer.d.ts +2 -0
- package/dist/server/rsc-entry/ssr-renderer.d.ts.map +1 -1
- package/dist/server/sitemap-generator.d.ts.map +1 -1
- package/dist/server/skippable-prefix.d.ts +23 -0
- package/dist/server/skippable-prefix.d.ts.map +1 -0
- package/dist/server/slot-interception.d.ts +80 -0
- package/dist/server/slot-interception.d.ts.map +1 -0
- package/dist/server/slot-resolver.d.ts +70 -8
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-bridge-types.d.ts +6 -0
- package/dist/server/ssr-bridge-types.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/server/ssr-wrappers.d.ts +24 -13
- package/dist/server/ssr-wrappers.d.ts.map +1 -1
- package/dist/server/state-tree-diff.d.ts +6 -27
- package/dist/server/state-tree-diff.d.ts.map +1 -1
- package/dist/server/static-generator.d.ts +6 -0
- package/dist/server/static-generator.d.ts.map +1 -1
- package/dist/server/static-not-found.d.ts +52 -0
- package/dist/server/static-not-found.d.ts.map +1 -0
- package/dist/server/status-code-resolver.d.ts +3 -10
- package/dist/server/status-code-resolver.d.ts.map +1 -1
- package/dist/shared/als-slots.d.ts +41 -0
- package/dist/shared/als-slots.d.ts.map +1 -0
- package/dist/shared/base-path.d.ts +56 -0
- package/dist/shared/base-path.d.ts.map +1 -0
- package/dist/shared/param-value.d.ts +80 -0
- package/dist/shared/param-value.d.ts.map +1 -0
- package/dist/shared/payload-root.d.ts +108 -0
- package/dist/shared/payload-root.d.ts.map +1 -0
- package/dist/shared/rsc-cache-key.d.ts +163 -0
- package/dist/shared/rsc-cache-key.d.ts.map +1 -0
- package/dist/shared/rsc-error-envelope.d.ts +25 -0
- package/dist/shared/rsc-error-envelope.d.ts.map +1 -0
- package/dist/shared/rsc-manifest.d.ts +28 -0
- package/dist/shared/rsc-manifest.d.ts.map +1 -0
- package/dist/shared/rsc-payload-path.d.ts +42 -0
- package/dist/shared/rsc-payload-path.d.ts.map +1 -0
- package/dist/shared/segment-info.d.ts +59 -0
- package/dist/shared/segment-info.d.ts.map +1 -0
- package/dist/shared/slot-params.d.ts +51 -0
- package/dist/shared/slot-params.d.ts.map +1 -0
- package/dist/shared/static-platform-files.d.ts +71 -0
- package/dist/shared/static-platform-files.d.ts.map +1 -0
- package/dist/shims/navigation-client.d.ts +8 -19
- package/dist/shims/navigation-client.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +0 -1
- package/dist/shims/navigation.d.ts.map +1 -1
- package/docs/api/31-api-client.mdx +4 -2
- package/docs/learn/02-pages-and-layouts.mdx +1 -1
- package/docs/learn/11-error-handling.mdx +4 -3
- package/docs/learn/12-client-navigation.mdx +2 -2
- package/docs/learn/14-deploying.mdx +23 -0
- package/docs/more/01-advanced-routing.mdx +172 -2
- package/docs/more/04-metadata-and-fonts.mdx +1 -1
- package/package.json +2 -2
- package/src/adapters/build-output-helper.ts +116 -3
- package/src/adapters/cloudflare.ts +86 -11
- package/src/adapters/fs-identity.ts +156 -0
- package/src/adapters/nitro.ts +6 -6
- package/src/adapters/shared.ts +196 -21
- package/src/adapters/types.ts +13 -1
- package/src/cache/fast-hash.ts +5 -0
- package/src/client/browser-entry/action-dispatch.ts +9 -4
- package/src/client/browser-entry/hydrate.ts +40 -29
- package/src/client/browser-entry/index.ts +15 -1
- package/src/client/browser-entry/post-hydration.ts +10 -9
- package/src/client/browser-entry/router-init.ts +104 -48
- package/src/client/browser-entry/rsc-stream.ts +11 -2
- package/src/client/error-boundary.tsx +20 -15
- package/src/client/history.ts +13 -6
- package/src/client/internal.ts +4 -3
- package/src/client/link.tsx +55 -8
- package/src/client/navigation-api.ts +3 -3
- package/src/client/navigation-commit.ts +174 -0
- package/src/client/navigation-context.ts +40 -67
- package/src/client/navigation-root.tsx +326 -101
- package/src/client/params-context.ts +192 -0
- package/src/client/router-effects.ts +231 -0
- package/src/client/router-lifecycle.ts +288 -0
- package/src/client/router-pipeline.ts +389 -0
- package/src/client/router-ref.ts +1 -1
- package/src/client/router-skew.ts +30 -0
- package/src/client/router-types.ts +230 -0
- package/src/client/router.ts +242 -690
- package/src/client/rsc-fetch.ts +180 -122
- package/src/client/segment-cache.ts +121 -44
- package/src/client/ssr-data.ts +6 -0
- package/src/client/stale-client.ts +191 -0
- package/src/client/state.ts +14 -1
- package/src/client/top-loader.tsx +2 -1
- package/src/client/unload-guard.ts +34 -2
- package/src/client/use-cookie.ts +9 -2
- package/src/client/use-router.ts +1 -1
- package/src/client/use-segment-params.ts +41 -18
- package/src/index.ts +5 -1
- package/src/plugin-context.ts +34 -1
- package/src/plugins/adapter-build.ts +4 -0
- package/src/plugins/build-manifest.ts +34 -13
- package/src/plugins/entries.ts +4 -0
- package/src/plugins/fonts.ts +11 -8
- package/src/plugins/request-dep/analysis.ts +447 -0
- package/src/plugins/request-dep/index.ts +376 -0
- package/src/plugins/request-dep/origin.ts +310 -0
- package/src/plugins/routing.ts +60 -3
- package/src/plugins/static-build.ts +333 -63
- package/src/routing/codegen-types.ts +18 -0
- package/src/routing/codegen.ts +50 -10
- package/src/routing/collision-probe.ts +438 -0
- package/src/routing/collision-spaces.ts +281 -0
- package/src/routing/interception.ts +896 -50
- package/src/routing/manifest-codegen.ts +6 -9
- package/src/routing/scanner.ts +114 -113
- package/src/routing/segment-classify.ts +57 -0
- package/src/routing/segment-keys.ts +146 -0
- package/src/routing/slot-placement.ts +97 -0
- package/src/routing/types.ts +1 -3
- package/src/routing/walkers.ts +8 -0
- package/src/search-params/define.ts +6 -29
- package/src/segment-params/define.ts +4 -27
- package/src/server/action-handler.ts +3 -1
- package/src/server/actions.ts +6 -3
- package/src/server/als-registry.ts +2 -1
- package/src/server/build-manifest.ts +14 -1
- package/src/server/chain-url-parts.ts +163 -0
- package/src/server/children-interception.ts +115 -0
- package/src/server/default-status-page.ts +127 -0
- package/src/server/deny-boundary.ts +5 -31
- package/src/server/deny-renderer.ts +83 -22
- package/src/server/head-response.ts +54 -0
- package/src/server/param-coercion.ts +48 -18
- package/src/server/pipeline-helpers.ts +0 -45
- package/src/server/pipeline-interception.ts +81 -32
- package/src/server/pipeline-outcome.ts +3 -5
- package/src/server/pipeline-phases.ts +68 -16
- package/src/server/pipeline.ts +57 -10
- package/src/server/prebuilt-builder.ts +1 -7
- package/src/server/prebuilt-runtime.ts +4 -4
- package/src/server/primitives.ts +0 -18
- package/src/server/publish-params.ts +42 -0
- package/src/server/request-context.ts +97 -18
- package/src/server/route-element-builder.ts +89 -98
- package/src/server/route-handler.ts +8 -8
- package/src/server/route-matcher.ts +21 -9
- package/src/server/rsc-cache-key-guard.ts +170 -0
- package/src/server/rsc-entry/api-handler.ts +6 -8
- package/src/server/rsc-entry/error-renderer.ts +64 -25
- package/src/server/rsc-entry/helpers.ts +31 -16
- package/src/server/rsc-entry/index.ts +36 -28
- package/src/server/rsc-entry/render-route.ts +12 -7
- package/src/server/rsc-entry/revalidate-renderer.ts +1 -1
- package/src/server/rsc-entry/rsc-payload.ts +14 -25
- package/src/server/rsc-entry/rsc-stream.ts +4 -3
- package/src/server/rsc-entry/ssr-renderer.ts +13 -9
- package/src/server/sitemap-generator.ts +1 -7
- package/src/server/skippable-prefix.ts +92 -0
- package/src/server/slot-interception.ts +168 -0
- package/src/server/slot-resolver.ts +253 -156
- package/src/server/ssr-bridge-types.ts +6 -0
- package/src/server/ssr-entry.ts +12 -4
- package/src/server/ssr-wrappers.tsx +33 -32
- package/src/server/state-tree-diff.ts +14 -55
- package/src/server/static-generator.ts +67 -45
- package/src/server/static-not-found.ts +134 -0
- package/src/server/status-code-resolver.ts +4 -47
- package/src/shared/als-slots.ts +72 -0
- package/src/shared/base-path.ts +80 -0
- package/src/shared/param-value.ts +244 -0
- package/src/shared/payload-root.ts +151 -0
- package/src/shared/rsc-cache-key.ts +269 -0
- package/src/shared/rsc-error-envelope.ts +31 -0
- package/src/shared/rsc-manifest.ts +29 -0
- package/src/shared/rsc-payload-path.ts +45 -0
- package/src/shared/segment-info.ts +60 -0
- package/src/shared/slot-params.ts +111 -0
- package/src/shared/static-platform-files.ts +75 -0
- package/src/shims/navigation-client.ts +8 -26
- package/src/shims/navigation.ts +0 -4
- package/dist/_chunks/build-output-helper-DOGYFb_X.js +0 -196
- package/dist/_chunks/build-output-helper-DOGYFb_X.js.map +0 -1
- package/dist/_chunks/canonicalize-DQHyFClh.js.map +0 -1
- package/dist/_chunks/cli-schema-sync-D3naS3eH.js +0 -688
- package/dist/_chunks/cli-schema-sync-D3naS3eH.js.map +0 -1
- package/dist/_chunks/define-COtkxMRT.js +0 -191
- package/dist/_chunks/define-COtkxMRT.js.map +0 -1
- package/dist/_chunks/define-c4au4I9R.js +0 -82
- package/dist/_chunks/define-c4au4I9R.js.map +0 -1
- package/dist/_chunks/fast-hash-D6hIVt1Y.js.map +0 -1
- package/dist/_chunks/logger-AWfuX-KJ.js.map +0 -1
- package/dist/_chunks/navigation-root-bUDZLw74.js +0 -124
- package/dist/_chunks/navigation-root-bUDZLw74.js.map +0 -1
- package/dist/_chunks/plugin-context---kTF5v8.js.map +0 -1
- package/dist/_chunks/router-ref-CtmF-aPv.js.map +0 -1
- package/dist/_chunks/segment-classify-Byy425ng.js.map +0 -1
- package/dist/_chunks/ssr-data-BOWsq18U.js.map +0 -1
- package/dist/_chunks/use-segment-params-D1CzlgBo.js +0 -151
- package/dist/_chunks/use-segment-params-D1CzlgBo.js.map +0 -1
- package/dist/_chunks/walkers-BtTlKviE.js.map +0 -1
- package/dist/client/error-boundary.js.map +0 -1
- package/dist/plugins/request-dep.d.ts +0 -32
- package/dist/plugins/request-dep.d.ts.map +0 -1
- package/src/plugins/request-dep.ts +0 -499
|
@@ -81,8 +81,8 @@ export interface NavigationApiController {
|
|
|
81
81
|
/**
|
|
82
82
|
* Resolve the deferred promise created by setRouterNavigating(true),
|
|
83
83
|
* clearing the browser's native loading state. Call this when the
|
|
84
|
-
* navigation fully completes —
|
|
85
|
-
*
|
|
84
|
+
* navigation fully completes — the same finally block in router.navigate
|
|
85
|
+
* that clears the router's pending store.
|
|
86
86
|
*/
|
|
87
87
|
completeRouterNavigation: () => void;
|
|
88
88
|
/**
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What it means for a page to be "current" on the client.
|
|
3
|
+
*
|
|
4
|
+
* One module owns every write that makes a navigation's destination the
|
|
5
|
+
* current page, and the read that describes the current page back to the
|
|
6
|
+
* server. Keeping them together is the point: `X-Timber-State-Tree` is
|
|
7
|
+
* derived from the segment cache, so the thing that publishes and the thing
|
|
8
|
+
* that reports have to agree about when a page becomes current.
|
|
9
|
+
*
|
|
10
|
+
* See design/19-client-navigation.md §"State Update Invariants".
|
|
11
|
+
*/
|
|
12
|
+
import { type SegmentCache } from './segment-cache.js';
|
|
13
|
+
import type { HistoryStack } from './history.js';
|
|
14
|
+
import type { SegmentInfo, StateTree } from '../shared/segment-info.js';
|
|
15
|
+
import type { ParamsSource } from '../shared/payload-root.js';
|
|
16
|
+
import { type NavigationState } from './navigation-context.js';
|
|
17
|
+
/** Everything a commit needs to describe the page it makes current. */
|
|
18
|
+
export interface NavigationCommitInput {
|
|
19
|
+
payload: unknown;
|
|
20
|
+
/** The params that payload published — replayed with it on popstate. */
|
|
21
|
+
params: ParamsSource;
|
|
22
|
+
/**
|
|
23
|
+
* The rendered chain's metadata, or null/undefined when this commit
|
|
24
|
+
* carries none at all — a revalidation payload, or a history entry
|
|
25
|
+
* stored before the channel existed.
|
|
26
|
+
*
|
|
27
|
+
* An empty *array* is a different statement from an absent one: the
|
|
28
|
+
* server rendered a route with no layout-bearing segments (a layoutless
|
|
29
|
+
* app — the missing-root-layout check is a warning, not an error), so
|
|
30
|
+
* the correct tree is the empty one. Collapsing the two left the
|
|
31
|
+
* departing route's tree in place, which `treePaths` then reported as
|
|
32
|
+
* mounted — enough to select an intercepting rewrite whose slot is not
|
|
33
|
+
* on screen (TIM-1282).
|
|
34
|
+
*/
|
|
35
|
+
segmentInfo?: SegmentInfo[] | null;
|
|
36
|
+
/** When true, clear the segment cache if segmentInfo is absent
|
|
37
|
+
* (popstate replay for entries without layout metadata). */
|
|
38
|
+
clearSegmentCacheOnEmpty?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A navigation's destination, split into what a render needs and what a
|
|
42
|
+
* commit publishes.
|
|
43
|
+
*/
|
|
44
|
+
export interface PreparedNavigation {
|
|
45
|
+
/** The state the incoming tree renders with. Pure — safe before winning. */
|
|
46
|
+
navState: NavigationState;
|
|
47
|
+
/** Publishes the destination. Call only once the render has won. */
|
|
48
|
+
commit: () => void;
|
|
49
|
+
}
|
|
50
|
+
export interface NavigationCommitter {
|
|
51
|
+
prepareNavigation(url: string, opts: NavigationCommitInput): PreparedNavigation;
|
|
52
|
+
currentStateTree(): StateTree | undefined;
|
|
53
|
+
updateSegmentCache(segmentInfo: SegmentInfo[] | null | undefined): void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Derive the navigation state (pathname + search) a URL renders with.
|
|
57
|
+
*
|
|
58
|
+
* Pure: publishing it — the module-level fallback for tests and SSR, and the
|
|
59
|
+
* globalThis bridge — is `prepareNavigation`'s commit, which runs only once
|
|
60
|
+
* the render is known to have won (TIM-1301). Callers pass the returned value
|
|
61
|
+
* explicitly to renderRoot/wrapPayload, so a render never depends on the
|
|
62
|
+
* publish having happened first.
|
|
63
|
+
*/
|
|
64
|
+
export declare function deriveNavigationState(url: string): NavigationState;
|
|
65
|
+
export declare function createNavigationCommitter(deps: {
|
|
66
|
+
segmentCache: SegmentCache;
|
|
67
|
+
historyStack: HistoryStack;
|
|
68
|
+
/** Read at call time — the router's `clientSegmentCache` opt-in. */
|
|
69
|
+
clientSegmentCache: () => boolean | undefined;
|
|
70
|
+
}): NavigationCommitter;
|
|
71
|
+
//# sourceMappingURL=navigation-commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-commit.d.ts","sourceRoot":"","sources":["../../src/client/navigation-commit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnF,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,MAAM,EAAE,YAAY,CAAC;IACrB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IACnC;iEAC6D;IAC7D,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,QAAQ,EAAE,eAAe,CAAC;IAC1B,oEAAoE;IACpE,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,kBAAkB,CAAC;IAChF,gBAAgB,IAAI,SAAS,GAAG,SAAS,CAAC;IAC1C,kBAAkB,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;CACzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAQlE;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,oEAAoE;IACpE,kBAAkB,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC;CAC/C,GAAG,mBAAmB,CA0FtB"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NavigationContext — React context for navigation state.
|
|
3
3
|
*
|
|
4
|
-
* Holds the current
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Holds the current pathname and search, updated atomically with the RSC
|
|
5
|
+
* tree on each navigation. This replaces the previous useSyncExternalStore
|
|
6
|
+
* approach for usePathname() and useSearchParams(), which suffered from a
|
|
7
|
+
* timing gap: the new tree could commit before the external store
|
|
8
|
+
* re-renders fired, causing a frame where both old and new active states
|
|
9
|
+
* were visible simultaneously.
|
|
10
|
+
*
|
|
11
|
+
* Segment params are NOT here — see the note on NavigationState below.
|
|
10
12
|
*
|
|
11
13
|
* By wrapping the RSC payload element in NavigationProvider inside
|
|
12
14
|
* renderRoot(), the context value and the element tree are passed to
|
|
13
15
|
* reactRoot.render() in the same call — atomic by construction.
|
|
14
|
-
* All consumers (
|
|
16
|
+
* All consumers (usePathname, useSearchParams) see the new values in the
|
|
15
17
|
* same render pass as the new tree.
|
|
16
18
|
*
|
|
17
19
|
* During SSR, no NavigationProvider is mounted. Hooks fall back to
|
|
@@ -37,15 +39,24 @@
|
|
|
37
39
|
* See design/19-client-navigation.md §"NavigationContext"
|
|
38
40
|
*/
|
|
39
41
|
import React, { type ReactNode } from 'react';
|
|
42
|
+
/**
|
|
43
|
+
* What the browser knows about the current location.
|
|
44
|
+
*
|
|
45
|
+
* Params are deliberately absent: they are a property of the tree the server
|
|
46
|
+
* rendered, not of the address bar, and they now travel inside the payload as
|
|
47
|
+
* the payload root. Keeping a copy here meant the router had to thread
|
|
48
|
+
* the record from a response header into context on every path — navigation,
|
|
49
|
+
* traversal, prefetch, revalidation — and each of those was a place to drop it
|
|
50
|
+
* (TIM-1294).
|
|
51
|
+
*/
|
|
40
52
|
export interface NavigationState {
|
|
41
|
-
params: Record<string, string | string[]>;
|
|
42
53
|
pathname: string;
|
|
43
54
|
search: string;
|
|
44
55
|
}
|
|
45
56
|
/**
|
|
46
57
|
* Read the navigation context. Returns null during SSR (no provider)
|
|
47
58
|
* or in the RSC environment (no context available).
|
|
48
|
-
* Internal — used by
|
|
59
|
+
* Internal — used by usePathname() and useSearchParams().
|
|
49
60
|
*/
|
|
50
61
|
export declare function useNavigationContext(): NavigationState | null;
|
|
51
62
|
export interface NavigationProviderProps {
|
|
@@ -62,16 +73,22 @@ export declare function NavigationProvider({ value, children, }: NavigationProvi
|
|
|
62
73
|
export declare function setNavigationState(state: NavigationState): void;
|
|
63
74
|
export declare function getNavigationState(): NavigationState;
|
|
64
75
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
* the pending
|
|
76
|
+
* There was a second React context here — `PendingNavigationContext`, holding
|
|
77
|
+
* the in-flight navigation URL, provided by `NavigationRoot` out of a
|
|
78
|
+
* `useState` — plus a `usePendingNavigationUrl()` reader for it. Both are gone
|
|
79
|
+
* (TIM-1307).
|
|
80
|
+
*
|
|
81
|
+
* Nothing read them. `usePendingNavigation()` (use-pending-navigation.ts) and
|
|
82
|
+
* `TopLoader` both subscribe to the router's external pending store via
|
|
83
|
+
* `useSyncExternalStore`: sync priority, immune to transition entanglement,
|
|
84
|
+
* and cleared by `runNavigation`'s supersession-guarded `finally` (TIM-1034).
|
|
85
|
+
* The context was a parallel representation of the same fact that no consumer
|
|
86
|
+
* ever migrated to, and one that could not even agree with the store — a
|
|
87
|
+
* navigation superseded by a cached popstate replay left its URL set until the
|
|
88
|
+
* next full navigation, because the staleness guard skipped the clear and no
|
|
89
|
+
* other path touched it.
|
|
90
|
+
*
|
|
91
|
+
* One representation, and it is the router's. See
|
|
92
|
+
* design/19-client-navigation.md §"How Pending State Works".
|
|
72
93
|
*/
|
|
73
|
-
export declare function PendingNavigationProvider({ value, children, }: {
|
|
74
|
-
value: string | null;
|
|
75
|
-
children?: ReactNode;
|
|
76
|
-
}): React.ReactElement;
|
|
77
94
|
//# sourceMappingURL=navigation-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-context.d.ts","sourceRoot":"","sources":["../../src/client/navigation-context.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"navigation-context.d.ts","sourceRoot":"","sources":["../../src/client/navigation-context.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO7D;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAsCD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,eAAe,GAAG,IAAI,CAO7D;AAMD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE,uBAAuB,GAAG,KAAK,CAAC,YAAY,CAO9C;AA6BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAE/D;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAMD;;;;;;;;;;;;;;;;;;GAkBG"}
|
|
@@ -9,14 +9,18 @@
|
|
|
9
9
|
* NavigationRoot holds the current element in React state. Navigation
|
|
10
10
|
* updates call startTransition(() => setState(newElement)), which IS
|
|
11
11
|
* a transition update. React keeps the old committed tree visible while
|
|
12
|
-
*
|
|
12
|
+
* the new tree resolves, instead of hiding it behind a Suspense fallback.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* The navigation's async work runs OUTSIDE the transition scope and every
|
|
15
|
+
* state update it schedules gets its own synchronous `startTransition` — a
|
|
16
|
+
* transition scope does not survive an `await`, and an async callback that
|
|
17
|
+
* returns a thenable defers the commit past the promise callers await. See
|
|
18
|
+
* the long comment on `_navigateTransition` (TIM-1306).
|
|
19
|
+
*
|
|
20
|
+
* This component holds no pending state. The `TopLoader` it renders and the
|
|
21
|
+
* public `usePendingNavigation()` both subscribe to the router's external
|
|
22
|
+
* pending store; NavigationRoot's own `pendingUrl` was a second, unread
|
|
23
|
+
* representation of the same fact and is gone (TIM-1307).
|
|
20
24
|
*
|
|
21
25
|
* Hard navigation guard: When a hard navigation is triggered (500 error,
|
|
22
26
|
* version skew), the component throws an unresolved thenable AFTER all
|
|
@@ -32,6 +36,32 @@
|
|
|
32
36
|
*/
|
|
33
37
|
import { type ReactNode } from 'react';
|
|
34
38
|
import { type TopLoaderConfig } from './top-loader.js';
|
|
39
|
+
/**
|
|
40
|
+
* What a navigation's `perform()` hands back to the transition.
|
|
41
|
+
*
|
|
42
|
+
* Declared once and shared by every layer that passes it along — the router's
|
|
43
|
+
* `RouterDeps.navigateTransition` imports it too — so a field cannot be added
|
|
44
|
+
* to the producer and dropped by the adapter in between. `E` is the element
|
|
45
|
+
* type: `ReactNode` here, `unknown` in the router, which never touches it.
|
|
46
|
+
*/
|
|
47
|
+
export interface TransitionResult<E = ReactNode> {
|
|
48
|
+
/** The wrapped tree to render. */
|
|
49
|
+
element: E;
|
|
50
|
+
/** Resolves when the Flight stream finishes decoding, or null. */
|
|
51
|
+
decodePromise: Promise<void> | null;
|
|
52
|
+
/**
|
|
53
|
+
* Publishes the navigation's state — segment cache, pathname, address bar,
|
|
54
|
+
* history stack, and the client's record of the mounted tree — and
|
|
55
|
+
* announces it to listeners outside React.
|
|
56
|
+
*
|
|
57
|
+
* Run when React commits this tree, not when the tree is handed over: a
|
|
58
|
+
* tree React is still waiting on, or one a later navigation replaces first,
|
|
59
|
+
* has been given to React without being on screen. A superseded navigation
|
|
60
|
+
* never runs it and leaves every one of those consumers describing the
|
|
61
|
+
* route still on screen (TIM-1301).
|
|
62
|
+
*/
|
|
63
|
+
commit: () => void;
|
|
64
|
+
}
|
|
35
65
|
/**
|
|
36
66
|
* Invalidate all in-flight navigation transitions. Any navigateTransition()
|
|
37
67
|
* call whose perform() has not yet committed will reject with AbortError
|
|
@@ -61,9 +91,8 @@ export declare function isHardNavigating(): boolean;
|
|
|
61
91
|
/**
|
|
62
92
|
* Root wrapper component that enables transition-based rendering.
|
|
63
93
|
*
|
|
64
|
-
* Renders
|
|
65
|
-
*
|
|
66
|
-
* (the provider renders no extra DOM elements).
|
|
94
|
+
* Renders the TopLoader alongside the tree it holds in state. Neither adds a
|
|
95
|
+
* DOM element on the hydration path, so the tree matches the server HTML.
|
|
67
96
|
*
|
|
68
97
|
* Usage in browser-entry.ts:
|
|
69
98
|
* const rootEl = createElement(NavigationRoot, { initial: wrapped });
|
|
@@ -88,22 +117,33 @@ export declare function NavigationRoot({ initial, topLoaderConfig, }: {
|
|
|
88
117
|
*/
|
|
89
118
|
export declare function transitionRender(element: ReactNode): void;
|
|
90
119
|
/**
|
|
91
|
-
* Run a full navigation
|
|
92
|
-
*
|
|
93
|
-
* The `perform` callback
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
120
|
+
* Run a full navigation, handing its tree to React in a transition.
|
|
121
|
+
*
|
|
122
|
+
* The `perform` callback fetches the RSC payload, updates router state, and
|
|
123
|
+
* returns the wrapped React element. `perform` is async by contract and runs
|
|
124
|
+
* OUTSIDE any transition scope — only the `setRendered` that hands its result
|
|
125
|
+
* over is wrapped, in a synchronous `startTransition`.
|
|
126
|
+
*
|
|
127
|
+
* Do not call this from inside a React action scope, and never let a
|
|
128
|
+
* `startTransition` callback in this path return a thenable: either opens an
|
|
129
|
+
* action scope that entangles the update and defers the commit until the
|
|
130
|
+
* action settles (TIM-1306, TIM-1307).
|
|
131
|
+
*
|
|
132
|
+
* Returns a Promise that resolves when the async work completes — the payload
|
|
133
|
+
* is fetched, decoded, and handed to React. It does **not** wait for React to
|
|
134
|
+
* commit the tree, so the state that publishes on that commit (address bar,
|
|
135
|
+
* segment cache, history entry, pathname) may still be a beat behind when it
|
|
136
|
+
* resolves. Anything that needs the destination to be current should listen
|
|
137
|
+
* for `timber:navigation-end`, which is dispatched by the publish itself.
|
|
138
|
+
*
|
|
139
|
+
* Awaiting the publish here was tried and rejected: it makes the promise
|
|
140
|
+
* depend on a React commit, which never arrives if the root unmounts
|
|
141
|
+
* mid-navigation, and deadlocks any caller that awaits a navigation inside
|
|
142
|
+
* `act()`.
|
|
100
143
|
*
|
|
101
144
|
* Used for: navigate(), refresh(), popstate with fetch.
|
|
102
145
|
*/
|
|
103
|
-
export declare function navigateTransition(
|
|
104
|
-
element: ReactNode;
|
|
105
|
-
decodePromise: Promise<void> | null;
|
|
106
|
-
}>): Promise<void>;
|
|
146
|
+
export declare function navigateTransition(url: string, perform: () => Promise<TransitionResult>): Promise<void>;
|
|
107
147
|
/**
|
|
108
148
|
* Install one-shot deferred callbacks for the no-RSC bootstrap path (TIM-600).
|
|
109
149
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-root.d.ts","sourceRoot":"","sources":["../../src/client/navigation-root.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"navigation-root.d.ts","sourceRoot":"","sources":["../../src/client/navigation-root.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIlE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,SAAS;IAC7C,kCAAkC;IAClC,OAAO,EAAE,CAAC,CAAC;IACX,kEAAkE;IAClE,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC;;;;;;;;;;OAUG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AA4DD;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AA6ED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAmCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,eAAe,GAChB,EAAE;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,GAAG,SAAS,CAoMZ;AAID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAIzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI,CAe5F"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Segment params context — the one channel params use to reach the browser.
|
|
3
|
+
*
|
|
4
|
+
* Params ride the RSC payload's root row as a sibling of the tree
|
|
5
|
+
* (`{ tree, params, slotParams }`), rather than in four side channels that
|
|
6
|
+
* raced to seed them: a response header, an inline script, and two build-time
|
|
7
|
+
* manifest fields all previously carried the same record, each with its own
|
|
8
|
+
* `JSON.stringify` (TIM-1294).
|
|
9
|
+
*
|
|
10
|
+
* Riding the payload is what makes them *typed*. `defineSchema` takes any
|
|
11
|
+
* `Codec<T>`, so a coerced param is whatever the codec returned — a `Date`, a
|
|
12
|
+
* `bigint` — and `JSON.stringify` either flattened it to a string or threw
|
|
13
|
+
* mid-response. React Flight carries those values natively, so the client
|
|
14
|
+
* reads the value the server produced instead of a lossy copy of it. See
|
|
15
|
+
* design/41-global-params.md §"Transport".
|
|
16
|
+
*
|
|
17
|
+
* **The client owns the provider.** There is exactly one `ParamsProvider` in
|
|
18
|
+
* the browser's tree, rendered by `PayloadRoot` above the point where a
|
|
19
|
+
* partial navigation splices the new payload into the retained tree. It has to
|
|
20
|
+
* be there and it has to be alone: a provider *inside* the payload lands below
|
|
21
|
+
* the retained region, whose own root is the departing route's provider, so
|
|
22
|
+
* every reader in a skipped layout resolves to the departing record and no
|
|
23
|
+
* amount of wrapping above it helps (TIM-1297).
|
|
24
|
+
*
|
|
25
|
+
* Ordering still holds without a bootstrap contract, for the same reason it
|
|
26
|
+
* did when the provider was in the tree: a provider renders before its own
|
|
27
|
+
* descendants by construction, so `useSegmentParams()` is correct during
|
|
28
|
+
* hydration without anything having to run before `hydrateRoot()`.
|
|
29
|
+
*/
|
|
30
|
+
import React from 'react';
|
|
31
|
+
import { type PublishedParams } from '../shared/payload-root.js';
|
|
32
|
+
import type { SlotParamsRecord } from '../shared/slot-params.js';
|
|
33
|
+
export type ParamsContextValue = PublishedParams;
|
|
34
|
+
/**
|
|
35
|
+
* Read the params provided by the tree. Returns null when no provider is
|
|
36
|
+
* above the caller — a component rendered outside a timber route, a
|
|
37
|
+
* `useSegmentParams()` call from outside React entirely, or any component
|
|
38
|
+
* during SSR (where the params reach the hook through the ALS-backed SSR data
|
|
39
|
+
* context instead, and there is no client-owned tree to hold a provider).
|
|
40
|
+
*/
|
|
41
|
+
export declare function useParamsContext(): ParamsContextValue | null;
|
|
42
|
+
interface ParamsProviderProps {
|
|
43
|
+
params: Record<string, string | string[]>;
|
|
44
|
+
slotParams: SlotParamsRecord | null;
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The client's root: publishes a payload's params over the tree being shown.
|
|
49
|
+
*
|
|
50
|
+
* Rendered at the same position in the wrapper chain on **every** render path
|
|
51
|
+
* — hydration, full navigation, partial navigation, popstate replay, shallow
|
|
52
|
+
* search sync, and revalidation from a server action. Being unconditional is
|
|
53
|
+
* load-bearing twice over: an element type that appears on one render and not
|
|
54
|
+
* the next remounts everything below it, destroying exactly the layout state a
|
|
55
|
+
* partial navigation exists to preserve; and a reader in a skipped layout has
|
|
56
|
+
* to have *some* provider above it on every path or it falls back to the
|
|
57
|
+
* module-level snapshot.
|
|
58
|
+
*
|
|
59
|
+
* `children` is the tree to display, which is not always `source`'s tree:
|
|
60
|
+
*
|
|
61
|
+
* - Full navigation, hydration, replay — `source` is the payload being shown,
|
|
62
|
+
* and `children` is its own tree.
|
|
63
|
+
* - **Partial navigation** — `children` is the *retained* tree and `source` is
|
|
64
|
+
* the *incoming* payload. This is the case the whole design exists for: the
|
|
65
|
+
* retained tree is not re-rendered, so the destination's params can only
|
|
66
|
+
* reach it from above, and this provider is above it.
|
|
67
|
+
*
|
|
68
|
+
* `source` may be a thenable, in which case this suspends on the payload's
|
|
69
|
+
* root row. That happens on the hydration path only, where the payload
|
|
70
|
+
* promise was going to be rendered at this position anyway. Every other path
|
|
71
|
+
* resolves the row in the router — inside the navigation transition — and
|
|
72
|
+
* hands over a settled value, so a decode rejection surfaces where React
|
|
73
|
+
* renders the tree and is caught by the error boundary *around* it, rather
|
|
74
|
+
* than here, above every boundary the app has.
|
|
75
|
+
*/
|
|
76
|
+
export declare function PayloadRoot({ source, children }: {
|
|
77
|
+
source: unknown;
|
|
78
|
+
children?: React.ReactNode;
|
|
79
|
+
}): React.FunctionComponentElement<ParamsProviderProps>;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=params-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params-context.d.ts","sourceRoot":"","sources":["../../src/client/params-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAmDjD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,GAAG,IAAI,CAE5D;AAID,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,uDAIhG"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Effects — full-page navigation and post-paint scroll.
|
|
3
|
+
*
|
|
4
|
+
* The two things the router does *to the document* rather than to its own
|
|
5
|
+
* state: leaving the SPA entirely, and moving the scroll position once React
|
|
6
|
+
* has committed. Extracted from `router.ts` to keep that file focused on
|
|
7
|
+
* navigation state (see design/18-build-system.md §"No file >500 lines").
|
|
8
|
+
*
|
|
9
|
+
* See design/19-client-navigation.md §"Scroll Restoration"
|
|
10
|
+
*/
|
|
11
|
+
/** The subset of `RouterDeps` the post-paint scroll effects need. */
|
|
12
|
+
export interface ScrollEffectDeps {
|
|
13
|
+
scrollTo: (x: number, y: number) => void;
|
|
14
|
+
afterPaint?: (callback: () => void) => void;
|
|
15
|
+
scrollToHash?: (hash: string) => boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ScrollEffects {
|
|
18
|
+
/**
|
|
19
|
+
* Schedule scroll restoration after the next paint and fire the
|
|
20
|
+
* scroll-restored event. Used by navigate, popstate, and refresh.
|
|
21
|
+
*/
|
|
22
|
+
restoreScrollAfterPaint: (scrollY: number) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Scroll to the element matching the URL #fragment after paint, falling
|
|
25
|
+
* back to scroll-to-top when no element matches (matching full-page-load
|
|
26
|
+
* behavior for an unknown fragment). Used by forward navigation to a
|
|
27
|
+
* hash-bearing URL (TIM-1035).
|
|
28
|
+
*/
|
|
29
|
+
scrollToHashAfterPaint: (hash: string) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createScrollEffects(deps: ScrollEffectDeps): ScrollEffects;
|
|
32
|
+
/**
|
|
33
|
+
* Leave the SPA and never come back.
|
|
34
|
+
*
|
|
35
|
+
* Every router path that gives up on client-side navigation does the same
|
|
36
|
+
* three things: flag the hard navigation so the Navigation API and React stop
|
|
37
|
+
* acting on a dying document, perform the document load, then block forever so
|
|
38
|
+
* the caller cannot carry on rendering into it. The returned promise is
|
|
39
|
+
* deliberately unresolvable — `location` assignment does not stop this turn of
|
|
40
|
+
* the event loop.
|
|
41
|
+
*
|
|
42
|
+
* Callers: server error, non-RSC response, and every version skew path
|
|
43
|
+
* ([33-version-skew.md](../../../../design/33-version-skew.md)).
|
|
44
|
+
*/
|
|
45
|
+
export declare function leaveSpa(url: string, fromUrl: string): Promise<never>;
|
|
46
|
+
export interface SpaExitDeps {
|
|
47
|
+
/** The controller that owns the router right now, or null when idle. */
|
|
48
|
+
currentNavAbort: () => AbortController | null;
|
|
49
|
+
/** Supersede whatever is in flight and take ownership. */
|
|
50
|
+
supersede: () => void;
|
|
51
|
+
}
|
|
52
|
+
export interface SpaExits {
|
|
53
|
+
/**
|
|
54
|
+
* Leave the SPA — but only if `navAbort` still owns the router. Every
|
|
55
|
+
* failure a navigation can end on (a server error, a non-RSC response, a
|
|
56
|
+
* version skew) can surface long after the user has clicked something else:
|
|
57
|
+
* a fetch that was never cancellable, a Flight thenable that rejects late.
|
|
58
|
+
* Hard navigating to the abandoned URL would undo that click, so a
|
|
59
|
+
* navigation that no longer owns the router does nothing and lets the one
|
|
60
|
+
* that does drive. Never resolves when it does navigate.
|
|
61
|
+
*
|
|
62
|
+
* Must be called from inside the `runNavigation()` callback. That function's
|
|
63
|
+
* `finally` clears the current controller, so an ownership check downstream
|
|
64
|
+
* of it compares against `null` and never leaves at all.
|
|
65
|
+
*/
|
|
66
|
+
leaveSpaIfOwned: (navAbort: AbortController, url: string, fromUrl: string) => Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Leave the SPA from a path that never entered `runNavigation()` — the
|
|
69
|
+
* stale-client short circuits, which decide before any fetch is attempted.
|
|
70
|
+
*
|
|
71
|
+
* Supersedes first. Nothing else on those paths takes ownership, so without
|
|
72
|
+
* it an in-flight navigation keeps the router: when its fetch or decode
|
|
73
|
+
* fails a moment later it still passes its own ownership check and hard
|
|
74
|
+
* navigates to *its* URL, overwriting the document load started here.
|
|
75
|
+
*/
|
|
76
|
+
leaveSpaSuperseding: (url: string, fromUrl: string) => Promise<never>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The two ownership-aware ways out of the SPA.
|
|
80
|
+
*
|
|
81
|
+
* Both wrap {@link leaveSpa} with the question "is this navigation still the
|
|
82
|
+
* one the user is waiting for?" — asked before leaving on a failure, answered
|
|
83
|
+
* by force on a path that decided before any navigation began. They live
|
|
84
|
+
* together because every caller of `leaveSpa()` needs one or the other, and
|
|
85
|
+
* an unguarded call is the bug (TIM-1275, TIM-1276).
|
|
86
|
+
*/
|
|
87
|
+
export declare function createSpaExits({ currentNavAbort, supersede }: SpaExitDeps): SpaExits;
|
|
88
|
+
export interface NavigationRecoveryDeps {
|
|
89
|
+
/** The controller that owns the router right now, or null when idle. */
|
|
90
|
+
currentNavAbort: () => AbortController | null;
|
|
91
|
+
leaveSpaIfOwned: SpaExits['leaveSpaIfOwned'];
|
|
92
|
+
/** Replace the current entry with `url` — the router's own `navigate()`. */
|
|
93
|
+
navigate: (url: string) => Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Answer the failures an RSC fetch can end on, or report that this one is not
|
|
97
|
+
* ours to answer.
|
|
98
|
+
*
|
|
99
|
+
* Returns `true` when the error was handled; the caller rethrows on `false`.
|
|
100
|
+
* Handling a failure by leaving the SPA never resolves at all — the document
|
|
101
|
+
* is going away and the caller must not carry on rendering into it.
|
|
102
|
+
*
|
|
103
|
+
* There is exactly one family of these and one response to it, so it lives in
|
|
104
|
+
* one function rather than once per fetch path. `navigate()`, `refresh()` and
|
|
105
|
+
* an uncached traversal all reach it: the latter two used to rethrow instead,
|
|
106
|
+
* and since nobody awaits a traversal that meant pressing Back on a 500 left
|
|
107
|
+
* the user on the old document with an unhandled rejection (TIM-1277).
|
|
108
|
+
*
|
|
109
|
+
* Order matters in exactly one way: `recordSkew()` ends in error-*text*
|
|
110
|
+
* matching, so it goes last and can never pre-empt a framework control-flow
|
|
111
|
+
* signal whose message happens to read like a stale bundle. The class checks
|
|
112
|
+
* above it are mutually exclusive, so their order is free.
|
|
113
|
+
*
|
|
114
|
+
* Must be called from inside the `runNavigation()` callback — see
|
|
115
|
+
* {@link SpaExits.leaveSpaIfOwned}.
|
|
116
|
+
*/
|
|
117
|
+
export declare function createNavigationRecovery({ currentNavAbort, leaveSpaIfOwned, navigate, }: NavigationRecoveryDeps): (error: unknown, navAbort: AbortController, url: string, fromUrl: string) => Promise<boolean>;
|
|
118
|
+
/**
|
|
119
|
+
* Perform the full document load.
|
|
120
|
+
*
|
|
121
|
+
* `fromUrl` is the URL the navigation departed from, passed explicitly
|
|
122
|
+
* because the address bar may have already been updated.
|
|
123
|
+
*
|
|
124
|
+
* When the target differs from the departure point only by #fragment,
|
|
125
|
+
* assigning `href` is a hash change, not a load — so assign first (to update
|
|
126
|
+
* the address bar) and then reload (TIM-1235).
|
|
127
|
+
*/
|
|
128
|
+
export declare function hardNavigate(url: string, fromUrl: string): void;
|
|
129
|
+
//# sourceMappingURL=router-effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-effects.d.ts","sourceRoot":"","sources":["../../src/client/router-effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1C;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,uBAAuB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD;;;;;OAKG;IACH,sBAAsB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,aAAa,CA2BzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAIrE;AAED,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,eAAe,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IAC9C,0DAA0D;IAC1D,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACvB;;;;;;;;;;;;OAYG;IACH,eAAe,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5F;;;;;;;;OAQG;IACH,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;CACvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,WAAW,GAAG,QAAQ,CAgBpF;AAED,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,eAAe,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IAC9C,eAAe,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC7C,4EAA4E;IAC5E,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,eAAe,EACf,eAAe,EACf,QAAQ,GACT,EAAE,sBAAsB,WAEd,OAAO,YACJ,eAAe,OACpB,MAAM,WACF,MAAM,KACd,OAAO,CAAC,OAAO,CAAC,CAsBpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAS/D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Lifecycle — who owns the router, and when a fetch may be cut.
|
|
3
|
+
*
|
|
4
|
+
* One navigation at a time owns the router. This module holds that ownership
|
|
5
|
+
* (`currentNavAbort`), the rule for taking it (`createNavAbort` supersedes),
|
|
6
|
+
* the wrapper every navigation runs inside (`runNavigation`), the set of
|
|
7
|
+
* navigations whose trees are on screen and therefore unabortable
|
|
8
|
+
* (`handedOffNavAborts`), and the pending store that `TopLoader` and
|
|
9
|
+
* `usePendingNavigation()` subscribe to.
|
|
10
|
+
*
|
|
11
|
+
* These belong together because every one of them is a read or a write of
|
|
12
|
+
* "which navigation is the user waiting for?" — the question `router.ts` used
|
|
13
|
+
* to answer in four places. Split out of `router.ts` for the same reason
|
|
14
|
+
* `router-effects.ts` was (design/18-build-system.md §"No file >500 lines").
|
|
15
|
+
*
|
|
16
|
+
* See design/19-client-navigation.md §"How Pending State Works".
|
|
17
|
+
*/
|
|
18
|
+
/** The subset of `RouterDeps` the navigation lifecycle needs. */
|
|
19
|
+
export interface NavigationLifecycleDeps {
|
|
20
|
+
/**
|
|
21
|
+
* Signal that a router-initiated navigation has completed. Resolves the
|
|
22
|
+
* deferred promise that ties the browser's native loading state to the
|
|
23
|
+
* navigation lifecycle.
|
|
24
|
+
*/
|
|
25
|
+
completeRouterNavigation?: () => void;
|
|
26
|
+
}
|
|
27
|
+
export interface NavigationLifecycle {
|
|
28
|
+
/** The controller that owns the router right now, or null when idle. */
|
|
29
|
+
currentNavAbort: () => AbortController | null;
|
|
30
|
+
/**
|
|
31
|
+
* Take ownership of the router, superseding whatever held it. See the
|
|
32
|
+
* implementation for the three parts of superseding.
|
|
33
|
+
*/
|
|
34
|
+
createNavAbort: (externalSignal?: AbortSignal) => AbortController;
|
|
35
|
+
/**
|
|
36
|
+
* Run `fn` inside the abort/pending/cleanup lifecycle. AbortErrors are
|
|
37
|
+
* swallowed (not application errors); all other errors propagate.
|
|
38
|
+
*/
|
|
39
|
+
runNavigation: (url: string, fn: (navAbort: AbortController) => Promise<void>, externalSignal?: AbortSignal) => Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Record that `owner`'s payload has reached React, so its stream is no
|
|
42
|
+
* longer cuttable. No-op when `owner` no longer owns the router.
|
|
43
|
+
*/
|
|
44
|
+
markHandedOff: (owner: AbortController) => void;
|
|
45
|
+
/** React has committed `owner`'s tree — every earlier handoff is off screen. */
|
|
46
|
+
forgetOlderHandoffs: (owner: AbortController) => void;
|
|
47
|
+
/** Whether a navigation is currently in flight. */
|
|
48
|
+
isPending: () => boolean;
|
|
49
|
+
/** The URL currently being navigated to, or null if idle. */
|
|
50
|
+
getPendingUrl: () => string | null;
|
|
51
|
+
/** Subscribe to pending state changes. */
|
|
52
|
+
onPendingChange: (listener: (pending: boolean) => void) => () => void;
|
|
53
|
+
}
|
|
54
|
+
export declare function createNavigationLifecycle(deps: NavigationLifecycleDeps): NavigationLifecycle;
|
|
55
|
+
//# sourceMappingURL=router-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-lifecycle.d.ts","sourceRoot":"","sources":["../../src/client/router-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,iEAAiE;AACjE,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,eAAe,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IAC9C;;;OAGG;IACH,cAAc,EAAE,CAAC,cAAc,CAAC,EAAE,WAAW,KAAK,eAAe,CAAC;IAClE;;;OAGG;IACH,aAAa,EAAE,CACb,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,EAChD,cAAc,CAAC,EAAE,WAAW,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB;;;OAGG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAChD,gFAAgF;IAChF,mBAAmB,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAEtD,mDAAmD;IACnD,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,6DAA6D;IAC7D,aAAa,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACnC,0CAA0C;IAC1C,eAAe,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CACvE;AAYD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,uBAAuB,GAAG,mBAAmB,CAqN5F"}
|