@ohhwells/bridge 0.1.97 → 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.cjs +28 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -599,9 +599,9 @@ function applyStylesToDom(store) {
|
|
|
599
599
|
);
|
|
600
600
|
if (!store) return;
|
|
601
601
|
for (const [sectionId, override] of Object.entries(store.sections)) {
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
);
|
|
602
|
+
const escaped = CSS.escape(sectionId);
|
|
603
|
+
const byInstance = document.querySelectorAll(`[data-ohw-instance="${escaped}"]`);
|
|
604
|
+
const sections = byInstance.length ? byInstance : document.querySelectorAll(`[data-ohw-section="${escaped}"]`);
|
|
605
605
|
for (const marker of Array.from(sections)) {
|
|
606
606
|
const section = marker.querySelector(":scope > [data-ai-section]") ?? marker;
|
|
607
607
|
for (const [prop, attr] of Object.entries(SECTION_ATTRS)) {
|
|
@@ -679,8 +679,9 @@ function parseSectionsFromRoot(root) {
|
|
|
679
679
|
const seen = /* @__PURE__ */ new Set();
|
|
680
680
|
const sections = [];
|
|
681
681
|
for (const el of root.querySelectorAll("[data-ohw-section]")) {
|
|
682
|
-
const id = el.getAttribute("data-ohw-section")
|
|
683
|
-
|
|
682
|
+
const id = el.getAttribute("data-ohw-instance") || el.getAttribute("data-ohw-section") || "";
|
|
683
|
+
const type = el.getAttribute("data-ohw-section") ?? "";
|
|
684
|
+
if (!id || seen.has(id) || LINK_PICKER_EXCLUDED_IDS.has(type)) continue;
|
|
684
685
|
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
685
686
|
if (el.hasAttribute("data-ohw-ai-template-hidden") || el.hasAttribute("data-ohw-ai-removed") || el.hasAttribute("data-ohw-ai-replaced-by"))
|
|
686
687
|
continue;
|
|
@@ -17217,7 +17218,26 @@ function OhhwellsBridge() {
|
|
|
17217
17218
|
return;
|
|
17218
17219
|
}
|
|
17219
17220
|
const r2 = target.getBoundingClientRect();
|
|
17220
|
-
|
|
17221
|
+
let top = r2.top, left = r2.x - TEXT_HOVER_SIDE_PAD, bottom = r2.bottom, right = r2.x + r2.width + TEXT_HOVER_SIDE_PAD;
|
|
17222
|
+
let clipParent = target.parentElement;
|
|
17223
|
+
while (clipParent) {
|
|
17224
|
+
const style = getComputedStyle(clipParent);
|
|
17225
|
+
if (style.overflowY === "hidden" || style.overflowY === "clip" || style.overflowX === "hidden" || style.overflowX === "clip") {
|
|
17226
|
+
const pr = clipParent.getBoundingClientRect();
|
|
17227
|
+
top = Math.max(top, pr.top);
|
|
17228
|
+
bottom = Math.min(bottom, pr.bottom);
|
|
17229
|
+
left = Math.max(left, pr.left);
|
|
17230
|
+
right = Math.min(right, pr.right);
|
|
17231
|
+
}
|
|
17232
|
+
if (clipParent === document.documentElement) break;
|
|
17233
|
+
clipParent = clipParent.parentElement;
|
|
17234
|
+
}
|
|
17235
|
+
const width = right - left, height = bottom - top;
|
|
17236
|
+
if (width <= 0 || height <= 0) {
|
|
17237
|
+
setHoveredTextRect(null);
|
|
17238
|
+
return;
|
|
17239
|
+
}
|
|
17240
|
+
setHoveredTextRect(new DOMRect(left, top, width, height));
|
|
17221
17241
|
};
|
|
17222
17242
|
const observer = new MutationObserver(sync);
|
|
17223
17243
|
observer.observe(document.documentElement, {
|
|
@@ -20391,12 +20411,11 @@ function OhhwellsBridge() {
|
|
|
20391
20411
|
}
|
|
20392
20412
|
const { y } = toProbeCoords(clientX, clientY, fromParentViewport);
|
|
20393
20413
|
const sections = Array.from(document.querySelectorAll("[data-ohw-section]")).filter(
|
|
20394
|
-
(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
|
|
20414
|
+
(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
|
|
20395
20415
|
).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top);
|
|
20396
20416
|
const ZONE = 20;
|
|
20397
20417
|
for (let i = 0; i < sections.length; i++) {
|
|
20398
20418
|
const a = sections[i];
|
|
20399
|
-
if (isPageFrameSection(a)) continue;
|
|
20400
20419
|
const b = sections[i + 1] ?? null;
|
|
20401
20420
|
const boundaryY = a.getBoundingClientRect().bottom;
|
|
20402
20421
|
if (Math.abs(y - boundaryY) <= ZONE) {
|
|
@@ -22043,7 +22062,7 @@ function OhhwellsBridge() {
|
|
|
22043
22062
|
postToParent2({
|
|
22044
22063
|
type: "ow:ready",
|
|
22045
22064
|
version: "1",
|
|
22046
|
-
bridgeVersion: "0.1.
|
|
22065
|
+
bridgeVersion: "0.1.98",
|
|
22047
22066
|
path: pathname,
|
|
22048
22067
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22049
22068
|
sections
|