@ohhwells/bridge 0.1.164 → 0.1.166-next.442
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 +1785 -1268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -1
- package/dist/index.d.ts +68 -1
- package/dist/index.js +1425 -896
- 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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React12, { useCallback as useCallback12, useEffect as
|
|
4
|
+
import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
|
|
5
5
|
import { createRoot as createRoot3 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync3 } from "react-dom";
|
|
7
7
|
|
|
@@ -840,6 +840,10 @@ function useOhwCarousel(key, initial) {
|
|
|
840
840
|
if (Array.isArray(detail?.images)) setImages(detail.images);
|
|
841
841
|
};
|
|
842
842
|
el.addEventListener(CAROUSEL_EVENT, onChange);
|
|
843
|
+
const pending = parseSlides(el.getAttribute(CAROUSEL_VALUE_ATTR));
|
|
844
|
+
if (pending.length > 0) {
|
|
845
|
+
setImages((prev) => JSON.stringify(prev) === JSON.stringify(pending) ? prev : pending);
|
|
846
|
+
}
|
|
843
847
|
return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
|
|
844
848
|
}, [key]);
|
|
845
849
|
const bind = {
|
|
@@ -1094,21 +1098,21 @@ function chromeFrom(sample) {
|
|
|
1094
1098
|
};
|
|
1095
1099
|
}
|
|
1096
1100
|
function filledPrimary(seed) {
|
|
1097
|
-
const
|
|
1098
|
-
const luminance = relativeLuminance(
|
|
1101
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1102
|
+
const luminance = relativeLuminance(paint2);
|
|
1099
1103
|
return {
|
|
1100
|
-
background: toCss({ ...
|
|
1104
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1101
1105
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1102
1106
|
borderColor: TRANSPARENT,
|
|
1103
1107
|
borderWidth: "0px"
|
|
1104
1108
|
};
|
|
1105
1109
|
}
|
|
1106
1110
|
function generatedSecondary(primary) {
|
|
1107
|
-
const
|
|
1111
|
+
const paint2 = accentColor(primary);
|
|
1108
1112
|
return {
|
|
1109
1113
|
background: TRANSPARENT,
|
|
1110
|
-
color:
|
|
1111
|
-
borderColor:
|
|
1114
|
+
color: paint2,
|
|
1115
|
+
borderColor: paint2,
|
|
1112
1116
|
borderWidth: "1px"
|
|
1113
1117
|
};
|
|
1114
1118
|
}
|
|
@@ -1121,9 +1125,9 @@ function generatedGhost(primary) {
|
|
|
1121
1125
|
};
|
|
1122
1126
|
}
|
|
1123
1127
|
function normalizeOutlineChrome(outline, primary) {
|
|
1124
|
-
const
|
|
1128
|
+
const paint2 = accentColor(primary);
|
|
1125
1129
|
const text = parseColor(outline.color);
|
|
1126
|
-
const paintRgb = parseColor(
|
|
1130
|
+
const paintRgb = parseColor(paint2);
|
|
1127
1131
|
const primaryLabel = parseColor(primary.color);
|
|
1128
1132
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1129
1133
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1132,8 +1136,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1132
1136
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1133
1137
|
return {
|
|
1134
1138
|
...outline,
|
|
1135
|
-
color:
|
|
1136
|
-
borderColor: hasBorder ?
|
|
1139
|
+
color: paint2,
|
|
1140
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1137
1141
|
};
|
|
1138
1142
|
}
|
|
1139
1143
|
function generateButtonVariants(samples) {
|
|
@@ -2524,6 +2528,14 @@ function socialHrefKey(item) {
|
|
|
2524
2528
|
function socialIconKey(item) {
|
|
2525
2529
|
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
2526
2530
|
}
|
|
2531
|
+
function pendingIconKey(item) {
|
|
2532
|
+
const existing = socialIconKey(item);
|
|
2533
|
+
if (existing) return existing;
|
|
2534
|
+
const base = socialHrefKey(item)?.replace(/-href$/, "");
|
|
2535
|
+
if (!base) return null;
|
|
2536
|
+
const taken = item.ownerDocument.querySelector(`[data-ohw-key="${base}"]`);
|
|
2537
|
+
return taken && taken !== item ? `${base}-icon` : base;
|
|
2538
|
+
}
|
|
2527
2539
|
var SOCIAL_PLATFORM_LABELS = {
|
|
2528
2540
|
instagram: "Instagram",
|
|
2529
2541
|
facebook: "Facebook",
|
|
@@ -2721,9 +2733,9 @@ function reconcileSocialsFromContent(content, root = document) {
|
|
|
2721
2733
|
listSocialsRows(root).forEach((row) => {
|
|
2722
2734
|
const rowDisplay = socialsDisplayFor(row, content);
|
|
2723
2735
|
listSocialItems(row).forEach((item) => {
|
|
2724
|
-
const key =
|
|
2736
|
+
const key = pendingIconKey(item);
|
|
2725
2737
|
const stored2 = key ? content[key] : void 0;
|
|
2726
|
-
if (!stored2?.trim()) return;
|
|
2738
|
+
if (!stored2?.trim().startsWith("<")) return;
|
|
2727
2739
|
const existing = item.querySelector(ICON_SELECTOR);
|
|
2728
2740
|
if (existing && existing.innerHTML.trim() && !existing.hasAttribute(SOCIALS_ICON_PLACEHOLDER_ATTR)) return;
|
|
2729
2741
|
ensureIconSlot(item);
|
|
@@ -2983,8 +2995,7 @@ function ensureIconSlot(item) {
|
|
|
2983
2995
|
const adopted = adoptAsIconSlot(drawn, base);
|
|
2984
2996
|
if (adopted) return adopted;
|
|
2985
2997
|
}
|
|
2986
|
-
const
|
|
2987
|
-
const iconKey = taken && taken !== item ? `${base}-icon` : base;
|
|
2998
|
+
const iconKey = pendingIconKey(item) ?? base;
|
|
2988
2999
|
const slot = document.createElement("span");
|
|
2989
3000
|
slot.setAttribute("data-ohw-key", iconKey);
|
|
2990
3001
|
slot.setAttribute("data-ohw-editable", "icon");
|
|
@@ -3496,11 +3507,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
|
|
|
3496
3507
|
container.appendChild(column);
|
|
3497
3508
|
return { column, firstLink };
|
|
3498
3509
|
}
|
|
3499
|
-
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL,
|
|
3510
|
+
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
|
|
3500
3511
|
if (!canAddFooterColumn()) {
|
|
3501
3512
|
throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
|
|
3502
3513
|
}
|
|
3503
|
-
const resolvedHref =
|
|
3514
|
+
const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
|
|
3504
3515
|
const colIndex = getNextFooterColumnIndex();
|
|
3505
3516
|
const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
|
|
3506
3517
|
if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
|
|
@@ -3879,8 +3890,8 @@ function duplicateFooterItem(sourceAnchor) {
|
|
|
3879
3890
|
const column = findFooterColumnForLink(sourceAnchor);
|
|
3880
3891
|
if (!column) return null;
|
|
3881
3892
|
const href = getLinkHref(sourceAnchor);
|
|
3882
|
-
const
|
|
3883
|
-
const label = (
|
|
3893
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
3894
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
3884
3895
|
return insertFooterItem(column, href || "/", label, sourceAnchor);
|
|
3885
3896
|
}
|
|
3886
3897
|
function footerLabelKeyFromHrefKey(hrefKey) {
|
|
@@ -3890,8 +3901,8 @@ function deleteFooterItem(sourceAnchor) {
|
|
|
3890
3901
|
if (!isFooterLinkAnchor(sourceAnchor)) return null;
|
|
3891
3902
|
const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
3892
3903
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
|
|
3893
|
-
const
|
|
3894
|
-
const label = (
|
|
3904
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
3905
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
3895
3906
|
const labelKey = footerLabelKeyFromHrefKey(hrefKey);
|
|
3896
3907
|
const previousOrder = getFooterOrderFromDom();
|
|
3897
3908
|
const previousOrderJson = JSON.stringify(previousOrder);
|
|
@@ -4859,8 +4870,8 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4859
4870
|
const mapped = keyMap.get(oldHrefKey);
|
|
4860
4871
|
if (!mapped) return;
|
|
4861
4872
|
el.setAttribute("data-ohw-href-key", mapped.hrefKey);
|
|
4862
|
-
const
|
|
4863
|
-
if (
|
|
4873
|
+
const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
|
|
4874
|
+
if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
|
|
4864
4875
|
};
|
|
4865
4876
|
if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
|
|
4866
4877
|
root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
|
|
@@ -4868,10 +4879,10 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4868
4879
|
function readNavLinkSnapshot(hrefKey) {
|
|
4869
4880
|
const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
4870
4881
|
if (!el) return { href: "/", label: "Untitled" };
|
|
4871
|
-
const
|
|
4882
|
+
const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
|
|
4872
4883
|
return {
|
|
4873
4884
|
href: getLinkHref2(el),
|
|
4874
|
-
label: (
|
|
4885
|
+
label: (labelEl2?.textContent ?? "").trim() || "Untitled"
|
|
4875
4886
|
};
|
|
4876
4887
|
}
|
|
4877
4888
|
function findClonedNavAnchor(unit, hrefKey) {
|
|
@@ -5045,8 +5056,8 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5045
5056
|
if (!isNavbarLinkItem(sourceAnchor)) return null;
|
|
5046
5057
|
const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
5047
5058
|
if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
|
|
5048
|
-
const
|
|
5049
|
-
const label = (
|
|
5059
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
5060
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
5050
5061
|
const previousForest = getNavForestFromDom();
|
|
5051
5062
|
const previousOrderJson = serializeNavOrder(previousForest);
|
|
5052
5063
|
const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
|
|
@@ -6421,6 +6432,24 @@ function deleteSectionFromState(state, sectionId) {
|
|
|
6421
6432
|
if (removed.includes(sectionId)) return state;
|
|
6422
6433
|
return { ...state, v: 1, sections: state.sections, removed: [...removed, sectionId] };
|
|
6423
6434
|
}
|
|
6435
|
+
function moveSectionInState(state, sectionId, targetPath) {
|
|
6436
|
+
const entry = state.sections.find((section) => section.id === sectionId);
|
|
6437
|
+
if (!entry) return null;
|
|
6438
|
+
const moved = {
|
|
6439
|
+
id: entry.id,
|
|
6440
|
+
label: entry.label,
|
|
6441
|
+
path: targetPath,
|
|
6442
|
+
afterSection: null,
|
|
6443
|
+
tree: entry.tree,
|
|
6444
|
+
media: entry.media,
|
|
6445
|
+
...entry.brand ? { brand: entry.brand } : {}
|
|
6446
|
+
};
|
|
6447
|
+
return {
|
|
6448
|
+
...state,
|
|
6449
|
+
v: 1,
|
|
6450
|
+
sections: state.sections.map((section) => section.id === sectionId ? moved : section)
|
|
6451
|
+
};
|
|
6452
|
+
}
|
|
6424
6453
|
function reapRemovedAiSections(state, store, removedIds, excludeIds = /* @__PURE__ */ new Set()) {
|
|
6425
6454
|
const generated = new Set(state.sections.map((entry) => entry.id));
|
|
6426
6455
|
const reapedIds = [...new Set(removedIds)].filter((id) => generated.has(id) && !excludeIds.has(id));
|
|
@@ -6649,6 +6678,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6649
6678
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6650
6679
|
return target ? pricingFeatureList(target).length : 0;
|
|
6651
6680
|
}
|
|
6681
|
+
function prevailingFeatureIcon(features) {
|
|
6682
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6683
|
+
for (const row of features) {
|
|
6684
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6685
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6686
|
+
entry.count += 1;
|
|
6687
|
+
counts.set(key, entry);
|
|
6688
|
+
}
|
|
6689
|
+
let best = null;
|
|
6690
|
+
for (const entry of counts.values()) {
|
|
6691
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6692
|
+
}
|
|
6693
|
+
if (!best) return {};
|
|
6694
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6695
|
+
}
|
|
6652
6696
|
function addPricingCardFeature(tree, index, text) {
|
|
6653
6697
|
return withPricingCollection(tree, (collection) => {
|
|
6654
6698
|
const children = collection.children;
|
|
@@ -6657,7 +6701,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6657
6701
|
const features = pricingFeatureList(target);
|
|
6658
6702
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6659
6703
|
target.slots = target.slots ?? {};
|
|
6660
|
-
target.slots.features = [...features, { text }];
|
|
6704
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6661
6705
|
return true;
|
|
6662
6706
|
});
|
|
6663
6707
|
}
|
|
@@ -7301,6 +7345,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7301
7345
|
);
|
|
7302
7346
|
}
|
|
7303
7347
|
|
|
7348
|
+
// src/lib/youtube.ts
|
|
7349
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7350
|
+
function extractYouTubeId(input) {
|
|
7351
|
+
const trimmed = input.trim();
|
|
7352
|
+
if (!trimmed) return null;
|
|
7353
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7354
|
+
let url;
|
|
7355
|
+
try {
|
|
7356
|
+
url = new URL(trimmed);
|
|
7357
|
+
} catch {
|
|
7358
|
+
return null;
|
|
7359
|
+
}
|
|
7360
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7361
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7362
|
+
return null;
|
|
7363
|
+
}
|
|
7364
|
+
let candidate = null;
|
|
7365
|
+
if (host === "youtu.be") {
|
|
7366
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7367
|
+
} else if (url.pathname === "/watch") {
|
|
7368
|
+
candidate = url.searchParams.get("v");
|
|
7369
|
+
} else {
|
|
7370
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7371
|
+
candidate = match ? match[1] : null;
|
|
7372
|
+
}
|
|
7373
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7376
|
+
// src/lib/section-embed.ts
|
|
7377
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7378
|
+
function readStoredEmbed(value) {
|
|
7379
|
+
if (value.startsWith("start\n")) {
|
|
7380
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7381
|
+
}
|
|
7382
|
+
return { raw: value, at: "end" };
|
|
7383
|
+
}
|
|
7384
|
+
function embedFrameSrc(value) {
|
|
7385
|
+
const videoId = extractYouTubeId(value);
|
|
7386
|
+
if (videoId) {
|
|
7387
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7388
|
+
}
|
|
7389
|
+
let url;
|
|
7390
|
+
try {
|
|
7391
|
+
url = new URL(value);
|
|
7392
|
+
} catch {
|
|
7393
|
+
return null;
|
|
7394
|
+
}
|
|
7395
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7396
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7397
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7398
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7399
|
+
return { src, title: "Map" };
|
|
7400
|
+
}
|
|
7401
|
+
if (host === "maps.app.goo.gl") {
|
|
7402
|
+
return { src: value, title: "Map" };
|
|
7403
|
+
}
|
|
7404
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7405
|
+
return { src: value, title: "Calendar" };
|
|
7406
|
+
}
|
|
7407
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7408
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7409
|
+
}
|
|
7410
|
+
if (host === "forms.gle") {
|
|
7411
|
+
return { src: value, title: "Form" };
|
|
7412
|
+
}
|
|
7413
|
+
return null;
|
|
7414
|
+
}
|
|
7415
|
+
function place(section, box, at) {
|
|
7416
|
+
if (at === "start") {
|
|
7417
|
+
section.insertBefore(box, section.firstChild);
|
|
7418
|
+
return;
|
|
7419
|
+
}
|
|
7420
|
+
section.appendChild(box);
|
|
7421
|
+
}
|
|
7422
|
+
function paint(section, key, src, title, at) {
|
|
7423
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7424
|
+
const frame = existing?.querySelector("iframe");
|
|
7425
|
+
if (existing && frame) {
|
|
7426
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7427
|
+
frame.title = title;
|
|
7428
|
+
place(section, existing, at);
|
|
7429
|
+
return;
|
|
7430
|
+
}
|
|
7431
|
+
existing?.remove();
|
|
7432
|
+
const box = document.createElement("div");
|
|
7433
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7434
|
+
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;";
|
|
7435
|
+
const frameWrap = document.createElement("div");
|
|
7436
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7437
|
+
const iframe = document.createElement("iframe");
|
|
7438
|
+
iframe.src = src;
|
|
7439
|
+
iframe.title = title;
|
|
7440
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7441
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7442
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7443
|
+
frameWrap.appendChild(iframe);
|
|
7444
|
+
box.appendChild(frameWrap);
|
|
7445
|
+
place(section, box, at);
|
|
7446
|
+
}
|
|
7447
|
+
function applySectionEmbeds(content) {
|
|
7448
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7449
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7450
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7451
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7452
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7453
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7454
|
+
if (!section || !stored || !frame) {
|
|
7455
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7456
|
+
continue;
|
|
7457
|
+
}
|
|
7458
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7461
|
+
|
|
7304
7462
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7305
7463
|
import { flushSync } from "react-dom";
|
|
7306
7464
|
import { createRoot } from "react-dom/client";
|
|
@@ -7874,7 +8032,7 @@ var AI_MOBILE_CSS = [
|
|
|
7874
8032
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7875
8033
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7876
8034
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
7877
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8035
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7878
8036
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7879
8037
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7880
8038
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -7890,8 +8048,10 @@ var AI_MOBILE_CSS = [
|
|
|
7890
8048
|
"[data-ai-section]{overflow-x:hidden}",
|
|
7891
8049
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
7892
8050
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
7893
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
7894
|
-
|
|
8051
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8052
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8053
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8054
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
7895
8055
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
7896
8056
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
7897
8057
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8096,6 +8256,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8096
8256
|
function textAttrs(ctx, path) {
|
|
8097
8257
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8098
8258
|
}
|
|
8259
|
+
var AI_RESPONSIVE_CSS = [
|
|
8260
|
+
"@media (max-width: 960px) {",
|
|
8261
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8262
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8263
|
+
"}",
|
|
8264
|
+
"@media (max-width: 640px) {",
|
|
8265
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8266
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8267
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8268
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8269
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8270
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8271
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8272
|
+
// layered text used to be.
|
|
8273
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8274
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8275
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8276
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8277
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8278
|
+
// other rule had already been taught to stand down.
|
|
8279
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8280
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8281
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8282
|
+
"}"
|
|
8283
|
+
].join("\n");
|
|
8099
8284
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8100
8285
|
function MediaBox({
|
|
8101
8286
|
refValue,
|
|
@@ -8150,7 +8335,7 @@ function MediaBox({
|
|
|
8150
8335
|
position: fill ? "absolute" : void 0,
|
|
8151
8336
|
inset: fill ? 0 : void 0,
|
|
8152
8337
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8153
|
-
height: fill ? "100%" : void 0,
|
|
8338
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8154
8339
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8155
8340
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8156
8341
|
borderRadius: radius,
|
|
@@ -9646,7 +9831,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9646
9831
|
return /* @__PURE__ */ jsx(
|
|
9647
9832
|
"div",
|
|
9648
9833
|
{
|
|
9649
|
-
"data-ai-grid":
|
|
9834
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9650
9835
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9651
9836
|
style: {
|
|
9652
9837
|
display: "grid",
|
|
@@ -9948,7 +10133,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
9948
10133
|
},
|
|
9949
10134
|
children: [
|
|
9950
10135
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
9951
|
-
// The section's `data-ai-
|
|
10136
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
9952
10137
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
9953
10138
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
9954
10139
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10367,6 +10552,7 @@ function AiTreeRenderer({
|
|
|
10367
10552
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10368
10553
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10369
10554
|
...bgAttrs,
|
|
10555
|
+
"data-ai-responsive": "",
|
|
10370
10556
|
style: {
|
|
10371
10557
|
position: "relative",
|
|
10372
10558
|
padding: `${padCss} 0`,
|
|
@@ -10380,12 +10566,13 @@ function AiTreeRenderer({
|
|
|
10380
10566
|
...fillHeight ? { display: "grid" } : {}
|
|
10381
10567
|
},
|
|
10382
10568
|
children: [
|
|
10383
|
-
|
|
10569
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10384
10570
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
10571
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10385
10572
|
/* @__PURE__ */ jsx(
|
|
10386
10573
|
"div",
|
|
10387
10574
|
{
|
|
10388
|
-
"data-ai-
|
|
10575
|
+
"data-ai-section-inner": "",
|
|
10389
10576
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10390
10577
|
style: {
|
|
10391
10578
|
position: "relative",
|
|
@@ -10402,7 +10589,7 @@ function AiTreeRenderer({
|
|
|
10402
10589
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10403
10590
|
"div",
|
|
10404
10591
|
{
|
|
10405
|
-
"data-ai-
|
|
10592
|
+
"data-ai-columns": "",
|
|
10406
10593
|
style: {
|
|
10407
10594
|
display: "grid",
|
|
10408
10595
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11064,9 +11251,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11064
11251
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11065
11252
|
continue;
|
|
11066
11253
|
}
|
|
11067
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11068
11254
|
let container = existing?.container;
|
|
11255
|
+
let isNewMount = false;
|
|
11069
11256
|
if (!container || !container.isConnected) {
|
|
11257
|
+
isNewMount = true;
|
|
11070
11258
|
existing?.root.unmount();
|
|
11071
11259
|
container?.remove();
|
|
11072
11260
|
container = document.createElement("div");
|
|
@@ -11404,6 +11592,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11404
11592
|
return 3;
|
|
11405
11593
|
}
|
|
11406
11594
|
}
|
|
11595
|
+
function readLiveSocialItems() {
|
|
11596
|
+
const root = getFooterRoot();
|
|
11597
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11598
|
+
if (!row) return [];
|
|
11599
|
+
const items = [];
|
|
11600
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11601
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11602
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11603
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11604
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11605
|
+
items.push({ platform, href });
|
|
11606
|
+
}
|
|
11607
|
+
return items;
|
|
11608
|
+
}
|
|
11609
|
+
function syncSocialRowsFromDom(tree) {
|
|
11610
|
+
const root = getFooterRoot();
|
|
11611
|
+
if (!root) return;
|
|
11612
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11613
|
+
const live = readLiveSocialItems();
|
|
11614
|
+
if (row && live.length === 0) return;
|
|
11615
|
+
for (const col of tree.columns) {
|
|
11616
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11617
|
+
if (block.type !== "social-row") return [block];
|
|
11618
|
+
if (!row) return [];
|
|
11619
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11620
|
+
});
|
|
11621
|
+
}
|
|
11622
|
+
}
|
|
11407
11623
|
function collectBrandBlocks(tree) {
|
|
11408
11624
|
const brand = [];
|
|
11409
11625
|
for (const col of tree.columns) {
|
|
@@ -11649,12 +11865,13 @@ function textOf2(el) {
|
|
|
11649
11865
|
}
|
|
11650
11866
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11651
11867
|
const next = cloneTree(tree);
|
|
11868
|
+
syncSocialRowsFromDom(next);
|
|
11652
11869
|
const domCols = listFooterColumns().map((col) => {
|
|
11653
11870
|
const heading = getFooterColumnHeadingEl(col);
|
|
11654
11871
|
const title = heading ? textOf2(heading) : void 0;
|
|
11655
11872
|
const items = listFooterLinksInColumn(col).map((anchor) => {
|
|
11656
|
-
const
|
|
11657
|
-
const label = textOf2(
|
|
11873
|
+
const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11874
|
+
const label = textOf2(labelEl2) || textOf2(anchor);
|
|
11658
11875
|
const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
|
|
11659
11876
|
return label ? { label, href: href || "home" } : null;
|
|
11660
11877
|
}).filter((x) => Boolean(x));
|
|
@@ -12121,8 +12338,116 @@ function useHashLinkScroll(isEditMode) {
|
|
|
12121
12338
|
}, [isEditMode]);
|
|
12122
12339
|
}
|
|
12123
12340
|
|
|
12341
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12342
|
+
import { useEffect as useEffect5 } from "react";
|
|
12343
|
+
|
|
12344
|
+
// src/lib/strip-placeholders.ts
|
|
12345
|
+
var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
12346
|
+
var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
|
|
12347
|
+
var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
|
|
12348
|
+
var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
|
|
12349
|
+
var HIDDEN_ATTR2 = "data-ohw-placeholder-hidden";
|
|
12350
|
+
function hasPlaceholder(text) {
|
|
12351
|
+
return HAS_PLACEHOLDER_RE.test(text);
|
|
12352
|
+
}
|
|
12353
|
+
function stripPlaceholderText(text) {
|
|
12354
|
+
if (!hasPlaceholder(text)) return text;
|
|
12355
|
+
const lead = text.match(/^\s*/)?.[0] ?? "";
|
|
12356
|
+
const trail = lead.length === text.length ? "" : text.match(/\s*$/)?.[0] ?? "";
|
|
12357
|
+
const body = text.slice(lead.length, text.length - trail.length).replace(PLACEHOLDER_RE, "").replace(/\(\s*\)|\[\s*\]/g, "").replace(/[ \t]{2,}/g, " ").replace(/[ \t]+([.,;:!?])/g, "$1").trim();
|
|
12358
|
+
return body ? `${lead}${body}${trail}` : lead || trail ? " " : "";
|
|
12359
|
+
}
|
|
12360
|
+
function skipped(el) {
|
|
12361
|
+
for (let node = el; node; node = node.parentElement) {
|
|
12362
|
+
if (SKIPPED_TAGS.has(node.tagName)) return true;
|
|
12363
|
+
}
|
|
12364
|
+
return false;
|
|
12365
|
+
}
|
|
12366
|
+
function hideIfEmptied(el) {
|
|
12367
|
+
const control = el?.closest("a, button");
|
|
12368
|
+
if (!control || control.hasAttribute(HIDDEN_ATTR2)) return;
|
|
12369
|
+
if ((control.textContent ?? "").trim()) return;
|
|
12370
|
+
if (control.querySelector("img, svg, picture, video")) return;
|
|
12371
|
+
control.setAttribute(HIDDEN_ATTR2, "");
|
|
12372
|
+
control.style.display = "none";
|
|
12373
|
+
}
|
|
12374
|
+
function stripElementAttrs(el) {
|
|
12375
|
+
let changed = false;
|
|
12376
|
+
const href = el.getAttribute("href");
|
|
12377
|
+
if (href && hasPlaceholder(decodeSafely(href))) {
|
|
12378
|
+
el.removeAttribute("href");
|
|
12379
|
+
changed = true;
|
|
12380
|
+
}
|
|
12381
|
+
for (const name of TEXT_ATTRS) {
|
|
12382
|
+
const value = el.getAttribute(name);
|
|
12383
|
+
if (value && hasPlaceholder(value)) {
|
|
12384
|
+
el.setAttribute(name, stripPlaceholderText(value).trim());
|
|
12385
|
+
changed = true;
|
|
12386
|
+
}
|
|
12387
|
+
}
|
|
12388
|
+
return changed;
|
|
12389
|
+
}
|
|
12390
|
+
function decodeSafely(value) {
|
|
12391
|
+
try {
|
|
12392
|
+
return decodeURIComponent(value);
|
|
12393
|
+
} catch {
|
|
12394
|
+
return value;
|
|
12395
|
+
}
|
|
12396
|
+
}
|
|
12397
|
+
function stripPlaceholders(root) {
|
|
12398
|
+
const doc = root.ownerDocument ?? root;
|
|
12399
|
+
let changed = 0;
|
|
12400
|
+
if (root.nodeType === 3) {
|
|
12401
|
+
return stripTextNode(root) ? 1 : 0;
|
|
12402
|
+
}
|
|
12403
|
+
if (root.nodeType !== 1 && root.nodeType !== 9) return 0;
|
|
12404
|
+
const rootEl = root.nodeType === 1 ? root : root.documentElement;
|
|
12405
|
+
if (!rootEl || skipped(rootEl)) return 0;
|
|
12406
|
+
for (const el of [rootEl, ...Array.from(rootEl.querySelectorAll("[href], [alt], [title], [aria-label], [placeholder]"))]) {
|
|
12407
|
+
if (!skipped(el) && stripElementAttrs(el)) changed++;
|
|
12408
|
+
}
|
|
12409
|
+
const walker = doc.createTreeWalker(rootEl, 4);
|
|
12410
|
+
const texts = [];
|
|
12411
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
12412
|
+
if (node.nodeValue && node.nodeValue.includes("[")) texts.push(node);
|
|
12413
|
+
}
|
|
12414
|
+
for (const node of texts) {
|
|
12415
|
+
if (stripTextNode(node)) changed++;
|
|
12416
|
+
}
|
|
12417
|
+
return changed;
|
|
12418
|
+
}
|
|
12419
|
+
function stripTextNode(node) {
|
|
12420
|
+
const value = node.nodeValue ?? "";
|
|
12421
|
+
if (!value.includes("[") || !hasPlaceholder(value) || skipped(node.parentElement)) return false;
|
|
12422
|
+
node.nodeValue = stripPlaceholderText(value);
|
|
12423
|
+
hideIfEmptied(node.parentElement);
|
|
12424
|
+
return true;
|
|
12425
|
+
}
|
|
12426
|
+
|
|
12427
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12428
|
+
function usePublishedPlaceholderStrip(isEditMode) {
|
|
12429
|
+
useEffect5(() => {
|
|
12430
|
+
if (isEditMode) return;
|
|
12431
|
+
stripPlaceholders(document.body);
|
|
12432
|
+
const observer = new MutationObserver((records) => {
|
|
12433
|
+
for (const record of records) {
|
|
12434
|
+
if (record.type === "childList") record.addedNodes.forEach((node) => stripPlaceholders(node));
|
|
12435
|
+
else stripPlaceholders(record.target);
|
|
12436
|
+
}
|
|
12437
|
+
});
|
|
12438
|
+
observer.observe(document.body, {
|
|
12439
|
+
childList: true,
|
|
12440
|
+
subtree: true,
|
|
12441
|
+
characterData: true,
|
|
12442
|
+
attributes: true,
|
|
12443
|
+
attributeFilter: ["href", "alt", "title", "aria-label", "placeholder"]
|
|
12444
|
+
});
|
|
12445
|
+
return () => observer.disconnect();
|
|
12446
|
+
}, [isEditMode]);
|
|
12447
|
+
}
|
|
12448
|
+
|
|
12124
12449
|
// src/ui/SchedulingWidget.tsx
|
|
12125
|
-
import { useCallback, useEffect as
|
|
12450
|
+
import { useCallback, useEffect as useEffect6, useId, useMemo, useRef, useState as useState3 } from "react";
|
|
12126
12451
|
|
|
12127
12452
|
// src/ui/EmailCaptureModal.tsx
|
|
12128
12453
|
import { useState as useState2 } from "react";
|
|
@@ -12440,7 +12765,7 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12440
12765
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
12441
12766
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
12442
12767
|
};
|
|
12443
|
-
|
|
12768
|
+
useEffect6(() => {
|
|
12444
12769
|
const el = scrollRef.current;
|
|
12445
12770
|
if (!el) return;
|
|
12446
12771
|
updateScrollState();
|
|
@@ -12698,7 +13023,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12698
13023
|
});
|
|
12699
13024
|
}, []);
|
|
12700
13025
|
const [selectedIdx, setSelectedIdx] = useState3(0);
|
|
12701
|
-
|
|
13026
|
+
useEffect6(() => {
|
|
12702
13027
|
if (!schedule?.classes) return;
|
|
12703
13028
|
for (let i = 0; i < dates.length; i++) {
|
|
12704
13029
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -12707,7 +13032,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12707
13032
|
}
|
|
12708
13033
|
}
|
|
12709
13034
|
}, [schedule, dates]);
|
|
12710
|
-
|
|
13035
|
+
useEffect6(() => {
|
|
12711
13036
|
if (typeof window === "undefined") return;
|
|
12712
13037
|
const onVisible = () => {
|
|
12713
13038
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -12719,7 +13044,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12719
13044
|
document.removeEventListener("visibilitychange", onVisible);
|
|
12720
13045
|
};
|
|
12721
13046
|
}, [refetchLiveSchedule]);
|
|
12722
|
-
|
|
13047
|
+
useEffect6(() => {
|
|
12723
13048
|
if (typeof window === "undefined") return;
|
|
12724
13049
|
const isInEditor = window.self !== window.top;
|
|
12725
13050
|
setInEditor(isInEditor);
|
|
@@ -17256,7 +17581,7 @@ function clearSubmitError(form) {
|
|
|
17256
17581
|
if (note) note.style.display = "none";
|
|
17257
17582
|
}
|
|
17258
17583
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17259
|
-
var
|
|
17584
|
+
var HIDDEN_ATTR3 = "data-ohw-form-hidden";
|
|
17260
17585
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17261
17586
|
function formSuccessKey(formKey) {
|
|
17262
17587
|
return `${formKey}-success`;
|
|
@@ -17282,13 +17607,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17282
17607
|
Array.from(form.children).forEach((child) => {
|
|
17283
17608
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17284
17609
|
if (state === "success") {
|
|
17285
|
-
if (!child.hasAttribute(
|
|
17286
|
-
child.setAttribute(
|
|
17610
|
+
if (!child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17611
|
+
child.setAttribute(HIDDEN_ATTR3, child.style.display);
|
|
17287
17612
|
child.style.display = "none";
|
|
17288
17613
|
}
|
|
17289
|
-
} else if (child.hasAttribute(
|
|
17290
|
-
child.style.display = child.getAttribute(
|
|
17291
|
-
child.removeAttribute(
|
|
17614
|
+
} else if (child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17615
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
|
|
17616
|
+
child.removeAttribute(HIDDEN_ATTR3);
|
|
17292
17617
|
}
|
|
17293
17618
|
});
|
|
17294
17619
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17353,7 +17678,7 @@ function apiBase() {
|
|
|
17353
17678
|
function bridgeVersion() {
|
|
17354
17679
|
try {
|
|
17355
17680
|
if (true) {
|
|
17356
|
-
return "0.1.
|
|
17681
|
+
return "0.1.166-next.442";
|
|
17357
17682
|
}
|
|
17358
17683
|
} catch {
|
|
17359
17684
|
}
|
|
@@ -17367,7 +17692,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17367
17692
|
return;
|
|
17368
17693
|
}
|
|
17369
17694
|
try {
|
|
17370
|
-
const v = true ? "0.1.
|
|
17695
|
+
const v = true ? "0.1.166-next.442" : "";
|
|
17371
17696
|
if (v) {
|
|
17372
17697
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17373
17698
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18045,6 +18370,7 @@ function MediaOverlay({
|
|
|
18045
18370
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18046
18371
|
);
|
|
18047
18372
|
}, [isVideo]);
|
|
18373
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18048
18374
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18049
18375
|
const box = {
|
|
18050
18376
|
position: "fixed",
|
|
@@ -18143,11 +18469,10 @@ function MediaOverlay({
|
|
|
18143
18469
|
className: "flex items-center justify-center cursor-pointer",
|
|
18144
18470
|
style: {
|
|
18145
18471
|
...box,
|
|
18146
|
-
//
|
|
18147
|
-
//
|
|
18148
|
-
//
|
|
18149
|
-
|
|
18150
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18472
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18473
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18474
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18475
|
+
pointerEvents: "none",
|
|
18151
18476
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18152
18477
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18153
18478
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18174,17 +18499,17 @@ function MediaOverlay({
|
|
|
18174
18499
|
},
|
|
18175
18500
|
children: [
|
|
18176
18501
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18177
|
-
|
|
18502
|
+
replaceLabel
|
|
18178
18503
|
]
|
|
18179
18504
|
}
|
|
18180
18505
|
),
|
|
18181
|
-
replaceMode
|
|
18506
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18182
18507
|
Button,
|
|
18183
18508
|
{
|
|
18184
18509
|
"data-ohw-media-overlay": "",
|
|
18185
18510
|
variant: "outline",
|
|
18186
18511
|
size: "sm",
|
|
18187
|
-
"aria-label":
|
|
18512
|
+
"aria-label": replaceLabel,
|
|
18188
18513
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18189
18514
|
style: {
|
|
18190
18515
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18207,7 +18532,7 @@ function MediaOverlay({
|
|
|
18207
18532
|
},
|
|
18208
18533
|
children: [
|
|
18209
18534
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18210
|
-
replaceMode === "full" ?
|
|
18535
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18211
18536
|
]
|
|
18212
18537
|
}
|
|
18213
18538
|
)
|
|
@@ -18274,7 +18599,7 @@ function CarouselOverlay({
|
|
|
18274
18599
|
}
|
|
18275
18600
|
|
|
18276
18601
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18277
|
-
import { useCallback as useCallback2, useEffect as
|
|
18602
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useRef as useRef4, useState as useState7 } from "react";
|
|
18278
18603
|
import { Check, X } from "lucide-react";
|
|
18279
18604
|
|
|
18280
18605
|
// src/lib/ai-change-highlight.ts
|
|
@@ -18370,7 +18695,7 @@ function readRect(instanceId) {
|
|
|
18370
18695
|
}
|
|
18371
18696
|
function useLiveSectionRect(sectionId) {
|
|
18372
18697
|
const [rect, setRect] = useState7(null);
|
|
18373
|
-
|
|
18698
|
+
useEffect8(() => {
|
|
18374
18699
|
if (!sectionId) {
|
|
18375
18700
|
setRect(null);
|
|
18376
18701
|
return;
|
|
@@ -18410,7 +18735,7 @@ function readNavToggleRect() {
|
|
|
18410
18735
|
}
|
|
18411
18736
|
function useLiveNavToggleHole(active) {
|
|
18412
18737
|
const [rect, setRect] = useState7(null);
|
|
18413
|
-
|
|
18738
|
+
useEffect8(() => {
|
|
18414
18739
|
if (!active) {
|
|
18415
18740
|
setRect(null);
|
|
18416
18741
|
return;
|
|
@@ -18534,7 +18859,7 @@ function AiSectionOverlay({
|
|
|
18534
18859
|
reviewIdRef.current = reviewId;
|
|
18535
18860
|
const selectedIdRef = useRef4(null);
|
|
18536
18861
|
selectedIdRef.current = selectedId;
|
|
18537
|
-
|
|
18862
|
+
useEffect8(() => {
|
|
18538
18863
|
onSelectionChange?.(selectedId);
|
|
18539
18864
|
}, [selectedId, onSelectionChange]);
|
|
18540
18865
|
const report = useCallback2(
|
|
@@ -18560,7 +18885,7 @@ function AiSectionOverlay({
|
|
|
18560
18885
|
},
|
|
18561
18886
|
[report]
|
|
18562
18887
|
);
|
|
18563
|
-
|
|
18888
|
+
useEffect8(() => {
|
|
18564
18889
|
apiRef.current = {
|
|
18565
18890
|
selectFromElement,
|
|
18566
18891
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
@@ -18585,7 +18910,7 @@ function AiSectionOverlay({
|
|
|
18585
18910
|
apiRef.current = null;
|
|
18586
18911
|
};
|
|
18587
18912
|
}, [apiRef, selectFromElement, report]);
|
|
18588
|
-
|
|
18913
|
+
useEffect8(() => {
|
|
18589
18914
|
const onMessage = (e) => {
|
|
18590
18915
|
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
18591
18916
|
selectedIdRef.current = null;
|
|
@@ -18610,9 +18935,9 @@ function AiSectionOverlay({
|
|
|
18610
18935
|
window.addEventListener("message", onMessage);
|
|
18611
18936
|
return () => window.removeEventListener("message", onMessage);
|
|
18612
18937
|
}, [postToParent2]);
|
|
18613
|
-
|
|
18938
|
+
useEffect8(() => installAiChangeHighlight(), []);
|
|
18614
18939
|
const [hoveredId, setHoveredId] = useState7(null);
|
|
18615
|
-
|
|
18940
|
+
useEffect8(() => {
|
|
18616
18941
|
const onMove = (e) => {
|
|
18617
18942
|
const t = e.target;
|
|
18618
18943
|
if (!(t instanceof Element)) return;
|
|
@@ -18637,7 +18962,7 @@ function AiSectionOverlay({
|
|
|
18637
18962
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
18638
18963
|
};
|
|
18639
18964
|
}, []);
|
|
18640
|
-
|
|
18965
|
+
useEffect8(() => {
|
|
18641
18966
|
const onKeyDown = (e) => {
|
|
18642
18967
|
if (e.key !== "Escape") return;
|
|
18643
18968
|
if (reviewIdRef.current) return;
|
|
@@ -18661,7 +18986,7 @@ function AiSectionOverlay({
|
|
|
18661
18986
|
[postToParent2]
|
|
18662
18987
|
);
|
|
18663
18988
|
const [navDropdownForceOpen, setNavDropdownForceOpen] = useState7(false);
|
|
18664
|
-
|
|
18989
|
+
useEffect8(() => {
|
|
18665
18990
|
const update = () => {
|
|
18666
18991
|
setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
|
|
18667
18992
|
};
|
|
@@ -18680,7 +19005,7 @@ function AiSectionOverlay({
|
|
|
18680
19005
|
const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
|
|
18681
19006
|
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
18682
19007
|
const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
|
|
18683
|
-
|
|
19008
|
+
useEffect8(() => {
|
|
18684
19009
|
const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
|
|
18685
19010
|
if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
|
|
18686
19011
|
postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
|
|
@@ -18800,8 +19125,24 @@ function AiSectionOverlay({
|
|
|
18800
19125
|
}
|
|
18801
19126
|
|
|
18802
19127
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18803
|
-
import { useCallback as useCallback3, useEffect as
|
|
18804
|
-
import {
|
|
19128
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
19129
|
+
import {
|
|
19130
|
+
AlignCenter,
|
|
19131
|
+
AlignLeft,
|
|
19132
|
+
AlignRight,
|
|
19133
|
+
ArrowLeft as ArrowLeft2,
|
|
19134
|
+
ArrowRight as ArrowRight2,
|
|
19135
|
+
Check as Check2,
|
|
19136
|
+
ChevronDown as ChevronDown3,
|
|
19137
|
+
Image as ImageIcon2,
|
|
19138
|
+
ImageMinus,
|
|
19139
|
+
ImagePlus,
|
|
19140
|
+
Link as LinkIcon,
|
|
19141
|
+
Minus,
|
|
19142
|
+
Palette,
|
|
19143
|
+
Plus as Plus2,
|
|
19144
|
+
Star
|
|
19145
|
+
} from "lucide-react";
|
|
18805
19146
|
|
|
18806
19147
|
// src/lib/ai-media-strip-tree.ts
|
|
18807
19148
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -18915,14 +19256,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
18915
19256
|
return true;
|
|
18916
19257
|
});
|
|
18917
19258
|
}
|
|
18918
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
18919
|
-
return withMediaStrip(tree, (block) => {
|
|
18920
|
-
const items = block.items;
|
|
18921
|
-
if (index < 0 || index >= items.length) return false;
|
|
18922
|
-
items[index] = { ...items[index], alt };
|
|
18923
|
-
return true;
|
|
18924
|
-
});
|
|
18925
|
-
}
|
|
18926
19259
|
function setMediaStripItemLink(tree, index, link) {
|
|
18927
19260
|
return withMediaStrip(tree, (block) => {
|
|
18928
19261
|
const items = block.items;
|
|
@@ -18940,11 +19273,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
18940
19273
|
});
|
|
18941
19274
|
}
|
|
18942
19275
|
|
|
19276
|
+
// src/ui/dialog.tsx
|
|
19277
|
+
import * as React9 from "react";
|
|
19278
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19279
|
+
import { X as X2 } from "lucide-react";
|
|
19280
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19281
|
+
function Dialog2({
|
|
19282
|
+
...props
|
|
19283
|
+
}) {
|
|
19284
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19285
|
+
}
|
|
19286
|
+
function DialogPortal({
|
|
19287
|
+
...props
|
|
19288
|
+
}) {
|
|
19289
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19290
|
+
}
|
|
19291
|
+
function DialogOverlay({
|
|
19292
|
+
className,
|
|
19293
|
+
...props
|
|
19294
|
+
}) {
|
|
19295
|
+
return /* @__PURE__ */ jsx20(
|
|
19296
|
+
DialogPrimitive.Overlay,
|
|
19297
|
+
{
|
|
19298
|
+
"data-slot": "dialog-overlay",
|
|
19299
|
+
"data-ohw-link-modal-root": "",
|
|
19300
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19301
|
+
...props
|
|
19302
|
+
}
|
|
19303
|
+
);
|
|
19304
|
+
}
|
|
19305
|
+
var DialogContent = React9.forwardRef(
|
|
19306
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19307
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19308
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19309
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19310
|
+
/* @__PURE__ */ jsxs11(
|
|
19311
|
+
DialogPrimitive.Content,
|
|
19312
|
+
{
|
|
19313
|
+
ref,
|
|
19314
|
+
"data-slot": "dialog-content",
|
|
19315
|
+
className: cn(
|
|
19316
|
+
positionMode,
|
|
19317
|
+
"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",
|
|
19318
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19319
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19320
|
+
className
|
|
19321
|
+
),
|
|
19322
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19323
|
+
...props,
|
|
19324
|
+
children: [
|
|
19325
|
+
children,
|
|
19326
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19327
|
+
DialogPrimitive.Close,
|
|
19328
|
+
{
|
|
19329
|
+
type: "button",
|
|
19330
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19331
|
+
"aria-label": "Close",
|
|
19332
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19333
|
+
}
|
|
19334
|
+
) : null
|
|
19335
|
+
]
|
|
19336
|
+
}
|
|
19337
|
+
)
|
|
19338
|
+
] });
|
|
19339
|
+
}
|
|
19340
|
+
);
|
|
19341
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19342
|
+
function DialogHeader({
|
|
19343
|
+
className,
|
|
19344
|
+
...props
|
|
19345
|
+
}) {
|
|
19346
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19347
|
+
}
|
|
19348
|
+
function DialogFooter({
|
|
19349
|
+
className,
|
|
19350
|
+
...props
|
|
19351
|
+
}) {
|
|
19352
|
+
return /* @__PURE__ */ jsx20(
|
|
19353
|
+
"div",
|
|
19354
|
+
{
|
|
19355
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19356
|
+
...props
|
|
19357
|
+
}
|
|
19358
|
+
);
|
|
19359
|
+
}
|
|
19360
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19361
|
+
DialogPrimitive.Title,
|
|
19362
|
+
{
|
|
19363
|
+
ref,
|
|
19364
|
+
className: cn(
|
|
19365
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19366
|
+
className
|
|
19367
|
+
),
|
|
19368
|
+
...props
|
|
19369
|
+
}
|
|
19370
|
+
));
|
|
19371
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19372
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19373
|
+
DialogPrimitive.Description,
|
|
19374
|
+
{
|
|
19375
|
+
ref,
|
|
19376
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19377
|
+
...props
|
|
19378
|
+
}
|
|
19379
|
+
));
|
|
19380
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19381
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19382
|
+
|
|
18943
19383
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18944
|
-
import { Fragment as Fragment7, jsx as
|
|
18945
|
-
var PRIMARY3 = "#0885FE";
|
|
18946
|
-
var
|
|
18947
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19384
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19385
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19386
|
+
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]";
|
|
18948
19387
|
function findMediaStripItemElement(sectionId, index) {
|
|
18949
19388
|
const sectionEl = findByInstanceId(sectionId);
|
|
18950
19389
|
if (!sectionEl) return null;
|
|
@@ -18954,22 +19393,43 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
18954
19393
|
}
|
|
18955
19394
|
return null;
|
|
18956
19395
|
}
|
|
18957
|
-
function
|
|
18958
|
-
|
|
19396
|
+
function itemRefFromTarget(target) {
|
|
19397
|
+
if (!(target instanceof Element)) return null;
|
|
19398
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19399
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19400
|
+
if (!itemEl) return null;
|
|
19401
|
+
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19402
|
+
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19403
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19404
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19405
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19406
|
+
return { sectionId, index };
|
|
19407
|
+
}
|
|
19408
|
+
function sameRef(a, b) {
|
|
19409
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19410
|
+
}
|
|
19411
|
+
function rectOf(el) {
|
|
18959
19412
|
if (!el) return null;
|
|
18960
19413
|
const r2 = el.getBoundingClientRect();
|
|
18961
19414
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
18962
19415
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18963
19416
|
}
|
|
18964
|
-
function
|
|
19417
|
+
function readRect2(ref) {
|
|
19418
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19419
|
+
}
|
|
19420
|
+
function readStripRect(ref) {
|
|
19421
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19422
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19423
|
+
}
|
|
19424
|
+
function useLiveItemRect(ref, strip = false) {
|
|
18965
19425
|
const [rect, setRect] = useState8(null);
|
|
18966
|
-
|
|
19426
|
+
useEffect9(() => {
|
|
18967
19427
|
if (!ref) {
|
|
18968
19428
|
setRect(null);
|
|
18969
19429
|
return;
|
|
18970
19430
|
}
|
|
18971
19431
|
const update = () => {
|
|
18972
|
-
const next = readRect2(ref);
|
|
19432
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
18973
19433
|
setRect(
|
|
18974
19434
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
18975
19435
|
);
|
|
@@ -18984,9 +19444,49 @@ function useLiveItemRect(ref) {
|
|
|
18984
19444
|
window.removeEventListener("resize", update);
|
|
18985
19445
|
clearInterval(interval);
|
|
18986
19446
|
};
|
|
18987
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19447
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
18988
19448
|
return rect;
|
|
18989
19449
|
}
|
|
19450
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19451
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19452
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19453
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19454
|
+
const slotRef = useRef5(null);
|
|
19455
|
+
const [shift, setShift] = useState8(0);
|
|
19456
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19457
|
+
useLayoutEffect4(() => {
|
|
19458
|
+
const slot = slotRef.current;
|
|
19459
|
+
if (!slot) return;
|
|
19460
|
+
const clamp = () => {
|
|
19461
|
+
const w = slot.offsetWidth;
|
|
19462
|
+
if (w <= 0) return;
|
|
19463
|
+
const half = w / 2;
|
|
19464
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19465
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19466
|
+
};
|
|
19467
|
+
clamp();
|
|
19468
|
+
const ro = new ResizeObserver(clamp);
|
|
19469
|
+
ro.observe(slot);
|
|
19470
|
+
return () => ro.disconnect();
|
|
19471
|
+
}, [centerX, children]);
|
|
19472
|
+
const mobile = window.innerWidth <= 480;
|
|
19473
|
+
return /* @__PURE__ */ jsx21(
|
|
19474
|
+
"div",
|
|
19475
|
+
{
|
|
19476
|
+
ref: slotRef,
|
|
19477
|
+
"data-ohw-bridge": "",
|
|
19478
|
+
"data-ohw-item-interaction": "",
|
|
19479
|
+
className: "pointer-events-auto fixed",
|
|
19480
|
+
style: {
|
|
19481
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19482
|
+
left: centerX + shift,
|
|
19483
|
+
transform: "translate(-50%, -100%)",
|
|
19484
|
+
zIndex: 2147483645
|
|
19485
|
+
},
|
|
19486
|
+
children
|
|
19487
|
+
}
|
|
19488
|
+
);
|
|
19489
|
+
}
|
|
18990
19490
|
function requestValidateTree(postToParent2, tree) {
|
|
18991
19491
|
return new Promise((resolve) => {
|
|
18992
19492
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19023,116 +19523,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19023
19523
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19024
19524
|
});
|
|
19025
19525
|
}
|
|
19026
|
-
function
|
|
19526
|
+
function ToolbarAction({
|
|
19027
19527
|
label,
|
|
19028
19528
|
onClick,
|
|
19029
|
-
disabled,
|
|
19030
|
-
active
|
|
19529
|
+
disabled = false,
|
|
19530
|
+
active = false,
|
|
19531
|
+
children
|
|
19031
19532
|
}) {
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
{
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
disabled,
|
|
19038
|
-
style: {
|
|
19039
|
-
height: 28,
|
|
19040
|
-
padding: "0 10px",
|
|
19041
|
-
display: "inline-flex",
|
|
19042
|
-
alignItems: "center",
|
|
19043
|
-
gap: 4,
|
|
19044
|
-
borderRadius: 999,
|
|
19045
|
-
border: "none",
|
|
19046
|
-
cursor: disabled ? "default" : "pointer",
|
|
19047
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19048
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19049
|
-
opacity: disabled ? 0.4 : 1,
|
|
19050
|
-
fontSize: 12,
|
|
19051
|
-
lineHeight: "16px",
|
|
19052
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19053
|
-
whiteSpace: "nowrap",
|
|
19054
|
-
flex: "0 0 auto"
|
|
19055
|
-
},
|
|
19056
|
-
children: label
|
|
19057
|
-
}
|
|
19058
|
-
);
|
|
19533
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19534
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19535
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19536
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19537
|
+
] });
|
|
19059
19538
|
}
|
|
19060
|
-
function
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
},
|
|
19090
|
-
children: "Alt"
|
|
19091
|
-
}
|
|
19092
|
-
),
|
|
19093
|
-
/* @__PURE__ */ jsx20(
|
|
19094
|
-
"input",
|
|
19539
|
+
function ToolbarSeparator() {
|
|
19540
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19541
|
+
}
|
|
19542
|
+
function OptionMenu({
|
|
19543
|
+
label,
|
|
19544
|
+
value,
|
|
19545
|
+
options,
|
|
19546
|
+
onChange
|
|
19547
|
+
}) {
|
|
19548
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19549
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19550
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19551
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19552
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19553
|
+
"button",
|
|
19554
|
+
{
|
|
19555
|
+
type: "button",
|
|
19556
|
+
"aria-label": label,
|
|
19557
|
+
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",
|
|
19558
|
+
children: [
|
|
19559
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19560
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19561
|
+
]
|
|
19562
|
+
}
|
|
19563
|
+
) }),
|
|
19564
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19565
|
+
const selected = option.value === value;
|
|
19566
|
+
return /* @__PURE__ */ jsxs12(
|
|
19567
|
+
DropdownMenuItem,
|
|
19095
19568
|
{
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
"aria-label": "Image alt text",
|
|
19111
|
-
style: {
|
|
19112
|
-
flex: 1,
|
|
19113
|
-
minWidth: 0,
|
|
19114
|
-
border: "none",
|
|
19115
|
-
outline: "none",
|
|
19116
|
-
background: "transparent",
|
|
19117
|
-
fontSize: 12,
|
|
19118
|
-
lineHeight: "16px",
|
|
19119
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19120
|
-
color: "#1f2937"
|
|
19121
|
-
}
|
|
19122
|
-
}
|
|
19123
|
-
)
|
|
19124
|
-
]
|
|
19125
|
-
}
|
|
19126
|
-
);
|
|
19569
|
+
role: "menuitemradio",
|
|
19570
|
+
"aria-checked": selected,
|
|
19571
|
+
onSelect: () => onChange(option.value),
|
|
19572
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19573
|
+
children: [
|
|
19574
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19575
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19576
|
+
]
|
|
19577
|
+
},
|
|
19578
|
+
option.value
|
|
19579
|
+
);
|
|
19580
|
+
}) })
|
|
19581
|
+
] })
|
|
19582
|
+
] });
|
|
19127
19583
|
}
|
|
19128
19584
|
var VARIANTS = [
|
|
19129
19585
|
{ value: "logos", label: "Logos" },
|
|
19130
19586
|
{ value: "reel", label: "Reel" }
|
|
19131
19587
|
];
|
|
19132
19588
|
var ALIGNS = [
|
|
19133
|
-
{ value: "left", label: "
|
|
19134
|
-
{ value: "center", label: "
|
|
19135
|
-
{ value: "right", label: "
|
|
19589
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19590
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19591
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19136
19592
|
];
|
|
19137
19593
|
var HOVERS = [
|
|
19138
19594
|
{ value: "none", label: "None" },
|
|
@@ -19140,104 +19596,104 @@ var HOVERS = [
|
|
|
19140
19596
|
{ value: "zoom", label: "Zoom" },
|
|
19141
19597
|
{ value: "fade", label: "Fade" }
|
|
19142
19598
|
];
|
|
19143
|
-
var TREATMENTS = [
|
|
19144
|
-
{ value: "color", label: "Color" },
|
|
19145
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19146
|
-
];
|
|
19147
19599
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19148
|
-
function
|
|
19149
|
-
|
|
19600
|
+
function LinkModal({
|
|
19601
|
+
href,
|
|
19602
|
+
linkTarget,
|
|
19603
|
+
onClose,
|
|
19604
|
+
onSave
|
|
19605
|
+
}) {
|
|
19606
|
+
const [draft, setDraft] = useState8(href);
|
|
19607
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19150
19608
|
const [invalid, setInvalid] = useState8(false);
|
|
19151
|
-
|
|
19152
|
-
setDraft(value);
|
|
19153
|
-
setInvalid(false);
|
|
19154
|
-
}, [value]);
|
|
19155
|
-
const commit2 = () => {
|
|
19609
|
+
const save = () => {
|
|
19156
19610
|
const next = draft.trim();
|
|
19157
|
-
if (next
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
onCommit(next);
|
|
19161
|
-
};
|
|
19162
|
-
return /* @__PURE__ */ jsxs11(
|
|
19163
|
-
"div",
|
|
19164
|
-
{
|
|
19165
|
-
style: {
|
|
19166
|
-
display: "flex",
|
|
19167
|
-
alignItems: "center",
|
|
19168
|
-
gap: 6,
|
|
19169
|
-
height: 28,
|
|
19170
|
-
padding: "0 12px",
|
|
19171
|
-
borderRadius: 999,
|
|
19172
|
-
background: "#ffffff",
|
|
19173
|
-
width: "100%",
|
|
19174
|
-
maxWidth: 260,
|
|
19175
|
-
boxSizing: "border-box",
|
|
19176
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19177
|
-
},
|
|
19178
|
-
children: [
|
|
19179
|
-
/* @__PURE__ */ jsx20(
|
|
19180
|
-
"span",
|
|
19181
|
-
{
|
|
19182
|
-
style: {
|
|
19183
|
-
flex: "0 0 auto",
|
|
19184
|
-
color: OHW_BLUE_DARK,
|
|
19185
|
-
fontSize: 10,
|
|
19186
|
-
fontWeight: 700,
|
|
19187
|
-
textTransform: "uppercase",
|
|
19188
|
-
letterSpacing: 0.4
|
|
19189
|
-
},
|
|
19190
|
-
children: "Link"
|
|
19191
|
-
}
|
|
19192
|
-
),
|
|
19193
|
-
/* @__PURE__ */ jsx20(
|
|
19194
|
-
"input",
|
|
19195
|
-
{
|
|
19196
|
-
type: "text",
|
|
19197
|
-
inputMode: "url",
|
|
19198
|
-
value: draft,
|
|
19199
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19200
|
-
onBlur: commit2,
|
|
19201
|
-
onKeyDown: (e) => {
|
|
19202
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19203
|
-
if (e.key === "Escape") {
|
|
19204
|
-
setDraft(value);
|
|
19205
|
-
setInvalid(false);
|
|
19206
|
-
e.currentTarget.blur();
|
|
19207
|
-
}
|
|
19208
|
-
},
|
|
19209
|
-
placeholder: "https://example.com",
|
|
19210
|
-
"aria-label": "Image link URL",
|
|
19211
|
-
"aria-invalid": invalid,
|
|
19212
|
-
style: {
|
|
19213
|
-
flex: 1,
|
|
19214
|
-
minWidth: 0,
|
|
19215
|
-
border: "none",
|
|
19216
|
-
outline: "none",
|
|
19217
|
-
background: "transparent",
|
|
19218
|
-
fontSize: 12,
|
|
19219
|
-
lineHeight: "16px",
|
|
19220
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19221
|
-
color: "#1f2937"
|
|
19222
|
-
}
|
|
19223
|
-
}
|
|
19224
|
-
)
|
|
19225
|
-
]
|
|
19611
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19612
|
+
setInvalid(true);
|
|
19613
|
+
return;
|
|
19226
19614
|
}
|
|
19227
|
-
|
|
19615
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19616
|
+
onClose();
|
|
19617
|
+
};
|
|
19618
|
+
return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
19619
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19620
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
19621
|
+
/* @__PURE__ */ jsx21(
|
|
19622
|
+
"input",
|
|
19623
|
+
{
|
|
19624
|
+
autoFocus: true,
|
|
19625
|
+
type: "text",
|
|
19626
|
+
inputMode: "url",
|
|
19627
|
+
value: draft,
|
|
19628
|
+
onChange: (e) => {
|
|
19629
|
+
setDraft(e.target.value);
|
|
19630
|
+
setInvalid(false);
|
|
19631
|
+
},
|
|
19632
|
+
onKeyDown: (e) => {
|
|
19633
|
+
if (e.key === "Enter") save();
|
|
19634
|
+
},
|
|
19635
|
+
placeholder: "https://example.com",
|
|
19636
|
+
"aria-label": "Image link URL",
|
|
19637
|
+
"aria-invalid": invalid,
|
|
19638
|
+
className: cn(
|
|
19639
|
+
"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",
|
|
19640
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19641
|
+
)
|
|
19642
|
+
}
|
|
19643
|
+
),
|
|
19644
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19645
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19646
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19647
|
+
"Open in new tab"
|
|
19648
|
+
] })
|
|
19649
|
+
] }),
|
|
19650
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
19651
|
+
href && /* @__PURE__ */ jsx21(
|
|
19652
|
+
"button",
|
|
19653
|
+
{
|
|
19654
|
+
type: "button",
|
|
19655
|
+
onClick: () => {
|
|
19656
|
+
onSave("", "new-tab");
|
|
19657
|
+
onClose();
|
|
19658
|
+
},
|
|
19659
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19660
|
+
children: "Remove link"
|
|
19661
|
+
}
|
|
19662
|
+
),
|
|
19663
|
+
/* @__PURE__ */ jsx21(
|
|
19664
|
+
"button",
|
|
19665
|
+
{
|
|
19666
|
+
type: "button",
|
|
19667
|
+
onClick: onClose,
|
|
19668
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19669
|
+
children: "Cancel"
|
|
19670
|
+
}
|
|
19671
|
+
),
|
|
19672
|
+
/* @__PURE__ */ jsx21(
|
|
19673
|
+
"button",
|
|
19674
|
+
{
|
|
19675
|
+
type: "button",
|
|
19676
|
+
onClick: save,
|
|
19677
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19678
|
+
children: "Save"
|
|
19679
|
+
}
|
|
19680
|
+
)
|
|
19681
|
+
] })
|
|
19682
|
+
] }) });
|
|
19228
19683
|
}
|
|
19229
19684
|
function MediaStripToolbar({
|
|
19230
19685
|
entry,
|
|
19231
19686
|
index,
|
|
19232
19687
|
pending,
|
|
19233
19688
|
error,
|
|
19689
|
+
itemEditOn,
|
|
19690
|
+
onToggleItemEdit,
|
|
19234
19691
|
onSetVariant,
|
|
19235
19692
|
onSetAlign,
|
|
19236
19693
|
onSetHover,
|
|
19237
19694
|
onSetTreatment,
|
|
19238
19695
|
onResize,
|
|
19239
|
-
|
|
19240
|
-
onSetLink,
|
|
19696
|
+
onOpenLink,
|
|
19241
19697
|
onAddItem,
|
|
19242
19698
|
onRemoveItem,
|
|
19243
19699
|
onChangeImage,
|
|
@@ -19246,81 +19702,102 @@ function MediaStripToolbar({
|
|
|
19246
19702
|
}) {
|
|
19247
19703
|
const items = mediaStripItems(entry.tree);
|
|
19248
19704
|
const itemCount = items.length;
|
|
19249
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19250
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19251
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19252
19705
|
const slots = findMediaStripSlots(entry.tree);
|
|
19253
19706
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19254
19707
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19255
19708
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19256
19709
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19257
19710
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19258
|
-
const
|
|
19259
|
-
const
|
|
19260
|
-
|
|
19261
|
-
gap: 6,
|
|
19262
|
-
flexWrap: "nowrap",
|
|
19263
|
-
justifyContent: "center",
|
|
19264
|
-
overflowX: "auto",
|
|
19265
|
-
WebkitOverflowScrolling: "touch",
|
|
19266
|
-
width: "100%",
|
|
19267
|
-
scrollbarWidth: "none"
|
|
19268
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19269
|
-
return /* @__PURE__ */ jsxs11(
|
|
19711
|
+
const mobile = window.innerWidth <= 480;
|
|
19712
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19713
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19270
19714
|
"div",
|
|
19271
19715
|
{
|
|
19272
19716
|
"data-ohw-bridge": "",
|
|
19273
19717
|
"data-ohw-toolbar": "",
|
|
19274
19718
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
flexDirection: "column",
|
|
19278
|
-
gap: 6,
|
|
19279
|
-
alignItems: "center",
|
|
19280
|
-
background: OHW_BLUE,
|
|
19281
|
-
padding: 8,
|
|
19282
|
-
borderRadius: 12,
|
|
19283
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19284
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19285
|
-
opacity: pending ? 0.6 : 1,
|
|
19286
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19287
|
-
},
|
|
19719
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19720
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19288
19721
|
children: [
|
|
19289
|
-
/* @__PURE__ */
|
|
19290
|
-
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
|
|
19319
|
-
|
|
19320
|
-
|
|
19722
|
+
/* @__PURE__ */ jsxs12(
|
|
19723
|
+
"div",
|
|
19724
|
+
{
|
|
19725
|
+
className: cn(
|
|
19726
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19727
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19728
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19729
|
+
),
|
|
19730
|
+
children: [
|
|
19731
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19732
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
19733
|
+
CustomToolbarButton,
|
|
19734
|
+
{
|
|
19735
|
+
type: "button",
|
|
19736
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19737
|
+
"aria-pressed": itemEditOn,
|
|
19738
|
+
onClick: onToggleItemEdit,
|
|
19739
|
+
className: "group size-8",
|
|
19740
|
+
children: /* @__PURE__ */ jsx21(
|
|
19741
|
+
Star,
|
|
19742
|
+
{
|
|
19743
|
+
size: 16,
|
|
19744
|
+
fill: "currentColor",
|
|
19745
|
+
strokeWidth: 0,
|
|
19746
|
+
className: cn(
|
|
19747
|
+
"transition-colors",
|
|
19748
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19749
|
+
),
|
|
19750
|
+
style: { pointerEvents: "none" }
|
|
19751
|
+
}
|
|
19752
|
+
)
|
|
19753
|
+
}
|
|
19754
|
+
) }),
|
|
19755
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19756
|
+
] }),
|
|
19757
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19758
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19759
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19760
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19761
|
+
/* @__PURE__ */ jsx21(
|
|
19762
|
+
ToolbarAction,
|
|
19763
|
+
{
|
|
19764
|
+
label: gatedLabel("Move right"),
|
|
19765
|
+
onClick: onMoveRight,
|
|
19766
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19767
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
19768
|
+
}
|
|
19769
|
+
),
|
|
19770
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19771
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19772
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19773
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19774
|
+
/* @__PURE__ */ jsx21(
|
|
19775
|
+
ToolbarAction,
|
|
19776
|
+
{
|
|
19777
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19778
|
+
active: treatment === "grayscale",
|
|
19779
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19780
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19781
|
+
}
|
|
19782
|
+
),
|
|
19783
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19784
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
19785
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19786
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19787
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19788
|
+
sizeValue,
|
|
19789
|
+
"px"
|
|
19790
|
+
] }),
|
|
19791
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19792
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19793
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19794
|
+
]
|
|
19795
|
+
}
|
|
19796
|
+
),
|
|
19797
|
+
error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19321
19798
|
]
|
|
19322
19799
|
}
|
|
19323
|
-
);
|
|
19800
|
+
) });
|
|
19324
19801
|
}
|
|
19325
19802
|
function findMediaStripSlots(tree) {
|
|
19326
19803
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19339,31 +19816,23 @@ function AiMediaStripOverlay({
|
|
|
19339
19816
|
}) {
|
|
19340
19817
|
const [hover, setHover] = useState8(null);
|
|
19341
19818
|
const [active, setActive] = useState8(null);
|
|
19819
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
19820
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19342
19821
|
const [pending, setPending] = useState8(false);
|
|
19343
19822
|
const [error, setError] = useState8(null);
|
|
19344
19823
|
const activeRef = useRef5(null);
|
|
19345
19824
|
activeRef.current = active;
|
|
19346
|
-
|
|
19825
|
+
const linkOpenRef = useRef5(false);
|
|
19826
|
+
linkOpenRef.current = linkOpen;
|
|
19827
|
+
useEffect9(() => {
|
|
19347
19828
|
const onMove = (e) => {
|
|
19829
|
+
const ref = itemRefFromTarget(e.target);
|
|
19348
19830
|
const t = e.target;
|
|
19349
|
-
|
|
19350
|
-
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
if (!itemEl) {
|
|
19355
|
-
setHover(null);
|
|
19356
|
-
return;
|
|
19357
|
-
}
|
|
19358
|
-
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19359
|
-
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19360
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19361
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19362
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19363
|
-
setHover(null);
|
|
19364
|
-
return;
|
|
19365
|
-
}
|
|
19366
|
-
setHover({ sectionId, index });
|
|
19831
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19832
|
+
setHover((prev) => {
|
|
19833
|
+
const next = ref && !overEditable ? ref : null;
|
|
19834
|
+
return sameRef(prev, next) ? prev : next;
|
|
19835
|
+
});
|
|
19367
19836
|
};
|
|
19368
19837
|
const onLeave = () => setHover(null);
|
|
19369
19838
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19373,35 +19842,40 @@ function AiMediaStripOverlay({
|
|
|
19373
19842
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19374
19843
|
};
|
|
19375
19844
|
}, []);
|
|
19376
|
-
|
|
19845
|
+
useEffect9(() => {
|
|
19377
19846
|
const onClick = (e) => {
|
|
19378
|
-
const current = activeRef.current;
|
|
19379
|
-
if (!current) return;
|
|
19380
19847
|
const t = e.target;
|
|
19381
|
-
if (!(t instanceof
|
|
19382
|
-
if (t.closest(
|
|
19383
|
-
const
|
|
19384
|
-
if (
|
|
19385
|
-
|
|
19848
|
+
if (!(t instanceof Element)) return;
|
|
19849
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19850
|
+
const ref = itemRefFromTarget(t);
|
|
19851
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19852
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19853
|
+
setItemEditOn(false);
|
|
19386
19854
|
setError(null);
|
|
19855
|
+
setActive(ref);
|
|
19387
19856
|
};
|
|
19388
19857
|
document.addEventListener("click", onClick, true);
|
|
19389
19858
|
return () => document.removeEventListener("click", onClick, true);
|
|
19390
|
-
}, []);
|
|
19391
|
-
|
|
19859
|
+
}, [clearInteractionChromeRef]);
|
|
19860
|
+
useEffect9(() => {
|
|
19392
19861
|
const onBlur = () => {
|
|
19393
19862
|
if (!activeRef.current) return;
|
|
19394
19863
|
setActive(null);
|
|
19864
|
+
setItemEditOn(false);
|
|
19865
|
+
setLinkOpen(false);
|
|
19395
19866
|
setError(null);
|
|
19396
19867
|
};
|
|
19397
19868
|
window.addEventListener("blur", onBlur);
|
|
19398
19869
|
return () => window.removeEventListener("blur", onBlur);
|
|
19399
19870
|
}, []);
|
|
19400
|
-
|
|
19871
|
+
useEffect9(() => {
|
|
19401
19872
|
const onKeyDown = (e) => {
|
|
19402
19873
|
if (e.key !== "Escape") return;
|
|
19403
19874
|
if (!activeRef.current) return;
|
|
19875
|
+
if (linkOpenRef.current) return;
|
|
19876
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19404
19877
|
setActive(null);
|
|
19878
|
+
setItemEditOn(false);
|
|
19405
19879
|
setError(null);
|
|
19406
19880
|
};
|
|
19407
19881
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19435,137 +19909,133 @@ function AiMediaStripOverlay({
|
|
|
19435
19909
|
tree: nextTree,
|
|
19436
19910
|
label: entry.label,
|
|
19437
19911
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19438
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19912
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
19913
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19914
|
+
// on every edit reads as the section jumping around.
|
|
19915
|
+
skipScrollIntoView: true
|
|
19439
19916
|
});
|
|
19440
19917
|
return true;
|
|
19441
19918
|
},
|
|
19442
19919
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19443
19920
|
);
|
|
19444
19921
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19445
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19446
19922
|
const activeItemRect = useLiveItemRect(active);
|
|
19447
|
-
const
|
|
19448
|
-
const
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19482
|
-
ItemInteractionLayer,
|
|
19483
|
-
{
|
|
19484
|
-
rect: activeItemRect,
|
|
19485
|
-
state: toolbarState,
|
|
19486
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19487
|
-
MediaStripToolbar,
|
|
19488
|
-
{
|
|
19489
|
-
entry: activeEntry,
|
|
19490
|
-
index: active.index,
|
|
19491
|
-
pending,
|
|
19492
|
-
error,
|
|
19493
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19494
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19495
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19496
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19497
|
-
onResize: (delta) => {
|
|
19498
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19499
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19500
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19501
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19502
|
-
},
|
|
19503
|
-
onSetAlt: (alt) => {
|
|
19504
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19505
|
-
},
|
|
19506
|
-
onSetLink: (href, linkTarget) => {
|
|
19923
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
19924
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
19925
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
19926
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
19927
|
+
const activeHref = activeItem?.href ?? "";
|
|
19928
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19929
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19930
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
19931
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19932
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
19933
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
19934
|
+
MediaStripToolbar,
|
|
19935
|
+
{
|
|
19936
|
+
entry: activeEntry,
|
|
19937
|
+
index: active.index,
|
|
19938
|
+
pending,
|
|
19939
|
+
error,
|
|
19940
|
+
itemEditOn,
|
|
19941
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
19942
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19943
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19944
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19945
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19946
|
+
onResize: (delta) => {
|
|
19947
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19948
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19949
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19950
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19951
|
+
},
|
|
19952
|
+
onOpenLink: () => setLinkOpen(true),
|
|
19953
|
+
onAddItem: () => {
|
|
19954
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19955
|
+
if (!picked) return;
|
|
19956
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19507
19957
|
void runMutation(
|
|
19508
19958
|
active.sectionId,
|
|
19509
|
-
(tree) =>
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19514
|
-
if (!picked) return;
|
|
19515
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19516
|
-
void runMutation(
|
|
19517
|
-
active.sectionId,
|
|
19518
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19519
|
-
{ [picked.assetId]: picked.url }
|
|
19520
|
-
).then((applied) => {
|
|
19521
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19522
|
-
});
|
|
19523
|
-
});
|
|
19524
|
-
},
|
|
19525
|
-
onChangeImage: () => {
|
|
19526
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19527
|
-
if (!picked) return;
|
|
19528
|
-
void runMutation(
|
|
19529
|
-
active.sectionId,
|
|
19530
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19531
|
-
{ [picked.assetId]: picked.url }
|
|
19532
|
-
);
|
|
19959
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19960
|
+
{ [picked.assetId]: picked.url }
|
|
19961
|
+
).then((applied) => {
|
|
19962
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19533
19963
|
});
|
|
19534
|
-
}
|
|
19535
|
-
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19544
|
-
(applied) => {
|
|
19545
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19546
|
-
}
|
|
19547
|
-
);
|
|
19548
|
-
},
|
|
19549
|
-
onMoveRight: () => {
|
|
19550
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19551
|
-
(applied) => {
|
|
19552
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19553
|
-
}
|
|
19964
|
+
});
|
|
19965
|
+
},
|
|
19966
|
+
onChangeImage: () => {
|
|
19967
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19968
|
+
if (!picked) return;
|
|
19969
|
+
void runMutation(
|
|
19970
|
+
active.sectionId,
|
|
19971
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19972
|
+
{ [picked.assetId]: picked.url }
|
|
19554
19973
|
);
|
|
19555
|
-
}
|
|
19974
|
+
});
|
|
19975
|
+
},
|
|
19976
|
+
onRemoveItem: () => {
|
|
19977
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19978
|
+
(applied) => {
|
|
19979
|
+
if (applied) setActive(null);
|
|
19980
|
+
}
|
|
19981
|
+
);
|
|
19982
|
+
},
|
|
19983
|
+
onMoveLeft: () => {
|
|
19984
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19985
|
+
(applied) => {
|
|
19986
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19987
|
+
}
|
|
19988
|
+
);
|
|
19989
|
+
},
|
|
19990
|
+
onMoveRight: () => {
|
|
19991
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19992
|
+
(applied) => {
|
|
19993
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19994
|
+
}
|
|
19995
|
+
);
|
|
19556
19996
|
}
|
|
19557
|
-
|
|
19558
|
-
}
|
|
19559
|
-
|
|
19997
|
+
}
|
|
19998
|
+
) }),
|
|
19999
|
+
/* @__PURE__ */ jsx21(
|
|
20000
|
+
"div",
|
|
20001
|
+
{
|
|
20002
|
+
"data-ohw-bridge": "",
|
|
20003
|
+
"data-ohw-item-interaction": "",
|
|
20004
|
+
"aria-hidden": true,
|
|
20005
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20006
|
+
style: {
|
|
20007
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20008
|
+
left: activeItemRect.left - 5,
|
|
20009
|
+
background: PRIMARY3,
|
|
20010
|
+
zIndex: 2147483644
|
|
20011
|
+
},
|
|
20012
|
+
children: "Media item"
|
|
20013
|
+
}
|
|
20014
|
+
),
|
|
20015
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
20016
|
+
LinkModal,
|
|
20017
|
+
{
|
|
20018
|
+
href: activeHref,
|
|
20019
|
+
linkTarget: activeTarget,
|
|
20020
|
+
onClose: () => setLinkOpen(false),
|
|
20021
|
+
onSave: (href, linkTarget) => {
|
|
20022
|
+
void runMutation(
|
|
20023
|
+
active.sectionId,
|
|
20024
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20025
|
+
);
|
|
20026
|
+
}
|
|
20027
|
+
}
|
|
20028
|
+
)
|
|
20029
|
+
] })
|
|
19560
20030
|
] });
|
|
19561
20031
|
}
|
|
19562
20032
|
|
|
19563
20033
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19564
|
-
import { useCallback as useCallback4, useEffect as
|
|
19565
|
-
import { Check as
|
|
19566
|
-
import { Fragment as Fragment8, jsx as
|
|
20034
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
20035
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
20036
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19567
20037
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19568
|
-
var
|
|
20038
|
+
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]";
|
|
19569
20039
|
function findPricingCardElement(sectionId, index) {
|
|
19570
20040
|
const sectionEl = findByInstanceId(sectionId);
|
|
19571
20041
|
if (!sectionEl) return null;
|
|
@@ -19577,7 +20047,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19577
20047
|
}
|
|
19578
20048
|
function cardRefFromTarget(target) {
|
|
19579
20049
|
if (!(target instanceof Element)) return null;
|
|
19580
|
-
if (target.closest(
|
|
20050
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19581
20051
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19582
20052
|
if (!cardEl) return null;
|
|
19583
20053
|
const sectionEl = cardEl.closest("[data-ohw-section]");
|
|
@@ -19587,25 +20057,25 @@ function cardRefFromTarget(target) {
|
|
|
19587
20057
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19588
20058
|
return { sectionId, index };
|
|
19589
20059
|
}
|
|
19590
|
-
function
|
|
20060
|
+
function sameRef2(a, b) {
|
|
19591
20061
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19592
20062
|
}
|
|
19593
|
-
function
|
|
20063
|
+
function rectOf2(el) {
|
|
19594
20064
|
if (!el) return null;
|
|
19595
20065
|
const r2 = el.getBoundingClientRect();
|
|
19596
20066
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19597
20067
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19598
20068
|
}
|
|
19599
20069
|
function readRect3(ref) {
|
|
19600
|
-
return
|
|
20070
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19601
20071
|
}
|
|
19602
20072
|
function readGridRect(ref) {
|
|
19603
20073
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19604
|
-
return
|
|
20074
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19605
20075
|
}
|
|
19606
20076
|
function useLiveCardRect(ref, grid = false) {
|
|
19607
20077
|
const [rect, setRect] = useState9(null);
|
|
19608
|
-
|
|
20078
|
+
useEffect10(() => {
|
|
19609
20079
|
if (!ref) {
|
|
19610
20080
|
setRect(null);
|
|
19611
20081
|
return;
|
|
@@ -19631,19 +20101,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19631
20101
|
}
|
|
19632
20102
|
var TOOLBAR_GRID_GAP = 52;
|
|
19633
20103
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19634
|
-
var
|
|
20104
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19635
20105
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19636
20106
|
const slotRef = useRef6(null);
|
|
19637
20107
|
const [shift, setShift] = useState9(0);
|
|
19638
20108
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19639
|
-
|
|
20109
|
+
useLayoutEffect5(() => {
|
|
19640
20110
|
const slot = slotRef.current;
|
|
19641
20111
|
if (!slot) return;
|
|
19642
20112
|
const clamp = () => {
|
|
19643
20113
|
const w = slot.offsetWidth;
|
|
19644
20114
|
if (w <= 0) return;
|
|
19645
20115
|
const half = w / 2;
|
|
19646
|
-
const clamped = Math.max(
|
|
20116
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19647
20117
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19648
20118
|
};
|
|
19649
20119
|
clamp();
|
|
@@ -19652,7 +20122,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19652
20122
|
return () => ro.disconnect();
|
|
19653
20123
|
}, [centerX, children]);
|
|
19654
20124
|
const mobile = window.innerWidth <= 480;
|
|
19655
|
-
return /* @__PURE__ */
|
|
20125
|
+
return /* @__PURE__ */ jsx22(
|
|
19656
20126
|
"div",
|
|
19657
20127
|
{
|
|
19658
20128
|
ref: slotRef,
|
|
@@ -19687,7 +20157,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19687
20157
|
});
|
|
19688
20158
|
}
|
|
19689
20159
|
function StyleSwatch({ style }) {
|
|
19690
|
-
return /* @__PURE__ */
|
|
20160
|
+
return /* @__PURE__ */ jsx22(
|
|
19691
20161
|
"span",
|
|
19692
20162
|
{
|
|
19693
20163
|
"aria-hidden": true,
|
|
@@ -19701,35 +20171,35 @@ function StyleSwatch({ style }) {
|
|
|
19701
20171
|
);
|
|
19702
20172
|
}
|
|
19703
20173
|
function ButtonGlyph() {
|
|
19704
|
-
return /* @__PURE__ */
|
|
19705
|
-
/* @__PURE__ */
|
|
19706
|
-
/* @__PURE__ */
|
|
20174
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20175
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20176
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19707
20177
|
] });
|
|
19708
20178
|
}
|
|
19709
20179
|
function FeatureGlyph({ mode }) {
|
|
19710
|
-
return /* @__PURE__ */
|
|
19711
|
-
/* @__PURE__ */
|
|
19712
|
-
/* @__PURE__ */
|
|
19713
|
-
/* @__PURE__ */
|
|
19714
|
-
/* @__PURE__ */
|
|
19715
|
-
/* @__PURE__ */
|
|
19716
|
-
mode === "add" && /* @__PURE__ */
|
|
20180
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20181
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20182
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20183
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20184
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20185
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20186
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19717
20187
|
] });
|
|
19718
20188
|
}
|
|
19719
|
-
function
|
|
20189
|
+
function ToolbarAction2({
|
|
19720
20190
|
label,
|
|
19721
20191
|
onClick,
|
|
19722
20192
|
disabled = false,
|
|
19723
20193
|
children
|
|
19724
20194
|
}) {
|
|
19725
|
-
const button = /* @__PURE__ */
|
|
19726
|
-
return /* @__PURE__ */
|
|
19727
|
-
/* @__PURE__ */
|
|
19728
|
-
/* @__PURE__ */
|
|
20195
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20196
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20197
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20198
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19729
20199
|
] });
|
|
19730
20200
|
}
|
|
19731
|
-
function
|
|
19732
|
-
return /* @__PURE__ */
|
|
20201
|
+
function ToolbarSeparator2() {
|
|
20202
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19733
20203
|
}
|
|
19734
20204
|
function CardStyleMenu({
|
|
19735
20205
|
value,
|
|
@@ -19737,7 +20207,7 @@ function CardStyleMenu({
|
|
|
19737
20207
|
disabled = false
|
|
19738
20208
|
}) {
|
|
19739
20209
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19740
|
-
const trigger = /* @__PURE__ */
|
|
20210
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
19741
20211
|
"button",
|
|
19742
20212
|
{
|
|
19743
20213
|
type: "button",
|
|
@@ -19748,28 +20218,28 @@ function CardStyleMenu({
|
|
|
19748
20218
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19749
20219
|
),
|
|
19750
20220
|
children: [
|
|
19751
|
-
/* @__PURE__ */
|
|
19752
|
-
/* @__PURE__ */
|
|
19753
|
-
/* @__PURE__ */
|
|
20221
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20222
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20223
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
19754
20224
|
]
|
|
19755
20225
|
}
|
|
19756
20226
|
);
|
|
19757
20227
|
if (disabled) {
|
|
19758
|
-
return /* @__PURE__ */
|
|
19759
|
-
/* @__PURE__ */
|
|
19760
|
-
/* @__PURE__ */
|
|
19761
|
-
/* @__PURE__ */
|
|
19762
|
-
/* @__PURE__ */
|
|
20228
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20229
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20230
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20231
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20232
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19763
20233
|
] })
|
|
19764
20234
|
] });
|
|
19765
20235
|
}
|
|
19766
|
-
return /* @__PURE__ */
|
|
19767
|
-
/* @__PURE__ */
|
|
19768
|
-
/* @__PURE__ */
|
|
19769
|
-
/* @__PURE__ */
|
|
19770
|
-
/* @__PURE__ */
|
|
20236
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20237
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20238
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20239
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20240
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19771
20241
|
const selected = style.value === value;
|
|
19772
|
-
return /* @__PURE__ */
|
|
20242
|
+
return /* @__PURE__ */ jsxs13(
|
|
19773
20243
|
DropdownMenuItem,
|
|
19774
20244
|
{
|
|
19775
20245
|
role: "menuitemradio",
|
|
@@ -19777,9 +20247,9 @@ function CardStyleMenu({
|
|
|
19777
20247
|
onSelect: () => onChange(style.value),
|
|
19778
20248
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19779
20249
|
children: [
|
|
19780
|
-
/* @__PURE__ */
|
|
19781
|
-
/* @__PURE__ */
|
|
19782
|
-
selected && /* @__PURE__ */
|
|
20250
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20251
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20252
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
19783
20253
|
]
|
|
19784
20254
|
},
|
|
19785
20255
|
style.value
|
|
@@ -19809,7 +20279,7 @@ function PricingCardToolbar({
|
|
|
19809
20279
|
const style = pricingCardStyle(entry.tree, index);
|
|
19810
20280
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19811
20281
|
const mobile = window.innerWidth <= 480;
|
|
19812
|
-
return /* @__PURE__ */
|
|
20282
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
19813
20283
|
"div",
|
|
19814
20284
|
{
|
|
19815
20285
|
"data-ohw-bridge": "",
|
|
@@ -19821,7 +20291,7 @@ function PricingCardToolbar({
|
|
|
19821
20291
|
),
|
|
19822
20292
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19823
20293
|
children: [
|
|
19824
|
-
/* @__PURE__ */
|
|
20294
|
+
/* @__PURE__ */ jsxs13(
|
|
19825
20295
|
"div",
|
|
19826
20296
|
{
|
|
19827
20297
|
className: cn(
|
|
@@ -19830,8 +20300,8 @@ function PricingCardToolbar({
|
|
|
19830
20300
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19831
20301
|
),
|
|
19832
20302
|
children: [
|
|
19833
|
-
/* @__PURE__ */
|
|
19834
|
-
/* @__PURE__ */
|
|
20303
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20304
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
19835
20305
|
CustomToolbarButton,
|
|
19836
20306
|
{
|
|
19837
20307
|
type: "button",
|
|
@@ -19839,7 +20309,7 @@ function PricingCardToolbar({
|
|
|
19839
20309
|
"aria-pressed": featuredTag,
|
|
19840
20310
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19841
20311
|
className: "group size-8",
|
|
19842
|
-
children: /* @__PURE__ */
|
|
20312
|
+
children: /* @__PURE__ */ jsx22(
|
|
19843
20313
|
Star2,
|
|
19844
20314
|
{
|
|
19845
20315
|
size: 16,
|
|
@@ -19854,25 +20324,25 @@ function PricingCardToolbar({
|
|
|
19854
20324
|
)
|
|
19855
20325
|
}
|
|
19856
20326
|
) }),
|
|
19857
|
-
/* @__PURE__ */
|
|
20327
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
19858
20328
|
] }),
|
|
19859
|
-
/* @__PURE__ */
|
|
19860
|
-
/* @__PURE__ */
|
|
19861
|
-
/* @__PURE__ */
|
|
19862
|
-
/* @__PURE__ */
|
|
19863
|
-
/* @__PURE__ */
|
|
19864
|
-
/* @__PURE__ */
|
|
19865
|
-
/* @__PURE__ */
|
|
20329
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20330
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20331
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20332
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20333
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20334
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20335
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
19866
20336
|
] }) }),
|
|
19867
|
-
/* @__PURE__ */
|
|
19868
|
-
/* @__PURE__ */
|
|
19869
|
-
/* @__PURE__ */
|
|
19870
|
-
/* @__PURE__ */
|
|
19871
|
-
/* @__PURE__ */
|
|
20337
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20338
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20339
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20340
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20341
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19872
20342
|
]
|
|
19873
20343
|
}
|
|
19874
20344
|
),
|
|
19875
|
-
error && /* @__PURE__ */
|
|
20345
|
+
error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19876
20346
|
]
|
|
19877
20347
|
}
|
|
19878
20348
|
) });
|
|
@@ -19899,14 +20369,14 @@ function AiPricingCardOverlay({
|
|
|
19899
20369
|
const [error, setError] = useState9(null);
|
|
19900
20370
|
const activeRef = useRef6(null);
|
|
19901
20371
|
activeRef.current = active;
|
|
19902
|
-
|
|
20372
|
+
useEffect10(() => {
|
|
19903
20373
|
const onMove = (e) => {
|
|
19904
20374
|
const ref = cardRefFromTarget(e.target);
|
|
19905
20375
|
const t = e.target;
|
|
19906
20376
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
19907
20377
|
setHover((prev) => {
|
|
19908
20378
|
const next = ref && !overEditable ? ref : null;
|
|
19909
|
-
return
|
|
20379
|
+
return sameRef2(prev, next) ? prev : next;
|
|
19910
20380
|
});
|
|
19911
20381
|
};
|
|
19912
20382
|
const onLeave = () => setHover(null);
|
|
@@ -19917,19 +20387,19 @@ function AiPricingCardOverlay({
|
|
|
19917
20387
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19918
20388
|
};
|
|
19919
20389
|
}, []);
|
|
19920
|
-
|
|
20390
|
+
useEffect10(() => {
|
|
19921
20391
|
const onClick = (e) => {
|
|
19922
20392
|
const t = e.target;
|
|
19923
20393
|
if (!(t instanceof Element)) return;
|
|
19924
|
-
if (t.closest(
|
|
20394
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
19925
20395
|
const ref = cardRefFromTarget(t);
|
|
19926
|
-
setActive((prev) =>
|
|
19927
|
-
if (!ref || !
|
|
20396
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20397
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
19928
20398
|
};
|
|
19929
20399
|
document.addEventListener("click", onClick, true);
|
|
19930
20400
|
return () => document.removeEventListener("click", onClick, true);
|
|
19931
20401
|
}, []);
|
|
19932
|
-
|
|
20402
|
+
useEffect10(() => {
|
|
19933
20403
|
const onBlur = () => {
|
|
19934
20404
|
if (!activeRef.current) return;
|
|
19935
20405
|
setActive(null);
|
|
@@ -19938,7 +20408,7 @@ function AiPricingCardOverlay({
|
|
|
19938
20408
|
window.addEventListener("blur", onBlur);
|
|
19939
20409
|
return () => window.removeEventListener("blur", onBlur);
|
|
19940
20410
|
}, []);
|
|
19941
|
-
|
|
20411
|
+
useEffect10(() => {
|
|
19942
20412
|
const onKeyDown = (e) => {
|
|
19943
20413
|
if (e.key !== "Escape") return;
|
|
19944
20414
|
if (!activeRef.current) return;
|
|
@@ -19989,12 +20459,12 @@ function AiPricingCardOverlay({
|
|
|
19989
20459
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19990
20460
|
const activeCardRect = useLiveCardRect(active);
|
|
19991
20461
|
const activeGridRect = useLiveCardRect(active, true);
|
|
19992
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
19993
|
-
return /* @__PURE__ */
|
|
19994
|
-
hoverRect && /* @__PURE__ */
|
|
19995
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
19996
|
-
/* @__PURE__ */
|
|
19997
|
-
/* @__PURE__ */
|
|
20462
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20463
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20464
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20465
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20466
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20467
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
19998
20468
|
PricingCardToolbar,
|
|
19999
20469
|
{
|
|
20000
20470
|
entry: activeEntry,
|
|
@@ -20022,7 +20492,7 @@ function AiPricingCardOverlay({
|
|
|
20022
20492
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20023
20493
|
}
|
|
20024
20494
|
) }),
|
|
20025
|
-
/* @__PURE__ */
|
|
20495
|
+
/* @__PURE__ */ jsx22(
|
|
20026
20496
|
"div",
|
|
20027
20497
|
{
|
|
20028
20498
|
"data-ohw-bridge": "",
|
|
@@ -20043,7 +20513,7 @@ function AiPricingCardOverlay({
|
|
|
20043
20513
|
}
|
|
20044
20514
|
|
|
20045
20515
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20046
|
-
import { useCallback as useCallback5, useEffect as
|
|
20516
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef7, useState as useState10 } from "react";
|
|
20047
20517
|
import { Star as Star3 } from "lucide-react";
|
|
20048
20518
|
|
|
20049
20519
|
// src/lib/ai-video-tree.ts
|
|
@@ -20086,39 +20556,11 @@ function clearVideo(tree, path) {
|
|
|
20086
20556
|
});
|
|
20087
20557
|
}
|
|
20088
20558
|
|
|
20089
|
-
// src/lib/youtube.ts
|
|
20090
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20091
|
-
function extractYouTubeId(input) {
|
|
20092
|
-
const trimmed = input.trim();
|
|
20093
|
-
if (!trimmed) return null;
|
|
20094
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20095
|
-
let url;
|
|
20096
|
-
try {
|
|
20097
|
-
url = new URL(trimmed);
|
|
20098
|
-
} catch {
|
|
20099
|
-
return null;
|
|
20100
|
-
}
|
|
20101
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20102
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20103
|
-
return null;
|
|
20104
|
-
}
|
|
20105
|
-
let candidate = null;
|
|
20106
|
-
if (host === "youtu.be") {
|
|
20107
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20108
|
-
} else if (url.pathname === "/watch") {
|
|
20109
|
-
candidate = url.searchParams.get("v");
|
|
20110
|
-
} else {
|
|
20111
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20112
|
-
candidate = match ? match[1] : null;
|
|
20113
|
-
}
|
|
20114
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20115
|
-
}
|
|
20116
|
-
|
|
20117
20559
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20118
|
-
import { Fragment as Fragment9, jsx as
|
|
20560
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20119
20561
|
var PRIMARY5 = "#0885FE";
|
|
20120
|
-
var
|
|
20121
|
-
var
|
|
20562
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20563
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20122
20564
|
function findVideoBlockElement(sectionId, path) {
|
|
20123
20565
|
const sectionEl = findByInstanceId(sectionId);
|
|
20124
20566
|
if (!sectionEl) return null;
|
|
@@ -20137,7 +20579,7 @@ function readRect4(ref) {
|
|
|
20137
20579
|
}
|
|
20138
20580
|
function useLiveBlockRect(ref) {
|
|
20139
20581
|
const [rect, setRect] = useState10(null);
|
|
20140
|
-
|
|
20582
|
+
useEffect11(() => {
|
|
20141
20583
|
if (!ref) {
|
|
20142
20584
|
setRect(null);
|
|
20143
20585
|
return;
|
|
@@ -20178,12 +20620,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20178
20620
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20179
20621
|
});
|
|
20180
20622
|
}
|
|
20181
|
-
function
|
|
20623
|
+
function Pill({
|
|
20182
20624
|
label,
|
|
20183
20625
|
onClick,
|
|
20184
20626
|
disabled
|
|
20185
20627
|
}) {
|
|
20186
|
-
return /* @__PURE__ */
|
|
20628
|
+
return /* @__PURE__ */ jsx23(
|
|
20187
20629
|
"button",
|
|
20188
20630
|
{
|
|
20189
20631
|
type: "button",
|
|
@@ -20199,7 +20641,7 @@ function Pill2({
|
|
|
20199
20641
|
border: "none",
|
|
20200
20642
|
cursor: disabled ? "default" : "pointer",
|
|
20201
20643
|
background: "#ffffff",
|
|
20202
|
-
color:
|
|
20644
|
+
color: OHW_BLUE_DARK,
|
|
20203
20645
|
opacity: disabled ? 0.4 : 1,
|
|
20204
20646
|
fontSize: 12,
|
|
20205
20647
|
lineHeight: "16px",
|
|
@@ -20217,7 +20659,7 @@ function watchUrl(id) {
|
|
|
20217
20659
|
function VideoUrlInput({ value, onCommit }) {
|
|
20218
20660
|
const [draft, setDraft] = useState10(value ? watchUrl(value) : "");
|
|
20219
20661
|
const [invalid, setInvalid] = useState10(false);
|
|
20220
|
-
|
|
20662
|
+
useEffect11(() => {
|
|
20221
20663
|
setDraft(value ? watchUrl(value) : "");
|
|
20222
20664
|
setInvalid(false);
|
|
20223
20665
|
}, [value]);
|
|
@@ -20242,8 +20684,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20242
20684
|
onCommit(id);
|
|
20243
20685
|
}
|
|
20244
20686
|
};
|
|
20245
|
-
return /* @__PURE__ */
|
|
20246
|
-
/* @__PURE__ */
|
|
20687
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20688
|
+
/* @__PURE__ */ jsxs14(
|
|
20247
20689
|
"div",
|
|
20248
20690
|
{
|
|
20249
20691
|
style: {
|
|
@@ -20259,12 +20701,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20259
20701
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20260
20702
|
},
|
|
20261
20703
|
children: [
|
|
20262
|
-
/* @__PURE__ */
|
|
20704
|
+
/* @__PURE__ */ jsx23(
|
|
20263
20705
|
"span",
|
|
20264
20706
|
{
|
|
20265
20707
|
style: {
|
|
20266
20708
|
flex: "0 0 auto",
|
|
20267
|
-
color:
|
|
20709
|
+
color: OHW_BLUE_DARK,
|
|
20268
20710
|
fontSize: 10,
|
|
20269
20711
|
lineHeight: "16px",
|
|
20270
20712
|
fontWeight: 700,
|
|
@@ -20274,7 +20716,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20274
20716
|
children: "Video"
|
|
20275
20717
|
}
|
|
20276
20718
|
),
|
|
20277
|
-
/* @__PURE__ */
|
|
20719
|
+
/* @__PURE__ */ jsx23(
|
|
20278
20720
|
"input",
|
|
20279
20721
|
{
|
|
20280
20722
|
type: "text",
|
|
@@ -20311,7 +20753,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20311
20753
|
]
|
|
20312
20754
|
}
|
|
20313
20755
|
),
|
|
20314
|
-
invalid && /* @__PURE__ */
|
|
20756
|
+
invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20315
20757
|
] });
|
|
20316
20758
|
}
|
|
20317
20759
|
function VideoToolbar({
|
|
@@ -20321,7 +20763,7 @@ function VideoToolbar({
|
|
|
20321
20763
|
onSetVideoId,
|
|
20322
20764
|
onRemove
|
|
20323
20765
|
}) {
|
|
20324
|
-
return /* @__PURE__ */
|
|
20766
|
+
return /* @__PURE__ */ jsxs14(
|
|
20325
20767
|
"div",
|
|
20326
20768
|
{
|
|
20327
20769
|
"data-ohw-bridge": "",
|
|
@@ -20333,7 +20775,7 @@ function VideoToolbar({
|
|
|
20333
20775
|
gap: 6,
|
|
20334
20776
|
alignItems: "center",
|
|
20335
20777
|
width: 280,
|
|
20336
|
-
background:
|
|
20778
|
+
background: OHW_BLUE,
|
|
20337
20779
|
padding: 8,
|
|
20338
20780
|
borderRadius: 12,
|
|
20339
20781
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20341,9 +20783,9 @@ function VideoToolbar({
|
|
|
20341
20783
|
opacity: pending ? 0.6 : 1
|
|
20342
20784
|
},
|
|
20343
20785
|
children: [
|
|
20344
|
-
/* @__PURE__ */
|
|
20345
|
-
/* @__PURE__ */
|
|
20346
|
-
error && /* @__PURE__ */
|
|
20786
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20787
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20788
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20347
20789
|
]
|
|
20348
20790
|
}
|
|
20349
20791
|
);
|
|
@@ -20360,7 +20802,7 @@ function AiVideoOverlay({
|
|
|
20360
20802
|
const [error, setError] = useState10(null);
|
|
20361
20803
|
const activeRef = useRef7(null);
|
|
20362
20804
|
activeRef.current = active;
|
|
20363
|
-
|
|
20805
|
+
useEffect11(() => {
|
|
20364
20806
|
const onMove = (e) => {
|
|
20365
20807
|
const t = e.target;
|
|
20366
20808
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -20390,7 +20832,7 @@ function AiVideoOverlay({
|
|
|
20390
20832
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20391
20833
|
};
|
|
20392
20834
|
}, []);
|
|
20393
|
-
|
|
20835
|
+
useEffect11(() => {
|
|
20394
20836
|
const onClick = (e) => {
|
|
20395
20837
|
const current = activeRef.current;
|
|
20396
20838
|
if (!current) return;
|
|
@@ -20405,7 +20847,7 @@ function AiVideoOverlay({
|
|
|
20405
20847
|
document.addEventListener("click", onClick, true);
|
|
20406
20848
|
return () => document.removeEventListener("click", onClick, true);
|
|
20407
20849
|
}, []);
|
|
20408
|
-
|
|
20850
|
+
useEffect11(() => {
|
|
20409
20851
|
const onBlur = () => {
|
|
20410
20852
|
if (!activeRef.current) return;
|
|
20411
20853
|
setActive(null);
|
|
@@ -20414,7 +20856,7 @@ function AiVideoOverlay({
|
|
|
20414
20856
|
window.addEventListener("blur", onBlur);
|
|
20415
20857
|
return () => window.removeEventListener("blur", onBlur);
|
|
20416
20858
|
}, []);
|
|
20417
|
-
|
|
20859
|
+
useEffect11(() => {
|
|
20418
20860
|
const onKeyDown = (e) => {
|
|
20419
20861
|
if (e.key !== "Escape") return;
|
|
20420
20862
|
if (!activeRef.current) return;
|
|
@@ -20463,8 +20905,8 @@ function AiVideoOverlay({
|
|
|
20463
20905
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20464
20906
|
const TOOLBAR_APPROX_H = 90;
|
|
20465
20907
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20466
|
-
return /* @__PURE__ */
|
|
20467
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
20908
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
20909
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20468
20910
|
"button",
|
|
20469
20911
|
{
|
|
20470
20912
|
type: "button",
|
|
@@ -20492,15 +20934,15 @@ function AiVideoOverlay({
|
|
|
20492
20934
|
fontSize: 14,
|
|
20493
20935
|
fontWeight: 700
|
|
20494
20936
|
},
|
|
20495
|
-
children: /* @__PURE__ */
|
|
20937
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20496
20938
|
}
|
|
20497
20939
|
),
|
|
20498
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
20940
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20499
20941
|
ItemInteractionLayer,
|
|
20500
20942
|
{
|
|
20501
20943
|
rect: activeBlockRect,
|
|
20502
20944
|
state: toolbarState,
|
|
20503
|
-
toolbar: /* @__PURE__ */
|
|
20945
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20504
20946
|
VideoToolbar,
|
|
20505
20947
|
{
|
|
20506
20948
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20523,7 +20965,7 @@ function AiVideoOverlay({
|
|
|
20523
20965
|
}
|
|
20524
20966
|
|
|
20525
20967
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20526
|
-
import { useCallback as useCallback6, useEffect as
|
|
20968
|
+
import { useCallback as useCallback6, useEffect as useEffect12, useRef as useRef8, useState as useState11 } from "react";
|
|
20527
20969
|
import { Star as Star4 } from "lucide-react";
|
|
20528
20970
|
|
|
20529
20971
|
// src/lib/ai-carousel-tree.ts
|
|
@@ -20575,10 +21017,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20575
21017
|
}
|
|
20576
21018
|
|
|
20577
21019
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20578
|
-
import { Fragment as Fragment10, jsx as
|
|
21020
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20579
21021
|
var PRIMARY6 = "#0885FE";
|
|
20580
|
-
var
|
|
20581
|
-
var
|
|
21022
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21023
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20582
21024
|
function findCarouselItemElement(sectionId, index) {
|
|
20583
21025
|
const sectionEl = findByInstanceId(sectionId);
|
|
20584
21026
|
if (!sectionEl) return null;
|
|
@@ -20597,7 +21039,7 @@ function readRect5(ref) {
|
|
|
20597
21039
|
}
|
|
20598
21040
|
function useLiveItemRect2(ref) {
|
|
20599
21041
|
const [rect, setRect] = useState11(null);
|
|
20600
|
-
|
|
21042
|
+
useEffect12(() => {
|
|
20601
21043
|
if (!ref) {
|
|
20602
21044
|
setRect(null);
|
|
20603
21045
|
return;
|
|
@@ -20657,8 +21099,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20657
21099
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20658
21100
|
});
|
|
20659
21101
|
}
|
|
20660
|
-
function
|
|
20661
|
-
return /* @__PURE__ */
|
|
21102
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21103
|
+
return /* @__PURE__ */ jsx24(
|
|
20662
21104
|
"button",
|
|
20663
21105
|
{
|
|
20664
21106
|
type: "button",
|
|
@@ -20674,7 +21116,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20674
21116
|
border: "none",
|
|
20675
21117
|
cursor: disabled ? "default" : "pointer",
|
|
20676
21118
|
background: "#ffffff",
|
|
20677
|
-
color:
|
|
21119
|
+
color: OHW_BLUE_DARK2,
|
|
20678
21120
|
opacity: disabled ? 0.4 : 1,
|
|
20679
21121
|
fontSize: 12,
|
|
20680
21122
|
lineHeight: "16px",
|
|
@@ -20692,7 +21134,7 @@ function TogglePill({
|
|
|
20692
21134
|
onToggle,
|
|
20693
21135
|
disabled
|
|
20694
21136
|
}) {
|
|
20695
|
-
return /* @__PURE__ */
|
|
21137
|
+
return /* @__PURE__ */ jsxs15(
|
|
20696
21138
|
"button",
|
|
20697
21139
|
{
|
|
20698
21140
|
type: "button",
|
|
@@ -20711,7 +21153,7 @@ function TogglePill({
|
|
|
20711
21153
|
border: "none",
|
|
20712
21154
|
cursor: disabled ? "default" : "pointer",
|
|
20713
21155
|
background: "#ffffff",
|
|
20714
|
-
color:
|
|
21156
|
+
color: OHW_BLUE_DARK2,
|
|
20715
21157
|
opacity: disabled ? 0.4 : 1,
|
|
20716
21158
|
fontSize: 12,
|
|
20717
21159
|
lineHeight: "16px",
|
|
@@ -20721,7 +21163,7 @@ function TogglePill({
|
|
|
20721
21163
|
},
|
|
20722
21164
|
children: [
|
|
20723
21165
|
label,
|
|
20724
|
-
/* @__PURE__ */
|
|
21166
|
+
/* @__PURE__ */ jsx24(
|
|
20725
21167
|
"span",
|
|
20726
21168
|
{
|
|
20727
21169
|
"aria-hidden": true,
|
|
@@ -20734,10 +21176,10 @@ function TogglePill({
|
|
|
20734
21176
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20735
21177
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20736
21178
|
// "disabled control" rather than "switch that is off".
|
|
20737
|
-
background: on ?
|
|
21179
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20738
21180
|
transition: "background 120ms ease"
|
|
20739
21181
|
},
|
|
20740
|
-
children: /* @__PURE__ */
|
|
21182
|
+
children: /* @__PURE__ */ jsx24(
|
|
20741
21183
|
"span",
|
|
20742
21184
|
{
|
|
20743
21185
|
style: {
|
|
@@ -20766,7 +21208,7 @@ function CarouselSlideToolbar({
|
|
|
20766
21208
|
onChangeImage,
|
|
20767
21209
|
onToggleAutoplay
|
|
20768
21210
|
}) {
|
|
20769
|
-
return /* @__PURE__ */
|
|
21211
|
+
return /* @__PURE__ */ jsxs15(
|
|
20770
21212
|
"div",
|
|
20771
21213
|
{
|
|
20772
21214
|
"data-ohw-bridge": "",
|
|
@@ -20777,7 +21219,7 @@ function CarouselSlideToolbar({
|
|
|
20777
21219
|
flexDirection: "column",
|
|
20778
21220
|
gap: 6,
|
|
20779
21221
|
alignItems: "center",
|
|
20780
|
-
background:
|
|
21222
|
+
background: OHW_BLUE2,
|
|
20781
21223
|
padding: 8,
|
|
20782
21224
|
borderRadius: 12,
|
|
20783
21225
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20789,11 +21231,11 @@ function CarouselSlideToolbar({
|
|
|
20789
21231
|
pointerEvents: pending ? "none" : "auto"
|
|
20790
21232
|
},
|
|
20791
21233
|
children: [
|
|
20792
|
-
/* @__PURE__ */
|
|
20793
|
-
/* @__PURE__ */
|
|
20794
|
-
/* @__PURE__ */
|
|
21234
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21235
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21236
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20795
21237
|
] }),
|
|
20796
|
-
error && /* @__PURE__ */
|
|
21238
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20797
21239
|
]
|
|
20798
21240
|
}
|
|
20799
21241
|
);
|
|
@@ -20813,10 +21255,10 @@ function AiFadeCarouselOverlay({
|
|
|
20813
21255
|
const skeletonRef = useRef8(null);
|
|
20814
21256
|
const activeRef = useRef8(null);
|
|
20815
21257
|
activeRef.current = active;
|
|
20816
|
-
|
|
21258
|
+
useEffect12(() => {
|
|
20817
21259
|
setAutoplayOverride(null);
|
|
20818
21260
|
}, [active?.sectionId, active?.index]);
|
|
20819
|
-
|
|
21261
|
+
useEffect12(() => {
|
|
20820
21262
|
if (!swapping?.fadingOut || !skeletonRef.current) return;
|
|
20821
21263
|
const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
20822
21264
|
duration: MEDIA_UPLOAD_FADE_MS,
|
|
@@ -20826,7 +21268,7 @@ function AiFadeCarouselOverlay({
|
|
|
20826
21268
|
anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
|
|
20827
21269
|
return () => anim.cancel();
|
|
20828
21270
|
}, [swapping?.fadingOut]);
|
|
20829
|
-
|
|
21271
|
+
useEffect12(() => {
|
|
20830
21272
|
const onMove = (e) => {
|
|
20831
21273
|
const t = e.target;
|
|
20832
21274
|
if (!(t instanceof Element)) return;
|
|
@@ -20860,7 +21302,7 @@ function AiFadeCarouselOverlay({
|
|
|
20860
21302
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20861
21303
|
};
|
|
20862
21304
|
}, []);
|
|
20863
|
-
|
|
21305
|
+
useEffect12(() => {
|
|
20864
21306
|
const onClick = (e) => {
|
|
20865
21307
|
const current = activeRef.current;
|
|
20866
21308
|
if (!current) return;
|
|
@@ -20875,7 +21317,7 @@ function AiFadeCarouselOverlay({
|
|
|
20875
21317
|
document.addEventListener("click", onClick, true);
|
|
20876
21318
|
return () => document.removeEventListener("click", onClick, true);
|
|
20877
21319
|
}, []);
|
|
20878
|
-
|
|
21320
|
+
useEffect12(() => {
|
|
20879
21321
|
const onBlur = () => {
|
|
20880
21322
|
if (!activeRef.current) return;
|
|
20881
21323
|
setActive(null);
|
|
@@ -20884,7 +21326,7 @@ function AiFadeCarouselOverlay({
|
|
|
20884
21326
|
window.addEventListener("blur", onBlur);
|
|
20885
21327
|
return () => window.removeEventListener("blur", onBlur);
|
|
20886
21328
|
}, []);
|
|
20887
|
-
|
|
21329
|
+
useEffect12(() => {
|
|
20888
21330
|
const onKeyDown = (e) => {
|
|
20889
21331
|
if (e.key !== "Escape") return;
|
|
20890
21332
|
if (!activeRef.current) return;
|
|
@@ -20933,8 +21375,8 @@ function AiFadeCarouselOverlay({
|
|
|
20933
21375
|
const activeItemRect = useLiveItemRect2(active);
|
|
20934
21376
|
const TOOLBAR_APPROX_H = 90;
|
|
20935
21377
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20936
|
-
return /* @__PURE__ */
|
|
20937
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21378
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21379
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
20938
21380
|
"button",
|
|
20939
21381
|
{
|
|
20940
21382
|
type: "button",
|
|
@@ -20963,10 +21405,10 @@ function AiFadeCarouselOverlay({
|
|
|
20963
21405
|
fontSize: 14,
|
|
20964
21406
|
fontWeight: 700
|
|
20965
21407
|
},
|
|
20966
|
-
children: /* @__PURE__ */
|
|
21408
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
20967
21409
|
}
|
|
20968
21410
|
),
|
|
20969
|
-
swapping && /* @__PURE__ */
|
|
21411
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
20970
21412
|
"div",
|
|
20971
21413
|
{
|
|
20972
21414
|
ref: skeletonRef,
|
|
@@ -20984,15 +21426,15 @@ function AiFadeCarouselOverlay({
|
|
|
20984
21426
|
zIndex: 2147483646,
|
|
20985
21427
|
pointerEvents: "none"
|
|
20986
21428
|
},
|
|
20987
|
-
children: /* @__PURE__ */
|
|
21429
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
20988
21430
|
}
|
|
20989
21431
|
),
|
|
20990
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21432
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
20991
21433
|
ItemInteractionLayer,
|
|
20992
21434
|
{
|
|
20993
21435
|
rect: activeItemRect,
|
|
20994
21436
|
state: toolbarState,
|
|
20995
|
-
toolbar: /* @__PURE__ */
|
|
21437
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
20996
21438
|
CarouselSlideToolbar,
|
|
20997
21439
|
{
|
|
20998
21440
|
pending,
|
|
@@ -21181,120 +21623,13 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21181
21623
|
}
|
|
21182
21624
|
|
|
21183
21625
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21184
|
-
import { useEffect as
|
|
21185
|
-
|
|
21186
|
-
// src/ui/dialog.tsx
|
|
21187
|
-
import * as React9 from "react";
|
|
21188
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21189
|
-
import { X as X2 } from "lucide-react";
|
|
21190
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21191
|
-
function Dialog2({
|
|
21192
|
-
...props
|
|
21193
|
-
}) {
|
|
21194
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21195
|
-
}
|
|
21196
|
-
function DialogPortal({
|
|
21197
|
-
...props
|
|
21198
|
-
}) {
|
|
21199
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21200
|
-
}
|
|
21201
|
-
function DialogOverlay({
|
|
21202
|
-
className,
|
|
21203
|
-
...props
|
|
21204
|
-
}) {
|
|
21205
|
-
return /* @__PURE__ */ jsx24(
|
|
21206
|
-
DialogPrimitive.Overlay,
|
|
21207
|
-
{
|
|
21208
|
-
"data-slot": "dialog-overlay",
|
|
21209
|
-
"data-ohw-link-modal-root": "",
|
|
21210
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21211
|
-
...props
|
|
21212
|
-
}
|
|
21213
|
-
);
|
|
21214
|
-
}
|
|
21215
|
-
var DialogContent = React9.forwardRef(
|
|
21216
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21217
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21218
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21219
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21220
|
-
/* @__PURE__ */ jsxs15(
|
|
21221
|
-
DialogPrimitive.Content,
|
|
21222
|
-
{
|
|
21223
|
-
ref,
|
|
21224
|
-
"data-slot": "dialog-content",
|
|
21225
|
-
className: cn(
|
|
21226
|
-
positionMode,
|
|
21227
|
-
"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",
|
|
21228
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21229
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21230
|
-
className
|
|
21231
|
-
),
|
|
21232
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21233
|
-
...props,
|
|
21234
|
-
children: [
|
|
21235
|
-
children,
|
|
21236
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21237
|
-
DialogPrimitive.Close,
|
|
21238
|
-
{
|
|
21239
|
-
type: "button",
|
|
21240
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21241
|
-
"aria-label": "Close",
|
|
21242
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21243
|
-
}
|
|
21244
|
-
) : null
|
|
21245
|
-
]
|
|
21246
|
-
}
|
|
21247
|
-
)
|
|
21248
|
-
] });
|
|
21249
|
-
}
|
|
21250
|
-
);
|
|
21251
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21252
|
-
function DialogHeader({
|
|
21253
|
-
className,
|
|
21254
|
-
...props
|
|
21255
|
-
}) {
|
|
21256
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21257
|
-
}
|
|
21258
|
-
function DialogFooter({
|
|
21259
|
-
className,
|
|
21260
|
-
...props
|
|
21261
|
-
}) {
|
|
21262
|
-
return /* @__PURE__ */ jsx24(
|
|
21263
|
-
"div",
|
|
21264
|
-
{
|
|
21265
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21266
|
-
...props
|
|
21267
|
-
}
|
|
21268
|
-
);
|
|
21269
|
-
}
|
|
21270
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21271
|
-
DialogPrimitive.Title,
|
|
21272
|
-
{
|
|
21273
|
-
ref,
|
|
21274
|
-
className: cn(
|
|
21275
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21276
|
-
className
|
|
21277
|
-
),
|
|
21278
|
-
...props
|
|
21279
|
-
}
|
|
21280
|
-
));
|
|
21281
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21282
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21283
|
-
DialogPrimitive.Description,
|
|
21284
|
-
{
|
|
21285
|
-
ref,
|
|
21286
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21287
|
-
...props
|
|
21288
|
-
}
|
|
21289
|
-
));
|
|
21290
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21291
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21626
|
+
import { useEffect as useEffect16 } from "react";
|
|
21292
21627
|
|
|
21293
21628
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21294
21629
|
import { Info, X as X4 } from "lucide-react";
|
|
21295
21630
|
|
|
21296
21631
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21297
|
-
import { ArrowRight as
|
|
21632
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21298
21633
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21299
21634
|
function DestinationBreadcrumb({
|
|
21300
21635
|
pageTitle,
|
|
@@ -21308,7 +21643,7 @@ function DestinationBreadcrumb({
|
|
|
21308
21643
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21309
21644
|
] }),
|
|
21310
21645
|
/* @__PURE__ */ jsx25(
|
|
21311
|
-
|
|
21646
|
+
ArrowRight3,
|
|
21312
21647
|
{
|
|
21313
21648
|
size: 16,
|
|
21314
21649
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21381,7 +21716,7 @@ function SectionTreeItem({
|
|
|
21381
21716
|
}
|
|
21382
21717
|
|
|
21383
21718
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21384
|
-
import { useEffect as
|
|
21719
|
+
import { useEffect as useEffect13, useId as useId2, useRef as useRef9, useState as useState12 } from "react";
|
|
21385
21720
|
|
|
21386
21721
|
// src/ui/input.tsx
|
|
21387
21722
|
import * as React10 from "react";
|
|
@@ -21420,7 +21755,7 @@ function Label({ className, ...props }) {
|
|
|
21420
21755
|
}
|
|
21421
21756
|
|
|
21422
21757
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21423
|
-
import { ChevronDown as
|
|
21758
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21424
21759
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21425
21760
|
function FieldChevron({
|
|
21426
21761
|
onClick
|
|
@@ -21433,7 +21768,7 @@ function FieldChevron({
|
|
|
21433
21768
|
onClick,
|
|
21434
21769
|
"aria-label": "Open page list",
|
|
21435
21770
|
tabIndex: -1,
|
|
21436
|
-
children: /* @__PURE__ */ jsx29(
|
|
21771
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21437
21772
|
}
|
|
21438
21773
|
);
|
|
21439
21774
|
}
|
|
@@ -21453,7 +21788,7 @@ function UrlOrPageInput({
|
|
|
21453
21788
|
const inputRef = useRef9(null);
|
|
21454
21789
|
const rootRef = useRef9(null);
|
|
21455
21790
|
const [isFocused, setIsFocused] = useState12(false);
|
|
21456
|
-
|
|
21791
|
+
useEffect13(() => {
|
|
21457
21792
|
if (!dropdownOpen) return;
|
|
21458
21793
|
const isOutside = (e) => {
|
|
21459
21794
|
const root = rootRef.current;
|
|
@@ -21661,9 +21996,9 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21661
21996
|
}
|
|
21662
21997
|
|
|
21663
21998
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21664
|
-
import { useCallback as useCallback7, useEffect as
|
|
21999
|
+
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21665
22000
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21666
|
-
import { ArrowLeft as
|
|
22001
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21667
22002
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21668
22003
|
|
|
21669
22004
|
// src/lib/parent-scroll.ts
|
|
@@ -21723,7 +22058,7 @@ function useSectionRects(sectionIdsKey, enabled) {
|
|
|
21723
22058
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
21724
22059
|
[sectionIdsKey]
|
|
21725
22060
|
);
|
|
21726
|
-
|
|
22061
|
+
useEffect14(() => {
|
|
21727
22062
|
if (!enabled || sectionIds.length === 0) {
|
|
21728
22063
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
21729
22064
|
return;
|
|
@@ -21778,12 +22113,12 @@ function SectionPickerOverlay({
|
|
|
21778
22113
|
);
|
|
21779
22114
|
const normalizedTarget = normalizePath(pagePath);
|
|
21780
22115
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
21781
|
-
|
|
22116
|
+
useEffect14(() => {
|
|
21782
22117
|
if (isOnTargetPage) return;
|
|
21783
22118
|
const search = readPreservedSearch();
|
|
21784
22119
|
router.push(`${normalizedTarget}${search}`);
|
|
21785
22120
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
21786
|
-
|
|
22121
|
+
useEffect14(() => {
|
|
21787
22122
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
21788
22123
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
21789
22124
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -21821,7 +22156,7 @@ function SectionPickerOverlay({
|
|
|
21821
22156
|
},
|
|
21822
22157
|
[]
|
|
21823
22158
|
);
|
|
21824
|
-
|
|
22159
|
+
useEffect14(() => {
|
|
21825
22160
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
|
|
21826
22161
|
const next = getIframeVisibleClip({
|
|
21827
22162
|
iframeOffsetTop,
|
|
@@ -21865,12 +22200,12 @@ function SectionPickerOverlay({
|
|
|
21865
22200
|
window.removeEventListener("resize", onResize);
|
|
21866
22201
|
};
|
|
21867
22202
|
}, [applyHoverAt]);
|
|
21868
|
-
|
|
22203
|
+
useEffect14(() => {
|
|
21869
22204
|
const ptr = pointerRef.current;
|
|
21870
22205
|
if (!ptr) return;
|
|
21871
22206
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
21872
22207
|
}, [rects, applyHoverAt]);
|
|
21873
|
-
|
|
22208
|
+
useEffect14(() => {
|
|
21874
22209
|
const rememberPointer = (clientX, clientY) => {
|
|
21875
22210
|
pointerRef.current = { x: clientX, y: clientY };
|
|
21876
22211
|
const top = iframeOffsetTopRef.current;
|
|
@@ -21902,7 +22237,7 @@ function SectionPickerOverlay({
|
|
|
21902
22237
|
},
|
|
21903
22238
|
[selectedId, onSelect]
|
|
21904
22239
|
);
|
|
21905
|
-
|
|
22240
|
+
useEffect14(() => {
|
|
21906
22241
|
const onKeyDown = (e) => {
|
|
21907
22242
|
if (e.key === "Escape") {
|
|
21908
22243
|
e.preventDefault();
|
|
@@ -21940,7 +22275,7 @@ function SectionPickerOverlay({
|
|
|
21940
22275
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
21941
22276
|
onClick: onBack,
|
|
21942
22277
|
children: [
|
|
21943
|
-
/* @__PURE__ */ jsx31(
|
|
22278
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
21944
22279
|
"Back"
|
|
21945
22280
|
]
|
|
21946
22281
|
}
|
|
@@ -22009,7 +22344,7 @@ function SectionPickerOverlay({
|
|
|
22009
22344
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22010
22345
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22011
22346
|
"aria-hidden": true,
|
|
22012
|
-
children: /* @__PURE__ */ jsx31(
|
|
22347
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22013
22348
|
}
|
|
22014
22349
|
) : null
|
|
22015
22350
|
]
|
|
@@ -22025,7 +22360,7 @@ function SectionPickerOverlay({
|
|
|
22025
22360
|
}
|
|
22026
22361
|
|
|
22027
22362
|
// src/ui/link-modal/useLinkModalState.ts
|
|
22028
|
-
import { useCallback as useCallback8, useEffect as
|
|
22363
|
+
import { useCallback as useCallback8, useEffect as useEffect15, useMemo as useMemo3, useState as useState14 } from "react";
|
|
22029
22364
|
function useLinkModalState({
|
|
22030
22365
|
open,
|
|
22031
22366
|
mode,
|
|
@@ -22052,7 +22387,7 @@ function useLinkModalState({
|
|
|
22052
22387
|
setDropdownOpen(false);
|
|
22053
22388
|
setUrlError("");
|
|
22054
22389
|
}, []);
|
|
22055
|
-
|
|
22390
|
+
useEffect15(() => {
|
|
22056
22391
|
if (!open) return;
|
|
22057
22392
|
if (mode === "edit" && initialTarget) {
|
|
22058
22393
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -22218,7 +22553,7 @@ function LinkPopover({
|
|
|
22218
22553
|
onSubmit
|
|
22219
22554
|
});
|
|
22220
22555
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
22221
|
-
|
|
22556
|
+
useEffect16(() => {
|
|
22222
22557
|
if (!open) return;
|
|
22223
22558
|
if (sectionPickerActive) {
|
|
22224
22559
|
postToParent({ type: "ui:unlock" });
|
|
@@ -22393,6 +22728,7 @@ function shouldUseDevFixtures() {
|
|
|
22393
22728
|
function getLogoElement(el) {
|
|
22394
22729
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22395
22730
|
if (marked) return marked;
|
|
22731
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22396
22732
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22397
22733
|
if (!root) return null;
|
|
22398
22734
|
const anchor = el.closest("a");
|
|
@@ -22461,8 +22797,8 @@ function addFooterColumnWithPersist({
|
|
|
22461
22797
|
// src/ui/FloatingPanel.tsx
|
|
22462
22798
|
import {
|
|
22463
22799
|
useCallback as useCallback9,
|
|
22464
|
-
useEffect as
|
|
22465
|
-
useLayoutEffect as
|
|
22800
|
+
useEffect as useEffect17,
|
|
22801
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22466
22802
|
useRef as useRef11,
|
|
22467
22803
|
useState as useState15
|
|
22468
22804
|
} from "react";
|
|
@@ -22545,10 +22881,10 @@ function FloatingPanel({
|
|
|
22545
22881
|
x: clampX(home.x, measured.w),
|
|
22546
22882
|
y: fittedY
|
|
22547
22883
|
};
|
|
22548
|
-
|
|
22884
|
+
useEffect17(() => {
|
|
22549
22885
|
setLiveScroll(parentScroll);
|
|
22550
22886
|
}, [parentScroll]);
|
|
22551
|
-
|
|
22887
|
+
useEffect17(() => {
|
|
22552
22888
|
if (!open) return;
|
|
22553
22889
|
const onParentScroll = (e) => {
|
|
22554
22890
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
@@ -22559,7 +22895,7 @@ function FloatingPanel({
|
|
|
22559
22895
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22560
22896
|
}, [open]);
|
|
22561
22897
|
const positionRef = useRef11(position);
|
|
22562
|
-
|
|
22898
|
+
useLayoutEffect6(() => {
|
|
22563
22899
|
if (!open) {
|
|
22564
22900
|
positionRef.current = position;
|
|
22565
22901
|
return;
|
|
@@ -22569,7 +22905,7 @@ function FloatingPanel({
|
|
|
22569
22905
|
}
|
|
22570
22906
|
positionRef.current = position;
|
|
22571
22907
|
}, [open, position, liveScroll, parentScroll]);
|
|
22572
|
-
|
|
22908
|
+
useLayoutEffect6(() => {
|
|
22573
22909
|
if (!open || !panelRef.current) return;
|
|
22574
22910
|
const el = panelRef.current;
|
|
22575
22911
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22633,11 +22969,11 @@ function FloatingPanel({
|
|
|
22633
22969
|
} catch {
|
|
22634
22970
|
}
|
|
22635
22971
|
}, []);
|
|
22636
|
-
|
|
22972
|
+
useEffect17(() => {
|
|
22637
22973
|
if (open) return;
|
|
22638
22974
|
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22639
22975
|
}, [open]);
|
|
22640
|
-
|
|
22976
|
+
useEffect17(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
|
|
22641
22977
|
if (!open) return null;
|
|
22642
22978
|
return /* @__PURE__ */ jsxs22(
|
|
22643
22979
|
"div",
|
|
@@ -22778,7 +23114,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
22778
23114
|
}
|
|
22779
23115
|
|
|
22780
23116
|
// src/ui/button-style-panel.tsx
|
|
22781
|
-
import { Check as
|
|
23117
|
+
import { Check as Check5 } from "lucide-react";
|
|
22782
23118
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22783
23119
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
22784
23120
|
function ButtonStylePanel({
|
|
@@ -22849,7 +23185,7 @@ function ButtonStylePanel({
|
|
|
22849
23185
|
{
|
|
22850
23186
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
22851
23187
|
"aria-hidden": true,
|
|
22852
|
-
children: /* @__PURE__ */ jsx35(
|
|
23188
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
22853
23189
|
}
|
|
22854
23190
|
) : null
|
|
22855
23191
|
]
|
|
@@ -23157,7 +23493,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
|
|
|
23157
23493
|
}
|
|
23158
23494
|
|
|
23159
23495
|
// src/useNavItemDrag.ts
|
|
23160
|
-
import { useCallback as useCallback10, useEffect as
|
|
23496
|
+
import { useCallback as useCallback10, useEffect as useEffect18, useRef as useRef12, useState as useState16 } from "react";
|
|
23161
23497
|
function useNavItemDrag({
|
|
23162
23498
|
isEditMode,
|
|
23163
23499
|
editContentRef,
|
|
@@ -23390,7 +23726,7 @@ function useNavItemDrag({
|
|
|
23390
23726
|
},
|
|
23391
23727
|
[]
|
|
23392
23728
|
);
|
|
23393
|
-
|
|
23729
|
+
useEffect18(() => {
|
|
23394
23730
|
if (!isEditMode) return;
|
|
23395
23731
|
const THRESHOLD = 10;
|
|
23396
23732
|
const resolveWasSelected = (el) => {
|
|
@@ -23549,7 +23885,7 @@ function useNavItemDrag({
|
|
|
23549
23885
|
}
|
|
23550
23886
|
|
|
23551
23887
|
// src/useSectionDrag.ts
|
|
23552
|
-
import { useCallback as useCallback11, useEffect as
|
|
23888
|
+
import { useCallback as useCallback11, useEffect as useEffect19, useRef as useRef13, useState as useState17 } from "react";
|
|
23553
23889
|
|
|
23554
23890
|
// src/lib/section-dnd.ts
|
|
23555
23891
|
function isFooterSection(el) {
|
|
@@ -23769,7 +24105,7 @@ function useSectionDrag({
|
|
|
23769
24105
|
},
|
|
23770
24106
|
[footerDragRef, navDragRef]
|
|
23771
24107
|
);
|
|
23772
|
-
|
|
24108
|
+
useEffect19(() => {
|
|
23773
24109
|
if (!isEditMode) return;
|
|
23774
24110
|
const onPointerDown = (e) => {
|
|
23775
24111
|
if (e.button !== 0) return;
|
|
@@ -23874,7 +24210,7 @@ function useSectionDrag({
|
|
|
23874
24210
|
}
|
|
23875
24211
|
|
|
23876
24212
|
// src/ui/footer-container-chrome.tsx
|
|
23877
|
-
import { Plus as
|
|
24213
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
23878
24214
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
23879
24215
|
function FooterContainerChrome({
|
|
23880
24216
|
rect,
|
|
@@ -23915,7 +24251,7 @@ function FooterContainerChrome({
|
|
|
23915
24251
|
if (addDisabled) return;
|
|
23916
24252
|
onAdd();
|
|
23917
24253
|
},
|
|
23918
|
-
children: /* @__PURE__ */ jsx36(
|
|
24254
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
23919
24255
|
}
|
|
23920
24256
|
) }),
|
|
23921
24257
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24093,6 +24429,138 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24093
24429
|
return false;
|
|
24094
24430
|
}
|
|
24095
24431
|
|
|
24432
|
+
// src/lib/build-page-sync.ts
|
|
24433
|
+
import { useEffect as useEffect20 } from "react";
|
|
24434
|
+
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24435
|
+
function normalisePath(path) {
|
|
24436
|
+
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
24437
|
+
if (!trimmed || trimmed === "/") return "/";
|
|
24438
|
+
return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
|
|
24439
|
+
}
|
|
24440
|
+
function isDeadPageHref(href, livePaths) {
|
|
24441
|
+
const value = href.trim();
|
|
24442
|
+
if (!value.startsWith("/") || value.startsWith("//")) return false;
|
|
24443
|
+
const path = normalisePath(value);
|
|
24444
|
+
if (path === "/") return false;
|
|
24445
|
+
return !livePaths.some((live) => {
|
|
24446
|
+
const p = normalisePath(live);
|
|
24447
|
+
return p === path || p !== "/" && path.startsWith(`${p}/`);
|
|
24448
|
+
});
|
|
24449
|
+
}
|
|
24450
|
+
var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
24451
|
+
function planBuildPageSync(links, msg) {
|
|
24452
|
+
const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
|
|
24453
|
+
const removed = new Set((msg.removed ?? []).map(normalisePath));
|
|
24454
|
+
const remove = [];
|
|
24455
|
+
const relabel = [];
|
|
24456
|
+
const retarget = [];
|
|
24457
|
+
const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
|
|
24458
|
+
for (const link of links) {
|
|
24459
|
+
const href = link.href.trim();
|
|
24460
|
+
const isPage = href.startsWith("/") && !href.startsWith("//");
|
|
24461
|
+
if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
|
|
24462
|
+
if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
|
|
24463
|
+
else remove.push(link.hrefKey);
|
|
24464
|
+
continue;
|
|
24465
|
+
}
|
|
24466
|
+
if (isPage) {
|
|
24467
|
+
const path = normalisePath(href);
|
|
24468
|
+
const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
|
|
24469
|
+
if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
|
|
24470
|
+
relabel.push({ hrefKey: link.hrefKey, label: rename.label });
|
|
24471
|
+
}
|
|
24472
|
+
continue;
|
|
24473
|
+
}
|
|
24474
|
+
if (href.startsWith("#") || href.startsWith("/#")) {
|
|
24475
|
+
const anchor = href.replace(/^\/?#/u, "").toLowerCase();
|
|
24476
|
+
const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
|
|
24477
|
+
if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
|
|
24478
|
+
relabel.push({ hrefKey: link.hrefKey, label: target.label });
|
|
24479
|
+
}
|
|
24480
|
+
}
|
|
24481
|
+
}
|
|
24482
|
+
return { remove, relabel, retarget };
|
|
24483
|
+
}
|
|
24484
|
+
function linkHref(el) {
|
|
24485
|
+
const key = el.getAttribute("data-ohw-href-key");
|
|
24486
|
+
const stored = key ? getStoredLinkHref(key) : void 0;
|
|
24487
|
+
return stored ?? el.getAttribute("href") ?? "";
|
|
24488
|
+
}
|
|
24489
|
+
function labelEl(anchor) {
|
|
24490
|
+
return anchor.querySelector('[data-ohw-editable="text"]');
|
|
24491
|
+
}
|
|
24492
|
+
function collectLinks() {
|
|
24493
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24494
|
+
const links = [];
|
|
24495
|
+
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
24496
|
+
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
24497
|
+
if (seen.has(hrefKey)) return;
|
|
24498
|
+
const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
24499
|
+
if (!area) return;
|
|
24500
|
+
const label = labelEl(el);
|
|
24501
|
+
if (!label && area !== "chrome") return;
|
|
24502
|
+
seen.add(hrefKey);
|
|
24503
|
+
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
24504
|
+
});
|
|
24505
|
+
return links;
|
|
24506
|
+
}
|
|
24507
|
+
function applyBuildPageSync(msg, deps) {
|
|
24508
|
+
const plan = planBuildPageSync(collectLinks(), msg);
|
|
24509
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
24510
|
+
for (const hrefKey of plan.remove) {
|
|
24511
|
+
const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
24512
|
+
if (!anchor) continue;
|
|
24513
|
+
const nav = isNavbarHrefKey(hrefKey);
|
|
24514
|
+
const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
|
|
24515
|
+
if (!result) continue;
|
|
24516
|
+
for (const key of result.removedKeys) {
|
|
24517
|
+
nodes.set(key, "");
|
|
24518
|
+
clearStoredLinkHref(key);
|
|
24519
|
+
}
|
|
24520
|
+
nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
|
|
24521
|
+
}
|
|
24522
|
+
for (const { hrefKey, label } of plan.relabel) {
|
|
24523
|
+
const labelKey = hrefKey.replace(/-href$/u, "-label");
|
|
24524
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24525
|
+
const el = labelEl(anchor);
|
|
24526
|
+
if (el) el.textContent = label;
|
|
24527
|
+
});
|
|
24528
|
+
nodes.set(labelKey, label);
|
|
24529
|
+
}
|
|
24530
|
+
for (const { hrefKey, href } of plan.retarget) {
|
|
24531
|
+
setStoredLinkHref(hrefKey, href);
|
|
24532
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24533
|
+
if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
|
|
24534
|
+
});
|
|
24535
|
+
nodes.set(hrefKey, href);
|
|
24536
|
+
}
|
|
24537
|
+
if (nodes.size === 0) return 0;
|
|
24538
|
+
deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
|
|
24539
|
+
deps.postToParent({
|
|
24540
|
+
type: "ow:change",
|
|
24541
|
+
nodes: [...nodes].map(([key, text]) => ({ key, text }))
|
|
24542
|
+
});
|
|
24543
|
+
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24544
|
+
}
|
|
24545
|
+
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24546
|
+
useEffect20(() => {
|
|
24547
|
+
if (!isEditMode) return;
|
|
24548
|
+
const onMessage = (e) => {
|
|
24549
|
+
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
24550
|
+
const changed = applyBuildPageSync(e.data, {
|
|
24551
|
+
getEditContent: () => editContentRef.current,
|
|
24552
|
+
setEditContent: (next) => {
|
|
24553
|
+
editContentRef.current = next;
|
|
24554
|
+
},
|
|
24555
|
+
postToParent: postToParent2
|
|
24556
|
+
});
|
|
24557
|
+
postToParent2({ type: "ow:pages-synced", changed });
|
|
24558
|
+
};
|
|
24559
|
+
window.addEventListener("message", onMessage);
|
|
24560
|
+
return () => window.removeEventListener("message", onMessage);
|
|
24561
|
+
}, [isEditMode, editContentRef, postToParent2]);
|
|
24562
|
+
}
|
|
24563
|
+
|
|
24096
24564
|
// src/lib/nav-page-sync.ts
|
|
24097
24565
|
function labelKeyFor(hrefKey) {
|
|
24098
24566
|
return hrefKey.replace(/-href$/, "-label");
|
|
@@ -24190,7 +24658,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24190
24658
|
}
|
|
24191
24659
|
|
|
24192
24660
|
// src/ui/navbar-container-chrome.tsx
|
|
24193
|
-
import { Plus as
|
|
24661
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24194
24662
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24195
24663
|
function NavbarContainerChrome({
|
|
24196
24664
|
rect,
|
|
@@ -24226,7 +24694,7 @@ function NavbarContainerChrome({
|
|
|
24226
24694
|
e.stopPropagation();
|
|
24227
24695
|
onAdd();
|
|
24228
24696
|
},
|
|
24229
|
-
children: /* @__PURE__ */ jsx37(
|
|
24697
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24230
24698
|
}
|
|
24231
24699
|
)
|
|
24232
24700
|
}
|
|
@@ -24298,7 +24766,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24298
24766
|
}
|
|
24299
24767
|
|
|
24300
24768
|
// src/OhhwellsBridge.tsx
|
|
24301
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
24769
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
|
|
24302
24770
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24303
24771
|
var PRIMARY7 = "#0885FE";
|
|
24304
24772
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25076,7 +25544,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25076
25544
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25077
25545
|
return resolveFooterLinksContainerFrom(el);
|
|
25078
25546
|
}
|
|
25079
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25547
|
+
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)) {
|
|
25080
25548
|
return getNavigationRoot(el);
|
|
25081
25549
|
}
|
|
25082
25550
|
return null;
|
|
@@ -25298,7 +25766,6 @@ var ICONS = {
|
|
|
25298
25766
|
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"/>',
|
|
25299
25767
|
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"/>'
|
|
25300
25768
|
};
|
|
25301
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25302
25769
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25303
25770
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25304
25771
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25396,7 +25863,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25396
25863
|
el.style.top = `${top}px`;
|
|
25397
25864
|
el.style.height = `${height}px`;
|
|
25398
25865
|
}
|
|
25399
|
-
var
|
|
25866
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25400
25867
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25401
25868
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25402
25869
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25423,8 +25890,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25423
25890
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25424
25891
|
const half = toolbarWidth / 2;
|
|
25425
25892
|
return Math.max(
|
|
25426
|
-
|
|
25427
|
-
Math.min(centerX, window.innerWidth -
|
|
25893
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
25894
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25428
25895
|
);
|
|
25429
25896
|
}
|
|
25430
25897
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25798,7 +26265,7 @@ function OhhwellsBridge() {
|
|
|
25798
26265
|
const searchParams = useSearchParams();
|
|
25799
26266
|
const isEditMode = isEditSessionActive();
|
|
25800
26267
|
const [bridgeRoot, setBridgeRoot] = useState18(null);
|
|
25801
|
-
|
|
26268
|
+
useEffect21(() => {
|
|
25802
26269
|
const figtreeFontId = "ohw-figtree-font";
|
|
25803
26270
|
if (!document.getElementById(figtreeFontId)) {
|
|
25804
26271
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25825,7 +26292,7 @@ function OhhwellsBridge() {
|
|
|
25825
26292
|
}, []);
|
|
25826
26293
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25827
26294
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
25828
|
-
|
|
26295
|
+
useLayoutEffect7(() => {
|
|
25829
26296
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25830
26297
|
if (next !== subdomain) setSubdomain(next);
|
|
25831
26298
|
if (next) return;
|
|
@@ -25837,7 +26304,7 @@ function OhhwellsBridge() {
|
|
|
25837
26304
|
}, 0);
|
|
25838
26305
|
return () => window.clearTimeout(t);
|
|
25839
26306
|
}, [subdomainFromQuery, subdomain]);
|
|
25840
|
-
|
|
26307
|
+
useEffect21(() => {
|
|
25841
26308
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
25842
26309
|
const url = new URL(window.location.href);
|
|
25843
26310
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -25849,6 +26316,7 @@ function OhhwellsBridge() {
|
|
|
25849
26316
|
useSavedLinkNavigation(isEditMode);
|
|
25850
26317
|
useNavDropdownToggle(isEditMode);
|
|
25851
26318
|
useHashLinkScroll(isEditMode);
|
|
26319
|
+
usePublishedPlaceholderStrip(isEditMode);
|
|
25852
26320
|
const postToParent2 = useCallback12((data) => {
|
|
25853
26321
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
25854
26322
|
window.parent.postMessage(data, "*");
|
|
@@ -25857,14 +26325,14 @@ function OhhwellsBridge() {
|
|
|
25857
26325
|
const [fetchState, setFetchState] = useState18("idle");
|
|
25858
26326
|
const [showBranding, setShowBranding] = useState18(false);
|
|
25859
26327
|
const autoSaveTimers = useRef14(/* @__PURE__ */ new Map());
|
|
25860
|
-
|
|
26328
|
+
useEffect21(() => {
|
|
25861
26329
|
stampBridgeVersionOnDocument();
|
|
25862
26330
|
}, []);
|
|
25863
|
-
|
|
26331
|
+
useEffect21(() => {
|
|
25864
26332
|
if (isEditMode) return;
|
|
25865
26333
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
25866
26334
|
}, [isEditMode, subdomain, fetchState]);
|
|
25867
|
-
|
|
26335
|
+
useEffect21(() => {
|
|
25868
26336
|
if (isEditMode || !subdomain) return;
|
|
25869
26337
|
const onError = (event) => {
|
|
25870
26338
|
reportOutageBeacon({
|
|
@@ -26005,7 +26473,7 @@ function OhhwellsBridge() {
|
|
|
26005
26473
|
}, []);
|
|
26006
26474
|
const selectMediaElementRef = useRef14(selectMediaElement);
|
|
26007
26475
|
selectMediaElementRef.current = selectMediaElement;
|
|
26008
|
-
|
|
26476
|
+
useEffect21(() => {
|
|
26009
26477
|
if (!selectedMedia) return;
|
|
26010
26478
|
const update = () => {
|
|
26011
26479
|
const el = selectedMediaElRef.current;
|
|
@@ -26220,7 +26688,7 @@ function OhhwellsBridge() {
|
|
|
26220
26688
|
const [fieldDragging, setFieldDragging] = useState18(false);
|
|
26221
26689
|
const clearFormPickRef = useRef14(clearFormPick);
|
|
26222
26690
|
clearFormPickRef.current = clearFormPick;
|
|
26223
|
-
|
|
26691
|
+
useEffect21(() => {
|
|
26224
26692
|
const el = fieldPickElRef.current;
|
|
26225
26693
|
if (!el || fieldPickRect === null) return;
|
|
26226
26694
|
const observer = new ResizeObserver(() => {
|
|
@@ -26229,7 +26697,7 @@ function OhhwellsBridge() {
|
|
|
26229
26697
|
observer.observe(el);
|
|
26230
26698
|
return () => observer.disconnect();
|
|
26231
26699
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26232
|
-
|
|
26700
|
+
useEffect21(() => {
|
|
26233
26701
|
const el = formPickElRef.current;
|
|
26234
26702
|
if (!el || formPickRect === null) return;
|
|
26235
26703
|
const observer = new ResizeObserver(() => {
|
|
@@ -26256,7 +26724,7 @@ function OhhwellsBridge() {
|
|
|
26256
26724
|
const hoveredItemElRef = useRef14(null);
|
|
26257
26725
|
const [hoveredItemRect, setHoveredItemRect] = useState18(null);
|
|
26258
26726
|
const [hoveredTextRect, setHoveredTextRect] = useState18(null);
|
|
26259
|
-
|
|
26727
|
+
useEffect21(() => {
|
|
26260
26728
|
const sync = () => {
|
|
26261
26729
|
const el = document.querySelector(
|
|
26262
26730
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26306,21 +26774,6 @@ function OhhwellsBridge() {
|
|
|
26306
26774
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26307
26775
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26308
26776
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26309
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26310
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26311
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26312
|
-
const floatingPanelRef = useRef14(null);
|
|
26313
|
-
floatingPanelRef.current = floatingPanel;
|
|
26314
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26315
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26316
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26317
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26318
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26319
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26320
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26321
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26322
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26323
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26324
26777
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26325
26778
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26326
26779
|
const footerDragRef = useRef14(null);
|
|
@@ -26334,6 +26787,7 @@ function OhhwellsBridge() {
|
|
|
26334
26787
|
const linkPopoverSessionRef = useRef14(null);
|
|
26335
26788
|
const addNavAfterAnchorRef = useRef14(null);
|
|
26336
26789
|
const editContentRef = useRef14({});
|
|
26790
|
+
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
26337
26791
|
const aiSectionsRef = useRef14("");
|
|
26338
26792
|
const aiFooterRef = useRef14("");
|
|
26339
26793
|
const applyTreeLocalRef = useRef14(
|
|
@@ -26346,6 +26800,21 @@ function OhhwellsBridge() {
|
|
|
26346
26800
|
const stylesRef = useRef14("");
|
|
26347
26801
|
const appliedDrawerRef = useRef14(null);
|
|
26348
26802
|
const pendingDeleteUndoRef = useRef14(null);
|
|
26803
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26804
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
26805
|
+
const floatingPanelRef = useRef14(null);
|
|
26806
|
+
floatingPanelRef.current = floatingPanel;
|
|
26807
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
26808
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26809
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
26810
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
26811
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26812
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26813
|
+
const buttonPointerDragRef = useRef14(null);
|
|
26814
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26815
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26816
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26817
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26349
26818
|
const [sitePages, setSitePages] = useState18([]);
|
|
26350
26819
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26351
26820
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26355,8 +26824,19 @@ function OhhwellsBridge() {
|
|
|
26355
26824
|
const linkPopoverOpenRef = useRef14(false);
|
|
26356
26825
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26357
26826
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26827
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26358
26828
|
linkPopoverSessionRef.current = linkPopover;
|
|
26359
|
-
|
|
26829
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26830
|
+
useEffect21(() => {
|
|
26831
|
+
const syncViewport = () => {
|
|
26832
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26833
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26834
|
+
};
|
|
26835
|
+
syncViewport();
|
|
26836
|
+
window.addEventListener("resize", syncViewport);
|
|
26837
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26838
|
+
}, []);
|
|
26839
|
+
useEffect21(() => {
|
|
26360
26840
|
setSectionOrderPersistHandler((entries) => {
|
|
26361
26841
|
const currentPath = window.location.pathname;
|
|
26362
26842
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26366,7 +26846,7 @@ function OhhwellsBridge() {
|
|
|
26366
26846
|
});
|
|
26367
26847
|
return () => setSectionOrderPersistHandler(null);
|
|
26368
26848
|
}, []);
|
|
26369
|
-
|
|
26849
|
+
useEffect21(() => {
|
|
26370
26850
|
setAiFooterMountOptions({
|
|
26371
26851
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26372
26852
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26450,7 +26930,7 @@ function OhhwellsBridge() {
|
|
|
26450
26930
|
}, [isEditMode, pathname]);
|
|
26451
26931
|
const runSectionsPrefetchRef = useRef14(runSectionsPrefetch);
|
|
26452
26932
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26453
|
-
|
|
26933
|
+
useEffect21(() => {
|
|
26454
26934
|
if (!linkPopover) {
|
|
26455
26935
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26456
26936
|
return;
|
|
@@ -26478,7 +26958,7 @@ function OhhwellsBridge() {
|
|
|
26478
26958
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26479
26959
|
};
|
|
26480
26960
|
}, [linkPopover, postToParent2]);
|
|
26481
|
-
|
|
26961
|
+
useEffect21(() => {
|
|
26482
26962
|
if (!isEditMode) return;
|
|
26483
26963
|
const useFixtures = shouldUseDevFixtures();
|
|
26484
26964
|
if (useFixtures) {
|
|
@@ -26504,7 +26984,7 @@ function OhhwellsBridge() {
|
|
|
26504
26984
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26505
26985
|
return () => window.removeEventListener("message", onSitePages);
|
|
26506
26986
|
}, [isEditMode, postToParent2]);
|
|
26507
|
-
|
|
26987
|
+
useEffect21(() => {
|
|
26508
26988
|
if (!isEditMode) return;
|
|
26509
26989
|
const deps = {
|
|
26510
26990
|
getEditContent: () => editContentRef.current,
|
|
@@ -26541,14 +27021,14 @@ function OhhwellsBridge() {
|
|
|
26541
27021
|
window.addEventListener("message", onPageMessage);
|
|
26542
27022
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26543
27023
|
}, [isEditMode, postToParent2]);
|
|
26544
|
-
|
|
27024
|
+
useEffect21(() => {
|
|
26545
27025
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26546
27026
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26547
27027
|
if (Object.keys(manifest).length === 0) return;
|
|
26548
27028
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26549
27029
|
});
|
|
26550
27030
|
}, [isEditMode]);
|
|
26551
|
-
|
|
27031
|
+
useEffect21(() => {
|
|
26552
27032
|
const update = () => {
|
|
26553
27033
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26554
27034
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27807,7 +28287,7 @@ function OhhwellsBridge() {
|
|
|
27807
28287
|
},
|
|
27808
28288
|
[postToParent2]
|
|
27809
28289
|
);
|
|
27810
|
-
|
|
28290
|
+
useEffect21(() => {
|
|
27811
28291
|
const onDragOver = (e) => {
|
|
27812
28292
|
const dragged = buttonCollectionDragRef.current;
|
|
27813
28293
|
if (!dragged) return;
|
|
@@ -27878,7 +28358,7 @@ function OhhwellsBridge() {
|
|
|
27878
28358
|
setLogoSizeDraft(null);
|
|
27879
28359
|
deselectRef.current();
|
|
27880
28360
|
}, []);
|
|
27881
|
-
|
|
28361
|
+
useEffect21(() => {
|
|
27882
28362
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
27883
28363
|
if (!session || !logoSizeDraft) {
|
|
27884
28364
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28036,7 +28516,7 @@ function OhhwellsBridge() {
|
|
|
28036
28516
|
deselectRef.current = deselect;
|
|
28037
28517
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28038
28518
|
const lastSiteWideScopeRef = useRef14(null);
|
|
28039
|
-
|
|
28519
|
+
useEffect21(() => {
|
|
28040
28520
|
if (!isEditMode) {
|
|
28041
28521
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28042
28522
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28062,7 +28542,7 @@ function OhhwellsBridge() {
|
|
|
28062
28542
|
isFooterFrameSelection,
|
|
28063
28543
|
postToParent2
|
|
28064
28544
|
]);
|
|
28065
|
-
|
|
28545
|
+
useLayoutEffect7(() => {
|
|
28066
28546
|
if (!subdomain || isEditMode) {
|
|
28067
28547
|
setFetchState("done");
|
|
28068
28548
|
return;
|
|
@@ -28089,6 +28569,7 @@ function OhhwellsBridge() {
|
|
|
28089
28569
|
applyAiFooterFromContent(content);
|
|
28090
28570
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28091
28571
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28572
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28092
28573
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28093
28574
|
}
|
|
28094
28575
|
applyBrandChrome(content);
|
|
@@ -28099,15 +28580,16 @@ function OhhwellsBridge() {
|
|
|
28099
28580
|
if (key === "__ohw_sections") continue;
|
|
28100
28581
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28101
28582
|
if (key === AI_FOOTER_KEY) continue;
|
|
28583
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28584
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28102
28585
|
if (key === BRAND_KIT_KEY) continue;
|
|
28103
28586
|
if (key === STYLE_STORE_KEY) continue;
|
|
28104
28587
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28105
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28106
28588
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28107
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28108
28589
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28109
28590
|
continue;
|
|
28110
28591
|
}
|
|
28592
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28111
28593
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28112
28594
|
if (applyCarouselNode(key, val)) continue;
|
|
28113
28595
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28147,6 +28629,7 @@ function OhhwellsBridge() {
|
|
|
28147
28629
|
});
|
|
28148
28630
|
applyLinkByKey(key, val);
|
|
28149
28631
|
}
|
|
28632
|
+
applySectionEmbeds(content);
|
|
28150
28633
|
applyLogoFromContent(content);
|
|
28151
28634
|
applyLogoSizes(content);
|
|
28152
28635
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28213,7 +28696,7 @@ function OhhwellsBridge() {
|
|
|
28213
28696
|
cancelled = true;
|
|
28214
28697
|
};
|
|
28215
28698
|
}, [subdomain, isEditMode]);
|
|
28216
|
-
|
|
28699
|
+
useEffect21(() => {
|
|
28217
28700
|
if (!isEditMode) return;
|
|
28218
28701
|
const resolveIndex = (form, clientY) => {
|
|
28219
28702
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28254,7 +28737,7 @@ function OhhwellsBridge() {
|
|
|
28254
28737
|
window.removeEventListener("drop", onDrop, true);
|
|
28255
28738
|
};
|
|
28256
28739
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28257
|
-
|
|
28740
|
+
useEffect21(() => {
|
|
28258
28741
|
if (!isEditMode) return;
|
|
28259
28742
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28260
28743
|
markFormFields(form);
|
|
@@ -28266,7 +28749,7 @@ function OhhwellsBridge() {
|
|
|
28266
28749
|
});
|
|
28267
28750
|
return () => observer.disconnect();
|
|
28268
28751
|
}, [isEditMode, fetchState, pathname]);
|
|
28269
|
-
|
|
28752
|
+
useEffect21(() => {
|
|
28270
28753
|
if (!isEditMode) return;
|
|
28271
28754
|
let saveTimer = null;
|
|
28272
28755
|
const onInput = (e) => {
|
|
@@ -28288,14 +28771,14 @@ function OhhwellsBridge() {
|
|
|
28288
28771
|
document.addEventListener("input", onInput, true);
|
|
28289
28772
|
return () => document.removeEventListener("input", onInput, true);
|
|
28290
28773
|
}, [isEditMode, persistFields]);
|
|
28291
|
-
|
|
28774
|
+
useEffect21(() => {
|
|
28292
28775
|
if (isEditMode || fetchState !== "done") return;
|
|
28293
28776
|
const content = contentCache.get(subdomain) ?? {};
|
|
28294
28777
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28295
28778
|
reconcileFieldsFromContent(form, content);
|
|
28296
28779
|
});
|
|
28297
28780
|
}, [isEditMode, fetchState, subdomain]);
|
|
28298
|
-
|
|
28781
|
+
useEffect21(() => {
|
|
28299
28782
|
if (!isEditMode) return;
|
|
28300
28783
|
const swallow = (e) => {
|
|
28301
28784
|
const target = e.target;
|
|
@@ -28304,14 +28787,14 @@ function OhhwellsBridge() {
|
|
|
28304
28787
|
document.addEventListener("submit", swallow, true);
|
|
28305
28788
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28306
28789
|
}, [isEditMode]);
|
|
28307
|
-
|
|
28790
|
+
useEffect21(() => {
|
|
28308
28791
|
if (isEditMode || fetchState !== "done") return;
|
|
28309
28792
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28310
28793
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28311
28794
|
console.log({ apiUrl, subdomain });
|
|
28312
28795
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28313
28796
|
}, [isEditMode, fetchState, subdomain]);
|
|
28314
|
-
|
|
28797
|
+
useEffect21(() => {
|
|
28315
28798
|
if (!subdomain || isEditMode) return;
|
|
28316
28799
|
let debounceTimer = null;
|
|
28317
28800
|
let observer = null;
|
|
@@ -28335,20 +28818,22 @@ function OhhwellsBridge() {
|
|
|
28335
28818
|
}
|
|
28336
28819
|
applyAiFooterFromContent(content);
|
|
28337
28820
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28821
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28338
28822
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28339
28823
|
}
|
|
28340
28824
|
for (const [key, val] of Object.entries(content)) {
|
|
28341
28825
|
if (key === "__ohw_sections") continue;
|
|
28342
28826
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28343
28827
|
if (key === AI_FOOTER_KEY) continue;
|
|
28828
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28829
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28344
28830
|
if (key === BRAND_KIT_KEY) continue;
|
|
28345
28831
|
if (key === STYLE_STORE_KEY) continue;
|
|
28346
28832
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28347
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28348
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28349
28833
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28350
28834
|
continue;
|
|
28351
28835
|
}
|
|
28836
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28352
28837
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28353
28838
|
if (applyCarouselNode(key, val)) continue;
|
|
28354
28839
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28373,6 +28858,7 @@ function OhhwellsBridge() {
|
|
|
28373
28858
|
});
|
|
28374
28859
|
applyLinkByKey(key, val);
|
|
28375
28860
|
}
|
|
28861
|
+
applySectionEmbeds(content);
|
|
28376
28862
|
applyLogoFromContent(content);
|
|
28377
28863
|
reconcileNavbarItemsFromContent(content);
|
|
28378
28864
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28428,16 +28914,16 @@ function OhhwellsBridge() {
|
|
|
28428
28914
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28429
28915
|
};
|
|
28430
28916
|
}, [subdomain, isEditMode, pathname]);
|
|
28431
|
-
|
|
28917
|
+
useLayoutEffect7(() => {
|
|
28432
28918
|
const el = document.getElementById("ohw-loader");
|
|
28433
28919
|
if (!el) return;
|
|
28434
28920
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28435
28921
|
el.style.display = visible ? "flex" : "none";
|
|
28436
28922
|
}, [subdomain, fetchState]);
|
|
28437
|
-
|
|
28923
|
+
useEffect21(() => {
|
|
28438
28924
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28439
28925
|
}, [pathname, postToParent2]);
|
|
28440
|
-
|
|
28926
|
+
useEffect21(() => {
|
|
28441
28927
|
if (!subdomain || isEditMode) return;
|
|
28442
28928
|
const content = contentCache.get(subdomain);
|
|
28443
28929
|
if (!content) return;
|
|
@@ -28455,7 +28941,7 @@ function OhhwellsBridge() {
|
|
|
28455
28941
|
}
|
|
28456
28942
|
applyAiFooterFromContent(content);
|
|
28457
28943
|
}, [pathname, subdomain, isEditMode]);
|
|
28458
|
-
|
|
28944
|
+
useEffect21(() => {
|
|
28459
28945
|
if (!isEditMode) return;
|
|
28460
28946
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28461
28947
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28463,12 +28949,12 @@ function OhhwellsBridge() {
|
|
|
28463
28949
|
deselectRef.current();
|
|
28464
28950
|
deactivateRef.current();
|
|
28465
28951
|
}, [pathname, isEditMode]);
|
|
28466
|
-
|
|
28952
|
+
useEffect21(() => {
|
|
28467
28953
|
if (!isEditMode) return;
|
|
28468
28954
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28469
28955
|
initItemInstancesFromContent(editContentRef.current);
|
|
28470
28956
|
}, [pathname, isEditMode]);
|
|
28471
|
-
|
|
28957
|
+
useEffect21(() => {
|
|
28472
28958
|
if (!isEditMode) return;
|
|
28473
28959
|
const observer = new MutationObserver(() => {
|
|
28474
28960
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28479,7 +28965,7 @@ function OhhwellsBridge() {
|
|
|
28479
28965
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28480
28966
|
return () => observer.disconnect();
|
|
28481
28967
|
}, [isEditMode, pathname]);
|
|
28482
|
-
|
|
28968
|
+
useEffect21(() => {
|
|
28483
28969
|
const contentForNav = () => {
|
|
28484
28970
|
if (isEditMode) return editContentRef.current;
|
|
28485
28971
|
if (!subdomain) return {};
|
|
@@ -28552,7 +29038,7 @@ function OhhwellsBridge() {
|
|
|
28552
29038
|
observer?.disconnect();
|
|
28553
29039
|
};
|
|
28554
29040
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28555
|
-
|
|
29041
|
+
useEffect21(() => {
|
|
28556
29042
|
if (!isEditMode) return;
|
|
28557
29043
|
let applying = false;
|
|
28558
29044
|
let rafId = null;
|
|
@@ -28590,7 +29076,7 @@ function OhhwellsBridge() {
|
|
|
28590
29076
|
observer.disconnect();
|
|
28591
29077
|
};
|
|
28592
29078
|
}, [isEditMode, pathname]);
|
|
28593
|
-
|
|
29079
|
+
useEffect21(() => {
|
|
28594
29080
|
if (!isEditMode) return;
|
|
28595
29081
|
let lastPosted = 0;
|
|
28596
29082
|
const measure = () => {
|
|
@@ -28612,29 +29098,14 @@ function OhhwellsBridge() {
|
|
|
28612
29098
|
const t2 = setTimeout(measure, 500);
|
|
28613
29099
|
const ro = new ResizeObserver(schedule);
|
|
28614
29100
|
ro.observe(document.body);
|
|
28615
|
-
let lastWidth = window.innerWidth;
|
|
28616
|
-
let resizeTimers = [];
|
|
28617
|
-
const clearResizeTimers = () => {
|
|
28618
|
-
resizeTimers.forEach(clearTimeout);
|
|
28619
|
-
resizeTimers = [];
|
|
28620
|
-
};
|
|
28621
|
-
const handleResize = () => {
|
|
28622
|
-
if (window.innerWidth === lastWidth) return;
|
|
28623
|
-
lastWidth = window.innerWidth;
|
|
28624
|
-
clearResizeTimers();
|
|
28625
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
28626
|
-
};
|
|
28627
|
-
window.addEventListener("resize", handleResize);
|
|
28628
29101
|
return () => {
|
|
28629
29102
|
clearTimeout(t1);
|
|
28630
29103
|
clearTimeout(t2);
|
|
28631
29104
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28632
29105
|
ro.disconnect();
|
|
28633
|
-
clearResizeTimers();
|
|
28634
|
-
window.removeEventListener("resize", handleResize);
|
|
28635
29106
|
};
|
|
28636
29107
|
}, [pathname, isEditMode, postToParent2]);
|
|
28637
|
-
|
|
29108
|
+
useEffect21(() => {
|
|
28638
29109
|
if (isEditMode) return;
|
|
28639
29110
|
const handleClick = (e) => {
|
|
28640
29111
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28648,7 +29119,7 @@ function OhhwellsBridge() {
|
|
|
28648
29119
|
document.addEventListener("click", handleClick, true);
|
|
28649
29120
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28650
29121
|
}, [isEditMode, router, pathname]);
|
|
28651
|
-
|
|
29122
|
+
useEffect21(() => {
|
|
28652
29123
|
if (!isEditMode) {
|
|
28653
29124
|
editStylesRef.current?.base.remove();
|
|
28654
29125
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -28928,6 +29399,13 @@ function OhhwellsBridge() {
|
|
|
28928
29399
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
28929
29400
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
28930
29401
|
if (isInsideLinkEditor(target)) return;
|
|
29402
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29403
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29404
|
+
if (target.closest(
|
|
29405
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29406
|
+
)) {
|
|
29407
|
+
return;
|
|
29408
|
+
}
|
|
28931
29409
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
28932
29410
|
clearMediaSelectionRef.current();
|
|
28933
29411
|
}
|
|
@@ -28951,8 +29429,6 @@ function OhhwellsBridge() {
|
|
|
28951
29429
|
return;
|
|
28952
29430
|
}
|
|
28953
29431
|
}
|
|
28954
|
-
if (isInsideFloatingPanel(target)) return;
|
|
28955
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
28956
29432
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
28957
29433
|
if (collectionItem) {
|
|
28958
29434
|
e.preventDefault();
|
|
@@ -28964,11 +29440,6 @@ function OhhwellsBridge() {
|
|
|
28964
29440
|
});
|
|
28965
29441
|
return;
|
|
28966
29442
|
}
|
|
28967
|
-
if (target.closest(
|
|
28968
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
28969
|
-
)) {
|
|
28970
|
-
return;
|
|
28971
|
-
}
|
|
28972
29443
|
{
|
|
28973
29444
|
const formEl = getFormElement(target);
|
|
28974
29445
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29122,9 +29593,13 @@ function OhhwellsBridge() {
|
|
|
29122
29593
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29123
29594
|
e.preventDefault();
|
|
29124
29595
|
e.stopPropagation();
|
|
29125
|
-
selectIconElementRef.current(editable);
|
|
29126
29596
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29127
29597
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29598
|
+
if (aiIcon) {
|
|
29599
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29600
|
+
} else {
|
|
29601
|
+
selectIconElementRef.current(editable);
|
|
29602
|
+
}
|
|
29128
29603
|
postToParentRef.current({
|
|
29129
29604
|
type: "ow:icon-pick",
|
|
29130
29605
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29352,6 +29827,9 @@ function OhhwellsBridge() {
|
|
|
29352
29827
|
setHoveredItemRect(null);
|
|
29353
29828
|
hoveredNavContainerRef.current = null;
|
|
29354
29829
|
setHoveredNavContainerRect(null);
|
|
29830
|
+
siblingHintElRef.current = null;
|
|
29831
|
+
setSiblingHintRect(null);
|
|
29832
|
+
setSiblingHintRects([]);
|
|
29355
29833
|
return;
|
|
29356
29834
|
}
|
|
29357
29835
|
{
|
|
@@ -29472,7 +29950,6 @@ function OhhwellsBridge() {
|
|
|
29472
29950
|
hoveredNavContainerRef.current = null;
|
|
29473
29951
|
setHoveredNavContainerRect(null);
|
|
29474
29952
|
hoveredItemElRef.current = editable;
|
|
29475
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29476
29953
|
}
|
|
29477
29954
|
}
|
|
29478
29955
|
}
|
|
@@ -30182,7 +30659,11 @@ function OhhwellsBridge() {
|
|
|
30182
30659
|
};
|
|
30183
30660
|
const handleMouseMove = (e) => {
|
|
30184
30661
|
const { clientX, clientY } = e;
|
|
30185
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30662
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30663
|
+
dismissImageHover();
|
|
30664
|
+
clearImageHover();
|
|
30665
|
+
return;
|
|
30666
|
+
}
|
|
30186
30667
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30187
30668
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30188
30669
|
formHoverElRef.current = null;
|
|
@@ -30211,7 +30692,12 @@ function OhhwellsBridge() {
|
|
|
30211
30692
|
setHoveredItemRect(null);
|
|
30212
30693
|
hoveredNavContainerRef.current = null;
|
|
30213
30694
|
setHoveredNavContainerRect(null);
|
|
30695
|
+
siblingHintElRef.current = null;
|
|
30696
|
+
setSiblingHintRect(null);
|
|
30697
|
+
setSiblingHintRects([]);
|
|
30214
30698
|
dismissImageHover();
|
|
30699
|
+
clearImageHover();
|
|
30700
|
+
setSectionGap(null);
|
|
30215
30701
|
return;
|
|
30216
30702
|
}
|
|
30217
30703
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30223,7 +30709,11 @@ function OhhwellsBridge() {
|
|
|
30223
30709
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30224
30710
|
const { clientX, clientY } = e.data;
|
|
30225
30711
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30226
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30712
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30713
|
+
dismissImageHover();
|
|
30714
|
+
clearImageHover();
|
|
30715
|
+
return;
|
|
30716
|
+
}
|
|
30227
30717
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30228
30718
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30229
30719
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30603,6 +31093,7 @@ function OhhwellsBridge() {
|
|
|
30603
31093
|
applyAiFooterFromContent(content);
|
|
30604
31094
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30605
31095
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31096
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30606
31097
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30607
31098
|
}
|
|
30608
31099
|
applyBrandChrome(content);
|
|
@@ -30617,15 +31108,16 @@ function OhhwellsBridge() {
|
|
|
30617
31108
|
}
|
|
30618
31109
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30619
31110
|
if (key === AI_FOOTER_KEY) continue;
|
|
31111
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31112
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30620
31113
|
if (key === BRAND_KIT_KEY) continue;
|
|
30621
31114
|
if (key === STYLE_STORE_KEY) continue;
|
|
30622
31115
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30623
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30624
31116
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30625
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30626
31117
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30627
31118
|
continue;
|
|
30628
31119
|
}
|
|
31120
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30629
31121
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30630
31122
|
if (applyCarouselNode(key, val)) continue;
|
|
30631
31123
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30651,6 +31143,7 @@ function OhhwellsBridge() {
|
|
|
30651
31143
|
});
|
|
30652
31144
|
applyLinkByKey(key, val);
|
|
30653
31145
|
}
|
|
31146
|
+
applySectionEmbeds(content);
|
|
30654
31147
|
applyLogoFromContent(content);
|
|
30655
31148
|
applyLogoSizes(content);
|
|
30656
31149
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -30878,6 +31371,31 @@ function OhhwellsBridge() {
|
|
|
30878
31371
|
postAiSectionsChanged();
|
|
30879
31372
|
};
|
|
30880
31373
|
window.addEventListener("message", handleAiDeleteSection);
|
|
31374
|
+
const handleAiMoveSection = (e) => {
|
|
31375
|
+
if (e.data?.type !== "ow:ai-move-section") return;
|
|
31376
|
+
const sectionId = typeof e.data.sectionId === "string" ? e.data.sectionId : "";
|
|
31377
|
+
const targetPage = typeof e.data.targetPage === "string" ? e.data.targetPage : "";
|
|
31378
|
+
if (!sectionId || !targetPage) return;
|
|
31379
|
+
const previous = aiSectionsRef.current;
|
|
31380
|
+
const nextState = moveSectionInState(parseAiSectionsState(previous), sectionId, targetPage);
|
|
31381
|
+
if (!nextState) return;
|
|
31382
|
+
clearInteractionChrome();
|
|
31383
|
+
const nextValue = serializeAiSectionsState(nextState);
|
|
31384
|
+
aiSectionsRef.current = nextValue;
|
|
31385
|
+
applyAiSectionsToDom(nextState);
|
|
31386
|
+
const newHeight = document.body.scrollHeight;
|
|
31387
|
+
if (newHeight > 50) postToParentRef.current({ type: "ow:height", height: newHeight });
|
|
31388
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: nextValue }] });
|
|
31389
|
+
postToParentRef.current({
|
|
31390
|
+
type: "ow:ai-section-moved",
|
|
31391
|
+
sectionId,
|
|
31392
|
+
targetPage,
|
|
31393
|
+
previous,
|
|
31394
|
+
value: nextValue
|
|
31395
|
+
});
|
|
31396
|
+
postAiSectionsChanged();
|
|
31397
|
+
};
|
|
31398
|
+
window.addEventListener("message", handleAiMoveSection);
|
|
30881
31399
|
const handleAiSetSections = (e) => {
|
|
30882
31400
|
if (e.data?.type !== "ow:ai-set-sections") return;
|
|
30883
31401
|
const value = typeof e.data.value === "string" ? e.data.value : "";
|
|
@@ -31258,6 +31776,12 @@ function OhhwellsBridge() {
|
|
|
31258
31776
|
closeLinkPopoverRef.current();
|
|
31259
31777
|
return;
|
|
31260
31778
|
}
|
|
31779
|
+
if (floatingPanelOpenRef.current) {
|
|
31780
|
+
setFloatingPanelRef.current(null);
|
|
31781
|
+
deselectRef.current();
|
|
31782
|
+
deactivateRef.current();
|
|
31783
|
+
return;
|
|
31784
|
+
}
|
|
31261
31785
|
deselectRef.current();
|
|
31262
31786
|
deactivateRef.current();
|
|
31263
31787
|
clearMediaSelectionRef.current();
|
|
@@ -32077,6 +32601,7 @@ function OhhwellsBridge() {
|
|
|
32077
32601
|
window.removeEventListener("message", handleAiApplyTree);
|
|
32078
32602
|
window.removeEventListener("message", handleAiApplyFooter);
|
|
32079
32603
|
window.removeEventListener("message", handleAiDeleteSection);
|
|
32604
|
+
window.removeEventListener("message", handleAiMoveSection);
|
|
32080
32605
|
window.removeEventListener("message", handleAiSetSections);
|
|
32081
32606
|
window.removeEventListener("message", handleAiSetBrand);
|
|
32082
32607
|
window.removeEventListener("message", handleAiSetStyles);
|
|
@@ -32093,17 +32618,17 @@ function OhhwellsBridge() {
|
|
|
32093
32618
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32094
32619
|
window.removeEventListener("message", handleDeactivate);
|
|
32095
32620
|
window.removeEventListener("message", handleSelectNav);
|
|
32096
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32097
32621
|
window.removeEventListener("message", handleToastAction);
|
|
32098
32622
|
window.removeEventListener("message", handleFormCount);
|
|
32099
32623
|
window.removeEventListener("message", handleUiEscape);
|
|
32624
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32100
32625
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32101
32626
|
autoSaveTimers.current.clear();
|
|
32102
32627
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
32103
32628
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32104
32629
|
};
|
|
32105
32630
|
}, [isEditMode, refreshStateRules]);
|
|
32106
|
-
|
|
32631
|
+
useEffect21(() => {
|
|
32107
32632
|
if (!isEditMode) return;
|
|
32108
32633
|
const THRESHOLD = 10;
|
|
32109
32634
|
const resolveWasSelected = (el) => {
|
|
@@ -32259,7 +32784,7 @@ function OhhwellsBridge() {
|
|
|
32259
32784
|
unlockFooterDragInteraction();
|
|
32260
32785
|
};
|
|
32261
32786
|
}, [isEditMode]);
|
|
32262
|
-
|
|
32787
|
+
useEffect21(() => {
|
|
32263
32788
|
if (!isEditMode) return;
|
|
32264
32789
|
const THRESHOLD = 10;
|
|
32265
32790
|
const onPointerDown = (e) => {
|
|
@@ -32350,7 +32875,7 @@ function OhhwellsBridge() {
|
|
|
32350
32875
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32351
32876
|
};
|
|
32352
32877
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32353
|
-
|
|
32878
|
+
useEffect21(() => {
|
|
32354
32879
|
const handler = (e) => {
|
|
32355
32880
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32356
32881
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32366,7 +32891,7 @@ function OhhwellsBridge() {
|
|
|
32366
32891
|
window.addEventListener("message", handler);
|
|
32367
32892
|
return () => window.removeEventListener("message", handler);
|
|
32368
32893
|
}, [processConfigRequest]);
|
|
32369
|
-
|
|
32894
|
+
useEffect21(() => {
|
|
32370
32895
|
if (!isEditMode) return;
|
|
32371
32896
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32372
32897
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32390,7 +32915,7 @@ function OhhwellsBridge() {
|
|
|
32390
32915
|
postToParent2({
|
|
32391
32916
|
type: "ow:ready",
|
|
32392
32917
|
version: "1",
|
|
32393
|
-
bridgeVersion: "0.1.
|
|
32918
|
+
bridgeVersion: "0.1.166-next.442",
|
|
32394
32919
|
path: pathname,
|
|
32395
32920
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32396
32921
|
sections
|
|
@@ -32402,7 +32927,7 @@ function OhhwellsBridge() {
|
|
|
32402
32927
|
clearTimeout(timer);
|
|
32403
32928
|
};
|
|
32404
32929
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32405
|
-
|
|
32930
|
+
useEffect21(() => {
|
|
32406
32931
|
scrollToHashSectionWhenReady();
|
|
32407
32932
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32408
32933
|
window.addEventListener("hashchange", onHashChange);
|
|
@@ -32444,7 +32969,7 @@ function OhhwellsBridge() {
|
|
|
32444
32969
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32445
32970
|
refreshActiveCommandsRef.current();
|
|
32446
32971
|
}, []);
|
|
32447
|
-
|
|
32972
|
+
useEffect21(() => {
|
|
32448
32973
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32449
32974
|
if (!session || !logoSizeDraft) return;
|
|
32450
32975
|
const onPanelAction = (e) => {
|
|
@@ -33125,7 +33650,7 @@ function OhhwellsBridge() {
|
|
|
33125
33650
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33126
33651
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33127
33652
|
"data-ohw-add-field": "",
|
|
33128
|
-
children: /* @__PURE__ */ jsx40(
|
|
33653
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33129
33654
|
}
|
|
33130
33655
|
),
|
|
33131
33656
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -33618,6 +34143,7 @@ export {
|
|
|
33618
34143
|
hasMountedContentNodes,
|
|
33619
34144
|
indexCollectionItems,
|
|
33620
34145
|
insertFooterHours,
|
|
34146
|
+
isDeadPageHref,
|
|
33621
34147
|
isEditSessionActive,
|
|
33622
34148
|
isPlainLeftClick,
|
|
33623
34149
|
isRenderableFooterTree,
|
|
@@ -33629,6 +34155,7 @@ export {
|
|
|
33629
34155
|
parseAiFooterState,
|
|
33630
34156
|
parseAiSectionsState,
|
|
33631
34157
|
parseTarget,
|
|
34158
|
+
planBuildPageSync,
|
|
33632
34159
|
recordOverriddenPaths,
|
|
33633
34160
|
releaseTemplateLogoIfReplaced,
|
|
33634
34161
|
removeFooterBlock,
|
|
@@ -33638,6 +34165,8 @@ export {
|
|
|
33638
34165
|
serializeAiFooterState,
|
|
33639
34166
|
shouldFetchContentForPath,
|
|
33640
34167
|
stepViableSlide,
|
|
34168
|
+
stripPlaceholderText,
|
|
34169
|
+
stripPlaceholders,
|
|
33641
34170
|
stripTextAlignCss,
|
|
33642
34171
|
toggleVariants,
|
|
33643
34172
|
useOhwCarousel,
|