@rangojs/router 0.5.1 → 0.6.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/README.md +5 -1
- package/dist/bin/rango.js +343 -125
- package/dist/types/browser/event-controller.d.ts +6 -0
- package/dist/types/browser/react/use-router.d.ts +10 -3
- package/dist/types/browser/react/use-search-params.d.ts +57 -10
- package/dist/types/browser/types.d.ts +22 -0
- package/dist/types/build/merge-full-manifests.d.ts +3 -0
- package/dist/types/build/route-trie.d.ts +4 -73
- package/dist/types/build/route-types/per-module-writer.d.ts +6 -4
- package/dist/types/build/route-types/router-processing.d.ts +2 -3
- package/dist/types/cache/cache-exec-scope.d.ts +31 -0
- package/dist/types/cache/cf/cf-cache-constants.d.ts +8 -1
- package/dist/types/cache/cf/cf-cache-store.d.ts +15 -1
- package/dist/types/cache/cf/cf-cache-types.d.ts +1 -1
- package/dist/types/cache/cf/cf-kv-utils.d.ts +21 -0
- package/dist/types/cache/taint.d.ts +12 -6
- package/dist/types/client-urls/client-root.d.ts +38 -0
- package/dist/types/client-urls/client-urls.d.ts +5 -0
- package/dist/types/client-urls/navigation.d.ts +38 -0
- package/dist/types/client-urls/revalidation-protocol.d.ts +25 -0
- package/dist/types/client-urls/server-projection.d.ts +62 -0
- package/dist/types/client-urls/types.d.ts +144 -0
- package/dist/types/client.d.ts +12 -4
- package/dist/types/client.rsc.d.ts +4 -1
- package/dist/types/decode-loader-results.d.ts +37 -0
- package/dist/types/errors.d.ts +1 -0
- package/dist/types/handles/is-thenable.d.ts +2 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/loader-redirect.d.ts +27 -0
- package/dist/types/outlet-context.d.ts +12 -0
- package/dist/types/outlet-provider.d.ts +3 -1
- package/dist/types/redirect-origin.d.ts +4 -0
- package/dist/types/route-content-wrapper.d.ts +42 -1
- package/dist/types/route-definition/helpers-types.d.ts +13 -2
- package/dist/types/router/error-handling.d.ts +35 -1
- package/dist/types/router/intercept-resolution.d.ts +12 -0
- package/dist/types/router/loader-resolution.d.ts +24 -2
- package/dist/types/router/revalidation.d.ts +7 -0
- package/dist/{types.backup/build/route-trie.d.ts → types/router/route-trie-builder.d.ts} +4 -16
- package/dist/types/router/router-interfaces.d.ts +20 -0
- package/dist/types/router/segment-resolution/helpers.d.ts +1 -1
- package/dist/types/router/trie-matching.d.ts +1 -1
- package/dist/types/rsc/helpers.d.ts +3 -0
- package/dist/types/rsc/manifest-init.d.ts +5 -5
- package/dist/types/rsc/render-pipeline.d.ts +9 -0
- package/dist/types/rsc/routine-plan.d.ts +124 -0
- package/dist/types/rsc/shell-capture-constants.d.ts +17 -0
- package/dist/types/rsc/shell-capture.d.ts +9 -0
- package/dist/types/rsc/shell-serve.d.ts +11 -0
- package/dist/types/rsc/types.d.ts +30 -0
- package/dist/types/segment-system.d.ts +2 -0
- package/dist/types/server/context.d.ts +10 -0
- package/dist/types/server/handle-store.d.ts +34 -3
- package/dist/types/server/request-context.d.ts +14 -1
- package/dist/types/server.d.ts +1 -0
- package/dist/types/ssr/index.d.ts +22 -0
- package/dist/types/ssr/ssr-root.d.ts +10 -0
- package/dist/types/testing/dom.entry.d.ts +1 -1
- package/dist/types/testing/render-route.d.ts +16 -6
- package/dist/types/testing/run-loader.d.ts +9 -0
- package/dist/types/types/boundaries.d.ts +22 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/loader-types.d.ts +57 -5
- package/dist/types/types/segments.d.ts +7 -0
- package/dist/types/urls/path-helper-types.d.ts +10 -4
- package/dist/types/vite/discovery/client-urls-projection.d.ts +53 -0
- package/dist/types/vite/discovery/discover-routers.d.ts +1 -1
- package/dist/types/vite/discovery/state.d.ts +8 -1
- package/dist/types/vite/encryption-key.d.ts +2 -0
- package/dist/types/vite/plugins/expose-internal-ids.d.ts +10 -0
- package/dist/types/vite/plugins/server-ref-hashing.d.ts +24 -0
- package/dist/types/vite/plugins/server-reference-pattern.d.ts +1 -0
- package/dist/types/vite/utils/shared-utils.d.ts +12 -0
- package/dist/vite/index.js +5101 -2056
- package/package.json +3 -3
- package/skills/breadcrumbs/SKILL.md +39 -9
- package/skills/caching/SKILL.md +1 -1
- package/skills/catalog.json +7 -1
- package/skills/client-urls/SKILL.md +338 -0
- package/skills/comparison/references/framework-comparison.md +23 -9
- package/skills/hooks/SKILL.md +2 -2
- package/skills/hooks/data.md +11 -2
- package/skills/hooks/handle-and-actions.md +7 -0
- package/skills/hooks/outlets.md +26 -5
- package/skills/hooks/urls.md +40 -3
- package/skills/loader/SKILL.md +132 -20
- package/skills/migrate-nextjs/SKILL.md +70 -10
- package/skills/migrate-react-router/SKILL.md +49 -13
- package/skills/migrate-react-router/component-migration.md +18 -13
- package/skills/migrate-react-router/data-and-actions.md +14 -3
- package/skills/migrate-react-router/route-mapping.md +15 -2
- package/skills/mime-routes/SKILL.md +3 -1
- package/skills/parallel/SKILL.md +32 -1
- package/skills/ppr/SKILL.md +16 -6
- package/skills/prerender/SKILL.md +8 -4
- package/skills/rango/SKILL.md +21 -17
- package/skills/react-compiler/SKILL.md +3 -3
- package/skills/response-routes/SKILL.md +4 -2
- package/skills/route/SKILL.md +5 -2
- package/skills/router-setup/SKILL.md +16 -2
- package/skills/scripts/SKILL.md +16 -6
- package/skills/shell-manifest/SKILL.md +16 -7
- package/skills/testing/SKILL.md +2 -2
- package/skills/testing/client-components.md +6 -0
- package/skills/testing/handles.md +30 -8
- package/skills/testing/loader.md +51 -49
- package/skills/testing/middleware.md +1 -1
- package/skills/theme/SKILL.md +8 -5
- package/skills/typesafety/generated-files-and-cli.md +16 -9
- package/skills/typesafety/route-types.md +5 -1
- package/skills/use-cache/SKILL.md +47 -0
- package/src/bin/rango.ts +7 -3
- package/src/browser/event-controller.ts +40 -15
- package/src/browser/navigation-bridge.ts +6 -0
- package/src/browser/navigation-client.ts +5 -0
- package/src/browser/partial-update.ts +77 -10
- package/src/browser/react/NavigationProvider.tsx +7 -0
- package/src/browser/react/use-router.ts +40 -11
- package/src/browser/react/use-search-params.ts +140 -17
- package/src/browser/rsc-router.tsx +59 -0
- package/src/browser/server-action-bridge.ts +26 -0
- package/src/browser/types.ts +22 -0
- package/src/build/merge-full-manifests.ts +161 -0
- package/src/build/route-trie.ts +9 -332
- package/src/build/route-types/include-resolution.ts +66 -11
- package/src/build/route-types/per-module-writer.ts +11 -6
- package/src/build/route-types/router-processing.ts +184 -153
- package/src/build/runtime-discovery.ts +23 -12
- package/src/cache/cache-exec-scope.ts +47 -0
- package/src/cache/cache-runtime.ts +113 -40
- package/src/cache/cf/cf-cache-constants.ts +8 -1
- package/src/cache/cf/cf-cache-store.ts +41 -64
- package/src/cache/cf/cf-cache-types.ts +1 -1
- package/src/cache/cf/cf-kv-utils.ts +38 -0
- package/src/cache/segment-codec.ts +21 -5
- package/src/cache/taint.ts +28 -9
- package/src/client-urls/client-root.tsx +168 -0
- package/src/client-urls/client-urls.ts +698 -0
- package/src/client-urls/navigation.ts +237 -0
- package/src/client-urls/revalidation-protocol.ts +56 -0
- package/src/client-urls/server-projection.ts +579 -0
- package/src/client-urls/types.ts +195 -0
- package/src/client.rsc.tsx +12 -0
- package/src/client.tsx +49 -6
- package/src/decode-loader-results.ts +113 -0
- package/src/errors.ts +14 -0
- package/src/handles/deferred-resolution.ts +14 -7
- package/src/handles/is-thenable.ts +2 -4
- package/src/index.ts +1 -0
- package/src/loader-redirect.tsx +64 -0
- package/src/outlet-context.ts +12 -0
- package/src/outlet-provider.tsx +15 -1
- package/src/redirect-origin.ts +29 -0
- package/src/route-content-wrapper.tsx +96 -3
- package/src/route-definition/dsl-helpers.ts +28 -3
- package/src/route-definition/helpers-types.ts +13 -0
- package/src/route-definition/redirect.ts +17 -18
- package/src/router/error-handling.ts +65 -11
- package/src/router/intercept-resolution.ts +29 -0
- package/src/router/loader-resolution.ts +261 -28
- package/src/router/match-middleware/cache-lookup.ts +24 -15
- package/src/router/match-result.ts +7 -0
- package/src/router/revalidation.ts +24 -11
- package/src/router/route-trie-builder.ts +334 -0
- package/src/router/router-interfaces.ts +38 -0
- package/src/router/segment-resolution/fresh.ts +47 -0
- package/src/router/segment-resolution/helpers.ts +9 -11
- package/src/router/segment-resolution/loader-cache.ts +14 -24
- package/src/router/segment-resolution/revalidation.ts +20 -1
- package/src/router/trie-matching.ts +3 -3
- package/src/router.ts +46 -1
- package/src/rsc/full-payload.ts +6 -0
- package/src/rsc/handler.ts +36 -12
- package/src/rsc/helpers.ts +13 -0
- package/src/rsc/loader-fetch.ts +2 -2
- package/src/rsc/manifest-init.ts +28 -9
- package/src/rsc/progressive-enhancement.ts +247 -70
- package/src/rsc/render-pipeline.ts +68 -24
- package/src/rsc/routine-plan.ts +359 -0
- package/src/rsc/rsc-rendering.ts +569 -302
- package/src/rsc/server-action.ts +180 -71
- package/src/rsc/shell-capture-constants.ts +18 -0
- package/src/rsc/shell-capture.ts +104 -21
- package/src/rsc/shell-serve.ts +15 -2
- package/src/rsc/ssr-setup.ts +10 -1
- package/src/rsc/types.ts +31 -2
- package/src/segment-system.tsx +83 -26
- package/src/server/context.ts +10 -0
- package/src/server/cookie-store.ts +19 -19
- package/src/server/handle-store.ts +185 -48
- package/src/server/request-context.ts +36 -6
- package/src/server.ts +7 -0
- package/src/ssr/index.tsx +37 -2
- package/src/ssr/ssr-root.tsx +30 -2
- package/src/testing/dom.entry.ts +1 -1
- package/src/testing/render-route.tsx +22 -8
- package/src/testing/run-loader.ts +51 -13
- package/src/types/boundaries.ts +19 -0
- package/src/types/index.ts +1 -0
- package/src/types/loader-types.ts +60 -5
- package/src/types/segments.ts +7 -0
- package/src/urls/include-helper.ts +22 -4
- package/src/urls/path-helper-types.ts +14 -1
- package/src/use-loader.tsx +67 -6
- package/src/vite/discovery/client-urls-projection.ts +322 -0
- package/src/vite/discovery/discover-routers.ts +43 -17
- package/src/vite/discovery/state.ts +11 -1
- package/src/vite/discovery/virtual-module-codegen.ts +20 -0
- package/src/vite/encryption-key.ts +29 -0
- package/src/vite/plugins/expose-action-id.ts +2 -2
- package/src/vite/plugins/expose-internal-ids.ts +46 -0
- package/src/vite/plugins/server-ref-hashing.ts +74 -0
- package/src/vite/plugins/server-reference-pattern.ts +10 -0
- package/src/vite/plugins/virtual-entries.ts +12 -3
- package/src/vite/rango.ts +9 -0
- package/src/vite/router-discovery.ts +184 -14
- package/src/vite/utils/shared-utils.ts +12 -7
- package/dist/types.backup/__internal.d.ts +0 -127
- package/dist/types.backup/bin/rango.d.ts +0 -1
- package/dist/types.backup/browser/action-coordinator.d.ts +0 -57
- package/dist/types.backup/browser/action-fence.d.ts +0 -33
- package/dist/types.backup/browser/app-shell.d.ts +0 -34
- package/dist/types.backup/browser/app-version.d.ts +0 -6
- package/dist/types.backup/browser/connection-warmup.d.ts +0 -31
- package/dist/types.backup/browser/cookie-name.d.ts +0 -66
- package/dist/types.backup/browser/event-controller.d.ts +0 -221
- package/dist/types.backup/browser/history-state.d.ts +0 -26
- package/dist/types.backup/browser/index.d.ts +0 -1
- package/dist/types.backup/browser/intercept-utils.d.ts +0 -30
- package/dist/types.backup/browser/invalidate-client-cache.d.ts +0 -17
- package/dist/types.backup/browser/link-interceptor.d.ts +0 -43
- package/dist/types.backup/browser/logging.d.ts +0 -33
- package/dist/types.backup/browser/merge-segment-loaders.d.ts +0 -38
- package/dist/types.backup/browser/navigation-bridge.d.ts +0 -27
- package/dist/types.backup/browser/navigation-client.d.ts +0 -17
- package/dist/types.backup/browser/navigation-store-handle.d.ts +0 -25
- package/dist/types.backup/browser/navigation-store.d.ts +0 -95
- package/dist/types.backup/browser/navigation-transaction.d.ts +0 -75
- package/dist/types.backup/browser/network-error-handler.d.ts +0 -35
- package/dist/types.backup/browser/partial-update.d.ts +0 -61
- package/dist/types.backup/browser/prefetch/cache.d.ts +0 -183
- package/dist/types.backup/browser/prefetch/fetch.d.ts +0 -52
- package/dist/types.backup/browser/prefetch/observer.d.ts +0 -27
- package/dist/types.backup/browser/prefetch/policy.d.ts +0 -13
- package/dist/types.backup/browser/prefetch/queue.d.ts +0 -48
- package/dist/types.backup/browser/prefetch/resource-ready.d.ts +0 -28
- package/dist/types.backup/browser/rango-state.d.ts +0 -52
- package/dist/types.backup/browser/react/Link.d.ts +0 -140
- package/dist/types.backup/browser/react/NavigationProvider.d.ts +0 -88
- package/dist/types.backup/browser/react/ScrollRestoration.d.ts +0 -78
- package/dist/types.backup/browser/react/context.d.ts +0 -54
- package/dist/types.backup/browser/react/filter-segment-order.d.ts +0 -35
- package/dist/types.backup/browser/react/index.d.ts +0 -1
- package/dist/types.backup/browser/react/location-state-shared.d.ts +0 -162
- package/dist/types.backup/browser/react/location-state.d.ts +0 -29
- package/dist/types.backup/browser/react/mount-context.d.ts +0 -23
- package/dist/types.backup/browser/react/nonce-context.d.ts +0 -14
- package/dist/types.backup/browser/react/shallow-equal.d.ts +0 -5
- package/dist/types.backup/browser/react/use-action.d.ts +0 -61
- package/dist/types.backup/browser/react/use-handle.d.ts +0 -21
- package/dist/types.backup/browser/react/use-href.d.ts +0 -32
- package/dist/types.backup/browser/react/use-link-status.d.ts +0 -36
- package/dist/types.backup/browser/react/use-mount.d.ts +0 -24
- package/dist/types.backup/browser/react/use-navigation.d.ts +0 -15
- package/dist/types.backup/browser/react/use-params.d.ts +0 -21
- package/dist/types.backup/browser/react/use-pathname.d.ts +0 -13
- package/dist/types.backup/browser/react/use-reverse.d.ts +0 -40
- package/dist/types.backup/browser/react/use-router.d.ts +0 -23
- package/dist/types.backup/browser/react/use-search-params.d.ts +0 -19
- package/dist/types.backup/browser/react/use-segments.d.ts +0 -29
- package/dist/types.backup/browser/response-adapter.d.ts +0 -58
- package/dist/types.backup/browser/rsc-router.d.ts +0 -141
- package/dist/types.backup/browser/scroll-restoration.d.ts +0 -103
- package/dist/types.backup/browser/segment-reconciler.d.ts +0 -74
- package/dist/types.backup/browser/segment-structure-assert.d.ts +0 -16
- package/dist/types.backup/browser/server-action-bridge.d.ts +0 -29
- package/dist/types.backup/browser/types.d.ts +0 -530
- package/dist/types.backup/browser/validate-redirect-origin.d.ts +0 -28
- package/dist/types.backup/build/collect-fallback-refs.d.ts +0 -5
- package/dist/types.backup/build/generate-manifest.d.ts +0 -100
- package/dist/types.backup/build/generate-route-types.d.ts +0 -8
- package/dist/types.backup/build/index.d.ts +0 -21
- package/dist/types.backup/build/prefix-tree-utils.d.ts +0 -56
- package/dist/types.backup/build/route-types/ast-helpers.d.ts +0 -3
- package/dist/types.backup/build/route-types/ast-route-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/codegen.d.ts +0 -16
- package/dist/types.backup/build/route-types/include-resolution.d.ts +0 -74
- package/dist/types.backup/build/route-types/param-extraction.d.ts +0 -13
- package/dist/types.backup/build/route-types/per-module-writer.d.ts +0 -18
- package/dist/types.backup/build/route-types/router-processing.d.ts +0 -82
- package/dist/types.backup/build/route-types/scan-filter.d.ts +0 -17
- package/dist/types.backup/build/route-types/source-scan.d.ts +0 -13
- package/dist/types.backup/build/runtime-discovery.d.ts +0 -24
- package/dist/types.backup/cache/background-task.d.ts +0 -21
- package/dist/types.backup/cache/cache-error.d.ts +0 -71
- package/dist/types.backup/cache/cache-key-utils.d.ts +0 -35
- package/dist/types.backup/cache/cache-policy.d.ts +0 -59
- package/dist/types.backup/cache/cache-runtime.d.ts +0 -51
- package/dist/types.backup/cache/cache-scope.d.ts +0 -134
- package/dist/types.backup/cache/cache-tag.d.ts +0 -79
- package/dist/types.backup/cache/cf/cf-base64.d.ts +0 -4
- package/dist/types.backup/cache/cf/cf-cache-constants.d.ts +0 -105
- package/dist/types.backup/cache/cf/cf-cache-store.d.ts +0 -481
- package/dist/types.backup/cache/cf/cf-cache-types.d.ts +0 -300
- package/dist/types.backup/cache/cf/cf-kv-utils.d.ts +0 -22
- package/dist/types.backup/cache/cf/cf-tag-marker-memo.d.ts +0 -15
- package/dist/types.backup/cache/cf/index.d.ts +0 -3
- package/dist/types.backup/cache/document-cache.d.ts +0 -69
- package/dist/types.backup/cache/handle-capture.d.ts +0 -23
- package/dist/types.backup/cache/handle-snapshot.d.ts +0 -39
- package/dist/types.backup/cache/index.d.ts +0 -7
- package/dist/types.backup/cache/memory-segment-store.d.ts +0 -163
- package/dist/types.backup/cache/profile-registry.d.ts +0 -40
- package/dist/types.backup/cache/read-through-swr.d.ts +0 -60
- package/dist/types.backup/cache/segment-codec.d.ts +0 -78
- package/dist/types.backup/cache/shell-snapshot.d.ts +0 -162
- package/dist/types.backup/cache/tag-invalidation.d.ts +0 -74
- package/dist/types.backup/cache/taint.d.ts +0 -71
- package/dist/types.backup/cache/types.d.ts +0 -407
- package/dist/types.backup/cache/vercel/index.d.ts +0 -1
- package/dist/types.backup/cache/vercel/vercel-cache-store.d.ts +0 -267
- package/dist/types.backup/client.d.ts +0 -184
- package/dist/types.backup/client.rsc.d.ts +0 -39
- package/dist/types.backup/cloudflare/index.d.ts +0 -7
- package/dist/types.backup/cloudflare/tracing.d.ts +0 -53
- package/dist/types.backup/component-utils.d.ts +0 -46
- package/dist/types.backup/components/DefaultDocument.d.ts +0 -13
- package/dist/types.backup/context-var.d.ts +0 -84
- package/dist/types.backup/debug.d.ts +0 -57
- package/dist/types.backup/decode-loader-results.d.ts +0 -5
- package/dist/types.backup/default-error-boundary.d.ts +0 -10
- package/dist/types.backup/defer.d.ts +0 -89
- package/dist/types.backup/deps/browser.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-client.d.ts +0 -1
- package/dist/types.backup/deps/html-stream-server.d.ts +0 -1
- package/dist/types.backup/deps/rsc.d.ts +0 -1
- package/dist/types.backup/deps/ssr.d.ts +0 -1
- package/dist/types.backup/encode-kv.d.ts +0 -35
- package/dist/types.backup/errors.d.ts +0 -226
- package/dist/types.backup/escape-script.d.ts +0 -44
- package/dist/types.backup/handle.d.ts +0 -93
- package/dist/types.backup/handles/MetaTags.d.ts +0 -17
- package/dist/types.backup/handles/Scripts.d.ts +0 -38
- package/dist/types.backup/handles/breadcrumbs.d.ts +0 -43
- package/dist/types.backup/handles/deferred-resolution.d.ts +0 -53
- package/dist/types.backup/handles/is-thenable.d.ts +0 -12
- package/dist/types.backup/handles/meta.d.ts +0 -43
- package/dist/types.backup/handles/script.d.ts +0 -139
- package/dist/types.backup/host/cookie-handler.d.ts +0 -8
- package/dist/types.backup/host/errors.d.ts +0 -40
- package/dist/types.backup/host/index.d.ts +0 -33
- package/dist/types.backup/host/pattern-matcher.d.ts +0 -30
- package/dist/types.backup/host/router.d.ts +0 -12
- package/dist/types.backup/host/testing.d.ts +0 -41
- package/dist/types.backup/host/types.d.ts +0 -148
- package/dist/types.backup/host/utils.d.ts +0 -20
- package/dist/types.backup/href-client.d.ts +0 -214
- package/dist/types.backup/index.d.ts +0 -112
- package/dist/types.backup/index.rsc.d.ts +0 -51
- package/dist/types.backup/internal-debug.d.ts +0 -1
- package/dist/types.backup/loader-store.d.ts +0 -193
- package/dist/types.backup/loader.d.ts +0 -18
- package/dist/types.backup/loader.rsc.d.ts +0 -18
- package/dist/types.backup/missing-id-error.d.ts +0 -1
- package/dist/types.backup/outlet-context.d.ts +0 -12
- package/dist/types.backup/outlet-provider.d.ts +0 -12
- package/dist/types.backup/prerender/build-shell-capture.d.ts +0 -104
- package/dist/types.backup/prerender/param-hash.d.ts +0 -6
- package/dist/types.backup/prerender/shell-manifest-key.d.ts +0 -18
- package/dist/types.backup/prerender/store.d.ts +0 -62
- package/dist/types.backup/prerender.d.ts +0 -292
- package/dist/types.backup/redirect-origin.d.ts +0 -55
- package/dist/types.backup/regex-escape.d.ts +0 -6
- package/dist/types.backup/render-error-thrower.d.ts +0 -13
- package/dist/types.backup/response-utils.d.ts +0 -35
- package/dist/types.backup/reverse.d.ts +0 -206
- package/dist/types.backup/root-error-boundary.d.ts +0 -32
- package/dist/types.backup/route-content-wrapper.d.ts +0 -40
- package/dist/types.backup/route-definition/dsl-helpers.d.ts +0 -130
- package/dist/types.backup/route-definition/helper-factories.d.ts +0 -22
- package/dist/types.backup/route-definition/helpers-types.d.ts +0 -392
- package/dist/types.backup/route-definition/index.d.ts +0 -7
- package/dist/types.backup/route-definition/redirect.d.ts +0 -48
- package/dist/types.backup/route-definition/resolve-handler-use.d.ts +0 -19
- package/dist/types.backup/route-definition/use-item-types.d.ts +0 -1
- package/dist/types.backup/route-definition.d.ts +0 -1
- package/dist/types.backup/route-map-builder.d.ts +0 -127
- package/dist/types.backup/route-name.d.ts +0 -27
- package/dist/types.backup/route-types.d.ts +0 -172
- package/dist/types.backup/router/basename.d.ts +0 -10
- package/dist/types.backup/router/content-negotiation.d.ts +0 -91
- package/dist/types.backup/router/debug-manifest.d.ts +0 -7
- package/dist/types.backup/router/error-handling.d.ts +0 -76
- package/dist/types.backup/router/find-match.d.ts +0 -19
- package/dist/types.backup/router/handler-context.d.ts +0 -41
- package/dist/types.backup/router/instrument.d.ts +0 -161
- package/dist/types.backup/router/intercept-resolution.d.ts +0 -79
- package/dist/types.backup/router/lazy-includes.d.ts +0 -26
- package/dist/types.backup/router/loader-resolution.d.ts +0 -63
- package/dist/types.backup/router/logging.d.ts +0 -41
- package/dist/types.backup/router/manifest.d.ts +0 -8
- package/dist/types.backup/router/match-api.d.ts +0 -19
- package/dist/types.backup/router/match-context.d.ts +0 -184
- package/dist/types.backup/router/match-handlers.d.ts +0 -49
- package/dist/types.backup/router/match-middleware/background-revalidation.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-lookup.d.ts +0 -113
- package/dist/types.backup/router/match-middleware/cache-store.d.ts +0 -112
- package/dist/types.backup/router/match-middleware/index.d.ts +0 -80
- package/dist/types.backup/router/match-middleware/intercept-resolution.d.ts +0 -116
- package/dist/types.backup/router/match-middleware/segment-resolution.d.ts +0 -94
- package/dist/types.backup/router/match-pipelines.d.ts +0 -103
- package/dist/types.backup/router/match-result.d.ts +0 -114
- package/dist/types.backup/router/metrics.d.ts +0 -6
- package/dist/types.backup/router/middleware-types.d.ts +0 -74
- package/dist/types.backup/router/middleware.d.ts +0 -116
- package/dist/types.backup/router/navigation-snapshot.d.ts +0 -22
- package/dist/types.backup/router/params-util.d.ts +0 -8
- package/dist/types.backup/router/parse-pattern.d.ts +0 -38
- package/dist/types.backup/router/pattern-matching.d.ts +0 -169
- package/dist/types.backup/router/prefetch-cache-ttl.d.ts +0 -27
- package/dist/types.backup/router/prefetch-limits.d.ts +0 -20
- package/dist/types.backup/router/prerender-match.d.ts +0 -50
- package/dist/types.backup/router/preview-match.d.ts +0 -22
- package/dist/types.backup/router/request-classification.d.ts +0 -104
- package/dist/types.backup/router/revalidation.d.ts +0 -57
- package/dist/types.backup/router/route-snapshot.d.ts +0 -112
- package/dist/types.backup/router/router-context.d.ts +0 -137
- package/dist/types.backup/router/router-interfaces.d.ts +0 -432
- package/dist/types.backup/router/router-options.d.ts +0 -738
- package/dist/types.backup/router/router-registry.d.ts +0 -15
- package/dist/types.backup/router/segment-resolution/fresh.d.ts +0 -55
- package/dist/types.backup/router/segment-resolution/helpers.d.ts +0 -93
- package/dist/types.backup/router/segment-resolution/loader-cache.d.ts +0 -33
- package/dist/types.backup/router/segment-resolution/loader-mask.d.ts +0 -44
- package/dist/types.backup/router/segment-resolution/loader-snapshot.d.ts +0 -90
- package/dist/types.backup/router/segment-resolution/mask-nested.d.ts +0 -53
- package/dist/types.backup/router/segment-resolution/revalidation.d.ts +0 -85
- package/dist/types.backup/router/segment-resolution/static-store.d.ts +0 -17
- package/dist/types.backup/router/segment-resolution/streamed-handler-telemetry.d.ts +0 -16
- package/dist/types.backup/router/segment-resolution/view-transition-default.d.ts +0 -28
- package/dist/types.backup/router/segment-resolution.d.ts +0 -3
- package/dist/types.backup/router/segment-wrappers.d.ts +0 -53
- package/dist/types.backup/router/state-cookie-name.d.ts +0 -1
- package/dist/types.backup/router/substitute-pattern-params.d.ts +0 -23
- package/dist/types.backup/router/telemetry-otel.d.ts +0 -113
- package/dist/types.backup/router/telemetry.d.ts +0 -215
- package/dist/types.backup/router/timeout.d.ts +0 -68
- package/dist/types.backup/router/tracing.d.ts +0 -125
- package/dist/types.backup/router/trie-matching.d.ts +0 -32
- package/dist/types.backup/router/types.d.ts +0 -98
- package/dist/types.backup/router/url-params.d.ts +0 -26
- package/dist/types.backup/router.d.ts +0 -7
- package/dist/types.backup/rsc/capture-queue.d.ts +0 -6
- package/dist/types.backup/rsc/full-payload.d.ts +0 -22
- package/dist/types.backup/rsc/handler-context.d.ts +0 -31
- package/dist/types.backup/rsc/handler.d.ts +0 -9
- package/dist/types.backup/rsc/helpers.d.ts +0 -213
- package/dist/types.backup/rsc/index.d.ts +0 -17
- package/dist/types.backup/rsc/json-route-result.d.ts +0 -20
- package/dist/types.backup/rsc/loader-fetch.d.ts +0 -14
- package/dist/types.backup/rsc/manifest-init.d.ts +0 -18
- package/dist/types.backup/rsc/nonce.d.ts +0 -28
- package/dist/types.backup/rsc/origin-guard.d.ts +0 -50
- package/dist/types.backup/rsc/progressive-enhancement.d.ts +0 -19
- package/dist/types.backup/rsc/redirect-guard.d.ts +0 -35
- package/dist/types.backup/rsc/response-cache-serve.d.ts +0 -46
- package/dist/types.backup/rsc/response-error.d.ts +0 -19
- package/dist/types.backup/rsc/response-route-handler.d.ts +0 -29
- package/dist/types.backup/rsc/rsc-rendering.d.ts +0 -23
- package/dist/types.backup/rsc/runtime-warnings.d.ts +0 -22
- package/dist/types.backup/rsc/server-action.d.ts +0 -68
- package/dist/types.backup/rsc/shell-build-manifest.d.ts +0 -84
- package/dist/types.backup/rsc/shell-capture-constants.d.ts +0 -27
- package/dist/types.backup/rsc/shell-capture.d.ts +0 -374
- package/dist/types.backup/rsc/shell-serve.d.ts +0 -136
- package/dist/types.backup/rsc/ssr-setup.d.ts +0 -48
- package/dist/types.backup/rsc/transition-gate.d.ts +0 -27
- package/dist/types.backup/rsc/types.d.ts +0 -290
- package/dist/types.backup/runtime-env.d.ts +0 -1
- package/dist/types.backup/search-params.d.ts +0 -125
- package/dist/types.backup/segment-content-promise.d.ts +0 -13
- package/dist/types.backup/segment-fragments.d.ts +0 -56
- package/dist/types.backup/segment-loader-promise.d.ts +0 -22
- package/dist/types.backup/segment-system.d.ts +0 -84
- package/dist/types.backup/serialize.d.ts +0 -164
- package/dist/types.backup/server/context.d.ts +0 -494
- package/dist/types.backup/server/cookie-parse.d.ts +0 -10
- package/dist/types.backup/server/cookie-store.d.ts +0 -107
- package/dist/types.backup/server/fetchable-loader-store.d.ts +0 -20
- package/dist/types.backup/server/handle-store.d.ts +0 -100
- package/dist/types.backup/server/loader-registry.d.ts +0 -32
- package/dist/types.backup/server/request-context.d.ts +0 -596
- package/dist/types.backup/server/root-layout.d.ts +0 -3
- package/dist/types.backup/server.d.ts +0 -15
- package/dist/types.backup/ssr/index.d.ts +0 -233
- package/dist/types.backup/ssr/inject-rsc-eager.d.ts +0 -3
- package/dist/types.backup/ssr/preinit-client-references.d.ts +0 -71
- package/dist/types.backup/ssr/ssr-root.d.ts +0 -69
- package/dist/types.backup/static-handler.d.ts +0 -57
- package/dist/types.backup/testing/cache-status.d.ts +0 -63
- package/dist/types.backup/testing/collect-handle.d.ts +0 -20
- package/dist/types.backup/testing/dispatch.d.ts +0 -123
- package/dist/types.backup/testing/dom.entry.d.ts +0 -15
- package/dist/types.backup/testing/e2e/fixture.d.ts +0 -37
- package/dist/types.backup/testing/e2e/index.d.ts +0 -30
- package/dist/types.backup/testing/e2e/matchers.d.ts +0 -17
- package/dist/types.backup/testing/e2e/page-helpers.d.ts +0 -62
- package/dist/types.backup/testing/e2e/parity.d.ts +0 -111
- package/dist/types.backup/testing/e2e/server.d.ts +0 -35
- package/dist/types.backup/testing/flight-matchers.d.ts +0 -55
- package/dist/types.backup/testing/flight-normalize.d.ts +0 -1
- package/dist/types.backup/testing/flight-tree.d.ts +0 -192
- package/dist/types.backup/testing/flight.d.ts +0 -115
- package/dist/types.backup/testing/flight.entry.d.ts +0 -27
- package/dist/types.backup/testing/generated-routes.d.ts +0 -66
- package/dist/types.backup/testing/index.d.ts +0 -52
- package/dist/types.backup/testing/internal/context.d.ts +0 -225
- package/dist/types.backup/testing/internal/flight-client-globals.d.ts +0 -1
- package/dist/types.backup/testing/internal/seed-vars.d.ts +0 -30
- package/dist/types.backup/testing/render-handler.d.ts +0 -160
- package/dist/types.backup/testing/render-route.d.ts +0 -246
- package/dist/types.backup/testing/run-loader.d.ts +0 -186
- package/dist/types.backup/testing/run-middleware.d.ts +0 -132
- package/dist/types.backup/testing/run-transition-when.d.ts +0 -77
- package/dist/types.backup/testing/vitest-stubs/cloudflare-email.d.ts +0 -6
- package/dist/types.backup/testing/vitest-stubs/cloudflare-workers.d.ts +0 -13
- package/dist/types.backup/testing/vitest-stubs/plugin-rsc.d.ts +0 -7
- package/dist/types.backup/testing/vitest-stubs/version.d.ts +0 -1
- package/dist/types.backup/testing/vitest.d.ts +0 -205
- package/dist/types.backup/theme/ThemeProvider.d.ts +0 -13
- package/dist/types.backup/theme/ThemeScript.d.ts +0 -45
- package/dist/types.backup/theme/constants.d.ts +0 -39
- package/dist/types.backup/theme/index.d.ts +0 -29
- package/dist/types.backup/theme/theme-context.d.ts +0 -21
- package/dist/types.backup/theme/theme-script.d.ts +0 -26
- package/dist/types.backup/theme/types.d.ts +0 -162
- package/dist/types.backup/theme/use-theme.d.ts +0 -8
- package/dist/types.backup/types/boundaries.d.ts +0 -93
- package/dist/types.backup/types/cache-types.d.ts +0 -191
- package/dist/types.backup/types/error-types.d.ts +0 -114
- package/dist/types.backup/types/global-namespace.d.ts +0 -90
- package/dist/types.backup/types/handler-context.d.ts +0 -658
- package/dist/types.backup/types/index.d.ts +0 -11
- package/dist/types.backup/types/loader-types.d.ts +0 -182
- package/dist/types.backup/types/request-scope.d.ts +0 -93
- package/dist/types.backup/types/route-config.d.ts +0 -105
- package/dist/types.backup/types/route-entry.d.ts +0 -95
- package/dist/types.backup/types/segments.d.ts +0 -234
- package/dist/types.backup/types.d.ts +0 -1
- package/dist/types.backup/urls/include-helper.d.ts +0 -17
- package/dist/types.backup/urls/include-provider.d.ts +0 -27
- package/dist/types.backup/urls/index.d.ts +0 -6
- package/dist/types.backup/urls/path-helper-types.d.ts +0 -197
- package/dist/types.backup/urls/path-helper.d.ts +0 -12
- package/dist/types.backup/urls/pattern-types.d.ts +0 -166
- package/dist/types.backup/urls/response-types.d.ts +0 -67
- package/dist/types.backup/urls/type-extraction.d.ts +0 -157
- package/dist/types.backup/urls/urls-function.d.ts +0 -24
- package/dist/types.backup/urls.d.ts +0 -1
- package/dist/types.backup/use-loader.d.ts +0 -150
- package/dist/types.backup/vercel/index.d.ts +0 -10
- package/dist/types.backup/vercel/tracing.d.ts +0 -70
- package/dist/types.backup/vite/debug.d.ts +0 -80
- package/dist/types.backup/vite/discovery/bundle-postprocess.d.ts +0 -12
- package/dist/types.backup/vite/discovery/dev-prerender-cache.d.ts +0 -65
- package/dist/types.backup/vite/discovery/discover-routers.d.ts +0 -17
- package/dist/types.backup/vite/discovery/discovery-errors.d.ts +0 -113
- package/dist/types.backup/vite/discovery/gate-state.d.ts +0 -79
- package/dist/types.backup/vite/discovery/prerender-collection.d.ts +0 -24
- package/dist/types.backup/vite/discovery/route-types-writer.d.ts +0 -32
- package/dist/types.backup/vite/discovery/self-gen-tracking.d.ts +0 -22
- package/dist/types.backup/vite/discovery/shell-prerender-phase.d.ts +0 -40
- package/dist/types.backup/vite/discovery/state.d.ts +0 -162
- package/dist/types.backup/vite/discovery/virtual-module-codegen.d.ts +0 -15
- package/dist/types.backup/vite/index.d.ts +0 -11
- package/dist/types.backup/vite/inject-client-debug.d.ts +0 -56
- package/dist/types.backup/vite/plugin-types.d.ts +0 -298
- package/dist/types.backup/vite/plugins/cjs-to-esm.d.ts +0 -6
- package/dist/types.backup/vite/plugins/client-ref-dedup.d.ts +0 -40
- package/dist/types.backup/vite/plugins/client-ref-hashing.d.ts +0 -35
- package/dist/types.backup/vite/plugins/cloudflare-protocol-stub.d.ts +0 -64
- package/dist/types.backup/vite/plugins/expose-action-id.d.ts +0 -18
- package/dist/types.backup/vite/plugins/expose-id-utils.d.ts +0 -37
- package/dist/types.backup/vite/plugins/expose-ids/export-analysis.d.ts +0 -19
- package/dist/types.backup/vite/plugins/expose-ids/handler-transform.d.ts +0 -10
- package/dist/types.backup/vite/plugins/expose-ids/loader-transform.d.ts +0 -8
- package/dist/types.backup/vite/plugins/expose-ids/router-transform.d.ts +0 -13
- package/dist/types.backup/vite/plugins/expose-ids/types.d.ts +0 -29
- package/dist/types.backup/vite/plugins/expose-internal-ids.d.ts +0 -6
- package/dist/types.backup/vite/plugins/performance-tracks.d.ts +0 -25
- package/dist/types.backup/vite/plugins/refresh-cmd.d.ts +0 -20
- package/dist/types.backup/vite/plugins/use-cache-transform.d.ts +0 -20
- package/dist/types.backup/vite/plugins/vercel-output.d.ts +0 -85
- package/dist/types.backup/vite/plugins/version-injector.d.ts +0 -21
- package/dist/types.backup/vite/plugins/version-plugin.d.ts +0 -19
- package/dist/types.backup/vite/plugins/virtual-entries.d.ts +0 -36
- package/dist/types.backup/vite/plugins/virtual-stub-plugin.d.ts +0 -7
- package/dist/types.backup/vite/rango.d.ts +0 -29
- package/dist/types.backup/vite/router-discovery.d.ts +0 -23
- package/dist/types.backup/vite/utils/ast-handler-extract.d.ts +0 -64
- package/dist/types.backup/vite/utils/banner.d.ts +0 -2
- package/dist/types.backup/vite/utils/bundle-analysis.d.ts +0 -28
- package/dist/types.backup/vite/utils/client-chunks.d.ts +0 -55
- package/dist/types.backup/vite/utils/directive-prologue.d.ts +0 -16
- package/dist/types.backup/vite/utils/forward-user-plugins.d.ts +0 -37
- package/dist/types.backup/vite/utils/manifest-utils.d.ts +0 -7
- package/dist/types.backup/vite/utils/package-resolution.d.ts +0 -6
- package/dist/types.backup/vite/utils/prerender-utils.d.ts +0 -32
- package/dist/types.backup/vite/utils/shared-utils.d.ts +0 -55
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import type { ReactElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Internal entry representing a state value with its unique key.
|
|
4
|
-
* When __rsc_ls_lazy is true, __rsc_ls_value holds a getter function
|
|
5
|
-
* that is called at navigation time (not at entry creation time).
|
|
6
|
-
*/
|
|
7
|
-
export interface LocationStateEntry {
|
|
8
|
-
readonly __rsc_ls_key: string;
|
|
9
|
-
readonly __rsc_ls_value: unknown;
|
|
10
|
-
readonly __rsc_ls_lazy?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Options for createLocationState
|
|
14
|
-
*/
|
|
15
|
-
export interface LocationStateOptions {
|
|
16
|
-
/** When true, the state is cleared from history after first read (flash message pattern) */
|
|
17
|
-
flash?: boolean;
|
|
18
|
-
}
|
|
19
|
-
type LocationStateUnsafeFn = (...args: never[]) => unknown;
|
|
20
|
-
type LocationStateUnsafeCtor = abstract new (...args: never[]) => unknown;
|
|
21
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
22
|
-
type IsUnknown<T> = IsAny<T> extends true ? false : unknown extends T ? true : false;
|
|
23
|
-
/**
|
|
24
|
-
* Branded error surfaced when a value that cannot live in location state is
|
|
25
|
-
* used. Location state is written into `history.state`, which uses the
|
|
26
|
-
* structured clone algorithm; React elements, functions, and symbols throw a
|
|
27
|
-
* `DataCloneError` at runtime. Carries a human-readable reason so the compile
|
|
28
|
-
* error explains the fix.
|
|
29
|
-
*/
|
|
30
|
-
export type LocationStateUnsafe<Reason extends string> = {
|
|
31
|
-
readonly __rango_location_state_unsafe: Reason;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Maps `T` to itself when it is safe to store in location state, or to a branded
|
|
35
|
-
* {@link LocationStateUnsafe} error for the disallowed parts: `unknown`, React
|
|
36
|
-
* elements (RSC/JSX content), functions, class constructors, and symbols.
|
|
37
|
-
* Recurses through arrays, `Map`, `Set`, and plain objects; structured-clone
|
|
38
|
-
* built-ins (`Date`, `RegExp`, typed arrays, `Blob`, `File`, `FormData`) pass
|
|
39
|
-
* through. Consumed by {@link ValidateLocationState}, which is intersected into a
|
|
40
|
-
* definition's value parameter so posting RSC content is a COMPILE error, not a
|
|
41
|
-
* runtime `DataCloneError`. (`any` is unguardable and remains an escape hatch.)
|
|
42
|
-
*/
|
|
43
|
-
export type LocationStateSafe<T> = IsUnknown<T> extends true ? LocationStateUnsafe<"location state needs an explicit, concrete type; `unknown` cannot be verified as serializable"> : T extends LocationStateUnsafeFn ? LocationStateUnsafe<"functions cannot be stored in location state"> : T extends LocationStateUnsafeCtor ? LocationStateUnsafe<"class constructors cannot be stored in location state"> : T extends symbol ? LocationStateUnsafe<"symbols cannot be stored in location state"> : T extends ReactElement ? LocationStateUnsafe<"React/RSC content cannot be stored in location state; store plain data and render it on arrival"> : T extends string | number | boolean | bigint | null | undefined ? T : T extends Date | RegExp | ArrayBuffer | ArrayBufferView | Blob | File | FormData ? T : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<LocationStateSafe<K>, LocationStateSafe<V>> : T extends ReadonlySet<infer V> ? ReadonlySet<LocationStateSafe<V>> : T extends readonly unknown[] ? {
|
|
44
|
-
[K in keyof T]: LocationStateSafe<T[K]>;
|
|
45
|
-
} : T extends object ? {
|
|
46
|
-
[K in keyof T]: LocationStateSafe<T[K]>;
|
|
47
|
-
} : T;
|
|
48
|
-
/**
|
|
49
|
-
* `unknown` (a no-op) when `T` is safe to store in location state, otherwise a
|
|
50
|
-
* branded {@link LocationStateUnsafe} object. Intersected into the value
|
|
51
|
-
* parameter of a definition's call and `write()` so POSTING RSC content (or any
|
|
52
|
-
* non-serializable value) is a compile error whose text carries the reason —
|
|
53
|
-
* without a `TState extends ...` self-constraint, which TypeScript rejects as
|
|
54
|
-
* circular (TS2313). For safe `T`, `value & unknown` collapses back to `value`,
|
|
55
|
-
* so valid usage is unchanged.
|
|
56
|
-
*/
|
|
57
|
-
export type ValidateLocationState<T> = [T] extends [LocationStateSafe<T>] ? unknown : LocationStateUnsafe<"location state must be serializable: React/RSC content, functions, and symbols cannot be stored — pass plain data and render it on arrival">;
|
|
58
|
-
/**
|
|
59
|
-
* Type-safe location state definition
|
|
60
|
-
*
|
|
61
|
-
* Created via createLocationState(), used with Link's state prop
|
|
62
|
-
* and useLocationState() hook.
|
|
63
|
-
*/
|
|
64
|
-
export interface LocationStateDefinition<TArgs extends unknown[], TState> {
|
|
65
|
-
(...args: TArgs): LocationStateEntry;
|
|
66
|
-
/** Injected by Vite plugin - do not set manually */
|
|
67
|
-
__rsc_ls_key: string;
|
|
68
|
-
/** Whether this state auto-clears after first read */
|
|
69
|
-
readonly __rsc_ls_flash: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Read the current value from history.state.
|
|
72
|
-
*
|
|
73
|
-
* Returns undefined during SSR (no `window`). To stay hydration-safe, do
|
|
74
|
-
* NOT call read() inline during the initial render — the server returns
|
|
75
|
-
* undefined while the client may have a value preserved in history.state
|
|
76
|
-
* (e.g. after a hard reload of an entry that earlier called write()),
|
|
77
|
-
* which causes a hydration mismatch. Call read() inside an event handler
|
|
78
|
-
* or a useEffect post-mount instead, or use useLocationState() if you
|
|
79
|
-
* want React to manage subscription/hydration for you.
|
|
80
|
-
*/
|
|
81
|
-
read(): TState | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Statically write the value into the current history entry under this
|
|
84
|
-
* definition's key, preserving any other keys already on history.state
|
|
85
|
-
* (e.g. router bookkeeping, other LocationState slots).
|
|
86
|
-
*
|
|
87
|
-
* This is the non-reactive counterpart to read(): it does not dispatch any
|
|
88
|
-
* event, so components reading via useLocationState() will NOT re-render
|
|
89
|
-
* until the next navigation/popstate. Use it when you only need the value
|
|
90
|
-
* to be there on the next read() or on the next mount (including after
|
|
91
|
-
* back/forward and hard refresh of the same entry).
|
|
92
|
-
*
|
|
93
|
-
* Client-only: throws when called on the server (no history available).
|
|
94
|
-
*/
|
|
95
|
-
write(value: TState & ValidateLocationState<TState>): void;
|
|
96
|
-
/**
|
|
97
|
-
* Statically remove this definition's slot from the current history entry,
|
|
98
|
-
* leaving any other keys on history.state untouched. Idempotent: removing
|
|
99
|
-
* a slot that isn't present is a no-op.
|
|
100
|
-
*
|
|
101
|
-
* Same non-reactive semantics as write(): no event is dispatched, so
|
|
102
|
-
* useLocationState() readers will NOT re-render until the next navigation.
|
|
103
|
-
*
|
|
104
|
-
* Client-only: throws when called on the server (no history available).
|
|
105
|
-
*/
|
|
106
|
-
delete(): void;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Create a type-safe location state definition
|
|
110
|
-
*
|
|
111
|
-
* The key is auto-injected by the Vite exposeInternalIds plugin as a property
|
|
112
|
-
* based on file path and export name. No manual key required.
|
|
113
|
-
*
|
|
114
|
-
* @param options Optional configuration
|
|
115
|
-
* @returns A typed state definition for use with Link and useLocationState
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```typescript
|
|
119
|
-
* // Persistent state (survives back/forward)
|
|
120
|
-
* export const ProductState = createLocationState<{ name: string; price: number }>();
|
|
121
|
-
*
|
|
122
|
-
* // Flash state (cleared after first read)
|
|
123
|
-
* export const FlashMessage = createLocationState<{ text: string }>({ flash: true });
|
|
124
|
-
*
|
|
125
|
-
* // Use in Link
|
|
126
|
-
* <Link to="/product/123" state={[ProductState({ name: "Widget", price: 9.99 })]}>
|
|
127
|
-
*
|
|
128
|
-
* // Just-in-time typed state (getter called at click time, not render time).
|
|
129
|
-
* // Must be in a client component — the getter function can't cross the RSC boundary.
|
|
130
|
-
* <Link
|
|
131
|
-
* to="/product/123"
|
|
132
|
-
* state={[ProductState(() => ({ name: product.name, price: product.price }))]}
|
|
133
|
-
* >
|
|
134
|
-
*
|
|
135
|
-
* // Read with hook (reactive)
|
|
136
|
-
* const product = useLocationState(ProductState);
|
|
137
|
-
*
|
|
138
|
-
* // Read without hook (snapshot, client-side only)
|
|
139
|
-
* const snap = ProductState.read();
|
|
140
|
-
*
|
|
141
|
-
* // Static write to current history entry (non-reactive, client-side only).
|
|
142
|
-
* // Survives back/forward and hard refresh; useLocationState() readers will
|
|
143
|
-
* // NOT see the new value until the next navigation. Pair with .read() or a
|
|
144
|
-
* // fresh mount.
|
|
145
|
-
* ProductState.write({ name: "Widget", price: 9.99 });
|
|
146
|
-
*
|
|
147
|
-
* // Manually clear the slot (non-reactive, client-side only).
|
|
148
|
-
* ProductState.delete();
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
export declare function createLocationState<TState>(options?: LocationStateOptions): LocationStateDefinition<[
|
|
152
|
-
(TState | (() => TState)) & ValidateLocationState<TState>
|
|
153
|
-
], TState>;
|
|
154
|
-
/**
|
|
155
|
-
* Check if a value is a LocationStateEntry
|
|
156
|
-
*/
|
|
157
|
-
export declare function isLocationStateEntry(value: unknown): value is LocationStateEntry;
|
|
158
|
-
/**
|
|
159
|
-
* Resolve state entries into a flat object for history.state
|
|
160
|
-
*/
|
|
161
|
-
export declare function resolveLocationStateEntries(entries: LocationStateEntry[]): Record<string, unknown>;
|
|
162
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { LocationStateDefinition } from "./location-state-shared.js";
|
|
2
|
-
export { createLocationState, isLocationStateEntry, resolveLocationStateEntries, type LocationStateEntry, type LocationStateDefinition, type LocationStateOptions, } from "./location-state-shared.js";
|
|
3
|
-
/**
|
|
4
|
-
* Hook to read location state from history.state
|
|
5
|
-
*
|
|
6
|
-
* Behavior depends on the definition:
|
|
7
|
-
* - Normal state: persists across navigations, reactive to popstate
|
|
8
|
-
* - Flash state (created with { flash: true }): read once, cleared after paint
|
|
9
|
-
*
|
|
10
|
-
* Overloaded:
|
|
11
|
-
* - With definition: Returns typed state from the specific key
|
|
12
|
-
* - With type param only: Returns plain state from history.state.state
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // Persistent state
|
|
17
|
-
* const ProductState = createLocationState<{ name: string }>();
|
|
18
|
-
* const state = useLocationState(ProductState);
|
|
19
|
-
*
|
|
20
|
-
* // Flash state (auto-clears after paint)
|
|
21
|
-
* const FlashMsg = createLocationState<{ text: string }>({ flash: true });
|
|
22
|
-
* const flash = useLocationState(FlashMsg);
|
|
23
|
-
*
|
|
24
|
-
* // Plain state access (reads from history.state.state)
|
|
25
|
-
* const state = useLocationState<{ from?: string }>();
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function useLocationState<TArgs extends unknown[], TState>(definition: LocationStateDefinition<TArgs, TState>): TState | undefined;
|
|
29
|
-
export declare function useLocationState<T = unknown>(): T | undefined;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type Context, type ReactNode } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Context for the current include() mount path.
|
|
4
|
-
*
|
|
5
|
-
* Each include() wraps its subtree with a MountContext.Provider
|
|
6
|
-
* carrying the URL prefix. Nested includes override the context,
|
|
7
|
-
* so useMount() returns the nearest mount path.
|
|
8
|
-
*
|
|
9
|
-
* Default value "/" means root-level (no include wrapping).
|
|
10
|
-
*/
|
|
11
|
-
export declare const MountContext: Context<string>;
|
|
12
|
-
/**
|
|
13
|
-
* Provider wrapper for MountContext.
|
|
14
|
-
*
|
|
15
|
-
* RSC server components cannot use MountContext.Provider directly because
|
|
16
|
-
* .Provider is a property on the context object, not a named export.
|
|
17
|
-
* Client reference proxies on the RSC server return undefined for property
|
|
18
|
-
* access. This wrapper is a proper "use client" export that RSC can reference.
|
|
19
|
-
*/
|
|
20
|
-
export declare function MountContextProvider({ value, children, }: {
|
|
21
|
-
value: string;
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
}): ReactNode;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context for CSP nonce propagation to client components during SSR.
|
|
3
|
-
*
|
|
4
|
-
* The SSR renderer wraps the tree with NonceContext.Provider so that
|
|
5
|
-
* client components (e.g. MetaTags) can apply nonces to inline scripts.
|
|
6
|
-
* On the browser side, no provider is needed — the default undefined
|
|
7
|
-
* is correct since CSP nonces are a server-side HTML concern.
|
|
8
|
-
*/
|
|
9
|
-
import { type Context } from "react";
|
|
10
|
-
export declare const NonceContext: Context<string | undefined>;
|
|
11
|
-
/**
|
|
12
|
-
* Read the CSP nonce during SSR. Returns undefined on the client.
|
|
13
|
-
*/
|
|
14
|
-
export declare function useNonce(): string | undefined;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { TrackedActionState } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Server action function type
|
|
4
|
-
* Server actions have a $$id property added by the RSC compiler
|
|
5
|
-
*/
|
|
6
|
-
export type ServerActionFunction = ((...args: any[]) => Promise<any>) & {
|
|
7
|
-
$$id?: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Hook to track the lifecycle of a specific server action
|
|
11
|
-
*
|
|
12
|
-
* Unlike useNavigation which tracks global navigation state, useAction
|
|
13
|
-
* tracks the state of individual server action invocations.
|
|
14
|
-
*
|
|
15
|
-
* Uses the event controller for reactive state management.
|
|
16
|
-
* State is derived from the inflight actions tracked by the controller.
|
|
17
|
-
*
|
|
18
|
-
* Features:
|
|
19
|
-
* - Tracks action lifecycle: idle → loading → streaming → idle
|
|
20
|
-
* - Captures result/error locally (React handles cleanup)
|
|
21
|
-
* - If multiple actions fire, tracks only the last one
|
|
22
|
-
* - Supports selector pattern like useNavigation
|
|
23
|
-
*
|
|
24
|
-
* Matching behavior:
|
|
25
|
-
* - **Function reference**: Uses full $$id for exact matching. This is precise
|
|
26
|
-
* and distinguishes between actions with the same name in different files.
|
|
27
|
-
* - **String**: Matches by suffix (action name after #). This is convenient
|
|
28
|
-
* but may be ambiguous if multiple files export the same action name.
|
|
29
|
-
*
|
|
30
|
-
* @param action - Either a server action function or a string action name.
|
|
31
|
-
* - **Function**: Must be directly imported in the client component.
|
|
32
|
-
* Actions passed as props from server components will throw an error.
|
|
33
|
-
* - **String**: The exported function name from your "use server" file.
|
|
34
|
-
* Matches any action ending with "#actionName" (suffix match).
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* // Option 1: Direct import (precise matching)
|
|
39
|
-
* import { addToCart } from './actions';
|
|
40
|
-
* const actionState = useAction(addToCart);
|
|
41
|
-
*
|
|
42
|
-
* // Option 2: String-based (suffix matching)
|
|
43
|
-
* // Matches "hash#addToCart" or "src/actions.ts#addToCart"
|
|
44
|
-
* const actionState = useAction('addToCart');
|
|
45
|
-
*
|
|
46
|
-
* // With selector for specific values
|
|
47
|
-
* const isLoading = useAction(addToCart, state => state.state === 'loading');
|
|
48
|
-
* const error = useAction(addToCart, state => state.error);
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @note The selector is expected to be stable for a given hook instance.
|
|
52
|
-
* This hook tracks one projection of one action. Changing selector semantics
|
|
53
|
-
* for the same action ID without a new action event is not a supported pattern;
|
|
54
|
-
* use separate useAction() subscriptions if you need different projections.
|
|
55
|
-
*
|
|
56
|
-
* @note Actions passed as props from server components lose their metadata
|
|
57
|
-
* during RSC serialization. Use a string action name or import directly.
|
|
58
|
-
*/
|
|
59
|
-
export declare function useAction(action: ServerActionFunction | string): TrackedActionState;
|
|
60
|
-
export declare function useAction<T>(action: ServerActionFunction | string, selector: (state: TrackedActionState) => T): T;
|
|
61
|
-
export type { TrackedActionState };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Handle } from "../../handle.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access collected handle data.
|
|
4
|
-
*
|
|
5
|
-
* Returns the collected value from all route segments that pushed to this handle.
|
|
6
|
-
* Re-renders when handle data changes (navigation, actions).
|
|
7
|
-
*
|
|
8
|
-
* @param handle - The handle to read
|
|
9
|
-
* @param selector - Optional selector for performance (only re-render when selected value changes)
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* // Get all breadcrumbs
|
|
14
|
-
* const breadcrumbs = useHandle(Breadcrumbs);
|
|
15
|
-
*
|
|
16
|
-
* // With selector - only re-render when last crumb changes
|
|
17
|
-
* const lastCrumb = useHandle(Breadcrumbs, (data) => data.at(-1));
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function useHandle<T, A>(handle: Handle<T, A>): Rango.FlightSerialize<A>;
|
|
21
|
-
export declare function useHandle<T, A, S>(handle: Handle<T, A>, selector: (data: Rango.FlightSerialize<A>) => S): S;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side hook for mount-aware URL resolution.
|
|
3
|
-
*
|
|
4
|
-
* Returns an href function that automatically prepends the current
|
|
5
|
-
* include() mount prefix. Inside an include("/shop", ...) scope,
|
|
6
|
-
* the returned function resolves local paths relative to /shop.
|
|
7
|
-
*
|
|
8
|
-
* For absolute paths (outside the current mount), use the bare
|
|
9
|
-
* href() function directly instead.
|
|
10
|
-
*
|
|
11
|
-
* @returns A function that prepends the mount prefix to paths
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* "use client";
|
|
16
|
-
* import { useHref, href } from "@rangojs/router/client";
|
|
17
|
-
*
|
|
18
|
-
* // Inside include("/shop", shopPatterns)
|
|
19
|
-
* function ShopNav() {
|
|
20
|
-
* const href = useHref();
|
|
21
|
-
*
|
|
22
|
-
* return (
|
|
23
|
-
* <>
|
|
24
|
-
* {// Local paths - auto-prefixed with /shop}
|
|
25
|
-
* <Link to={href("/cart")}>Cart</Link>
|
|
26
|
-
* <Link to={href("/product/widget")}>Widget</Link>
|
|
27
|
-
* </>
|
|
28
|
-
* );
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function useHref(): (path: `/${string}`) => string;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type Context } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Context for Link component to provide its destination URL
|
|
4
|
-
* Used by useLinkStatus to determine if this specific link is pending
|
|
5
|
-
*/
|
|
6
|
-
export declare const LinkContext: Context<string | null>;
|
|
7
|
-
/**
|
|
8
|
-
* Link status returned by useLinkStatus hook
|
|
9
|
-
*/
|
|
10
|
-
export interface LinkStatus {
|
|
11
|
-
/** Whether navigation to this link's destination is in progress */
|
|
12
|
-
pending: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Hook to track the pending state of a Link component
|
|
16
|
-
*
|
|
17
|
-
* Must be used inside a Link component. Returns `{ pending: true }`
|
|
18
|
-
* when navigation to this link's destination is in progress.
|
|
19
|
-
*
|
|
20
|
-
* Useful for showing inline loading indicators on individual links.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* function LoadingIndicator() {
|
|
25
|
-
* const { pending } = useLinkStatus();
|
|
26
|
-
* return pending ? <Spinner /> : null;
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* // In your component:
|
|
30
|
-
* <Link to="/dashboard">
|
|
31
|
-
* Dashboard
|
|
32
|
-
* <LoadingIndicator />
|
|
33
|
-
* </Link>
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare function useLinkStatus(): LinkStatus;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the current include() mount path.
|
|
3
|
-
*
|
|
4
|
-
* Inside `include("/articles", blogPatterns)`, returns "/articles".
|
|
5
|
-
* For nested includes, returns the nearest mount path.
|
|
6
|
-
* At root level (no include), returns "/".
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* "use client";
|
|
11
|
-
* import { useMount, href } from "@rangojs/router/client";
|
|
12
|
-
*
|
|
13
|
-
* function BlogNav({ slug }: { slug: string }) {
|
|
14
|
-
* const mount = useMount(); // "/articles"
|
|
15
|
-
* return (
|
|
16
|
-
* <>
|
|
17
|
-
* <Link to={href("/", mount)}>Blog Home</Link>
|
|
18
|
-
* <Link to={href(`/${slug}`, mount)}>Post</Link>
|
|
19
|
-
* </>
|
|
20
|
-
* );
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function useMount(): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PublicNavigationState } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access reactive navigation state with optional selector for performance.
|
|
4
|
-
*
|
|
5
|
-
* Returns state only. For actions (push, replace, refresh, prefetch),
|
|
6
|
-
* use useRouter() instead.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* const { state, location } = useNavigation();
|
|
11
|
-
* const isLoading = useNavigation(nav => nav.state === 'loading');
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare function useNavigation(): PublicNavigationState;
|
|
15
|
-
export declare function useNavigation<T>(selector: (state: PublicNavigationState) => T): T;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to access the current route params.
|
|
3
|
-
*
|
|
4
|
-
* Returns the merged route params from the matched route.
|
|
5
|
-
* Updates when navigation completes, not during pending navigation.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* // Route: /products/:productId
|
|
10
|
-
* const params = useParams();
|
|
11
|
-
* // { productId: "123" }
|
|
12
|
-
*
|
|
13
|
-
* // Annotate the expected shape via a generic
|
|
14
|
-
* const { productId } = useParams<{ productId: string }>();
|
|
15
|
-
*
|
|
16
|
-
* // With selector
|
|
17
|
-
* const productId = useParams(p => p.productId);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function useParams<T extends object = Record<string, string | undefined>>(): Readonly<T>;
|
|
21
|
-
export declare function useParams<T>(selector: (params: Record<string, string | undefined>) => T): T;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to access the current pathname.
|
|
3
|
-
*
|
|
4
|
-
* Returns the committed pathname string (excludes search params and hash).
|
|
5
|
-
* Updates when navigation completes, not during pending navigation.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* const pathname = usePathname();
|
|
10
|
-
* // "/products/123"
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function usePathname(): string;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { LocalReverseFunction } from "../../reverse.js";
|
|
2
|
-
type RouteEntry = string | {
|
|
3
|
-
readonly path: string;
|
|
4
|
-
};
|
|
5
|
-
type LocalRouteMap = Readonly<Record<string, RouteEntry>>;
|
|
6
|
-
/**
|
|
7
|
-
* Mount-aware reverse function for a locally-imported `routes` map.
|
|
8
|
-
*
|
|
9
|
-
* The `routes` map you pass IS the scope: `reverse("name")` looks the name up
|
|
10
|
-
* in that map (verbatim), prefixes the result with the surrounding `include()`
|
|
11
|
-
* mount path via `useMount()`, and substitutes params — auto-filling from the
|
|
12
|
-
* current matched route's params, with explicit params overriding. A module's
|
|
13
|
-
* components can therefore reverse their own routes without knowing where the
|
|
14
|
-
* module is mounted: include it under any prefix and the URLs resolve correctly.
|
|
15
|
-
*
|
|
16
|
-
* The leading dot is optional and cosmetic: `reverse("post")` and
|
|
17
|
-
* `reverse(".post")` resolve identically. The dot exists only as a readability
|
|
18
|
-
* convention and for parity with `ctx.reverse(".name")` on the server; here the
|
|
19
|
-
* passed map is the scope, so there is no separate global namespace to
|
|
20
|
-
* disambiguate and the dot carries no meaning.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* "use client";
|
|
25
|
-
* import { Link, useReverse } from "@rangojs/router/client";
|
|
26
|
-
* import { routes as blogRoutes } from "../urls/blog.gen.js";
|
|
27
|
-
*
|
|
28
|
-
* function BlogNav() {
|
|
29
|
-
* const reverse = useReverse(blogRoutes);
|
|
30
|
-
* return (
|
|
31
|
-
* <>
|
|
32
|
-
* <Link to={reverse("index")}>Blog</Link>
|
|
33
|
-
* <Link to={reverse("post", { postId: "hello" })}>Post</Link>
|
|
34
|
-
* </>
|
|
35
|
-
* );
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function useReverse<const TRoutes extends LocalRouteMap>(routes: TRoutes): LocalReverseFunction<TRoutes>;
|
|
40
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { RouterInstance } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access router actions (push, replace, refresh, prefetch, back, forward).
|
|
4
|
-
*
|
|
5
|
-
* Returns a STABLE reference that never changes, so components using
|
|
6
|
-
* useRouter() do not re-render on navigation state changes.
|
|
7
|
-
* For reactive navigation state, use useNavigation() instead.
|
|
8
|
-
*
|
|
9
|
-
* Methods read `basename` from the context on each call. It is set once from
|
|
10
|
-
* the initial payload and is stable within a session — a cross-app navigation
|
|
11
|
-
* is a full document load (X-RSC-Reload), so the target app mounts fresh with
|
|
12
|
-
* its own basename.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const router = useRouter();
|
|
17
|
-
* router.push("/products");
|
|
18
|
-
* router.replace("/login", { scroll: false });
|
|
19
|
-
* router.prefetch("/dashboard");
|
|
20
|
-
* router.back();
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function useRouter(): RouterInstance;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyURLSearchParams } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to access the current URL search params.
|
|
4
|
-
*
|
|
5
|
-
* Returns a read-only URLSearchParams object from the committed location.
|
|
6
|
-
* Updates when navigation completes, not during pending navigation.
|
|
7
|
-
*
|
|
8
|
-
* Note: During SSR the search params are not available (the server only sends
|
|
9
|
-
* the pathname). The hook returns empty params during SSR and syncs from
|
|
10
|
-
* the browser URL on mount.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* const searchParams = useSearchParams();
|
|
15
|
-
* const query = searchParams.get("q"); // "react"
|
|
16
|
-
* const page = searchParams.get("page"); // "2"
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function useSearchParams(): ReadonlyURLSearchParams;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Segments state returned by useSegments hook
|
|
3
|
-
*/
|
|
4
|
-
export interface SegmentsState {
|
|
5
|
-
/** URL path segments (e.g., /shop/products/123 → ["shop", "products", "123"]) */
|
|
6
|
-
path: readonly string[];
|
|
7
|
-
/** Matched segment IDs in order (layouts and routes only, e.g., ["L0", "L0L1", "L0L1R0"]) */
|
|
8
|
-
segmentIds: readonly string[];
|
|
9
|
-
/** Current URL location */
|
|
10
|
-
location: URL;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Hook to access current route segments with optional selector for performance
|
|
14
|
-
*
|
|
15
|
-
* Provides information about the current URL path and matched route segments.
|
|
16
|
-
* Uses the event controller for reactive state management.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* // Get full segments state
|
|
21
|
-
* const { path, segmentIds, location } = useSegments();
|
|
22
|
-
*
|
|
23
|
-
* // Use selector for specific values (better performance)
|
|
24
|
-
* const path = useSegments(s => s.path);
|
|
25
|
-
* const isShopRoute = useSegments(s => s.path[0] === "shop");
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function useSegments(): SegmentsState;
|
|
29
|
-
export declare function useSegments<T>(selector: (state: SegmentsState) => T): T;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
type HeaderResult = {
|
|
2
|
-
url: string;
|
|
3
|
-
} | "blocked" | null;
|
|
4
|
-
/**
|
|
5
|
-
* Extract and validate an RSC response header URL (X-RSC-Reload, X-RSC-Redirect).
|
|
6
|
-
* Returns { url } if valid, "blocked" if present but invalid origin, null if absent.
|
|
7
|
-
*/
|
|
8
|
-
export declare function extractRscHeaderUrl(response: Response, header: string): HeaderResult;
|
|
9
|
-
/**
|
|
10
|
-
* Empty 200 response that won't choke Flight parsing.
|
|
11
|
-
* Used when a header URL is blocked by origin validation.
|
|
12
|
-
*/
|
|
13
|
-
export declare function emptyResponse(): Response;
|
|
14
|
-
/**
|
|
15
|
-
* Whether an RSC content response carries a server-stamped router identity
|
|
16
|
-
* (`X-RSC-Router-Id`) that DIFFERS from the id this client expects (its own
|
|
17
|
-
* routerId, also sent as `_rsc_rid`). Pre-decode integrity check: lets a caller
|
|
18
|
-
* refuse a foreign app's payload before `createFromFetch` imports its chunks.
|
|
19
|
-
*
|
|
20
|
-
* True ONLY when both the header and the expected id are present and differ. An
|
|
21
|
-
* absent header (control-only reload/redirect responses are not stamped) or an
|
|
22
|
-
* absent expected id (e.g. before the client is seeded) is a pass-through —
|
|
23
|
-
* never a false reject.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isForeignRouterId(response: Response, expectedId: string | undefined): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Handle the X-RSC-Reload control header (server requests a full page reload on
|
|
28
|
-
* a version mismatch). Returns a short-circuit response when the header is
|
|
29
|
-
* present -- emptyResponse() if the URL was blocked by origin validation, or a
|
|
30
|
-
* never-resolving promise while the page reloads -- and null when absent, so
|
|
31
|
-
* the caller continues processing (e.g. the X-RSC-Redirect check). Scoped to
|
|
32
|
-
* X-RSC-Reload only; redirect handling differs between callers.
|
|
33
|
-
*/
|
|
34
|
-
export declare function handleReloadHeader(response: Response, opts: {
|
|
35
|
-
onBlocked: () => void;
|
|
36
|
-
onReload: (url: string) => void;
|
|
37
|
-
}): Response | Promise<Response> | null;
|
|
38
|
-
/**
|
|
39
|
-
* Tee a response body for RSC parsing and stream completion tracking.
|
|
40
|
-
* Returns a new Response with one branch; the other is consumed to detect
|
|
41
|
-
* end-of-stream, calling onComplete when done.
|
|
42
|
-
*
|
|
43
|
-
* `onComplete` receives `endedCleanly`: true only on a normal EOF drain, false
|
|
44
|
-
* on a read error or an abort (the signal cancelled the reader). Callers that
|
|
45
|
-
* gate a "fully complete" fast path (e.g. prefetch's `entry.complete`) must
|
|
46
|
-
* treat a non-clean end as incomplete — a broken stream is not complete data.
|
|
47
|
-
*
|
|
48
|
-
* If the response has no body, onComplete fires synchronously with `true`
|
|
49
|
-
* (an empty body is a clean, complete stream).
|
|
50
|
-
* If signal is provided, an abort cancels the tracking reader.
|
|
51
|
-
*
|
|
52
|
-
* `silent` suppresses the stream-error log. Prefetch passes it: a speculative,
|
|
53
|
-
* low-priority prefetch that is aborted or never consumed can error its stream
|
|
54
|
-
* benignly, which is not worth surfacing. The fresh-navigation path keeps the
|
|
55
|
-
* log (default), where a stream error reflects a real failed navigation.
|
|
56
|
-
*/
|
|
57
|
-
export declare function teeWithCompletion(response: Response, onComplete: (endedCleanly: boolean) => void, signal?: AbortSignal, silent?: boolean): Response;
|
|
58
|
-
export {};
|