@domql/router 3.8.0 → 3.8.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/dist/cjs/index.js CHANGED
@@ -151,7 +151,7 @@ const defaultOptions = {
151
151
  scrollToOffset: 0,
152
152
  contentElementKey: "content",
153
153
  scrollToOptions: { behavior: "smooth" },
154
- useParamsMatching: false
154
+ useParamsMatching: true
155
155
  };
156
156
  const router = (path, el, state = {}, options = {}) => {
157
157
  const element = el || void 0;
@@ -204,7 +204,10 @@ const router = (path, el, state = {}, options = {}) => {
204
204
  }
205
205
  }
206
206
  if (opts.pushState) {
207
- win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
207
+ try {
208
+ win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
209
+ } catch (e) {
210
+ }
208
211
  }
209
212
  if (pathChanged || !hashChanged) {
210
213
  const stateUpdate = { route, hash, debugging: false };
package/dist/esm/index.js CHANGED
@@ -120,7 +120,7 @@ const defaultOptions = {
120
120
  scrollToOffset: 0,
121
121
  contentElementKey: "content",
122
122
  scrollToOptions: { behavior: "smooth" },
123
- useParamsMatching: false
123
+ useParamsMatching: true
124
124
  };
125
125
  const router = (path, el, state = {}, options = {}) => {
126
126
  const element = el || void 0;
@@ -173,7 +173,10 @@ const router = (path, el, state = {}, options = {}) => {
173
173
  }
174
174
  }
175
175
  if (opts.pushState) {
176
- win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
176
+ try {
177
+ win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
178
+ } catch (e) {
179
+ }
177
180
  }
178
181
  if (pathChanged || !hashChanged) {
179
182
  const stateUpdate = { route, hash, debugging: false };
@@ -498,7 +498,7 @@ var DomqlRouter = (() => {
498
498
  scrollToOffset: 0,
499
499
  contentElementKey: "content",
500
500
  scrollToOptions: { behavior: "smooth" },
501
- useParamsMatching: false
501
+ useParamsMatching: true
502
502
  };
503
503
  var router = (path, el, state = {}, options = {}) => {
504
504
  const element = el || void 0;
@@ -551,7 +551,10 @@ var DomqlRouter = (() => {
551
551
  }
552
552
  }
553
553
  if (opts.pushState) {
554
- win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
554
+ try {
555
+ win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
556
+ } catch (e) {
557
+ }
555
558
  }
556
559
  if (pathChanged || !hashChanged) {
557
560
  const stateUpdate = { route, hash, debugging: false };
package/index.js CHANGED
@@ -154,7 +154,7 @@ const defaultOptions = {
154
154
  scrollToOffset: 0,
155
155
  contentElementKey: 'content',
156
156
  scrollToOptions: { behavior: 'smooth' },
157
- useParamsMatching: false
157
+ useParamsMatching: true
158
158
  }
159
159
 
160
160
  export const router = (path, el, state = {}, options = {}) => {
@@ -227,7 +227,9 @@ export const router = (path, el, state = {}, options = {}) => {
227
227
  }
228
228
 
229
229
  if (opts.pushState) {
230
- win.history.pushState(state, null, pathname + (search || '') + (hash || ''))
230
+ try {
231
+ win.history.pushState(state, null, pathname + (search || '') + (hash || ''))
232
+ } catch (e) {} // expected in sandboxed iframes (e.g. about:srcdoc) where pushState is restricted
231
233
  }
232
234
 
233
235
  if (pathChanged || !hashChanged) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/router",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -27,8 +27,8 @@
27
27
  "prepublish": "npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/element": "^3.8.0",
31
- "@domql/utils": "^3.8.0"
30
+ "@domql/element": "^3.8.1",
31
+ "@domql/utils": "^3.8.1"
32
32
  },
33
33
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
34
34
  "devDependencies": {