@yoamigo.com/core 0.1.14 → 0.1.15

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/index.js CHANGED
@@ -168,6 +168,7 @@ var BuilderSelectionManager = class {
168
168
  this.setupScrollResizeListeners();
169
169
  this.setupKeyboardListener();
170
170
  this.setupWheelForwarding();
171
+ this.setupHistoryInterception();
171
172
  this.notifyPageReady();
172
173
  window.addEventListener("popstate", () => this.notifyPageReady());
173
174
  }
@@ -486,6 +487,23 @@ var BuilderSelectionManager = class {
486
487
  }
487
488
  }, { passive: false });
488
489
  }
490
+ /**
491
+ * Intercept History API to detect SPA navigation
492
+ * Catches programmatic navigation (wouter, react-router, etc.)
493
+ * Standard pattern used by analytics tools like Google Analytics
494
+ */
495
+ setupHistoryInterception() {
496
+ const originalPushState = history.pushState.bind(history);
497
+ history.pushState = (...args) => {
498
+ originalPushState(...args);
499
+ this.notifyPageReady();
500
+ };
501
+ const originalReplaceState = history.replaceState.bind(history);
502
+ history.replaceState = (...args) => {
503
+ originalReplaceState(...args);
504
+ this.notifyPageReady();
505
+ };
506
+ }
489
507
  showHoverOverlay(element) {
490
508
  if (!this.hoverOverlay) return;
491
509
  const rect = element.getBoundingClientRect();
package/dist/lib.js CHANGED
@@ -127,6 +127,7 @@ var BuilderSelectionManager = class {
127
127
  this.setupScrollResizeListeners();
128
128
  this.setupKeyboardListener();
129
129
  this.setupWheelForwarding();
130
+ this.setupHistoryInterception();
130
131
  this.notifyPageReady();
131
132
  window.addEventListener("popstate", () => this.notifyPageReady());
132
133
  }
@@ -445,6 +446,23 @@ var BuilderSelectionManager = class {
445
446
  }
446
447
  }, { passive: false });
447
448
  }
449
+ /**
450
+ * Intercept History API to detect SPA navigation
451
+ * Catches programmatic navigation (wouter, react-router, etc.)
452
+ * Standard pattern used by analytics tools like Google Analytics
453
+ */
454
+ setupHistoryInterception() {
455
+ const originalPushState = history.pushState.bind(history);
456
+ history.pushState = (...args) => {
457
+ originalPushState(...args);
458
+ this.notifyPageReady();
459
+ };
460
+ const originalReplaceState = history.replaceState.bind(history);
461
+ history.replaceState = (...args) => {
462
+ originalReplaceState(...args);
463
+ this.notifyPageReady();
464
+ };
465
+ }
448
466
  showHoverOverlay(element) {
449
467
  if (!this.hoverOverlay) return;
450
468
  const rect = element.getBoundingClientRect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoamigo.com/core",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Core components, router, and utilities for YoAmigo templates",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",