@ohhwells/bridge 0.1.163 → 0.1.164-next.439
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1439 -1035
- 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 +1244 -826
- 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) {
|
|
@@ -2638,6 +2644,14 @@ function socialHrefKey(item) {
|
|
|
2638
2644
|
function socialIconKey(item) {
|
|
2639
2645
|
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
2640
2646
|
}
|
|
2647
|
+
function pendingIconKey(item) {
|
|
2648
|
+
const existing = socialIconKey(item);
|
|
2649
|
+
if (existing) return existing;
|
|
2650
|
+
const base = socialHrefKey(item)?.replace(/-href$/, "");
|
|
2651
|
+
if (!base) return null;
|
|
2652
|
+
const taken = item.ownerDocument.querySelector(`[data-ohw-key="${base}"]`);
|
|
2653
|
+
return taken && taken !== item ? `${base}-icon` : base;
|
|
2654
|
+
}
|
|
2641
2655
|
var SOCIAL_PLATFORM_LABELS = {
|
|
2642
2656
|
instagram: "Instagram",
|
|
2643
2657
|
facebook: "Facebook",
|
|
@@ -2835,9 +2849,9 @@ function reconcileSocialsFromContent(content, root = document) {
|
|
|
2835
2849
|
listSocialsRows(root).forEach((row) => {
|
|
2836
2850
|
const rowDisplay = socialsDisplayFor(row, content);
|
|
2837
2851
|
listSocialItems(row).forEach((item) => {
|
|
2838
|
-
const key =
|
|
2852
|
+
const key = pendingIconKey(item);
|
|
2839
2853
|
const stored2 = key ? content[key] : void 0;
|
|
2840
|
-
if (!stored2?.trim()) return;
|
|
2854
|
+
if (!stored2?.trim().startsWith("<")) return;
|
|
2841
2855
|
const existing = item.querySelector(ICON_SELECTOR);
|
|
2842
2856
|
if (existing && existing.innerHTML.trim() && !existing.hasAttribute(SOCIALS_ICON_PLACEHOLDER_ATTR)) return;
|
|
2843
2857
|
ensureIconSlot(item);
|
|
@@ -3097,8 +3111,7 @@ function ensureIconSlot(item) {
|
|
|
3097
3111
|
const adopted = adoptAsIconSlot(drawn, base);
|
|
3098
3112
|
if (adopted) return adopted;
|
|
3099
3113
|
}
|
|
3100
|
-
const
|
|
3101
|
-
const iconKey = taken && taken !== item ? `${base}-icon` : base;
|
|
3114
|
+
const iconKey = pendingIconKey(item) ?? base;
|
|
3102
3115
|
const slot = document.createElement("span");
|
|
3103
3116
|
slot.setAttribute("data-ohw-key", iconKey);
|
|
3104
3117
|
slot.setAttribute("data-ohw-editable", "icon");
|
|
@@ -3610,11 +3623,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
|
|
|
3610
3623
|
container.appendChild(column);
|
|
3611
3624
|
return { column, firstLink };
|
|
3612
3625
|
}
|
|
3613
|
-
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL,
|
|
3626
|
+
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
|
|
3614
3627
|
if (!canAddFooterColumn()) {
|
|
3615
3628
|
throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
|
|
3616
3629
|
}
|
|
3617
|
-
const resolvedHref =
|
|
3630
|
+
const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
|
|
3618
3631
|
const colIndex = getNextFooterColumnIndex();
|
|
3619
3632
|
const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
|
|
3620
3633
|
if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
|
|
@@ -3993,8 +4006,8 @@ function duplicateFooterItem(sourceAnchor) {
|
|
|
3993
4006
|
const column = findFooterColumnForLink(sourceAnchor);
|
|
3994
4007
|
if (!column) return null;
|
|
3995
4008
|
const href = getLinkHref(sourceAnchor);
|
|
3996
|
-
const
|
|
3997
|
-
const label = (
|
|
4009
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
4010
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
3998
4011
|
return insertFooterItem(column, href || "/", label, sourceAnchor);
|
|
3999
4012
|
}
|
|
4000
4013
|
function footerLabelKeyFromHrefKey(hrefKey) {
|
|
@@ -4004,8 +4017,8 @@ function deleteFooterItem(sourceAnchor) {
|
|
|
4004
4017
|
if (!isFooterLinkAnchor(sourceAnchor)) return null;
|
|
4005
4018
|
const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
4006
4019
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
|
|
4007
|
-
const
|
|
4008
|
-
const label = (
|
|
4020
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
4021
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
4009
4022
|
const labelKey = footerLabelKeyFromHrefKey(hrefKey);
|
|
4010
4023
|
const previousOrder = getFooterOrderFromDom();
|
|
4011
4024
|
const previousOrderJson = JSON.stringify(previousOrder);
|
|
@@ -4973,8 +4986,8 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4973
4986
|
const mapped = keyMap.get(oldHrefKey);
|
|
4974
4987
|
if (!mapped) return;
|
|
4975
4988
|
el.setAttribute("data-ohw-href-key", mapped.hrefKey);
|
|
4976
|
-
const
|
|
4977
|
-
if (
|
|
4989
|
+
const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
|
|
4990
|
+
if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
|
|
4978
4991
|
};
|
|
4979
4992
|
if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
|
|
4980
4993
|
root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
|
|
@@ -4982,10 +4995,10 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4982
4995
|
function readNavLinkSnapshot(hrefKey) {
|
|
4983
4996
|
const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
4984
4997
|
if (!el) return { href: "/", label: "Untitled" };
|
|
4985
|
-
const
|
|
4998
|
+
const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
|
|
4986
4999
|
return {
|
|
4987
5000
|
href: getLinkHref2(el),
|
|
4988
|
-
label: (
|
|
5001
|
+
label: (labelEl2?.textContent ?? "").trim() || "Untitled"
|
|
4989
5002
|
};
|
|
4990
5003
|
}
|
|
4991
5004
|
function findClonedNavAnchor(unit, hrefKey) {
|
|
@@ -5159,8 +5172,8 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5159
5172
|
if (!isNavbarLinkItem(sourceAnchor)) return null;
|
|
5160
5173
|
const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
5161
5174
|
if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
|
|
5162
|
-
const
|
|
5163
|
-
const label = (
|
|
5175
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
5176
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
5164
5177
|
const previousForest = getNavForestFromDom();
|
|
5165
5178
|
const previousOrderJson = serializeNavOrder(previousForest);
|
|
5166
5179
|
const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
|
|
@@ -6535,6 +6548,24 @@ function deleteSectionFromState(state, sectionId) {
|
|
|
6535
6548
|
if (removed.includes(sectionId)) return state;
|
|
6536
6549
|
return { ...state, v: 1, sections: state.sections, removed: [...removed, sectionId] };
|
|
6537
6550
|
}
|
|
6551
|
+
function moveSectionInState(state, sectionId, targetPath) {
|
|
6552
|
+
const entry = state.sections.find((section) => section.id === sectionId);
|
|
6553
|
+
if (!entry) return null;
|
|
6554
|
+
const moved = {
|
|
6555
|
+
id: entry.id,
|
|
6556
|
+
label: entry.label,
|
|
6557
|
+
path: targetPath,
|
|
6558
|
+
afterSection: null,
|
|
6559
|
+
tree: entry.tree,
|
|
6560
|
+
media: entry.media,
|
|
6561
|
+
...entry.brand ? { brand: entry.brand } : {}
|
|
6562
|
+
};
|
|
6563
|
+
return {
|
|
6564
|
+
...state,
|
|
6565
|
+
v: 1,
|
|
6566
|
+
sections: state.sections.map((section) => section.id === sectionId ? moved : section)
|
|
6567
|
+
};
|
|
6568
|
+
}
|
|
6538
6569
|
function reapRemovedAiSections(state, store, removedIds, excludeIds = /* @__PURE__ */ new Set()) {
|
|
6539
6570
|
const generated = new Set(state.sections.map((entry) => entry.id));
|
|
6540
6571
|
const reapedIds = [...new Set(removedIds)].filter((id) => generated.has(id) && !excludeIds.has(id));
|
|
@@ -6763,6 +6794,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6763
6794
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6764
6795
|
return target ? pricingFeatureList(target).length : 0;
|
|
6765
6796
|
}
|
|
6797
|
+
function prevailingFeatureIcon(features) {
|
|
6798
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6799
|
+
for (const row of features) {
|
|
6800
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6801
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6802
|
+
entry.count += 1;
|
|
6803
|
+
counts.set(key, entry);
|
|
6804
|
+
}
|
|
6805
|
+
let best = null;
|
|
6806
|
+
for (const entry of counts.values()) {
|
|
6807
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6808
|
+
}
|
|
6809
|
+
if (!best) return {};
|
|
6810
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6811
|
+
}
|
|
6766
6812
|
function addPricingCardFeature(tree, index, text) {
|
|
6767
6813
|
return withPricingCollection(tree, (collection) => {
|
|
6768
6814
|
const children = collection.children;
|
|
@@ -6771,7 +6817,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6771
6817
|
const features = pricingFeatureList(target);
|
|
6772
6818
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6773
6819
|
target.slots = target.slots ?? {};
|
|
6774
|
-
target.slots.features = [...features, { text }];
|
|
6820
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6775
6821
|
return true;
|
|
6776
6822
|
});
|
|
6777
6823
|
}
|
|
@@ -7415,6 +7461,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7415
7461
|
);
|
|
7416
7462
|
}
|
|
7417
7463
|
|
|
7464
|
+
// src/lib/youtube.ts
|
|
7465
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7466
|
+
function extractYouTubeId(input) {
|
|
7467
|
+
const trimmed = input.trim();
|
|
7468
|
+
if (!trimmed) return null;
|
|
7469
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7470
|
+
let url;
|
|
7471
|
+
try {
|
|
7472
|
+
url = new URL(trimmed);
|
|
7473
|
+
} catch {
|
|
7474
|
+
return null;
|
|
7475
|
+
}
|
|
7476
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7477
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7478
|
+
return null;
|
|
7479
|
+
}
|
|
7480
|
+
let candidate = null;
|
|
7481
|
+
if (host === "youtu.be") {
|
|
7482
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7483
|
+
} else if (url.pathname === "/watch") {
|
|
7484
|
+
candidate = url.searchParams.get("v");
|
|
7485
|
+
} else {
|
|
7486
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7487
|
+
candidate = match ? match[1] : null;
|
|
7488
|
+
}
|
|
7489
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7490
|
+
}
|
|
7491
|
+
|
|
7492
|
+
// src/lib/section-embed.ts
|
|
7493
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7494
|
+
function readStoredEmbed(value) {
|
|
7495
|
+
if (value.startsWith("start\n")) {
|
|
7496
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7497
|
+
}
|
|
7498
|
+
return { raw: value, at: "end" };
|
|
7499
|
+
}
|
|
7500
|
+
function embedFrameSrc(value) {
|
|
7501
|
+
const videoId = extractYouTubeId(value);
|
|
7502
|
+
if (videoId) {
|
|
7503
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7504
|
+
}
|
|
7505
|
+
let url;
|
|
7506
|
+
try {
|
|
7507
|
+
url = new URL(value);
|
|
7508
|
+
} catch {
|
|
7509
|
+
return null;
|
|
7510
|
+
}
|
|
7511
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7512
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7513
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7514
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7515
|
+
return { src, title: "Map" };
|
|
7516
|
+
}
|
|
7517
|
+
if (host === "maps.app.goo.gl") {
|
|
7518
|
+
return { src: value, title: "Map" };
|
|
7519
|
+
}
|
|
7520
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7521
|
+
return { src: value, title: "Calendar" };
|
|
7522
|
+
}
|
|
7523
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7524
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7525
|
+
}
|
|
7526
|
+
if (host === "forms.gle") {
|
|
7527
|
+
return { src: value, title: "Form" };
|
|
7528
|
+
}
|
|
7529
|
+
return null;
|
|
7530
|
+
}
|
|
7531
|
+
function place(section, box, at) {
|
|
7532
|
+
if (at === "start") {
|
|
7533
|
+
section.insertBefore(box, section.firstChild);
|
|
7534
|
+
return;
|
|
7535
|
+
}
|
|
7536
|
+
section.appendChild(box);
|
|
7537
|
+
}
|
|
7538
|
+
function paint(section, key, src, title, at) {
|
|
7539
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7540
|
+
const frame = existing?.querySelector("iframe");
|
|
7541
|
+
if (existing && frame) {
|
|
7542
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7543
|
+
frame.title = title;
|
|
7544
|
+
place(section, existing, at);
|
|
7545
|
+
return;
|
|
7546
|
+
}
|
|
7547
|
+
existing?.remove();
|
|
7548
|
+
const box = document.createElement("div");
|
|
7549
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7550
|
+
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;";
|
|
7551
|
+
const frameWrap = document.createElement("div");
|
|
7552
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7553
|
+
const iframe = document.createElement("iframe");
|
|
7554
|
+
iframe.src = src;
|
|
7555
|
+
iframe.title = title;
|
|
7556
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7557
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7558
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7559
|
+
frameWrap.appendChild(iframe);
|
|
7560
|
+
box.appendChild(frameWrap);
|
|
7561
|
+
place(section, box, at);
|
|
7562
|
+
}
|
|
7563
|
+
function applySectionEmbeds(content) {
|
|
7564
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7565
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7566
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7567
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7568
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7569
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7570
|
+
if (!section || !stored || !frame) {
|
|
7571
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7572
|
+
continue;
|
|
7573
|
+
}
|
|
7574
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7575
|
+
}
|
|
7576
|
+
}
|
|
7577
|
+
|
|
7418
7578
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7419
7579
|
var import_react_dom = require("react-dom");
|
|
7420
7580
|
var import_client = require("react-dom/client");
|
|
@@ -7988,7 +8148,7 @@ var AI_MOBILE_CSS = [
|
|
|
7988
8148
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7989
8149
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7990
8150
|
// 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-
|
|
8151
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7992
8152
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7993
8153
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7994
8154
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8004,8 +8164,10 @@ var AI_MOBILE_CSS = [
|
|
|
8004
8164
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8005
8165
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8006
8166
|
// 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
|
-
|
|
8167
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8168
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8169
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8170
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
8009
8171
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8010
8172
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8011
8173
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8210,6 +8372,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8210
8372
|
function textAttrs(ctx, path) {
|
|
8211
8373
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8212
8374
|
}
|
|
8375
|
+
var AI_RESPONSIVE_CSS = [
|
|
8376
|
+
"@media (max-width: 960px) {",
|
|
8377
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8378
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8379
|
+
"}",
|
|
8380
|
+
"@media (max-width: 640px) {",
|
|
8381
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8382
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8383
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8384
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8385
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8386
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8387
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8388
|
+
// layered text used to be.
|
|
8389
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8390
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8391
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8392
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8393
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8394
|
+
// other rule had already been taught to stand down.
|
|
8395
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8396
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8397
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8398
|
+
"}"
|
|
8399
|
+
].join("\n");
|
|
8213
8400
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8214
8401
|
function MediaBox({
|
|
8215
8402
|
refValue,
|
|
@@ -8264,7 +8451,7 @@ function MediaBox({
|
|
|
8264
8451
|
position: fill ? "absolute" : void 0,
|
|
8265
8452
|
inset: fill ? 0 : void 0,
|
|
8266
8453
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8267
|
-
height: fill ? "100%" : void 0,
|
|
8454
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8268
8455
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8269
8456
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8270
8457
|
borderRadius: radius,
|
|
@@ -9760,7 +9947,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9760
9947
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9761
9948
|
"div",
|
|
9762
9949
|
{
|
|
9763
|
-
"data-ai-grid":
|
|
9950
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9764
9951
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9765
9952
|
style: {
|
|
9766
9953
|
display: "grid",
|
|
@@ -10062,7 +10249,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10062
10249
|
},
|
|
10063
10250
|
children: [
|
|
10064
10251
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10065
|
-
// The section's `data-ai-
|
|
10252
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
10066
10253
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10067
10254
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10068
10255
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10481,6 +10668,7 @@ function AiTreeRenderer({
|
|
|
10481
10668
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10482
10669
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10483
10670
|
...bgAttrs,
|
|
10671
|
+
"data-ai-responsive": "",
|
|
10484
10672
|
style: {
|
|
10485
10673
|
position: "relative",
|
|
10486
10674
|
padding: `${padCss} 0`,
|
|
@@ -10494,12 +10682,13 @@ function AiTreeRenderer({
|
|
|
10494
10682
|
...fillHeight ? { display: "grid" } : {}
|
|
10495
10683
|
},
|
|
10496
10684
|
children: [
|
|
10497
|
-
|
|
10685
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10498
10686
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10687
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10499
10688
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10500
10689
|
"div",
|
|
10501
10690
|
{
|
|
10502
|
-
"data-ai-
|
|
10691
|
+
"data-ai-section-inner": "",
|
|
10503
10692
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10504
10693
|
style: {
|
|
10505
10694
|
position: "relative",
|
|
@@ -10516,7 +10705,7 @@ function AiTreeRenderer({
|
|
|
10516
10705
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10517
10706
|
"div",
|
|
10518
10707
|
{
|
|
10519
|
-
"data-ai-
|
|
10708
|
+
"data-ai-columns": "",
|
|
10520
10709
|
style: {
|
|
10521
10710
|
display: "grid",
|
|
10522
10711
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11178,9 +11367,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11178
11367
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11179
11368
|
continue;
|
|
11180
11369
|
}
|
|
11181
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11182
11370
|
let container = existing?.container;
|
|
11371
|
+
let isNewMount = false;
|
|
11183
11372
|
if (!container || !container.isConnected) {
|
|
11373
|
+
isNewMount = true;
|
|
11184
11374
|
existing?.root.unmount();
|
|
11185
11375
|
container?.remove();
|
|
11186
11376
|
container = document.createElement("div");
|
|
@@ -11518,6 +11708,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11518
11708
|
return 3;
|
|
11519
11709
|
}
|
|
11520
11710
|
}
|
|
11711
|
+
function readLiveSocialItems() {
|
|
11712
|
+
const root = getFooterRoot();
|
|
11713
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11714
|
+
if (!row) return [];
|
|
11715
|
+
const items = [];
|
|
11716
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11717
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11718
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11719
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11720
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11721
|
+
items.push({ platform, href });
|
|
11722
|
+
}
|
|
11723
|
+
return items;
|
|
11724
|
+
}
|
|
11725
|
+
function syncSocialRowsFromDom(tree) {
|
|
11726
|
+
const root = getFooterRoot();
|
|
11727
|
+
if (!root) return;
|
|
11728
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11729
|
+
const live = readLiveSocialItems();
|
|
11730
|
+
if (row && live.length === 0) return;
|
|
11731
|
+
for (const col of tree.columns) {
|
|
11732
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11733
|
+
if (block.type !== "social-row") return [block];
|
|
11734
|
+
if (!row) return [];
|
|
11735
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11736
|
+
});
|
|
11737
|
+
}
|
|
11738
|
+
}
|
|
11521
11739
|
function collectBrandBlocks(tree) {
|
|
11522
11740
|
const brand = [];
|
|
11523
11741
|
for (const col of tree.columns) {
|
|
@@ -11763,12 +11981,13 @@ function textOf2(el) {
|
|
|
11763
11981
|
}
|
|
11764
11982
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11765
11983
|
const next = cloneTree(tree);
|
|
11984
|
+
syncSocialRowsFromDom(next);
|
|
11766
11985
|
const domCols = listFooterColumns().map((col) => {
|
|
11767
11986
|
const heading = getFooterColumnHeadingEl(col);
|
|
11768
11987
|
const title = heading ? textOf2(heading) : void 0;
|
|
11769
11988
|
const items = listFooterLinksInColumn(col).map((anchor) => {
|
|
11770
|
-
const
|
|
11771
|
-
const label = textOf2(
|
|
11989
|
+
const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11990
|
+
const label = textOf2(labelEl2) || textOf2(anchor);
|
|
11772
11991
|
const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
|
|
11773
11992
|
return label ? { label, href: href || "home" } : null;
|
|
11774
11993
|
}).filter((x) => Boolean(x));
|
|
@@ -17467,7 +17686,7 @@ function apiBase() {
|
|
|
17467
17686
|
function bridgeVersion() {
|
|
17468
17687
|
try {
|
|
17469
17688
|
if (true) {
|
|
17470
|
-
return "0.1.
|
|
17689
|
+
return "0.1.164-next.439";
|
|
17471
17690
|
}
|
|
17472
17691
|
} catch {
|
|
17473
17692
|
}
|
|
@@ -17481,7 +17700,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17481
17700
|
return;
|
|
17482
17701
|
}
|
|
17483
17702
|
try {
|
|
17484
|
-
const v = true ? "0.1.
|
|
17703
|
+
const v = true ? "0.1.164-next.439" : "";
|
|
17485
17704
|
if (v) {
|
|
17486
17705
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17487
17706
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18159,6 +18378,7 @@ function MediaOverlay({
|
|
|
18159
18378
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18160
18379
|
);
|
|
18161
18380
|
}, [isVideo]);
|
|
18381
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18162
18382
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18163
18383
|
const box = {
|
|
18164
18384
|
position: "fixed",
|
|
@@ -18257,11 +18477,10 @@ function MediaOverlay({
|
|
|
18257
18477
|
className: "flex items-center justify-center cursor-pointer",
|
|
18258
18478
|
style: {
|
|
18259
18479
|
...box,
|
|
18260
|
-
//
|
|
18261
|
-
//
|
|
18262
|
-
//
|
|
18263
|
-
|
|
18264
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18480
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18481
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18482
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18483
|
+
pointerEvents: "none",
|
|
18265
18484
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18266
18485
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18267
18486
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18288,17 +18507,17 @@ function MediaOverlay({
|
|
|
18288
18507
|
},
|
|
18289
18508
|
children: [
|
|
18290
18509
|
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
|
-
|
|
18510
|
+
replaceLabel
|
|
18292
18511
|
]
|
|
18293
18512
|
}
|
|
18294
18513
|
),
|
|
18295
|
-
replaceMode
|
|
18514
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18296
18515
|
Button,
|
|
18297
18516
|
{
|
|
18298
18517
|
"data-ohw-media-overlay": "",
|
|
18299
18518
|
variant: "outline",
|
|
18300
18519
|
size: "sm",
|
|
18301
|
-
"aria-label":
|
|
18520
|
+
"aria-label": replaceLabel,
|
|
18302
18521
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18303
18522
|
style: {
|
|
18304
18523
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18321,7 +18540,7 @@ function MediaOverlay({
|
|
|
18321
18540
|
},
|
|
18322
18541
|
children: [
|
|
18323
18542
|
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" ?
|
|
18543
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18325
18544
|
]
|
|
18326
18545
|
}
|
|
18327
18546
|
)
|
|
@@ -18915,7 +19134,7 @@ function AiSectionOverlay({
|
|
|
18915
19134
|
|
|
18916
19135
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18917
19136
|
var import_react12 = require("react");
|
|
18918
|
-
var
|
|
19137
|
+
var import_lucide_react9 = require("lucide-react");
|
|
18919
19138
|
|
|
18920
19139
|
// src/lib/ai-media-strip-tree.ts
|
|
18921
19140
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19029,14 +19248,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19029
19248
|
return true;
|
|
19030
19249
|
});
|
|
19031
19250
|
}
|
|
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
19251
|
function setMediaStripItemLink(tree, index, link) {
|
|
19041
19252
|
return withMediaStrip(tree, (block) => {
|
|
19042
19253
|
const items = block.items;
|
|
@@ -19054,11 +19265,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19054
19265
|
});
|
|
19055
19266
|
}
|
|
19056
19267
|
|
|
19057
|
-
// src/ui/
|
|
19268
|
+
// src/ui/dialog.tsx
|
|
19269
|
+
var React9 = __toESM(require("react"), 1);
|
|
19270
|
+
var import_radix_ui6 = require("radix-ui");
|
|
19271
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19058
19272
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19273
|
+
function Dialog2({
|
|
19274
|
+
...props
|
|
19275
|
+
}) {
|
|
19276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19277
|
+
}
|
|
19278
|
+
function DialogPortal({
|
|
19279
|
+
...props
|
|
19280
|
+
}) {
|
|
19281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19282
|
+
}
|
|
19283
|
+
function DialogOverlay({
|
|
19284
|
+
className,
|
|
19285
|
+
...props
|
|
19286
|
+
}) {
|
|
19287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19288
|
+
import_radix_ui6.Dialog.Overlay,
|
|
19289
|
+
{
|
|
19290
|
+
"data-slot": "dialog-overlay",
|
|
19291
|
+
"data-ohw-link-modal-root": "",
|
|
19292
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19293
|
+
...props
|
|
19294
|
+
}
|
|
19295
|
+
);
|
|
19296
|
+
}
|
|
19297
|
+
var DialogContent = React9.forwardRef(
|
|
19298
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19299
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19301
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19302
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19303
|
+
import_radix_ui6.Dialog.Content,
|
|
19304
|
+
{
|
|
19305
|
+
ref,
|
|
19306
|
+
"data-slot": "dialog-content",
|
|
19307
|
+
className: cn(
|
|
19308
|
+
positionMode,
|
|
19309
|
+
"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",
|
|
19310
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19311
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19312
|
+
className
|
|
19313
|
+
),
|
|
19314
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19315
|
+
...props,
|
|
19316
|
+
children: [
|
|
19317
|
+
children,
|
|
19318
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19319
|
+
import_radix_ui6.Dialog.Close,
|
|
19320
|
+
{
|
|
19321
|
+
type: "button",
|
|
19322
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19323
|
+
"aria-label": "Close",
|
|
19324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19325
|
+
}
|
|
19326
|
+
) : null
|
|
19327
|
+
]
|
|
19328
|
+
}
|
|
19329
|
+
)
|
|
19330
|
+
] });
|
|
19331
|
+
}
|
|
19332
|
+
);
|
|
19333
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19334
|
+
function DialogHeader({
|
|
19335
|
+
className,
|
|
19336
|
+
...props
|
|
19337
|
+
}) {
|
|
19338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19339
|
+
}
|
|
19340
|
+
function DialogFooter({
|
|
19341
|
+
className,
|
|
19342
|
+
...props
|
|
19343
|
+
}) {
|
|
19344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19345
|
+
"div",
|
|
19346
|
+
{
|
|
19347
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19348
|
+
...props
|
|
19349
|
+
}
|
|
19350
|
+
);
|
|
19351
|
+
}
|
|
19352
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19353
|
+
import_radix_ui6.Dialog.Title,
|
|
19354
|
+
{
|
|
19355
|
+
ref,
|
|
19356
|
+
className: cn(
|
|
19357
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19358
|
+
className
|
|
19359
|
+
),
|
|
19360
|
+
...props
|
|
19361
|
+
}
|
|
19362
|
+
));
|
|
19363
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19364
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19365
|
+
import_radix_ui6.Dialog.Description,
|
|
19366
|
+
{
|
|
19367
|
+
ref,
|
|
19368
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19369
|
+
...props
|
|
19370
|
+
}
|
|
19371
|
+
));
|
|
19372
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19373
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19374
|
+
|
|
19375
|
+
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19376
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
19377
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19378
|
+
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
19379
|
function findMediaStripItemElement(sectionId, index) {
|
|
19063
19380
|
const sectionEl = findByInstanceId(sectionId);
|
|
19064
19381
|
if (!sectionEl) return null;
|
|
@@ -19068,14 +19385,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19068
19385
|
}
|
|
19069
19386
|
return null;
|
|
19070
19387
|
}
|
|
19071
|
-
function
|
|
19072
|
-
|
|
19388
|
+
function itemRefFromTarget(target) {
|
|
19389
|
+
if (!(target instanceof Element)) return null;
|
|
19390
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19391
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19392
|
+
if (!itemEl) return null;
|
|
19393
|
+
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19394
|
+
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19395
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19396
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19397
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19398
|
+
return { sectionId, index };
|
|
19399
|
+
}
|
|
19400
|
+
function sameRef(a, b) {
|
|
19401
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19402
|
+
}
|
|
19403
|
+
function rectOf(el) {
|
|
19073
19404
|
if (!el) return null;
|
|
19074
19405
|
const r2 = el.getBoundingClientRect();
|
|
19075
19406
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19076
19407
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19077
19408
|
}
|
|
19078
|
-
function
|
|
19409
|
+
function readRect2(ref) {
|
|
19410
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19411
|
+
}
|
|
19412
|
+
function readStripRect(ref) {
|
|
19413
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19414
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19415
|
+
}
|
|
19416
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19079
19417
|
const [rect, setRect] = (0, import_react12.useState)(null);
|
|
19080
19418
|
(0, import_react12.useEffect)(() => {
|
|
19081
19419
|
if (!ref) {
|
|
@@ -19083,7 +19421,7 @@ function useLiveItemRect(ref) {
|
|
|
19083
19421
|
return;
|
|
19084
19422
|
}
|
|
19085
19423
|
const update = () => {
|
|
19086
|
-
const next = readRect2(ref);
|
|
19424
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19087
19425
|
setRect(
|
|
19088
19426
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19089
19427
|
);
|
|
@@ -19098,9 +19436,49 @@ function useLiveItemRect(ref) {
|
|
|
19098
19436
|
window.removeEventListener("resize", update);
|
|
19099
19437
|
clearInterval(interval);
|
|
19100
19438
|
};
|
|
19101
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19439
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19102
19440
|
return rect;
|
|
19103
19441
|
}
|
|
19442
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19443
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19444
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19445
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19446
|
+
const slotRef = (0, import_react12.useRef)(null);
|
|
19447
|
+
const [shift, setShift] = (0, import_react12.useState)(0);
|
|
19448
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19449
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
19450
|
+
const slot = slotRef.current;
|
|
19451
|
+
if (!slot) return;
|
|
19452
|
+
const clamp = () => {
|
|
19453
|
+
const w = slot.offsetWidth;
|
|
19454
|
+
if (w <= 0) return;
|
|
19455
|
+
const half = w / 2;
|
|
19456
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19457
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19458
|
+
};
|
|
19459
|
+
clamp();
|
|
19460
|
+
const ro = new ResizeObserver(clamp);
|
|
19461
|
+
ro.observe(slot);
|
|
19462
|
+
return () => ro.disconnect();
|
|
19463
|
+
}, [centerX, children]);
|
|
19464
|
+
const mobile = window.innerWidth <= 480;
|
|
19465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19466
|
+
"div",
|
|
19467
|
+
{
|
|
19468
|
+
ref: slotRef,
|
|
19469
|
+
"data-ohw-bridge": "",
|
|
19470
|
+
"data-ohw-item-interaction": "",
|
|
19471
|
+
className: "pointer-events-auto fixed",
|
|
19472
|
+
style: {
|
|
19473
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19474
|
+
left: centerX + shift,
|
|
19475
|
+
transform: "translate(-50%, -100%)",
|
|
19476
|
+
zIndex: 2147483645
|
|
19477
|
+
},
|
|
19478
|
+
children
|
|
19479
|
+
}
|
|
19480
|
+
);
|
|
19481
|
+
}
|
|
19104
19482
|
function requestValidateTree(postToParent2, tree) {
|
|
19105
19483
|
return new Promise((resolve) => {
|
|
19106
19484
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19137,116 +19515,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19137
19515
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19138
19516
|
});
|
|
19139
19517
|
}
|
|
19140
|
-
function
|
|
19518
|
+
function ToolbarAction({
|
|
19141
19519
|
label,
|
|
19142
19520
|
onClick,
|
|
19143
|
-
disabled,
|
|
19144
|
-
active
|
|
19521
|
+
disabled = false,
|
|
19522
|
+
active = false,
|
|
19523
|
+
children
|
|
19145
19524
|
}) {
|
|
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
|
-
);
|
|
19525
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19527
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
19528
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19529
|
+
] });
|
|
19173
19530
|
}
|
|
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",
|
|
19531
|
+
function ToolbarSeparator() {
|
|
19532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19533
|
+
}
|
|
19534
|
+
function OptionMenu({
|
|
19535
|
+
label,
|
|
19536
|
+
value,
|
|
19537
|
+
options,
|
|
19538
|
+
onChange
|
|
19539
|
+
}) {
|
|
19540
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19542
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19543
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
19544
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19545
|
+
"button",
|
|
19546
|
+
{
|
|
19547
|
+
type: "button",
|
|
19548
|
+
"aria-label": label,
|
|
19549
|
+
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",
|
|
19550
|
+
children: [
|
|
19551
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
19552
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
19553
|
+
]
|
|
19554
|
+
}
|
|
19555
|
+
) }),
|
|
19556
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19557
|
+
const selected = option.value === value;
|
|
19558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19559
|
+
DropdownMenuItem,
|
|
19209
19560
|
{
|
|
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
|
-
);
|
|
19561
|
+
role: "menuitemradio",
|
|
19562
|
+
"aria-checked": selected,
|
|
19563
|
+
onSelect: () => onChange(option.value),
|
|
19564
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19565
|
+
children: [
|
|
19566
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
|
|
19567
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
19568
|
+
]
|
|
19569
|
+
},
|
|
19570
|
+
option.value
|
|
19571
|
+
);
|
|
19572
|
+
}) })
|
|
19573
|
+
] })
|
|
19574
|
+
] });
|
|
19241
19575
|
}
|
|
19242
19576
|
var VARIANTS = [
|
|
19243
19577
|
{ value: "logos", label: "Logos" },
|
|
19244
19578
|
{ value: "reel", label: "Reel" }
|
|
19245
19579
|
];
|
|
19246
19580
|
var ALIGNS = [
|
|
19247
|
-
{ value: "left", label: "
|
|
19248
|
-
{ value: "center", label: "
|
|
19249
|
-
{ value: "right", label: "
|
|
19581
|
+
{ value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
|
|
19582
|
+
{ value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
|
|
19583
|
+
{ value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
|
|
19250
19584
|
];
|
|
19251
19585
|
var HOVERS = [
|
|
19252
19586
|
{ value: "none", label: "None" },
|
|
@@ -19254,104 +19588,104 @@ var HOVERS = [
|
|
|
19254
19588
|
{ value: "zoom", label: "Zoom" },
|
|
19255
19589
|
{ value: "fade", label: "Fade" }
|
|
19256
19590
|
];
|
|
19257
|
-
var TREATMENTS = [
|
|
19258
|
-
{ value: "color", label: "Color" },
|
|
19259
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19260
|
-
];
|
|
19261
19591
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19262
|
-
function
|
|
19263
|
-
|
|
19592
|
+
function LinkModal({
|
|
19593
|
+
href,
|
|
19594
|
+
linkTarget,
|
|
19595
|
+
onClose,
|
|
19596
|
+
onSave
|
|
19597
|
+
}) {
|
|
19598
|
+
const [draft, setDraft] = (0, import_react12.useState)(href);
|
|
19599
|
+
const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
|
|
19264
19600
|
const [invalid, setInvalid] = (0, import_react12.useState)(false);
|
|
19265
|
-
|
|
19266
|
-
setDraft(value);
|
|
19267
|
-
setInvalid(false);
|
|
19268
|
-
}, [value]);
|
|
19269
|
-
const commit2 = () => {
|
|
19601
|
+
const save = () => {
|
|
19270
19602
|
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
|
-
]
|
|
19603
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19604
|
+
setInvalid(true);
|
|
19605
|
+
return;
|
|
19340
19606
|
}
|
|
19341
|
-
|
|
19607
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19608
|
+
onClose();
|
|
19609
|
+
};
|
|
19610
|
+
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: [
|
|
19611
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19612
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
19613
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19614
|
+
"input",
|
|
19615
|
+
{
|
|
19616
|
+
autoFocus: true,
|
|
19617
|
+
type: "text",
|
|
19618
|
+
inputMode: "url",
|
|
19619
|
+
value: draft,
|
|
19620
|
+
onChange: (e) => {
|
|
19621
|
+
setDraft(e.target.value);
|
|
19622
|
+
setInvalid(false);
|
|
19623
|
+
},
|
|
19624
|
+
onKeyDown: (e) => {
|
|
19625
|
+
if (e.key === "Enter") save();
|
|
19626
|
+
},
|
|
19627
|
+
placeholder: "https://example.com",
|
|
19628
|
+
"aria-label": "Image link URL",
|
|
19629
|
+
"aria-invalid": invalid,
|
|
19630
|
+
className: cn(
|
|
19631
|
+
"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",
|
|
19632
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19633
|
+
)
|
|
19634
|
+
}
|
|
19635
|
+
),
|
|
19636
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19637
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19638
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19639
|
+
"Open in new tab"
|
|
19640
|
+
] })
|
|
19641
|
+
] }),
|
|
19642
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
|
|
19643
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19644
|
+
"button",
|
|
19645
|
+
{
|
|
19646
|
+
type: "button",
|
|
19647
|
+
onClick: () => {
|
|
19648
|
+
onSave("", "new-tab");
|
|
19649
|
+
onClose();
|
|
19650
|
+
},
|
|
19651
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19652
|
+
children: "Remove link"
|
|
19653
|
+
}
|
|
19654
|
+
),
|
|
19655
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19656
|
+
"button",
|
|
19657
|
+
{
|
|
19658
|
+
type: "button",
|
|
19659
|
+
onClick: onClose,
|
|
19660
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19661
|
+
children: "Cancel"
|
|
19662
|
+
}
|
|
19663
|
+
),
|
|
19664
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19665
|
+
"button",
|
|
19666
|
+
{
|
|
19667
|
+
type: "button",
|
|
19668
|
+
onClick: save,
|
|
19669
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19670
|
+
children: "Save"
|
|
19671
|
+
}
|
|
19672
|
+
)
|
|
19673
|
+
] })
|
|
19674
|
+
] }) });
|
|
19342
19675
|
}
|
|
19343
19676
|
function MediaStripToolbar({
|
|
19344
19677
|
entry,
|
|
19345
19678
|
index,
|
|
19346
19679
|
pending,
|
|
19347
19680
|
error,
|
|
19681
|
+
itemEditOn,
|
|
19682
|
+
onToggleItemEdit,
|
|
19348
19683
|
onSetVariant,
|
|
19349
19684
|
onSetAlign,
|
|
19350
19685
|
onSetHover,
|
|
19351
19686
|
onSetTreatment,
|
|
19352
19687
|
onResize,
|
|
19353
|
-
|
|
19354
|
-
onSetLink,
|
|
19688
|
+
onOpenLink,
|
|
19355
19689
|
onAddItem,
|
|
19356
19690
|
onRemoveItem,
|
|
19357
19691
|
onChangeImage,
|
|
@@ -19360,81 +19694,102 @@ function MediaStripToolbar({
|
|
|
19360
19694
|
}) {
|
|
19361
19695
|
const items = mediaStripItems(entry.tree);
|
|
19362
19696
|
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
19697
|
const slots = findMediaStripSlots(entry.tree);
|
|
19367
19698
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19368
19699
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19369
19700
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19370
19701
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19371
19702
|
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)(
|
|
19703
|
+
const mobile = window.innerWidth <= 480;
|
|
19704
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19384
19706
|
"div",
|
|
19385
19707
|
{
|
|
19386
19708
|
"data-ohw-bridge": "",
|
|
19387
19709
|
"data-ohw-toolbar": "",
|
|
19388
19710
|
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
|
-
},
|
|
19711
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19712
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19402
19713
|
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
|
-
|
|
19714
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19715
|
+
"div",
|
|
19716
|
+
{
|
|
19717
|
+
className: cn(
|
|
19718
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19719
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19720
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19721
|
+
),
|
|
19722
|
+
children: [
|
|
19723
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19724
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19725
|
+
CustomToolbarButton,
|
|
19726
|
+
{
|
|
19727
|
+
type: "button",
|
|
19728
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19729
|
+
"aria-pressed": itemEditOn,
|
|
19730
|
+
onClick: onToggleItemEdit,
|
|
19731
|
+
className: "group size-8",
|
|
19732
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19733
|
+
import_lucide_react9.Star,
|
|
19734
|
+
{
|
|
19735
|
+
size: 16,
|
|
19736
|
+
fill: "currentColor",
|
|
19737
|
+
strokeWidth: 0,
|
|
19738
|
+
className: cn(
|
|
19739
|
+
"transition-colors",
|
|
19740
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19741
|
+
),
|
|
19742
|
+
style: { pointerEvents: "none" }
|
|
19743
|
+
}
|
|
19744
|
+
)
|
|
19745
|
+
}
|
|
19746
|
+
) }),
|
|
19747
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19748
|
+
] }),
|
|
19749
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19750
|
+
/* @__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" } }) }),
|
|
19751
|
+
/* @__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" } }) }),
|
|
19752
|
+
/* @__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" } }) }),
|
|
19753
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19754
|
+
ToolbarAction,
|
|
19755
|
+
{
|
|
19756
|
+
label: gatedLabel("Move right"),
|
|
19757
|
+
onClick: onMoveRight,
|
|
19758
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
19760
|
+
}
|
|
19761
|
+
),
|
|
19762
|
+
/* @__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" } }) }),
|
|
19763
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19764
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19765
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19766
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19767
|
+
ToolbarAction,
|
|
19768
|
+
{
|
|
19769
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19770
|
+
active: treatment === "grayscale",
|
|
19771
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19773
|
+
}
|
|
19774
|
+
),
|
|
19775
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19776
|
+
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)),
|
|
19777
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19778
|
+
/* @__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" } }) }),
|
|
19779
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19780
|
+
sizeValue,
|
|
19781
|
+
"px"
|
|
19782
|
+
] }),
|
|
19783
|
+
/* @__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" } }) }),
|
|
19784
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19785
|
+
/* @__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" } }) })
|
|
19786
|
+
]
|
|
19787
|
+
}
|
|
19788
|
+
),
|
|
19789
|
+
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
19790
|
]
|
|
19436
19791
|
}
|
|
19437
|
-
);
|
|
19792
|
+
) });
|
|
19438
19793
|
}
|
|
19439
19794
|
function findMediaStripSlots(tree) {
|
|
19440
19795
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19453,31 +19808,23 @@ function AiMediaStripOverlay({
|
|
|
19453
19808
|
}) {
|
|
19454
19809
|
const [hover, setHover] = (0, import_react12.useState)(null);
|
|
19455
19810
|
const [active, setActive] = (0, import_react12.useState)(null);
|
|
19811
|
+
const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
|
|
19812
|
+
const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
|
|
19456
19813
|
const [pending, setPending] = (0, import_react12.useState)(false);
|
|
19457
19814
|
const [error, setError] = (0, import_react12.useState)(null);
|
|
19458
19815
|
const activeRef = (0, import_react12.useRef)(null);
|
|
19459
19816
|
activeRef.current = active;
|
|
19817
|
+
const linkOpenRef = (0, import_react12.useRef)(false);
|
|
19818
|
+
linkOpenRef.current = linkOpen;
|
|
19460
19819
|
(0, import_react12.useEffect)(() => {
|
|
19461
19820
|
const onMove = (e) => {
|
|
19821
|
+
const ref = itemRefFromTarget(e.target);
|
|
19462
19822
|
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 });
|
|
19823
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19824
|
+
setHover((prev) => {
|
|
19825
|
+
const next = ref && !overEditable ? ref : null;
|
|
19826
|
+
return sameRef(prev, next) ? prev : next;
|
|
19827
|
+
});
|
|
19481
19828
|
};
|
|
19482
19829
|
const onLeave = () => setHover(null);
|
|
19483
19830
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19489,23 +19836,25 @@ function AiMediaStripOverlay({
|
|
|
19489
19836
|
}, []);
|
|
19490
19837
|
(0, import_react12.useEffect)(() => {
|
|
19491
19838
|
const onClick = (e) => {
|
|
19492
|
-
const current = activeRef.current;
|
|
19493
|
-
if (!current) return;
|
|
19494
19839
|
const t = e.target;
|
|
19495
|
-
if (!(t instanceof
|
|
19496
|
-
if (t.closest(
|
|
19497
|
-
const
|
|
19498
|
-
if (
|
|
19499
|
-
|
|
19840
|
+
if (!(t instanceof Element)) return;
|
|
19841
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19842
|
+
const ref = itemRefFromTarget(t);
|
|
19843
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19844
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19845
|
+
setItemEditOn(false);
|
|
19500
19846
|
setError(null);
|
|
19847
|
+
setActive(ref);
|
|
19501
19848
|
};
|
|
19502
19849
|
document.addEventListener("click", onClick, true);
|
|
19503
19850
|
return () => document.removeEventListener("click", onClick, true);
|
|
19504
|
-
}, []);
|
|
19851
|
+
}, [clearInteractionChromeRef]);
|
|
19505
19852
|
(0, import_react12.useEffect)(() => {
|
|
19506
19853
|
const onBlur = () => {
|
|
19507
19854
|
if (!activeRef.current) return;
|
|
19508
19855
|
setActive(null);
|
|
19856
|
+
setItemEditOn(false);
|
|
19857
|
+
setLinkOpen(false);
|
|
19509
19858
|
setError(null);
|
|
19510
19859
|
};
|
|
19511
19860
|
window.addEventListener("blur", onBlur);
|
|
@@ -19515,7 +19864,10 @@ function AiMediaStripOverlay({
|
|
|
19515
19864
|
const onKeyDown = (e) => {
|
|
19516
19865
|
if (e.key !== "Escape") return;
|
|
19517
19866
|
if (!activeRef.current) return;
|
|
19867
|
+
if (linkOpenRef.current) return;
|
|
19868
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19518
19869
|
setActive(null);
|
|
19870
|
+
setItemEditOn(false);
|
|
19519
19871
|
setError(null);
|
|
19520
19872
|
};
|
|
19521
19873
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19549,137 +19901,133 @@ function AiMediaStripOverlay({
|
|
|
19549
19901
|
tree: nextTree,
|
|
19550
19902
|
label: entry.label,
|
|
19551
19903
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19552
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19904
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
19905
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19906
|
+
// on every edit reads as the section jumping around.
|
|
19907
|
+
skipScrollIntoView: true
|
|
19553
19908
|
});
|
|
19554
19909
|
return true;
|
|
19555
19910
|
},
|
|
19556
19911
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19557
19912
|
);
|
|
19558
19913
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19559
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19560
19914
|
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) => {
|
|
19915
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
19916
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
19917
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
19918
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
19919
|
+
const activeHref = activeItem?.href ?? "";
|
|
19920
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
19922
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
19923
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
19924
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
19925
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19926
|
+
MediaStripToolbar,
|
|
19927
|
+
{
|
|
19928
|
+
entry: activeEntry,
|
|
19929
|
+
index: active.index,
|
|
19930
|
+
pending,
|
|
19931
|
+
error,
|
|
19932
|
+
itemEditOn,
|
|
19933
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
19934
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19935
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19936
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19937
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19938
|
+
onResize: (delta) => {
|
|
19939
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19940
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19941
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19942
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19943
|
+
},
|
|
19944
|
+
onOpenLink: () => setLinkOpen(true),
|
|
19945
|
+
onAddItem: () => {
|
|
19946
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19947
|
+
if (!picked) return;
|
|
19948
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19621
19949
|
void runMutation(
|
|
19622
19950
|
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
|
-
});
|
|
19637
|
-
});
|
|
19638
|
-
},
|
|
19639
|
-
onChangeImage: () => {
|
|
19640
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19641
|
-
if (!picked) return;
|
|
19642
|
-
void runMutation(
|
|
19643
|
-
active.sectionId,
|
|
19644
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19645
|
-
{ [picked.assetId]: picked.url }
|
|
19646
|
-
);
|
|
19951
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19952
|
+
{ [picked.assetId]: picked.url }
|
|
19953
|
+
).then((applied) => {
|
|
19954
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19647
19955
|
});
|
|
19648
|
-
}
|
|
19649
|
-
|
|
19650
|
-
|
|
19651
|
-
|
|
19652
|
-
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
|
|
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
|
-
}
|
|
19956
|
+
});
|
|
19957
|
+
},
|
|
19958
|
+
onChangeImage: () => {
|
|
19959
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19960
|
+
if (!picked) return;
|
|
19961
|
+
void runMutation(
|
|
19962
|
+
active.sectionId,
|
|
19963
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19964
|
+
{ [picked.assetId]: picked.url }
|
|
19668
19965
|
);
|
|
19669
|
-
}
|
|
19966
|
+
});
|
|
19967
|
+
},
|
|
19968
|
+
onRemoveItem: () => {
|
|
19969
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19970
|
+
(applied) => {
|
|
19971
|
+
if (applied) setActive(null);
|
|
19972
|
+
}
|
|
19973
|
+
);
|
|
19974
|
+
},
|
|
19975
|
+
onMoveLeft: () => {
|
|
19976
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19977
|
+
(applied) => {
|
|
19978
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19979
|
+
}
|
|
19980
|
+
);
|
|
19981
|
+
},
|
|
19982
|
+
onMoveRight: () => {
|
|
19983
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19984
|
+
(applied) => {
|
|
19985
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19986
|
+
}
|
|
19987
|
+
);
|
|
19670
19988
|
}
|
|
19671
|
-
|
|
19672
|
-
}
|
|
19673
|
-
|
|
19989
|
+
}
|
|
19990
|
+
) }),
|
|
19991
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19992
|
+
"div",
|
|
19993
|
+
{
|
|
19994
|
+
"data-ohw-bridge": "",
|
|
19995
|
+
"data-ohw-item-interaction": "",
|
|
19996
|
+
"aria-hidden": true,
|
|
19997
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
19998
|
+
style: {
|
|
19999
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20000
|
+
left: activeItemRect.left - 5,
|
|
20001
|
+
background: PRIMARY3,
|
|
20002
|
+
zIndex: 2147483644
|
|
20003
|
+
},
|
|
20004
|
+
children: "Media item"
|
|
20005
|
+
}
|
|
20006
|
+
),
|
|
20007
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20008
|
+
LinkModal,
|
|
20009
|
+
{
|
|
20010
|
+
href: activeHref,
|
|
20011
|
+
linkTarget: activeTarget,
|
|
20012
|
+
onClose: () => setLinkOpen(false),
|
|
20013
|
+
onSave: (href, linkTarget) => {
|
|
20014
|
+
void runMutation(
|
|
20015
|
+
active.sectionId,
|
|
20016
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20017
|
+
);
|
|
20018
|
+
}
|
|
20019
|
+
}
|
|
20020
|
+
)
|
|
20021
|
+
] })
|
|
19674
20022
|
] });
|
|
19675
20023
|
}
|
|
19676
20024
|
|
|
19677
20025
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19678
20026
|
var import_react13 = require("react");
|
|
19679
|
-
var
|
|
19680
|
-
var
|
|
20027
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20028
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
19681
20029
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19682
|
-
var
|
|
20030
|
+
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
20031
|
function findPricingCardElement(sectionId, index) {
|
|
19684
20032
|
const sectionEl = findByInstanceId(sectionId);
|
|
19685
20033
|
if (!sectionEl) return null;
|
|
@@ -19691,7 +20039,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19691
20039
|
}
|
|
19692
20040
|
function cardRefFromTarget(target) {
|
|
19693
20041
|
if (!(target instanceof Element)) return null;
|
|
19694
|
-
if (target.closest(
|
|
20042
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19695
20043
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19696
20044
|
if (!cardEl) return null;
|
|
19697
20045
|
const sectionEl = cardEl.closest("[data-ohw-section]");
|
|
@@ -19701,21 +20049,21 @@ function cardRefFromTarget(target) {
|
|
|
19701
20049
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19702
20050
|
return { sectionId, index };
|
|
19703
20051
|
}
|
|
19704
|
-
function
|
|
20052
|
+
function sameRef2(a, b) {
|
|
19705
20053
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19706
20054
|
}
|
|
19707
|
-
function
|
|
20055
|
+
function rectOf2(el) {
|
|
19708
20056
|
if (!el) return null;
|
|
19709
20057
|
const r2 = el.getBoundingClientRect();
|
|
19710
20058
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19711
20059
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19712
20060
|
}
|
|
19713
20061
|
function readRect3(ref) {
|
|
19714
|
-
return
|
|
20062
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19715
20063
|
}
|
|
19716
20064
|
function readGridRect(ref) {
|
|
19717
20065
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19718
|
-
return
|
|
20066
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19719
20067
|
}
|
|
19720
20068
|
function useLiveCardRect(ref, grid = false) {
|
|
19721
20069
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
@@ -19745,7 +20093,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19745
20093
|
}
|
|
19746
20094
|
var TOOLBAR_GRID_GAP = 52;
|
|
19747
20095
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19748
|
-
var
|
|
20096
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19749
20097
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19750
20098
|
const slotRef = (0, import_react13.useRef)(null);
|
|
19751
20099
|
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
@@ -19757,7 +20105,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19757
20105
|
const w = slot.offsetWidth;
|
|
19758
20106
|
if (w <= 0) return;
|
|
19759
20107
|
const half = w / 2;
|
|
19760
|
-
const clamped = Math.max(
|
|
20108
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19761
20109
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19762
20110
|
};
|
|
19763
20111
|
clamp();
|
|
@@ -19766,7 +20114,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19766
20114
|
return () => ro.disconnect();
|
|
19767
20115
|
}, [centerX, children]);
|
|
19768
20116
|
const mobile = window.innerWidth <= 480;
|
|
19769
|
-
return /* @__PURE__ */ (0,
|
|
20117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19770
20118
|
"div",
|
|
19771
20119
|
{
|
|
19772
20120
|
ref: slotRef,
|
|
@@ -19801,7 +20149,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19801
20149
|
});
|
|
19802
20150
|
}
|
|
19803
20151
|
function StyleSwatch({ style }) {
|
|
19804
|
-
return /* @__PURE__ */ (0,
|
|
20152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19805
20153
|
"span",
|
|
19806
20154
|
{
|
|
19807
20155
|
"aria-hidden": true,
|
|
@@ -19815,35 +20163,35 @@ function StyleSwatch({ style }) {
|
|
|
19815
20163
|
);
|
|
19816
20164
|
}
|
|
19817
20165
|
function ButtonGlyph() {
|
|
19818
|
-
return /* @__PURE__ */ (0,
|
|
19819
|
-
/* @__PURE__ */ (0,
|
|
19820
|
-
/* @__PURE__ */ (0,
|
|
20166
|
+
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: [
|
|
20167
|
+
/* @__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" }),
|
|
20168
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19821
20169
|
] });
|
|
19822
20170
|
}
|
|
19823
20171
|
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,
|
|
20172
|
+
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: [
|
|
20173
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20174
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20175
|
+
/* @__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" }),
|
|
20176
|
+
/* @__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" }),
|
|
20177
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20178
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19831
20179
|
] });
|
|
19832
20180
|
}
|
|
19833
|
-
function
|
|
20181
|
+
function ToolbarAction2({
|
|
19834
20182
|
label,
|
|
19835
20183
|
onClick,
|
|
19836
20184
|
disabled = false,
|
|
19837
20185
|
children
|
|
19838
20186
|
}) {
|
|
19839
|
-
const button = /* @__PURE__ */ (0,
|
|
19840
|
-
return /* @__PURE__ */ (0,
|
|
19841
|
-
/* @__PURE__ */ (0,
|
|
19842
|
-
/* @__PURE__ */ (0,
|
|
20187
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20189
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20190
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19843
20191
|
] });
|
|
19844
20192
|
}
|
|
19845
|
-
function
|
|
19846
|
-
return /* @__PURE__ */ (0,
|
|
20193
|
+
function ToolbarSeparator2() {
|
|
20194
|
+
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
20195
|
}
|
|
19848
20196
|
function CardStyleMenu({
|
|
19849
20197
|
value,
|
|
@@ -19851,7 +20199,7 @@ function CardStyleMenu({
|
|
|
19851
20199
|
disabled = false
|
|
19852
20200
|
}) {
|
|
19853
20201
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19854
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20202
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19855
20203
|
"button",
|
|
19856
20204
|
{
|
|
19857
20205
|
type: "button",
|
|
@@ -19862,28 +20210,28 @@ function CardStyleMenu({
|
|
|
19862
20210
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19863
20211
|
),
|
|
19864
20212
|
children: [
|
|
19865
|
-
/* @__PURE__ */ (0,
|
|
19866
|
-
/* @__PURE__ */ (0,
|
|
19867
|
-
/* @__PURE__ */ (0,
|
|
20213
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
|
|
20214
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20215
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
19868
20216
|
]
|
|
19869
20217
|
}
|
|
19870
20218
|
);
|
|
19871
20219
|
if (disabled) {
|
|
19872
|
-
return /* @__PURE__ */ (0,
|
|
19873
|
-
/* @__PURE__ */ (0,
|
|
19874
|
-
/* @__PURE__ */ (0,
|
|
19875
|
-
/* @__PURE__ */ (0,
|
|
19876
|
-
/* @__PURE__ */ (0,
|
|
20220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20221
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20222
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20223
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20224
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19877
20225
|
] })
|
|
19878
20226
|
] });
|
|
19879
20227
|
}
|
|
19880
|
-
return /* @__PURE__ */ (0,
|
|
19881
|
-
/* @__PURE__ */ (0,
|
|
19882
|
-
/* @__PURE__ */ (0,
|
|
19883
|
-
/* @__PURE__ */ (0,
|
|
19884
|
-
/* @__PURE__ */ (0,
|
|
20228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20229
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20230
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20231
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20232
|
+
/* @__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
20233
|
const selected = style.value === value;
|
|
19886
|
-
return /* @__PURE__ */ (0,
|
|
20234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19887
20235
|
DropdownMenuItem,
|
|
19888
20236
|
{
|
|
19889
20237
|
role: "menuitemradio",
|
|
@@ -19891,9 +20239,9 @@ function CardStyleMenu({
|
|
|
19891
20239
|
onSelect: () => onChange(style.value),
|
|
19892
20240
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19893
20241
|
children: [
|
|
19894
|
-
/* @__PURE__ */ (0,
|
|
19895
|
-
/* @__PURE__ */ (0,
|
|
19896
|
-
selected && /* @__PURE__ */ (0,
|
|
20242
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
|
|
20243
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
|
|
20244
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
|
|
19897
20245
|
]
|
|
19898
20246
|
},
|
|
19899
20247
|
style.value
|
|
@@ -19923,7 +20271,7 @@ function PricingCardToolbar({
|
|
|
19923
20271
|
const style = pricingCardStyle(entry.tree, index);
|
|
19924
20272
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19925
20273
|
const mobile = window.innerWidth <= 480;
|
|
19926
|
-
return /* @__PURE__ */ (0,
|
|
20274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19927
20275
|
"div",
|
|
19928
20276
|
{
|
|
19929
20277
|
"data-ohw-bridge": "",
|
|
@@ -19935,7 +20283,7 @@ function PricingCardToolbar({
|
|
|
19935
20283
|
),
|
|
19936
20284
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19937
20285
|
children: [
|
|
19938
|
-
/* @__PURE__ */ (0,
|
|
20286
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19939
20287
|
"div",
|
|
19940
20288
|
{
|
|
19941
20289
|
className: cn(
|
|
@@ -19944,8 +20292,8 @@ function PricingCardToolbar({
|
|
|
19944
20292
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19945
20293
|
),
|
|
19946
20294
|
children: [
|
|
19947
|
-
/* @__PURE__ */ (0,
|
|
19948
|
-
/* @__PURE__ */ (0,
|
|
20295
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20296
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19949
20297
|
CustomToolbarButton,
|
|
19950
20298
|
{
|
|
19951
20299
|
type: "button",
|
|
@@ -19953,8 +20301,8 @@ function PricingCardToolbar({
|
|
|
19953
20301
|
"aria-pressed": featuredTag,
|
|
19954
20302
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19955
20303
|
className: "group size-8",
|
|
19956
|
-
children: /* @__PURE__ */ (0,
|
|
19957
|
-
|
|
20304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20305
|
+
import_lucide_react10.Star,
|
|
19958
20306
|
{
|
|
19959
20307
|
size: 16,
|
|
19960
20308
|
fill: "currentColor",
|
|
@@ -19968,25 +20316,25 @@ function PricingCardToolbar({
|
|
|
19968
20316
|
)
|
|
19969
20317
|
}
|
|
19970
20318
|
) }),
|
|
19971
|
-
/* @__PURE__ */ (0,
|
|
20319
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
19972
20320
|
] }),
|
|
19973
|
-
/* @__PURE__ */ (0,
|
|
19974
|
-
/* @__PURE__ */ (0,
|
|
19975
|
-
/* @__PURE__ */ (0,
|
|
19976
|
-
/* @__PURE__ */ (0,
|
|
19977
|
-
/* @__PURE__ */ (0,
|
|
19978
|
-
/* @__PURE__ */ (0,
|
|
19979
|
-
/* @__PURE__ */ (0,
|
|
20321
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20322
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20323
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20324
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
|
|
20325
|
+
/* @__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: [
|
|
20326
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
|
|
20327
|
+
/* @__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
20328
|
] }) }),
|
|
19981
|
-
/* @__PURE__ */ (0,
|
|
19982
|
-
/* @__PURE__ */ (0,
|
|
19983
|
-
/* @__PURE__ */ (0,
|
|
19984
|
-
/* @__PURE__ */ (0,
|
|
19985
|
-
/* @__PURE__ */ (0,
|
|
20329
|
+
/* @__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" }) }),
|
|
20330
|
+
/* @__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" }) }),
|
|
20331
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20332
|
+
/* @__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" } }) }),
|
|
20333
|
+
/* @__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
20334
|
]
|
|
19987
20335
|
}
|
|
19988
20336
|
),
|
|
19989
|
-
error && /* @__PURE__ */ (0,
|
|
20337
|
+
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
20338
|
]
|
|
19991
20339
|
}
|
|
19992
20340
|
) });
|
|
@@ -20020,7 +20368,7 @@ function AiPricingCardOverlay({
|
|
|
20020
20368
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20021
20369
|
setHover((prev) => {
|
|
20022
20370
|
const next = ref && !overEditable ? ref : null;
|
|
20023
|
-
return
|
|
20371
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20024
20372
|
});
|
|
20025
20373
|
};
|
|
20026
20374
|
const onLeave = () => setHover(null);
|
|
@@ -20035,10 +20383,10 @@ function AiPricingCardOverlay({
|
|
|
20035
20383
|
const onClick = (e) => {
|
|
20036
20384
|
const t = e.target;
|
|
20037
20385
|
if (!(t instanceof Element)) return;
|
|
20038
|
-
if (t.closest(
|
|
20386
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20039
20387
|
const ref = cardRefFromTarget(t);
|
|
20040
|
-
setActive((prev) =>
|
|
20041
|
-
if (!ref || !
|
|
20388
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20389
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20042
20390
|
};
|
|
20043
20391
|
document.addEventListener("click", onClick, true);
|
|
20044
20392
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20103,12 +20451,12 @@ function AiPricingCardOverlay({
|
|
|
20103
20451
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20104
20452
|
const activeCardRect = useLiveCardRect(active);
|
|
20105
20453
|
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,
|
|
20454
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20456
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20457
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20458
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20459
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20112
20460
|
PricingCardToolbar,
|
|
20113
20461
|
{
|
|
20114
20462
|
entry: activeEntry,
|
|
@@ -20136,7 +20484,7 @@ function AiPricingCardOverlay({
|
|
|
20136
20484
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20137
20485
|
}
|
|
20138
20486
|
) }),
|
|
20139
|
-
/* @__PURE__ */ (0,
|
|
20487
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20140
20488
|
"div",
|
|
20141
20489
|
{
|
|
20142
20490
|
"data-ohw-bridge": "",
|
|
@@ -20158,7 +20506,7 @@ function AiPricingCardOverlay({
|
|
|
20158
20506
|
|
|
20159
20507
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20160
20508
|
var import_react14 = require("react");
|
|
20161
|
-
var
|
|
20509
|
+
var import_lucide_react11 = require("lucide-react");
|
|
20162
20510
|
|
|
20163
20511
|
// src/lib/ai-video-tree.ts
|
|
20164
20512
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20200,39 +20548,11 @@ function clearVideo(tree, path) {
|
|
|
20200
20548
|
});
|
|
20201
20549
|
}
|
|
20202
20550
|
|
|
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
20551
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20232
|
-
var
|
|
20552
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
20233
20553
|
var PRIMARY5 = "#0885FE";
|
|
20234
|
-
var
|
|
20235
|
-
var
|
|
20554
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20555
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20236
20556
|
function findVideoBlockElement(sectionId, path) {
|
|
20237
20557
|
const sectionEl = findByInstanceId(sectionId);
|
|
20238
20558
|
if (!sectionEl) return null;
|
|
@@ -20292,12 +20612,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20292
20612
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20293
20613
|
});
|
|
20294
20614
|
}
|
|
20295
|
-
function
|
|
20615
|
+
function Pill({
|
|
20296
20616
|
label,
|
|
20297
20617
|
onClick,
|
|
20298
20618
|
disabled
|
|
20299
20619
|
}) {
|
|
20300
|
-
return /* @__PURE__ */ (0,
|
|
20620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20301
20621
|
"button",
|
|
20302
20622
|
{
|
|
20303
20623
|
type: "button",
|
|
@@ -20313,7 +20633,7 @@ function Pill2({
|
|
|
20313
20633
|
border: "none",
|
|
20314
20634
|
cursor: disabled ? "default" : "pointer",
|
|
20315
20635
|
background: "#ffffff",
|
|
20316
|
-
color:
|
|
20636
|
+
color: OHW_BLUE_DARK,
|
|
20317
20637
|
opacity: disabled ? 0.4 : 1,
|
|
20318
20638
|
fontSize: 12,
|
|
20319
20639
|
lineHeight: "16px",
|
|
@@ -20356,8 +20676,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20356
20676
|
onCommit(id);
|
|
20357
20677
|
}
|
|
20358
20678
|
};
|
|
20359
|
-
return /* @__PURE__ */ (0,
|
|
20360
|
-
/* @__PURE__ */ (0,
|
|
20679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20680
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20361
20681
|
"div",
|
|
20362
20682
|
{
|
|
20363
20683
|
style: {
|
|
@@ -20373,12 +20693,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20373
20693
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20374
20694
|
},
|
|
20375
20695
|
children: [
|
|
20376
|
-
/* @__PURE__ */ (0,
|
|
20696
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20377
20697
|
"span",
|
|
20378
20698
|
{
|
|
20379
20699
|
style: {
|
|
20380
20700
|
flex: "0 0 auto",
|
|
20381
|
-
color:
|
|
20701
|
+
color: OHW_BLUE_DARK,
|
|
20382
20702
|
fontSize: 10,
|
|
20383
20703
|
lineHeight: "16px",
|
|
20384
20704
|
fontWeight: 700,
|
|
@@ -20388,7 +20708,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20388
20708
|
children: "Video"
|
|
20389
20709
|
}
|
|
20390
20710
|
),
|
|
20391
|
-
/* @__PURE__ */ (0,
|
|
20711
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20392
20712
|
"input",
|
|
20393
20713
|
{
|
|
20394
20714
|
type: "text",
|
|
@@ -20425,7 +20745,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20425
20745
|
]
|
|
20426
20746
|
}
|
|
20427
20747
|
),
|
|
20428
|
-
invalid && /* @__PURE__ */ (0,
|
|
20748
|
+
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
20749
|
] });
|
|
20430
20750
|
}
|
|
20431
20751
|
function VideoToolbar({
|
|
@@ -20435,7 +20755,7 @@ function VideoToolbar({
|
|
|
20435
20755
|
onSetVideoId,
|
|
20436
20756
|
onRemove
|
|
20437
20757
|
}) {
|
|
20438
|
-
return /* @__PURE__ */ (0,
|
|
20758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20439
20759
|
"div",
|
|
20440
20760
|
{
|
|
20441
20761
|
"data-ohw-bridge": "",
|
|
@@ -20447,7 +20767,7 @@ function VideoToolbar({
|
|
|
20447
20767
|
gap: 6,
|
|
20448
20768
|
alignItems: "center",
|
|
20449
20769
|
width: 280,
|
|
20450
|
-
background:
|
|
20770
|
+
background: OHW_BLUE,
|
|
20451
20771
|
padding: 8,
|
|
20452
20772
|
borderRadius: 12,
|
|
20453
20773
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20455,9 +20775,9 @@ function VideoToolbar({
|
|
|
20455
20775
|
opacity: pending ? 0.6 : 1
|
|
20456
20776
|
},
|
|
20457
20777
|
children: [
|
|
20458
|
-
/* @__PURE__ */ (0,
|
|
20459
|
-
/* @__PURE__ */ (0,
|
|
20460
|
-
error && /* @__PURE__ */ (0,
|
|
20778
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20779
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20780
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20461
20781
|
]
|
|
20462
20782
|
}
|
|
20463
20783
|
);
|
|
@@ -20577,8 +20897,8 @@ function AiVideoOverlay({
|
|
|
20577
20897
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20578
20898
|
const TOOLBAR_APPROX_H = 90;
|
|
20579
20899
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20580
|
-
return /* @__PURE__ */ (0,
|
|
20581
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
20900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
20901
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20582
20902
|
"button",
|
|
20583
20903
|
{
|
|
20584
20904
|
type: "button",
|
|
@@ -20606,15 +20926,15 @@ function AiVideoOverlay({
|
|
|
20606
20926
|
fontSize: 14,
|
|
20607
20927
|
fontWeight: 700
|
|
20608
20928
|
},
|
|
20609
|
-
children: /* @__PURE__ */ (0,
|
|
20929
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
20610
20930
|
}
|
|
20611
20931
|
),
|
|
20612
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20932
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20613
20933
|
ItemInteractionLayer,
|
|
20614
20934
|
{
|
|
20615
20935
|
rect: activeBlockRect,
|
|
20616
20936
|
state: toolbarState,
|
|
20617
|
-
toolbar: /* @__PURE__ */ (0,
|
|
20937
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20618
20938
|
VideoToolbar,
|
|
20619
20939
|
{
|
|
20620
20940
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20638,7 +20958,7 @@ function AiVideoOverlay({
|
|
|
20638
20958
|
|
|
20639
20959
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20640
20960
|
var import_react15 = require("react");
|
|
20641
|
-
var
|
|
20961
|
+
var import_lucide_react12 = require("lucide-react");
|
|
20642
20962
|
|
|
20643
20963
|
// src/lib/ai-carousel-tree.ts
|
|
20644
20964
|
function isCarouselBlock(node) {
|
|
@@ -20689,10 +21009,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20689
21009
|
}
|
|
20690
21010
|
|
|
20691
21011
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20692
|
-
var
|
|
21012
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
20693
21013
|
var PRIMARY6 = "#0885FE";
|
|
20694
|
-
var
|
|
20695
|
-
var
|
|
21014
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21015
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20696
21016
|
function findCarouselItemElement(sectionId, index) {
|
|
20697
21017
|
const sectionEl = findByInstanceId(sectionId);
|
|
20698
21018
|
if (!sectionEl) return null;
|
|
@@ -20771,8 +21091,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20771
21091
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20772
21092
|
});
|
|
20773
21093
|
}
|
|
20774
|
-
function
|
|
20775
|
-
return /* @__PURE__ */ (0,
|
|
21094
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20776
21096
|
"button",
|
|
20777
21097
|
{
|
|
20778
21098
|
type: "button",
|
|
@@ -20788,7 +21108,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20788
21108
|
border: "none",
|
|
20789
21109
|
cursor: disabled ? "default" : "pointer",
|
|
20790
21110
|
background: "#ffffff",
|
|
20791
|
-
color:
|
|
21111
|
+
color: OHW_BLUE_DARK2,
|
|
20792
21112
|
opacity: disabled ? 0.4 : 1,
|
|
20793
21113
|
fontSize: 12,
|
|
20794
21114
|
lineHeight: "16px",
|
|
@@ -20806,7 +21126,7 @@ function TogglePill({
|
|
|
20806
21126
|
onToggle,
|
|
20807
21127
|
disabled
|
|
20808
21128
|
}) {
|
|
20809
|
-
return /* @__PURE__ */ (0,
|
|
21129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
20810
21130
|
"button",
|
|
20811
21131
|
{
|
|
20812
21132
|
type: "button",
|
|
@@ -20825,7 +21145,7 @@ function TogglePill({
|
|
|
20825
21145
|
border: "none",
|
|
20826
21146
|
cursor: disabled ? "default" : "pointer",
|
|
20827
21147
|
background: "#ffffff",
|
|
20828
|
-
color:
|
|
21148
|
+
color: OHW_BLUE_DARK2,
|
|
20829
21149
|
opacity: disabled ? 0.4 : 1,
|
|
20830
21150
|
fontSize: 12,
|
|
20831
21151
|
lineHeight: "16px",
|
|
@@ -20835,7 +21155,7 @@ function TogglePill({
|
|
|
20835
21155
|
},
|
|
20836
21156
|
children: [
|
|
20837
21157
|
label,
|
|
20838
|
-
/* @__PURE__ */ (0,
|
|
21158
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20839
21159
|
"span",
|
|
20840
21160
|
{
|
|
20841
21161
|
"aria-hidden": true,
|
|
@@ -20848,10 +21168,10 @@ function TogglePill({
|
|
|
20848
21168
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20849
21169
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20850
21170
|
// "disabled control" rather than "switch that is off".
|
|
20851
|
-
background: on ?
|
|
21171
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20852
21172
|
transition: "background 120ms ease"
|
|
20853
21173
|
},
|
|
20854
|
-
children: /* @__PURE__ */ (0,
|
|
21174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20855
21175
|
"span",
|
|
20856
21176
|
{
|
|
20857
21177
|
style: {
|
|
@@ -20880,7 +21200,7 @@ function CarouselSlideToolbar({
|
|
|
20880
21200
|
onChangeImage,
|
|
20881
21201
|
onToggleAutoplay
|
|
20882
21202
|
}) {
|
|
20883
|
-
return /* @__PURE__ */ (0,
|
|
21203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
20884
21204
|
"div",
|
|
20885
21205
|
{
|
|
20886
21206
|
"data-ohw-bridge": "",
|
|
@@ -20891,7 +21211,7 @@ function CarouselSlideToolbar({
|
|
|
20891
21211
|
flexDirection: "column",
|
|
20892
21212
|
gap: 6,
|
|
20893
21213
|
alignItems: "center",
|
|
20894
|
-
background:
|
|
21214
|
+
background: OHW_BLUE2,
|
|
20895
21215
|
padding: 8,
|
|
20896
21216
|
borderRadius: 12,
|
|
20897
21217
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20903,11 +21223,11 @@ function CarouselSlideToolbar({
|
|
|
20903
21223
|
pointerEvents: pending ? "none" : "auto"
|
|
20904
21224
|
},
|
|
20905
21225
|
children: [
|
|
20906
|
-
/* @__PURE__ */ (0,
|
|
20907
|
-
/* @__PURE__ */ (0,
|
|
20908
|
-
/* @__PURE__ */ (0,
|
|
21226
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21227
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21228
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20909
21229
|
] }),
|
|
20910
|
-
error && /* @__PURE__ */ (0,
|
|
21230
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20911
21231
|
]
|
|
20912
21232
|
}
|
|
20913
21233
|
);
|
|
@@ -21047,8 +21367,8 @@ function AiFadeCarouselOverlay({
|
|
|
21047
21367
|
const activeItemRect = useLiveItemRect2(active);
|
|
21048
21368
|
const TOOLBAR_APPROX_H = 90;
|
|
21049
21369
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21050
|
-
return /* @__PURE__ */ (0,
|
|
21051
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
21371
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21052
21372
|
"button",
|
|
21053
21373
|
{
|
|
21054
21374
|
type: "button",
|
|
@@ -21077,10 +21397,10 @@ function AiFadeCarouselOverlay({
|
|
|
21077
21397
|
fontSize: 14,
|
|
21078
21398
|
fontWeight: 700
|
|
21079
21399
|
},
|
|
21080
|
-
children: /* @__PURE__ */ (0,
|
|
21400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21081
21401
|
}
|
|
21082
21402
|
),
|
|
21083
|
-
swapping && /* @__PURE__ */ (0,
|
|
21403
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21084
21404
|
"div",
|
|
21085
21405
|
{
|
|
21086
21406
|
ref: skeletonRef,
|
|
@@ -21098,15 +21418,15 @@ function AiFadeCarouselOverlay({
|
|
|
21098
21418
|
zIndex: 2147483646,
|
|
21099
21419
|
pointerEvents: "none"
|
|
21100
21420
|
},
|
|
21101
|
-
children: /* @__PURE__ */ (0,
|
|
21421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21102
21422
|
}
|
|
21103
21423
|
),
|
|
21104
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21424
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21105
21425
|
ItemInteractionLayer,
|
|
21106
21426
|
{
|
|
21107
21427
|
rect: activeItemRect,
|
|
21108
21428
|
state: toolbarState,
|
|
21109
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21429
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21110
21430
|
CarouselSlideToolbar,
|
|
21111
21431
|
{
|
|
21112
21432
|
pending,
|
|
@@ -21297,113 +21617,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21297
21617
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21298
21618
|
var import_react19 = require("react");
|
|
21299
21619
|
|
|
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
21620
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21408
21621
|
var import_lucide_react16 = require("lucide-react");
|
|
21409
21622
|
|
|
@@ -22507,6 +22720,7 @@ function shouldUseDevFixtures() {
|
|
|
22507
22720
|
function getLogoElement(el) {
|
|
22508
22721
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22509
22722
|
if (marked) return marked;
|
|
22723
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22510
22724
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22511
22725
|
if (!root) return null;
|
|
22512
22726
|
const anchor = el.closest("a");
|
|
@@ -24201,6 +24415,138 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24201
24415
|
return false;
|
|
24202
24416
|
}
|
|
24203
24417
|
|
|
24418
|
+
// src/lib/build-page-sync.ts
|
|
24419
|
+
var import_react23 = require("react");
|
|
24420
|
+
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24421
|
+
function normalisePath(path) {
|
|
24422
|
+
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
24423
|
+
if (!trimmed || trimmed === "/") return "/";
|
|
24424
|
+
return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
|
|
24425
|
+
}
|
|
24426
|
+
function isDeadPageHref(href, livePaths) {
|
|
24427
|
+
const value = href.trim();
|
|
24428
|
+
if (!value.startsWith("/") || value.startsWith("//")) return false;
|
|
24429
|
+
const path = normalisePath(value);
|
|
24430
|
+
if (path === "/") return false;
|
|
24431
|
+
return !livePaths.some((live) => {
|
|
24432
|
+
const p = normalisePath(live);
|
|
24433
|
+
return p === path || p !== "/" && path.startsWith(`${p}/`);
|
|
24434
|
+
});
|
|
24435
|
+
}
|
|
24436
|
+
var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
24437
|
+
function planBuildPageSync(links, msg) {
|
|
24438
|
+
const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
|
|
24439
|
+
const removed = new Set((msg.removed ?? []).map(normalisePath));
|
|
24440
|
+
const remove = [];
|
|
24441
|
+
const relabel = [];
|
|
24442
|
+
const retarget = [];
|
|
24443
|
+
const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
|
|
24444
|
+
for (const link of links) {
|
|
24445
|
+
const href = link.href.trim();
|
|
24446
|
+
const isPage = href.startsWith("/") && !href.startsWith("//");
|
|
24447
|
+
if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
|
|
24448
|
+
if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
|
|
24449
|
+
else remove.push(link.hrefKey);
|
|
24450
|
+
continue;
|
|
24451
|
+
}
|
|
24452
|
+
if (isPage) {
|
|
24453
|
+
const path = normalisePath(href);
|
|
24454
|
+
const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
|
|
24455
|
+
if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
|
|
24456
|
+
relabel.push({ hrefKey: link.hrefKey, label: rename.label });
|
|
24457
|
+
}
|
|
24458
|
+
continue;
|
|
24459
|
+
}
|
|
24460
|
+
if (href.startsWith("#") || href.startsWith("/#")) {
|
|
24461
|
+
const anchor = href.replace(/^\/?#/u, "").toLowerCase();
|
|
24462
|
+
const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
|
|
24463
|
+
if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
|
|
24464
|
+
relabel.push({ hrefKey: link.hrefKey, label: target.label });
|
|
24465
|
+
}
|
|
24466
|
+
}
|
|
24467
|
+
}
|
|
24468
|
+
return { remove, relabel, retarget };
|
|
24469
|
+
}
|
|
24470
|
+
function linkHref(el) {
|
|
24471
|
+
const key = el.getAttribute("data-ohw-href-key");
|
|
24472
|
+
const stored = key ? getStoredLinkHref(key) : void 0;
|
|
24473
|
+
return stored ?? el.getAttribute("href") ?? "";
|
|
24474
|
+
}
|
|
24475
|
+
function labelEl(anchor) {
|
|
24476
|
+
return anchor.querySelector('[data-ohw-editable="text"]');
|
|
24477
|
+
}
|
|
24478
|
+
function collectLinks() {
|
|
24479
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24480
|
+
const links = [];
|
|
24481
|
+
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
24482
|
+
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
24483
|
+
if (seen.has(hrefKey)) return;
|
|
24484
|
+
const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
24485
|
+
if (!area) return;
|
|
24486
|
+
const label = labelEl(el);
|
|
24487
|
+
if (!label && area !== "chrome") return;
|
|
24488
|
+
seen.add(hrefKey);
|
|
24489
|
+
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
24490
|
+
});
|
|
24491
|
+
return links;
|
|
24492
|
+
}
|
|
24493
|
+
function applyBuildPageSync(msg, deps) {
|
|
24494
|
+
const plan = planBuildPageSync(collectLinks(), msg);
|
|
24495
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
24496
|
+
for (const hrefKey of plan.remove) {
|
|
24497
|
+
const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
24498
|
+
if (!anchor) continue;
|
|
24499
|
+
const nav = isNavbarHrefKey(hrefKey);
|
|
24500
|
+
const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
|
|
24501
|
+
if (!result) continue;
|
|
24502
|
+
for (const key of result.removedKeys) {
|
|
24503
|
+
nodes.set(key, "");
|
|
24504
|
+
clearStoredLinkHref(key);
|
|
24505
|
+
}
|
|
24506
|
+
nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
|
|
24507
|
+
}
|
|
24508
|
+
for (const { hrefKey, label } of plan.relabel) {
|
|
24509
|
+
const labelKey = hrefKey.replace(/-href$/u, "-label");
|
|
24510
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24511
|
+
const el = labelEl(anchor);
|
|
24512
|
+
if (el) el.textContent = label;
|
|
24513
|
+
});
|
|
24514
|
+
nodes.set(labelKey, label);
|
|
24515
|
+
}
|
|
24516
|
+
for (const { hrefKey, href } of plan.retarget) {
|
|
24517
|
+
setStoredLinkHref(hrefKey, href);
|
|
24518
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24519
|
+
if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
|
|
24520
|
+
});
|
|
24521
|
+
nodes.set(hrefKey, href);
|
|
24522
|
+
}
|
|
24523
|
+
if (nodes.size === 0) return 0;
|
|
24524
|
+
deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
|
|
24525
|
+
deps.postToParent({
|
|
24526
|
+
type: "ow:change",
|
|
24527
|
+
nodes: [...nodes].map(([key, text]) => ({ key, text }))
|
|
24528
|
+
});
|
|
24529
|
+
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24530
|
+
}
|
|
24531
|
+
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24532
|
+
(0, import_react23.useEffect)(() => {
|
|
24533
|
+
if (!isEditMode) return;
|
|
24534
|
+
const onMessage = (e) => {
|
|
24535
|
+
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
24536
|
+
const changed = applyBuildPageSync(e.data, {
|
|
24537
|
+
getEditContent: () => editContentRef.current,
|
|
24538
|
+
setEditContent: (next) => {
|
|
24539
|
+
editContentRef.current = next;
|
|
24540
|
+
},
|
|
24541
|
+
postToParent: postToParent2
|
|
24542
|
+
});
|
|
24543
|
+
postToParent2({ type: "ow:pages-synced", changed });
|
|
24544
|
+
};
|
|
24545
|
+
window.addEventListener("message", onMessage);
|
|
24546
|
+
return () => window.removeEventListener("message", onMessage);
|
|
24547
|
+
}, [isEditMode, editContentRef, postToParent2]);
|
|
24548
|
+
}
|
|
24549
|
+
|
|
24204
24550
|
// src/lib/nav-page-sync.ts
|
|
24205
24551
|
function labelKeyFor(hrefKey) {
|
|
24206
24552
|
return hrefKey.replace(/-href$/, "-label");
|
|
@@ -25184,7 +25530,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25184
25530
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25185
25531
|
return resolveFooterLinksContainerFrom(el);
|
|
25186
25532
|
}
|
|
25187
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25533
|
+
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
25534
|
return getNavigationRoot(el);
|
|
25189
25535
|
}
|
|
25190
25536
|
return null;
|
|
@@ -25406,7 +25752,6 @@ var ICONS = {
|
|
|
25406
25752
|
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
25753
|
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
25754
|
};
|
|
25409
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25410
25755
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25411
25756
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25412
25757
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25504,7 +25849,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25504
25849
|
el.style.top = `${top}px`;
|
|
25505
25850
|
el.style.height = `${height}px`;
|
|
25506
25851
|
}
|
|
25507
|
-
var
|
|
25852
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25508
25853
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25509
25854
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25510
25855
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25531,8 +25876,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25531
25876
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25532
25877
|
const half = toolbarWidth / 2;
|
|
25533
25878
|
return Math.max(
|
|
25534
|
-
|
|
25535
|
-
Math.min(centerX, window.innerWidth -
|
|
25879
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
25880
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25536
25881
|
);
|
|
25537
25882
|
}
|
|
25538
25883
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25656,9 +26001,9 @@ function FloatingToolbar({
|
|
|
25656
26001
|
showEditLink,
|
|
25657
26002
|
onEditLink
|
|
25658
26003
|
}) {
|
|
25659
|
-
const localRef =
|
|
25660
|
-
const [measuredW, setMeasuredW] =
|
|
25661
|
-
const setRefs =
|
|
26004
|
+
const localRef = import_react24.default.useRef(null);
|
|
26005
|
+
const [measuredW, setMeasuredW] = import_react24.default.useState(330);
|
|
26006
|
+
const setRefs = import_react24.default.useCallback(
|
|
25662
26007
|
(node) => {
|
|
25663
26008
|
localRef.current = node;
|
|
25664
26009
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -25670,7 +26015,7 @@ function FloatingToolbar({
|
|
|
25670
26015
|
},
|
|
25671
26016
|
[elRef]
|
|
25672
26017
|
);
|
|
25673
|
-
|
|
26018
|
+
import_react24.default.useLayoutEffect(() => {
|
|
25674
26019
|
const node = localRef.current;
|
|
25675
26020
|
if (!node) return;
|
|
25676
26021
|
const update = () => {
|
|
@@ -25696,7 +26041,7 @@ function FloatingToolbar({
|
|
|
25696
26041
|
pointerEvents: "auto"
|
|
25697
26042
|
},
|
|
25698
26043
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
|
|
25699
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
26044
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react24.default.Fragment, { children: [
|
|
25700
26045
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
25701
26046
|
btns.map((btn) => {
|
|
25702
26047
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -25905,8 +26250,8 @@ function OhhwellsBridge() {
|
|
|
25905
26250
|
const router = (0, import_navigation4.useRouter)();
|
|
25906
26251
|
const searchParams = (0, import_navigation4.useSearchParams)();
|
|
25907
26252
|
const isEditMode = isEditSessionActive();
|
|
25908
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
25909
|
-
(0,
|
|
26253
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react24.useState)(null);
|
|
26254
|
+
(0, import_react24.useEffect)(() => {
|
|
25910
26255
|
const figtreeFontId = "ohw-figtree-font";
|
|
25911
26256
|
if (!document.getElementById(figtreeFontId)) {
|
|
25912
26257
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25932,8 +26277,8 @@ function OhhwellsBridge() {
|
|
|
25932
26277
|
};
|
|
25933
26278
|
}, []);
|
|
25934
26279
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25935
|
-
const [subdomain, setSubdomain] = (0,
|
|
25936
|
-
(0,
|
|
26280
|
+
const [subdomain, setSubdomain] = (0, import_react24.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
26281
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
25937
26282
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25938
26283
|
if (next !== subdomain) setSubdomain(next);
|
|
25939
26284
|
if (next) return;
|
|
@@ -25945,7 +26290,7 @@ function OhhwellsBridge() {
|
|
|
25945
26290
|
}, 0);
|
|
25946
26291
|
return () => window.clearTimeout(t);
|
|
25947
26292
|
}, [subdomainFromQuery, subdomain]);
|
|
25948
|
-
(0,
|
|
26293
|
+
(0, import_react24.useEffect)(() => {
|
|
25949
26294
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
25950
26295
|
const url = new URL(window.location.href);
|
|
25951
26296
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -25957,22 +26302,22 @@ function OhhwellsBridge() {
|
|
|
25957
26302
|
useSavedLinkNavigation(isEditMode);
|
|
25958
26303
|
useNavDropdownToggle(isEditMode);
|
|
25959
26304
|
useHashLinkScroll(isEditMode);
|
|
25960
|
-
const postToParent2 = (0,
|
|
26305
|
+
const postToParent2 = (0, import_react24.useCallback)((data) => {
|
|
25961
26306
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
25962
26307
|
window.parent.postMessage(data, "*");
|
|
25963
26308
|
}
|
|
25964
26309
|
}, []);
|
|
25965
|
-
const [fetchState, setFetchState] = (0,
|
|
25966
|
-
const [showBranding, setShowBranding] = (0,
|
|
25967
|
-
const autoSaveTimers = (0,
|
|
25968
|
-
(0,
|
|
26310
|
+
const [fetchState, setFetchState] = (0, import_react24.useState)("idle");
|
|
26311
|
+
const [showBranding, setShowBranding] = (0, import_react24.useState)(false);
|
|
26312
|
+
const autoSaveTimers = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26313
|
+
(0, import_react24.useEffect)(() => {
|
|
25969
26314
|
stampBridgeVersionOnDocument();
|
|
25970
26315
|
}, []);
|
|
25971
|
-
(0,
|
|
26316
|
+
(0, import_react24.useEffect)(() => {
|
|
25972
26317
|
if (isEditMode) return;
|
|
25973
26318
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
25974
26319
|
}, [isEditMode, subdomain, fetchState]);
|
|
25975
|
-
(0,
|
|
26320
|
+
(0, import_react24.useEffect)(() => {
|
|
25976
26321
|
if (isEditMode || !subdomain) return;
|
|
25977
26322
|
const onError = (event) => {
|
|
25978
26323
|
reportOutageBeacon({
|
|
@@ -25993,40 +26338,40 @@ function OhhwellsBridge() {
|
|
|
25993
26338
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
25994
26339
|
};
|
|
25995
26340
|
}, [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,
|
|
26341
|
+
const activeElRef = (0, import_react24.useRef)(null);
|
|
26342
|
+
const pointerHeldRef = (0, import_react24.useRef)(false);
|
|
26343
|
+
const selectedElRef = (0, import_react24.useRef)(null);
|
|
26344
|
+
const selectedHrefKeyRef = (0, import_react24.useRef)(null);
|
|
26345
|
+
const selectedFooterColAttrRef = (0, import_react24.useRef)(null);
|
|
26346
|
+
const footerHeadingTitleCacheRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26347
|
+
const originalContentRef = (0, import_react24.useRef)(null);
|
|
26348
|
+
const activeStateElRef = (0, import_react24.useRef)(null);
|
|
26349
|
+
const parentScrollRef = (0, import_react24.useRef)(null);
|
|
26350
|
+
const visibleViewportRef = (0, import_react24.useRef)(null);
|
|
26351
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react24.useState)(null);
|
|
26352
|
+
const attachVisibleViewport = (0, import_react24.useCallback)((node) => {
|
|
26008
26353
|
visibleViewportRef.current = node;
|
|
26009
26354
|
setDialogPortalContainer(node);
|
|
26010
26355
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
26011
26356
|
}, []);
|
|
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,
|
|
26357
|
+
const toolbarElRef = (0, import_react24.useRef)(null);
|
|
26358
|
+
const glowElRef = (0, import_react24.useRef)(null);
|
|
26359
|
+
const hoveredImageRef = (0, import_react24.useRef)(null);
|
|
26360
|
+
const hoveredImageHasTextOverlapRef = (0, import_react24.useRef)(false);
|
|
26361
|
+
const dragOverElRef = (0, import_react24.useRef)(null);
|
|
26362
|
+
const [mediaHover, setMediaHover] = (0, import_react24.useState)(null);
|
|
26363
|
+
const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react24.useState)(null);
|
|
26364
|
+
const selectedAiSectionIdRef = (0, import_react24.useRef)(null);
|
|
26365
|
+
const handleAiSectionSelectionChange = (0, import_react24.useCallback)((id) => {
|
|
26021
26366
|
selectedAiSectionIdRef.current = id;
|
|
26022
26367
|
setSelectedAiSectionId(id);
|
|
26023
26368
|
}, []);
|
|
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,
|
|
26369
|
+
const [selectedMedia, setSelectedMedia] = (0, import_react24.useState)(null);
|
|
26370
|
+
const selectedMediaElRef = (0, import_react24.useRef)(null);
|
|
26371
|
+
const mediaKeyDropTokenRef = (0, import_react24.useRef)(0);
|
|
26372
|
+
const selectedIconElRef = (0, import_react24.useRef)(null);
|
|
26373
|
+
const selectedSocialElRef = (0, import_react24.useRef)(null);
|
|
26374
|
+
const queueSectionKeyDrop = (0, import_react24.useCallback)((prev) => {
|
|
26030
26375
|
const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
|
|
26031
26376
|
if (!sectionEl) return;
|
|
26032
26377
|
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
@@ -26047,31 +26392,31 @@ function OhhwellsBridge() {
|
|
|
26047
26392
|
window.addEventListener("message", onQueueDrained);
|
|
26048
26393
|
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
26049
26394
|
}, []);
|
|
26050
|
-
const clearMediaSelection = (0,
|
|
26395
|
+
const clearMediaSelection = (0, import_react24.useCallback)(() => {
|
|
26051
26396
|
const prev = selectedMediaElRef.current;
|
|
26052
26397
|
selectedMediaElRef.current = null;
|
|
26053
26398
|
setSelectedMedia(null);
|
|
26054
26399
|
queueSectionKeyDrop(prev);
|
|
26055
26400
|
}, [queueSectionKeyDrop]);
|
|
26056
|
-
const clearMediaSelectionRef = (0,
|
|
26401
|
+
const clearMediaSelectionRef = (0, import_react24.useRef)(clearMediaSelection);
|
|
26057
26402
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
26058
|
-
const clearIconSelection = (0,
|
|
26403
|
+
const clearIconSelection = (0, import_react24.useCallback)(() => {
|
|
26059
26404
|
const prev = selectedIconElRef.current;
|
|
26060
26405
|
if (!prev) return;
|
|
26061
26406
|
selectedIconElRef.current = null;
|
|
26062
26407
|
queueSectionKeyDrop(prev);
|
|
26063
26408
|
}, [queueSectionKeyDrop]);
|
|
26064
|
-
const clearIconSelectionRef = (0,
|
|
26409
|
+
const clearIconSelectionRef = (0, import_react24.useRef)(clearIconSelection);
|
|
26065
26410
|
clearIconSelectionRef.current = clearIconSelection;
|
|
26066
|
-
const clearSocialSelection = (0,
|
|
26411
|
+
const clearSocialSelection = (0, import_react24.useCallback)(() => {
|
|
26067
26412
|
const prev = selectedSocialElRef.current;
|
|
26068
26413
|
if (!prev) return;
|
|
26069
26414
|
selectedSocialElRef.current = null;
|
|
26070
26415
|
queueSectionKeyDrop(prev);
|
|
26071
26416
|
}, [queueSectionKeyDrop]);
|
|
26072
|
-
const clearSocialSelectionRef = (0,
|
|
26417
|
+
const clearSocialSelectionRef = (0, import_react24.useRef)(clearSocialSelection);
|
|
26073
26418
|
clearSocialSelectionRef.current = clearSocialSelection;
|
|
26074
|
-
const selectIconElement = (0,
|
|
26419
|
+
const selectIconElement = (0, import_react24.useCallback)((el) => {
|
|
26075
26420
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26076
26421
|
selectedIconElRef.current = el;
|
|
26077
26422
|
const sectionEl = el.closest("[data-ohw-section]");
|
|
@@ -26084,9 +26429,9 @@ function OhhwellsBridge() {
|
|
|
26084
26429
|
keyLabel: "Icon"
|
|
26085
26430
|
});
|
|
26086
26431
|
}, []);
|
|
26087
|
-
const selectIconElementRef = (0,
|
|
26432
|
+
const selectIconElementRef = (0, import_react24.useRef)(selectIconElement);
|
|
26088
26433
|
selectIconElementRef.current = selectIconElement;
|
|
26089
|
-
const selectMediaElement = (0,
|
|
26434
|
+
const selectMediaElement = (0, import_react24.useCallback)((el) => {
|
|
26090
26435
|
const r2 = el.getBoundingClientRect();
|
|
26091
26436
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
26092
26437
|
selectedIconElRef.current = null;
|
|
@@ -26111,9 +26456,9 @@ function OhhwellsBridge() {
|
|
|
26111
26456
|
keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
|
|
26112
26457
|
});
|
|
26113
26458
|
}, []);
|
|
26114
|
-
const selectMediaElementRef = (0,
|
|
26459
|
+
const selectMediaElementRef = (0, import_react24.useRef)(selectMediaElement);
|
|
26115
26460
|
selectMediaElementRef.current = selectMediaElement;
|
|
26116
|
-
(0,
|
|
26461
|
+
(0, import_react24.useEffect)(() => {
|
|
26117
26462
|
if (!selectedMedia) return;
|
|
26118
26463
|
const update = () => {
|
|
26119
26464
|
const el = selectedMediaElRef.current;
|
|
@@ -26133,54 +26478,54 @@ function OhhwellsBridge() {
|
|
|
26133
26478
|
window.removeEventListener("resize", update);
|
|
26134
26479
|
};
|
|
26135
26480
|
}, [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,
|
|
26481
|
+
const [carouselHover, setCarouselHover] = (0, import_react24.useState)(null);
|
|
26482
|
+
const [uploadingRects, setUploadingRects] = (0, import_react24.useState)({});
|
|
26483
|
+
const hoveredGapRef = (0, import_react24.useRef)(null);
|
|
26484
|
+
const imageUnhoverTimerRef = (0, import_react24.useRef)(null);
|
|
26485
|
+
const imageShowTimerRef = (0, import_react24.useRef)(null);
|
|
26486
|
+
const editStylesRef = (0, import_react24.useRef)(null);
|
|
26487
|
+
const activateRef = (0, import_react24.useRef)(() => {
|
|
26143
26488
|
});
|
|
26144
|
-
const deactivateRef = (0,
|
|
26489
|
+
const deactivateRef = (0, import_react24.useRef)(() => {
|
|
26145
26490
|
});
|
|
26146
|
-
const selectRef = (0,
|
|
26491
|
+
const selectRef = (0, import_react24.useRef)(() => {
|
|
26147
26492
|
});
|
|
26148
|
-
const selectFrameRef = (0,
|
|
26493
|
+
const selectFrameRef = (0, import_react24.useRef)(() => {
|
|
26149
26494
|
});
|
|
26150
|
-
const selectLogoRef = (0,
|
|
26495
|
+
const selectLogoRef = (0, import_react24.useRef)(() => {
|
|
26151
26496
|
});
|
|
26152
|
-
const openLogoSizePanelRef = (0,
|
|
26497
|
+
const openLogoSizePanelRef = (0, import_react24.useRef)(() => {
|
|
26153
26498
|
});
|
|
26154
|
-
const deselectRef = (0,
|
|
26499
|
+
const deselectRef = (0, import_react24.useRef)(() => {
|
|
26155
26500
|
});
|
|
26156
|
-
const closeFloatingPanelOnlyRef = (0,
|
|
26501
|
+
const closeFloatingPanelOnlyRef = (0, import_react24.useRef)(() => {
|
|
26157
26502
|
});
|
|
26158
|
-
const reselectNavigationItemRef = (0,
|
|
26503
|
+
const reselectNavigationItemRef = (0, import_react24.useRef)(() => {
|
|
26159
26504
|
});
|
|
26160
|
-
const commitNavigationTextEditRef = (0,
|
|
26505
|
+
const commitNavigationTextEditRef = (0, import_react24.useRef)(() => {
|
|
26161
26506
|
});
|
|
26162
|
-
const handleDeleteSelectedRef = (0,
|
|
26163
|
-
const runPendingDeleteUndoRef = (0,
|
|
26164
|
-
const isFooterFrameSelectionRef = (0,
|
|
26165
|
-
const refreshActiveCommandsRef = (0,
|
|
26507
|
+
const handleDeleteSelectedRef = (0, import_react24.useRef)(() => false);
|
|
26508
|
+
const runPendingDeleteUndoRef = (0, import_react24.useRef)(() => false);
|
|
26509
|
+
const isFooterFrameSelectionRef = (0, import_react24.useRef)(false);
|
|
26510
|
+
const refreshActiveCommandsRef = (0, import_react24.useRef)(() => {
|
|
26166
26511
|
});
|
|
26167
|
-
const postToParentRef = (0,
|
|
26512
|
+
const postToParentRef = (0, import_react24.useRef)(postToParent2);
|
|
26168
26513
|
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,
|
|
26514
|
+
const aiSectionApiRef = (0, import_react24.useRef)(null);
|
|
26515
|
+
const sectionsLoadedRef = (0, import_react24.useRef)(false);
|
|
26516
|
+
const pendingScheduleConfigRequests = (0, import_react24.useRef)([]);
|
|
26517
|
+
const [toolbarRect, setToolbarRect] = (0, import_react24.useState)(null);
|
|
26518
|
+
const [formPickRect, setFormPickRect] = (0, import_react24.useState)(null);
|
|
26519
|
+
const formPickElRef = (0, import_react24.useRef)(null);
|
|
26520
|
+
const [formViewState, setFormViewStateUi] = (0, import_react24.useState)("default");
|
|
26521
|
+
const [formPickCount, setFormPickCount] = (0, import_react24.useState)(null);
|
|
26522
|
+
const [formHoverRect, setFormHoverRect] = (0, import_react24.useState)(null);
|
|
26523
|
+
const formHoverElRef = (0, import_react24.useRef)(null);
|
|
26524
|
+
const [fieldPickRect, setFieldPickRect] = (0, import_react24.useState)(null);
|
|
26525
|
+
const fieldPickElRef = (0, import_react24.useRef)(null);
|
|
26526
|
+
const [fieldPickState, setFieldPickState] = (0, import_react24.useState)(null);
|
|
26527
|
+
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react24.useState)(false);
|
|
26528
|
+
const clearFormPick = (0, import_react24.useCallback)(() => {
|
|
26184
26529
|
const form = formPickElRef.current;
|
|
26185
26530
|
const editing = fieldPickElRef.current;
|
|
26186
26531
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
@@ -26200,7 +26545,7 @@ function OhhwellsBridge() {
|
|
|
26200
26545
|
formPickElRef.current = null;
|
|
26201
26546
|
setFormPickRect(null);
|
|
26202
26547
|
}, []);
|
|
26203
|
-
const clearFieldPick = (0,
|
|
26548
|
+
const clearFieldPick = (0, import_react24.useCallback)(() => {
|
|
26204
26549
|
const wrapper = fieldPickElRef.current;
|
|
26205
26550
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
26206
26551
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
@@ -26210,9 +26555,9 @@ function OhhwellsBridge() {
|
|
|
26210
26555
|
setFieldPickRect(null);
|
|
26211
26556
|
setFieldPickState(null);
|
|
26212
26557
|
}, []);
|
|
26213
|
-
const persistFieldsRef = (0,
|
|
26558
|
+
const persistFieldsRef = (0, import_react24.useRef)(() => {
|
|
26214
26559
|
});
|
|
26215
|
-
const persistFields = (0,
|
|
26560
|
+
const persistFields = (0, import_react24.useCallback)(
|
|
26216
26561
|
(form) => {
|
|
26217
26562
|
const key = formKeyOf(form);
|
|
26218
26563
|
if (!key) return;
|
|
@@ -26223,7 +26568,7 @@ function OhhwellsBridge() {
|
|
|
26223
26568
|
[]
|
|
26224
26569
|
);
|
|
26225
26570
|
persistFieldsRef.current = persistFields;
|
|
26226
|
-
const selectField = (0,
|
|
26571
|
+
const selectField = (0, import_react24.useCallback)((wrapper) => {
|
|
26227
26572
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
26228
26573
|
commitPlaceholderEdit(fieldPickElRef.current);
|
|
26229
26574
|
}
|
|
@@ -26236,7 +26581,7 @@ function OhhwellsBridge() {
|
|
|
26236
26581
|
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
26237
26582
|
setFieldTypePickerOpen(false);
|
|
26238
26583
|
}, []);
|
|
26239
|
-
const withSelectedField = (0,
|
|
26584
|
+
const withSelectedField = (0, import_react24.useCallback)(
|
|
26240
26585
|
(run) => {
|
|
26241
26586
|
const wrapper = fieldPickElRef.current;
|
|
26242
26587
|
const form = formPickElRef.current;
|
|
@@ -26249,28 +26594,28 @@ function OhhwellsBridge() {
|
|
|
26249
26594
|
},
|
|
26250
26595
|
[persistFields]
|
|
26251
26596
|
);
|
|
26252
|
-
const handleFieldTypeChange = (0,
|
|
26597
|
+
const handleFieldTypeChange = (0, import_react24.useCallback)(
|
|
26253
26598
|
(type) => withSelectedField((_form, wrapper) => {
|
|
26254
26599
|
applyFieldType(wrapper, type);
|
|
26255
26600
|
selectField(wrapper);
|
|
26256
26601
|
}),
|
|
26257
26602
|
[selectField, withSelectedField]
|
|
26258
26603
|
);
|
|
26259
|
-
const handleFieldRequiredToggle = (0,
|
|
26604
|
+
const handleFieldRequiredToggle = (0, import_react24.useCallback)(
|
|
26260
26605
|
() => withSelectedField((_form, wrapper) => {
|
|
26261
26606
|
setFieldRequired(wrapper, !isFieldRequired(wrapper));
|
|
26262
26607
|
selectField(wrapper);
|
|
26263
26608
|
}),
|
|
26264
26609
|
[selectField, withSelectedField]
|
|
26265
26610
|
);
|
|
26266
|
-
const handleFieldDuplicate = (0,
|
|
26611
|
+
const handleFieldDuplicate = (0, import_react24.useCallback)(
|
|
26267
26612
|
() => withSelectedField((form, wrapper) => {
|
|
26268
26613
|
const copy = duplicateField(form, wrapper);
|
|
26269
26614
|
selectField(copy);
|
|
26270
26615
|
}),
|
|
26271
26616
|
[selectField, withSelectedField]
|
|
26272
26617
|
);
|
|
26273
|
-
const handleFieldDelete = (0,
|
|
26618
|
+
const handleFieldDelete = (0, import_react24.useCallback)(
|
|
26274
26619
|
() => withSelectedField((_form, wrapper) => {
|
|
26275
26620
|
removeField(wrapper);
|
|
26276
26621
|
clearFieldPick();
|
|
@@ -26278,7 +26623,7 @@ function OhhwellsBridge() {
|
|
|
26278
26623
|
}),
|
|
26279
26624
|
[clearFieldPick, withSelectedField]
|
|
26280
26625
|
);
|
|
26281
|
-
const handleAddField = (0,
|
|
26626
|
+
const handleAddField = (0, import_react24.useCallback)(
|
|
26282
26627
|
(type) => {
|
|
26283
26628
|
const form = formPickElRef.current;
|
|
26284
26629
|
if (!form) return;
|
|
@@ -26294,8 +26639,8 @@ function OhhwellsBridge() {
|
|
|
26294
26639
|
},
|
|
26295
26640
|
[persistFields, selectField]
|
|
26296
26641
|
);
|
|
26297
|
-
const fieldDragRef = (0,
|
|
26298
|
-
const buildFieldDropSlots = (0,
|
|
26642
|
+
const fieldDragRef = (0, import_react24.useRef)(null);
|
|
26643
|
+
const buildFieldDropSlots = (0, import_react24.useCallback)((form, draggedKey) => {
|
|
26299
26644
|
const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
|
|
26300
26645
|
const slots = others.map((el) => {
|
|
26301
26646
|
const rect = el.getBoundingClientRect();
|
|
@@ -26308,7 +26653,7 @@ function OhhwellsBridge() {
|
|
|
26308
26653
|
}
|
|
26309
26654
|
return slots;
|
|
26310
26655
|
}, []);
|
|
26311
|
-
const handleFieldDragStart = (0,
|
|
26656
|
+
const handleFieldDragStart = (0, import_react24.useCallback)(() => {
|
|
26312
26657
|
const wrapper = fieldPickElRef.current;
|
|
26313
26658
|
const form = formPickElRef.current;
|
|
26314
26659
|
if (!wrapper || !form) return;
|
|
@@ -26317,18 +26662,18 @@ function OhhwellsBridge() {
|
|
|
26317
26662
|
setFieldDragging(true);
|
|
26318
26663
|
setFieldDropSlots(buildFieldDropSlots(form, key));
|
|
26319
26664
|
}, [buildFieldDropSlots]);
|
|
26320
|
-
const handleFieldDragEnd = (0,
|
|
26665
|
+
const handleFieldDragEnd = (0, import_react24.useCallback)(() => {
|
|
26321
26666
|
fieldDragRef.current = null;
|
|
26322
26667
|
setFieldDropIndex(null);
|
|
26323
26668
|
setFieldDropSlots([]);
|
|
26324
26669
|
setFieldDragging(false);
|
|
26325
26670
|
}, []);
|
|
26326
|
-
const [fieldDropIndex, setFieldDropIndex] = (0,
|
|
26327
|
-
const [fieldDropSlots, setFieldDropSlots] = (0,
|
|
26328
|
-
const [fieldDragging, setFieldDragging] = (0,
|
|
26329
|
-
const clearFormPickRef = (0,
|
|
26671
|
+
const [fieldDropIndex, setFieldDropIndex] = (0, import_react24.useState)(null);
|
|
26672
|
+
const [fieldDropSlots, setFieldDropSlots] = (0, import_react24.useState)([]);
|
|
26673
|
+
const [fieldDragging, setFieldDragging] = (0, import_react24.useState)(false);
|
|
26674
|
+
const clearFormPickRef = (0, import_react24.useRef)(clearFormPick);
|
|
26330
26675
|
clearFormPickRef.current = clearFormPick;
|
|
26331
|
-
(0,
|
|
26676
|
+
(0, import_react24.useEffect)(() => {
|
|
26332
26677
|
const el = fieldPickElRef.current;
|
|
26333
26678
|
if (!el || fieldPickRect === null) return;
|
|
26334
26679
|
const observer = new ResizeObserver(() => {
|
|
@@ -26337,7 +26682,7 @@ function OhhwellsBridge() {
|
|
|
26337
26682
|
observer.observe(el);
|
|
26338
26683
|
return () => observer.disconnect();
|
|
26339
26684
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26340
|
-
(0,
|
|
26685
|
+
(0, import_react24.useEffect)(() => {
|
|
26341
26686
|
const el = formPickElRef.current;
|
|
26342
26687
|
if (!el || formPickRect === null) return;
|
|
26343
26688
|
const observer = new ResizeObserver(() => {
|
|
@@ -26346,25 +26691,25 @@ function OhhwellsBridge() {
|
|
|
26346
26691
|
observer.observe(el);
|
|
26347
26692
|
return () => observer.disconnect();
|
|
26348
26693
|
}, [formPickRect !== null, formViewState]);
|
|
26349
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
26350
|
-
const toolbarVariantRef = (0,
|
|
26694
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react24.useState)("none");
|
|
26695
|
+
const toolbarVariantRef = (0, import_react24.useRef)("none");
|
|
26351
26696
|
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,
|
|
26697
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react24.useState)(false);
|
|
26698
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react24.useState)(false);
|
|
26699
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react24.useState)(false);
|
|
26700
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react24.useState)(null);
|
|
26701
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react24.useState)(false);
|
|
26702
|
+
const [toggleState, setToggleState] = (0, import_react24.useState)(null);
|
|
26703
|
+
const [maxBadge, setMaxBadge] = (0, import_react24.useState)(null);
|
|
26704
|
+
const [activeCommands, setActiveCommands] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
|
|
26705
|
+
const [sectionGap, setSectionGap] = (0, import_react24.useState)(null);
|
|
26706
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react24.useState)(false);
|
|
26707
|
+
const hoveredNavContainerRef = (0, import_react24.useRef)(null);
|
|
26708
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react24.useState)(null);
|
|
26709
|
+
const hoveredItemElRef = (0, import_react24.useRef)(null);
|
|
26710
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react24.useState)(null);
|
|
26711
|
+
const [hoveredTextRect, setHoveredTextRect] = (0, import_react24.useState)(null);
|
|
26712
|
+
(0, import_react24.useEffect)(() => {
|
|
26368
26713
|
const sync = () => {
|
|
26369
26714
|
const el = document.querySelector(
|
|
26370
26715
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26408,63 +26753,75 @@ function OhhwellsBridge() {
|
|
|
26408
26753
|
});
|
|
26409
26754
|
return () => observer.disconnect();
|
|
26410
26755
|
}, []);
|
|
26411
|
-
const siblingHintElRef = (0,
|
|
26412
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
26413
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
26414
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
26415
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
26756
|
+
const siblingHintElRef = (0, import_react24.useRef)(null);
|
|
26757
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react24.useState)(null);
|
|
26758
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react24.useState)([]);
|
|
26759
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react24.useState)(false);
|
|
26760
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react24.useState)(false);
|
|
26416
26761
|
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)(
|
|
26762
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react24.useState)(null);
|
|
26763
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react24.useState)(null);
|
|
26764
|
+
const footerDragRef = (0, import_react24.useRef)(null);
|
|
26765
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react24.useState)([]);
|
|
26766
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react24.useState)(null);
|
|
26767
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react24.useState)(null);
|
|
26768
|
+
const footerPointerDragRef = (0, import_react24.useRef)(null);
|
|
26769
|
+
const suppressNextClickRef = (0, import_react24.useRef)(false);
|
|
26770
|
+
const suppressClickUntilRef = (0, import_react24.useRef)(0);
|
|
26771
|
+
const [linkPopover, setLinkPopover] = (0, import_react24.useState)(null);
|
|
26772
|
+
const linkPopoverSessionRef = (0, import_react24.useRef)(null);
|
|
26773
|
+
const addNavAfterAnchorRef = (0, import_react24.useRef)(null);
|
|
26774
|
+
const editContentRef = (0, import_react24.useRef)({});
|
|
26775
|
+
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
26776
|
+
const aiSectionsRef = (0, import_react24.useRef)("");
|
|
26777
|
+
const aiFooterRef = (0, import_react24.useRef)("");
|
|
26778
|
+
const applyTreeLocalRef = (0, import_react24.useRef)(
|
|
26448
26779
|
null
|
|
26449
26780
|
);
|
|
26450
|
-
const applyFooterTreeLocalRef = (0,
|
|
26451
|
-
const clearInteractionChromeRef = (0,
|
|
26781
|
+
const applyFooterTreeLocalRef = (0, import_react24.useRef)(null);
|
|
26782
|
+
const clearInteractionChromeRef = (0, import_react24.useRef)(() => {
|
|
26452
26783
|
});
|
|
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
|
|
26784
|
+
const brandKitRef = (0, import_react24.useRef)("");
|
|
26785
|
+
const stylesRef = (0, import_react24.useRef)("");
|
|
26786
|
+
const appliedDrawerRef = (0, import_react24.useRef)(null);
|
|
26787
|
+
const pendingDeleteUndoRef = (0, import_react24.useRef)(null);
|
|
26788
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
|
|
26789
|
+
const floatingPanelOpenRef = (0, import_react24.useRef)(false);
|
|
26790
|
+
const floatingPanelRef = (0, import_react24.useRef)(null);
|
|
26791
|
+
floatingPanelRef.current = floatingPanel;
|
|
26792
|
+
const setFloatingPanelRef = (0, import_react24.useRef)(setFloatingPanel);
|
|
26793
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
|
|
26794
|
+
const buttonCollectionDragRef = (0, import_react24.useRef)(null);
|
|
26795
|
+
const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
|
|
26796
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
|
|
26797
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
|
|
26798
|
+
const buttonPointerDragRef = (0, import_react24.useRef)(null);
|
|
26799
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
|
|
26800
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
|
|
26801
|
+
const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
|
|
26802
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
|
|
26803
|
+
const [sitePages, setSitePages] = (0, import_react24.useState)([]);
|
|
26804
|
+
const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26805
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
|
|
26806
|
+
const sectionsPrefetchGenRef = (0, import_react24.useRef)(0);
|
|
26807
|
+
const setLinkPopoverRef = (0, import_react24.useRef)(setLinkPopover);
|
|
26808
|
+
const linkPopoverPanelRef = (0, import_react24.useRef)(null);
|
|
26809
|
+
const linkPopoverOpenRef = (0, import_react24.useRef)(false);
|
|
26810
|
+
const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
|
|
26465
26811
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26812
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26466
26813
|
linkPopoverSessionRef.current = linkPopover;
|
|
26467
|
-
|
|
26814
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26815
|
+
(0, import_react24.useEffect)(() => {
|
|
26816
|
+
const syncViewport = () => {
|
|
26817
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26818
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26819
|
+
};
|
|
26820
|
+
syncViewport();
|
|
26821
|
+
window.addEventListener("resize", syncViewport);
|
|
26822
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26823
|
+
}, []);
|
|
26824
|
+
(0, import_react24.useEffect)(() => {
|
|
26468
26825
|
setSectionOrderPersistHandler((entries) => {
|
|
26469
26826
|
const currentPath = window.location.pathname;
|
|
26470
26827
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26474,7 +26831,7 @@ function OhhwellsBridge() {
|
|
|
26474
26831
|
});
|
|
26475
26832
|
return () => setSectionOrderPersistHandler(null);
|
|
26476
26833
|
}, []);
|
|
26477
|
-
(0,
|
|
26834
|
+
(0, import_react24.useEffect)(() => {
|
|
26478
26835
|
setAiFooterMountOptions({
|
|
26479
26836
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26480
26837
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26537,7 +26894,7 @@ function OhhwellsBridge() {
|
|
|
26537
26894
|
const bumpLinkPopoverGrace = () => {
|
|
26538
26895
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
26539
26896
|
};
|
|
26540
|
-
const runSectionsPrefetch = (0,
|
|
26897
|
+
const runSectionsPrefetch = (0, import_react24.useCallback)((pages) => {
|
|
26541
26898
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
26542
26899
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
26543
26900
|
const paths = pages.map((p) => p.path);
|
|
@@ -26556,9 +26913,9 @@ function OhhwellsBridge() {
|
|
|
26556
26913
|
);
|
|
26557
26914
|
});
|
|
26558
26915
|
}, [isEditMode, pathname]);
|
|
26559
|
-
const runSectionsPrefetchRef = (0,
|
|
26916
|
+
const runSectionsPrefetchRef = (0, import_react24.useRef)(runSectionsPrefetch);
|
|
26560
26917
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26561
|
-
(0,
|
|
26918
|
+
(0, import_react24.useEffect)(() => {
|
|
26562
26919
|
if (!linkPopover) {
|
|
26563
26920
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26564
26921
|
return;
|
|
@@ -26586,7 +26943,7 @@ function OhhwellsBridge() {
|
|
|
26586
26943
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26587
26944
|
};
|
|
26588
26945
|
}, [linkPopover, postToParent2]);
|
|
26589
|
-
(0,
|
|
26946
|
+
(0, import_react24.useEffect)(() => {
|
|
26590
26947
|
if (!isEditMode) return;
|
|
26591
26948
|
const useFixtures = shouldUseDevFixtures();
|
|
26592
26949
|
if (useFixtures) {
|
|
@@ -26612,7 +26969,7 @@ function OhhwellsBridge() {
|
|
|
26612
26969
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26613
26970
|
return () => window.removeEventListener("message", onSitePages);
|
|
26614
26971
|
}, [isEditMode, postToParent2]);
|
|
26615
|
-
(0,
|
|
26972
|
+
(0, import_react24.useEffect)(() => {
|
|
26616
26973
|
if (!isEditMode) return;
|
|
26617
26974
|
const deps = {
|
|
26618
26975
|
getEditContent: () => editContentRef.current,
|
|
@@ -26649,14 +27006,14 @@ function OhhwellsBridge() {
|
|
|
26649
27006
|
window.addEventListener("message", onPageMessage);
|
|
26650
27007
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26651
27008
|
}, [isEditMode, postToParent2]);
|
|
26652
|
-
(0,
|
|
27009
|
+
(0, import_react24.useEffect)(() => {
|
|
26653
27010
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26654
27011
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26655
27012
|
if (Object.keys(manifest).length === 0) return;
|
|
26656
27013
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26657
27014
|
});
|
|
26658
27015
|
}, [isEditMode]);
|
|
26659
|
-
(0,
|
|
27016
|
+
(0, import_react24.useEffect)(() => {
|
|
26660
27017
|
const update = () => {
|
|
26661
27018
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26662
27019
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -26680,10 +27037,10 @@ function OhhwellsBridge() {
|
|
|
26680
27037
|
vvp.removeEventListener("resize", update);
|
|
26681
27038
|
};
|
|
26682
27039
|
}, []);
|
|
26683
|
-
const refreshStateRules = (0,
|
|
27040
|
+
const refreshStateRules = (0, import_react24.useCallback)(() => {
|
|
26684
27041
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
26685
27042
|
}, []);
|
|
26686
|
-
const processConfigRequest = (0,
|
|
27043
|
+
const processConfigRequest = (0, import_react24.useCallback)((insertAfterVal) => {
|
|
26687
27044
|
const tracker = getSectionsTracker();
|
|
26688
27045
|
let entries = [];
|
|
26689
27046
|
try {
|
|
@@ -26706,7 +27063,7 @@ function OhhwellsBridge() {
|
|
|
26706
27063
|
}
|
|
26707
27064
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
26708
27065
|
}, [isEditMode]);
|
|
26709
|
-
const deactivate = (0,
|
|
27066
|
+
const deactivate = (0, import_react24.useCallback)(() => {
|
|
26710
27067
|
const el = activeElRef.current;
|
|
26711
27068
|
if (!el) return;
|
|
26712
27069
|
const isFormBlock = el.dataset.ohwEditable === "form";
|
|
@@ -26772,12 +27129,12 @@ function OhhwellsBridge() {
|
|
|
26772
27129
|
setToolbarShowEditLink(false);
|
|
26773
27130
|
postToParent2({ type: "ow:exit-edit" });
|
|
26774
27131
|
}, [postToParent2]);
|
|
26775
|
-
const clearSelectedAttr = (0,
|
|
27132
|
+
const clearSelectedAttr = (0, import_react24.useCallback)(() => {
|
|
26776
27133
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
26777
27134
|
el.removeAttribute("data-ohw-selected");
|
|
26778
27135
|
});
|
|
26779
27136
|
}, []);
|
|
26780
|
-
const deselect = (0,
|
|
27137
|
+
const deselect = (0, import_react24.useCallback)(() => {
|
|
26781
27138
|
const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
|
|
26782
27139
|
clearSelectedAttr();
|
|
26783
27140
|
selectedElRef.current = null;
|
|
@@ -26813,20 +27170,20 @@ function OhhwellsBridge() {
|
|
|
26813
27170
|
setToolbarVariant("none");
|
|
26814
27171
|
}
|
|
26815
27172
|
}, [clearSelectedAttr]);
|
|
26816
|
-
const markSelected = (0,
|
|
27173
|
+
const markSelected = (0, import_react24.useCallback)((el) => {
|
|
26817
27174
|
clearSelectedAttr();
|
|
26818
27175
|
el.removeAttribute("data-ohw-hovered");
|
|
26819
27176
|
el.setAttribute("data-ohw-selected", "");
|
|
26820
27177
|
}, [clearSelectedAttr]);
|
|
26821
|
-
const isSelectedForHover = (0,
|
|
27178
|
+
const isSelectedForHover = (0, import_react24.useCallback)((el) => {
|
|
26822
27179
|
if (!el) return false;
|
|
26823
27180
|
return [selectedElRef.current, activeElRef.current].some(
|
|
26824
27181
|
(busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
|
|
26825
27182
|
);
|
|
26826
27183
|
}, []);
|
|
26827
|
-
const isSelectedForHoverRef = (0,
|
|
27184
|
+
const isSelectedForHoverRef = (0, import_react24.useRef)(isSelectedForHover);
|
|
26828
27185
|
isSelectedForHoverRef.current = isSelectedForHover;
|
|
26829
|
-
const resolveHrefKeyElement = (0,
|
|
27186
|
+
const resolveHrefKeyElement = (0, import_react24.useCallback)((hrefKey) => {
|
|
26830
27187
|
if (isFooterHrefKey(hrefKey)) {
|
|
26831
27188
|
return document.querySelector(
|
|
26832
27189
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -26841,7 +27198,7 @@ function OhhwellsBridge() {
|
|
|
26841
27198
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
26842
27199
|
);
|
|
26843
27200
|
}, []);
|
|
26844
|
-
const resyncSelectedNavigationItem = (0,
|
|
27201
|
+
const resyncSelectedNavigationItem = (0, import_react24.useCallback)(() => {
|
|
26845
27202
|
const hrefKey = selectedHrefKeyRef.current;
|
|
26846
27203
|
if (hrefKey) {
|
|
26847
27204
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -26879,7 +27236,7 @@ function OhhwellsBridge() {
|
|
|
26879
27236
|
);
|
|
26880
27237
|
}
|
|
26881
27238
|
}, [resolveHrefKeyElement]);
|
|
26882
|
-
const reselectNavigationItem = (0,
|
|
27239
|
+
const reselectNavigationItem = (0, import_react24.useCallback)((navAnchor) => {
|
|
26883
27240
|
selectedElRef.current = navAnchor;
|
|
26884
27241
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
26885
27242
|
selectedFooterColAttrRef.current = null;
|
|
@@ -26910,7 +27267,7 @@ function OhhwellsBridge() {
|
|
|
26910
27267
|
setToolbarShowEditLink(false);
|
|
26911
27268
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
26912
27269
|
}, [markSelected]);
|
|
26913
|
-
const commitNavigationTextEdit = (0,
|
|
27270
|
+
const commitNavigationTextEdit = (0, import_react24.useCallback)((navAnchor) => {
|
|
26914
27271
|
const el = activeElRef.current;
|
|
26915
27272
|
if (!el) return;
|
|
26916
27273
|
const key = el.dataset.ohwKey;
|
|
@@ -26943,7 +27300,7 @@ function OhhwellsBridge() {
|
|
|
26943
27300
|
postToParent2({ type: "ow:exit-edit" });
|
|
26944
27301
|
reselectNavigationItem(navAnchor);
|
|
26945
27302
|
}, [postToParent2, reselectNavigationItem]);
|
|
26946
|
-
const handleAddTopLevelNavItem = (0,
|
|
27303
|
+
const handleAddTopLevelNavItem = (0, import_react24.useCallback)(() => {
|
|
26947
27304
|
const items = listNavbarRootItems();
|
|
26948
27305
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
26949
27306
|
deselectRef.current();
|
|
@@ -26955,7 +27312,7 @@ function OhhwellsBridge() {
|
|
|
26955
27312
|
intent: "add-nav"
|
|
26956
27313
|
});
|
|
26957
27314
|
}, []);
|
|
26958
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
27315
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react24.useCallback)(
|
|
26959
27316
|
(anchor) => {
|
|
26960
27317
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
26961
27318
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -26968,7 +27325,7 @@ function OhhwellsBridge() {
|
|
|
26968
27325
|
},
|
|
26969
27326
|
[postToParent2]
|
|
26970
27327
|
);
|
|
26971
|
-
const handleNavDropdownOpenChange = (0,
|
|
27328
|
+
const handleNavDropdownOpenChange = (0, import_react24.useCallback)((open) => {
|
|
26972
27329
|
const selected = selectedElRef.current;
|
|
26973
27330
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
26974
27331
|
if (isNestedNavChild(selected)) return;
|
|
@@ -26984,7 +27341,7 @@ function OhhwellsBridge() {
|
|
|
26984
27341
|
}
|
|
26985
27342
|
});
|
|
26986
27343
|
}, []);
|
|
26987
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
27344
|
+
const handleFooterHeadingVisibleChange = (0, import_react24.useCallback)(
|
|
26988
27345
|
(visible) => {
|
|
26989
27346
|
const selected = selectedElRef.current;
|
|
26990
27347
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -27037,7 +27394,7 @@ function OhhwellsBridge() {
|
|
|
27037
27394
|
},
|
|
27038
27395
|
[postToParent2]
|
|
27039
27396
|
);
|
|
27040
|
-
const enterEditOnNewItem = (0,
|
|
27397
|
+
const enterEditOnNewItem = (0, import_react24.useCallback)((anchor) => {
|
|
27041
27398
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
27042
27399
|
if (!label) {
|
|
27043
27400
|
selectRef.current(anchor);
|
|
@@ -27046,8 +27403,8 @@ function OhhwellsBridge() {
|
|
|
27046
27403
|
setNavGroupForceOpen(anchor, true);
|
|
27047
27404
|
activateRef.current(label);
|
|
27048
27405
|
}, []);
|
|
27049
|
-
const pendingSocialAddRef = (0,
|
|
27050
|
-
const handleAddChildItem = (0,
|
|
27406
|
+
const pendingSocialAddRef = (0, import_react24.useRef)(null);
|
|
27407
|
+
const handleAddChildItem = (0, import_react24.useCallback)(() => {
|
|
27051
27408
|
const selected = selectedElRef.current;
|
|
27052
27409
|
if (!selected) return;
|
|
27053
27410
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
@@ -27174,7 +27531,7 @@ function OhhwellsBridge() {
|
|
|
27174
27531
|
});
|
|
27175
27532
|
});
|
|
27176
27533
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
27177
|
-
const handleAddFooterColumn = (0,
|
|
27534
|
+
const handleAddFooterColumn = (0, import_react24.useCallback)(() => {
|
|
27178
27535
|
if (document.querySelector("[data-ai-footer]")) {
|
|
27179
27536
|
const state = parseAiFooterState(aiFooterRef.current);
|
|
27180
27537
|
if (!state?.tree) return;
|
|
@@ -27230,7 +27587,7 @@ function OhhwellsBridge() {
|
|
|
27230
27587
|
selectRef.current(result.firstLink);
|
|
27231
27588
|
});
|
|
27232
27589
|
}, [postToParent2]);
|
|
27233
|
-
const clearFooterDragVisuals = (0,
|
|
27590
|
+
const clearFooterDragVisuals = (0, import_react24.useCallback)(() => {
|
|
27234
27591
|
footerDragRef.current = null;
|
|
27235
27592
|
setSiblingHintRects([]);
|
|
27236
27593
|
setFooterDropSlots([]);
|
|
@@ -27239,7 +27596,7 @@ function OhhwellsBridge() {
|
|
|
27239
27596
|
setIsItemDragging(false);
|
|
27240
27597
|
unlockFooterDragInteraction();
|
|
27241
27598
|
}, []);
|
|
27242
|
-
const refreshFooterDragVisuals = (0,
|
|
27599
|
+
const refreshFooterDragVisuals = (0, import_react24.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
27243
27600
|
const dragged = session.draggedEl;
|
|
27244
27601
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
27245
27602
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -27271,13 +27628,13 @@ function OhhwellsBridge() {
|
|
|
27271
27628
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
27272
27629
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
27273
27630
|
}, []);
|
|
27274
|
-
const refreshFooterDragVisualsRef = (0,
|
|
27631
|
+
const refreshFooterDragVisualsRef = (0, import_react24.useRef)(refreshFooterDragVisuals);
|
|
27275
27632
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
27276
|
-
const commitFooterDragRef = (0,
|
|
27633
|
+
const commitFooterDragRef = (0, import_react24.useRef)(() => {
|
|
27277
27634
|
});
|
|
27278
|
-
const beginFooterDragRef = (0,
|
|
27635
|
+
const beginFooterDragRef = (0, import_react24.useRef)(() => {
|
|
27279
27636
|
});
|
|
27280
|
-
const beginFooterDrag = (0,
|
|
27637
|
+
const beginFooterDrag = (0, import_react24.useCallback)(
|
|
27281
27638
|
(session) => {
|
|
27282
27639
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
27283
27640
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -27297,7 +27654,7 @@ function OhhwellsBridge() {
|
|
|
27297
27654
|
[refreshFooterDragVisuals]
|
|
27298
27655
|
);
|
|
27299
27656
|
beginFooterDragRef.current = beginFooterDrag;
|
|
27300
|
-
const commitFooterDrag = (0,
|
|
27657
|
+
const commitFooterDrag = (0, import_react24.useCallback)(
|
|
27301
27658
|
(clientX, clientY) => {
|
|
27302
27659
|
const session = footerDragRef.current;
|
|
27303
27660
|
if (!session) {
|
|
@@ -27469,7 +27826,7 @@ function OhhwellsBridge() {
|
|
|
27469
27826
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
27470
27827
|
);
|
|
27471
27828
|
commitFooterDragRef.current = commitFooterDrag;
|
|
27472
|
-
const startFooterLinkDrag = (0,
|
|
27829
|
+
const startFooterLinkDrag = (0, import_react24.useCallback)(
|
|
27473
27830
|
(anchor, clientX, clientY, wasSelected) => {
|
|
27474
27831
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
27475
27832
|
if (!hrefKey) return false;
|
|
@@ -27505,7 +27862,7 @@ function OhhwellsBridge() {
|
|
|
27505
27862
|
},
|
|
27506
27863
|
[beginFooterDrag]
|
|
27507
27864
|
);
|
|
27508
|
-
const startFooterColumnDrag = (0,
|
|
27865
|
+
const startFooterColumnDrag = (0, import_react24.useCallback)(
|
|
27509
27866
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
27510
27867
|
const columns = listFooterColumns(columnEl);
|
|
27511
27868
|
const idx = columns.indexOf(columnEl);
|
|
@@ -27525,7 +27882,7 @@ function OhhwellsBridge() {
|
|
|
27525
27882
|
},
|
|
27526
27883
|
[beginFooterDrag]
|
|
27527
27884
|
);
|
|
27528
|
-
const persistButtonCollectionDrag = (0,
|
|
27885
|
+
const persistButtonCollectionDrag = (0, import_react24.useCallback)(
|
|
27529
27886
|
(button, clientX) => {
|
|
27530
27887
|
const insertIndex = buttonDropInsertIndexRef.current;
|
|
27531
27888
|
if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
|
|
@@ -27549,7 +27906,7 @@ function OhhwellsBridge() {
|
|
|
27549
27906
|
},
|
|
27550
27907
|
[postToParent2]
|
|
27551
27908
|
);
|
|
27552
|
-
const refreshButtonDragVisuals = (0,
|
|
27909
|
+
const refreshButtonDragVisuals = (0, import_react24.useCallback)((button, clientX, clientY) => {
|
|
27553
27910
|
const collection = buttonCollectionOf(button);
|
|
27554
27911
|
if (!collection) {
|
|
27555
27912
|
setButtonDropSlots([]);
|
|
@@ -27566,7 +27923,7 @@ function OhhwellsBridge() {
|
|
|
27566
27923
|
setDraggedItemRect(button.getBoundingClientRect());
|
|
27567
27924
|
if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
|
|
27568
27925
|
}, []);
|
|
27569
|
-
const handleItemDragStart = (0,
|
|
27926
|
+
const handleItemDragStart = (0, import_react24.useCallback)(
|
|
27570
27927
|
(e) => {
|
|
27571
27928
|
const selected = selectedElRef.current;
|
|
27572
27929
|
if (!selected) {
|
|
@@ -27597,7 +27954,7 @@ function OhhwellsBridge() {
|
|
|
27597
27954
|
},
|
|
27598
27955
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
|
|
27599
27956
|
);
|
|
27600
|
-
const handleItemDragEnd = (0,
|
|
27957
|
+
const handleItemDragEnd = (0, import_react24.useCallback)(
|
|
27601
27958
|
(e) => {
|
|
27602
27959
|
const collectionButton = buttonCollectionDragRef.current;
|
|
27603
27960
|
if (collectionButton) {
|
|
@@ -27628,7 +27985,7 @@ function OhhwellsBridge() {
|
|
|
27628
27985
|
},
|
|
27629
27986
|
[commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
|
|
27630
27987
|
);
|
|
27631
|
-
const handleItemChromePointerDown = (0,
|
|
27988
|
+
const handleItemChromePointerDown = (0, import_react24.useCallback)((e) => {
|
|
27632
27989
|
if (e.button !== 0) return;
|
|
27633
27990
|
const selected = selectedElRef.current;
|
|
27634
27991
|
if (!selected) return;
|
|
@@ -27669,7 +28026,7 @@ function OhhwellsBridge() {
|
|
|
27669
28026
|
}
|
|
27670
28027
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
27671
28028
|
}, [armNavPressFromChrome]);
|
|
27672
|
-
const handleItemChromeClick = (0,
|
|
28029
|
+
const handleItemChromeClick = (0, import_react24.useCallback)((clientX, clientY) => {
|
|
27673
28030
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
27674
28031
|
suppressNextClickRef.current = false;
|
|
27675
28032
|
return;
|
|
@@ -27682,7 +28039,7 @@ function OhhwellsBridge() {
|
|
|
27682
28039
|
}, []);
|
|
27683
28040
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
27684
28041
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
27685
|
-
const select = (0,
|
|
28042
|
+
const select = (0, import_react24.useCallback)((anchor) => {
|
|
27686
28043
|
if (!isNavigationItem2(anchor)) return;
|
|
27687
28044
|
if (activeElRef.current) deactivate();
|
|
27688
28045
|
clearSocialSelectionRef.current();
|
|
@@ -27759,7 +28116,7 @@ function OhhwellsBridge() {
|
|
|
27759
28116
|
setLogoSizeDraft(null);
|
|
27760
28117
|
}
|
|
27761
28118
|
}, [deactivate, markSelected]);
|
|
27762
|
-
const selectFrame = (0,
|
|
28119
|
+
const selectFrame = (0, import_react24.useCallback)((el) => {
|
|
27763
28120
|
if (!isNavigationContainer(el)) return;
|
|
27764
28121
|
if (activeElRef.current) deactivate();
|
|
27765
28122
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -27800,7 +28157,7 @@ function OhhwellsBridge() {
|
|
|
27800
28157
|
setFloatingPanelPos(null);
|
|
27801
28158
|
setLogoSizeDraft(null);
|
|
27802
28159
|
}, [deactivate, markSelected, postToParent2]);
|
|
27803
|
-
const selectLogo = (0,
|
|
28160
|
+
const selectLogo = (0, import_react24.useCallback)(
|
|
27804
28161
|
(logoEl) => {
|
|
27805
28162
|
if (activeElRef.current) deactivate();
|
|
27806
28163
|
selectedElRef.current = logoEl;
|
|
@@ -27829,7 +28186,7 @@ function OhhwellsBridge() {
|
|
|
27829
28186
|
},
|
|
27830
28187
|
[deactivate, markSelected]
|
|
27831
28188
|
);
|
|
27832
|
-
const openLogoSizePanel = (0,
|
|
28189
|
+
const openLogoSizePanel = (0, import_react24.useCallback)((logoEl) => {
|
|
27833
28190
|
const placement = getLogoPlacement(logoEl);
|
|
27834
28191
|
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
27835
28192
|
setLogoSizeDraft(draft);
|
|
@@ -27842,7 +28199,7 @@ function OhhwellsBridge() {
|
|
|
27842
28199
|
placement
|
|
27843
28200
|
});
|
|
27844
28201
|
}, []);
|
|
27845
|
-
const openSocialsDisplayPanel = (0,
|
|
28202
|
+
const openSocialsDisplayPanel = (0, import_react24.useCallback)((row) => {
|
|
27846
28203
|
setFloatingPanelPos(null);
|
|
27847
28204
|
setParentScrollSnap(parentScrollRef.current);
|
|
27848
28205
|
setFloatingPanel({
|
|
@@ -27853,7 +28210,7 @@ function OhhwellsBridge() {
|
|
|
27853
28210
|
row
|
|
27854
28211
|
});
|
|
27855
28212
|
}, []);
|
|
27856
|
-
const rememberButtonTokens = (0,
|
|
28213
|
+
const rememberButtonTokens = (0, import_react24.useCallback)(
|
|
27857
28214
|
(content, tokens, nodes) => {
|
|
27858
28215
|
if (nodes.length === 0) return content;
|
|
27859
28216
|
const next = { ...content };
|
|
@@ -27864,7 +28221,7 @@ function OhhwellsBridge() {
|
|
|
27864
28221
|
},
|
|
27865
28222
|
[postToParent2]
|
|
27866
28223
|
);
|
|
27867
|
-
const tokensForButton = (0,
|
|
28224
|
+
const tokensForButton = (0, import_react24.useCallback)(
|
|
27868
28225
|
(el, persistFallback = false) => {
|
|
27869
28226
|
const stored = readStoredStyleTokens(editContentRef.current);
|
|
27870
28227
|
if (stored) return stored;
|
|
@@ -27879,7 +28236,7 @@ function OhhwellsBridge() {
|
|
|
27879
28236
|
},
|
|
27880
28237
|
[rememberButtonTokens]
|
|
27881
28238
|
);
|
|
27882
|
-
const openButtonStylePanel = (0,
|
|
28239
|
+
const openButtonStylePanel = (0, import_react24.useCallback)(
|
|
27883
28240
|
(anchor) => {
|
|
27884
28241
|
const id = buttonId(anchor);
|
|
27885
28242
|
if (!id) return;
|
|
@@ -27897,7 +28254,7 @@ function OhhwellsBridge() {
|
|
|
27897
28254
|
},
|
|
27898
28255
|
[tokensForButton]
|
|
27899
28256
|
);
|
|
27900
|
-
const applySelectedButtonStyle = (0,
|
|
28257
|
+
const applySelectedButtonStyle = (0, import_react24.useCallback)(
|
|
27901
28258
|
(patch) => {
|
|
27902
28259
|
const panel = floatingPanelRef.current;
|
|
27903
28260
|
const id = panel?.kind === "button-style" ? panel.buttonId : null;
|
|
@@ -27915,7 +28272,7 @@ function OhhwellsBridge() {
|
|
|
27915
28272
|
},
|
|
27916
28273
|
[postToParent2]
|
|
27917
28274
|
);
|
|
27918
|
-
(0,
|
|
28275
|
+
(0, import_react24.useEffect)(() => {
|
|
27919
28276
|
const onDragOver = (e) => {
|
|
27920
28277
|
const dragged = buttonCollectionDragRef.current;
|
|
27921
28278
|
if (!dragged) return;
|
|
@@ -27934,11 +28291,11 @@ function OhhwellsBridge() {
|
|
|
27934
28291
|
document.removeEventListener("drop", onDrop);
|
|
27935
28292
|
};
|
|
27936
28293
|
}, [refreshButtonDragVisuals]);
|
|
27937
|
-
const isEditModeRef = (0,
|
|
27938
|
-
const requestMissingSocialIconsRef = (0,
|
|
28294
|
+
const isEditModeRef = (0, import_react24.useRef)(false);
|
|
28295
|
+
const requestMissingSocialIconsRef = (0, import_react24.useRef)(() => {
|
|
27939
28296
|
});
|
|
27940
|
-
const askedSocialIconsRef = (0,
|
|
27941
|
-
const requestMissingSocialIcons = (0,
|
|
28297
|
+
const askedSocialIconsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
|
|
28298
|
+
const requestMissingSocialIcons = (0, import_react24.useCallback)(() => {
|
|
27942
28299
|
const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
|
|
27943
28300
|
const missing = socialsMissingIcons(row);
|
|
27944
28301
|
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
@@ -27950,7 +28307,7 @@ function OhhwellsBridge() {
|
|
|
27950
28307
|
}, []);
|
|
27951
28308
|
requestMissingSocialIconsRef.current = requestMissingSocialIcons;
|
|
27952
28309
|
isEditModeRef.current = isEditMode;
|
|
27953
|
-
const changeSocialsDisplay = (0,
|
|
28310
|
+
const changeSocialsDisplay = (0, import_react24.useCallback)(
|
|
27954
28311
|
(row, next) => {
|
|
27955
28312
|
if (next.icon) {
|
|
27956
28313
|
const missing = socialsMissingIcons(row);
|
|
@@ -27974,19 +28331,19 @@ function OhhwellsBridge() {
|
|
|
27974
28331
|
},
|
|
27975
28332
|
[]
|
|
27976
28333
|
);
|
|
27977
|
-
const closeFloatingPanelOnly = (0,
|
|
28334
|
+
const closeFloatingPanelOnly = (0, import_react24.useCallback)(() => {
|
|
27978
28335
|
setFloatingPanel(null);
|
|
27979
28336
|
setFloatingPanelPos(null);
|
|
27980
28337
|
setLogoSizeDraft(null);
|
|
27981
28338
|
}, []);
|
|
27982
28339
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
27983
|
-
const closeFloatingPanelAndDeselect = (0,
|
|
28340
|
+
const closeFloatingPanelAndDeselect = (0, import_react24.useCallback)(() => {
|
|
27984
28341
|
setFloatingPanel(null);
|
|
27985
28342
|
setFloatingPanelPos(null);
|
|
27986
28343
|
setLogoSizeDraft(null);
|
|
27987
28344
|
deselectRef.current();
|
|
27988
28345
|
}, []);
|
|
27989
|
-
(0,
|
|
28346
|
+
(0, import_react24.useEffect)(() => {
|
|
27990
28347
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
27991
28348
|
if (!session || !logoSizeDraft) {
|
|
27992
28349
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28005,7 +28362,7 @@ function OhhwellsBridge() {
|
|
|
28005
28362
|
max: LOGO_SIZE_MAX
|
|
28006
28363
|
});
|
|
28007
28364
|
}, [floatingPanel, logoSizeDraft, editorViewport]);
|
|
28008
|
-
const persistLogoSizeDraft = (0,
|
|
28365
|
+
const persistLogoSizeDraft = (0, import_react24.useCallback)(
|
|
28009
28366
|
(placement, draft) => {
|
|
28010
28367
|
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
28011
28368
|
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
@@ -28045,7 +28402,7 @@ function OhhwellsBridge() {
|
|
|
28045
28402
|
},
|
|
28046
28403
|
[postToParent2]
|
|
28047
28404
|
);
|
|
28048
|
-
const activate = (0,
|
|
28405
|
+
const activate = (0, import_react24.useCallback)((el, options) => {
|
|
28049
28406
|
if (activeElRef.current === el) return;
|
|
28050
28407
|
document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
|
|
28051
28408
|
hovered.removeAttribute("data-ohw-hovered");
|
|
@@ -28143,8 +28500,8 @@ function OhhwellsBridge() {
|
|
|
28143
28500
|
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
28144
28501
|
deselectRef.current = deselect;
|
|
28145
28502
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28146
|
-
const lastSiteWideScopeRef = (0,
|
|
28147
|
-
(0,
|
|
28503
|
+
const lastSiteWideScopeRef = (0, import_react24.useRef)(null);
|
|
28504
|
+
(0, import_react24.useEffect)(() => {
|
|
28148
28505
|
if (!isEditMode) {
|
|
28149
28506
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28150
28507
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28170,7 +28527,7 @@ function OhhwellsBridge() {
|
|
|
28170
28527
|
isFooterFrameSelection,
|
|
28171
28528
|
postToParent2
|
|
28172
28529
|
]);
|
|
28173
|
-
(0,
|
|
28530
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
28174
28531
|
if (!subdomain || isEditMode) {
|
|
28175
28532
|
setFetchState("done");
|
|
28176
28533
|
return;
|
|
@@ -28197,6 +28554,7 @@ function OhhwellsBridge() {
|
|
|
28197
28554
|
applyAiFooterFromContent(content);
|
|
28198
28555
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28199
28556
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28557
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28200
28558
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28201
28559
|
}
|
|
28202
28560
|
applyBrandChrome(content);
|
|
@@ -28207,15 +28565,16 @@ function OhhwellsBridge() {
|
|
|
28207
28565
|
if (key === "__ohw_sections") continue;
|
|
28208
28566
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28209
28567
|
if (key === AI_FOOTER_KEY) continue;
|
|
28568
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28569
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28210
28570
|
if (key === BRAND_KIT_KEY) continue;
|
|
28211
28571
|
if (key === STYLE_STORE_KEY) continue;
|
|
28212
28572
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28213
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28214
28573
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28215
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28216
28574
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28217
28575
|
continue;
|
|
28218
28576
|
}
|
|
28577
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28219
28578
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28220
28579
|
if (applyCarouselNode(key, val)) continue;
|
|
28221
28580
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28255,6 +28614,7 @@ function OhhwellsBridge() {
|
|
|
28255
28614
|
});
|
|
28256
28615
|
applyLinkByKey(key, val);
|
|
28257
28616
|
}
|
|
28617
|
+
applySectionEmbeds(content);
|
|
28258
28618
|
applyLogoFromContent(content);
|
|
28259
28619
|
applyLogoSizes(content);
|
|
28260
28620
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28321,7 +28681,7 @@ function OhhwellsBridge() {
|
|
|
28321
28681
|
cancelled = true;
|
|
28322
28682
|
};
|
|
28323
28683
|
}, [subdomain, isEditMode]);
|
|
28324
|
-
(0,
|
|
28684
|
+
(0, import_react24.useEffect)(() => {
|
|
28325
28685
|
if (!isEditMode) return;
|
|
28326
28686
|
const resolveIndex = (form, clientY) => {
|
|
28327
28687
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28362,7 +28722,7 @@ function OhhwellsBridge() {
|
|
|
28362
28722
|
window.removeEventListener("drop", onDrop, true);
|
|
28363
28723
|
};
|
|
28364
28724
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28365
|
-
(0,
|
|
28725
|
+
(0, import_react24.useEffect)(() => {
|
|
28366
28726
|
if (!isEditMode) return;
|
|
28367
28727
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28368
28728
|
markFormFields(form);
|
|
@@ -28374,7 +28734,7 @@ function OhhwellsBridge() {
|
|
|
28374
28734
|
});
|
|
28375
28735
|
return () => observer.disconnect();
|
|
28376
28736
|
}, [isEditMode, fetchState, pathname]);
|
|
28377
|
-
(0,
|
|
28737
|
+
(0, import_react24.useEffect)(() => {
|
|
28378
28738
|
if (!isEditMode) return;
|
|
28379
28739
|
let saveTimer = null;
|
|
28380
28740
|
const onInput = (e) => {
|
|
@@ -28396,14 +28756,14 @@ function OhhwellsBridge() {
|
|
|
28396
28756
|
document.addEventListener("input", onInput, true);
|
|
28397
28757
|
return () => document.removeEventListener("input", onInput, true);
|
|
28398
28758
|
}, [isEditMode, persistFields]);
|
|
28399
|
-
(0,
|
|
28759
|
+
(0, import_react24.useEffect)(() => {
|
|
28400
28760
|
if (isEditMode || fetchState !== "done") return;
|
|
28401
28761
|
const content = contentCache.get(subdomain) ?? {};
|
|
28402
28762
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28403
28763
|
reconcileFieldsFromContent(form, content);
|
|
28404
28764
|
});
|
|
28405
28765
|
}, [isEditMode, fetchState, subdomain]);
|
|
28406
|
-
(0,
|
|
28766
|
+
(0, import_react24.useEffect)(() => {
|
|
28407
28767
|
if (!isEditMode) return;
|
|
28408
28768
|
const swallow = (e) => {
|
|
28409
28769
|
const target = e.target;
|
|
@@ -28412,14 +28772,14 @@ function OhhwellsBridge() {
|
|
|
28412
28772
|
document.addEventListener("submit", swallow, true);
|
|
28413
28773
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28414
28774
|
}, [isEditMode]);
|
|
28415
|
-
(0,
|
|
28775
|
+
(0, import_react24.useEffect)(() => {
|
|
28416
28776
|
if (isEditMode || fetchState !== "done") return;
|
|
28417
28777
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28418
28778
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28419
28779
|
console.log({ apiUrl, subdomain });
|
|
28420
28780
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28421
28781
|
}, [isEditMode, fetchState, subdomain]);
|
|
28422
|
-
(0,
|
|
28782
|
+
(0, import_react24.useEffect)(() => {
|
|
28423
28783
|
if (!subdomain || isEditMode) return;
|
|
28424
28784
|
let debounceTimer = null;
|
|
28425
28785
|
let observer = null;
|
|
@@ -28443,20 +28803,22 @@ function OhhwellsBridge() {
|
|
|
28443
28803
|
}
|
|
28444
28804
|
applyAiFooterFromContent(content);
|
|
28445
28805
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28806
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28446
28807
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28447
28808
|
}
|
|
28448
28809
|
for (const [key, val] of Object.entries(content)) {
|
|
28449
28810
|
if (key === "__ohw_sections") continue;
|
|
28450
28811
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28451
28812
|
if (key === AI_FOOTER_KEY) continue;
|
|
28813
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28814
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28452
28815
|
if (key === BRAND_KIT_KEY) continue;
|
|
28453
28816
|
if (key === STYLE_STORE_KEY) continue;
|
|
28454
28817
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28455
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28456
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28457
28818
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28458
28819
|
continue;
|
|
28459
28820
|
}
|
|
28821
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28460
28822
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28461
28823
|
if (applyCarouselNode(key, val)) continue;
|
|
28462
28824
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28481,6 +28843,7 @@ function OhhwellsBridge() {
|
|
|
28481
28843
|
});
|
|
28482
28844
|
applyLinkByKey(key, val);
|
|
28483
28845
|
}
|
|
28846
|
+
applySectionEmbeds(content);
|
|
28484
28847
|
applyLogoFromContent(content);
|
|
28485
28848
|
reconcileNavbarItemsFromContent(content);
|
|
28486
28849
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28536,16 +28899,16 @@ function OhhwellsBridge() {
|
|
|
28536
28899
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28537
28900
|
};
|
|
28538
28901
|
}, [subdomain, isEditMode, pathname]);
|
|
28539
|
-
(0,
|
|
28902
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
28540
28903
|
const el = document.getElementById("ohw-loader");
|
|
28541
28904
|
if (!el) return;
|
|
28542
28905
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28543
28906
|
el.style.display = visible ? "flex" : "none";
|
|
28544
28907
|
}, [subdomain, fetchState]);
|
|
28545
|
-
(0,
|
|
28908
|
+
(0, import_react24.useEffect)(() => {
|
|
28546
28909
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28547
28910
|
}, [pathname, postToParent2]);
|
|
28548
|
-
(0,
|
|
28911
|
+
(0, import_react24.useEffect)(() => {
|
|
28549
28912
|
if (!subdomain || isEditMode) return;
|
|
28550
28913
|
const content = contentCache.get(subdomain);
|
|
28551
28914
|
if (!content) return;
|
|
@@ -28563,7 +28926,7 @@ function OhhwellsBridge() {
|
|
|
28563
28926
|
}
|
|
28564
28927
|
applyAiFooterFromContent(content);
|
|
28565
28928
|
}, [pathname, subdomain, isEditMode]);
|
|
28566
|
-
(0,
|
|
28929
|
+
(0, import_react24.useEffect)(() => {
|
|
28567
28930
|
if (!isEditMode) return;
|
|
28568
28931
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28569
28932
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28571,12 +28934,12 @@ function OhhwellsBridge() {
|
|
|
28571
28934
|
deselectRef.current();
|
|
28572
28935
|
deactivateRef.current();
|
|
28573
28936
|
}, [pathname, isEditMode]);
|
|
28574
|
-
(0,
|
|
28937
|
+
(0, import_react24.useEffect)(() => {
|
|
28575
28938
|
if (!isEditMode) return;
|
|
28576
28939
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28577
28940
|
initItemInstancesFromContent(editContentRef.current);
|
|
28578
28941
|
}, [pathname, isEditMode]);
|
|
28579
|
-
(0,
|
|
28942
|
+
(0, import_react24.useEffect)(() => {
|
|
28580
28943
|
if (!isEditMode) return;
|
|
28581
28944
|
const observer = new MutationObserver(() => {
|
|
28582
28945
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28587,7 +28950,7 @@ function OhhwellsBridge() {
|
|
|
28587
28950
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28588
28951
|
return () => observer.disconnect();
|
|
28589
28952
|
}, [isEditMode, pathname]);
|
|
28590
|
-
(0,
|
|
28953
|
+
(0, import_react24.useEffect)(() => {
|
|
28591
28954
|
const contentForNav = () => {
|
|
28592
28955
|
if (isEditMode) return editContentRef.current;
|
|
28593
28956
|
if (!subdomain) return {};
|
|
@@ -28660,7 +29023,7 @@ function OhhwellsBridge() {
|
|
|
28660
29023
|
observer?.disconnect();
|
|
28661
29024
|
};
|
|
28662
29025
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28663
|
-
(0,
|
|
29026
|
+
(0, import_react24.useEffect)(() => {
|
|
28664
29027
|
if (!isEditMode) return;
|
|
28665
29028
|
let applying = false;
|
|
28666
29029
|
let rafId = null;
|
|
@@ -28698,7 +29061,7 @@ function OhhwellsBridge() {
|
|
|
28698
29061
|
observer.disconnect();
|
|
28699
29062
|
};
|
|
28700
29063
|
}, [isEditMode, pathname]);
|
|
28701
|
-
(0,
|
|
29064
|
+
(0, import_react24.useEffect)(() => {
|
|
28702
29065
|
if (!isEditMode) return;
|
|
28703
29066
|
let lastPosted = 0;
|
|
28704
29067
|
const measure = () => {
|
|
@@ -28720,29 +29083,14 @@ function OhhwellsBridge() {
|
|
|
28720
29083
|
const t2 = setTimeout(measure, 500);
|
|
28721
29084
|
const ro = new ResizeObserver(schedule);
|
|
28722
29085
|
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
29086
|
return () => {
|
|
28737
29087
|
clearTimeout(t1);
|
|
28738
29088
|
clearTimeout(t2);
|
|
28739
29089
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28740
29090
|
ro.disconnect();
|
|
28741
|
-
clearResizeTimers();
|
|
28742
|
-
window.removeEventListener("resize", handleResize);
|
|
28743
29091
|
};
|
|
28744
29092
|
}, [pathname, isEditMode, postToParent2]);
|
|
28745
|
-
(0,
|
|
29093
|
+
(0, import_react24.useEffect)(() => {
|
|
28746
29094
|
if (isEditMode) return;
|
|
28747
29095
|
const handleClick = (e) => {
|
|
28748
29096
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28756,7 +29104,7 @@ function OhhwellsBridge() {
|
|
|
28756
29104
|
document.addEventListener("click", handleClick, true);
|
|
28757
29105
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28758
29106
|
}, [isEditMode, router, pathname]);
|
|
28759
|
-
(0,
|
|
29107
|
+
(0, import_react24.useEffect)(() => {
|
|
28760
29108
|
if (!isEditMode) {
|
|
28761
29109
|
editStylesRef.current?.base.remove();
|
|
28762
29110
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -29036,6 +29384,13 @@ function OhhwellsBridge() {
|
|
|
29036
29384
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29037
29385
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29038
29386
|
if (isInsideLinkEditor(target)) return;
|
|
29387
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29388
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29389
|
+
if (target.closest(
|
|
29390
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29391
|
+
)) {
|
|
29392
|
+
return;
|
|
29393
|
+
}
|
|
29039
29394
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29040
29395
|
clearMediaSelectionRef.current();
|
|
29041
29396
|
}
|
|
@@ -29059,8 +29414,6 @@ function OhhwellsBridge() {
|
|
|
29059
29414
|
return;
|
|
29060
29415
|
}
|
|
29061
29416
|
}
|
|
29062
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29063
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29064
29417
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29065
29418
|
if (collectionItem) {
|
|
29066
29419
|
e.preventDefault();
|
|
@@ -29072,11 +29425,6 @@ function OhhwellsBridge() {
|
|
|
29072
29425
|
});
|
|
29073
29426
|
return;
|
|
29074
29427
|
}
|
|
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
29428
|
{
|
|
29081
29429
|
const formEl = getFormElement(target);
|
|
29082
29430
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29230,9 +29578,13 @@ function OhhwellsBridge() {
|
|
|
29230
29578
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29231
29579
|
e.preventDefault();
|
|
29232
29580
|
e.stopPropagation();
|
|
29233
|
-
selectIconElementRef.current(editable);
|
|
29234
29581
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29235
29582
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29583
|
+
if (aiIcon) {
|
|
29584
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29585
|
+
} else {
|
|
29586
|
+
selectIconElementRef.current(editable);
|
|
29587
|
+
}
|
|
29236
29588
|
postToParentRef.current({
|
|
29237
29589
|
type: "ow:icon-pick",
|
|
29238
29590
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29460,6 +29812,9 @@ function OhhwellsBridge() {
|
|
|
29460
29812
|
setHoveredItemRect(null);
|
|
29461
29813
|
hoveredNavContainerRef.current = null;
|
|
29462
29814
|
setHoveredNavContainerRect(null);
|
|
29815
|
+
siblingHintElRef.current = null;
|
|
29816
|
+
setSiblingHintRect(null);
|
|
29817
|
+
setSiblingHintRects([]);
|
|
29463
29818
|
return;
|
|
29464
29819
|
}
|
|
29465
29820
|
{
|
|
@@ -29580,7 +29935,6 @@ function OhhwellsBridge() {
|
|
|
29580
29935
|
hoveredNavContainerRef.current = null;
|
|
29581
29936
|
setHoveredNavContainerRect(null);
|
|
29582
29937
|
hoveredItemElRef.current = editable;
|
|
29583
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29584
29938
|
}
|
|
29585
29939
|
}
|
|
29586
29940
|
}
|
|
@@ -30290,7 +30644,11 @@ function OhhwellsBridge() {
|
|
|
30290
30644
|
};
|
|
30291
30645
|
const handleMouseMove = (e) => {
|
|
30292
30646
|
const { clientX, clientY } = e;
|
|
30293
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30647
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30648
|
+
dismissImageHover();
|
|
30649
|
+
clearImageHover();
|
|
30650
|
+
return;
|
|
30651
|
+
}
|
|
30294
30652
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30295
30653
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30296
30654
|
formHoverElRef.current = null;
|
|
@@ -30319,7 +30677,12 @@ function OhhwellsBridge() {
|
|
|
30319
30677
|
setHoveredItemRect(null);
|
|
30320
30678
|
hoveredNavContainerRef.current = null;
|
|
30321
30679
|
setHoveredNavContainerRect(null);
|
|
30680
|
+
siblingHintElRef.current = null;
|
|
30681
|
+
setSiblingHintRect(null);
|
|
30682
|
+
setSiblingHintRects([]);
|
|
30322
30683
|
dismissImageHover();
|
|
30684
|
+
clearImageHover();
|
|
30685
|
+
setSectionGap(null);
|
|
30323
30686
|
return;
|
|
30324
30687
|
}
|
|
30325
30688
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30331,7 +30694,11 @@ function OhhwellsBridge() {
|
|
|
30331
30694
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30332
30695
|
const { clientX, clientY } = e.data;
|
|
30333
30696
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30334
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30697
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30698
|
+
dismissImageHover();
|
|
30699
|
+
clearImageHover();
|
|
30700
|
+
return;
|
|
30701
|
+
}
|
|
30335
30702
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30336
30703
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30337
30704
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30711,6 +31078,7 @@ function OhhwellsBridge() {
|
|
|
30711
31078
|
applyAiFooterFromContent(content);
|
|
30712
31079
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30713
31080
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31081
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30714
31082
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30715
31083
|
}
|
|
30716
31084
|
applyBrandChrome(content);
|
|
@@ -30725,15 +31093,16 @@ function OhhwellsBridge() {
|
|
|
30725
31093
|
}
|
|
30726
31094
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30727
31095
|
if (key === AI_FOOTER_KEY) continue;
|
|
31096
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31097
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30728
31098
|
if (key === BRAND_KIT_KEY) continue;
|
|
30729
31099
|
if (key === STYLE_STORE_KEY) continue;
|
|
30730
31100
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30731
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30732
31101
|
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
31102
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30735
31103
|
continue;
|
|
30736
31104
|
}
|
|
31105
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30737
31106
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30738
31107
|
if (applyCarouselNode(key, val)) continue;
|
|
30739
31108
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30759,6 +31128,7 @@ function OhhwellsBridge() {
|
|
|
30759
31128
|
});
|
|
30760
31129
|
applyLinkByKey(key, val);
|
|
30761
31130
|
}
|
|
31131
|
+
applySectionEmbeds(content);
|
|
30762
31132
|
applyLogoFromContent(content);
|
|
30763
31133
|
applyLogoSizes(content);
|
|
30764
31134
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -30986,6 +31356,31 @@ function OhhwellsBridge() {
|
|
|
30986
31356
|
postAiSectionsChanged();
|
|
30987
31357
|
};
|
|
30988
31358
|
window.addEventListener("message", handleAiDeleteSection);
|
|
31359
|
+
const handleAiMoveSection = (e) => {
|
|
31360
|
+
if (e.data?.type !== "ow:ai-move-section") return;
|
|
31361
|
+
const sectionId = typeof e.data.sectionId === "string" ? e.data.sectionId : "";
|
|
31362
|
+
const targetPage = typeof e.data.targetPage === "string" ? e.data.targetPage : "";
|
|
31363
|
+
if (!sectionId || !targetPage) return;
|
|
31364
|
+
const previous = aiSectionsRef.current;
|
|
31365
|
+
const nextState = moveSectionInState(parseAiSectionsState(previous), sectionId, targetPage);
|
|
31366
|
+
if (!nextState) return;
|
|
31367
|
+
clearInteractionChrome();
|
|
31368
|
+
const nextValue = serializeAiSectionsState(nextState);
|
|
31369
|
+
aiSectionsRef.current = nextValue;
|
|
31370
|
+
applyAiSectionsToDom(nextState);
|
|
31371
|
+
const newHeight = document.body.scrollHeight;
|
|
31372
|
+
if (newHeight > 50) postToParentRef.current({ type: "ow:height", height: newHeight });
|
|
31373
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: nextValue }] });
|
|
31374
|
+
postToParentRef.current({
|
|
31375
|
+
type: "ow:ai-section-moved",
|
|
31376
|
+
sectionId,
|
|
31377
|
+
targetPage,
|
|
31378
|
+
previous,
|
|
31379
|
+
value: nextValue
|
|
31380
|
+
});
|
|
31381
|
+
postAiSectionsChanged();
|
|
31382
|
+
};
|
|
31383
|
+
window.addEventListener("message", handleAiMoveSection);
|
|
30989
31384
|
const handleAiSetSections = (e) => {
|
|
30990
31385
|
if (e.data?.type !== "ow:ai-set-sections") return;
|
|
30991
31386
|
const value = typeof e.data.value === "string" ? e.data.value : "";
|
|
@@ -31366,6 +31761,12 @@ function OhhwellsBridge() {
|
|
|
31366
31761
|
closeLinkPopoverRef.current();
|
|
31367
31762
|
return;
|
|
31368
31763
|
}
|
|
31764
|
+
if (floatingPanelOpenRef.current) {
|
|
31765
|
+
setFloatingPanelRef.current(null);
|
|
31766
|
+
deselectRef.current();
|
|
31767
|
+
deactivateRef.current();
|
|
31768
|
+
return;
|
|
31769
|
+
}
|
|
31369
31770
|
deselectRef.current();
|
|
31370
31771
|
deactivateRef.current();
|
|
31371
31772
|
clearMediaSelectionRef.current();
|
|
@@ -32185,6 +32586,7 @@ function OhhwellsBridge() {
|
|
|
32185
32586
|
window.removeEventListener("message", handleAiApplyTree);
|
|
32186
32587
|
window.removeEventListener("message", handleAiApplyFooter);
|
|
32187
32588
|
window.removeEventListener("message", handleAiDeleteSection);
|
|
32589
|
+
window.removeEventListener("message", handleAiMoveSection);
|
|
32188
32590
|
window.removeEventListener("message", handleAiSetSections);
|
|
32189
32591
|
window.removeEventListener("message", handleAiSetBrand);
|
|
32190
32592
|
window.removeEventListener("message", handleAiSetStyles);
|
|
@@ -32201,17 +32603,17 @@ function OhhwellsBridge() {
|
|
|
32201
32603
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32202
32604
|
window.removeEventListener("message", handleDeactivate);
|
|
32203
32605
|
window.removeEventListener("message", handleSelectNav);
|
|
32204
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32205
32606
|
window.removeEventListener("message", handleToastAction);
|
|
32206
32607
|
window.removeEventListener("message", handleFormCount);
|
|
32207
32608
|
window.removeEventListener("message", handleUiEscape);
|
|
32609
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32208
32610
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32209
32611
|
autoSaveTimers.current.clear();
|
|
32210
32612
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
32211
32613
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32212
32614
|
};
|
|
32213
32615
|
}, [isEditMode, refreshStateRules]);
|
|
32214
|
-
(0,
|
|
32616
|
+
(0, import_react24.useEffect)(() => {
|
|
32215
32617
|
if (!isEditMode) return;
|
|
32216
32618
|
const THRESHOLD = 10;
|
|
32217
32619
|
const resolveWasSelected = (el) => {
|
|
@@ -32367,7 +32769,7 @@ function OhhwellsBridge() {
|
|
|
32367
32769
|
unlockFooterDragInteraction();
|
|
32368
32770
|
};
|
|
32369
32771
|
}, [isEditMode]);
|
|
32370
|
-
(0,
|
|
32772
|
+
(0, import_react24.useEffect)(() => {
|
|
32371
32773
|
if (!isEditMode) return;
|
|
32372
32774
|
const THRESHOLD = 10;
|
|
32373
32775
|
const onPointerDown = (e) => {
|
|
@@ -32458,7 +32860,7 @@ function OhhwellsBridge() {
|
|
|
32458
32860
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32459
32861
|
};
|
|
32460
32862
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32461
|
-
(0,
|
|
32863
|
+
(0, import_react24.useEffect)(() => {
|
|
32462
32864
|
const handler = (e) => {
|
|
32463
32865
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32464
32866
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32474,7 +32876,7 @@ function OhhwellsBridge() {
|
|
|
32474
32876
|
window.addEventListener("message", handler);
|
|
32475
32877
|
return () => window.removeEventListener("message", handler);
|
|
32476
32878
|
}, [processConfigRequest]);
|
|
32477
|
-
(0,
|
|
32879
|
+
(0, import_react24.useEffect)(() => {
|
|
32478
32880
|
if (!isEditMode) return;
|
|
32479
32881
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32480
32882
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32498,7 +32900,7 @@ function OhhwellsBridge() {
|
|
|
32498
32900
|
postToParent2({
|
|
32499
32901
|
type: "ow:ready",
|
|
32500
32902
|
version: "1",
|
|
32501
|
-
bridgeVersion: "0.1.
|
|
32903
|
+
bridgeVersion: "0.1.164-next.439",
|
|
32502
32904
|
path: pathname,
|
|
32503
32905
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32504
32906
|
sections
|
|
@@ -32510,13 +32912,13 @@ function OhhwellsBridge() {
|
|
|
32510
32912
|
clearTimeout(timer);
|
|
32511
32913
|
};
|
|
32512
32914
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32513
|
-
(0,
|
|
32915
|
+
(0, import_react24.useEffect)(() => {
|
|
32514
32916
|
scrollToHashSectionWhenReady();
|
|
32515
32917
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32516
32918
|
window.addEventListener("hashchange", onHashChange);
|
|
32517
32919
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
32518
32920
|
}, [pathname]);
|
|
32519
|
-
const handleCommand = (0,
|
|
32921
|
+
const handleCommand = (0, import_react24.useCallback)((cmd) => {
|
|
32520
32922
|
const el = activeElRef.current;
|
|
32521
32923
|
const selBefore = window.getSelection();
|
|
32522
32924
|
let savedOffsets = null;
|
|
@@ -32552,7 +32954,7 @@ function OhhwellsBridge() {
|
|
|
32552
32954
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32553
32955
|
refreshActiveCommandsRef.current();
|
|
32554
32956
|
}, []);
|
|
32555
|
-
(0,
|
|
32957
|
+
(0, import_react24.useEffect)(() => {
|
|
32556
32958
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32557
32959
|
if (!session || !logoSizeDraft) return;
|
|
32558
32960
|
const onPanelAction = (e) => {
|
|
@@ -32590,7 +32992,7 @@ function OhhwellsBridge() {
|
|
|
32590
32992
|
window.addEventListener("message", onPanelAction);
|
|
32591
32993
|
return () => window.removeEventListener("message", onPanelAction);
|
|
32592
32994
|
}, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
|
|
32593
|
-
const handleStateChange = (0,
|
|
32995
|
+
const handleStateChange = (0, import_react24.useCallback)((state) => {
|
|
32594
32996
|
if (!activeStateElRef.current) return;
|
|
32595
32997
|
const el = activeStateElRef.current;
|
|
32596
32998
|
if (state === "Default") {
|
|
@@ -32603,7 +33005,7 @@ function OhhwellsBridge() {
|
|
|
32603
33005
|
}
|
|
32604
33006
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
32605
33007
|
}, [deactivate]);
|
|
32606
|
-
const reselectAfterLinkPopover = (0,
|
|
33008
|
+
const reselectAfterLinkPopover = (0, import_react24.useCallback)(
|
|
32607
33009
|
(hrefKey) => {
|
|
32608
33010
|
requestAnimationFrame(() => {
|
|
32609
33011
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -32612,7 +33014,7 @@ function OhhwellsBridge() {
|
|
|
32612
33014
|
},
|
|
32613
33015
|
[resolveHrefKeyElement]
|
|
32614
33016
|
);
|
|
32615
|
-
const closeLinkPopover = (0,
|
|
33017
|
+
const closeLinkPopover = (0, import_react24.useCallback)(() => {
|
|
32616
33018
|
const session = linkPopoverSessionRef.current;
|
|
32617
33019
|
addNavAfterAnchorRef.current = null;
|
|
32618
33020
|
setLinkPopover(null);
|
|
@@ -32620,9 +33022,9 @@ function OhhwellsBridge() {
|
|
|
32620
33022
|
reselectAfterLinkPopover(session.key);
|
|
32621
33023
|
}
|
|
32622
33024
|
}, [reselectAfterLinkPopover]);
|
|
32623
|
-
const closeLinkPopoverRef = (0,
|
|
33025
|
+
const closeLinkPopoverRef = (0, import_react24.useRef)(closeLinkPopover);
|
|
32624
33026
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
32625
|
-
const openLinkPopoverForActive = (0,
|
|
33027
|
+
const openLinkPopoverForActive = (0, import_react24.useCallback)(() => {
|
|
32626
33028
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
32627
33029
|
if (!hrefCtx) return;
|
|
32628
33030
|
bumpLinkPopoverGrace();
|
|
@@ -32633,7 +33035,7 @@ function OhhwellsBridge() {
|
|
|
32633
33035
|
});
|
|
32634
33036
|
deactivate();
|
|
32635
33037
|
}, [deactivate]);
|
|
32636
|
-
const openLinkPopoverForSelected = (0,
|
|
33038
|
+
const openLinkPopoverForSelected = (0, import_react24.useCallback)(() => {
|
|
32637
33039
|
const anchor = selectedElRef.current;
|
|
32638
33040
|
if (!anchor) return;
|
|
32639
33041
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -32650,7 +33052,7 @@ function OhhwellsBridge() {
|
|
|
32650
33052
|
});
|
|
32651
33053
|
deselect();
|
|
32652
33054
|
}, [deselect]);
|
|
32653
|
-
const handleSelectParent = (0,
|
|
33055
|
+
const handleSelectParent = (0, import_react24.useCallback)(() => {
|
|
32654
33056
|
const selected = selectedElRef.current;
|
|
32655
33057
|
if (!selected) return;
|
|
32656
33058
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -32677,7 +33079,7 @@ function OhhwellsBridge() {
|
|
|
32677
33079
|
}
|
|
32678
33080
|
deselectRef.current();
|
|
32679
33081
|
}, []);
|
|
32680
|
-
const handleDuplicateSelected = (0,
|
|
33082
|
+
const handleDuplicateSelected = (0, import_react24.useCallback)(() => {
|
|
32681
33083
|
const selected = selectedElRef.current;
|
|
32682
33084
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
32683
33085
|
if (isCtaButton(selected)) {
|
|
@@ -32846,7 +33248,7 @@ function OhhwellsBridge() {
|
|
|
32846
33248
|
});
|
|
32847
33249
|
}
|
|
32848
33250
|
}, [postToParent2, tokensForButton]);
|
|
32849
|
-
const runPendingDeleteUndo = (0,
|
|
33251
|
+
const runPendingDeleteUndo = (0, import_react24.useCallback)(() => {
|
|
32850
33252
|
const pending = pendingDeleteUndoRef.current;
|
|
32851
33253
|
if (!pending) return false;
|
|
32852
33254
|
pendingDeleteUndoRef.current = null;
|
|
@@ -32854,7 +33256,7 @@ function OhhwellsBridge() {
|
|
|
32854
33256
|
enforceLinkHrefs();
|
|
32855
33257
|
return true;
|
|
32856
33258
|
}, []);
|
|
32857
|
-
const handleDeleteSelected = (0,
|
|
33259
|
+
const handleDeleteSelected = (0, import_react24.useCallback)(() => {
|
|
32858
33260
|
const selected = selectedElRef.current;
|
|
32859
33261
|
if (!selected) return false;
|
|
32860
33262
|
if (isCtaButton(selected)) {
|
|
@@ -32916,7 +33318,7 @@ function OhhwellsBridge() {
|
|
|
32916
33318
|
}, [postToParent2]);
|
|
32917
33319
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
32918
33320
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
32919
|
-
const handleLinkPopoverSubmit = (0,
|
|
33321
|
+
const handleLinkPopoverSubmit = (0, import_react24.useCallback)(
|
|
32920
33322
|
(target) => {
|
|
32921
33323
|
const session = linkPopoverSessionRef.current;
|
|
32922
33324
|
if (!session) return;
|
|
@@ -32982,14 +33384,14 @@ function OhhwellsBridge() {
|
|
|
32982
33384
|
const showEditLink = toolbarShowEditLink;
|
|
32983
33385
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
32984
33386
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
32985
|
-
const handleMediaSelect = (0,
|
|
33387
|
+
const handleMediaSelect = (0, import_react24.useCallback)((key) => {
|
|
32986
33388
|
const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
|
|
32987
33389
|
(m) => (m.dataset.ohwKey ?? "") === key
|
|
32988
33390
|
) ?? null;
|
|
32989
33391
|
if (!el) return;
|
|
32990
33392
|
selectMediaElementRef.current(el);
|
|
32991
33393
|
}, []);
|
|
32992
|
-
const handleMediaReplace = (0,
|
|
33394
|
+
const handleMediaReplace = (0, import_react24.useCallback)(
|
|
32993
33395
|
(key) => {
|
|
32994
33396
|
postToParent2({
|
|
32995
33397
|
type: "ow:image-pick",
|
|
@@ -32999,13 +33401,13 @@ function OhhwellsBridge() {
|
|
|
32999
33401
|
},
|
|
33000
33402
|
[postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
|
|
33001
33403
|
);
|
|
33002
|
-
const handleEditCarousel = (0,
|
|
33404
|
+
const handleEditCarousel = (0, import_react24.useCallback)(
|
|
33003
33405
|
(key) => {
|
|
33004
33406
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
33005
33407
|
},
|
|
33006
33408
|
[postToParent2]
|
|
33007
33409
|
);
|
|
33008
|
-
const handleMediaFadeOutComplete = (0,
|
|
33410
|
+
const handleMediaFadeOutComplete = (0, import_react24.useCallback)((key) => {
|
|
33009
33411
|
setUploadingRects((prev) => {
|
|
33010
33412
|
if (!(key in prev)) return prev;
|
|
33011
33413
|
const next = { ...prev };
|
|
@@ -33013,7 +33415,7 @@ function OhhwellsBridge() {
|
|
|
33013
33415
|
return next;
|
|
33014
33416
|
});
|
|
33015
33417
|
}, []);
|
|
33016
|
-
const handleVideoSettingsChange = (0,
|
|
33418
|
+
const handleVideoSettingsChange = (0, import_react24.useCallback)(
|
|
33017
33419
|
(key, settings) => {
|
|
33018
33420
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
33019
33421
|
const video = getVideoEl2(el);
|
|
@@ -33727,6 +34129,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33727
34129
|
hasMountedContentNodes,
|
|
33728
34130
|
indexCollectionItems,
|
|
33729
34131
|
insertFooterHours,
|
|
34132
|
+
isDeadPageHref,
|
|
33730
34133
|
isEditSessionActive,
|
|
33731
34134
|
isPlainLeftClick,
|
|
33732
34135
|
isRenderableFooterTree,
|
|
@@ -33738,6 +34141,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33738
34141
|
parseAiFooterState,
|
|
33739
34142
|
parseAiSectionsState,
|
|
33740
34143
|
parseTarget,
|
|
34144
|
+
planBuildPageSync,
|
|
33741
34145
|
recordOverriddenPaths,
|
|
33742
34146
|
releaseTemplateLogoIfReplaced,
|
|
33743
34147
|
removeFooterBlock,
|