@koordinates/xstate-tree 5.1.0-next.2 → 5.1.0-next.4
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/lib/utils.js +1 -10
- package/lib/xstate-tree.d.ts +7 -0
- package/lib/xstateTree.js +1 -1
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toJSON = exports.mergeMeta = exports.isNil = exports.isEqual = exports.difference = exports.
|
|
3
|
+
exports.toJSON = exports.mergeMeta = exports.isNil = exports.isEqual = exports.difference = exports.assert = exports.assertIsDefined = exports.delay = void 0;
|
|
4
4
|
function delay(ms = 0) {
|
|
5
5
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6
6
|
}
|
|
@@ -26,15 +26,6 @@ function assert(value, msg) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.assert = assert;
|
|
29
|
-
function isLikelyPageLoad() {
|
|
30
|
-
// without performance API, we can't tell if this is a page load
|
|
31
|
-
if (typeof performance === "undefined") {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
// if it's been < 5 seconds since the page was loaded, it's probably a page load
|
|
35
|
-
return performance.now() < 5000;
|
|
36
|
-
}
|
|
37
|
-
exports.isLikelyPageLoad = isLikelyPageLoad;
|
|
38
29
|
function difference(a, b) {
|
|
39
30
|
const result = {};
|
|
40
31
|
for (const key in b) {
|
package/lib/xstate-tree.d.ts
CHANGED
|
@@ -496,6 +496,13 @@ export declare type RouteMeta<T> = T extends Route<any, any, any, infer TMeta> ?
|
|
|
496
496
|
*/
|
|
497
497
|
export declare type RouteParams<T> = T extends Route<infer TParams, any, any, any> ? TParams : undefined;
|
|
498
498
|
|
|
499
|
+
/**
|
|
500
|
+
* @public
|
|
501
|
+
*
|
|
502
|
+
* Extract query type from route
|
|
503
|
+
*/
|
|
504
|
+
export declare type RouteQuery<T> = T extends Route<any, infer TQuery, any, any> ? TQuery : undefined;
|
|
505
|
+
|
|
499
506
|
declare type RouteRedirect<TParams, TQuery, TMeta> = (args: MakeEmptyObjectPropertiesOptional<{
|
|
500
507
|
params: TParams;
|
|
501
508
|
query: TQuery;
|
package/lib/xstateTree.js
CHANGED
|
@@ -318,7 +318,7 @@ function buildRootComponent(machine, routing) {
|
|
|
318
318
|
const { getPathName = () => routing.history.location.pathname, getQueryString = () => routing.history.location.search, } = routing;
|
|
319
319
|
const initialMeta = {
|
|
320
320
|
...(routing.history.location.state?.meta ?? {}),
|
|
321
|
-
onloadEvent:
|
|
321
|
+
onloadEvent: true,
|
|
322
322
|
};
|
|
323
323
|
const queryString = getQueryString();
|
|
324
324
|
const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), initialMeta);
|
package/package.json
CHANGED