@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.
Files changed (341) hide show
  1. package/LICENSE +21 -13
  2. package/README.md +48 -2
  3. package/dist/angular/browser.js +82 -77
  4. package/dist/angular/browser.js.map +11 -11
  5. package/dist/angular/components/constants.js +43 -0
  6. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  7. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  8. package/dist/angular/hmrPreserveCore.ts +132 -134
  9. package/dist/angular/index.js +1719 -844
  10. package/dist/angular/index.js.map +34 -26
  11. package/dist/angular/server.js +1620 -768
  12. package/dist/angular/server.js.map +28 -20
  13. package/dist/build.js +4935 -2593
  14. package/dist/build.js.map +72 -57
  15. package/dist/cli/config/client.js +578 -0
  16. package/dist/cli/config/server.js +39587 -0
  17. package/dist/cli/htmx/htmx.min.js +1 -0
  18. package/dist/cli/index.js +16828 -3511
  19. package/dist/client/index.js +49 -46
  20. package/dist/client/index.js.map +12 -12
  21. package/dist/core/streamingSlotRegistrar.js +1 -19
  22. package/dist/core/streamingSlotRegistrar.js.map +2 -2
  23. package/dist/core/streamingSlotRegistry.js +1 -19
  24. package/dist/core/streamingSlotRegistry.js.map +2 -2
  25. package/dist/dev/client/cssUtils.ts +98 -41
  26. package/dist/dev/client/domState.ts +2 -0
  27. package/dist/dev/client/errorOverlay.ts +14 -13
  28. package/dist/dev/client/handlers/angularHmrShim.ts +20 -20
  29. package/dist/dev/client/handlers/angularRemount.ts +74 -55
  30. package/dist/dev/client/handlers/angularRemountWiring.ts +1 -2
  31. package/dist/dev/client/handlers/html.ts +144 -41
  32. package/dist/dev/client/handlers/htmx.ts +43 -8
  33. package/dist/dev/client/handlers/react.ts +114 -32
  34. package/dist/dev/client/handlers/rebuild.ts +28 -8
  35. package/dist/dev/client/handlers/svelte.ts +92 -51
  36. package/dist/dev/client/handlers/vue.ts +36 -45
  37. package/dist/dev/client/hmrClient.ts +101 -26
  38. package/dist/dev/client/hmrTiming.ts +141 -0
  39. package/dist/dev/client/hmrToast.ts +22 -24
  40. package/dist/dev/client/reactRefreshSetup.ts +4 -0
  41. package/dist/dev/client/vendor/reactRefreshRuntime.d.ts +12 -0
  42. package/dist/dev/client/vendor/reactRefreshRuntime.js +313 -0
  43. package/dist/dev/serverBootstrap.js +45 -0
  44. package/dist/index.js +7153 -3224
  45. package/dist/index.js.map +118 -86
  46. package/dist/islands/browser.js +1 -19
  47. package/dist/islands/browser.js.map +3 -3
  48. package/dist/islands/index.js +709 -120
  49. package/dist/islands/index.js.map +18 -13
  50. package/dist/mobile/browser.js +428 -0
  51. package/dist/mobile/browser.js.map +12 -0
  52. package/dist/mobile/index.js +3058 -0
  53. package/dist/mobile/index.js.map +35 -0
  54. package/dist/react/browser.js +13 -62
  55. package/dist/react/browser.js.map +5 -6
  56. package/dist/react/components/browser/index.js +23 -13
  57. package/dist/react/components/index.js +30 -34
  58. package/dist/react/components/index.js.map +8 -7
  59. package/dist/react/hooks/index.js +1 -19
  60. package/dist/react/hooks/index.js.map +3 -3
  61. package/dist/react/index.js +1643 -679
  62. package/dist/react/index.js.map +29 -20
  63. package/dist/react/jsxDevRuntimeCompat.js +22 -20
  64. package/dist/react/jsxDevRuntimeCompat.js.map +5 -4
  65. package/dist/react/jsxRuntimeCompat.js +90 -0
  66. package/dist/react/jsxRuntimeCompat.js.map +10 -0
  67. package/dist/react/router/browser.js +77 -0
  68. package/dist/react/router/browser.js.map +10 -0
  69. package/dist/react/router/index.js +77 -0
  70. package/dist/react/router/index.js.map +10 -0
  71. package/dist/react/server.js +950 -565
  72. package/dist/react/server.js.map +16 -11
  73. package/dist/src/angular/components/constants.d.ts +21 -0
  74. package/dist/src/angular/hmrPreserveCore.d.ts +7 -20
  75. package/dist/src/angular/islands.d.ts +1 -1
  76. package/dist/src/angular/pageHandler.d.ts +2 -0
  77. package/dist/src/angular/ssrRender.d.ts +4 -1
  78. package/dist/src/build/bunStringRawUnicodePlugin.d.ts +12 -0
  79. package/dist/src/build/chainInlineSourcemaps.d.ts +1 -0
  80. package/dist/src/build/compileAngular.d.ts +5 -7
  81. package/dist/src/build/compileSvelte.d.ts +3 -0
  82. package/dist/src/build/compileVue.d.ts +3 -1
  83. package/dist/src/build/generateReactIndexes.d.ts +1 -0
  84. package/dist/src/build/islandRegistryTransform.d.ts +17 -0
  85. package/dist/src/build/maskLiterals.d.ts +28 -0
  86. package/dist/src/build/parseVueSpaRoutes.d.ts +5 -0
  87. package/dist/src/build/resolveBuildMode.d.ts +7 -0
  88. package/dist/src/build/serverExternals.d.ts +14 -0
  89. package/dist/src/build/spaSideManifests.d.ts +16 -0
  90. package/dist/src/build/tailwindCompiler.d.ts +0 -1
  91. package/dist/src/cli/add/dependencies.d.ts +13 -0
  92. package/dist/src/cli/config/absolute/AbsoluteConfigPanel.d.ts +6 -0
  93. package/dist/src/cli/config/absolute/editAbsoluteConfig.d.ts +5 -0
  94. package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +19 -0
  95. package/dist/src/cli/config/auth/AuthPanel.d.ts +6 -0
  96. package/dist/src/cli/config/auth/authCatalog.d.ts +10 -0
  97. package/dist/src/cli/config/auth/authScaffolds.d.ts +16 -0
  98. package/dist/src/cli/config/auth/editAuthConfig.d.ts +5 -0
  99. package/dist/src/cli/config/auth/resolveAuthSettings.d.ts +14 -0
  100. package/dist/src/cli/config/auth/resolveAuthState.d.ts +2 -0
  101. package/dist/src/cli/config/auth/scaffoldAuthFeature.d.ts +6 -0
  102. package/dist/src/cli/config/client.d.ts +1 -0
  103. package/dist/src/cli/config/configCert.d.ts +12 -0
  104. package/dist/src/cli/config/eslint/EslintPanel.d.ts +6 -0
  105. package/dist/src/cli/config/eslint/configAst.d.ts +18 -0
  106. package/dist/src/cli/config/eslint/editConfigRule.d.ts +6 -0
  107. package/dist/src/cli/config/eslint/eslintStyles.d.ts +1 -0
  108. package/dist/src/cli/config/eslint/resolveConfig.d.ts +3 -0
  109. package/dist/src/cli/config/eslint/serializeValue.d.ts +9 -0
  110. package/dist/src/cli/config/guards.d.ts +4 -0
  111. package/dist/src/cli/config/integrations/IntegrationsPanel.d.ts +6 -0
  112. package/dist/src/cli/config/packageJson/PackageJsonPanel.d.ts +6 -0
  113. package/dist/src/cli/config/packageJson/editPackageJson.d.ts +9 -0
  114. package/dist/src/cli/config/packageJson/resolvePackageJson.d.ts +8 -0
  115. package/dist/src/cli/config/page/ConfigShell.d.ts +6 -0
  116. package/dist/src/cli/config/page/FieldEditor.d.ts +9 -0
  117. package/dist/src/cli/config/page/PanelHost.d.ts +6 -0
  118. package/dist/src/cli/config/page/configStyles.d.ts +1 -0
  119. package/dist/src/cli/config/panels.d.ts +7 -0
  120. package/dist/src/cli/config/prettier/PrettierPanel.d.ts +6 -0
  121. package/dist/src/cli/config/prettier/editPrettier.d.ts +5 -0
  122. package/dist/src/cli/config/prettier/resolvePrettier.d.ts +11 -0
  123. package/dist/src/cli/config/schema/fromJsonSchema.d.ts +3 -0
  124. package/dist/src/cli/config/schema/fromType.d.ts +1 -0
  125. package/dist/src/cli/config/schema/serialize.d.ts +1 -0
  126. package/dist/src/cli/config/server.d.ts +527 -0
  127. package/dist/src/cli/config/tsconfig/TsconfigPanel.d.ts +6 -0
  128. package/dist/src/cli/config/tsconfig/editTsconfig.d.ts +5 -0
  129. package/dist/src/cli/config/tsconfig/resolveTsconfig.d.ts +8 -0
  130. package/dist/src/cli/config/tsconfig/tsconfigStyles.d.ts +1 -0
  131. package/dist/src/cli/discoverInstances.d.ts +5 -0
  132. package/dist/src/cli/elysiaOpenApiTypeboxPlugin.d.ts +8 -0
  133. package/dist/src/cli/generate/componentTemplates.d.ts +7 -0
  134. package/dist/src/cli/generate/context.d.ts +30 -0
  135. package/dist/src/cli/generate/cssStrategy.d.ts +20 -0
  136. package/dist/src/cli/generate/frameworkKey.d.ts +3 -0
  137. package/dist/src/cli/generate/frameworks.d.ts +40 -0
  138. package/dist/src/cli/generate/generateApi.d.ts +3 -0
  139. package/dist/src/cli/generate/generateComponent.d.ts +4 -0
  140. package/dist/src/cli/generate/generatePage.d.ts +4 -0
  141. package/dist/src/cli/generate/naming.d.ts +5 -0
  142. package/dist/src/cli/generate/navData.d.ts +10 -0
  143. package/dist/src/cli/generate/outcome.d.ts +17 -0
  144. package/dist/src/cli/generate/pageTemplates.d.ts +11 -0
  145. package/dist/src/cli/generate/routeWiring.d.ts +40 -0
  146. package/dist/src/cli/generate/staticNav.d.ts +5 -0
  147. package/dist/src/cli/heapDiff.d.ts +1 -0
  148. package/dist/src/cli/htmx/install.d.ts +6 -0
  149. package/dist/src/cli/inspectData.d.ts +12 -0
  150. package/dist/src/cli/inspectTui.d.ts +1 -0
  151. package/dist/src/cli/instanceStatus.d.ts +22 -0
  152. package/dist/src/cli/integrations/addPlugin.d.ts +8 -0
  153. package/dist/src/cli/integrations/catalog.d.ts +20 -0
  154. package/dist/src/cli/psTui.d.ts +1 -0
  155. package/dist/src/cli/scripts/add.d.ts +1 -0
  156. package/dist/src/cli/scripts/analyze.d.ts +1 -0
  157. package/dist/src/cli/scripts/api.d.ts +1 -0
  158. package/dist/src/cli/scripts/build.d.ts +1 -1
  159. package/dist/src/cli/scripts/db.d.ts +20 -0
  160. package/dist/src/cli/scripts/dev.d.ts +5 -1
  161. package/dist/src/cli/scripts/doctor.d.ts +1 -0
  162. package/dist/src/cli/scripts/env.d.ts +7 -0
  163. package/dist/src/cli/scripts/eslint.d.ts +37 -2
  164. package/dist/src/cli/scripts/eslintChunked.d.ts +37 -0
  165. package/dist/src/cli/scripts/generate.d.ts +1 -0
  166. package/dist/src/cli/scripts/htmx.d.ts +1 -0
  167. package/dist/src/cli/scripts/inspect.d.ts +1 -0
  168. package/dist/src/cli/scripts/islands.d.ts +1 -0
  169. package/dist/src/cli/scripts/lintProof.d.ts +42 -0
  170. package/dist/src/cli/scripts/logs.d.ts +1 -0
  171. package/dist/src/cli/scripts/ls.d.ts +1 -0
  172. package/dist/src/cli/scripts/mem.d.ts +1 -0
  173. package/dist/src/cli/scripts/mobile.d.ts +1 -0
  174. package/dist/src/cli/scripts/prettier.d.ts +2 -0
  175. package/dist/src/cli/scripts/ps.d.ts +1 -0
  176. package/dist/src/cli/scripts/remove.d.ts +1 -0
  177. package/dist/src/cli/scripts/routes.d.ts +1 -0
  178. package/dist/src/cli/scripts/start.d.ts +6 -1
  179. package/dist/src/cli/scripts/tunnelRelay.d.ts +9 -0
  180. package/dist/src/cli/scripts/workspace.d.ts +3 -1
  181. package/dist/src/cli/serverBundleExternals.d.ts +2 -0
  182. package/dist/src/cli/tuiPrimitives.d.ts +14 -0
  183. package/dist/src/cli/typeGraphCoherence.d.ts +32 -0
  184. package/dist/src/cli/utils.d.ts +3 -1
  185. package/dist/src/cli/workspaceTui.d.ts +2 -1
  186. package/dist/src/client/hydrators/react.d.ts +1 -1
  187. package/dist/src/client/hydrators/svelte.d.ts +1 -1
  188. package/dist/src/client/hydrators/vue.d.ts +1 -1
  189. package/dist/src/client/islandStore.d.ts +3 -3
  190. package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
  191. package/dist/src/constants.d.ts +21 -0
  192. package/dist/src/core/angularServerModule.d.ts +1 -0
  193. package/dist/src/core/build.d.ts +11 -3
  194. package/dist/src/core/devRouteRegistrationCallsite.d.ts +1 -5
  195. package/dist/src/core/index.d.ts +1 -0
  196. package/dist/src/core/pageResponseCache.d.ts +23 -0
  197. package/dist/src/core/prepare.d.ts +192 -154
  198. package/dist/src/core/requestContext.d.ts +18 -0
  199. package/dist/src/dev/angular/fastHmrCompiler.d.ts +5 -3
  200. package/dist/src/dev/angular/hmrCompiler.d.ts +1 -1
  201. package/dist/src/dev/angular/resolveOwningComponents.d.ts +1 -1
  202. package/dist/src/dev/clientManager.d.ts +10 -1
  203. package/dist/src/dev/configResolver.d.ts +2 -0
  204. package/dist/src/dev/moduleMapper.d.ts +1 -1
  205. package/dist/src/dev/moduleServer.d.ts +2 -1
  206. package/dist/src/dev/pathUtils.d.ts +1 -1
  207. package/dist/src/dev/reactComponentClassifier.d.ts +1 -1
  208. package/dist/src/dev/rebuildTrigger.d.ts +4 -0
  209. package/dist/src/dev/requestInspector.d.ts +31 -0
  210. package/dist/src/dev/serverBootstrap.d.ts +1 -0
  211. package/dist/src/dev/serverEntryWatcher.d.ts +3 -3
  212. package/dist/src/dev/tunnel/client.d.ts +20 -0
  213. package/dist/src/dev/tunnel/protocol.d.ts +85 -0
  214. package/dist/src/dev/tunnel/relay.d.ts +28 -0
  215. package/dist/src/dev/webSocket.d.ts +1 -1
  216. package/dist/src/mobile/androidConformance.d.ts +42 -0
  217. package/dist/src/mobile/androidEmulatorController.d.ts +99 -0
  218. package/dist/src/mobile/androidNativeWatcher.d.ts +19 -0
  219. package/dist/src/mobile/androidRelease.d.ts +47 -0
  220. package/dist/src/mobile/androidWebView.d.ts +46 -0
  221. package/dist/src/mobile/artifactStore.d.ts +47 -0
  222. package/dist/src/mobile/associationFiles.d.ts +49 -0
  223. package/dist/src/mobile/browser.d.ts +2 -0
  224. package/dist/src/mobile/buildMetadata.d.ts +10 -0
  225. package/dist/src/mobile/buildPipeline.d.ts +8 -0
  226. package/dist/src/mobile/buildRelease.d.ts +24 -0
  227. package/dist/src/mobile/capacitorBundle.d.ts +28 -0
  228. package/dist/src/mobile/capacitorProject.d.ts +9 -0
  229. package/dist/src/mobile/client.d.ts +35 -0
  230. package/dist/src/mobile/compatibilityDispatcher.d.ts +26 -0
  231. package/dist/src/mobile/config.d.ts +16 -0
  232. package/dist/src/mobile/emulatorDoctor.d.ts +25 -0
  233. package/dist/src/mobile/emulatorInstaller.d.ts +41 -0
  234. package/dist/src/mobile/index.d.ts +19 -0
  235. package/dist/src/mobile/materializedBundle.d.ts +36 -0
  236. package/dist/src/mobile/nativeDeepLinks.d.ts +5 -0
  237. package/dist/src/mobile/pageProtocol.d.ts +89 -0
  238. package/dist/src/mobile/producerContext.d.ts +4 -0
  239. package/dist/src/mobile/producerContextState.d.ts +10 -0
  240. package/dist/src/mobile/releaseArtifact.d.ts +75 -0
  241. package/dist/src/mobile/releaseDoctor.d.ts +13 -0
  242. package/dist/src/mobile/routeMatcher.d.ts +3 -0
  243. package/dist/src/mobile/routeMetadataTransform.d.ts +13 -0
  244. package/dist/src/mobile/shellBootstrap.d.ts +1 -0
  245. package/dist/src/mobile/transport.d.ts +31 -0
  246. package/dist/src/plugins/devtoolsJson.d.ts +6 -47
  247. package/dist/src/plugins/hmr.d.ts +22 -96
  248. package/dist/src/plugins/imageOptimizer.d.ts +150 -62
  249. package/dist/src/plugins/networking.d.ts +2 -2
  250. package/dist/src/plugins/openApiPlugin.d.ts +4 -0
  251. package/dist/src/plugins/telemetryPlugin.d.ts +36 -0
  252. package/dist/src/react/browser.d.ts +0 -2
  253. package/dist/src/react/hooks/useMediaQuery.d.ts +1 -1
  254. package/dist/src/react/index.d.ts +0 -2
  255. package/dist/src/react/jsxDevRuntimeCompat.d.ts +1 -1
  256. package/dist/src/react/jsxRuntimeCompat.d.ts +7 -0
  257. package/dist/src/react/pageHandler.d.ts +8 -0
  258. package/dist/src/react/router/UniversalRouter.d.ts +43 -0
  259. package/dist/src/react/router/browser.d.ts +2 -0
  260. package/dist/src/react/router/index.d.ts +2 -0
  261. package/dist/src/svelte/pageHandler.d.ts +5 -0
  262. package/dist/src/svelte/router/hashMode.d.ts +1 -6
  263. package/dist/src/svelte/router/matchPath.d.ts +4 -24
  264. package/dist/src/svelte/router/page.svelte.d.ts +1 -10
  265. package/dist/src/svelte/router/prefetchCache.d.ts +2 -6
  266. package/dist/src/utils/cleanup.d.ts +1 -0
  267. package/dist/src/utils/defineConvention.d.ts +2 -2
  268. package/dist/src/utils/defineEnv.d.ts +4 -4
  269. package/dist/src/utils/formatBytes.d.ts +2 -0
  270. package/dist/src/utils/generatedDir.d.ts +1 -1
  271. package/dist/src/utils/iconVersion.d.ts +5 -0
  272. package/dist/src/utils/imageProcessing.d.ts +1 -1
  273. package/dist/src/utils/index.d.ts +2 -0
  274. package/dist/src/utils/inlinePageCss.d.ts +9 -0
  275. package/dist/src/utils/instanceRegistry.d.ts +13 -0
  276. package/dist/src/utils/isTestSourcePath.d.ts +1 -0
  277. package/dist/src/utils/jsonLd.d.ts +1 -1
  278. package/dist/src/utils/loadConfig.d.ts +11 -3
  279. package/dist/src/utils/logger.d.ts +2 -0
  280. package/dist/src/utils/portScan.d.ts +22 -0
  281. package/dist/src/utils/projectRoot.d.ts +17 -0
  282. package/dist/src/utils/resolveConvention.d.ts +1 -1
  283. package/dist/src/utils/resolveDevPort.d.ts +4 -1
  284. package/dist/src/utils/runtimeMode.d.ts +1 -1
  285. package/dist/src/utils/spaRouteCss.d.ts +10 -0
  286. package/dist/src/utils/spaRouteManifest.d.ts +8 -0
  287. package/dist/src/utils/stripStringsAndComments.d.ts +18 -0
  288. package/dist/src/utils/userAgentFunctions.d.ts +1 -1
  289. package/dist/src/utils/vueCompiler.d.ts +1 -0
  290. package/dist/src/vue/components/Image.d.ts +2 -2
  291. package/dist/src/vue/defineVuePage.d.ts +1 -11
  292. package/dist/src/vue/index.d.ts +3 -0
  293. package/dist/src/vue/pageHandler.d.ts +5 -0
  294. package/dist/src/vue/resolveGeneratedVueModulePath.d.ts +1 -0
  295. package/dist/src/vue/teleports.d.ts +2 -0
  296. package/dist/src/vue/useResource.d.ts +65 -0
  297. package/dist/svelte/browser.js +1 -19
  298. package/dist/svelte/browser.js.map +3 -3
  299. package/dist/svelte/components/Head.svelte +7 -1
  300. package/dist/svelte/index.js +1281 -543
  301. package/dist/svelte/index.js.map +27 -19
  302. package/dist/svelte/router/Link.svelte.d.ts +3 -3
  303. package/dist/svelte/router/Route.svelte.d.ts +5 -5
  304. package/dist/svelte/router/Router.svelte.d.ts +3 -3
  305. package/dist/svelte/router/hashMode.ts +6 -12
  306. package/dist/svelte/router/matchPath.ts +44 -61
  307. package/dist/svelte/router/page.d.ts +1 -10
  308. package/dist/svelte/router/page.js +6 -6
  309. package/dist/svelte/router/prefetchCache.ts +21 -23
  310. package/dist/svelte/router/viewTransitions.ts +22 -12
  311. package/dist/svelte/server.js +697 -565
  312. package/dist/svelte/server.js.map +14 -11
  313. package/dist/types/absoluteConfig.d.ts +22 -0
  314. package/dist/types/angular.d.ts +4 -1
  315. package/dist/types/authPanel.d.ts +62 -0
  316. package/dist/types/build.d.ts +116 -0
  317. package/dist/types/cli.d.ts +57 -0
  318. package/dist/types/config.d.ts +52 -0
  319. package/dist/types/eslintConfig.d.ts +68 -0
  320. package/dist/types/globals.d.ts +31 -10
  321. package/dist/types/image.d.ts +2 -0
  322. package/dist/types/index.d.ts +1 -0
  323. package/dist/types/integrationsPanel.d.ts +29 -0
  324. package/dist/types/messages.d.ts +12 -0
  325. package/dist/types/packageJson.d.ts +74 -0
  326. package/dist/types/packageJsonPanel.d.ts +29 -0
  327. package/dist/types/prettier.d.ts +26 -0
  328. package/dist/types/tsconfig.d.ts +31 -0
  329. package/dist/types/vue.d.ts +13 -15
  330. package/dist/vue/browser.js +14 -36
  331. package/dist/vue/browser.js.map +5 -5
  332. package/dist/vue/components/Image.js +3 -20
  333. package/dist/vue/components/Image.js.map +3 -3
  334. package/dist/vue/components/index.js +3 -20
  335. package/dist/vue/components/index.js.map +3 -3
  336. package/dist/vue/index.js +1573 -620
  337. package/dist/vue/index.js.map +34 -22
  338. package/dist/vue/server.js +800 -520
  339. package/dist/vue/server.js.map +17 -11
  340. package/package.json +145 -68
  341. package/dist/src/react/UniversalRouter.d.ts +0 -12
