@domql/router 2.5.94 → 2.5.110
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 +3 -2
- package/index.js +3 -2
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -54,7 +54,8 @@ const router = (path, element, state = {}, passedOptions = {}) => {
|
|
|
54
54
|
const options = { ...defaultOptions, ...element.context.routerOptions, ...passedOptions };
|
|
55
55
|
lastLevel = options.lastLevel;
|
|
56
56
|
const contentElementKey = options.contentElementKey;
|
|
57
|
-
const
|
|
57
|
+
const urlObj = new win.URL(win.location.origin + path);
|
|
58
|
+
const { pathname, search, hash } = urlObj;
|
|
58
59
|
const rootNode = element.node;
|
|
59
60
|
const route = getActiveRoute(options.level, pathname);
|
|
60
61
|
const content = element.routes[route || "/"] || element.routes["/*"];
|
|
@@ -67,7 +68,7 @@ const router = (path, element, state = {}, passedOptions = {}) => {
|
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
70
|
if (options.pushState) {
|
|
70
|
-
win.history.pushState(state, null, pathname + (
|
|
71
|
+
win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
|
|
71
72
|
}
|
|
72
73
|
if (pathChanged || !hashChanged) {
|
|
73
74
|
if (options.updateState) {
|
package/index.js
CHANGED
|
@@ -38,7 +38,8 @@ export const router = (
|
|
|
38
38
|
lastLevel = options.lastLevel
|
|
39
39
|
const contentElementKey = options.contentElementKey
|
|
40
40
|
|
|
41
|
-
const
|
|
41
|
+
const urlObj = new win.URL(win.location.origin + path)
|
|
42
|
+
const { pathname, search, hash } = urlObj
|
|
42
43
|
|
|
43
44
|
const rootNode = element.node
|
|
44
45
|
const route = getActiveRoute(options.level, pathname)
|
|
@@ -53,7 +54,7 @@ export const router = (
|
|
|
53
54
|
return
|
|
54
55
|
}
|
|
55
56
|
if (options.pushState) {
|
|
56
|
-
win.history.pushState(state, null, pathname + (
|
|
57
|
+
win.history.pushState(state, null, pathname + (search || '') + (hash || ''))
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
if (pathChanged || !hashChanged) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/router",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.110",
|
|
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": "
|
|
28
|
+
"gitHead": "2942c0972b473f8be846cbf0e5a9f1917cf20d65",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/core": "^7.12.0"
|
|
31
31
|
}
|