@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.js CHANGED
@@ -7531,7 +7531,7 @@ function isInferredFooterGroup(el) {
7531
7531
  return Array.from(el.querySelectorAll(":scope > [data-ohw-href-key]")).some(isNavigationItem);
7532
7532
  }
7533
7533
  function isNavigationContainer(el) {
7534
- return el.hasAttribute("data-ohw-nav-container") || isNavigationRoot(el) || isInferredFooterGroup(el);
7534
+ return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || isNavigationRoot(el) || isInferredFooterGroup(el);
7535
7535
  }
7536
7536
  function isPointOverNavigation(x, y) {
7537
7537
  const navRoot = document.querySelector("[data-ohw-nav-root]") ?? document.querySelector("nav");
@@ -8183,14 +8183,28 @@ function OhhwellsBridge() {
8183
8183
  const runSectionsPrefetchRef = useRef5(runSectionsPrefetch);
8184
8184
  runSectionsPrefetchRef.current = runSectionsPrefetch;
8185
8185
  useEffect8(() => {
8186
- if (!linkPopover) return;
8186
+ if (!linkPopover) {
8187
+ document.documentElement.removeAttribute("data-ohw-link-popover-open");
8188
+ return;
8189
+ }
8190
+ document.documentElement.setAttribute("data-ohw-link-popover-open", "");
8187
8191
  if (hoveredImageRef.current) {
8188
8192
  hoveredImageRef.current = null;
8189
8193
  hoveredImageHasTextOverlapRef.current = false;
8190
8194
  }
8191
8195
  hoveredGapRef.current = null;
8192
8196
  setSectionGap(null);
8197
+ hoveredItemElRef.current = null;
8198
+ setHoveredItemRect(null);
8199
+ hoveredNavContainerRef.current = null;
8200
+ setHoveredNavContainerRect(null);
8201
+ document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
8202
+ el.removeAttribute("data-ohw-hovered");
8203
+ });
8193
8204
  postToParent2({ type: "ow:image-unhover" });
8205
+ return () => {
8206
+ document.documentElement.removeAttribute("data-ohw-link-popover-open");
8207
+ };
8194
8208
  }, [linkPopover, postToParent2]);
