@ohhwells/bridge 0.1.42-next.89 → 0.1.42-next.90
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 +51 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8142,6 +8142,11 @@ function getNavigationItemAnchor(el) {
|
|
|
8142
8142
|
function isNavigationItem(el) {
|
|
8143
8143
|
return getNavigationItemAnchor(el) !== null;
|
|
8144
8144
|
}
|
|
8145
|
+
function listNavigationItems() {
|
|
8146
|
+
return Array.from(
|
|
8147
|
+
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
8148
|
+
).filter((el) => isNavigationItem(el));
|
|
8149
|
+
}
|
|
8145
8150
|
function getNavigationItemReorderState(anchor) {
|
|
8146
8151
|
if (isNavbarButton2(anchor)) return { key: null, disabled: false };
|
|
8147
8152
|
return getReorderHandleStateFromAnchor(anchor);
|
|
@@ -8277,6 +8282,18 @@ function getNavigationSelectionParent(el) {
|
|
|
8277
8282
|
}
|
|
8278
8283
|
return null;
|
|
8279
8284
|
}
|
|
8285
|
+
function collectNavigationItemSiblingHintRects(selected) {
|
|
8286
|
+
if (!isNavigationItem(selected)) return [];
|
|
8287
|
+
const footerColumn = getFooterColumn(selected);
|
|
8288
|
+
if (footerColumn) {
|
|
8289
|
+
return listFooterLinksInColumn(footerColumn).filter((link) => link !== selected).map((link) => link.getBoundingClientRect());
|
|
8290
|
+
}
|
|
8291
|
+
const navContainer = selected.closest("[data-ohw-nav-container], [data-ohw-nav-drawer]");
|
|
8292
|
+
if (navContainer) {
|
|
8293
|
+
return Array.from(navContainer.querySelectorAll("[data-ohw-href-key]")).filter((el) => isNavigationItem(el) && el !== selected).map((el) => el.getBoundingClientRect());
|
|
8294
|
+
}
|
|
8295
|
+
return listNavigationItems().filter((el) => el !== selected).map((el) => el.getBoundingClientRect());
|
|
8296
|
+
}
|
|
8280
8297
|
function placeCaretAtPoint(el, x, y) {
|
|
8281
8298
|
const selection = window.getSelection();
|
|
8282
8299
|
if (!selection) return;
|
|
@@ -9162,6 +9179,7 @@ function OhhwellsBridge() {
|
|
|
9162
9179
|
setIsFooterFrameSelection(false);
|
|
9163
9180
|
setToolbarVariant("link-action");
|
|
9164
9181
|
setToolbarRect(link.getBoundingClientRect());
|
|
9182
|
+
setSiblingHintRects(collectNavigationItemSiblingHintRects(link));
|
|
9165
9183
|
return;
|
|
9166
9184
|
}
|
|
9167
9185
|
const colAttr = selectedFooterColAttrRef.current;
|
|
@@ -9188,6 +9206,7 @@ function OhhwellsBridge() {
|
|
|
9188
9206
|
setReorderDragDisabled(disabled);
|
|
9189
9207
|
setToolbarVariant("link-action");
|
|
9190
9208
|
setToolbarRect(navAnchor.getBoundingClientRect());
|
|
9209
|
+
setSiblingHintRects(collectNavigationItemSiblingHintRects(navAnchor));
|
|
9191
9210
|
setToolbarShowEditLink(false);
|
|
9192
9211
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
9193
9212
|
}, [markSelected]);
|
|
@@ -9553,7 +9572,7 @@ function OhhwellsBridge() {
|
|
|
9553
9572
|
hoveredItemElRef.current = null;
|
|
9554
9573
|
siblingHintElRef.current = null;
|
|
9555
9574
|
setSiblingHintRect(null);
|
|
9556
|
-
setSiblingHintRects(
|
|
9575
|
+
setSiblingHintRects(collectNavigationItemSiblingHintRects(anchor));
|
|
9557
9576
|
setIsItemDragging(false);
|
|
9558
9577
|
const { key, disabled } = getNavigationItemReorderState(anchor);
|
|
9559
9578
|
setReorderHrefKey(key);
|
|
@@ -10206,7 +10225,8 @@ function OhhwellsBridge() {
|
|
|
10206
10225
|
setHoveredNavContainerRect(null);
|
|
10207
10226
|
return;
|
|
10208
10227
|
}
|
|
10209
|
-
|
|
10228
|
+
const itemSelected = toolbarVariantRef.current === "link-action" && Boolean(selectedElRef.current && isNavigationItem(selectedElRef.current));
|
|
10229
|
+
if (toolbarVariantRef.current !== "select-frame" && !itemSelected) {
|
|
10210
10230
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
10211
10231
|
if (navContainer && !getNavigationItemAnchor(target)) {
|
|
10212
10232
|
hoveredNavContainerRef.current = navContainer;
|
|
@@ -10219,6 +10239,9 @@ function OhhwellsBridge() {
|
|
|
10219
10239
|
hoveredNavContainerRef.current = null;
|
|
10220
10240
|
setHoveredNavContainerRect(null);
|
|
10221
10241
|
}
|
|
10242
|
+
} else if (itemSelected) {
|
|
10243
|
+
hoveredNavContainerRef.current = null;
|
|
10244
|
+
setHoveredNavContainerRect(null);
|
|
10222
10245
|
}
|
|
10223
10246
|
const navAnchor = getNavigationItemAnchor(target);
|
|
10224
10247
|
if (navAnchor) {
|
|
@@ -10235,7 +10258,7 @@ function OhhwellsBridge() {
|
|
|
10235
10258
|
if (footerCol) {
|
|
10236
10259
|
hoveredNavContainerRef.current = null;
|
|
10237
10260
|
setHoveredNavContainerRect(null);
|
|
10238
|
-
if (selectedElRef.current === footerCol) return;
|
|
10261
|
+
if (itemSelected || selectedElRef.current === footerCol) return;
|
|
10239
10262
|
hoveredItemElRef.current = footerCol;
|
|
10240
10263
|
setHoveredItemRect(footerCol.getBoundingClientRect());
|
|
10241
10264
|
return;
|
|
@@ -10406,7 +10429,8 @@ function OhhwellsBridge() {
|
|
|
10406
10429
|
}
|
|
10407
10430
|
};
|
|
10408
10431
|
const probeNavigationHoverAt = (x, y) => {
|
|
10409
|
-
|
|
10432
|
+
const itemSelected = toolbarVariantRef.current === "link-action" && Boolean(selectedElRef.current && isNavigationItem(selectedElRef.current));
|
|
10433
|
+
if (toolbarVariantRef.current === "select-frame" || itemSelected) {
|
|
10410
10434
|
hoveredNavContainerRef.current = null;
|
|
10411
10435
|
setHoveredNavContainerRect(null);
|
|
10412
10436
|
}
|
|
@@ -10440,7 +10464,7 @@ function OhhwellsBridge() {
|
|
|
10440
10464
|
return;
|
|
10441
10465
|
}
|
|
10442
10466
|
}
|
|
10443
|
-
if (toolbarVariantRef.current !== "select-frame") {
|
|
10467
|
+
if (toolbarVariantRef.current !== "select-frame" && !itemSelected) {
|
|
10444
10468
|
for (const container of navContainers) {
|
|
10445
10469
|
const containerRect = container.getBoundingClientRect();
|
|
10446
10470
|
const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
|
|
@@ -10458,21 +10482,23 @@ function OhhwellsBridge() {
|
|
|
10458
10482
|
hoveredNavContainerRef.current = null;
|
|
10459
10483
|
setHoveredNavContainerRect(null);
|
|
10460
10484
|
}
|
|
10461
|
-
|
|
10462
|
-
const
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
if (
|
|
10468
|
-
hoveredItemElRef.current
|
|
10469
|
-
|
|
10485
|
+
if (!itemSelected) {
|
|
10486
|
+
for (const column of footerColumns) {
|
|
10487
|
+
const containerRect = column.getBoundingClientRect();
|
|
10488
|
+
const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
|
|
10489
|
+
if (!overContainer) continue;
|
|
10490
|
+
if (isPointOverNavItem(column, x, y)) continue;
|
|
10491
|
+
if (selectedElRef.current === column) {
|
|
10492
|
+
if (hoveredItemElRef.current === column) {
|
|
10493
|
+
hoveredItemElRef.current = null;
|
|
10494
|
+
setHoveredItemRect(null);
|
|
10495
|
+
}
|
|
10496
|
+
return;
|
|
10470
10497
|
}
|
|
10498
|
+
hoveredItemElRef.current = column;
|
|
10499
|
+
setHoveredItemRect(column.getBoundingClientRect());
|
|
10471
10500
|
return;
|
|
10472
10501
|
}
|
|
10473
|
-
hoveredItemElRef.current = column;
|
|
10474
|
-
setHoveredItemRect(column.getBoundingClientRect());
|
|
10475
|
-
return;
|
|
10476
10502
|
}
|
|
10477
10503
|
if (hoveredItemElRef.current?.hasAttribute("data-ohw-footer-col") || hoveredItemElRef.current?.hasAttribute("data-ohw-footer-column")) {
|
|
10478
10504
|
hoveredItemElRef.current = null;
|
|
@@ -11122,10 +11148,14 @@ function OhhwellsBridge() {
|
|
|
11122
11148
|
setSiblingHintRect(siblingHintElRef.current.getBoundingClientRect());
|
|
11123
11149
|
}
|
|
11124
11150
|
const selected = selectedElRef.current;
|
|
11125
|
-
if (selected && !footerDragRef.current &&
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11151
|
+
if (selected && !footerDragRef.current && !navDragRef.current) {
|
|
11152
|
+
if (selected.hasAttribute("data-ohw-footer-col") || Boolean(selected.closest("footer") && isInferredFooterGroup(selected))) {
|
|
11153
|
+
setSiblingHintRects(
|
|
11154
|
+
listFooterColumns().filter((column) => column !== selected).map((column) => column.getBoundingClientRect())
|
|
11155
|
+
);
|
|
11156
|
+
} else if (isNavigationItem(selected)) {
|
|
11157
|
+
setSiblingHintRects(collectNavigationItemSiblingHintRects(selected));
|
|
11158
|
+
}
|
|
11129
11159
|
}
|
|
11130
11160
|
if (footerDragRef.current) {
|
|
11131
11161
|
const session = footerDragRef.current;
|