@ohhwells/bridge 0.1.52-next.142 → 0.1.52-next.143
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 +44 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9302,6 +9302,26 @@ function logoHasUploadedImage(logoEl) {
|
|
|
9302
9302
|
if (img.style.display === "none") return false;
|
|
9303
9303
|
return true;
|
|
9304
9304
|
}
|
|
9305
|
+
function getLogoInteractionRect(logoEl) {
|
|
9306
|
+
if (logoHasUploadedImage(logoEl)) {
|
|
9307
|
+
const img = logoEl.querySelector('img[data-ohw-key="nav-logo-image"], img[data-ohw-key="footer-logo"], img[data-ohw-key="footer-logo-image"]') ?? logoEl.querySelector("img");
|
|
9308
|
+
if (img) {
|
|
9309
|
+
const r2 = img.getBoundingClientRect();
|
|
9310
|
+
if (r2.width > 0 && r2.height > 0) return r2;
|
|
9311
|
+
}
|
|
9312
|
+
}
|
|
9313
|
+
const text = logoEl.querySelector(
|
|
9314
|
+
'[data-ohw-key="nav-logo-text"], [data-ohw-key="footer-logo-text"]'
|
|
9315
|
+
);
|
|
9316
|
+
if (text) {
|
|
9317
|
+
const style = window.getComputedStyle(text);
|
|
9318
|
+
if (style.display !== "none" && style.visibility !== "hidden") {
|
|
9319
|
+
const r2 = text.getBoundingClientRect();
|
|
9320
|
+
if (r2.width > 0 && r2.height > 0) return r2;
|
|
9321
|
+
}
|
|
9322
|
+
}
|
|
9323
|
+
return logoEl.getBoundingClientRect();
|
|
9324
|
+
}
|
|
9305
9325
|
function readLogoSizeState(content, placement) {
|
|
9306
9326
|
const desktopPx = resolveDesktopLogoSize(content, placement);
|
|
9307
9327
|
const mobileFollowing = isMobileLogoSizeFollowing(content, placement);
|
|
@@ -13041,7 +13061,7 @@ function OhhwellsBridge() {
|
|
|
13041
13061
|
setReorderDragDisabled(false);
|
|
13042
13062
|
setIsFooterFrameSelection(false);
|
|
13043
13063
|
setToolbarVariant("logo");
|
|
13044
|
-
setToolbarRect(logoEl
|
|
13064
|
+
setToolbarRect(getLogoInteractionRect(logoEl));
|
|
13045
13065
|
setToolbarShowEditLink(false);
|
|
13046
13066
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
13047
13067
|
},
|
|
@@ -13093,6 +13113,19 @@ function OhhwellsBridge() {
|
|
|
13093
13113
|
draft.mobileFollowing
|
|
13094
13114
|
);
|
|
13095
13115
|
postToParent2({ type: "ow:change", nodes });
|
|
13116
|
+
requestAnimationFrame(() => {
|
|
13117
|
+
const selected = selectedElRef.current;
|
|
13118
|
+
if (!selected || toolbarVariantRef.current !== "logo") return;
|
|
13119
|
+
const rect = getLogoInteractionRect(selected);
|
|
13120
|
+
setToolbarRect(rect);
|
|
13121
|
+
if (glowElRef.current) {
|
|
13122
|
+
const GAP = SELECTION_CHROME_GAP2;
|
|
13123
|
+
glowElRef.current.style.top = `${rect.top - GAP}px`;
|
|
13124
|
+
glowElRef.current.style.left = `${rect.left - GAP}px`;
|
|
13125
|
+
glowElRef.current.style.width = `${rect.width + GAP * 2}px`;
|
|
13126
|
+
glowElRef.current.style.height = `${rect.height + GAP * 2}px`;
|
|
13127
|
+
}
|
|
13128
|
+
});
|
|
13096
13129
|
},
|
|
13097
13130
|
[postToParent2]
|
|
13098
13131
|
);
|
|
@@ -13873,7 +13906,7 @@ function OhhwellsBridge() {
|
|
|
13873
13906
|
setHoveredNavContainerRect(null);
|
|
13874
13907
|
if (selectedElRef.current === logoEl) return;
|
|
13875
13908
|
hoveredItemElRef.current = logoEl;
|
|
13876
|
-
setHoveredItemRect(logoEl
|
|
13909
|
+
setHoveredItemRect(getLogoInteractionRect(logoEl));
|
|
13877
13910
|
return;
|
|
13878
13911
|
}
|
|
13879
13912
|
const navAnchor = getNavigationItemAnchor(target);
|
|
@@ -14113,7 +14146,7 @@ function OhhwellsBridge() {
|
|
|
14113
14146
|
setHoveredNavContainerRect(null);
|
|
14114
14147
|
if (selectedElRef.current !== logo) {
|
|
14115
14148
|
hoveredItemElRef.current = logo;
|
|
14116
|
-
setHoveredItemRect(logo
|
|
14149
|
+
setHoveredItemRect(getLogoInteractionRect(logo));
|
|
14117
14150
|
}
|
|
14118
14151
|
return;
|
|
14119
14152
|
}
|
|
@@ -15024,7 +15057,8 @@ function OhhwellsBridge() {
|
|
|
15024
15057
|
const handleScroll = () => {
|
|
15025
15058
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
15026
15059
|
if (focusEl) {
|
|
15027
|
-
const
|
|
15060
|
+
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : toolbarVariantRef.current === "logo" ? null : focusEl;
|
|
15061
|
+
const r2 = measureEl ? measureEl.getBoundingClientRect() : toolbarVariantRef.current === "logo" ? getLogoInteractionRect(focusEl) : focusEl.getBoundingClientRect();
|
|
15028
15062
|
applyToolbarPos(r2);
|
|
15029
15063
|
setToolbarRect(r2);
|
|
15030
15064
|
setMaxBadge((prev) => prev && activeElRef.current ? { ...prev, rect: r2 } : prev);
|
|
@@ -15034,7 +15068,9 @@ function OhhwellsBridge() {
|
|
|
15034
15068
|
setToggleState((prev) => prev ? { ...prev, rect } : null);
|
|
15035
15069
|
}
|
|
15036
15070
|
if (hoveredItemElRef.current) {
|
|
15037
|
-
|
|
15071
|
+
const hoverEl = hoveredItemElRef.current;
|
|
15072
|
+
const logo = getLogoElement(hoverEl);
|
|
15073
|
+
setHoveredItemRect(logo ? getLogoInteractionRect(logo) : hoverEl.getBoundingClientRect());
|
|
15038
15074
|
}
|
|
15039
15075
|
if (hoveredNavContainerRef.current) {
|
|
15040
15076
|
setHoveredNavContainerRect(hoveredNavContainerRef.current.getBoundingClientRect());
|
|
@@ -15287,8 +15323,9 @@ function OhhwellsBridge() {
|
|
|
15287
15323
|
}
|
|
15288
15324
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
15289
15325
|
if (focusEl) {
|
|
15290
|
-
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : focusEl;
|
|
15291
|
-
|
|
15326
|
+
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : toolbarVariantRef.current === "logo" ? null : focusEl;
|
|
15327
|
+
const r2 = measureEl ? measureEl.getBoundingClientRect() : toolbarVariantRef.current === "logo" ? getLogoInteractionRect(focusEl) : focusEl.getBoundingClientRect();
|
|
15328
|
+
applyToolbarPos(r2);
|
|
15292
15329
|
}
|
|
15293
15330
|
};
|
|
15294
15331
|
const handleClickAt = (e) => {
|