@ohhwells/bridge 0.1.98 → 0.1.99

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
@@ -17151,7 +17151,26 @@ function OhhwellsBridge() {
17151
17151
  return;
17152
17152
  }
17153
17153
  const r2 = target.getBoundingClientRect();
17154
- setHoveredTextRect(new DOMRect(r2.x - TEXT_HOVER_SIDE_PAD, r2.y, r2.width + TEXT_HOVER_SIDE_PAD * 2, r2.height));
17154
+ let top = r2.top, left = r2.x - TEXT_HOVER_SIDE_PAD, bottom = r2.bottom, right = r2.x + r2.width + TEXT_HOVER_SIDE_PAD;
17155
+ let clipParent = target.parentElement;
17156
+ while (clipParent) {
17157
+ const style = getComputedStyle(clipParent);
17158
+ if (style.overflowY === "hidden" || style.overflowY === "clip" || style.overflowX === "hidden" || style.overflowX === "clip") {
17159
+ const pr = clipParent.getBoundingClientRect();
17160
+ top = Math.max(top, pr.top);
17161
+ bottom = Math.min(bottom, pr.bottom);
17162
+ left = Math.max(left, pr.left);
17163
+ right = Math.min(right, pr.right);
17164
+ }
17165
+ if (clipParent === document.documentElement) break;
17166
+ clipParent = clipParent.parentElement;
17167
+ }
17168
+ const width = right - left, height = bottom - top;
17169
+ if (width <= 0 || height <= 0) {
17170
+ setHoveredTextRect(null);
17171
+ return;
17172
+ }
17173
+ setHoveredTextRect(new DOMRect(left, top, width, height));
17155
17174
  };
17156
17175
  const observer = new MutationObserver(sync);
17157
17176
  observer.observe(document.documentElement, {
@@ -20325,12 +20344,11 @@ function OhhwellsBridge() {
20325
20344
  }
20326
20345
  const { y } = toProbeCoords(clientX, clientY, fromParentViewport);
20327
20346
  const sections = Array.from(document.querySelectorAll("[data-ohw-section]")).filter(
20328
- (el) => !el.hasAttribute("data-ohw-ai-template-hidden") && !el.hasAttribute("data-ohw-ai-removed") && !el.hasAttribute("data-ohw-ai-replaced-by") && el.getBoundingClientRect().height > 0
20347
+ (el) => !el.hasAttribute("data-ohw-ai-template-hidden") && !el.hasAttribute("data-ohw-ai-removed") && !el.hasAttribute("data-ohw-ai-replaced-by") && !isPageFrameSection(el) && el.getBoundingClientRect().height > 0
20329
20348
  ).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top);
20330
20349
  const ZONE = 20;
20331
20350
  for (let i = 0; i < sections.length; i++) {
20332
20351
  const a = sections[i];
20333
- if (isPageFrameSection(a)) continue;
20334
20352
  const b = sections[i + 1] ?? null;
20335
20353
  const boundaryY = a.getBoundingClientRect().bottom;
20336
20354
  if (Math.abs(y - boundaryY) <= ZONE) {
@@ -21977,7 +21995,7 @@ function OhhwellsBridge() {
21977
21995
  postToParent2({
21978
21996
  type: "ow:ready",
21979
21997
  version: "1",
21980
- bridgeVersion: "0.1.97",
21998
+ bridgeVersion: "0.1.98",
21981
21999
  path: pathname,
21982
22000
  nodes: collectEditableNodes(editContentRef.current),
21983
22001
  sections