@ohhwells/bridge 0.1.52-next.141 → 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 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);
@@ -9497,7 +9517,8 @@ function FloatingPanel({
9497
9517
  role: "dialog",
9498
9518
  "aria-label": title,
9499
9519
  className: cn(
9500
- "fixed z-[2147483645] flex w-64 flex-col overflow-hidden rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
9520
+ // Above MediaOverlay / item chrome (2147483646); link-modal content shares this tier.
9521
+ "fixed z-[2147483647] flex w-64 flex-col overflow-hidden rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
9501
9522
  className
9502
9523
  ),
9503
9524
  style: { left: clamped.x, top: clamped.y },
@@ -11142,6 +11163,10 @@ function isInsideLinkEditor(target) {
11142
11163
  function isInsideFloatingPanel(target) {
11143
11164
  return Boolean(target.closest("[data-ohw-floating-panel]"));
11144
11165
  }
11166
+ function isPointOverFloatingPanel(clientX, clientY) {
11167
+ const el = document.elementFromPoint(clientX, clientY);
11168
+ return Boolean(el instanceof Element && el.closest("[data-ohw-floating-panel]"));
11169
+ }
11145
11170
  function getHrefKeyFromElement(el) {
11146
11171
  if (!el) return null;
11147
11172
  const anchor = el.closest("[data-ohw-href-key]");
@@ -13036,7 +13061,7 @@ function OhhwellsBridge() {
13036
13061
  setReorderDragDisabled(false);
13037
13062
  setIsFooterFrameSelection(false);
13038
13063
  setToolbarVariant("logo");
13039
- setToolbarRect(logoEl.getBoundingClientRect());
13064
+ setToolbarRect(getLogoInteractionRect(logoEl));
13040
13065
  setToolbarShowEditLink(false);
13041
13066
  setActiveCommands(/* @__PURE__ */ new Set());
13042
13067
  },
@@ -13088,6 +13113,19 @@ function OhhwellsBridge() {
13088
13113
  draft.mobileFollowing
13089
13114
  );
13090
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
+ });
13091
13129
  },
13092
13130
  [postToParent2]
13093
13131
  );
@@ -13816,6 +13854,16 @@ function OhhwellsBridge() {
13816
13854
  setHoveredNavContainerRect(null);
13817
13855
  return;
13818
13856
  }
13857
+ if (isInsideFloatingPanel(target) || isPointOverFloatingPanel(e.clientX, e.clientY)) {
13858
+ hoveredItemElRef.current = null;
13859
+ setHoveredItemRect(null);
13860
+ hoveredNavContainerRef.current = null;
13861
+ setHoveredNavContainerRect(null);
13862
+ siblingHintElRef.current = null;
13863
+ setSiblingHintRect(null);
13864
+ setSiblingHintRects([]);
13865
+ return;
13866
+ }
13819
13867
  {
13820
13868
  const selected2 = selectedElRef.current;
13821
13869
  const selectedIsFooterColumn = Boolean(selected2) && !isFooterLinksContainer(selected2) && (selected2.hasAttribute("data-ohw-footer-col") || selected2.hasAttribute("data-ohw-footer-column") || Boolean(selected2.closest("footer") && isInferredFooterGroup2(selected2)));
@@ -13858,7 +13906,7 @@ function OhhwellsBridge() {
13858
13906
  setHoveredNavContainerRect(null);
13859
13907
  if (selectedElRef.current === logoEl) return;
13860
13908
  hoveredItemElRef.current = logoEl;
13861
- setHoveredItemRect(logoEl.getBoundingClientRect());
13909
+ setHoveredItemRect(getLogoInteractionRect(logoEl));
13862
13910
  return;
13863
13911
  }
13864
13912
  const navAnchor = getNavigationItemAnchor(target);
@@ -14098,7 +14146,7 @@ function OhhwellsBridge() {
14098
14146
  setHoveredNavContainerRect(null);
14099
14147
  if (selectedElRef.current !== logo) {
14100
14148
  hoveredItemElRef.current = logo;
14101
- setHoveredItemRect(logo.getBoundingClientRect());
14149
+ setHoveredItemRect(getLogoInteractionRect(logo));
14102
14150
  }
14103
14151
  return;
14104
14152
  }
@@ -14187,7 +14235,7 @@ function OhhwellsBridge() {
14187
14235
  }
14188
14236
  };