@@ -1,4 +1,4 @@
1
- import type { Snippet } from 'svelte';
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
- import { SvelteComponent } from 'svelte';
19
+ class Link extends SvelteComponent<Props> {}
20
20
 
21
- export default class Link extends SvelteComponent<Props> {}
21
+ export { Link as default };
@@ -1,4 +1,4 @@
1
- import type { Snippet } from 'svelte';
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
- import { SvelteComponent } from 'svelte';
9
+ class Route<Path extends string = string> extends SvelteComponent<
10
+ RouteProps<Path>
11
+ > {}
10
12
 
11
- export default class Route<
12
- Path extends string = string
13
- > extends SvelteComponent<RouteProps<Path>> {}
13
+ export { Route as default };
@@ -1,4 +1,4 @@
1
- import type { Snippet } from 'svelte';
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
- import { SvelteComponent } from 'svelte';
14
+ class Router extends SvelteComponent<Props> {}
15
15
 
16
- export default class Router extends SvelteComponent<Props> {}
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.hash;
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 { segments, score };
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
- * Match a URL pathname against a compiled pattern. Returns the extracted
66
- * params on a successful match, or a miss otherwise.
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 pi = 0;
76
- for (let si = 0; si < pattern.segments.length; si++) {
77
- const segment = pattern.segments[si];
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(pi).join('/');
82
- return {
83
- matched: true,
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[pi];
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
- pi++;
127
+ pathIndex++;
102
128
  continue;
103
129
  }
104
130
 
105
131
  // param
106
132
  params[segment.name] = candidate;
107
- pi++;
133
+ pathIndex++;
108
134
  }
109
135
 
110
- if (pi !== pathSegments.length) {
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 connection?.saveData === true;
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 { cancel: () => {} };
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 doc = document as Document & {
32
- startViewTransition: StartViewTransition;
33
- };
34
- await doc.startViewTransition(() => mutate()).finished;
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
  };