@ohhwells/bridge 0.1.42-next.87 → 0.1.42-next.89

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
@@ -6617,17 +6617,20 @@ function navOrderKeysEqual(a, b) {
6617
6617
  }
6618
6618
  return true;
6619
6619
  }
6620
- function getNavOrderFromContainer(container) {
6620
+ function getNavbarLinkKeysInContainer(container) {
6621
6621
  return Array.from(container.querySelectorAll("[data-ohw-href-key]")).filter(isNavbarLinkItem).map((el) => el.getAttribute("data-ohw-href-key")).filter((key) => Boolean(key));
6622
6622
  }
6623
6623
  function applyNavOrderToContainer(container, order) {
6624
6624
  const desired = order.filter((key, i) => order.indexOf(key) === i);
6625
- const current = getNavOrderFromContainer(container);
6625
+ const current = getNavbarLinkKeysInContainer(container);
6626
6626
  const extras = current.filter((key) => !desired.includes(key));
6627
6627
  const expected = [...desired.filter((key) => current.includes(key)), ...extras];
6628
+ const orderedEls = [];
6628
6629
  if (navOrderKeysEqual(current, expected)) return;
6630
+ if (current.length === expected.length && current.every((key, i) => key === expected[i])) {
6631
+ return;
6632
+ }
6629
6633
  const seen = /* @__PURE__ */ new Set();
6630
- const orderedEls = [];
6631
6634
  for (const hrefKey of desired) {
6632
6635
  if (seen.has(hrefKey)) continue;
6633
6636
  seen.add(hrefKey);
@@ -8033,7 +8036,13 @@ function collectEditableNodes(extraContent) {
8033
8036
  nodes.push({ key: `${key}${VIDEO_AUTOPLAY_SUFFIX}`, type: "video-setting", text: String(video.autoplay) });
8034
8037
  nodes.push({ key: `${key}${VIDEO_MUTED_SUFFIX}`, type: "video-setting", text: String(video.muted) });
8035
8038
  });
8036
- return nodes;
8039
+ const seen = /* @__PURE__ */ new Set();
8040
+ return nodes.filter((node) => {
8041
+ if (!node.key) return true;
8042
+ if (seen.has(node.key)) return false;
8043
+ seen.add(node.key);
8044
+ return true;
8045
+ });
8037
8046
  }
8038
8047
  function isMediaEditable(el) {
8039
8048
  const t = el.dataset.ohwEditable;
@@ -8165,7 +8174,7 @@ function countFooterNavItems(el) {
8165
8174
  return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem).length;
8166
8175
  }
8167
8176
  function findFooterItemGroup(item) {
8168
- const explicit = item.closest("[data-ohw-footer-col]");
8177
+ const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
8169
8178
  if (explicit) return explicit;
8170
8179
  const footer = item.closest("footer");
8171
8180
  if (!footer) return null;
@@ -8182,14 +8191,17 @@ function isNavigationRoot(el) {
8182
8191
  function isInferredFooterGroup(el) {
8183
8192
  const footer = el.closest("footer");
8184
8193
  if (!footer || el === footer) return false;
8185
- if (el.hasAttribute("data-ohw-footer-col")) return true;
8194
+ if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
8186
8195
  return countFooterNavItems(el) >= 2;
8187
8196
  }
8188
8197
  function isNavigationContainer(el) {
8189
- return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || isNavigationRoot(el) || isInferredFooterGroup(el);
8198
+ return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isNavigationRoot(el) || isInferredFooterGroup(el);
8199
+ }
8200
+ function isNavbarLinksContainer(el) {
8201
+ return el.hasAttribute("data-ohw-nav-container");
8190
8202
  }
8191
8203
  function getFooterColumn(el) {
8192
- return el.closest("[data-ohw-footer-col]");
8204
+ return el.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
8193
8205
  }
8194
8206
  function resolveFooterColumnSelectionTarget(target, clientX, clientY) {
8195
8207
  if (getNavigationItemAnchor(target)) return null;
@@ -8213,7 +8225,7 @@ function isPointOverNavigation(x, y) {
8213
8225
  function findHoveredNavOrFooterContainer(x, y) {
8214
8226
  const candidates = [
8215
8227
  ...document.querySelectorAll("[data-ohw-nav-container]"),
8216
- ...document.querySelectorAll("[data-ohw-footer-col]")
8228
+ ...listFooterColumns()
8217
8229
  ];
8218
8230
  for (const container of candidates) {
8219
8231
  const r2 = container.getBoundingClientRect();
@@ -8260,7 +8272,7 @@ function getNavigationSelectionParent(el) {
8260
8272
  if (footerGroup) return footerGroup;
8261
8273
  return getNavigationRoot(el);
8262
8274
  }
8263
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || isInferredFooterGroup(el)) {
8275
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup(el)) {
8264
8276
  return getNavigationRoot(el);
8265
8277
  }
8266
8278
  return null;
@@ -8440,8 +8452,6 @@ var ICONS = {
8440
8452
  insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
8441
8453
  insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
8442
8454
  };
8443
- var TOOLBAR_PILL_PADDING = 2;
8444
- var TOOLBAR_TOGGLE_GAP = 4;
8445
8455
  var SELECTION_CHROME_GAP2 = 4;
8446
8456
  var TOOLBAR_STROKE_GAP2 = 4;
8447
8457
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -8656,15 +8666,6 @@ function FloatingToolbar({
8656
8666
  left,
8657
8667
  transform,
8658
8668
  zIndex: 2147483647,
8659
- background: "#fff",
8660
- border: "1px solid #E7E5E4",
8661
- borderRadius: 6,
8662
- boxShadow: "0px 2px 4px -2px rgba(0,0,0,.1),0px 4px 6px -1px rgba(0,0,0,.1)",
8663
- display: "flex",
8664
- alignItems: "center",
8665
- padding: TOOLBAR_PILL_PADDING,
8666
- gap: TOOLBAR_TOGGLE_GAP,
8667
- fontFamily: "sans-serif",
8668
8669
  pointerEvents: "auto"
8669
8670
  },
8670
8671
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(CustomToolbar, { children: [
@@ -8831,7 +8832,6 @@ function OhhwellsBridge() {
8831
8832
  const dragOverElRef = (0, import_react9.useRef)(null);
8832
8833
  const [mediaHover, setMediaHover] = (0, import_react9.useState)(null);
8833
8834
  const [uploadingRects, setUploadingRects] = (0, import_react9.useState)({});
8834
- const pendingUploadRectRef = (0, import_react9.useRef)(null);
8835
8835
  const hoveredGapRef = (0, import_react9.useRef)(null);
8836
8836
  const imageUnhoverTimerRef = (0, import_react9.useRef)(null);
8837
8837
  const imageShowTimerRef = (0, import_react9.useRef)(null);
@@ -8991,7 +8991,6 @@ function OhhwellsBridge() {
8991
8991
  body.style.overflow = prevBodyOverflow;
8992
8992
  document.removeEventListener("wheel", preventBackgroundScroll, scrollOpts);
8993
8993
  document.removeEventListener("touchmove", preventBackgroundScroll, scrollOpts);
8994
- document.documentElement.removeAttribute("data-ohw-link-popover-open");
8995
8994
  };
8996
8995
  }, [linkPopover, postToParent2]);
8997
8996
  (0, import_react9.useEffect)(() => {
@@ -9604,14 +9603,11 @@ function OhhwellsBridge() {
9604
9603
  if (hoveredImageRef.current) {
9605
9604
  hoveredImageRef.current = null;
9606
9605
  setMediaHover(null);
9607
- postToParentRef.current({ type: "ow:image-unhover" });
9608
9606
  }
9609
9607
  setToolbarVariant("rich-text");
9610
9608
  siblingHintElRef.current = null;
9611
9609
  setSiblingHintRect(null);
9612
- setSiblingHintRects([]);
9613
9610
  setIsItemDragging(false);
9614
- setIsFooterFrameSelection(false);
9615
9611
  el.setAttribute("contenteditable", "true");
9616
9612
  el.setAttribute("data-ohw-editing", "");
9617
9613
  el.removeAttribute("data-ohw-hovered");
@@ -9800,6 +9796,13 @@ function OhhwellsBridge() {
9800
9796
  const observeRoots = () => [document.querySelector("nav"), document.querySelector("footer")].filter(
9801
9797
  (el) => Boolean(el)
9802
9798
  );
9799
+ const roots = observeRoots();
9800
+ if (roots.length === 0) {
9801
+ reconcileNavbarItemsFromContent(contentForNav());
9802
+ reconcileFooterOrderFromContent(contentForNav());
9803
+ if (isEditMode) syncNavigationDragCursorAttrs();
9804
+ return;
9805
+ }
9803
9806
  let rafId = null;
9804
9807
  let applying = false;
9805
9808
  let observer = null;
@@ -9936,29 +9939,6 @@ function OhhwellsBridge() {
9936
9939
  [data-ohw-href-key][data-ohw-selected] * {
9937
9940
  cursor: text !important;
9938
9941
  }
9939
- /* Native <a> drag steals clicks \u2014 disable for edit links; reorder via press-to-drag / handle. */
9940
- footer [data-ohw-href-key],
9941
- nav [data-ohw-href-key],
9942
- [data-ohw-nav-container] [data-ohw-href-key],
9943
- [data-ohw-nav-drawer] [data-ohw-href-key] {
9944
- -webkit-user-drag: none !important;
9945
- }
9946
- html[data-ohw-footer-press-drag] footer,
9947
- html[data-ohw-footer-press-drag] footer * {
9948
- user-select: none !important;
9949
- -webkit-user-select: none !important;
9950
- }
9951
- html[data-ohw-item-dragging] footer,
9952
- html[data-ohw-item-dragging] footer *,
9953
- html[data-ohw-item-dragging] nav,
9954
- html[data-ohw-item-dragging] nav * {
9955
- user-select: none !important;
9956
- -webkit-user-select: none !important;
9957
- pointer-events: none !important;
9958
- }
9959
- html[data-ohw-item-dragging] {
9960
- cursor: grabbing !important;
9961
- }
9962
9942
  [data-ohw-editable="image"], [data-ohw-editable="image"] *,
9963
9943
  [data-ohw-editable="video"], [data-ohw-editable="video"] *,
9964
9944
  [data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
@@ -10101,15 +10081,7 @@ function OhhwellsBridge() {
10101
10081
  if (isMediaEditable(editable)) {
10102
10082
  e.preventDefault();
10103
10083
  e.stopPropagation();
10104
- const key = editable.dataset.ohwKey ?? "";
10105
- const r2 = editable.getBoundingClientRect();
10106
- if (key && r2.width > 1 && r2.height > 1) {
10107
- pendingUploadRectRef.current = {
10108
- key,
10109
- rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height }
10110
- };
10111
- }
10112
- postToParentRef.current({ type: "ow:image-pick", key, elementType: editable.dataset.ohwEditable ?? "image" });
10084
+ postToParentRef.current({ type: "ow:image-pick", key: editable.dataset.ohwKey ?? "", elementType: editable.dataset.ohwEditable ?? "image" });
10113
10085
  return;
10114
10086
  }
10115
10087
  const hrefCtx = getHrefKeyFromElement(editable);
@@ -10235,28 +10207,19 @@ function OhhwellsBridge() {
10235
10207
  return;
10236
10208
  }
10237
10209
  if (toolbarVariantRef.current !== "select-frame") {
10238
- const frameContainer = target.closest("[data-ohw-nav-container]") ?? target.closest("[data-ohw-footer-col]");
10239
- if (frameContainer && !getNavigationItemAnchor(target)) {
10240
- hoveredNavContainerRef.current = frameContainer;
10241
- setHoveredNavContainerRect(frameContainer.getBoundingClientRect());
10210
+ const navContainer = target.closest("[data-ohw-nav-container]");
10211
+ if (navContainer && !getNavigationItemAnchor(target)) {
10212
+ hoveredNavContainerRef.current = navContainer;
10213
+ setHoveredNavContainerRect(navContainer.getBoundingClientRect());
10242
10214
  hoveredItemElRef.current = null;
10243
10215
  setHoveredItemRect(null);
10244
10216
  return;
10245
10217
  }
10246
- if (!target.closest("[data-ohw-nav-container], [data-ohw-footer-col]")) {
10218
+ if (!target.closest("[data-ohw-nav-container]")) {
10247
10219
  hoveredNavContainerRef.current = null;
10248
10220
  setHoveredNavContainerRect(null);
10249
10221
  }
10250
10222
  }
10251
- const footerCol = target.closest("[data-ohw-footer-col]");
10252
- if (footerCol) {
10253
- hoveredNavContainerRef.current = null;
10254
- setHoveredNavContainerRect(null);
10255
- if (selectedElRef.current === footerCol) return;
10256
- hoveredItemElRef.current = footerCol;
10257
- setHoveredItemRect(footerCol.getBoundingClientRect());
10258
- return;
10259
- }
10260
10223
  const navAnchor = getNavigationItemAnchor(target);
10261
10224
  if (navAnchor) {
10262
10225
  hoveredNavContainerRef.current = null;
@@ -10268,6 +10231,15 @@ function OhhwellsBridge() {
10268
10231
  setHoveredItemRect(navAnchor.getBoundingClientRect());
10269
10232
  return;
10270
10233
  }
10234
+ const footerCol = target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
10235
+ if (footerCol) {
10236
+ hoveredNavContainerRef.current = null;
10237
+ setHoveredNavContainerRect(null);
10238
+ if (selectedElRef.current === footerCol) return;
10239
+ hoveredItemElRef.current = footerCol;
10240
+ setHoveredItemRect(footerCol.getBoundingClientRect());
10241
+ return;
10242
+ }
10271
10243
  const editable = target.closest("[data-ohw-editable]");
10272
10244
  if (!editable) return;
10273
10245
  const selected = selectedElRef.current;
@@ -10285,19 +10257,21 @@ function OhhwellsBridge() {
10285
10257
  };
10286
10258
  const handleMouseOut = (e) => {
10287
10259
  const target = e.target;
10288
- if (target.closest("[data-ohw-nav-container], [data-ohw-footer-col]")) {
10260
+ if (target.closest("[data-ohw-nav-container], [data-ohw-footer-col], [data-ohw-footer-column]")) {
10289
10261
  const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
10290
- if (related2?.closest("[data-ohw-nav-container], [data-ohw-footer-col], [data-ohw-navbar-container-chrome], [data-ohw-navbar-add-button]")) {
10262
+ if (related2?.closest("[data-ohw-nav-container], [data-ohw-footer-col], [data-ohw-footer-column], [data-ohw-navbar-container-chrome], [data-ohw-navbar-add-button]")) {
10291
10263
  return;
10292
10264
  }
10293
10265
  hoveredNavContainerRef.current = null;
10294
10266
  setHoveredNavContainerRect(null);
10295
10267
  }
10296
- const footerCol = target.closest("[data-ohw-footer-col]");
10268
+ const footerCol = target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
10297
10269
  if (footerCol && hoveredItemElRef.current === footerCol) {
10298
10270
  const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
10299
10271
  if (related2?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
10300
- if (related2?.closest("[data-ohw-footer-col]") === footerCol) return;
10272
+ if (related2?.closest("[data-ohw-footer-col], [data-ohw-footer-column]") === footerCol) {
10273
+ return;
10274
+ }
10301
10275
  hoveredItemElRef.current = null;
10302
10276
  setHoveredItemRect(null);
10303
10277
  return;
@@ -10413,12 +10387,12 @@ function OhhwellsBridge() {
10413
10387
  const stickyPad = 48;
10414
10388
  const withinPad = x >= pr.left - stickyPad && x <= pr.left + pr.width + stickyPad && y >= pr.top - stickyPad && y <= pr.top + pr.height + stickyPad;
10415
10389
  if (withinPad) {
10416
- const yieldToSmaller = smallest !== pinned && candidatePool.includes(smallest) && (() => {
10390
+ if (smallest !== pinned && candidatePool.includes(smallest)) {
10417
10391
  const sr = getVisibleRect(smallest);
10418
- const pr2 = getVisibleRect(pinned);
10419
- return sr.width * sr.height < pr2.width * pr2.height;
10420
- })();
10421
- if (!yieldToSmaller) return pinned;
10392
+ const overOther = x >= sr.left && x <= sr.left + sr.width && y >= sr.top && y <= sr.top + sr.height;
10393
+ if (overOther) return smallest;
10394
+ }
10395
+ return pinned;
10422
10396
  }
10423
10397
  }
10424
10398
  return smallest;
@@ -10430,20 +10404,17 @@ function OhhwellsBridge() {
10430
10404
  resumeAnimTracks();
10431
10405
  postToParentRef.current({ type: "ow:image-unhover" });
10432
10406
  }
10433
- clearImageHover();
10434
10407
  };
10435
10408
  const probeNavigationHoverAt = (x, y) => {
10436
10409
  if (toolbarVariantRef.current === "select-frame") {
10437
10410
  hoveredNavContainerRef.current = null;
10438
10411
  setHoveredNavContainerRect(null);
10439
- return;
10440
10412
  }
10441
- const frameContainers = [
10442
- ...document.querySelectorAll("[data-ohw-nav-container]"),
10443
- ...document.querySelectorAll("[data-ohw-footer-col]")
10444
- ];
10445
- let overFrame = null;
10446
- for (const container of frameContainers) {
10413
+ const navContainers = Array.from(
10414
+ document.querySelectorAll("[data-ohw-nav-container]")
10415
+ );
10416
+ const footerColumns = listFooterColumns();
10417
+ for (const container of [...navContainers, ...footerColumns]) {
10447
10418
  const containerRect = container.getBoundingClientRect();
10448
10419
  const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
10449
10420
  if (!overContainer) continue;
@@ -10462,21 +10433,51 @@ function OhhwellsBridge() {
10462
10433
  clearHrefKeyHover(navItemHit);
10463
10434
  hoveredItemElRef.current = navItemHit;
10464
10435
  setHoveredItemRect(navItemHit.getBoundingClientRect());
10436
+ } else if (hoveredItemElRef.current === navItemHit) {
10437
+ hoveredItemElRef.current = null;
10438
+ setHoveredItemRect(null);
10465
10439
  }
10466
10440
  return;
10467
10441
  }
10468
- overFrame = container;
10469
- break;
10470
10442
  }
10471
- if (!overFrame) {
10443
+ if (toolbarVariantRef.current !== "select-frame") {
10444
+ for (const container of navContainers) {
10445
+ const containerRect = container.getBoundingClientRect();
10446
+ const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
10447
+ if (!overContainer) continue;
10448
+ if (isPointOverNavItem(container, x, y)) continue;
10449
+ hoveredNavContainerRef.current = container;
10450
+ setHoveredNavContainerRect(container.getBoundingClientRect());
10451
+ hoveredItemElRef.current = null;
10452
+ setHoveredItemRect(null);
10453
+ return;
10454
+ }
10472
10455
  hoveredNavContainerRef.current = null;
10473
10456
  setHoveredNavContainerRect(null);
10457
+ } else {
10458
+ hoveredNavContainerRef.current = null;
10459
+ setHoveredNavContainerRect(null);
10460
+ }
10461
+ for (const column of footerColumns) {
10462
+ const containerRect = column.getBoundingClientRect();
10463
+ const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
10464
+ if (!overContainer) continue;
10465
+ if (isPointOverNavItem(column, x, y)) continue;
10466
+ if (selectedElRef.current === column) {
10467
+ if (hoveredItemElRef.current === column) {
10468
+ hoveredItemElRef.current = null;
10469
+ setHoveredItemRect(null);
10470
+ }
10471
+ return;
10472
+ }
10473
+ hoveredItemElRef.current = column;
10474
+ setHoveredItemRect(column.getBoundingClientRect());
10474
10475
  return;
10475
10476
  }
10476
- hoveredNavContainerRef.current = overFrame;
10477
- setHoveredNavContainerRect(overFrame.getBoundingClientRect());
10478
- hoveredItemElRef.current = null;
10479
- setHoveredItemRect(null);
10477
+ if (hoveredItemElRef.current?.hasAttribute("data-ohw-footer-col") || hoveredItemElRef.current?.hasAttribute("data-ohw-footer-column")) {
10478
+ hoveredItemElRef.current = null;
10479
+ setHoveredItemRect(null);
10480
+ }
10480
10481
  };
10481
10482
  const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
10482
10483
  if (linkPopoverOpenRef.current) {
@@ -10497,6 +10498,10 @@ function OhhwellsBridge() {
10497
10498
  }
10498
10499
  hoveredNavContainerRef.current = null;
10499
10500
  setHoveredNavContainerRect(null);
10501
+ if (hoveredItemElRef.current?.hasAttribute("data-ohw-footer-col") || hoveredItemElRef.current?.hasAttribute("data-ohw-footer-column")) {
10502
+ hoveredItemElRef.current = null;
10503
+ setHoveredItemRect(null);
10504
+ }
10500
10505
  const toggleEl = document.querySelector("[data-ohw-state-toggle]");
10501
10506
  if (toggleEl) {
10502
10507
  const tr = toggleEl.getBoundingClientRect();
@@ -10537,7 +10542,7 @@ function OhhwellsBridge() {
10537
10542
  return;
10538
10543
  }
10539
10544
  const topEl = document.elementFromPoint(x2, y2);
10540
- if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"], [data-ohw-media-chrome]')) {
10545
+ if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
10541
10546
  if (hoveredImageRef.current) {
10542
10547
  hoveredImageRef.current = null;
10543
10548
  resumeAnimTracks();
@@ -10821,7 +10826,6 @@ function OhhwellsBridge() {
10821
10826
  if (!entry || entry.fadingOut) return prev;
10822
10827
  return { ...prev, [key]: { ...entry, fadingOut: true } };
10823
10828
  });
10824
- if (pendingUploadRectRef.current?.key === key) pendingUploadRectRef.current = null;
10825
10829
  };
10826
10830
  let found = false;
10827
10831
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -10961,7 +10965,6 @@ function OhhwellsBridge() {
10961
10965
  editContentRef.current = { ...editContentRef.current, ...content };
10962
10966
  reconcileNavbarItemsFromContent(editContentRef.current);
10963
10967
  syncNavigationDragCursorAttrs();
10964
- reconcileFooterOrderFromContent(editContentRef.current);
10965
10968
  enforceLinkHrefs();
10966
10969
  postToParentRef.current({ type: "ow:hydrate-done" });
10967
10970
  };
@@ -11234,43 +11237,23 @@ function OhhwellsBridge() {
11234
11237
  activeStateElRef.current = null;
11235
11238
  setToggleState(null);
11236
11239
  };
11237
- const resolveUploadRects = (key) => {
11238
- const matches = Array.from(document.querySelectorAll(`[data-ohw-key="${key}"]`));
11239
- const rects = matches.map((el) => {
11240
- const r2 = el.getBoundingClientRect();
11241
- return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
11242
- }).filter((r2) => r2.width > 1 && r2.height > 1);
11243
- if (rects.length > 0) return rects;
11244
- const pending = pendingUploadRectRef.current;
11245
- if (pending?.key === key && pending.rect.width > 1 && pending.rect.height > 1) {
11246
- return [pending.rect];
11247
- }
11248
- const hovered = hoveredImageRef.current;
11249
- if (hovered?.dataset.ohwKey === key) {
11250
- const r2 = hovered.getBoundingClientRect();
11251
- if (r2.width > 1 && r2.height > 1) {
11252
- return [{ top: r2.top, left: r2.left, width: r2.width, height: r2.height }];
11253
- }
11254
- }
11255
- return [];
11256
- };
11257
11240
  const handleImageUploading = (e) => {
11258
- const type = e.data?.type;
11259
- if (type !== "ow:image-uploading" && type !== "ow:anim-lock") return;
11260
- const key = e.data.key;
11261
- if (!key) return;
11262
- const uploading = type === "ow:anim-lock" ? true : !!e.data.uploading;
11241
+ if (e.data?.type !== "ow:image-uploading") return;
11242
+ const { key, uploading } = e.data;
11263
11243
  setUploadingRects((prev) => {
11264
11244
  if (!uploading) {
11265
- if (pendingUploadRectRef.current?.key === key) pendingUploadRectRef.current = null;
11266
11245
  if (!(key in prev)) return prev;
11267
11246
  const next = { ...prev };
11268
11247
  delete next[key];
11269
11248
  return next;
11270
11249
  }
11271
- const rects = resolveUploadRects(key);
11272
- if (rects.length === 0) return prev;
11273
- return { ...prev, [key]: { rects } };
11250
+ const el = document.querySelector(`[data-ohw-key="${key}"]`);
11251
+ if (!el) return prev;
11252
+ const r2 = getVisibleRect(el);
11253
+ return {
11254
+ ...prev,
11255
+ [key]: { rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height } }
11256
+ };
11274
11257
  });
11275
11258
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
11276
11259
  const track = el.closest("[data-ohw-hover-pause]");
@@ -11387,7 +11370,7 @@ function OhhwellsBridge() {
11387
11370
  }
11388
11371
  }
11389
11372
  const footerColumn = findHoveredNavOrFooterContainer(clientX, clientY);
11390
- if (footerColumn?.hasAttribute("data-ohw-footer-col")) {
11373
+ if (footerColumn?.hasAttribute("data-ohw-footer-col") || footerColumn?.hasAttribute("data-ohw-footer-column")) {
11391
11374
  selectFrameRef.current(footerColumn);
11392
11375
  return;
11393
11376
  }
@@ -11776,14 +11759,14 @@ function OhhwellsBridge() {
11776
11759
  },
11777
11760
  [postToParent2, sitePages, sectionsByPath]
11778
11761
  );
11762
+ const showEditLink = toolbarShowEditLink;
11763
+ const currentSections = sectionsByPath[pathname] ?? [];
11764
+ linkPopoverOpenRef.current = linkPopover !== null;
11779
11765
  const handleMediaReplace = (0, import_react9.useCallback)(
11780
11766
  (key) => {
11781
- if (mediaHover?.key === key) {
11782
- pendingUploadRectRef.current = { key, rect: mediaHover.rect };
11783
- }
11784
11767
  postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
11785
11768
  },
11786
- [postToParent2, mediaHover]
11769
+ [postToParent2, mediaHover?.elementType]
11787
11770
  );
11788
11771
  const handleMediaFadeOutComplete = (0, import_react9.useCallback)((key) => {
11789
11772
  setUploadingRects((prev) => {
@@ -11815,25 +11798,20 @@ function OhhwellsBridge() {
11815
11798
  },
11816
11799
  [postToParent2]
11817
11800
  );
11818
- const showEditLink = toolbarShowEditLink;
11819
- const currentSections = sectionsByPath[pathname] ?? [];
11820
- linkPopoverOpenRef.current = linkPopover !== null;
11821
11801
  return bridgeRoot ? (0, import_react_dom3.createPortal)(
11822
11802
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
11823
11803
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
11824
- Object.entries(uploadingRects).flatMap(
11825
- ([key, { rects, fadingOut }]) => rects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
11826
- MediaOverlay,
11827
- {
11828
- hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
11829
- isUploading: true,
11830
- fadingOut,
11831
- onFadeOutComplete: handleMediaFadeOutComplete,
11832
- onReplace: handleMediaReplace
11833
- },
11834
- `uploading-${key}-${i}`
11835
- ))
11836
- ),
11804
+ Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
11805
+ MediaOverlay,
11806
+ {
11807
+ hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
11808
+ isUploading: true,
11809
+ fadingOut,
11810
+ onFadeOutComplete: handleMediaFadeOutComplete,
11811
+ onReplace: handleMediaReplace
11812
+ },
11813
+ `uploading-${key}`
11814
+ )),
11837
11815
  mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
11838
11816
  MediaOverlay,
11839
11817
  {
@@ -11888,9 +11866,9 @@ function OhhwellsBridge() {
11888
11866
  },
11889
11867
  `nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
11890
11868
  )),
11891
- hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && !siblingHintRect && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
11892
- toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
11893
- hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !siblingHintRect && siblingHintRects.length === 0 && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
11869
+ hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
11870
+ toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
11871
+ hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
11894
11872
  toolbarRect && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
11895
11873
  ItemInteractionLayer,
11896
11874
  {