@ohhwells/bridge 0.1.54-next.156 → 0.1.55
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 +323 -2375
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -18
- package/dist/index.d.ts +3 -18
- package/dist/index.js +318 -2375
- package/dist/index.js.map +1 -1
- package/dist/styles.css +0 -108
- package/package.json +1 -6
- package/dist/pages.cjs +0 -141
- package/dist/pages.cjs.map +0 -1
- package/dist/pages.d.cts +0 -45
- package/dist/pages.d.ts +0 -45
- package/dist/pages.js +0 -107
- package/dist/pages.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React11, { useCallback as
|
|
4
|
+
import React11, { useCallback as useCallback6, useEffect as useEffect11, useLayoutEffect as useLayoutEffect3, useRef as useRef8, useState as useState10 } from "react";
|
|
5
5
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync2 } from "react-dom";
|
|
7
7
|
|
|
@@ -118,59 +118,6 @@ function deleteSectionFromState(state, sectionId) {
|
|
|
118
118
|
return { ...state, v: 1, sections: state.sections, removed: [...removed, sectionId] };
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
// src/lib/brand-chrome.ts
|
|
122
|
-
var BRAND_NAME_KEY = "__ohw_brand_name";
|
|
123
|
-
var BRAND_TITLE_KEY = "__ohw_site_title";
|
|
124
|
-
var BRAND_FAVICON_LETTER_KEY = "__ohw_favicon_letter";
|
|
125
|
-
var BRAND_CHROME_KEYS = /* @__PURE__ */ new Set([
|
|
126
|
-
BRAND_NAME_KEY,
|
|
127
|
-
BRAND_TITLE_KEY,
|
|
128
|
-
BRAND_FAVICON_LETTER_KEY
|
|
129
|
-
]);
|
|
130
|
-
function upsertMeta(selector, attr, token, value) {
|
|
131
|
-
let el = document.head.querySelector(selector);
|
|
132
|
-
if (!el) {
|
|
133
|
-
el = document.createElement("meta");
|
|
134
|
-
el.setAttribute(attr, token);
|
|
135
|
-
document.head.appendChild(el);
|
|
136
|
-
}
|
|
137
|
-
if (el.getAttribute("content") !== value) el.setAttribute("content", value);
|
|
138
|
-
}
|
|
139
|
-
function escapeXml(value) {
|
|
140
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
141
|
-
}
|
|
142
|
-
function applyLetterFavicon(letter) {
|
|
143
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="12" fill="#111827"/><text x="32" y="46" font-family="system-ui,-apple-system,Segoe UI,sans-serif" font-size="40" font-weight="700" text-anchor="middle" fill="#ffffff">${escapeXml(letter)}</text></svg>`;
|
|
144
|
-
const href = `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
145
|
-
let link = document.head.querySelector('link[rel="icon"]');
|
|
146
|
-
if (!link) {
|
|
147
|
-
link = document.createElement("link");
|
|
148
|
-
link.rel = "icon";
|
|
149
|
-
document.head.appendChild(link);
|
|
150
|
-
}
|
|
151
|
-
link.type = "image/svg+xml";
|
|
152
|
-
if (link.href !== href) link.href = href;
|
|
153
|
-
}
|
|
154
|
-
function applyBrandChrome(content) {
|
|
155
|
-
const name = content[BRAND_NAME_KEY];
|
|
156
|
-
if (typeof name === "string" && name.length > 0) {
|
|
157
|
-
document.querySelectorAll("[data-ohw-wordmark]").forEach((el) => {
|
|
158
|
-
if (el.textContent !== name) el.textContent = name;
|
|
159
|
-
if (el.getAttribute("title") !== name) el.setAttribute("title", name);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
const title = content[BRAND_TITLE_KEY];
|
|
163
|
-
if (typeof title === "string" && title.length > 0) {
|
|
164
|
-
if (document.title !== title) document.title = title;
|
|
165
|
-
upsertMeta('meta[property="og:title"]', "property", "og:title", title);
|
|
166
|
-
upsertMeta('meta[name="twitter:title"]', "name", "twitter:title", title);
|
|
167
|
-
}
|
|
168
|
-
const letter = content[BRAND_FAVICON_LETTER_KEY];
|
|
169
|
-
if (typeof letter === "string" && letter.length > 0) {
|
|
170
|
-
applyLetterFavicon(letter);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
121
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
175
122
|
import { flushSync } from "react-dom";
|
|
176
123
|
import { createRoot } from "react-dom/client";
|
|
@@ -215,17 +162,13 @@ function MediaBox({
|
|
|
215
162
|
const url = refValue ? ctx.resolveMedia(refValue) : null;
|
|
216
163
|
const isIcon = /^(lucide|simple):/.test(refValue);
|
|
217
164
|
const aspectRatio = aspect && /^\d+:\d+$/.test(aspect) ? aspect.replace(":", " / ") : void 0;
|
|
218
|
-
const editAttrs = ctx.keyFor && editPath ? {
|
|
219
|
-
"data-ohw-key": ctx.keyFor(editPath),
|
|
220
|
-
"data-ohw-editable": isIcon ? "icon" : "image"
|
|
221
|
-
} : {};
|
|
165
|
+
const editAttrs = ctx.keyFor && editPath && !isIcon ? { "data-ohw-key": ctx.keyFor(editPath), "data-ohw-editable": "image" } : {};
|
|
222
166
|
if (isIcon) {
|
|
223
167
|
const Icon = refValue.startsWith("lucide:") ? lucideByName(refValue.slice(7)) : null;
|
|
224
168
|
return /* @__PURE__ */ jsx(
|
|
225
169
|
"span",
|
|
226
170
|
{
|
|
227
171
|
"data-ai-icon": refValue,
|
|
228
|
-
...editAttrs,
|
|
229
172
|
style: {
|
|
230
173
|
display: "inline-flex",
|
|
231
174
|
width: 48,
|
|
@@ -2010,7 +1953,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
2010
1953
|
const autoId = useId();
|
|
2011
1954
|
const insertAfter = insertAfterProp ?? autoId;
|
|
2012
1955
|
const [schedule, setSchedule] = useState2(null);
|
|
2013
|
-
const [loading, setLoading] = useState2(
|
|
1956
|
+
const [loading, setLoading] = useState2(true);
|
|
2014
1957
|
const [inEditor, setInEditor] = useState2(false);
|
|
2015
1958
|
const [isHovered, setIsHovered] = useState2(false);
|
|
2016
1959
|
const [modalState, setModalState] = useState2(null);
|
|
@@ -2184,10 +2127,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
2184
2127
|
"*"
|
|
2185
2128
|
);
|
|
2186
2129
|
};
|
|
2130
|
+
if (!inEditor && !loading && !schedule) return null;
|
|
2187
2131
|
const sectionId = `scheduling-${insertAfter}`;
|
|
2188
|
-
if (!inEditor && !loading && !schedule) {
|
|
2189
|
-
return /* @__PURE__ */ jsx4("section", { "data-ohw-section": sectionId, "data-ohw-scheduling-anchor": insertAfter, style: { display: "none" } });
|
|
2190
|
-
}
|
|
2191
2132
|
return /* @__PURE__ */ jsxs3(
|
|
2192
2133
|
"section",
|
|
2193
2134
|
{
|
|
@@ -5756,7 +5697,7 @@ CustomToolbarButton.displayName = "CustomToolbarButton";
|
|
|
5756
5697
|
|
|
5757
5698
|
// src/ui/item-action-toolbar.tsx
|
|
5758
5699
|
import { useState as useState3 } from "react";
|
|
5759
|
-
import {
|
|
5700
|
+
import { Copy, CornerLeftUp, Heading, Link, MoreHorizontal, Plus, Trash2 } from "lucide-react";
|
|
5760
5701
|
|
|
5761
5702
|
// src/ui/dropdown-menu.tsx
|
|
5762
5703
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
@@ -5921,7 +5862,6 @@ function ToolbarActionTooltip({
|
|
|
5921
5862
|
function ItemActionToolbar({
|
|
5922
5863
|
onEditLink,
|
|
5923
5864
|
onAddItem,
|
|
5924
|
-
onStyle,
|
|
5925
5865
|
onSelectParent,
|
|
5926
5866
|
onDuplicate,
|
|
5927
5867
|
onDelete,
|
|
@@ -5933,8 +5873,6 @@ function ItemActionToolbar({
|
|
|
5933
5873
|
deleteDisabled = false,
|
|
5934
5874
|
showEditLink = true,
|
|
5935
5875
|
showAddItem = true,
|
|
5936
|
-
showStyle = false,
|
|
5937
|
-
styleActive = false,
|
|
5938
5876
|
showMore = true,
|
|
5939
5877
|
tooltipSide = "bottom",
|
|
5940
5878
|
dropdownOpen = null,
|
|
@@ -6008,22 +5946,6 @@ function ItemActionToolbar({
|
|
|
6008
5946
|
children: /* @__PURE__ */ jsx11(Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
6009
5947
|
}
|
|
6010
5948
|
) : null,
|
|
6011
|
-
showStyle ? /* @__PURE__ */ jsx11(
|
|
6012
|
-
ToolbarActionTooltip,
|
|
6013
|
-
{
|
|
6014
|
-
label: "Style",
|
|
6015
|
-
side: tooltipSide,
|
|
6016
|
-
buttonProps: {
|
|
6017
|
-
active: styleActive,
|
|
6018
|
-
onMouseDown: (e) => {
|
|
6019
|
-
e.preventDefault();
|
|
6020
|
-
e.stopPropagation();
|
|
6021
|
-
onStyle?.();
|
|
6022
|
-
}
|
|
6023
|
-
},
|
|
6024
|
-
children: /* @__PURE__ */ jsx11(Brush, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
6025
|
-
}
|
|
6026
|
-
) : null,
|
|
6027
5949
|
showAddItem ? /* @__PURE__ */ jsx11(
|
|
6028
5950
|
ToolbarActionTooltip,
|
|
6029
5951
|
{
|
|
@@ -9530,445 +9452,6 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
9530
9452
|
};
|
|
9531
9453
|
}
|
|
9532
9454
|
|
|
9533
|
-
// src/lib/icon-markup.ts
|
|
9534
|
-
var GLYPH_SELECTOR = "svg, img";
|
|
9535
|
-
function referenceBox(slot) {
|
|
9536
|
-
const row = slot.closest("[data-ohw-socials-row]") ?? slot.closest("a")?.parentElement ?? null;
|
|
9537
|
-
const neighbour = row ? Array.from(row.querySelectorAll('[data-ohw-editable="icon"]')).find((el) => el !== slot) : null;
|
|
9538
|
-
const source = (neighbour ?? slot).querySelector(GLYPH_SELECTOR);
|
|
9539
|
-
const box = source?.getBoundingClientRect() ?? null;
|
|
9540
|
-
return box?.width && box.height ? box : null;
|
|
9541
|
-
}
|
|
9542
|
-
function iconMarkupSizedFor(slot, markup) {
|
|
9543
|
-
const box = referenceBox(slot);
|
|
9544
|
-
if (!box) return markup;
|
|
9545
|
-
const holder = document.createElement("div");
|
|
9546
|
-
holder.innerHTML = markup;
|
|
9547
|
-
const glyph = holder.querySelector(GLYPH_SELECTOR);
|
|
9548
|
-
if (!glyph) return markup;
|
|
9549
|
-
glyph.style.width = `${Math.round(box.width)}px`;
|
|
9550
|
-
glyph.style.height = `${Math.round(box.height)}px`;
|
|
9551
|
-
return holder.innerHTML;
|
|
9552
|
-
}
|
|
9553
|
-
function applyIconMarkup(slot, markup) {
|
|
9554
|
-
if (!markup) return;
|
|
9555
|
-
const coloured = iconMarkupInheritingColour(markup);
|
|
9556
|
-
const sized = iconMarkupSizedFor(slot, coloured);
|
|
9557
|
-
if (slot.innerHTML !== sized) slot.innerHTML = sized;
|
|
9558
|
-
if (sized === coloured) {
|
|
9559
|
-
requestAnimationFrame(() => {
|
|
9560
|
-
if (!slot.isConnected) return;
|
|
9561
|
-
const resized = iconMarkupSizedFor(slot, coloured);
|
|
9562
|
-
if (resized !== coloured && slot.innerHTML !== resized) slot.innerHTML = resized;
|
|
9563
|
-
});
|
|
9564
|
-
}
|
|
9565
|
-
}
|
|
9566
|
-
function detectIconStyle(el) {
|
|
9567
|
-
const row = el.closest("[data-ohw-socials-row]");
|
|
9568
|
-
const glyphs = Array.from((row ?? el).querySelectorAll("svg"));
|
|
9569
|
-
const outlined = glyphs.some((svg) => {
|
|
9570
|
-
return Array.from(svg.querySelectorAll("*")).some((node) => {
|
|
9571
|
-
return node.getAttribute("stroke") !== null && node.getAttribute("stroke") !== "none";
|
|
9572
|
-
});
|
|
9573
|
-
});
|
|
9574
|
-
return outlined ? "outline" : "fill";
|
|
9575
|
-
}
|
|
9576
|
-
function iconMarkupInheritingColour(markup) {
|
|
9577
|
-
const holder = document.createElement("div");
|
|
9578
|
-
holder.innerHTML = markup;
|
|
9579
|
-
holder.querySelectorAll("svg *").forEach((node) => {
|
|
9580
|
-
if (node.getAttribute("fill") && node.getAttribute("fill") !== "none") {
|
|
9581
|
-
node.setAttribute("fill", "currentColor");
|
|
9582
|
-
}
|
|
9583
|
-
if (node.getAttribute("stroke") && node.getAttribute("stroke") !== "none") {
|
|
9584
|
-
node.setAttribute("stroke", "currentColor");
|
|
9585
|
-
}
|
|
9586
|
-
});
|
|
9587
|
-
return holder.innerHTML;
|
|
9588
|
-
}
|
|
9589
|
-
|
|
9590
|
-
// src/lib/socials-items.ts
|
|
9591
|
-
var ICON_SELECTOR = '[data-ohw-editable="icon"]';
|
|
9592
|
-
var SOCIAL_KEY_RE = /(^|-)social(s)?(-|$)/i;
|
|
9593
|
-
var SOCIALS_ROW_ATTR = "data-ohw-socials-row";
|
|
9594
|
-
var SOCIALS_ITEM_ATTR = "data-ohw-social-item";
|
|
9595
|
-
function isSocialItem(el) {
|
|
9596
|
-
if (!el) return false;
|
|
9597
|
-
const anchor = el instanceof HTMLAnchorElement ? el : el.closest("a");
|
|
9598
|
-
if (!anchor) return false;
|
|
9599
|
-
if (SOCIAL_KEY_RE.test(anchor.getAttribute("data-ohw-href-key") ?? "")) return true;
|
|
9600
|
-
return anchor.querySelectorAll(ICON_SELECTOR).length === 1;
|
|
9601
|
-
}
|
|
9602
|
-
function getSocialItem(el) {
|
|
9603
|
-
const anchor = el.closest("a");
|
|
9604
|
-
return isSocialItem(anchor) ? anchor : null;
|
|
9605
|
-
}
|
|
9606
|
-
function findSocialsRow(el) {
|
|
9607
|
-
const item = getSocialItem(el);
|
|
9608
|
-
if (!item) return null;
|
|
9609
|
-
const wrapper = item.parentElement;
|
|
9610
|
-
const row = wrapper && wrapper.querySelectorAll("a").length === 1 && wrapper.matches("li, div, span") ? wrapper.parentElement : wrapper;
|
|
9611
|
-
if (!row) return null;
|
|
9612
|
-
const anchors = Array.from(row.querySelectorAll("a"));
|
|
9613
|
-
if (!anchors.length || !anchors.every((anchor) => isSocialItem(anchor))) return null;
|
|
9614
|
-
return row;
|
|
9615
|
-
}
|
|
9616
|
-
function isSocialsRow(el) {
|
|
9617
|
-
const anchors = Array.from(el.querySelectorAll("a"));
|
|
9618
|
-
return anchors.length > 0 && anchors.every((anchor) => isSocialItem(anchor));
|
|
9619
|
-
}
|
|
9620
|
-
function listSocialItems(row) {
|
|
9621
|
-
return Array.from(row.children).map((child) => {
|
|
9622
|
-
if (!(child instanceof HTMLElement)) return null;
|
|
9623
|
-
const anchor = child.matches("a") ? child : child.querySelector("a");
|
|
9624
|
-
return isSocialItem(anchor) ? anchor : null;
|
|
9625
|
-
}).filter((item) => item !== null);
|
|
9626
|
-
}
|
|
9627
|
-
function socialRowUnit(item) {
|
|
9628
|
-
const row = findSocialsRow(item);
|
|
9629
|
-
let node = item;
|
|
9630
|
-
while (node.parentElement && node.parentElement !== row) {
|
|
9631
|
-
node = node.parentElement;
|
|
9632
|
-
}
|
|
9633
|
-
return node;
|
|
9634
|
-
}
|
|
9635
|
-
function listSocialsRows(root = document) {
|
|
9636
|
-
const rows = /* @__PURE__ */ new Set();
|
|
9637
|
-
root.querySelectorAll(`${ICON_SELECTOR}, a[data-ohw-href-key]`).forEach((el) => {
|
|
9638
|
-
const row = findSocialsRow(el);
|
|
9639
|
-
if (row) rows.add(row);
|
|
9640
|
-
});
|
|
9641
|
-
root.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`).forEach((row) => rows.add(row));
|
|
9642
|
-
return Array.from(rows);
|
|
9643
|
-
}
|
|
9644
|
-
var rowTemplates = /* @__PURE__ */ new Map();
|
|
9645
|
-
function markSocialsRows(root = document) {
|
|
9646
|
-
root.querySelectorAll(`[${SOCIALS_ITEM_ATTR}]`).forEach((item) => {
|
|
9647
|
-
item.removeAttribute(SOCIALS_ITEM_ATTR);
|
|
9648
|
-
});
|
|
9649
|
-
listSocialsRows(root).forEach((row) => {
|
|
9650
|
-
row.setAttribute(SOCIALS_ROW_ATTR, "");
|
|
9651
|
-
const items = listSocialItems(row);
|
|
9652
|
-
if (items[0]) rowTemplates.set(rowKeyOf(row), socialRowUnit(items[0]).outerHTML);
|
|
9653
|
-
items.forEach((item, index) => {
|
|
9654
|
-
item.setAttribute(SOCIALS_ITEM_ATTR, String(index));
|
|
9655
|
-
const iconKey = socialIconKey(item);
|
|
9656
|
-
if (iconKey) ensureLabelSlot(item, iconKey);
|
|
9657
|
-
});
|
|
9658
|
-
});
|
|
9659
|
-
}
|
|
9660
|
-
var SOCIALS_LABEL_ATTR = "data-ohw-social-label";
|
|
9661
|
-
function ensureLabelSlot(item, iconKey) {
|
|
9662
|
-
if (socialLabelElement(item)) return;
|
|
9663
|
-
const label = document.createElement("span");
|
|
9664
|
-
label.setAttribute("data-ohw-key", `${iconKey}-label`);
|
|
9665
|
-
label.setAttribute("data-ohw-editable", "text");
|
|
9666
|
-
label.setAttribute(SOCIALS_LABEL_ATTR, "");
|
|
9667
|
-
label.style.display = "none";
|
|
9668
|
-
label.textContent = item.getAttribute("aria-label") ?? "";
|
|
9669
|
-
item.appendChild(label);
|
|
9670
|
-
}
|
|
9671
|
-
function socialLabelElement(item) {
|
|
9672
|
-
return item.querySelector(
|
|
9673
|
-
`[${SOCIALS_LABEL_ATTR}], [data-ohw-editable="text"], [data-ohw-editable="plain"]`
|
|
9674
|
-
);
|
|
9675
|
-
}
|
|
9676
|
-
function socialLabelKey(iconKey) {
|
|
9677
|
-
return `${iconKey}-label`;
|
|
9678
|
-
}
|
|
9679
|
-
function applyStoredValues(item, content) {
|
|
9680
|
-
const hrefKey = socialHrefKey(item);
|
|
9681
|
-
const iconKey = socialIconKey(item);
|
|
9682
|
-
if (hrefKey && content[hrefKey] !== void 0) item.setAttribute("href", content[hrefKey]);
|
|
9683
|
-
if (iconKey) {
|
|
9684
|
-
const glyph = item.querySelector(ICON_SELECTOR);
|
|
9685
|
-
if (glyph && content[iconKey]) applyIconMarkup(glyph, content[iconKey]);
|
|
9686
|
-
const label = item.querySelector(`[${SOCIALS_LABEL_ATTR}]`);
|
|
9687
|
-
label?.setAttribute("data-ohw-key", socialLabelKey(iconKey));
|
|
9688
|
-
const stored = content[socialLabelKey(iconKey)];
|
|
9689
|
-
if (label && stored) label.textContent = stored;
|
|
9690
|
-
}
|
|
9691
|
-
}
|
|
9692
|
-
function socialPlatformKey(iconKey) {
|
|
9693
|
-
return `${iconKey}-platform`;
|
|
9694
|
-
}
|
|
9695
|
-
function socialHrefKey(item) {
|
|
9696
|
-
return item.getAttribute("data-ohw-href-key");
|
|
9697
|
-
}
|
|
9698
|
-
function socialIconKey(item) {
|
|
9699
|
-
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
9700
|
-
}
|
|
9701
|
-
var SOCIALS_ORDER_KEY = "__ohw_socials_order";
|
|
9702
|
-
function fromMarkup(markup) {
|
|
9703
|
-
const holder = document.createElement("div");
|
|
9704
|
-
holder.innerHTML = markup;
|
|
9705
|
-
return holder.firstElementChild instanceof HTMLElement ? holder.firstElementChild : null;
|
|
9706
|
-
}
|
|
9707
|
-
var rowKeys = /* @__PURE__ */ new WeakMap();
|
|
9708
|
-
function rowKeyOf(row) {
|
|
9709
|
-
const first = listSocialItems(row)[0];
|
|
9710
|
-
const itemKey = first ? socialIconKey(first) ?? socialHrefKey(first)?.replace(/-href$/, "") : null;
|
|
9711
|
-
const derived = itemKey?.replace(/-[^-]+$/, "") || null;
|
|
9712
|
-
if (derived) rowKeys.set(row, derived);
|
|
9713
|
-
return derived ?? rowKeys.get(row) ?? "social";
|
|
9714
|
-
}
|
|
9715
|
-
function getSocialsOrderFromDom(root = document) {
|
|
9716
|
-
const order = {};
|
|
9717
|
-
listSocialsRows(root).forEach((row) => {
|
|
9718
|
-
order[rowKeyOf(row)] = listSocialItems(row).map((item) => socialHrefKey(item)).filter((key) => Boolean(key));
|
|
9719
|
-
});
|
|
9720
|
-
return order;
|
|
9721
|
-
}
|
|
9722
|
-
function hasStoredValue(content, hrefKey) {
|
|
9723
|
-
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9724
|
-
return Boolean(content[hrefKey]) || Boolean(content[iconKey]);
|
|
9725
|
-
}
|
|
9726
|
-
function parseSocialsOrder(raw) {
|
|
9727
|
-
if (!raw) return null;
|
|
9728
|
-
try {
|
|
9729
|
-
const parsed = JSON.parse(raw);
|
|
9730
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9731
|
-
} catch {
|
|
9732
|
-
return null;
|
|
9733
|
-
}
|
|
9734
|
-
}
|
|
9735
|
-
function nextSocialIndex(row, rowKey, content) {
|
|
9736
|
-
const used = listSocialItems(row).map((item) => socialHrefKey(item)).concat(Object.keys(content)).map((key) => key?.match(new RegExp(`^${rowKey}-(\\d+)`))?.[1]).map((digits) => digits === void 0 ? -1 : Number(digits));
|
|
9737
|
-
return Math.max(-1, ...used) + 1;
|
|
9738
|
-
}
|
|
9739
|
-
function insertSocialItem(row, after, content = {}) {
|
|
9740
|
-
const rowKey = rowKeyOf(row);
|
|
9741
|
-
const template = listSocialItems(row)[0];
|
|
9742
|
-
const remembered = rowTemplates.get(rowKey);
|
|
9743
|
-
if (!template && !remembered) return null;
|
|
9744
|
-
const index = nextSocialIndex(row, rowKey, content);
|
|
9745
|
-
const iconKey = `${rowKey}-${index}`;
|
|
9746
|
-
const hrefKey = `${iconKey}-href`;
|
|
9747
|
-
const templateUnit = template ? socialRowUnit(template) : null;
|
|
9748
|
-
const unit = templateUnit ? templateUnit.cloneNode(true) : fromMarkup(remembered);
|
|
9749
|
-
const item = unit && (unit.matches("a") ? unit : unit.querySelector("a"));
|
|
9750
|
-
if (!unit || !item) return null;
|
|
9751
|
-
item.setAttribute("data-ohw-href-key", hrefKey);
|
|
9752
|
-
item.setAttribute("href", "");
|
|
9753
|
-
item.removeAttribute("aria-label");
|
|
9754
|
-
item.querySelectorAll("[data-ohw-hovered], [data-ohw-selected]").forEach((el) => {
|
|
9755
|
-
el.removeAttribute("data-ohw-hovered");
|
|
9756
|
-
el.removeAttribute("data-ohw-selected");
|
|
9757
|
-
});
|
|
9758
|
-
const icon = item.querySelector(ICON_SELECTOR);
|
|
9759
|
-
icon?.setAttribute("data-ohw-key", iconKey);
|
|
9760
|
-
item.querySelector(`[${SOCIALS_LABEL_ATTR}]`)?.remove();
|
|
9761
|
-
const afterUnit = after ? socialRowUnit(after) : null;
|
|
9762
|
-
if (afterUnit && afterUnit.parentElement === row) afterUnit.insertAdjacentElement("afterend", unit);
|
|
9763
|
-
else row.appendChild(unit);
|
|
9764
|
-
markSocialsRows(row.ownerDocument);
|
|
9765
|
-
return { item, hrefKey, iconKey, order: getSocialsOrderFromDom(row.ownerDocument) };
|
|
9766
|
-
}
|
|
9767
|
-
function duplicateSocialItem(item, content) {
|
|
9768
|
-
const row = findSocialsRow(item);
|
|
9769
|
-
const created = row ? insertSocialItem(row, item, content) : null;
|
|
9770
|
-
if (!created) return null;
|
|
9771
|
-
const sourceHref = socialHrefKey(item);
|
|
9772
|
-
const sourceIcon = socialIconKey(item);
|
|
9773
|
-
const link = created.item;
|
|
9774
|
-
if (sourceHref) link.setAttribute("href", item.getAttribute("href") ?? "");
|
|
9775
|
-
const glyph = item.querySelector(ICON_SELECTOR)?.innerHTML;
|
|
9776
|
-
if (glyph) {
|
|
9777
|
-
const slot = link.querySelector(ICON_SELECTOR);
|
|
9778
|
-
if (slot) slot.innerHTML = glyph;
|
|
9779
|
-
}
|
|
9780
|
-
return {
|
|
9781
|
-
...created,
|
|
9782
|
-
copiedFrom: { href: sourceHref, icon: sourceIcon }
|
|
9783
|
-
};
|
|
9784
|
-
}
|
|
9785
|
-
function removeSocialItem(item, content) {
|
|
9786
|
-
const row = findSocialsRow(item);
|
|
9787
|
-
if (!row) return null;
|
|
9788
|
-
const hrefKey = socialHrefKey(item);
|
|
9789
|
-
const iconKey = socialIconKey(item);
|
|
9790
|
-
const removedKeys = [hrefKey, iconKey].filter((key) => Boolean(key));
|
|
9791
|
-
if (!removedKeys.length) return null;
|
|
9792
|
-
const previousOrder = getSocialsOrderFromDom(row.ownerDocument);
|
|
9793
|
-
const previousContent = Object.fromEntries(
|
|
9794
|
-
removedKeys.filter((key) => key in content).map((key) => [key, content[key]])
|
|
9795
|
-
);
|
|
9796
|
-
const unit = socialRowUnit(item);
|
|
9797
|
-
const nextSibling = unit.nextElementSibling;
|
|
9798
|
-
unit.remove();
|
|
9799
|
-
markSocialsRows(row.ownerDocument);
|
|
9800
|
-
return {
|
|
9801
|
-
removedKeys,
|
|
9802
|
-
previousContent,
|
|
9803
|
-
order: getSocialsOrderFromDom(row.ownerDocument),
|
|
9804
|
-
previousOrder,
|
|
9805
|
-
undo: () => {
|
|
9806
|
-
if (nextSibling) nextSibling.before(unit);
|
|
9807
|
-
else row.appendChild(unit);
|
|
9808
|
-
markSocialsRows(row.ownerDocument);
|
|
9809
|
-
}
|
|
9810
|
-
};
|
|
9811
|
-
}
|
|
9812
|
-
function applySocialsOrder(order, root = document) {
|
|
9813
|
-
listSocialsRows(root).forEach((row) => {
|
|
9814
|
-
const wanted = order[rowKeyOf(row)];
|
|
9815
|
-
if (!wanted) return;
|
|
9816
|
-
const byKey = new Map(listSocialItems(row).map((item) => [socialHrefKey(item), item]));
|
|
9817
|
-
wanted.forEach((key) => {
|
|
9818
|
-
const item = byKey.get(key);
|
|
9819
|
-
if (item) row.appendChild(socialRowUnit(item));
|
|
9820
|
-
});
|
|
9821
|
-
});
|
|
9822
|
-
markSocialsRows(root);
|
|
9823
|
-
}
|
|
9824
|
-
function reconcileSocialsFromContent(content, root = document) {
|
|
9825
|
-
markSocialsRows(root);
|
|
9826
|
-
const stored = parseSocialsOrder(content[SOCIALS_ORDER_KEY]);
|
|
9827
|
-
if (!stored) return;
|
|
9828
|
-
listSocialsRows(root).forEach((row) => {
|
|
9829
|
-
const wanted = stored[rowKeyOf(row)];
|
|
9830
|
-
if (!wanted) return;
|
|
9831
|
-
if (!wanted.length) return;
|
|
9832
|
-
wanted.forEach((key) => {
|
|
9833
|
-
if (listSocialItems(row).some((item) => socialHrefKey(item) === key)) return;
|
|
9834
|
-
if (!hasStoredValue(content, key)) return;
|
|
9835
|
-
const created = insertSocialItem(row, null, content);
|
|
9836
|
-
if (created) {
|
|
9837
|
-
created.item.setAttribute("data-ohw-href-key", key);
|
|
9838
|
-
created.item.querySelector(ICON_SELECTOR)?.setAttribute("data-ohw-key", key.replace(/-href$/, ""));
|
|
9839
|
-
applyStoredValues(created.item, content);
|
|
9840
|
-
}
|
|
9841
|
-
});
|
|
9842
|
-
const present = listSocialItems(row);
|
|
9843
|
-
const surviving = present.filter((item) => {
|
|
9844
|
-
const key = socialHrefKey(item);
|
|
9845
|
-
return !key || wanted.includes(key);
|
|
9846
|
-
});
|
|
9847
|
-
if (surviving.length) {
|
|
9848
|
-
present.forEach((item) => {
|
|
9849
|
-
if (!surviving.includes(item)) socialRowUnit(item).remove();
|
|
9850
|
-
});
|
|
9851
|
-
}
|
|
9852
|
-
});
|
|
9853
|
-
applySocialsOrder(stored, root);
|
|
9854
|
-
}
|
|
9855
|
-
var DROP_BAR_THICKNESS = 3;
|
|
9856
|
-
function buildSocialDropSlots(row) {
|
|
9857
|
-
const items = listSocialItems(row);
|
|
9858
|
-
if (!items.length) return [];
|
|
9859
|
-
return items.concat(items[items.length - 1]).map((item, index) => {
|
|
9860
|
-
const rect = item.getBoundingClientRect();
|
|
9861
|
-
const left = (index === items.length ? rect.right : rect.left) - DROP_BAR_THICKNESS / 2;
|
|
9862
|
-
return {
|
|
9863
|
-
insertIndex: index,
|
|
9864
|
-
columnIndex: -1,
|
|
9865
|
-
left,
|
|
9866
|
-
top: rect.top,
|
|
9867
|
-
width: DROP_BAR_THICKNESS,
|
|
9868
|
-
height: rect.height,
|
|
9869
|
-
direction: "vertical"
|
|
9870
|
-
};
|
|
9871
|
-
});
|
|
9872
|
-
}
|
|
9873
|
-
function findSocialByHrefKey(hrefKey, root = document) {
|
|
9874
|
-
const el = root.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
9875
|
-
return el ? getSocialItem(el) : null;
|
|
9876
|
-
}
|
|
9877
|
-
function buildSocialDropSlotsForKey(hrefKey, root = document) {
|
|
9878
|
-
const item = findSocialByHrefKey(hrefKey, root);
|
|
9879
|
-
const row = item ? findSocialsRow(item) : null;
|
|
9880
|
-
return row ? buildSocialDropSlots(row) : [];
|
|
9881
|
-
}
|
|
9882
|
-
function hitTestSocialDropSlot(clientX, clientY, draggedHrefKey, root = document) {
|
|
9883
|
-
const distanceTo = (slot) => {
|
|
9884
|
-
const dx = clientX - (slot.left + slot.width / 2);
|
|
9885
|
-
const dy = clientY < slot.top ? slot.top - clientY : Math.max(0, clientY - (slot.top + slot.height));
|
|
9886
|
-
return Math.hypot(dx, dy);
|
|
9887
|
-
};
|
|
9888
|
-
const slots = buildSocialDropSlotsForKey(draggedHrefKey, root);
|
|
9889
|
-
return slots.reduce((best, slot) => {
|
|
9890
|
-
return !best || distanceTo(slot) < distanceTo(best) ? slot : best;
|
|
9891
|
-
}, null);
|
|
9892
|
-
}
|
|
9893
|
-
function planSocialMove(hrefKey, insertIndex, root = document) {
|
|
9894
|
-
const item = findSocialByHrefKey(hrefKey, root);
|
|
9895
|
-
const row = item ? findSocialsRow(item) : null;
|
|
9896
|
-
if (!row) return null;
|
|
9897
|
-
const order = getSocialsOrderFromDom(root);
|
|
9898
|
-
const key = rowKeyOf(row);
|
|
9899
|
-
const current = order[key];
|
|
9900
|
-
if (!current) return null;
|
|
9901
|
-
const from = current.indexOf(hrefKey);
|
|
9902
|
-
if (from < 0) return null;
|
|
9903
|
-
const next = current.filter((_, index) => index !== from);
|
|
9904
|
-
next.splice(insertIndex > from ? insertIndex - 1 : insertIndex, 0, hrefKey);
|
|
9905
|
-
return { ...order, [key]: next };
|
|
9906
|
-
}
|
|
9907
|
-
var SOCIALS_DISPLAY_KEY = "__ohw_socials_display";
|
|
9908
|
-
function readSocialsDisplay(row) {
|
|
9909
|
-
const items = listSocialItems(row);
|
|
9910
|
-
const visible = (el) => Boolean(el) && el.style.display !== "none" && el.getAttribute("data-ohw-hidden") === null;
|
|
9911
|
-
return {
|
|
9912
|
-
text: items.some((item) => visible(socialLabelElement(item))),
|
|
9913
|
-
icon: items.some((item) => visible(item.querySelector(ICON_SELECTOR)))
|
|
9914
|
-
};
|
|
9915
|
-
}
|
|
9916
|
-
function parseSocialsDisplay(raw) {
|
|
9917
|
-
if (!raw) return null;
|
|
9918
|
-
try {
|
|
9919
|
-
const parsed = JSON.parse(raw);
|
|
9920
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9921
|
-
} catch {
|
|
9922
|
-
return null;
|
|
9923
|
-
}
|
|
9924
|
-
}
|
|
9925
|
-
function socialsDisplayFor(row, content) {
|
|
9926
|
-
return parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY])?.[rowKeyOf(row)] ?? readSocialsDisplay(row);
|
|
9927
|
-
}
|
|
9928
|
-
function socialsDisplayWith(row, display, content) {
|
|
9929
|
-
return { ...parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]) ?? {}, [rowKeyOf(row)]: display };
|
|
9930
|
-
}
|
|
9931
|
-
function applySocialsDisplayToRow(row, display) {
|
|
9932
|
-
listSocialItems(row).forEach((item) => {
|
|
9933
|
-
const label = socialLabelElement(item);
|
|
9934
|
-
const icon = item.querySelector(ICON_SELECTOR);
|
|
9935
|
-
if (label) label.style.display = display.text ? "" : "none";
|
|
9936
|
-
if (icon) icon.style.display = display.icon ? "" : "none";
|
|
9937
|
-
});
|
|
9938
|
-
}
|
|
9939
|
-
function applySocialsDisplayFromContent(content, root = document) {
|
|
9940
|
-
const stored = parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]);
|
|
9941
|
-
if (!stored) return;
|
|
9942
|
-
listSocialsRows(root).forEach((row) => {
|
|
9943
|
-
const display = stored[rowKeyOf(row)];
|
|
9944
|
-
if (!display) return;
|
|
9945
|
-
if (display.icon) {
|
|
9946
|
-
listSocialItems(row).forEach((item) => {
|
|
9947
|
-
const iconKey = ensureIconSlot(item);
|
|
9948
|
-
const slot = item.querySelector(ICON_SELECTOR);
|
|
9949
|
-
if (iconKey && slot && content[iconKey]) applyIconMarkup(slot, content[iconKey]);
|
|
9950
|
-
});
|
|
9951
|
-
}
|
|
9952
|
-
applySocialsDisplayToRow(row, display);
|
|
9953
|
-
});
|
|
9954
|
-
}
|
|
9955
|
-
function socialsMissingIcons(row) {
|
|
9956
|
-
return listSocialItems(row).filter((item) => !item.querySelector(ICON_SELECTOR)).map((item) => ({ hrefKey: socialHrefKey(item) ?? "", url: item.getAttribute("href") ?? "" })).filter((entry) => Boolean(entry.hrefKey));
|
|
9957
|
-
}
|
|
9958
|
-
function ensureIconSlot(item) {
|
|
9959
|
-
const existing = item.querySelector(ICON_SELECTOR);
|
|
9960
|
-
if (existing) return existing.dataset.ohwKey ?? null;
|
|
9961
|
-
const hrefKey = socialHrefKey(item);
|
|
9962
|
-
if (!hrefKey) return null;
|
|
9963
|
-
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9964
|
-
const slot = document.createElement("span");
|
|
9965
|
-
slot.setAttribute("data-ohw-key", iconKey);
|
|
9966
|
-
slot.setAttribute("data-ohw-editable", "icon");
|
|
9967
|
-
slot.style.display = "inline-flex";
|
|
9968
|
-
item.prepend(slot);
|
|
9969
|
-
return iconKey;
|
|
9970
|
-
}
|
|
9971
|
-
|
|
9972
9455
|
// src/lib/footer-items.ts
|
|
9973
9456
|
var FOOTER_ORDER_KEY = "__ohw_footer_order";
|
|
9974
9457
|
var MAX_FOOTER_COLUMNS = 18;
|
|
@@ -10813,329 +10296,6 @@ function deleteFooterColumn(column) {
|
|
|
10813
10296
|
};
|
|
10814
10297
|
}
|
|
10815
10298
|
|
|
10816
|
-
// src/lib/logo-identity.ts
|
|
10817
|
-
var LOGO_TEXT_KEYS = ["nav-logo-text", "footer-logo-text", "logo-text"];
|
|
10818
|
-
var LOGO_IMAGE_KEYS = ["nav-logo-image", "footer-logo", "footer-logo-image"];
|
|
10819
|
-
var LOGO_HREF_KEYS = ["nav-logo-href", "footer-logo-href", "logo-href"];
|
|
10820
|
-
var LOGO_PLACEHOLDER_KEY = "logo-is-placeholder";
|
|
10821
|
-
var LOGO_ALT_KEY = "logo-alt";
|
|
10822
|
-
var LOGO_IMAGE_URL_KEY = "nav-logo-image";
|
|
10823
|
-
var PLACEHOLDER_BUSINESS_NAME = "Business name";
|
|
10824
|
-
function resolveLogoDisplayText(text) {
|
|
10825
|
-
const trimmed = (text ?? "").trim();
|
|
10826
|
-
return trimmed || PLACEHOLDER_BUSINESS_NAME;
|
|
10827
|
-
}
|
|
10828
|
-
function isFooterLogoRoot(root) {
|
|
10829
|
-
return Boolean(root.closest("footer") || root.closest('[data-ohw-section="footer"]'));
|
|
10830
|
-
}
|
|
10831
|
-
function imageKeyForRoot(root) {
|
|
10832
|
-
return isFooterLogoRoot(root) ? "footer-logo" : "nav-logo-image";
|
|
10833
|
-
}
|
|
10834
|
-
function textKeyForRoot(root) {
|
|
10835
|
-
return isFooterLogoRoot(root) ? "footer-logo-text" : "nav-logo-text";
|
|
10836
|
-
}
|
|
10837
|
-
function ensureLogoHrefKey(root) {
|
|
10838
|
-
if (!(root instanceof HTMLAnchorElement)) return;
|
|
10839
|
-
if (root.hasAttribute("data-ohw-href-key")) return;
|
|
10840
|
-
root.setAttribute("data-ohw-href-key", isFooterLogoRoot(root) ? "footer-logo-href" : "nav-logo-href");
|
|
10841
|
-
}
|
|
10842
|
-
function applyLogoIdentity(text, isPlaceholder) {
|
|
10843
|
-
const display = resolveLogoDisplayText(text);
|
|
10844
|
-
const placeholder = isPlaceholder || !text.trim() || display === PLACEHOLDER_BUSINESS_NAME;
|
|
10845
|
-
for (const key of LOGO_TEXT_KEYS) {
|
|
10846
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
10847
|
-
if (el.textContent !== display) el.textContent = display;
|
|
10848
|
-
});
|
|
10849
|
-
}
|
|
10850
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
10851
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
10852
|
-
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
10853
|
-
if (img) img.alt = display;
|
|
10854
|
-
});
|
|
10855
|
-
}
|
|
10856
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((el) => {
|
|
10857
|
-
if (placeholder) el.setAttribute("data-ohw-placeholder", "");
|
|
10858
|
-
else el.removeAttribute("data-ohw-placeholder");
|
|
10859
|
-
});
|
|
10860
|
-
return display;
|
|
10861
|
-
}
|
|
10862
|
-
function applyLogoImage(url, alt) {
|
|
10863
|
-
const displayAlt = resolveLogoDisplayText(alt);
|
|
10864
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
10865
|
-
ensureLogoHrefKey(root);
|
|
10866
|
-
const imageKey = imageKeyForRoot(root);
|
|
10867
|
-
const textKey = textKeyForRoot(root);
|
|
10868
|
-
let img = root.querySelector(`img[data-ohw-key="${imageKey}"]`) ?? (root.querySelector(`[data-ohw-key="${imageKey}"]`) instanceof HTMLImageElement ? root.querySelector(`[data-ohw-key="${imageKey}"]`) : null) ?? root.querySelector("img");
|
|
10869
|
-
let textEl = root.querySelector(`[data-ohw-key="${textKey}"]`) ?? root.querySelector('[data-ohw-key="logo-text"]');
|
|
10870
|
-
if (url) {
|
|
10871
|
-
if (!img) {
|
|
10872
|
-
img = document.createElement("img");
|
|
10873
|
-
img.setAttribute("data-ohw-editable", "image");
|
|
10874
|
-
img.setAttribute("data-ohw-key", imageKey);
|
|
10875
|
-
img.alt = displayAlt;
|
|
10876
|
-
img.style.height = "";
|
|
10877
|
-
img.style.maxHeight = "none";
|
|
10878
|
-
img.style.width = "auto";
|
|
10879
|
-
img.style.display = "block";
|
|
10880
|
-
img.style.objectFit = "contain";
|
|
10881
|
-
root.insertBefore(img, root.firstChild);
|
|
10882
|
-
} else {
|
|
10883
|
-
img.setAttribute("data-ohw-editable", "image");
|
|
10884
|
-
img.setAttribute("data-ohw-key", imageKey);
|
|
10885
|
-
}
|
|
10886
|
-
img.removeAttribute("srcset");
|
|
10887
|
-
img.removeAttribute("sizes");
|
|
10888
|
-
img.src = url;
|
|
10889
|
-
img.alt = displayAlt;
|
|
10890
|
-
img.style.display = "block";
|
|
10891
|
-
if (textEl) textEl.style.display = "none";
|
|
10892
|
-
root.removeAttribute("data-ohw-placeholder");
|
|
10893
|
-
return;
|
|
10894
|
-
}
|
|
10895
|
-
if (img) {
|
|
10896
|
-
img.removeAttribute("src");
|
|
10897
|
-
img.removeAttribute("srcset");
|
|
10898
|
-
img.removeAttribute("sizes");
|
|
10899
|
-
img.alt = displayAlt;
|
|
10900
|
-
img.style.display = "none";
|
|
10901
|
-
}
|
|
10902
|
-
if (!textEl) {
|
|
10903
|
-
textEl = document.createElement("span");
|
|
10904
|
-
textEl.setAttribute("data-ohw-editable", "plain");
|
|
10905
|
-
textEl.setAttribute("data-ohw-key", textKey);
|
|
10906
|
-
root.appendChild(textEl);
|
|
10907
|
-
}
|
|
10908
|
-
textEl.style.display = "";
|
|
10909
|
-
if (textEl.textContent !== displayAlt) textEl.textContent = displayAlt;
|
|
10910
|
-
if (!displayAlt.trim() || displayAlt === PLACEHOLDER_BUSINESS_NAME) {
|
|
10911
|
-
root.setAttribute("data-ohw-placeholder", "");
|
|
10912
|
-
} else {
|
|
10913
|
-
root.removeAttribute("data-ohw-placeholder");
|
|
10914
|
-
}
|
|
10915
|
-
});
|
|
10916
|
-
}
|
|
10917
|
-
function applyLogoHref(href) {
|
|
10918
|
-
const target = href.trim() || "/";
|
|
10919
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
10920
|
-
ensureLogoHrefKey(root);
|
|
10921
|
-
if (root instanceof HTMLAnchorElement) {
|
|
10922
|
-
root.setAttribute("href", target);
|
|
10923
|
-
}
|
|
10924
|
-
});
|
|
10925
|
-
for (const key of LOGO_HREF_KEYS) setStoredLinkHref(key, target);
|
|
10926
|
-
}
|
|
10927
|
-
function readLogoIdentityFromDom() {
|
|
10928
|
-
let imageUrl = null;
|
|
10929
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
10930
|
-
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
10931
|
-
const img = el instanceof HTMLImageElement ? el : el?.querySelector("img");
|
|
10932
|
-
const attrSrc = img?.getAttribute("src")?.trim() ?? "";
|
|
10933
|
-
if (attrSrc && !attrSrc.startsWith("data:") && img && img.style.display !== "none") {
|
|
10934
|
-
imageUrl = img.currentSrc || img.src;
|
|
10935
|
-
break;
|
|
10936
|
-
}
|
|
10937
|
-
}
|
|
10938
|
-
let text = PLACEHOLDER_BUSINESS_NAME;
|
|
10939
|
-
let isPlaceholder = true;
|
|
10940
|
-
for (const key of LOGO_TEXT_KEYS) {
|
|
10941
|
-
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
10942
|
-
if (el?.textContent?.trim()) {
|
|
10943
|
-
text = el.textContent.trim();
|
|
10944
|
-
const logoRoot2 = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
10945
|
-
isPlaceholder = logoRoot2?.hasAttribute("data-ohw-placeholder") === true || text === PLACEHOLDER_BUSINESS_NAME;
|
|
10946
|
-
break;
|
|
10947
|
-
}
|
|
10948
|
-
}
|
|
10949
|
-
if (imageUrl) {
|
|
10950
|
-
const logoImg = document.querySelector(
|
|
10951
|
-
'[data-ohw-key="nav-logo-image"], [data-ohw-key="footer-logo"]'
|
|
10952
|
-
);
|
|
10953
|
-
const alt = logoImg?.alt?.trim() || text;
|
|
10954
|
-
isPlaceholder = false;
|
|
10955
|
-
const hrefEl = document.querySelector(
|
|
10956
|
-
'a[data-ohw-role="logo"], a[data-ohw-logo], [data-ohw-role="logo"]'
|
|
10957
|
-
);
|
|
10958
|
-
const href2 = (hrefEl instanceof HTMLAnchorElement ? hrefEl.getAttribute("href") : null) || hrefEl?.closest("a")?.getAttribute("href") || "/";
|
|
10959
|
-
return { text, isPlaceholder, imageUrl, href: href2, alt };
|
|
10960
|
-
}
|
|
10961
|
-
const logoRoot = document.querySelector('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
10962
|
-
const href = (logoRoot instanceof HTMLAnchorElement ? logoRoot.getAttribute("href") : null) || logoRoot?.closest("a")?.getAttribute("href") || "/";
|
|
10963
|
-
return { text, isPlaceholder, imageUrl: null, href, alt: text };
|
|
10964
|
-
}
|
|
10965
|
-
function applyLogoFromContent(content) {
|
|
10966
|
-
const hasLogoIdentity = LOGO_PLACEHOLDER_KEY in content || LOGO_TEXT_KEYS.some((key) => key in content) || LOGO_IMAGE_KEYS.some((key) => key in content) || LOGO_ALT_KEY in content || LOGO_HREF_KEYS.some((key) => key in content);
|
|
10967
|
-
if (!hasLogoIdentity) return false;
|
|
10968
|
-
const logoText = content[LOGO_TEXT_KEYS[0]] ?? content[LOGO_TEXT_KEYS[1]] ?? readLogoIdentityFromDom().text;
|
|
10969
|
-
const logoAlt = content[LOGO_ALT_KEY] ?? logoText;
|
|
10970
|
-
const rawLogoImage = content[LOGO_IMAGE_URL_KEY] ?? content["footer-logo"] ?? content["footer-logo-image"] ?? null;
|
|
10971
|
-
const logoImageUrl = typeof rawLogoImage === "string" && rawLogoImage.trim() ? rawLogoImage.trim() : null;
|
|
10972
|
-
const imageExplicitlyCleared = LOGO_IMAGE_KEYS.some((key) => key in content) && !logoImageUrl;
|
|
10973
|
-
const logoIsPlaceholder = LOGO_PLACEHOLDER_KEY in content ? content[LOGO_PLACEHOLDER_KEY] !== "false" : !logoImageUrl && (!logoText.trim() || logoText === PLACEHOLDER_BUSINESS_NAME);
|
|
10974
|
-
if (logoImageUrl) {
|
|
10975
|
-
applyLogoImage(logoImageUrl, logoAlt);
|
|
10976
|
-
} else {
|
|
10977
|
-
if (imageExplicitlyCleared) applyLogoImage(null, logoAlt);
|
|
10978
|
-
applyLogoIdentity(logoText, logoIsPlaceholder);
|
|
10979
|
-
}
|
|
10980
|
-
const logoHref = content["nav-logo-href"] ?? content["footer-logo-href"] ?? content["logo-href"];
|
|
10981
|
-
if (typeof logoHref === "string" && logoHref.trim()) {
|
|
10982
|
-
applyLogoHref(logoHref);
|
|
10983
|
-
}
|
|
10984
|
-
return true;
|
|
10985
|
-
}
|
|
10986
|
-
|
|
10987
|
-
// src/lib/logo-size.ts
|
|
10988
|
-
var LOGO_SIZE_DEFAULTS = {
|
|
10989
|
-
navbar: 28,
|
|
10990
|
-
footer: 32
|
|
10991
|
-
};
|
|
10992
|
-
var LOGO_SIZE_MIN = 16;
|
|
10993
|
-
var LOGO_SIZE_MAX = 80;
|
|
10994
|
-
var LOGO_SIZE_DESKTOP_KEYS = {
|
|
10995
|
-
navbar: "nav-logo-size",
|
|
10996
|
-
footer: "footer-logo-size"
|
|
10997
|
-
};
|
|
10998
|
-
var LOGO_SIZE_MOBILE_KEYS = {
|
|
10999
|
-
navbar: "nav-logo-size-mobile",
|
|
11000
|
-
footer: "footer-logo-size-mobile"
|
|
11001
|
-
};
|
|
11002
|
-
var LOGO_SIZE_KEYS = [
|
|
11003
|
-
LOGO_SIZE_DESKTOP_KEYS.navbar,
|
|
11004
|
-
LOGO_SIZE_DESKTOP_KEYS.footer,
|
|
11005
|
-
LOGO_SIZE_MOBILE_KEYS.navbar,
|
|
11006
|
-
LOGO_SIZE_MOBILE_KEYS.footer
|
|
11007
|
-
];
|
|
11008
|
-
function isFooterLogoRoot2(root) {
|
|
11009
|
-
return Boolean(root.closest("footer") || root.closest('[data-ohw-section="footer"]'));
|
|
11010
|
-
}
|
|
11011
|
-
function getLogoPlacement(root) {
|
|
11012
|
-
return isFooterLogoRoot2(root) ? "footer" : "navbar";
|
|
11013
|
-
}
|
|
11014
|
-
function parseLogoSizePx(raw, fallback) {
|
|
11015
|
-
if (raw == null || raw === "") return fallback;
|
|
11016
|
-
const n = Number.parseFloat(raw);
|
|
11017
|
-
if (!Number.isFinite(n)) return fallback;
|
|
11018
|
-
return Math.min(LOGO_SIZE_MAX, Math.max(LOGO_SIZE_MIN, Math.round(n)));
|
|
11019
|
-
}
|
|
11020
|
-
function isMobileLogoSizeFollowing(content, placement) {
|
|
11021
|
-
const raw = content[LOGO_SIZE_MOBILE_KEYS[placement]];
|
|
11022
|
-
return raw == null || raw.trim() === "";
|
|
11023
|
-
}
|
|
11024
|
-
function resolveDesktopLogoSize(content, placement) {
|
|
11025
|
-
return parseLogoSizePx(content[LOGO_SIZE_DESKTOP_KEYS[placement]], LOGO_SIZE_DEFAULTS[placement]);
|
|
11026
|
-
}
|
|
11027
|
-
function resolveMobileLogoSize(content, placement) {
|
|
11028
|
-
if (isMobileLogoSizeFollowing(content, placement)) {
|
|
11029
|
-
return resolveDesktopLogoSize(content, placement);
|
|
11030
|
-
}
|
|
11031
|
-
return parseLogoSizePx(
|
|
11032
|
-
content[LOGO_SIZE_MOBILE_KEYS[placement]],
|
|
11033
|
-
resolveDesktopLogoSize(content, placement)
|
|
11034
|
-
);
|
|
11035
|
-
}
|
|
11036
|
-
function setRootSizeVars(root, desktopPx, mobilePx, following) {
|
|
11037
|
-
root.style.setProperty("--ohw-logo-size", `${desktopPx}px`);
|
|
11038
|
-
if (following) {
|
|
11039
|
-
root.style.removeProperty("--ohw-logo-size-mobile");
|
|
11040
|
-
} else {
|
|
11041
|
-
root.style.setProperty("--ohw-logo-size-mobile", `${mobilePx}px`);
|
|
11042
|
-
}
|
|
11043
|
-
root.querySelectorAll("img").forEach((img) => {
|
|
11044
|
-
img.style.height = "";
|
|
11045
|
-
img.style.maxHeight = "none";
|
|
11046
|
-
img.style.width = "auto";
|
|
11047
|
-
img.style.objectFit = "contain";
|
|
11048
|
-
});
|
|
11049
|
-
}
|
|
11050
|
-
function applyLogoSizes(content) {
|
|
11051
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
11052
|
-
const placement = getLogoPlacement(root);
|
|
11053
|
-
const desktop = resolveDesktopLogoSize(content, placement);
|
|
11054
|
-
const following = isMobileLogoSizeFollowing(content, placement);
|
|
11055
|
-
const mobile = following ? desktop : resolveMobileLogoSize(content, placement);
|
|
11056
|
-
setRootSizeVars(root, desktop, mobile, following);
|
|
11057
|
-
});
|
|
11058
|
-
}
|
|
11059
|
-
function applyLogoSizeToPlacement(placement, desktopPx, mobilePx, following) {
|
|
11060
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
11061
|
-
if (getLogoPlacement(root) !== placement) return;
|
|
11062
|
-
setRootSizeVars(root, desktopPx, mobilePx, following);
|
|
11063
|
-
});
|
|
11064
|
-
}
|
|
11065
|
-
function logoHasUploadedImage(logoEl) {
|
|
11066
|
-
if (logoEl.hasAttribute("data-ohw-placeholder")) return false;
|
|
11067
|
-
const img = logoEl.querySelector('img[data-ohw-key="nav-logo-image"], img[data-ohw-key="footer-logo"], img[data-ohw-key="footer-logo-image"]') ?? logoEl.querySelector("img");
|
|
11068
|
-
if (!img) return false;
|
|
11069
|
-
const src = img.getAttribute("src")?.trim() ?? "";
|
|
11070
|
-
if (!src || src.startsWith("data:")) return false;
|
|
11071
|
-
if (img.style.display === "none") return false;
|
|
11072
|
-
return true;
|
|
11073
|
-
}
|
|
11074
|
-
function getLogoInteractionRect(logoEl) {
|
|
11075
|
-
if (logoHasUploadedImage(logoEl)) {
|
|
11076
|
-
const img = logoEl.querySelector('img[data-ohw-key="nav-logo-image"], img[data-ohw-key="footer-logo"], img[data-ohw-key="footer-logo-image"]') ?? logoEl.querySelector("img");
|
|
11077
|
-
if (img) {
|
|
11078
|
-
const r2 = img.getBoundingClientRect();
|
|
11079
|
-
if (r2.width > 0 && r2.height > 0) return r2;
|
|
11080
|
-
}
|
|
11081
|
-
}
|
|
11082
|
-
const text = logoEl.querySelector(
|
|
11083
|
-
'[data-ohw-key="nav-logo-text"], [data-ohw-key="footer-logo-text"]'
|
|
11084
|
-
);
|
|
11085
|
-
if (text) {
|
|
11086
|
-
const style = window.getComputedStyle(text);
|
|
11087
|
-
if (style.display !== "none" && style.visibility !== "hidden") {
|
|
11088
|
-
const r2 = text.getBoundingClientRect();
|
|
11089
|
-
if (r2.width > 0 && r2.height > 0) return r2;
|
|
11090
|
-
}
|
|
11091
|
-
}
|
|
11092
|
-
return logoEl.getBoundingClientRect();
|
|
11093
|
-
}
|
|
11094
|
-
function readLogoSizeState(content, placement) {
|
|
11095
|
-
const desktopPx = resolveDesktopLogoSize(content, placement);
|
|
11096
|
-
const mobileFollowing = isMobileLogoSizeFollowing(content, placement);
|
|
11097
|
-
const mobilePx = mobileFollowing ? desktopPx : resolveMobileLogoSize(content, placement);
|
|
11098
|
-
return { desktopPx, mobilePx, mobileFollowing };
|
|
11099
|
-
}
|
|
11100
|
-
|
|
11101
|
-
// src/lib/site-wide-scope.ts
|
|
11102
|
-
function getLogoElement(el) {
|
|
11103
|
-
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
11104
|
-
if (marked) return marked;
|
|
11105
|
-
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
11106
|
-
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
11107
|
-
if (!root) return null;
|
|
11108
|
-
const anchor = el.closest("a");
|
|
11109
|
-
if (anchor && root.contains(anchor) && !anchor.hasAttribute("data-ohw-href-key") && !anchor.closest("[data-ohw-nav-container]") && Boolean(anchor.querySelector("img") || anchor.matches("img"))) {
|
|
11110
|
-
return anchor;
|
|
11111
|
-
}
|
|
11112
|
-
const img = el.matches("img") ? el : null;
|
|
11113
|
-
if (img && !img.closest("[data-ohw-href-key]") && !img.closest("[data-ohw-nav-container]") && (img.closest("footer") || img.closest("nav, [data-ohw-nav-root]"))) {
|
|
11114
|
-
return img;
|
|
11115
|
-
}
|
|
11116
|
-
return null;
|
|
11117
|
-
}
|
|
11118
|
-
function isInFooter(el) {
|
|
11119
|
-
if (!el) return false;
|
|
11120
|
-
return Boolean(el.closest("footer") || el.closest('[data-ohw-section="footer"]'));
|
|
11121
|
-
}
|
|
11122
|
-
function isSiteWideElement(el) {
|
|
11123
|
-
if (!el) return false;
|
|
11124
|
-
if (getLogoElement(el)) return true;
|
|
11125
|
-
if (isInFooter(el)) return true;
|
|
11126
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-root")) {
|
|
11127
|
-
return true;
|
|
11128
|
-
}
|
|
11129
|
-
if (el.hasAttribute("data-ohw-href-key") && el.closest("nav, [data-ohw-nav-root], [data-ohw-nav-drawer], aside")) {
|
|
11130
|
-
return true;
|
|
11131
|
-
}
|
|
11132
|
-
if (el.closest('[data-ohw-role="navbar-button"]')) return true;
|
|
11133
|
-
return false;
|
|
11134
|
-
}
|
|
11135
|
-
function isSiteWideScopeActive(args) {
|
|
11136
|
-
return isSiteWideElement(args.selected) || isSiteWideElement(args.hoveredItem) || isSiteWideElement(args.hoveredNavContainer) || isSiteWideElement(args.active);
|
|
11137
|
-
}
|
|
11138
|
-
|
|
11139
10299
|
// src/lib/add-footer-column.ts
|
|
11140
10300
|
function buildFooterColumnEditContentPatch(result) {
|
|
11141
10301
|
return {
|
|
@@ -11168,381 +10328,19 @@ function addFooterColumnWithPersist({
|
|
|
11168
10328
|
return result;
|
|
11169
10329
|
}
|
|
11170
10330
|
|
|
11171
|
-
// src/
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
useRef as useRef7,
|
|
11177
|
-
useState as useState8
|
|
11178
|
-
} from "react";
|
|
11179
|
-
import { X as X5 } from "lucide-react";
|
|
11180
|
-
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
11181
|
-
var PANEL_WIDTH = 256;
|
|
11182
|
-
var EDGE_MARGIN = 16;
|
|
11183
|
-
function getVisibleClip(parentScroll) {
|
|
11184
|
-
const left = 0;
|
|
11185
|
-
const right = window.innerWidth;
|
|
11186
|
-
if (!parentScroll) {
|
|
11187
|
-
return { top: 0, bottom: window.innerHeight, left, right };
|
|
10331
|
+
// src/lib/item-drag-interaction.ts
|
|
10332
|
+
function disableNativeHrefDrag(el) {
|
|
10333
|
+
if (el.draggable) el.draggable = false;
|
|
10334
|
+
if (el.getAttribute("draggable") !== "false") {
|
|
10335
|
+
el.setAttribute("draggable", "false");
|
|
11188
10336
|
}
|
|
11189
|
-
const { iframeOffsetTop, headerH: visibleCanvasTop, canvasH } = parentScroll;
|
|
11190
|
-
const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
|
|
11191
|
-
const bottom = Math.min(window.innerHeight, visibleCanvasTop + canvasH - iframeOffsetTop);
|
|
11192
|
-
return { top, bottom: Math.max(top, bottom), left, right };
|
|
11193
10337
|
}
|
|
11194
|
-
function
|
|
11195
|
-
const
|
|
11196
|
-
|
|
11197
|
-
x: Math.max(EDGE_MARGIN, clip.right - PANEL_WIDTH - EDGE_MARGIN),
|
|
11198
|
-
y: Math.min(
|
|
11199
|
-
Math.max(clip.top + EDGE_MARGIN, EDGE_MARGIN),
|
|
11200
|
-
Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelHeight - EDGE_MARGIN)
|
|
11201
|
-
)
|
|
11202
|
-
};
|
|
10338
|
+
function clearTextSelection() {
|
|
10339
|
+
const sel = window.getSelection();
|
|
10340
|
+
if (sel && !sel.isCollapsed) sel.removeAllRanges();
|
|
11203
10341
|
}
|
|
11204
|
-
function
|
|
11205
|
-
|
|
11206
|
-
const maxX = Math.max(clip.left + EDGE_MARGIN, clip.right - panelW - EDGE_MARGIN);
|
|
11207
|
-
const maxY = Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelH - EDGE_MARGIN);
|
|
11208
|
-
return {
|
|
11209
|
-
x: Math.min(Math.max(pos.x, clip.left + EDGE_MARGIN), maxX),
|
|
11210
|
-
y: Math.min(Math.max(pos.y, clip.top + EDGE_MARGIN), maxY)
|
|
11211
|
-
};
|
|
11212
|
-
}
|
|
11213
|
-
function FloatingPanel({
|
|
11214
|
-
open,
|
|
11215
|
-
title,
|
|
11216
|
-
context,
|
|
11217
|
-
icon,
|
|
11218
|
-
onClose,
|
|
11219
|
-
children,
|
|
11220
|
-
position,
|
|
11221
|
-
onPositionChange,
|
|
11222
|
-
parentScroll = null,
|
|
11223
|
-
className,
|
|
11224
|
-
bodyClassName
|
|
11225
|
-
}) {
|
|
11226
|
-
const panelRef = useRef7(null);
|
|
11227
|
-
const [measured, setMeasured] = useState8({ w: PANEL_WIDTH, h: 280 });
|
|
11228
|
-
const dragRef = useRef7(null);
|
|
11229
|
-
const resolved = position ?? defaultFloatingPanelPosition(parentScroll, measured.h);
|
|
11230
|
-
const clamped = clampPosition(resolved, parentScroll, measured.w, measured.h);
|
|
11231
|
-
useLayoutEffect3(() => {
|
|
11232
|
-
if (!open || !panelRef.current) return;
|
|
11233
|
-
const el = panelRef.current;
|
|
11234
|
-
const next = { w: el.offsetWidth || PANEL_WIDTH, h: el.offsetHeight || 280 };
|
|
11235
|
-
setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
|
|
11236
|
-
}, [open, children, title, context]);
|
|
11237
|
-
useEffect9(() => {
|
|
11238
|
-
if (!open || !position || !onPositionChange) return;
|
|
11239
|
-
const next = clampPosition(position, parentScroll, measured.w, measured.h);
|
|
11240
|
-
if (next.x !== position.x || next.y !== position.y) onPositionChange(next);
|
|
11241
|
-
}, [open, parentScroll, measured.w, measured.h, position, onPositionChange]);
|
|
11242
|
-
const onHeaderPointerDown = useCallback5(
|
|
11243
|
-
(e) => {
|
|
11244
|
-
if (e.button !== 0) return;
|
|
11245
|
-
if (e.target.closest("[data-ohw-floating-panel-close]")) return;
|
|
11246
|
-
e.preventDefault();
|
|
11247
|
-
e.stopPropagation();
|
|
11248
|
-
const el = e.currentTarget;
|
|
11249
|
-
el.setPointerCapture(e.pointerId);
|
|
11250
|
-
dragRef.current = {
|
|
11251
|
-
pointerId: e.pointerId,
|
|
11252
|
-
startX: e.clientX,
|
|
11253
|
-
startY: e.clientY,
|
|
11254
|
-
originX: clamped.x,
|
|
11255
|
-
originY: clamped.y
|
|
11256
|
-
};
|
|
11257
|
-
},
|
|
11258
|
-
[clamped.x, clamped.y]
|
|
11259
|
-
);
|
|
11260
|
-
const onHeaderPointerMove = useCallback5(
|
|
11261
|
-
(e) => {
|
|
11262
|
-
const drag = dragRef.current;
|
|
11263
|
-
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
11264
|
-
e.preventDefault();
|
|
11265
|
-
const next = clampPosition(
|
|
11266
|
-
{
|
|
11267
|
-
x: drag.originX + (e.clientX - drag.startX),
|
|
11268
|
-
y: drag.originY + (e.clientY - drag.startY)
|
|
11269
|
-
},
|
|
11270
|
-
parentScroll,
|
|
11271
|
-
measured.w,
|
|
11272
|
-
measured.h
|
|
11273
|
-
);
|
|
11274
|
-
onPositionChange?.(next);
|
|
11275
|
-
},
|
|
11276
|
-
[measured.h, measured.w, onPositionChange, parentScroll]
|
|
11277
|
-
);
|
|
11278
|
-
const endDrag = useCallback5((e) => {
|
|
11279
|
-
const drag = dragRef.current;
|
|
11280
|
-
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
11281
|
-
dragRef.current = null;
|
|
11282
|
-
try {
|
|
11283
|
-
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
11284
|
-
} catch {
|
|
11285
|
-
}
|
|
11286
|
-
}, []);
|
|
11287
|
-
if (!open) return null;
|
|
11288
|
-
return /* @__PURE__ */ jsxs16(
|
|
11289
|
-
"div",
|
|
11290
|
-
{
|
|
11291
|
-
ref: panelRef,
|
|
11292
|
-
"data-ohw-floating-panel": "",
|
|
11293
|
-
role: "dialog",
|
|
11294
|
-
"aria-label": title,
|
|
11295
|
-
className: cn(
|
|
11296
|
-
// Above MediaOverlay / item chrome (2147483646); link-modal content shares this tier.
|
|
11297
|
-
"fixed z-[2147483647] flex w-64 flex-col overflow-hidden rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
11298
|
-
className
|
|
11299
|
-
),
|
|
11300
|
-
style: { left: clamped.x, top: clamped.y },
|
|
11301
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
11302
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
11303
|
-
onClick: (e) => e.stopPropagation(),
|
|
11304
|
-
children: [
|
|
11305
|
-
/* @__PURE__ */ jsxs16(
|
|
11306
|
-
"div",
|
|
11307
|
-
{
|
|
11308
|
-
"data-ohw-floating-panel-header": "",
|
|
11309
|
-
className: "relative flex cursor-grab items-start gap-2 border-b border-border py-5 pl-5 pr-11 active:cursor-grabbing",
|
|
11310
|
-
onPointerDown: onHeaderPointerDown,
|
|
11311
|
-
onPointerMove: onHeaderPointerMove,
|
|
11312
|
-
onPointerUp: endDrag,
|
|
11313
|
-
onPointerCancel: endDrag,
|
|
11314
|
-
children: [
|
|
11315
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
11316
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
11317
|
-
icon ? /* @__PURE__ */ jsx26("span", { className: "shrink-0 text-foreground", children: icon }) : null,
|
|
11318
|
-
/* @__PURE__ */ jsx26("p", { className: "min-w-0 flex-1 text-lg font-semibold leading-7 text-foreground", children: title })
|
|
11319
|
-
] }),
|
|
11320
|
-
context ? /* @__PURE__ */ jsx26("p", { className: "w-full text-sm leading-5 text-muted-foreground", children: context }) : null
|
|
11321
|
-
] }),
|
|
11322
|
-
/* @__PURE__ */ jsx26(
|
|
11323
|
-
"button",
|
|
11324
|
-
{
|
|
11325
|
-
type: "button",
|
|
11326
|
-
"data-ohw-floating-panel-close": "",
|
|
11327
|
-
"aria-label": "Close",
|
|
11328
|
-
className: "absolute right-2.5 top-2.5 rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
11329
|
-
onClick: (e) => {
|
|
11330
|
-
e.stopPropagation();
|
|
11331
|
-
onClose();
|
|
11332
|
-
},
|
|
11333
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
11334
|
-
children: /* @__PURE__ */ jsx26(X5, { size: 16, "aria-hidden": true })
|
|
11335
|
-
}
|
|
11336
|
-
)
|
|
11337
|
-
]
|
|
11338
|
-
}
|
|
11339
|
-
),
|
|
11340
|
-
/* @__PURE__ */ jsx26(
|
|
11341
|
-
"div",
|
|
11342
|
-
{
|
|
11343
|
-
"data-ohw-floating-panel-body": "",
|
|
11344
|
-
className: cn("flex w-full flex-col gap-4 p-5", bodyClassName),
|
|
11345
|
-
children
|
|
11346
|
-
}
|
|
11347
|
-
)
|
|
11348
|
-
]
|
|
11349
|
-
}
|
|
11350
|
-
);
|
|
11351
|
-
}
|
|
11352
|
-
|
|
11353
|
-
// src/ui/logo-size-panel.tsx
|
|
11354
|
-
import { ArrowUpRight, Link as Link2 } from "lucide-react";
|
|
11355
|
-
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
11356
|
-
function SizeSlider({
|
|
11357
|
-
value,
|
|
11358
|
-
onChange
|
|
11359
|
-
}) {
|
|
11360
|
-
const pct = (value - LOGO_SIZE_MIN) / (LOGO_SIZE_MAX - LOGO_SIZE_MIN) * 100;
|
|
11361
|
-
return /* @__PURE__ */ jsxs17("div", { className: "flex w-full flex-col gap-3", children: [
|
|
11362
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex w-full items-center gap-2 text-sm font-medium leading-5", children: [
|
|
11363
|
-
/* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1 text-foreground", children: "Size" }),
|
|
11364
|
-
/* @__PURE__ */ jsxs17("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: [
|
|
11365
|
-
value,
|
|
11366
|
-
" px"
|
|
11367
|
-
] })
|
|
11368
|
-
] }),
|
|
11369
|
-
/* @__PURE__ */ jsxs17("div", { className: "relative h-2 w-full rounded-full bg-primary-50", children: [
|
|
11370
|
-
/* @__PURE__ */ jsx27(
|
|
11371
|
-
"div",
|
|
11372
|
-
{
|
|
11373
|
-
className: "absolute inset-y-0 left-0 rounded-full bg-primary",
|
|
11374
|
-
style: { width: `${pct}%` }
|
|
11375
|
-
}
|
|
11376
|
-
),
|
|
11377
|
-
/* @__PURE__ */ jsx27(
|
|
11378
|
-
"input",
|
|
11379
|
-
{
|
|
11380
|
-
type: "range",
|
|
11381
|
-
min: LOGO_SIZE_MIN,
|
|
11382
|
-
max: LOGO_SIZE_MAX,
|
|
11383
|
-
step: 1,
|
|
11384
|
-
value,
|
|
11385
|
-
"aria-label": "Logo size",
|
|
11386
|
-
className: cn(
|
|
11387
|
-
"absolute inset-0 h-full w-full cursor-pointer appearance-none bg-transparent",
|
|
11388
|
-
"[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:size-5",
|
|
11389
|
-
"[&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2",
|
|
11390
|
-
"[&::-webkit-slider-thumb]:border-primary [&::-webkit-slider-thumb]:bg-background",
|
|
11391
|
-
"[&::-moz-range-thumb]:size-5 [&::-moz-range-thumb]:rounded-full",
|
|
11392
|
-
"[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-primary",
|
|
11393
|
-
"[&::-moz-range-thumb]:bg-background"
|
|
11394
|
-
),
|
|
11395
|
-
onChange: (e) => onChange(Number(e.target.value))
|
|
11396
|
-
}
|
|
11397
|
-
)
|
|
11398
|
-
] })
|
|
11399
|
-
] });
|
|
11400
|
-
}
|
|
11401
|
-
function LogoSizePanel({
|
|
11402
|
-
viewport,
|
|
11403
|
-
sizePx,
|
|
11404
|
-
mobileFollowing = true,
|
|
11405
|
-
onSizeChange,
|
|
11406
|
-
onCustomizeMobile,
|
|
11407
|
-
onResetMobile,
|
|
11408
|
-
onUpdateEverywhere,
|
|
11409
|
-
className
|
|
11410
|
-
}) {
|
|
11411
|
-
const showFollowing = viewport === "mobile" && mobileFollowing;
|
|
11412
|
-
const showMobileSlider = viewport === "mobile" && !mobileFollowing;
|
|
11413
|
-
const showDesktopSlider = viewport === "desktop";
|
|
11414
|
-
return /* @__PURE__ */ jsxs17("div", { className: cn("flex w-full flex-col gap-4", className), children: [
|
|
11415
|
-
showFollowing ? /* @__PURE__ */ jsxs17("div", { className: "flex w-full flex-col gap-2", children: [
|
|
11416
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-1", children: [
|
|
11417
|
-
/* @__PURE__ */ jsx27(Link2, { size: 16, className: "mt-0.5 shrink-0 text-foreground", "aria-hidden": true }),
|
|
11418
|
-
/* @__PURE__ */ jsx27("p", { className: "text-sm font-semibold leading-5 text-foreground", children: "Following desktop size" })
|
|
11419
|
-
] }),
|
|
11420
|
-
/* @__PURE__ */ jsx27("p", { className: "text-sm leading-5 text-muted-foreground", children: "Mobile uses the desktop size until you customize it. Change the desktop size and it follows automatically." }),
|
|
11421
|
-
/* @__PURE__ */ jsx27(
|
|
11422
|
-
Button,
|
|
11423
|
-
{
|
|
11424
|
-
type: "button",
|
|
11425
|
-
variant: "outline",
|
|
11426
|
-
size: "sm",
|
|
11427
|
-
className: "h-9 w-full min-w-0 cursor-pointer",
|
|
11428
|
-
onClick: onCustomizeMobile,
|
|
11429
|
-
children: "Customize for mobile"
|
|
11430
|
-
}
|
|
11431
|
-
)
|
|
11432
|
-
] }) : null,
|
|
11433
|
-
showDesktopSlider || showMobileSlider ? /* @__PURE__ */ jsx27(SizeSlider, { value: sizePx, onChange: onSizeChange }) : null,
|
|
11434
|
-
showMobileSlider ? /* @__PURE__ */ jsx27(
|
|
11435
|
-
Button,
|
|
11436
|
-
{
|
|
11437
|
-
type: "button",
|
|
11438
|
-
variant: "outline",
|
|
11439
|
-
size: "sm",
|
|
11440
|
-
className: "h-9 w-full min-w-0 cursor-pointer",
|
|
11441
|
-
onClick: onResetMobile,
|
|
11442
|
-
children: "Reset to desktop size"
|
|
11443
|
-
}
|
|
11444
|
-
) : null,
|
|
11445
|
-
/* @__PURE__ */ jsx27("div", { className: "h-px w-full bg-border", role: "separator" }),
|
|
11446
|
-
/* @__PURE__ */ jsxs17(
|
|
11447
|
-
Button,
|
|
11448
|
-
{
|
|
11449
|
-
type: "button",
|
|
11450
|
-
variant: "outline",
|
|
11451
|
-
size: "sm",
|
|
11452
|
-
className: "h-9 w-full min-w-0 cursor-pointer gap-1",
|
|
11453
|
-
onClick: onUpdateEverywhere,
|
|
11454
|
-
children: [
|
|
11455
|
-
"Update logo everywhere",
|
|
11456
|
-
/* @__PURE__ */ jsx27(ArrowUpRight, { size: 16, "aria-hidden": true })
|
|
11457
|
-
]
|
|
11458
|
-
}
|
|
11459
|
-
),
|
|
11460
|
-
/* @__PURE__ */ jsx27("p", { className: "text-sm leading-5 text-muted-foreground", children: "Matches the right version to your background." })
|
|
11461
|
-
] });
|
|
11462
|
-
}
|
|
11463
|
-
|
|
11464
|
-
// src/ui/socials-display-panel.tsx
|
|
11465
|
-
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
11466
|
-
function DisplaySwitch({
|
|
11467
|
-
label,
|
|
11468
|
-
checked,
|
|
11469
|
-
disabled,
|
|
11470
|
-
onChange
|
|
11471
|
-
}) {
|
|
11472
|
-
return /* @__PURE__ */ jsxs18("div", { className: "flex w-full items-center gap-2", children: [
|
|
11473
|
-
/* @__PURE__ */ jsx28(
|
|
11474
|
-
"span",
|
|
11475
|
-
{
|
|
11476
|
-
className: cn(
|
|
11477
|
-
"min-w-0 flex-1 text-sm font-medium leading-5",
|
|
11478
|
-
disabled ? "text-muted-foreground" : "text-foreground"
|
|
11479
|
-
),
|
|
11480
|
-
children: label
|
|
11481
|
-
}
|
|
11482
|
-
),
|
|
11483
|
-
/* @__PURE__ */ jsx28(
|
|
11484
|
-
"button",
|
|
11485
|
-
{
|
|
11486
|
-
type: "button",
|
|
11487
|
-
role: "switch",
|
|
11488
|
-
"aria-checked": checked,
|
|
11489
|
-
"aria-label": label,
|
|
11490
|
-
disabled,
|
|
11491
|
-
onClick: () => onChange(!checked),
|
|
11492
|
-
className: cn(
|
|
11493
|
-
"relative h-5 w-9 shrink-0 rounded-full transition-colors",
|
|
11494
|
-
checked ? "bg-primary" : "bg-primary-50",
|
|
11495
|
-
disabled ? "cursor-default opacity-50" : "cursor-pointer"
|
|
11496
|
-
),
|
|
11497
|
-
children: /* @__PURE__ */ jsx28(
|
|
11498
|
-
"span",
|
|
11499
|
-
{
|
|
11500
|
-
className: cn(
|
|
11501
|
-
"absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all",
|
|
11502
|
-
checked ? "left-[1.125rem]" : "left-0.5"
|
|
11503
|
-
)
|
|
11504
|
-
}
|
|
11505
|
-
)
|
|
11506
|
-
}
|
|
11507
|
-
)
|
|
11508
|
-
] });
|
|
11509
|
-
}
|
|
11510
|
-
function SocialsDisplayPanel({ display, onChange, className }) {
|
|
11511
|
-
return /* @__PURE__ */ jsxs18("div", { className: cn("flex w-full flex-col gap-3", className), children: [
|
|
11512
|
-
/* @__PURE__ */ jsx28(
|
|
11513
|
-
DisplaySwitch,
|
|
11514
|
-
{
|
|
11515
|
-
label: "Text",
|
|
11516
|
-
checked: display.text,
|
|
11517
|
-
disabled: display.text && !display.icon,
|
|
11518
|
-
onChange: (text) => onChange({ ...display, text })
|
|
11519
|
-
}
|
|
11520
|
-
),
|
|
11521
|
-
/* @__PURE__ */ jsx28(
|
|
11522
|
-
DisplaySwitch,
|
|
11523
|
-
{
|
|
11524
|
-
label: "Icon",
|
|
11525
|
-
checked: display.icon,
|
|
11526
|
-
disabled: display.icon && !display.text,
|
|
11527
|
-
onChange: (icon) => onChange({ ...display, icon })
|
|
11528
|
-
}
|
|
11529
|
-
)
|
|
11530
|
-
] });
|
|
11531
|
-
}
|
|
11532
|
-
|
|
11533
|
-
// src/lib/item-drag-interaction.ts
|
|
11534
|
-
function disableNativeHrefDrag(el) {
|
|
11535
|
-
if (el.draggable) el.draggable = false;
|
|
11536
|
-
if (el.getAttribute("draggable") !== "false") {
|
|
11537
|
-
el.setAttribute("draggable", "false");
|
|
11538
|
-
}
|
|
11539
|
-
}
|
|
11540
|
-
function clearTextSelection() {
|
|
11541
|
-
const sel = window.getSelection();
|
|
11542
|
-
if (sel && !sel.isCollapsed) sel.removeAllRanges();
|
|
11543
|
-
}
|
|
11544
|
-
function armItemPressDrag() {
|
|
11545
|
-
document.documentElement.setAttribute("data-ohw-footer-press-drag", "");
|
|
10342
|
+
function armItemPressDrag() {
|
|
10343
|
+
document.documentElement.setAttribute("data-ohw-footer-press-drag", "");
|
|
11546
10344
|
}
|
|
11547
10345
|
function lockItemDuringDrag() {
|
|
11548
10346
|
document.documentElement.removeAttribute("data-ohw-footer-press-drag");
|
|
@@ -11728,7 +10526,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
|
|
|
11728
10526
|
}
|
|
11729
10527
|
|
|
11730
10528
|
// src/useNavItemDrag.ts
|
|
11731
|
-
import { useCallback as
|
|
10529
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef7, useState as useState8 } from "react";
|
|
11732
10530
|
function useNavItemDrag({
|
|
11733
10531
|
isEditMode,
|
|
11734
10532
|
editContentRef,
|
|
@@ -11752,11 +10550,11 @@ function useNavItemDrag({
|
|
|
11752
10550
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
11753
10551
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
11754
10552
|
}) {
|
|
11755
|
-
const navDragRef =
|
|
11756
|
-
const [navDropSlots, setNavDropSlots] =
|
|
11757
|
-
const [activeNavDropIndex, setActiveNavDropIndex] =
|
|
11758
|
-
const navPointerDragRef =
|
|
11759
|
-
const clearNavDragVisuals =
|
|
10553
|
+
const navDragRef = useRef7(null);
|
|
10554
|
+
const [navDropSlots, setNavDropSlots] = useState8([]);
|
|
10555
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = useState8(null);
|
|
10556
|
+
const navPointerDragRef = useRef7(null);
|
|
10557
|
+
const clearNavDragVisuals = useCallback5(() => {
|
|
11760
10558
|
const session = navDragRef.current;
|
|
11761
10559
|
const keepOpenEl = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.draggedEl : null;
|
|
11762
10560
|
navDragRef.current = null;
|
|
@@ -11773,7 +10571,7 @@ function useNavItemDrag({
|
|
|
11773
10571
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
11774
10572
|
unlockItemDragInteraction();
|
|
11775
10573
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
11776
|
-
const refreshNavDragVisuals =
|
|
10574
|
+
const refreshNavDragVisuals = useCallback5(
|
|
11777
10575
|
(session, activeSlot, clientX, clientY) => {
|
|
11778
10576
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
11779
10577
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -11791,13 +10589,13 @@ function useNavItemDrag({
|
|
|
11791
10589
|
},
|
|
11792
10590
|
[setDraggedItemRect, setSiblingHintRects]
|
|
11793
10591
|
);
|
|
11794
|
-
const refreshNavDragVisualsRef =
|
|
10592
|
+
const refreshNavDragVisualsRef = useRef7(refreshNavDragVisuals);
|
|
11795
10593
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
11796
|
-
const commitNavDragRef =
|
|
10594
|
+
const commitNavDragRef = useRef7(() => {
|
|
11797
10595
|
});
|
|
11798
|
-
const beginNavDragRef =
|
|
10596
|
+
const beginNavDragRef = useRef7(() => {
|
|
11799
10597
|
});
|
|
11800
|
-
const beginNavDrag =
|
|
10598
|
+
const beginNavDrag = useCallback5(
|
|
11801
10599
|
(session) => {
|
|
11802
10600
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
11803
10601
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -11831,7 +10629,7 @@ function useNavItemDrag({
|
|
|
11831
10629
|
]
|
|
11832
10630
|
);
|
|
11833
10631
|
beginNavDragRef.current = beginNavDrag;
|
|
11834
|
-
const commitNavDrag =
|
|
10632
|
+
const commitNavDrag = useCallback5(
|
|
11835
10633
|
(clientX, clientY) => {
|
|
11836
10634
|
const session = navDragRef.current;
|
|
11837
10635
|
if (!session) {
|
|
@@ -11892,7 +10690,7 @@ function useNavItemDrag({
|
|
|
11892
10690
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
11893
10691
|
);
|
|
11894
10692
|
commitNavDragRef.current = commitNavDrag;
|
|
11895
|
-
const startNavLinkDrag =
|
|
10693
|
+
const startNavLinkDrag = useCallback5(
|
|
11896
10694
|
(anchor, clientX, clientY, wasSelected) => {
|
|
11897
10695
|
if (footerDragRef.current) return false;
|
|
11898
10696
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -11910,7 +10708,7 @@ function useNavItemDrag({
|
|
|
11910
10708
|
},
|
|
11911
10709
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
11912
10710
|
);
|
|
11913
|
-
const onNavDragOver =
|
|
10711
|
+
const onNavDragOver = useCallback5(
|
|
11914
10712
|
(e) => {
|
|
11915
10713
|
const session = navDragRef.current;
|
|
11916
10714
|
if (!session) return false;
|
|
@@ -11922,7 +10720,7 @@ function useNavItemDrag({
|
|
|
11922
10720
|
},
|
|
11923
10721
|
[]
|
|
11924
10722
|
);
|
|
11925
|
-
|
|
10723
|
+
useEffect9(() => {
|
|
11926
10724
|
if (!isEditMode) return;
|
|
11927
10725
|
const THRESHOLD = 10;
|
|
11928
10726
|
const resolveWasSelected = (el) => {
|
|
@@ -12047,7 +10845,7 @@ function useNavItemDrag({
|
|
|
12047
10845
|
setLinkPopover,
|
|
12048
10846
|
suppressNextClickRef
|
|
12049
10847
|
]);
|
|
12050
|
-
const armNavPressFromChrome =
|
|
10848
|
+
const armNavPressFromChrome = useCallback5(
|
|
12051
10849
|
(selected, clientX, clientY, pointerId) => {
|
|
12052
10850
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
12053
10851
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -12079,7 +10877,7 @@ function useNavItemDrag({
|
|
|
12079
10877
|
|
|
12080
10878
|
// src/ui/footer-container-chrome.tsx
|
|
12081
10879
|
import { Plus as Plus2 } from "lucide-react";
|
|
12082
|
-
import { jsx as
|
|
10880
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
12083
10881
|
function FooterContainerChrome({
|
|
12084
10882
|
rect,
|
|
12085
10883
|
onAdd,
|
|
@@ -12087,7 +10885,7 @@ function FooterContainerChrome({
|
|
|
12087
10885
|
}) {
|
|
12088
10886
|
const chromeGap = 6;
|
|
12089
10887
|
const buttonMargin = 7;
|
|
12090
|
-
return /* @__PURE__ */
|
|
10888
|
+
return /* @__PURE__ */ jsx26(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx26(
|
|
12091
10889
|
"div",
|
|
12092
10890
|
{
|
|
12093
10891
|
"data-ohw-footer-container-chrome": "",
|
|
@@ -12099,8 +10897,8 @@ function FooterContainerChrome({
|
|
|
12099
10897
|
width: rect.width + chromeGap * 2,
|
|
12100
10898
|
height: rect.height + chromeGap * 2
|
|
12101
10899
|
},
|
|
12102
|
-
children: /* @__PURE__ */
|
|
12103
|
-
/* @__PURE__ */
|
|
10900
|
+
children: /* @__PURE__ */ jsxs16(Tooltip, { children: [
|
|
10901
|
+
/* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(
|
|
12104
10902
|
"button",
|
|
12105
10903
|
{
|
|
12106
10904
|
type: "button",
|
|
@@ -12119,17 +10917,17 @@ function FooterContainerChrome({
|
|
|
12119
10917
|
if (addDisabled) return;
|
|
12120
10918
|
onAdd();
|
|
12121
10919
|
},
|
|
12122
|
-
children: /* @__PURE__ */
|
|
10920
|
+
children: /* @__PURE__ */ jsx26(Plus2, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
12123
10921
|
}
|
|
12124
10922
|
) }),
|
|
12125
|
-
/* @__PURE__ */
|
|
10923
|
+
/* @__PURE__ */ jsx26(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
12126
10924
|
] })
|
|
12127
10925
|
}
|
|
12128
10926
|
) });
|
|
12129
10927
|
}
|
|
12130
10928
|
|
|
12131
10929
|
// src/lib/carousel.ts
|
|
12132
|
-
import { useEffect as
|
|
10930
|
+
import { useEffect as useEffect10, useState as useState9 } from "react";
|
|
12133
10931
|
var CAROUSEL_ATTR = "data-ohw-carousel";
|
|
12134
10932
|
var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
|
|
12135
10933
|
var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
|
|
@@ -12191,8 +10989,8 @@ function applyCarouselNode(key, val) {
|
|
|
12191
10989
|
return true;
|
|
12192
10990
|
}
|
|
12193
10991
|
function useOhwCarousel(key, initial) {
|
|
12194
|
-
const [images, setImages] =
|
|
12195
|
-
|
|
10992
|
+
const [images, setImages] = useState9(initial);
|
|
10993
|
+
useEffect10(() => {
|
|
12196
10994
|
const el = document.querySelector(
|
|
12197
10995
|
`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
|
|
12198
10996
|
);
|
|
@@ -12305,18 +11103,6 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
12305
11103
|
}
|
|
12306
11104
|
if (extraContent && !isScoped) {
|
|
12307
11105
|
applyNavFooterDeleteOverrides(byKey, extraContent);
|
|
12308
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
12309
|
-
if (!(key in extraContent)) continue;
|
|
12310
|
-
byKey.set(key, { key, type: "image", text: extraContent[key] ?? "" });
|
|
12311
|
-
}
|
|
12312
|
-
for (const key of [LOGO_PLACEHOLDER_KEY, LOGO_ALT_KEY]) {
|
|
12313
|
-
if (!(key in extraContent)) continue;
|
|
12314
|
-
byKey.set(key, { key, type: "meta", text: extraContent[key] ?? "" });
|
|
12315
|
-
}
|
|
12316
|
-
for (const key of LOGO_SIZE_KEYS) {
|
|
12317
|
-
if (!(key in extraContent)) continue;
|
|
12318
|
-
byKey.set(key, { key, type: "meta", text: extraContent[key] ?? "" });
|
|
12319
|
-
}
|
|
12320
11106
|
}
|
|
12321
11107
|
return Array.from(byKey.values());
|
|
12322
11108
|
}
|
|
@@ -12419,7 +11205,7 @@ function isNavbarLinksContainer(el) {
|
|
|
12419
11205
|
function isNavigationItem(el) {
|
|
12420
11206
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
12421
11207
|
if (!anchor) return false;
|
|
12422
|
-
return Boolean(anchor.querySelector('[data-ohw-editable="text"]'))
|
|
11208
|
+
return Boolean(anchor.querySelector('[data-ohw-editable="text"]'));
|
|
12423
11209
|
}
|
|
12424
11210
|
function findFooterItemGroup(item) {
|
|
12425
11211
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -12440,9 +11226,8 @@ function isInferredFooterGroup(el) {
|
|
|
12440
11226
|
const footer = el.closest("footer");
|
|
12441
11227
|
if (!footer || el === footer) return false;
|
|
12442
11228
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
12443
|
-
if (isSocialsRow(el)) return false;
|
|
12444
11229
|
const count = Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(
|
|
12445
|
-
|
|
11230
|
+
isNavigationItem
|
|
12446
11231
|
).length;
|
|
12447
11232
|
return count >= 2;
|
|
12448
11233
|
}
|
|
@@ -12486,8 +11271,7 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12486
11271
|
if (key.endsWith("-href")) applyLinkByKey2(key, text);
|
|
12487
11272
|
else {
|
|
12488
11273
|
document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
|
|
12489
|
-
|
|
12490
|
-
else el.textContent = text;
|
|
11274
|
+
el.textContent = text;
|
|
12491
11275
|
});
|
|
12492
11276
|
}
|
|
12493
11277
|
}
|
|
@@ -12549,21 +11333,6 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12549
11333
|
});
|
|
12550
11334
|
return true;
|
|
12551
11335
|
}
|
|
12552
|
-
const social = getSocialItem(selected);
|
|
12553
|
-
if (social) {
|
|
12554
|
-
const result = removeSocialItem(social, getEditContent());
|
|
12555
|
-
if (!result) return false;
|
|
12556
|
-
finishDelete({
|
|
12557
|
-
toastTitle: "Social deleted",
|
|
12558
|
-
removedKeys: result.removedKeys,
|
|
12559
|
-
previousContent: result.previousContent,
|
|
12560
|
-
orderKey: SOCIALS_ORDER_KEY,
|
|
12561
|
-
orderJson: JSON.stringify(result.order),
|
|
12562
|
-
previousOrderJson: JSON.stringify(result.previousOrder),
|
|
12563
|
-
undoDom: result.undo
|
|
12564
|
-
});
|
|
12565
|
-
return true;
|
|
12566
|
-
}
|
|
12567
11336
|
if (isFooterHrefKey(hrefKey)) {
|
|
12568
11337
|
const result = deleteFooterItem(selected);
|
|
12569
11338
|
if (!result) return false;
|
|
@@ -12583,13 +11352,13 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12583
11352
|
|
|
12584
11353
|
// src/ui/navbar-container-chrome.tsx
|
|
12585
11354
|
import { Plus as Plus3 } from "lucide-react";
|
|
12586
|
-
import { jsx as
|
|
11355
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
12587
11356
|
function NavbarContainerChrome({
|
|
12588
11357
|
rect,
|
|
12589
11358
|
onAdd
|
|
12590
11359
|
}) {
|
|
12591
11360
|
const chromeGap = 6;
|
|
12592
|
-
return /* @__PURE__ */
|
|
11361
|
+
return /* @__PURE__ */ jsx27(
|
|
12593
11362
|
"div",
|
|
12594
11363
|
{
|
|
12595
11364
|
"data-ohw-navbar-container-chrome": "",
|
|
@@ -12601,7 +11370,7 @@ function NavbarContainerChrome({
|
|
|
12601
11370
|
width: rect.width + chromeGap * 2,
|
|
12602
11371
|
height: rect.height + chromeGap * 2
|
|
12603
11372
|
},
|
|
12604
|
-
children: /* @__PURE__ */
|
|
11373
|
+
children: /* @__PURE__ */ jsx27(
|
|
12605
11374
|
"button",
|
|
12606
11375
|
{
|
|
12607
11376
|
type: "button",
|
|
@@ -12618,7 +11387,7 @@ function NavbarContainerChrome({
|
|
|
12618
11387
|
e.stopPropagation();
|
|
12619
11388
|
onAdd();
|
|
12620
11389
|
},
|
|
12621
|
-
children: /* @__PURE__ */
|
|
11390
|
+
children: /* @__PURE__ */ jsx27(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
12622
11391
|
}
|
|
12623
11392
|
)
|
|
12624
11393
|
}
|
|
@@ -12627,7 +11396,7 @@ function NavbarContainerChrome({
|
|
|
12627
11396
|
|
|
12628
11397
|
// src/ui/drop-indicator.tsx
|
|
12629
11398
|
import * as React10 from "react";
|
|
12630
|
-
import { jsx as
|
|
11399
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
12631
11400
|
var dropIndicatorVariants = cva(
|
|
12632
11401
|
"ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
|
|
12633
11402
|
{
|
|
@@ -12651,7 +11420,7 @@ var dropIndicatorVariants = cva(
|
|
|
12651
11420
|
);
|
|
12652
11421
|
var DropIndicator = React10.forwardRef(
|
|
12653
11422
|
({ className, direction, state, ...props }, ref) => {
|
|
12654
|
-
return /* @__PURE__ */
|
|
11423
|
+
return /* @__PURE__ */ jsx28(
|
|
12655
11424
|
"div",
|
|
12656
11425
|
{
|
|
12657
11426
|
ref,
|
|
@@ -12668,7 +11437,7 @@ var DropIndicator = React10.forwardRef(
|
|
|
12668
11437
|
DropIndicator.displayName = "DropIndicator";
|
|
12669
11438
|
|
|
12670
11439
|
// src/ui/badge.tsx
|
|
12671
|
-
import { jsx as
|
|
11440
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
12672
11441
|
var badgeVariants = cva(
|
|
12673
11442
|
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
12674
11443
|
{
|
|
@@ -12686,12 +11455,12 @@ var badgeVariants = cva(
|
|
|
12686
11455
|
}
|
|
12687
11456
|
);
|
|
12688
11457
|
function Badge({ className, variant, ...props }) {
|
|
12689
|
-
return /* @__PURE__ */
|
|
11458
|
+
return /* @__PURE__ */ jsx29("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
12690
11459
|
}
|
|
12691
11460
|
|
|
12692
11461
|
// src/OhhwellsBridge.tsx
|
|
12693
|
-
import { Link as
|
|
12694
|
-
import { Fragment as Fragment8, jsx as
|
|
11462
|
+
import { Link as Link2 } from "lucide-react";
|
|
11463
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
12695
11464
|
var PRIMARY3 = "#0885FE";
|
|
12696
11465
|
var IMAGE_FADE_MS = 300;
|
|
12697
11466
|
function runOpacityFade(el, onDone) {
|
|
@@ -12785,10 +11554,21 @@ function parseSchedulingInsertAfter(insertAfter) {
|
|
|
12785
11554
|
insertBefore: insertAfter.slice(idx + INSERT_BEFORE_MARKER.length)
|
|
12786
11555
|
};
|
|
12787
11556
|
}
|
|
12788
|
-
function
|
|
12789
|
-
|
|
12790
|
-
const
|
|
12791
|
-
|
|
11557
|
+
function resolveSchedulingInsert(insertAfter, explicitInsertBefore) {
|
|
11558
|
+
const parsed = parseSchedulingInsertAfter(insertAfter);
|
|
11559
|
+
const insertBefore = explicitInsertBefore ?? parsed.insertBefore;
|
|
11560
|
+
const effectiveInsertAfter = insertBefore && parsed.insertBefore === null ? `${insertAfter}${INSERT_BEFORE_MARKER}${insertBefore}` : insertAfter;
|
|
11561
|
+
return { effectiveInsertAfter, insertBefore };
|
|
11562
|
+
}
|
|
11563
|
+
function getSchedulingMountPoint(insertAfter) {
|
|
11564
|
+
const { anchor } = parseSchedulingInsertAfter(insertAfter);
|
|
11565
|
+
let anchorEl = document.querySelector(`[data-ohw-section="${anchor}"]`);
|
|
11566
|
+
if (!anchorEl && anchor === "scheduling") {
|
|
11567
|
+
const widgets = Array.from(document.querySelectorAll('[data-ohw-section^="scheduling-"]'));
|
|
11568
|
+
anchorEl = widgets.at(-1) ?? null;
|
|
11569
|
+
}
|
|
11570
|
+
if (!anchorEl) return null;
|
|
11571
|
+
return anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
|
|
12792
11572
|
}
|
|
12793
11573
|
function schedulingMountDepth(insertAfter) {
|
|
12794
11574
|
if (!insertAfter.includes(INSERT_BEFORE_MARKER)) return 0;
|
|
@@ -12805,7 +11585,8 @@ function getPageSchedulingEntries(raw) {
|
|
|
12805
11585
|
}
|
|
12806
11586
|
}
|
|
12807
11587
|
function isSchedulingWidgetMissing(entry) {
|
|
12808
|
-
|
|
11588
|
+
const { effectiveInsertAfter } = resolveSchedulingInsert(entry.insertAfter);
|
|
11589
|
+
return !document.querySelector(`[data-ohw-section="${schedulingSectionId(effectiveInsertAfter)}"]`);
|
|
12809
11590
|
}
|
|
12810
11591
|
function hasMissingSchedulingWidgets(entries) {
|
|
12811
11592
|
return entries.some(isSchedulingWidgetMissing);
|
|
@@ -12835,17 +11616,16 @@ function initSectionsFromContent(content, removeExisting = false) {
|
|
|
12835
11616
|
} catch {
|
|
12836
11617
|
}
|
|
12837
11618
|
}
|
|
12838
|
-
function mountSchedulingWidget(
|
|
12839
|
-
const
|
|
12840
|
-
const sectionId = schedulingSectionId(
|
|
11619
|
+
function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId, explicitInsertBefore) {
|
|
11620
|
+
const { effectiveInsertAfter, insertBefore } = resolveSchedulingInsert(insertAfter, explicitInsertBefore);
|
|
11621
|
+
const sectionId = schedulingSectionId(effectiveInsertAfter);
|
|
12841
11622
|
if (document.querySelector(`[data-ohw-section="${sectionId}"]`)) return false;
|
|
12842
|
-
const
|
|
12843
|
-
if (!
|
|
12844
|
-
const mountPoint = anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
|
|
11623
|
+
const mountPoint = getSchedulingMountPoint(effectiveInsertAfter);
|
|
11624
|
+
if (!mountPoint) return false;
|
|
12845
11625
|
const container = document.createElement("div");
|
|
12846
11626
|
container.dataset.ohwSectionContainer = "scheduling";
|
|
12847
|
-
if (
|
|
12848
|
-
const beforeAnchor = document.querySelector(`[data-ohw-section="${
|
|
11627
|
+
if (insertBefore) {
|
|
11628
|
+
const beforeAnchor = document.querySelector(`[data-ohw-section="${insertBefore}"]`);
|
|
12849
11629
|
const beforePoint = beforeAnchor?.closest('[data-ohw-section-container="scheduling"]') ?? beforeAnchor;
|
|
12850
11630
|
if (!beforePoint) return false;
|
|
12851
11631
|
beforePoint.insertAdjacentElement("beforebegin", container);
|
|
@@ -12856,25 +11636,19 @@ function mountSchedulingWidget(anchorId, notifyOnConnect = false, scheduleId, be
|
|
|
12856
11636
|
}
|
|
12857
11637
|
tail.insertAdjacentElement("afterend", container);
|
|
12858
11638
|
}
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
});
|
|
12873
|
-
} catch (err) {
|
|
12874
|
-
console.error("[ow:scheduling] render threw", err);
|
|
12875
|
-
container.remove();
|
|
12876
|
-
return false;
|
|
12877
|
-
}
|
|
11639
|
+
const root = createRoot2(container);
|
|
11640
|
+
flushSync2(() => {
|
|
11641
|
+
root.render(
|
|
11642
|
+
/* @__PURE__ */ jsx30(
|
|
11643
|
+
SchedulingWidget,
|
|
11644
|
+
{
|
|
11645
|
+
notifyOnConnect,
|
|
11646
|
+
initialScheduleId: scheduleId,
|
|
11647
|
+
insertAfter: effectiveInsertAfter
|
|
11648
|
+
}
|
|
11649
|
+
)
|
|
11650
|
+
);
|
|
11651
|
+
});
|
|
12878
11652
|
const tracker = getSectionsTracker();
|
|
12879
11653
|
let sections = [];
|
|
12880
11654
|
try {
|
|
@@ -12882,12 +11656,10 @@ function mountSchedulingWidget(anchorId, notifyOnConnect = false, scheduleId, be
|
|
|
12882
11656
|
} catch {
|
|
12883
11657
|
}
|
|
12884
11658
|
const inEditor = typeof window !== "undefined" && window.self !== window.top;
|
|
12885
|
-
if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter ===
|
|
11659
|
+
if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter === effectiveInsertAfter)) {
|
|
12886
11660
|
sections.push({
|
|
12887
11661
|
type: "scheduling",
|
|
12888
|
-
insertAfter:
|
|
12889
|
-
anchorId,
|
|
12890
|
-
beforeId: beforeId ?? null,
|
|
11662
|
+
insertAfter: effectiveInsertAfter,
|
|
12891
11663
|
pagePath: window.location.pathname,
|
|
12892
11664
|
...scheduleId ? { scheduleId } : {}
|
|
12893
11665
|
});
|
|
@@ -12901,8 +11673,7 @@ function mountSchedulingEntries(entries, notifyOnConnect = false) {
|
|
|
12901
11673
|
for (let i = pending.length - 1; i >= 0; i--) {
|
|
12902
11674
|
const entry = pending[i];
|
|
12903
11675
|
const shouldNotify = typeof notifyOnConnect === "function" ? notifyOnConnect(entry) : notifyOnConnect;
|
|
12904
|
-
|
|
12905
|
-
if (mountSchedulingWidget(anchorId, shouldNotify, entry.scheduleId ?? null, beforeId, entry.insertAfter)) {
|
|
11676
|
+
if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId)) {
|
|
12906
11677
|
pending.splice(i, 1);
|
|
12907
11678
|
}
|
|
12908
11679
|
}
|
|
@@ -12916,17 +11687,6 @@ function applyLinkHref(el, val) {
|
|
|
12916
11687
|
const anchor = el instanceof HTMLAnchorElement ? el : el.querySelector("a");
|
|
12917
11688
|
if (anchor) anchor.setAttribute("href", val);
|
|
12918
11689
|
}
|
|
12919
|
-
function currentIconRef(el) {
|
|
12920
|
-
const uploaded = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
12921
|
-
if (uploaded?.getAttribute("src")) {
|
|
12922
|
-
return uploaded.getAttribute("src") ?? "";
|
|
12923
|
-
}
|
|
12924
|
-
const svg = el instanceof SVGElement ? el : el.querySelector("svg");
|
|
12925
|
-
const named = Array.from(svg?.classList ?? []).find(
|
|
12926
|
-
(c) => c.startsWith("lucide-") && c !== "lucide-icon"
|
|
12927
|
-
);
|
|
12928
|
-
return named ? `lucide:${named.slice("lucide-".length)}` : "";
|
|
12929
|
-
}
|
|
12930
11690
|
function getEditMeasureEl(editable) {
|
|
12931
11691
|
return editable.closest("[data-ohw-href-key]") ?? editable;
|
|
12932
11692
|
}
|
|
@@ -12971,11 +11731,8 @@ function isMediaEditable(el) {
|
|
|
12971
11731
|
const t = el.dataset.ohwEditable;
|
|
12972
11732
|
return t === "image" || t === "bg-image" || t === "video";
|
|
12973
11733
|
}
|
|
12974
|
-
function isIconEditable(el) {
|
|
12975
|
-
return el.dataset.ohwEditable === "icon";
|
|
12976
|
-
}
|
|
12977
11734
|
var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [data-ohw-editable="video"]';
|
|
12978
|
-
var NON_MEDIA_SELECTOR = '[data-ohw-editable]:not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"])
|
|
11735
|
+
var NON_MEDIA_SELECTOR = '[data-ohw-editable]:not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"])';
|
|
12979
11736
|
function getVideoEl2(el) {
|
|
12980
11737
|
return el instanceof HTMLVideoElement ? el : el.querySelector("video");
|
|
12981
11738
|
}
|
|
@@ -13046,13 +11803,6 @@ function isInsideLinkEditor(target) {
|
|
|
13046
11803
|
target.closest("[data-ohw-link-popover-root]") || target.closest("[data-ohw-link-modal-root]") || target.closest("[data-ohw-link-page-dropdown]") || target.closest("[data-ohw-section-picker]") || target.closest("[data-ohw-navbar-container-chrome]") || target.closest("[data-ohw-navbar-add-button]") || target.closest("[data-ohw-footer-container-chrome]") || target.closest("[data-ohw-footer-add-button]") || target.closest("[data-ohw-more-menu]") || target.closest('[data-slot="dropdown-menu-content"]') || target.closest('[data-slot="popover-content"]') || target.closest('[data-slot="dialog-content"]') || target.closest('[data-slot="dialog-overlay"]')
|
|
13047
11804
|
);
|
|
13048
11805
|
}
|
|
13049
|
-
function isInsideFloatingPanel(target) {
|
|
13050
|
-
return Boolean(target.closest("[data-ohw-floating-panel]"));
|
|
13051
|
-
}
|
|
13052
|
-
function isPointOverFloatingPanel(clientX, clientY) {
|
|
13053
|
-
const el = document.elementFromPoint(clientX, clientY);
|
|
13054
|
-
return Boolean(el instanceof Element && el.closest("[data-ohw-floating-panel]"));
|
|
13055
|
-
}
|
|
13056
11806
|
function getHrefKeyFromElement(el) {
|
|
13057
11807
|
if (!el) return null;
|
|
13058
11808
|
const anchor = el.closest("[data-ohw-href-key]");
|
|
@@ -13100,29 +11850,13 @@ function isNavItemPointerTarget(el) {
|
|
|
13100
11850
|
function getNavigationItemAnchor(el) {
|
|
13101
11851
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
13102
11852
|
if (!anchor) return null;
|
|
13103
|
-
if (!anchor.querySelector('[data-ohw-editable="text"]')
|
|
11853
|
+
if (!anchor.querySelector('[data-ohw-editable="text"]')) return null;
|
|
13104
11854
|
if (!isNavItemPointerTarget(anchor)) return null;
|
|
13105
11855
|
return anchor;
|
|
13106
11856
|
}
|
|
13107
11857
|
function isNavigationItem2(el) {
|
|
13108
11858
|
return getNavigationItemAnchor(el) !== null;
|
|
13109
11859
|
}
|
|
13110
|
-
function requestSocialDialog(anchor, post, content) {
|
|
13111
|
-
const item = getSocialItem(anchor);
|
|
13112
|
-
if (!item) return false;
|
|
13113
|
-
const iconKey = item.querySelector('[data-ohw-editable="icon"]')?.dataset.ohwKey ?? "";
|
|
13114
|
-
post({
|
|
13115
|
-
type: "ow:social-pick",
|
|
13116
|
-
hrefKey: item.getAttribute("data-ohw-href-key") ?? "",
|
|
13117
|
-
iconKey,
|
|
13118
|
-
url: getLinkHref4(item),
|
|
13119
|
-
iconStyle: detectIconStyle(item),
|
|
13120
|
-
// What was chosen last time. Guessing from the address instead reads as "Website" for anything
|
|
13121
|
-
// unrecognised, and for an item with no address at all — so a deliberate choice looked lost.
|
|
13122
|
-
platformId: content[socialPlatformKey(iconKey)] ?? ""
|
|
13123
|
-
});
|
|
13124
|
-
return true;
|
|
13125
|
-
}
|
|
13126
11860
|
function listNavigationItems() {
|
|
13127
11861
|
return Array.from(
|
|
13128
11862
|
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
@@ -13157,7 +11891,7 @@ function getNavigationRoot(el) {
|
|
|
13157
11891
|
return el.closest("nav, footer, aside");
|
|
13158
11892
|
}
|
|
13159
11893
|
function countFooterNavItems(el) {
|
|
13160
|
-
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(
|
|
11894
|
+
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem2).length;
|
|
13161
11895
|
}
|
|
13162
11896
|
function findFooterItemGroup2(item) {
|
|
13163
11897
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -13178,11 +11912,10 @@ function isInferredFooterGroup2(el) {
|
|
|
13178
11912
|
const footer = el.closest("footer");
|
|
13179
11913
|
if (!footer || el === footer) return false;
|
|
13180
11914
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
13181
|
-
if (isSocialsRow(el)) return false;
|
|
13182
11915
|
return countFooterNavItems(el) >= 2;
|
|
13183
11916
|
}
|
|
13184
11917
|
function isNavigationContainer(el) {
|
|
13185
|
-
return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el) || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isNavigationRoot(el) ||
|
|
11918
|
+
return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el) || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isNavigationRoot(el) || isInferredFooterGroup2(el);
|
|
13186
11919
|
}
|
|
13187
11920
|
function isNavbarLinksContainer2(el) {
|
|
13188
11921
|
return el.hasAttribute("data-ohw-nav-container");
|
|
@@ -13265,8 +11998,6 @@ function resolveNavContainerSelectionTarget(target, clientX, clientY) {
|
|
|
13265
11998
|
return null;
|
|
13266
11999
|
}
|
|
13267
12000
|
function getNavigationSelectionParent(el) {
|
|
13268
|
-
const socialsRow = findSocialsRow(el);
|
|
13269
|
-
if (socialsRow) return socialsRow;
|
|
13270
12001
|
if (isNavigationItem2(el)) {
|
|
13271
12002
|
const childrenRoot = el.closest("[data-ohw-nav-children]");
|
|
13272
12003
|
if (childrenRoot) {
|
|
@@ -13285,17 +12016,13 @@ function getNavigationSelectionParent(el) {
|
|
|
13285
12016
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
13286
12017
|
return getFooterLinksContainer();
|
|
13287
12018
|
}
|
|
13288
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") ||
|
|
12019
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
13289
12020
|
return getNavigationRoot(el);
|
|
13290
12021
|
}
|
|
13291
12022
|
return null;
|
|
13292
12023
|
}
|
|
13293
12024
|
function collectNavigationItemSiblingHintRects(selected) {
|
|
13294
12025
|
if (!isNavigationItem2(selected)) return [];
|
|
13295
|
-
const socialsRow = findSocialsRow(selected);
|
|
13296
|
-
if (socialsRow) {
|
|
13297
|
-
return listSocialItems(socialsRow).filter((item) => item !== selected).map((item) => item.getBoundingClientRect());
|
|
13298
|
-
}
|
|
13299
12026
|
const footerColumn = getFooterColumn(selected);
|
|
13300
12027
|
if (footerColumn) {
|
|
13301
12028
|
return listFooterLinksInColumn(footerColumn).filter((link) => link !== selected).map((link) => link.getBoundingClientRect());
|
|
@@ -13528,7 +12255,7 @@ function EditGlowChrome({
|
|
|
13528
12255
|
hideHandle = false
|
|
13529
12256
|
}) {
|
|
13530
12257
|
const GAP = SELECTION_CHROME_GAP2;
|
|
13531
|
-
return /* @__PURE__ */
|
|
12258
|
+
return /* @__PURE__ */ jsxs17(
|
|
13532
12259
|
"div",
|
|
13533
12260
|
{
|
|
13534
12261
|
ref: elRef,
|
|
@@ -13543,7 +12270,7 @@ function EditGlowChrome({
|
|
|
13543
12270
|
zIndex: 2147483646
|
|
13544
12271
|
},
|
|
13545
12272
|
children: [
|
|
13546
|
-
/* @__PURE__ */
|
|
12273
|
+
/* @__PURE__ */ jsx30(
|
|
13547
12274
|
"div",
|
|
13548
12275
|
{
|
|
13549
12276
|
style: {
|
|
@@ -13556,7 +12283,7 @@ function EditGlowChrome({
|
|
|
13556
12283
|
}
|
|
13557
12284
|
}
|
|
13558
12285
|
),
|
|
13559
|
-
reorderHrefKey && !hideHandle && /* @__PURE__ */
|
|
12286
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ jsx30(
|
|
13560
12287
|
"div",
|
|
13561
12288
|
{
|
|
13562
12289
|
"data-ohw-drag-handle-container": "",
|
|
@@ -13568,7 +12295,7 @@ function EditGlowChrome({
|
|
|
13568
12295
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
13569
12296
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
13570
12297
|
},
|
|
13571
|
-
children: /* @__PURE__ */
|
|
12298
|
+
children: /* @__PURE__ */ jsx30(
|
|
13572
12299
|
DragHandle,
|
|
13573
12300
|
{
|
|
13574
12301
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -13778,7 +12505,7 @@ function FloatingToolbar({
|
|
|
13778
12505
|
return () => ro.disconnect();
|
|
13779
12506
|
}, [showEditLink, activeCommands]);
|
|
13780
12507
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
13781
|
-
return /* @__PURE__ */
|
|
12508
|
+
return /* @__PURE__ */ jsx30(
|
|
13782
12509
|
"div",
|
|
13783
12510
|
{
|
|
13784
12511
|
ref: setRefs,
|
|
@@ -13790,12 +12517,12 @@ function FloatingToolbar({
|
|
|
13790
12517
|
zIndex: 2147483647,
|
|
13791
12518
|
pointerEvents: "auto"
|
|
13792
12519
|
},
|
|
13793
|
-
children: /* @__PURE__ */
|
|
13794
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */
|
|
13795
|
-
gi > 0 && /* @__PURE__ */
|
|
12520
|
+
children: /* @__PURE__ */ jsxs17(CustomToolbar, { children: [
|
|
12521
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ jsxs17(React11.Fragment, { children: [
|
|
12522
|
+
gi > 0 && /* @__PURE__ */ jsx30(CustomToolbarDivider, {}),
|
|
13796
12523
|
btns.map((btn) => {
|
|
13797
12524
|
const isActive = activeCommands.has(btn.cmd);
|
|
13798
|
-
return /* @__PURE__ */
|
|
12525
|
+
return /* @__PURE__ */ jsx30(
|
|
13799
12526
|
CustomToolbarButton,
|
|
13800
12527
|
{
|
|
13801
12528
|
title: btn.title,
|
|
@@ -13804,7 +12531,7 @@ function FloatingToolbar({
|
|
|
13804
12531
|
e.preventDefault();
|
|
13805
12532
|
onCommand(btn.cmd);
|
|
13806
12533
|
},
|
|
13807
|
-
children: /* @__PURE__ */
|
|
12534
|
+
children: /* @__PURE__ */ jsx30(
|
|
13808
12535
|
"svg",
|
|
13809
12536
|
{
|
|
13810
12537
|
width: "16",
|
|
@@ -13825,7 +12552,7 @@ function FloatingToolbar({
|
|
|
13825
12552
|
);
|
|
13826
12553
|
})
|
|
13827
12554
|
] }, gi)),
|
|
13828
|
-
showEditLink ? /* @__PURE__ */
|
|
12555
|
+
showEditLink ? /* @__PURE__ */ jsx30(
|
|
13829
12556
|
CustomToolbarButton,
|
|
13830
12557
|
{
|
|
13831
12558
|
type: "button",
|
|
@@ -13839,7 +12566,7 @@ function FloatingToolbar({
|
|
|
13839
12566
|
e.preventDefault();
|
|
13840
12567
|
e.stopPropagation();
|
|
13841
12568
|
},
|
|
13842
|
-
children: /* @__PURE__ */
|
|
12569
|
+
children: /* @__PURE__ */ jsx30(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
13843
12570
|
}
|
|
13844
12571
|
) : null
|
|
13845
12572
|
] })
|
|
@@ -13856,7 +12583,7 @@ function StateToggle({
|
|
|
13856
12583
|
states,
|
|
13857
12584
|
onStateChange
|
|
13858
12585
|
}) {
|
|
13859
|
-
return /* @__PURE__ */
|
|
12586
|
+
return /* @__PURE__ */ jsx30(
|
|
13860
12587
|
ToggleGroup,
|
|
13861
12588
|
{
|
|
13862
12589
|
"data-ohw-state-toggle": "",
|
|
@@ -13870,12 +12597,11 @@ function StateToggle({
|
|
|
13870
12597
|
left: rect.right - 8,
|
|
13871
12598
|
transform: "translateX(-100%)"
|
|
13872
12599
|
},
|
|
13873
|
-
children: states.map((state) => /* @__PURE__ */
|
|
12600
|
+
children: states.map((state) => /* @__PURE__ */ jsx30(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
13874
12601
|
}
|
|
13875
12602
|
);
|
|
13876
12603
|
}
|
|
13877
12604
|
var contentCache = /* @__PURE__ */ new Map();
|
|
13878
|
-
var fetchedContentPaths = /* @__PURE__ */ new Set();
|
|
13879
12605
|
function resolveSubdomain(subdomainFromQuery) {
|
|
13880
12606
|
if (subdomainFromQuery) return subdomainFromQuery;
|
|
13881
12607
|
if (typeof window !== "undefined") {
|
|
@@ -13898,8 +12624,8 @@ function OhhwellsBridge() {
|
|
|
13898
12624
|
const router = useRouter3();
|
|
13899
12625
|
const searchParams = useSearchParams();
|
|
13900
12626
|
const isEditMode = isEditSessionActive();
|
|
13901
|
-
const [bridgeRoot, setBridgeRoot] =
|
|
13902
|
-
|
|
12627
|
+
const [bridgeRoot, setBridgeRoot] = useState10(null);
|
|
12628
|
+
useEffect11(() => {
|
|
13903
12629
|
const figtreeFontId = "ohw-figtree-font";
|
|
13904
12630
|
if (!document.getElementById(figtreeFontId)) {
|
|
13905
12631
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -13928,136 +12654,110 @@ function OhhwellsBridge() {
|
|
|
13928
12654
|
const subdomain = resolveSubdomain(subdomainFromQuery);
|
|
13929
12655
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
13930
12656
|
useSavedLinkNavigation(isEditMode);
|
|
13931
|
-
const postToParent2 =
|
|
12657
|
+
const postToParent2 = useCallback6((data) => {
|
|
13932
12658
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
13933
12659
|
window.parent.postMessage(data, "*");
|
|
13934
12660
|
}
|
|
13935
12661
|
}, []);
|
|
13936
|
-
const [fetchState, setFetchState] =
|
|
13937
|
-
const autoSaveTimers =
|
|
13938
|
-
const activeElRef =
|
|
13939
|
-
const pointerHeldRef =
|
|
13940
|
-
const selectedElRef =
|
|
13941
|
-
const selectedHrefKeyRef =
|
|
13942
|
-
const selectedFooterColAttrRef =
|
|
13943
|
-
const originalContentRef =
|
|
13944
|
-
const activeStateElRef =
|
|
13945
|
-
const parentScrollRef =
|
|
13946
|
-
const visibleViewportRef =
|
|
13947
|
-
const [dialogPortalContainer, setDialogPortalContainer] =
|
|
13948
|
-
const attachVisibleViewport =
|
|
12662
|
+
const [fetchState, setFetchState] = useState10("idle");
|
|
12663
|
+
const autoSaveTimers = useRef8(/* @__PURE__ */ new Map());
|
|
12664
|
+
const activeElRef = useRef8(null);
|
|
12665
|
+
const pointerHeldRef = useRef8(false);
|
|
12666
|
+
const selectedElRef = useRef8(null);
|
|
12667
|
+
const selectedHrefKeyRef = useRef8(null);
|
|
12668
|
+
const selectedFooterColAttrRef = useRef8(null);
|
|
12669
|
+
const originalContentRef = useRef8(null);
|
|
12670
|
+
const activeStateElRef = useRef8(null);
|
|
12671
|
+
const parentScrollRef = useRef8(null);
|
|
12672
|
+
const visibleViewportRef = useRef8(null);
|
|
12673
|
+
const [dialogPortalContainer, setDialogPortalContainer] = useState10(null);
|
|
12674
|
+
const attachVisibleViewport = useCallback6((node) => {
|
|
13949
12675
|
visibleViewportRef.current = node;
|
|
13950
12676
|
setDialogPortalContainer(node);
|
|
13951
12677
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
13952
12678
|
}, []);
|
|
13953
|
-
const toolbarElRef =
|
|
13954
|
-
const glowElRef =
|
|
13955
|
-
const hoveredImageRef =
|
|
13956
|
-
const hoveredImageHasTextOverlapRef =
|
|
13957
|
-
const dragOverElRef =
|
|
13958
|
-
const [mediaHover, setMediaHover] =
|
|
13959
|
-
const [carouselHover, setCarouselHover] =
|
|
13960
|
-
const [uploadingRects, setUploadingRects] =
|
|
13961
|
-
const hoveredGapRef =
|
|
13962
|
-
const imageUnhoverTimerRef =
|
|
13963
|
-
const imageShowTimerRef =
|
|
13964
|
-
const editStylesRef =
|
|
13965
|
-
const activateRef =
|
|
12679
|
+
const toolbarElRef = useRef8(null);
|
|
12680
|
+
const glowElRef = useRef8(null);
|
|
12681
|
+
const hoveredImageRef = useRef8(null);
|
|
12682
|
+
const hoveredImageHasTextOverlapRef = useRef8(false);
|
|
12683
|
+
const dragOverElRef = useRef8(null);
|
|
12684
|
+
const [mediaHover, setMediaHover] = useState10(null);
|
|
12685
|
+
const [carouselHover, setCarouselHover] = useState10(null);
|
|
12686
|
+
const [uploadingRects, setUploadingRects] = useState10({});
|
|
12687
|
+
const hoveredGapRef = useRef8(null);
|
|
12688
|
+
const imageUnhoverTimerRef = useRef8(null);
|
|
12689
|
+
const imageShowTimerRef = useRef8(null);
|
|
12690
|
+
const editStylesRef = useRef8(null);
|
|
12691
|
+
const activateRef = useRef8(() => {
|
|
13966
12692
|
});
|
|
13967
|
-
const deactivateRef =
|
|
12693
|
+
const deactivateRef = useRef8(() => {
|
|
13968
12694
|
});
|
|
13969
|
-
const selectRef =
|
|
12695
|
+
const selectRef = useRef8(() => {
|
|
13970
12696
|
});
|
|
13971
|
-
const selectFrameRef =
|
|
12697
|
+
const selectFrameRef = useRef8(() => {
|
|
13972
12698
|
});
|
|
13973
|
-
const
|
|
12699
|
+
const deselectRef = useRef8(() => {
|
|
13974
12700
|
});
|
|
13975
|
-
const
|
|
12701
|
+
const reselectNavigationItemRef = useRef8(() => {
|
|
13976
12702
|
});
|
|
13977
|
-
const
|
|
12703
|
+
const commitNavigationTextEditRef = useRef8(() => {
|
|
13978
12704
|
});
|
|
13979
|
-
const
|
|
12705
|
+
const handleDeleteSelectedRef = useRef8(() => false);
|
|
12706
|
+
const runPendingDeleteUndoRef = useRef8(() => false);
|
|
12707
|
+
const isFooterFrameSelectionRef = useRef8(false);
|
|
12708
|
+
const refreshActiveCommandsRef = useRef8(() => {
|
|
13980
12709
|
});
|
|
13981
|
-
const
|
|
13982
|
-
});
|
|
13983
|
-
const commitNavigationTextEditRef = useRef9(() => {
|
|
13984
|
-
});
|
|
13985
|
-
const handleDeleteSelectedRef = useRef9(() => false);
|
|
13986
|
-
const runPendingDeleteUndoRef = useRef9(() => false);
|
|
13987
|
-
const isFooterFrameSelectionRef = useRef9(false);
|
|
13988
|
-
const refreshActiveCommandsRef = useRef9(() => {
|
|
13989
|
-
});
|
|
13990
|
-
const postToParentRef = useRef9(postToParent2);
|
|
12710
|
+
const postToParentRef = useRef8(postToParent2);
|
|
13991
12711
|
postToParentRef.current = postToParent2;
|
|
13992
|
-
const aiSectionApiRef =
|
|
13993
|
-
const sectionsLoadedRef =
|
|
13994
|
-
const pendingScheduleConfigRequests =
|
|
13995
|
-
const [toolbarRect, setToolbarRect] =
|
|
13996
|
-
const [toolbarVariant, setToolbarVariant] =
|
|
13997
|
-
const toolbarVariantRef =
|
|
12712
|
+
const aiSectionApiRef = useRef8(null);
|
|
12713
|
+
const sectionsLoadedRef = useRef8(false);
|
|
12714
|
+
const pendingScheduleConfigRequests = useRef8([]);
|
|
12715
|
+
const [toolbarRect, setToolbarRect] = useState10(null);
|
|
12716
|
+
const [toolbarVariant, setToolbarVariant] = useState10("none");
|
|
12717
|
+
const toolbarVariantRef = useRef8("none");
|
|
13998
12718
|
toolbarVariantRef.current = toolbarVariant;
|
|
13999
|
-
const [selectedIsCta, setSelectedIsCta] =
|
|
14000
|
-
const [
|
|
14001
|
-
const [
|
|
14002
|
-
const [
|
|
14003
|
-
const [
|
|
14004
|
-
const [
|
|
14005
|
-
const [
|
|
14006
|
-
const [
|
|
14007
|
-
const
|
|
14008
|
-
const [
|
|
14009
|
-
const
|
|
14010
|
-
const [
|
|
14011
|
-
const
|
|
14012
|
-
const [
|
|
14013
|
-
const
|
|
14014
|
-
const [
|
|
14015
|
-
const [
|
|
14016
|
-
const [isItemDragging, setIsItemDragging] = useState11(false);
|
|
14017
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState11(false);
|
|
12719
|
+
const [selectedIsCta, setSelectedIsCta] = useState10(false);
|
|
12720
|
+
const [reorderHrefKey, setReorderHrefKey] = useState10(null);
|
|
12721
|
+
const [reorderDragDisabled, setReorderDragDisabled] = useState10(false);
|
|
12722
|
+
const [toggleState, setToggleState] = useState10(null);
|
|
12723
|
+
const [maxBadge, setMaxBadge] = useState10(null);
|
|
12724
|
+
const [activeCommands, setActiveCommands] = useState10(/* @__PURE__ */ new Set());
|
|
12725
|
+
const [sectionGap, setSectionGap] = useState10(null);
|
|
12726
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = useState10(false);
|
|
12727
|
+
const hoveredNavContainerRef = useRef8(null);
|
|
12728
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = useState10(null);
|
|
12729
|
+
const hoveredItemElRef = useRef8(null);
|
|
12730
|
+
const [hoveredItemRect, setHoveredItemRect] = useState10(null);
|
|
12731
|
+
const siblingHintElRef = useRef8(null);
|
|
12732
|
+
const [siblingHintRect, setSiblingHintRect] = useState10(null);
|
|
12733
|
+
const [siblingHintRects, setSiblingHintRects] = useState10([]);
|
|
12734
|
+
const [isItemDragging, setIsItemDragging] = useState10(false);
|
|
12735
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState10(false);
|
|
14018
12736
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
14019
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] =
|
|
14020
|
-
const [footerHeadingVisible, setFooterHeadingVisible] =
|
|
14021
|
-
const footerDragRef =
|
|
14022
|
-
const [footerDropSlots, setFooterDropSlots] =
|
|
14023
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] =
|
|
14024
|
-
const [draggedItemRect, setDraggedItemRect] =
|
|
14025
|
-
const footerPointerDragRef =
|
|
14026
|
-
const suppressNextClickRef =
|
|
14027
|
-
const suppressClickUntilRef =
|
|
14028
|
-
const [linkPopover, setLinkPopover] =
|
|
14029
|
-
const linkPopoverSessionRef =
|
|
14030
|
-
const addNavAfterAnchorRef =
|
|
14031
|
-
const editContentRef =
|
|
14032
|
-
const aiSectionsRef =
|
|
14033
|
-
const pendingDeleteUndoRef =
|
|
14034
|
-
const [
|
|
14035
|
-
const
|
|
14036
|
-
const
|
|
14037
|
-
const
|
|
14038
|
-
const
|
|
14039
|
-
const
|
|
14040
|
-
const
|
|
14041
|
-
const [sitePages, setSitePages] = useState11([]);
|
|
14042
|
-
const [sectionsByPath, setSectionsByPath] = useState11({});
|
|
14043
|
-
const sectionsPrefetchGenRef = useRef9(0);
|
|
14044
|
-
const setLinkPopoverRef = useRef9(setLinkPopover);
|
|
14045
|
-
const linkPopoverPanelRef = useRef9(null);
|
|
14046
|
-
const linkPopoverOpenRef = useRef9(false);
|
|
14047
|
-
const linkPopoverGraceUntilRef = useRef9(0);
|
|
12737
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState10(null);
|
|
12738
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = useState10(null);
|
|
12739
|
+
const footerDragRef = useRef8(null);
|
|
12740
|
+
const [footerDropSlots, setFooterDropSlots] = useState10([]);
|
|
12741
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = useState10(null);
|
|
12742
|
+
const [draggedItemRect, setDraggedItemRect] = useState10(null);
|
|
12743
|
+
const footerPointerDragRef = useRef8(null);
|
|
12744
|
+
const suppressNextClickRef = useRef8(false);
|
|
12745
|
+
const suppressClickUntilRef = useRef8(0);
|
|
12746
|
+
const [linkPopover, setLinkPopover] = useState10(null);
|
|
12747
|
+
const linkPopoverSessionRef = useRef8(null);
|
|
12748
|
+
const addNavAfterAnchorRef = useRef8(null);
|
|
12749
|
+
const editContentRef = useRef8({});
|
|
12750
|
+
const aiSectionsRef = useRef8("");
|
|
12751
|
+
const pendingDeleteUndoRef = useRef8(null);
|
|
12752
|
+
const [sitePages, setSitePages] = useState10([]);
|
|
12753
|
+
const [sectionsByPath, setSectionsByPath] = useState10({});
|
|
12754
|
+
const sectionsPrefetchGenRef = useRef8(0);
|
|
12755
|
+
const setLinkPopoverRef = useRef8(setLinkPopover);
|
|
12756
|
+
const linkPopoverPanelRef = useRef8(null);
|
|
12757
|
+
const linkPopoverOpenRef = useRef8(false);
|
|
12758
|
+
const linkPopoverGraceUntilRef = useRef8(0);
|
|
14048
12759
|
setLinkPopoverRef.current = setLinkPopover;
|
|
14049
|
-
setFloatingPanelRef.current = setFloatingPanel;
|
|
14050
12760
|
linkPopoverSessionRef.current = linkPopover;
|
|
14051
|
-
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
14052
|
-
useEffect12(() => {
|
|
14053
|
-
const syncViewport = () => {
|
|
14054
|
-
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
14055
|
-
setEditorViewport((prev) => prev === next ? prev : next);
|
|
14056
|
-
};
|
|
14057
|
-
syncViewport();
|
|
14058
|
-
window.addEventListener("resize", syncViewport);
|
|
14059
|
-
return () => window.removeEventListener("resize", syncViewport);
|
|
14060
|
-
}, []);
|
|
14061
12761
|
const {
|
|
14062
12762
|
navDragRef,
|
|
14063
12763
|
navDropSlots,
|
|
@@ -14093,7 +12793,7 @@ function OhhwellsBridge() {
|
|
|
14093
12793
|
const bumpLinkPopoverGrace = () => {
|
|
14094
12794
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
14095
12795
|
};
|
|
14096
|
-
const runSectionsPrefetch =
|
|
12796
|
+
const runSectionsPrefetch = useCallback6((pages) => {
|
|
14097
12797
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
14098
12798
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
14099
12799
|
const paths = pages.map((p) => p.path);
|
|
@@ -14112,9 +12812,9 @@ function OhhwellsBridge() {
|
|
|
14112
12812
|
);
|
|
14113
12813
|
});
|
|
14114
12814
|
}, [isEditMode, pathname]);
|
|
14115
|
-
const runSectionsPrefetchRef =
|
|
12815
|
+
const runSectionsPrefetchRef = useRef8(runSectionsPrefetch);
|
|
14116
12816
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
14117
|
-
|
|
12817
|
+
useEffect11(() => {
|
|
14118
12818
|
if (!linkPopover) {
|
|
14119
12819
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
14120
12820
|
return;
|
|
@@ -14142,7 +12842,7 @@ function OhhwellsBridge() {
|
|
|
14142
12842
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
14143
12843
|
};
|
|
14144
12844
|
}, [linkPopover, postToParent2]);
|
|
14145
|
-
|
|
12845
|
+
useEffect11(() => {
|
|
14146
12846
|
if (!isEditMode) return;
|
|
14147
12847
|
const useFixtures = shouldUseDevFixtures();
|
|
14148
12848
|
if (useFixtures) {
|
|
@@ -14166,14 +12866,14 @@ function OhhwellsBridge() {
|
|
|
14166
12866
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
14167
12867
|
return () => window.removeEventListener("message", onSitePages);
|
|
14168
12868
|
}, [isEditMode, postToParent2]);
|
|
14169
|
-
|
|
12869
|
+
useEffect11(() => {
|
|
14170
12870
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
14171
12871
|
void loadAllSectionsManifest().then((manifest) => {
|
|
14172
12872
|
if (Object.keys(manifest).length === 0) return;
|
|
14173
12873
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
14174
12874
|
});
|
|
14175
12875
|
}, [isEditMode]);
|
|
14176
|
-
|
|
12876
|
+
useEffect11(() => {
|
|
14177
12877
|
const update = () => {
|
|
14178
12878
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
14179
12879
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -14197,10 +12897,10 @@ function OhhwellsBridge() {
|
|
|
14197
12897
|
vvp.removeEventListener("resize", update);
|
|
14198
12898
|
};
|
|
14199
12899
|
}, []);
|
|
14200
|
-
const refreshStateRules =
|
|
12900
|
+
const refreshStateRules = useCallback6(() => {
|
|
14201
12901
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
14202
12902
|
}, []);
|
|
14203
|
-
const processConfigRequest =
|
|
12903
|
+
const processConfigRequest = useCallback6((insertAfterVal) => {
|
|
14204
12904
|
const tracker = getSectionsTracker();
|
|
14205
12905
|
let entries = [];
|
|
14206
12906
|
try {
|
|
@@ -14223,7 +12923,7 @@ function OhhwellsBridge() {
|
|
|
14223
12923
|
}
|
|
14224
12924
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
14225
12925
|
}, [isEditMode]);
|
|
14226
|
-
const deactivate =
|
|
12926
|
+
const deactivate = useCallback6(() => {
|
|
14227
12927
|
const el = activeElRef.current;
|
|
14228
12928
|
if (!el) return;
|
|
14229
12929
|
const key = el.dataset.ohwKey;
|
|
@@ -14256,19 +12956,17 @@ function OhhwellsBridge() {
|
|
|
14256
12956
|
setToolbarShowEditLink(false);
|
|
14257
12957
|
postToParent2({ type: "ow:exit-edit" });
|
|
14258
12958
|
}, [postToParent2]);
|
|
14259
|
-
const clearSelectedAttr =
|
|
12959
|
+
const clearSelectedAttr = useCallback6(() => {
|
|
14260
12960
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
14261
12961
|
el.removeAttribute("data-ohw-selected");
|
|
14262
12962
|
});
|
|
14263
12963
|
}, []);
|
|
14264
|
-
const deselect =
|
|
12964
|
+
const deselect = useCallback6(() => {
|
|
14265
12965
|
clearSelectedAttr();
|
|
14266
12966
|
selectedElRef.current = null;
|
|
14267
12967
|
selectedHrefKeyRef.current = null;
|
|
14268
12968
|
selectedFooterColAttrRef.current = null;
|
|
14269
12969
|
setSelectedIsCta(false);
|
|
14270
|
-
setSelectedIsSocial(false);
|
|
14271
|
-
setSelectedIsSocialsRow(false);
|
|
14272
12970
|
setReorderHrefKey(null);
|
|
14273
12971
|
setReorderDragDisabled(false);
|
|
14274
12972
|
setIsFooterFrameSelection(false);
|
|
@@ -14280,21 +12978,17 @@ function OhhwellsBridge() {
|
|
|
14280
12978
|
setIsItemDragging(false);
|
|
14281
12979
|
hoveredNavContainerRef.current = null;
|
|
14282
12980
|
setHoveredNavContainerRect(null);
|
|
14283
|
-
hoveredItemElRef.current = null;
|
|
14284
|
-
setHoveredItemRect(null);
|
|
14285
|
-
setFloatingPanel(null);
|
|
14286
|
-
setLogoSizeDraft(null);
|
|
14287
12981
|
if (!activeElRef.current) {
|
|
14288
12982
|
setNavGroupForceOpen(null, false);
|
|
14289
12983
|
setToolbarRect(null);
|
|
14290
12984
|
setToolbarVariant("none");
|
|
14291
12985
|
}
|
|
14292
12986
|
}, [clearSelectedAttr]);
|
|
14293
|
-
const markSelected =
|
|
12987
|
+
const markSelected = useCallback6((el) => {
|
|
14294
12988
|
clearSelectedAttr();
|
|
14295
12989
|
el.setAttribute("data-ohw-selected", "");
|
|
14296
12990
|
}, [clearSelectedAttr]);
|
|
14297
|
-
const resolveHrefKeyElement =
|
|
12991
|
+
const resolveHrefKeyElement = useCallback6((hrefKey) => {
|
|
14298
12992
|
if (isFooterHrefKey(hrefKey)) {
|
|
14299
12993
|
return document.querySelector(
|
|
14300
12994
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -14309,7 +13003,7 @@ function OhhwellsBridge() {
|
|
|
14309
13003
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
14310
13004
|
);
|
|
14311
13005
|
}, []);
|
|
14312
|
-
const resyncSelectedNavigationItem =
|
|
13006
|
+
const resyncSelectedNavigationItem = useCallback6(() => {
|
|
14313
13007
|
const hrefKey = selectedHrefKeyRef.current;
|
|
14314
13008
|
if (hrefKey) {
|
|
14315
13009
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -14347,14 +13041,12 @@ function OhhwellsBridge() {
|
|
|
14347
13041
|
);
|
|
14348
13042
|
}
|
|
14349
13043
|
}, [resolveHrefKeyElement]);
|
|
14350
|
-
const reselectNavigationItem =
|
|
13044
|
+
const reselectNavigationItem = useCallback6((navAnchor) => {
|
|
14351
13045
|
selectedElRef.current = navAnchor;
|
|
14352
13046
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
14353
13047
|
selectedFooterColAttrRef.current = null;
|
|
14354
13048
|
markSelected(navAnchor);
|
|
14355
13049
|
setSelectedIsCta(isCtaButton(navAnchor));
|
|
14356
|
-
setSelectedIsSocial(Boolean(getSocialItem(navAnchor)));
|
|
14357
|
-
setSelectedIsSocialsRow(false);
|
|
14358
13050
|
const isDropdownTrigger = !isNestedNavChild(navAnchor) && (navItemHasDropdownChildren(navAnchor) || navItemOwnsDropdownPanel(navAnchor));
|
|
14359
13051
|
if (isNestedNavChild(navAnchor)) {
|
|
14360
13052
|
setNavGroupForceOpen(navAnchor, true);
|
|
@@ -14378,7 +13070,7 @@ function OhhwellsBridge() {
|
|
|
14378
13070
|
setToolbarShowEditLink(false);
|
|
14379
13071
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
14380
13072
|
}, [markSelected]);
|
|
14381
|
-
const commitNavigationTextEdit =
|
|
13073
|
+
const commitNavigationTextEdit = useCallback6((navAnchor) => {
|
|
14382
13074
|
const el = activeElRef.current;
|
|
14383
13075
|
if (!el) return;
|
|
14384
13076
|
const key = el.dataset.ohwKey;
|
|
@@ -14405,7 +13097,7 @@ function OhhwellsBridge() {
|
|
|
14405
13097
|
postToParent2({ type: "ow:exit-edit" });
|
|
14406
13098
|
reselectNavigationItem(navAnchor);
|
|
14407
13099
|
}, [postToParent2, reselectNavigationItem]);
|
|
14408
|
-
const handleAddTopLevelNavItem =
|
|
13100
|
+
const handleAddTopLevelNavItem = useCallback6(() => {
|
|
14409
13101
|
const items = listNavbarRootItems();
|
|
14410
13102
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
14411
13103
|
deselectRef.current();
|
|
@@ -14417,7 +13109,7 @@ function OhhwellsBridge() {
|
|
|
14417
13109
|
intent: "add-nav"
|
|
14418
13110
|
});
|
|
14419
13111
|
}, []);
|
|
14420
|
-
const maybeWarnNavLinkDropdownConflict =
|
|
13112
|
+
const maybeWarnNavLinkDropdownConflict = useCallback6(
|
|
14421
13113
|
(anchor) => {
|
|
14422
13114
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
14423
13115
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -14430,7 +13122,7 @@ function OhhwellsBridge() {
|
|
|
14430
13122
|
},
|
|
14431
13123
|
[postToParent2]
|
|
14432
13124
|
);
|
|
14433
|
-
const handleNavDropdownOpenChange =
|
|
13125
|
+
const handleNavDropdownOpenChange = useCallback6((open) => {
|
|
14434
13126
|
const selected = selectedElRef.current;
|
|
14435
13127
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
14436
13128
|
setNavGroupForceOpen(selected, open);
|
|
@@ -14442,7 +13134,7 @@ function OhhwellsBridge() {
|
|
|
14442
13134
|
}
|
|
14443
13135
|
});
|
|
14444
13136
|
}, []);
|
|
14445
|
-
const handleFooterHeadingVisibleChange =
|
|
13137
|
+
const handleFooterHeadingVisibleChange = useCallback6(
|
|
14446
13138
|
(visible) => {
|
|
14447
13139
|
const selected = selectedElRef.current;
|
|
14448
13140
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -14466,7 +13158,7 @@ function OhhwellsBridge() {
|
|
|
14466
13158
|
},
|
|
14467
13159
|
[postToParent2]
|
|
14468
13160
|
);
|
|
14469
|
-
const enterEditOnNewItem =
|
|
13161
|
+
const enterEditOnNewItem = useCallback6((anchor) => {
|
|
14470
13162
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
14471
13163
|
if (!label) {
|
|
14472
13164
|
selectRef.current(anchor);
|
|
@@ -14475,31 +13167,9 @@ function OhhwellsBridge() {
|
|
|
14475
13167
|
setNavGroupForceOpen(anchor, true);
|
|
14476
13168
|
activateRef.current(label);
|
|
14477
13169
|
}, []);
|
|
14478
|
-
const handleAddChildItem =
|
|
13170
|
+
const handleAddChildItem = useCallback6(() => {
|
|
14479
13171
|
const selected = selectedElRef.current;
|
|
14480
13172
|
if (!selected) return;
|
|
14481
|
-
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
14482
|
-
if (socialsRow) {
|
|
14483
|
-
const after = getSocialItem(selected);
|
|
14484
|
-
const result2 = insertSocialItem(socialsRow, after, editContentRef.current);
|
|
14485
|
-
if (!result2) return;
|
|
14486
|
-
const orderJson = JSON.stringify(result2.order);
|
|
14487
|
-
applySocialsDisplayToRow(socialsRow, socialsDisplayFor(socialsRow, editContentRef.current));
|
|
14488
|
-
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14489
|
-
postToParent2({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
14490
|
-
postToParentRef.current({
|
|
14491
|
-
type: "ow:social-pick",
|
|
14492
|
-
hrefKey: result2.hrefKey,
|
|
14493
|
-
iconKey: result2.iconKey,
|
|
14494
|
-
url: "",
|
|
14495
|
-
iconStyle: detectIconStyle(result2.item),
|
|
14496
|
-
platformId: "",
|
|
14497
|
-
// Lets the editor undo the insert if the dialog is dismissed: an item that was never given
|
|
14498
|
-
// an address should not survive a Cancel.
|
|
14499
|
-
isNew: true
|
|
14500
|
-
});
|
|
14501
|
-
return;
|
|
14502
|
-
}
|
|
14503
13173
|
if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
|
|
14504
13174
|
if (!selected.hasAttribute("data-ohw-footer-col") && !selected.closest("[data-ohw-footer-col]")) {
|
|
14505
13175
|
}
|
|
@@ -14573,7 +13243,7 @@ function OhhwellsBridge() {
|
|
|
14573
13243
|
enterEditOnNewItem(result.anchor);
|
|
14574
13244
|
});
|
|
14575
13245
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
14576
|
-
const handleAddFooterColumn =
|
|
13246
|
+
const handleAddFooterColumn = useCallback6(() => {
|
|
14577
13247
|
if (!canAddFooterColumn()) {
|
|
14578
13248
|
postToParent2({
|
|
14579
13249
|
type: "ow:toast",
|
|
@@ -14594,7 +13264,7 @@ function OhhwellsBridge() {
|
|
|
14594
13264
|
selectRef.current(result.firstLink);
|
|
14595
13265
|
});
|
|
14596
13266
|
}, [postToParent2]);
|
|
14597
|
-
const clearFooterDragVisuals =
|
|
13267
|
+
const clearFooterDragVisuals = useCallback6(() => {
|
|
14598
13268
|
footerDragRef.current = null;
|
|
14599
13269
|
setSiblingHintRects([]);
|
|
14600
13270
|
setFooterDropSlots([]);
|
|
@@ -14603,7 +13273,7 @@ function OhhwellsBridge() {
|
|
|
14603
13273
|
setIsItemDragging(false);
|
|
14604
13274
|
unlockFooterDragInteraction();
|
|
14605
13275
|
}, []);
|
|
14606
|
-
const refreshFooterDragVisuals =
|
|
13276
|
+
const refreshFooterDragVisuals = useCallback6((session, activeSlot, clientX, clientY) => {
|
|
14607
13277
|
const dragged = session.draggedEl;
|
|
14608
13278
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
14609
13279
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -14612,13 +13282,6 @@ function OhhwellsBridge() {
|
|
|
14612
13282
|
}
|
|
14613
13283
|
session.activeSlot = activeSlot;
|
|
14614
13284
|
setSiblingHintRects([]);
|
|
14615
|
-
if (session.kind === "social") {
|
|
14616
|
-
const slots2 = session.hrefKey ? buildSocialDropSlotsForKey(session.hrefKey) : [];
|
|
14617
|
-
setFooterDropSlots(slots2);
|
|
14618
|
-
const activeIdx2 = activeSlot ? slots2.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
14619
|
-
setActiveFooterDropIndex(activeIdx2 >= 0 ? activeIdx2 : null);
|
|
14620
|
-
return;
|
|
14621
|
-
}
|
|
14622
13285
|
if (session.kind === "link") {
|
|
14623
13286
|
const columns = listFooterColumns();
|
|
14624
13287
|
const slots2 = [];
|
|
@@ -14635,13 +13298,13 @@ function OhhwellsBridge() {
|
|
|
14635
13298
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
14636
13299
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
14637
13300
|
}, []);
|
|
14638
|
-
const refreshFooterDragVisualsRef =
|
|
13301
|
+
const refreshFooterDragVisualsRef = useRef8(refreshFooterDragVisuals);
|
|
14639
13302
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
14640
|
-
const commitFooterDragRef =
|
|
13303
|
+
const commitFooterDragRef = useRef8(() => {
|
|
14641
13304
|
});
|
|
14642
|
-
const beginFooterDragRef =
|
|
13305
|
+
const beginFooterDragRef = useRef8(() => {
|
|
14643
13306
|
});
|
|
14644
|
-
const beginFooterDrag =
|
|
13307
|
+
const beginFooterDrag = useCallback6(
|
|
14645
13308
|
(session) => {
|
|
14646
13309
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
14647
13310
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -14655,13 +13318,13 @@ function OhhwellsBridge() {
|
|
|
14655
13318
|
if (session.wasSelected && selectedElRef.current === session.draggedEl) {
|
|
14656
13319
|
setToolbarRect(rect);
|
|
14657
13320
|
}
|
|
14658
|
-
const initialSlot = session.kind === "
|
|
13321
|
+
const initialSlot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
14659
13322
|
refreshFooterDragVisuals(session, initialSlot, session.lastClientX, session.lastClientY);
|
|
14660
13323
|
},
|
|
14661
13324
|
[refreshFooterDragVisuals]
|
|
14662
13325
|
);
|
|
14663
13326
|
beginFooterDragRef.current = beginFooterDrag;
|
|
14664
|
-
const commitFooterDrag =
|
|
13327
|
+
const commitFooterDrag = useCallback6(
|
|
14665
13328
|
(clientX, clientY) => {
|
|
14666
13329
|
const session = footerDragRef.current;
|
|
14667
13330
|
if (!session) {
|
|
@@ -14671,11 +13334,8 @@ function OhhwellsBridge() {
|
|
|
14671
13334
|
const x = typeof clientX === "number" && (clientX !== 0 || clientY !== 0) ? clientX : session.lastClientX;
|
|
14672
13335
|
const y = typeof clientY === "number" && (clientX !== 0 || clientY !== 0) ? clientY : session.lastClientY;
|
|
14673
13336
|
let nextOrder = null;
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
if (session.kind === "social" && session.hrefKey && slot) {
|
|
14677
|
-
nextSocialsOrder = planSocialMove(session.hrefKey, slot.insertIndex);
|
|
14678
|
-
} else if (session.kind === "link" && session.hrefKey && slot) {
|
|
13337
|
+
const slot = session.activeSlot ?? (session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(x, y, session.hrefKey) : session.kind === "column" ? hitTestColumnDropSlot(x, y) : null);
|
|
13338
|
+
if (session.kind === "link" && session.hrefKey && slot) {
|
|
14679
13339
|
nextOrder = planFooterLinkMove(session.hrefKey, slot.columnIndex, slot.insertIndex);
|
|
14680
13340
|
} else if (session.kind === "column" && slot) {
|
|
14681
13341
|
nextOrder = planFooterColumnMove(session.sourceColumnIndex, slot.insertIndex);
|
|
@@ -14733,27 +13393,6 @@ function OhhwellsBridge() {
|
|
|
14733
13393
|
}
|
|
14734
13394
|
deselectRef.current();
|
|
14735
13395
|
};
|
|
14736
|
-
if (nextSocialsOrder) {
|
|
14737
|
-
const orderJson = JSON.stringify(nextSocialsOrder);
|
|
14738
|
-
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14739
|
-
applySocialsOrder(nextSocialsOrder);
|
|
14740
|
-
postToParentRef.current({
|
|
14741
|
-
type: "ow:change",
|
|
14742
|
-
nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }]
|
|
14743
|
-
});
|
|
14744
|
-
applySelectionAfterDrop();
|
|
14745
|
-
clearFooterDragVisuals();
|
|
14746
|
-
const reapply = nextSocialsOrder;
|
|
14747
|
-
requestAnimationFrame(() => {
|
|
14748
|
-
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14749
|
-
applySelectionAfterDrop();
|
|
14750
|
-
requestAnimationFrame(() => {
|
|
14751
|
-
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14752
|
-
resyncSelectedNavigationItem();
|
|
14753
|
-
});
|
|
14754
|
-
});
|
|
14755
|
-
return;
|
|
14756
|
-
}
|
|
14757
13396
|
if (nextOrder) {
|
|
14758
13397
|
const orderJson = JSON.stringify(nextOrder);
|
|
14759
13398
|
editContentRef.current = {
|
|
@@ -14789,25 +13428,10 @@ function OhhwellsBridge() {
|
|
|
14789
13428
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
14790
13429
|
);
|
|
14791
13430
|
commitFooterDragRef.current = commitFooterDrag;
|
|
14792
|
-
const startFooterLinkDrag =
|
|
13431
|
+
const startFooterLinkDrag = useCallback6(
|
|
14793
13432
|
(anchor, clientX, clientY, wasSelected) => {
|
|
14794
13433
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
14795
|
-
if (!hrefKey) return false;
|
|
14796
|
-
if (getSocialItem(anchor)) {
|
|
14797
|
-
beginFooterDrag({
|
|
14798
|
-
kind: "social",
|
|
14799
|
-
hrefKey,
|
|
14800
|
-
columnEl: null,
|
|
14801
|
-
sourceColumnIndex: 0,
|
|
14802
|
-
wasSelected,
|
|
14803
|
-
draggedEl: anchor,
|
|
14804
|
-
lastClientX: clientX,
|
|
14805
|
-
lastClientY: clientY,
|
|
14806
|
-
activeSlot: null
|
|
14807
|
-
});
|
|
14808
|
-
return true;
|
|
14809
|
-
}
|
|
14810
|
-
if (!isFooterHrefKey(hrefKey)) return false;
|
|
13434
|
+
if (!hrefKey || !isFooterHrefKey(hrefKey)) return false;
|
|
14811
13435
|
const column = findFooterColumnForLink(anchor);
|
|
14812
13436
|
const columns = listFooterColumns();
|
|
14813
13437
|
beginFooterDrag({
|
|
@@ -14825,7 +13449,7 @@ function OhhwellsBridge() {
|
|
|
14825
13449
|
},
|
|
14826
13450
|
[beginFooterDrag]
|
|
14827
13451
|
);
|
|
14828
|
-
const startFooterColumnDrag =
|
|
13452
|
+
const startFooterColumnDrag = useCallback6(
|
|
14829
13453
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
14830
13454
|
const columns = listFooterColumns();
|
|
14831
13455
|
const idx = columns.indexOf(columnEl);
|
|
@@ -14845,7 +13469,7 @@ function OhhwellsBridge() {
|
|
|
14845
13469
|
},
|
|
14846
13470
|
[beginFooterDrag]
|
|
14847
13471
|
);
|
|
14848
|
-
const handleItemDragStart =
|
|
13472
|
+
const handleItemDragStart = useCallback6(
|
|
14849
13473
|
(e) => {
|
|
14850
13474
|
const selected = selectedElRef.current;
|
|
14851
13475
|
if (!selected) {
|
|
@@ -14865,7 +13489,7 @@ function OhhwellsBridge() {
|
|
|
14865
13489
|
},
|
|
14866
13490
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
|
|
14867
13491
|
);
|
|
14868
|
-
const handleItemDragEnd =
|
|
13492
|
+
const handleItemDragEnd = useCallback6(
|
|
14869
13493
|
(e) => {
|
|
14870
13494
|
if (footerDragRef.current) {
|
|
14871
13495
|
const x = e?.clientX;
|
|
@@ -14891,7 +13515,7 @@ function OhhwellsBridge() {
|
|
|
14891
13515
|
},
|
|
14892
13516
|
[commitFooterDrag, commitNavDrag, navDragRef]
|
|
14893
13517
|
);
|
|
14894
|
-
const handleItemChromePointerDown =
|
|
13518
|
+
const handleItemChromePointerDown = useCallback6((e) => {
|
|
14895
13519
|
if (e.button !== 0) return;
|
|
14896
13520
|
const selected = selectedElRef.current;
|
|
14897
13521
|
if (!selected) return;
|
|
@@ -14922,7 +13546,7 @@ function OhhwellsBridge() {
|
|
|
14922
13546
|
}
|
|
14923
13547
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
14924
13548
|
}, [armNavPressFromChrome]);
|
|
14925
|
-
const handleItemChromeClick =
|
|
13549
|
+
const handleItemChromeClick = useCallback6((clientX, clientY) => {
|
|
14926
13550
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
14927
13551
|
suppressNextClickRef.current = false;
|
|
14928
13552
|
return;
|
|
@@ -14935,7 +13559,7 @@ function OhhwellsBridge() {
|
|
|
14935
13559
|
}, []);
|
|
14936
13560
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
14937
13561
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
14938
|
-
const select =
|
|
13562
|
+
const select = useCallback6((anchor) => {
|
|
14939
13563
|
if (!isNavigationItem2(anchor)) return;
|
|
14940
13564
|
if (activeElRef.current) deactivate();
|
|
14941
13565
|
aiSectionApiRef.current?.selectFromElement(anchor);
|
|
@@ -14944,8 +13568,6 @@ function OhhwellsBridge() {
|
|
|
14944
13568
|
selectedFooterColAttrRef.current = null;
|
|
14945
13569
|
markSelected(anchor);
|
|
14946
13570
|
setSelectedIsCta(isCtaButton(anchor));
|
|
14947
|
-
setSelectedIsSocial(Boolean(getSocialItem(anchor)));
|
|
14948
|
-
setSelectedIsSocialsRow(false);
|
|
14949
13571
|
clearHrefKeyHover(anchor);
|
|
14950
13572
|
const isDropdownTrigger = !isNestedNavChild(anchor) && (navItemHasDropdownChildren(anchor) || navItemOwnsDropdownPanel(anchor));
|
|
14951
13573
|
if (isNestedNavChild(anchor)) {
|
|
@@ -14975,10 +13597,8 @@ function OhhwellsBridge() {
|
|
|
14975
13597
|
setToolbarRect(anchor.getBoundingClientRect());
|
|
14976
13598
|
setToolbarShowEditLink(false);
|
|
14977
13599
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
14978
|
-
setFloatingPanel(null);
|
|
14979
|
-
setLogoSizeDraft(null);
|
|
14980
13600
|
}, [deactivate, markSelected]);
|
|
14981
|
-
const selectFrame =
|
|
13601
|
+
const selectFrame = useCallback6((el) => {
|
|
14982
13602
|
if (!isNavigationContainer(el)) return;
|
|
14983
13603
|
if (activeElRef.current) deactivate();
|
|
14984
13604
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -14988,8 +13608,6 @@ function OhhwellsBridge() {
|
|
|
14988
13608
|
selectedFooterColAttrRef.current = isFooterColumn ? el.getAttribute("data-ohw-footer-col") ?? String(listFooterColumns().indexOf(el)) : null;
|
|
14989
13609
|
markSelected(el);
|
|
14990
13610
|
setSelectedIsCta(false);
|
|
14991
|
-
setSelectedIsSocial(false);
|
|
14992
|
-
setSelectedIsSocialsRow(isSocialsRow(el));
|
|
14993
13611
|
clearHrefKeyHover(el);
|
|
14994
13612
|
setNavGroupForceOpen(null, false);
|
|
14995
13613
|
hoveredNavContainerRef.current = null;
|
|
@@ -15026,145 +13644,14 @@ function OhhwellsBridge() {
|
|
|
15026
13644
|
setToolbarRect(el.getBoundingClientRect());
|
|
15027
13645
|
setToolbarShowEditLink(false);
|
|
15028
13646
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
15029
|
-
setFloatingPanel(null);
|
|
15030
|
-
setLogoSizeDraft(null);
|
|
15031
13647
|
}, [deactivate, markSelected, postToParent2]);
|
|
15032
|
-
const
|
|
15033
|
-
(logoEl) => {
|
|
15034
|
-
if (activeElRef.current) deactivate();
|
|
15035
|
-
selectedElRef.current = logoEl;
|
|
15036
|
-
selectedHrefKeyRef.current = null;
|
|
15037
|
-
selectedFooterColAttrRef.current = null;
|
|
15038
|
-
markSelected(logoEl);
|
|
15039
|
-
setSelectedIsCta(false);
|
|
15040
|
-
setSelectedIsSocial(false);
|
|
15041
|
-
setSelectedIsSocialsRow(false);
|
|
15042
|
-
setSelectedIsSocialsRow(false);
|
|
15043
|
-
clearHrefKeyHover(logoEl);
|
|
15044
|
-
hoveredNavContainerRef.current = null;
|
|
15045
|
-
setHoveredNavContainerRect(null);
|
|
15046
|
-
setHoveredItemRect(null);
|
|
15047
|
-
hoveredItemElRef.current = null;
|
|
15048
|
-
siblingHintElRef.current = null;
|
|
15049
|
-
setSiblingHintRect(null);
|
|
15050
|
-
setSiblingHintRects([]);
|
|
15051
|
-
setIsItemDragging(false);
|
|
15052
|
-
setReorderHrefKey(null);
|
|
15053
|
-
setReorderDragDisabled(false);
|
|
15054
|
-
setIsFooterFrameSelection(false);
|
|
15055
|
-
setToolbarVariant("logo");
|
|
15056
|
-
setToolbarRect(getLogoInteractionRect(logoEl));
|
|
15057
|
-
setToolbarShowEditLink(false);
|
|
15058
|
-
setActiveCommands(/* @__PURE__ */ new Set());
|
|
15059
|
-
},
|
|
15060
|
-
[deactivate, markSelected]
|
|
15061
|
-
);
|
|
15062
|
-
const openLogoSizePanel = useCallback7((logoEl) => {
|
|
15063
|
-
const placement = getLogoPlacement(logoEl);
|
|
15064
|
-
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
15065
|
-
setLogoSizeDraft(draft);
|
|
15066
|
-
setParentScrollSnap(parentScrollRef.current);
|
|
15067
|
-
setFloatingPanel({
|
|
15068
|
-
key: `logo-size:${placement}`,
|
|
15069
|
-
title: "Logo",
|
|
15070
|
-
context: placement === "navbar" ? "Navbar" : "Footer",
|
|
15071
|
-
kind: "logo-size",
|
|
15072
|
-
placement
|
|
15073
|
-
});
|
|
15074
|
-
}, []);
|
|
15075
|
-
const openSocialsDisplayPanel = useCallback7((row) => {
|
|
15076
|
-
setParentScrollSnap(parentScrollRef.current);
|
|
15077
|
-
setFloatingPanel({
|
|
15078
|
-
key: "socials-display",
|
|
15079
|
-
title: "Style",
|
|
15080
|
-
context: "Socials \xB7 Footer",
|
|
15081
|
-
kind: "socials-display",
|
|
15082
|
-
row
|
|
15083
|
-
});
|
|
15084
|
-
}, []);
|
|
15085
|
-
const changeSocialsDisplay = useCallback7(
|
|
15086
|
-
(row, next) => {
|
|
15087
|
-
if (next.icon) {
|
|
15088
|
-
const missing = socialsMissingIcons(row);
|
|
15089
|
-
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
15090
|
-
if (missing.length) {
|
|
15091
|
-
postToParentRef.current({ type: "ow:social-icons-needed", items: missing });
|
|
15092
|
-
}
|
|
15093
|
-
}
|
|
15094
|
-
applySocialsDisplayToRow(row, next);
|
|
15095
|
-
requestAnimationFrame(() => {
|
|
15096
|
-
if (selectedElRef.current === row && row.isConnected) setToolbarRect(row.getBoundingClientRect());
|
|
15097
|
-
});
|
|
15098
|
-
const displayJson = JSON.stringify(socialsDisplayWith(row, next, editContentRef.current));
|
|
15099
|
-
editContentRef.current = { ...editContentRef.current, [SOCIALS_DISPLAY_KEY]: displayJson };
|
|
15100
|
-
postToParentRef.current({
|
|
15101
|
-
type: "ow:change",
|
|
15102
|
-
nodes: [{ key: SOCIALS_DISPLAY_KEY, text: displayJson }],
|
|
15103
|
-
flush: true
|
|
15104
|
-
});
|
|
15105
|
-
},
|
|
15106
|
-
[]
|
|
15107
|
-
);
|
|
15108
|
-
const closeFloatingPanelOnly = useCallback7(() => {
|
|
15109
|
-
setFloatingPanel(null);
|
|
15110
|
-
setLogoSizeDraft(null);
|
|
15111
|
-
}, []);
|
|
15112
|
-
const closeFloatingPanelAndDeselect = useCallback7(() => {
|
|
15113
|
-
setFloatingPanel(null);
|
|
15114
|
-
setLogoSizeDraft(null);
|
|
15115
|
-
deselectRef.current();
|
|
15116
|
-
}, []);
|
|
15117
|
-
const persistLogoSizeDraft = useCallback7(
|
|
15118
|
-
(placement, draft) => {
|
|
15119
|
-
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
15120
|
-
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
15121
|
-
const nodes = [
|
|
15122
|
-
{ key: desktopKey, text: String(draft.desktopPx) }
|
|
15123
|
-
];
|
|
15124
|
-
if (draft.mobileFollowing) {
|
|
15125
|
-
nodes.push({ key: mobileKey, text: "" });
|
|
15126
|
-
} else {
|
|
15127
|
-
nodes.push({ key: mobileKey, text: String(draft.mobilePx) });
|
|
15128
|
-
}
|
|
15129
|
-
editContentRef.current = {
|
|
15130
|
-
...editContentRef.current,
|
|
15131
|
-
[desktopKey]: String(draft.desktopPx),
|
|
15132
|
-
[mobileKey]: draft.mobileFollowing ? "" : String(draft.mobilePx)
|
|
15133
|
-
};
|
|
15134
|
-
applyLogoSizeToPlacement(
|
|
15135
|
-
placement,
|
|
15136
|
-
draft.desktopPx,
|
|
15137
|
-
draft.mobileFollowing ? draft.desktopPx : draft.mobilePx,
|
|
15138
|
-
draft.mobileFollowing
|
|
15139
|
-
);
|
|
15140
|
-
postToParent2({ type: "ow:change", nodes });
|
|
15141
|
-
requestAnimationFrame(() => {
|
|
15142
|
-
const selected = selectedElRef.current;
|
|
15143
|
-
if (!selected || toolbarVariantRef.current !== "logo") return;
|
|
15144
|
-
const rect = getLogoInteractionRect(selected);
|
|
15145
|
-
setToolbarRect(rect);
|
|
15146
|
-
if (glowElRef.current) {
|
|
15147
|
-
const GAP = SELECTION_CHROME_GAP2;
|
|
15148
|
-
glowElRef.current.style.top = `${rect.top - GAP}px`;
|
|
15149
|
-
glowElRef.current.style.left = `${rect.left - GAP}px`;
|
|
15150
|
-
glowElRef.current.style.width = `${rect.width + GAP * 2}px`;
|
|
15151
|
-
glowElRef.current.style.height = `${rect.height + GAP * 2}px`;
|
|
15152
|
-
}
|
|
15153
|
-
});
|
|
15154
|
-
},
|
|
15155
|
-
[postToParent2]
|
|
15156
|
-
);
|
|
15157
|
-
const activate = useCallback7((el, options) => {
|
|
13648
|
+
const activate = useCallback6((el, options) => {
|
|
15158
13649
|
if (activeElRef.current === el) return;
|
|
15159
|
-
if (isIconEditable(el)) return;
|
|
15160
|
-
if (el.hasAttribute("data-ohw-social-label")) return;
|
|
15161
13650
|
clearSelectedAttr();
|
|
15162
13651
|
selectedElRef.current = null;
|
|
15163
13652
|
selectedHrefKeyRef.current = null;
|
|
15164
13653
|
selectedFooterColAttrRef.current = null;
|
|
15165
13654
|
setSelectedIsCta(false);
|
|
15166
|
-
setSelectedIsSocial(false);
|
|
15167
|
-
setSelectedIsSocialsRow(false);
|
|
15168
13655
|
deactivate();
|
|
15169
13656
|
if (hoveredImageRef.current) {
|
|
15170
13657
|
hoveredImageRef.current = null;
|
|
@@ -15234,38 +13721,8 @@ function OhhwellsBridge() {
|
|
|
15234
13721
|
deactivateRef.current = deactivate;
|
|
15235
13722
|
selectRef.current = select;
|
|
15236
13723
|
selectFrameRef.current = selectFrame;
|
|
15237
|
-
selectLogoRef.current = selectLogo;
|
|
15238
|
-
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
15239
13724
|
deselectRef.current = deselect;
|
|
15240
|
-
|
|
15241
|
-
const lastSiteWideScopeRef = useRef9(null);
|
|
15242
|
-
useEffect12(() => {
|
|
15243
|
-
if (!isEditMode) {
|
|
15244
|
-
if (lastSiteWideScopeRef.current !== false) {
|
|
15245
|
-
lastSiteWideScopeRef.current = false;
|
|
15246
|
-
postToParent2({ type: "ow:site-wide-scope", active: false });
|
|
15247
|
-
}
|
|
15248
|
-
return;
|
|
15249
|
-
}
|
|
15250
|
-
const active = isSiteWideScopeActive({
|
|
15251
|
-
selected: selectedElRef.current,
|
|
15252
|
-
hoveredItem: hoveredItemElRef.current,
|
|
15253
|
-
hoveredNavContainer: hoveredNavContainerRef.current,
|
|
15254
|
-
active: activeElRef.current
|
|
15255
|
-
});
|
|
15256
|
-
if (lastSiteWideScopeRef.current === active) return;
|
|
15257
|
-
lastSiteWideScopeRef.current = active;
|
|
15258
|
-
postToParent2({ type: "ow:site-wide-scope", active });
|
|
15259
|
-
}, [
|
|
15260
|
-
isEditMode,
|
|
15261
|
-
hoveredItemRect,
|
|
15262
|
-
hoveredNavContainerRect,
|
|
15263
|
-
toolbarVariant,
|
|
15264
|
-
toolbarRect,
|
|
15265
|
-
isFooterFrameSelection,
|
|
15266
|
-
postToParent2
|
|
15267
|
-
]);
|
|
15268
|
-
useLayoutEffect4(() => {
|
|
13725
|
+
useLayoutEffect3(() => {
|
|
15269
13726
|
if (!subdomain || isEditMode) {
|
|
15270
13727
|
setFetchState("done");
|
|
15271
13728
|
return;
|
|
@@ -15276,13 +13733,9 @@ function OhhwellsBridge() {
|
|
|
15276
13733
|
aiSectionsRef.current = content[AI_SECTIONS_KEY];
|
|
15277
13734
|
applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
|
|
15278
13735
|
}
|
|
15279
|
-
applyBrandChrome(content);
|
|
15280
13736
|
for (const [key, val] of Object.entries(content)) {
|
|
15281
13737
|
if (key === "__ohw_sections") continue;
|
|
15282
13738
|
if (key === AI_SECTIONS_KEY) continue;
|
|
15283
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
15284
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
15285
|
-
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
15286
13739
|
if (applyVideoSettingNode(key, val)) continue;
|
|
15287
13740
|
if (applyCarouselNode(key, val)) continue;
|
|
15288
13741
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -15309,20 +13762,14 @@ function OhhwellsBridge() {
|
|
|
15309
13762
|
}
|
|
15310
13763
|
} else if (el.dataset.ohwEditable === "link") {
|
|
15311
13764
|
applyLinkHref(el, val);
|
|
15312
|
-
} else if (el.dataset.ohwEditable === "icon") {
|
|
15313
|
-
applyIconMarkup(el, val);
|
|
15314
13765
|
} else if (el.innerHTML !== val) {
|
|
15315
13766
|
el.innerHTML = val;
|
|
15316
13767
|
}
|
|
15317
13768
|
});
|
|
15318
13769
|
applyLinkByKey(key, val);
|
|
15319
13770
|
}
|
|
15320
|
-
applyLogoFromContent(content);
|
|
15321
|
-
applyLogoSizes(content);
|
|
15322
13771
|
reconcileNavbarItemsFromContent(content);
|
|
15323
13772
|
reconcileFooterOrderFromContent(content);
|
|
15324
|
-
reconcileSocialsFromContent(content);
|
|
15325
|
-
applySocialsDisplayFromContent(content);
|
|
15326
13773
|
enforceLinkHrefs();
|
|
15327
13774
|
initSectionsFromContent(content, true);
|
|
15328
13775
|
sectionsLoadedRef.current = true;
|
|
@@ -15338,9 +13785,7 @@ function OhhwellsBridge() {
|
|
|
15338
13785
|
let cancelled = false;
|
|
15339
13786
|
setFetchState("loading");
|
|
15340
13787
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
15341
|
-
|
|
15342
|
-
fetchedContentPaths.add(`${subdomain}::${initialPath}`);
|
|
15343
|
-
fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(initialPath)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
13788
|
+
fetch(`${apiUrl}/api/public/sites/${subdomain}/content`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
15344
13789
|
if (cancelled) return;
|
|
15345
13790
|
const content = data?.content ?? {};
|
|
15346
13791
|
contentCache.set(subdomain, content);
|
|
@@ -15353,7 +13798,7 @@ function OhhwellsBridge() {
|
|
|
15353
13798
|
cancelled = true;
|
|
15354
13799
|
};
|
|
15355
13800
|
}, [subdomain, isEditMode]);
|
|
15356
|
-
|
|
13801
|
+
useEffect11(() => {
|
|
15357
13802
|
if (!subdomain || isEditMode) return;
|
|
15358
13803
|
let debounceTimer = null;
|
|
15359
13804
|
let observer = null;
|
|
@@ -15363,12 +13808,8 @@ function OhhwellsBridge() {
|
|
|
15363
13808
|
retryMissingSchedulingMounts(getPageSchedulingEntries(content["__ohw_sections"]), false);
|
|
15364
13809
|
observer?.disconnect();
|
|
15365
13810
|
try {
|
|
15366
|
-
applyBrandChrome(content);
|
|
15367
13811
|
for (const [key, val] of Object.entries(content)) {
|
|
15368
13812
|
if (key === "__ohw_sections") continue;
|
|
15369
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
15370
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
15371
|
-
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
15372
13813
|
if (applyVideoSettingNode(key, val)) continue;
|
|
15373
13814
|
if (applyCarouselNode(key, val)) continue;
|
|
15374
13815
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -15389,12 +13830,8 @@ function OhhwellsBridge() {
|
|
|
15389
13830
|
});
|
|
15390
13831
|
applyLinkByKey(key, val);
|
|
15391
13832
|
}
|
|
15392
|
-
applyLogoFromContent(content);
|
|
15393
13833
|
reconcileNavbarItemsFromContent(content);
|
|
15394
13834
|
reconcileFooterOrderFromContent(content);
|
|
15395
|
-
reconcileSocialsFromContent(content);
|
|
15396
|
-
applySocialsDisplayFromContent(content);
|
|
15397
|
-
applySocialsDisplayFromContent(content);
|
|
15398
13835
|
} finally {
|
|
15399
13836
|
observer?.observe(document.body, { childList: true, subtree: true });
|
|
15400
13837
|
}
|
|
@@ -15405,17 +13842,6 @@ function OhhwellsBridge() {
|
|
|
15405
13842
|
debounceTimer = setTimeout(applyFromCache, 150);
|
|
15406
13843
|
};
|
|
15407
13844
|
applyFromCache();
|
|
15408
|
-
const pathCacheKey = `${subdomain}::${pathname}`;
|
|
15409
|
-
if (!fetchedContentPaths.has(pathCacheKey)) {
|
|
15410
|
-
fetchedContentPaths.add(pathCacheKey);
|
|
15411
|
-
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
15412
|
-
fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(pathname)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
15413
|
-
if (!data?.content) return;
|
|
15414
|
-
contentCache.set(subdomain, data.content);
|
|
15415
|
-
applyFromCache();
|
|
15416
|
-
}).catch(() => {
|
|
15417
|
-
});
|
|
15418
|
-
}
|
|
15419
13845
|
observer = new MutationObserver(scheduleApply);
|
|
15420
13846
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
15421
13847
|
return () => {
|
|
@@ -15423,16 +13849,16 @@ function OhhwellsBridge() {
|
|
|
15423
13849
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
15424
13850
|
};
|
|
15425
13851
|
}, [subdomain, isEditMode, pathname]);
|
|
15426
|
-
|
|
13852
|
+
useLayoutEffect3(() => {
|
|
15427
13853
|
const el = document.getElementById("ohw-loader");
|
|
15428
13854
|
if (!el) return;
|
|
15429
13855
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
15430
13856
|
el.style.display = visible ? "flex" : "none";
|
|
15431
13857
|
}, [subdomain, fetchState]);
|
|
15432
|
-
|
|
13858
|
+
useEffect11(() => {
|
|
15433
13859
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
15434
13860
|
}, [pathname, postToParent2]);
|
|
15435
|
-
|
|
13861
|
+
useEffect11(() => {
|
|
15436
13862
|
if (!isEditMode) return;
|
|
15437
13863
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
15438
13864
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -15440,7 +13866,7 @@ function OhhwellsBridge() {
|
|
|
15440
13866
|
deselectRef.current();
|
|
15441
13867
|
deactivateRef.current();
|
|
15442
13868
|
}, [pathname, isEditMode]);
|
|
15443
|
-
|
|
13869
|
+
useEffect11(() => {
|
|
15444
13870
|
const contentForNav = () => {
|
|
15445
13871
|
if (isEditMode) return editContentRef.current;
|
|
15446
13872
|
if (!subdomain) return {};
|
|
@@ -15472,9 +13898,6 @@ function OhhwellsBridge() {
|
|
|
15472
13898
|
const content = contentForNav();
|
|
15473
13899
|
reconcileNavbarItemsFromContent(content);
|
|
15474
13900
|
reconcileFooterOrderFromContent(content);
|
|
15475
|
-
reconcileSocialsFromContent(content);
|
|
15476
|
-
applySocialsDisplayFromContent(content);
|
|
15477
|
-
applySocialsDisplayFromContent(content);
|
|
15478
13901
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
15479
13902
|
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key"))) {
|
|
15480
13903
|
disableNativeHrefDrag(el);
|
|
@@ -15508,7 +13931,7 @@ function OhhwellsBridge() {
|
|
|
15508
13931
|
observer?.disconnect();
|
|
15509
13932
|
};
|
|
15510
13933
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
15511
|
-
|
|
13934
|
+
useEffect11(() => {
|
|
15512
13935
|
if (!isEditMode) return;
|
|
15513
13936
|
const measure = () => {
|
|
15514
13937
|
const h = document.body.scrollHeight;
|
|
@@ -15532,7 +13955,7 @@ function OhhwellsBridge() {
|
|
|
15532
13955
|
window.removeEventListener("resize", handleResize);
|
|
15533
13956
|
};
|
|
15534
13957
|
}, [pathname, isEditMode, postToParent2]);
|
|
15535
|
-
|
|
13958
|
+
useEffect11(() => {
|
|
15536
13959
|
if (!subdomainFromQuery || isEditMode) return;
|
|
15537
13960
|
const handleClick = (e) => {
|
|
15538
13961
|
const anchor = e.target.closest("a");
|
|
@@ -15548,7 +13971,7 @@ function OhhwellsBridge() {
|
|
|
15548
13971
|
document.addEventListener("click", handleClick, true);
|
|
15549
13972
|
return () => document.removeEventListener("click", handleClick, true);
|
|
15550
13973
|
}, [subdomainFromQuery, isEditMode, router]);
|
|
15551
|
-
|
|
13974
|
+
useEffect11(() => {
|
|
15552
13975
|
if (!isEditMode) {
|
|
15553
13976
|
editStylesRef.current?.base.remove();
|
|
15554
13977
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -15677,7 +14100,6 @@ function OhhwellsBridge() {
|
|
|
15677
14100
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
15678
14101
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
15679
14102
|
if (isInsideLinkEditor(target)) return;
|
|
15680
|
-
if (isInsideFloatingPanel(target)) return;
|
|
15681
14103
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
15682
14104
|
const beneath = document.elementsFromPoint(e.clientX, e.clientY).find(
|
|
15683
14105
|
(el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
|
|
@@ -15741,21 +14163,6 @@ function OhhwellsBridge() {
|
|
|
15741
14163
|
return;
|
|
15742
14164
|
}
|
|
15743
14165
|
}
|
|
15744
|
-
const logoEl = getLogoElement(target);
|
|
15745
|
-
if (logoEl) {
|
|
15746
|
-
e.preventDefault();
|
|
15747
|
-
e.stopPropagation();
|
|
15748
|
-
if (!logoHasUploadedImage(logoEl)) {
|
|
15749
|
-
deselectRef.current();
|
|
15750
|
-
deactivateRef.current();
|
|
15751
|
-
const identity = readLogoIdentityFromDom();
|
|
15752
|
-
postToParentRef.current({ type: "ow:open-logo-settings", ...identity });
|
|
15753
|
-
return;
|
|
15754
|
-
}
|
|
15755
|
-
selectLogoRef.current(logoEl);
|
|
15756
|
-
openLogoSizePanelRef.current(logoEl);
|
|
15757
|
-
return;
|
|
15758
|
-
}
|
|
15759
14166
|
const editable = target.closest("[data-ohw-editable]");
|
|
15760
14167
|
if (editable) {
|
|
15761
14168
|
if (editable.dataset.ohwEditable === "link") {
|
|
@@ -15772,17 +14179,6 @@ function OhhwellsBridge() {
|
|
|
15772
14179
|
});
|
|
15773
14180
|
return;
|
|
15774
14181
|
}
|
|
15775
|
-
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
15776
|
-
e.preventDefault();
|
|
15777
|
-
e.stopPropagation();
|
|
15778
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
15779
|
-
postToParentRef.current({
|
|
15780
|
-
type: "ow:icon-pick",
|
|
15781
|
-
key: editable.dataset.ohwKey ?? "",
|
|
15782
|
-
current: currentIconRef(editable)
|
|
15783
|
-
});
|
|
15784
|
-
return;
|
|
15785
|
-
}
|
|
15786
14182
|
if (isMediaEditable(editable)) {
|
|
15787
14183
|
e.preventDefault();
|
|
15788
14184
|
e.stopPropagation();
|
|
@@ -15797,7 +14193,6 @@ function OhhwellsBridge() {
|
|
|
15797
14193
|
e.stopPropagation();
|
|
15798
14194
|
if (selectedElRef.current === navAnchor) {
|
|
15799
14195
|
if (e.detail >= 2) return;
|
|
15800
|
-
if (requestSocialDialog(navAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
15801
14196
|
activateRef.current(editable, { caretX: e.clientX, caretY: e.clientY });
|
|
15802
14197
|
return;
|
|
15803
14198
|
}
|
|
@@ -15814,7 +14209,6 @@ function OhhwellsBridge() {
|
|
|
15814
14209
|
e.preventDefault();
|
|
15815
14210
|
e.stopPropagation();
|
|
15816
14211
|
if (selectedElRef.current === hrefAnchor) {
|
|
15817
|
-
if (requestSocialDialog(hrefAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
15818
14212
|
const textEditable = hrefAnchor.querySelector('[data-ohw-editable="text"]') ?? hrefAnchor.querySelector("[data-ohw-editable]");
|
|
15819
14213
|
if (textEditable) {
|
|
15820
14214
|
activateRef.current(textEditable, {
|
|
@@ -15853,13 +14247,6 @@ function OhhwellsBridge() {
|
|
|
15853
14247
|
selectFrameRef.current(navContainerToSelect);
|
|
15854
14248
|
return;
|
|
15855
14249
|
}
|
|
15856
|
-
const socialsRowToSelect = isSocialsRow(target) ? target : null;
|
|
15857
|
-
if (socialsRowToSelect && !getSocialItem(target)) {
|
|
15858
|
-
e.preventDefault();
|
|
15859
|
-
e.stopPropagation();
|
|
15860
|
-
selectFrameRef.current(socialsRowToSelect);
|
|
15861
|
-
return;
|
|
15862
|
-
}
|
|
15863
14250
|
const footerColumnToSelect = resolveFooterColumnSelectionTarget(target, e.clientX, e.clientY);
|
|
15864
14251
|
if (footerColumnToSelect) {
|
|
15865
14252
|
e.preventDefault();
|
|
@@ -15908,11 +14295,9 @@ function OhhwellsBridge() {
|
|
|
15908
14295
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
15909
14296
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
15910
14297
|
if (isInsideLinkEditor(target)) return;
|
|
15911
|
-
if (isInsideFloatingPanel(target)) return;
|
|
15912
14298
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
15913
14299
|
return;
|
|
15914
14300
|
}
|
|
15915
|
-
if (getSocialItem(target)) return;
|
|
15916
14301
|
const navLabel = getNavigationLabelEditable(target);
|
|
15917
14302
|
const editable = navLabel?.editable ?? target.closest('[data-ohw-editable="text"], [data-ohw-editable="plain"]');
|
|
15918
14303
|
if (!editable || isMediaEditable(editable) || editable.dataset.ohwEditable === "link") return;
|
|
@@ -15936,16 +14321,6 @@ function OhhwellsBridge() {
|
|
|
15936
14321
|
setHoveredNavContainerRect(null);
|
|
15937
14322
|
return;
|
|
15938
14323
|
}
|
|
15939
|
-
if (isInsideFloatingPanel(target) || isPointOverFloatingPanel(e.clientX, e.clientY)) {
|
|
15940
|
-
hoveredItemElRef.current = null;
|
|
15941
|
-
setHoveredItemRect(null);
|
|
15942
|
-
hoveredNavContainerRef.current = null;
|
|
15943
|
-
setHoveredNavContainerRect(null);
|
|
15944
|
-
siblingHintElRef.current = null;
|
|
15945
|
-
setSiblingHintRect(null);
|
|
15946
|
-
setSiblingHintRects([]);
|
|
15947
|
-
return;
|
|
15948
|
-
}
|
|
15949
14324
|
{
|
|
15950
14325
|
const selected2 = selectedElRef.current;
|
|
15951
14326
|
const selectedIsFooterColumn = Boolean(selected2) && !isFooterLinksContainer(selected2) && (selected2.hasAttribute("data-ohw-footer-col") || selected2.hasAttribute("data-ohw-footer-column") || Boolean(selected2.closest("footer") && isInferredFooterGroup2(selected2)));
|
|
@@ -15953,7 +14328,7 @@ function OhhwellsBridge() {
|
|
|
15953
14328
|
const allowFooterLinksHover = toolbarVariantRef.current !== "select-frame" || selectedIsFooterColumn;
|
|
15954
14329
|
if (allowNavContainerHover) {
|
|
15955
14330
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
15956
|
-
if (navContainer && !getNavigationItemAnchor(target)
|
|
14331
|
+
if (navContainer && !getNavigationItemAnchor(target)) {
|
|
15957
14332
|
hoveredNavContainerRef.current = navContainer;
|
|
15958
14333
|
setHoveredNavContainerRect(navContainer.getBoundingClientRect());
|
|
15959
14334
|
hoveredItemElRef.current = null;
|
|
@@ -15982,15 +14357,6 @@ function OhhwellsBridge() {
|
|
|
15982
14357
|
setHoveredNavContainerRect(null);
|
|
15983
14358
|
}
|
|
15984
14359
|
}
|
|
15985
|
-
const logoEl = getLogoElement(target);
|
|
15986
|
-
if (logoEl) {
|
|
15987
|
-
hoveredNavContainerRef.current = null;
|
|
15988
|
-
setHoveredNavContainerRect(null);
|
|
15989
|
-
if (selectedElRef.current === logoEl) return;
|
|
15990
|
-
hoveredItemElRef.current = logoEl;
|
|
15991
|
-
setHoveredItemRect(getLogoInteractionRect(logoEl));
|
|
15992
|
-
return;
|
|
15993
|
-
}
|
|
15994
14360
|
const navAnchor = getNavigationItemAnchor(target);
|
|
15995
14361
|
if (navAnchor) {
|
|
15996
14362
|
hoveredNavContainerRef.current = null;
|
|
@@ -16016,11 +14382,6 @@ function OhhwellsBridge() {
|
|
|
16016
14382
|
const selected = selectedElRef.current;
|
|
16017
14383
|
if (selected && (selected === editable || selected.contains(editable))) return;
|
|
16018
14384
|
if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
|
|
16019
|
-
if (isIconEditable(editable)) {
|
|
16020
|
-
hoveredItemElRef.current = editable;
|
|
16021
|
-
setHoveredItemRect(editable.getBoundingClientRect());
|
|
16022
|
-
return;
|
|
16023
|
-
}
|
|
16024
14385
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
16025
14386
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
16026
14387
|
clearHrefKeyHover(hoverTarget);
|
|
@@ -16028,12 +14389,6 @@ function OhhwellsBridge() {
|
|
|
16028
14389
|
setHoveredItemRect(hoverTarget.getBoundingClientRect());
|
|
16029
14390
|
} else if (!isInsideNavigationItem(editable)) {
|
|
16030
14391
|
hoverTarget.setAttribute("data-ohw-hovered", "");
|
|
16031
|
-
if (editable.closest("footer") || editable.closest('[data-ohw-section="footer"]')) {
|
|
16032
|
-
hoveredNavContainerRef.current = null;
|
|
16033
|
-
setHoveredNavContainerRect(null);
|
|
16034
|
-
hoveredItemElRef.current = editable;
|
|
16035
|
-
setHoveredItemRect(editable.getBoundingClientRect());
|
|
16036
|
-
}
|
|
16037
14392
|
}
|
|
16038
14393
|
}
|
|
16039
14394
|
};
|
|
@@ -16069,30 +14424,11 @@ function OhhwellsBridge() {
|
|
|
16069
14424
|
}
|
|
16070
14425
|
return;
|
|
16071
14426
|
}
|
|
16072
|
-
const logoEl = getLogoElement(target);
|
|
16073
|
-
if (logoEl) {
|
|
16074
|
-
const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
16075
|
-
if (related2 && (logoEl === related2 || logoEl.contains(related2) || related2.closest?.('[data-ohw-role="logo"], [data-ohw-logo]'))) {
|
|
16076
|
-
return;
|
|
16077
|
-
}
|
|
16078
|
-
if (hoveredItemElRef.current === logoEl) {
|
|
16079
|
-
hoveredItemElRef.current = null;
|
|
16080
|
-
setHoveredItemRect(null);
|
|
16081
|
-
}
|
|
16082
|
-
return;
|
|
16083
|
-
}
|
|
16084
14427
|
const editable = target.closest("[data-ohw-editable]");
|
|
16085
14428
|
if (!editable) return;
|
|
16086
14429
|
const related = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
16087
14430
|
if (related?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
|
|
16088
14431
|
if (!isMediaEditable(editable)) {
|
|
16089
|
-
if (isIconEditable(editable) && hoveredItemElRef.current === editable) {
|
|
16090
|
-
if (!related?.closest("[data-ohw-item-interaction]")) {
|
|
16091
|
-
hoveredItemElRef.current = null;
|
|
16092
|
-
setHoveredItemRect(null);
|
|
16093
|
-
}
|
|
16094
|
-
return;
|
|
16095
|
-
}
|
|
16096
14432
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
16097
14433
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
16098
14434
|
if (!related?.closest("[data-ohw-href-key]")) {
|
|
@@ -16101,13 +14437,6 @@ function OhhwellsBridge() {
|
|
|
16101
14437
|
}
|
|
16102
14438
|
} else {
|
|
16103
14439
|
hoverTarget.removeAttribute("data-ohw-hovered");
|
|
16104
|
-
if (hoveredItemElRef.current === editable) {
|
|
16105
|
-
const stillOnEditable = related instanceof Element && related.closest("[data-ohw-editable]") === editable;
|
|
16106
|
-
if (!stillOnEditable) {
|
|
16107
|
-
hoveredItemElRef.current = null;
|
|
16108
|
-
setHoveredItemRect(null);
|
|
16109
|
-
}
|
|
16110
|
-
}
|
|
16111
14440
|
}
|
|
16112
14441
|
}
|
|
16113
14442
|
};
|
|
@@ -16224,26 +14553,6 @@ function OhhwellsBridge() {
|
|
|
16224
14553
|
hoveredNavContainerRef.current = null;
|
|
16225
14554
|
setHoveredNavContainerRect(null);
|
|
16226
14555
|
}
|
|
16227
|
-
const logoCandidates = [
|
|
16228
|
-
...document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]'),
|
|
16229
|
-
...document.querySelectorAll("nav a:not([data-ohw-href-key]), [data-ohw-nav-root] a:not([data-ohw-href-key])"),
|
|
16230
|
-
...document.querySelectorAll("footer img")
|
|
16231
|
-
];
|
|
16232
|
-
const seenLogos = /* @__PURE__ */ new Set();
|
|
16233
|
-
for (const candidate of logoCandidates) {
|
|
16234
|
-
const logo = getLogoElement(candidate);
|
|
16235
|
-
if (!logo || seenLogos.has(logo)) continue;
|
|
16236
|
-
seenLogos.add(logo);
|
|
16237
|
-
const r2 = logo.getBoundingClientRect();
|
|
16238
|
-
if (x < r2.left || x > r2.right || y < r2.top || y > r2.bottom) continue;
|
|
16239
|
-
hoveredNavContainerRef.current = null;
|
|
16240
|
-
setHoveredNavContainerRect(null);
|
|
16241
|
-
if (selectedElRef.current !== logo) {
|
|
16242
|
-
hoveredItemElRef.current = logo;
|
|
16243
|
-
setHoveredItemRect(getLogoInteractionRect(logo));
|
|
16244
|
-
}
|
|
16245
|
-
return;
|
|
16246
|
-
}
|
|
16247
14556
|
const navContainers = Array.from(
|
|
16248
14557
|
document.querySelectorAll("[data-ohw-nav-container]")
|
|
16249
14558
|
);
|
|
@@ -16329,7 +14638,7 @@ function OhhwellsBridge() {
|
|
|
16329
14638
|
}
|
|
16330
14639
|
};
|
|
16331
14640
|
const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
|
|
16332
|
-
if (linkPopoverOpenRef.current
|
|
14641
|
+
if (linkPopoverOpenRef.current) {
|
|
16333
14642
|
if (hoveredImageRef.current) {
|
|
16334
14643
|
hoveredImageRef.current = null;
|
|
16335
14644
|
hoveredImageHasTextOverlapRef.current = false;
|
|
@@ -16583,7 +14892,7 @@ function OhhwellsBridge() {
|
|
|
16583
14892
|
}
|
|
16584
14893
|
};
|
|
16585
14894
|
const probeHoverCardsAt = (clientX, clientY, fromParentViewport = false) => {
|
|
16586
|
-
if (linkPopoverOpenRef.current ||
|
|
14895
|
+
if (linkPopoverOpenRef.current || document.documentElement.hasAttribute("data-ohw-section-picking")) {
|
|
16587
14896
|
if (activeStateElRef.current) {
|
|
16588
14897
|
activeStateElRef.current.removeAttribute("data-ohw-state-hovered");
|
|
16589
14898
|
activeStateElRef.current = null;
|
|
@@ -16651,19 +14960,6 @@ function OhhwellsBridge() {
|
|
|
16651
14960
|
};
|
|
16652
14961
|
const handleMouseMove = (e) => {
|
|
16653
14962
|
const { clientX, clientY } = e;
|
|
16654
|
-
if (floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
|
|
16655
|
-
hoveredItemElRef.current = null;
|
|
16656
|
-
setHoveredItemRect(null);
|
|
16657
|
-
hoveredNavContainerRef.current = null;
|
|
16658
|
-
setHoveredNavContainerRect(null);
|
|
16659
|
-
siblingHintElRef.current = null;
|
|
16660
|
-
setSiblingHintRect(null);
|
|
16661
|
-
setSiblingHintRects([]);
|
|
16662
|
-
dismissImageHover();
|
|
16663
|
-
clearImageHover();
|
|
16664
|
-
setSectionGap(null);
|
|
16665
|
-
return;
|
|
16666
|
-
}
|
|
16667
14963
|
probeSectionGapAt(clientX, clientY);
|
|
16668
14964
|
probeImageAt(clientX, clientY);
|
|
16669
14965
|
probeHoverCardsAt(clientX, clientY);
|
|
@@ -16672,11 +14968,6 @@ function OhhwellsBridge() {
|
|
|
16672
14968
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
16673
14969
|
const { clientX, clientY } = e.data;
|
|
16674
14970
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
16675
|
-
if (floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
|
|
16676
|
-
dismissImageHover();
|
|
16677
|
-
clearImageHover();
|
|
16678
|
-
return;
|
|
16679
|
-
}
|
|
16680
14971
|
probeSectionGapAt(clientX, clientY);
|
|
16681
14972
|
probeImageAt(clientX, clientY);
|
|
16682
14973
|
probeHoverCardsAt(clientX, clientY);
|
|
@@ -16686,7 +14977,7 @@ function OhhwellsBridge() {
|
|
|
16686
14977
|
if (footerSession) {
|
|
16687
14978
|
e.preventDefault();
|
|
16688
14979
|
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
16689
|
-
const slot = footerSession.kind === "
|
|
14980
|
+
const slot = footerSession.kind === "link" && footerSession.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, footerSession.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
16690
14981
|
refreshFooterDragVisualsRef.current(footerSession, slot, e.clientX, e.clientY);
|
|
16691
14982
|
return;
|
|
16692
14983
|
}
|
|
@@ -16738,62 +15029,6 @@ function OhhwellsBridge() {
|
|
|
16738
15029
|
resumeAnimTracks();
|
|
16739
15030
|
clearImageHover();
|
|
16740
15031
|
};
|
|
16741
|
-
const handleSocialCancel = (e) => {
|
|
16742
|
-
if (e.data?.type !== "ow:social-cancel") return;
|
|
16743
|
-
const { hrefKey } = e.data;
|
|
16744
|
-
const item = hrefKey ? findSocialByHrefKey(hrefKey) : null;
|
|
16745
|
-
if (!item) return;
|
|
16746
|
-
const removed = removeSocialItem(item, editContentRef.current);
|
|
16747
|
-
if (!removed) return;
|
|
16748
|
-
const orderJson = JSON.stringify(removed.order);
|
|
16749
|
-
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
16750
|
-
postToParentRef.current({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
16751
|
-
deselectRef.current();
|
|
16752
|
-
};
|
|
16753
|
-
const handleSocialUpdate = (e) => {
|
|
16754
|
-
if (e.data?.type !== "ow:social-update") return;
|
|
16755
|
-
const updates = Array.isArray(e.data.items) ? e.data.items : [e.data];
|
|
16756
|
-
const nodes = [];
|
|
16757
|
-
for (const { hrefKey, iconKey, url, iconMarkup, platformId, label } of updates) {
|
|
16758
|
-
if (hrefKey) {
|
|
16759
|
-
document.querySelectorAll(`[data-ohw-href-key="${hrefKey}"]`).forEach((el) => applyLinkHref(el, url));
|
|
16760
|
-
nodes.push({ key: hrefKey, text: url });
|
|
16761
|
-
}
|
|
16762
|
-
if (iconKey && typeof iconMarkup === "string" && iconMarkup) {
|
|
16763
|
-
document.querySelectorAll(`[data-ohw-key="${iconKey}"][data-ohw-editable="icon"]`).forEach((el) => {
|
|
16764
|
-
applyIconMarkup(el, iconMarkup);
|
|
16765
|
-
});
|
|
16766
|
-
nodes.push({ key: iconKey, text: iconMarkup });
|
|
16767
|
-
}
|
|
16768
|
-
if (iconKey && platformId) nodes.push({ key: socialPlatformKey(iconKey), text: platformId });
|
|
16769
|
-
if (iconKey && label) {
|
|
16770
|
-
const labelKey = socialLabelKey(iconKey);
|
|
16771
|
-
document.querySelectorAll(`[data-ohw-key="${labelKey}"]`).forEach((el) => {
|
|
16772
|
-
el.textContent = label;
|
|
16773
|
-
});
|
|
16774
|
-
nodes.push({ key: labelKey, text: label });
|
|
16775
|
-
}
|
|
16776
|
-
}
|
|
16777
|
-
if (!nodes.length) return;
|
|
16778
|
-
editContentRef.current = {
|
|
16779
|
-
...editContentRef.current,
|
|
16780
|
-
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
16781
|
-
};
|
|
16782
|
-
postToParentRef.current({ type: "ow:change", nodes, flush: true });
|
|
16783
|
-
};
|
|
16784
|
-
const handleIconMarkup = (e) => {
|
|
16785
|
-
if (e.data?.type !== "ow:icon-markup") return;
|
|
16786
|
-
const { key, markup } = e.data;
|
|
16787
|
-
if (!key || typeof markup !== "string") return;
|
|
16788
|
-
const targets = document.querySelectorAll(
|
|
16789
|
-
`[data-ohw-key="${key}"][data-ohw-editable="icon"]`
|
|
16790
|
-
);
|
|
16791
|
-
if (!targets.length) return;
|
|
16792
|
-
targets.forEach((el) => {
|
|
16793
|
-
applyIconMarkup(el, markup);
|
|
16794
|
-
});
|
|
16795
|
-
postToParentRef.current({ type: "ow:change", nodes: [{ key, text: markup }], flush: true });
|
|
16796
|
-
};
|
|
16797
15032
|
const handleImageUrl = (e) => {
|
|
16798
15033
|
if (e.data?.type !== "ow:image-url") return;
|
|
16799
15034
|
const { key, url } = e.data;
|
|
@@ -16926,7 +15161,6 @@ function OhhwellsBridge() {
|
|
|
16926
15161
|
aiSectionsRef.current = content[AI_SECTIONS_KEY];
|
|
16927
15162
|
applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
|
|
16928
15163
|
}
|
|
16929
|
-
applyBrandChrome(content);
|
|
16930
15164
|
let sectionsJson = null;
|
|
16931
15165
|
for (const [key, val] of Object.entries(content)) {
|
|
16932
15166
|
if (key === "__ohw_sections") {
|
|
@@ -16934,9 +15168,6 @@ function OhhwellsBridge() {
|
|
|
16934
15168
|
continue;
|
|
16935
15169
|
}
|
|
16936
15170
|
if (key === AI_SECTIONS_KEY) continue;
|
|
16937
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
16938
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
16939
|
-
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
16940
15171
|
if (applyVideoSettingNode(key, val)) continue;
|
|
16941
15172
|
if (applyCarouselNode(key, val)) continue;
|
|
16942
15173
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -16956,8 +15187,6 @@ function OhhwellsBridge() {
|
|
|
16956
15187
|
});
|
|
16957
15188
|
applyLinkByKey(key, val);
|
|
16958
15189
|
}
|
|
16959
|
-
applyLogoFromContent(content);
|
|
16960
|
-
applyLogoSizes(content);
|
|
16961
15190
|
if (sectionsJson) {
|
|
16962
15191
|
initSectionsFromContent({ __ohw_sections: sectionsJson }, true);
|
|
16963
15192
|
sectionsLoadedRef.current = true;
|
|
@@ -16972,58 +15201,6 @@ function OhhwellsBridge() {
|
|
|
16972
15201
|
if (hydratedHeight > 50) postToParentRef.current({ type: "ow:height", height: hydratedHeight });
|
|
16973
15202
|
postToParentRef.current({ type: "ow:hydrate-done" });
|
|
16974
15203
|
};
|
|
16975
|
-
const handleUpdateLogoIdentity = (e) => {
|
|
16976
|
-
if (e.data?.type !== "ow:update-logo-identity") return;
|
|
16977
|
-
const rawText = typeof e.data.text === "string" ? e.data.text : "";
|
|
16978
|
-
const alt = typeof e.data.alt === "string" ? e.data.alt : rawText;
|
|
16979
|
-
const href = typeof e.data.href === "string" ? e.data.href : void 0;
|
|
16980
|
-
const imageProvided = "image" in e.data;
|
|
16981
|
-
const imageUrl = imageProvided && typeof e.data.image === "string" && e.data.image.trim() ? e.data.image.trim() : imageProvided ? null : void 0;
|
|
16982
|
-
let isPlaceholder = e.data.isPlaceholder !== false;
|
|
16983
|
-
if (imageUrl) isPlaceholder = false;
|
|
16984
|
-
else if (imageProvided && imageUrl === null) {
|
|
16985
|
-
isPlaceholder = e.data.isPlaceholder === true || !rawText.trim() || resolveLogoDisplayText(rawText) === PLACEHOLDER_BUSINESS_NAME;
|
|
16986
|
-
}
|
|
16987
|
-
const display = applyLogoIdentity(rawText, isPlaceholder);
|
|
16988
|
-
const displayAlt = resolveLogoDisplayText(alt || display);
|
|
16989
|
-
if (imageUrl !== void 0) {
|
|
16990
|
-
applyLogoImage(imageUrl, displayAlt);
|
|
16991
|
-
} else {
|
|
16992
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
16993
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
16994
|
-
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
16995
|
-
if (img) img.alt = displayAlt;
|
|
16996
|
-
});
|
|
16997
|
-
}
|
|
16998
|
-
}
|
|
16999
|
-
if (href !== void 0) {
|
|
17000
|
-
applyLogoHref(href);
|
|
17001
|
-
applyLinkByKey("nav-logo-href", href);
|
|
17002
|
-
applyLinkByKey("footer-logo-href", href);
|
|
17003
|
-
applyLinkByKey("logo-href", href);
|
|
17004
|
-
}
|
|
17005
|
-
const nodes = [
|
|
17006
|
-
...LOGO_TEXT_KEYS.map((key) => ({ key, text: display })),
|
|
17007
|
-
{ key: LOGO_PLACEHOLDER_KEY, text: isPlaceholder ? "true" : "false" },
|
|
17008
|
-
{ key: LOGO_ALT_KEY, text: displayAlt }
|
|
17009
|
-
];
|
|
17010
|
-
if (imageUrl !== void 0) {
|
|
17011
|
-
if (imageUrl) {
|
|
17012
|
-
for (const key of LOGO_IMAGE_KEYS) nodes.push({ key, text: imageUrl });
|
|
17013
|
-
} else {
|
|
17014
|
-
for (const key of LOGO_IMAGE_KEYS) nodes.push({ key, text: "" });
|
|
17015
|
-
}
|
|
17016
|
-
}
|
|
17017
|
-
if (href !== void 0) {
|
|
17018
|
-
for (const key of LOGO_HREF_KEYS) nodes.push({ key, text: href.trim() || "/" });
|
|
17019
|
-
}
|
|
17020
|
-
editContentRef.current = {
|
|
17021
|
-
...editContentRef.current,
|
|
17022
|
-
...Object.fromEntries(nodes.map(({ key, text }) => [key, text]))
|
|
17023
|
-
};
|
|
17024
|
-
applyLogoSizes(editContentRef.current);
|
|
17025
|
-
postToParentRef.current({ type: "ow:change", nodes });
|
|
17026
|
-
};
|
|
17027
15204
|
window.addEventListener("message", handleHydrate);
|
|
17028
15205
|
const postAiSectionsChanged = () => {
|
|
17029
15206
|
postToParentRef.current({
|
|
@@ -17088,12 +15265,6 @@ function OhhwellsBridge() {
|
|
|
17088
15265
|
closeLinkPopoverRef.current();
|
|
17089
15266
|
return;
|
|
17090
15267
|
}
|
|
17091
|
-
if (floatingPanelOpenRef.current) {
|
|
17092
|
-
setFloatingPanelRef.current(null);
|
|
17093
|
-
deselectRef.current();
|
|
17094
|
-
deactivateRef.current();
|
|
17095
|
-
return;
|
|
17096
|
-
}
|
|
17097
15268
|
deselectRef.current();
|
|
17098
15269
|
deactivateRef.current();
|
|
17099
15270
|
};
|
|
@@ -17113,10 +15284,6 @@ function OhhwellsBridge() {
|
|
|
17113
15284
|
closeLinkPopoverRef.current();
|
|
17114
15285
|
return;
|
|
17115
15286
|
}
|
|
17116
|
-
if (floatingPanelOpenRef.current) {
|
|
17117
|
-
closeFloatingPanelOnlyRef.current();
|
|
17118
|
-
return;
|
|
17119
|
-
}
|
|
17120
15287
|
if (activeElRef.current) {
|
|
17121
15288
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
17122
15289
|
const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
|
|
@@ -17147,10 +15314,6 @@ function OhhwellsBridge() {
|
|
|
17147
15314
|
return;
|
|
17148
15315
|
}
|
|
17149
15316
|
if (selectedElRef.current) {
|
|
17150
|
-
if (toolbarVariantRef.current === "logo") {
|
|
17151
|
-
deselectRef.current();
|
|
17152
|
-
return;
|
|
17153
|
-
}
|
|
17154
15317
|
if (toolbarVariantRef.current === "select-frame") {
|
|
17155
15318
|
const parent2 = getNavigationSelectionParent(selectedElRef.current);
|
|
17156
15319
|
if (parent2 && isNavigationContainer(parent2) && isFooterLinksContainer(parent2) && !isFooterLinksContainer(selectedElRef.current)) {
|
|
@@ -17184,16 +15347,7 @@ function OhhwellsBridge() {
|
|
|
17184
15347
|
closeLinkPopoverRef.current();
|
|
17185
15348
|
return;
|
|
17186
15349
|
}
|
|
17187
|
-
if (e.key === "Escape" && floatingPanelOpenRef.current) {
|
|
17188
|
-
e.preventDefault();
|
|
17189
|
-
closeFloatingPanelOnlyRef.current();
|
|
17190
|
-
return;
|
|
17191
|
-
}
|
|
17192
15350
|
if (e.key === "Escape" && selectedElRef.current && !activeElRef.current) {
|
|
17193
|
-
if (toolbarVariantRef.current === "logo") {
|
|
17194
|
-
deselectRef.current();
|
|
17195
|
-
return;
|
|
17196
|
-
}
|
|
17197
15351
|
if (toolbarVariantRef.current === "select-frame") {
|
|
17198
15352
|
const parent2 = getNavigationSelectionParent(selectedElRef.current);
|
|
17199
15353
|
if (parent2 && isNavigationContainer(parent2) && isFooterLinksContainer(parent2) && !isFooterLinksContainer(selectedElRef.current)) {
|
|
@@ -17271,8 +15425,7 @@ function OhhwellsBridge() {
|
|
|
17271
15425
|
const handleScroll = () => {
|
|
17272
15426
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
17273
15427
|
if (focusEl) {
|
|
17274
|
-
const
|
|
17275
|
-
const r2 = measureEl ? measureEl.getBoundingClientRect() : toolbarVariantRef.current === "logo" ? getLogoInteractionRect(focusEl) : focusEl.getBoundingClientRect();
|
|
15428
|
+
const r2 = activeElRef.current ? getEditMeasureEl(activeElRef.current).getBoundingClientRect() : focusEl.getBoundingClientRect();
|
|
17276
15429
|
applyToolbarPos(r2);
|
|
17277
15430
|
setToolbarRect(r2);
|
|
17278
15431
|
setMaxBadge((prev) => prev && activeElRef.current ? { ...prev, rect: r2 } : prev);
|
|
@@ -17282,9 +15435,7 @@ function OhhwellsBridge() {
|
|
|
17282
15435
|
setToggleState((prev) => prev ? { ...prev, rect } : null);
|
|
17283
15436
|
}
|
|
17284
15437
|
if (hoveredItemElRef.current) {
|
|
17285
|
-
|
|
17286
|
-
const logo = getLogoElement(hoverEl);
|
|
17287
|
-
setHoveredItemRect(logo ? getLogoInteractionRect(logo) : hoverEl.getBoundingClientRect());
|
|
15438
|
+
setHoveredItemRect(hoveredItemElRef.current.getBoundingClientRect());
|
|
17288
15439
|
}
|
|
17289
15440
|
if (hoveredNavContainerRef.current) {
|
|
17290
15441
|
setHoveredNavContainerRect(hoveredNavContainerRef.current.getBoundingClientRect());
|
|
@@ -17304,7 +15455,7 @@ function OhhwellsBridge() {
|
|
|
17304
15455
|
}
|
|
17305
15456
|
if (footerDragRef.current) {
|
|
17306
15457
|
const session = footerDragRef.current;
|
|
17307
|
-
const slot = session.kind === "
|
|
15458
|
+
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
17308
15459
|
refreshFooterDragVisualsRef.current(session, slot, session.lastClientX, session.lastClientY);
|
|
17309
15460
|
}
|
|
17310
15461
|
if (navDragRef.current) {
|
|
@@ -17338,12 +15489,8 @@ function OhhwellsBridge() {
|
|
|
17338
15489
|
if (inserted) {
|
|
17339
15490
|
const tracker = getSectionsTracker();
|
|
17340
15491
|
postToParentRef.current({ type: "ow:change", nodes: [{ key: "__ohw_sections", text: tracker.textContent ?? "[]" }] });
|
|
17341
|
-
const
|
|
17342
|
-
|
|
17343
|
-
if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
|
|
17344
|
-
};
|
|
17345
|
-
reportHeight();
|
|
17346
|
-
setTimeout(reportHeight, 500);
|
|
15492
|
+
const h = document.documentElement.scrollHeight;
|
|
15493
|
+
if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
|
|
17347
15494
|
}
|
|
17348
15495
|
};
|
|
17349
15496
|
const handleSwitchSchedule = (e) => {
|
|
@@ -17536,17 +15683,13 @@ function OhhwellsBridge() {
|
|
|
17536
15683
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
17537
15684
|
const { iframeOffsetTop, headerH, canvasH } = e.data;
|
|
17538
15685
|
parentScrollRef.current = { iframeOffsetTop, headerH, canvasH };
|
|
17539
|
-
if (floatingPanelOpenRef.current) {
|
|
17540
|
-
setParentScrollSnap({ iframeOffsetTop, headerH, canvasH });
|
|
17541
|
-
}
|
|
17542
15686
|
if (visibleViewportRef.current) {
|
|
17543
15687
|
applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
|
|
17544
15688
|
}
|
|
17545
15689
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
17546
15690
|
if (focusEl) {
|
|
17547
|
-
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) :
|
|
17548
|
-
|
|
17549
|
-
applyToolbarPos(r2);
|
|
15691
|
+
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : focusEl;
|
|
15692
|
+
applyToolbarPos(measureEl.getBoundingClientRect());
|
|
17550
15693
|
}
|
|
17551
15694
|
};
|
|
17552
15695
|
const handleClickAt = (e) => {
|
|
@@ -17571,25 +15714,6 @@ function OhhwellsBridge() {
|
|
|
17571
15714
|
postToParentRef.current({ type: "ow:image-pick", key: stateCardImage.dataset.ohwKey ?? "", elementType: stateCardImage.dataset.ohwEditable ?? "image" });
|
|
17572
15715
|
return;
|
|
17573
15716
|
}
|
|
17574
|
-
const logoAtPoint = Array.from(
|
|
17575
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]')
|
|
17576
|
-
).map((el) => getLogoElement(el)).find((logo) => {
|
|
17577
|
-
if (!logo) return false;
|
|
17578
|
-
const r2 = logo.getBoundingClientRect();
|
|
17579
|
-
return clientX >= r2.left && clientX <= r2.right && clientY >= r2.top && clientY <= r2.bottom;
|
|
17580
|
-
});
|
|
17581
|
-
if (logoAtPoint) {
|
|
17582
|
-
if (!logoHasUploadedImage(logoAtPoint)) {
|
|
17583
|
-
deselectRef.current();
|
|
17584
|
-
deactivateRef.current();
|
|
17585
|
-
const identity = readLogoIdentityFromDom();
|
|
17586
|
-
postToParentRef.current({ type: "ow:open-logo-settings", ...identity });
|
|
17587
|
-
return;
|
|
17588
|
-
}
|
|
17589
|
-
selectLogoRef.current(logoAtPoint);
|
|
17590
|
-
openLogoSizePanelRef.current(logoAtPoint);
|
|
17591
|
-
return;
|
|
17592
|
-
}
|
|
17593
15717
|
const textEditable = Array.from(
|
|
17594
15718
|
document.querySelectorAll(NON_MEDIA_SELECTOR)
|
|
17595
15719
|
).find((el) => {
|
|
@@ -17651,9 +15775,6 @@ function OhhwellsBridge() {
|
|
|
17651
15775
|
window.addEventListener("message", handleClearSchedulingWidget);
|
|
17652
15776
|
window.addEventListener("message", handleRemoveSchedulingSection);
|
|
17653
15777
|
window.addEventListener("message", handleCollectSection);
|
|
17654
|
-
window.addEventListener("message", handleSocialCancel);
|
|
17655
|
-
window.addEventListener("message", handleSocialUpdate);
|
|
17656
|
-
window.addEventListener("message", handleIconMarkup);
|
|
17657
15778
|
window.addEventListener("message", handleImageUrl);
|
|
17658
15779
|
window.addEventListener("message", handleImageUploading);
|
|
17659
15780
|
window.addEventListener("message", handleCarouselChange);
|
|
@@ -17661,14 +15782,6 @@ function OhhwellsBridge() {
|
|
|
17661
15782
|
window.addEventListener("message", handleParentScroll);
|
|
17662
15783
|
window.addEventListener("message", handlePointerSync);
|
|
17663
15784
|
window.addEventListener("message", handleClickAt);
|
|
17664
|
-
window.addEventListener("message", handleUpdateLogoIdentity);
|
|
17665
|
-
const handleViewMode = (e) => {
|
|
17666
|
-
if (e.data?.type !== "ow:view-mode") return;
|
|
17667
|
-
const mode = e.data.mode === "Mobile" || e.data.mode === "mobile" ? "mobile" : "desktop";
|
|
17668
|
-
setEditorViewport(mode);
|
|
17669
|
-
applyLogoSizes(editContentRef.current);
|
|
17670
|
-
};
|
|
17671
|
-
window.addEventListener("message", handleViewMode);
|
|
17672
15785
|
const handleViewportResize = () => {
|
|
17673
15786
|
if (visibleViewportRef.current) {
|
|
17674
15787
|
applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
|
|
@@ -17713,9 +15826,6 @@ function OhhwellsBridge() {
|
|
|
17713
15826
|
window.removeEventListener("message", handleClearSchedulingWidget);
|
|
17714
15827
|
window.removeEventListener("message", handleRemoveSchedulingSection);
|
|
17715
15828
|
window.removeEventListener("message", handleCollectSection);
|
|
17716
|
-
window.removeEventListener("message", handleSocialCancel);
|
|
17717
|
-
window.removeEventListener("message", handleSocialUpdate);
|
|
17718
|
-
window.removeEventListener("message", handleIconMarkup);
|
|
17719
15829
|
window.removeEventListener("message", handleImageUrl);
|
|
17720
15830
|
window.removeEventListener("message", handleImageUploading);
|
|
17721
15831
|
window.removeEventListener("message", handleCarouselChange);
|
|
@@ -17724,8 +15834,6 @@ function OhhwellsBridge() {
|
|
|
17724
15834
|
window.removeEventListener("resize", handleViewportResize);
|
|
17725
15835
|
window.removeEventListener("message", handlePointerSync);
|
|
17726
15836
|
window.removeEventListener("message", handleClickAt);
|
|
17727
|
-
window.removeEventListener("message", handleUpdateLogoIdentity);
|
|
17728
|
-
window.removeEventListener("message", handleViewMode);
|
|
17729
15837
|
window.removeEventListener("message", handleHydrate);
|
|
17730
15838
|
window.removeEventListener("message", handleAiApplyTree);
|
|
17731
15839
|
window.removeEventListener("message", handleAiDeleteSection);
|
|
@@ -17739,7 +15847,7 @@ function OhhwellsBridge() {
|
|
|
17739
15847
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
17740
15848
|
};
|
|
17741
15849
|
}, [isEditMode, refreshStateRules]);
|
|
17742
|
-
|
|
15850
|
+
useEffect11(() => {
|
|
17743
15851
|
if (!isEditMode) return;
|
|
17744
15852
|
const THRESHOLD = 10;
|
|
17745
15853
|
const resolveWasSelected = (el) => {
|
|
@@ -17794,7 +15902,7 @@ function OhhwellsBridge() {
|
|
|
17794
15902
|
clearTextSelection();
|
|
17795
15903
|
const session = footerDragRef.current;
|
|
17796
15904
|
if (!session) return;
|
|
17797
|
-
const slot = session.kind === "
|
|
15905
|
+
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, session.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
17798
15906
|
refreshFooterDragVisualsRef.current(session, slot, e.clientX, e.clientY);
|
|
17799
15907
|
return;
|
|
17800
15908
|
}
|
|
@@ -17893,7 +16001,7 @@ function OhhwellsBridge() {
|
|
|
17893
16001
|
unlockFooterDragInteraction();
|
|
17894
16002
|
};
|
|
17895
16003
|
}, [isEditMode]);
|
|
17896
|
-
|
|
16004
|
+
useEffect11(() => {
|
|
17897
16005
|
const handler = (e) => {
|
|
17898
16006
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
17899
16007
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -17909,7 +16017,7 @@ function OhhwellsBridge() {
|
|
|
17909
16017
|
window.addEventListener("message", handler);
|
|
17910
16018
|
return () => window.removeEventListener("message", handler);
|
|
17911
16019
|
}, [processConfigRequest]);
|
|
17912
|
-
|
|
16020
|
+
useEffect11(() => {
|
|
17913
16021
|
if (!isEditMode) return;
|
|
17914
16022
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
17915
16023
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -17945,13 +16053,13 @@ function OhhwellsBridge() {
|
|
|
17945
16053
|
clearTimeout(timer);
|
|
17946
16054
|
};
|
|
17947
16055
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
17948
|
-
|
|
16056
|
+
useEffect11(() => {
|
|
17949
16057
|
scrollToHashSectionWhenReady();
|
|
17950
16058
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
17951
16059
|
window.addEventListener("hashchange", onHashChange);
|
|
17952
16060
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
17953
16061
|
}, [pathname]);
|
|
17954
|
-
const handleCommand =
|
|
16062
|
+
const handleCommand = useCallback6((cmd) => {
|
|
17955
16063
|
const el = activeElRef.current;
|
|
17956
16064
|
const selBefore = window.getSelection();
|
|
17957
16065
|
let savedOffsets = null;
|
|
@@ -17987,7 +16095,7 @@ function OhhwellsBridge() {
|
|
|
17987
16095
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
17988
16096
|
refreshActiveCommandsRef.current();
|
|
17989
16097
|
}, []);
|
|
17990
|
-
const handleStateChange =
|
|
16098
|
+
const handleStateChange = useCallback6((state) => {
|
|
17991
16099
|
if (!activeStateElRef.current) return;
|
|
17992
16100
|
const el = activeStateElRef.current;
|
|
17993
16101
|
if (state === "Default") {
|
|
@@ -18000,7 +16108,7 @@ function OhhwellsBridge() {
|
|
|
18000
16108
|
}
|
|
18001
16109
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
18002
16110
|
}, [deactivate]);
|
|
18003
|
-
const reselectAfterLinkPopover =
|
|
16111
|
+
const reselectAfterLinkPopover = useCallback6(
|
|
18004
16112
|
(hrefKey) => {
|
|
18005
16113
|
requestAnimationFrame(() => {
|
|
18006
16114
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -18009,7 +16117,7 @@ function OhhwellsBridge() {
|
|
|
18009
16117
|
},
|
|
18010
16118
|
[resolveHrefKeyElement]
|
|
18011
16119
|
);
|
|
18012
|
-
const closeLinkPopover =
|
|
16120
|
+
const closeLinkPopover = useCallback6(() => {
|
|
18013
16121
|
const session = linkPopoverSessionRef.current;
|
|
18014
16122
|
addNavAfterAnchorRef.current = null;
|
|
18015
16123
|
setLinkPopover(null);
|
|
@@ -18017,9 +16125,9 @@ function OhhwellsBridge() {
|
|
|
18017
16125
|
reselectAfterLinkPopover(session.key);
|
|
18018
16126
|
}
|
|
18019
16127
|
}, [reselectAfterLinkPopover]);
|
|
18020
|
-
const closeLinkPopoverRef =
|
|
16128
|
+
const closeLinkPopoverRef = useRef8(closeLinkPopover);
|
|
18021
16129
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
18022
|
-
const openLinkPopoverForActive =
|
|
16130
|
+
const openLinkPopoverForActive = useCallback6(() => {
|
|
18023
16131
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
18024
16132
|
if (!hrefCtx) return;
|
|
18025
16133
|
bumpLinkPopoverGrace();
|
|
@@ -18030,15 +16138,11 @@ function OhhwellsBridge() {
|
|
|
18030
16138
|
});
|
|
18031
16139
|
deactivate();
|
|
18032
16140
|
}, [deactivate]);
|
|
18033
|
-
const openLinkPopoverForSelected =
|
|
16141
|
+
const openLinkPopoverForSelected = useCallback6(() => {
|
|
18034
16142
|
const anchor = selectedElRef.current;
|
|
18035
16143
|
if (!anchor) return;
|
|
18036
16144
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
18037
16145
|
if (!key) return;
|
|
18038
|
-
if (requestSocialDialog(anchor, postToParentRef.current, editContentRef.current)) {
|
|
18039
|
-
deselect();
|
|
18040
|
-
return;
|
|
18041
|
-
}
|
|
18042
16146
|
bumpLinkPopoverGrace();
|
|
18043
16147
|
setLinkPopover({
|
|
18044
16148
|
key,
|
|
@@ -18047,7 +16151,7 @@ function OhhwellsBridge() {
|
|
|
18047
16151
|
});
|
|
18048
16152
|
deselect();
|
|
18049
16153
|
}, [deselect]);
|
|
18050
|
-
const handleSelectParent =
|
|
16154
|
+
const handleSelectParent = useCallback6(() => {
|
|
18051
16155
|
const selected = selectedElRef.current;
|
|
18052
16156
|
if (!selected) return;
|
|
18053
16157
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -18074,37 +16178,11 @@ function OhhwellsBridge() {
|
|
|
18074
16178
|
}
|
|
18075
16179
|
deselectRef.current();
|
|
18076
16180
|
}, []);
|
|
18077
|
-
const handleDuplicateSelected =
|
|
16181
|
+
const handleDuplicateSelected = useCallback6(() => {
|
|
18078
16182
|
const selected = selectedElRef.current;
|
|
18079
16183
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
18080
16184
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
18081
16185
|
if (!hrefKey) return;
|
|
18082
|
-
const social = getSocialItem(selected);
|
|
18083
|
-
if (social) {
|
|
18084
|
-
const result = duplicateSocialItem(social, editContentRef.current);
|
|
18085
|
-
if (!result) return;
|
|
18086
|
-
const orderJson = JSON.stringify(result.order);
|
|
18087
|
-
const carried = [
|
|
18088
|
-
{ from: result.copiedFrom?.href, to: result.hrefKey },
|
|
18089
|
-
{ from: result.copiedFrom?.icon, to: result.iconKey },
|
|
18090
|
-
{ from: result.copiedFrom?.icon ? socialPlatformKey(result.copiedFrom.icon) : null, to: socialPlatformKey(result.iconKey) }
|
|
18091
|
-
];
|
|
18092
|
-
const nodes = [{ key: SOCIALS_ORDER_KEY, text: orderJson }];
|
|
18093
|
-
for (const { from, to } of carried) {
|
|
18094
|
-
const value = from ? editContentRef.current[from] : void 0;
|
|
18095
|
-
if (value) nodes.push({ key: to, text: value });
|
|
18096
|
-
}
|
|
18097
|
-
editContentRef.current = {
|
|
18098
|
-
...editContentRef.current,
|
|
18099
|
-
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
18100
|
-
};
|
|
18101
|
-
postToParent2({ type: "ow:change", nodes });
|
|
18102
|
-
enforceLinkHrefs();
|
|
18103
|
-
const copyRow = findSocialsRow(result.item);
|
|
18104
|
-
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
18105
|
-
requestAnimationFrame(() => selectRef.current(result.item));
|
|
18106
|
-
return;
|
|
18107
|
-
}
|
|
18108
16186
|
if (isNavbarHrefKey(hrefKey)) {
|
|
18109
16187
|
const result = duplicateNavbarItem(selected);
|
|
18110
16188
|
if (!result) return;
|
|
@@ -18190,7 +16268,7 @@ function OhhwellsBridge() {
|
|
|
18190
16268
|
});
|
|
18191
16269
|
}
|
|
18192
16270
|
}, [postToParent2]);
|
|
18193
|
-
const runPendingDeleteUndo =
|
|
16271
|
+
const runPendingDeleteUndo = useCallback6(() => {
|
|
18194
16272
|
const pending = pendingDeleteUndoRef.current;
|
|
18195
16273
|
if (!pending) return false;
|
|
18196
16274
|
pendingDeleteUndoRef.current = null;
|
|
@@ -18198,7 +16276,7 @@ function OhhwellsBridge() {
|
|
|
18198
16276
|
enforceLinkHrefs();
|
|
18199
16277
|
return true;
|
|
18200
16278
|
}, []);
|
|
18201
|
-
const handleDeleteSelected =
|
|
16279
|
+
const handleDeleteSelected = useCallback6(() => {
|
|
18202
16280
|
const selected = selectedElRef.current;
|
|
18203
16281
|
if (!selected) return false;
|
|
18204
16282
|
return deleteSelectedNavFooterItem({
|
|
@@ -18219,7 +16297,7 @@ function OhhwellsBridge() {
|
|
|
18219
16297
|
}, [postToParent2]);
|
|
18220
16298
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
18221
16299
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
18222
|
-
const handleLinkPopoverSubmit =
|
|
16300
|
+
const handleLinkPopoverSubmit = useCallback6(
|
|
18223
16301
|
(target) => {
|
|
18224
16302
|
const session = linkPopoverSessionRef.current;
|
|
18225
16303
|
if (!session) return;
|
|
@@ -18285,19 +16363,19 @@ function OhhwellsBridge() {
|
|
|
18285
16363
|
const showEditLink = toolbarShowEditLink;
|
|
18286
16364
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
18287
16365
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
18288
|
-
const handleMediaReplace =
|
|
16366
|
+
const handleMediaReplace = useCallback6(
|
|
18289
16367
|
(key) => {
|
|
18290
16368
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
18291
16369
|
},
|
|
18292
16370
|
[postToParent2, mediaHover?.elementType]
|
|
18293
16371
|
);
|
|
18294
|
-
const handleEditCarousel =
|
|
16372
|
+
const handleEditCarousel = useCallback6(
|
|
18295
16373
|
(key) => {
|
|
18296
16374
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
18297
16375
|
},
|
|
18298
16376
|
[postToParent2]
|
|
18299
16377
|
);
|
|
18300
|
-
const handleMediaFadeOutComplete =
|
|
16378
|
+
const handleMediaFadeOutComplete = useCallback6((key) => {
|
|
18301
16379
|
setUploadingRects((prev) => {
|
|
18302
16380
|
if (!(key in prev)) return prev;
|
|
18303
16381
|
const next = { ...prev };
|
|
@@ -18305,7 +16383,7 @@ function OhhwellsBridge() {
|
|
|
18305
16383
|
return next;
|
|
18306
16384
|
});
|
|
18307
16385
|
}, []);
|
|
18308
|
-
const handleVideoSettingsChange =
|
|
16386
|
+
const handleVideoSettingsChange = useCallback6(
|
|
18309
16387
|
(key, settings) => {
|
|
18310
16388
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
18311
16389
|
const video = getVideoEl2(el);
|
|
@@ -18328,10 +16406,10 @@ function OhhwellsBridge() {
|
|
|
18328
16406
|
[postToParent2]
|
|
18329
16407
|
);
|
|
18330
16408
|
return bridgeRoot ? createPortal2(
|
|
18331
|
-
/* @__PURE__ */
|
|
18332
|
-
/* @__PURE__ */
|
|
18333
|
-
isEditMode && /* @__PURE__ */
|
|
18334
|
-
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */
|
|
16409
|
+
/* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
16410
|
+
/* @__PURE__ */ jsx30("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
16411
|
+
isEditMode && /* @__PURE__ */ jsx30(AiSectionOverlay, { postToParent: postToParent2, apiRef: aiSectionApiRef }),
|
|
16412
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ jsx30(
|
|
18335
16413
|
MediaOverlay,
|
|
18336
16414
|
{
|
|
18337
16415
|
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
@@ -18342,7 +16420,7 @@ function OhhwellsBridge() {
|
|
|
18342
16420
|
},
|
|
18343
16421
|
`uploading-${key}`
|
|
18344
16422
|
)),
|
|
18345
|
-
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */
|
|
16423
|
+
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ jsx30(
|
|
18346
16424
|
MediaOverlay,
|
|
18347
16425
|
{
|
|
18348
16426
|
hover: mediaHover,
|
|
@@ -18351,11 +16429,11 @@ function OhhwellsBridge() {
|
|
|
18351
16429
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
18352
16430
|
}
|
|
18353
16431
|
),
|
|
18354
|
-
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */
|
|
18355
|
-
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */
|
|
18356
|
-
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */
|
|
18357
|
-
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */
|
|
18358
|
-
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */
|
|
16432
|
+
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx30(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
|
|
16433
|
+
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ jsx30(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
16434
|
+
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ jsx30(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
|
|
16435
|
+
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ jsx30(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
|
|
16436
|
+
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ jsx30(
|
|
18359
16437
|
"div",
|
|
18360
16438
|
{
|
|
18361
16439
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -18365,7 +16443,7 @@ function OhhwellsBridge() {
|
|
|
18365
16443
|
width: slot.width,
|
|
18366
16444
|
height: slot.height
|
|
18367
16445
|
},
|
|
18368
|
-
children: /* @__PURE__ */
|
|
16446
|
+
children: /* @__PURE__ */ jsx30(
|
|
18369
16447
|
DropIndicator,
|
|
18370
16448
|
{
|
|
18371
16449
|
direction: slot.direction,
|
|
@@ -18376,7 +16454,7 @@ function OhhwellsBridge() {
|
|
|
18376
16454
|
},
|
|
18377
16455
|
`footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
|
|
18378
16456
|
)),
|
|
18379
|
-
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */
|
|
16457
|
+
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ jsx30(
|
|
18380
16458
|
"div",
|
|
18381
16459
|
{
|
|
18382
16460
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -18386,7 +16464,7 @@ function OhhwellsBridge() {
|
|
|
18386
16464
|
width: slot.width,
|
|
18387
16465
|
height: slot.height
|
|
18388
16466
|
},
|
|
18389
|
-
children: /* @__PURE__ */
|
|
16467
|
+
children: /* @__PURE__ */ jsx30(
|
|
18390
16468
|
DropIndicator,
|
|
18391
16469
|
{
|
|
18392
16470
|
direction: slot.direction,
|
|
@@ -18397,10 +16475,10 @@ function OhhwellsBridge() {
|
|
|
18397
16475
|
},
|
|
18398
16476
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
18399
16477
|
)),
|
|
18400
|
-
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */
|
|
18401
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */
|
|
18402
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */
|
|
18403
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */
|
|
16478
|
+
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx30(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
16479
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ jsx30(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
16480
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ jsx30(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
16481
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ jsx30(
|
|
18404
16482
|
FooterContainerChrome,
|
|
18405
16483
|
{
|
|
18406
16484
|
rect: toolbarRect,
|
|
@@ -18408,7 +16486,7 @@ function OhhwellsBridge() {
|
|
|
18408
16486
|
addDisabled: !canAddFooterColumn()
|
|
18409
16487
|
}
|
|
18410
16488
|
),
|
|
18411
|
-
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame"
|
|
16489
|
+
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ jsx30(
|
|
18412
16490
|
ItemInteractionLayer,
|
|
18413
16491
|
{
|
|
18414
16492
|
rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
|
|
@@ -18420,21 +16498,13 @@ function OhhwellsBridge() {
|
|
|
18420
16498
|
dragHandleLabel: reorderHrefKey ? `Reorder ${reorderHrefKey}` : "Reorder item",
|
|
18421
16499
|
onDragHandleDragStart: handleItemDragStart,
|
|
18422
16500
|
onDragHandleDragEnd: handleItemDragEnd,
|
|
18423
|
-
onItemPointerDown:
|
|
18424
|
-
onItemClick:
|
|
18425
|
-
itemDragSurface:
|
|
18426
|
-
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" &&
|
|
16501
|
+
onItemPointerDown: handleItemChromePointerDown,
|
|
16502
|
+
onItemClick: handleItemChromeClick,
|
|
16503
|
+
itemDragSurface: !isFooterFrameSelection,
|
|
16504
|
+
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && isFooterFrameSelection && !isItemDragging ? /* @__PURE__ */ jsx30(
|
|
18427
16505
|
ItemActionToolbar,
|
|
18428
16506
|
{
|
|
18429
16507
|
onEditLink: openLinkPopoverForSelected,
|
|
18430
|
-
onStyle: () => {
|
|
18431
|
-
const row = selectedElRef.current;
|
|
18432
|
-
if (!row) return;
|
|
18433
|
-
if (floatingPanel?.kind === "socials-display") closeFloatingPanelOnly();
|
|
18434
|
-
else openSocialsDisplayPanel(row);
|
|
18435
|
-
},
|
|
18436
|
-
showStyle: selectedIsSocialsRow,
|
|
18437
|
-
styleActive: floatingPanel?.kind === "socials-display",
|
|
18438
16508
|
onAddItem: handleAddChildItem,
|
|
18439
16509
|
onSelectParent: handleSelectParent,
|
|
18440
16510
|
onDuplicate: handleDuplicateSelected,
|
|
@@ -18442,12 +16512,12 @@ function OhhwellsBridge() {
|
|
|
18442
16512
|
addItemDisabled: false,
|
|
18443
16513
|
editLinkDisabled: false,
|
|
18444
16514
|
moreDisabled: false,
|
|
18445
|
-
duplicateDisabled: isFooterFrameSelection
|
|
18446
|
-
showEditLink: !isFooterFrameSelection &&
|
|
18447
|
-
showAddItem: isFooterFrameSelection ||
|
|
16515
|
+
duplicateDisabled: isFooterFrameSelection,
|
|
16516
|
+
showEditLink: !isFooterFrameSelection && navDropdownPreviewOpen === null,
|
|
16517
|
+
showAddItem: isFooterFrameSelection || !selectedIsCta && Boolean(
|
|
18448
16518
|
selectedElRef.current && isNavbarHrefKey(selectedElRef.current.getAttribute("data-ohw-href-key")) && !isNestedNavChild(selectedElRef.current)
|
|
18449
16519
|
),
|
|
18450
|
-
showMore:
|
|
16520
|
+
showMore: !selectedIsCta || isFooterFrameSelection,
|
|
18451
16521
|
dropdownOpen: navDropdownPreviewOpen,
|
|
18452
16522
|
onDropdownOpenChange: handleNavDropdownOpenChange,
|
|
18453
16523
|
headingVisible: footerHeadingVisible,
|
|
@@ -18456,8 +16526,8 @@ function OhhwellsBridge() {
|
|
|
18456
16526
|
) : void 0
|
|
18457
16527
|
}
|
|
18458
16528
|
),
|
|
18459
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */
|
|
18460
|
-
/* @__PURE__ */
|
|
16529
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
16530
|
+
/* @__PURE__ */ jsx30(
|
|
18461
16531
|
EditGlowChrome,
|
|
18462
16532
|
{
|
|
18463
16533
|
rect: toolbarRect,
|
|
@@ -18467,7 +16537,7 @@ function OhhwellsBridge() {
|
|
|
18467
16537
|
hideHandle: isItemDragging
|
|
18468
16538
|
}
|
|
18469
16539
|
),
|
|
18470
|
-
/* @__PURE__ */
|
|
16540
|
+
/* @__PURE__ */ jsx30(
|
|
18471
16541
|
FloatingToolbar,
|
|
18472
16542
|
{
|
|
18473
16543
|
rect: toolbarRect,
|
|
@@ -18480,7 +16550,7 @@ function OhhwellsBridge() {
|
|
|
18480
16550
|
}
|
|
18481
16551
|
)
|
|
18482
16552
|
] }),
|
|
18483
|
-
maxBadge && /* @__PURE__ */
|
|
16553
|
+
maxBadge && /* @__PURE__ */ jsxs17(
|
|
18484
16554
|
"div",
|
|
18485
16555
|
{
|
|
18486
16556
|
"data-ohw-max-badge": "",
|
|
@@ -18506,7 +16576,7 @@ function OhhwellsBridge() {
|
|
|
18506
16576
|
]
|
|
18507
16577
|
}
|
|
18508
16578
|
),
|
|
18509
|
-
toggleState && !linkPopover && /* @__PURE__ */
|
|
16579
|
+
toggleState && !linkPopover && /* @__PURE__ */ jsx30(
|
|
18510
16580
|
StateToggle,
|
|
18511
16581
|
{
|
|
18512
16582
|
rect: toggleState.rect,
|
|
@@ -18515,15 +16585,15 @@ function OhhwellsBridge() {
|
|
|
18515
16585
|
onStateChange: handleStateChange
|
|
18516
16586
|
}
|
|
18517
16587
|
),
|
|
18518
|
-
sectionGap && !linkPopover && /* @__PURE__ */
|
|
16588
|
+
sectionGap && !linkPopover && /* @__PURE__ */ jsxs17(
|
|
18519
16589
|
"div",
|
|
18520
16590
|
{
|
|
18521
16591
|
"data-ohw-section-insert-line": "",
|
|
18522
16592
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
18523
16593
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
18524
16594
|
children: [
|
|
18525
|
-
/* @__PURE__ */
|
|
18526
|
-
/* @__PURE__ */
|
|
16595
|
+
/* @__PURE__ */ jsx30("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
16596
|
+
/* @__PURE__ */ jsx30(
|
|
18527
16597
|
Badge,
|
|
18528
16598
|
{
|
|
18529
16599
|
className: "px-8 py-1 bg-primary hover:bg-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
|
|
@@ -18540,11 +16610,11 @@ function OhhwellsBridge() {
|
|
|
18540
16610
|
children: "Add Section"
|
|
18541
16611
|
}
|
|
18542
16612
|
),
|
|
18543
|
-
/* @__PURE__ */
|
|
16613
|
+
/* @__PURE__ */ jsx30("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
18544
16614
|
]
|
|
18545
16615
|
}
|
|
18546
16616
|
),
|
|
18547
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */
|
|
16617
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ jsx30(
|
|
18548
16618
|
LinkPopover,
|
|
18549
16619
|
{
|
|
18550
16620
|
panelRef: linkPopoverPanelRef,
|
|
@@ -18560,137 +16630,11 @@ function OhhwellsBridge() {
|
|
|
18560
16630
|
onSubmit: handleLinkPopoverSubmit
|
|
18561
16631
|
},
|
|
18562
16632
|
linkPopover.key
|
|
18563
|
-
) : null,
|
|
18564
|
-
floatingPanel && floatingPanel.kind === "socials-display" ? /* @__PURE__ */ jsx33(
|
|
18565
|
-
FloatingPanel,
|
|
18566
|
-
{
|
|
18567
|
-
open: true,
|
|
18568
|
-
title: floatingPanel.title,
|
|
18569
|
-
context: floatingPanel.context,
|
|
18570
|
-
position: floatingPanelPos,
|
|
18571
|
-
onPositionChange: setFloatingPanelPos,
|
|
18572
|
-
parentScroll: parentScrollSnap ?? parentScrollRef.current,
|
|
18573
|
-
onClose: closeFloatingPanelOnly,
|
|
18574
|
-
children: /* @__PURE__ */ jsx33(
|
|
18575
|
-
SocialsDisplayPanel,
|
|
18576
|
-
{
|
|
18577
|
-
display: socialsDisplayFor(floatingPanel.row, editContentRef.current),
|
|
18578
|
-
onChange: (next) => {
|
|
18579
|
-
changeSocialsDisplay(floatingPanel.row, next);
|
|
18580
|
-
setFloatingPanel({ ...floatingPanel });
|
|
18581
|
-
}
|
|
18582
|
-
}
|
|
18583
|
-
)
|
|
18584
|
-
}
|
|
18585
|
-
) : null,
|
|
18586
|
-
floatingPanel && floatingPanel.kind === "logo-size" && logoSizeDraft ? /* @__PURE__ */ jsx33(
|
|
18587
|
-
FloatingPanel,
|
|
18588
|
-
{
|
|
18589
|
-
open: true,
|
|
18590
|
-
title: floatingPanel.title,
|
|
18591
|
-
context: floatingPanel.context,
|
|
18592
|
-
position: floatingPanelPos,
|
|
18593
|
-
onPositionChange: setFloatingPanelPos,
|
|
18594
|
-
parentScroll: parentScrollSnap ?? parentScrollRef.current,
|
|
18595
|
-
onClose: closeFloatingPanelAndDeselect,
|
|
18596
|
-
children: /* @__PURE__ */ jsx33(
|
|
18597
|
-
LogoSizePanel,
|
|
18598
|
-
{
|
|
18599
|
-
viewport: editorViewport,
|
|
18600
|
-
sizePx: editorViewport === "mobile" && !logoSizeDraft.mobileFollowing ? logoSizeDraft.mobilePx : logoSizeDraft.desktopPx,
|
|
18601
|
-
mobileFollowing: logoSizeDraft.mobileFollowing,
|
|
18602
|
-
onSizeChange: (px) => {
|
|
18603
|
-
const next = editorViewport === "mobile" ? { ...logoSizeDraft, mobilePx: px, mobileFollowing: false } : {
|
|
18604
|
-
...logoSizeDraft,
|
|
18605
|
-
desktopPx: px,
|
|
18606
|
-
mobilePx: logoSizeDraft.mobileFollowing ? px : logoSizeDraft.mobilePx
|
|
18607
|
-
};
|
|
18608
|
-
setLogoSizeDraft(next);
|
|
18609
|
-
persistLogoSizeDraft(floatingPanel.placement, next);
|
|
18610
|
-
},
|
|
18611
|
-
onCustomizeMobile: () => {
|
|
18612
|
-
const next = {
|
|
18613
|
-
...logoSizeDraft,
|
|
18614
|
-
mobileFollowing: false,
|
|
18615
|
-
mobilePx: logoSizeDraft.desktopPx
|
|
18616
|
-
};
|
|
18617
|
-
setLogoSizeDraft(next);
|
|
18618
|
-
persistLogoSizeDraft(floatingPanel.placement, next);
|
|
18619
|
-
},
|
|
18620
|
-
onResetMobile: () => {
|
|
18621
|
-
const next = {
|
|
18622
|
-
...logoSizeDraft,
|
|
18623
|
-
mobileFollowing: true,
|
|
18624
|
-
mobilePx: logoSizeDraft.desktopPx
|
|
18625
|
-
};
|
|
18626
|
-
setLogoSizeDraft(next);
|
|
18627
|
-
persistLogoSizeDraft(floatingPanel.placement, next);
|
|
18628
|
-
},
|
|
18629
|
-
onUpdateEverywhere: () => {
|
|
18630
|
-
const identity = readLogoIdentityFromDom();
|
|
18631
|
-
postToParent2({ type: "ow:open-logo-settings", ...identity });
|
|
18632
|
-
}
|
|
18633
|
-
}
|
|
18634
|
-
)
|
|
18635
|
-
}
|
|
18636
16633
|
) : null
|
|
18637
16634
|
] }),
|
|
18638
16635
|
bridgeRoot
|
|
18639
16636
|
) : null;
|
|
18640
16637
|
}
|
|
18641
|
-
|
|
18642
|
-
// src/ui/EmptySection.tsx
|
|
18643
|
-
import Link4 from "next/link";
|
|
18644
|
-
import { Fragment as Fragment9, jsx as jsx34, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
18645
|
-
function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey }) {
|
|
18646
|
-
return /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
18647
|
-
/* @__PURE__ */ jsx34(
|
|
18648
|
-
"p",
|
|
18649
|
-
{
|
|
18650
|
-
style: {
|
|
18651
|
-
fontFamily: "var(--brand-font-body)",
|
|
18652
|
-
fontSize: "0.75rem",
|
|
18653
|
-
fontWeight: 500,
|
|
18654
|
-
letterSpacing: "0.15em",
|
|
18655
|
-
textTransform: "uppercase",
|
|
18656
|
-
color: "var(--brand-accent)",
|
|
18657
|
-
marginBottom: "1.5rem"
|
|
18658
|
-
},
|
|
18659
|
-
children: /* @__PURE__ */ jsx34(Link4, { href: homeHref, style: { color: "inherit" }, children: /* @__PURE__ */ jsx34("span", { ...eyebrowKey ? { "data-ohw-editable": "text", "data-ohw-key": eyebrowKey } : {}, children: "Home" }) })
|
|
18660
|
-
}
|
|
18661
|
-
),
|
|
18662
|
-
/* @__PURE__ */ jsx34(
|
|
18663
|
-
"h1",
|
|
18664
|
-
{
|
|
18665
|
-
style: {
|
|
18666
|
-
fontFamily: "var(--brand-font-heading)",
|
|
18667
|
-
fontSize: "clamp(2rem, 3.5vw, 2.75rem)",
|
|
18668
|
-
lineHeight: 1.1,
|
|
18669
|
-
letterSpacing: "-0.025em",
|
|
18670
|
-
color: "var(--brand-text)",
|
|
18671
|
-
marginBottom: "1rem"
|
|
18672
|
-
},
|
|
18673
|
-
...titleKey ? { "data-ohw-editable": "text", "data-ohw-key": titleKey, "data-ohw-max-length": 80 } : {},
|
|
18674
|
-
children: title
|
|
18675
|
-
}
|
|
18676
|
-
),
|
|
18677
|
-
/* @__PURE__ */ jsx34(
|
|
18678
|
-
"p",
|
|
18679
|
-
{
|
|
18680
|
-
style: {
|
|
18681
|
-
fontFamily: "var(--brand-font-body)",
|
|
18682
|
-
fontSize: "1rem",
|
|
18683
|
-
lineHeight: 1.7,
|
|
18684
|
-
fontWeight: 300,
|
|
18685
|
-
color: "var(--brand-text-muted)",
|
|
18686
|
-
maxWidth: "340px"
|
|
18687
|
-
},
|
|
18688
|
-
...subtitleKey ? { "data-ohw-editable": "text", "data-ohw-key": subtitleKey, "data-ohw-max-length": 160 } : {},
|
|
18689
|
-
children: "This page doesn't have any content yet."
|
|
18690
|
-
}
|
|
18691
|
-
)
|
|
18692
|
-
] });
|
|
18693
|
-
}
|
|
18694
16638
|
export {
|
|
18695
16639
|
AI_DEFAULT_BRAND,
|
|
18696
16640
|
AI_TREE_SCHEMA_VERSIONS,
|
|
@@ -18707,7 +16651,6 @@ export {
|
|
|
18707
16651
|
DropdownMenuItem,
|
|
18708
16652
|
DropdownMenuSeparator,
|
|
18709
16653
|
DropdownMenuTrigger,
|
|
18710
|
-
EmptySection,
|
|
18711
16654
|
ItemActionToolbar,
|
|
18712
16655
|
ItemInteractionLayer,
|
|
18713
16656
|
LinkEditorPanel,
|