@absolutejs/absolute 0.19.0-beta.999 → 0.20.0-beta.1
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/LICENSE +21 -13
- package/README.md +48 -2
- package/dist/angular/browser.js +82 -77
- package/dist/angular/browser.js.map +11 -11
- package/dist/angular/components/constants.js +43 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/hmrPreserveCore.ts +132 -134
- package/dist/angular/index.js +1719 -844
- package/dist/angular/index.js.map +34 -26
- package/dist/angular/server.js +1620 -768
- package/dist/angular/server.js.map +28 -20
- package/dist/build.js +4935 -2593
- package/dist/build.js.map +72 -57
- package/dist/cli/config/client.js +578 -0
- package/dist/cli/config/server.js +39587 -0
- package/dist/cli/htmx/htmx.min.js +1 -0
- package/dist/cli/index.js +16828 -3511
- package/dist/client/index.js +49 -46
- package/dist/client/index.js.map +12 -12
- package/dist/core/streamingSlotRegistrar.js +1 -19
- package/dist/core/streamingSlotRegistrar.js.map +2 -2
- package/dist/core/streamingSlotRegistry.js +1 -19
- package/dist/core/streamingSlotRegistry.js.map +2 -2
- package/dist/dev/client/cssUtils.ts +98 -41
- package/dist/dev/client/domState.ts +2 -0
- package/dist/dev/client/errorOverlay.ts +14 -13
- package/dist/dev/client/handlers/angularHmrShim.ts +20 -20
- package/dist/dev/client/handlers/angularRemount.ts +74 -55
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -2
- package/dist/dev/client/handlers/html.ts +144 -41
- package/dist/dev/client/handlers/htmx.ts +43 -8
- package/dist/dev/client/handlers/react.ts +114 -32
- package/dist/dev/client/handlers/rebuild.ts +28 -8
- package/dist/dev/client/handlers/svelte.ts +92 -51
- package/dist/dev/client/handlers/vue.ts +36 -45
- package/dist/dev/client/hmrClient.ts +101 -26
- package/dist/dev/client/hmrTiming.ts +141 -0
- package/dist/dev/client/hmrToast.ts +22 -24
- package/dist/dev/client/reactRefreshSetup.ts +4 -0
- package/dist/dev/client/vendor/reactRefreshRuntime.d.ts +12 -0
- package/dist/dev/client/vendor/reactRefreshRuntime.js +313 -0
- package/dist/dev/serverBootstrap.js +45 -0
- package/dist/index.js +7153 -3224
- package/dist/index.js.map +118 -86
- package/dist/islands/browser.js +1 -19
- package/dist/islands/browser.js.map +3 -3
- package/dist/islands/index.js +709 -120
- package/dist/islands/index.js.map +18 -13
- package/dist/mobile/browser.js +428 -0
- package/dist/mobile/browser.js.map +12 -0
- package/dist/mobile/index.js +3058 -0
- package/dist/mobile/index.js.map +35 -0
- package/dist/react/browser.js +13 -62
- package/dist/react/browser.js.map +5 -6
- package/dist/react/components/browser/index.js +23 -13
- package/dist/react/components/index.js +30 -34
- package/dist/react/components/index.js.map +8 -7
- package/dist/react/hooks/index.js +1 -19
- package/dist/react/hooks/index.js.map +3 -3
- package/dist/react/index.js +1643 -679
- package/dist/react/index.js.map +29 -20
- package/dist/react/jsxDevRuntimeCompat.js +22 -20
- package/dist/react/jsxDevRuntimeCompat.js.map +5 -4
- package/dist/react/jsxRuntimeCompat.js +90 -0
- package/dist/react/jsxRuntimeCompat.js.map +10 -0
- package/dist/react/router/browser.js +77 -0
- package/dist/react/router/browser.js.map +10 -0
- package/dist/react/router/index.js +77 -0
- package/dist/react/router/index.js.map +10 -0
- package/dist/react/server.js +950 -565
- package/dist/react/server.js.map +16 -11
- package/dist/src/angular/components/constants.d.ts +21 -0
- package/dist/src/angular/hmrPreserveCore.d.ts +7 -20
- package/dist/src/angular/islands.d.ts +1 -1
- package/dist/src/angular/pageHandler.d.ts +2 -0
- package/dist/src/angular/ssrRender.d.ts +4 -1
- package/dist/src/build/bunStringRawUnicodePlugin.d.ts +12 -0
- package/dist/src/build/chainInlineSourcemaps.d.ts +1 -0
- package/dist/src/build/compileAngular.d.ts +5 -7
- package/dist/src/build/compileSvelte.d.ts +3 -0
- package/dist/src/build/compileVue.d.ts +3 -1
- package/dist/src/build/generateReactIndexes.d.ts +1 -0
- package/dist/src/build/islandRegistryTransform.d.ts +17 -0
- package/dist/src/build/maskLiterals.d.ts +28 -0
- package/dist/src/build/parseVueSpaRoutes.d.ts +5 -0
- package/dist/src/build/resolveBuildMode.d.ts +7 -0
- package/dist/src/build/serverExternals.d.ts +14 -0
- package/dist/src/build/spaSideManifests.d.ts +16 -0
- package/dist/src/build/tailwindCompiler.d.ts +0 -1
- package/dist/src/cli/add/dependencies.d.ts +13 -0
- package/dist/src/cli/config/absolute/AbsoluteConfigPanel.d.ts +6 -0
- package/dist/src/cli/config/absolute/editAbsoluteConfig.d.ts +5 -0
- package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +19 -0
- package/dist/src/cli/config/auth/AuthPanel.d.ts +6 -0
- package/dist/src/cli/config/auth/authCatalog.d.ts +10 -0
- package/dist/src/cli/config/auth/authScaffolds.d.ts +16 -0
- package/dist/src/cli/config/auth/editAuthConfig.d.ts +5 -0
- package/dist/src/cli/config/auth/resolveAuthSettings.d.ts +14 -0
- package/dist/src/cli/config/auth/resolveAuthState.d.ts +2 -0
- package/dist/src/cli/config/auth/scaffoldAuthFeature.d.ts +6 -0
- package/dist/src/cli/config/client.d.ts +1 -0
- package/dist/src/cli/config/configCert.d.ts +12 -0
- package/dist/src/cli/config/eslint/EslintPanel.d.ts +6 -0
- package/dist/src/cli/config/eslint/configAst.d.ts +18 -0
- package/dist/src/cli/config/eslint/editConfigRule.d.ts +6 -0
- package/dist/src/cli/config/eslint/eslintStyles.d.ts +1 -0
- package/dist/src/cli/config/eslint/resolveConfig.d.ts +3 -0
- package/dist/src/cli/config/eslint/serializeValue.d.ts +9 -0
- package/dist/src/cli/config/guards.d.ts +4 -0
- package/dist/src/cli/config/integrations/IntegrationsPanel.d.ts +6 -0
- package/dist/src/cli/config/packageJson/PackageJsonPanel.d.ts +6 -0
- package/dist/src/cli/config/packageJson/editPackageJson.d.ts +9 -0
- package/dist/src/cli/config/packageJson/resolvePackageJson.d.ts +8 -0
- package/dist/src/cli/config/page/ConfigShell.d.ts +6 -0
- package/dist/src/cli/config/page/FieldEditor.d.ts +9 -0
- package/dist/src/cli/config/page/PanelHost.d.ts +6 -0
- package/dist/src/cli/config/page/configStyles.d.ts +1 -0
- package/dist/src/cli/config/panels.d.ts +7 -0
- package/dist/src/cli/config/prettier/PrettierPanel.d.ts +6 -0
- package/dist/src/cli/config/prettier/editPrettier.d.ts +5 -0
- package/dist/src/cli/config/prettier/resolvePrettier.d.ts +11 -0
- package/dist/src/cli/config/schema/fromJsonSchema.d.ts +3 -0
- package/dist/src/cli/config/schema/fromType.d.ts +1 -0
- package/dist/src/cli/config/schema/serialize.d.ts +1 -0
- package/dist/src/cli/config/server.d.ts +527 -0
- package/dist/src/cli/config/tsconfig/TsconfigPanel.d.ts +6 -0
- package/dist/src/cli/config/tsconfig/editTsconfig.d.ts +5 -0
- package/dist/src/cli/config/tsconfig/resolveTsconfig.d.ts +8 -0
- package/dist/src/cli/config/tsconfig/tsconfigStyles.d.ts +1 -0
- package/dist/src/cli/discoverInstances.d.ts +5 -0
- package/dist/src/cli/elysiaOpenApiTypeboxPlugin.d.ts +8 -0
- package/dist/src/cli/generate/componentTemplates.d.ts +7 -0
- package/dist/src/cli/generate/context.d.ts +30 -0
- package/dist/src/cli/generate/cssStrategy.d.ts +20 -0
- package/dist/src/cli/generate/frameworkKey.d.ts +3 -0
- package/dist/src/cli/generate/frameworks.d.ts +40 -0
- package/dist/src/cli/generate/generateApi.d.ts +3 -0
- package/dist/src/cli/generate/generateComponent.d.ts +4 -0
- package/dist/src/cli/generate/generatePage.d.ts +4 -0
- package/dist/src/cli/generate/naming.d.ts +5 -0
- package/dist/src/cli/generate/navData.d.ts +10 -0
- package/dist/src/cli/generate/outcome.d.ts +17 -0
- package/dist/src/cli/generate/pageTemplates.d.ts +11 -0
- package/dist/src/cli/generate/routeWiring.d.ts +40 -0
- package/dist/src/cli/generate/staticNav.d.ts +5 -0
- package/dist/src/cli/heapDiff.d.ts +1 -0
- package/dist/src/cli/htmx/install.d.ts +6 -0
- package/dist/src/cli/inspectData.d.ts +12 -0
- package/dist/src/cli/inspectTui.d.ts +1 -0
- package/dist/src/cli/instanceStatus.d.ts +22 -0
- package/dist/src/cli/integrations/addPlugin.d.ts +8 -0
- package/dist/src/cli/integrations/catalog.d.ts +20 -0
- package/dist/src/cli/psTui.d.ts +1 -0
- package/dist/src/cli/scripts/add.d.ts +1 -0
- package/dist/src/cli/scripts/analyze.d.ts +1 -0
- package/dist/src/cli/scripts/api.d.ts +1 -0
- package/dist/src/cli/scripts/build.d.ts +1 -1
- package/dist/src/cli/scripts/db.d.ts +20 -0
- package/dist/src/cli/scripts/dev.d.ts +5 -1
- package/dist/src/cli/scripts/doctor.d.ts +1 -0
- package/dist/src/cli/scripts/env.d.ts +7 -0
- package/dist/src/cli/scripts/eslint.d.ts +37 -2
- package/dist/src/cli/scripts/eslintChunked.d.ts +37 -0
- package/dist/src/cli/scripts/generate.d.ts +1 -0
- package/dist/src/cli/scripts/htmx.d.ts +1 -0
- package/dist/src/cli/scripts/inspect.d.ts +1 -0
- package/dist/src/cli/scripts/islands.d.ts +1 -0
- package/dist/src/cli/scripts/lintProof.d.ts +42 -0
- package/dist/src/cli/scripts/logs.d.ts +1 -0
- package/dist/src/cli/scripts/ls.d.ts +1 -0
- package/dist/src/cli/scripts/mem.d.ts +1 -0
- package/dist/src/cli/scripts/mobile.d.ts +1 -0
- package/dist/src/cli/scripts/prettier.d.ts +2 -0
- package/dist/src/cli/scripts/ps.d.ts +1 -0
- package/dist/src/cli/scripts/remove.d.ts +1 -0
- package/dist/src/cli/scripts/routes.d.ts +1 -0
- package/dist/src/cli/scripts/start.d.ts +6 -1
- package/dist/src/cli/scripts/tunnelRelay.d.ts +9 -0
- package/dist/src/cli/scripts/workspace.d.ts +3 -1
- package/dist/src/cli/serverBundleExternals.d.ts +2 -0
- package/dist/src/cli/tuiPrimitives.d.ts +14 -0
- package/dist/src/cli/typeGraphCoherence.d.ts +32 -0
- package/dist/src/cli/utils.d.ts +3 -1
- package/dist/src/cli/workspaceTui.d.ts +2 -1
- package/dist/src/client/hydrators/react.d.ts +1 -1
- package/dist/src/client/hydrators/svelte.d.ts +1 -1
- package/dist/src/client/hydrators/vue.d.ts +1 -1
- package/dist/src/client/islandStore.d.ts +3 -3
- package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
- package/dist/src/constants.d.ts +21 -0
- package/dist/src/core/angularServerModule.d.ts +1 -0
- package/dist/src/core/build.d.ts +11 -3
- package/dist/src/core/devRouteRegistrationCallsite.d.ts +1 -5
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/core/pageResponseCache.d.ts +23 -0
- package/dist/src/core/prepare.d.ts +192 -154
- package/dist/src/core/requestContext.d.ts +18 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +5 -3
- package/dist/src/dev/angular/hmrCompiler.d.ts +1 -1
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +1 -1
- package/dist/src/dev/clientManager.d.ts +10 -1
- package/dist/src/dev/configResolver.d.ts +2 -0
- package/dist/src/dev/moduleMapper.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -1
- package/dist/src/dev/pathUtils.d.ts +1 -1
- package/dist/src/dev/reactComponentClassifier.d.ts +1 -1
- package/dist/src/dev/rebuildTrigger.d.ts +4 -0
- package/dist/src/dev/requestInspector.d.ts +31 -0
- package/dist/src/dev/serverBootstrap.d.ts +1 -0
- package/dist/src/dev/serverEntryWatcher.d.ts +3 -3
- package/dist/src/dev/tunnel/client.d.ts +20 -0
- package/dist/src/dev/tunnel/protocol.d.ts +85 -0
- package/dist/src/dev/tunnel/relay.d.ts +28 -0
- package/dist/src/dev/webSocket.d.ts +1 -1
- package/dist/src/mobile/androidConformance.d.ts +42 -0
- package/dist/src/mobile/androidEmulatorController.d.ts +99 -0
- package/dist/src/mobile/androidNativeWatcher.d.ts +19 -0
- package/dist/src/mobile/androidRelease.d.ts +47 -0
- package/dist/src/mobile/androidWebView.d.ts +46 -0
- package/dist/src/mobile/artifactStore.d.ts +47 -0
- package/dist/src/mobile/associationFiles.d.ts +49 -0
- package/dist/src/mobile/browser.d.ts +2 -0
- package/dist/src/mobile/buildMetadata.d.ts +10 -0
- package/dist/src/mobile/buildPipeline.d.ts +8 -0
- package/dist/src/mobile/buildRelease.d.ts +24 -0
- package/dist/src/mobile/capacitorBundle.d.ts +28 -0
- package/dist/src/mobile/capacitorProject.d.ts +9 -0
- package/dist/src/mobile/client.d.ts +35 -0
- package/dist/src/mobile/compatibilityDispatcher.d.ts +26 -0
- package/dist/src/mobile/config.d.ts +16 -0
- package/dist/src/mobile/emulatorDoctor.d.ts +25 -0
- package/dist/src/mobile/emulatorInstaller.d.ts +41 -0
- package/dist/src/mobile/index.d.ts +19 -0
- package/dist/src/mobile/materializedBundle.d.ts +36 -0
- package/dist/src/mobile/nativeDeepLinks.d.ts +5 -0
- package/dist/src/mobile/pageProtocol.d.ts +89 -0
- package/dist/src/mobile/producerContext.d.ts +4 -0
- package/dist/src/mobile/producerContextState.d.ts +10 -0
- package/dist/src/mobile/releaseArtifact.d.ts +75 -0
- package/dist/src/mobile/releaseDoctor.d.ts +13 -0
- package/dist/src/mobile/routeMatcher.d.ts +3 -0
- package/dist/src/mobile/routeMetadataTransform.d.ts +13 -0
- package/dist/src/mobile/shellBootstrap.d.ts +1 -0
- package/dist/src/mobile/transport.d.ts +31 -0
- package/dist/src/plugins/devtoolsJson.d.ts +6 -47
- package/dist/src/plugins/hmr.d.ts +22 -96
- package/dist/src/plugins/imageOptimizer.d.ts +150 -62
- package/dist/src/plugins/networking.d.ts +2 -2
- package/dist/src/plugins/openApiPlugin.d.ts +4 -0
- package/dist/src/plugins/telemetryPlugin.d.ts +36 -0
- package/dist/src/react/browser.d.ts +0 -2
- package/dist/src/react/hooks/useMediaQuery.d.ts +1 -1
- package/dist/src/react/index.d.ts +0 -2
- package/dist/src/react/jsxDevRuntimeCompat.d.ts +1 -1
- package/dist/src/react/jsxRuntimeCompat.d.ts +7 -0
- package/dist/src/react/pageHandler.d.ts +8 -0
- package/dist/src/react/router/UniversalRouter.d.ts +43 -0
- package/dist/src/react/router/browser.d.ts +2 -0
- package/dist/src/react/router/index.d.ts +2 -0
- package/dist/src/svelte/pageHandler.d.ts +5 -0
- package/dist/src/svelte/router/hashMode.d.ts +1 -6
- package/dist/src/svelte/router/matchPath.d.ts +4 -24
- package/dist/src/svelte/router/page.svelte.d.ts +1 -10
- package/dist/src/svelte/router/prefetchCache.d.ts +2 -6
- package/dist/src/utils/cleanup.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +2 -2
- package/dist/src/utils/defineEnv.d.ts +4 -4
- package/dist/src/utils/formatBytes.d.ts +2 -0
- package/dist/src/utils/generatedDir.d.ts +1 -1
- package/dist/src/utils/iconVersion.d.ts +5 -0
- package/dist/src/utils/imageProcessing.d.ts +1 -1
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/inlinePageCss.d.ts +9 -0
- package/dist/src/utils/instanceRegistry.d.ts +13 -0
- package/dist/src/utils/isTestSourcePath.d.ts +1 -0
- package/dist/src/utils/jsonLd.d.ts +1 -1
- package/dist/src/utils/loadConfig.d.ts +11 -3
- package/dist/src/utils/logger.d.ts +2 -0
- package/dist/src/utils/portScan.d.ts +22 -0
- package/dist/src/utils/projectRoot.d.ts +17 -0
- package/dist/src/utils/resolveConvention.d.ts +1 -1
- package/dist/src/utils/resolveDevPort.d.ts +4 -1
- package/dist/src/utils/runtimeMode.d.ts +1 -1
- package/dist/src/utils/spaRouteCss.d.ts +10 -0
- package/dist/src/utils/spaRouteManifest.d.ts +8 -0
- package/dist/src/utils/stripStringsAndComments.d.ts +18 -0
- package/dist/src/utils/userAgentFunctions.d.ts +1 -1
- package/dist/src/utils/vueCompiler.d.ts +1 -0
- package/dist/src/vue/components/Image.d.ts +2 -2
- package/dist/src/vue/defineVuePage.d.ts +1 -11
- package/dist/src/vue/index.d.ts +3 -0
- package/dist/src/vue/pageHandler.d.ts +5 -0
- package/dist/src/vue/resolveGeneratedVueModulePath.d.ts +1 -0
- package/dist/src/vue/teleports.d.ts +2 -0
- package/dist/src/vue/useResource.d.ts +65 -0
- package/dist/svelte/browser.js +1 -19
- package/dist/svelte/browser.js.map +3 -3
- package/dist/svelte/components/Head.svelte +7 -1
- package/dist/svelte/index.js +1281 -543
- package/dist/svelte/index.js.map +27 -19
- package/dist/svelte/router/Link.svelte.d.ts +3 -3
- package/dist/svelte/router/Route.svelte.d.ts +5 -5
- package/dist/svelte/router/Router.svelte.d.ts +3 -3
- package/dist/svelte/router/hashMode.ts +6 -12
- package/dist/svelte/router/matchPath.ts +44 -61
- package/dist/svelte/router/page.d.ts +1 -10
- package/dist/svelte/router/page.js +6 -6
- package/dist/svelte/router/prefetchCache.ts +21 -23
- package/dist/svelte/router/viewTransitions.ts +22 -12
- package/dist/svelte/server.js +697 -565
- package/dist/svelte/server.js.map +14 -11
- package/dist/types/absoluteConfig.d.ts +22 -0
- package/dist/types/angular.d.ts +4 -1
- package/dist/types/authPanel.d.ts +62 -0
- package/dist/types/build.d.ts +116 -0
- package/dist/types/cli.d.ts +57 -0
- package/dist/types/config.d.ts +52 -0
- package/dist/types/eslintConfig.d.ts +68 -0
- package/dist/types/globals.d.ts +31 -10
- package/dist/types/image.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/integrationsPanel.d.ts +29 -0
- package/dist/types/messages.d.ts +12 -0
- package/dist/types/packageJson.d.ts +74 -0
- package/dist/types/packageJsonPanel.d.ts +29 -0
- package/dist/types/prettier.d.ts +26 -0
- package/dist/types/tsconfig.d.ts +31 -0
- package/dist/types/vue.d.ts +13 -15
- package/dist/vue/browser.js +14 -36
- package/dist/vue/browser.js.map +5 -5
- package/dist/vue/components/Image.js +3 -20
- package/dist/vue/components/Image.js.map +3 -3
- package/dist/vue/components/index.js +3 -20
- package/dist/vue/components/index.js.map +3 -3
- package/dist/vue/index.js +1573 -620
- package/dist/vue/index.js.map +34 -22
- package/dist/vue/server.js +800 -520
- package/dist/vue/server.js.map +17 -11
- package/package.json +145 -68
- package/dist/src/react/UniversalRouter.d.ts +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { SvelteComponent, type Snippet } from 'svelte';
|
|
2
2
|
import type { LinkPrefetchMode } from '../../types/svelteRouter';
|
|
3
3
|
|
|
4
4
|
type LinkProps = {
|
|
@@ -16,6 +16,6 @@ type LinkProps = {
|
|
|
16
16
|
declare const __propDef: { props: LinkProps };
|
|
17
17
|
type Props = typeof __propDef.props;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
class Link extends SvelteComponent<Props> {}
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export { Link as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { SvelteComponent, type Snippet } from 'svelte';
|
|
2
2
|
import type { ExtractRouteParams } from '../../types/svelteRouter';
|
|
3
3
|
|
|
4
4
|
type RouteProps<Path extends string> = {
|
|
@@ -6,8 +6,8 @@ type RouteProps<Path extends string> = {
|
|
|
6
6
|
content: Snippet<[ExtractRouteParams<Path>]>;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
class Route<Path extends string = string> extends SvelteComponent<
|
|
10
|
+
RouteProps<Path>
|
|
11
|
+
> {}
|
|
10
12
|
|
|
11
|
-
export default
|
|
12
|
-
Path extends string = string
|
|
13
|
-
> extends SvelteComponent<RouteProps<Path>> {}
|
|
13
|
+
export { Route as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { SvelteComponent, type Snippet } from 'svelte';
|
|
2
2
|
import type { RouterMode } from '../../types/svelteRouter';
|
|
3
3
|
|
|
4
4
|
type RouterProps = {
|
|
@@ -11,6 +11,6 @@ type RouterProps = {
|
|
|
11
11
|
declare const __propDef: { props: RouterProps };
|
|
12
12
|
type Props = typeof __propDef.props;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
class Router extends SvelteComponent<Props> {}
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export { Router as default };
|
|
@@ -13,8 +13,13 @@
|
|
|
13
13
|
* Returns the part after `#/`, prefixed with `/` so it parses as a
|
|
14
14
|
* normal pathname.
|
|
15
15
|
*/
|
|
16
|
+
export const buildHashHref = (pathname: string) => {
|
|
17
|
+
const trimmed = pathname.replace(/^\/+/, '');
|
|
18
|
+
|
|
19
|
+
return trimmed === '' ? '#/' : `#/${trimmed}`;
|
|
20
|
+
};
|
|
16
21
|
export const hashPathnameOf = (url: URL) => {
|
|
17
|
-
const hash = url
|
|
22
|
+
const { hash } = url;
|
|
18
23
|
if (!hash || hash === '#') return '/';
|
|
19
24
|
|
|
20
25
|
// Tolerate both `#/foo` and `#foo`.
|
|
@@ -24,14 +29,3 @@ export const hashPathnameOf = (url: URL) => {
|
|
|
24
29
|
|
|
25
30
|
return `/${trimmed.replace(/^\/+/, '')}`;
|
|
26
31
|
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Build a hash URL from a routable pathname. Used by goto() / pushState()
|
|
30
|
-
* when in hash mode — converts `/dashboard/settings` to `#/dashboard/settings`
|
|
31
|
-
* and writes the result back to the URL.
|
|
32
|
-
*/
|
|
33
|
-
export const buildHashHref = (pathname: string) => {
|
|
34
|
-
const trimmed = pathname.replace(/^\/+/, '');
|
|
35
|
-
|
|
36
|
-
return trimmed === '' ? '#/' : `#/${trimmed}`;
|
|
37
|
-
};
|
|
@@ -12,11 +12,18 @@ type CompiledPattern = {
|
|
|
12
12
|
segments: CompiledSegment[];
|
|
13
13
|
score: number;
|
|
14
14
|
};
|
|
15
|
+
type RouteMatchBuilder = <Path extends string>(
|
|
16
|
+
params: Record<string, string | undefined>
|
|
17
|
+
) => RouteMatchResult<ExtractRouteParams<Path>>;
|
|
15
18
|
|
|
16
19
|
const STATIC_SEGMENT_WEIGHT = 100;
|
|
17
20
|
const PARAM_SEGMENT_WEIGHT = 10;
|
|
18
21
|
const WILDCARD_SEGMENT_WEIGHT = 1;
|
|
19
22
|
const OPTIONAL_PENALTY = 1;
|
|
23
|
+
const buildRouteMatch: RouteMatchBuilder = (params) => ({
|
|
24
|
+
matched: true,
|
|
25
|
+
params: Object.assign(Object.create(null), params)
|
|
26
|
+
});
|
|
20
27
|
|
|
21
28
|
const splitPath = (path: string) => {
|
|
22
29
|
const trimmed = path.replace(/^\/+/, '').replace(/\/+$/, '');
|
|
@@ -45,6 +52,14 @@ const compileSegment = (raw: string): CompiledSegment => {
|
|
|
45
52
|
* Compile a `<Route path>` pattern into segments + a specificity score.
|
|
46
53
|
* Higher score = more specific (longer static prefix beats parameterised).
|
|
47
54
|
*/
|
|
55
|
+
export const comparePatterns = (
|
|
56
|
+
left: { score: number; index: number },
|
|
57
|
+
right: { score: number; index: number }
|
|
58
|
+
) => {
|
|
59
|
+
if (left.score !== right.score) return right.score - left.score;
|
|
60
|
+
|
|
61
|
+
return left.index - right.index;
|
|
62
|
+
};
|
|
48
63
|
export const compilePattern = (pattern: string): CompiledPattern => {
|
|
49
64
|
const segments = splitPath(pattern).map(compileSegment);
|
|
50
65
|
|
|
@@ -58,13 +73,22 @@ export const compilePattern = (pattern: string): CompiledPattern => {
|
|
|
58
73
|
score += WILDCARD_SEGMENT_WEIGHT;
|
|
59
74
|
}
|
|
60
75
|
|
|
61
|
-
return {
|
|
76
|
+
return { score, segments };
|
|
62
77
|
};
|
|
78
|
+
export const joinBasepath = (basepath: string, pattern: string) => {
|
|
79
|
+
const trimmedBase = basepath.replace(/\/+$/, '');
|
|
80
|
+
const trimmedPattern = pattern.replace(/^\/+/, '');
|
|
63
81
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
if (trimmedPattern === '') {
|
|
83
|
+
return trimmedBase === '' ? '/' : trimmedBase;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (trimmedBase === '') {
|
|
87
|
+
return `/${trimmedPattern}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return `${trimmedBase}/${trimmedPattern}`;
|
|
91
|
+
};
|
|
68
92
|
export const matchPattern = <Path extends string>(
|
|
69
93
|
pattern: CompiledPattern,
|
|
70
94
|
pathname: string
|
|
@@ -72,20 +96,22 @@ export const matchPattern = <Path extends string>(
|
|
|
72
96
|
const pathSegments = splitPath(pathname);
|
|
73
97
|
const params: Record<string, string | undefined> = {};
|
|
74
98
|
|
|
75
|
-
let
|
|
76
|
-
for (
|
|
77
|
-
|
|
99
|
+
let pathIndex = 0;
|
|
100
|
+
for (
|
|
101
|
+
let segmentIndex = 0;
|
|
102
|
+
segmentIndex < pattern.segments.length;
|
|
103
|
+
segmentIndex++
|
|
104
|
+
) {
|
|
105
|
+
const segment = pattern.segments[segmentIndex];
|
|
78
106
|
if (!segment) continue;
|
|
79
107
|
|
|
80
108
|
if (segment.kind === 'wildcard') {
|
|
81
|
-
params['wildcard'] = pathSegments.slice(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
params: params as ExtractRouteParams<Path>
|
|
85
|
-
};
|
|
109
|
+
params['wildcard'] = pathSegments.slice(pathIndex).join('/');
|
|
110
|
+
|
|
111
|
+
return buildRouteMatch<Path>(params);
|
|
86
112
|
}
|
|
87
113
|
|
|
88
|
-
const candidate = pathSegments[
|
|
114
|
+
const candidate = pathSegments[pathIndex];
|
|
89
115
|
|
|
90
116
|
if (candidate === undefined) {
|
|
91
117
|
if (segment.kind === 'param' && segment.optional) {
|
|
@@ -98,61 +124,18 @@ export const matchPattern = <Path extends string>(
|
|
|
98
124
|
|
|
99
125
|
if (segment.kind === 'static') {
|
|
100
126
|
if (segment.value !== candidate) return { matched: false };
|
|
101
|
-
|
|
127
|
+
pathIndex++;
|
|
102
128
|
continue;
|
|
103
129
|
}
|
|
104
130
|
|
|
105
131
|
// param
|
|
106
132
|
params[segment.name] = candidate;
|
|
107
|
-
|
|
133
|
+
pathIndex++;
|
|
108
134
|
}
|
|
109
135
|
|
|
110
|
-
if (
|
|
136
|
+
if (pathIndex !== pathSegments.length) {
|
|
111
137
|
return { matched: false };
|
|
112
138
|
}
|
|
113
139
|
|
|
114
|
-
return
|
|
115
|
-
matched: true,
|
|
116
|
-
params: params as ExtractRouteParams<Path>
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Stable comparator for compiled patterns. Higher specificity sorts first.
|
|
122
|
-
* When two patterns have equal score, declaration order (the original index)
|
|
123
|
-
* decides — passed in via the `index` field on each entry.
|
|
124
|
-
*/
|
|
125
|
-
export const comparePatterns = (
|
|
126
|
-
a: { score: number; index: number },
|
|
127
|
-
b: { score: number; index: number }
|
|
128
|
-
) => {
|
|
129
|
-
if (a.score !== b.score) return b.score - a.score;
|
|
130
|
-
|
|
131
|
-
return a.index - b.index;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Join a basepath stack with a child pattern, producing an absolute pattern
|
|
136
|
-
* that the route matcher can compile against an incoming pathname.
|
|
137
|
-
*
|
|
138
|
-
* Handles slash edge cases:
|
|
139
|
-
* joinBasepath('', '/users') → '/users'
|
|
140
|
-
* joinBasepath('/portal', '/users') → '/portal/users'
|
|
141
|
-
* joinBasepath('/portal/', '/users') → '/portal/users'
|
|
142
|
-
* joinBasepath('/portal', 'users') → '/portal/users'
|
|
143
|
-
* joinBasepath('/portal', '/') → '/portal'
|
|
144
|
-
*/
|
|
145
|
-
export const joinBasepath = (basepath: string, pattern: string) => {
|
|
146
|
-
const trimmedBase = basepath.replace(/\/+$/, '');
|
|
147
|
-
const trimmedPattern = pattern.replace(/^\/+/, '');
|
|
148
|
-
|
|
149
|
-
if (trimmedPattern === '') {
|
|
150
|
-
return trimmedBase === '' ? '/' : trimmedBase;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (trimmedBase === '') {
|
|
154
|
-
return `/${trimmedPattern}`;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return `${trimmedBase}/${trimmedPattern}`;
|
|
140
|
+
return buildRouteMatch<Path>(params);
|
|
158
141
|
};
|
|
@@ -11,14 +11,5 @@ import type { PageState } from '../../types/svelteRouter';
|
|
|
11
11
|
* Backed by `$state`. Direct property access in templates re-renders.
|
|
12
12
|
*/
|
|
13
13
|
export declare const page: PageState;
|
|
14
|
-
/**
|
|
15
|
-
* Internal — only Router.svelte and the navigation primitives call this.
|
|
16
|
-
* Replaces the entire page state in one assignment so subscribers fire
|
|
17
|
-
* once per navigation rather than once per mutated field.
|
|
18
|
-
*/
|
|
19
|
-
export declare const setPage: (next: Partial<PageState>) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Internal — used during SSR to seed the page state before render so
|
|
22
|
-
* `<Route>` blocks see the correct `page.url`.
|
|
23
|
-
*/
|
|
24
14
|
export declare const seedPage: (url: URL, params?: Record<string, string | undefined>) => void;
|
|
15
|
+
export declare const setPage: (next: Partial<PageState>) => void;
|
|
@@ -14,14 +14,14 @@ const inner = $.proxy(initialState());
|
|
|
14
14
|
|
|
15
15
|
export const page = inner;
|
|
16
16
|
|
|
17
|
-
export const setPage = (next) => {
|
|
18
|
-
if (next.url !== undefined) inner.url = next.url;
|
|
19
|
-
if (next.params !== undefined) inner.params = next.params;
|
|
20
|
-
if (next.state !== undefined) inner.state = next.state;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
17
|
export const seedPage = (url, params = {}) => {
|
|
24
18
|
inner.url = url;
|
|
25
19
|
inner.params = params;
|
|
26
20
|
inner.state = undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const setPage = (next) => {
|
|
24
|
+
if (next.url !== undefined) inner.url = next.url;
|
|
25
|
+
if (next.params !== undefined) inner.params = next.params;
|
|
26
|
+
if (next.state !== undefined) inner.state = next.state;
|
|
27
27
|
};
|
|
@@ -11,13 +11,13 @@ const cache = new Map<string, CacheEntry>();
|
|
|
11
11
|
const isSlowConnection = () => {
|
|
12
12
|
if (typeof navigator === 'undefined') return false;
|
|
13
13
|
|
|
14
|
-
const connection = (
|
|
15
|
-
navigator as Navigator & {
|
|
16
|
-
connection?: { saveData?: boolean };
|
|
17
|
-
}
|
|
18
|
-
).connection;
|
|
14
|
+
const connection = Reflect.get(navigator, 'connection');
|
|
19
15
|
|
|
20
|
-
return
|
|
16
|
+
return (
|
|
17
|
+
typeof connection === 'object' &&
|
|
18
|
+
connection !== null &&
|
|
19
|
+
Reflect.get(connection, 'saveData') === true
|
|
20
|
+
);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const prefersReducedData = () => {
|
|
@@ -36,6 +36,16 @@ const evictOldest = () => {
|
|
|
36
36
|
* Prefetch a URL into the in-memory cache. No-op if the user has signalled
|
|
37
37
|
* data-saver / reduced-data, or if the URL is already cached.
|
|
38
38
|
*/
|
|
39
|
+
export const clearPrefetchCache = () => {
|
|
40
|
+
cache.clear();
|
|
41
|
+
};
|
|
42
|
+
export const consumePrefetch = (url: string) => {
|
|
43
|
+
const entry = cache.get(url);
|
|
44
|
+
if (!entry) return undefined;
|
|
45
|
+
cache.delete(url);
|
|
46
|
+
|
|
47
|
+
return entry.promise;
|
|
48
|
+
};
|
|
39
49
|
export const prefetch = (url: string) => {
|
|
40
50
|
if (typeof fetch === 'undefined') return;
|
|
41
51
|
if (isSlowConnection() || prefersReducedData()) return;
|
|
@@ -49,22 +59,6 @@ export const prefetch = (url: string) => {
|
|
|
49
59
|
cache.set(url, { promise, url });
|
|
50
60
|
};
|
|
51
61
|
|
|
52
|
-
/**
|
|
53
|
-
* Consume a cached prefetch entry on actual navigation, removing it from
|
|
54
|
-
* the cache. Returns the cached Promise<Response> or undefined.
|
|
55
|
-
*/
|
|
56
|
-
export const consumePrefetch = (url: string) => {
|
|
57
|
-
const entry = cache.get(url);
|
|
58
|
-
if (!entry) return undefined;
|
|
59
|
-
cache.delete(url);
|
|
60
|
-
|
|
61
|
-
return entry.promise;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const clearPrefetchCache = () => {
|
|
65
|
-
cache.clear();
|
|
66
|
-
};
|
|
67
|
-
|
|
68
62
|
type HoverHandle = {
|
|
69
63
|
cancel: () => void;
|
|
70
64
|
};
|
|
@@ -76,7 +70,11 @@ type HoverHandle = {
|
|
|
76
70
|
*/
|
|
77
71
|
export const scheduleHoverPrefetch = (url: string): HoverHandle => {
|
|
78
72
|
if (typeof window === 'undefined') {
|
|
79
|
-
return {
|
|
73
|
+
return {
|
|
74
|
+
cancel: () => {
|
|
75
|
+
/* nothing scheduled server-side */
|
|
76
|
+
}
|
|
77
|
+
};
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
const timer = window.setTimeout(() => {
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
type StartViewTransition = (callback: () => void | Promise<void>) => {
|
|
2
|
-
finished: Promise<void>;
|
|
3
|
-
};
|
|
4
|
-
|
|
5
1
|
const supportsViewTransitions = () => {
|
|
6
2
|
if (typeof document === 'undefined') return false;
|
|
7
3
|
|
|
8
|
-
return (
|
|
9
|
-
typeof (document as { startViewTransition?: StartViewTransition })
|
|
10
|
-
.startViewTransition === 'function'
|
|
11
|
-
);
|
|
4
|
+
return typeof Reflect.get(document, 'startViewTransition') === 'function';
|
|
12
5
|
};
|
|
13
6
|
|
|
14
7
|
/**
|
|
@@ -28,8 +21,25 @@ export const withViewTransition = async (
|
|
|
28
21
|
// Call as a method on `document` (NOT as an extracted bare function) —
|
|
29
22
|
// `document.startViewTransition` requires `this === document` or it
|
|
30
23
|
// throws "Illegal invocation".
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
const startViewTransition: unknown = Reflect.get(
|
|
25
|
+
document,
|
|
26
|
+
'startViewTransition'
|
|
27
|
+
);
|
|
28
|
+
if (typeof startViewTransition !== 'function') {
|
|
29
|
+
await mutate();
|
|
30
|
+
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const transitionResult: unknown = Reflect.apply(
|
|
34
|
+
startViewTransition,
|
|
35
|
+
document,
|
|
36
|
+
[() => mutate()]
|
|
37
|
+
);
|
|
38
|
+
if (
|
|
39
|
+
typeof transitionResult === 'object' &&
|
|
40
|
+
transitionResult !== null &&
|
|
41
|
+
'finished' in transitionResult
|
|
42
|
+
) {
|
|
43
|
+
await transitionResult.finished;
|
|
44
|
+
}
|
|
35
45
|
};
|