@ohhwells/bridge 0.1.42-next.102 → 0.1.42-next.104

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
@@ -7306,18 +7306,28 @@ function buildRootNavDropSlots() {
7306
7306
  });
7307
7307
  return slots;
7308
7308
  }
7309
+ const edgeGap = (() => {
7310
+ if (items.length < 2) return 32;
7311
+ const a = items[0].getBoundingClientRect();
7312
+ const b = items[1].getBoundingClientRect();
7313
+ return Math.max(0, b.left - a.right);
7314
+ })();
7309
7315
  for (let i = 0; i <= items.length; i++) {
7310
7316
  let left;
7311
7317
  let top;
7312
7318
  let height;
7313
7319
  if (i === 0) {
7314
7320
  const first = items[0].getBoundingClientRect();
7315
- left = first.left - barThickness / 2;
7321
+ left = first.left - edgeGap / 2 - barThickness / 2;
7316
7322
  top = first.top;
7317
7323
  height = first.height;
7318
7324
  } else if (i === items.length) {
7319
7325
  const last = items[items.length - 1].getBoundingClientRect();
7320
- left = last.right - barThickness / 2;
7326
+ const lastGap = items.length >= 2 ? Math.max(
7327
+ 0,
7328
+ last.left - items[items.length - 2].getBoundingClientRect().right
7329
+ ) : edgeGap;
7330
+ left = last.right + lastGap / 2 - barThickness / 2;
7321
7331
  top = last.top;
7322
7332
  height = last.height;
7323
7333
  } else {
@@ -7344,18 +7354,28 @@ function buildChildNavDropSlots(parentHrefKey) {
7344
7354
  const slots = [];
7345
7355
  const barThickness = 3;
7346
7356
  if (children.length === 0) return slots;
7357
+ const edgeGap = (() => {
7358
+ if (children.length < 2) return 16;
7359
+ const a = children[0].getBoundingClientRect();
7360
+ const b = children[1].getBoundingClientRect();
7361
+ return Math.max(0, b.top - a.bottom);
7362
+ })();
7347
7363
  for (let i = 0; i <= children.length; i++) {
7348
7364
  let top;
7349
7365
  let width;
7350
7366
  let left;
7351
7367
  if (i === 0) {
7352
7368
  const first = children[0].getBoundingClientRect();
7353
- top = first.top - barThickness / 2;
7369
+ top = first.top - edgeGap / 2 - barThickness / 2;
7354
7370
  left = first.left;
7355
7371
  width = first.width;
7356
7372
  } else if (i === children.length) {
7357
7373
  const last = children[children.length - 1].getBoundingClientRect();
7358
- top = last.bottom - barThickness / 2;
7374
+ const lastGap = children.length >= 2 ? Math.max(
7375
+ 0,
7376
+ last.top - children[children.length - 2].getBoundingClientRect().bottom
7377
+ ) : edgeGap;
7378
+ top = last.bottom + lastGap / 2 - barThickness / 2;
7359
7379
  left = last.left;
7360
7380
  width = last.width;
7361
7381
  } else {
@@ -7407,12 +7427,6 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
7407
7427
  }
7408
7428
  return best?.slot ?? null;
7409
7429
  }
7410
- function siblingRectsForNavDrag(draggedEl, activeParentId) {
7411
- if (activeParentId) {
7412
- return listNavChildren(activeParentId).filter((el) => el !== draggedEl).map((el) => el.getBoundingClientRect());
7413
- }
7414
- return listReorderableNavItems().filter((el) => el !== draggedEl).map((el) => el.getBoundingClientRect());
7415
- }
7416
7430
 
7417
7431
  // src/useNavItemDrag.ts
7418
7432
  var import_react8 = require("react");
@@ -7461,8 +7475,7 @@ function useNavItemDrag({
7461
7475
  session.lastClientY = clientY;
7462
7476
  }
7463
7477
  session.activeSlot = activeSlot;
7464
- const parentId = activeSlot?.parentId ?? null;
7465
- setSiblingHintRects(siblingRectsForNavDrag(session.draggedEl, parentId));
7478
+ setSiblingHintRects([]);
7466
7479
  const slots = buildAllNavDropSlots(session.hrefKey);
7467
7480
  setNavDropSlots(slots);
7468
7481
  const activeIdx = activeSlot ? slots.findIndex(
@@ -9480,21 +9493,11 @@ function OhhwellsBridge() {
9480
9493
  session.lastClientY = clientY;
9481
9494
  }
9482
9495
  session.activeSlot = activeSlot;
9496
+ setSiblingHintRects([]);
9483
9497
  if (session.kind === "link") {
9484
- const columns2 = listFooterColumns();
9485
- const focusCols = /* @__PURE__ */ new Set([session.sourceColumnIndex]);
9486
- if (activeSlot) focusCols.add(activeSlot.columnIndex);
9487
- const siblingRects = [];
9488
- columns2.forEach((col, i) => {
9489
- if (!focusCols.has(i)) return;
9490
- for (const link of listFooterLinksInColumn(col)) {
9491
- if (link === dragged) continue;
9492
- siblingRects.push(link.getBoundingClientRect());
9493
- }
9494
- });
9495
- setSiblingHintRects(siblingRects);
9498
+ const columns = listFooterColumns();
9496
9499
  const slots2 = [];
9497
- columns2.forEach((col, i) => {
9500
+ columns.forEach((col, i) => {
9498
9501
  slots2.push(...buildLinkDropSlots(col, i));
9499
9502
  });
9500
9503
  setFooterDropSlots(slots2);
@@ -9502,8 +9505,6 @@ function OhhwellsBridge() {
9502
9505
  setActiveFooterDropIndex(activeIdx2 >= 0 ? activeIdx2 : null);
9503
9506
  return;
9504
9507
  }
9505
- const columns = listFooterColumns();
9506
- setSiblingHintRects(columns.filter((col) => col !== dragged).map((col) => col.getBoundingClientRect()));
9507
9508
  const slots = buildColumnDropSlots();
9508
9509
  setFooterDropSlots(slots);
9509
9510
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
@@ -12111,7 +12112,7 @@ function OhhwellsBridge() {
12111
12112
  }
12112
12113
  ),
12113
12114
  siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
12114
- siblingHintRects.length > 0 && !linkPopover && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
12115
+ siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
12115
12116
  isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
12116
12117
  isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
12117
12118
  "div",