@ohhwells/bridge 0.1.38 → 0.1.39

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
@@ -6021,7 +6021,13 @@ function collectEditableNodes() {
6021
6021
  nodes.push({ key: `${key}${VIDEO_AUTOPLAY_SUFFIX}`, type: "video-setting", text: String(video.autoplay) });
6022
6022
  nodes.push({ key: `${key}${VIDEO_MUTED_SUFFIX}`, type: "video-setting", text: String(video.muted) });
6023
6023
  });
6024
- return nodes;
6024
+ const seen = /* @__PURE__ */ new Set();
6025
+ return nodes.filter((node) => {
6026
+ if (!node.key) return true;
6027
+ if (seen.has(node.key)) return false;
6028
+ seen.add(node.key);
6029
+ return true;
6030
+ });
6025
6031
  }
6026
6032
  function isMediaEditable(el) {
6027
6033
  const t = el.dataset.ohwEditable;
@@ -7158,7 +7164,6 @@ function OhhwellsBridge() {
7158
7164
  [data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]) {
7159
7165
  outline: 2px dashed ${PRIMARY2} !important;
7160
7166
  outline-offset: 4px;
7161
- border-radius: 2px;
7162
7167
  }
7163
7168
  [data-ohw-href-key] [data-ohw-hovered],
7164
7169
  [data-ohw-href-key][data-ohw-hovered],
@@ -7185,7 +7190,7 @@ function OhhwellsBridge() {
7185
7190
  stateViews.textContent = `
7186
7191
  [data-ohw-state-view]:not([data-ohw-state-view="default"]) { display: none; }
7187
7192
  [data-ohw-state-view="default"] [data-ohw-editable] { pointer-events: auto !important; }
7188
- [data-ohw-state-hovered] { outline: 2px dashed ${PRIMARY2} !important; outline-offset: 4px; border-radius: 2px; }
7193
+ [data-ohw-state-hovered] { outline: 2px dashed ${PRIMARY2} !important; outline-offset: 4px; }
7189
7194
  [data-ohw-state-hovered]:has([data-ohw-hovered]) { outline: none !important; }
7190
7195
  `;
7191
7196
  document.head.appendChild(base);
@@ -7414,12 +7419,12 @@ function OhhwellsBridge() {
7414
7419
  const stickyPad = 48;
7415
7420
  const withinPad = x >= pr.left - stickyPad && x <= pr.left + pr.width + stickyPad && y >= pr.top - stickyPad && y <= pr.top + pr.height + stickyPad;
7416
7421
  if (withinPad) {
7417
- const yieldToSmaller = smallest !== pinned && candidatePool.includes(smallest) && (() => {
7422
+ if (smallest !== pinned && candidatePool.includes(smallest)) {
7418
7423
  const sr = getVisibleRect(smallest);
7419
- const pr2 = getVisibleRect(pinned);
7420
- return sr.width * sr.height < pr2.width * pr2.height;
7421
- })();
7422
- if (!yieldToSmaller) return pinned;
7424
+ const overOther = x >= sr.left && x <= sr.left + sr.width && y >= sr.top && y <= sr.top + sr.height;
7425
+ if (overOther) return smallest;
7426
+ }
7427
+ return pinned;
7423
7428
  }
7424
7429
  }
7425
7430
  return smallest;
@@ -7460,6 +7465,21 @@ function OhhwellsBridge() {
7460
7465
  }
7461
7466
  if (imgEl) {
7462
7467
  const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
7468
+ const overMediaChrome = Array.from(
7469
+ document.querySelectorAll("[data-ohw-media-chrome]")
7470
+ ).some((el) => {
7471
+ const r2 = el.getBoundingClientRect();
7472
+ return x >= r2.left && x <= r2.right && y >= r2.top && y <= r2.bottom;
7473
+ });
7474
+ if (overMediaChrome) {
7475
+ if (hoveredImageRef.current) {
7476
+ hoveredImageRef.current = null;
7477
+ hoveredImageHasTextOverlapRef.current = false;
7478
+ resumeAnimTracks();
7479
+ clearImageHover();
7480
+ }
7481
+ return;
7482
+ }
7463
7483
  const topEl = document.elementFromPoint(x, y);
7464
7484
  if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
7465
7485
  if (hoveredImageRef.current) {