@ohhwells/bridge 0.1.164-next.438 → 0.1.164
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 +1035 -1395
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -60
- package/dist/index.d.ts +1 -60
- package/dist/index.js +826 -1200
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +0 -116
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -86,7 +86,6 @@ __export(index_exports, {
|
|
|
86
86
|
hasMountedContentNodes: () => hasMountedContentNodes,
|
|
87
87
|
indexCollectionItems: () => indexCollectionItems,
|
|
88
88
|
insertFooterHours: () => insertFooterHours,
|
|
89
|
-
isDeadPageHref: () => isDeadPageHref,
|
|
90
89
|
isEditSessionActive: () => isEditSessionActive,
|
|
91
90
|
isPlainLeftClick: () => isPlainLeftClick,
|
|
92
91
|
isRenderableFooterTree: () => isRenderableFooterTree,
|
|
@@ -98,7 +97,6 @@ __export(index_exports, {
|
|
|
98
97
|
parseAiFooterState: () => parseAiFooterState,
|
|
99
98
|
parseAiSectionsState: () => parseAiSectionsState,
|
|
100
99
|
parseTarget: () => parseTarget,
|
|
101
|
-
planBuildPageSync: () => planBuildPageSync,
|
|
102
100
|
recordOverriddenPaths: () => recordOverriddenPaths,
|
|
103
101
|
releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
|
|
104
102
|
removeFooterBlock: () => removeFooterBlock,
|
|
@@ -117,7 +115,7 @@ __export(index_exports, {
|
|
|
117
115
|
module.exports = __toCommonJS(index_exports);
|
|
118
116
|
|
|
119
117
|
// src/OhhwellsBridge.tsx
|
|
120
|
-
var
|
|
118
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
121
119
|
var import_client3 = require("react-dom/client");
|
|
122
120
|
var import_react_dom5 = require("react-dom");
|
|
123
121
|
|
|
@@ -956,10 +954,6 @@ function useOhwCarousel(key, initial) {
|
|
|
956
954
|
if (Array.isArray(detail?.images)) setImages(detail.images);
|
|
957
955
|
};
|
|
958
956
|
el.addEventListener(CAROUSEL_EVENT, onChange);
|
|
959
|
-
const pending = parseSlides(el.getAttribute(CAROUSEL_VALUE_ATTR));
|
|
960
|
-
if (pending.length > 0) {
|
|
961
|
-
setImages((prev) => JSON.stringify(prev) === JSON.stringify(pending) ? prev : pending);
|
|
962
|
-
}
|
|
963
957
|
return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
|
|
964
958
|
}, [key]);
|
|
965
959
|
const bind = {
|
|
@@ -1214,21 +1208,21 @@ function chromeFrom(sample) {
|
|
|
1214
1208
|
};
|
|
1215
1209
|
}
|
|
1216
1210
|
function filledPrimary(seed) {
|
|
1217
|
-
const
|
|
1218
|
-
const luminance = relativeLuminance(
|
|
1211
|
+
const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1212
|
+
const luminance = relativeLuminance(paint);
|
|
1219
1213
|
return {
|
|
1220
|
-
background: toCss({ ...
|
|
1214
|
+
background: toCss({ ...paint, a: 1 }),
|
|
1221
1215
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1222
1216
|
borderColor: TRANSPARENT,
|
|
1223
1217
|
borderWidth: "0px"
|
|
1224
1218
|
};
|
|
1225
1219
|
}
|
|
1226
1220
|
function generatedSecondary(primary) {
|
|
1227
|
-
const
|
|
1221
|
+
const paint = accentColor(primary);
|
|
1228
1222
|
return {
|
|
1229
1223
|
background: TRANSPARENT,
|
|
1230
|
-
color:
|
|
1231
|
-
borderColor:
|
|
1224
|
+
color: paint,
|
|
1225
|
+
borderColor: paint,
|
|
1232
1226
|
borderWidth: "1px"
|
|
1233
1227
|
};
|
|
1234
1228
|
}
|
|
@@ -1241,9 +1235,9 @@ function generatedGhost(primary) {
|
|
|
1241
1235
|
};
|
|
1242
1236
|
}
|
|
1243
1237
|
function normalizeOutlineChrome(outline, primary) {
|
|
1244
|
-
const
|
|
1238
|
+
const paint = accentColor(primary);
|
|
1245
1239
|
const text = parseColor(outline.color);
|
|
1246
|
-
const paintRgb = parseColor(
|
|
1240
|
+
const paintRgb = parseColor(paint);
|
|
1247
1241
|
const primaryLabel = parseColor(primary.color);
|
|
1248
1242
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1249
1243
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1252,8 +1246,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1252
1246
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1253
1247
|
return {
|
|
1254
1248
|
...outline,
|
|
1255
|
-
color:
|
|
1256
|
-
borderColor: hasBorder ?
|
|
1249
|
+
color: paint,
|
|
1250
|
+
borderColor: hasBorder ? paint : outline.borderColor
|
|
1257
1251
|
};
|
|
1258
1252
|
}
|
|
1259
1253
|
function generateButtonVariants(samples) {
|
|
@@ -2644,14 +2638,6 @@ function socialHrefKey(item) {
|
|
|
2644
2638
|
function socialIconKey(item) {
|
|
2645
2639
|
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
2646
2640
|
}
|
|
2647
|
-
function pendingIconKey(item) {
|
|
2648
|
-
const existing = socialIconKey(item);
|
|
2649
|
-
if (existing) return existing;
|
|
2650
|
-
const base = socialHrefKey(item)?.replace(/-href$/, "");
|
|
2651
|
-
if (!base) return null;
|
|
2652
|
-
const taken = item.ownerDocument.querySelector(`[data-ohw-key="${base}"]`);
|
|
2653
|
-
return taken && taken !== item ? `${base}-icon` : base;
|
|
2654
|
-
}
|
|
2655
2641
|
var SOCIAL_PLATFORM_LABELS = {
|
|
2656
2642
|
instagram: "Instagram",
|
|
2657
2643
|
facebook: "Facebook",
|
|
@@ -2849,9 +2835,9 @@ function reconcileSocialsFromContent(content, root = document) {
|
|
|
2849
2835
|
listSocialsRows(root).forEach((row) => {
|
|
2850
2836
|
const rowDisplay = socialsDisplayFor(row, content);
|
|
2851
2837
|
listSocialItems(row).forEach((item) => {
|
|
2852
|
-
const key =
|
|
2838
|
+
const key = socialIconKey(item) ?? socialHrefKey(item)?.replace(/-href$/, "");
|
|
2853
2839
|
const stored2 = key ? content[key] : void 0;
|
|
2854
|
-
if (!stored2?.trim()
|
|
2840
|
+
if (!stored2?.trim()) return;
|
|
2855
2841
|
const existing = item.querySelector(ICON_SELECTOR);
|
|
2856
2842
|
if (existing && existing.innerHTML.trim() && !existing.hasAttribute(SOCIALS_ICON_PLACEHOLDER_ATTR)) return;
|
|
2857
2843
|
ensureIconSlot(item);
|
|
@@ -3111,7 +3097,8 @@ function ensureIconSlot(item) {
|
|
|
3111
3097
|
const adopted = adoptAsIconSlot(drawn, base);
|
|
3112
3098
|
if (adopted) return adopted;
|
|
3113
3099
|
}
|
|
3114
|
-
const
|
|
3100
|
+
const taken = document.querySelector(`[data-ohw-key="${base}"]`);
|
|
3101
|
+
const iconKey = taken && taken !== item ? `${base}-icon` : base;
|
|
3115
3102
|
const slot = document.createElement("span");
|
|
3116
3103
|
slot.setAttribute("data-ohw-key", iconKey);
|
|
3117
3104
|
slot.setAttribute("data-ohw-editable", "icon");
|
|
@@ -3623,11 +3610,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
|
|
|
3623
3610
|
container.appendChild(column);
|
|
3624
3611
|
return { column, firstLink };
|
|
3625
3612
|
}
|
|
3626
|
-
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL,
|
|
3613
|
+
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
|
|
3627
3614
|
if (!canAddFooterColumn()) {
|
|
3628
3615
|
throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
|
|
3629
3616
|
}
|
|
3630
|
-
const resolvedHref =
|
|
3617
|
+
const resolvedHref = linkHref || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
|
|
3631
3618
|
const colIndex = getNextFooterColumnIndex();
|
|
3632
3619
|
const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
|
|
3633
3620
|
if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
|
|
@@ -4006,8 +3993,8 @@ function duplicateFooterItem(sourceAnchor) {
|
|
|
4006
3993
|
const column = findFooterColumnForLink(sourceAnchor);
|
|
4007
3994
|
if (!column) return null;
|
|
4008
3995
|
const href = getLinkHref(sourceAnchor);
|
|
4009
|
-
const
|
|
4010
|
-
const label = (
|
|
3996
|
+
const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
3997
|
+
const label = (labelEl?.textContent ?? "").trim() || "Untitled";
|
|
4011
3998
|
return insertFooterItem(column, href || "/", label, sourceAnchor);
|
|
4012
3999
|
}
|
|
4013
4000
|
function footerLabelKeyFromHrefKey(hrefKey) {
|
|
@@ -4017,8 +4004,8 @@ function deleteFooterItem(sourceAnchor) {
|
|
|
4017
4004
|
if (!isFooterLinkAnchor(sourceAnchor)) return null;
|
|
4018
4005
|
const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
4019
4006
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
|
|
4020
|
-
const
|
|
4021
|
-
const label = (
|
|
4007
|
+
const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
4008
|
+
const label = (labelEl?.textContent ?? "").trim() || "Untitled";
|
|
4022
4009
|
const labelKey = footerLabelKeyFromHrefKey(hrefKey);
|
|
4023
4010
|
const previousOrder = getFooterOrderFromDom();
|
|
4024
4011
|
const previousOrderJson = JSON.stringify(previousOrder);
|
|
@@ -4986,8 +4973,8 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4986
4973
|
const mapped = keyMap.get(oldHrefKey);
|
|
4987
4974
|
if (!mapped) return;
|
|
4988
4975
|
el.setAttribute("data-ohw-href-key", mapped.hrefKey);
|
|
4989
|
-
const
|
|
4990
|
-
if (
|
|
4976
|
+
const labelEl = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
|
|
4977
|
+
if (labelEl) labelEl.setAttribute("data-ohw-key", mapped.labelKey);
|
|
4991
4978
|
};
|
|
4992
4979
|
if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
|
|
4993
4980
|
root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
|
|
@@ -4995,10 +4982,10 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4995
4982
|
function readNavLinkSnapshot(hrefKey) {
|
|
4996
4983
|
const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
4997
4984
|
if (!el) return { href: "/", label: "Untitled" };
|
|
4998
|
-
const
|
|
4985
|
+
const labelEl = el.querySelector('[data-ohw-editable="text"]');
|
|
4999
4986
|
return {
|
|
5000
4987
|
href: getLinkHref2(el),
|
|
5001
|
-
label: (
|
|
4988
|
+
label: (labelEl?.textContent ?? "").trim() || "Untitled"
|
|
5002
4989
|
};
|
|
5003
4990
|
}
|
|
5004
4991
|
function findClonedNavAnchor(unit, hrefKey) {
|
|
@@ -5172,8 +5159,8 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5172
5159
|
if (!isNavbarLinkItem(sourceAnchor)) return null;
|
|
5173
5160
|
const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
5174
5161
|
if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
|
|
5175
|
-
const
|
|
5176
|
-
const label = (
|
|
5162
|
+
const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
5163
|
+
const label = (labelEl?.textContent ?? "").trim() || "Untitled";
|
|
5177
5164
|
const previousForest = getNavForestFromDom();
|
|
5178
5165
|
const previousOrderJson = serializeNavOrder(previousForest);
|
|
5179
5166
|
const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
|
|
@@ -6776,21 +6763,6 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6776
6763
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6777
6764
|
return target ? pricingFeatureList(target).length : 0;
|
|
6778
6765
|
}
|
|
6779
|
-
function prevailingFeatureIcon(features) {
|
|
6780
|
-
const counts = /* @__PURE__ */ new Map();
|
|
6781
|
-
for (const row of features) {
|
|
6782
|
-
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6783
|
-
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6784
|
-
entry.count += 1;
|
|
6785
|
-
counts.set(key, entry);
|
|
6786
|
-
}
|
|
6787
|
-
let best = null;
|
|
6788
|
-
for (const entry of counts.values()) {
|
|
6789
|
-
if (!best || entry.count > best.count) best = entry;
|
|
6790
|
-
}
|
|
6791
|
-
if (!best) return {};
|
|
6792
|
-
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6793
|
-
}
|
|
6794
6766
|
function addPricingCardFeature(tree, index, text) {
|
|
6795
6767
|
return withPricingCollection(tree, (collection) => {
|
|
6796
6768
|
const children = collection.children;
|
|
@@ -6799,7 +6771,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6799
6771
|
const features = pricingFeatureList(target);
|
|
6800
6772
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6801
6773
|
target.slots = target.slots ?? {};
|
|
6802
|
-
target.slots.features = [...features, { text
|
|
6774
|
+
target.slots.features = [...features, { text }];
|
|
6803
6775
|
return true;
|
|
6804
6776
|
});
|
|
6805
6777
|
}
|
|
@@ -7443,120 +7415,6 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7443
7415
|
);
|
|
7444
7416
|
}
|
|
7445
7417
|
|
|
7446
|
-
// src/lib/youtube.ts
|
|
7447
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7448
|
-
function extractYouTubeId(input) {
|
|
7449
|
-
const trimmed = input.trim();
|
|
7450
|
-
if (!trimmed) return null;
|
|
7451
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7452
|
-
let url;
|
|
7453
|
-
try {
|
|
7454
|
-
url = new URL(trimmed);
|
|
7455
|
-
} catch {
|
|
7456
|
-
return null;
|
|
7457
|
-
}
|
|
7458
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
7459
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7460
|
-
return null;
|
|
7461
|
-
}
|
|
7462
|
-
let candidate = null;
|
|
7463
|
-
if (host === "youtu.be") {
|
|
7464
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7465
|
-
} else if (url.pathname === "/watch") {
|
|
7466
|
-
candidate = url.searchParams.get("v");
|
|
7467
|
-
} else {
|
|
7468
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7469
|
-
candidate = match ? match[1] : null;
|
|
7470
|
-
}
|
|
7471
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7472
|
-
}
|
|
7473
|
-
|
|
7474
|
-
// src/lib/section-embed.ts
|
|
7475
|
-
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7476
|
-
function readStoredEmbed(value) {
|
|
7477
|
-
if (value.startsWith("start\n")) {
|
|
7478
|
-
return { raw: value.slice("start\n".length), at: "start" };
|
|
7479
|
-
}
|
|
7480
|
-
return { raw: value, at: "end" };
|
|
7481
|
-
}
|
|
7482
|
-
function embedFrameSrc(value) {
|
|
7483
|
-
const videoId = extractYouTubeId(value);
|
|
7484
|
-
if (videoId) {
|
|
7485
|
-
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7486
|
-
}
|
|
7487
|
-
let url;
|
|
7488
|
-
try {
|
|
7489
|
-
url = new URL(value);
|
|
7490
|
-
} catch {
|
|
7491
|
-
return null;
|
|
7492
|
-
}
|
|
7493
|
-
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7494
|
-
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7495
|
-
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7496
|
-
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7497
|
-
return { src, title: "Map" };
|
|
7498
|
-
}
|
|
7499
|
-
if (host === "maps.app.goo.gl") {
|
|
7500
|
-
return { src: value, title: "Map" };
|
|
7501
|
-
}
|
|
7502
|
-
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7503
|
-
return { src: value, title: "Calendar" };
|
|
7504
|
-
}
|
|
7505
|
-
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7506
|
-
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7507
|
-
}
|
|
7508
|
-
if (host === "forms.gle") {
|
|
7509
|
-
return { src: value, title: "Form" };
|
|
7510
|
-
}
|
|
7511
|
-
return null;
|
|
7512
|
-
}
|
|
7513
|
-
function place(section, box, at) {
|
|
7514
|
-
if (at === "start") {
|
|
7515
|
-
section.insertBefore(box, section.firstChild);
|
|
7516
|
-
return;
|
|
7517
|
-
}
|
|
7518
|
-
section.appendChild(box);
|
|
7519
|
-
}
|
|
7520
|
-
function paint(section, key, src, title, at) {
|
|
7521
|
-
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7522
|
-
const frame = existing?.querySelector("iframe");
|
|
7523
|
-
if (existing && frame) {
|
|
7524
|
-
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7525
|
-
frame.title = title;
|
|
7526
|
-
place(section, existing, at);
|
|
7527
|
-
return;
|
|
7528
|
-
}
|
|
7529
|
-
existing?.remove();
|
|
7530
|
-
const box = document.createElement("div");
|
|
7531
|
-
box.setAttribute("data-ohw-section-embed", key);
|
|
7532
|
-
box.style.cssText = at === "start" ? "width:100%;max-width:960px;margin:0 auto 32px;padding:32px 24px 0;box-sizing:border-box;" : "width:100%;max-width:960px;margin:32px auto 0;padding:0 24px 32px;box-sizing:border-box;";
|
|
7533
|
-
const frameWrap = document.createElement("div");
|
|
7534
|
-
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7535
|
-
const iframe = document.createElement("iframe");
|
|
7536
|
-
iframe.src = src;
|
|
7537
|
-
iframe.title = title;
|
|
7538
|
-
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7539
|
-
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7540
|
-
iframe.setAttribute("allowfullscreen", "");
|
|
7541
|
-
frameWrap.appendChild(iframe);
|
|
7542
|
-
box.appendChild(frameWrap);
|
|
7543
|
-
place(section, box, at);
|
|
7544
|
-
}
|
|
7545
|
-
function applySectionEmbeds(content) {
|
|
7546
|
-
for (const [key, val] of Object.entries(content)) {
|
|
7547
|
-
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7548
|
-
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7549
|
-
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7550
|
-
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7551
|
-
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7552
|
-
if (!section || !stored || !frame) {
|
|
7553
|
-
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7554
|
-
continue;
|
|
7555
|
-
}
|
|
7556
|
-
paint(section, key, frame.src, frame.title, stored.at);
|
|
7557
|
-
}
|
|
7558
|
-
}
|
|
7559
|
-
|
|
7560
7418
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7561
7419
|
var import_react_dom = require("react-dom");
|
|
7562
7420
|
var import_client = require("react-dom/client");
|
|
@@ -8130,7 +7988,7 @@ var AI_MOBILE_CSS = [
|
|
|
8130
7988
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
8131
7989
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
8132
7990
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
8133
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
7991
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
|
|
8134
7992
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
8135
7993
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
8136
7994
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8146,10 +8004,8 @@ var AI_MOBILE_CSS = [
|
|
|
8146
8004
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8147
8005
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8148
8006
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
8149
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
8150
|
-
|
|
8151
|
-
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8152
|
-
"[data-ai-container]{padding:0 20px !important}",
|
|
8007
|
+
// still got a 20px band of section background down both sides on a phone.
|
|
8008
|
+
"[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8153
8009
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8154
8010
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8155
8011
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8354,31 +8210,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8354
8210
|
function textAttrs(ctx, path) {
|
|
8355
8211
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8356
8212
|
}
|
|
8357
|
-
var AI_RESPONSIVE_CSS = [
|
|
8358
|
-
"@media (max-width: 960px) {",
|
|
8359
|
-
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8360
|
-
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8361
|
-
"}",
|
|
8362
|
-
"@media (max-width: 640px) {",
|
|
8363
|
-
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8364
|
-
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8365
|
-
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8366
|
-
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8367
|
-
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8368
|
-
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8369
|
-
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8370
|
-
// layered text used to be.
|
|
8371
|
-
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8372
|
-
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8373
|
-
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8374
|
-
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8375
|
-
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8376
|
-
// other rule had already been taught to stand down.
|
|
8377
|
-
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8378
|
-
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8379
|
-
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8380
|
-
"}"
|
|
8381
|
-
].join("\n");
|
|
8382
8213
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8383
8214
|
function MediaBox({
|
|
8384
8215
|
refValue,
|
|
@@ -8433,7 +8264,7 @@ function MediaBox({
|
|
|
8433
8264
|
position: fill ? "absolute" : void 0,
|
|
8434
8265
|
inset: fill ? 0 : void 0,
|
|
8435
8266
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8436
|
-
height: fill ? "100%" :
|
|
8267
|
+
height: fill ? "100%" : void 0,
|
|
8437
8268
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8438
8269
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8439
8270
|
borderRadius: radius,
|
|
@@ -9929,7 +9760,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9929
9760
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9930
9761
|
"div",
|
|
9931
9762
|
{
|
|
9932
|
-
"data-ai-grid":
|
|
9763
|
+
"data-ai-grid": "",
|
|
9933
9764
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9934
9765
|
style: {
|
|
9935
9766
|
display: "grid",
|
|
@@ -10231,7 +10062,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10231
10062
|
},
|
|
10232
10063
|
children: [
|
|
10233
10064
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10234
|
-
// The section's `data-ai-
|
|
10065
|
+
// The section's `data-ai-container` gave up its max-width/gutter so the base
|
|
10235
10066
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10236
10067
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10237
10068
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10650,7 +10481,6 @@ function AiTreeRenderer({
|
|
|
10650
10481
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10651
10482
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10652
10483
|
...bgAttrs,
|
|
10653
|
-
"data-ai-responsive": "",
|
|
10654
10484
|
style: {
|
|
10655
10485
|
position: "relative",
|
|
10656
10486
|
padding: `${padCss} 0`,
|
|
@@ -10664,13 +10494,12 @@ function AiTreeRenderer({
|
|
|
10664
10494
|
...fillHeight ? { display: "grid" } : {}
|
|
10665
10495
|
},
|
|
10666
10496
|
children: [
|
|
10667
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10668
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10669
10497
|
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10498
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10670
10499
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10671
10500
|
"div",
|
|
10672
10501
|
{
|
|
10673
|
-
"data-ai-
|
|
10502
|
+
"data-ai-container": "",
|
|
10674
10503
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10675
10504
|
style: {
|
|
10676
10505
|
position: "relative",
|
|
@@ -10687,7 +10516,7 @@ function AiTreeRenderer({
|
|
|
10687
10516
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10688
10517
|
"div",
|
|
10689
10518
|
{
|
|
10690
|
-
"data-ai-
|
|
10519
|
+
"data-ai-row": "",
|
|
10691
10520
|
style: {
|
|
10692
10521
|
display: "grid",
|
|
10693
10522
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11349,10 +11178,9 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11349
11178
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11350
11179
|
continue;
|
|
11351
11180
|
}
|
|
11181
|
+
const isNewMount = !existing || !existing.container.isConnected;
|
|
11352
11182
|
let container = existing?.container;
|
|
11353
|
-
let isNewMount = false;
|
|
11354
11183
|
if (!container || !container.isConnected) {
|
|
11355
|
-
isNewMount = true;
|
|
11356
11184
|
existing?.root.unmount();
|
|
11357
11185
|
container?.remove();
|
|
11358
11186
|
container = document.createElement("div");
|
|
@@ -11690,34 +11518,6 @@ function minSpanForFooterBlock(type) {
|
|
|
11690
11518
|
return 3;
|
|
11691
11519
|
}
|
|
11692
11520
|
}
|
|
11693
|
-
function readLiveSocialItems() {
|
|
11694
|
-
const root = getFooterRoot();
|
|
11695
|
-
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11696
|
-
if (!row) return [];
|
|
11697
|
-
const items = [];
|
|
11698
|
-
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11699
|
-
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11700
|
-
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11701
|
-
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11702
|
-
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11703
|
-
items.push({ platform, href });
|
|
11704
|
-
}
|
|
11705
|
-
return items;
|
|
11706
|
-
}
|
|
11707
|
-
function syncSocialRowsFromDom(tree) {
|
|
11708
|
-
const root = getFooterRoot();
|
|
11709
|
-
if (!root) return;
|
|
11710
|
-
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11711
|
-
const live = readLiveSocialItems();
|
|
11712
|
-
if (row && live.length === 0) return;
|
|
11713
|
-
for (const col of tree.columns) {
|
|
11714
|
-
col.blocks = col.blocks.flatMap((block) => {
|
|
11715
|
-
if (block.type !== "social-row") return [block];
|
|
11716
|
-
if (!row) return [];
|
|
11717
|
-
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11718
|
-
});
|
|
11719
|
-
}
|
|
11720
|
-
}
|
|
11721
11521
|
function collectBrandBlocks(tree) {
|
|
11722
11522
|
const brand = [];
|
|
11723
11523
|
for (const col of tree.columns) {
|
|
@@ -11963,13 +11763,12 @@ function textOf2(el) {
|
|
|
11963
11763
|
}
|
|
11964
11764
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11965
11765
|
const next = cloneTree(tree);
|
|
11966
|
-
syncSocialRowsFromDom(next);
|
|
11967
11766
|
const domCols = listFooterColumns().map((col) => {
|
|
11968
11767
|
const heading = getFooterColumnHeadingEl(col);
|
|
11969
11768
|
const title = heading ? textOf2(heading) : void 0;
|
|
11970
11769
|
const items = listFooterLinksInColumn(col).map((anchor) => {
|
|
11971
|
-
const
|
|
11972
|
-
const label = textOf2(
|
|
11770
|
+
const labelEl = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11771
|
+
const label = textOf2(labelEl) || textOf2(anchor);
|
|
11973
11772
|
const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
|
|
11974
11773
|
return label ? { label, href: href || "home" } : null;
|
|
11975
11774
|
}).filter((x) => Boolean(x));
|
|
@@ -17668,7 +17467,7 @@ function apiBase() {
|
|
|
17668
17467
|
function bridgeVersion() {
|
|
17669
17468
|
try {
|
|
17670
17469
|
if (true) {
|
|
17671
|
-
return "0.1.164
|
|
17470
|
+
return "0.1.164";
|
|
17672
17471
|
}
|
|
17673
17472
|
} catch {
|
|
17674
17473
|
}
|
|
@@ -17682,7 +17481,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17682
17481
|
return;
|
|
17683
17482
|
}
|
|
17684
17483
|
try {
|
|
17685
|
-
const v = true ? "0.1.164
|
|
17484
|
+
const v = true ? "0.1.164" : "";
|
|
17686
17485
|
if (v) {
|
|
17687
17486
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17688
17487
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18360,7 +18159,6 @@ function MediaOverlay({
|
|
|
18360
18159
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18361
18160
|
);
|
|
18362
18161
|
}, [isVideo]);
|
|
18363
|
-
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18364
18162
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18365
18163
|
const box = {
|
|
18366
18164
|
position: "fixed",
|
|
@@ -18459,10 +18257,11 @@ function MediaOverlay({
|
|
|
18459
18257
|
className: "flex items-center justify-center cursor-pointer",
|
|
18460
18258
|
style: {
|
|
18461
18259
|
...box,
|
|
18462
|
-
//
|
|
18463
|
-
//
|
|
18464
|
-
//
|
|
18465
|
-
|
|
18260
|
+
// When text overlays this media, let clicks fall THROUGH to the text underneath. In the
|
|
18261
|
+
// parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
|
|
18262
|
+
// in-document, pointer-events does it natively. The button below opts back in, so
|
|
18263
|
+
// Replace still works.
|
|
18264
|
+
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18466
18265
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18467
18266
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18468
18267
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18489,17 +18288,17 @@ function MediaOverlay({
|
|
|
18489
18288
|
},
|
|
18490
18289
|
children: [
|
|
18491
18290
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
18492
|
-
|
|
18291
|
+
isVideo ? "Replace video" : "Replace image"
|
|
18493
18292
|
]
|
|
18494
18293
|
}
|
|
18495
18294
|
),
|
|
18496
|
-
|
|
18295
|
+
replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18497
18296
|
Button,
|
|
18498
18297
|
{
|
|
18499
18298
|
"data-ohw-media-overlay": "",
|
|
18500
18299
|
variant: "outline",
|
|
18501
18300
|
size: "sm",
|
|
18502
|
-
"aria-label":
|
|
18301
|
+
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
18503
18302
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18504
18303
|
style: {
|
|
18505
18304
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18522,7 +18321,7 @@ function MediaOverlay({
|
|
|
18522
18321
|
},
|
|
18523
18322
|
children: [
|
|
18524
18323
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
18525
|
-
replaceMode === "full" ?
|
|
18324
|
+
replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
|
|
18526
18325
|
]
|
|
18527
18326
|
}
|
|
18528
18327
|
)
|
|
@@ -19116,7 +18915,7 @@ function AiSectionOverlay({
|
|
|
19116
18915
|
|
|
19117
18916
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19118
18917
|
var import_react12 = require("react");
|
|
19119
|
-
var
|
|
18918
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19120
18919
|
|
|
19121
18920
|
// src/lib/ai-media-strip-tree.ts
|
|
19122
18921
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19230,6 +19029,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19230
19029
|
return true;
|
|
19231
19030
|
});
|
|
19232
19031
|
}
|
|
19032
|
+
function setMediaStripItemAlt(tree, index, alt) {
|
|
19033
|
+
return withMediaStrip(tree, (block) => {
|
|
19034
|
+
const items = block.items;
|
|
19035
|
+
if (index < 0 || index >= items.length) return false;
|
|
19036
|
+
items[index] = { ...items[index], alt };
|
|
19037
|
+
return true;
|
|
19038
|
+
});
|
|
19039
|
+
}
|
|
19233
19040
|
function setMediaStripItemLink(tree, index, link) {
|
|
19234
19041
|
return withMediaStrip(tree, (block) => {
|
|
19235
19042
|
const items = block.items;
|
|
@@ -19247,117 +19054,11 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19247
19054
|
});
|
|
19248
19055
|
}
|
|
19249
19056
|
|
|
19250
|
-
// src/ui/dialog.tsx
|
|
19251
|
-
var React9 = __toESM(require("react"), 1);
|
|
19252
|
-
var import_radix_ui6 = require("radix-ui");
|
|
19253
|
-
var import_lucide_react8 = require("lucide-react");
|
|
19254
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19255
|
-
function Dialog2({
|
|
19256
|
-
...props
|
|
19257
|
-
}) {
|
|
19258
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19259
|
-
}
|
|
19260
|
-
function DialogPortal({
|
|
19261
|
-
...props
|
|
19262
|
-
}) {
|
|
19263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19264
|
-
}
|
|
19265
|
-
function DialogOverlay({
|
|
19266
|
-
className,
|
|
19267
|
-
...props
|
|
19268
|
-
}) {
|
|
19269
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19270
|
-
import_radix_ui6.Dialog.Overlay,
|
|
19271
|
-
{
|
|
19272
|
-
"data-slot": "dialog-overlay",
|
|
19273
|
-
"data-ohw-link-modal-root": "",
|
|
19274
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19275
|
-
...props
|
|
19276
|
-
}
|
|
19277
|
-
);
|
|
19278
|
-
}
|
|
19279
|
-
var DialogContent = React9.forwardRef(
|
|
19280
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19281
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
19282
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19283
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19284
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19285
|
-
import_radix_ui6.Dialog.Content,
|
|
19286
|
-
{
|
|
19287
|
-
ref,
|
|
19288
|
-
"data-slot": "dialog-content",
|
|
19289
|
-
className: cn(
|
|
19290
|
-
positionMode,
|
|
19291
|
-
"left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
|
|
19292
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19293
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19294
|
-
className
|
|
19295
|
-
),
|
|
19296
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
19297
|
-
...props,
|
|
19298
|
-
children: [
|
|
19299
|
-
children,
|
|
19300
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19301
|
-
import_radix_ui6.Dialog.Close,
|
|
19302
|
-
{
|
|
19303
|
-
type: "button",
|
|
19304
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19305
|
-
"aria-label": "Close",
|
|
19306
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19307
|
-
}
|
|
19308
|
-
) : null
|
|
19309
|
-
]
|
|
19310
|
-
}
|
|
19311
|
-
)
|
|
19312
|
-
] });
|
|
19313
|
-
}
|
|
19314
|
-
);
|
|
19315
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19316
|
-
function DialogHeader({
|
|
19317
|
-
className,
|
|
19318
|
-
...props
|
|
19319
|
-
}) {
|
|
19320
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19321
|
-
}
|
|
19322
|
-
function DialogFooter({
|
|
19323
|
-
className,
|
|
19324
|
-
...props
|
|
19325
|
-
}) {
|
|
19326
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19327
|
-
"div",
|
|
19328
|
-
{
|
|
19329
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
19330
|
-
...props
|
|
19331
|
-
}
|
|
19332
|
-
);
|
|
19333
|
-
}
|
|
19334
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19335
|
-
import_radix_ui6.Dialog.Title,
|
|
19336
|
-
{
|
|
19337
|
-
ref,
|
|
19338
|
-
className: cn(
|
|
19339
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19340
|
-
className
|
|
19341
|
-
),
|
|
19342
|
-
...props
|
|
19343
|
-
}
|
|
19344
|
-
));
|
|
19345
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19346
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19347
|
-
import_radix_ui6.Dialog.Description,
|
|
19348
|
-
{
|
|
19349
|
-
ref,
|
|
19350
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
19351
|
-
...props
|
|
19352
|
-
}
|
|
19353
|
-
));
|
|
19354
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19355
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19356
|
-
|
|
19357
19057
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19358
|
-
var
|
|
19359
|
-
var PRIMARY3 = "
|
|
19360
|
-
var
|
|
19058
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19059
|
+
var PRIMARY3 = "#0885FE";
|
|
19060
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
|
|
19061
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19361
19062
|
function findMediaStripItemElement(sectionId, index) {
|
|
19362
19063
|
const sectionEl = findByInstanceId(sectionId);
|
|
19363
19064
|
if (!sectionEl) return null;
|
|
@@ -19367,35 +19068,14 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19367
19068
|
}
|
|
19368
19069
|
return null;
|
|
19369
19070
|
}
|
|
19370
|
-
function
|
|
19371
|
-
|
|
19372
|
-
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19373
|
-
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19374
|
-
if (!itemEl) return null;
|
|
19375
|
-
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19376
|
-
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19377
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19378
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19379
|
-
if (!sectionId || Number.isNaN(index)) return null;
|
|
19380
|
-
return { sectionId, index };
|
|
19381
|
-
}
|
|
19382
|
-
function sameRef(a, b) {
|
|
19383
|
-
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19384
|
-
}
|
|
19385
|
-
function rectOf(el) {
|
|
19071
|
+
function readRect2(ref) {
|
|
19072
|
+
const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19386
19073
|
if (!el) return null;
|
|
19387
19074
|
const r2 = el.getBoundingClientRect();
|
|
19388
19075
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19389
19076
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19390
19077
|
}
|
|
19391
|
-
function
|
|
19392
|
-
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19393
|
-
}
|
|
19394
|
-
function readStripRect(ref) {
|
|
19395
|
-
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19396
|
-
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19397
|
-
}
|
|
19398
|
-
function useLiveItemRect(ref, strip = false) {
|
|
19078
|
+
function useLiveItemRect(ref) {
|
|
19399
19079
|
const [rect, setRect] = (0, import_react12.useState)(null);
|
|
19400
19080
|
(0, import_react12.useEffect)(() => {
|
|
19401
19081
|
if (!ref) {
|
|
@@ -19403,7 +19083,7 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
19403
19083
|
return;
|
|
19404
19084
|
}
|
|
19405
19085
|
const update = () => {
|
|
19406
|
-
const next =
|
|
19086
|
+
const next = readRect2(ref);
|
|
19407
19087
|
setRect(
|
|
19408
19088
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19409
19089
|
);
|
|
@@ -19418,49 +19098,9 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
19418
19098
|
window.removeEventListener("resize", update);
|
|
19419
19099
|
clearInterval(interval);
|
|
19420
19100
|
};
|
|
19421
|
-
}, [ref?.sectionId, ref?.index
|
|
19101
|
+
}, [ref?.sectionId, ref?.index]);
|
|
19422
19102
|
return rect;
|
|
19423
19103
|
}
|
|
19424
|
-
var TOOLBAR_STRIP_GAP = 52;
|
|
19425
|
-
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19426
|
-
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19427
|
-
function StripToolbarSlot({ stripRect, children }) {
|
|
19428
|
-
const slotRef = (0, import_react12.useRef)(null);
|
|
19429
|
-
const [shift, setShift] = (0, import_react12.useState)(0);
|
|
19430
|
-
const centerX = stripRect.left + stripRect.width / 2;
|
|
19431
|
-
(0, import_react12.useLayoutEffect)(() => {
|
|
19432
|
-
const slot = slotRef.current;
|
|
19433
|
-
if (!slot) return;
|
|
19434
|
-
const clamp = () => {
|
|
19435
|
-
const w = slot.offsetWidth;
|
|
19436
|
-
if (w <= 0) return;
|
|
19437
|
-
const half = w / 2;
|
|
19438
|
-
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19439
|
-
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19440
|
-
};
|
|
19441
|
-
clamp();
|
|
19442
|
-
const ro = new ResizeObserver(clamp);
|
|
19443
|
-
ro.observe(slot);
|
|
19444
|
-
return () => ro.disconnect();
|
|
19445
|
-
}, [centerX, children]);
|
|
19446
|
-
const mobile = window.innerWidth <= 480;
|
|
19447
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19448
|
-
"div",
|
|
19449
|
-
{
|
|
19450
|
-
ref: slotRef,
|
|
19451
|
-
"data-ohw-bridge": "",
|
|
19452
|
-
"data-ohw-item-interaction": "",
|
|
19453
|
-
className: "pointer-events-auto fixed",
|
|
19454
|
-
style: {
|
|
19455
|
-
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19456
|
-
left: centerX + shift,
|
|
19457
|
-
transform: "translate(-50%, -100%)",
|
|
19458
|
-
zIndex: 2147483645
|
|
19459
|
-
},
|
|
19460
|
-
children
|
|
19461
|
-
}
|
|
19462
|
-
);
|
|
19463
|
-
}
|
|
19464
19104
|
function requestValidateTree(postToParent2, tree) {
|
|
19465
19105
|
return new Promise((resolve) => {
|
|
19466
19106
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19497,72 +19137,116 @@ function requestAssetPick(postToParent2) {
|
|
|
19497
19137
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19498
19138
|
});
|
|
19499
19139
|
}
|
|
19500
|
-
function
|
|
19140
|
+
function Pill({
|
|
19501
19141
|
label,
|
|
19502
19142
|
onClick,
|
|
19503
|
-
disabled
|
|
19504
|
-
active
|
|
19505
|
-
children
|
|
19143
|
+
disabled,
|
|
19144
|
+
active
|
|
19506
19145
|
}) {
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19147
|
+
"button",
|
|
19148
|
+
{
|
|
19149
|
+
type: "button",
|
|
19150
|
+
onClick,
|
|
19151
|
+
disabled,
|
|
19152
|
+
style: {
|
|
19153
|
+
height: 28,
|
|
19154
|
+
padding: "0 10px",
|
|
19155
|
+
display: "inline-flex",
|
|
19156
|
+
alignItems: "center",
|
|
19157
|
+
gap: 4,
|
|
19158
|
+
borderRadius: 999,
|
|
19159
|
+
border: "none",
|
|
19160
|
+
cursor: disabled ? "default" : "pointer",
|
|
19161
|
+
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19162
|
+
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19163
|
+
opacity: disabled ? 0.4 : 1,
|
|
19164
|
+
fontSize: 12,
|
|
19165
|
+
lineHeight: "16px",
|
|
19166
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19167
|
+
whiteSpace: "nowrap",
|
|
19168
|
+
flex: "0 0 auto"
|
|
19169
|
+
},
|
|
19170
|
+
children: label
|
|
19171
|
+
}
|
|
19172
|
+
);
|
|
19515
19173
|
}
|
|
19516
|
-
function
|
|
19517
|
-
|
|
19518
|
-
value,
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
"
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
|
|
19537
|
-
) }),
|
|
19538
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19539
|
-
const selected = option.value === value;
|
|
19540
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19541
|
-
DropdownMenuItem,
|
|
19174
|
+
function AltInput({ value, onCommit }) {
|
|
19175
|
+
const [draft, setDraft] = (0, import_react12.useState)(value);
|
|
19176
|
+
(0, import_react12.useEffect)(() => setDraft(value), [value]);
|
|
19177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19178
|
+
"div",
|
|
19179
|
+
{
|
|
19180
|
+
style: {
|
|
19181
|
+
display: "flex",
|
|
19182
|
+
alignItems: "center",
|
|
19183
|
+
gap: 6,
|
|
19184
|
+
height: 28,
|
|
19185
|
+
padding: "0 12px",
|
|
19186
|
+
borderRadius: 999,
|
|
19187
|
+
background: "#ffffff",
|
|
19188
|
+
width: "100%",
|
|
19189
|
+
maxWidth: 260,
|
|
19190
|
+
boxSizing: "border-box"
|
|
19191
|
+
},
|
|
19192
|
+
children: [
|
|
19193
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19194
|
+
"span",
|
|
19542
19195
|
{
|
|
19543
|
-
|
|
19544
|
-
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
|
|
19549
|
-
|
|
19550
|
-
|
|
19551
|
-
|
|
19552
|
-
|
|
19553
|
-
)
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19196
|
+
style: {
|
|
19197
|
+
flex: "0 0 auto",
|
|
19198
|
+
color: OHW_BLUE_DARK,
|
|
19199
|
+
fontSize: 10,
|
|
19200
|
+
fontWeight: 700,
|
|
19201
|
+
textTransform: "uppercase",
|
|
19202
|
+
letterSpacing: 0.4
|
|
19203
|
+
},
|
|
19204
|
+
children: "Alt"
|
|
19205
|
+
}
|
|
19206
|
+
),
|
|
19207
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19208
|
+
"input",
|
|
19209
|
+
{
|
|
19210
|
+
type: "text",
|
|
19211
|
+
value: draft,
|
|
19212
|
+
onChange: (e) => setDraft(e.target.value),
|
|
19213
|
+
onBlur: () => {
|
|
19214
|
+
if (draft !== value) onCommit(draft);
|
|
19215
|
+
},
|
|
19216
|
+
onKeyDown: (e) => {
|
|
19217
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
19218
|
+
if (e.key === "Escape") {
|
|
19219
|
+
setDraft(value);
|
|
19220
|
+
e.currentTarget.blur();
|
|
19221
|
+
}
|
|
19222
|
+
},
|
|
19223
|
+
placeholder: "Describe this image",
|
|
19224
|
+
"aria-label": "Image alt text",
|
|
19225
|
+
style: {
|
|
19226
|
+
flex: 1,
|
|
19227
|
+
minWidth: 0,
|
|
19228
|
+
border: "none",
|
|
19229
|
+
outline: "none",
|
|
19230
|
+
background: "transparent",
|
|
19231
|
+
fontSize: 12,
|
|
19232
|
+
lineHeight: "16px",
|
|
19233
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19234
|
+
color: "#1f2937"
|
|
19235
|
+
}
|
|
19236
|
+
}
|
|
19237
|
+
)
|
|
19238
|
+
]
|
|
19239
|
+
}
|
|
19240
|
+
);
|
|
19557
19241
|
}
|
|
19558
19242
|
var VARIANTS = [
|
|
19559
19243
|
{ value: "logos", label: "Logos" },
|
|
19560
19244
|
{ value: "reel", label: "Reel" }
|
|
19561
19245
|
];
|
|
19562
19246
|
var ALIGNS = [
|
|
19563
|
-
{ value: "left", label: "
|
|
19564
|
-
{ value: "center", label: "
|
|
19565
|
-
{ value: "right", label: "
|
|
19247
|
+
{ value: "left", label: "Left" },
|
|
19248
|
+
{ value: "center", label: "Center" },
|
|
19249
|
+
{ value: "right", label: "Right" }
|
|
19566
19250
|
];
|
|
19567
19251
|
var HOVERS = [
|
|
19568
19252
|
{ value: "none", label: "None" },
|
|
@@ -19570,104 +19254,104 @@ var HOVERS = [
|
|
|
19570
19254
|
{ value: "zoom", label: "Zoom" },
|
|
19571
19255
|
{ value: "fade", label: "Fade" }
|
|
19572
19256
|
];
|
|
19257
|
+
var TREATMENTS = [
|
|
19258
|
+
{ value: "color", label: "Color" },
|
|
19259
|
+
{ value: "grayscale", label: "Grayscale" }
|
|
19260
|
+
];
|
|
19573
19261
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19574
|
-
function
|
|
19575
|
-
|
|
19576
|
-
linkTarget,
|
|
19577
|
-
onClose,
|
|
19578
|
-
onSave
|
|
19579
|
-
}) {
|
|
19580
|
-
const [draft, setDraft] = (0, import_react12.useState)(href);
|
|
19581
|
-
const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
|
|
19262
|
+
function LinkInput({ value, onCommit }) {
|
|
19263
|
+
const [draft, setDraft] = (0, import_react12.useState)(value);
|
|
19582
19264
|
const [invalid, setInvalid] = (0, import_react12.useState)(false);
|
|
19583
|
-
|
|
19265
|
+
(0, import_react12.useEffect)(() => {
|
|
19266
|
+
setDraft(value);
|
|
19267
|
+
setInvalid(false);
|
|
19268
|
+
}, [value]);
|
|
19269
|
+
const commit2 = () => {
|
|
19584
19270
|
const next = draft.trim();
|
|
19585
|
-
if (next
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19590
|
-
onClose();
|
|
19271
|
+
if (next === value) return setInvalid(false);
|
|
19272
|
+
if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
|
|
19273
|
+
setInvalid(false);
|
|
19274
|
+
onCommit(next);
|
|
19591
19275
|
};
|
|
19592
|
-
return /* @__PURE__ */ (0,
|
|
19593
|
-
|
|
19594
|
-
|
|
19595
|
-
|
|
19596
|
-
"
|
|
19597
|
-
|
|
19598
|
-
|
|
19599
|
-
|
|
19600
|
-
|
|
19601
|
-
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
|
|
19609
|
-
|
|
19610
|
-
"
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
|
|
19623
|
-
|
|
19624
|
-
|
|
19625
|
-
|
|
19626
|
-
|
|
19627
|
-
|
|
19628
|
-
|
|
19629
|
-
|
|
19630
|
-
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
19634
|
-
|
|
19635
|
-
|
|
19636
|
-
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
19644
|
-
|
|
19645
|
-
|
|
19646
|
-
|
|
19647
|
-
|
|
19648
|
-
|
|
19649
|
-
|
|
19650
|
-
|
|
19651
|
-
|
|
19652
|
-
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
|
|
19276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19277
|
+
"div",
|
|
19278
|
+
{
|
|
19279
|
+
style: {
|
|
19280
|
+
display: "flex",
|
|
19281
|
+
alignItems: "center",
|
|
19282
|
+
gap: 6,
|
|
19283
|
+
height: 28,
|
|
19284
|
+
padding: "0 12px",
|
|
19285
|
+
borderRadius: 999,
|
|
19286
|
+
background: "#ffffff",
|
|
19287
|
+
width: "100%",
|
|
19288
|
+
maxWidth: 260,
|
|
19289
|
+
boxSizing: "border-box",
|
|
19290
|
+
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19291
|
+
},
|
|
19292
|
+
children: [
|
|
19293
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19294
|
+
"span",
|
|
19295
|
+
{
|
|
19296
|
+
style: {
|
|
19297
|
+
flex: "0 0 auto",
|
|
19298
|
+
color: OHW_BLUE_DARK,
|
|
19299
|
+
fontSize: 10,
|
|
19300
|
+
fontWeight: 700,
|
|
19301
|
+
textTransform: "uppercase",
|
|
19302
|
+
letterSpacing: 0.4
|
|
19303
|
+
},
|
|
19304
|
+
children: "Link"
|
|
19305
|
+
}
|
|
19306
|
+
),
|
|
19307
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19308
|
+
"input",
|
|
19309
|
+
{
|
|
19310
|
+
type: "text",
|
|
19311
|
+
inputMode: "url",
|
|
19312
|
+
value: draft,
|
|
19313
|
+
onChange: (e) => setDraft(e.target.value),
|
|
19314
|
+
onBlur: commit2,
|
|
19315
|
+
onKeyDown: (e) => {
|
|
19316
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
19317
|
+
if (e.key === "Escape") {
|
|
19318
|
+
setDraft(value);
|
|
19319
|
+
setInvalid(false);
|
|
19320
|
+
e.currentTarget.blur();
|
|
19321
|
+
}
|
|
19322
|
+
},
|
|
19323
|
+
placeholder: "https://example.com",
|
|
19324
|
+
"aria-label": "Image link URL",
|
|
19325
|
+
"aria-invalid": invalid,
|
|
19326
|
+
style: {
|
|
19327
|
+
flex: 1,
|
|
19328
|
+
minWidth: 0,
|
|
19329
|
+
border: "none",
|
|
19330
|
+
outline: "none",
|
|
19331
|
+
background: "transparent",
|
|
19332
|
+
fontSize: 12,
|
|
19333
|
+
lineHeight: "16px",
|
|
19334
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19335
|
+
color: "#1f2937"
|
|
19336
|
+
}
|
|
19337
|
+
}
|
|
19338
|
+
)
|
|
19339
|
+
]
|
|
19340
|
+
}
|
|
19341
|
+
);
|
|
19657
19342
|
}
|
|
19658
19343
|
function MediaStripToolbar({
|
|
19659
19344
|
entry,
|
|
19660
19345
|
index,
|
|
19661
19346
|
pending,
|
|
19662
19347
|
error,
|
|
19663
|
-
itemEditOn,
|
|
19664
|
-
onToggleItemEdit,
|
|
19665
19348
|
onSetVariant,
|
|
19666
19349
|
onSetAlign,
|
|
19667
19350
|
onSetHover,
|
|
19668
19351
|
onSetTreatment,
|
|
19669
19352
|
onResize,
|
|
19670
|
-
|
|
19353
|
+
onSetAlt,
|
|
19354
|
+
onSetLink,
|
|
19671
19355
|
onAddItem,
|
|
19672
19356
|
onRemoveItem,
|
|
19673
19357
|
onChangeImage,
|
|
@@ -19676,102 +19360,81 @@ function MediaStripToolbar({
|
|
|
19676
19360
|
}) {
|
|
19677
19361
|
const items = mediaStripItems(entry.tree);
|
|
19678
19362
|
const itemCount = items.length;
|
|
19363
|
+
const currentAlt = items[index]?.alt ?? "";
|
|
19364
|
+
const currentHref2 = items[index]?.href ?? "";
|
|
19365
|
+
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19679
19366
|
const slots = findMediaStripSlots(entry.tree);
|
|
19680
19367
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19681
19368
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19682
19369
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19683
19370
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19684
19371
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19685
|
-
const
|
|
19686
|
-
const
|
|
19687
|
-
|
|
19372
|
+
const isMobile = window.innerWidth <= 480;
|
|
19373
|
+
const rowStyle = isMobile ? {
|
|
19374
|
+
display: "flex",
|
|
19375
|
+
gap: 6,
|
|
19376
|
+
flexWrap: "nowrap",
|
|
19377
|
+
justifyContent: "center",
|
|
19378
|
+
overflowX: "auto",
|
|
19379
|
+
WebkitOverflowScrolling: "touch",
|
|
19380
|
+
width: "100%",
|
|
19381
|
+
scrollbarWidth: "none"
|
|
19382
|
+
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19688
19384
|
"div",
|
|
19689
19385
|
{
|
|
19690
19386
|
"data-ohw-bridge": "",
|
|
19691
19387
|
"data-ohw-toolbar": "",
|
|
19692
19388
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19693
|
-
|
|
19694
|
-
|
|
19389
|
+
style: {
|
|
19390
|
+
display: "flex",
|
|
19391
|
+
flexDirection: "column",
|
|
19392
|
+
gap: 6,
|
|
19393
|
+
alignItems: "center",
|
|
19394
|
+
background: OHW_BLUE,
|
|
19395
|
+
padding: 8,
|
|
19396
|
+
borderRadius: 12,
|
|
19397
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19398
|
+
pointerEvents: pending ? "none" : "auto",
|
|
19399
|
+
opacity: pending ? 0.6 : 1,
|
|
19400
|
+
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19401
|
+
},
|
|
19695
19402
|
children: [
|
|
19696
|
-
/* @__PURE__ */ (0,
|
|
19697
|
-
|
|
19698
|
-
{
|
|
19699
|
-
|
|
19700
|
-
|
|
19701
|
-
|
|
19702
|
-
|
|
19703
|
-
|
|
19704
|
-
|
|
19705
|
-
|
|
19706
|
-
|
|
19707
|
-
|
|
19708
|
-
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
|
|
19712
|
-
|
|
19713
|
-
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
|
|
19721
|
-
|
|
19722
|
-
|
|
19723
|
-
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
) }),
|
|
19729
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19730
|
-
] }),
|
|
19731
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19732
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19733
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19734
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19735
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19736
|
-
ToolbarAction,
|
|
19737
|
-
{
|
|
19738
|
-
label: gatedLabel("Move right"),
|
|
19739
|
-
onClick: onMoveRight,
|
|
19740
|
-
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19741
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
19742
|
-
}
|
|
19743
|
-
),
|
|
19744
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19745
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19746
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19747
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19748
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19749
|
-
ToolbarAction,
|
|
19750
|
-
{
|
|
19751
|
-
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19752
|
-
active: treatment === "grayscale",
|
|
19753
|
-
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19754
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19755
|
-
}
|
|
19756
|
-
),
|
|
19757
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19758
|
-
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
19759
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19760
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19761
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19762
|
-
sizeValue,
|
|
19763
|
-
"px"
|
|
19764
|
-
] }),
|
|
19765
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19766
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19767
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19768
|
-
]
|
|
19769
|
-
}
|
|
19770
|
-
),
|
|
19771
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19403
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19404
|
+
VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
|
|
19405
|
+
ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
|
|
19406
|
+
] }),
|
|
19407
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19408
|
+
HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
|
|
19409
|
+
TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
|
|
19410
|
+
] }),
|
|
19411
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
19412
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
|
|
19413
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
|
|
19414
|
+
sizeValue,
|
|
19415
|
+
"px"
|
|
19416
|
+
] }),
|
|
19417
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
|
|
19418
|
+
] }),
|
|
19419
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
|
|
19420
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
|
|
19421
|
+
currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19422
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
|
|
19423
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
|
|
19424
|
+
] }),
|
|
19425
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19426
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
|
|
19427
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
|
|
19428
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
|
|
19429
|
+
] }),
|
|
19430
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19431
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
|
|
19432
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
|
|
19433
|
+
] }),
|
|
19434
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
19772
19435
|
]
|
|
19773
19436
|
}
|
|
19774
|
-
)
|
|
19437
|
+
);
|
|
19775
19438
|
}
|
|
19776
19439
|
function findMediaStripSlots(tree) {
|
|
19777
19440
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19790,23 +19453,31 @@ function AiMediaStripOverlay({
|
|
|
19790
19453
|
}) {
|
|
19791
19454
|
const [hover, setHover] = (0, import_react12.useState)(null);
|
|
19792
19455
|
const [active, setActive] = (0, import_react12.useState)(null);
|
|
19793
|
-
const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
|
|
19794
|
-
const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
|
|
19795
19456
|
const [pending, setPending] = (0, import_react12.useState)(false);
|
|
19796
19457
|
const [error, setError] = (0, import_react12.useState)(null);
|
|
19797
19458
|
const activeRef = (0, import_react12.useRef)(null);
|
|
19798
19459
|
activeRef.current = active;
|
|
19799
|
-
const linkOpenRef = (0, import_react12.useRef)(false);
|
|
19800
|
-
linkOpenRef.current = linkOpen;
|
|
19801
19460
|
(0, import_react12.useEffect)(() => {
|
|
19802
19461
|
const onMove = (e) => {
|
|
19803
|
-
const ref = itemRefFromTarget(e.target);
|
|
19804
19462
|
const t = e.target;
|
|
19805
|
-
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19463
|
+
if (!(t instanceof HTMLElement)) return;
|
|
19464
|
+
if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
|
|
19465
|
+
return;
|
|
19466
|
+
}
|
|
19467
|
+
const itemEl = t.closest("[data-ohw-media-strip-item]");
|
|
19468
|
+
if (!itemEl) {
|
|
19469
|
+
setHover(null);
|
|
19470
|
+
return;
|
|
19471
|
+
}
|
|
19472
|
+
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19473
|
+
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19474
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19475
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19476
|
+
if (!sectionId || Number.isNaN(index)) {
|
|
19477
|
+
setHover(null);
|
|
19478
|
+
return;
|
|
19479
|
+
}
|
|
19480
|
+
setHover({ sectionId, index });
|
|
19810
19481
|
};
|
|
19811
19482
|
const onLeave = () => setHover(null);
|
|
19812
19483
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19818,25 +19489,23 @@ function AiMediaStripOverlay({
|
|
|
19818
19489
|
}, []);
|
|
19819
19490
|
(0, import_react12.useEffect)(() => {
|
|
19820
19491
|
const onClick = (e) => {
|
|
19492
|
+
const current = activeRef.current;
|
|
19493
|
+
if (!current) return;
|
|
19821
19494
|
const t = e.target;
|
|
19822
|
-
if (!(t instanceof
|
|
19823
|
-
if (t.closest(
|
|
19824
|
-
const
|
|
19825
|
-
if (
|
|
19826
|
-
|
|
19827
|
-
setItemEditOn(false);
|
|
19495
|
+
if (!(t instanceof HTMLElement)) return;
|
|
19496
|
+
if (t.closest("[data-ohw-item-interaction]")) return;
|
|
19497
|
+
const itemEl = findMediaStripItemElement(current.sectionId, current.index);
|
|
19498
|
+
if (itemEl && itemEl.contains(t)) return;
|
|
19499
|
+
setActive(null);
|
|
19828
19500
|
setError(null);
|
|
19829
|
-
setActive(ref);
|
|
19830
19501
|
};
|
|
19831
19502
|
document.addEventListener("click", onClick, true);
|
|
19832
19503
|
return () => document.removeEventListener("click", onClick, true);
|
|
19833
|
-
}, [
|
|
19504
|
+
}, []);
|
|
19834
19505
|
(0, import_react12.useEffect)(() => {
|
|
19835
19506
|
const onBlur = () => {
|
|
19836
19507
|
if (!activeRef.current) return;
|
|
19837
19508
|
setActive(null);
|
|
19838
|
-
setItemEditOn(false);
|
|
19839
|
-
setLinkOpen(false);
|
|
19840
19509
|
setError(null);
|
|
19841
19510
|
};
|
|
19842
19511
|
window.addEventListener("blur", onBlur);
|
|
@@ -19846,10 +19515,7 @@ function AiMediaStripOverlay({
|
|
|
19846
19515
|
const onKeyDown = (e) => {
|
|
19847
19516
|
if (e.key !== "Escape") return;
|
|
19848
19517
|
if (!activeRef.current) return;
|
|
19849
|
-
if (linkOpenRef.current) return;
|
|
19850
|
-
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19851
19518
|
setActive(null);
|
|
19852
|
-
setItemEditOn(false);
|
|
19853
19519
|
setError(null);
|
|
19854
19520
|
};
|
|
19855
19521
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19883,133 +19549,137 @@ function AiMediaStripOverlay({
|
|
|
19883
19549
|
tree: nextTree,
|
|
19884
19550
|
label: entry.label,
|
|
19885
19551
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19886
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19887
|
-
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19888
|
-
// on every edit reads as the section jumping around.
|
|
19889
|
-
skipScrollIntoView: true
|
|
19552
|
+
...entry.brand ? { brand: entry.brand } : {}
|
|
19890
19553
|
});
|
|
19891
19554
|
return true;
|
|
19892
19555
|
},
|
|
19893
19556
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19894
19557
|
);
|
|
19895
19558
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19559
|
+
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19896
19560
|
const activeItemRect = useLiveItemRect(active);
|
|
19897
|
-
const
|
|
19898
|
-
const
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
|
|
19561
|
+
const TOOLBAR_APPROX_H = 170;
|
|
19562
|
+
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
19563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
19564
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19565
|
+
"button",
|
|
19566
|
+
{
|
|
19567
|
+
type: "button",
|
|
19568
|
+
"data-ohw-toolbar": "",
|
|
19569
|
+
onClick: () => {
|
|
19570
|
+
clearInteractionChromeRef.current();
|
|
19571
|
+
setActive(hover);
|
|
19572
|
+
},
|
|
19573
|
+
"aria-label": "Configure media item",
|
|
19574
|
+
style: {
|
|
19575
|
+
position: "fixed",
|
|
19576
|
+
top: hoverHandleRect.top + 8,
|
|
19577
|
+
left: hoverHandleRect.left + hoverHandleRect.width - 36,
|
|
19578
|
+
width: 28,
|
|
19579
|
+
height: 28,
|
|
19580
|
+
borderRadius: 8,
|
|
19581
|
+
border: `1.5px dashed ${PRIMARY3}`,
|
|
19582
|
+
background: "#ffffff",
|
|
19583
|
+
color: PRIMARY3,
|
|
19584
|
+
display: "flex",
|
|
19585
|
+
alignItems: "center",
|
|
19586
|
+
justifyContent: "center",
|
|
19587
|
+
cursor: "pointer",
|
|
19588
|
+
zIndex: 2147483643,
|
|
19589
|
+
fontSize: 14,
|
|
19590
|
+
fontWeight: 700
|
|
19591
|
+
},
|
|
19592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
19593
|
+
}
|
|
19594
|
+
),
|
|
19595
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19596
|
+
ItemInteractionLayer,
|
|
19597
|
+
{
|
|
19598
|
+
rect: activeItemRect,
|
|
19599
|
+
state: toolbarState,
|
|
19600
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19601
|
+
MediaStripToolbar,
|
|
19602
|
+
{
|
|
19603
|
+
entry: activeEntry,
|
|
19604
|
+
index: active.index,
|
|
19605
|
+
pending,
|
|
19606
|
+
error,
|
|
19607
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19608
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19609
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19610
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19611
|
+
onResize: (delta) => {
|
|
19612
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19613
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19614
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19615
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19616
|
+
},
|
|
19617
|
+
onSetAlt: (alt) => {
|
|
19618
|
+
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19619
|
+
},
|
|
19620
|
+
onSetLink: (href, linkTarget) => {
|
|
19931
19621
|
void runMutation(
|
|
19932
19622
|
active.sectionId,
|
|
19933
|
-
(tree) =>
|
|
19934
|
-
|
|
19935
|
-
|
|
19936
|
-
|
|
19623
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
19624
|
+
);
|
|
19625
|
+
},
|
|
19626
|
+
onAddItem: () => {
|
|
19627
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19628
|
+
if (!picked) return;
|
|
19629
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19630
|
+
void runMutation(
|
|
19631
|
+
active.sectionId,
|
|
19632
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19633
|
+
{ [picked.assetId]: picked.url }
|
|
19634
|
+
).then((applied) => {
|
|
19635
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19636
|
+
});
|
|
19937
19637
|
});
|
|
19938
|
-
}
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19638
|
+
},
|
|
19639
|
+
onChangeImage: () => {
|
|
19640
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19641
|
+
if (!picked) return;
|
|
19642
|
+
void runMutation(
|
|
19643
|
+
active.sectionId,
|
|
19644
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19645
|
+
{ [picked.assetId]: picked.url }
|
|
19646
|
+
);
|
|
19647
|
+
});
|
|
19648
|
+
},
|
|
19649
|
+
onRemoveItem: () => {
|
|
19650
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19651
|
+
(applied) => {
|
|
19652
|
+
if (applied) setActive(null);
|
|
19653
|
+
}
|
|
19947
19654
|
);
|
|
19948
|
-
}
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
19959
|
-
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
},
|
|
19964
|
-
onMoveRight: () => {
|
|
19965
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19966
|
-
(applied) => {
|
|
19967
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19968
|
-
}
|
|
19969
|
-
);
|
|
19970
|
-
}
|
|
19971
|
-
}
|
|
19972
|
-
) }),
|
|
19973
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19974
|
-
"div",
|
|
19975
|
-
{
|
|
19976
|
-
"data-ohw-bridge": "",
|
|
19977
|
-
"data-ohw-item-interaction": "",
|
|
19978
|
-
"aria-hidden": true,
|
|
19979
|
-
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
19980
|
-
style: {
|
|
19981
|
-
top: activeItemRect.top + activeItemRect.height + 10,
|
|
19982
|
-
left: activeItemRect.left - 5,
|
|
19983
|
-
background: PRIMARY3,
|
|
19984
|
-
zIndex: 2147483644
|
|
19985
|
-
},
|
|
19986
|
-
children: "Media item"
|
|
19987
|
-
}
|
|
19988
|
-
),
|
|
19989
|
-
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19990
|
-
LinkModal,
|
|
19991
|
-
{
|
|
19992
|
-
href: activeHref,
|
|
19993
|
-
linkTarget: activeTarget,
|
|
19994
|
-
onClose: () => setLinkOpen(false),
|
|
19995
|
-
onSave: (href, linkTarget) => {
|
|
19996
|
-
void runMutation(
|
|
19997
|
-
active.sectionId,
|
|
19998
|
-
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
19999
|
-
);
|
|
19655
|
+
},
|
|
19656
|
+
onMoveLeft: () => {
|
|
19657
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19658
|
+
(applied) => {
|
|
19659
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19660
|
+
}
|
|
19661
|
+
);
|
|
19662
|
+
},
|
|
19663
|
+
onMoveRight: () => {
|
|
19664
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19665
|
+
(applied) => {
|
|
19666
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19667
|
+
}
|
|
19668
|
+
);
|
|
19669
|
+
}
|
|
20000
19670
|
}
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
19671
|
+
)
|
|
19672
|
+
}
|
|
19673
|
+
)
|
|
20004
19674
|
] });
|
|
20005
19675
|
}
|
|
20006
19676
|
|
|
20007
19677
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
20008
19678
|
var import_react13 = require("react");
|
|
20009
|
-
var
|
|
20010
|
-
var
|
|
19679
|
+
var import_lucide_react9 = require("lucide-react");
|
|
19680
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
20011
19681
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
20012
|
-
var
|
|
19682
|
+
var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
|
|
20013
19683
|
function findPricingCardElement(sectionId, index) {
|
|
20014
19684
|
const sectionEl = findByInstanceId(sectionId);
|
|
20015
19685
|
if (!sectionEl) return null;
|
|
@@ -20021,7 +19691,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
20021
19691
|
}
|
|
20022
19692
|
function cardRefFromTarget(target) {
|
|
20023
19693
|
if (!(target instanceof Element)) return null;
|
|
20024
|
-
if (target.closest(
|
|
19694
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
20025
19695
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
20026
19696
|
if (!cardEl) return null;
|
|
20027
19697
|
const sectionEl = cardEl.closest("[data-ohw-section]");
|
|
@@ -20031,21 +19701,21 @@ function cardRefFromTarget(target) {
|
|
|
20031
19701
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
20032
19702
|
return { sectionId, index };
|
|
20033
19703
|
}
|
|
20034
|
-
function
|
|
19704
|
+
function sameRef(a, b) {
|
|
20035
19705
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
20036
19706
|
}
|
|
20037
|
-
function
|
|
19707
|
+
function rectOf(el) {
|
|
20038
19708
|
if (!el) return null;
|
|
20039
19709
|
const r2 = el.getBoundingClientRect();
|
|
20040
19710
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
20041
19711
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20042
19712
|
}
|
|
20043
19713
|
function readRect3(ref) {
|
|
20044
|
-
return
|
|
19714
|
+
return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
20045
19715
|
}
|
|
20046
19716
|
function readGridRect(ref) {
|
|
20047
19717
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
20048
|
-
return
|
|
19718
|
+
return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
20049
19719
|
}
|
|
20050
19720
|
function useLiveCardRect(ref, grid = false) {
|
|
20051
19721
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
@@ -20075,7 +19745,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
20075
19745
|
}
|
|
20076
19746
|
var TOOLBAR_GRID_GAP = 52;
|
|
20077
19747
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
20078
|
-
var
|
|
19748
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
20079
19749
|
function GridToolbarSlot({ gridRect, children }) {
|
|
20080
19750
|
const slotRef = (0, import_react13.useRef)(null);
|
|
20081
19751
|
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
@@ -20087,7 +19757,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20087
19757
|
const w = slot.offsetWidth;
|
|
20088
19758
|
if (w <= 0) return;
|
|
20089
19759
|
const half = w / 2;
|
|
20090
|
-
const clamped = Math.max(
|
|
19760
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
20091
19761
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
20092
19762
|
};
|
|
20093
19763
|
clamp();
|
|
@@ -20096,7 +19766,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20096
19766
|
return () => ro.disconnect();
|
|
20097
19767
|
}, [centerX, children]);
|
|
20098
19768
|
const mobile = window.innerWidth <= 480;
|
|
20099
|
-
return /* @__PURE__ */ (0,
|
|
19769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20100
19770
|
"div",
|
|
20101
19771
|
{
|
|
20102
19772
|
ref: slotRef,
|
|
@@ -20131,7 +19801,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
20131
19801
|
});
|
|
20132
19802
|
}
|
|
20133
19803
|
function StyleSwatch({ style }) {
|
|
20134
|
-
return /* @__PURE__ */ (0,
|
|
19804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20135
19805
|
"span",
|
|
20136
19806
|
{
|
|
20137
19807
|
"aria-hidden": true,
|
|
@@ -20145,35 +19815,35 @@ function StyleSwatch({ style }) {
|
|
|
20145
19815
|
);
|
|
20146
19816
|
}
|
|
20147
19817
|
function ButtonGlyph() {
|
|
20148
|
-
return /* @__PURE__ */ (0,
|
|
20149
|
-
/* @__PURE__ */ (0,
|
|
20150
|
-
/* @__PURE__ */ (0,
|
|
19818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
19819
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
19820
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20151
19821
|
] });
|
|
20152
19822
|
}
|
|
20153
19823
|
function FeatureGlyph({ mode }) {
|
|
20154
|
-
return /* @__PURE__ */ (0,
|
|
20155
|
-
/* @__PURE__ */ (0,
|
|
20156
|
-
/* @__PURE__ */ (0,
|
|
20157
|
-
/* @__PURE__ */ (0,
|
|
20158
|
-
/* @__PURE__ */ (0,
|
|
20159
|
-
/* @__PURE__ */ (0,
|
|
20160
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
19824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
19825
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
19826
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
19827
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
19828
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
19829
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
19830
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20161
19831
|
] });
|
|
20162
19832
|
}
|
|
20163
|
-
function
|
|
19833
|
+
function ToolbarAction({
|
|
20164
19834
|
label,
|
|
20165
19835
|
onClick,
|
|
20166
19836
|
disabled = false,
|
|
20167
19837
|
children
|
|
20168
19838
|
}) {
|
|
20169
|
-
const button = /* @__PURE__ */ (0,
|
|
20170
|
-
return /* @__PURE__ */ (0,
|
|
20171
|
-
/* @__PURE__ */ (0,
|
|
20172
|
-
/* @__PURE__ */ (0,
|
|
19839
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
19840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19841
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
19842
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
20173
19843
|
] });
|
|
20174
19844
|
}
|
|
20175
|
-
function
|
|
20176
|
-
return /* @__PURE__ */ (0,
|
|
19845
|
+
function ToolbarSeparator() {
|
|
19846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
20177
19847
|
}
|
|
20178
19848
|
function CardStyleMenu({
|
|
20179
19849
|
value,
|
|
@@ -20181,7 +19851,7 @@ function CardStyleMenu({
|
|
|
20181
19851
|
disabled = false
|
|
20182
19852
|
}) {
|
|
20183
19853
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
20184
|
-
const trigger = /* @__PURE__ */ (0,
|
|
19854
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20185
19855
|
"button",
|
|
20186
19856
|
{
|
|
20187
19857
|
type: "button",
|
|
@@ -20192,28 +19862,28 @@ function CardStyleMenu({
|
|
|
20192
19862
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20193
19863
|
),
|
|
20194
19864
|
children: [
|
|
20195
|
-
/* @__PURE__ */ (0,
|
|
20196
|
-
/* @__PURE__ */ (0,
|
|
20197
|
-
/* @__PURE__ */ (0,
|
|
19865
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
|
|
19866
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
19867
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20198
19868
|
]
|
|
20199
19869
|
}
|
|
20200
19870
|
);
|
|
20201
19871
|
if (disabled) {
|
|
20202
|
-
return /* @__PURE__ */ (0,
|
|
20203
|
-
/* @__PURE__ */ (0,
|
|
20204
|
-
/* @__PURE__ */ (0,
|
|
20205
|
-
/* @__PURE__ */ (0,
|
|
20206
|
-
/* @__PURE__ */ (0,
|
|
19872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19873
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
19874
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19875
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
19876
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20207
19877
|
] })
|
|
20208
19878
|
] });
|
|
20209
19879
|
}
|
|
20210
|
-
return /* @__PURE__ */ (0,
|
|
20211
|
-
/* @__PURE__ */ (0,
|
|
20212
|
-
/* @__PURE__ */ (0,
|
|
20213
|
-
/* @__PURE__ */ (0,
|
|
20214
|
-
/* @__PURE__ */ (0,
|
|
19880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19881
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
19882
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
19883
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
19884
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
20215
19885
|
const selected = style.value === value;
|
|
20216
|
-
return /* @__PURE__ */ (0,
|
|
19886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20217
19887
|
DropdownMenuItem,
|
|
20218
19888
|
{
|
|
20219
19889
|
role: "menuitemradio",
|
|
@@ -20221,9 +19891,9 @@ function CardStyleMenu({
|
|
|
20221
19891
|
onSelect: () => onChange(style.value),
|
|
20222
19892
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20223
19893
|
children: [
|
|
20224
|
-
/* @__PURE__ */ (0,
|
|
20225
|
-
/* @__PURE__ */ (0,
|
|
20226
|
-
selected && /* @__PURE__ */ (0,
|
|
19894
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
|
|
19895
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
|
|
19896
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
20227
19897
|
]
|
|
20228
19898
|
},
|
|
20229
19899
|
style.value
|
|
@@ -20253,7 +19923,7 @@ function PricingCardToolbar({
|
|
|
20253
19923
|
const style = pricingCardStyle(entry.tree, index);
|
|
20254
19924
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20255
19925
|
const mobile = window.innerWidth <= 480;
|
|
20256
|
-
return /* @__PURE__ */ (0,
|
|
19926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20257
19927
|
"div",
|
|
20258
19928
|
{
|
|
20259
19929
|
"data-ohw-bridge": "",
|
|
@@ -20265,7 +19935,7 @@ function PricingCardToolbar({
|
|
|
20265
19935
|
),
|
|
20266
19936
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20267
19937
|
children: [
|
|
20268
|
-
/* @__PURE__ */ (0,
|
|
19938
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20269
19939
|
"div",
|
|
20270
19940
|
{
|
|
20271
19941
|
className: cn(
|
|
@@ -20274,8 +19944,8 @@ function PricingCardToolbar({
|
|
|
20274
19944
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20275
19945
|
),
|
|
20276
19946
|
children: [
|
|
20277
|
-
/* @__PURE__ */ (0,
|
|
20278
|
-
/* @__PURE__ */ (0,
|
|
19947
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19948
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20279
19949
|
CustomToolbarButton,
|
|
20280
19950
|
{
|
|
20281
19951
|
type: "button",
|
|
@@ -20283,8 +19953,8 @@ function PricingCardToolbar({
|
|
|
20283
19953
|
"aria-pressed": featuredTag,
|
|
20284
19954
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20285
19955
|
className: "group size-8",
|
|
20286
|
-
children: /* @__PURE__ */ (0,
|
|
20287
|
-
|
|
19956
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19957
|
+
import_lucide_react9.Star,
|
|
20288
19958
|
{
|
|
20289
19959
|
size: 16,
|
|
20290
19960
|
fill: "currentColor",
|
|
@@ -20298,25 +19968,25 @@ function PricingCardToolbar({
|
|
|
20298
19968
|
)
|
|
20299
19969
|
}
|
|
20300
19970
|
) }),
|
|
20301
|
-
/* @__PURE__ */ (0,
|
|
19971
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20302
19972
|
] }),
|
|
20303
|
-
/* @__PURE__ */ (0,
|
|
20304
|
-
/* @__PURE__ */ (0,
|
|
20305
|
-
/* @__PURE__ */ (0,
|
|
20306
|
-
/* @__PURE__ */ (0,
|
|
20307
|
-
/* @__PURE__ */ (0,
|
|
20308
|
-
/* @__PURE__ */ (0,
|
|
20309
|
-
/* @__PURE__ */ (0,
|
|
19973
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19974
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
19975
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19976
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
|
|
19977
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "relative inline-flex", children: [
|
|
19978
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
|
|
19979
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
20310
19980
|
] }) }),
|
|
20311
|
-
/* @__PURE__ */ (0,
|
|
20312
|
-
/* @__PURE__ */ (0,
|
|
20313
|
-
/* @__PURE__ */ (0,
|
|
20314
|
-
/* @__PURE__ */ (0,
|
|
20315
|
-
/* @__PURE__ */ (0,
|
|
19981
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "add" }) }),
|
|
19982
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "remove" }) }),
|
|
19983
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19984
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19985
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20316
19986
|
]
|
|
20317
19987
|
}
|
|
20318
19988
|
),
|
|
20319
|
-
error && /* @__PURE__ */ (0,
|
|
19989
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
20320
19990
|
]
|
|
20321
19991
|
}
|
|
20322
19992
|
) });
|
|
@@ -20350,7 +20020,7 @@ function AiPricingCardOverlay({
|
|
|
20350
20020
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20351
20021
|
setHover((prev) => {
|
|
20352
20022
|
const next = ref && !overEditable ? ref : null;
|
|
20353
|
-
return
|
|
20023
|
+
return sameRef(prev, next) ? prev : next;
|
|
20354
20024
|
});
|
|
20355
20025
|
};
|
|
20356
20026
|
const onLeave = () => setHover(null);
|
|
@@ -20365,10 +20035,10 @@ function AiPricingCardOverlay({
|
|
|
20365
20035
|
const onClick = (e) => {
|
|
20366
20036
|
const t = e.target;
|
|
20367
20037
|
if (!(t instanceof Element)) return;
|
|
20368
|
-
if (t.closest(
|
|
20038
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
20369
20039
|
const ref = cardRefFromTarget(t);
|
|
20370
|
-
setActive((prev) =>
|
|
20371
|
-
if (!ref || !
|
|
20040
|
+
setActive((prev) => sameRef(prev, ref) ? prev : ref);
|
|
20041
|
+
if (!ref || !sameRef(activeRef.current, ref)) setError(null);
|
|
20372
20042
|
};
|
|
20373
20043
|
document.addEventListener("click", onClick, true);
|
|
20374
20044
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20433,12 +20103,12 @@ function AiPricingCardOverlay({
|
|
|
20433
20103
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20434
20104
|
const activeCardRect = useLiveCardRect(active);
|
|
20435
20105
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20436
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20437
|
-
return /* @__PURE__ */ (0,
|
|
20438
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20439
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20440
|
-
/* @__PURE__ */ (0,
|
|
20441
|
-
/* @__PURE__ */ (0,
|
|
20106
|
+
const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20108
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20109
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20110
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20111
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20442
20112
|
PricingCardToolbar,
|
|
20443
20113
|
{
|
|
20444
20114
|
entry: activeEntry,
|
|
@@ -20466,7 +20136,7 @@ function AiPricingCardOverlay({
|
|
|
20466
20136
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20467
20137
|
}
|
|
20468
20138
|
) }),
|
|
20469
|
-
/* @__PURE__ */ (0,
|
|
20139
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20470
20140
|
"div",
|
|
20471
20141
|
{
|
|
20472
20142
|
"data-ohw-bridge": "",
|
|
@@ -20488,7 +20158,7 @@ function AiPricingCardOverlay({
|
|
|
20488
20158
|
|
|
20489
20159
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20490
20160
|
var import_react14 = require("react");
|
|
20491
|
-
var
|
|
20161
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20492
20162
|
|
|
20493
20163
|
// src/lib/ai-video-tree.ts
|
|
20494
20164
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20530,11 +20200,39 @@ function clearVideo(tree, path) {
|
|
|
20530
20200
|
});
|
|
20531
20201
|
}
|
|
20532
20202
|
|
|
20203
|
+
// src/lib/youtube.ts
|
|
20204
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20205
|
+
function extractYouTubeId(input) {
|
|
20206
|
+
const trimmed = input.trim();
|
|
20207
|
+
if (!trimmed) return null;
|
|
20208
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20209
|
+
let url;
|
|
20210
|
+
try {
|
|
20211
|
+
url = new URL(trimmed);
|
|
20212
|
+
} catch {
|
|
20213
|
+
return null;
|
|
20214
|
+
}
|
|
20215
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
20216
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20217
|
+
return null;
|
|
20218
|
+
}
|
|
20219
|
+
let candidate = null;
|
|
20220
|
+
if (host === "youtu.be") {
|
|
20221
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20222
|
+
} else if (url.pathname === "/watch") {
|
|
20223
|
+
candidate = url.searchParams.get("v");
|
|
20224
|
+
} else {
|
|
20225
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20226
|
+
candidate = match ? match[1] : null;
|
|
20227
|
+
}
|
|
20228
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20229
|
+
}
|
|
20230
|
+
|
|
20533
20231
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20534
|
-
var
|
|
20232
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
20535
20233
|
var PRIMARY5 = "#0885FE";
|
|
20536
|
-
var
|
|
20537
|
-
var
|
|
20234
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20235
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20538
20236
|
function findVideoBlockElement(sectionId, path) {
|
|
20539
20237
|
const sectionEl = findByInstanceId(sectionId);
|
|
20540
20238
|
if (!sectionEl) return null;
|
|
@@ -20594,12 +20292,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20594
20292
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20595
20293
|
});
|
|
20596
20294
|
}
|
|
20597
|
-
function
|
|
20295
|
+
function Pill2({
|
|
20598
20296
|
label,
|
|
20599
20297
|
onClick,
|
|
20600
20298
|
disabled
|
|
20601
20299
|
}) {
|
|
20602
|
-
return /* @__PURE__ */ (0,
|
|
20300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20603
20301
|
"button",
|
|
20604
20302
|
{
|
|
20605
20303
|
type: "button",
|
|
@@ -20615,7 +20313,7 @@ function Pill({
|
|
|
20615
20313
|
border: "none",
|
|
20616
20314
|
cursor: disabled ? "default" : "pointer",
|
|
20617
20315
|
background: "#ffffff",
|
|
20618
|
-
color:
|
|
20316
|
+
color: OHW_BLUE_DARK2,
|
|
20619
20317
|
opacity: disabled ? 0.4 : 1,
|
|
20620
20318
|
fontSize: 12,
|
|
20621
20319
|
lineHeight: "16px",
|
|
@@ -20658,8 +20356,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20658
20356
|
onCommit(id);
|
|
20659
20357
|
}
|
|
20660
20358
|
};
|
|
20661
|
-
return /* @__PURE__ */ (0,
|
|
20662
|
-
/* @__PURE__ */ (0,
|
|
20359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20360
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20663
20361
|
"div",
|
|
20664
20362
|
{
|
|
20665
20363
|
style: {
|
|
@@ -20675,12 +20373,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20675
20373
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20676
20374
|
},
|
|
20677
20375
|
children: [
|
|
20678
|
-
/* @__PURE__ */ (0,
|
|
20376
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20679
20377
|
"span",
|
|
20680
20378
|
{
|
|
20681
20379
|
style: {
|
|
20682
20380
|
flex: "0 0 auto",
|
|
20683
|
-
color:
|
|
20381
|
+
color: OHW_BLUE_DARK2,
|
|
20684
20382
|
fontSize: 10,
|
|
20685
20383
|
lineHeight: "16px",
|
|
20686
20384
|
fontWeight: 700,
|
|
@@ -20690,7 +20388,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20690
20388
|
children: "Video"
|
|
20691
20389
|
}
|
|
20692
20390
|
),
|
|
20693
|
-
/* @__PURE__ */ (0,
|
|
20391
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20694
20392
|
"input",
|
|
20695
20393
|
{
|
|
20696
20394
|
type: "text",
|
|
@@ -20727,7 +20425,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20727
20425
|
]
|
|
20728
20426
|
}
|
|
20729
20427
|
),
|
|
20730
|
-
invalid && /* @__PURE__ */ (0,
|
|
20428
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20731
20429
|
] });
|
|
20732
20430
|
}
|
|
20733
20431
|
function VideoToolbar({
|
|
@@ -20737,7 +20435,7 @@ function VideoToolbar({
|
|
|
20737
20435
|
onSetVideoId,
|
|
20738
20436
|
onRemove
|
|
20739
20437
|
}) {
|
|
20740
|
-
return /* @__PURE__ */ (0,
|
|
20438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20741
20439
|
"div",
|
|
20742
20440
|
{
|
|
20743
20441
|
"data-ohw-bridge": "",
|
|
@@ -20749,7 +20447,7 @@ function VideoToolbar({
|
|
|
20749
20447
|
gap: 6,
|
|
20750
20448
|
alignItems: "center",
|
|
20751
20449
|
width: 280,
|
|
20752
|
-
background:
|
|
20450
|
+
background: OHW_BLUE2,
|
|
20753
20451
|
padding: 8,
|
|
20754
20452
|
borderRadius: 12,
|
|
20755
20453
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20757,9 +20455,9 @@ function VideoToolbar({
|
|
|
20757
20455
|
opacity: pending ? 0.6 : 1
|
|
20758
20456
|
},
|
|
20759
20457
|
children: [
|
|
20760
|
-
/* @__PURE__ */ (0,
|
|
20761
|
-
/* @__PURE__ */ (0,
|
|
20762
|
-
error && /* @__PURE__ */ (0,
|
|
20458
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20459
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20460
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20763
20461
|
]
|
|
20764
20462
|
}
|
|
20765
20463
|
);
|
|
@@ -20879,8 +20577,8 @@ function AiVideoOverlay({
|
|
|
20879
20577
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20880
20578
|
const TOOLBAR_APPROX_H = 90;
|
|
20881
20579
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20882
|
-
return /* @__PURE__ */ (0,
|
|
20883
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
20580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20581
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20884
20582
|
"button",
|
|
20885
20583
|
{
|
|
20886
20584
|
type: "button",
|
|
@@ -20908,15 +20606,15 @@ function AiVideoOverlay({
|
|
|
20908
20606
|
fontSize: 14,
|
|
20909
20607
|
fontWeight: 700
|
|
20910
20608
|
},
|
|
20911
|
-
children: /* @__PURE__ */ (0,
|
|
20609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
20912
20610
|
}
|
|
20913
20611
|
),
|
|
20914
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20612
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20915
20613
|
ItemInteractionLayer,
|
|
20916
20614
|
{
|
|
20917
20615
|
rect: activeBlockRect,
|
|
20918
20616
|
state: toolbarState,
|
|
20919
|
-
toolbar: /* @__PURE__ */ (0,
|
|
20617
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20920
20618
|
VideoToolbar,
|
|
20921
20619
|
{
|
|
20922
20620
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20940,7 +20638,7 @@ function AiVideoOverlay({
|
|
|
20940
20638
|
|
|
20941
20639
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20942
20640
|
var import_react15 = require("react");
|
|
20943
|
-
var
|
|
20641
|
+
var import_lucide_react11 = require("lucide-react");
|
|
20944
20642
|
|
|
20945
20643
|
// src/lib/ai-carousel-tree.ts
|
|
20946
20644
|
function isCarouselBlock(node) {
|
|
@@ -20991,10 +20689,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20991
20689
|
}
|
|
20992
20690
|
|
|
20993
20691
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20994
|
-
var
|
|
20692
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
20995
20693
|
var PRIMARY6 = "#0885FE";
|
|
20996
|
-
var
|
|
20997
|
-
var
|
|
20694
|
+
var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
20695
|
+
var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20998
20696
|
function findCarouselItemElement(sectionId, index) {
|
|
20999
20697
|
const sectionEl = findByInstanceId(sectionId);
|
|
21000
20698
|
if (!sectionEl) return null;
|
|
@@ -21073,8 +20771,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
21073
20771
|
postToParent2({ type: "ow:asset-pick", id });
|
|
21074
20772
|
});
|
|
21075
20773
|
}
|
|
21076
|
-
function
|
|
21077
|
-
return /* @__PURE__ */ (0,
|
|
20774
|
+
function Pill3({ label, onClick, disabled }) {
|
|
20775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21078
20776
|
"button",
|
|
21079
20777
|
{
|
|
21080
20778
|
type: "button",
|
|
@@ -21090,7 +20788,7 @@ function Pill2({ label, onClick, disabled }) {
|
|
|
21090
20788
|
border: "none",
|
|
21091
20789
|
cursor: disabled ? "default" : "pointer",
|
|
21092
20790
|
background: "#ffffff",
|
|
21093
|
-
color:
|
|
20791
|
+
color: OHW_BLUE_DARK3,
|
|
21094
20792
|
opacity: disabled ? 0.4 : 1,
|
|
21095
20793
|
fontSize: 12,
|
|
21096
20794
|
lineHeight: "16px",
|
|
@@ -21108,7 +20806,7 @@ function TogglePill({
|
|
|
21108
20806
|
onToggle,
|
|
21109
20807
|
disabled
|
|
21110
20808
|
}) {
|
|
21111
|
-
return /* @__PURE__ */ (0,
|
|
20809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
21112
20810
|
"button",
|
|
21113
20811
|
{
|
|
21114
20812
|
type: "button",
|
|
@@ -21127,7 +20825,7 @@ function TogglePill({
|
|
|
21127
20825
|
border: "none",
|
|
21128
20826
|
cursor: disabled ? "default" : "pointer",
|
|
21129
20827
|
background: "#ffffff",
|
|
21130
|
-
color:
|
|
20828
|
+
color: OHW_BLUE_DARK3,
|
|
21131
20829
|
opacity: disabled ? 0.4 : 1,
|
|
21132
20830
|
fontSize: 12,
|
|
21133
20831
|
lineHeight: "16px",
|
|
@@ -21137,7 +20835,7 @@ function TogglePill({
|
|
|
21137
20835
|
},
|
|
21138
20836
|
children: [
|
|
21139
20837
|
label,
|
|
21140
|
-
/* @__PURE__ */ (0,
|
|
20838
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21141
20839
|
"span",
|
|
21142
20840
|
{
|
|
21143
20841
|
"aria-hidden": true,
|
|
@@ -21150,10 +20848,10 @@ function TogglePill({
|
|
|
21150
20848
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
21151
20849
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
21152
20850
|
// "disabled control" rather than "switch that is off".
|
|
21153
|
-
background: on ?
|
|
20851
|
+
background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
|
|
21154
20852
|
transition: "background 120ms ease"
|
|
21155
20853
|
},
|
|
21156
|
-
children: /* @__PURE__ */ (0,
|
|
20854
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21157
20855
|
"span",
|
|
21158
20856
|
{
|
|
21159
20857
|
style: {
|
|
@@ -21182,7 +20880,7 @@ function CarouselSlideToolbar({
|
|
|
21182
20880
|
onChangeImage,
|
|
21183
20881
|
onToggleAutoplay
|
|
21184
20882
|
}) {
|
|
21185
|
-
return /* @__PURE__ */ (0,
|
|
20883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
21186
20884
|
"div",
|
|
21187
20885
|
{
|
|
21188
20886
|
"data-ohw-bridge": "",
|
|
@@ -21193,7 +20891,7 @@ function CarouselSlideToolbar({
|
|
|
21193
20891
|
flexDirection: "column",
|
|
21194
20892
|
gap: 6,
|
|
21195
20893
|
alignItems: "center",
|
|
21196
|
-
background:
|
|
20894
|
+
background: OHW_BLUE3,
|
|
21197
20895
|
padding: 8,
|
|
21198
20896
|
borderRadius: 12,
|
|
21199
20897
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21205,11 +20903,11 @@ function CarouselSlideToolbar({
|
|
|
21205
20903
|
pointerEvents: pending ? "none" : "auto"
|
|
21206
20904
|
},
|
|
21207
20905
|
children: [
|
|
21208
|
-
/* @__PURE__ */ (0,
|
|
21209
|
-
/* @__PURE__ */ (0,
|
|
21210
|
-
/* @__PURE__ */ (0,
|
|
20906
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
20907
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
|
|
20908
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21211
20909
|
] }),
|
|
21212
|
-
error && /* @__PURE__ */ (0,
|
|
20910
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21213
20911
|
]
|
|
21214
20912
|
}
|
|
21215
20913
|
);
|
|
@@ -21349,8 +21047,8 @@ function AiFadeCarouselOverlay({
|
|
|
21349
21047
|
const activeItemRect = useLiveItemRect2(active);
|
|
21350
21048
|
const TOOLBAR_APPROX_H = 90;
|
|
21351
21049
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21352
|
-
return /* @__PURE__ */ (0,
|
|
21353
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
21051
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21354
21052
|
"button",
|
|
21355
21053
|
{
|
|
21356
21054
|
type: "button",
|
|
@@ -21379,10 +21077,10 @@ function AiFadeCarouselOverlay({
|
|
|
21379
21077
|
fontSize: 14,
|
|
21380
21078
|
fontWeight: 700
|
|
21381
21079
|
},
|
|
21382
|
-
children: /* @__PURE__ */ (0,
|
|
21080
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21383
21081
|
}
|
|
21384
21082
|
),
|
|
21385
|
-
swapping && /* @__PURE__ */ (0,
|
|
21083
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21386
21084
|
"div",
|
|
21387
21085
|
{
|
|
21388
21086
|
ref: skeletonRef,
|
|
@@ -21400,15 +21098,15 @@ function AiFadeCarouselOverlay({
|
|
|
21400
21098
|
zIndex: 2147483646,
|
|
21401
21099
|
pointerEvents: "none"
|
|
21402
21100
|
},
|
|
21403
|
-
children: /* @__PURE__ */ (0,
|
|
21101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21404
21102
|
}
|
|
21405
21103
|
),
|
|
21406
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21104
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21407
21105
|
ItemInteractionLayer,
|
|
21408
21106
|
{
|
|
21409
21107
|
rect: activeItemRect,
|
|
21410
21108
|
state: toolbarState,
|
|
21411
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21109
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21412
21110
|
CarouselSlideToolbar,
|
|
21413
21111
|
{
|
|
21414
21112
|
pending,
|
|
@@ -21599,6 +21297,113 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21599
21297
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21600
21298
|
var import_react19 = require("react");
|
|
21601
21299
|
|
|
21300
|
+
// src/ui/dialog.tsx
|
|
21301
|
+
var React9 = __toESM(require("react"), 1);
|
|
21302
|
+
var import_radix_ui6 = require("radix-ui");
|
|
21303
|
+
var import_lucide_react12 = require("lucide-react");
|
|
21304
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
21305
|
+
function Dialog2({
|
|
21306
|
+
...props
|
|
21307
|
+
}) {
|
|
21308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21309
|
+
}
|
|
21310
|
+
function DialogPortal({
|
|
21311
|
+
...props
|
|
21312
|
+
}) {
|
|
21313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21314
|
+
}
|
|
21315
|
+
function DialogOverlay({
|
|
21316
|
+
className,
|
|
21317
|
+
...props
|
|
21318
|
+
}) {
|
|
21319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21320
|
+
import_radix_ui6.Dialog.Overlay,
|
|
21321
|
+
{
|
|
21322
|
+
"data-slot": "dialog-overlay",
|
|
21323
|
+
"data-ohw-link-modal-root": "",
|
|
21324
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21325
|
+
...props
|
|
21326
|
+
}
|
|
21327
|
+
);
|
|
21328
|
+
}
|
|
21329
|
+
var DialogContent = React9.forwardRef(
|
|
21330
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21331
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
21332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21333
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21334
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21335
|
+
import_radix_ui6.Dialog.Content,
|
|
21336
|
+
{
|
|
21337
|
+
ref,
|
|
21338
|
+
"data-slot": "dialog-content",
|
|
21339
|
+
className: cn(
|
|
21340
|
+
positionMode,
|
|
21341
|
+
"left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
|
|
21342
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21343
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21344
|
+
className
|
|
21345
|
+
),
|
|
21346
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
21347
|
+
...props,
|
|
21348
|
+
children: [
|
|
21349
|
+
children,
|
|
21350
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21351
|
+
import_radix_ui6.Dialog.Close,
|
|
21352
|
+
{
|
|
21353
|
+
type: "button",
|
|
21354
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21355
|
+
"aria-label": "Close",
|
|
21356
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
21357
|
+
}
|
|
21358
|
+
) : null
|
|
21359
|
+
]
|
|
21360
|
+
}
|
|
21361
|
+
)
|
|
21362
|
+
] });
|
|
21363
|
+
}
|
|
21364
|
+
);
|
|
21365
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21366
|
+
function DialogHeader({
|
|
21367
|
+
className,
|
|
21368
|
+
...props
|
|
21369
|
+
}) {
|
|
21370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21371
|
+
}
|
|
21372
|
+
function DialogFooter({
|
|
21373
|
+
className,
|
|
21374
|
+
...props
|
|
21375
|
+
}) {
|
|
21376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21377
|
+
"div",
|
|
21378
|
+
{
|
|
21379
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
21380
|
+
...props
|
|
21381
|
+
}
|
|
21382
|
+
);
|
|
21383
|
+
}
|
|
21384
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21385
|
+
import_radix_ui6.Dialog.Title,
|
|
21386
|
+
{
|
|
21387
|
+
ref,
|
|
21388
|
+
className: cn(
|
|
21389
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21390
|
+
className
|
|
21391
|
+
),
|
|
21392
|
+
...props
|
|
21393
|
+
}
|
|
21394
|
+
));
|
|
21395
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21396
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21397
|
+
import_radix_ui6.Dialog.Description,
|
|
21398
|
+
{
|
|
21399
|
+
ref,
|
|
21400
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
21401
|
+
...props
|
|
21402
|
+
}
|
|
21403
|
+
));
|
|
21404
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21405
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21406
|
+
|
|
21602
21407
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21603
21408
|
var import_lucide_react16 = require("lucide-react");
|
|
21604
21409
|
|
|
@@ -22702,7 +22507,6 @@ function shouldUseDevFixtures() {
|
|
|
22702
22507
|
function getLogoElement(el) {
|
|
22703
22508
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22704
22509
|
if (marked) return marked;
|
|
22705
|
-
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22706
22510
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22707
22511
|
if (!root) return null;
|
|
22708
22512
|
const anchor = el.closest("a");
|
|
@@ -24397,138 +24201,6 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24397
24201
|
return false;
|
|
24398
24202
|
}
|
|
24399
24203
|
|
|
24400
|
-
// src/lib/build-page-sync.ts
|
|
24401
|
-
var import_react23 = require("react");
|
|
24402
|
-
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24403
|
-
function normalisePath(path) {
|
|
24404
|
-
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
24405
|
-
if (!trimmed || trimmed === "/") return "/";
|
|
24406
|
-
return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
|
|
24407
|
-
}
|
|
24408
|
-
function isDeadPageHref(href, livePaths) {
|
|
24409
|
-
const value = href.trim();
|
|
24410
|
-
if (!value.startsWith("/") || value.startsWith("//")) return false;
|
|
24411
|
-
const path = normalisePath(value);
|
|
24412
|
-
if (path === "/") return false;
|
|
24413
|
-
return !livePaths.some((live) => {
|
|
24414
|
-
const p = normalisePath(live);
|
|
24415
|
-
return p === path || p !== "/" && path.startsWith(`${p}/`);
|
|
24416
|
-
});
|
|
24417
|
-
}
|
|
24418
|
-
var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
24419
|
-
function planBuildPageSync(links, msg) {
|
|
24420
|
-
const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
|
|
24421
|
-
const removed = new Set((msg.removed ?? []).map(normalisePath));
|
|
24422
|
-
const remove = [];
|
|
24423
|
-
const relabel = [];
|
|
24424
|
-
const retarget = [];
|
|
24425
|
-
const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
|
|
24426
|
-
for (const link of links) {
|
|
24427
|
-
const href = link.href.trim();
|
|
24428
|
-
const isPage = href.startsWith("/") && !href.startsWith("//");
|
|
24429
|
-
if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
|
|
24430
|
-
if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
|
|
24431
|
-
else remove.push(link.hrefKey);
|
|
24432
|
-
continue;
|
|
24433
|
-
}
|
|
24434
|
-
if (isPage) {
|
|
24435
|
-
const path = normalisePath(href);
|
|
24436
|
-
const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
|
|
24437
|
-
if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
|
|
24438
|
-
relabel.push({ hrefKey: link.hrefKey, label: rename.label });
|
|
24439
|
-
}
|
|
24440
|
-
continue;
|
|
24441
|
-
}
|
|
24442
|
-
if (href.startsWith("#") || href.startsWith("/#")) {
|
|
24443
|
-
const anchor = href.replace(/^\/?#/u, "").toLowerCase();
|
|
24444
|
-
const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
|
|
24445
|
-
if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
|
|
24446
|
-
relabel.push({ hrefKey: link.hrefKey, label: target.label });
|
|
24447
|
-
}
|
|
24448
|
-
}
|
|
24449
|
-
}
|
|
24450
|
-
return { remove, relabel, retarget };
|
|
24451
|
-
}
|
|
24452
|
-
function linkHref(el) {
|
|
24453
|
-
const key = el.getAttribute("data-ohw-href-key");
|
|
24454
|
-
const stored = key ? getStoredLinkHref(key) : void 0;
|
|
24455
|
-
return stored ?? el.getAttribute("href") ?? "";
|
|
24456
|
-
}
|
|
24457
|
-
function labelEl(anchor) {
|
|
24458
|
-
return anchor.querySelector('[data-ohw-editable="text"]');
|
|
24459
|
-
}
|
|
24460
|
-
function collectLinks() {
|
|
24461
|
-
const seen = /* @__PURE__ */ new Set();
|
|
24462
|
-
const links = [];
|
|
24463
|
-
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
24464
|
-
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
24465
|
-
if (seen.has(hrefKey)) return;
|
|
24466
|
-
const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
24467
|
-
if (!area) return;
|
|
24468
|
-
const label = labelEl(el);
|
|
24469
|
-
if (!label && area !== "chrome") return;
|
|
24470
|
-
seen.add(hrefKey);
|
|
24471
|
-
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
24472
|
-
});
|
|
24473
|
-
return links;
|
|
24474
|
-
}
|
|
24475
|
-
function applyBuildPageSync(msg, deps) {
|
|
24476
|
-
const plan = planBuildPageSync(collectLinks(), msg);
|
|
24477
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
24478
|
-
for (const hrefKey of plan.remove) {
|
|
24479
|
-
const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
24480
|
-
if (!anchor) continue;
|
|
24481
|
-
const nav = isNavbarHrefKey(hrefKey);
|
|
24482
|
-
const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
|
|
24483
|
-
if (!result) continue;
|
|
24484
|
-
for (const key of result.removedKeys) {
|
|
24485
|
-
nodes.set(key, "");
|
|
24486
|
-
clearStoredLinkHref(key);
|
|
24487
|
-
}
|
|
24488
|
-
nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
|
|
24489
|
-
}
|
|
24490
|
-
for (const { hrefKey, label } of plan.relabel) {
|
|
24491
|
-
const labelKey = hrefKey.replace(/-href$/u, "-label");
|
|
24492
|
-
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24493
|
-
const el = labelEl(anchor);
|
|
24494
|
-
if (el) el.textContent = label;
|
|
24495
|
-
});
|
|
24496
|
-
nodes.set(labelKey, label);
|
|
24497
|
-
}
|
|
24498
|
-
for (const { hrefKey, href } of plan.retarget) {
|
|
24499
|
-
setStoredLinkHref(hrefKey, href);
|
|
24500
|
-
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24501
|
-
if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
|
|
24502
|
-
});
|
|
24503
|
-
nodes.set(hrefKey, href);
|
|
24504
|
-
}
|
|
24505
|
-
if (nodes.size === 0) return 0;
|
|
24506
|
-
deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
|
|
24507
|
-
deps.postToParent({
|
|
24508
|
-
type: "ow:change",
|
|
24509
|
-
nodes: [...nodes].map(([key, text]) => ({ key, text }))
|
|
24510
|
-
});
|
|
24511
|
-
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24512
|
-
}
|
|
24513
|
-
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24514
|
-
(0, import_react23.useEffect)(() => {
|
|
24515
|
-
if (!isEditMode) return;
|
|
24516
|
-
const onMessage = (e) => {
|
|
24517
|
-
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
24518
|
-
const changed = applyBuildPageSync(e.data, {
|
|
24519
|
-
getEditContent: () => editContentRef.current,
|
|
24520
|
-
setEditContent: (next) => {
|
|
24521
|
-
editContentRef.current = next;
|
|
24522
|
-
},
|
|
24523
|
-
postToParent: postToParent2
|
|
24524
|
-
});
|
|
24525
|
-
postToParent2({ type: "ow:pages-synced", changed });
|
|
24526
|
-
};
|
|
24527
|
-
window.addEventListener("message", onMessage);
|
|
24528
|
-
return () => window.removeEventListener("message", onMessage);
|
|
24529
|
-
}, [isEditMode, editContentRef, postToParent2]);
|
|
24530
|
-
}
|
|
24531
|
-
|
|
24532
24204
|
// src/lib/nav-page-sync.ts
|
|
24533
24205
|
function labelKeyFor(hrefKey) {
|
|
24534
24206
|
return hrefKey.replace(/-href$/, "-label");
|
|
@@ -25512,7 +25184,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25512
25184
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25513
25185
|
return resolveFooterLinksContainerFrom(el);
|
|
25514
25186
|
}
|
|
25515
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") ||
|
|
25187
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25516
25188
|
return getNavigationRoot(el);
|
|
25517
25189
|
}
|
|
25518
25190
|
return null;
|
|
@@ -25734,6 +25406,7 @@ var ICONS = {
|
|
|
25734
25406
|
insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
|
|
25735
25407
|
insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
|
|
25736
25408
|
};
|
|
25409
|
+
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25737
25410
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25738
25411
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25739
25412
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25831,7 +25504,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25831
25504
|
el.style.top = `${top}px`;
|
|
25832
25505
|
el.style.height = `${height}px`;
|
|
25833
25506
|
}
|
|
25834
|
-
var
|
|
25507
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
25835
25508
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25836
25509
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25837
25510
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25858,8 +25531,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25858
25531
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25859
25532
|
const half = toolbarWidth / 2;
|
|
25860
25533
|
return Math.max(
|
|
25861
|
-
|
|
25862
|
-
Math.min(centerX, window.innerWidth -
|
|
25534
|
+
TOOLBAR_EDGE_MARGIN3 + half,
|
|
25535
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
|
|
25863
25536
|
);
|
|
25864
25537
|
}
|
|
25865
25538
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25983,9 +25656,9 @@ function FloatingToolbar({
|
|
|
25983
25656
|
showEditLink,
|
|
25984
25657
|
onEditLink
|
|
25985
25658
|
}) {
|
|
25986
|
-
const localRef =
|
|
25987
|
-
const [measuredW, setMeasuredW] =
|
|
25988
|
-
const setRefs =
|
|
25659
|
+
const localRef = import_react23.default.useRef(null);
|
|
25660
|
+
const [measuredW, setMeasuredW] = import_react23.default.useState(330);
|
|
25661
|
+
const setRefs = import_react23.default.useCallback(
|
|
25989
25662
|
(node) => {
|
|
25990
25663
|
localRef.current = node;
|
|
25991
25664
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -25997,7 +25670,7 @@ function FloatingToolbar({
|
|
|
25997
25670
|
},
|
|
25998
25671
|
[elRef]
|
|
25999
25672
|
);
|
|
26000
|
-
|
|
25673
|
+
import_react23.default.useLayoutEffect(() => {
|
|
26001
25674
|
const node = localRef.current;
|
|
26002
25675
|
if (!node) return;
|
|
26003
25676
|
const update = () => {
|
|
@@ -26023,7 +25696,7 @@ function FloatingToolbar({
|
|
|
26023
25696
|
pointerEvents: "auto"
|
|
26024
25697
|
},
|
|
26025
25698
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
|
|
26026
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
25699
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
|
|
26027
25700
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
26028
25701
|
btns.map((btn) => {
|
|
26029
25702
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -26232,8 +25905,8 @@ function OhhwellsBridge() {
|
|
|
26232
25905
|
const router = (0, import_navigation4.useRouter)();
|
|
26233
25906
|
const searchParams = (0, import_navigation4.useSearchParams)();
|
|
26234
25907
|
const isEditMode = isEditSessionActive();
|
|
26235
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
26236
|
-
(0,
|
|
25908
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
|
|
25909
|
+
(0, import_react23.useEffect)(() => {
|
|
26237
25910
|
const figtreeFontId = "ohw-figtree-font";
|
|
26238
25911
|
if (!document.getElementById(figtreeFontId)) {
|
|
26239
25912
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -26259,8 +25932,8 @@ function OhhwellsBridge() {
|
|
|
26259
25932
|
};
|
|
26260
25933
|
}, []);
|
|
26261
25934
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26262
|
-
const [subdomain, setSubdomain] = (0,
|
|
26263
|
-
(0,
|
|
25935
|
+
const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
25936
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
26264
25937
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26265
25938
|
if (next !== subdomain) setSubdomain(next);
|
|
26266
25939
|
if (next) return;
|
|
@@ -26272,7 +25945,7 @@ function OhhwellsBridge() {
|
|
|
26272
25945
|
}, 0);
|
|
26273
25946
|
return () => window.clearTimeout(t);
|
|
26274
25947
|
}, [subdomainFromQuery, subdomain]);
|
|
26275
|
-
(0,
|
|
25948
|
+
(0, import_react23.useEffect)(() => {
|
|
26276
25949
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
26277
25950
|
const url = new URL(window.location.href);
|
|
26278
25951
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -26284,22 +25957,22 @@ function OhhwellsBridge() {
|
|
|
26284
25957
|
useSavedLinkNavigation(isEditMode);
|
|
26285
25958
|
useNavDropdownToggle(isEditMode);
|
|
26286
25959
|
useHashLinkScroll(isEditMode);
|
|
26287
|
-
const postToParent2 = (0,
|
|
25960
|
+
const postToParent2 = (0, import_react23.useCallback)((data) => {
|
|
26288
25961
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
26289
25962
|
window.parent.postMessage(data, "*");
|
|
26290
25963
|
}
|
|
26291
25964
|
}, []);
|
|
26292
|
-
const [fetchState, setFetchState] = (0,
|
|
26293
|
-
const [showBranding, setShowBranding] = (0,
|
|
26294
|
-
const autoSaveTimers = (0,
|
|
26295
|
-
(0,
|
|
25965
|
+
const [fetchState, setFetchState] = (0, import_react23.useState)("idle");
|
|
25966
|
+
const [showBranding, setShowBranding] = (0, import_react23.useState)(false);
|
|
25967
|
+
const autoSaveTimers = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
|
|
25968
|
+
(0, import_react23.useEffect)(() => {
|
|
26296
25969
|
stampBridgeVersionOnDocument();
|
|
26297
25970
|
}, []);
|
|
26298
|
-
(0,
|
|
25971
|
+
(0, import_react23.useEffect)(() => {
|
|
26299
25972
|
if (isEditMode) return;
|
|
26300
25973
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
26301
25974
|
}, [isEditMode, subdomain, fetchState]);
|
|
26302
|
-
(0,
|
|
25975
|
+
(0, import_react23.useEffect)(() => {
|
|
26303
25976
|
if (isEditMode || !subdomain) return;
|
|
26304
25977
|
const onError = (event) => {
|
|
26305
25978
|
reportOutageBeacon({
|
|
@@ -26320,40 +25993,40 @@ function OhhwellsBridge() {
|
|
|
26320
25993
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
26321
25994
|
};
|
|
26322
25995
|
}, [isEditMode, subdomain]);
|
|
26323
|
-
const activeElRef = (0,
|
|
26324
|
-
const pointerHeldRef = (0,
|
|
26325
|
-
const selectedElRef = (0,
|
|
26326
|
-
const selectedHrefKeyRef = (0,
|
|
26327
|
-
const selectedFooterColAttrRef = (0,
|
|
26328
|
-
const footerHeadingTitleCacheRef = (0,
|
|
26329
|
-
const originalContentRef = (0,
|
|
26330
|
-
const activeStateElRef = (0,
|
|
26331
|
-
const parentScrollRef = (0,
|
|
26332
|
-
const visibleViewportRef = (0,
|
|
26333
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
26334
|
-
const attachVisibleViewport = (0,
|
|
25996
|
+
const activeElRef = (0, import_react23.useRef)(null);
|
|
25997
|
+
const pointerHeldRef = (0, import_react23.useRef)(false);
|
|
25998
|
+
const selectedElRef = (0, import_react23.useRef)(null);
|
|
25999
|
+
const selectedHrefKeyRef = (0, import_react23.useRef)(null);
|
|
26000
|
+
const selectedFooterColAttrRef = (0, import_react23.useRef)(null);
|
|
26001
|
+
const footerHeadingTitleCacheRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
|
|
26002
|
+
const originalContentRef = (0, import_react23.useRef)(null);
|
|
26003
|
+
const activeStateElRef = (0, import_react23.useRef)(null);
|
|
26004
|
+
const parentScrollRef = (0, import_react23.useRef)(null);
|
|
26005
|
+
const visibleViewportRef = (0, import_react23.useRef)(null);
|
|
26006
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react23.useState)(null);
|
|
26007
|
+
const attachVisibleViewport = (0, import_react23.useCallback)((node) => {
|
|
26335
26008
|
visibleViewportRef.current = node;
|
|
26336
26009
|
setDialogPortalContainer(node);
|
|
26337
26010
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
26338
26011
|
}, []);
|
|
26339
|
-
const toolbarElRef = (0,
|
|
26340
|
-
const glowElRef = (0,
|
|
26341
|
-
const hoveredImageRef = (0,
|
|
26342
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
26343
|
-
const dragOverElRef = (0,
|
|
26344
|
-
const [mediaHover, setMediaHover] = (0,
|
|
26345
|
-
const [selectedAiSectionId, setSelectedAiSectionId] = (0,
|
|
26346
|
-
const selectedAiSectionIdRef = (0,
|
|
26347
|
-
const handleAiSectionSelectionChange = (0,
|
|
26012
|
+
const toolbarElRef = (0, import_react23.useRef)(null);
|
|
26013
|
+
const glowElRef = (0, import_react23.useRef)(null);
|
|
26014
|
+
const hoveredImageRef = (0, import_react23.useRef)(null);
|
|
26015
|
+
const hoveredImageHasTextOverlapRef = (0, import_react23.useRef)(false);
|
|
26016
|
+
const dragOverElRef = (0, import_react23.useRef)(null);
|
|
26017
|
+
const [mediaHover, setMediaHover] = (0, import_react23.useState)(null);
|
|
26018
|
+
const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react23.useState)(null);
|
|
26019
|
+
const selectedAiSectionIdRef = (0, import_react23.useRef)(null);
|
|
26020
|
+
const handleAiSectionSelectionChange = (0, import_react23.useCallback)((id) => {
|
|
26348
26021
|
selectedAiSectionIdRef.current = id;
|
|
26349
26022
|
setSelectedAiSectionId(id);
|
|
26350
26023
|
}, []);
|
|
26351
|
-
const [selectedMedia, setSelectedMedia] = (0,
|
|
26352
|
-
const selectedMediaElRef = (0,
|
|
26353
|
-
const mediaKeyDropTokenRef = (0,
|
|
26354
|
-
const selectedIconElRef = (0,
|
|
26355
|
-
const selectedSocialElRef = (0,
|
|
26356
|
-
const queueSectionKeyDrop = (0,
|
|
26024
|
+
const [selectedMedia, setSelectedMedia] = (0, import_react23.useState)(null);
|
|
26025
|
+
const selectedMediaElRef = (0, import_react23.useRef)(null);
|
|
26026
|
+
const mediaKeyDropTokenRef = (0, import_react23.useRef)(0);
|
|
26027
|
+
const selectedIconElRef = (0, import_react23.useRef)(null);
|
|
26028
|
+
const selectedSocialElRef = (0, import_react23.useRef)(null);
|
|
26029
|
+
const queueSectionKeyDrop = (0, import_react23.useCallback)((prev) => {
|
|
26357
26030
|
const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
|
|
26358
26031
|
if (!sectionEl) return;
|
|
26359
26032
|
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
@@ -26374,31 +26047,31 @@ function OhhwellsBridge() {
|
|
|
26374
26047
|
window.addEventListener("message", onQueueDrained);
|
|
26375
26048
|
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
26376
26049
|
}, []);
|
|
26377
|
-
const clearMediaSelection = (0,
|
|
26050
|
+
const clearMediaSelection = (0, import_react23.useCallback)(() => {
|
|
26378
26051
|
const prev = selectedMediaElRef.current;
|
|
26379
26052
|
selectedMediaElRef.current = null;
|
|
26380
26053
|
setSelectedMedia(null);
|
|
26381
26054
|
queueSectionKeyDrop(prev);
|
|
26382
26055
|
}, [queueSectionKeyDrop]);
|
|
26383
|
-
const clearMediaSelectionRef = (0,
|
|
26056
|
+
const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
|
|
26384
26057
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
26385
|
-
const clearIconSelection = (0,
|
|
26058
|
+
const clearIconSelection = (0, import_react23.useCallback)(() => {
|
|
26386
26059
|
const prev = selectedIconElRef.current;
|
|
26387
26060
|
if (!prev) return;
|
|
26388
26061
|
selectedIconElRef.current = null;
|
|
26389
26062
|
queueSectionKeyDrop(prev);
|
|
26390
26063
|
}, [queueSectionKeyDrop]);
|
|
26391
|
-
const clearIconSelectionRef = (0,
|
|
26064
|
+
const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
|
|
26392
26065
|
clearIconSelectionRef.current = clearIconSelection;
|
|
26393
|
-
const clearSocialSelection = (0,
|
|
26066
|
+
const clearSocialSelection = (0, import_react23.useCallback)(() => {
|
|
26394
26067
|
const prev = selectedSocialElRef.current;
|
|
26395
26068
|
if (!prev) return;
|
|
26396
26069
|
selectedSocialElRef.current = null;
|
|
26397
26070
|
queueSectionKeyDrop(prev);
|
|
26398
26071
|
}, [queueSectionKeyDrop]);
|
|
26399
|
-
const clearSocialSelectionRef = (0,
|
|
26072
|
+
const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
|
|
26400
26073
|
clearSocialSelectionRef.current = clearSocialSelection;
|
|
26401
|
-
const selectIconElement = (0,
|
|
26074
|
+
const selectIconElement = (0, import_react23.useCallback)((el) => {
|
|
26402
26075
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26403
26076
|
selectedIconElRef.current = el;
|
|
26404
26077
|
const sectionEl = el.closest("[data-ohw-section]");
|
|
@@ -26411,9 +26084,9 @@ function OhhwellsBridge() {
|
|
|
26411
26084
|
keyLabel: "Icon"
|
|
26412
26085
|
});
|
|
26413
26086
|
}, []);
|
|
26414
|
-
const selectIconElementRef = (0,
|
|
26087
|
+
const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
|
|
26415
26088
|
selectIconElementRef.current = selectIconElement;
|
|
26416
|
-
const selectMediaElement = (0,
|
|
26089
|
+
const selectMediaElement = (0, import_react23.useCallback)((el) => {
|
|
26417
26090
|
const r2 = el.getBoundingClientRect();
|
|
26418
26091
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
26419
26092
|
selectedIconElRef.current = null;
|
|
@@ -26438,9 +26111,9 @@ function OhhwellsBridge() {
|
|
|
26438
26111
|
keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
|
|
26439
26112
|
});
|
|
26440
26113
|
}, []);
|
|
26441
|
-
const selectMediaElementRef = (0,
|
|
26114
|
+
const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
|
|
26442
26115
|
selectMediaElementRef.current = selectMediaElement;
|
|
26443
|
-
(0,
|
|
26116
|
+
(0, import_react23.useEffect)(() => {
|
|
26444
26117
|
if (!selectedMedia) return;
|
|
26445
26118
|
const update = () => {
|
|
26446
26119
|
const el = selectedMediaElRef.current;
|
|
@@ -26460,54 +26133,54 @@ function OhhwellsBridge() {
|
|
|
26460
26133
|
window.removeEventListener("resize", update);
|
|
26461
26134
|
};
|
|
26462
26135
|
}, [selectedMedia !== null]);
|
|
26463
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
26464
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
26465
|
-
const hoveredGapRef = (0,
|
|
26466
|
-
const imageUnhoverTimerRef = (0,
|
|
26467
|
-
const imageShowTimerRef = (0,
|
|
26468
|
-
const editStylesRef = (0,
|
|
26469
|
-
const activateRef = (0,
|
|
26136
|
+
const [carouselHover, setCarouselHover] = (0, import_react23.useState)(null);
|
|
26137
|
+
const [uploadingRects, setUploadingRects] = (0, import_react23.useState)({});
|
|
26138
|
+
const hoveredGapRef = (0, import_react23.useRef)(null);
|
|
26139
|
+
const imageUnhoverTimerRef = (0, import_react23.useRef)(null);
|
|
26140
|
+
const imageShowTimerRef = (0, import_react23.useRef)(null);
|
|
26141
|
+
const editStylesRef = (0, import_react23.useRef)(null);
|
|
26142
|
+
const activateRef = (0, import_react23.useRef)(() => {
|
|
26470
26143
|
});
|
|
26471
|
-
const deactivateRef = (0,
|
|
26144
|
+
const deactivateRef = (0, import_react23.useRef)(() => {
|
|
26472
26145
|
});
|
|
26473
|
-
const selectRef = (0,
|
|
26146
|
+
const selectRef = (0, import_react23.useRef)(() => {
|
|
26474
26147
|
});
|
|
26475
|
-
const selectFrameRef = (0,
|
|
26148
|
+
const selectFrameRef = (0, import_react23.useRef)(() => {
|
|
26476
26149
|
});
|
|
26477
|
-
const selectLogoRef = (0,
|
|
26150
|
+
const selectLogoRef = (0, import_react23.useRef)(() => {
|
|
26478
26151
|
});
|
|
26479
|
-
const openLogoSizePanelRef = (0,
|
|
26152
|
+
const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
|
|
26480
26153
|
});
|
|
26481
|
-
const deselectRef = (0,
|
|
26154
|
+
const deselectRef = (0, import_react23.useRef)(() => {
|
|
26482
26155
|
});
|
|
26483
|
-
const closeFloatingPanelOnlyRef = (0,
|
|
26156
|
+
const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
|
|
26484
26157
|
});
|
|
26485
|
-
const reselectNavigationItemRef = (0,
|
|
26158
|
+
const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
|
|
26486
26159
|
});
|
|
26487
|
-
const commitNavigationTextEditRef = (0,
|
|
26160
|
+
const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
|
|
26488
26161
|
});
|
|
26489
|
-
const handleDeleteSelectedRef = (0,
|
|
26490
|
-
const runPendingDeleteUndoRef = (0,
|
|
26491
|
-
const isFooterFrameSelectionRef = (0,
|
|
26492
|
-
const refreshActiveCommandsRef = (0,
|
|
26162
|
+
const handleDeleteSelectedRef = (0, import_react23.useRef)(() => false);
|
|
26163
|
+
const runPendingDeleteUndoRef = (0, import_react23.useRef)(() => false);
|
|
26164
|
+
const isFooterFrameSelectionRef = (0, import_react23.useRef)(false);
|
|
26165
|
+
const refreshActiveCommandsRef = (0, import_react23.useRef)(() => {
|
|
26493
26166
|
});
|
|
26494
|
-
const postToParentRef = (0,
|
|
26167
|
+
const postToParentRef = (0, import_react23.useRef)(postToParent2);
|
|
26495
26168
|
postToParentRef.current = postToParent2;
|
|
26496
|
-
const aiSectionApiRef = (0,
|
|
26497
|
-
const sectionsLoadedRef = (0,
|
|
26498
|
-
const pendingScheduleConfigRequests = (0,
|
|
26499
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
26500
|
-
const [formPickRect, setFormPickRect] = (0,
|
|
26501
|
-
const formPickElRef = (0,
|
|
26502
|
-
const [formViewState, setFormViewStateUi] = (0,
|
|
26503
|
-
const [formPickCount, setFormPickCount] = (0,
|
|
26504
|
-
const [formHoverRect, setFormHoverRect] = (0,
|
|
26505
|
-
const formHoverElRef = (0,
|
|
26506
|
-
const [fieldPickRect, setFieldPickRect] = (0,
|
|
26507
|
-
const fieldPickElRef = (0,
|
|
26508
|
-
const [fieldPickState, setFieldPickState] = (0,
|
|
26509
|
-
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0,
|
|
26510
|
-
const clearFormPick = (0,
|
|
26169
|
+
const aiSectionApiRef = (0, import_react23.useRef)(null);
|
|
26170
|
+
const sectionsLoadedRef = (0, import_react23.useRef)(false);
|
|
26171
|
+
const pendingScheduleConfigRequests = (0, import_react23.useRef)([]);
|
|
26172
|
+
const [toolbarRect, setToolbarRect] = (0, import_react23.useState)(null);
|
|
26173
|
+
const [formPickRect, setFormPickRect] = (0, import_react23.useState)(null);
|
|
26174
|
+
const formPickElRef = (0, import_react23.useRef)(null);
|
|
26175
|
+
const [formViewState, setFormViewStateUi] = (0, import_react23.useState)("default");
|
|
26176
|
+
const [formPickCount, setFormPickCount] = (0, import_react23.useState)(null);
|
|
26177
|
+
const [formHoverRect, setFormHoverRect] = (0, import_react23.useState)(null);
|
|
26178
|
+
const formHoverElRef = (0, import_react23.useRef)(null);
|
|
26179
|
+
const [fieldPickRect, setFieldPickRect] = (0, import_react23.useState)(null);
|
|
26180
|
+
const fieldPickElRef = (0, import_react23.useRef)(null);
|
|
26181
|
+
const [fieldPickState, setFieldPickState] = (0, import_react23.useState)(null);
|
|
26182
|
+
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react23.useState)(false);
|
|
26183
|
+
const clearFormPick = (0, import_react23.useCallback)(() => {
|
|
26511
26184
|
const form = formPickElRef.current;
|
|
26512
26185
|
const editing = fieldPickElRef.current;
|
|
26513
26186
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
@@ -26527,7 +26200,7 @@ function OhhwellsBridge() {
|
|
|
26527
26200
|
formPickElRef.current = null;
|
|
26528
26201
|
setFormPickRect(null);
|
|
26529
26202
|
}, []);
|
|
26530
|
-
const clearFieldPick = (0,
|
|
26203
|
+
const clearFieldPick = (0, import_react23.useCallback)(() => {
|
|
26531
26204
|
const wrapper = fieldPickElRef.current;
|
|
26532
26205
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
26533
26206
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
@@ -26537,9 +26210,9 @@ function OhhwellsBridge() {
|
|
|
26537
26210
|
setFieldPickRect(null);
|
|
26538
26211
|
setFieldPickState(null);
|
|
26539
26212
|
}, []);
|
|
26540
|
-
const persistFieldsRef = (0,
|
|
26213
|
+
const persistFieldsRef = (0, import_react23.useRef)(() => {
|
|
26541
26214
|
});
|
|
26542
|
-
const persistFields = (0,
|
|
26215
|
+
const persistFields = (0, import_react23.useCallback)(
|
|
26543
26216
|
(form) => {
|
|
26544
26217
|
const key = formKeyOf(form);
|
|
26545
26218
|
if (!key) return;
|
|
@@ -26550,7 +26223,7 @@ function OhhwellsBridge() {
|
|
|
26550
26223
|
[]
|
|
26551
26224
|
);
|
|
26552
26225
|
persistFieldsRef.current = persistFields;
|
|
26553
|
-
const selectField = (0,
|
|
26226
|
+
const selectField = (0, import_react23.useCallback)((wrapper) => {
|
|
26554
26227
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
26555
26228
|
commitPlaceholderEdit(fieldPickElRef.current);
|
|
26556
26229
|
}
|
|
@@ -26563,7 +26236,7 @@ function OhhwellsBridge() {
|
|
|
26563
26236
|
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
26564
26237
|
setFieldTypePickerOpen(false);
|
|
26565
26238
|
}, []);
|
|
26566
|
-
const withSelectedField = (0,
|
|
26239
|
+
const withSelectedField = (0, import_react23.useCallback)(
|
|
26567
26240
|
(run) => {
|
|
26568
26241
|
const wrapper = fieldPickElRef.current;
|
|
26569
26242
|
const form = formPickElRef.current;
|
|
@@ -26576,28 +26249,28 @@ function OhhwellsBridge() {
|
|
|
26576
26249
|
},
|
|
26577
26250
|
[persistFields]
|
|
26578
26251
|
);
|
|
26579
|
-
const handleFieldTypeChange = (0,
|
|
26252
|
+
const handleFieldTypeChange = (0, import_react23.useCallback)(
|
|
26580
26253
|
(type) => withSelectedField((_form, wrapper) => {
|
|
26581
26254
|
applyFieldType(wrapper, type);
|
|
26582
26255
|
selectField(wrapper);
|
|
26583
26256
|
}),
|
|
26584
26257
|
[selectField, withSelectedField]
|
|
26585
26258
|
);
|
|
26586
|
-
const handleFieldRequiredToggle = (0,
|
|
26259
|
+
const handleFieldRequiredToggle = (0, import_react23.useCallback)(
|
|
26587
26260
|
() => withSelectedField((_form, wrapper) => {
|
|
26588
26261
|
setFieldRequired(wrapper, !isFieldRequired(wrapper));
|
|
26589
26262
|
selectField(wrapper);
|
|
26590
26263
|
}),
|
|
26591
26264
|
[selectField, withSelectedField]
|
|
26592
26265
|
);
|
|
26593
|
-
const handleFieldDuplicate = (0,
|
|
26266
|
+
const handleFieldDuplicate = (0, import_react23.useCallback)(
|
|
26594
26267
|
() => withSelectedField((form, wrapper) => {
|
|
26595
26268
|
const copy = duplicateField(form, wrapper);
|
|
26596
26269
|
selectField(copy);
|
|
26597
26270
|
}),
|
|
26598
26271
|
[selectField, withSelectedField]
|
|
26599
26272
|
);
|
|
26600
|
-
const handleFieldDelete = (0,
|
|
26273
|
+
const handleFieldDelete = (0, import_react23.useCallback)(
|
|
26601
26274
|
() => withSelectedField((_form, wrapper) => {
|
|
26602
26275
|
removeField(wrapper);
|
|
26603
26276
|
clearFieldPick();
|
|
@@ -26605,7 +26278,7 @@ function OhhwellsBridge() {
|
|
|
26605
26278
|
}),
|
|
26606
26279
|
[clearFieldPick, withSelectedField]
|
|
26607
26280
|
);
|
|
26608
|
-
const handleAddField = (0,
|
|
26281
|
+
const handleAddField = (0, import_react23.useCallback)(
|
|
26609
26282
|
(type) => {
|
|
26610
26283
|
const form = formPickElRef.current;
|
|
26611
26284
|
if (!form) return;
|
|
@@ -26621,8 +26294,8 @@ function OhhwellsBridge() {
|
|
|
26621
26294
|
},
|
|
26622
26295
|
[persistFields, selectField]
|
|
26623
26296
|
);
|
|
26624
|
-
const fieldDragRef = (0,
|
|
26625
|
-
const buildFieldDropSlots = (0,
|
|
26297
|
+
const fieldDragRef = (0, import_react23.useRef)(null);
|
|
26298
|
+
const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
|
|
26626
26299
|
const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
|
|
26627
26300
|
const slots = others.map((el) => {
|
|
26628
26301
|
const rect = el.getBoundingClientRect();
|
|
@@ -26635,7 +26308,7 @@ function OhhwellsBridge() {
|
|
|
26635
26308
|
}
|
|
26636
26309
|
return slots;
|
|
26637
26310
|
}, []);
|
|
26638
|
-
const handleFieldDragStart = (0,
|
|
26311
|
+
const handleFieldDragStart = (0, import_react23.useCallback)(() => {
|
|
26639
26312
|
const wrapper = fieldPickElRef.current;
|
|
26640
26313
|
const form = formPickElRef.current;
|
|
26641
26314
|
if (!wrapper || !form) return;
|
|
@@ -26644,18 +26317,18 @@ function OhhwellsBridge() {
|
|
|
26644
26317
|
setFieldDragging(true);
|
|
26645
26318
|
setFieldDropSlots(buildFieldDropSlots(form, key));
|
|
26646
26319
|
}, [buildFieldDropSlots]);
|
|
26647
|
-
const handleFieldDragEnd = (0,
|
|
26320
|
+
const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
|
|
26648
26321
|
fieldDragRef.current = null;
|
|
26649
26322
|
setFieldDropIndex(null);
|
|
26650
26323
|
setFieldDropSlots([]);
|
|
26651
26324
|
setFieldDragging(false);
|
|
26652
26325
|
}, []);
|
|
26653
|
-
const [fieldDropIndex, setFieldDropIndex] = (0,
|
|
26654
|
-
const [fieldDropSlots, setFieldDropSlots] = (0,
|
|
26655
|
-
const [fieldDragging, setFieldDragging] = (0,
|
|
26656
|
-
const clearFormPickRef = (0,
|
|
26326
|
+
const [fieldDropIndex, setFieldDropIndex] = (0, import_react23.useState)(null);
|
|
26327
|
+
const [fieldDropSlots, setFieldDropSlots] = (0, import_react23.useState)([]);
|
|
26328
|
+
const [fieldDragging, setFieldDragging] = (0, import_react23.useState)(false);
|
|
26329
|
+
const clearFormPickRef = (0, import_react23.useRef)(clearFormPick);
|
|
26657
26330
|
clearFormPickRef.current = clearFormPick;
|
|
26658
|
-
(0,
|
|
26331
|
+
(0, import_react23.useEffect)(() => {
|
|
26659
26332
|
const el = fieldPickElRef.current;
|
|
26660
26333
|
if (!el || fieldPickRect === null) return;
|
|
26661
26334
|
const observer = new ResizeObserver(() => {
|
|
@@ -26664,7 +26337,7 @@ function OhhwellsBridge() {
|
|
|
26664
26337
|
observer.observe(el);
|
|
26665
26338
|
return () => observer.disconnect();
|
|
26666
26339
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26667
|
-
(0,
|
|
26340
|
+
(0, import_react23.useEffect)(() => {
|
|
26668
26341
|
const el = formPickElRef.current;
|
|
26669
26342
|
if (!el || formPickRect === null) return;
|
|
26670
26343
|
const observer = new ResizeObserver(() => {
|
|
@@ -26673,25 +26346,25 @@ function OhhwellsBridge() {
|
|
|
26673
26346
|
observer.observe(el);
|
|
26674
26347
|
return () => observer.disconnect();
|
|
26675
26348
|
}, [formPickRect !== null, formViewState]);
|
|
26676
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
26677
|
-
const toolbarVariantRef = (0,
|
|
26349
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
|
|
26350
|
+
const toolbarVariantRef = (0, import_react23.useRef)("none");
|
|
26678
26351
|
toolbarVariantRef.current = toolbarVariant;
|
|
26679
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
26680
|
-
const [selectedIsSocial, setSelectedIsSocial] = (0,
|
|
26681
|
-
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0,
|
|
26682
|
-
const [reorderHrefKey, setReorderHrefKey] = (0,
|
|
26683
|
-
const [reorderDragDisabled, setReorderDragDisabled] = (0,
|
|
26684
|
-
const [toggleState, setToggleState] = (0,
|
|
26685
|
-
const [maxBadge, setMaxBadge] = (0,
|
|
26686
|
-
const [activeCommands, setActiveCommands] = (0,
|
|
26687
|
-
const [sectionGap, setSectionGap] = (0,
|
|
26688
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] = (0,
|
|
26689
|
-
const hoveredNavContainerRef = (0,
|
|
26690
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0,
|
|
26691
|
-
const hoveredItemElRef = (0,
|
|
26692
|
-
const [hoveredItemRect, setHoveredItemRect] = (0,
|
|
26693
|
-
const [hoveredTextRect, setHoveredTextRect] = (0,
|
|
26694
|
-
(0,
|
|
26352
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react23.useState)(false);
|
|
26353
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react23.useState)(false);
|
|
26354
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react23.useState)(false);
|
|
26355
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react23.useState)(null);
|
|
26356
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react23.useState)(false);
|
|
26357
|
+
const [toggleState, setToggleState] = (0, import_react23.useState)(null);
|
|
26358
|
+
const [maxBadge, setMaxBadge] = (0, import_react23.useState)(null);
|
|
26359
|
+
const [activeCommands, setActiveCommands] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
|
|
26360
|
+
const [sectionGap, setSectionGap] = (0, import_react23.useState)(null);
|
|
26361
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react23.useState)(false);
|
|
26362
|
+
const hoveredNavContainerRef = (0, import_react23.useRef)(null);
|
|
26363
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react23.useState)(null);
|
|
26364
|
+
const hoveredItemElRef = (0, import_react23.useRef)(null);
|
|
26365
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react23.useState)(null);
|
|
26366
|
+
const [hoveredTextRect, setHoveredTextRect] = (0, import_react23.useState)(null);
|
|
26367
|
+
(0, import_react23.useEffect)(() => {
|
|
26695
26368
|
const sync = () => {
|
|
26696
26369
|
const el = document.querySelector(
|
|
26697
26370
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26735,75 +26408,63 @@ function OhhwellsBridge() {
|
|
|
26735
26408
|
});
|
|
26736
26409
|
return () => observer.disconnect();
|
|
26737
26410
|
}, []);
|
|
26738
|
-
const siblingHintElRef = (0,
|
|
26739
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
26740
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
26741
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
26742
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
26411
|
+
const siblingHintElRef = (0, import_react23.useRef)(null);
|
|
26412
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react23.useState)(null);
|
|
26413
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react23.useState)([]);
|
|
26414
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react23.useState)(false);
|
|
26415
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react23.useState)(false);
|
|
26743
26416
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26744
|
-
const [
|
|
26745
|
-
const
|
|
26746
|
-
|
|
26747
|
-
const
|
|
26748
|
-
|
|
26749
|
-
const [
|
|
26750
|
-
const
|
|
26751
|
-
const
|
|
26752
|
-
const
|
|
26753
|
-
const [
|
|
26754
|
-
const
|
|
26755
|
-
const
|
|
26756
|
-
const
|
|
26757
|
-
|
|
26758
|
-
const
|
|
26759
|
-
const
|
|
26760
|
-
const
|
|
26417
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
|
|
26418
|
+
const floatingPanelOpenRef = (0, import_react23.useRef)(false);
|
|
26419
|
+
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26420
|
+
const floatingPanelRef = (0, import_react23.useRef)(null);
|
|
26421
|
+
floatingPanelRef.current = floatingPanel;
|
|
26422
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react23.useState)(null);
|
|
26423
|
+
const buttonCollectionDragRef = (0, import_react23.useRef)(null);
|
|
26424
|
+
const buttonDropInsertIndexRef = (0, import_react23.useRef)(null);
|
|
26425
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react23.useState)([]);
|
|
26426
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react23.useState)(null);
|
|
26427
|
+
const buttonPointerDragRef = (0, import_react23.useRef)(null);
|
|
26428
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react23.useState)(0);
|
|
26429
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react23.useState)(null);
|
|
26430
|
+
const [editorViewport, setEditorViewport] = (0, import_react23.useState)("desktop");
|
|
26431
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react23.useState)(null);
|
|
26432
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react23.useState)(null);
|
|
26433
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react23.useState)(null);
|
|
26434
|
+
const footerDragRef = (0, import_react23.useRef)(null);
|
|
26435
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react23.useState)([]);
|
|
26436
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react23.useState)(null);
|
|
26437
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react23.useState)(null);
|
|
26438
|
+
const footerPointerDragRef = (0, import_react23.useRef)(null);
|
|
26439
|
+
const suppressNextClickRef = (0, import_react23.useRef)(false);
|
|
26440
|
+
const suppressClickUntilRef = (0, import_react23.useRef)(0);
|
|
26441
|
+
const [linkPopover, setLinkPopover] = (0, import_react23.useState)(null);
|
|
26442
|
+
const linkPopoverSessionRef = (0, import_react23.useRef)(null);
|
|
26443
|
+
const addNavAfterAnchorRef = (0, import_react23.useRef)(null);
|
|
26444
|
+
const editContentRef = (0, import_react23.useRef)({});
|
|
26445
|
+
const aiSectionsRef = (0, import_react23.useRef)("");
|
|
26446
|
+
const aiFooterRef = (0, import_react23.useRef)("");
|
|
26447
|
+
const applyTreeLocalRef = (0, import_react23.useRef)(
|
|
26761
26448
|
null
|
|
26762
26449
|
);
|
|
26763
|
-
const applyFooterTreeLocalRef = (0,
|
|
26764
|
-
const clearInteractionChromeRef = (0,
|
|
26450
|
+
const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
|
|
26451
|
+
const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
|
|
26765
26452
|
});
|
|
26766
|
-
const brandKitRef = (0,
|
|
26767
|
-
const stylesRef = (0,
|
|
26768
|
-
const appliedDrawerRef = (0,
|
|
26769
|
-
const pendingDeleteUndoRef = (0,
|
|
26770
|
-
const [
|
|
26771
|
-
const
|
|
26772
|
-
const
|
|
26773
|
-
|
|
26774
|
-
const
|
|
26775
|
-
const
|
|
26776
|
-
const
|
|
26777
|
-
const
|
|
26778
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
|
|
26779
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
|
|
26780
|
-
const buttonPointerDragRef = (0, import_react24.useRef)(null);
|
|
26781
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
|
|
26782
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
|
|
26783
|
-
const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
|
|
26784
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
|
|
26785
|
-
const [sitePages, setSitePages] = (0, import_react24.useState)([]);
|
|
26786
|
-
const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26787
|
-
const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
|
|
26788
|
-
const sectionsPrefetchGenRef = (0, import_react24.useRef)(0);
|
|
26789
|
-
const setLinkPopoverRef = (0, import_react24.useRef)(setLinkPopover);
|
|
26790
|
-
const linkPopoverPanelRef = (0, import_react24.useRef)(null);
|
|
26791
|
-
const linkPopoverOpenRef = (0, import_react24.useRef)(false);
|
|
26792
|
-
const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
|
|
26453
|
+
const brandKitRef = (0, import_react23.useRef)("");
|
|
26454
|
+
const stylesRef = (0, import_react23.useRef)("");
|
|
26455
|
+
const appliedDrawerRef = (0, import_react23.useRef)(null);
|
|
26456
|
+
const pendingDeleteUndoRef = (0, import_react23.useRef)(null);
|
|
26457
|
+
const [sitePages, setSitePages] = (0, import_react23.useState)([]);
|
|
26458
|
+
const collectionItemsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
|
|
26459
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react23.useState)({});
|
|
26460
|
+
const sectionsPrefetchGenRef = (0, import_react23.useRef)(0);
|
|
26461
|
+
const setLinkPopoverRef = (0, import_react23.useRef)(setLinkPopover);
|
|
26462
|
+
const linkPopoverPanelRef = (0, import_react23.useRef)(null);
|
|
26463
|
+
const linkPopoverOpenRef = (0, import_react23.useRef)(false);
|
|
26464
|
+
const linkPopoverGraceUntilRef = (0, import_react23.useRef)(0);
|
|
26793
26465
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26794
|
-
setFloatingPanelRef.current = setFloatingPanel;
|
|
26795
26466
|
linkPopoverSessionRef.current = linkPopover;
|
|
26796
|
-
|
|
26797
|
-
(0, import_react24.useEffect)(() => {
|
|
26798
|
-
const syncViewport = () => {
|
|
26799
|
-
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26800
|
-
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26801
|
-
};
|
|
26802
|
-
syncViewport();
|
|
26803
|
-
window.addEventListener("resize", syncViewport);
|
|
26804
|
-
return () => window.removeEventListener("resize", syncViewport);
|
|
26805
|
-
}, []);
|
|
26806
|
-
(0, import_react24.useEffect)(() => {
|
|
26467
|
+
(0, import_react23.useEffect)(() => {
|
|
26807
26468
|
setSectionOrderPersistHandler((entries) => {
|
|
26808
26469
|
const currentPath = window.location.pathname;
|
|
26809
26470
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26813,7 +26474,7 @@ function OhhwellsBridge() {
|
|
|
26813
26474
|
});
|
|
26814
26475
|
return () => setSectionOrderPersistHandler(null);
|
|
26815
26476
|
}, []);
|
|
26816
|
-
(0,
|
|
26477
|
+
(0, import_react23.useEffect)(() => {
|
|
26817
26478
|
setAiFooterMountOptions({
|
|
26818
26479
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26819
26480
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26876,7 +26537,7 @@ function OhhwellsBridge() {
|
|
|
26876
26537
|
const bumpLinkPopoverGrace = () => {
|
|
26877
26538
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
26878
26539
|
};
|
|
26879
|
-
const runSectionsPrefetch = (0,
|
|
26540
|
+
const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
|
|
26880
26541
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
26881
26542
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
26882
26543
|
const paths = pages.map((p) => p.path);
|
|
@@ -26895,9 +26556,9 @@ function OhhwellsBridge() {
|
|
|
26895
26556
|
);
|
|
26896
26557
|
});
|
|
26897
26558
|
}, [isEditMode, pathname]);
|
|
26898
|
-
const runSectionsPrefetchRef = (0,
|
|
26559
|
+
const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
|
|
26899
26560
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26900
|
-
(0,
|
|
26561
|
+
(0, import_react23.useEffect)(() => {
|
|
26901
26562
|
if (!linkPopover) {
|
|
26902
26563
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26903
26564
|
return;
|
|
@@ -26925,7 +26586,7 @@ function OhhwellsBridge() {
|
|
|
26925
26586
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26926
26587
|
};
|
|
26927
26588
|
}, [linkPopover, postToParent2]);
|
|
26928
|
-
(0,
|
|
26589
|
+
(0, import_react23.useEffect)(() => {
|
|
26929
26590
|
if (!isEditMode) return;
|
|
26930
26591
|
const useFixtures = shouldUseDevFixtures();
|
|
26931
26592
|
if (useFixtures) {
|
|
@@ -26951,7 +26612,7 @@ function OhhwellsBridge() {
|
|
|
26951
26612
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26952
26613
|
return () => window.removeEventListener("message", onSitePages);
|
|
26953
26614
|
}, [isEditMode, postToParent2]);
|
|
26954
|
-
(0,
|
|
26615
|
+
(0, import_react23.useEffect)(() => {
|
|
26955
26616
|
if (!isEditMode) return;
|
|
26956
26617
|
const deps = {
|
|
26957
26618
|
getEditContent: () => editContentRef.current,
|
|
@@ -26988,14 +26649,14 @@ function OhhwellsBridge() {
|
|
|
26988
26649
|
window.addEventListener("message", onPageMessage);
|
|
26989
26650
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26990
26651
|
}, [isEditMode, postToParent2]);
|
|
26991
|
-
(0,
|
|
26652
|
+
(0, import_react23.useEffect)(() => {
|
|
26992
26653
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26993
26654
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26994
26655
|
if (Object.keys(manifest).length === 0) return;
|
|
26995
26656
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26996
26657
|
});
|
|
26997
26658
|
}, [isEditMode]);
|
|
26998
|
-
(0,
|
|
26659
|
+
(0, import_react23.useEffect)(() => {
|
|
26999
26660
|
const update = () => {
|
|
27000
26661
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
27001
26662
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27019,10 +26680,10 @@ function OhhwellsBridge() {
|
|
|
27019
26680
|
vvp.removeEventListener("resize", update);
|
|
27020
26681
|
};
|
|
27021
26682
|
}, []);
|
|
27022
|
-
const refreshStateRules = (0,
|
|
26683
|
+
const refreshStateRules = (0, import_react23.useCallback)(() => {
|
|
27023
26684
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
27024
26685
|
}, []);
|
|
27025
|
-
const processConfigRequest = (0,
|
|
26686
|
+
const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
|
|
27026
26687
|
const tracker = getSectionsTracker();
|
|
27027
26688
|
let entries = [];
|
|
27028
26689
|
try {
|
|
@@ -27045,7 +26706,7 @@ function OhhwellsBridge() {
|
|
|
27045
26706
|
}
|
|
27046
26707
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
27047
26708
|
}, [isEditMode]);
|
|
27048
|
-
const deactivate = (0,
|
|
26709
|
+
const deactivate = (0, import_react23.useCallback)(() => {
|
|
27049
26710
|
const el = activeElRef.current;
|
|
27050
26711
|
if (!el) return;
|
|
27051
26712
|
const isFormBlock = el.dataset.ohwEditable === "form";
|
|
@@ -27111,12 +26772,12 @@ function OhhwellsBridge() {
|
|
|
27111
26772
|
setToolbarShowEditLink(false);
|
|
27112
26773
|
postToParent2({ type: "ow:exit-edit" });
|
|
27113
26774
|
}, [postToParent2]);
|
|
27114
|
-
const clearSelectedAttr = (0,
|
|
26775
|
+
const clearSelectedAttr = (0, import_react23.useCallback)(() => {
|
|
27115
26776
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
27116
26777
|
el.removeAttribute("data-ohw-selected");
|
|
27117
26778
|
});
|
|
27118
26779
|
}, []);
|
|
27119
|
-
const deselect = (0,
|
|
26780
|
+
const deselect = (0, import_react23.useCallback)(() => {
|
|
27120
26781
|
const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
|
|
27121
26782
|
clearSelectedAttr();
|
|
27122
26783
|
selectedElRef.current = null;
|
|
@@ -27152,20 +26813,20 @@ function OhhwellsBridge() {
|
|
|
27152
26813
|
setToolbarVariant("none");
|
|
27153
26814
|
}
|
|
27154
26815
|
}, [clearSelectedAttr]);
|
|
27155
|
-
const markSelected = (0,
|
|
26816
|
+
const markSelected = (0, import_react23.useCallback)((el) => {
|
|
27156
26817
|
clearSelectedAttr();
|
|
27157
26818
|
el.removeAttribute("data-ohw-hovered");
|
|
27158
26819
|
el.setAttribute("data-ohw-selected", "");
|
|
27159
26820
|
}, [clearSelectedAttr]);
|
|
27160
|
-
const isSelectedForHover = (0,
|
|
26821
|
+
const isSelectedForHover = (0, import_react23.useCallback)((el) => {
|
|
27161
26822
|
if (!el) return false;
|
|
27162
26823
|
return [selectedElRef.current, activeElRef.current].some(
|
|
27163
26824
|
(busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
|
|
27164
26825
|
);
|
|
27165
26826
|
}, []);
|
|
27166
|
-
const isSelectedForHoverRef = (0,
|
|
26827
|
+
const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
|
|
27167
26828
|
isSelectedForHoverRef.current = isSelectedForHover;
|
|
27168
|
-
const resolveHrefKeyElement = (0,
|
|
26829
|
+
const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
|
|
27169
26830
|
if (isFooterHrefKey(hrefKey)) {
|
|
27170
26831
|
return document.querySelector(
|
|
27171
26832
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -27180,7 +26841,7 @@ function OhhwellsBridge() {
|
|
|
27180
26841
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
27181
26842
|
);
|
|
27182
26843
|
}, []);
|
|
27183
|
-
const resyncSelectedNavigationItem = (0,
|
|
26844
|
+
const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
|
|
27184
26845
|
const hrefKey = selectedHrefKeyRef.current;
|
|
27185
26846
|
if (hrefKey) {
|
|
27186
26847
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -27218,7 +26879,7 @@ function OhhwellsBridge() {
|
|
|
27218
26879
|
);
|
|
27219
26880
|
}
|
|
27220
26881
|
}, [resolveHrefKeyElement]);
|
|
27221
|
-
const reselectNavigationItem = (0,
|
|
26882
|
+
const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
|
|
27222
26883
|
selectedElRef.current = navAnchor;
|
|
27223
26884
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
27224
26885
|
selectedFooterColAttrRef.current = null;
|
|
@@ -27249,7 +26910,7 @@ function OhhwellsBridge() {
|
|
|
27249
26910
|
setToolbarShowEditLink(false);
|
|
27250
26911
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27251
26912
|
}, [markSelected]);
|
|
27252
|
-
const commitNavigationTextEdit = (0,
|
|
26913
|
+
const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
|
|
27253
26914
|
const el = activeElRef.current;
|
|
27254
26915
|
if (!el) return;
|
|
27255
26916
|
const key = el.dataset.ohwKey;
|
|
@@ -27282,7 +26943,7 @@ function OhhwellsBridge() {
|
|
|
27282
26943
|
postToParent2({ type: "ow:exit-edit" });
|
|
27283
26944
|
reselectNavigationItem(navAnchor);
|
|
27284
26945
|
}, [postToParent2, reselectNavigationItem]);
|
|
27285
|
-
const handleAddTopLevelNavItem = (0,
|
|
26946
|
+
const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
|
|
27286
26947
|
const items = listNavbarRootItems();
|
|
27287
26948
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
27288
26949
|
deselectRef.current();
|
|
@@ -27294,7 +26955,7 @@ function OhhwellsBridge() {
|
|
|
27294
26955
|
intent: "add-nav"
|
|
27295
26956
|
});
|
|
27296
26957
|
}, []);
|
|
27297
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
26958
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
|
|
27298
26959
|
(anchor) => {
|
|
27299
26960
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
27300
26961
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -27307,7 +26968,7 @@ function OhhwellsBridge() {
|
|
|
27307
26968
|
},
|
|
27308
26969
|
[postToParent2]
|
|
27309
26970
|
);
|
|
27310
|
-
const handleNavDropdownOpenChange = (0,
|
|
26971
|
+
const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
|
|
27311
26972
|
const selected = selectedElRef.current;
|
|
27312
26973
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
27313
26974
|
if (isNestedNavChild(selected)) return;
|
|
@@ -27323,7 +26984,7 @@ function OhhwellsBridge() {
|
|
|
27323
26984
|
}
|
|
27324
26985
|
});
|
|
27325
26986
|
}, []);
|
|
27326
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
26987
|
+
const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
|
|
27327
26988
|
(visible) => {
|
|
27328
26989
|
const selected = selectedElRef.current;
|
|
27329
26990
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -27376,7 +27037,7 @@ function OhhwellsBridge() {
|
|
|
27376
27037
|
},
|
|
27377
27038
|
[postToParent2]
|
|
27378
27039
|
);
|
|
27379
|
-
const enterEditOnNewItem = (0,
|
|
27040
|
+
const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
|
|
27380
27041
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
27381
27042
|
if (!label) {
|
|
27382
27043
|
selectRef.current(anchor);
|
|
@@ -27385,8 +27046,8 @@ function OhhwellsBridge() {
|
|
|
27385
27046
|
setNavGroupForceOpen(anchor, true);
|
|
27386
27047
|
activateRef.current(label);
|
|
27387
27048
|
}, []);
|
|
27388
|
-
const pendingSocialAddRef = (0,
|
|
27389
|
-
const handleAddChildItem = (0,
|
|
27049
|
+
const pendingSocialAddRef = (0, import_react23.useRef)(null);
|
|
27050
|
+
const handleAddChildItem = (0, import_react23.useCallback)(() => {
|
|
27390
27051
|
const selected = selectedElRef.current;
|
|
27391
27052
|
if (!selected) return;
|
|
27392
27053
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
@@ -27513,7 +27174,7 @@ function OhhwellsBridge() {
|
|
|
27513
27174
|
});
|
|
27514
27175
|
});
|
|
27515
27176
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
27516
|
-
const handleAddFooterColumn = (0,
|
|
27177
|
+
const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
|
|
27517
27178
|
if (document.querySelector("[data-ai-footer]")) {
|
|
27518
27179
|
const state = parseAiFooterState(aiFooterRef.current);
|
|
27519
27180
|
if (!state?.tree) return;
|
|
@@ -27569,7 +27230,7 @@ function OhhwellsBridge() {
|
|
|
27569
27230
|
selectRef.current(result.firstLink);
|
|
27570
27231
|
});
|
|
27571
27232
|
}, [postToParent2]);
|
|
27572
|
-
const clearFooterDragVisuals = (0,
|
|
27233
|
+
const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
|
|
27573
27234
|
footerDragRef.current = null;
|
|
27574
27235
|
setSiblingHintRects([]);
|
|
27575
27236
|
setFooterDropSlots([]);
|
|
@@ -27578,7 +27239,7 @@ function OhhwellsBridge() {
|
|
|
27578
27239
|
setIsItemDragging(false);
|
|
27579
27240
|
unlockFooterDragInteraction();
|
|
27580
27241
|
}, []);
|
|
27581
|
-
const refreshFooterDragVisuals = (0,
|
|
27242
|
+
const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
27582
27243
|
const dragged = session.draggedEl;
|
|
27583
27244
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
27584
27245
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -27610,13 +27271,13 @@ function OhhwellsBridge() {
|
|
|
27610
27271
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
27611
27272
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
27612
27273
|
}, []);
|
|
27613
|
-
const refreshFooterDragVisualsRef = (0,
|
|
27274
|
+
const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
|
|
27614
27275
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
27615
|
-
const commitFooterDragRef = (0,
|
|
27276
|
+
const commitFooterDragRef = (0, import_react23.useRef)(() => {
|
|
27616
27277
|
});
|
|
27617
|
-
const beginFooterDragRef = (0,
|
|
27278
|
+
const beginFooterDragRef = (0, import_react23.useRef)(() => {
|
|
27618
27279
|
});
|
|
27619
|
-
const beginFooterDrag = (0,
|
|
27280
|
+
const beginFooterDrag = (0, import_react23.useCallback)(
|
|
27620
27281
|
(session) => {
|
|
27621
27282
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
27622
27283
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -27636,7 +27297,7 @@ function OhhwellsBridge() {
|
|
|
27636
27297
|
[refreshFooterDragVisuals]
|
|
27637
27298
|
);
|
|
27638
27299
|
beginFooterDragRef.current = beginFooterDrag;
|
|
27639
|
-
const commitFooterDrag = (0,
|
|
27300
|
+
const commitFooterDrag = (0, import_react23.useCallback)(
|
|
27640
27301
|
(clientX, clientY) => {
|
|
27641
27302
|
const session = footerDragRef.current;
|
|
27642
27303
|
if (!session) {
|
|
@@ -27808,7 +27469,7 @@ function OhhwellsBridge() {
|
|
|
27808
27469
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
27809
27470
|
);
|
|
27810
27471
|
commitFooterDragRef.current = commitFooterDrag;
|
|
27811
|
-
const startFooterLinkDrag = (0,
|
|
27472
|
+
const startFooterLinkDrag = (0, import_react23.useCallback)(
|
|
27812
27473
|
(anchor, clientX, clientY, wasSelected) => {
|
|
27813
27474
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
27814
27475
|
if (!hrefKey) return false;
|
|
@@ -27844,7 +27505,7 @@ function OhhwellsBridge() {
|
|
|
27844
27505
|
},
|
|
27845
27506
|
[beginFooterDrag]
|
|
27846
27507
|
);
|
|
27847
|
-
const startFooterColumnDrag = (0,
|
|
27508
|
+
const startFooterColumnDrag = (0, import_react23.useCallback)(
|
|
27848
27509
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
27849
27510
|
const columns = listFooterColumns(columnEl);
|
|
27850
27511
|
const idx = columns.indexOf(columnEl);
|
|
@@ -27864,7 +27525,7 @@ function OhhwellsBridge() {
|
|
|
27864
27525
|
},
|
|
27865
27526
|
[beginFooterDrag]
|
|
27866
27527
|
);
|
|
27867
|
-
const persistButtonCollectionDrag = (0,
|
|
27528
|
+
const persistButtonCollectionDrag = (0, import_react23.useCallback)(
|
|
27868
27529
|
(button, clientX) => {
|
|
27869
27530
|
const insertIndex = buttonDropInsertIndexRef.current;
|
|
27870
27531
|
if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
|
|
@@ -27888,7 +27549,7 @@ function OhhwellsBridge() {
|
|
|
27888
27549
|
},
|
|
27889
27550
|
[postToParent2]
|
|
27890
27551
|
);
|
|
27891
|
-
const refreshButtonDragVisuals = (0,
|
|
27552
|
+
const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
|
|
27892
27553
|
const collection = buttonCollectionOf(button);
|
|
27893
27554
|
if (!collection) {
|
|
27894
27555
|
setButtonDropSlots([]);
|
|
@@ -27905,7 +27566,7 @@ function OhhwellsBridge() {
|
|
|
27905
27566
|
setDraggedItemRect(button.getBoundingClientRect());
|
|
27906
27567
|
if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
|
|
27907
27568
|
}, []);
|
|
27908
|
-
const handleItemDragStart = (0,
|
|
27569
|
+
const handleItemDragStart = (0, import_react23.useCallback)(
|
|
27909
27570
|
(e) => {
|
|
27910
27571
|
const selected = selectedElRef.current;
|
|
27911
27572
|
if (!selected) {
|
|
@@ -27936,7 +27597,7 @@ function OhhwellsBridge() {
|
|
|
27936
27597
|
},
|
|
27937
27598
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
|
|
27938
27599
|
);
|
|
27939
|
-
const handleItemDragEnd = (0,
|
|
27600
|
+
const handleItemDragEnd = (0, import_react23.useCallback)(
|
|
27940
27601
|
(e) => {
|
|
27941
27602
|
const collectionButton = buttonCollectionDragRef.current;
|
|
27942
27603
|
if (collectionButton) {
|
|
@@ -27967,7 +27628,7 @@ function OhhwellsBridge() {
|
|
|
27967
27628
|
},
|
|
27968
27629
|
[commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
|
|
27969
27630
|
);
|
|
27970
|
-
const handleItemChromePointerDown = (0,
|
|
27631
|
+
const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
|
|
27971
27632
|
if (e.button !== 0) return;
|
|
27972
27633
|
const selected = selectedElRef.current;
|
|
27973
27634
|
if (!selected) return;
|
|
@@ -28008,7 +27669,7 @@ function OhhwellsBridge() {
|
|
|
28008
27669
|
}
|
|
28009
27670
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
28010
27671
|
}, [armNavPressFromChrome]);
|
|
28011
|
-
const handleItemChromeClick = (0,
|
|
27672
|
+
const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
|
|
28012
27673
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
28013
27674
|
suppressNextClickRef.current = false;
|
|
28014
27675
|
return;
|
|
@@ -28021,7 +27682,7 @@ function OhhwellsBridge() {
|
|
|
28021
27682
|
}, []);
|
|
28022
27683
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
28023
27684
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
28024
|
-
const select = (0,
|
|
27685
|
+
const select = (0, import_react23.useCallback)((anchor) => {
|
|
28025
27686
|
if (!isNavigationItem2(anchor)) return;
|
|
28026
27687
|
if (activeElRef.current) deactivate();
|
|
28027
27688
|
clearSocialSelectionRef.current();
|
|
@@ -28098,7 +27759,7 @@ function OhhwellsBridge() {
|
|
|
28098
27759
|
setLogoSizeDraft(null);
|
|
28099
27760
|
}
|
|
28100
27761
|
}, [deactivate, markSelected]);
|
|
28101
|
-
const selectFrame = (0,
|
|
27762
|
+
const selectFrame = (0, import_react23.useCallback)((el) => {
|
|
28102
27763
|
if (!isNavigationContainer(el)) return;
|
|
28103
27764
|
if (activeElRef.current) deactivate();
|
|
28104
27765
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -28139,7 +27800,7 @@ function OhhwellsBridge() {
|
|
|
28139
27800
|
setFloatingPanelPos(null);
|
|
28140
27801
|
setLogoSizeDraft(null);
|
|
28141
27802
|
}, [deactivate, markSelected, postToParent2]);
|
|
28142
|
-
const selectLogo = (0,
|
|
27803
|
+
const selectLogo = (0, import_react23.useCallback)(
|
|
28143
27804
|
(logoEl) => {
|
|
28144
27805
|
if (activeElRef.current) deactivate();
|
|
28145
27806
|
selectedElRef.current = logoEl;
|
|
@@ -28168,7 +27829,7 @@ function OhhwellsBridge() {
|
|
|
28168
27829
|
},
|
|
28169
27830
|
[deactivate, markSelected]
|
|
28170
27831
|
);
|
|
28171
|
-
const openLogoSizePanel = (0,
|
|
27832
|
+
const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
|
|
28172
27833
|
const placement = getLogoPlacement(logoEl);
|
|
28173
27834
|
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
28174
27835
|
setLogoSizeDraft(draft);
|
|
@@ -28181,7 +27842,7 @@ function OhhwellsBridge() {
|
|
|
28181
27842
|
placement
|
|
28182
27843
|
});
|
|
28183
27844
|
}, []);
|
|
28184
|
-
const openSocialsDisplayPanel = (0,
|
|
27845
|
+
const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
|
|
28185
27846
|
setFloatingPanelPos(null);
|
|
28186
27847
|
setParentScrollSnap(parentScrollRef.current);
|
|
28187
27848
|
setFloatingPanel({
|
|
@@ -28192,7 +27853,7 @@ function OhhwellsBridge() {
|
|
|
28192
27853
|
row
|
|
28193
27854
|
});
|
|
28194
27855
|
}, []);
|
|
28195
|
-
const rememberButtonTokens = (0,
|
|
27856
|
+
const rememberButtonTokens = (0, import_react23.useCallback)(
|
|
28196
27857
|
(content, tokens, nodes) => {
|
|
28197
27858
|
if (nodes.length === 0) return content;
|
|
28198
27859
|
const next = { ...content };
|
|
@@ -28203,7 +27864,7 @@ function OhhwellsBridge() {
|
|
|
28203
27864
|
},
|
|
28204
27865
|
[postToParent2]
|
|
28205
27866
|
);
|
|
28206
|
-
const tokensForButton = (0,
|
|
27867
|
+
const tokensForButton = (0, import_react23.useCallback)(
|
|
28207
27868
|
(el, persistFallback = false) => {
|
|
28208
27869
|
const stored = readStoredStyleTokens(editContentRef.current);
|
|
28209
27870
|
if (stored) return stored;
|
|
@@ -28218,7 +27879,7 @@ function OhhwellsBridge() {
|
|
|
28218
27879
|
},
|
|
28219
27880
|
[rememberButtonTokens]
|
|
28220
27881
|
);
|
|
28221
|
-
const openButtonStylePanel = (0,
|
|
27882
|
+
const openButtonStylePanel = (0, import_react23.useCallback)(
|
|
28222
27883
|
(anchor) => {
|
|
28223
27884
|
const id = buttonId(anchor);
|
|
28224
27885
|
if (!id) return;
|
|
@@ -28236,7 +27897,7 @@ function OhhwellsBridge() {
|
|
|
28236
27897
|
},
|
|
28237
27898
|
[tokensForButton]
|
|
28238
27899
|
);
|
|
28239
|
-
const applySelectedButtonStyle = (0,
|
|
27900
|
+
const applySelectedButtonStyle = (0, import_react23.useCallback)(
|
|
28240
27901
|
(patch) => {
|
|
28241
27902
|
const panel = floatingPanelRef.current;
|
|
28242
27903
|
const id = panel?.kind === "button-style" ? panel.buttonId : null;
|
|
@@ -28254,7 +27915,7 @@ function OhhwellsBridge() {
|
|
|
28254
27915
|
},
|
|
28255
27916
|
[postToParent2]
|
|
28256
27917
|
);
|
|
28257
|
-
(0,
|
|
27918
|
+
(0, import_react23.useEffect)(() => {
|
|
28258
27919
|
const onDragOver = (e) => {
|
|
28259
27920
|
const dragged = buttonCollectionDragRef.current;
|
|
28260
27921
|
if (!dragged) return;
|
|
@@ -28273,11 +27934,11 @@ function OhhwellsBridge() {
|
|
|
28273
27934
|
document.removeEventListener("drop", onDrop);
|
|
28274
27935
|
};
|
|
28275
27936
|
}, [refreshButtonDragVisuals]);
|
|
28276
|
-
const isEditModeRef = (0,
|
|
28277
|
-
const requestMissingSocialIconsRef = (0,
|
|
27937
|
+
const isEditModeRef = (0, import_react23.useRef)(false);
|
|
27938
|
+
const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
|
|
28278
27939
|
});
|
|
28279
|
-
const askedSocialIconsRef = (0,
|
|
28280
|
-
const requestMissingSocialIcons = (0,
|
|
27940
|
+
const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
|
|
27941
|
+
const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
|
|
28281
27942
|
const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
|
|
28282
27943
|
const missing = socialsMissingIcons(row);
|
|
28283
27944
|
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
@@ -28289,7 +27950,7 @@ function OhhwellsBridge() {
|
|
|
28289
27950
|
}, []);
|
|
28290
27951
|
requestMissingSocialIconsRef.current = requestMissingSocialIcons;
|
|
28291
27952
|
isEditModeRef.current = isEditMode;
|
|
28292
|
-
const changeSocialsDisplay = (0,
|
|
27953
|
+
const changeSocialsDisplay = (0, import_react23.useCallback)(
|
|
28293
27954
|
(row, next) => {
|
|
28294
27955
|
if (next.icon) {
|
|
28295
27956
|
const missing = socialsMissingIcons(row);
|
|
@@ -28313,19 +27974,19 @@ function OhhwellsBridge() {
|
|
|
28313
27974
|
},
|
|
28314
27975
|
[]
|
|
28315
27976
|
);
|
|
28316
|
-
const closeFloatingPanelOnly = (0,
|
|
27977
|
+
const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
|
|
28317
27978
|
setFloatingPanel(null);
|
|
28318
27979
|
setFloatingPanelPos(null);
|
|
28319
27980
|
setLogoSizeDraft(null);
|
|
28320
27981
|
}, []);
|
|
28321
27982
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28322
|
-
const closeFloatingPanelAndDeselect = (0,
|
|
27983
|
+
const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
|
|
28323
27984
|
setFloatingPanel(null);
|
|
28324
27985
|
setFloatingPanelPos(null);
|
|
28325
27986
|
setLogoSizeDraft(null);
|
|
28326
27987
|
deselectRef.current();
|
|
28327
27988
|
}, []);
|
|
28328
|
-
(0,
|
|
27989
|
+
(0, import_react23.useEffect)(() => {
|
|
28329
27990
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
28330
27991
|
if (!session || !logoSizeDraft) {
|
|
28331
27992
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28344,7 +28005,7 @@ function OhhwellsBridge() {
|
|
|
28344
28005
|
max: LOGO_SIZE_MAX
|
|
28345
28006
|
});
|
|
28346
28007
|
}, [floatingPanel, logoSizeDraft, editorViewport]);
|
|
28347
|
-
const persistLogoSizeDraft = (0,
|
|
28008
|
+
const persistLogoSizeDraft = (0, import_react23.useCallback)(
|
|
28348
28009
|
(placement, draft) => {
|
|
28349
28010
|
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
28350
28011
|
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
@@ -28384,7 +28045,7 @@ function OhhwellsBridge() {
|
|
|
28384
28045
|
},
|
|
28385
28046
|
[postToParent2]
|
|
28386
28047
|
);
|
|
28387
|
-
const activate = (0,
|
|
28048
|
+
const activate = (0, import_react23.useCallback)((el, options) => {
|
|
28388
28049
|
if (activeElRef.current === el) return;
|
|
28389
28050
|
document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
|
|
28390
28051
|
hovered.removeAttribute("data-ohw-hovered");
|
|
@@ -28482,8 +28143,8 @@ function OhhwellsBridge() {
|
|
|
28482
28143
|
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
28483
28144
|
deselectRef.current = deselect;
|
|
28484
28145
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28485
|
-
const lastSiteWideScopeRef = (0,
|
|
28486
|
-
(0,
|
|
28146
|
+
const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
|
|
28147
|
+
(0, import_react23.useEffect)(() => {
|
|
28487
28148
|
if (!isEditMode) {
|
|
28488
28149
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28489
28150
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28509,7 +28170,7 @@ function OhhwellsBridge() {
|
|
|
28509
28170
|
isFooterFrameSelection,
|
|
28510
28171
|
postToParent2
|
|
28511
28172
|
]);
|
|
28512
|
-
(0,
|
|
28173
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
28513
28174
|
if (!subdomain || isEditMode) {
|
|
28514
28175
|
setFetchState("done");
|
|
28515
28176
|
return;
|
|
@@ -28536,7 +28197,6 @@ function OhhwellsBridge() {
|
|
|
28536
28197
|
applyAiFooterFromContent(content);
|
|
28537
28198
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28538
28199
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28539
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28540
28200
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28541
28201
|
}
|
|
28542
28202
|
applyBrandChrome(content);
|
|
@@ -28547,16 +28207,15 @@ function OhhwellsBridge() {
|
|
|
28547
28207
|
if (key === "__ohw_sections") continue;
|
|
28548
28208
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28549
28209
|
if (key === AI_FOOTER_KEY) continue;
|
|
28550
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28551
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28552
28210
|
if (key === BRAND_KIT_KEY) continue;
|
|
28553
28211
|
if (key === STYLE_STORE_KEY) continue;
|
|
28554
28212
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28213
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28555
28214
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28215
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28556
28216
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28557
28217
|
continue;
|
|
28558
28218
|
}
|
|
28559
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28560
28219
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28561
28220
|
if (applyCarouselNode(key, val)) continue;
|
|
28562
28221
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28596,7 +28255,6 @@ function OhhwellsBridge() {
|
|
|
28596
28255
|
});
|
|
28597
28256
|
applyLinkByKey(key, val);
|
|
28598
28257
|
}
|
|
28599
|
-
applySectionEmbeds(content);
|
|
28600
28258
|
applyLogoFromContent(content);
|
|
28601
28259
|
applyLogoSizes(content);
|
|
28602
28260
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28663,7 +28321,7 @@ function OhhwellsBridge() {
|
|
|
28663
28321
|
cancelled = true;
|
|
28664
28322
|
};
|
|
28665
28323
|
}, [subdomain, isEditMode]);
|
|
28666
|
-
(0,
|
|
28324
|
+
(0, import_react23.useEffect)(() => {
|
|
28667
28325
|
if (!isEditMode) return;
|
|
28668
28326
|
const resolveIndex = (form, clientY) => {
|
|
28669
28327
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28704,7 +28362,7 @@ function OhhwellsBridge() {
|
|
|
28704
28362
|
window.removeEventListener("drop", onDrop, true);
|
|
28705
28363
|
};
|
|
28706
28364
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28707
|
-
(0,
|
|
28365
|
+
(0, import_react23.useEffect)(() => {
|
|
28708
28366
|
if (!isEditMode) return;
|
|
28709
28367
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28710
28368
|
markFormFields(form);
|
|
@@ -28716,7 +28374,7 @@ function OhhwellsBridge() {
|
|
|
28716
28374
|
});
|
|
28717
28375
|
return () => observer.disconnect();
|
|
28718
28376
|
}, [isEditMode, fetchState, pathname]);
|
|
28719
|
-
(0,
|
|
28377
|
+
(0, import_react23.useEffect)(() => {
|
|
28720
28378
|
if (!isEditMode) return;
|
|
28721
28379
|
let saveTimer = null;
|
|
28722
28380
|
const onInput = (e) => {
|
|
@@ -28738,14 +28396,14 @@ function OhhwellsBridge() {
|
|
|
28738
28396
|
document.addEventListener("input", onInput, true);
|
|
28739
28397
|
return () => document.removeEventListener("input", onInput, true);
|
|
28740
28398
|
}, [isEditMode, persistFields]);
|
|
28741
|
-
(0,
|
|
28399
|
+
(0, import_react23.useEffect)(() => {
|
|
28742
28400
|
if (isEditMode || fetchState !== "done") return;
|
|
28743
28401
|
const content = contentCache.get(subdomain) ?? {};
|
|
28744
28402
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28745
28403
|
reconcileFieldsFromContent(form, content);
|
|
28746
28404
|
});
|
|
28747
28405
|
}, [isEditMode, fetchState, subdomain]);
|
|
28748
|
-
(0,
|
|
28406
|
+
(0, import_react23.useEffect)(() => {
|
|
28749
28407
|
if (!isEditMode) return;
|
|
28750
28408
|
const swallow = (e) => {
|
|
28751
28409
|
const target = e.target;
|
|
@@ -28754,14 +28412,14 @@ function OhhwellsBridge() {
|
|
|
28754
28412
|
document.addEventListener("submit", swallow, true);
|
|
28755
28413
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28756
28414
|
}, [isEditMode]);
|
|
28757
|
-
(0,
|
|
28415
|
+
(0, import_react23.useEffect)(() => {
|
|
28758
28416
|
if (isEditMode || fetchState !== "done") return;
|
|
28759
28417
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28760
28418
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28761
28419
|
console.log({ apiUrl, subdomain });
|
|
28762
28420
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28763
28421
|
}, [isEditMode, fetchState, subdomain]);
|
|
28764
|
-
(0,
|
|
28422
|
+
(0, import_react23.useEffect)(() => {
|
|
28765
28423
|
if (!subdomain || isEditMode) return;
|
|
28766
28424
|
let debounceTimer = null;
|
|
28767
28425
|
let observer = null;
|
|
@@ -28785,22 +28443,20 @@ function OhhwellsBridge() {
|
|
|
28785
28443
|
}
|
|
28786
28444
|
applyAiFooterFromContent(content);
|
|
28787
28445
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28788
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28789
28446
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28790
28447
|
}
|
|
28791
28448
|
for (const [key, val] of Object.entries(content)) {
|
|
28792
28449
|
if (key === "__ohw_sections") continue;
|
|
28793
28450
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28794
28451
|
if (key === AI_FOOTER_KEY) continue;
|
|
28795
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28796
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28797
28452
|
if (key === BRAND_KIT_KEY) continue;
|
|
28798
28453
|
if (key === STYLE_STORE_KEY) continue;
|
|
28799
28454
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28455
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28456
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28800
28457
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28801
28458
|
continue;
|
|
28802
28459
|
}
|
|
28803
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28804
28460
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28805
28461
|
if (applyCarouselNode(key, val)) continue;
|
|
28806
28462
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28825,7 +28481,6 @@ function OhhwellsBridge() {
|
|
|
28825
28481
|
});
|
|
28826
28482
|
applyLinkByKey(key, val);
|
|
28827
28483
|
}
|
|
28828
|
-
applySectionEmbeds(content);
|
|
28829
28484
|
applyLogoFromContent(content);
|
|
28830
28485
|
reconcileNavbarItemsFromContent(content);
|
|
28831
28486
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28881,16 +28536,16 @@ function OhhwellsBridge() {
|
|
|
28881
28536
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28882
28537
|
};
|
|
28883
28538
|
}, [subdomain, isEditMode, pathname]);
|
|
28884
|
-
(0,
|
|
28539
|
+
(0, import_react23.useLayoutEffect)(() => {
|
|
28885
28540
|
const el = document.getElementById("ohw-loader");
|
|
28886
28541
|
if (!el) return;
|
|
28887
28542
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28888
28543
|
el.style.display = visible ? "flex" : "none";
|
|
28889
28544
|
}, [subdomain, fetchState]);
|
|
28890
|
-
(0,
|
|
28545
|
+
(0, import_react23.useEffect)(() => {
|
|
28891
28546
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28892
28547
|
}, [pathname, postToParent2]);
|
|
28893
|
-
(0,
|
|
28548
|
+
(0, import_react23.useEffect)(() => {
|
|
28894
28549
|
if (!subdomain || isEditMode) return;
|
|
28895
28550
|
const content = contentCache.get(subdomain);
|
|
28896
28551
|
if (!content) return;
|
|
@@ -28908,7 +28563,7 @@ function OhhwellsBridge() {
|
|
|
28908
28563
|
}
|
|
28909
28564
|
applyAiFooterFromContent(content);
|
|
28910
28565
|
}, [pathname, subdomain, isEditMode]);
|
|
28911
|
-
(0,
|
|
28566
|
+
(0, import_react23.useEffect)(() => {
|
|
28912
28567
|
if (!isEditMode) return;
|
|
28913
28568
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28914
28569
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28916,12 +28571,12 @@ function OhhwellsBridge() {
|
|
|
28916
28571
|
deselectRef.current();
|
|
28917
28572
|
deactivateRef.current();
|
|
28918
28573
|
}, [pathname, isEditMode]);
|
|
28919
|
-
(0,
|
|
28574
|
+
(0, import_react23.useEffect)(() => {
|
|
28920
28575
|
if (!isEditMode) return;
|
|
28921
28576
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28922
28577
|
initItemInstancesFromContent(editContentRef.current);
|
|
28923
28578
|
}, [pathname, isEditMode]);
|
|
28924
|
-
(0,
|
|
28579
|
+
(0, import_react23.useEffect)(() => {
|
|
28925
28580
|
if (!isEditMode) return;
|
|
28926
28581
|
const observer = new MutationObserver(() => {
|
|
28927
28582
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28932,7 +28587,7 @@ function OhhwellsBridge() {
|
|
|
28932
28587
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28933
28588
|
return () => observer.disconnect();
|
|
28934
28589
|
}, [isEditMode, pathname]);
|
|
28935
|
-
(0,
|
|
28590
|
+
(0, import_react23.useEffect)(() => {
|
|
28936
28591
|
const contentForNav = () => {
|
|
28937
28592
|
if (isEditMode) return editContentRef.current;
|
|
28938
28593
|
if (!subdomain) return {};
|
|
@@ -29005,7 +28660,7 @@ function OhhwellsBridge() {
|
|
|
29005
28660
|
observer?.disconnect();
|
|
29006
28661
|
};
|
|
29007
28662
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
29008
|
-
(0,
|
|
28663
|
+
(0, import_react23.useEffect)(() => {
|
|
29009
28664
|
if (!isEditMode) return;
|
|
29010
28665
|
let applying = false;
|
|
29011
28666
|
let rafId = null;
|
|
@@ -29043,7 +28698,7 @@ function OhhwellsBridge() {
|
|
|
29043
28698
|
observer.disconnect();
|
|
29044
28699
|
};
|
|
29045
28700
|
}, [isEditMode, pathname]);
|
|
29046
|
-
(0,
|
|
28701
|
+
(0, import_react23.useEffect)(() => {
|
|
29047
28702
|
if (!isEditMode) return;
|
|
29048
28703
|
let lastPosted = 0;
|
|
29049
28704
|
const measure = () => {
|
|
@@ -29065,14 +28720,29 @@ function OhhwellsBridge() {
|
|
|
29065
28720
|
const t2 = setTimeout(measure, 500);
|
|
29066
28721
|
const ro = new ResizeObserver(schedule);
|
|
29067
28722
|
ro.observe(document.body);
|
|
28723
|
+
let lastWidth = window.innerWidth;
|
|
28724
|
+
let resizeTimers = [];
|
|
28725
|
+
const clearResizeTimers = () => {
|
|
28726
|
+
resizeTimers.forEach(clearTimeout);
|
|
28727
|
+
resizeTimers = [];
|
|
28728
|
+
};
|
|
28729
|
+
const handleResize = () => {
|
|
28730
|
+
if (window.innerWidth === lastWidth) return;
|
|
28731
|
+
lastWidth = window.innerWidth;
|
|
28732
|
+
clearResizeTimers();
|
|
28733
|
+
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
28734
|
+
};
|
|
28735
|
+
window.addEventListener("resize", handleResize);
|
|
29068
28736
|
return () => {
|
|
29069
28737
|
clearTimeout(t1);
|
|
29070
28738
|
clearTimeout(t2);
|
|
29071
28739
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29072
28740
|
ro.disconnect();
|
|
28741
|
+
clearResizeTimers();
|
|
28742
|
+
window.removeEventListener("resize", handleResize);
|
|
29073
28743
|
};
|
|
29074
28744
|
}, [pathname, isEditMode, postToParent2]);
|
|
29075
|
-
(0,
|
|
28745
|
+
(0, import_react23.useEffect)(() => {
|
|
29076
28746
|
if (isEditMode) return;
|
|
29077
28747
|
const handleClick = (e) => {
|
|
29078
28748
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -29086,7 +28756,7 @@ function OhhwellsBridge() {
|
|
|
29086
28756
|
document.addEventListener("click", handleClick, true);
|
|
29087
28757
|
return () => document.removeEventListener("click", handleClick, true);
|
|
29088
28758
|
}, [isEditMode, router, pathname]);
|
|
29089
|
-
(0,
|
|
28759
|
+
(0, import_react23.useEffect)(() => {
|
|
29090
28760
|
if (!isEditMode) {
|
|
29091
28761
|
editStylesRef.current?.base.remove();
|
|
29092
28762
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -29366,13 +29036,6 @@ function OhhwellsBridge() {
|
|
|
29366
29036
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29367
29037
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29368
29038
|
if (isInsideLinkEditor(target)) return;
|
|
29369
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29370
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29371
|
-
if (target.closest(
|
|
29372
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29373
|
-
)) {
|
|
29374
|
-
return;
|
|
29375
|
-
}
|
|
29376
29039
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29377
29040
|
clearMediaSelectionRef.current();
|
|
29378
29041
|
}
|
|
@@ -29396,6 +29059,8 @@ function OhhwellsBridge() {
|
|
|
29396
29059
|
return;
|
|
29397
29060
|
}
|
|
29398
29061
|
}
|
|
29062
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29063
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29399
29064
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29400
29065
|
if (collectionItem) {
|
|
29401
29066
|
e.preventDefault();
|
|
@@ -29407,6 +29072,11 @@ function OhhwellsBridge() {
|
|
|
29407
29072
|
});
|
|
29408
29073
|
return;
|
|
29409
29074
|
}
|
|
29075
|
+
if (target.closest(
|
|
29076
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29077
|
+
)) {
|
|
29078
|
+
return;
|
|
29079
|
+
}
|
|
29410
29080
|
{
|
|
29411
29081
|
const formEl = getFormElement(target);
|
|
29412
29082
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29560,13 +29230,9 @@ function OhhwellsBridge() {
|
|
|
29560
29230
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29561
29231
|
e.preventDefault();
|
|
29562
29232
|
e.stopPropagation();
|
|
29233
|
+
selectIconElementRef.current(editable);
|
|
29563
29234
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29564
29235
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29565
|
-
if (aiIcon) {
|
|
29566
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29567
|
-
} else {
|
|
29568
|
-
selectIconElementRef.current(editable);
|
|
29569
|
-
}
|
|
29570
29236
|
postToParentRef.current({
|
|
29571
29237
|
type: "ow:icon-pick",
|
|
29572
29238
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29794,9 +29460,6 @@ function OhhwellsBridge() {
|
|
|
29794
29460
|
setHoveredItemRect(null);
|
|
29795
29461
|
hoveredNavContainerRef.current = null;
|
|
29796
29462
|
setHoveredNavContainerRect(null);
|
|
29797
|
-
siblingHintElRef.current = null;
|
|
29798
|
-
setSiblingHintRect(null);
|
|
29799
|
-
setSiblingHintRects([]);
|
|
29800
29463
|
return;
|
|
29801
29464
|
}
|
|
29802
29465
|
{
|
|
@@ -29917,6 +29580,7 @@ function OhhwellsBridge() {
|
|
|
29917
29580
|
hoveredNavContainerRef.current = null;
|
|
29918
29581
|
setHoveredNavContainerRect(null);
|
|
29919
29582
|
hoveredItemElRef.current = editable;
|
|
29583
|
+
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29920
29584
|
}
|
|
29921
29585
|
}
|
|
29922
29586
|
}
|
|
@@ -30626,11 +30290,7 @@ function OhhwellsBridge() {
|
|
|
30626
30290
|
};
|
|
30627
30291
|
const handleMouseMove = (e) => {
|
|
30628
30292
|
const { clientX, clientY } = e;
|
|
30629
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30630
|
-
dismissImageHover();
|
|
30631
|
-
clearImageHover();
|
|
30632
|
-
return;
|
|
30633
|
-
}
|
|
30293
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
30634
30294
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30635
30295
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30636
30296
|
formHoverElRef.current = null;
|
|
@@ -30659,12 +30319,7 @@ function OhhwellsBridge() {
|
|
|
30659
30319
|
setHoveredItemRect(null);
|
|
30660
30320
|
hoveredNavContainerRef.current = null;
|
|
30661
30321
|
setHoveredNavContainerRect(null);
|
|
30662
|
-
siblingHintElRef.current = null;
|
|
30663
|
-
setSiblingHintRect(null);
|
|
30664
|
-
setSiblingHintRects([]);
|
|
30665
30322
|
dismissImageHover();
|
|
30666
|
-
clearImageHover();
|
|
30667
|
-
setSectionGap(null);
|
|
30668
30323
|
return;
|
|
30669
30324
|
}
|
|
30670
30325
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30676,11 +30331,7 @@ function OhhwellsBridge() {
|
|
|
30676
30331
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30677
30332
|
const { clientX, clientY } = e.data;
|
|
30678
30333
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30679
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30680
|
-
dismissImageHover();
|
|
30681
|
-
clearImageHover();
|
|
30682
|
-
return;
|
|
30683
|
-
}
|
|
30334
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
30684
30335
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30685
30336
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30686
30337
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -31060,7 +30711,6 @@ function OhhwellsBridge() {
|
|
|
31060
30711
|
applyAiFooterFromContent(content);
|
|
31061
30712
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31062
30713
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31063
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31064
30714
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31065
30715
|
}
|
|
31066
30716
|
applyBrandChrome(content);
|
|
@@ -31075,16 +30725,15 @@ function OhhwellsBridge() {
|
|
|
31075
30725
|
}
|
|
31076
30726
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31077
30727
|
if (key === AI_FOOTER_KEY) continue;
|
|
31078
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31079
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31080
30728
|
if (key === BRAND_KIT_KEY) continue;
|
|
31081
30729
|
if (key === STYLE_STORE_KEY) continue;
|
|
31082
30730
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30731
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31083
30732
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30733
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31084
30734
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31085
30735
|
continue;
|
|
31086
30736
|
}
|
|
31087
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31088
30737
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31089
30738
|
if (applyCarouselNode(key, val)) continue;
|
|
31090
30739
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31110,7 +30759,6 @@ function OhhwellsBridge() {
|
|
|
31110
30759
|
});
|
|
31111
30760
|
applyLinkByKey(key, val);
|
|
31112
30761
|
}
|
|
31113
|
-
applySectionEmbeds(content);
|
|
31114
30762
|
applyLogoFromContent(content);
|
|
31115
30763
|
applyLogoSizes(content);
|
|
31116
30764
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31718,12 +31366,6 @@ function OhhwellsBridge() {
|
|
|
31718
31366
|
closeLinkPopoverRef.current();
|
|
31719
31367
|
return;
|
|
31720
31368
|
}
|
|
31721
|
-
if (floatingPanelOpenRef.current) {
|
|
31722
|
-
setFloatingPanelRef.current(null);
|
|
31723
|
-
deselectRef.current();
|
|
31724
|
-
deactivateRef.current();
|
|
31725
|
-
return;
|
|
31726
|
-
}
|
|
31727
31369
|
deselectRef.current();
|
|
31728
31370
|
deactivateRef.current();
|
|
31729
31371
|
clearMediaSelectionRef.current();
|
|
@@ -32559,17 +32201,17 @@ function OhhwellsBridge() {
|
|
|
32559
32201
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32560
32202
|
window.removeEventListener("message", handleDeactivate);
|
|
32561
32203
|
window.removeEventListener("message", handleSelectNav);
|
|
32204
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32562
32205
|
window.removeEventListener("message", handleToastAction);
|
|
32563
32206
|
window.removeEventListener("message", handleFormCount);
|
|
32564
32207
|
window.removeEventListener("message", handleUiEscape);
|
|
32565
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32566
32208
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32567
32209
|
autoSaveTimers.current.clear();
|
|
32568
32210
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
32569
32211
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32570
32212
|
};
|
|
32571
32213
|
}, [isEditMode, refreshStateRules]);
|
|
32572
|
-
(0,
|
|
32214
|
+
(0, import_react23.useEffect)(() => {
|
|
32573
32215
|
if (!isEditMode) return;
|
|
32574
32216
|
const THRESHOLD = 10;
|
|
32575
32217
|
const resolveWasSelected = (el) => {
|
|
@@ -32725,7 +32367,7 @@ function OhhwellsBridge() {
|
|
|
32725
32367
|
unlockFooterDragInteraction();
|
|
32726
32368
|
};
|
|
32727
32369
|
}, [isEditMode]);
|
|
32728
|
-
(0,
|
|
32370
|
+
(0, import_react23.useEffect)(() => {
|
|
32729
32371
|
if (!isEditMode) return;
|
|
32730
32372
|
const THRESHOLD = 10;
|
|
32731
32373
|
const onPointerDown = (e) => {
|
|
@@ -32816,7 +32458,7 @@ function OhhwellsBridge() {
|
|
|
32816
32458
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32817
32459
|
};
|
|
32818
32460
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32819
|
-
(0,
|
|
32461
|
+
(0, import_react23.useEffect)(() => {
|
|
32820
32462
|
const handler = (e) => {
|
|
32821
32463
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32822
32464
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32832,7 +32474,7 @@ function OhhwellsBridge() {
|
|
|
32832
32474
|
window.addEventListener("message", handler);
|
|
32833
32475
|
return () => window.removeEventListener("message", handler);
|
|
32834
32476
|
}, [processConfigRequest]);
|
|
32835
|
-
(0,
|
|
32477
|
+
(0, import_react23.useEffect)(() => {
|
|
32836
32478
|
if (!isEditMode) return;
|
|
32837
32479
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32838
32480
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32856,7 +32498,7 @@ function OhhwellsBridge() {
|
|
|
32856
32498
|
postToParent2({
|
|
32857
32499
|
type: "ow:ready",
|
|
32858
32500
|
version: "1",
|
|
32859
|
-
bridgeVersion: "0.1.164
|
|
32501
|
+
bridgeVersion: "0.1.164",
|
|
32860
32502
|
path: pathname,
|
|
32861
32503
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32862
32504
|
sections
|
|
@@ -32868,13 +32510,13 @@ function OhhwellsBridge() {
|
|
|
32868
32510
|
clearTimeout(timer);
|
|
32869
32511
|
};
|
|
32870
32512
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32871
|
-
(0,
|
|
32513
|
+
(0, import_react23.useEffect)(() => {
|
|
32872
32514
|
scrollToHashSectionWhenReady();
|
|
32873
32515
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32874
32516
|
window.addEventListener("hashchange", onHashChange);
|
|
32875
32517
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
32876
32518
|
}, [pathname]);
|
|
32877
|
-
const handleCommand = (0,
|
|
32519
|
+
const handleCommand = (0, import_react23.useCallback)((cmd) => {
|
|
32878
32520
|
const el = activeElRef.current;
|
|
32879
32521
|
const selBefore = window.getSelection();
|
|
32880
32522
|
let savedOffsets = null;
|
|
@@ -32910,7 +32552,7 @@ function OhhwellsBridge() {
|
|
|
32910
32552
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32911
32553
|
refreshActiveCommandsRef.current();
|
|
32912
32554
|
}, []);
|
|
32913
|
-
(0,
|
|
32555
|
+
(0, import_react23.useEffect)(() => {
|
|
32914
32556
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32915
32557
|
if (!session || !logoSizeDraft) return;
|
|
32916
32558
|
const onPanelAction = (e) => {
|
|
@@ -32948,7 +32590,7 @@ function OhhwellsBridge() {
|
|
|
32948
32590
|
window.addEventListener("message", onPanelAction);
|
|
32949
32591
|
return () => window.removeEventListener("message", onPanelAction);
|
|
32950
32592
|
}, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
|
|
32951
|
-
const handleStateChange = (0,
|
|
32593
|
+
const handleStateChange = (0, import_react23.useCallback)((state) => {
|
|
32952
32594
|
if (!activeStateElRef.current) return;
|
|
32953
32595
|
const el = activeStateElRef.current;
|
|
32954
32596
|
if (state === "Default") {
|
|
@@ -32961,7 +32603,7 @@ function OhhwellsBridge() {
|
|
|
32961
32603
|
}
|
|
32962
32604
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
32963
32605
|
}, [deactivate]);
|
|
32964
|
-
const reselectAfterLinkPopover = (0,
|
|
32606
|
+
const reselectAfterLinkPopover = (0, import_react23.useCallback)(
|
|
32965
32607
|
(hrefKey) => {
|
|
32966
32608
|
requestAnimationFrame(() => {
|
|
32967
32609
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -32970,7 +32612,7 @@ function OhhwellsBridge() {
|
|
|
32970
32612
|
},
|
|
32971
32613
|
[resolveHrefKeyElement]
|
|
32972
32614
|
);
|
|
32973
|
-
const closeLinkPopover = (0,
|
|
32615
|
+
const closeLinkPopover = (0, import_react23.useCallback)(() => {
|
|
32974
32616
|
const session = linkPopoverSessionRef.current;
|
|
32975
32617
|
addNavAfterAnchorRef.current = null;
|
|
32976
32618
|
setLinkPopover(null);
|
|
@@ -32978,9 +32620,9 @@ function OhhwellsBridge() {
|
|
|
32978
32620
|
reselectAfterLinkPopover(session.key);
|
|
32979
32621
|
}
|
|
32980
32622
|
}, [reselectAfterLinkPopover]);
|
|
32981
|
-
const closeLinkPopoverRef = (0,
|
|
32623
|
+
const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
|
|
32982
32624
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
32983
|
-
const openLinkPopoverForActive = (0,
|
|
32625
|
+
const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
|
|
32984
32626
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
32985
32627
|
if (!hrefCtx) return;
|
|
32986
32628
|
bumpLinkPopoverGrace();
|
|
@@ -32991,7 +32633,7 @@ function OhhwellsBridge() {
|
|
|
32991
32633
|
});
|
|
32992
32634
|
deactivate();
|
|
32993
32635
|
}, [deactivate]);
|
|
32994
|
-
const openLinkPopoverForSelected = (0,
|
|
32636
|
+
const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
|
|
32995
32637
|
const anchor = selectedElRef.current;
|
|
32996
32638
|
if (!anchor) return;
|
|
32997
32639
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -33008,7 +32650,7 @@ function OhhwellsBridge() {
|
|
|
33008
32650
|
});
|
|
33009
32651
|
deselect();
|
|
33010
32652
|
}, [deselect]);
|
|
33011
|
-
const handleSelectParent = (0,
|
|
32653
|
+
const handleSelectParent = (0, import_react23.useCallback)(() => {
|
|
33012
32654
|
const selected = selectedElRef.current;
|
|
33013
32655
|
if (!selected) return;
|
|
33014
32656
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -33035,7 +32677,7 @@ function OhhwellsBridge() {
|
|
|
33035
32677
|
}
|
|
33036
32678
|
deselectRef.current();
|
|
33037
32679
|
}, []);
|
|
33038
|
-
const handleDuplicateSelected = (0,
|
|
32680
|
+
const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
|
|
33039
32681
|
const selected = selectedElRef.current;
|
|
33040
32682
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
33041
32683
|
if (isCtaButton(selected)) {
|
|
@@ -33204,7 +32846,7 @@ function OhhwellsBridge() {
|
|
|
33204
32846
|
});
|
|
33205
32847
|
}
|
|
33206
32848
|
}, [postToParent2, tokensForButton]);
|
|
33207
|
-
const runPendingDeleteUndo = (0,
|
|
32849
|
+
const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
|
|
33208
32850
|
const pending = pendingDeleteUndoRef.current;
|
|
33209
32851
|
if (!pending) return false;
|
|
33210
32852
|
pendingDeleteUndoRef.current = null;
|
|
@@ -33212,7 +32854,7 @@ function OhhwellsBridge() {
|
|
|
33212
32854
|
enforceLinkHrefs();
|
|
33213
32855
|
return true;
|
|
33214
32856
|
}, []);
|
|
33215
|
-
const handleDeleteSelected = (0,
|
|
32857
|
+
const handleDeleteSelected = (0, import_react23.useCallback)(() => {
|
|
33216
32858
|
const selected = selectedElRef.current;
|
|
33217
32859
|
if (!selected) return false;
|
|
33218
32860
|
if (isCtaButton(selected)) {
|
|
@@ -33274,7 +32916,7 @@ function OhhwellsBridge() {
|
|
|
33274
32916
|
}, [postToParent2]);
|
|
33275
32917
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
33276
32918
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
33277
|
-
const handleLinkPopoverSubmit = (0,
|
|
32919
|
+
const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
|
|
33278
32920
|
(target) => {
|
|
33279
32921
|
const session = linkPopoverSessionRef.current;
|
|
33280
32922
|
if (!session) return;
|
|
@@ -33340,14 +32982,14 @@ function OhhwellsBridge() {
|
|
|
33340
32982
|
const showEditLink = toolbarShowEditLink;
|
|
33341
32983
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
33342
32984
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
33343
|
-
const handleMediaSelect = (0,
|
|
32985
|
+
const handleMediaSelect = (0, import_react23.useCallback)((key) => {
|
|
33344
32986
|
const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
|
|
33345
32987
|
(m) => (m.dataset.ohwKey ?? "") === key
|
|
33346
32988
|
) ?? null;
|
|
33347
32989
|
if (!el) return;
|
|
33348
32990
|
selectMediaElementRef.current(el);
|
|
33349
32991
|
}, []);
|
|
33350
|
-
const handleMediaReplace = (0,
|
|
32992
|
+
const handleMediaReplace = (0, import_react23.useCallback)(
|
|
33351
32993
|
(key) => {
|
|
33352
32994
|
postToParent2({
|
|
33353
32995
|
type: "ow:image-pick",
|
|
@@ -33357,13 +32999,13 @@ function OhhwellsBridge() {
|
|
|
33357
32999
|
},
|
|
33358
33000
|
[postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
|
|
33359
33001
|
);
|
|
33360
|
-
const handleEditCarousel = (0,
|
|
33002
|
+
const handleEditCarousel = (0, import_react23.useCallback)(
|
|
33361
33003
|
(key) => {
|
|
33362
33004
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
33363
33005
|
},
|
|
33364
33006
|
[postToParent2]
|
|
33365
33007
|
);
|
|
33366
|
-
const handleMediaFadeOutComplete = (0,
|
|
33008
|
+
const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
|
|
33367
33009
|
setUploadingRects((prev) => {
|
|
33368
33010
|
if (!(key in prev)) return prev;
|
|
33369
33011
|
const next = { ...prev };
|
|
@@ -33371,7 +33013,7 @@ function OhhwellsBridge() {
|
|
|
33371
33013
|
return next;
|
|
33372
33014
|
});
|
|
33373
33015
|
}, []);
|
|
33374
|
-
const handleVideoSettingsChange = (0,
|
|
33016
|
+
const handleVideoSettingsChange = (0, import_react23.useCallback)(
|
|
33375
33017
|
(key, settings) => {
|
|
33376
33018
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
33377
33019
|
const video = getVideoEl2(el);
|
|
@@ -34085,7 +33727,6 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34085
33727
|
hasMountedContentNodes,
|
|
34086
33728
|
indexCollectionItems,
|
|
34087
33729
|
insertFooterHours,
|
|
34088
|
-
isDeadPageHref,
|
|
34089
33730
|
isEditSessionActive,
|
|
34090
33731
|
isPlainLeftClick,
|
|
34091
33732
|
isRenderableFooterTree,
|
|
@@ -34097,7 +33738,6 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34097
33738
|
parseAiFooterState,
|
|
34098
33739
|
parseAiSectionsState,
|
|
34099
33740
|
parseTarget,
|
|
34100
|
-
planBuildPageSync,
|
|
34101
33741
|
recordOverriddenPaths,
|
|
34102
33742
|
releaseTemplateLogoIfReplaced,
|
|
34103
33743
|
removeFooterBlock,
|