@xmachines/play-router 6.0.0 → 6.1.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 +7 -8
- package/dist/router-bridge-base.d.ts +1 -1
- package/dist/router-bridge-base.js +1 -1
- package/dist/types.d.ts +17 -17
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Route tree extraction from XState v5 state machines. Part of [@xmachines/play](../play/README.md) Universal Player Architecture.
|
|
4
4
|
|
|
5
|
-
[](https://opensource.org/licenses/MIT) [](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-router)
|
|
6
6
|
|
|
7
7
|
This package extracts the routes from a machine graph and looks them up in both directions. The Actor therefore keeps the authority over the navigation.
|
|
8
8
|
|
|
@@ -588,18 +588,17 @@ breadcrumb. It also carries three fields that the routing layer reads:
|
|
|
588
588
|
| --------- | -------- | ------------------------------------------------------------------------------- |
|
|
589
589
|
| `path` | required | The template of the route path |
|
|
590
590
|
| `handler` | `"root"` | Where the generated `play.route` transition sits: `"root"`, `"local"`, `"both"` |
|
|
591
|
-
| `reenter` | `false` | Whether the transition re-enters its
|
|
591
|
+
| `reenter` | `false` | Whether the transition re-enters its domain |
|
|
592
592
|
| `data` | none | The extra data of the route: a literal value, or a function of the event |
|
|
593
593
|
|
|
594
594
|
[`@xmachines/play-xstate`](../play-xstate/README.md) reads `handler`, `reenter`, and `data` when it generates the
|
|
595
595
|
transitions. See the README of that package for what each value does.
|
|
596
596
|
|
|
597
|
-
**The four names are RESERVED
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
Give such a field another name.
|
|
597
|
+
**The four names are RESERVED.** The routing layer reads each of them, so a field of
|
|
598
|
+
your own under one of these names changes the machine. An unknown `handler` value throws
|
|
599
|
+
an `InvalidRouteHandlerError` at the format time, and the machine builds never. A `data`
|
|
600
|
+
value goes to `context.data`, where the `/context` projection of every view reads it.
|
|
601
|
+
Give a field of your own another name.
|
|
603
602
|
|
|
604
603
|
### Relative vs absolute paths
|
|
605
604
|
|
|
@@ -487,7 +487,7 @@ export declare abstract class RouterBridgeBase implements MountableRouterBridge
|
|
|
487
487
|
/**
|
|
488
488
|
* Reads the path parameters of a URL, with the URLPattern API.
|
|
489
489
|
*
|
|
490
|
-
* The API is always present: `@xmachines/play-
|
|
490
|
+
* The API is always present: `@xmachines/play-url` uses the native URLPattern of the
|
|
491
491
|
* runtime, and it falls back to `urlpattern-polyfill`, which it carries as an ordinary
|
|
492
492
|
* dependency. A consumer therefore loads nothing, whatever the runtime.
|
|
493
493
|
*
|
|
@@ -1176,7 +1176,7 @@ export class RouterBridgeBase {
|
|
|
1176
1176
|
/**
|
|
1177
1177
|
* Reads the path parameters of a URL, with the URLPattern API.
|
|
1178
1178
|
*
|
|
1179
|
-
* The API is always present: `@xmachines/play-
|
|
1179
|
+
* The API is always present: `@xmachines/play-url` uses the native URLPattern of the
|
|
1180
1180
|
* runtime, and it falls back to `urlpattern-polyfill`, which it carries as an ordinary
|
|
1181
1181
|
* dependency. A consumer therefore loads nothing, whatever the runtime.
|
|
1182
1182
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -45,18 +45,21 @@ export interface RouteObject {
|
|
|
45
45
|
* two siblings therefore still runs the `entry` action of their shared parent.
|
|
46
46
|
*
|
|
47
47
|
* {@link RouteObject.handler} is the field that spares those intermediate ancestors:
|
|
48
|
-
* `"local"` and `"both"` move the domain down to the parent of the state
|
|
49
|
-
* two fields together where an `entry` action must run one
|
|
50
|
-
* the actor really enters.
|
|
48
|
+
* `"local"` and `"both"` move the domain down to the parent of the state, while the
|
|
49
|
+
* parent is active. Use the two fields together where an `entry` action must run one
|
|
50
|
+
* time for each state that the actor really enters. The target itself re-enters
|
|
51
|
+
* under both settings, so a route to the state that the actor already holds runs the
|
|
52
|
+
* `exit` and `entry` actions of that state again. The ROOT of the machine is the one
|
|
53
|
+
* exception: a route to the root has the root as its domain, so the flag decides.
|
|
51
54
|
*
|
|
52
55
|
* Set the field to `true` where the domain must run its `entry` actions again on
|
|
53
|
-
*
|
|
56
|
+
* each route to this state. The flag of a state applies to the routes to that state
|
|
57
|
+
* alone, and not to the routes to its descendants.
|
|
54
58
|
*
|
|
55
59
|
* The flag does not decide the destination. The value of the machine after a route
|
|
56
60
|
* is identical under both settings. A route to a state that has children still
|
|
57
|
-
* enters the `initial` child of that state, because the
|
|
58
|
-
*
|
|
59
|
-
* both settings.
|
|
61
|
+
* enters the `initial` child of that state, because XState enters the initial child
|
|
62
|
+
* of a compound target under both settings.
|
|
60
63
|
*
|
|
61
64
|
* @see [Play RFC](../../docs/rfc/play.md)
|
|
62
65
|
*/
|
|
@@ -73,8 +76,8 @@ export interface RouteObject {
|
|
|
73
76
|
*
|
|
74
77
|
* `"local"` installs the transition on the PARENT of this state instead, and it
|
|
75
78
|
* targets this state relatively. XState offers the transitions of the deepest active
|
|
76
|
-
* state node first, so the parent answers the event itself
|
|
77
|
-
* its `entry` actions
|
|
79
|
+
* state node first, so the parent answers the event itself. The parent then runs its
|
|
80
|
+
* `exit` and its `entry` actions again only where the state declares `reenter: true`.
|
|
78
81
|
*
|
|
79
82
|
* `"both"` installs one transition in each place. The local one answers while the
|
|
80
83
|
* parent is active, and the root one answers a route that arrives from outside the
|
|
@@ -132,14 +135,11 @@ export interface RouteObject {
|
|
|
132
135
|
* The additional metadata of the route: a title, a breadcrumb, and so on.
|
|
133
136
|
*
|
|
134
137
|
* CAUTION: `path`, `handler`, `reenter` and `data` are RESERVED. The routing layer
|
|
135
|
-
* reads those four names
|
|
136
|
-
*
|
|
137
|
-
* `
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* generated transition, and the literal `true` alone turns the reentry on: the
|
|
141
|
-
* default is `false`, and a release before this one generated every transition with
|
|
142
|
-
* `reenter: true`. Give such a field another name.
|
|
138
|
+
* reads those four names. An unknown `handler` value throws an
|
|
139
|
+
* `InvalidRouteHandlerError` from `formatPlayRouteTransitions`, so the machine builds
|
|
140
|
+
* never. A `data` value goes to `context.data`, where the `/context` projection of
|
|
141
|
+
* every view reads it. A `reenter` value is the FLAG of the generated transition, and
|
|
142
|
+
* the literal `true` alone turns the reentry on. Give a field of your own another name.
|
|
143
143
|
*/
|
|
144
144
|
[key: string]: unknown;
|
|
145
145
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,KAAK,SAAS,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB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,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACtD;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmachines/play-router",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Route maps, the router bridge base and the Routable capability of @xmachines/play. It names no state machine; the machine half is the ./xstate subpath.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"routing",
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
"test:coverage": "vitest run --coverage"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@xmachines/play-url": "6.
|
|
56
|
+
"@xmachines/play-url": "6.1.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@statelyai/graph": "^2.4.0",
|
|
60
60
|
"@testing-library/jest-dom": "^7.0.1",
|
|
61
61
|
"@types/node": "^26.6.2",
|
|
62
62
|
"@vitest/browser-playwright": "^5.0.1",
|
|
63
|
-
"@xmachines/core": "6.
|
|
64
|
-
"@xmachines/play": "6.
|
|
65
|
-
"@xmachines/play-atom": "6.
|
|
66
|
-
"@xmachines/play-view": "6.
|
|
63
|
+
"@xmachines/core": "6.1.0",
|
|
64
|
+
"@xmachines/play": "6.1.0",
|
|
65
|
+
"@xmachines/play-atom": "6.1.0",
|
|
66
|
+
"@xmachines/play-view": "6.1.0",
|
|
67
67
|
"oxfmt": "^0.70.0",
|
|
68
68
|
"oxlint": "^1.85.0",
|
|
69
69
|
"typescript": "^5.9.3 || ^6.0.3",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@statelyai/graph": "^2.4.0",
|
|
76
|
-
"@xmachines/core": "6.
|
|
77
|
-
"@xmachines/play": "6.
|
|
78
|
-
"@xmachines/play-atom": "6.
|
|
76
|
+
"@xmachines/core": "6.1.0",
|
|
77
|
+
"@xmachines/play": "6.1.0",
|
|
78
|
+
"@xmachines/play-atom": "6.1.0",
|
|
79
79
|
"xstate": "^5.33.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|