From 87eee0dd88ddd7f20124aa661746d645ddf698f5 Mon Sep 17 00:00:00 2001 From: Piotr Sarna Date: Tue, 7 Oct 2025 17:38:09 +0200 Subject: [PATCH 1/3] Remove tmp .svelte-kit files --- .../__package__/components/Link/Link.d.ts | 21 -- .../__package__/components/Link/Link.d.ts.map | 1 - .../__package__/components/Link/Link.js | 1 - .../__package__/components/Link/Link.svelte | 50 ---- .../components/Link/Link.svelte.d.ts | 5 - .../components/Link/Link.svelte.d.ts.map | 1 - .../__package__/components/Route/Route.d.ts | 25 -- .../components/Route/Route.d.ts.map | 1 - .../__package__/components/Route/Route.js | 1 - .../__package__/components/Route/Route.svelte | 46 ---- .../components/Route/Route.svelte.d.ts | 5 - .../components/Route/Route.svelte.d.ts.map | 1 - .../__package__/components/Router/Router.d.ts | 21 -- .../components/Router/Router.d.ts.map | 1 - .../__package__/components/Router/Router.js | 1 - .../components/Router/Router.svelte | 165 ------------- .../components/Router/Router.svelte.d.ts | 5 - .../components/Router/Router.svelte.d.ts.map | 1 - .svelte-kit/__package__/index.d.ts | 7 - .svelte-kit/__package__/index.d.ts.map | 1 - .svelte-kit/__package__/index.js | 6 - .../__package__/lib/RouterContext.d.ts | 27 --- .../__package__/lib/RouterContext.d.ts.map | 1 - .svelte-kit/__package__/lib/RouterContext.js | 1 - .svelte-kit/__package__/lib/actions.d.ts | 33 --- .svelte-kit/__package__/lib/actions.d.ts.map | 1 - .svelte-kit/__package__/lib/actions.js | 81 ------- .svelte-kit/__package__/lib/contexts.d.ts | 29 --- .svelte-kit/__package__/lib/contexts.d.ts.map | 1 - .svelte-kit/__package__/lib/contexts.js | 10 - .svelte-kit/__package__/lib/history.d.ts | 58 ----- .svelte-kit/__package__/lib/history.d.ts.map | 1 - .svelte-kit/__package__/lib/history.js | 92 -------- .svelte-kit/__package__/lib/utils.d.ts | 72 ------ .svelte-kit/__package__/lib/utils.d.ts.map | 1 - .svelte-kit/__package__/lib/utils.js | 216 ------------------ 36 files changed, 990 deletions(-) delete mode 100644 .svelte-kit/__package__/components/Link/Link.d.ts delete mode 100644 .svelte-kit/__package__/components/Link/Link.d.ts.map delete mode 100644 .svelte-kit/__package__/components/Link/Link.js delete mode 100644 .svelte-kit/__package__/components/Link/Link.svelte delete mode 100644 .svelte-kit/__package__/components/Link/Link.svelte.d.ts delete mode 100644 .svelte-kit/__package__/components/Link/Link.svelte.d.ts.map delete mode 100644 .svelte-kit/__package__/components/Route/Route.d.ts delete mode 100644 .svelte-kit/__package__/components/Route/Route.d.ts.map delete mode 100644 .svelte-kit/__package__/components/Route/Route.js delete mode 100644 .svelte-kit/__package__/components/Route/Route.svelte delete mode 100644 .svelte-kit/__package__/components/Route/Route.svelte.d.ts delete mode 100644 .svelte-kit/__package__/components/Route/Route.svelte.d.ts.map delete mode 100644 .svelte-kit/__package__/components/Router/Router.d.ts delete mode 100644 .svelte-kit/__package__/components/Router/Router.d.ts.map delete mode 100644 .svelte-kit/__package__/components/Router/Router.js delete mode 100644 .svelte-kit/__package__/components/Router/Router.svelte delete mode 100644 .svelte-kit/__package__/components/Router/Router.svelte.d.ts delete mode 100644 .svelte-kit/__package__/components/Router/Router.svelte.d.ts.map delete mode 100644 .svelte-kit/__package__/index.d.ts delete mode 100644 .svelte-kit/__package__/index.d.ts.map delete mode 100644 .svelte-kit/__package__/index.js delete mode 100644 .svelte-kit/__package__/lib/RouterContext.d.ts delete mode 100644 .svelte-kit/__package__/lib/RouterContext.d.ts.map delete mode 100644 .svelte-kit/__package__/lib/RouterContext.js delete mode 100644 .svelte-kit/__package__/lib/actions.d.ts delete mode 100644 .svelte-kit/__package__/lib/actions.d.ts.map delete mode 100644 .svelte-kit/__package__/lib/actions.js delete mode 100644 .svelte-kit/__package__/lib/contexts.d.ts delete mode 100644 .svelte-kit/__package__/lib/contexts.d.ts.map delete mode 100644 .svelte-kit/__package__/lib/contexts.js delete mode 100644 .svelte-kit/__package__/lib/history.d.ts delete mode 100644 .svelte-kit/__package__/lib/history.d.ts.map delete mode 100644 .svelte-kit/__package__/lib/history.js delete mode 100644 .svelte-kit/__package__/lib/utils.d.ts delete mode 100644 .svelte-kit/__package__/lib/utils.d.ts.map delete mode 100644 .svelte-kit/__package__/lib/utils.js diff --git a/.svelte-kit/__package__/components/Link/Link.d.ts b/.svelte-kit/__package__/components/Link/Link.d.ts deleted file mode 100644 index 584bd08..0000000 --- a/.svelte-kit/__package__/components/Link/Link.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { Snippet } from "svelte"; -import type { HTMLAnchorAttributes } from "svelte/elements"; -import type { RouteLocation } from "../Route/Route"; -export type LinkProps = { - children: Snippet<[boolean]>; - to: string; - replace?: boolean; - preserveScroll?: boolean; - state?: { - [k in string | number]: unknown; - }; - getProps?: (linkParams: GetPropsParams) => Record; - click?: (e: MouseEvent) => void; -} & Omit; -export type GetPropsParams = { - location: RouteLocation; - href: string; - isPartiallyCurrent: boolean; - isCurrent: boolean; -}; -//# sourceMappingURL=Link.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Link/Link.d.ts.map b/.svelte-kit/__package__/components/Link/Link.d.ts.map deleted file mode 100644 index a0bcb31..0000000 --- a/.svelte-kit/__package__/components/Link/Link.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../../src/components/Link/Link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE;SACL,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO;KAChC,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/D,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACjC,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Link/Link.js b/.svelte-kit/__package__/components/Link/Link.js deleted file mode 100644 index cb0ff5c..0000000 --- a/.svelte-kit/__package__/components/Link/Link.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/.svelte-kit/__package__/components/Link/Link.svelte b/.svelte-kit/__package__/components/Link/Link.svelte deleted file mode 100644 index 5de3198..0000000 --- a/.svelte-kit/__package__/components/Link/Link.svelte +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {@render children(!!ariaCurrent)} - diff --git a/.svelte-kit/__package__/components/Link/Link.svelte.d.ts b/.svelte-kit/__package__/components/Link/Link.svelte.d.ts deleted file mode 100644 index 9a34b68..0000000 --- a/.svelte-kit/__package__/components/Link/Link.svelte.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { LinkProps } from "./Link"; -declare const Link: import("svelte").Component; -type Link = ReturnType; -export default Link; -//# sourceMappingURL=Link.svelte.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Link/Link.svelte.d.ts.map b/.svelte-kit/__package__/components/Link/Link.svelte.d.ts.map deleted file mode 100644 index e1ae3be..0000000 --- a/.svelte-kit/__package__/components/Link/Link.svelte.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Link.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/components/Link/Link.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAyDxC,QAAA,MAAM,IAAI,+CAAsC,CAAC;AACjD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Route/Route.d.ts b/.svelte-kit/__package__/components/Route/Route.d.ts deleted file mode 100644 index 545f093..0000000 --- a/.svelte-kit/__package__/components/Route/Route.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Component, Snippet } from "svelte"; -export type RouteProps = { - path?: string; - component?: Component>; - children?: Snippet<[RouteParams]>; - [additionalProp: string]: unknown; -}; -export type RouteSlots = { - default: { - location: RouteLocation; - params: RouteParams; - }; -}; -export type RouteLocation = { - pathname: string; - search: string; - hash?: string; - state: { - [k in string | number]: unknown; - }; -}; -export type RouteParams = { - [param: string]: string; -}; -//# sourceMappingURL=Route.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Route/Route.d.ts.map b/.svelte-kit/__package__/components/Route/Route.d.ts.map deleted file mode 100644 index 92a1431..0000000 --- a/.svelte-kit/__package__/components/Route/Route.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../../../../src/components/Route/Route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMjD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IAClC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE;QACP,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;SACJ,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO;KAChC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Route/Route.js b/.svelte-kit/__package__/components/Route/Route.js deleted file mode 100644 index cb0ff5c..0000000 --- a/.svelte-kit/__package__/components/Route/Route.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/.svelte-kit/__package__/components/Route/Route.svelte b/.svelte-kit/__package__/components/Route/Route.svelte deleted file mode 100644 index 698471c..0000000 --- a/.svelte-kit/__package__/components/Route/Route.svelte +++ /dev/null @@ -1,46 +0,0 @@ - - -{#if $activeRoute && $activeRoute.route === route} - {#if PropComponent} - - {:else} - {@render children?.(routeParams)} - {/if} -{/if} diff --git a/.svelte-kit/__package__/components/Route/Route.svelte.d.ts b/.svelte-kit/__package__/components/Route/Route.svelte.d.ts deleted file mode 100644 index 04f3e3e..0000000 --- a/.svelte-kit/__package__/components/Route/Route.svelte.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RouteProps } from "./Route.js"; -declare const Route: import("svelte").Component; -type Route = ReturnType; -export default Route; -//# sourceMappingURL=Route.svelte.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Route/Route.svelte.d.ts.map b/.svelte-kit/__package__/components/Route/Route.svelte.d.ts.map deleted file mode 100644 index 3d8d107..0000000 --- a/.svelte-kit/__package__/components/Route/Route.svelte.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Route.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/components/Route/Route.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAmD1D,QAAA,MAAM,KAAK,gDAAsC,CAAC;AAClD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Router/Router.d.ts b/.svelte-kit/__package__/components/Router/Router.d.ts deleted file mode 100644 index f5f9d1b..0000000 --- a/.svelte-kit/__package__/components/Router/Router.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { Snippet } from "svelte"; -import type { RouteLocation } from "../Route/Route"; -import { globalHistory } from "../../lib/history"; -export type Viewtransition = { - fn?: any; - delay?: number; - duration?: number; - x?: number; - y?: number; - opacity?: number; - easing?: any; - css?: (t: number) => string; -}; -export type RouterProps = { - basepath?: string; - url?: string; - viewtransition?: (direction?: string) => Viewtransition; - history?: typeof globalHistory; - children: Snippet<[string | null, RouteLocation]>; -}; -//# sourceMappingURL=Router.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Router/Router.d.ts.map b/.svelte-kit/__package__/components/Router/Router.d.ts.map deleted file mode 100644 index def31b3..0000000 --- a/.svelte-kit/__package__/components/Router/Router.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../../../src/components/Router/Router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,cAAc,CAAC;IACxD,OAAO,CAAC,EAAE,OAAO,aAAa,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;CACnD,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Router/Router.js b/.svelte-kit/__package__/components/Router/Router.js deleted file mode 100644 index 0a8bf24..0000000 --- a/.svelte-kit/__package__/components/Router/Router.js +++ /dev/null @@ -1 +0,0 @@ -import { globalHistory } from "../../lib/history"; diff --git a/.svelte-kit/__package__/components/Router/Router.svelte b/.svelte-kit/__package__/components/Router/Router.svelte deleted file mode 100644 index 7e9d930..0000000 --- a/.svelte-kit/__package__/components/Router/Router.svelte +++ /dev/null @@ -1,165 +0,0 @@ - - -{#if viewtransition} - {#key $location.pathname} -
- {@render children($activeRoute && $activeRoute.uri, $location)} -
- {/key} -{:else} - {@render children($activeRoute && $activeRoute.uri, $location)} -{/if} diff --git a/.svelte-kit/__package__/components/Router/Router.svelte.d.ts b/.svelte-kit/__package__/components/Router/Router.svelte.d.ts deleted file mode 100644 index 7ba591c..0000000 --- a/.svelte-kit/__package__/components/Router/Router.svelte.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { RouterProps } from "./Router.js"; -declare const Router: import("svelte").Component; -type Router = ReturnType; -export default Router; -//# sourceMappingURL=Router.svelte.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/components/Router/Router.svelte.d.ts.map b/.svelte-kit/__package__/components/Router/Router.svelte.d.ts.map deleted file mode 100644 index 505bf21..0000000 --- a/.svelte-kit/__package__/components/Router/Router.svelte.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Router.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/components/Router/Router.svelte.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAoK/D,QAAA,MAAM,MAAM,iDAAsC,CAAC;AACnD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/index.d.ts b/.svelte-kit/__package__/index.d.ts deleted file mode 100644 index 3fb5c72..0000000 --- a/.svelte-kit/__package__/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { default as Link } from "./components/Link/Link.svelte"; -export { default as Route } from "./components/Route/Route.svelte"; -export { default as Router } from "./components/Router/Router.svelte"; -export { link, links } from "./lib/actions.js"; -export { useHistory, useLocation, useRouter } from "./lib/contexts.js"; -export { navigate, listen } from "./lib/history.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/index.d.ts.map b/.svelte-kit/__package__/index.d.ts.map deleted file mode 100644 index 25839db..0000000 --- a/.svelte-kit/__package__/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/index.js b/.svelte-kit/__package__/index.js deleted file mode 100644 index 30f4ea2..0000000 --- a/.svelte-kit/__package__/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export { default as Link } from "./components/Link/Link.svelte"; -export { default as Route } from "./components/Route/Route.svelte"; -export { default as Router } from "./components/Router/Router.svelte"; -export { link, links } from "./lib/actions.js"; -export { useHistory, useLocation, useRouter } from "./lib/contexts.js"; -export { navigate, listen } from "./lib/history.js"; diff --git a/.svelte-kit/__package__/lib/RouterContext.d.ts b/.svelte-kit/__package__/lib/RouterContext.d.ts deleted file mode 100644 index c53f554..0000000 --- a/.svelte-kit/__package__/lib/RouterContext.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { readable } from "svelte/store"; -export type RouteConfig = { - _path?: string; - path: string; - default: boolean; -}; -type ActiveRoute = { - params: { - [key: string]: string; - }; - preserveScroll: boolean; - route: RouteConfig; - uri: string; -}; -type RouterBase = { - path: string; - uri: string; -}; -export type RouterContext = { - activeRoute: ReturnType>; - base: ReturnType>; - routerBase: ReturnType>; - registerRoute: (route: Omit) => {}; - unregisterRoute: (route: RouteConfig) => {}; -}; -export {}; -//# sourceMappingURL=RouterContext.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/RouterContext.d.ts.map b/.svelte-kit/__package__/lib/RouterContext.d.ts.map deleted file mode 100644 index de126d4..0000000 --- a/.svelte-kit/__package__/lib/RouterContext.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"RouterContext.d.ts","sourceRoot":"","sources":["../../../../src/lib/RouterContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClC,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,WAAW,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;IACtD,IAAI,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9C,UAAU,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACpD,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;IAC3D,eAAe,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,EAAE,CAAC;CAC7C,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/RouterContext.js b/.svelte-kit/__package__/lib/RouterContext.js deleted file mode 100644 index b607653..0000000 --- a/.svelte-kit/__package__/lib/RouterContext.js +++ /dev/null @@ -1 +0,0 @@ -import { readable } from "svelte/store"; diff --git a/.svelte-kit/__package__/lib/actions.d.ts b/.svelte-kit/__package__/lib/actions.d.ts deleted file mode 100644 index b0616a1..0000000 --- a/.svelte-kit/__package__/lib/actions.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * A link action that can be added to tags rather - * than using the component. - * - * Example: - * ```html - * {post.title} - * ``` - */ -export declare const link: (node: HTMLElement) => { - destroy(): void; -}; -/** - * An action to be added at a root element of your application to - * capture all relative links and push them onto the history stack. - * - * Example: - * ```html - *
- * - * - * - * {#each projects as project} - * {project.title} - * {/each} - * - *
- * ``` - */ -export declare const links: (node: HTMLElement) => { - destroy(): void; -}; -//# sourceMappingURL=actions.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/actions.d.ts.map b/.svelte-kit/__package__/lib/actions.d.ts.map deleted file mode 100644 index 5be8f31..0000000 --- a/.svelte-kit/__package__/lib/actions.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,SAAU,WAAW;;CAyBrC,CAAC;AACF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK,SAAU,WAAW;;CAmCtC,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/actions.js b/.svelte-kit/__package__/lib/actions.js deleted file mode 100644 index 221fe3c..0000000 --- a/.svelte-kit/__package__/lib/actions.js +++ /dev/null @@ -1,81 +0,0 @@ -import { navigate } from "./history.js"; -import { hostMatches, shouldNavigate } from "./utils.js"; -/** - * A link action that can be added to tags rather - * than using the component. - * - * Example: - * ```html - * {post.title} - * ``` - */ -export const link = (node) => { - const onClick = (event) => { - const anchor = event.currentTarget; - if (anchor instanceof HTMLAnchorElement) { - if ((anchor.target === "" || anchor.target === "_self") && - hostMatches(anchor) && - shouldNavigate(event)) { - event.preventDefault(); - navigate(anchor.pathname + anchor.search, { - replace: anchor.hasAttribute("replace"), - preserveScroll: anchor.hasAttribute("preserveScroll"), - }); - } - } - }; - node.addEventListener("click", onClick); - return { - destroy() { - node.removeEventListener("click", onClick); - }, - }; -}; -/** - * An action to be added at a root element of your application to - * capture all relative links and push them onto the history stack. - * - * Example: - * ```html - *
- * - * - * - * {#each projects as project} - * {project.title} - * {/each} - * - *
- * ``` - */ -export const links = (node) => { - const findClosest = (tagName, el) => { - while (el && el.tagName !== tagName && el.parentElement) - el = el.parentElement; - return el; - }; - const onClick = (event) => { - if (event.target instanceof HTMLElement) { - const anchor = findClosest("A", event.target); - if (anchor instanceof HTMLAnchorElement) { - if (anchor && - (anchor.target === "" || anchor.target === "_self") && - hostMatches(anchor) && - shouldNavigate(event) && - !anchor.hasAttribute("noroute")) { - event.preventDefault(); - navigate(anchor.pathname + anchor.search, { - replace: anchor.hasAttribute("replace"), - preserveScroll: anchor.hasAttribute("preserveScroll"), - }); - } - } - } - }; - node.addEventListener("click", onClick); - return { - destroy() { - node.removeEventListener("click", onClick); - }, - }; -}; diff --git a/.svelte-kit/__package__/lib/contexts.d.ts b/.svelte-kit/__package__/lib/contexts.d.ts deleted file mode 100644 index 7dcc813..0000000 --- a/.svelte-kit/__package__/lib/contexts.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { RouterContext } from "../lib/RouterContext"; -import type { RouteLocation } from "../components/Route/Route"; -export declare const LOCATION: {}; -export declare const ROUTER: {}; -export declare const HISTORY: {}; -export declare const useInternalLocation: () => import("svelte/store").Writable; -export declare const useLocation: () => import("svelte/store").Readable; -export declare const useRouter: () => RouterContext; -export declare const useHistory: () => { - readonly location: ReturnType<(source: typeof window) => Location & { - state: any; - key: string; - }>; - listen: (listener: (params: { - location: ReturnType<(source: typeof window) => Location & { - state: any; - key: string; - }>; - action: "POP" | "PUSH"; - preserveScroll?: boolean; - }) => void) => () => void; - navigate: (to: string, options?: { - replace?: boolean; - state?: { [k in string | number]: unknown; }; - preserveScroll?: boolean; - blurActiveElement?: boolean; - }) => void; -}; -//# sourceMappingURL=contexts.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/contexts.d.ts.map b/.svelte-kit/__package__/lib/contexts.d.ts.map deleted file mode 100644 index 3d326cf..0000000 --- a/.svelte-kit/__package__/lib/contexts.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../../src/lib/contexts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,QAAQ,IAAK,CAAC;AAC3B,eAAO,MAAM,MAAM,IAAK,CAAC;AACzB,eAAO,MAAM,OAAO,IAAK,CAAC;AAM1B,eAAO,MAAM,mBAAmB,sDACkC,CAAC;AAEnE,eAAO,MAAM,WAAW,sDAA8C,CAAC;AACvE,eAAO,MAAM,SAAS,qBAA0C,CAAC;AACjE,eAAO,MAAM,UAAU;;;;;;;;;;;sBAAD,CAAC;;kCACuN,CAAC;eAAkB,CAAC;aAAuB,CAAC;sBAA6E,CAAC;yBAAmC,CAAC;;CADzU,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/contexts.js b/.svelte-kit/__package__/lib/contexts.js deleted file mode 100644 index 8fdb9a6..0000000 --- a/.svelte-kit/__package__/lib/contexts.js +++ /dev/null @@ -1,10 +0,0 @@ -import { getContext } from "svelte"; -import { readable, writable } from "svelte/store"; -import { globalHistory } from "./history"; -export const LOCATION = {}; -export const ROUTER = {}; -export const HISTORY = {}; -export const useInternalLocation = () => getContext(LOCATION); -export const useLocation = () => getContext(LOCATION); -export const useRouter = () => getContext(ROUTER); -export const useHistory = () => getContext(HISTORY); diff --git a/.svelte-kit/__package__/lib/history.d.ts b/.svelte-kit/__package__/lib/history.d.ts deleted file mode 100644 index 81404c0..0000000 --- a/.svelte-kit/__package__/lib/history.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -export type HistoryListener = (event: { - location: ReturnType; - action: string; - preserveScroll?: boolean; -}) => void; -declare const getLocation: (source: typeof window) => Location & { - state: any; - key: string; -}; -type Listener = (params: { - location: ReturnType; - action: "POP" | "PUSH"; - preserveScroll?: boolean; -}) => void; -type StackItem = { - pathname: string; - search: string; -}; -declare const createHistory: (source: typeof window) => { - readonly location: ReturnType; - listen: (listener: Listener) => () => void; - navigate: (to: string, options?: { - replace?: boolean; - state?: { [k in string | number]: unknown; }; - preserveScroll?: boolean; - blurActiveElement?: boolean; - }) => void; -}; -declare const createMemorySource: (initialPathname?: string) => { - readonly location: StackItem; - addEventListener: typeof window.addEventListener; - removeEventListener: typeof window.removeEventListener; - history: { - readonly entries: StackItem[]; - readonly index: number; - readonly state: any; - pushState: (state: any, _: unknown, uri: string) => void; - replaceState: (state: any, _: unknown, uri: string) => void; - }; -}; -declare const globalHistory: { - readonly location: ReturnType; - listen: (listener: Listener) => () => void; - navigate: (to: string, options?: { - replace?: boolean; - state?: { [k in string | number]: unknown; }; - preserveScroll?: boolean; - blurActiveElement?: boolean; - }) => void; -}; -declare const navigate: (to: string, options?: { - replace?: boolean; - state?: { [k in string | number]: unknown; }; - preserveScroll?: boolean; - blurActiveElement?: boolean; -}) => void, listen: (listener: Listener) => () => void; -export { globalHistory, navigate, listen, createHistory, createMemorySource }; -//# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/history.d.ts.map b/.svelte-kit/__package__/lib/history.d.ts.map deleted file mode 100644 index 3f01dd0..0000000 --- a/.svelte-kit/__package__/lib/history.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/lib/history.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE;IACpC,QAAQ,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,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MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;QACpB,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QACzD,YAAY,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;KAC7D,CAAC;CAmCH,CAAC;AAGF,QAAA,MAAM,aAAa;uBAnHE,UAAU,CAAC,OAAO,WAAW,CAAC;YACzC,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,IAAI;cAChC,CACR,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,GACL,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,GAChC,CAAC;QACF,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,KACE,IAAI;CAyGV,CAAC;AACF,QAAA,MAAQ,QAAQ,OAnHR,MAAM,YACA;IACR,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,GACL,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,GAChC,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,KACE,IAAI,EA0GO,MAAM,aArHH,QAAQ,KAAK,MAAM,IAqHE,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/history.js b/.svelte-kit/__package__/lib/history.js deleted file mode 100644 index 09754fa..0000000 --- a/.svelte-kit/__package__/lib/history.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Adapted from https://github.com/reach/router/blob/b60e6dd781d5d3a4bdaaf4de665649c0f6a7e78d/src/lib/history.js - * https://github.com/reach/router/blob/master/LICENSE - */ -import { canUseDOM } from "./utils"; -const getLocation = (source) => { - return { - ...source.location, - state: source.history.state, - key: (source.history.state && source.history.state.key) || "initial", - }; -}; -const createHistory = (source) => { - const listeners = []; - let location = getLocation(source); - return { - get location() { - return location; - }, - listen(listener) { - listeners.push(listener); - const popstateListener = () => { - location = getLocation(source); - listener({ location, action: "POP" }); - }; - source.addEventListener("popstate", popstateListener); - return () => { - source.removeEventListener("popstate", popstateListener); - const index = listeners.indexOf(listener); - listeners.splice(index, 1); - }; - }, - navigate(to, options) { - let { state = {}, replace = false, preserveScroll = false, blurActiveElement = false, } = options ?? {}; - state = { ...state, key: Date.now() + "" }; - // try...catch iOS Safari limits to 100 pushState calls - try { - if (replace) - source.history.replaceState(state, "", to); - else - source.history.pushState(state, "", to); - } - catch (e) { - source.location[replace ? "replace" : "assign"](to); - } - location = getLocation(source); - listeners.forEach((listener) => listener({ location, action: "PUSH", preserveScroll })); - if (blurActiveElement && document.activeElement instanceof HTMLElement) - document.activeElement.blur(); - }, - }; -}; -// Stores history entries in memory for testing or other platforms like Native -const createMemorySource = (initialPathname = "/") => { - let index = 0; - const stack = [{ pathname: initialPathname, search: "" }]; - const states = []; - return { - get location() { - return stack[index]; - }, - addEventListener() { }, - removeEventListener() { }, - history: { - get entries() { - return stack; - }, - get index() { - return index; - }, - get state() { - return states[index]; - }, - pushState(state, _, uri) { - const [pathname, search = ""] = uri.split("?"); - index++; - stack.push({ pathname, search }); - states.push(state); - }, - replaceState(state, _, uri) { - const [pathname, search = ""] = uri.split("?"); - stack[index] = { pathname, search }; - states[index] = state; - }, - }, - }; -}; -// Global history uses window.history as the source if available, -// otherwise a memory history -const globalHistory = createHistory(canUseDOM() ? window : createMemorySource()); -const { navigate, listen } = globalHistory; -export { globalHistory, navigate, listen, createHistory, createMemorySource }; diff --git a/.svelte-kit/__package__/lib/utils.d.ts b/.svelte-kit/__package__/lib/utils.d.ts deleted file mode 100644 index 6e51ef5..0000000 --- a/.svelte-kit/__package__/lib/utils.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Adapted from https://github.com/reach/router/blob/b60e6dd781d5d3a4bdaaf4de665649c0f6a7e78d/src/lib/utils.js - * https://github.com/reach/router/blob/master/LICENSE - */ -import type { RouteConfig } from "../types/RouterContext"; -/** - * Strip `str` of potential start and end `/` - */ -declare const stripSlashes: (string: string) => string; -/** - * Ranks and picks the best route to match. Each segment gets the highest - * amount of points, then the type of segment gets an additional amount of - * points where - * - * static > dynamic > splat > root - * - * This way we don't have to worry about the order of our routes, let the - * computers do it. - * - * A route looks like this - * - * { path, default, value } - * - * And a returned match looks like: - * - * { route, params, uri } - * - */ -declare const pick: (routes: RouteConfig[], uri: string) => { - route: RouteConfig; - params: Record; - uri: string; -} | null; -/** - * Resolve URIs as though every path is a directory, no files. Relative URIs - * in the browser can feel awkward because not only can you be "in a directory", - * you can be "at a file", too. For example: - * - * browserSpecResolve('foo', '/bar/') => /bar/foo - * browserSpecResolve('foo', '/bar') => /foo - * - * But on the command line of a file system, it's not as complicated. You can't - * `cd` from a file, only directories. This way, links have to know less about - * their current path. To go deeper you can do this: - * - * - * // instead of - * - * - * Just like `cd`, if you want to go deeper from the command line, you do this: - * - * cd deeper - * # not - * cd $(pwd)/deeper - * - * By treating every path as a directory, linking to relative paths should - * require less contextual information and (fingers crossed) be more intuitive. - */ -declare const resolve: (to: string, base: string) => string; -/** - * Combines the `basepath` and the `path` into one path. - */ -declare const combinePaths: (basepath: string, path: string) => string; -/** - * Decides whether a given `event` should result in a navigation or not. - * @param {object} event - */ -declare const shouldNavigate: (event: MouseEvent) => boolean; -declare const hostMatches: (anchor: HTMLAnchorElement) => boolean; -declare const canUseDOM: () => boolean; -export { stripSlashes, pick, resolve, combinePaths, shouldNavigate, hostMatches, canUseDOM, }; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/utils.d.ts.map b/.svelte-kit/__package__/lib/utils.d.ts.map deleted file mode 100644 index 8dc8fe8..0000000 --- a/.svelte-kit/__package__/lib/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAc1D;;GAEG;AACH,QAAA,MAAM,YAAY,WAAY,MAAM,WAAuC,CAAC;AAmC5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,IAAI,WAAY,WAAW,EAAE,OAAO,MAAM;;;;QA6E/C,CAAC;AAMF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,OAAO,OAAQ,MAAM,QAAQ,MAAM,WAiCxC,CAAC;AACF;;GAEG;AACH,QAAA,MAAM,YAAY,aAAc,MAAM,QAAQ,MAAM,WAG9C,CAAC;AACP;;;GAGG;AACH,QAAA,MAAM,cAAc,UAAW,UAAU,YAG4B,CAAC;AAGtE,QAAA,MAAM,WAAW,WAAY,iBAAiB,YAO7C,CAAC;AAEF,QAAA,MAAM,SAAS,eACgE,CAAC;AAEhF,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,GACV,CAAC"} \ No newline at end of file diff --git a/.svelte-kit/__package__/lib/utils.js b/.svelte-kit/__package__/lib/utils.js deleted file mode 100644 index 5f820d9..0000000 --- a/.svelte-kit/__package__/lib/utils.js +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Adapted from https://github.com/reach/router/blob/b60e6dd781d5d3a4bdaaf4de665649c0f6a7e78d/src/lib/utils.js - * https://github.com/reach/router/blob/master/LICENSE - */ -const PARAM = /^:(.+)/; -const SEGMENT_POINTS = 4; -const STATIC_POINTS = 3; -const DYNAMIC_POINTS = 2; -const SPLAT_PENALTY = 1; -const ROOT_POINTS = 1; -/** - * Split up the URI into segments delimited by `/` - * Strip starting/ending `/` - */ -const segmentize = (uri) => uri.replace(/(^\/+|\/+$)/g, "").split("/"); -/** - * Strip `str` of potential start and end `/` - */ -const stripSlashes = (string) => string.replace(/(^\/+|\/+$)/g, ""); -/** - * Score a route depending on how its individual segments look - */ -const rankRoute = (route, index) => { - const score = route.default - ? 0 - : segmentize(route.path).reduce((score, segment) => { - score += SEGMENT_POINTS; - if (segment === "") { - score += ROOT_POINTS; - } - else if (PARAM.test(segment)) { - score += DYNAMIC_POINTS; - } - else if (segment[0] === "*") { - score -= SEGMENT_POINTS + SPLAT_PENALTY; - } - else { - score += STATIC_POINTS; - } - return score; - }, 0); - return { route, score, index }; -}; -/** - * Give a score to all routes and sort them on that - * If two routes have the exact same score, we go by index instead - */ -const rankRoutes = (routes) => routes - .map(rankRoute) - .sort((a, b) => a.score < b.score ? 1 : a.score > b.score ? -1 : a.index - b.index); -/** - * Ranks and picks the best route to match. Each segment gets the highest - * amount of points, then the type of segment gets an additional amount of - * points where - * - * static > dynamic > splat > root - * - * This way we don't have to worry about the order of our routes, let the - * computers do it. - * - * A route looks like this - * - * { path, default, value } - * - * And a returned match looks like: - * - * { route, params, uri } - * - */ -const pick = (routes, uri) => { - let match; - let default_; - const [uriPathname] = uri.split("?"); - const uriSegments = segmentize(uriPathname); - const isRootUri = uriSegments[0] === ""; - const ranked = rankRoutes(routes); - for (let i = 0, l = ranked.length; i < l; i++) { - const route = ranked[i].route; - let missed = false; - if (route.default) { - default_ = { - route, - params: {}, - uri, - }; - continue; - } - const routeSegments = segmentize(route.path); - const params = {}; - const max = Math.max(uriSegments.length, routeSegments.length); - let index = 0; - for (; index < max; index++) { - const routeSegment = routeSegments[index]; - const uriSegment = uriSegments[index]; - if (routeSegment && routeSegment[0] === "*") { - // Hit a splat, just grab the rest, and return a match - // uri: /files/documents/work - // route: /files/* or /files/*splatname - const splatName = routeSegment === "*" ? "*" : routeSegment.slice(1); - params[splatName] = uriSegments - .slice(index) - .map(decodeURIComponent) - .join("/"); - break; - } - if (typeof uriSegment === "undefined") { - // URI is shorter than the route, no match - // uri: /users - // route: /users/:userId - missed = true; - break; - } - const dynamicMatch = PARAM.exec(routeSegment); - if (dynamicMatch && !isRootUri) { - const value = decodeURIComponent(uriSegment); - params[dynamicMatch[1]] = value; - } - else if (routeSegment !== uriSegment) { - // Current segments don't match, not dynamic, not splat, so no match - // uri: /users/123/settings - // route: /users/:id/profile - missed = true; - break; - } - } - if (!missed) { - match = { - route, - params, - uri: "/" + uriSegments.slice(0, index).join("/"), - }; - break; - } - } - return match || default_ || null; -}; -/** - * Add the query to the pathname if a query is given - */ -const addQuery = (pathname, query) => pathname + (query ? `?${query}` : ""); -/** - * Resolve URIs as though every path is a directory, no files. Relative URIs - * in the browser can feel awkward because not only can you be "in a directory", - * you can be "at a file", too. For example: - * - * browserSpecResolve('foo', '/bar/') => /bar/foo - * browserSpecResolve('foo', '/bar') => /foo - * - * But on the command line of a file system, it's not as complicated. You can't - * `cd` from a file, only directories. This way, links have to know less about - * their current path. To go deeper you can do this: - * - * - * // instead of - * - * - * Just like `cd`, if you want to go deeper from the command line, you do this: - * - * cd deeper - * # not - * cd $(pwd)/deeper - * - * By treating every path as a directory, linking to relative paths should - * require less contextual information and (fingers crossed) be more intuitive. - */ -const resolve = (to, base) => { - // /foo/bar, /baz/qux => /foo/bar - if (to.startsWith("/")) - return to; - const [toPathname, toQuery] = to.split("?"); - const [basePathname] = base.split("?"); - const toSegments = segmentize(toPathname); - const baseSegments = segmentize(basePathname); - // ?a=b, /users?b=c => /users?a=b - if (toSegments[0] === "") - return addQuery(basePathname, toQuery); - // profile, /users/789 => /users/789/profile - if (!toSegments[0].startsWith(".")) { - const pathname = baseSegments.concat(toSegments).join("/"); - return addQuery((basePathname === "/" ? "" : "/") + pathname, toQuery); - } - // ./ , /users/123 => /users/123 - // ../ , /users/123 => /users - // ../.. , /users/123 => / - // ../../one, /a/b/c/d => /a/b/one - // .././one , /a/b/c/d => /a/b/c/one - const allSegments = baseSegments.concat(toSegments); - const segments = []; - allSegments.forEach((segment) => { - if (segment === "..") - segments.pop(); - else if (segment !== ".") - segments.push(segment); - }); - return addQuery("/" + segments.join("/"), toQuery); -}; -/** - * Combines the `basepath` and the `path` into one path. - */ -const combinePaths = (basepath, path) => `${stripSlashes(path === "/" ? basepath : `${stripSlashes(basepath)}/${stripSlashes(path)}`)}/`; -/** - * Decides whether a given `event` should result in a navigation or not. - * @param {object} event - */ -const shouldNavigate = (event) => !event.defaultPrevented && - event.button === 0 && - !(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); -// svelte seems to kill anchor.host value in ie11, so fall back to checking href -const hostMatches = (anchor) => { - const host = location.host; - return (anchor.host === host || - anchor.href.indexOf(`https://${host}`) === 0 || - anchor.href.indexOf(`http://${host}`) === 0); -}; -const canUseDOM = () => typeof window !== "undefined" && "document" in window && "location" in window; -export { stripSlashes, pick, resolve, combinePaths, shouldNavigate, hostMatches, canUseDOM, }; From 223faf005987c659e70cedad8a587a0e3edd7ac3 Mon Sep 17 00:00:00 2001 From: Piotr Sarna Date: Tue, 7 Oct 2025 17:40:20 +0200 Subject: [PATCH 2/3] Fix registerRoute in SSR mode --- dist/components/Link/Link.d.ts.map | 2 +- dist/components/Link/Link.svelte.d.ts.map | 2 +- dist/components/Route/Route.d.ts.map | 2 +- dist/components/Route/Route.svelte | 7 ++++++- dist/components/Route/Route.svelte.d.ts.map | 2 +- dist/components/Router/Router.d.ts.map | 2 +- dist/components/Router/Router.svelte.d.ts.map | 2 +- dist/index.d.ts.map | 2 +- dist/lib/RouterContext.d.ts.map | 2 +- dist/lib/actions.d.ts.map | 2 +- dist/lib/contexts.d.ts.map | 2 +- dist/lib/history.d.ts.map | 2 +- dist/lib/utils.d.ts.map | 2 +- package.json | 2 +- src/components/Route/Route.svelte | 7 ++++++- 15 files changed, 25 insertions(+), 15 deletions(-) diff --git a/dist/components/Link/Link.d.ts.map b/dist/components/Link/Link.d.ts.map index a0bcb31..a563b5a 100644 --- a/dist/components/Link/Link.d.ts.map +++ b/dist/components/Link/Link.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../../src/components/Link/Link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE;SACL,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO;KAChC,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/D,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACjC,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC"} \ No newline at end of file +{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE;SACL,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO;KAChC,CAAC;IACF,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/D,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACjC,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC"} \ No newline at end of file diff --git a/dist/components/Link/Link.svelte.d.ts.map b/dist/components/Link/Link.svelte.d.ts.map index e1ae3be..9a5d7e0 100644 --- a/dist/components/Link/Link.svelte.d.ts.map +++ b/dist/components/Link/Link.svelte.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Link.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/components/Link/Link.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAyDxC,QAAA,MAAM,IAAI,+CAAsC,CAAC;AACjD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"} \ No newline at end of file +{"version":3,"file":"Link.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAyDxC,QAAA,MAAM,IAAI,+CAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AACpC,eAAe,IAAI,CAAC"} \ No newline at end of file diff --git a/dist/components/Route/Route.d.ts.map b/dist/components/Route/Route.d.ts.map index 92a1431..f50b338 100644 --- a/dist/components/Route/Route.d.ts.map +++ b/dist/components/Route/Route.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../../../../src/components/Route/Route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMjD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IAClC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE;QACP,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;SACJ,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO;KAChC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB,CAAC"} \ No newline at end of file +{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../../src/components/Route/Route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMjD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IAClC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE;QACP,QAAQ,EAAE,aAAa,CAAC;QACxB,MAAM,EAAE,WAAW,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;SACJ,CAAC,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO;KAChC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB,CAAC"} \ No newline at end of file diff --git a/dist/components/Route/Route.svelte b/dist/components/Route/Route.svelte index 698471c..f20d6f5 100644 --- a/dist/components/Route/Route.svelte +++ b/dist/components/Route/Route.svelte @@ -28,7 +28,12 @@ onMount(() => { registerRoute(route); - }); + }) + + // Handle SSR mode + if (typeof window === "undefined") { + registerRoute(route); + } onDestroy(() => { unregisterRoute(route); diff --git a/dist/components/Route/Route.svelte.d.ts.map b/dist/components/Route/Route.svelte.d.ts.map index 3d8d107..b55f3f2 100644 --- a/dist/components/Route/Route.svelte.d.ts.map +++ b/dist/components/Route/Route.svelte.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Route.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/components/Route/Route.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAmD1D,QAAA,MAAM,KAAK,gDAAsC,CAAC;AAClD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"} \ No newline at end of file +{"version":3,"file":"Route.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/Route/Route.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAwD1D,QAAA,MAAM,KAAK,gDAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/dist/components/Router/Router.d.ts.map b/dist/components/Router/Router.d.ts.map index def31b3..4f934bb 100644 --- a/dist/components/Router/Router.d.ts.map +++ b/dist/components/Router/Router.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../../../src/components/Router/Router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,cAAc,CAAC;IACxD,OAAO,CAAC,EAAE,OAAO,aAAa,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;CACnD,CAAC"} \ No newline at end of file +{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../../src/components/Router/Router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,cAAc,CAAC;IACxD,OAAO,CAAC,EAAE,OAAO,aAAa,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;CACnD,CAAC"} \ No newline at end of file diff --git a/dist/components/Router/Router.svelte.d.ts.map b/dist/components/Router/Router.svelte.d.ts.map index 505bf21..7f1dd12 100644 --- a/dist/components/Router/Router.svelte.d.ts.map +++ b/dist/components/Router/Router.svelte.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Router.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/components/Router/Router.svelte.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAoK/D,QAAA,MAAM,MAAM,iDAAsC,CAAC;AACnD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"} \ No newline at end of file +{"version":3,"file":"Router.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/Router/Router.svelte.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAoK/D,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 25839db..d6ec58f 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/dist/lib/RouterContext.d.ts.map b/dist/lib/RouterContext.d.ts.map index de126d4..5afc861 100644 --- a/dist/lib/RouterContext.d.ts.map +++ b/dist/lib/RouterContext.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"RouterContext.d.ts","sourceRoot":"","sources":["../../../../src/lib/RouterContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClC,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,WAAW,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC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AAC,UAAU,CAAC,CAAC,CAAC;IAC9C,UAAU,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACpD,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;IAC3D,eAAe,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,EAAE,CAAC;CAC7C,CAAC"} \ No newline at end of file diff --git a/dist/lib/actions.d.ts.map b/dist/lib/actions.d.ts.map index 5be8f31..c2b006f 100644 --- a/dist/lib/actions.d.ts.map +++ b/dist/lib/actions.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,SAAU,WAAW;;CAyBrC,CAAC;AACF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK,SAAU,WAAW;;CAmCtC,CAAC"} \ No newline at end of file +{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/lib/actions.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,WAAW;;CAyBrC,CAAC;AACF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,WAAW;;CAmCtC,CAAC"} \ No newline at end of file diff --git a/dist/lib/contexts.d.ts.map b/dist/lib/contexts.d.ts.map index 3d326cf..307a096 100644 --- a/dist/lib/contexts.d.ts.map +++ b/dist/lib/contexts.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../../src/lib/contexts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,QAAQ,IAAK,CAAC;AAC3B,eAAO,MAAM,MAAM,IAAK,CAAC;AACzB,eAAO,MAAM,OAAO,IAAK,CAAC;AAM1B,eAAO,MAAM,mBAAmB,sDACkC,CAAC;AAEnE,eAAO,MAAM,WAAW,sDAA8C,CAAC;AACvE,eAAO,MAAM,SAAS,qBAA0C,CAAC;AACjE,eAAO,MAAM,UAAU;;;;;;;;;;;sBAAD,CAAC;;kCACuN,CAAC;eAAkB,CAAC;aAAuB,CAAC;sBAA6E,CAAC;yBAAmC,CAAC;;CADzU,CAAC"} \ No newline at end of file +{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/lib/contexts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,QAAQ,IAAK,CAAC;AAC3B,eAAO,MAAM,MAAM,IAAK,CAAC;AACzB,eAAO,MAAM,OAAO,IAAK,CAAC;AAM1B,eAAO,MAAM,mBAAmB,sDACkC,CAAC;AAEnE,eAAO,MAAM,WAAW,sDAA8C,CAAC;AACvE,eAAO,MAAM,SAAS,qBAA0C,CAAC;AACjE,eAAO,MAAM,UAAU;;;;;;;;;;;sBAAP,CAAC;;kCAC4M,CAAC;eAAiB,CAAC;aAAsB,CAAC;sBAA0E,CAAC;yBAAkC,CAAC;;CADlT,CAAC"} \ No newline at end of file diff --git a/dist/lib/history.d.ts.map b/dist/lib/history.d.ts.map index 3f01dd0..789f382 100644 --- a/dist/lib/history.d.ts.map +++ b/dist/lib/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/lib/history.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE;IACpC,QAAQ,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC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/dist/lib/utils.d.ts.map b/dist/lib/utils.d.ts.map index 8dc8fe8..4f8e647 100644 --- a/dist/lib/utils.d.ts.map +++ b/dist/lib/utils.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAc1D;;GAEG;AACH,QAAA,MAAM,YAAY,WAAY,MAAM,WAAuC,CAAC;AAmC5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,IAAI,WAAY,WAAW,EAAE,OAAO,MAAM;;;;QA6E/C,CAAC;AAMF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,OAAO,OAAQ,MAAM,QAAQ,MAAM,WAiCxC,CAAC;AACF;;GAEG;AACH,QAAA,MAAM,YAAY,aAAc,MAAM,QAAQ,MAAM,WAG9C,CAAC;AACP;;;GAGG;AACH,QAAA,MAAM,cAAc,UAAW,UAAU,YAG4B,CAAC;AAGtE,QAAA,MAAM,WAAW,WAAY,iBAAiB,YAO7C,CAAC;AAEF,QAAA,MAAM,SAAS,eACgE,CAAC;AAEhF,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,GACV,CAAC"} \ No newline at end of file +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAc1D;;GAEG;AACH,QAAA,MAAM,YAAY,GAAI,QAAQ,MAAM,WAAuC,CAAC;AAmC5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,IAAI,GAAI,QAAQ,WAAW,EAAE,EAAE,KAAK,MAAM;;;;QA6E/C,CAAC;AAMF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,OAAO,GAAI,IAAI,MAAM,EAAE,MAAM,MAAM,WAiCxC,CAAC;AACF;;GAEG;AACH,QAAA,MAAM,YAAY,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,WAG9C,CAAC;AACP;;;GAGG;AACH,QAAA,MAAM,cAAc,GAAI,OAAO,UAAU,YAG4B,CAAC;AAGtE,QAAA,MAAM,WAAW,GAAI,QAAQ,iBAAiB,YAO7C,CAAC;AAEF,QAAA,MAAM,SAAS,eACgE,CAAC;AAEhF,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,cAAc,EACd,WAAW,EACX,SAAS,GACV,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index a7c4ee8..8f3d179 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte5-router", - "version": "3.0.2", + "version": "3.0.3", "author": "Jacob Cutshall @jpcutshall", "license": "MIT", "type": "module", diff --git a/src/components/Route/Route.svelte b/src/components/Route/Route.svelte index 698471c..f20d6f5 100755 --- a/src/components/Route/Route.svelte +++ b/src/components/Route/Route.svelte @@ -28,7 +28,12 @@ onMount(() => { registerRoute(route); - }); + }) + + // Handle SSR mode + if (typeof window === "undefined") { + registerRoute(route); + } onDestroy(() => { unregisterRoute(route); From 45af3a3c41ad30be0843f6b5b1f26c0c870321b4 Mon Sep 17 00:00:00 2001 From: Piotr Sarna Date: Mon, 13 Oct 2025 18:05:41 +0200 Subject: [PATCH 3/3] Add url hash support in links --- .../Route/Route_20251007173551.svelte | 51 +++++++++++ .../Route/Route_20251007173857.svelte | 51 +++++++++++ .history/package_20251007172558.json | 62 +++++++++++++ .history/package_20251007173410.json | 62 +++++++++++++ .history/package_20251013180505.json | 62 +++++++++++++ .../Route/Route_20251007172558.svelte | 44 +++++++++ .../Route/Route_20251007173343.svelte | 51 +++++++++++ .history/src/lib/actions_20251007172558.ts | 91 +++++++++++++++++++ .history/src/lib/actions_20251013180410.ts | 91 +++++++++++++++++++ dist/lib/actions.js | 2 +- package.json | 2 +- src/lib/actions.ts | 2 +- 12 files changed, 568 insertions(+), 3 deletions(-) create mode 100644 .history/dist/components/Route/Route_20251007173551.svelte create mode 100644 .history/dist/components/Route/Route_20251007173857.svelte create mode 100644 .history/package_20251007172558.json create mode 100644 .history/package_20251007173410.json create mode 100644 .history/package_20251013180505.json create mode 100644 .history/src/components/Route/Route_20251007172558.svelte create mode 100644 .history/src/components/Route/Route_20251007173343.svelte create mode 100644 .history/src/lib/actions_20251007172558.ts create mode 100644 .history/src/lib/actions_20251013180410.ts diff --git a/.history/dist/components/Route/Route_20251007173551.svelte b/.history/dist/components/Route/Route_20251007173551.svelte new file mode 100644 index 0000000..f20d6f5 --- /dev/null +++ b/.history/dist/components/Route/Route_20251007173551.svelte @@ -0,0 +1,51 @@ + + +{#if $activeRoute && $activeRoute.route === route} + {#if PropComponent} + + {:else} + {@render children?.(routeParams)} + {/if} +{/if} diff --git a/.history/dist/components/Route/Route_20251007173857.svelte b/.history/dist/components/Route/Route_20251007173857.svelte new file mode 100644 index 0000000..c41939d --- /dev/null +++ b/.history/dist/components/Route/Route_20251007173857.svelte @@ -0,0 +1,51 @@ + + +{#if $activeRoute && $activeRoute.route === route} + {#if PropComponent} + + {:else} + {@render children?.(routeParams)} + {/if} +{/if} diff --git a/.history/package_20251007172558.json b/.history/package_20251007172558.json new file mode 100644 index 0000000..a7c4ee8 --- /dev/null +++ b/.history/package_20251007172558.json @@ -0,0 +1,62 @@ +{ + "name": "svelte5-router", + "version": "3.0.2", + "author": "Jacob Cutshall @jpcutshall", + "license": "MIT", + "type": "module", + "description": "A declarative Svelte routing library with SSR support", + "scripts": { + "package": "svelte-package", + "check": "svelte-check --tsconfig ./tsconfig.json", + "test": "vite -c vite.config.ts --force tests/" + }, + "keywords": [ + "svelte routing", + "svelte", + "sveltejs", + "route", + "router", + "routing", + "svelte route", + "svelte router", + "typescript" + ], + "repository": { + "type": "git", + "url": "https://github.com/jpcutshall/svelte5-router.git" + }, + "bugs": { + "url": "https://github.com/jpcutshall/svelte5-router/issues" + }, + "homepage": "https://github.com/jpcutshall/svelte5-router", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js", + "default": "./dist/index.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js", + "default": "./dist/index.js" + } + }, + "files": [ + "dist" + ], + "peerDependencies": { + "svelte": "^5.0.0" + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^3.3.1", + "@sveltejs/package": "^2.3.7", + "@sveltejs/vite-plugin-svelte": "^4.0.1", + "@tsconfig/svelte": "^5.0.4", + "prettier": "^3.2.5", + "prettier-plugin-svelte": "^3.2.3", + "svelte": "^5.2.3", + "svelte-check": "^4.0.9", + "typescript": "^5.6.3", + "vite": "^5.4.11", + "svelte5-router": "./dist" + } +} diff --git a/.history/package_20251007173410.json b/.history/package_20251007173410.json new file mode 100644 index 0000000..8f3d179 --- /dev/null +++ b/.history/package_20251007173410.json @@ -0,0 +1,62 @@ +{ + "name": "svelte5-router", + "version": "3.0.3", + "author": "Jacob Cutshall @jpcutshall", + "license": "MIT", + "type": "module", + "description": "A declarative Svelte routing library with SSR support", + "scripts": { + "package": "svelte-package", + "check": "svelte-check --tsconfig ./tsconfig.json", + "test": "vite -c vite.config.ts --force tests/" + }, + "keywords": [ + "svelte routing", + "svelte", + "sveltejs", + "route", + "router", + "routing", + "svelte route", + "svelte router", + "typescript" + ], + "repository": { + "type": "git", + "url": "https://github.com/jpcutshall/svelte5-router.git" + }, + "bugs": { + "url": "https://github.com/jpcutshall/svelte5-router/issues" + }, + "homepage": "https://github.com/jpcutshall/svelte5-router", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js", + "default": "./dist/index.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js", + "default": "./dist/index.js" + } + }, + "files": [ + "dist" + ], + "peerDependencies": { + "svelte": "^5.0.0" + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^3.3.1", + "@sveltejs/package": "^2.3.7", + "@sveltejs/vite-plugin-svelte": "^4.0.1", + "@tsconfig/svelte": "^5.0.4", + "prettier": "^3.2.5", + "prettier-plugin-svelte": "^3.2.3", + "svelte": "^5.2.3", + "svelte-check": "^4.0.9", + "typescript": "^5.6.3", + "vite": "^5.4.11", + "svelte5-router": "./dist" + } +} diff --git a/.history/package_20251013180505.json b/.history/package_20251013180505.json new file mode 100644 index 0000000..f80b0d2 --- /dev/null +++ b/.history/package_20251013180505.json @@ -0,0 +1,62 @@ +{ + "name": "svelte5-router", + "version": "3.0.4", + "author": "Jacob Cutshall @jpcutshall", + "license": "MIT", + "type": "module", + "description": "A declarative Svelte routing library with SSR support", + "scripts": { + "package": "svelte-package", + "check": "svelte-check --tsconfig ./tsconfig.json", + "test": "vite -c vite.config.ts --force tests/" + }, + "keywords": [ + "svelte routing", + "svelte", + "sveltejs", + "route", + "router", + "routing", + "svelte route", + "svelte router", + "typescript" + ], + "repository": { + "type": "git", + "url": "https://github.com/jpcutshall/svelte5-router.git" + }, + "bugs": { + "url": "https://github.com/jpcutshall/svelte5-router/issues" + }, + "homepage": "https://github.com/jpcutshall/svelte5-router", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js", + "default": "./dist/index.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js", + "default": "./dist/index.js" + } + }, + "files": [ + "dist" + ], + "peerDependencies": { + "svelte": "^5.0.0" + }, + "devDependencies": { + "@sveltejs/adapter-auto": "^3.3.1", + "@sveltejs/package": "^2.3.7", + "@sveltejs/vite-plugin-svelte": "^4.0.1", + "@tsconfig/svelte": "^5.0.4", + "prettier": "^3.2.5", + "prettier-plugin-svelte": "^3.2.3", + "svelte": "^5.2.3", + "svelte-check": "^4.0.9", + "typescript": "^5.6.3", + "vite": "^5.4.11", + "svelte5-router": "./dist" + } +} diff --git a/.history/src/components/Route/Route_20251007172558.svelte b/.history/src/components/Route/Route_20251007172558.svelte new file mode 100644 index 0000000..8a6c72c --- /dev/null +++ b/.history/src/components/Route/Route_20251007172558.svelte @@ -0,0 +1,44 @@ + + +{#if $activeRoute && $activeRoute.route === route} + {#if PropComponent} + + {:else} + {@render children?.(routeParams)} + {/if} +{/if} diff --git a/.history/src/components/Route/Route_20251007173343.svelte b/.history/src/components/Route/Route_20251007173343.svelte new file mode 100644 index 0000000..f20d6f5 --- /dev/null +++ b/.history/src/components/Route/Route_20251007173343.svelte @@ -0,0 +1,51 @@ + + +{#if $activeRoute && $activeRoute.route === route} + {#if PropComponent} + + {:else} + {@render children?.(routeParams)} + {/if} +{/if} diff --git a/.history/src/lib/actions_20251007172558.ts b/.history/src/lib/actions_20251007172558.ts new file mode 100644 index 0000000..301abd6 --- /dev/null +++ b/.history/src/lib/actions_20251007172558.ts @@ -0,0 +1,91 @@ +import { navigate } from "./history.js"; +import { hostMatches, shouldNavigate } from "./utils.js"; + +/** + * A link action that can be added to tags rather + * than using the component. + * + * Example: + * ```html + * {post.title} + * ``` + */ +export const link = (node: HTMLElement) => { + const onClick = (event: MouseEvent) => { + const anchor = event.currentTarget; + if (anchor instanceof HTMLAnchorElement) { + if ( + (anchor.target === "" || anchor.target === "_self") && + hostMatches(anchor) && + shouldNavigate(event) + ) { + event.preventDefault(); + navigate(anchor.pathname + anchor.search, { + replace: anchor.hasAttribute("replace"), + preserveScroll: anchor.hasAttribute("preserveScroll"), + }); + } + } + }; + + node.addEventListener("click", onClick); + + return { + destroy() { + node.removeEventListener("click", onClick); + }, + }; +}; +/** + * An action to be added at a root element of your application to + * capture all relative links and push them onto the history stack. + * + * Example: + * ```html + *
+ * + * + * + * {#each projects as project} + * {project.title} + * {/each} + * + *
+ * ``` + */ +export const links = (node: HTMLElement) => { + const findClosest = (tagName: string, el: HTMLElement) => { + while (el && el.tagName !== tagName && el.parentElement) + el = el.parentElement; + return el; + }; + + const onClick = (event: MouseEvent) => { + if (event.target instanceof HTMLElement) { + const anchor = findClosest("A", event.target); + if (anchor instanceof HTMLAnchorElement) { + if ( + anchor && + (anchor.target === "" || anchor.target === "_self") && + hostMatches(anchor) && + shouldNavigate(event) && + !anchor.hasAttribute("noroute") + ) { + event.preventDefault(); + navigate(anchor.pathname + anchor.search, { + replace: anchor.hasAttribute("replace"), + preserveScroll: anchor.hasAttribute("preserveScroll"), + }); + } + } + } + }; + + node.addEventListener("click", onClick); + + return { + destroy() { + node.removeEventListener("click", onClick); + }, + }; +}; diff --git a/.history/src/lib/actions_20251013180410.ts b/.history/src/lib/actions_20251013180410.ts new file mode 100644 index 0000000..b148245 --- /dev/null +++ b/.history/src/lib/actions_20251013180410.ts @@ -0,0 +1,91 @@ +import { navigate } from "./history.js"; +import { hostMatches, shouldNavigate } from "./utils.js"; + +/** + * A link action that can be added to tags rather + * than using the component. + * + * Example: + * ```html + * {post.title} + * ``` + */ +export const link = (node: HTMLElement) => { + const onClick = (event: MouseEvent) => { + const anchor = event.currentTarget; + if (anchor instanceof HTMLAnchorElement) { + if ( + (anchor.target === "" || anchor.target === "_self") && + hostMatches(anchor) && + shouldNavigate(event) + ) { + event.preventDefault(); + navigate(anchor.pathname + anchor.hash + anchor.search, { + replace: anchor.hasAttribute("replace"), + preserveScroll: anchor.hasAttribute("preserveScroll"), + }); + } + } + }; + + node.addEventListener("click", onClick); + + return { + destroy() { + node.removeEventListener("click", onClick); + }, + }; +}; +/** + * An action to be added at a root element of your application to + * capture all relative links and push them onto the history stack. + * + * Example: + * ```html + *
+ * + * + * + * {#each projects as project} + * {project.title} + * {/each} + * + *
+ * ``` + */ +export const links = (node: HTMLElement) => { + const findClosest = (tagName: string, el: HTMLElement) => { + while (el && el.tagName !== tagName && el.parentElement) + el = el.parentElement; + return el; + }; + + const onClick = (event: MouseEvent) => { + if (event.target instanceof HTMLElement) { + const anchor = findClosest("A", event.target); + if (anchor instanceof HTMLAnchorElement) { + if ( + anchor && + (anchor.target === "" || anchor.target === "_self") && + hostMatches(anchor) && + shouldNavigate(event) && + !anchor.hasAttribute("noroute") + ) { + event.preventDefault(); + navigate(anchor.pathname + anchor.search, { + replace: anchor.hasAttribute("replace"), + preserveScroll: anchor.hasAttribute("preserveScroll"), + }); + } + } + } + }; + + node.addEventListener("click", onClick); + + return { + destroy() { + node.removeEventListener("click", onClick); + }, + }; +}; diff --git a/dist/lib/actions.js b/dist/lib/actions.js index 221fe3c..03b4255 100644 --- a/dist/lib/actions.js +++ b/dist/lib/actions.js @@ -17,7 +17,7 @@ export const link = (node) => { hostMatches(anchor) && shouldNavigate(event)) { event.preventDefault(); - navigate(anchor.pathname + anchor.search, { + navigate(anchor.pathname + anchor.hash + anchor.search, { replace: anchor.hasAttribute("replace"), preserveScroll: anchor.hasAttribute("preserveScroll"), }); diff --git a/package.json b/package.json index 8f3d179..f80b0d2 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svelte5-router", - "version": "3.0.3", + "version": "3.0.4", "author": "Jacob Cutshall @jpcutshall", "license": "MIT", "type": "module", diff --git a/src/lib/actions.ts b/src/lib/actions.ts index 301abd6..b148245 100755 --- a/src/lib/actions.ts +++ b/src/lib/actions.ts @@ -20,7 +20,7 @@ export const link = (node: HTMLElement) => { shouldNavigate(event) ) { event.preventDefault(); - navigate(anchor.pathname + anchor.search, { + navigate(anchor.pathname + anchor.hash + anchor.search, { replace: anchor.hasAttribute("replace"), preserveScroll: anchor.hasAttribute("preserveScroll"), });