@ohhwells/bridge 0.1.162 → 0.1.163-next.434
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/README.md +1 -1
- package/dist/index.cjs +1384 -1031
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.js +1189 -822
- 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 +116 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -86,6 +86,7 @@ __export(index_exports, {
|
|
|
86
86
|
hasMountedContentNodes: () => hasMountedContentNodes,
|
|
87
87
|
indexCollectionItems: () => indexCollectionItems,
|
|
88
88
|
insertFooterHours: () => insertFooterHours,
|
|
89
|
+
isDeadPageHref: () => isDeadPageHref,
|
|
89
90
|
isEditSessionActive: () => isEditSessionActive,
|
|
90
91
|
isPlainLeftClick: () => isPlainLeftClick,
|
|
91
92
|
isRenderableFooterTree: () => isRenderableFooterTree,
|
|
@@ -97,6 +98,7 @@ __export(index_exports, {
|
|
|
97
98
|
parseAiFooterState: () => parseAiFooterState,
|
|
98
99
|
parseAiSectionsState: () => parseAiSectionsState,
|
|
99
100
|
parseTarget: () => parseTarget,
|
|
101
|
+
planBuildPageSync: () => planBuildPageSync,
|
|
100
102
|
recordOverriddenPaths: () => recordOverriddenPaths,
|
|
101
103
|
releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
|
|
102
104
|
removeFooterBlock: () => removeFooterBlock,
|
|
@@ -115,7 +117,7 @@ __export(index_exports, {
|
|
|
115
117
|
module.exports = __toCommonJS(index_exports);
|
|
116
118
|
|
|
117
119
|
// src/OhhwellsBridge.tsx
|
|
118
|
-
var
|
|
120
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
119
121
|
var import_client3 = require("react-dom/client");
|
|
120
122
|
var import_react_dom5 = require("react-dom");
|
|
121
123
|
|
|
@@ -954,6 +956,10 @@ function useOhwCarousel(key, initial) {
|
|
|
954
956
|
if (Array.isArray(detail?.images)) setImages(detail.images);
|
|
955
957
|
};
|
|
956
958
|
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
|
+
}
|
|
957
963
|
return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
|
|
958
964
|
}, [key]);
|
|
959
965
|
const bind = {
|
|
@@ -1208,21 +1214,21 @@ function chromeFrom(sample) {
|
|
|
1208
1214
|
};
|
|
1209
1215
|
}
|
|
1210
1216
|
function filledPrimary(seed) {
|
|
1211
|
-
const
|
|
1212
|
-
const luminance = relativeLuminance(
|
|
1217
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1218
|
+
const luminance = relativeLuminance(paint2);
|
|
1213
1219
|
return {
|
|
1214
|
-
background: toCss({ ...
|
|
1220
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1215
1221
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1216
1222
|
borderColor: TRANSPARENT,
|
|
1217
1223
|
borderWidth: "0px"
|
|
1218
1224
|
};
|
|
1219
1225
|
}
|
|
1220
1226
|
function generatedSecondary(primary) {
|
|
1221
|
-
const
|
|
1227
|
+
const paint2 = accentColor(primary);
|
|
1222
1228
|
return {
|
|
1223
1229
|
background: TRANSPARENT,
|
|
1224
|
-
color:
|
|
1225
|
-
borderColor:
|
|
1230
|
+
color: paint2,
|
|
1231
|
+
borderColor: paint2,
|
|
1226
1232
|
borderWidth: "1px"
|
|
1227
1233
|
};
|
|
1228
1234
|
}
|
|
@@ -1235,9 +1241,9 @@ function generatedGhost(primary) {
|
|
|
1235
1241
|
};
|
|
1236
1242
|
}
|
|
1237
1243
|
function normalizeOutlineChrome(outline, primary) {
|
|
1238
|
-
const
|
|
1244
|
+
const paint2 = accentColor(primary);
|
|
1239
1245
|
const text = parseColor(outline.color);
|
|
1240
|
-
const paintRgb = parseColor(
|
|
1246
|
+
const paintRgb = parseColor(paint2);
|
|
1241
1247
|
const primaryLabel = parseColor(primary.color);
|
|
1242
1248
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1243
1249
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1246,8 +1252,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1246
1252
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1247
1253
|
return {
|
|
1248
1254
|
...outline,
|
|
1249
|
-
color:
|
|
1250
|
-
borderColor: hasBorder ?
|
|
1255
|
+
color: paint2,
|
|
1256
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1251
1257
|
};
|
|
1252
1258
|
}
|
|
1253
1259
|
function generateButtonVariants(samples) {
|
|
@@ -3610,11 +3616,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
|
|
|
3610
3616
|
container.appendChild(column);
|
|
3611
3617
|
return { column, firstLink };
|
|
3612
3618
|
}
|
|
3613
|
-
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL,
|
|
3619
|
+
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
|
|
3614
3620
|
if (!canAddFooterColumn()) {
|
|
3615
3621
|
throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
|
|
3616
3622
|
}
|
|
3617
|
-
const resolvedHref =
|
|
3623
|
+
const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
|
|
3618
3624
|
const colIndex = getNextFooterColumnIndex();
|
|
3619
3625
|
const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
|
|
3620
3626
|
if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
|
|
@@ -3993,8 +3999,8 @@ function duplicateFooterItem(sourceAnchor) {
|
|
|
3993
3999
|
const column = findFooterColumnForLink(sourceAnchor);
|
|
3994
4000
|
if (!column) return null;
|
|
3995
4001
|
const href = getLinkHref(sourceAnchor);
|
|
3996
|
-
const
|
|
3997
|
-
const label = (
|
|
4002
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
4003
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
3998
4004
|
return insertFooterItem(column, href || "/", label, sourceAnchor);
|
|
3999
4005
|
}
|
|
4000
4006
|
function footerLabelKeyFromHrefKey(hrefKey) {
|
|
@@ -4004,8 +4010,8 @@ function deleteFooterItem(sourceAnchor) {
|
|
|
4004
4010
|
if (!isFooterLinkAnchor(sourceAnchor)) return null;
|
|
4005
4011
|
const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
4006
4012
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
|
|
4007
|
-
const
|
|
4008
|
-
const label = (
|
|
4013
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
4014
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
4009
4015
|
const labelKey = footerLabelKeyFromHrefKey(hrefKey);
|
|
4010
4016
|
const previousOrder = getFooterOrderFromDom();
|
|
4011
4017
|
const previousOrderJson = JSON.stringify(previousOrder);
|
|
@@ -4973,8 +4979,8 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4973
4979
|
const mapped = keyMap.get(oldHrefKey);
|
|
4974
4980
|
if (!mapped) return;
|
|
4975
4981
|
el.setAttribute("data-ohw-href-key", mapped.hrefKey);
|
|
4976
|
-
const
|
|
4977
|
-
if (
|
|
4982
|
+
const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
|
|
4983
|
+
if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
|
|
4978
4984
|
};
|
|
4979
4985
|
if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
|
|
4980
4986
|
root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
|
|
@@ -4982,10 +4988,10 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4982
4988
|
function readNavLinkSnapshot(hrefKey) {
|
|
4983
4989
|
const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
4984
4990
|
if (!el) return { href: "/", label: "Untitled" };
|
|
4985
|
-
const
|
|
4991
|
+
const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
|
|
4986
4992
|
return {
|
|
4987
4993
|
href: getLinkHref2(el),
|
|
4988
|
-
label: (
|
|
4994
|
+
label: (labelEl2?.textContent ?? "").trim() || "Untitled"
|
|
4989
4995
|
};
|
|
4990
4996
|
}
|
|
4991
4997
|
function findClonedNavAnchor(unit, hrefKey) {
|
|
@@ -5159,8 +5165,8 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5159
5165
|
if (!isNavbarLinkItem(sourceAnchor)) return null;
|
|
5160
5166
|
const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
5161
5167
|
if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
|
|
5162
|
-
const
|
|
5163
|
-
const label = (
|
|
5168
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
5169
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
5164
5170
|
const previousForest = getNavForestFromDom();
|
|
5165
5171
|
const previousOrderJson = serializeNavOrder(previousForest);
|
|
5166
5172
|
const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
|
|
@@ -6763,6 +6769,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6763
6769
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6764
6770
|
return target ? pricingFeatureList(target).length : 0;
|
|
6765
6771
|
}
|
|
6772
|
+
function prevailingFeatureIcon(features) {
|
|
6773
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6774
|
+
for (const row of features) {
|
|
6775
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6776
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6777
|
+
entry.count += 1;
|
|
6778
|
+
counts.set(key, entry);
|
|
6779
|
+
}
|
|
6780
|
+
let best = null;
|
|
6781
|
+
for (const entry of counts.values()) {
|
|
6782
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6783
|
+
}
|
|
6784
|
+
if (!best) return {};
|
|
6785
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6786
|
+
}
|
|
6766
6787
|
function addPricingCardFeature(tree, index, text) {
|
|
6767
6788
|
return withPricingCollection(tree, (collection) => {
|
|
6768
6789
|
const children = collection.children;
|
|
@@ -6771,7 +6792,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6771
6792
|
const features = pricingFeatureList(target);
|
|
6772
6793
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6773
6794
|
target.slots = target.slots ?? {};
|
|
6774
|
-
target.slots.features = [...features, { text }];
|
|
6795
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6775
6796
|
return true;
|
|
6776
6797
|
});
|
|
6777
6798
|
}
|
|
@@ -7415,6 +7436,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7415
7436
|
);
|
|
7416
7437
|
}
|
|
7417
7438
|
|
|
7439
|
+
// src/lib/youtube.ts
|
|
7440
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7441
|
+
function extractYouTubeId(input) {
|
|
7442
|
+
const trimmed = input.trim();
|
|
7443
|
+
if (!trimmed) return null;
|
|
7444
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7445
|
+
let url;
|
|
7446
|
+
try {
|
|
7447
|
+
url = new URL(trimmed);
|
|
7448
|
+
} catch {
|
|
7449
|
+
return null;
|
|
7450
|
+
}
|
|
7451
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7452
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7453
|
+
return null;
|
|
7454
|
+
}
|
|
7455
|
+
let candidate = null;
|
|
7456
|
+
if (host === "youtu.be") {
|
|
7457
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7458
|
+
} else if (url.pathname === "/watch") {
|
|
7459
|
+
candidate = url.searchParams.get("v");
|
|
7460
|
+
} else {
|
|
7461
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7462
|
+
candidate = match ? match[1] : null;
|
|
7463
|
+
}
|
|
7464
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7465
|
+
}
|
|
7466
|
+
|
|
7467
|
+
// src/lib/section-embed.ts
|
|
7468
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7469
|
+
function readStoredEmbed(value) {
|
|
7470
|
+
if (value.startsWith("start\n")) {
|
|
7471
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7472
|
+
}
|
|
7473
|
+
return { raw: value, at: "end" };
|
|
7474
|
+
}
|
|
7475
|
+
function embedFrameSrc(value) {
|
|
7476
|
+
const videoId = extractYouTubeId(value);
|
|
7477
|
+
if (videoId) {
|
|
7478
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7479
|
+
}
|
|
7480
|
+
let url;
|
|
7481
|
+
try {
|
|
7482
|
+
url = new URL(value);
|
|
7483
|
+
} catch {
|
|
7484
|
+
return null;
|
|
7485
|
+
}
|
|
7486
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7487
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7488
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7489
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7490
|
+
return { src, title: "Map" };
|
|
7491
|
+
}
|
|
7492
|
+
if (host === "maps.app.goo.gl") {
|
|
7493
|
+
return { src: value, title: "Map" };
|
|
7494
|
+
}
|
|
7495
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7496
|
+
return { src: value, title: "Calendar" };
|
|
7497
|
+
}
|
|
7498
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7499
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7500
|
+
}
|
|
7501
|
+
if (host === "forms.gle") {
|
|
7502
|
+
return { src: value, title: "Form" };
|
|
7503
|
+
}
|
|
7504
|
+
return null;
|
|
7505
|
+
}
|
|
7506
|
+
function place(section, box, at) {
|
|
7507
|
+
if (at === "start") {
|
|
7508
|
+
section.insertBefore(box, section.firstChild);
|
|
7509
|
+
return;
|
|
7510
|
+
}
|
|
7511
|
+
section.appendChild(box);
|
|
7512
|
+
}
|
|
7513
|
+
function paint(section, key, src, title, at) {
|
|
7514
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7515
|
+
const frame = existing?.querySelector("iframe");
|
|
7516
|
+
if (existing && frame) {
|
|
7517
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7518
|
+
frame.title = title;
|
|
7519
|
+
place(section, existing, at);
|
|
7520
|
+
return;
|
|
7521
|
+
}
|
|
7522
|
+
existing?.remove();
|
|
7523
|
+
const box = document.createElement("div");
|
|
7524
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7525
|
+
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;";
|
|
7526
|
+
const frameWrap = document.createElement("div");
|
|
7527
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7528
|
+
const iframe = document.createElement("iframe");
|
|
7529
|
+
iframe.src = src;
|
|
7530
|
+
iframe.title = title;
|
|
7531
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7532
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7533
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7534
|
+
frameWrap.appendChild(iframe);
|
|
7535
|
+
box.appendChild(frameWrap);
|
|
7536
|
+
place(section, box, at);
|
|
7537
|
+
}
|
|
7538
|
+
function applySectionEmbeds(content) {
|
|
7539
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7540
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7541
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7542
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7543
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7544
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7545
|
+
if (!section || !stored || !frame) {
|
|
7546
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7547
|
+
continue;
|
|
7548
|
+
}
|
|
7549
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7550
|
+
}
|
|
7551
|
+
}
|
|
7552
|
+
|
|
7418
7553
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7419
7554
|
var import_react_dom = require("react-dom");
|
|
7420
7555
|
var import_client = require("react-dom/client");
|
|
@@ -7988,7 +8123,7 @@ var AI_MOBILE_CSS = [
|
|
|
7988
8123
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7989
8124
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7990
8125
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
7991
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8126
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7992
8127
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7993
8128
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7994
8129
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8004,8 +8139,10 @@ var AI_MOBILE_CSS = [
|
|
|
8004
8139
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8005
8140
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8006
8141
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
8007
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
8008
|
-
|
|
8142
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8143
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8144
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8145
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
8009
8146
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8010
8147
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8011
8148
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8210,6 +8347,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8210
8347
|
function textAttrs(ctx, path) {
|
|
8211
8348
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8212
8349
|
}
|
|
8350
|
+
var AI_RESPONSIVE_CSS = [
|
|
8351
|
+
"@media (max-width: 960px) {",
|
|
8352
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8353
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8354
|
+
"}",
|
|
8355
|
+
"@media (max-width: 640px) {",
|
|
8356
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8357
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8358
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8359
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8360
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8361
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8362
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8363
|
+
// layered text used to be.
|
|
8364
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8365
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8366
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8367
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8368
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8369
|
+
// other rule had already been taught to stand down.
|
|
8370
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8371
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8372
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8373
|
+
"}"
|
|
8374
|
+
].join("\n");
|
|
8213
8375
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8214
8376
|
function MediaBox({
|
|
8215
8377
|
refValue,
|
|
@@ -8264,7 +8426,7 @@ function MediaBox({
|
|
|
8264
8426
|
position: fill ? "absolute" : void 0,
|
|
8265
8427
|
inset: fill ? 0 : void 0,
|
|
8266
8428
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8267
|
-
height: fill ? "100%" : void 0,
|
|
8429
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8268
8430
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8269
8431
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8270
8432
|
borderRadius: radius,
|
|
@@ -9760,7 +9922,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9760
9922
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9761
9923
|
"div",
|
|
9762
9924
|
{
|
|
9763
|
-
"data-ai-grid":
|
|
9925
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9764
9926
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9765
9927
|
style: {
|
|
9766
9928
|
display: "grid",
|
|
@@ -10062,7 +10224,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10062
10224
|
},
|
|
10063
10225
|
children: [
|
|
10064
10226
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10065
|
-
// The section's `data-ai-
|
|
10227
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
10066
10228
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10067
10229
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10068
10230
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10481,6 +10643,7 @@ function AiTreeRenderer({
|
|
|
10481
10643
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10482
10644
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10483
10645
|
...bgAttrs,
|
|
10646
|
+
"data-ai-responsive": "",
|
|
10484
10647
|
style: {
|
|
10485
10648
|
position: "relative",
|
|
10486
10649
|
padding: `${padCss} 0`,
|
|
@@ -10494,12 +10657,13 @@ function AiTreeRenderer({
|
|
|
10494
10657
|
...fillHeight ? { display: "grid" } : {}
|
|
10495
10658
|
},
|
|
10496
10659
|
children: [
|
|
10497
|
-
|
|
10660
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10498
10661
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10662
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10499
10663
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10500
10664
|
"div",
|
|
10501
10665
|
{
|
|
10502
|
-
"data-ai-
|
|
10666
|
+
"data-ai-section-inner": "",
|
|
10503
10667
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10504
10668
|
style: {
|
|
10505
10669
|
position: "relative",
|
|
@@ -10516,7 +10680,7 @@ function AiTreeRenderer({
|
|
|
10516
10680
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10517
10681
|
"div",
|
|
10518
10682
|
{
|
|
10519
|
-
"data-ai-
|
|
10683
|
+
"data-ai-columns": "",
|
|
10520
10684
|
style: {
|
|
10521
10685
|
display: "grid",
|
|
10522
10686
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11178,9 +11342,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11178
11342
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11179
11343
|
continue;
|
|
11180
11344
|
}
|
|
11181
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11182
11345
|
let container = existing?.container;
|
|
11346
|
+
let isNewMount = false;
|
|
11183
11347
|
if (!container || !container.isConnected) {
|
|
11348
|
+
isNewMount = true;
|
|
11184
11349
|
existing?.root.unmount();
|
|
11185
11350
|
container?.remove();
|
|
11186
11351
|
container = document.createElement("div");
|
|
@@ -11518,6 +11683,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11518
11683
|
return 3;
|
|
11519
11684
|
}
|
|
11520
11685
|
}
|
|
11686
|
+
function readLiveSocialItems() {
|
|
11687
|
+
const root = getFooterRoot();
|
|
11688
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11689
|
+
if (!row) return [];
|
|
11690
|
+
const items = [];
|
|
11691
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11692
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11693
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11694
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11695
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11696
|
+
items.push({ platform, href });
|
|
11697
|
+
}
|
|
11698
|
+
return items;
|
|
11699
|
+
}
|
|
11700
|
+
function syncSocialRowsFromDom(tree) {
|
|
11701
|
+
const root = getFooterRoot();
|
|
11702
|
+
if (!root) return;
|
|
11703
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11704
|
+
const live = readLiveSocialItems();
|
|
11705
|
+
if (row && live.length === 0) return;
|
|
11706
|
+
for (const col of tree.columns) {
|
|
11707
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11708
|
+
if (block.type !== "social-row") return [block];
|
|
11709
|
+
if (!row) return [];
|
|
11710
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11711
|
+
});
|
|
11712
|
+
}
|
|
11713
|
+
}
|
|
11521
11714
|
function collectBrandBlocks(tree) {
|
|
11522
11715
|
const brand = [];
|
|
11523
11716
|
for (const col of tree.columns) {
|
|
@@ -11763,12 +11956,13 @@ function textOf2(el) {
|
|
|
11763
11956
|
}
|
|
11764
11957
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11765
11958
|
const next = cloneTree(tree);
|
|
11959
|
+
syncSocialRowsFromDom(next);
|
|
11766
11960
|
const domCols = listFooterColumns().map((col) => {
|
|
11767
11961
|
const heading = getFooterColumnHeadingEl(col);
|
|
11768
11962
|
const title = heading ? textOf2(heading) : void 0;
|
|
11769
11963
|
const items = listFooterLinksInColumn(col).map((anchor) => {
|
|
11770
|
-
const
|
|
11771
|
-
const label = textOf2(
|
|
11964
|
+
const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11965
|
+
const label = textOf2(labelEl2) || textOf2(anchor);
|
|
11772
11966
|
const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
|
|
11773
11967
|
return label ? { label, href: href || "home" } : null;
|
|
11774
11968
|
}).filter((x) => Boolean(x));
|
|
@@ -17467,7 +17661,7 @@ function apiBase() {
|
|
|
17467
17661
|
function bridgeVersion() {
|
|
17468
17662
|
try {
|
|
17469
17663
|
if (true) {
|
|
17470
|
-
return "0.1.
|
|
17664
|
+
return "0.1.163-next.434";
|
|
17471
17665
|
}
|
|
17472
17666
|
} catch {
|
|
17473
17667
|
}
|
|
@@ -17481,7 +17675,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17481
17675
|
return;
|
|
17482
17676
|
}
|
|
17483
17677
|
try {
|
|
17484
|
-
const v = true ? "0.1.
|
|
17678
|
+
const v = true ? "0.1.163-next.434" : "";
|
|
17485
17679
|
if (v) {
|
|
17486
17680
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17487
17681
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18159,6 +18353,7 @@ function MediaOverlay({
|
|
|
18159
18353
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18160
18354
|
);
|
|
18161
18355
|
}, [isVideo]);
|
|
18356
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18162
18357
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18163
18358
|
const box = {
|
|
18164
18359
|
position: "fixed",
|
|
@@ -18257,11 +18452,10 @@ function MediaOverlay({
|
|
|
18257
18452
|
className: "flex items-center justify-center cursor-pointer",
|
|
18258
18453
|
style: {
|
|
18259
18454
|
...box,
|
|
18260
|
-
//
|
|
18261
|
-
//
|
|
18262
|
-
//
|
|
18263
|
-
|
|
18264
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18455
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18456
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18457
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18458
|
+
pointerEvents: "none",
|
|
18265
18459
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18266
18460
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18267
18461
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18288,17 +18482,17 @@ function MediaOverlay({
|
|
|
18288
18482
|
},
|
|
18289
18483
|
children: [
|
|
18290
18484
|
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 }),
|
|
18291
|
-
|
|
18485
|
+
replaceLabel
|
|
18292
18486
|
]
|
|
18293
18487
|
}
|
|
18294
18488
|
),
|
|
18295
|
-
replaceMode
|
|
18489
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18296
18490
|
Button,
|
|
18297
18491
|
{
|
|
18298
18492
|
"data-ohw-media-overlay": "",
|
|
18299
18493
|
variant: "outline",
|
|
18300
18494
|
size: "sm",
|
|
18301
|
-
"aria-label":
|
|
18495
|
+
"aria-label": replaceLabel,
|
|
18302
18496
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18303
18497
|
style: {
|
|
18304
18498
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18321,7 +18515,7 @@ function MediaOverlay({
|
|
|
18321
18515
|
},
|
|
18322
18516
|
children: [
|
|
18323
18517
|
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 }),
|
|
18324
|
-
replaceMode === "full" ?
|
|
18518
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18325
18519
|
]
|
|
18326
18520
|
}
|
|
18327
18521
|
)
|
|
@@ -18915,7 +19109,7 @@ function AiSectionOverlay({
|
|
|
18915
19109
|
|
|
18916
19110
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18917
19111
|
var import_react12 = require("react");
|
|
18918
|
-
var
|
|
19112
|
+
var import_lucide_react9 = require("lucide-react");
|
|
18919
19113
|
|
|
18920
19114
|
// src/lib/ai-media-strip-tree.ts
|
|
18921
19115
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19029,14 +19223,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19029
19223
|
return true;
|
|
19030
19224
|
});
|
|
19031
19225
|
}
|
|
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
|
-
}
|
|
19040
19226
|
function setMediaStripItemLink(tree, index, link) {
|
|
19041
19227
|
return withMediaStrip(tree, (block) => {
|
|
19042
19228
|
const items = block.items;
|
|
@@ -19054,11 +19240,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19054
19240
|
});
|
|
19055
19241
|
}
|
|
19056
19242
|
|
|
19057
|
-
// src/ui/
|
|
19243
|
+
// src/ui/dialog.tsx
|
|
19244
|
+
var React9 = __toESM(require("react"), 1);
|
|
19245
|
+
var import_radix_ui6 = require("radix-ui");
|
|
19246
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19058
19247
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19248
|
+
function Dialog2({
|
|
19249
|
+
...props
|
|
19250
|
+
}) {
|
|
19251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19252
|
+
}
|
|
19253
|
+
function DialogPortal({
|
|
19254
|
+
...props
|
|
19255
|
+
}) {
|
|
19256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19257
|
+
}
|
|
19258
|
+
function DialogOverlay({
|
|
19259
|
+
className,
|
|
19260
|
+
...props
|
|
19261
|
+
}) {
|
|
19262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19263
|
+
import_radix_ui6.Dialog.Overlay,
|
|
19264
|
+
{
|
|
19265
|
+
"data-slot": "dialog-overlay",
|
|
19266
|
+
"data-ohw-link-modal-root": "",
|
|
19267
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19268
|
+
...props
|
|
19269
|
+
}
|
|
19270
|
+
);
|
|
19271
|
+
}
|
|
19272
|
+
var DialogContent = React9.forwardRef(
|
|
19273
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19274
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19276
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19277
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19278
|
+
import_radix_ui6.Dialog.Content,
|
|
19279
|
+
{
|
|
19280
|
+
ref,
|
|
19281
|
+
"data-slot": "dialog-content",
|
|
19282
|
+
className: cn(
|
|
19283
|
+
positionMode,
|
|
19284
|
+
"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",
|
|
19285
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19286
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19287
|
+
className
|
|
19288
|
+
),
|
|
19289
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19290
|
+
...props,
|
|
19291
|
+
children: [
|
|
19292
|
+
children,
|
|
19293
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19294
|
+
import_radix_ui6.Dialog.Close,
|
|
19295
|
+
{
|
|
19296
|
+
type: "button",
|
|
19297
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19298
|
+
"aria-label": "Close",
|
|
19299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19300
|
+
}
|
|
19301
|
+
) : null
|
|
19302
|
+
]
|
|
19303
|
+
}
|
|
19304
|
+
)
|
|
19305
|
+
] });
|
|
19306
|
+
}
|
|
19307
|
+
);
|
|
19308
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19309
|
+
function DialogHeader({
|
|
19310
|
+
className,
|
|
19311
|
+
...props
|
|
19312
|
+
}) {
|
|
19313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19314
|
+
}
|
|
19315
|
+
function DialogFooter({
|
|
19316
|
+
className,
|
|
19317
|
+
...props
|
|
19318
|
+
}) {
|
|
19319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19320
|
+
"div",
|
|
19321
|
+
{
|
|
19322
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19323
|
+
...props
|
|
19324
|
+
}
|
|
19325
|
+
);
|
|
19326
|
+
}
|
|
19327
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19328
|
+
import_radix_ui6.Dialog.Title,
|
|
19329
|
+
{
|
|
19330
|
+
ref,
|
|
19331
|
+
className: cn(
|
|
19332
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19333
|
+
className
|
|
19334
|
+
),
|
|
19335
|
+
...props
|
|
19336
|
+
}
|
|
19337
|
+
));
|
|
19338
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19339
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19340
|
+
import_radix_ui6.Dialog.Description,
|
|
19341
|
+
{
|
|
19342
|
+
ref,
|
|
19343
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19344
|
+
...props
|
|
19345
|
+
}
|
|
19346
|
+
));
|
|
19347
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19348
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19349
|
+
|
|
19350
|
+
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19351
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
19352
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19353
|
+
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]";
|
|
19062
19354
|
function findMediaStripItemElement(sectionId, index) {
|
|
19063
19355
|
const sectionEl = findByInstanceId(sectionId);
|
|
19064
19356
|
if (!sectionEl) return null;
|
|
@@ -19068,14 +19360,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19068
19360
|
}
|
|
19069
19361
|
return null;
|
|
19070
19362
|
}
|
|
19071
|
-
function
|
|
19072
|
-
|
|
19363
|
+
function itemRefFromTarget(target) {
|
|
19364
|
+
if (!(target instanceof Element)) return null;
|
|
19365
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19366
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19367
|
+
if (!itemEl) return null;
|
|
19368
|
+
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19369
|
+
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19370
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19371
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19372
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19373
|
+
return { sectionId, index };
|
|
19374
|
+
}
|
|
19375
|
+
function sameRef(a, b) {
|
|
19376
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19377
|
+
}
|
|
19378
|
+
function rectOf(el) {
|
|
19073
19379
|
if (!el) return null;
|
|
19074
19380
|
const r2 = el.getBoundingClientRect();
|
|
19075
19381
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19076
19382
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19077
19383
|
}
|
|
19078
|
-
function
|
|
19384
|
+
function readRect2(ref) {
|
|
19385
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19386
|
+
}
|
|
19387
|
+
function readStripRect(ref) {
|
|
19388
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19389
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19390
|
+
}
|
|
19391
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19079
19392
|
const [rect, setRect] = (0, import_react12.useState)(null);
|
|
19080
19393
|
(0, import_react12.useEffect)(() => {
|
|
19081
19394
|
if (!ref) {
|
|
@@ -19083,7 +19396,7 @@ function useLiveItemRect(ref) {
|
|
|
19083
19396
|
return;
|
|
19084
19397
|
}
|
|
19085
19398
|
const update = () => {
|
|
19086
|
-
const next = readRect2(ref);
|
|
19399
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19087
19400
|
setRect(
|
|
19088
19401
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19089
19402
|
);
|
|
@@ -19098,9 +19411,49 @@ function useLiveItemRect(ref) {
|
|
|
19098
19411
|
window.removeEventListener("resize", update);
|
|
19099
19412
|
clearInterval(interval);
|
|
19100
19413
|
};
|
|
19101
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19414
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19102
19415
|
return rect;
|
|
19103
19416
|
}
|
|
19417
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19418
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19419
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19420
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19421
|
+
const slotRef = (0, import_react12.useRef)(null);
|
|
19422
|
+
const [shift, setShift] = (0, import_react12.useState)(0);
|
|
19423
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19424
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
19425
|
+
const slot = slotRef.current;
|
|
19426
|
+
if (!slot) return;
|
|
19427
|
+
const clamp = () => {
|
|
19428
|
+
const w = slot.offsetWidth;
|
|
19429
|
+
if (w <= 0) return;
|
|
19430
|
+
const half = w / 2;
|
|
19431
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19432
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19433
|
+
};
|
|
19434
|
+
clamp();
|
|
19435
|
+
const ro = new ResizeObserver(clamp);
|
|
19436
|
+
ro.observe(slot);
|
|
19437
|
+
return () => ro.disconnect();
|
|
19438
|
+
}, [centerX, children]);
|
|
19439
|
+
const mobile = window.innerWidth <= 480;
|
|
19440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19441
|
+
"div",
|
|
19442
|
+
{
|
|
19443
|
+
ref: slotRef,
|
|
19444
|
+
"data-ohw-bridge": "",
|
|
19445
|
+
"data-ohw-item-interaction": "",
|
|
19446
|
+
className: "pointer-events-auto fixed",
|
|
19447
|
+
style: {
|
|
19448
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19449
|
+
left: centerX + shift,
|
|
19450
|
+
transform: "translate(-50%, -100%)",
|
|
19451
|
+
zIndex: 2147483645
|
|
19452
|
+
},
|
|
19453
|
+
children
|
|
19454
|
+
}
|
|
19455
|
+
);
|
|
19456
|
+
}
|
|
19104
19457
|
function requestValidateTree(postToParent2, tree) {
|
|
19105
19458
|
return new Promise((resolve) => {
|
|
19106
19459
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19137,116 +19490,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19137
19490
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19138
19491
|
});
|
|
19139
19492
|
}
|
|
19140
|
-
function
|
|
19493
|
+
function ToolbarAction({
|
|
19141
19494
|
label,
|
|
19142
19495
|
onClick,
|
|
19143
|
-
disabled,
|
|
19144
|
-
active
|
|
19496
|
+
disabled = false,
|
|
19497
|
+
active = false,
|
|
19498
|
+
children
|
|
19145
19499
|
}) {
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
{
|
|
19149
|
-
|
|
19150
|
-
|
|
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
|
-
);
|
|
19500
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19502
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
19503
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19504
|
+
] });
|
|
19173
19505
|
}
|
|
19174
|
-
function
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
|
|
19200
|
-
|
|
19201
|
-
|
|
19202
|
-
|
|
19203
|
-
},
|
|
19204
|
-
children: "Alt"
|
|
19205
|
-
}
|
|
19206
|
-
),
|
|
19207
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19208
|
-
"input",
|
|
19506
|
+
function ToolbarSeparator() {
|
|
19507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19508
|
+
}
|
|
19509
|
+
function OptionMenu({
|
|
19510
|
+
label,
|
|
19511
|
+
value,
|
|
19512
|
+
options,
|
|
19513
|
+
onChange
|
|
19514
|
+
}) {
|
|
19515
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19517
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19518
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
19519
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19520
|
+
"button",
|
|
19521
|
+
{
|
|
19522
|
+
type: "button",
|
|
19523
|
+
"aria-label": label,
|
|
19524
|
+
className: "inline-flex h-8 min-w-[76px] items-center gap-[7px] rounded-[6px] bg-transparent px-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted data-[state=open]:bg-muted",
|
|
19525
|
+
children: [
|
|
19526
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
19527
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
19528
|
+
]
|
|
19529
|
+
}
|
|
19530
|
+
) }),
|
|
19531
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19532
|
+
const selected = option.value === value;
|
|
19533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19534
|
+
DropdownMenuItem,
|
|
19209
19535
|
{
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
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
|
-
);
|
|
19536
|
+
role: "menuitemradio",
|
|
19537
|
+
"aria-checked": selected,
|
|
19538
|
+
onSelect: () => onChange(option.value),
|
|
19539
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19540
|
+
children: [
|
|
19541
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
|
|
19542
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
19543
|
+
]
|
|
19544
|
+
},
|
|
19545
|
+
option.value
|
|
19546
|
+
);
|
|
19547
|
+
}) })
|
|
19548
|
+
] })
|
|
19549
|
+
] });
|
|
19241
19550
|
}
|
|
19242
19551
|
var VARIANTS = [
|
|
19243
19552
|
{ value: "logos", label: "Logos" },
|
|
19244
19553
|
{ value: "reel", label: "Reel" }
|
|
19245
19554
|
];
|
|
19246
19555
|
var ALIGNS = [
|
|
19247
|
-
{ value: "left", label: "
|
|
19248
|
-
{ value: "center", label: "
|
|
19249
|
-
{ value: "right", label: "
|
|
19556
|
+
{ value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
|
|
19557
|
+
{ value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
|
|
19558
|
+
{ value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
|
|
19250
19559
|
];
|
|
19251
19560
|
var HOVERS = [
|
|
19252
19561
|
{ value: "none", label: "None" },
|
|
@@ -19254,104 +19563,104 @@ var HOVERS = [
|
|
|
19254
19563
|
{ value: "zoom", label: "Zoom" },
|
|
19255
19564
|
{ value: "fade", label: "Fade" }
|
|
19256
19565
|
];
|
|
19257
|
-
var TREATMENTS = [
|
|
19258
|
-
{ value: "color", label: "Color" },
|
|
19259
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19260
|
-
];
|
|
19261
19566
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19262
|
-
function
|
|
19263
|
-
|
|
19567
|
+
function LinkModal({
|
|
19568
|
+
href,
|
|
19569
|
+
linkTarget,
|
|
19570
|
+
onClose,
|
|
19571
|
+
onSave
|
|
19572
|
+
}) {
|
|
19573
|
+
const [draft, setDraft] = (0, import_react12.useState)(href);
|
|
19574
|
+
const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
|
|
19264
19575
|
const [invalid, setInvalid] = (0, import_react12.useState)(false);
|
|
19265
|
-
|
|
19266
|
-
setDraft(value);
|
|
19267
|
-
setInvalid(false);
|
|
19268
|
-
}, [value]);
|
|
19269
|
-
const commit2 = () => {
|
|
19576
|
+
const save = () => {
|
|
19270
19577
|
const next = draft.trim();
|
|
19271
|
-
if (next
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
onCommit(next);
|
|
19275
|
-
};
|
|
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
|
-
]
|
|
19578
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19579
|
+
setInvalid(true);
|
|
19580
|
+
return;
|
|
19340
19581
|
}
|
|
19341
|
-
|
|
19582
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19583
|
+
onClose();
|
|
19584
|
+
};
|
|
19585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
19586
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19587
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
19588
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19589
|
+
"input",
|
|
19590
|
+
{
|
|
19591
|
+
autoFocus: true,
|
|
19592
|
+
type: "text",
|
|
19593
|
+
inputMode: "url",
|
|
19594
|
+
value: draft,
|
|
19595
|
+
onChange: (e) => {
|
|
19596
|
+
setDraft(e.target.value);
|
|
19597
|
+
setInvalid(false);
|
|
19598
|
+
},
|
|
19599
|
+
onKeyDown: (e) => {
|
|
19600
|
+
if (e.key === "Enter") save();
|
|
19601
|
+
},
|
|
19602
|
+
placeholder: "https://example.com",
|
|
19603
|
+
"aria-label": "Image link URL",
|
|
19604
|
+
"aria-invalid": invalid,
|
|
19605
|
+
className: cn(
|
|
19606
|
+
"h-9 w-full rounded-[6px] border border-border bg-background px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:border-bridge-primary",
|
|
19607
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19608
|
+
)
|
|
19609
|
+
}
|
|
19610
|
+
),
|
|
19611
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19612
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19613
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19614
|
+
"Open in new tab"
|
|
19615
|
+
] })
|
|
19616
|
+
] }),
|
|
19617
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
|
|
19618
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19619
|
+
"button",
|
|
19620
|
+
{
|
|
19621
|
+
type: "button",
|
|
19622
|
+
onClick: () => {
|
|
19623
|
+
onSave("", "new-tab");
|
|
19624
|
+
onClose();
|
|
19625
|
+
},
|
|
19626
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19627
|
+
children: "Remove link"
|
|
19628
|
+
}
|
|
19629
|
+
),
|
|
19630
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19631
|
+
"button",
|
|
19632
|
+
{
|
|
19633
|
+
type: "button",
|
|
19634
|
+
onClick: onClose,
|
|
19635
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19636
|
+
children: "Cancel"
|
|
19637
|
+
}
|
|
19638
|
+
),
|
|
19639
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19640
|
+
"button",
|
|
19641
|
+
{
|
|
19642
|
+
type: "button",
|
|
19643
|
+
onClick: save,
|
|
19644
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19645
|
+
children: "Save"
|
|
19646
|
+
}
|
|
19647
|
+
)
|
|
19648
|
+
] })
|
|
19649
|
+
] }) });
|
|
19342
19650
|
}
|
|
19343
19651
|
function MediaStripToolbar({
|
|
19344
19652
|
entry,
|
|
19345
19653
|
index,
|
|
19346
19654
|
pending,
|
|
19347
19655
|
error,
|
|
19656
|
+
itemEditOn,
|
|
19657
|
+
onToggleItemEdit,
|
|
19348
19658
|
onSetVariant,
|
|
19349
19659
|
onSetAlign,
|
|
19350
19660
|
onSetHover,
|
|
19351
19661
|
onSetTreatment,
|
|
19352
19662
|
onResize,
|
|
19353
|
-
|
|
19354
|
-
onSetLink,
|
|
19663
|
+
onOpenLink,
|
|
19355
19664
|
onAddItem,
|
|
19356
19665
|
onRemoveItem,
|
|
19357
19666
|
onChangeImage,
|
|
@@ -19360,81 +19669,102 @@ function MediaStripToolbar({
|
|
|
19360
19669
|
}) {
|
|
19361
19670
|
const items = mediaStripItems(entry.tree);
|
|
19362
19671
|
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";
|
|
19366
19672
|
const slots = findMediaStripSlots(entry.tree);
|
|
19367
19673
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19368
19674
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19369
19675
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19370
19676
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19371
19677
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19372
|
-
const
|
|
19373
|
-
const
|
|
19374
|
-
|
|
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)(
|
|
19678
|
+
const mobile = window.innerWidth <= 480;
|
|
19679
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19384
19681
|
"div",
|
|
19385
19682
|
{
|
|
19386
19683
|
"data-ohw-bridge": "",
|
|
19387
19684
|
"data-ohw-toolbar": "",
|
|
19388
19685
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19389
|
-
|
|
19390
|
-
|
|
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
|
-
},
|
|
19686
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19687
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19402
19688
|
children: [
|
|
19403
|
-
/* @__PURE__ */ (0,
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19433
|
-
|
|
19434
|
-
|
|
19689
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19690
|
+
"div",
|
|
19691
|
+
{
|
|
19692
|
+
className: cn(
|
|
19693
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19694
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19695
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19696
|
+
),
|
|
19697
|
+
children: [
|
|
19698
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19699
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19700
|
+
CustomToolbarButton,
|
|
19701
|
+
{
|
|
19702
|
+
type: "button",
|
|
19703
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19704
|
+
"aria-pressed": itemEditOn,
|
|
19705
|
+
onClick: onToggleItemEdit,
|
|
19706
|
+
className: "group size-8",
|
|
19707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19708
|
+
import_lucide_react9.Star,
|
|
19709
|
+
{
|
|
19710
|
+
size: 16,
|
|
19711
|
+
fill: "currentColor",
|
|
19712
|
+
strokeWidth: 0,
|
|
19713
|
+
className: cn(
|
|
19714
|
+
"transition-colors",
|
|
19715
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19716
|
+
),
|
|
19717
|
+
style: { pointerEvents: "none" }
|
|
19718
|
+
}
|
|
19719
|
+
)
|
|
19720
|
+
}
|
|
19721
|
+
) }),
|
|
19722
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19723
|
+
] }),
|
|
19724
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19725
|
+
/* @__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" } }) }),
|
|
19726
|
+
/* @__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" } }) }),
|
|
19727
|
+
/* @__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" } }) }),
|
|
19728
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19729
|
+
ToolbarAction,
|
|
19730
|
+
{
|
|
19731
|
+
label: gatedLabel("Move right"),
|
|
19732
|
+
onClick: onMoveRight,
|
|
19733
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19734
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
19735
|
+
}
|
|
19736
|
+
),
|
|
19737
|
+
/* @__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" } }) }),
|
|
19738
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19739
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19740
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19741
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19742
|
+
ToolbarAction,
|
|
19743
|
+
{
|
|
19744
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19745
|
+
active: treatment === "grayscale",
|
|
19746
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19748
|
+
}
|
|
19749
|
+
),
|
|
19750
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19751
|
+
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)),
|
|
19752
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19753
|
+
/* @__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" } }) }),
|
|
19754
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19755
|
+
sizeValue,
|
|
19756
|
+
"px"
|
|
19757
|
+
] }),
|
|
19758
|
+
/* @__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" } }) }),
|
|
19759
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19760
|
+
/* @__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" } }) })
|
|
19761
|
+
]
|
|
19762
|
+
}
|
|
19763
|
+
),
|
|
19764
|
+
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 })
|
|
19435
19765
|
]
|
|
19436
19766
|
}
|
|
19437
|
-
);
|
|
19767
|
+
) });
|
|
19438
19768
|
}
|
|
19439
19769
|
function findMediaStripSlots(tree) {
|
|
19440
19770
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19453,31 +19783,23 @@ function AiMediaStripOverlay({
|
|
|
19453
19783
|
}) {
|
|
19454
19784
|
const [hover, setHover] = (0, import_react12.useState)(null);
|
|
19455
19785
|
const [active, setActive] = (0, import_react12.useState)(null);
|
|
19786
|
+
const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
|
|
19787
|
+
const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
|
|
19456
19788
|
const [pending, setPending] = (0, import_react12.useState)(false);
|
|
19457
19789
|
const [error, setError] = (0, import_react12.useState)(null);
|
|
19458
19790
|
const activeRef = (0, import_react12.useRef)(null);
|
|
19459
19791
|
activeRef.current = active;
|
|
19792
|
+
const linkOpenRef = (0, import_react12.useRef)(false);
|
|
19793
|
+
linkOpenRef.current = linkOpen;
|
|
19460
19794
|
(0, import_react12.useEffect)(() => {
|
|
19461
19795
|
const onMove = (e) => {
|
|
19796
|
+
const ref = itemRefFromTarget(e.target);
|
|
19462
19797
|
const t = e.target;
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
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 });
|
|
19798
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19799
|
+
setHover((prev) => {
|
|
19800
|
+
const next = ref && !overEditable ? ref : null;
|
|
19801
|
+
return sameRef(prev, next) ? prev : next;
|
|
19802
|
+
});
|
|
19481
19803
|
};
|
|
19482
19804
|
const onLeave = () => setHover(null);
|
|
19483
19805
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19489,23 +19811,25 @@ function AiMediaStripOverlay({
|
|
|
19489
19811
|
}, []);
|
|
19490
19812
|
(0, import_react12.useEffect)(() => {
|
|
19491
19813
|
const onClick = (e) => {
|
|
19492
|
-
const current = activeRef.current;
|
|
19493
|
-
if (!current) return;
|
|
19494
19814
|
const t = e.target;
|
|
19495
|
-
if (!(t instanceof
|
|
19496
|
-
if (t.closest(
|
|
19497
|
-
const
|
|
19498
|
-
if (
|
|
19499
|
-
|
|
19815
|
+
if (!(t instanceof Element)) return;
|
|
19816
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19817
|
+
const ref = itemRefFromTarget(t);
|
|
19818
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19819
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19820
|
+
setItemEditOn(false);
|
|
19500
19821
|
setError(null);
|
|
19822
|
+
setActive(ref);
|
|
19501
19823
|
};
|
|
19502
19824
|
document.addEventListener("click", onClick, true);
|
|
19503
19825
|
return () => document.removeEventListener("click", onClick, true);
|
|
19504
|
-
}, []);
|
|
19826
|
+
}, [clearInteractionChromeRef]);
|
|
19505
19827
|
(0, import_react12.useEffect)(() => {
|
|
19506
19828
|
const onBlur = () => {
|
|
19507
19829
|
if (!activeRef.current) return;
|
|
19508
19830
|
setActive(null);
|
|
19831
|
+
setItemEditOn(false);
|
|
19832
|
+
setLinkOpen(false);
|
|
19509
19833
|
setError(null);
|
|
19510
19834
|
};
|
|
19511
19835
|
window.addEventListener("blur", onBlur);
|
|
@@ -19515,7 +19839,10 @@ function AiMediaStripOverlay({
|
|
|
19515
19839
|
const onKeyDown = (e) => {
|
|
19516
19840
|
if (e.key !== "Escape") return;
|
|
19517
19841
|
if (!activeRef.current) return;
|
|
19842
|
+
if (linkOpenRef.current) return;
|
|
19843
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19518
19844
|
setActive(null);
|
|
19845
|
+
setItemEditOn(false);
|
|
19519
19846
|
setError(null);
|
|
19520
19847
|
};
|
|
19521
19848
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19549,137 +19876,133 @@ function AiMediaStripOverlay({
|
|
|
19549
19876
|
tree: nextTree,
|
|
19550
19877
|
label: entry.label,
|
|
19551
19878
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19552
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19879
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
19880
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19881
|
+
// on every edit reads as the section jumping around.
|
|
19882
|
+
skipScrollIntoView: true
|
|
19553
19883
|
});
|
|
19554
19884
|
return true;
|
|
19555
19885
|
},
|
|
19556
19886
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19557
19887
|
);
|
|
19558
19888
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19559
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19560
19889
|
const activeItemRect = useLiveItemRect(active);
|
|
19561
|
-
const
|
|
19562
|
-
const
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
|
|
19590
|
-
|
|
19591
|
-
|
|
19592
|
-
|
|
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) => {
|
|
19890
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
19891
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
19892
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
19893
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
19894
|
+
const activeHref = activeItem?.href ?? "";
|
|
19895
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
19897
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
19898
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
19899
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
19900
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19901
|
+
MediaStripToolbar,
|
|
19902
|
+
{
|
|
19903
|
+
entry: activeEntry,
|
|
19904
|
+
index: active.index,
|
|
19905
|
+
pending,
|
|
19906
|
+
error,
|
|
19907
|
+
itemEditOn,
|
|
19908
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
19909
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19910
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19911
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19912
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19913
|
+
onResize: (delta) => {
|
|
19914
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19915
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19916
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19917
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19918
|
+
},
|
|
19919
|
+
onOpenLink: () => setLinkOpen(true),
|
|
19920
|
+
onAddItem: () => {
|
|
19921
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19922
|
+
if (!picked) return;
|
|
19923
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19621
19924
|
void runMutation(
|
|
19622
19925
|
active.sectionId,
|
|
19623
|
-
(tree) =>
|
|
19624
|
-
|
|
19625
|
-
|
|
19626
|
-
|
|
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
|
-
});
|
|
19926
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19927
|
+
{ [picked.assetId]: picked.url }
|
|
19928
|
+
).then((applied) => {
|
|
19929
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19637
19930
|
});
|
|
19638
|
-
}
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
19644
|
-
|
|
19645
|
-
|
|
19646
|
-
|
|
19647
|
-
});
|
|
19648
|
-
},
|
|
19649
|
-
onRemoveItem: () => {
|
|
19650
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19651
|
-
(applied) => {
|
|
19652
|
-
if (applied) setActive(null);
|
|
19653
|
-
}
|
|
19654
|
-
);
|
|
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
|
-
}
|
|
19931
|
+
});
|
|
19932
|
+
},
|
|
19933
|
+
onChangeImage: () => {
|
|
19934
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19935
|
+
if (!picked) return;
|
|
19936
|
+
void runMutation(
|
|
19937
|
+
active.sectionId,
|
|
19938
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19939
|
+
{ [picked.assetId]: picked.url }
|
|
19668
19940
|
);
|
|
19669
|
-
}
|
|
19941
|
+
});
|
|
19942
|
+
},
|
|
19943
|
+
onRemoveItem: () => {
|
|
19944
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19945
|
+
(applied) => {
|
|
19946
|
+
if (applied) setActive(null);
|
|
19947
|
+
}
|
|
19948
|
+
);
|
|
19949
|
+
},
|
|
19950
|
+
onMoveLeft: () => {
|
|
19951
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19952
|
+
(applied) => {
|
|
19953
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19954
|
+
}
|
|
19955
|
+
);
|
|
19956
|
+
},
|
|
19957
|
+
onMoveRight: () => {
|
|
19958
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19959
|
+
(applied) => {
|
|
19960
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19961
|
+
}
|
|
19962
|
+
);
|
|
19670
19963
|
}
|
|
19671
|
-
|
|
19672
|
-
}
|
|
19673
|
-
|
|
19964
|
+
}
|
|
19965
|
+
) }),
|
|
19966
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19967
|
+
"div",
|
|
19968
|
+
{
|
|
19969
|
+
"data-ohw-bridge": "",
|
|
19970
|
+
"data-ohw-item-interaction": "",
|
|
19971
|
+
"aria-hidden": true,
|
|
19972
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
19973
|
+
style: {
|
|
19974
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
19975
|
+
left: activeItemRect.left - 5,
|
|
19976
|
+
background: PRIMARY3,
|
|
19977
|
+
zIndex: 2147483644
|
|
19978
|
+
},
|
|
19979
|
+
children: "Media item"
|
|
19980
|
+
}
|
|
19981
|
+
),
|
|
19982
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19983
|
+
LinkModal,
|
|
19984
|
+
{
|
|
19985
|
+
href: activeHref,
|
|
19986
|
+
linkTarget: activeTarget,
|
|
19987
|
+
onClose: () => setLinkOpen(false),
|
|
19988
|
+
onSave: (href, linkTarget) => {
|
|
19989
|
+
void runMutation(
|
|
19990
|
+
active.sectionId,
|
|
19991
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
19992
|
+
);
|
|
19993
|
+
}
|
|
19994
|
+
}
|
|
19995
|
+
)
|
|
19996
|
+
] })
|
|
19674
19997
|
] });
|
|
19675
19998
|
}
|
|
19676
19999
|
|
|
19677
20000
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19678
20001
|
var import_react13 = require("react");
|
|
19679
|
-
var
|
|
19680
|
-
var
|
|
20002
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20003
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
19681
20004
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19682
|
-
var
|
|
20005
|
+
var CHROME_SELECTOR2 = "[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]";
|
|
19683
20006
|
function findPricingCardElement(sectionId, index) {
|
|
19684
20007
|
const sectionEl = findByInstanceId(sectionId);
|
|
19685
20008
|
if (!sectionEl) return null;
|
|
@@ -19691,7 +20014,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19691
20014
|
}
|
|
19692
20015
|
function cardRefFromTarget(target) {
|
|
19693
20016
|
if (!(target instanceof Element)) return null;
|
|
19694
|
-
if (target.closest(
|
|
20017
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19695
20018
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19696
20019
|
if (!cardEl) return null;
|
|
19697
20020
|
const sectionEl = cardEl.closest("[data-ohw-section]");
|
|
@@ -19701,21 +20024,21 @@ function cardRefFromTarget(target) {
|
|
|
19701
20024
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19702
20025
|
return { sectionId, index };
|
|
19703
20026
|
}
|
|
19704
|
-
function
|
|
20027
|
+
function sameRef2(a, b) {
|
|
19705
20028
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19706
20029
|
}
|
|
19707
|
-
function
|
|
20030
|
+
function rectOf2(el) {
|
|
19708
20031
|
if (!el) return null;
|
|
19709
20032
|
const r2 = el.getBoundingClientRect();
|
|
19710
20033
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19711
20034
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19712
20035
|
}
|
|
19713
20036
|
function readRect3(ref) {
|
|
19714
|
-
return
|
|
20037
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19715
20038
|
}
|
|
19716
20039
|
function readGridRect(ref) {
|
|
19717
20040
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19718
|
-
return
|
|
20041
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19719
20042
|
}
|
|
19720
20043
|
function useLiveCardRect(ref, grid = false) {
|
|
19721
20044
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
@@ -19745,7 +20068,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19745
20068
|
}
|
|
19746
20069
|
var TOOLBAR_GRID_GAP = 52;
|
|
19747
20070
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19748
|
-
var
|
|
20071
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19749
20072
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19750
20073
|
const slotRef = (0, import_react13.useRef)(null);
|
|
19751
20074
|
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
@@ -19757,7 +20080,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19757
20080
|
const w = slot.offsetWidth;
|
|
19758
20081
|
if (w <= 0) return;
|
|
19759
20082
|
const half = w / 2;
|
|
19760
|
-
const clamped = Math.max(
|
|
20083
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19761
20084
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19762
20085
|
};
|
|
19763
20086
|
clamp();
|
|
@@ -19766,7 +20089,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19766
20089
|
return () => ro.disconnect();
|
|
19767
20090
|
}, [centerX, children]);
|
|
19768
20091
|
const mobile = window.innerWidth <= 480;
|
|
19769
|
-
return /* @__PURE__ */ (0,
|
|
20092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19770
20093
|
"div",
|
|
19771
20094
|
{
|
|
19772
20095
|
ref: slotRef,
|
|
@@ -19801,7 +20124,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19801
20124
|
});
|
|
19802
20125
|
}
|
|
19803
20126
|
function StyleSwatch({ style }) {
|
|
19804
|
-
return /* @__PURE__ */ (0,
|
|
20127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19805
20128
|
"span",
|
|
19806
20129
|
{
|
|
19807
20130
|
"aria-hidden": true,
|
|
@@ -19815,35 +20138,35 @@ function StyleSwatch({ style }) {
|
|
|
19815
20138
|
);
|
|
19816
20139
|
}
|
|
19817
20140
|
function ButtonGlyph() {
|
|
19818
|
-
return /* @__PURE__ */ (0,
|
|
19819
|
-
/* @__PURE__ */ (0,
|
|
19820
|
-
/* @__PURE__ */ (0,
|
|
20141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20142
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20143
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19821
20144
|
] });
|
|
19822
20145
|
}
|
|
19823
20146
|
function FeatureGlyph({ mode }) {
|
|
19824
|
-
return /* @__PURE__ */ (0,
|
|
19825
|
-
/* @__PURE__ */ (0,
|
|
19826
|
-
/* @__PURE__ */ (0,
|
|
19827
|
-
/* @__PURE__ */ (0,
|
|
19828
|
-
/* @__PURE__ */ (0,
|
|
19829
|
-
/* @__PURE__ */ (0,
|
|
19830
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
20147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20148
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20149
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20150
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20151
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20152
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20153
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19831
20154
|
] });
|
|
19832
20155
|
}
|
|
19833
|
-
function
|
|
20156
|
+
function ToolbarAction2({
|
|
19834
20157
|
label,
|
|
19835
20158
|
onClick,
|
|
19836
20159
|
disabled = false,
|
|
19837
20160
|
children
|
|
19838
20161
|
}) {
|
|
19839
|
-
const button = /* @__PURE__ */ (0,
|
|
19840
|
-
return /* @__PURE__ */ (0,
|
|
19841
|
-
/* @__PURE__ */ (0,
|
|
19842
|
-
/* @__PURE__ */ (0,
|
|
20162
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20164
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20165
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19843
20166
|
] });
|
|
19844
20167
|
}
|
|
19845
|
-
function
|
|
19846
|
-
return /* @__PURE__ */ (0,
|
|
20168
|
+
function ToolbarSeparator2() {
|
|
20169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19847
20170
|
}
|
|
19848
20171
|
function CardStyleMenu({
|
|
19849
20172
|
value,
|
|
@@ -19851,7 +20174,7 @@ function CardStyleMenu({
|
|
|
19851
20174
|
disabled = false
|
|
19852
20175
|
}) {
|
|
19853
20176
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19854
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20177
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19855
20178
|
"button",
|
|
19856
20179
|
{
|
|
19857
20180
|
type: "button",
|
|
@@ -19862,28 +20185,28 @@ function CardStyleMenu({
|
|
|
19862
20185
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19863
20186
|
),
|
|
19864
20187
|
children: [
|
|
19865
|
-
/* @__PURE__ */ (0,
|
|
19866
|
-
/* @__PURE__ */ (0,
|
|
19867
|
-
/* @__PURE__ */ (0,
|
|
20188
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
|
|
20189
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20190
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
19868
20191
|
]
|
|
19869
20192
|
}
|
|
19870
20193
|
);
|
|
19871
20194
|
if (disabled) {
|
|
19872
|
-
return /* @__PURE__ */ (0,
|
|
19873
|
-
/* @__PURE__ */ (0,
|
|
19874
|
-
/* @__PURE__ */ (0,
|
|
19875
|
-
/* @__PURE__ */ (0,
|
|
19876
|
-
/* @__PURE__ */ (0,
|
|
20195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20196
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20197
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20198
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20199
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19877
20200
|
] })
|
|
19878
20201
|
] });
|
|
19879
20202
|
}
|
|
19880
|
-
return /* @__PURE__ */ (0,
|
|
19881
|
-
/* @__PURE__ */ (0,
|
|
19882
|
-
/* @__PURE__ */ (0,
|
|
19883
|
-
/* @__PURE__ */ (0,
|
|
19884
|
-
/* @__PURE__ */ (0,
|
|
20203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20204
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20205
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20206
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20207
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19885
20208
|
const selected = style.value === value;
|
|
19886
|
-
return /* @__PURE__ */ (0,
|
|
20209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19887
20210
|
DropdownMenuItem,
|
|
19888
20211
|
{
|
|
19889
20212
|
role: "menuitemradio",
|
|
@@ -19891,9 +20214,9 @@ function CardStyleMenu({
|
|
|
19891
20214
|
onSelect: () => onChange(style.value),
|
|
19892
20215
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19893
20216
|
children: [
|
|
19894
|
-
/* @__PURE__ */ (0,
|
|
19895
|
-
/* @__PURE__ */ (0,
|
|
19896
|
-
selected && /* @__PURE__ */ (0,
|
|
20217
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
|
|
20218
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
|
|
20219
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
|
|
19897
20220
|
]
|
|
19898
20221
|
},
|
|
19899
20222
|
style.value
|
|
@@ -19923,7 +20246,7 @@ function PricingCardToolbar({
|
|
|
19923
20246
|
const style = pricingCardStyle(entry.tree, index);
|
|
19924
20247
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19925
20248
|
const mobile = window.innerWidth <= 480;
|
|
19926
|
-
return /* @__PURE__ */ (0,
|
|
20249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19927
20250
|
"div",
|
|
19928
20251
|
{
|
|
19929
20252
|
"data-ohw-bridge": "",
|
|
@@ -19935,7 +20258,7 @@ function PricingCardToolbar({
|
|
|
19935
20258
|
),
|
|
19936
20259
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19937
20260
|
children: [
|
|
19938
|
-
/* @__PURE__ */ (0,
|
|
20261
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19939
20262
|
"div",
|
|
19940
20263
|
{
|
|
19941
20264
|
className: cn(
|
|
@@ -19944,8 +20267,8 @@ function PricingCardToolbar({
|
|
|
19944
20267
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19945
20268
|
),
|
|
19946
20269
|
children: [
|
|
19947
|
-
/* @__PURE__ */ (0,
|
|
19948
|
-
/* @__PURE__ */ (0,
|
|
20270
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20271
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19949
20272
|
CustomToolbarButton,
|
|
19950
20273
|
{
|
|
19951
20274
|
type: "button",
|
|
@@ -19953,8 +20276,8 @@ function PricingCardToolbar({
|
|
|
19953
20276
|
"aria-pressed": featuredTag,
|
|
19954
20277
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19955
20278
|
className: "group size-8",
|
|
19956
|
-
children: /* @__PURE__ */ (0,
|
|
19957
|
-
|
|
20279
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20280
|
+
import_lucide_react10.Star,
|
|
19958
20281
|
{
|
|
19959
20282
|
size: 16,
|
|
19960
20283
|
fill: "currentColor",
|
|
@@ -19968,25 +20291,25 @@ function PricingCardToolbar({
|
|
|
19968
20291
|
)
|
|
19969
20292
|
}
|
|
19970
20293
|
) }),
|
|
19971
|
-
/* @__PURE__ */ (0,
|
|
20294
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
19972
20295
|
] }),
|
|
19973
|
-
/* @__PURE__ */ (0,
|
|
19974
|
-
/* @__PURE__ */ (0,
|
|
19975
|
-
/* @__PURE__ */ (0,
|
|
19976
|
-
/* @__PURE__ */ (0,
|
|
19977
|
-
/* @__PURE__ */ (0,
|
|
19978
|
-
/* @__PURE__ */ (0,
|
|
19979
|
-
/* @__PURE__ */ (0,
|
|
20296
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20297
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20298
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20299
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
|
|
20300
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
|
|
20301
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
|
|
20302
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
19980
20303
|
] }) }),
|
|
19981
|
-
/* @__PURE__ */ (0,
|
|
19982
|
-
/* @__PURE__ */ (0,
|
|
19983
|
-
/* @__PURE__ */ (0,
|
|
19984
|
-
/* @__PURE__ */ (0,
|
|
19985
|
-
/* @__PURE__ */ (0,
|
|
20304
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
|
|
20305
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
|
|
20306
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20307
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20308
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19986
20309
|
]
|
|
19987
20310
|
}
|
|
19988
20311
|
),
|
|
19989
|
-
error && /* @__PURE__ */ (0,
|
|
20312
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19990
20313
|
]
|
|
19991
20314
|
}
|
|
19992
20315
|
) });
|
|
@@ -20020,7 +20343,7 @@ function AiPricingCardOverlay({
|
|
|
20020
20343
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20021
20344
|
setHover((prev) => {
|
|
20022
20345
|
const next = ref && !overEditable ? ref : null;
|
|
20023
|
-
return
|
|
20346
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20024
20347
|
});
|
|
20025
20348
|
};
|
|
20026
20349
|
const onLeave = () => setHover(null);
|
|
@@ -20035,10 +20358,10 @@ function AiPricingCardOverlay({
|
|
|
20035
20358
|
const onClick = (e) => {
|
|
20036
20359
|
const t = e.target;
|
|
20037
20360
|
if (!(t instanceof Element)) return;
|
|
20038
|
-
if (t.closest(
|
|
20361
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20039
20362
|
const ref = cardRefFromTarget(t);
|
|
20040
|
-
setActive((prev) =>
|
|
20041
|
-
if (!ref || !
|
|
20363
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20364
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20042
20365
|
};
|
|
20043
20366
|
document.addEventListener("click", onClick, true);
|
|
20044
20367
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20103,12 +20426,12 @@ function AiPricingCardOverlay({
|
|
|
20103
20426
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20104
20427
|
const activeCardRect = useLiveCardRect(active);
|
|
20105
20428
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20106
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20107
|
-
return /* @__PURE__ */ (0,
|
|
20108
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20109
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20110
|
-
/* @__PURE__ */ (0,
|
|
20111
|
-
/* @__PURE__ */ (0,
|
|
20429
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20431
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20432
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20433
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20434
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20112
20435
|
PricingCardToolbar,
|
|
20113
20436
|
{
|
|
20114
20437
|
entry: activeEntry,
|
|
@@ -20136,7 +20459,7 @@ function AiPricingCardOverlay({
|
|
|
20136
20459
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20137
20460
|
}
|
|
20138
20461
|
) }),
|
|
20139
|
-
/* @__PURE__ */ (0,
|
|
20462
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20140
20463
|
"div",
|
|
20141
20464
|
{
|
|
20142
20465
|
"data-ohw-bridge": "",
|
|
@@ -20158,7 +20481,7 @@ function AiPricingCardOverlay({
|
|
|
20158
20481
|
|
|
20159
20482
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20160
20483
|
var import_react14 = require("react");
|
|
20161
|
-
var
|
|
20484
|
+
var import_lucide_react11 = require("lucide-react");
|
|
20162
20485
|
|
|
20163
20486
|
// src/lib/ai-video-tree.ts
|
|
20164
20487
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20200,39 +20523,11 @@ function clearVideo(tree, path) {
|
|
|
20200
20523
|
});
|
|
20201
20524
|
}
|
|
20202
20525
|
|
|
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
|
-
|
|
20231
20526
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20232
|
-
var
|
|
20527
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
20233
20528
|
var PRIMARY5 = "#0885FE";
|
|
20234
|
-
var
|
|
20235
|
-
var
|
|
20529
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20530
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20236
20531
|
function findVideoBlockElement(sectionId, path) {
|
|
20237
20532
|
const sectionEl = findByInstanceId(sectionId);
|
|
20238
20533
|
if (!sectionEl) return null;
|
|
@@ -20292,12 +20587,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20292
20587
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20293
20588
|
});
|
|
20294
20589
|
}
|
|
20295
|
-
function
|
|
20590
|
+
function Pill({
|
|
20296
20591
|
label,
|
|
20297
20592
|
onClick,
|
|
20298
20593
|
disabled
|
|
20299
20594
|
}) {
|
|
20300
|
-
return /* @__PURE__ */ (0,
|
|
20595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20301
20596
|
"button",
|
|
20302
20597
|
{
|
|
20303
20598
|
type: "button",
|
|
@@ -20313,7 +20608,7 @@ function Pill2({
|
|
|
20313
20608
|
border: "none",
|
|
20314
20609
|
cursor: disabled ? "default" : "pointer",
|
|
20315
20610
|
background: "#ffffff",
|
|
20316
|
-
color:
|
|
20611
|
+
color: OHW_BLUE_DARK,
|
|
20317
20612
|
opacity: disabled ? 0.4 : 1,
|
|
20318
20613
|
fontSize: 12,
|
|
20319
20614
|
lineHeight: "16px",
|
|
@@ -20356,8 +20651,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20356
20651
|
onCommit(id);
|
|
20357
20652
|
}
|
|
20358
20653
|
};
|
|
20359
|
-
return /* @__PURE__ */ (0,
|
|
20360
|
-
/* @__PURE__ */ (0,
|
|
20654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20655
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20361
20656
|
"div",
|
|
20362
20657
|
{
|
|
20363
20658
|
style: {
|
|
@@ -20373,12 +20668,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20373
20668
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20374
20669
|
},
|
|
20375
20670
|
children: [
|
|
20376
|
-
/* @__PURE__ */ (0,
|
|
20671
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20377
20672
|
"span",
|
|
20378
20673
|
{
|
|
20379
20674
|
style: {
|
|
20380
20675
|
flex: "0 0 auto",
|
|
20381
|
-
color:
|
|
20676
|
+
color: OHW_BLUE_DARK,
|
|
20382
20677
|
fontSize: 10,
|
|
20383
20678
|
lineHeight: "16px",
|
|
20384
20679
|
fontWeight: 700,
|
|
@@ -20388,7 +20683,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20388
20683
|
children: "Video"
|
|
20389
20684
|
}
|
|
20390
20685
|
),
|
|
20391
|
-
/* @__PURE__ */ (0,
|
|
20686
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20392
20687
|
"input",
|
|
20393
20688
|
{
|
|
20394
20689
|
type: "text",
|
|
@@ -20425,7 +20720,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20425
20720
|
]
|
|
20426
20721
|
}
|
|
20427
20722
|
),
|
|
20428
|
-
invalid && /* @__PURE__ */ (0,
|
|
20723
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime23.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." })
|
|
20429
20724
|
] });
|
|
20430
20725
|
}
|
|
20431
20726
|
function VideoToolbar({
|
|
@@ -20435,7 +20730,7 @@ function VideoToolbar({
|
|
|
20435
20730
|
onSetVideoId,
|
|
20436
20731
|
onRemove
|
|
20437
20732
|
}) {
|
|
20438
|
-
return /* @__PURE__ */ (0,
|
|
20733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20439
20734
|
"div",
|
|
20440
20735
|
{
|
|
20441
20736
|
"data-ohw-bridge": "",
|
|
@@ -20447,7 +20742,7 @@ function VideoToolbar({
|
|
|
20447
20742
|
gap: 6,
|
|
20448
20743
|
alignItems: "center",
|
|
20449
20744
|
width: 280,
|
|
20450
|
-
background:
|
|
20745
|
+
background: OHW_BLUE,
|
|
20451
20746
|
padding: 8,
|
|
20452
20747
|
borderRadius: 12,
|
|
20453
20748
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20455,9 +20750,9 @@ function VideoToolbar({
|
|
|
20455
20750
|
opacity: pending ? 0.6 : 1
|
|
20456
20751
|
},
|
|
20457
20752
|
children: [
|
|
20458
|
-
/* @__PURE__ */ (0,
|
|
20459
|
-
/* @__PURE__ */ (0,
|
|
20460
|
-
error && /* @__PURE__ */ (0,
|
|
20753
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20754
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20755
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20461
20756
|
]
|
|
20462
20757
|
}
|
|
20463
20758
|
);
|
|
@@ -20577,8 +20872,8 @@ function AiVideoOverlay({
|
|
|
20577
20872
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20578
20873
|
const TOOLBAR_APPROX_H = 90;
|
|
20579
20874
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20580
|
-
return /* @__PURE__ */ (0,
|
|
20581
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
20875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
20876
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20582
20877
|
"button",
|
|
20583
20878
|
{
|
|
20584
20879
|
type: "button",
|
|
@@ -20606,15 +20901,15 @@ function AiVideoOverlay({
|
|
|
20606
20901
|
fontSize: 14,
|
|
20607
20902
|
fontWeight: 700
|
|
20608
20903
|
},
|
|
20609
|
-
children: /* @__PURE__ */ (0,
|
|
20904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
20610
20905
|
}
|
|
20611
20906
|
),
|
|
20612
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20907
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20613
20908
|
ItemInteractionLayer,
|
|
20614
20909
|
{
|
|
20615
20910
|
rect: activeBlockRect,
|
|
20616
20911
|
state: toolbarState,
|
|
20617
|
-
toolbar: /* @__PURE__ */ (0,
|
|
20912
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20618
20913
|
VideoToolbar,
|
|
20619
20914
|
{
|
|
20620
20915
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20638,7 +20933,7 @@ function AiVideoOverlay({
|
|
|
20638
20933
|
|
|
20639
20934
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20640
20935
|
var import_react15 = require("react");
|
|
20641
|
-
var
|
|
20936
|
+
var import_lucide_react12 = require("lucide-react");
|
|
20642
20937
|
|
|
20643
20938
|
// src/lib/ai-carousel-tree.ts
|
|
20644
20939
|
function isCarouselBlock(node) {
|
|
@@ -20689,10 +20984,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20689
20984
|
}
|
|
20690
20985
|
|
|
20691
20986
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20692
|
-
var
|
|
20987
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
20693
20988
|
var PRIMARY6 = "#0885FE";
|
|
20694
|
-
var
|
|
20695
|
-
var
|
|
20989
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
20990
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20696
20991
|
function findCarouselItemElement(sectionId, index) {
|
|
20697
20992
|
const sectionEl = findByInstanceId(sectionId);
|
|
20698
20993
|
if (!sectionEl) return null;
|
|
@@ -20771,8 +21066,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20771
21066
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20772
21067
|
});
|
|
20773
21068
|
}
|
|
20774
|
-
function
|
|
20775
|
-
return /* @__PURE__ */ (0,
|
|
21069
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20776
21071
|
"button",
|
|
20777
21072
|
{
|
|
20778
21073
|
type: "button",
|
|
@@ -20788,7 +21083,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20788
21083
|
border: "none",
|
|
20789
21084
|
cursor: disabled ? "default" : "pointer",
|
|
20790
21085
|
background: "#ffffff",
|
|
20791
|
-
color:
|
|
21086
|
+
color: OHW_BLUE_DARK2,
|
|
20792
21087
|
opacity: disabled ? 0.4 : 1,
|
|
20793
21088
|
fontSize: 12,
|
|
20794
21089
|
lineHeight: "16px",
|
|
@@ -20806,7 +21101,7 @@ function TogglePill({
|
|
|
20806
21101
|
onToggle,
|
|
20807
21102
|
disabled
|
|
20808
21103
|
}) {
|
|
20809
|
-
return /* @__PURE__ */ (0,
|
|
21104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
20810
21105
|
"button",
|
|
20811
21106
|
{
|
|
20812
21107
|
type: "button",
|
|
@@ -20825,7 +21120,7 @@ function TogglePill({
|
|
|
20825
21120
|
border: "none",
|
|
20826
21121
|
cursor: disabled ? "default" : "pointer",
|
|
20827
21122
|
background: "#ffffff",
|
|
20828
|
-
color:
|
|
21123
|
+
color: OHW_BLUE_DARK2,
|
|
20829
21124
|
opacity: disabled ? 0.4 : 1,
|
|
20830
21125
|
fontSize: 12,
|
|
20831
21126
|
lineHeight: "16px",
|
|
@@ -20835,7 +21130,7 @@ function TogglePill({
|
|
|
20835
21130
|
},
|
|
20836
21131
|
children: [
|
|
20837
21132
|
label,
|
|
20838
|
-
/* @__PURE__ */ (0,
|
|
21133
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20839
21134
|
"span",
|
|
20840
21135
|
{
|
|
20841
21136
|
"aria-hidden": true,
|
|
@@ -20848,10 +21143,10 @@ function TogglePill({
|
|
|
20848
21143
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20849
21144
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20850
21145
|
// "disabled control" rather than "switch that is off".
|
|
20851
|
-
background: on ?
|
|
21146
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20852
21147
|
transition: "background 120ms ease"
|
|
20853
21148
|
},
|
|
20854
|
-
children: /* @__PURE__ */ (0,
|
|
21149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20855
21150
|
"span",
|
|
20856
21151
|
{
|
|
20857
21152
|
style: {
|
|
@@ -20880,7 +21175,7 @@ function CarouselSlideToolbar({
|
|
|
20880
21175
|
onChangeImage,
|
|
20881
21176
|
onToggleAutoplay
|
|
20882
21177
|
}) {
|
|
20883
|
-
return /* @__PURE__ */ (0,
|
|
21178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
20884
21179
|
"div",
|
|
20885
21180
|
{
|
|
20886
21181
|
"data-ohw-bridge": "",
|
|
@@ -20891,7 +21186,7 @@ function CarouselSlideToolbar({
|
|
|
20891
21186
|
flexDirection: "column",
|
|
20892
21187
|
gap: 6,
|
|
20893
21188
|
alignItems: "center",
|
|
20894
|
-
background:
|
|
21189
|
+
background: OHW_BLUE2,
|
|
20895
21190
|
padding: 8,
|
|
20896
21191
|
borderRadius: 12,
|
|
20897
21192
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20903,11 +21198,11 @@ function CarouselSlideToolbar({
|
|
|
20903
21198
|
pointerEvents: pending ? "none" : "auto"
|
|
20904
21199
|
},
|
|
20905
21200
|
children: [
|
|
20906
|
-
/* @__PURE__ */ (0,
|
|
20907
|
-
/* @__PURE__ */ (0,
|
|
20908
|
-
/* @__PURE__ */ (0,
|
|
21201
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21202
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21203
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20909
21204
|
] }),
|
|
20910
|
-
error && /* @__PURE__ */ (0,
|
|
21205
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20911
21206
|
]
|
|
20912
21207
|
}
|
|
20913
21208
|
);
|
|
@@ -21047,8 +21342,8 @@ function AiFadeCarouselOverlay({
|
|
|
21047
21342
|
const activeItemRect = useLiveItemRect2(active);
|
|
21048
21343
|
const TOOLBAR_APPROX_H = 90;
|
|
21049
21344
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21050
|
-
return /* @__PURE__ */ (0,
|
|
21051
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
21346
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21052
21347
|
"button",
|
|
21053
21348
|
{
|
|
21054
21349
|
type: "button",
|
|
@@ -21077,10 +21372,10 @@ function AiFadeCarouselOverlay({
|
|
|
21077
21372
|
fontSize: 14,
|
|
21078
21373
|
fontWeight: 700
|
|
21079
21374
|
},
|
|
21080
|
-
children: /* @__PURE__ */ (0,
|
|
21375
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21081
21376
|
}
|
|
21082
21377
|
),
|
|
21083
|
-
swapping && /* @__PURE__ */ (0,
|
|
21378
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21084
21379
|
"div",
|
|
21085
21380
|
{
|
|
21086
21381
|
ref: skeletonRef,
|
|
@@ -21098,15 +21393,15 @@ function AiFadeCarouselOverlay({
|
|
|
21098
21393
|
zIndex: 2147483646,
|
|
21099
21394
|
pointerEvents: "none"
|
|
21100
21395
|
},
|
|
21101
|
-
children: /* @__PURE__ */ (0,
|
|
21396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21102
21397
|
}
|
|
21103
21398
|
),
|
|
21104
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21399
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21105
21400
|
ItemInteractionLayer,
|
|
21106
21401
|
{
|
|
21107
21402
|
rect: activeItemRect,
|
|
21108
21403
|
state: toolbarState,
|
|
21109
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21404
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21110
21405
|
CarouselSlideToolbar,
|
|
21111
21406
|
{
|
|
21112
21407
|
pending,
|
|
@@ -21297,113 +21592,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21297
21592
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21298
21593
|
var import_react19 = require("react");
|
|
21299
21594
|
|
|
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
|
-
|
|
21407
21595
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21408
21596
|
var import_lucide_react16 = require("lucide-react");
|
|
21409
21597
|
|
|
@@ -22507,6 +22695,7 @@ function shouldUseDevFixtures() {
|
|
|
22507
22695
|
function getLogoElement(el) {
|
|
22508
22696
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22509
22697
|
if (marked) return marked;
|
|
22698
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22510
22699
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22511
22700
|
if (!root) return null;
|
|
22512
22701
|
const anchor = el.closest("a");
|
|
@@ -24201,6 +24390,138 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24201
24390
|
return false;
|
|
24202
24391
|
}
|
|
24203
24392
|
|
|
24393
|
+
// src/lib/build-page-sync.ts
|
|
24394
|
+
var import_react23 = require("react");
|
|
24395
|
+
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24396
|
+
function normalisePath(path) {
|
|
24397
|
+
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
24398
|
+
if (!trimmed || trimmed === "/") return "/";
|
|
24399
|
+
return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
|
|
24400
|
+
}
|
|
24401
|
+
function isDeadPageHref(href, livePaths) {
|
|
24402
|
+
const value = href.trim();
|
|
24403
|
+
if (!value.startsWith("/") || value.startsWith("//")) return false;
|
|
24404
|
+
const path = normalisePath(value);
|
|
24405
|
+
if (path === "/") return false;
|
|
24406
|
+
return !livePaths.some((live) => {
|
|
24407
|
+
const p = normalisePath(live);
|
|
24408
|
+
return p === path || p !== "/" && path.startsWith(`${p}/`);
|
|
24409
|
+
});
|
|
24410
|
+
}
|
|
24411
|
+
var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
24412
|
+
function planBuildPageSync(links, msg) {
|
|
24413
|
+
const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
|
|
24414
|
+
const removed = new Set((msg.removed ?? []).map(normalisePath));
|
|
24415
|
+
const remove = [];
|
|
24416
|
+
const relabel = [];
|
|
24417
|
+
const retarget = [];
|
|
24418
|
+
const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
|
|
24419
|
+
for (const link of links) {
|
|
24420
|
+
const href = link.href.trim();
|
|
24421
|
+
const isPage = href.startsWith("/") && !href.startsWith("//");
|
|
24422
|
+
if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
|
|
24423
|
+
if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
|
|
24424
|
+
else remove.push(link.hrefKey);
|
|
24425
|
+
continue;
|
|
24426
|
+
}
|
|
24427
|
+
if (isPage) {
|
|
24428
|
+
const path = normalisePath(href);
|
|
24429
|
+
const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
|
|
24430
|
+
if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
|
|
24431
|
+
relabel.push({ hrefKey: link.hrefKey, label: rename.label });
|
|
24432
|
+
}
|
|
24433
|
+
continue;
|
|
24434
|
+
}
|
|
24435
|
+
if (href.startsWith("#") || href.startsWith("/#")) {
|
|
24436
|
+
const anchor = href.replace(/^\/?#/u, "").toLowerCase();
|
|
24437
|
+
const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
|
|
24438
|
+
if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
|
|
24439
|
+
relabel.push({ hrefKey: link.hrefKey, label: target.label });
|
|
24440
|
+
}
|
|
24441
|
+
}
|
|
24442
|
+
}
|
|
24443
|
+
return { remove, relabel, retarget };
|
|
24444
|
+
}
|
|
24445
|
+
function linkHref(el) {
|
|
24446
|
+
const key = el.getAttribute("data-ohw-href-key");
|
|
24447
|
+
const stored = key ? getStoredLinkHref(key) : void 0;
|
|
24448
|
+
return stored ?? el.getAttribute("href") ?? "";
|
|
24449
|
+
}
|
|
24450
|
+
function labelEl(anchor) {
|
|
24451
|
+
return anchor.querySelector('[data-ohw-editable="text"]');
|
|
24452
|
+
}
|
|
24453
|
+
function collectLinks() {
|
|
24454
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24455
|
+
const links = [];
|
|
24456
|
+
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
24457
|
+
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
24458
|
+
if (seen.has(hrefKey)) return;
|
|
24459
|
+
const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
24460
|
+
if (!area) return;
|
|
24461
|
+
const label = labelEl(el);
|
|
24462
|
+
if (!label && area !== "chrome") return;
|
|
24463
|
+
seen.add(hrefKey);
|
|
24464
|
+
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
24465
|
+
});
|
|
24466
|
+
return links;
|
|
24467
|
+
}
|
|
24468
|
+
function applyBuildPageSync(msg, deps) {
|
|
24469
|
+
const plan = planBuildPageSync(collectLinks(), msg);
|
|
24470
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
24471
|
+
for (const hrefKey of plan.remove) {
|
|
24472
|
+
const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
24473
|
+
if (!anchor) continue;
|
|
24474
|
+
const nav = isNavbarHrefKey(hrefKey);
|
|
24475
|
+
const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
|
|
24476
|
+
if (!result) continue;
|
|
24477
|
+
for (const key of result.removedKeys) {
|
|
24478
|
+
nodes.set(key, "");
|
|
24479
|
+
clearStoredLinkHref(key);
|
|
24480
|
+
}
|
|
24481
|
+
nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
|
|
24482
|
+
}
|
|
24483
|
+
for (const { hrefKey, label } of plan.relabel) {
|
|
24484
|
+
const labelKey = hrefKey.replace(/-href$/u, "-label");
|
|
24485
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24486
|
+
const el = labelEl(anchor);
|
|
24487
|
+
if (el) el.textContent = label;
|
|
24488
|
+
});
|
|
24489
|
+
nodes.set(labelKey, label);
|
|
24490
|
+
}
|
|
24491
|
+
for (const { hrefKey, href } of plan.retarget) {
|
|
24492
|
+
setStoredLinkHref(hrefKey, href);
|
|
24493
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24494
|
+
if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
|
|
24495
|
+
});
|
|
24496
|
+
nodes.set(hrefKey, href);
|
|
24497
|
+
}
|
|
24498
|
+
if (nodes.size === 0) return 0;
|
|
24499
|
+
deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
|
|
24500
|
+
deps.postToParent({
|
|
24501
|
+
type: "ow:change",
|
|
24502
|
+
nodes: [...nodes].map(([key, text]) => ({ key, text }))
|
|
24503
|
+
});
|
|
24504
|
+
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24505
|
+
}
|
|
24506
|
+
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24507
|
+
(0, import_react23.useEffect)(() => {
|
|
24508
|
+
if (!isEditMode) return;
|
|
24509
|
+
const onMessage = (e) => {
|
|
24510
|
+
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
24511
|
+
const changed = applyBuildPageSync(e.data, {
|
|
24512
|
+
getEditContent: () => editContentRef.current,
|
|
24513
|
+
setEditContent: (next) => {
|
|
24514
|
+
editContentRef.current = next;
|
|
24515
|
+
},
|
|
24516
|
+
postToParent: postToParent2
|
|
24517
|
+
});
|
|
24518
|
+
postToParent2({ type: "ow:pages-synced", changed });
|
|
24519
|
+
};
|
|
24520
|
+
window.addEventListener("message", onMessage);
|
|
24521
|
+
return () => window.removeEventListener("message", onMessage);
|
|
24522
|
+
}, [isEditMode, editContentRef, postToParent2]);
|
|
24523
|
+
}
|
|
24524
|
+
|
|
24204
24525
|
// src/lib/nav-page-sync.ts
|
|
24205
24526
|
function labelKeyFor(hrefKey) {
|
|
24206
24527
|
return hrefKey.replace(/-href$/, "-label");
|
|
@@ -25184,7 +25505,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25184
25505
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25185
25506
|
return resolveFooterLinksContainerFrom(el);
|
|
25186
25507
|
}
|
|
25187
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25508
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isFooterLinksContainer(el) || isInferredFooterGroup2(el)) {
|
|
25188
25509
|
return getNavigationRoot(el);
|
|
25189
25510
|
}
|
|
25190
25511
|
return null;
|
|
@@ -25406,7 +25727,6 @@ var ICONS = {
|
|
|
25406
25727
|
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"/>',
|
|
25407
25728
|
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"/>'
|
|
25408
25729
|
};
|
|
25409
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25410
25730
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25411
25731
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25412
25732
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25504,7 +25824,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25504
25824
|
el.style.top = `${top}px`;
|
|
25505
25825
|
el.style.height = `${height}px`;
|
|
25506
25826
|
}
|
|
25507
|
-
var
|
|
25827
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25508
25828
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25509
25829
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25510
25830
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25531,8 +25851,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25531
25851
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25532
25852
|
const half = toolbarWidth / 2;
|
|
25533
25853
|
return Math.max(
|
|
25534
|
-
|
|
25535
|
-
Math.min(centerX, window.innerWidth -
|
|
25854
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
25855
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25536
25856
|
);
|
|
25537
25857
|
}
|
|
25538
25858
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25656,9 +25976,9 @@ function FloatingToolbar({
|
|
|
25656
25976
|
showEditLink,
|
|
25657
25977
|
onEditLink
|
|
25658
25978
|
}) {
|
|
25659
|
-
const localRef =
|
|
25660
|
-
const [measuredW, setMeasuredW] =
|
|
25661
|
-
const setRefs =
|
|
25979
|
+
const localRef = import_react24.default.useRef(null);
|
|
25980
|
+
const [measuredW, setMeasuredW] = import_react24.default.useState(330);
|
|
25981
|
+
const setRefs = import_react24.default.useCallback(
|
|
25662
25982
|
(node) => {
|
|
25663
25983
|
localRef.current = node;
|
|
25664
25984
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -25670,7 +25990,7 @@ function FloatingToolbar({
|
|
|
25670
25990
|
},
|
|
25671
25991
|
[elRef]
|
|
25672
25992
|
);
|
|
25673
|
-
|
|
25993
|
+
import_react24.default.useLayoutEffect(() => {
|
|
25674
25994
|
const node = localRef.current;
|
|
25675
25995
|
if (!node) return;
|
|
25676
25996
|
const update = () => {
|
|
@@ -25696,7 +26016,7 @@ function FloatingToolbar({
|
|
|
25696
26016
|
pointerEvents: "auto"
|
|
25697
26017
|
},
|
|
25698
26018
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
|
|
25699
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
26019
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react24.default.Fragment, { children: [
|
|
25700
26020
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
25701
26021
|
btns.map((btn) => {
|
|
25702
26022
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -25905,8 +26225,8 @@ function OhhwellsBridge() {
|
|
|
25905
26225
|
const router = (0, import_navigation4.useRouter)();
|
|
25906
26226
|
const searchParams = (0, import_navigation4.useSearchParams)();
|
|
25907
26227
|
const isEditMode = isEditSessionActive();
|
|
25908
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
25909
|
-
(0,
|
|
26228
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react24.useState)(null);
|
|
26229
|
+
(0, import_react24.useEffect)(() => {
|
|
25910
26230
|
const figtreeFontId = "ohw-figtree-font";
|
|
25911
26231
|
if (!document.getElementById(figtreeFontId)) {
|
|
25912
26232
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25932,8 +26252,8 @@ function OhhwellsBridge() {
|
|
|
25932
26252
|
};
|
|
25933
26253
|
}, []);
|
|
25934
26254
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25935
|
-
const [subdomain, setSubdomain] = (0,
|
|
25936
|
-
(0,
|
|
26255
|
+
const [subdomain, setSubdomain] = (0, import_react24.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
26256
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
25937
26257
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25938
26258
|
if (next !== subdomain) setSubdomain(next);
|
|
25939
26259
|
if (next) return;
|
|
@@ -25945,7 +26265,7 @@ function OhhwellsBridge() {
|
|
|
25945
26265
|
}, 0);
|
|
25946
26266
|
return () => window.clearTimeout(t);
|
|
25947
26267
|
}, [subdomainFromQuery, subdomain]);
|
|
25948
|
-
(0,
|
|
26268
|
+
(0, import_react24.useEffect)(() => {
|
|
25949
26269
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
25950
26270
|
const url = new URL(window.location.href);
|
|
25951
26271
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -25957,22 +26277,22 @@ function OhhwellsBridge() {
|
|
|
25957
26277
|
useSavedLinkNavigation(isEditMode);
|
|
25958
26278
|
useNavDropdownToggle(isEditMode);
|
|
25959
26279
|
useHashLinkScroll(isEditMode);
|
|
25960
|
-
const postToParent2 = (0,
|
|
26280
|
+
const postToParent2 = (0, import_react24.useCallback)((data) => {
|
|
25961
26281
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
25962
26282
|
window.parent.postMessage(data, "*");
|
|
25963
26283
|
}
|
|
25964
26284
|
}, []);
|
|
25965
|
-
const [fetchState, setFetchState] = (0,
|
|
25966
|
-
const [showBranding, setShowBranding] = (0,
|
|
25967
|
-
const autoSaveTimers = (0,
|
|
25968
|
-
(0,
|
|
26285
|
+
const [fetchState, setFetchState] = (0, import_react24.useState)("idle");
|
|
26286
|
+
const [showBranding, setShowBranding] = (0, import_react24.useState)(false);
|
|
26287
|
+
const autoSaveTimers = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26288
|
+
(0, import_react24.useEffect)(() => {
|
|
25969
26289
|
stampBridgeVersionOnDocument();
|
|
25970
26290
|
}, []);
|
|
25971
|
-
(0,
|
|
26291
|
+
(0, import_react24.useEffect)(() => {
|
|
25972
26292
|
if (isEditMode) return;
|
|
25973
26293
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
25974
26294
|
}, [isEditMode, subdomain, fetchState]);
|
|
25975
|
-
(0,
|
|
26295
|
+
(0, import_react24.useEffect)(() => {
|
|
25976
26296
|
if (isEditMode || !subdomain) return;
|
|
25977
26297
|
const onError = (event) => {
|
|
25978
26298
|
reportOutageBeacon({
|
|
@@ -25993,40 +26313,40 @@ function OhhwellsBridge() {
|
|
|
25993
26313
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
25994
26314
|
};
|
|
25995
26315
|
}, [isEditMode, subdomain]);
|
|
25996
|
-
const activeElRef = (0,
|
|
25997
|
-
const pointerHeldRef = (0,
|
|
25998
|
-
const selectedElRef = (0,
|
|
25999
|
-
const selectedHrefKeyRef = (0,
|
|
26000
|
-
const selectedFooterColAttrRef = (0,
|
|
26001
|
-
const footerHeadingTitleCacheRef = (0,
|
|
26002
|
-
const originalContentRef = (0,
|
|
26003
|
-
const activeStateElRef = (0,
|
|
26004
|
-
const parentScrollRef = (0,
|
|
26005
|
-
const visibleViewportRef = (0,
|
|
26006
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
26007
|
-
const attachVisibleViewport = (0,
|
|
26316
|
+
const activeElRef = (0, import_react24.useRef)(null);
|
|
26317
|
+
const pointerHeldRef = (0, import_react24.useRef)(false);
|
|
26318
|
+
const selectedElRef = (0, import_react24.useRef)(null);
|
|
26319
|
+
const selectedHrefKeyRef = (0, import_react24.useRef)(null);
|
|
26320
|
+
const selectedFooterColAttrRef = (0, import_react24.useRef)(null);
|
|
26321
|
+
const footerHeadingTitleCacheRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26322
|
+
const originalContentRef = (0, import_react24.useRef)(null);
|
|
26323
|
+
const activeStateElRef = (0, import_react24.useRef)(null);
|
|
26324
|
+
const parentScrollRef = (0, import_react24.useRef)(null);
|
|
26325
|
+
const visibleViewportRef = (0, import_react24.useRef)(null);
|
|
26326
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react24.useState)(null);
|
|
26327
|
+
const attachVisibleViewport = (0, import_react24.useCallback)((node) => {
|
|
26008
26328
|
visibleViewportRef.current = node;
|
|
26009
26329
|
setDialogPortalContainer(node);
|
|
26010
26330
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
26011
26331
|
}, []);
|
|
26012
|
-
const toolbarElRef = (0,
|
|
26013
|
-
const glowElRef = (0,
|
|
26014
|
-
const hoveredImageRef = (0,
|
|
26015
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
26016
|
-
const dragOverElRef = (0,
|
|
26017
|
-
const [mediaHover, setMediaHover] = (0,
|
|
26018
|
-
const [selectedAiSectionId, setSelectedAiSectionId] = (0,
|
|
26019
|
-
const selectedAiSectionIdRef = (0,
|
|
26020
|
-
const handleAiSectionSelectionChange = (0,
|
|
26332
|
+
const toolbarElRef = (0, import_react24.useRef)(null);
|
|
26333
|
+
const glowElRef = (0, import_react24.useRef)(null);
|
|
26334
|
+
const hoveredImageRef = (0, import_react24.useRef)(null);
|
|
26335
|
+
const hoveredImageHasTextOverlapRef = (0, import_react24.useRef)(false);
|
|
26336
|
+
const dragOverElRef = (0, import_react24.useRef)(null);
|
|
26337
|
+
const [mediaHover, setMediaHover] = (0, import_react24.useState)(null);
|
|
26338
|
+
const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react24.useState)(null);
|
|
26339
|
+
const selectedAiSectionIdRef = (0, import_react24.useRef)(null);
|
|
26340
|
+
const handleAiSectionSelectionChange = (0, import_react24.useCallback)((id) => {
|
|
26021
26341
|
selectedAiSectionIdRef.current = id;
|
|
26022
26342
|
setSelectedAiSectionId(id);
|
|
26023
26343
|
}, []);
|
|
26024
|
-
const [selectedMedia, setSelectedMedia] = (0,
|
|
26025
|
-
const selectedMediaElRef = (0,
|
|
26026
|
-
const mediaKeyDropTokenRef = (0,
|
|
26027
|
-
const selectedIconElRef = (0,
|
|
26028
|
-
const selectedSocialElRef = (0,
|
|
26029
|
-
const queueSectionKeyDrop = (0,
|
|
26344
|
+
const [selectedMedia, setSelectedMedia] = (0, import_react24.useState)(null);
|
|
26345
|
+
const selectedMediaElRef = (0, import_react24.useRef)(null);
|
|
26346
|
+
const mediaKeyDropTokenRef = (0, import_react24.useRef)(0);
|
|
26347
|
+
const selectedIconElRef = (0, import_react24.useRef)(null);
|
|
26348
|
+
const selectedSocialElRef = (0, import_react24.useRef)(null);
|
|
26349
|
+
const queueSectionKeyDrop = (0, import_react24.useCallback)((prev) => {
|
|
26030
26350
|
const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
|
|
26031
26351
|
if (!sectionEl) return;
|
|
26032
26352
|
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
@@ -26047,31 +26367,31 @@ function OhhwellsBridge() {
|
|
|
26047
26367
|
window.addEventListener("message", onQueueDrained);
|
|
26048
26368
|
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
26049
26369
|
}, []);
|
|
26050
|
-
const clearMediaSelection = (0,
|
|
26370
|
+
const clearMediaSelection = (0, import_react24.useCallback)(() => {
|
|
26051
26371
|
const prev = selectedMediaElRef.current;
|
|
26052
26372
|
selectedMediaElRef.current = null;
|
|
26053
26373
|
setSelectedMedia(null);
|
|
26054
26374
|
queueSectionKeyDrop(prev);
|
|
26055
26375
|
}, [queueSectionKeyDrop]);
|
|
26056
|
-
const clearMediaSelectionRef = (0,
|
|
26376
|
+
const clearMediaSelectionRef = (0, import_react24.useRef)(clearMediaSelection);
|
|
26057
26377
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
26058
|
-
const clearIconSelection = (0,
|
|
26378
|
+
const clearIconSelection = (0, import_react24.useCallback)(() => {
|
|
26059
26379
|
const prev = selectedIconElRef.current;
|
|
26060
26380
|
if (!prev) return;
|
|
26061
26381
|
selectedIconElRef.current = null;
|
|
26062
26382
|
queueSectionKeyDrop(prev);
|
|
26063
26383
|
}, [queueSectionKeyDrop]);
|
|
26064
|
-
const clearIconSelectionRef = (0,
|
|
26384
|
+
const clearIconSelectionRef = (0, import_react24.useRef)(clearIconSelection);
|
|
26065
26385
|
clearIconSelectionRef.current = clearIconSelection;
|
|
26066
|
-
const clearSocialSelection = (0,
|
|
26386
|
+
const clearSocialSelection = (0, import_react24.useCallback)(() => {
|
|
26067
26387
|
const prev = selectedSocialElRef.current;
|
|
26068
26388
|
if (!prev) return;
|
|
26069
26389
|
selectedSocialElRef.current = null;
|
|
26070
26390
|
queueSectionKeyDrop(prev);
|
|
26071
26391
|
}, [queueSectionKeyDrop]);
|
|
26072
|
-
const clearSocialSelectionRef = (0,
|
|
26392
|
+
const clearSocialSelectionRef = (0, import_react24.useRef)(clearSocialSelection);
|
|
26073
26393
|
clearSocialSelectionRef.current = clearSocialSelection;
|
|
26074
|
-
const selectIconElement = (0,
|
|
26394
|
+
const selectIconElement = (0, import_react24.useCallback)((el) => {
|
|
26075
26395
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26076
26396
|
selectedIconElRef.current = el;
|
|
26077
26397
|
const sectionEl = el.closest("[data-ohw-section]");
|
|
@@ -26084,9 +26404,9 @@ function OhhwellsBridge() {
|
|
|
26084
26404
|
keyLabel: "Icon"
|
|
26085
26405
|
});
|
|
26086
26406
|
}, []);
|
|
26087
|
-
const selectIconElementRef = (0,
|
|
26407
|
+
const selectIconElementRef = (0, import_react24.useRef)(selectIconElement);
|
|
26088
26408
|
selectIconElementRef.current = selectIconElement;
|
|
26089
|
-
const selectMediaElement = (0,
|
|
26409
|
+
const selectMediaElement = (0, import_react24.useCallback)((el) => {
|
|
26090
26410
|
const r2 = el.getBoundingClientRect();
|
|
26091
26411
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
26092
26412
|
selectedIconElRef.current = null;
|
|
@@ -26111,9 +26431,9 @@ function OhhwellsBridge() {
|
|
|
26111
26431
|
keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
|
|
26112
26432
|
});
|
|
26113
26433
|
}, []);
|
|
26114
|
-
const selectMediaElementRef = (0,
|
|
26434
|
+
const selectMediaElementRef = (0, import_react24.useRef)(selectMediaElement);
|
|
26115
26435
|
selectMediaElementRef.current = selectMediaElement;
|
|
26116
|
-
(0,
|
|
26436
|
+
(0, import_react24.useEffect)(() => {
|
|
26117
26437
|
if (!selectedMedia) return;
|
|
26118
26438
|
const update = () => {
|
|
26119
26439
|
const el = selectedMediaElRef.current;
|
|
@@ -26133,54 +26453,54 @@ function OhhwellsBridge() {
|
|
|
26133
26453
|
window.removeEventListener("resize", update);
|
|
26134
26454
|
};
|
|
26135
26455
|
}, [selectedMedia !== null]);
|
|
26136
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
26137
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
26138
|
-
const hoveredGapRef = (0,
|
|
26139
|
-
const imageUnhoverTimerRef = (0,
|
|
26140
|
-
const imageShowTimerRef = (0,
|
|
26141
|
-
const editStylesRef = (0,
|
|
26142
|
-
const activateRef = (0,
|
|
26456
|
+
const [carouselHover, setCarouselHover] = (0, import_react24.useState)(null);
|
|
26457
|
+
const [uploadingRects, setUploadingRects] = (0, import_react24.useState)({});
|
|
26458
|
+
const hoveredGapRef = (0, import_react24.useRef)(null);
|
|
26459
|
+
const imageUnhoverTimerRef = (0, import_react24.useRef)(null);
|
|
26460
|
+
const imageShowTimerRef = (0, import_react24.useRef)(null);
|
|
26461
|
+
const editStylesRef = (0, import_react24.useRef)(null);
|
|
26462
|
+
const activateRef = (0, import_react24.useRef)(() => {
|
|
26143
26463
|
});
|
|
26144
|
-
const deactivateRef = (0,
|
|
26464
|
+
const deactivateRef = (0, import_react24.useRef)(() => {
|
|
26145
26465
|
});
|
|
26146
|
-
const selectRef = (0,
|
|
26466
|
+
const selectRef = (0, import_react24.useRef)(() => {
|
|
26147
26467
|
});
|
|
26148
|
-
const selectFrameRef = (0,
|
|
26468
|
+
const selectFrameRef = (0, import_react24.useRef)(() => {
|
|
26149
26469
|
});
|
|
26150
|
-
const selectLogoRef = (0,
|
|
26470
|
+
const selectLogoRef = (0, import_react24.useRef)(() => {
|
|
26151
26471
|
});
|
|
26152
|
-
const openLogoSizePanelRef = (0,
|
|
26472
|
+
const openLogoSizePanelRef = (0, import_react24.useRef)(() => {
|
|
26153
26473
|
});
|
|
26154
|
-
const deselectRef = (0,
|
|
26474
|
+
const deselectRef = (0, import_react24.useRef)(() => {
|
|
26155
26475
|
});
|
|
26156
|
-
const closeFloatingPanelOnlyRef = (0,
|
|
26476
|
+
const closeFloatingPanelOnlyRef = (0, import_react24.useRef)(() => {
|
|
26157
26477
|
});
|
|
26158
|
-
const reselectNavigationItemRef = (0,
|
|
26478
|
+
const reselectNavigationItemRef = (0, import_react24.useRef)(() => {
|
|
26159
26479
|
});
|
|
26160
|
-
const commitNavigationTextEditRef = (0,
|
|
26480
|
+
const commitNavigationTextEditRef = (0, import_react24.useRef)(() => {
|
|
26161
26481
|
});
|
|
26162
|
-
const handleDeleteSelectedRef = (0,
|
|
26163
|
-
const runPendingDeleteUndoRef = (0,
|
|
26164
|
-
const isFooterFrameSelectionRef = (0,
|
|
26165
|
-
const refreshActiveCommandsRef = (0,
|
|
26482
|
+
const handleDeleteSelectedRef = (0, import_react24.useRef)(() => false);
|
|
26483
|
+
const runPendingDeleteUndoRef = (0, import_react24.useRef)(() => false);
|
|
26484
|
+
const isFooterFrameSelectionRef = (0, import_react24.useRef)(false);
|
|
26485
|
+
const refreshActiveCommandsRef = (0, import_react24.useRef)(() => {
|
|
26166
26486
|
});
|
|
26167
|
-
const postToParentRef = (0,
|
|
26487
|
+
const postToParentRef = (0, import_react24.useRef)(postToParent2);
|
|
26168
26488
|
postToParentRef.current = postToParent2;
|
|
26169
|
-
const aiSectionApiRef = (0,
|
|
26170
|
-
const sectionsLoadedRef = (0,
|
|
26171
|
-
const pendingScheduleConfigRequests = (0,
|
|
26172
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
26173
|
-
const [formPickRect, setFormPickRect] = (0,
|
|
26174
|
-
const formPickElRef = (0,
|
|
26175
|
-
const [formViewState, setFormViewStateUi] = (0,
|
|
26176
|
-
const [formPickCount, setFormPickCount] = (0,
|
|
26177
|
-
const [formHoverRect, setFormHoverRect] = (0,
|
|
26178
|
-
const formHoverElRef = (0,
|
|
26179
|
-
const [fieldPickRect, setFieldPickRect] = (0,
|
|
26180
|
-
const fieldPickElRef = (0,
|
|
26181
|
-
const [fieldPickState, setFieldPickState] = (0,
|
|
26182
|
-
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0,
|
|
26183
|
-
const clearFormPick = (0,
|
|
26489
|
+
const aiSectionApiRef = (0, import_react24.useRef)(null);
|
|
26490
|
+
const sectionsLoadedRef = (0, import_react24.useRef)(false);
|
|
26491
|
+
const pendingScheduleConfigRequests = (0, import_react24.useRef)([]);
|
|
26492
|
+
const [toolbarRect, setToolbarRect] = (0, import_react24.useState)(null);
|
|
26493
|
+
const [formPickRect, setFormPickRect] = (0, import_react24.useState)(null);
|
|
26494
|
+
const formPickElRef = (0, import_react24.useRef)(null);
|
|
26495
|
+
const [formViewState, setFormViewStateUi] = (0, import_react24.useState)("default");
|
|
26496
|
+
const [formPickCount, setFormPickCount] = (0, import_react24.useState)(null);
|
|
26497
|
+
const [formHoverRect, setFormHoverRect] = (0, import_react24.useState)(null);
|
|
26498
|
+
const formHoverElRef = (0, import_react24.useRef)(null);
|
|
26499
|
+
const [fieldPickRect, setFieldPickRect] = (0, import_react24.useState)(null);
|
|
26500
|
+
const fieldPickElRef = (0, import_react24.useRef)(null);
|
|
26501
|
+
const [fieldPickState, setFieldPickState] = (0, import_react24.useState)(null);
|
|
26502
|
+
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react24.useState)(false);
|
|
26503
|
+
const clearFormPick = (0, import_react24.useCallback)(() => {
|
|
26184
26504
|
const form = formPickElRef.current;
|
|
26185
26505
|
const editing = fieldPickElRef.current;
|
|
26186
26506
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
@@ -26200,7 +26520,7 @@ function OhhwellsBridge() {
|
|
|
26200
26520
|
formPickElRef.current = null;
|
|
26201
26521
|
setFormPickRect(null);
|
|
26202
26522
|
}, []);
|
|
26203
|
-
const clearFieldPick = (0,
|
|
26523
|
+
const clearFieldPick = (0, import_react24.useCallback)(() => {
|
|
26204
26524
|
const wrapper = fieldPickElRef.current;
|
|
26205
26525
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
26206
26526
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
@@ -26210,9 +26530,9 @@ function OhhwellsBridge() {
|
|
|
26210
26530
|
setFieldPickRect(null);
|
|
26211
26531
|
setFieldPickState(null);
|
|
26212
26532
|
}, []);
|
|
26213
|
-
const persistFieldsRef = (0,
|
|
26533
|
+
const persistFieldsRef = (0, import_react24.useRef)(() => {
|
|
26214
26534
|
});
|
|
26215
|
-
const persistFields = (0,
|
|
26535
|
+
const persistFields = (0, import_react24.useCallback)(
|
|
26216
26536
|
(form) => {
|
|
26217
26537
|
const key = formKeyOf(form);
|
|
26218
26538
|
if (!key) return;
|
|
@@ -26223,7 +26543,7 @@ function OhhwellsBridge() {
|
|
|
26223
26543
|
[]
|
|
26224
26544
|
);
|
|
26225
26545
|
persistFieldsRef.current = persistFields;
|
|
26226
|
-
const selectField = (0,
|
|
26546
|
+
const selectField = (0, import_react24.useCallback)((wrapper) => {
|
|
26227
26547
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
26228
26548
|
commitPlaceholderEdit(fieldPickElRef.current);
|
|
26229
26549
|
}
|
|
@@ -26236,7 +26556,7 @@ function OhhwellsBridge() {
|
|
|
26236
26556
|
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
26237
26557
|
setFieldTypePickerOpen(false);
|
|
26238
26558
|
}, []);
|
|
26239
|
-
const withSelectedField = (0,
|
|
26559
|
+
const withSelectedField = (0, import_react24.useCallback)(
|
|
26240
26560
|
(run) => {
|
|
26241
26561
|
const wrapper = fieldPickElRef.current;
|
|
26242
26562
|
const form = formPickElRef.current;
|
|
@@ -26249,28 +26569,28 @@ function OhhwellsBridge() {
|
|
|
26249
26569
|
},
|
|
26250
26570
|
[persistFields]
|
|
26251
26571
|
);
|
|
26252
|
-
const handleFieldTypeChange = (0,
|
|
26572
|
+
const handleFieldTypeChange = (0, import_react24.useCallback)(
|
|
26253
26573
|
(type) => withSelectedField((_form, wrapper) => {
|
|
26254
26574
|
applyFieldType(wrapper, type);
|
|
26255
26575
|
selectField(wrapper);
|
|
26256
26576
|
}),
|
|
26257
26577
|
[selectField, withSelectedField]
|
|
26258
26578
|
);
|
|
26259
|
-
const handleFieldRequiredToggle = (0,
|
|
26579
|
+
const handleFieldRequiredToggle = (0, import_react24.useCallback)(
|
|
26260
26580
|
() => withSelectedField((_form, wrapper) => {
|
|
26261
26581
|
setFieldRequired(wrapper, !isFieldRequired(wrapper));
|
|
26262
26582
|
selectField(wrapper);
|
|
26263
26583
|
}),
|
|
26264
26584
|
[selectField, withSelectedField]
|
|
26265
26585
|
);
|
|
26266
|
-
const handleFieldDuplicate = (0,
|
|
26586
|
+
const handleFieldDuplicate = (0, import_react24.useCallback)(
|
|
26267
26587
|
() => withSelectedField((form, wrapper) => {
|
|
26268
26588
|
const copy = duplicateField(form, wrapper);
|
|
26269
26589
|
selectField(copy);
|
|
26270
26590
|
}),
|
|
26271
26591
|
[selectField, withSelectedField]
|
|
26272
26592
|
);
|
|
26273
|
-
const handleFieldDelete = (0,
|
|
26593
|
+
const handleFieldDelete = (0, import_react24.useCallback)(
|
|
26274
26594
|
() => withSelectedField((_form, wrapper) => {
|
|
26275
26595
|
removeField(wrapper);
|
|
26276
26596
|
clearFieldPick();
|
|
@@ -26278,7 +26598,7 @@ function OhhwellsBridge() {
|
|
|
26278
26598
|
}),
|
|
26279
26599
|
[clearFieldPick, withSelectedField]
|
|
26280
26600
|
);
|
|
26281
|
-
const handleAddField = (0,
|
|
26601
|
+
const handleAddField = (0, import_react24.useCallback)(
|
|
26282
26602
|
(type) => {
|
|
26283
26603
|
const form = formPickElRef.current;
|
|
26284
26604
|
if (!form) return;
|
|
@@ -26294,8 +26614,8 @@ function OhhwellsBridge() {
|
|
|
26294
26614
|
},
|
|
26295
26615
|
[persistFields, selectField]
|
|
26296
26616
|
);
|
|
26297
|
-
const fieldDragRef = (0,
|
|
26298
|
-
const buildFieldDropSlots = (0,
|
|
26617
|
+
const fieldDragRef = (0, import_react24.useRef)(null);
|
|
26618
|
+
const buildFieldDropSlots = (0, import_react24.useCallback)((form, draggedKey) => {
|
|
26299
26619
|
const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
|
|
26300
26620
|
const slots = others.map((el) => {
|
|
26301
26621
|
const rect = el.getBoundingClientRect();
|
|
@@ -26308,7 +26628,7 @@ function OhhwellsBridge() {
|
|
|
26308
26628
|
}
|
|
26309
26629
|
return slots;
|
|
26310
26630
|
}, []);
|
|
26311
|
-
const handleFieldDragStart = (0,
|
|
26631
|
+
const handleFieldDragStart = (0, import_react24.useCallback)(() => {
|
|
26312
26632
|
const wrapper = fieldPickElRef.current;
|
|
26313
26633
|
const form = formPickElRef.current;
|
|
26314
26634
|
if (!wrapper || !form) return;
|
|
@@ -26317,18 +26637,18 @@ function OhhwellsBridge() {
|
|
|
26317
26637
|
setFieldDragging(true);
|
|
26318
26638
|
setFieldDropSlots(buildFieldDropSlots(form, key));
|
|
26319
26639
|
}, [buildFieldDropSlots]);
|
|
26320
|
-
const handleFieldDragEnd = (0,
|
|
26640
|
+
const handleFieldDragEnd = (0, import_react24.useCallback)(() => {
|
|
26321
26641
|
fieldDragRef.current = null;
|
|
26322
26642
|
setFieldDropIndex(null);
|
|
26323
26643
|
setFieldDropSlots([]);
|
|
26324
26644
|
setFieldDragging(false);
|
|
26325
26645
|
}, []);
|
|
26326
|
-
const [fieldDropIndex, setFieldDropIndex] = (0,
|
|
26327
|
-
const [fieldDropSlots, setFieldDropSlots] = (0,
|
|
26328
|
-
const [fieldDragging, setFieldDragging] = (0,
|
|
26329
|
-
const clearFormPickRef = (0,
|
|
26646
|
+
const [fieldDropIndex, setFieldDropIndex] = (0, import_react24.useState)(null);
|
|
26647
|
+
const [fieldDropSlots, setFieldDropSlots] = (0, import_react24.useState)([]);
|
|
26648
|
+
const [fieldDragging, setFieldDragging] = (0, import_react24.useState)(false);
|
|
26649
|
+
const clearFormPickRef = (0, import_react24.useRef)(clearFormPick);
|
|
26330
26650
|
clearFormPickRef.current = clearFormPick;
|
|
26331
|
-
(0,
|
|
26651
|
+
(0, import_react24.useEffect)(() => {
|
|
26332
26652
|
const el = fieldPickElRef.current;
|
|
26333
26653
|
if (!el || fieldPickRect === null) return;
|
|
26334
26654
|
const observer = new ResizeObserver(() => {
|
|
@@ -26337,7 +26657,7 @@ function OhhwellsBridge() {
|
|
|
26337
26657
|
observer.observe(el);
|
|
26338
26658
|
return () => observer.disconnect();
|
|
26339
26659
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26340
|
-
(0,
|
|
26660
|
+
(0, import_react24.useEffect)(() => {
|
|
26341
26661
|
const el = formPickElRef.current;
|
|
26342
26662
|
if (!el || formPickRect === null) return;
|
|
26343
26663
|
const observer = new ResizeObserver(() => {
|
|
@@ -26346,25 +26666,25 @@ function OhhwellsBridge() {
|
|
|
26346
26666
|
observer.observe(el);
|
|
26347
26667
|
return () => observer.disconnect();
|
|
26348
26668
|
}, [formPickRect !== null, formViewState]);
|
|
26349
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
26350
|
-
const toolbarVariantRef = (0,
|
|
26669
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react24.useState)("none");
|
|
26670
|
+
const toolbarVariantRef = (0, import_react24.useRef)("none");
|
|
26351
26671
|
toolbarVariantRef.current = toolbarVariant;
|
|
26352
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
26353
|
-
const [selectedIsSocial, setSelectedIsSocial] = (0,
|
|
26354
|
-
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0,
|
|
26355
|
-
const [reorderHrefKey, setReorderHrefKey] = (0,
|
|
26356
|
-
const [reorderDragDisabled, setReorderDragDisabled] = (0,
|
|
26357
|
-
const [toggleState, setToggleState] = (0,
|
|
26358
|
-
const [maxBadge, setMaxBadge] = (0,
|
|
26359
|
-
const [activeCommands, setActiveCommands] = (0,
|
|
26360
|
-
const [sectionGap, setSectionGap] = (0,
|
|
26361
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] = (0,
|
|
26362
|
-
const hoveredNavContainerRef = (0,
|
|
26363
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0,
|
|
26364
|
-
const hoveredItemElRef = (0,
|
|
26365
|
-
const [hoveredItemRect, setHoveredItemRect] = (0,
|
|
26366
|
-
const [hoveredTextRect, setHoveredTextRect] = (0,
|
|
26367
|
-
(0,
|
|
26672
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react24.useState)(false);
|
|
26673
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react24.useState)(false);
|
|
26674
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react24.useState)(false);
|
|
26675
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react24.useState)(null);
|
|
26676
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react24.useState)(false);
|
|
26677
|
+
const [toggleState, setToggleState] = (0, import_react24.useState)(null);
|
|
26678
|
+
const [maxBadge, setMaxBadge] = (0, import_react24.useState)(null);
|
|
26679
|
+
const [activeCommands, setActiveCommands] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
|
|
26680
|
+
const [sectionGap, setSectionGap] = (0, import_react24.useState)(null);
|
|
26681
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react24.useState)(false);
|
|
26682
|
+
const hoveredNavContainerRef = (0, import_react24.useRef)(null);
|
|
26683
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react24.useState)(null);
|
|
26684
|
+
const hoveredItemElRef = (0, import_react24.useRef)(null);
|
|
26685
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react24.useState)(null);
|
|
26686
|
+
const [hoveredTextRect, setHoveredTextRect] = (0, import_react24.useState)(null);
|
|
26687
|
+
(0, import_react24.useEffect)(() => {
|
|
26368
26688
|
const sync = () => {
|
|
26369
26689
|
const el = document.querySelector(
|
|
26370
26690
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26408,63 +26728,75 @@ function OhhwellsBridge() {
|
|
|
26408
26728
|
});
|
|
26409
26729
|
return () => observer.disconnect();
|
|
26410
26730
|
}, []);
|
|
26411
|
-
const siblingHintElRef = (0,
|
|
26412
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
26413
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
26414
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
26415
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
26731
|
+
const siblingHintElRef = (0, import_react24.useRef)(null);
|
|
26732
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react24.useState)(null);
|
|
26733
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react24.useState)([]);
|
|
26734
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react24.useState)(false);
|
|
26735
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react24.useState)(false);
|
|
26416
26736
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26417
|
-
const [
|
|
26418
|
-
const
|
|
26419
|
-
|
|
26420
|
-
const
|
|
26421
|
-
|
|
26422
|
-
const [
|
|
26423
|
-
const
|
|
26424
|
-
const
|
|
26425
|
-
const
|
|
26426
|
-
const [
|
|
26427
|
-
const
|
|
26428
|
-
const
|
|
26429
|
-
const
|
|
26430
|
-
|
|
26431
|
-
const
|
|
26432
|
-
const
|
|
26433
|
-
const
|
|
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)(
|
|
26737
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react24.useState)(null);
|
|
26738
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react24.useState)(null);
|
|
26739
|
+
const footerDragRef = (0, import_react24.useRef)(null);
|
|
26740
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react24.useState)([]);
|
|
26741
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react24.useState)(null);
|
|
26742
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react24.useState)(null);
|
|
26743
|
+
const footerPointerDragRef = (0, import_react24.useRef)(null);
|
|
26744
|
+
const suppressNextClickRef = (0, import_react24.useRef)(false);
|
|
26745
|
+
const suppressClickUntilRef = (0, import_react24.useRef)(0);
|
|
26746
|
+
const [linkPopover, setLinkPopover] = (0, import_react24.useState)(null);
|
|
26747
|
+
const linkPopoverSessionRef = (0, import_react24.useRef)(null);
|
|
26748
|
+
const addNavAfterAnchorRef = (0, import_react24.useRef)(null);
|
|
26749
|
+
const editContentRef = (0, import_react24.useRef)({});
|
|
26750
|
+
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
26751
|
+
const aiSectionsRef = (0, import_react24.useRef)("");
|
|
26752
|
+
const aiFooterRef = (0, import_react24.useRef)("");
|
|
26753
|
+
const applyTreeLocalRef = (0, import_react24.useRef)(
|
|
26448
26754
|
null
|
|
26449
26755
|
);
|
|
26450
|
-
const applyFooterTreeLocalRef = (0,
|
|
26451
|
-
const clearInteractionChromeRef = (0,
|
|
26756
|
+
const applyFooterTreeLocalRef = (0, import_react24.useRef)(null);
|
|
26757
|
+
const clearInteractionChromeRef = (0, import_react24.useRef)(() => {
|
|
26452
26758
|
});
|
|
26453
|
-
const brandKitRef = (0,
|
|
26454
|
-
const stylesRef = (0,
|
|
26455
|
-
const appliedDrawerRef = (0,
|
|
26456
|
-
const pendingDeleteUndoRef = (0,
|
|
26457
|
-
const [
|
|
26458
|
-
const
|
|
26459
|
-
const
|
|
26460
|
-
|
|
26461
|
-
const
|
|
26462
|
-
const
|
|
26463
|
-
const
|
|
26464
|
-
const
|
|
26759
|
+
const brandKitRef = (0, import_react24.useRef)("");
|
|
26760
|
+
const stylesRef = (0, import_react24.useRef)("");
|
|
26761
|
+
const appliedDrawerRef = (0, import_react24.useRef)(null);
|
|
26762
|
+
const pendingDeleteUndoRef = (0, import_react24.useRef)(null);
|
|
26763
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
|
|
26764
|
+
const floatingPanelOpenRef = (0, import_react24.useRef)(false);
|
|
26765
|
+
const floatingPanelRef = (0, import_react24.useRef)(null);
|
|
26766
|
+
floatingPanelRef.current = floatingPanel;
|
|
26767
|
+
const setFloatingPanelRef = (0, import_react24.useRef)(setFloatingPanel);
|
|
26768
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
|
|
26769
|
+
const buttonCollectionDragRef = (0, import_react24.useRef)(null);
|
|
26770
|
+
const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
|
|
26771
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
|
|
26772
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
|
|
26773
|
+
const buttonPointerDragRef = (0, import_react24.useRef)(null);
|
|
26774
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
|
|
26775
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
|
|
26776
|
+
const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
|
|
26777
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
|
|
26778
|
+
const [sitePages, setSitePages] = (0, import_react24.useState)([]);
|
|
26779
|
+
const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26780
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
|
|
26781
|
+
const sectionsPrefetchGenRef = (0, import_react24.useRef)(0);
|
|
26782
|
+
const setLinkPopoverRef = (0, import_react24.useRef)(setLinkPopover);
|
|
26783
|
+
const linkPopoverPanelRef = (0, import_react24.useRef)(null);
|
|
26784
|
+
const linkPopoverOpenRef = (0, import_react24.useRef)(false);
|
|
26785
|
+
const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
|
|
26465
26786
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26787
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26466
26788
|
linkPopoverSessionRef.current = linkPopover;
|
|
26467
|
-
|
|
26789
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26790
|
+
(0, import_react24.useEffect)(() => {
|
|
26791
|
+
const syncViewport = () => {
|
|
26792
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26793
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26794
|
+
};
|
|
26795
|
+
syncViewport();
|
|
26796
|
+
window.addEventListener("resize", syncViewport);
|
|
26797
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26798
|
+
}, []);
|
|
26799
|
+
(0, import_react24.useEffect)(() => {
|
|
26468
26800
|
setSectionOrderPersistHandler((entries) => {
|
|
26469
26801
|
const currentPath = window.location.pathname;
|
|
26470
26802
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26474,7 +26806,7 @@ function OhhwellsBridge() {
|
|
|
26474
26806
|
});
|
|
26475
26807
|
return () => setSectionOrderPersistHandler(null);
|
|
26476
26808
|
}, []);
|
|
26477
|
-
(0,
|
|
26809
|
+
(0, import_react24.useEffect)(() => {
|
|
26478
26810
|
setAiFooterMountOptions({
|
|
26479
26811
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26480
26812
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26537,7 +26869,7 @@ function OhhwellsBridge() {
|
|
|
26537
26869
|
const bumpLinkPopoverGrace = () => {
|
|
26538
26870
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
26539
26871
|
};
|
|
26540
|
-
const runSectionsPrefetch = (0,
|
|
26872
|
+
const runSectionsPrefetch = (0, import_react24.useCallback)((pages) => {
|
|
26541
26873
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
26542
26874
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
26543
26875
|
const paths = pages.map((p) => p.path);
|
|
@@ -26556,9 +26888,9 @@ function OhhwellsBridge() {
|
|
|
26556
26888
|
);
|
|
26557
26889
|
});
|
|
26558
26890
|
}, [isEditMode, pathname]);
|
|
26559
|
-
const runSectionsPrefetchRef = (0,
|
|
26891
|
+
const runSectionsPrefetchRef = (0, import_react24.useRef)(runSectionsPrefetch);
|
|
26560
26892
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26561
|
-
(0,
|
|
26893
|
+
(0, import_react24.useEffect)(() => {
|
|
26562
26894
|
if (!linkPopover) {
|
|
26563
26895
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26564
26896
|
return;
|
|
@@ -26586,7 +26918,7 @@ function OhhwellsBridge() {
|
|
|
26586
26918
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26587
26919
|
};
|
|
26588
26920
|
}, [linkPopover, postToParent2]);
|
|
26589
|
-
(0,
|
|
26921
|
+
(0, import_react24.useEffect)(() => {
|
|
26590
26922
|
if (!isEditMode) return;
|
|
26591
26923
|
const useFixtures = shouldUseDevFixtures();
|
|
26592
26924
|
if (useFixtures) {
|
|
@@ -26612,7 +26944,7 @@ function OhhwellsBridge() {
|
|
|
26612
26944
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26613
26945
|
return () => window.removeEventListener("message", onSitePages);
|
|
26614
26946
|
}, [isEditMode, postToParent2]);
|
|
26615
|
-
(0,
|
|
26947
|
+
(0, import_react24.useEffect)(() => {
|
|
26616
26948
|
if (!isEditMode) return;
|
|
26617
26949
|
const deps = {
|
|
26618
26950
|
getEditContent: () => editContentRef.current,
|
|
@@ -26649,14 +26981,14 @@ function OhhwellsBridge() {
|
|
|
26649
26981
|
window.addEventListener("message", onPageMessage);
|
|
26650
26982
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26651
26983
|
}, [isEditMode, postToParent2]);
|
|
26652
|
-
(0,
|
|
26984
|
+
(0, import_react24.useEffect)(() => {
|
|
26653
26985
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26654
26986
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26655
26987
|
if (Object.keys(manifest).length === 0) return;
|
|
26656
26988
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26657
26989
|
});
|
|
26658
26990
|
}, [isEditMode]);
|
|
26659
|
-
(0,
|
|
26991
|
+
(0, import_react24.useEffect)(() => {
|
|
26660
26992
|
const update = () => {
|
|
26661
26993
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26662
26994
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -26680,10 +27012,10 @@ function OhhwellsBridge() {
|
|
|
26680
27012
|
vvp.removeEventListener("resize", update);
|
|
26681
27013
|
};
|
|
26682
27014
|
}, []);
|
|
26683
|
-
const refreshStateRules = (0,
|
|
27015
|
+
const refreshStateRules = (0, import_react24.useCallback)(() => {
|
|
26684
27016
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
26685
27017
|
}, []);
|
|
26686
|
-
const processConfigRequest = (0,
|
|
27018
|
+
const processConfigRequest = (0, import_react24.useCallback)((insertAfterVal) => {
|
|
26687
27019
|
const tracker = getSectionsTracker();
|
|
26688
27020
|
let entries = [];
|
|
26689
27021
|
try {
|
|
@@ -26706,7 +27038,7 @@ function OhhwellsBridge() {
|
|
|
26706
27038
|
}
|
|
26707
27039
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
26708
27040
|
}, [isEditMode]);
|
|
26709
|
-
const deactivate = (0,
|
|
27041
|
+
const deactivate = (0, import_react24.useCallback)(() => {
|
|
26710
27042
|
const el = activeElRef.current;
|
|
26711
27043
|
if (!el) return;
|
|
26712
27044
|
const isFormBlock = el.dataset.ohwEditable === "form";
|
|
@@ -26772,12 +27104,12 @@ function OhhwellsBridge() {
|
|
|
26772
27104
|
setToolbarShowEditLink(false);
|
|
26773
27105
|
postToParent2({ type: "ow:exit-edit" });
|
|
26774
27106
|
}, [postToParent2]);
|
|
26775
|
-
const clearSelectedAttr = (0,
|
|
27107
|
+
const clearSelectedAttr = (0, import_react24.useCallback)(() => {
|
|
26776
27108
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
26777
27109
|
el.removeAttribute("data-ohw-selected");
|
|
26778
27110
|
});
|
|
26779
27111
|
}, []);
|
|
26780
|
-
const deselect = (0,
|
|
27112
|
+
const deselect = (0, import_react24.useCallback)(() => {
|
|
26781
27113
|
const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
|
|
26782
27114
|
clearSelectedAttr();
|
|
26783
27115
|
selectedElRef.current = null;
|
|
@@ -26813,20 +27145,20 @@ function OhhwellsBridge() {
|
|
|
26813
27145
|
setToolbarVariant("none");
|
|
26814
27146
|
}
|
|
26815
27147
|
}, [clearSelectedAttr]);
|
|
26816
|
-
const markSelected = (0,
|
|
27148
|
+
const markSelected = (0, import_react24.useCallback)((el) => {
|
|
26817
27149
|
clearSelectedAttr();
|
|
26818
27150
|
el.removeAttribute("data-ohw-hovered");
|
|
26819
27151
|
el.setAttribute("data-ohw-selected", "");
|
|
26820
27152
|
}, [clearSelectedAttr]);
|
|
26821
|
-
const isSelectedForHover = (0,
|
|
27153
|
+
const isSelectedForHover = (0, import_react24.useCallback)((el) => {
|
|
26822
27154
|
if (!el) return false;
|
|
26823
27155
|
return [selectedElRef.current, activeElRef.current].some(
|
|
26824
27156
|
(busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
|
|
26825
27157
|
);
|
|
26826
27158
|
}, []);
|
|
26827
|
-
const isSelectedForHoverRef = (0,
|
|
27159
|
+
const isSelectedForHoverRef = (0, import_react24.useRef)(isSelectedForHover);
|
|
26828
27160
|
isSelectedForHoverRef.current = isSelectedForHover;
|
|
26829
|
-
const resolveHrefKeyElement = (0,
|
|
27161
|
+
const resolveHrefKeyElement = (0, import_react24.useCallback)((hrefKey) => {
|
|
26830
27162
|
if (isFooterHrefKey(hrefKey)) {
|
|
26831
27163
|
return document.querySelector(
|
|
26832
27164
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -26841,7 +27173,7 @@ function OhhwellsBridge() {
|
|
|
26841
27173
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
26842
27174
|
);
|
|
26843
27175
|
}, []);
|
|
26844
|
-
const resyncSelectedNavigationItem = (0,
|
|
27176
|
+
const resyncSelectedNavigationItem = (0, import_react24.useCallback)(() => {
|
|
26845
27177
|
const hrefKey = selectedHrefKeyRef.current;
|
|
26846
27178
|
if (hrefKey) {
|
|
26847
27179
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -26879,7 +27211,7 @@ function OhhwellsBridge() {
|
|
|
26879
27211
|
);
|
|
26880
27212
|
}
|
|
26881
27213
|
}, [resolveHrefKeyElement]);
|
|
26882
|
-
const reselectNavigationItem = (0,
|
|
27214
|
+
const reselectNavigationItem = (0, import_react24.useCallback)((navAnchor) => {
|
|
26883
27215
|
selectedElRef.current = navAnchor;
|
|
26884
27216
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
26885
27217
|
selectedFooterColAttrRef.current = null;
|
|
@@ -26910,7 +27242,7 @@ function OhhwellsBridge() {
|
|
|
26910
27242
|
setToolbarShowEditLink(false);
|
|
26911
27243
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
26912
27244
|
}, [markSelected]);
|
|
26913
|
-
const commitNavigationTextEdit = (0,
|
|
27245
|
+
const commitNavigationTextEdit = (0, import_react24.useCallback)((navAnchor) => {
|
|
26914
27246
|
const el = activeElRef.current;
|
|
26915
27247
|
if (!el) return;
|
|
26916
27248
|
const key = el.dataset.ohwKey;
|
|
@@ -26943,7 +27275,7 @@ function OhhwellsBridge() {
|
|
|
26943
27275
|
postToParent2({ type: "ow:exit-edit" });
|
|
26944
27276
|
reselectNavigationItem(navAnchor);
|
|
26945
27277
|
}, [postToParent2, reselectNavigationItem]);
|
|
26946
|
-
const handleAddTopLevelNavItem = (0,
|
|
27278
|
+
const handleAddTopLevelNavItem = (0, import_react24.useCallback)(() => {
|
|
26947
27279
|
const items = listNavbarRootItems();
|
|
26948
27280
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
26949
27281
|
deselectRef.current();
|
|
@@ -26955,7 +27287,7 @@ function OhhwellsBridge() {
|
|
|
26955
27287
|
intent: "add-nav"
|
|
26956
27288
|
});
|
|
26957
27289
|
}, []);
|
|
26958
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
27290
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react24.useCallback)(
|
|
26959
27291
|
(anchor) => {
|
|
26960
27292
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
26961
27293
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -26968,7 +27300,7 @@ function OhhwellsBridge() {
|
|
|
26968
27300
|
},
|
|
26969
27301
|
[postToParent2]
|
|
26970
27302
|
);
|
|
26971
|
-
const handleNavDropdownOpenChange = (0,
|
|
27303
|
+
const handleNavDropdownOpenChange = (0, import_react24.useCallback)((open) => {
|
|
26972
27304
|
const selected = selectedElRef.current;
|
|
26973
27305
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
26974
27306
|
if (isNestedNavChild(selected)) return;
|
|
@@ -26984,7 +27316,7 @@ function OhhwellsBridge() {
|
|
|
26984
27316
|
}
|
|
26985
27317
|
});
|
|
26986
27318
|
}, []);
|
|
26987
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
27319
|
+
const handleFooterHeadingVisibleChange = (0, import_react24.useCallback)(
|
|
26988
27320
|
(visible) => {
|
|
26989
27321
|
const selected = selectedElRef.current;
|
|
26990
27322
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -27037,7 +27369,7 @@ function OhhwellsBridge() {
|
|
|
27037
27369
|
},
|
|
27038
27370
|
[postToParent2]
|
|
27039
27371
|
);
|
|
27040
|
-
const enterEditOnNewItem = (0,
|
|
27372
|
+
const enterEditOnNewItem = (0, import_react24.useCallback)((anchor) => {
|
|
27041
27373
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
27042
27374
|
if (!label) {
|
|
27043
27375
|
selectRef.current(anchor);
|
|
@@ -27046,8 +27378,8 @@ function OhhwellsBridge() {
|
|
|
27046
27378
|
setNavGroupForceOpen(anchor, true);
|
|
27047
27379
|
activateRef.current(label);
|
|
27048
27380
|
}, []);
|
|
27049
|
-
const pendingSocialAddRef = (0,
|
|
27050
|
-
const handleAddChildItem = (0,
|
|
27381
|
+
const pendingSocialAddRef = (0, import_react24.useRef)(null);
|
|
27382
|
+
const handleAddChildItem = (0, import_react24.useCallback)(() => {
|
|
27051
27383
|
const selected = selectedElRef.current;
|
|
27052
27384
|
if (!selected) return;
|
|
27053
27385
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
@@ -27174,7 +27506,7 @@ function OhhwellsBridge() {
|
|
|
27174
27506
|
});
|
|
27175
27507
|
});
|
|
27176
27508
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
27177
|
-
const handleAddFooterColumn = (0,
|
|
27509
|
+
const handleAddFooterColumn = (0, import_react24.useCallback)(() => {
|
|
27178
27510
|
if (document.querySelector("[data-ai-footer]")) {
|
|
27179
27511
|
const state = parseAiFooterState(aiFooterRef.current);
|
|
27180
27512
|
if (!state?.tree) return;
|
|
@@ -27230,7 +27562,7 @@ function OhhwellsBridge() {
|
|
|
27230
27562
|
selectRef.current(result.firstLink);
|
|
27231
27563
|
});
|
|
27232
27564
|
}, [postToParent2]);
|
|
27233
|
-
const clearFooterDragVisuals = (0,
|
|
27565
|
+
const clearFooterDragVisuals = (0, import_react24.useCallback)(() => {
|
|
27234
27566
|
footerDragRef.current = null;
|
|
27235
27567
|
setSiblingHintRects([]);
|
|
27236
27568
|
setFooterDropSlots([]);
|
|
@@ -27239,7 +27571,7 @@ function OhhwellsBridge() {
|
|
|
27239
27571
|
setIsItemDragging(false);
|
|
27240
27572
|
unlockFooterDragInteraction();
|
|
27241
27573
|
}, []);
|
|
27242
|
-
const refreshFooterDragVisuals = (0,
|
|
27574
|
+
const refreshFooterDragVisuals = (0, import_react24.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
27243
27575
|
const dragged = session.draggedEl;
|
|
27244
27576
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
27245
27577
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -27271,13 +27603,13 @@ function OhhwellsBridge() {
|
|
|
27271
27603
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
27272
27604
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
27273
27605
|
}, []);
|
|
27274
|
-
const refreshFooterDragVisualsRef = (0,
|
|
27606
|
+
const refreshFooterDragVisualsRef = (0, import_react24.useRef)(refreshFooterDragVisuals);
|
|
27275
27607
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
27276
|
-
const commitFooterDragRef = (0,
|
|
27608
|
+
const commitFooterDragRef = (0, import_react24.useRef)(() => {
|
|
27277
27609
|
});
|
|
27278
|
-
const beginFooterDragRef = (0,
|
|
27610
|
+
const beginFooterDragRef = (0, import_react24.useRef)(() => {
|
|
27279
27611
|
});
|
|
27280
|
-
const beginFooterDrag = (0,
|
|
27612
|
+
const beginFooterDrag = (0, import_react24.useCallback)(
|
|
27281
27613
|
(session) => {
|
|
27282
27614
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
27283
27615
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -27297,7 +27629,7 @@ function OhhwellsBridge() {
|
|
|
27297
27629
|
[refreshFooterDragVisuals]
|
|
27298
27630
|
);
|
|
27299
27631
|
beginFooterDragRef.current = beginFooterDrag;
|
|
27300
|
-
const commitFooterDrag = (0,
|
|
27632
|
+
const commitFooterDrag = (0, import_react24.useCallback)(
|
|
27301
27633
|
(clientX, clientY) => {
|
|
27302
27634
|
const session = footerDragRef.current;
|
|
27303
27635
|
if (!session) {
|
|
@@ -27469,7 +27801,7 @@ function OhhwellsBridge() {
|
|
|
27469
27801
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
27470
27802
|
);
|
|
27471
27803
|
commitFooterDragRef.current = commitFooterDrag;
|
|
27472
|
-
const startFooterLinkDrag = (0,
|
|
27804
|
+
const startFooterLinkDrag = (0, import_react24.useCallback)(
|
|
27473
27805
|
(anchor, clientX, clientY, wasSelected) => {
|
|
27474
27806
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
27475
27807
|
if (!hrefKey) return false;
|
|
@@ -27505,7 +27837,7 @@ function OhhwellsBridge() {
|
|
|
27505
27837
|
},
|
|
27506
27838
|
[beginFooterDrag]
|
|
27507
27839
|
);
|
|
27508
|
-
const startFooterColumnDrag = (0,
|
|
27840
|
+
const startFooterColumnDrag = (0, import_react24.useCallback)(
|
|
27509
27841
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
27510
27842
|
const columns = listFooterColumns(columnEl);
|
|
27511
27843
|
const idx = columns.indexOf(columnEl);
|
|
@@ -27525,7 +27857,7 @@ function OhhwellsBridge() {
|
|
|
27525
27857
|
},
|
|
27526
27858
|
[beginFooterDrag]
|
|
27527
27859
|
);
|
|
27528
|
-
const persistButtonCollectionDrag = (0,
|
|
27860
|
+
const persistButtonCollectionDrag = (0, import_react24.useCallback)(
|
|
27529
27861
|
(button, clientX) => {
|
|
27530
27862
|
const insertIndex = buttonDropInsertIndexRef.current;
|
|
27531
27863
|
if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
|
|
@@ -27549,7 +27881,7 @@ function OhhwellsBridge() {
|
|
|
27549
27881
|
},
|
|
27550
27882
|
[postToParent2]
|
|
27551
27883
|
);
|
|
27552
|
-
const refreshButtonDragVisuals = (0,
|
|
27884
|
+
const refreshButtonDragVisuals = (0, import_react24.useCallback)((button, clientX, clientY) => {
|
|
27553
27885
|
const collection = buttonCollectionOf(button);
|
|
27554
27886
|
if (!collection) {
|
|
27555
27887
|
setButtonDropSlots([]);
|
|
@@ -27566,7 +27898,7 @@ function OhhwellsBridge() {
|
|
|
27566
27898
|
setDraggedItemRect(button.getBoundingClientRect());
|
|
27567
27899
|
if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
|
|
27568
27900
|
}, []);
|
|
27569
|
-
const handleItemDragStart = (0,
|
|
27901
|
+
const handleItemDragStart = (0, import_react24.useCallback)(
|
|
27570
27902
|
(e) => {
|
|
27571
27903
|
const selected = selectedElRef.current;
|
|
27572
27904
|
if (!selected) {
|
|
@@ -27597,7 +27929,7 @@ function OhhwellsBridge() {
|
|
|
27597
27929
|
},
|
|
27598
27930
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
|
|
27599
27931
|
);
|
|
27600
|
-
const handleItemDragEnd = (0,
|
|
27932
|
+
const handleItemDragEnd = (0, import_react24.useCallback)(
|
|
27601
27933
|
(e) => {
|
|
27602
27934
|
const collectionButton = buttonCollectionDragRef.current;
|
|
27603
27935
|
if (collectionButton) {
|
|
@@ -27628,7 +27960,7 @@ function OhhwellsBridge() {
|
|
|
27628
27960
|
},
|
|
27629
27961
|
[commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
|
|
27630
27962
|
);
|
|
27631
|
-
const handleItemChromePointerDown = (0,
|
|
27963
|
+
const handleItemChromePointerDown = (0, import_react24.useCallback)((e) => {
|
|
27632
27964
|
if (e.button !== 0) return;
|
|
27633
27965
|
const selected = selectedElRef.current;
|
|
27634
27966
|
if (!selected) return;
|
|
@@ -27669,7 +28001,7 @@ function OhhwellsBridge() {
|
|
|
27669
28001
|
}
|
|
27670
28002
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
27671
28003
|
}, [armNavPressFromChrome]);
|
|
27672
|
-
const handleItemChromeClick = (0,
|
|
28004
|
+
const handleItemChromeClick = (0, import_react24.useCallback)((clientX, clientY) => {
|
|
27673
28005
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
27674
28006
|
suppressNextClickRef.current = false;
|
|
27675
28007
|
return;
|
|
@@ -27682,7 +28014,7 @@ function OhhwellsBridge() {
|
|
|
27682
28014
|
}, []);
|
|
27683
28015
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
27684
28016
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
27685
|
-
const select = (0,
|
|
28017
|
+
const select = (0, import_react24.useCallback)((anchor) => {
|
|
27686
28018
|
if (!isNavigationItem2(anchor)) return;
|
|
27687
28019
|
if (activeElRef.current) deactivate();
|
|
27688
28020
|
clearSocialSelectionRef.current();
|
|
@@ -27759,7 +28091,7 @@ function OhhwellsBridge() {
|
|
|
27759
28091
|
setLogoSizeDraft(null);
|
|
27760
28092
|
}
|
|
27761
28093
|
}, [deactivate, markSelected]);
|
|
27762
|
-
const selectFrame = (0,
|
|
28094
|
+
const selectFrame = (0, import_react24.useCallback)((el) => {
|
|
27763
28095
|
if (!isNavigationContainer(el)) return;
|
|
27764
28096
|
if (activeElRef.current) deactivate();
|
|
27765
28097
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -27800,7 +28132,7 @@ function OhhwellsBridge() {
|
|
|
27800
28132
|
setFloatingPanelPos(null);
|
|
27801
28133
|
setLogoSizeDraft(null);
|
|
27802
28134
|
}, [deactivate, markSelected, postToParent2]);
|
|
27803
|
-
const selectLogo = (0,
|
|
28135
|
+
const selectLogo = (0, import_react24.useCallback)(
|
|
27804
28136
|
(logoEl) => {
|
|
27805
28137
|
if (activeElRef.current) deactivate();
|
|
27806
28138
|
selectedElRef.current = logoEl;
|
|
@@ -27829,7 +28161,7 @@ function OhhwellsBridge() {
|
|
|
27829
28161
|
},
|
|
27830
28162
|
[deactivate, markSelected]
|
|
27831
28163
|
);
|
|
27832
|
-
const openLogoSizePanel = (0,
|
|
28164
|
+
const openLogoSizePanel = (0, import_react24.useCallback)((logoEl) => {
|
|
27833
28165
|
const placement = getLogoPlacement(logoEl);
|
|
27834
28166
|
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
27835
28167
|
setLogoSizeDraft(draft);
|
|
@@ -27842,7 +28174,7 @@ function OhhwellsBridge() {
|
|
|
27842
28174
|
placement
|
|
27843
28175
|
});
|
|
27844
28176
|
}, []);
|
|
27845
|
-
const openSocialsDisplayPanel = (0,
|
|
28177
|
+
const openSocialsDisplayPanel = (0, import_react24.useCallback)((row) => {
|
|
27846
28178
|
setFloatingPanelPos(null);
|
|
27847
28179
|
setParentScrollSnap(parentScrollRef.current);
|
|
27848
28180
|
setFloatingPanel({
|
|
@@ -27853,7 +28185,7 @@ function OhhwellsBridge() {
|
|
|
27853
28185
|
row
|
|
27854
28186
|
});
|
|
27855
28187
|
}, []);
|
|
27856
|
-
const rememberButtonTokens = (0,
|
|
28188
|
+
const rememberButtonTokens = (0, import_react24.useCallback)(
|
|
27857
28189
|
(content, tokens, nodes) => {
|
|
27858
28190
|
if (nodes.length === 0) return content;
|
|
27859
28191
|
const next = { ...content };
|
|
@@ -27864,7 +28196,7 @@ function OhhwellsBridge() {
|
|
|
27864
28196
|
},
|
|
27865
28197
|
[postToParent2]
|
|
27866
28198
|
);
|
|
27867
|
-
const tokensForButton = (0,
|
|
28199
|
+
const tokensForButton = (0, import_react24.useCallback)(
|
|
27868
28200
|
(el, persistFallback = false) => {
|
|
27869
28201
|
const stored = readStoredStyleTokens(editContentRef.current);
|
|
27870
28202
|
if (stored) return stored;
|
|
@@ -27879,7 +28211,7 @@ function OhhwellsBridge() {
|
|
|
27879
28211
|
},
|
|
27880
28212
|
[rememberButtonTokens]
|
|
27881
28213
|
);
|
|
27882
|
-
const openButtonStylePanel = (0,
|
|
28214
|
+
const openButtonStylePanel = (0, import_react24.useCallback)(
|
|
27883
28215
|
(anchor) => {
|
|
27884
28216
|
const id = buttonId(anchor);
|
|
27885
28217
|
if (!id) return;
|
|
@@ -27897,7 +28229,7 @@ function OhhwellsBridge() {
|
|
|
27897
28229
|
},
|
|
27898
28230
|
[tokensForButton]
|
|
27899
28231
|
);
|
|
27900
|
-
const applySelectedButtonStyle = (0,
|
|
28232
|
+
const applySelectedButtonStyle = (0, import_react24.useCallback)(
|
|
27901
28233
|
(patch) => {
|
|
27902
28234
|
const panel = floatingPanelRef.current;
|
|
27903
28235
|
const id = panel?.kind === "button-style" ? panel.buttonId : null;
|
|
@@ -27915,7 +28247,7 @@ function OhhwellsBridge() {
|
|
|
27915
28247
|
},
|
|
27916
28248
|
[postToParent2]
|
|
27917
28249
|
);
|
|
27918
|
-
(0,
|
|
28250
|
+
(0, import_react24.useEffect)(() => {
|
|
27919
28251
|
const onDragOver = (e) => {
|
|
27920
28252
|
const dragged = buttonCollectionDragRef.current;
|
|
27921
28253
|
if (!dragged) return;
|
|
@@ -27934,11 +28266,11 @@ function OhhwellsBridge() {
|
|
|
27934
28266
|
document.removeEventListener("drop", onDrop);
|
|
27935
28267
|
};
|
|
27936
28268
|
}, [refreshButtonDragVisuals]);
|
|
27937
|
-
const isEditModeRef = (0,
|
|
27938
|
-
const requestMissingSocialIconsRef = (0,
|
|
28269
|
+
const isEditModeRef = (0, import_react24.useRef)(false);
|
|
28270
|
+
const requestMissingSocialIconsRef = (0, import_react24.useRef)(() => {
|
|
27939
28271
|
});
|
|
27940
|
-
const askedSocialIconsRef = (0,
|
|
27941
|
-
const requestMissingSocialIcons = (0,
|
|
28272
|
+
const askedSocialIconsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
|
|
28273
|
+
const requestMissingSocialIcons = (0, import_react24.useCallback)(() => {
|
|
27942
28274
|
const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
|
|
27943
28275
|
const missing = socialsMissingIcons(row);
|
|
27944
28276
|
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
@@ -27950,7 +28282,7 @@ function OhhwellsBridge() {
|
|
|
27950
28282
|
}, []);
|
|
27951
28283
|
requestMissingSocialIconsRef.current = requestMissingSocialIcons;
|
|
27952
28284
|
isEditModeRef.current = isEditMode;
|
|
27953
|
-
const changeSocialsDisplay = (0,
|
|
28285
|
+
const changeSocialsDisplay = (0, import_react24.useCallback)(
|
|
27954
28286
|
(row, next) => {
|
|
27955
28287
|
if (next.icon) {
|
|
27956
28288
|
const missing = socialsMissingIcons(row);
|
|
@@ -27974,19 +28306,19 @@ function OhhwellsBridge() {
|
|
|
27974
28306
|
},
|
|
27975
28307
|
[]
|
|
27976
28308
|
);
|
|
27977
|
-
const closeFloatingPanelOnly = (0,
|
|
28309
|
+
const closeFloatingPanelOnly = (0, import_react24.useCallback)(() => {
|
|
27978
28310
|
setFloatingPanel(null);
|
|
27979
28311
|
setFloatingPanelPos(null);
|
|
27980
28312
|
setLogoSizeDraft(null);
|
|
27981
28313
|
}, []);
|
|
27982
28314
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
27983
|
-
const closeFloatingPanelAndDeselect = (0,
|
|
28315
|
+
const closeFloatingPanelAndDeselect = (0, import_react24.useCallback)(() => {
|
|
27984
28316
|
setFloatingPanel(null);
|
|
27985
28317
|
setFloatingPanelPos(null);
|
|
27986
28318
|
setLogoSizeDraft(null);
|
|
27987
28319
|
deselectRef.current();
|
|
27988
28320
|
}, []);
|
|
27989
|
-
(0,
|
|
28321
|
+
(0, import_react24.useEffect)(() => {
|
|
27990
28322
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
27991
28323
|
if (!session || !logoSizeDraft) {
|
|
27992
28324
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28005,7 +28337,7 @@ function OhhwellsBridge() {
|
|
|
28005
28337
|
max: LOGO_SIZE_MAX
|
|
28006
28338
|
});
|
|
28007
28339
|
}, [floatingPanel, logoSizeDraft, editorViewport]);
|
|
28008
|
-
const persistLogoSizeDraft = (0,
|
|
28340
|
+
const persistLogoSizeDraft = (0, import_react24.useCallback)(
|
|
28009
28341
|
(placement, draft) => {
|
|
28010
28342
|
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
28011
28343
|
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
@@ -28045,7 +28377,7 @@ function OhhwellsBridge() {
|
|
|
28045
28377
|
},
|
|
28046
28378
|
[postToParent2]
|
|
28047
28379
|
);
|
|
28048
|
-
const activate = (0,
|
|
28380
|
+
const activate = (0, import_react24.useCallback)((el, options) => {
|
|
28049
28381
|
if (activeElRef.current === el) return;
|
|
28050
28382
|
document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
|
|
28051
28383
|
hovered.removeAttribute("data-ohw-hovered");
|
|
@@ -28143,8 +28475,8 @@ function OhhwellsBridge() {
|
|
|
28143
28475
|
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
28144
28476
|
deselectRef.current = deselect;
|
|
28145
28477
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28146
|
-
const lastSiteWideScopeRef = (0,
|
|
28147
|
-
(0,
|
|
28478
|
+
const lastSiteWideScopeRef = (0, import_react24.useRef)(null);
|
|
28479
|
+
(0, import_react24.useEffect)(() => {
|
|
28148
28480
|
if (!isEditMode) {
|
|
28149
28481
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28150
28482
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28170,7 +28502,7 @@ function OhhwellsBridge() {
|
|
|
28170
28502
|
isFooterFrameSelection,
|
|
28171
28503
|
postToParent2
|
|
28172
28504
|
]);
|
|
28173
|
-
(0,
|
|
28505
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
28174
28506
|
if (!subdomain || isEditMode) {
|
|
28175
28507
|
setFetchState("done");
|
|
28176
28508
|
return;
|
|
@@ -28197,6 +28529,7 @@ function OhhwellsBridge() {
|
|
|
28197
28529
|
applyAiFooterFromContent(content);
|
|
28198
28530
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28199
28531
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28532
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28200
28533
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28201
28534
|
}
|
|
28202
28535
|
applyBrandChrome(content);
|
|
@@ -28207,15 +28540,16 @@ function OhhwellsBridge() {
|
|
|
28207
28540
|
if (key === "__ohw_sections") continue;
|
|
28208
28541
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28209
28542
|
if (key === AI_FOOTER_KEY) continue;
|
|
28543
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28544
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28210
28545
|
if (key === BRAND_KIT_KEY) continue;
|
|
28211
28546
|
if (key === STYLE_STORE_KEY) continue;
|
|
28212
28547
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28213
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28214
28548
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28215
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28216
28549
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28217
28550
|
continue;
|
|
28218
28551
|
}
|
|
28552
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28219
28553
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28220
28554
|
if (applyCarouselNode(key, val)) continue;
|
|
28221
28555
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28255,6 +28589,7 @@ function OhhwellsBridge() {
|
|
|
28255
28589
|
});
|
|
28256
28590
|
applyLinkByKey(key, val);
|
|
28257
28591
|
}
|
|
28592
|
+
applySectionEmbeds(content);
|
|
28258
28593
|
applyLogoFromContent(content);
|
|
28259
28594
|
applyLogoSizes(content);
|
|
28260
28595
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28321,7 +28656,7 @@ function OhhwellsBridge() {
|
|
|
28321
28656
|
cancelled = true;
|
|
28322
28657
|
};
|
|
28323
28658
|
}, [subdomain, isEditMode]);
|
|
28324
|
-
(0,
|
|
28659
|
+
(0, import_react24.useEffect)(() => {
|
|
28325
28660
|
if (!isEditMode) return;
|
|
28326
28661
|
const resolveIndex = (form, clientY) => {
|
|
28327
28662
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28362,7 +28697,7 @@ function OhhwellsBridge() {
|
|
|
28362
28697
|
window.removeEventListener("drop", onDrop, true);
|
|
28363
28698
|
};
|
|
28364
28699
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28365
|
-
(0,
|
|
28700
|
+
(0, import_react24.useEffect)(() => {
|
|
28366
28701
|
if (!isEditMode) return;
|
|
28367
28702
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28368
28703
|
markFormFields(form);
|
|
@@ -28374,7 +28709,7 @@ function OhhwellsBridge() {
|
|
|
28374
28709
|
});
|
|
28375
28710
|
return () => observer.disconnect();
|
|
28376
28711
|
}, [isEditMode, fetchState, pathname]);
|
|
28377
|
-
(0,
|
|
28712
|
+
(0, import_react24.useEffect)(() => {
|
|
28378
28713
|
if (!isEditMode) return;
|
|
28379
28714
|
let saveTimer = null;
|
|
28380
28715
|
const onInput = (e) => {
|
|
@@ -28396,14 +28731,14 @@ function OhhwellsBridge() {
|
|
|
28396
28731
|
document.addEventListener("input", onInput, true);
|
|
28397
28732
|
return () => document.removeEventListener("input", onInput, true);
|
|
28398
28733
|
}, [isEditMode, persistFields]);
|
|
28399
|
-
(0,
|
|
28734
|
+
(0, import_react24.useEffect)(() => {
|
|
28400
28735
|
if (isEditMode || fetchState !== "done") return;
|
|
28401
28736
|
const content = contentCache.get(subdomain) ?? {};
|
|
28402
28737
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28403
28738
|
reconcileFieldsFromContent(form, content);
|
|
28404
28739
|
});
|
|
28405
28740
|
}, [isEditMode, fetchState, subdomain]);
|
|
28406
|
-
(0,
|
|
28741
|
+
(0, import_react24.useEffect)(() => {
|
|
28407
28742
|
if (!isEditMode) return;
|
|
28408
28743
|
const swallow = (e) => {
|
|
28409
28744
|
const target = e.target;
|
|
@@ -28412,14 +28747,14 @@ function OhhwellsBridge() {
|
|
|
28412
28747
|
document.addEventListener("submit", swallow, true);
|
|
28413
28748
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28414
28749
|
}, [isEditMode]);
|
|
28415
|
-
(0,
|
|
28750
|
+
(0, import_react24.useEffect)(() => {
|
|
28416
28751
|
if (isEditMode || fetchState !== "done") return;
|
|
28417
28752
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28418
28753
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28419
28754
|
console.log({ apiUrl, subdomain });
|
|
28420
28755
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28421
28756
|
}, [isEditMode, fetchState, subdomain]);
|
|
28422
|
-
(0,
|
|
28757
|
+
(0, import_react24.useEffect)(() => {
|
|
28423
28758
|
if (!subdomain || isEditMode) return;
|
|
28424
28759
|
let debounceTimer = null;
|
|
28425
28760
|
let observer = null;
|
|
@@ -28443,20 +28778,22 @@ function OhhwellsBridge() {
|
|
|
28443
28778
|
}
|
|
28444
28779
|
applyAiFooterFromContent(content);
|
|
28445
28780
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28781
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28446
28782
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28447
28783
|
}
|
|
28448
28784
|
for (const [key, val] of Object.entries(content)) {
|
|
28449
28785
|
if (key === "__ohw_sections") continue;
|
|
28450
28786
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28451
28787
|
if (key === AI_FOOTER_KEY) continue;
|
|
28788
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28789
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28452
28790
|
if (key === BRAND_KIT_KEY) continue;
|
|
28453
28791
|
if (key === STYLE_STORE_KEY) continue;
|
|
28454
28792
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28455
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28456
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28457
28793
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28458
28794
|
continue;
|
|
28459
28795
|
}
|
|
28796
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28460
28797
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28461
28798
|
if (applyCarouselNode(key, val)) continue;
|
|
28462
28799
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28481,6 +28818,7 @@ function OhhwellsBridge() {
|
|
|
28481
28818
|
});
|
|
28482
28819
|
applyLinkByKey(key, val);
|
|
28483
28820
|
}
|
|
28821
|
+
applySectionEmbeds(content);
|
|
28484
28822
|
applyLogoFromContent(content);
|
|
28485
28823
|
reconcileNavbarItemsFromContent(content);
|
|
28486
28824
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28536,16 +28874,16 @@ function OhhwellsBridge() {
|
|
|
28536
28874
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28537
28875
|
};
|
|
28538
28876
|
}, [subdomain, isEditMode, pathname]);
|
|
28539
|
-
(0,
|
|
28877
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
28540
28878
|
const el = document.getElementById("ohw-loader");
|
|
28541
28879
|
if (!el) return;
|
|
28542
28880
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28543
28881
|
el.style.display = visible ? "flex" : "none";
|
|
28544
28882
|
}, [subdomain, fetchState]);
|
|
28545
|
-
(0,
|
|
28883
|
+
(0, import_react24.useEffect)(() => {
|
|
28546
28884
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28547
28885
|
}, [pathname, postToParent2]);
|
|
28548
|
-
(0,
|
|
28886
|
+
(0, import_react24.useEffect)(() => {
|
|
28549
28887
|
if (!subdomain || isEditMode) return;
|
|
28550
28888
|
const content = contentCache.get(subdomain);
|
|
28551
28889
|
if (!content) return;
|
|
@@ -28563,7 +28901,7 @@ function OhhwellsBridge() {
|
|
|
28563
28901
|
}
|
|
28564
28902
|
applyAiFooterFromContent(content);
|
|
28565
28903
|
}, [pathname, subdomain, isEditMode]);
|
|
28566
|
-
(0,
|
|
28904
|
+
(0, import_react24.useEffect)(() => {
|
|
28567
28905
|
if (!isEditMode) return;
|
|
28568
28906
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28569
28907
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28571,12 +28909,12 @@ function OhhwellsBridge() {
|
|
|
28571
28909
|
deselectRef.current();
|
|
28572
28910
|
deactivateRef.current();
|
|
28573
28911
|
}, [pathname, isEditMode]);
|
|
28574
|
-
(0,
|
|
28912
|
+
(0, import_react24.useEffect)(() => {
|
|
28575
28913
|
if (!isEditMode) return;
|
|
28576
28914
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28577
28915
|
initItemInstancesFromContent(editContentRef.current);
|
|
28578
28916
|
}, [pathname, isEditMode]);
|
|
28579
|
-
(0,
|
|
28917
|
+
(0, import_react24.useEffect)(() => {
|
|
28580
28918
|
if (!isEditMode) return;
|
|
28581
28919
|
const observer = new MutationObserver(() => {
|
|
28582
28920
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28587,7 +28925,7 @@ function OhhwellsBridge() {
|
|
|
28587
28925
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28588
28926
|
return () => observer.disconnect();
|
|
28589
28927
|
}, [isEditMode, pathname]);
|
|
28590
|
-
(0,
|
|
28928
|
+
(0, import_react24.useEffect)(() => {
|
|
28591
28929
|
const contentForNav = () => {
|
|
28592
28930
|
if (isEditMode) return editContentRef.current;
|
|
28593
28931
|
if (!subdomain) return {};
|
|
@@ -28660,7 +28998,7 @@ function OhhwellsBridge() {
|
|
|
28660
28998
|
observer?.disconnect();
|
|
28661
28999
|
};
|
|
28662
29000
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28663
|
-
(0,
|
|
29001
|
+
(0, import_react24.useEffect)(() => {
|
|
28664
29002
|
if (!isEditMode) return;
|
|
28665
29003
|
let applying = false;
|
|
28666
29004
|
let rafId = null;
|
|
@@ -28698,7 +29036,7 @@ function OhhwellsBridge() {
|
|
|
28698
29036
|
observer.disconnect();
|
|
28699
29037
|
};
|
|
28700
29038
|
}, [isEditMode, pathname]);
|
|
28701
|
-
(0,
|
|
29039
|
+
(0, import_react24.useEffect)(() => {
|
|
28702
29040
|
if (!isEditMode) return;
|
|
28703
29041
|
let lastPosted = 0;
|
|
28704
29042
|
const measure = () => {
|
|
@@ -28720,29 +29058,14 @@ function OhhwellsBridge() {
|
|
|
28720
29058
|
const t2 = setTimeout(measure, 500);
|
|
28721
29059
|
const ro = new ResizeObserver(schedule);
|
|
28722
29060
|
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);
|
|
28736
29061
|
return () => {
|
|
28737
29062
|
clearTimeout(t1);
|
|
28738
29063
|
clearTimeout(t2);
|
|
28739
29064
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28740
29065
|
ro.disconnect();
|
|
28741
|
-
clearResizeTimers();
|
|
28742
|
-
window.removeEventListener("resize", handleResize);
|
|
28743
29066
|
};
|
|
28744
29067
|
}, [pathname, isEditMode, postToParent2]);
|
|
28745
|
-
(0,
|
|
29068
|
+
(0, import_react24.useEffect)(() => {
|
|
28746
29069
|
if (isEditMode) return;
|
|
28747
29070
|
const handleClick = (e) => {
|
|
28748
29071
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28756,7 +29079,7 @@ function OhhwellsBridge() {
|
|
|
28756
29079
|
document.addEventListener("click", handleClick, true);
|
|
28757
29080
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28758
29081
|
}, [isEditMode, router, pathname]);
|
|
28759
|
-
(0,
|
|
29082
|
+
(0, import_react24.useEffect)(() => {
|
|
28760
29083
|
if (!isEditMode) {
|
|
28761
29084
|
editStylesRef.current?.base.remove();
|
|
28762
29085
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -29036,6 +29359,13 @@ function OhhwellsBridge() {
|
|
|
29036
29359
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29037
29360
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29038
29361
|
if (isInsideLinkEditor(target)) return;
|
|
29362
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29363
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29364
|
+
if (target.closest(
|
|
29365
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29366
|
+
)) {
|
|
29367
|
+
return;
|
|
29368
|
+
}
|
|
29039
29369
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29040
29370
|
clearMediaSelectionRef.current();
|
|
29041
29371
|
}
|
|
@@ -29059,8 +29389,6 @@ function OhhwellsBridge() {
|
|
|
29059
29389
|
return;
|
|
29060
29390
|
}
|
|
29061
29391
|
}
|
|
29062
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29063
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29064
29392
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29065
29393
|
if (collectionItem) {
|
|
29066
29394
|
e.preventDefault();
|
|
@@ -29072,11 +29400,6 @@ function OhhwellsBridge() {
|
|
|
29072
29400
|
});
|
|
29073
29401
|
return;
|
|
29074
29402
|
}
|
|
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
|
-
}
|
|
29080
29403
|
{
|
|
29081
29404
|
const formEl = getFormElement(target);
|
|
29082
29405
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29230,9 +29553,13 @@ function OhhwellsBridge() {
|
|
|
29230
29553
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29231
29554
|
e.preventDefault();
|
|
29232
29555
|
e.stopPropagation();
|
|
29233
|
-
selectIconElementRef.current(editable);
|
|
29234
29556
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29235
29557
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29558
|
+
if (aiIcon) {
|
|
29559
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29560
|
+
} else {
|
|
29561
|
+
selectIconElementRef.current(editable);
|
|
29562
|
+
}
|
|
29236
29563
|
postToParentRef.current({
|
|
29237
29564
|
type: "ow:icon-pick",
|
|
29238
29565
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29460,6 +29787,9 @@ function OhhwellsBridge() {
|
|
|
29460
29787
|
setHoveredItemRect(null);
|
|
29461
29788
|
hoveredNavContainerRef.current = null;
|
|
29462
29789
|
setHoveredNavContainerRect(null);
|
|
29790
|
+
siblingHintElRef.current = null;
|
|
29791
|
+
setSiblingHintRect(null);
|
|
29792
|
+
setSiblingHintRects([]);
|
|
29463
29793
|
return;
|
|
29464
29794
|
}
|
|
29465
29795
|
{
|
|
@@ -29580,7 +29910,6 @@ function OhhwellsBridge() {
|
|
|
29580
29910
|
hoveredNavContainerRef.current = null;
|
|
29581
29911
|
setHoveredNavContainerRect(null);
|
|
29582
29912
|
hoveredItemElRef.current = editable;
|
|
29583
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29584
29913
|
}
|
|
29585
29914
|
}
|
|
29586
29915
|
}
|
|
@@ -30290,7 +30619,11 @@ function OhhwellsBridge() {
|
|
|
30290
30619
|
};
|
|
30291
30620
|
const handleMouseMove = (e) => {
|
|
30292
30621
|
const { clientX, clientY } = e;
|
|
30293
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30622
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30623
|
+
dismissImageHover();
|
|
30624
|
+
clearImageHover();
|
|
30625
|
+
return;
|
|
30626
|
+
}
|
|
30294
30627
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30295
30628
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30296
30629
|
formHoverElRef.current = null;
|
|
@@ -30319,7 +30652,12 @@ function OhhwellsBridge() {
|
|
|
30319
30652
|
setHoveredItemRect(null);
|
|
30320
30653
|
hoveredNavContainerRef.current = null;
|
|
30321
30654
|
setHoveredNavContainerRect(null);
|
|
30655
|
+
siblingHintElRef.current = null;
|
|
30656
|
+
setSiblingHintRect(null);
|
|
30657
|
+
setSiblingHintRects([]);
|
|
30322
30658
|
dismissImageHover();
|
|
30659
|
+
clearImageHover();
|
|
30660
|
+
setSectionGap(null);
|
|
30323
30661
|
return;
|
|
30324
30662
|
}
|
|
30325
30663
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30331,7 +30669,11 @@ function OhhwellsBridge() {
|
|
|
30331
30669
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30332
30670
|
const { clientX, clientY } = e.data;
|
|
30333
30671
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30334
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30672
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30673
|
+
dismissImageHover();
|
|
30674
|
+
clearImageHover();
|
|
30675
|
+
return;
|
|
30676
|
+
}
|
|
30335
30677
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30336
30678
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30337
30679
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30711,6 +31053,7 @@ function OhhwellsBridge() {
|
|
|
30711
31053
|
applyAiFooterFromContent(content);
|
|
30712
31054
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30713
31055
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31056
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30714
31057
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30715
31058
|
}
|
|
30716
31059
|
applyBrandChrome(content);
|
|
@@ -30725,15 +31068,16 @@ function OhhwellsBridge() {
|
|
|
30725
31068
|
}
|
|
30726
31069
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30727
31070
|
if (key === AI_FOOTER_KEY) continue;
|
|
31071
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31072
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30728
31073
|
if (key === BRAND_KIT_KEY) continue;
|
|
30729
31074
|
if (key === STYLE_STORE_KEY) continue;
|
|
30730
31075
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30731
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30732
31076
|
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;
|
|
30734
31077
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30735
31078
|
continue;
|
|
30736
31079
|
}
|
|
31080
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30737
31081
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30738
31082
|
if (applyCarouselNode(key, val)) continue;
|
|
30739
31083
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30759,6 +31103,7 @@ function OhhwellsBridge() {
|
|
|
30759
31103
|
});
|
|
30760
31104
|
applyLinkByKey(key, val);
|
|
30761
31105
|
}
|
|
31106
|
+
applySectionEmbeds(content);
|
|
30762
31107
|
applyLogoFromContent(content);
|
|
30763
31108
|
applyLogoSizes(content);
|
|
30764
31109
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31366,6 +31711,12 @@ function OhhwellsBridge() {
|
|
|
31366
31711
|
closeLinkPopoverRef.current();
|
|
31367
31712
|
return;
|
|
31368
31713
|
}
|
|
31714
|
+
if (floatingPanelOpenRef.current) {
|
|
31715
|
+
setFloatingPanelRef.current(null);
|
|
31716
|
+
deselectRef.current();
|
|
31717
|
+
deactivateRef.current();
|
|
31718
|
+
return;
|
|
31719
|
+
}
|
|
31369
31720
|
deselectRef.current();
|
|
31370
31721
|
deactivateRef.current();
|
|
31371
31722
|
clearMediaSelectionRef.current();
|
|
@@ -32201,17 +32552,17 @@ function OhhwellsBridge() {
|
|
|
32201
32552
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32202
32553
|
window.removeEventListener("message", handleDeactivate);
|
|
32203
32554
|
window.removeEventListener("message", handleSelectNav);
|
|
32204
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32205
32555
|
window.removeEventListener("message", handleToastAction);
|
|
32206
32556
|
window.removeEventListener("message", handleFormCount);
|
|
32207
32557
|
window.removeEventListener("message", handleUiEscape);
|
|
32558
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32208
32559
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32209
32560
|
autoSaveTimers.current.clear();
|
|
32210
32561
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
32211
32562
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32212
32563
|
};
|
|
32213
32564
|
}, [isEditMode, refreshStateRules]);
|
|
32214
|
-
(0,
|
|
32565
|
+
(0, import_react24.useEffect)(() => {
|
|
32215
32566
|
if (!isEditMode) return;
|
|
32216
32567
|
const THRESHOLD = 10;
|
|
32217
32568
|
const resolveWasSelected = (el) => {
|
|
@@ -32367,7 +32718,7 @@ function OhhwellsBridge() {
|
|
|
32367
32718
|
unlockFooterDragInteraction();
|
|
32368
32719
|
};
|
|
32369
32720
|
}, [isEditMode]);
|
|
32370
|
-
(0,
|
|
32721
|
+
(0, import_react24.useEffect)(() => {
|
|
32371
32722
|
if (!isEditMode) return;
|
|
32372
32723
|
const THRESHOLD = 10;
|
|
32373
32724
|
const onPointerDown = (e) => {
|
|
@@ -32458,7 +32809,7 @@ function OhhwellsBridge() {
|
|
|
32458
32809
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32459
32810
|
};
|
|
32460
32811
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32461
|
-
(0,
|
|
32812
|
+
(0, import_react24.useEffect)(() => {
|
|
32462
32813
|
const handler = (e) => {
|
|
32463
32814
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32464
32815
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32474,7 +32825,7 @@ function OhhwellsBridge() {
|
|
|
32474
32825
|
window.addEventListener("message", handler);
|
|
32475
32826
|
return () => window.removeEventListener("message", handler);
|
|
32476
32827
|
}, [processConfigRequest]);
|
|
32477
|
-
(0,
|
|
32828
|
+
(0, import_react24.useEffect)(() => {
|
|
32478
32829
|
if (!isEditMode) return;
|
|
32479
32830
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32480
32831
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32498,7 +32849,7 @@ function OhhwellsBridge() {
|
|
|
32498
32849
|
postToParent2({
|
|
32499
32850
|
type: "ow:ready",
|
|
32500
32851
|
version: "1",
|
|
32501
|
-
bridgeVersion: "0.1.
|
|
32852
|
+
bridgeVersion: "0.1.163-next.434",
|
|
32502
32853
|
path: pathname,
|
|
32503
32854
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32504
32855
|
sections
|
|
@@ -32510,13 +32861,13 @@ function OhhwellsBridge() {
|
|
|
32510
32861
|
clearTimeout(timer);
|
|
32511
32862
|
};
|
|
32512
32863
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32513
|
-
(0,
|
|
32864
|
+
(0, import_react24.useEffect)(() => {
|
|
32514
32865
|
scrollToHashSectionWhenReady();
|
|
32515
32866
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32516
32867
|
window.addEventListener("hashchange", onHashChange);
|
|
32517
32868
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
32518
32869
|
}, [pathname]);
|
|
32519
|
-
const handleCommand = (0,
|
|
32870
|
+
const handleCommand = (0, import_react24.useCallback)((cmd) => {
|
|
32520
32871
|
const el = activeElRef.current;
|
|
32521
32872
|
const selBefore = window.getSelection();
|
|
32522
32873
|
let savedOffsets = null;
|
|
@@ -32552,7 +32903,7 @@ function OhhwellsBridge() {
|
|
|
32552
32903
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32553
32904
|
refreshActiveCommandsRef.current();
|
|
32554
32905
|
}, []);
|
|
32555
|
-
(0,
|
|
32906
|
+
(0, import_react24.useEffect)(() => {
|
|
32556
32907
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32557
32908
|
if (!session || !logoSizeDraft) return;
|
|
32558
32909
|
const onPanelAction = (e) => {
|
|
@@ -32590,7 +32941,7 @@ function OhhwellsBridge() {
|
|
|
32590
32941
|
window.addEventListener("message", onPanelAction);
|
|
32591
32942
|
return () => window.removeEventListener("message", onPanelAction);
|
|
32592
32943
|
}, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
|
|
32593
|
-
const handleStateChange = (0,
|
|
32944
|
+
const handleStateChange = (0, import_react24.useCallback)((state) => {
|
|
32594
32945
|
if (!activeStateElRef.current) return;
|
|
32595
32946
|
const el = activeStateElRef.current;
|
|
32596
32947
|
if (state === "Default") {
|
|
@@ -32603,7 +32954,7 @@ function OhhwellsBridge() {
|
|
|
32603
32954
|
}
|
|
32604
32955
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
32605
32956
|
}, [deactivate]);
|
|
32606
|
-
const reselectAfterLinkPopover = (0,
|
|
32957
|
+
const reselectAfterLinkPopover = (0, import_react24.useCallback)(
|
|
32607
32958
|
(hrefKey) => {
|
|
32608
32959
|
requestAnimationFrame(() => {
|
|
32609
32960
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -32612,7 +32963,7 @@ function OhhwellsBridge() {
|
|
|
32612
32963
|
},
|
|
32613
32964
|
[resolveHrefKeyElement]
|
|
32614
32965
|
);
|
|
32615
|
-
const closeLinkPopover = (0,
|
|
32966
|
+
const closeLinkPopover = (0, import_react24.useCallback)(() => {
|
|
32616
32967
|
const session = linkPopoverSessionRef.current;
|
|
32617
32968
|
addNavAfterAnchorRef.current = null;
|
|
32618
32969
|
setLinkPopover(null);
|
|
@@ -32620,9 +32971,9 @@ function OhhwellsBridge() {
|
|
|
32620
32971
|
reselectAfterLinkPopover(session.key);
|
|
32621
32972
|
}
|
|
32622
32973
|
}, [reselectAfterLinkPopover]);
|
|
32623
|
-
const closeLinkPopoverRef = (0,
|
|
32974
|
+
const closeLinkPopoverRef = (0, import_react24.useRef)(closeLinkPopover);
|
|
32624
32975
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
32625
|
-
const openLinkPopoverForActive = (0,
|
|
32976
|
+
const openLinkPopoverForActive = (0, import_react24.useCallback)(() => {
|
|
32626
32977
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
32627
32978
|
if (!hrefCtx) return;
|
|
32628
32979
|
bumpLinkPopoverGrace();
|
|
@@ -32633,7 +32984,7 @@ function OhhwellsBridge() {
|
|
|
32633
32984
|
});
|
|
32634
32985
|
deactivate();
|
|
32635
32986
|
}, [deactivate]);
|
|
32636
|
-
const openLinkPopoverForSelected = (0,
|
|
32987
|
+
const openLinkPopoverForSelected = (0, import_react24.useCallback)(() => {
|
|
32637
32988
|
const anchor = selectedElRef.current;
|
|
32638
32989
|
if (!anchor) return;
|
|
32639
32990
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -32650,7 +33001,7 @@ function OhhwellsBridge() {
|
|
|
32650
33001
|
});
|
|
32651
33002
|
deselect();
|
|
32652
33003
|
}, [deselect]);
|
|
32653
|
-
const handleSelectParent = (0,
|
|
33004
|
+
const handleSelectParent = (0, import_react24.useCallback)(() => {
|
|
32654
33005
|
const selected = selectedElRef.current;
|
|
32655
33006
|
if (!selected) return;
|
|
32656
33007
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -32677,7 +33028,7 @@ function OhhwellsBridge() {
|
|
|
32677
33028
|
}
|
|
32678
33029
|
deselectRef.current();
|
|
32679
33030
|
}, []);
|
|
32680
|
-
const handleDuplicateSelected = (0,
|
|
33031
|
+
const handleDuplicateSelected = (0, import_react24.useCallback)(() => {
|
|
32681
33032
|
const selected = selectedElRef.current;
|
|
32682
33033
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
32683
33034
|
if (isCtaButton(selected)) {
|
|
@@ -32846,7 +33197,7 @@ function OhhwellsBridge() {
|
|
|
32846
33197
|
});
|
|
32847
33198
|
}
|
|
32848
33199
|
}, [postToParent2, tokensForButton]);
|
|
32849
|
-
const runPendingDeleteUndo = (0,
|
|
33200
|
+
const runPendingDeleteUndo = (0, import_react24.useCallback)(() => {
|
|
32850
33201
|
const pending = pendingDeleteUndoRef.current;
|
|
32851
33202
|
if (!pending) return false;
|
|
32852
33203
|
pendingDeleteUndoRef.current = null;
|
|
@@ -32854,7 +33205,7 @@ function OhhwellsBridge() {
|
|
|
32854
33205
|
enforceLinkHrefs();
|
|
32855
33206
|
return true;
|
|
32856
33207
|
}, []);
|
|
32857
|
-
const handleDeleteSelected = (0,
|
|
33208
|
+
const handleDeleteSelected = (0, import_react24.useCallback)(() => {
|
|
32858
33209
|
const selected = selectedElRef.current;
|
|
32859
33210
|
if (!selected) return false;
|
|
32860
33211
|
if (isCtaButton(selected)) {
|
|
@@ -32916,7 +33267,7 @@ function OhhwellsBridge() {
|
|
|
32916
33267
|
}, [postToParent2]);
|
|
32917
33268
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
32918
33269
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
32919
|
-
const handleLinkPopoverSubmit = (0,
|
|
33270
|
+
const handleLinkPopoverSubmit = (0, import_react24.useCallback)(
|
|
32920
33271
|
(target) => {
|
|
32921
33272
|
const session = linkPopoverSessionRef.current;
|
|
32922
33273
|
if (!session) return;
|
|
@@ -32982,14 +33333,14 @@ function OhhwellsBridge() {
|
|
|
32982
33333
|
const showEditLink = toolbarShowEditLink;
|
|
32983
33334
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
32984
33335
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
32985
|
-
const handleMediaSelect = (0,
|
|
33336
|
+
const handleMediaSelect = (0, import_react24.useCallback)((key) => {
|
|
32986
33337
|
const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
|
|
32987
33338
|
(m) => (m.dataset.ohwKey ?? "") === key
|
|
32988
33339
|
) ?? null;
|
|
32989
33340
|
if (!el) return;
|
|
32990
33341
|
selectMediaElementRef.current(el);
|
|
32991
33342
|
}, []);
|
|
32992
|
-
const handleMediaReplace = (0,
|
|
33343
|
+
const handleMediaReplace = (0, import_react24.useCallback)(
|
|
32993
33344
|
(key) => {
|
|
32994
33345
|
postToParent2({
|
|
32995
33346
|
type: "ow:image-pick",
|
|
@@ -32999,13 +33350,13 @@ function OhhwellsBridge() {
|
|
|
32999
33350
|
},
|
|
33000
33351
|
[postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
|
|
33001
33352
|
);
|
|
33002
|
-
const handleEditCarousel = (0,
|
|
33353
|
+
const handleEditCarousel = (0, import_react24.useCallback)(
|
|
33003
33354
|
(key) => {
|
|
33004
33355
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
33005
33356
|
},
|
|
33006
33357
|
[postToParent2]
|
|
33007
33358
|
);
|
|
33008
|
-
const handleMediaFadeOutComplete = (0,
|
|
33359
|
+
const handleMediaFadeOutComplete = (0, import_react24.useCallback)((key) => {
|
|
33009
33360
|
setUploadingRects((prev) => {
|
|
33010
33361
|
if (!(key in prev)) return prev;
|
|
33011
33362
|
const next = { ...prev };
|
|
@@ -33013,7 +33364,7 @@ function OhhwellsBridge() {
|
|
|
33013
33364
|
return next;
|
|
33014
33365
|
});
|
|
33015
33366
|
}, []);
|
|
33016
|
-
const handleVideoSettingsChange = (0,
|
|
33367
|
+
const handleVideoSettingsChange = (0, import_react24.useCallback)(
|
|
33017
33368
|
(key, settings) => {
|
|
33018
33369
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
33019
33370
|
const video = getVideoEl2(el);
|
|
@@ -33727,6 +34078,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33727
34078
|
hasMountedContentNodes,
|
|
33728
34079
|
indexCollectionItems,
|
|
33729
34080
|
insertFooterHours,
|
|
34081
|
+
isDeadPageHref,
|
|
33730
34082
|
isEditSessionActive,
|
|
33731
34083
|
isPlainLeftClick,
|
|
33732
34084
|
isRenderableFooterTree,
|
|
@@ -33738,6 +34090,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33738
34090
|
parseAiFooterState,
|
|
33739
34091
|
parseAiSectionsState,
|
|
33740
34092
|
parseTarget,
|
|
34093
|
+
planBuildPageSync,
|
|
33741
34094
|
recordOverriddenPaths,
|
|
33742
34095
|
releaseTemplateLogoIfReplaced,
|
|
33743
34096
|
removeFooterBlock,
|