@domql/router 2.5.57 → 2.5.82

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
@@ -51,7 +51,7 @@ const defaultOptions = {
51
51
  const router = (path, element, state = {}, passedOptions = {}) => {
52
52
  const options = { ...defaultOptions, ...element.context.routerOptions, ...passedOptions };
53
53
  lastLevel = options.lastLevel;
54
- const newElementKey = options.newElementKey;
54
+ const contentElementKey = options.contentElementKey;
55
55
  const [pathname, hash] = path.split("#");
56
56
  const rootNode = element.node;
57
57
  const route = getActiveRoute(options.level, pathname);
@@ -60,22 +60,22 @@ const router = (path, element, state = {}, passedOptions = {}) => {
60
60
  const hashChanged = hash && hash !== import_utils.window.location.hash.slice(1);
61
61
  const pathChanged = pathname !== lastPathname;
62
62
  lastPathname = pathname;
63
- if (!content)
63
+ if (!content || element.state.root.debugging)
64
64
  return;
65
65
  if (options.pushState) {
66
66
  import_utils.window.history.pushState(state, null, pathname + (hash ? `#${hash}` : ""));
67
67
  }
68
68
  if (pathChanged || !hashChanged) {
69
69
  if (options.updateState) {
70
- element.state.update({ route, hash }, { preventContentUpdate: true });
70
+ element.state.update({ route, hash, debugging: false }, { preventContentUpdate: true });
71
71
  }
72
- if (newElementKey && options.removeOldElement) {
73
- element[newElementKey].remove();
72
+ if (contentElementKey && options.removeOldElement) {
73
+ element[contentElementKey].remove();
74
74
  }
75
75
  element.set({
76
76
  tag: options.useFragment && "fragment",
77
77
  extend: content
78
- }, { newElementKey });
78
+ }, { contentElementKey });
79
79
  }
80
80
  if (options.scrollToTop) {
81
81
  scrollNode.scrollTo({
package/index.js CHANGED
@@ -34,7 +34,7 @@ export const router = (
34
34
  ) => {
35
35
  const options = { ...defaultOptions, ...element.context.routerOptions, ...passedOptions }
36
36
  lastLevel = options.lastLevel
37
- const newElementKey = options.newElementKey
37
+ const contentElementKey = options.contentElementKey
38
38
 
39
39
  const [pathname, hash] = path.split('#')
40
40
 
@@ -46,24 +46,24 @@ export const router = (
46
46
  const pathChanged = pathname !== lastPathname
47
47
  lastPathname = pathname
48
48
 
49
- if (!content) return
49
+ if (!content || element.state.root.debugging) return
50
50
  if (options.pushState) {
51
51
  window.history.pushState(state, null, pathname + (hash ? `#${hash}` : ''))
52
52
  }
53
53
 
54
54
  if (pathChanged || !hashChanged) {
55
55
  if (options.updateState) {
56
- element.state.update({ route, hash }, { preventContentUpdate: true })
56
+ element.state.update({ route, hash, debugging: false }, { preventContentUpdate: true })
57
57
  }
58
58
 
59
- if (newElementKey && options.removeOldElement) {
60
- element[newElementKey].remove()
59
+ if (contentElementKey && options.removeOldElement) {
60
+ element[contentElementKey].remove()
61
61
  }
62
62
 
63
63
  element.set({
64
64
  tag: options.useFragment && 'fragment',
65
65
  extend: content
66
- }, { newElementKey })
66
+ }, { contentElementKey })
67
67
  }
68
68
 
69
69
  if (options.scrollToTop) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/router",
3
- "version": "2.5.57",
3
+ "version": "2.5.82",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
18
- "build:esm": "npx esbuild *.js --target=es2019 --format=esm --outdir=dist/esm",
18
+ "build:esm": "npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm",
19
19
  "build:cjs": "npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs",
20
20
  "build:iife": "npx esbuild *.js --target=node16 --format=iife --outdir=dist/iife",
21
21
  "build": "yarn build:cjs",
@@ -25,7 +25,7 @@
25
25
  "@domql/globals": "latest",
26
26
  "@domql/utils": "latest"
27
27
  },
28
- "gitHead": "f479a1805e3de4f53d9b3392bfe93b9d735c948c",
28
+ "gitHead": "d459c82294b8af698a706e4310cce67878e0969f",
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.12.0"
31
31
  }