eddev 2.0.0-beta.24 → 2.0.0-beta.241
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/css/editor-styles.css +4 -0
- package/dist/app/entry/HydrationOverlay.d.ts +2 -0
- package/dist/app/entry/HydrationOverlay.d.ts.map +1 -0
- package/dist/app/entry/HydrationOverlay.js +2 -0
- package/dist/app/entry/MetaTags.d.ts +2 -0
- package/dist/app/entry/MetaTags.d.ts.map +1 -0
- package/dist/app/entry/MetaTags.js +27 -14
- package/dist/app/entry/boot-admin.d.ts +1 -0
- package/dist/app/entry/boot-admin.d.ts.map +1 -0
- package/dist/app/entry/boot-admin.js +7 -3
- package/dist/app/entry/hydration-script.d.ts +2 -0
- package/dist/app/entry/hydration-script.d.ts.map +1 -0
- package/dist/app/entry/hydration-script.js +18 -0
- package/dist/app/entry/spa-root.d.ts +1 -0
- package/dist/app/entry/spa-root.d.ts.map +1 -0
- package/dist/app/entry/spa-root.js +3 -5
- package/dist/app/entry/ssr-root-client.d.ts +1 -0
- package/dist/app/entry/ssr-root-client.d.ts.map +1 -0
- package/dist/app/entry/ssr-root-client.js +16 -11
- package/dist/app/entry/ssr-root.d.ts +4 -3
- package/dist/app/entry/ssr-root.d.ts.map +1 -0
- package/dist/app/entry/ssr-root.js +15 -17
- package/dist/app/lib/admin/defineField.d.ts +1 -0
- package/dist/app/lib/admin/defineField.d.ts.map +1 -0
- package/dist/app/lib/admin/defineWidget.d.ts +1 -0
- package/dist/app/lib/admin/defineWidget.d.ts.map +1 -0
- package/dist/app/lib/admin/index.d.ts +1 -0
- package/dist/app/lib/admin/index.d.ts.map +1 -0
- package/dist/app/lib/admin/installFieldTypes.d.ts +1 -0
- package/dist/app/lib/admin/installFieldTypes.d.ts.map +1 -0
- package/dist/app/lib/admin/installFieldTypes.js +2 -0
- package/dist/app/lib/admin/runWidgets.d.ts +1 -0
- package/dist/app/lib/admin/runWidgets.d.ts.map +1 -0
- package/dist/app/lib/admin/runWidgets.js +7 -2
- package/dist/app/lib/blocks/ContentBlocks.d.ts +8 -5
- package/dist/app/lib/blocks/ContentBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/ContentBlocks.js +16 -3
- package/dist/app/lib/blocks/EditableText.d.ts +30 -5
- package/dist/app/lib/blocks/EditableText.d.ts.map +1 -0
- package/dist/app/lib/blocks/EditableText.js +34 -5
- package/dist/app/lib/blocks/InnerBlocks.d.ts +21 -6
- package/dist/app/lib/blocks/InnerBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/InnerBlocks.js +73 -25
- package/dist/app/lib/blocks/SlotBlocks.d.ts +8 -0
- package/dist/app/lib/blocks/SlotBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/SlotBlocks.js +46 -0
- package/dist/app/lib/blocks/block-utils.d.ts +2 -1
- package/dist/app/lib/blocks/block-utils.d.ts.map +1 -0
- package/dist/app/lib/blocks/block-utils.js +3 -1
- package/dist/app/lib/blocks/builtin-blocks.d.ts +2 -0
- package/dist/app/lib/blocks/builtin-blocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/builtin-blocks.js +55 -0
- package/dist/app/lib/blocks/defineBlock.d.ts +4 -0
- package/dist/app/lib/blocks/defineBlock.d.ts.map +1 -0
- package/dist/app/lib/blocks/defineBlock.js +9 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +8 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.js +164 -0
- package/dist/app/lib/blocks/editor/EditorSupport.d.ts +1 -0
- package/dist/app/lib/blocks/editor/EditorSupport.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/EditorSupport.js +17 -10
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -0
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.d.ts +8 -1
- package/dist/app/lib/blocks/editor/block-templates.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.js +71 -2
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts +1 -0
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/controls.d.ts +1 -0
- package/dist/app/lib/blocks/editor/controls.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/create-block.d.ts +10 -0
- package/dist/app/lib/blocks/editor/create-block.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/create-block.js +13 -0
- package/dist/app/lib/blocks/editor/editor-config.d.ts +77 -8
- package/dist/app/lib/blocks/editor/editor-config.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/editor-config.js +29 -62
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts +4 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +126 -21
- package/dist/app/lib/blocks/editor/root-blocks.d.ts +7 -0
- package/dist/app/lib/blocks/editor/root-blocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts +12 -1
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/usePostEditor.js +33 -13
- package/dist/app/lib/blocks/index.d.ts +8 -5
- package/dist/app/lib/blocks/index.d.ts.map +1 -0
- package/dist/app/lib/blocks/index.js +7 -5
- package/dist/app/lib/blocks/inline-editing.d.ts +10 -0
- package/dist/app/lib/blocks/inline-editing.d.ts.map +1 -0
- package/dist/app/lib/blocks/inline-editing.js +12 -2
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts +1 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +2 -2
- package/dist/app/lib/devtools/components/DevUI.d.ts +1 -0
- package/dist/app/lib/devtools/components/DevUI.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/DevUI.js +3 -2
- package/dist/app/lib/devtools/components/GridIndicator.d.ts +2 -0
- package/dist/app/lib/devtools/components/GridIndicator.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/GridIndicator.js +29 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts +1 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts +2 -1
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +1394 -349
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts.map +1 -0
- package/dist/app/lib/devtools/index.d.ts +1 -0
- package/dist/app/lib/devtools/index.d.ts.map +1 -0
- package/dist/app/lib/devtools/loader.d.ts +1 -0
- package/dist/app/lib/devtools/loader.d.ts.map +1 -0
- package/dist/app/lib/devtools/loader.js +8 -7
- package/dist/app/lib/devtools/tailwind.config.d.ts +1 -0
- package/dist/app/lib/devtools/tailwind.config.d.ts.map +1 -0
- package/dist/app/lib/devtools/useQueryDebug.d.ts +8 -1
- package/dist/app/lib/devtools/useQueryDebug.d.ts.map +1 -0
- package/dist/app/lib/devtools/useQueryDebug.js +5 -8
- package/dist/app/lib/dynamic/dynamic.d.ts +2 -1
- package/dist/app/lib/dynamic/dynamic.d.ts.map +1 -0
- package/dist/app/lib/dynamic/dynamic.js +5 -1
- package/dist/app/lib/dynamic/index.d.ts +1 -0
- package/dist/app/lib/dynamic/index.d.ts.map +1 -0
- package/dist/app/lib/hooks/index.d.ts +3 -3
- package/dist/app/lib/hooks/index.d.ts.map +1 -0
- package/dist/app/lib/hooks/index.js +2 -3
- package/dist/app/lib/hooks/{queryUtils.d.ts → query-hooks.d.ts} +42 -3
- package/dist/app/lib/hooks/query-hooks.d.ts.map +1 -0
- package/dist/app/lib/hooks/{queryUtils.js → query-hooks.js} +96 -29
- package/dist/app/lib/hooks/useAppData.d.ts +1 -0
- package/dist/app/lib/hooks/useAppData.d.ts.map +1 -0
- package/dist/app/lib/hooks/useAppData.js +11 -0
- package/dist/app/lib/hooks/useRPC.d.ts +1 -4
- package/dist/app/lib/hooks/useRPC.d.ts.map +1 -0
- package/dist/app/lib/hooks/useRPC.js +0 -8
- package/dist/app/lib/integrations/gravityforms/index.d.ts +3 -0
- package/dist/app/lib/integrations/gravityforms/index.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/index.js +2 -0
- package/dist/app/lib/integrations/gravityforms/types.d.ts +145 -0
- package/dist/app/lib/integrations/gravityforms/types.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/types.js +1 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts +31 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.js +295 -0
- package/dist/app/lib/internal/finalize-rpc.d.ts +18 -0
- package/dist/app/lib/internal/finalize-rpc.d.ts.map +1 -0
- package/dist/app/lib/internal/finalize-rpc.js +3 -0
- package/dist/app/lib/internal/index.d.ts +2 -0
- package/dist/app/lib/internal/index.d.ts.map +1 -0
- package/dist/app/lib/internal/index.js +1 -0
- package/dist/app/lib/internal/internal-store.d.ts +1 -0
- package/dist/app/lib/internal/internal-store.d.ts.map +1 -0
- package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -0
- package/dist/app/lib/internal/read-admin-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts +2 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-block-manifest.js +7 -0
- package/dist/app/lib/internal/read-view-manifest.d.ts +7 -4
- package/dist/app/lib/internal/read-view-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-view-manifest.js +18 -0
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +1 -0
- package/dist/app/lib/legacy-stitches/createStitches.d.ts.map +1 -0
- package/dist/app/lib/legacy-stitches/index.d.ts +1 -0
- package/dist/app/lib/legacy-stitches/index.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BackButton.d.ts +50 -0
- package/dist/app/lib/routing/components/BackButton.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BackButton.js +47 -0
- package/dist/app/lib/routing/components/BrowserRouter.d.ts +7 -1
- package/dist/app/lib/routing/components/BrowserRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BrowserRouter.js +168 -31
- package/dist/app/lib/routing/components/ClientOnly.d.ts +1 -0
- package/dist/app/lib/routing/components/ClientOnly.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ClientOnly.js +3 -3
- package/dist/app/lib/routing/components/Link.d.ts +22 -2
- package/dist/app/lib/routing/components/Link.d.ts.map +1 -0
- package/dist/app/lib/routing/components/Link.js +53 -25
- package/dist/app/lib/routing/components/NativeLinkHandler.d.ts +10 -0
- package/dist/app/lib/routing/components/NativeLinkHandler.d.ts.map +1 -0
- package/dist/app/lib/routing/components/NativeLinkHandler.js +23 -0
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -0
- package/dist/app/lib/routing/components/RouteRenderer.d.ts.map +1 -0
- package/dist/app/lib/routing/components/RouteRenderer.js +15 -1
- package/dist/app/lib/routing/components/SSRRouter.d.ts +3 -0
- package/dist/app/lib/routing/components/SSRRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/SSRRouter.js +2 -0
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts +1 -0
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ScrollRestoration.js +4 -1
- package/dist/app/lib/routing/context.d.ts +9 -5
- package/dist/app/lib/routing/context.d.ts.map +1 -0
- package/dist/app/lib/routing/context.js +11 -0
- package/dist/app/lib/routing/hooks/{useIsSSR.d.ts → useHydrating.d.ts} +7 -0
- package/dist/app/lib/routing/hooks/useHydrating.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/{useIsSSR.js → useHydrating.js} +9 -1
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts +3 -1
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRoute.d.ts +16 -0
- package/dist/app/lib/routing/hooks/useRoute.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRoute.js +21 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouterState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts +78 -6
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useSearchParams.js +75 -15
- package/dist/app/lib/routing/index.d.ts +5 -1
- package/dist/app/lib/routing/index.d.ts.map +1 -0
- package/dist/app/lib/routing/index.js +4 -1
- package/dist/app/lib/routing/loader.d.ts +1 -0
- package/dist/app/lib/routing/loader.d.ts.map +1 -0
- package/dist/app/lib/routing/loader.js +19 -10
- package/dist/app/lib/routing/types.d.ts +61 -8
- package/dist/app/lib/routing/types.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.d.ts +5 -1
- package/dist/app/lib/routing/utils.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.js +36 -4
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +11 -2
- package/dist/app/lib/runtime/apiConfig.d.ts.map +1 -0
- package/dist/app/lib/runtime/apiConfig.js +6 -0
- package/dist/app/lib/runtime/errorHandling.d.ts +40 -0
- package/dist/app/lib/runtime/errorHandling.d.ts.map +1 -0
- package/dist/app/lib/runtime/errorHandling.js +6 -0
- package/dist/app/lib/runtime/index.d.ts +3 -0
- package/dist/app/lib/runtime/index.d.ts.map +1 -0
- package/dist/app/lib/runtime/index.js +2 -0
- package/dist/app/lib/views/defineView.d.ts +2 -1
- package/dist/app/lib/views/defineView.d.ts.map +1 -0
- package/dist/app/lib/views/index.d.ts +1 -0
- package/dist/app/lib/views/index.d.ts.map +1 -0
- package/dist/app/server/index.d.ts +4 -1
- package/dist/app/server/index.d.ts.map +1 -0
- package/dist/app/server/index.js +3 -1
- package/dist/app/server/proxy-wp-admin.d.ts +2 -2
- package/dist/app/server/proxy-wp-admin.d.ts.map +1 -0
- package/dist/app/server/proxy-wp-admin.js +45 -12
- package/dist/app/server/render-ai-page.d.ts +13 -0
- package/dist/app/server/render-ai-page.d.ts.map +1 -0
- package/dist/app/server/render-ai-page.js +102 -0
- package/dist/app/server/render-ssr-page.d.ts +32 -3
- package/dist/app/server/render-ssr-page.d.ts.map +1 -0
- package/dist/app/server/render-ssr-page.js +229 -10
- package/dist/app/server/rpc.d.ts +52 -0
- package/dist/app/server/rpc.d.ts.map +1 -0
- package/dist/app/server/rpc.js +18 -0
- package/dist/app/server/server-context.d.ts +48 -8
- package/dist/app/server/server-context.d.ts.map +1 -0
- package/dist/app/server/server-context.js +366 -45
- package/dist/app/server/server-custom-config.d.ts +3 -0
- package/dist/app/server/server-custom-config.d.ts.map +1 -0
- package/dist/app/server/server-custom-config.js +1 -0
- package/dist/app/server/utils/content-security.d.ts +26 -0
- package/dist/app/server/utils/content-security.d.ts.map +1 -0
- package/dist/app/server/utils/content-security.js +124 -0
- package/dist/app/server/utils/headers.d.ts +1 -0
- package/dist/app/server/utils/headers.d.ts.map +1 -0
- package/dist/app/server/utils/replace-host.d.ts +2 -1
- package/dist/app/server/utils/replace-host.d.ts.map +1 -0
- package/dist/app/server/utils/replace-host.js +10 -2
- package/dist/app/server/utils/swr-cache.d.ts +5 -0
- package/dist/app/server/utils/swr-cache.d.ts.map +1 -0
- package/dist/app/server/utils/swr-cache.js +31 -0
- package/dist/app/utils/APIProvider.d.ts +3 -0
- package/dist/app/utils/APIProvider.d.ts.map +1 -0
- package/dist/app/utils/APIProvider.js +5 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts +20 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/BlockErrorBoundary.js +38 -0
- package/dist/app/utils/ErrorMessage.d.ts +6 -0
- package/dist/app/utils/ErrorMessage.d.ts.map +1 -0
- package/dist/app/utils/ErrorMessage.js +14 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts +20 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/RouteErrorBoundary.js +41 -0
- package/dist/app/utils/asset-capture.d.ts +3 -0
- package/dist/app/utils/asset-capture.d.ts.map +1 -0
- package/dist/app/utils/asset-capture.js +5 -0
- package/dist/app/utils/hydration-debugger.d.ts +14 -0
- package/dist/app/utils/hydration-debugger.d.ts.map +1 -0
- package/dist/app/utils/hydration-debugger.js +11 -0
- package/dist/app/utils/query-client.d.ts +3 -0
- package/dist/app/utils/query-client.d.ts.map +1 -0
- package/dist/app/utils/query-client.js +5 -1
- package/dist/app/utils/query-monitor.d.ts +27 -0
- package/dist/app/utils/query-monitor.d.ts.map +1 -0
- package/dist/app/utils/query-monitor.js +7 -0
- package/dist/app/utils/trpc-client.d.ts +3 -0
- package/dist/app/utils/trpc-client.d.ts.map +1 -0
- package/dist/app/utils/trpc-client.js +39 -0
- package/dist/app/utils/wp.d.ts +11 -10
- package/dist/app/utils/wp.d.ts.map +1 -0
- package/dist/node/cli/cli-mode.d.ts +1 -0
- package/dist/node/cli/cli-mode.d.ts.map +1 -0
- package/dist/node/cli/cli-worker.d.ts +1 -0
- package/dist/node/cli/cli-worker.d.ts.map +1 -0
- package/dist/node/cli/cli-worker.js +7 -3
- package/dist/node/cli/cli.d.ts +1 -0
- package/dist/node/cli/cli.d.ts.map +1 -0
- package/dist/node/cli/cli.js +120 -7
- package/dist/node/cli/display/CLIApp.d.ts +1 -0
- package/dist/node/cli/display/CLIApp.d.ts.map +1 -0
- package/dist/node/cli/display/CLIApp.js +1 -1
- package/dist/node/cli/display/boot-cli-app.d.ts +1 -0
- package/dist/node/cli/display/boot-cli-app.d.ts.map +1 -0
- package/dist/node/cli/display/boot-cli-app.js +1 -1
- package/dist/node/cli/display/components/Fullscreen.d.ts +1 -0
- package/dist/node/cli/display/components/Fullscreen.d.ts.map +1 -0
- package/dist/node/cli/display/components/LogEntries.d.ts +1 -0
- package/dist/node/cli/display/components/LogEntries.d.ts.map +1 -0
- package/dist/node/cli/display/components/MenuItem.d.ts +1 -0
- package/dist/node/cli/display/components/MenuItem.d.ts.map +1 -0
- package/dist/node/cli/display/components/TextInput.d.ts +1 -0
- package/dist/node/cli/display/components/TextInput.d.ts.map +1 -0
- package/dist/node/cli/display/hooks/useManifest.d.ts +1 -0
- package/dist/node/cli/display/hooks/useManifest.d.ts.map +1 -0
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -0
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts.map +1 -0
- package/dist/node/cli/display/tools/BlockList.d.ts +1 -0
- package/dist/node/cli/display/tools/BlockList.d.ts.map +1 -0
- package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -0
- package/dist/node/cli/display/tools/CreateBlock.d.ts.map +1 -0
- package/dist/node/cli/display/tools/cli-tool-list.d.ts +1 -0
- package/dist/node/cli/display/tools/cli-tool-list.d.ts.map +1 -0
- package/dist/node/cli/display/tools/cli-tools.d.ts +1 -0
- package/dist/node/cli/display/tools/cli-tools.d.ts.map +1 -0
- package/dist/node/cli/display/util/colors.d.ts +1 -0
- package/dist/node/cli/display/util/colors.d.ts.map +1 -0
- package/dist/node/cli/version.d.ts +2 -1
- package/dist/node/cli/version.d.ts.map +1 -0
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/build-vinxi.d.ts +1 -0
- package/dist/node/compiler/build-vinxi.d.ts.map +1 -0
- package/dist/node/compiler/build-vinxi.js +3 -1
- package/dist/node/compiler/bundler.admin.d.ts +1 -0
- package/dist/node/compiler/bundler.admin.d.ts.map +1 -0
- package/dist/node/compiler/bundler.admin.js +1 -0
- package/dist/node/compiler/bundler.frontend.d.ts +2 -0
- package/dist/node/compiler/bundler.frontend.d.ts.map +1 -0
- package/dist/node/compiler/bundler.frontend.js +26 -11
- package/dist/node/compiler/cache-config.d.ts +3 -0
- package/dist/node/compiler/cache-config.d.ts.map +1 -0
- package/dist/node/compiler/cache-config.js +16 -0
- package/dist/node/compiler/dev-server.d.ts +4 -1
- package/dist/node/compiler/dev-server.d.ts.map +1 -0
- package/dist/node/compiler/dev-server.js +34 -11
- package/dist/node/compiler/get-vite-config.d.ts +12 -1
- package/dist/node/compiler/get-vite-config.d.ts.map +1 -0
- package/dist/node/compiler/get-vite-config.js +176 -42
- package/dist/node/compiler/vinxi-app.d.ts +4 -0
- package/dist/node/compiler/vinxi-app.d.ts.map +1 -0
- package/dist/node/compiler/vinxi-app.js +137 -37
- package/dist/node/compiler/vinxi-codegen.d.ts +1 -0
- package/dist/node/compiler/vinxi-codegen.d.ts.map +1 -0
- package/dist/node/compiler/vinxi-codegen.js +362 -116
- package/dist/node/graphql/graphql-codegen.d.ts +12 -1
- package/dist/node/graphql/graphql-codegen.d.ts.map +1 -0
- package/dist/node/graphql/graphql-codegen.js +239 -37
- package/dist/node/graphql/graphql-schema-loader.d.ts +3 -1
- package/dist/node/graphql/graphql-schema-loader.d.ts.map +1 -0
- package/dist/node/graphql/graphql-schema-loader.js +5 -16
- package/dist/node/graphql/plugins/gql-plugin-files.d.ts +3 -1
- package/dist/node/graphql/plugins/gql-plugin-files.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-files.js +3 -2
- package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts +1 -0
- package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.d.ts +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.js +2 -2
- package/dist/node/graphql/query-files-loader.d.ts +4 -0
- package/dist/node/graphql/query-files-loader.d.ts.map +1 -0
- package/dist/node/graphql/query-files-loader.js +5 -0
- package/dist/node/graphql/wp-info-query.d.ts +1 -0
- package/dist/node/graphql/wp-info-query.d.ts.map +1 -0
- package/dist/node/project/config.d.ts +260 -69
- package/dist/node/project/config.d.ts.map +1 -0
- package/dist/node/project/config.js +100 -21
- package/dist/node/project/eddev-build-file.d.ts +1 -0
- package/dist/node/project/eddev-build-file.d.ts.map +1 -0
- package/dist/node/project/eddev-build-file.js +4 -2
- package/dist/node/project/env.d.ts +5 -0
- package/dist/node/project/env.d.ts.map +1 -0
- package/dist/node/project/env.js +1 -0
- package/dist/node/project/favicons.d.ts +1 -0
- package/dist/node/project/favicons.d.ts.map +1 -0
- package/dist/node/project/manifest/block-manifest.d.ts +1 -0
- package/dist/node/project/manifest/block-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/block-manifest.js +6 -2
- package/dist/node/project/manifest/field-manifest.d.ts +1 -0
- package/dist/node/project/manifest/field-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/manifest.d.ts +2 -0
- package/dist/node/project/manifest/manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/manifest.js +14 -10
- package/dist/node/project/manifest/routes-manifest.d.ts +21 -0
- package/dist/node/project/manifest/routes-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/routes-manifest.js +74 -0
- package/dist/node/project/manifest/view-manifest.d.ts +1 -0
- package/dist/node/project/manifest/view-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/widget-manifest.d.ts +1 -0
- package/dist/node/project/manifest/widget-manifest.d.ts.map +1 -0
- package/dist/node/project/project.d.ts +12 -0
- package/dist/node/project/project.d.ts.map +1 -0
- package/dist/node/project/project.js +55 -1
- package/dist/node/project/wp-info.d.ts +3 -0
- package/dist/node/project/wp-info.d.ts.map +1 -0
- package/dist/node/project/wp-info.js +10 -1
- package/dist/node/storybook/index.d.ts +3 -0
- package/dist/node/storybook/index.d.ts.map +1 -0
- package/dist/node/storybook/index.js +13 -0
- package/dist/node/types/block-type.d.ts +39 -7
- package/dist/node/types/block-type.d.ts.map +1 -0
- package/dist/node/types/block-type.js +4 -1
- package/dist/node/types/view-type.d.ts +1 -0
- package/dist/node/types/view-type.d.ts.map +1 -0
- package/dist/node/utils/fetch-wp.d.ts +2 -0
- package/dist/node/utils/fetch-wp.d.ts.map +1 -0
- package/dist/node/utils/fetch-wp.js +28 -0
- package/dist/node/utils/format-zod-error.d.ts +1 -0
- package/dist/node/utils/format-zod-error.d.ts.map +1 -0
- package/dist/node/utils/fs-codegen.d.ts +4 -0
- package/dist/node/utils/fs-codegen.d.ts.map +1 -0
- package/dist/node/utils/fs-codegen.js +10 -2
- package/dist/node/utils/fs.d.ts +6 -1
- package/dist/node/utils/fs.d.ts.map +1 -0
- package/dist/node/utils/get-repo-info.d.ts +1 -0
- package/dist/node/utils/get-repo-info.d.ts.map +1 -0
- package/dist/node/utils/helpers.d.ts +1 -0
- package/dist/node/utils/helpers.d.ts.map +1 -0
- package/dist/node/utils/highlight-code.d.ts +1 -0
- package/dist/node/utils/highlight-code.d.ts.map +1 -0
- package/dist/node/utils/is-deploying.d.ts +1 -0
- package/dist/node/utils/is-deploying.d.ts.map +1 -0
- package/dist/node/utils/is-deploying.js +1 -1
- package/dist/node/utils/report-builder.d.ts +7 -6
- package/dist/node/utils/report-builder.d.ts.map +1 -0
- package/dist/node/utils/self-signed-cert.d.ts +5 -0
- package/dist/node/utils/self-signed-cert.d.ts.map +1 -0
- package/dist/node/utils/self-signed-cert.js +28 -4
- package/dist/node/utils/stateful-log.d.ts +1 -0
- package/dist/node/utils/stateful-log.d.ts.map +1 -0
- package/dist/node/utils/stateful-log.js +2 -0
- package/dist/node/utils/ts-export-extractor.d.ts +1 -0
- package/dist/node/utils/ts-export-extractor.d.ts.map +1 -0
- package/dist/node/utils/watch-file-tree.d.ts +18 -3
- package/dist/node/utils/watch-file-tree.d.ts.map +1 -0
- package/dist/node/utils/watch-file-tree.js +12 -5
- package/package.json +39 -24
- package/tsconfig.app.json +8 -3
- package/tsconfig.node.json +1 -0
- package/types.app.d.ts +2 -0
- package/types.env.d.ts +3 -0
- package/types.meta.d.ts +449 -136
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +0 -15
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +0 -35
- package/dist/app/lib/hooks/apiConfig.js +0 -4
- package/dist/app/lib/hooks/usePageLoad.d.ts +0 -6
- package/dist/app/lib/hooks/usePageLoad.js +0 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRouter } from "../hooks/useRouter";
|
|
3
|
+
/**
|
|
4
|
+
* Use this component to wrap any HTML element that contains <a> tags that are not already handled by the router.
|
|
5
|
+
*/
|
|
6
|
+
export function NativeLinkHandler({ as, ...props }) {
|
|
7
|
+
const handleClickEvent = useRouter((r) => r.handleClickEvent);
|
|
8
|
+
const Comp = (as ?? "div");
|
|
9
|
+
return (_jsx(Comp, { ...props, onClick: (e) => {
|
|
10
|
+
if (props.onClick)
|
|
11
|
+
props.onClick(e);
|
|
12
|
+
if (e.target instanceof HTMLAnchorElement) {
|
|
13
|
+
const link = e.target;
|
|
14
|
+
handleClickEvent?.(e, link.href, false, link);
|
|
15
|
+
}
|
|
16
|
+
else if (e.target instanceof HTMLElement) {
|
|
17
|
+
const link = e.target.closest("a");
|
|
18
|
+
if (link) {
|
|
19
|
+
handleClickEvent?.(e, link.href, false, link);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
} }));
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/components/RouteRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAOxC,eAAO,MAAM,WAAW,oFAatB,CAAA;AAEF,wBAAgB,SAAS,4CAGxB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,2CA8BxD;yBA9Be,YAAY"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
|
+
import { RouteErrorBoundary } from "../../../utils/RouteErrorBoundary.js";
|
|
3
4
|
import { RouteItemContext } from "../context.js";
|
|
4
5
|
import { useRouter } from "../hooks/useRouter.js";
|
|
5
6
|
import { useRouterState } from "../hooks/useRouterState.js";
|
|
@@ -20,9 +21,22 @@ export function RouteDisplay(props) {
|
|
|
20
21
|
if (!Component) {
|
|
21
22
|
console.error("No component for route");
|
|
22
23
|
}
|
|
24
|
+
const router = useRouter();
|
|
23
25
|
return useMemo(() => {
|
|
24
26
|
let child = !!Component && _jsx(Component, { ...props.route.props });
|
|
25
|
-
|
|
27
|
+
if (router.isAI) {
|
|
28
|
+
child = _jsx("div", { id: "ai-page-contents", children: child });
|
|
29
|
+
}
|
|
30
|
+
return (_jsx(RouteErrorBoundary, { route: props.route, onError: (error, errorInfo) => {
|
|
31
|
+
if (env.client) {
|
|
32
|
+
if (error.message.includes("Failed to fetch dynamically imported module")) {
|
|
33
|
+
router.emitEvent({
|
|
34
|
+
type: "error:component-load-failed",
|
|
35
|
+
error,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, children: _jsx(RouteItemContext.Provider, { value: props.route, children: child }) }));
|
|
26
40
|
}, [Component, props.route, props.route]);
|
|
27
41
|
}
|
|
28
42
|
RouteDisplay.displayName = "RouteDisplay";
|
|
@@ -2,8 +2,11 @@ import { PropsWithChildren } from "react";
|
|
|
2
2
|
import { RouteLoader } from "../loader.js";
|
|
3
3
|
import { RouteState } from "../types.js";
|
|
4
4
|
type Props = PropsWithChildren<{
|
|
5
|
+
hostname?: string;
|
|
5
6
|
route: RouteState;
|
|
6
7
|
loader: RouteLoader;
|
|
8
|
+
isAI?: boolean;
|
|
7
9
|
}>;
|
|
8
10
|
export declare function SSRRouter(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
12
|
+
//# sourceMappingURL=SSRRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SSRRouter.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/components/SSRRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,MAAM,OAAO,CAAA;AAInD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,KAAK,KAAK,GAAG,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,UAAU,CAAA;IACjB,MAAM,EAAE,WAAW,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAC,CAAA;AAEF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,2CAiBrC"}
|
|
@@ -7,6 +7,8 @@ export function SSRRouter(props) {
|
|
|
7
7
|
const router = useRouter();
|
|
8
8
|
const routerState = useRouterState();
|
|
9
9
|
router.loader = props.loader;
|
|
10
|
+
router.hostname = props.hostname;
|
|
11
|
+
router.isAI = props.isAI;
|
|
10
12
|
routerState.history = [props.route];
|
|
11
13
|
routerState.activeRoute = props.route;
|
|
12
14
|
return (_jsx(RouterContext.Provider, { value: router, children: _jsx(RouterStateContext.Provider, { value: routerState, children: _jsx(AppRenderer, {}) }) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollRestoration.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/components/ScrollRestoration.tsx"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACX,2FAA2F;IAC3F,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,KAAK,IAAI,CAAA;IACxF,4CAA4C;IAC5C,SAAS,CAAC,EAAE,cAAc,CAAA;CAC3B,CAAA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,QAiC7C"}
|
|
@@ -11,7 +11,10 @@ export function ScrollRestoration(props) {
|
|
|
11
11
|
}));
|
|
12
12
|
useRouterEvents((event) => {
|
|
13
13
|
if (event.type === "navigate:changed") {
|
|
14
|
-
//
|
|
14
|
+
// If the pathname and search term are the same, then we're on the same page
|
|
15
|
+
const isSameRoute = event.currentRoute.pathname === event.lastRoute.pathname && event.currentRoute.search === event.lastRoute.search;
|
|
16
|
+
if (isSameRoute)
|
|
17
|
+
return;
|
|
15
18
|
if (event.currentRoute.returnState) {
|
|
16
19
|
restore({
|
|
17
20
|
top: event.currentRoute.returnState.scrollTop ?? 0,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
1
|
+
import { RouteMetaTag, RouterAPI, RouterAPIState } from "./types.js";
|
|
2
|
+
export declare const RouterContext: import("react").Context<RouterAPI>;
|
|
3
|
+
export declare const RouterStateContext: import("react").Context<RouterAPIState>;
|
|
4
|
+
export declare const RouteItemContext: import("react").Context<import("./types.js").TypedRouteState<"_unknown", {}>>;
|
|
5
|
+
export declare const clientMetaTags: {
|
|
6
|
+
tags: null | RouteMetaTag[];
|
|
7
|
+
setMetaTags(tags: RouteMetaTag[]): void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/routing/context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAc,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAkBhF,eAAO,MAAM,aAAa,oCAgBxB,CAAA;AAEF,eAAO,MAAM,kBAAkB,yCAI7B,CAAA;AAEF,eAAO,MAAM,gBAAgB,+EAAwC,CAAA;AAErE,eAAO,MAAM,cAAc;UACX,IAAI,GAAG,YAAY,EAAE;sBACjB,YAAY,EAAE;CAGhC,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
import { RouteLoader } from "./loader.js";
|
|
3
|
+
import { proxy } from "valtio";
|
|
3
4
|
const NOOP_ROUTE = {
|
|
4
5
|
component: () => null,
|
|
5
6
|
id: "initial",
|
|
@@ -26,6 +27,10 @@ export const RouterContext = createContext({
|
|
|
26
27
|
replaceQuery(query) { },
|
|
27
28
|
handleClickEvent(e, originalHref) { },
|
|
28
29
|
emitEvent(event) { },
|
|
30
|
+
getState() {
|
|
31
|
+
return null;
|
|
32
|
+
},
|
|
33
|
+
restoreRoute(route) { },
|
|
29
34
|
});
|
|
30
35
|
export const RouterStateContext = createContext({
|
|
31
36
|
history: [NOOP_ROUTE],
|
|
@@ -33,3 +38,9 @@ export const RouterStateContext = createContext({
|
|
|
33
38
|
blockers: [],
|
|
34
39
|
});
|
|
35
40
|
export const RouteItemContext = createContext(NOOP_ROUTE);
|
|
41
|
+
export const clientMetaTags = proxy({
|
|
42
|
+
tags: null,
|
|
43
|
+
setMetaTags(tags) {
|
|
44
|
+
clientMetaTags.tags = tags;
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -5,4 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* On the client, this hook will return `true` once, after hydration, and then switch to `false`.
|
|
7
7
|
*/
|
|
8
|
+
export declare function useHydrating(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Alias of useHydrating (was renamed)
|
|
11
|
+
* @deprecated
|
|
12
|
+
* @see useHydrating
|
|
13
|
+
*/
|
|
8
14
|
export declare function useIsSSR(): boolean;
|
|
15
|
+
//# sourceMappingURL=useHydrating.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHydrating.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useHydrating.tsx"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,YAAY,YAa3B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,YAEvB"}
|
|
@@ -7,7 +7,7 @@ let isSSR = true;
|
|
|
7
7
|
*
|
|
8
8
|
* On the client, this hook will return `true` once, after hydration, and then switch to `false`.
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function useHydrating() {
|
|
11
11
|
const [value, setValue] = useState(isSSR);
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
if (!isSSR)
|
|
@@ -20,3 +20,11 @@ export function useIsSSR() {
|
|
|
20
20
|
}, []);
|
|
21
21
|
return value;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Alias of useHydrating (was renamed)
|
|
25
|
+
* @deprecated
|
|
26
|
+
* @see useHydrating
|
|
27
|
+
*/
|
|
28
|
+
export function useIsSSR() {
|
|
29
|
+
return useHydrating();
|
|
30
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Dispatch } from "react";
|
|
1
2
|
/**
|
|
2
3
|
* Works exactly like useState, but allows back and forward navigation to restore the previous state.
|
|
3
4
|
* You must pass a unique ID as an additional first parameter to ensure the state is restored correctly.
|
|
4
5
|
*/
|
|
5
|
-
export declare function useRestorableState<T>(key: string, fallback
|
|
6
|
+
export declare function useRestorableState<T>(key: string, fallback: T): [T, Dispatch<T>];
|
|
7
|
+
//# sourceMappingURL=useRestorableState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRestorableState.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useRestorableState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAA;AAI1C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAYhF"}
|
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
import type { RouteState } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current route object.
|
|
4
|
+
*
|
|
5
|
+
* In most circumstances, this will be the active top-level route.
|
|
6
|
+
*
|
|
7
|
+
* In cases where manual rendering of routes is taking place, such as during page transitions or in some modal cases.
|
|
8
|
+
*
|
|
9
|
+
* @returns The current route
|
|
10
|
+
*/
|
|
2
11
|
export declare function useRoute(): RouteState;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the current route, if it matches the specified view, otherwise null.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useViewRoute<V extends keyof ViewProps>(view: V): Extract<RouteState, {
|
|
16
|
+
view: V;
|
|
17
|
+
}> | null;
|
|
18
|
+
//# sourceMappingURL=useRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRoute.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,UAAU,CAErC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,GAAG,IAAI,CAOxG"}
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
2
|
import { RouteItemContext } from "../context.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the current route object.
|
|
5
|
+
*
|
|
6
|
+
* In most circumstances, this will be the active top-level route.
|
|
7
|
+
*
|
|
8
|
+
* In cases where manual rendering of routes is taking place, such as during page transitions or in some modal cases.
|
|
9
|
+
*
|
|
10
|
+
* @returns The current route
|
|
11
|
+
*/
|
|
3
12
|
export function useRoute() {
|
|
4
13
|
return useContext(RouteItemContext);
|
|
5
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the current route, if it matches the specified view, otherwise null.
|
|
17
|
+
*/
|
|
18
|
+
export function useViewRoute(view) {
|
|
19
|
+
const route = useContext(RouteItemContext);
|
|
20
|
+
if (route.view === view) {
|
|
21
|
+
return route;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRouteMeta.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useRouteMeta.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,eAAO,MAAM,eAAe;UACd,SAAS;CACrB,CAAA;AAEF,wBAAgB,YAAY,IAGf,SAAS,CACrB"}
|
|
@@ -2,3 +2,4 @@ import type { RouteState } from "../types.js";
|
|
|
2
2
|
type TransitionFunction = (currentRoute: RouteState, nextRoute: RouteState) => void | Promise<any | void>;
|
|
3
3
|
export declare function useRouteTransition(func: TransitionFunction): void;
|
|
4
4
|
export {};
|
|
5
|
+
//# sourceMappingURL=useRouteTransition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRouteTransition.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useRouteTransition.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,KAAK,kBAAkB,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;AAEzG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,QAe1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRouter.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useRouter.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,wBAAgB,SAAS,CAAC,CAAC,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,CAO1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRouterEvents.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useRouterEvents.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,wBAAgB,eAAe,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,QAWpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRouterState.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useRouterState.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,wBAAgB,cAAc,CAAC,CAAC,GAAG,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,CAAC,GAAG,CAAC,CAI7F"}
|
|
@@ -1,10 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search param API object.
|
|
3
|
+
*/
|
|
1
4
|
export type SearchParamAPI<T> = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Set an individual parameter value by key.
|
|
7
|
+
*
|
|
8
|
+
* If the value is an array, then one or more `key[]` parameters will be set. Otherwise, a single `key` parameter will be set.
|
|
9
|
+
*
|
|
10
|
+
* If the value is `null` or `undefined`, the parameter will be removed from the query string.
|
|
11
|
+
*
|
|
12
|
+
* @param key The search parameter name
|
|
13
|
+
* @param value The value to set
|
|
14
|
+
*/
|
|
15
|
+
set<K extends keyof T>(key: K, value: T[K] | null | undefined): void;
|
|
16
|
+
/**
|
|
17
|
+
* Set all parameters at once, replacing the entire query string. Any parameters not present will be replaced with their default value. Passing an empty object is equivalent to calling `reset()`.
|
|
18
|
+
*
|
|
19
|
+
* @param value
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
setAll: (value: Partial<T>) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a memoized setter function for a specific key.
|
|
25
|
+
*
|
|
26
|
+
* This is useful when you want to pass a setter function to a child component, without needing to pass the entire API object.
|
|
27
|
+
*
|
|
28
|
+
* For example:
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <SearchInput value={params.q} onSearch={api.setter("q")} />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param key The search parameter name
|
|
34
|
+
* @returns (value: T) => void
|
|
35
|
+
*/
|
|
36
|
+
setter<K extends keyof T>(key: K): (value: T[K] | null | undefined) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Reset all parameters to their default values.
|
|
39
|
+
*/
|
|
5
40
|
reset(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the current value of a parameter. In most cases, you should use the `params` object returned from `useSearchParams` instead of this method.
|
|
43
|
+
*/
|
|
6
44
|
get<K extends keyof T>(key: K): T[K];
|
|
7
45
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Provides type-safe read/write access to query string parameters, integrating with the routing system.
|
|
48
|
+
*
|
|
49
|
+
* - Call `useSearchParams` with a default value object, which defines the expected shape of the query string parameters.
|
|
50
|
+
* - Only keys that are present in the default value object will be handled, and all others will be ignored.
|
|
51
|
+
* - Arrays of values are supported, and you should use a default value of `[]` for that key. You may want to cast the default parameter as an array of the expected type (eg. `myValue: [] as string[]`) to ensure that the parameter type is correct.
|
|
52
|
+
* - This hook returns a tuple with the current query string parameters object, and an API object with methods to interact with the query string. See {@link SearchParamAPI} for more details.
|
|
53
|
+
*
|
|
54
|
+
* For example:
|
|
55
|
+
* ```tsx
|
|
56
|
+
* const [params, api] = useSearchParams({
|
|
57
|
+
* mode: "list" as "list" | "grid",
|
|
58
|
+
* page: 1,
|
|
59
|
+
* tags: [] as string[],
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* api.set("mode", "grid")
|
|
63
|
+
* api.set("tags", ["tag1", "tag2"])
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* Note that if a parameter is set back to it's default value, it'll actually be _removed_ from the updated query string, keeping the URL clean when only the default values are set.
|
|
67
|
+
*
|
|
68
|
+
* ```tsx
|
|
69
|
+
* api.set("mode", "grid")
|
|
70
|
+
* // url becomes: "/?mode=grid"
|
|
71
|
+
* // params.mode === 'grid'
|
|
72
|
+
*
|
|
73
|
+
* api.set("mode", "list")
|
|
74
|
+
* // url becomes: "/"
|
|
75
|
+
* // params.mode === 'list'
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @param defaultValue - The default value object, defining the expected shape of the query string parameters.
|
|
79
|
+
* @returns A tuple of the resolve parameter object, and a {@link SearchParamAPI} object with methods to interact with the query string.
|
|
80
|
+
*/
|
|
81
|
+
export declare function useSearchParams<T extends object>(defaultValue: T): [T, SearchParamAPI<T>];
|
|
82
|
+
//# sourceMappingURL=useSearchParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchParams.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/routing/hooks/useSearchParams.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B;;;;;;;;;OASG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;IACpE;;;;;OAKG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;IACnC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IAC3E;;OAEG;IACH,KAAK,IAAI,IAAI,CAAA;IACb;;OAEG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;CACrC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CA2DzF"}
|
|
@@ -1,30 +1,90 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
1
|
+
import { useMemo, useRef, useState } from "react";
|
|
2
2
|
import { useRoute } from "./useRoute.js";
|
|
3
3
|
import { useRouter } from "./useRouter.js";
|
|
4
|
+
import { parseQuery } from "../utils.js";
|
|
5
|
+
import { hash } from "object-code";
|
|
6
|
+
/**
|
|
7
|
+
* Provides type-safe read/write access to query string parameters, integrating with the routing system.
|
|
8
|
+
*
|
|
9
|
+
* - Call `useSearchParams` with a default value object, which defines the expected shape of the query string parameters.
|
|
10
|
+
* - Only keys that are present in the default value object will be handled, and all others will be ignored.
|
|
11
|
+
* - Arrays of values are supported, and you should use a default value of `[]` for that key. You may want to cast the default parameter as an array of the expected type (eg. `myValue: [] as string[]`) to ensure that the parameter type is correct.
|
|
12
|
+
* - This hook returns a tuple with the current query string parameters object, and an API object with methods to interact with the query string. See {@link SearchParamAPI} for more details.
|
|
13
|
+
*
|
|
14
|
+
* For example:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const [params, api] = useSearchParams({
|
|
17
|
+
* mode: "list" as "list" | "grid",
|
|
18
|
+
* page: 1,
|
|
19
|
+
* tags: [] as string[],
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* api.set("mode", "grid")
|
|
23
|
+
* api.set("tags", ["tag1", "tag2"])
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Note that if a parameter is set back to it's default value, it'll actually be _removed_ from the updated query string, keeping the URL clean when only the default values are set.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* api.set("mode", "grid")
|
|
30
|
+
* // url becomes: "/?mode=grid"
|
|
31
|
+
* // params.mode === 'grid'
|
|
32
|
+
*
|
|
33
|
+
* api.set("mode", "list")
|
|
34
|
+
* // url becomes: "/"
|
|
35
|
+
* // params.mode === 'list'
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param defaultValue - The default value object, defining the expected shape of the query string parameters.
|
|
39
|
+
* @returns A tuple of the resolve parameter object, and a {@link SearchParamAPI} object with methods to interact with the query string.
|
|
40
|
+
*/
|
|
4
41
|
export function useSearchParams(defaultValue) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
42
|
+
const [currentQuery, replaceQuery] = env.admin
|
|
43
|
+
? useState({})
|
|
44
|
+
: [useRoute().query, useRouter((r) => r.replaceQuery)];
|
|
45
|
+
const merged = useMemo(() => ({
|
|
8
46
|
...defaultValue,
|
|
9
|
-
...
|
|
10
|
-
}), [
|
|
47
|
+
...currentQuery,
|
|
48
|
+
}), [currentQuery]);
|
|
49
|
+
const values = useRef(merged);
|
|
50
|
+
values.current = merged;
|
|
51
|
+
// Memoized setters
|
|
52
|
+
const setters = useMemo(() => ({}), []);
|
|
53
|
+
// Gets the current value, directly from the source.
|
|
54
|
+
function get() {
|
|
55
|
+
if (env.client) {
|
|
56
|
+
return { ...defaultValue, ...parseQuery(document.location.search) };
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return merged;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Main update function
|
|
11
63
|
const update = (patch) => {
|
|
12
|
-
const value = { ...
|
|
64
|
+
const value = { ...get(), ...patch };
|
|
13
65
|
for (let key in defaultValue) {
|
|
14
|
-
if (defaultValue[key] === value[key] || [null, undefined].includes(value[key])) {
|
|
66
|
+
if (hash(defaultValue[key]) === hash(value[key]) || [null, undefined].includes(value[key])) {
|
|
15
67
|
delete value[key];
|
|
16
68
|
}
|
|
17
69
|
}
|
|
70
|
+
values.current = value;
|
|
18
71
|
replaceQuery(value);
|
|
19
72
|
};
|
|
20
73
|
return [
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
set: (key, value) => update({
|
|
24
|
-
setAll: (value) => update(
|
|
25
|
-
|
|
74
|
+
values.current,
|
|
75
|
+
useMemo(() => ({
|
|
76
|
+
set: (key, value) => update({ [key]: value }),
|
|
77
|
+
setAll: (value) => update({
|
|
78
|
+
...defaultValue,
|
|
79
|
+
...value,
|
|
80
|
+
}),
|
|
81
|
+
setter: (key) => {
|
|
82
|
+
if (!setters[key])
|
|
83
|
+
setters[key] = (value) => update({ [key]: value });
|
|
84
|
+
return setters[key];
|
|
85
|
+
},
|
|
26
86
|
reset: () => update({}),
|
|
27
|
-
get: (key) =>
|
|
28
|
-
},
|
|
87
|
+
get: (key) => values.current[key],
|
|
88
|
+
}), []),
|
|
29
89
|
];
|
|
30
90
|
}
|
|
@@ -3,11 +3,15 @@ export * from "./components/Link.js";
|
|
|
3
3
|
export * from "./components/ScrollRestoration.js";
|
|
4
4
|
export * from "./components/RouteRenderer.js";
|
|
5
5
|
export * from "./components/ClientOnly.js";
|
|
6
|
+
export * from "./components/BackButton.js";
|
|
7
|
+
export * from "./components/NativeLinkHandler.js";
|
|
6
8
|
export * from "./hooks/useRoute.js";
|
|
7
9
|
export * from "./hooks/useRouteTransition.js";
|
|
8
10
|
export * from "./hooks/useRouter.js";
|
|
9
11
|
export * from "./hooks/useRouterEvents.js";
|
|
10
12
|
export * from "./hooks/useRouterState.js";
|
|
11
13
|
export * from "./hooks/useRestorableState.js";
|
|
12
|
-
export * from "./hooks/
|
|
14
|
+
export * from "./hooks/useHydrating.js";
|
|
13
15
|
export * from "./hooks/useSearchParams.js";
|
|
16
|
+
export { getLinkHandlerMode, isSameOrigin } from "./utils.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/routing/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAE1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,mCAAmC,CAAA;AACjD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mCAAmC,CAAA;AAEjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -3,11 +3,14 @@ export * from "./components/Link.js";
|
|
|
3
3
|
export * from "./components/ScrollRestoration.js";
|
|
4
4
|
export * from "./components/RouteRenderer.js";
|
|
5
5
|
export * from "./components/ClientOnly.js";
|
|
6
|
+
export * from "./components/BackButton.js";
|
|
7
|
+
export * from "./components/NativeLinkHandler.js";
|
|
6
8
|
export * from "./hooks/useRoute.js";
|
|
7
9
|
export * from "./hooks/useRouteTransition.js";
|
|
8
10
|
export * from "./hooks/useRouter.js";
|
|
9
11
|
export * from "./hooks/useRouterEvents.js";
|
|
10
12
|
export * from "./hooks/useRouterState.js";
|
|
11
13
|
export * from "./hooks/useRestorableState.js";
|
|
12
|
-
export * from "./hooks/
|
|
14
|
+
export * from "./hooks/useHydrating.js";
|
|
13
15
|
export * from "./hooks/useSearchParams.js";
|
|
16
|
+
export { getLinkHandlerMode, isSameOrigin } from "./utils.js";
|
|
@@ -28,3 +28,4 @@ export declare class RouteLoader {
|
|
|
28
28
|
getRouteComponent<K extends keyof ViewProps>(view: K): DynamicComponent<FunctionComponent<ViewProps[K]>>;
|
|
29
29
|
get appComponent(): DynamicComponent<FunctionComponent<PropsWithChildren<AppData>>>;
|
|
30
30
|
}
|
|
31
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/routing/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAA;IACf,SAAS,EAAE,iBAAiB,CAAA;CAC7B,CAAA;AAED,qBAAa,UAAW,SAAQ,KAAK;IAE1B,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;gBADlB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM;CAI5B;AAED,qBAAa,WAAW;IACtB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAY;IACpD,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAY;IAC1D,OAAO,EAAE,OAAO,CAAQ;IACxB,OAAO,CAAC,SAAS,CAAgD;IACjE,OAAO,CAAC,YAAY,CAA2C;IAE/D,EAAE,SAAgB;IAElB,YAAY,CAAC,IAAI,EAAE,OAAO,KAAK;IAI/B,oBAAoB,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM;IAI5D,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,WAAW;IAyBnB,YAAY,CAAC,QAAQ,EAAE,MAAM;IAKvB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAiD9E,UAAU,CAAC,OAAO,EAAE,OAAO;IAI3B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;IAKnD,iBAAiB,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,IAAI,EAAE,CAAC,GACT,gBAAgB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAG5F,IAAI,YAAY,IAC6B,gBAAgB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAC3G;CACF"}
|
|
@@ -56,6 +56,7 @@ export class RouteLoader {
|
|
|
56
56
|
return this.entries.has(cacheKey);
|
|
57
57
|
}
|
|
58
58
|
async loadRouteData(pathname, withAppData = false) {
|
|
59
|
+
pathname = withTrailingSlash(pathname);
|
|
59
60
|
const cacheKey = this.getKey(pathname);
|
|
60
61
|
// Cached value?
|
|
61
62
|
if (this.entries.has(cacheKey))
|
|
@@ -65,27 +66,35 @@ export class RouteLoader {
|
|
|
65
66
|
serverless: env.serverless,
|
|
66
67
|
debug: env.dev,
|
|
67
68
|
});
|
|
68
|
-
const promise = this.fetchImpl(requestUrl
|
|
69
|
-
.then((response) =>
|
|
70
|
-
.
|
|
69
|
+
const promise = this.fetchImpl(requestUrl)
|
|
70
|
+
.then(async (response) => {
|
|
71
|
+
if (response.redirected) {
|
|
72
|
+
return { redirect: response.url };
|
|
73
|
+
}
|
|
74
|
+
let text = await response.text();
|
|
71
75
|
if (this.processProps) {
|
|
72
76
|
text = this.processProps(text);
|
|
73
77
|
}
|
|
74
78
|
try {
|
|
75
|
-
|
|
79
|
+
const payload = JSON.parse(text);
|
|
80
|
+
if (!payload.view && !payload.redirect) {
|
|
81
|
+
throw new RouteError(`Invalid route data for '${pathname}'`, 500);
|
|
82
|
+
}
|
|
83
|
+
return payload;
|
|
76
84
|
}
|
|
77
85
|
catch (err) {
|
|
78
86
|
throw new RouteError(`JSON parse error for route '${pathname}':\n${err?.message}`, 500);
|
|
79
87
|
}
|
|
80
88
|
})
|
|
81
|
-
.then((data) => {
|
|
89
|
+
.then(async (data) => {
|
|
82
90
|
if (data.redirect) {
|
|
83
|
-
const redirect = data.redirect;
|
|
84
|
-
data = this.loadRouteData(redirect)
|
|
85
|
-
|
|
86
|
-
return data;
|
|
87
|
-
});
|
|
91
|
+
const redirect = parseURL(data.redirect).pathname;
|
|
92
|
+
data = await this.loadRouteData(redirect);
|
|
93
|
+
data.canonical = redirect;
|
|
88
94
|
}
|
|
95
|
+
return data;
|
|
96
|
+
})
|
|
97
|
+
.then((data) => {
|
|
89
98
|
this.entries.set(cacheKey, new Promise((resolve) => resolve(data)));
|
|
90
99
|
return data;
|
|
91
100
|
});
|