@koordinates/xstate-tree 4.5.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeMeta = exports.isNil = exports.isEqual = exports.difference = exports.isLikelyPageLoad = exports.assert = exports.assertIsDefined = exports.delay = void 0;
3
+ 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) {
@@ -635,6 +635,13 @@ export declare type RouteMeta<T> = T extends Route<any, any, any, infer TMeta> ?
635
635
  */
636
636
  export declare type RouteParams<T> = T extends Route<infer TParams, any, any, any> ? TParams : undefined;
637
637
 
638
+ /**
639
+ * @public
640
+ *
641
+ * Extract query type from route
642
+ */
643
+ export declare type RouteQuery<T> = T extends Route<any, infer TQuery, any, any> ? TQuery : undefined;
644
+
638
645
  declare type RouteRedirect<TParams, TQuery, TMeta> = (args: MakeEmptyObjectPropertiesOptional<{
639
646
  params: TParams;
640
647
  query: TQuery;
package/lib/xstateTree.js CHANGED
@@ -334,7 +334,7 @@ function buildRootComponent(machine, routing) {
334
334
  const { getPathName = () => routing.history.location.pathname, getQueryString = () => routing.history.location.search, } = routing;
335
335
  const initialMeta = {
336
336
  ...((_b = (_a = routing.history.location.state) === null || _a === void 0 ? void 0 : _a.meta) !== null && _b !== void 0 ? _b : {}),
337
- onloadEvent: (0, utils_1.isLikelyPageLoad)(),
337
+ onloadEvent: true,
338
338
  };
339
339
  const queryString = getQueryString();
340
340
  const result = (0, routing_1.handleLocationChange)(routing.routes, routing.basePath, getPathName(), getQueryString(), initialMeta);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@koordinates/xstate-tree",
3
3
  "main": "lib/index.js",
4
4
  "types": "lib/xstate-tree.d.ts",
5
- "version": "4.5.0",
5
+ "version": "4.6.1",
6
6
  "license": "MIT",
7
7
  "description": "Build UIs with Actors using xstate and React",
8
8
  "keywords": [