@xmachines/play-sveltekit-router 2.1.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  SvelteKit router adapter for the XMachines Universal Player Architecture. It keeps the state machine routes of a `RoutableActor` and the browser URL in step, in both directions, through the `$app/navigation` module of SvelteKit.
4
4
 
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.1.1-blue)](https://www.npmjs.com/package/@xmachines/play-sveltekit-router)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-3.0.0-blue)](https://www.npmjs.com/package/@xmachines/play-sveltekit-router)
6
6
 
7
7
  ## Installation
8
8
 
@@ -1,5 +1,6 @@
1
- import type { RoutableActor, RouteMap, LocationLike } from "@xmachines/play-router";
2
- export interface ConnectRouterOptions {
1
+ import { type RouterConnection } from "@xmachines/play-router";
2
+ import type { BasePathOptions, RoutableActor, RouteMap, LocationLike } from "@xmachines/play-router";
3
+ export interface ConnectRouterOptions extends BasePathOptions {
3
4
  readonly actor: RoutableActor;
4
5
  readonly routeMap: RouteMap;
5
6
  /**
@@ -22,5 +23,5 @@ export interface ConnectRouterOptions {
22
23
  * onDestroy(() => disconnect());
23
24
  * ```
24
25
  */
25
- export declare function connectRouter(options: ConnectRouterOptions): () => void;
26
+ export declare function connectRouter(options: ConnectRouterOptions): RouterConnection;
26
27
  //# sourceMappingURL=connect-router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-router.d.ts","sourceRoot":"","sources":["../src/connect-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGpF,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAIvE"}
1
+ {"version":3,"file":"connect-router.d.ts","sourceRoot":"","sources":["../src/connect-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EACX,eAAe,EACf,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC5D,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,gBAAgB,CAO7E"}
@@ -1,3 +1,4 @@
1
+ import { createRouterConnection } from "@xmachines/play-router";
1
2
  import { SvelteKitRouterBridge } from "./sveltekit-router-bridge.js";
2
3
  /**
3
4
  * Connects the SvelteKit router to an actor.
@@ -13,8 +14,11 @@ import { SvelteKitRouterBridge } from "./sveltekit-router-bridge.js";
13
14
  * ```
14
15
  */
15
16
  export function connectRouter(options) {
16
- const bridge = new SvelteKitRouterBridge(options.actor, options.routeMap, options.location);
17
+ const bridge = new SvelteKitRouterBridge(options.actor, options.routeMap, options.location, {
18
+ basePath: options.basePath,
19
+ basePathParams: options.basePathParams,
20
+ });
17
21
  bridge.connect();
18
- return () => bridge.disconnect();
22
+ return createRouterConnection(bridge);
19
23
  }
20
24
  //# sourceMappingURL=connect-router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-router.js","sourceRoot":"","sources":["../src/connect-router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAarE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,OAA6B;IAC1D,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5F,MAAM,CAAC,OAAO,EAAE,CAAC;IACjB,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;AAClC,CAAC"}
1
+ {"version":3,"file":"connect-router.js","sourceRoot":"","sources":["../src/connect-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAyB,MAAM,wBAAwB,CAAC;AAOvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAarE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,OAA6B;IAC1D,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;QAC3F,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;KACtC,CAAC,CAAC;IACH,MAAM,CAAC,OAAO,EAAE,CAAC;IACjB,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  export { RouteMap, createRouteMap, type RouteMapping, type RouteMapOptions, } from "@xmachines/play-router";
5
5
  export { SvelteKitRouterBridge } from "./sveltekit-router-bridge.js";
6
6
  export { connectRouter } from "./connect-router.js";
7
+ export type { BasePathOptions, RouterConnection } from "@xmachines/play-router";
7
8
  export type { ConnectRouterOptions } from "./connect-router.js";
8
9
  export type { LocationLike } from "@xmachines/play-router";
9
10
  export type { PlayRouteEvent, RouterBridge, RoutableActor } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { RouterBridgeBase } from "@xmachines/play-router";
2
2
  import type { LocationLike, RouteMap } from "@xmachines/play-router";
3
3
  import type { RoutableActor } from "@xmachines/play-router";
4
+ import type { BasePathOptions } from "@xmachines/play-router";
4
5
  /**
5
6
  * The SvelteKit router bridge — it connects the SvelteKit navigation to RouterBridgeBase.
6
7
  *
@@ -38,7 +39,7 @@ export declare class SvelteKitRouterBridge extends RouterBridgeBase {
38
39
  * callback registry of SvelteKit untouched.
39
40
  */
40
41
  private afterNavigateCell;
41
- constructor(actor: RoutableActor, routeMap: RouteMap, loc?: LocationLike | null);
42
+ constructor(actor: RoutableActor, routeMap: RouteMap, loc?: LocationLike | null, options?: BasePathOptions);
42
43
  /**
43
44
  * Pushes a RESOLVED concrete URL path through the SvelteKit `goto` function.
44
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit-router-bridge.d.ts","sourceRoot":"","sources":["../src/sveltekit-router-bridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAc5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,qBAAsB,SAAQ,gBAAgB;IAC1D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAsB;IAE1C;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,iBAAiB,CAAsC;gBAG9D,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,EAClB,GAAG,GAAE,YAAY,GAAG,IAAmE;IAMxF;;;;;;OAMG;IACH,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI5C,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAmBpC;;;;;;;OAOG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;cAOnB,oBAAoB,IAAI,MAAM,GAAG,IAAI;cAIrC,sBAAsB,IAAI,MAAM,GAAG,SAAS;CAG/D"}
1
+ {"version":3,"file":"sveltekit-router-bridge.d.ts","sourceRoot":"","sources":["../src/sveltekit-router-bridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAc9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,qBAAsB,SAAQ,gBAAgB;IAC1D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAsB;IAE1C;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,iBAAiB,CAAsC;gBAG9D,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,QAAQ,EAClB,GAAG,GAAE,YAAY,GAAG,IAAmE,EACvF,OAAO,CAAC,EAAE,eAAe;IAM1B;;;;;;OAMG;IACH,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI5C,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAmBpC;;;;;;;OAOG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;cAOnB,oBAAoB,IAAI,MAAM,GAAG,IAAI;cAIrC,sBAAsB,IAAI,MAAM,GAAG,SAAS;CAG/D"}
@@ -37,8 +37,8 @@ export class SvelteKitRouterBridge extends RouterBridgeBase {
37
37
  * callback registry of SvelteKit untouched.
38
38
  */
39
39
  afterNavigateCell = null;
40
- constructor(actor, routeMap, loc = globalThis.location ?? null) {
41
- super(actor, routeMap);
40
+ constructor(actor, routeMap, loc = globalThis.location ?? null, options) {
41
+ super(actor, routeMap, options);
42
42
  this.loc = loc;
43
43
  }
44
44
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit-router-bridge.js","sourceRoot":"","sources":["../src/sveltekit-router-bridge.ts"],"names":[],"mappings":"AAAA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CAAC,CAAC,UAAU,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEpB,MAAM,GAAG,GAAG,UAAU,CAAC,EAAE,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC;YAC7C,oBAAoB;YACpB,IAAI,CAAC,GAAG;gBAAE,OAAO;YAEjB,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACO,oBAAoB;QAC7B,IAAI,IAAI,CAAC,iBAAiB,KAAK,IAAI,EAAE,CAAC;YACrC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;YACrC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC/B,CAAC;IACF,CAAC;IAEkB,oBAAoB;QACtC,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ,IAAI,IAAI,CAAC;IACnC,CAAC;IAEkB,sBAAsB;QACxC,OAAO,IAAI,CAAC,GAAG,EAAE,MAAM,IAAI,SAAS,CAAC;IACtC,CAAC;CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-sveltekit-router",
3
- "version": "2.1.1",
3
+ "version": "3.0.0",
4
4
  "description": "SvelteKit router adapter for XMachines Universal Player Architecture",
5
5
  "keywords": [
6
6
  "adapter",
@@ -46,10 +46,10 @@
46
46
  "clean": "rm -rf dist *.tsbuildinfo coverage .vitest-attachments node_modules/.svelte2tsx-* node_modules/.vite*"
47
47
  },
48
48
  "dependencies": {
49
- "@xmachines/play": "2.1.1",
50
- "@xmachines/play-actor": "2.1.1",
51
- "@xmachines/play-router": "2.1.1",
52
- "@xmachines/play-signals": "2.1.1"
49
+ "@xmachines/play": "3.0.0",
50
+ "@xmachines/play-actor": "3.0.0",
51
+ "@xmachines/play-router": "3.0.0",
52
+ "@xmachines/play-signals": "3.0.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@sveltejs/kit": "^2.70.2",
@@ -57,7 +57,7 @@
57
57
  "@testing-library/jest-dom": "^6.9.1",
58
58
  "@types/node": "^26.2.0",
59
59
  "@vitest/browser-playwright": "^4.1.11",
60
- "@xmachines/play-svelte": "2.1.1",
60
+ "@xmachines/play-svelte": "3.0.0",
61
61
  "oxfmt": "^0.64.0",
62
62
  "oxlint": "^1.79.0",
63
63
  "svelte": "^5.55.5",