@domql/router 3.8.0 → 3.8.6

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 };
@@ -280,13 +280,18 @@ var DomqlRouter = (() => {
280
280
  if (result && typeof result.then === "function") {
281
281
  result.catch((err) => {
282
282
  element.error = err;
283
- console.error("[DOMQL] Async event error:", err);
283
+ if (err instanceof ReferenceError) console.warn("[DOMQL] Async event warning:", err.message);
284
+ else console.error("[DOMQL] Async event error:", err);
284
285
  });
285
286
  }
286
287
  return result;
287
288
  } catch (err) {
288
289
  element.error = err;
289
- console.error("[DOMQL] Event handler error:", err);
290
+ if (err instanceof ReferenceError) {
291
+ console.warn("[DOMQL] Event handler warning:", err.message);
292
+ } else {
293
+ console.error("[DOMQL] Event handler error:", err);
294
+ }
290
295
  if (element.context?.strictMode) throw err;
291
296
  }
292
297
  };
@@ -498,7 +503,7 @@ var DomqlRouter = (() => {
498
503
  scrollToOffset: 0,
499
504
  contentElementKey: "content",
500
505
  scrollToOptions: { behavior: "smooth" },
501
- useParamsMatching: false
506
+ useParamsMatching: true
502
507
  };
503
508
  var router = (path, el, state = {}, options = {}) => {
504
509
  const element = el || void 0;
@@ -551,7 +556,10 @@ var DomqlRouter = (() => {
551
556
  }
552
557
  }
553
558
  if (opts.pushState) {
554
- win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
559
+ try {
560
+ win.history.pushState(state, null, pathname + (search || "") + (hash || ""));
561
+ } catch (e) {
562
+ }
555
563
  }
556
564
  if (pathChanged || !hashChanged) {
557
565
  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.6",
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.6",
31
+ "@domql/utils": "^3.8.6"
32
32
  },
33
33
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
34
34
  "devDependencies": {