@ohhwells/bridge 0.1.166 → 0.1.167
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 +641 -528
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +233 -122
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -108,6 +108,8 @@ __export(index_exports, {
|
|
|
108
108
|
serializeAiFooterState: () => serializeAiFooterState,
|
|
109
109
|
shouldFetchContentForPath: () => shouldFetchContentForPath,
|
|
110
110
|
stepViableSlide: () => stepViableSlide,
|
|
111
|
+
stripPlaceholderText: () => stripPlaceholderText,
|
|
112
|
+
stripPlaceholders: () => stripPlaceholders,
|
|
111
113
|
stripTextAlignCss: () => stripTextAlignCss,
|
|
112
114
|
toggleVariants: () => toggleVariants,
|
|
113
115
|
useOhwCarousel: () => useOhwCarousel,
|
|
@@ -117,7 +119,7 @@ __export(index_exports, {
|
|
|
117
119
|
module.exports = __toCommonJS(index_exports);
|
|
118
120
|
|
|
119
121
|
// src/OhhwellsBridge.tsx
|
|
120
|
-
var
|
|
122
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
121
123
|
var import_client3 = require("react-dom/client");
|
|
122
124
|
var import_react_dom5 = require("react-dom");
|
|
123
125
|
|
|
@@ -12266,11 +12268,119 @@ function useHashLinkScroll(isEditMode) {
|
|
|
12266
12268
|
}, [isEditMode]);
|
|
12267
12269
|
}
|
|
12268
12270
|
|
|
12271
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12272
|
+
var import_react7 = require("react");
|
|
12273
|
+
|
|
12274
|
+
// src/lib/strip-placeholders.ts
|
|
12275
|
+
var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
12276
|
+
var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
|
|
12277
|
+
var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
|
|
12278
|
+
var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
|
|
12279
|
+
var HIDDEN_ATTR2 = "data-ohw-placeholder-hidden";
|
|
12280
|
+
function hasPlaceholder(text) {
|
|
12281
|
+
return HAS_PLACEHOLDER_RE.test(text);
|
|
12282
|
+
}
|
|
12283
|
+
function stripPlaceholderText(text) {
|
|
12284
|
+
if (!hasPlaceholder(text)) return text;
|
|
12285
|
+
const lead = text.match(/^\s*/)?.[0] ?? "";
|
|
12286
|
+
const trail = lead.length === text.length ? "" : text.match(/\s*$/)?.[0] ?? "";
|
|
12287
|
+
const body = text.slice(lead.length, text.length - trail.length).replace(PLACEHOLDER_RE, "").replace(/\(\s*\)|\[\s*\]/g, "").replace(/[ \t]{2,}/g, " ").replace(/[ \t]+([.,;:!?])/g, "$1").trim();
|
|
12288
|
+
return body ? `${lead}${body}${trail}` : lead || trail ? " " : "";
|
|
12289
|
+
}
|
|
12290
|
+
function skipped(el) {
|
|
12291
|
+
for (let node = el; node; node = node.parentElement) {
|
|
12292
|
+
if (SKIPPED_TAGS.has(node.tagName)) return true;
|
|
12293
|
+
}
|
|
12294
|
+
return false;
|
|
12295
|
+
}
|
|
12296
|
+
function hideIfEmptied(el) {
|
|
12297
|
+
const control = el?.closest("a, button");
|
|
12298
|
+
if (!control || control.hasAttribute(HIDDEN_ATTR2)) return;
|
|
12299
|
+
if ((control.textContent ?? "").trim()) return;
|
|
12300
|
+
if (control.querySelector("img, svg, picture, video")) return;
|
|
12301
|
+
control.setAttribute(HIDDEN_ATTR2, "");
|
|
12302
|
+
control.style.display = "none";
|
|
12303
|
+
}
|
|
12304
|
+
function stripElementAttrs(el) {
|
|
12305
|
+
let changed = false;
|
|
12306
|
+
const href = el.getAttribute("href");
|
|
12307
|
+
if (href && hasPlaceholder(decodeSafely(href))) {
|
|
12308
|
+
el.removeAttribute("href");
|
|
12309
|
+
changed = true;
|
|
12310
|
+
}
|
|
12311
|
+
for (const name of TEXT_ATTRS) {
|
|
12312
|
+
const value = el.getAttribute(name);
|
|
12313
|
+
if (value && hasPlaceholder(value)) {
|
|
12314
|
+
el.setAttribute(name, stripPlaceholderText(value).trim());
|
|
12315
|
+
changed = true;
|
|
12316
|
+
}
|
|
12317
|
+
}
|
|
12318
|
+
return changed;
|
|
12319
|
+
}
|
|
12320
|
+
function decodeSafely(value) {
|
|
12321
|
+
try {
|
|
12322
|
+
return decodeURIComponent(value);
|
|
12323
|
+
} catch {
|
|
12324
|
+
return value;
|
|
12325
|
+
}
|
|
12326
|
+
}
|
|
12327
|
+
function stripPlaceholders(root) {
|
|
12328
|
+
const doc = root.ownerDocument ?? root;
|
|
12329
|
+
let changed = 0;
|
|
12330
|
+
if (root.nodeType === 3) {
|
|
12331
|
+
return stripTextNode(root) ? 1 : 0;
|
|
12332
|
+
}
|
|
12333
|
+
if (root.nodeType !== 1 && root.nodeType !== 9) return 0;
|
|
12334
|
+
const rootEl = root.nodeType === 1 ? root : root.documentElement;
|
|
12335
|
+
if (!rootEl || skipped(rootEl)) return 0;
|
|
12336
|
+
for (const el of [rootEl, ...Array.from(rootEl.querySelectorAll("[href], [alt], [title], [aria-label], [placeholder]"))]) {
|
|
12337
|
+
if (!skipped(el) && stripElementAttrs(el)) changed++;
|
|
12338
|
+
}
|
|
12339
|
+
const walker = doc.createTreeWalker(rootEl, 4);
|
|
12340
|
+
const texts = [];
|
|
12341
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
12342
|
+
if (node.nodeValue && node.nodeValue.includes("[")) texts.push(node);
|
|
12343
|
+
}
|
|
12344
|
+
for (const node of texts) {
|
|
12345
|
+
if (stripTextNode(node)) changed++;
|
|
12346
|
+
}
|
|
12347
|
+
return changed;
|
|
12348
|
+
}
|
|
12349
|
+
function stripTextNode(node) {
|
|
12350
|
+
const value = node.nodeValue ?? "";
|
|
12351
|
+
if (!value.includes("[") || !hasPlaceholder(value) || skipped(node.parentElement)) return false;
|
|
12352
|
+
node.nodeValue = stripPlaceholderText(value);
|
|
12353
|
+
hideIfEmptied(node.parentElement);
|
|
12354
|
+
return true;
|
|
12355
|
+
}
|
|
12356
|
+
|
|
12357
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12358
|
+
function usePublishedPlaceholderStrip(isEditMode) {
|
|
12359
|
+
(0, import_react7.useEffect)(() => {
|
|
12360
|
+
if (isEditMode) return;
|
|
12361
|
+
stripPlaceholders(document.body);
|
|
12362
|
+
const observer = new MutationObserver((records) => {
|
|
12363
|
+
for (const record of records) {
|
|
12364
|
+
if (record.type === "childList") record.addedNodes.forEach((node) => stripPlaceholders(node));
|
|
12365
|
+
else stripPlaceholders(record.target);
|
|
12366
|
+
}
|
|
12367
|
+
});
|
|
12368
|
+
observer.observe(document.body, {
|
|
12369
|
+
childList: true,
|
|
12370
|
+
subtree: true,
|
|
12371
|
+
characterData: true,
|
|
12372
|
+
attributes: true,
|
|
12373
|
+
attributeFilter: ["href", "alt", "title", "aria-label", "placeholder"]
|
|
12374
|
+
});
|
|
12375
|
+
return () => observer.disconnect();
|
|
12376
|
+
}, [isEditMode]);
|
|
12377
|
+
}
|
|
12378
|
+
|
|
12269
12379
|
// src/ui/SchedulingWidget.tsx
|
|
12270
|
-
var
|
|
12380
|
+
var import_react9 = require("react");
|
|
12271
12381
|
|
|
12272
12382
|
// src/ui/EmailCaptureModal.tsx
|
|
12273
|
-
var
|
|
12383
|
+
var import_react8 = require("react");
|
|
12274
12384
|
var import_radix_ui = require("radix-ui");
|
|
12275
12385
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
12276
12386
|
var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
@@ -12300,11 +12410,11 @@ function Spinner() {
|
|
|
12300
12410
|
);
|
|
12301
12411
|
}
|
|
12302
12412
|
function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
|
|
12303
|
-
const [email, setEmail] = (0,
|
|
12304
|
-
const [submittedEmail, setSubmittedEmail] = (0,
|
|
12305
|
-
const [loading, setLoading] = (0,
|
|
12306
|
-
const [success, setSuccess] = (0,
|
|
12307
|
-
const [error, setError] = (0,
|
|
12413
|
+
const [email, setEmail] = (0, import_react8.useState)("");
|
|
12414
|
+
const [submittedEmail, setSubmittedEmail] = (0, import_react8.useState)("");
|
|
12415
|
+
const [loading, setLoading] = (0, import_react8.useState)(false);
|
|
12416
|
+
const [success, setSuccess] = (0, import_react8.useState)(false);
|
|
12417
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
12308
12418
|
const isBook = title === "Confirm your spot";
|
|
12309
12419
|
const handleSubmit = async () => {
|
|
12310
12420
|
const trimmed = email.trim();
|
|
@@ -12571,21 +12681,21 @@ function LoadingSkeleton() {
|
|
|
12571
12681
|
] });
|
|
12572
12682
|
}
|
|
12573
12683
|
function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
|
|
12574
|
-
const todayMs = (0,
|
|
12684
|
+
const todayMs = (0, import_react9.useMemo)(() => {
|
|
12575
12685
|
const d = /* @__PURE__ */ new Date();
|
|
12576
12686
|
d.setHours(0, 0, 0, 0);
|
|
12577
12687
|
return d.getTime();
|
|
12578
12688
|
}, []);
|
|
12579
|
-
const scrollRef = (0,
|
|
12580
|
-
const [canScrollLeft, setCanScrollLeft] = (0,
|
|
12581
|
-
const [canScrollRight, setCanScrollRight] = (0,
|
|
12689
|
+
const scrollRef = (0, import_react9.useRef)(null);
|
|
12690
|
+
const [canScrollLeft, setCanScrollLeft] = (0, import_react9.useState)(false);
|
|
12691
|
+
const [canScrollRight, setCanScrollRight] = (0, import_react9.useState)(false);
|
|
12582
12692
|
const updateScrollState = () => {
|
|
12583
12693
|
const el = scrollRef.current;
|
|
12584
12694
|
if (!el) return;
|
|
12585
12695
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
12586
12696
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
12587
12697
|
};
|
|
12588
|
-
(0,
|
|
12698
|
+
(0, import_react9.useEffect)(() => {
|
|
12589
12699
|
const el = scrollRef.current;
|
|
12590
12700
|
if (!el) return;
|
|
12591
12701
|
updateScrollState();
|
|
@@ -12600,9 +12710,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12600
12710
|
const scroll = (dir) => {
|
|
12601
12711
|
scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
|
|
12602
12712
|
};
|
|
12603
|
-
const isDragging = (0,
|
|
12604
|
-
const dragStartX = (0,
|
|
12605
|
-
const dragStartScrollLeft = (0,
|
|
12713
|
+
const isDragging = (0, import_react9.useRef)(false);
|
|
12714
|
+
const dragStartX = (0, import_react9.useRef)(0);
|
|
12715
|
+
const dragStartScrollLeft = (0, import_react9.useRef)(0);
|
|
12606
12716
|
const onDragStart = (e) => {
|
|
12607
12717
|
if (!scrollRef.current) return;
|
|
12608
12718
|
isDragging.current = true;
|
|
@@ -12622,14 +12732,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12622
12732
|
scrollRef.current.style.cursor = "grab";
|
|
12623
12733
|
scrollRef.current.style.userSelect = "";
|
|
12624
12734
|
};
|
|
12625
|
-
const datesWithClasses = (0,
|
|
12735
|
+
const datesWithClasses = (0, import_react9.useMemo)(
|
|
12626
12736
|
() => new Set(dates.map(
|
|
12627
12737
|
(d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
|
|
12628
12738
|
).filter((i) => i >= 0)),
|
|
12629
12739
|
[dates, schedule]
|
|
12630
12740
|
);
|
|
12631
12741
|
const selectedDate = dates[selectedIdx];
|
|
12632
|
-
const selectedClasses = (0,
|
|
12742
|
+
const selectedClasses = (0, import_react9.useMemo)(
|
|
12633
12743
|
() => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
|
|
12634
12744
|
[schedule, selectedDate]
|
|
12635
12745
|
);
|
|
@@ -12814,16 +12924,16 @@ function CalendarFoldIcon() {
|
|
|
12814
12924
|
);
|
|
12815
12925
|
}
|
|
12816
12926
|
function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
|
|
12817
|
-
const autoId = (0,
|
|
12927
|
+
const autoId = (0, import_react9.useId)();
|
|
12818
12928
|
const insertAfter = insertAfterProp ?? autoId;
|
|
12819
|
-
const [schedule, setSchedule] = (0,
|
|
12820
|
-
const [loading, setLoading] = (0,
|
|
12821
|
-
const [inEditor, setInEditor] = (0,
|
|
12822
|
-
const [isHovered, setIsHovered] = (0,
|
|
12823
|
-
const [modalState, setModalState] = (0,
|
|
12824
|
-
const switchScheduleIdRef = (0,
|
|
12825
|
-
const liveScheduleIdRef = (0,
|
|
12826
|
-
const refetchLiveSchedule = (0,
|
|
12929
|
+
const [schedule, setSchedule] = (0, import_react9.useState)(null);
|
|
12930
|
+
const [loading, setLoading] = (0, import_react9.useState)(initialScheduleId !== null);
|
|
12931
|
+
const [inEditor, setInEditor] = (0, import_react9.useState)(false);
|
|
12932
|
+
const [isHovered, setIsHovered] = (0, import_react9.useState)(false);
|
|
12933
|
+
const [modalState, setModalState] = (0, import_react9.useState)(null);
|
|
12934
|
+
const switchScheduleIdRef = (0, import_react9.useRef)(null);
|
|
12935
|
+
const liveScheduleIdRef = (0, import_react9.useRef)(null);
|
|
12936
|
+
const refetchLiveSchedule = (0, import_react9.useCallback)(async () => {
|
|
12827
12937
|
const id = liveScheduleIdRef.current;
|
|
12828
12938
|
if (!id) return;
|
|
12829
12939
|
try {
|
|
@@ -12833,7 +12943,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12833
12943
|
} catch {
|
|
12834
12944
|
}
|
|
12835
12945
|
}, []);
|
|
12836
|
-
const dates = (0,
|
|
12946
|
+
const dates = (0, import_react9.useMemo)(() => {
|
|
12837
12947
|
const today = /* @__PURE__ */ new Date();
|
|
12838
12948
|
today.setHours(0, 0, 0, 0);
|
|
12839
12949
|
return Array.from({ length: 14 }, (_, i) => {
|
|
@@ -12842,8 +12952,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12842
12952
|
return d;
|
|
12843
12953
|
});
|
|
12844
12954
|
}, []);
|
|
12845
|
-
const [selectedIdx, setSelectedIdx] = (0,
|
|
12846
|
-
(0,
|
|
12955
|
+
const [selectedIdx, setSelectedIdx] = (0, import_react9.useState)(0);
|
|
12956
|
+
(0, import_react9.useEffect)(() => {
|
|
12847
12957
|
if (!schedule?.classes) return;
|
|
12848
12958
|
for (let i = 0; i < dates.length; i++) {
|
|
12849
12959
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -12852,7 +12962,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12852
12962
|
}
|
|
12853
12963
|
}
|
|
12854
12964
|
}, [schedule, dates]);
|
|
12855
|
-
(0,
|
|
12965
|
+
(0, import_react9.useEffect)(() => {
|
|
12856
12966
|
if (typeof window === "undefined") return;
|
|
12857
12967
|
const onVisible = () => {
|
|
12858
12968
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -12864,7 +12974,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12864
12974
|
document.removeEventListener("visibilitychange", onVisible);
|
|
12865
12975
|
};
|
|
12866
12976
|
}, [refetchLiveSchedule]);
|
|
12867
|
-
(0,
|
|
12977
|
+
(0, import_react9.useEffect)(() => {
|
|
12868
12978
|
if (typeof window === "undefined") return;
|
|
12869
12979
|
const isInEditor = window.self !== window.top;
|
|
12870
12980
|
setInEditor(isInEditor);
|
|
@@ -16619,7 +16729,7 @@ var CustomToolbarButton = React5.forwardRef(
|
|
|
16619
16729
|
CustomToolbarButton.displayName = "CustomToolbarButton";
|
|
16620
16730
|
|
|
16621
16731
|
// src/ui/item-action-toolbar.tsx
|
|
16622
|
-
var
|
|
16732
|
+
var import_react10 = require("react");
|
|
16623
16733
|
var import_lucide_react3 = require("lucide-react");
|
|
16624
16734
|
|
|
16625
16735
|
// src/ui/dropdown-menu.tsx
|
|
@@ -16804,7 +16914,7 @@ function ItemActionToolbar({
|
|
|
16804
16914
|
headingVisible = null,
|
|
16805
16915
|
onHeadingVisibleChange
|
|
16806
16916
|
}) {
|
|
16807
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
16917
|
+
const [moreOpen, setMoreOpen] = (0, import_react10.useState)(false);
|
|
16808
16918
|
const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
|
|
16809
16919
|
const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
|
|
16810
16920
|
const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
|
|
@@ -17012,7 +17122,7 @@ function ItemActionToolbar({
|
|
|
17012
17122
|
}
|
|
17013
17123
|
|
|
17014
17124
|
// src/ui/item-interaction-layer.tsx
|
|
17015
|
-
var
|
|
17125
|
+
var import_react11 = require("react");
|
|
17016
17126
|
var import_react_dom3 = require("react-dom");
|
|
17017
17127
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
17018
17128
|
var PRIMARY = "var(--ohw-primary, #0885FE)";
|
|
@@ -17069,8 +17179,8 @@ function ClampedToolbarSlot({
|
|
|
17069
17179
|
align = "center",
|
|
17070
17180
|
children
|
|
17071
17181
|
}) {
|
|
17072
|
-
const slotRef = (0,
|
|
17073
|
-
(0,
|
|
17182
|
+
const slotRef = (0, import_react11.useRef)(null);
|
|
17183
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
17074
17184
|
const slot = slotRef.current;
|
|
17075
17185
|
if (!slot) return;
|
|
17076
17186
|
const clamp = () => {
|
|
@@ -17133,15 +17243,15 @@ function DetachedBelowToolbarSlot({
|
|
|
17133
17243
|
belowEl,
|
|
17134
17244
|
children
|
|
17135
17245
|
}) {
|
|
17136
|
-
const slotRef = (0,
|
|
17137
|
-
const [anchorBottom, setAnchorBottom] = (0,
|
|
17138
|
-
const [portalTarget] = (0,
|
|
17246
|
+
const slotRef = (0, import_react11.useRef)(null);
|
|
17247
|
+
const [anchorBottom, setAnchorBottom] = (0, import_react11.useState)(belowRect.bottom);
|
|
17248
|
+
const [portalTarget] = (0, import_react11.useState)(
|
|
17139
17249
|
() => typeof document === "undefined" ? null : document.querySelector("[data-ohw-bridge-root]") ?? document.body
|
|
17140
17250
|
);
|
|
17141
|
-
(0,
|
|
17251
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
17142
17252
|
setAnchorBottom(belowRect.bottom);
|
|
17143
17253
|
}, [belowRect.bottom, belowRect.height, belowRect.top]);
|
|
17144
|
-
(0,
|
|
17254
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
17145
17255
|
const slot = slotRef.current;
|
|
17146
17256
|
if (!slot) return;
|
|
17147
17257
|
const sync = () => {
|
|
@@ -17222,8 +17332,8 @@ function ItemInteractionLayer({
|
|
|
17222
17332
|
hidden = false,
|
|
17223
17333
|
className
|
|
17224
17334
|
}) {
|
|
17225
|
-
const localRef = (0,
|
|
17226
|
-
(0,
|
|
17335
|
+
const localRef = (0, import_react11.useRef)(null);
|
|
17336
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
17227
17337
|
const node = localRef.current;
|
|
17228
17338
|
if (!node) return;
|
|
17229
17339
|
node.style.display = hidden ? "none" : "block";
|
|
@@ -17401,7 +17511,7 @@ function clearSubmitError(form) {
|
|
|
17401
17511
|
if (note) note.style.display = "none";
|
|
17402
17512
|
}
|
|
17403
17513
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17404
|
-
var
|
|
17514
|
+
var HIDDEN_ATTR3 = "data-ohw-form-hidden";
|
|
17405
17515
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17406
17516
|
function formSuccessKey(formKey) {
|
|
17407
17517
|
return `${formKey}-success`;
|
|
@@ -17427,13 +17537,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17427
17537
|
Array.from(form.children).forEach((child) => {
|
|
17428
17538
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17429
17539
|
if (state === "success") {
|
|
17430
|
-
if (!child.hasAttribute(
|
|
17431
|
-
child.setAttribute(
|
|
17540
|
+
if (!child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17541
|
+
child.setAttribute(HIDDEN_ATTR3, child.style.display);
|
|
17432
17542
|
child.style.display = "none";
|
|
17433
17543
|
}
|
|
17434
|
-
} else if (child.hasAttribute(
|
|
17435
|
-
child.style.display = child.getAttribute(
|
|
17436
|
-
child.removeAttribute(
|
|
17544
|
+
} else if (child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17545
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
|
|
17546
|
+
child.removeAttribute(HIDDEN_ATTR3);
|
|
17437
17547
|
}
|
|
17438
17548
|
});
|
|
17439
17549
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17498,7 +17608,7 @@ function apiBase() {
|
|
|
17498
17608
|
function bridgeVersion() {
|
|
17499
17609
|
try {
|
|
17500
17610
|
if (true) {
|
|
17501
|
-
return "0.1.
|
|
17611
|
+
return "0.1.167";
|
|
17502
17612
|
}
|
|
17503
17613
|
} catch {
|
|
17504
17614
|
}
|
|
@@ -17512,7 +17622,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17512
17622
|
return;
|
|
17513
17623
|
}
|
|
17514
17624
|
try {
|
|
17515
|
-
const v = true ? "0.1.
|
|
17625
|
+
const v = true ? "0.1.167" : "";
|
|
17516
17626
|
if (v) {
|
|
17517
17627
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17518
17628
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18419,7 +18529,7 @@ function CarouselOverlay({
|
|
|
18419
18529
|
}
|
|
18420
18530
|
|
|
18421
18531
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18422
|
-
var
|
|
18532
|
+
var import_react12 = require("react");
|
|
18423
18533
|
var import_lucide_react7 = require("lucide-react");
|
|
18424
18534
|
|
|
18425
18535
|
// src/lib/ai-change-highlight.ts
|
|
@@ -18514,8 +18624,8 @@ function readRect(instanceId) {
|
|
|
18514
18624
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18515
18625
|
}
|
|
18516
18626
|
function useLiveSectionRect(sectionId) {
|
|
18517
|
-
const [rect, setRect] = (0,
|
|
18518
|
-
(0,
|
|
18627
|
+
const [rect, setRect] = (0, import_react12.useState)(null);
|
|
18628
|
+
(0, import_react12.useEffect)(() => {
|
|
18519
18629
|
if (!sectionId) {
|
|
18520
18630
|
setRect(null);
|
|
18521
18631
|
return;
|
|
@@ -18554,8 +18664,8 @@ function readNavToggleRect() {
|
|
|
18554
18664
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18555
18665
|
}
|
|
18556
18666
|
function useLiveNavToggleHole(active) {
|
|
18557
|
-
const [rect, setRect] = (0,
|
|
18558
|
-
(0,
|
|
18667
|
+
const [rect, setRect] = (0, import_react12.useState)(null);
|
|
18668
|
+
(0, import_react12.useEffect)(() => {
|
|
18559
18669
|
if (!active) {
|
|
18560
18670
|
setRect(null);
|
|
18561
18671
|
return;
|
|
@@ -18617,7 +18727,7 @@ function ReviewButton({
|
|
|
18617
18727
|
background,
|
|
18618
18728
|
color
|
|
18619
18729
|
}) {
|
|
18620
|
-
const [hover, setHover] = (0,
|
|
18730
|
+
const [hover, setHover] = (0, import_react12.useState)(false);
|
|
18621
18731
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "relative" }, children: [
|
|
18622
18732
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
18623
18733
|
"button",
|
|
@@ -18672,17 +18782,17 @@ function AiSectionOverlay({
|
|
|
18672
18782
|
apiRef,
|
|
18673
18783
|
onSelectionChange
|
|
18674
18784
|
}) {
|
|
18675
|
-
const [selectedId, setSelectedId] = (0,
|
|
18676
|
-
const [reviewId, setReviewId] = (0,
|
|
18677
|
-
const [reviewButtonsHidden, setReviewButtonsHidden] = (0,
|
|
18678
|
-
const reviewIdRef = (0,
|
|
18785
|
+
const [selectedId, setSelectedId] = (0, import_react12.useState)(null);
|
|
18786
|
+
const [reviewId, setReviewId] = (0, import_react12.useState)(null);
|
|
18787
|
+
const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react12.useState)(false);
|
|
18788
|
+
const reviewIdRef = (0, import_react12.useRef)(null);
|
|
18679
18789
|
reviewIdRef.current = reviewId;
|
|
18680
|
-
const selectedIdRef = (0,
|
|
18790
|
+
const selectedIdRef = (0, import_react12.useRef)(null);
|
|
18681
18791
|
selectedIdRef.current = selectedId;
|
|
18682
|
-
(0,
|
|
18792
|
+
(0, import_react12.useEffect)(() => {
|
|
18683
18793
|
onSelectionChange?.(selectedId);
|
|
18684
18794
|
}, [selectedId, onSelectionChange]);
|
|
18685
|
-
const report = (0,
|
|
18795
|
+
const report = (0, import_react12.useCallback)(
|
|
18686
18796
|
(el) => {
|
|
18687
18797
|
const labelSrc = el ? sectionElementOf(el) : null;
|
|
18688
18798
|
postToParent2({
|
|
@@ -18693,7 +18803,7 @@ function AiSectionOverlay({
|
|
|
18693
18803
|
},
|
|
18694
18804
|
[postToParent2]
|
|
18695
18805
|
);
|
|
18696
|
-
const selectFromElement = (0,
|
|
18806
|
+
const selectFromElement = (0, import_react12.useCallback)(
|
|
18697
18807
|
(el, options) => {
|
|
18698
18808
|
const inner = el?.closest("[data-ohw-section]") ?? null;
|
|
18699
18809
|
const sectionEl = inner ? movableUnit(inner) : null;
|
|
@@ -18705,7 +18815,7 @@ function AiSectionOverlay({
|
|
|
18705
18815
|
},
|
|
18706
18816
|
[report]
|
|
18707
18817
|
);
|
|
18708
|
-
(0,
|
|
18818
|
+
(0, import_react12.useEffect)(() => {
|
|
18709
18819
|
apiRef.current = {
|
|
18710
18820
|
selectFromElement,
|
|
18711
18821
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
@@ -18730,7 +18840,7 @@ function AiSectionOverlay({
|
|
|
18730
18840
|
apiRef.current = null;
|
|
18731
18841
|
};
|
|
18732
18842
|
}, [apiRef, selectFromElement, report]);
|
|
18733
|
-
(0,
|
|
18843
|
+
(0, import_react12.useEffect)(() => {
|
|
18734
18844
|
const onMessage = (e) => {
|
|
18735
18845
|
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
18736
18846
|
selectedIdRef.current = null;
|
|
@@ -18755,9 +18865,9 @@ function AiSectionOverlay({
|
|
|
18755
18865
|
window.addEventListener("message", onMessage);
|
|
18756
18866
|
return () => window.removeEventListener("message", onMessage);
|
|
18757
18867
|
}, [postToParent2]);
|
|
18758
|
-
(0,
|
|
18759
|
-
const [hoveredId, setHoveredId] = (0,
|
|
18760
|
-
(0,
|
|
18868
|
+
(0, import_react12.useEffect)(() => installAiChangeHighlight(), []);
|
|
18869
|
+
const [hoveredId, setHoveredId] = (0, import_react12.useState)(null);
|
|
18870
|
+
(0, import_react12.useEffect)(() => {
|
|
18761
18871
|
const onMove = (e) => {
|
|
18762
18872
|
const t = e.target;
|
|
18763
18873
|
if (!(t instanceof Element)) return;
|
|
@@ -18782,7 +18892,7 @@ function AiSectionOverlay({
|
|
|
18782
18892
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
18783
18893
|
};
|
|
18784
18894
|
}, []);
|
|
18785
|
-
(0,
|
|
18895
|
+
(0, import_react12.useEffect)(() => {
|
|
18786
18896
|
const onKeyDown = (e) => {
|
|
18787
18897
|
if (e.key !== "Escape") return;
|
|
18788
18898
|
if (reviewIdRef.current) return;
|
|
@@ -18796,7 +18906,7 @@ function AiSectionOverlay({
|
|
|
18796
18906
|
document.addEventListener("keydown", onKeyDown);
|
|
18797
18907
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
18798
18908
|
}, [report]);
|
|
18799
|
-
const decide = (0,
|
|
18909
|
+
const decide = (0, import_react12.useCallback)(
|
|
18800
18910
|
(decision) => {
|
|
18801
18911
|
const sectionId = reviewIdRef.current;
|
|
18802
18912
|
if (!sectionId) return;
|
|
@@ -18805,8 +18915,8 @@ function AiSectionOverlay({
|
|
|
18805
18915
|
},
|
|
18806
18916
|
[postToParent2]
|
|
18807
18917
|
);
|
|
18808
|
-
const [navDropdownForceOpen, setNavDropdownForceOpen] = (0,
|
|
18809
|
-
(0,
|
|
18918
|
+
const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react12.useState)(false);
|
|
18919
|
+
(0, import_react12.useEffect)(() => {
|
|
18810
18920
|
const update = () => {
|
|
18811
18921
|
setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
|
|
18812
18922
|
};
|
|
@@ -18825,7 +18935,7 @@ function AiSectionOverlay({
|
|
|
18825
18935
|
const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
|
|
18826
18936
|
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
18827
18937
|
const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
|
|
18828
|
-
(0,
|
|
18938
|
+
(0, import_react12.useEffect)(() => {
|
|
18829
18939
|
const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
|
|
18830
18940
|
if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
|
|
18831
18941
|
postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
|
|
@@ -18945,7 +19055,7 @@ function AiSectionOverlay({
|
|
|
18945
19055
|
}
|
|
18946
19056
|
|
|
18947
19057
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18948
|
-
var
|
|
19058
|
+
var import_react13 = require("react");
|
|
18949
19059
|
var import_lucide_react8 = require("lucide-react");
|
|
18950
19060
|
|
|
18951
19061
|
// src/lib/ai-media-strip-tree.ts
|
|
@@ -19107,8 +19217,8 @@ function readRect2(ref) {
|
|
|
19107
19217
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19108
19218
|
}
|
|
19109
19219
|
function useLiveItemRect(ref) {
|
|
19110
|
-
const [rect, setRect] = (0,
|
|
19111
|
-
(0,
|
|
19220
|
+
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
19221
|
+
(0, import_react13.useEffect)(() => {
|
|
19112
19222
|
if (!ref) {
|
|
19113
19223
|
setRect(null);
|
|
19114
19224
|
return;
|
|
@@ -19203,8 +19313,8 @@ function Pill({
|
|
|
19203
19313
|
);
|
|
19204
19314
|
}
|
|
19205
19315
|
function AltInput({ value, onCommit }) {
|
|
19206
|
-
const [draft, setDraft] = (0,
|
|
19207
|
-
(0,
|
|
19316
|
+
const [draft, setDraft] = (0, import_react13.useState)(value);
|
|
19317
|
+
(0, import_react13.useEffect)(() => setDraft(value), [value]);
|
|
19208
19318
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19209
19319
|
"div",
|
|
19210
19320
|
{
|
|
@@ -19291,9 +19401,9 @@ var TREATMENTS = [
|
|
|
19291
19401
|
];
|
|
19292
19402
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19293
19403
|
function LinkInput({ value, onCommit }) {
|
|
19294
|
-
const [draft, setDraft] = (0,
|
|
19295
|
-
const [invalid, setInvalid] = (0,
|
|
19296
|
-
(0,
|
|
19404
|
+
const [draft, setDraft] = (0, import_react13.useState)(value);
|
|
19405
|
+
const [invalid, setInvalid] = (0, import_react13.useState)(false);
|
|
19406
|
+
(0, import_react13.useEffect)(() => {
|
|
19297
19407
|
setDraft(value);
|
|
19298
19408
|
setInvalid(false);
|
|
19299
19409
|
}, [value]);
|
|
@@ -19482,13 +19592,13 @@ function AiMediaStripOverlay({
|
|
|
19482
19592
|
applyTreeLocalRef,
|
|
19483
19593
|
clearInteractionChromeRef
|
|
19484
19594
|
}) {
|
|
19485
|
-
const [hover, setHover] = (0,
|
|
19486
|
-
const [active, setActive] = (0,
|
|
19487
|
-
const [pending, setPending] = (0,
|
|
19488
|
-
const [error, setError] = (0,
|
|
19489
|
-
const activeRef = (0,
|
|
19595
|
+
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
19596
|
+
const [active, setActive] = (0, import_react13.useState)(null);
|
|
19597
|
+
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
19598
|
+
const [error, setError] = (0, import_react13.useState)(null);
|
|
19599
|
+
const activeRef = (0, import_react13.useRef)(null);
|
|
19490
19600
|
activeRef.current = active;
|
|
19491
|
-
(0,
|
|
19601
|
+
(0, import_react13.useEffect)(() => {
|
|
19492
19602
|
const onMove = (e) => {
|
|
19493
19603
|
const t = e.target;
|
|
19494
19604
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -19518,7 +19628,7 @@ function AiMediaStripOverlay({
|
|
|
19518
19628
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19519
19629
|
};
|
|
19520
19630
|
}, []);
|
|
19521
|
-
(0,
|
|
19631
|
+
(0, import_react13.useEffect)(() => {
|
|
19522
19632
|
const onClick = (e) => {
|
|
19523
19633
|
const current = activeRef.current;
|
|
19524
19634
|
if (!current) return;
|
|
@@ -19533,7 +19643,7 @@ function AiMediaStripOverlay({
|
|
|
19533
19643
|
document.addEventListener("click", onClick, true);
|
|
19534
19644
|
return () => document.removeEventListener("click", onClick, true);
|
|
19535
19645
|
}, []);
|
|
19536
|
-
(0,
|
|
19646
|
+
(0, import_react13.useEffect)(() => {
|
|
19537
19647
|
const onBlur = () => {
|
|
19538
19648
|
if (!activeRef.current) return;
|
|
19539
19649
|
setActive(null);
|
|
@@ -19542,7 +19652,7 @@ function AiMediaStripOverlay({
|
|
|
19542
19652
|
window.addEventListener("blur", onBlur);
|
|
19543
19653
|
return () => window.removeEventListener("blur", onBlur);
|
|
19544
19654
|
}, []);
|
|
19545
|
-
(0,
|
|
19655
|
+
(0, import_react13.useEffect)(() => {
|
|
19546
19656
|
const onKeyDown = (e) => {
|
|
19547
19657
|
if (e.key !== "Escape") return;
|
|
19548
19658
|
if (!activeRef.current) return;
|
|
@@ -19552,14 +19662,14 @@ function AiMediaStripOverlay({
|
|
|
19552
19662
|
document.addEventListener("keydown", onKeyDown);
|
|
19553
19663
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
19554
19664
|
}, []);
|
|
19555
|
-
const findEntry = (0,
|
|
19665
|
+
const findEntry = (0, import_react13.useCallback)(
|
|
19556
19666
|
(sectionId) => {
|
|
19557
19667
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
19558
19668
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
19559
19669
|
},
|
|
19560
19670
|
[aiSectionsRef]
|
|
19561
19671
|
);
|
|
19562
|
-
const runMutation = (0,
|
|
19672
|
+
const runMutation = (0, import_react13.useCallback)(
|
|
19563
19673
|
async (sectionId, mutate, extraMedia) => {
|
|
19564
19674
|
const entry = findEntry(sectionId);
|
|
19565
19675
|
if (!entry) return false;
|
|
@@ -19706,7 +19816,7 @@ function AiMediaStripOverlay({
|
|
|
19706
19816
|
}
|
|
19707
19817
|
|
|
19708
19818
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19709
|
-
var
|
|
19819
|
+
var import_react14 = require("react");
|
|
19710
19820
|
var import_lucide_react9 = require("lucide-react");
|
|
19711
19821
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
19712
19822
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
@@ -19749,8 +19859,8 @@ function readGridRect(ref) {
|
|
|
19749
19859
|
return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19750
19860
|
}
|
|
19751
19861
|
function useLiveCardRect(ref, grid = false) {
|
|
19752
|
-
const [rect, setRect] = (0,
|
|
19753
|
-
(0,
|
|
19862
|
+
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
19863
|
+
(0, import_react14.useEffect)(() => {
|
|
19754
19864
|
if (!ref) {
|
|
19755
19865
|
setRect(null);
|
|
19756
19866
|
return;
|
|
@@ -19778,10 +19888,10 @@ var TOOLBAR_GRID_GAP = 52;
|
|
|
19778
19888
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19779
19889
|
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19780
19890
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19781
|
-
const slotRef = (0,
|
|
19782
|
-
const [shift, setShift] = (0,
|
|
19891
|
+
const slotRef = (0, import_react14.useRef)(null);
|
|
19892
|
+
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
19783
19893
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19784
|
-
(0,
|
|
19894
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
19785
19895
|
const slot = slotRef.current;
|
|
19786
19896
|
if (!slot) return;
|
|
19787
19897
|
const clamp = () => {
|
|
@@ -20038,13 +20148,13 @@ function AiPricingCardOverlay({
|
|
|
20038
20148
|
aiSectionsRef,
|
|
20039
20149
|
applyTreeLocalRef
|
|
20040
20150
|
}) {
|
|
20041
|
-
const [hover, setHover] = (0,
|
|
20042
|
-
const [active, setActive] = (0,
|
|
20043
|
-
const [pending, setPending] = (0,
|
|
20044
|
-
const [error, setError] = (0,
|
|
20045
|
-
const activeRef = (0,
|
|
20151
|
+
const [hover, setHover] = (0, import_react14.useState)(null);
|
|
20152
|
+
const [active, setActive] = (0, import_react14.useState)(null);
|
|
20153
|
+
const [pending, setPending] = (0, import_react14.useState)(false);
|
|
20154
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
20155
|
+
const activeRef = (0, import_react14.useRef)(null);
|
|
20046
20156
|
activeRef.current = active;
|
|
20047
|
-
(0,
|
|
20157
|
+
(0, import_react14.useEffect)(() => {
|
|
20048
20158
|
const onMove = (e) => {
|
|
20049
20159
|
const ref = cardRefFromTarget(e.target);
|
|
20050
20160
|
const t = e.target;
|
|
@@ -20062,7 +20172,7 @@ function AiPricingCardOverlay({
|
|
|
20062
20172
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20063
20173
|
};
|
|
20064
20174
|
}, []);
|
|
20065
|
-
(0,
|
|
20175
|
+
(0, import_react14.useEffect)(() => {
|
|
20066
20176
|
const onClick = (e) => {
|
|
20067
20177
|
const t = e.target;
|
|
20068
20178
|
if (!(t instanceof Element)) return;
|
|
@@ -20074,7 +20184,7 @@ function AiPricingCardOverlay({
|
|
|
20074
20184
|
document.addEventListener("click", onClick, true);
|
|
20075
20185
|
return () => document.removeEventListener("click", onClick, true);
|
|
20076
20186
|
}, []);
|
|
20077
|
-
(0,
|
|
20187
|
+
(0, import_react14.useEffect)(() => {
|
|
20078
20188
|
const onBlur = () => {
|
|
20079
20189
|
if (!activeRef.current) return;
|
|
20080
20190
|
setActive(null);
|
|
@@ -20083,7 +20193,7 @@ function AiPricingCardOverlay({
|
|
|
20083
20193
|
window.addEventListener("blur", onBlur);
|
|
20084
20194
|
return () => window.removeEventListener("blur", onBlur);
|
|
20085
20195
|
}, []);
|
|
20086
|
-
(0,
|
|
20196
|
+
(0, import_react14.useEffect)(() => {
|
|
20087
20197
|
const onKeyDown = (e) => {
|
|
20088
20198
|
if (e.key !== "Escape") return;
|
|
20089
20199
|
if (!activeRef.current) return;
|
|
@@ -20094,14 +20204,14 @@ function AiPricingCardOverlay({
|
|
|
20094
20204
|
document.addEventListener("keydown", onKeyDown);
|
|
20095
20205
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
20096
20206
|
}, []);
|
|
20097
|
-
const findEntry = (0,
|
|
20207
|
+
const findEntry = (0, import_react14.useCallback)(
|
|
20098
20208
|
(sectionId) => {
|
|
20099
20209
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
20100
20210
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
20101
20211
|
},
|
|
20102
20212
|
[aiSectionsRef]
|
|
20103
20213
|
);
|
|
20104
|
-
const runMutation = (0,
|
|
20214
|
+
const runMutation = (0, import_react14.useCallback)(
|
|
20105
20215
|
async (sectionId, mutate) => {
|
|
20106
20216
|
const entry = findEntry(sectionId);
|
|
20107
20217
|
if (!entry) return false;
|
|
@@ -20188,7 +20298,7 @@ function AiPricingCardOverlay({
|
|
|
20188
20298
|
}
|
|
20189
20299
|
|
|
20190
20300
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20191
|
-
var
|
|
20301
|
+
var import_react15 = require("react");
|
|
20192
20302
|
var import_lucide_react10 = require("lucide-react");
|
|
20193
20303
|
|
|
20194
20304
|
// src/lib/ai-video-tree.ts
|
|
@@ -20281,8 +20391,8 @@ function readRect4(ref) {
|
|
|
20281
20391
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20282
20392
|
}
|
|
20283
20393
|
function useLiveBlockRect(ref) {
|
|
20284
|
-
const [rect, setRect] = (0,
|
|
20285
|
-
(0,
|
|
20394
|
+
const [rect, setRect] = (0, import_react15.useState)(null);
|
|
20395
|
+
(0, import_react15.useEffect)(() => {
|
|
20286
20396
|
if (!ref) {
|
|
20287
20397
|
setRect(null);
|
|
20288
20398
|
return;
|
|
@@ -20360,9 +20470,9 @@ function watchUrl(id) {
|
|
|
20360
20470
|
return `https://www.youtube.com/watch?v=${id}`;
|
|
20361
20471
|
}
|
|
20362
20472
|
function VideoUrlInput({ value, onCommit }) {
|
|
20363
|
-
const [draft, setDraft] = (0,
|
|
20364
|
-
const [invalid, setInvalid] = (0,
|
|
20365
|
-
(0,
|
|
20473
|
+
const [draft, setDraft] = (0, import_react15.useState)(value ? watchUrl(value) : "");
|
|
20474
|
+
const [invalid, setInvalid] = (0, import_react15.useState)(false);
|
|
20475
|
+
(0, import_react15.useEffect)(() => {
|
|
20366
20476
|
setDraft(value ? watchUrl(value) : "");
|
|
20367
20477
|
setInvalid(false);
|
|
20368
20478
|
}, [value]);
|
|
@@ -20499,13 +20609,13 @@ function AiVideoOverlay({
|
|
|
20499
20609
|
applyTreeLocalRef,
|
|
20500
20610
|
clearInteractionChromeRef
|
|
20501
20611
|
}) {
|
|
20502
|
-
const [hover, setHover] = (0,
|
|
20503
|
-
const [active, setActive] = (0,
|
|
20504
|
-
const [pending, setPending] = (0,
|
|
20505
|
-
const [error, setError] = (0,
|
|
20506
|
-
const activeRef = (0,
|
|
20612
|
+
const [hover, setHover] = (0, import_react15.useState)(null);
|
|
20613
|
+
const [active, setActive] = (0, import_react15.useState)(null);
|
|
20614
|
+
const [pending, setPending] = (0, import_react15.useState)(false);
|
|
20615
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
20616
|
+
const activeRef = (0, import_react15.useRef)(null);
|
|
20507
20617
|
activeRef.current = active;
|
|
20508
|
-
(0,
|
|
20618
|
+
(0, import_react15.useEffect)(() => {
|
|
20509
20619
|
const onMove = (e) => {
|
|
20510
20620
|
const t = e.target;
|
|
20511
20621
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -20535,7 +20645,7 @@ function AiVideoOverlay({
|
|
|
20535
20645
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20536
20646
|
};
|
|
20537
20647
|
}, []);
|
|
20538
|
-
(0,
|
|
20648
|
+
(0, import_react15.useEffect)(() => {
|
|
20539
20649
|
const onClick = (e) => {
|
|
20540
20650
|
const current = activeRef.current;
|
|
20541
20651
|
if (!current) return;
|
|
@@ -20550,7 +20660,7 @@ function AiVideoOverlay({
|
|
|
20550
20660
|
document.addEventListener("click", onClick, true);
|
|
20551
20661
|
return () => document.removeEventListener("click", onClick, true);
|
|
20552
20662
|
}, []);
|
|
20553
|
-
(0,
|
|
20663
|
+
(0, import_react15.useEffect)(() => {
|
|
20554
20664
|
const onBlur = () => {
|
|
20555
20665
|
if (!activeRef.current) return;
|
|
20556
20666
|
setActive(null);
|
|
@@ -20559,7 +20669,7 @@ function AiVideoOverlay({
|
|
|
20559
20669
|
window.addEventListener("blur", onBlur);
|
|
20560
20670
|
return () => window.removeEventListener("blur", onBlur);
|
|
20561
20671
|
}, []);
|
|
20562
|
-
(0,
|
|
20672
|
+
(0, import_react15.useEffect)(() => {
|
|
20563
20673
|
const onKeyDown = (e) => {
|
|
20564
20674
|
if (e.key !== "Escape") return;
|
|
20565
20675
|
if (!activeRef.current) return;
|
|
@@ -20569,14 +20679,14 @@ function AiVideoOverlay({
|
|
|
20569
20679
|
document.addEventListener("keydown", onKeyDown);
|
|
20570
20680
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
20571
20681
|
}, []);
|
|
20572
|
-
const findEntry = (0,
|
|
20682
|
+
const findEntry = (0, import_react15.useCallback)(
|
|
20573
20683
|
(sectionId) => {
|
|
20574
20684
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
20575
20685
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
20576
20686
|
},
|
|
20577
20687
|
[aiSectionsRef]
|
|
20578
20688
|
);
|
|
20579
|
-
const runMutation = (0,
|
|
20689
|
+
const runMutation = (0, import_react15.useCallback)(
|
|
20580
20690
|
async (sectionId, mutate) => {
|
|
20581
20691
|
const entry = findEntry(sectionId);
|
|
20582
20692
|
if (!entry) return false;
|
|
@@ -20668,7 +20778,7 @@ function AiVideoOverlay({
|
|
|
20668
20778
|
}
|
|
20669
20779
|
|
|
20670
20780
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20671
|
-
var
|
|
20781
|
+
var import_react16 = require("react");
|
|
20672
20782
|
var import_lucide_react11 = require("lucide-react");
|
|
20673
20783
|
|
|
20674
20784
|
// src/lib/ai-carousel-tree.ts
|
|
@@ -20741,8 +20851,8 @@ function readRect5(ref) {
|
|
|
20741
20851
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20742
20852
|
}
|
|
20743
20853
|
function useLiveItemRect2(ref) {
|
|
20744
|
-
const [rect, setRect] = (0,
|
|
20745
|
-
(0,
|
|
20854
|
+
const [rect, setRect] = (0, import_react16.useState)(null);
|
|
20855
|
+
(0, import_react16.useEffect)(() => {
|
|
20746
20856
|
if (!ref) {
|
|
20747
20857
|
setRect(null);
|
|
20748
20858
|
return;
|
|
@@ -20949,19 +21059,19 @@ function AiFadeCarouselOverlay({
|
|
|
20949
21059
|
applyTreeLocalRef,
|
|
20950
21060
|
clearInteractionChromeRef
|
|
20951
21061
|
}) {
|
|
20952
|
-
const [hover, setHover] = (0,
|
|
20953
|
-
const [active, setActive] = (0,
|
|
20954
|
-
const [pending, setPending] = (0,
|
|
20955
|
-
const [error, setError] = (0,
|
|
20956
|
-
const [autoplayOverride, setAutoplayOverride] = (0,
|
|
20957
|
-
const [swapping, setSwapping] = (0,
|
|
20958
|
-
const skeletonRef = (0,
|
|
20959
|
-
const activeRef = (0,
|
|
21062
|
+
const [hover, setHover] = (0, import_react16.useState)(null);
|
|
21063
|
+
const [active, setActive] = (0, import_react16.useState)(null);
|
|
21064
|
+
const [pending, setPending] = (0, import_react16.useState)(false);
|
|
21065
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
21066
|
+
const [autoplayOverride, setAutoplayOverride] = (0, import_react16.useState)(null);
|
|
21067
|
+
const [swapping, setSwapping] = (0, import_react16.useState)(null);
|
|
21068
|
+
const skeletonRef = (0, import_react16.useRef)(null);
|
|
21069
|
+
const activeRef = (0, import_react16.useRef)(null);
|
|
20960
21070
|
activeRef.current = active;
|
|
20961
|
-
(0,
|
|
21071
|
+
(0, import_react16.useEffect)(() => {
|
|
20962
21072
|
setAutoplayOverride(null);
|
|
20963
21073
|
}, [active?.sectionId, active?.index]);
|
|
20964
|
-
(0,
|
|
21074
|
+
(0, import_react16.useEffect)(() => {
|
|
20965
21075
|
if (!swapping?.fadingOut || !skeletonRef.current) return;
|
|
20966
21076
|
const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
20967
21077
|
duration: MEDIA_UPLOAD_FADE_MS,
|
|
@@ -20971,7 +21081,7 @@ function AiFadeCarouselOverlay({
|
|
|
20971
21081
|
anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
|
|
20972
21082
|
return () => anim.cancel();
|
|
20973
21083
|
}, [swapping?.fadingOut]);
|
|
20974
|
-
(0,
|
|
21084
|
+
(0, import_react16.useEffect)(() => {
|
|
20975
21085
|
const onMove = (e) => {
|
|
20976
21086
|
const t = e.target;
|
|
20977
21087
|
if (!(t instanceof Element)) return;
|
|
@@ -21005,7 +21115,7 @@ function AiFadeCarouselOverlay({
|
|
|
21005
21115
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
21006
21116
|
};
|
|
21007
21117
|
}, []);
|
|
21008
|
-
(0,
|
|
21118
|
+
(0, import_react16.useEffect)(() => {
|
|
21009
21119
|
const onClick = (e) => {
|
|
21010
21120
|
const current = activeRef.current;
|
|
21011
21121
|
if (!current) return;
|
|
@@ -21020,7 +21130,7 @@ function AiFadeCarouselOverlay({
|
|
|
21020
21130
|
document.addEventListener("click", onClick, true);
|
|
21021
21131
|
return () => document.removeEventListener("click", onClick, true);
|
|
21022
21132
|
}, []);
|
|
21023
|
-
(0,
|
|
21133
|
+
(0, import_react16.useEffect)(() => {
|
|
21024
21134
|
const onBlur = () => {
|
|
21025
21135
|
if (!activeRef.current) return;
|
|
21026
21136
|
setActive(null);
|
|
@@ -21029,7 +21139,7 @@ function AiFadeCarouselOverlay({
|
|
|
21029
21139
|
window.addEventListener("blur", onBlur);
|
|
21030
21140
|
return () => window.removeEventListener("blur", onBlur);
|
|
21031
21141
|
}, []);
|
|
21032
|
-
(0,
|
|
21142
|
+
(0, import_react16.useEffect)(() => {
|
|
21033
21143
|
const onKeyDown = (e) => {
|
|
21034
21144
|
if (e.key !== "Escape") return;
|
|
21035
21145
|
if (!activeRef.current) return;
|
|
@@ -21039,14 +21149,14 @@ function AiFadeCarouselOverlay({
|
|
|
21039
21149
|
document.addEventListener("keydown", onKeyDown);
|
|
21040
21150
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
21041
21151
|
}, []);
|
|
21042
|
-
const findEntry = (0,
|
|
21152
|
+
const findEntry = (0, import_react16.useCallback)(
|
|
21043
21153
|
(sectionId) => {
|
|
21044
21154
|
const state = parseAiSectionsState(aiSectionsRef.current);
|
|
21045
21155
|
return state.sections.find((s) => s.id === sectionId) ?? null;
|
|
21046
21156
|
},
|
|
21047
21157
|
[aiSectionsRef]
|
|
21048
21158
|
);
|
|
21049
|
-
const runMutation = (0,
|
|
21159
|
+
const runMutation = (0, import_react16.useCallback)(
|
|
21050
21160
|
async (sectionId, mutate, extraMedia) => {
|
|
21051
21161
|
const entry = findEntry(sectionId);
|
|
21052
21162
|
if (!entry) return false;
|
|
@@ -21326,7 +21436,7 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21326
21436
|
}
|
|
21327
21437
|
|
|
21328
21438
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21329
|
-
var
|
|
21439
|
+
var import_react20 = require("react");
|
|
21330
21440
|
|
|
21331
21441
|
// src/ui/dialog.tsx
|
|
21332
21442
|
var React9 = __toESM(require("react"), 1);
|
|
@@ -21526,7 +21636,7 @@ function SectionTreeItem({
|
|
|
21526
21636
|
}
|
|
21527
21637
|
|
|
21528
21638
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21529
|
-
var
|
|
21639
|
+
var import_react17 = require("react");
|
|
21530
21640
|
|
|
21531
21641
|
// src/ui/input.tsx
|
|
21532
21642
|
var React10 = __toESM(require("react"), 1);
|
|
@@ -21594,11 +21704,11 @@ function UrlOrPageInput({
|
|
|
21594
21704
|
readOnly = false,
|
|
21595
21705
|
urlError
|
|
21596
21706
|
}) {
|
|
21597
|
-
const inputId = (0,
|
|
21598
|
-
const inputRef = (0,
|
|
21599
|
-
const rootRef = (0,
|
|
21600
|
-
const [isFocused, setIsFocused] = (0,
|
|
21601
|
-
(0,
|
|
21707
|
+
const inputId = (0, import_react17.useId)();
|
|
21708
|
+
const inputRef = (0, import_react17.useRef)(null);
|
|
21709
|
+
const rootRef = (0, import_react17.useRef)(null);
|
|
21710
|
+
const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
|
|
21711
|
+
(0, import_react17.useEffect)(() => {
|
|
21602
21712
|
if (!dropdownOpen) return;
|
|
21603
21713
|
const isOutside = (e) => {
|
|
21604
21714
|
const root = rootRef.current;
|
|
@@ -21806,7 +21916,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21806
21916
|
}
|
|
21807
21917
|
|
|
21808
21918
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21809
|
-
var
|
|
21919
|
+
var import_react18 = require("react");
|
|
21810
21920
|
var import_react_dom4 = require("react-dom");
|
|
21811
21921
|
var import_lucide_react17 = require("lucide-react");
|
|
21812
21922
|
var import_navigation3 = require("next/navigation");
|
|
@@ -21863,12 +21973,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
|
|
|
21863
21973
|
return null;
|
|
21864
21974
|
}
|
|
21865
21975
|
function useSectionRects(sectionIdsKey, enabled) {
|
|
21866
|
-
const [rects, setRects] = (0,
|
|
21867
|
-
const sectionIds = (0,
|
|
21976
|
+
const [rects, setRects] = (0, import_react18.useState)(/* @__PURE__ */ new Map());
|
|
21977
|
+
const sectionIds = (0, import_react18.useMemo)(
|
|
21868
21978
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
21869
21979
|
[sectionIdsKey]
|
|
21870
21980
|
);
|
|
21871
|
-
(0,
|
|
21981
|
+
(0, import_react18.useEffect)(() => {
|
|
21872
21982
|
if (!enabled || sectionIds.length === 0) {
|
|
21873
21983
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
21874
21984
|
return;
|
|
@@ -21909,13 +22019,13 @@ function SectionPickerOverlay({
|
|
|
21909
22019
|
}) {
|
|
21910
22020
|
const router = (0, import_navigation3.useRouter)();
|
|
21911
22021
|
const pathname = (0, import_navigation3.usePathname)();
|
|
21912
|
-
const [selectedId, setSelectedId] = (0,
|
|
21913
|
-
const [hoveredId, setHoveredId] = (0,
|
|
21914
|
-
const pointerRef = (0,
|
|
21915
|
-
const pointerScreenRef = (0,
|
|
21916
|
-
const iframeOffsetTopRef = (0,
|
|
21917
|
-
const sectionIdsRef = (0,
|
|
21918
|
-
const [chromeClip, setChromeClip] = (0,
|
|
22022
|
+
const [selectedId, setSelectedId] = (0, import_react18.useState)(null);
|
|
22023
|
+
const [hoveredId, setHoveredId] = (0, import_react18.useState)(null);
|
|
22024
|
+
const pointerRef = (0, import_react18.useRef)(null);
|
|
22025
|
+
const pointerScreenRef = (0, import_react18.useRef)(null);
|
|
22026
|
+
const iframeOffsetTopRef = (0, import_react18.useRef)(null);
|
|
22027
|
+
const sectionIdsRef = (0, import_react18.useRef)([]);
|
|
22028
|
+
const [chromeClip, setChromeClip] = (0, import_react18.useState)(
|
|
21919
22029
|
() => ({
|
|
21920
22030
|
top: 0,
|
|
21921
22031
|
bottom: typeof window !== "undefined" ? window.innerHeight : 0
|
|
@@ -21923,12 +22033,12 @@ function SectionPickerOverlay({
|
|
|
21923
22033
|
);
|
|
21924
22034
|
const normalizedTarget = normalizePath(pagePath);
|
|
21925
22035
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
21926
|
-
(0,
|
|
22036
|
+
(0, import_react18.useEffect)(() => {
|
|
21927
22037
|
if (isOnTargetPage) return;
|
|
21928
22038
|
const search = readPreservedSearch();
|
|
21929
22039
|
router.push(`${normalizedTarget}${search}`);
|
|
21930
22040
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
21931
|
-
(0,
|
|
22041
|
+
(0, import_react18.useEffect)(() => {
|
|
21932
22042
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
21933
22043
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
21934
22044
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -21940,24 +22050,24 @@ function SectionPickerOverlay({
|
|
|
21940
22050
|
document.documentElement.removeAttribute("data-ohw-section-picking");
|
|
21941
22051
|
};
|
|
21942
22052
|
}, []);
|
|
21943
|
-
const liveSections = (0,
|
|
22053
|
+
const liveSections = (0, import_react18.useMemo)(() => {
|
|
21944
22054
|
if (!isOnTargetPage) return sections;
|
|
21945
22055
|
const live = collectSectionsFromDom();
|
|
21946
22056
|
if (live.length === 0) return sections;
|
|
21947
22057
|
const labels = new Map(sections.map((s) => [s.id, s.label]));
|
|
21948
22058
|
return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
|
|
21949
22059
|
}, [isOnTargetPage, sections, pathname]);
|
|
21950
|
-
const sectionIdsKey = (0,
|
|
22060
|
+
const sectionIdsKey = (0, import_react18.useMemo)(
|
|
21951
22061
|
() => liveSections.map((s) => s.id).join("\0"),
|
|
21952
22062
|
[liveSections]
|
|
21953
22063
|
);
|
|
21954
|
-
const sectionIds = (0,
|
|
22064
|
+
const sectionIds = (0, import_react18.useMemo)(
|
|
21955
22065
|
() => liveSections.map((s) => s.id),
|
|
21956
22066
|
[liveSections]
|
|
21957
22067
|
);
|
|
21958
22068
|
sectionIdsRef.current = sectionIds;
|
|
21959
22069
|
const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
|
|
21960
|
-
const applyHoverAt = (0,
|
|
22070
|
+
const applyHoverAt = (0, import_react18.useCallback)(
|
|
21961
22071
|
(x, y, liveRects) => {
|
|
21962
22072
|
const ids = sectionIdsRef.current;
|
|
21963
22073
|
const map = liveRects ?? readSectionRects(ids);
|
|
@@ -21966,7 +22076,7 @@ function SectionPickerOverlay({
|
|
|
21966
22076
|
},
|
|
21967
22077
|
[]
|
|
21968
22078
|
);
|
|
21969
|
-
(0,
|
|
22079
|
+
(0, import_react18.useEffect)(() => {
|
|
21970
22080
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
|
|
21971
22081
|
const next = getIframeVisibleClip({
|
|
21972
22082
|
iframeOffsetTop,
|
|
@@ -22010,12 +22120,12 @@ function SectionPickerOverlay({
|
|
|
22010
22120
|
window.removeEventListener("resize", onResize);
|
|
22011
22121
|
};
|
|
22012
22122
|
}, [applyHoverAt]);
|
|
22013
|
-
(0,
|
|
22123
|
+
(0, import_react18.useEffect)(() => {
|
|
22014
22124
|
const ptr = pointerRef.current;
|
|
22015
22125
|
if (!ptr) return;
|
|
22016
22126
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
22017
22127
|
}, [rects, applyHoverAt]);
|
|
22018
|
-
(0,
|
|
22128
|
+
(0, import_react18.useEffect)(() => {
|
|
22019
22129
|
const rememberPointer = (clientX, clientY) => {
|
|
22020
22130
|
pointerRef.current = { x: clientX, y: clientY };
|
|
22021
22131
|
const top = iframeOffsetTopRef.current;
|
|
@@ -22039,7 +22149,7 @@ function SectionPickerOverlay({
|
|
|
22039
22149
|
window.removeEventListener("message", onPointerSync);
|
|
22040
22150
|
};
|
|
22041
22151
|
}, [rects, applyHoverAt]);
|
|
22042
|
-
const handleSelect = (0,
|
|
22152
|
+
const handleSelect = (0, import_react18.useCallback)(
|
|
22043
22153
|
(section) => {
|
|
22044
22154
|
if (selectedId) return;
|
|
22045
22155
|
setSelectedId(section.id);
|
|
@@ -22047,7 +22157,7 @@ function SectionPickerOverlay({
|
|
|
22047
22157
|
},
|
|
22048
22158
|
[selectedId, onSelect]
|
|
22049
22159
|
);
|
|
22050
|
-
(0,
|
|
22160
|
+
(0, import_react18.useEffect)(() => {
|
|
22051
22161
|
const onKeyDown = (e) => {
|
|
22052
22162
|
if (e.key === "Escape") {
|
|
22053
22163
|
e.preventDefault();
|
|
@@ -22170,7 +22280,7 @@ function SectionPickerOverlay({
|
|
|
22170
22280
|
}
|
|
22171
22281
|
|
|
22172
22282
|
// src/ui/link-modal/useLinkModalState.ts
|
|
22173
|
-
var
|
|
22283
|
+
var import_react19 = require("react");
|
|
22174
22284
|
function useLinkModalState({
|
|
22175
22285
|
open,
|
|
22176
22286
|
mode,
|
|
@@ -22182,14 +22292,14 @@ function useLinkModalState({
|
|
|
22182
22292
|
onClose,
|
|
22183
22293
|
onSubmit
|
|
22184
22294
|
}) {
|
|
22185
|
-
const availablePages = (0,
|
|
22186
|
-
const [searchValue, setSearchValue] = (0,
|
|
22187
|
-
const [selectedPage, setSelectedPage] = (0,
|
|
22188
|
-
const [selectedSection, setSelectedSection] = (0,
|
|
22189
|
-
const [step, setStep] = (0,
|
|
22190
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
22191
|
-
const [urlError, setUrlError] = (0,
|
|
22192
|
-
const reset = (0,
|
|
22295
|
+
const availablePages = (0, import_react19.useMemo)(() => pages, [pages]);
|
|
22296
|
+
const [searchValue, setSearchValue] = (0, import_react19.useState)("");
|
|
22297
|
+
const [selectedPage, setSelectedPage] = (0, import_react19.useState)(null);
|
|
22298
|
+
const [selectedSection, setSelectedSection] = (0, import_react19.useState)(null);
|
|
22299
|
+
const [step, setStep] = (0, import_react19.useState)("input");
|
|
22300
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react19.useState)(false);
|
|
22301
|
+
const [urlError, setUrlError] = (0, import_react19.useState)("");
|
|
22302
|
+
const reset = (0, import_react19.useCallback)(() => {
|
|
22193
22303
|
setSearchValue("");
|
|
22194
22304
|
setSelectedPage(null);
|
|
22195
22305
|
setSelectedSection(null);
|
|
@@ -22197,7 +22307,7 @@ function useLinkModalState({
|
|
|
22197
22307
|
setDropdownOpen(false);
|
|
22198
22308
|
setUrlError("");
|
|
22199
22309
|
}, []);
|
|
22200
|
-
(0,
|
|
22310
|
+
(0, import_react19.useEffect)(() => {
|
|
22201
22311
|
if (!open) return;
|
|
22202
22312
|
if (mode === "edit" && initialTarget) {
|
|
22203
22313
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -22213,11 +22323,11 @@ function useLinkModalState({
|
|
|
22213
22323
|
setDropdownOpen(false);
|
|
22214
22324
|
setUrlError("");
|
|
22215
22325
|
}, [open, mode, initialTarget, reset]);
|
|
22216
|
-
const filteredPages = (0,
|
|
22326
|
+
const filteredPages = (0, import_react19.useMemo)(() => {
|
|
22217
22327
|
if (!searchValue.trim()) return availablePages;
|
|
22218
22328
|
return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
|
|
22219
22329
|
}, [availablePages, searchValue]);
|
|
22220
|
-
const activeSections = (0,
|
|
22330
|
+
const activeSections = (0, import_react19.useMemo)(() => {
|
|
22221
22331
|
if (!selectedPage) return [];
|
|
22222
22332
|
return getSectionsForPath(sectionsByPath, selectedPage.path);
|
|
22223
22333
|
}, [selectedPage, sectionsByPath]);
|
|
@@ -22266,7 +22376,7 @@ function useLinkModalState({
|
|
|
22266
22376
|
reset();
|
|
22267
22377
|
onClose();
|
|
22268
22378
|
};
|
|
22269
|
-
const isValid = (0,
|
|
22379
|
+
const isValid = (0, import_react19.useMemo)(() => {
|
|
22270
22380
|
if (urlError) return false;
|
|
22271
22381
|
if (showBreadcrumb) return true;
|
|
22272
22382
|
if (selectedPage) return true;
|
|
@@ -22363,7 +22473,7 @@ function LinkPopover({
|
|
|
22363
22473
|
onSubmit
|
|
22364
22474
|
});
|
|
22365
22475
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
22366
|
-
(0,
|
|
22476
|
+
(0, import_react20.useEffect)(() => {
|
|
22367
22477
|
if (!open) return;
|
|
22368
22478
|
if (sectionPickerActive) {
|
|
22369
22479
|
postToParent({ type: "ui:unlock" });
|
|
@@ -22604,7 +22714,7 @@ function addFooterColumnWithPersist({
|
|
|
22604
22714
|
}
|
|
22605
22715
|
|
|
22606
22716
|
// src/ui/FloatingPanel.tsx
|
|
22607
|
-
var
|
|
22717
|
+
var import_react21 = require("react");
|
|
22608
22718
|
var import_lucide_react18 = require("lucide-react");
|
|
22609
22719
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
22610
22720
|
var PANEL_WIDTH = 256;
|
|
@@ -22666,10 +22776,10 @@ function FloatingPanel({
|
|
|
22666
22776
|
className,
|
|
22667
22777
|
bodyClassName
|
|
22668
22778
|
}) {
|
|
22669
|
-
const panelRef = (0,
|
|
22670
|
-
const [measured, setMeasured] = (0,
|
|
22671
|
-
const dragRef = (0,
|
|
22672
|
-
const homeRef = (0,
|
|
22779
|
+
const panelRef = (0, import_react21.useRef)(null);
|
|
22780
|
+
const [measured, setMeasured] = (0, import_react21.useState)({ w: PANEL_WIDTH, h: 280 });
|
|
22781
|
+
const dragRef = (0, import_react21.useRef)(null);
|
|
22782
|
+
const homeRef = (0, import_react21.useRef)(null);
|
|
22673
22783
|
if (!open) {
|
|
22674
22784
|
homeRef.current = null;
|
|
22675
22785
|
} else if (position) {
|
|
@@ -22677,17 +22787,17 @@ function FloatingPanel({
|
|
|
22677
22787
|
} else if (homeRef.current == null) {
|
|
22678
22788
|
homeRef.current = defaultFloatingPanelPosition(parentScroll);
|
|
22679
22789
|
}
|
|
22680
|
-
const [liveScroll, setLiveScroll] = (0,
|
|
22790
|
+
const [liveScroll, setLiveScroll] = (0, import_react21.useState)(parentScroll);
|
|
22681
22791
|
const home = position ?? homeRef.current ?? defaultFloatingPanelPosition(parentScroll);
|
|
22682
22792
|
const { y: fittedY, maxHeight } = fitPanelInClip(home.y, liveScroll, measured.h);
|
|
22683
22793
|
const clamped = {
|
|
22684
22794
|
x: clampX(home.x, measured.w),
|
|
22685
22795
|
y: fittedY
|
|
22686
22796
|
};
|
|
22687
|
-
(0,
|
|
22797
|
+
(0, import_react21.useEffect)(() => {
|
|
22688
22798
|
setLiveScroll(parentScroll);
|
|
22689
22799
|
}, [parentScroll]);
|
|
22690
|
-
(0,
|
|
22800
|
+
(0, import_react21.useEffect)(() => {
|
|
22691
22801
|
if (!open) return;
|
|
22692
22802
|
const onParentScroll = (e) => {
|
|
22693
22803
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
@@ -22697,8 +22807,8 @@ function FloatingPanel({
|
|
|
22697
22807
|
window.addEventListener("message", onParentScroll);
|
|
22698
22808
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22699
22809
|
}, [open]);
|
|
22700
|
-
const positionRef = (0,
|
|
22701
|
-
(0,
|
|
22810
|
+
const positionRef = (0, import_react21.useRef)(position);
|
|
22811
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
22702
22812
|
if (!open) {
|
|
22703
22813
|
positionRef.current = position;
|
|
22704
22814
|
return;
|
|
@@ -22708,7 +22818,7 @@ function FloatingPanel({
|
|
|
22708
22818
|
}
|
|
22709
22819
|
positionRef.current = position;
|
|
22710
22820
|
}, [open, position, liveScroll, parentScroll]);
|
|
22711
|
-
(0,
|
|
22821
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
22712
22822
|
if (!open || !panelRef.current) return;
|
|
22713
22823
|
const el = panelRef.current;
|
|
22714
22824
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22717,7 +22827,7 @@ function FloatingPanel({
|
|
|
22717
22827
|
const next = { w: el.offsetWidth || PANEL_WIDTH, h: contentH };
|
|
22718
22828
|
setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
|
|
22719
22829
|
}, [open, children, title, context]);
|
|
22720
|
-
const onHeaderPointerDown = (0,
|
|
22830
|
+
const onHeaderPointerDown = (0, import_react21.useCallback)(
|
|
22721
22831
|
(e) => {
|
|
22722
22832
|
if (e.button !== 0) return;
|
|
22723
22833
|
if (e.target.closest("[data-ohw-floating-panel-close]")) return;
|
|
@@ -22736,7 +22846,7 @@ function FloatingPanel({
|
|
|
22736
22846
|
},
|
|
22737
22847
|
[clamped.x, clamped.y]
|
|
22738
22848
|
);
|
|
22739
|
-
const onHeaderPointerMove = (0,
|
|
22849
|
+
const onHeaderPointerMove = (0, import_react21.useCallback)(
|
|
22740
22850
|
(e) => {
|
|
22741
22851
|
const drag = dragRef.current;
|
|
22742
22852
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
@@ -22762,7 +22872,7 @@ function FloatingPanel({
|
|
|
22762
22872
|
},
|
|
22763
22873
|
[measured.w, onPositionChange, liveScroll]
|
|
22764
22874
|
);
|
|
22765
|
-
const endDrag = (0,
|
|
22875
|
+
const endDrag = (0, import_react21.useCallback)((e) => {
|
|
22766
22876
|
const drag = dragRef.current;
|
|
22767
22877
|
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
22768
22878
|
dragRef.current = null;
|
|
@@ -22772,11 +22882,11 @@ function FloatingPanel({
|
|
|
22772
22882
|
} catch {
|
|
22773
22883
|
}
|
|
22774
22884
|
}, []);
|
|
22775
|
-
(0,
|
|
22885
|
+
(0, import_react21.useEffect)(() => {
|
|
22776
22886
|
if (open) return;
|
|
22777
22887
|
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22778
22888
|
}, [open]);
|
|
22779
|
-
(0,
|
|
22889
|
+
(0, import_react21.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
|
|
22780
22890
|
if (!open) return null;
|
|
22781
22891
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
22782
22892
|
"div",
|
|
@@ -23296,7 +23406,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
|
|
|
23296
23406
|
}
|
|
23297
23407
|
|
|
23298
23408
|
// src/useNavItemDrag.ts
|
|
23299
|
-
var
|
|
23409
|
+
var import_react22 = require("react");
|
|
23300
23410
|
function useNavItemDrag({
|
|
23301
23411
|
isEditMode,
|
|
23302
23412
|
editContentRef,
|
|
@@ -23320,11 +23430,11 @@ function useNavItemDrag({
|
|
|
23320
23430
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
23321
23431
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
23322
23432
|
}) {
|
|
23323
|
-
const navDragRef = (0,
|
|
23324
|
-
const [navDropSlots, setNavDropSlots] = (0,
|
|
23325
|
-
const [activeNavDropIndex, setActiveNavDropIndex] = (0,
|
|
23326
|
-
const navPointerDragRef = (0,
|
|
23327
|
-
const clearNavDragVisuals = (0,
|
|
23433
|
+
const navDragRef = (0, import_react22.useRef)(null);
|
|
23434
|
+
const [navDropSlots, setNavDropSlots] = (0, import_react22.useState)([]);
|
|
23435
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react22.useState)(null);
|
|
23436
|
+
const navPointerDragRef = (0, import_react22.useRef)(null);
|
|
23437
|
+
const clearNavDragVisuals = (0, import_react22.useCallback)(() => {
|
|
23328
23438
|
const session = navDragRef.current;
|
|
23329
23439
|
const nestedHrefKey = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.hrefKey : null;
|
|
23330
23440
|
navDragRef.current = null;
|
|
@@ -23357,7 +23467,7 @@ function useNavItemDrag({
|
|
|
23357
23467
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
23358
23468
|
unlockItemDragInteraction();
|
|
23359
23469
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
23360
|
-
const refreshNavDragVisuals = (0,
|
|
23470
|
+
const refreshNavDragVisuals = (0, import_react22.useCallback)(
|
|
23361
23471
|
(session, activeSlot, clientX, clientY) => {
|
|
23362
23472
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
23363
23473
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -23375,13 +23485,13 @@ function useNavItemDrag({
|
|
|
23375
23485
|
},
|
|
23376
23486
|
[setDraggedItemRect, setSiblingHintRects]
|
|
23377
23487
|
);
|
|
23378
|
-
const refreshNavDragVisualsRef = (0,
|
|
23488
|
+
const refreshNavDragVisualsRef = (0, import_react22.useRef)(refreshNavDragVisuals);
|
|
23379
23489
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
23380
|
-
const commitNavDragRef = (0,
|
|
23490
|
+
const commitNavDragRef = (0, import_react22.useRef)(() => {
|
|
23381
23491
|
});
|
|
23382
|
-
const beginNavDragRef = (0,
|
|
23492
|
+
const beginNavDragRef = (0, import_react22.useRef)(() => {
|
|
23383
23493
|
});
|
|
23384
|
-
const beginNavDrag = (0,
|
|
23494
|
+
const beginNavDrag = (0, import_react22.useCallback)(
|
|
23385
23495
|
(session) => {
|
|
23386
23496
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
23387
23497
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -23420,7 +23530,7 @@ function useNavItemDrag({
|
|
|
23420
23530
|
]
|
|
23421
23531
|
);
|
|
23422
23532
|
beginNavDragRef.current = beginNavDrag;
|
|
23423
|
-
const commitNavDrag = (0,
|
|
23533
|
+
const commitNavDrag = (0, import_react22.useCallback)(
|
|
23424
23534
|
(clientX, clientY) => {
|
|
23425
23535
|
const session = navDragRef.current;
|
|
23426
23536
|
if (!session) {
|
|
@@ -23499,7 +23609,7 @@ function useNavItemDrag({
|
|
|
23499
23609
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
23500
23610
|
);
|
|
23501
23611
|
commitNavDragRef.current = commitNavDrag;
|
|
23502
|
-
const startNavLinkDrag = (0,
|
|
23612
|
+
const startNavLinkDrag = (0, import_react22.useCallback)(
|
|
23503
23613
|
(anchor, clientX, clientY, wasSelected) => {
|
|
23504
23614
|
if (footerDragRef.current) return false;
|
|
23505
23615
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -23517,7 +23627,7 @@ function useNavItemDrag({
|
|
|
23517
23627
|
},
|
|
23518
23628
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
23519
23629
|
);
|
|
23520
|
-
const onNavDragOver = (0,
|
|
23630
|
+
const onNavDragOver = (0, import_react22.useCallback)(
|
|
23521
23631
|
(e) => {
|
|
23522
23632
|
const session = navDragRef.current;
|
|
23523
23633
|
if (!session) return false;
|
|
@@ -23529,7 +23639,7 @@ function useNavItemDrag({
|
|
|
23529
23639
|
},
|
|
23530
23640
|
[]
|
|
23531
23641
|
);
|
|
23532
|
-
(0,
|
|
23642
|
+
(0, import_react22.useEffect)(() => {
|
|
23533
23643
|
if (!isEditMode) return;
|
|
23534
23644
|
const THRESHOLD = 10;
|
|
23535
23645
|
const resolveWasSelected = (el) => {
|
|
@@ -23656,7 +23766,7 @@ function useNavItemDrag({
|
|
|
23656
23766
|
setLinkPopover,
|
|
23657
23767
|
suppressNextClickRef
|
|
23658
23768
|
]);
|
|
23659
|
-
const armNavPressFromChrome = (0,
|
|
23769
|
+
const armNavPressFromChrome = (0, import_react22.useCallback)(
|
|
23660
23770
|
(selected, clientX, clientY, pointerId) => {
|
|
23661
23771
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
23662
23772
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -23688,7 +23798,7 @@ function useNavItemDrag({
|
|
|
23688
23798
|
}
|
|
23689
23799
|
|
|
23690
23800
|
// src/useSectionDrag.ts
|
|
23691
|
-
var
|
|
23801
|
+
var import_react23 = require("react");
|
|
23692
23802
|
|
|
23693
23803
|
// src/lib/section-dnd.ts
|
|
23694
23804
|
function isFooterSection(el) {
|
|
@@ -23781,21 +23891,21 @@ function useSectionDrag({
|
|
|
23781
23891
|
suppressNextClickRef,
|
|
23782
23892
|
suppressClickUntilRef
|
|
23783
23893
|
}) {
|
|
23784
|
-
const sectionDragRef = (0,
|
|
23785
|
-
const [sectionDropSlots, setSectionDropSlots] = (0,
|
|
23786
|
-
const [activeSectionDropIndex, setActiveSectionDropIndex] = (0,
|
|
23787
|
-
const [isSectionDragging, setIsSectionDragging] = (0,
|
|
23788
|
-
const sectionPointerDragRef = (0,
|
|
23789
|
-
const autoScrollRafRef = (0,
|
|
23790
|
-
const autoScrollDeltaRef = (0,
|
|
23791
|
-
const stopAutoScroll = (0,
|
|
23894
|
+
const sectionDragRef = (0, import_react23.useRef)(null);
|
|
23895
|
+
const [sectionDropSlots, setSectionDropSlots] = (0, import_react23.useState)([]);
|
|
23896
|
+
const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react23.useState)(null);
|
|
23897
|
+
const [isSectionDragging, setIsSectionDragging] = (0, import_react23.useState)(false);
|
|
23898
|
+
const sectionPointerDragRef = (0, import_react23.useRef)(null);
|
|
23899
|
+
const autoScrollRafRef = (0, import_react23.useRef)(null);
|
|
23900
|
+
const autoScrollDeltaRef = (0, import_react23.useRef)(0);
|
|
23901
|
+
const stopAutoScroll = (0, import_react23.useCallback)(() => {
|
|
23792
23902
|
if (autoScrollRafRef.current != null) {
|
|
23793
23903
|
cancelAnimationFrame(autoScrollRafRef.current);
|
|
23794
23904
|
autoScrollRafRef.current = null;
|
|
23795
23905
|
}
|
|
23796
23906
|
autoScrollDeltaRef.current = 0;
|
|
23797
23907
|
}, []);
|
|
23798
|
-
const tickAutoScroll = (0,
|
|
23908
|
+
const tickAutoScroll = (0, import_react23.useCallback)(() => {
|
|
23799
23909
|
if (!sectionDragRef.current) {
|
|
23800
23910
|
stopAutoScroll();
|
|
23801
23911
|
return;
|
|
@@ -23805,7 +23915,7 @@ function useSectionDrag({
|
|
|
23805
23915
|
}
|
|
23806
23916
|
autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
|
|
23807
23917
|
}, [postToParentRef, stopAutoScroll]);
|
|
23808
|
-
const updateAutoScroll = (0,
|
|
23918
|
+
const updateAutoScroll = (0, import_react23.useCallback)(
|
|
23809
23919
|
(clientY) => {
|
|
23810
23920
|
const clip = getIframeChromeClip(parentScrollRef.current);
|
|
23811
23921
|
let delta = 0;
|
|
@@ -23827,7 +23937,7 @@ function useSectionDrag({
|
|
|
23827
23937
|
},
|
|
23828
23938
|
[parentScrollRef, stopAutoScroll, tickAutoScroll]
|
|
23829
23939
|
);
|
|
23830
|
-
const clearSectionDragVisuals = (0,
|
|
23940
|
+
const clearSectionDragVisuals = (0, import_react23.useCallback)(() => {
|
|
23831
23941
|
sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
|
|
23832
23942
|
sectionDragRef.current = null;
|
|
23833
23943
|
setSectionDropSlots([]);
|
|
@@ -23837,7 +23947,7 @@ function useSectionDrag({
|
|
|
23837
23947
|
document.documentElement.removeAttribute("data-ohw-section-dragging-root");
|
|
23838
23948
|
unlockItemDragInteraction();
|
|
23839
23949
|
}, [stopAutoScroll]);
|
|
23840
|
-
const refreshSectionDragVisuals = (0,
|
|
23950
|
+
const refreshSectionDragVisuals = (0, import_react23.useCallback)(
|
|
23841
23951
|
(session, clientX, clientY) => {
|
|
23842
23952
|
session.lastClientX = clientX;
|
|
23843
23953
|
session.lastClientY = clientY;
|
|
@@ -23851,7 +23961,7 @@ function useSectionDrag({
|
|
|
23851
23961
|
},
|
|
23852
23962
|
[updateAutoScroll]
|
|
23853
23963
|
);
|
|
23854
|
-
const beginSectionDrag = (0,
|
|
23964
|
+
const beginSectionDrag = (0, import_react23.useCallback)(
|
|
23855
23965
|
(session) => {
|
|
23856
23966
|
sectionDragRef.current = session;
|
|
23857
23967
|
setIsSectionDragging(true);
|
|
@@ -23862,7 +23972,7 @@ function useSectionDrag({
|
|
|
23862
23972
|
},
|
|
23863
23973
|
[refreshSectionDragVisuals]
|
|
23864
23974
|
);
|
|
23865
|
-
const commitSectionDrag = (0,
|
|
23975
|
+
const commitSectionDrag = (0, import_react23.useCallback)(() => {
|
|
23866
23976
|
const session = sectionDragRef.current;
|
|
23867
23977
|
if (!session) {
|
|
23868
23978
|
clearSectionDragVisuals();
|
|
@@ -23891,7 +24001,7 @@ function useSectionDrag({
|
|
|
23891
24001
|
});
|
|
23892
24002
|
});
|
|
23893
24003
|
}, [clearSectionDragVisuals, editContentRef, postToParentRef]);
|
|
23894
|
-
const startSectionPressDrag = (0,
|
|
24004
|
+
const startSectionPressDrag = (0, import_react23.useCallback)(
|
|
23895
24005
|
(el, clientX, clientY, pointerId) => {
|
|
23896
24006
|
if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
|
|
23897
24007
|
const instanceId = instanceIdOf(el);
|
|
@@ -23908,7 +24018,7 @@ function useSectionDrag({
|
|
|
23908
24018
|
},
|
|
23909
24019
|
[footerDragRef, navDragRef]
|
|
23910
24020
|
);
|
|
23911
|
-
(0,
|
|
24021
|
+
(0, import_react23.useEffect)(() => {
|
|
23912
24022
|
if (!isEditMode) return;
|
|
23913
24023
|
const onPointerDown = (e) => {
|
|
23914
24024
|
if (e.button !== 0) return;
|
|
@@ -24233,7 +24343,7 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24233
24343
|
}
|
|
24234
24344
|
|
|
24235
24345
|
// src/lib/build-page-sync.ts
|
|
24236
|
-
var
|
|
24346
|
+
var import_react24 = require("react");
|
|
24237
24347
|
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24238
24348
|
function normalisePath(path) {
|
|
24239
24349
|
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
@@ -24346,7 +24456,7 @@ function applyBuildPageSync(msg, deps) {
|
|
|
24346
24456
|
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24347
24457
|
}
|
|
24348
24458
|
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24349
|
-
(0,
|
|
24459
|
+
(0, import_react24.useEffect)(() => {
|
|
24350
24460
|
if (!isEditMode) return;
|
|
24351
24461
|
const onMessage = (e) => {
|
|
24352
24462
|
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
@@ -25819,9 +25929,9 @@ function FloatingToolbar({
|
|
|
25819
25929
|
showEditLink,
|
|
25820
25930
|
onEditLink
|
|
25821
25931
|
}) {
|
|
25822
|
-
const localRef =
|
|
25823
|
-
const [measuredW, setMeasuredW] =
|
|
25824
|
-
const setRefs =
|
|
25932
|
+
const localRef = import_react25.default.useRef(null);
|
|
25933
|
+
const [measuredW, setMeasuredW] = import_react25.default.useState(330);
|
|
25934
|
+
const setRefs = import_react25.default.useCallback(
|
|
25825
25935
|
(node) => {
|
|
25826
25936
|
localRef.current = node;
|
|
25827
25937
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -25833,7 +25943,7 @@ function FloatingToolbar({
|
|
|
25833
25943
|
},
|
|
25834
25944
|
[elRef]
|
|
25835
25945
|
);
|
|
25836
|
-
|
|
25946
|
+
import_react25.default.useLayoutEffect(() => {
|
|
25837
25947
|
const node = localRef.current;
|
|
25838
25948
|
if (!node) return;
|
|
25839
25949
|
const update = () => {
|
|
@@ -25859,7 +25969,7 @@ function FloatingToolbar({
|
|
|
25859
25969
|
pointerEvents: "auto"
|
|
25860
25970
|
},
|
|
25861
25971
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
|
|
25862
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
25972
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react25.default.Fragment, { children: [
|
|
25863
25973
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
25864
25974
|
btns.map((btn) => {
|
|
25865
25975
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -26068,8 +26178,8 @@ function OhhwellsBridge() {
|
|
|
26068
26178
|
const router = (0, import_navigation4.useRouter)();
|
|
26069
26179
|
const searchParams = (0, import_navigation4.useSearchParams)();
|
|
26070
26180
|
const isEditMode = isEditSessionActive();
|
|
26071
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
26072
|
-
(0,
|
|
26181
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react25.useState)(null);
|
|
26182
|
+
(0, import_react25.useEffect)(() => {
|
|
26073
26183
|
const figtreeFontId = "ohw-figtree-font";
|
|
26074
26184
|
if (!document.getElementById(figtreeFontId)) {
|
|
26075
26185
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -26095,8 +26205,8 @@ function OhhwellsBridge() {
|
|
|
26095
26205
|
};
|
|
26096
26206
|
}, []);
|
|
26097
26207
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26098
|
-
const [subdomain, setSubdomain] = (0,
|
|
26099
|
-
(0,
|
|
26208
|
+
const [subdomain, setSubdomain] = (0, import_react25.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
26209
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
26100
26210
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26101
26211
|
if (next !== subdomain) setSubdomain(next);
|
|
26102
26212
|
if (next) return;
|
|
@@ -26108,7 +26218,7 @@ function OhhwellsBridge() {
|
|
|
26108
26218
|
}, 0);
|
|
26109
26219
|
return () => window.clearTimeout(t);
|
|
26110
26220
|
}, [subdomainFromQuery, subdomain]);
|
|
26111
|
-
(0,
|
|
26221
|
+
(0, import_react25.useEffect)(() => {
|
|
26112
26222
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
26113
26223
|
const url = new URL(window.location.href);
|
|
26114
26224
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -26120,22 +26230,23 @@ function OhhwellsBridge() {
|
|
|
26120
26230
|
useSavedLinkNavigation(isEditMode);
|
|
26121
26231
|
useNavDropdownToggle(isEditMode);
|
|
26122
26232
|
useHashLinkScroll(isEditMode);
|
|
26123
|
-
|
|
26233
|
+
usePublishedPlaceholderStrip(isEditMode);
|
|
26234
|
+
const postToParent2 = (0, import_react25.useCallback)((data) => {
|
|
26124
26235
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
26125
26236
|
window.parent.postMessage(data, "*");
|
|
26126
26237
|
}
|
|
26127
26238
|
}, []);
|
|
26128
|
-
const [fetchState, setFetchState] = (0,
|
|
26129
|
-
const [showBranding, setShowBranding] = (0,
|
|
26130
|
-
const autoSaveTimers = (0,
|
|
26131
|
-
(0,
|
|
26239
|
+
const [fetchState, setFetchState] = (0, import_react25.useState)("idle");
|
|
26240
|
+
const [showBranding, setShowBranding] = (0, import_react25.useState)(false);
|
|
26241
|
+
const autoSaveTimers = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
26242
|
+
(0, import_react25.useEffect)(() => {
|
|
26132
26243
|
stampBridgeVersionOnDocument();
|
|
26133
26244
|
}, []);
|
|
26134
|
-
(0,
|
|
26245
|
+
(0, import_react25.useEffect)(() => {
|
|
26135
26246
|
if (isEditMode) return;
|
|
26136
26247
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
26137
26248
|
}, [isEditMode, subdomain, fetchState]);
|
|
26138
|
-
(0,
|
|
26249
|
+
(0, import_react25.useEffect)(() => {
|
|
26139
26250
|
if (isEditMode || !subdomain) return;
|
|
26140
26251
|
const onError = (event) => {
|
|
26141
26252
|
reportOutageBeacon({
|
|
@@ -26156,40 +26267,40 @@ function OhhwellsBridge() {
|
|
|
26156
26267
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
26157
26268
|
};
|
|
26158
26269
|
}, [isEditMode, subdomain]);
|
|
26159
|
-
const activeElRef = (0,
|
|
26160
|
-
const pointerHeldRef = (0,
|
|
26161
|
-
const selectedElRef = (0,
|
|
26162
|
-
const selectedHrefKeyRef = (0,
|
|
26163
|
-
const selectedFooterColAttrRef = (0,
|
|
26164
|
-
const footerHeadingTitleCacheRef = (0,
|
|
26165
|
-
const originalContentRef = (0,
|
|
26166
|
-
const activeStateElRef = (0,
|
|
26167
|
-
const parentScrollRef = (0,
|
|
26168
|
-
const visibleViewportRef = (0,
|
|
26169
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
26170
|
-
const attachVisibleViewport = (0,
|
|
26270
|
+
const activeElRef = (0, import_react25.useRef)(null);
|
|
26271
|
+
const pointerHeldRef = (0, import_react25.useRef)(false);
|
|
26272
|
+
const selectedElRef = (0, import_react25.useRef)(null);
|
|
26273
|
+
const selectedHrefKeyRef = (0, import_react25.useRef)(null);
|
|
26274
|
+
const selectedFooterColAttrRef = (0, import_react25.useRef)(null);
|
|
26275
|
+
const footerHeadingTitleCacheRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
26276
|
+
const originalContentRef = (0, import_react25.useRef)(null);
|
|
26277
|
+
const activeStateElRef = (0, import_react25.useRef)(null);
|
|
26278
|
+
const parentScrollRef = (0, import_react25.useRef)(null);
|
|
26279
|
+
const visibleViewportRef = (0, import_react25.useRef)(null);
|
|
26280
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react25.useState)(null);
|
|
26281
|
+
const attachVisibleViewport = (0, import_react25.useCallback)((node) => {
|
|
26171
26282
|
visibleViewportRef.current = node;
|
|
26172
26283
|
setDialogPortalContainer(node);
|
|
26173
26284
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
26174
26285
|
}, []);
|
|
26175
|
-
const toolbarElRef = (0,
|
|
26176
|
-
const glowElRef = (0,
|
|
26177
|
-
const hoveredImageRef = (0,
|
|
26178
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
26179
|
-
const dragOverElRef = (0,
|
|
26180
|
-
const [mediaHover, setMediaHover] = (0,
|
|
26181
|
-
const [selectedAiSectionId, setSelectedAiSectionId] = (0,
|
|
26182
|
-
const selectedAiSectionIdRef = (0,
|
|
26183
|
-
const handleAiSectionSelectionChange = (0,
|
|
26286
|
+
const toolbarElRef = (0, import_react25.useRef)(null);
|
|
26287
|
+
const glowElRef = (0, import_react25.useRef)(null);
|
|
26288
|
+
const hoveredImageRef = (0, import_react25.useRef)(null);
|
|
26289
|
+
const hoveredImageHasTextOverlapRef = (0, import_react25.useRef)(false);
|
|
26290
|
+
const dragOverElRef = (0, import_react25.useRef)(null);
|
|
26291
|
+
const [mediaHover, setMediaHover] = (0, import_react25.useState)(null);
|
|
26292
|
+
const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react25.useState)(null);
|
|
26293
|
+
const selectedAiSectionIdRef = (0, import_react25.useRef)(null);
|
|
26294
|
+
const handleAiSectionSelectionChange = (0, import_react25.useCallback)((id) => {
|
|
26184
26295
|
selectedAiSectionIdRef.current = id;
|
|
26185
26296
|
setSelectedAiSectionId(id);
|
|
26186
26297
|
}, []);
|
|
26187
|
-
const [selectedMedia, setSelectedMedia] = (0,
|
|
26188
|
-
const selectedMediaElRef = (0,
|
|
26189
|
-
const mediaKeyDropTokenRef = (0,
|
|
26190
|
-
const selectedIconElRef = (0,
|
|
26191
|
-
const selectedSocialElRef = (0,
|
|
26192
|
-
const queueSectionKeyDrop = (0,
|
|
26298
|
+
const [selectedMedia, setSelectedMedia] = (0, import_react25.useState)(null);
|
|
26299
|
+
const selectedMediaElRef = (0, import_react25.useRef)(null);
|
|
26300
|
+
const mediaKeyDropTokenRef = (0, import_react25.useRef)(0);
|
|
26301
|
+
const selectedIconElRef = (0, import_react25.useRef)(null);
|
|
26302
|
+
const selectedSocialElRef = (0, import_react25.useRef)(null);
|
|
26303
|
+
const queueSectionKeyDrop = (0, import_react25.useCallback)((prev) => {
|
|
26193
26304
|
const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
|
|
26194
26305
|
if (!sectionEl) return;
|
|
26195
26306
|
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
@@ -26210,31 +26321,31 @@ function OhhwellsBridge() {
|
|
|
26210
26321
|
window.addEventListener("message", onQueueDrained);
|
|
26211
26322
|
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
26212
26323
|
}, []);
|
|
26213
|
-
const clearMediaSelection = (0,
|
|
26324
|
+
const clearMediaSelection = (0, import_react25.useCallback)(() => {
|
|
26214
26325
|
const prev = selectedMediaElRef.current;
|
|
26215
26326
|
selectedMediaElRef.current = null;
|
|
26216
26327
|
setSelectedMedia(null);
|
|
26217
26328
|
queueSectionKeyDrop(prev);
|
|
26218
26329
|
}, [queueSectionKeyDrop]);
|
|
26219
|
-
const clearMediaSelectionRef = (0,
|
|
26330
|
+
const clearMediaSelectionRef = (0, import_react25.useRef)(clearMediaSelection);
|
|
26220
26331
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
26221
|
-
const clearIconSelection = (0,
|
|
26332
|
+
const clearIconSelection = (0, import_react25.useCallback)(() => {
|
|
26222
26333
|
const prev = selectedIconElRef.current;
|
|
26223
26334
|
if (!prev) return;
|
|
26224
26335
|
selectedIconElRef.current = null;
|
|
26225
26336
|
queueSectionKeyDrop(prev);
|
|
26226
26337
|
}, [queueSectionKeyDrop]);
|
|
26227
|
-
const clearIconSelectionRef = (0,
|
|
26338
|
+
const clearIconSelectionRef = (0, import_react25.useRef)(clearIconSelection);
|
|
26228
26339
|
clearIconSelectionRef.current = clearIconSelection;
|
|
26229
|
-
const clearSocialSelection = (0,
|
|
26340
|
+
const clearSocialSelection = (0, import_react25.useCallback)(() => {
|
|
26230
26341
|
const prev = selectedSocialElRef.current;
|
|
26231
26342
|
if (!prev) return;
|
|
26232
26343
|
selectedSocialElRef.current = null;
|
|
26233
26344
|
queueSectionKeyDrop(prev);
|
|
26234
26345
|
}, [queueSectionKeyDrop]);
|
|
26235
|
-
const clearSocialSelectionRef = (0,
|
|
26346
|
+
const clearSocialSelectionRef = (0, import_react25.useRef)(clearSocialSelection);
|
|
26236
26347
|
clearSocialSelectionRef.current = clearSocialSelection;
|
|
26237
|
-
const selectIconElement = (0,
|
|
26348
|
+
const selectIconElement = (0, import_react25.useCallback)((el) => {
|
|
26238
26349
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26239
26350
|
selectedIconElRef.current = el;
|
|
26240
26351
|
const sectionEl = el.closest("[data-ohw-section]");
|
|
@@ -26247,9 +26358,9 @@ function OhhwellsBridge() {
|
|
|
26247
26358
|
keyLabel: "Icon"
|
|
26248
26359
|
});
|
|
26249
26360
|
}, []);
|
|
26250
|
-
const selectIconElementRef = (0,
|
|
26361
|
+
const selectIconElementRef = (0, import_react25.useRef)(selectIconElement);
|
|
26251
26362
|
selectIconElementRef.current = selectIconElement;
|
|
26252
|
-
const selectMediaElement = (0,
|
|
26363
|
+
const selectMediaElement = (0, import_react25.useCallback)((el) => {
|
|
26253
26364
|
const r2 = el.getBoundingClientRect();
|
|
26254
26365
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
26255
26366
|
selectedIconElRef.current = null;
|
|
@@ -26274,9 +26385,9 @@ function OhhwellsBridge() {
|
|
|
26274
26385
|
keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
|
|
26275
26386
|
});
|
|
26276
26387
|
}, []);
|
|
26277
|
-
const selectMediaElementRef = (0,
|
|
26388
|
+
const selectMediaElementRef = (0, import_react25.useRef)(selectMediaElement);
|
|
26278
26389
|
selectMediaElementRef.current = selectMediaElement;
|
|
26279
|
-
(0,
|
|
26390
|
+
(0, import_react25.useEffect)(() => {
|
|
26280
26391
|
if (!selectedMedia) return;
|
|
26281
26392
|
const update = () => {
|
|
26282
26393
|
const el = selectedMediaElRef.current;
|
|
@@ -26296,54 +26407,54 @@ function OhhwellsBridge() {
|
|
|
26296
26407
|
window.removeEventListener("resize", update);
|
|
26297
26408
|
};
|
|
26298
26409
|
}, [selectedMedia !== null]);
|
|
26299
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
26300
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
26301
|
-
const hoveredGapRef = (0,
|
|
26302
|
-
const imageUnhoverTimerRef = (0,
|
|
26303
|
-
const imageShowTimerRef = (0,
|
|
26304
|
-
const editStylesRef = (0,
|
|
26305
|
-
const activateRef = (0,
|
|
26410
|
+
const [carouselHover, setCarouselHover] = (0, import_react25.useState)(null);
|
|
26411
|
+
const [uploadingRects, setUploadingRects] = (0, import_react25.useState)({});
|
|
26412
|
+
const hoveredGapRef = (0, import_react25.useRef)(null);
|
|
26413
|
+
const imageUnhoverTimerRef = (0, import_react25.useRef)(null);
|
|
26414
|
+
const imageShowTimerRef = (0, import_react25.useRef)(null);
|
|
26415
|
+
const editStylesRef = (0, import_react25.useRef)(null);
|
|
26416
|
+
const activateRef = (0, import_react25.useRef)(() => {
|
|
26306
26417
|
});
|
|
26307
|
-
const deactivateRef = (0,
|
|
26418
|
+
const deactivateRef = (0, import_react25.useRef)(() => {
|
|
26308
26419
|
});
|
|
26309
|
-
const selectRef = (0,
|
|
26420
|
+
const selectRef = (0, import_react25.useRef)(() => {
|
|
26310
26421
|
});
|
|
26311
|
-
const selectFrameRef = (0,
|
|
26422
|
+
const selectFrameRef = (0, import_react25.useRef)(() => {
|
|
26312
26423
|
});
|
|
26313
|
-
const selectLogoRef = (0,
|
|
26424
|
+
const selectLogoRef = (0, import_react25.useRef)(() => {
|
|
26314
26425
|
});
|
|
26315
|
-
const openLogoSizePanelRef = (0,
|
|
26426
|
+
const openLogoSizePanelRef = (0, import_react25.useRef)(() => {
|
|
26316
26427
|
});
|
|
26317
|
-
const deselectRef = (0,
|
|
26428
|
+
const deselectRef = (0, import_react25.useRef)(() => {
|
|
26318
26429
|
});
|
|
26319
|
-
const closeFloatingPanelOnlyRef = (0,
|
|
26430
|
+
const closeFloatingPanelOnlyRef = (0, import_react25.useRef)(() => {
|
|
26320
26431
|
});
|
|
26321
|
-
const reselectNavigationItemRef = (0,
|
|
26432
|
+
const reselectNavigationItemRef = (0, import_react25.useRef)(() => {
|
|
26322
26433
|
});
|
|
26323
|
-
const commitNavigationTextEditRef = (0,
|
|
26434
|
+
const commitNavigationTextEditRef = (0, import_react25.useRef)(() => {
|
|
26324
26435
|
});
|
|
26325
|
-
const handleDeleteSelectedRef = (0,
|
|
26326
|
-
const runPendingDeleteUndoRef = (0,
|
|
26327
|
-
const isFooterFrameSelectionRef = (0,
|
|
26328
|
-
const refreshActiveCommandsRef = (0,
|
|
26436
|
+
const handleDeleteSelectedRef = (0, import_react25.useRef)(() => false);
|
|
26437
|
+
const runPendingDeleteUndoRef = (0, import_react25.useRef)(() => false);
|
|
26438
|
+
const isFooterFrameSelectionRef = (0, import_react25.useRef)(false);
|
|
26439
|
+
const refreshActiveCommandsRef = (0, import_react25.useRef)(() => {
|
|
26329
26440
|
});
|
|
26330
|
-
const postToParentRef = (0,
|
|
26441
|
+
const postToParentRef = (0, import_react25.useRef)(postToParent2);
|
|
26331
26442
|
postToParentRef.current = postToParent2;
|
|
26332
|
-
const aiSectionApiRef = (0,
|
|
26333
|
-
const sectionsLoadedRef = (0,
|
|
26334
|
-
const pendingScheduleConfigRequests = (0,
|
|
26335
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
26336
|
-
const [formPickRect, setFormPickRect] = (0,
|
|
26337
|
-
const formPickElRef = (0,
|
|
26338
|
-
const [formViewState, setFormViewStateUi] = (0,
|
|
26339
|
-
const [formPickCount, setFormPickCount] = (0,
|
|
26340
|
-
const [formHoverRect, setFormHoverRect] = (0,
|
|
26341
|
-
const formHoverElRef = (0,
|
|
26342
|
-
const [fieldPickRect, setFieldPickRect] = (0,
|
|
26343
|
-
const fieldPickElRef = (0,
|
|
26344
|
-
const [fieldPickState, setFieldPickState] = (0,
|
|
26345
|
-
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0,
|
|
26346
|
-
const clearFormPick = (0,
|
|
26443
|
+
const aiSectionApiRef = (0, import_react25.useRef)(null);
|
|
26444
|
+
const sectionsLoadedRef = (0, import_react25.useRef)(false);
|
|
26445
|
+
const pendingScheduleConfigRequests = (0, import_react25.useRef)([]);
|
|
26446
|
+
const [toolbarRect, setToolbarRect] = (0, import_react25.useState)(null);
|
|
26447
|
+
const [formPickRect, setFormPickRect] = (0, import_react25.useState)(null);
|
|
26448
|
+
const formPickElRef = (0, import_react25.useRef)(null);
|
|
26449
|
+
const [formViewState, setFormViewStateUi] = (0, import_react25.useState)("default");
|
|
26450
|
+
const [formPickCount, setFormPickCount] = (0, import_react25.useState)(null);
|
|
26451
|
+
const [formHoverRect, setFormHoverRect] = (0, import_react25.useState)(null);
|
|
26452
|
+
const formHoverElRef = (0, import_react25.useRef)(null);
|
|
26453
|
+
const [fieldPickRect, setFieldPickRect] = (0, import_react25.useState)(null);
|
|
26454
|
+
const fieldPickElRef = (0, import_react25.useRef)(null);
|
|
26455
|
+
const [fieldPickState, setFieldPickState] = (0, import_react25.useState)(null);
|
|
26456
|
+
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react25.useState)(false);
|
|
26457
|
+
const clearFormPick = (0, import_react25.useCallback)(() => {
|
|
26347
26458
|
const form = formPickElRef.current;
|
|
26348
26459
|
const editing = fieldPickElRef.current;
|
|
26349
26460
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
@@ -26363,7 +26474,7 @@ function OhhwellsBridge() {
|
|
|
26363
26474
|
formPickElRef.current = null;
|
|
26364
26475
|
setFormPickRect(null);
|
|
26365
26476
|
}, []);
|
|
26366
|
-
const clearFieldPick = (0,
|
|
26477
|
+
const clearFieldPick = (0, import_react25.useCallback)(() => {
|
|
26367
26478
|
const wrapper = fieldPickElRef.current;
|
|
26368
26479
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
26369
26480
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
@@ -26373,9 +26484,9 @@ function OhhwellsBridge() {
|
|
|
26373
26484
|
setFieldPickRect(null);
|
|
26374
26485
|
setFieldPickState(null);
|
|
26375
26486
|
}, []);
|
|
26376
|
-
const persistFieldsRef = (0,
|
|
26487
|
+
const persistFieldsRef = (0, import_react25.useRef)(() => {
|
|
26377
26488
|
});
|
|
26378
|
-
const persistFields = (0,
|
|
26489
|
+
const persistFields = (0, import_react25.useCallback)(
|
|
26379
26490
|
(form) => {
|
|
26380
26491
|
const key = formKeyOf(form);
|
|
26381
26492
|
if (!key) return;
|
|
@@ -26386,7 +26497,7 @@ function OhhwellsBridge() {
|
|
|
26386
26497
|
[]
|
|
26387
26498
|
);
|
|
26388
26499
|
persistFieldsRef.current = persistFields;
|
|
26389
|
-
const selectField = (0,
|
|
26500
|
+
const selectField = (0, import_react25.useCallback)((wrapper) => {
|
|
26390
26501
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
26391
26502
|
commitPlaceholderEdit(fieldPickElRef.current);
|
|
26392
26503
|
}
|
|
@@ -26399,7 +26510,7 @@ function OhhwellsBridge() {
|
|
|
26399
26510
|
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
26400
26511
|
setFieldTypePickerOpen(false);
|
|
26401
26512
|
}, []);
|
|
26402
|
-
const withSelectedField = (0,
|
|
26513
|
+
const withSelectedField = (0, import_react25.useCallback)(
|
|
26403
26514
|
(run) => {
|
|
26404
26515
|
const wrapper = fieldPickElRef.current;
|
|
26405
26516
|
const form = formPickElRef.current;
|
|
@@ -26412,28 +26523,28 @@ function OhhwellsBridge() {
|
|
|
26412
26523
|
},
|
|
26413
26524
|
[persistFields]
|
|
26414
26525
|
);
|
|
26415
|
-
const handleFieldTypeChange = (0,
|
|
26526
|
+
const handleFieldTypeChange = (0, import_react25.useCallback)(
|
|
26416
26527
|
(type) => withSelectedField((_form, wrapper) => {
|
|
26417
26528
|
applyFieldType(wrapper, type);
|
|
26418
26529
|
selectField(wrapper);
|
|
26419
26530
|
}),
|
|
26420
26531
|
[selectField, withSelectedField]
|
|
26421
26532
|
);
|
|
26422
|
-
const handleFieldRequiredToggle = (0,
|
|
26533
|
+
const handleFieldRequiredToggle = (0, import_react25.useCallback)(
|
|
26423
26534
|
() => withSelectedField((_form, wrapper) => {
|
|
26424
26535
|
setFieldRequired(wrapper, !isFieldRequired(wrapper));
|
|
26425
26536
|
selectField(wrapper);
|
|
26426
26537
|
}),
|
|
26427
26538
|
[selectField, withSelectedField]
|
|
26428
26539
|
);
|
|
26429
|
-
const handleFieldDuplicate = (0,
|
|
26540
|
+
const handleFieldDuplicate = (0, import_react25.useCallback)(
|
|
26430
26541
|
() => withSelectedField((form, wrapper) => {
|
|
26431
26542
|
const copy = duplicateField(form, wrapper);
|
|
26432
26543
|
selectField(copy);
|
|
26433
26544
|
}),
|
|
26434
26545
|
[selectField, withSelectedField]
|
|
26435
26546
|
);
|
|
26436
|
-
const handleFieldDelete = (0,
|
|
26547
|
+
const handleFieldDelete = (0, import_react25.useCallback)(
|
|
26437
26548
|
() => withSelectedField((_form, wrapper) => {
|
|
26438
26549
|
removeField(wrapper);
|
|
26439
26550
|
clearFieldPick();
|
|
@@ -26441,7 +26552,7 @@ function OhhwellsBridge() {
|
|
|
26441
26552
|
}),
|
|
26442
26553
|
[clearFieldPick, withSelectedField]
|
|
26443
26554
|
);
|
|
26444
|
-
const handleAddField = (0,
|
|
26555
|
+
const handleAddField = (0, import_react25.useCallback)(
|
|
26445
26556
|
(type) => {
|
|
26446
26557
|
const form = formPickElRef.current;
|
|
26447
26558
|
if (!form) return;
|
|
@@ -26457,8 +26568,8 @@ function OhhwellsBridge() {
|
|
|
26457
26568
|
},
|
|
26458
26569
|
[persistFields, selectField]
|
|
26459
26570
|
);
|
|
26460
|
-
const fieldDragRef = (0,
|
|
26461
|
-
const buildFieldDropSlots = (0,
|
|
26571
|
+
const fieldDragRef = (0, import_react25.useRef)(null);
|
|
26572
|
+
const buildFieldDropSlots = (0, import_react25.useCallback)((form, draggedKey) => {
|
|
26462
26573
|
const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
|
|
26463
26574
|
const slots = others.map((el) => {
|
|
26464
26575
|
const rect = el.getBoundingClientRect();
|
|
@@ -26471,7 +26582,7 @@ function OhhwellsBridge() {
|
|
|
26471
26582
|
}
|
|
26472
26583
|
return slots;
|
|
26473
26584
|
}, []);
|
|
26474
|
-
const handleFieldDragStart = (0,
|
|
26585
|
+
const handleFieldDragStart = (0, import_react25.useCallback)(() => {
|
|
26475
26586
|
const wrapper = fieldPickElRef.current;
|
|
26476
26587
|
const form = formPickElRef.current;
|
|
26477
26588
|
if (!wrapper || !form) return;
|
|
@@ -26480,18 +26591,18 @@ function OhhwellsBridge() {
|
|
|
26480
26591
|
setFieldDragging(true);
|
|
26481
26592
|
setFieldDropSlots(buildFieldDropSlots(form, key));
|
|
26482
26593
|
}, [buildFieldDropSlots]);
|
|
26483
|
-
const handleFieldDragEnd = (0,
|
|
26594
|
+
const handleFieldDragEnd = (0, import_react25.useCallback)(() => {
|
|
26484
26595
|
fieldDragRef.current = null;
|
|
26485
26596
|
setFieldDropIndex(null);
|
|
26486
26597
|
setFieldDropSlots([]);
|
|
26487
26598
|
setFieldDragging(false);
|
|
26488
26599
|
}, []);
|
|
26489
|
-
const [fieldDropIndex, setFieldDropIndex] = (0,
|
|
26490
|
-
const [fieldDropSlots, setFieldDropSlots] = (0,
|
|
26491
|
-
const [fieldDragging, setFieldDragging] = (0,
|
|
26492
|
-
const clearFormPickRef = (0,
|
|
26600
|
+
const [fieldDropIndex, setFieldDropIndex] = (0, import_react25.useState)(null);
|
|
26601
|
+
const [fieldDropSlots, setFieldDropSlots] = (0, import_react25.useState)([]);
|
|
26602
|
+
const [fieldDragging, setFieldDragging] = (0, import_react25.useState)(false);
|
|
26603
|
+
const clearFormPickRef = (0, import_react25.useRef)(clearFormPick);
|
|
26493
26604
|
clearFormPickRef.current = clearFormPick;
|
|
26494
|
-
(0,
|
|
26605
|
+
(0, import_react25.useEffect)(() => {
|
|
26495
26606
|
const el = fieldPickElRef.current;
|
|
26496
26607
|
if (!el || fieldPickRect === null) return;
|
|
26497
26608
|
const observer = new ResizeObserver(() => {
|
|
@@ -26500,7 +26611,7 @@ function OhhwellsBridge() {
|
|
|
26500
26611
|
observer.observe(el);
|
|
26501
26612
|
return () => observer.disconnect();
|
|
26502
26613
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26503
|
-
(0,
|
|
26614
|
+
(0, import_react25.useEffect)(() => {
|
|
26504
26615
|
const el = formPickElRef.current;
|
|
26505
26616
|
if (!el || formPickRect === null) return;
|
|
26506
26617
|
const observer = new ResizeObserver(() => {
|
|
@@ -26509,25 +26620,25 @@ function OhhwellsBridge() {
|
|
|
26509
26620
|
observer.observe(el);
|
|
26510
26621
|
return () => observer.disconnect();
|
|
26511
26622
|
}, [formPickRect !== null, formViewState]);
|
|
26512
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
26513
|
-
const toolbarVariantRef = (0,
|
|
26623
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react25.useState)("none");
|
|
26624
|
+
const toolbarVariantRef = (0, import_react25.useRef)("none");
|
|
26514
26625
|
toolbarVariantRef.current = toolbarVariant;
|
|
26515
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
26516
|
-
const [selectedIsSocial, setSelectedIsSocial] = (0,
|
|
26517
|
-
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0,
|
|
26518
|
-
const [reorderHrefKey, setReorderHrefKey] = (0,
|
|
26519
|
-
const [reorderDragDisabled, setReorderDragDisabled] = (0,
|
|
26520
|
-
const [toggleState, setToggleState] = (0,
|
|
26521
|
-
const [maxBadge, setMaxBadge] = (0,
|
|
26522
|
-
const [activeCommands, setActiveCommands] = (0,
|
|
26523
|
-
const [sectionGap, setSectionGap] = (0,
|
|
26524
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] = (0,
|
|
26525
|
-
const hoveredNavContainerRef = (0,
|
|
26526
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0,
|
|
26527
|
-
const hoveredItemElRef = (0,
|
|
26528
|
-
const [hoveredItemRect, setHoveredItemRect] = (0,
|
|
26529
|
-
const [hoveredTextRect, setHoveredTextRect] = (0,
|
|
26530
|
-
(0,
|
|
26626
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react25.useState)(false);
|
|
26627
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react25.useState)(false);
|
|
26628
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react25.useState)(false);
|
|
26629
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react25.useState)(null);
|
|
26630
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react25.useState)(false);
|
|
26631
|
+
const [toggleState, setToggleState] = (0, import_react25.useState)(null);
|
|
26632
|
+
const [maxBadge, setMaxBadge] = (0, import_react25.useState)(null);
|
|
26633
|
+
const [activeCommands, setActiveCommands] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
|
|
26634
|
+
const [sectionGap, setSectionGap] = (0, import_react25.useState)(null);
|
|
26635
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react25.useState)(false);
|
|
26636
|
+
const hoveredNavContainerRef = (0, import_react25.useRef)(null);
|
|
26637
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react25.useState)(null);
|
|
26638
|
+
const hoveredItemElRef = (0, import_react25.useRef)(null);
|
|
26639
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react25.useState)(null);
|
|
26640
|
+
const [hoveredTextRect, setHoveredTextRect] = (0, import_react25.useState)(null);
|
|
26641
|
+
(0, import_react25.useEffect)(() => {
|
|
26531
26642
|
const sync = () => {
|
|
26532
26643
|
const el = document.querySelector(
|
|
26533
26644
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26571,64 +26682,64 @@ function OhhwellsBridge() {
|
|
|
26571
26682
|
});
|
|
26572
26683
|
return () => observer.disconnect();
|
|
26573
26684
|
}, []);
|
|
26574
|
-
const siblingHintElRef = (0,
|
|
26575
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
26576
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
26577
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
26578
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
26685
|
+
const siblingHintElRef = (0, import_react25.useRef)(null);
|
|
26686
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react25.useState)(null);
|
|
26687
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react25.useState)([]);
|
|
26688
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
|
|
26689
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
|
|
26579
26690
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26580
|
-
const [floatingPanel, setFloatingPanel] = (0,
|
|
26581
|
-
const floatingPanelOpenRef = (0,
|
|
26691
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26692
|
+
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26582
26693
|
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26583
|
-
const floatingPanelRef = (0,
|
|
26694
|
+
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26584
26695
|
floatingPanelRef.current = floatingPanel;
|
|
26585
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0,
|
|
26586
|
-
const buttonCollectionDragRef = (0,
|
|
26587
|
-
const buttonDropInsertIndexRef = (0,
|
|
26588
|
-
const [buttonDropSlots, setButtonDropSlots] = (0,
|
|
26589
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0,
|
|
26590
|
-
const buttonPointerDragRef = (0,
|
|
26591
|
-
const [buttonStyleTick, setButtonStyleTick] = (0,
|
|
26592
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0,
|
|
26593
|
-
const [editorViewport, setEditorViewport] = (0,
|
|
26594
|
-
const [parentScrollSnap, setParentScrollSnap] = (0,
|
|
26595
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0,
|
|
26596
|
-
const [footerHeadingVisible, setFooterHeadingVisible] = (0,
|
|
26597
|
-
const footerDragRef = (0,
|
|
26598
|
-
const [footerDropSlots, setFooterDropSlots] = (0,
|
|
26599
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0,
|
|
26600
|
-
const [draggedItemRect, setDraggedItemRect] = (0,
|
|
26601
|
-
const footerPointerDragRef = (0,
|
|
26602
|
-
const suppressNextClickRef = (0,
|
|
26603
|
-
const suppressClickUntilRef = (0,
|
|
26604
|
-
const [linkPopover, setLinkPopover] = (0,
|
|
26605
|
-
const linkPopoverSessionRef = (0,
|
|
26606
|
-
const addNavAfterAnchorRef = (0,
|
|
26607
|
-
const editContentRef = (0,
|
|
26696
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26697
|
+
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26698
|
+
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26699
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26700
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26701
|
+
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26702
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26703
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26704
|
+
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26705
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26706
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
|
|
26707
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
|
|
26708
|
+
const footerDragRef = (0, import_react25.useRef)(null);
|
|
26709
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react25.useState)([]);
|
|
26710
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react25.useState)(null);
|
|
26711
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react25.useState)(null);
|
|
26712
|
+
const footerPointerDragRef = (0, import_react25.useRef)(null);
|
|
26713
|
+
const suppressNextClickRef = (0, import_react25.useRef)(false);
|
|
26714
|
+
const suppressClickUntilRef = (0, import_react25.useRef)(0);
|
|
26715
|
+
const [linkPopover, setLinkPopover] = (0, import_react25.useState)(null);
|
|
26716
|
+
const linkPopoverSessionRef = (0, import_react25.useRef)(null);
|
|
26717
|
+
const addNavAfterAnchorRef = (0, import_react25.useRef)(null);
|
|
26718
|
+
const editContentRef = (0, import_react25.useRef)({});
|
|
26608
26719
|
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
26609
|
-
const aiSectionsRef = (0,
|
|
26610
|
-
const aiFooterRef = (0,
|
|
26611
|
-
const applyTreeLocalRef = (0,
|
|
26720
|
+
const aiSectionsRef = (0, import_react25.useRef)("");
|
|
26721
|
+
const aiFooterRef = (0, import_react25.useRef)("");
|
|
26722
|
+
const applyTreeLocalRef = (0, import_react25.useRef)(
|
|
26612
26723
|
null
|
|
26613
26724
|
);
|
|
26614
|
-
const applyFooterTreeLocalRef = (0,
|
|
26615
|
-
const clearInteractionChromeRef = (0,
|
|
26725
|
+
const applyFooterTreeLocalRef = (0, import_react25.useRef)(null);
|
|
26726
|
+
const clearInteractionChromeRef = (0, import_react25.useRef)(() => {
|
|
26616
26727
|
});
|
|
26617
|
-
const brandKitRef = (0,
|
|
26618
|
-
const stylesRef = (0,
|
|
26619
|
-
const appliedDrawerRef = (0,
|
|
26620
|
-
const pendingDeleteUndoRef = (0,
|
|
26621
|
-
const [sitePages, setSitePages] = (0,
|
|
26622
|
-
const collectionItemsRef = (0,
|
|
26623
|
-
const [sectionsByPath, setSectionsByPath] = (0,
|
|
26624
|
-
const sectionsPrefetchGenRef = (0,
|
|
26625
|
-
const setLinkPopoverRef = (0,
|
|
26626
|
-
const linkPopoverPanelRef = (0,
|
|
26627
|
-
const linkPopoverOpenRef = (0,
|
|
26628
|
-
const linkPopoverGraceUntilRef = (0,
|
|
26728
|
+
const brandKitRef = (0, import_react25.useRef)("");
|
|
26729
|
+
const stylesRef = (0, import_react25.useRef)("");
|
|
26730
|
+
const appliedDrawerRef = (0, import_react25.useRef)(null);
|
|
26731
|
+
const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
|
|
26732
|
+
const [sitePages, setSitePages] = (0, import_react25.useState)([]);
|
|
26733
|
+
const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
26734
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
|
|
26735
|
+
const sectionsPrefetchGenRef = (0, import_react25.useRef)(0);
|
|
26736
|
+
const setLinkPopoverRef = (0, import_react25.useRef)(setLinkPopover);
|
|
26737
|
+
const linkPopoverPanelRef = (0, import_react25.useRef)(null);
|
|
26738
|
+
const linkPopoverOpenRef = (0, import_react25.useRef)(false);
|
|
26739
|
+
const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
|
|
26629
26740
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26630
26741
|
linkPopoverSessionRef.current = linkPopover;
|
|
26631
|
-
(0,
|
|
26742
|
+
(0, import_react25.useEffect)(() => {
|
|
26632
26743
|
setSectionOrderPersistHandler((entries) => {
|
|
26633
26744
|
const currentPath = window.location.pathname;
|
|
26634
26745
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26638,7 +26749,7 @@ function OhhwellsBridge() {
|
|
|
26638
26749
|
});
|
|
26639
26750
|
return () => setSectionOrderPersistHandler(null);
|
|
26640
26751
|
}, []);
|
|
26641
|
-
(0,
|
|
26752
|
+
(0, import_react25.useEffect)(() => {
|
|
26642
26753
|
setAiFooterMountOptions({
|
|
26643
26754
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26644
26755
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26701,7 +26812,7 @@ function OhhwellsBridge() {
|
|
|
26701
26812
|
const bumpLinkPopoverGrace = () => {
|
|
26702
26813
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
26703
26814
|
};
|
|
26704
|
-
const runSectionsPrefetch = (0,
|
|
26815
|
+
const runSectionsPrefetch = (0, import_react25.useCallback)((pages) => {
|
|
26705
26816
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
26706
26817
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
26707
26818
|
const paths = pages.map((p) => p.path);
|
|
@@ -26720,9 +26831,9 @@ function OhhwellsBridge() {
|
|
|
26720
26831
|
);
|
|
26721
26832
|
});
|
|
26722
26833
|
}, [isEditMode, pathname]);
|
|
26723
|
-
const runSectionsPrefetchRef = (0,
|
|
26834
|
+
const runSectionsPrefetchRef = (0, import_react25.useRef)(runSectionsPrefetch);
|
|
26724
26835
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26725
|
-
(0,
|
|
26836
|
+
(0, import_react25.useEffect)(() => {
|
|
26726
26837
|
if (!linkPopover) {
|
|
26727
26838
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26728
26839
|
return;
|
|
@@ -26750,7 +26861,7 @@ function OhhwellsBridge() {
|
|
|
26750
26861
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26751
26862
|
};
|
|
26752
26863
|
}, [linkPopover, postToParent2]);
|
|
26753
|
-
(0,
|
|
26864
|
+
(0, import_react25.useEffect)(() => {
|
|
26754
26865
|
if (!isEditMode) return;
|
|
26755
26866
|
const useFixtures = shouldUseDevFixtures();
|
|
26756
26867
|
if (useFixtures) {
|
|
@@ -26776,7 +26887,7 @@ function OhhwellsBridge() {
|
|
|
26776
26887
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26777
26888
|
return () => window.removeEventListener("message", onSitePages);
|
|
26778
26889
|
}, [isEditMode, postToParent2]);
|
|
26779
|
-
(0,
|
|
26890
|
+
(0, import_react25.useEffect)(() => {
|
|
26780
26891
|
if (!isEditMode) return;
|
|
26781
26892
|
const deps = {
|
|
26782
26893
|
getEditContent: () => editContentRef.current,
|
|
@@ -26813,14 +26924,14 @@ function OhhwellsBridge() {
|
|
|
26813
26924
|
window.addEventListener("message", onPageMessage);
|
|
26814
26925
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26815
26926
|
}, [isEditMode, postToParent2]);
|
|
26816
|
-
(0,
|
|
26927
|
+
(0, import_react25.useEffect)(() => {
|
|
26817
26928
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26818
26929
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26819
26930
|
if (Object.keys(manifest).length === 0) return;
|
|
26820
26931
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26821
26932
|
});
|
|
26822
26933
|
}, [isEditMode]);
|
|
26823
|
-
(0,
|
|
26934
|
+
(0, import_react25.useEffect)(() => {
|
|
26824
26935
|
const update = () => {
|
|
26825
26936
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26826
26937
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -26844,10 +26955,10 @@ function OhhwellsBridge() {
|
|
|
26844
26955
|
vvp.removeEventListener("resize", update);
|
|
26845
26956
|
};
|
|
26846
26957
|
}, []);
|
|
26847
|
-
const refreshStateRules = (0,
|
|
26958
|
+
const refreshStateRules = (0, import_react25.useCallback)(() => {
|
|
26848
26959
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
26849
26960
|
}, []);
|
|
26850
|
-
const processConfigRequest = (0,
|
|
26961
|
+
const processConfigRequest = (0, import_react25.useCallback)((insertAfterVal) => {
|
|
26851
26962
|
const tracker = getSectionsTracker();
|
|
26852
26963
|
let entries = [];
|
|
26853
26964
|
try {
|
|
@@ -26870,7 +26981,7 @@ function OhhwellsBridge() {
|
|
|
26870
26981
|
}
|
|
26871
26982
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
26872
26983
|
}, [isEditMode]);
|
|
26873
|
-
const deactivate = (0,
|
|
26984
|
+
const deactivate = (0, import_react25.useCallback)(() => {
|
|
26874
26985
|
const el = activeElRef.current;
|
|
26875
26986
|
if (!el) return;
|
|
26876
26987
|
const isFormBlock = el.dataset.ohwEditable === "form";
|
|
@@ -26936,12 +27047,12 @@ function OhhwellsBridge() {
|
|
|
26936
27047
|
setToolbarShowEditLink(false);
|
|
26937
27048
|
postToParent2({ type: "ow:exit-edit" });
|
|
26938
27049
|
}, [postToParent2]);
|
|
26939
|
-
const clearSelectedAttr = (0,
|
|
27050
|
+
const clearSelectedAttr = (0, import_react25.useCallback)(() => {
|
|
26940
27051
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
26941
27052
|
el.removeAttribute("data-ohw-selected");
|
|
26942
27053
|
});
|
|
26943
27054
|
}, []);
|
|
26944
|
-
const deselect = (0,
|
|
27055
|
+
const deselect = (0, import_react25.useCallback)(() => {
|
|
26945
27056
|
const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
|
|
26946
27057
|
clearSelectedAttr();
|
|
26947
27058
|
selectedElRef.current = null;
|
|
@@ -26977,20 +27088,20 @@ function OhhwellsBridge() {
|
|
|
26977
27088
|
setToolbarVariant("none");
|
|
26978
27089
|
}
|
|
26979
27090
|
}, [clearSelectedAttr]);
|
|
26980
|
-
const markSelected = (0,
|
|
27091
|
+
const markSelected = (0, import_react25.useCallback)((el) => {
|
|
26981
27092
|
clearSelectedAttr();
|
|
26982
27093
|
el.removeAttribute("data-ohw-hovered");
|
|
26983
27094
|
el.setAttribute("data-ohw-selected", "");
|
|
26984
27095
|
}, [clearSelectedAttr]);
|
|
26985
|
-
const isSelectedForHover = (0,
|
|
27096
|
+
const isSelectedForHover = (0, import_react25.useCallback)((el) => {
|
|
26986
27097
|
if (!el) return false;
|
|
26987
27098
|
return [selectedElRef.current, activeElRef.current].some(
|
|
26988
27099
|
(busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
|
|
26989
27100
|
);
|
|
26990
27101
|
}, []);
|
|
26991
|
-
const isSelectedForHoverRef = (0,
|
|
27102
|
+
const isSelectedForHoverRef = (0, import_react25.useRef)(isSelectedForHover);
|
|
26992
27103
|
isSelectedForHoverRef.current = isSelectedForHover;
|
|
26993
|
-
const resolveHrefKeyElement = (0,
|
|
27104
|
+
const resolveHrefKeyElement = (0, import_react25.useCallback)((hrefKey) => {
|
|
26994
27105
|
if (isFooterHrefKey(hrefKey)) {
|
|
26995
27106
|
return document.querySelector(
|
|
26996
27107
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -27005,7 +27116,7 @@ function OhhwellsBridge() {
|
|
|
27005
27116
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
27006
27117
|
);
|
|
27007
27118
|
}, []);
|
|
27008
|
-
const resyncSelectedNavigationItem = (0,
|
|
27119
|
+
const resyncSelectedNavigationItem = (0, import_react25.useCallback)(() => {
|
|
27009
27120
|
const hrefKey = selectedHrefKeyRef.current;
|
|
27010
27121
|
if (hrefKey) {
|
|
27011
27122
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -27043,7 +27154,7 @@ function OhhwellsBridge() {
|
|
|
27043
27154
|
);
|
|
27044
27155
|
}
|
|
27045
27156
|
}, [resolveHrefKeyElement]);
|
|
27046
|
-
const reselectNavigationItem = (0,
|
|
27157
|
+
const reselectNavigationItem = (0, import_react25.useCallback)((navAnchor) => {
|
|
27047
27158
|
selectedElRef.current = navAnchor;
|
|
27048
27159
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
27049
27160
|
selectedFooterColAttrRef.current = null;
|
|
@@ -27074,7 +27185,7 @@ function OhhwellsBridge() {
|
|
|
27074
27185
|
setToolbarShowEditLink(false);
|
|
27075
27186
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27076
27187
|
}, [markSelected]);
|
|
27077
|
-
const commitNavigationTextEdit = (0,
|
|
27188
|
+
const commitNavigationTextEdit = (0, import_react25.useCallback)((navAnchor) => {
|
|
27078
27189
|
const el = activeElRef.current;
|
|
27079
27190
|
if (!el) return;
|
|
27080
27191
|
const key = el.dataset.ohwKey;
|
|
@@ -27107,7 +27218,7 @@ function OhhwellsBridge() {
|
|
|
27107
27218
|
postToParent2({ type: "ow:exit-edit" });
|
|
27108
27219
|
reselectNavigationItem(navAnchor);
|
|
27109
27220
|
}, [postToParent2, reselectNavigationItem]);
|
|
27110
|
-
const handleAddTopLevelNavItem = (0,
|
|
27221
|
+
const handleAddTopLevelNavItem = (0, import_react25.useCallback)(() => {
|
|
27111
27222
|
const items = listNavbarRootItems();
|
|
27112
27223
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
27113
27224
|
deselectRef.current();
|
|
@@ -27119,7 +27230,7 @@ function OhhwellsBridge() {
|
|
|
27119
27230
|
intent: "add-nav"
|
|
27120
27231
|
});
|
|
27121
27232
|
}, []);
|
|
27122
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
27233
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react25.useCallback)(
|
|
27123
27234
|
(anchor) => {
|
|
27124
27235
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
27125
27236
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -27132,7 +27243,7 @@ function OhhwellsBridge() {
|
|
|
27132
27243
|
},
|
|
27133
27244
|
[postToParent2]
|
|
27134
27245
|
);
|
|
27135
|
-
const handleNavDropdownOpenChange = (0,
|
|
27246
|
+
const handleNavDropdownOpenChange = (0, import_react25.useCallback)((open) => {
|
|
27136
27247
|
const selected = selectedElRef.current;
|
|
27137
27248
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
27138
27249
|
if (isNestedNavChild(selected)) return;
|
|
@@ -27148,7 +27259,7 @@ function OhhwellsBridge() {
|
|
|
27148
27259
|
}
|
|
27149
27260
|
});
|
|
27150
27261
|
}, []);
|
|
27151
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
27262
|
+
const handleFooterHeadingVisibleChange = (0, import_react25.useCallback)(
|
|
27152
27263
|
(visible) => {
|
|
27153
27264
|
const selected = selectedElRef.current;
|
|
27154
27265
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -27201,7 +27312,7 @@ function OhhwellsBridge() {
|
|
|
27201
27312
|
},
|
|
27202
27313
|
[postToParent2]
|
|
27203
27314
|
);
|
|
27204
|
-
const enterEditOnNewItem = (0,
|
|
27315
|
+
const enterEditOnNewItem = (0, import_react25.useCallback)((anchor) => {
|
|
27205
27316
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
27206
27317
|
if (!label) {
|
|
27207
27318
|
selectRef.current(anchor);
|
|
@@ -27210,8 +27321,8 @@ function OhhwellsBridge() {
|
|
|
27210
27321
|
setNavGroupForceOpen(anchor, true);
|
|
27211
27322
|
activateRef.current(label);
|
|
27212
27323
|
}, []);
|
|
27213
|
-
const pendingSocialAddRef = (0,
|
|
27214
|
-
const handleAddChildItem = (0,
|
|
27324
|
+
const pendingSocialAddRef = (0, import_react25.useRef)(null);
|
|
27325
|
+
const handleAddChildItem = (0, import_react25.useCallback)(() => {
|
|
27215
27326
|
const selected = selectedElRef.current;
|
|
27216
27327
|
if (!selected) return;
|
|
27217
27328
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
@@ -27338,7 +27449,7 @@ function OhhwellsBridge() {
|
|
|
27338
27449
|
});
|
|
27339
27450
|
});
|
|
27340
27451
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
27341
|
-
const handleAddFooterColumn = (0,
|
|
27452
|
+
const handleAddFooterColumn = (0, import_react25.useCallback)(() => {
|
|
27342
27453
|
if (document.querySelector("[data-ai-footer]")) {
|
|
27343
27454
|
const state = parseAiFooterState(aiFooterRef.current);
|
|
27344
27455
|
if (!state?.tree) return;
|
|
@@ -27394,7 +27505,7 @@ function OhhwellsBridge() {
|
|
|
27394
27505
|
selectRef.current(result.firstLink);
|
|
27395
27506
|
});
|
|
27396
27507
|
}, [postToParent2]);
|
|
27397
|
-
const clearFooterDragVisuals = (0,
|
|
27508
|
+
const clearFooterDragVisuals = (0, import_react25.useCallback)(() => {
|
|
27398
27509
|
footerDragRef.current = null;
|
|
27399
27510
|
setSiblingHintRects([]);
|
|
27400
27511
|
setFooterDropSlots([]);
|
|
@@ -27403,7 +27514,7 @@ function OhhwellsBridge() {
|
|
|
27403
27514
|
setIsItemDragging(false);
|
|
27404
27515
|
unlockFooterDragInteraction();
|
|
27405
27516
|
}, []);
|
|
27406
|
-
const refreshFooterDragVisuals = (0,
|
|
27517
|
+
const refreshFooterDragVisuals = (0, import_react25.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
27407
27518
|
const dragged = session.draggedEl;
|
|
27408
27519
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
27409
27520
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -27435,13 +27546,13 @@ function OhhwellsBridge() {
|
|
|
27435
27546
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
27436
27547
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
27437
27548
|
}, []);
|
|
27438
|
-
const refreshFooterDragVisualsRef = (0,
|
|
27549
|
+
const refreshFooterDragVisualsRef = (0, import_react25.useRef)(refreshFooterDragVisuals);
|
|
27439
27550
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
27440
|
-
const commitFooterDragRef = (0,
|
|
27551
|
+
const commitFooterDragRef = (0, import_react25.useRef)(() => {
|
|
27441
27552
|
});
|
|
27442
|
-
const beginFooterDragRef = (0,
|
|
27553
|
+
const beginFooterDragRef = (0, import_react25.useRef)(() => {
|
|
27443
27554
|
});
|
|
27444
|
-
const beginFooterDrag = (0,
|
|
27555
|
+
const beginFooterDrag = (0, import_react25.useCallback)(
|
|
27445
27556
|
(session) => {
|
|
27446
27557
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
27447
27558
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -27461,7 +27572,7 @@ function OhhwellsBridge() {
|
|
|
27461
27572
|
[refreshFooterDragVisuals]
|
|
27462
27573
|
);
|
|
27463
27574
|
beginFooterDragRef.current = beginFooterDrag;
|
|
27464
|
-
const commitFooterDrag = (0,
|
|
27575
|
+
const commitFooterDrag = (0, import_react25.useCallback)(
|
|
27465
27576
|
(clientX, clientY) => {
|
|
27466
27577
|
const session = footerDragRef.current;
|
|
27467
27578
|
if (!session) {
|
|
@@ -27633,7 +27744,7 @@ function OhhwellsBridge() {
|
|
|
27633
27744
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
27634
27745
|
);
|
|
27635
27746
|
commitFooterDragRef.current = commitFooterDrag;
|
|
27636
|
-
const startFooterLinkDrag = (0,
|
|
27747
|
+
const startFooterLinkDrag = (0, import_react25.useCallback)(
|
|
27637
27748
|
(anchor, clientX, clientY, wasSelected) => {
|
|
27638
27749
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
27639
27750
|
if (!hrefKey) return false;
|
|
@@ -27669,7 +27780,7 @@ function OhhwellsBridge() {
|
|
|
27669
27780
|
},
|
|
27670
27781
|
[beginFooterDrag]
|
|
27671
27782
|
);
|
|
27672
|
-
const startFooterColumnDrag = (0,
|
|
27783
|
+
const startFooterColumnDrag = (0, import_react25.useCallback)(
|
|
27673
27784
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
27674
27785
|
const columns = listFooterColumns(columnEl);
|
|
27675
27786
|
const idx = columns.indexOf(columnEl);
|
|
@@ -27689,7 +27800,7 @@ function OhhwellsBridge() {
|
|
|
27689
27800
|
},
|
|
27690
27801
|
[beginFooterDrag]
|
|
27691
27802
|
);
|
|
27692
|
-
const persistButtonCollectionDrag = (0,
|
|
27803
|
+
const persistButtonCollectionDrag = (0, import_react25.useCallback)(
|
|
27693
27804
|
(button, clientX) => {
|
|
27694
27805
|
const insertIndex = buttonDropInsertIndexRef.current;
|
|
27695
27806
|
if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
|
|
@@ -27713,7 +27824,7 @@ function OhhwellsBridge() {
|
|
|
27713
27824
|
},
|
|
27714
27825
|
[postToParent2]
|
|
27715
27826
|
);
|
|
27716
|
-
const refreshButtonDragVisuals = (0,
|
|
27827
|
+
const refreshButtonDragVisuals = (0, import_react25.useCallback)((button, clientX, clientY) => {
|
|
27717
27828
|
const collection = buttonCollectionOf(button);
|
|
27718
27829
|
if (!collection) {
|
|
27719
27830
|
setButtonDropSlots([]);
|
|
@@ -27730,7 +27841,7 @@ function OhhwellsBridge() {
|
|
|
27730
27841
|
setDraggedItemRect(button.getBoundingClientRect());
|
|
27731
27842
|
if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
|
|
27732
27843
|
}, []);
|
|
27733
|
-
const handleItemDragStart = (0,
|
|
27844
|
+
const handleItemDragStart = (0, import_react25.useCallback)(
|
|
27734
27845
|
(e) => {
|
|
27735
27846
|
const selected = selectedElRef.current;
|
|
27736
27847
|
if (!selected) {
|
|
@@ -27761,7 +27872,7 @@ function OhhwellsBridge() {
|
|
|
27761
27872
|
},
|
|
27762
27873
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
|
|
27763
27874
|
);
|
|
27764
|
-
const handleItemDragEnd = (0,
|
|
27875
|
+
const handleItemDragEnd = (0, import_react25.useCallback)(
|
|
27765
27876
|
(e) => {
|
|
27766
27877
|
const collectionButton = buttonCollectionDragRef.current;
|
|
27767
27878
|
if (collectionButton) {
|
|
@@ -27792,7 +27903,7 @@ function OhhwellsBridge() {
|
|
|
27792
27903
|
},
|
|
27793
27904
|
[commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
|
|
27794
27905
|
);
|
|
27795
|
-
const handleItemChromePointerDown = (0,
|
|
27906
|
+
const handleItemChromePointerDown = (0, import_react25.useCallback)((e) => {
|
|
27796
27907
|
if (e.button !== 0) return;
|
|
27797
27908
|
const selected = selectedElRef.current;
|
|
27798
27909
|
if (!selected) return;
|
|
@@ -27833,7 +27944,7 @@ function OhhwellsBridge() {
|
|
|
27833
27944
|
}
|
|
27834
27945
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
27835
27946
|
}, [armNavPressFromChrome]);
|
|
27836
|
-
const handleItemChromeClick = (0,
|
|
27947
|
+
const handleItemChromeClick = (0, import_react25.useCallback)((clientX, clientY) => {
|
|
27837
27948
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
27838
27949
|
suppressNextClickRef.current = false;
|
|
27839
27950
|
return;
|
|
@@ -27846,7 +27957,7 @@ function OhhwellsBridge() {
|
|
|
27846
27957
|
}, []);
|
|
27847
27958
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
27848
27959
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
27849
|
-
const select = (0,
|
|
27960
|
+
const select = (0, import_react25.useCallback)((anchor) => {
|
|
27850
27961
|
if (!isNavigationItem2(anchor)) return;
|
|
27851
27962
|
if (activeElRef.current) deactivate();
|
|
27852
27963
|
clearSocialSelectionRef.current();
|
|
@@ -27923,7 +28034,7 @@ function OhhwellsBridge() {
|
|
|
27923
28034
|
setLogoSizeDraft(null);
|
|
27924
28035
|
}
|
|
27925
28036
|
}, [deactivate, markSelected]);
|
|
27926
|
-
const selectFrame = (0,
|
|
28037
|
+
const selectFrame = (0, import_react25.useCallback)((el) => {
|
|
27927
28038
|
if (!isNavigationContainer(el)) return;
|
|
27928
28039
|
if (activeElRef.current) deactivate();
|
|
27929
28040
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -27964,7 +28075,7 @@ function OhhwellsBridge() {
|
|
|
27964
28075
|
setFloatingPanelPos(null);
|
|
27965
28076
|
setLogoSizeDraft(null);
|
|
27966
28077
|
}, [deactivate, markSelected, postToParent2]);
|
|
27967
|
-
const selectLogo = (0,
|
|
28078
|
+
const selectLogo = (0, import_react25.useCallback)(
|
|
27968
28079
|
(logoEl) => {
|
|
27969
28080
|
if (activeElRef.current) deactivate();
|
|
27970
28081
|
selectedElRef.current = logoEl;
|
|
@@ -27993,7 +28104,7 @@ function OhhwellsBridge() {
|
|
|
27993
28104
|
},
|
|
27994
28105
|
[deactivate, markSelected]
|
|
27995
28106
|
);
|
|
27996
|
-
const openLogoSizePanel = (0,
|
|
28107
|
+
const openLogoSizePanel = (0, import_react25.useCallback)((logoEl) => {
|
|
27997
28108
|
const placement = getLogoPlacement(logoEl);
|
|
27998
28109
|
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
27999
28110
|
setLogoSizeDraft(draft);
|
|
@@ -28006,7 +28117,7 @@ function OhhwellsBridge() {
|
|
|
28006
28117
|
placement
|
|
28007
28118
|
});
|
|
28008
28119
|
}, []);
|
|
28009
|
-
const openSocialsDisplayPanel = (0,
|
|
28120
|
+
const openSocialsDisplayPanel = (0, import_react25.useCallback)((row) => {
|
|
28010
28121
|
setFloatingPanelPos(null);
|
|
28011
28122
|
setParentScrollSnap(parentScrollRef.current);
|
|
28012
28123
|
setFloatingPanel({
|
|
@@ -28017,7 +28128,7 @@ function OhhwellsBridge() {
|
|
|
28017
28128
|
row
|
|
28018
28129
|
});
|
|
28019
28130
|
}, []);
|
|
28020
|
-
const rememberButtonTokens = (0,
|
|
28131
|
+
const rememberButtonTokens = (0, import_react25.useCallback)(
|
|
28021
28132
|
(content, tokens, nodes) => {
|
|
28022
28133
|
if (nodes.length === 0) return content;
|
|
28023
28134
|
const next = { ...content };
|
|
@@ -28028,7 +28139,7 @@ function OhhwellsBridge() {
|
|
|
28028
28139
|
},
|
|
28029
28140
|
[postToParent2]
|
|
28030
28141
|
);
|
|
28031
|
-
const tokensForButton = (0,
|
|
28142
|
+
const tokensForButton = (0, import_react25.useCallback)(
|
|
28032
28143
|
(el, persistFallback = false) => {
|
|
28033
28144
|
const stored = readStoredStyleTokens(editContentRef.current);
|
|
28034
28145
|
if (stored) return stored;
|
|
@@ -28043,7 +28154,7 @@ function OhhwellsBridge() {
|
|
|
28043
28154
|
},
|
|
28044
28155
|
[rememberButtonTokens]
|
|
28045
28156
|
);
|
|
28046
|
-
const openButtonStylePanel = (0,
|
|
28157
|
+
const openButtonStylePanel = (0, import_react25.useCallback)(
|
|
28047
28158
|
(anchor) => {
|
|
28048
28159
|
const id = buttonId(anchor);
|
|
28049
28160
|
if (!id) return;
|
|
@@ -28061,7 +28172,7 @@ function OhhwellsBridge() {
|
|
|
28061
28172
|
},
|
|
28062
28173
|
[tokensForButton]
|
|
28063
28174
|
);
|
|
28064
|
-
const applySelectedButtonStyle = (0,
|
|
28175
|
+
const applySelectedButtonStyle = (0, import_react25.useCallback)(
|
|
28065
28176
|
(patch) => {
|
|
28066
28177
|
const panel = floatingPanelRef.current;
|
|
28067
28178
|
const id = panel?.kind === "button-style" ? panel.buttonId : null;
|
|
@@ -28079,7 +28190,7 @@ function OhhwellsBridge() {
|
|
|
28079
28190
|
},
|
|
28080
28191
|
[postToParent2]
|
|
28081
28192
|
);
|
|
28082
|
-
(0,
|
|
28193
|
+
(0, import_react25.useEffect)(() => {
|
|
28083
28194
|
const onDragOver = (e) => {
|
|
28084
28195
|
const dragged = buttonCollectionDragRef.current;
|
|
28085
28196
|
if (!dragged) return;
|
|
@@ -28098,11 +28209,11 @@ function OhhwellsBridge() {
|
|
|
28098
28209
|
document.removeEventListener("drop", onDrop);
|
|
28099
28210
|
};
|
|
28100
28211
|
}, [refreshButtonDragVisuals]);
|
|
28101
|
-
const isEditModeRef = (0,
|
|
28102
|
-
const requestMissingSocialIconsRef = (0,
|
|
28212
|
+
const isEditModeRef = (0, import_react25.useRef)(false);
|
|
28213
|
+
const requestMissingSocialIconsRef = (0, import_react25.useRef)(() => {
|
|
28103
28214
|
});
|
|
28104
|
-
const askedSocialIconsRef = (0,
|
|
28105
|
-
const requestMissingSocialIcons = (0,
|
|
28215
|
+
const askedSocialIconsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Set());
|
|
28216
|
+
const requestMissingSocialIcons = (0, import_react25.useCallback)(() => {
|
|
28106
28217
|
const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
|
|
28107
28218
|
const missing = socialsMissingIcons(row);
|
|
28108
28219
|
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
@@ -28114,7 +28225,7 @@ function OhhwellsBridge() {
|
|
|
28114
28225
|
}, []);
|
|
28115
28226
|
requestMissingSocialIconsRef.current = requestMissingSocialIcons;
|
|
28116
28227
|
isEditModeRef.current = isEditMode;
|
|
28117
|
-
const changeSocialsDisplay = (0,
|
|
28228
|
+
const changeSocialsDisplay = (0, import_react25.useCallback)(
|
|
28118
28229
|
(row, next) => {
|
|
28119
28230
|
if (next.icon) {
|
|
28120
28231
|
const missing = socialsMissingIcons(row);
|
|
@@ -28138,19 +28249,19 @@ function OhhwellsBridge() {
|
|
|
28138
28249
|
},
|
|
28139
28250
|
[]
|
|
28140
28251
|
);
|
|
28141
|
-
const closeFloatingPanelOnly = (0,
|
|
28252
|
+
const closeFloatingPanelOnly = (0, import_react25.useCallback)(() => {
|
|
28142
28253
|
setFloatingPanel(null);
|
|
28143
28254
|
setFloatingPanelPos(null);
|
|
28144
28255
|
setLogoSizeDraft(null);
|
|
28145
28256
|
}, []);
|
|
28146
28257
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28147
|
-
const closeFloatingPanelAndDeselect = (0,
|
|
28258
|
+
const closeFloatingPanelAndDeselect = (0, import_react25.useCallback)(() => {
|
|
28148
28259
|
setFloatingPanel(null);
|
|
28149
28260
|
setFloatingPanelPos(null);
|
|
28150
28261
|
setLogoSizeDraft(null);
|
|
28151
28262
|
deselectRef.current();
|
|
28152
28263
|
}, []);
|
|
28153
|
-
(0,
|
|
28264
|
+
(0, import_react25.useEffect)(() => {
|
|
28154
28265
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
28155
28266
|
if (!session || !logoSizeDraft) {
|
|
28156
28267
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28169,7 +28280,7 @@ function OhhwellsBridge() {
|
|
|
28169
28280
|
max: LOGO_SIZE_MAX
|
|
28170
28281
|
});
|
|
28171
28282
|
}, [floatingPanel, logoSizeDraft, editorViewport]);
|
|
28172
|
-
const persistLogoSizeDraft = (0,
|
|
28283
|
+
const persistLogoSizeDraft = (0, import_react25.useCallback)(
|
|
28173
28284
|
(placement, draft) => {
|
|
28174
28285
|
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
28175
28286
|
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
@@ -28209,7 +28320,7 @@ function OhhwellsBridge() {
|
|
|
28209
28320
|
},
|
|
28210
28321
|
[postToParent2]
|
|
28211
28322
|
);
|
|
28212
|
-
const activate = (0,
|
|
28323
|
+
const activate = (0, import_react25.useCallback)((el, options) => {
|
|
28213
28324
|
if (activeElRef.current === el) return;
|
|
28214
28325
|
document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
|
|
28215
28326
|
hovered.removeAttribute("data-ohw-hovered");
|
|
@@ -28307,8 +28418,8 @@ function OhhwellsBridge() {
|
|
|
28307
28418
|
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
28308
28419
|
deselectRef.current = deselect;
|
|
28309
28420
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28310
|
-
const lastSiteWideScopeRef = (0,
|
|
28311
|
-
(0,
|
|
28421
|
+
const lastSiteWideScopeRef = (0, import_react25.useRef)(null);
|
|
28422
|
+
(0, import_react25.useEffect)(() => {
|
|
28312
28423
|
if (!isEditMode) {
|
|
28313
28424
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28314
28425
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28334,7 +28445,7 @@ function OhhwellsBridge() {
|
|
|
28334
28445
|
isFooterFrameSelection,
|
|
28335
28446
|
postToParent2
|
|
28336
28447
|
]);
|
|
28337
|
-
(0,
|
|
28448
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
28338
28449
|
if (!subdomain || isEditMode) {
|
|
28339
28450
|
setFetchState("done");
|
|
28340
28451
|
return;
|
|
@@ -28485,7 +28596,7 @@ function OhhwellsBridge() {
|
|
|
28485
28596
|
cancelled = true;
|
|
28486
28597
|
};
|
|
28487
28598
|
}, [subdomain, isEditMode]);
|
|
28488
|
-
(0,
|
|
28599
|
+
(0, import_react25.useEffect)(() => {
|
|
28489
28600
|
if (!isEditMode) return;
|
|
28490
28601
|
const resolveIndex = (form, clientY) => {
|
|
28491
28602
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28526,7 +28637,7 @@ function OhhwellsBridge() {
|
|
|
28526
28637
|
window.removeEventListener("drop", onDrop, true);
|
|
28527
28638
|
};
|
|
28528
28639
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28529
|
-
(0,
|
|
28640
|
+
(0, import_react25.useEffect)(() => {
|
|
28530
28641
|
if (!isEditMode) return;
|
|
28531
28642
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28532
28643
|
markFormFields(form);
|
|
@@ -28538,7 +28649,7 @@ function OhhwellsBridge() {
|
|
|
28538
28649
|
});
|
|
28539
28650
|
return () => observer.disconnect();
|
|
28540
28651
|
}, [isEditMode, fetchState, pathname]);
|
|
28541
|
-
(0,
|
|
28652
|
+
(0, import_react25.useEffect)(() => {
|
|
28542
28653
|
if (!isEditMode) return;
|
|
28543
28654
|
let saveTimer = null;
|
|
28544
28655
|
const onInput = (e) => {
|
|
@@ -28560,14 +28671,14 @@ function OhhwellsBridge() {
|
|
|
28560
28671
|
document.addEventListener("input", onInput, true);
|
|
28561
28672
|
return () => document.removeEventListener("input", onInput, true);
|
|
28562
28673
|
}, [isEditMode, persistFields]);
|
|
28563
|
-
(0,
|
|
28674
|
+
(0, import_react25.useEffect)(() => {
|
|
28564
28675
|
if (isEditMode || fetchState !== "done") return;
|
|
28565
28676
|
const content = contentCache.get(subdomain) ?? {};
|
|
28566
28677
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28567
28678
|
reconcileFieldsFromContent(form, content);
|
|
28568
28679
|
});
|
|
28569
28680
|
}, [isEditMode, fetchState, subdomain]);
|
|
28570
|
-
(0,
|
|
28681
|
+
(0, import_react25.useEffect)(() => {
|
|
28571
28682
|
if (!isEditMode) return;
|
|
28572
28683
|
const swallow = (e) => {
|
|
28573
28684
|
const target = e.target;
|
|
@@ -28576,14 +28687,14 @@ function OhhwellsBridge() {
|
|
|
28576
28687
|
document.addEventListener("submit", swallow, true);
|
|
28577
28688
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28578
28689
|
}, [isEditMode]);
|
|
28579
|
-
(0,
|
|
28690
|
+
(0, import_react25.useEffect)(() => {
|
|
28580
28691
|
if (isEditMode || fetchState !== "done") return;
|
|
28581
28692
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28582
28693
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28583
28694
|
console.log({ apiUrl, subdomain });
|
|
28584
28695
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28585
28696
|
}, [isEditMode, fetchState, subdomain]);
|
|
28586
|
-
(0,
|
|
28697
|
+
(0, import_react25.useEffect)(() => {
|
|
28587
28698
|
if (!subdomain || isEditMode) return;
|
|
28588
28699
|
let debounceTimer = null;
|
|
28589
28700
|
let observer = null;
|
|
@@ -28700,16 +28811,16 @@ function OhhwellsBridge() {
|
|
|
28700
28811
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28701
28812
|
};
|
|
28702
28813
|
}, [subdomain, isEditMode, pathname]);
|
|
28703
|
-
(0,
|
|
28814
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
28704
28815
|
const el = document.getElementById("ohw-loader");
|
|
28705
28816
|
if (!el) return;
|
|
28706
28817
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28707
28818
|
el.style.display = visible ? "flex" : "none";
|
|
28708
28819
|
}, [subdomain, fetchState]);
|
|
28709
|
-
(0,
|
|
28820
|
+
(0, import_react25.useEffect)(() => {
|
|
28710
28821
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28711
28822
|
}, [pathname, postToParent2]);
|
|
28712
|
-
(0,
|
|
28823
|
+
(0, import_react25.useEffect)(() => {
|
|
28713
28824
|
if (!subdomain || isEditMode) return;
|
|
28714
28825
|
const content = contentCache.get(subdomain);
|
|
28715
28826
|
if (!content) return;
|
|
@@ -28727,7 +28838,7 @@ function OhhwellsBridge() {
|
|
|
28727
28838
|
}
|
|
28728
28839
|
applyAiFooterFromContent(content);
|
|
28729
28840
|
}, [pathname, subdomain, isEditMode]);
|
|
28730
|
-
(0,
|
|
28841
|
+
(0, import_react25.useEffect)(() => {
|
|
28731
28842
|
if (!isEditMode) return;
|
|
28732
28843
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28733
28844
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28735,12 +28846,12 @@ function OhhwellsBridge() {
|
|
|
28735
28846
|
deselectRef.current();
|
|
28736
28847
|
deactivateRef.current();
|
|
28737
28848
|
}, [pathname, isEditMode]);
|
|
28738
|
-
(0,
|
|
28849
|
+
(0, import_react25.useEffect)(() => {
|
|
28739
28850
|
if (!isEditMode) return;
|
|
28740
28851
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28741
28852
|
initItemInstancesFromContent(editContentRef.current);
|
|
28742
28853
|
}, [pathname, isEditMode]);
|
|
28743
|
-
(0,
|
|
28854
|
+
(0, import_react25.useEffect)(() => {
|
|
28744
28855
|
if (!isEditMode) return;
|
|
28745
28856
|
const observer = new MutationObserver(() => {
|
|
28746
28857
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28751,7 +28862,7 @@ function OhhwellsBridge() {
|
|
|
28751
28862
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28752
28863
|
return () => observer.disconnect();
|
|
28753
28864
|
}, [isEditMode, pathname]);
|
|
28754
|
-
(0,
|
|
28865
|
+
(0, import_react25.useEffect)(() => {
|
|
28755
28866
|
const contentForNav = () => {
|
|
28756
28867
|
if (isEditMode) return editContentRef.current;
|
|
28757
28868
|
if (!subdomain) return {};
|
|
@@ -28824,7 +28935,7 @@ function OhhwellsBridge() {
|
|
|
28824
28935
|
observer?.disconnect();
|
|
28825
28936
|
};
|
|
28826
28937
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28827
|
-
(0,
|
|
28938
|
+
(0, import_react25.useEffect)(() => {
|
|
28828
28939
|
if (!isEditMode) return;
|
|
28829
28940
|
let applying = false;
|
|
28830
28941
|
let rafId = null;
|
|
@@ -28862,7 +28973,7 @@ function OhhwellsBridge() {
|
|
|
28862
28973
|
observer.disconnect();
|
|
28863
28974
|
};
|
|
28864
28975
|
}, [isEditMode, pathname]);
|
|
28865
|
-
(0,
|
|
28976
|
+
(0, import_react25.useEffect)(() => {
|
|
28866
28977
|
if (!isEditMode) return;
|
|
28867
28978
|
let lastPosted = 0;
|
|
28868
28979
|
const measure = () => {
|
|
@@ -28906,7 +29017,7 @@ function OhhwellsBridge() {
|
|
|
28906
29017
|
window.removeEventListener("resize", handleResize);
|
|
28907
29018
|
};
|
|
28908
29019
|
}, [pathname, isEditMode, postToParent2]);
|
|
28909
|
-
(0,
|
|
29020
|
+
(0, import_react25.useEffect)(() => {
|
|
28910
29021
|
if (isEditMode) return;
|
|
28911
29022
|
const handleClick = (e) => {
|
|
28912
29023
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28920,7 +29031,7 @@ function OhhwellsBridge() {
|
|
|
28920
29031
|
document.addEventListener("click", handleClick, true);
|
|
28921
29032
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28922
29033
|
}, [isEditMode, router, pathname]);
|
|
28923
|
-
(0,
|
|
29034
|
+
(0, import_react25.useEffect)(() => {
|
|
28924
29035
|
if (!isEditMode) {
|
|
28925
29036
|
editStylesRef.current?.base.remove();
|
|
28926
29037
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -32401,7 +32512,7 @@ function OhhwellsBridge() {
|
|
|
32401
32512
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32402
32513
|
};
|
|
32403
32514
|
}, [isEditMode, refreshStateRules]);
|
|
32404
|
-
(0,
|
|
32515
|
+
(0, import_react25.useEffect)(() => {
|
|
32405
32516
|
if (!isEditMode) return;
|
|
32406
32517
|
const THRESHOLD = 10;
|
|
32407
32518
|
const resolveWasSelected = (el) => {
|
|
@@ -32557,7 +32668,7 @@ function OhhwellsBridge() {
|
|
|
32557
32668
|
unlockFooterDragInteraction();
|
|
32558
32669
|
};
|
|
32559
32670
|
}, [isEditMode]);
|
|
32560
|
-
(0,
|
|
32671
|
+
(0, import_react25.useEffect)(() => {
|
|
32561
32672
|
if (!isEditMode) return;
|
|
32562
32673
|
const THRESHOLD = 10;
|
|
32563
32674
|
const onPointerDown = (e) => {
|
|
@@ -32648,7 +32759,7 @@ function OhhwellsBridge() {
|
|
|
32648
32759
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32649
32760
|
};
|
|
32650
32761
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32651
|
-
(0,
|
|
32762
|
+
(0, import_react25.useEffect)(() => {
|
|
32652
32763
|
const handler = (e) => {
|
|
32653
32764
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32654
32765
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32664,7 +32775,7 @@ function OhhwellsBridge() {
|
|
|
32664
32775
|
window.addEventListener("message", handler);
|
|
32665
32776
|
return () => window.removeEventListener("message", handler);
|
|
32666
32777
|
}, [processConfigRequest]);
|
|
32667
|
-
(0,
|
|
32778
|
+
(0, import_react25.useEffect)(() => {
|
|
32668
32779
|
if (!isEditMode) return;
|
|
32669
32780
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32670
32781
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32688,7 +32799,7 @@ function OhhwellsBridge() {
|
|
|
32688
32799
|
postToParent2({
|
|
32689
32800
|
type: "ow:ready",
|
|
32690
32801
|
version: "1",
|
|
32691
|
-
bridgeVersion: "0.1.
|
|
32802
|
+
bridgeVersion: "0.1.167",
|
|
32692
32803
|
path: pathname,
|
|
32693
32804
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32694
32805
|
sections
|
|
@@ -32700,13 +32811,13 @@ function OhhwellsBridge() {
|
|
|
32700
32811
|
clearTimeout(timer);
|
|
32701
32812
|
};
|
|
32702
32813
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32703
|
-
(0,
|
|
32814
|
+
(0, import_react25.useEffect)(() => {
|
|
32704
32815
|
scrollToHashSectionWhenReady();
|
|
32705
32816
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32706
32817
|
window.addEventListener("hashchange", onHashChange);
|
|
32707
32818
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
32708
32819
|
}, [pathname]);
|
|
32709
|
-
const handleCommand = (0,
|
|
32820
|
+
const handleCommand = (0, import_react25.useCallback)((cmd) => {
|
|
32710
32821
|
const el = activeElRef.current;
|
|
32711
32822
|
const selBefore = window.getSelection();
|
|
32712
32823
|
let savedOffsets = null;
|
|
@@ -32742,7 +32853,7 @@ function OhhwellsBridge() {
|
|
|
32742
32853
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32743
32854
|
refreshActiveCommandsRef.current();
|
|
32744
32855
|
}, []);
|
|
32745
|
-
(0,
|
|
32856
|
+
(0, import_react25.useEffect)(() => {
|
|
32746
32857
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32747
32858
|
if (!session || !logoSizeDraft) return;
|
|
32748
32859
|
const onPanelAction = (e) => {
|
|
@@ -32780,7 +32891,7 @@ function OhhwellsBridge() {
|
|
|
32780
32891
|
window.addEventListener("message", onPanelAction);
|
|
32781
32892
|
return () => window.removeEventListener("message", onPanelAction);
|
|
32782
32893
|
}, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
|
|
32783
|
-
const handleStateChange = (0,
|
|
32894
|
+
const handleStateChange = (0, import_react25.useCallback)((state) => {
|
|
32784
32895
|
if (!activeStateElRef.current) return;
|
|
32785
32896
|
const el = activeStateElRef.current;
|
|
32786
32897
|
if (state === "Default") {
|
|
@@ -32793,7 +32904,7 @@ function OhhwellsBridge() {
|
|
|
32793
32904
|
}
|
|
32794
32905
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
32795
32906
|
}, [deactivate]);
|
|
32796
|
-
const reselectAfterLinkPopover = (0,
|
|
32907
|
+
const reselectAfterLinkPopover = (0, import_react25.useCallback)(
|
|
32797
32908
|
(hrefKey) => {
|
|
32798
32909
|
requestAnimationFrame(() => {
|
|
32799
32910
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -32802,7 +32913,7 @@ function OhhwellsBridge() {
|
|
|
32802
32913
|
},
|
|
32803
32914
|
[resolveHrefKeyElement]
|
|
32804
32915
|
);
|
|
32805
|
-
const closeLinkPopover = (0,
|
|
32916
|
+
const closeLinkPopover = (0, import_react25.useCallback)(() => {
|
|
32806
32917
|
const session = linkPopoverSessionRef.current;
|
|
32807
32918
|
addNavAfterAnchorRef.current = null;
|
|
32808
32919
|
setLinkPopover(null);
|
|
@@ -32810,9 +32921,9 @@ function OhhwellsBridge() {
|
|
|
32810
32921
|
reselectAfterLinkPopover(session.key);
|
|
32811
32922
|
}
|
|
32812
32923
|
}, [reselectAfterLinkPopover]);
|
|
32813
|
-
const closeLinkPopoverRef = (0,
|
|
32924
|
+
const closeLinkPopoverRef = (0, import_react25.useRef)(closeLinkPopover);
|
|
32814
32925
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
32815
|
-
const openLinkPopoverForActive = (0,
|
|
32926
|
+
const openLinkPopoverForActive = (0, import_react25.useCallback)(() => {
|
|
32816
32927
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
32817
32928
|
if (!hrefCtx) return;
|
|
32818
32929
|
bumpLinkPopoverGrace();
|
|
@@ -32823,7 +32934,7 @@ function OhhwellsBridge() {
|
|
|
32823
32934
|
});
|
|
32824
32935
|
deactivate();
|
|
32825
32936
|
}, [deactivate]);
|
|
32826
|
-
const openLinkPopoverForSelected = (0,
|
|
32937
|
+
const openLinkPopoverForSelected = (0, import_react25.useCallback)(() => {
|
|
32827
32938
|
const anchor = selectedElRef.current;
|
|
32828
32939
|
if (!anchor) return;
|
|
32829
32940
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -32840,7 +32951,7 @@ function OhhwellsBridge() {
|
|
|
32840
32951
|
});
|
|
32841
32952
|
deselect();
|
|
32842
32953
|
}, [deselect]);
|
|
32843
|
-
const handleSelectParent = (0,
|
|
32954
|
+
const handleSelectParent = (0, import_react25.useCallback)(() => {
|
|
32844
32955
|
const selected = selectedElRef.current;
|
|
32845
32956
|
if (!selected) return;
|
|
32846
32957
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -32867,7 +32978,7 @@ function OhhwellsBridge() {
|
|
|
32867
32978
|
}
|
|
32868
32979
|
deselectRef.current();
|
|
32869
32980
|
}, []);
|
|
32870
|
-
const handleDuplicateSelected = (0,
|
|
32981
|
+
const handleDuplicateSelected = (0, import_react25.useCallback)(() => {
|
|
32871
32982
|
const selected = selectedElRef.current;
|
|
32872
32983
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
32873
32984
|
if (isCtaButton(selected)) {
|
|
@@ -33036,7 +33147,7 @@ function OhhwellsBridge() {
|
|
|
33036
33147
|
});
|
|
33037
33148
|
}
|
|
33038
33149
|
}, [postToParent2, tokensForButton]);
|
|
33039
|
-
const runPendingDeleteUndo = (0,
|
|
33150
|
+
const runPendingDeleteUndo = (0, import_react25.useCallback)(() => {
|
|
33040
33151
|
const pending = pendingDeleteUndoRef.current;
|
|
33041
33152
|
if (!pending) return false;
|
|
33042
33153
|
pendingDeleteUndoRef.current = null;
|
|
@@ -33044,7 +33155,7 @@ function OhhwellsBridge() {
|
|
|
33044
33155
|
enforceLinkHrefs();
|
|
33045
33156
|
return true;
|
|
33046
33157
|
}, []);
|
|
33047
|
-
const handleDeleteSelected = (0,
|
|
33158
|
+
const handleDeleteSelected = (0, import_react25.useCallback)(() => {
|
|
33048
33159
|
const selected = selectedElRef.current;
|
|
33049
33160
|
if (!selected) return false;
|
|
33050
33161
|
if (isCtaButton(selected)) {
|
|
@@ -33106,7 +33217,7 @@ function OhhwellsBridge() {
|
|
|
33106
33217
|
}, [postToParent2]);
|
|
33107
33218
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
33108
33219
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
33109
|
-
const handleLinkPopoverSubmit = (0,
|
|
33220
|
+
const handleLinkPopoverSubmit = (0, import_react25.useCallback)(
|
|
33110
33221
|
(target) => {
|
|
33111
33222
|
const session = linkPopoverSessionRef.current;
|
|
33112
33223
|
if (!session) return;
|
|
@@ -33172,14 +33283,14 @@ function OhhwellsBridge() {
|
|
|
33172
33283
|
const showEditLink = toolbarShowEditLink;
|
|
33173
33284
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
33174
33285
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
33175
|
-
const handleMediaSelect = (0,
|
|
33286
|
+
const handleMediaSelect = (0, import_react25.useCallback)((key) => {
|
|
33176
33287
|
const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
|
|
33177
33288
|
(m) => (m.dataset.ohwKey ?? "") === key
|
|
33178
33289
|
) ?? null;
|
|
33179
33290
|
if (!el) return;
|
|
33180
33291
|
selectMediaElementRef.current(el);
|
|
33181
33292
|
}, []);
|
|
33182
|
-
const handleMediaReplace = (0,
|
|
33293
|
+
const handleMediaReplace = (0, import_react25.useCallback)(
|
|
33183
33294
|
(key) => {
|
|
33184
33295
|
postToParent2({
|
|
33185
33296
|
type: "ow:image-pick",
|
|
@@ -33189,13 +33300,13 @@ function OhhwellsBridge() {
|
|
|
33189
33300
|
},
|
|
33190
33301
|
[postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
|
|
33191
33302
|
);
|
|
33192
|
-
const handleEditCarousel = (0,
|
|
33303
|
+
const handleEditCarousel = (0, import_react25.useCallback)(
|
|
33193
33304
|
(key) => {
|
|
33194
33305
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
33195
33306
|
},
|
|
33196
33307
|
[postToParent2]
|
|
33197
33308
|
);
|
|
33198
|
-
const handleMediaFadeOutComplete = (0,
|
|
33309
|
+
const handleMediaFadeOutComplete = (0, import_react25.useCallback)((key) => {
|
|
33199
33310
|
setUploadingRects((prev) => {
|
|
33200
33311
|
if (!(key in prev)) return prev;
|
|
33201
33312
|
const next = { ...prev };
|
|
@@ -33203,7 +33314,7 @@ function OhhwellsBridge() {
|
|
|
33203
33314
|
return next;
|
|
33204
33315
|
});
|
|
33205
33316
|
}, []);
|
|
33206
|
-
const handleVideoSettingsChange = (0,
|
|
33317
|
+
const handleVideoSettingsChange = (0, import_react25.useCallback)(
|
|
33207
33318
|
(key, settings) => {
|
|
33208
33319
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
33209
33320
|
const video = getVideoEl2(el);
|
|
@@ -33939,6 +34050,8 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33939
34050
|
serializeAiFooterState,
|
|
33940
34051
|
shouldFetchContentForPath,
|
|
33941
34052
|
stepViableSlide,
|
|
34053
|
+
stripPlaceholderText,
|
|
34054
|
+
stripPlaceholders,
|
|
33942
34055
|
stripTextAlignCss,
|
|
33943
34056
|
toggleVariants,
|
|
33944
34057
|
useOhwCarousel,
|