@ohhwells/bridge 0.1.42-next.87 → 0.1.42-next.88
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 +78 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +78 -134
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6617,17 +6617,20 @@ function navOrderKeysEqual(a, b) {
|
|
|
6617
6617
|
}
|
|
6618
6618
|
return true;
|
|
6619
6619
|
}
|
|
6620
|
-
function
|
|
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 =
|
|
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
|
-
|
|
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-
|
|
8177
|
+
const explicit = item.closest("[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-
|
|
8194
|
+
if (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-
|
|
8204
|
+
return el.closest("[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-
|
|
8228
|
+
...document.querySelectorAll("[data-ohw-footer-column]")
|
|
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-
|
|
8275
|
+
if (el.hasAttribute("data-ohw-nav-container") || 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
|
-
|
|
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,7 +10207,7 @@ 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]");
|
|
10210
|
+
const frameContainer = target.closest("[data-ohw-nav-container]") ?? target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
|
|
10239
10211
|
if (frameContainer && !getNavigationItemAnchor(target)) {
|
|
10240
10212
|
hoveredNavContainerRef.current = frameContainer;
|
|
10241
10213
|
setHoveredNavContainerRect(frameContainer.getBoundingClientRect());
|
|
@@ -10243,20 +10215,11 @@ function OhhwellsBridge() {
|
|
|
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], [data-ohw-footer-col], [data-ohw-footer-column]")) {
|
|
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,9 +10257,9 @@ 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-
|
|
10260
|
+
if (target.closest("[data-ohw-nav-container], [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-
|
|
10262
|
+
if (related2?.closest("[data-ohw-nav-container], [data-ohw-footer-column], [data-ohw-navbar-container-chrome], [data-ohw-navbar-add-button]")) {
|
|
10291
10263
|
return;
|
|
10292
10264
|
}
|
|
10293
10265
|
hoveredNavContainerRef.current = null;
|
|
@@ -10413,12 +10385,12 @@ function OhhwellsBridge() {
|
|
|
10413
10385
|
const stickyPad = 48;
|
|
10414
10386
|
const withinPad = x >= pr.left - stickyPad && x <= pr.left + pr.width + stickyPad && y >= pr.top - stickyPad && y <= pr.top + pr.height + stickyPad;
|
|
10415
10387
|
if (withinPad) {
|
|
10416
|
-
|
|
10388
|
+
if (smallest !== pinned && candidatePool.includes(smallest)) {
|
|
10417
10389
|
const sr = getVisibleRect(smallest);
|
|
10418
|
-
const
|
|
10419
|
-
|
|
10420
|
-
}
|
|
10421
|
-
|
|
10390
|
+
const overOther = x >= sr.left && x <= sr.left + sr.width && y >= sr.top && y <= sr.top + sr.height;
|
|
10391
|
+
if (overOther) return smallest;
|
|
10392
|
+
}
|
|
10393
|
+
return pinned;
|
|
10422
10394
|
}
|
|
10423
10395
|
}
|
|
10424
10396
|
return smallest;
|
|
@@ -10430,7 +10402,6 @@ function OhhwellsBridge() {
|
|
|
10430
10402
|
resumeAnimTracks();
|
|
10431
10403
|
postToParentRef.current({ type: "ow:image-unhover" });
|
|
10432
10404
|
}
|
|
10433
|
-
clearImageHover();
|
|
10434
10405
|
};
|
|
10435
10406
|
const probeNavigationHoverAt = (x, y) => {
|
|
10436
10407
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -10440,7 +10411,7 @@ function OhhwellsBridge() {
|
|
|
10440
10411
|
}
|
|
10441
10412
|
const frameContainers = [
|
|
10442
10413
|
...document.querySelectorAll("[data-ohw-nav-container]"),
|
|
10443
|
-
...document.querySelectorAll("[data-ohw-footer-
|
|
10414
|
+
...document.querySelectorAll("[data-ohw-footer-column]")
|
|
10444
10415
|
];
|
|
10445
10416
|
let overFrame = null;
|
|
10446
10417
|
for (const container of frameContainers) {
|
|
@@ -10537,7 +10508,7 @@ function OhhwellsBridge() {
|
|
|
10537
10508
|
return;
|
|
10538
10509
|
}
|
|
10539
10510
|
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"]
|
|
10511
|
+
if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
10541
10512
|
if (hoveredImageRef.current) {
|
|
10542
10513
|
hoveredImageRef.current = null;
|
|
10543
10514
|
resumeAnimTracks();
|
|
@@ -10821,7 +10792,6 @@ function OhhwellsBridge() {
|
|
|
10821
10792
|
if (!entry || entry.fadingOut) return prev;
|
|
10822
10793
|
return { ...prev, [key]: { ...entry, fadingOut: true } };
|
|
10823
10794
|
});
|
|
10824
|
-
if (pendingUploadRectRef.current?.key === key) pendingUploadRectRef.current = null;
|
|
10825
10795
|
};
|
|
10826
10796
|
let found = false;
|
|
10827
10797
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -10961,7 +10931,6 @@ function OhhwellsBridge() {
|
|
|
10961
10931
|
editContentRef.current = { ...editContentRef.current, ...content };
|
|
10962
10932
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
10963
10933
|
syncNavigationDragCursorAttrs();
|
|
10964
|
-
reconcileFooterOrderFromContent(editContentRef.current);
|
|
10965
10934
|
enforceLinkHrefs();
|
|
10966
10935
|
postToParentRef.current({ type: "ow:hydrate-done" });
|
|
10967
10936
|
};
|
|
@@ -11234,43 +11203,23 @@ function OhhwellsBridge() {
|
|
|
11234
11203
|
activeStateElRef.current = null;
|
|
11235
11204
|
setToggleState(null);
|
|
11236
11205
|
};
|
|
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
11206
|
const handleImageUploading = (e) => {
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
const key = e.data.key;
|
|
11261
|
-
if (!key) return;
|
|
11262
|
-
const uploading = type === "ow:anim-lock" ? true : !!e.data.uploading;
|
|
11207
|
+
if (e.data?.type !== "ow:image-uploading") return;
|
|
11208
|
+
const { key, uploading } = e.data;
|
|
11263
11209
|
setUploadingRects((prev) => {
|
|
11264
11210
|
if (!uploading) {
|
|
11265
|
-
if (pendingUploadRectRef.current?.key === key) pendingUploadRectRef.current = null;
|
|
11266
11211
|
if (!(key in prev)) return prev;
|
|
11267
11212
|
const next = { ...prev };
|
|
11268
11213
|
delete next[key];
|
|
11269
11214
|
return next;
|
|
11270
11215
|
}
|
|
11271
|
-
const
|
|
11272
|
-
if (
|
|
11273
|
-
|
|
11216
|
+
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
11217
|
+
if (!el) return prev;
|
|
11218
|
+
const r2 = getVisibleRect(el);
|
|
11219
|
+
return {
|
|
11220
|
+
...prev,
|
|
11221
|
+
[key]: { rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height } }
|
|
11222
|
+
};
|
|
11274
11223
|
});
|
|
11275
11224
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
11276
11225
|
const track = el.closest("[data-ohw-hover-pause]");
|
|
@@ -11387,7 +11336,7 @@ function OhhwellsBridge() {
|
|
|
11387
11336
|
}
|
|
11388
11337
|
}
|
|
11389
11338
|
const footerColumn = findHoveredNavOrFooterContainer(clientX, clientY);
|
|
11390
|
-
if (footerColumn?.hasAttribute("data-ohw-footer-
|
|
11339
|
+
if (footerColumn?.hasAttribute("data-ohw-footer-column")) {
|
|
11391
11340
|
selectFrameRef.current(footerColumn);
|
|
11392
11341
|
return;
|
|
11393
11342
|
}
|
|
@@ -11776,14 +11725,14 @@ function OhhwellsBridge() {
|
|
|
11776
11725
|
},
|
|
11777
11726
|
[postToParent2, sitePages, sectionsByPath]
|
|
11778
11727
|
);
|
|
11728
|
+
const showEditLink = toolbarShowEditLink;
|
|
11729
|
+
const currentSections = sectionsByPath[pathname] ?? [];
|
|
11730
|
+
linkPopoverOpenRef.current = linkPopover !== null;
|
|
11779
11731
|
const handleMediaReplace = (0, import_react9.useCallback)(
|
|
11780
11732
|
(key) => {
|
|
11781
|
-
if (mediaHover?.key === key) {
|
|
11782
|
-
pendingUploadRectRef.current = { key, rect: mediaHover.rect };
|
|
11783
|
-
}
|
|
11784
11733
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
11785
11734
|
},
|
|
11786
|
-
[postToParent2, mediaHover]
|
|
11735
|
+
[postToParent2, mediaHover?.elementType]
|
|
11787
11736
|
);
|
|
11788
11737
|
const handleMediaFadeOutComplete = (0, import_react9.useCallback)((key) => {
|
|
11789
11738
|
setUploadingRects((prev) => {
|
|
@@ -11815,25 +11764,20 @@ function OhhwellsBridge() {
|
|
|
11815
11764
|
},
|
|
11816
11765
|
[postToParent2]
|
|
11817
11766
|
);
|
|
11818
|
-
const showEditLink = toolbarShowEditLink;
|
|
11819
|
-
const currentSections = sectionsByPath[pathname] ?? [];
|
|
11820
|
-
linkPopoverOpenRef.current = linkPopover !== null;
|
|
11821
11767
|
return bridgeRoot ? (0, import_react_dom3.createPortal)(
|
|
11822
11768
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
11823
11769
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
11824
|
-
Object.entries(uploadingRects).
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
{
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
))
|
|
11836
|
-
),
|
|
11770
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11771
|
+
MediaOverlay,
|
|
11772
|
+
{
|
|
11773
|
+
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
11774
|
+
isUploading: true,
|
|
11775
|
+
fadingOut,
|
|
11776
|
+
onFadeOutComplete: handleMediaFadeOutComplete,
|
|
11777
|
+
onReplace: handleMediaReplace
|
|
11778
|
+
},
|
|
11779
|
+
`uploading-${key}`
|
|
11780
|
+
)),
|
|
11837
11781
|
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11838
11782
|
MediaOverlay,
|
|
11839
11783
|
{
|
|
@@ -11888,9 +11832,9 @@ function OhhwellsBridge() {
|
|
|
11888
11832
|
},
|
|
11889
11833
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
11890
11834
|
)),
|
|
11891
|
-
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging &&
|
|
11892
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
11893
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !
|
|
11835
|
+
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
11836
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
11837
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
11894
11838
|
toolbarRect && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11895
11839
|
ItemInteractionLayer,
|
|
11896
11840
|
{
|