@ohhwells/bridge 0.1.42-next.88 → 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
@@ -8174,7 +8174,7 @@ function countFooterNavItems(el) {
8174
8174
  return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem).length;
8175
8175
  }
8176
8176
  function findFooterItemGroup(item) {
8177
- const explicit = item.closest("[data-ohw-footer-column]");
8177
+ const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
8178
8178
  if (explicit) return explicit;
8179
8179
  const footer = item.closest("footer");
8180
8180
  if (!footer) return null;
@@ -8191,7 +8191,7 @@ function isNavigationRoot(el) {
8191
8191
  function isInferredFooterGroup(el) {
8192
8192
  const footer = el.closest("footer");
8193
8193
  if (!footer || el === footer) return false;
8194
- if (el.hasAttribute("data-ohw-footer-column")) return true;
8194
+ if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
8195
8195
  return countFooterNavItems(el) >= 2;
8196
8196
  }
8197
8197
  function isNavigationContainer(el) {
@@ -8201,7 +8201,7 @@ function isNavbarLinksContainer(el) {
8201
8201
  return el.hasAttribute("data-ohw-nav-container");
8202
8202
  }
8203
8203
  function getFooterColumn(el) {
8204
- return el.closest("[data-ohw-footer-column]");
8204
+ return el.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
8205
8205
  }
8206
8206
  function resolveFooterColumnSelectionTarget(target, clientX, clientY) {
8207
8207
  if (getNavigationItemAnchor(target)) return null;
@@ -8225,7 +8225,7 @@ function isPointOverNavigation(x, y) {
8225
8225
  function findHoveredNavOrFooterContainer(x, y) {
8226
8226
  const candidates = [
8227
8227
  ...document.querySelectorAll("[data-ohw-nav-container]"),
8228
- ...document.querySelectorAll("[data-ohw-footer-column]")
8228
+ ...listFooterColumns()
8229
8229
  ];
8230
8230
  for (const container of candidates) {
8231
8231
  const r2 = container.getBoundingClientRect();
@@ -8272,7 +8272,7 @@ function getNavigationSelectionParent(el) {
8272
8272
  if (footerGroup) return footerGroup;
8273
8273
  return getNavigationRoot(el);
8274
8274
  }
8275
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup(el)) {
8275
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup(el)) {
8276
8276
  return getNavigationRoot(el);
8277
8277
  }
8278
8278
  return null;
@@ -10207,15 +10207,15 @@ function OhhwellsBridge() {
10207
10207
  return;
10208
10208
  }
10209
10209
  if (toolbarVariantRef.current !== "select-frame") {
10210
- const frameContainer = target.closest("[data-ohw-nav-container]") ?? target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
10211
- if (frameContainer && !getNavigationItemAnchor(target)) {
10212
- hoveredNavContainerRef.current = frameContainer;
10213
- 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());
10214
10214
  hoveredItemElRef.current = null;
10215
10215
  setHoveredItemRect(null);
10216
10216
  return;
10217
10217
  }
10218
- if (!target.closest("[data-ohw-nav-container], [data-ohw-footer-col], [data-ohw-footer-column]")) {
10218
+ if (!target.closest("[data-ohw-nav-container]")) {
10219
10219
  hoveredNavContainerRef.current = null;
10220
10220
  setHoveredNavContainerRect(null);
10221
10221
  }
@@ -10257,19 +10257,21 @@ function OhhwellsBridge() {
10257
10257
  };
10258
10258
  const handleMouseOut = (e) => {
10259
10259
  const target = e.target;
10260
- if (target.closest("[data-ohw-nav-container], [data-ohw-footer-column]")) {
10260
+ if (target.closest("[data-ohw-nav-container], [data-ohw-footer-col], [data-ohw-footer-column]")) {
10261
10261
  const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
10262
- if (related2?.closest("[data-ohw-nav-container], [data-ohw-footer-column], [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]")) {
10263
10263
  return;
10264
10264
  }
10265
10265
  hoveredNavContainerRef.current = null;
10266
10266
  setHoveredNavContainerRect(null);
10267
10267
  }
10268
- const footerCol = target.closest("[data-ohw-footer-col]");
10268
+ const footerCol = target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
10269
10269
  if (footerCol && hoveredItemElRef.current === footerCol) {
10270
10270
  const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
10271
10271
  if (related2?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
10272
- 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
+ }
10273
10275
  hoveredItemElRef.current = null;
10274
10276
  setHoveredItemRect(null);
10275
10277
  return;
@@ -10407,14 +10409,12 @@ function OhhwellsBridge() {
10407
10409
  if (toolbarVariantRef.current === "select-frame") {
10408
10410
  hoveredNavContainerRef.current = null;
10409
10411
  setHoveredNavContainerRect(null);
10410
- return;
10411
10412
  }
10412
- const frameContainers = [
10413
- ...document.querySelectorAll("[data-ohw-nav-container]"),
10414
- ...document.querySelectorAll("[data-ohw-footer-column]")
10415
- ];
10416
- let overFrame = null;
10417
- 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]) {
10418
10418
  const containerRect = container.getBoundingClientRect();
10419
10419
  const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
10420
10420
  if (!overContainer) continue;
@@ -10433,21 +10433,51 @@ function OhhwellsBridge() {
10433
10433
  clearHrefKeyHover(navItemHit);
10434
10434
  hoveredItemElRef.current = navItemHit;
10435
10435
  setHoveredItemRect(navItemHit.getBoundingClientRect());
10436
+ } else if (hoveredItemElRef.current === navItemHit) {
10437
+ hoveredItemElRef.current = null;
10438
+ setHoveredItemRect(null);
10436
10439
  }
10437
10440
  return;
10438
10441
  }
10439
- overFrame = container;
10440
- break;
10441
10442
  }
10442
- 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
+ }
10455
+ hoveredNavContainerRef.current = null;
10456
+ setHoveredNavContainerRect(null);
10457
+ } else {
10443
10458
  hoveredNavContainerRef.current = null;
10444
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());
10445
10475
  return;
10446
10476
  }
10447
- hoveredNavContainerRef.current = overFrame;
10448
- setHoveredNavContainerRect(overFrame.getBoundingClientRect());
10449
- hoveredItemElRef.current = null;
10450
- 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
+ }
10451
10481
  };
10452
10482
  const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
10453
10483
  if (linkPopoverOpenRef.current) {
@@ -10468,6 +10498,10 @@ function OhhwellsBridge() {
10468
10498
  }
10469
10499
  hoveredNavContainerRef.current = null;
10470
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
+ }
10471
10505
  const toggleEl = document.querySelector("[data-ohw-state-toggle]");
10472
10506
  if (toggleEl) {
10473
10507
  const tr = toggleEl.getBoundingClientRect();
@@ -11336,7 +11370,7 @@ function OhhwellsBridge() {
11336
11370
  }
11337
11371
  }
11338
11372
  const footerColumn = findHoveredNavOrFooterContainer(clientX, clientY);
11339
- if (footerColumn?.hasAttribute("data-ohw-footer-column")) {
11373
+ if (footerColumn?.hasAttribute("data-ohw-footer-col") || footerColumn?.hasAttribute("data-ohw-footer-column")) {
11340
11374
  selectFrameRef.current(footerColumn);
11341
11375
  return;
11342
11376
  }