@ohhwells/bridge 0.1.55 → 0.1.56
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 +1316 -263
- 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 +1316 -257
- package/dist/index.js.map +1 -1
- package/dist/styles.css +50 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React11, { useCallback as
|
|
4
|
+
import React11, { useCallback as useCallback7, useEffect as useEffect12, useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState11 } from "react";
|
|
5
5
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync2 } from "react-dom";
|
|
7
7
|
|
|
@@ -162,13 +162,17 @@ function MediaBox({
|
|
|
162
162
|
const url = refValue ? ctx.resolveMedia(refValue) : null;
|
|
163
163
|
const isIcon = /^(lucide|simple):/.test(refValue);
|
|
164
164
|
const aspectRatio = aspect && /^\d+:\d+$/.test(aspect) ? aspect.replace(":", " / ") : void 0;
|
|
165
|
-
const editAttrs = ctx.keyFor && editPath
|
|
165
|
+
const editAttrs = ctx.keyFor && editPath ? {
|
|
166
|
+
"data-ohw-key": ctx.keyFor(editPath),
|
|
167
|
+
"data-ohw-editable": isIcon ? "icon" : "image"
|
|
168
|
+
} : {};
|
|
166
169
|
if (isIcon) {
|
|
167
170
|
const Icon = refValue.startsWith("lucide:") ? lucideByName(refValue.slice(7)) : null;
|
|
168
171
|
return /* @__PURE__ */ jsx(
|
|
169
172
|
"span",
|
|
170
173
|
{
|
|
171
174
|
"data-ai-icon": refValue,
|
|
175
|
+
...editAttrs,
|
|
172
176
|
style: {
|
|
173
177
|
display: "inline-flex",
|
|
174
178
|
width: 48,
|
|
@@ -5697,7 +5701,7 @@ CustomToolbarButton.displayName = "CustomToolbarButton";
|
|
|
5697
5701
|
|
|
5698
5702
|
// src/ui/item-action-toolbar.tsx
|
|
5699
5703
|
import { useState as useState3 } from "react";
|
|
5700
|
-
import { Copy, CornerLeftUp, Heading, Link, MoreHorizontal, Plus, Trash2 } from "lucide-react";
|
|
5704
|
+
import { Brush, Copy, CornerLeftUp, Heading, Link, MoreHorizontal, Plus, Trash2 } from "lucide-react";
|
|
5701
5705
|
|
|
5702
5706
|
// src/ui/dropdown-menu.tsx
|
|
5703
5707
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
@@ -5862,6 +5866,7 @@ function ToolbarActionTooltip({
|
|
|
5862
5866
|
function ItemActionToolbar({
|
|
5863
5867
|
onEditLink,
|
|
5864
5868
|
onAddItem,
|
|
5869
|
+
onStyle,
|
|
5865
5870
|
onSelectParent,
|
|
5866
5871
|
onDuplicate,
|
|
5867
5872
|
onDelete,
|
|
@@ -5873,6 +5878,8 @@ function ItemActionToolbar({
|
|
|
5873
5878
|
deleteDisabled = false,
|
|
5874
5879
|
showEditLink = true,
|
|
5875
5880
|
showAddItem = true,
|
|
5881
|
+
showStyle = false,
|
|
5882
|
+
styleActive = false,
|
|
5876
5883
|
showMore = true,
|
|
5877
5884
|
tooltipSide = "bottom",
|
|
5878
5885
|
dropdownOpen = null,
|
|
@@ -5946,6 +5953,22 @@ function ItemActionToolbar({
|
|
|
5946
5953
|
children: /* @__PURE__ */ jsx11(Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
5947
5954
|
}
|
|
5948
5955
|
) : null,
|
|
5956
|
+
showStyle ? /* @__PURE__ */ jsx11(
|
|
5957
|
+
ToolbarActionTooltip,
|
|
5958
|
+
{
|
|
5959
|
+
label: "Style",
|
|
5960
|
+
side: tooltipSide,
|
|
5961
|
+
buttonProps: {
|
|
5962
|
+
active: styleActive,
|
|
5963
|
+
onMouseDown: (e) => {
|
|
5964
|
+
e.preventDefault();
|
|
5965
|
+
e.stopPropagation();
|
|
5966
|
+
onStyle?.();
|
|
5967
|
+
}
|
|
5968
|
+
},
|
|
5969
|
+
children: /* @__PURE__ */ jsx11(Brush, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
5970
|
+
}
|
|
5971
|
+
) : null,
|
|
5949
5972
|
showAddItem ? /* @__PURE__ */ jsx11(
|
|
5950
5973
|
ToolbarActionTooltip,
|
|
5951
5974
|
{
|
|
@@ -9452,6 +9475,449 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
9452
9475
|
};
|
|
9453
9476
|
}
|
|
9454
9477
|
|
|
9478
|
+
// src/lib/icon-markup.ts
|
|
9479
|
+
var GLYPH_SELECTOR = "svg, img";
|
|
9480
|
+
function referenceBox(slot) {
|
|
9481
|
+
const row = slot.closest("[data-ohw-socials-row]") ?? slot.closest("a")?.parentElement ?? null;
|
|
9482
|
+
const neighbour = row ? Array.from(row.querySelectorAll('[data-ohw-editable="icon"]')).find((el) => el !== slot) : null;
|
|
9483
|
+
const source = (neighbour ?? slot).querySelector(GLYPH_SELECTOR);
|
|
9484
|
+
const box = source?.getBoundingClientRect() ?? null;
|
|
9485
|
+
return box?.width && box.height ? box : null;
|
|
9486
|
+
}
|
|
9487
|
+
function iconMarkupSizedFor(slot, markup) {
|
|
9488
|
+
const box = referenceBox(slot);
|
|
9489
|
+
if (!box) return markup;
|
|
9490
|
+
const holder = document.createElement("div");
|
|
9491
|
+
holder.innerHTML = markup;
|
|
9492
|
+
const glyph = holder.querySelector(GLYPH_SELECTOR);
|
|
9493
|
+
if (!glyph) return markup;
|
|
9494
|
+
glyph.style.width = `${Math.round(box.width)}px`;
|
|
9495
|
+
glyph.style.height = `${Math.round(box.height)}px`;
|
|
9496
|
+
return holder.innerHTML;
|
|
9497
|
+
}
|
|
9498
|
+
function applyIconMarkup(slot, markup) {
|
|
9499
|
+
if (!markup) return;
|
|
9500
|
+
const coloured = iconMarkupInheritingColour(markup);
|
|
9501
|
+
const sized = iconMarkupSizedFor(slot, coloured);
|
|
9502
|
+
if (slot.innerHTML !== sized) slot.innerHTML = sized;
|
|
9503
|
+
if (sized === coloured) {
|
|
9504
|
+
requestAnimationFrame(() => {
|
|
9505
|
+
if (!slot.isConnected) return;
|
|
9506
|
+
const resized = iconMarkupSizedFor(slot, coloured);
|
|
9507
|
+
if (resized !== coloured && slot.innerHTML !== resized) slot.innerHTML = resized;
|
|
9508
|
+
});
|
|
9509
|
+
}
|
|
9510
|
+
}
|
|
9511
|
+
function detectIconStyle(el) {
|
|
9512
|
+
const row = el.closest("[data-ohw-socials-row]");
|
|
9513
|
+
const glyphs = Array.from((row ?? el).querySelectorAll("svg"));
|
|
9514
|
+
const outlined = glyphs.some((svg) => {
|
|
9515
|
+
return Array.from(svg.querySelectorAll("*")).some((node) => {
|
|
9516
|
+
return node.getAttribute("stroke") !== null && node.getAttribute("stroke") !== "none";
|
|
9517
|
+
});
|
|
9518
|
+
});
|
|
9519
|
+
return outlined ? "outline" : "fill";
|
|
9520
|
+
}
|
|
9521
|
+
function iconMarkupInheritingColour(markup) {
|
|
9522
|
+
const holder = document.createElement("div");
|
|
9523
|
+
holder.innerHTML = markup;
|
|
9524
|
+
holder.querySelectorAll("svg *").forEach((node) => {
|
|
9525
|
+
if (node.getAttribute("fill") && node.getAttribute("fill") !== "none") {
|
|
9526
|
+
node.setAttribute("fill", "currentColor");
|
|
9527
|
+
}
|
|
9528
|
+
if (node.getAttribute("stroke") && node.getAttribute("stroke") !== "none") {
|
|
9529
|
+
node.setAttribute("stroke", "currentColor");
|
|
9530
|
+
}
|
|
9531
|
+
});
|
|
9532
|
+
return holder.innerHTML;
|
|
9533
|
+
}
|
|
9534
|
+
|
|
9535
|
+
// src/lib/socials-items.ts
|
|
9536
|
+
var ICON_SELECTOR = '[data-ohw-editable="icon"]';
|
|
9537
|
+
var SOCIAL_KEY_RE = /(^|-)social(s)?(-|$)/i;
|
|
9538
|
+
var SOCIALS_ROW_ATTR = "data-ohw-socials-row";
|
|
9539
|
+
var SOCIALS_ITEM_ATTR = "data-ohw-social-item";
|
|
9540
|
+
function isSocialItem(el) {
|
|
9541
|
+
if (!el) return false;
|
|
9542
|
+
const anchor = el instanceof HTMLAnchorElement ? el : el.closest("a");
|
|
9543
|
+
if (!anchor) return false;
|
|
9544
|
+
if (SOCIAL_KEY_RE.test(anchor.getAttribute("data-ohw-href-key") ?? "")) return true;
|
|
9545
|
+
return anchor.querySelectorAll(ICON_SELECTOR).length === 1;
|
|
9546
|
+
}
|
|
9547
|
+
function getSocialItem(el) {
|
|
9548
|
+
const anchor = el.closest("a");
|
|
9549
|
+
return isSocialItem(anchor) ? anchor : null;
|
|
9550
|
+
}
|
|
9551
|
+
function findSocialsRow(el) {
|
|
9552
|
+
const item = getSocialItem(el);
|
|
9553
|
+
if (!item) return null;
|
|
9554
|
+
const wrapper = item.parentElement;
|
|
9555
|
+
const row = wrapper && wrapper.querySelectorAll("a").length === 1 && wrapper.matches("li, div, span") ? wrapper.parentElement : wrapper;
|
|
9556
|
+
if (!row) return null;
|
|
9557
|
+
const anchors = Array.from(row.querySelectorAll("a"));
|
|
9558
|
+
if (!anchors.length || !anchors.every((anchor) => isSocialItem(anchor))) return null;
|
|
9559
|
+
return row;
|
|
9560
|
+
}
|
|
9561
|
+
function isSocialsRow(el) {
|
|
9562
|
+
const anchors = Array.from(el.querySelectorAll("a"));
|
|
9563
|
+
return anchors.length > 0 && anchors.every((anchor) => isSocialItem(anchor));
|
|
9564
|
+
}
|
|
9565
|
+
function listSocialItems(row) {
|
|
9566
|
+
return Array.from(row.children).map((child) => {
|
|
9567
|
+
if (!(child instanceof HTMLElement)) return null;
|
|
9568
|
+
const anchor = child.matches("a") ? child : child.querySelector("a");
|
|
9569
|
+
return isSocialItem(anchor) ? anchor : null;
|
|
9570
|
+
}).filter((item) => item !== null);
|
|
9571
|
+
}
|
|
9572
|
+
function socialRowUnit(item) {
|
|
9573
|
+
const row = findSocialsRow(item);
|
|
9574
|
+
let node = item;
|
|
9575
|
+
while (node.parentElement && node.parentElement !== row) {
|
|
9576
|
+
node = node.parentElement;
|
|
9577
|
+
}
|
|
9578
|
+
return node;
|
|
9579
|
+
}
|
|
9580
|
+
function listSocialsRows(root = document) {
|
|
9581
|
+
const rows = /* @__PURE__ */ new Set();
|
|
9582
|
+
root.querySelectorAll(`${ICON_SELECTOR}, a[data-ohw-href-key]`).forEach((el) => {
|
|
9583
|
+
const row = findSocialsRow(el);
|
|
9584
|
+
if (row) rows.add(row);
|
|
9585
|
+
});
|
|
9586
|
+
root.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`).forEach((row) => rows.add(row));
|
|
9587
|
+
return Array.from(rows);
|
|
9588
|
+
}
|
|
9589
|
+
var rowTemplates = /* @__PURE__ */ new Map();
|
|
9590
|
+
function markSocialsRows(root = document) {
|
|
9591
|
+
root.querySelectorAll(`[${SOCIALS_ITEM_ATTR}]`).forEach((item) => {
|
|
9592
|
+
item.removeAttribute(SOCIALS_ITEM_ATTR);
|
|
9593
|
+
});
|
|
9594
|
+
listSocialsRows(root).forEach((row) => {
|
|
9595
|
+
row.setAttribute(SOCIALS_ROW_ATTR, "");
|
|
9596
|
+
const items = listSocialItems(row);
|
|
9597
|
+
if (items[0]) rowTemplates.set(rowKeyOf(row), socialRowUnit(items[0]).outerHTML);
|
|
9598
|
+
items.forEach((item, index) => {
|
|
9599
|
+
item.setAttribute(SOCIALS_ITEM_ATTR, String(index));
|
|
9600
|
+
const iconKey = socialIconKey(item);
|
|
9601
|
+
if (iconKey) ensureLabelSlot(item, iconKey);
|
|
9602
|
+
});
|
|
9603
|
+
});
|
|
9604
|
+
}
|
|
9605
|
+
var SOCIALS_LABEL_ATTR = "data-ohw-social-label";
|
|
9606
|
+
function ensureLabelSlot(item, iconKey) {
|
|
9607
|
+
if (socialLabelElement(item)) return;
|
|
9608
|
+
const label = document.createElement("span");
|
|
9609
|
+
label.setAttribute("data-ohw-key", `${iconKey}-label`);
|
|
9610
|
+
label.setAttribute("data-ohw-editable", "text");
|
|
9611
|
+
label.setAttribute(SOCIALS_LABEL_ATTR, "");
|
|
9612
|
+
label.style.display = "none";
|
|
9613
|
+
label.textContent = item.getAttribute("aria-label") ?? "";
|
|
9614
|
+
item.appendChild(label);
|
|
9615
|
+
}
|
|
9616
|
+
function socialLabelElement(item) {
|
|
9617
|
+
return item.querySelector(
|
|
9618
|
+
`[${SOCIALS_LABEL_ATTR}], [data-ohw-editable="text"], [data-ohw-editable="plain"]`
|
|
9619
|
+
);
|
|
9620
|
+
}
|
|
9621
|
+
function socialLabelKey(iconKey) {
|
|
9622
|
+
return `${iconKey}-label`;
|
|
9623
|
+
}
|
|
9624
|
+
function applyStoredValues(item, content) {
|
|
9625
|
+
const hrefKey = socialHrefKey(item);
|
|
9626
|
+
const iconKey = socialIconKey(item);
|
|
9627
|
+
if (hrefKey && content[hrefKey] !== void 0) item.setAttribute("href", content[hrefKey]);
|
|
9628
|
+
if (iconKey) {
|
|
9629
|
+
const glyph = item.querySelector(ICON_SELECTOR);
|
|
9630
|
+
if (glyph && content[iconKey]) applyIconMarkup(glyph, content[iconKey]);
|
|
9631
|
+
const label = item.querySelector(`[${SOCIALS_LABEL_ATTR}]`);
|
|
9632
|
+
label?.setAttribute("data-ohw-key", socialLabelKey(iconKey));
|
|
9633
|
+
const stored = content[socialLabelKey(iconKey)];
|
|
9634
|
+
if (label && stored) label.textContent = stored;
|
|
9635
|
+
}
|
|
9636
|
+
}
|
|
9637
|
+
function socialPlatformKey(iconKey) {
|
|
9638
|
+
return `${iconKey}-platform`;
|
|
9639
|
+
}
|
|
9640
|
+
function socialHrefKey(item) {
|
|
9641
|
+
return item.getAttribute("data-ohw-href-key");
|
|
9642
|
+
}
|
|
9643
|
+
function socialIconKey(item) {
|
|
9644
|
+
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
9645
|
+
}
|
|
9646
|
+
var SOCIALS_ORDER_KEY = "__ohw_socials_order";
|
|
9647
|
+
function fromMarkup(markup) {
|
|
9648
|
+
const holder = document.createElement("div");
|
|
9649
|
+
holder.innerHTML = markup;
|
|
9650
|
+
return holder.firstElementChild instanceof HTMLElement ? holder.firstElementChild : null;
|
|
9651
|
+
}
|
|
9652
|
+
var rowKeys = /* @__PURE__ */ new WeakMap();
|
|
9653
|
+
function rowKeyOf(row) {
|
|
9654
|
+
const first = listSocialItems(row)[0];
|
|
9655
|
+
const itemKey = first ? socialIconKey(first) ?? socialHrefKey(first)?.replace(/-href$/, "") : null;
|
|
9656
|
+
const derived = itemKey?.replace(/-[^-]+$/, "") || null;
|
|
9657
|
+
if (derived) rowKeys.set(row, derived);
|
|
9658
|
+
return derived ?? rowKeys.get(row) ?? "social";
|
|
9659
|
+
}
|
|
9660
|
+
function getSocialsOrderFromDom(root = document) {
|
|
9661
|
+
const order = {};
|
|
9662
|
+
listSocialsRows(root).forEach((row) => {
|
|
9663
|
+
order[rowKeyOf(row)] = listSocialItems(row).map((item) => socialHrefKey(item)).filter((key) => Boolean(key));
|
|
9664
|
+
});
|
|
9665
|
+
return order;
|
|
9666
|
+
}
|
|
9667
|
+
function hasStoredValue(content, hrefKey) {
|
|
9668
|
+
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9669
|
+
return Boolean(content[hrefKey]) || Boolean(content[iconKey]);
|
|
9670
|
+
}
|
|
9671
|
+
function parseSocialsOrder(raw) {
|
|
9672
|
+
if (!raw) return null;
|
|
9673
|
+
try {
|
|
9674
|
+
const parsed = JSON.parse(raw);
|
|
9675
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9676
|
+
} catch {
|
|
9677
|
+
return null;
|
|
9678
|
+
}
|
|
9679
|
+
}
|
|
9680
|
+
function nextSocialIndex(row, rowKey, content) {
|
|
9681
|
+
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));
|
|
9682
|
+
return Math.max(-1, ...used) + 1;
|
|
9683
|
+
}
|
|
9684
|
+
function insertSocialItem(row, after, content = {}) {
|
|
9685
|
+
const rowKey = rowKeyOf(row);
|
|
9686
|
+
const template = listSocialItems(row)[0];
|
|
9687
|
+
const remembered = rowTemplates.get(rowKey);
|
|
9688
|
+
if (!template && !remembered) return null;
|
|
9689
|
+
const index = nextSocialIndex(row, rowKey, content);
|
|
9690
|
+
const iconKey = `${rowKey}-${index}`;
|
|
9691
|
+
const hrefKey = `${iconKey}-href`;
|
|
9692
|
+
const templateUnit = template ? socialRowUnit(template) : null;
|
|
9693
|
+
const unit = templateUnit ? templateUnit.cloneNode(true) : fromMarkup(remembered);
|
|
9694
|
+
const item = unit && (unit.matches("a") ? unit : unit.querySelector("a"));
|
|
9695
|
+
if (!unit || !item) return null;
|
|
9696
|
+
item.setAttribute("data-ohw-href-key", hrefKey);
|
|
9697
|
+
item.setAttribute("href", "");
|
|
9698
|
+
item.removeAttribute("aria-label");
|
|
9699
|
+
item.querySelectorAll("[data-ohw-hovered], [data-ohw-selected]").forEach((el) => {
|
|
9700
|
+
el.removeAttribute("data-ohw-hovered");
|
|
9701
|
+
el.removeAttribute("data-ohw-selected");
|
|
9702
|
+
});
|
|
9703
|
+
const icon = item.querySelector(ICON_SELECTOR);
|
|
9704
|
+
icon?.setAttribute("data-ohw-key", iconKey);
|
|
9705
|
+
item.querySelector(`[${SOCIALS_LABEL_ATTR}]`)?.remove();
|
|
9706
|
+
const afterUnit = after ? socialRowUnit(after) : null;
|
|
9707
|
+
if (afterUnit && afterUnit.parentElement === row) afterUnit.insertAdjacentElement("afterend", unit);
|
|
9708
|
+
else row.appendChild(unit);
|
|
9709
|
+
markSocialsRows(row.ownerDocument);
|
|
9710
|
+
return { item, hrefKey, iconKey, order: getSocialsOrderFromDom(row.ownerDocument) };
|
|
9711
|
+
}
|
|
9712
|
+
function duplicateSocialItem(item, content) {
|
|
9713
|
+
const row = findSocialsRow(item);
|
|
9714
|
+
const created = row ? insertSocialItem(row, item, content) : null;
|
|
9715
|
+
if (!created) return null;
|
|
9716
|
+
const sourceHref = socialHrefKey(item);
|
|
9717
|
+
const sourceIcon = socialIconKey(item);
|
|
9718
|
+
const link = created.item;
|
|
9719
|
+
if (sourceHref) link.setAttribute("href", item.getAttribute("href") ?? "");
|
|
9720
|
+
const glyph = item.querySelector(ICON_SELECTOR)?.innerHTML;
|
|
9721
|
+
if (glyph) {
|
|
9722
|
+
const slot = link.querySelector(ICON_SELECTOR);
|
|
9723
|
+
if (slot) slot.innerHTML = glyph;
|
|
9724
|
+
}
|
|
9725
|
+
return {
|
|
9726
|
+
...created,
|
|
9727
|
+
copiedFrom: { href: sourceHref, icon: sourceIcon }
|
|
9728
|
+
};
|
|
9729
|
+
}
|
|
9730
|
+
function removeSocialItem(item, content) {
|
|
9731
|
+
const row = findSocialsRow(item);
|
|
9732
|
+
if (!row) return null;
|
|
9733
|
+
const hrefKey = socialHrefKey(item);
|
|
9734
|
+
const iconKey = socialIconKey(item);
|
|
9735
|
+
const removedKeys = [hrefKey, iconKey].filter((key) => Boolean(key));
|
|
9736
|
+
if (!removedKeys.length) return null;
|
|
9737
|
+
const previousOrder = getSocialsOrderFromDom(row.ownerDocument);
|
|
9738
|
+
const previousContent = Object.fromEntries(
|
|
9739
|
+
removedKeys.filter((key) => key in content).map((key) => [key, content[key]])
|
|
9740
|
+
);
|
|
9741
|
+
const unit = socialRowUnit(item);
|
|
9742
|
+
const nextSibling = unit.nextElementSibling;
|
|
9743
|
+
unit.remove();
|
|
9744
|
+
markSocialsRows(row.ownerDocument);
|
|
9745
|
+
return {
|
|
9746
|
+
removedKeys,
|
|
9747
|
+
previousContent,
|
|
9748
|
+
order: getSocialsOrderFromDom(row.ownerDocument),
|
|
9749
|
+
previousOrder,
|
|
9750
|
+
undo: () => {
|
|
9751
|
+
if (nextSibling) nextSibling.before(unit);
|
|
9752
|
+
else row.appendChild(unit);
|
|
9753
|
+
markSocialsRows(row.ownerDocument);
|
|
9754
|
+
}
|
|
9755
|
+
};
|
|
9756
|
+
}
|
|
9757
|
+
function applySocialsOrder(order, root = document) {
|
|
9758
|
+
listSocialsRows(root).forEach((row) => {
|
|
9759
|
+
const wanted = order[rowKeyOf(row)];
|
|
9760
|
+
if (!wanted) return;
|
|
9761
|
+
const byKey = new Map(listSocialItems(row).map((item) => [socialHrefKey(item), item]));
|
|
9762
|
+
wanted.forEach((key) => {
|
|
9763
|
+
const item = byKey.get(key);
|
|
9764
|
+
if (item) row.appendChild(socialRowUnit(item));
|
|
9765
|
+
});
|
|
9766
|
+
});
|
|
9767
|
+
markSocialsRows(root);
|
|
9768
|
+
}
|
|
9769
|
+
function reconcileSocialsFromContent(content, root = document) {
|
|
9770
|
+
markSocialsRows(root);
|
|
9771
|
+
const stored = parseSocialsOrder(content[SOCIALS_ORDER_KEY]);
|
|
9772
|
+
if (!stored) return;
|
|
9773
|
+
listSocialsRows(root).forEach((row) => {
|
|
9774
|
+
const wanted = stored[rowKeyOf(row)];
|
|
9775
|
+
if (!wanted) return;
|
|
9776
|
+
if (!wanted.length) return;
|
|
9777
|
+
wanted.forEach((key) => {
|
|
9778
|
+
if (listSocialItems(row).some((item) => socialHrefKey(item) === key)) return;
|
|
9779
|
+
if (!hasStoredValue(content, key)) return;
|
|
9780
|
+
const created = insertSocialItem(row, null, content);
|
|
9781
|
+
if (created) {
|
|
9782
|
+
created.item.setAttribute("data-ohw-href-key", key);
|
|
9783
|
+
created.item.querySelector(ICON_SELECTOR)?.setAttribute("data-ohw-key", key.replace(/-href$/, ""));
|
|
9784
|
+
applyStoredValues(created.item, content);
|
|
9785
|
+
}
|
|
9786
|
+
});
|
|
9787
|
+
const present = listSocialItems(row);
|
|
9788
|
+
const surviving = present.filter((item) => {
|
|
9789
|
+
const key = socialHrefKey(item);
|
|
9790
|
+
return !key || wanted.includes(key);
|
|
9791
|
+
});
|
|
9792
|
+
if (surviving.length) {
|
|
9793
|
+
present.forEach((item) => {
|
|
9794
|
+
if (!surviving.includes(item)) socialRowUnit(item).remove();
|
|
9795
|
+
});
|
|
9796
|
+
}
|
|
9797
|
+
});
|
|
9798
|
+
applySocialsOrder(stored, root);
|
|
9799
|
+
}
|
|
9800
|
+
var DROP_BAR_THICKNESS = 3;
|
|
9801
|
+
var DROP_BAR_GAP = 8;
|
|
9802
|
+
function buildSocialDropSlots(row) {
|
|
9803
|
+
const items = listSocialItems(row);
|
|
9804
|
+
if (!items.length) return [];
|
|
9805
|
+
const rects = items.map((item) => item.getBoundingClientRect());
|
|
9806
|
+
return items.concat(items[items.length - 1]).map((_, index) => {
|
|
9807
|
+
const previous = rects[index - 1];
|
|
9808
|
+
const next = rects[index];
|
|
9809
|
+
const centre = previous && next ? (previous.right + next.left) / 2 : next ? next.left - DROP_BAR_GAP : previous.right + DROP_BAR_GAP;
|
|
9810
|
+
const rect = next ?? previous;
|
|
9811
|
+
return {
|
|
9812
|
+
insertIndex: index,
|
|
9813
|
+
columnIndex: -1,
|
|
9814
|
+
left: centre - DROP_BAR_THICKNESS / 2,
|
|
9815
|
+
top: rect.top,
|
|
9816
|
+
width: DROP_BAR_THICKNESS,
|
|
9817
|
+
height: rect.height,
|
|
9818
|
+
direction: "vertical"
|
|
9819
|
+
};
|
|
9820
|
+
});
|
|
9821
|
+
}
|
|
9822
|
+
function findSocialByHrefKey(hrefKey, root = document) {
|
|
9823
|
+
const el = root.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
9824
|
+
return el ? getSocialItem(el) : null;
|
|
9825
|
+
}
|
|
9826
|
+
function buildSocialDropSlotsForKey(hrefKey, root = document) {
|
|
9827
|
+
const item = findSocialByHrefKey(hrefKey, root);
|
|
9828
|
+
const row = item ? findSocialsRow(item) : null;
|
|
9829
|
+
return row ? buildSocialDropSlots(row) : [];
|
|
9830
|
+
}
|
|
9831
|
+
function hitTestSocialDropSlot(clientX, clientY, draggedHrefKey, root = document) {
|
|
9832
|
+
const distanceTo = (slot) => {
|
|
9833
|
+
const dx = clientX - (slot.left + slot.width / 2);
|
|
9834
|
+
const dy = clientY < slot.top ? slot.top - clientY : Math.max(0, clientY - (slot.top + slot.height));
|
|
9835
|
+
return Math.hypot(dx, dy);
|
|
9836
|
+
};
|
|
9837
|
+
const slots = buildSocialDropSlotsForKey(draggedHrefKey, root);
|
|
9838
|
+
return slots.reduce((best, slot) => {
|
|
9839
|
+
return !best || distanceTo(slot) < distanceTo(best) ? slot : best;
|
|
9840
|
+
}, null);
|
|
9841
|
+
}
|
|
9842
|
+
function planSocialMove(hrefKey, insertIndex, root = document) {
|
|
9843
|
+
const item = findSocialByHrefKey(hrefKey, root);
|
|
9844
|
+
const row = item ? findSocialsRow(item) : null;
|
|
9845
|
+
if (!row) return null;
|
|
9846
|
+
const order = getSocialsOrderFromDom(root);
|
|
9847
|
+
const key = rowKeyOf(row);
|
|
9848
|
+
const current = order[key];
|
|
9849
|
+
if (!current) return null;
|
|
9850
|
+
const from = current.indexOf(hrefKey);
|
|
9851
|
+
if (from < 0) return null;
|
|
9852
|
+
const next = current.filter((_, index) => index !== from);
|
|
9853
|
+
next.splice(insertIndex > from ? insertIndex - 1 : insertIndex, 0, hrefKey);
|
|
9854
|
+
return { ...order, [key]: next };
|
|
9855
|
+
}
|
|
9856
|
+
var SOCIALS_DISPLAY_KEY = "__ohw_socials_display";
|
|
9857
|
+
function readSocialsDisplay(row) {
|
|
9858
|
+
const items = listSocialItems(row);
|
|
9859
|
+
const visible = (el) => Boolean(el) && el.style.display !== "none" && el.getAttribute("data-ohw-hidden") === null;
|
|
9860
|
+
return {
|
|
9861
|
+
text: items.some((item) => visible(socialLabelElement(item))),
|
|
9862
|
+
icon: items.some((item) => visible(item.querySelector(ICON_SELECTOR)))
|
|
9863
|
+
};
|
|
9864
|
+
}
|
|
9865
|
+
function parseSocialsDisplay(raw) {
|
|
9866
|
+
if (!raw) return null;
|
|
9867
|
+
try {
|
|
9868
|
+
const parsed = JSON.parse(raw);
|
|
9869
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9870
|
+
} catch {
|
|
9871
|
+
return null;
|
|
9872
|
+
}
|
|
9873
|
+
}
|
|
9874
|
+
function socialsDisplayFor(row, content) {
|
|
9875
|
+
return parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY])?.[rowKeyOf(row)] ?? readSocialsDisplay(row);
|
|
9876
|
+
}
|
|
9877
|
+
function socialsDisplayWith(row, display, content) {
|
|
9878
|
+
return { ...parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]) ?? {}, [rowKeyOf(row)]: display };
|
|
9879
|
+
}
|
|
9880
|
+
function applySocialsDisplayToRow(row, display) {
|
|
9881
|
+
listSocialItems(row).forEach((item) => {
|
|
9882
|
+
const label = socialLabelElement(item);
|
|
9883
|
+
const icon = item.querySelector(ICON_SELECTOR);
|
|
9884
|
+
if (label) label.style.display = display.text ? "" : "none";
|
|
9885
|
+
if (icon) icon.style.display = display.icon ? "" : "none";
|
|
9886
|
+
});
|
|
9887
|
+
}
|
|
9888
|
+
function applySocialsDisplayFromContent(content, root = document) {
|
|
9889
|
+
const stored = parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]);
|
|
9890
|
+
if (!stored) return;
|
|
9891
|
+
listSocialsRows(root).forEach((row) => {
|
|
9892
|
+
const display = stored[rowKeyOf(row)];
|
|
9893
|
+
if (!display) return;
|
|
9894
|
+
if (display.icon) {
|
|
9895
|
+
listSocialItems(row).forEach((item) => {
|
|
9896
|
+
const iconKey = ensureIconSlot(item);
|
|
9897
|
+
const slot = item.querySelector(ICON_SELECTOR);
|
|
9898
|
+
if (iconKey && slot && content[iconKey]) applyIconMarkup(slot, content[iconKey]);
|
|
9899
|
+
});
|
|
9900
|
+
}
|
|
9901
|
+
applySocialsDisplayToRow(row, display);
|
|
9902
|
+
});
|
|
9903
|
+
}
|
|
9904
|
+
function socialsMissingIcons(row) {
|
|
9905
|
+
return listSocialItems(row).filter((item) => !item.querySelector(ICON_SELECTOR)).map((item) => ({ hrefKey: socialHrefKey(item) ?? "", url: item.getAttribute("href") ?? "" })).filter((entry) => Boolean(entry.hrefKey));
|
|
9906
|
+
}
|
|
9907
|
+
function ensureIconSlot(item) {
|
|
9908
|
+
const existing = item.querySelector(ICON_SELECTOR);
|
|
9909
|
+
if (existing) return existing.dataset.ohwKey ?? null;
|
|
9910
|
+
const hrefKey = socialHrefKey(item);
|
|
9911
|
+
if (!hrefKey) return null;
|
|
9912
|
+
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9913
|
+
const slot = document.createElement("span");
|
|
9914
|
+
slot.setAttribute("data-ohw-key", iconKey);
|
|
9915
|
+
slot.setAttribute("data-ohw-editable", "icon");
|
|
9916
|
+
slot.style.display = "inline-flex";
|
|
9917
|
+
item.prepend(slot);
|
|
9918
|
+
return iconKey;
|
|
9919
|
+
}
|
|
9920
|
+
|
|
9455
9921
|
// src/lib/footer-items.ts
|
|
9456
9922
|
var FOOTER_ORDER_KEY = "__ohw_footer_order";
|
|
9457
9923
|
var MAX_FOOTER_COLUMNS = 18;
|
|
@@ -10328,6 +10794,257 @@ function addFooterColumnWithPersist({
|
|
|
10328
10794
|
return result;
|
|
10329
10795
|
}
|
|
10330
10796
|
|
|
10797
|
+
// src/ui/FloatingPanel.tsx
|
|
10798
|
+
import {
|
|
10799
|
+
useCallback as useCallback5,
|
|
10800
|
+
useEffect as useEffect9,
|
|
10801
|
+
useLayoutEffect as useLayoutEffect3,
|
|
10802
|
+
useRef as useRef7,
|
|
10803
|
+
useState as useState8
|
|
10804
|
+
} from "react";
|
|
10805
|
+
import { X as X5 } from "lucide-react";
|
|
10806
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
10807
|
+
var PANEL_WIDTH = 256;
|
|
10808
|
+
var EDGE_MARGIN = 16;
|
|
10809
|
+
function getVisibleClip(parentScroll) {
|
|
10810
|
+
const left = 0;
|
|
10811
|
+
const right = window.innerWidth;
|
|
10812
|
+
if (!parentScroll) {
|
|
10813
|
+
return { top: 0, bottom: window.innerHeight, left, right };
|
|
10814
|
+
}
|
|
10815
|
+
const { iframeOffsetTop, headerH: visibleCanvasTop, canvasH } = parentScroll;
|
|
10816
|
+
const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
|
|
10817
|
+
const bottom = Math.min(window.innerHeight, visibleCanvasTop + canvasH - iframeOffsetTop);
|
|
10818
|
+
return { top, bottom: Math.max(top, bottom), left, right };
|
|
10819
|
+
}
|
|
10820
|
+
function defaultFloatingPanelPosition(parentScroll, panelHeight = 280) {
|
|
10821
|
+
const clip = getVisibleClip(parentScroll);
|
|
10822
|
+
return {
|
|
10823
|
+
x: Math.max(EDGE_MARGIN, clip.right - PANEL_WIDTH - EDGE_MARGIN),
|
|
10824
|
+
y: Math.min(
|
|
10825
|
+
Math.max(clip.top + EDGE_MARGIN, EDGE_MARGIN),
|
|
10826
|
+
Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelHeight - EDGE_MARGIN)
|
|
10827
|
+
)
|
|
10828
|
+
};
|
|
10829
|
+
}
|
|
10830
|
+
function clampPosition(pos, parentScroll, panelW, panelH) {
|
|
10831
|
+
const clip = getVisibleClip(parentScroll);
|
|
10832
|
+
const maxX = Math.max(clip.left + EDGE_MARGIN, clip.right - panelW - EDGE_MARGIN);
|
|
10833
|
+
const maxY = Math.max(clip.top + EDGE_MARGIN, clip.bottom - panelH - EDGE_MARGIN);
|
|
10834
|
+
return {
|
|
10835
|
+
x: Math.min(Math.max(pos.x, clip.left + EDGE_MARGIN), maxX),
|
|
10836
|
+
y: Math.min(Math.max(pos.y, clip.top + EDGE_MARGIN), maxY)
|
|
10837
|
+
};
|
|
10838
|
+
}
|
|
10839
|
+
function FloatingPanel({
|
|
10840
|
+
open,
|
|
10841
|
+
title,
|
|
10842
|
+
context,
|
|
10843
|
+
icon,
|
|
10844
|
+
onClose,
|
|
10845
|
+
children,
|
|
10846
|
+
position,
|
|
10847
|
+
onPositionChange,
|
|
10848
|
+
parentScroll = null,
|
|
10849
|
+
className,
|
|
10850
|
+
bodyClassName
|
|
10851
|
+
}) {
|
|
10852
|
+
const panelRef = useRef7(null);
|
|
10853
|
+
const [measured, setMeasured] = useState8({ w: PANEL_WIDTH, h: 280 });
|
|
10854
|
+
const dragRef = useRef7(null);
|
|
10855
|
+
const resolved = position ?? defaultFloatingPanelPosition(parentScroll, measured.h);
|
|
10856
|
+
const clamped = clampPosition(resolved, parentScroll, measured.w, measured.h);
|
|
10857
|
+
useLayoutEffect3(() => {
|
|
10858
|
+
if (!open || !panelRef.current) return;
|
|
10859
|
+
const el = panelRef.current;
|
|
10860
|
+
const next = { w: el.offsetWidth || PANEL_WIDTH, h: el.offsetHeight || 280 };
|
|
10861
|
+
setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
|
|
10862
|
+
}, [open, children, title, context]);
|
|
10863
|
+
useEffect9(() => {
|
|
10864
|
+
if (!open || !position || !onPositionChange) return;
|
|
10865
|
+
const next = clampPosition(position, parentScroll, measured.w, measured.h);
|
|
10866
|
+
if (next.x !== position.x || next.y !== position.y) onPositionChange(next);
|
|
10867
|
+
}, [open, parentScroll, measured.w, measured.h, position, onPositionChange]);
|
|
10868
|
+
const onHeaderPointerDown = useCallback5(
|
|
10869
|
+
(e) => {
|
|
10870
|
+
if (e.button !== 0) return;
|
|
10871
|
+
if (e.target.closest("[data-ohw-floating-panel-close]")) return;
|
|
10872
|
+
e.preventDefault();
|
|
10873
|
+
e.stopPropagation();
|
|
10874
|
+
const el = e.currentTarget;
|
|
10875
|
+
el.setPointerCapture(e.pointerId);
|
|
10876
|
+
dragRef.current = {
|
|
10877
|
+
pointerId: e.pointerId,
|
|
10878
|
+
startX: e.clientX,
|
|
10879
|
+
startY: e.clientY,
|
|
10880
|
+
originX: clamped.x,
|
|
10881
|
+
originY: clamped.y
|
|
10882
|
+
};
|
|
10883
|
+
},
|
|
10884
|
+
[clamped.x, clamped.y]
|
|
10885
|
+
);
|
|
10886
|
+
const onHeaderPointerMove = useCallback5(
|
|
10887
|
+
(e) => {
|
|
10888
|
+
const drag = dragRef.current;
|
|
10889
|
+
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
10890
|
+
e.preventDefault();
|
|
10891
|
+
const next = clampPosition(
|
|
10892
|
+
{
|
|
10893
|
+
x: drag.originX + (e.clientX - drag.startX),
|
|
10894
|
+
y: drag.originY + (e.clientY - drag.startY)
|
|
10895
|
+
},
|
|
10896
|
+
parentScroll,
|
|
10897
|
+
measured.w,
|
|
10898
|
+
measured.h
|
|
10899
|
+
);
|
|
10900
|
+
onPositionChange?.(next);
|
|
10901
|
+
},
|
|
10902
|
+
[measured.h, measured.w, onPositionChange, parentScroll]
|
|
10903
|
+
);
|
|
10904
|
+
const endDrag = useCallback5((e) => {
|
|
10905
|
+
const drag = dragRef.current;
|
|
10906
|
+
if (!drag || drag.pointerId !== e.pointerId) return;
|
|
10907
|
+
dragRef.current = null;
|
|
10908
|
+
try {
|
|
10909
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
10910
|
+
} catch {
|
|
10911
|
+
}
|
|
10912
|
+
}, []);
|
|
10913
|
+
if (!open) return null;
|
|
10914
|
+
return /* @__PURE__ */ jsxs16(
|
|
10915
|
+
"div",
|
|
10916
|
+
{
|
|
10917
|
+
ref: panelRef,
|
|
10918
|
+
"data-ohw-floating-panel": "",
|
|
10919
|
+
role: "dialog",
|
|
10920
|
+
"aria-label": title,
|
|
10921
|
+
className: cn(
|
|
10922
|
+
// Above MediaOverlay / item chrome (2147483646); link-modal content shares this tier.
|
|
10923
|
+
"fixed z-[2147483647] flex w-64 flex-col overflow-hidden rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
10924
|
+
className
|
|
10925
|
+
),
|
|
10926
|
+
style: { left: clamped.x, top: clamped.y },
|
|
10927
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
10928
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
10929
|
+
onClick: (e) => e.stopPropagation(),
|
|
10930
|
+
children: [
|
|
10931
|
+
/* @__PURE__ */ jsxs16(
|
|
10932
|
+
"div",
|
|
10933
|
+
{
|
|
10934
|
+
"data-ohw-floating-panel-header": "",
|
|
10935
|
+
className: "relative flex cursor-grab items-start gap-2 border-b border-border py-5 pl-5 pr-11 active:cursor-grabbing",
|
|
10936
|
+
onPointerDown: onHeaderPointerDown,
|
|
10937
|
+
onPointerMove: onHeaderPointerMove,
|
|
10938
|
+
onPointerUp: endDrag,
|
|
10939
|
+
onPointerCancel: endDrag,
|
|
10940
|
+
children: [
|
|
10941
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
10942
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
10943
|
+
icon ? /* @__PURE__ */ jsx26("span", { className: "shrink-0 text-foreground", children: icon }) : null,
|
|
10944
|
+
/* @__PURE__ */ jsx26("p", { className: "min-w-0 flex-1 text-lg font-semibold leading-7 text-foreground", children: title })
|
|
10945
|
+
] }),
|
|
10946
|
+
context ? /* @__PURE__ */ jsx26("p", { className: "w-full text-sm leading-5 text-muted-foreground", children: context }) : null
|
|
10947
|
+
] }),
|
|
10948
|
+
/* @__PURE__ */ jsx26(
|
|
10949
|
+
"button",
|
|
10950
|
+
{
|
|
10951
|
+
type: "button",
|
|
10952
|
+
"data-ohw-floating-panel-close": "",
|
|
10953
|
+
"aria-label": "Close",
|
|
10954
|
+
className: "absolute right-2.5 top-2.5 rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
10955
|
+
onClick: (e) => {
|
|
10956
|
+
e.stopPropagation();
|
|
10957
|
+
onClose();
|
|
10958
|
+
},
|
|
10959
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
10960
|
+
children: /* @__PURE__ */ jsx26(X5, { size: 16, "aria-hidden": true })
|
|
10961
|
+
}
|
|
10962
|
+
)
|
|
10963
|
+
]
|
|
10964
|
+
}
|
|
10965
|
+
),
|
|
10966
|
+
/* @__PURE__ */ jsx26(
|
|
10967
|
+
"div",
|
|
10968
|
+
{
|
|
10969
|
+
"data-ohw-floating-panel-body": "",
|
|
10970
|
+
className: cn("flex w-full flex-col gap-4 p-5", bodyClassName),
|
|
10971
|
+
children
|
|
10972
|
+
}
|
|
10973
|
+
)
|
|
10974
|
+
]
|
|
10975
|
+
}
|
|
10976
|
+
);
|
|
10977
|
+
}
|
|
10978
|
+
|
|
10979
|
+
// src/ui/socials-display-panel.tsx
|
|
10980
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
10981
|
+
function DisplaySwitch({
|
|
10982
|
+
label,
|
|
10983
|
+
checked,
|
|
10984
|
+
disabled,
|
|
10985
|
+
onChange
|
|
10986
|
+
}) {
|
|
10987
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex w-full items-center gap-2", children: [
|
|
10988
|
+
/* @__PURE__ */ jsx27(
|
|
10989
|
+
"span",
|
|
10990
|
+
{
|
|
10991
|
+
className: cn(
|
|
10992
|
+
"min-w-0 flex-1 text-sm font-medium leading-5",
|
|
10993
|
+
disabled ? "text-muted-foreground" : "text-foreground"
|
|
10994
|
+
),
|
|
10995
|
+
children: label
|
|
10996
|
+
}
|
|
10997
|
+
),
|
|
10998
|
+
/* @__PURE__ */ jsx27(
|
|
10999
|
+
"button",
|
|
11000
|
+
{
|
|
11001
|
+
type: "button",
|
|
11002
|
+
role: "switch",
|
|
11003
|
+
"aria-checked": checked,
|
|
11004
|
+
"aria-label": label,
|
|
11005
|
+
disabled,
|
|
11006
|
+
onClick: () => onChange(!checked),
|
|
11007
|
+
className: cn(
|
|
11008
|
+
"relative h-5 w-9 shrink-0 rounded-full transition-colors",
|
|
11009
|
+
checked ? "bg-primary" : "bg-primary-50",
|
|
11010
|
+
disabled ? "cursor-default opacity-50" : "cursor-pointer"
|
|
11011
|
+
),
|
|
11012
|
+
children: /* @__PURE__ */ jsx27(
|
|
11013
|
+
"span",
|
|
11014
|
+
{
|
|
11015
|
+
className: cn(
|
|
11016
|
+
"absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all",
|
|
11017
|
+
checked ? "left-[1.125rem]" : "left-0.5"
|
|
11018
|
+
)
|
|
11019
|
+
}
|
|
11020
|
+
)
|
|
11021
|
+
}
|
|
11022
|
+
)
|
|
11023
|
+
] });
|
|
11024
|
+
}
|
|
11025
|
+
function SocialsDisplayPanel({ display, onChange, className }) {
|
|
11026
|
+
return /* @__PURE__ */ jsxs17("div", { className: cn("flex w-full flex-col gap-3", className), children: [
|
|
11027
|
+
/* @__PURE__ */ jsx27(
|
|
11028
|
+
DisplaySwitch,
|
|
11029
|
+
{
|
|
11030
|
+
label: "Text",
|
|
11031
|
+
checked: display.text,
|
|
11032
|
+
disabled: display.text && !display.icon,
|
|
11033
|
+
onChange: (text) => onChange({ ...display, text })
|
|
11034
|
+
}
|
|
11035
|
+
),
|
|
11036
|
+
/* @__PURE__ */ jsx27(
|
|
11037
|
+
DisplaySwitch,
|
|
11038
|
+
{
|
|
11039
|
+
label: "Icon",
|
|
11040
|
+
checked: display.icon,
|
|
11041
|
+
disabled: display.icon && !display.text,
|
|
11042
|
+
onChange: (icon) => onChange({ ...display, icon })
|
|
11043
|
+
}
|
|
11044
|
+
)
|
|
11045
|
+
] });
|
|
11046
|
+
}
|
|
11047
|
+
|
|
10331
11048
|
// src/lib/item-drag-interaction.ts
|
|
10332
11049
|
function disableNativeHrefDrag(el) {
|
|
10333
11050
|
if (el.draggable) el.draggable = false;
|
|
@@ -10526,7 +11243,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
|
|
|
10526
11243
|
}
|
|
10527
11244
|
|
|
10528
11245
|
// src/useNavItemDrag.ts
|
|
10529
|
-
import { useCallback as
|
|
11246
|
+
import { useCallback as useCallback6, useEffect as useEffect10, useRef as useRef8, useState as useState9 } from "react";
|
|
10530
11247
|
function useNavItemDrag({
|
|
10531
11248
|
isEditMode,
|
|
10532
11249
|
editContentRef,
|
|
@@ -10550,11 +11267,11 @@ function useNavItemDrag({
|
|
|
10550
11267
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
10551
11268
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
10552
11269
|
}) {
|
|
10553
|
-
const navDragRef =
|
|
10554
|
-
const [navDropSlots, setNavDropSlots] =
|
|
10555
|
-
const [activeNavDropIndex, setActiveNavDropIndex] =
|
|
10556
|
-
const navPointerDragRef =
|
|
10557
|
-
const clearNavDragVisuals =
|
|
11270
|
+
const navDragRef = useRef8(null);
|
|
11271
|
+
const [navDropSlots, setNavDropSlots] = useState9([]);
|
|
11272
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = useState9(null);
|
|
11273
|
+
const navPointerDragRef = useRef8(null);
|
|
11274
|
+
const clearNavDragVisuals = useCallback6(() => {
|
|
10558
11275
|
const session = navDragRef.current;
|
|
10559
11276
|
const keepOpenEl = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.draggedEl : null;
|
|
10560
11277
|
navDragRef.current = null;
|
|
@@ -10571,7 +11288,7 @@ function useNavItemDrag({
|
|
|
10571
11288
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
10572
11289
|
unlockItemDragInteraction();
|
|
10573
11290
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
10574
|
-
const refreshNavDragVisuals =
|
|
11291
|
+
const refreshNavDragVisuals = useCallback6(
|
|
10575
11292
|
(session, activeSlot, clientX, clientY) => {
|
|
10576
11293
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
10577
11294
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -10589,13 +11306,13 @@ function useNavItemDrag({
|
|
|
10589
11306
|
},
|
|
10590
11307
|
[setDraggedItemRect, setSiblingHintRects]
|
|
10591
11308
|
);
|
|
10592
|
-
const refreshNavDragVisualsRef =
|
|
11309
|
+
const refreshNavDragVisualsRef = useRef8(refreshNavDragVisuals);
|
|
10593
11310
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
10594
|
-
const commitNavDragRef =
|
|
11311
|
+
const commitNavDragRef = useRef8(() => {
|
|
10595
11312
|
});
|
|
10596
|
-
const beginNavDragRef =
|
|
11313
|
+
const beginNavDragRef = useRef8(() => {
|
|
10597
11314
|
});
|
|
10598
|
-
const beginNavDrag =
|
|
11315
|
+
const beginNavDrag = useCallback6(
|
|
10599
11316
|
(session) => {
|
|
10600
11317
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
10601
11318
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -10629,7 +11346,7 @@ function useNavItemDrag({
|
|
|
10629
11346
|
]
|
|
10630
11347
|
);
|
|
10631
11348
|
beginNavDragRef.current = beginNavDrag;
|
|
10632
|
-
const commitNavDrag =
|
|
11349
|
+
const commitNavDrag = useCallback6(
|
|
10633
11350
|
(clientX, clientY) => {
|
|
10634
11351
|
const session = navDragRef.current;
|
|
10635
11352
|
if (!session) {
|
|
@@ -10690,7 +11407,7 @@ function useNavItemDrag({
|
|
|
10690
11407
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
10691
11408
|
);
|
|
10692
11409
|
commitNavDragRef.current = commitNavDrag;
|
|
10693
|
-
const startNavLinkDrag =
|
|
11410
|
+
const startNavLinkDrag = useCallback6(
|
|
10694
11411
|
(anchor, clientX, clientY, wasSelected) => {
|
|
10695
11412
|
if (footerDragRef.current) return false;
|
|
10696
11413
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -10708,7 +11425,7 @@ function useNavItemDrag({
|
|
|
10708
11425
|
},
|
|
10709
11426
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
10710
11427
|
);
|
|
10711
|
-
const onNavDragOver =
|
|
11428
|
+
const onNavDragOver = useCallback6(
|
|
10712
11429
|
(e) => {
|
|
10713
11430
|
const session = navDragRef.current;
|
|
10714
11431
|
if (!session) return false;
|
|
@@ -10720,7 +11437,7 @@ function useNavItemDrag({
|
|
|
10720
11437
|
},
|
|
10721
11438
|
[]
|
|
10722
11439
|
);
|
|
10723
|
-
|
|
11440
|
+
useEffect10(() => {
|
|
10724
11441
|
if (!isEditMode) return;
|
|
10725
11442
|
const THRESHOLD = 10;
|
|
10726
11443
|
const resolveWasSelected = (el) => {
|
|
@@ -10845,7 +11562,7 @@ function useNavItemDrag({
|
|
|
10845
11562
|
setLinkPopover,
|
|
10846
11563
|
suppressNextClickRef
|
|
10847
11564
|
]);
|
|
10848
|
-
const armNavPressFromChrome =
|
|
11565
|
+
const armNavPressFromChrome = useCallback6(
|
|
10849
11566
|
(selected, clientX, clientY, pointerId) => {
|
|
10850
11567
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
10851
11568
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -10877,7 +11594,7 @@ function useNavItemDrag({
|
|
|
10877
11594
|
|
|
10878
11595
|
// src/ui/footer-container-chrome.tsx
|
|
10879
11596
|
import { Plus as Plus2 } from "lucide-react";
|
|
10880
|
-
import { jsx as
|
|
11597
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
10881
11598
|
function FooterContainerChrome({
|
|
10882
11599
|
rect,
|
|
10883
11600
|
onAdd,
|
|
@@ -10885,7 +11602,7 @@ function FooterContainerChrome({
|
|
|
10885
11602
|
}) {
|
|
10886
11603
|
const chromeGap = 6;
|
|
10887
11604
|
const buttonMargin = 7;
|
|
10888
|
-
return /* @__PURE__ */
|
|
11605
|
+
return /* @__PURE__ */ jsx28(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx28(
|
|
10889
11606
|
"div",
|
|
10890
11607
|
{
|
|
10891
11608
|
"data-ohw-footer-container-chrome": "",
|
|
@@ -10897,8 +11614,8 @@ function FooterContainerChrome({
|
|
|
10897
11614
|
width: rect.width + chromeGap * 2,
|
|
10898
11615
|
height: rect.height + chromeGap * 2
|
|
10899
11616
|
},
|
|
10900
|
-
children: /* @__PURE__ */
|
|
10901
|
-
/* @__PURE__ */
|
|
11617
|
+
children: /* @__PURE__ */ jsxs18(Tooltip, { children: [
|
|
11618
|
+
/* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx28(
|
|
10902
11619
|
"button",
|
|
10903
11620
|
{
|
|
10904
11621
|
type: "button",
|
|
@@ -10917,17 +11634,17 @@ function FooterContainerChrome({
|
|
|
10917
11634
|
if (addDisabled) return;
|
|
10918
11635
|
onAdd();
|
|
10919
11636
|
},
|
|
10920
|
-
children: /* @__PURE__ */
|
|
11637
|
+
children: /* @__PURE__ */ jsx28(Plus2, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
10921
11638
|
}
|
|
10922
11639
|
) }),
|
|
10923
|
-
/* @__PURE__ */
|
|
11640
|
+
/* @__PURE__ */ jsx28(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
10924
11641
|
] })
|
|
10925
11642
|
}
|
|
10926
11643
|
) });
|
|
10927
11644
|
}
|
|
10928
11645
|
|
|
10929
11646
|
// src/lib/carousel.ts
|
|
10930
|
-
import { useEffect as
|
|
11647
|
+
import { useEffect as useEffect11, useState as useState10 } from "react";
|
|
10931
11648
|
var CAROUSEL_ATTR = "data-ohw-carousel";
|
|
10932
11649
|
var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
|
|
10933
11650
|
var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
|
|
@@ -10989,8 +11706,8 @@ function applyCarouselNode(key, val) {
|
|
|
10989
11706
|
return true;
|
|
10990
11707
|
}
|
|
10991
11708
|
function useOhwCarousel(key, initial) {
|
|
10992
|
-
const [images, setImages] =
|
|
10993
|
-
|
|
11709
|
+
const [images, setImages] = useState10(initial);
|
|
11710
|
+
useEffect11(() => {
|
|
10994
11711
|
const el = document.querySelector(
|
|
10995
11712
|
`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
|
|
10996
11713
|
);
|
|
@@ -11205,7 +11922,7 @@ function isNavbarLinksContainer(el) {
|
|
|
11205
11922
|
function isNavigationItem(el) {
|
|
11206
11923
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
11207
11924
|
if (!anchor) return false;
|
|
11208
|
-
return Boolean(anchor.querySelector('[data-ohw-editable="text"]'));
|
|
11925
|
+
return Boolean(anchor.querySelector('[data-ohw-editable="text"]')) || Boolean(getSocialItem(anchor));
|
|
11209
11926
|
}
|
|
11210
11927
|
function findFooterItemGroup(item) {
|
|
11211
11928
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -11226,8 +11943,9 @@ function isInferredFooterGroup(el) {
|
|
|
11226
11943
|
const footer = el.closest("footer");
|
|
11227
11944
|
if (!footer || el === footer) return false;
|
|
11228
11945
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
11946
|
+
if (isSocialsRow(el)) return false;
|
|
11229
11947
|
const count = Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(
|
|
11230
|
-
isNavigationItem
|
|
11948
|
+
(item) => isNavigationItem(item) && !getSocialItem(item)
|
|
11231
11949
|
).length;
|
|
11232
11950
|
return count >= 2;
|
|
11233
11951
|
}
|
|
@@ -11271,7 +11989,8 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
11271
11989
|
if (key.endsWith("-href")) applyLinkByKey2(key, text);
|
|
11272
11990
|
else {
|
|
11273
11991
|
document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
|
|
11274
|
-
el.
|
|
11992
|
+
if (el.getAttribute("data-ohw-editable") === "icon") applyIconMarkup(el, text);
|
|
11993
|
+
else el.textContent = text;
|
|
11275
11994
|
});
|
|
11276
11995
|
}
|
|
11277
11996
|
}
|
|
@@ -11333,6 +12052,21 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
11333
12052
|
});
|
|
11334
12053
|
return true;
|
|
11335
12054
|
}
|
|
12055
|
+
const social = getSocialItem(selected);
|
|
12056
|
+
if (social) {
|
|
12057
|
+
const result = removeSocialItem(social, getEditContent());
|
|
12058
|
+
if (!result) return false;
|
|
12059
|
+
finishDelete({
|
|
12060
|
+
toastTitle: "Social deleted",
|
|
12061
|
+
removedKeys: result.removedKeys,
|
|
12062
|
+
previousContent: result.previousContent,
|
|
12063
|
+
orderKey: SOCIALS_ORDER_KEY,
|
|
12064
|
+
orderJson: JSON.stringify(result.order),
|
|
12065
|
+
previousOrderJson: JSON.stringify(result.previousOrder),
|
|
12066
|
+
undoDom: result.undo
|
|
12067
|
+
});
|
|
12068
|
+
return true;
|
|
12069
|
+
}
|
|
11336
12070
|
if (isFooterHrefKey(hrefKey)) {
|
|
11337
12071
|
const result = deleteFooterItem(selected);
|
|
11338
12072
|
if (!result) return false;
|
|
@@ -11352,13 +12086,13 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
11352
12086
|
|
|
11353
12087
|
// src/ui/navbar-container-chrome.tsx
|
|
11354
12088
|
import { Plus as Plus3 } from "lucide-react";
|
|
11355
|
-
import { jsx as
|
|
12089
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
11356
12090
|
function NavbarContainerChrome({
|
|
11357
12091
|
rect,
|
|
11358
12092
|
onAdd
|
|
11359
12093
|
}) {
|
|
11360
12094
|
const chromeGap = 6;
|
|
11361
|
-
return /* @__PURE__ */
|
|
12095
|
+
return /* @__PURE__ */ jsx29(
|
|
11362
12096
|
"div",
|
|
11363
12097
|
{
|
|
11364
12098
|
"data-ohw-navbar-container-chrome": "",
|
|
@@ -11370,7 +12104,7 @@ function NavbarContainerChrome({
|
|
|
11370
12104
|
width: rect.width + chromeGap * 2,
|
|
11371
12105
|
height: rect.height + chromeGap * 2
|
|
11372
12106
|
},
|
|
11373
|
-
children: /* @__PURE__ */
|
|
12107
|
+
children: /* @__PURE__ */ jsx29(
|
|
11374
12108
|
"button",
|
|
11375
12109
|
{
|
|
11376
12110
|
type: "button",
|
|
@@ -11387,7 +12121,7 @@ function NavbarContainerChrome({
|
|
|
11387
12121
|
e.stopPropagation();
|
|
11388
12122
|
onAdd();
|
|
11389
12123
|
},
|
|
11390
|
-
children: /* @__PURE__ */
|
|
12124
|
+
children: /* @__PURE__ */ jsx29(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
11391
12125
|
}
|
|
11392
12126
|
)
|
|
11393
12127
|
}
|
|
@@ -11396,7 +12130,7 @@ function NavbarContainerChrome({
|
|
|
11396
12130
|
|
|
11397
12131
|
// src/ui/drop-indicator.tsx
|
|
11398
12132
|
import * as React10 from "react";
|
|
11399
|
-
import { jsx as
|
|
12133
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
11400
12134
|
var dropIndicatorVariants = cva(
|
|
11401
12135
|
"ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
|
|
11402
12136
|
{
|
|
@@ -11420,7 +12154,7 @@ var dropIndicatorVariants = cva(
|
|
|
11420
12154
|
);
|
|
11421
12155
|
var DropIndicator = React10.forwardRef(
|
|
11422
12156
|
({ className, direction, state, ...props }, ref) => {
|
|
11423
|
-
return /* @__PURE__ */
|
|
12157
|
+
return /* @__PURE__ */ jsx30(
|
|
11424
12158
|
"div",
|
|
11425
12159
|
{
|
|
11426
12160
|
ref,
|
|
@@ -11437,7 +12171,7 @@ var DropIndicator = React10.forwardRef(
|
|
|
11437
12171
|
DropIndicator.displayName = "DropIndicator";
|
|
11438
12172
|
|
|
11439
12173
|
// src/ui/badge.tsx
|
|
11440
|
-
import { jsx as
|
|
12174
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
11441
12175
|
var badgeVariants = cva(
|
|
11442
12176
|
"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",
|
|
11443
12177
|
{
|
|
@@ -11455,12 +12189,12 @@ var badgeVariants = cva(
|
|
|
11455
12189
|
}
|
|
11456
12190
|
);
|
|
11457
12191
|
function Badge({ className, variant, ...props }) {
|
|
11458
|
-
return /* @__PURE__ */
|
|
12192
|
+
return /* @__PURE__ */ jsx31("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
11459
12193
|
}
|
|
11460
12194
|
|
|
11461
12195
|
// src/OhhwellsBridge.tsx
|
|
11462
12196
|
import { Link as Link2 } from "lucide-react";
|
|
11463
|
-
import { Fragment as Fragment8, jsx as
|
|
12197
|
+
import { Fragment as Fragment8, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
11464
12198
|
var PRIMARY3 = "#0885FE";
|
|
11465
12199
|
var IMAGE_FADE_MS = 300;
|
|
11466
12200
|
function runOpacityFade(el, onDone) {
|
|
@@ -11639,7 +12373,7 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
|
|
|
11639
12373
|
const root = createRoot2(container);
|
|
11640
12374
|
flushSync2(() => {
|
|
11641
12375
|
root.render(
|
|
11642
|
-
/* @__PURE__ */
|
|
12376
|
+
/* @__PURE__ */ jsx32(
|
|
11643
12377
|
SchedulingWidget,
|
|
11644
12378
|
{
|
|
11645
12379
|
notifyOnConnect,
|
|
@@ -11687,6 +12421,17 @@ function applyLinkHref(el, val) {
|
|
|
11687
12421
|
const anchor = el instanceof HTMLAnchorElement ? el : el.querySelector("a");
|
|
11688
12422
|
if (anchor) anchor.setAttribute("href", val);
|
|
11689
12423
|
}
|
|
12424
|
+
function currentIconRef(el) {
|
|
12425
|
+
const uploaded = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
12426
|
+
if (uploaded?.getAttribute("src")) {
|
|
12427
|
+
return uploaded.getAttribute("src") ?? "";
|
|
12428
|
+
}
|
|
12429
|
+
const svg = el instanceof SVGElement ? el : el.querySelector("svg");
|
|
12430
|
+
const named = Array.from(svg?.classList ?? []).find(
|
|
12431
|
+
(c) => c.startsWith("lucide-") && c !== "lucide-icon"
|
|
12432
|
+
);
|
|
12433
|
+
return named ? `lucide:${named.slice("lucide-".length)}` : "";
|
|
12434
|
+
}
|
|
11690
12435
|
function getEditMeasureEl(editable) {
|
|
11691
12436
|
return editable.closest("[data-ohw-href-key]") ?? editable;
|
|
11692
12437
|
}
|
|
@@ -11731,8 +12476,11 @@ function isMediaEditable(el) {
|
|
|
11731
12476
|
const t = el.dataset.ohwEditable;
|
|
11732
12477
|
return t === "image" || t === "bg-image" || t === "video";
|
|
11733
12478
|
}
|
|
12479
|
+
function isIconEditable(el) {
|
|
12480
|
+
return el.dataset.ohwEditable === "icon";
|
|
12481
|
+
}
|
|
11734
12482
|
var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [data-ohw-editable="video"]';
|
|
11735
|
-
var NON_MEDIA_SELECTOR = '[data-ohw-editable]:not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"])';
|
|
12483
|
+
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"])';
|
|
11736
12484
|
function getVideoEl2(el) {
|
|
11737
12485
|
return el instanceof HTMLVideoElement ? el : el.querySelector("video");
|
|
11738
12486
|
}
|
|
@@ -11850,13 +12598,29 @@ function isNavItemPointerTarget(el) {
|
|
|
11850
12598
|
function getNavigationItemAnchor(el) {
|
|
11851
12599
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
11852
12600
|
if (!anchor) return null;
|
|
11853
|
-
if (!anchor.querySelector('[data-ohw-editable="text"]')) return null;
|
|
12601
|
+
if (!anchor.querySelector('[data-ohw-editable="text"]') && !getSocialItem(anchor)) return null;
|
|
11854
12602
|
if (!isNavItemPointerTarget(anchor)) return null;
|
|
11855
12603
|
return anchor;
|
|
11856
12604
|
}
|
|
11857
12605
|
function isNavigationItem2(el) {
|
|
11858
12606
|
return getNavigationItemAnchor(el) !== null;
|
|
11859
12607
|
}
|
|
12608
|
+
function requestSocialDialog(anchor, post, content) {
|
|
12609
|
+
const item = getSocialItem(anchor);
|
|
12610
|
+
if (!item) return false;
|
|
12611
|
+
const iconKey = item.querySelector('[data-ohw-editable="icon"]')?.dataset.ohwKey ?? "";
|
|
12612
|
+
post({
|
|
12613
|
+
type: "ow:social-pick",
|
|
12614
|
+
hrefKey: item.getAttribute("data-ohw-href-key") ?? "",
|
|
12615
|
+
iconKey,
|
|
12616
|
+
url: getLinkHref4(item),
|
|
12617
|
+
iconStyle: detectIconStyle(item),
|
|
12618
|
+
// What was chosen last time. Guessing from the address instead reads as "Website" for anything
|
|
12619
|
+
// unrecognised, and for an item with no address at all — so a deliberate choice looked lost.
|
|
12620
|
+
platformId: content[socialPlatformKey(iconKey)] ?? ""
|
|
12621
|
+
});
|
|
12622
|
+
return true;
|
|
12623
|
+
}
|
|
11860
12624
|
function listNavigationItems() {
|
|
11861
12625
|
return Array.from(
|
|
11862
12626
|
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
@@ -11891,7 +12655,7 @@ function getNavigationRoot(el) {
|
|
|
11891
12655
|
return el.closest("nav, footer, aside");
|
|
11892
12656
|
}
|
|
11893
12657
|
function countFooterNavItems(el) {
|
|
11894
|
-
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem2).length;
|
|
12658
|
+
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter((item) => isNavigationItem2(item) && !getSocialItem(item)).length;
|
|
11895
12659
|
}
|
|
11896
12660
|
function findFooterItemGroup2(item) {
|
|
11897
12661
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -11912,10 +12676,11 @@ function isInferredFooterGroup2(el) {
|
|
|
11912
12676
|
const footer = el.closest("footer");
|
|
11913
12677
|
if (!footer || el === footer) return false;
|
|
11914
12678
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
12679
|
+
if (isSocialsRow(el)) return false;
|
|
11915
12680
|
return countFooterNavItems(el) >= 2;
|
|
11916
12681
|
}
|
|
11917
12682
|
function isNavigationContainer(el) {
|
|
11918
|
-
return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el) || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isNavigationRoot(el) || isInferredFooterGroup2(el);
|
|
12683
|
+
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);
|
|
11919
12684
|
}
|
|
11920
12685
|
function isNavbarLinksContainer2(el) {
|
|
11921
12686
|
return el.hasAttribute("data-ohw-nav-container");
|
|
@@ -11998,6 +12763,8 @@ function resolveNavContainerSelectionTarget(target, clientX, clientY) {
|
|
|
11998
12763
|
return null;
|
|
11999
12764
|
}
|
|
12000
12765
|
function getNavigationSelectionParent(el) {
|
|
12766
|
+
const socialsRow = findSocialsRow(el);
|
|
12767
|
+
if (socialsRow) return socialsRow;
|
|
12001
12768
|
if (isNavigationItem2(el)) {
|
|
12002
12769
|
const childrenRoot = el.closest("[data-ohw-nav-children]");
|
|
12003
12770
|
if (childrenRoot) {
|
|
@@ -12023,6 +12790,10 @@ function getNavigationSelectionParent(el) {
|
|
|
12023
12790
|
}
|
|
12024
12791
|
function collectNavigationItemSiblingHintRects(selected) {
|
|
12025
12792
|
if (!isNavigationItem2(selected)) return [];
|
|
12793
|
+
const socialsRow = findSocialsRow(selected);
|
|
12794
|
+
if (socialsRow) {
|
|
12795
|
+
return listSocialItems(socialsRow).filter((item) => item !== selected).map((item) => item.getBoundingClientRect());
|
|
12796
|
+
}
|
|
12026
12797
|
const footerColumn = getFooterColumn(selected);
|
|
12027
12798
|
if (footerColumn) {
|
|
12028
12799
|
return listFooterLinksInColumn(footerColumn).filter((link) => link !== selected).map((link) => link.getBoundingClientRect());
|
|
@@ -12255,7 +13026,7 @@ function EditGlowChrome({
|
|
|
12255
13026
|
hideHandle = false
|
|
12256
13027
|
}) {
|
|
12257
13028
|
const GAP = SELECTION_CHROME_GAP2;
|
|
12258
|
-
return /* @__PURE__ */
|
|
13029
|
+
return /* @__PURE__ */ jsxs19(
|
|
12259
13030
|
"div",
|
|
12260
13031
|
{
|
|
12261
13032
|
ref: elRef,
|
|
@@ -12270,7 +13041,7 @@ function EditGlowChrome({
|
|
|
12270
13041
|
zIndex: 2147483646
|
|
12271
13042
|
},
|
|
12272
13043
|
children: [
|
|
12273
|
-
/* @__PURE__ */
|
|
13044
|
+
/* @__PURE__ */ jsx32(
|
|
12274
13045
|
"div",
|
|
12275
13046
|
{
|
|
12276
13047
|
style: {
|
|
@@ -12283,7 +13054,7 @@ function EditGlowChrome({
|
|
|
12283
13054
|
}
|
|
12284
13055
|
}
|
|
12285
13056
|
),
|
|
12286
|
-
reorderHrefKey && !hideHandle && /* @__PURE__ */
|
|
13057
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ jsx32(
|
|
12287
13058
|
"div",
|
|
12288
13059
|
{
|
|
12289
13060
|
"data-ohw-drag-handle-container": "",
|
|
@@ -12295,7 +13066,7 @@ function EditGlowChrome({
|
|
|
12295
13066
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
12296
13067
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
12297
13068
|
},
|
|
12298
|
-
children: /* @__PURE__ */
|
|
13069
|
+
children: /* @__PURE__ */ jsx32(
|
|
12299
13070
|
DragHandle,
|
|
12300
13071
|
{
|
|
12301
13072
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -12505,7 +13276,7 @@ function FloatingToolbar({
|
|
|
12505
13276
|
return () => ro.disconnect();
|
|
12506
13277
|
}, [showEditLink, activeCommands]);
|
|
12507
13278
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
12508
|
-
return /* @__PURE__ */
|
|
13279
|
+
return /* @__PURE__ */ jsx32(
|
|
12509
13280
|
"div",
|
|
12510
13281
|
{
|
|
12511
13282
|
ref: setRefs,
|
|
@@ -12517,12 +13288,12 @@ function FloatingToolbar({
|
|
|
12517
13288
|
zIndex: 2147483647,
|
|
12518
13289
|
pointerEvents: "auto"
|
|
12519
13290
|
},
|
|
12520
|
-
children: /* @__PURE__ */
|
|
12521
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */
|
|
12522
|
-
gi > 0 && /* @__PURE__ */
|
|
13291
|
+
children: /* @__PURE__ */ jsxs19(CustomToolbar, { children: [
|
|
13292
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ jsxs19(React11.Fragment, { children: [
|
|
13293
|
+
gi > 0 && /* @__PURE__ */ jsx32(CustomToolbarDivider, {}),
|
|
12523
13294
|
btns.map((btn) => {
|
|
12524
13295
|
const isActive = activeCommands.has(btn.cmd);
|
|
12525
|
-
return /* @__PURE__ */
|
|
13296
|
+
return /* @__PURE__ */ jsx32(
|
|
12526
13297
|
CustomToolbarButton,
|
|
12527
13298
|
{
|
|
12528
13299
|
title: btn.title,
|
|
@@ -12531,7 +13302,7 @@ function FloatingToolbar({
|
|
|
12531
13302
|
e.preventDefault();
|
|
12532
13303
|
onCommand(btn.cmd);
|
|
12533
13304
|
},
|
|
12534
|
-
children: /* @__PURE__ */
|
|
13305
|
+
children: /* @__PURE__ */ jsx32(
|
|
12535
13306
|
"svg",
|
|
12536
13307
|
{
|
|
12537
13308
|
width: "16",
|
|
@@ -12552,7 +13323,7 @@ function FloatingToolbar({
|
|
|
12552
13323
|
);
|
|
12553
13324
|
})
|
|
12554
13325
|
] }, gi)),
|
|
12555
|
-
showEditLink ? /* @__PURE__ */
|
|
13326
|
+
showEditLink ? /* @__PURE__ */ jsx32(
|
|
12556
13327
|
CustomToolbarButton,
|
|
12557
13328
|
{
|
|
12558
13329
|
type: "button",
|
|
@@ -12566,7 +13337,7 @@ function FloatingToolbar({
|
|
|
12566
13337
|
e.preventDefault();
|
|
12567
13338
|
e.stopPropagation();
|
|
12568
13339
|
},
|
|
12569
|
-
children: /* @__PURE__ */
|
|
13340
|
+
children: /* @__PURE__ */ jsx32(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
12570
13341
|
}
|
|
12571
13342
|
) : null
|
|
12572
13343
|
] })
|
|
@@ -12583,7 +13354,7 @@ function StateToggle({
|
|
|
12583
13354
|
states,
|
|
12584
13355
|
onStateChange
|
|
12585
13356
|
}) {
|
|
12586
|
-
return /* @__PURE__ */
|
|
13357
|
+
return /* @__PURE__ */ jsx32(
|
|
12587
13358
|
ToggleGroup,
|
|
12588
13359
|
{
|
|
12589
13360
|
"data-ohw-state-toggle": "",
|
|
@@ -12597,7 +13368,7 @@ function StateToggle({
|
|
|
12597
13368
|
left: rect.right - 8,
|
|
12598
13369
|
transform: "translateX(-100%)"
|
|
12599
13370
|
},
|
|
12600
|
-
children: states.map((state) => /* @__PURE__ */
|
|
13371
|
+
children: states.map((state) => /* @__PURE__ */ jsx32(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
12601
13372
|
}
|
|
12602
13373
|
);
|
|
12603
13374
|
}
|
|
@@ -12624,8 +13395,8 @@ function OhhwellsBridge() {
|
|
|
12624
13395
|
const router = useRouter3();
|
|
12625
13396
|
const searchParams = useSearchParams();
|
|
12626
13397
|
const isEditMode = isEditSessionActive();
|
|
12627
|
-
const [bridgeRoot, setBridgeRoot] =
|
|
12628
|
-
|
|
13398
|
+
const [bridgeRoot, setBridgeRoot] = useState11(null);
|
|
13399
|
+
useEffect12(() => {
|
|
12629
13400
|
const figtreeFontId = "ohw-figtree-font";
|
|
12630
13401
|
if (!document.getElementById(figtreeFontId)) {
|
|
12631
13402
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -12654,108 +13425,113 @@ function OhhwellsBridge() {
|
|
|
12654
13425
|
const subdomain = resolveSubdomain(subdomainFromQuery);
|
|
12655
13426
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
12656
13427
|
useSavedLinkNavigation(isEditMode);
|
|
12657
|
-
const postToParent2 =
|
|
13428
|
+
const postToParent2 = useCallback7((data) => {
|
|
12658
13429
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
12659
13430
|
window.parent.postMessage(data, "*");
|
|
12660
13431
|
}
|
|
12661
13432
|
}, []);
|
|
12662
|
-
const [fetchState, setFetchState] =
|
|
12663
|
-
const autoSaveTimers =
|
|
12664
|
-
const activeElRef =
|
|
12665
|
-
const pointerHeldRef =
|
|
12666
|
-
const selectedElRef =
|
|
12667
|
-
const selectedHrefKeyRef =
|
|
12668
|
-
const selectedFooterColAttrRef =
|
|
12669
|
-
const originalContentRef =
|
|
12670
|
-
const activeStateElRef =
|
|
12671
|
-
const parentScrollRef =
|
|
12672
|
-
const visibleViewportRef =
|
|
12673
|
-
const [dialogPortalContainer, setDialogPortalContainer] =
|
|
12674
|
-
const attachVisibleViewport =
|
|
13433
|
+
const [fetchState, setFetchState] = useState11("idle");
|
|
13434
|
+
const autoSaveTimers = useRef9(/* @__PURE__ */ new Map());
|
|
13435
|
+
const activeElRef = useRef9(null);
|
|
13436
|
+
const pointerHeldRef = useRef9(false);
|
|
13437
|
+
const selectedElRef = useRef9(null);
|
|
13438
|
+
const selectedHrefKeyRef = useRef9(null);
|
|
13439
|
+
const selectedFooterColAttrRef = useRef9(null);
|
|
13440
|
+
const originalContentRef = useRef9(null);
|
|
13441
|
+
const activeStateElRef = useRef9(null);
|
|
13442
|
+
const parentScrollRef = useRef9(null);
|
|
13443
|
+
const visibleViewportRef = useRef9(null);
|
|
13444
|
+
const [dialogPortalContainer, setDialogPortalContainer] = useState11(null);
|
|
13445
|
+
const attachVisibleViewport = useCallback7((node) => {
|
|
12675
13446
|
visibleViewportRef.current = node;
|
|
12676
13447
|
setDialogPortalContainer(node);
|
|
12677
13448
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
12678
13449
|
}, []);
|
|
12679
|
-
const toolbarElRef =
|
|
12680
|
-
const glowElRef =
|
|
12681
|
-
const hoveredImageRef =
|
|
12682
|
-
const hoveredImageHasTextOverlapRef =
|
|
12683
|
-
const dragOverElRef =
|
|
12684
|
-
const [mediaHover, setMediaHover] =
|
|
12685
|
-
const [carouselHover, setCarouselHover] =
|
|
12686
|
-
const [uploadingRects, setUploadingRects] =
|
|
12687
|
-
const hoveredGapRef =
|
|
12688
|
-
const imageUnhoverTimerRef =
|
|
12689
|
-
const imageShowTimerRef =
|
|
12690
|
-
const editStylesRef =
|
|
12691
|
-
const activateRef =
|
|
13450
|
+
const toolbarElRef = useRef9(null);
|
|
13451
|
+
const glowElRef = useRef9(null);
|
|
13452
|
+
const hoveredImageRef = useRef9(null);
|
|
13453
|
+
const hoveredImageHasTextOverlapRef = useRef9(false);
|
|
13454
|
+
const dragOverElRef = useRef9(null);
|
|
13455
|
+
const [mediaHover, setMediaHover] = useState11(null);
|
|
13456
|
+
const [carouselHover, setCarouselHover] = useState11(null);
|
|
13457
|
+
const [uploadingRects, setUploadingRects] = useState11({});
|
|
13458
|
+
const hoveredGapRef = useRef9(null);
|
|
13459
|
+
const imageUnhoverTimerRef = useRef9(null);
|
|
13460
|
+
const imageShowTimerRef = useRef9(null);
|
|
13461
|
+
const editStylesRef = useRef9(null);
|
|
13462
|
+
const activateRef = useRef9(() => {
|
|
12692
13463
|
});
|
|
12693
|
-
const deactivateRef =
|
|
13464
|
+
const deactivateRef = useRef9(() => {
|
|
12694
13465
|
});
|
|
12695
|
-
const selectRef =
|
|
13466
|
+
const selectRef = useRef9(() => {
|
|
12696
13467
|
});
|
|
12697
|
-
const selectFrameRef =
|
|
13468
|
+
const selectFrameRef = useRef9(() => {
|
|
12698
13469
|
});
|
|
12699
|
-
const deselectRef =
|
|
13470
|
+
const deselectRef = useRef9(() => {
|
|
12700
13471
|
});
|
|
12701
|
-
const reselectNavigationItemRef =
|
|
13472
|
+
const reselectNavigationItemRef = useRef9(() => {
|
|
12702
13473
|
});
|
|
12703
|
-
const commitNavigationTextEditRef =
|
|
13474
|
+
const commitNavigationTextEditRef = useRef9(() => {
|
|
12704
13475
|
});
|
|
12705
|
-
const handleDeleteSelectedRef =
|
|
12706
|
-
const runPendingDeleteUndoRef =
|
|
12707
|
-
const isFooterFrameSelectionRef =
|
|
12708
|
-
const refreshActiveCommandsRef =
|
|
13476
|
+
const handleDeleteSelectedRef = useRef9(() => false);
|
|
13477
|
+
const runPendingDeleteUndoRef = useRef9(() => false);
|
|
13478
|
+
const isFooterFrameSelectionRef = useRef9(false);
|
|
13479
|
+
const refreshActiveCommandsRef = useRef9(() => {
|
|
12709
13480
|
});
|
|
12710
|
-
const postToParentRef =
|
|
13481
|
+
const postToParentRef = useRef9(postToParent2);
|
|
12711
13482
|
postToParentRef.current = postToParent2;
|
|
12712
|
-
const aiSectionApiRef =
|
|
12713
|
-
const sectionsLoadedRef =
|
|
12714
|
-
const pendingScheduleConfigRequests =
|
|
12715
|
-
const [toolbarRect, setToolbarRect] =
|
|
12716
|
-
const [toolbarVariant, setToolbarVariant] =
|
|
12717
|
-
const toolbarVariantRef =
|
|
13483
|
+
const aiSectionApiRef = useRef9(null);
|
|
13484
|
+
const sectionsLoadedRef = useRef9(false);
|
|
13485
|
+
const pendingScheduleConfigRequests = useRef9([]);
|
|
13486
|
+
const [toolbarRect, setToolbarRect] = useState11(null);
|
|
13487
|
+
const [toolbarVariant, setToolbarVariant] = useState11("none");
|
|
13488
|
+
const toolbarVariantRef = useRef9("none");
|
|
12718
13489
|
toolbarVariantRef.current = toolbarVariant;
|
|
12719
|
-
const [selectedIsCta, setSelectedIsCta] =
|
|
12720
|
-
const [
|
|
12721
|
-
const [
|
|
12722
|
-
const [
|
|
12723
|
-
const [
|
|
12724
|
-
const [
|
|
12725
|
-
const [
|
|
12726
|
-
const [
|
|
12727
|
-
const
|
|
12728
|
-
const [
|
|
12729
|
-
const
|
|
12730
|
-
const [
|
|
12731
|
-
const
|
|
12732
|
-
const [
|
|
12733
|
-
const
|
|
12734
|
-
const [
|
|
12735
|
-
const [
|
|
13490
|
+
const [selectedIsCta, setSelectedIsCta] = useState11(false);
|
|
13491
|
+
const [selectedIsSocial, setSelectedIsSocial] = useState11(false);
|
|
13492
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = useState11(false);
|
|
13493
|
+
const [reorderHrefKey, setReorderHrefKey] = useState11(null);
|
|
13494
|
+
const [reorderDragDisabled, setReorderDragDisabled] = useState11(false);
|
|
13495
|
+
const [toggleState, setToggleState] = useState11(null);
|
|
13496
|
+
const [maxBadge, setMaxBadge] = useState11(null);
|
|
13497
|
+
const [activeCommands, setActiveCommands] = useState11(/* @__PURE__ */ new Set());
|
|
13498
|
+
const [sectionGap, setSectionGap] = useState11(null);
|
|
13499
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = useState11(false);
|
|
13500
|
+
const hoveredNavContainerRef = useRef9(null);
|
|
13501
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = useState11(null);
|
|
13502
|
+
const hoveredItemElRef = useRef9(null);
|
|
13503
|
+
const [hoveredItemRect, setHoveredItemRect] = useState11(null);
|
|
13504
|
+
const siblingHintElRef = useRef9(null);
|
|
13505
|
+
const [siblingHintRect, setSiblingHintRect] = useState11(null);
|
|
13506
|
+
const [siblingHintRects, setSiblingHintRects] = useState11([]);
|
|
13507
|
+
const [isItemDragging, setIsItemDragging] = useState11(false);
|
|
13508
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState11(false);
|
|
12736
13509
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
12737
|
-
const [
|
|
12738
|
-
const [
|
|
12739
|
-
const
|
|
12740
|
-
const [
|
|
12741
|
-
const [
|
|
12742
|
-
const
|
|
12743
|
-
const
|
|
12744
|
-
const
|
|
12745
|
-
const
|
|
12746
|
-
const
|
|
12747
|
-
const
|
|
12748
|
-
const
|
|
12749
|
-
const
|
|
12750
|
-
const
|
|
12751
|
-
const
|
|
12752
|
-
const
|
|
12753
|
-
const
|
|
12754
|
-
const
|
|
12755
|
-
const
|
|
12756
|
-
const
|
|
12757
|
-
const
|
|
12758
|
-
const
|
|
13510
|
+
const [floatingPanel, setFloatingPanel] = useState11(null);
|
|
13511
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState11(null);
|
|
13512
|
+
const [parentScrollSnap, setParentScrollSnap] = useState11(null);
|
|
13513
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState11(null);
|
|
13514
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = useState11(null);
|
|
13515
|
+
const footerDragRef = useRef9(null);
|
|
13516
|
+
const [footerDropSlots, setFooterDropSlots] = useState11([]);
|
|
13517
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = useState11(null);
|
|
13518
|
+
const [draggedItemRect, setDraggedItemRect] = useState11(null);
|
|
13519
|
+
const footerPointerDragRef = useRef9(null);
|
|
13520
|
+
const suppressNextClickRef = useRef9(false);
|
|
13521
|
+
const suppressClickUntilRef = useRef9(0);
|
|
13522
|
+
const [linkPopover, setLinkPopover] = useState11(null);
|
|
13523
|
+
const linkPopoverSessionRef = useRef9(null);
|
|
13524
|
+
const addNavAfterAnchorRef = useRef9(null);
|
|
13525
|
+
const editContentRef = useRef9({});
|
|
13526
|
+
const aiSectionsRef = useRef9("");
|
|
13527
|
+
const pendingDeleteUndoRef = useRef9(null);
|
|
13528
|
+
const [sitePages, setSitePages] = useState11([]);
|
|
13529
|
+
const [sectionsByPath, setSectionsByPath] = useState11({});
|
|
13530
|
+
const sectionsPrefetchGenRef = useRef9(0);
|
|
13531
|
+
const setLinkPopoverRef = useRef9(setLinkPopover);
|
|
13532
|
+
const linkPopoverPanelRef = useRef9(null);
|
|
13533
|
+
const linkPopoverOpenRef = useRef9(false);
|
|
13534
|
+
const linkPopoverGraceUntilRef = useRef9(0);
|
|
12759
13535
|
setLinkPopoverRef.current = setLinkPopover;
|
|
12760
13536
|
linkPopoverSessionRef.current = linkPopover;
|
|
12761
13537
|
const {
|
|
@@ -12793,7 +13569,7 @@ function OhhwellsBridge() {
|
|
|
12793
13569
|
const bumpLinkPopoverGrace = () => {
|
|
12794
13570
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
12795
13571
|
};
|
|
12796
|
-
const runSectionsPrefetch =
|
|
13572
|
+
const runSectionsPrefetch = useCallback7((pages) => {
|
|
12797
13573
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
12798
13574
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
12799
13575
|
const paths = pages.map((p) => p.path);
|
|
@@ -12812,9 +13588,9 @@ function OhhwellsBridge() {
|
|
|
12812
13588
|
);
|
|
12813
13589
|
});
|
|
12814
13590
|
}, [isEditMode, pathname]);
|
|
12815
|
-
const runSectionsPrefetchRef =
|
|
13591
|
+
const runSectionsPrefetchRef = useRef9(runSectionsPrefetch);
|
|
12816
13592
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
12817
|
-
|
|
13593
|
+
useEffect12(() => {
|
|
12818
13594
|
if (!linkPopover) {
|
|
12819
13595
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
12820
13596
|
return;
|
|
@@ -12842,7 +13618,7 @@ function OhhwellsBridge() {
|
|
|
12842
13618
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
12843
13619
|
};
|
|
12844
13620
|
}, [linkPopover, postToParent2]);
|
|
12845
|
-
|
|
13621
|
+
useEffect12(() => {
|
|
12846
13622
|
if (!isEditMode) return;
|
|
12847
13623
|
const useFixtures = shouldUseDevFixtures();
|
|
12848
13624
|
if (useFixtures) {
|
|
@@ -12866,14 +13642,14 @@ function OhhwellsBridge() {
|
|
|
12866
13642
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
12867
13643
|
return () => window.removeEventListener("message", onSitePages);
|
|
12868
13644
|
}, [isEditMode, postToParent2]);
|
|
12869
|
-
|
|
13645
|
+
useEffect12(() => {
|
|
12870
13646
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
12871
13647
|
void loadAllSectionsManifest().then((manifest) => {
|
|
12872
13648
|
if (Object.keys(manifest).length === 0) return;
|
|
12873
13649
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
12874
13650
|
});
|
|
12875
13651
|
}, [isEditMode]);
|
|
12876
|
-
|
|
13652
|
+
useEffect12(() => {
|
|
12877
13653
|
const update = () => {
|
|
12878
13654
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
12879
13655
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -12897,10 +13673,10 @@ function OhhwellsBridge() {
|
|
|
12897
13673
|
vvp.removeEventListener("resize", update);
|
|
12898
13674
|
};
|
|
12899
13675
|
}, []);
|
|
12900
|
-
const refreshStateRules =
|
|
13676
|
+
const refreshStateRules = useCallback7(() => {
|
|
12901
13677
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
12902
13678
|
}, []);
|
|
12903
|
-
const processConfigRequest =
|
|
13679
|
+
const processConfigRequest = useCallback7((insertAfterVal) => {
|
|
12904
13680
|
const tracker = getSectionsTracker();
|
|
12905
13681
|
let entries = [];
|
|
12906
13682
|
try {
|
|
@@ -12923,7 +13699,7 @@ function OhhwellsBridge() {
|
|
|
12923
13699
|
}
|
|
12924
13700
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
12925
13701
|
}, [isEditMode]);
|
|
12926
|
-
const deactivate =
|
|
13702
|
+
const deactivate = useCallback7(() => {
|
|
12927
13703
|
const el = activeElRef.current;
|
|
12928
13704
|
if (!el) return;
|
|
12929
13705
|
const key = el.dataset.ohwKey;
|
|
@@ -12956,17 +13732,19 @@ function OhhwellsBridge() {
|
|
|
12956
13732
|
setToolbarShowEditLink(false);
|
|
12957
13733
|
postToParent2({ type: "ow:exit-edit" });
|
|
12958
13734
|
}, [postToParent2]);
|
|
12959
|
-
const clearSelectedAttr =
|
|
13735
|
+
const clearSelectedAttr = useCallback7(() => {
|
|
12960
13736
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
12961
13737
|
el.removeAttribute("data-ohw-selected");
|
|
12962
13738
|
});
|
|
12963
13739
|
}, []);
|
|
12964
|
-
const deselect =
|
|
13740
|
+
const deselect = useCallback7(() => {
|
|
12965
13741
|
clearSelectedAttr();
|
|
12966
13742
|
selectedElRef.current = null;
|
|
12967
13743
|
selectedHrefKeyRef.current = null;
|
|
12968
13744
|
selectedFooterColAttrRef.current = null;
|
|
12969
13745
|
setSelectedIsCta(false);
|
|
13746
|
+
setSelectedIsSocial(false);
|
|
13747
|
+
setSelectedIsSocialsRow(false);
|
|
12970
13748
|
setReorderHrefKey(null);
|
|
12971
13749
|
setReorderDragDisabled(false);
|
|
12972
13750
|
setIsFooterFrameSelection(false);
|
|
@@ -12984,11 +13762,11 @@ function OhhwellsBridge() {
|
|
|
12984
13762
|
setToolbarVariant("none");
|
|
12985
13763
|
}
|
|
12986
13764
|
}, [clearSelectedAttr]);
|
|
12987
|
-
const markSelected =
|
|
13765
|
+
const markSelected = useCallback7((el) => {
|
|
12988
13766
|
clearSelectedAttr();
|
|
12989
13767
|
el.setAttribute("data-ohw-selected", "");
|
|
12990
13768
|
}, [clearSelectedAttr]);
|
|
12991
|
-
const resolveHrefKeyElement =
|
|
13769
|
+
const resolveHrefKeyElement = useCallback7((hrefKey) => {
|
|
12992
13770
|
if (isFooterHrefKey(hrefKey)) {
|
|
12993
13771
|
return document.querySelector(
|
|
12994
13772
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -13003,7 +13781,7 @@ function OhhwellsBridge() {
|
|
|
13003
13781
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
13004
13782
|
);
|
|
13005
13783
|
}, []);
|
|
13006
|
-
const resyncSelectedNavigationItem =
|
|
13784
|
+
const resyncSelectedNavigationItem = useCallback7(() => {
|
|
13007
13785
|
const hrefKey = selectedHrefKeyRef.current;
|
|
13008
13786
|
if (hrefKey) {
|
|
13009
13787
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -13041,12 +13819,14 @@ function OhhwellsBridge() {
|
|
|
13041
13819
|
);
|
|
13042
13820
|
}
|
|
13043
13821
|
}, [resolveHrefKeyElement]);
|
|
13044
|
-
const reselectNavigationItem =
|
|
13822
|
+
const reselectNavigationItem = useCallback7((navAnchor) => {
|
|
13045
13823
|
selectedElRef.current = navAnchor;
|
|
13046
13824
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
13047
13825
|
selectedFooterColAttrRef.current = null;
|
|
13048
13826
|
markSelected(navAnchor);
|
|
13049
13827
|
setSelectedIsCta(isCtaButton(navAnchor));
|
|
13828
|
+
setSelectedIsSocial(Boolean(getSocialItem(navAnchor)));
|
|
13829
|
+
setSelectedIsSocialsRow(false);
|
|
13050
13830
|
const isDropdownTrigger = !isNestedNavChild(navAnchor) && (navItemHasDropdownChildren(navAnchor) || navItemOwnsDropdownPanel(navAnchor));
|
|
13051
13831
|
if (isNestedNavChild(navAnchor)) {
|
|
13052
13832
|
setNavGroupForceOpen(navAnchor, true);
|
|
@@ -13070,7 +13850,7 @@ function OhhwellsBridge() {
|
|
|
13070
13850
|
setToolbarShowEditLink(false);
|
|
13071
13851
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
13072
13852
|
}, [markSelected]);
|
|
13073
|
-
const commitNavigationTextEdit =
|
|
13853
|
+
const commitNavigationTextEdit = useCallback7((navAnchor) => {
|
|
13074
13854
|
const el = activeElRef.current;
|
|
13075
13855
|
if (!el) return;
|
|
13076
13856
|
const key = el.dataset.ohwKey;
|
|
@@ -13097,7 +13877,7 @@ function OhhwellsBridge() {
|
|
|
13097
13877
|
postToParent2({ type: "ow:exit-edit" });
|
|
13098
13878
|
reselectNavigationItem(navAnchor);
|
|
13099
13879
|
}, [postToParent2, reselectNavigationItem]);
|
|
13100
|
-
const handleAddTopLevelNavItem =
|
|
13880
|
+
const handleAddTopLevelNavItem = useCallback7(() => {
|
|
13101
13881
|
const items = listNavbarRootItems();
|
|
13102
13882
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
13103
13883
|
deselectRef.current();
|
|
@@ -13109,7 +13889,7 @@ function OhhwellsBridge() {
|
|
|
13109
13889
|
intent: "add-nav"
|
|
13110
13890
|
});
|
|
13111
13891
|
}, []);
|
|
13112
|
-
const maybeWarnNavLinkDropdownConflict =
|
|
13892
|
+
const maybeWarnNavLinkDropdownConflict = useCallback7(
|
|
13113
13893
|
(anchor) => {
|
|
13114
13894
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
13115
13895
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -13122,7 +13902,7 @@ function OhhwellsBridge() {
|
|
|
13122
13902
|
},
|
|
13123
13903
|
[postToParent2]
|
|
13124
13904
|
);
|
|
13125
|
-
const handleNavDropdownOpenChange =
|
|
13905
|
+
const handleNavDropdownOpenChange = useCallback7((open) => {
|
|
13126
13906
|
const selected = selectedElRef.current;
|
|
13127
13907
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
13128
13908
|
setNavGroupForceOpen(selected, open);
|
|
@@ -13134,7 +13914,7 @@ function OhhwellsBridge() {
|
|
|
13134
13914
|
}
|
|
13135
13915
|
});
|
|
13136
13916
|
}, []);
|
|
13137
|
-
const handleFooterHeadingVisibleChange =
|
|
13917
|
+
const handleFooterHeadingVisibleChange = useCallback7(
|
|
13138
13918
|
(visible) => {
|
|
13139
13919
|
const selected = selectedElRef.current;
|
|
13140
13920
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -13158,7 +13938,7 @@ function OhhwellsBridge() {
|
|
|
13158
13938
|
},
|
|
13159
13939
|
[postToParent2]
|
|
13160
13940
|
);
|
|
13161
|
-
const enterEditOnNewItem =
|
|
13941
|
+
const enterEditOnNewItem = useCallback7((anchor) => {
|
|
13162
13942
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
13163
13943
|
if (!label) {
|
|
13164
13944
|
selectRef.current(anchor);
|
|
@@ -13167,9 +13947,31 @@ function OhhwellsBridge() {
|
|
|
13167
13947
|
setNavGroupForceOpen(anchor, true);
|
|
13168
13948
|
activateRef.current(label);
|
|
13169
13949
|
}, []);
|
|
13170
|
-
const handleAddChildItem =
|
|
13950
|
+
const handleAddChildItem = useCallback7(() => {
|
|
13171
13951
|
const selected = selectedElRef.current;
|
|
13172
13952
|
if (!selected) return;
|
|
13953
|
+
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
13954
|
+
if (socialsRow) {
|
|
13955
|
+
const after = getSocialItem(selected);
|
|
13956
|
+
const result2 = insertSocialItem(socialsRow, after, editContentRef.current);
|
|
13957
|
+
if (!result2) return;
|
|
13958
|
+
const orderJson = JSON.stringify(result2.order);
|
|
13959
|
+
applySocialsDisplayToRow(socialsRow, socialsDisplayFor(socialsRow, editContentRef.current));
|
|
13960
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
13961
|
+
postToParent2({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
13962
|
+
postToParentRef.current({
|
|
13963
|
+
type: "ow:social-pick",
|
|
13964
|
+
hrefKey: result2.hrefKey,
|
|
13965
|
+
iconKey: result2.iconKey,
|
|
13966
|
+
url: "",
|
|
13967
|
+
iconStyle: detectIconStyle(result2.item),
|
|
13968
|
+
platformId: "",
|
|
13969
|
+
// Lets the editor undo the insert if the dialog is dismissed: an item that was never given
|
|
13970
|
+
// an address should not survive a Cancel.
|
|
13971
|
+
isNew: true
|
|
13972
|
+
});
|
|
13973
|
+
return;
|
|
13974
|
+
}
|
|
13173
13975
|
if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
|
|
13174
13976
|
if (!selected.hasAttribute("data-ohw-footer-col") && !selected.closest("[data-ohw-footer-col]")) {
|
|
13175
13977
|
}
|
|
@@ -13243,7 +14045,7 @@ function OhhwellsBridge() {
|
|
|
13243
14045
|
enterEditOnNewItem(result.anchor);
|
|
13244
14046
|
});
|
|
13245
14047
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
13246
|
-
const handleAddFooterColumn =
|
|
14048
|
+
const handleAddFooterColumn = useCallback7(() => {
|
|
13247
14049
|
if (!canAddFooterColumn()) {
|
|
13248
14050
|
postToParent2({
|
|
13249
14051
|
type: "ow:toast",
|
|
@@ -13264,7 +14066,7 @@ function OhhwellsBridge() {
|
|
|
13264
14066
|
selectRef.current(result.firstLink);
|
|
13265
14067
|
});
|
|
13266
14068
|
}, [postToParent2]);
|
|
13267
|
-
const clearFooterDragVisuals =
|
|
14069
|
+
const clearFooterDragVisuals = useCallback7(() => {
|
|
13268
14070
|
footerDragRef.current = null;
|
|
13269
14071
|
setSiblingHintRects([]);
|
|
13270
14072
|
setFooterDropSlots([]);
|
|
@@ -13273,7 +14075,7 @@ function OhhwellsBridge() {
|
|
|
13273
14075
|
setIsItemDragging(false);
|
|
13274
14076
|
unlockFooterDragInteraction();
|
|
13275
14077
|
}, []);
|
|
13276
|
-
const refreshFooterDragVisuals =
|
|
14078
|
+
const refreshFooterDragVisuals = useCallback7((session, activeSlot, clientX, clientY) => {
|
|
13277
14079
|
const dragged = session.draggedEl;
|
|
13278
14080
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
13279
14081
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -13282,6 +14084,13 @@ function OhhwellsBridge() {
|
|
|
13282
14084
|
}
|
|
13283
14085
|
session.activeSlot = activeSlot;
|
|
13284
14086
|
setSiblingHintRects([]);
|
|
14087
|
+
if (session.kind === "social") {
|
|
14088
|
+
const slots2 = session.hrefKey ? buildSocialDropSlotsForKey(session.hrefKey) : [];
|
|
14089
|
+
setFooterDropSlots(slots2);
|
|
14090
|
+
const activeIdx2 = activeSlot ? slots2.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
14091
|
+
setActiveFooterDropIndex(activeIdx2 >= 0 ? activeIdx2 : null);
|
|
14092
|
+
return;
|
|
14093
|
+
}
|
|
13285
14094
|
if (session.kind === "link") {
|
|
13286
14095
|
const columns = listFooterColumns();
|
|
13287
14096
|
const slots2 = [];
|
|
@@ -13298,13 +14107,13 @@ function OhhwellsBridge() {
|
|
|
13298
14107
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
13299
14108
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
13300
14109
|
}, []);
|
|
13301
|
-
const refreshFooterDragVisualsRef =
|
|
14110
|
+
const refreshFooterDragVisualsRef = useRef9(refreshFooterDragVisuals);
|
|
13302
14111
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
13303
|
-
const commitFooterDragRef =
|
|
14112
|
+
const commitFooterDragRef = useRef9(() => {
|
|
13304
14113
|
});
|
|
13305
|
-
const beginFooterDragRef =
|
|
14114
|
+
const beginFooterDragRef = useRef9(() => {
|
|
13306
14115
|
});
|
|
13307
|
-
const beginFooterDrag =
|
|
14116
|
+
const beginFooterDrag = useCallback7(
|
|
13308
14117
|
(session) => {
|
|
13309
14118
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
13310
14119
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -13318,13 +14127,13 @@ function OhhwellsBridge() {
|
|
|
13318
14127
|
if (session.wasSelected && selectedElRef.current === session.draggedEl) {
|
|
13319
14128
|
setToolbarRect(rect);
|
|
13320
14129
|
}
|
|
13321
|
-
const initialSlot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
14130
|
+
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);
|
|
13322
14131
|
refreshFooterDragVisuals(session, initialSlot, session.lastClientX, session.lastClientY);
|
|
13323
14132
|
},
|
|
13324
14133
|
[refreshFooterDragVisuals]
|
|
13325
14134
|
);
|
|
13326
14135
|
beginFooterDragRef.current = beginFooterDrag;
|
|
13327
|
-
const commitFooterDrag =
|
|
14136
|
+
const commitFooterDrag = useCallback7(
|
|
13328
14137
|
(clientX, clientY) => {
|
|
13329
14138
|
const session = footerDragRef.current;
|
|
13330
14139
|
if (!session) {
|
|
@@ -13334,8 +14143,11 @@ function OhhwellsBridge() {
|
|
|
13334
14143
|
const x = typeof clientX === "number" && (clientX !== 0 || clientY !== 0) ? clientX : session.lastClientX;
|
|
13335
14144
|
const y = typeof clientY === "number" && (clientX !== 0 || clientY !== 0) ? clientY : session.lastClientY;
|
|
13336
14145
|
let nextOrder = null;
|
|
13337
|
-
|
|
13338
|
-
|
|
14146
|
+
let nextSocialsOrder = null;
|
|
14147
|
+
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);
|
|
14148
|
+
if (session.kind === "social" && session.hrefKey && slot) {
|
|
14149
|
+
nextSocialsOrder = planSocialMove(session.hrefKey, slot.insertIndex);
|
|
14150
|
+
} else if (session.kind === "link" && session.hrefKey && slot) {
|
|
13339
14151
|
nextOrder = planFooterLinkMove(session.hrefKey, slot.columnIndex, slot.insertIndex);
|
|
13340
14152
|
} else if (session.kind === "column" && slot) {
|
|
13341
14153
|
nextOrder = planFooterColumnMove(session.sourceColumnIndex, slot.insertIndex);
|
|
@@ -13393,6 +14205,27 @@ function OhhwellsBridge() {
|
|
|
13393
14205
|
}
|
|
13394
14206
|
deselectRef.current();
|
|
13395
14207
|
};
|
|
14208
|
+
if (nextSocialsOrder) {
|
|
14209
|
+
const orderJson = JSON.stringify(nextSocialsOrder);
|
|
14210
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14211
|
+
applySocialsOrder(nextSocialsOrder);
|
|
14212
|
+
postToParentRef.current({
|
|
14213
|
+
type: "ow:change",
|
|
14214
|
+
nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }]
|
|
14215
|
+
});
|
|
14216
|
+
applySelectionAfterDrop();
|
|
14217
|
+
clearFooterDragVisuals();
|
|
14218
|
+
const reapply = nextSocialsOrder;
|
|
14219
|
+
requestAnimationFrame(() => {
|
|
14220
|
+
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14221
|
+
applySelectionAfterDrop();
|
|
14222
|
+
requestAnimationFrame(() => {
|
|
14223
|
+
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14224
|
+
resyncSelectedNavigationItem();
|
|
14225
|
+
});
|
|
14226
|
+
});
|
|
14227
|
+
return;
|
|
14228
|
+
}
|
|
13396
14229
|
if (nextOrder) {
|
|
13397
14230
|
const orderJson = JSON.stringify(nextOrder);
|
|
13398
14231
|
editContentRef.current = {
|
|
@@ -13428,10 +14261,25 @@ function OhhwellsBridge() {
|
|
|
13428
14261
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
13429
14262
|
);
|
|
13430
14263
|
commitFooterDragRef.current = commitFooterDrag;
|
|
13431
|
-
const startFooterLinkDrag =
|
|
14264
|
+
const startFooterLinkDrag = useCallback7(
|
|
13432
14265
|
(anchor, clientX, clientY, wasSelected) => {
|
|
13433
14266
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
13434
|
-
if (!hrefKey
|
|
14267
|
+
if (!hrefKey) return false;
|
|
14268
|
+
if (getSocialItem(anchor)) {
|
|
14269
|
+
beginFooterDrag({
|
|
14270
|
+
kind: "social",
|
|
14271
|
+
hrefKey,
|
|
14272
|
+
columnEl: null,
|
|
14273
|
+
sourceColumnIndex: 0,
|
|
14274
|
+
wasSelected,
|
|
14275
|
+
draggedEl: anchor,
|
|
14276
|
+
lastClientX: clientX,
|
|
14277
|
+
lastClientY: clientY,
|
|
14278
|
+
activeSlot: null
|
|
14279
|
+
});
|
|
14280
|
+
return true;
|
|
14281
|
+
}
|
|
14282
|
+
if (!isFooterHrefKey(hrefKey)) return false;
|
|
13435
14283
|
const column = findFooterColumnForLink(anchor);
|
|
13436
14284
|
const columns = listFooterColumns();
|
|
13437
14285
|
beginFooterDrag({
|
|
@@ -13449,7 +14297,7 @@ function OhhwellsBridge() {
|
|
|
13449
14297
|
},
|
|
13450
14298
|
[beginFooterDrag]
|
|
13451
14299
|
);
|
|
13452
|
-
const startFooterColumnDrag =
|
|
14300
|
+
const startFooterColumnDrag = useCallback7(
|
|
13453
14301
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
13454
14302
|
const columns = listFooterColumns();
|
|
13455
14303
|
const idx = columns.indexOf(columnEl);
|
|
@@ -13469,7 +14317,7 @@ function OhhwellsBridge() {
|
|
|
13469
14317
|
},
|
|
13470
14318
|
[beginFooterDrag]
|
|
13471
14319
|
);
|
|
13472
|
-
const handleItemDragStart =
|
|
14320
|
+
const handleItemDragStart = useCallback7(
|
|
13473
14321
|
(e) => {
|
|
13474
14322
|
const selected = selectedElRef.current;
|
|
13475
14323
|
if (!selected) {
|
|
@@ -13489,7 +14337,7 @@ function OhhwellsBridge() {
|
|
|
13489
14337
|
},
|
|
13490
14338
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
|
|
13491
14339
|
);
|
|
13492
|
-
const handleItemDragEnd =
|
|
14340
|
+
const handleItemDragEnd = useCallback7(
|
|
13493
14341
|
(e) => {
|
|
13494
14342
|
if (footerDragRef.current) {
|
|
13495
14343
|
const x = e?.clientX;
|
|
@@ -13515,7 +14363,7 @@ function OhhwellsBridge() {
|
|
|
13515
14363
|
},
|
|
13516
14364
|
[commitFooterDrag, commitNavDrag, navDragRef]
|
|
13517
14365
|
);
|
|
13518
|
-
const handleItemChromePointerDown =
|
|
14366
|
+
const handleItemChromePointerDown = useCallback7((e) => {
|
|
13519
14367
|
if (e.button !== 0) return;
|
|
13520
14368
|
const selected = selectedElRef.current;
|
|
13521
14369
|
if (!selected) return;
|
|
@@ -13546,7 +14394,7 @@ function OhhwellsBridge() {
|
|
|
13546
14394
|
}
|
|
13547
14395
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
13548
14396
|
}, [armNavPressFromChrome]);
|
|
13549
|
-
const handleItemChromeClick =
|
|
14397
|
+
const handleItemChromeClick = useCallback7((clientX, clientY) => {
|
|
13550
14398
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
13551
14399
|
suppressNextClickRef.current = false;
|
|
13552
14400
|
return;
|
|
@@ -13559,7 +14407,7 @@ function OhhwellsBridge() {
|
|
|
13559
14407
|
}, []);
|
|
13560
14408
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
13561
14409
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
13562
|
-
const select =
|
|
14410
|
+
const select = useCallback7((anchor) => {
|
|
13563
14411
|
if (!isNavigationItem2(anchor)) return;
|
|
13564
14412
|
if (activeElRef.current) deactivate();
|
|
13565
14413
|
aiSectionApiRef.current?.selectFromElement(anchor);
|
|
@@ -13568,6 +14416,8 @@ function OhhwellsBridge() {
|
|
|
13568
14416
|
selectedFooterColAttrRef.current = null;
|
|
13569
14417
|
markSelected(anchor);
|
|
13570
14418
|
setSelectedIsCta(isCtaButton(anchor));
|
|
14419
|
+
setSelectedIsSocial(Boolean(getSocialItem(anchor)));
|
|
14420
|
+
setSelectedIsSocialsRow(false);
|
|
13571
14421
|
clearHrefKeyHover(anchor);
|
|
13572
14422
|
const isDropdownTrigger = !isNestedNavChild(anchor) && (navItemHasDropdownChildren(anchor) || navItemOwnsDropdownPanel(anchor));
|
|
13573
14423
|
if (isNestedNavChild(anchor)) {
|
|
@@ -13598,7 +14448,7 @@ function OhhwellsBridge() {
|
|
|
13598
14448
|
setToolbarShowEditLink(false);
|
|
13599
14449
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
13600
14450
|
}, [deactivate, markSelected]);
|
|
13601
|
-
const selectFrame =
|
|
14451
|
+
const selectFrame = useCallback7((el) => {
|
|
13602
14452
|
if (!isNavigationContainer(el)) return;
|
|
13603
14453
|
if (activeElRef.current) deactivate();
|
|
13604
14454
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -13608,6 +14458,8 @@ function OhhwellsBridge() {
|
|
|
13608
14458
|
selectedFooterColAttrRef.current = isFooterColumn ? el.getAttribute("data-ohw-footer-col") ?? String(listFooterColumns().indexOf(el)) : null;
|
|
13609
14459
|
markSelected(el);
|
|
13610
14460
|
setSelectedIsCta(false);
|
|
14461
|
+
setSelectedIsSocial(false);
|
|
14462
|
+
setSelectedIsSocialsRow(isSocialsRow(el));
|
|
13611
14463
|
clearHrefKeyHover(el);
|
|
13612
14464
|
setNavGroupForceOpen(null, false);
|
|
13613
14465
|
hoveredNavContainerRef.current = null;
|
|
@@ -13645,13 +14497,57 @@ function OhhwellsBridge() {
|
|
|
13645
14497
|
setToolbarShowEditLink(false);
|
|
13646
14498
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
13647
14499
|
}, [deactivate, markSelected, postToParent2]);
|
|
13648
|
-
const
|
|
14500
|
+
const openSocialsDisplayPanel = useCallback7((row) => {
|
|
14501
|
+
setParentScrollSnap(parentScrollRef.current);
|
|
14502
|
+
setFloatingPanel({
|
|
14503
|
+
key: "socials-display",
|
|
14504
|
+
title: "Style",
|
|
14505
|
+
context: "Socials \xB7 Footer",
|
|
14506
|
+
kind: "socials-display",
|
|
14507
|
+
row
|
|
14508
|
+
});
|
|
14509
|
+
}, []);
|
|
14510
|
+
const changeSocialsDisplay = useCallback7(
|
|
14511
|
+
(row, next) => {
|
|
14512
|
+
if (next.icon) {
|
|
14513
|
+
const missing = socialsMissingIcons(row);
|
|
14514
|
+
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
14515
|
+
if (missing.length) {
|
|
14516
|
+
postToParentRef.current({ type: "ow:social-icons-needed", items: missing });
|
|
14517
|
+
}
|
|
14518
|
+
}
|
|
14519
|
+
applySocialsDisplayToRow(row, next);
|
|
14520
|
+
requestAnimationFrame(() => {
|
|
14521
|
+
if (selectedElRef.current === row && row.isConnected) setToolbarRect(row.getBoundingClientRect());
|
|
14522
|
+
});
|
|
14523
|
+
const displayJson = JSON.stringify(socialsDisplayWith(row, next, editContentRef.current));
|
|
14524
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_DISPLAY_KEY]: displayJson };
|
|
14525
|
+
postToParentRef.current({
|
|
14526
|
+
type: "ow:change",
|
|
14527
|
+
nodes: [{ key: SOCIALS_DISPLAY_KEY, text: displayJson }],
|
|
14528
|
+
flush: true
|
|
14529
|
+
});
|
|
14530
|
+
},
|
|
14531
|
+
[]
|
|
14532
|
+
);
|
|
14533
|
+
const closeFloatingPanelOnly = useCallback7(() => {
|
|
14534
|
+
setFloatingPanel(null);
|
|
14535
|
+
}, []);
|
|
14536
|
+
const closeFloatingPanelAndDeselect = useCallback7(() => {
|
|
14537
|
+
setFloatingPanel(null);
|
|
14538
|
+
deselectRef.current();
|
|
14539
|
+
}, []);
|
|
14540
|
+
const activate = useCallback7((el, options) => {
|
|
13649
14541
|
if (activeElRef.current === el) return;
|
|
14542
|
+
if (isIconEditable(el)) return;
|
|
14543
|
+
if (el.hasAttribute("data-ohw-social-label")) return;
|
|
13650
14544
|
clearSelectedAttr();
|
|
13651
14545
|
selectedElRef.current = null;
|
|
13652
14546
|
selectedHrefKeyRef.current = null;
|
|
13653
14547
|
selectedFooterColAttrRef.current = null;
|
|
13654
14548
|
setSelectedIsCta(false);
|
|
14549
|
+
setSelectedIsSocial(false);
|
|
14550
|
+
setSelectedIsSocialsRow(false);
|
|
13655
14551
|
deactivate();
|
|
13656
14552
|
if (hoveredImageRef.current) {
|
|
13657
14553
|
hoveredImageRef.current = null;
|
|
@@ -13722,7 +14618,7 @@ function OhhwellsBridge() {
|
|
|
13722
14618
|
selectRef.current = select;
|
|
13723
14619
|
selectFrameRef.current = selectFrame;
|
|
13724
14620
|
deselectRef.current = deselect;
|
|
13725
|
-
|
|
14621
|
+
useLayoutEffect4(() => {
|
|
13726
14622
|
if (!subdomain || isEditMode) {
|
|
13727
14623
|
setFetchState("done");
|
|
13728
14624
|
return;
|
|
@@ -13762,6 +14658,8 @@ function OhhwellsBridge() {
|
|
|
13762
14658
|
}
|
|
13763
14659
|
} else if (el.dataset.ohwEditable === "link") {
|
|
13764
14660
|
applyLinkHref(el, val);
|
|
14661
|
+
} else if (el.dataset.ohwEditable === "icon") {
|
|
14662
|
+
applyIconMarkup(el, val);
|
|
13765
14663
|
} else if (el.innerHTML !== val) {
|
|
13766
14664
|
el.innerHTML = val;
|
|
13767
14665
|
}
|
|
@@ -13770,6 +14668,8 @@ function OhhwellsBridge() {
|
|
|
13770
14668
|
}
|
|
13771
14669
|
reconcileNavbarItemsFromContent(content);
|
|
13772
14670
|
reconcileFooterOrderFromContent(content);
|
|
14671
|
+
reconcileSocialsFromContent(content);
|
|
14672
|
+
applySocialsDisplayFromContent(content);
|
|
13773
14673
|
enforceLinkHrefs();
|
|
13774
14674
|
initSectionsFromContent(content, true);
|
|
13775
14675
|
sectionsLoadedRef.current = true;
|
|
@@ -13798,7 +14698,7 @@ function OhhwellsBridge() {
|
|
|
13798
14698
|
cancelled = true;
|
|
13799
14699
|
};
|
|
13800
14700
|
}, [subdomain, isEditMode]);
|
|
13801
|
-
|
|
14701
|
+
useEffect12(() => {
|
|
13802
14702
|
if (!subdomain || isEditMode) return;
|
|
13803
14703
|
let debounceTimer = null;
|
|
13804
14704
|
let observer = null;
|
|
@@ -13832,6 +14732,8 @@ function OhhwellsBridge() {
|
|
|
13832
14732
|
}
|
|
13833
14733
|
reconcileNavbarItemsFromContent(content);
|
|
13834
14734
|
reconcileFooterOrderFromContent(content);
|
|
14735
|
+
reconcileSocialsFromContent(content);
|
|
14736
|
+
applySocialsDisplayFromContent(content);
|
|
13835
14737
|
} finally {
|
|
13836
14738
|
observer?.observe(document.body, { childList: true, subtree: true });
|
|
13837
14739
|
}
|
|
@@ -13849,16 +14751,16 @@ function OhhwellsBridge() {
|
|
|
13849
14751
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
13850
14752
|
};
|
|
13851
14753
|
}, [subdomain, isEditMode, pathname]);
|
|
13852
|
-
|
|
14754
|
+
useLayoutEffect4(() => {
|
|
13853
14755
|
const el = document.getElementById("ohw-loader");
|
|
13854
14756
|
if (!el) return;
|
|
13855
14757
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
13856
14758
|
el.style.display = visible ? "flex" : "none";
|
|
13857
14759
|
}, [subdomain, fetchState]);
|
|
13858
|
-
|
|
14760
|
+
useEffect12(() => {
|
|
13859
14761
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
13860
14762
|
}, [pathname, postToParent2]);
|
|
13861
|
-
|
|
14763
|
+
useEffect12(() => {
|
|
13862
14764
|
if (!isEditMode) return;
|
|
13863
14765
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
13864
14766
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -13866,7 +14768,7 @@ function OhhwellsBridge() {
|
|
|
13866
14768
|
deselectRef.current();
|
|
13867
14769
|
deactivateRef.current();
|
|
13868
14770
|
}, [pathname, isEditMode]);
|
|
13869
|
-
|
|
14771
|
+
useEffect12(() => {
|
|
13870
14772
|
const contentForNav = () => {
|
|
13871
14773
|
if (isEditMode) return editContentRef.current;
|
|
13872
14774
|
if (!subdomain) return {};
|
|
@@ -13898,8 +14800,10 @@ function OhhwellsBridge() {
|
|
|
13898
14800
|
const content = contentForNav();
|
|
13899
14801
|
reconcileNavbarItemsFromContent(content);
|
|
13900
14802
|
reconcileFooterOrderFromContent(content);
|
|
14803
|
+
reconcileSocialsFromContent(content);
|
|
14804
|
+
applySocialsDisplayFromContent(content);
|
|
13901
14805
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
13902
|
-
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key"))) {
|
|
14806
|
+
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
|
|
13903
14807
|
disableNativeHrefDrag(el);
|
|
13904
14808
|
}
|
|
13905
14809
|
});
|
|
@@ -13931,7 +14835,7 @@ function OhhwellsBridge() {
|
|
|
13931
14835
|
observer?.disconnect();
|
|
13932
14836
|
};
|
|
13933
14837
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
13934
|
-
|
|
14838
|
+
useEffect12(() => {
|
|
13935
14839
|
if (!isEditMode) return;
|
|
13936
14840
|
const measure = () => {
|
|
13937
14841
|
const h = document.body.scrollHeight;
|
|
@@ -13955,7 +14859,7 @@ function OhhwellsBridge() {
|
|
|
13955
14859
|
window.removeEventListener("resize", handleResize);
|
|
13956
14860
|
};
|
|
13957
14861
|
}, [pathname, isEditMode, postToParent2]);
|
|
13958
|
-
|
|
14862
|
+
useEffect12(() => {
|
|
13959
14863
|
if (!subdomainFromQuery || isEditMode) return;
|
|
13960
14864
|
const handleClick = (e) => {
|
|
13961
14865
|
const anchor = e.target.closest("a");
|
|
@@ -13971,7 +14875,7 @@ function OhhwellsBridge() {
|
|
|
13971
14875
|
document.addEventListener("click", handleClick, true);
|
|
13972
14876
|
return () => document.removeEventListener("click", handleClick, true);
|
|
13973
14877
|
}, [subdomainFromQuery, isEditMode, router]);
|
|
13974
|
-
|
|
14878
|
+
useEffect12(() => {
|
|
13975
14879
|
if (!isEditMode) {
|
|
13976
14880
|
editStylesRef.current?.base.remove();
|
|
13977
14881
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -14179,6 +15083,17 @@ function OhhwellsBridge() {
|
|
|
14179
15083
|
});
|
|
14180
15084
|
return;
|
|
14181
15085
|
}
|
|
15086
|
+
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
15087
|
+
e.preventDefault();
|
|
15088
|
+
e.stopPropagation();
|
|
15089
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
15090
|
+
postToParentRef.current({
|
|
15091
|
+
type: "ow:icon-pick",
|
|
15092
|
+
key: editable.dataset.ohwKey ?? "",
|
|
15093
|
+
current: currentIconRef(editable)
|
|
15094
|
+
});
|
|
15095
|
+
return;
|
|
15096
|
+
}
|
|
14182
15097
|
if (isMediaEditable(editable)) {
|
|
14183
15098
|
e.preventDefault();
|
|
14184
15099
|
e.stopPropagation();
|
|
@@ -14193,6 +15108,7 @@ function OhhwellsBridge() {
|
|
|
14193
15108
|
e.stopPropagation();
|
|
14194
15109
|
if (selectedElRef.current === navAnchor) {
|
|
14195
15110
|
if (e.detail >= 2) return;
|
|
15111
|
+
if (requestSocialDialog(navAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
14196
15112
|
activateRef.current(editable, { caretX: e.clientX, caretY: e.clientY });
|
|
14197
15113
|
return;
|
|
14198
15114
|
}
|
|
@@ -14209,6 +15125,7 @@ function OhhwellsBridge() {
|
|
|
14209
15125
|
e.preventDefault();
|
|
14210
15126
|
e.stopPropagation();
|
|
14211
15127
|
if (selectedElRef.current === hrefAnchor) {
|
|
15128
|
+
if (requestSocialDialog(hrefAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
14212
15129
|
const textEditable = hrefAnchor.querySelector('[data-ohw-editable="text"]') ?? hrefAnchor.querySelector("[data-ohw-editable]");
|
|
14213
15130
|
if (textEditable) {
|
|
14214
15131
|
activateRef.current(textEditable, {
|
|
@@ -14247,6 +15164,13 @@ function OhhwellsBridge() {
|
|
|
14247
15164
|
selectFrameRef.current(navContainerToSelect);
|
|
14248
15165
|
return;
|
|
14249
15166
|
}
|
|
15167
|
+
const socialsRowToSelect = isSocialsRow(target) ? target : null;
|
|
15168
|
+
if (socialsRowToSelect && !getSocialItem(target)) {
|
|
15169
|
+
e.preventDefault();
|
|
15170
|
+
e.stopPropagation();
|
|
15171
|
+
selectFrameRef.current(socialsRowToSelect);
|
|
15172
|
+
return;
|
|
15173
|
+
}
|
|
14250
15174
|
const footerColumnToSelect = resolveFooterColumnSelectionTarget(target, e.clientX, e.clientY);
|
|
14251
15175
|
if (footerColumnToSelect) {
|
|
14252
15176
|
e.preventDefault();
|
|
@@ -14298,6 +15222,7 @@ function OhhwellsBridge() {
|
|
|
14298
15222
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
14299
15223
|
return;
|
|
14300
15224
|
}
|
|
15225
|
+
if (getSocialItem(target)) return;
|
|
14301
15226
|
const navLabel = getNavigationLabelEditable(target);
|
|
14302
15227
|
const editable = navLabel?.editable ?? target.closest('[data-ohw-editable="text"], [data-ohw-editable="plain"]');
|
|
14303
15228
|
if (!editable || isMediaEditable(editable) || editable.dataset.ohwEditable === "link") return;
|
|
@@ -14382,6 +15307,11 @@ function OhhwellsBridge() {
|
|
|
14382
15307
|
const selected = selectedElRef.current;
|
|
14383
15308
|
if (selected && (selected === editable || selected.contains(editable))) return;
|
|
14384
15309
|
if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
|
|
15310
|
+
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
15311
|
+
hoveredItemElRef.current = editable;
|
|
15312
|
+
setHoveredItemRect(editable.getBoundingClientRect());
|
|
15313
|
+
return;
|
|
15314
|
+
}
|
|
14385
15315
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
14386
15316
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
14387
15317
|
clearHrefKeyHover(hoverTarget);
|
|
@@ -14429,6 +15359,13 @@ function OhhwellsBridge() {
|
|
|
14429
15359
|
const related = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
14430
15360
|
if (related?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
|
|
14431
15361
|
if (!isMediaEditable(editable)) {
|
|
15362
|
+
if (isIconEditable(editable) && !getSocialItem(editable) && hoveredItemElRef.current === editable) {
|
|
15363
|
+
if (!related?.closest("[data-ohw-item-interaction]")) {
|
|
15364
|
+
hoveredItemElRef.current = null;
|
|
15365
|
+
setHoveredItemRect(null);
|
|
15366
|
+
}
|
|
15367
|
+
return;
|
|
15368
|
+
}
|
|
14432
15369
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
14433
15370
|
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
14434
15371
|
if (!related?.closest("[data-ohw-href-key]")) {
|
|
@@ -14977,7 +15914,7 @@ function OhhwellsBridge() {
|
|
|
14977
15914
|
if (footerSession) {
|
|
14978
15915
|
e.preventDefault();
|
|
14979
15916
|
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
14980
|
-
const slot = footerSession.kind === "link" && footerSession.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, footerSession.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
15917
|
+
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);
|
|
14981
15918
|
refreshFooterDragVisualsRef.current(footerSession, slot, e.clientX, e.clientY);
|
|
14982
15919
|
return;
|
|
14983
15920
|
}
|
|
@@ -15029,6 +15966,62 @@ function OhhwellsBridge() {
|
|
|
15029
15966
|
resumeAnimTracks();
|
|
15030
15967
|
clearImageHover();
|
|
15031
15968
|
};
|
|
15969
|
+
const handleSocialCancel = (e) => {
|
|
15970
|
+
if (e.data?.type !== "ow:social-cancel") return;
|
|
15971
|
+
const { hrefKey } = e.data;
|
|
15972
|
+
const item = hrefKey ? findSocialByHrefKey(hrefKey) : null;
|
|
15973
|
+
if (!item) return;
|
|
15974
|
+
const removed = removeSocialItem(item, editContentRef.current);
|
|
15975
|
+
if (!removed) return;
|
|
15976
|
+
const orderJson = JSON.stringify(removed.order);
|
|
15977
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
15978
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
15979
|
+
deselectRef.current();
|
|
15980
|
+
};
|
|
15981
|
+
const handleSocialUpdate = (e) => {
|
|
15982
|
+
if (e.data?.type !== "ow:social-update") return;
|
|
15983
|
+
const updates = Array.isArray(e.data.items) ? e.data.items : [e.data];
|
|
15984
|
+
const nodes = [];
|
|
15985
|
+
for (const { hrefKey, iconKey, url, iconMarkup, platformId, label } of updates) {
|
|
15986
|
+
if (hrefKey) {
|
|
15987
|
+
document.querySelectorAll(`[data-ohw-href-key="${hrefKey}"]`).forEach((el) => applyLinkHref(el, url));
|
|
15988
|
+
nodes.push({ key: hrefKey, text: url });
|
|
15989
|
+
}
|
|
15990
|
+
if (iconKey && typeof iconMarkup === "string" && iconMarkup) {
|
|
15991
|
+
document.querySelectorAll(`[data-ohw-key="${iconKey}"][data-ohw-editable="icon"]`).forEach((el) => {
|
|
15992
|
+
applyIconMarkup(el, iconMarkup);
|
|
15993
|
+
});
|
|
15994
|
+
nodes.push({ key: iconKey, text: iconMarkup });
|
|
15995
|
+
}
|
|
15996
|
+
if (iconKey && platformId) nodes.push({ key: socialPlatformKey(iconKey), text: platformId });
|
|
15997
|
+
if (iconKey && label) {
|
|
15998
|
+
const labelKey = socialLabelKey(iconKey);
|
|
15999
|
+
document.querySelectorAll(`[data-ohw-key="${labelKey}"]`).forEach((el) => {
|
|
16000
|
+
el.textContent = label;
|
|
16001
|
+
});
|
|
16002
|
+
nodes.push({ key: labelKey, text: label });
|
|
16003
|
+
}
|
|
16004
|
+
}
|
|
16005
|
+
if (!nodes.length) return;
|
|
16006
|
+
editContentRef.current = {
|
|
16007
|
+
...editContentRef.current,
|
|
16008
|
+
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
16009
|
+
};
|
|
16010
|
+
postToParentRef.current({ type: "ow:change", nodes, flush: true });
|
|
16011
|
+
};
|
|
16012
|
+
const handleIconMarkup = (e) => {
|
|
16013
|
+
if (e.data?.type !== "ow:icon-markup") return;
|
|
16014
|
+
const { key, markup } = e.data;
|
|
16015
|
+
if (!key || typeof markup !== "string") return;
|
|
16016
|
+
const targets = document.querySelectorAll(
|
|
16017
|
+
`[data-ohw-key="${key}"][data-ohw-editable="icon"]`
|
|
16018
|
+
);
|
|
16019
|
+
if (!targets.length) return;
|
|
16020
|
+
targets.forEach((el) => {
|
|
16021
|
+
applyIconMarkup(el, markup);
|
|
16022
|
+
});
|
|
16023
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key, text: markup }], flush: true });
|
|
16024
|
+
};
|
|
15032
16025
|
const handleImageUrl = (e) => {
|
|
15033
16026
|
if (e.data?.type !== "ow:image-url") return;
|
|
15034
16027
|
const { key, url } = e.data;
|
|
@@ -15455,7 +16448,7 @@ function OhhwellsBridge() {
|
|
|
15455
16448
|
}
|
|
15456
16449
|
if (footerDragRef.current) {
|
|
15457
16450
|
const session = footerDragRef.current;
|
|
15458
|
-
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
16451
|
+
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);
|
|
15459
16452
|
refreshFooterDragVisualsRef.current(session, slot, session.lastClientX, session.lastClientY);
|
|
15460
16453
|
}
|
|
15461
16454
|
if (navDragRef.current) {
|
|
@@ -15775,6 +16768,9 @@ function OhhwellsBridge() {
|
|
|
15775
16768
|
window.addEventListener("message", handleClearSchedulingWidget);
|
|
15776
16769
|
window.addEventListener("message", handleRemoveSchedulingSection);
|
|
15777
16770
|
window.addEventListener("message", handleCollectSection);
|
|
16771
|
+
window.addEventListener("message", handleSocialCancel);
|
|
16772
|
+
window.addEventListener("message", handleSocialUpdate);
|
|
16773
|
+
window.addEventListener("message", handleIconMarkup);
|
|
15778
16774
|
window.addEventListener("message", handleImageUrl);
|
|
15779
16775
|
window.addEventListener("message", handleImageUploading);
|
|
15780
16776
|
window.addEventListener("message", handleCarouselChange);
|
|
@@ -15826,6 +16822,9 @@ function OhhwellsBridge() {
|
|
|
15826
16822
|
window.removeEventListener("message", handleClearSchedulingWidget);
|
|
15827
16823
|
window.removeEventListener("message", handleRemoveSchedulingSection);
|
|
15828
16824
|
window.removeEventListener("message", handleCollectSection);
|
|
16825
|
+
window.removeEventListener("message", handleSocialCancel);
|
|
16826
|
+
window.removeEventListener("message", handleSocialUpdate);
|
|
16827
|
+
window.removeEventListener("message", handleIconMarkup);
|
|
15829
16828
|
window.removeEventListener("message", handleImageUrl);
|
|
15830
16829
|
window.removeEventListener("message", handleImageUploading);
|
|
15831
16830
|
window.removeEventListener("message", handleCarouselChange);
|
|
@@ -15847,7 +16846,7 @@ function OhhwellsBridge() {
|
|
|
15847
16846
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
15848
16847
|
};
|
|
15849
16848
|
}, [isEditMode, refreshStateRules]);
|
|
15850
|
-
|
|
16849
|
+
useEffect12(() => {
|
|
15851
16850
|
if (!isEditMode) return;
|
|
15852
16851
|
const THRESHOLD = 10;
|
|
15853
16852
|
const resolveWasSelected = (el) => {
|
|
@@ -15867,9 +16866,9 @@ function OhhwellsBridge() {
|
|
|
15867
16866
|
return;
|
|
15868
16867
|
}
|
|
15869
16868
|
if (target.closest("[data-ohw-item-drag-surface]")) return;
|
|
15870
|
-
const anchor = getNavigationItemAnchor(target);
|
|
16869
|
+
const anchor = getNavigationItemAnchor(target) ?? (document.elementsFromPoint(e.clientX, e.clientY).map((el) => el instanceof HTMLElement ? getNavigationItemAnchor(el) : null).find((found) => found !== null) ?? null);
|
|
15871
16870
|
const hrefKey = anchor?.getAttribute("data-ohw-href-key") ?? null;
|
|
15872
|
-
if (anchor && isFooterHrefKey(hrefKey)) {
|
|
16871
|
+
if (anchor && (isFooterHrefKey(hrefKey) || getSocialItem(anchor))) {
|
|
15873
16872
|
footerPointerDragRef.current = {
|
|
15874
16873
|
el: anchor,
|
|
15875
16874
|
kind: "link",
|
|
@@ -15902,7 +16901,7 @@ function OhhwellsBridge() {
|
|
|
15902
16901
|
clearTextSelection();
|
|
15903
16902
|
const session = footerDragRef.current;
|
|
15904
16903
|
if (!session) return;
|
|
15905
|
-
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, session.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
16904
|
+
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);
|
|
15906
16905
|
refreshFooterDragVisualsRef.current(session, slot, e.clientX, e.clientY);
|
|
15907
16906
|
return;
|
|
15908
16907
|
}
|
|
@@ -15929,7 +16928,7 @@ function OhhwellsBridge() {
|
|
|
15929
16928
|
const column = findFooterColumnForLink(pending.el);
|
|
15930
16929
|
const columns2 = listFooterColumns();
|
|
15931
16930
|
beginFooterDragRef.current({
|
|
15932
|
-
kind: "link",
|
|
16931
|
+
kind: getSocialItem(pending.el) ? "social" : "link",
|
|
15933
16932
|
hrefKey: key,
|
|
15934
16933
|
columnEl: column,
|
|
15935
16934
|
sourceColumnIndex: column ? columns2.indexOf(column) : 0,
|
|
@@ -16001,7 +17000,7 @@ function OhhwellsBridge() {
|
|
|
16001
17000
|
unlockFooterDragInteraction();
|
|
16002
17001
|
};
|
|
16003
17002
|
}, [isEditMode]);
|
|
16004
|
-
|
|
17003
|
+
useEffect12(() => {
|
|
16005
17004
|
const handler = (e) => {
|
|
16006
17005
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
16007
17006
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -16017,7 +17016,7 @@ function OhhwellsBridge() {
|
|
|
16017
17016
|
window.addEventListener("message", handler);
|
|
16018
17017
|
return () => window.removeEventListener("message", handler);
|
|
16019
17018
|
}, [processConfigRequest]);
|
|
16020
|
-
|
|
17019
|
+
useEffect12(() => {
|
|
16021
17020
|
if (!isEditMode) return;
|
|
16022
17021
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
16023
17022
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -16041,7 +17040,7 @@ function OhhwellsBridge() {
|
|
|
16041
17040
|
postToParent2({
|
|
16042
17041
|
type: "ow:ready",
|
|
16043
17042
|
version: "1",
|
|
16044
|
-
bridgeVersion: "0.1.
|
|
17043
|
+
bridgeVersion: "0.1.55",
|
|
16045
17044
|
path: pathname,
|
|
16046
17045
|
nodes: collectEditableNodes(editContentRef.current),
|
|
16047
17046
|
sections
|
|
@@ -16053,13 +17052,13 @@ function OhhwellsBridge() {
|
|
|
16053
17052
|
clearTimeout(timer);
|
|
16054
17053
|
};
|
|
16055
17054
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
16056
|
-
|
|
17055
|
+
useEffect12(() => {
|
|
16057
17056
|
scrollToHashSectionWhenReady();
|
|
16058
17057
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
16059
17058
|
window.addEventListener("hashchange", onHashChange);
|
|
16060
17059
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
16061
17060
|
}, [pathname]);
|
|
16062
|
-
const handleCommand =
|
|
17061
|
+
const handleCommand = useCallback7((cmd) => {
|
|
16063
17062
|
const el = activeElRef.current;
|
|
16064
17063
|
const selBefore = window.getSelection();
|
|
16065
17064
|
let savedOffsets = null;
|
|
@@ -16095,7 +17094,7 @@ function OhhwellsBridge() {
|
|
|
16095
17094
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
16096
17095
|
refreshActiveCommandsRef.current();
|
|
16097
17096
|
}, []);
|
|
16098
|
-
const handleStateChange =
|
|
17097
|
+
const handleStateChange = useCallback7((state) => {
|
|
16099
17098
|
if (!activeStateElRef.current) return;
|
|
16100
17099
|
const el = activeStateElRef.current;
|
|
16101
17100
|
if (state === "Default") {
|
|
@@ -16108,7 +17107,7 @@ function OhhwellsBridge() {
|
|
|
16108
17107
|
}
|
|
16109
17108
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
16110
17109
|
}, [deactivate]);
|
|
16111
|
-
const reselectAfterLinkPopover =
|
|
17110
|
+
const reselectAfterLinkPopover = useCallback7(
|
|
16112
17111
|
(hrefKey) => {
|
|
16113
17112
|
requestAnimationFrame(() => {
|
|
16114
17113
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -16117,7 +17116,7 @@ function OhhwellsBridge() {
|
|
|
16117
17116
|
},
|
|
16118
17117
|
[resolveHrefKeyElement]
|
|
16119
17118
|
);
|
|
16120
|
-
const closeLinkPopover =
|
|
17119
|
+
const closeLinkPopover = useCallback7(() => {
|
|
16121
17120
|
const session = linkPopoverSessionRef.current;
|
|
16122
17121
|
addNavAfterAnchorRef.current = null;
|
|
16123
17122
|
setLinkPopover(null);
|
|
@@ -16125,9 +17124,9 @@ function OhhwellsBridge() {
|
|
|
16125
17124
|
reselectAfterLinkPopover(session.key);
|
|
16126
17125
|
}
|
|
16127
17126
|
}, [reselectAfterLinkPopover]);
|
|
16128
|
-
const closeLinkPopoverRef =
|
|
17127
|
+
const closeLinkPopoverRef = useRef9(closeLinkPopover);
|
|
16129
17128
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
16130
|
-
const openLinkPopoverForActive =
|
|
17129
|
+
const openLinkPopoverForActive = useCallback7(() => {
|
|
16131
17130
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
16132
17131
|
if (!hrefCtx) return;
|
|
16133
17132
|
bumpLinkPopoverGrace();
|
|
@@ -16138,11 +17137,15 @@ function OhhwellsBridge() {
|
|
|
16138
17137
|
});
|
|
16139
17138
|
deactivate();
|
|
16140
17139
|
}, [deactivate]);
|
|
16141
|
-
const openLinkPopoverForSelected =
|
|
17140
|
+
const openLinkPopoverForSelected = useCallback7(() => {
|
|
16142
17141
|
const anchor = selectedElRef.current;
|
|
16143
17142
|
if (!anchor) return;
|
|
16144
17143
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
16145
17144
|
if (!key) return;
|
|
17145
|
+
if (requestSocialDialog(anchor, postToParentRef.current, editContentRef.current)) {
|
|
17146
|
+
deselect();
|
|
17147
|
+
return;
|
|
17148
|
+
}
|
|
16146
17149
|
bumpLinkPopoverGrace();
|
|
16147
17150
|
setLinkPopover({
|
|
16148
17151
|
key,
|
|
@@ -16151,7 +17154,7 @@ function OhhwellsBridge() {
|
|
|
16151
17154
|
});
|
|
16152
17155
|
deselect();
|
|
16153
17156
|
}, [deselect]);
|
|
16154
|
-
const handleSelectParent =
|
|
17157
|
+
const handleSelectParent = useCallback7(() => {
|
|
16155
17158
|
const selected = selectedElRef.current;
|
|
16156
17159
|
if (!selected) return;
|
|
16157
17160
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -16178,11 +17181,37 @@ function OhhwellsBridge() {
|
|
|
16178
17181
|
}
|
|
16179
17182
|
deselectRef.current();
|
|
16180
17183
|
}, []);
|
|
16181
|
-
const handleDuplicateSelected =
|
|
17184
|
+
const handleDuplicateSelected = useCallback7(() => {
|
|
16182
17185
|
const selected = selectedElRef.current;
|
|
16183
17186
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
16184
17187
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
16185
17188
|
if (!hrefKey) return;
|
|
17189
|
+
const social = getSocialItem(selected);
|
|
17190
|
+
if (social) {
|
|
17191
|
+
const result = duplicateSocialItem(social, editContentRef.current);
|
|
17192
|
+
if (!result) return;
|
|
17193
|
+
const orderJson = JSON.stringify(result.order);
|
|
17194
|
+
const carried = [
|
|
17195
|
+
{ from: result.copiedFrom?.href, to: result.hrefKey },
|
|
17196
|
+
{ from: result.copiedFrom?.icon, to: result.iconKey },
|
|
17197
|
+
{ from: result.copiedFrom?.icon ? socialPlatformKey(result.copiedFrom.icon) : null, to: socialPlatformKey(result.iconKey) }
|
|
17198
|
+
];
|
|
17199
|
+
const nodes = [{ key: SOCIALS_ORDER_KEY, text: orderJson }];
|
|
17200
|
+
for (const { from, to } of carried) {
|
|
17201
|
+
const value = from ? editContentRef.current[from] : void 0;
|
|
17202
|
+
if (value) nodes.push({ key: to, text: value });
|
|
17203
|
+
}
|
|
17204
|
+
editContentRef.current = {
|
|
17205
|
+
...editContentRef.current,
|
|
17206
|
+
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
17207
|
+
};
|
|
17208
|
+
postToParent2({ type: "ow:change", nodes });
|
|
17209
|
+
enforceLinkHrefs();
|
|
17210
|
+
const copyRow = findSocialsRow(result.item);
|
|
17211
|
+
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
17212
|
+
requestAnimationFrame(() => selectRef.current(result.item));
|
|
17213
|
+
return;
|
|
17214
|
+
}
|
|
16186
17215
|
if (isNavbarHrefKey(hrefKey)) {
|
|
16187
17216
|
const result = duplicateNavbarItem(selected);
|
|
16188
17217
|
if (!result) return;
|
|
@@ -16268,7 +17297,7 @@ function OhhwellsBridge() {
|
|
|
16268
17297
|
});
|
|
16269
17298
|
}
|
|
16270
17299
|
}, [postToParent2]);
|
|
16271
|
-
const runPendingDeleteUndo =
|
|
17300
|
+
const runPendingDeleteUndo = useCallback7(() => {
|
|
16272
17301
|
const pending = pendingDeleteUndoRef.current;
|
|
16273
17302
|
if (!pending) return false;
|
|
16274
17303
|
pendingDeleteUndoRef.current = null;
|
|
@@ -16276,7 +17305,7 @@ function OhhwellsBridge() {
|
|
|
16276
17305
|
enforceLinkHrefs();
|
|
16277
17306
|
return true;
|
|
16278
17307
|
}, []);
|
|
16279
|
-
const handleDeleteSelected =
|
|
17308
|
+
const handleDeleteSelected = useCallback7(() => {
|
|
16280
17309
|
const selected = selectedElRef.current;
|
|
16281
17310
|
if (!selected) return false;
|
|
16282
17311
|
return deleteSelectedNavFooterItem({
|
|
@@ -16297,7 +17326,7 @@ function OhhwellsBridge() {
|
|
|
16297
17326
|
}, [postToParent2]);
|
|
16298
17327
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
16299
17328
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
16300
|
-
const handleLinkPopoverSubmit =
|
|
17329
|
+
const handleLinkPopoverSubmit = useCallback7(
|
|
16301
17330
|
(target) => {
|
|
16302
17331
|
const session = linkPopoverSessionRef.current;
|
|
16303
17332
|
if (!session) return;
|
|
@@ -16363,19 +17392,19 @@ function OhhwellsBridge() {
|
|
|
16363
17392
|
const showEditLink = toolbarShowEditLink;
|
|
16364
17393
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
16365
17394
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
16366
|
-
const handleMediaReplace =
|
|
17395
|
+
const handleMediaReplace = useCallback7(
|
|
16367
17396
|
(key) => {
|
|
16368
17397
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
16369
17398
|
},
|
|
16370
17399
|
[postToParent2, mediaHover?.elementType]
|
|
16371
17400
|
);
|
|
16372
|
-
const handleEditCarousel =
|
|
17401
|
+
const handleEditCarousel = useCallback7(
|
|
16373
17402
|
(key) => {
|
|
16374
17403
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
16375
17404
|
},
|
|
16376
17405
|
[postToParent2]
|
|
16377
17406
|
);
|
|
16378
|
-
const handleMediaFadeOutComplete =
|
|
17407
|
+
const handleMediaFadeOutComplete = useCallback7((key) => {
|
|
16379
17408
|
setUploadingRects((prev) => {
|
|
16380
17409
|
if (!(key in prev)) return prev;
|
|
16381
17410
|
const next = { ...prev };
|
|
@@ -16383,7 +17412,7 @@ function OhhwellsBridge() {
|
|
|
16383
17412
|
return next;
|
|
16384
17413
|
});
|
|
16385
17414
|
}, []);
|
|
16386
|
-
const handleVideoSettingsChange =
|
|
17415
|
+
const handleVideoSettingsChange = useCallback7(
|
|
16387
17416
|
(key, settings) => {
|
|
16388
17417
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
16389
17418
|
const video = getVideoEl2(el);
|
|
@@ -16406,10 +17435,10 @@ function OhhwellsBridge() {
|
|
|
16406
17435
|
[postToParent2]
|
|
16407
17436
|
);
|
|
16408
17437
|
return bridgeRoot ? createPortal2(
|
|
16409
|
-
/* @__PURE__ */
|
|
16410
|
-
/* @__PURE__ */
|
|
16411
|
-
isEditMode && /* @__PURE__ */
|
|
16412
|
-
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */
|
|
17438
|
+
/* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
17439
|
+
/* @__PURE__ */ jsx32("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
17440
|
+
isEditMode && /* @__PURE__ */ jsx32(AiSectionOverlay, { postToParent: postToParent2, apiRef: aiSectionApiRef }),
|
|
17441
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ jsx32(
|
|
16413
17442
|
MediaOverlay,
|
|
16414
17443
|
{
|
|
16415
17444
|
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
@@ -16420,7 +17449,7 @@ function OhhwellsBridge() {
|
|
|
16420
17449
|
},
|
|
16421
17450
|
`uploading-${key}`
|
|
16422
17451
|
)),
|
|
16423
|
-
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */
|
|
17452
|
+
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ jsx32(
|
|
16424
17453
|
MediaOverlay,
|
|
16425
17454
|
{
|
|
16426
17455
|
hover: mediaHover,
|
|
@@ -16429,11 +17458,11 @@ function OhhwellsBridge() {
|
|
|
16429
17458
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
16430
17459
|
}
|
|
16431
17460
|
),
|
|
16432
|
-
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */
|
|
16433
|
-
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */
|
|
16434
|
-
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */
|
|
16435
|
-
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */
|
|
16436
|
-
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */
|
|
17461
|
+
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx32(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
|
|
17462
|
+
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ jsx32(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
17463
|
+
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ jsx32(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
|
|
17464
|
+
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ jsx32(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
|
|
17465
|
+
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ jsx32(
|
|
16437
17466
|
"div",
|
|
16438
17467
|
{
|
|
16439
17468
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -16443,7 +17472,7 @@ function OhhwellsBridge() {
|
|
|
16443
17472
|
width: slot.width,
|
|
16444
17473
|
height: slot.height
|
|
16445
17474
|
},
|
|
16446
|
-
children: /* @__PURE__ */
|
|
17475
|
+
children: /* @__PURE__ */ jsx32(
|
|
16447
17476
|
DropIndicator,
|
|
16448
17477
|
{
|
|
16449
17478
|
direction: slot.direction,
|
|
@@ -16454,7 +17483,7 @@ function OhhwellsBridge() {
|
|
|
16454
17483
|
},
|
|
16455
17484
|
`footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
|
|
16456
17485
|
)),
|
|
16457
|
-
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */
|
|
17486
|
+
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ jsx32(
|
|
16458
17487
|
"div",
|
|
16459
17488
|
{
|
|
16460
17489
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -16464,7 +17493,7 @@ function OhhwellsBridge() {
|
|
|
16464
17493
|
width: slot.width,
|
|
16465
17494
|
height: slot.height
|
|
16466
17495
|
},
|
|
16467
|
-
children: /* @__PURE__ */
|
|
17496
|
+
children: /* @__PURE__ */ jsx32(
|
|
16468
17497
|
DropIndicator,
|
|
16469
17498
|
{
|
|
16470
17499
|
direction: slot.direction,
|
|
@@ -16475,10 +17504,10 @@ function OhhwellsBridge() {
|
|
|
16475
17504
|
},
|
|
16476
17505
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
16477
17506
|
)),
|
|
16478
|
-
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */
|
|
16479
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */
|
|
16480
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */
|
|
16481
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */
|
|
17507
|
+
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx32(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
17508
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ jsx32(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
17509
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ jsx32(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
17510
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ jsx32(
|
|
16482
17511
|
FooterContainerChrome,
|
|
16483
17512
|
{
|
|
16484
17513
|
rect: toolbarRect,
|
|
@@ -16486,7 +17515,7 @@ function OhhwellsBridge() {
|
|
|
16486
17515
|
addDisabled: !canAddFooterColumn()
|
|
16487
17516
|
}
|
|
16488
17517
|
),
|
|
16489
|
-
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */
|
|
17518
|
+
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ jsx32(
|
|
16490
17519
|
ItemInteractionLayer,
|
|
16491
17520
|
{
|
|
16492
17521
|
rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
|
|
@@ -16501,10 +17530,18 @@ function OhhwellsBridge() {
|
|
|
16501
17530
|
onItemPointerDown: handleItemChromePointerDown,
|
|
16502
17531
|
onItemClick: handleItemChromeClick,
|
|
16503
17532
|
itemDragSurface: !isFooterFrameSelection,
|
|
16504
|
-
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && isFooterFrameSelection && !isItemDragging ? /* @__PURE__ */
|
|
17533
|
+
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && (isFooterFrameSelection || selectedIsSocialsRow) && !isItemDragging ? /* @__PURE__ */ jsx32(
|
|
16505
17534
|
ItemActionToolbar,
|
|
16506
17535
|
{
|
|
16507
17536
|
onEditLink: openLinkPopoverForSelected,
|
|
17537
|
+
onStyle: () => {
|
|
17538
|
+
const row = selectedElRef.current;
|
|
17539
|
+
if (!row) return;
|
|
17540
|
+
if (floatingPanel?.kind === "socials-display") closeFloatingPanelOnly();
|
|
17541
|
+
else openSocialsDisplayPanel(row);
|
|
17542
|
+
},
|
|
17543
|
+
showStyle: selectedIsSocialsRow,
|
|
17544
|
+
styleActive: floatingPanel?.kind === "socials-display",
|
|
16508
17545
|
onAddItem: handleAddChildItem,
|
|
16509
17546
|
onSelectParent: handleSelectParent,
|
|
16510
17547
|
onDuplicate: handleDuplicateSelected,
|
|
@@ -16512,12 +17549,12 @@ function OhhwellsBridge() {
|
|
|
16512
17549
|
addItemDisabled: false,
|
|
16513
17550
|
editLinkDisabled: false,
|
|
16514
17551
|
moreDisabled: false,
|
|
16515
|
-
duplicateDisabled: isFooterFrameSelection,
|
|
16516
|
-
showEditLink: !isFooterFrameSelection && navDropdownPreviewOpen === null,
|
|
16517
|
-
showAddItem: isFooterFrameSelection || !selectedIsCta && Boolean(
|
|
17552
|
+
duplicateDisabled: isFooterFrameSelection || selectedIsSocialsRow,
|
|
17553
|
+
showEditLink: !isFooterFrameSelection && !selectedIsSocialsRow && navDropdownPreviewOpen === null,
|
|
17554
|
+
showAddItem: isFooterFrameSelection || selectedIsSocialsRow || !selectedIsCta && Boolean(
|
|
16518
17555
|
selectedElRef.current && isNavbarHrefKey(selectedElRef.current.getAttribute("data-ohw-href-key")) && !isNestedNavChild(selectedElRef.current)
|
|
16519
17556
|
),
|
|
16520
|
-
showMore: !selectedIsCta || isFooterFrameSelection,
|
|
17557
|
+
showMore: (!selectedIsCta || isFooterFrameSelection) && !selectedIsSocialsRow,
|
|
16521
17558
|
dropdownOpen: navDropdownPreviewOpen,
|
|
16522
17559
|
onDropdownOpenChange: handleNavDropdownOpenChange,
|
|
16523
17560
|
headingVisible: footerHeadingVisible,
|
|
@@ -16526,8 +17563,8 @@ function OhhwellsBridge() {
|
|
|
16526
17563
|
) : void 0
|
|
16527
17564
|
}
|
|
16528
17565
|
),
|
|
16529
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */
|
|
16530
|
-
/* @__PURE__ */
|
|
17566
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
17567
|
+
/* @__PURE__ */ jsx32(
|
|
16531
17568
|
EditGlowChrome,
|
|
16532
17569
|
{
|
|
16533
17570
|
rect: toolbarRect,
|
|
@@ -16537,7 +17574,7 @@ function OhhwellsBridge() {
|
|
|
16537
17574
|
hideHandle: isItemDragging
|
|
16538
17575
|
}
|
|
16539
17576
|
),
|
|
16540
|
-
/* @__PURE__ */
|
|
17577
|
+
/* @__PURE__ */ jsx32(
|
|
16541
17578
|
FloatingToolbar,
|
|
16542
17579
|
{
|
|
16543
17580
|
rect: toolbarRect,
|
|
@@ -16550,7 +17587,7 @@ function OhhwellsBridge() {
|
|
|
16550
17587
|
}
|
|
16551
17588
|
)
|
|
16552
17589
|
] }),
|
|
16553
|
-
maxBadge && /* @__PURE__ */
|
|
17590
|
+
maxBadge && /* @__PURE__ */ jsxs19(
|
|
16554
17591
|
"div",
|
|
16555
17592
|
{
|
|
16556
17593
|
"data-ohw-max-badge": "",
|
|
@@ -16576,7 +17613,7 @@ function OhhwellsBridge() {
|
|
|
16576
17613
|
]
|
|
16577
17614
|
}
|
|
16578
17615
|
),
|
|
16579
|
-
toggleState && !linkPopover && /* @__PURE__ */
|
|
17616
|
+
toggleState && !linkPopover && /* @__PURE__ */ jsx32(
|
|
16580
17617
|
StateToggle,
|
|
16581
17618
|
{
|
|
16582
17619
|
rect: toggleState.rect,
|
|
@@ -16585,15 +17622,15 @@ function OhhwellsBridge() {
|
|
|
16585
17622
|
onStateChange: handleStateChange
|
|
16586
17623
|
}
|
|
16587
17624
|
),
|
|
16588
|
-
sectionGap && !linkPopover && /* @__PURE__ */
|
|
17625
|
+
sectionGap && !linkPopover && /* @__PURE__ */ jsxs19(
|
|
16589
17626
|
"div",
|
|
16590
17627
|
{
|
|
16591
17628
|
"data-ohw-section-insert-line": "",
|
|
16592
17629
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
16593
17630
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
16594
17631
|
children: [
|
|
16595
|
-
/* @__PURE__ */
|
|
16596
|
-
/* @__PURE__ */
|
|
17632
|
+
/* @__PURE__ */ jsx32("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
17633
|
+
/* @__PURE__ */ jsx32(
|
|
16597
17634
|
Badge,
|
|
16598
17635
|
{
|
|
16599
17636
|
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",
|
|
@@ -16610,11 +17647,11 @@ function OhhwellsBridge() {
|
|
|
16610
17647
|
children: "Add Section"
|
|
16611
17648
|
}
|
|
16612
17649
|
),
|
|
16613
|
-
/* @__PURE__ */
|
|
17650
|
+
/* @__PURE__ */ jsx32("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
16614
17651
|
]
|
|
16615
17652
|
}
|
|
16616
17653
|
),
|
|
16617
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */
|
|
17654
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ jsx32(
|
|
16618
17655
|
LinkPopover,
|
|
16619
17656
|
{
|
|
16620
17657
|
panelRef: linkPopoverPanelRef,
|
|
@@ -16630,6 +17667,28 @@ function OhhwellsBridge() {
|
|
|
16630
17667
|
onSubmit: handleLinkPopoverSubmit
|
|
16631
17668
|
},
|
|
16632
17669
|
linkPopover.key
|
|
17670
|
+
) : null,
|
|
17671
|
+
floatingPanel && floatingPanel.kind === "socials-display" ? /* @__PURE__ */ jsx32(
|
|
17672
|
+
FloatingPanel,
|
|
17673
|
+
{
|
|
17674
|
+
open: true,
|
|
17675
|
+
title: floatingPanel.title,
|
|
17676
|
+
context: floatingPanel.context,
|
|
17677
|
+
position: floatingPanelPos,
|
|
17678
|
+
onPositionChange: setFloatingPanelPos,
|
|
17679
|
+
parentScroll: parentScrollSnap ?? parentScrollRef.current,
|
|
17680
|
+
onClose: closeFloatingPanelOnly,
|
|
17681
|
+
children: /* @__PURE__ */ jsx32(
|
|
17682
|
+
SocialsDisplayPanel,
|
|
17683
|
+
{
|
|
17684
|
+
display: socialsDisplayFor(floatingPanel.row, editContentRef.current),
|
|
17685
|
+
onChange: (next) => {
|
|
17686
|
+
changeSocialsDisplay(floatingPanel.row, next);
|
|
17687
|
+
setFloatingPanel({ ...floatingPanel });
|
|
17688
|
+
}
|
|
17689
|
+
}
|
|
17690
|
+
)
|
|
17691
|
+
}
|
|
16633
17692
|
) : null
|
|
16634
17693
|
] }),
|
|
16635
17694
|
bridgeRoot
|