8195
8209
  useEffect8(() => {
8196
8210
  if (!isEditMode) return;
@@ -8466,6 +8480,53 @@ function OhhwellsBridge() {
8466
8480
  movedColumnIndex = Math.max(0, Math.min(adjusted, nextOrder.length - 1));
8467
8481
  }
8468
8482
  clearFooterDragVisuals();
8483
+ const applySelectionAfterDrop = () => {
8484
+ if (!wasSelected) {
8485
+ deselectRef.current();
8486
+ return;
8487
+ }
8488
+ if (hrefKey) {
8489
+ const link = document.querySelector(
8490
+ `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
8491
+ );
8492
+ if (link && isNavigationItem(link)) {
8493
+ selectRef.current(link);
8494
+ return;
8495
+ }
8496
+ }
8497
+ if (movedColumnIndex !== null && nextOrder) {
8498
+ const colKeys = nextOrder[movedColumnIndex] ?? [];
8499
+ let column = null;
8500
+ for (const key of colKeys) {
8501
+ const link = document.querySelector(
8502
+ `footer [data-ohw-href-key="${CSS.escape(key)}"]`
8503
+ );
8504
+ if (link) {
8505
+ column = findFooterColumnForLink(link);
8506
+ if (column) break;
8507
+ }
8508
+ }
8509
+ if (!column) column = listFooterColumns()[movedColumnIndex] ?? null;
8510
+ if (column && isNavigationContainer(column)) {
8511
+ selectFrameRef.current(column);
8512
+ return;
8513
+ }
8514
+ }
8515
+ if (document.body.contains(draggedEl)) {
8516
+ if (isNavigationItem(draggedEl)) {
8517
+ selectRef.current(draggedEl);
8518
+ return;
8519
+ }
8520
+ if (isNavigationContainer(draggedEl)) {
8521
+ selectFrameRef.current(draggedEl);
8522
+ return;
8523
+ }
8524
+ }
8525
+ deselectRef.current();
8526
+ };
8527
+ if (!wasSelected) {
8528
+ deselectRef.current();
8529
+ }
8469
8530
  if (nextOrder) {
8470
8531
  const orderJson = JSON.stringify(nextOrder);
8471
8532
  editContentRef.current = {
@@ -8474,25 +8535,20 @@ function OhhwellsBridge() {
8474
8535
  };
8475
8536
  applyFooterOrder(nextOrder);
8476
8537
  document.querySelectorAll("footer [data-ohw-href-key]").forEach(disableNativeHrefDrag);
8538
+ postToParentRef.current({
8539
+ type: "ow:change",
8540
+ nodes: [{ key: FOOTER_ORDER_KEY, text: orderJson }]
8541
+ });
8477
8542
  requestAnimationFrame(() => {
8478
8543
  if (editContentRef.current[FOOTER_ORDER_KEY] === orderJson) {
8479
8544
  applyFooterOrder(nextOrder);
8480
8545
  document.querySelectorAll("footer [data-ohw-href-key]").forEach(disableNativeHrefDrag);
8481
8546
  }
8547
+ requestAnimationFrame(applySelectionAfterDrop);
8482
8548
  });
8483
- postToParentRef.current({
8484
- type: "ow:change",
8485
- nodes: [{ key: FOOTER_ORDER_KEY, text: orderJson }]
8486
- });
8487
- }
8488
- 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);
8489
- if (still && isNavigationItem(still)) {
8490
- selectRef.current(still);
8491
- } else if (still && isNavigationContainer(still)) {
8492
- selectFrameRef.current(still);
8493
- } else if (wasSelected) {
8494
- deselectRef.current();
8549
+ return;
8495
8550
  }
8551
+ applySelectionAfterDrop();
8496
8552
  },
8497
8553
  [clearFooterDragVisuals]
8498
8554
  );
@@ -8966,6 +9022,9 @@ function OhhwellsBridge() {
8966
9022
  outline-offset: 6px;
8967
9023
  border-radius: 8px;
8968
9024
  }
9025
+ html[data-ohw-link-popover-open] footer [data-ohw-footer-col]:hover {
9026
+ outline: none !important;
9027
+ }
8969
9028
  html[data-ohw-footer-press-drag] footer,
8970
9029
  html[data-ohw-footer-press-drag] footer * {
8971
9030
  user-select: none !important;
@@ -9198,6 +9257,13 @@ function OhhwellsBridge() {
9198
9257
  const handleMouseOver = (e) => {
9199
9258
  if (document.documentElement.hasAttribute("data-ohw-section-picking")) return;
9200
9259
  const target = e.target;
9260
+ if (linkPopoverOpenRef.current) {
9261
+ hoveredItemElRef.current = null;
9262
+ setHoveredItemRect(null);
9263
+ hoveredNavContainerRef.current = null;
9264
+ setHoveredNavContainerRect(null);
9265
+ return;
9266
+ }
9201
9267
  if (toolbarVariantRef.current !== "select-frame") {
9202
9268
  const navContainer = target.closest("[data-ohw-nav-container]");
9203
9269
  if (navContainer && !getNavigationItemAnchor(target)) {
@@ -10374,6 +10440,9 @@ function OhhwellsBridge() {
10374
10440
  };
10375
10441
  const onPointerDown = (e) => {
10376
10442
  if (e.button !== 0) return;
10443
+ if (suppressNextClickRef.current && !footerDragRef.current && !footerPointerDragRef.current?.started) {
10444
+ suppressNextClickRef.current = false;
10445
+ }
10377
10446
  if (footerDragRef.current) return;
10378
10447
  const target = e.target;
10379
10448
  if (!target) return;
@@ -10760,7 +10829,7 @@ function OhhwellsBridge() {
10760
10829
  )),
10761
10830
  hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && !siblingHintRect && siblingHintRects.length === 0 && /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
10762
10831
  toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && /* @__PURE__ */ jsx25(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
10763
- hoveredItemRect && !hoveredNavContainerRect && !siblingHintRect && siblingHintRects.length === 0 && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
10832
+ hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !siblingHintRect && siblingHintRects.length === 0 && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
10764
10833
  toolbarRect && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ jsx25(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__ */ jsx25(ItemActionToolbar, { onEditLink: openLinkPopoverForSelected, addItemDisabled: true, editLinkDisabled: false, moreDisabled: true }) : void 0 }),
10765
10834
  toolbarRect && toolbarVariant === "rich-text" && /* @__PURE__ */ jsxs14(Fragment5, { children: [
10766
10835
  /* @__PURE__ */ jsx25(EditGlowChrome, { rect: toolbarRect, elRef: glowElRef, reorderHrefKey, dragDisabled: reorderDragDisabled }),