@ohhwells/bridge 0.1.52 → 0.1.53
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/README.md +12 -1
- package/dist/index.cjs +374 -290
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +154 -70
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -69,7 +69,7 @@ __export(index_exports, {
|
|
|
69
69
|
module.exports = __toCommonJS(index_exports);
|
|
70
70
|
|
|
71
71
|
// src/OhhwellsBridge.tsx
|
|
72
|
-
var
|
|
72
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
73
73
|
var import_client = require("react-dom/client");
|
|
74
74
|
var import_react_dom2 = require("react-dom");
|
|
75
75
|
|
|
@@ -84,6 +84,9 @@ function getStoredLinkHref(key) {
|
|
|
84
84
|
function clearStoredLinkHref(key) {
|
|
85
85
|
linkHrefStore.delete(key);
|
|
86
86
|
}
|
|
87
|
+
function listStoredLinkHrefs() {
|
|
88
|
+
return Array.from(linkHrefStore.entries());
|
|
89
|
+
}
|
|
87
90
|
function enforceLinkHrefs() {
|
|
88
91
|
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
89
92
|
const key = el.getAttribute("data-ohw-href-key") ?? "";
|
|
@@ -118,11 +121,43 @@ function useLinkHrefGuardian(...deps) {
|
|
|
118
121
|
}, deps);
|
|
119
122
|
}
|
|
120
123
|
|
|
124
|
+
// src/useSavedLinkNavigation.ts
|
|
125
|
+
var import_react2 = require("react");
|
|
126
|
+
var import_navigation = require("next/navigation");
|
|
127
|
+
function isRouterHref(href) {
|
|
128
|
+
return href.startsWith("/") || href.startsWith("#");
|
|
129
|
+
}
|
|
130
|
+
function shouldLetBrowserHandle(e, anchor) {
|
|
131
|
+
return e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || anchor.hasAttribute("download") || anchor.target !== "" && anchor.target !== "_self";
|
|
132
|
+
}
|
|
133
|
+
function useSavedLinkNavigation(isEditMode) {
|
|
134
|
+
const router = (0, import_navigation.useRouter)();
|
|
135
|
+
(0, import_react2.useEffect)(() => {
|
|
136
|
+
if (isEditMode) return;
|
|
137
|
+
const onClick = (e) => {
|
|
138
|
+
const anchor = e.target?.closest(
|
|
139
|
+
"a[data-ohw-href-key]"
|
|
140
|
+
);
|
|
141
|
+
if (!anchor || shouldLetBrowserHandle(e, anchor)) return;
|
|
142
|
+
const key = anchor.getAttribute("data-ohw-href-key");
|
|
143
|
+
if (!key || getStoredLinkHref(key) === void 0) return;
|
|
144
|
+
const href = anchor.getAttribute("href");
|
|
145
|
+
if (!href) return;
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
e.stopPropagation();
|
|
148
|
+
if (isRouterHref(href)) router.push(href);
|
|
149
|
+
else window.location.assign(href);
|
|
150
|
+
};
|
|
151
|
+
document.addEventListener("click", onClick, true);
|
|
152
|
+
return () => document.removeEventListener("click", onClick, true);
|
|
153
|
+
}, [isEditMode, router]);
|
|
154
|
+
}
|
|
155
|
+
|
|
121
156
|
// src/ui/SchedulingWidget.tsx
|
|
122
|
-
var
|
|
157
|
+
var import_react4 = require("react");
|
|
123
158
|
|
|
124
159
|
// src/ui/EmailCaptureModal.tsx
|
|
125
|
-
var
|
|
160
|
+
var import_react3 = require("react");
|
|
126
161
|
var import_radix_ui = require("radix-ui");
|
|
127
162
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
128
163
|
var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
@@ -152,11 +187,11 @@ function Spinner() {
|
|
|
152
187
|
);
|
|
153
188
|
}
|
|
154
189
|
function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
|
|
155
|
-
const [email, setEmail] = (0,
|
|
156
|
-
const [submittedEmail, setSubmittedEmail] = (0,
|
|
157
|
-
const [loading, setLoading] = (0,
|
|
158
|
-
const [success, setSuccess] = (0,
|
|
159
|
-
const [error, setError] = (0,
|
|
190
|
+
const [email, setEmail] = (0, import_react3.useState)("");
|
|
191
|
+
const [submittedEmail, setSubmittedEmail] = (0, import_react3.useState)("");
|
|
192
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
193
|
+
const [success, setSuccess] = (0, import_react3.useState)(false);
|
|
194
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
160
195
|
const isBook = title === "Confirm your spot";
|
|
161
196
|
const handleSubmit = async () => {
|
|
162
197
|
const trimmed = email.trim();
|
|
@@ -420,21 +455,21 @@ function LoadingSkeleton() {
|
|
|
420
455
|
] });
|
|
421
456
|
}
|
|
422
457
|
function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
|
|
423
|
-
const todayMs = (0,
|
|
458
|
+
const todayMs = (0, import_react4.useMemo)(() => {
|
|
424
459
|
const d = /* @__PURE__ */ new Date();
|
|
425
460
|
d.setHours(0, 0, 0, 0);
|
|
426
461
|
return d.getTime();
|
|
427
462
|
}, []);
|
|
428
|
-
const scrollRef = (0,
|
|
429
|
-
const [canScrollLeft, setCanScrollLeft] = (0,
|
|
430
|
-
const [canScrollRight, setCanScrollRight] = (0,
|
|
463
|
+
const scrollRef = (0, import_react4.useRef)(null);
|
|
464
|
+
const [canScrollLeft, setCanScrollLeft] = (0, import_react4.useState)(false);
|
|
465
|
+
const [canScrollRight, setCanScrollRight] = (0, import_react4.useState)(false);
|
|
431
466
|
const updateScrollState = () => {
|
|
432
467
|
const el = scrollRef.current;
|
|
433
468
|
if (!el) return;
|
|
434
469
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
435
470
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
436
471
|
};
|
|
437
|
-
(0,
|
|
472
|
+
(0, import_react4.useEffect)(() => {
|
|
438
473
|
const el = scrollRef.current;
|
|
439
474
|
if (!el) return;
|
|
440
475
|
updateScrollState();
|
|
@@ -449,9 +484,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
449
484
|
const scroll = (dir) => {
|
|
450
485
|
scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
|
|
451
486
|
};
|
|
452
|
-
const isDragging = (0,
|
|
453
|
-
const dragStartX = (0,
|
|
454
|
-
const dragStartScrollLeft = (0,
|
|
487
|
+
const isDragging = (0, import_react4.useRef)(false);
|
|
488
|
+
const dragStartX = (0, import_react4.useRef)(0);
|
|
489
|
+
const dragStartScrollLeft = (0, import_react4.useRef)(0);
|
|
455
490
|
const onDragStart = (e) => {
|
|
456
491
|
if (!scrollRef.current) return;
|
|
457
492
|
isDragging.current = true;
|
|
@@ -471,14 +506,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
471
506
|
scrollRef.current.style.cursor = "grab";
|
|
472
507
|
scrollRef.current.style.userSelect = "";
|
|
473
508
|
};
|
|
474
|
-
const datesWithClasses = (0,
|
|
509
|
+
const datesWithClasses = (0, import_react4.useMemo)(
|
|
475
510
|
() => new Set(dates.map(
|
|
476
511
|
(d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
|
|
477
512
|
).filter((i) => i >= 0)),
|
|
478
513
|
[dates, schedule]
|
|
479
514
|
);
|
|
480
515
|
const selectedDate = dates[selectedIdx];
|
|
481
|
-
const selectedClasses = (0,
|
|
516
|
+
const selectedClasses = (0, import_react4.useMemo)(
|
|
482
517
|
() => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
|
|
483
518
|
[schedule, selectedDate]
|
|
484
519
|
);
|
|
@@ -663,16 +698,16 @@ function CalendarFoldIcon() {
|
|
|
663
698
|
);
|
|
664
699
|
}
|
|
665
700
|
function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
|
|
666
|
-
const autoId = (0,
|
|
701
|
+
const autoId = (0, import_react4.useId)();
|
|
667
702
|
const insertAfter = insertAfterProp ?? autoId;
|
|
668
|
-
const [schedule, setSchedule] = (0,
|
|
669
|
-
const [loading, setLoading] = (0,
|
|
670
|
-
const [inEditor, setInEditor] = (0,
|
|
671
|
-
const [isHovered, setIsHovered] = (0,
|
|
672
|
-
const [modalState, setModalState] = (0,
|
|
673
|
-
const switchScheduleIdRef = (0,
|
|
674
|
-
const liveScheduleIdRef = (0,
|
|
675
|
-
const refetchLiveSchedule = (0,
|
|
703
|
+
const [schedule, setSchedule] = (0, import_react4.useState)(null);
|
|
704
|
+
const [loading, setLoading] = (0, import_react4.useState)(true);
|
|
705
|
+
const [inEditor, setInEditor] = (0, import_react4.useState)(false);
|
|
706
|
+
const [isHovered, setIsHovered] = (0, import_react4.useState)(false);
|
|
707
|
+
const [modalState, setModalState] = (0, import_react4.useState)(null);
|
|
708
|
+
const switchScheduleIdRef = (0, import_react4.useRef)(null);
|
|
709
|
+
const liveScheduleIdRef = (0, import_react4.useRef)(null);
|
|
710
|
+
const refetchLiveSchedule = (0, import_react4.useCallback)(async () => {
|
|
676
711
|
const id = liveScheduleIdRef.current;
|
|
677
712
|
if (!id) return;
|
|
678
713
|
try {
|
|
@@ -682,7 +717,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
682
717
|
} catch {
|
|
683
718
|
}
|
|
684
719
|
}, []);
|
|
685
|
-
const dates = (0,
|
|
720
|
+
const dates = (0, import_react4.useMemo)(() => {
|
|
686
721
|
const today = /* @__PURE__ */ new Date();
|
|
687
722
|
today.setHours(0, 0, 0, 0);
|
|
688
723
|
return Array.from({ length: 14 }, (_, i) => {
|
|
@@ -691,8 +726,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
691
726
|
return d;
|
|
692
727
|
});
|
|
693
728
|
}, []);
|
|
694
|
-
const [selectedIdx, setSelectedIdx] = (0,
|
|
695
|
-
(0,
|
|
729
|
+
const [selectedIdx, setSelectedIdx] = (0, import_react4.useState)(0);
|
|
730
|
+
(0, import_react4.useEffect)(() => {
|
|
696
731
|
if (!schedule?.classes) return;
|
|
697
732
|
for (let i = 0; i < dates.length; i++) {
|
|
698
733
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -701,7 +736,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
701
736
|
}
|
|
702
737
|
}
|
|
703
738
|
}, [schedule, dates]);
|
|
704
|
-
(0,
|
|
739
|
+
(0, import_react4.useEffect)(() => {
|
|
705
740
|
if (typeof window === "undefined") return;
|
|
706
741
|
const onVisible = () => {
|
|
707
742
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -713,7 +748,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
713
748
|
document.removeEventListener("visibilitychange", onVisible);
|
|
714
749
|
};
|
|
715
750
|
}, [refetchLiveSchedule]);
|
|
716
|
-
(0,
|
|
751
|
+
(0, import_react4.useEffect)(() => {
|
|
717
752
|
if (typeof window === "undefined") return;
|
|
718
753
|
const isInEditor = window.self !== window.top;
|
|
719
754
|
setInEditor(isInEditor);
|
|
@@ -4409,7 +4444,7 @@ var CustomToolbarButton = React4.forwardRef(
|
|
|
4409
4444
|
CustomToolbarButton.displayName = "CustomToolbarButton";
|
|
4410
4445
|
|
|
4411
4446
|
// src/ui/item-action-toolbar.tsx
|
|
4412
|
-
var
|
|
4447
|
+
var import_react5 = require("react");
|
|
4413
4448
|
var import_lucide_react2 = require("lucide-react");
|
|
4414
4449
|
|
|
4415
4450
|
// src/ui/dropdown-menu.tsx
|
|
@@ -4593,7 +4628,7 @@ function ItemActionToolbar({
|
|
|
4593
4628
|
headingVisible = null,
|
|
4594
4629
|
onHeadingVisibleChange
|
|
4595
4630
|
}) {
|
|
4596
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
4631
|
+
const [moreOpen, setMoreOpen] = (0, import_react5.useState)(false);
|
|
4597
4632
|
const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
|
|
4598
4633
|
const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
|
|
4599
4634
|
const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
|
|
@@ -4769,7 +4804,7 @@ function ItemActionToolbar({
|
|
|
4769
4804
|
}
|
|
4770
4805
|
|
|
4771
4806
|
// src/ui/item-interaction-layer.tsx
|
|
4772
|
-
var
|
|
4807
|
+
var import_react6 = require("react");
|
|
4773
4808
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4774
4809
|
var PRIMARY = "var(--ohw-primary, #0885FE)";
|
|
4775
4810
|
var FOCUS_RING = `0 0 0 4px color-mix(in srgb, ${PRIMARY} 12%, transparent)`;
|
|
@@ -4821,8 +4856,8 @@ function ClampedToolbarSlot({
|
|
|
4821
4856
|
placement,
|
|
4822
4857
|
children
|
|
4823
4858
|
}) {
|
|
4824
|
-
const slotRef = (0,
|
|
4825
|
-
(0,
|
|
4859
|
+
const slotRef = (0, import_react6.useRef)(null);
|
|
4860
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
4826
4861
|
const slot = slotRef.current;
|
|
4827
4862
|
if (!slot) return;
|
|
4828
4863
|
const clamp = () => {
|
|
@@ -4875,8 +4910,8 @@ function DetachedBelowToolbarSlot({
|
|
|
4875
4910
|
belowRect,
|
|
4876
4911
|
children
|
|
4877
4912
|
}) {
|
|
4878
|
-
const slotRef = (0,
|
|
4879
|
-
(0,
|
|
4913
|
+
const slotRef = (0, import_react6.useRef)(null);
|
|
4914
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
4880
4915
|
const slot = slotRef.current;
|
|
4881
4916
|
if (!slot) return;
|
|
4882
4917
|
const clamp = () => {
|
|
@@ -5308,7 +5343,43 @@ function CarouselOverlay({
|
|
|
5308
5343
|
|
|
5309
5344
|
// src/OhhwellsBridge.tsx
|
|
5310
5345
|
var import_react_dom3 = require("react-dom");
|
|
5311
|
-
var
|
|
5346
|
+
var import_navigation3 = require("next/navigation");
|
|
5347
|
+
|
|
5348
|
+
// src/lib/cta-button.ts
|
|
5349
|
+
function isCtaButton(el) {
|
|
5350
|
+
return Boolean(
|
|
5351
|
+
el.closest('[data-ohw-role="navbar-button"], [data-ohw-role="button"]')
|
|
5352
|
+
);
|
|
5353
|
+
}
|
|
5354
|
+
var CTA_BUTTON_SELECTOR = '[data-ohw-role="navbar-button"], [data-ohw-role="button"]';
|
|
5355
|
+
|
|
5356
|
+
// src/lib/media-overlay-guards.ts
|
|
5357
|
+
var BRIDGE_CHROME_SELECTOR = [
|
|
5358
|
+
"[data-ohw-toolbar]",
|
|
5359
|
+
"[data-ohw-item-toolbar-anchor]",
|
|
5360
|
+
"[data-ohw-drag-handle-container]",
|
|
5361
|
+
'[data-slot="drag-handle"]',
|
|
5362
|
+
"[data-ohw-more-menu]",
|
|
5363
|
+
'[data-slot="dropdown-menu-content"]'
|
|
5364
|
+
].join(", ");
|
|
5365
|
+
function containsPoint(el, x, y) {
|
|
5366
|
+
const r2 = el.getBoundingClientRect();
|
|
5367
|
+
if (r2.width <= 0 || r2.height <= 0) return false;
|
|
5368
|
+
return x >= r2.left && x <= r2.right && y >= r2.top && y <= r2.bottom;
|
|
5369
|
+
}
|
|
5370
|
+
function isPointOverBridgeChrome(x, y) {
|
|
5371
|
+
for (const el of document.querySelectorAll(BRIDGE_CHROME_SELECTOR)) {
|
|
5372
|
+
if (containsPoint(el, x, y)) return true;
|
|
5373
|
+
}
|
|
5374
|
+
return false;
|
|
5375
|
+
}
|
|
5376
|
+
function findCtaButtonAtPoint(x, y, media) {
|
|
5377
|
+
const hits = Array.from(
|
|
5378
|
+
document.querySelectorAll(CTA_BUTTON_SELECTOR)
|
|
5379
|
+
).filter((el) => containsPoint(el, x, y) && !(media && el.contains(media)));
|
|
5380
|
+
if (hits.length === 0) return null;
|
|
5381
|
+
return hits.reduce((best, el) => best.contains(el) ? el : best);
|
|
5382
|
+
}
|
|
5312
5383
|
|
|
5313
5384
|
// src/lib/session-search.ts
|
|
5314
5385
|
var STORAGE_KEY = "ohw-preserved-search";
|
|
@@ -5586,7 +5657,7 @@ function scrollToHashSectionWhenReady(behavior = "smooth") {
|
|
|
5586
5657
|
}
|
|
5587
5658
|
|
|
5588
5659
|
// src/ui/link-modal/LinkPopover.tsx
|
|
5589
|
-
var
|
|
5660
|
+
var import_react10 = require("react");
|
|
5590
5661
|
|
|
5591
5662
|
// src/ui/dialog.tsx
|
|
5592
5663
|
var React7 = __toESM(require("react"), 1);
|
|
@@ -5786,7 +5857,7 @@ function SectionTreeItem({
|
|
|
5786
5857
|
}
|
|
5787
5858
|
|
|
5788
5859
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
5789
|
-
var
|
|
5860
|
+
var import_react7 = require("react");
|
|
5790
5861
|
|
|
5791
5862
|
// src/ui/input.tsx
|
|
5792
5863
|
var React8 = __toESM(require("react"), 1);
|
|
@@ -5854,11 +5925,11 @@ function UrlOrPageInput({
|
|
|
5854
5925
|
readOnly = false,
|
|
5855
5926
|
urlError
|
|
5856
5927
|
}) {
|
|
5857
|
-
const inputId = (0,
|
|
5858
|
-
const inputRef = (0,
|
|
5859
|
-
const rootRef = (0,
|
|
5860
|
-
const [isFocused, setIsFocused] = (0,
|
|
5861
|
-
(0,
|
|
5928
|
+
const inputId = (0, import_react7.useId)();
|
|
5929
|
+
const inputRef = (0, import_react7.useRef)(null);
|
|
5930
|
+
const rootRef = (0, import_react7.useRef)(null);
|
|
5931
|
+
const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
|
|
5932
|
+
(0, import_react7.useEffect)(() => {
|
|
5862
5933
|
if (!dropdownOpen) return;
|
|
5863
5934
|
const isOutside = (e) => {
|
|
5864
5935
|
const root = rootRef.current;
|
|
@@ -6066,10 +6137,10 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
6066
6137
|
}
|
|
6067
6138
|
|
|
6068
6139
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
6069
|
-
var
|
|
6140
|
+
var import_react8 = require("react");
|
|
6070
6141
|
var import_react_dom = require("react-dom");
|
|
6071
6142
|
var import_lucide_react10 = require("lucide-react");
|
|
6072
|
-
var
|
|
6143
|
+
var import_navigation2 = require("next/navigation");
|
|
6073
6144
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6074
6145
|
var DIM_OVERLAY = "rgba(0, 0, 0, 0.45)";
|
|
6075
6146
|
function rectsEqual(a, b) {
|
|
@@ -6103,12 +6174,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
|
|
|
6103
6174
|
return null;
|
|
6104
6175
|
}
|
|
6105
6176
|
function useSectionRects(sectionIdsKey, enabled) {
|
|
6106
|
-
const [rects, setRects] = (0,
|
|
6107
|
-
const sectionIds = (0,
|
|
6177
|
+
const [rects, setRects] = (0, import_react8.useState)(/* @__PURE__ */ new Map());
|
|
6178
|
+
const sectionIds = (0, import_react8.useMemo)(
|
|
6108
6179
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
6109
6180
|
[sectionIdsKey]
|
|
6110
6181
|
);
|
|
6111
|
-
(0,
|
|
6182
|
+
(0, import_react8.useEffect)(() => {
|
|
6112
6183
|
if (!enabled || sectionIds.length === 0) {
|
|
6113
6184
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
6114
6185
|
return;
|
|
@@ -6147,15 +6218,15 @@ function SectionPickerOverlay({
|
|
|
6147
6218
|
onBack,
|
|
6148
6219
|
onSelect
|
|
6149
6220
|
}) {
|
|
6150
|
-
const router = (0,
|
|
6151
|
-
const pathname = (0,
|
|
6152
|
-
const [selectedId, setSelectedId] = (0,
|
|
6153
|
-
const [hoveredId, setHoveredId] = (0,
|
|
6154
|
-
const pointerRef = (0,
|
|
6155
|
-
const pointerScreenRef = (0,
|
|
6156
|
-
const iframeOffsetTopRef = (0,
|
|
6157
|
-
const sectionIdsRef = (0,
|
|
6158
|
-
const [chromeClip, setChromeClip] = (0,
|
|
6221
|
+
const router = (0, import_navigation2.useRouter)();
|
|
6222
|
+
const pathname = (0, import_navigation2.usePathname)();
|
|
6223
|
+
const [selectedId, setSelectedId] = (0, import_react8.useState)(null);
|
|
6224
|
+
const [hoveredId, setHoveredId] = (0, import_react8.useState)(null);
|
|
6225
|
+
const pointerRef = (0, import_react8.useRef)(null);
|
|
6226
|
+
const pointerScreenRef = (0, import_react8.useRef)(null);
|
|
6227
|
+
const iframeOffsetTopRef = (0, import_react8.useRef)(null);
|
|
6228
|
+
const sectionIdsRef = (0, import_react8.useRef)([]);
|
|
6229
|
+
const [chromeClip, setChromeClip] = (0, import_react8.useState)(
|
|
6159
6230
|
() => ({
|
|
6160
6231
|
top: 0,
|
|
6161
6232
|
bottom: typeof window !== "undefined" ? window.innerHeight : 0
|
|
@@ -6163,12 +6234,12 @@ function SectionPickerOverlay({
|
|
|
6163
6234
|
);
|
|
6164
6235
|
const normalizedTarget = normalizePath(pagePath);
|
|
6165
6236
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
6166
|
-
(0,
|
|
6237
|
+
(0, import_react8.useEffect)(() => {
|
|
6167
6238
|
if (isOnTargetPage) return;
|
|
6168
6239
|
const search = readPreservedSearch();
|
|
6169
6240
|
router.push(`${normalizedTarget}${search}`);
|
|
6170
6241
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
6171
|
-
(0,
|
|
6242
|
+
(0, import_react8.useEffect)(() => {
|
|
6172
6243
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
6173
6244
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
6174
6245
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -6180,24 +6251,24 @@ function SectionPickerOverlay({
|
|
|
6180
6251
|
document.documentElement.removeAttribute("data-ohw-section-picking");
|
|
6181
6252
|
};
|
|
6182
6253
|
}, []);
|
|
6183
|
-
const liveSections = (0,
|
|
6254
|
+
const liveSections = (0, import_react8.useMemo)(() => {
|
|
6184
6255
|
if (!isOnTargetPage) return sections;
|
|
6185
6256
|
const live = collectSectionsFromDom();
|
|
6186
6257
|
if (live.length === 0) return sections;
|
|
6187
6258
|
const labels = new Map(sections.map((s) => [s.id, s.label]));
|
|
6188
6259
|
return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
|
|
6189
6260
|
}, [isOnTargetPage, sections, pathname]);
|
|
6190
|
-
const sectionIdsKey = (0,
|
|
6261
|
+
const sectionIdsKey = (0, import_react8.useMemo)(
|
|
6191
6262
|
() => liveSections.map((s) => s.id).join("\0"),
|
|
6192
6263
|
[liveSections]
|
|
6193
6264
|
);
|
|
6194
|
-
const sectionIds = (0,
|
|
6265
|
+
const sectionIds = (0, import_react8.useMemo)(
|
|
6195
6266
|
() => liveSections.map((s) => s.id),
|
|
6196
6267
|
[liveSections]
|
|
6197
6268
|
);
|
|
6198
6269
|
sectionIdsRef.current = sectionIds;
|
|
6199
6270
|
const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
|
|
6200
|
-
const applyHoverAt = (0,
|
|
6271
|
+
const applyHoverAt = (0, import_react8.useCallback)(
|
|
6201
6272
|
(x, y, liveRects) => {
|
|
6202
6273
|
const ids = sectionIdsRef.current;
|
|
6203
6274
|
const map = liveRects ?? readSectionRects(ids);
|
|
@@ -6206,7 +6277,7 @@ function SectionPickerOverlay({
|
|
|
6206
6277
|
},
|
|
6207
6278
|
[]
|
|
6208
6279
|
);
|
|
6209
|
-
(0,
|
|
6280
|
+
(0, import_react8.useEffect)(() => {
|
|
6210
6281
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH) => {
|
|
6211
6282
|
const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
|
|
6212
6283
|
const bottom = Math.min(
|
|
@@ -6248,12 +6319,12 @@ function SectionPickerOverlay({
|
|
|
6248
6319
|
window.removeEventListener("resize", onResize);
|
|
6249
6320
|
};
|
|
6250
6321
|
}, [applyHoverAt]);
|
|
6251
|
-
(0,
|
|
6322
|
+
(0, import_react8.useEffect)(() => {
|
|
6252
6323
|
const ptr = pointerRef.current;
|
|
6253
6324
|
if (!ptr) return;
|
|
6254
6325
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
6255
6326
|
}, [rects, applyHoverAt]);
|
|
6256
|
-
(0,
|
|
6327
|
+
(0, import_react8.useEffect)(() => {
|
|
6257
6328
|
const rememberPointer = (clientX, clientY) => {
|
|
6258
6329
|
pointerRef.current = { x: clientX, y: clientY };
|
|
6259
6330
|
const top = iframeOffsetTopRef.current;
|
|
@@ -6277,7 +6348,7 @@ function SectionPickerOverlay({
|
|
|
6277
6348
|
window.removeEventListener("message", onPointerSync);
|
|
6278
6349
|
};
|
|
6279
6350
|
}, [rects, applyHoverAt]);
|
|
6280
|
-
const handleSelect = (0,
|
|
6351
|
+
const handleSelect = (0, import_react8.useCallback)(
|
|
6281
6352
|
(section) => {
|
|
6282
6353
|
if (selectedId) return;
|
|
6283
6354
|
setSelectedId(section.id);
|
|
@@ -6285,7 +6356,7 @@ function SectionPickerOverlay({
|
|
|
6285
6356
|
},
|
|
6286
6357
|
[selectedId, onSelect]
|
|
6287
6358
|
);
|
|
6288
|
-
(0,
|
|
6359
|
+
(0, import_react8.useEffect)(() => {
|
|
6289
6360
|
const onKeyDown = (e) => {
|
|
6290
6361
|
if (e.key === "Escape") {
|
|
6291
6362
|
e.preventDefault();
|
|
@@ -6408,7 +6479,7 @@ function SectionPickerOverlay({
|
|
|
6408
6479
|
}
|
|
6409
6480
|
|
|
6410
6481
|
// src/ui/link-modal/useLinkModalState.ts
|
|
6411
|
-
var
|
|
6482
|
+
var import_react9 = require("react");
|
|
6412
6483
|
function useLinkModalState({
|
|
6413
6484
|
open,
|
|
6414
6485
|
mode,
|
|
@@ -6420,14 +6491,14 @@ function useLinkModalState({
|
|
|
6420
6491
|
onClose,
|
|
6421
6492
|
onSubmit
|
|
6422
6493
|
}) {
|
|
6423
|
-
const availablePages = (0,
|
|
6424
|
-
const [searchValue, setSearchValue] = (0,
|
|
6425
|
-
const [selectedPage, setSelectedPage] = (0,
|
|
6426
|
-
const [selectedSection, setSelectedSection] = (0,
|
|
6427
|
-
const [step, setStep] = (0,
|
|
6428
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
6429
|
-
const [urlError, setUrlError] = (0,
|
|
6430
|
-
const reset = (0,
|
|
6494
|
+
const availablePages = (0, import_react9.useMemo)(() => pages, [pages]);
|
|
6495
|
+
const [searchValue, setSearchValue] = (0, import_react9.useState)("");
|
|
6496
|
+
const [selectedPage, setSelectedPage] = (0, import_react9.useState)(null);
|
|
6497
|
+
const [selectedSection, setSelectedSection] = (0, import_react9.useState)(null);
|
|
6498
|
+
const [step, setStep] = (0, import_react9.useState)("input");
|
|
6499
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react9.useState)(false);
|
|
6500
|
+
const [urlError, setUrlError] = (0, import_react9.useState)("");
|
|
6501
|
+
const reset = (0, import_react9.useCallback)(() => {
|
|
6431
6502
|
setSearchValue("");
|
|
6432
6503
|
setSelectedPage(null);
|
|
6433
6504
|
setSelectedSection(null);
|
|
@@ -6435,7 +6506,7 @@ function useLinkModalState({
|
|
|
6435
6506
|
setDropdownOpen(false);
|
|
6436
6507
|
setUrlError("");
|
|
6437
6508
|
}, []);
|
|
6438
|
-
(0,
|
|
6509
|
+
(0, import_react9.useEffect)(() => {
|
|
6439
6510
|
if (!open) return;
|
|
6440
6511
|
if (mode === "edit" && initialTarget) {
|
|
6441
6512
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -6451,11 +6522,11 @@ function useLinkModalState({
|
|
|
6451
6522
|
setDropdownOpen(false);
|
|
6452
6523
|
setUrlError("");
|
|
6453
6524
|
}, [open, mode, initialTarget, reset]);
|
|
6454
|
-
const filteredPages = (0,
|
|
6525
|
+
const filteredPages = (0, import_react9.useMemo)(() => {
|
|
6455
6526
|
if (!searchValue.trim()) return availablePages;
|
|
6456
6527
|
return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
|
|
6457
6528
|
}, [availablePages, searchValue]);
|
|
6458
|
-
const activeSections = (0,
|
|
6529
|
+
const activeSections = (0, import_react9.useMemo)(() => {
|
|
6459
6530
|
if (!selectedPage) return [];
|
|
6460
6531
|
return getSectionsForPath(sectionsByPath, selectedPage.path);
|
|
6461
6532
|
}, [selectedPage, sectionsByPath]);
|
|
@@ -6504,7 +6575,7 @@ function useLinkModalState({
|
|
|
6504
6575
|
reset();
|
|
6505
6576
|
onClose();
|
|
6506
6577
|
};
|
|
6507
|
-
const isValid = (0,
|
|
6578
|
+
const isValid = (0, import_react9.useMemo)(() => {
|
|
6508
6579
|
if (urlError) return false;
|
|
6509
6580
|
if (showBreadcrumb) return true;
|
|
6510
6581
|
if (selectedPage) return true;
|
|
@@ -6601,7 +6672,7 @@ function LinkPopover({
|
|
|
6601
6672
|
onSubmit
|
|
6602
6673
|
});
|
|
6603
6674
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
6604
|
-
(0,
|
|
6675
|
+
(0, import_react10.useEffect)(() => {
|
|
6605
6676
|
if (!open) return;
|
|
6606
6677
|
if (sectionPickerActive) {
|
|
6607
6678
|
postToParent({ type: "ui:unlock" });
|
|
@@ -6929,12 +7000,9 @@ function getLinkHref(el) {
|
|
|
6929
7000
|
}
|
|
6930
7001
|
return el.getAttribute("href") ?? "";
|
|
6931
7002
|
}
|
|
6932
|
-
function isNavbarButton(el) {
|
|
6933
|
-
return el.hasAttribute("data-ohw-role") && el.getAttribute("data-ohw-role") === "navbar-button";
|
|
6934
|
-
}
|
|
6935
7003
|
function isNavbarLinkItem(el) {
|
|
6936
7004
|
if (!el.matches("[data-ohw-href-key]")) return false;
|
|
6937
|
-
if (
|
|
7005
|
+
if (isCtaButton(el)) return false;
|
|
6938
7006
|
if (!el.querySelector('[data-ohw-editable="text"]')) return false;
|
|
6939
7007
|
return Boolean(el.closest("nav, [data-ohw-nav-container], [data-ohw-nav-drawer]"));
|
|
6940
7008
|
}
|
|
@@ -7015,7 +7083,7 @@ function buildNavLink(index, href, label, template) {
|
|
|
7015
7083
|
}
|
|
7016
7084
|
function insertNavLinkInContainer(container, anchor, afterHrefKey) {
|
|
7017
7085
|
if (!afterHrefKey) {
|
|
7018
|
-
const cta = container.querySelector(
|
|
7086
|
+
const cta = container.querySelector(CTA_BUTTON_SELECTOR);
|
|
7019
7087
|
if (cta && cta.parentElement === container) {
|
|
7020
7088
|
container.insertBefore(anchor, cta);
|
|
7021
7089
|
return;
|
|
@@ -8896,7 +8964,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
|
|
|
8896
8964
|
}
|
|
8897
8965
|
|
|
8898
8966
|
// src/useNavItemDrag.ts
|
|
8899
|
-
var
|
|
8967
|
+
var import_react11 = require("react");
|
|
8900
8968
|
function useNavItemDrag({
|
|
8901
8969
|
isEditMode,
|
|
8902
8970
|
editContentRef,
|
|
@@ -8918,14 +8986,13 @@ function useNavItemDrag({
|
|
|
8918
8986
|
setSiblingHintRects,
|
|
8919
8987
|
setToolbarRect,
|
|
8920
8988
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
8921
|
-
isDragHandleDisabled: isDragHandleDisabled2
|
|
8922
|
-
isNavbarButton: isNavbarButton3
|
|
8989
|
+
isDragHandleDisabled: isDragHandleDisabled2
|
|
8923
8990
|
}) {
|
|
8924
|
-
const navDragRef = (0,
|
|
8925
|
-
const [navDropSlots, setNavDropSlots] = (0,
|
|
8926
|
-
const [activeNavDropIndex, setActiveNavDropIndex] = (0,
|
|
8927
|
-
const navPointerDragRef = (0,
|
|
8928
|
-
const clearNavDragVisuals = (0,
|
|
8991
|
+
const navDragRef = (0, import_react11.useRef)(null);
|
|
8992
|
+
const [navDropSlots, setNavDropSlots] = (0, import_react11.useState)([]);
|
|
8993
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react11.useState)(null);
|
|
8994
|
+
const navPointerDragRef = (0, import_react11.useRef)(null);
|
|
8995
|
+
const clearNavDragVisuals = (0, import_react11.useCallback)(() => {
|
|
8929
8996
|
const session = navDragRef.current;
|
|
8930
8997
|
const keepOpenEl = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.draggedEl : null;
|
|
8931
8998
|
navDragRef.current = null;
|
|
@@ -8942,7 +9009,7 @@ function useNavItemDrag({
|
|
|
8942
9009
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
8943
9010
|
unlockItemDragInteraction();
|
|
8944
9011
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
8945
|
-
const refreshNavDragVisuals = (0,
|
|
9012
|
+
const refreshNavDragVisuals = (0, import_react11.useCallback)(
|
|
8946
9013
|
(session, activeSlot, clientX, clientY) => {
|
|
8947
9014
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
8948
9015
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -8960,13 +9027,13 @@ function useNavItemDrag({
|
|
|
8960
9027
|
},
|
|
8961
9028
|
[setDraggedItemRect, setSiblingHintRects]
|
|
8962
9029
|
);
|
|
8963
|
-
const refreshNavDragVisualsRef = (0,
|
|
9030
|
+
const refreshNavDragVisualsRef = (0, import_react11.useRef)(refreshNavDragVisuals);
|
|
8964
9031
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
8965
|
-
const commitNavDragRef = (0,
|
|
9032
|
+
const commitNavDragRef = (0, import_react11.useRef)(() => {
|
|
8966
9033
|
});
|
|
8967
|
-
const beginNavDragRef = (0,
|
|
9034
|
+
const beginNavDragRef = (0, import_react11.useRef)(() => {
|
|
8968
9035
|
});
|
|
8969
|
-
const beginNavDrag = (0,
|
|
9036
|
+
const beginNavDrag = (0, import_react11.useCallback)(
|
|
8970
9037
|
(session) => {
|
|
8971
9038
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
8972
9039
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -9000,7 +9067,7 @@ function useNavItemDrag({
|
|
|
9000
9067
|
]
|
|
9001
9068
|
);
|
|
9002
9069
|
beginNavDragRef.current = beginNavDrag;
|
|
9003
|
-
const commitNavDrag = (0,
|
|
9070
|
+
const commitNavDrag = (0, import_react11.useCallback)(
|
|
9004
9071
|
(clientX, clientY) => {
|
|
9005
9072
|
const session = navDragRef.current;
|
|
9006
9073
|
if (!session) {
|
|
@@ -9061,12 +9128,12 @@ function useNavItemDrag({
|
|
|
9061
9128
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
9062
9129
|
);
|
|
9063
9130
|
commitNavDragRef.current = commitNavDrag;
|
|
9064
|
-
const startNavLinkDrag = (0,
|
|
9131
|
+
const startNavLinkDrag = (0, import_react11.useCallback)(
|
|
9065
9132
|
(anchor, clientX, clientY, wasSelected) => {
|
|
9066
9133
|
if (footerDragRef.current) return false;
|
|
9067
9134
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
9068
9135
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
9069
|
-
if (
|
|
9136
|
+
if (isCtaButton(anchor) || isDragHandleDisabled2(anchor)) return false;
|
|
9070
9137
|
beginNavDrag({
|
|
9071
9138
|
hrefKey,
|
|
9072
9139
|
wasSelected,
|
|
@@ -9077,9 +9144,9 @@ function useNavItemDrag({
|
|
|
9077
9144
|
});
|
|
9078
9145
|
return true;
|
|
9079
9146
|
},
|
|
9080
|
-
[beginNavDrag, footerDragRef, isDragHandleDisabled2,
|
|
9147
|
+
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
9081
9148
|
);
|
|
9082
|
-
const onNavDragOver = (0,
|
|
9149
|
+
const onNavDragOver = (0, import_react11.useCallback)(
|
|
9083
9150
|
(e) => {
|
|
9084
9151
|
const session = navDragRef.current;
|
|
9085
9152
|
if (!session) return false;
|
|
@@ -9091,7 +9158,7 @@ function useNavItemDrag({
|
|
|
9091
9158
|
},
|
|
9092
9159
|
[]
|
|
9093
9160
|
);
|
|
9094
|
-
(0,
|
|
9161
|
+
(0, import_react11.useEffect)(() => {
|
|
9095
9162
|
if (!isEditMode) return;
|
|
9096
9163
|
const THRESHOLD = 10;
|
|
9097
9164
|
const resolveWasSelected = (el) => {
|
|
@@ -9113,7 +9180,7 @@ function useNavItemDrag({
|
|
|
9113
9180
|
const anchor = getNavigationItemAnchor2(target);
|
|
9114
9181
|
const hrefKey = anchor?.getAttribute("data-ohw-href-key") ?? null;
|
|
9115
9182
|
if (!anchor || !isNavbarHrefKey(hrefKey)) return;
|
|
9116
|
-
if (
|
|
9183
|
+
if (isCtaButton(anchor) || isDragHandleDisabled2(anchor)) return;
|
|
9117
9184
|
navPointerDragRef.current = {
|
|
9118
9185
|
el: anchor,
|
|
9119
9186
|
startX: e.clientX,
|
|
@@ -9210,17 +9277,17 @@ function useNavItemDrag({
|
|
|
9210
9277
|
getNavigationItemAnchor2,
|
|
9211
9278
|
isDragHandleDisabled2,
|
|
9212
9279
|
isEditMode,
|
|
9213
|
-
|
|
9280
|
+
isCtaButton,
|
|
9214
9281
|
linkPopoverOpenRef,
|
|
9215
9282
|
selectedElRef,
|
|
9216
9283
|
setLinkPopover,
|
|
9217
9284
|
suppressNextClickRef
|
|
9218
9285
|
]);
|
|
9219
|
-
const armNavPressFromChrome = (0,
|
|
9286
|
+
const armNavPressFromChrome = (0, import_react11.useCallback)(
|
|
9220
9287
|
(selected, clientX, clientY, pointerId) => {
|
|
9221
9288
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
9222
9289
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
9223
|
-
if (
|
|
9290
|
+
if (isCtaButton(selected) || isDragHandleDisabled2(selected)) return false;
|
|
9224
9291
|
navPointerDragRef.current = {
|
|
9225
9292
|
el: selected,
|
|
9226
9293
|
startX: clientX,
|
|
@@ -9231,7 +9298,7 @@ function useNavItemDrag({
|
|
|
9231
9298
|
};
|
|
9232
9299
|
return true;
|
|
9233
9300
|
},
|
|
9234
|
-
[isDragHandleDisabled2,
|
|
9301
|
+
[isDragHandleDisabled2, isCtaButton]
|
|
9235
9302
|
);
|
|
9236
9303
|
return {
|
|
9237
9304
|
navDragRef,
|
|
@@ -9298,7 +9365,7 @@ function FooterContainerChrome({
|
|
|
9298
9365
|
}
|
|
9299
9366
|
|
|
9300
9367
|
// src/lib/carousel.ts
|
|
9301
|
-
var
|
|
9368
|
+
var import_react12 = require("react");
|
|
9302
9369
|
var CAROUSEL_ATTR = "data-ohw-carousel";
|
|
9303
9370
|
var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
|
|
9304
9371
|
var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
|
|
@@ -9360,8 +9427,8 @@ function applyCarouselNode(key, val) {
|
|
|
9360
9427
|
return true;
|
|
9361
9428
|
}
|
|
9362
9429
|
function useOhwCarousel(key, initial) {
|
|
9363
|
-
const [images, setImages] = (0,
|
|
9364
|
-
(0,
|
|
9430
|
+
const [images, setImages] = (0, import_react12.useState)(initial);
|
|
9431
|
+
(0, import_react12.useEffect)(() => {
|
|
9365
9432
|
const el = document.querySelector(
|
|
9366
9433
|
`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
|
|
9367
9434
|
);
|
|
@@ -9426,6 +9493,9 @@ function collectEditableNodes(extraContent) {
|
|
|
9426
9493
|
if (!key) return;
|
|
9427
9494
|
nodes.push({ key, type: "link", text: getLinkHref3(el) });
|
|
9428
9495
|
});
|
|
9496
|
+
for (const [key, href] of listStoredLinkHrefs()) {
|
|
9497
|
+
nodes.push({ key, type: "link", text: href });
|
|
9498
|
+
}
|
|
9429
9499
|
if (extraContent) {
|
|
9430
9500
|
for (const key of [NAV_ORDER_KEY, FOOTER_ORDER_KEY, NAV_COUNT_KEY]) {
|
|
9431
9501
|
const text = extraContent[key];
|
|
@@ -10154,9 +10224,6 @@ function getHrefKeyFromElement(el) {
|
|
|
10154
10224
|
if (!key) return null;
|
|
10155
10225
|
return { anchor, key };
|
|
10156
10226
|
}
|
|
10157
|
-
function isNavbarButton2(el) {
|
|
10158
|
-
return Boolean(el.closest('[data-ohw-role="navbar-button"]'));
|
|
10159
|
-
}
|
|
10160
10227
|
function isNavDropdownPanelOpen(childrenRoot) {
|
|
10161
10228
|
if (childrenRoot.closest("[data-ohw-nav-drawer]")) return true;
|
|
10162
10229
|
const group = childrenRoot.closest("[data-ohw-nav-group]");
|
|
@@ -10209,7 +10276,7 @@ function listNavigationItems() {
|
|
|
10209
10276
|
).filter((el) => isNavigationItem2(el));
|
|
10210
10277
|
}
|
|
10211
10278
|
function getNavigationItemReorderState(anchor) {
|
|
10212
|
-
if (
|
|
10279
|
+
if (isCtaButton(anchor)) return { key: null, disabled: false };
|
|
10213
10280
|
return getReorderHandleStateFromAnchor(anchor);
|
|
10214
10281
|
}
|
|
10215
10282
|
function getReorderHandleState(el) {
|
|
@@ -10311,7 +10378,7 @@ function findHoveredNavOrFooterContainer(x, y) {
|
|
|
10311
10378
|
}
|
|
10312
10379
|
function isPointOverNavItem(container, x, y) {
|
|
10313
10380
|
return Array.from(container.querySelectorAll("[data-ohw-href-key]")).some((el) => {
|
|
10314
|
-
if (!isNavigationItem2(el) ||
|
|
10381
|
+
if (!isNavigationItem2(el) || isCtaButton(el)) return false;
|
|
10315
10382
|
if (!isNavItemPointerTarget(el)) return false;
|
|
10316
10383
|
const itemRect = el.getBoundingClientRect();
|
|
10317
10384
|
return x >= itemRect.left && x <= itemRect.right && y >= itemRect.top && y <= itemRect.bottom;
|
|
@@ -10325,7 +10392,7 @@ function isPointOverFooterColumn(x, y) {
|
|
|
10325
10392
|
}
|
|
10326
10393
|
function resolveNavContainerSelectionTarget(target, clientX, clientY) {
|
|
10327
10394
|
if (getNavigationItemAnchor(target)) return null;
|
|
10328
|
-
if (target.closest(
|
|
10395
|
+
if (target.closest(CTA_BUTTON_SELECTOR)) return null;
|
|
10329
10396
|
const plainLink = target.closest("a");
|
|
10330
10397
|
if (plainLink && !plainLink.hasAttribute("data-ohw-href-key") && !plainLink.closest("[data-ohw-nav-container]")) {
|
|
10331
10398
|
return null;
|
|
@@ -10824,9 +10891,9 @@ function FloatingToolbar({
|
|
|
10824
10891
|
showEditLink,
|
|
10825
10892
|
onEditLink
|
|
10826
10893
|
}) {
|
|
10827
|
-
const localRef =
|
|
10828
|
-
const [measuredW, setMeasuredW] =
|
|
10829
|
-
const setRefs =
|
|
10894
|
+
const localRef = import_react13.default.useRef(null);
|
|
10895
|
+
const [measuredW, setMeasuredW] = import_react13.default.useState(330);
|
|
10896
|
+
const setRefs = import_react13.default.useCallback(
|
|
10830
10897
|
(node) => {
|
|
10831
10898
|
localRef.current = node;
|
|
10832
10899
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -10838,7 +10905,7 @@ function FloatingToolbar({
|
|
|
10838
10905
|
},
|
|
10839
10906
|
[elRef]
|
|
10840
10907
|
);
|
|
10841
|
-
|
|
10908
|
+
import_react13.default.useLayoutEffect(() => {
|
|
10842
10909
|
const node = localRef.current;
|
|
10843
10910
|
if (!node) return;
|
|
10844
10911
|
const update = () => {
|
|
@@ -10864,7 +10931,7 @@ function FloatingToolbar({
|
|
|
10864
10931
|
pointerEvents: "auto"
|
|
10865
10932
|
},
|
|
10866
10933
|
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CustomToolbar, { children: [
|
|
10867
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10934
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react13.default.Fragment, { children: [
|
|
10868
10935
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CustomToolbarDivider, {}),
|
|
10869
10936
|
btns.map((btn) => {
|
|
10870
10937
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -10966,12 +11033,12 @@ function resolveSubdomain(subdomainFromQuery) {
|
|
|
10966
11033
|
return "";
|
|
10967
11034
|
}
|
|
10968
11035
|
function OhhwellsBridge() {
|
|
10969
|
-
const pathname = (0,
|
|
10970
|
-
const router = (0,
|
|
10971
|
-
const searchParams = (0,
|
|
11036
|
+
const pathname = (0, import_navigation3.usePathname)();
|
|
11037
|
+
const router = (0, import_navigation3.useRouter)();
|
|
11038
|
+
const searchParams = (0, import_navigation3.useSearchParams)();
|
|
10972
11039
|
const isEditMode = isEditSessionActive();
|
|
10973
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
10974
|
-
(0,
|
|
11040
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react13.useState)(null);
|
|
11041
|
+
(0, import_react13.useEffect)(() => {
|
|
10975
11042
|
const figtreeFontId = "ohw-figtree-font";
|
|
10976
11043
|
if (!document.getElementById(figtreeFontId)) {
|
|
10977
11044
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -10999,106 +11066,107 @@ function OhhwellsBridge() {
|
|
|
10999
11066
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
11000
11067
|
const subdomain = resolveSubdomain(subdomainFromQuery);
|
|
11001
11068
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
11002
|
-
|
|
11069
|
+
useSavedLinkNavigation(isEditMode);
|
|
11070
|
+
const postToParent2 = (0, import_react13.useCallback)((data) => {
|
|
11003
11071
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
11004
11072
|
window.parent.postMessage(data, "*");
|
|
11005
11073
|
}
|
|
11006
11074
|
}, []);
|
|
11007
|
-
const [fetchState, setFetchState] = (0,
|
|
11008
|
-
const autoSaveTimers = (0,
|
|
11009
|
-
const activeElRef = (0,
|
|
11010
|
-
const pointerHeldRef = (0,
|
|
11011
|
-
const selectedElRef = (0,
|
|
11012
|
-
const selectedHrefKeyRef = (0,
|
|
11013
|
-
const selectedFooterColAttrRef = (0,
|
|
11014
|
-
const originalContentRef = (0,
|
|
11015
|
-
const activeStateElRef = (0,
|
|
11016
|
-
const parentScrollRef = (0,
|
|
11017
|
-
const visibleViewportRef = (0,
|
|
11018
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
11019
|
-
const attachVisibleViewport = (0,
|
|
11075
|
+
const [fetchState, setFetchState] = (0, import_react13.useState)("idle");
|
|
11076
|
+
const autoSaveTimers = (0, import_react13.useRef)(/* @__PURE__ */ new Map());
|
|
11077
|
+
const activeElRef = (0, import_react13.useRef)(null);
|
|
11078
|
+
const pointerHeldRef = (0, import_react13.useRef)(false);
|
|
11079
|
+
const selectedElRef = (0, import_react13.useRef)(null);
|
|
11080
|
+
const selectedHrefKeyRef = (0, import_react13.useRef)(null);
|
|
11081
|
+
const selectedFooterColAttrRef = (0, import_react13.useRef)(null);
|
|
11082
|
+
const originalContentRef = (0, import_react13.useRef)(null);
|
|
11083
|
+
const activeStateElRef = (0, import_react13.useRef)(null);
|
|
11084
|
+
const parentScrollRef = (0, import_react13.useRef)(null);
|
|
11085
|
+
const visibleViewportRef = (0, import_react13.useRef)(null);
|
|
11086
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react13.useState)(null);
|
|
11087
|
+
const attachVisibleViewport = (0, import_react13.useCallback)((node) => {
|
|
11020
11088
|
visibleViewportRef.current = node;
|
|
11021
11089
|
setDialogPortalContainer(node);
|
|
11022
11090
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
11023
11091
|
}, []);
|
|
11024
|
-
const toolbarElRef = (0,
|
|
11025
|
-
const glowElRef = (0,
|
|
11026
|
-
const hoveredImageRef = (0,
|
|
11027
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
11028
|
-
const dragOverElRef = (0,
|
|
11029
|
-
const [mediaHover, setMediaHover] = (0,
|
|
11030
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
11031
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
11032
|
-
const hoveredGapRef = (0,
|
|
11033
|
-
const imageUnhoverTimerRef = (0,
|
|
11034
|
-
const imageShowTimerRef = (0,
|
|
11035
|
-
const editStylesRef = (0,
|
|
11036
|
-
const activateRef = (0,
|
|
11092
|
+
const toolbarElRef = (0, import_react13.useRef)(null);
|
|
11093
|
+
const glowElRef = (0, import_react13.useRef)(null);
|
|
11094
|
+
const hoveredImageRef = (0, import_react13.useRef)(null);
|
|
11095
|
+
const hoveredImageHasTextOverlapRef = (0, import_react13.useRef)(false);
|
|
11096
|
+
const dragOverElRef = (0, import_react13.useRef)(null);
|
|
11097
|
+
const [mediaHover, setMediaHover] = (0, import_react13.useState)(null);
|
|
11098
|
+
const [carouselHover, setCarouselHover] = (0, import_react13.useState)(null);
|
|
11099
|
+
const [uploadingRects, setUploadingRects] = (0, import_react13.useState)({});
|
|
11100
|
+
const hoveredGapRef = (0, import_react13.useRef)(null);
|
|
11101
|
+
const imageUnhoverTimerRef = (0, import_react13.useRef)(null);
|
|
11102
|
+
const imageShowTimerRef = (0, import_react13.useRef)(null);
|
|
11103
|
+
const editStylesRef = (0, import_react13.useRef)(null);
|
|
11104
|
+
const activateRef = (0, import_react13.useRef)(() => {
|
|
11037
11105
|
});
|
|
11038
|
-
const deactivateRef = (0,
|
|
11106
|
+
const deactivateRef = (0, import_react13.useRef)(() => {
|
|
11039
11107
|
});
|
|
11040
|
-
const selectRef = (0,
|
|
11108
|
+
const selectRef = (0, import_react13.useRef)(() => {
|
|
11041
11109
|
});
|
|
11042
|
-
const selectFrameRef = (0,
|
|
11110
|
+
const selectFrameRef = (0, import_react13.useRef)(() => {
|
|
11043
11111
|
});
|
|
11044
|
-
const deselectRef = (0,
|
|
11112
|
+
const deselectRef = (0, import_react13.useRef)(() => {
|
|
11045
11113
|
});
|
|
11046
|
-
const reselectNavigationItemRef = (0,
|
|
11114
|
+
const reselectNavigationItemRef = (0, import_react13.useRef)(() => {
|
|
11047
11115
|
});
|
|
11048
|
-
const commitNavigationTextEditRef = (0,
|
|
11116
|
+
const commitNavigationTextEditRef = (0, import_react13.useRef)(() => {
|
|
11049
11117
|
});
|
|
11050
|
-
const handleDeleteSelectedRef = (0,
|
|
11051
|
-
const runPendingDeleteUndoRef = (0,
|
|
11052
|
-
const isFooterFrameSelectionRef = (0,
|
|
11053
|
-
const refreshActiveCommandsRef = (0,
|
|
11118
|
+
const handleDeleteSelectedRef = (0, import_react13.useRef)(() => false);
|
|
11119
|
+
const runPendingDeleteUndoRef = (0, import_react13.useRef)(() => false);
|
|
11120
|
+
const isFooterFrameSelectionRef = (0, import_react13.useRef)(false);
|
|
11121
|
+
const refreshActiveCommandsRef = (0, import_react13.useRef)(() => {
|
|
11054
11122
|
});
|
|
11055
|
-
const postToParentRef = (0,
|
|
11123
|
+
const postToParentRef = (0, import_react13.useRef)(postToParent2);
|
|
11056
11124
|
postToParentRef.current = postToParent2;
|
|
11057
|
-
const sectionsLoadedRef = (0,
|
|
11058
|
-
const pendingScheduleConfigRequests = (0,
|
|
11059
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
11060
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
11061
|
-
const toolbarVariantRef = (0,
|
|
11125
|
+
const sectionsLoadedRef = (0, import_react13.useRef)(false);
|
|
11126
|
+
const pendingScheduleConfigRequests = (0, import_react13.useRef)([]);
|
|
11127
|
+
const [toolbarRect, setToolbarRect] = (0, import_react13.useState)(null);
|
|
11128
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react13.useState)("none");
|
|
11129
|
+
const toolbarVariantRef = (0, import_react13.useRef)("none");
|
|
11062
11130
|
toolbarVariantRef.current = toolbarVariant;
|
|
11063
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
11064
|
-
const [reorderHrefKey, setReorderHrefKey] = (0,
|
|
11065
|
-
const [reorderDragDisabled, setReorderDragDisabled] = (0,
|
|
11066
|
-
const [toggleState, setToggleState] = (0,
|
|
11067
|
-
const [maxBadge, setMaxBadge] = (0,
|
|
11068
|
-
const [activeCommands, setActiveCommands] = (0,
|
|
11069
|
-
const [sectionGap, setSectionGap] = (0,
|
|
11070
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] = (0,
|
|
11071
|
-
const hoveredNavContainerRef = (0,
|
|
11072
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0,
|
|
11073
|
-
const hoveredItemElRef = (0,
|
|
11074
|
-
const [hoveredItemRect, setHoveredItemRect] = (0,
|
|
11075
|
-
const siblingHintElRef = (0,
|
|
11076
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
11077
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
11078
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
11079
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
11131
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react13.useState)(false);
|
|
11132
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react13.useState)(null);
|
|
11133
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react13.useState)(false);
|
|
11134
|
+
const [toggleState, setToggleState] = (0, import_react13.useState)(null);
|
|
11135
|
+
const [maxBadge, setMaxBadge] = (0, import_react13.useState)(null);
|
|
11136
|
+
const [activeCommands, setActiveCommands] = (0, import_react13.useState)(/* @__PURE__ */ new Set());
|
|
11137
|
+
const [sectionGap, setSectionGap] = (0, import_react13.useState)(null);
|
|
11138
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react13.useState)(false);
|
|
11139
|
+
const hoveredNavContainerRef = (0, import_react13.useRef)(null);
|
|
11140
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react13.useState)(null);
|
|
11141
|
+
const hoveredItemElRef = (0, import_react13.useRef)(null);
|
|
11142
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react13.useState)(null);
|
|
11143
|
+
const siblingHintElRef = (0, import_react13.useRef)(null);
|
|
11144
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react13.useState)(null);
|
|
11145
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react13.useState)([]);
|
|
11146
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react13.useState)(false);
|
|
11147
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react13.useState)(false);
|
|
11080
11148
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
11081
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0,
|
|
11082
|
-
const [footerHeadingVisible, setFooterHeadingVisible] = (0,
|
|
11083
|
-
const footerDragRef = (0,
|
|
11084
|
-
const [footerDropSlots, setFooterDropSlots] = (0,
|
|
11085
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0,
|
|
11086
|
-
const [draggedItemRect, setDraggedItemRect] = (0,
|
|
11087
|
-
const footerPointerDragRef = (0,
|
|
11088
|
-
const suppressNextClickRef = (0,
|
|
11089
|
-
const suppressClickUntilRef = (0,
|
|
11090
|
-
const [linkPopover, setLinkPopover] = (0,
|
|
11091
|
-
const linkPopoverSessionRef = (0,
|
|
11092
|
-
const addNavAfterAnchorRef = (0,
|
|
11093
|
-
const editContentRef = (0,
|
|
11094
|
-
const pendingDeleteUndoRef = (0,
|
|
11095
|
-
const [sitePages, setSitePages] = (0,
|
|
11096
|
-
const [sectionsByPath, setSectionsByPath] = (0,
|
|
11097
|
-
const sectionsPrefetchGenRef = (0,
|
|
11098
|
-
const setLinkPopoverRef = (0,
|
|
11099
|
-
const linkPopoverPanelRef = (0,
|
|
11100
|
-
const linkPopoverOpenRef = (0,
|
|
11101
|
-
const linkPopoverGraceUntilRef = (0,
|
|
11149
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react13.useState)(null);
|
|
11150
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react13.useState)(null);
|
|
11151
|
+
const footerDragRef = (0, import_react13.useRef)(null);
|
|
11152
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react13.useState)([]);
|
|
11153
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react13.useState)(null);
|
|
11154
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react13.useState)(null);
|
|
11155
|
+
const footerPointerDragRef = (0, import_react13.useRef)(null);
|
|
11156
|
+
const suppressNextClickRef = (0, import_react13.useRef)(false);
|
|
11157
|
+
const suppressClickUntilRef = (0, import_react13.useRef)(0);
|
|
11158
|
+
const [linkPopover, setLinkPopover] = (0, import_react13.useState)(null);
|
|
11159
|
+
const linkPopoverSessionRef = (0, import_react13.useRef)(null);
|
|
11160
|
+
const addNavAfterAnchorRef = (0, import_react13.useRef)(null);
|
|
11161
|
+
const editContentRef = (0, import_react13.useRef)({});
|
|
11162
|
+
const pendingDeleteUndoRef = (0, import_react13.useRef)(null);
|
|
11163
|
+
const [sitePages, setSitePages] = (0, import_react13.useState)([]);
|
|
11164
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react13.useState)({});
|
|
11165
|
+
const sectionsPrefetchGenRef = (0, import_react13.useRef)(0);
|
|
11166
|
+
const setLinkPopoverRef = (0, import_react13.useRef)(setLinkPopover);
|
|
11167
|
+
const linkPopoverPanelRef = (0, import_react13.useRef)(null);
|
|
11168
|
+
const linkPopoverOpenRef = (0, import_react13.useRef)(false);
|
|
11169
|
+
const linkPopoverGraceUntilRef = (0, import_react13.useRef)(0);
|
|
11102
11170
|
setLinkPopoverRef.current = setLinkPopover;
|
|
11103
11171
|
linkPopoverSessionRef.current = linkPopover;
|
|
11104
11172
|
const {
|
|
@@ -11131,13 +11199,12 @@ function OhhwellsBridge() {
|
|
|
11131
11199
|
setSiblingHintRects,
|
|
11132
11200
|
setToolbarRect,
|
|
11133
11201
|
getNavigationItemAnchor,
|
|
11134
|
-
isDragHandleDisabled
|
|
11135
|
-
isNavbarButton: isNavbarButton2
|
|
11202
|
+
isDragHandleDisabled
|
|
11136
11203
|
});
|
|
11137
11204
|
const bumpLinkPopoverGrace = () => {
|
|
11138
11205
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
11139
11206
|
};
|
|
11140
|
-
const runSectionsPrefetch = (0,
|
|
11207
|
+
const runSectionsPrefetch = (0, import_react13.useCallback)((pages) => {
|
|
11141
11208
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
11142
11209
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
11143
11210
|
const paths = pages.map((p) => p.path);
|
|
@@ -11156,9 +11223,9 @@ function OhhwellsBridge() {
|
|
|
11156
11223
|
);
|
|
11157
11224
|
});
|
|
11158
11225
|
}, [isEditMode, pathname]);
|
|
11159
|
-
const runSectionsPrefetchRef = (0,
|
|
11226
|
+
const runSectionsPrefetchRef = (0, import_react13.useRef)(runSectionsPrefetch);
|
|
11160
11227
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
11161
|
-
(0,
|
|
11228
|
+
(0, import_react13.useEffect)(() => {
|
|
11162
11229
|
if (!linkPopover) {
|
|
11163
11230
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
11164
11231
|
return;
|
|
@@ -11186,7 +11253,7 @@ function OhhwellsBridge() {
|
|
|
11186
11253
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
11187
11254
|
};
|
|
11188
11255
|
}, [linkPopover, postToParent2]);
|
|
11189
|
-
(0,
|
|
11256
|
+
(0, import_react13.useEffect)(() => {
|
|
11190
11257
|
if (!isEditMode) return;
|
|
11191
11258
|
const useFixtures = shouldUseDevFixtures();
|
|
11192
11259
|
if (useFixtures) {
|
|
@@ -11210,14 +11277,14 @@ function OhhwellsBridge() {
|
|
|
11210
11277
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
11211
11278
|
return () => window.removeEventListener("message", onSitePages);
|
|
11212
11279
|
}, [isEditMode, postToParent2]);
|
|
11213
|
-
(0,
|
|
11280
|
+
(0, import_react13.useEffect)(() => {
|
|
11214
11281
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
11215
11282
|
void loadAllSectionsManifest().then((manifest) => {
|
|
11216
11283
|
if (Object.keys(manifest).length === 0) return;
|
|
11217
11284
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
11218
11285
|
});
|
|
11219
11286
|
}, [isEditMode]);
|
|
11220
|
-
(0,
|
|
11287
|
+
(0, import_react13.useEffect)(() => {
|
|
11221
11288
|
const update = () => {
|
|
11222
11289
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
11223
11290
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -11241,10 +11308,10 @@ function OhhwellsBridge() {
|
|
|
11241
11308
|
vvp.removeEventListener("resize", update);
|
|
11242
11309
|
};
|
|
11243
11310
|
}, []);
|
|
11244
|
-
const refreshStateRules = (0,
|
|
11311
|
+
const refreshStateRules = (0, import_react13.useCallback)(() => {
|
|
11245
11312
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
11246
11313
|
}, []);
|
|
11247
|
-
const processConfigRequest = (0,
|
|
11314
|
+
const processConfigRequest = (0, import_react13.useCallback)((insertAfterVal) => {
|
|
11248
11315
|
const tracker = getSectionsTracker();
|
|
11249
11316
|
let entries = [];
|
|
11250
11317
|
try {
|
|
@@ -11267,7 +11334,7 @@ function OhhwellsBridge() {
|
|
|
11267
11334
|
}
|
|
11268
11335
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
11269
11336
|
}, [isEditMode]);
|
|
11270
|
-
const deactivate = (0,
|
|
11337
|
+
const deactivate = (0, import_react13.useCallback)(() => {
|
|
11271
11338
|
const el = activeElRef.current;
|
|
11272
11339
|
if (!el) return;
|
|
11273
11340
|
const key = el.dataset.ohwKey;
|
|
@@ -11300,12 +11367,12 @@ function OhhwellsBridge() {
|
|
|
11300
11367
|
setToolbarShowEditLink(false);
|
|
11301
11368
|
postToParent2({ type: "ow:exit-edit" });
|
|
11302
11369
|
}, [postToParent2]);
|
|
11303
|
-
const clearSelectedAttr = (0,
|
|
11370
|
+
const clearSelectedAttr = (0, import_react13.useCallback)(() => {
|
|
11304
11371
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
11305
11372
|
el.removeAttribute("data-ohw-selected");
|
|
11306
11373
|
});
|
|
11307
11374
|
}, []);
|
|
11308
|
-
const deselect = (0,
|
|
11375
|
+
const deselect = (0, import_react13.useCallback)(() => {
|
|
11309
11376
|
clearSelectedAttr();
|
|
11310
11377
|
selectedElRef.current = null;
|
|
11311
11378
|
selectedHrefKeyRef.current = null;
|
|
@@ -11328,11 +11395,11 @@ function OhhwellsBridge() {
|
|
|
11328
11395
|
setToolbarVariant("none");
|
|
11329
11396
|
}
|
|
11330
11397
|
}, [clearSelectedAttr]);
|
|
11331
|
-
const markSelected = (0,
|
|
11398
|
+
const markSelected = (0, import_react13.useCallback)((el) => {
|
|
11332
11399
|
clearSelectedAttr();
|
|
11333
11400
|
el.setAttribute("data-ohw-selected", "");
|
|
11334
11401
|
}, [clearSelectedAttr]);
|
|
11335
|
-
const resolveHrefKeyElement = (0,
|
|
11402
|
+
const resolveHrefKeyElement = (0, import_react13.useCallback)((hrefKey) => {
|
|
11336
11403
|
if (isFooterHrefKey(hrefKey)) {
|
|
11337
11404
|
return document.querySelector(
|
|
11338
11405
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -11347,7 +11414,7 @@ function OhhwellsBridge() {
|
|
|
11347
11414
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
11348
11415
|
);
|
|
11349
11416
|
}, []);
|
|
11350
|
-
const resyncSelectedNavigationItem = (0,
|
|
11417
|
+
const resyncSelectedNavigationItem = (0, import_react13.useCallback)(() => {
|
|
11351
11418
|
const hrefKey = selectedHrefKeyRef.current;
|
|
11352
11419
|
if (hrefKey) {
|
|
11353
11420
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -11385,12 +11452,12 @@ function OhhwellsBridge() {
|
|
|
11385
11452
|
);
|
|
11386
11453
|
}
|
|
11387
11454
|
}, [resolveHrefKeyElement]);
|
|
11388
|
-
const reselectNavigationItem = (0,
|
|
11455
|
+
const reselectNavigationItem = (0, import_react13.useCallback)((navAnchor) => {
|
|
11389
11456
|
selectedElRef.current = navAnchor;
|
|
11390
11457
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
11391
11458
|
selectedFooterColAttrRef.current = null;
|
|
11392
11459
|
markSelected(navAnchor);
|
|
11393
|
-
setSelectedIsCta(
|
|
11460
|
+
setSelectedIsCta(isCtaButton(navAnchor));
|
|
11394
11461
|
const isDropdownTrigger = !isNestedNavChild(navAnchor) && (navItemHasDropdownChildren(navAnchor) || navItemOwnsDropdownPanel(navAnchor));
|
|
11395
11462
|
if (isNestedNavChild(navAnchor)) {
|
|
11396
11463
|
setNavGroupForceOpen(navAnchor, true);
|
|
@@ -11414,7 +11481,7 @@ function OhhwellsBridge() {
|
|
|
11414
11481
|
setToolbarShowEditLink(false);
|
|
11415
11482
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
11416
11483
|
}, [markSelected]);
|
|
11417
|
-
const commitNavigationTextEdit = (0,
|
|
11484
|
+
const commitNavigationTextEdit = (0, import_react13.useCallback)((navAnchor) => {
|
|
11418
11485
|
const el = activeElRef.current;
|
|
11419
11486
|
if (!el) return;
|
|
11420
11487
|
const key = el.dataset.ohwKey;
|
|
@@ -11441,7 +11508,7 @@ function OhhwellsBridge() {
|
|
|
11441
11508
|
postToParent2({ type: "ow:exit-edit" });
|
|
11442
11509
|
reselectNavigationItem(navAnchor);
|
|
11443
11510
|
}, [postToParent2, reselectNavigationItem]);
|
|
11444
|
-
const handleAddTopLevelNavItem = (0,
|
|
11511
|
+
const handleAddTopLevelNavItem = (0, import_react13.useCallback)(() => {
|
|
11445
11512
|
const items = listNavbarRootItems();
|
|
11446
11513
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
11447
11514
|
deselectRef.current();
|
|
@@ -11453,7 +11520,7 @@ function OhhwellsBridge() {
|
|
|
11453
11520
|
intent: "add-nav"
|
|
11454
11521
|
});
|
|
11455
11522
|
}, []);
|
|
11456
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
11523
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react13.useCallback)(
|
|
11457
11524
|
(anchor) => {
|
|
11458
11525
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
11459
11526
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -11466,7 +11533,7 @@ function OhhwellsBridge() {
|
|
|
11466
11533
|
},
|
|
11467
11534
|
[postToParent2]
|
|
11468
11535
|
);
|
|
11469
|
-
const handleNavDropdownOpenChange = (0,
|
|
11536
|
+
const handleNavDropdownOpenChange = (0, import_react13.useCallback)((open) => {
|
|
11470
11537
|
const selected = selectedElRef.current;
|
|
11471
11538
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
11472
11539
|
setNavGroupForceOpen(selected, open);
|
|
@@ -11478,7 +11545,7 @@ function OhhwellsBridge() {
|
|
|
11478
11545
|
}
|
|
11479
11546
|
});
|
|
11480
11547
|
}, []);
|
|
11481
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
11548
|
+
const handleFooterHeadingVisibleChange = (0, import_react13.useCallback)(
|
|
11482
11549
|
(visible) => {
|
|
11483
11550
|
const selected = selectedElRef.current;
|
|
11484
11551
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -11502,7 +11569,7 @@ function OhhwellsBridge() {
|
|
|
11502
11569
|
},
|
|
11503
11570
|
[postToParent2]
|
|
11504
11571
|
);
|
|
11505
|
-
const enterEditOnNewItem = (0,
|
|
11572
|
+
const enterEditOnNewItem = (0, import_react13.useCallback)((anchor) => {
|
|
11506
11573
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11507
11574
|
if (!label) {
|
|
11508
11575
|
selectRef.current(anchor);
|
|
@@ -11511,7 +11578,7 @@ function OhhwellsBridge() {
|
|
|
11511
11578
|
setNavGroupForceOpen(anchor, true);
|
|
11512
11579
|
activateRef.current(label);
|
|
11513
11580
|
}, []);
|
|
11514
|
-
const handleAddChildItem = (0,
|
|
11581
|
+
const handleAddChildItem = (0, import_react13.useCallback)(() => {
|
|
11515
11582
|
const selected = selectedElRef.current;
|
|
11516
11583
|
if (!selected) return;
|
|
11517
11584
|
if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
|
|
@@ -11587,7 +11654,7 @@ function OhhwellsBridge() {
|
|
|
11587
11654
|
enterEditOnNewItem(result.anchor);
|
|
11588
11655
|
});
|
|
11589
11656
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
11590
|
-
const handleAddFooterColumn = (0,
|
|
11657
|
+
const handleAddFooterColumn = (0, import_react13.useCallback)(() => {
|
|
11591
11658
|
if (!canAddFooterColumn()) {
|
|
11592
11659
|
postToParent2({
|
|
11593
11660
|
type: "ow:toast",
|
|
@@ -11608,7 +11675,7 @@ function OhhwellsBridge() {
|
|
|
11608
11675
|
selectRef.current(result.firstLink);
|
|
11609
11676
|
});
|
|
11610
11677
|
}, [postToParent2]);
|
|
11611
|
-
const clearFooterDragVisuals = (0,
|
|
11678
|
+
const clearFooterDragVisuals = (0, import_react13.useCallback)(() => {
|
|
11612
11679
|
footerDragRef.current = null;
|
|
11613
11680
|
setSiblingHintRects([]);
|
|
11614
11681
|
setFooterDropSlots([]);
|
|
@@ -11617,7 +11684,7 @@ function OhhwellsBridge() {
|
|
|
11617
11684
|
setIsItemDragging(false);
|
|
11618
11685
|
unlockFooterDragInteraction();
|
|
11619
11686
|
}, []);
|
|
11620
|
-
const refreshFooterDragVisuals = (0,
|
|
11687
|
+
const refreshFooterDragVisuals = (0, import_react13.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
11621
11688
|
const dragged = session.draggedEl;
|
|
11622
11689
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
11623
11690
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -11642,13 +11709,13 @@ function OhhwellsBridge() {
|
|
|
11642
11709
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
11643
11710
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
11644
11711
|
}, []);
|
|
11645
|
-
const refreshFooterDragVisualsRef = (0,
|
|
11712
|
+
const refreshFooterDragVisualsRef = (0, import_react13.useRef)(refreshFooterDragVisuals);
|
|
11646
11713
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
11647
|
-
const commitFooterDragRef = (0,
|
|
11714
|
+
const commitFooterDragRef = (0, import_react13.useRef)(() => {
|
|
11648
11715
|
});
|
|
11649
|
-
const beginFooterDragRef = (0,
|
|
11716
|
+
const beginFooterDragRef = (0, import_react13.useRef)(() => {
|
|
11650
11717
|
});
|
|
11651
|
-
const beginFooterDrag = (0,
|
|
11718
|
+
const beginFooterDrag = (0, import_react13.useCallback)(
|
|
11652
11719
|
(session) => {
|
|
11653
11720
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
11654
11721
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -11668,7 +11735,7 @@ function OhhwellsBridge() {
|
|
|
11668
11735
|
[refreshFooterDragVisuals]
|
|
11669
11736
|
);
|
|
11670
11737
|
beginFooterDragRef.current = beginFooterDrag;
|
|
11671
|
-
const commitFooterDrag = (0,
|
|
11738
|
+
const commitFooterDrag = (0, import_react13.useCallback)(
|
|
11672
11739
|
(clientX, clientY) => {
|
|
11673
11740
|
const session = footerDragRef.current;
|
|
11674
11741
|
if (!session) {
|
|
@@ -11772,7 +11839,7 @@ function OhhwellsBridge() {
|
|
|
11772
11839
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
11773
11840
|
);
|
|
11774
11841
|
commitFooterDragRef.current = commitFooterDrag;
|
|
11775
|
-
const startFooterLinkDrag = (0,
|
|
11842
|
+
const startFooterLinkDrag = (0, import_react13.useCallback)(
|
|
11776
11843
|
(anchor, clientX, clientY, wasSelected) => {
|
|
11777
11844
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
11778
11845
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return false;
|
|
@@ -11793,7 +11860,7 @@ function OhhwellsBridge() {
|
|
|
11793
11860
|
},
|
|
11794
11861
|
[beginFooterDrag]
|
|
11795
11862
|
);
|
|
11796
|
-
const startFooterColumnDrag = (0,
|
|
11863
|
+
const startFooterColumnDrag = (0, import_react13.useCallback)(
|
|
11797
11864
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
11798
11865
|
const columns = listFooterColumns();
|
|
11799
11866
|
const idx = columns.indexOf(columnEl);
|
|
@@ -11813,7 +11880,7 @@ function OhhwellsBridge() {
|
|
|
11813
11880
|
},
|
|
11814
11881
|
[beginFooterDrag]
|
|
11815
11882
|
);
|
|
11816
|
-
const handleItemDragStart = (0,
|
|
11883
|
+
const handleItemDragStart = (0, import_react13.useCallback)(
|
|
11817
11884
|
(e) => {
|
|
11818
11885
|
const selected = selectedElRef.current;
|
|
11819
11886
|
if (!selected) {
|
|
@@ -11833,7 +11900,7 @@ function OhhwellsBridge() {
|
|
|
11833
11900
|
},
|
|
11834
11901
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
|
|
11835
11902
|
);
|
|
11836
|
-
const handleItemDragEnd = (0,
|
|
11903
|
+
const handleItemDragEnd = (0, import_react13.useCallback)(
|
|
11837
11904
|
(e) => {
|
|
11838
11905
|
if (footerDragRef.current) {
|
|
11839
11906
|
const x = e?.clientX;
|
|
@@ -11859,7 +11926,7 @@ function OhhwellsBridge() {
|
|
|
11859
11926
|
},
|
|
11860
11927
|
[commitFooterDrag, commitNavDrag, navDragRef]
|
|
11861
11928
|
);
|
|
11862
|
-
const handleItemChromePointerDown = (0,
|
|
11929
|
+
const handleItemChromePointerDown = (0, import_react13.useCallback)((e) => {
|
|
11863
11930
|
if (e.button !== 0) return;
|
|
11864
11931
|
const selected = selectedElRef.current;
|
|
11865
11932
|
if (!selected) return;
|
|
@@ -11890,7 +11957,7 @@ function OhhwellsBridge() {
|
|
|
11890
11957
|
}
|
|
11891
11958
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
11892
11959
|
}, [armNavPressFromChrome]);
|
|
11893
|
-
const handleItemChromeClick = (0,
|
|
11960
|
+
const handleItemChromeClick = (0, import_react13.useCallback)((clientX, clientY) => {
|
|
11894
11961
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
11895
11962
|
suppressNextClickRef.current = false;
|
|
11896
11963
|
return;
|
|
@@ -11903,14 +11970,14 @@ function OhhwellsBridge() {
|
|
|
11903
11970
|
}, []);
|
|
11904
11971
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
11905
11972
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
11906
|
-
const select = (0,
|
|
11973
|
+
const select = (0, import_react13.useCallback)((anchor) => {
|
|
11907
11974
|
if (!isNavigationItem2(anchor)) return;
|
|
11908
11975
|
if (activeElRef.current) deactivate();
|
|
11909
11976
|
selectedElRef.current = anchor;
|
|
11910
11977
|
selectedHrefKeyRef.current = anchor.getAttribute("data-ohw-href-key");
|
|
11911
11978
|
selectedFooterColAttrRef.current = null;
|
|
11912
11979
|
markSelected(anchor);
|
|
11913
|
-
setSelectedIsCta(
|
|
11980
|
+
setSelectedIsCta(isCtaButton(anchor));
|
|
11914
11981
|
clearHrefKeyHover(anchor);
|
|
11915
11982
|
const isDropdownTrigger = !isNestedNavChild(anchor) && (navItemHasDropdownChildren(anchor) || navItemOwnsDropdownPanel(anchor));
|
|
11916
11983
|
if (isNestedNavChild(anchor)) {
|
|
@@ -11941,7 +12008,7 @@ function OhhwellsBridge() {
|
|
|
11941
12008
|
setToolbarShowEditLink(false);
|
|
11942
12009
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
11943
12010
|
}, [deactivate, markSelected]);
|
|
11944
|
-
const selectFrame = (0,
|
|
12011
|
+
const selectFrame = (0, import_react13.useCallback)((el) => {
|
|
11945
12012
|
if (!isNavigationContainer(el)) return;
|
|
11946
12013
|
if (activeElRef.current) deactivate();
|
|
11947
12014
|
const isFooterColumn = !isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || Boolean(el.closest("footer") && isInferredFooterGroup2(el)));
|
|
@@ -11987,7 +12054,7 @@ function OhhwellsBridge() {
|
|
|
11987
12054
|
setToolbarShowEditLink(false);
|
|
11988
12055
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
11989
12056
|
}, [deactivate, markSelected, postToParent2]);
|
|
11990
|
-
const activate = (0,
|
|
12057
|
+
const activate = (0, import_react13.useCallback)((el, options) => {
|
|
11991
12058
|
if (activeElRef.current === el) return;
|
|
11992
12059
|
clearSelectedAttr();
|
|
11993
12060
|
selectedElRef.current = null;
|
|
@@ -12056,7 +12123,7 @@ function OhhwellsBridge() {
|
|
|
12056
12123
|
selectRef.current = select;
|
|
12057
12124
|
selectFrameRef.current = selectFrame;
|
|
12058
12125
|
deselectRef.current = deselect;
|
|
12059
|
-
(0,
|
|
12126
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
12060
12127
|
if (!subdomain || isEditMode) {
|
|
12061
12128
|
setFetchState("done");
|
|
12062
12129
|
return;
|
|
@@ -12127,7 +12194,7 @@ function OhhwellsBridge() {
|
|
|
12127
12194
|
cancelled = true;
|
|
12128
12195
|
};
|
|
12129
12196
|
}, [subdomain, isEditMode]);
|
|
12130
|
-
(0,
|
|
12197
|
+
(0, import_react13.useEffect)(() => {
|
|
12131
12198
|
if (!subdomain || isEditMode) return;
|
|
12132
12199
|
let debounceTimer = null;
|
|
12133
12200
|
let observer = null;
|
|
@@ -12178,16 +12245,16 @@ function OhhwellsBridge() {
|
|
|
12178
12245
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
12179
12246
|
};
|
|
12180
12247
|
}, [subdomain, isEditMode, pathname]);
|
|
12181
|
-
(0,
|
|
12248
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
12182
12249
|
const el = document.getElementById("ohw-loader");
|
|
12183
12250
|
if (!el) return;
|
|
12184
12251
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
12185
12252
|
el.style.display = visible ? "flex" : "none";
|
|
12186
12253
|
}, [subdomain, fetchState]);
|
|
12187
|
-
(0,
|
|
12254
|
+
(0, import_react13.useEffect)(() => {
|
|
12188
12255
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
12189
12256
|
}, [pathname, postToParent2]);
|
|
12190
|
-
(0,
|
|
12257
|
+
(0, import_react13.useEffect)(() => {
|
|
12191
12258
|
if (!isEditMode) return;
|
|
12192
12259
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
12193
12260
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -12195,7 +12262,7 @@ function OhhwellsBridge() {
|
|
|
12195
12262
|
deselectRef.current();
|
|
12196
12263
|
deactivateRef.current();
|
|
12197
12264
|
}, [pathname, isEditMode]);
|
|
12198
|
-
(0,
|
|
12265
|
+
(0, import_react13.useEffect)(() => {
|
|
12199
12266
|
const contentForNav = () => {
|
|
12200
12267
|
if (isEditMode) return editContentRef.current;
|
|
12201
12268
|
if (!subdomain) return {};
|
|
@@ -12260,7 +12327,7 @@ function OhhwellsBridge() {
|
|
|
12260
12327
|
observer?.disconnect();
|
|
12261
12328
|
};
|
|
12262
12329
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
12263
|
-
(0,
|
|
12330
|
+
(0, import_react13.useEffect)(() => {
|
|
12264
12331
|
if (!isEditMode) return;
|
|
12265
12332
|
const measure = () => {
|
|
12266
12333
|
const h = document.body.scrollHeight;
|
|
@@ -12284,7 +12351,7 @@ function OhhwellsBridge() {
|
|
|
12284
12351
|
window.removeEventListener("resize", handleResize);
|
|
12285
12352
|
};
|
|
12286
12353
|
}, [pathname, isEditMode, postToParent2]);
|
|
12287
|
-
(0,
|
|
12354
|
+
(0, import_react13.useEffect)(() => {
|
|
12288
12355
|
if (!subdomainFromQuery || isEditMode) return;
|
|
12289
12356
|
const handleClick = (e) => {
|
|
12290
12357
|
const anchor = e.target.closest("a");
|
|
@@ -12300,7 +12367,7 @@ function OhhwellsBridge() {
|
|
|
12300
12367
|
document.addEventListener("click", handleClick, true);
|
|
12301
12368
|
return () => document.removeEventListener("click", handleClick, true);
|
|
12302
12369
|
}, [subdomainFromQuery, isEditMode, router]);
|
|
12303
|
-
(0,
|
|
12370
|
+
(0, import_react13.useEffect)(() => {
|
|
12304
12371
|
if (!isEditMode) {
|
|
12305
12372
|
editStylesRef.current?.base.remove();
|
|
12306
12373
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -12886,7 +12953,7 @@ function OhhwellsBridge() {
|
|
|
12886
12953
|
const navItemHit = Array.from(
|
|
12887
12954
|
container.querySelectorAll("[data-ohw-href-key]")
|
|
12888
12955
|
).filter((el) => {
|
|
12889
|
-
if (!isNavigationItem2(el) ||
|
|
12956
|
+
if (!isNavigationItem2(el) || isCtaButton(el)) return false;
|
|
12890
12957
|
if (!isNavItemPointerTarget(el)) return false;
|
|
12891
12958
|
const itemRect = el.getBoundingClientRect();
|
|
12892
12959
|
return x >= itemRect.left && x <= itemRect.right && y >= itemRect.top && y <= itemRect.bottom;
|
|
@@ -13028,6 +13095,22 @@ function OhhwellsBridge() {
|
|
|
13028
13095
|
}
|
|
13029
13096
|
return;
|
|
13030
13097
|
}
|
|
13098
|
+
if (!isDragOver && isPointOverBridgeChrome(x2, y2)) {
|
|
13099
|
+
dismissImageHover();
|
|
13100
|
+
return;
|
|
13101
|
+
}
|
|
13102
|
+
const ctaHit = isDragOver ? null : findCtaButtonAtPoint(x2, y2, imgEl);
|
|
13103
|
+
if (ctaHit) {
|
|
13104
|
+
dismissImageHover();
|
|
13105
|
+
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
13106
|
+
const selected = selectedElRef.current;
|
|
13107
|
+
if (selected !== ctaHit && !selected?.contains(ctaHit)) {
|
|
13108
|
+
clearHrefKeyHover(ctaHit);
|
|
13109
|
+
hoveredItemElRef.current = ctaHit;
|
|
13110
|
+
setHoveredItemRect(ctaHit.getBoundingClientRect());
|
|
13111
|
+
}
|
|
13112
|
+
return;
|
|
13113
|
+
}
|
|
13031
13114
|
const topEl = document.elementFromPoint(x2, y2);
|
|
13032
13115
|
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-more-menu], [data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-item"]')) {
|
|
13033
13116
|
if (hoveredImageRef.current) {
|
|
@@ -13151,7 +13234,7 @@ function OhhwellsBridge() {
|
|
|
13151
13234
|
const navLinkHit = Array.from(
|
|
13152
13235
|
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
13153
13236
|
).find((el) => {
|
|
13154
|
-
if (!isNavigationItem2(el) ||
|
|
13237
|
+
if (!isNavigationItem2(el) || isCtaButton(el)) return false;
|
|
13155
13238
|
if (!isNavItemPointerTarget(el)) return false;
|
|
13156
13239
|
const er = el.getBoundingClientRect();
|
|
13157
13240
|
return x2 >= er.left && x2 <= er.right && y2 >= er.top && y2 <= er.bottom;
|
|
@@ -13970,7 +14053,7 @@ function OhhwellsBridge() {
|
|
|
13970
14053
|
if (navRoot && navContainer) {
|
|
13971
14054
|
const rr = navRoot.getBoundingClientRect();
|
|
13972
14055
|
if (clientX >= rr.left && clientX <= rr.right && clientY >= rr.top && clientY <= rr.bottom && !isPointOverNavItem(navContainer, clientX, clientY)) {
|
|
13973
|
-
const book = navRoot.querySelector(
|
|
14056
|
+
const book = navRoot.querySelector(CTA_BUTTON_SELECTOR);
|
|
13974
14057
|
if (book) {
|
|
13975
14058
|
const br = book.getBoundingClientRect();
|
|
13976
14059
|
if (clientX >= br.left && clientX <= br.right && clientY >= br.top && clientY <= br.bottom) {
|
|
@@ -14063,7 +14146,7 @@ function OhhwellsBridge() {
|
|
|
14063
14146
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
14064
14147
|
};
|
|
14065
14148
|
}, [isEditMode, refreshStateRules]);
|
|
14066
|
-
(0,
|
|
14149
|
+
(0, import_react13.useEffect)(() => {
|
|
14067
14150
|
if (!isEditMode) return;
|
|
14068
14151
|
const THRESHOLD = 10;
|
|
14069
14152
|
const resolveWasSelected = (el) => {
|
|
@@ -14217,7 +14300,7 @@ function OhhwellsBridge() {
|
|
|
14217
14300
|
unlockFooterDragInteraction();
|
|
14218
14301
|
};
|
|
14219
14302
|
}, [isEditMode]);
|
|
14220
|
-
(0,
|
|
14303
|
+
(0, import_react13.useEffect)(() => {
|
|
14221
14304
|
const handler = (e) => {
|
|
14222
14305
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
14223
14306
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -14233,7 +14316,7 @@ function OhhwellsBridge() {
|
|
|
14233
14316
|
window.addEventListener("message", handler);
|
|
14234
14317
|
return () => window.removeEventListener("message", handler);
|
|
14235
14318
|
}, [processConfigRequest]);
|
|
14236
|
-
(0,
|
|
14319
|
+
(0, import_react13.useEffect)(() => {
|
|
14237
14320
|
if (!isEditMode) return;
|
|
14238
14321
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
14239
14322
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -14268,13 +14351,13 @@ function OhhwellsBridge() {
|
|
|
14268
14351
|
clearTimeout(timer);
|
|
14269
14352
|
};
|
|
14270
14353
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
14271
|
-
(0,
|
|
14354
|
+
(0, import_react13.useEffect)(() => {
|
|
14272
14355
|
scrollToHashSectionWhenReady();
|
|
14273
14356
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
14274
14357
|
window.addEventListener("hashchange", onHashChange);
|
|
14275
14358
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
14276
14359
|
}, [pathname]);
|
|
14277
|
-
const handleCommand = (0,
|
|
14360
|
+
const handleCommand = (0, import_react13.useCallback)((cmd) => {
|
|
14278
14361
|
const el = activeElRef.current;
|
|
14279
14362
|
const selBefore = window.getSelection();
|
|
14280
14363
|
let savedOffsets = null;
|
|
@@ -14310,7 +14393,7 @@ function OhhwellsBridge() {
|
|
|
14310
14393
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
14311
14394
|
refreshActiveCommandsRef.current();
|
|
14312
14395
|
}, []);
|
|
14313
|
-
const handleStateChange = (0,
|
|
14396
|
+
const handleStateChange = (0, import_react13.useCallback)((state) => {
|
|
14314
14397
|
if (!activeStateElRef.current) return;
|
|
14315
14398
|
const el = activeStateElRef.current;
|
|
14316
14399
|
if (state === "Default") {
|
|
@@ -14323,7 +14406,7 @@ function OhhwellsBridge() {
|
|
|
14323
14406
|
}
|
|
14324
14407
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
14325
14408
|
}, [deactivate]);
|
|
14326
|
-
const reselectAfterLinkPopover = (0,
|
|
14409
|
+
const reselectAfterLinkPopover = (0, import_react13.useCallback)(
|
|
14327
14410
|
(hrefKey) => {
|
|
14328
14411
|
requestAnimationFrame(() => {
|
|
14329
14412
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -14332,7 +14415,7 @@ function OhhwellsBridge() {
|
|
|
14332
14415
|
},
|
|
14333
14416
|
[resolveHrefKeyElement]
|
|
14334
14417
|
);
|
|
14335
|
-
const closeLinkPopover = (0,
|
|
14418
|
+
const closeLinkPopover = (0, import_react13.useCallback)(() => {
|
|
14336
14419
|
const session = linkPopoverSessionRef.current;
|
|
14337
14420
|
addNavAfterAnchorRef.current = null;
|
|
14338
14421
|
setLinkPopover(null);
|
|
@@ -14340,9 +14423,9 @@ function OhhwellsBridge() {
|
|
|
14340
14423
|
reselectAfterLinkPopover(session.key);
|
|
14341
14424
|
}
|
|
14342
14425
|
}, [reselectAfterLinkPopover]);
|
|
14343
|
-
const closeLinkPopoverRef = (0,
|
|
14426
|
+
const closeLinkPopoverRef = (0, import_react13.useRef)(closeLinkPopover);
|
|
14344
14427
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
14345
|
-
const openLinkPopoverForActive = (0,
|
|
14428
|
+
const openLinkPopoverForActive = (0, import_react13.useCallback)(() => {
|
|
14346
14429
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
14347
14430
|
if (!hrefCtx) return;
|
|
14348
14431
|
bumpLinkPopoverGrace();
|
|
@@ -14353,7 +14436,7 @@ function OhhwellsBridge() {
|
|
|
14353
14436
|
});
|
|
14354
14437
|
deactivate();
|
|
14355
14438
|
}, [deactivate]);
|
|
14356
|
-
const openLinkPopoverForSelected = (0,
|
|
14439
|
+
const openLinkPopoverForSelected = (0, import_react13.useCallback)(() => {
|
|
14357
14440
|
const anchor = selectedElRef.current;
|
|
14358
14441
|
if (!anchor) return;
|
|
14359
14442
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -14366,7 +14449,7 @@ function OhhwellsBridge() {
|
|
|
14366
14449
|
});
|
|
14367
14450
|
deselect();
|
|
14368
14451
|
}, [deselect]);
|
|
14369
|
-
const handleSelectParent = (0,
|
|
14452
|
+
const handleSelectParent = (0, import_react13.useCallback)(() => {
|
|
14370
14453
|
const selected = selectedElRef.current;
|
|
14371
14454
|
if (!selected) return;
|
|
14372
14455
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -14393,7 +14476,7 @@ function OhhwellsBridge() {
|
|
|
14393
14476
|
}
|
|
14394
14477
|
deselectRef.current();
|
|
14395
14478
|
}, []);
|
|
14396
|
-
const handleDuplicateSelected = (0,
|
|
14479
|
+
const handleDuplicateSelected = (0, import_react13.useCallback)(() => {
|
|
14397
14480
|
const selected = selectedElRef.current;
|
|
14398
14481
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
14399
14482
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
@@ -14483,7 +14566,7 @@ function OhhwellsBridge() {
|
|
|
14483
14566
|
});
|
|
14484
14567
|
}
|
|
14485
14568
|
}, [postToParent2]);
|
|
14486
|
-
const runPendingDeleteUndo = (0,
|
|
14569
|
+
const runPendingDeleteUndo = (0, import_react13.useCallback)(() => {
|
|
14487
14570
|
const pending = pendingDeleteUndoRef.current;
|
|
14488
14571
|
if (!pending) return false;
|
|
14489
14572
|
pendingDeleteUndoRef.current = null;
|
|
@@ -14491,7 +14574,7 @@ function OhhwellsBridge() {
|
|
|
14491
14574
|
enforceLinkHrefs();
|
|
14492
14575
|
return true;
|
|
14493
14576
|
}, []);
|
|
14494
|
-
const handleDeleteSelected = (0,
|
|
14577
|
+
const handleDeleteSelected = (0, import_react13.useCallback)(() => {
|
|
14495
14578
|
const selected = selectedElRef.current;
|
|
14496
14579
|
if (!selected) return false;
|
|
14497
14580
|
return deleteSelectedNavFooterItem({
|
|
@@ -14512,7 +14595,7 @@ function OhhwellsBridge() {
|
|
|
14512
14595
|
}, [postToParent2]);
|
|
14513
14596
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
14514
14597
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
14515
|
-
const handleLinkPopoverSubmit = (0,
|
|
14598
|
+
const handleLinkPopoverSubmit = (0, import_react13.useCallback)(
|
|
14516
14599
|
(target) => {
|
|
14517
14600
|
const session = linkPopoverSessionRef.current;
|
|
14518
14601
|
if (!session) return;
|
|
@@ -14562,6 +14645,7 @@ function OhhwellsBridge() {
|
|
|
14562
14645
|
return;
|
|
14563
14646
|
}
|
|
14564
14647
|
const { key } = session;
|
|
14648
|
+
setStoredLinkHref(key, target);
|
|
14565
14649
|
applyLinkByKey(key, target);
|
|
14566
14650
|
editContentRef.current = { ...editContentRef.current, [key]: target };
|
|
14567
14651
|
postToParent2({ type: "ow:change", nodes: [{ key, text: target }] });
|
|
@@ -14577,19 +14661,19 @@ function OhhwellsBridge() {
|
|
|
14577
14661
|
const showEditLink = toolbarShowEditLink;
|
|
14578
14662
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
14579
14663
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
14580
|
-
const handleMediaReplace = (0,
|
|
14664
|
+
const handleMediaReplace = (0, import_react13.useCallback)(
|
|
14581
14665
|
(key) => {
|
|
14582
14666
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
14583
14667
|
},
|
|
14584
14668
|
[postToParent2, mediaHover?.elementType]
|
|
14585
14669
|
);
|
|
14586
|
-
const handleEditCarousel = (0,
|
|
14670
|
+
const handleEditCarousel = (0, import_react13.useCallback)(
|
|
14587
14671
|
(key) => {
|
|
14588
14672
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
14589
14673
|
},
|
|
14590
14674
|
[postToParent2]
|
|
14591
14675
|
);
|
|
14592
|
-
const handleMediaFadeOutComplete = (0,
|
|
14676
|
+
const handleMediaFadeOutComplete = (0, import_react13.useCallback)((key) => {
|
|
14593
14677
|
setUploadingRects((prev) => {
|
|
14594
14678
|
if (!(key in prev)) return prev;
|
|
14595
14679
|
const next = { ...prev };
|
|
@@ -14597,7 +14681,7 @@ function OhhwellsBridge() {
|
|
|
14597
14681
|
return next;
|
|
14598
14682
|
});
|
|
14599
14683
|
}, []);
|
|
14600
|
-
const handleVideoSettingsChange = (0,
|
|
14684
|
+
const handleVideoSettingsChange = (0, import_react13.useCallback)(
|
|
14601
14685
|
(key, settings) => {
|
|
14602
14686
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
14603
14687
|
const video = getVideoEl2(el);
|