14189
14237
  const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
14190
- if (linkPopoverOpenRef.current) {
14238
+ if (linkPopoverOpenRef.current || floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
14191
14239
  if (hoveredImageRef.current) {
14192
14240
  hoveredImageRef.current = null;
14193
14241
  hoveredImageHasTextOverlapRef.current = false;
@@ -14441,7 +14489,7 @@ function OhhwellsBridge() {
14441
14489
  }
14442
14490
  };
14443
14491
  const probeHoverCardsAt = (clientX, clientY, fromParentViewport = false) => {
14444
- if (linkPopoverOpenRef.current || document.documentElement.hasAttribute("data-ohw-section-picking")) {
14492
+ if (linkPopoverOpenRef.current || floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY) || document.documentElement.hasAttribute("data-ohw-section-picking")) {
14445
14493
  if (activeStateElRef.current) {
14446
14494
  activeStateElRef.current.removeAttribute("data-ohw-state-hovered");
14447
14495
  activeStateElRef.current = null;
@@ -14509,6 +14557,19 @@ function OhhwellsBridge() {
14509
14557
  };
14510
14558
  const handleMouseMove = (e) => {
14511
14559
  const { clientX, clientY } = e;
14560
+ if (floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
14561
+ hoveredItemElRef.current = null;
14562
+ setHoveredItemRect(null);
14563
+ hoveredNavContainerRef.current = null;
14564
+ setHoveredNavContainerRect(null);
14565
+ siblingHintElRef.current = null;
14566
+ setSiblingHintRect(null);
14567
+ setSiblingHintRects([]);
14568
+ dismissImageHover();
14569
+ clearImageHover();
14570
+ setSectionGap(null);
14571
+ return;
14572
+ }
14512
14573
  probeSectionGapAt(clientX, clientY);
14513
14574
  probeImageAt(clientX, clientY);
14514
14575
  probeHoverCardsAt(clientX, clientY);
@@ -14517,6 +14578,11 @@ function OhhwellsBridge() {
14517
14578
  if (e.data?.type !== "ow:pointer-sync") return;
14518
14579
  const { clientX, clientY } = e.data;
14519
14580
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
14581
+ if (floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
14582
+ dismissImageHover();
14583
+ clearImageHover();
14584
+ return;
14585
+ }
14520
14586
  probeSectionGapAt(clientX, clientY);
14521
14587
  probeImageAt(clientX, clientY);
14522
14588
  probeHoverCardsAt(clientX, clientY);
@@ -14991,7 +15057,8 @@ function OhhwellsBridge() {
14991
15057
  const handleScroll = () => {
14992
15058
  const focusEl = activeElRef.current ?? selectedElRef.current;
14993
15059
  if (focusEl) {
14994
- const r2 = activeElRef.current ? getEditMeasureEl(activeElRef.current).getBoundingClientRect() : focusEl.getBoundingClientRect();
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();
14995
15062
  applyToolbarPos(r2);
14996
15063
  setToolbarRect(r2);
14997
15064
  setMaxBadge((prev) => prev && activeElRef.current ? { ...prev, rect: r2 } : prev);
@@ -15001,7 +15068,9 @@ function OhhwellsBridge() {
15001
15068
  setToggleState((prev) => prev ? { ...prev, rect } : null);
15002
15069
  }
15003
15070
  if (hoveredItemElRef.current) {
15004
- setHoveredItemRect(hoveredItemElRef.current.getBoundingClientRect());
15071
+ const hoverEl = hoveredItemElRef.current;
15072
+ const logo = getLogoElement(hoverEl);
15073
+ setHoveredItemRect(logo ? getLogoInteractionRect(logo) : hoverEl.getBoundingClientRect());
15005
15074
  }
15006
15075
  if (hoveredNavContainerRef.current) {
15007
15076
  setHoveredNavContainerRect(hoveredNavContainerRef.current.getBoundingClientRect());
@@ -15254,8 +15323,9 @@ function OhhwellsBridge() {
15254
15323
  }
15255
15324
  const focusEl = activeElRef.current ?? selectedElRef.current;
15256
15325
  if (focusEl) {
15257
- const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : focusEl;
15258
- applyToolbarPos(measureEl.getBoundingClientRect());
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);
15259
15329
  }
15260
15330
  };
15261
15331
  const handleClickAt = (e) => {