@ohhwells/bridge 0.1.38-next.69 → 0.1.38-next.71
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 +84 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +84 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7593,7 +7593,7 @@ function isInferredFooterGroup(el) {
|
|
|
7593
7593
|
return Array.from(el.querySelectorAll(":scope > [data-ohw-href-key]")).some(isNavigationItem);
|
|
7594
7594
|
}
|
|
7595
7595
|
function isNavigationContainer(el) {
|
|
7596
|
-
return el.hasAttribute("data-ohw-nav-container") || isNavigationRoot(el) || isInferredFooterGroup(el);
|
|
7596
|
+
return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || isNavigationRoot(el) || isInferredFooterGroup(el);
|
|
7597
7597
|
}
|
|
7598
7598
|
function isPointOverNavigation(x, y) {
|
|
7599
7599
|
const navRoot = document.querySelector("[data-ohw-nav-root]") ?? document.querySelector("nav");
|
|
@@ -8245,14 +8245,28 @@ function OhhwellsBridge() {
|
|
|
8245
8245
|
const runSectionsPrefetchRef = (0, import_react9.useRef)(runSectionsPrefetch);
|
|
8246
8246
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
8247
8247
|
(0, import_react9.useEffect)(() => {
|
|
8248
|
-
if (!linkPopover)
|
|
8248
|
+
if (!linkPopover) {
|
|
8249
|
+
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
8250
|
+
return;
|
|
8251
|
+
}
|
|
8252
|
+
document.documentElement.setAttribute("data-ohw-link-popover-open", "");
|
|
8249
8253
|
if (hoveredImageRef.current) {
|
|
8250
8254
|
hoveredImageRef.current = null;
|
|
8251
8255
|
hoveredImageHasTextOverlapRef.current = false;
|
|
8252
8256
|
}
|
|
8253
8257
|
hoveredGapRef.current = null;
|
|
8254
8258
|
setSectionGap(null);
|
|
8259
|
+
hoveredItemElRef.current = null;
|
|
8260
|
+
setHoveredItemRect(null);
|
|
8261
|
+
hoveredNavContainerRef.current = null;
|
|
8262
|
+
setHoveredNavContainerRect(null);
|
|
8263
|
+
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
8264
|
+
el.removeAttribute("data-ohw-hovered");
|
|
8265
|
+
});
|
|
8255
8266
|
postToParent2({ type: "ow:image-unhover" });
|
|
8267
|
+
return () => {
|
|
8268
|
+
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
8269
|
+
};
|
|
8256
8270
|
}, [linkPopover, postToParent2]);
|
|
8257
8271
|
(0, import_react9.useEffect)(() => {
|
|
8258
8272
|
if (!isEditMode) return;
|
|
@@ -8528,6 +8542,53 @@ function OhhwellsBridge() {
|
|
|
8528
8542
|
movedColumnIndex = Math.max(0, Math.min(adjusted, nextOrder.length - 1));
|
|
8529
8543
|
}
|
|
8530
8544
|
clearFooterDragVisuals();
|
|
8545
|
+
const applySelectionAfterDrop = () => {
|
|
8546
|
+
if (!wasSelected) {
|
|
8547
|
+
deselectRef.current();
|
|
8548
|
+
return;
|
|
8549
|
+
}
|
|
8550
|
+
if (hrefKey) {
|
|
8551
|
+
const link = document.querySelector(
|
|
8552
|
+
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
8553
|
+
);
|
|
8554
|
+
if (link && isNavigationItem(link)) {
|
|
8555
|
+
selectRef.current(link);
|
|
8556
|
+
return;
|
|
8557
|
+
}
|
|
8558
|
+
}
|
|
8559
|
+
if (movedColumnIndex !== null && nextOrder) {
|
|
8560
|
+
const colKeys = nextOrder[movedColumnIndex] ?? [];
|
|
8561
|
+
let column = null;
|
|
8562
|
+
for (const key of colKeys) {
|
|
8563
|
+
const link = document.querySelector(
|
|
8564
|
+
`footer [data-ohw-href-key="${CSS.escape(key)}"]`
|
|
8565
|
+
);
|
|
8566
|
+
if (link) {
|
|
8567
|
+
column = findFooterColumnForLink(link);
|
|
8568
|
+
if (column) break;
|
|
8569
|
+
}
|
|
8570
|
+
}
|
|
8571
|
+
if (!column) column = listFooterColumns()[movedColumnIndex] ?? null;
|
|
8572
|
+
if (column && isNavigationContainer(column)) {
|
|
8573
|
+
selectFrameRef.current(column);
|
|
8574
|
+
return;
|
|
8575
|
+
}
|
|
8576
|
+
}
|
|
8577
|
+
if (document.body.contains(draggedEl)) {
|
|
8578
|
+
if (isNavigationItem(draggedEl)) {
|
|
8579
|
+
selectRef.current(draggedEl);
|
|
8580
|
+
return;
|
|
8581
|
+
}
|
|
8582
|
+
if (isNavigationContainer(draggedEl)) {
|
|
8583
|
+
selectFrameRef.current(draggedEl);
|
|
8584
|
+
return;
|
|
8585
|
+
}
|
|
8586
|
+
}
|
|
8587
|
+
deselectRef.current();
|
|
8588
|
+
};
|
|
8589
|
+
if (!wasSelected) {
|
|
8590
|
+
deselectRef.current();
|
|
8591
|
+
}
|
|
8531
8592
|
if (nextOrder) {
|
|
8532
8593
|
const orderJson = JSON.stringify(nextOrder);
|
|
8533
8594
|
editContentRef.current = {
|
|
@@ -8536,25 +8597,20 @@ function OhhwellsBridge() {
|
|
|
8536
8597
|
};
|
|
8537
8598
|
applyFooterOrder(nextOrder);
|
|
8538
8599
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach(disableNativeHrefDrag);
|
|
8600
|
+
postToParentRef.current({
|
|
8601
|
+
type: "ow:change",
|
|
8602
|
+
nodes: [{ key: FOOTER_ORDER_KEY, text: orderJson }]
|
|
8603
|
+
});
|
|
8539
8604
|
requestAnimationFrame(() => {
|
|
8540
8605
|
if (editContentRef.current[FOOTER_ORDER_KEY] === orderJson) {
|
|
8541
8606
|
applyFooterOrder(nextOrder);
|
|
8542
8607
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach(disableNativeHrefDrag);
|
|
8543
8608
|
}
|
|
8609
|
+
requestAnimationFrame(applySelectionAfterDrop);
|
|
8544
8610
|
});
|
|
8545
|
-
|
|
8546
|
-
type: "ow:change",
|
|
8547
|
-
nodes: [{ key: FOOTER_ORDER_KEY, text: orderJson }]
|
|
8548
|
-
});
|
|
8549
|
-
}
|
|
8550
|
-
const still = (hrefKey ? document.querySelector(`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`) : null) ?? (movedColumnIndex !== null ? listFooterColumns()[movedColumnIndex] ?? null : null) ?? (document.body.contains(draggedEl) ? draggedEl : null);
|
|
8551
|
-
if (still && isNavigationItem(still)) {
|
|
8552
|
-
selectRef.current(still);
|
|
8553
|
-
} else if (still && isNavigationContainer(still)) {
|
|
8554
|
-
selectFrameRef.current(still);
|
|
8555
|
-
} else if (wasSelected) {
|
|
8556
|
-
deselectRef.current();
|
|
8611
|
+
return;
|
|
8557
8612
|
}
|
|
8613
|
+
applySelectionAfterDrop();
|
|
8558
8614
|
},
|
|
8559
8615
|
[clearFooterDragVisuals]
|
|
8560
8616
|
);
|
|
@@ -9028,6 +9084,9 @@ function OhhwellsBridge() {
|
|
|
9028
9084
|
outline-offset: 6px;
|
|
9029
9085
|
border-radius: 8px;
|
|
9030
9086
|
}
|
|
9087
|
+
html[data-ohw-link-popover-open] footer [data-ohw-footer-col]:hover {
|
|
9088
|
+
outline: none !important;
|
|
9089
|
+
}
|
|
9031
9090
|
html[data-ohw-footer-press-drag] footer,
|
|
9032
9091
|
html[data-ohw-footer-press-drag] footer * {
|
|
9033
9092
|
user-select: none !important;
|
|
@@ -9260,6 +9319,13 @@ function OhhwellsBridge() {
|
|
|
9260
9319
|
const handleMouseOver = (e) => {
|
|
9261
9320
|
if (document.documentElement.hasAttribute("data-ohw-section-picking")) return;
|
|
9262
9321
|
const target = e.target;
|
|
9322
|
+
if (linkPopoverOpenRef.current) {
|
|
9323
|
+
hoveredItemElRef.current = null;
|
|
9324
|
+
setHoveredItemRect(null);
|
|
9325
|
+
hoveredNavContainerRef.current = null;
|
|
9326
|
+
setHoveredNavContainerRect(null);
|
|
9327
|
+
return;
|
|
9328
|
+
}
|
|
9263
9329
|
if (toolbarVariantRef.current !== "select-frame") {
|
|
9264
9330
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
9265
9331
|
if (navContainer && !getNavigationItemAnchor(target)) {
|
|
@@ -10436,6 +10502,9 @@ function OhhwellsBridge() {
|
|
|
10436
10502
|
};
|
|
10437
10503
|
const onPointerDown = (e) => {
|
|
10438
10504
|
if (e.button !== 0) return;
|
|
10505
|
+
if (suppressNextClickRef.current && !footerDragRef.current && !footerPointerDragRef.current?.started) {
|
|
10506
|
+
suppressNextClickRef.current = false;
|
|
10507
|
+
}
|
|
10439
10508
|
if (footerDragRef.current) return;
|
|
10440
10509
|
const target = e.target;
|
|
10441
10510
|
if (!target) return;
|
|
@@ -10822,7 +10891,7 @@ function OhhwellsBridge() {
|
|
|
10822
10891
|
)),
|
|
10823
10892
|
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && !siblingHintRect && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
10824
10893
|
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
10825
|
-
hoveredItemRect && !hoveredNavContainerRect && !siblingHintRect && siblingHintRects.length === 0 && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
10894
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !siblingHintRect && siblingHintRects.length === 0 && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
10826
10895
|
toolbarRect && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemInteractionLayer, { rect: isItemDragging && draggedItemRect && footerDragRef.current?.wasSelected ? draggedItemRect : toolbarRect, elRef: glowElRef, state: isItemDragging ? "dragging" : resolveItemInteractionState(toolbarRect, parentScrollRef.current), showHandle: toolbarVariant === "link-action" && Boolean(reorderHrefKey) || toolbarVariant === "select-frame" && isFooterFrameSelection, dragDisabled: reorderDragDisabled, dragHandleLabel: reorderHrefKey ? `Reorder ${reorderHrefKey}` : "Reorder item", onDragHandleDragStart: handleItemDragStart, onDragHandleDragEnd: handleItemDragEnd, onItemPointerDown: handleItemChromePointerDown, onItemClick: handleItemChromeClick, toolbar: toolbarVariant === "link-action" && !isItemDragging ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemActionToolbar, { onEditLink: openLinkPopoverForSelected, addItemDisabled: true, editLinkDisabled: false, moreDisabled: true }) : void 0 }),
|
|
10827
10896
|
toolbarRect && toolbarVariant === "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
10828
10897
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditGlowChrome, { rect: toolbarRect, elRef: glowElRef, reorderHrefKey, dragDisabled: reorderDragDisabled }),
|