@domql/router 2.3.109 → 2.3.112

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/dist/cjs/index.js CHANGED
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var router_exports = {};
20
20
  __export(router_exports, {
21
+ default: () => router_default,
21
22
  getActiveRoute: () => getActiveRoute,
22
23
  lastLevel: () => lastLevel,
23
24
  router: () => router
@@ -46,13 +47,15 @@ const router = (path, element, state = {}, options = defaultOptions) => {
46
47
  const [pathname, hash] = path.split("#");
47
48
  const route = getActiveRoute(pathname, options.level);
48
49
  const content = element.routes[route] || element.routes["/*"];
49
- if (content)
50
+ if (!content)
50
51
  return;
51
52
  if (options.pushState)
52
53
  import_globals.window.history.pushState(state, null, pathname + (hash ? `#${hash}` : ""));
53
54
  element.set({ tag: options.useFragment && "fragment", extend: content });
54
55
  if (options.updateState)
55
- element.state.update({ route, hash }, { preventContentUpdate: !options.stateContentUpdate });
56
+ element.state.update({ route, hash }, {
57
+ preventContentUpdate: !options.stateContentUpdate
58
+ });
56
59
  const rootNode = element.node;
57
60
  const scrollNode = options.scrollNode;
58
61
  if (options.scrollToTop) {
@@ -79,3 +82,4 @@ const router = (path, element, state = {}, options = defaultOptions) => {
79
82
  }
80
83
  }
81
84
  };
85
+ var router_default = router;
package/index.js CHANGED
@@ -37,11 +37,13 @@ export const router = (
37
37
  const route = getActiveRoute(pathname, options.level)
38
38
  const content = element.routes[route] || element.routes['/*']
39
39
 
40
- if (content) return
40
+ if (!content) return
41
41
  if (options.pushState) window.history.pushState(state, null, pathname + (hash ? `#${hash}` : ''))
42
42
 
43
43
  element.set({ tag: options.useFragment && 'fragment', extend: content })
44
- if (options.updateState) element.state.update({ route, hash }, { preventContentUpdate: !options.stateContentUpdate })
44
+ if (options.updateState) element.state.update({ route, hash }, {
45
+ preventContentUpdate: !options.stateContentUpdate
46
+ })
45
47
 
46
48
  const rootNode = element.node
47
49
  const scrollNode = options.scrollNode
@@ -66,3 +68,5 @@ export const router = (
66
68
  }
67
69
  }
68
70
  }
71
+
72
+ export default router
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/router",
3
- "version": "2.3.109",
3
+ "version": "2.3.112",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -25,7 +25,7 @@
25
25
  "@domql/globals": "latest",
26
26
  "@domql/utils": "latest"
27
27
  },
28
- "gitHead": "abe8666e3d77d8b287034e91756a9939cb2b6d97",
28
+ "gitHead": "a86dad4cef1731f6a97d43ec445074c31f76760a",
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.12.0"
31
31
  }