react-router 7.16.0 → 8.0.0-pre.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/CHANGELOG.md +0 -1
- package/dist/development/dom-export.d.ts +6 -172
- package/dist/development/dom-export.js +12 -1007
- package/dist/development/index-react-server-client.d.ts +7 -4
- package/dist/development/index-react-server-client.js +8 -52
- package/dist/development/index-react-server.d.ts +1645 -1635
- package/dist/development/index-react-server.js +2880 -3642
- package/dist/development/index.d.ts +43 -1475
- package/dist/development/index.js +37 -2621
- package/dist/development/lib/actions.js +62 -0
- package/dist/development/lib/components.d.ts +1022 -0
- package/dist/development/lib/components.js +835 -0
- package/dist/development/lib/context.d.ts +83 -0
- package/dist/development/lib/context.js +41 -0
- package/dist/development/lib/dom/dom.d.ts +119 -0
- package/dist/development/lib/dom/dom.js +143 -0
- package/dist/development/lib/dom/lib.d.ts +2042 -0
- package/dist/development/lib/dom/lib.js +1259 -0
- package/dist/development/lib/dom/server.d.ts +138 -0
- package/dist/development/lib/dom/server.js +301 -0
- package/dist/development/lib/dom/ssr/components.d.ts +196 -0
- package/dist/development/lib/dom/ssr/components.js +579 -0
- package/dist/development/lib/dom/ssr/data.js +29 -0
- package/dist/development/lib/dom/ssr/entry.d.ts +59 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.js +83 -0
- package/dist/development/lib/dom/ssr/errors.d.ts +7 -0
- package/dist/development/lib/dom/ssr/errors.js +36 -0
- package/dist/development/lib/dom/ssr/fallback.js +28 -0
- package/dist/development/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/development/lib/dom/ssr/fog-of-war.js +170 -0
- package/dist/development/lib/dom/ssr/hydration.d.ts +32 -0
- package/dist/development/lib/dom/ssr/hydration.js +29 -0
- package/dist/development/lib/dom/ssr/invariant.js +16 -0
- package/dist/development/lib/dom/ssr/links.js +170 -0
- package/dist/development/lib/dom/ssr/markup.js +24 -0
- package/dist/development/lib/dom/ssr/routeModules.d.ts +206 -0
- package/dist/development/lib/dom/ssr/routeModules.js +31 -0
- package/dist/development/lib/dom/ssr/routes-test-stub.d.ts +62 -0
- package/dist/development/lib/dom/ssr/routes-test-stub.js +108 -0
- package/dist/development/lib/dom/ssr/routes.d.ts +33 -0
- package/dist/development/lib/dom/ssr/routes.js +303 -0
- package/dist/development/lib/dom/ssr/server.d.ts +45 -0
- package/dist/development/lib/dom/ssr/server.js +68 -0
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/development/lib/dom/ssr/single-fetch.js +346 -0
- package/dist/development/lib/dom-export/dom-router-provider.d.ts +9 -0
- package/dist/development/lib/dom-export/dom-router-provider.js +22 -0
- package/dist/development/lib/dom-export/hydrated-router.d.ts +125 -0
- package/dist/development/lib/dom-export/hydrated-router.js +153 -0
- package/dist/development/lib/errors.js +29 -0
- package/dist/development/lib/hooks.d.ts +947 -0
- package/dist/development/lib/hooks.js +1386 -0
- package/dist/development/lib/href.d.ts +20 -0
- package/dist/development/lib/href.js +50 -0
- package/dist/development/lib/router/history.d.ts +258 -0
- package/dist/development/lib/router/history.js +371 -0
- package/dist/development/lib/router/instrumentation.d.ts +86 -0
- package/dist/development/lib/router/instrumentation.js +213 -0
- package/dist/development/lib/router/links.d.ts +113 -0
- package/dist/development/lib/router/router.d.ts +663 -0
- package/dist/development/lib/router/router.js +2981 -0
- package/dist/development/lib/router/utils.d.ts +942 -0
- package/dist/development/lib/router/utils.js +791 -0
- package/dist/development/lib/rsc/browser.d.ts +137 -0
- package/dist/development/lib/rsc/browser.js +599 -0
- package/dist/development/lib/rsc/errorBoundaries.d.ts +11 -0
- package/dist/development/lib/rsc/errorBoundaries.js +90 -0
- package/dist/development/lib/rsc/html-stream/browser.d.ts +48 -0
- package/dist/development/lib/rsc/html-stream/browser.js +74 -0
- package/dist/development/lib/rsc/html-stream/server.js +78 -0
- package/dist/development/lib/rsc/route-modules.js +27 -0
- package/dist/development/lib/rsc/server.rsc.d.ts +219 -0
- package/dist/development/lib/rsc/server.ssr.d.ts +129 -0
- package/dist/development/lib/rsc/server.ssr.js +388 -0
- package/dist/development/lib/server-runtime/build.d.ts +66 -0
- package/dist/development/lib/server-runtime/cookies.d.ts +66 -0
- package/dist/development/lib/server-runtime/cookies.js +139 -0
- package/dist/development/lib/server-runtime/crypto.js +43 -0
- package/dist/development/lib/server-runtime/data.d.ts +13 -0
- package/dist/development/lib/server-runtime/data.js +25 -0
- package/dist/development/lib/server-runtime/dev.d.ts +9 -0
- package/dist/development/lib/server-runtime/dev.js +26 -0
- package/dist/development/lib/server-runtime/entry.js +20 -0
- package/dist/development/lib/server-runtime/errors.js +95 -0
- package/dist/development/lib/server-runtime/headers.js +73 -0
- package/dist/development/lib/server-runtime/invariant.js +19 -0
- package/dist/development/lib/server-runtime/mode.d.ts +12 -0
- package/dist/development/lib/server-runtime/mode.js +25 -0
- package/dist/development/lib/server-runtime/routeMatching.js +28 -0
- package/dist/development/lib/server-runtime/routes.d.ts +13 -0
- package/dist/development/lib/server-runtime/routes.js +74 -0
- package/dist/development/lib/server-runtime/server.d.ts +10 -0
- package/dist/development/lib/server-runtime/server.js +351 -0
- package/dist/development/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +45 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +52 -0
- package/dist/development/lib/server-runtime/sessions.d.ts +145 -0
- package/dist/development/lib/server-runtime/sessions.js +98 -0
- package/dist/development/lib/server-runtime/single-fetch.d.ts +7 -0
- package/dist/development/lib/server-runtime/single-fetch.js +215 -0
- package/dist/development/lib/server-runtime/urls.js +31 -0
- package/dist/development/lib/server-runtime/warnings.js +20 -0
- package/dist/development/lib/types/future.d.ts +9 -0
- package/dist/development/lib/types/internal.d.ts +26 -177
- package/dist/development/lib/types/internal.js +3 -2
- package/dist/{production/register-CNAx3TXj.d.ts → development/lib/types/register.d.ts} +9 -15
- package/dist/development/lib/types/route-data.d.ts +113 -0
- package/dist/development/lib/types/route-module-annotations.d.ts +149 -0
- package/dist/development/lib/types/route-module.d.ts +19 -0
- package/dist/development/lib/types/serializes-to.d.ts +13 -0
- package/dist/development/lib/types/utils.d.ts +11 -0
- package/dist/development/vendor/turbo-stream-v2/flatten.js +159 -0
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +178 -0
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +198 -0
- package/dist/development/vendor/turbo-stream-v2/utils.js +47 -0
- package/dist/production/dom-export.d.ts +6 -172
- package/dist/production/dom-export.js +12 -1007
- package/dist/production/index-react-server-client.d.ts +7 -4
- package/dist/production/index-react-server-client.js +8 -52
- package/dist/production/index-react-server.d.ts +1645 -1635
- package/dist/production/index-react-server.js +2871 -3642
- package/dist/production/index.d.ts +43 -1475
- package/dist/production/index.js +37 -2621
- package/dist/production/lib/actions.js +62 -0
- package/dist/production/lib/components.d.ts +1022 -0
- package/dist/production/lib/components.js +835 -0
- package/dist/production/lib/context.d.ts +83 -0
- package/dist/production/lib/context.js +41 -0
- package/dist/production/lib/dom/dom.d.ts +119 -0
- package/dist/production/lib/dom/dom.js +143 -0
- package/dist/production/lib/dom/lib.d.ts +2042 -0
- package/dist/production/lib/dom/lib.js +1259 -0
- package/dist/production/lib/dom/server.d.ts +138 -0
- package/dist/production/lib/dom/server.js +301 -0
- package/dist/production/lib/dom/ssr/components.d.ts +196 -0
- package/dist/production/lib/dom/ssr/components.js +579 -0
- package/dist/production/lib/dom/ssr/data.js +29 -0
- package/dist/production/lib/dom/ssr/entry.d.ts +59 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.js +83 -0
- package/dist/production/lib/dom/ssr/errors.d.ts +7 -0
- package/dist/production/lib/dom/ssr/errors.js +36 -0
- package/dist/production/lib/dom/ssr/fallback.js +21 -0
- package/dist/production/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/production/lib/dom/ssr/fog-of-war.js +170 -0
- package/dist/production/lib/dom/ssr/hydration.d.ts +32 -0
- package/dist/production/lib/dom/ssr/hydration.js +29 -0
- package/dist/production/lib/dom/ssr/invariant.js +16 -0
- package/dist/production/lib/dom/ssr/links.js +170 -0
- package/dist/production/lib/dom/ssr/markup.js +24 -0
- package/dist/production/lib/dom/ssr/routeModules.d.ts +206 -0
- package/dist/production/lib/dom/ssr/routeModules.js +31 -0
- package/dist/production/lib/dom/ssr/routes-test-stub.d.ts +62 -0
- package/dist/production/lib/dom/ssr/routes-test-stub.js +108 -0
- package/dist/production/lib/dom/ssr/routes.d.ts +33 -0
- package/dist/production/lib/dom/ssr/routes.js +303 -0
- package/dist/production/lib/dom/ssr/server.d.ts +45 -0
- package/dist/production/lib/dom/ssr/server.js +68 -0
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/production/lib/dom/ssr/single-fetch.js +346 -0
- package/dist/production/lib/dom-export/dom-router-provider.d.ts +9 -0
- package/dist/production/lib/dom-export/dom-router-provider.js +22 -0
- package/dist/production/lib/dom-export/hydrated-router.d.ts +125 -0
- package/dist/production/lib/dom-export/hydrated-router.js +153 -0
- package/dist/production/lib/errors.js +29 -0
- package/dist/production/lib/hooks.d.ts +947 -0
- package/dist/production/lib/hooks.js +1371 -0
- package/dist/production/lib/href.d.ts +20 -0
- package/dist/production/lib/href.js +50 -0
- package/dist/production/lib/router/history.d.ts +258 -0
- package/dist/production/lib/router/history.js +371 -0
- package/dist/production/lib/router/instrumentation.d.ts +86 -0
- package/dist/production/lib/router/instrumentation.js +213 -0
- package/dist/production/lib/router/links.d.ts +113 -0
- package/dist/production/lib/router/router.d.ts +663 -0
- package/dist/production/lib/router/router.js +2981 -0
- package/dist/production/lib/router/utils.d.ts +942 -0
- package/dist/production/lib/router/utils.js +782 -0
- package/dist/production/lib/rsc/browser.d.ts +137 -0
- package/dist/production/lib/rsc/browser.js +599 -0
- package/dist/production/lib/rsc/errorBoundaries.d.ts +11 -0
- package/dist/production/lib/rsc/errorBoundaries.js +90 -0
- package/dist/production/lib/rsc/html-stream/browser.d.ts +48 -0
- package/dist/production/lib/rsc/html-stream/browser.js +74 -0
- package/dist/production/lib/rsc/html-stream/server.js +78 -0
- package/dist/production/lib/rsc/route-modules.js +27 -0
- package/dist/production/lib/rsc/server.rsc.d.ts +219 -0
- package/dist/production/lib/rsc/server.ssr.d.ts +129 -0
- package/dist/production/lib/rsc/server.ssr.js +388 -0
- package/dist/production/lib/server-runtime/build.d.ts +66 -0
- package/dist/production/lib/server-runtime/cookies.d.ts +66 -0
- package/dist/production/lib/server-runtime/cookies.js +139 -0
- package/dist/production/lib/server-runtime/crypto.js +43 -0
- package/dist/production/lib/server-runtime/data.d.ts +13 -0
- package/dist/production/lib/server-runtime/data.js +25 -0
- package/dist/production/lib/server-runtime/dev.d.ts +9 -0
- package/dist/production/lib/server-runtime/dev.js +26 -0
- package/dist/production/lib/server-runtime/entry.js +20 -0
- package/dist/production/lib/server-runtime/errors.js +95 -0
- package/dist/production/lib/server-runtime/headers.js +73 -0
- package/dist/production/lib/server-runtime/invariant.js +19 -0
- package/dist/production/lib/server-runtime/mode.d.ts +12 -0
- package/dist/production/lib/server-runtime/mode.js +25 -0
- package/dist/production/lib/server-runtime/routeMatching.js +28 -0
- package/dist/production/lib/server-runtime/routes.d.ts +13 -0
- package/dist/production/lib/server-runtime/routes.js +74 -0
- package/dist/production/lib/server-runtime/server.d.ts +10 -0
- package/dist/production/lib/server-runtime/server.js +351 -0
- package/dist/production/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +45 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +52 -0
- package/dist/production/lib/server-runtime/sessions.d.ts +145 -0
- package/dist/production/lib/server-runtime/sessions.js +98 -0
- package/dist/production/lib/server-runtime/single-fetch.d.ts +7 -0
- package/dist/production/lib/server-runtime/single-fetch.js +215 -0
- package/dist/production/lib/server-runtime/urls.js +31 -0
- package/dist/production/lib/server-runtime/warnings.js +20 -0
- package/dist/production/lib/types/future.d.ts +9 -0
- package/dist/production/lib/types/internal.d.ts +26 -177
- package/dist/production/lib/types/internal.js +3 -2
- package/dist/{development/register-CNAx3TXj.d.ts → production/lib/types/register.d.ts} +9 -15
- package/dist/production/lib/types/route-data.d.ts +113 -0
- package/dist/production/lib/types/route-module-annotations.d.ts +149 -0
- package/dist/production/lib/types/route-module.d.ts +19 -0
- package/dist/production/lib/types/serializes-to.d.ts +13 -0
- package/dist/production/lib/types/utils.d.ts +11 -0
- package/dist/production/vendor/turbo-stream-v2/flatten.js +159 -0
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +178 -0
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +198 -0
- package/dist/production/vendor/turbo-stream-v2/utils.js +47 -0
- package/docs/explanation/backend-for-frontend.md +50 -0
- package/docs/explanation/code-splitting.md +77 -0
- package/docs/explanation/concurrency.md +135 -0
- package/docs/explanation/form-vs-fetcher.md +292 -0
- package/docs/explanation/hot-module-replacement.md +137 -0
- package/docs/explanation/hydration.md +14 -0
- package/docs/explanation/index-query-param.md +86 -0
- package/docs/explanation/index.md +4 -0
- package/docs/explanation/lazy-route-discovery.md +78 -0
- package/docs/explanation/location.md +6 -0
- package/docs/explanation/progressive-enhancement.md +150 -0
- package/docs/explanation/race-conditions.md +88 -0
- package/docs/explanation/react-transitions.md +160 -0
- package/docs/explanation/route-matching.md +7 -0
- package/docs/explanation/server-client-execution.md +4 -0
- package/docs/explanation/sessions-and-cookies.md +465 -0
- package/docs/explanation/special-files.md +16 -0
- package/docs/explanation/state-management.md +524 -0
- package/docs/explanation/styling.md +87 -0
- package/docs/explanation/type-safety.md +82 -0
- package/docs/how-to/accessibility.md +44 -0
- package/docs/how-to/client-data.md +199 -0
- package/docs/how-to/data-strategy.md +317 -0
- package/docs/how-to/error-boundary.md +231 -0
- package/docs/how-to/error-reporting.md +134 -0
- package/docs/how-to/fetchers.md +307 -0
- package/docs/how-to/file-route-conventions.md +410 -0
- package/docs/how-to/file-uploads.md +217 -0
- package/docs/how-to/form-validation.md +120 -0
- package/docs/how-to/headers.md +164 -0
- package/docs/how-to/index.md +4 -0
- package/docs/how-to/instrumentation.md +556 -0
- package/docs/how-to/meta.md +40 -0
- package/docs/how-to/middleware.md +728 -0
- package/docs/how-to/navigation-blocking.md +233 -0
- package/docs/how-to/optimize-revalidation.md +12 -0
- package/docs/how-to/pre-rendering.md +225 -0
- package/docs/how-to/presets.md +103 -0
- package/docs/how-to/react-server-components.md +899 -0
- package/docs/how-to/resource-routes.md +126 -0
- package/docs/how-to/route-module-type-safety.md +100 -0
- package/docs/how-to/search-params.md +4 -0
- package/docs/how-to/security.md +30 -0
- package/docs/how-to/server-bundles.md +66 -0
- package/docs/how-to/spa.md +120 -0
- package/docs/how-to/status.md +63 -0
- package/docs/how-to/suspense.md +132 -0
- package/docs/how-to/using-handle.md +117 -0
- package/docs/how-to/view-transitions.md +237 -0
- package/docs/how-to/webhook.md +50 -0
- package/docs/index.md +39 -0
- package/docs/start/data/actions.md +138 -0
- package/docs/start/data/custom.md +198 -0
- package/docs/start/data/data-loading.md +44 -0
- package/docs/start/data/index.md +4 -0
- package/docs/start/data/installation.md +52 -0
- package/docs/start/data/navigating.md +12 -0
- package/docs/start/data/pending-ui.md +12 -0
- package/docs/start/data/route-object.md +248 -0
- package/docs/start/data/routing.md +281 -0
- package/docs/start/data/testing.md +8 -0
- package/docs/start/declarative/index.md +4 -0
- package/docs/start/declarative/installation.md +43 -0
- package/docs/start/declarative/navigating.md +133 -0
- package/docs/start/declarative/routing.md +237 -0
- package/docs/start/declarative/url-values.md +65 -0
- package/docs/start/framework/actions.md +175 -0
- package/docs/start/framework/data-loading.md +201 -0
- package/docs/start/framework/deploying.md +96 -0
- package/docs/start/framework/index.md +4 -0
- package/docs/start/framework/installation.md +42 -0
- package/docs/start/framework/navigating.md +182 -0
- package/docs/start/framework/pending-ui.md +142 -0
- package/docs/start/framework/rendering.md +59 -0
- package/docs/start/framework/route-module.md +527 -0
- package/docs/start/framework/routing.md +362 -0
- package/docs/start/framework/testing.md +133 -0
- package/docs/start/index.md +4 -0
- package/docs/start/modes.md +201 -0
- package/docs/upgrading/component-routes.md +363 -0
- package/docs/upgrading/future.md +31 -0
- package/docs/upgrading/index.md +4 -0
- package/docs/upgrading/remix.md +403 -0
- package/docs/upgrading/router-provider.md +442 -0
- package/docs/upgrading/v6.md +379 -0
- package/package.json +44 -87
- package/dist/development/browser-D3uq9sI1.d.ts +0 -318
- package/dist/development/browser-nIQ4Nsyi.d.mts +0 -318
- package/dist/development/chunk-IBI7OMNB.js +0 -1363
- package/dist/development/chunk-QUQL4437.mjs +0 -11529
- package/dist/development/chunk-S54KXAEJ.mjs +0 -2585
- package/dist/development/chunk-SRID2YZ2.js +0 -10229
- package/dist/development/chunk-XEJDWL2B.js +0 -188
- package/dist/development/context-m8rizgnE.d.mts +0 -1771
- package/dist/development/data-D4xhSy90.d.ts +0 -1732
- package/dist/development/data-U8FS-wNn.d.mts +0 -1732
- package/dist/development/dom-export.d.mts +0 -172
- package/dist/development/dom-export.mjs +0 -1008
- package/dist/development/index-react-server-client-BLiUx67a.d.ts +0 -3655
- package/dist/development/index-react-server-client-CdKROblb.d.mts +0 -2600
- package/dist/development/index-react-server-client.d.mts +0 -4
- package/dist/development/index-react-server-client.mjs +0 -59
- package/dist/development/index-react-server.d.mts +0 -2703
- package/dist/development/index-react-server.mjs +0 -3780
- package/dist/development/index.d.mts +0 -1478
- package/dist/development/index.mjs +0 -277
- package/dist/development/instrumentation-1q4YhLGP.d.ts +0 -715
- package/dist/development/lib/types/internal.d.mts +0 -184
- package/dist/development/lib/types/internal.mjs +0 -10
- package/dist/development/register-CqK96Zfk.d.mts +0 -30
- package/dist/production/browser-D3uq9sI1.d.ts +0 -318
- package/dist/production/browser-nIQ4Nsyi.d.mts +0 -318
- package/dist/production/chunk-EAQNHM3N.js +0 -188
- package/dist/production/chunk-NALGHHKE.mjs +0 -2585
- package/dist/production/chunk-Q65P7S7Y.mjs +0 -11529
- package/dist/production/chunk-SKEDDLRM.js +0 -1363
- package/dist/production/chunk-Y7DNFQZP.js +0 -10229
- package/dist/production/context-m8rizgnE.d.mts +0 -1771
- package/dist/production/data-D4xhSy90.d.ts +0 -1732
- package/dist/production/data-U8FS-wNn.d.mts +0 -1732
- package/dist/production/dom-export.d.mts +0 -172
- package/dist/production/dom-export.mjs +0 -1008
- package/dist/production/index-react-server-client-BLiUx67a.d.ts +0 -3655
- package/dist/production/index-react-server-client-CdKROblb.d.mts +0 -2600
- package/dist/production/index-react-server-client.d.mts +0 -4
- package/dist/production/index-react-server-client.mjs +0 -59
- package/dist/production/index-react-server.d.mts +0 -2703
- package/dist/production/index-react-server.mjs +0 -3780
- package/dist/production/index.d.mts +0 -1478
- package/dist/production/index.mjs +0 -277
- package/dist/production/instrumentation-1q4YhLGP.d.ts +0 -715
- package/dist/production/lib/types/internal.d.mts +0 -184
- package/dist/production/lib/types/internal.mjs +0 -10
- package/dist/production/register-CqK96Zfk.d.mts +0 -30
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
import { Action, History, Location, To } from "./router/history.js";
|
|
3
|
+
import { RouteMatch, TrackedPromise } from "./router/utils.js";
|
|
4
|
+
import { RelativeRoutingType, Router, RouterState, StaticHandlerContext } from "./router/router.js";
|
|
5
|
+
import { ClientOnErrorFunction } from "./components.js";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
|
|
8
|
+
//#region lib/context.d.ts
|
|
9
|
+
interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "useTransitions"> {
|
|
10
|
+
router: Router;
|
|
11
|
+
staticContext?: StaticHandlerContext;
|
|
12
|
+
onError?: ClientOnErrorFunction;
|
|
13
|
+
}
|
|
14
|
+
declare const DataRouterContext: React$1.Context<DataRouterContextObject | null>;
|
|
15
|
+
declare const DataRouterStateContext: React$1.Context<RouterState | null>;
|
|
16
|
+
type ViewTransitionContextObject = {
|
|
17
|
+
isTransitioning: false;
|
|
18
|
+
} | {
|
|
19
|
+
isTransitioning: true;
|
|
20
|
+
flushSync: boolean;
|
|
21
|
+
currentLocation: Location;
|
|
22
|
+
nextLocation: Location;
|
|
23
|
+
};
|
|
24
|
+
declare const ViewTransitionContext: React$1.Context<ViewTransitionContextObject>;
|
|
25
|
+
type FetchersContextObject = Map<string, any>;
|
|
26
|
+
declare const FetchersContext: React$1.Context<FetchersContextObject>;
|
|
27
|
+
declare const AwaitContext: React$1.Context<TrackedPromise | null>;
|
|
28
|
+
declare const AwaitContextProvider: (props: React$1.ComponentProps<typeof AwaitContext.Provider>) => React$1.FunctionComponentElement<React$1.ProviderProps<TrackedPromise | null>>;
|
|
29
|
+
interface NavigateOptions {
|
|
30
|
+
/** Replace the current entry in the history stack instead of pushing a new one */
|
|
31
|
+
replace?: boolean;
|
|
32
|
+
/** Masked URL */
|
|
33
|
+
mask?: To;
|
|
34
|
+
/** Adds persistent client side routing state to the next location */
|
|
35
|
+
state?: any;
|
|
36
|
+
/** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */
|
|
37
|
+
preventScrollReset?: boolean;
|
|
38
|
+
/** Defines the relative path behavior for the link. "route" will use the route hierarchy so ".." will remove all URL segments of the current route pattern while "path" will use the URL path so ".." will remove one URL segment. */
|
|
39
|
+
relative?: RelativeRoutingType;
|
|
40
|
+
/** Wraps the initial state update for this navigation in a {@link https://react.dev/reference/react-dom/flushSync ReactDOM.flushSync} call instead of the default {@link https://react.dev/reference/react/startTransition React.startTransition} */
|
|
41
|
+
flushSync?: boolean;
|
|
42
|
+
/** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link useViewTransitionState `useViewTransitionState()`} hook. */
|
|
43
|
+
viewTransition?: boolean;
|
|
44
|
+
/** Specifies the default revalidation behavior after this submission */
|
|
45
|
+
defaultShouldRevalidate?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A Navigator is a "location changer"; it's how you get to different locations.
|
|
49
|
+
*
|
|
50
|
+
* Every history instance conforms to the Navigator interface, but the
|
|
51
|
+
* distinction is useful primarily when it comes to the low-level `<Router>` API
|
|
52
|
+
* where both the location and a navigator must be provided separately in order
|
|
53
|
+
* to avoid "tearing" that may occur in a suspense-enabled app if the action
|
|
54
|
+
* and/or location were to be read directly from the history instance.
|
|
55
|
+
*/
|
|
56
|
+
interface Navigator {
|
|
57
|
+
createHref: History["createHref"];
|
|
58
|
+
encodeLocation?: History["encodeLocation"];
|
|
59
|
+
go: History["go"];
|
|
60
|
+
push(to: To, state?: any, opts?: NavigateOptions): void;
|
|
61
|
+
replace(to: To, state?: any, opts?: NavigateOptions): void;
|
|
62
|
+
}
|
|
63
|
+
interface NavigationContextObject {
|
|
64
|
+
basename: string;
|
|
65
|
+
navigator: Navigator;
|
|
66
|
+
static: boolean;
|
|
67
|
+
useTransitions: boolean | undefined;
|
|
68
|
+
future: {};
|
|
69
|
+
}
|
|
70
|
+
declare const NavigationContext: React$1.Context<NavigationContextObject>;
|
|
71
|
+
interface LocationContextObject {
|
|
72
|
+
location: Location;
|
|
73
|
+
navigationType: Action;
|
|
74
|
+
}
|
|
75
|
+
declare const LocationContext: React$1.Context<LocationContextObject>;
|
|
76
|
+
interface RouteContextObject {
|
|
77
|
+
outlet: React$1.ReactElement | null;
|
|
78
|
+
matches: RouteMatch[];
|
|
79
|
+
isDataRoute: boolean;
|
|
80
|
+
}
|
|
81
|
+
declare const RouteContext: React$1.Context<RouteContextObject>;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { AwaitContextProvider, DataRouterContext, DataRouterStateContext, FetchersContext, LocationContext, NavigateOptions, NavigationContext, Navigator, RouteContext, ViewTransitionContext };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v8.0.0-pre.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import * as React$1 from "react";
|
|
12
|
+
//#region lib/context.ts
|
|
13
|
+
const DataRouterContext = React$1.createContext(null);
|
|
14
|
+
DataRouterContext.displayName = "DataRouter";
|
|
15
|
+
const DataRouterStateContext = React$1.createContext(null);
|
|
16
|
+
DataRouterStateContext.displayName = "DataRouterState";
|
|
17
|
+
const RSCRouterContext = React$1.createContext(false);
|
|
18
|
+
function useIsRSCRouterContext() {
|
|
19
|
+
return React$1.useContext(RSCRouterContext);
|
|
20
|
+
}
|
|
21
|
+
const ViewTransitionContext = React$1.createContext({ isTransitioning: false });
|
|
22
|
+
ViewTransitionContext.displayName = "ViewTransition";
|
|
23
|
+
const FetchersContext = React$1.createContext(/* @__PURE__ */ new Map());
|
|
24
|
+
FetchersContext.displayName = "Fetchers";
|
|
25
|
+
const AwaitContext = React$1.createContext(null);
|
|
26
|
+
AwaitContext.displayName = "Await";
|
|
27
|
+
const AwaitContextProvider = (props) => React$1.createElement(AwaitContext.Provider, props);
|
|
28
|
+
const NavigationContext = React$1.createContext(null);
|
|
29
|
+
NavigationContext.displayName = "Navigation";
|
|
30
|
+
const LocationContext = React$1.createContext(null);
|
|
31
|
+
LocationContext.displayName = "Location";
|
|
32
|
+
const RouteContext = React$1.createContext({
|
|
33
|
+
outlet: null,
|
|
34
|
+
matches: [],
|
|
35
|
+
isDataRoute: false
|
|
36
|
+
});
|
|
37
|
+
RouteContext.displayName = "Route";
|
|
38
|
+
const RouteErrorContext = React$1.createContext(null);
|
|
39
|
+
RouteErrorContext.displayName = "RouteError";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { AwaitContext, AwaitContextProvider, DataRouterContext, DataRouterStateContext, FetchersContext, LocationContext, NavigationContext, RSCRouterContext, RouteContext, RouteErrorContext, ViewTransitionContext, useIsRSCRouterContext };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
|
|
2
|
+
import { FormEncType, HTMLFormMethod } from "../router/utils.js";
|
|
3
|
+
import { RelativeRoutingType } from "../router/router.js";
|
|
4
|
+
|
|
5
|
+
//#region lib/dom/dom.d.ts
|
|
6
|
+
type ParamKeyValuePair = [string, string];
|
|
7
|
+
type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
|
|
8
|
+
/**
|
|
9
|
+
Creates a URLSearchParams object using the given initializer.
|
|
10
|
+
|
|
11
|
+
This is identical to `new URLSearchParams(init)` except it also
|
|
12
|
+
supports arrays as values in the object form of the initializer
|
|
13
|
+
instead of just strings. This is convenient when you need multiple
|
|
14
|
+
values for a given key, but don't want to use an array initializer.
|
|
15
|
+
|
|
16
|
+
For example, instead of:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
let searchParams = new URLSearchParams([
|
|
20
|
+
['sort', 'name'],
|
|
21
|
+
['sort', 'price']
|
|
22
|
+
]);
|
|
23
|
+
```
|
|
24
|
+
you can do:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
let searchParams = createSearchParams({
|
|
28
|
+
sort: ['name', 'price']
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
@category Utils
|
|
33
|
+
*/
|
|
34
|
+
declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams;
|
|
35
|
+
type JsonObject = { [Key in string]: JsonValue } & { [Key in string]?: JsonValue | undefined };
|
|
36
|
+
type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
37
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
38
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
39
|
+
type SubmitTarget = HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | JsonValue | null;
|
|
40
|
+
/**
|
|
41
|
+
* Submit options shared by both navigations and fetchers
|
|
42
|
+
*/
|
|
43
|
+
interface SharedSubmitOptions {
|
|
44
|
+
/**
|
|
45
|
+
* The HTTP method used to submit the form. Overrides `<form method>`.
|
|
46
|
+
* Defaults to "GET".
|
|
47
|
+
*/
|
|
48
|
+
method?: HTMLFormMethod;
|
|
49
|
+
/**
|
|
50
|
+
* The action URL path used to submit the form. Overrides `<form action>`.
|
|
51
|
+
* Defaults to the path of the current route.
|
|
52
|
+
*/
|
|
53
|
+
action?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The encoding used to submit the form. Overrides `<form encType>`.
|
|
56
|
+
* Defaults to "application/x-www-form-urlencoded".
|
|
57
|
+
*/
|
|
58
|
+
encType?: FormEncType;
|
|
59
|
+
/**
|
|
60
|
+
* Determines whether the form action is relative to the route hierarchy or
|
|
61
|
+
* the pathname. Use this if you want to opt out of navigating the route
|
|
62
|
+
* hierarchy and want to instead route based on /-delimited URL segments
|
|
63
|
+
*/
|
|
64
|
+
relative?: RelativeRoutingType;
|
|
65
|
+
/**
|
|
66
|
+
* In browser-based environments, prevent resetting scroll after this
|
|
67
|
+
* navigation when using the <ScrollRestoration> component
|
|
68
|
+
*/
|
|
69
|
+
preventScrollReset?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Enable flushSync for this submission's state updates
|
|
72
|
+
*/
|
|
73
|
+
flushSync?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Specify the default revalidation behavior after this submission
|
|
76
|
+
*
|
|
77
|
+
* If no `shouldRevalidate` functions are present on the active routes, then this
|
|
78
|
+
* value will be used directly. Otherwise it will be passed into `shouldRevalidate`
|
|
79
|
+
* so the route can make the final determination on revalidation. This can be
|
|
80
|
+
* useful when updating search params and you don't want to trigger a revalidation.
|
|
81
|
+
*
|
|
82
|
+
* By default (when not specified), loaders will revalidate according to the routers
|
|
83
|
+
* standard revalidation behavior.
|
|
84
|
+
*/
|
|
85
|
+
defaultShouldRevalidate?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Submit options available to fetchers
|
|
89
|
+
*/
|
|
90
|
+
interface FetcherSubmitOptions extends SharedSubmitOptions {}
|
|
91
|
+
/**
|
|
92
|
+
* Submit options available to navigations
|
|
93
|
+
*/
|
|
94
|
+
interface SubmitOptions extends FetcherSubmitOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Set `true` to replace the current entry in the browser's history stack
|
|
97
|
+
* instead of creating a new one (i.e. stay on "the same page"). Defaults
|
|
98
|
+
* to `false`.
|
|
99
|
+
*/
|
|
100
|
+
replace?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* State object to add to the history stack entry for this navigation
|
|
103
|
+
*/
|
|
104
|
+
state?: any;
|
|
105
|
+
/**
|
|
106
|
+
* Indicate a specific fetcherKey to use when using navigate=false
|
|
107
|
+
*/
|
|
108
|
+
fetcherKey?: string;
|
|
109
|
+
/**
|
|
110
|
+
* navigate=false will use a fetcher instead of a navigation
|
|
111
|
+
*/
|
|
112
|
+
navigate?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Enable view transitions on this submission navigation
|
|
115
|
+
*/
|
|
116
|
+
viewTransition?: boolean;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { FetcherSubmitOptions, ParamKeyValuePair, SubmitOptions, SubmitTarget, URLSearchParamsInit, createSearchParams };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v8.0.0-pre.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import { warning } from "../router/history.js";
|
|
12
|
+
import { stripBasename } from "../router/utils.js";
|
|
13
|
+
const defaultEncType = "application/x-www-form-urlencoded";
|
|
14
|
+
function isHtmlElement(object) {
|
|
15
|
+
return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
|
|
16
|
+
}
|
|
17
|
+
function isButtonElement(object) {
|
|
18
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
|
|
19
|
+
}
|
|
20
|
+
function isFormElement(object) {
|
|
21
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
|
|
22
|
+
}
|
|
23
|
+
function isInputElement(object) {
|
|
24
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
|
|
25
|
+
}
|
|
26
|
+
function isModifiedEvent(event) {
|
|
27
|
+
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
28
|
+
}
|
|
29
|
+
function shouldProcessLinkClick(event, target) {
|
|
30
|
+
return event.button === 0 && (!target || target === "_self") && !isModifiedEvent(event);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
Creates a URLSearchParams object using the given initializer.
|
|
34
|
+
|
|
35
|
+
This is identical to `new URLSearchParams(init)` except it also
|
|
36
|
+
supports arrays as values in the object form of the initializer
|
|
37
|
+
instead of just strings. This is convenient when you need multiple
|
|
38
|
+
values for a given key, but don't want to use an array initializer.
|
|
39
|
+
|
|
40
|
+
For example, instead of:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
let searchParams = new URLSearchParams([
|
|
44
|
+
['sort', 'name'],
|
|
45
|
+
['sort', 'price']
|
|
46
|
+
]);
|
|
47
|
+
```
|
|
48
|
+
you can do:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
let searchParams = createSearchParams({
|
|
52
|
+
sort: ['name', 'price']
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
@category Utils
|
|
57
|
+
*/
|
|
58
|
+
function createSearchParams(init = "") {
|
|
59
|
+
return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
|
|
60
|
+
let value = init[key];
|
|
61
|
+
return memo.concat(Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]);
|
|
62
|
+
}, []));
|
|
63
|
+
}
|
|
64
|
+
function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
|
|
65
|
+
let searchParams = createSearchParams(locationSearch);
|
|
66
|
+
if (defaultSearchParams) defaultSearchParams.forEach((_, key) => {
|
|
67
|
+
if (!searchParams.has(key)) defaultSearchParams.getAll(key).forEach((value) => {
|
|
68
|
+
searchParams.append(key, value);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
return searchParams;
|
|
72
|
+
}
|
|
73
|
+
let _formDataSupportsSubmitter = null;
|
|
74
|
+
function isFormDataSubmitterSupported() {
|
|
75
|
+
if (_formDataSupportsSubmitter === null) try {
|
|
76
|
+
new FormData(document.createElement("form"), 0);
|
|
77
|
+
_formDataSupportsSubmitter = false;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
_formDataSupportsSubmitter = true;
|
|
80
|
+
}
|
|
81
|
+
return _formDataSupportsSubmitter;
|
|
82
|
+
}
|
|
83
|
+
const supportedFormEncTypes = new Set([
|
|
84
|
+
"application/x-www-form-urlencoded",
|
|
85
|
+
"multipart/form-data",
|
|
86
|
+
"text/plain"
|
|
87
|
+
]);
|
|
88
|
+
function getFormEncType(encType) {
|
|
89
|
+
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
90
|
+
warning(false, `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return encType;
|
|
94
|
+
}
|
|
95
|
+
function getFormSubmissionInfo(target, basename) {
|
|
96
|
+
let method;
|
|
97
|
+
let action;
|
|
98
|
+
let encType;
|
|
99
|
+
let formData;
|
|
100
|
+
let body;
|
|
101
|
+
if (isFormElement(target)) {
|
|
102
|
+
let attr = target.getAttribute("action");
|
|
103
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
104
|
+
method = target.getAttribute("method") || "get";
|
|
105
|
+
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
106
|
+
formData = new FormData(target);
|
|
107
|
+
} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
|
|
108
|
+
let form = target.form;
|
|
109
|
+
if (form == null) throw new Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);
|
|
110
|
+
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
111
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
112
|
+
method = target.getAttribute("formmethod") || form.getAttribute("method") || "get";
|
|
113
|
+
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
114
|
+
formData = new FormData(form, target);
|
|
115
|
+
if (!isFormDataSubmitterSupported()) {
|
|
116
|
+
let { name, type, value } = target;
|
|
117
|
+
if (type === "image") {
|
|
118
|
+
let prefix = name ? `${name}.` : "";
|
|
119
|
+
formData.append(`${prefix}x`, "0");
|
|
120
|
+
formData.append(`${prefix}y`, "0");
|
|
121
|
+
} else if (name) formData.append(name, value);
|
|
122
|
+
}
|
|
123
|
+
} else if (isHtmlElement(target)) throw new Error("Cannot submit element that is not <form>, <button>, or <input type=\"submit|image\">");
|
|
124
|
+
else {
|
|
125
|
+
method = "get";
|
|
126
|
+
action = null;
|
|
127
|
+
encType = defaultEncType;
|
|
128
|
+
body = target;
|
|
129
|
+
}
|
|
130
|
+
if (formData && encType === "text/plain") {
|
|
131
|
+
body = formData;
|
|
132
|
+
formData = void 0;
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
action,
|
|
136
|
+
method: method.toLowerCase(),
|
|
137
|
+
encType,
|
|
138
|
+
formData,
|
|
139
|
+
body
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
export { createSearchParams, getFormSubmissionInfo, getSearchParamsForLocation, shouldProcessLinkClick };
|