@ohhwells/bridge 0.1.55 → 0.1.57
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 +1383 -275
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1383 -269
- package/dist/index.js.map +1 -1
- package/dist/styles.css +50 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -74,7 +74,7 @@ __export(index_exports, {
|
|
|
74
74
|
module.exports = __toCommonJS(index_exports);
|
|
75
75
|
|
|
76
76
|
// src/OhhwellsBridge.tsx
|
|
77
|
-
var
|
|
77
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
78
78
|
var import_client2 = require("react-dom/client");
|
|
79
79
|
var import_react_dom3 = require("react-dom");
|
|
80
80
|
|
|
@@ -235,13 +235,17 @@ function MediaBox({
|
|
|
235
235
|
const url = refValue ? ctx.resolveMedia(refValue) : null;
|
|
236
236
|
const isIcon = /^(lucide|simple):/.test(refValue);
|
|
237
237
|
const aspectRatio = aspect && /^\d+:\d+$/.test(aspect) ? aspect.replace(":", " / ") : void 0;
|
|
238
|
-
const editAttrs = ctx.keyFor && editPath
|
|
238
|
+
const editAttrs = ctx.keyFor && editPath ? {
|
|
239
|
+
"data-ohw-key": ctx.keyFor(editPath),
|
|
240
|
+
"data-ohw-editable": isIcon ? "icon" : "image"
|
|
241
|
+
} : {};
|
|
239
242
|
if (isIcon) {
|
|
240
243
|
const Icon = refValue.startsWith("lucide:") ? lucideByName(refValue.slice(7)) : null;
|
|
241
244
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
245
|
"span",
|
|
243
246
|
{
|
|
244
247
|
"data-ai-icon": refValue,
|
|
248
|
+
...editAttrs,
|
|
245
249
|
style: {
|
|
246
250
|
display: "inline-flex",
|
|
247
251
|
width: 48,
|
|
@@ -5935,6 +5939,7 @@ function ToolbarActionTooltip({
|
|
|
5935
5939
|
function ItemActionToolbar({
|
|
5936
5940
|
onEditLink,
|
|
5937
5941
|
onAddItem,
|
|
5942
|
+
onStyle,
|
|
5938
5943
|
onSelectParent,
|
|
5939
5944
|
onDuplicate,
|
|
5940
5945
|
onDelete,
|
|
@@ -5946,6 +5951,8 @@ function ItemActionToolbar({
|
|
|
5946
5951
|
deleteDisabled = false,
|
|
5947
5952
|
showEditLink = true,
|
|
5948
5953
|
showAddItem = true,
|
|
5954
|
+
showStyle = false,
|
|
5955
|
+
styleActive = false,
|
|
5949
5956
|
showMore = true,
|
|
5950
5957
|
tooltipSide = "bottom",
|
|
5951
5958
|
dropdownOpen = null,
|
|
@@ -6019,6 +6026,22 @@ function ItemActionToolbar({
|
|
|
6019
6026
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
6020
6027
|
}
|
|
6021
6028
|
) : null,
|
|
6029
|
+
showStyle ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6030
|
+
ToolbarActionTooltip,
|
|
6031
|
+
{
|
|
6032
|
+
label: "Style",
|
|
6033
|
+
side: tooltipSide,
|
|
6034
|
+
buttonProps: {
|
|
6035
|
+
active: styleActive,
|
|
6036
|
+
onMouseDown: (e) => {
|
|
6037
|
+
e.preventDefault();
|
|
6038
|
+
e.stopPropagation();
|
|
6039
|
+
onStyle?.();
|
|
6040
|
+
}
|
|
6041
|
+
},
|
|
6042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.Brush, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
6043
|
+
}
|
|
6044
|
+
) : null,
|
|
6022
6045
|
showAddItem ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6023
6046
|
ToolbarActionTooltip,
|
|
6024
6047
|
{
|
|
@@ -7002,6 +7025,47 @@ function AiSectionOverlay({
|
|
|
7002
7025
|
] });
|
|
7003
7026
|
}
|
|
7004
7027
|
|
|
7028
|
+
// src/lib/section-instances.ts
|
|
7029
|
+
var SECTION_ORDER_KEY = "__ohw_section_order";
|
|
7030
|
+
function getPageSectionOrderEntries(raw, currentPath) {
|
|
7031
|
+
if (!raw) return [];
|
|
7032
|
+
try {
|
|
7033
|
+
const entries = JSON.parse(raw);
|
|
7034
|
+
return entries.filter((e) => !e.pagePath || e.pagePath === currentPath);
|
|
7035
|
+
} catch {
|
|
7036
|
+
return [];
|
|
7037
|
+
}
|
|
7038
|
+
}
|
|
7039
|
+
function rekeySectionSubtree(root, instanceId) {
|
|
7040
|
+
const suffix = `::${instanceId}`;
|
|
7041
|
+
const rekey = (el, attr) => {
|
|
7042
|
+
const current = el.getAttribute(attr);
|
|
7043
|
+
if (current) el.setAttribute(attr, `${current}${suffix}`);
|
|
7044
|
+
};
|
|
7045
|
+
if (root.hasAttribute("data-ohw-key")) rekey(root, "data-ohw-key");
|
|
7046
|
+
if (root.hasAttribute("data-ohw-href-key")) rekey(root, "data-ohw-href-key");
|
|
7047
|
+
root.querySelectorAll("[data-ohw-key]").forEach((el) => rekey(el, "data-ohw-key"));
|
|
7048
|
+
root.querySelectorAll("[data-ohw-href-key]").forEach((el) => rekey(el, "data-ohw-href-key"));
|
|
7049
|
+
}
|
|
7050
|
+
function initSectionInstancesFromContent(content, currentPath) {
|
|
7051
|
+
document.querySelectorAll("[data-ohw-section]:not([data-ohw-instance])").forEach((el) => {
|
|
7052
|
+
el.setAttribute("data-ohw-instance", el.getAttribute("data-ohw-section") ?? "");
|
|
7053
|
+
});
|
|
7054
|
+
const entries = getPageSectionOrderEntries(content[SECTION_ORDER_KEY], currentPath);
|
|
7055
|
+
for (const entry of entries) {
|
|
7056
|
+
if (entry.instanceId === entry.type) continue;
|
|
7057
|
+
if (document.querySelector(`[data-ohw-instance="${CSS.escape(entry.instanceId)}"]`)) continue;
|
|
7058
|
+
const original = document.querySelector(
|
|
7059
|
+
`[data-ohw-section="${CSS.escape(entry.type)}"][data-ohw-instance="${CSS.escape(entry.type)}"]`
|
|
7060
|
+
);
|
|
7061
|
+
if (!original) continue;
|
|
7062
|
+
const clone = original.cloneNode(true);
|
|
7063
|
+
clone.setAttribute("data-ohw-instance", entry.instanceId);
|
|
7064
|
+
rekeySectionSubtree(clone, entry.instanceId);
|
|
7065
|
+
original.insertAdjacentElement("afterend", clone);
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
7068
|
+
|
|
7005
7069
|
// src/OhhwellsBridge.tsx
|
|
7006
7070
|
var import_react_dom4 = require("react-dom");
|
|
7007
7071
|
var import_navigation3 = require("next/navigation");
|
|
@@ -7034,9 +7098,16 @@ function isPointOverBridgeChrome(x, y) {
|
|
|
7034
7098
|
}
|
|
7035
7099
|
return false;
|
|
7036
7100
|
}
|
|
7037
|
-
|
|
7101
|
+
var BUTTON_LIKE_SELECTOR = `button, [role="button"], ${CTA_BUTTON_SELECTOR}`;
|
|
7102
|
+
function isButtonLikeElement(el) {
|
|
7103
|
+
return el.matches(BUTTON_LIKE_SELECTOR);
|
|
7104
|
+
}
|
|
7105
|
+
function findClosestButtonLike(target) {
|
|
7106
|
+
return target.closest(BUTTON_LIKE_SELECTOR);
|
|
7107
|
+
}
|
|
7108
|
+
function findButtonAtPoint(x, y, media) {
|
|
7038
7109
|
const hits = Array.from(
|
|
7039
|
-
document.querySelectorAll(
|
|
7110
|
+
document.querySelectorAll(BUTTON_LIKE_SELECTOR)
|
|
7040
7111
|
).filter((el) => containsPoint(el, x, y) && !(media && el.contains(media)));
|
|
7041
7112
|
if (hits.length === 0) return null;
|
|
7042
7113
|
return hits.reduce((best, el) => best.contains(el) ? el : best);
|
|
@@ -9525,6 +9596,449 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
9525
9596
|
};
|
|
9526
9597
|
}
|
|
9527
9598
|
|
|
9599
|
+
// src/lib/icon-markup.ts
|
|
9600
|
+
var GLYPH_SELECTOR = "svg, img";
|
|
9601
|
+
function referenceBox(slot) {
|
|
9602
|
+
const row = slot.closest("[data-ohw-socials-row]") ?? slot.closest("a")?.parentElement ?? null;
|
|
9603
|
+
const neighbour = row ? Array.from(row.querySelectorAll('[data-ohw-editable="icon"]')).find((el) => el !== slot) : null;
|
|
9604
|
+
const source = (neighbour ?? slot).querySelector(GLYPH_SELECTOR);
|
|
9605
|
+
const box = source?.getBoundingClientRect() ?? null;
|
|
9606
|
+
return box?.width && box.height ? box : null;
|
|
9607
|
+
}
|
|
9608
|
+
function iconMarkupSizedFor(slot, markup) {
|
|
9609
|
+
const box = referenceBox(slot);
|
|
9610
|
+
if (!box) return markup;
|
|
9611
|
+
const holder = document.createElement("div");
|
|
9612
|
+
holder.innerHTML = markup;
|
|
9613
|
+
const glyph = holder.querySelector(GLYPH_SELECTOR);
|
|
9614
|
+
if (!glyph) return markup;
|
|
9615
|
+
glyph.style.width = `${Math.round(box.width)}px`;
|
|
9616
|
+
glyph.style.height = `${Math.round(box.height)}px`;
|
|
9617
|
+
return holder.innerHTML;
|
|
9618
|
+
}
|
|
9619
|
+
function applyIconMarkup(slot, markup) {
|
|
9620
|
+
if (!markup) return;
|
|
9621
|
+
const coloured = iconMarkupInheritingColour(markup);
|
|
9622
|
+
const sized = iconMarkupSizedFor(slot, coloured);
|
|
9623
|
+
if (slot.innerHTML !== sized) slot.innerHTML = sized;
|
|
9624
|
+
if (sized === coloured) {
|
|
9625
|
+
requestAnimationFrame(() => {
|
|
9626
|
+
if (!slot.isConnected) return;
|
|
9627
|
+
const resized = iconMarkupSizedFor(slot, coloured);
|
|
9628
|
+
if (resized !== coloured && slot.innerHTML !== resized) slot.innerHTML = resized;
|
|
9629
|
+
});
|
|
9630
|
+
}
|
|
9631
|
+
}
|
|
9632
|
+
function detectIconStyle(el) {
|
|
9633
|
+
const row = el.closest("[data-ohw-socials-row]");
|
|
9634
|
+
const glyphs = Array.from((row ?? el).querySelectorAll("svg"));
|
|
9635
|
+
const outlined = glyphs.some((svg) => {
|
|
9636
|
+
return Array.from(svg.querySelectorAll("*")).some((node) => {
|
|
9637
|
+
return node.getAttribute("stroke") !== null && node.getAttribute("stroke") !== "none";
|
|
9638
|
+
});
|
|
9639
|
+
});
|
|
9640
|
+
return outlined ? "outline" : "fill";
|
|
9641
|
+
}
|
|
9642
|
+
function iconMarkupInheritingColour(markup) {
|
|
9643
|
+
const holder = document.createElement("div");
|
|
9644
|
+
holder.innerHTML = markup;
|
|
9645
|
+
holder.querySelectorAll("svg *").forEach((node) => {
|
|
9646
|
+
if (node.getAttribute("fill") && node.getAttribute("fill") !== "none") {
|
|
9647
|
+
node.setAttribute("fill", "currentColor");
|
|
9648
|
+
}
|
|
9649
|
+
if (node.getAttribute("stroke") && node.getAttribute("stroke") !== "none") {
|
|
9650
|
+
node.setAttribute("stroke", "currentColor");
|
|
9651
|
+
}
|
|
9652
|
+
});
|
|
9653
|
+
return holder.innerHTML;
|
|
9654
|
+
}
|
|
9655
|
+
|
|
9656
|
+
// src/lib/socials-items.ts
|
|
9657
|
+
var ICON_SELECTOR = '[data-ohw-editable="icon"]';
|
|
9658
|
+
var SOCIAL_KEY_RE = /(^|-)social(s)?(-|$)/i;
|
|
9659
|
+
var SOCIALS_ROW_ATTR = "data-ohw-socials-row";
|
|
9660
|
+
var SOCIALS_ITEM_ATTR = "data-ohw-social-item";
|
|
9661
|
+
function isSocialItem(el) {
|
|
9662
|
+
if (!el) return false;
|
|
9663
|
+
const anchor = el instanceof HTMLAnchorElement ? el : el.closest("a");
|
|
9664
|
+
if (!anchor) return false;
|
|
9665
|
+
if (SOCIAL_KEY_RE.test(anchor.getAttribute("data-ohw-href-key") ?? "")) return true;
|
|
9666
|
+
return anchor.querySelectorAll(ICON_SELECTOR).length === 1;
|
|
9667
|
+
}
|
|
9668
|
+
function getSocialItem(el) {
|
|
9669
|
+
const anchor = el.closest("a");
|
|
9670
|
+
return isSocialItem(anchor) ? anchor : null;
|
|
9671
|
+
}
|
|
9672
|
+
function findSocialsRow(el) {
|
|
9673
|
+
const item = getSocialItem(el);
|
|
9674
|
+
if (!item) return null;
|
|
9675
|
+
const wrapper = item.parentElement;
|
|
9676
|
+
const row = wrapper && wrapper.querySelectorAll("a").length === 1 && wrapper.matches("li, div, span") ? wrapper.parentElement : wrapper;
|
|
9677
|
+
if (!row) return null;
|
|
9678
|
+
const anchors = Array.from(row.querySelectorAll("a"));
|
|
9679
|
+
if (!anchors.length || !anchors.every((anchor) => isSocialItem(anchor))) return null;
|
|
9680
|
+
return row;
|
|
9681
|
+
}
|
|
9682
|
+
function isSocialsRow(el) {
|
|
9683
|
+
const anchors = Array.from(el.querySelectorAll("a"));
|
|
9684
|
+
return anchors.length > 0 && anchors.every((anchor) => isSocialItem(anchor));
|
|
9685
|
+
}
|
|
9686
|
+
function listSocialItems(row) {
|
|
9687
|
+
return Array.from(row.children).map((child) => {
|
|
9688
|
+
if (!(child instanceof HTMLElement)) return null;
|
|
9689
|
+
const anchor = child.matches("a") ? child : child.querySelector("a");
|
|
9690
|
+
return isSocialItem(anchor) ? anchor : null;
|
|
9691
|
+
}).filter((item) => item !== null);
|
|
9692
|
+
}
|
|
9693
|
+
function socialRowUnit(item) {
|
|
9694
|
+
const row = findSocialsRow(item);
|
|
9695
|
+
let node = item;
|
|
9696
|
+
while (node.parentElement && node.parentElement !== row) {
|
|
9697
|
+
node = node.parentElement;
|
|
9698
|
+
}
|
|
9699
|
+
return node;
|
|
9700
|
+
}
|
|
9701
|
+
function listSocialsRows(root = document) {
|
|
9702
|
+
const rows = /* @__PURE__ */ new Set();
|
|
9703
|
+
root.querySelectorAll(`${ICON_SELECTOR}, a[data-ohw-href-key]`).forEach((el) => {
|
|
9704
|
+
const row = findSocialsRow(el);
|
|
9705
|
+
if (row) rows.add(row);
|
|
9706
|
+
});
|
|
9707
|
+
root.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`).forEach((row) => rows.add(row));
|
|
9708
|
+
return Array.from(rows);
|
|
9709
|
+
}
|
|
9710
|
+
var rowTemplates = /* @__PURE__ */ new Map();
|
|
9711
|
+
function markSocialsRows(root = document) {
|
|
9712
|
+
root.querySelectorAll(`[${SOCIALS_ITEM_ATTR}]`).forEach((item) => {
|
|
9713
|
+
item.removeAttribute(SOCIALS_ITEM_ATTR);
|
|
9714
|
+
});
|
|
9715
|
+
listSocialsRows(root).forEach((row) => {
|
|
9716
|
+
row.setAttribute(SOCIALS_ROW_ATTR, "");
|
|
9717
|
+
const items = listSocialItems(row);
|
|
9718
|
+
if (items[0]) rowTemplates.set(rowKeyOf(row), socialRowUnit(items[0]).outerHTML);
|
|
9719
|
+
items.forEach((item, index) => {
|
|
9720
|
+
item.setAttribute(SOCIALS_ITEM_ATTR, String(index));
|
|
9721
|
+
const iconKey = socialIconKey(item);
|
|
9722
|
+
if (iconKey) ensureLabelSlot(item, iconKey);
|
|
9723
|
+
});
|
|
9724
|
+
});
|
|
9725
|
+
}
|
|
9726
|
+
var SOCIALS_LABEL_ATTR = "data-ohw-social-label";
|
|
9727
|
+
function ensureLabelSlot(item, iconKey) {
|
|
9728
|
+
if (socialLabelElement(item)) return;
|
|
9729
|
+
const label = document.createElement("span");
|
|
9730
|
+
label.setAttribute("data-ohw-key", `${iconKey}-label`);
|
|
9731
|
+
label.setAttribute("data-ohw-editable", "text");
|
|
9732
|
+
label.setAttribute(SOCIALS_LABEL_ATTR, "");
|
|
9733
|
+
label.style.display = "none";
|
|
9734
|
+
label.textContent = item.getAttribute("aria-label") ?? "";
|
|
9735
|
+
item.appendChild(label);
|
|
9736
|
+
}
|
|
9737
|
+
function socialLabelElement(item) {
|
|
9738
|
+
return item.querySelector(
|
|
9739
|
+
`[${SOCIALS_LABEL_ATTR}], [data-ohw-editable="text"], [data-ohw-editable="plain"]`
|
|
9740
|
+
);
|
|
9741
|
+
}
|
|
9742
|
+
function socialLabelKey(iconKey) {
|
|
9743
|
+
return `${iconKey}-label`;
|
|
9744
|
+
}
|
|
9745
|
+
function applyStoredValues(item, content) {
|
|
9746
|
+
const hrefKey = socialHrefKey(item);
|
|
9747
|
+
const iconKey = socialIconKey(item);
|
|
9748
|
+
if (hrefKey && content[hrefKey] !== void 0) item.setAttribute("href", content[hrefKey]);
|
|
9749
|
+
if (iconKey) {
|
|
9750
|
+
const glyph = item.querySelector(ICON_SELECTOR);
|
|
9751
|
+
if (glyph && content[iconKey]) applyIconMarkup(glyph, content[iconKey]);
|
|
9752
|
+
const label = item.querySelector(`[${SOCIALS_LABEL_ATTR}]`);
|
|
9753
|
+
label?.setAttribute("data-ohw-key", socialLabelKey(iconKey));
|
|
9754
|
+
const stored = content[socialLabelKey(iconKey)];
|
|
9755
|
+
if (label && stored) label.textContent = stored;
|
|
9756
|
+
}
|
|
9757
|
+
}
|
|
9758
|
+
function socialPlatformKey(iconKey) {
|
|
9759
|
+
return `${iconKey}-platform`;
|
|
9760
|
+
}
|
|
9761
|
+
function socialHrefKey(item) {
|
|
9762
|
+
return item.getAttribute("data-ohw-href-key");
|
|
9763
|
+
}
|
|
9764
|
+
function socialIconKey(item) {
|
|
9765
|
+
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
9766
|
+
}
|
|
9767
|
+
var SOCIALS_ORDER_KEY = "__ohw_socials_order";
|
|
9768
|
+
function fromMarkup(markup) {
|
|
9769
|
+
const holder = document.createElement("div");
|
|
9770
|
+
holder.innerHTML = markup;
|
|
9771
|
+
return holder.firstElementChild instanceof HTMLElement ? holder.firstElementChild : null;
|
|
9772
|
+
}
|
|
9773
|
+
var rowKeys = /* @__PURE__ */ new WeakMap();
|
|
9774
|
+
function rowKeyOf(row) {
|
|
9775
|
+
const first = listSocialItems(row)[0];
|
|
9776
|
+
const itemKey = first ? socialIconKey(first) ?? socialHrefKey(first)?.replace(/-href$/, "") : null;
|
|
9777
|
+
const derived = itemKey?.replace(/-[^-]+$/, "") || null;
|
|
9778
|
+
if (derived) rowKeys.set(row, derived);
|
|
9779
|
+
return derived ?? rowKeys.get(row) ?? "social";
|
|
9780
|
+
}
|
|
9781
|
+
function getSocialsOrderFromDom(root = document) {
|
|
9782
|
+
const order = {};
|
|
9783
|
+
listSocialsRows(root).forEach((row) => {
|
|
9784
|
+
order[rowKeyOf(row)] = listSocialItems(row).map((item) => socialHrefKey(item)).filter((key) => Boolean(key));
|
|
9785
|
+
});
|
|
9786
|
+
return order;
|
|
9787
|
+
}
|
|
9788
|
+
function hasStoredValue(content, hrefKey) {
|
|
9789
|
+
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9790
|
+
return Boolean(content[hrefKey]) || Boolean(content[iconKey]);
|
|
9791
|
+
}
|
|
9792
|
+
function parseSocialsOrder(raw) {
|
|
9793
|
+
if (!raw) return null;
|
|
9794
|
+
try {
|
|
9795
|
+
const parsed = JSON.parse(raw);
|
|
9796
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9797
|
+
} catch {
|
|
9798
|
+
return null;
|
|
9799
|
+
}
|
|
9800
|
+
}
|
|
9801
|
+
function nextSocialIndex(row, rowKey, content) {
|
|
9802
|
+
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));
|
|
9803
|
+
return Math.max(-1, ...used) + 1;
|
|
9804
|
+
}
|
|
9805
|
+
function insertSocialItem(row, after, content = {}) {
|
|
9806
|
+
const rowKey = rowKeyOf(row);
|
|
9807
|
+
const template = listSocialItems(row)[0];
|
|
9808
|
+
const remembered = rowTemplates.get(rowKey);
|
|
9809
|
+
if (!template && !remembered) return null;
|
|
9810
|
+
const index = nextSocialIndex(row, rowKey, content);
|
|
9811
|
+
const iconKey = `${rowKey}-${index}`;
|
|
9812
|
+
const hrefKey = `${iconKey}-href`;
|
|
9813
|
+
const templateUnit = template ? socialRowUnit(template) : null;
|
|
9814
|
+
const unit = templateUnit ? templateUnit.cloneNode(true) : fromMarkup(remembered);
|
|
9815
|
+
const item = unit && (unit.matches("a") ? unit : unit.querySelector("a"));
|
|
9816
|
+
if (!unit || !item) return null;
|
|
9817
|
+
item.setAttribute("data-ohw-href-key", hrefKey);
|
|
9818
|
+
item.setAttribute("href", "");
|
|
9819
|
+
item.removeAttribute("aria-label");
|
|
9820
|
+
item.querySelectorAll("[data-ohw-hovered], [data-ohw-selected]").forEach((el) => {
|
|
9821
|
+
el.removeAttribute("data-ohw-hovered");
|
|
9822
|
+
el.removeAttribute("data-ohw-selected");
|
|
9823
|
+
});
|
|
9824
|
+
const icon = item.querySelector(ICON_SELECTOR);
|
|
9825
|
+
icon?.setAttribute("data-ohw-key", iconKey);
|
|
9826
|
+
item.querySelector(`[${SOCIALS_LABEL_ATTR}]`)?.remove();
|
|
9827
|
+
const afterUnit = after ? socialRowUnit(after) : null;
|
|
9828
|
+
if (afterUnit && afterUnit.parentElement === row) afterUnit.insertAdjacentElement("afterend", unit);
|
|
9829
|
+
else row.appendChild(unit);
|
|
9830
|
+
markSocialsRows(row.ownerDocument);
|
|
9831
|
+
return { item, hrefKey, iconKey, order: getSocialsOrderFromDom(row.ownerDocument) };
|
|
9832
|
+
}
|
|
9833
|
+
function duplicateSocialItem(item, content) {
|
|
9834
|
+
const row = findSocialsRow(item);
|
|
9835
|
+
const created = row ? insertSocialItem(row, item, content) : null;
|
|
9836
|
+
if (!created) return null;
|
|
9837
|
+
const sourceHref = socialHrefKey(item);
|
|
9838
|
+
const sourceIcon = socialIconKey(item);
|
|
9839
|
+
const link = created.item;
|
|
9840
|
+
if (sourceHref) link.setAttribute("href", item.getAttribute("href") ?? "");
|
|
9841
|
+
const glyph = item.querySelector(ICON_SELECTOR)?.innerHTML;
|
|
9842
|
+
if (glyph) {
|
|
9843
|
+
const slot = link.querySelector(ICON_SELECTOR);
|
|
9844
|
+
if (slot) slot.innerHTML = glyph;
|
|
9845
|
+
}
|
|
9846
|
+
return {
|
|
9847
|
+
...created,
|
|
9848
|
+
copiedFrom: { href: sourceHref, icon: sourceIcon }
|
|
9849
|
+
};
|
|
9850
|
+
}
|
|
9851
|
+
function removeSocialItem(item, content) {
|
|
9852
|
+
const row = findSocialsRow(item);
|
|
9853
|
+
if (!row) return null;
|
|
9854
|
+
const hrefKey = socialHrefKey(item);
|
|
9855
|
+
const iconKey = socialIconKey(item);
|
|
9856
|
+
const removedKeys = [hrefKey, iconKey].filter((key) => Boolean(key));
|
|
9857
|
+
if (!removedKeys.length) return null;
|
|
9858
|
+
const previousOrder = getSocialsOrderFromDom(row.ownerDocument);
|
|
9859
|
+
const previousContent = Object.fromEntries(
|
|
9860
|
+
removedKeys.filter((key) => key in content).map((key) => [key, content[key]])
|
|
9861
|
+
);
|
|
9862
|
+
const unit = socialRowUnit(item);
|
|
9863
|
+
const nextSibling = unit.nextElementSibling;
|
|
9864
|
+
unit.remove();
|
|
9865
|
+
markSocialsRows(row.ownerDocument);
|
|
9866
|
+
return {
|
|
9867
|
+
removedKeys,
|
|
9868
|
+
previousContent,
|
|
9869
|
+
order: getSocialsOrderFromDom(row.ownerDocument),
|
|
9870
|
+
previousOrder,
|
|
9871
|
+
undo: () => {
|
|
9872
|
+
if (nextSibling) nextSibling.before(unit);
|
|
9873
|
+
else row.appendChild(unit);
|
|
9874
|
+
markSocialsRows(row.ownerDocument);
|
|
9875
|
+
}
|
|
9876
|
+
};
|
|
9877
|
+
}
|
|
9878
|
+
function applySocialsOrder(order, root = document) {
|
|
9879
|
+
listSocialsRows(root).forEach((row) => {
|
|
9880
|
+
const wanted = order[rowKeyOf(row)];
|
|
9881
|
+
if (!wanted) return;
|
|
9882
|
+
const byKey = new Map(listSocialItems(row).map((item) => [socialHrefKey(item), item]));
|
|
9883
|
+
wanted.forEach((key) => {
|
|
9884
|
+
const item = byKey.get(key);
|
|
9885
|
+
if (item) row.appendChild(socialRowUnit(item));
|
|
9886
|
+
});
|
|
9887
|
+
});
|
|
9888
|
+
markSocialsRows(root);
|
|
9889
|
+
}
|
|
9890
|
+
function reconcileSocialsFromContent(content, root = document) {
|
|
9891
|
+
markSocialsRows(root);
|
|
9892
|
+
const stored = parseSocialsOrder(content[SOCIALS_ORDER_KEY]);
|
|
9893
|
+
if (!stored) return;
|
|
9894
|
+
listSocialsRows(root).forEach((row) => {
|
|
9895
|
+
const wanted = stored[rowKeyOf(row)];
|
|
9896
|
+
if (!wanted) return;
|
|
9897
|
+
if (!wanted.length) return;
|
|
9898
|
+
wanted.forEach((key) => {
|
|
9899
|
+
if (listSocialItems(row).some((item) => socialHrefKey(item) === key)) return;
|
|
9900
|
+
if (!hasStoredValue(content, key)) return;
|
|
9901
|
+
const created = insertSocialItem(row, null, content);
|
|
9902
|
+
if (created) {
|
|
9903
|
+
created.item.setAttribute("data-ohw-href-key", key);
|
|
9904
|
+
created.item.querySelector(ICON_SELECTOR)?.setAttribute("data-ohw-key", key.replace(/-href$/, ""));
|
|
9905
|
+
applyStoredValues(created.item, content);
|
|
9906
|
+
}
|
|
9907
|
+
});
|
|
9908
|
+
const present = listSocialItems(row);
|
|
9909
|
+
const surviving = present.filter((item) => {
|
|
9910
|
+
const key = socialHrefKey(item);
|
|
9911
|
+
return !key || wanted.includes(key);
|
|
9912
|
+
});
|
|
9913
|
+
if (surviving.length) {
|
|
9914
|
+
present.forEach((item) => {
|
|
9915
|
+
if (!surviving.includes(item)) socialRowUnit(item).remove();
|
|
9916
|
+
});
|
|
9917
|
+
}
|
|
9918
|
+
});
|
|
9919
|
+
applySocialsOrder(stored, root);
|
|
9920
|
+
}
|
|
9921
|
+
var DROP_BAR_THICKNESS = 3;
|
|
9922
|
+
var DROP_BAR_GAP = 8;
|
|
9923
|
+
function buildSocialDropSlots(row) {
|
|
9924
|
+
const items = listSocialItems(row);
|
|
9925
|
+
if (!items.length) return [];
|
|
9926
|
+
const rects = items.map((item) => item.getBoundingClientRect());
|
|
9927
|
+
return items.concat(items[items.length - 1]).map((_, index) => {
|
|
9928
|
+
const previous = rects[index - 1];
|
|
9929
|
+
const next = rects[index];
|
|
9930
|
+
const centre = previous && next ? (previous.right + next.left) / 2 : next ? next.left - DROP_BAR_GAP : previous.right + DROP_BAR_GAP;
|
|
9931
|
+
const rect = next ?? previous;
|
|
9932
|
+
return {
|
|
9933
|
+
insertIndex: index,
|
|
9934
|
+
columnIndex: -1,
|
|
9935
|
+
left: centre - DROP_BAR_THICKNESS / 2,
|
|
9936
|
+
top: rect.top,
|
|
9937
|
+
width: DROP_BAR_THICKNESS,
|
|
9938
|
+
height: rect.height,
|
|
9939
|
+
direction: "vertical"
|
|
9940
|
+
};
|
|
9941
|
+
});
|
|
9942
|
+
}
|
|
9943
|
+
function findSocialByHrefKey(hrefKey, root = document) {
|
|
9944
|
+
const el = root.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
9945
|
+
return el ? getSocialItem(el) : null;
|
|
9946
|
+
}
|
|
9947
|
+
function buildSocialDropSlotsForKey(hrefKey, root = document) {
|
|
9948
|
+
const item = findSocialByHrefKey(hrefKey, root);
|
|
9949
|
+
const row = item ? findSocialsRow(item) : null;
|
|
9950
|
+
return row ? buildSocialDropSlots(row) : [];
|
|
9951
|
+
}
|
|
9952
|
+
function hitTestSocialDropSlot(clientX, clientY, draggedHrefKey, root = document) {
|
|
9953
|
+
const distanceTo = (slot) => {
|
|
9954
|
+
const dx = clientX - (slot.left + slot.width / 2);
|
|
9955
|
+
const dy = clientY < slot.top ? slot.top - clientY : Math.max(0, clientY - (slot.top + slot.height));
|
|
9956
|
+
return Math.hypot(dx, dy);
|
|
9957
|
+
};
|
|
9958
|
+
const slots = buildSocialDropSlotsForKey(draggedHrefKey, root);
|
|
9959
|
+
return slots.reduce((best, slot) => {
|
|
9960
|
+
return !best || distanceTo(slot) < distanceTo(best) ? slot : best;
|
|
9961
|
+
}, null);
|
|
9962
|
+
}
|
|
9963
|
+
function planSocialMove(hrefKey, insertIndex, root = document) {
|
|
9964
|
+
const item = findSocialByHrefKey(hrefKey, root);
|
|
9965
|
+
const row = item ? findSocialsRow(item) : null;
|
|
9966
|
+
if (!row) return null;
|
|
9967
|
+
const order = getSocialsOrderFromDom(root);
|
|
9968
|
+
const key = rowKeyOf(row);
|
|
9969
|
+
const current = order[key];
|
|
9970
|
+
if (!current) return null;
|
|
9971
|
+
const from = current.indexOf(hrefKey);
|
|
9972
|
+
if (from < 0) return null;
|
|
9973
|
+
const next = current.filter((_, index) => index !== from);
|
|
9974
|
+
next.splice(insertIndex > from ? insertIndex - 1 : insertIndex, 0, hrefKey);
|
|
9975
|
+
return { ...order, [key]: next };
|
|
9976
|
+
}
|
|
9977
|
+
var SOCIALS_DISPLAY_KEY = "__ohw_socials_display";
|
|
9978
|
+
function readSocialsDisplay(row) {
|
|
9979
|
+
const items = listSocialItems(row);
|
|
9980
|
+
const visible = (el) => Boolean(el) && el.style.display !== "none" && el.getAttribute("data-ohw-hidden") === null;
|
|
9981
|
+
return {
|
|
9982
|
+
text: items.some((item) => visible(socialLabelElement(item))),
|
|
9983
|
+
icon: items.some((item) => visible(item.querySelector(ICON_SELECTOR)))
|
|
9984
|
+
};
|
|
9985
|
+
}
|
|
9986
|
+
function parseSocialsDisplay(raw) {
|
|
9987
|
+
if (!raw) return null;
|
|
9988
|
+
try {
|
|
9989
|
+
const parsed = JSON.parse(raw);
|
|
9990
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9991
|
+
} catch {
|
|
9992
|
+
return null;
|
|
9993
|
+
}
|
|
9994
|
+
}
|
|
9995
|
+
function socialsDisplayFor(row, content) {
|
|
9996
|
+
return parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY])?.[rowKeyOf(row)] ?? readSocialsDisplay(row);
|
|
9997
|
+
}
|
|
9998
|
+
function socialsDisplayWith(row, display, content) {
|
|
9999
|
+
return { ...parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]) ?? {}, [rowKeyOf(row)]: display };
|
|
10000
|
+
}
|
|
10001
|
+
function applySocialsDisplayToRow(row, display) {
|
|
10002
|
+
listSocialItems(row).forEach((item) => {
|
|
10003
|
+
const label = socialLabelElement(item);
|
|
10004
|
+
const icon = item.querySelector(ICON_SELECTOR);
|
|
10005
|
+
if (label) label.style.display = display.text ? "" : "none";
|
|
10006
|
+
if (icon) icon.style.display = display.icon ? "" : "none";
|
|
10007
|
+
});
|
|
10008
|
+
}
|
|
10009
|
+
function applySocialsDisplayFromContent(content, root = document) {
|
|
10010
|
+
const stored = parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]);
|
|
10011
|
+
if (!stored) return;
|
|
10012
|
+
listSocialsRows(root).forEach((row) => {
|
|
10013
|
+
const display = stored[rowKeyOf(row)];
|
|
10014
|
+
if (!display) return;
|
|
10015
|
+
if (display.icon) {
|
|
10016
|
+
listSocialItems(row).forEach((item) => {
|
|
10017
|
+
const iconKey = ensureIconSlot(item);
|
|
10018
|
+
const slot = item.querySelector(ICON_SELECTOR);
|
|
10019
|
+
if (iconKey && slot && content[iconKey]) applyIconMarkup(slot, content[iconKey]);
|
|
10020
|
+
});
|
|
10021
|
+
}
|
|
10022
|
+
applySocialsDisplayToRow(row, display);
|
|
10023
|
+
});
|
|
10024
|
+
}
|
|
10025
|
+
function socialsMissingIcons(row) {
|
|
10026
|
+
return listSocialItems(row).filter((item) => !item.querySelector(ICON_SELECTOR)).map((item) => ({ hrefKey: socialHrefKey(item) ?? "", url: item.getAttribute("href") ?? "" })).filter((entry) => Boolean(entry.hrefKey));
|
|
10027
|
+
}
|
|
10028
|
+
function ensureIconSlot(item) {
|
|
10029
|
+
const existing = item.querySelector(ICON_SELECTOR);
|
|
10030
|
+
if (existing) return existing.dataset.ohwKey ?? null;
|
|
10031
|
+
const hrefKey = socialHrefKey(item);
|
|
10032
|
+
if (!hrefKey) return null;
|
|
10033
|
+
const iconKey = hrefKey.replace(/-href$/, "");
|
|
10034
|
+
const slot = document.createElement("span");
|
|
10035
|
+
slot.setAttribute("data-ohw-key", iconKey);
|
|
10036
|
+
slot.setAttribute("data-ohw-editable", "icon");
|
|
10037
|
+
slot.style.display = "inline-flex";
|
|
10038
|
+
item.prepend(slot);
|
|
10039
|
+
return iconKey;
|
|
10040
|
+
}
|
|
10041
|
+
|
|
9528
10042
|
// src/lib/footer-items.ts
|
|
9529
10043
|
var FOOTER_ORDER_KEY = "__ohw_footer_order";
|
|
9530
10044
|
var MAX_FOOTER_COLUMNS = 18;
|
|
@@ -10401,6 +10915,251 @@ function addFooterColumnWithPersist({
|
|
|
10401
10915
|
return result;
|
|
10402
10916
|
}
|
|
10403
10917
|
|
|
10918
|
+
// src/ui/FloatingPanel.tsx
|
|
10919
|
+
var import_react13 = require("react");
|
|
10920
|
+
var import_lucide_react13 = require("lucide-react");
|
|
10921
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
10922
|
+
var PANEL_WIDTH = 256;
|
|
10923
|
+
var EDGE_MARGIN = 16;
|
|
10924
|
+
function getVisibleClip(parentScroll) {
|
|
10925
|
+
const left = 0;
|
|
10926
|
+
const right = window.innerWidth;
|
|
10927
|
+
if (!parentScroll) {
|
|
10928
|
+
return { top: 0, bottom: window.innerHeight, left, right };
|
|
10929
|
+
}
|
|
10930
|
+
const { iframeOffsetTop, headerH: visibleCanvasTop, canvasH } = parentScroll;
|
|
10931
|
+
const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
|
|
10932
|
+
const bottom = Math.min(window.innerHeight, visibleCanvasTop + canvasH - iframeOffsetTop);
|
|
10933
|
+
return { top, bottom: Math.max(top, bottom), left, right };
|
|
10934
|
+
}
|
|
10935
|
+
function defaultFloatingPanelPosition(parentScroll, panelHeight = 280) {
|
|
10936
|
+
const clip = getVisibleClip(parentScroll);
|
|
10937
|
+
return {
|
|
10938
|
+
x: Math.max(EDGE_MARGIN, clip.right - PANEL_WIDTH - EDGE_MARGIN),
|
|
10939
|
+
y: Math.min(
|
|
10940
|
+
Math.max(clip.top + EDGE_MARGIN, EDGE_MARGIN),
|
|
10941
|
+
Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelHeight - EDGE_MARGIN)
|
|
10942
|
+
)
|
|
10943
|
+
};
|
|
10944
|
+
}
|
|
10945
|
+
function clampPosition(pos, parentScroll, panelW, panelH) {
|
|
10946
|
+
const clip = getVisibleClip(parentScroll);
|
|
10947
|
+
const maxX = Math.max(clip.left + EDGE_MARGIN, clip.right - panelW - EDGE_MARGIN);
|
|
10948
|
+
const maxY = Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelH - EDGE_MARGIN);
|
|
10949
|
+
return {
|
|
10950
|
+
x: Math.min(Math.max(pos.x, clip.left + EDGE_MARGIN), maxX),
|
|
10951
|
+
y: Math.min(Math.max(pos.y, clip.top + EDGE_MARGIN), maxY)
|
|
10952
|
+
};
|
|
10953
|
+
}
|
|
10954
|
+
function FloatingPanel({
|
|
10955
|
+
open,
|
|
10956
|
+
title,
|
|
10957
|
+
context,
|
|
10958
|
+
icon,
|
|
10959
|
+
onClose,
|
|
10960
|
+
children,
|
|
10961
|
+
position,
|
|
10962
|
+
onPositionChange,
|
|
10963
|
+
parentScroll = null,
|
|
10964
|
+
className,
|
|
10965
|
+
bodyClassName
|
|
10966
|
+
}) {
|
|
10967
|
+
const panelRef = (0, import_react13.useRef)(null);
|
|
10968
|
+
const [measured, setMeasured] = (0, import_react13.useState)({ w: PANEL_WIDTH, h: 280 });
|
|
10969
|
+
const dragRef = (0, import_react13.useRef)(null);
|
|
10970
|
+
const resolved = position ?? defaultFloatingPanelPosition(parentScroll, measured.h);
|
|
10971
|
+
const clamped = clampPosition(resolved, parentScroll, measured.w, measured.h);
|
|
10972
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
10973
|
+
if (!open || !panelRef.current) return;
|
|
10974
|
+
const el = panelRef.current;
|
|
10975
|
+
const next = { w: el.offsetWidth || PANEL_WIDTH, h: el.offsetHeight || 280 };
|
|
10976
|
+
setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
|
|
10977
|
+
}, [open, children, title, context]);
|
|
10978
|
+
(0, import_react13.useEffect)(() => {
|
|
10979
|
+
if (!open || !position || !onPositionChange) return;
|
|
10980
|
+
const next = clampPosition(position, parentScroll, measured.w, measured.h);
|
|
10981
|
+
if (next.x !== position.x || next.y !== position.y) onPositionChange(next);
|
|
10982
|
+
}, [open, parentScroll, measured.w, measured.h, position, onPositionChange]);
|
|
10983
|
+
const onHeaderPointerDown = (0, import_react13.useCallback)(
|
|
10984
|
+
(e) => {
|
|
10985
|
+
if (e.button !== 0) return;
|
|
10986
|
+
if (e.target.closest("[data-ohw-floating-panel-close]")) return;
|
|
10987
|
+
e.preventDefault();
|
|
10988
|
+
e.stopPropagation();
|
|
10989
|
+
const el = e.currentTarget;
|
|
10990
|
+
el.setPointerCapture(e.pointerId);
|
|
10991
|
+
dragRef.current = {
|
|
10992
|
+
pointerId: e.pointerId,
|
|
10993
|
+
startX: e.clientX,
|
|
10994
|
+
startY: e.clientY,
|
|
10995
|
+
originX: clamped.x,
|
|
10996
|
+
originY: clamped.y
|
|
10997
|
+
};
|
|
10998
|
+
},
|
|
10999
|
+
[clamped.x, clamped.y]
|
|
11000
|
+
);
|
|
11001
|
+
const onHeaderPointerMove = (0, import_react13.useCallback)(
|
|
11002
|
+
(e) => {
|
|
11003
|
+
const drag = dragRef.current;
|
|
11004
|
+
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
11005
|
+
e.preventDefault();
|
|
11006
|
+
const next = clampPosition(
|
|
11007
|
+
{
|
|
11008
|
+
x: drag.originX + (e.clientX - drag.startX),
|
|
11009
|
+
y: drag.originY + (e.clientY - drag.startY)
|
|
11010
|
+
},
|
|
11011
|
+
parentScroll,
|
|
11012
|
+
measured.w,
|
|
11013
|
+
measured.h
|
|
11014
|
+
);
|
|
11015
|
+
onPositionChange?.(next);
|
|
11016
|
+
},
|
|
11017
|
+
[measured.h, measured.w, onPositionChange, parentScroll]
|
|
11018
|
+
);
|
|
11019
|
+
const endDrag = (0, import_react13.useCallback)((e) => {
|
|
11020
|
+
const drag = dragRef.current;
|
|
11021
|
+
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
11022
|
+
dragRef.current = null;
|
|
11023
|
+
try {
|
|
11024
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
11025
|
+
} catch {
|
|
11026
|
+
}
|
|
11027
|
+
}, []);
|
|
11028
|
+
if (!open) return null;
|
|
11029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
11030
|
+
"div",
|
|
11031
|
+
{
|
|
11032
|
+
ref: panelRef,
|
|
11033
|
+
"data-ohw-floating-panel": "",
|
|
11034
|
+
role: "dialog",
|
|
11035
|
+
"aria-label": title,
|
|
11036
|
+
className: cn(
|
|
11037
|
+
// Above MediaOverlay / item chrome (2147483646); link-modal content shares this tier.
|
|
11038
|
+
"fixed z-[2147483647] flex w-64 flex-col overflow-hidden rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
11039
|
+
className
|
|
11040
|
+
),
|
|
11041
|
+
style: { left: clamped.x, top: clamped.y },
|
|
11042
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
11043
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
11044
|
+
onClick: (e) => e.stopPropagation(),
|
|
11045
|
+
children: [
|
|
11046
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
11047
|
+
"div",
|
|
11048
|
+
{
|
|
11049
|
+
"data-ohw-floating-panel-header": "",
|
|
11050
|
+
className: "relative flex cursor-grab items-start gap-2 border-b border-border py-5 pl-5 pr-11 active:cursor-grabbing",
|
|
11051
|
+
onPointerDown: onHeaderPointerDown,
|
|
11052
|
+
onPointerMove: onHeaderPointerMove,
|
|
11053
|
+
onPointerUp: endDrag,
|
|
11054
|
+
onPointerCancel: endDrag,
|
|
11055
|
+
children: [
|
|
11056
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
11057
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11058
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "shrink-0 text-foreground", children: icon }) : null,
|
|
11059
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "min-w-0 flex-1 text-lg font-semibold leading-7 text-foreground", children: title })
|
|
11060
|
+
] }),
|
|
11061
|
+
context ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "w-full text-sm leading-5 text-muted-foreground", children: context }) : null
|
|
11062
|
+
] }),
|
|
11063
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11064
|
+
"button",
|
|
11065
|
+
{
|
|
11066
|
+
type: "button",
|
|
11067
|
+
"data-ohw-floating-panel-close": "",
|
|
11068
|
+
"aria-label": "Close",
|
|
11069
|
+
className: "absolute right-2.5 top-2.5 rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
11070
|
+
onClick: (e) => {
|
|
11071
|
+
e.stopPropagation();
|
|
11072
|
+
onClose();
|
|
11073
|
+
},
|
|
11074
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
11075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.X, { size: 16, "aria-hidden": true })
|
|
11076
|
+
}
|
|
11077
|
+
)
|
|
11078
|
+
]
|
|
11079
|
+
}
|
|
11080
|
+
),
|
|
11081
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
11082
|
+
"div",
|
|
11083
|
+
{
|
|
11084
|
+
"data-ohw-floating-panel-body": "",
|
|
11085
|
+
className: cn("flex w-full flex-col gap-4 p-5", bodyClassName),
|
|
11086
|
+
children
|
|
11087
|
+
}
|
|
11088
|
+
)
|
|
11089
|
+
]
|
|
11090
|
+
}
|
|
11091
|
+
);
|
|
11092
|
+
}
|
|
11093
|
+
|
|
11094
|
+
// src/ui/socials-display-panel.tsx
|
|
11095
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
11096
|
+
function DisplaySwitch({
|
|
11097
|
+
label,
|
|
11098
|
+
checked,
|
|
11099
|
+
disabled,
|
|
11100
|
+
onChange
|
|
11101
|
+
}) {
|
|
11102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
|
|
11103
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11104
|
+
"span",
|
|
11105
|
+
{
|
|
11106
|
+
className: cn(
|
|
11107
|
+
"min-w-0 flex-1 text-sm font-medium leading-5",
|
|
11108
|
+
disabled ? "text-muted-foreground" : "text-foreground"
|
|
11109
|
+
),
|
|
11110
|
+
children: label
|
|
11111
|
+
}
|
|
11112
|
+
),
|
|
11113
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11114
|
+
"button",
|
|
11115
|
+
{
|
|
11116
|
+
type: "button",
|
|
11117
|
+
role: "switch",
|
|
11118
|
+
"aria-checked": checked,
|
|
11119
|
+
"aria-label": label,
|
|
11120
|
+
disabled,
|
|
11121
|
+
onClick: () => onChange(!checked),
|
|
11122
|
+
className: cn(
|
|
11123
|
+
"relative h-5 w-9 shrink-0 rounded-full transition-colors",
|
|
11124
|
+
checked ? "bg-primary" : "bg-primary-50",
|
|
11125
|
+
disabled ? "cursor-default opacity-50" : "cursor-pointer"
|
|
11126
|
+
),
|
|
11127
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11128
|
+
"span",
|
|
11129
|
+
{
|
|
11130
|
+
className: cn(
|
|
11131
|
+
"absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all",
|
|
11132
|
+
checked ? "left-[1.125rem]" : "left-0.5"
|
|
11133
|
+
)
|
|
11134
|
+
}
|
|
11135
|
+
)
|
|
11136
|
+
}
|
|
11137
|
+
)
|
|
11138
|
+
] });
|
|
11139
|
+
}
|
|
11140
|
+
function SocialsDisplayPanel({ display, onChange, className }) {
|
|
11141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: cn("flex w-full flex-col gap-3", className), children: [
|
|
11142
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11143
|
+
DisplaySwitch,
|
|
11144
|
+
{
|
|
11145
|
+
label: "Text",
|
|
11146
|
+
checked: display.text,
|
|
11147
|
+
disabled: display.text && !display.icon,
|
|
11148
|
+
onChange: (text) => onChange({ ...display, text })
|
|
11149
|
+
}
|
|
11150
|
+
),
|
|
11151
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
11152
|
+
DisplaySwitch,
|
|
11153
|
+
{
|
|
11154
|
+
label: "Icon",
|
|
11155
|
+
checked: display.icon,
|
|
11156
|
+
disabled: display.icon && !display.text,
|
|
11157
|
+
onChange: (icon) => onChange({ ...display, icon })
|
|
11158
|
+
}
|
|
11159
|
+
)
|
|
11160
|
+
] });
|
|
11161
|
+
}
|
|
11162
|
+
|
|
10404
11163
|
// src/lib/item-drag-interaction.ts
|
|
10405
11164
|
function disableNativeHrefDrag(el) {
|
|
10406
11165
|
if (el.draggable) el.draggable = false;
|
|
@@ -10599,7 +11358,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
|
|
|
10599
11358
|
}
|
|
10600
11359
|
|
|
10601
11360
|
// src/useNavItemDrag.ts
|
|
10602
|
-
var
|
|
11361
|
+
var import_react14 = require("react");
|
|
10603
11362
|
function useNavItemDrag({
|
|
10604
11363
|
isEditMode,
|
|
10605
11364
|
editContentRef,
|
|
@@ -10623,11 +11382,11 @@ function useNavItemDrag({
|
|
|
10623
11382
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
10624
11383
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
10625
11384
|
}) {
|
|
10626
|
-
const navDragRef = (0,
|
|
10627
|
-
const [navDropSlots, setNavDropSlots] = (0,
|
|
10628
|
-
const [activeNavDropIndex, setActiveNavDropIndex] = (0,
|
|
10629
|
-
const navPointerDragRef = (0,
|
|
10630
|
-
const clearNavDragVisuals = (0,
|
|
11385
|
+
const navDragRef = (0, import_react14.useRef)(null);
|
|
11386
|
+
const [navDropSlots, setNavDropSlots] = (0, import_react14.useState)([]);
|
|
11387
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react14.useState)(null);
|
|
11388
|
+
const navPointerDragRef = (0, import_react14.useRef)(null);
|
|
11389
|
+
const clearNavDragVisuals = (0, import_react14.useCallback)(() => {
|
|
10631
11390
|
const session = navDragRef.current;
|
|
10632
11391
|
const keepOpenEl = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.draggedEl : null;
|
|
10633
11392
|
navDragRef.current = null;
|
|
@@ -10644,7 +11403,7 @@ function useNavItemDrag({
|
|
|
10644
11403
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
10645
11404
|
unlockItemDragInteraction();
|
|
10646
11405
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
10647
|
-
const refreshNavDragVisuals = (0,
|
|
11406
|
+
const refreshNavDragVisuals = (0, import_react14.useCallback)(
|
|
10648
11407
|
(session, activeSlot, clientX, clientY) => {
|
|
10649
11408
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
10650
11409
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -10662,13 +11421,13 @@ function useNavItemDrag({
|
|
|
10662
11421
|
},
|
|
10663
11422
|
[setDraggedItemRect, setSiblingHintRects]
|
|
10664
11423
|
);
|
|
10665
|
-
const refreshNavDragVisualsRef = (0,
|
|
11424
|
+
const refreshNavDragVisualsRef = (0, import_react14.useRef)(refreshNavDragVisuals);
|
|
10666
11425
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
10667
|
-
const commitNavDragRef = (0,
|
|
11426
|
+
const commitNavDragRef = (0, import_react14.useRef)(() => {
|
|
10668
11427
|
});
|
|
10669
|
-
const beginNavDragRef = (0,
|
|
11428
|
+
const beginNavDragRef = (0, import_react14.useRef)(() => {
|
|
10670
11429
|
});
|
|
10671
|
-
const beginNavDrag = (0,
|
|
11430
|
+
const beginNavDrag = (0, import_react14.useCallback)(
|
|
10672
11431
|
(session) => {
|
|
10673
11432
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
10674
11433
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -10702,7 +11461,7 @@ function useNavItemDrag({
|
|
|
10702
11461
|
]
|
|
10703
11462
|
);
|
|
10704
11463
|
beginNavDragRef.current = beginNavDrag;
|
|
10705
|
-
const commitNavDrag = (0,
|
|
11464
|
+
const commitNavDrag = (0, import_react14.useCallback)(
|
|
10706
11465
|
(clientX, clientY) => {
|
|
10707
11466
|
const session = navDragRef.current;
|
|
10708
11467
|
if (!session) {
|
|
@@ -10763,7 +11522,7 @@ function useNavItemDrag({
|
|
|
10763
11522
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
10764
11523
|
);
|
|
10765
11524
|
commitNavDragRef.current = commitNavDrag;
|
|
10766
|
-
const startNavLinkDrag = (0,
|
|
11525
|
+
const startNavLinkDrag = (0, import_react14.useCallback)(
|
|
10767
11526
|
(anchor, clientX, clientY, wasSelected) => {
|
|
10768
11527
|
if (footerDragRef.current) return false;
|
|
10769
11528
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -10781,7 +11540,7 @@ function useNavItemDrag({
|
|
|
10781
11540
|
},
|
|
10782
11541
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
10783
11542
|
);
|
|
10784
|
-
const onNavDragOver = (0,
|
|
11543
|
+
const onNavDragOver = (0, import_react14.useCallback)(
|
|
10785
11544
|
(e) => {
|
|
10786
11545
|
const session = navDragRef.current;
|
|
10787
11546
|
if (!session) return false;
|
|
@@ -10793,7 +11552,7 @@ function useNavItemDrag({
|
|
|
10793
11552
|
},
|
|
10794
11553
|
[]
|
|
10795
11554
|
);
|
|
10796
|
-
(0,
|
|
11555
|
+
(0, import_react14.useEffect)(() => {
|
|
10797
11556
|
if (!isEditMode) return;
|
|
10798
11557
|
const THRESHOLD = 10;
|
|
10799
11558
|
const resolveWasSelected = (el) => {
|
|
@@ -10918,7 +11677,7 @@ function useNavItemDrag({
|
|
|
10918
11677
|
setLinkPopover,
|
|
10919
11678
|
suppressNextClickRef
|
|
10920
11679
|
]);
|
|
10921
|
-
const armNavPressFromChrome = (0,
|
|
11680
|
+
const armNavPressFromChrome = (0, import_react14.useCallback)(
|
|
10922
11681
|
(selected, clientX, clientY, pointerId) => {
|
|
10923
11682
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
10924
11683
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -10949,8 +11708,8 @@ function useNavItemDrag({
|
|
|
10949
11708
|
}
|
|
10950
11709
|
|
|
10951
11710
|
// src/ui/footer-container-chrome.tsx
|
|
10952
|
-
var
|
|
10953
|
-
var
|
|
11711
|
+
var import_lucide_react14 = require("lucide-react");
|
|
11712
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
10954
11713
|
function FooterContainerChrome({
|
|
10955
11714
|
rect,
|
|
10956
11715
|
onAdd,
|
|
@@ -10958,7 +11717,7 @@ function FooterContainerChrome({
|
|
|
10958
11717
|
}) {
|
|
10959
11718
|
const chromeGap = 6;
|
|
10960
11719
|
const buttonMargin = 7;
|
|
10961
|
-
return /* @__PURE__ */ (0,
|
|
11720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
10962
11721
|
"div",
|
|
10963
11722
|
{
|
|
10964
11723
|
"data-ohw-footer-container-chrome": "",
|
|
@@ -10970,8 +11729,8 @@ function FooterContainerChrome({
|
|
|
10970
11729
|
width: rect.width + chromeGap * 2,
|
|
10971
11730
|
height: rect.height + chromeGap * 2
|
|
10972
11731
|
},
|
|
10973
|
-
children: /* @__PURE__ */ (0,
|
|
10974
|
-
/* @__PURE__ */ (0,
|
|
11732
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
11733
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
10975
11734
|
"button",
|
|
10976
11735
|
{
|
|
10977
11736
|
type: "button",
|
|
@@ -10990,17 +11749,17 @@ function FooterContainerChrome({
|
|
|
10990
11749
|
if (addDisabled) return;
|
|
10991
11750
|
onAdd();
|
|
10992
11751
|
},
|
|
10993
|
-
children: /* @__PURE__ */ (0,
|
|
11752
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react14.Plus, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
10994
11753
|
}
|
|
10995
11754
|
) }),
|
|
10996
|
-
/* @__PURE__ */ (0,
|
|
11755
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
10997
11756
|
] })
|
|
10998
11757
|
}
|
|
10999
11758
|
) });
|
|
11000
11759
|
}
|
|
11001
11760
|
|
|
11002
11761
|
// src/lib/carousel.ts
|
|
11003
|
-
var
|
|
11762
|
+
var import_react15 = require("react");
|
|
11004
11763
|
var CAROUSEL_ATTR = "data-ohw-carousel";
|
|
11005
11764
|
var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
|
|
11006
11765
|
var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
|
|
@@ -11062,8 +11821,8 @@ function applyCarouselNode(key, val) {
|
|
|
11062
11821
|
return true;
|
|
11063
11822
|
}
|
|
11064
11823
|
function useOhwCarousel(key, initial) {
|
|
11065
|
-
const [images, setImages] = (0,
|
|
11066
|
-
(0,
|
|
11824
|
+
const [images, setImages] = (0, import_react15.useState)(initial);
|
|
11825
|
+
(0, import_react15.useEffect)(() => {
|
|
11067
11826
|
const el = document.querySelector(
|
|
11068
11827
|
`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
|
|
11069
11828
|
);
|
|
@@ -11278,7 +12037,7 @@ function isNavbarLinksContainer(el) {
|
|
|
11278
12037
|
function isNavigationItem(el) {
|
|
11279
12038
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
11280
12039
|
if (!anchor) return false;
|
|
11281
|
-
return Boolean(anchor.querySelector('[data-ohw-editable="text"]'));
|
|
12040
|
+
return Boolean(anchor.querySelector('[data-ohw-editable="text"]')) || Boolean(getSocialItem(anchor));
|
|
11282
12041
|
}
|
|
11283
12042
|
function findFooterItemGroup(item) {
|
|
11284
12043
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -11299,8 +12058,9 @@ function isInferredFooterGroup(el) {
|
|
|
11299
12058
|
const footer = el.closest("footer");
|
|
11300
12059
|
if (!footer || el === footer) return false;
|
|
11301
12060
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
12061
|
+
if (isSocialsRow(el)) return false;
|
|
11302
12062
|
const count = Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(
|
|
11303
|
-
isNavigationItem
|
|
12063
|
+
(item) => isNavigationItem(item) && !getSocialItem(item)
|
|
11304
12064
|
).length;
|
|
11305
12065
|
return count >= 2;
|
|
11306
12066
|
}
|
|
@@ -11344,7 +12104,8 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
11344
12104
|
if (key.endsWith("-href")) applyLinkByKey2(key, text);
|
|
11345
12105
|
else {
|
|
11346
12106
|
document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
|
|
11347
|
-
el.
|
|
12107
|
+
if (el.getAttribute("data-ohw-editable") === "icon") applyIconMarkup(el, text);
|
|
12108
|
+
else el.textContent = text;
|
|
11348
12109
|
});
|
|
11349
12110
|
}
|
|
11350
12111
|
}
|
|
@@ -11406,6 +12167,21 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
11406
12167
|
});
|
|
11407
12168
|
return true;
|
|
11408
12169
|
}
|
|
12170
|
+
const social = getSocialItem(selected);
|
|
12171
|
+
if (social) {
|
|
12172
|
+
const result = removeSocialItem(social, getEditContent());
|
|
12173
|
+
if (!result) return false;
|
|
12174
|
+
finishDelete({
|
|
12175
|
+
toastTitle: "Social deleted",
|
|
12176
|
+
removedKeys: result.removedKeys,
|
|
12177
|
+
previousContent: result.previousContent,
|
|
12178
|
+
orderKey: SOCIALS_ORDER_KEY,
|
|
12179
|
+
orderJson: JSON.stringify(result.order),
|
|
12180
|
+
previousOrderJson: JSON.stringify(result.previousOrder),
|
|
12181
|
+
undoDom: result.undo
|
|
12182
|
+
});
|
|
12183
|
+
return true;
|
|
12184
|
+
}
|
|
11409
12185
|
if (isFooterHrefKey(hrefKey)) {
|
|
11410
12186
|
const result = deleteFooterItem(selected);
|
|
11411
12187
|
if (!result) return false;
|
|
@@ -11424,14 +12200,14 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
11424
12200
|
}
|
|
11425
12201
|
|
|
11426
12202
|
// src/ui/navbar-container-chrome.tsx
|
|
11427
|
-
var
|
|
11428
|
-
var
|
|
12203
|
+
var import_lucide_react15 = require("lucide-react");
|
|
12204
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
11429
12205
|
function NavbarContainerChrome({
|
|
11430
12206
|
rect,
|
|
11431
12207
|
onAdd
|
|
11432
12208
|
}) {
|
|
11433
12209
|
const chromeGap = 6;
|
|
11434
|
-
return /* @__PURE__ */ (0,
|
|
12210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
11435
12211
|
"div",
|
|
11436
12212
|
{
|
|
11437
12213
|
"data-ohw-navbar-container-chrome": "",
|
|
@@ -11443,7 +12219,7 @@ function NavbarContainerChrome({
|
|
|
11443
12219
|
width: rect.width + chromeGap * 2,
|
|
11444
12220
|
height: rect.height + chromeGap * 2
|
|
11445
12221
|
},
|
|
11446
|
-
children: /* @__PURE__ */ (0,
|
|
12222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
11447
12223
|
"button",
|
|
11448
12224
|
{
|
|
11449
12225
|
type: "button",
|
|
@@ -11460,7 +12236,7 @@ function NavbarContainerChrome({
|
|
|
11460
12236
|
e.stopPropagation();
|
|
11461
12237
|
onAdd();
|
|
11462
12238
|
},
|
|
11463
|
-
children: /* @__PURE__ */ (0,
|
|
12239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.Plus, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
11464
12240
|
}
|
|
11465
12241
|
)
|
|
11466
12242
|
}
|
|
@@ -11469,7 +12245,7 @@ function NavbarContainerChrome({
|
|
|
11469
12245
|
|
|
11470
12246
|
// src/ui/drop-indicator.tsx
|
|
11471
12247
|
var React10 = __toESM(require("react"), 1);
|
|
11472
|
-
var
|
|
12248
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
11473
12249
|
var dropIndicatorVariants = cva(
|
|
11474
12250
|
"ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
|
|
11475
12251
|
{
|
|
@@ -11493,7 +12269,7 @@ var dropIndicatorVariants = cva(
|
|
|
11493
12269
|
);
|
|
11494
12270
|
var DropIndicator = React10.forwardRef(
|
|
11495
12271
|
({ className, direction, state, ...props }, ref) => {
|
|
11496
|
-
return /* @__PURE__ */ (0,
|
|
12272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
11497
12273
|
"div",
|
|
11498
12274
|
{
|
|
11499
12275
|
ref,
|
|
@@ -11510,7 +12286,7 @@ var DropIndicator = React10.forwardRef(
|
|
|
11510
12286
|
DropIndicator.displayName = "DropIndicator";
|
|
11511
12287
|
|
|
11512
12288
|
// src/ui/badge.tsx
|
|
11513
|
-
var
|
|
12289
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
11514
12290
|
var badgeVariants = cva(
|
|
11515
12291
|
"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",
|
|
11516
12292
|
{
|
|
@@ -11528,12 +12304,12 @@ var badgeVariants = cva(
|
|
|
11528
12304
|
}
|
|
11529
12305
|
);
|
|
11530
12306
|
function Badge({ className, variant, ...props }) {
|
|
11531
|
-
return /* @__PURE__ */ (0,
|
|
12307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
11532
12308
|
}
|
|
11533
12309
|
|
|
11534
12310
|
// src/OhhwellsBridge.tsx
|
|
11535
|
-
var
|
|
11536
|
-
var
|
|
12311
|
+
var import_lucide_react16 = require("lucide-react");
|
|
12312
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
11537
12313
|
var PRIMARY3 = "#0885FE";
|
|
11538
12314
|
var IMAGE_FADE_MS = 300;
|
|
11539
12315
|
function runOpacityFade(el, onDone) {
|
|
@@ -11712,7 +12488,7 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
|
|
|
11712
12488
|
const root = (0, import_client2.createRoot)(container);
|
|
11713
12489
|
(0, import_react_dom3.flushSync)(() => {
|
|
11714
12490
|
root.render(
|
|
11715
|
-
/* @__PURE__ */ (0,
|
|
12491
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
11716
12492
|
SchedulingWidget,
|
|
11717
12493
|
{
|
|
11718
12494
|
notifyOnConnect,
|
|
@@ -11760,6 +12536,17 @@ function applyLinkHref(el, val) {
|
|
|
11760
12536
|
const anchor = el instanceof HTMLAnchorElement ? el : el.querySelector("a");
|
|
11761
12537
|
if (anchor) anchor.setAttribute("href", val);
|
|
11762
12538
|
}
|
|
12539
|
+
function currentIconRef(el) {
|
|
12540
|
+
const uploaded = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
12541
|
+
if (uploaded?.getAttribute("src")) {
|
|
12542
|
+
return uploaded.getAttribute("src") ?? "";
|
|
12543
|
+
}
|
|
12544
|
+
const svg = el instanceof SVGElement ? el : el.querySelector("svg");
|
|
12545
|
+
const named = Array.from(svg?.classList ?? []).find(
|
|
12546
|
+
(c) => c.startsWith("lucide-") && c !== "lucide-icon"
|
|
12547
|
+
);
|
|
12548
|
+
return named ? `lucide:${named.slice("lucide-".length)}` : "";
|
|
12549
|
+
}
|
|
11763
12550
|
function getEditMeasureEl(editable) {
|
|
11764
12551
|
return editable.closest("[data-ohw-href-key]") ?? editable;
|
|
11765
12552
|
}
|
|
@@ -11804,8 +12591,11 @@ function isMediaEditable(el) {
|
|
|
11804
12591
|
const t = el.dataset.ohwEditable;
|
|
11805
12592
|
return t === "image" || t === "bg-image" || t === "video";
|
|
11806
12593
|
}
|
|
12594
|
+
function isIconEditable(el) {
|
|
12595
|
+
return el.dataset.ohwEditable === "icon";
|
|
12596
|
+
}
|
|
11807
12597
|
var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [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"])';
|
|
12598
|
+
var NON_MEDIA_SELECTOR = '[data-ohw-editable]:not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"]):not([data-ohw-editable="icon"])';
|
|
11809
12599
|
function getVideoEl2(el) {
|
|
11810
12600
|
return el instanceof HTMLVideoElement ? el : el.querySelector("video");
|
|
11811
12601
|
}
|
|
@@ -11923,13 +12713,29 @@ function isNavItemPointerTarget(el) {
|
|
|
11923
12713
|
function getNavigationItemAnchor(el) {
|
|
11924
12714
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
11925
12715
|
if (!anchor) return null;
|
|
11926
|
-
if (!anchor.querySelector('[data-ohw-editable="text"]')) return null;
|
|
12716
|
+
if (!anchor.querySelector('[data-ohw-editable="text"]') && !getSocialItem(anchor)) return null;
|
|
11927
12717
|
if (!isNavItemPointerTarget(anchor)) return null;
|
|
11928
12718
|
return anchor;
|
|
11929
12719
|
}
|
|
11930
12720
|
function isNavigationItem2(el) {
|
|
11931
12721
|
return getNavigationItemAnchor(el) !== null;
|
|
11932
12722
|
}
|
|
12723
|
+
function requestSocialDialog(anchor, post, content) {
|
|
12724
|
+
const item = getSocialItem(anchor);
|
|
12725
|
+
if (!item) return false;
|
|
12726
|
+
const iconKey = item.querySelector('[data-ohw-editable="icon"]')?.dataset.ohwKey ?? "";
|
|
12727
|
+
post({
|
|
12728
|
+
type: "ow:social-pick",
|
|
12729
|
+
hrefKey: item.getAttribute("data-ohw-href-key") ?? "",
|
|
12730
|
+
iconKey,
|
|
12731
|
+
url: getLinkHref4(item),
|
|
12732
|
+
iconStyle: detectIconStyle(item),
|
|
12733
|
+
// What was chosen last time. Guessing from the address instead reads as "Website" for anything
|
|
12734
|
+
// unrecognised, and for an item with no address at all — so a deliberate choice looked lost.
|
|
12735
|
+
platformId: content[socialPlatformKey(iconKey)] ?? ""
|
|
12736
|
+
});
|
|
12737
|
+
return true;
|
|
12738
|
+
}
|
|
11933
12739
|
function listNavigationItems() {
|
|
11934
12740
|
return Array.from(
|
|
11935
12741
|
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
@@ -11964,7 +12770,7 @@ function getNavigationRoot(el) {
|
|
|
11964
12770
|
return el.closest("nav, footer, aside");
|
|
11965
12771
|
}
|
|
11966
12772
|
function countFooterNavItems(el) {
|
|
11967
|
-
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem2).length;
|
|
12773
|
+
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter((item) => isNavigationItem2(item) && !getSocialItem(item)).length;
|
|
11968
12774
|
}
|
|
11969
12775
|
function findFooterItemGroup2(item) {
|
|
11970
12776
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -11985,10 +12791,11 @@ function isInferredFooterGroup2(el) {
|
|
|
11985
12791
|
const footer = el.closest("footer");
|
|
11986
12792
|
if (!footer || el === footer) return false;
|
|
11987
12793
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
12794
|
+
if (isSocialsRow(el)) return false;
|
|
11988
12795
|
return countFooterNavItems(el) >= 2;
|
|
11989
12796
|
}
|
|
11990
12797
|
function isNavigationContainer(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);
|
|
12798
|
+
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) || isSocialsRow(el) || isInferredFooterGroup2(el);
|
|
11992
12799
|
}
|
|
11993
12800
|
function isNavbarLinksContainer2(el) {
|
|
11994
12801
|
return el.hasAttribute("data-ohw-nav-container");
|
|
@@ -12071,6 +12878,8 @@ function resolveNavContainerSelectionTarget(target, clientX, clientY) {
|
|
|
12071
12878
|
return null;
|
|
12072
12879
|
}
|
|
12073
12880
|
function getNavigationSelectionParent(el) {
|
|
12881
|
+
const socialsRow = findSocialsRow(el);
|
|
12882
|
+
if (socialsRow) return socialsRow;
|
|
12074
12883
|
if (isNavigationItem2(el)) {
|
|
12075
12884
|
const childrenRoot = el.closest("[data-ohw-nav-children]");
|
|
12076
12885
|
if (childrenRoot) {
|
|
@@ -12096,6 +12905,10 @@ function getNavigationSelectionParent(el) {
|
|
|
12096
12905
|
}
|
|
12097
12906
|
function collectNavigationItemSiblingHintRects(selected) {
|
|
12098
12907
|
if (!isNavigationItem2(selected)) return [];
|
|
12908
|
+
const socialsRow = findSocialsRow(selected);
|
|
12909
|
+
if (socialsRow) {
|
|
12910
|
+
return listSocialItems(socialsRow).filter((item) => item !== selected).map((item) => item.getBoundingClientRect());
|
|
12911
|
+
}
|
|
12099
12912
|
const footerColumn = getFooterColumn(selected);
|
|
12100
12913
|
if (footerColumn) {
|
|
12101
12914
|
return listFooterLinksInColumn(footerColumn).filter((link) => link !== selected).map((link) => link.getBoundingClientRect());
|
|
@@ -12328,7 +13141,7 @@ function EditGlowChrome({
|
|
|
12328
13141
|
hideHandle = false
|
|
12329
13142
|
}) {
|
|
12330
13143
|
const GAP = SELECTION_CHROME_GAP2;
|
|
12331
|
-
return /* @__PURE__ */ (0,
|
|
13144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
12332
13145
|
"div",
|
|
12333
13146
|
{
|
|
12334
13147
|
ref: elRef,
|
|
@@ -12343,7 +13156,7 @@ function EditGlowChrome({
|
|
|
12343
13156
|
zIndex: 2147483646
|
|
12344
13157
|
},
|
|
12345
13158
|
children: [
|
|
12346
|
-
/* @__PURE__ */ (0,
|
|
13159
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12347
13160
|
"div",
|
|
12348
13161
|
{
|
|
12349
13162
|
style: {
|
|
@@ -12356,7 +13169,7 @@ function EditGlowChrome({
|
|
|
12356
13169
|
}
|
|
12357
13170
|
}
|
|
12358
13171
|
),
|
|
12359
|
-
reorderHrefKey && !hideHandle && /* @__PURE__ */ (0,
|
|
13172
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12360
13173
|
"div",
|
|
12361
13174
|
{
|
|
12362
13175
|
"data-ohw-drag-handle-container": "",
|
|
@@ -12368,7 +13181,7 @@ function EditGlowChrome({
|
|
|
12368
13181
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
12369
13182
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
12370
13183
|
},
|
|
12371
|
-
children: /* @__PURE__ */ (0,
|
|
13184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12372
13185
|
DragHandle,
|
|
12373
13186
|
{
|
|
12374
13187
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -12551,9 +13364,9 @@ function FloatingToolbar({
|
|
|
12551
13364
|
showEditLink,
|
|
12552
13365
|
onEditLink
|
|
12553
13366
|
}) {
|
|
12554
|
-
const localRef =
|
|
12555
|
-
const [measuredW, setMeasuredW] =
|
|
12556
|
-
const setRefs =
|
|
13367
|
+
const localRef = import_react16.default.useRef(null);
|
|
13368
|
+
const [measuredW, setMeasuredW] = import_react16.default.useState(330);
|
|
13369
|
+
const setRefs = import_react16.default.useCallback(
|
|
12557
13370
|
(node) => {
|
|
12558
13371
|
localRef.current = node;
|
|
12559
13372
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -12565,7 +13378,7 @@ function FloatingToolbar({
|
|
|
12565
13378
|
},
|
|
12566
13379
|
[elRef]
|
|
12567
13380
|
);
|
|
12568
|
-
|
|
13381
|
+
import_react16.default.useLayoutEffect(() => {
|
|
12569
13382
|
const node = localRef.current;
|
|
12570
13383
|
if (!node) return;
|
|
12571
13384
|
const update = () => {
|
|
@@ -12578,7 +13391,7 @@ function FloatingToolbar({
|
|
|
12578
13391
|
return () => ro.disconnect();
|
|
12579
13392
|
}, [showEditLink, activeCommands]);
|
|
12580
13393
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
12581
|
-
return /* @__PURE__ */ (0,
|
|
13394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12582
13395
|
"div",
|
|
12583
13396
|
{
|
|
12584
13397
|
ref: setRefs,
|
|
@@ -12590,12 +13403,12 @@ function FloatingToolbar({
|
|
|
12590
13403
|
zIndex: 2147483647,
|
|
12591
13404
|
pointerEvents: "auto"
|
|
12592
13405
|
},
|
|
12593
|
-
children: /* @__PURE__ */ (0,
|
|
12594
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0,
|
|
12595
|
-
gi > 0 && /* @__PURE__ */ (0,
|
|
13406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(CustomToolbar, { children: [
|
|
13407
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react16.default.Fragment, { children: [
|
|
13408
|
+
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomToolbarDivider, {}),
|
|
12596
13409
|
btns.map((btn) => {
|
|
12597
13410
|
const isActive = activeCommands.has(btn.cmd);
|
|
12598
|
-
return /* @__PURE__ */ (0,
|
|
13411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12599
13412
|
CustomToolbarButton,
|
|
12600
13413
|
{
|
|
12601
13414
|
title: btn.title,
|
|
@@ -12604,7 +13417,7 @@ function FloatingToolbar({
|
|
|
12604
13417
|
e.preventDefault();
|
|
12605
13418
|
onCommand(btn.cmd);
|
|
12606
13419
|
},
|
|
12607
|
-
children: /* @__PURE__ */ (0,
|
|
13420
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12608
13421
|
"svg",
|
|
12609
13422
|
{
|
|
12610
13423
|
width: "16",
|
|
@@ -12625,7 +13438,7 @@ function FloatingToolbar({
|
|
|
12625
13438
|
);
|
|
12626
13439
|
})
|
|
12627
13440
|
] }, gi)),
|
|
12628
|
-
showEditLink ? /* @__PURE__ */ (0,
|
|
13441
|
+
showEditLink ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12629
13442
|
CustomToolbarButton,
|
|
12630
13443
|
{
|
|
12631
13444
|
type: "button",
|
|
@@ -12639,7 +13452,7 @@ function FloatingToolbar({
|
|
|
12639
13452
|
e.preventDefault();
|
|
12640
13453
|
e.stopPropagation();
|
|
12641
13454
|
},
|
|
12642
|
-
children: /* @__PURE__ */ (0,
|
|
13455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react16.Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
12643
13456
|
}
|
|
12644
13457
|
) : null
|
|
12645
13458
|
] })
|
|
@@ -12656,7 +13469,7 @@ function StateToggle({
|
|
|
12656
13469
|
states,
|
|
12657
13470
|
onStateChange
|
|
12658
13471
|
}) {
|
|
12659
|
-
return /* @__PURE__ */ (0,
|
|
13472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
12660
13473
|
ToggleGroup,
|
|
12661
13474
|
{
|
|
12662
13475
|
"data-ohw-state-toggle": "",
|
|
@@ -12670,7 +13483,7 @@ function StateToggle({
|
|
|
12670
13483
|
left: rect.right - 8,
|
|
12671
13484
|
transform: "translateX(-100%)"
|
|
12672
13485
|
},
|
|
12673
|
-
children: states.map((state) => /* @__PURE__ */ (0,
|
|
13486
|
+
children: states.map((state) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
12674
13487
|
}
|
|
12675
13488
|
);
|
|
12676
13489
|
}
|
|
@@ -12697,8 +13510,8 @@ function OhhwellsBridge() {
|
|
|
12697
13510
|
const router = (0, import_navigation3.useRouter)();
|
|
12698
13511
|
const searchParams = (0, import_navigation3.useSearchParams)();
|
|
12699
13512
|
const isEditMode = isEditSessionActive();
|
|
12700
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
12701
|
-
(0,
|
|
13513
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react16.useState)(null);
|
|
13514
|
+
(0, import_react16.useEffect)(() => {
|
|
12702
13515
|
const figtreeFontId = "ohw-figtree-font";
|
|
12703
13516
|
if (!document.getElementById(figtreeFontId)) {
|
|
12704
13517
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -12727,108 +13540,113 @@ function OhhwellsBridge() {
|
|
|
12727
13540
|
const subdomain = resolveSubdomain(subdomainFromQuery);
|
|
12728
13541
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
12729
13542
|
useSavedLinkNavigation(isEditMode);
|
|
12730
|
-
const postToParent2 = (0,
|
|
13543
|
+
const postToParent2 = (0, import_react16.useCallback)((data) => {
|
|
12731
13544
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
12732
13545
|
window.parent.postMessage(data, "*");
|
|
12733
13546
|
}
|
|
12734
13547
|
}, []);
|
|
12735
|
-
const [fetchState, setFetchState] = (0,
|
|
12736
|
-
const autoSaveTimers = (0,
|
|
12737
|
-
const activeElRef = (0,
|
|
12738
|
-
const pointerHeldRef = (0,
|
|
12739
|
-
const selectedElRef = (0,
|
|
12740
|
-
const selectedHrefKeyRef = (0,
|
|
12741
|
-
const selectedFooterColAttrRef = (0,
|
|
12742
|
-
const originalContentRef = (0,
|
|
12743
|
-
const activeStateElRef = (0,
|
|
12744
|
-
const parentScrollRef = (0,
|
|
12745
|
-
const visibleViewportRef = (0,
|
|
12746
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
12747
|
-
const attachVisibleViewport = (0,
|
|
13548
|
+
const [fetchState, setFetchState] = (0, import_react16.useState)("idle");
|
|
13549
|
+
const autoSaveTimers = (0, import_react16.useRef)(/* @__PURE__ */ new Map());
|
|
13550
|
+
const activeElRef = (0, import_react16.useRef)(null);
|
|
13551
|
+
const pointerHeldRef = (0, import_react16.useRef)(false);
|
|
13552
|
+
const selectedElRef = (0, import_react16.useRef)(null);
|
|
13553
|
+
const selectedHrefKeyRef = (0, import_react16.useRef)(null);
|
|
13554
|
+
const selectedFooterColAttrRef = (0, import_react16.useRef)(null);
|
|
13555
|
+
const originalContentRef = (0, import_react16.useRef)(null);
|
|
13556
|
+
const activeStateElRef = (0, import_react16.useRef)(null);
|
|
13557
|
+
const parentScrollRef = (0, import_react16.useRef)(null);
|
|
13558
|
+
const visibleViewportRef = (0, import_react16.useRef)(null);
|
|
13559
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react16.useState)(null);
|
|
13560
|
+
const attachVisibleViewport = (0, import_react16.useCallback)((node) => {
|
|
12748
13561
|
visibleViewportRef.current = node;
|
|
12749
13562
|
setDialogPortalContainer(node);
|
|
12750
13563
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
12751
13564
|
}, []);
|
|
12752
|
-
const toolbarElRef = (0,
|
|
12753
|
-
const glowElRef = (0,
|
|
12754
|
-
const hoveredImageRef = (0,
|
|
12755
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
12756
|
-
const dragOverElRef = (0,
|
|
12757
|
-
const [mediaHover, setMediaHover] = (0,
|
|
12758
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
12759
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
12760
|
-
const hoveredGapRef = (0,
|
|
12761
|
-
const imageUnhoverTimerRef = (0,
|
|
12762
|
-
const imageShowTimerRef = (0,
|
|
12763
|
-
const editStylesRef = (0,
|
|
12764
|
-
const activateRef = (0,
|
|
13565
|
+
const toolbarElRef = (0, import_react16.useRef)(null);
|
|
13566
|
+
const glowElRef = (0, import_react16.useRef)(null);
|
|
13567
|
+
const hoveredImageRef = (0, import_react16.useRef)(null);
|
|
13568
|
+
const hoveredImageHasTextOverlapRef = (0, import_react16.useRef)(false);
|
|
13569
|
+
const dragOverElRef = (0, import_react16.useRef)(null);
|
|
13570
|
+
const [mediaHover, setMediaHover] = (0, import_react16.useState)(null);
|
|
13571
|
+
const [carouselHover, setCarouselHover] = (0, import_react16.useState)(null);
|
|
13572
|
+
const [uploadingRects, setUploadingRects] = (0, import_react16.useState)({});
|
|
13573
|
+
const hoveredGapRef = (0, import_react16.useRef)(null);
|
|
13574
|
+
const imageUnhoverTimerRef = (0, import_react16.useRef)(null);
|
|
13575
|
+
const imageShowTimerRef = (0, import_react16.useRef)(null);
|
|
13576
|
+
const editStylesRef = (0, import_react16.useRef)(null);
|
|
13577
|
+
const activateRef = (0, import_react16.useRef)(() => {
|
|
12765
13578
|
});
|
|
12766
|
-
const deactivateRef = (0,
|
|
13579
|
+
const deactivateRef = (0, import_react16.useRef)(() => {
|
|
12767
13580
|
});
|
|
12768
|
-
const selectRef = (0,
|
|
13581
|
+
const selectRef = (0, import_react16.useRef)(() => {
|
|
12769
13582
|
});
|
|
12770
|
-
const selectFrameRef = (0,
|
|
13583
|
+
const selectFrameRef = (0, import_react16.useRef)(() => {
|
|
12771
13584
|
});
|
|
12772
|
-
const deselectRef = (0,
|
|
13585
|
+
const deselectRef = (0, import_react16.useRef)(() => {
|
|
12773
13586
|
});
|
|
12774
|
-
const reselectNavigationItemRef = (0,
|
|
13587
|
+
const reselectNavigationItemRef = (0, import_react16.useRef)(() => {
|
|
12775
13588
|
});
|
|
12776
|
-
const commitNavigationTextEditRef = (0,
|
|
13589
|
+
const commitNavigationTextEditRef = (0, import_react16.useRef)(() => {
|
|
12777
13590
|
});
|
|
12778
|
-
const handleDeleteSelectedRef = (0,
|
|
12779
|
-
const runPendingDeleteUndoRef = (0,
|
|
12780
|
-
const isFooterFrameSelectionRef = (0,
|
|
12781
|
-
const refreshActiveCommandsRef = (0,
|
|
13591
|
+
const handleDeleteSelectedRef = (0, import_react16.useRef)(() => false);
|
|
13592
|
+
const runPendingDeleteUndoRef = (0, import_react16.useRef)(() => false);
|
|
13593
|
+
const isFooterFrameSelectionRef = (0, import_react16.useRef)(false);
|
|
13594
|
+
const refreshActiveCommandsRef = (0, import_react16.useRef)(() => {
|
|
12782
13595
|
});
|
|
12783
|
-
const postToParentRef = (0,
|
|
13596
|
+
const postToParentRef = (0, import_react16.useRef)(postToParent2);
|
|
12784
13597
|
postToParentRef.current = postToParent2;
|
|
12785
|
-
const aiSectionApiRef = (0,
|
|
12786
|
-
const sectionsLoadedRef = (0,
|
|
12787
|
-
const pendingScheduleConfigRequests = (0,
|
|
12788
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
12789
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
12790
|
-
const toolbarVariantRef = (0,
|
|
13598
|
+
const aiSectionApiRef = (0, import_react16.useRef)(null);
|
|
13599
|
+
const sectionsLoadedRef = (0, import_react16.useRef)(false);
|
|
13600
|
+
const pendingScheduleConfigRequests = (0, import_react16.useRef)([]);
|
|
13601
|
+
const [toolbarRect, setToolbarRect] = (0, import_react16.useState)(null);
|
|
13602
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react16.useState)("none");
|
|
13603
|
+
const toolbarVariantRef = (0, import_react16.useRef)("none");
|
|
12791
13604
|
toolbarVariantRef.current = toolbarVariant;
|
|
12792
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
12793
|
-
const [
|
|
12794
|
-
const [
|
|
12795
|
-
const [
|
|
12796
|
-
const [
|
|
12797
|
-
const [
|
|
12798
|
-
const [
|
|
12799
|
-
const [
|
|
12800
|
-
const
|
|
12801
|
-
const [
|
|
12802
|
-
const
|
|
12803
|
-
const [
|
|
12804
|
-
const
|
|
12805
|
-
const [
|
|
12806
|
-
const
|
|
12807
|
-
const [
|
|
12808
|
-
const [
|
|
13605
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react16.useState)(false);
|
|
13606
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react16.useState)(false);
|
|
13607
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react16.useState)(false);
|
|
13608
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react16.useState)(null);
|
|
13609
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react16.useState)(false);
|
|
13610
|
+
const [toggleState, setToggleState] = (0, import_react16.useState)(null);
|
|
13611
|
+
const [maxBadge, setMaxBadge] = (0, import_react16.useState)(null);
|
|
13612
|
+
const [activeCommands, setActiveCommands] = (0, import_react16.useState)(/* @__PURE__ */ new Set());
|
|
13613
|
+
const [sectionGap, setSectionGap] = (0, import_react16.useState)(null);
|
|
13614
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react16.useState)(false);
|
|
13615
|
+
const hoveredNavContainerRef = (0, import_react16.useRef)(null);
|
|
13616
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react16.useState)(null);
|
|
13617
|
+
const hoveredItemElRef = (0, import_react16.useRef)(null);
|
|
13618
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react16.useState)(null);
|
|
13619
|
+
const siblingHintElRef = (0, import_react16.useRef)(null);
|
|
13620
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react16.useState)(null);
|
|
13621
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react16.useState)([]);
|
|
13622
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react16.useState)(false);
|
|
13623
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react16.useState)(false);
|
|
12809
13624
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
12810
|
-
const [
|
|
12811
|
-
const [
|
|
12812
|
-
const
|
|
12813
|
-
const [
|
|
12814
|
-
const [
|
|
12815
|
-
const
|
|
12816
|
-
const
|
|
12817
|
-
const
|
|
12818
|
-
const
|
|
12819
|
-
const
|
|
12820
|
-
const
|
|
12821
|
-
const
|
|
12822
|
-
const
|
|
12823
|
-
const
|
|
12824
|
-
const
|
|
12825
|
-
const
|
|
12826
|
-
const
|
|
12827
|
-
const
|
|
12828
|
-
const
|
|
12829
|
-
const
|
|
12830
|
-
const
|
|
12831
|
-
const
|
|
13625
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react16.useState)(null);
|
|
13626
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react16.useState)(null);
|
|
13627
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react16.useState)(null);
|
|
13628
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react16.useState)(null);
|
|
13629
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react16.useState)(null);
|
|
13630
|
+
const footerDragRef = (0, import_react16.useRef)(null);
|
|
13631
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react16.useState)([]);
|
|
13632
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react16.useState)(null);
|
|
13633
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react16.useState)(null);
|
|
13634
|
+
const footerPointerDragRef = (0, import_react16.useRef)(null);
|
|
13635
|
+
const suppressNextClickRef = (0, import_react16.useRef)(false);
|
|
13636
|
+
const suppressClickUntilRef = (0, import_react16.useRef)(0);
|
|
13637
|
+
const [linkPopover, setLinkPopover] = (0, import_react16.useState)(null);
|
|
13638
|
+
const linkPopoverSessionRef = (0, import_react16.useRef)(null);
|
|
13639
|
+
const addNavAfterAnchorRef = (0, import_react16.useRef)(null);
|
|
13640
|
+
const editContentRef = (0, import_react16.useRef)({});
|
|
13641
|
+
const aiSectionsRef = (0, import_react16.useRef)("");
|
|
13642
|
+
const pendingDeleteUndoRef = (0, import_react16.useRef)(null);
|
|
13643
|
+
const [sitePages, setSitePages] = (0, import_react16.useState)([]);
|
|
13644
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react16.useState)({});
|
|
13645
|
+
const sectionsPrefetchGenRef = (0, import_react16.useRef)(0);
|
|
13646
|
+
const setLinkPopoverRef = (0, import_react16.useRef)(setLinkPopover);
|
|
13647
|
+
const linkPopoverPanelRef = (0, import_react16.useRef)(null);
|
|
13648
|
+
const linkPopoverOpenRef = (0, import_react16.useRef)(false);
|
|
13649
|
+
const linkPopoverGraceUntilRef = (0, import_react16.useRef)(0);
|
|
12832
13650
|
setLinkPopoverRef.current = setLinkPopover;
|
|
12833
13651
|
linkPopoverSessionRef.current = linkPopover;
|
|
12834
13652
|
const {
|
|
@@ -12866,7 +13684,7 @@ function OhhwellsBridge() {
|
|
|
12866
13684
|
const bumpLinkPopoverGrace = () => {
|
|
12867
13685
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
12868
13686
|
};
|
|
12869
|
-
const runSectionsPrefetch = (0,
|
|
13687
|
+
const runSectionsPrefetch = (0, import_react16.useCallback)((pages) => {
|
|
12870
13688
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
12871
13689
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
12872
13690
|
const paths = pages.map((p) => p.path);
|
|
@@ -12885,9 +13703,9 @@ function OhhwellsBridge() {
|
|
|
12885
13703
|
);
|
|
12886
13704
|
});
|
|
12887
13705
|
}, [isEditMode, pathname]);
|
|
12888
|
-
const runSectionsPrefetchRef = (0,
|
|
13706
|
+
const runSectionsPrefetchRef = (0, import_react16.useRef)(runSectionsPrefetch);
|
|
12889
13707
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
12890
|
-
(0,
|
|
13708
|
+
(0, import_react16.useEffect)(() => {
|
|
12891
13709
|
if (!linkPopover) {
|
|
12892
13710
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
12893
13711
|
return;
|
|
@@ -12915,7 +13733,7 @@ function OhhwellsBridge() {
|
|
|
12915
13733
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
12916
13734
|
};
|
|
12917
13735
|
}, [linkPopover, postToParent2]);
|
|
12918
|
-
(0,
|
|
13736
|
+
(0, import_react16.useEffect)(() => {
|
|
12919
13737
|
if (!isEditMode) return;
|
|
12920
13738
|
const useFixtures = shouldUseDevFixtures();
|
|
12921
13739
|
if (useFixtures) {
|
|
@@ -12939,14 +13757,14 @@ function OhhwellsBridge() {
|
|
|
12939
13757
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
12940
13758
|
return () => window.removeEventListener("message", onSitePages);
|
|
12941
13759
|
}, [isEditMode, postToParent2]);
|
|
12942
|
-
(0,
|
|
13760
|
+
(0, import_react16.useEffect)(() => {
|
|
12943
13761
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
12944
13762
|
void loadAllSectionsManifest().then((manifest) => {
|
|
12945
13763
|
if (Object.keys(manifest).length === 0) return;
|
|
12946
13764
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
12947
13765
|
});
|
|
12948
13766
|
}, [isEditMode]);
|
|
12949
|
-
(0,
|
|
13767
|
+
(0, import_react16.useEffect)(() => {
|
|
12950
13768
|
const update = () => {
|
|
12951
13769
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
12952
13770
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -12970,10 +13788,10 @@ function OhhwellsBridge() {
|
|
|
12970
13788
|
vvp.removeEventListener("resize", update);
|
|
12971
13789
|
};
|
|
12972
13790
|
}, []);
|
|
12973
|
-
const refreshStateRules = (0,
|
|
13791
|
+
const refreshStateRules = (0, import_react16.useCallback)(() => {
|
|
12974
13792
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
12975
13793
|
}, []);
|
|
12976
|
-
const processConfigRequest = (0,
|
|
13794
|
+
const processConfigRequest = (0, import_react16.useCallback)((insertAfterVal) => {
|
|
12977
13795
|
const tracker = getSectionsTracker();
|
|
12978
13796
|
let entries = [];
|
|
12979
13797
|
try {
|
|
@@ -12996,7 +13814,7 @@ function OhhwellsBridge() {
|
|
|
12996
13814
|
}
|
|
12997
13815
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
12998
13816
|
}, [isEditMode]);
|
|
12999
|
-
const deactivate = (0,
|
|
13817
|
+
const deactivate = (0, import_react16.useCallback)(() => {
|
|
13000
13818
|
const el = activeElRef.current;
|
|
13001
13819
|
if (!el) return;
|
|
13002
13820
|
const key = el.dataset.ohwKey;
|
|
@@ -13029,17 +13847,19 @@ function OhhwellsBridge() {
|
|
|
13029
13847
|
setToolbarShowEditLink(false);
|
|
13030
13848
|
postToParent2({ type: "ow:exit-edit" });
|
|
13031
13849
|
}, [postToParent2]);
|
|
13032
|
-
const clearSelectedAttr = (0,
|
|
13850
|
+
const clearSelectedAttr = (0, import_react16.useCallback)(() => {
|
|
13033
13851
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
13034
13852
|
el.removeAttribute("data-ohw-selected");
|
|
13035
13853
|
});
|
|
13036
13854
|
}, []);
|
|
13037
|
-
const deselect = (0,
|
|
13855
|
+
const deselect = (0, import_react16.useCallback)(() => {
|
|
13038
13856
|
clearSelectedAttr();
|
|
13039
13857
|
selectedElRef.current = null;
|
|
13040
13858
|
selectedHrefKeyRef.current = null;
|
|
13041
13859
|
selectedFooterColAttrRef.current = null;
|
|
13042
13860
|
setSelectedIsCta(false);
|
|
13861
|
+
setSelectedIsSocial(false);
|
|
13862
|
+
setSelectedIsSocialsRow(false);
|
|
13043
13863
|
setReorderHrefKey(null);
|
|
13044
13864
|
setReorderDragDisabled(false);
|
|
13045
13865
|
setIsFooterFrameSelection(false);
|
|
@@ -13057,11 +13877,11 @@ function OhhwellsBridge() {
|
|
|
13057
13877
|
setToolbarVariant("none");
|
|
13058
13878
|
}
|
|
13059
13879
|
}, [clearSelectedAttr]);
|
|
13060
|
-
const markSelected = (0,
|
|
13880
|
+
const markSelected = (0, import_react16.useCallback)((el) => {
|
|
13061
13881
|
clearSelectedAttr();
|
|
13062
13882
|
el.setAttribute("data-ohw-selected", "");
|
|
13063
13883
|
}, [clearSelectedAttr]);
|
|
13064
|
-
const resolveHrefKeyElement = (0,
|
|
13884
|
+
const resolveHrefKeyElement = (0, import_react16.useCallback)((hrefKey) => {
|
|
13065
13885
|
if (isFooterHrefKey(hrefKey)) {
|
|
13066
13886
|
return document.querySelector(
|
|
13067
13887
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -13076,7 +13896,7 @@ function OhhwellsBridge() {
|
|
|
13076
13896
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
13077
13897
|
);
|
|
13078
13898
|
}, []);
|
|
13079
|
-
const resyncSelectedNavigationItem = (0,
|
|
13899
|
+
const resyncSelectedNavigationItem = (0, import_react16.useCallback)(() => {
|
|
13080
13900
|
const hrefKey = selectedHrefKeyRef.current;
|
|
13081
13901
|
if (hrefKey) {
|
|
13082
13902
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -13114,12 +13934,14 @@ function OhhwellsBridge() {
|
|
|
13114
13934
|
);
|
|
13115
13935
|
}
|
|
13116
13936
|
}, [resolveHrefKeyElement]);
|
|
13117
|
-
const reselectNavigationItem = (0,
|
|
13937
|
+
const reselectNavigationItem = (0, import_react16.useCallback)((navAnchor) => {
|
|
13118
13938
|
selectedElRef.current = navAnchor;
|
|
13119
13939
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
13120
13940
|
selectedFooterColAttrRef.current = null;
|
|
13121
13941
|
markSelected(navAnchor);
|
|
13122
13942
|
setSelectedIsCta(isCtaButton(navAnchor));
|
|
13943
|
+
setSelectedIsSocial(Boolean(getSocialItem(navAnchor)));
|
|
13944
|
+
setSelectedIsSocialsRow(false);
|
|
13123
13945
|
const isDropdownTrigger = !isNestedNavChild(navAnchor) && (navItemHasDropdownChildren(navAnchor) || navItemOwnsDropdownPanel(navAnchor));
|
|
13124
13946
|
if (isNestedNavChild(navAnchor)) {
|
|
13125
13947
|
setNavGroupForceOpen(navAnchor, true);
|
|
@@ -13143,7 +13965,7 @@ function OhhwellsBridge() {
|
|
|
13143
13965
|
setToolbarShowEditLink(false);
|
|
13144
13966
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
13145
13967
|
}, [markSelected]);
|
|
13146
|
-
const commitNavigationTextEdit = (0,
|
|
13968
|
+
const commitNavigationTextEdit = (0, import_react16.useCallback)((navAnchor) => {
|
|
13147
13969
|
const el = activeElRef.current;
|
|
13148
13970
|
if (!el) return;
|
|
13149
13971
|
const key = el.dataset.ohwKey;
|
|
@@ -13170,7 +13992,7 @@ function OhhwellsBridge() {
|
|
|
13170
13992
|
postToParent2({ type: "ow:exit-edit" });
|
|
13171
13993
|
reselectNavigationItem(navAnchor);
|
|
13172
13994
|
}, [postToParent2, reselectNavigationItem]);
|
|
13173
|
-
const handleAddTopLevelNavItem = (0,
|
|
13995
|
+
const handleAddTopLevelNavItem = (0, import_react16.useCallback)(() => {
|
|
13174
13996
|
const items = listNavbarRootItems();
|
|
13175
13997
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
13176
13998
|
deselectRef.current();
|
|
@@ -13182,7 +14004,7 @@ function OhhwellsBridge() {
|
|
|
13182
14004
|
intent: "add-nav"
|
|
13183
14005
|
});
|
|
13184
14006
|
}, []);
|
|
13185
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
14007
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react16.useCallback)(
|
|
13186
14008
|
(anchor) => {
|
|
13187
14009
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
13188
14010
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -13195,7 +14017,7 @@ function OhhwellsBridge() {
|
|
|
13195
14017
|
},
|
|
13196
14018
|
[postToParent2]
|
|
13197
14019
|
);
|
|
13198
|
-
const handleNavDropdownOpenChange = (0,
|
|
14020
|
+
const handleNavDropdownOpenChange = (0, import_react16.useCallback)((open) => {
|
|
13199
14021
|
const selected = selectedElRef.current;
|
|
13200
14022
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
13201
14023
|
setNavGroupForceOpen(selected, open);
|
|
@@ -13207,7 +14029,7 @@ function OhhwellsBridge() {
|
|
|
13207
14029
|
}
|
|
13208
14030
|
});
|
|
13209
14031
|
}, []);
|
|
13210
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
14032
|
+
const handleFooterHeadingVisibleChange = (0, import_react16.useCallback)(
|
|
13211
14033
|
(visible) => {
|
|
13212
14034
|
const selected = selectedElRef.current;
|
|
13213
14035
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -13231,7 +14053,7 @@ function OhhwellsBridge() {
|
|
|
13231
14053
|
},
|
|
13232
14054
|
[postToParent2]
|
|
13233
14055
|
);
|
|
13234
|
-
const enterEditOnNewItem = (0,
|
|
14056
|
+
const enterEditOnNewItem = (0, import_react16.useCallback)((anchor) => {
|
|
13235
14057
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
13236
14058
|
if (!label) {
|
|
13237
14059
|
selectRef.current(anchor);
|
|
@@ -13240,9 +14062,31 @@ function OhhwellsBridge() {
|
|
|
13240
14062
|
setNavGroupForceOpen(anchor, true);
|
|
13241
14063
|
activateRef.current(label);
|
|
13242
14064
|
}, []);
|
|
13243
|
-
const handleAddChildItem = (0,
|
|
14065
|
+
const handleAddChildItem = (0, import_react16.useCallback)(() => {
|
|
13244
14066
|
const selected = selectedElRef.current;
|
|
13245
14067
|
if (!selected) return;
|
|
14068
|
+
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
14069
|
+
if (socialsRow) {
|
|
14070
|
+
const after = getSocialItem(selected);
|
|
14071
|
+
const result2 = insertSocialItem(socialsRow, after, editContentRef.current);
|
|
14072
|
+
if (!result2) return;
|
|
14073
|
+
const orderJson = JSON.stringify(result2.order);
|
|
14074
|
+
applySocialsDisplayToRow(socialsRow, socialsDisplayFor(socialsRow, editContentRef.current));
|
|
14075
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14076
|
+
postToParent2({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
14077
|
+
postToParentRef.current({
|
|
14078
|
+
type: "ow:social-pick",
|
|
14079
|
+
hrefKey: result2.hrefKey,
|
|
14080
|
+
iconKey: result2.iconKey,
|
|
14081
|
+
url: "",
|
|
14082
|
+
iconStyle: detectIconStyle(result2.item),
|
|
14083
|
+
platformId: "",
|
|
14084
|
+
// Lets the editor undo the insert if the dialog is dismissed: an item that was never given
|
|
14085
|
+
// an address should not survive a Cancel.
|
|
14086
|
+
isNew: true
|
|
14087
|
+
});
|
|
14088
|
+
return;
|
|
14089
|
+
}
|
|
13246
14090
|
if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
|
|
13247
14091
|
if (!selected.hasAttribute("data-ohw-footer-col") && !selected.closest("[data-ohw-footer-col]")) {
|
|
13248
14092
|
}
|
|
@@ -13316,7 +14160,7 @@ function OhhwellsBridge() {
|
|
|
13316
14160
|
enterEditOnNewItem(result.anchor);
|
|
13317
14161
|
});
|
|
13318
14162
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
13319
|
-
const handleAddFooterColumn = (0,
|
|
14163
|
+
const handleAddFooterColumn = (0, import_react16.useCallback)(() => {
|
|
13320
14164
|
if (!canAddFooterColumn()) {
|
|
13321
14165
|
postToParent2({
|
|
13322
14166
|
type: "ow:toast",
|
|
@@ -13337,7 +14181,7 @@ function OhhwellsBridge() {
|
|
|
13337
14181
|
selectRef.current(result.firstLink);
|
|
13338
14182
|
});
|
|
13339
14183
|
}, [postToParent2]);
|
|
13340
|
-
const clearFooterDragVisuals = (0,
|
|
14184
|
+
const clearFooterDragVisuals = (0, import_react16.useCallback)(() => {
|
|
13341
14185
|
footerDragRef.current = null;
|
|
13342
14186
|
setSiblingHintRects([]);
|
|
13343
14187
|
setFooterDropSlots([]);
|
|
@@ -13346,7 +14190,7 @@ function OhhwellsBridge() {
|
|
|
13346
14190
|
setIsItemDragging(false);
|
|
13347
14191
|
unlockFooterDragInteraction();
|
|
13348
14192
|
}, []);
|
|
13349
|
-
const refreshFooterDragVisuals = (0,
|
|
14193
|
+
const refreshFooterDragVisuals = (0, import_react16.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
13350
14194
|
const dragged = session.draggedEl;
|
|
13351
14195
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
13352
14196
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -13355,6 +14199,13 @@ function OhhwellsBridge() {
|
|
|
13355
14199
|
}
|
|
13356
14200
|
session.activeSlot = activeSlot;
|
|
13357
14201
|
setSiblingHintRects([]);
|
|
14202
|
+
if (session.kind === "social") {
|
|
14203
|
+
const slots2 = session.hrefKey ? buildSocialDropSlotsForKey(session.hrefKey) : [];
|
|
14204
|
+
setFooterDropSlots(slots2);
|
|
14205
|
+
const activeIdx2 = activeSlot ? slots2.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
14206
|
+
setActiveFooterDropIndex(activeIdx2 >= 0 ? activeIdx2 : null);
|
|
14207
|
+
return;
|
|
14208
|
+
}
|
|
13358
14209
|
if (session.kind === "link") {
|
|
13359
14210
|
const columns = listFooterColumns();
|
|
13360
14211
|
const slots2 = [];
|
|
@@ -13371,13 +14222,13 @@ function OhhwellsBridge() {
|
|
|
13371
14222
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
13372
14223
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
13373
14224
|
}, []);
|
|
13374
|
-
const refreshFooterDragVisualsRef = (0,
|
|
14225
|
+
const refreshFooterDragVisualsRef = (0, import_react16.useRef)(refreshFooterDragVisuals);
|
|
13375
14226
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
13376
|
-
const commitFooterDragRef = (0,
|
|
14227
|
+
const commitFooterDragRef = (0, import_react16.useRef)(() => {
|
|
13377
14228
|
});
|
|
13378
|
-
const beginFooterDragRef = (0,
|
|
14229
|
+
const beginFooterDragRef = (0, import_react16.useRef)(() => {
|
|
13379
14230
|
});
|
|
13380
|
-
const beginFooterDrag = (0,
|
|
14231
|
+
const beginFooterDrag = (0, import_react16.useCallback)(
|
|
13381
14232
|
(session) => {
|
|
13382
14233
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
13383
14234
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -13391,13 +14242,13 @@ function OhhwellsBridge() {
|
|
|
13391
14242
|
if (session.wasSelected && selectedElRef.current === session.draggedEl) {
|
|
13392
14243
|
setToolbarRect(rect);
|
|
13393
14244
|
}
|
|
13394
|
-
const initialSlot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
14245
|
+
const initialSlot = session.kind === "social" && session.hrefKey ? hitTestSocialDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
13395
14246
|
refreshFooterDragVisuals(session, initialSlot, session.lastClientX, session.lastClientY);
|
|
13396
14247
|
},
|
|
13397
14248
|
[refreshFooterDragVisuals]
|
|
13398
14249
|
);
|
|
13399
14250
|
beginFooterDragRef.current = beginFooterDrag;
|
|
13400
|
-
const commitFooterDrag = (0,
|
|
14251
|
+
const commitFooterDrag = (0, import_react16.useCallback)(
|
|
13401
14252
|
(clientX, clientY) => {
|
|
13402
14253
|
const session = footerDragRef.current;
|
|
13403
14254
|
if (!session) {
|
|
@@ -13407,8 +14258,11 @@ function OhhwellsBridge() {
|
|
|
13407
14258
|
const x = typeof clientX === "number" && (clientX !== 0 || clientY !== 0) ? clientX : session.lastClientX;
|
|
13408
14259
|
const y = typeof clientY === "number" && (clientX !== 0 || clientY !== 0) ? clientY : session.lastClientY;
|
|
13409
14260
|
let nextOrder = null;
|
|
13410
|
-
|
|
13411
|
-
|
|
14261
|
+
let nextSocialsOrder = null;
|
|
14262
|
+
const slot = session.activeSlot ?? (session.kind === "social" && session.hrefKey ? hitTestSocialDropSlot(x, y, session.hrefKey) : session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(x, y, session.hrefKey) : session.kind === "column" ? hitTestColumnDropSlot(x, y) : null);
|
|
14263
|
+
if (session.kind === "social" && session.hrefKey && slot) {
|
|
14264
|
+
nextSocialsOrder = planSocialMove(session.hrefKey, slot.insertIndex);
|
|
14265
|
+
} else if (session.kind === "link" && session.hrefKey && slot) {
|
|
13412
14266
|
nextOrder = planFooterLinkMove(session.hrefKey, slot.columnIndex, slot.insertIndex);
|
|
13413
14267
|
} else if (session.kind === "column" && slot) {
|
|
13414
14268
|
nextOrder = planFooterColumnMove(session.sourceColumnIndex, slot.insertIndex);
|
|
@@ -13466,6 +14320,27 @@ function OhhwellsBridge() {
|
|
|
13466
14320
|
}
|
|
13467
14321
|
deselectRef.current();
|
|
13468
14322
|
};
|
|
14323
|
+
if (nextSocialsOrder) {
|
|
14324
|
+
const orderJson = JSON.stringify(nextSocialsOrder);
|
|
14325
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14326
|
+
applySocialsOrder(nextSocialsOrder);
|
|
14327
|
+
postToParentRef.current({
|
|
14328
|
+
type: "ow:change",
|
|
14329
|
+
nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }]
|
|
14330
|
+
});
|
|
14331
|
+
applySelectionAfterDrop();
|
|
14332
|
+
clearFooterDragVisuals();
|
|
14333
|
+
const reapply = nextSocialsOrder;
|
|
14334
|
+
requestAnimationFrame(() => {
|
|
14335
|
+
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14336
|
+
applySelectionAfterDrop();
|
|
14337
|
+
requestAnimationFrame(() => {
|
|
14338
|
+
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14339
|
+
resyncSelectedNavigationItem();
|
|
14340
|
+
});
|
|
14341
|
+
});
|
|
14342
|
+
return;
|
|
14343
|
+
}
|
|
13469
14344
|
if (nextOrder) {
|
|
13470
14345
|
const orderJson = JSON.stringify(nextOrder);
|
|
13471
14346
|
editContentRef.current = {
|
|
@@ -13501,10 +14376,25 @@ function OhhwellsBridge() {
|
|
|
13501
14376
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
13502
14377
|
);
|
|
13503
14378
|
commitFooterDragRef.current = commitFooterDrag;
|
|
13504
|
-
const startFooterLinkDrag = (0,
|
|
14379
|
+
const startFooterLinkDrag = (0, import_react16.useCallback)(
|
|
13505
14380
|
(anchor, clientX, clientY, wasSelected) => {
|
|
13506
14381
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
13507
|
-
if (!hrefKey
|
|
14382
|
+
if (!hrefKey) return false;
|
|
14383
|
+
if (getSocialItem(anchor)) {
|
|
14384
|
+
beginFooterDrag({
|
|
14385
|
+
kind: "social",
|
|
14386
|
+
hrefKey,
|
|
14387
|
+
columnEl: null,
|
|
14388
|
+
sourceColumnIndex: 0,
|
|
14389
|
+
wasSelected,
|
|
14390
|
+
draggedEl: anchor,
|
|
14391
|
+
lastClientX: clientX,
|
|
14392
|
+
lastClientY: clientY,
|
|
14393
|
+
activeSlot: null
|
|
14394
|
+
});
|
|
14395
|
+
return true;
|
|
14396
|
+
}
|
|
14397
|
+
if (!isFooterHrefKey(hrefKey)) return false;
|
|
13508
14398
|
const column = findFooterColumnForLink(anchor);
|
|
13509
14399
|
const columns = listFooterColumns();
|
|
13510
14400
|
beginFooterDrag({
|
|
@@ -13522,7 +14412,7 @@ function OhhwellsBridge() {
|
|
|
13522
14412
|
},
|
|
13523
14413
|
[beginFooterDrag]
|
|
13524
14414
|
);
|
|
13525
|
-
const startFooterColumnDrag = (0,
|
|
14415
|
+
const startFooterColumnDrag = (0, import_react16.useCallback)(
|
|
13526
14416
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
13527
14417
|
const columns = listFooterColumns();
|
|
13528
14418
|
const idx = columns.indexOf(columnEl);
|
|
@@ -13542,7 +14432,7 @@ function OhhwellsBridge() {
|
|
|
13542
14432
|
},
|
|
13543
14433
|
[beginFooterDrag]
|
|
13544
14434
|
);
|
|
13545
|
-
const handleItemDragStart = (0,
|
|
14435
|
+
const handleItemDragStart = (0, import_react16.useCallback)(
|
|
13546
14436
|
(e) => {
|
|
13547
14437
|
const selected = selectedElRef.current;
|
|
13548
14438
|
if (!selected) {
|
|
@@ -13562,7 +14452,7 @@ function OhhwellsBridge() {
|
|
|
13562
14452
|
},
|
|
13563
14453
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
|
|
13564
14454
|
);
|
|
13565
|
-
const handleItemDragEnd = (0,
|
|
14455
|
+
const handleItemDragEnd = (0, import_react16.useCallback)(
|
|
13566
14456
|
(e) => {
|
|
13567
14457
|
if (footerDragRef.current) {
|
|
13568
14458
|
const x = e?.clientX;
|
|
@@ -13588,7 +14478,7 @@ function OhhwellsBridge() {
|
|
|
13588
14478
|
},
|
|
13589
14479
|
[commitFooterDrag, commitNavDrag, navDragRef]
|
|
13590
14480
|
);
|
|
13591
|
-
const handleItemChromePointerDown = (0,
|
|
14481
|
+
const handleItemChromePointerDown = (0, import_react16.useCallback)((e) => {
|
|
13592
14482
|
if (e.button !== 0) return;
|
|
13593
14483
|
const selected = selectedElRef.current;
|
|
13594
14484
|
if (!selected) return;
|
|
@@ -13619,7 +14509,7 @@ function OhhwellsBridge() {
|
|
|
13619
14509
|
}
|
|
13620
14510
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
13621
14511
|
}, [armNavPressFromChrome]);
|
|
13622
|
-
const handleItemChromeClick = (0,
|
|
14512
|
+
const handleItemChromeClick = (0, import_react16.useCallback)((clientX, clientY) => {
|
|
13623
14513
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
13624
14514
|
suppressNextClickRef.current = false;
|
|
13625
14515
|
return;
|
|
@@ -13632,7 +14522,7 @@ function OhhwellsBridge() {
|
|
|
13632
14522
|
}, []);
|
|
13633
14523
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
13634
14524
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
13635
|
-
const select = (0,
|
|
14525
|
+
const select = (0, import_react16.useCallback)((anchor) => {
|
|
13636
14526
|
if (!isNavigationItem2(anchor)) return;
|
|
13637
14527
|
if (activeElRef.current) deactivate();
|
|
13638
14528
|
aiSectionApiRef.current?.selectFromElement(anchor);
|
|
@@ -13641,6 +14531,8 @@ function OhhwellsBridge() {
|
|
|
13641
14531
|
selectedFooterColAttrRef.current = null;
|
|
13642
14532
|
markSelected(anchor);
|
|
13643
14533
|
setSelectedIsCta(isCtaButton(anchor));
|
|
14534
|
+
setSelectedIsSocial(Boolean(getSocialItem(anchor)));
|
|
14535
|
+
setSelectedIsSocialsRow(false);
|
|
13644
14536
|
clearHrefKeyHover(anchor);
|
|
13645
14537
|
const isDropdownTrigger = !isNestedNavChild(anchor) && (navItemHasDropdownChildren(anchor) || navItemOwnsDropdownPanel(anchor));
|
|
13646
14538
|
if (isNestedNavChild(anchor)) {
|
|
@@ -13671,7 +14563,7 @@ function OhhwellsBridge() {
|
|
|
13671
14563
|
setToolbarShowEditLink(false);
|
|
13672
14564
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
13673
14565
|
}, [deactivate, markSelected]);
|
|
13674
|
-
const selectFrame = (0,
|
|
14566
|
+
const selectFrame = (0, import_react16.useCallback)((el) => {
|
|
13675
14567
|
if (!isNavigationContainer(el)) return;
|
|
13676
14568
|
if (activeElRef.current) deactivate();
|
|
13677
14569
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -13681,6 +14573,8 @@ function OhhwellsBridge() {
|
|
|
13681
14573
|
selectedFooterColAttrRef.current = isFooterColumn ? el.getAttribute("data-ohw-footer-col") ?? String(listFooterColumns().indexOf(el)) : null;
|
|
13682
14574
|
markSelected(el);
|
|
13683
14575
|
setSelectedIsCta(false);
|
|
14576
|
+
setSelectedIsSocial(false);
|
|
14577
|
+
setSelectedIsSocialsRow(isSocialsRow(el));
|
|
13684
14578
|
clearHrefKeyHover(el);
|
|
13685
14579
|
setNavGroupForceOpen(null, false);
|
|
13686
14580
|
hoveredNavContainerRef.current = null;
|
|
@@ -13718,13 +14612,57 @@ function OhhwellsBridge() {
|
|
|
13718
14612
|
setToolbarShowEditLink(false);
|
|
13719
14613
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
13720
14614
|
}, [deactivate, markSelected, postToParent2]);
|
|
13721
|
-
const
|
|
14615
|
+
const openSocialsDisplayPanel = (0, import_react16.useCallback)((row) => {
|
|
14616
|
+
setParentScrollSnap(parentScrollRef.current);
|
|
14617
|
+
setFloatingPanel({
|
|
14618
|
+
key: "socials-display",
|
|
14619
|
+
title: "Style",
|
|
14620
|
+
context: "Socials \xB7 Footer",
|
|
14621
|
+
kind: "socials-display",
|
|
14622
|
+
row
|
|
14623
|
+
});
|
|
14624
|
+
}, []);
|
|
14625
|
+
const changeSocialsDisplay = (0, import_react16.useCallback)(
|
|
14626
|
+
(row, next) => {
|
|
14627
|
+
if (next.icon) {
|
|
14628
|
+
const missing = socialsMissingIcons(row);
|
|
14629
|
+
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
14630
|
+
if (missing.length) {
|
|
14631
|
+
postToParentRef.current({ type: "ow:social-icons-needed", items: missing });
|
|
14632
|
+
}
|
|
14633
|
+
}
|
|
14634
|
+
applySocialsDisplayToRow(row, next);
|
|
14635
|
+
requestAnimationFrame(() => {
|
|
14636
|
+
if (selectedElRef.current === row && row.isConnected) setToolbarRect(row.getBoundingClientRect());
|
|
14637
|
+
});
|
|
14638
|
+
const displayJson = JSON.stringify(socialsDisplayWith(row, next, editContentRef.current));
|
|
14639
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_DISPLAY_KEY]: displayJson };
|
|
14640
|
+
postToParentRef.current({
|
|
14641
|
+
type: "ow:change",
|
|
14642
|
+
nodes: [{ key: SOCIALS_DISPLAY_KEY, text: displayJson }],
|
|
14643
|
+
flush: true
|
|
14644
|
+
});
|
|
14645
|
+
},
|
|
14646
|
+
[]
|
|
14647
|
+
);
|
|
14648
|
+
const closeFloatingPanelOnly = (0, import_react16.useCallback)(() => {
|
|
14649
|
+
setFloatingPanel(null);
|
|
14650
|
+
}, []);
|
|
14651
|
+
const closeFloatingPanelAndDeselect = (0, import_react16.useCallback)(() => {
|
|
14652
|
+
setFloatingPanel(null);
|
|
14653
|
+
deselectRef.current();
|
|
14654
|
+
}, []);
|
|
14655
|
+
const activate = (0, import_react16.useCallback)((el, options) => {
|
|
13722
14656
|
if (activeElRef.current === el) return;
|
|
14657
|
+
if (isIconEditable(el)) return;
|
|
14658
|
+
if (el.hasAttribute("data-ohw-social-label")) return;
|
|
13723
14659
|
clearSelectedAttr();
|
|
13724
14660
|
selectedElRef.current = null;
|
|
13725
14661
|
selectedHrefKeyRef.current = null;
|
|
13726
14662
|
selectedFooterColAttrRef.current = null;
|
|
13727
14663
|
setSelectedIsCta(false);
|
|
14664
|
+
setSelectedIsSocial(false);
|
|
14665
|
+
setSelectedIsSocialsRow(false);
|
|
13728
14666
|
deactivate();
|
|
13729
14667
|
if (hoveredImageRef.current) {
|
|
13730
14668
|
hoveredImageRef.current = null;
|
|
@@ -13795,7 +14733,7 @@ function OhhwellsBridge() {
|
|
|
13795
14733
|
selectRef.current = select;
|
|
13796
14734
|
selectFrameRef.current = selectFrame;
|
|
13797
14735
|
deselectRef.current = deselect;
|
|
13798
|
-
(0,
|
|
14736
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
13799
14737
|
if (!subdomain || isEditMode) {
|
|
13800
14738
|
setFetchState("done");
|
|
13801
14739
|
return;
|
|
@@ -13835,6 +14773,8 @@ function OhhwellsBridge() {
|
|
|
13835
14773
|
}
|
|
13836
14774
|
} else if (el.dataset.ohwEditable === "link") {
|
|
13837
14775
|
applyLinkHref(el, val);
|
|
14776
|
+
} else if (el.dataset.ohwEditable === "icon") {
|
|
14777
|
+
applyIconMarkup(el, val);
|
|
13838
14778
|
} else if (el.innerHTML !== val) {
|
|
13839
14779
|
el.innerHTML = val;
|
|
13840
14780
|
}
|
|
@@ -13843,8 +14783,11 @@ function OhhwellsBridge() {
|
|
|
13843
14783
|
}
|
|
13844
14784
|
reconcileNavbarItemsFromContent(content);
|
|
13845
14785
|
reconcileFooterOrderFromContent(content);
|
|
14786
|
+
reconcileSocialsFromContent(content);
|
|
14787
|
+
applySocialsDisplayFromContent(content);
|
|
13846
14788
|
enforceLinkHrefs();
|
|
13847
14789
|
initSectionsFromContent(content, true);
|
|
14790
|
+
initSectionInstancesFromContent(content, window.location.pathname);
|
|
13848
14791
|
sectionsLoadedRef.current = true;
|
|
13849
14792
|
pendingScheduleConfigRequests.current.splice(0).forEach(processConfigRequest);
|
|
13850
14793
|
return imageLoads.length > 0 ? Promise.all(imageLoads).then(() => {
|
|
@@ -13871,7 +14814,7 @@ function OhhwellsBridge() {
|
|
|
13871
14814
|
cancelled = true;
|
|
13872
14815
|
};
|
|
13873
14816
|
}, [subdomain, isEditMode]);
|
|
13874
|
-
(0,
|
|
14817
|
+
(0, import_react16.useEffect)(() => {
|
|
13875
14818
|
if (!subdomain || isEditMode) return;
|
|
13876
14819
|
let debounceTimer = null;
|
|
13877
14820
|
let observer = null;
|
|
@@ -13879,6 +14822,7 @@ function OhhwellsBridge() {
|
|
|
13879
14822
|
const content = contentCache.get(subdomain);
|
|
13880
14823
|
if (!content) return;
|
|
13881
14824
|
retryMissingSchedulingMounts(getPageSchedulingEntries(content["__ohw_sections"]), false);
|
|
14825
|
+
initSectionInstancesFromContent(content, window.location.pathname);
|
|
13882
14826
|
observer?.disconnect();
|
|
13883
14827
|
try {
|
|
13884
14828
|
for (const [key, val] of Object.entries(content)) {
|
|
@@ -13905,6 +14849,8 @@ function OhhwellsBridge() {
|
|
|
13905
14849
|
}
|
|
13906
14850
|
reconcileNavbarItemsFromContent(content);
|
|
13907
14851
|
reconcileFooterOrderFromContent(content);
|
|
14852
|
+
reconcileSocialsFromContent(content);
|
|
14853
|
+
applySocialsDisplayFromContent(content);
|
|
13908
14854
|
} finally {
|
|
13909
14855
|
observer?.observe(document.body, { childList: true, subtree: true });
|
|
13910
14856
|
}
|
|
@@ -13922,16 +14868,16 @@ function OhhwellsBridge() {
|
|
|
13922
14868
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
13923
14869
|
};
|
|
13924
14870
|
}, [subdomain, isEditMode, pathname]);
|
|
13925
|
-
(0,
|
|
14871
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
13926
14872
|
const el = document.getElementById("ohw-loader");
|
|
13927
14873
|
if (!el) return;
|
|
13928
14874
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
13929
14875
|
el.style.display = visible ? "flex" : "none";
|
|
13930
14876
|
}, [subdomain, fetchState]);
|
|
13931
|
-
(0,
|
|
14877
|
+
(0, import_react16.useEffect)(() => {
|
|
13932
14878
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
13933
14879
|
}, [pathname, postToParent2]);
|
|
13934
|
-
(0,
|
|
14880
|
+
(0, import_react16.useEffect)(() => {
|
|
13935
14881
|
if (!isEditMode) return;
|
|
13936
14882
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
13937
14883
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -13939,7 +14885,7 @@ function OhhwellsBridge() {
|
|
|
13939
14885
|
deselectRef.current();
|
|
13940
14886
|
deactivateRef.current();
|
|
13941
14887
|
}, [pathname, isEditMode]);
|
|
13942
|
-
(0,
|
|
14888
|
+
(0, import_react16.useEffect)(() => {
|
|
13943
14889
|
const contentForNav = () => {
|
|
13944
14890
|
if (isEditMode) return editContentRef.current;
|
|
13945
14891
|
if (!subdomain) return {};
|
|
@@ -13971,8 +14917,10 @@ function OhhwellsBridge() {
|
|
|
13971
14917
|
const content = contentForNav();
|
|
13972
14918
|
reconcileNavbarItemsFromContent(content);
|
|
13973
14919
|
reconcileFooterOrderFromContent(content);
|
|
14920
|
+
reconcileSocialsFromContent(content);
|
|
14921
|
+
applySocialsDisplayFromContent(content);
|
|
13974
14922
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
13975
|
-
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key"))) {
|
|
14923
|
+
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
|
|
13976
14924
|
disableNativeHrefDrag(el);
|
|
13977
14925
|
}
|
|
13978
14926
|
});
|
|
@@ -14004,7 +14952,7 @@ function OhhwellsBridge() {
|
|
|
14004
14952
|
observer?.disconnect();
|
|
14005
14953
|
};
|
|
14006
14954
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
14007
|
-
(0,
|
|
14955
|
+
(0, import_react16.useEffect)(() => {
|
|
14008
14956
|
if (!isEditMode) return;
|
|
14009
14957
|
const measure = () => {
|
|
14010
14958
|
const h = document.body.scrollHeight;
|
|
@@ -14028,7 +14976,7 @@ function OhhwellsBridge() {
|
|
|
14028
14976
|
window.removeEventListener("resize", handleResize);
|
|
14029
14977
|
};
|
|
14030
14978
|
}, [pathname, isEditMode, postToParent2]);
|
|
14031
|
-
(0,
|
|
14979
|
+
(0, import_react16.useEffect)(() => {
|
|
14032
14980
|
if (!subdomainFromQuery || isEditMode) return;
|
|
14033
14981
|
const handleClick = (e) => {
|
|
14034
14982
|
const anchor = e.target.closest("a");
|
|
@@ -14044,7 +14992,7 @@ function OhhwellsBridge() {
|
|
|
14044
14992
|
document.addEventListener("click", handleClick, true);
|
|
14045
14993
|
return () => document.removeEventListener("click", handleClick, true);
|
|
14046
14994
|
}, [subdomainFromQuery, isEditMode, router]);
|
|
14047
|
-
(0,
|
|
14995
|
+
(0, import_react16.useEffect)(() => {
|
|
14048
14996
|
if (!isEditMode) {
|
|
14049
14997
|
editStylesRef.current?.base.remove();
|
|
14050
14998
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -14252,21 +15200,37 @@ function OhhwellsBridge() {
|
|
|
14252
15200
|
});
|
|
14253
15201
|
return;
|
|
14254
15202
|
}
|
|
14255
|
-
if (
|
|
15203
|
+
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
15204
|
+
e.preventDefault();
|
|
15205
|
+
e.stopPropagation();
|
|
15206
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
15207
|
+
postToParentRef.current({
|
|
15208
|
+
type: "ow:icon-pick",
|
|
15209
|
+
key: editable.dataset.ohwKey ?? "",
|
|
15210
|
+
current: currentIconRef(editable)
|
|
15211
|
+
});
|
|
15212
|
+
return;
|
|
15213
|
+
}
|
|
15214
|
+
const clickedButton = findClosestButtonLike(target);
|
|
15215
|
+
const buttonOnMedia = Boolean(clickedButton && isMediaEditable(editable) && editable.contains(clickedButton));
|
|
15216
|
+
if (isMediaEditable(editable) && !buttonOnMedia) {
|
|
14256
15217
|
e.preventDefault();
|
|
14257
15218
|
e.stopPropagation();
|
|
14258
15219
|
aiSectionApiRef.current?.selectFromElement(editable);
|
|
14259
15220
|
postToParentRef.current({ type: "ow:image-pick", key: editable.dataset.ohwKey ?? "", elementType: editable.dataset.ohwEditable ?? "image" });
|
|
14260
15221
|
return;
|
|
14261
15222
|
}
|
|
14262
|
-
const
|
|
15223
|
+
const hrefLookupTarget = buttonOnMedia ? clickedButton : editable;
|
|
15224
|
+
const hrefCtx = getHrefKeyFromElement(hrefLookupTarget);
|
|
14263
15225
|
const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
|
|
14264
15226
|
if (navAnchor) {
|
|
14265
15227
|
e.preventDefault();
|
|
14266
15228
|
e.stopPropagation();
|
|
14267
15229
|
if (selectedElRef.current === navAnchor) {
|
|
14268
15230
|
if (e.detail >= 2) return;
|
|
14269
|
-
|
|
15231
|
+
if (requestSocialDialog(navAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
15232
|
+
const activateTarget = isButtonLikeElement(hrefLookupTarget) ? navAnchor.querySelector('[data-ohw-editable="text"]') ?? hrefLookupTarget : hrefLookupTarget;
|
|
15233
|
+
activateRef.current(activateTarget, { caretX: e.clientX, caretY: e.clientY });
|
|
14270
15234
|
return;
|
|
14271
15235
|
}
|
|
14272
15236
|
selectRef.current(navAnchor);
|
|
@@ -14274,7 +15238,7 @@ function OhhwellsBridge() {
|
|
|
14274
15238
|
}
|
|
14275
15239
|
e.preventDefault();
|
|
14276
15240
|
e.stopPropagation();
|
|
14277
|
-
activateRef.current(
|
|
15241
|
+
activateRef.current(hrefLookupTarget, { caretX: e.clientX, caretY: e.clientY });
|
|
14278
15242
|
return;
|
|
14279
15243
|
}
|
|
14280
15244
|
const hrefAnchor = getNavigationItemAnchor(target);
|
|
@@ -14282,6 +15246,7 @@ function OhhwellsBridge() {
|
|
|
14282
15246
|
e.preventDefault();
|
|
14283
15247
|
e.stopPropagation();
|
|
14284
15248
|
if (selectedElRef.current === hrefAnchor) {
|
|
15249
|
+
if (requestSocialDialog(hrefAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
14285
15250
|
const textEditable = hrefAnchor.querySelector('[data-ohw-editable="text"]') ?? hrefAnchor.querySelector("[data-ohw-editable]");
|
|
14286
15251
|
if (textEditable) {
|
|
14287
15252
|
activateRef.current(textEditable, {
|
|
@@ -14320,6 +15285,13 @@ function OhhwellsBridge() {
|
|
|
14320
15285
|
selectFrameRef.current(navContainerToSelect);
|
|
14321
15286
|
return;
|
|
14322
15287
|
}
|
|
15288
|
+
const socialsRowToSelect = isSocialsRow(target) ? target : null;
|
|
15289
|
+
if (socialsRowToSelect && !getSocialItem(target)) {
|
|
15290
|
+
e.preventDefault();
|
|
15291
|
+
e.stopPropagation();
|
|
15292
|
+
selectFrameRef.current(socialsRowToSelect);
|
|
15293
|
+
return;
|
|
15294
|
+
}
|
|
14323
15295
|
const footerColumnToSelect = resolveFooterColumnSelectionTarget(target, e.clientX, e.clientY);
|
|
14324
15296
|
if (footerColumnToSelect) {
|
|
14325
15297
|
e.preventDefault();
|
|
@@ -14371,6 +15343,7 @@ function OhhwellsBridge() {
|
|
|
14371
15343
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
14372
15344
|
return;
|
|
14373
15345
|
}
|
|
15346
|
+
if (getSocialItem(target)) return;
|
|
14374
15347
|
const navLabel = getNavigationLabelEditable(target);
|
|
14375
15348
|
const editable = navLabel?.editable ?? target.closest('[data-ohw-editable="text"], [data-ohw-editable="plain"]');
|
|
14376
15349
|
if (!editable || isMediaEditable(editable) || editable.dataset.ohwEditable === "link") return;
|
|
@@ -14455,6 +15428,11 @@ function OhhwellsBridge() {
|
|
|
14455
15428
|
const selected = selectedElRef.current;
|
|
14456
15429
|
if (selected && (selected === editable || selected.contains(editable))) return;
|
|
14457
15430
|
if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
|
|
15431
|
+
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
15432
|
+
hoveredItemElRef.current = editable;
|
|
15433
|
+
setHoveredItemRect(editable.getBoundingClientRect());
|
|
15434
|
+
return;
|
|
15435
|
+
}
|
|
14458
15436
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
14459
15437
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
14460
15438
|
clearHrefKeyHover(hoverTarget);
|
|
@@ -14502,6 +15480,13 @@ function OhhwellsBridge() {
|
|
|
14502
15480
|
const related = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
14503
15481
|
if (related?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
|
|
14504
15482
|
if (!isMediaEditable(editable)) {
|
|
15483
|
+
if (isIconEditable(editable) && !getSocialItem(editable) && hoveredItemElRef.current === editable) {
|
|
15484
|
+
if (!related?.closest("[data-ohw-item-interaction]")) {
|
|
15485
|
+
hoveredItemElRef.current = null;
|
|
15486
|
+
setHoveredItemRect(null);
|
|
15487
|
+
}
|
|
15488
|
+
return;
|
|
15489
|
+
}
|
|
14505
15490
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
14506
15491
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
14507
15492
|
if (!related?.closest("[data-ohw-href-key]")) {
|
|
@@ -14783,15 +15768,15 @@ function OhhwellsBridge() {
|
|
|
14783
15768
|
dismissImageHover();
|
|
14784
15769
|
return;
|
|
14785
15770
|
}
|
|
14786
|
-
const
|
|
14787
|
-
if (
|
|
15771
|
+
const buttonHit = isDragOver ? null : findButtonAtPoint(x2, y2, imgEl);
|
|
15772
|
+
if (buttonHit) {
|
|
14788
15773
|
dismissImageHover();
|
|
14789
15774
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
14790
15775
|
const selected = selectedElRef.current;
|
|
14791
|
-
if (selected !==
|
|
14792
|
-
clearHrefKeyHover(
|
|
14793
|
-
hoveredItemElRef.current =
|
|
14794
|
-
setHoveredItemRect(
|
|
15776
|
+
if (selected !== buttonHit && !selected?.contains(buttonHit)) {
|
|
15777
|
+
clearHrefKeyHover(buttonHit);
|
|
15778
|
+
hoveredItemElRef.current = buttonHit;
|
|
15779
|
+
setHoveredItemRect(buttonHit.getBoundingClientRect());
|
|
14795
15780
|
}
|
|
14796
15781
|
return;
|
|
14797
15782
|
}
|
|
@@ -15050,7 +16035,7 @@ function OhhwellsBridge() {
|
|
|
15050
16035
|
if (footerSession) {
|
|
15051
16036
|
e.preventDefault();
|
|
15052
16037
|
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
15053
|
-
const slot = footerSession.kind === "link" && footerSession.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, footerSession.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
16038
|
+
const slot = footerSession.kind === "social" && footerSession.hrefKey ? hitTestSocialDropSlot(e.clientX, e.clientY, footerSession.hrefKey) : footerSession.kind === "link" && footerSession.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, footerSession.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
15054
16039
|
refreshFooterDragVisualsRef.current(footerSession, slot, e.clientX, e.clientY);
|
|
15055
16040
|
return;
|
|
15056
16041
|
}
|
|
@@ -15102,6 +16087,62 @@ function OhhwellsBridge() {
|
|
|
15102
16087
|
resumeAnimTracks();
|
|
15103
16088
|
clearImageHover();
|
|
15104
16089
|
};
|
|
16090
|
+
const handleSocialCancel = (e) => {
|
|
16091
|
+
if (e.data?.type !== "ow:social-cancel") return;
|
|
16092
|
+
const { hrefKey } = e.data;
|
|
16093
|
+
const item = hrefKey ? findSocialByHrefKey(hrefKey) : null;
|
|
16094
|
+
if (!item) return;
|
|
16095
|
+
const removed = removeSocialItem(item, editContentRef.current);
|
|
16096
|
+
if (!removed) return;
|
|
16097
|
+
const orderJson = JSON.stringify(removed.order);
|
|
16098
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
16099
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
16100
|
+
deselectRef.current();
|
|
16101
|
+
};
|
|
16102
|
+
const handleSocialUpdate = (e) => {
|
|
16103
|
+
if (e.data?.type !== "ow:social-update") return;
|
|
16104
|
+
const updates = Array.isArray(e.data.items) ? e.data.items : [e.data];
|
|
16105
|
+
const nodes = [];
|
|
16106
|
+
for (const { hrefKey, iconKey, url, iconMarkup, platformId, label } of updates) {
|
|
16107
|
+
if (hrefKey) {
|
|
16108
|
+
document.querySelectorAll(`[data-ohw-href-key="${hrefKey}"]`).forEach((el) => applyLinkHref(el, url));
|
|
16109
|
+
nodes.push({ key: hrefKey, text: url });
|
|
16110
|
+
}
|
|
16111
|
+
if (iconKey && typeof iconMarkup === "string" && iconMarkup) {
|
|
16112
|
+
document.querySelectorAll(`[data-ohw-key="${iconKey}"][data-ohw-editable="icon"]`).forEach((el) => {
|
|
16113
|
+
applyIconMarkup(el, iconMarkup);
|
|
16114
|
+
});
|
|
16115
|
+
nodes.push({ key: iconKey, text: iconMarkup });
|
|
16116
|
+
}
|
|
16117
|
+
if (iconKey && platformId) nodes.push({ key: socialPlatformKey(iconKey), text: platformId });
|
|
16118
|
+
if (iconKey && label) {
|
|
16119
|
+
const labelKey = socialLabelKey(iconKey);
|
|
16120
|
+
document.querySelectorAll(`[data-ohw-key="${labelKey}"]`).forEach((el) => {
|
|
16121
|
+
el.textContent = label;
|
|
16122
|
+
});
|
|
16123
|
+
nodes.push({ key: labelKey, text: label });
|
|
16124
|
+
}
|
|
16125
|
+
}
|
|
16126
|
+
if (!nodes.length) return;
|
|
16127
|
+
editContentRef.current = {
|
|
16128
|
+
...editContentRef.current,
|
|
16129
|
+
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
16130
|
+
};
|
|
16131
|
+
postToParentRef.current({ type: "ow:change", nodes, flush: true });
|
|
16132
|
+
};
|
|
16133
|
+
const handleIconMarkup = (e) => {
|
|
16134
|
+
if (e.data?.type !== "ow:icon-markup") return;
|
|
16135
|
+
const { key, markup } = e.data;
|
|
16136
|
+
if (!key || typeof markup !== "string") return;
|
|
16137
|
+
const targets = document.querySelectorAll(
|
|
16138
|
+
`[data-ohw-key="${key}"][data-ohw-editable="icon"]`
|
|
16139
|
+
);
|
|
16140
|
+
if (!targets.length) return;
|
|
16141
|
+
targets.forEach((el) => {
|
|
16142
|
+
applyIconMarkup(el, markup);
|
|
16143
|
+
});
|
|
16144
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key, text: markup }], flush: true });
|
|
16145
|
+
};
|
|
15105
16146
|
const handleImageUrl = (e) => {
|
|
15106
16147
|
if (e.data?.type !== "ow:image-url") return;
|
|
15107
16148
|
const { key, url } = e.data;
|
|
@@ -15265,6 +16306,7 @@ function OhhwellsBridge() {
|
|
|
15265
16306
|
sectionsLoadedRef.current = true;
|
|
15266
16307
|
pendingScheduleConfigRequests.current.splice(0).forEach(processConfigRequest);
|
|
15267
16308
|
}
|
|
16309
|
+
initSectionInstancesFromContent(content, window.location.pathname);
|
|
15268
16310
|
editContentRef.current = { ...editContentRef.current, ...content };
|
|
15269
16311
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
15270
16312
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
@@ -15528,7 +16570,7 @@ function OhhwellsBridge() {
|
|
|
15528
16570
|
}
|
|
15529
16571
|
if (footerDragRef.current) {
|
|
15530
16572
|
const session = footerDragRef.current;
|
|
15531
|
-
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
16573
|
+
const slot = session.kind === "social" && session.hrefKey ? hitTestSocialDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
15532
16574
|
refreshFooterDragVisualsRef.current(session, slot, session.lastClientX, session.lastClientY);
|
|
15533
16575
|
}
|
|
15534
16576
|
if (navDragRef.current) {
|
|
@@ -15848,6 +16890,9 @@ function OhhwellsBridge() {
|
|
|
15848
16890
|
window.addEventListener("message", handleClearSchedulingWidget);
|
|
15849
16891
|
window.addEventListener("message", handleRemoveSchedulingSection);
|
|
15850
16892
|
window.addEventListener("message", handleCollectSection);
|
|
16893
|
+
window.addEventListener("message", handleSocialCancel);
|
|
16894
|
+
window.addEventListener("message", handleSocialUpdate);
|
|
16895
|
+
window.addEventListener("message", handleIconMarkup);
|
|
15851
16896
|
window.addEventListener("message", handleImageUrl);
|
|
15852
16897
|
window.addEventListener("message", handleImageUploading);
|
|
15853
16898
|
window.addEventListener("message", handleCarouselChange);
|
|
@@ -15899,6 +16944,9 @@ function OhhwellsBridge() {
|
|
|
15899
16944
|
window.removeEventListener("message", handleClearSchedulingWidget);
|
|
15900
16945
|
window.removeEventListener("message", handleRemoveSchedulingSection);
|
|
15901
16946
|
window.removeEventListener("message", handleCollectSection);
|
|
16947
|
+
window.removeEventListener("message", handleSocialCancel);
|
|
16948
|
+
window.removeEventListener("message", handleSocialUpdate);
|
|
16949
|
+
window.removeEventListener("message", handleIconMarkup);
|
|
15902
16950
|
window.removeEventListener("message", handleImageUrl);
|
|
15903
16951
|
window.removeEventListener("message", handleImageUploading);
|
|
15904
16952
|
window.removeEventListener("message", handleCarouselChange);
|
|
@@ -15920,7 +16968,7 @@ function OhhwellsBridge() {
|
|
|
15920
16968
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
15921
16969
|
};
|
|
15922
16970
|
}, [isEditMode, refreshStateRules]);
|
|
15923
|
-
(0,
|
|
16971
|
+
(0, import_react16.useEffect)(() => {
|
|
15924
16972
|
if (!isEditMode) return;
|
|
15925
16973
|
const THRESHOLD = 10;
|
|
15926
16974
|
const resolveWasSelected = (el) => {
|
|
@@ -15940,9 +16988,9 @@ function OhhwellsBridge() {
|
|
|
15940
16988
|
return;
|
|
15941
16989
|
}
|
|
15942
16990
|
if (target.closest("[data-ohw-item-drag-surface]")) return;
|
|
15943
|
-
const anchor = getNavigationItemAnchor(target);
|
|
16991
|
+
const anchor = getNavigationItemAnchor(target) ?? (document.elementsFromPoint(e.clientX, e.clientY).map((el) => el instanceof HTMLElement ? getNavigationItemAnchor(el) : null).find((found) => found !== null) ?? null);
|
|
15944
16992
|
const hrefKey = anchor?.getAttribute("data-ohw-href-key") ?? null;
|
|
15945
|
-
if (anchor && isFooterHrefKey(hrefKey)) {
|
|
16993
|
+
if (anchor && (isFooterHrefKey(hrefKey) || getSocialItem(anchor))) {
|
|
15946
16994
|
footerPointerDragRef.current = {
|
|
15947
16995
|
el: anchor,
|
|
15948
16996
|
kind: "link",
|
|
@@ -15975,7 +17023,7 @@ function OhhwellsBridge() {
|
|
|
15975
17023
|
clearTextSelection();
|
|
15976
17024
|
const session = footerDragRef.current;
|
|
15977
17025
|
if (!session) return;
|
|
15978
|
-
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, session.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
17026
|
+
const slot = session.kind === "social" && session.hrefKey ? hitTestSocialDropSlot(e.clientX, e.clientY, session.hrefKey) : session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, session.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
15979
17027
|
refreshFooterDragVisualsRef.current(session, slot, e.clientX, e.clientY);
|
|
15980
17028
|
return;
|
|
15981
17029
|
}
|
|
@@ -16002,7 +17050,7 @@ function OhhwellsBridge() {
|
|
|
16002
17050
|
const column = findFooterColumnForLink(pending.el);
|
|
16003
17051
|
const columns2 = listFooterColumns();
|
|
16004
17052
|
beginFooterDragRef.current({
|
|
16005
|
-
kind: "link",
|
|
17053
|
+
kind: getSocialItem(pending.el) ? "social" : "link",
|
|
16006
17054
|
hrefKey: key,
|
|
16007
17055
|
columnEl: column,
|
|
16008
17056
|
sourceColumnIndex: column ? columns2.indexOf(column) : 0,
|
|
@@ -16074,7 +17122,7 @@ function OhhwellsBridge() {
|
|
|
16074
17122
|
unlockFooterDragInteraction();
|
|
16075
17123
|
};
|
|
16076
17124
|
}, [isEditMode]);
|
|
16077
|
-
(0,
|
|
17125
|
+
(0, import_react16.useEffect)(() => {
|
|
16078
17126
|
const handler = (e) => {
|
|
16079
17127
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
16080
17128
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -16090,7 +17138,7 @@ function OhhwellsBridge() {
|
|
|
16090
17138
|
window.addEventListener("message", handler);
|
|
16091
17139
|
return () => window.removeEventListener("message", handler);
|
|
16092
17140
|
}, [processConfigRequest]);
|
|
16093
|
-
(0,
|
|
17141
|
+
(0, import_react16.useEffect)(() => {
|
|
16094
17142
|
if (!isEditMode) return;
|
|
16095
17143
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
16096
17144
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -16114,7 +17162,7 @@ function OhhwellsBridge() {
|
|
|
16114
17162
|
postToParent2({
|
|
16115
17163
|
type: "ow:ready",
|
|
16116
17164
|
version: "1",
|
|
16117
|
-
bridgeVersion: "0.1.
|
|
17165
|
+
bridgeVersion: "0.1.56",
|
|
16118
17166
|
path: pathname,
|
|
16119
17167
|
nodes: collectEditableNodes(editContentRef.current),
|
|
16120
17168
|
sections
|
|
@@ -16126,13 +17174,13 @@ function OhhwellsBridge() {
|
|
|
16126
17174
|
clearTimeout(timer);
|
|
16127
17175
|
};
|
|
16128
17176
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
16129
|
-
(0,
|
|
17177
|
+
(0, import_react16.useEffect)(() => {
|
|
16130
17178
|
scrollToHashSectionWhenReady();
|
|
16131
17179
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
16132
17180
|
window.addEventListener("hashchange", onHashChange);
|
|
16133
17181
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
16134
17182
|
}, [pathname]);
|
|
16135
|
-
const handleCommand = (0,
|
|
17183
|
+
const handleCommand = (0, import_react16.useCallback)((cmd) => {
|
|
16136
17184
|
const el = activeElRef.current;
|
|
16137
17185
|
const selBefore = window.getSelection();
|
|
16138
17186
|
let savedOffsets = null;
|
|
@@ -16168,7 +17216,7 @@ function OhhwellsBridge() {
|
|
|
16168
17216
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
16169
17217
|
refreshActiveCommandsRef.current();
|
|
16170
17218
|
}, []);
|
|
16171
|
-
const handleStateChange = (0,
|
|
17219
|
+
const handleStateChange = (0, import_react16.useCallback)((state) => {
|
|
16172
17220
|
if (!activeStateElRef.current) return;
|
|
16173
17221
|
const el = activeStateElRef.current;
|
|
16174
17222
|
if (state === "Default") {
|
|
@@ -16181,7 +17229,7 @@ function OhhwellsBridge() {
|
|
|
16181
17229
|
}
|
|
16182
17230
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
16183
17231
|
}, [deactivate]);
|
|
16184
|
-
const reselectAfterLinkPopover = (0,
|
|
17232
|
+
const reselectAfterLinkPopover = (0, import_react16.useCallback)(
|
|
16185
17233
|
(hrefKey) => {
|
|
16186
17234
|
requestAnimationFrame(() => {
|
|
16187
17235
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -16190,7 +17238,7 @@ function OhhwellsBridge() {
|
|
|
16190
17238
|
},
|
|
16191
17239
|
[resolveHrefKeyElement]
|
|
16192
17240
|
);
|
|
16193
|
-
const closeLinkPopover = (0,
|
|
17241
|
+
const closeLinkPopover = (0, import_react16.useCallback)(() => {
|
|
16194
17242
|
const session = linkPopoverSessionRef.current;
|
|
16195
17243
|
addNavAfterAnchorRef.current = null;
|
|
16196
17244
|
setLinkPopover(null);
|
|
@@ -16198,9 +17246,9 @@ function OhhwellsBridge() {
|
|
|
16198
17246
|
reselectAfterLinkPopover(session.key);
|
|
16199
17247
|
}
|
|
16200
17248
|
}, [reselectAfterLinkPopover]);
|
|
16201
|
-
const closeLinkPopoverRef = (0,
|
|
17249
|
+
const closeLinkPopoverRef = (0, import_react16.useRef)(closeLinkPopover);
|
|
16202
17250
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
16203
|
-
const openLinkPopoverForActive = (0,
|
|
17251
|
+
const openLinkPopoverForActive = (0, import_react16.useCallback)(() => {
|
|
16204
17252
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
16205
17253
|
if (!hrefCtx) return;
|
|
16206
17254
|
bumpLinkPopoverGrace();
|
|
@@ -16211,11 +17259,15 @@ function OhhwellsBridge() {
|
|
|
16211
17259
|
});
|
|
16212
17260
|
deactivate();
|
|
16213
17261
|
}, [deactivate]);
|
|
16214
|
-
const openLinkPopoverForSelected = (0,
|
|
17262
|
+
const openLinkPopoverForSelected = (0, import_react16.useCallback)(() => {
|
|
16215
17263
|
const anchor = selectedElRef.current;
|
|
16216
17264
|
if (!anchor) return;
|
|
16217
17265
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
16218
17266
|
if (!key) return;
|
|
17267
|
+
if (requestSocialDialog(anchor, postToParentRef.current, editContentRef.current)) {
|
|
17268
|
+
deselect();
|
|
17269
|
+
return;
|
|
17270
|
+
}
|
|
16219
17271
|
bumpLinkPopoverGrace();
|
|
16220
17272
|
setLinkPopover({
|
|
16221
17273
|
key,
|
|
@@ -16224,7 +17276,7 @@ function OhhwellsBridge() {
|
|
|
16224
17276
|
});
|
|
16225
17277
|
deselect();
|
|
16226
17278
|
}, [deselect]);
|
|
16227
|
-
const handleSelectParent = (0,
|
|
17279
|
+
const handleSelectParent = (0, import_react16.useCallback)(() => {
|
|
16228
17280
|
const selected = selectedElRef.current;
|
|
16229
17281
|
if (!selected) return;
|
|
16230
17282
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -16251,11 +17303,37 @@ function OhhwellsBridge() {
|
|
|
16251
17303
|
}
|
|
16252
17304
|
deselectRef.current();
|
|
16253
17305
|
}, []);
|
|
16254
|
-
const handleDuplicateSelected = (0,
|
|
17306
|
+
const handleDuplicateSelected = (0, import_react16.useCallback)(() => {
|
|
16255
17307
|
const selected = selectedElRef.current;
|
|
16256
17308
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
16257
17309
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
16258
17310
|
if (!hrefKey) return;
|
|
17311
|
+
const social = getSocialItem(selected);
|
|
17312
|
+
if (social) {
|
|
17313
|
+
const result = duplicateSocialItem(social, editContentRef.current);
|
|
17314
|
+
if (!result) return;
|
|
17315
|
+
const orderJson = JSON.stringify(result.order);
|
|
17316
|
+
const carried = [
|
|
17317
|
+
{ from: result.copiedFrom?.href, to: result.hrefKey },
|
|
17318
|
+
{ from: result.copiedFrom?.icon, to: result.iconKey },
|
|
17319
|
+
{ from: result.copiedFrom?.icon ? socialPlatformKey(result.copiedFrom.icon) : null, to: socialPlatformKey(result.iconKey) }
|
|
17320
|
+
];
|
|
17321
|
+
const nodes = [{ key: SOCIALS_ORDER_KEY, text: orderJson }];
|
|
17322
|
+
for (const { from, to } of carried) {
|
|
17323
|
+
const value = from ? editContentRef.current[from] : void 0;
|
|
17324
|
+
if (value) nodes.push({ key: to, text: value });
|
|
17325
|
+
}
|
|
17326
|
+
editContentRef.current = {
|
|
17327
|
+
...editContentRef.current,
|
|
17328
|
+
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
17329
|
+
};
|
|
17330
|
+
postToParent2({ type: "ow:change", nodes });
|
|
17331
|
+
enforceLinkHrefs();
|
|
17332
|
+
const copyRow = findSocialsRow(result.item);
|
|
17333
|
+
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
17334
|
+
requestAnimationFrame(() => selectRef.current(result.item));
|
|
17335
|
+
return;
|
|
17336
|
+
}
|
|
16259
17337
|
if (isNavbarHrefKey(hrefKey)) {
|
|
16260
17338
|
const result = duplicateNavbarItem(selected);
|
|
16261
17339
|
if (!result) return;
|
|
@@ -16341,7 +17419,7 @@ function OhhwellsBridge() {
|
|
|
16341
17419
|
});
|
|
16342
17420
|
}
|
|
16343
17421
|
}, [postToParent2]);
|
|
16344
|
-
const runPendingDeleteUndo = (0,
|
|
17422
|
+
const runPendingDeleteUndo = (0, import_react16.useCallback)(() => {
|
|
16345
17423
|
const pending = pendingDeleteUndoRef.current;
|
|
16346
17424
|
if (!pending) return false;
|
|
16347
17425
|
pendingDeleteUndoRef.current = null;
|
|
@@ -16349,7 +17427,7 @@ function OhhwellsBridge() {
|
|
|
16349
17427
|
enforceLinkHrefs();
|
|
16350
17428
|
return true;
|
|
16351
17429
|
}, []);
|
|
16352
|
-
const handleDeleteSelected = (0,
|
|
17430
|
+
const handleDeleteSelected = (0, import_react16.useCallback)(() => {
|
|
16353
17431
|
const selected = selectedElRef.current;
|
|
16354
17432
|
if (!selected) return false;
|
|
16355
17433
|
return deleteSelectedNavFooterItem({
|
|
@@ -16370,7 +17448,7 @@ function OhhwellsBridge() {
|
|
|
16370
17448
|
}, [postToParent2]);
|
|
16371
17449
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
16372
17450
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
16373
|
-
const handleLinkPopoverSubmit = (0,
|
|
17451
|
+
const handleLinkPopoverSubmit = (0, import_react16.useCallback)(
|
|
16374
17452
|
(target) => {
|
|
16375
17453
|
const session = linkPopoverSessionRef.current;
|
|
16376
17454
|
if (!session) return;
|
|
@@ -16436,19 +17514,19 @@ function OhhwellsBridge() {
|
|
|
16436
17514
|
const showEditLink = toolbarShowEditLink;
|
|
16437
17515
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
16438
17516
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
16439
|
-
const handleMediaReplace = (0,
|
|
17517
|
+
const handleMediaReplace = (0, import_react16.useCallback)(
|
|
16440
17518
|
(key) => {
|
|
16441
17519
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
16442
17520
|
},
|
|
16443
17521
|
[postToParent2, mediaHover?.elementType]
|
|
16444
17522
|
);
|
|
16445
|
-
const handleEditCarousel = (0,
|
|
17523
|
+
const handleEditCarousel = (0, import_react16.useCallback)(
|
|
16446
17524
|
(key) => {
|
|
16447
17525
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
16448
17526
|
},
|
|
16449
17527
|
[postToParent2]
|
|
16450
17528
|
);
|
|
16451
|
-
const handleMediaFadeOutComplete = (0,
|
|
17529
|
+
const handleMediaFadeOutComplete = (0, import_react16.useCallback)((key) => {
|
|
16452
17530
|
setUploadingRects((prev) => {
|
|
16453
17531
|
if (!(key in prev)) return prev;
|
|
16454
17532
|
const next = { ...prev };
|
|
@@ -16456,7 +17534,7 @@ function OhhwellsBridge() {
|
|
|
16456
17534
|
return next;
|
|
16457
17535
|
});
|
|
16458
17536
|
}, []);
|
|
16459
|
-
const handleVideoSettingsChange = (0,
|
|
17537
|
+
const handleVideoSettingsChange = (0, import_react16.useCallback)(
|
|
16460
17538
|
(key, settings) => {
|
|
16461
17539
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
16462
17540
|
const video = getVideoEl2(el);
|
|
@@ -16479,10 +17557,10 @@ function OhhwellsBridge() {
|
|
|
16479
17557
|
[postToParent2]
|
|
16480
17558
|
);
|
|
16481
17559
|
return bridgeRoot ? (0, import_react_dom4.createPortal)(
|
|
16482
|
-
/* @__PURE__ */ (0,
|
|
16483
|
-
/* @__PURE__ */ (0,
|
|
16484
|
-
isEditMode && /* @__PURE__ */ (0,
|
|
16485
|
-
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0,
|
|
17560
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
17561
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
17562
|
+
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AiSectionOverlay, { postToParent: postToParent2, apiRef: aiSectionApiRef }),
|
|
17563
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16486
17564
|
MediaOverlay,
|
|
16487
17565
|
{
|
|
16488
17566
|
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
@@ -16493,7 +17571,7 @@ function OhhwellsBridge() {
|
|
|
16493
17571
|
},
|
|
16494
17572
|
`uploading-${key}`
|
|
16495
17573
|
)),
|
|
16496
|
-
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0,
|
|
17574
|
+
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16497
17575
|
MediaOverlay,
|
|
16498
17576
|
{
|
|
16499
17577
|
hover: mediaHover,
|
|
@@ -16502,11 +17580,11 @@ function OhhwellsBridge() {
|
|
|
16502
17580
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
16503
17581
|
}
|
|
16504
17582
|
),
|
|
16505
|
-
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0,
|
|
16506
|
-
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0,
|
|
16507
|
-
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0,
|
|
16508
|
-
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0,
|
|
16509
|
-
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0,
|
|
17583
|
+
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
|
|
17584
|
+
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
17585
|
+
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
|
|
17586
|
+
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
|
|
17587
|
+
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16510
17588
|
"div",
|
|
16511
17589
|
{
|
|
16512
17590
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -16516,7 +17594,7 @@ function OhhwellsBridge() {
|
|
|
16516
17594
|
width: slot.width,
|
|
16517
17595
|
height: slot.height
|
|
16518
17596
|
},
|
|
16519
|
-
children: /* @__PURE__ */ (0,
|
|
17597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16520
17598
|
DropIndicator,
|
|
16521
17599
|
{
|
|
16522
17600
|
direction: slot.direction,
|
|
@@ -16527,7 +17605,7 @@ function OhhwellsBridge() {
|
|
|
16527
17605
|
},
|
|
16528
17606
|
`footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
|
|
16529
17607
|
)),
|
|
16530
|
-
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0,
|
|
17608
|
+
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16531
17609
|
"div",
|
|
16532
17610
|
{
|
|
16533
17611
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -16537,7 +17615,7 @@ function OhhwellsBridge() {
|
|
|
16537
17615
|
width: slot.width,
|
|
16538
17616
|
height: slot.height
|
|
16539
17617
|
},
|
|
16540
|
-
children: /* @__PURE__ */ (0,
|
|
17618
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16541
17619
|
DropIndicator,
|
|
16542
17620
|
{
|
|
16543
17621
|
direction: slot.direction,
|
|
@@ -16548,10 +17626,10 @@ function OhhwellsBridge() {
|
|
|
16548
17626
|
},
|
|
16549
17627
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
16550
17628
|
)),
|
|
16551
|
-
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0,
|
|
16552
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0,
|
|
16553
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0,
|
|
16554
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0,
|
|
17629
|
+
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
17630
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
17631
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
17632
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16555
17633
|
FooterContainerChrome,
|
|
16556
17634
|
{
|
|
16557
17635
|
rect: toolbarRect,
|
|
@@ -16559,7 +17637,7 @@ function OhhwellsBridge() {
|
|
|
16559
17637
|
addDisabled: !canAddFooterColumn()
|
|
16560
17638
|
}
|
|
16561
17639
|
),
|
|
16562
|
-
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0,
|
|
17640
|
+
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16563
17641
|
ItemInteractionLayer,
|
|
16564
17642
|
{
|
|
16565
17643
|
rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
|
|
@@ -16574,10 +17652,18 @@ function OhhwellsBridge() {
|
|
|
16574
17652
|
onItemPointerDown: handleItemChromePointerDown,
|
|
16575
17653
|
onItemClick: handleItemChromeClick,
|
|
16576
17654
|
itemDragSurface: !isFooterFrameSelection,
|
|
16577
|
-
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && isFooterFrameSelection && !isItemDragging ? /* @__PURE__ */ (0,
|
|
17655
|
+
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && (isFooterFrameSelection || selectedIsSocialsRow) && !isItemDragging ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16578
17656
|
ItemActionToolbar,
|
|
16579
17657
|
{
|
|
16580
17658
|
onEditLink: openLinkPopoverForSelected,
|
|
17659
|
+
onStyle: () => {
|
|
17660
|
+
const row = selectedElRef.current;
|
|
17661
|
+
if (!row) return;
|
|
17662
|
+
if (floatingPanel?.kind === "socials-display") closeFloatingPanelOnly();
|
|
17663
|
+
else openSocialsDisplayPanel(row);
|
|
17664
|
+
},
|
|
17665
|
+
showStyle: selectedIsSocialsRow,
|
|
17666
|
+
styleActive: floatingPanel?.kind === "socials-display",
|
|
16581
17667
|
onAddItem: handleAddChildItem,
|
|
16582
17668
|
onSelectParent: handleSelectParent,
|
|
16583
17669
|
onDuplicate: handleDuplicateSelected,
|
|
@@ -16585,12 +17671,12 @@ function OhhwellsBridge() {
|
|
|
16585
17671
|
addItemDisabled: false,
|
|
16586
17672
|
editLinkDisabled: false,
|
|
16587
17673
|
moreDisabled: false,
|
|
16588
|
-
duplicateDisabled: isFooterFrameSelection,
|
|
16589
|
-
showEditLink: !isFooterFrameSelection && navDropdownPreviewOpen === null,
|
|
16590
|
-
showAddItem: isFooterFrameSelection || !selectedIsCta && Boolean(
|
|
17674
|
+
duplicateDisabled: isFooterFrameSelection || selectedIsSocialsRow,
|
|
17675
|
+
showEditLink: !isFooterFrameSelection && !selectedIsSocialsRow && navDropdownPreviewOpen === null,
|
|
17676
|
+
showAddItem: isFooterFrameSelection || selectedIsSocialsRow || !selectedIsCta && Boolean(
|
|
16591
17677
|
selectedElRef.current && isNavbarHrefKey(selectedElRef.current.getAttribute("data-ohw-href-key")) && !isNestedNavChild(selectedElRef.current)
|
|
16592
17678
|
),
|
|
16593
|
-
showMore: !selectedIsCta || isFooterFrameSelection,
|
|
17679
|
+
showMore: (!selectedIsCta || isFooterFrameSelection) && !selectedIsSocialsRow,
|
|
16594
17680
|
dropdownOpen: navDropdownPreviewOpen,
|
|
16595
17681
|
onDropdownOpenChange: handleNavDropdownOpenChange,
|
|
16596
17682
|
headingVisible: footerHeadingVisible,
|
|
@@ -16599,8 +17685,8 @@ function OhhwellsBridge() {
|
|
|
16599
17685
|
) : void 0
|
|
16600
17686
|
}
|
|
16601
17687
|
),
|
|
16602
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0,
|
|
16603
|
-
/* @__PURE__ */ (0,
|
|
17688
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
17689
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16604
17690
|
EditGlowChrome,
|
|
16605
17691
|
{
|
|
16606
17692
|
rect: toolbarRect,
|
|
@@ -16610,7 +17696,7 @@ function OhhwellsBridge() {
|
|
|
16610
17696
|
hideHandle: isItemDragging
|
|
16611
17697
|
}
|
|
16612
17698
|
),
|
|
16613
|
-
/* @__PURE__ */ (0,
|
|
17699
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16614
17700
|
FloatingToolbar,
|
|
16615
17701
|
{
|
|
16616
17702
|
rect: toolbarRect,
|
|
@@ -16623,7 +17709,7 @@ function OhhwellsBridge() {
|
|
|
16623
17709
|
}
|
|
16624
17710
|
)
|
|
16625
17711
|
] }),
|
|
16626
|
-
maxBadge && /* @__PURE__ */ (0,
|
|
17712
|
+
maxBadge && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
16627
17713
|
"div",
|
|
16628
17714
|
{
|
|
16629
17715
|
"data-ohw-max-badge": "",
|
|
@@ -16649,7 +17735,7 @@ function OhhwellsBridge() {
|
|
|
16649
17735
|
]
|
|
16650
17736
|
}
|
|
16651
17737
|
),
|
|
16652
|
-
toggleState && !linkPopover && /* @__PURE__ */ (0,
|
|
17738
|
+
toggleState && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16653
17739
|
StateToggle,
|
|
16654
17740
|
{
|
|
16655
17741
|
rect: toggleState.rect,
|
|
@@ -16658,15 +17744,15 @@ function OhhwellsBridge() {
|
|
|
16658
17744
|
onStateChange: handleStateChange
|
|
16659
17745
|
}
|
|
16660
17746
|
),
|
|
16661
|
-
sectionGap && !linkPopover && /* @__PURE__ */ (0,
|
|
17747
|
+
sectionGap && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
16662
17748
|
"div",
|
|
16663
17749
|
{
|
|
16664
17750
|
"data-ohw-section-insert-line": "",
|
|
16665
17751
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
16666
17752
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
16667
17753
|
children: [
|
|
16668
|
-
/* @__PURE__ */ (0,
|
|
16669
|
-
/* @__PURE__ */ (0,
|
|
17754
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
17755
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16670
17756
|
Badge,
|
|
16671
17757
|
{
|
|
16672
17758
|
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",
|
|
@@ -16683,11 +17769,11 @@ function OhhwellsBridge() {
|
|
|
16683
17769
|
children: "Add Section"
|
|
16684
17770
|
}
|
|
16685
17771
|
),
|
|
16686
|
-
/* @__PURE__ */ (0,
|
|
17772
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
16687
17773
|
]
|
|
16688
17774
|
}
|
|
16689
17775
|
),
|
|
16690
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0,
|
|
17776
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
16691
17777
|
LinkPopover,
|
|
16692
17778
|
{
|
|
16693
17779
|
panelRef: linkPopoverPanelRef,
|
|
@@ -16703,6 +17789,28 @@ function OhhwellsBridge() {
|
|
|
16703
17789
|
onSubmit: handleLinkPopoverSubmit
|
|
16704
17790
|
},
|
|
16705
17791
|
linkPopover.key
|
|
17792
|
+
) : null,
|
|
17793
|
+
floatingPanel && floatingPanel.kind === "socials-display" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
17794
|
+
FloatingPanel,
|
|
17795
|
+
{
|
|
17796
|
+
open: true,
|
|
17797
|
+
title: floatingPanel.title,
|
|
17798
|
+
context: floatingPanel.context,
|
|
17799
|
+
position: floatingPanelPos,
|
|
17800
|
+
onPositionChange: setFloatingPanelPos,
|
|
17801
|
+
parentScroll: parentScrollSnap ?? parentScrollRef.current,
|
|
17802
|
+
onClose: closeFloatingPanelOnly,
|
|
17803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
17804
|
+
SocialsDisplayPanel,
|
|
17805
|
+
{
|
|
17806
|
+
display: socialsDisplayFor(floatingPanel.row, editContentRef.current),
|
|
17807
|
+
onChange: (next) => {
|
|
17808
|
+
changeSocialsDisplay(floatingPanel.row, next);
|
|
17809
|
+
setFloatingPanel({ ...floatingPanel });
|
|
17810
|
+
}
|
|
17811
|
+
}
|
|
17812
|
+
)
|
|
17813
|
+
}
|
|
16706
17814
|
) : null
|
|
16707
17815
|
] }),
|
|
16708
17816
|
bridgeRoot
|