@ohhwells/bridge 0.1.160-next.428 → 0.1.160-next.429
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 +663 -560
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +247 -144
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -115,7 +115,7 @@ __export(index_exports, {
|
|
|
115
115
|
module.exports = __toCommonJS(index_exports);
|
|
116
116
|
|
|
117
117
|
// src/OhhwellsBridge.tsx
|
|
118
|
-
var
|
|
118
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
119
119
|
var import_client3 = require("react-dom/client");
|
|
120
120
|
var import_react_dom5 = require("react-dom");
|
|
121
121
|
|
|
@@ -12295,11 +12295,139 @@ function useSavedLinkNavigation(isEditMode) {
|
|
|
12295
12295
|
}, [isEditMode, router]);
|
|
12296
12296
|
}
|
|
12297
12297
|
|
|
12298
|
-
// src/
|
|
12298
|
+
// src/useNavDropdownToggle.ts
|
|
12299
|
+
var import_react5 = require("react");
|
|
12300
|
+
var import_navigation2 = require("next/navigation");
|
|
12301
|
+
var OPEN_ATTR = "data-ohw-nav-force-open";
|
|
12302
|
+
function parentLinkWithDropdown(target) {
|
|
12303
|
+
const anchor = target?.closest?.("a");
|
|
12304
|
+
const group = anchor?.parentElement;
|
|
12305
|
+
if (!anchor || !group?.matches("[data-ohw-nav-group]:not([data-ohw-nav-dropdown-template])")) {
|
|
12306
|
+
return null;
|
|
12307
|
+
}
|
|
12308
|
+
const hasChildren = group.querySelector(":scope > [data-ohw-nav-children] > [data-ohw-href-key]");
|
|
12309
|
+
return hasChildren ? anchor : null;
|
|
12310
|
+
}
|
|
12311
|
+
function closeAll(except) {
|
|
12312
|
+
document.querySelectorAll(`[${OPEN_ATTR}]`).forEach((group) => {
|
|
12313
|
+
if (group === except) return;
|
|
12314
|
+
group.removeAttribute(OPEN_ATTR);
|
|
12315
|
+
group.querySelector(":scope > a")?.setAttribute("aria-expanded", "false");
|
|
12316
|
+
});
|
|
12317
|
+
}
|
|
12318
|
+
function useNavDropdownToggle(isEditMode) {
|
|
12319
|
+
const pathname = (0, import_navigation2.usePathname)();
|
|
12320
|
+
(0, import_react5.useEffect)(() => {
|
|
12321
|
+
if (isEditMode) return;
|
|
12322
|
+
const onClick = (e) => {
|
|
12323
|
+
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
12324
|
+
const anchor = parentLinkWithDropdown(e.target);
|
|
12325
|
+
if (!anchor) {
|
|
12326
|
+
const insideOpen = e.target?.closest?.(`[${OPEN_ATTR}]`);
|
|
12327
|
+
const onChildLink = e.target?.closest?.("[data-ohw-nav-children] a");
|
|
12328
|
+
if (!insideOpen || onChildLink) closeAll();
|
|
12329
|
+
return;
|
|
12330
|
+
}
|
|
12331
|
+
e.preventDefault();
|
|
12332
|
+
e.stopPropagation();
|
|
12333
|
+
const group = anchor.parentElement;
|
|
12334
|
+
const open = !group.hasAttribute(OPEN_ATTR);
|
|
12335
|
+
closeAll(group);
|
|
12336
|
+
group.toggleAttribute(OPEN_ATTR, open);
|
|
12337
|
+
anchor.setAttribute("aria-expanded", String(open));
|
|
12338
|
+
};
|
|
12339
|
+
const onKeyDown = (e) => {
|
|
12340
|
+
if (e.key !== "Escape") return;
|
|
12341
|
+
const open = document.querySelector(`[${OPEN_ATTR}] > a`);
|
|
12342
|
+
closeAll();
|
|
12343
|
+
open?.focus();
|
|
12344
|
+
};
|
|
12345
|
+
window.addEventListener("click", onClick, true);
|
|
12346
|
+
window.addEventListener("keydown", onKeyDown);
|
|
12347
|
+
return () => {
|
|
12348
|
+
window.removeEventListener("click", onClick, true);
|
|
12349
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
12350
|
+
};
|
|
12351
|
+
}, [isEditMode]);
|
|
12352
|
+
(0, import_react5.useEffect)(() => {
|
|
12353
|
+
if (!isEditMode) closeAll();
|
|
12354
|
+
}, [pathname, isEditMode]);
|
|
12355
|
+
}
|
|
12356
|
+
|
|
12357
|
+
// src/useHashLinkScroll.ts
|
|
12299
12358
|
var import_react6 = require("react");
|
|
12300
12359
|
|
|
12360
|
+
// src/lib/scroll-to-section.ts
|
|
12361
|
+
var MAX_ATTEMPTS = 12;
|
|
12362
|
+
var RETRY_MS = 100;
|
|
12363
|
+
function getHashSectionId() {
|
|
12364
|
+
if (typeof window === "undefined") return null;
|
|
12365
|
+
const id = window.location.hash.replace(/^#/, "").trim();
|
|
12366
|
+
return id || null;
|
|
12367
|
+
}
|
|
12368
|
+
function scrollToOhwSection(sectionId, behavior = "smooth") {
|
|
12369
|
+
if (!sectionId || typeof document === "undefined") return false;
|
|
12370
|
+
const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
12371
|
+
if (!el) return false;
|
|
12372
|
+
el.scrollIntoView({ behavior, block: "start" });
|
|
12373
|
+
return true;
|
|
12374
|
+
}
|
|
12375
|
+
function scrollToHashSectionWhenReady(behavior = "smooth") {
|
|
12376
|
+
const id = getHashSectionId();
|
|
12377
|
+
if (!id) return;
|
|
12378
|
+
let attempt = 0;
|
|
12379
|
+
const tick = () => {
|
|
12380
|
+
if (scrollToOhwSection(id, behavior)) return;
|
|
12381
|
+
attempt += 1;
|
|
12382
|
+
if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
|
|
12383
|
+
};
|
|
12384
|
+
tick();
|
|
12385
|
+
}
|
|
12386
|
+
function scrollToOhwSectionAfterNavigation(sectionId, behavior = "smooth") {
|
|
12387
|
+
let attempt = 0;
|
|
12388
|
+
const tick = () => {
|
|
12389
|
+
if (getHashSectionId() === sectionId && scrollToOhwSection(sectionId, behavior)) return;
|
|
12390
|
+
attempt += 1;
|
|
12391
|
+
if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
|
|
12392
|
+
};
|
|
12393
|
+
window.setTimeout(tick, 0);
|
|
12394
|
+
}
|
|
12395
|
+
|
|
12396
|
+
// src/useHashLinkScroll.ts
|
|
12397
|
+
function samePageSectionId(anchor) {
|
|
12398
|
+
const href = anchor.getAttribute("href");
|
|
12399
|
+
if (!href || !href.includes("#")) return null;
|
|
12400
|
+
if (anchor.target !== "" && anchor.target !== "_self") return null;
|
|
12401
|
+
let url;
|
|
12402
|
+
try {
|
|
12403
|
+
url = new URL(href, window.location.href);
|
|
12404
|
+
} catch {
|
|
12405
|
+
return null;
|
|
12406
|
+
}
|
|
12407
|
+
if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) return null;
|
|
12408
|
+
const id = decodeURIComponent(url.hash.replace(/^#/, "")).trim();
|
|
12409
|
+
return id || null;
|
|
12410
|
+
}
|
|
12411
|
+
function useHashLinkScroll(isEditMode) {
|
|
12412
|
+
(0, import_react6.useEffect)(() => {
|
|
12413
|
+
if (isEditMode) return;
|
|
12414
|
+
const onClick = (e) => {
|
|
12415
|
+
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
12416
|
+
const anchor = e.target?.closest?.("a");
|
|
12417
|
+
if (!anchor) return;
|
|
12418
|
+
const id = samePageSectionId(anchor);
|
|
12419
|
+
if (id) scrollToOhwSectionAfterNavigation(id);
|
|
12420
|
+
};
|
|
12421
|
+
window.addEventListener("click", onClick, true);
|
|
12422
|
+
return () => window.removeEventListener("click", onClick, true);
|
|
12423
|
+
}, [isEditMode]);
|
|
12424
|
+
}
|
|
12425
|
+
|
|
12426
|
+
// src/ui/SchedulingWidget.tsx
|
|
12427
|
+
var import_react8 = require("react");
|
|
12428
|
+
|
|
12301
12429
|
// src/ui/EmailCaptureModal.tsx
|
|
12302
|
-
var
|
|
12430
|
+
var import_react7 = require("react");
|
|
12303
12431
|
var import_radix_ui = require("radix-ui");
|
|
12304
12432
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
12305
12433
|
var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
@@ -12329,11 +12457,11 @@ function Spinner() {
|
|
|
12329
12457
|
);
|
|
12330
12458
|
}
|
|
12331
12459
|
function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
|
|
12332
|
-
const [email, setEmail] = (0,
|
|
12333
|
-
const [submittedEmail, setSubmittedEmail] = (0,
|
|
12334
|
-
const [loading, setLoading] = (0,
|
|
12335
|
-
const [success, setSuccess] = (0,
|
|
12336
|
-
const [error, setError] = (0,
|
|
12460
|
+
const [email, setEmail] = (0, import_react7.useState)("");
|
|
12461
|
+
const [submittedEmail, setSubmittedEmail] = (0, import_react7.useState)("");
|
|
12462
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
12463
|
+
const [success, setSuccess] = (0, import_react7.useState)(false);
|
|
12464
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
12337
12465
|
const isBook = title === "Confirm your spot";
|
|
12338
12466
|
const handleSubmit = async () => {
|
|
12339
12467
|
const trimmed = email.trim();
|
|
@@ -12600,21 +12728,21 @@ function LoadingSkeleton() {
|
|
|
12600
12728
|
] });
|
|
12601
12729
|
}
|
|
12602
12730
|
function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
|
|
12603
|
-
const todayMs = (0,
|
|
12731
|
+
const todayMs = (0, import_react8.useMemo)(() => {
|
|
12604
12732
|
const d = /* @__PURE__ */ new Date();
|
|
12605
12733
|
d.setHours(0, 0, 0, 0);
|
|
12606
12734
|
return d.getTime();
|
|
12607
12735
|
}, []);
|
|
12608
|
-
const scrollRef = (0,
|
|
12609
|
-
const [canScrollLeft, setCanScrollLeft] = (0,
|
|
12610
|
-
const [canScrollRight, setCanScrollRight] = (0,
|
|
12736
|
+
const scrollRef = (0, import_react8.useRef)(null);
|
|
12737
|
+
const [canScrollLeft, setCanScrollLeft] = (0, import_react8.useState)(false);
|
|
12738
|
+
const [canScrollRight, setCanScrollRight] = (0, import_react8.useState)(false);
|
|
12611
12739
|
const updateScrollState = () => {
|
|
12612
12740
|
const el = scrollRef.current;
|
|
12613
12741
|
if (!el) return;
|
|
12614
12742
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
12615
12743
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
12616
12744
|
};
|
|
12617
|
-
(0,
|
|
12745
|
+
(0, import_react8.useEffect)(() => {
|
|
12618
12746
|
const el = scrollRef.current;
|
|
12619
12747
|
if (!el) return;
|
|
12620
12748
|
updateScrollState();
|
|
@@ -12629,9 +12757,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12629
12757
|
const scroll = (dir) => {
|
|
12630
12758
|
scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
|
|
12631
12759
|
};
|
|
12632
|
-
const isDragging = (0,
|
|
12633
|
-
const dragStartX = (0,
|
|
12634
|
-
const dragStartScrollLeft = (0,
|
|
12760
|
+
const isDragging = (0, import_react8.useRef)(false);
|
|
12761
|
+
const dragStartX = (0, import_react8.useRef)(0);
|
|
12762
|
+
const dragStartScrollLeft = (0, import_react8.useRef)(0);
|
|
12635
12763
|
const onDragStart = (e) => {
|
|
12636
12764
|
if (!scrollRef.current) return;
|
|
12637
12765
|
isDragging.current = true;
|
|
@@ -12651,14 +12779,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12651
12779
|
scrollRef.current.style.cursor = "grab";
|
|
12652
12780
|
scrollRef.current.style.userSelect = "";
|
|
12653
12781
|
};
|
|
12654
|
-
const datesWithClasses = (0,
|
|
12782
|
+
const datesWithClasses = (0, import_react8.useMemo)(
|
|
12655
12783
|
() => new Set(dates.map(
|
|
12656
12784
|
(d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
|
|
12657
12785
|
).filter((i) => i >= 0)),
|
|
12658
12786
|
[dates, schedule]
|
|
12659
12787
|
);
|
|
12660
12788
|
const selectedDate = dates[selectedIdx];
|
|
12661
|
-
const selectedClasses = (0,
|
|
12789
|
+
const selectedClasses = (0, import_react8.useMemo)(
|
|
12662
12790
|
() => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
|
|
12663
12791
|
[schedule, selectedDate]
|
|
12664
12792
|
);
|
|
@@ -12843,16 +12971,16 @@ function CalendarFoldIcon() {
|
|
|
12843
12971
|
);
|
|
12844
12972
|
}
|
|
12845
12973
|
function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
|
|
12846
|
-
const autoId = (0,
|
|
12974
|
+
const autoId = (0, import_react8.useId)();
|
|
12847
12975
|
const insertAfter = insertAfterProp ?? autoId;
|
|
12848
|
-
const [schedule, setSchedule] = (0,
|
|
12849
|
-
const [loading, setLoading] = (0,
|
|
12850
|
-
const [inEditor, setInEditor] = (0,
|
|
12851
|
-
const [isHovered, setIsHovered] = (0,
|
|
12852
|
-
const [modalState, setModalState] = (0,
|
|
12853
|
-
const switchScheduleIdRef = (0,
|
|
12854
|
-
const liveScheduleIdRef = (0,
|
|
12855
|
-
const refetchLiveSchedule = (0,
|
|
12976
|
+
const [schedule, setSchedule] = (0, import_react8.useState)(null);
|
|
12977
|
+
const [loading, setLoading] = (0, import_react8.useState)(initialScheduleId !== null);
|
|
12978
|
+
const [inEditor, setInEditor] = (0, import_react8.useState)(false);
|
|
12979
|
+
const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
|
|
12980
|
+
const [modalState, setModalState] = (0, import_react8.useState)(null);
|
|
12981
|
+
const switchScheduleIdRef = (0, import_react8.useRef)(null);
|
|
12982
|
+
const liveScheduleIdRef = (0, import_react8.useRef)(null);
|
|
12983
|
+
const refetchLiveSchedule = (0, import_react8.useCallback)(async () => {
|
|
12856
12984
|
const id = liveScheduleIdRef.current;
|
|
12857
12985
|
if (!id) return;
|
|
12858
12986
|
try {
|
|
@@ -12862,7 +12990,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12862
12990
|
} catch {
|
|
12863
12991
|
}
|
|
12864
12992
|
}, []);
|
|
12865
|
-
const dates = (0,
|
|
12993
|
+
const dates = (0, import_react8.useMemo)(() => {
|
|
12866
12994
|
const today = /* @__PURE__ */ new Date();
|
|
12867
12995
|
today.setHours(0, 0, 0, 0);
|
|
12868
12996
|
return Array.from({ length: 14 }, (_, i) => {
|
|
@@ -12871,8 +12999,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12871
12999
|
return d;
|
|
12872
13000
|
});
|
|
12873
13001
|
}, []);
|
|
12874
|
-
const [selectedIdx, setSelectedIdx] = (0,
|
|
12875
|
-
(0,
|
|
13002
|
+
const [selectedIdx, setSelectedIdx] = (0, import_react8.useState)(0);
|
|
13003
|
+
(0, import_react8.useEffect)(() => {
|
|
12876
13004
|
if (!schedule?.classes) return;
|
|
12877
13005
|
for (let i = 0; i < dates.length; i++) {
|
|
12878
13006
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -12881,7 +13009,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12881
13009
|
}
|
|
12882
13010
|
}
|
|
12883
13011
|
}, [schedule, dates]);
|
|
12884
|
-
(0,
|
|
13012
|
+
(0, import_react8.useEffect)(() => {
|
|
12885
13013
|
if (typeof window === "undefined") return;
|
|
12886
13014
|
const onVisible = () => {
|
|
12887
13015
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -12893,7 +13021,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12893
13021
|
document.removeEventListener("visibilitychange", onVisible);
|
|
12894
13022
|
};
|
|
12895
13023
|
}, [refetchLiveSchedule]);
|
|
12896
|
-
(0,
|
|
13024
|
+
(0, import_react8.useEffect)(() => {
|
|
12897
13025
|
if (typeof window === "undefined") return;
|
|
12898
13026
|
const isInEditor = window.self !== window.top;
|
|
12899
13027
|
setInEditor(isInEditor);
|
|
@@ -16648,7 +16776,7 @@ var CustomToolbarButton = React5.forwardRef(
|
|
|
16648
16776
|
CustomToolbarButton.displayName = "CustomToolbarButton";
|
|
16649
16777
|
|
|
16650
16778
|
// src/ui/item-action-toolbar.tsx
|
|
16651
|
-
var
|
|
16779
|
+
var import_react9 = require("react");
|
|
16652
16780
|
var import_lucide_react3 = require("lucide-react");
|
|
16653
16781
|
|
|
16654
16782
|
// src/ui/dropdown-menu.tsx
|
|
@@ -16833,7 +16961,7 @@ function ItemActionToolbar({
|
|
|
16833
16961
|
headingVisible = null,
|
|
16834
16962
|
onHeadingVisibleChange
|
|
16835
16963
|
}) {
|
|
16836
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
16964
|
+
const [moreOpen, setMoreOpen] = (0, import_react9.useState)(false);
|
|
16837
16965
|
const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
|
|
16838
16966
|
const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
|
|
16839
16967
|
const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
|
|
@@ -17041,7 +17169,7 @@ function ItemActionToolbar({
|
|
|
17041
17169
|
}
|
|
17042
17170
|
|
|
17043
17171
|
// src/ui/item-interaction-layer.tsx
|
|
17044
|
-
var
|
|
17172
|
+
var import_react10 = require("react");
|
|
17045
17173
|
var import_react_dom3 = require("react-dom");
|
|
17046
17174
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
17047
17175
|
var PRIMARY = "var(--ohw-primary, #0885FE)";
|
|
@@ -17098,8 +17226,8 @@ function ClampedToolbarSlot({
|
|
|
17098
17226
|
align = "center",
|
|
17099
17227
|
children
|
|
17100
17228
|
}) {
|
|
17101
|
-
const slotRef = (0,
|
|
17102
|
-
(0,
|
|
17229
|
+
const slotRef = (0, import_react10.useRef)(null);
|
|
17230
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
17103
17231
|
const slot = slotRef.current;
|
|
17104
17232
|
if (!slot) return;
|
|
17105
17233
|
const clamp = () => {
|
|
@@ -17162,15 +17290,15 @@ function DetachedBelowToolbarSlot({
|
|
|
17162
17290
|
belowEl,
|
|
17163
17291
|
children
|
|
17164
17292
|
}) {
|
|
17165
|
-
const slotRef = (0,
|
|
17166
|
-
const [anchorBottom, setAnchorBottom] = (0,
|
|
17167
|
-
const [portalTarget] = (0,
|
|
17293
|
+
const slotRef = (0, import_react10.useRef)(null);
|
|
17294
|
+
const [anchorBottom, setAnchorBottom] = (0, import_react10.useState)(belowRect.bottom);
|
|
17295
|
+
const [portalTarget] = (0, import_react10.useState)(
|
|
17168
17296
|
() => typeof document === "undefined" ? null : document.querySelector("[data-ohw-bridge-root]") ?? document.body
|
|
17169
17297
|
);
|
|
17170
|
-
(0,
|
|
17298
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
17171
17299
|
setAnchorBottom(belowRect.bottom);
|
|
17172
17300
|
}, [belowRect.bottom, belowRect.height, belowRect.top]);
|
|
17173
|
-
(0,
|
|
17301
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
17174
17302
|
const slot = slotRef.current;
|
|
17175
17303
|
if (!slot) return;
|
|
17176
17304
|
const sync = () => {
|
|
@@ -17251,8 +17379,8 @@ function ItemInteractionLayer({
|
|
|
17251
17379
|
hidden = false,
|
|
17252
17380
|
className
|
|
17253
17381
|
}) {
|
|
17254
|
-
const localRef = (0,
|
|
17255
|
-
(0,
|
|
17382
|
+
const localRef = (0, import_react10.useRef)(null);
|
|
17383
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
17256
17384
|
const node = localRef.current;
|
|
17257
17385
|
if (!node) return;
|
|
17258
17386
|
node.style.display = hidden ? "none" : "block";
|
|
@@ -17527,7 +17655,7 @@ function apiBase() {
|
|
|
17527
17655
|
function bridgeVersion() {
|
|
17528
17656
|
try {
|
|
17529
17657
|
if (true) {
|
|
17530
|
-
return "0.1.160-next.
|
|
17658
|
+
return "0.1.160-next.429";
|
|
17531
17659
|
}
|
|
17532
17660
|
} catch {
|
|
17533
17661
|
}
|
|
@@ -17541,7 +17669,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17541
17669
|
return;
|
|
17542
17670
|
}
|
|
17543
17671
|
try {
|
|
17544
|
-
const v = true ? "0.1.160-next.
|
|
17672
|
+
const v = true ? "0.1.160-next.429" : "";
|
|
17545
17673
|
if (v) {
|
|
17546
17674
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17547
17675
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18448,7 +18576,7 @@ function CarouselOverlay({
|
|
|
18448
18576
|
}
|
|
18449
18577
|
|
|
18450
18578
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18451
|
-
var
|
|
18579
|
+
var import_react11 = require("react");
|
|
18452
18580
|
var import_lucide_react7 = require("lucide-react");
|
|
18453
18581
|
|
|
18454
18582
|
// src/lib/ai-change-highlight.ts
|
|
@@ -18543,8 +18671,8 @@ function readRect(instanceId) {
|
|
|
18543
18671
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18544
18672
|
}
|
|
18545
18673
|
function useLiveSectionRect(sectionId) {
|
|
18546
|
-
const [rect, setRect] = (0,
|
|
18547
|
-
(0,
|
|
18674
|
+
const [rect, setRect] = (0, import_react11.useState)(null);
|
|
18675
|
+
(0, import_react11.useEffect)(() => {
|
|
18548
18676
|
if (!sectionId) {
|
|
18549
18677
|
setRect(null);
|
|
18550
18678
|
return;
|
|
@@ -18583,8 +18711,8 @@ function readNavToggleRect() {
|
|
|
18583
18711
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18584
18712
|
}
|
|
18585
18713
|
function useLiveNavToggleHole(active) {
|
|
18586
|
-
const [rect, setRect] = (0,
|
|
18587
|
-
(0,
|
|
18714
|
+
const [rect, setRect] = (0, import_react11.useState)(null);
|
|
18715
|
+
(0, import_react11.useEffect)(() => {
|
|
18588
18716
|
if (!active) {
|
|
18589
18717
|
setRect(null);
|
|
18590
18718
|
return;
|
|
@@ -18646,7 +18774,7 @@ function ReviewButton({
|
|
|
18646
18774
|
background,
|
|
18647
18775
|
color
|
|
18648
18776
|
}) {
|
|
18649
|
-
const [hover, setHover] = (0,
|
|
18777
|
+
const [hover, setHover] = (0, import_react11.useState)(false);
|
|
18650
18778
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "relative" }, children: [
|
|
18651
18779
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
18652
18780
|
"button",
|
|
@@ -18701,17 +18829,17 @@ function AiSectionOverlay({
|
|
|
18701
18829
|
apiRef,
|
|
18702
18830
|
onSelectionChange
|
|
18703
18831
|
}) {
|
|
18704
|
-
const [selectedId, setSelectedId] = (0,
|
|
18705
|
-
const [reviewId, setReviewId] = (0,
|
|
18706
|
-
const [reviewButtonsHidden, setReviewButtonsHidden] = (0,
|
|
18707
|
-
const reviewIdRef = (0,
|
|
18832
|
+
const [selectedId, setSelectedId] = (0, import_react11.useState)(null);
|
|
18833
|
+
const [reviewId, setReviewId] = (0, import_react11.useState)(null);
|
|
18834
|
+
const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react11.useState)(false);
|
|
18835
|
+
const reviewIdRef = (0, import_react11.useRef)(null);
|
|
18708
18836
|
reviewIdRef.current = reviewId;
|
|
18709
|
-
const selectedIdRef = (0,
|
|
18837
|
+
const selectedIdRef = (0, import_react11.useRef)(null);
|
|
18710
18838
|
selectedIdRef.current = selectedId;
|
|
18711
|
-
(0,
|
|
18839
|
+
(0, import_react11.useEffect)(() => {
|
|
18712
18840
|
onSelectionChange?.(selectedId);
|
|
18713
18841
|
}, [selectedId, onSelectionChange]);
|
|
18714
|
-
const report = (0,
|
|
18842
|
+
const report = (0, import_react11.useCallback)(
|
|
18715
18843
|
(el) => {
|
|
18716
18844
|
const labelSrc = el ? sectionElementOf(el) : null;
|
|
18717
18845
|
postToParent2({
|
|
@@ -18722,7 +18850,7 @@ function AiSectionOverlay({
|
|
|
18722
18850
|
},
|
|
18723
18851
|
[postToParent2]
|
|
18724
18852
|
);
|
|
18725
|
-
const selectFromElement = (0,
|
|
18853
|
+
const selectFromElement = (0, import_react11.useCallback)(
|
|
18726
18854
|
(el, options) => {
|
|
18727
18855
|
const inner = el?.closest("[data-ohw-section]") ?? null;
|
|
18728
18856
|
const sectionEl = inner ? movableUnit(inner) : null;
|
|
@@ -18734,7 +18862,7 @@ function AiSectionOverlay({
|
|
|
18734
18862
|
},
|
|
18735
18863
|
[report]
|
|
18736
18864
|
);
|
|
18737
|
-
(0,
|
|
18865
|
+
(0, import_react11.useEffect)(() => {
|
|
18738
18866
|
apiRef.current = {
|
|
18739
18867
|
selectFromElement,
|
|
18740
18868
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
@@ -18759,7 +18887,7 @@ function AiSectionOverlay({
|
|
|
18759
18887
|
apiRef.current = null;
|
|
18760
18888
|
};
|
|
18761
18889
|
}, [apiRef, selectFromElement, report]);
|
|
18762
|
-
(0,
|
|
18890
|
+
(0, import_react11.useEffect)(() => {
|
|
18763
18891
|
const onMessage = (e) => {
|
|
18764
18892
|
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
18765
18893
|
selectedIdRef.current = null;
|
|
@@ -18784,9 +18912,9 @@ function AiSectionOverlay({
|
|
|
18784
18912
|
window.addEventListener("message", onMessage);
|
|
18785
18913
|
return () => window.removeEventListener("message", onMessage);
|
|
18786
18914
|
}, [postToParent2]);
|
|
18787
|
-
(0,
|
|
18788
|
-
const [hoveredId, setHoveredId] = (0,
|
|
18789
|
-
(0,
|
|
18915
|
+
(0, import_react11.useEffect)(() => installAiChangeHighlight(), []);
|
|
18916
|
+
const [hoveredId, setHoveredId] = (0, import_react11.useState)(null);
|
|
18917
|
+
(0, import_react11.useEffect)(() => {
|
|
18790
18918
|
const onMove = (e) => {
|
|
18791
18919
|
const t = e.target;
|
|
18792
18920
|
if (!(t instanceof Element)) return;
|
|
@@ -18811,7 +18939,7 @@ function AiSectionOverlay({
|
|
|
18811
18939
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
18812
18940
|
};
|
|
18813
18941
|
}, []);
|
|
18814
|
-
(0,
|
|
18942
|
+
(0, import_react11.useEffect)(() => {
|
|
18815
18943
|
const onKeyDown = (e) => {
|
|
18816
18944
|
if (e.key !== "Escape") return;
|
|
18817
18945
|
if (reviewIdRef.current) return;
|
|
@@ -18825,7 +18953,7 @@ function AiSectionOverlay({
|
|
|
18825
18953
|
document.addEventListener("keydown", onKeyDown);
|
|
18826
18954
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
18827
18955
|
}, [report]);
|
|
18828
|
-
const decide = (0,
|
|
18956
|
+
const decide = (0, import_react11.useCallback)(
|
|
18829
18957
|
(decision) => {
|
|
18830
18958
|
const sectionId = reviewIdRef.current;
|
|
18831
18959
|
if (!sectionId) return;
|
|
@@ -18834,8 +18962,8 @@ function AiSectionOverlay({
|
|
|
18834
18962
|
},
|
|
18835
18963
|
[postToParent2]
|
|
18836
18964
|
);
|
|
18837
|
-
const [navDropdownForceOpen, setNavDropdownForceOpen] = (0,
|
|
18838
|
-
(0,
|
|
18965
|
+
const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react11.useState)(false);
|
|
18966
|
+
(0, import_react11.useEffect)(() => {
|
|
18839
18967
|
const update = () => {
|
|
18840
18968
|
setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
|
|
18841
18969
|
};
|
|
@@ -18854,7 +18982,7 @@ function AiSectionOverlay({
|
|
|
18854
18982
|
const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
|
|
18855
18983
|
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
18856
18984
|
const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
|
|
18857
|
-
(0,
|
|
18985
|
+
(0, import_react11.useEffect)(() => {
|
|
18858
18986
|
const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
|
|
18859
18987
|
if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
|
|
18860
18988
|
postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
|
|
@@ -18974,7 +19102,7 @@ function AiSectionOverlay({
|
|
|
18974
19102
|
}
|
|
18975
19103
|
|
|
18976
19104
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18977
|
-
var
|
|
19105
|
+
var import_react12 = require("react");
|
|
18978
19106
|
var import_lucide_react9 = require("lucide-react");
|
|
18979
19107
|
|
|
18980
19108
|
// src/lib/ai-media-strip-tree.ts
|
|
@@ -19255,8 +19383,8 @@ function readStripRect(ref) {
|
|
|
19255
19383
|
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19256
19384
|
}
|
|
19257
19385
|
function useLiveItemRect(ref, strip = false) {
|
|
19258
|
-
const [rect, setRect] = (0,
|
|
19259
|
-
(0,
|
|
19386
|
+
const [rect, setRect] = (0, import_react12.useState)(null);
|
|
19387
|
+
(0, import_react12.useEffect)(() => {
|
|
19260
19388
|
if (!ref) {
|
|
19261
19389
|
setRect(null);
|
|
19262
19390
|
return;
|
|
@@ -19284,10 +19412,10 @@ var TOOLBAR_STRIP_GAP = 52;
|
|
|
19284
19412
|
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19285
19413
|
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19286
19414
|
function StripToolbarSlot({ stripRect, children }) {
|
|
19287
|
-
const slotRef = (0,
|
|
19288
|
-
const [shift, setShift] = (0,
|
|
19415
|
+
const slotRef = (0, import_react12.useRef)(null);
|
|
19416
|
+
const [shift, setShift] = (0, import_react12.useState)(0);
|
|
19289
19417
|
const centerX = stripRect.left + stripRect.width / 2;
|
|
19290
|
-
(0,
|
|
19418
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
19291
19419
|
const slot = slotRef.current;
|
|
19292
19420
|
if (!slot) return;
|
|
19293
19421
|
const clamp = () => {
|
|
@@ -19436,9 +19564,9 @@ function LinkModal({
|
|
|
19436
19564
|
onClose,
|
|
19437
19565
|
onSave
|
|
19438
19566
|
}) {
|
|
19439
|
-
const [draft, setDraft] = (0,
|
|
19440
|
-
const [newTab, setNewTab] = (0,
|
|
19441
|
-
const [invalid, setInvalid] = (0,
|
|
19567
|
+
const [draft, setDraft] = (0, import_react12.useState)(href);
|
|
19568
|
+
const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
|
|
19569
|
+
const [invalid, setInvalid] = (0, import_react12.useState)(false);
|
|
19442
19570
|
const save = () => {
|
|
19443
19571
|
const next = draft.trim();
|
|
19444
19572
|
if (next && !HTTP_URL_RE.test(next)) {
|
|
@@ -19647,17 +19775,17 @@ function AiMediaStripOverlay({
|
|
|
19647
19775
|
applyTreeLocalRef,
|
|
19648
19776
|
clearInteractionChromeRef
|
|
19649
19777
|
}) {
|
|
19650
|
-
const [hover, setHover] = (0,
|
|
19651
|
-
const [active, setActive] = (0,
|
|
19652
|
-
const [itemEditOn, setItemEditOn] = (0,
|
|
19653
|
-
const [linkOpen, setLinkOpen] = (0,
|
|
19654
|
-
const [pending, setPending] = (0,
|
|
19655
|
-
const [error, setError] = (0,
|
|
19656
|
-
const activeRef = (0,
|
|
19778
|
+
const [hover, setHover] = (0, import_react12.useState)(null);
|
|
19779
|
+
const [active, setActive] = (0, import_react12.useState)(null);
|
|
19780
|
+
const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
|
|
19781
|
+
const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
|
|
19782
|
+
const [pending, setPending] = (0, import_react12.useState)(false);
|
|
19783
|
+
const [error, setError] = (0, import_react12.useState)(null);
|
|
19784
|
+
const activeRef = (0, import_react12.useRef)(null);
|
|
19657
19785
|
activeRef.current = active;
|
|
19658
|
-
const linkOpenRef = (0,
|
|
19786
|
+
const linkOpenRef = (0, import_react12.useRef)(false);
|
|
19659
19787
|
linkOpenRef.current = linkOpen;
|
|
19660
|
-
(0,
|
|
19788
|
+
(0, import_react12.useEffect)(() => {
|
|
19661
19789
|
const onMove = (e) => {
|
|
19662
19790
|
const ref = itemRefFromTarget(e.target);
|
|
19663
19791
|
const t = e.target;
|
|
@@ -19675,7 +19803,7 @@ function AiMediaStripOverlay({
|
|
|
19675
19803
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19676
19804
|
};
|
|
19677
19805
|
}, []);
|
|
19678
|
-
(0,
|
|
19806
|
+
(0, import_react12.useEffect)(() => {
|
|
19679
19807
|
const onClick = (e) => {
|
|
19680
19808
|
const t = e.target;
|
|
19681
19809
|
if (!(t instanceof Element)) return;
|
|
@@ -19690,7 +19818,7 @@ function AiMediaStripOverlay({
|
|
|
19690
19818
|
document.addEventListener("click", onClick, true);
|
|
19691
19819
|
return () => document.removeEventListener("click", onClick, true);
|
|
19692
19820
|
}, [clearInteractionChromeRef]);
|
|
19693
|
-
(0,
|
|
19821
|
+
(0, import_react12.useEffect)(() => {
|
|
19694
19822
|
const onBlur = () => {
|
|
19695
19823
|
if (!activeRef.current) return;
|
|
19696
19824
|
setActive(null);
|
|
@@ -19701,7 +19829,7 @@ function AiMediaStripOverlay({
|
|
|
19701
19829
|
window.addEventListener("blur", onBlur);
|
|
19702
19830
|
return () => window.removeEventListener("blur", onBlur);
|
|
19703
19831
|
}, []);
|
|
19704
|
-
(0,
|
|
19832
|
+
(0, import_react12.useEffect)(() => {
|
|
19705
19833
|
const onKeyDown = (e) => {
|
|
19706
19834
|
if (e.key !== "Escape") return;
|
|
19707
19835
|
if (!activeRef.current) return;
|
|
@@ -19714,14 +19842,14 @@ function AiMediaStripOverlay({
|
|
|
19714
19842
|
document.addEventListener("keydown", onKeyDown);
|
|
19715
19843
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
19716
19844
|
}, []);
|
|
19717
|
-
const findEntry = (0,
|
|
19845
|
+
const findEntry = (0, import_react12.useCallback)(
|
|
19718
19846
|
(sectionId) => {
|
|
19719
19847
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
19720
19848
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
19721
19849
|
},
|
|
19722
19850
|
[aiSectionsRef]
|
|
19723
19851
|
);
|
|
19724
|
-
const runMutation = (0,
|
|
19852
|
+
const runMutation = (0, import_react12.useCallback)(
|
|
19725
19853
|
async (sectionId, mutate, extraMedia) => {
|
|
19726
19854
|
const entry = findEntry(sectionId);
|
|
19727
19855
|
if (!entry) return false;
|
|
@@ -19864,7 +19992,7 @@ function AiMediaStripOverlay({
|
|
|
19864
19992
|
}
|
|
19865
19993
|
|
|
19866
19994
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19867
|
-
var
|
|
19995
|
+
var import_react13 = require("react");
|
|
19868
19996
|
var import_lucide_react10 = require("lucide-react");
|
|
19869
19997
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
19870
19998
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
@@ -19907,8 +20035,8 @@ function readGridRect(ref) {
|
|
|
19907
20035
|
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19908
20036
|
}
|
|
19909
20037
|
function useLiveCardRect(ref, grid = false) {
|
|
19910
|
-
const [rect, setRect] = (0,
|
|
19911
|
-
(0,
|
|
20038
|
+
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
20039
|
+
(0, import_react13.useEffect)(() => {
|
|
19912
20040
|
if (!ref) {
|
|
19913
20041
|
setRect(null);
|
|
19914
20042
|
return;
|
|
@@ -19936,10 +20064,10 @@ var TOOLBAR_GRID_GAP = 52;
|
|
|
19936
20064
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19937
20065
|
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19938
20066
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19939
|
-
const slotRef = (0,
|
|
19940
|
-
const [shift, setShift] = (0,
|
|
20067
|
+
const slotRef = (0, import_react13.useRef)(null);
|
|
20068
|
+
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
19941
20069
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19942
|
-
(0,
|
|
20070
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
19943
20071
|
const slot = slotRef.current;
|
|
19944
20072
|
if (!slot) return;
|
|
19945
20073
|
const clamp = () => {
|
|
@@ -20196,13 +20324,13 @@ function AiPricingCardOverlay({
|
|
|
20196
20324
|
aiSectionsRef,
|
|
20197
20325
|
applyTreeLocalRef
|
|
20198
20326
|
}) {
|
|
20199
|
-
const [hover, setHover] = (0,
|
|
20200
|
-
const [active, setActive] = (0,
|
|
20201
|
-
const [pending, setPending] = (0,
|
|
20202
|
-
const [error, setError] = (0,
|
|
20203
|
-
const activeRef = (0,
|
|
20327
|
+
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
20328
|
+
const [active, setActive] = (0, import_react13.useState)(null);
|
|
20329
|
+
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
20330
|
+
const [error, setError] = (0, import_react13.useState)(null);
|
|
20331
|
+
const activeRef = (0, import_react13.useRef)(null);
|
|
20204
20332
|
activeRef.current = active;
|
|
20205
|
-
(0,
|
|
20333
|
+
(0, import_react13.useEffect)(() => {
|
|
20206
20334
|
const onMove = (e) => {
|
|
20207
20335
|
const ref = cardRefFromTarget(e.target);
|
|
20208
20336
|
const t = e.target;
|
|
@@ -20220,7 +20348,7 @@ function AiPricingCardOverlay({
|
|
|
20220
20348
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20221
20349
|
};
|
|
20222
20350
|
}, []);
|
|
20223
|
-
(0,
|
|
20351
|
+
(0, import_react13.useEffect)(() => {
|
|
20224
20352
|
const onClick = (e) => {
|
|
20225
20353
|
const t = e.target;
|
|
20226
20354
|
if (!(t instanceof Element)) return;
|
|
@@ -20232,7 +20360,7 @@ function AiPricingCardOverlay({
|
|
|
20232
20360
|
document.addEventListener("click", onClick, true);
|
|
20233
20361
|
return () => document.removeEventListener("click", onClick, true);
|
|
20234
20362
|
}, []);
|
|
20235
|
-
(0,
|
|
20363
|
+
(0, import_react13.useEffect)(() => {
|
|
20236
20364
|
const onBlur = () => {
|
|
20237
20365
|
if (!activeRef.current) return;
|
|
20238
20366
|
setActive(null);
|
|
@@ -20241,7 +20369,7 @@ function AiPricingCardOverlay({
|
|
|
20241
20369
|
window.addEventListener("blur", onBlur);
|
|
20242
20370
|
return () => window.removeEventListener("blur", onBlur);
|
|
20243
20371
|
}, []);
|
|
20244
|
-
(0,
|
|
20372
|
+
(0, import_react13.useEffect)(() => {
|
|
20245
20373
|
const onKeyDown = (e) => {
|
|
20246
20374
|
if (e.key !== "Escape") return;
|
|
20247
20375
|
if (!activeRef.current) return;
|
|
@@ -20252,14 +20380,14 @@ function AiPricingCardOverlay({
|
|
|
20252
20380
|
document.addEventListener("keydown", onKeyDown);
|
|
20253
20381
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
20254
20382
|
}, []);
|
|
20255
|
-
const findEntry = (0,
|
|
20383
|
+
const findEntry = (0, import_react13.useCallback)(
|
|
20256
20384
|
(sectionId) => {
|
|
20257
20385
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
20258
20386
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
20259
20387
|
},
|
|
20260
20388
|
[aiSectionsRef]
|
|
20261
20389
|
);
|
|
20262
|
-
const runMutation = (0,
|
|
20390
|
+
const runMutation = (0, import_react13.useCallback)(
|
|
20263
20391
|
async (sectionId, mutate) => {
|
|
20264
20392
|
const entry = findEntry(sectionId);
|
|
20265
20393
|
if (!entry) return false;
|
|
@@ -20346,7 +20474,7 @@ function AiPricingCardOverlay({
|
|
|
20346
20474
|
}
|
|
20347
20475
|
|
|
20348
20476
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20349
|
-
var
|
|
20477
|
+
var import_react14 = require("react");
|
|
20350
20478
|
var import_lucide_react11 = require("lucide-react");
|
|
20351
20479
|
|
|
20352
20480
|
// src/lib/ai-video-tree.ts
|
|
@@ -20411,8 +20539,8 @@ function readRect4(ref) {
|
|
|
20411
20539
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20412
20540
|
}
|
|
20413
20541
|
function useLiveBlockRect(ref) {
|
|
20414
|
-
const [rect, setRect] = (0,
|
|
20415
|
-
(0,
|
|
20542
|
+
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
20543
|
+
(0, import_react14.useEffect)(() => {
|
|
20416
20544
|
if (!ref) {
|
|
20417
20545
|
setRect(null);
|
|
20418
20546
|
return;
|
|
@@ -20490,9 +20618,9 @@ function watchUrl(id) {
|
|
|
20490
20618
|
return `https://www.youtube.com/watch?v=${id}`;
|
|
20491
20619
|
}
|
|
20492
20620
|
function VideoUrlInput({ value, onCommit }) {
|
|
20493
|
-
const [draft, setDraft] = (0,
|
|
20494
|
-
const [invalid, setInvalid] = (0,
|
|
20495
|
-
(0,
|
|
20621
|
+
const [draft, setDraft] = (0, import_react14.useState)(value ? watchUrl(value) : "");
|
|
20622
|
+
const [invalid, setInvalid] = (0, import_react14.useState)(false);
|
|
20623
|
+
(0, import_react14.useEffect)(() => {
|
|
20496
20624
|
setDraft(value ? watchUrl(value) : "");
|
|
20497
20625
|
setInvalid(false);
|
|
20498
20626
|
}, [value]);
|
|
@@ -20629,13 +20757,13 @@ function AiVideoOverlay({
|
|
|
20629
20757
|
applyTreeLocalRef,
|
|
20630
20758
|
clearInteractionChromeRef
|
|
20631
20759
|
}) {
|
|
20632
|
-
const [hover, setHover] = (0,
|
|
20633
|
-
const [active, setActive] = (0,
|
|
20634
|
-
const [pending, setPending] = (0,
|
|
20635
|
-
const [error, setError] = (0,
|
|
20636
|
-
const activeRef = (0,
|
|
20760
|
+
const [hover, setHover] = (0, import_react14.useState)(null);
|
|
20761
|
+
const [active, setActive] = (0, import_react14.useState)(null);
|
|
20762
|
+
const [pending, setPending] = (0, import_react14.useState)(false);
|
|
20763
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
20764
|
+
const activeRef = (0, import_react14.useRef)(null);
|
|
20637
20765
|
activeRef.current = active;
|
|
20638
|
-
(0,
|
|
20766
|
+
(0, import_react14.useEffect)(() => {
|
|
20639
20767
|
const onMove = (e) => {
|
|
20640
20768
|
const t = e.target;
|
|
20641
20769
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -20665,7 +20793,7 @@ function AiVideoOverlay({
|
|
|
20665
20793
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20666
20794
|
};
|
|
20667
20795
|
}, []);
|
|
20668
|
-
(0,
|
|
20796
|
+
(0, import_react14.useEffect)(() => {
|
|
20669
20797
|
const onClick = (e) => {
|
|
20670
20798
|
const current = activeRef.current;
|
|
20671
20799
|
if (!current) return;
|
|
@@ -20680,7 +20808,7 @@ function AiVideoOverlay({
|
|
|
20680
20808
|
document.addEventListener("click", onClick, true);
|
|
20681
20809
|
return () => document.removeEventListener("click", onClick, true);
|
|
20682
20810
|
}, []);
|
|
20683
|
-
(0,
|
|
20811
|
+
(0, import_react14.useEffect)(() => {
|
|
20684
20812
|
const onBlur = () => {
|
|
20685
20813
|
if (!activeRef.current) return;
|
|
20686
20814
|
setActive(null);
|
|
@@ -20689,7 +20817,7 @@ function AiVideoOverlay({
|
|
|
20689
20817
|
window.addEventListener("blur", onBlur);
|
|
20690
20818
|
return () => window.removeEventListener("blur", onBlur);
|
|
20691
20819
|
}, []);
|
|
20692
|
-
(0,
|
|
20820
|
+
(0, import_react14.useEffect)(() => {
|
|
20693
20821
|
const onKeyDown = (e) => {
|
|
20694
20822
|
if (e.key !== "Escape") return;
|
|
20695
20823
|
if (!activeRef.current) return;
|
|
@@ -20699,14 +20827,14 @@ function AiVideoOverlay({
|
|
|
20699
20827
|
document.addEventListener("keydown", onKeyDown);
|
|
20700
20828
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
20701
20829
|
}, []);
|
|
20702
|
-
const findEntry = (0,
|
|
20830
|
+
const findEntry = (0, import_react14.useCallback)(
|
|
20703
20831
|
(sectionId) => {
|
|
20704
20832
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
20705
20833
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
20706
20834
|
},
|
|
20707
20835
|
[aiSectionsRef]
|
|
20708
20836
|
);
|
|
20709
|
-
const runMutation = (0,
|
|
20837
|
+
const runMutation = (0, import_react14.useCallback)(
|
|
20710
20838
|
async (sectionId, mutate) => {
|
|
20711
20839
|
const entry = findEntry(sectionId);
|
|
20712
20840
|
if (!entry) return false;
|
|
@@ -20798,7 +20926,7 @@ function AiVideoOverlay({
|
|
|
20798
20926
|
}
|
|
20799
20927
|
|
|
20800
20928
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20801
|
-
var
|
|
20929
|
+
var import_react15 = require("react");
|
|
20802
20930
|
var import_lucide_react12 = require("lucide-react");
|
|
20803
20931
|
|
|
20804
20932
|
// src/lib/ai-carousel-tree.ts
|
|
@@ -20871,8 +20999,8 @@ function readRect5(ref) {
|
|
|
20871
20999
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20872
21000
|
}
|
|
20873
21001
|
function useLiveItemRect2(ref) {
|
|
20874
|
-
const [rect, setRect] = (0,
|
|
20875
|
-
(0,
|
|
21002
|
+
const [rect, setRect] = (0, import_react15.useState)(null);
|
|
21003
|
+
(0, import_react15.useEffect)(() => {
|
|
20876
21004
|
if (!ref) {
|
|
20877
21005
|
setRect(null);
|
|
20878
21006
|
return;
|
|
@@ -21079,19 +21207,19 @@ function AiFadeCarouselOverlay({
|
|
|
21079
21207
|
applyTreeLocalRef,
|
|
21080
21208
|
clearInteractionChromeRef
|
|
21081
21209
|
}) {
|
|
21082
|
-
const [hover, setHover] = (0,
|
|
21083
|
-
const [active, setActive] = (0,
|
|
21084
|
-
const [pending, setPending] = (0,
|
|
21085
|
-
const [error, setError] = (0,
|
|
21086
|
-
const [autoplayOverride, setAutoplayOverride] = (0,
|
|
21087
|
-
const [swapping, setSwapping] = (0,
|
|
21088
|
-
const skeletonRef = (0,
|
|
21089
|
-
const activeRef = (0,
|
|
21210
|
+
const [hover, setHover] = (0, import_react15.useState)(null);
|
|
21211
|
+
const [active, setActive] = (0, import_react15.useState)(null);
|
|
21212
|
+
const [pending, setPending] = (0, import_react15.useState)(false);
|
|
21213
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
21214
|
+
const [autoplayOverride, setAutoplayOverride] = (0, import_react15.useState)(null);
|
|
21215
|
+
const [swapping, setSwapping] = (0, import_react15.useState)(null);
|
|
21216
|
+
const skeletonRef = (0, import_react15.useRef)(null);
|
|
21217
|
+
const activeRef = (0, import_react15.useRef)(null);
|
|
21090
21218
|
activeRef.current = active;
|
|
21091
|
-
(0,
|
|
21219
|
+
(0, import_react15.useEffect)(() => {
|
|
21092
21220
|
setAutoplayOverride(null);
|
|
21093
21221
|
}, [active?.sectionId, active?.index]);
|
|
21094
|
-
(0,
|
|
21222
|
+
(0, import_react15.useEffect)(() => {
|
|
21095
21223
|
if (!swapping?.fadingOut || !skeletonRef.current) return;
|
|
21096
21224
|
const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
21097
21225
|
duration: MEDIA_UPLOAD_FADE_MS,
|
|
@@ -21101,7 +21229,7 @@ function AiFadeCarouselOverlay({
|
|
|
21101
21229
|
anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
|
|
21102
21230
|
return () => anim.cancel();
|
|
21103
21231
|
}, [swapping?.fadingOut]);
|
|
21104
|
-
(0,
|
|
21232
|
+
(0, import_react15.useEffect)(() => {
|
|
21105
21233
|
const onMove = (e) => {
|
|
21106
21234
|
const t = e.target;
|
|
21107
21235
|
if (!(t instanceof Element)) return;
|
|
@@ -21135,7 +21263,7 @@ function AiFadeCarouselOverlay({
|
|
|
21135
21263
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
21136
21264
|
};
|
|
21137
21265
|
}, []);
|
|
21138
|
-
(0,
|
|
21266
|
+
(0, import_react15.useEffect)(() => {
|
|
21139
21267
|
const onClick = (e) => {
|
|
21140
21268
|
const current = activeRef.current;
|
|
21141
21269
|
if (!current) return;
|
|
@@ -21150,7 +21278,7 @@ function AiFadeCarouselOverlay({
|
|
|
21150
21278
|
document.addEventListener("click", onClick, true);
|
|
21151
21279
|
return () => document.removeEventListener("click", onClick, true);
|
|
21152
21280
|
}, []);
|
|
21153
|
-
(0,
|
|
21281
|
+
(0, import_react15.useEffect)(() => {
|
|
21154
21282
|
const onBlur = () => {
|
|
21155
21283
|
if (!activeRef.current) return;
|
|
21156
21284
|
setActive(null);
|
|
@@ -21159,7 +21287,7 @@ function AiFadeCarouselOverlay({
|
|
|
21159
21287
|
window.addEventListener("blur", onBlur);
|
|
21160
21288
|
return () => window.removeEventListener("blur", onBlur);
|
|
21161
21289
|
}, []);
|
|
21162
|
-
(0,
|
|
21290
|
+
(0, import_react15.useEffect)(() => {
|
|
21163
21291
|
const onKeyDown = (e) => {
|
|
21164
21292
|
if (e.key !== "Escape") return;
|
|
21165
21293
|
if (!activeRef.current) return;
|
|
@@ -21169,14 +21297,14 @@ function AiFadeCarouselOverlay({
|
|
|
21169
21297
|
document.addEventListener("keydown", onKeyDown);
|
|
21170
21298
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
21171
21299
|
}, []);
|
|
21172
|
-
const findEntry = (0,
|
|
21300
|
+
const findEntry = (0, import_react15.useCallback)(
|
|
21173
21301
|
(sectionId) => {
|
|
21174
21302
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
21175
21303
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
21176
21304
|
},
|
|
21177
21305
|
[aiSectionsRef]
|
|
21178
21306
|
);
|
|
21179
|
-
const runMutation = (0,
|
|
21307
|
+
const runMutation = (0, import_react15.useCallback)(
|
|
21180
21308
|
async (sectionId, mutate, extraMedia) => {
|
|
21181
21309
|
const entry = findEntry(sectionId);
|
|
21182
21310
|
if (!entry) return false;
|
|
@@ -21313,7 +21441,7 @@ function AiFadeCarouselOverlay({
|
|
|
21313
21441
|
|
|
21314
21442
|
// src/OhhwellsBridge.tsx
|
|
21315
21443
|
var import_react_dom6 = require("react-dom");
|
|
21316
|
-
var
|
|
21444
|
+
var import_navigation4 = require("next/navigation");
|
|
21317
21445
|
|
|
21318
21446
|
// src/lib/media-overlay-guards.ts
|
|
21319
21447
|
var BRIDGE_CHROME_SELECTOR = [
|
|
@@ -21455,35 +21583,8 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21455
21583
|
return next;
|
|
21456
21584
|
}
|
|
21457
21585
|
|
|
21458
|
-
// src/lib/scroll-to-section.ts
|
|
21459
|
-
var MAX_ATTEMPTS = 12;
|
|
21460
|
-
var RETRY_MS = 100;
|
|
21461
|
-
function getHashSectionId() {
|
|
21462
|
-
if (typeof window === "undefined") return null;
|
|
21463
|
-
const id = window.location.hash.replace(/^#/, "").trim();
|
|
21464
|
-
return id || null;
|
|
21465
|
-
}
|
|
21466
|
-
function scrollToOhwSection(sectionId, behavior = "smooth") {
|
|
21467
|
-
if (!sectionId || typeof document === "undefined") return false;
|
|
21468
|
-
const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
21469
|
-
if (!el) return false;
|
|
21470
|
-
el.scrollIntoView({ behavior, block: "start" });
|
|
21471
|
-
return true;
|
|
21472
|
-
}
|
|
21473
|
-
function scrollToHashSectionWhenReady(behavior = "smooth") {
|
|
21474
|
-
const id = getHashSectionId();
|
|
21475
|
-
if (!id) return;
|
|
21476
|
-
let attempt = 0;
|
|
21477
|
-
const tick = () => {
|
|
21478
|
-
if (scrollToOhwSection(id, behavior)) return;
|
|
21479
|
-
attempt += 1;
|
|
21480
|
-
if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
|
|
21481
|
-
};
|
|
21482
|
-
tick();
|
|
21483
|
-
}
|
|
21484
|
-
|
|
21485
21586
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21486
|
-
var
|
|
21587
|
+
var import_react19 = require("react");
|
|
21487
21588
|
|
|
21488
21589
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21489
21590
|
var import_lucide_react16 = require("lucide-react");
|
|
@@ -21576,7 +21677,7 @@ function SectionTreeItem({
|
|
|
21576
21677
|
}
|
|
21577
21678
|
|
|
21578
21679
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21579
|
-
var
|
|
21680
|
+
var import_react16 = require("react");
|
|
21580
21681
|
|
|
21581
21682
|
// src/ui/input.tsx
|
|
21582
21683
|
var React10 = __toESM(require("react"), 1);
|
|
@@ -21644,11 +21745,11 @@ function UrlOrPageInput({
|
|
|
21644
21745
|
readOnly = false,
|
|
21645
21746
|
urlError
|
|
21646
21747
|
}) {
|
|
21647
|
-
const inputId = (0,
|
|
21648
|
-
const inputRef = (0,
|
|
21649
|
-
const rootRef = (0,
|
|
21650
|
-
const [isFocused, setIsFocused] = (0,
|
|
21651
|
-
(0,
|
|
21748
|
+
const inputId = (0, import_react16.useId)();
|
|
21749
|
+
const inputRef = (0, import_react16.useRef)(null);
|
|
21750
|
+
const rootRef = (0, import_react16.useRef)(null);
|
|
21751
|
+
const [isFocused, setIsFocused] = (0, import_react16.useState)(false);
|
|
21752
|
+
(0, import_react16.useEffect)(() => {
|
|
21652
21753
|
if (!dropdownOpen) return;
|
|
21653
21754
|
const isOutside = (e) => {
|
|
21654
21755
|
const root = rootRef.current;
|
|
@@ -21856,10 +21957,10 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21856
21957
|
}
|
|
21857
21958
|
|
|
21858
21959
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21859
|
-
var
|
|
21960
|
+
var import_react17 = require("react");
|
|
21860
21961
|
var import_react_dom4 = require("react-dom");
|
|
21861
21962
|
var import_lucide_react17 = require("lucide-react");
|
|
21862
|
-
var
|
|
21963
|
+
var import_navigation3 = require("next/navigation");
|
|
21863
21964
|
|
|
21864
21965
|
// src/lib/parent-scroll.ts
|
|
21865
21966
|
function visibleBand(parentScroll) {
|
|
@@ -21913,12 +22014,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
|
|
|
21913
22014
|
return null;
|
|
21914
22015
|
}
|
|
21915
22016
|
function useSectionRects(sectionIdsKey, enabled) {
|
|
21916
|
-
const [rects, setRects] = (0,
|
|
21917
|
-
const sectionIds = (0,
|
|
22017
|
+
const [rects, setRects] = (0, import_react17.useState)(/* @__PURE__ */ new Map());
|
|
22018
|
+
const sectionIds = (0, import_react17.useMemo)(
|
|
21918
22019
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
21919
22020
|
[sectionIdsKey]
|
|
21920
22021
|
);
|
|
21921
|
-
(0,
|
|
22022
|
+
(0, import_react17.useEffect)(() => {
|
|
21922
22023
|
if (!enabled || sectionIds.length === 0) {
|
|
21923
22024
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
21924
22025
|
return;
|
|
@@ -21957,15 +22058,15 @@ function SectionPickerOverlay({
|
|
|
21957
22058
|
onBack,
|
|
21958
22059
|
onSelect
|
|
21959
22060
|
}) {
|
|
21960
|
-
const router = (0,
|
|
21961
|
-
const pathname = (0,
|
|
21962
|
-
const [selectedId, setSelectedId] = (0,
|
|
21963
|
-
const [hoveredId, setHoveredId] = (0,
|
|
21964
|
-
const pointerRef = (0,
|
|
21965
|
-
const pointerScreenRef = (0,
|
|
21966
|
-
const iframeOffsetTopRef = (0,
|
|
21967
|
-
const sectionIdsRef = (0,
|
|
21968
|
-
const [chromeClip, setChromeClip] = (0,
|
|
22061
|
+
const router = (0, import_navigation3.useRouter)();
|
|
22062
|
+
const pathname = (0, import_navigation3.usePathname)();
|
|
22063
|
+
const [selectedId, setSelectedId] = (0, import_react17.useState)(null);
|
|
22064
|
+
const [hoveredId, setHoveredId] = (0, import_react17.useState)(null);
|
|
22065
|
+
const pointerRef = (0, import_react17.useRef)(null);
|
|
22066
|
+
const pointerScreenRef = (0, import_react17.useRef)(null);
|
|
22067
|
+
const iframeOffsetTopRef = (0, import_react17.useRef)(null);
|
|
22068
|
+
const sectionIdsRef = (0, import_react17.useRef)([]);
|
|
22069
|
+
const [chromeClip, setChromeClip] = (0, import_react17.useState)(
|
|
21969
22070
|
() => ({
|
|
21970
22071
|
top: 0,
|
|
21971
22072
|
bottom: typeof window !== "undefined" ? window.innerHeight : 0
|
|
@@ -21973,12 +22074,12 @@ function SectionPickerOverlay({
|
|
|
21973
22074
|
);
|
|
21974
22075
|
const normalizedTarget = normalizePath(pagePath);
|
|
21975
22076
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
21976
|
-
(0,
|
|
22077
|
+
(0, import_react17.useEffect)(() => {
|
|
21977
22078
|
if (isOnTargetPage) return;
|
|
21978
22079
|
const search = readPreservedSearch();
|
|
21979
22080
|
router.push(`${normalizedTarget}${search}`);
|
|
21980
22081
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
21981
|
-
(0,
|
|
22082
|
+
(0, import_react17.useEffect)(() => {
|
|
21982
22083
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
21983
22084
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
21984
22085
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -21990,24 +22091,24 @@ function SectionPickerOverlay({
|
|
|
21990
22091
|
document.documentElement.removeAttribute("data-ohw-section-picking");
|
|
21991
22092
|
};
|
|
21992
22093
|
}, []);
|
|
21993
|
-
const liveSections = (0,
|
|
22094
|
+
const liveSections = (0, import_react17.useMemo)(() => {
|
|
21994
22095
|
if (!isOnTargetPage) return sections;
|
|
21995
22096
|
const live = collectSectionsFromDom();
|
|
21996
22097
|
if (live.length === 0) return sections;
|
|
21997
22098
|
const labels = new Map(sections.map((s) => [s.id, s.label]));
|
|
21998
22099
|
return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
|
|
21999
22100
|
}, [isOnTargetPage, sections, pathname]);
|
|
22000
|
-
const sectionIdsKey = (0,
|
|
22101
|
+
const sectionIdsKey = (0, import_react17.useMemo)(
|
|
22001
22102
|
() => liveSections.map((s) => s.id).join("\0"),
|
|
22002
22103
|
[liveSections]
|
|
22003
22104
|
);
|
|
22004
|
-
const sectionIds = (0,
|
|
22105
|
+
const sectionIds = (0, import_react17.useMemo)(
|
|
22005
22106
|
() => liveSections.map((s) => s.id),
|
|
22006
22107
|
[liveSections]
|
|
22007
22108
|
);
|
|
22008
22109
|
sectionIdsRef.current = sectionIds;
|
|
22009
22110
|
const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
|
|
22010
|
-
const applyHoverAt = (0,
|
|
22111
|
+
const applyHoverAt = (0, import_react17.useCallback)(
|
|
22011
22112
|
(x, y, liveRects) => {
|
|
22012
22113
|
const ids = sectionIdsRef.current;
|
|
22013
22114
|
const map = liveRects ?? readSectionRects(ids);
|
|
@@ -22016,7 +22117,7 @@ function SectionPickerOverlay({
|
|
|
22016
22117
|
},
|
|
22017
22118
|
[]
|
|
22018
22119
|
);
|
|
22019
|
-
(0,
|
|
22120
|
+
(0, import_react17.useEffect)(() => {
|
|
22020
22121
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
|
|
22021
22122
|
const next = getIframeVisibleClip({
|
|
22022
22123
|
iframeOffsetTop,
|
|
@@ -22060,12 +22161,12 @@ function SectionPickerOverlay({
|
|
|
22060
22161
|
window.removeEventListener("resize", onResize);
|
|
22061
22162
|
};
|
|
22062
22163
|
}, [applyHoverAt]);
|
|
22063
|
-
(0,
|
|
22164
|
+
(0, import_react17.useEffect)(() => {
|
|
22064
22165
|
const ptr = pointerRef.current;
|
|
22065
22166
|
if (!ptr) return;
|
|
22066
22167
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
22067
22168
|
}, [rects, applyHoverAt]);
|
|
22068
|
-
(0,
|
|
22169
|
+
(0, import_react17.useEffect)(() => {
|
|
22069
22170
|
const rememberPointer = (clientX, clientY) => {
|
|
22070
22171
|
pointerRef.current = { x: clientX, y: clientY };
|
|
22071
22172
|
const top = iframeOffsetTopRef.current;
|
|
@@ -22089,7 +22190,7 @@ function SectionPickerOverlay({
|
|
|
22089
22190
|
window.removeEventListener("message", onPointerSync);
|
|
22090
22191
|
};
|
|
22091
22192
|
}, [rects, applyHoverAt]);
|
|
22092
|
-
const handleSelect = (0,
|
|
22193
|
+
const handleSelect = (0, import_react17.useCallback)(
|
|
22093
22194
|
(section) => {
|
|
22094
22195
|
if (selectedId) return;
|
|
22095
22196
|
setSelectedId(section.id);
|
|
@@ -22097,7 +22198,7 @@ function SectionPickerOverlay({
|
|
|
22097
22198
|
},
|
|
22098
22199
|
[selectedId, onSelect]
|
|
22099
22200
|
);
|
|
22100
|
-
(0,
|
|
22201
|
+
(0, import_react17.useEffect)(() => {
|
|
22101
22202
|
const onKeyDown = (e) => {
|
|
22102
22203
|
if (e.key === "Escape") {
|
|
22103
22204
|
e.preventDefault();
|
|
@@ -22220,7 +22321,7 @@ function SectionPickerOverlay({
|
|
|
22220
22321
|
}
|
|
22221
22322
|
|
|
22222
22323
|
// src/ui/link-modal/useLinkModalState.ts
|
|
22223
|
-
var
|
|
22324
|
+
var import_react18 = require("react");
|
|
22224
22325
|
function useLinkModalState({
|
|
22225
22326
|
open,
|
|
22226
22327
|
mode,
|
|
@@ -22232,14 +22333,14 @@ function useLinkModalState({
|
|
|
22232
22333
|
onClose,
|
|
22233
22334
|
onSubmit
|
|
22234
22335
|
}) {
|
|
22235
|
-
const availablePages = (0,
|
|
22236
|
-
const [searchValue, setSearchValue] = (0,
|
|
22237
|
-
const [selectedPage, setSelectedPage] = (0,
|
|
22238
|
-
const [selectedSection, setSelectedSection] = (0,
|
|
22239
|
-
const [step, setStep] = (0,
|
|
22240
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
22241
|
-
const [urlError, setUrlError] = (0,
|
|
22242
|
-
const reset = (0,
|
|
22336
|
+
const availablePages = (0, import_react18.useMemo)(() => pages, [pages]);
|
|
22337
|
+
const [searchValue, setSearchValue] = (0, import_react18.useState)("");
|
|
22338
|
+
const [selectedPage, setSelectedPage] = (0, import_react18.useState)(null);
|
|
22339
|
+
const [selectedSection, setSelectedSection] = (0, import_react18.useState)(null);
|
|
22340
|
+
const [step, setStep] = (0, import_react18.useState)("input");
|
|
22341
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react18.useState)(false);
|
|
22342
|
+
const [urlError, setUrlError] = (0, import_react18.useState)("");
|
|
22343
|
+
const reset = (0, import_react18.useCallback)(() => {
|
|
22243
22344
|
setSearchValue("");
|
|
22244
22345
|
setSelectedPage(null);
|
|
22245
22346
|
setSelectedSection(null);
|
|
@@ -22247,7 +22348,7 @@ function useLinkModalState({
|
|
|
22247
22348
|
setDropdownOpen(false);
|
|
22248
22349
|
setUrlError("");
|
|
22249
22350
|
}, []);
|
|
22250
|
-
(0,
|
|
22351
|
+
(0, import_react18.useEffect)(() => {
|
|
22251
22352
|
if (!open) return;
|
|
22252
22353
|
if (mode === "edit" && initialTarget) {
|
|
22253
22354
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -22263,11 +22364,11 @@ function useLinkModalState({
|
|
|
22263
22364
|
setDropdownOpen(false);
|
|
22264
22365
|
setUrlError("");
|
|
22265
22366
|
}, [open, mode, initialTarget, reset]);
|
|
22266
|
-
const filteredPages = (0,
|
|
22367
|
+
const filteredPages = (0, import_react18.useMemo)(() => {
|
|
22267
22368
|
if (!searchValue.trim()) return availablePages;
|
|
22268
22369
|
return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
|
|
22269
22370
|
}, [availablePages, searchValue]);
|
|
22270
|
-
const activeSections = (0,
|
|
22371
|
+
const activeSections = (0, import_react18.useMemo)(() => {
|
|
22271
22372
|
if (!selectedPage) return [];
|
|
22272
22373
|
return getSectionsForPath(sectionsByPath, selectedPage.path);
|
|
22273
22374
|
}, [selectedPage, sectionsByPath]);
|
|
@@ -22316,7 +22417,7 @@ function useLinkModalState({
|
|
|
22316
22417
|
reset();
|
|
22317
22418
|
onClose();
|
|
22318
22419
|
};
|
|
22319
|
-
const isValid = (0,
|
|
22420
|
+
const isValid = (0, import_react18.useMemo)(() => {
|
|
22320
22421
|
if (urlError) return false;
|
|
22321
22422
|
if (showBreadcrumb) return true;
|
|
22322
22423
|
if (selectedPage) return true;
|
|
@@ -22413,7 +22514,7 @@ function LinkPopover({
|
|
|
22413
22514
|
onSubmit
|
|
22414
22515
|
});
|
|
22415
22516
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
22416
|
-
(0,
|
|
22517
|
+
(0, import_react19.useEffect)(() => {
|
|
22417
22518
|
if (!open) return;
|
|
22418
22519
|
if (sectionPickerActive) {
|
|
22419
22520
|
postToParent({ type: "ui:unlock" });
|
|
@@ -22655,7 +22756,7 @@ function addFooterColumnWithPersist({
|
|
|
22655
22756
|
}
|
|
22656
22757
|
|
|
22657
22758
|
// src/ui/FloatingPanel.tsx
|
|
22658
|
-
var
|
|
22759
|
+
var import_react20 = require("react");
|
|
22659
22760
|
var import_lucide_react18 = require("lucide-react");
|
|
22660
22761
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
22661
22762
|
var PANEL_WIDTH = 256;
|
|
@@ -22717,10 +22818,10 @@ function FloatingPanel({
|
|
|
22717
22818
|
className,
|
|
22718
22819
|
bodyClassName
|
|
22719
22820
|
}) {
|
|
22720
|
-
const panelRef = (0,
|
|
22721
|
-
const [measured, setMeasured] = (0,
|
|
22722
|
-
const dragRef = (0,
|
|
22723
|
-
const homeRef = (0,
|
|
22821
|
+
const panelRef = (0, import_react20.useRef)(null);
|
|
22822
|
+
const [measured, setMeasured] = (0, import_react20.useState)({ w: PANEL_WIDTH, h: 280 });
|
|
22823
|
+
const dragRef = (0, import_react20.useRef)(null);
|
|
22824
|
+
const homeRef = (0, import_react20.useRef)(null);
|
|
22724
22825
|
if (!open) {
|
|
22725
22826
|
homeRef.current = null;
|
|
22726
22827
|
} else if (position) {
|
|
@@ -22728,17 +22829,17 @@ function FloatingPanel({
|
|
|
22728
22829
|
} else if (homeRef.current == null) {
|
|
22729
22830
|
homeRef.current = defaultFloatingPanelPosition(parentScroll);
|
|
22730
22831
|
}
|
|
22731
|
-
const [liveScroll, setLiveScroll] = (0,
|
|
22832
|
+
const [liveScroll, setLiveScroll] = (0, import_react20.useState)(parentScroll);
|
|
22732
22833
|
const home = position ?? homeRef.current ?? defaultFloatingPanelPosition(parentScroll);
|
|
22733
22834
|
const { y: fittedY, maxHeight } = fitPanelInClip(home.y, liveScroll, measured.h);
|
|
22734
22835
|
const clamped = {
|
|
22735
22836
|
x: clampX(home.x, measured.w),
|
|
22736
22837
|
y: fittedY
|
|
22737
22838
|
};
|
|
22738
|
-
(0,
|
|
22839
|
+
(0, import_react20.useEffect)(() => {
|
|
22739
22840
|
setLiveScroll(parentScroll);
|
|
22740
22841
|
}, [parentScroll]);
|
|
22741
|
-
(0,
|
|
22842
|
+
(0, import_react20.useEffect)(() => {
|
|
22742
22843
|
if (!open) return;
|
|
22743
22844
|
const onParentScroll = (e) => {
|
|
22744
22845
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
@@ -22748,8 +22849,8 @@ function FloatingPanel({
|
|
|
22748
22849
|
window.addEventListener("message", onParentScroll);
|
|
22749
22850
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22750
22851
|
}, [open]);
|
|
22751
|
-
const positionRef = (0,
|
|
22752
|
-
(0,
|
|
22852
|
+
const positionRef = (0, import_react20.useRef)(position);
|
|
22853
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
22753
22854
|
if (!open) {
|
|
22754
22855
|
positionRef.current = position;
|
|
22755
22856
|
return;
|
|
@@ -22759,7 +22860,7 @@ function FloatingPanel({
|
|
|
22759
22860
|
}
|
|
22760
22861
|
positionRef.current = position;
|
|
22761
22862
|
}, [open, position, liveScroll, parentScroll]);
|
|
22762
|
-
(0,
|
|
22863
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
22763
22864
|
if (!open || !panelRef.current) return;
|
|
22764
22865
|
const el = panelRef.current;
|
|
22765
22866
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22768,7 +22869,7 @@ function FloatingPanel({
|
|
|
22768
22869
|
const next = { w: el.offsetWidth || PANEL_WIDTH, h: contentH };
|
|
22769
22870
|
setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
|
|
22770
22871
|
}, [open, children, title, context]);
|
|
22771
|
-
const onHeaderPointerDown = (0,
|
|
22872
|
+
const onHeaderPointerDown = (0, import_react20.useCallback)(
|
|
22772
22873
|
(e) => {
|
|
22773
22874
|
if (e.button !== 0) return;
|
|
22774
22875
|
if (e.target.closest("[data-ohw-floating-panel-close]")) return;
|
|
@@ -22787,7 +22888,7 @@ function FloatingPanel({
|
|
|
22787
22888
|
},
|
|
22788
22889
|
[clamped.x, clamped.y]
|
|
22789
22890
|
);
|
|
22790
|
-
const onHeaderPointerMove = (0,
|
|
22891
|
+
const onHeaderPointerMove = (0, import_react20.useCallback)(
|
|
22791
22892
|
(e) => {
|
|
22792
22893
|
const drag = dragRef.current;
|
|
22793
22894
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
@@ -22813,7 +22914,7 @@ function FloatingPanel({
|
|
|
22813
22914
|
},
|
|
22814
22915
|
[measured.w, onPositionChange, liveScroll]
|
|
22815
22916
|
);
|
|
22816
|
-
const endDrag = (0,
|
|
22917
|
+
const endDrag = (0, import_react20.useCallback)((e) => {
|
|
22817
22918
|
const drag = dragRef.current;
|
|
22818
22919
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
22819
22920
|
dragRef.current = null;
|
|
@@ -22823,11 +22924,11 @@ function FloatingPanel({
|
|
|
22823
22924
|
} catch {
|
|
22824
22925
|
}
|
|
22825
22926
|
}, []);
|
|
22826
|
-
(0,
|
|
22927
|
+
(0, import_react20.useEffect)(() => {
|
|
22827
22928
|
if (open) return;
|
|
22828
22929
|
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22829
22930
|
}, [open]);
|
|
22830
|
-
(0,
|
|
22931
|
+
(0, import_react20.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
|
|
22831
22932
|
if (!open) return null;
|
|
22832
22933
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
22833
22934
|
"div",
|
|
@@ -23347,7 +23448,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
|
|
|
23347
23448
|
}
|
|
23348
23449
|
|
|
23349
23450
|
// src/useNavItemDrag.ts
|
|
23350
|
-
var
|
|
23451
|
+
var import_react21 = require("react");
|
|
23351
23452
|
function useNavItemDrag({
|
|
23352
23453
|
isEditMode,
|
|
23353
23454
|
editContentRef,
|
|
@@ -23371,11 +23472,11 @@ function useNavItemDrag({
|
|
|
23371
23472
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
23372
23473
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
23373
23474
|
}) {
|
|
23374
|
-
const navDragRef = (0,
|
|
23375
|
-
const [navDropSlots, setNavDropSlots] = (0,
|
|
23376
|
-
const [activeNavDropIndex, setActiveNavDropIndex] = (0,
|
|
23377
|
-
const navPointerDragRef = (0,
|
|
23378
|
-
const clearNavDragVisuals = (0,
|
|
23475
|
+
const navDragRef = (0, import_react21.useRef)(null);
|
|
23476
|
+
const [navDropSlots, setNavDropSlots] = (0, import_react21.useState)([]);
|
|
23477
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react21.useState)(null);
|
|
23478
|
+
const navPointerDragRef = (0, import_react21.useRef)(null);
|
|
23479
|
+
const clearNavDragVisuals = (0, import_react21.useCallback)(() => {
|
|
23379
23480
|
const session = navDragRef.current;
|
|
23380
23481
|
const nestedHrefKey = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.hrefKey : null;
|
|
23381
23482
|
navDragRef.current = null;
|
|
@@ -23408,7 +23509,7 @@ function useNavItemDrag({
|
|
|
23408
23509
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
23409
23510
|
unlockItemDragInteraction();
|
|
23410
23511
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
23411
|
-
const refreshNavDragVisuals = (0,
|
|
23512
|
+
const refreshNavDragVisuals = (0, import_react21.useCallback)(
|
|
23412
23513
|
(session, activeSlot, clientX, clientY) => {
|
|
23413
23514
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
23414
23515
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -23426,13 +23527,13 @@ function useNavItemDrag({
|
|
|
23426
23527
|
},
|
|
23427
23528
|
[setDraggedItemRect, setSiblingHintRects]
|
|
23428
23529
|
);
|
|
23429
|
-
const refreshNavDragVisualsRef = (0,
|
|
23530
|
+
const refreshNavDragVisualsRef = (0, import_react21.useRef)(refreshNavDragVisuals);
|
|
23430
23531
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
23431
|
-
const commitNavDragRef = (0,
|
|
23532
|
+
const commitNavDragRef = (0, import_react21.useRef)(() => {
|
|
23432
23533
|
});
|
|
23433
|
-
const beginNavDragRef = (0,
|
|
23534
|
+
const beginNavDragRef = (0, import_react21.useRef)(() => {
|
|
23434
23535
|
});
|
|
23435
|
-
const beginNavDrag = (0,
|
|
23536
|
+
const beginNavDrag = (0, import_react21.useCallback)(
|
|
23436
23537
|
(session) => {
|
|
23437
23538
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
23438
23539
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -23471,7 +23572,7 @@ function useNavItemDrag({
|
|
|
23471
23572
|
]
|
|
23472
23573
|
);
|
|
23473
23574
|
beginNavDragRef.current = beginNavDrag;
|
|
23474
|
-
const commitNavDrag = (0,
|
|
23575
|
+
const commitNavDrag = (0, import_react21.useCallback)(
|
|
23475
23576
|
(clientX, clientY) => {
|
|
23476
23577
|
const session = navDragRef.current;
|
|
23477
23578
|
if (!session) {
|
|
@@ -23550,7 +23651,7 @@ function useNavItemDrag({
|
|
|
23550
23651
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
23551
23652
|
);
|
|
23552
23653
|
commitNavDragRef.current = commitNavDrag;
|
|
23553
|
-
const startNavLinkDrag = (0,
|
|
23654
|
+
const startNavLinkDrag = (0, import_react21.useCallback)(
|
|
23554
23655
|
(anchor, clientX, clientY, wasSelected) => {
|
|
23555
23656
|
if (footerDragRef.current) return false;
|
|
23556
23657
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -23568,7 +23669,7 @@ function useNavItemDrag({
|
|
|
23568
23669
|
},
|
|
23569
23670
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
23570
23671
|
);
|
|
23571
|
-
const onNavDragOver = (0,
|
|
23672
|
+
const onNavDragOver = (0, import_react21.useCallback)(
|
|
23572
23673
|
(e) => {
|
|
23573
23674
|
const session = navDragRef.current;
|
|
23574
23675
|
if (!session) return false;
|
|
@@ -23580,7 +23681,7 @@ function useNavItemDrag({
|
|
|
23580
23681
|
},
|
|
23581
23682
|
[]
|
|
23582
23683
|
);
|
|
23583
|
-
(0,
|
|
23684
|
+
(0, import_react21.useEffect)(() => {
|
|
23584
23685
|
if (!isEditMode) return;
|
|
23585
23686
|
const THRESHOLD = 10;
|
|
23586
23687
|
const resolveWasSelected = (el) => {
|
|
@@ -23707,7 +23808,7 @@ function useNavItemDrag({
|
|
|
23707
23808
|
setLinkPopover,
|
|
23708
23809
|
suppressNextClickRef
|
|
23709
23810
|
]);
|
|
23710
|
-
const armNavPressFromChrome = (0,
|
|
23811
|
+
const armNavPressFromChrome = (0, import_react21.useCallback)(
|
|
23711
23812
|
(selected, clientX, clientY, pointerId) => {
|
|
23712
23813
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
23713
23814
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -23739,7 +23840,7 @@ function useNavItemDrag({
|
|
|
23739
23840
|
}
|
|
23740
23841
|
|
|
23741
23842
|
// src/useSectionDrag.ts
|
|
23742
|
-
var
|
|
23843
|
+
var import_react22 = require("react");
|
|
23743
23844
|
|
|
23744
23845
|
// src/lib/section-dnd.ts
|
|
23745
23846
|
function isFooterSection(el) {
|
|
@@ -23832,21 +23933,21 @@ function useSectionDrag({
|
|
|
23832
23933
|
suppressNextClickRef,
|
|
23833
23934
|
suppressClickUntilRef
|
|
23834
23935
|
}) {
|
|
23835
|
-
const sectionDragRef = (0,
|
|
23836
|
-
const [sectionDropSlots, setSectionDropSlots] = (0,
|
|
23837
|
-
const [activeSectionDropIndex, setActiveSectionDropIndex] = (0,
|
|
23838
|
-
const [isSectionDragging, setIsSectionDragging] = (0,
|
|
23839
|
-
const sectionPointerDragRef = (0,
|
|
23840
|
-
const autoScrollRafRef = (0,
|
|
23841
|
-
const autoScrollDeltaRef = (0,
|
|
23842
|
-
const stopAutoScroll = (0,
|
|
23936
|
+
const sectionDragRef = (0, import_react22.useRef)(null);
|
|
23937
|
+
const [sectionDropSlots, setSectionDropSlots] = (0, import_react22.useState)([]);
|
|
23938
|
+
const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react22.useState)(null);
|
|
23939
|
+
const [isSectionDragging, setIsSectionDragging] = (0, import_react22.useState)(false);
|
|
23940
|
+
const sectionPointerDragRef = (0, import_react22.useRef)(null);
|
|
23941
|
+
const autoScrollRafRef = (0, import_react22.useRef)(null);
|
|
23942
|
+
const autoScrollDeltaRef = (0, import_react22.useRef)(0);
|
|
23943
|
+
const stopAutoScroll = (0, import_react22.useCallback)(() => {
|
|
23843
23944
|
if (autoScrollRafRef.current != null) {
|
|
23844
23945
|
cancelAnimationFrame(autoScrollRafRef.current);
|
|
23845
23946
|
autoScrollRafRef.current = null;
|
|
23846
23947
|
}
|
|
23847
23948
|
autoScrollDeltaRef.current = 0;
|
|
23848
23949
|
}, []);
|
|
23849
|
-
const tickAutoScroll = (0,
|
|
23950
|
+
const tickAutoScroll = (0, import_react22.useCallback)(() => {
|
|
23850
23951
|
if (!sectionDragRef.current) {
|
|
23851
23952
|
stopAutoScroll();
|
|
23852
23953
|
return;
|
|
@@ -23856,7 +23957,7 @@ function useSectionDrag({
|
|
|
23856
23957
|
}
|
|
23857
23958
|
autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
|
|
23858
23959
|
}, [postToParentRef, stopAutoScroll]);
|
|
23859
|
-
const updateAutoScroll = (0,
|
|
23960
|
+
const updateAutoScroll = (0, import_react22.useCallback)(
|
|
23860
23961
|
(clientY) => {
|
|
23861
23962
|
const clip = getIframeChromeClip(parentScrollRef.current);
|
|
23862
23963
|
let delta = 0;
|
|
@@ -23878,7 +23979,7 @@ function useSectionDrag({
|
|
|
23878
23979
|
},
|
|
23879
23980
|
[parentScrollRef, stopAutoScroll, tickAutoScroll]
|
|
23880
23981
|
);
|
|
23881
|
-
const clearSectionDragVisuals = (0,
|
|
23982
|
+
const clearSectionDragVisuals = (0, import_react22.useCallback)(() => {
|
|
23882
23983
|
sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
|
|
23883
23984
|
sectionDragRef.current = null;
|
|
23884
23985
|
setSectionDropSlots([]);
|
|
@@ -23888,7 +23989,7 @@ function useSectionDrag({
|
|
|
23888
23989
|
document.documentElement.removeAttribute("data-ohw-section-dragging-root");
|
|
23889
23990
|
unlockItemDragInteraction();
|
|
23890
23991
|
}, [stopAutoScroll]);
|
|
23891
|
-
const refreshSectionDragVisuals = (0,
|
|
23992
|
+
const refreshSectionDragVisuals = (0, import_react22.useCallback)(
|
|
23892
23993
|
(session, clientX, clientY) => {
|
|
23893
23994
|
session.lastClientX = clientX;
|
|
23894
23995
|
session.lastClientY = clientY;
|
|
@@ -23902,7 +24003,7 @@ function useSectionDrag({
|
|
|
23902
24003
|
},
|
|
23903
24004
|
[updateAutoScroll]
|
|
23904
24005
|
);
|
|
23905
|
-
const beginSectionDrag = (0,
|
|
24006
|
+
const beginSectionDrag = (0, import_react22.useCallback)(
|
|
23906
24007
|
(session) => {
|
|
23907
24008
|
sectionDragRef.current = session;
|
|
23908
24009
|
setIsSectionDragging(true);
|
|
@@ -23913,7 +24014,7 @@ function useSectionDrag({
|
|
|
23913
24014
|
},
|
|
23914
24015
|
[refreshSectionDragVisuals]
|
|
23915
24016
|
);
|
|
23916
|
-
const commitSectionDrag = (0,
|
|
24017
|
+
const commitSectionDrag = (0, import_react22.useCallback)(() => {
|
|
23917
24018
|
const session = sectionDragRef.current;
|
|
23918
24019
|
if (!session) {
|
|
23919
24020
|
clearSectionDragVisuals();
|
|
@@ -23942,7 +24043,7 @@ function useSectionDrag({
|
|
|
23942
24043
|
});
|
|
23943
24044
|
});
|
|
23944
24045
|
}, [clearSectionDragVisuals, editContentRef, postToParentRef]);
|
|
23945
|
-
const startSectionPressDrag = (0,
|
|
24046
|
+
const startSectionPressDrag = (0, import_react22.useCallback)(
|
|
23946
24047
|
(el, clientX, clientY, pointerId) => {
|
|
23947
24048
|
if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
|
|
23948
24049
|
const instanceId = instanceIdOf(el);
|
|
@@ -23959,7 +24060,7 @@ function useSectionDrag({
|
|
|
23959
24060
|
},
|
|
23960
24061
|
[footerDragRef, navDragRef]
|
|
23961
24062
|
);
|
|
23962
|
-
(0,
|
|
24063
|
+
(0, import_react22.useEffect)(() => {
|
|
23963
24064
|
if (!isEditMode) return;
|
|
23964
24065
|
const onPointerDown = (e) => {
|
|
23965
24066
|
if (e.button !== 0) return;
|
|
@@ -25737,9 +25838,9 @@ function FloatingToolbar({
|
|
|
25737
25838
|
showEditLink,
|
|
25738
25839
|
onEditLink
|
|
25739
25840
|
}) {
|
|
25740
|
-
const localRef =
|
|
25741
|
-
const [measuredW, setMeasuredW] =
|
|
25742
|
-
const setRefs =
|
|
25841
|
+
const localRef = import_react23.default.useRef(null);
|
|
25842
|
+
const [measuredW, setMeasuredW] = import_react23.default.useState(330);
|
|
25843
|
+
const setRefs = import_react23.default.useCallback(
|
|
25743
25844
|
(node) => {
|
|
25744
25845
|
localRef.current = node;
|
|
25745
25846
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -25751,7 +25852,7 @@ function FloatingToolbar({
|
|
|
25751
25852
|
},
|
|
25752
25853
|
[elRef]
|
|
25753
25854
|
);
|
|
25754
|
-
|
|
25855
|
+
import_react23.default.useLayoutEffect(() => {
|
|
25755
25856
|
const node = localRef.current;
|
|
25756
25857
|
if (!node) return;
|
|
25757
25858
|
const update = () => {
|
|
@@ -25777,7 +25878,7 @@ function FloatingToolbar({
|
|
|
25777
25878
|
pointerEvents: "auto"
|
|
25778
25879
|
},
|
|
25779
25880
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
|
|
25780
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
25881
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
|
|
25781
25882
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
25782
25883
|
btns.map((btn) => {
|
|
25783
25884
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -25982,12 +26083,12 @@ function resolveSubdomain(subdomainFromQuery) {
|
|
|
25982
26083
|
return "";
|
|
25983
26084
|
}
|
|
25984
26085
|
function OhhwellsBridge() {
|
|
25985
|
-
const pathname = (0,
|
|
25986
|
-
const router = (0,
|
|
25987
|
-
const searchParams = (0,
|
|
26086
|
+
const pathname = (0, import_navigation4.usePathname)();
|
|
26087
|
+
const router = (0, import_navigation4.useRouter)();
|
|
26088
|
+
const searchParams = (0, import_navigation4.useSearchParams)();
|
|
25988
26089
|
const isEditMode = isEditSessionActive();
|
|
25989
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
25990
|
-
(0,
|
|
26090
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
|
|
26091
|
+
(0, import_react23.useEffect)(() => {
|
|
25991
26092
|
const figtreeFontId = "ohw-figtree-font";
|
|
25992
26093
|
if (!document.getElementById(figtreeFontId)) {
|
|
25993
26094
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -26013,8 +26114,8 @@ function OhhwellsBridge() {
|
|
|
26013
26114
|
};
|
|
26014
26115
|
}, []);
|
|
26015
26116
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26016
|
-
const [subdomain, setSubdomain] = (0,
|
|
26017
|
-
(0,
|
|
26117
|
+
const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
26118
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
26018
26119
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26019
26120
|
if (next !== subdomain) setSubdomain(next);
|
|
26020
26121
|
if (next) return;
|
|
@@ -26026,7 +26127,7 @@ function OhhwellsBridge() {
|
|
|
26026
26127
|
}, 0);
|
|
26027
26128
|
return () => window.clearTimeout(t);
|
|
26028
26129
|
}, [subdomainFromQuery, subdomain]);
|
|
26029
|
-
(0,
|
|
26130
|
+
(0, import_react23.useEffect)(() => {
|
|
26030
26131
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
26031
26132
|
const url = new URL(window.location.href);
|
|
26032
26133
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -26036,22 +26137,24 @@ function OhhwellsBridge() {
|
|
|
26036
26137
|
}, [subdomainFromQuery]);
|
|
26037
26138
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
26038
26139
|
useSavedLinkNavigation(isEditMode);
|
|
26039
|
-
|
|
26140
|
+
useNavDropdownToggle(isEditMode);
|
|
26141
|
+
useHashLinkScroll(isEditMode);
|
|
26142
|
+
const postToParent2 = (0, import_react23.useCallback)((data) => {
|
|
26040
26143
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
26041
26144
|
window.parent.postMessage(data, "*");
|
|
26042
26145
|
}
|
|
26043
26146
|
}, []);
|
|
26044
|
-
const [fetchState, setFetchState] = (0,
|
|
26045
|
-
const [showBranding, setShowBranding] = (0,
|
|
26046
|
-
const autoSaveTimers = (0,
|
|
26047
|
-
(0,
|
|
26147
|
+
const [fetchState, setFetchState] = (0, import_react23.useState)("idle");
|
|
26148
|
+
const [showBranding, setShowBranding] = (0, import_react23.useState)(false);
|
|
26149
|
+
const autoSaveTimers = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
|
|
26150
|
+
(0, import_react23.useEffect)(() => {
|
|
26048
26151
|
stampBridgeVersionOnDocument();
|
|
26049
26152
|
}, []);
|
|
26050
|
-
(0,
|
|
26153
|
+
(0, import_react23.useEffect)(() => {
|
|
26051
26154
|
if (isEditMode) return;
|
|
26052
26155
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
26053
26156
|
}, [isEditMode, subdomain, fetchState]);
|
|
26054
|
-
(0,
|
|
26157
|
+
(0, import_react23.useEffect)(() => {
|
|
26055
26158
|
if (isEditMode || !subdomain) return;
|
|
26056
26159
|
const onError = (event) => {
|
|
26057
26160
|
reportOutageBeacon({
|
|
@@ -26072,40 +26175,40 @@ function OhhwellsBridge() {
|
|
|
26072
26175
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
26073
26176
|
};
|
|
26074
26177
|
}, [isEditMode, subdomain]);
|
|
26075
|
-
const activeElRef = (0,
|
|
26076
|
-
const pointerHeldRef = (0,
|
|
26077
|
-
const selectedElRef = (0,
|
|
26078
|
-
const selectedHrefKeyRef = (0,
|
|
26079
|
-
const selectedFooterColAttrRef = (0,
|
|
26080
|
-
const footerHeadingTitleCacheRef = (0,
|
|
26081
|
-
const originalContentRef = (0,
|
|
26082
|
-
const activeStateElRef = (0,
|
|
26083
|
-
const parentScrollRef = (0,
|
|
26084
|
-
const visibleViewportRef = (0,
|
|
26085
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
26086
|
-
const attachVisibleViewport = (0,
|
|
26178
|
+
const activeElRef = (0, import_react23.useRef)(null);
|
|
26179
|
+
const pointerHeldRef = (0, import_react23.useRef)(false);
|
|
26180
|
+
const selectedElRef = (0, import_react23.useRef)(null);
|
|
26181
|
+
const selectedHrefKeyRef = (0, import_react23.useRef)(null);
|
|
26182
|
+
const selectedFooterColAttrRef = (0, import_react23.useRef)(null);
|
|
26183
|
+
const footerHeadingTitleCacheRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
|
|
26184
|
+
const originalContentRef = (0, import_react23.useRef)(null);
|
|
26185
|
+
const activeStateElRef = (0, import_react23.useRef)(null);
|
|
26186
|
+
const parentScrollRef = (0, import_react23.useRef)(null);
|
|
26187
|
+
const visibleViewportRef = (0, import_react23.useRef)(null);
|
|
26188
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react23.useState)(null);
|
|
26189
|
+
const attachVisibleViewport = (0, import_react23.useCallback)((node) => {
|
|
26087
26190
|
visibleViewportRef.current = node;
|
|
26088
26191
|
setDialogPortalContainer(node);
|
|
26089
26192
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
26090
26193
|
}, []);
|
|
26091
|
-
const toolbarElRef = (0,
|
|
26092
|
-
const glowElRef = (0,
|
|
26093
|
-
const hoveredImageRef = (0,
|
|
26094
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
26095
|
-
const dragOverElRef = (0,
|
|
26096
|
-
const [mediaHover, setMediaHover] = (0,
|
|
26097
|
-
const [selectedAiSectionId, setSelectedAiSectionId] = (0,
|
|
26098
|
-
const selectedAiSectionIdRef = (0,
|
|
26099
|
-
const handleAiSectionSelectionChange = (0,
|
|
26194
|
+
const toolbarElRef = (0, import_react23.useRef)(null);
|
|
26195
|
+
const glowElRef = (0, import_react23.useRef)(null);
|
|
26196
|
+
const hoveredImageRef = (0, import_react23.useRef)(null);
|
|
26197
|
+
const hoveredImageHasTextOverlapRef = (0, import_react23.useRef)(false);
|
|
26198
|
+
const dragOverElRef = (0, import_react23.useRef)(null);
|
|
26199
|
+
const [mediaHover, setMediaHover] = (0, import_react23.useState)(null);
|
|
26200
|
+
const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react23.useState)(null);
|
|
26201
|
+
const selectedAiSectionIdRef = (0, import_react23.useRef)(null);
|
|
26202
|
+
const handleAiSectionSelectionChange = (0, import_react23.useCallback)((id) => {
|
|
26100
26203
|
selectedAiSectionIdRef.current = id;
|
|
26101
26204
|
setSelectedAiSectionId(id);
|
|
26102
26205
|
}, []);
|
|
26103
|
-
const [selectedMedia, setSelectedMedia] = (0,
|
|
26104
|
-
const selectedMediaElRef = (0,
|
|
26105
|
-
const mediaKeyDropTokenRef = (0,
|
|
26106
|
-
const selectedIconElRef = (0,
|
|
26107
|
-
const selectedSocialElRef = (0,
|
|
26108
|
-
const queueSectionKeyDrop = (0,
|
|
26206
|
+
const [selectedMedia, setSelectedMedia] = (0, import_react23.useState)(null);
|
|
26207
|
+
const selectedMediaElRef = (0, import_react23.useRef)(null);
|
|
26208
|
+
const mediaKeyDropTokenRef = (0, import_react23.useRef)(0);
|
|
26209
|
+
const selectedIconElRef = (0, import_react23.useRef)(null);
|
|
26210
|
+
const selectedSocialElRef = (0, import_react23.useRef)(null);
|
|
26211
|
+
const queueSectionKeyDrop = (0, import_react23.useCallback)((prev) => {
|
|
26109
26212
|
const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
|
|
26110
26213
|
if (!sectionEl) return;
|
|
26111
26214
|
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
@@ -26126,31 +26229,31 @@ function OhhwellsBridge() {
|
|
|
26126
26229
|
window.addEventListener("message", onQueueDrained);
|
|
26127
26230
|
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
26128
26231
|
}, []);
|
|
26129
|
-
const clearMediaSelection = (0,
|
|
26232
|
+
const clearMediaSelection = (0, import_react23.useCallback)(() => {
|
|
26130
26233
|
const prev = selectedMediaElRef.current;
|
|
26131
26234
|
selectedMediaElRef.current = null;
|
|
26132
26235
|
setSelectedMedia(null);
|
|
26133
26236
|
queueSectionKeyDrop(prev);
|
|
26134
26237
|
}, [queueSectionKeyDrop]);
|
|
26135
|
-
const clearMediaSelectionRef = (0,
|
|
26238
|
+
const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
|
|
26136
26239
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
26137
|
-
const clearIconSelection = (0,
|
|
26240
|
+
const clearIconSelection = (0, import_react23.useCallback)(() => {
|
|
26138
26241
|
const prev = selectedIconElRef.current;
|
|
26139
26242
|
if (!prev) return;
|
|
26140
26243
|
selectedIconElRef.current = null;
|
|
26141
26244
|
queueSectionKeyDrop(prev);
|
|
26142
26245
|
}, [queueSectionKeyDrop]);
|
|
26143
|
-
const clearIconSelectionRef = (0,
|
|
26246
|
+
const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
|
|
26144
26247
|
clearIconSelectionRef.current = clearIconSelection;
|
|
26145
|
-
const clearSocialSelection = (0,
|
|
26248
|
+
const clearSocialSelection = (0, import_react23.useCallback)(() => {
|
|
26146
26249
|
const prev = selectedSocialElRef.current;
|
|
26147
26250
|
if (!prev) return;
|
|
26148
26251
|
selectedSocialElRef.current = null;
|
|
26149
26252
|
queueSectionKeyDrop(prev);
|
|
26150
26253
|
}, [queueSectionKeyDrop]);
|
|
26151
|
-
const clearSocialSelectionRef = (0,
|
|
26254
|
+
const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
|
|
26152
26255
|
clearSocialSelectionRef.current = clearSocialSelection;
|
|
26153
|
-
const selectIconElement = (0,
|
|
26256
|
+
const selectIconElement = (0, import_react23.useCallback)((el) => {
|
|
26154
26257
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26155
26258
|
selectedIconElRef.current = el;
|
|
26156
26259
|
const sectionEl = el.closest("[data-ohw-section]");
|
|
@@ -26163,9 +26266,9 @@ function OhhwellsBridge() {
|
|
|
26163
26266
|
keyLabel: "Icon"
|
|
26164
26267
|
});
|
|
26165
26268
|
}, []);
|
|
26166
|
-
const selectIconElementRef = (0,
|
|
26269
|
+
const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
|
|
26167
26270
|
selectIconElementRef.current = selectIconElement;
|
|
26168
|
-
const selectMediaElement = (0,
|
|
26271
|
+
const selectMediaElement = (0, import_react23.useCallback)((el) => {
|
|
26169
26272
|
const r2 = el.getBoundingClientRect();
|
|
26170
26273
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
26171
26274
|
selectedIconElRef.current = null;
|
|
@@ -26190,9 +26293,9 @@ function OhhwellsBridge() {
|
|
|
26190
26293
|
keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
|
|
26191
26294
|
});
|
|
26192
26295
|
}, []);
|
|
26193
|
-
const selectMediaElementRef = (0,
|
|
26296
|
+
const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
|
|
26194
26297
|
selectMediaElementRef.current = selectMediaElement;
|
|
26195
|
-
(0,
|
|
26298
|
+
(0, import_react23.useEffect)(() => {
|
|
26196
26299
|
if (!selectedMedia) return;
|
|
26197
26300
|
const update = () => {
|
|
26198
26301
|
const el = selectedMediaElRef.current;
|
|
@@ -26212,54 +26315,54 @@ function OhhwellsBridge() {
|
|
|
26212
26315
|
window.removeEventListener("resize", update);
|
|
26213
26316
|
};
|
|
26214
26317
|
}, [selectedMedia !== null]);
|
|
26215
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
26216
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
26217
|
-
const hoveredGapRef = (0,
|
|
26218
|
-
const imageUnhoverTimerRef = (0,
|
|
26219
|
-
const imageShowTimerRef = (0,
|
|
26220
|
-
const editStylesRef = (0,
|
|
26221
|
-
const activateRef = (0,
|
|
26318
|
+
const [carouselHover, setCarouselHover] = (0, import_react23.useState)(null);
|
|
26319
|
+
const [uploadingRects, setUploadingRects] = (0, import_react23.useState)({});
|
|
26320
|
+
const hoveredGapRef = (0, import_react23.useRef)(null);
|
|
26321
|
+
const imageUnhoverTimerRef = (0, import_react23.useRef)(null);
|
|
26322
|
+
const imageShowTimerRef = (0, import_react23.useRef)(null);
|
|
26323
|
+
const editStylesRef = (0, import_react23.useRef)(null);
|
|
26324
|
+
const activateRef = (0, import_react23.useRef)(() => {
|
|
26222
26325
|
});
|
|
26223
|
-
const deactivateRef = (0,
|
|
26326
|
+
const deactivateRef = (0, import_react23.useRef)(() => {
|
|
26224
26327
|
});
|
|
26225
|
-
const selectRef = (0,
|
|
26328
|
+
const selectRef = (0, import_react23.useRef)(() => {
|
|
26226
26329
|
});
|
|
26227
|
-
const selectFrameRef = (0,
|
|
26330
|
+
const selectFrameRef = (0, import_react23.useRef)(() => {
|
|
26228
26331
|
});
|
|
26229
|
-
const selectLogoRef = (0,
|
|
26332
|
+
const selectLogoRef = (0, import_react23.useRef)(() => {
|
|
26230
26333
|
});
|
|
26231
|
-
const openLogoSizePanelRef = (0,
|
|
26334
|
+
const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
|
|
26232
26335
|
});
|
|
26233
|
-
const deselectRef = (0,
|
|
26336
|
+
const deselectRef = (0, import_react23.useRef)(() => {
|
|
26234
26337
|
});
|
|
26235
|
-
const closeFloatingPanelOnlyRef = (0,
|
|
26338
|
+
const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
|
|
26236
26339
|
});
|
|
26237
|
-
const reselectNavigationItemRef = (0,
|
|
26340
|
+
const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
|
|
26238
26341
|
});
|
|
26239
|
-
const commitNavigationTextEditRef = (0,
|
|
26342
|
+
const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
|
|
26240
26343
|
});
|
|
26241
|
-
const handleDeleteSelectedRef = (0,
|
|
26242
|
-
const runPendingDeleteUndoRef = (0,
|
|
26243
|
-
const isFooterFrameSelectionRef = (0,
|
|
26244
|
-
const refreshActiveCommandsRef = (0,
|
|
26344
|
+
const handleDeleteSelectedRef = (0, import_react23.useRef)(() => false);
|
|
26345
|
+
const runPendingDeleteUndoRef = (0, import_react23.useRef)(() => false);
|
|
26346
|
+
const isFooterFrameSelectionRef = (0, import_react23.useRef)(false);
|
|
26347
|
+
const refreshActiveCommandsRef = (0, import_react23.useRef)(() => {
|
|
26245
26348
|
});
|
|
26246
|
-
const postToParentRef = (0,
|
|
26349
|
+
const postToParentRef = (0, import_react23.useRef)(postToParent2);
|
|
26247
26350
|
postToParentRef.current = postToParent2;
|
|
26248
|
-
const aiSectionApiRef = (0,
|
|
26249
|
-
const sectionsLoadedRef = (0,
|
|
26250
|
-
const pendingScheduleConfigRequests = (0,
|
|
26251
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
26252
|
-
const [formPickRect, setFormPickRect] = (0,
|
|
26253
|
-
const formPickElRef = (0,
|
|
26254
|
-
const [formViewState, setFormViewStateUi] = (0,
|
|
26255
|
-
const [formPickCount, setFormPickCount] = (0,
|
|
26256
|
-
const [formHoverRect, setFormHoverRect] = (0,
|
|
26257
|
-
const formHoverElRef = (0,
|
|
26258
|
-
const [fieldPickRect, setFieldPickRect] = (0,
|
|
26259
|
-
const fieldPickElRef = (0,
|
|
26260
|
-
const [fieldPickState, setFieldPickState] = (0,
|
|
26261
|
-
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0,
|
|
26262
|
-
const clearFormPick = (0,
|
|
26351
|
+
const aiSectionApiRef = (0, import_react23.useRef)(null);
|
|
26352
|
+
const sectionsLoadedRef = (0, import_react23.useRef)(false);
|
|
26353
|
+
const pendingScheduleConfigRequests = (0, import_react23.useRef)([]);
|
|
26354
|
+
const [toolbarRect, setToolbarRect] = (0, import_react23.useState)(null);
|
|
26355
|
+
const [formPickRect, setFormPickRect] = (0, import_react23.useState)(null);
|
|
26356
|
+
const formPickElRef = (0, import_react23.useRef)(null);
|
|
26357
|
+
const [formViewState, setFormViewStateUi] = (0, import_react23.useState)("default");
|
|
26358
|
+
const [formPickCount, setFormPickCount] = (0, import_react23.useState)(null);
|
|
26359
|
+
const [formHoverRect, setFormHoverRect] = (0, import_react23.useState)(null);
|
|
26360
|
+
const formHoverElRef = (0, import_react23.useRef)(null);
|
|
26361
|
+
const [fieldPickRect, setFieldPickRect] = (0, import_react23.useState)(null);
|
|
26362
|
+
const fieldPickElRef = (0, import_react23.useRef)(null);
|
|
26363
|
+
const [fieldPickState, setFieldPickState] = (0, import_react23.useState)(null);
|
|
26364
|
+
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react23.useState)(false);
|
|
26365
|
+
const clearFormPick = (0, import_react23.useCallback)(() => {
|
|
26263
26366
|
const form = formPickElRef.current;
|
|
26264
26367
|
const editing = fieldPickElRef.current;
|
|
26265
26368
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
@@ -26279,7 +26382,7 @@ function OhhwellsBridge() {
|
|
|
26279
26382
|
formPickElRef.current = null;
|
|
26280
26383
|
setFormPickRect(null);
|
|
26281
26384
|
}, []);
|
|
26282
|
-
const clearFieldPick = (0,
|
|
26385
|
+
const clearFieldPick = (0, import_react23.useCallback)(() => {
|
|
26283
26386
|
const wrapper = fieldPickElRef.current;
|
|
26284
26387
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
26285
26388
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
@@ -26289,9 +26392,9 @@ function OhhwellsBridge() {
|
|
|
26289
26392
|
setFieldPickRect(null);
|
|
26290
26393
|
setFieldPickState(null);
|
|
26291
26394
|
}, []);
|
|
26292
|
-
const persistFieldsRef = (0,
|
|
26395
|
+
const persistFieldsRef = (0, import_react23.useRef)(() => {
|
|
26293
26396
|
});
|
|
26294
|
-
const persistFields = (0,
|
|
26397
|
+
const persistFields = (0, import_react23.useCallback)(
|
|
26295
26398
|
(form) => {
|
|
26296
26399
|
const key = formKeyOf(form);
|
|
26297
26400
|
if (!key) return;
|
|
@@ -26302,7 +26405,7 @@ function OhhwellsBridge() {
|
|
|
26302
26405
|
[]
|
|
26303
26406
|
);
|
|
26304
26407
|
persistFieldsRef.current = persistFields;
|
|
26305
|
-
const selectField = (0,
|
|
26408
|
+
const selectField = (0, import_react23.useCallback)((wrapper) => {
|
|
26306
26409
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
26307
26410
|
commitPlaceholderEdit(fieldPickElRef.current);
|
|
26308
26411
|
}
|
|
@@ -26315,7 +26418,7 @@ function OhhwellsBridge() {
|
|
|
26315
26418
|
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
26316
26419
|
setFieldTypePickerOpen(false);
|
|
26317
26420
|
}, []);
|
|
26318
|
-
const withSelectedField = (0,
|
|
26421
|
+
const withSelectedField = (0, import_react23.useCallback)(
|
|
26319
26422
|
(run) => {
|
|
26320
26423
|
const wrapper = fieldPickElRef.current;
|
|
26321
26424
|
const form = formPickElRef.current;
|
|
@@ -26328,28 +26431,28 @@ function OhhwellsBridge() {
|
|
|
26328
26431
|
},
|
|
26329
26432
|
[persistFields]
|
|
26330
26433
|
);
|
|
26331
|
-
const handleFieldTypeChange = (0,
|
|
26434
|
+
const handleFieldTypeChange = (0, import_react23.useCallback)(
|
|
26332
26435
|
(type) => withSelectedField((_form, wrapper) => {
|
|
26333
26436
|
applyFieldType(wrapper, type);
|
|
26334
26437
|
selectField(wrapper);
|
|
26335
26438
|
}),
|
|
26336
26439
|
[selectField, withSelectedField]
|
|
26337
26440
|
);
|
|
26338
|
-
const handleFieldRequiredToggle = (0,
|
|
26441
|
+
const handleFieldRequiredToggle = (0, import_react23.useCallback)(
|
|
26339
26442
|
() => withSelectedField((_form, wrapper) => {
|
|
26340
26443
|
setFieldRequired(wrapper, !isFieldRequired(wrapper));
|
|
26341
26444
|
selectField(wrapper);
|
|
26342
26445
|
}),
|
|
26343
26446
|
[selectField, withSelectedField]
|
|
26344
26447
|
);
|
|
26345
|
-
const handleFieldDuplicate = (0,
|
|
26448
|
+
const handleFieldDuplicate = (0, import_react23.useCallback)(
|
|
26346
26449
|
() => withSelectedField((form, wrapper) => {
|
|
26347
26450
|
const copy = duplicateField(form, wrapper);
|
|
26348
26451
|
selectField(copy);
|
|
26349
26452
|
}),
|
|
26350
26453
|
[selectField, withSelectedField]
|
|
26351
26454
|
);
|
|
26352
|
-
const handleFieldDelete = (0,
|
|
26455
|
+
const handleFieldDelete = (0, import_react23.useCallback)(
|
|
26353
26456
|
() => withSelectedField((_form, wrapper) => {
|
|
26354
26457
|
removeField(wrapper);
|
|
26355
26458
|
clearFieldPick();
|
|
@@ -26357,7 +26460,7 @@ function OhhwellsBridge() {
|
|
|
26357
26460
|
}),
|
|
26358
26461
|
[clearFieldPick, withSelectedField]
|
|
26359
26462
|
);
|
|
26360
|
-
const handleAddField = (0,
|
|
26463
|
+
const handleAddField = (0, import_react23.useCallback)(
|
|
26361
26464
|
(type) => {
|
|
26362
26465
|
const form = formPickElRef.current;
|
|
26363
26466
|
if (!form) return;
|
|
@@ -26373,8 +26476,8 @@ function OhhwellsBridge() {
|
|
|
26373
26476
|
},
|
|
26374
26477
|
[persistFields, selectField]
|
|
26375
26478
|
);
|
|
26376
|
-
const fieldDragRef = (0,
|
|
26377
|
-
const buildFieldDropSlots = (0,
|
|
26479
|
+
const fieldDragRef = (0, import_react23.useRef)(null);
|
|
26480
|
+
const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
|
|
26378
26481
|
const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
|
|
26379
26482
|
const slots = others.map((el) => {
|
|
26380
26483
|
const rect = el.getBoundingClientRect();
|
|
@@ -26387,7 +26490,7 @@ function OhhwellsBridge() {
|
|
|
26387
26490
|
}
|
|
26388
26491
|
return slots;
|
|
26389
26492
|
}, []);
|
|
26390
|
-
const handleFieldDragStart = (0,
|
|
26493
|
+
const handleFieldDragStart = (0, import_react23.useCallback)(() => {
|
|
26391
26494
|
const wrapper = fieldPickElRef.current;
|
|
26392
26495
|
const form = formPickElRef.current;
|
|
26393
26496
|
if (!wrapper || !form) return;
|
|
@@ -26396,18 +26499,18 @@ function OhhwellsBridge() {
|
|
|
26396
26499
|
setFieldDragging(true);
|
|
26397
26500
|
setFieldDropSlots(buildFieldDropSlots(form, key));
|
|
26398
26501
|
}, [buildFieldDropSlots]);
|
|
26399
|
-
const handleFieldDragEnd = (0,
|
|
26502
|
+
const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
|
|
26400
26503
|
fieldDragRef.current = null;
|
|
26401
26504
|
setFieldDropIndex(null);
|
|
26402
26505
|
setFieldDropSlots([]);
|
|
26403
26506
|
setFieldDragging(false);
|
|
26404
26507
|
}, []);
|
|
26405
|
-
const [fieldDropIndex, setFieldDropIndex] = (0,
|
|
26406
|
-
const [fieldDropSlots, setFieldDropSlots] = (0,
|
|
26407
|
-
const [fieldDragging, setFieldDragging] = (0,
|
|
26408
|
-
const clearFormPickRef = (0,
|
|
26508
|
+
const [fieldDropIndex, setFieldDropIndex] = (0, import_react23.useState)(null);
|
|
26509
|
+
const [fieldDropSlots, setFieldDropSlots] = (0, import_react23.useState)([]);
|
|
26510
|
+
const [fieldDragging, setFieldDragging] = (0, import_react23.useState)(false);
|
|
26511
|
+
const clearFormPickRef = (0, import_react23.useRef)(clearFormPick);
|
|
26409
26512
|
clearFormPickRef.current = clearFormPick;
|
|
26410
|
-
(0,
|
|
26513
|
+
(0, import_react23.useEffect)(() => {
|
|
26411
26514
|
const el = fieldPickElRef.current;
|
|
26412
26515
|
if (!el || fieldPickRect === null) return;
|
|
26413
26516
|
const observer = new ResizeObserver(() => {
|
|
@@ -26416,7 +26519,7 @@ function OhhwellsBridge() {
|
|
|
26416
26519
|
observer.observe(el);
|
|
26417
26520
|
return () => observer.disconnect();
|
|
26418
26521
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26419
|
-
(0,
|
|
26522
|
+
(0, import_react23.useEffect)(() => {
|
|
26420
26523
|
const el = formPickElRef.current;
|
|
26421
26524
|
if (!el || formPickRect === null) return;
|
|
26422
26525
|
const observer = new ResizeObserver(() => {
|
|
@@ -26425,25 +26528,25 @@ function OhhwellsBridge() {
|
|
|
26425
26528
|
observer.observe(el);
|
|
26426
26529
|
return () => observer.disconnect();
|
|
26427
26530
|
}, [formPickRect !== null, formViewState]);
|
|
26428
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
26429
|
-
const toolbarVariantRef = (0,
|
|
26531
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
|
|
26532
|
+
const toolbarVariantRef = (0, import_react23.useRef)("none");
|
|
26430
26533
|
toolbarVariantRef.current = toolbarVariant;
|
|
26431
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
26432
|
-
const [selectedIsSocial, setSelectedIsSocial] = (0,
|
|
26433
|
-
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0,
|
|
26434
|
-
const [reorderHrefKey, setReorderHrefKey] = (0,
|
|
26435
|
-
const [reorderDragDisabled, setReorderDragDisabled] = (0,
|
|
26436
|
-
const [toggleState, setToggleState] = (0,
|
|
26437
|
-
const [maxBadge, setMaxBadge] = (0,
|
|
26438
|
-
const [activeCommands, setActiveCommands] = (0,
|
|
26439
|
-
const [sectionGap, setSectionGap] = (0,
|
|
26440
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] = (0,
|
|
26441
|
-
const hoveredNavContainerRef = (0,
|
|
26442
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0,
|
|
26443
|
-
const hoveredItemElRef = (0,
|
|
26444
|
-
const [hoveredItemRect, setHoveredItemRect] = (0,
|
|
26445
|
-
const [hoveredTextRect, setHoveredTextRect] = (0,
|
|
26446
|
-
(0,
|
|
26534
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react23.useState)(false);
|
|
26535
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react23.useState)(false);
|
|
26536
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react23.useState)(false);
|
|
26537
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react23.useState)(null);
|
|
26538
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react23.useState)(false);
|
|
26539
|
+
const [toggleState, setToggleState] = (0, import_react23.useState)(null);
|
|
26540
|
+
const [maxBadge, setMaxBadge] = (0, import_react23.useState)(null);
|
|
26541
|
+
const [activeCommands, setActiveCommands] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
|
|
26542
|
+
const [sectionGap, setSectionGap] = (0, import_react23.useState)(null);
|
|
26543
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react23.useState)(false);
|
|
26544
|
+
const hoveredNavContainerRef = (0, import_react23.useRef)(null);
|
|
26545
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react23.useState)(null);
|
|
26546
|
+
const hoveredItemElRef = (0, import_react23.useRef)(null);
|
|
26547
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react23.useState)(null);
|
|
26548
|
+
const [hoveredTextRect, setHoveredTextRect] = (0, import_react23.useState)(null);
|
|
26549
|
+
(0, import_react23.useEffect)(() => {
|
|
26447
26550
|
const sync = () => {
|
|
26448
26551
|
const el = document.querySelector(
|
|
26449
26552
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26487,65 +26590,65 @@ function OhhwellsBridge() {
|
|
|
26487
26590
|
});
|
|
26488
26591
|
return () => observer.disconnect();
|
|
26489
26592
|
}, []);
|
|
26490
|
-
const siblingHintElRef = (0,
|
|
26491
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
26492
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
26493
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
26494
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
26593
|
+
const siblingHintElRef = (0, import_react23.useRef)(null);
|
|
26594
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react23.useState)(null);
|
|
26595
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react23.useState)([]);
|
|
26596
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react23.useState)(false);
|
|
26597
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react23.useState)(false);
|
|
26495
26598
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26496
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0,
|
|
26497
|
-
const [footerHeadingVisible, setFooterHeadingVisible] = (0,
|
|
26498
|
-
const footerDragRef = (0,
|
|
26499
|
-
const [footerDropSlots, setFooterDropSlots] = (0,
|
|
26500
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0,
|
|
26501
|
-
const [draggedItemRect, setDraggedItemRect] = (0,
|
|
26502
|
-
const footerPointerDragRef = (0,
|
|
26503
|
-
const suppressNextClickRef = (0,
|
|
26504
|
-
const suppressClickUntilRef = (0,
|
|
26505
|
-
const [linkPopover, setLinkPopover] = (0,
|
|
26506
|
-
const linkPopoverSessionRef = (0,
|
|
26507
|
-
const addNavAfterAnchorRef = (0,
|
|
26508
|
-
const editContentRef = (0,
|
|
26509
|
-
const aiSectionsRef = (0,
|
|
26510
|
-
const aiFooterRef = (0,
|
|
26511
|
-
const applyTreeLocalRef = (0,
|
|
26599
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react23.useState)(null);
|
|
26600
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react23.useState)(null);
|
|
26601
|
+
const footerDragRef = (0, import_react23.useRef)(null);
|
|
26602
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react23.useState)([]);
|
|
26603
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react23.useState)(null);
|
|
26604
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react23.useState)(null);
|
|
26605
|
+
const footerPointerDragRef = (0, import_react23.useRef)(null);
|
|
26606
|
+
const suppressNextClickRef = (0, import_react23.useRef)(false);
|
|
26607
|
+
const suppressClickUntilRef = (0, import_react23.useRef)(0);
|
|
26608
|
+
const [linkPopover, setLinkPopover] = (0, import_react23.useState)(null);
|
|
26609
|
+
const linkPopoverSessionRef = (0, import_react23.useRef)(null);
|
|
26610
|
+
const addNavAfterAnchorRef = (0, import_react23.useRef)(null);
|
|
26611
|
+
const editContentRef = (0, import_react23.useRef)({});
|
|
26612
|
+
const aiSectionsRef = (0, import_react23.useRef)("");
|
|
26613
|
+
const aiFooterRef = (0, import_react23.useRef)("");
|
|
26614
|
+
const applyTreeLocalRef = (0, import_react23.useRef)(
|
|
26512
26615
|
null
|
|
26513
26616
|
);
|
|
26514
|
-
const applyFooterTreeLocalRef = (0,
|
|
26515
|
-
const clearInteractionChromeRef = (0,
|
|
26617
|
+
const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
|
|
26618
|
+
const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
|
|
26516
26619
|
});
|
|
26517
|
-
const brandKitRef = (0,
|
|
26518
|
-
const stylesRef = (0,
|
|
26519
|
-
const appliedDrawerRef = (0,
|
|
26520
|
-
const pendingDeleteUndoRef = (0,
|
|
26521
|
-
const [floatingPanel, setFloatingPanel] = (0,
|
|
26522
|
-
const floatingPanelOpenRef = (0,
|
|
26523
|
-
const floatingPanelRef = (0,
|
|
26620
|
+
const brandKitRef = (0, import_react23.useRef)("");
|
|
26621
|
+
const stylesRef = (0, import_react23.useRef)("");
|
|
26622
|
+
const appliedDrawerRef = (0, import_react23.useRef)(null);
|
|
26623
|
+
const pendingDeleteUndoRef = (0, import_react23.useRef)(null);
|
|
26624
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
|
|
26625
|
+
const floatingPanelOpenRef = (0, import_react23.useRef)(false);
|
|
26626
|
+
const floatingPanelRef = (0, import_react23.useRef)(null);
|
|
26524
26627
|
floatingPanelRef.current = floatingPanel;
|
|
26525
|
-
const setFloatingPanelRef = (0,
|
|
26526
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0,
|
|
26527
|
-
const buttonCollectionDragRef = (0,
|
|
26528
|
-
const buttonDropInsertIndexRef = (0,
|
|
26529
|
-
const [buttonDropSlots, setButtonDropSlots] = (0,
|
|
26530
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0,
|
|
26531
|
-
const buttonPointerDragRef = (0,
|
|
26532
|
-
const [buttonStyleTick, setButtonStyleTick] = (0,
|
|
26533
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0,
|
|
26534
|
-
const [editorViewport, setEditorViewport] = (0,
|
|
26535
|
-
const [parentScrollSnap, setParentScrollSnap] = (0,
|
|
26536
|
-
const [sitePages, setSitePages] = (0,
|
|
26537
|
-
const collectionItemsRef = (0,
|
|
26538
|
-
const [sectionsByPath, setSectionsByPath] = (0,
|
|
26539
|
-
const sectionsPrefetchGenRef = (0,
|
|
26540
|
-
const setLinkPopoverRef = (0,
|
|
26541
|
-
const linkPopoverPanelRef = (0,
|
|
26542
|
-
const linkPopoverOpenRef = (0,
|
|
26543
|
-
const linkPopoverGraceUntilRef = (0,
|
|
26628
|
+
const setFloatingPanelRef = (0, import_react23.useRef)(setFloatingPanel);
|
|
26629
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react23.useState)(null);
|
|
26630
|
+
const buttonCollectionDragRef = (0, import_react23.useRef)(null);
|
|
26631
|
+
const buttonDropInsertIndexRef = (0, import_react23.useRef)(null);
|
|
26632
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react23.useState)([]);
|
|
26633
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react23.useState)(null);
|
|
26634
|
+
const buttonPointerDragRef = (0, import_react23.useRef)(null);
|
|
26635
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react23.useState)(0);
|
|
26636
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react23.useState)(null);
|
|
26637
|
+
const [editorViewport, setEditorViewport] = (0, import_react23.useState)("desktop");
|
|
26638
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react23.useState)(null);
|
|
26639
|
+
const [sitePages, setSitePages] = (0, import_react23.useState)([]);
|
|
26640
|
+
const collectionItemsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
|
|
26641
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react23.useState)({});
|
|
26642
|
+
const sectionsPrefetchGenRef = (0, import_react23.useRef)(0);
|
|
26643
|
+
const setLinkPopoverRef = (0, import_react23.useRef)(setLinkPopover);
|
|
26644
|
+
const linkPopoverPanelRef = (0, import_react23.useRef)(null);
|
|
26645
|
+
const linkPopoverOpenRef = (0, import_react23.useRef)(false);
|
|
26646
|
+
const linkPopoverGraceUntilRef = (0, import_react23.useRef)(0);
|
|
26544
26647
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26545
26648
|
setFloatingPanelRef.current = setFloatingPanel;
|
|
26546
26649
|
linkPopoverSessionRef.current = linkPopover;
|
|
26547
26650
|
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26548
|
-
(0,
|
|
26651
|
+
(0, import_react23.useEffect)(() => {
|
|
26549
26652
|
const syncViewport = () => {
|
|
26550
26653
|
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26551
26654
|
setEditorViewport((prev) => prev === next ? prev : next);
|
|
@@ -26554,7 +26657,7 @@ function OhhwellsBridge() {
|
|
|
26554
26657
|
window.addEventListener("resize", syncViewport);
|
|
26555
26658
|
return () => window.removeEventListener("resize", syncViewport);
|
|
26556
26659
|
}, []);
|
|
26557
|
-
(0,
|
|
26660
|
+
(0, import_react23.useEffect)(() => {
|
|
26558
26661
|
setSectionOrderPersistHandler((entries) => {
|
|
26559
26662
|
const currentPath = window.location.pathname;
|
|
26560
26663
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26564,7 +26667,7 @@ function OhhwellsBridge() {
|
|
|
26564
26667
|
});
|
|
26565
26668
|
return () => setSectionOrderPersistHandler(null);
|
|
26566
26669
|
}, []);
|
|
26567
|
-
(0,
|
|
26670
|
+
(0, import_react23.useEffect)(() => {
|
|
26568
26671
|
setAiFooterMountOptions({
|
|
26569
26672
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26570
26673
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26627,7 +26730,7 @@ function OhhwellsBridge() {
|
|
|
26627
26730
|
const bumpLinkPopoverGrace = () => {
|
|
26628
26731
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
26629
26732
|
};
|
|
26630
|
-
const runSectionsPrefetch = (0,
|
|
26733
|
+
const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
|
|
26631
26734
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
26632
26735
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
26633
26736
|
const paths = pages.map((p) => p.path);
|
|
@@ -26646,9 +26749,9 @@ function OhhwellsBridge() {
|
|
|
26646
26749
|
);
|
|
26647
26750
|
});
|
|
26648
26751
|
}, [isEditMode, pathname]);
|
|
26649
|
-
const runSectionsPrefetchRef = (0,
|
|
26752
|
+
const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
|
|
26650
26753
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26651
|
-
(0,
|
|
26754
|
+
(0, import_react23.useEffect)(() => {
|
|
26652
26755
|
if (!linkPopover) {
|
|
26653
26756
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26654
26757
|
return;
|
|
@@ -26676,7 +26779,7 @@ function OhhwellsBridge() {
|
|
|
26676
26779
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26677
26780
|
};
|
|
26678
26781
|
}, [linkPopover, postToParent2]);
|
|
26679
|
-
(0,
|
|
26782
|
+
(0, import_react23.useEffect)(() => {
|
|
26680
26783
|
if (!isEditMode) return;
|
|
26681
26784
|
const useFixtures = shouldUseDevFixtures();
|
|
26682
26785
|
if (useFixtures) {
|
|
@@ -26702,7 +26805,7 @@ function OhhwellsBridge() {
|
|
|
26702
26805
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26703
26806
|
return () => window.removeEventListener("message", onSitePages);
|
|
26704
26807
|
}, [isEditMode, postToParent2]);
|
|
26705
|
-
(0,
|
|
26808
|
+
(0, import_react23.useEffect)(() => {
|
|
26706
26809
|
if (!isEditMode) return;
|
|
26707
26810
|
const deps = {
|
|
26708
26811
|
getEditContent: () => editContentRef.current,
|
|
@@ -26739,14 +26842,14 @@ function OhhwellsBridge() {
|
|
|
26739
26842
|
window.addEventListener("message", onPageMessage);
|
|
26740
26843
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26741
26844
|
}, [isEditMode, postToParent2]);
|
|
26742
|
-
(0,
|
|
26845
|
+
(0, import_react23.useEffect)(() => {
|
|
26743
26846
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26744
26847
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26745
26848
|
if (Object.keys(manifest).length === 0) return;
|
|
26746
26849
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26747
26850
|
});
|
|
26748
26851
|
}, [isEditMode]);
|
|
26749
|
-
(0,
|
|
26852
|
+
(0, import_react23.useEffect)(() => {
|
|
26750
26853
|
const update = () => {
|
|
26751
26854
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26752
26855
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -26770,10 +26873,10 @@ function OhhwellsBridge() {
|
|
|
26770
26873
|
vvp.removeEventListener("resize", update);
|
|
26771
26874
|
};
|
|
26772
26875
|
}, []);
|
|
26773
|
-
const refreshStateRules = (0,
|
|
26876
|
+
const refreshStateRules = (0, import_react23.useCallback)(() => {
|
|
26774
26877
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
26775
26878
|
}, []);
|
|
26776
|
-
const processConfigRequest = (0,
|
|
26879
|
+
const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
|
|
26777
26880
|
const tracker = getSectionsTracker();
|
|
26778
26881
|
let entries = [];
|
|
26779
26882
|
try {
|
|
@@ -26796,7 +26899,7 @@ function OhhwellsBridge() {
|
|
|
26796
26899
|
}
|
|
26797
26900
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
26798
26901
|
}, [isEditMode]);
|
|
26799
|
-
const deactivate = (0,
|
|
26902
|
+
const deactivate = (0, import_react23.useCallback)(() => {
|
|
26800
26903
|
const el = activeElRef.current;
|
|
26801
26904
|
if (!el) return;
|
|
26802
26905
|
const isFormBlock = el.dataset.ohwEditable === "form";
|
|
@@ -26862,12 +26965,12 @@ function OhhwellsBridge() {
|
|
|
26862
26965
|
setToolbarShowEditLink(false);
|
|
26863
26966
|
postToParent2({ type: "ow:exit-edit" });
|
|
26864
26967
|
}, [postToParent2]);
|
|
26865
|
-
const clearSelectedAttr = (0,
|
|
26968
|
+
const clearSelectedAttr = (0, import_react23.useCallback)(() => {
|
|
26866
26969
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
26867
26970
|
el.removeAttribute("data-ohw-selected");
|
|
26868
26971
|
});
|
|
26869
26972
|
}, []);
|
|
26870
|
-
const deselect = (0,
|
|
26973
|
+
const deselect = (0, import_react23.useCallback)(() => {
|
|
26871
26974
|
const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
|
|
26872
26975
|
clearSelectedAttr();
|
|
26873
26976
|
selectedElRef.current = null;
|
|
@@ -26903,20 +27006,20 @@ function OhhwellsBridge() {
|
|
|
26903
27006
|
setToolbarVariant("none");
|
|
26904
27007
|
}
|
|
26905
27008
|
}, [clearSelectedAttr]);
|
|
26906
|
-
const markSelected = (0,
|
|
27009
|
+
const markSelected = (0, import_react23.useCallback)((el) => {
|
|
26907
27010
|
clearSelectedAttr();
|
|
26908
27011
|
el.removeAttribute("data-ohw-hovered");
|
|
26909
27012
|
el.setAttribute("data-ohw-selected", "");
|
|
26910
27013
|
}, [clearSelectedAttr]);
|
|
26911
|
-
const isSelectedForHover = (0,
|
|
27014
|
+
const isSelectedForHover = (0, import_react23.useCallback)((el) => {
|
|
26912
27015
|
if (!el) return false;
|
|
26913
27016
|
return [selectedElRef.current, activeElRef.current].some(
|
|
26914
27017
|
(busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
|
|
26915
27018
|
);
|
|
26916
27019
|
}, []);
|
|
26917
|
-
const isSelectedForHoverRef = (0,
|
|
27020
|
+
const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
|
|
26918
27021
|
isSelectedForHoverRef.current = isSelectedForHover;
|
|
26919
|
-
const resolveHrefKeyElement = (0,
|
|
27022
|
+
const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
|
|
26920
27023
|
if (isFooterHrefKey(hrefKey)) {
|
|
26921
27024
|
return document.querySelector(
|
|
26922
27025
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -26931,7 +27034,7 @@ function OhhwellsBridge() {
|
|
|
26931
27034
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
26932
27035
|
);
|
|
26933
27036
|
}, []);
|
|
26934
|
-
const resyncSelectedNavigationItem = (0,
|
|
27037
|
+
const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
|
|
26935
27038
|
const hrefKey = selectedHrefKeyRef.current;
|
|
26936
27039
|
if (hrefKey) {
|
|
26937
27040
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -26969,7 +27072,7 @@ function OhhwellsBridge() {
|
|
|
26969
27072
|
);
|
|
26970
27073
|
}
|
|
26971
27074
|
}, [resolveHrefKeyElement]);
|
|
26972
|
-
const reselectNavigationItem = (0,
|
|
27075
|
+
const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
|
|
26973
27076
|
selectedElRef.current = navAnchor;
|
|
26974
27077
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
26975
27078
|
selectedFooterColAttrRef.current = null;
|
|
@@ -27000,7 +27103,7 @@ function OhhwellsBridge() {
|
|
|
27000
27103
|
setToolbarShowEditLink(false);
|
|
27001
27104
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27002
27105
|
}, [markSelected]);
|
|
27003
|
-
const commitNavigationTextEdit = (0,
|
|
27106
|
+
const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
|
|
27004
27107
|
const el = activeElRef.current;
|
|
27005
27108
|
if (!el) return;
|
|
27006
27109
|
const key = el.dataset.ohwKey;
|
|
@@ -27033,7 +27136,7 @@ function OhhwellsBridge() {
|
|
|
27033
27136
|
postToParent2({ type: "ow:exit-edit" });
|
|
27034
27137
|
reselectNavigationItem(navAnchor);
|
|
27035
27138
|
}, [postToParent2, reselectNavigationItem]);
|
|
27036
|
-
const handleAddTopLevelNavItem = (0,
|
|
27139
|
+
const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
|
|
27037
27140
|
const items = listNavbarRootItems();
|
|
27038
27141
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
27039
27142
|
deselectRef.current();
|
|
@@ -27045,7 +27148,7 @@ function OhhwellsBridge() {
|
|
|
27045
27148
|
intent: "add-nav"
|
|
27046
27149
|
});
|
|
27047
27150
|
}, []);
|
|
27048
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
27151
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
|
|
27049
27152
|
(anchor) => {
|
|
27050
27153
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
27051
27154
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -27058,7 +27161,7 @@ function OhhwellsBridge() {
|
|
|
27058
27161
|
},
|
|
27059
27162
|
[postToParent2]
|
|
27060
27163
|
);
|
|
27061
|
-
const handleNavDropdownOpenChange = (0,
|
|
27164
|
+
const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
|
|
27062
27165
|
const selected = selectedElRef.current;
|
|
27063
27166
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
27064
27167
|
if (isNestedNavChild(selected)) return;
|
|
@@ -27074,7 +27177,7 @@ function OhhwellsBridge() {
|
|
|
27074
27177
|
}
|
|
27075
27178
|
});
|
|
27076
27179
|
}, []);
|
|
27077
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
27180
|
+
const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
|
|
27078
27181
|
(visible) => {
|
|
27079
27182
|
const selected = selectedElRef.current;
|
|
27080
27183
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -27127,7 +27230,7 @@ function OhhwellsBridge() {
|
|
|
27127
27230
|
},
|
|
27128
27231
|
[postToParent2]
|
|
27129
27232
|
);
|
|
27130
|
-
const enterEditOnNewItem = (0,
|
|
27233
|
+
const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
|
|
27131
27234
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
27132
27235
|
if (!label) {
|
|
27133
27236
|
selectRef.current(anchor);
|
|
@@ -27136,8 +27239,8 @@ function OhhwellsBridge() {
|
|
|
27136
27239
|
setNavGroupForceOpen(anchor, true);
|
|
27137
27240
|
activateRef.current(label);
|
|
27138
27241
|
}, []);
|
|
27139
|
-
const pendingSocialAddRef = (0,
|
|
27140
|
-
const handleAddChildItem = (0,
|
|
27242
|
+
const pendingSocialAddRef = (0, import_react23.useRef)(null);
|
|
27243
|
+
const handleAddChildItem = (0, import_react23.useCallback)(() => {
|
|
27141
27244
|
const selected = selectedElRef.current;
|
|
27142
27245
|
if (!selected) return;
|
|
27143
27246
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
@@ -27264,7 +27367,7 @@ function OhhwellsBridge() {
|
|
|
27264
27367
|
});
|
|
27265
27368
|
});
|
|
27266
27369
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
27267
|
-
const handleAddFooterColumn = (0,
|
|
27370
|
+
const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
|
|
27268
27371
|
if (document.querySelector("[data-ai-footer]")) {
|
|
27269
27372
|
const state = parseAiFooterState(aiFooterRef.current);
|
|
27270
27373
|
if (!state?.tree) return;
|
|
@@ -27320,7 +27423,7 @@ function OhhwellsBridge() {
|
|
|
27320
27423
|
selectRef.current(result.firstLink);
|
|
27321
27424
|
});
|
|
27322
27425
|
}, [postToParent2]);
|
|
27323
|
-
const clearFooterDragVisuals = (0,
|
|
27426
|
+
const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
|
|
27324
27427
|
footerDragRef.current = null;
|
|
27325
27428
|
setSiblingHintRects([]);
|
|
27326
27429
|
setFooterDropSlots([]);
|
|
@@ -27329,7 +27432,7 @@ function OhhwellsBridge() {
|
|
|
27329
27432
|
setIsItemDragging(false);
|
|
27330
27433
|
unlockFooterDragInteraction();
|
|
27331
27434
|
}, []);
|
|
27332
|
-
const refreshFooterDragVisuals = (0,
|
|
27435
|
+
const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
27333
27436
|
const dragged = session.draggedEl;
|
|
27334
27437
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
27335
27438
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -27361,13 +27464,13 @@ function OhhwellsBridge() {
|
|
|
27361
27464
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
27362
27465
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
27363
27466
|
}, []);
|
|
27364
|
-
const refreshFooterDragVisualsRef = (0,
|
|
27467
|
+
const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
|
|
27365
27468
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
27366
|
-
const commitFooterDragRef = (0,
|
|
27469
|
+
const commitFooterDragRef = (0, import_react23.useRef)(() => {
|
|
27367
27470
|
});
|
|
27368
|
-
const beginFooterDragRef = (0,
|
|
27471
|
+
const beginFooterDragRef = (0, import_react23.useRef)(() => {
|
|
27369
27472
|
});
|
|
27370
|
-
const beginFooterDrag = (0,
|
|
27473
|
+
const beginFooterDrag = (0, import_react23.useCallback)(
|
|
27371
27474
|
(session) => {
|
|
27372
27475
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
27373
27476
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -27387,7 +27490,7 @@ function OhhwellsBridge() {
|
|
|
27387
27490
|
[refreshFooterDragVisuals]
|
|
27388
27491
|
);
|
|
27389
27492
|
beginFooterDragRef.current = beginFooterDrag;
|
|
27390
|
-
const commitFooterDrag = (0,
|
|
27493
|
+
const commitFooterDrag = (0, import_react23.useCallback)(
|
|
27391
27494
|
(clientX, clientY) => {
|
|
27392
27495
|
const session = footerDragRef.current;
|
|
27393
27496
|
if (!session) {
|
|
@@ -27559,7 +27662,7 @@ function OhhwellsBridge() {
|
|
|
27559
27662
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
27560
27663
|
);
|
|
27561
27664
|
commitFooterDragRef.current = commitFooterDrag;
|
|
27562
|
-
const startFooterLinkDrag = (0,
|
|
27665
|
+
const startFooterLinkDrag = (0, import_react23.useCallback)(
|
|
27563
27666
|
(anchor, clientX, clientY, wasSelected) => {
|
|
27564
27667
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
27565
27668
|
if (!hrefKey) return false;
|
|
@@ -27595,7 +27698,7 @@ function OhhwellsBridge() {
|
|
|
27595
27698
|
},
|
|
27596
27699
|
[beginFooterDrag]
|
|
27597
27700
|
);
|
|
27598
|
-
const startFooterColumnDrag = (0,
|
|
27701
|
+
const startFooterColumnDrag = (0, import_react23.useCallback)(
|
|
27599
27702
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
27600
27703
|
const columns = listFooterColumns(columnEl);
|
|
27601
27704
|
const idx = columns.indexOf(columnEl);
|
|
@@ -27615,7 +27718,7 @@ function OhhwellsBridge() {
|
|
|
27615
27718
|
},
|
|
27616
27719
|
[beginFooterDrag]
|
|
27617
27720
|
);
|
|
27618
|
-
const persistButtonCollectionDrag = (0,
|
|
27721
|
+
const persistButtonCollectionDrag = (0, import_react23.useCallback)(
|
|
27619
27722
|
(button, clientX) => {
|
|
27620
27723
|
const insertIndex = buttonDropInsertIndexRef.current;
|
|
27621
27724
|
if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
|
|
@@ -27639,7 +27742,7 @@ function OhhwellsBridge() {
|
|
|
27639
27742
|
},
|
|
27640
27743
|
[postToParent2]
|
|
27641
27744
|
);
|
|
27642
|
-
const refreshButtonDragVisuals = (0,
|
|
27745
|
+
const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
|
|
27643
27746
|
const collection = buttonCollectionOf(button);
|
|
27644
27747
|
if (!collection) {
|
|
27645
27748
|
setButtonDropSlots([]);
|
|
@@ -27656,7 +27759,7 @@ function OhhwellsBridge() {
|
|
|
27656
27759
|
setDraggedItemRect(button.getBoundingClientRect());
|
|
27657
27760
|
if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
|
|
27658
27761
|
}, []);
|
|
27659
|
-
const handleItemDragStart = (0,
|
|
27762
|
+
const handleItemDragStart = (0, import_react23.useCallback)(
|
|
27660
27763
|
(e) => {
|
|
27661
27764
|
const selected = selectedElRef.current;
|
|
27662
27765
|
if (!selected) {
|
|
@@ -27687,7 +27790,7 @@ function OhhwellsBridge() {
|
|
|
27687
27790
|
},
|
|
27688
27791
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
|
|
27689
27792
|
);
|
|
27690
|
-
const handleItemDragEnd = (0,
|
|
27793
|
+
const handleItemDragEnd = (0, import_react23.useCallback)(
|
|
27691
27794
|
(e) => {
|
|
27692
27795
|
const collectionButton = buttonCollectionDragRef.current;
|
|
27693
27796
|
if (collectionButton) {
|
|
@@ -27718,7 +27821,7 @@ function OhhwellsBridge() {
|
|
|
27718
27821
|
},
|
|
27719
27822
|
[commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
|
|
27720
27823
|
);
|
|
27721
|
-
const handleItemChromePointerDown = (0,
|
|
27824
|
+
const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
|
|
27722
27825
|
if (e.button !== 0) return;
|
|
27723
27826
|
const selected = selectedElRef.current;
|
|
27724
27827
|
if (!selected) return;
|
|
@@ -27759,7 +27862,7 @@ function OhhwellsBridge() {
|
|
|
27759
27862
|
}
|
|
27760
27863
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
27761
27864
|
}, [armNavPressFromChrome]);
|
|
27762
|
-
const handleItemChromeClick = (0,
|
|
27865
|
+
const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
|
|
27763
27866
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
27764
27867
|
suppressNextClickRef.current = false;
|
|
27765
27868
|
return;
|
|
@@ -27772,7 +27875,7 @@ function OhhwellsBridge() {
|
|
|
27772
27875
|
}, []);
|
|
27773
27876
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
27774
27877
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
27775
|
-
const select = (0,
|
|
27878
|
+
const select = (0, import_react23.useCallback)((anchor) => {
|
|
27776
27879
|
if (!isNavigationItem2(anchor)) return;
|
|
27777
27880
|
if (activeElRef.current) deactivate();
|
|
27778
27881
|
clearSocialSelectionRef.current();
|
|
@@ -27849,7 +27952,7 @@ function OhhwellsBridge() {
|
|
|
27849
27952
|
setLogoSizeDraft(null);
|
|
27850
27953
|
}
|
|
27851
27954
|
}, [deactivate, markSelected]);
|
|
27852
|
-
const selectFrame = (0,
|
|
27955
|
+
const selectFrame = (0, import_react23.useCallback)((el) => {
|
|
27853
27956
|
if (!isNavigationContainer(el)) return;
|
|
27854
27957
|
if (activeElRef.current) deactivate();
|
|
27855
27958
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -27890,7 +27993,7 @@ function OhhwellsBridge() {
|
|
|
27890
27993
|
setFloatingPanelPos(null);
|
|
27891
27994
|
setLogoSizeDraft(null);
|
|
27892
27995
|
}, [deactivate, markSelected, postToParent2]);
|
|
27893
|
-
const selectLogo = (0,
|
|
27996
|
+
const selectLogo = (0, import_react23.useCallback)(
|
|
27894
27997
|
(logoEl) => {
|
|
27895
27998
|
if (activeElRef.current) deactivate();
|
|
27896
27999
|
selectedElRef.current = logoEl;
|
|
@@ -27919,7 +28022,7 @@ function OhhwellsBridge() {
|
|
|
27919
28022
|
},
|
|
27920
28023
|
[deactivate, markSelected]
|
|
27921
28024
|
);
|
|
27922
|
-
const openLogoSizePanel = (0,
|
|
28025
|
+
const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
|
|
27923
28026
|
const placement = getLogoPlacement(logoEl);
|
|
27924
28027
|
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
27925
28028
|
setLogoSizeDraft(draft);
|
|
@@ -27932,7 +28035,7 @@ function OhhwellsBridge() {
|
|
|
27932
28035
|
placement
|
|
27933
28036
|
});
|
|
27934
28037
|
}, []);
|
|
27935
|
-
const openSocialsDisplayPanel = (0,
|
|
28038
|
+
const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
|
|
27936
28039
|
setFloatingPanelPos(null);
|
|
27937
28040
|
setParentScrollSnap(parentScrollRef.current);
|
|
27938
28041
|
setFloatingPanel({
|
|
@@ -27943,7 +28046,7 @@ function OhhwellsBridge() {
|
|
|
27943
28046
|
row
|
|
27944
28047
|
});
|
|
27945
28048
|
}, []);
|
|
27946
|
-
const rememberButtonTokens = (0,
|
|
28049
|
+
const rememberButtonTokens = (0, import_react23.useCallback)(
|
|
27947
28050
|
(content, tokens, nodes) => {
|
|
27948
28051
|
if (nodes.length === 0) return content;
|
|
27949
28052
|
const next = { ...content };
|
|
@@ -27954,7 +28057,7 @@ function OhhwellsBridge() {
|
|
|
27954
28057
|
},
|
|
27955
28058
|
[postToParent2]
|
|
27956
28059
|
);
|
|
27957
|
-
const tokensForButton = (0,
|
|
28060
|
+
const tokensForButton = (0, import_react23.useCallback)(
|
|
27958
28061
|
(el, persistFallback = false) => {
|
|
27959
28062
|
const stored = readStoredStyleTokens(editContentRef.current);
|
|
27960
28063
|
if (stored) return stored;
|
|
@@ -27969,7 +28072,7 @@ function OhhwellsBridge() {
|
|
|
27969
28072
|
},
|
|
27970
28073
|
[rememberButtonTokens]
|
|
27971
28074
|
);
|
|
27972
|
-
const openButtonStylePanel = (0,
|
|
28075
|
+
const openButtonStylePanel = (0, import_react23.useCallback)(
|
|
27973
28076
|
(anchor) => {
|
|
27974
28077
|
const id = buttonId(anchor);
|
|
27975
28078
|
if (!id) return;
|
|
@@ -27987,7 +28090,7 @@ function OhhwellsBridge() {
|
|
|
27987
28090
|
},
|
|
27988
28091
|
[tokensForButton]
|
|
27989
28092
|
);
|
|
27990
|
-
const applySelectedButtonStyle = (0,
|
|
28093
|
+
const applySelectedButtonStyle = (0, import_react23.useCallback)(
|
|
27991
28094
|
(patch) => {
|
|
27992
28095
|
const panel = floatingPanelRef.current;
|
|
27993
28096
|
const id = panel?.kind === "button-style" ? panel.buttonId : null;
|
|
@@ -28005,7 +28108,7 @@ function OhhwellsBridge() {
|
|
|
28005
28108
|
},
|
|
28006
28109
|
[postToParent2]
|
|
28007
28110
|
);
|
|
28008
|
-
(0,
|
|
28111
|
+
(0, import_react23.useEffect)(() => {
|
|
28009
28112
|
const onDragOver = (e) => {
|
|
28010
28113
|
const dragged = buttonCollectionDragRef.current;
|
|
28011
28114
|
if (!dragged) return;
|
|
@@ -28024,11 +28127,11 @@ function OhhwellsBridge() {
|
|
|
28024
28127
|
document.removeEventListener("drop", onDrop);
|
|
28025
28128
|
};
|
|
28026
28129
|
}, [refreshButtonDragVisuals]);
|
|
28027
|
-
const isEditModeRef = (0,
|
|
28028
|
-
const requestMissingSocialIconsRef = (0,
|
|
28130
|
+
const isEditModeRef = (0, import_react23.useRef)(false);
|
|
28131
|
+
const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
|
|
28029
28132
|
});
|
|
28030
|
-
const askedSocialIconsRef = (0,
|
|
28031
|
-
const requestMissingSocialIcons = (0,
|
|
28133
|
+
const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
|
|
28134
|
+
const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
|
|
28032
28135
|
const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
|
|
28033
28136
|
const missing = socialsMissingIcons(row);
|
|
28034
28137
|
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
@@ -28040,7 +28143,7 @@ function OhhwellsBridge() {
|
|
|
28040
28143
|
}, []);
|
|
28041
28144
|
requestMissingSocialIconsRef.current = requestMissingSocialIcons;
|
|
28042
28145
|
isEditModeRef.current = isEditMode;
|
|
28043
|
-
const changeSocialsDisplay = (0,
|
|
28146
|
+
const changeSocialsDisplay = (0, import_react23.useCallback)(
|
|
28044
28147
|
(row, next) => {
|
|
28045
28148
|
if (next.icon) {
|
|
28046
28149
|
const missing = socialsMissingIcons(row);
|
|
@@ -28064,19 +28167,19 @@ function OhhwellsBridge() {
|
|
|
28064
28167
|
},
|
|
28065
28168
|
[]
|
|
28066
28169
|
);
|
|
28067
|
-
const closeFloatingPanelOnly = (0,
|
|
28170
|
+
const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
|
|
28068
28171
|
setFloatingPanel(null);
|
|
28069
28172
|
setFloatingPanelPos(null);
|
|
28070
28173
|
setLogoSizeDraft(null);
|
|
28071
28174
|
}, []);
|
|
28072
28175
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28073
|
-
const closeFloatingPanelAndDeselect = (0,
|
|
28176
|
+
const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
|
|
28074
28177
|
setFloatingPanel(null);
|
|
28075
28178
|
setFloatingPanelPos(null);
|
|
28076
28179
|
setLogoSizeDraft(null);
|
|
28077
28180
|
deselectRef.current();
|
|
28078
28181
|
}, []);
|
|
28079
|
-
(0,
|
|
28182
|
+
(0, import_react23.useEffect)(() => {
|
|
28080
28183
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
28081
28184
|
if (!session || !logoSizeDraft) {
|
|
28082
28185
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28095,7 +28198,7 @@ function OhhwellsBridge() {
|
|
|
28095
28198
|
max: LOGO_SIZE_MAX
|
|
28096
28199
|
});
|
|
28097
28200
|
}, [floatingPanel, logoSizeDraft, editorViewport]);
|
|
28098
|
-
const persistLogoSizeDraft = (0,
|
|
28201
|
+
const persistLogoSizeDraft = (0, import_react23.useCallback)(
|
|
28099
28202
|
(placement, draft) => {
|
|
28100
28203
|
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
28101
28204
|
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
@@ -28135,7 +28238,7 @@ function OhhwellsBridge() {
|
|
|
28135
28238
|
},
|
|
28136
28239
|
[postToParent2]
|
|
28137
28240
|
);
|
|
28138
|
-
const activate = (0,
|
|
28241
|
+
const activate = (0, import_react23.useCallback)((el, options) => {
|
|
28139
28242
|
if (activeElRef.current === el) return;
|
|
28140
28243
|
document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
|
|
28141
28244
|
hovered.removeAttribute("data-ohw-hovered");
|
|
@@ -28233,8 +28336,8 @@ function OhhwellsBridge() {
|
|
|
28233
28336
|
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
28234
28337
|
deselectRef.current = deselect;
|
|
28235
28338
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28236
|
-
const lastSiteWideScopeRef = (0,
|
|
28237
|
-
(0,
|
|
28339
|
+
const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
|
|
28340
|
+
(0, import_react23.useEffect)(() => {
|
|
28238
28341
|
if (!isEditMode) {
|
|
28239
28342
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28240
28343
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28260,7 +28363,7 @@ function OhhwellsBridge() {
|
|
|
28260
28363
|
isFooterFrameSelection,
|
|
28261
28364
|
postToParent2
|
|
28262
28365
|
]);
|
|
28263
|
-
(0,
|
|
28366
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
28264
28367
|
if (!subdomain || isEditMode) {
|
|
28265
28368
|
setFetchState("done");
|
|
28266
28369
|
return;
|
|
@@ -28414,7 +28517,7 @@ function OhhwellsBridge() {
|
|
|
28414
28517
|
cancelled = true;
|
|
28415
28518
|
};
|
|
28416
28519
|
}, [subdomain, isEditMode]);
|
|
28417
|
-
(0,
|
|
28520
|
+
(0, import_react23.useEffect)(() => {
|
|
28418
28521
|
if (!isEditMode) return;
|
|
28419
28522
|
const resolveIndex = (form, clientY) => {
|
|
28420
28523
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28455,7 +28558,7 @@ function OhhwellsBridge() {
|
|
|
28455
28558
|
window.removeEventListener("drop", onDrop, true);
|
|
28456
28559
|
};
|
|
28457
28560
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28458
|
-
(0,
|
|
28561
|
+
(0, import_react23.useEffect)(() => {
|
|
28459
28562
|
if (!isEditMode) return;
|
|
28460
28563
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28461
28564
|
markFormFields(form);
|
|
@@ -28467,7 +28570,7 @@ function OhhwellsBridge() {
|
|
|
28467
28570
|
});
|
|
28468
28571
|
return () => observer.disconnect();
|
|
28469
28572
|
}, [isEditMode, fetchState, pathname]);
|
|
28470
|
-
(0,
|
|
28573
|
+
(0, import_react23.useEffect)(() => {
|
|
28471
28574
|
if (!isEditMode) return;
|
|
28472
28575
|
let saveTimer = null;
|
|
28473
28576
|
const onInput = (e) => {
|
|
@@ -28489,14 +28592,14 @@ function OhhwellsBridge() {
|
|
|
28489
28592
|
document.addEventListener("input", onInput, true);
|
|
28490
28593
|
return () => document.removeEventListener("input", onInput, true);
|
|
28491
28594
|
}, [isEditMode, persistFields]);
|
|
28492
|
-
(0,
|
|
28595
|
+
(0, import_react23.useEffect)(() => {
|
|
28493
28596
|
if (isEditMode || fetchState !== "done") return;
|
|
28494
28597
|
const content = contentCache.get(subdomain) ?? {};
|
|
28495
28598
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28496
28599
|
reconcileFieldsFromContent(form, content);
|
|
28497
28600
|
});
|
|
28498
28601
|
}, [isEditMode, fetchState, subdomain]);
|
|
28499
|
-
(0,
|
|
28602
|
+
(0, import_react23.useEffect)(() => {
|
|
28500
28603
|
if (!isEditMode) return;
|
|
28501
28604
|
const swallow = (e) => {
|
|
28502
28605
|
const target = e.target;
|
|
@@ -28505,14 +28608,14 @@ function OhhwellsBridge() {
|
|
|
28505
28608
|
document.addEventListener("submit", swallow, true);
|
|
28506
28609
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28507
28610
|
}, [isEditMode]);
|
|
28508
|
-
(0,
|
|
28611
|
+
(0, import_react23.useEffect)(() => {
|
|
28509
28612
|
if (isEditMode || fetchState !== "done") return;
|
|
28510
28613
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28511
28614
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28512
28615
|
console.log({ apiUrl, subdomain });
|
|
28513
28616
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28514
28617
|
}, [isEditMode, fetchState, subdomain]);
|
|
28515
|
-
(0,
|
|
28618
|
+
(0, import_react23.useEffect)(() => {
|
|
28516
28619
|
if (!subdomain || isEditMode) return;
|
|
28517
28620
|
let debounceTimer = null;
|
|
28518
28621
|
let observer = null;
|
|
@@ -28632,16 +28735,16 @@ function OhhwellsBridge() {
|
|
|
28632
28735
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28633
28736
|
};
|
|
28634
28737
|
}, [subdomain, isEditMode, pathname]);
|
|
28635
|
-
(0,
|
|
28738
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
28636
28739
|
const el = document.getElementById("ohw-loader");
|
|
28637
28740
|
if (!el) return;
|
|
28638
28741
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28639
28742
|
el.style.display = visible ? "flex" : "none";
|
|
28640
28743
|
}, [subdomain, fetchState]);
|
|
28641
|
-
(0,
|
|
28744
|
+
(0, import_react23.useEffect)(() => {
|
|
28642
28745
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28643
28746
|
}, [pathname, postToParent2]);
|
|
28644
|
-
(0,
|
|
28747
|
+
(0, import_react23.useEffect)(() => {
|
|
28645
28748
|
if (!subdomain || isEditMode) return;
|
|
28646
28749
|
const content = contentCache.get(subdomain);
|
|
28647
28750
|
if (!content) return;
|
|
@@ -28659,7 +28762,7 @@ function OhhwellsBridge() {
|
|
|
28659
28762
|
}
|
|
28660
28763
|
applyAiFooterFromContent(content);
|
|
28661
28764
|
}, [pathname, subdomain, isEditMode]);
|
|
28662
|
-
(0,
|
|
28765
|
+
(0, import_react23.useEffect)(() => {
|
|
28663
28766
|
if (!isEditMode) return;
|
|
28664
28767
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28665
28768
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28667,12 +28770,12 @@ function OhhwellsBridge() {
|
|
|
28667
28770
|
deselectRef.current();
|
|
28668
28771
|
deactivateRef.current();
|
|
28669
28772
|
}, [pathname, isEditMode]);
|
|
28670
|
-
(0,
|
|
28773
|
+
(0, import_react23.useEffect)(() => {
|
|
28671
28774
|
if (!isEditMode) return;
|
|
28672
28775
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28673
28776
|
initItemInstancesFromContent(editContentRef.current);
|
|
28674
28777
|
}, [pathname, isEditMode]);
|
|
28675
|
-
(0,
|
|
28778
|
+
(0, import_react23.useEffect)(() => {
|
|
28676
28779
|
if (!isEditMode) return;
|
|
28677
28780
|
const observer = new MutationObserver(() => {
|
|
28678
28781
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28683,7 +28786,7 @@ function OhhwellsBridge() {
|
|
|
28683
28786
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28684
28787
|
return () => observer.disconnect();
|
|
28685
28788
|
}, [isEditMode, pathname]);
|
|
28686
|
-
(0,
|
|
28789
|
+
(0, import_react23.useEffect)(() => {
|
|
28687
28790
|
const contentForNav = () => {
|
|
28688
28791
|
if (isEditMode) return editContentRef.current;
|
|
28689
28792
|
if (!subdomain) return {};
|
|
@@ -28756,7 +28859,7 @@ function OhhwellsBridge() {
|
|
|
28756
28859
|
observer?.disconnect();
|
|
28757
28860
|
};
|
|
28758
28861
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28759
|
-
(0,
|
|
28862
|
+
(0, import_react23.useEffect)(() => {
|
|
28760
28863
|
if (!isEditMode) return;
|
|
28761
28864
|
let applying = false;
|
|
28762
28865
|
let rafId = null;
|
|
@@ -28794,7 +28897,7 @@ function OhhwellsBridge() {
|
|
|
28794
28897
|
observer.disconnect();
|
|
28795
28898
|
};
|
|
28796
28899
|
}, [isEditMode, pathname]);
|
|
28797
|
-
(0,
|
|
28900
|
+
(0, import_react23.useEffect)(() => {
|
|
28798
28901
|
if (!isEditMode) return;
|
|
28799
28902
|
let lastPosted = 0;
|
|
28800
28903
|
const measure = () => {
|
|
@@ -28823,7 +28926,7 @@ function OhhwellsBridge() {
|
|
|
28823
28926
|
ro.disconnect();
|
|
28824
28927
|
};
|
|
28825
28928
|
}, [pathname, isEditMode, postToParent2]);
|
|
28826
|
-
(0,
|
|
28929
|
+
(0, import_react23.useEffect)(() => {
|
|
28827
28930
|
if (isEditMode) return;
|
|
28828
28931
|
const handleClick = (e) => {
|
|
28829
28932
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28837,7 +28940,7 @@ function OhhwellsBridge() {
|
|
|
28837
28940
|
document.addEventListener("click", handleClick, true);
|
|
28838
28941
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28839
28942
|
}, [isEditMode, router, pathname]);
|
|
28840
|
-
(0,
|
|
28943
|
+
(0, import_react23.useEffect)(() => {
|
|
28841
28944
|
if (!isEditMode) {
|
|
28842
28945
|
editStylesRef.current?.base.remove();
|
|
28843
28946
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -32320,7 +32423,7 @@ function OhhwellsBridge() {
|
|
|
32320
32423
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32321
32424
|
};
|
|
32322
32425
|
}, [isEditMode, refreshStateRules]);
|
|
32323
|
-
(0,
|
|
32426
|
+
(0, import_react23.useEffect)(() => {
|
|
32324
32427
|
if (!isEditMode) return;
|
|
32325
32428
|
const THRESHOLD = 10;
|
|
32326
32429
|
const resolveWasSelected = (el) => {
|
|
@@ -32476,7 +32579,7 @@ function OhhwellsBridge() {
|
|
|
32476
32579
|
unlockFooterDragInteraction();
|
|
32477
32580
|
};
|
|
32478
32581
|
}, [isEditMode]);
|
|
32479
|
-
(0,
|
|
32582
|
+
(0, import_react23.useEffect)(() => {
|
|
32480
32583
|
if (!isEditMode) return;
|
|
32481
32584
|
const THRESHOLD = 10;
|
|
32482
32585
|
const onPointerDown = (e) => {
|
|
@@ -32567,7 +32670,7 @@ function OhhwellsBridge() {
|
|
|
32567
32670
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32568
32671
|
};
|
|
32569
32672
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32570
|
-
(0,
|
|
32673
|
+
(0, import_react23.useEffect)(() => {
|
|
32571
32674
|
const handler = (e) => {
|
|
32572
32675
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32573
32676
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32583,7 +32686,7 @@ function OhhwellsBridge() {
|
|
|
32583
32686
|
window.addEventListener("message", handler);
|
|
32584
32687
|
return () => window.removeEventListener("message", handler);
|
|
32585
32688
|
}, [processConfigRequest]);
|
|
32586
|
-
(0,
|
|
32689
|
+
(0, import_react23.useEffect)(() => {
|
|
32587
32690
|
if (!isEditMode) return;
|
|
32588
32691
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32589
32692
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32607,7 +32710,7 @@ function OhhwellsBridge() {
|
|
|
32607
32710
|
postToParent2({
|
|
32608
32711
|
type: "ow:ready",
|
|
32609
32712
|
version: "1",
|
|
32610
|
-
bridgeVersion: "0.1.160-next.
|
|
32713
|
+
bridgeVersion: "0.1.160-next.429",
|
|
32611
32714
|
path: pathname,
|
|
32612
32715
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32613
32716
|
sections
|
|
@@ -32619,13 +32722,13 @@ function OhhwellsBridge() {
|
|
|
32619
32722
|
clearTimeout(timer);
|
|
32620
32723
|
};
|
|
32621
32724
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32622
|
-
(0,
|
|
32725
|
+
(0, import_react23.useEffect)(() => {
|
|
32623
32726
|
scrollToHashSectionWhenReady();
|
|
32624
32727
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32625
32728
|
window.addEventListener("hashchange", onHashChange);
|
|
32626
32729
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
32627
32730
|
}, [pathname]);
|
|
32628
|
-
const handleCommand = (0,
|
|
32731
|
+
const handleCommand = (0, import_react23.useCallback)((cmd) => {
|
|
32629
32732
|
const el = activeElRef.current;
|
|
32630
32733
|
const selBefore = window.getSelection();
|
|
32631
32734
|
let savedOffsets = null;
|
|
@@ -32661,7 +32764,7 @@ function OhhwellsBridge() {
|
|
|
32661
32764
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32662
32765
|
refreshActiveCommandsRef.current();
|
|
32663
32766
|
}, []);
|
|
32664
|
-
(0,
|
|
32767
|
+
(0, import_react23.useEffect)(() => {
|
|
32665
32768
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32666
32769
|
if (!session || !logoSizeDraft) return;
|
|
32667
32770
|
const onPanelAction = (e) => {
|
|
@@ -32699,7 +32802,7 @@ function OhhwellsBridge() {
|
|
|
32699
32802
|
window.addEventListener("message", onPanelAction);
|
|
32700
32803
|
return () => window.removeEventListener("message", onPanelAction);
|
|
32701
32804
|
}, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
|
|
32702
|
-
const handleStateChange = (0,
|
|
32805
|
+
const handleStateChange = (0, import_react23.useCallback)((state) => {
|
|
32703
32806
|
if (!activeStateElRef.current) return;
|
|
32704
32807
|
const el = activeStateElRef.current;
|
|
32705
32808
|
if (state === "Default") {
|
|
@@ -32712,7 +32815,7 @@ function OhhwellsBridge() {
|
|
|
32712
32815
|
}
|
|
32713
32816
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
32714
32817
|
}, [deactivate]);
|
|
32715
|
-
const reselectAfterLinkPopover = (0,
|
|
32818
|
+
const reselectAfterLinkPopover = (0, import_react23.useCallback)(
|
|
32716
32819
|
(hrefKey) => {
|
|
32717
32820
|
requestAnimationFrame(() => {
|
|
32718
32821
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -32721,7 +32824,7 @@ function OhhwellsBridge() {
|
|
|
32721
32824
|
},
|
|
32722
32825
|
[resolveHrefKeyElement]
|
|
32723
32826
|
);
|
|
32724
|
-
const closeLinkPopover = (0,
|
|
32827
|
+
const closeLinkPopover = (0, import_react23.useCallback)(() => {
|
|
32725
32828
|
const session = linkPopoverSessionRef.current;
|
|
32726
32829
|
addNavAfterAnchorRef.current = null;
|
|
32727
32830
|
setLinkPopover(null);
|
|
@@ -32729,9 +32832,9 @@ function OhhwellsBridge() {
|
|
|
32729
32832
|
reselectAfterLinkPopover(session.key);
|
|
32730
32833
|
}
|
|
32731
32834
|
}, [reselectAfterLinkPopover]);
|
|
32732
|
-
const closeLinkPopoverRef = (0,
|
|
32835
|
+
const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
|
|
32733
32836
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
32734
|
-
const openLinkPopoverForActive = (0,
|
|
32837
|
+
const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
|
|
32735
32838
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
32736
32839
|
if (!hrefCtx) return;
|
|
32737
32840
|
bumpLinkPopoverGrace();
|
|
@@ -32742,7 +32845,7 @@ function OhhwellsBridge() {
|
|
|
32742
32845
|
});
|
|
32743
32846
|
deactivate();
|
|
32744
32847
|
}, [deactivate]);
|
|
32745
|
-
const openLinkPopoverForSelected = (0,
|
|
32848
|
+
const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
|
|
32746
32849
|
const anchor = selectedElRef.current;
|
|
32747
32850
|
if (!anchor) return;
|
|
32748
32851
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -32759,7 +32862,7 @@ function OhhwellsBridge() {
|
|
|
32759
32862
|
});
|
|
32760
32863
|
deselect();
|
|
32761
32864
|
}, [deselect]);
|
|
32762
|
-
const handleSelectParent = (0,
|
|
32865
|
+
const handleSelectParent = (0, import_react23.useCallback)(() => {
|
|
32763
32866
|
const selected = selectedElRef.current;
|
|
32764
32867
|
if (!selected) return;
|
|
32765
32868
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -32786,7 +32889,7 @@ function OhhwellsBridge() {
|
|
|
32786
32889
|
}
|
|
32787
32890
|
deselectRef.current();
|
|
32788
32891
|
}, []);
|
|
32789
|
-
const handleDuplicateSelected = (0,
|
|
32892
|
+
const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
|
|
32790
32893
|
const selected = selectedElRef.current;
|
|
32791
32894
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
32792
32895
|
if (isCtaButton(selected)) {
|
|
@@ -32955,7 +33058,7 @@ function OhhwellsBridge() {
|
|
|
32955
33058
|
});
|
|
32956
33059
|
}
|
|
32957
33060
|
}, [postToParent2, tokensForButton]);
|
|
32958
|
-
const runPendingDeleteUndo = (0,
|
|
33061
|
+
const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
|
|
32959
33062
|
const pending = pendingDeleteUndoRef.current;
|
|
32960
33063
|
if (!pending) return false;
|
|
32961
33064
|
pendingDeleteUndoRef.current = null;
|
|
@@ -32963,7 +33066,7 @@ function OhhwellsBridge() {
|
|
|
32963
33066
|
enforceLinkHrefs();
|
|
32964
33067
|
return true;
|
|
32965
33068
|
}, []);
|
|
32966
|
-
const handleDeleteSelected = (0,
|
|
33069
|
+
const handleDeleteSelected = (0, import_react23.useCallback)(() => {
|
|
32967
33070
|
const selected = selectedElRef.current;
|
|
32968
33071
|
if (!selected) return false;
|
|
32969
33072
|
if (isCtaButton(selected)) {
|
|
@@ -33025,7 +33128,7 @@ function OhhwellsBridge() {
|
|
|
33025
33128
|
}, [postToParent2]);
|
|
33026
33129
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
33027
33130
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
33028
|
-
const handleLinkPopoverSubmit = (0,
|
|
33131
|
+
const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
|
|
33029
33132
|
(target) => {
|
|
33030
33133
|
const session = linkPopoverSessionRef.current;
|
|
33031
33134
|
if (!session) return;
|
|
@@ -33091,14 +33194,14 @@ function OhhwellsBridge() {
|
|
|
33091
33194
|
const showEditLink = toolbarShowEditLink;
|
|
33092
33195
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
33093
33196
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
33094
|
-
const handleMediaSelect = (0,
|
|
33197
|
+
const handleMediaSelect = (0, import_react23.useCallback)((key) => {
|
|
33095
33198
|
const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
|
|
33096
33199
|
(m) => (m.dataset.ohwKey ?? "") === key
|
|
33097
33200
|
) ?? null;
|
|
33098
33201
|
if (!el) return;
|
|
33099
33202
|
selectMediaElementRef.current(el);
|
|
33100
33203
|
}, []);
|
|
33101
|
-
const handleMediaReplace = (0,
|
|
33204
|
+
const handleMediaReplace = (0, import_react23.useCallback)(
|
|
33102
33205
|
(key) => {
|
|
33103
33206
|
postToParent2({
|
|
33104
33207
|
type: "ow:image-pick",
|
|
@@ -33108,13 +33211,13 @@ function OhhwellsBridge() {
|
|
|
33108
33211
|
},
|
|
33109
33212
|
[postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
|
|
33110
33213
|
);
|
|
33111
|
-
const handleEditCarousel = (0,
|
|
33214
|
+
const handleEditCarousel = (0, import_react23.useCallback)(
|
|
33112
33215
|
(key) => {
|
|
33113
33216
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
33114
33217
|
},
|
|
33115
33218
|
[postToParent2]
|
|
33116
33219
|
);
|
|
33117
|
-
const handleMediaFadeOutComplete = (0,
|
|
33220
|
+
const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
|
|
33118
33221
|
setUploadingRects((prev) => {
|
|
33119
33222
|
if (!(key in prev)) return prev;
|
|
33120
33223
|
const next = { ...prev };
|
|
@@ -33122,7 +33225,7 @@ function OhhwellsBridge() {
|
|
|
33122
33225
|
return next;
|
|
33123
33226
|
});
|
|
33124
33227
|
}, []);
|
|
33125
|
-
const handleVideoSettingsChange = (0,
|
|
33228
|
+
const handleVideoSettingsChange = (0, import_react23.useCallback)(
|
|
33126
33229
|
(key, settings) => {
|
|
33127
33230
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
33128
33231
|
const video = getVideoEl2(el);
|