@ohhwells/bridge 0.1.54-next.153 → 0.1.54
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 +332 -2077
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -12
- package/dist/index.d.ts +2 -12
- package/dist/index.js +326 -2076
- package/dist/index.js.map +1 -1
- package/dist/styles.css +0 -87
- 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.cjs
CHANGED
|
@@ -46,7 +46,6 @@ __export(index_exports, {
|
|
|
46
46
|
DropdownMenuItem: () => DropdownMenuItem,
|
|
47
47
|
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
|
48
48
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
49
|
-
EmptySection: () => EmptySection,
|
|
50
49
|
ItemActionToolbar: () => ItemActionToolbar,
|
|
51
50
|
ItemInteractionLayer: () => ItemInteractionLayer,
|
|
52
51
|
LinkEditorPanel: () => LinkEditorPanel,
|
|
@@ -75,7 +74,7 @@ __export(index_exports, {
|
|
|
75
74
|
module.exports = __toCommonJS(index_exports);
|
|
76
75
|
|
|
77
76
|
// src/OhhwellsBridge.tsx
|
|
78
|
-
var
|
|
77
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
79
78
|
var import_client2 = require("react-dom/client");
|
|
80
79
|
var import_react_dom3 = require("react-dom");
|
|
81
80
|
|
|
@@ -236,17 +235,13 @@ function MediaBox({
|
|
|
236
235
|
const url = refValue ? ctx.resolveMedia(refValue) : null;
|
|
237
236
|
const isIcon = /^(lucide|simple):/.test(refValue);
|
|
238
237
|
const aspectRatio = aspect && /^\d+:\d+$/.test(aspect) ? aspect.replace(":", " / ") : void 0;
|
|
239
|
-
const editAttrs = ctx.keyFor && editPath ? {
|
|
240
|
-
"data-ohw-key": ctx.keyFor(editPath),
|
|
241
|
-
"data-ohw-editable": isIcon ? "icon" : "image"
|
|
242
|
-
} : {};
|
|
238
|
+
const editAttrs = ctx.keyFor && editPath && !isIcon ? { "data-ohw-key": ctx.keyFor(editPath), "data-ohw-editable": "image" } : {};
|
|
243
239
|
if (isIcon) {
|
|
244
240
|
const Icon = refValue.startsWith("lucide:") ? lucideByName(refValue.slice(7)) : null;
|
|
245
241
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
246
242
|
"span",
|
|
247
243
|
{
|
|
248
244
|
"data-ai-icon": refValue,
|
|
249
|
-
...editAttrs,
|
|
250
245
|
style: {
|
|
251
246
|
display: "inline-flex",
|
|
252
247
|
width: 48,
|
|
@@ -2031,7 +2026,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
2031
2026
|
const autoId = (0, import_react5.useId)();
|
|
2032
2027
|
const insertAfter = insertAfterProp ?? autoId;
|
|
2033
2028
|
const [schedule, setSchedule] = (0, import_react5.useState)(null);
|
|
2034
|
-
const [loading, setLoading] = (0, import_react5.useState)(
|
|
2029
|
+
const [loading, setLoading] = (0, import_react5.useState)(true);
|
|
2035
2030
|
const [inEditor, setInEditor] = (0, import_react5.useState)(false);
|
|
2036
2031
|
const [isHovered, setIsHovered] = (0, import_react5.useState)(false);
|
|
2037
2032
|
const [modalState, setModalState] = (0, import_react5.useState)(null);
|
|
@@ -2205,10 +2200,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
2205
2200
|
"*"
|
|
2206
2201
|
);
|
|
2207
2202
|
};
|
|
2203
|
+
if (!inEditor && !loading && !schedule) return null;
|
|
2208
2204
|
const sectionId = `scheduling-${insertAfter}`;
|
|
2209
|
-
if (!inEditor && !loading && !schedule) {
|
|
2210
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("section", { "data-ohw-section": sectionId, "data-ohw-scheduling-anchor": insertAfter, style: { display: "none" } });
|
|
2211
|
-
}
|
|
2212
2205
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2213
2206
|
"section",
|
|
2214
2207
|
{
|
|
@@ -9532,358 +9525,6 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
9532
9525
|
};
|
|
9533
9526
|
}
|
|
9534
9527
|
|
|
9535
|
-
// src/lib/icon-markup.ts
|
|
9536
|
-
var GLYPH_SELECTOR = "svg, img";
|
|
9537
|
-
function referenceBox(slot) {
|
|
9538
|
-
const row = slot.closest("[data-ohw-socials-row]") ?? slot.closest("a")?.parentElement ?? null;
|
|
9539
|
-
const neighbour = row ? Array.from(row.querySelectorAll('[data-ohw-editable="icon"]')).find((el) => el !== slot) : null;
|
|
9540
|
-
const source = (neighbour ?? slot).querySelector(GLYPH_SELECTOR);
|
|
9541
|
-
const box = source?.getBoundingClientRect() ?? null;
|
|
9542
|
-
return box?.width && box.height ? box : null;
|
|
9543
|
-
}
|
|
9544
|
-
function iconMarkupSizedFor(slot, markup) {
|
|
9545
|
-
const box = referenceBox(slot);
|
|
9546
|
-
if (!box) return markup;
|
|
9547
|
-
const holder = document.createElement("div");
|
|
9548
|
-
holder.innerHTML = markup;
|
|
9549
|
-
const glyph = holder.querySelector(GLYPH_SELECTOR);
|
|
9550
|
-
if (!glyph) return markup;
|
|
9551
|
-
glyph.style.width = `${Math.round(box.width)}px`;
|
|
9552
|
-
glyph.style.height = `${Math.round(box.height)}px`;
|
|
9553
|
-
return holder.innerHTML;
|
|
9554
|
-
}
|
|
9555
|
-
function applyIconMarkup(slot, markup) {
|
|
9556
|
-
if (!markup) return;
|
|
9557
|
-
const coloured = iconMarkupInheritingColour(markup);
|
|
9558
|
-
const sized = iconMarkupSizedFor(slot, coloured);
|
|
9559
|
-
if (slot.innerHTML !== sized) slot.innerHTML = sized;
|
|
9560
|
-
if (sized === coloured) {
|
|
9561
|
-
requestAnimationFrame(() => {
|
|
9562
|
-
if (!slot.isConnected) return;
|
|
9563
|
-
const resized = iconMarkupSizedFor(slot, coloured);
|
|
9564
|
-
if (resized !== coloured && slot.innerHTML !== resized) slot.innerHTML = resized;
|
|
9565
|
-
});
|
|
9566
|
-
}
|
|
9567
|
-
}
|
|
9568
|
-
function detectIconStyle(el) {
|
|
9569
|
-
const row = el.closest("[data-ohw-socials-row]");
|
|
9570
|
-
const glyphs = Array.from((row ?? el).querySelectorAll("svg"));
|
|
9571
|
-
const outlined = glyphs.some((svg) => {
|
|
9572
|
-
return Array.from(svg.querySelectorAll("*")).some((node) => {
|
|
9573
|
-
return node.getAttribute("stroke") !== null && node.getAttribute("stroke") !== "none";
|
|
9574
|
-
});
|
|
9575
|
-
});
|
|
9576
|
-
return outlined ? "outline" : "fill";
|
|
9577
|
-
}
|
|
9578
|
-
function iconMarkupInheritingColour(markup) {
|
|
9579
|
-
const holder = document.createElement("div");
|
|
9580
|
-
holder.innerHTML = markup;
|
|
9581
|
-
holder.querySelectorAll("svg *").forEach((node) => {
|
|
9582
|
-
if (node.getAttribute("fill") && node.getAttribute("fill") !== "none") {
|
|
9583
|
-
node.setAttribute("fill", "currentColor");
|
|
9584
|
-
}
|
|
9585
|
-
if (node.getAttribute("stroke") && node.getAttribute("stroke") !== "none") {
|
|
9586
|
-
node.setAttribute("stroke", "currentColor");
|
|
9587
|
-
}
|
|
9588
|
-
});
|
|
9589
|
-
return holder.innerHTML;
|
|
9590
|
-
}
|
|
9591
|
-
|
|
9592
|
-
// src/lib/socials-items.ts
|
|
9593
|
-
var ICON_SELECTOR = '[data-ohw-editable="icon"]';
|
|
9594
|
-
var SOCIALS_ROW_ATTR = "data-ohw-socials-row";
|
|
9595
|
-
var SOCIALS_ITEM_ATTR = "data-ohw-social-item";
|
|
9596
|
-
function isSocialItem(el) {
|
|
9597
|
-
if (!el) return false;
|
|
9598
|
-
const anchor = el instanceof HTMLAnchorElement ? el : el.closest("a");
|
|
9599
|
-
if (!anchor) return false;
|
|
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 row = item.parentElement;
|
|
9610
|
-
if (!row) return null;
|
|
9611
|
-
const anchors = Array.from(row.querySelectorAll("a"));
|
|
9612
|
-
if (!anchors.length || !anchors.every((anchor) => isSocialItem(anchor))) return null;
|
|
9613
|
-
return row;
|
|
9614
|
-
}
|
|
9615
|
-
function isSocialsRow(el) {
|
|
9616
|
-
const anchors = Array.from(el.querySelectorAll("a"));
|
|
9617
|
-
return anchors.length > 0 && anchors.every((anchor) => isSocialItem(anchor));
|
|
9618
|
-
}
|
|
9619
|
-
function listSocialItems(row) {
|
|
9620
|
-
return Array.from(row.children).filter((child) => {
|
|
9621
|
-
return child instanceof HTMLElement && isSocialItem(child);
|
|
9622
|
-
});
|
|
9623
|
-
}
|
|
9624
|
-
function listSocialsRows(root = document) {
|
|
9625
|
-
const rows = /* @__PURE__ */ new Set();
|
|
9626
|
-
root.querySelectorAll(ICON_SELECTOR).forEach((icon) => {
|
|
9627
|
-
const row = findSocialsRow(icon);
|
|
9628
|
-
if (row) rows.add(row);
|
|
9629
|
-
});
|
|
9630
|
-
root.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`).forEach((row) => rows.add(row));
|
|
9631
|
-
return Array.from(rows);
|
|
9632
|
-
}
|
|
9633
|
-
var rowTemplates = /* @__PURE__ */ new Map();
|
|
9634
|
-
function markSocialsRows(root = document) {
|
|
9635
|
-
root.querySelectorAll(`[${SOCIALS_ITEM_ATTR}]`).forEach((item) => {
|
|
9636
|
-
item.removeAttribute(SOCIALS_ITEM_ATTR);
|
|
9637
|
-
});
|
|
9638
|
-
listSocialsRows(root).forEach((row) => {
|
|
9639
|
-
row.setAttribute(SOCIALS_ROW_ATTR, "");
|
|
9640
|
-
const items = listSocialItems(row);
|
|
9641
|
-
if (items[0]) rowTemplates.set(rowKeyOf(row), items[0].outerHTML);
|
|
9642
|
-
items.forEach((item, index) => {
|
|
9643
|
-
item.setAttribute(SOCIALS_ITEM_ATTR, String(index));
|
|
9644
|
-
const iconKey = socialIconKey(item);
|
|
9645
|
-
if (iconKey) ensureLabelSlot(item, iconKey);
|
|
9646
|
-
});
|
|
9647
|
-
});
|
|
9648
|
-
}
|
|
9649
|
-
var SOCIALS_LABEL_ATTR = "data-ohw-social-label";
|
|
9650
|
-
function ensureLabelSlot(item, iconKey) {
|
|
9651
|
-
if (item.querySelector(`[${SOCIALS_LABEL_ATTR}]`)) return;
|
|
9652
|
-
const label = document.createElement("span");
|
|
9653
|
-
label.setAttribute("data-ohw-key", `${iconKey}-label`);
|
|
9654
|
-
label.setAttribute("data-ohw-editable", "text");
|
|
9655
|
-
label.setAttribute(SOCIALS_LABEL_ATTR, "");
|
|
9656
|
-
label.style.display = "none";
|
|
9657
|
-
label.textContent = item.getAttribute("aria-label") ?? "";
|
|
9658
|
-
item.appendChild(label);
|
|
9659
|
-
}
|
|
9660
|
-
function socialLabelKey(iconKey) {
|
|
9661
|
-
return `${iconKey}-label`;
|
|
9662
|
-
}
|
|
9663
|
-
function applyStoredValues(item, content) {
|
|
9664
|
-
const hrefKey = socialHrefKey(item);
|
|
9665
|
-
const iconKey = socialIconKey(item);
|
|
9666
|
-
if (hrefKey && content[hrefKey] !== void 0) item.setAttribute("href", content[hrefKey]);
|
|
9667
|
-
if (iconKey) {
|
|
9668
|
-
const glyph = item.querySelector(ICON_SELECTOR);
|
|
9669
|
-
if (glyph && content[iconKey]) applyIconMarkup(glyph, content[iconKey]);
|
|
9670
|
-
const label = item.querySelector(`[${SOCIALS_LABEL_ATTR}]`);
|
|
9671
|
-
label?.setAttribute("data-ohw-key", socialLabelKey(iconKey));
|
|
9672
|
-
const stored = content[socialLabelKey(iconKey)];
|
|
9673
|
-
if (label && stored) label.textContent = stored;
|
|
9674
|
-
}
|
|
9675
|
-
}
|
|
9676
|
-
function socialPlatformKey(iconKey) {
|
|
9677
|
-
return `${iconKey}-platform`;
|
|
9678
|
-
}
|
|
9679
|
-
function socialHrefKey(item) {
|
|
9680
|
-
return item.getAttribute("data-ohw-href-key");
|
|
9681
|
-
}
|
|
9682
|
-
function socialIconKey(item) {
|
|
9683
|
-
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
9684
|
-
}
|
|
9685
|
-
var SOCIALS_ORDER_KEY = "__ohw_socials_order";
|
|
9686
|
-
function fromMarkup(markup) {
|
|
9687
|
-
const holder = document.createElement("div");
|
|
9688
|
-
holder.innerHTML = markup;
|
|
9689
|
-
return holder.firstElementChild instanceof HTMLElement ? holder.firstElementChild : null;
|
|
9690
|
-
}
|
|
9691
|
-
var rowKeys = /* @__PURE__ */ new WeakMap();
|
|
9692
|
-
function rowKeyOf(row) {
|
|
9693
|
-
const first = listSocialItems(row)[0];
|
|
9694
|
-
const derived = first ? socialIconKey(first)?.replace(/-\d+$/, "") : null;
|
|
9695
|
-
if (derived) rowKeys.set(row, derived);
|
|
9696
|
-
return derived ?? rowKeys.get(row) ?? "social";
|
|
9697
|
-
}
|
|
9698
|
-
function getSocialsOrderFromDom(root = document) {
|
|
9699
|
-
const order = {};
|
|
9700
|
-
listSocialsRows(root).forEach((row) => {
|
|
9701
|
-
order[rowKeyOf(row)] = listSocialItems(row).map((item) => socialHrefKey(item)).filter((key) => Boolean(key));
|
|
9702
|
-
});
|
|
9703
|
-
return order;
|
|
9704
|
-
}
|
|
9705
|
-
function hasStoredValue(content, hrefKey) {
|
|
9706
|
-
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9707
|
-
return Boolean(content[hrefKey]) || Boolean(content[iconKey]);
|
|
9708
|
-
}
|
|
9709
|
-
function parseSocialsOrder(raw) {
|
|
9710
|
-
if (!raw) return null;
|
|
9711
|
-
try {
|
|
9712
|
-
const parsed = JSON.parse(raw);
|
|
9713
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9714
|
-
} catch {
|
|
9715
|
-
return null;
|
|
9716
|
-
}
|
|
9717
|
-
}
|
|
9718
|
-
function nextSocialIndex(row, rowKey, content) {
|
|
9719
|
-
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));
|
|
9720
|
-
return Math.max(-1, ...used) + 1;
|
|
9721
|
-
}
|
|
9722
|
-
function insertSocialItem(row, after, content = {}) {
|
|
9723
|
-
const rowKey = rowKeyOf(row);
|
|
9724
|
-
const template = listSocialItems(row)[0];
|
|
9725
|
-
const remembered = rowTemplates.get(rowKey);
|
|
9726
|
-
if (!template && !remembered) return null;
|
|
9727
|
-
const index = nextSocialIndex(row, rowKey, content);
|
|
9728
|
-
const iconKey = `${rowKey}-${index}`;
|
|
9729
|
-
const hrefKey = `${iconKey}-href`;
|
|
9730
|
-
const item = template ? template.cloneNode(true) : fromMarkup(remembered);
|
|
9731
|
-
if (!item) return null;
|
|
9732
|
-
item.setAttribute("data-ohw-href-key", hrefKey);
|
|
9733
|
-
item.setAttribute("href", "");
|
|
9734
|
-
item.removeAttribute("aria-label");
|
|
9735
|
-
item.querySelectorAll("[data-ohw-hovered], [data-ohw-selected]").forEach((el) => {
|
|
9736
|
-
el.removeAttribute("data-ohw-hovered");
|
|
9737
|
-
el.removeAttribute("data-ohw-selected");
|
|
9738
|
-
});
|
|
9739
|
-
const icon = item.querySelector(ICON_SELECTOR);
|
|
9740
|
-
icon?.setAttribute("data-ohw-key", iconKey);
|
|
9741
|
-
item.querySelector(`[${SOCIALS_LABEL_ATTR}]`)?.remove();
|
|
9742
|
-
if (after && after.parentElement === row) after.insertAdjacentElement("afterend", item);
|
|
9743
|
-
else row.appendChild(item);
|
|
9744
|
-
markSocialsRows(row.ownerDocument);
|
|
9745
|
-
return { item, hrefKey, iconKey, order: getSocialsOrderFromDom(row.ownerDocument) };
|
|
9746
|
-
}
|
|
9747
|
-
function duplicateSocialItem(item, content) {
|
|
9748
|
-
const row = findSocialsRow(item);
|
|
9749
|
-
const created = row ? insertSocialItem(row, item, content) : null;
|
|
9750
|
-
if (!created) return null;
|
|
9751
|
-
const sourceHref = socialHrefKey(item);
|
|
9752
|
-
const sourceIcon = socialIconKey(item);
|
|
9753
|
-
const link = created.item;
|
|
9754
|
-
if (sourceHref) link.setAttribute("href", item.getAttribute("href") ?? "");
|
|
9755
|
-
const glyph = item.querySelector(ICON_SELECTOR)?.innerHTML;
|
|
9756
|
-
if (glyph) {
|
|
9757
|
-
const slot = link.querySelector(ICON_SELECTOR);
|
|
9758
|
-
if (slot) slot.innerHTML = glyph;
|
|
9759
|
-
}
|
|
9760
|
-
return {
|
|
9761
|
-
...created,
|
|
9762
|
-
copiedFrom: { href: sourceHref, icon: sourceIcon }
|
|
9763
|
-
};
|
|
9764
|
-
}
|
|
9765
|
-
function removeSocialItem(item, content) {
|
|
9766
|
-
const row = findSocialsRow(item);
|
|
9767
|
-
if (!row) return null;
|
|
9768
|
-
const hrefKey = socialHrefKey(item);
|
|
9769
|
-
const iconKey = socialIconKey(item);
|
|
9770
|
-
const removedKeys = [hrefKey, iconKey].filter((key) => Boolean(key));
|
|
9771
|
-
if (!removedKeys.length) return null;
|
|
9772
|
-
const previousOrder = getSocialsOrderFromDom(row.ownerDocument);
|
|
9773
|
-
const previousContent = Object.fromEntries(
|
|
9774
|
-
removedKeys.filter((key) => key in content).map((key) => [key, content[key]])
|
|
9775
|
-
);
|
|
9776
|
-
const nextSibling = item.nextElementSibling;
|
|
9777
|
-
item.remove();
|
|
9778
|
-
markSocialsRows(row.ownerDocument);
|
|
9779
|
-
return {
|
|
9780
|
-
removedKeys,
|
|
9781
|
-
previousContent,
|
|
9782
|
-
order: getSocialsOrderFromDom(row.ownerDocument),
|
|
9783
|
-
previousOrder,
|
|
9784
|
-
undo: () => {
|
|
9785
|
-
if (nextSibling) nextSibling.before(item);
|
|
9786
|
-
else row.appendChild(item);
|
|
9787
|
-
markSocialsRows(row.ownerDocument);
|
|
9788
|
-
}
|
|
9789
|
-
};
|
|
9790
|
-
}
|
|
9791
|
-
function applySocialsOrder(order, root = document) {
|
|
9792
|
-
listSocialsRows(root).forEach((row) => {
|
|
9793
|
-
const wanted = order[rowKeyOf(row)];
|
|
9794
|
-
if (!wanted) return;
|
|
9795
|
-
const byKey = new Map(listSocialItems(row).map((item) => [socialHrefKey(item), item]));
|
|
9796
|
-
wanted.forEach((key) => {
|
|
9797
|
-
const item = byKey.get(key);
|
|
9798
|
-
if (item) row.appendChild(item);
|
|
9799
|
-
});
|
|
9800
|
-
});
|
|
9801
|
-
markSocialsRows(root);
|
|
9802
|
-
}
|
|
9803
|
-
function reconcileSocialsFromContent(content, root = document) {
|
|
9804
|
-
markSocialsRows(root);
|
|
9805
|
-
const stored = parseSocialsOrder(content[SOCIALS_ORDER_KEY]);
|
|
9806
|
-
if (!stored) return;
|
|
9807
|
-
listSocialsRows(root).forEach((row) => {
|
|
9808
|
-
const wanted = stored[rowKeyOf(row)];
|
|
9809
|
-
if (!wanted) return;
|
|
9810
|
-
if (!wanted.length) return;
|
|
9811
|
-
wanted.forEach((key) => {
|
|
9812
|
-
if (listSocialItems(row).some((item) => socialHrefKey(item) === key)) return;
|
|
9813
|
-
if (!hasStoredValue(content, key)) return;
|
|
9814
|
-
const created = insertSocialItem(row, null, content);
|
|
9815
|
-
if (created) {
|
|
9816
|
-
created.item.setAttribute("data-ohw-href-key", key);
|
|
9817
|
-
created.item.querySelector(ICON_SELECTOR)?.setAttribute("data-ohw-key", key.replace(/-href$/, ""));
|
|
9818
|
-
applyStoredValues(created.item, content);
|
|
9819
|
-
}
|
|
9820
|
-
});
|
|
9821
|
-
const present = listSocialItems(row);
|
|
9822
|
-
const surviving = present.filter((item) => {
|
|
9823
|
-
const key = socialHrefKey(item);
|
|
9824
|
-
return !key || wanted.includes(key);
|
|
9825
|
-
});
|
|
9826
|
-
if (surviving.length) {
|
|
9827
|
-
present.forEach((item) => {
|
|
9828
|
-
if (!surviving.includes(item)) item.remove();
|
|
9829
|
-
});
|
|
9830
|
-
}
|
|
9831
|
-
});
|
|
9832
|
-
applySocialsOrder(stored, root);
|
|
9833
|
-
}
|
|
9834
|
-
var DROP_BAR_THICKNESS = 3;
|
|
9835
|
-
function buildSocialDropSlots(row) {
|
|
9836
|
-
const items = listSocialItems(row);
|
|
9837
|
-
if (!items.length) return [];
|
|
9838
|
-
return items.concat(items[items.length - 1]).map((item, index) => {
|
|
9839
|
-
const rect = item.getBoundingClientRect();
|
|
9840
|
-
const left = (index === items.length ? rect.right : rect.left) - DROP_BAR_THICKNESS / 2;
|
|
9841
|
-
return {
|
|
9842
|
-
insertIndex: index,
|
|
9843
|
-
columnIndex: -1,
|
|
9844
|
-
left,
|
|
9845
|
-
top: rect.top,
|
|
9846
|
-
width: DROP_BAR_THICKNESS,
|
|
9847
|
-
height: rect.height,
|
|
9848
|
-
direction: "vertical"
|
|
9849
|
-
};
|
|
9850
|
-
});
|
|
9851
|
-
}
|
|
9852
|
-
function findSocialByHrefKey(hrefKey, root = document) {
|
|
9853
|
-
const el = root.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
9854
|
-
return el ? getSocialItem(el) : null;
|
|
9855
|
-
}
|
|
9856
|
-
function buildSocialDropSlotsForKey(hrefKey, root = document) {
|
|
9857
|
-
const item = findSocialByHrefKey(hrefKey, root);
|
|
9858
|
-
const row = item ? findSocialsRow(item) : null;
|
|
9859
|
-
return row ? buildSocialDropSlots(row) : [];
|
|
9860
|
-
}
|
|
9861
|
-
function hitTestSocialDropSlot(clientX, clientY, draggedHrefKey, root = document) {
|
|
9862
|
-
const distanceTo = (slot) => {
|
|
9863
|
-
const dx = clientX - (slot.left + slot.width / 2);
|
|
9864
|
-
const dy = clientY < slot.top ? slot.top - clientY : Math.max(0, clientY - (slot.top + slot.height));
|
|
9865
|
-
return Math.hypot(dx, dy);
|
|
9866
|
-
};
|
|
9867
|
-
const slots = buildSocialDropSlotsForKey(draggedHrefKey, root);
|
|
9868
|
-
return slots.reduce((best, slot) => {
|
|
9869
|
-
return !best || distanceTo(slot) < distanceTo(best) ? slot : best;
|
|
9870
|
-
}, null);
|
|
9871
|
-
}
|
|
9872
|
-
function planSocialMove(hrefKey, insertIndex, root = document) {
|
|
9873
|
-
const item = findSocialByHrefKey(hrefKey, root);
|
|
9874
|
-
const row = item ? findSocialsRow(item) : null;
|
|
9875
|
-
if (!row) return null;
|
|
9876
|
-
const order = getSocialsOrderFromDom(root);
|
|
9877
|
-
const key = rowKeyOf(row);
|
|
9878
|
-
const current = order[key];
|
|
9879
|
-
if (!current) return null;
|
|
9880
|
-
const from = current.indexOf(hrefKey);
|
|
9881
|
-
if (from < 0) return null;
|
|
9882
|
-
const next = current.filter((_, index) => index !== from);
|
|
9883
|
-
next.splice(insertIndex > from ? insertIndex - 1 : insertIndex, 0, hrefKey);
|
|
9884
|
-
return { ...order, [key]: next };
|
|
9885
|
-
}
|
|
9886
|
-
|
|
9887
9528
|
// src/lib/footer-items.ts
|
|
9888
9529
|
var FOOTER_ORDER_KEY = "__ohw_footer_order";
|
|
9889
9530
|
var MAX_FOOTER_COLUMNS = 18;
|
|
@@ -10728,329 +10369,6 @@ function deleteFooterColumn(column) {
|
|
|
10728
10369
|
};
|
|
10729
10370
|
}
|
|
10730
10371
|
|
|
10731
|
-
// src/lib/logo-identity.ts
|
|
10732
|
-
var LOGO_TEXT_KEYS = ["nav-logo-text", "footer-logo-text", "logo-text"];
|
|
10733
|
-
var LOGO_IMAGE_KEYS = ["nav-logo-image", "footer-logo", "footer-logo-image"];
|
|
10734
|
-
var LOGO_HREF_KEYS = ["nav-logo-href", "footer-logo-href", "logo-href"];
|
|
10735
|
-
var LOGO_PLACEHOLDER_KEY = "logo-is-placeholder";
|
|
10736
|
-
var LOGO_ALT_KEY = "logo-alt";
|
|
10737
|
-
var LOGO_IMAGE_URL_KEY = "nav-logo-image";
|
|
10738
|
-
var PLACEHOLDER_BUSINESS_NAME = "Business name";
|
|
10739
|
-
function resolveLogoDisplayText(text) {
|
|
10740
|
-
const trimmed = (text ?? "").trim();
|
|
10741
|
-
return trimmed || PLACEHOLDER_BUSINESS_NAME;
|
|
10742
|
-
}
|
|
10743
|
-
function isFooterLogoRoot(root) {
|
|
10744
|
-
return Boolean(root.closest("footer") || root.closest('[data-ohw-section="footer"]'));
|
|
10745
|
-
}
|
|
10746
|
-
function imageKeyForRoot(root) {
|
|
10747
|
-
return isFooterLogoRoot(root) ? "footer-logo" : "nav-logo-image";
|
|
10748
|
-
}
|
|
10749
|
-
function textKeyForRoot(root) {
|
|
10750
|
-
return isFooterLogoRoot(root) ? "footer-logo-text" : "nav-logo-text";
|
|
10751
|
-
}
|
|
10752
|
-
function ensureLogoHrefKey(root) {
|
|
10753
|
-
if (!(root instanceof HTMLAnchorElement)) return;
|
|
10754
|
-
if (root.hasAttribute("data-ohw-href-key")) return;
|
|
10755
|
-
root.setAttribute("data-ohw-href-key", isFooterLogoRoot(root) ? "footer-logo-href" : "nav-logo-href");
|
|
10756
|
-
}
|
|
10757
|
-
function applyLogoIdentity(text, isPlaceholder) {
|
|
10758
|
-
const display = resolveLogoDisplayText(text);
|
|
10759
|
-
const placeholder = isPlaceholder || !text.trim() || display === PLACEHOLDER_BUSINESS_NAME;
|
|
10760
|
-
for (const key of LOGO_TEXT_KEYS) {
|
|
10761
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
10762
|
-
if (el.textContent !== display) el.textContent = display;
|
|
10763
|
-
});
|
|
10764
|
-
}
|
|
10765
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
10766
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
10767
|
-
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
10768
|
-
if (img) img.alt = display;
|
|
10769
|
-
});
|
|
10770
|
-
}
|
|
10771
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((el) => {
|
|
10772
|
-
if (placeholder) el.setAttribute("data-ohw-placeholder", "");
|
|
10773
|
-
else el.removeAttribute("data-ohw-placeholder");
|
|
10774
|
-
});
|
|
10775
|
-
return display;
|
|
10776
|
-
}
|
|
10777
|
-
function applyLogoImage(url, alt) {
|
|
10778
|
-
const displayAlt = resolveLogoDisplayText(alt);
|
|
10779
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
10780
|
-
ensureLogoHrefKey(root);
|
|
10781
|
-
const imageKey = imageKeyForRoot(root);
|
|
10782
|
-
const textKey = textKeyForRoot(root);
|
|
10783
|
-
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");
|
|
10784
|
-
let textEl = root.querySelector(`[data-ohw-key="${textKey}"]`) ?? root.querySelector('[data-ohw-key="logo-text"]');
|
|
10785
|
-
if (url) {
|
|
10786
|
-
if (!img) {
|
|
10787
|
-
img = document.createElement("img");
|
|
10788
|
-
img.setAttribute("data-ohw-editable", "image");
|
|
10789
|
-
img.setAttribute("data-ohw-key", imageKey);
|
|
10790
|
-
img.alt = displayAlt;
|
|
10791
|
-
img.style.height = "";
|
|
10792
|
-
img.style.maxHeight = "none";
|
|
10793
|
-
img.style.width = "auto";
|
|
10794
|
-
img.style.display = "block";
|
|
10795
|
-
img.style.objectFit = "contain";
|
|
10796
|
-
root.insertBefore(img, root.firstChild);
|
|
10797
|
-
} else {
|
|
10798
|
-
img.setAttribute("data-ohw-editable", "image");
|
|
10799
|
-
img.setAttribute("data-ohw-key", imageKey);
|
|
10800
|
-
}
|
|
10801
|
-
img.removeAttribute("srcset");
|
|
10802
|
-
img.removeAttribute("sizes");
|
|
10803
|
-
img.src = url;
|
|
10804
|
-
img.alt = displayAlt;
|
|
10805
|
-
img.style.display = "block";
|
|
10806
|
-
if (textEl) textEl.style.display = "none";
|
|
10807
|
-
root.removeAttribute("data-ohw-placeholder");
|
|
10808
|
-
return;
|
|
10809
|
-
}
|
|
10810
|
-
if (img) {
|
|
10811
|
-
img.removeAttribute("src");
|
|
10812
|
-
img.removeAttribute("srcset");
|
|
10813
|
-
img.removeAttribute("sizes");
|
|
10814
|
-
img.alt = displayAlt;
|
|
10815
|
-
img.style.display = "none";
|
|
10816
|
-
}
|
|
10817
|
-
if (!textEl) {
|
|
10818
|
-
textEl = document.createElement("span");
|
|
10819
|
-
textEl.setAttribute("data-ohw-editable", "plain");
|
|
10820
|
-
textEl.setAttribute("data-ohw-key", textKey);
|
|
10821
|
-
root.appendChild(textEl);
|
|
10822
|
-
}
|
|
10823
|
-
textEl.style.display = "";
|
|
10824
|
-
if (textEl.textContent !== displayAlt) textEl.textContent = displayAlt;
|
|
10825
|
-
if (!displayAlt.trim() || displayAlt === PLACEHOLDER_BUSINESS_NAME) {
|
|
10826
|
-
root.setAttribute("data-ohw-placeholder", "");
|
|
10827
|
-
} else {
|
|
10828
|
-
root.removeAttribute("data-ohw-placeholder");
|
|
10829
|
-
}
|
|
10830
|
-
});
|
|
10831
|
-
}
|
|
10832
|
-
function applyLogoHref(href) {
|
|
10833
|
-
const target = href.trim() || "/";
|
|
10834
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
10835
|
-
ensureLogoHrefKey(root);
|
|
10836
|
-
if (root instanceof HTMLAnchorElement) {
|
|
10837
|
-
root.setAttribute("href", target);
|
|
10838
|
-
}
|
|
10839
|
-
});
|
|
10840
|
-
for (const key of LOGO_HREF_KEYS) setStoredLinkHref(key, target);
|
|
10841
|
-
}
|
|
10842
|
-
function readLogoIdentityFromDom() {
|
|
10843
|
-
let imageUrl = null;
|
|
10844
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
10845
|
-
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
10846
|
-
const img = el instanceof HTMLImageElement ? el : el?.querySelector("img");
|
|
10847
|
-
const attrSrc = img?.getAttribute("src")?.trim() ?? "";
|
|
10848
|
-
if (attrSrc && !attrSrc.startsWith("data:") && img && img.style.display !== "none") {
|
|
10849
|
-
imageUrl = img.currentSrc || img.src;
|
|
10850
|
-
break;
|
|
10851
|
-
}
|
|
10852
|
-
}
|
|
10853
|
-
let text = PLACEHOLDER_BUSINESS_NAME;
|
|
10854
|
-
let isPlaceholder = true;
|
|
10855
|
-
for (const key of LOGO_TEXT_KEYS) {
|
|
10856
|
-
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
10857
|
-
if (el?.textContent?.trim()) {
|
|
10858
|
-
text = el.textContent.trim();
|
|
10859
|
-
const logoRoot2 = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
10860
|
-
isPlaceholder = logoRoot2?.hasAttribute("data-ohw-placeholder") === true || text === PLACEHOLDER_BUSINESS_NAME;
|
|
10861
|
-
break;
|
|
10862
|
-
}
|
|
10863
|
-
}
|
|
10864
|
-
if (imageUrl) {
|
|
10865
|
-
const logoImg = document.querySelector(
|
|
10866
|
-
'[data-ohw-key="nav-logo-image"], [data-ohw-key="footer-logo"]'
|
|
10867
|
-
);
|
|
10868
|
-
const alt = logoImg?.alt?.trim() || text;
|
|
10869
|
-
isPlaceholder = false;
|
|
10870
|
-
const hrefEl = document.querySelector(
|
|
10871
|
-
'a[data-ohw-role="logo"], a[data-ohw-logo], [data-ohw-role="logo"]'
|
|
10872
|
-
);
|
|
10873
|
-
const href2 = (hrefEl instanceof HTMLAnchorElement ? hrefEl.getAttribute("href") : null) || hrefEl?.closest("a")?.getAttribute("href") || "/";
|
|
10874
|
-
return { text, isPlaceholder, imageUrl, href: href2, alt };
|
|
10875
|
-
}
|
|
10876
|
-
const logoRoot = document.querySelector('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
10877
|
-
const href = (logoRoot instanceof HTMLAnchorElement ? logoRoot.getAttribute("href") : null) || logoRoot?.closest("a")?.getAttribute("href") || "/";
|
|
10878
|
-
return { text, isPlaceholder, imageUrl: null, href, alt: text };
|
|
10879
|
-
}
|
|
10880
|
-
function applyLogoFromContent(content) {
|
|
10881
|
-
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);
|
|
10882
|
-
if (!hasLogoIdentity) return false;
|
|
10883
|
-
const logoText = content[LOGO_TEXT_KEYS[0]] ?? content[LOGO_TEXT_KEYS[1]] ?? readLogoIdentityFromDom().text;
|
|
10884
|
-
const logoAlt = content[LOGO_ALT_KEY] ?? logoText;
|
|
10885
|
-
const rawLogoImage = content[LOGO_IMAGE_URL_KEY] ?? content["footer-logo"] ?? content["footer-logo-image"] ?? null;
|
|
10886
|
-
const logoImageUrl = typeof rawLogoImage === "string" && rawLogoImage.trim() ? rawLogoImage.trim() : null;
|
|
10887
|
-
const imageExplicitlyCleared = LOGO_IMAGE_KEYS.some((key) => key in content) && !logoImageUrl;
|
|
10888
|
-
const logoIsPlaceholder = LOGO_PLACEHOLDER_KEY in content ? content[LOGO_PLACEHOLDER_KEY] !== "false" : !logoImageUrl && (!logoText.trim() || logoText === PLACEHOLDER_BUSINESS_NAME);
|
|
10889
|
-
if (logoImageUrl) {
|
|
10890
|
-
applyLogoImage(logoImageUrl, logoAlt);
|
|
10891
|
-
} else {
|
|
10892
|
-
if (imageExplicitlyCleared) applyLogoImage(null, logoAlt);
|
|
10893
|
-
applyLogoIdentity(logoText, logoIsPlaceholder);
|
|
10894
|
-
}
|
|
10895
|
-
const logoHref = content["nav-logo-href"] ?? content["footer-logo-href"] ?? content["logo-href"];
|
|
10896
|
-
if (typeof logoHref === "string" && logoHref.trim()) {
|
|
10897
|
-
applyLogoHref(logoHref);
|
|
10898
|
-
}
|
|
10899
|
-
return true;
|
|
10900
|
-
}
|
|
10901
|
-
|
|
10902
|
-
// src/lib/logo-size.ts
|
|
10903
|
-
var LOGO_SIZE_DEFAULTS = {
|
|
10904
|
-
navbar: 28,
|
|
10905
|
-
footer: 32
|
|
10906
|
-
};
|
|
10907
|
-
var LOGO_SIZE_MIN = 16;
|
|
10908
|
-
var LOGO_SIZE_MAX = 80;
|
|
10909
|
-
var LOGO_SIZE_DESKTOP_KEYS = {
|
|
10910
|
-
navbar: "nav-logo-size",
|
|
10911
|
-
footer: "footer-logo-size"
|
|
10912
|
-
};
|
|
10913
|
-
var LOGO_SIZE_MOBILE_KEYS = {
|
|
10914
|
-
navbar: "nav-logo-size-mobile",
|
|
10915
|
-
footer: "footer-logo-size-mobile"
|
|
10916
|
-
};
|
|
10917
|
-
var LOGO_SIZE_KEYS = [
|
|
10918
|
-
LOGO_SIZE_DESKTOP_KEYS.navbar,
|
|
10919
|
-
LOGO_SIZE_DESKTOP_KEYS.footer,
|
|
10920
|
-
LOGO_SIZE_MOBILE_KEYS.navbar,
|
|
10921
|
-
LOGO_SIZE_MOBILE_KEYS.footer
|
|
10922
|
-
];
|
|
10923
|
-
function isFooterLogoRoot2(root) {
|
|
10924
|
-
return Boolean(root.closest("footer") || root.closest('[data-ohw-section="footer"]'));
|
|
10925
|
-
}
|
|
10926
|
-
function getLogoPlacement(root) {
|
|
10927
|
-
return isFooterLogoRoot2(root) ? "footer" : "navbar";
|
|
10928
|
-
}
|
|
10929
|
-
function parseLogoSizePx(raw, fallback) {
|
|
10930
|
-
if (raw == null || raw === "") return fallback;
|
|
10931
|
-
const n = Number.parseFloat(raw);
|
|
10932
|
-
if (!Number.isFinite(n)) return fallback;
|
|
10933
|
-
return Math.min(LOGO_SIZE_MAX, Math.max(LOGO_SIZE_MIN, Math.round(n)));
|
|
10934
|
-
}
|
|
10935
|
-
function isMobileLogoSizeFollowing(content, placement) {
|
|
10936
|
-
const raw = content[LOGO_SIZE_MOBILE_KEYS[placement]];
|
|
10937
|
-
return raw == null || raw.trim() === "";
|
|
10938
|
-
}
|
|
10939
|
-
function resolveDesktopLogoSize(content, placement) {
|
|
10940
|
-
return parseLogoSizePx(content[LOGO_SIZE_DESKTOP_KEYS[placement]], LOGO_SIZE_DEFAULTS[placement]);
|
|
10941
|
-
}
|
|
10942
|
-
function resolveMobileLogoSize(content, placement) {
|
|
10943
|
-
if (isMobileLogoSizeFollowing(content, placement)) {
|
|
10944
|
-
return resolveDesktopLogoSize(content, placement);
|
|
10945
|
-
}
|
|
10946
|
-
return parseLogoSizePx(
|
|
10947
|
-
content[LOGO_SIZE_MOBILE_KEYS[placement]],
|
|
10948
|
-
resolveDesktopLogoSize(content, placement)
|
|
10949
|
-
);
|
|
10950
|
-
}
|
|
10951
|
-
function setRootSizeVars(root, desktopPx, mobilePx, following) {
|
|
10952
|
-
root.style.setProperty("--ohw-logo-size", `${desktopPx}px`);
|
|
10953
|
-
if (following) {
|
|
10954
|
-
root.style.removeProperty("--ohw-logo-size-mobile");
|
|
10955
|
-
} else {
|
|
10956
|
-
root.style.setProperty("--ohw-logo-size-mobile", `${mobilePx}px`);
|
|
10957
|
-
}
|
|
10958
|
-
root.querySelectorAll("img").forEach((img) => {
|
|
10959
|
-
img.style.height = "";
|
|
10960
|
-
img.style.maxHeight = "none";
|
|
10961
|
-
img.style.width = "auto";
|
|
10962
|
-
img.style.objectFit = "contain";
|
|
10963
|
-
});
|
|
10964
|
-
}
|
|
10965
|
-
function applyLogoSizes(content) {
|
|
10966
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
10967
|
-
const placement = getLogoPlacement(root);
|
|
10968
|
-
const desktop = resolveDesktopLogoSize(content, placement);
|
|
10969
|
-
const following = isMobileLogoSizeFollowing(content, placement);
|
|
10970
|
-
const mobile = following ? desktop : resolveMobileLogoSize(content, placement);
|
|
10971
|
-
setRootSizeVars(root, desktop, mobile, following);
|
|
10972
|
-
});
|
|
10973
|
-
}
|
|
10974
|
-
function applyLogoSizeToPlacement(placement, desktopPx, mobilePx, following) {
|
|
10975
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
10976
|
-
if (getLogoPlacement(root) !== placement) return;
|
|
10977
|
-
setRootSizeVars(root, desktopPx, mobilePx, following);
|
|
10978
|
-
});
|
|
10979
|
-
}
|
|
10980
|
-
function logoHasUploadedImage(logoEl) {
|
|
10981
|
-
if (logoEl.hasAttribute("data-ohw-placeholder")) return false;
|
|
10982
|
-
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");
|
|
10983
|
-
if (!img) return false;
|
|
10984
|
-
const src = img.getAttribute("src")?.trim() ?? "";
|
|
10985
|
-
if (!src || src.startsWith("data:")) return false;
|
|
10986
|
-
if (img.style.display === "none") return false;
|
|
10987
|
-
return true;
|
|
10988
|
-
}
|
|
10989
|
-
function getLogoInteractionRect(logoEl) {
|
|
10990
|
-
if (logoHasUploadedImage(logoEl)) {
|
|
10991
|
-
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");
|
|
10992
|
-
if (img) {
|
|
10993
|
-
const r2 = img.getBoundingClientRect();
|
|
10994
|
-
if (r2.width > 0 && r2.height > 0) return r2;
|
|
10995
|
-
}
|
|
10996
|
-
}
|
|
10997
|
-
const text = logoEl.querySelector(
|
|
10998
|
-
'[data-ohw-key="nav-logo-text"], [data-ohw-key="footer-logo-text"]'
|
|
10999
|
-
);
|
|
11000
|
-
if (text) {
|
|
11001
|
-
const style = window.getComputedStyle(text);
|
|
11002
|
-
if (style.display !== "none" && style.visibility !== "hidden") {
|
|
11003
|
-
const r2 = text.getBoundingClientRect();
|
|
11004
|
-
if (r2.width > 0 && r2.height > 0) return r2;
|
|
11005
|
-
}
|
|
11006
|
-
}
|
|
11007
|
-
return logoEl.getBoundingClientRect();
|
|
11008
|
-
}
|
|
11009
|
-
function readLogoSizeState(content, placement) {
|
|
11010
|
-
const desktopPx = resolveDesktopLogoSize(content, placement);
|
|
11011
|
-
const mobileFollowing = isMobileLogoSizeFollowing(content, placement);
|
|
11012
|
-
const mobilePx = mobileFollowing ? desktopPx : resolveMobileLogoSize(content, placement);
|
|
11013
|
-
return { desktopPx, mobilePx, mobileFollowing };
|
|
11014
|
-
}
|
|
11015
|
-
|
|
11016
|
-
// src/lib/site-wide-scope.ts
|
|
11017
|
-
function getLogoElement(el) {
|
|
11018
|
-
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
11019
|
-
if (marked) return marked;
|
|
11020
|
-
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
11021
|
-
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
11022
|
-
if (!root) return null;
|
|
11023
|
-
const anchor = el.closest("a");
|
|
11024
|
-
if (anchor && root.contains(anchor) && !anchor.hasAttribute("data-ohw-href-key") && !anchor.closest("[data-ohw-nav-container]") && Boolean(anchor.querySelector("img") || anchor.matches("img"))) {
|
|
11025
|
-
return anchor;
|
|
11026
|
-
}
|
|
11027
|
-
const img = el.matches("img") ? el : null;
|
|
11028
|
-
if (img && !img.closest("[data-ohw-href-key]") && !img.closest("[data-ohw-nav-container]") && (img.closest("footer") || img.closest("nav, [data-ohw-nav-root]"))) {
|
|
11029
|
-
return img;
|
|
11030
|
-
}
|
|
11031
|
-
return null;
|
|
11032
|
-
}
|
|
11033
|
-
function isInFooter(el) {
|
|
11034
|
-
if (!el) return false;
|
|
11035
|
-
return Boolean(el.closest("footer") || el.closest('[data-ohw-section="footer"]'));
|
|
11036
|
-
}
|
|
11037
|
-
function isSiteWideElement(el) {
|
|
11038
|
-
if (!el) return false;
|
|
11039
|
-
if (getLogoElement(el)) return true;
|
|
11040
|
-
if (isInFooter(el)) return true;
|
|
11041
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-root")) {
|
|
11042
|
-
return true;
|
|
11043
|
-
}
|
|
11044
|
-
if (el.hasAttribute("data-ohw-href-key") && el.closest("nav, [data-ohw-nav-root], [data-ohw-nav-drawer], aside")) {
|
|
11045
|
-
return true;
|
|
11046
|
-
}
|
|
11047
|
-
if (el.closest('[data-ohw-role="navbar-button"]')) return true;
|
|
11048
|
-
return false;
|
|
11049
|
-
}
|
|
11050
|
-
function isSiteWideScopeActive(args) {
|
|
11051
|
-
return isSiteWideElement(args.selected) || isSiteWideElement(args.hoveredItem) || isSiteWideElement(args.hoveredNavContainer) || isSiteWideElement(args.active);
|
|
11052
|
-
}
|
|
11053
|
-
|
|
11054
10372
|
// src/lib/add-footer-column.ts
|
|
11055
10373
|
function buildFooterColumnEditContentPatch(result) {
|
|
11056
10374
|
return {
|
|
@@ -11083,317 +10401,30 @@ function addFooterColumnWithPersist({
|
|
|
11083
10401
|
return result;
|
|
11084
10402
|
}
|
|
11085
10403
|
|
|
11086
|
-
// src/
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
var EDGE_MARGIN = 16;
|
|
11092
|
-
function getVisibleClip(parentScroll) {
|
|
11093
|
-
const left = 0;
|
|
11094
|
-
const right = window.innerWidth;
|
|
11095
|
-
if (!parentScroll) {
|
|
11096
|
-
return { top: 0, bottom: window.innerHeight, left, right };
|
|
10404
|
+
// src/lib/item-drag-interaction.ts
|
|
10405
|
+
function disableNativeHrefDrag(el) {
|
|
10406
|
+
if (el.draggable) el.draggable = false;
|
|
10407
|
+
if (el.getAttribute("draggable") !== "false") {
|
|
10408
|
+
el.setAttribute("draggable", "false");
|
|
11097
10409
|
}
|
|
11098
|
-
const { iframeOffsetTop, headerH: visibleCanvasTop, canvasH } = parentScroll;
|
|
11099
|
-
const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
|
|
11100
|
-
const bottom = Math.min(window.innerHeight, visibleCanvasTop + canvasH - iframeOffsetTop);
|
|
11101
|
-
return { top, bottom: Math.max(top, bottom), left, right };
|
|
11102
10410
|
}
|
|
11103
|
-
function
|
|
11104
|
-
const
|
|
11105
|
-
|
|
11106
|
-
x: Math.max(EDGE_MARGIN, clip.right - PANEL_WIDTH - EDGE_MARGIN),
|
|
11107
|
-
y: Math.min(
|
|
11108
|
-
Math.max(clip.top + EDGE_MARGIN, EDGE_MARGIN),
|
|
11109
|
-
Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelHeight - EDGE_MARGIN)
|
|
11110
|
-
)
|
|
11111
|
-
};
|
|
10411
|
+
function clearTextSelection() {
|
|
10412
|
+
const sel = window.getSelection();
|
|
10413
|
+
if (sel && !sel.isCollapsed) sel.removeAllRanges();
|
|
11112
10414
|
}
|
|
11113
|
-
function
|
|
11114
|
-
|
|
11115
|
-
const maxX = Math.max(clip.left + EDGE_MARGIN, clip.right - panelW - EDGE_MARGIN);
|
|
11116
|
-
const maxY = Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelH - EDGE_MARGIN);
|
|
11117
|
-
return {
|
|
11118
|
-
x: Math.min(Math.max(pos.x, clip.left + EDGE_MARGIN), maxX),
|
|
11119
|
-
y: Math.min(Math.max(pos.y, clip.top + EDGE_MARGIN), maxY)
|
|
11120
|
-
};
|
|
10415
|
+
function armItemPressDrag() {
|
|
10416
|
+
document.documentElement.setAttribute("data-ohw-footer-press-drag", "");
|
|
11121
10417
|
}
|
|
11122
|
-
function
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
icon,
|
|
11127
|
-
onClose,
|
|
11128
|
-
children,
|
|
11129
|
-
position,
|
|
11130
|
-
onPositionChange,
|
|
11131
|
-
parentScroll = null,
|
|
11132
|
-
className,
|
|
11133
|
-
bodyClassName
|
|
11134
|
-
}) {
|
|
11135
|
-
const panelRef = (0, import_react13.useRef)(null);
|
|
11136
|
-
const [measured, setMeasured] = (0, import_react13.useState)({ w: PANEL_WIDTH, h: 280 });
|
|
11137
|
-
const dragRef = (0, import_react13.useRef)(null);
|
|
11138
|
-
const resolved = position ?? defaultFloatingPanelPosition(parentScroll, measured.h);
|
|
11139
|
-
const clamped = clampPosition(resolved, parentScroll, measured.w, measured.h);
|
|
11140
|
-
(0, import_react13.useLayoutEffect)(() => {
|
|
11141
|
-
if (!open || !panelRef.current) return;
|
|
11142
|
-
const el = panelRef.current;
|
|
11143
|
-
const next = { w: el.offsetWidth || PANEL_WIDTH, h: el.offsetHeight || 280 };
|
|
11144
|
-
setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
|
|
11145
|
-
}, [open, children, title, context]);
|
|
11146
|
-
(0, import_react13.useEffect)(() => {
|
|
11147
|
-
if (!open || !position || !onPositionChange) return;
|
|
11148
|
-
const next = clampPosition(position, parentScroll, measured.w, measured.h);
|
|
11149
|
-
if (next.x !== position.x || next.y !== position.y) onPositionChange(next);
|
|
11150
|
-
}, [open, parentScroll, measured.w, measured.h, position, onPositionChange]);
|
|
11151
|
-
const onHeaderPointerDown = (0, import_react13.useCallback)(
|
|
11152
|
-
(e) => {
|
|
11153
|
-
if (e.button !== 0) return;
|
|
11154
|
-
if (e.target.closest("[data-ohw-floating-panel-close]")) return;
|
|
11155
|
-
e.preventDefault();
|
|
11156
|
-
e.stopPropagation();
|
|
11157
|
-
const el = e.currentTarget;
|
|
11158
|
-
el.setPointerCapture(e.pointerId);
|
|
11159
|
-
dragRef.current = {
|
|
11160
|
-
pointerId: e.pointerId,
|
|
11161
|
-
startX: e.clientX,
|
|
11162
|
-
startY: e.clientY,
|
|
11163
|
-
originX: clamped.x,
|
|
11164
|
-
originY: clamped.y
|
|
11165
|
-
};
|
|
11166
|
-
},
|
|
11167
|
-
[clamped.x, clamped.y]
|
|
11168
|
-
);
|
|
11169
|
-
const onHeaderPointerMove = (0, import_react13.useCallback)(
|
|
11170
|
-
(e) => {
|
|
11171
|
-
const drag = dragRef.current;
|
|
11172
|
-
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
11173
|
-
e.preventDefault();
|
|
11174
|
-
const next = clampPosition(
|
|
11175
|
-
{
|
|
11176
|
-
x: drag.originX + (e.clientX - drag.startX),
|
|
11177
|
-
y: drag.originY + (e.clientY - drag.startY)
|
|
11178
|
-
},
|
|
11179
|
-
parentScroll,
|
|
11180
|
-
measured.w,
|
|
11181
|
-
measured.h
|
|
11182
|
-
);
|
|
11183
|
-
onPositionChange?.(next);
|
|
11184
|
-
},
|
|
11185
|
-
[measured.h, measured.w, onPositionChange, parentScroll]
|
|
11186
|
-
);
|
|
11187
|
-
const endDrag = (0, import_react13.useCallback)((e) => {
|
|
11188
|
-
const drag = dragRef.current;
|
|
11189
|
-
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
11190
|
-
dragRef.current = null;
|
|
11191
|
-
try {
|
|
11192
|
-
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
11193
|
-
} catch {
|
|
11194
|
-
}
|
|
11195
|
-
}, []);
|
|
11196
|
-
if (!open) return null;
|
|
11197
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
11198
|
-
"div",
|
|
11199
|
-
{
|
|
11200
|
-
ref: panelRef,
|
|
11201
|
-
"data-ohw-floating-panel": "",
|
|
11202
|
-
role: "dialog",
|
|
11203
|
-
"aria-label": title,
|
|
11204
|
-
className: cn(
|
|
11205
|
-
// Above MediaOverlay / item chrome (2147483646); link-modal content shares this tier.
|
|
11206
|
-
"fixed z-[2147483647] flex w-64 flex-col overflow-hidden rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
11207
|
-
className
|
|
11208
|
-
),
|
|
11209
|
-
style: { left: clamped.x, top: clamped.y },
|
|
11210
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
11211
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
11212
|
-
onClick: (e) => e.stopPropagation(),
|
|
11213
|
-
children: [
|
|
11214
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
11215
|
-
"div",
|
|
11216
|
-
{
|
|
11217
|
-
"data-ohw-floating-panel-header": "",
|
|
11218
|
-
className: "relative flex cursor-grab items-start gap-2 border-b border-border py-5 pl-5 pr-11 active:cursor-grabbing",
|
|
11219
|
-
onPointerDown: onHeaderPointerDown,
|
|
11220
|
-
onPointerMove: onHeaderPointerMove,
|
|
11221
|
-
onPointerUp: endDrag,
|
|
11222
|
-
onPointerCancel: endDrag,
|
|
11223
|
-
children: [
|
|
11224
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
11225
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11226
|
-
icon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "shrink-0 text-foreground", children: icon }) : null,
|
|
11227
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "min-w-0 flex-1 text-lg font-semibold leading-7 text-foreground", children: title })
|
|
11228
|
-
] }),
|
|
11229
|
-
context ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "w-full text-sm leading-5 text-muted-foreground", children: context }) : null
|
|
11230
|
-
] }),
|
|
11231
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11232
|
-
"button",
|
|
11233
|
-
{
|
|
11234
|
-
type: "button",
|
|
11235
|
-
"data-ohw-floating-panel-close": "",
|
|
11236
|
-
"aria-label": "Close",
|
|
11237
|
-
className: "absolute right-2.5 top-2.5 rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
11238
|
-
onClick: (e) => {
|
|
11239
|
-
e.stopPropagation();
|
|
11240
|
-
onClose();
|
|
11241
|
-
},
|
|
11242
|
-
onPointerDown: (e) => e.stopPropagation(),
|
|
11243
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.X, { size: 16, "aria-hidden": true })
|
|
11244
|
-
}
|
|
11245
|
-
)
|
|
11246
|
-
]
|
|
11247
|
-
}
|
|
11248
|
-
),
|
|
11249
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11250
|
-
"div",
|
|
11251
|
-
{
|
|
11252
|
-
"data-ohw-floating-panel-body": "",
|
|
11253
|
-
className: cn("flex w-full flex-col gap-4 p-5", bodyClassName),
|
|
11254
|
-
children
|
|
11255
|
-
}
|
|
11256
|
-
)
|
|
11257
|
-
]
|
|
11258
|
-
}
|
|
11259
|
-
);
|
|
10418
|
+
function lockItemDuringDrag() {
|
|
10419
|
+
document.documentElement.removeAttribute("data-ohw-footer-press-drag");
|
|
10420
|
+
document.documentElement.setAttribute("data-ohw-item-dragging", "");
|
|
10421
|
+
clearTextSelection();
|
|
11260
10422
|
}
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
value,
|
|
11267
|
-
onChange
|
|
11268
|
-
}) {
|
|
11269
|
-
const pct = (value - LOGO_SIZE_MIN) / (LOGO_SIZE_MAX - LOGO_SIZE_MIN) * 100;
|
|
11270
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
|
|
11271
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full items-center gap-2 text-sm font-medium leading-5", children: [
|
|
11272
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "min-w-0 flex-1 text-foreground", children: "Size" }),
|
|
11273
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: [
|
|
11274
|
-
value,
|
|
11275
|
-
" px"
|
|
11276
|
-
] })
|
|
11277
|
-
] }),
|
|
11278
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative h-2 w-full rounded-full bg-primary-50", children: [
|
|
11279
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11280
|
-
"div",
|
|
11281
|
-
{
|
|
11282
|
-
className: "absolute inset-y-0 left-0 rounded-full bg-primary",
|
|
11283
|
-
style: { width: `${pct}%` }
|
|
11284
|
-
}
|
|
11285
|
-
),
|
|
11286
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11287
|
-
"input",
|
|
11288
|
-
{
|
|
11289
|
-
type: "range",
|
|
11290
|
-
min: LOGO_SIZE_MIN,
|
|
11291
|
-
max: LOGO_SIZE_MAX,
|
|
11292
|
-
step: 1,
|
|
11293
|
-
value,
|
|
11294
|
-
"aria-label": "Logo size",
|
|
11295
|
-
className: cn(
|
|
11296
|
-
"absolute inset-0 h-full w-full cursor-pointer appearance-none bg-transparent",
|
|
11297
|
-
"[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:size-5",
|
|
11298
|
-
"[&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2",
|
|
11299
|
-
"[&::-webkit-slider-thumb]:border-primary [&::-webkit-slider-thumb]:bg-background",
|
|
11300
|
-
"[&::-moz-range-thumb]:size-5 [&::-moz-range-thumb]:rounded-full",
|
|
11301
|
-
"[&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-primary",
|
|
11302
|
-
"[&::-moz-range-thumb]:bg-background"
|
|
11303
|
-
),
|
|
11304
|
-
onChange: (e) => onChange(Number(e.target.value))
|
|
11305
|
-
}
|
|
11306
|
-
)
|
|
11307
|
-
] })
|
|
11308
|
-
] });
|
|
11309
|
-
}
|
|
11310
|
-
function LogoSizePanel({
|
|
11311
|
-
viewport,
|
|
11312
|
-
sizePx,
|
|
11313
|
-
mobileFollowing = true,
|
|
11314
|
-
onSizeChange,
|
|
11315
|
-
onCustomizeMobile,
|
|
11316
|
-
onResetMobile,
|
|
11317
|
-
onUpdateEverywhere,
|
|
11318
|
-
className
|
|
11319
|
-
}) {
|
|
11320
|
-
const showFollowing = viewport === "mobile" && mobileFollowing;
|
|
11321
|
-
const showMobileSlider = viewport === "mobile" && !mobileFollowing;
|
|
11322
|
-
const showDesktopSlider = viewport === "desktop";
|
|
11323
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn("flex w-full flex-col gap-4", className), children: [
|
|
11324
|
-
showFollowing ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full flex-col gap-2", children: [
|
|
11325
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-start gap-1", children: [
|
|
11326
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Link, { size: 16, className: "mt-0.5 shrink-0 text-foreground", "aria-hidden": true }),
|
|
11327
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm font-semibold leading-5 text-foreground", children: "Following desktop size" })
|
|
11328
|
-
] }),
|
|
11329
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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." }),
|
|
11330
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11331
|
-
Button,
|
|
11332
|
-
{
|
|
11333
|
-
type: "button",
|
|
11334
|
-
variant: "outline",
|
|
11335
|
-
size: "sm",
|
|
11336
|
-
className: "h-9 w-full min-w-0 cursor-pointer",
|
|
11337
|
-
onClick: onCustomizeMobile,
|
|
11338
|
-
children: "Customize for mobile"
|
|
11339
|
-
}
|
|
11340
|
-
)
|
|
11341
|
-
] }) : null,
|
|
11342
|
-
showDesktopSlider || showMobileSlider ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SizeSlider, { value: sizePx, onChange: onSizeChange }) : null,
|
|
11343
|
-
showMobileSlider ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11344
|
-
Button,
|
|
11345
|
-
{
|
|
11346
|
-
type: "button",
|
|
11347
|
-
variant: "outline",
|
|
11348
|
-
size: "sm",
|
|
11349
|
-
className: "h-9 w-full min-w-0 cursor-pointer",
|
|
11350
|
-
onClick: onResetMobile,
|
|
11351
|
-
children: "Reset to desktop size"
|
|
11352
|
-
}
|
|
11353
|
-
) : null,
|
|
11354
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-px w-full bg-border", role: "separator" }),
|
|
11355
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
11356
|
-
Button,
|
|
11357
|
-
{
|
|
11358
|
-
type: "button",
|
|
11359
|
-
variant: "outline",
|
|
11360
|
-
size: "sm",
|
|
11361
|
-
className: "h-9 w-full min-w-0 cursor-pointer gap-1",
|
|
11362
|
-
onClick: onUpdateEverywhere,
|
|
11363
|
-
children: [
|
|
11364
|
-
"Update logo everywhere",
|
|
11365
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.ArrowUpRight, { size: 16, "aria-hidden": true })
|
|
11366
|
-
]
|
|
11367
|
-
}
|
|
11368
|
-
),
|
|
11369
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm leading-5 text-muted-foreground", children: "Matches the right version to your background." })
|
|
11370
|
-
] });
|
|
11371
|
-
}
|
|
11372
|
-
|
|
11373
|
-
// src/lib/item-drag-interaction.ts
|
|
11374
|
-
function disableNativeHrefDrag(el) {
|
|
11375
|
-
if (el.draggable) el.draggable = false;
|
|
11376
|
-
if (el.getAttribute("draggable") !== "false") {
|
|
11377
|
-
el.setAttribute("draggable", "false");
|
|
11378
|
-
}
|
|
11379
|
-
}
|
|
11380
|
-
function clearTextSelection() {
|
|
11381
|
-
const sel = window.getSelection();
|
|
11382
|
-
if (sel && !sel.isCollapsed) sel.removeAllRanges();
|
|
11383
|
-
}
|
|
11384
|
-
function armItemPressDrag() {
|
|
11385
|
-
document.documentElement.setAttribute("data-ohw-footer-press-drag", "");
|
|
11386
|
-
}
|
|
11387
|
-
function lockItemDuringDrag() {
|
|
11388
|
-
document.documentElement.removeAttribute("data-ohw-footer-press-drag");
|
|
11389
|
-
document.documentElement.setAttribute("data-ohw-item-dragging", "");
|
|
11390
|
-
clearTextSelection();
|
|
11391
|
-
}
|
|
11392
|
-
function unlockItemDragInteraction() {
|
|
11393
|
-
const wasDragging = document.documentElement.hasAttribute("data-ohw-item-dragging");
|
|
11394
|
-
document.documentElement.removeAttribute("data-ohw-footer-press-drag");
|
|
11395
|
-
document.documentElement.removeAttribute("data-ohw-item-dragging");
|
|
11396
|
-
if (wasDragging) clearTextSelection();
|
|
10423
|
+
function unlockItemDragInteraction() {
|
|
10424
|
+
const wasDragging = document.documentElement.hasAttribute("data-ohw-item-dragging");
|
|
10425
|
+
document.documentElement.removeAttribute("data-ohw-footer-press-drag");
|
|
10426
|
+
document.documentElement.removeAttribute("data-ohw-item-dragging");
|
|
10427
|
+
if (wasDragging) clearTextSelection();
|
|
11397
10428
|
}
|
|
11398
10429
|
var armFooterPressDrag = armItemPressDrag;
|
|
11399
10430
|
var lockFooterDuringDrag = lockItemDuringDrag;
|
|
@@ -11568,7 +10599,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
|
|
|
11568
10599
|
}
|
|
11569
10600
|
|
|
11570
10601
|
// src/useNavItemDrag.ts
|
|
11571
|
-
var
|
|
10602
|
+
var import_react13 = require("react");
|
|
11572
10603
|
function useNavItemDrag({
|
|
11573
10604
|
isEditMode,
|
|
11574
10605
|
editContentRef,
|
|
@@ -11592,11 +10623,11 @@ function useNavItemDrag({
|
|
|
11592
10623
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
11593
10624
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
11594
10625
|
}) {
|
|
11595
|
-
const navDragRef = (0,
|
|
11596
|
-
const [navDropSlots, setNavDropSlots] = (0,
|
|
11597
|
-
const [activeNavDropIndex, setActiveNavDropIndex] = (0,
|
|
11598
|
-
const navPointerDragRef = (0,
|
|
11599
|
-
const clearNavDragVisuals = (0,
|
|
10626
|
+
const navDragRef = (0, import_react13.useRef)(null);
|
|
10627
|
+
const [navDropSlots, setNavDropSlots] = (0, import_react13.useState)([]);
|
|
10628
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react13.useState)(null);
|
|
10629
|
+
const navPointerDragRef = (0, import_react13.useRef)(null);
|
|
10630
|
+
const clearNavDragVisuals = (0, import_react13.useCallback)(() => {
|
|
11600
10631
|
const session = navDragRef.current;
|
|
11601
10632
|
const keepOpenEl = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.draggedEl : null;
|
|
11602
10633
|
navDragRef.current = null;
|
|
@@ -11613,7 +10644,7 @@ function useNavItemDrag({
|
|
|
11613
10644
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
11614
10645
|
unlockItemDragInteraction();
|
|
11615
10646
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
11616
|
-
const refreshNavDragVisuals = (0,
|
|
10647
|
+
const refreshNavDragVisuals = (0, import_react13.useCallback)(
|
|
11617
10648
|
(session, activeSlot, clientX, clientY) => {
|
|
11618
10649
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
11619
10650
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -11631,13 +10662,13 @@ function useNavItemDrag({
|
|
|
11631
10662
|
},
|
|
11632
10663
|
[setDraggedItemRect, setSiblingHintRects]
|
|
11633
10664
|
);
|
|
11634
|
-
const refreshNavDragVisualsRef = (0,
|
|
10665
|
+
const refreshNavDragVisualsRef = (0, import_react13.useRef)(refreshNavDragVisuals);
|
|
11635
10666
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
11636
|
-
const commitNavDragRef = (0,
|
|
10667
|
+
const commitNavDragRef = (0, import_react13.useRef)(() => {
|
|
11637
10668
|
});
|
|
11638
|
-
const beginNavDragRef = (0,
|
|
10669
|
+
const beginNavDragRef = (0, import_react13.useRef)(() => {
|
|
11639
10670
|
});
|
|
11640
|
-
const beginNavDrag = (0,
|
|
10671
|
+
const beginNavDrag = (0, import_react13.useCallback)(
|
|
11641
10672
|
(session) => {
|
|
11642
10673
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
11643
10674
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -11671,7 +10702,7 @@ function useNavItemDrag({
|
|
|
11671
10702
|
]
|
|
11672
10703
|
);
|
|
11673
10704
|
beginNavDragRef.current = beginNavDrag;
|
|
11674
|
-
const commitNavDrag = (0,
|
|
10705
|
+
const commitNavDrag = (0, import_react13.useCallback)(
|
|
11675
10706
|
(clientX, clientY) => {
|
|
11676
10707
|
const session = navDragRef.current;
|
|
11677
10708
|
if (!session) {
|
|
@@ -11732,7 +10763,7 @@ function useNavItemDrag({
|
|
|
11732
10763
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
11733
10764
|
);
|
|
11734
10765
|
commitNavDragRef.current = commitNavDrag;
|
|
11735
|
-
const startNavLinkDrag = (0,
|
|
10766
|
+
const startNavLinkDrag = (0, import_react13.useCallback)(
|
|
11736
10767
|
(anchor, clientX, clientY, wasSelected) => {
|
|
11737
10768
|
if (footerDragRef.current) return false;
|
|
11738
10769
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -11750,7 +10781,7 @@ function useNavItemDrag({
|
|
|
11750
10781
|
},
|
|
11751
10782
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
11752
10783
|
);
|
|
11753
|
-
const onNavDragOver = (0,
|
|
10784
|
+
const onNavDragOver = (0, import_react13.useCallback)(
|
|
11754
10785
|
(e) => {
|
|
11755
10786
|
const session = navDragRef.current;
|
|
11756
10787
|
if (!session) return false;
|
|
@@ -11762,7 +10793,7 @@ function useNavItemDrag({
|
|
|
11762
10793
|
},
|
|
11763
10794
|
[]
|
|
11764
10795
|
);
|
|
11765
|
-
(0,
|
|
10796
|
+
(0, import_react13.useEffect)(() => {
|
|
11766
10797
|
if (!isEditMode) return;
|
|
11767
10798
|
const THRESHOLD = 10;
|
|
11768
10799
|
const resolveWasSelected = (el) => {
|
|
@@ -11887,7 +10918,7 @@ function useNavItemDrag({
|
|
|
11887
10918
|
setLinkPopover,
|
|
11888
10919
|
suppressNextClickRef
|
|
11889
10920
|
]);
|
|
11890
|
-
const armNavPressFromChrome = (0,
|
|
10921
|
+
const armNavPressFromChrome = (0, import_react13.useCallback)(
|
|
11891
10922
|
(selected, clientX, clientY, pointerId) => {
|
|
11892
10923
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
11893
10924
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -11918,8 +10949,8 @@ function useNavItemDrag({
|
|
|
11918
10949
|
}
|
|
11919
10950
|
|
|
11920
10951
|
// src/ui/footer-container-chrome.tsx
|
|
11921
|
-
var
|
|
11922
|
-
var
|
|
10952
|
+
var import_lucide_react13 = require("lucide-react");
|
|
10953
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
11923
10954
|
function FooterContainerChrome({
|
|
11924
10955
|
rect,
|
|
11925
10956
|
onAdd,
|
|
@@ -11927,7 +10958,7 @@ function FooterContainerChrome({
|
|
|
11927
10958
|
}) {
|
|
11928
10959
|
const chromeGap = 6;
|
|
11929
10960
|
const buttonMargin = 7;
|
|
11930
|
-
return /* @__PURE__ */ (0,
|
|
10961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11931
10962
|
"div",
|
|
11932
10963
|
{
|
|
11933
10964
|
"data-ohw-footer-container-chrome": "",
|
|
@@ -11939,8 +10970,8 @@ function FooterContainerChrome({
|
|
|
11939
10970
|
width: rect.width + chromeGap * 2,
|
|
11940
10971
|
height: rect.height + chromeGap * 2
|
|
11941
10972
|
},
|
|
11942
|
-
children: /* @__PURE__ */ (0,
|
|
11943
|
-
/* @__PURE__ */ (0,
|
|
10973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
10974
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11944
10975
|
"button",
|
|
11945
10976
|
{
|
|
11946
10977
|
type: "button",
|
|
@@ -11959,17 +10990,17 @@ function FooterContainerChrome({
|
|
|
11959
10990
|
if (addDisabled) return;
|
|
11960
10991
|
onAdd();
|
|
11961
10992
|
},
|
|
11962
|
-
children: /* @__PURE__ */ (0,
|
|
10993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Plus, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
11963
10994
|
}
|
|
11964
10995
|
) }),
|
|
11965
|
-
/* @__PURE__ */ (0,
|
|
10996
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
11966
10997
|
] })
|
|
11967
10998
|
}
|
|
11968
10999
|
) });
|
|
11969
11000
|
}
|
|
11970
11001
|
|
|
11971
11002
|
// src/lib/carousel.ts
|
|
11972
|
-
var
|
|
11003
|
+
var import_react14 = require("react");
|
|
11973
11004
|
var CAROUSEL_ATTR = "data-ohw-carousel";
|
|
11974
11005
|
var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
|
|
11975
11006
|
var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
|
|
@@ -12031,8 +11062,8 @@ function applyCarouselNode(key, val) {
|
|
|
12031
11062
|
return true;
|
|
12032
11063
|
}
|
|
12033
11064
|
function useOhwCarousel(key, initial) {
|
|
12034
|
-
const [images, setImages] = (0,
|
|
12035
|
-
(0,
|
|
11065
|
+
const [images, setImages] = (0, import_react14.useState)(initial);
|
|
11066
|
+
(0, import_react14.useEffect)(() => {
|
|
12036
11067
|
const el = document.querySelector(
|
|
12037
11068
|
`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
|
|
12038
11069
|
);
|
|
@@ -12145,18 +11176,6 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
12145
11176
|
}
|
|
12146
11177
|
if (extraContent && !isScoped) {
|
|
12147
11178
|
applyNavFooterDeleteOverrides(byKey, extraContent);
|
|
12148
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
12149
|
-
if (!(key in extraContent)) continue;
|
|
12150
|
-
byKey.set(key, { key, type: "image", text: extraContent[key] ?? "" });
|
|
12151
|
-
}
|
|
12152
|
-
for (const key of [LOGO_PLACEHOLDER_KEY, LOGO_ALT_KEY]) {
|
|
12153
|
-
if (!(key in extraContent)) continue;
|
|
12154
|
-
byKey.set(key, { key, type: "meta", text: extraContent[key] ?? "" });
|
|
12155
|
-
}
|
|
12156
|
-
for (const key of LOGO_SIZE_KEYS) {
|
|
12157
|
-
if (!(key in extraContent)) continue;
|
|
12158
|
-
byKey.set(key, { key, type: "meta", text: extraContent[key] ?? "" });
|
|
12159
|
-
}
|
|
12160
11179
|
}
|
|
12161
11180
|
return Array.from(byKey.values());
|
|
12162
11181
|
}
|
|
@@ -12259,7 +11278,7 @@ function isNavbarLinksContainer(el) {
|
|
|
12259
11278
|
function isNavigationItem(el) {
|
|
12260
11279
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
12261
11280
|
if (!anchor) return false;
|
|
12262
|
-
return Boolean(anchor.querySelector('[data-ohw-editable="text"]'))
|
|
11281
|
+
return Boolean(anchor.querySelector('[data-ohw-editable="text"]'));
|
|
12263
11282
|
}
|
|
12264
11283
|
function findFooterItemGroup(item) {
|
|
12265
11284
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -12280,9 +11299,8 @@ function isInferredFooterGroup(el) {
|
|
|
12280
11299
|
const footer = el.closest("footer");
|
|
12281
11300
|
if (!footer || el === footer) return false;
|
|
12282
11301
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
12283
|
-
if (isSocialsRow(el)) return false;
|
|
12284
11302
|
const count = Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(
|
|
12285
|
-
|
|
11303
|
+
isNavigationItem
|
|
12286
11304
|
).length;
|
|
12287
11305
|
return count >= 2;
|
|
12288
11306
|
}
|
|
@@ -12326,8 +11344,7 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12326
11344
|
if (key.endsWith("-href")) applyLinkByKey2(key, text);
|
|
12327
11345
|
else {
|
|
12328
11346
|
document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
|
|
12329
|
-
|
|
12330
|
-
else el.textContent = text;
|
|
11347
|
+
el.textContent = text;
|
|
12331
11348
|
});
|
|
12332
11349
|
}
|
|
12333
11350
|
}
|
|
@@ -12389,21 +11406,6 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12389
11406
|
});
|
|
12390
11407
|
return true;
|
|
12391
11408
|
}
|
|
12392
|
-
const social = getSocialItem(selected);
|
|
12393
|
-
if (social) {
|
|
12394
|
-
const result = removeSocialItem(social, getEditContent());
|
|
12395
|
-
if (!result) return false;
|
|
12396
|
-
finishDelete({
|
|
12397
|
-
toastTitle: "Social deleted",
|
|
12398
|
-
removedKeys: result.removedKeys,
|
|
12399
|
-
previousContent: result.previousContent,
|
|
12400
|
-
orderKey: SOCIALS_ORDER_KEY,
|
|
12401
|
-
orderJson: JSON.stringify(result.order),
|
|
12402
|
-
previousOrderJson: JSON.stringify(result.previousOrder),
|
|
12403
|
-
undoDom: result.undo
|
|
12404
|
-
});
|
|
12405
|
-
return true;
|
|
12406
|
-
}
|
|
12407
11409
|
if (isFooterHrefKey(hrefKey)) {
|
|
12408
11410
|
const result = deleteFooterItem(selected);
|
|
12409
11411
|
if (!result) return false;
|
|
@@ -12422,14 +11424,14 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12422
11424
|
}
|
|
12423
11425
|
|
|
12424
11426
|
// src/ui/navbar-container-chrome.tsx
|
|
12425
|
-
var
|
|
12426
|
-
var
|
|
11427
|
+
var import_lucide_react14 = require("lucide-react");
|
|
11428
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
12427
11429
|
function NavbarContainerChrome({
|
|
12428
11430
|
rect,
|
|
12429
11431
|
onAdd
|
|
12430
11432
|
}) {
|
|
12431
11433
|
const chromeGap = 6;
|
|
12432
|
-
return /* @__PURE__ */ (0,
|
|
11434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
12433
11435
|
"div",
|
|
12434
11436
|
{
|
|
12435
11437
|
"data-ohw-navbar-container-chrome": "",
|
|
@@ -12441,7 +11443,7 @@ function NavbarContainerChrome({
|
|
|
12441
11443
|
width: rect.width + chromeGap * 2,
|
|
12442
11444
|
height: rect.height + chromeGap * 2
|
|
12443
11445
|
},
|
|
12444
|
-
children: /* @__PURE__ */ (0,
|
|
11446
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
12445
11447
|
"button",
|
|
12446
11448
|
{
|
|
12447
11449
|
type: "button",
|
|
@@ -12458,7 +11460,7 @@ function NavbarContainerChrome({
|
|
|
12458
11460
|
e.stopPropagation();
|
|
12459
11461
|
onAdd();
|
|
12460
11462
|
},
|
|
12461
|
-
children: /* @__PURE__ */ (0,
|
|
11463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Plus, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
12462
11464
|
}
|
|
12463
11465
|
)
|
|
12464
11466
|
}
|
|
@@ -12467,7 +11469,7 @@ function NavbarContainerChrome({
|
|
|
12467
11469
|
|
|
12468
11470
|
// src/ui/drop-indicator.tsx
|
|
12469
11471
|
var React10 = __toESM(require("react"), 1);
|
|
12470
|
-
var
|
|
11472
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
12471
11473
|
var dropIndicatorVariants = cva(
|
|
12472
11474
|
"ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
|
|
12473
11475
|
{
|
|
@@ -12491,7 +11493,7 @@ var dropIndicatorVariants = cva(
|
|
|
12491
11493
|
);
|
|
12492
11494
|
var DropIndicator = React10.forwardRef(
|
|
12493
11495
|
({ className, direction, state, ...props }, ref) => {
|
|
12494
|
-
return /* @__PURE__ */ (0,
|
|
11496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
12495
11497
|
"div",
|
|
12496
11498
|
{
|
|
12497
11499
|
ref,
|
|
@@ -12508,7 +11510,7 @@ var DropIndicator = React10.forwardRef(
|
|
|
12508
11510
|
DropIndicator.displayName = "DropIndicator";
|
|
12509
11511
|
|
|
12510
11512
|
// src/ui/badge.tsx
|
|
12511
|
-
var
|
|
11513
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
12512
11514
|
var badgeVariants = cva(
|
|
12513
11515
|
"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",
|
|
12514
11516
|
{
|
|
@@ -12526,12 +11528,12 @@ var badgeVariants = cva(
|
|
|
12526
11528
|
}
|
|
12527
11529
|
);
|
|
12528
11530
|
function Badge({ className, variant, ...props }) {
|
|
12529
|
-
return /* @__PURE__ */ (0,
|
|
11531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
12530
11532
|
}
|
|
12531
11533
|
|
|
12532
11534
|
// src/OhhwellsBridge.tsx
|
|
12533
|
-
var
|
|
12534
|
-
var
|
|
11535
|
+
var import_lucide_react15 = require("lucide-react");
|
|
11536
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
12535
11537
|
var PRIMARY3 = "#0885FE";
|
|
12536
11538
|
var IMAGE_FADE_MS = 300;
|
|
12537
11539
|
function runOpacityFade(el, onDone) {
|
|
@@ -12625,10 +11627,21 @@ function parseSchedulingInsertAfter(insertAfter) {
|
|
|
12625
11627
|
insertBefore: insertAfter.slice(idx + INSERT_BEFORE_MARKER.length)
|
|
12626
11628
|
};
|
|
12627
11629
|
}
|
|
12628
|
-
function
|
|
12629
|
-
|
|
12630
|
-
const
|
|
12631
|
-
|
|
11630
|
+
function resolveSchedulingInsert(insertAfter, explicitInsertBefore) {
|
|
11631
|
+
const parsed = parseSchedulingInsertAfter(insertAfter);
|
|
11632
|
+
const insertBefore = explicitInsertBefore ?? parsed.insertBefore;
|
|
11633
|
+
const effectiveInsertAfter = insertBefore && parsed.insertBefore === null ? `${insertAfter}${INSERT_BEFORE_MARKER}${insertBefore}` : insertAfter;
|
|
11634
|
+
return { effectiveInsertAfter, insertBefore };
|
|
11635
|
+
}
|
|
11636
|
+
function getSchedulingMountPoint(insertAfter) {
|
|
11637
|
+
const { anchor } = parseSchedulingInsertAfter(insertAfter);
|
|
11638
|
+
let anchorEl = document.querySelector(`[data-ohw-section="${anchor}"]`);
|
|
11639
|
+
if (!anchorEl && anchor === "scheduling") {
|
|
11640
|
+
const widgets = Array.from(document.querySelectorAll('[data-ohw-section^="scheduling-"]'));
|
|
11641
|
+
anchorEl = widgets.at(-1) ?? null;
|
|
11642
|
+
}
|
|
11643
|
+
if (!anchorEl) return null;
|
|
11644
|
+
return anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
|
|
12632
11645
|
}
|
|
12633
11646
|
function schedulingMountDepth(insertAfter) {
|
|
12634
11647
|
if (!insertAfter.includes(INSERT_BEFORE_MARKER)) return 0;
|
|
@@ -12645,7 +11658,8 @@ function getPageSchedulingEntries(raw) {
|
|
|
12645
11658
|
}
|
|
12646
11659
|
}
|
|
12647
11660
|
function isSchedulingWidgetMissing(entry) {
|
|
12648
|
-
|
|
11661
|
+
const { effectiveInsertAfter } = resolveSchedulingInsert(entry.insertAfter);
|
|
11662
|
+
return !document.querySelector(`[data-ohw-section="${schedulingSectionId(effectiveInsertAfter)}"]`);
|
|
12649
11663
|
}
|
|
12650
11664
|
function hasMissingSchedulingWidgets(entries) {
|
|
12651
11665
|
return entries.some(isSchedulingWidgetMissing);
|
|
@@ -12675,17 +11689,16 @@ function initSectionsFromContent(content, removeExisting = false) {
|
|
|
12675
11689
|
} catch {
|
|
12676
11690
|
}
|
|
12677
11691
|
}
|
|
12678
|
-
function mountSchedulingWidget(
|
|
12679
|
-
const
|
|
12680
|
-
const sectionId = schedulingSectionId(
|
|
11692
|
+
function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId, explicitInsertBefore) {
|
|
11693
|
+
const { effectiveInsertAfter, insertBefore } = resolveSchedulingInsert(insertAfter, explicitInsertBefore);
|
|
11694
|
+
const sectionId = schedulingSectionId(effectiveInsertAfter);
|
|
12681
11695
|
if (document.querySelector(`[data-ohw-section="${sectionId}"]`)) return false;
|
|
12682
|
-
const
|
|
12683
|
-
if (!
|
|
12684
|
-
const mountPoint = anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
|
|
11696
|
+
const mountPoint = getSchedulingMountPoint(effectiveInsertAfter);
|
|
11697
|
+
if (!mountPoint) return false;
|
|
12685
11698
|
const container = document.createElement("div");
|
|
12686
11699
|
container.dataset.ohwSectionContainer = "scheduling";
|
|
12687
|
-
if (
|
|
12688
|
-
const beforeAnchor = document.querySelector(`[data-ohw-section="${
|
|
11700
|
+
if (insertBefore) {
|
|
11701
|
+
const beforeAnchor = document.querySelector(`[data-ohw-section="${insertBefore}"]`);
|
|
12689
11702
|
const beforePoint = beforeAnchor?.closest('[data-ohw-section-container="scheduling"]') ?? beforeAnchor;
|
|
12690
11703
|
if (!beforePoint) return false;
|
|
12691
11704
|
beforePoint.insertAdjacentElement("beforebegin", container);
|
|
@@ -12696,25 +11709,19 @@ function mountSchedulingWidget(anchorId, notifyOnConnect = false, scheduleId, be
|
|
|
12696
11709
|
}
|
|
12697
11710
|
tail.insertAdjacentElement("afterend", container);
|
|
12698
11711
|
}
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
});
|
|
12713
|
-
} catch (err) {
|
|
12714
|
-
console.error("[ow:scheduling] render threw", err);
|
|
12715
|
-
container.remove();
|
|
12716
|
-
return false;
|
|
12717
|
-
}
|
|
11712
|
+
const root = (0, import_client2.createRoot)(container);
|
|
11713
|
+
(0, import_react_dom3.flushSync)(() => {
|
|
11714
|
+
root.render(
|
|
11715
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
11716
|
+
SchedulingWidget,
|
|
11717
|
+
{
|
|
11718
|
+
notifyOnConnect,
|
|
11719
|
+
initialScheduleId: scheduleId,
|
|
11720
|
+
insertAfter: effectiveInsertAfter
|
|
11721
|
+
}
|
|
11722
|
+
)
|
|
11723
|
+
);
|
|
11724
|
+
});
|
|
12718
11725
|
const tracker = getSectionsTracker();
|
|
12719
11726
|
let sections = [];
|
|
12720
11727
|
try {
|
|
@@ -12722,12 +11729,10 @@ function mountSchedulingWidget(anchorId, notifyOnConnect = false, scheduleId, be
|
|
|
12722
11729
|
} catch {
|
|
12723
11730
|
}
|
|
12724
11731
|
const inEditor = typeof window !== "undefined" && window.self !== window.top;
|
|
12725
|
-
if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter ===
|
|
11732
|
+
if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter === effectiveInsertAfter)) {
|
|
12726
11733
|
sections.push({
|
|
12727
11734
|
type: "scheduling",
|
|
12728
|
-
insertAfter:
|
|
12729
|
-
anchorId,
|
|
12730
|
-
beforeId: beforeId ?? null,
|
|
11735
|
+
insertAfter: effectiveInsertAfter,
|
|
12731
11736
|
pagePath: window.location.pathname,
|
|
12732
11737
|
...scheduleId ? { scheduleId } : {}
|
|
12733
11738
|
});
|
|
@@ -12741,8 +11746,7 @@ function mountSchedulingEntries(entries, notifyOnConnect = false) {
|
|
|
12741
11746
|
for (let i = pending.length - 1; i >= 0; i--) {
|
|
12742
11747
|
const entry = pending[i];
|
|
12743
11748
|
const shouldNotify = typeof notifyOnConnect === "function" ? notifyOnConnect(entry) : notifyOnConnect;
|
|
12744
|
-
|
|
12745
|
-
if (mountSchedulingWidget(anchorId, shouldNotify, entry.scheduleId ?? null, beforeId, entry.insertAfter)) {
|
|
11749
|
+
if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId)) {
|
|
12746
11750
|
pending.splice(i, 1);
|
|
12747
11751
|
}
|
|
12748
11752
|
}
|
|
@@ -12756,17 +11760,6 @@ function applyLinkHref(el, val) {
|
|
|
12756
11760
|
const anchor = el instanceof HTMLAnchorElement ? el : el.querySelector("a");
|
|
12757
11761
|
if (anchor) anchor.setAttribute("href", val);
|
|
12758
11762
|
}
|
|
12759
|
-
function currentIconRef(el) {
|
|
12760
|
-
const uploaded = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
12761
|
-
if (uploaded?.getAttribute("src")) {
|
|
12762
|
-
return uploaded.getAttribute("src") ?? "";
|
|
12763
|
-
}
|
|
12764
|
-
const svg = el instanceof SVGElement ? el : el.querySelector("svg");
|
|
12765
|
-
const named = Array.from(svg?.classList ?? []).find(
|
|
12766
|
-
(c) => c.startsWith("lucide-") && c !== "lucide-icon"
|
|
12767
|
-
);
|
|
12768
|
-
return named ? `lucide:${named.slice("lucide-".length)}` : "";
|
|
12769
|
-
}
|
|
12770
11763
|
function getEditMeasureEl(editable) {
|
|
12771
11764
|
return editable.closest("[data-ohw-href-key]") ?? editable;
|
|
12772
11765
|
}
|
|
@@ -12811,11 +11804,8 @@ function isMediaEditable(el) {
|
|
|
12811
11804
|
const t = el.dataset.ohwEditable;
|
|
12812
11805
|
return t === "image" || t === "bg-image" || t === "video";
|
|
12813
11806
|
}
|
|
12814
|
-
function isIconEditable(el) {
|
|
12815
|
-
return el.dataset.ohwEditable === "icon";
|
|
12816
|
-
}
|
|
12817
11807
|
var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [data-ohw-editable="video"]';
|
|
12818
|
-
var NON_MEDIA_SELECTOR = '[data-ohw-editable]:not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"])
|
|
11808
|
+
var NON_MEDIA_SELECTOR = '[data-ohw-editable]:not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"])';
|
|
12819
11809
|
function getVideoEl2(el) {
|
|
12820
11810
|
return el instanceof HTMLVideoElement ? el : el.querySelector("video");
|
|
12821
11811
|
}
|
|
@@ -12886,13 +11876,6 @@ function isInsideLinkEditor(target) {
|
|
|
12886
11876
|
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"]')
|
|
12887
11877
|
);
|
|
12888
11878
|
}
|
|
12889
|
-
function isInsideFloatingPanel(target) {
|
|
12890
|
-
return Boolean(target.closest("[data-ohw-floating-panel]"));
|
|
12891
|
-
}
|
|
12892
|
-
function isPointOverFloatingPanel(clientX, clientY) {
|
|
12893
|
-
const el = document.elementFromPoint(clientX, clientY);
|
|
12894
|
-
return Boolean(el instanceof Element && el.closest("[data-ohw-floating-panel]"));
|
|
12895
|
-
}
|
|
12896
11879
|
function getHrefKeyFromElement(el) {
|
|
12897
11880
|
if (!el) return null;
|
|
12898
11881
|
const anchor = el.closest("[data-ohw-href-key]");
|
|
@@ -12940,29 +11923,13 @@ function isNavItemPointerTarget(el) {
|
|
|
12940
11923
|
function getNavigationItemAnchor(el) {
|
|
12941
11924
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
12942
11925
|
if (!anchor) return null;
|
|
12943
|
-
if (!anchor.querySelector('[data-ohw-editable="text"]')
|
|
11926
|
+
if (!anchor.querySelector('[data-ohw-editable="text"]')) return null;
|
|
12944
11927
|
if (!isNavItemPointerTarget(anchor)) return null;
|
|
12945
11928
|
return anchor;
|
|
12946
11929
|
}
|
|
12947
11930
|
function isNavigationItem2(el) {
|
|
12948
11931
|
return getNavigationItemAnchor(el) !== null;
|
|
12949
11932
|
}
|
|
12950
|
-
function requestSocialDialog(anchor, post, content) {
|
|
12951
|
-
const item = getSocialItem(anchor);
|
|
12952
|
-
if (!item) return false;
|
|
12953
|
-
const iconKey = item.querySelector('[data-ohw-editable="icon"]')?.dataset.ohwKey ?? "";
|
|
12954
|
-
post({
|
|
12955
|
-
type: "ow:social-pick",
|
|
12956
|
-
hrefKey: item.getAttribute("data-ohw-href-key") ?? "",
|
|
12957
|
-
iconKey,
|
|
12958
|
-
url: getLinkHref4(item),
|
|
12959
|
-
iconStyle: detectIconStyle(item),
|
|
12960
|
-
// What was chosen last time. Guessing from the address instead reads as "Website" for anything
|
|
12961
|
-
// unrecognised, and for an item with no address at all — so a deliberate choice looked lost.
|
|
12962
|
-
platformId: content[socialPlatformKey(iconKey)] ?? ""
|
|
12963
|
-
});
|
|
12964
|
-
return true;
|
|
12965
|
-
}
|
|
12966
11933
|
function listNavigationItems() {
|
|
12967
11934
|
return Array.from(
|
|
12968
11935
|
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
@@ -12997,7 +11964,7 @@ function getNavigationRoot(el) {
|
|
|
12997
11964
|
return el.closest("nav, footer, aside");
|
|
12998
11965
|
}
|
|
12999
11966
|
function countFooterNavItems(el) {
|
|
13000
|
-
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(
|
|
11967
|
+
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem2).length;
|
|
13001
11968
|
}
|
|
13002
11969
|
function findFooterItemGroup2(item) {
|
|
13003
11970
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -13018,11 +11985,10 @@ function isInferredFooterGroup2(el) {
|
|
|
13018
11985
|
const footer = el.closest("footer");
|
|
13019
11986
|
if (!footer || el === footer) return false;
|
|
13020
11987
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
13021
|
-
if (isSocialsRow(el)) return false;
|
|
13022
11988
|
return countFooterNavItems(el) >= 2;
|
|
13023
11989
|
}
|
|
13024
11990
|
function isNavigationContainer(el) {
|
|
13025
|
-
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) ||
|
|
11991
|
+
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);
|
|
13026
11992
|
}
|
|
13027
11993
|
function isNavbarLinksContainer2(el) {
|
|
13028
11994
|
return el.hasAttribute("data-ohw-nav-container");
|
|
@@ -13105,8 +12071,6 @@ function resolveNavContainerSelectionTarget(target, clientX, clientY) {
|
|
|
13105
12071
|
return null;
|
|
13106
12072
|
}
|
|
13107
12073
|
function getNavigationSelectionParent(el) {
|
|
13108
|
-
const socialsRow = findSocialsRow(el);
|
|
13109
|
-
if (socialsRow) return socialsRow;
|
|
13110
12074
|
if (isNavigationItem2(el)) {
|
|
13111
12075
|
const childrenRoot = el.closest("[data-ohw-nav-children]");
|
|
13112
12076
|
if (childrenRoot) {
|
|
@@ -13125,17 +12089,13 @@ function getNavigationSelectionParent(el) {
|
|
|
13125
12089
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
13126
12090
|
return getFooterLinksContainer();
|
|
13127
12091
|
}
|
|
13128
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") ||
|
|
12092
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
13129
12093
|
return getNavigationRoot(el);
|
|
13130
12094
|
}
|
|
13131
12095
|
return null;
|
|
13132
12096
|
}
|
|
13133
12097
|
function collectNavigationItemSiblingHintRects(selected) {
|
|
13134
12098
|
if (!isNavigationItem2(selected)) return [];
|
|
13135
|
-
const socialsRow = findSocialsRow(selected);
|
|
13136
|
-
if (socialsRow) {
|
|
13137
|
-
return listSocialItems(socialsRow).filter((item) => item !== selected).map((item) => item.getBoundingClientRect());
|
|
13138
|
-
}
|
|
13139
12099
|
const footerColumn = getFooterColumn(selected);
|
|
13140
12100
|
if (footerColumn) {
|
|
13141
12101
|
return listFooterLinksInColumn(footerColumn).filter((link) => link !== selected).map((link) => link.getBoundingClientRect());
|
|
@@ -13368,7 +12328,7 @@ function EditGlowChrome({
|
|
|
13368
12328
|
hideHandle = false
|
|
13369
12329
|
}) {
|
|
13370
12330
|
const GAP = SELECTION_CHROME_GAP2;
|
|
13371
|
-
return /* @__PURE__ */ (0,
|
|
12331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
13372
12332
|
"div",
|
|
13373
12333
|
{
|
|
13374
12334
|
ref: elRef,
|
|
@@ -13383,7 +12343,7 @@ function EditGlowChrome({
|
|
|
13383
12343
|
zIndex: 2147483646
|
|
13384
12344
|
},
|
|
13385
12345
|
children: [
|
|
13386
|
-
/* @__PURE__ */ (0,
|
|
12346
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13387
12347
|
"div",
|
|
13388
12348
|
{
|
|
13389
12349
|
style: {
|
|
@@ -13396,7 +12356,7 @@ function EditGlowChrome({
|
|
|
13396
12356
|
}
|
|
13397
12357
|
}
|
|
13398
12358
|
),
|
|
13399
|
-
reorderHrefKey && !hideHandle && /* @__PURE__ */ (0,
|
|
12359
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13400
12360
|
"div",
|
|
13401
12361
|
{
|
|
13402
12362
|
"data-ohw-drag-handle-container": "",
|
|
@@ -13408,7 +12368,7 @@ function EditGlowChrome({
|
|
|
13408
12368
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
13409
12369
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
13410
12370
|
},
|
|
13411
|
-
children: /* @__PURE__ */ (0,
|
|
12371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13412
12372
|
DragHandle,
|
|
13413
12373
|
{
|
|
13414
12374
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -13591,9 +12551,9 @@ function FloatingToolbar({
|
|
|
13591
12551
|
showEditLink,
|
|
13592
12552
|
onEditLink
|
|
13593
12553
|
}) {
|
|
13594
|
-
const localRef =
|
|
13595
|
-
const [measuredW, setMeasuredW] =
|
|
13596
|
-
const setRefs =
|
|
12554
|
+
const localRef = import_react15.default.useRef(null);
|
|
12555
|
+
const [measuredW, setMeasuredW] = import_react15.default.useState(330);
|
|
12556
|
+
const setRefs = import_react15.default.useCallback(
|
|
13597
12557
|
(node) => {
|
|
13598
12558
|
localRef.current = node;
|
|
13599
12559
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -13605,7 +12565,7 @@ function FloatingToolbar({
|
|
|
13605
12565
|
},
|
|
13606
12566
|
[elRef]
|
|
13607
12567
|
);
|
|
13608
|
-
|
|
12568
|
+
import_react15.default.useLayoutEffect(() => {
|
|
13609
12569
|
const node = localRef.current;
|
|
13610
12570
|
if (!node) return;
|
|
13611
12571
|
const update = () => {
|
|
@@ -13618,7 +12578,7 @@ function FloatingToolbar({
|
|
|
13618
12578
|
return () => ro.disconnect();
|
|
13619
12579
|
}, [showEditLink, activeCommands]);
|
|
13620
12580
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
13621
|
-
return /* @__PURE__ */ (0,
|
|
12581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13622
12582
|
"div",
|
|
13623
12583
|
{
|
|
13624
12584
|
ref: setRefs,
|
|
@@ -13630,12 +12590,12 @@ function FloatingToolbar({
|
|
|
13630
12590
|
zIndex: 2147483647,
|
|
13631
12591
|
pointerEvents: "auto"
|
|
13632
12592
|
},
|
|
13633
|
-
children: /* @__PURE__ */ (0,
|
|
13634
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0,
|
|
13635
|
-
gi > 0 && /* @__PURE__ */ (0,
|
|
12593
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(CustomToolbar, { children: [
|
|
12594
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react15.default.Fragment, { children: [
|
|
12595
|
+
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomToolbarDivider, {}),
|
|
13636
12596
|
btns.map((btn) => {
|
|
13637
12597
|
const isActive = activeCommands.has(btn.cmd);
|
|
13638
|
-
return /* @__PURE__ */ (0,
|
|
12598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13639
12599
|
CustomToolbarButton,
|
|
13640
12600
|
{
|
|
13641
12601
|
title: btn.title,
|
|
@@ -13644,7 +12604,7 @@ function FloatingToolbar({
|
|
|
13644
12604
|
e.preventDefault();
|
|
13645
12605
|
onCommand(btn.cmd);
|
|
13646
12606
|
},
|
|
13647
|
-
children: /* @__PURE__ */ (0,
|
|
12607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13648
12608
|
"svg",
|
|
13649
12609
|
{
|
|
13650
12610
|
width: "16",
|
|
@@ -13665,7 +12625,7 @@ function FloatingToolbar({
|
|
|
13665
12625
|
);
|
|
13666
12626
|
})
|
|
13667
12627
|
] }, gi)),
|
|
13668
|
-
showEditLink ? /* @__PURE__ */ (0,
|
|
12628
|
+
showEditLink ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13669
12629
|
CustomToolbarButton,
|
|
13670
12630
|
{
|
|
13671
12631
|
type: "button",
|
|
@@ -13679,7 +12639,7 @@ function FloatingToolbar({
|
|
|
13679
12639
|
e.preventDefault();
|
|
13680
12640
|
e.stopPropagation();
|
|
13681
12641
|
},
|
|
13682
|
-
children: /* @__PURE__ */ (0,
|
|
12642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react15.Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
13683
12643
|
}
|
|
13684
12644
|
) : null
|
|
13685
12645
|
] })
|
|
@@ -13696,7 +12656,7 @@ function StateToggle({
|
|
|
13696
12656
|
states,
|
|
13697
12657
|
onStateChange
|
|
13698
12658
|
}) {
|
|
13699
|
-
return /* @__PURE__ */ (0,
|
|
12659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13700
12660
|
ToggleGroup,
|
|
13701
12661
|
{
|
|
13702
12662
|
"data-ohw-state-toggle": "",
|
|
@@ -13710,12 +12670,11 @@ function StateToggle({
|
|
|
13710
12670
|
left: rect.right - 8,
|
|
13711
12671
|
transform: "translateX(-100%)"
|
|
13712
12672
|
},
|
|
13713
|
-
children: states.map((state) => /* @__PURE__ */ (0,
|
|
12673
|
+
children: states.map((state) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
13714
12674
|
}
|
|
13715
12675
|
);
|
|
13716
12676
|
}
|
|
13717
12677
|
var contentCache = /* @__PURE__ */ new Map();
|
|
13718
|
-
var fetchedContentPaths = /* @__PURE__ */ new Set();
|
|
13719
12678
|
function resolveSubdomain(subdomainFromQuery) {
|
|
13720
12679
|
if (subdomainFromQuery) return subdomainFromQuery;
|
|
13721
12680
|
if (typeof window !== "undefined") {
|
|
@@ -13738,8 +12697,8 @@ function OhhwellsBridge() {
|
|
|
13738
12697
|
const router = (0, import_navigation3.useRouter)();
|
|
13739
12698
|
const searchParams = (0, import_navigation3.useSearchParams)();
|
|
13740
12699
|
const isEditMode = isEditSessionActive();
|
|
13741
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
13742
|
-
(0,
|
|
12700
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react15.useState)(null);
|
|
12701
|
+
(0, import_react15.useEffect)(() => {
|
|
13743
12702
|
const figtreeFontId = "ohw-figtree-font";
|
|
13744
12703
|
if (!document.getElementById(figtreeFontId)) {
|
|
13745
12704
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -13768,136 +12727,110 @@ function OhhwellsBridge() {
|
|
|
13768
12727
|
const subdomain = resolveSubdomain(subdomainFromQuery);
|
|
13769
12728
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
13770
12729
|
useSavedLinkNavigation(isEditMode);
|
|
13771
|
-
const postToParent2 = (0,
|
|
12730
|
+
const postToParent2 = (0, import_react15.useCallback)((data) => {
|
|
13772
12731
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
13773
12732
|
window.parent.postMessage(data, "*");
|
|
13774
12733
|
}
|
|
13775
12734
|
}, []);
|
|
13776
|
-
const [fetchState, setFetchState] = (0,
|
|
13777
|
-
const autoSaveTimers = (0,
|
|
13778
|
-
const activeElRef = (0,
|
|
13779
|
-
const pointerHeldRef = (0,
|
|
13780
|
-
const selectedElRef = (0,
|
|
13781
|
-
const selectedHrefKeyRef = (0,
|
|
13782
|
-
const selectedFooterColAttrRef = (0,
|
|
13783
|
-
const originalContentRef = (0,
|
|
13784
|
-
const activeStateElRef = (0,
|
|
13785
|
-
const parentScrollRef = (0,
|
|
13786
|
-
const visibleViewportRef = (0,
|
|
13787
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
13788
|
-
const attachVisibleViewport = (0,
|
|
12735
|
+
const [fetchState, setFetchState] = (0, import_react15.useState)("idle");
|
|
12736
|
+
const autoSaveTimers = (0, import_react15.useRef)(/* @__PURE__ */ new Map());
|
|
12737
|
+
const activeElRef = (0, import_react15.useRef)(null);
|
|
12738
|
+
const pointerHeldRef = (0, import_react15.useRef)(false);
|
|
12739
|
+
const selectedElRef = (0, import_react15.useRef)(null);
|
|
12740
|
+
const selectedHrefKeyRef = (0, import_react15.useRef)(null);
|
|
12741
|
+
const selectedFooterColAttrRef = (0, import_react15.useRef)(null);
|
|
12742
|
+
const originalContentRef = (0, import_react15.useRef)(null);
|
|
12743
|
+
const activeStateElRef = (0, import_react15.useRef)(null);
|
|
12744
|
+
const parentScrollRef = (0, import_react15.useRef)(null);
|
|
12745
|
+
const visibleViewportRef = (0, import_react15.useRef)(null);
|
|
12746
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react15.useState)(null);
|
|
12747
|
+
const attachVisibleViewport = (0, import_react15.useCallback)((node) => {
|
|
13789
12748
|
visibleViewportRef.current = node;
|
|
13790
12749
|
setDialogPortalContainer(node);
|
|
13791
12750
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
13792
12751
|
}, []);
|
|
13793
|
-
const toolbarElRef = (0,
|
|
13794
|
-
const glowElRef = (0,
|
|
13795
|
-
const hoveredImageRef = (0,
|
|
13796
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
13797
|
-
const dragOverElRef = (0,
|
|
13798
|
-
const [mediaHover, setMediaHover] = (0,
|
|
13799
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
13800
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
13801
|
-
const hoveredGapRef = (0,
|
|
13802
|
-
const imageUnhoverTimerRef = (0,
|
|
13803
|
-
const imageShowTimerRef = (0,
|
|
13804
|
-
const editStylesRef = (0,
|
|
13805
|
-
const activateRef = (0,
|
|
13806
|
-
});
|
|
13807
|
-
const deactivateRef = (0, import_react16.useRef)(() => {
|
|
12752
|
+
const toolbarElRef = (0, import_react15.useRef)(null);
|
|
12753
|
+
const glowElRef = (0, import_react15.useRef)(null);
|
|
12754
|
+
const hoveredImageRef = (0, import_react15.useRef)(null);
|
|
12755
|
+
const hoveredImageHasTextOverlapRef = (0, import_react15.useRef)(false);
|
|
12756
|
+
const dragOverElRef = (0, import_react15.useRef)(null);
|
|
12757
|
+
const [mediaHover, setMediaHover] = (0, import_react15.useState)(null);
|
|
12758
|
+
const [carouselHover, setCarouselHover] = (0, import_react15.useState)(null);
|
|
12759
|
+
const [uploadingRects, setUploadingRects] = (0, import_react15.useState)({});
|
|
12760
|
+
const hoveredGapRef = (0, import_react15.useRef)(null);
|
|
12761
|
+
const imageUnhoverTimerRef = (0, import_react15.useRef)(null);
|
|
12762
|
+
const imageShowTimerRef = (0, import_react15.useRef)(null);
|
|
12763
|
+
const editStylesRef = (0, import_react15.useRef)(null);
|
|
12764
|
+
const activateRef = (0, import_react15.useRef)(() => {
|
|
13808
12765
|
});
|
|
13809
|
-
const
|
|
12766
|
+
const deactivateRef = (0, import_react15.useRef)(() => {
|
|
13810
12767
|
});
|
|
13811
|
-
const
|
|
12768
|
+
const selectRef = (0, import_react15.useRef)(() => {
|
|
13812
12769
|
});
|
|
13813
|
-
const
|
|
12770
|
+
const selectFrameRef = (0, import_react15.useRef)(() => {
|
|
13814
12771
|
});
|
|
13815
|
-
const
|
|
12772
|
+
const deselectRef = (0, import_react15.useRef)(() => {
|
|
13816
12773
|
});
|
|
13817
|
-
const
|
|
12774
|
+
const reselectNavigationItemRef = (0, import_react15.useRef)(() => {
|
|
13818
12775
|
});
|
|
13819
|
-
const
|
|
12776
|
+
const commitNavigationTextEditRef = (0, import_react15.useRef)(() => {
|
|
13820
12777
|
});
|
|
13821
|
-
const
|
|
12778
|
+
const handleDeleteSelectedRef = (0, import_react15.useRef)(() => false);
|
|
12779
|
+
const runPendingDeleteUndoRef = (0, import_react15.useRef)(() => false);
|
|
12780
|
+
const isFooterFrameSelectionRef = (0, import_react15.useRef)(false);
|
|
12781
|
+
const refreshActiveCommandsRef = (0, import_react15.useRef)(() => {
|
|
13822
12782
|
});
|
|
13823
|
-
const
|
|
13824
|
-
});
|
|
13825
|
-
const handleDeleteSelectedRef = (0, import_react16.useRef)(() => false);
|
|
13826
|
-
const runPendingDeleteUndoRef = (0, import_react16.useRef)(() => false);
|
|
13827
|
-
const isFooterFrameSelectionRef = (0, import_react16.useRef)(false);
|
|
13828
|
-
const refreshActiveCommandsRef = (0, import_react16.useRef)(() => {
|
|
13829
|
-
});
|
|
13830
|
-
const postToParentRef = (0, import_react16.useRef)(postToParent2);
|
|
12783
|
+
const postToParentRef = (0, import_react15.useRef)(postToParent2);
|
|
13831
12784
|
postToParentRef.current = postToParent2;
|
|
13832
|
-
const aiSectionApiRef = (0,
|
|
13833
|
-
const sectionsLoadedRef = (0,
|
|
13834
|
-
const pendingScheduleConfigRequests = (0,
|
|
13835
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
13836
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
13837
|
-
const toolbarVariantRef = (0,
|
|
12785
|
+
const aiSectionApiRef = (0, import_react15.useRef)(null);
|
|
12786
|
+
const sectionsLoadedRef = (0, import_react15.useRef)(false);
|
|
12787
|
+
const pendingScheduleConfigRequests = (0, import_react15.useRef)([]);
|
|
12788
|
+
const [toolbarRect, setToolbarRect] = (0, import_react15.useState)(null);
|
|
12789
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react15.useState)("none");
|
|
12790
|
+
const toolbarVariantRef = (0, import_react15.useRef)("none");
|
|
13838
12791
|
toolbarVariantRef.current = toolbarVariant;
|
|
13839
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
13840
|
-
const [
|
|
13841
|
-
const [
|
|
13842
|
-
const [
|
|
13843
|
-
const [
|
|
13844
|
-
const [
|
|
13845
|
-
const [
|
|
13846
|
-
const [
|
|
13847
|
-
const
|
|
13848
|
-
const [
|
|
13849
|
-
const
|
|
13850
|
-
const [
|
|
13851
|
-
const
|
|
13852
|
-
const [
|
|
13853
|
-
const
|
|
13854
|
-
const [
|
|
13855
|
-
const [
|
|
13856
|
-
const [isItemDragging, setIsItemDragging] = (0, import_react16.useState)(false);
|
|
13857
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react16.useState)(false);
|
|
12792
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react15.useState)(false);
|
|
12793
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react15.useState)(null);
|
|
12794
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react15.useState)(false);
|
|
12795
|
+
const [toggleState, setToggleState] = (0, import_react15.useState)(null);
|
|
12796
|
+
const [maxBadge, setMaxBadge] = (0, import_react15.useState)(null);
|
|
12797
|
+
const [activeCommands, setActiveCommands] = (0, import_react15.useState)(/* @__PURE__ */ new Set());
|
|
12798
|
+
const [sectionGap, setSectionGap] = (0, import_react15.useState)(null);
|
|
12799
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react15.useState)(false);
|
|
12800
|
+
const hoveredNavContainerRef = (0, import_react15.useRef)(null);
|
|
12801
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react15.useState)(null);
|
|
12802
|
+
const hoveredItemElRef = (0, import_react15.useRef)(null);
|
|
12803
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react15.useState)(null);
|
|
12804
|
+
const siblingHintElRef = (0, import_react15.useRef)(null);
|
|
12805
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react15.useState)(null);
|
|
12806
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react15.useState)([]);
|
|
12807
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react15.useState)(false);
|
|
12808
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react15.useState)(false);
|
|
13858
12809
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
13859
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0,
|
|
13860
|
-
const [footerHeadingVisible, setFooterHeadingVisible] = (0,
|
|
13861
|
-
const footerDragRef = (0,
|
|
13862
|
-
const [footerDropSlots, setFooterDropSlots] = (0,
|
|
13863
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0,
|
|
13864
|
-
const [draggedItemRect, setDraggedItemRect] = (0,
|
|
13865
|
-
const footerPointerDragRef = (0,
|
|
13866
|
-
const suppressNextClickRef = (0,
|
|
13867
|
-
const suppressClickUntilRef = (0,
|
|
13868
|
-
const [linkPopover, setLinkPopover] = (0,
|
|
13869
|
-
const linkPopoverSessionRef = (0,
|
|
13870
|
-
const addNavAfterAnchorRef = (0,
|
|
13871
|
-
const editContentRef = (0,
|
|
13872
|
-
const aiSectionsRef = (0,
|
|
13873
|
-
const pendingDeleteUndoRef = (0,
|
|
13874
|
-
const [
|
|
13875
|
-
const
|
|
13876
|
-
const
|
|
13877
|
-
const
|
|
13878
|
-
const
|
|
13879
|
-
const
|
|
13880
|
-
const
|
|
13881
|
-
const [sitePages, setSitePages] = (0, import_react16.useState)([]);
|
|
13882
|
-
const [sectionsByPath, setSectionsByPath] = (0, import_react16.useState)({});
|
|
13883
|
-
const sectionsPrefetchGenRef = (0, import_react16.useRef)(0);
|
|
13884
|
-
const setLinkPopoverRef = (0, import_react16.useRef)(setLinkPopover);
|
|
13885
|
-
const linkPopoverPanelRef = (0, import_react16.useRef)(null);
|
|
13886
|
-
const linkPopoverOpenRef = (0, import_react16.useRef)(false);
|
|
13887
|
-
const linkPopoverGraceUntilRef = (0, import_react16.useRef)(0);
|
|
12810
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react15.useState)(null);
|
|
12811
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react15.useState)(null);
|
|
12812
|
+
const footerDragRef = (0, import_react15.useRef)(null);
|
|
12813
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react15.useState)([]);
|
|
12814
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react15.useState)(null);
|
|
12815
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react15.useState)(null);
|
|
12816
|
+
const footerPointerDragRef = (0, import_react15.useRef)(null);
|
|
12817
|
+
const suppressNextClickRef = (0, import_react15.useRef)(false);
|
|
12818
|
+
const suppressClickUntilRef = (0, import_react15.useRef)(0);
|
|
12819
|
+
const [linkPopover, setLinkPopover] = (0, import_react15.useState)(null);
|
|
12820
|
+
const linkPopoverSessionRef = (0, import_react15.useRef)(null);
|
|
12821
|
+
const addNavAfterAnchorRef = (0, import_react15.useRef)(null);
|
|
12822
|
+
const editContentRef = (0, import_react15.useRef)({});
|
|
12823
|
+
const aiSectionsRef = (0, import_react15.useRef)("");
|
|
12824
|
+
const pendingDeleteUndoRef = (0, import_react15.useRef)(null);
|
|
12825
|
+
const [sitePages, setSitePages] = (0, import_react15.useState)([]);
|
|
12826
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react15.useState)({});
|
|
12827
|
+
const sectionsPrefetchGenRef = (0, import_react15.useRef)(0);
|
|
12828
|
+
const setLinkPopoverRef = (0, import_react15.useRef)(setLinkPopover);
|
|
12829
|
+
const linkPopoverPanelRef = (0, import_react15.useRef)(null);
|
|
12830
|
+
const linkPopoverOpenRef = (0, import_react15.useRef)(false);
|
|
12831
|
+
const linkPopoverGraceUntilRef = (0, import_react15.useRef)(0);
|
|
13888
12832
|
setLinkPopoverRef.current = setLinkPopover;
|
|
13889
|
-
setFloatingPanelRef.current = setFloatingPanel;
|
|
13890
12833
|
linkPopoverSessionRef.current = linkPopover;
|
|
13891
|
-
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
13892
|
-
(0, import_react16.useEffect)(() => {
|
|
13893
|
-
const syncViewport = () => {
|
|
13894
|
-
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
13895
|
-
setEditorViewport((prev) => prev === next ? prev : next);
|
|
13896
|
-
};
|
|
13897
|
-
syncViewport();
|
|
13898
|
-
window.addEventListener("resize", syncViewport);
|
|
13899
|
-
return () => window.removeEventListener("resize", syncViewport);
|
|
13900
|
-
}, []);
|
|
13901
12834
|
const {
|
|
13902
12835
|
navDragRef,
|
|
13903
12836
|
navDropSlots,
|
|
@@ -13933,7 +12866,7 @@ function OhhwellsBridge() {
|
|
|
13933
12866
|
const bumpLinkPopoverGrace = () => {
|
|
13934
12867
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
13935
12868
|
};
|
|
13936
|
-
const runSectionsPrefetch = (0,
|
|
12869
|
+
const runSectionsPrefetch = (0, import_react15.useCallback)((pages) => {
|
|
13937
12870
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
13938
12871
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
13939
12872
|
const paths = pages.map((p) => p.path);
|
|
@@ -13952,9 +12885,9 @@ function OhhwellsBridge() {
|
|
|
13952
12885
|
);
|
|
13953
12886
|
});
|
|
13954
12887
|
}, [isEditMode, pathname]);
|
|
13955
|
-
const runSectionsPrefetchRef = (0,
|
|
12888
|
+
const runSectionsPrefetchRef = (0, import_react15.useRef)(runSectionsPrefetch);
|
|
13956
12889
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
13957
|
-
(0,
|
|
12890
|
+
(0, import_react15.useEffect)(() => {
|
|
13958
12891
|
if (!linkPopover) {
|
|
13959
12892
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
13960
12893
|
return;
|
|
@@ -13982,7 +12915,7 @@ function OhhwellsBridge() {
|
|
|
13982
12915
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
13983
12916
|
};
|
|
13984
12917
|
}, [linkPopover, postToParent2]);
|
|
13985
|
-
(0,
|
|
12918
|
+
(0, import_react15.useEffect)(() => {
|
|
13986
12919
|
if (!isEditMode) return;
|
|
13987
12920
|
const useFixtures = shouldUseDevFixtures();
|
|
13988
12921
|
if (useFixtures) {
|
|
@@ -14006,14 +12939,14 @@ function OhhwellsBridge() {
|
|
|
14006
12939
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
14007
12940
|
return () => window.removeEventListener("message", onSitePages);
|
|
14008
12941
|
}, [isEditMode, postToParent2]);
|
|
14009
|
-
(0,
|
|
12942
|
+
(0, import_react15.useEffect)(() => {
|
|
14010
12943
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
14011
12944
|
void loadAllSectionsManifest().then((manifest) => {
|
|
14012
12945
|
if (Object.keys(manifest).length === 0) return;
|
|
14013
12946
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
14014
12947
|
});
|
|
14015
12948
|
}, [isEditMode]);
|
|
14016
|
-
(0,
|
|
12949
|
+
(0, import_react15.useEffect)(() => {
|
|
14017
12950
|
const update = () => {
|
|
14018
12951
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
14019
12952
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -14037,10 +12970,10 @@ function OhhwellsBridge() {
|
|
|
14037
12970
|
vvp.removeEventListener("resize", update);
|
|
14038
12971
|
};
|
|
14039
12972
|
}, []);
|
|
14040
|
-
const refreshStateRules = (0,
|
|
12973
|
+
const refreshStateRules = (0, import_react15.useCallback)(() => {
|
|
14041
12974
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
14042
12975
|
}, []);
|
|
14043
|
-
const processConfigRequest = (0,
|
|
12976
|
+
const processConfigRequest = (0, import_react15.useCallback)((insertAfterVal) => {
|
|
14044
12977
|
const tracker = getSectionsTracker();
|
|
14045
12978
|
let entries = [];
|
|
14046
12979
|
try {
|
|
@@ -14063,7 +12996,7 @@ function OhhwellsBridge() {
|
|
|
14063
12996
|
}
|
|
14064
12997
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
14065
12998
|
}, [isEditMode]);
|
|
14066
|
-
const deactivate = (0,
|
|
12999
|
+
const deactivate = (0, import_react15.useCallback)(() => {
|
|
14067
13000
|
const el = activeElRef.current;
|
|
14068
13001
|
if (!el) return;
|
|
14069
13002
|
const key = el.dataset.ohwKey;
|
|
@@ -14096,19 +13029,17 @@ function OhhwellsBridge() {
|
|
|
14096
13029
|
setToolbarShowEditLink(false);
|
|
14097
13030
|
postToParent2({ type: "ow:exit-edit" });
|
|
14098
13031
|
}, [postToParent2]);
|
|
14099
|
-
const clearSelectedAttr = (0,
|
|
13032
|
+
const clearSelectedAttr = (0, import_react15.useCallback)(() => {
|
|
14100
13033
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
14101
13034
|
el.removeAttribute("data-ohw-selected");
|
|
14102
13035
|
});
|
|
14103
13036
|
}, []);
|
|
14104
|
-
const deselect = (0,
|
|
13037
|
+
const deselect = (0, import_react15.useCallback)(() => {
|
|
14105
13038
|
clearSelectedAttr();
|
|
14106
13039
|
selectedElRef.current = null;
|
|
14107
13040
|
selectedHrefKeyRef.current = null;
|
|
14108
13041
|
selectedFooterColAttrRef.current = null;
|
|
14109
13042
|
setSelectedIsCta(false);
|
|
14110
|
-
setSelectedIsSocial(false);
|
|
14111
|
-
setSelectedIsSocialsRow(false);
|
|
14112
13043
|
setReorderHrefKey(null);
|
|
14113
13044
|
setReorderDragDisabled(false);
|
|
14114
13045
|
setIsFooterFrameSelection(false);
|
|
@@ -14120,21 +13051,17 @@ function OhhwellsBridge() {
|
|
|
14120
13051
|
setIsItemDragging(false);
|
|
14121
13052
|
hoveredNavContainerRef.current = null;
|
|
14122
13053
|
setHoveredNavContainerRect(null);
|
|
14123
|
-
hoveredItemElRef.current = null;
|
|
14124
|
-
setHoveredItemRect(null);
|
|
14125
|
-
setFloatingPanel(null);
|
|
14126
|
-
setLogoSizeDraft(null);
|
|
14127
13054
|
if (!activeElRef.current) {
|
|
14128
13055
|
setNavGroupForceOpen(null, false);
|
|
14129
13056
|
setToolbarRect(null);
|
|
14130
13057
|
setToolbarVariant("none");
|
|
14131
13058
|
}
|
|
14132
13059
|
}, [clearSelectedAttr]);
|
|
14133
|
-
const markSelected = (0,
|
|
13060
|
+
const markSelected = (0, import_react15.useCallback)((el) => {
|
|
14134
13061
|
clearSelectedAttr();
|
|
14135
13062
|
el.setAttribute("data-ohw-selected", "");
|
|
14136
13063
|
}, [clearSelectedAttr]);
|
|
14137
|
-
const resolveHrefKeyElement = (0,
|
|
13064
|
+
const resolveHrefKeyElement = (0, import_react15.useCallback)((hrefKey) => {
|
|
14138
13065
|
if (isFooterHrefKey(hrefKey)) {
|
|
14139
13066
|
return document.querySelector(
|
|
14140
13067
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -14149,7 +13076,7 @@ function OhhwellsBridge() {
|
|
|
14149
13076
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
14150
13077
|
);
|
|
14151
13078
|
}, []);
|
|
14152
|
-
const resyncSelectedNavigationItem = (0,
|
|
13079
|
+
const resyncSelectedNavigationItem = (0, import_react15.useCallback)(() => {
|
|
14153
13080
|
const hrefKey = selectedHrefKeyRef.current;
|
|
14154
13081
|
if (hrefKey) {
|
|
14155
13082
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -14187,14 +13114,12 @@ function OhhwellsBridge() {
|
|
|
14187
13114
|
);
|
|
14188
13115
|
}
|
|
14189
13116
|
}, [resolveHrefKeyElement]);
|
|
14190
|
-
const reselectNavigationItem = (0,
|
|
13117
|
+
const reselectNavigationItem = (0, import_react15.useCallback)((navAnchor) => {
|
|
14191
13118
|
selectedElRef.current = navAnchor;
|
|
14192
13119
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
14193
13120
|
selectedFooterColAttrRef.current = null;
|
|
14194
13121
|
markSelected(navAnchor);
|
|
14195
13122
|
setSelectedIsCta(isCtaButton(navAnchor));
|
|
14196
|
-
setSelectedIsSocial(Boolean(getSocialItem(navAnchor)));
|
|
14197
|
-
setSelectedIsSocialsRow(false);
|
|
14198
13123
|
const isDropdownTrigger = !isNestedNavChild(navAnchor) && (navItemHasDropdownChildren(navAnchor) || navItemOwnsDropdownPanel(navAnchor));
|
|
14199
13124
|
if (isNestedNavChild(navAnchor)) {
|
|
14200
13125
|
setNavGroupForceOpen(navAnchor, true);
|
|
@@ -14218,7 +13143,7 @@ function OhhwellsBridge() {
|
|
|
14218
13143
|
setToolbarShowEditLink(false);
|
|
14219
13144
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
14220
13145
|
}, [markSelected]);
|
|
14221
|
-
const commitNavigationTextEdit = (0,
|
|
13146
|
+
const commitNavigationTextEdit = (0, import_react15.useCallback)((navAnchor) => {
|
|
14222
13147
|
const el = activeElRef.current;
|
|
14223
13148
|
if (!el) return;
|
|
14224
13149
|
const key = el.dataset.ohwKey;
|
|
@@ -14245,7 +13170,7 @@ function OhhwellsBridge() {
|
|
|
14245
13170
|
postToParent2({ type: "ow:exit-edit" });
|
|
14246
13171
|
reselectNavigationItem(navAnchor);
|
|
14247
13172
|
}, [postToParent2, reselectNavigationItem]);
|
|
14248
|
-
const handleAddTopLevelNavItem = (0,
|
|
13173
|
+
const handleAddTopLevelNavItem = (0, import_react15.useCallback)(() => {
|
|
14249
13174
|
const items = listNavbarRootItems();
|
|
14250
13175
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
14251
13176
|
deselectRef.current();
|
|
@@ -14257,7 +13182,7 @@ function OhhwellsBridge() {
|
|
|
14257
13182
|
intent: "add-nav"
|
|
14258
13183
|
});
|
|
14259
13184
|
}, []);
|
|
14260
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
13185
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react15.useCallback)(
|
|
14261
13186
|
(anchor) => {
|
|
14262
13187
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
14263
13188
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -14270,7 +13195,7 @@ function OhhwellsBridge() {
|
|
|
14270
13195
|
},
|
|
14271
13196
|
[postToParent2]
|
|
14272
13197
|
);
|
|
14273
|
-
const handleNavDropdownOpenChange = (0,
|
|
13198
|
+
const handleNavDropdownOpenChange = (0, import_react15.useCallback)((open) => {
|
|
14274
13199
|
const selected = selectedElRef.current;
|
|
14275
13200
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
14276
13201
|
setNavGroupForceOpen(selected, open);
|
|
@@ -14282,7 +13207,7 @@ function OhhwellsBridge() {
|
|
|
14282
13207
|
}
|
|
14283
13208
|
});
|
|
14284
13209
|
}, []);
|
|
14285
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
13210
|
+
const handleFooterHeadingVisibleChange = (0, import_react15.useCallback)(
|
|
14286
13211
|
(visible) => {
|
|
14287
13212
|
const selected = selectedElRef.current;
|
|
14288
13213
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -14306,7 +13231,7 @@ function OhhwellsBridge() {
|
|
|
14306
13231
|
},
|
|
14307
13232
|
[postToParent2]
|
|
14308
13233
|
);
|
|
14309
|
-
const enterEditOnNewItem = (0,
|
|
13234
|
+
const enterEditOnNewItem = (0, import_react15.useCallback)((anchor) => {
|
|
14310
13235
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
14311
13236
|
if (!label) {
|
|
14312
13237
|
selectRef.current(anchor);
|
|
@@ -14315,30 +13240,9 @@ function OhhwellsBridge() {
|
|
|
14315
13240
|
setNavGroupForceOpen(anchor, true);
|
|
14316
13241
|
activateRef.current(label);
|
|
14317
13242
|
}, []);
|
|
14318
|
-
const handleAddChildItem = (0,
|
|
13243
|
+
const handleAddChildItem = (0, import_react15.useCallback)(() => {
|
|
14319
13244
|
const selected = selectedElRef.current;
|
|
14320
13245
|
if (!selected) return;
|
|
14321
|
-
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
14322
|
-
if (socialsRow) {
|
|
14323
|
-
const after = getSocialItem(selected);
|
|
14324
|
-
const result2 = insertSocialItem(socialsRow, after, editContentRef.current);
|
|
14325
|
-
if (!result2) return;
|
|
14326
|
-
const orderJson = JSON.stringify(result2.order);
|
|
14327
|
-
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14328
|
-
postToParent2({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
14329
|
-
postToParentRef.current({
|
|
14330
|
-
type: "ow:social-pick",
|
|
14331
|
-
hrefKey: result2.hrefKey,
|
|
14332
|
-
iconKey: result2.iconKey,
|
|
14333
|
-
url: "",
|
|
14334
|
-
iconStyle: detectIconStyle(result2.item),
|
|
14335
|
-
platformId: "",
|
|
14336
|
-
// Lets the editor undo the insert if the dialog is dismissed: an item that was never given
|
|
14337
|
-
// an address should not survive a Cancel.
|
|
14338
|
-
isNew: true
|
|
14339
|
-
});
|
|
14340
|
-
return;
|
|
14341
|
-
}
|
|
14342
13246
|
if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
|
|
14343
13247
|
if (!selected.hasAttribute("data-ohw-footer-col") && !selected.closest("[data-ohw-footer-col]")) {
|
|
14344
13248
|
}
|
|
@@ -14412,7 +13316,7 @@ function OhhwellsBridge() {
|
|
|
14412
13316
|
enterEditOnNewItem(result.anchor);
|
|
14413
13317
|
});
|
|
14414
13318
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
14415
|
-
const handleAddFooterColumn = (0,
|
|
13319
|
+
const handleAddFooterColumn = (0, import_react15.useCallback)(() => {
|
|
14416
13320
|
if (!canAddFooterColumn()) {
|
|
14417
13321
|
postToParent2({
|
|
14418
13322
|
type: "ow:toast",
|
|
@@ -14433,7 +13337,7 @@ function OhhwellsBridge() {
|
|
|
14433
13337
|
selectRef.current(result.firstLink);
|
|
14434
13338
|
});
|
|
14435
13339
|
}, [postToParent2]);
|
|
14436
|
-
const clearFooterDragVisuals = (0,
|
|
13340
|
+
const clearFooterDragVisuals = (0, import_react15.useCallback)(() => {
|
|
14437
13341
|
footerDragRef.current = null;
|
|
14438
13342
|
setSiblingHintRects([]);
|
|
14439
13343
|
setFooterDropSlots([]);
|
|
@@ -14442,7 +13346,7 @@ function OhhwellsBridge() {
|
|
|
14442
13346
|
setIsItemDragging(false);
|
|
14443
13347
|
unlockFooterDragInteraction();
|
|
14444
13348
|
}, []);
|
|
14445
|
-
const refreshFooterDragVisuals = (0,
|
|
13349
|
+
const refreshFooterDragVisuals = (0, import_react15.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
14446
13350
|
const dragged = session.draggedEl;
|
|
14447
13351
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
14448
13352
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -14451,13 +13355,6 @@ function OhhwellsBridge() {
|
|
|
14451
13355
|
}
|
|
14452
13356
|
session.activeSlot = activeSlot;
|
|
14453
13357
|
setSiblingHintRects([]);
|
|
14454
|
-
if (session.kind === "social") {
|
|
14455
|
-
const slots2 = session.hrefKey ? buildSocialDropSlotsForKey(session.hrefKey) : [];
|
|
14456
|
-
setFooterDropSlots(slots2);
|
|
14457
|
-
const activeIdx2 = activeSlot ? slots2.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
14458
|
-
setActiveFooterDropIndex(activeIdx2 >= 0 ? activeIdx2 : null);
|
|
14459
|
-
return;
|
|
14460
|
-
}
|
|
14461
13358
|
if (session.kind === "link") {
|
|
14462
13359
|
const columns = listFooterColumns();
|
|
14463
13360
|
const slots2 = [];
|
|
@@ -14474,13 +13371,13 @@ function OhhwellsBridge() {
|
|
|
14474
13371
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
14475
13372
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
14476
13373
|
}, []);
|
|
14477
|
-
const refreshFooterDragVisualsRef = (0,
|
|
13374
|
+
const refreshFooterDragVisualsRef = (0, import_react15.useRef)(refreshFooterDragVisuals);
|
|
14478
13375
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
14479
|
-
const commitFooterDragRef = (0,
|
|
13376
|
+
const commitFooterDragRef = (0, import_react15.useRef)(() => {
|
|
14480
13377
|
});
|
|
14481
|
-
const beginFooterDragRef = (0,
|
|
13378
|
+
const beginFooterDragRef = (0, import_react15.useRef)(() => {
|
|
14482
13379
|
});
|
|
14483
|
-
const beginFooterDrag = (0,
|
|
13380
|
+
const beginFooterDrag = (0, import_react15.useCallback)(
|
|
14484
13381
|
(session) => {
|
|
14485
13382
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
14486
13383
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -14494,13 +13391,13 @@ function OhhwellsBridge() {
|
|
|
14494
13391
|
if (session.wasSelected && selectedElRef.current === session.draggedEl) {
|
|
14495
13392
|
setToolbarRect(rect);
|
|
14496
13393
|
}
|
|
14497
|
-
const initialSlot = session.kind === "
|
|
13394
|
+
const initialSlot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
14498
13395
|
refreshFooterDragVisuals(session, initialSlot, session.lastClientX, session.lastClientY);
|
|
14499
13396
|
},
|
|
14500
13397
|
[refreshFooterDragVisuals]
|
|
14501
13398
|
);
|
|
14502
13399
|
beginFooterDragRef.current = beginFooterDrag;
|
|
14503
|
-
const commitFooterDrag = (0,
|
|
13400
|
+
const commitFooterDrag = (0, import_react15.useCallback)(
|
|
14504
13401
|
(clientX, clientY) => {
|
|
14505
13402
|
const session = footerDragRef.current;
|
|
14506
13403
|
if (!session) {
|
|
@@ -14510,11 +13407,8 @@ function OhhwellsBridge() {
|
|
|
14510
13407
|
const x = typeof clientX === "number" && (clientX !== 0 || clientY !== 0) ? clientX : session.lastClientX;
|
|
14511
13408
|
const y = typeof clientY === "number" && (clientX !== 0 || clientY !== 0) ? clientY : session.lastClientY;
|
|
14512
13409
|
let nextOrder = null;
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
if (session.kind === "social" && session.hrefKey && slot) {
|
|
14516
|
-
nextSocialsOrder = planSocialMove(session.hrefKey, slot.insertIndex);
|
|
14517
|
-
} else if (session.kind === "link" && session.hrefKey && slot) {
|
|
13410
|
+
const slot = session.activeSlot ?? (session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(x, y, session.hrefKey) : session.kind === "column" ? hitTestColumnDropSlot(x, y) : null);
|
|
13411
|
+
if (session.kind === "link" && session.hrefKey && slot) {
|
|
14518
13412
|
nextOrder = planFooterLinkMove(session.hrefKey, slot.columnIndex, slot.insertIndex);
|
|
14519
13413
|
} else if (session.kind === "column" && slot) {
|
|
14520
13414
|
nextOrder = planFooterColumnMove(session.sourceColumnIndex, slot.insertIndex);
|
|
@@ -14572,27 +13466,6 @@ function OhhwellsBridge() {
|
|
|
14572
13466
|
}
|
|
14573
13467
|
deselectRef.current();
|
|
14574
13468
|
};
|
|
14575
|
-
if (nextSocialsOrder) {
|
|
14576
|
-
const orderJson = JSON.stringify(nextSocialsOrder);
|
|
14577
|
-
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14578
|
-
applySocialsOrder(nextSocialsOrder);
|
|
14579
|
-
postToParentRef.current({
|
|
14580
|
-
type: "ow:change",
|
|
14581
|
-
nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }]
|
|
14582
|
-
});
|
|
14583
|
-
applySelectionAfterDrop();
|
|
14584
|
-
clearFooterDragVisuals();
|
|
14585
|
-
const reapply = nextSocialsOrder;
|
|
14586
|
-
requestAnimationFrame(() => {
|
|
14587
|
-
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14588
|
-
applySelectionAfterDrop();
|
|
14589
|
-
requestAnimationFrame(() => {
|
|
14590
|
-
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14591
|
-
resyncSelectedNavigationItem();
|
|
14592
|
-
});
|
|
14593
|
-
});
|
|
14594
|
-
return;
|
|
14595
|
-
}
|
|
14596
13469
|
if (nextOrder) {
|
|
14597
13470
|
const orderJson = JSON.stringify(nextOrder);
|
|
14598
13471
|
editContentRef.current = {
|
|
@@ -14628,25 +13501,10 @@ function OhhwellsBridge() {
|
|
|
14628
13501
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
14629
13502
|
);
|
|
14630
13503
|
commitFooterDragRef.current = commitFooterDrag;
|
|
14631
|
-
const startFooterLinkDrag = (0,
|
|
13504
|
+
const startFooterLinkDrag = (0, import_react15.useCallback)(
|
|
14632
13505
|
(anchor, clientX, clientY, wasSelected) => {
|
|
14633
13506
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
14634
|
-
if (!hrefKey) return false;
|
|
14635
|
-
if (getSocialItem(anchor)) {
|
|
14636
|
-
beginFooterDrag({
|
|
14637
|
-
kind: "social",
|
|
14638
|
-
hrefKey,
|
|
14639
|
-
columnEl: null,
|
|
14640
|
-
sourceColumnIndex: 0,
|
|
14641
|
-
wasSelected,
|
|
14642
|
-
draggedEl: anchor,
|
|
14643
|
-
lastClientX: clientX,
|
|
14644
|
-
lastClientY: clientY,
|
|
14645
|
-
activeSlot: null
|
|
14646
|
-
});
|
|
14647
|
-
return true;
|
|
14648
|
-
}
|
|
14649
|
-
if (!isFooterHrefKey(hrefKey)) return false;
|
|
13507
|
+
if (!hrefKey || !isFooterHrefKey(hrefKey)) return false;
|
|
14650
13508
|
const column = findFooterColumnForLink(anchor);
|
|
14651
13509
|
const columns = listFooterColumns();
|
|
14652
13510
|
beginFooterDrag({
|
|
@@ -14664,7 +13522,7 @@ function OhhwellsBridge() {
|
|
|
14664
13522
|
},
|
|
14665
13523
|
[beginFooterDrag]
|
|
14666
13524
|
);
|
|
14667
|
-
const startFooterColumnDrag = (0,
|
|
13525
|
+
const startFooterColumnDrag = (0, import_react15.useCallback)(
|
|
14668
13526
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
14669
13527
|
const columns = listFooterColumns();
|
|
14670
13528
|
const idx = columns.indexOf(columnEl);
|
|
@@ -14684,7 +13542,7 @@ function OhhwellsBridge() {
|
|
|
14684
13542
|
},
|
|
14685
13543
|
[beginFooterDrag]
|
|
14686
13544
|
);
|
|
14687
|
-
const handleItemDragStart = (0,
|
|
13545
|
+
const handleItemDragStart = (0, import_react15.useCallback)(
|
|
14688
13546
|
(e) => {
|
|
14689
13547
|
const selected = selectedElRef.current;
|
|
14690
13548
|
if (!selected) {
|
|
@@ -14704,7 +13562,7 @@ function OhhwellsBridge() {
|
|
|
14704
13562
|
},
|
|
14705
13563
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
|
|
14706
13564
|
);
|
|
14707
|
-
const handleItemDragEnd = (0,
|
|
13565
|
+
const handleItemDragEnd = (0, import_react15.useCallback)(
|
|
14708
13566
|
(e) => {
|
|
14709
13567
|
if (footerDragRef.current) {
|
|
14710
13568
|
const x = e?.clientX;
|
|
@@ -14730,7 +13588,7 @@ function OhhwellsBridge() {
|
|
|
14730
13588
|
},
|
|
14731
13589
|
[commitFooterDrag, commitNavDrag, navDragRef]
|
|
14732
13590
|
);
|
|
14733
|
-
const handleItemChromePointerDown = (0,
|
|
13591
|
+
const handleItemChromePointerDown = (0, import_react15.useCallback)((e) => {
|
|
14734
13592
|
if (e.button !== 0) return;
|
|
14735
13593
|
const selected = selectedElRef.current;
|
|
14736
13594
|
if (!selected) return;
|
|
@@ -14761,7 +13619,7 @@ function OhhwellsBridge() {
|
|
|
14761
13619
|
}
|
|
14762
13620
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
14763
13621
|
}, [armNavPressFromChrome]);
|
|
14764
|
-
const handleItemChromeClick = (0,
|
|
13622
|
+
const handleItemChromeClick = (0, import_react15.useCallback)((clientX, clientY) => {
|
|
14765
13623
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
14766
13624
|
suppressNextClickRef.current = false;
|
|
14767
13625
|
return;
|
|
@@ -14774,7 +13632,7 @@ function OhhwellsBridge() {
|
|
|
14774
13632
|
}, []);
|
|
14775
13633
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
14776
13634
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
14777
|
-
const select = (0,
|
|
13635
|
+
const select = (0, import_react15.useCallback)((anchor) => {
|
|
14778
13636
|
if (!isNavigationItem2(anchor)) return;
|
|
14779
13637
|
if (activeElRef.current) deactivate();
|
|
14780
13638
|
aiSectionApiRef.current?.selectFromElement(anchor);
|
|
@@ -14783,8 +13641,6 @@ function OhhwellsBridge() {
|
|
|
14783
13641
|
selectedFooterColAttrRef.current = null;
|
|
14784
13642
|
markSelected(anchor);
|
|
14785
13643
|
setSelectedIsCta(isCtaButton(anchor));
|
|
14786
|
-
setSelectedIsSocial(Boolean(getSocialItem(anchor)));
|
|
14787
|
-
setSelectedIsSocialsRow(false);
|
|
14788
13644
|
clearHrefKeyHover(anchor);
|
|
14789
13645
|
const isDropdownTrigger = !isNestedNavChild(anchor) && (navItemHasDropdownChildren(anchor) || navItemOwnsDropdownPanel(anchor));
|
|
14790
13646
|
if (isNestedNavChild(anchor)) {
|
|
@@ -14814,10 +13670,8 @@ function OhhwellsBridge() {
|
|
|
14814
13670
|
setToolbarRect(anchor.getBoundingClientRect());
|
|
14815
13671
|
setToolbarShowEditLink(false);
|
|
14816
13672
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
14817
|
-
setFloatingPanel(null);
|
|
14818
|
-
setLogoSizeDraft(null);
|
|
14819
13673
|
}, [deactivate, markSelected]);
|
|
14820
|
-
const selectFrame = (0,
|
|
13674
|
+
const selectFrame = (0, import_react15.useCallback)((el) => {
|
|
14821
13675
|
if (!isNavigationContainer(el)) return;
|
|
14822
13676
|
if (activeElRef.current) deactivate();
|
|
14823
13677
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -14827,8 +13681,6 @@ function OhhwellsBridge() {
|
|
|
14827
13681
|
selectedFooterColAttrRef.current = isFooterColumn ? el.getAttribute("data-ohw-footer-col") ?? String(listFooterColumns().indexOf(el)) : null;
|
|
14828
13682
|
markSelected(el);
|
|
14829
13683
|
setSelectedIsCta(false);
|
|
14830
|
-
setSelectedIsSocial(false);
|
|
14831
|
-
setSelectedIsSocialsRow(isSocialsRow(el));
|
|
14832
13684
|
clearHrefKeyHover(el);
|
|
14833
13685
|
setNavGroupForceOpen(null, false);
|
|
14834
13686
|
hoveredNavContainerRef.current = null;
|
|
@@ -14865,112 +13717,14 @@ function OhhwellsBridge() {
|
|
|
14865
13717
|
setToolbarRect(el.getBoundingClientRect());
|
|
14866
13718
|
setToolbarShowEditLink(false);
|
|
14867
13719
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
14868
|
-
setFloatingPanel(null);
|
|
14869
|
-
setLogoSizeDraft(null);
|
|
14870
13720
|
}, [deactivate, markSelected, postToParent2]);
|
|
14871
|
-
const
|
|
14872
|
-
(logoEl) => {
|
|
14873
|
-
if (activeElRef.current) deactivate();
|
|
14874
|
-
selectedElRef.current = logoEl;
|
|
14875
|
-
selectedHrefKeyRef.current = null;
|
|
14876
|
-
selectedFooterColAttrRef.current = null;
|
|
14877
|
-
markSelected(logoEl);
|
|
14878
|
-
setSelectedIsCta(false);
|
|
14879
|
-
setSelectedIsSocial(false);
|
|
14880
|
-
setSelectedIsSocialsRow(false);
|
|
14881
|
-
setSelectedIsSocialsRow(false);
|
|
14882
|
-
clearHrefKeyHover(logoEl);
|
|
14883
|
-
hoveredNavContainerRef.current = null;
|
|
14884
|
-
setHoveredNavContainerRect(null);
|
|
14885
|
-
setHoveredItemRect(null);
|
|
14886
|
-
hoveredItemElRef.current = null;
|
|
14887
|
-
siblingHintElRef.current = null;
|
|
14888
|
-
setSiblingHintRect(null);
|
|
14889
|
-
setSiblingHintRects([]);
|
|
14890
|
-
setIsItemDragging(false);
|
|
14891
|
-
setReorderHrefKey(null);
|
|
14892
|
-
setReorderDragDisabled(false);
|
|
14893
|
-
setIsFooterFrameSelection(false);
|
|
14894
|
-
setToolbarVariant("logo");
|
|
14895
|
-
setToolbarRect(getLogoInteractionRect(logoEl));
|
|
14896
|
-
setToolbarShowEditLink(false);
|
|
14897
|
-
setActiveCommands(/* @__PURE__ */ new Set());
|
|
14898
|
-
},
|
|
14899
|
-
[deactivate, markSelected]
|
|
14900
|
-
);
|
|
14901
|
-
const openLogoSizePanel = (0, import_react16.useCallback)((logoEl) => {
|
|
14902
|
-
const placement = getLogoPlacement(logoEl);
|
|
14903
|
-
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
14904
|
-
setLogoSizeDraft(draft);
|
|
14905
|
-
setParentScrollSnap(parentScrollRef.current);
|
|
14906
|
-
setFloatingPanel({
|
|
14907
|
-
key: `logo-size:${placement}`,
|
|
14908
|
-
title: "Logo",
|
|
14909
|
-
context: placement === "navbar" ? "Navbar" : "Footer",
|
|
14910
|
-
kind: "logo-size",
|
|
14911
|
-
placement
|
|
14912
|
-
});
|
|
14913
|
-
}, []);
|
|
14914
|
-
const closeFloatingPanelOnly = (0, import_react16.useCallback)(() => {
|
|
14915
|
-
setFloatingPanel(null);
|
|
14916
|
-
setLogoSizeDraft(null);
|
|
14917
|
-
}, []);
|
|
14918
|
-
const closeFloatingPanelAndDeselect = (0, import_react16.useCallback)(() => {
|
|
14919
|
-
setFloatingPanel(null);
|
|
14920
|
-
setLogoSizeDraft(null);
|
|
14921
|
-
deselectRef.current();
|
|
14922
|
-
}, []);
|
|
14923
|
-
const persistLogoSizeDraft = (0, import_react16.useCallback)(
|
|
14924
|
-
(placement, draft) => {
|
|
14925
|
-
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
14926
|
-
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
14927
|
-
const nodes = [
|
|
14928
|
-
{ key: desktopKey, text: String(draft.desktopPx) }
|
|
14929
|
-
];
|
|
14930
|
-
if (draft.mobileFollowing) {
|
|
14931
|
-
nodes.push({ key: mobileKey, text: "" });
|
|
14932
|
-
} else {
|
|
14933
|
-
nodes.push({ key: mobileKey, text: String(draft.mobilePx) });
|
|
14934
|
-
}
|
|
14935
|
-
editContentRef.current = {
|
|
14936
|
-
...editContentRef.current,
|
|
14937
|
-
[desktopKey]: String(draft.desktopPx),
|
|
14938
|
-
[mobileKey]: draft.mobileFollowing ? "" : String(draft.mobilePx)
|
|
14939
|
-
};
|
|
14940
|
-
applyLogoSizeToPlacement(
|
|
14941
|
-
placement,
|
|
14942
|
-
draft.desktopPx,
|
|
14943
|
-
draft.mobileFollowing ? draft.desktopPx : draft.mobilePx,
|
|
14944
|
-
draft.mobileFollowing
|
|
14945
|
-
);
|
|
14946
|
-
postToParent2({ type: "ow:change", nodes });
|
|
14947
|
-
requestAnimationFrame(() => {
|
|
14948
|
-
const selected = selectedElRef.current;
|
|
14949
|
-
if (!selected || toolbarVariantRef.current !== "logo") return;
|
|
14950
|
-
const rect = getLogoInteractionRect(selected);
|
|
14951
|
-
setToolbarRect(rect);
|
|
14952
|
-
if (glowElRef.current) {
|
|
14953
|
-
const GAP = SELECTION_CHROME_GAP2;
|
|
14954
|
-
glowElRef.current.style.top = `${rect.top - GAP}px`;
|
|
14955
|
-
glowElRef.current.style.left = `${rect.left - GAP}px`;
|
|
14956
|
-
glowElRef.current.style.width = `${rect.width + GAP * 2}px`;
|
|
14957
|
-
glowElRef.current.style.height = `${rect.height + GAP * 2}px`;
|
|
14958
|
-
}
|
|
14959
|
-
});
|
|
14960
|
-
},
|
|
14961
|
-
[postToParent2]
|
|
14962
|
-
);
|
|
14963
|
-
const activate = (0, import_react16.useCallback)((el, options) => {
|
|
13721
|
+
const activate = (0, import_react15.useCallback)((el, options) => {
|
|
14964
13722
|
if (activeElRef.current === el) return;
|
|
14965
|
-
if (isIconEditable(el)) return;
|
|
14966
|
-
if (el.hasAttribute("data-ohw-social-label")) return;
|
|
14967
13723
|
clearSelectedAttr();
|
|
14968
13724
|
selectedElRef.current = null;
|
|
14969
13725
|
selectedHrefKeyRef.current = null;
|
|
14970
13726
|
selectedFooterColAttrRef.current = null;
|
|
14971
13727
|
setSelectedIsCta(false);
|
|
14972
|
-
setSelectedIsSocial(false);
|
|
14973
|
-
setSelectedIsSocialsRow(false);
|
|
14974
13728
|
deactivate();
|
|
14975
13729
|
if (hoveredImageRef.current) {
|
|
14976
13730
|
hoveredImageRef.current = null;
|
|
@@ -15040,38 +13794,8 @@ function OhhwellsBridge() {
|
|
|
15040
13794
|
deactivateRef.current = deactivate;
|
|
15041
13795
|
selectRef.current = select;
|
|
15042
13796
|
selectFrameRef.current = selectFrame;
|
|
15043
|
-
selectLogoRef.current = selectLogo;
|
|
15044
|
-
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
15045
13797
|
deselectRef.current = deselect;
|
|
15046
|
-
|
|
15047
|
-
const lastSiteWideScopeRef = (0, import_react16.useRef)(null);
|
|
15048
|
-
(0, import_react16.useEffect)(() => {
|
|
15049
|
-
if (!isEditMode) {
|
|
15050
|
-
if (lastSiteWideScopeRef.current !== false) {
|
|
15051
|
-
lastSiteWideScopeRef.current = false;
|
|
15052
|
-
postToParent2({ type: "ow:site-wide-scope", active: false });
|
|
15053
|
-
}
|
|
15054
|
-
return;
|
|
15055
|
-
}
|
|
15056
|
-
const active = isSiteWideScopeActive({
|
|
15057
|
-
selected: selectedElRef.current,
|
|
15058
|
-
hoveredItem: hoveredItemElRef.current,
|
|
15059
|
-
hoveredNavContainer: hoveredNavContainerRef.current,
|
|
15060
|
-
active: activeElRef.current
|
|
15061
|
-
});
|
|
15062
|
-
if (lastSiteWideScopeRef.current === active) return;
|
|
15063
|
-
lastSiteWideScopeRef.current = active;
|
|
15064
|
-
postToParent2({ type: "ow:site-wide-scope", active });
|
|
15065
|
-
}, [
|
|
15066
|
-
isEditMode,
|
|
15067
|
-
hoveredItemRect,
|
|
15068
|
-
hoveredNavContainerRect,
|
|
15069
|
-
toolbarVariant,
|
|
15070
|
-
toolbarRect,
|
|
15071
|
-
isFooterFrameSelection,
|
|
15072
|
-
postToParent2
|
|
15073
|
-
]);
|
|
15074
|
-
(0, import_react16.useLayoutEffect)(() => {
|
|
13798
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
15075
13799
|
if (!subdomain || isEditMode) {
|
|
15076
13800
|
setFetchState("done");
|
|
15077
13801
|
return;
|
|
@@ -15085,8 +13809,6 @@ function OhhwellsBridge() {
|
|
|
15085
13809
|
for (const [key, val] of Object.entries(content)) {
|
|
15086
13810
|
if (key === "__ohw_sections") continue;
|
|
15087
13811
|
if (key === AI_SECTIONS_KEY) continue;
|
|
15088
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
15089
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
15090
13812
|
if (applyVideoSettingNode(key, val)) continue;
|
|
15091
13813
|
if (applyCarouselNode(key, val)) continue;
|
|
15092
13814
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -15113,19 +13835,14 @@ function OhhwellsBridge() {
|
|
|
15113
13835
|
}
|
|
15114
13836
|
} else if (el.dataset.ohwEditable === "link") {
|
|
15115
13837
|
applyLinkHref(el, val);
|
|
15116
|
-
} else if (el.dataset.ohwEditable === "icon") {
|
|
15117
|
-
applyIconMarkup(el, val);
|
|
15118
13838
|
} else if (el.innerHTML !== val) {
|
|
15119
13839
|
el.innerHTML = val;
|
|
15120
13840
|
}
|
|
15121
13841
|
});
|
|
15122
13842
|
applyLinkByKey(key, val);
|
|
15123
13843
|
}
|
|
15124
|
-
applyLogoFromContent(content);
|
|
15125
|
-
applyLogoSizes(content);
|
|
15126
13844
|
reconcileNavbarItemsFromContent(content);
|
|
15127
13845
|
reconcileFooterOrderFromContent(content);
|
|
15128
|
-
reconcileSocialsFromContent(content);
|
|
15129
13846
|
enforceLinkHrefs();
|
|
15130
13847
|
initSectionsFromContent(content, true);
|
|
15131
13848
|
sectionsLoadedRef.current = true;
|
|
@@ -15141,9 +13858,7 @@ function OhhwellsBridge() {
|
|
|
15141
13858
|
let cancelled = false;
|
|
15142
13859
|
setFetchState("loading");
|
|
15143
13860
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
15144
|
-
|
|
15145
|
-
fetchedContentPaths.add(`${subdomain}::${initialPath}`);
|
|
15146
|
-
fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(initialPath)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
13861
|
+
fetch(`${apiUrl}/api/public/sites/${subdomain}/content`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
15147
13862
|
if (cancelled) return;
|
|
15148
13863
|
const content = data?.content ?? {};
|
|
15149
13864
|
contentCache.set(subdomain, content);
|
|
@@ -15156,7 +13871,7 @@ function OhhwellsBridge() {
|
|
|
15156
13871
|
cancelled = true;
|
|
15157
13872
|
};
|
|
15158
13873
|
}, [subdomain, isEditMode]);
|
|
15159
|
-
(0,
|
|
13874
|
+
(0, import_react15.useEffect)(() => {
|
|
15160
13875
|
if (!subdomain || isEditMode) return;
|
|
15161
13876
|
let debounceTimer = null;
|
|
15162
13877
|
let observer = null;
|
|
@@ -15168,8 +13883,6 @@ function OhhwellsBridge() {
|
|
|
15168
13883
|
try {
|
|
15169
13884
|
for (const [key, val] of Object.entries(content)) {
|
|
15170
13885
|
if (key === "__ohw_sections") continue;
|
|
15171
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
15172
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
15173
13886
|
if (applyVideoSettingNode(key, val)) continue;
|
|
15174
13887
|
if (applyCarouselNode(key, val)) continue;
|
|
15175
13888
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -15190,10 +13903,8 @@ function OhhwellsBridge() {
|
|
|
15190
13903
|
});
|
|
15191
13904
|
applyLinkByKey(key, val);
|
|
15192
13905
|
}
|
|
15193
|
-
applyLogoFromContent(content);
|
|
15194
13906
|
reconcileNavbarItemsFromContent(content);
|
|
15195
13907
|
reconcileFooterOrderFromContent(content);
|
|
15196
|
-
reconcileSocialsFromContent(content);
|
|
15197
13908
|
} finally {
|
|
15198
13909
|
observer?.observe(document.body, { childList: true, subtree: true });
|
|
15199
13910
|
}
|
|
@@ -15204,17 +13915,6 @@ function OhhwellsBridge() {
|
|
|
15204
13915
|
debounceTimer = setTimeout(applyFromCache, 150);
|
|
15205
13916
|
};
|
|
15206
13917
|
applyFromCache();
|
|
15207
|
-
const pathCacheKey = `${subdomain}::${pathname}`;
|
|
15208
|
-
if (!fetchedContentPaths.has(pathCacheKey)) {
|
|
15209
|
-
fetchedContentPaths.add(pathCacheKey);
|
|
15210
|
-
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
15211
|
-
fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(pathname)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
15212
|
-
if (!data?.content) return;
|
|
15213
|
-
contentCache.set(subdomain, data.content);
|
|
15214
|
-
applyFromCache();
|
|
15215
|
-
}).catch(() => {
|
|
15216
|
-
});
|
|
15217
|
-
}
|
|
15218
13918
|
observer = new MutationObserver(scheduleApply);
|
|
15219
13919
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
15220
13920
|
return () => {
|
|
@@ -15222,16 +13922,16 @@ function OhhwellsBridge() {
|
|
|
15222
13922
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
15223
13923
|
};
|
|
15224
13924
|
}, [subdomain, isEditMode, pathname]);
|
|
15225
|
-
(0,
|
|
13925
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
15226
13926
|
const el = document.getElementById("ohw-loader");
|
|
15227
13927
|
if (!el) return;
|
|
15228
13928
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
15229
13929
|
el.style.display = visible ? "flex" : "none";
|
|
15230
13930
|
}, [subdomain, fetchState]);
|
|
15231
|
-
(0,
|
|
13931
|
+
(0, import_react15.useEffect)(() => {
|
|
15232
13932
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
15233
13933
|
}, [pathname, postToParent2]);
|
|
15234
|
-
(0,
|
|
13934
|
+
(0, import_react15.useEffect)(() => {
|
|
15235
13935
|
if (!isEditMode) return;
|
|
15236
13936
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
15237
13937
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -15239,7 +13939,7 @@ function OhhwellsBridge() {
|
|
|
15239
13939
|
deselectRef.current();
|
|
15240
13940
|
deactivateRef.current();
|
|
15241
13941
|
}, [pathname, isEditMode]);
|
|
15242
|
-
(0,
|
|
13942
|
+
(0, import_react15.useEffect)(() => {
|
|
15243
13943
|
const contentForNav = () => {
|
|
15244
13944
|
if (isEditMode) return editContentRef.current;
|
|
15245
13945
|
if (!subdomain) return {};
|
|
@@ -15271,7 +13971,6 @@ function OhhwellsBridge() {
|
|
|
15271
13971
|
const content = contentForNav();
|
|
15272
13972
|
reconcileNavbarItemsFromContent(content);
|
|
15273
13973
|
reconcileFooterOrderFromContent(content);
|
|
15274
|
-
reconcileSocialsFromContent(content);
|
|
15275
13974
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
15276
13975
|
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key"))) {
|
|
15277
13976
|
disableNativeHrefDrag(el);
|
|
@@ -15305,7 +14004,7 @@ function OhhwellsBridge() {
|
|
|
15305
14004
|
observer?.disconnect();
|
|
15306
14005
|
};
|
|
15307
14006
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
15308
|
-
(0,
|
|
14007
|
+
(0, import_react15.useEffect)(() => {
|
|
15309
14008
|
if (!isEditMode) return;
|
|
15310
14009
|
const measure = () => {
|
|
15311
14010
|
const h = document.body.scrollHeight;
|
|
@@ -15329,7 +14028,7 @@ function OhhwellsBridge() {
|
|
|
15329
14028
|
window.removeEventListener("resize", handleResize);
|
|
15330
14029
|
};
|
|
15331
14030
|
}, [pathname, isEditMode, postToParent2]);
|
|
15332
|
-
(0,
|
|
14031
|
+
(0, import_react15.useEffect)(() => {
|
|
15333
14032
|
if (!subdomainFromQuery || isEditMode) return;
|
|
15334
14033
|
const handleClick = (e) => {
|
|
15335
14034
|
const anchor = e.target.closest("a");
|
|
@@ -15345,7 +14044,7 @@ function OhhwellsBridge() {
|
|
|
15345
14044
|
document.addEventListener("click", handleClick, true);
|
|
15346
14045
|
return () => document.removeEventListener("click", handleClick, true);
|
|
15347
14046
|
}, [subdomainFromQuery, isEditMode, router]);
|
|
15348
|
-
(0,
|
|
14047
|
+
(0, import_react15.useEffect)(() => {
|
|
15349
14048
|
if (!isEditMode) {
|
|
15350
14049
|
editStylesRef.current?.base.remove();
|
|
15351
14050
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -15474,7 +14173,6 @@ function OhhwellsBridge() {
|
|
|
15474
14173
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
15475
14174
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
15476
14175
|
if (isInsideLinkEditor(target)) return;
|
|
15477
|
-
if (isInsideFloatingPanel(target)) return;
|
|
15478
14176
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
15479
14177
|
const beneath = document.elementsFromPoint(e.clientX, e.clientY).find(
|
|
15480
14178
|
(el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
|
|
@@ -15538,21 +14236,6 @@ function OhhwellsBridge() {
|
|
|
15538
14236
|
return;
|
|
15539
14237
|
}
|
|
15540
14238
|
}
|
|
15541
|
-
const logoEl = getLogoElement(target);
|
|
15542
|
-
if (logoEl) {
|
|
15543
|
-
e.preventDefault();
|
|
15544
|
-
e.stopPropagation();
|
|
15545
|
-
if (!logoHasUploadedImage(logoEl)) {
|
|
15546
|
-
deselectRef.current();
|
|
15547
|
-
deactivateRef.current();
|
|
15548
|
-
const identity = readLogoIdentityFromDom();
|
|
15549
|
-
postToParentRef.current({ type: "ow:open-logo-settings", ...identity });
|
|
15550
|
-
return;
|
|
15551
|
-
}
|
|
15552
|
-
selectLogoRef.current(logoEl);
|
|
15553
|
-
openLogoSizePanelRef.current(logoEl);
|
|
15554
|
-
return;
|
|
15555
|
-
}
|
|
15556
14239
|
const editable = target.closest("[data-ohw-editable]");
|
|
15557
14240
|
if (editable) {
|
|
15558
14241
|
if (editable.dataset.ohwEditable === "link") {
|
|
@@ -15569,17 +14252,6 @@ function OhhwellsBridge() {
|
|
|
15569
14252
|
});
|
|
15570
14253
|
return;
|
|
15571
14254
|
}
|
|
15572
|
-
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
15573
|
-
e.preventDefault();
|
|
15574
|
-
e.stopPropagation();
|
|
15575
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
15576
|
-
postToParentRef.current({
|
|
15577
|
-
type: "ow:icon-pick",
|
|
15578
|
-
key: editable.dataset.ohwKey ?? "",
|
|
15579
|
-
current: currentIconRef(editable)
|
|
15580
|
-
});
|
|
15581
|
-
return;
|
|
15582
|
-
}
|
|
15583
14255
|
if (isMediaEditable(editable)) {
|
|
15584
14256
|
e.preventDefault();
|
|
15585
14257
|
e.stopPropagation();
|
|
@@ -15594,7 +14266,6 @@ function OhhwellsBridge() {
|
|
|
15594
14266
|
e.stopPropagation();
|
|
15595
14267
|
if (selectedElRef.current === navAnchor) {
|
|
15596
14268
|
if (e.detail >= 2) return;
|
|
15597
|
-
if (requestSocialDialog(navAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
15598
14269
|
activateRef.current(editable, { caretX: e.clientX, caretY: e.clientY });
|
|
15599
14270
|
return;
|
|
15600
14271
|
}
|
|
@@ -15611,7 +14282,6 @@ function OhhwellsBridge() {
|
|
|
15611
14282
|
e.preventDefault();
|
|
15612
14283
|
e.stopPropagation();
|
|
15613
14284
|
if (selectedElRef.current === hrefAnchor) {
|
|
15614
|
-
if (requestSocialDialog(hrefAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
15615
14285
|
const textEditable = hrefAnchor.querySelector('[data-ohw-editable="text"]') ?? hrefAnchor.querySelector("[data-ohw-editable]");
|
|
15616
14286
|
if (textEditable) {
|
|
15617
14287
|
activateRef.current(textEditable, {
|
|
@@ -15650,13 +14320,6 @@ function OhhwellsBridge() {
|
|
|
15650
14320
|
selectFrameRef.current(navContainerToSelect);
|
|
15651
14321
|
return;
|
|
15652
14322
|
}
|
|
15653
|
-
const socialsRowToSelect = isSocialsRow(target) ? target : null;
|
|
15654
|
-
if (socialsRowToSelect && !getSocialItem(target)) {
|
|
15655
|
-
e.preventDefault();
|
|
15656
|
-
e.stopPropagation();
|
|
15657
|
-
selectFrameRef.current(socialsRowToSelect);
|
|
15658
|
-
return;
|
|
15659
|
-
}
|
|
15660
14323
|
const footerColumnToSelect = resolveFooterColumnSelectionTarget(target, e.clientX, e.clientY);
|
|
15661
14324
|
if (footerColumnToSelect) {
|
|
15662
14325
|
e.preventDefault();
|
|
@@ -15705,11 +14368,9 @@ function OhhwellsBridge() {
|
|
|
15705
14368
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
15706
14369
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
15707
14370
|
if (isInsideLinkEditor(target)) return;
|
|
15708
|
-
if (isInsideFloatingPanel(target)) return;
|
|
15709
14371
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
15710
14372
|
return;
|
|
15711
14373
|
}
|
|
15712
|
-
if (getSocialItem(target)) return;
|
|
15713
14374
|
const navLabel = getNavigationLabelEditable(target);
|
|
15714
14375
|
const editable = navLabel?.editable ?? target.closest('[data-ohw-editable="text"], [data-ohw-editable="plain"]');
|
|
15715
14376
|
if (!editable || isMediaEditable(editable) || editable.dataset.ohwEditable === "link") return;
|
|
@@ -15733,16 +14394,6 @@ function OhhwellsBridge() {
|
|
|
15733
14394
|
setHoveredNavContainerRect(null);
|
|
15734
14395
|
return;
|
|
15735
14396
|
}
|
|
15736
|
-
if (isInsideFloatingPanel(target) || isPointOverFloatingPanel(e.clientX, e.clientY)) {
|
|
15737
|
-
hoveredItemElRef.current = null;
|
|
15738
|
-
setHoveredItemRect(null);
|
|
15739
|
-
hoveredNavContainerRef.current = null;
|
|
15740
|
-
setHoveredNavContainerRect(null);
|
|
15741
|
-
siblingHintElRef.current = null;
|
|
15742
|
-
setSiblingHintRect(null);
|
|
15743
|
-
setSiblingHintRects([]);
|
|
15744
|
-
return;
|
|
15745
|
-
}
|
|
15746
14397
|
{
|
|
15747
14398
|
const selected2 = selectedElRef.current;
|
|
15748
14399
|
const selectedIsFooterColumn = Boolean(selected2) && !isFooterLinksContainer(selected2) && (selected2.hasAttribute("data-ohw-footer-col") || selected2.hasAttribute("data-ohw-footer-column") || Boolean(selected2.closest("footer") && isInferredFooterGroup2(selected2)));
|
|
@@ -15750,7 +14401,7 @@ function OhhwellsBridge() {
|
|
|
15750
14401
|
const allowFooterLinksHover = toolbarVariantRef.current !== "select-frame" || selectedIsFooterColumn;
|
|
15751
14402
|
if (allowNavContainerHover) {
|
|
15752
14403
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
15753
|
-
if (navContainer && !getNavigationItemAnchor(target)
|
|
14404
|
+
if (navContainer && !getNavigationItemAnchor(target)) {
|
|
15754
14405
|
hoveredNavContainerRef.current = navContainer;
|
|
15755
14406
|
setHoveredNavContainerRect(navContainer.getBoundingClientRect());
|
|
15756
14407
|
hoveredItemElRef.current = null;
|
|
@@ -15779,15 +14430,6 @@ function OhhwellsBridge() {
|
|
|
15779
14430
|
setHoveredNavContainerRect(null);
|
|
15780
14431
|
}
|
|
15781
14432
|
}
|
|
15782
|
-
const logoEl = getLogoElement(target);
|
|
15783
|
-
if (logoEl) {
|
|
15784
|
-
hoveredNavContainerRef.current = null;
|
|
15785
|
-
setHoveredNavContainerRect(null);
|
|
15786
|
-
if (selectedElRef.current === logoEl) return;
|
|
15787
|
-
hoveredItemElRef.current = logoEl;
|
|
15788
|
-
setHoveredItemRect(getLogoInteractionRect(logoEl));
|
|
15789
|
-
return;
|
|
15790
|
-
}
|
|
15791
14433
|
const navAnchor = getNavigationItemAnchor(target);
|
|
15792
14434
|
if (navAnchor) {
|
|
15793
14435
|
hoveredNavContainerRef.current = null;
|
|
@@ -15813,11 +14455,6 @@ function OhhwellsBridge() {
|
|
|
15813
14455
|
const selected = selectedElRef.current;
|
|
15814
14456
|
if (selected && (selected === editable || selected.contains(editable))) return;
|
|
15815
14457
|
if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
|
|
15816
|
-
if (isIconEditable(editable)) {
|
|
15817
|
-
hoveredItemElRef.current = editable;
|
|
15818
|
-
setHoveredItemRect(editable.getBoundingClientRect());
|
|
15819
|
-
return;
|
|
15820
|
-
}
|
|
15821
14458
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
15822
14459
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
15823
14460
|
clearHrefKeyHover(hoverTarget);
|
|
@@ -15825,12 +14462,6 @@ function OhhwellsBridge() {
|
|
|
15825
14462
|
setHoveredItemRect(hoverTarget.getBoundingClientRect());
|
|
15826
14463
|
} else if (!isInsideNavigationItem(editable)) {
|
|
15827
14464
|
hoverTarget.setAttribute("data-ohw-hovered", "");
|
|
15828
|
-
if (editable.closest("footer") || editable.closest('[data-ohw-section="footer"]')) {
|
|
15829
|
-
hoveredNavContainerRef.current = null;
|
|
15830
|
-
setHoveredNavContainerRect(null);
|
|
15831
|
-
hoveredItemElRef.current = editable;
|
|
15832
|
-
setHoveredItemRect(editable.getBoundingClientRect());
|
|
15833
|
-
}
|
|
15834
14465
|
}
|
|
15835
14466
|
}
|
|
15836
14467
|
};
|
|
@@ -15866,30 +14497,11 @@ function OhhwellsBridge() {
|
|
|
15866
14497
|
}
|
|
15867
14498
|
return;
|
|
15868
14499
|
}
|
|
15869
|
-
const logoEl = getLogoElement(target);
|
|
15870
|
-
if (logoEl) {
|
|
15871
|
-
const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
15872
|
-
if (related2 && (logoEl === related2 || logoEl.contains(related2) || related2.closest?.('[data-ohw-role="logo"], [data-ohw-logo]'))) {
|
|
15873
|
-
return;
|
|
15874
|
-
}
|
|
15875
|
-
if (hoveredItemElRef.current === logoEl) {
|
|
15876
|
-
hoveredItemElRef.current = null;
|
|
15877
|
-
setHoveredItemRect(null);
|
|
15878
|
-
}
|
|
15879
|
-
return;
|
|
15880
|
-
}
|
|
15881
14500
|
const editable = target.closest("[data-ohw-editable]");
|
|
15882
14501
|
if (!editable) return;
|
|
15883
14502
|
const related = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
15884
14503
|
if (related?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
|
|
15885
14504
|
if (!isMediaEditable(editable)) {
|
|
15886
|
-
if (isIconEditable(editable) && hoveredItemElRef.current === editable) {
|
|
15887
|
-
if (!related?.closest("[data-ohw-item-interaction]")) {
|
|
15888
|
-
hoveredItemElRef.current = null;
|
|
15889
|
-
setHoveredItemRect(null);
|
|
15890
|
-
}
|
|
15891
|
-
return;
|
|
15892
|
-
}
|
|
15893
14505
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
15894
14506
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
15895
14507
|
if (!related?.closest("[data-ohw-href-key]")) {
|
|
@@ -15898,13 +14510,6 @@ function OhhwellsBridge() {
|
|
|
15898
14510
|
}
|
|
15899
14511
|
} else {
|
|
15900
14512
|
hoverTarget.removeAttribute("data-ohw-hovered");
|
|
15901
|
-
if (hoveredItemElRef.current === editable) {
|
|
15902
|
-
const stillOnEditable = related instanceof Element && related.closest("[data-ohw-editable]") === editable;
|
|
15903
|
-
if (!stillOnEditable) {
|
|
15904
|
-
hoveredItemElRef.current = null;
|
|
15905
|
-
setHoveredItemRect(null);
|
|
15906
|
-
}
|
|
15907
|
-
}
|
|
15908
14513
|
}
|
|
15909
14514
|
}
|
|
15910
14515
|
};
|
|
@@ -16021,26 +14626,6 @@ function OhhwellsBridge() {
|
|
|
16021
14626
|
hoveredNavContainerRef.current = null;
|
|
16022
14627
|
setHoveredNavContainerRect(null);
|
|
16023
14628
|
}
|
|
16024
|
-
const logoCandidates = [
|
|
16025
|
-
...document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]'),
|
|
16026
|
-
...document.querySelectorAll("nav a:not([data-ohw-href-key]), [data-ohw-nav-root] a:not([data-ohw-href-key])"),
|
|
16027
|
-
...document.querySelectorAll("footer img")
|
|
16028
|
-
];
|
|
16029
|
-
const seenLogos = /* @__PURE__ */ new Set();
|
|
16030
|
-
for (const candidate of logoCandidates) {
|
|
16031
|
-
const logo = getLogoElement(candidate);
|
|
16032
|
-
if (!logo || seenLogos.has(logo)) continue;
|
|
16033
|
-
seenLogos.add(logo);
|
|
16034
|
-
const r2 = logo.getBoundingClientRect();
|
|
16035
|
-
if (x < r2.left || x > r2.right || y < r2.top || y > r2.bottom) continue;
|
|
16036
|
-
hoveredNavContainerRef.current = null;
|
|
16037
|
-
setHoveredNavContainerRect(null);
|
|
16038
|
-
if (selectedElRef.current !== logo) {
|
|
16039
|
-
hoveredItemElRef.current = logo;
|
|
16040
|
-
setHoveredItemRect(getLogoInteractionRect(logo));
|
|
16041
|
-
}
|
|
16042
|
-
return;
|
|
16043
|
-
}
|
|
16044
14629
|
const navContainers = Array.from(
|
|
16045
14630
|
document.querySelectorAll("[data-ohw-nav-container]")
|
|
16046
14631
|
);
|
|
@@ -16126,7 +14711,7 @@ function OhhwellsBridge() {
|
|
|
16126
14711
|
}
|
|
16127
14712
|
};
|
|
16128
14713
|
const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
|
|
16129
|
-
if (linkPopoverOpenRef.current
|
|
14714
|
+
if (linkPopoverOpenRef.current) {
|
|
16130
14715
|
if (hoveredImageRef.current) {
|
|
16131
14716
|
hoveredImageRef.current = null;
|
|
16132
14717
|
hoveredImageHasTextOverlapRef.current = false;
|
|
@@ -16380,7 +14965,7 @@ function OhhwellsBridge() {
|
|
|
16380
14965
|
}
|
|
16381
14966
|
};
|
|
16382
14967
|
const probeHoverCardsAt = (clientX, clientY, fromParentViewport = false) => {
|
|
16383
|
-
if (linkPopoverOpenRef.current ||
|
|
14968
|
+
if (linkPopoverOpenRef.current || document.documentElement.hasAttribute("data-ohw-section-picking")) {
|
|
16384
14969
|
if (activeStateElRef.current) {
|
|
16385
14970
|
activeStateElRef.current.removeAttribute("data-ohw-state-hovered");
|
|
16386
14971
|
activeStateElRef.current = null;
|
|
@@ -16448,19 +15033,6 @@ function OhhwellsBridge() {
|
|
|
16448
15033
|
};
|
|
16449
15034
|
const handleMouseMove = (e) => {
|
|
16450
15035
|
const { clientX, clientY } = e;
|
|
16451
|
-
if (floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
|
|
16452
|
-
hoveredItemElRef.current = null;
|
|
16453
|
-
setHoveredItemRect(null);
|
|
16454
|
-
hoveredNavContainerRef.current = null;
|
|
16455
|
-
setHoveredNavContainerRect(null);
|
|
16456
|
-
siblingHintElRef.current = null;
|
|
16457
|
-
setSiblingHintRect(null);
|
|
16458
|
-
setSiblingHintRects([]);
|
|
16459
|
-
dismissImageHover();
|
|
16460
|
-
clearImageHover();
|
|
16461
|
-
setSectionGap(null);
|
|
16462
|
-
return;
|
|
16463
|
-
}
|
|
16464
15036
|
probeSectionGapAt(clientX, clientY);
|
|
16465
15037
|
probeImageAt(clientX, clientY);
|
|
16466
15038
|
probeHoverCardsAt(clientX, clientY);
|
|
@@ -16469,11 +15041,6 @@ function OhhwellsBridge() {
|
|
|
16469
15041
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
16470
15042
|
const { clientX, clientY } = e.data;
|
|
16471
15043
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
16472
|
-
if (floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
|
|
16473
|
-
dismissImageHover();
|
|
16474
|
-
clearImageHover();
|
|
16475
|
-
return;
|
|
16476
|
-
}
|
|
16477
15044
|
probeSectionGapAt(clientX, clientY);
|
|
16478
15045
|
probeImageAt(clientX, clientY);
|
|
16479
15046
|
probeHoverCardsAt(clientX, clientY);
|
|
@@ -16483,7 +15050,7 @@ function OhhwellsBridge() {
|
|
|
16483
15050
|
if (footerSession) {
|
|
16484
15051
|
e.preventDefault();
|
|
16485
15052
|
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
16486
|
-
const slot = footerSession.kind === "
|
|
15053
|
+
const slot = footerSession.kind === "link" && footerSession.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, footerSession.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
16487
15054
|
refreshFooterDragVisualsRef.current(footerSession, slot, e.clientX, e.clientY);
|
|
16488
15055
|
return;
|
|
16489
15056
|
}
|
|
@@ -16535,60 +15102,6 @@ function OhhwellsBridge() {
|
|
|
16535
15102
|
resumeAnimTracks();
|
|
16536
15103
|
clearImageHover();
|
|
16537
15104
|
};
|
|
16538
|
-
const handleSocialCancel = (e) => {
|
|
16539
|
-
if (e.data?.type !== "ow:social-cancel") return;
|
|
16540
|
-
const { hrefKey } = e.data;
|
|
16541
|
-
const item = hrefKey ? findSocialByHrefKey(hrefKey) : null;
|
|
16542
|
-
if (!item) return;
|
|
16543
|
-
const removed = removeSocialItem(item, editContentRef.current);
|
|
16544
|
-
if (!removed) return;
|
|
16545
|
-
const orderJson = JSON.stringify(removed.order);
|
|
16546
|
-
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
16547
|
-
postToParentRef.current({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
16548
|
-
deselectRef.current();
|
|
16549
|
-
};
|
|
16550
|
-
const handleSocialUpdate = (e) => {
|
|
16551
|
-
if (e.data?.type !== "ow:social-update") return;
|
|
16552
|
-
const { hrefKey, iconKey, url, iconMarkup, platformId, label } = e.data;
|
|
16553
|
-
const nodes = [];
|
|
16554
|
-
if (hrefKey) {
|
|
16555
|
-
document.querySelectorAll(`[data-ohw-href-key="${hrefKey}"]`).forEach((el) => applyLinkHref(el, url));
|
|
16556
|
-
nodes.push({ key: hrefKey, text: url });
|
|
16557
|
-
}
|
|
16558
|
-
if (iconKey && typeof iconMarkup === "string" && iconMarkup) {
|
|
16559
|
-
document.querySelectorAll(`[data-ohw-key="${iconKey}"][data-ohw-editable="icon"]`).forEach((el) => {
|
|
16560
|
-
applyIconMarkup(el, iconMarkup);
|
|
16561
|
-
});
|
|
16562
|
-
nodes.push({ key: iconKey, text: iconMarkup });
|
|
16563
|
-
}
|
|
16564
|
-
if (iconKey && platformId) nodes.push({ key: socialPlatformKey(iconKey), text: platformId });
|
|
16565
|
-
if (iconKey && label) {
|
|
16566
|
-
const labelKey = socialLabelKey(iconKey);
|
|
16567
|
-
document.querySelectorAll(`[data-ohw-key="${labelKey}"]`).forEach((el) => {
|
|
16568
|
-
el.textContent = label;
|
|
16569
|
-
});
|
|
16570
|
-
nodes.push({ key: labelKey, text: label });
|
|
16571
|
-
}
|
|
16572
|
-
if (!nodes.length) return;
|
|
16573
|
-
editContentRef.current = {
|
|
16574
|
-
...editContentRef.current,
|
|
16575
|
-
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
16576
|
-
};
|
|
16577
|
-
postToParentRef.current({ type: "ow:change", nodes });
|
|
16578
|
-
};
|
|
16579
|
-
const handleIconMarkup = (e) => {
|
|
16580
|
-
if (e.data?.type !== "ow:icon-markup") return;
|
|
16581
|
-
const { key, markup } = e.data;
|
|
16582
|
-
if (!key || typeof markup !== "string") return;
|
|
16583
|
-
const targets = document.querySelectorAll(
|
|
16584
|
-
`[data-ohw-key="${key}"][data-ohw-editable="icon"]`
|
|
16585
|
-
);
|
|
16586
|
-
if (!targets.length) return;
|
|
16587
|
-
targets.forEach((el) => {
|
|
16588
|
-
applyIconMarkup(el, markup);
|
|
16589
|
-
});
|
|
16590
|
-
postToParentRef.current({ type: "ow:change", nodes: [{ key, text: markup }] });
|
|
16591
|
-
};
|
|
16592
15105
|
const handleImageUrl = (e) => {
|
|
16593
15106
|
if (e.data?.type !== "ow:image-url") return;
|
|
16594
15107
|
const { key, url } = e.data;
|
|
@@ -16728,8 +15241,6 @@ function OhhwellsBridge() {
|
|
|
16728
15241
|
continue;
|
|
16729
15242
|
}
|
|
16730
15243
|
if (key === AI_SECTIONS_KEY) continue;
|
|
16731
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
16732
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
16733
15244
|
if (applyVideoSettingNode(key, val)) continue;
|
|
16734
15245
|
if (applyCarouselNode(key, val)) continue;
|
|
16735
15246
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -16749,8 +15260,6 @@ function OhhwellsBridge() {
|
|
|
16749
15260
|
});
|
|
16750
15261
|
applyLinkByKey(key, val);
|
|
16751
15262
|
}
|
|
16752
|
-
applyLogoFromContent(content);
|
|
16753
|
-
applyLogoSizes(content);
|
|
16754
15263
|
if (sectionsJson) {
|
|
16755
15264
|
initSectionsFromContent({ __ohw_sections: sectionsJson }, true);
|
|
16756
15265
|
sectionsLoadedRef.current = true;
|
|
@@ -16765,58 +15274,6 @@ function OhhwellsBridge() {
|
|
|
16765
15274
|
if (hydratedHeight > 50) postToParentRef.current({ type: "ow:height", height: hydratedHeight });
|
|
16766
15275
|
postToParentRef.current({ type: "ow:hydrate-done" });
|
|
16767
15276
|
};
|
|
16768
|
-
const handleUpdateLogoIdentity = (e) => {
|
|
16769
|
-
if (e.data?.type !== "ow:update-logo-identity") return;
|
|
16770
|
-
const rawText = typeof e.data.text === "string" ? e.data.text : "";
|
|
16771
|
-
const alt = typeof e.data.alt === "string" ? e.data.alt : rawText;
|
|
16772
|
-
const href = typeof e.data.href === "string" ? e.data.href : void 0;
|
|
16773
|
-
const imageProvided = "image" in e.data;
|
|
16774
|
-
const imageUrl = imageProvided && typeof e.data.image === "string" && e.data.image.trim() ? e.data.image.trim() : imageProvided ? null : void 0;
|
|
16775
|
-
let isPlaceholder = e.data.isPlaceholder !== false;
|
|
16776
|
-
if (imageUrl) isPlaceholder = false;
|
|
16777
|
-
else if (imageProvided && imageUrl === null) {
|
|
16778
|
-
isPlaceholder = e.data.isPlaceholder === true || !rawText.trim() || resolveLogoDisplayText(rawText) === PLACEHOLDER_BUSINESS_NAME;
|
|
16779
|
-
}
|
|
16780
|
-
const display = applyLogoIdentity(rawText, isPlaceholder);
|
|
16781
|
-
const displayAlt = resolveLogoDisplayText(alt || display);
|
|
16782
|
-
if (imageUrl !== void 0) {
|
|
16783
|
-
applyLogoImage(imageUrl, displayAlt);
|
|
16784
|
-
} else {
|
|
16785
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
16786
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
16787
|
-
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
16788
|
-
if (img) img.alt = displayAlt;
|
|
16789
|
-
});
|
|
16790
|
-
}
|
|
16791
|
-
}
|
|
16792
|
-
if (href !== void 0) {
|
|
16793
|
-
applyLogoHref(href);
|
|
16794
|
-
applyLinkByKey("nav-logo-href", href);
|
|
16795
|
-
applyLinkByKey("footer-logo-href", href);
|
|
16796
|
-
applyLinkByKey("logo-href", href);
|
|
16797
|
-
}
|
|
16798
|
-
const nodes = [
|
|
16799
|
-
...LOGO_TEXT_KEYS.map((key) => ({ key, text: display })),
|
|
16800
|
-
{ key: LOGO_PLACEHOLDER_KEY, text: isPlaceholder ? "true" : "false" },
|
|
16801
|
-
{ key: LOGO_ALT_KEY, text: displayAlt }
|
|
16802
|
-
];
|
|
16803
|
-
if (imageUrl !== void 0) {
|
|
16804
|
-
if (imageUrl) {
|
|
16805
|
-
for (const key of LOGO_IMAGE_KEYS) nodes.push({ key, text: imageUrl });
|
|
16806
|
-
} else {
|
|
16807
|
-
for (const key of LOGO_IMAGE_KEYS) nodes.push({ key, text: "" });
|
|
16808
|
-
}
|
|
16809
|
-
}
|
|
16810
|
-
if (href !== void 0) {
|
|
16811
|
-
for (const key of LOGO_HREF_KEYS) nodes.push({ key, text: href.trim() || "/" });
|
|
16812
|
-
}
|
|
16813
|
-
editContentRef.current = {
|
|
16814
|
-
...editContentRef.current,
|
|
16815
|
-
...Object.fromEntries(nodes.map(({ key, text }) => [key, text]))
|
|
16816
|
-
};
|
|
16817
|
-
applyLogoSizes(editContentRef.current);
|
|
16818
|
-
postToParentRef.current({ type: "ow:change", nodes });
|
|
16819
|
-
};
|
|
16820
15277
|
window.addEventListener("message", handleHydrate);
|
|
16821
15278
|
const postAiSectionsChanged = () => {
|
|
16822
15279
|
postToParentRef.current({
|
|
@@ -16881,12 +15338,6 @@ function OhhwellsBridge() {
|
|
|
16881
15338
|
closeLinkPopoverRef.current();
|
|
16882
15339
|
return;
|
|
16883
15340
|
}
|
|
16884
|
-
if (floatingPanelOpenRef.current) {
|
|
16885
|
-
setFloatingPanelRef.current(null);
|
|
16886
|
-
deselectRef.current();
|
|
16887
|
-
deactivateRef.current();
|
|
16888
|
-
return;
|
|
16889
|
-
}
|
|
16890
15341
|
deselectRef.current();
|
|
16891
15342
|
deactivateRef.current();
|
|
16892
15343
|
};
|
|
@@ -16906,10 +15357,6 @@ function OhhwellsBridge() {
|
|
|
16906
15357
|
closeLinkPopoverRef.current();
|
|
16907
15358
|
return;
|
|
16908
15359
|
}
|
|
16909
|
-
if (floatingPanelOpenRef.current) {
|
|
16910
|
-
closeFloatingPanelOnlyRef.current();
|
|
16911
|
-
return;
|
|
16912
|
-
}
|
|
16913
15360
|
if (activeElRef.current) {
|
|
16914
15361
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
16915
15362
|
const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
|
|
@@ -16940,10 +15387,6 @@ function OhhwellsBridge() {
|
|
|
16940
15387
|
return;
|
|
16941
15388
|
}
|
|
16942
15389
|
if (selectedElRef.current) {
|
|
16943
|
-
if (toolbarVariantRef.current === "logo") {
|
|
16944
|
-
deselectRef.current();
|
|
16945
|
-
return;
|
|
16946
|
-
}
|
|
16947
15390
|
if (toolbarVariantRef.current === "select-frame") {
|
|
16948
15391
|
const parent2 = getNavigationSelectionParent(selectedElRef.current);
|
|
16949
15392
|
if (parent2 && isNavigationContainer(parent2) && isFooterLinksContainer(parent2) && !isFooterLinksContainer(selectedElRef.current)) {
|
|
@@ -16977,16 +15420,7 @@ function OhhwellsBridge() {
|
|
|
16977
15420
|
closeLinkPopoverRef.current();
|
|
16978
15421
|
return;
|
|
16979
15422
|
}
|
|
16980
|
-
if (e.key === "Escape" && floatingPanelOpenRef.current) {
|
|
16981
|
-
e.preventDefault();
|
|
16982
|
-
closeFloatingPanelOnlyRef.current();
|
|
16983
|
-
return;
|
|
16984
|
-
}
|
|
16985
15423
|
if (e.key === "Escape" && selectedElRef.current && !activeElRef.current) {
|
|
16986
|
-
if (toolbarVariantRef.current === "logo") {
|
|
16987
|
-
deselectRef.current();
|
|
16988
|
-
return;
|
|
16989
|
-
}
|
|
16990
15424
|
if (toolbarVariantRef.current === "select-frame") {
|
|
16991
15425
|
const parent2 = getNavigationSelectionParent(selectedElRef.current);
|
|
16992
15426
|
if (parent2 && isNavigationContainer(parent2) && isFooterLinksContainer(parent2) && !isFooterLinksContainer(selectedElRef.current)) {
|
|
@@ -17064,8 +15498,7 @@ function OhhwellsBridge() {
|
|
|
17064
15498
|
const handleScroll = () => {
|
|
17065
15499
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
17066
15500
|
if (focusEl) {
|
|
17067
|
-
const
|
|
17068
|
-
const r2 = measureEl ? measureEl.getBoundingClientRect() : toolbarVariantRef.current === "logo" ? getLogoInteractionRect(focusEl) : focusEl.getBoundingClientRect();
|
|
15501
|
+
const r2 = activeElRef.current ? getEditMeasureEl(activeElRef.current).getBoundingClientRect() : focusEl.getBoundingClientRect();
|
|
17069
15502
|
applyToolbarPos(r2);
|
|
17070
15503
|
setToolbarRect(r2);
|
|
17071
15504
|
setMaxBadge((prev) => prev && activeElRef.current ? { ...prev, rect: r2 } : prev);
|
|
@@ -17075,9 +15508,7 @@ function OhhwellsBridge() {
|
|
|
17075
15508
|
setToggleState((prev) => prev ? { ...prev, rect } : null);
|
|
17076
15509
|
}
|
|
17077
15510
|
if (hoveredItemElRef.current) {
|
|
17078
|
-
|
|
17079
|
-
const logo = getLogoElement(hoverEl);
|
|
17080
|
-
setHoveredItemRect(logo ? getLogoInteractionRect(logo) : hoverEl.getBoundingClientRect());
|
|
15511
|
+
setHoveredItemRect(hoveredItemElRef.current.getBoundingClientRect());
|
|
17081
15512
|
}
|
|
17082
15513
|
if (hoveredNavContainerRef.current) {
|
|
17083
15514
|
setHoveredNavContainerRect(hoveredNavContainerRef.current.getBoundingClientRect());
|
|
@@ -17097,7 +15528,7 @@ function OhhwellsBridge() {
|
|
|
17097
15528
|
}
|
|
17098
15529
|
if (footerDragRef.current) {
|
|
17099
15530
|
const session = footerDragRef.current;
|
|
17100
|
-
const slot = session.kind === "
|
|
15531
|
+
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
17101
15532
|
refreshFooterDragVisualsRef.current(session, slot, session.lastClientX, session.lastClientY);
|
|
17102
15533
|
}
|
|
17103
15534
|
if (navDragRef.current) {
|
|
@@ -17131,12 +15562,8 @@ function OhhwellsBridge() {
|
|
|
17131
15562
|
if (inserted) {
|
|
17132
15563
|
const tracker = getSectionsTracker();
|
|
17133
15564
|
postToParentRef.current({ type: "ow:change", nodes: [{ key: "__ohw_sections", text: tracker.textContent ?? "[]" }] });
|
|
17134
|
-
const
|
|
17135
|
-
|
|
17136
|
-
if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
|
|
17137
|
-
};
|
|
17138
|
-
reportHeight();
|
|
17139
|
-
setTimeout(reportHeight, 500);
|
|
15565
|
+
const h = document.documentElement.scrollHeight;
|
|
15566
|
+
if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
|
|
17140
15567
|
}
|
|
17141
15568
|
};
|
|
17142
15569
|
const handleSwitchSchedule = (e) => {
|
|
@@ -17329,17 +15756,13 @@ function OhhwellsBridge() {
|
|
|
17329
15756
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
17330
15757
|
const { iframeOffsetTop, headerH, canvasH } = e.data;
|
|
17331
15758
|
parentScrollRef.current = { iframeOffsetTop, headerH, canvasH };
|
|
17332
|
-
if (floatingPanelOpenRef.current) {
|
|
17333
|
-
setParentScrollSnap({ iframeOffsetTop, headerH, canvasH });
|
|
17334
|
-
}
|
|
17335
15759
|
if (visibleViewportRef.current) {
|
|
17336
15760
|
applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
|
|
17337
15761
|
}
|
|
17338
15762
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
17339
15763
|
if (focusEl) {
|
|
17340
|
-
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) :
|
|
17341
|
-
|
|
17342
|
-
applyToolbarPos(r2);
|
|
15764
|
+
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : focusEl;
|
|
15765
|
+
applyToolbarPos(measureEl.getBoundingClientRect());
|
|
17343
15766
|
}
|
|
17344
15767
|
};
|
|
17345
15768
|
const handleClickAt = (e) => {
|
|
@@ -17364,25 +15787,6 @@ function OhhwellsBridge() {
|
|
|
17364
15787
|
postToParentRef.current({ type: "ow:image-pick", key: stateCardImage.dataset.ohwKey ?? "", elementType: stateCardImage.dataset.ohwEditable ?? "image" });
|
|
17365
15788
|
return;
|
|
17366
15789
|
}
|
|
17367
|
-
const logoAtPoint = Array.from(
|
|
17368
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]')
|
|
17369
|
-
).map((el) => getLogoElement(el)).find((logo) => {
|
|
17370
|
-
if (!logo) return false;
|
|
17371
|
-
const r2 = logo.getBoundingClientRect();
|
|
17372
|
-
return clientX >= r2.left && clientX <= r2.right && clientY >= r2.top && clientY <= r2.bottom;
|
|
17373
|
-
});
|
|
17374
|
-
if (logoAtPoint) {
|
|
17375
|
-
if (!logoHasUploadedImage(logoAtPoint)) {
|
|
17376
|
-
deselectRef.current();
|
|
17377
|
-
deactivateRef.current();
|
|
17378
|
-
const identity = readLogoIdentityFromDom();
|
|
17379
|
-
postToParentRef.current({ type: "ow:open-logo-settings", ...identity });
|
|
17380
|
-
return;
|
|
17381
|
-
}
|
|
17382
|
-
selectLogoRef.current(logoAtPoint);
|
|
17383
|
-
openLogoSizePanelRef.current(logoAtPoint);
|
|
17384
|
-
return;
|
|
17385
|
-
}
|
|
17386
15790
|
const textEditable = Array.from(
|
|
17387
15791
|
document.querySelectorAll(NON_MEDIA_SELECTOR)
|
|
17388
15792
|
).find((el) => {
|
|
@@ -17444,9 +15848,6 @@ function OhhwellsBridge() {
|
|
|
17444
15848
|
window.addEventListener("message", handleClearSchedulingWidget);
|
|
17445
15849
|
window.addEventListener("message", handleRemoveSchedulingSection);
|
|
17446
15850
|
window.addEventListener("message", handleCollectSection);
|
|
17447
|
-
window.addEventListener("message", handleSocialCancel);
|
|
17448
|
-
window.addEventListener("message", handleSocialUpdate);
|
|
17449
|
-
window.addEventListener("message", handleIconMarkup);
|
|
17450
15851
|
window.addEventListener("message", handleImageUrl);
|
|
17451
15852
|
window.addEventListener("message", handleImageUploading);
|
|
17452
15853
|
window.addEventListener("message", handleCarouselChange);
|
|
@@ -17454,14 +15855,6 @@ function OhhwellsBridge() {
|
|
|
17454
15855
|
window.addEventListener("message", handleParentScroll);
|
|
17455
15856
|
window.addEventListener("message", handlePointerSync);
|
|
17456
15857
|
window.addEventListener("message", handleClickAt);
|
|
17457
|
-
window.addEventListener("message", handleUpdateLogoIdentity);
|
|
17458
|
-
const handleViewMode = (e) => {
|
|
17459
|
-
if (e.data?.type !== "ow:view-mode") return;
|
|
17460
|
-
const mode = e.data.mode === "Mobile" || e.data.mode === "mobile" ? "mobile" : "desktop";
|
|
17461
|
-
setEditorViewport(mode);
|
|
17462
|
-
applyLogoSizes(editContentRef.current);
|
|
17463
|
-
};
|
|
17464
|
-
window.addEventListener("message", handleViewMode);
|
|
17465
15858
|
const handleViewportResize = () => {
|
|
17466
15859
|
if (visibleViewportRef.current) {
|
|
17467
15860
|
applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
|
|
@@ -17506,9 +15899,6 @@ function OhhwellsBridge() {
|
|
|
17506
15899
|
window.removeEventListener("message", handleClearSchedulingWidget);
|
|
17507
15900
|
window.removeEventListener("message", handleRemoveSchedulingSection);
|
|
17508
15901
|
window.removeEventListener("message", handleCollectSection);
|
|
17509
|
-
window.removeEventListener("message", handleSocialCancel);
|
|
17510
|
-
window.removeEventListener("message", handleSocialUpdate);
|
|
17511
|
-
window.removeEventListener("message", handleIconMarkup);
|
|
17512
15902
|
window.removeEventListener("message", handleImageUrl);
|
|
17513
15903
|
window.removeEventListener("message", handleImageUploading);
|
|
17514
15904
|
window.removeEventListener("message", handleCarouselChange);
|
|
@@ -17517,8 +15907,6 @@ function OhhwellsBridge() {
|
|
|
17517
15907
|
window.removeEventListener("resize", handleViewportResize);
|
|
17518
15908
|
window.removeEventListener("message", handlePointerSync);
|
|
17519
15909
|
window.removeEventListener("message", handleClickAt);
|
|
17520
|
-
window.removeEventListener("message", handleUpdateLogoIdentity);
|
|
17521
|
-
window.removeEventListener("message", handleViewMode);
|
|
17522
15910
|
window.removeEventListener("message", handleHydrate);
|
|
17523
15911
|
window.removeEventListener("message", handleAiApplyTree);
|
|
17524
15912
|
window.removeEventListener("message", handleAiDeleteSection);
|
|
@@ -17532,7 +15920,7 @@ function OhhwellsBridge() {
|
|
|
17532
15920
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
17533
15921
|
};
|
|
17534
15922
|
}, [isEditMode, refreshStateRules]);
|
|
17535
|
-
(0,
|
|
15923
|
+
(0, import_react15.useEffect)(() => {
|
|
17536
15924
|
if (!isEditMode) return;
|
|
17537
15925
|
const THRESHOLD = 10;
|
|
17538
15926
|
const resolveWasSelected = (el) => {
|
|
@@ -17587,7 +15975,7 @@ function OhhwellsBridge() {
|
|
|
17587
15975
|
clearTextSelection();
|
|
17588
15976
|
const session = footerDragRef.current;
|
|
17589
15977
|
if (!session) return;
|
|
17590
|
-
const slot = session.kind === "
|
|
15978
|
+
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, session.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
17591
15979
|
refreshFooterDragVisualsRef.current(session, slot, e.clientX, e.clientY);
|
|
17592
15980
|
return;
|
|
17593
15981
|
}
|
|
@@ -17686,7 +16074,7 @@ function OhhwellsBridge() {
|
|
|
17686
16074
|
unlockFooterDragInteraction();
|
|
17687
16075
|
};
|
|
17688
16076
|
}, [isEditMode]);
|
|
17689
|
-
(0,
|
|
16077
|
+
(0, import_react15.useEffect)(() => {
|
|
17690
16078
|
const handler = (e) => {
|
|
17691
16079
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
17692
16080
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -17702,7 +16090,7 @@ function OhhwellsBridge() {
|
|
|
17702
16090
|
window.addEventListener("message", handler);
|
|
17703
16091
|
return () => window.removeEventListener("message", handler);
|
|
17704
16092
|
}, [processConfigRequest]);
|
|
17705
|
-
(0,
|
|
16093
|
+
(0, import_react15.useEffect)(() => {
|
|
17706
16094
|
if (!isEditMode) return;
|
|
17707
16095
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
17708
16096
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -17738,13 +16126,13 @@ function OhhwellsBridge() {
|
|
|
17738
16126
|
clearTimeout(timer);
|
|
17739
16127
|
};
|
|
17740
16128
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
17741
|
-
(0,
|
|
16129
|
+
(0, import_react15.useEffect)(() => {
|
|
17742
16130
|
scrollToHashSectionWhenReady();
|
|
17743
16131
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
17744
16132
|
window.addEventListener("hashchange", onHashChange);
|
|
17745
16133
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
17746
16134
|
}, [pathname]);
|
|
17747
|
-
const handleCommand = (0,
|
|
16135
|
+
const handleCommand = (0, import_react15.useCallback)((cmd) => {
|
|
17748
16136
|
const el = activeElRef.current;
|
|
17749
16137
|
const selBefore = window.getSelection();
|
|
17750
16138
|
let savedOffsets = null;
|
|
@@ -17780,7 +16168,7 @@ function OhhwellsBridge() {
|
|
|
17780
16168
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
17781
16169
|
refreshActiveCommandsRef.current();
|
|
17782
16170
|
}, []);
|
|
17783
|
-
const handleStateChange = (0,
|
|
16171
|
+
const handleStateChange = (0, import_react15.useCallback)((state) => {
|
|
17784
16172
|
if (!activeStateElRef.current) return;
|
|
17785
16173
|
const el = activeStateElRef.current;
|
|
17786
16174
|
if (state === "Default") {
|
|
@@ -17793,7 +16181,7 @@ function OhhwellsBridge() {
|
|
|
17793
16181
|
}
|
|
17794
16182
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
17795
16183
|
}, [deactivate]);
|
|
17796
|
-
const reselectAfterLinkPopover = (0,
|
|
16184
|
+
const reselectAfterLinkPopover = (0, import_react15.useCallback)(
|
|
17797
16185
|
(hrefKey) => {
|
|
17798
16186
|
requestAnimationFrame(() => {
|
|
17799
16187
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -17802,7 +16190,7 @@ function OhhwellsBridge() {
|
|
|
17802
16190
|
},
|
|
17803
16191
|
[resolveHrefKeyElement]
|
|
17804
16192
|
);
|
|
17805
|
-
const closeLinkPopover = (0,
|
|
16193
|
+
const closeLinkPopover = (0, import_react15.useCallback)(() => {
|
|
17806
16194
|
const session = linkPopoverSessionRef.current;
|
|
17807
16195
|
addNavAfterAnchorRef.current = null;
|
|
17808
16196
|
setLinkPopover(null);
|
|
@@ -17810,9 +16198,9 @@ function OhhwellsBridge() {
|
|
|
17810
16198
|
reselectAfterLinkPopover(session.key);
|
|
17811
16199
|
}
|
|
17812
16200
|
}, [reselectAfterLinkPopover]);
|
|
17813
|
-
const closeLinkPopoverRef = (0,
|
|
16201
|
+
const closeLinkPopoverRef = (0, import_react15.useRef)(closeLinkPopover);
|
|
17814
16202
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
17815
|
-
const openLinkPopoverForActive = (0,
|
|
16203
|
+
const openLinkPopoverForActive = (0, import_react15.useCallback)(() => {
|
|
17816
16204
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
17817
16205
|
if (!hrefCtx) return;
|
|
17818
16206
|
bumpLinkPopoverGrace();
|
|
@@ -17823,15 +16211,11 @@ function OhhwellsBridge() {
|
|
|
17823
16211
|
});
|
|
17824
16212
|
deactivate();
|
|
17825
16213
|
}, [deactivate]);
|
|
17826
|
-
const openLinkPopoverForSelected = (0,
|
|
16214
|
+
const openLinkPopoverForSelected = (0, import_react15.useCallback)(() => {
|
|
17827
16215
|
const anchor = selectedElRef.current;
|
|
17828
16216
|
if (!anchor) return;
|
|
17829
16217
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
17830
16218
|
if (!key) return;
|
|
17831
|
-
if (requestSocialDialog(anchor, postToParentRef.current, editContentRef.current)) {
|
|
17832
|
-
deselect();
|
|
17833
|
-
return;
|
|
17834
|
-
}
|
|
17835
16219
|
bumpLinkPopoverGrace();
|
|
17836
16220
|
setLinkPopover({
|
|
17837
16221
|
key,
|
|
@@ -17840,7 +16224,7 @@ function OhhwellsBridge() {
|
|
|
17840
16224
|
});
|
|
17841
16225
|
deselect();
|
|
17842
16226
|
}, [deselect]);
|
|
17843
|
-
const handleSelectParent = (0,
|
|
16227
|
+
const handleSelectParent = (0, import_react15.useCallback)(() => {
|
|
17844
16228
|
const selected = selectedElRef.current;
|
|
17845
16229
|
if (!selected) return;
|
|
17846
16230
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -17867,35 +16251,11 @@ function OhhwellsBridge() {
|
|
|
17867
16251
|
}
|
|
17868
16252
|
deselectRef.current();
|
|
17869
16253
|
}, []);
|
|
17870
|
-
const handleDuplicateSelected = (0,
|
|
16254
|
+
const handleDuplicateSelected = (0, import_react15.useCallback)(() => {
|
|
17871
16255
|
const selected = selectedElRef.current;
|
|
17872
16256
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
17873
16257
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
17874
16258
|
if (!hrefKey) return;
|
|
17875
|
-
const social = getSocialItem(selected);
|
|
17876
|
-
if (social) {
|
|
17877
|
-
const result = duplicateSocialItem(social, editContentRef.current);
|
|
17878
|
-
if (!result) return;
|
|
17879
|
-
const orderJson = JSON.stringify(result.order);
|
|
17880
|
-
const carried = [
|
|
17881
|
-
{ from: result.copiedFrom?.href, to: result.hrefKey },
|
|
17882
|
-
{ from: result.copiedFrom?.icon, to: result.iconKey },
|
|
17883
|
-
{ from: result.copiedFrom?.icon ? socialPlatformKey(result.copiedFrom.icon) : null, to: socialPlatformKey(result.iconKey) }
|
|
17884
|
-
];
|
|
17885
|
-
const nodes = [{ key: SOCIALS_ORDER_KEY, text: orderJson }];
|
|
17886
|
-
for (const { from, to } of carried) {
|
|
17887
|
-
const value = from ? editContentRef.current[from] : void 0;
|
|
17888
|
-
if (value) nodes.push({ key: to, text: value });
|
|
17889
|
-
}
|
|
17890
|
-
editContentRef.current = {
|
|
17891
|
-
...editContentRef.current,
|
|
17892
|
-
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
17893
|
-
};
|
|
17894
|
-
postToParent2({ type: "ow:change", nodes });
|
|
17895
|
-
enforceLinkHrefs();
|
|
17896
|
-
requestAnimationFrame(() => selectRef.current(result.item));
|
|
17897
|
-
return;
|
|
17898
|
-
}
|
|
17899
16259
|
if (isNavbarHrefKey(hrefKey)) {
|
|
17900
16260
|
const result = duplicateNavbarItem(selected);
|
|
17901
16261
|
if (!result) return;
|
|
@@ -17981,7 +16341,7 @@ function OhhwellsBridge() {
|
|
|
17981
16341
|
});
|
|
17982
16342
|
}
|
|
17983
16343
|
}, [postToParent2]);
|
|
17984
|
-
const runPendingDeleteUndo = (0,
|
|
16344
|
+
const runPendingDeleteUndo = (0, import_react15.useCallback)(() => {
|
|
17985
16345
|
const pending = pendingDeleteUndoRef.current;
|
|
17986
16346
|
if (!pending) return false;
|
|
17987
16347
|
pendingDeleteUndoRef.current = null;
|
|
@@ -17989,7 +16349,7 @@ function OhhwellsBridge() {
|
|
|
17989
16349
|
enforceLinkHrefs();
|
|
17990
16350
|
return true;
|
|
17991
16351
|
}, []);
|
|
17992
|
-
const handleDeleteSelected = (0,
|
|
16352
|
+
const handleDeleteSelected = (0, import_react15.useCallback)(() => {
|
|
17993
16353
|
const selected = selectedElRef.current;
|
|
17994
16354
|
if (!selected) return false;
|
|
17995
16355
|
return deleteSelectedNavFooterItem({
|
|
@@ -18010,7 +16370,7 @@ function OhhwellsBridge() {
|
|
|
18010
16370
|
}, [postToParent2]);
|
|
18011
16371
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
18012
16372
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
18013
|
-
const handleLinkPopoverSubmit = (0,
|
|
16373
|
+
const handleLinkPopoverSubmit = (0, import_react15.useCallback)(
|
|
18014
16374
|
(target) => {
|
|
18015
16375
|
const session = linkPopoverSessionRef.current;
|
|
18016
16376
|
if (!session) return;
|
|
@@ -18076,19 +16436,19 @@ function OhhwellsBridge() {
|
|
|
18076
16436
|
const showEditLink = toolbarShowEditLink;
|
|
18077
16437
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
18078
16438
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
18079
|
-
const handleMediaReplace = (0,
|
|
16439
|
+
const handleMediaReplace = (0, import_react15.useCallback)(
|
|
18080
16440
|
(key) => {
|
|
18081
16441
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
18082
16442
|
},
|
|
18083
16443
|
[postToParent2, mediaHover?.elementType]
|
|
18084
16444
|
);
|
|
18085
|
-
const handleEditCarousel = (0,
|
|
16445
|
+
const handleEditCarousel = (0, import_react15.useCallback)(
|
|
18086
16446
|
(key) => {
|
|
18087
16447
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
18088
16448
|
},
|
|
18089
16449
|
[postToParent2]
|
|
18090
16450
|
);
|
|
18091
|
-
const handleMediaFadeOutComplete = (0,
|
|
16451
|
+
const handleMediaFadeOutComplete = (0, import_react15.useCallback)((key) => {
|
|
18092
16452
|
setUploadingRects((prev) => {
|
|
18093
16453
|
if (!(key in prev)) return prev;
|
|
18094
16454
|
const next = { ...prev };
|
|
@@ -18096,7 +16456,7 @@ function OhhwellsBridge() {
|
|
|
18096
16456
|
return next;
|
|
18097
16457
|
});
|
|
18098
16458
|
}, []);
|
|
18099
|
-
const handleVideoSettingsChange = (0,
|
|
16459
|
+
const handleVideoSettingsChange = (0, import_react15.useCallback)(
|
|
18100
16460
|
(key, settings) => {
|
|
18101
16461
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
18102
16462
|
const video = getVideoEl2(el);
|
|
@@ -18119,10 +16479,10 @@ function OhhwellsBridge() {
|
|
|
18119
16479
|
[postToParent2]
|
|
18120
16480
|
);
|
|
18121
16481
|
return bridgeRoot ? (0, import_react_dom4.createPortal)(
|
|
18122
|
-
/* @__PURE__ */ (0,
|
|
18123
|
-
/* @__PURE__ */ (0,
|
|
18124
|
-
isEditMode && /* @__PURE__ */ (0,
|
|
18125
|
-
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0,
|
|
16482
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
16483
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
16484
|
+
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AiSectionOverlay, { postToParent: postToParent2, apiRef: aiSectionApiRef }),
|
|
16485
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18126
16486
|
MediaOverlay,
|
|
18127
16487
|
{
|
|
18128
16488
|
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
@@ -18133,7 +16493,7 @@ function OhhwellsBridge() {
|
|
|
18133
16493
|
},
|
|
18134
16494
|
`uploading-${key}`
|
|
18135
16495
|
)),
|
|
18136
|
-
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0,
|
|
16496
|
+
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18137
16497
|
MediaOverlay,
|
|
18138
16498
|
{
|
|
18139
16499
|
hover: mediaHover,
|
|
@@ -18142,11 +16502,11 @@ function OhhwellsBridge() {
|
|
|
18142
16502
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
18143
16503
|
}
|
|
18144
16504
|
),
|
|
18145
|
-
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0,
|
|
18146
|
-
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0,
|
|
18147
|
-
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0,
|
|
18148
|
-
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0,
|
|
18149
|
-
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0,
|
|
16505
|
+
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
|
|
16506
|
+
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
16507
|
+
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
|
|
16508
|
+
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
|
|
16509
|
+
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18150
16510
|
"div",
|
|
18151
16511
|
{
|
|
18152
16512
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -18156,7 +16516,7 @@ function OhhwellsBridge() {
|
|
|
18156
16516
|
width: slot.width,
|
|
18157
16517
|
height: slot.height
|
|
18158
16518
|
},
|
|
18159
|
-
children: /* @__PURE__ */ (0,
|
|
16519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18160
16520
|
DropIndicator,
|
|
18161
16521
|
{
|
|
18162
16522
|
direction: slot.direction,
|
|
@@ -18167,7 +16527,7 @@ function OhhwellsBridge() {
|
|
|
18167
16527
|
},
|
|
18168
16528
|
`footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
|
|
18169
16529
|
)),
|
|
18170
|
-
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0,
|
|
16530
|
+
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18171
16531
|
"div",
|
|
18172
16532
|
{
|
|
18173
16533
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -18177,7 +16537,7 @@ function OhhwellsBridge() {
|
|
|
18177
16537
|
width: slot.width,
|
|
18178
16538
|
height: slot.height
|
|
18179
16539
|
},
|
|
18180
|
-
children: /* @__PURE__ */ (0,
|
|
16540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18181
16541
|
DropIndicator,
|
|
18182
16542
|
{
|
|
18183
16543
|
direction: slot.direction,
|
|
@@ -18188,10 +16548,10 @@ function OhhwellsBridge() {
|
|
|
18188
16548
|
},
|
|
18189
16549
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
18190
16550
|
)),
|
|
18191
|
-
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0,
|
|
18192
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0,
|
|
18193
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0,
|
|
18194
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0,
|
|
16551
|
+
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
16552
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
16553
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
16554
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18195
16555
|
FooterContainerChrome,
|
|
18196
16556
|
{
|
|
18197
16557
|
rect: toolbarRect,
|
|
@@ -18199,7 +16559,7 @@ function OhhwellsBridge() {
|
|
|
18199
16559
|
addDisabled: !canAddFooterColumn()
|
|
18200
16560
|
}
|
|
18201
16561
|
),
|
|
18202
|
-
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame"
|
|
16562
|
+
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18203
16563
|
ItemInteractionLayer,
|
|
18204
16564
|
{
|
|
18205
16565
|
rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
|
|
@@ -18211,10 +16571,10 @@ function OhhwellsBridge() {
|
|
|
18211
16571
|
dragHandleLabel: reorderHrefKey ? `Reorder ${reorderHrefKey}` : "Reorder item",
|
|
18212
16572
|
onDragHandleDragStart: handleItemDragStart,
|
|
18213
16573
|
onDragHandleDragEnd: handleItemDragEnd,
|
|
18214
|
-
onItemPointerDown:
|
|
18215
|
-
onItemClick:
|
|
18216
|
-
itemDragSurface:
|
|
18217
|
-
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" &&
|
|
16574
|
+
onItemPointerDown: handleItemChromePointerDown,
|
|
16575
|
+
onItemClick: handleItemChromeClick,
|
|
16576
|
+
itemDragSurface: !isFooterFrameSelection,
|
|
16577
|
+
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && isFooterFrameSelection && !isItemDragging ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18218
16578
|
ItemActionToolbar,
|
|
18219
16579
|
{
|
|
18220
16580
|
onEditLink: openLinkPopoverForSelected,
|
|
@@ -18225,12 +16585,12 @@ function OhhwellsBridge() {
|
|
|
18225
16585
|
addItemDisabled: false,
|
|
18226
16586
|
editLinkDisabled: false,
|
|
18227
16587
|
moreDisabled: false,
|
|
18228
|
-
duplicateDisabled: isFooterFrameSelection
|
|
18229
|
-
showEditLink: !isFooterFrameSelection &&
|
|
18230
|
-
showAddItem: isFooterFrameSelection ||
|
|
16588
|
+
duplicateDisabled: isFooterFrameSelection,
|
|
16589
|
+
showEditLink: !isFooterFrameSelection && navDropdownPreviewOpen === null,
|
|
16590
|
+
showAddItem: isFooterFrameSelection || !selectedIsCta && Boolean(
|
|
18231
16591
|
selectedElRef.current && isNavbarHrefKey(selectedElRef.current.getAttribute("data-ohw-href-key")) && !isNestedNavChild(selectedElRef.current)
|
|
18232
16592
|
),
|
|
18233
|
-
showMore:
|
|
16593
|
+
showMore: !selectedIsCta || isFooterFrameSelection,
|
|
18234
16594
|
dropdownOpen: navDropdownPreviewOpen,
|
|
18235
16595
|
onDropdownOpenChange: handleNavDropdownOpenChange,
|
|
18236
16596
|
headingVisible: footerHeadingVisible,
|
|
@@ -18239,8 +16599,8 @@ function OhhwellsBridge() {
|
|
|
18239
16599
|
) : void 0
|
|
18240
16600
|
}
|
|
18241
16601
|
),
|
|
18242
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0,
|
|
18243
|
-
/* @__PURE__ */ (0,
|
|
16602
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
16603
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18244
16604
|
EditGlowChrome,
|
|
18245
16605
|
{
|
|
18246
16606
|
rect: toolbarRect,
|
|
@@ -18250,7 +16610,7 @@ function OhhwellsBridge() {
|
|
|
18250
16610
|
hideHandle: isItemDragging
|
|
18251
16611
|
}
|
|
18252
16612
|
),
|
|
18253
|
-
/* @__PURE__ */ (0,
|
|
16613
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18254
16614
|
FloatingToolbar,
|
|
18255
16615
|
{
|
|
18256
16616
|
rect: toolbarRect,
|
|
@@ -18263,7 +16623,7 @@ function OhhwellsBridge() {
|
|
|
18263
16623
|
}
|
|
18264
16624
|
)
|
|
18265
16625
|
] }),
|
|
18266
|
-
maxBadge && /* @__PURE__ */ (0,
|
|
16626
|
+
maxBadge && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
18267
16627
|
"div",
|
|
18268
16628
|
{
|
|
18269
16629
|
"data-ohw-max-badge": "",
|
|
@@ -18289,7 +16649,7 @@ function OhhwellsBridge() {
|
|
|
18289
16649
|
]
|
|
18290
16650
|
}
|
|
18291
16651
|
),
|
|
18292
|
-
toggleState && !linkPopover && /* @__PURE__ */ (0,
|
|
16652
|
+
toggleState && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18293
16653
|
StateToggle,
|
|
18294
16654
|
{
|
|
18295
16655
|
rect: toggleState.rect,
|
|
@@ -18298,15 +16658,15 @@ function OhhwellsBridge() {
|
|
|
18298
16658
|
onStateChange: handleStateChange
|
|
18299
16659
|
}
|
|
18300
16660
|
),
|
|
18301
|
-
sectionGap && !linkPopover && /* @__PURE__ */ (0,
|
|
16661
|
+
sectionGap && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
18302
16662
|
"div",
|
|
18303
16663
|
{
|
|
18304
16664
|
"data-ohw-section-insert-line": "",
|
|
18305
16665
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
18306
16666
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
18307
16667
|
children: [
|
|
18308
|
-
/* @__PURE__ */ (0,
|
|
18309
|
-
/* @__PURE__ */ (0,
|
|
16668
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
16669
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18310
16670
|
Badge,
|
|
18311
16671
|
{
|
|
18312
16672
|
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",
|
|
@@ -18323,11 +16683,11 @@ function OhhwellsBridge() {
|
|
|
18323
16683
|
children: "Add Section"
|
|
18324
16684
|
}
|
|
18325
16685
|
),
|
|
18326
|
-
/* @__PURE__ */ (0,
|
|
16686
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
18327
16687
|
]
|
|
18328
16688
|
}
|
|
18329
16689
|
),
|
|
18330
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0,
|
|
16690
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18331
16691
|
LinkPopover,
|
|
18332
16692
|
{
|
|
18333
16693
|
panelRef: linkPopoverPanelRef,
|
|
@@ -18343,115 +16703,11 @@ function OhhwellsBridge() {
|
|
|
18343
16703
|
onSubmit: handleLinkPopoverSubmit
|
|
18344
16704
|
},
|
|
18345
16705
|
linkPopover.key
|
|
18346
|
-
) : null,
|
|
18347
|
-
floatingPanel && floatingPanel.kind === "logo-size" && logoSizeDraft ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18348
|
-
FloatingPanel,
|
|
18349
|
-
{
|
|
18350
|
-
open: true,
|
|
18351
|
-
title: floatingPanel.title,
|
|
18352
|
-
context: floatingPanel.context,
|
|
18353
|
-
position: floatingPanelPos,
|
|
18354
|
-
onPositionChange: setFloatingPanelPos,
|
|
18355
|
-
parentScroll: parentScrollSnap ?? parentScrollRef.current,
|
|
18356
|
-
onClose: closeFloatingPanelAndDeselect,
|
|
18357
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18358
|
-
LogoSizePanel,
|
|
18359
|
-
{
|
|
18360
|
-
viewport: editorViewport,
|
|
18361
|
-
sizePx: editorViewport === "mobile" && !logoSizeDraft.mobileFollowing ? logoSizeDraft.mobilePx : logoSizeDraft.desktopPx,
|
|
18362
|
-
mobileFollowing: logoSizeDraft.mobileFollowing,
|
|
18363
|
-
onSizeChange: (px) => {
|
|
18364
|
-
const next = editorViewport === "mobile" ? { ...logoSizeDraft, mobilePx: px, mobileFollowing: false } : {
|
|
18365
|
-
...logoSizeDraft,
|
|
18366
|
-
desktopPx: px,
|
|
18367
|
-
mobilePx: logoSizeDraft.mobileFollowing ? px : logoSizeDraft.mobilePx
|
|
18368
|
-
};
|
|
18369
|
-
setLogoSizeDraft(next);
|
|
18370
|
-
persistLogoSizeDraft(floatingPanel.placement, next);
|
|
18371
|
-
},
|
|
18372
|
-
onCustomizeMobile: () => {
|
|
18373
|
-
const next = {
|
|
18374
|
-
...logoSizeDraft,
|
|
18375
|
-
mobileFollowing: false,
|
|
18376
|
-
mobilePx: logoSizeDraft.desktopPx
|
|
18377
|
-
};
|
|
18378
|
-
setLogoSizeDraft(next);
|
|
18379
|
-
persistLogoSizeDraft(floatingPanel.placement, next);
|
|
18380
|
-
},
|
|
18381
|
-
onResetMobile: () => {
|
|
18382
|
-
const next = {
|
|
18383
|
-
...logoSizeDraft,
|
|
18384
|
-
mobileFollowing: true,
|
|
18385
|
-
mobilePx: logoSizeDraft.desktopPx
|
|
18386
|
-
};
|
|
18387
|
-
setLogoSizeDraft(next);
|
|
18388
|
-
persistLogoSizeDraft(floatingPanel.placement, next);
|
|
18389
|
-
},
|
|
18390
|
-
onUpdateEverywhere: () => {
|
|
18391
|
-
const identity = readLogoIdentityFromDom();
|
|
18392
|
-
postToParent2({ type: "ow:open-logo-settings", ...identity });
|
|
18393
|
-
}
|
|
18394
|
-
}
|
|
18395
|
-
)
|
|
18396
|
-
}
|
|
18397
16706
|
) : null
|
|
18398
16707
|
] }),
|
|
18399
16708
|
bridgeRoot
|
|
18400
16709
|
) : null;
|
|
18401
16710
|
}
|
|
18402
|
-
|
|
18403
|
-
// src/ui/EmptySection.tsx
|
|
18404
|
-
var import_link = __toESM(require("next/link"), 1);
|
|
18405
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
18406
|
-
function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey }) {
|
|
18407
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
18408
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18409
|
-
"p",
|
|
18410
|
-
{
|
|
18411
|
-
style: {
|
|
18412
|
-
fontFamily: "var(--brand-font-body)",
|
|
18413
|
-
fontSize: "0.75rem",
|
|
18414
|
-
fontWeight: 500,
|
|
18415
|
-
letterSpacing: "0.15em",
|
|
18416
|
-
textTransform: "uppercase",
|
|
18417
|
-
color: "var(--brand-accent)",
|
|
18418
|
-
marginBottom: "1.5rem"
|
|
18419
|
-
},
|
|
18420
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_link.default, { href: homeHref, style: { color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { ...eyebrowKey ? { "data-ohw-editable": "text", "data-ohw-key": eyebrowKey } : {}, children: "Home" }) })
|
|
18421
|
-
}
|
|
18422
|
-
),
|
|
18423
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18424
|
-
"h1",
|
|
18425
|
-
{
|
|
18426
|
-
style: {
|
|
18427
|
-
fontFamily: "var(--brand-font-heading)",
|
|
18428
|
-
fontSize: "clamp(2rem, 3.5vw, 2.75rem)",
|
|
18429
|
-
lineHeight: 1.1,
|
|
18430
|
-
letterSpacing: "-0.025em",
|
|
18431
|
-
color: "var(--brand-text)",
|
|
18432
|
-
marginBottom: "1rem"
|
|
18433
|
-
},
|
|
18434
|
-
...titleKey ? { "data-ohw-editable": "text", "data-ohw-key": titleKey, "data-ohw-max-length": 80 } : {},
|
|
18435
|
-
children: title
|
|
18436
|
-
}
|
|
18437
|
-
),
|
|
18438
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18439
|
-
"p",
|
|
18440
|
-
{
|
|
18441
|
-
style: {
|
|
18442
|
-
fontFamily: "var(--brand-font-body)",
|
|
18443
|
-
fontSize: "1rem",
|
|
18444
|
-
lineHeight: 1.7,
|
|
18445
|
-
fontWeight: 300,
|
|
18446
|
-
color: "var(--brand-text-muted)",
|
|
18447
|
-
maxWidth: "340px"
|
|
18448
|
-
},
|
|
18449
|
-
...subtitleKey ? { "data-ohw-editable": "text", "data-ohw-key": subtitleKey, "data-ohw-max-length": 160 } : {},
|
|
18450
|
-
children: "This page doesn't have any content yet."
|
|
18451
|
-
}
|
|
18452
|
-
)
|
|
18453
|
-
] });
|
|
18454
|
-
}
|
|
18455
16711
|
// Annotate the CommonJS export names for ESM import in node:
|
|
18456
16712
|
0 && (module.exports = {
|
|
18457
16713
|
AI_DEFAULT_BRAND,
|
|
@@ -18469,7 +16725,6 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
18469
16725
|
DropdownMenuItem,
|
|
18470
16726
|
DropdownMenuSeparator,
|
|
18471
16727
|
DropdownMenuTrigger,
|
|
18472
|
-
EmptySection,
|
|
18473
16728
|
ItemActionToolbar,
|
|
18474
16729
|
ItemInteractionLayer,
|
|
18475
16730
|
LinkEditorPanel,
|