@ohhwells/bridge 0.1.68-next.199 → 0.1.68-next.203
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 +70 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +70 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10857,7 +10857,8 @@ function findSocialsRow(el) {
|
|
|
10857
10857
|
}
|
|
10858
10858
|
function isSocialsRow(el) {
|
|
10859
10859
|
const anchors = Array.from(el.querySelectorAll("a"));
|
|
10860
|
-
|
|
10860
|
+
if (!anchors.length || !anchors.some((anchor) => isSocialItem(anchor))) return false;
|
|
10861
|
+
return findSocialsRow(anchors[0]) === el;
|
|
10861
10862
|
}
|
|
10862
10863
|
var MAX_SOCIAL_ITEMS_PER_ROW = 7;
|
|
10863
10864
|
function canAddSocialItem(row) {
|
|
@@ -10895,6 +10896,7 @@ function markSocialsRows(root = document) {
|
|
|
10895
10896
|
});
|
|
10896
10897
|
listSocialsRows(root).forEach((row) => {
|
|
10897
10898
|
row.setAttribute(SOCIALS_ROW_ATTR, "");
|
|
10899
|
+
allowRowToWrap(row);
|
|
10898
10900
|
const items = listSocialItems(row);
|
|
10899
10901
|
const firstUnit = items[0] ? socialRowUnit(items[0], row) : null;
|
|
10900
10902
|
if (firstUnit) rowTemplates.set(rowKeyOf(row), firstUnit.outerHTML);
|
|
@@ -11189,7 +11191,29 @@ function applySocialsDisplayToRow(row, display) {
|
|
|
11189
11191
|
const icon = item.querySelector(ICON_SELECTOR);
|
|
11190
11192
|
if (label) label.style.display = display.text ? "" : "none";
|
|
11191
11193
|
if (icon) icon.style.display = display.icon ? "" : "none";
|
|
11194
|
+
layOutIconAndLabel(item, Boolean(display.text && display.icon));
|
|
11192
11195
|
});
|
|
11196
|
+
allowRowToWrap(row);
|
|
11197
|
+
}
|
|
11198
|
+
function layOutIconAndLabel(item, on) {
|
|
11199
|
+
const hasBoth = Boolean(item.querySelector(ICON_SELECTOR)) && Boolean(socialLabelElement(item));
|
|
11200
|
+
if (!hasBoth) {
|
|
11201
|
+
item.style.display = "";
|
|
11202
|
+
item.style.alignItems = "";
|
|
11203
|
+
item.style.gap = "";
|
|
11204
|
+
item.style.whiteSpace = "";
|
|
11205
|
+
item.style.flex = "";
|
|
11206
|
+
return;
|
|
11207
|
+
}
|
|
11208
|
+
item.style.display = on ? "inline-flex" : "";
|
|
11209
|
+
item.style.alignItems = on ? "center" : "";
|
|
11210
|
+
item.style.gap = on ? "8px" : "";
|
|
11211
|
+
item.style.whiteSpace = on ? "nowrap" : "";
|
|
11212
|
+
item.style.flex = on ? "0 0 auto" : "";
|
|
11213
|
+
}
|
|
11214
|
+
function allowRowToWrap(row) {
|
|
11215
|
+
const display = row.ownerDocument.defaultView?.getComputedStyle(row).display ?? "";
|
|
11216
|
+
if (display === "flex" || display === "inline-flex") row.style.flexWrap = "wrap";
|
|
11193
11217
|
}
|
|
11194
11218
|
function applySocialsDisplayFromContent(content, root = document) {
|
|
11195
11219
|
const stored = parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]);
|
|
@@ -14212,6 +14236,7 @@ function fadeInImageElement(img, onReady) {
|
|
|
14212
14236
|
function applyEditableImageSrc(img, url) {
|
|
14213
14237
|
img.removeAttribute("srcset");
|
|
14214
14238
|
img.removeAttribute("sizes");
|
|
14239
|
+
if (img.loading === "lazy") img.loading = "eager";
|
|
14215
14240
|
img.src = url;
|
|
14216
14241
|
}
|
|
14217
14242
|
function fadeInBgImage(el, url, onReady) {
|
|
@@ -16116,6 +16141,7 @@ function OhhwellsBridge() {
|
|
|
16116
16141
|
}, [clearSelectedAttr]);
|
|
16117
16142
|
const markSelected = (0, import_react17.useCallback)((el) => {
|
|
16118
16143
|
clearSelectedAttr();
|
|
16144
|
+
el.removeAttribute("data-ohw-hovered");
|
|
16119
16145
|
el.setAttribute("data-ohw-selected", "");
|
|
16120
16146
|
}, [clearSelectedAttr]);
|
|
16121
16147
|
const resolveHrefKeyElement = (0, import_react17.useCallback)((hrefKey) => {
|
|
@@ -18057,6 +18083,16 @@ function OhhwellsBridge() {
|
|
|
18057
18083
|
return;
|
|
18058
18084
|
}
|
|
18059
18085
|
}
|
|
18086
|
+
if (allowNavContainerHover) {
|
|
18087
|
+
const socialsRow = isSocialsRow(target) ? target : null;
|
|
18088
|
+
if (socialsRow && !getSocialItem(target) && selected2 !== socialsRow) {
|
|
18089
|
+
hoveredNavContainerRef.current = socialsRow;
|
|
18090
|
+
setHoveredNavContainerRect(socialsRow.getBoundingClientRect());
|
|
18091
|
+
hoveredItemElRef.current = null;
|
|
18092
|
+
setHoveredItemRect(null);
|
|
18093
|
+
return;
|
|
18094
|
+
}
|
|
18095
|
+
}
|
|
18060
18096
|
if (allowFooterLinksHover) {
|
|
18061
18097
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
18062
18098
|
if (!navContainer) {
|
|
@@ -18142,7 +18178,7 @@ function OhhwellsBridge() {
|
|
|
18142
18178
|
clearHrefKeyHover(hoverTarget);
|
|
18143
18179
|
hoveredItemElRef.current = hoverTarget;
|
|
18144
18180
|
setHoveredItemRect(hoverTarget.getBoundingClientRect());
|
|
18145
|
-
} else if (!isInsideNavigationItem(editable)) {
|
|
18181
|
+
} else if (!isInsideNavigationItem(editable) && hoverTarget !== selectedElRef.current) {
|
|
18146
18182
|
hoverTarget.setAttribute("data-ohw-hovered", "");
|
|
18147
18183
|
if (editable.closest("footer") || editable.closest('[data-ohw-section="footer"]')) {
|
|
18148
18184
|
hoveredNavContainerRef.current = null;
|
|
@@ -18735,6 +18771,35 @@ function OhhwellsBridge() {
|
|
|
18735
18771
|
}
|
|
18736
18772
|
}
|
|
18737
18773
|
};
|
|
18774
|
+
const probeSocialsRowAt = (clientX, clientY, fromParentViewport = false) => {
|
|
18775
|
+
const wasSocialsRow = Boolean(hoveredNavContainerRef.current?.hasAttribute(SOCIALS_ROW_ATTR));
|
|
18776
|
+
const clear = () => {
|
|
18777
|
+
if (!wasSocialsRow) return false;
|
|
18778
|
+
hoveredNavContainerRef.current = null;
|
|
18779
|
+
setHoveredNavContainerRect(null);
|
|
18780
|
+
return false;
|
|
18781
|
+
};
|
|
18782
|
+
if (linkPopoverOpenRef.current || toolbarVariantRef.current === "select-frame") return clear();
|
|
18783
|
+
const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
|
|
18784
|
+
const SLACK = 6;
|
|
18785
|
+
for (const row of Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`))) {
|
|
18786
|
+
const rect = row.getBoundingClientRect();
|
|
18787
|
+
const inside = x >= rect.left - SLACK && x <= rect.right + SLACK && y >= rect.top - SLACK && y <= rect.bottom + SLACK;
|
|
18788
|
+
if (!inside) continue;
|
|
18789
|
+
if (selectedElRef.current === row) return clear();
|
|
18790
|
+
const overItem = listSocialItems(row).some((item) => {
|
|
18791
|
+
const box = item.getBoundingClientRect();
|
|
18792
|
+
return x >= box.left && x <= box.right && y >= box.top && y <= box.bottom;
|
|
18793
|
+
});
|
|
18794
|
+
if (overItem) return clear();
|
|
18795
|
+
hoveredNavContainerRef.current = row;
|
|
18796
|
+
setHoveredNavContainerRect(rect);
|
|
18797
|
+
hoveredItemElRef.current = null;
|
|
18798
|
+
setHoveredItemRect(null);
|
|
18799
|
+
return true;
|
|
18800
|
+
}
|
|
18801
|
+
return clear();
|
|
18802
|
+
};
|
|
18738
18803
|
const probeSectionGapAt = (clientX, clientY, fromParentViewport = false) => {
|
|
18739
18804
|
if (linkPopoverOpenRef.current) {
|
|
18740
18805
|
if (hoveredGapRef.current) {
|
|
@@ -18791,6 +18856,7 @@ function OhhwellsBridge() {
|
|
|
18791
18856
|
setSectionGap(null);
|
|
18792
18857
|
return;
|
|
18793
18858
|
}
|
|
18859
|
+
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
18794
18860
|
probeSectionGapAt(clientX, clientY);
|
|
18795
18861
|
probeImageAt(clientX, clientY);
|
|
18796
18862
|
probeHoverCardsAt(clientX, clientY);
|
|
@@ -18804,6 +18870,7 @@ function OhhwellsBridge() {
|
|
|
18804
18870
|
clearImageHover();
|
|
18805
18871
|
return;
|
|
18806
18872
|
}
|
|
18873
|
+
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
18807
18874
|
probeSectionGapAt(clientX, clientY);
|
|
18808
18875
|
probeImageAt(clientX, clientY);
|
|
18809
18876
|
probeHoverCardsAt(clientX, clientY);
|
|
@@ -20717,7 +20784,7 @@ function OhhwellsBridge() {
|
|
|
20717
20784
|
)),
|
|
20718
20785
|
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
20719
20786
|
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
20720
|
-
hoveredTextRect && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: hoveredTextRect, state: "hover" }),
|
|
20787
|
+
hoveredTextRect && !hoveredNavContainerRect && !hoveredItemRect && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: hoveredTextRect, state: "hover" }),
|
|
20721
20788
|
formPickRect && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
20722
20789
|
ItemInteractionLayer,
|
|
20723
20790
|
{
|