@ohhwells/bridge 0.1.54-next.151 → 0.1.54-next.154
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 +903 -89
- 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 +904 -90
- package/dist/index.js.map +1 -1
- package/dist/styles.css +18 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -236,13 +236,17 @@ function MediaBox({
|
|
|
236
236
|
const url = refValue ? ctx.resolveMedia(refValue) : null;
|
|
237
237
|
const isIcon = /^(lucide|simple):/.test(refValue);
|
|
238
238
|
const aspectRatio = aspect && /^\d+:\d+$/.test(aspect) ? aspect.replace(":", " / ") : void 0;
|
|
239
|
-
const editAttrs = ctx.keyFor && editPath
|
|
239
|
+
const editAttrs = ctx.keyFor && editPath ? {
|
|
240
|
+
"data-ohw-key": ctx.keyFor(editPath),
|
|
241
|
+
"data-ohw-editable": isIcon ? "icon" : "image"
|
|
242
|
+
} : {};
|
|
240
243
|
if (isIcon) {
|
|
241
244
|
const Icon = refValue.startsWith("lucide:") ? lucideByName(refValue.slice(7)) : null;
|
|
242
245
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
243
246
|
"span",
|
|
244
247
|
{
|
|
245
248
|
"data-ai-icon": refValue,
|
|
249
|
+
...editAttrs,
|
|
246
250
|
style: {
|
|
247
251
|
display: "inline-flex",
|
|
248
252
|
width: 48,
|
|
@@ -5938,6 +5942,7 @@ function ToolbarActionTooltip({
|
|
|
5938
5942
|
function ItemActionToolbar({
|
|
5939
5943
|
onEditLink,
|
|
5940
5944
|
onAddItem,
|
|
5945
|
+
onStyle,
|
|
5941
5946
|
onSelectParent,
|
|
5942
5947
|
onDuplicate,
|
|
5943
5948
|
onDelete,
|
|
@@ -5949,6 +5954,8 @@ function ItemActionToolbar({
|
|
|
5949
5954
|
deleteDisabled = false,
|
|
5950
5955
|
showEditLink = true,
|
|
5951
5956
|
showAddItem = true,
|
|
5957
|
+
showStyle = false,
|
|
5958
|
+
styleActive = false,
|
|
5952
5959
|
showMore = true,
|
|
5953
5960
|
tooltipSide = "bottom",
|
|
5954
5961
|
dropdownOpen = null,
|
|
@@ -6022,6 +6029,22 @@ function ItemActionToolbar({
|
|
|
6022
6029
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
6023
6030
|
}
|
|
6024
6031
|
) : null,
|
|
6032
|
+
showStyle ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6033
|
+
ToolbarActionTooltip,
|
|
6034
|
+
{
|
|
6035
|
+
label: "Style",
|
|
6036
|
+
side: tooltipSide,
|
|
6037
|
+
buttonProps: {
|
|
6038
|
+
active: styleActive,
|
|
6039
|
+
onMouseDown: (e) => {
|
|
6040
|
+
e.preventDefault();
|
|
6041
|
+
e.stopPropagation();
|
|
6042
|
+
onStyle?.();
|
|
6043
|
+
}
|
|
6044
|
+
},
|
|
6045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.Brush, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
6046
|
+
}
|
|
6047
|
+
) : null,
|
|
6025
6048
|
showAddItem ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
6026
6049
|
ToolbarActionTooltip,
|
|
6027
6050
|
{
|
|
@@ -9528,6 +9551,445 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
9528
9551
|
};
|
|
9529
9552
|
}
|
|
9530
9553
|
|
|
9554
|
+
// src/lib/icon-markup.ts
|
|
9555
|
+
var GLYPH_SELECTOR = "svg, img";
|
|
9556
|
+
function referenceBox(slot) {
|
|
9557
|
+
const row = slot.closest("[data-ohw-socials-row]") ?? slot.closest("a")?.parentElement ?? null;
|
|
9558
|
+
const neighbour = row ? Array.from(row.querySelectorAll('[data-ohw-editable="icon"]')).find((el) => el !== slot) : null;
|
|
9559
|
+
const source = (neighbour ?? slot).querySelector(GLYPH_SELECTOR);
|
|
9560
|
+
const box = source?.getBoundingClientRect() ?? null;
|
|
9561
|
+
return box?.width && box.height ? box : null;
|
|
9562
|
+
}
|
|
9563
|
+
function iconMarkupSizedFor(slot, markup) {
|
|
9564
|
+
const box = referenceBox(slot);
|
|
9565
|
+
if (!box) return markup;
|
|
9566
|
+
const holder = document.createElement("div");
|
|
9567
|
+
holder.innerHTML = markup;
|
|
9568
|
+
const glyph = holder.querySelector(GLYPH_SELECTOR);
|
|
9569
|
+
if (!glyph) return markup;
|
|
9570
|
+
glyph.style.width = `${Math.round(box.width)}px`;
|
|
9571
|
+
glyph.style.height = `${Math.round(box.height)}px`;
|
|
9572
|
+
return holder.innerHTML;
|
|
9573
|
+
}
|
|
9574
|
+
function applyIconMarkup(slot, markup) {
|
|
9575
|
+
if (!markup) return;
|
|
9576
|
+
const coloured = iconMarkupInheritingColour(markup);
|
|
9577
|
+
const sized = iconMarkupSizedFor(slot, coloured);
|
|
9578
|
+
if (slot.innerHTML !== sized) slot.innerHTML = sized;
|
|
9579
|
+
if (sized === coloured) {
|
|
9580
|
+
requestAnimationFrame(() => {
|
|
9581
|
+
if (!slot.isConnected) return;
|
|
9582
|
+
const resized = iconMarkupSizedFor(slot, coloured);
|
|
9583
|
+
if (resized !== coloured && slot.innerHTML !== resized) slot.innerHTML = resized;
|
|
9584
|
+
});
|
|
9585
|
+
}
|
|
9586
|
+
}
|
|
9587
|
+
function detectIconStyle(el) {
|
|
9588
|
+
const row = el.closest("[data-ohw-socials-row]");
|
|
9589
|
+
const glyphs = Array.from((row ?? el).querySelectorAll("svg"));
|
|
9590
|
+
const outlined = glyphs.some((svg) => {
|
|
9591
|
+
return Array.from(svg.querySelectorAll("*")).some((node) => {
|
|
9592
|
+
return node.getAttribute("stroke") !== null && node.getAttribute("stroke") !== "none";
|
|
9593
|
+
});
|
|
9594
|
+
});
|
|
9595
|
+
return outlined ? "outline" : "fill";
|
|
9596
|
+
}
|
|
9597
|
+
function iconMarkupInheritingColour(markup) {
|
|
9598
|
+
const holder = document.createElement("div");
|
|
9599
|
+
holder.innerHTML = markup;
|
|
9600
|
+
holder.querySelectorAll("svg *").forEach((node) => {
|
|
9601
|
+
if (node.getAttribute("fill") && node.getAttribute("fill") !== "none") {
|
|
9602
|
+
node.setAttribute("fill", "currentColor");
|
|
9603
|
+
}
|
|
9604
|
+
if (node.getAttribute("stroke") && node.getAttribute("stroke") !== "none") {
|
|
9605
|
+
node.setAttribute("stroke", "currentColor");
|
|
9606
|
+
}
|
|
9607
|
+
});
|
|
9608
|
+
return holder.innerHTML;
|
|
9609
|
+
}
|
|
9610
|
+
|
|
9611
|
+
// src/lib/socials-items.ts
|
|
9612
|
+
var ICON_SELECTOR = '[data-ohw-editable="icon"]';
|
|
9613
|
+
var SOCIAL_KEY_RE = /(^|-)social(s)?(-|$)/i;
|
|
9614
|
+
var SOCIALS_ROW_ATTR = "data-ohw-socials-row";
|
|
9615
|
+
var SOCIALS_ITEM_ATTR = "data-ohw-social-item";
|
|
9616
|
+
function isSocialItem(el) {
|
|
9617
|
+
if (!el) return false;
|
|
9618
|
+
const anchor = el instanceof HTMLAnchorElement ? el : el.closest("a");
|
|
9619
|
+
if (!anchor) return false;
|
|
9620
|
+
if (SOCIAL_KEY_RE.test(anchor.getAttribute("data-ohw-href-key") ?? "")) return true;
|
|
9621
|
+
return anchor.querySelectorAll(ICON_SELECTOR).length === 1;
|
|
9622
|
+
}
|
|
9623
|
+
function getSocialItem(el) {
|
|
9624
|
+
const anchor = el.closest("a");
|
|
9625
|
+
return isSocialItem(anchor) ? anchor : null;
|
|
9626
|
+
}
|
|
9627
|
+
function findSocialsRow(el) {
|
|
9628
|
+
const item = getSocialItem(el);
|
|
9629
|
+
if (!item) return null;
|
|
9630
|
+
const wrapper = item.parentElement;
|
|
9631
|
+
const row = wrapper && wrapper.querySelectorAll("a").length === 1 && wrapper.matches("li, div, span") ? wrapper.parentElement : wrapper;
|
|
9632
|
+
if (!row) return null;
|
|
9633
|
+
const anchors = Array.from(row.querySelectorAll("a"));
|
|
9634
|
+
if (!anchors.length || !anchors.every((anchor) => isSocialItem(anchor))) return null;
|
|
9635
|
+
return row;
|
|
9636
|
+
}
|
|
9637
|
+
function isSocialsRow(el) {
|
|
9638
|
+
const anchors = Array.from(el.querySelectorAll("a"));
|
|
9639
|
+
return anchors.length > 0 && anchors.every((anchor) => isSocialItem(anchor));
|
|
9640
|
+
}
|
|
9641
|
+
function listSocialItems(row) {
|
|
9642
|
+
return Array.from(row.children).map((child) => {
|
|
9643
|
+
if (!(child instanceof HTMLElement)) return null;
|
|
9644
|
+
const anchor = child.matches("a") ? child : child.querySelector("a");
|
|
9645
|
+
return isSocialItem(anchor) ? anchor : null;
|
|
9646
|
+
}).filter((item) => item !== null);
|
|
9647
|
+
}
|
|
9648
|
+
function socialRowUnit(item) {
|
|
9649
|
+
const row = findSocialsRow(item);
|
|
9650
|
+
let node = item;
|
|
9651
|
+
while (node.parentElement && node.parentElement !== row) {
|
|
9652
|
+
node = node.parentElement;
|
|
9653
|
+
}
|
|
9654
|
+
return node;
|
|
9655
|
+
}
|
|
9656
|
+
function listSocialsRows(root = document) {
|
|
9657
|
+
const rows = /* @__PURE__ */ new Set();
|
|
9658
|
+
root.querySelectorAll(`${ICON_SELECTOR}, a[data-ohw-href-key]`).forEach((el) => {
|
|
9659
|
+
const row = findSocialsRow(el);
|
|
9660
|
+
if (row) rows.add(row);
|
|
9661
|
+
});
|
|
9662
|
+
root.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`).forEach((row) => rows.add(row));
|
|
9663
|
+
return Array.from(rows);
|
|
9664
|
+
}
|
|
9665
|
+
var rowTemplates = /* @__PURE__ */ new Map();
|
|
9666
|
+
function markSocialsRows(root = document) {
|
|
9667
|
+
root.querySelectorAll(`[${SOCIALS_ITEM_ATTR}]`).forEach((item) => {
|
|
9668
|
+
item.removeAttribute(SOCIALS_ITEM_ATTR);
|
|
9669
|
+
});
|
|
9670
|
+
listSocialsRows(root).forEach((row) => {
|
|
9671
|
+
row.setAttribute(SOCIALS_ROW_ATTR, "");
|
|
9672
|
+
const items = listSocialItems(row);
|
|
9673
|
+
if (items[0]) rowTemplates.set(rowKeyOf(row), socialRowUnit(items[0]).outerHTML);
|
|
9674
|
+
items.forEach((item, index) => {
|
|
9675
|
+
item.setAttribute(SOCIALS_ITEM_ATTR, String(index));
|
|
9676
|
+
const iconKey = socialIconKey(item);
|
|
9677
|
+
if (iconKey) ensureLabelSlot(item, iconKey);
|
|
9678
|
+
});
|
|
9679
|
+
});
|
|
9680
|
+
}
|
|
9681
|
+
var SOCIALS_LABEL_ATTR = "data-ohw-social-label";
|
|
9682
|
+
function ensureLabelSlot(item, iconKey) {
|
|
9683
|
+
if (socialLabelElement(item)) return;
|
|
9684
|
+
const label = document.createElement("span");
|
|
9685
|
+
label.setAttribute("data-ohw-key", `${iconKey}-label`);
|
|
9686
|
+
label.setAttribute("data-ohw-editable", "text");
|
|
9687
|
+
label.setAttribute(SOCIALS_LABEL_ATTR, "");
|
|
9688
|
+
label.style.display = "none";
|
|
9689
|
+
label.textContent = item.getAttribute("aria-label") ?? "";
|
|
9690
|
+
item.appendChild(label);
|
|
9691
|
+
}
|
|
9692
|
+
function socialLabelElement(item) {
|
|
9693
|
+
return item.querySelector(
|
|
9694
|
+
`[${SOCIALS_LABEL_ATTR}], [data-ohw-editable="text"], [data-ohw-editable="plain"]`
|
|
9695
|
+
);
|
|
9696
|
+
}
|
|
9697
|
+
function socialLabelKey(iconKey) {
|
|
9698
|
+
return `${iconKey}-label`;
|
|
9699
|
+
}
|
|
9700
|
+
function applyStoredValues(item, content) {
|
|
9701
|
+
const hrefKey = socialHrefKey(item);
|
|
9702
|
+
const iconKey = socialIconKey(item);
|
|
9703
|
+
if (hrefKey && content[hrefKey] !== void 0) item.setAttribute("href", content[hrefKey]);
|
|
9704
|
+
if (iconKey) {
|
|
9705
|
+
const glyph = item.querySelector(ICON_SELECTOR);
|
|
9706
|
+
if (glyph && content[iconKey]) applyIconMarkup(glyph, content[iconKey]);
|
|
9707
|
+
const label = item.querySelector(`[${SOCIALS_LABEL_ATTR}]`);
|
|
9708
|
+
label?.setAttribute("data-ohw-key", socialLabelKey(iconKey));
|
|
9709
|
+
const stored = content[socialLabelKey(iconKey)];
|
|
9710
|
+
if (label && stored) label.textContent = stored;
|
|
9711
|
+
}
|
|
9712
|
+
}
|
|
9713
|
+
function socialPlatformKey(iconKey) {
|
|
9714
|
+
return `${iconKey}-platform`;
|
|
9715
|
+
}
|
|
9716
|
+
function socialHrefKey(item) {
|
|
9717
|
+
return item.getAttribute("data-ohw-href-key");
|
|
9718
|
+
}
|
|
9719
|
+
function socialIconKey(item) {
|
|
9720
|
+
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
9721
|
+
}
|
|
9722
|
+
var SOCIALS_ORDER_KEY = "__ohw_socials_order";
|
|
9723
|
+
function fromMarkup(markup) {
|
|
9724
|
+
const holder = document.createElement("div");
|
|
9725
|
+
holder.innerHTML = markup;
|
|
9726
|
+
return holder.firstElementChild instanceof HTMLElement ? holder.firstElementChild : null;
|
|
9727
|
+
}
|
|
9728
|
+
var rowKeys = /* @__PURE__ */ new WeakMap();
|
|
9729
|
+
function rowKeyOf(row) {
|
|
9730
|
+
const first = listSocialItems(row)[0];
|
|
9731
|
+
const itemKey = first ? socialIconKey(first) ?? socialHrefKey(first)?.replace(/-href$/, "") : null;
|
|
9732
|
+
const derived = itemKey?.replace(/-[^-]+$/, "") || null;
|
|
9733
|
+
if (derived) rowKeys.set(row, derived);
|
|
9734
|
+
return derived ?? rowKeys.get(row) ?? "social";
|
|
9735
|
+
}
|
|
9736
|
+
function getSocialsOrderFromDom(root = document) {
|
|
9737
|
+
const order = {};
|
|
9738
|
+
listSocialsRows(root).forEach((row) => {
|
|
9739
|
+
order[rowKeyOf(row)] = listSocialItems(row).map((item) => socialHrefKey(item)).filter((key) => Boolean(key));
|
|
9740
|
+
});
|
|
9741
|
+
return order;
|
|
9742
|
+
}
|
|
9743
|
+
function hasStoredValue(content, hrefKey) {
|
|
9744
|
+
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9745
|
+
return Boolean(content[hrefKey]) || Boolean(content[iconKey]);
|
|
9746
|
+
}
|
|
9747
|
+
function parseSocialsOrder(raw) {
|
|
9748
|
+
if (!raw) return null;
|
|
9749
|
+
try {
|
|
9750
|
+
const parsed = JSON.parse(raw);
|
|
9751
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9752
|
+
} catch {
|
|
9753
|
+
return null;
|
|
9754
|
+
}
|
|
9755
|
+
}
|
|
9756
|
+
function nextSocialIndex(row, rowKey, content) {
|
|
9757
|
+
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));
|
|
9758
|
+
return Math.max(-1, ...used) + 1;
|
|
9759
|
+
}
|
|
9760
|
+
function insertSocialItem(row, after, content = {}) {
|
|
9761
|
+
const rowKey = rowKeyOf(row);
|
|
9762
|
+
const template = listSocialItems(row)[0];
|
|
9763
|
+
const remembered = rowTemplates.get(rowKey);
|
|
9764
|
+
if (!template && !remembered) return null;
|
|
9765
|
+
const index = nextSocialIndex(row, rowKey, content);
|
|
9766
|
+
const iconKey = `${rowKey}-${index}`;
|
|
9767
|
+
const hrefKey = `${iconKey}-href`;
|
|
9768
|
+
const templateUnit = template ? socialRowUnit(template) : null;
|
|
9769
|
+
const unit = templateUnit ? templateUnit.cloneNode(true) : fromMarkup(remembered);
|
|
9770
|
+
const item = unit && (unit.matches("a") ? unit : unit.querySelector("a"));
|
|
9771
|
+
if (!unit || !item) return null;
|
|
9772
|
+
item.setAttribute("data-ohw-href-key", hrefKey);
|
|
9773
|
+
item.setAttribute("href", "");
|
|
9774
|
+
item.removeAttribute("aria-label");
|
|
9775
|
+
item.querySelectorAll("[data-ohw-hovered], [data-ohw-selected]").forEach((el) => {
|
|
9776
|
+
el.removeAttribute("data-ohw-hovered");
|
|
9777
|
+
el.removeAttribute("data-ohw-selected");
|
|
9778
|
+
});
|
|
9779
|
+
const icon = item.querySelector(ICON_SELECTOR);
|
|
9780
|
+
icon?.setAttribute("data-ohw-key", iconKey);
|
|
9781
|
+
item.querySelector(`[${SOCIALS_LABEL_ATTR}]`)?.remove();
|
|
9782
|
+
const afterUnit = after ? socialRowUnit(after) : null;
|
|
9783
|
+
if (afterUnit && afterUnit.parentElement === row) afterUnit.insertAdjacentElement("afterend", unit);
|
|
9784
|
+
else row.appendChild(unit);
|
|
9785
|
+
markSocialsRows(row.ownerDocument);
|
|
9786
|
+
return { item, hrefKey, iconKey, order: getSocialsOrderFromDom(row.ownerDocument) };
|
|
9787
|
+
}
|
|
9788
|
+
function duplicateSocialItem(item, content) {
|
|
9789
|
+
const row = findSocialsRow(item);
|
|
9790
|
+
const created = row ? insertSocialItem(row, item, content) : null;
|
|
9791
|
+
if (!created) return null;
|
|
9792
|
+
const sourceHref = socialHrefKey(item);
|
|
9793
|
+
const sourceIcon = socialIconKey(item);
|
|
9794
|
+
const link = created.item;
|
|
9795
|
+
if (sourceHref) link.setAttribute("href", item.getAttribute("href") ?? "");
|
|
9796
|
+
const glyph = item.querySelector(ICON_SELECTOR)?.innerHTML;
|
|
9797
|
+
if (glyph) {
|
|
9798
|
+
const slot = link.querySelector(ICON_SELECTOR);
|
|
9799
|
+
if (slot) slot.innerHTML = glyph;
|
|
9800
|
+
}
|
|
9801
|
+
return {
|
|
9802
|
+
...created,
|
|
9803
|
+
copiedFrom: { href: sourceHref, icon: sourceIcon }
|
|
9804
|
+
};
|
|
9805
|
+
}
|
|
9806
|
+
function removeSocialItem(item, content) {
|
|
9807
|
+
const row = findSocialsRow(item);
|
|
9808
|
+
if (!row) return null;
|
|
9809
|
+
const hrefKey = socialHrefKey(item);
|
|
9810
|
+
const iconKey = socialIconKey(item);
|
|
9811
|
+
const removedKeys = [hrefKey, iconKey].filter((key) => Boolean(key));
|
|
9812
|
+
if (!removedKeys.length) return null;
|
|
9813
|
+
const previousOrder = getSocialsOrderFromDom(row.ownerDocument);
|
|
9814
|
+
const previousContent = Object.fromEntries(
|
|
9815
|
+
removedKeys.filter((key) => key in content).map((key) => [key, content[key]])
|
|
9816
|
+
);
|
|
9817
|
+
const unit = socialRowUnit(item);
|
|
9818
|
+
const nextSibling = unit.nextElementSibling;
|
|
9819
|
+
unit.remove();
|
|
9820
|
+
markSocialsRows(row.ownerDocument);
|
|
9821
|
+
return {
|
|
9822
|
+
removedKeys,
|
|
9823
|
+
previousContent,
|
|
9824
|
+
order: getSocialsOrderFromDom(row.ownerDocument),
|
|
9825
|
+
previousOrder,
|
|
9826
|
+
undo: () => {
|
|
9827
|
+
if (nextSibling) nextSibling.before(unit);
|
|
9828
|
+
else row.appendChild(unit);
|
|
9829
|
+
markSocialsRows(row.ownerDocument);
|
|
9830
|
+
}
|
|
9831
|
+
};
|
|
9832
|
+
}
|
|
9833
|
+
function applySocialsOrder(order, root = document) {
|
|
9834
|
+
listSocialsRows(root).forEach((row) => {
|
|
9835
|
+
const wanted = order[rowKeyOf(row)];
|
|
9836
|
+
if (!wanted) return;
|
|
9837
|
+
const byKey = new Map(listSocialItems(row).map((item) => [socialHrefKey(item), item]));
|
|
9838
|
+
wanted.forEach((key) => {
|
|
9839
|
+
const item = byKey.get(key);
|
|
9840
|
+
if (item) row.appendChild(socialRowUnit(item));
|
|
9841
|
+
});
|
|
9842
|
+
});
|
|
9843
|
+
markSocialsRows(root);
|
|
9844
|
+
}
|
|
9845
|
+
function reconcileSocialsFromContent(content, root = document) {
|
|
9846
|
+
markSocialsRows(root);
|
|
9847
|
+
const stored = parseSocialsOrder(content[SOCIALS_ORDER_KEY]);
|
|
9848
|
+
if (!stored) return;
|
|
9849
|
+
listSocialsRows(root).forEach((row) => {
|
|
9850
|
+
const wanted = stored[rowKeyOf(row)];
|
|
9851
|
+
if (!wanted) return;
|
|
9852
|
+
if (!wanted.length) return;
|
|
9853
|
+
wanted.forEach((key) => {
|
|
9854
|
+
if (listSocialItems(row).some((item) => socialHrefKey(item) === key)) return;
|
|
9855
|
+
if (!hasStoredValue(content, key)) return;
|
|
9856
|
+
const created = insertSocialItem(row, null, content);
|
|
9857
|
+
if (created) {
|
|
9858
|
+
created.item.setAttribute("data-ohw-href-key", key);
|
|
9859
|
+
created.item.querySelector(ICON_SELECTOR)?.setAttribute("data-ohw-key", key.replace(/-href$/, ""));
|
|
9860
|
+
applyStoredValues(created.item, content);
|
|
9861
|
+
}
|
|
9862
|
+
});
|
|
9863
|
+
const present = listSocialItems(row);
|
|
9864
|
+
const surviving = present.filter((item) => {
|
|
9865
|
+
const key = socialHrefKey(item);
|
|
9866
|
+
return !key || wanted.includes(key);
|
|
9867
|
+
});
|
|
9868
|
+
if (surviving.length) {
|
|
9869
|
+
present.forEach((item) => {
|
|
9870
|
+
if (!surviving.includes(item)) socialRowUnit(item).remove();
|
|
9871
|
+
});
|
|
9872
|
+
}
|
|
9873
|
+
});
|
|
9874
|
+
applySocialsOrder(stored, root);
|
|
9875
|
+
}
|
|
9876
|
+
var DROP_BAR_THICKNESS = 3;
|
|
9877
|
+
function buildSocialDropSlots(row) {
|
|
9878
|
+
const items = listSocialItems(row);
|
|
9879
|
+
if (!items.length) return [];
|
|
9880
|
+
return items.concat(items[items.length - 1]).map((item, index) => {
|
|
9881
|
+
const rect = item.getBoundingClientRect();
|
|
9882
|
+
const left = (index === items.length ? rect.right : rect.left) - DROP_BAR_THICKNESS / 2;
|
|
9883
|
+
return {
|
|
9884
|
+
insertIndex: index,
|
|
9885
|
+
columnIndex: -1,
|
|
9886
|
+
left,
|
|
9887
|
+
top: rect.top,
|
|
9888
|
+
width: DROP_BAR_THICKNESS,
|
|
9889
|
+
height: rect.height,
|
|
9890
|
+
direction: "vertical"
|
|
9891
|
+
};
|
|
9892
|
+
});
|
|
9893
|
+
}
|
|
9894
|
+
function findSocialByHrefKey(hrefKey, root = document) {
|
|
9895
|
+
const el = root.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
9896
|
+
return el ? getSocialItem(el) : null;
|
|
9897
|
+
}
|
|
9898
|
+
function buildSocialDropSlotsForKey(hrefKey, root = document) {
|
|
9899
|
+
const item = findSocialByHrefKey(hrefKey, root);
|
|
9900
|
+
const row = item ? findSocialsRow(item) : null;
|
|
9901
|
+
return row ? buildSocialDropSlots(row) : [];
|
|
9902
|
+
}
|
|
9903
|
+
function hitTestSocialDropSlot(clientX, clientY, draggedHrefKey, root = document) {
|
|
9904
|
+
const distanceTo = (slot) => {
|
|
9905
|
+
const dx = clientX - (slot.left + slot.width / 2);
|
|
9906
|
+
const dy = clientY < slot.top ? slot.top - clientY : Math.max(0, clientY - (slot.top + slot.height));
|
|
9907
|
+
return Math.hypot(dx, dy);
|
|
9908
|
+
};
|
|
9909
|
+
const slots = buildSocialDropSlotsForKey(draggedHrefKey, root);
|
|
9910
|
+
return slots.reduce((best, slot) => {
|
|
9911
|
+
return !best || distanceTo(slot) < distanceTo(best) ? slot : best;
|
|
9912
|
+
}, null);
|
|
9913
|
+
}
|
|
9914
|
+
function planSocialMove(hrefKey, insertIndex, root = document) {
|
|
9915
|
+
const item = findSocialByHrefKey(hrefKey, root);
|
|
9916
|
+
const row = item ? findSocialsRow(item) : null;
|
|
9917
|
+
if (!row) return null;
|
|
9918
|
+
const order = getSocialsOrderFromDom(root);
|
|
9919
|
+
const key = rowKeyOf(row);
|
|
9920
|
+
const current = order[key];
|
|
9921
|
+
if (!current) return null;
|
|
9922
|
+
const from = current.indexOf(hrefKey);
|
|
9923
|
+
if (from < 0) return null;
|
|
9924
|
+
const next = current.filter((_, index) => index !== from);
|
|
9925
|
+
next.splice(insertIndex > from ? insertIndex - 1 : insertIndex, 0, hrefKey);
|
|
9926
|
+
return { ...order, [key]: next };
|
|
9927
|
+
}
|
|
9928
|
+
var SOCIALS_DISPLAY_KEY = "__ohw_socials_display";
|
|
9929
|
+
function readSocialsDisplay(row) {
|
|
9930
|
+
const items = listSocialItems(row);
|
|
9931
|
+
const visible = (el) => Boolean(el) && el.style.display !== "none" && el.getAttribute("data-ohw-hidden") === null;
|
|
9932
|
+
return {
|
|
9933
|
+
text: items.some((item) => visible(socialLabelElement(item))),
|
|
9934
|
+
icon: items.some((item) => visible(item.querySelector(ICON_SELECTOR)))
|
|
9935
|
+
};
|
|
9936
|
+
}
|
|
9937
|
+
function parseSocialsDisplay(raw) {
|
|
9938
|
+
if (!raw) return null;
|
|
9939
|
+
try {
|
|
9940
|
+
const parsed = JSON.parse(raw);
|
|
9941
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
9942
|
+
} catch {
|
|
9943
|
+
return null;
|
|
9944
|
+
}
|
|
9945
|
+
}
|
|
9946
|
+
function socialsDisplayFor(row, content) {
|
|
9947
|
+
return parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY])?.[rowKeyOf(row)] ?? readSocialsDisplay(row);
|
|
9948
|
+
}
|
|
9949
|
+
function socialsDisplayWith(row, display, content) {
|
|
9950
|
+
return { ...parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]) ?? {}, [rowKeyOf(row)]: display };
|
|
9951
|
+
}
|
|
9952
|
+
function applySocialsDisplayToRow(row, display) {
|
|
9953
|
+
listSocialItems(row).forEach((item) => {
|
|
9954
|
+
const label = socialLabelElement(item);
|
|
9955
|
+
const icon = item.querySelector(ICON_SELECTOR);
|
|
9956
|
+
if (label) label.style.display = display.text ? "" : "none";
|
|
9957
|
+
if (icon) icon.style.display = display.icon ? "" : "none";
|
|
9958
|
+
});
|
|
9959
|
+
}
|
|
9960
|
+
function applySocialsDisplayFromContent(content, root = document) {
|
|
9961
|
+
const stored = parseSocialsDisplay(content[SOCIALS_DISPLAY_KEY]);
|
|
9962
|
+
if (!stored) return;
|
|
9963
|
+
listSocialsRows(root).forEach((row) => {
|
|
9964
|
+
const display = stored[rowKeyOf(row)];
|
|
9965
|
+
if (!display) return;
|
|
9966
|
+
if (display.icon) {
|
|
9967
|
+
listSocialItems(row).forEach((item) => {
|
|
9968
|
+
const iconKey = ensureIconSlot(item);
|
|
9969
|
+
const slot = item.querySelector(ICON_SELECTOR);
|
|
9970
|
+
if (iconKey && slot && content[iconKey]) applyIconMarkup(slot, content[iconKey]);
|
|
9971
|
+
});
|
|
9972
|
+
}
|
|
9973
|
+
applySocialsDisplayToRow(row, display);
|
|
9974
|
+
});
|
|
9975
|
+
}
|
|
9976
|
+
function socialsMissingIcons(row) {
|
|
9977
|
+
return listSocialItems(row).filter((item) => !item.querySelector(ICON_SELECTOR)).map((item) => ({ hrefKey: socialHrefKey(item) ?? "", url: item.getAttribute("href") ?? "" })).filter((entry) => Boolean(entry.hrefKey));
|
|
9978
|
+
}
|
|
9979
|
+
function ensureIconSlot(item) {
|
|
9980
|
+
const existing = item.querySelector(ICON_SELECTOR);
|
|
9981
|
+
if (existing) return existing.dataset.ohwKey ?? null;
|
|
9982
|
+
const hrefKey = socialHrefKey(item);
|
|
9983
|
+
if (!hrefKey) return null;
|
|
9984
|
+
const iconKey = hrefKey.replace(/-href$/, "");
|
|
9985
|
+
const slot = document.createElement("span");
|
|
9986
|
+
slot.setAttribute("data-ohw-key", iconKey);
|
|
9987
|
+
slot.setAttribute("data-ohw-editable", "icon");
|
|
9988
|
+
slot.style.display = "inline-flex";
|
|
9989
|
+
item.prepend(slot);
|
|
9990
|
+
return iconKey;
|
|
9991
|
+
}
|
|
9992
|
+
|
|
9531
9993
|
// src/lib/footer-items.ts
|
|
9532
9994
|
var FOOTER_ORDER_KEY = "__ohw_footer_order";
|
|
9533
9995
|
var MAX_FOOTER_COLUMNS = 18;
|
|
@@ -11014,6 +11476,75 @@ function LogoSizePanel({
|
|
|
11014
11476
|
] });
|
|
11015
11477
|
}
|
|
11016
11478
|
|
|
11479
|
+
// src/ui/socials-display-panel.tsx
|
|
11480
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
11481
|
+
function DisplaySwitch({
|
|
11482
|
+
label,
|
|
11483
|
+
checked,
|
|
11484
|
+
disabled,
|
|
11485
|
+
onChange
|
|
11486
|
+
}) {
|
|
11487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
|
|
11488
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
11489
|
+
"span",
|
|
11490
|
+
{
|
|
11491
|
+
className: cn(
|
|
11492
|
+
"min-w-0 flex-1 text-sm font-medium leading-5",
|
|
11493
|
+
disabled ? "text-muted-foreground" : "text-foreground"
|
|
11494
|
+
),
|
|
11495
|
+
children: label
|
|
11496
|
+
}
|
|
11497
|
+
),
|
|
11498
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
11499
|
+
"button",
|
|
11500
|
+
{
|
|
11501
|
+
type: "button",
|
|
11502
|
+
role: "switch",
|
|
11503
|
+
"aria-checked": checked,
|
|
11504
|
+
"aria-label": label,
|
|
11505
|
+
disabled,
|
|
11506
|
+
onClick: () => onChange(!checked),
|
|
11507
|
+
className: cn(
|
|
11508
|
+
"relative h-5 w-9 shrink-0 rounded-full transition-colors",
|
|
11509
|
+
checked ? "bg-primary" : "bg-primary-50",
|
|
11510
|
+
disabled ? "cursor-default opacity-50" : "cursor-pointer"
|
|
11511
|
+
),
|
|
11512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
11513
|
+
"span",
|
|
11514
|
+
{
|
|
11515
|
+
className: cn(
|
|
11516
|
+
"absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all",
|
|
11517
|
+
checked ? "left-[1.125rem]" : "left-0.5"
|
|
11518
|
+
)
|
|
11519
|
+
}
|
|
11520
|
+
)
|
|
11521
|
+
}
|
|
11522
|
+
)
|
|
11523
|
+
] });
|
|
11524
|
+
}
|
|
11525
|
+
function SocialsDisplayPanel({ display, onChange, className }) {
|
|
11526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cn("flex w-full flex-col gap-3", className), children: [
|
|
11527
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
11528
|
+
DisplaySwitch,
|
|
11529
|
+
{
|
|
11530
|
+
label: "Text",
|
|
11531
|
+
checked: display.text,
|
|
11532
|
+
disabled: display.text && !display.icon,
|
|
11533
|
+
onChange: (text) => onChange({ ...display, text })
|
|
11534
|
+
}
|
|
11535
|
+
),
|
|
11536
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
11537
|
+
DisplaySwitch,
|
|
11538
|
+
{
|
|
11539
|
+
label: "Icon",
|
|
11540
|
+
checked: display.icon,
|
|
11541
|
+
disabled: display.icon && !display.text,
|
|
11542
|
+
onChange: (icon) => onChange({ ...display, icon })
|
|
11543
|
+
}
|
|
11544
|
+
)
|
|
11545
|
+
] });
|
|
11546
|
+
}
|
|
11547
|
+
|
|
11017
11548
|
// src/lib/item-drag-interaction.ts
|
|
11018
11549
|
function disableNativeHrefDrag(el) {
|
|
11019
11550
|
if (el.draggable) el.draggable = false;
|
|
@@ -11563,7 +12094,7 @@ function useNavItemDrag({
|
|
|
11563
12094
|
|
|
11564
12095
|
// src/ui/footer-container-chrome.tsx
|
|
11565
12096
|
var import_lucide_react15 = require("lucide-react");
|
|
11566
|
-
var
|
|
12097
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
11567
12098
|
function FooterContainerChrome({
|
|
11568
12099
|
rect,
|
|
11569
12100
|
onAdd,
|
|
@@ -11571,7 +12102,7 @@ function FooterContainerChrome({
|
|
|
11571
12102
|
}) {
|
|
11572
12103
|
const chromeGap = 6;
|
|
11573
12104
|
const buttonMargin = 7;
|
|
11574
|
-
return /* @__PURE__ */ (0,
|
|
12105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
11575
12106
|
"div",
|
|
11576
12107
|
{
|
|
11577
12108
|
"data-ohw-footer-container-chrome": "",
|
|
@@ -11583,8 +12114,8 @@ function FooterContainerChrome({
|
|
|
11583
12114
|
width: rect.width + chromeGap * 2,
|
|
11584
12115
|
height: rect.height + chromeGap * 2
|
|
11585
12116
|
},
|
|
11586
|
-
children: /* @__PURE__ */ (0,
|
|
11587
|
-
/* @__PURE__ */ (0,
|
|
12117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
12118
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
11588
12119
|
"button",
|
|
11589
12120
|
{
|
|
11590
12121
|
type: "button",
|
|
@@ -11603,10 +12134,10 @@ function FooterContainerChrome({
|
|
|
11603
12134
|
if (addDisabled) return;
|
|
11604
12135
|
onAdd();
|
|
11605
12136
|
},
|
|
11606
|
-
children: /* @__PURE__ */ (0,
|
|
12137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react15.Plus, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
11607
12138
|
}
|
|
11608
12139
|
) }),
|
|
11609
|
-
/* @__PURE__ */ (0,
|
|
12140
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
11610
12141
|
] })
|
|
11611
12142
|
}
|
|
11612
12143
|
) });
|
|
@@ -11903,7 +12434,7 @@ function isNavbarLinksContainer(el) {
|
|
|
11903
12434
|
function isNavigationItem(el) {
|
|
11904
12435
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
11905
12436
|
if (!anchor) return false;
|
|
11906
|
-
return Boolean(anchor.querySelector('[data-ohw-editable="text"]'));
|
|
12437
|
+
return Boolean(anchor.querySelector('[data-ohw-editable="text"]')) || Boolean(getSocialItem(anchor));
|
|
11907
12438
|
}
|
|
11908
12439
|
function findFooterItemGroup(item) {
|
|
11909
12440
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -11924,8 +12455,9 @@ function isInferredFooterGroup(el) {
|
|
|
11924
12455
|
const footer = el.closest("footer");
|
|
11925
12456
|
if (!footer || el === footer) return false;
|
|
11926
12457
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
12458
|
+
if (isSocialsRow(el)) return false;
|
|
11927
12459
|
const count = Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(
|
|
11928
|
-
isNavigationItem
|
|
12460
|
+
(item) => isNavigationItem(item) && !getSocialItem(item)
|
|
11929
12461
|
).length;
|
|
11930
12462
|
return count >= 2;
|
|
11931
12463
|
}
|
|
@@ -11969,7 +12501,8 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
11969
12501
|
if (key.endsWith("-href")) applyLinkByKey2(key, text);
|
|
11970
12502
|
else {
|
|
11971
12503
|
document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
|
|
11972
|
-
el.
|
|
12504
|
+
if (el.getAttribute("data-ohw-editable") === "icon") applyIconMarkup(el, text);
|
|
12505
|
+
else el.textContent = text;
|
|
11973
12506
|
});
|
|
11974
12507
|
}
|
|
11975
12508
|
}
|
|
@@ -12031,6 +12564,21 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12031
12564
|
});
|
|
12032
12565
|
return true;
|
|
12033
12566
|
}
|
|
12567
|
+
const social = getSocialItem(selected);
|
|
12568
|
+
if (social) {
|
|
12569
|
+
const result = removeSocialItem(social, getEditContent());
|
|
12570
|
+
if (!result) return false;
|
|
12571
|
+
finishDelete({
|
|
12572
|
+
toastTitle: "Social deleted",
|
|
12573
|
+
removedKeys: result.removedKeys,
|
|
12574
|
+
previousContent: result.previousContent,
|
|
12575
|
+
orderKey: SOCIALS_ORDER_KEY,
|
|
12576
|
+
orderJson: JSON.stringify(result.order),
|
|
12577
|
+
previousOrderJson: JSON.stringify(result.previousOrder),
|
|
12578
|
+
undoDom: result.undo
|
|
12579
|
+
});
|
|
12580
|
+
return true;
|
|
12581
|
+
}
|
|
12034
12582
|
if (isFooterHrefKey(hrefKey)) {
|
|
12035
12583
|
const result = deleteFooterItem(selected);
|
|
12036
12584
|
if (!result) return false;
|
|
@@ -12050,13 +12598,13 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
12050
12598
|
|
|
12051
12599
|
// src/ui/navbar-container-chrome.tsx
|
|
12052
12600
|
var import_lucide_react16 = require("lucide-react");
|
|
12053
|
-
var
|
|
12601
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
12054
12602
|
function NavbarContainerChrome({
|
|
12055
12603
|
rect,
|
|
12056
12604
|
onAdd
|
|
12057
12605
|
}) {
|
|
12058
12606
|
const chromeGap = 6;
|
|
12059
|
-
return /* @__PURE__ */ (0,
|
|
12607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
12060
12608
|
"div",
|
|
12061
12609
|
{
|
|
12062
12610
|
"data-ohw-navbar-container-chrome": "",
|
|
@@ -12068,7 +12616,7 @@ function NavbarContainerChrome({
|
|
|
12068
12616
|
width: rect.width + chromeGap * 2,
|
|
12069
12617
|
height: rect.height + chromeGap * 2
|
|
12070
12618
|
},
|
|
12071
|
-
children: /* @__PURE__ */ (0,
|
|
12619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
12072
12620
|
"button",
|
|
12073
12621
|
{
|
|
12074
12622
|
type: "button",
|
|
@@ -12085,7 +12633,7 @@ function NavbarContainerChrome({
|
|
|
12085
12633
|
e.stopPropagation();
|
|
12086
12634
|
onAdd();
|
|
12087
12635
|
},
|
|
12088
|
-
children: /* @__PURE__ */ (0,
|
|
12636
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react16.Plus, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
12089
12637
|
}
|
|
12090
12638
|
)
|
|
12091
12639
|
}
|
|
@@ -12094,7 +12642,7 @@ function NavbarContainerChrome({
|
|
|
12094
12642
|
|
|
12095
12643
|
// src/ui/drop-indicator.tsx
|
|
12096
12644
|
var React10 = __toESM(require("react"), 1);
|
|
12097
|
-
var
|
|
12645
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
12098
12646
|
var dropIndicatorVariants = cva(
|
|
12099
12647
|
"ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
|
|
12100
12648
|
{
|
|
@@ -12118,7 +12666,7 @@ var dropIndicatorVariants = cva(
|
|
|
12118
12666
|
);
|
|
12119
12667
|
var DropIndicator = React10.forwardRef(
|
|
12120
12668
|
({ className, direction, state, ...props }, ref) => {
|
|
12121
|
-
return /* @__PURE__ */ (0,
|
|
12669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
12122
12670
|
"div",
|
|
12123
12671
|
{
|
|
12124
12672
|
ref,
|
|
@@ -12135,7 +12683,7 @@ var DropIndicator = React10.forwardRef(
|
|
|
12135
12683
|
DropIndicator.displayName = "DropIndicator";
|
|
12136
12684
|
|
|
12137
12685
|
// src/ui/badge.tsx
|
|
12138
|
-
var
|
|
12686
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
12139
12687
|
var badgeVariants = cva(
|
|
12140
12688
|
"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",
|
|
12141
12689
|
{
|
|
@@ -12153,12 +12701,12 @@ var badgeVariants = cva(
|
|
|
12153
12701
|
}
|
|
12154
12702
|
);
|
|
12155
12703
|
function Badge({ className, variant, ...props }) {
|
|
12156
|
-
return /* @__PURE__ */ (0,
|
|
12704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
12157
12705
|
}
|
|
12158
12706
|
|
|
12159
12707
|
// src/OhhwellsBridge.tsx
|
|
12160
12708
|
var import_lucide_react17 = require("lucide-react");
|
|
12161
|
-
var
|
|
12709
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
12162
12710
|
var PRIMARY3 = "#0885FE";
|
|
12163
12711
|
var IMAGE_FADE_MS = 300;
|
|
12164
12712
|
function runOpacityFade(el, onDone) {
|
|
@@ -12327,7 +12875,7 @@ function mountSchedulingWidget(anchorId, notifyOnConnect = false, scheduleId, be
|
|
|
12327
12875
|
const root = (0, import_client2.createRoot)(container);
|
|
12328
12876
|
(0, import_react_dom3.flushSync)(() => {
|
|
12329
12877
|
root.render(
|
|
12330
|
-
/* @__PURE__ */ (0,
|
|
12878
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
12331
12879
|
SchedulingWidget,
|
|
12332
12880
|
{
|
|
12333
12881
|
notifyOnConnect,
|
|
@@ -12567,13 +13115,29 @@ function isNavItemPointerTarget(el) {
|
|
|
12567
13115
|
function getNavigationItemAnchor(el) {
|
|
12568
13116
|
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
12569
13117
|
if (!anchor) return null;
|
|
12570
|
-
if (!anchor.querySelector('[data-ohw-editable="text"]')) return null;
|
|
13118
|
+
if (!anchor.querySelector('[data-ohw-editable="text"]') && !getSocialItem(anchor)) return null;
|
|
12571
13119
|
if (!isNavItemPointerTarget(anchor)) return null;
|
|
12572
13120
|
return anchor;
|
|
12573
13121
|
}
|
|
12574
13122
|
function isNavigationItem2(el) {
|
|
12575
13123
|
return getNavigationItemAnchor(el) !== null;
|
|
12576
13124
|
}
|
|
13125
|
+
function requestSocialDialog(anchor, post, content) {
|
|
13126
|
+
const item = getSocialItem(anchor);
|
|
13127
|
+
if (!item) return false;
|
|
13128
|
+
const iconKey = item.querySelector('[data-ohw-editable="icon"]')?.dataset.ohwKey ?? "";
|
|
13129
|
+
post({
|
|
13130
|
+
type: "ow:social-pick",
|
|
13131
|
+
hrefKey: item.getAttribute("data-ohw-href-key") ?? "",
|
|
13132
|
+
iconKey,
|
|
13133
|
+
url: getLinkHref4(item),
|
|
13134
|
+
iconStyle: detectIconStyle(item),
|
|
13135
|
+
// What was chosen last time. Guessing from the address instead reads as "Website" for anything
|
|
13136
|
+
// unrecognised, and for an item with no address at all — so a deliberate choice looked lost.
|
|
13137
|
+
platformId: content[socialPlatformKey(iconKey)] ?? ""
|
|
13138
|
+
});
|
|
13139
|
+
return true;
|
|
13140
|
+
}
|
|
12577
13141
|
function listNavigationItems() {
|
|
12578
13142
|
return Array.from(
|
|
12579
13143
|
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
@@ -12608,7 +13172,7 @@ function getNavigationRoot(el) {
|
|
|
12608
13172
|
return el.closest("nav, footer, aside");
|
|
12609
13173
|
}
|
|
12610
13174
|
function countFooterNavItems(el) {
|
|
12611
|
-
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem2).length;
|
|
13175
|
+
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter((item) => isNavigationItem2(item) && !getSocialItem(item)).length;
|
|
12612
13176
|
}
|
|
12613
13177
|
function findFooterItemGroup2(item) {
|
|
12614
13178
|
const explicit = item.closest("[data-ohw-footer-col], [data-ohw-footer-column]");
|
|
@@ -12629,10 +13193,11 @@ function isInferredFooterGroup2(el) {
|
|
|
12629
13193
|
const footer = el.closest("footer");
|
|
12630
13194
|
if (!footer || el === footer) return false;
|
|
12631
13195
|
if (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column")) return true;
|
|
13196
|
+
if (isSocialsRow(el)) return false;
|
|
12632
13197
|
return countFooterNavItems(el) >= 2;
|
|
12633
13198
|
}
|
|
12634
13199
|
function isNavigationContainer(el) {
|
|
12635
|
-
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);
|
|
13200
|
+
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);
|
|
12636
13201
|
}
|
|
12637
13202
|
function isNavbarLinksContainer2(el) {
|
|
12638
13203
|
return el.hasAttribute("data-ohw-nav-container");
|
|
@@ -12715,6 +13280,8 @@ function resolveNavContainerSelectionTarget(target, clientX, clientY) {
|
|
|
12715
13280
|
return null;
|
|
12716
13281
|
}
|
|
12717
13282
|
function getNavigationSelectionParent(el) {
|
|
13283
|
+
const socialsRow = findSocialsRow(el);
|
|
13284
|
+
if (socialsRow) return socialsRow;
|
|
12718
13285
|
if (isNavigationItem2(el)) {
|
|
12719
13286
|
const childrenRoot = el.closest("[data-ohw-nav-children]");
|
|
12720
13287
|
if (childrenRoot) {
|
|
@@ -12740,6 +13307,10 @@ function getNavigationSelectionParent(el) {
|
|
|
12740
13307
|
}
|
|
12741
13308
|
function collectNavigationItemSiblingHintRects(selected) {
|
|
12742
13309
|
if (!isNavigationItem2(selected)) return [];
|
|
13310
|
+
const socialsRow = findSocialsRow(selected);
|
|
13311
|
+
if (socialsRow) {
|
|
13312
|
+
return listSocialItems(socialsRow).filter((item) => item !== selected).map((item) => item.getBoundingClientRect());
|
|
13313
|
+
}
|
|
12743
13314
|
const footerColumn = getFooterColumn(selected);
|
|
12744
13315
|
if (footerColumn) {
|
|
12745
13316
|
return listFooterLinksInColumn(footerColumn).filter((link) => link !== selected).map((link) => link.getBoundingClientRect());
|
|
@@ -12972,7 +13543,7 @@ function EditGlowChrome({
|
|
|
12972
13543
|
hideHandle = false
|
|
12973
13544
|
}) {
|
|
12974
13545
|
const GAP = SELECTION_CHROME_GAP2;
|
|
12975
|
-
return /* @__PURE__ */ (0,
|
|
13546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
12976
13547
|
"div",
|
|
12977
13548
|
{
|
|
12978
13549
|
ref: elRef,
|
|
@@ -12987,7 +13558,7 @@ function EditGlowChrome({
|
|
|
12987
13558
|
zIndex: 2147483646
|
|
12988
13559
|
},
|
|
12989
13560
|
children: [
|
|
12990
|
-
/* @__PURE__ */ (0,
|
|
13561
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
12991
13562
|
"div",
|
|
12992
13563
|
{
|
|
12993
13564
|
style: {
|
|
@@ -13000,7 +13571,7 @@ function EditGlowChrome({
|
|
|
13000
13571
|
}
|
|
13001
13572
|
}
|
|
13002
13573
|
),
|
|
13003
|
-
reorderHrefKey && !hideHandle && /* @__PURE__ */ (0,
|
|
13574
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
13004
13575
|
"div",
|
|
13005
13576
|
{
|
|
13006
13577
|
"data-ohw-drag-handle-container": "",
|
|
@@ -13012,7 +13583,7 @@ function EditGlowChrome({
|
|
|
13012
13583
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
13013
13584
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
13014
13585
|
},
|
|
13015
|
-
children: /* @__PURE__ */ (0,
|
|
13586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
13016
13587
|
DragHandle,
|
|
13017
13588
|
{
|
|
13018
13589
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -13222,7 +13793,7 @@ function FloatingToolbar({
|
|
|
13222
13793
|
return () => ro.disconnect();
|
|
13223
13794
|
}, [showEditLink, activeCommands]);
|
|
13224
13795
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
13225
|
-
return /* @__PURE__ */ (0,
|
|
13796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
13226
13797
|
"div",
|
|
13227
13798
|
{
|
|
13228
13799
|
ref: setRefs,
|
|
@@ -13234,12 +13805,12 @@ function FloatingToolbar({
|
|
|
13234
13805
|
zIndex: 2147483647,
|
|
13235
13806
|
pointerEvents: "auto"
|
|
13236
13807
|
},
|
|
13237
|
-
children: /* @__PURE__ */ (0,
|
|
13238
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0,
|
|
13239
|
-
gi > 0 && /* @__PURE__ */ (0,
|
|
13808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(CustomToolbar, { children: [
|
|
13809
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react16.default.Fragment, { children: [
|
|
13810
|
+
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomToolbarDivider, {}),
|
|
13240
13811
|
btns.map((btn) => {
|
|
13241
13812
|
const isActive = activeCommands.has(btn.cmd);
|
|
13242
|
-
return /* @__PURE__ */ (0,
|
|
13813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
13243
13814
|
CustomToolbarButton,
|
|
13244
13815
|
{
|
|
13245
13816
|
title: btn.title,
|
|
@@ -13248,7 +13819,7 @@ function FloatingToolbar({
|
|
|
13248
13819
|
e.preventDefault();
|
|
13249
13820
|
onCommand(btn.cmd);
|
|
13250
13821
|
},
|
|
13251
|
-
children: /* @__PURE__ */ (0,
|
|
13822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
13252
13823
|
"svg",
|
|
13253
13824
|
{
|
|
13254
13825
|
width: "16",
|
|
@@ -13269,7 +13840,7 @@ function FloatingToolbar({
|
|
|
13269
13840
|
);
|
|
13270
13841
|
})
|
|
13271
13842
|
] }, gi)),
|
|
13272
|
-
showEditLink ? /* @__PURE__ */ (0,
|
|
13843
|
+
showEditLink ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
13273
13844
|
CustomToolbarButton,
|
|
13274
13845
|
{
|
|
13275
13846
|
type: "button",
|
|
@@ -13283,7 +13854,7 @@ function FloatingToolbar({
|
|
|
13283
13854
|
e.preventDefault();
|
|
13284
13855
|
e.stopPropagation();
|
|
13285
13856
|
},
|
|
13286
|
-
children: /* @__PURE__ */ (0,
|
|
13857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react17.Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
13287
13858
|
}
|
|
13288
13859
|
) : null
|
|
13289
13860
|
] })
|
|
@@ -13300,7 +13871,7 @@ function StateToggle({
|
|
|
13300
13871
|
states,
|
|
13301
13872
|
onStateChange
|
|
13302
13873
|
}) {
|
|
13303
|
-
return /* @__PURE__ */ (0,
|
|
13874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
13304
13875
|
ToggleGroup,
|
|
13305
13876
|
{
|
|
13306
13877
|
"data-ohw-state-toggle": "",
|
|
@@ -13314,7 +13885,7 @@ function StateToggle({
|
|
|
13314
13885
|
left: rect.right - 8,
|
|
13315
13886
|
transform: "translateX(-100%)"
|
|
13316
13887
|
},
|
|
13317
|
-
children: states.map((state) => /* @__PURE__ */ (0,
|
|
13888
|
+
children: states.map((state) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
13318
13889
|
}
|
|
13319
13890
|
);
|
|
13320
13891
|
}
|
|
@@ -13441,6 +14012,8 @@ function OhhwellsBridge() {
|
|
|
13441
14012
|
const toolbarVariantRef = (0, import_react16.useRef)("none");
|
|
13442
14013
|
toolbarVariantRef.current = toolbarVariant;
|
|
13443
14014
|
const [selectedIsCta, setSelectedIsCta] = (0, import_react16.useState)(false);
|
|
14015
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react16.useState)(false);
|
|
14016
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react16.useState)(false);
|
|
13444
14017
|
const [reorderHrefKey, setReorderHrefKey] = (0, import_react16.useState)(null);
|
|
13445
14018
|
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react16.useState)(false);
|
|
13446
14019
|
const [toggleState, setToggleState] = (0, import_react16.useState)(null);
|
|
@@ -13709,6 +14282,8 @@ function OhhwellsBridge() {
|
|
|
13709
14282
|
selectedHrefKeyRef.current = null;
|
|
13710
14283
|
selectedFooterColAttrRef.current = null;
|
|
13711
14284
|
setSelectedIsCta(false);
|
|
14285
|
+
setSelectedIsSocial(false);
|
|
14286
|
+
setSelectedIsSocialsRow(false);
|
|
13712
14287
|
setReorderHrefKey(null);
|
|
13713
14288
|
setReorderDragDisabled(false);
|
|
13714
14289
|
setIsFooterFrameSelection(false);
|
|
@@ -13793,6 +14368,8 @@ function OhhwellsBridge() {
|
|
|
13793
14368
|
selectedFooterColAttrRef.current = null;
|
|
13794
14369
|
markSelected(navAnchor);
|
|
13795
14370
|
setSelectedIsCta(isCtaButton(navAnchor));
|
|
14371
|
+
setSelectedIsSocial(Boolean(getSocialItem(navAnchor)));
|
|
14372
|
+
setSelectedIsSocialsRow(false);
|
|
13796
14373
|
const isDropdownTrigger = !isNestedNavChild(navAnchor) && (navItemHasDropdownChildren(navAnchor) || navItemOwnsDropdownPanel(navAnchor));
|
|
13797
14374
|
if (isNestedNavChild(navAnchor)) {
|
|
13798
14375
|
setNavGroupForceOpen(navAnchor, true);
|
|
@@ -13916,6 +14493,28 @@ function OhhwellsBridge() {
|
|
|
13916
14493
|
const handleAddChildItem = (0, import_react16.useCallback)(() => {
|
|
13917
14494
|
const selected = selectedElRef.current;
|
|
13918
14495
|
if (!selected) return;
|
|
14496
|
+
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
14497
|
+
if (socialsRow) {
|
|
14498
|
+
const after = getSocialItem(selected);
|
|
14499
|
+
const result2 = insertSocialItem(socialsRow, after, editContentRef.current);
|
|
14500
|
+
if (!result2) return;
|
|
14501
|
+
const orderJson = JSON.stringify(result2.order);
|
|
14502
|
+
applySocialsDisplayToRow(socialsRow, socialsDisplayFor(socialsRow, editContentRef.current));
|
|
14503
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14504
|
+
postToParent2({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
14505
|
+
postToParentRef.current({
|
|
14506
|
+
type: "ow:social-pick",
|
|
14507
|
+
hrefKey: result2.hrefKey,
|
|
14508
|
+
iconKey: result2.iconKey,
|
|
14509
|
+
url: "",
|
|
14510
|
+
iconStyle: detectIconStyle(result2.item),
|
|
14511
|
+
platformId: "",
|
|
14512
|
+
// Lets the editor undo the insert if the dialog is dismissed: an item that was never given
|
|
14513
|
+
// an address should not survive a Cancel.
|
|
14514
|
+
isNew: true
|
|
14515
|
+
});
|
|
14516
|
+
return;
|
|
14517
|
+
}
|
|
13919
14518
|
if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
|
|
13920
14519
|
if (!selected.hasAttribute("data-ohw-footer-col") && !selected.closest("[data-ohw-footer-col]")) {
|
|
13921
14520
|
}
|
|
@@ -14028,6 +14627,13 @@ function OhhwellsBridge() {
|
|
|
14028
14627
|
}
|
|
14029
14628
|
session.activeSlot = activeSlot;
|
|
14030
14629
|
setSiblingHintRects([]);
|
|
14630
|
+
if (session.kind === "social") {
|
|
14631
|
+
const slots2 = session.hrefKey ? buildSocialDropSlotsForKey(session.hrefKey) : [];
|
|
14632
|
+
setFooterDropSlots(slots2);
|
|
14633
|
+
const activeIdx2 = activeSlot ? slots2.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
14634
|
+
setActiveFooterDropIndex(activeIdx2 >= 0 ? activeIdx2 : null);
|
|
14635
|
+
return;
|
|
14636
|
+
}
|
|
14031
14637
|
if (session.kind === "link") {
|
|
14032
14638
|
const columns = listFooterColumns();
|
|
14033
14639
|
const slots2 = [];
|
|
@@ -14064,7 +14670,7 @@ function OhhwellsBridge() {
|
|
|
14064
14670
|
if (session.wasSelected && selectedElRef.current === session.draggedEl) {
|
|
14065
14671
|
setToolbarRect(rect);
|
|
14066
14672
|
}
|
|
14067
|
-
const initialSlot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
14673
|
+
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);
|
|
14068
14674
|
refreshFooterDragVisuals(session, initialSlot, session.lastClientX, session.lastClientY);
|
|
14069
14675
|
},
|
|
14070
14676
|
[refreshFooterDragVisuals]
|
|
@@ -14080,8 +14686,11 @@ function OhhwellsBridge() {
|
|
|
14080
14686
|
const x = typeof clientX === "number" && (clientX !== 0 || clientY !== 0) ? clientX : session.lastClientX;
|
|
14081
14687
|
const y = typeof clientY === "number" && (clientX !== 0 || clientY !== 0) ? clientY : session.lastClientY;
|
|
14082
14688
|
let nextOrder = null;
|
|
14083
|
-
|
|
14084
|
-
|
|
14689
|
+
let nextSocialsOrder = null;
|
|
14690
|
+
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);
|
|
14691
|
+
if (session.kind === "social" && session.hrefKey && slot) {
|
|
14692
|
+
nextSocialsOrder = planSocialMove(session.hrefKey, slot.insertIndex);
|
|
14693
|
+
} else if (session.kind === "link" && session.hrefKey && slot) {
|
|
14085
14694
|
nextOrder = planFooterLinkMove(session.hrefKey, slot.columnIndex, slot.insertIndex);
|
|
14086
14695
|
} else if (session.kind === "column" && slot) {
|
|
14087
14696
|
nextOrder = planFooterColumnMove(session.sourceColumnIndex, slot.insertIndex);
|
|
@@ -14139,6 +14748,27 @@ function OhhwellsBridge() {
|
|
|
14139
14748
|
}
|
|
14140
14749
|
deselectRef.current();
|
|
14141
14750
|
};
|
|
14751
|
+
if (nextSocialsOrder) {
|
|
14752
|
+
const orderJson = JSON.stringify(nextSocialsOrder);
|
|
14753
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
14754
|
+
applySocialsOrder(nextSocialsOrder);
|
|
14755
|
+
postToParentRef.current({
|
|
14756
|
+
type: "ow:change",
|
|
14757
|
+
nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }]
|
|
14758
|
+
});
|
|
14759
|
+
applySelectionAfterDrop();
|
|
14760
|
+
clearFooterDragVisuals();
|
|
14761
|
+
const reapply = nextSocialsOrder;
|
|
14762
|
+
requestAnimationFrame(() => {
|
|
14763
|
+
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14764
|
+
applySelectionAfterDrop();
|
|
14765
|
+
requestAnimationFrame(() => {
|
|
14766
|
+
if (editContentRef.current[SOCIALS_ORDER_KEY] === orderJson) applySocialsOrder(reapply);
|
|
14767
|
+
resyncSelectedNavigationItem();
|
|
14768
|
+
});
|
|
14769
|
+
});
|
|
14770
|
+
return;
|
|
14771
|
+
}
|
|
14142
14772
|
if (nextOrder) {
|
|
14143
14773
|
const orderJson = JSON.stringify(nextOrder);
|
|
14144
14774
|
editContentRef.current = {
|
|
@@ -14177,7 +14807,22 @@ function OhhwellsBridge() {
|
|
|
14177
14807
|
const startFooterLinkDrag = (0, import_react16.useCallback)(
|
|
14178
14808
|
(anchor, clientX, clientY, wasSelected) => {
|
|
14179
14809
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
14180
|
-
if (!hrefKey
|
|
14810
|
+
if (!hrefKey) return false;
|
|
14811
|
+
if (getSocialItem(anchor)) {
|
|
14812
|
+
beginFooterDrag({
|
|
14813
|
+
kind: "social",
|
|
14814
|
+
hrefKey,
|
|
14815
|
+
columnEl: null,
|
|
14816
|
+
sourceColumnIndex: 0,
|
|
14817
|
+
wasSelected,
|
|
14818
|
+
draggedEl: anchor,
|
|
14819
|
+
lastClientX: clientX,
|
|
14820
|
+
lastClientY: clientY,
|
|
14821
|
+
activeSlot: null
|
|
14822
|
+
});
|
|
14823
|
+
return true;
|
|
14824
|
+
}
|
|
14825
|
+
if (!isFooterHrefKey(hrefKey)) return false;
|
|
14181
14826
|
const column = findFooterColumnForLink(anchor);
|
|
14182
14827
|
const columns = listFooterColumns();
|
|
14183
14828
|
beginFooterDrag({
|
|
@@ -14314,6 +14959,8 @@ function OhhwellsBridge() {
|
|
|
14314
14959
|
selectedFooterColAttrRef.current = null;
|
|
14315
14960
|
markSelected(anchor);
|
|
14316
14961
|
setSelectedIsCta(isCtaButton(anchor));
|
|
14962
|
+
setSelectedIsSocial(Boolean(getSocialItem(anchor)));
|
|
14963
|
+
setSelectedIsSocialsRow(false);
|
|
14317
14964
|
clearHrefKeyHover(anchor);
|
|
14318
14965
|
const isDropdownTrigger = !isNestedNavChild(anchor) && (navItemHasDropdownChildren(anchor) || navItemOwnsDropdownPanel(anchor));
|
|
14319
14966
|
if (isNestedNavChild(anchor)) {
|
|
@@ -14356,6 +15003,8 @@ function OhhwellsBridge() {
|
|
|
14356
15003
|
selectedFooterColAttrRef.current = isFooterColumn ? el.getAttribute("data-ohw-footer-col") ?? String(listFooterColumns().indexOf(el)) : null;
|
|
14357
15004
|
markSelected(el);
|
|
14358
15005
|
setSelectedIsCta(false);
|
|
15006
|
+
setSelectedIsSocial(false);
|
|
15007
|
+
setSelectedIsSocialsRow(isSocialsRow(el));
|
|
14359
15008
|
clearHrefKeyHover(el);
|
|
14360
15009
|
setNavGroupForceOpen(null, false);
|
|
14361
15010
|
hoveredNavContainerRef.current = null;
|
|
@@ -14403,6 +15052,9 @@ function OhhwellsBridge() {
|
|
|
14403
15052
|
selectedFooterColAttrRef.current = null;
|
|
14404
15053
|
markSelected(logoEl);
|
|
14405
15054
|
setSelectedIsCta(false);
|
|
15055
|
+
setSelectedIsSocial(false);
|
|
15056
|
+
setSelectedIsSocialsRow(false);
|
|
15057
|
+
setSelectedIsSocialsRow(false);
|
|
14406
15058
|
clearHrefKeyHover(logoEl);
|
|
14407
15059
|
hoveredNavContainerRef.current = null;
|
|
14408
15060
|
setHoveredNavContainerRect(null);
|
|
@@ -14435,6 +15087,39 @@ function OhhwellsBridge() {
|
|
|
14435
15087
|
placement
|
|
14436
15088
|
});
|
|
14437
15089
|
}, []);
|
|
15090
|
+
const openSocialsDisplayPanel = (0, import_react16.useCallback)((row) => {
|
|
15091
|
+
setParentScrollSnap(parentScrollRef.current);
|
|
15092
|
+
setFloatingPanel({
|
|
15093
|
+
key: "socials-display",
|
|
15094
|
+
title: "Style",
|
|
15095
|
+
context: "Socials \xB7 Footer",
|
|
15096
|
+
kind: "socials-display",
|
|
15097
|
+
row
|
|
15098
|
+
});
|
|
15099
|
+
}, []);
|
|
15100
|
+
const changeSocialsDisplay = (0, import_react16.useCallback)(
|
|
15101
|
+
(row, next) => {
|
|
15102
|
+
if (next.icon) {
|
|
15103
|
+
const missing = socialsMissingIcons(row);
|
|
15104
|
+
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
15105
|
+
if (missing.length) {
|
|
15106
|
+
postToParentRef.current({ type: "ow:social-icons-needed", items: missing });
|
|
15107
|
+
}
|
|
15108
|
+
}
|
|
15109
|
+
applySocialsDisplayToRow(row, next);
|
|
15110
|
+
requestAnimationFrame(() => {
|
|
15111
|
+
if (selectedElRef.current === row && row.isConnected) setToolbarRect(row.getBoundingClientRect());
|
|
15112
|
+
});
|
|
15113
|
+
const displayJson = JSON.stringify(socialsDisplayWith(row, next, editContentRef.current));
|
|
15114
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_DISPLAY_KEY]: displayJson };
|
|
15115
|
+
postToParentRef.current({
|
|
15116
|
+
type: "ow:change",
|
|
15117
|
+
nodes: [{ key: SOCIALS_DISPLAY_KEY, text: displayJson }],
|
|
15118
|
+
flush: true
|
|
15119
|
+
});
|
|
15120
|
+
},
|
|
15121
|
+
[]
|
|
15122
|
+
);
|
|
14438
15123
|
const closeFloatingPanelOnly = (0, import_react16.useCallback)(() => {
|
|
14439
15124
|
setFloatingPanel(null);
|
|
14440
15125
|
setLogoSizeDraft(null);
|
|
@@ -14486,11 +15171,15 @@ function OhhwellsBridge() {
|
|
|
14486
15171
|
);
|
|
14487
15172
|
const activate = (0, import_react16.useCallback)((el, options) => {
|
|
14488
15173
|
if (activeElRef.current === el) return;
|
|
15174
|
+
if (isIconEditable(el)) return;
|
|
15175
|
+
if (el.hasAttribute("data-ohw-social-label")) return;
|
|
14489
15176
|
clearSelectedAttr();
|
|
14490
15177
|
selectedElRef.current = null;
|
|
14491
15178
|
selectedHrefKeyRef.current = null;
|
|
14492
15179
|
selectedFooterColAttrRef.current = null;
|
|
14493
15180
|
setSelectedIsCta(false);
|
|
15181
|
+
setSelectedIsSocial(false);
|
|
15182
|
+
setSelectedIsSocialsRow(false);
|
|
14494
15183
|
deactivate();
|
|
14495
15184
|
if (hoveredImageRef.current) {
|
|
14496
15185
|
hoveredImageRef.current = null;
|
|
@@ -14634,7 +15323,7 @@ function OhhwellsBridge() {
|
|
|
14634
15323
|
} else if (el.dataset.ohwEditable === "link") {
|
|
14635
15324
|
applyLinkHref(el, val);
|
|
14636
15325
|
} else if (el.dataset.ohwEditable === "icon") {
|
|
14637
|
-
|
|
15326
|
+
applyIconMarkup(el, val);
|
|
14638
15327
|
} else if (el.innerHTML !== val) {
|
|
14639
15328
|
el.innerHTML = val;
|
|
14640
15329
|
}
|
|
@@ -14645,6 +15334,8 @@ function OhhwellsBridge() {
|
|
|
14645
15334
|
applyLogoSizes(content);
|
|
14646
15335
|
reconcileNavbarItemsFromContent(content);
|
|
14647
15336
|
reconcileFooterOrderFromContent(content);
|
|
15337
|
+
reconcileSocialsFromContent(content);
|
|
15338
|
+
applySocialsDisplayFromContent(content);
|
|
14648
15339
|
enforceLinkHrefs();
|
|
14649
15340
|
initSectionsFromContent(content, true);
|
|
14650
15341
|
sectionsLoadedRef.current = true;
|
|
@@ -14712,6 +15403,9 @@ function OhhwellsBridge() {
|
|
|
14712
15403
|
applyLogoFromContent(content);
|
|
14713
15404
|
reconcileNavbarItemsFromContent(content);
|
|
14714
15405
|
reconcileFooterOrderFromContent(content);
|
|
15406
|
+
reconcileSocialsFromContent(content);
|
|
15407
|
+
applySocialsDisplayFromContent(content);
|
|
15408
|
+
applySocialsDisplayFromContent(content);
|
|
14715
15409
|
} finally {
|
|
14716
15410
|
observer?.observe(document.body, { childList: true, subtree: true });
|
|
14717
15411
|
}
|
|
@@ -14789,6 +15483,9 @@ function OhhwellsBridge() {
|
|
|
14789
15483
|
const content = contentForNav();
|
|
14790
15484
|
reconcileNavbarItemsFromContent(content);
|
|
14791
15485
|
reconcileFooterOrderFromContent(content);
|
|
15486
|
+
reconcileSocialsFromContent(content);
|
|
15487
|
+
applySocialsDisplayFromContent(content);
|
|
15488
|
+
applySocialsDisplayFromContent(content);
|
|
14792
15489
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
14793
15490
|
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key"))) {
|
|
14794
15491
|
disableNativeHrefDrag(el);
|
|
@@ -15086,7 +15783,7 @@ function OhhwellsBridge() {
|
|
|
15086
15783
|
});
|
|
15087
15784
|
return;
|
|
15088
15785
|
}
|
|
15089
|
-
if (isIconEditable(editable)) {
|
|
15786
|
+
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
15090
15787
|
e.preventDefault();
|
|
15091
15788
|
e.stopPropagation();
|
|
15092
15789
|
aiSectionApiRef.current?.selectFromElement(editable);
|
|
@@ -15111,6 +15808,7 @@ function OhhwellsBridge() {
|
|
|
15111
15808
|
e.stopPropagation();
|
|
15112
15809
|
if (selectedElRef.current === navAnchor) {
|
|
15113
15810
|
if (e.detail >= 2) return;
|
|
15811
|
+
if (requestSocialDialog(navAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
15114
15812
|
activateRef.current(editable, { caretX: e.clientX, caretY: e.clientY });
|
|
15115
15813
|
return;
|
|
15116
15814
|
}
|
|
@@ -15127,6 +15825,7 @@ function OhhwellsBridge() {
|
|
|
15127
15825
|
e.preventDefault();
|
|
15128
15826
|
e.stopPropagation();
|
|
15129
15827
|
if (selectedElRef.current === hrefAnchor) {
|
|
15828
|
+
if (requestSocialDialog(hrefAnchor, postToParentRef.current, editContentRef.current)) return;
|
|
15130
15829
|
const textEditable = hrefAnchor.querySelector('[data-ohw-editable="text"]') ?? hrefAnchor.querySelector("[data-ohw-editable]");
|
|
15131
15830
|
if (textEditable) {
|
|
15132
15831
|
activateRef.current(textEditable, {
|
|
@@ -15165,6 +15864,13 @@ function OhhwellsBridge() {
|
|
|
15165
15864
|
selectFrameRef.current(navContainerToSelect);
|
|
15166
15865
|
return;
|
|
15167
15866
|
}
|
|
15867
|
+
const socialsRowToSelect = isSocialsRow(target) ? target : null;
|
|
15868
|
+
if (socialsRowToSelect && !getSocialItem(target)) {
|
|
15869
|
+
e.preventDefault();
|
|
15870
|
+
e.stopPropagation();
|
|
15871
|
+
selectFrameRef.current(socialsRowToSelect);
|
|
15872
|
+
return;
|
|
15873
|
+
}
|
|
15168
15874
|
const footerColumnToSelect = resolveFooterColumnSelectionTarget(target, e.clientX, e.clientY);
|
|
15169
15875
|
if (footerColumnToSelect) {
|
|
15170
15876
|
e.preventDefault();
|
|
@@ -15217,6 +15923,7 @@ function OhhwellsBridge() {
|
|
|
15217
15923
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
15218
15924
|
return;
|
|
15219
15925
|
}
|
|
15926
|
+
if (getSocialItem(target)) return;
|
|
15220
15927
|
const navLabel = getNavigationLabelEditable(target);
|
|
15221
15928
|
const editable = navLabel?.editable ?? target.closest('[data-ohw-editable="text"], [data-ohw-editable="plain"]');
|
|
15222
15929
|
if (!editable || isMediaEditable(editable) || editable.dataset.ohwEditable === "link") return;
|
|
@@ -15990,7 +16697,7 @@ function OhhwellsBridge() {
|
|
|
15990
16697
|
if (footerSession) {
|
|
15991
16698
|
e.preventDefault();
|
|
15992
16699
|
if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
|
|
15993
|
-
const slot = footerSession.kind === "link" && footerSession.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, footerSession.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
16700
|
+
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);
|
|
15994
16701
|
refreshFooterDragVisualsRef.current(footerSession, slot, e.clientX, e.clientY);
|
|
15995
16702
|
return;
|
|
15996
16703
|
}
|
|
@@ -16042,6 +16749,49 @@ function OhhwellsBridge() {
|
|
|
16042
16749
|
resumeAnimTracks();
|
|
16043
16750
|
clearImageHover();
|
|
16044
16751
|
};
|
|
16752
|
+
const handleSocialCancel = (e) => {
|
|
16753
|
+
if (e.data?.type !== "ow:social-cancel") return;
|
|
16754
|
+
const { hrefKey } = e.data;
|
|
16755
|
+
const item = hrefKey ? findSocialByHrefKey(hrefKey) : null;
|
|
16756
|
+
if (!item) return;
|
|
16757
|
+
const removed = removeSocialItem(item, editContentRef.current);
|
|
16758
|
+
if (!removed) return;
|
|
16759
|
+
const orderJson = JSON.stringify(removed.order);
|
|
16760
|
+
editContentRef.current = { ...editContentRef.current, [SOCIALS_ORDER_KEY]: orderJson };
|
|
16761
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key: SOCIALS_ORDER_KEY, text: orderJson }] });
|
|
16762
|
+
deselectRef.current();
|
|
16763
|
+
};
|
|
16764
|
+
const handleSocialUpdate = (e) => {
|
|
16765
|
+
if (e.data?.type !== "ow:social-update") return;
|
|
16766
|
+
const updates = Array.isArray(e.data.items) ? e.data.items : [e.data];
|
|
16767
|
+
const nodes = [];
|
|
16768
|
+
for (const { hrefKey, iconKey, url, iconMarkup, platformId, label } of updates) {
|
|
16769
|
+
if (hrefKey) {
|
|
16770
|
+
document.querySelectorAll(`[data-ohw-href-key="${hrefKey}"]`).forEach((el) => applyLinkHref(el, url));
|
|
16771
|
+
nodes.push({ key: hrefKey, text: url });
|
|
16772
|
+
}
|
|
16773
|
+
if (iconKey && typeof iconMarkup === "string" && iconMarkup) {
|
|
16774
|
+
document.querySelectorAll(`[data-ohw-key="${iconKey}"][data-ohw-editable="icon"]`).forEach((el) => {
|
|
16775
|
+
applyIconMarkup(el, iconMarkup);
|
|
16776
|
+
});
|
|
16777
|
+
nodes.push({ key: iconKey, text: iconMarkup });
|
|
16778
|
+
}
|
|
16779
|
+
if (iconKey && platformId) nodes.push({ key: socialPlatformKey(iconKey), text: platformId });
|
|
16780
|
+
if (iconKey && label) {
|
|
16781
|
+
const labelKey = socialLabelKey(iconKey);
|
|
16782
|
+
document.querySelectorAll(`[data-ohw-key="${labelKey}"]`).forEach((el) => {
|
|
16783
|
+
el.textContent = label;
|
|
16784
|
+
});
|
|
16785
|
+
nodes.push({ key: labelKey, text: label });
|
|
16786
|
+
}
|
|
16787
|
+
}
|
|
16788
|
+
if (!nodes.length) return;
|
|
16789
|
+
editContentRef.current = {
|
|
16790
|
+
...editContentRef.current,
|
|
16791
|
+
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
16792
|
+
};
|
|
16793
|
+
postToParentRef.current({ type: "ow:change", nodes, flush: true });
|
|
16794
|
+
};
|
|
16045
16795
|
const handleIconMarkup = (e) => {
|
|
16046
16796
|
if (e.data?.type !== "ow:icon-markup") return;
|
|
16047
16797
|
const { key, markup } = e.data;
|
|
@@ -16051,9 +16801,9 @@ function OhhwellsBridge() {
|
|
|
16051
16801
|
);
|
|
16052
16802
|
if (!targets.length) return;
|
|
16053
16803
|
targets.forEach((el) => {
|
|
16054
|
-
el
|
|
16804
|
+
applyIconMarkup(el, markup);
|
|
16055
16805
|
});
|
|
16056
|
-
postToParentRef.current({ type: "ow:change", nodes: [{ key, text: markup }] });
|
|
16806
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key, text: markup }], flush: true });
|
|
16057
16807
|
};
|
|
16058
16808
|
const handleImageUrl = (e) => {
|
|
16059
16809
|
if (e.data?.type !== "ow:image-url") return;
|
|
@@ -16563,7 +17313,7 @@ function OhhwellsBridge() {
|
|
|
16563
17313
|
}
|
|
16564
17314
|
if (footerDragRef.current) {
|
|
16565
17315
|
const session = footerDragRef.current;
|
|
16566
|
-
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(session.lastClientX, session.lastClientY, session.hrefKey) : hitTestColumnDropSlot(session.lastClientX, session.lastClientY);
|
|
17316
|
+
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);
|
|
16567
17317
|
refreshFooterDragVisualsRef.current(session, slot, session.lastClientX, session.lastClientY);
|
|
16568
17318
|
}
|
|
16569
17319
|
if (navDragRef.current) {
|
|
@@ -16910,6 +17660,8 @@ function OhhwellsBridge() {
|
|
|
16910
17660
|
window.addEventListener("message", handleClearSchedulingWidget);
|
|
16911
17661
|
window.addEventListener("message", handleRemoveSchedulingSection);
|
|
16912
17662
|
window.addEventListener("message", handleCollectSection);
|
|
17663
|
+
window.addEventListener("message", handleSocialCancel);
|
|
17664
|
+
window.addEventListener("message", handleSocialUpdate);
|
|
16913
17665
|
window.addEventListener("message", handleIconMarkup);
|
|
16914
17666
|
window.addEventListener("message", handleImageUrl);
|
|
16915
17667
|
window.addEventListener("message", handleImageUploading);
|
|
@@ -16970,6 +17722,8 @@ function OhhwellsBridge() {
|
|
|
16970
17722
|
window.removeEventListener("message", handleClearSchedulingWidget);
|
|
16971
17723
|
window.removeEventListener("message", handleRemoveSchedulingSection);
|
|
16972
17724
|
window.removeEventListener("message", handleCollectSection);
|
|
17725
|
+
window.removeEventListener("message", handleSocialCancel);
|
|
17726
|
+
window.removeEventListener("message", handleSocialUpdate);
|
|
16973
17727
|
window.removeEventListener("message", handleIconMarkup);
|
|
16974
17728
|
window.removeEventListener("message", handleImageUrl);
|
|
16975
17729
|
window.removeEventListener("message", handleImageUploading);
|
|
@@ -17049,7 +17803,7 @@ function OhhwellsBridge() {
|
|
|
17049
17803
|
clearTextSelection();
|
|
17050
17804
|
const session = footerDragRef.current;
|
|
17051
17805
|
if (!session) return;
|
|
17052
|
-
const slot = session.kind === "link" && session.hrefKey ? hitTestLinkDropSlot(e.clientX, e.clientY, session.hrefKey) : hitTestColumnDropSlot(e.clientX, e.clientY);
|
|
17806
|
+
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);
|
|
17053
17807
|
refreshFooterDragVisualsRef.current(session, slot, e.clientX, e.clientY);
|
|
17054
17808
|
return;
|
|
17055
17809
|
}
|
|
@@ -17290,6 +18044,10 @@ function OhhwellsBridge() {
|
|
|
17290
18044
|
if (!anchor) return;
|
|
17291
18045
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
17292
18046
|
if (!key) return;
|
|
18047
|
+
if (requestSocialDialog(anchor, postToParentRef.current, editContentRef.current)) {
|
|
18048
|
+
deselect();
|
|
18049
|
+
return;
|
|
18050
|
+
}
|
|
17293
18051
|
bumpLinkPopoverGrace();
|
|
17294
18052
|
setLinkPopover({
|
|
17295
18053
|
key,
|
|
@@ -17330,6 +18088,32 @@ function OhhwellsBridge() {
|
|
|
17330
18088
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
17331
18089
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
17332
18090
|
if (!hrefKey) return;
|
|
18091
|
+
const social = getSocialItem(selected);
|
|
18092
|
+
if (social) {
|
|
18093
|
+
const result = duplicateSocialItem(social, editContentRef.current);
|
|
18094
|
+
if (!result) return;
|
|
18095
|
+
const orderJson = JSON.stringify(result.order);
|
|
18096
|
+
const carried = [
|
|
18097
|
+
{ from: result.copiedFrom?.href, to: result.hrefKey },
|
|
18098
|
+
{ from: result.copiedFrom?.icon, to: result.iconKey },
|
|
18099
|
+
{ from: result.copiedFrom?.icon ? socialPlatformKey(result.copiedFrom.icon) : null, to: socialPlatformKey(result.iconKey) }
|
|
18100
|
+
];
|
|
18101
|
+
const nodes = [{ key: SOCIALS_ORDER_KEY, text: orderJson }];
|
|
18102
|
+
for (const { from, to } of carried) {
|
|
18103
|
+
const value = from ? editContentRef.current[from] : void 0;
|
|
18104
|
+
if (value) nodes.push({ key: to, text: value });
|
|
18105
|
+
}
|
|
18106
|
+
editContentRef.current = {
|
|
18107
|
+
...editContentRef.current,
|
|
18108
|
+
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
18109
|
+
};
|
|
18110
|
+
postToParent2({ type: "ow:change", nodes });
|
|
18111
|
+
enforceLinkHrefs();
|
|
18112
|
+
const copyRow = findSocialsRow(result.item);
|
|
18113
|
+
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
18114
|
+
requestAnimationFrame(() => selectRef.current(result.item));
|
|
18115
|
+
return;
|
|
18116
|
+
}
|
|
17333
18117
|
if (isNavbarHrefKey(hrefKey)) {
|
|
17334
18118
|
const result = duplicateNavbarItem(selected);
|
|
17335
18119
|
if (!result) return;
|
|
@@ -17553,10 +18337,10 @@ function OhhwellsBridge() {
|
|
|
17553
18337
|
[postToParent2]
|
|
17554
18338
|
);
|
|
17555
18339
|
return bridgeRoot ? (0, import_react_dom4.createPortal)(
|
|
17556
|
-
/* @__PURE__ */ (0,
|
|
17557
|
-
/* @__PURE__ */ (0,
|
|
17558
|
-
isEditMode && /* @__PURE__ */ (0,
|
|
17559
|
-
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0,
|
|
18340
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
18341
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
18342
|
+
isEditMode && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AiSectionOverlay, { postToParent: postToParent2, apiRef: aiSectionApiRef }),
|
|
18343
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17560
18344
|
MediaOverlay,
|
|
17561
18345
|
{
|
|
17562
18346
|
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
@@ -17567,7 +18351,7 @@ function OhhwellsBridge() {
|
|
|
17567
18351
|
},
|
|
17568
18352
|
`uploading-${key}`
|
|
17569
18353
|
)),
|
|
17570
|
-
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0,
|
|
18354
|
+
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17571
18355
|
MediaOverlay,
|
|
17572
18356
|
{
|
|
17573
18357
|
hover: mediaHover,
|
|
@@ -17576,11 +18360,11 @@ function OhhwellsBridge() {
|
|
|
17576
18360
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
17577
18361
|
}
|
|
17578
18362
|
),
|
|
17579
|
-
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0,
|
|
17580
|
-
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0,
|
|
17581
|
-
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0,
|
|
17582
|
-
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0,
|
|
17583
|
-
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0,
|
|
18363
|
+
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
|
|
18364
|
+
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
18365
|
+
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
|
|
18366
|
+
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
|
|
18367
|
+
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17584
18368
|
"div",
|
|
17585
18369
|
{
|
|
17586
18370
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -17590,7 +18374,7 @@ function OhhwellsBridge() {
|
|
|
17590
18374
|
width: slot.width,
|
|
17591
18375
|
height: slot.height
|
|
17592
18376
|
},
|
|
17593
|
-
children: /* @__PURE__ */ (0,
|
|
18377
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17594
18378
|
DropIndicator,
|
|
17595
18379
|
{
|
|
17596
18380
|
direction: slot.direction,
|
|
@@ -17601,7 +18385,7 @@ function OhhwellsBridge() {
|
|
|
17601
18385
|
},
|
|
17602
18386
|
`footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
|
|
17603
18387
|
)),
|
|
17604
|
-
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0,
|
|
18388
|
+
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17605
18389
|
"div",
|
|
17606
18390
|
{
|
|
17607
18391
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -17611,7 +18395,7 @@ function OhhwellsBridge() {
|
|
|
17611
18395
|
width: slot.width,
|
|
17612
18396
|
height: slot.height
|
|
17613
18397
|
},
|
|
17614
|
-
children: /* @__PURE__ */ (0,
|
|
18398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17615
18399
|
DropIndicator,
|
|
17616
18400
|
{
|
|
17617
18401
|
direction: slot.direction,
|
|
@@ -17622,10 +18406,10 @@ function OhhwellsBridge() {
|
|
|
17622
18406
|
},
|
|
17623
18407
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
17624
18408
|
)),
|
|
17625
|
-
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0,
|
|
17626
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0,
|
|
17627
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0,
|
|
17628
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0,
|
|
18409
|
+
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
18410
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
18411
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
18412
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17629
18413
|
FooterContainerChrome,
|
|
17630
18414
|
{
|
|
17631
18415
|
rect: toolbarRect,
|
|
@@ -17633,7 +18417,7 @@ function OhhwellsBridge() {
|
|
|
17633
18417
|
addDisabled: !canAddFooterColumn()
|
|
17634
18418
|
}
|
|
17635
18419
|
),
|
|
17636
|
-
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame" || toolbarVariant === "logo") && /* @__PURE__ */ (0,
|
|
18420
|
+
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame" || toolbarVariant === "logo") && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17637
18421
|
ItemInteractionLayer,
|
|
17638
18422
|
{
|
|
17639
18423
|
rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
|
|
@@ -17648,10 +18432,18 @@ function OhhwellsBridge() {
|
|
|
17648
18432
|
onItemPointerDown: toolbarVariant === "logo" ? void 0 : handleItemChromePointerDown,
|
|
17649
18433
|
onItemClick: toolbarVariant === "logo" ? void 0 : handleItemChromeClick,
|
|
17650
18434
|
itemDragSurface: toolbarVariant !== "logo" && !isFooterFrameSelection,
|
|
17651
|
-
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && isFooterFrameSelection && !isItemDragging ? /* @__PURE__ */ (0,
|
|
18435
|
+
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && (isFooterFrameSelection || selectedIsSocialsRow) && !isItemDragging ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17652
18436
|
ItemActionToolbar,
|
|
17653
18437
|
{
|
|
17654
18438
|
onEditLink: openLinkPopoverForSelected,
|
|
18439
|
+
onStyle: () => {
|
|
18440
|
+
const row = selectedElRef.current;
|
|
18441
|
+
if (!row) return;
|
|
18442
|
+
if (floatingPanel?.kind === "socials-display") closeFloatingPanelOnly();
|
|
18443
|
+
else openSocialsDisplayPanel(row);
|
|
18444
|
+
},
|
|
18445
|
+
showStyle: selectedIsSocialsRow,
|
|
18446
|
+
styleActive: floatingPanel?.kind === "socials-display",
|
|
17655
18447
|
onAddItem: handleAddChildItem,
|
|
17656
18448
|
onSelectParent: handleSelectParent,
|
|
17657
18449
|
onDuplicate: handleDuplicateSelected,
|
|
@@ -17659,12 +18451,12 @@ function OhhwellsBridge() {
|
|
|
17659
18451
|
addItemDisabled: false,
|
|
17660
18452
|
editLinkDisabled: false,
|
|
17661
18453
|
moreDisabled: false,
|
|
17662
|
-
duplicateDisabled: isFooterFrameSelection,
|
|
17663
|
-
showEditLink: !isFooterFrameSelection && navDropdownPreviewOpen === null,
|
|
17664
|
-
showAddItem: isFooterFrameSelection || !selectedIsCta && Boolean(
|
|
18454
|
+
duplicateDisabled: isFooterFrameSelection || selectedIsSocialsRow,
|
|
18455
|
+
showEditLink: !isFooterFrameSelection && !selectedIsSocialsRow && navDropdownPreviewOpen === null,
|
|
18456
|
+
showAddItem: isFooterFrameSelection || selectedIsSocialsRow || !selectedIsCta && Boolean(
|
|
17665
18457
|
selectedElRef.current && isNavbarHrefKey(selectedElRef.current.getAttribute("data-ohw-href-key")) && !isNestedNavChild(selectedElRef.current)
|
|
17666
18458
|
),
|
|
17667
|
-
showMore: !selectedIsCta || isFooterFrameSelection,
|
|
18459
|
+
showMore: (!selectedIsCta || isFooterFrameSelection) && !selectedIsSocialsRow,
|
|
17668
18460
|
dropdownOpen: navDropdownPreviewOpen,
|
|
17669
18461
|
onDropdownOpenChange: handleNavDropdownOpenChange,
|
|
17670
18462
|
headingVisible: footerHeadingVisible,
|
|
@@ -17673,8 +18465,8 @@ function OhhwellsBridge() {
|
|
|
17673
18465
|
) : void 0
|
|
17674
18466
|
}
|
|
17675
18467
|
),
|
|
17676
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0,
|
|
17677
|
-
/* @__PURE__ */ (0,
|
|
18468
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
18469
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17678
18470
|
EditGlowChrome,
|
|
17679
18471
|
{
|
|
17680
18472
|
rect: toolbarRect,
|
|
@@ -17684,7 +18476,7 @@ function OhhwellsBridge() {
|
|
|
17684
18476
|
hideHandle: isItemDragging
|
|
17685
18477
|
}
|
|
17686
18478
|
),
|
|
17687
|
-
/* @__PURE__ */ (0,
|
|
18479
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17688
18480
|
FloatingToolbar,
|
|
17689
18481
|
{
|
|
17690
18482
|
rect: toolbarRect,
|
|
@@ -17697,7 +18489,7 @@ function OhhwellsBridge() {
|
|
|
17697
18489
|
}
|
|
17698
18490
|
)
|
|
17699
18491
|
] }),
|
|
17700
|
-
maxBadge && /* @__PURE__ */ (0,
|
|
18492
|
+
maxBadge && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
17701
18493
|
"div",
|
|
17702
18494
|
{
|
|
17703
18495
|
"data-ohw-max-badge": "",
|
|
@@ -17723,7 +18515,7 @@ function OhhwellsBridge() {
|
|
|
17723
18515
|
]
|
|
17724
18516
|
}
|
|
17725
18517
|
),
|
|
17726
|
-
toggleState && !linkPopover && /* @__PURE__ */ (0,
|
|
18518
|
+
toggleState && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17727
18519
|
StateToggle,
|
|
17728
18520
|
{
|
|
17729
18521
|
rect: toggleState.rect,
|
|
@@ -17732,15 +18524,15 @@ function OhhwellsBridge() {
|
|
|
17732
18524
|
onStateChange: handleStateChange
|
|
17733
18525
|
}
|
|
17734
18526
|
),
|
|
17735
|
-
sectionGap && !linkPopover && /* @__PURE__ */ (0,
|
|
18527
|
+
sectionGap && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
17736
18528
|
"div",
|
|
17737
18529
|
{
|
|
17738
18530
|
"data-ohw-section-insert-line": "",
|
|
17739
18531
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
17740
18532
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
17741
18533
|
children: [
|
|
17742
|
-
/* @__PURE__ */ (0,
|
|
17743
|
-
/* @__PURE__ */ (0,
|
|
18534
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
18535
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17744
18536
|
Badge,
|
|
17745
18537
|
{
|
|
17746
18538
|
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",
|
|
@@ -17757,11 +18549,11 @@ function OhhwellsBridge() {
|
|
|
17757
18549
|
children: "Add Section"
|
|
17758
18550
|
}
|
|
17759
18551
|
),
|
|
17760
|
-
/* @__PURE__ */ (0,
|
|
18552
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
17761
18553
|
]
|
|
17762
18554
|
}
|
|
17763
18555
|
),
|
|
17764
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0,
|
|
18556
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17765
18557
|
LinkPopover,
|
|
17766
18558
|
{
|
|
17767
18559
|
panelRef: linkPopoverPanelRef,
|
|
@@ -17778,7 +18570,29 @@ function OhhwellsBridge() {
|
|
|
17778
18570
|
},
|
|
17779
18571
|
linkPopover.key
|
|
17780
18572
|
) : null,
|
|
17781
|
-
floatingPanel && floatingPanel.kind === "
|
|
18573
|
+
floatingPanel && floatingPanel.kind === "socials-display" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18574
|
+
FloatingPanel,
|
|
18575
|
+
{
|
|
18576
|
+
open: true,
|
|
18577
|
+
title: floatingPanel.title,
|
|
18578
|
+
context: floatingPanel.context,
|
|
18579
|
+
position: floatingPanelPos,
|
|
18580
|
+
onPositionChange: setFloatingPanelPos,
|
|
18581
|
+
parentScroll: parentScrollSnap ?? parentScrollRef.current,
|
|
18582
|
+
onClose: closeFloatingPanelOnly,
|
|
18583
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18584
|
+
SocialsDisplayPanel,
|
|
18585
|
+
{
|
|
18586
|
+
display: socialsDisplayFor(floatingPanel.row, editContentRef.current),
|
|
18587
|
+
onChange: (next) => {
|
|
18588
|
+
changeSocialsDisplay(floatingPanel.row, next);
|
|
18589
|
+
setFloatingPanel({ ...floatingPanel });
|
|
18590
|
+
}
|
|
18591
|
+
}
|
|
18592
|
+
)
|
|
18593
|
+
}
|
|
18594
|
+
) : null,
|
|
18595
|
+
floatingPanel && floatingPanel.kind === "logo-size" && logoSizeDraft ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17782
18596
|
FloatingPanel,
|
|
17783
18597
|
{
|
|
17784
18598
|
open: true,
|
|
@@ -17788,7 +18602,7 @@ function OhhwellsBridge() {
|
|
|
17788
18602
|
onPositionChange: setFloatingPanelPos,
|
|
17789
18603
|
parentScroll: parentScrollSnap ?? parentScrollRef.current,
|
|
17790
18604
|
onClose: closeFloatingPanelAndDeselect,
|
|
17791
|
-
children: /* @__PURE__ */ (0,
|
|
18605
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
17792
18606
|
LogoSizePanel,
|
|
17793
18607
|
{
|
|
17794
18608
|
viewport: editorViewport,
|
|
@@ -17836,10 +18650,10 @@ function OhhwellsBridge() {
|
|
|
17836
18650
|
|
|
17837
18651
|
// src/ui/EmptySection.tsx
|
|
17838
18652
|
var import_link = __toESM(require("next/link"), 1);
|
|
17839
|
-
var
|
|
18653
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
17840
18654
|
function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey }) {
|
|
17841
|
-
return /* @__PURE__ */ (0,
|
|
17842
|
-
/* @__PURE__ */ (0,
|
|
18655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
18656
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
17843
18657
|
"p",
|
|
17844
18658
|
{
|
|
17845
18659
|
style: {
|
|
@@ -17851,10 +18665,10 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
17851
18665
|
color: "var(--brand-accent)",
|
|
17852
18666
|
marginBottom: "1.5rem"
|
|
17853
18667
|
},
|
|
17854
|
-
children: /* @__PURE__ */ (0,
|
|
18668
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_link.default, { href: homeHref, style: { color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ...eyebrowKey ? { "data-ohw-editable": "text", "data-ohw-key": eyebrowKey } : {}, children: "Home" }) })
|
|
17855
18669
|
}
|
|
17856
18670
|
),
|
|
17857
|
-
/* @__PURE__ */ (0,
|
|
18671
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
17858
18672
|
"h1",
|
|
17859
18673
|
{
|
|
17860
18674
|
style: {
|
|
@@ -17869,7 +18683,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
17869
18683
|
children: title
|
|
17870
18684
|
}
|
|
17871
18685
|
),
|
|
17872
|
-
/* @__PURE__ */ (0,
|
|
18686
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
17873
18687
|
"p",
|
|
17874
18688
|
{
|
|
17875
18689
|
style: {
|