@ohhwells/bridge 0.1.163 → 0.1.164-next.438
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 +1395 -1035
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.js +1200 -826
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +116 -0
- package/package.json +3 -3
package/dist/index.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 useEffect20, 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;
|
|
@@ -6649,6 +6660,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6649
6660
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6650
6661
|
return target ? pricingFeatureList(target).length : 0;
|
|
6651
6662
|
}
|
|
6663
|
+
function prevailingFeatureIcon(features) {
|
|
6664
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6665
|
+
for (const row of features) {
|
|
6666
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6667
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6668
|
+
entry.count += 1;
|
|
6669
|
+
counts.set(key, entry);
|
|
6670
|
+
}
|
|
6671
|
+
let best = null;
|
|
6672
|
+
for (const entry of counts.values()) {
|
|
6673
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6674
|
+
}
|
|
6675
|
+
if (!best) return {};
|
|
6676
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6677
|
+
}
|
|
6652
6678
|
function addPricingCardFeature(tree, index, text) {
|
|
6653
6679
|
return withPricingCollection(tree, (collection) => {
|
|
6654
6680
|
const children = collection.children;
|
|
@@ -6657,7 +6683,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6657
6683
|
const features = pricingFeatureList(target);
|
|
6658
6684
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6659
6685
|
target.slots = target.slots ?? {};
|
|
6660
|
-
target.slots.features = [...features, { text }];
|
|
6686
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6661
6687
|
return true;
|
|
6662
6688
|
});
|
|
6663
6689
|
}
|
|
@@ -7301,6 +7327,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7301
7327
|
);
|
|
7302
7328
|
}
|
|
7303
7329
|
|
|
7330
|
+
// src/lib/youtube.ts
|
|
7331
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7332
|
+
function extractYouTubeId(input) {
|
|
7333
|
+
const trimmed = input.trim();
|
|
7334
|
+
if (!trimmed) return null;
|
|
7335
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7336
|
+
let url;
|
|
7337
|
+
try {
|
|
7338
|
+
url = new URL(trimmed);
|
|
7339
|
+
} catch {
|
|
7340
|
+
return null;
|
|
7341
|
+
}
|
|
7342
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7343
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7344
|
+
return null;
|
|
7345
|
+
}
|
|
7346
|
+
let candidate = null;
|
|
7347
|
+
if (host === "youtu.be") {
|
|
7348
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7349
|
+
} else if (url.pathname === "/watch") {
|
|
7350
|
+
candidate = url.searchParams.get("v");
|
|
7351
|
+
} else {
|
|
7352
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7353
|
+
candidate = match ? match[1] : null;
|
|
7354
|
+
}
|
|
7355
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7356
|
+
}
|
|
7357
|
+
|
|
7358
|
+
// src/lib/section-embed.ts
|
|
7359
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7360
|
+
function readStoredEmbed(value) {
|
|
7361
|
+
if (value.startsWith("start\n")) {
|
|
7362
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7363
|
+
}
|
|
7364
|
+
return { raw: value, at: "end" };
|
|
7365
|
+
}
|
|
7366
|
+
function embedFrameSrc(value) {
|
|
7367
|
+
const videoId = extractYouTubeId(value);
|
|
7368
|
+
if (videoId) {
|
|
7369
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7370
|
+
}
|
|
7371
|
+
let url;
|
|
7372
|
+
try {
|
|
7373
|
+
url = new URL(value);
|
|
7374
|
+
} catch {
|
|
7375
|
+
return null;
|
|
7376
|
+
}
|
|
7377
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7378
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7379
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7380
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7381
|
+
return { src, title: "Map" };
|
|
7382
|
+
}
|
|
7383
|
+
if (host === "maps.app.goo.gl") {
|
|
7384
|
+
return { src: value, title: "Map" };
|
|
7385
|
+
}
|
|
7386
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7387
|
+
return { src: value, title: "Calendar" };
|
|
7388
|
+
}
|
|
7389
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7390
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7391
|
+
}
|
|
7392
|
+
if (host === "forms.gle") {
|
|
7393
|
+
return { src: value, title: "Form" };
|
|
7394
|
+
}
|
|
7395
|
+
return null;
|
|
7396
|
+
}
|
|
7397
|
+
function place(section, box, at) {
|
|
7398
|
+
if (at === "start") {
|
|
7399
|
+
section.insertBefore(box, section.firstChild);
|
|
7400
|
+
return;
|
|
7401
|
+
}
|
|
7402
|
+
section.appendChild(box);
|
|
7403
|
+
}
|
|
7404
|
+
function paint(section, key, src, title, at) {
|
|
7405
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7406
|
+
const frame = existing?.querySelector("iframe");
|
|
7407
|
+
if (existing && frame) {
|
|
7408
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7409
|
+
frame.title = title;
|
|
7410
|
+
place(section, existing, at);
|
|
7411
|
+
return;
|
|
7412
|
+
}
|
|
7413
|
+
existing?.remove();
|
|
7414
|
+
const box = document.createElement("div");
|
|
7415
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7416
|
+
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;";
|
|
7417
|
+
const frameWrap = document.createElement("div");
|
|
7418
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7419
|
+
const iframe = document.createElement("iframe");
|
|
7420
|
+
iframe.src = src;
|
|
7421
|
+
iframe.title = title;
|
|
7422
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7423
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7424
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7425
|
+
frameWrap.appendChild(iframe);
|
|
7426
|
+
box.appendChild(frameWrap);
|
|
7427
|
+
place(section, box, at);
|
|
7428
|
+
}
|
|
7429
|
+
function applySectionEmbeds(content) {
|
|
7430
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7431
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7432
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7433
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7434
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7435
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7436
|
+
if (!section || !stored || !frame) {
|
|
7437
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7438
|
+
continue;
|
|
7439
|
+
}
|
|
7440
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7441
|
+
}
|
|
7442
|
+
}
|
|
7443
|
+
|
|
7304
7444
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7305
7445
|
import { flushSync } from "react-dom";
|
|
7306
7446
|
import { createRoot } from "react-dom/client";
|
|
@@ -7874,7 +8014,7 @@ var AI_MOBILE_CSS = [
|
|
|
7874
8014
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7875
8015
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7876
8016
|
// 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-
|
|
8017
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7878
8018
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7879
8019
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7880
8020
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -7890,8 +8030,10 @@ var AI_MOBILE_CSS = [
|
|
|
7890
8030
|
"[data-ai-section]{overflow-x:hidden}",
|
|
7891
8031
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
7892
8032
|
// 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
|
-
|
|
8033
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8034
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8035
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8036
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
7895
8037
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
7896
8038
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
7897
8039
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8096,6 +8238,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8096
8238
|
function textAttrs(ctx, path) {
|
|
8097
8239
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8098
8240
|
}
|
|
8241
|
+
var AI_RESPONSIVE_CSS = [
|
|
8242
|
+
"@media (max-width: 960px) {",
|
|
8243
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8244
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8245
|
+
"}",
|
|
8246
|
+
"@media (max-width: 640px) {",
|
|
8247
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8248
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8249
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8250
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8251
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8252
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8253
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8254
|
+
// layered text used to be.
|
|
8255
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8256
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8257
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8258
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8259
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8260
|
+
// other rule had already been taught to stand down.
|
|
8261
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8262
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8263
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8264
|
+
"}"
|
|
8265
|
+
].join("\n");
|
|
8099
8266
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8100
8267
|
function MediaBox({
|
|
8101
8268
|
refValue,
|
|
@@ -8150,7 +8317,7 @@ function MediaBox({
|
|
|
8150
8317
|
position: fill ? "absolute" : void 0,
|
|
8151
8318
|
inset: fill ? 0 : void 0,
|
|
8152
8319
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8153
|
-
height: fill ? "100%" : void 0,
|
|
8320
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8154
8321
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8155
8322
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8156
8323
|
borderRadius: radius,
|
|
@@ -9646,7 +9813,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9646
9813
|
return /* @__PURE__ */ jsx(
|
|
9647
9814
|
"div",
|
|
9648
9815
|
{
|
|
9649
|
-
"data-ai-grid":
|
|
9816
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9650
9817
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9651
9818
|
style: {
|
|
9652
9819
|
display: "grid",
|
|
@@ -9948,7 +10115,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
9948
10115
|
},
|
|
9949
10116
|
children: [
|
|
9950
10117
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
9951
|
-
// The section's `data-ai-
|
|
10118
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
9952
10119
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
9953
10120
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
9954
10121
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10367,6 +10534,7 @@ function AiTreeRenderer({
|
|
|
10367
10534
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10368
10535
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10369
10536
|
...bgAttrs,
|
|
10537
|
+
"data-ai-responsive": "",
|
|
10370
10538
|
style: {
|
|
10371
10539
|
position: "relative",
|
|
10372
10540
|
padding: `${padCss} 0`,
|
|
@@ -10380,12 +10548,13 @@ function AiTreeRenderer({
|
|
|
10380
10548
|
...fillHeight ? { display: "grid" } : {}
|
|
10381
10549
|
},
|
|
10382
10550
|
children: [
|
|
10383
|
-
|
|
10551
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10384
10552
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
10553
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10385
10554
|
/* @__PURE__ */ jsx(
|
|
10386
10555
|
"div",
|
|
10387
10556
|
{
|
|
10388
|
-
"data-ai-
|
|
10557
|
+
"data-ai-section-inner": "",
|
|
10389
10558
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10390
10559
|
style: {
|
|
10391
10560
|
position: "relative",
|
|
@@ -10402,7 +10571,7 @@ function AiTreeRenderer({
|
|
|
10402
10571
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10403
10572
|
"div",
|
|
10404
10573
|
{
|
|
10405
|
-
"data-ai-
|
|
10574
|
+
"data-ai-columns": "",
|
|
10406
10575
|
style: {
|
|
10407
10576
|
display: "grid",
|
|
10408
10577
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11064,9 +11233,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11064
11233
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11065
11234
|
continue;
|
|
11066
11235
|
}
|
|
11067
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11068
11236
|
let container = existing?.container;
|
|
11237
|
+
let isNewMount = false;
|
|
11069
11238
|
if (!container || !container.isConnected) {
|
|
11239
|
+
isNewMount = true;
|
|
11070
11240
|
existing?.root.unmount();
|
|
11071
11241
|
container?.remove();
|
|
11072
11242
|
container = document.createElement("div");
|
|
@@ -11404,6 +11574,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11404
11574
|
return 3;
|
|
11405
11575
|
}
|
|
11406
11576
|
}
|
|
11577
|
+
function readLiveSocialItems() {
|
|
11578
|
+
const root = getFooterRoot();
|
|
11579
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11580
|
+
if (!row) return [];
|
|
11581
|
+
const items = [];
|
|
11582
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11583
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11584
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11585
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11586
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11587
|
+
items.push({ platform, href });
|
|
11588
|
+
}
|
|
11589
|
+
return items;
|
|
11590
|
+
}
|
|
11591
|
+
function syncSocialRowsFromDom(tree) {
|
|
11592
|
+
const root = getFooterRoot();
|
|
11593
|
+
if (!root) return;
|
|
11594
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11595
|
+
const live = readLiveSocialItems();
|
|
11596
|
+
if (row && live.length === 0) return;
|
|
11597
|
+
for (const col of tree.columns) {
|
|
11598
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11599
|
+
if (block.type !== "social-row") return [block];
|
|
11600
|
+
if (!row) return [];
|
|
11601
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11602
|
+
});
|
|
11603
|
+
}
|
|
11604
|
+
}
|
|
11407
11605
|
function collectBrandBlocks(tree) {
|
|
11408
11606
|
const brand = [];
|
|
11409
11607
|
for (const col of tree.columns) {
|
|
@@ -11649,12 +11847,13 @@ function textOf2(el) {
|
|
|
11649
11847
|
}
|
|
11650
11848
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11651
11849
|
const next = cloneTree(tree);
|
|
11850
|
+
syncSocialRowsFromDom(next);
|
|
11652
11851
|
const domCols = listFooterColumns().map((col) => {
|
|
11653
11852
|
const heading = getFooterColumnHeadingEl(col);
|
|
11654
11853
|
const title = heading ? textOf2(heading) : void 0;
|
|
11655
11854
|
const items = listFooterLinksInColumn(col).map((anchor) => {
|
|
11656
|
-
const
|
|
11657
|
-
const label = textOf2(
|
|
11855
|
+
const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11856
|
+
const label = textOf2(labelEl2) || textOf2(anchor);
|
|
11658
11857
|
const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
|
|
11659
11858
|
return label ? { label, href: href || "home" } : null;
|
|
11660
11859
|
}).filter((x) => Boolean(x));
|
|
@@ -17353,7 +17552,7 @@ function apiBase() {
|
|
|
17353
17552
|
function bridgeVersion() {
|
|
17354
17553
|
try {
|
|
17355
17554
|
if (true) {
|
|
17356
|
-
return "0.1.
|
|
17555
|
+
return "0.1.164-next.438";
|
|
17357
17556
|
}
|
|
17358
17557
|
} catch {
|
|
17359
17558
|
}
|
|
@@ -17367,7 +17566,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17367
17566
|
return;
|
|
17368
17567
|
}
|
|
17369
17568
|
try {
|
|
17370
|
-
const v = true ? "0.1.
|
|
17569
|
+
const v = true ? "0.1.164-next.438" : "";
|
|
17371
17570
|
if (v) {
|
|
17372
17571
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17373
17572
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18045,6 +18244,7 @@ function MediaOverlay({
|
|
|
18045
18244
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18046
18245
|
);
|
|
18047
18246
|
}, [isVideo]);
|
|
18247
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18048
18248
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18049
18249
|
const box = {
|
|
18050
18250
|
position: "fixed",
|
|
@@ -18143,11 +18343,10 @@ function MediaOverlay({
|
|
|
18143
18343
|
className: "flex items-center justify-center cursor-pointer",
|
|
18144
18344
|
style: {
|
|
18145
18345
|
...box,
|
|
18146
|
-
//
|
|
18147
|
-
//
|
|
18148
|
-
//
|
|
18149
|
-
|
|
18150
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18346
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18347
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18348
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18349
|
+
pointerEvents: "none",
|
|
18151
18350
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18152
18351
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18153
18352
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18174,17 +18373,17 @@ function MediaOverlay({
|
|
|
18174
18373
|
},
|
|
18175
18374
|
children: [
|
|
18176
18375
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18177
|
-
|
|
18376
|
+
replaceLabel
|
|
18178
18377
|
]
|
|
18179
18378
|
}
|
|
18180
18379
|
),
|
|
18181
|
-
replaceMode
|
|
18380
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18182
18381
|
Button,
|
|
18183
18382
|
{
|
|
18184
18383
|
"data-ohw-media-overlay": "",
|
|
18185
18384
|
variant: "outline",
|
|
18186
18385
|
size: "sm",
|
|
18187
|
-
"aria-label":
|
|
18386
|
+
"aria-label": replaceLabel,
|
|
18188
18387
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18189
18388
|
style: {
|
|
18190
18389
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18207,7 +18406,7 @@ function MediaOverlay({
|
|
|
18207
18406
|
},
|
|
18208
18407
|
children: [
|
|
18209
18408
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18210
|
-
replaceMode === "full" ?
|
|
18409
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18211
18410
|
]
|
|
18212
18411
|
}
|
|
18213
18412
|
)
|
|
@@ -18800,8 +18999,24 @@ function AiSectionOverlay({
|
|
|
18800
18999
|
}
|
|
18801
19000
|
|
|
18802
19001
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18803
|
-
import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef5, useState as useState8 } from "react";
|
|
18804
|
-
import {
|
|
19002
|
+
import { useCallback as useCallback3, useEffect as useEffect8, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
19003
|
+
import {
|
|
19004
|
+
AlignCenter,
|
|
19005
|
+
AlignLeft,
|
|
19006
|
+
AlignRight,
|
|
19007
|
+
ArrowLeft as ArrowLeft2,
|
|
19008
|
+
ArrowRight as ArrowRight2,
|
|
19009
|
+
Check as Check2,
|
|
19010
|
+
ChevronDown as ChevronDown3,
|
|
19011
|
+
Image as ImageIcon2,
|
|
19012
|
+
ImageMinus,
|
|
19013
|
+
ImagePlus,
|
|
19014
|
+
Link as LinkIcon,
|
|
19015
|
+
Minus,
|
|
19016
|
+
Palette,
|
|
19017
|
+
Plus as Plus2,
|
|
19018
|
+
Star
|
|
19019
|
+
} from "lucide-react";
|
|
18805
19020
|
|
|
18806
19021
|
// src/lib/ai-media-strip-tree.ts
|
|
18807
19022
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -18915,14 +19130,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
18915
19130
|
return true;
|
|
18916
19131
|
});
|
|
18917
19132
|
}
|
|
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
19133
|
function setMediaStripItemLink(tree, index, link) {
|
|
18927
19134
|
return withMediaStrip(tree, (block) => {
|
|
18928
19135
|
const items = block.items;
|
|
@@ -18940,11 +19147,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
18940
19147
|
});
|
|
18941
19148
|
}
|
|
18942
19149
|
|
|
19150
|
+
// src/ui/dialog.tsx
|
|
19151
|
+
import * as React9 from "react";
|
|
19152
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19153
|
+
import { X as X2 } from "lucide-react";
|
|
19154
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19155
|
+
function Dialog2({
|
|
19156
|
+
...props
|
|
19157
|
+
}) {
|
|
19158
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19159
|
+
}
|
|
19160
|
+
function DialogPortal({
|
|
19161
|
+
...props
|
|
19162
|
+
}) {
|
|
19163
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19164
|
+
}
|
|
19165
|
+
function DialogOverlay({
|
|
19166
|
+
className,
|
|
19167
|
+
...props
|
|
19168
|
+
}) {
|
|
19169
|
+
return /* @__PURE__ */ jsx20(
|
|
19170
|
+
DialogPrimitive.Overlay,
|
|
19171
|
+
{
|
|
19172
|
+
"data-slot": "dialog-overlay",
|
|
19173
|
+
"data-ohw-link-modal-root": "",
|
|
19174
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19175
|
+
...props
|
|
19176
|
+
}
|
|
19177
|
+
);
|
|
19178
|
+
}
|
|
19179
|
+
var DialogContent = React9.forwardRef(
|
|
19180
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19181
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19182
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19183
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19184
|
+
/* @__PURE__ */ jsxs11(
|
|
19185
|
+
DialogPrimitive.Content,
|
|
19186
|
+
{
|
|
19187
|
+
ref,
|
|
19188
|
+
"data-slot": "dialog-content",
|
|
19189
|
+
className: cn(
|
|
19190
|
+
positionMode,
|
|
19191
|
+
"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",
|
|
19192
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19193
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19194
|
+
className
|
|
19195
|
+
),
|
|
19196
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19197
|
+
...props,
|
|
19198
|
+
children: [
|
|
19199
|
+
children,
|
|
19200
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19201
|
+
DialogPrimitive.Close,
|
|
19202
|
+
{
|
|
19203
|
+
type: "button",
|
|
19204
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19205
|
+
"aria-label": "Close",
|
|
19206
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19207
|
+
}
|
|
19208
|
+
) : null
|
|
19209
|
+
]
|
|
19210
|
+
}
|
|
19211
|
+
)
|
|
19212
|
+
] });
|
|
19213
|
+
}
|
|
19214
|
+
);
|
|
19215
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19216
|
+
function DialogHeader({
|
|
19217
|
+
className,
|
|
19218
|
+
...props
|
|
19219
|
+
}) {
|
|
19220
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19221
|
+
}
|
|
19222
|
+
function DialogFooter({
|
|
19223
|
+
className,
|
|
19224
|
+
...props
|
|
19225
|
+
}) {
|
|
19226
|
+
return /* @__PURE__ */ jsx20(
|
|
19227
|
+
"div",
|
|
19228
|
+
{
|
|
19229
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19230
|
+
...props
|
|
19231
|
+
}
|
|
19232
|
+
);
|
|
19233
|
+
}
|
|
19234
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19235
|
+
DialogPrimitive.Title,
|
|
19236
|
+
{
|
|
19237
|
+
ref,
|
|
19238
|
+
className: cn(
|
|
19239
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19240
|
+
className
|
|
19241
|
+
),
|
|
19242
|
+
...props
|
|
19243
|
+
}
|
|
19244
|
+
));
|
|
19245
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19246
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19247
|
+
DialogPrimitive.Description,
|
|
19248
|
+
{
|
|
19249
|
+
ref,
|
|
19250
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19251
|
+
...props
|
|
19252
|
+
}
|
|
19253
|
+
));
|
|
19254
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19255
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19256
|
+
|
|
18943
19257
|
// 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)`;
|
|
19258
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19259
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19260
|
+
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
19261
|
function findMediaStripItemElement(sectionId, index) {
|
|
18949
19262
|
const sectionEl = findByInstanceId(sectionId);
|
|
18950
19263
|
if (!sectionEl) return null;
|
|
@@ -18954,14 +19267,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
18954
19267
|
}
|
|
18955
19268
|
return null;
|
|
18956
19269
|
}
|
|
18957
|
-
function
|
|
18958
|
-
|
|
19270
|
+
function itemRefFromTarget(target) {
|
|
19271
|
+
if (!(target instanceof Element)) return null;
|
|
19272
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19273
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19274
|
+
if (!itemEl) return null;
|
|
19275
|
+
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19276
|
+
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19277
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19278
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19279
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19280
|
+
return { sectionId, index };
|
|
19281
|
+
}
|
|
19282
|
+
function sameRef(a, b) {
|
|
19283
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19284
|
+
}
|
|
19285
|
+
function rectOf(el) {
|
|
18959
19286
|
if (!el) return null;
|
|
18960
19287
|
const r2 = el.getBoundingClientRect();
|
|
18961
19288
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
18962
19289
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18963
19290
|
}
|
|
18964
|
-
function
|
|
19291
|
+
function readRect2(ref) {
|
|
19292
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19293
|
+
}
|
|
19294
|
+
function readStripRect(ref) {
|
|
19295
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19296
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19297
|
+
}
|
|
19298
|
+
function useLiveItemRect(ref, strip = false) {
|
|
18965
19299
|
const [rect, setRect] = useState8(null);
|
|
18966
19300
|
useEffect8(() => {
|
|
18967
19301
|
if (!ref) {
|
|
@@ -18969,7 +19303,7 @@ function useLiveItemRect(ref) {
|
|
|
18969
19303
|
return;
|
|
18970
19304
|
}
|
|
18971
19305
|
const update = () => {
|
|
18972
|
-
const next = readRect2(ref);
|
|
19306
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
18973
19307
|
setRect(
|
|
18974
19308
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
18975
19309
|
);
|
|
@@ -18984,9 +19318,49 @@ function useLiveItemRect(ref) {
|
|
|
18984
19318
|
window.removeEventListener("resize", update);
|
|
18985
19319
|
clearInterval(interval);
|
|
18986
19320
|
};
|
|
18987
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19321
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
18988
19322
|
return rect;
|
|
18989
19323
|
}
|
|
19324
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19325
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19326
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19327
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19328
|
+
const slotRef = useRef5(null);
|
|
19329
|
+
const [shift, setShift] = useState8(0);
|
|
19330
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19331
|
+
useLayoutEffect4(() => {
|
|
19332
|
+
const slot = slotRef.current;
|
|
19333
|
+
if (!slot) return;
|
|
19334
|
+
const clamp = () => {
|
|
19335
|
+
const w = slot.offsetWidth;
|
|
19336
|
+
if (w <= 0) return;
|
|
19337
|
+
const half = w / 2;
|
|
19338
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19339
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19340
|
+
};
|
|
19341
|
+
clamp();
|
|
19342
|
+
const ro = new ResizeObserver(clamp);
|
|
19343
|
+
ro.observe(slot);
|
|
19344
|
+
return () => ro.disconnect();
|
|
19345
|
+
}, [centerX, children]);
|
|
19346
|
+
const mobile = window.innerWidth <= 480;
|
|
19347
|
+
return /* @__PURE__ */ jsx21(
|
|
19348
|
+
"div",
|
|
19349
|
+
{
|
|
19350
|
+
ref: slotRef,
|
|
19351
|
+
"data-ohw-bridge": "",
|
|
19352
|
+
"data-ohw-item-interaction": "",
|
|
19353
|
+
className: "pointer-events-auto fixed",
|
|
19354
|
+
style: {
|
|
19355
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19356
|
+
left: centerX + shift,
|
|
19357
|
+
transform: "translate(-50%, -100%)",
|
|
19358
|
+
zIndex: 2147483645
|
|
19359
|
+
},
|
|
19360
|
+
children
|
|
19361
|
+
}
|
|
19362
|
+
);
|
|
19363
|
+
}
|
|
18990
19364
|
function requestValidateTree(postToParent2, tree) {
|
|
18991
19365
|
return new Promise((resolve) => {
|
|
18992
19366
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19023,116 +19397,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19023
19397
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19024
19398
|
});
|
|
19025
19399
|
}
|
|
19026
|
-
function
|
|
19400
|
+
function ToolbarAction({
|
|
19027
19401
|
label,
|
|
19028
19402
|
onClick,
|
|
19029
|
-
disabled,
|
|
19030
|
-
active
|
|
19403
|
+
disabled = false,
|
|
19404
|
+
active = false,
|
|
19405
|
+
children
|
|
19031
19406
|
}) {
|
|
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
|
-
);
|
|
19407
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19408
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19409
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19410
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19411
|
+
] });
|
|
19059
19412
|
}
|
|
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",
|
|
19413
|
+
function ToolbarSeparator() {
|
|
19414
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19415
|
+
}
|
|
19416
|
+
function OptionMenu({
|
|
19417
|
+
label,
|
|
19418
|
+
value,
|
|
19419
|
+
options,
|
|
19420
|
+
onChange
|
|
19421
|
+
}) {
|
|
19422
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19423
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19424
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19425
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19426
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19427
|
+
"button",
|
|
19428
|
+
{
|
|
19429
|
+
type: "button",
|
|
19430
|
+
"aria-label": label,
|
|
19431
|
+
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",
|
|
19432
|
+
children: [
|
|
19433
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19434
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19435
|
+
]
|
|
19436
|
+
}
|
|
19437
|
+
) }),
|
|
19438
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19439
|
+
const selected = option.value === value;
|
|
19440
|
+
return /* @__PURE__ */ jsxs12(
|
|
19441
|
+
DropdownMenuItem,
|
|
19095
19442
|
{
|
|
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
|
-
);
|
|
19443
|
+
role: "menuitemradio",
|
|
19444
|
+
"aria-checked": selected,
|
|
19445
|
+
onSelect: () => onChange(option.value),
|
|
19446
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19447
|
+
children: [
|
|
19448
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19449
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19450
|
+
]
|
|
19451
|
+
},
|
|
19452
|
+
option.value
|
|
19453
|
+
);
|
|
19454
|
+
}) })
|
|
19455
|
+
] })
|
|
19456
|
+
] });
|
|
19127
19457
|
}
|
|
19128
19458
|
var VARIANTS = [
|
|
19129
19459
|
{ value: "logos", label: "Logos" },
|
|
19130
19460
|
{ value: "reel", label: "Reel" }
|
|
19131
19461
|
];
|
|
19132
19462
|
var ALIGNS = [
|
|
19133
|
-
{ value: "left", label: "
|
|
19134
|
-
{ value: "center", label: "
|
|
19135
|
-
{ value: "right", label: "
|
|
19463
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19464
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19465
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19136
19466
|
];
|
|
19137
19467
|
var HOVERS = [
|
|
19138
19468
|
{ value: "none", label: "None" },
|
|
@@ -19140,104 +19470,104 @@ var HOVERS = [
|
|
|
19140
19470
|
{ value: "zoom", label: "Zoom" },
|
|
19141
19471
|
{ value: "fade", label: "Fade" }
|
|
19142
19472
|
];
|
|
19143
|
-
var TREATMENTS = [
|
|
19144
|
-
{ value: "color", label: "Color" },
|
|
19145
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19146
|
-
];
|
|
19147
19473
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19148
|
-
function
|
|
19149
|
-
|
|
19474
|
+
function LinkModal({
|
|
19475
|
+
href,
|
|
19476
|
+
linkTarget,
|
|
19477
|
+
onClose,
|
|
19478
|
+
onSave
|
|
19479
|
+
}) {
|
|
19480
|
+
const [draft, setDraft] = useState8(href);
|
|
19481
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19150
19482
|
const [invalid, setInvalid] = useState8(false);
|
|
19151
|
-
|
|
19152
|
-
setDraft(value);
|
|
19153
|
-
setInvalid(false);
|
|
19154
|
-
}, [value]);
|
|
19155
|
-
const commit2 = () => {
|
|
19483
|
+
const save = () => {
|
|
19156
19484
|
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
|
-
]
|
|
19485
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19486
|
+
setInvalid(true);
|
|
19487
|
+
return;
|
|
19226
19488
|
}
|
|
19227
|
-
|
|
19489
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19490
|
+
onClose();
|
|
19491
|
+
};
|
|
19492
|
+
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: [
|
|
19493
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19494
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
19495
|
+
/* @__PURE__ */ jsx21(
|
|
19496
|
+
"input",
|
|
19497
|
+
{
|
|
19498
|
+
autoFocus: true,
|
|
19499
|
+
type: "text",
|
|
19500
|
+
inputMode: "url",
|
|
19501
|
+
value: draft,
|
|
19502
|
+
onChange: (e) => {
|
|
19503
|
+
setDraft(e.target.value);
|
|
19504
|
+
setInvalid(false);
|
|
19505
|
+
},
|
|
19506
|
+
onKeyDown: (e) => {
|
|
19507
|
+
if (e.key === "Enter") save();
|
|
19508
|
+
},
|
|
19509
|
+
placeholder: "https://example.com",
|
|
19510
|
+
"aria-label": "Image link URL",
|
|
19511
|
+
"aria-invalid": invalid,
|
|
19512
|
+
className: cn(
|
|
19513
|
+
"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",
|
|
19514
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19515
|
+
)
|
|
19516
|
+
}
|
|
19517
|
+
),
|
|
19518
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19519
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19520
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19521
|
+
"Open in new tab"
|
|
19522
|
+
] })
|
|
19523
|
+
] }),
|
|
19524
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
19525
|
+
href && /* @__PURE__ */ jsx21(
|
|
19526
|
+
"button",
|
|
19527
|
+
{
|
|
19528
|
+
type: "button",
|
|
19529
|
+
onClick: () => {
|
|
19530
|
+
onSave("", "new-tab");
|
|
19531
|
+
onClose();
|
|
19532
|
+
},
|
|
19533
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19534
|
+
children: "Remove link"
|
|
19535
|
+
}
|
|
19536
|
+
),
|
|
19537
|
+
/* @__PURE__ */ jsx21(
|
|
19538
|
+
"button",
|
|
19539
|
+
{
|
|
19540
|
+
type: "button",
|
|
19541
|
+
onClick: onClose,
|
|
19542
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19543
|
+
children: "Cancel"
|
|
19544
|
+
}
|
|
19545
|
+
),
|
|
19546
|
+
/* @__PURE__ */ jsx21(
|
|
19547
|
+
"button",
|
|
19548
|
+
{
|
|
19549
|
+
type: "button",
|
|
19550
|
+
onClick: save,
|
|
19551
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19552
|
+
children: "Save"
|
|
19553
|
+
}
|
|
19554
|
+
)
|
|
19555
|
+
] })
|
|
19556
|
+
] }) });
|
|
19228
19557
|
}
|
|
19229
19558
|
function MediaStripToolbar({
|
|
19230
19559
|
entry,
|
|
19231
19560
|
index,
|
|
19232
19561
|
pending,
|
|
19233
19562
|
error,
|
|
19563
|
+
itemEditOn,
|
|
19564
|
+
onToggleItemEdit,
|
|
19234
19565
|
onSetVariant,
|
|
19235
19566
|
onSetAlign,
|
|
19236
19567
|
onSetHover,
|
|
19237
19568
|
onSetTreatment,
|
|
19238
19569
|
onResize,
|
|
19239
|
-
|
|
19240
|
-
onSetLink,
|
|
19570
|
+
onOpenLink,
|
|
19241
19571
|
onAddItem,
|
|
19242
19572
|
onRemoveItem,
|
|
19243
19573
|
onChangeImage,
|
|
@@ -19246,81 +19576,102 @@ function MediaStripToolbar({
|
|
|
19246
19576
|
}) {
|
|
19247
19577
|
const items = mediaStripItems(entry.tree);
|
|
19248
19578
|
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
19579
|
const slots = findMediaStripSlots(entry.tree);
|
|
19253
19580
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19254
19581
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19255
19582
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19256
19583
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19257
19584
|
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(
|
|
19585
|
+
const mobile = window.innerWidth <= 480;
|
|
19586
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19587
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19270
19588
|
"div",
|
|
19271
19589
|
{
|
|
19272
19590
|
"data-ohw-bridge": "",
|
|
19273
19591
|
"data-ohw-toolbar": "",
|
|
19274
19592
|
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
|
-
},
|
|
19593
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19594
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19288
19595
|
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
|
-
|
|
19596
|
+
/* @__PURE__ */ jsxs12(
|
|
19597
|
+
"div",
|
|
19598
|
+
{
|
|
19599
|
+
className: cn(
|
|
19600
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19601
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19602
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19603
|
+
),
|
|
19604
|
+
children: [
|
|
19605
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19606
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
19607
|
+
CustomToolbarButton,
|
|
19608
|
+
{
|
|
19609
|
+
type: "button",
|
|
19610
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19611
|
+
"aria-pressed": itemEditOn,
|
|
19612
|
+
onClick: onToggleItemEdit,
|
|
19613
|
+
className: "group size-8",
|
|
19614
|
+
children: /* @__PURE__ */ jsx21(
|
|
19615
|
+
Star,
|
|
19616
|
+
{
|
|
19617
|
+
size: 16,
|
|
19618
|
+
fill: "currentColor",
|
|
19619
|
+
strokeWidth: 0,
|
|
19620
|
+
className: cn(
|
|
19621
|
+
"transition-colors",
|
|
19622
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19623
|
+
),
|
|
19624
|
+
style: { pointerEvents: "none" }
|
|
19625
|
+
}
|
|
19626
|
+
)
|
|
19627
|
+
}
|
|
19628
|
+
) }),
|
|
19629
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19630
|
+
] }),
|
|
19631
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19632
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19633
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19634
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19635
|
+
/* @__PURE__ */ jsx21(
|
|
19636
|
+
ToolbarAction,
|
|
19637
|
+
{
|
|
19638
|
+
label: gatedLabel("Move right"),
|
|
19639
|
+
onClick: onMoveRight,
|
|
19640
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19641
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
19642
|
+
}
|
|
19643
|
+
),
|
|
19644
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19645
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19646
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19647
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19648
|
+
/* @__PURE__ */ jsx21(
|
|
19649
|
+
ToolbarAction,
|
|
19650
|
+
{
|
|
19651
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19652
|
+
active: treatment === "grayscale",
|
|
19653
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19654
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19655
|
+
}
|
|
19656
|
+
),
|
|
19657
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19658
|
+
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)),
|
|
19659
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19660
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19661
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19662
|
+
sizeValue,
|
|
19663
|
+
"px"
|
|
19664
|
+
] }),
|
|
19665
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19666
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19667
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19668
|
+
]
|
|
19669
|
+
}
|
|
19670
|
+
),
|
|
19671
|
+
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
19672
|
]
|
|
19322
19673
|
}
|
|
19323
|
-
);
|
|
19674
|
+
) });
|
|
19324
19675
|
}
|
|
19325
19676
|
function findMediaStripSlots(tree) {
|
|
19326
19677
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19339,31 +19690,23 @@ function AiMediaStripOverlay({
|
|
|
19339
19690
|
}) {
|
|
19340
19691
|
const [hover, setHover] = useState8(null);
|
|
19341
19692
|
const [active, setActive] = useState8(null);
|
|
19693
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
19694
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19342
19695
|
const [pending, setPending] = useState8(false);
|
|
19343
19696
|
const [error, setError] = useState8(null);
|
|
19344
19697
|
const activeRef = useRef5(null);
|
|
19345
19698
|
activeRef.current = active;
|
|
19699
|
+
const linkOpenRef = useRef5(false);
|
|
19700
|
+
linkOpenRef.current = linkOpen;
|
|
19346
19701
|
useEffect8(() => {
|
|
19347
19702
|
const onMove = (e) => {
|
|
19703
|
+
const ref = itemRefFromTarget(e.target);
|
|
19348
19704
|
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 });
|
|
19705
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19706
|
+
setHover((prev) => {
|
|
19707
|
+
const next = ref && !overEditable ? ref : null;
|
|
19708
|
+
return sameRef(prev, next) ? prev : next;
|
|
19709
|
+
});
|
|
19367
19710
|
};
|
|
19368
19711
|
const onLeave = () => setHover(null);
|
|
19369
19712
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19375,23 +19718,25 @@ function AiMediaStripOverlay({
|
|
|
19375
19718
|
}, []);
|
|
19376
19719
|
useEffect8(() => {
|
|
19377
19720
|
const onClick = (e) => {
|
|
19378
|
-
const current = activeRef.current;
|
|
19379
|
-
if (!current) return;
|
|
19380
19721
|
const t = e.target;
|
|
19381
|
-
if (!(t instanceof
|
|
19382
|
-
if (t.closest(
|
|
19383
|
-
const
|
|
19384
|
-
if (
|
|
19385
|
-
|
|
19722
|
+
if (!(t instanceof Element)) return;
|
|
19723
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19724
|
+
const ref = itemRefFromTarget(t);
|
|
19725
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19726
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19727
|
+
setItemEditOn(false);
|
|
19386
19728
|
setError(null);
|
|
19729
|
+
setActive(ref);
|
|
19387
19730
|
};
|
|
19388
19731
|
document.addEventListener("click", onClick, true);
|
|
19389
19732
|
return () => document.removeEventListener("click", onClick, true);
|
|
19390
|
-
}, []);
|
|
19733
|
+
}, [clearInteractionChromeRef]);
|
|
19391
19734
|
useEffect8(() => {
|
|
19392
19735
|
const onBlur = () => {
|
|
19393
19736
|
if (!activeRef.current) return;
|
|
19394
19737
|
setActive(null);
|
|
19738
|
+
setItemEditOn(false);
|
|
19739
|
+
setLinkOpen(false);
|
|
19395
19740
|
setError(null);
|
|
19396
19741
|
};
|
|
19397
19742
|
window.addEventListener("blur", onBlur);
|
|
@@ -19401,7 +19746,10 @@ function AiMediaStripOverlay({
|
|
|
19401
19746
|
const onKeyDown = (e) => {
|
|
19402
19747
|
if (e.key !== "Escape") return;
|
|
19403
19748
|
if (!activeRef.current) return;
|
|
19749
|
+
if (linkOpenRef.current) return;
|
|
19750
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19404
19751
|
setActive(null);
|
|
19752
|
+
setItemEditOn(false);
|
|
19405
19753
|
setError(null);
|
|
19406
19754
|
};
|
|
19407
19755
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19435,137 +19783,133 @@ function AiMediaStripOverlay({
|
|
|
19435
19783
|
tree: nextTree,
|
|
19436
19784
|
label: entry.label,
|
|
19437
19785
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19438
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19786
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
19787
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19788
|
+
// on every edit reads as the section jumping around.
|
|
19789
|
+
skipScrollIntoView: true
|
|
19439
19790
|
});
|
|
19440
19791
|
return true;
|
|
19441
19792
|
},
|
|
19442
19793
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19443
19794
|
);
|
|
19444
19795
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19445
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19446
19796
|
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) => {
|
|
19797
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
19798
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
19799
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
19800
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
19801
|
+
const activeHref = activeItem?.href ?? "";
|
|
19802
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19803
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19804
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
19805
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19806
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
19807
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
19808
|
+
MediaStripToolbar,
|
|
19809
|
+
{
|
|
19810
|
+
entry: activeEntry,
|
|
19811
|
+
index: active.index,
|
|
19812
|
+
pending,
|
|
19813
|
+
error,
|
|
19814
|
+
itemEditOn,
|
|
19815
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
19816
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19817
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19818
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19819
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19820
|
+
onResize: (delta) => {
|
|
19821
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19822
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19823
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19824
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19825
|
+
},
|
|
19826
|
+
onOpenLink: () => setLinkOpen(true),
|
|
19827
|
+
onAddItem: () => {
|
|
19828
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19829
|
+
if (!picked) return;
|
|
19830
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19507
19831
|
void runMutation(
|
|
19508
19832
|
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
|
-
});
|
|
19833
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19834
|
+
{ [picked.assetId]: picked.url }
|
|
19835
|
+
).then((applied) => {
|
|
19836
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19523
19837
|
});
|
|
19524
|
-
}
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
});
|
|
19534
|
-
},
|
|
19535
|
-
onRemoveItem: () => {
|
|
19536
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19537
|
-
(applied) => {
|
|
19538
|
-
if (applied) setActive(null);
|
|
19539
|
-
}
|
|
19540
|
-
);
|
|
19541
|
-
},
|
|
19542
|
-
onMoveLeft: () => {
|
|
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
|
-
}
|
|
19838
|
+
});
|
|
19839
|
+
},
|
|
19840
|
+
onChangeImage: () => {
|
|
19841
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19842
|
+
if (!picked) return;
|
|
19843
|
+
void runMutation(
|
|
19844
|
+
active.sectionId,
|
|
19845
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19846
|
+
{ [picked.assetId]: picked.url }
|
|
19554
19847
|
);
|
|
19555
|
-
}
|
|
19848
|
+
});
|
|
19849
|
+
},
|
|
19850
|
+
onRemoveItem: () => {
|
|
19851
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19852
|
+
(applied) => {
|
|
19853
|
+
if (applied) setActive(null);
|
|
19854
|
+
}
|
|
19855
|
+
);
|
|
19856
|
+
},
|
|
19857
|
+
onMoveLeft: () => {
|
|
19858
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19859
|
+
(applied) => {
|
|
19860
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19861
|
+
}
|
|
19862
|
+
);
|
|
19863
|
+
},
|
|
19864
|
+
onMoveRight: () => {
|
|
19865
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19866
|
+
(applied) => {
|
|
19867
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19868
|
+
}
|
|
19869
|
+
);
|
|
19556
19870
|
}
|
|
19557
|
-
|
|
19558
|
-
}
|
|
19559
|
-
|
|
19871
|
+
}
|
|
19872
|
+
) }),
|
|
19873
|
+
/* @__PURE__ */ jsx21(
|
|
19874
|
+
"div",
|
|
19875
|
+
{
|
|
19876
|
+
"data-ohw-bridge": "",
|
|
19877
|
+
"data-ohw-item-interaction": "",
|
|
19878
|
+
"aria-hidden": true,
|
|
19879
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
19880
|
+
style: {
|
|
19881
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
19882
|
+
left: activeItemRect.left - 5,
|
|
19883
|
+
background: PRIMARY3,
|
|
19884
|
+
zIndex: 2147483644
|
|
19885
|
+
},
|
|
19886
|
+
children: "Media item"
|
|
19887
|
+
}
|
|
19888
|
+
),
|
|
19889
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
19890
|
+
LinkModal,
|
|
19891
|
+
{
|
|
19892
|
+
href: activeHref,
|
|
19893
|
+
linkTarget: activeTarget,
|
|
19894
|
+
onClose: () => setLinkOpen(false),
|
|
19895
|
+
onSave: (href, linkTarget) => {
|
|
19896
|
+
void runMutation(
|
|
19897
|
+
active.sectionId,
|
|
19898
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
19899
|
+
);
|
|
19900
|
+
}
|
|
19901
|
+
}
|
|
19902
|
+
)
|
|
19903
|
+
] })
|
|
19560
19904
|
] });
|
|
19561
19905
|
}
|
|
19562
19906
|
|
|
19563
19907
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19564
|
-
import { useCallback as useCallback4, useEffect as useEffect9, useLayoutEffect as
|
|
19565
|
-
import { Check as
|
|
19566
|
-
import { Fragment as Fragment8, jsx as
|
|
19908
|
+
import { useCallback as useCallback4, useEffect as useEffect9, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
19909
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
19910
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19567
19911
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19568
|
-
var
|
|
19912
|
+
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
19913
|
function findPricingCardElement(sectionId, index) {
|
|
19570
19914
|
const sectionEl = findByInstanceId(sectionId);
|
|
19571
19915
|
if (!sectionEl) return null;
|
|
@@ -19577,7 +19921,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19577
19921
|
}
|
|
19578
19922
|
function cardRefFromTarget(target) {
|
|
19579
19923
|
if (!(target instanceof Element)) return null;
|
|
19580
|
-
if (target.closest(
|
|
19924
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19581
19925
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19582
19926
|
if (!cardEl) return null;
|
|
19583
19927
|
const sectionEl = cardEl.closest("[data-ohw-section]");
|
|
@@ -19587,21 +19931,21 @@ function cardRefFromTarget(target) {
|
|
|
19587
19931
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19588
19932
|
return { sectionId, index };
|
|
19589
19933
|
}
|
|
19590
|
-
function
|
|
19934
|
+
function sameRef2(a, b) {
|
|
19591
19935
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19592
19936
|
}
|
|
19593
|
-
function
|
|
19937
|
+
function rectOf2(el) {
|
|
19594
19938
|
if (!el) return null;
|
|
19595
19939
|
const r2 = el.getBoundingClientRect();
|
|
19596
19940
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19597
19941
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19598
19942
|
}
|
|
19599
19943
|
function readRect3(ref) {
|
|
19600
|
-
return
|
|
19944
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19601
19945
|
}
|
|
19602
19946
|
function readGridRect(ref) {
|
|
19603
19947
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19604
|
-
return
|
|
19948
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19605
19949
|
}
|
|
19606
19950
|
function useLiveCardRect(ref, grid = false) {
|
|
19607
19951
|
const [rect, setRect] = useState9(null);
|
|
@@ -19631,19 +19975,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19631
19975
|
}
|
|
19632
19976
|
var TOOLBAR_GRID_GAP = 52;
|
|
19633
19977
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19634
|
-
var
|
|
19978
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19635
19979
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19636
19980
|
const slotRef = useRef6(null);
|
|
19637
19981
|
const [shift, setShift] = useState9(0);
|
|
19638
19982
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19639
|
-
|
|
19983
|
+
useLayoutEffect5(() => {
|
|
19640
19984
|
const slot = slotRef.current;
|
|
19641
19985
|
if (!slot) return;
|
|
19642
19986
|
const clamp = () => {
|
|
19643
19987
|
const w = slot.offsetWidth;
|
|
19644
19988
|
if (w <= 0) return;
|
|
19645
19989
|
const half = w / 2;
|
|
19646
|
-
const clamped = Math.max(
|
|
19990
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19647
19991
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19648
19992
|
};
|
|
19649
19993
|
clamp();
|
|
@@ -19652,7 +19996,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19652
19996
|
return () => ro.disconnect();
|
|
19653
19997
|
}, [centerX, children]);
|
|
19654
19998
|
const mobile = window.innerWidth <= 480;
|
|
19655
|
-
return /* @__PURE__ */
|
|
19999
|
+
return /* @__PURE__ */ jsx22(
|
|
19656
20000
|
"div",
|
|
19657
20001
|
{
|
|
19658
20002
|
ref: slotRef,
|
|
@@ -19687,7 +20031,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19687
20031
|
});
|
|
19688
20032
|
}
|
|
19689
20033
|
function StyleSwatch({ style }) {
|
|
19690
|
-
return /* @__PURE__ */
|
|
20034
|
+
return /* @__PURE__ */ jsx22(
|
|
19691
20035
|
"span",
|
|
19692
20036
|
{
|
|
19693
20037
|
"aria-hidden": true,
|
|
@@ -19701,35 +20045,35 @@ function StyleSwatch({ style }) {
|
|
|
19701
20045
|
);
|
|
19702
20046
|
}
|
|
19703
20047
|
function ButtonGlyph() {
|
|
19704
|
-
return /* @__PURE__ */
|
|
19705
|
-
/* @__PURE__ */
|
|
19706
|
-
/* @__PURE__ */
|
|
20048
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20049
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20050
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19707
20051
|
] });
|
|
19708
20052
|
}
|
|
19709
20053
|
function FeatureGlyph({ mode }) {
|
|
19710
|
-
return /* @__PURE__ */
|
|
19711
|
-
/* @__PURE__ */
|
|
19712
|
-
/* @__PURE__ */
|
|
19713
|
-
/* @__PURE__ */
|
|
19714
|
-
/* @__PURE__ */
|
|
19715
|
-
/* @__PURE__ */
|
|
19716
|
-
mode === "add" && /* @__PURE__ */
|
|
20054
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20055
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20056
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20057
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20058
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20059
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20060
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19717
20061
|
] });
|
|
19718
20062
|
}
|
|
19719
|
-
function
|
|
20063
|
+
function ToolbarAction2({
|
|
19720
20064
|
label,
|
|
19721
20065
|
onClick,
|
|
19722
20066
|
disabled = false,
|
|
19723
20067
|
children
|
|
19724
20068
|
}) {
|
|
19725
|
-
const button = /* @__PURE__ */
|
|
19726
|
-
return /* @__PURE__ */
|
|
19727
|
-
/* @__PURE__ */
|
|
19728
|
-
/* @__PURE__ */
|
|
20069
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20070
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20071
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20072
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19729
20073
|
] });
|
|
19730
20074
|
}
|
|
19731
|
-
function
|
|
19732
|
-
return /* @__PURE__ */
|
|
20075
|
+
function ToolbarSeparator2() {
|
|
20076
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19733
20077
|
}
|
|
19734
20078
|
function CardStyleMenu({
|
|
19735
20079
|
value,
|
|
@@ -19737,7 +20081,7 @@ function CardStyleMenu({
|
|
|
19737
20081
|
disabled = false
|
|
19738
20082
|
}) {
|
|
19739
20083
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19740
|
-
const trigger = /* @__PURE__ */
|
|
20084
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
19741
20085
|
"button",
|
|
19742
20086
|
{
|
|
19743
20087
|
type: "button",
|
|
@@ -19748,28 +20092,28 @@ function CardStyleMenu({
|
|
|
19748
20092
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19749
20093
|
),
|
|
19750
20094
|
children: [
|
|
19751
|
-
/* @__PURE__ */
|
|
19752
|
-
/* @__PURE__ */
|
|
19753
|
-
/* @__PURE__ */
|
|
20095
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20096
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20097
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
19754
20098
|
]
|
|
19755
20099
|
}
|
|
19756
20100
|
);
|
|
19757
20101
|
if (disabled) {
|
|
19758
|
-
return /* @__PURE__ */
|
|
19759
|
-
/* @__PURE__ */
|
|
19760
|
-
/* @__PURE__ */
|
|
19761
|
-
/* @__PURE__ */
|
|
19762
|
-
/* @__PURE__ */
|
|
20102
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20103
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20104
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20105
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20106
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19763
20107
|
] })
|
|
19764
20108
|
] });
|
|
19765
20109
|
}
|
|
19766
|
-
return /* @__PURE__ */
|
|
19767
|
-
/* @__PURE__ */
|
|
19768
|
-
/* @__PURE__ */
|
|
19769
|
-
/* @__PURE__ */
|
|
19770
|
-
/* @__PURE__ */
|
|
20110
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20111
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20112
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20113
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20114
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19771
20115
|
const selected = style.value === value;
|
|
19772
|
-
return /* @__PURE__ */
|
|
20116
|
+
return /* @__PURE__ */ jsxs13(
|
|
19773
20117
|
DropdownMenuItem,
|
|
19774
20118
|
{
|
|
19775
20119
|
role: "menuitemradio",
|
|
@@ -19777,9 +20121,9 @@ function CardStyleMenu({
|
|
|
19777
20121
|
onSelect: () => onChange(style.value),
|
|
19778
20122
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19779
20123
|
children: [
|
|
19780
|
-
/* @__PURE__ */
|
|
19781
|
-
/* @__PURE__ */
|
|
19782
|
-
selected && /* @__PURE__ */
|
|
20124
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20125
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20126
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
19783
20127
|
]
|
|
19784
20128
|
},
|
|
19785
20129
|
style.value
|
|
@@ -19809,7 +20153,7 @@ function PricingCardToolbar({
|
|
|
19809
20153
|
const style = pricingCardStyle(entry.tree, index);
|
|
19810
20154
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19811
20155
|
const mobile = window.innerWidth <= 480;
|
|
19812
|
-
return /* @__PURE__ */
|
|
20156
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
19813
20157
|
"div",
|
|
19814
20158
|
{
|
|
19815
20159
|
"data-ohw-bridge": "",
|
|
@@ -19821,7 +20165,7 @@ function PricingCardToolbar({
|
|
|
19821
20165
|
),
|
|
19822
20166
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19823
20167
|
children: [
|
|
19824
|
-
/* @__PURE__ */
|
|
20168
|
+
/* @__PURE__ */ jsxs13(
|
|
19825
20169
|
"div",
|
|
19826
20170
|
{
|
|
19827
20171
|
className: cn(
|
|
@@ -19830,8 +20174,8 @@ function PricingCardToolbar({
|
|
|
19830
20174
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19831
20175
|
),
|
|
19832
20176
|
children: [
|
|
19833
|
-
/* @__PURE__ */
|
|
19834
|
-
/* @__PURE__ */
|
|
20177
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20178
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
19835
20179
|
CustomToolbarButton,
|
|
19836
20180
|
{
|
|
19837
20181
|
type: "button",
|
|
@@ -19839,7 +20183,7 @@ function PricingCardToolbar({
|
|
|
19839
20183
|
"aria-pressed": featuredTag,
|
|
19840
20184
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19841
20185
|
className: "group size-8",
|
|
19842
|
-
children: /* @__PURE__ */
|
|
20186
|
+
children: /* @__PURE__ */ jsx22(
|
|
19843
20187
|
Star2,
|
|
19844
20188
|
{
|
|
19845
20189
|
size: 16,
|
|
@@ -19854,25 +20198,25 @@ function PricingCardToolbar({
|
|
|
19854
20198
|
)
|
|
19855
20199
|
}
|
|
19856
20200
|
) }),
|
|
19857
|
-
/* @__PURE__ */
|
|
20201
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
19858
20202
|
] }),
|
|
19859
|
-
/* @__PURE__ */
|
|
19860
|
-
/* @__PURE__ */
|
|
19861
|
-
/* @__PURE__ */
|
|
19862
|
-
/* @__PURE__ */
|
|
19863
|
-
/* @__PURE__ */
|
|
19864
|
-
/* @__PURE__ */
|
|
19865
|
-
/* @__PURE__ */
|
|
20203
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20204
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20205
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20206
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20207
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20208
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20209
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
19866
20210
|
] }) }),
|
|
19867
|
-
/* @__PURE__ */
|
|
19868
|
-
/* @__PURE__ */
|
|
19869
|
-
/* @__PURE__ */
|
|
19870
|
-
/* @__PURE__ */
|
|
19871
|
-
/* @__PURE__ */
|
|
20211
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20212
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20213
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20214
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20215
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19872
20216
|
]
|
|
19873
20217
|
}
|
|
19874
20218
|
),
|
|
19875
|
-
error && /* @__PURE__ */
|
|
20219
|
+
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
20220
|
]
|
|
19877
20221
|
}
|
|
19878
20222
|
) });
|
|
@@ -19906,7 +20250,7 @@ function AiPricingCardOverlay({
|
|
|
19906
20250
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
19907
20251
|
setHover((prev) => {
|
|
19908
20252
|
const next = ref && !overEditable ? ref : null;
|
|
19909
|
-
return
|
|
20253
|
+
return sameRef2(prev, next) ? prev : next;
|
|
19910
20254
|
});
|
|
19911
20255
|
};
|
|
19912
20256
|
const onLeave = () => setHover(null);
|
|
@@ -19921,10 +20265,10 @@ function AiPricingCardOverlay({
|
|
|
19921
20265
|
const onClick = (e) => {
|
|
19922
20266
|
const t = e.target;
|
|
19923
20267
|
if (!(t instanceof Element)) return;
|
|
19924
|
-
if (t.closest(
|
|
20268
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
19925
20269
|
const ref = cardRefFromTarget(t);
|
|
19926
|
-
setActive((prev) =>
|
|
19927
|
-
if (!ref || !
|
|
20270
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20271
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
19928
20272
|
};
|
|
19929
20273
|
document.addEventListener("click", onClick, true);
|
|
19930
20274
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -19989,12 +20333,12 @@ function AiPricingCardOverlay({
|
|
|
19989
20333
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19990
20334
|
const activeCardRect = useLiveCardRect(active);
|
|
19991
20335
|
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__ */
|
|
20336
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20337
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20338
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20339
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20340
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20341
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
19998
20342
|
PricingCardToolbar,
|
|
19999
20343
|
{
|
|
20000
20344
|
entry: activeEntry,
|
|
@@ -20022,7 +20366,7 @@ function AiPricingCardOverlay({
|
|
|
20022
20366
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20023
20367
|
}
|
|
20024
20368
|
) }),
|
|
20025
|
-
/* @__PURE__ */
|
|
20369
|
+
/* @__PURE__ */ jsx22(
|
|
20026
20370
|
"div",
|
|
20027
20371
|
{
|
|
20028
20372
|
"data-ohw-bridge": "",
|
|
@@ -20086,39 +20430,11 @@ function clearVideo(tree, path) {
|
|
|
20086
20430
|
});
|
|
20087
20431
|
}
|
|
20088
20432
|
|
|
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
20433
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20118
|
-
import { Fragment as Fragment9, jsx as
|
|
20434
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20119
20435
|
var PRIMARY5 = "#0885FE";
|
|
20120
|
-
var
|
|
20121
|
-
var
|
|
20436
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20437
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20122
20438
|
function findVideoBlockElement(sectionId, path) {
|
|
20123
20439
|
const sectionEl = findByInstanceId(sectionId);
|
|
20124
20440
|
if (!sectionEl) return null;
|
|
@@ -20178,12 +20494,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20178
20494
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20179
20495
|
});
|
|
20180
20496
|
}
|
|
20181
|
-
function
|
|
20497
|
+
function Pill({
|
|
20182
20498
|
label,
|
|
20183
20499
|
onClick,
|
|
20184
20500
|
disabled
|
|
20185
20501
|
}) {
|
|
20186
|
-
return /* @__PURE__ */
|
|
20502
|
+
return /* @__PURE__ */ jsx23(
|
|
20187
20503
|
"button",
|
|
20188
20504
|
{
|
|
20189
20505
|
type: "button",
|
|
@@ -20199,7 +20515,7 @@ function Pill2({
|
|
|
20199
20515
|
border: "none",
|
|
20200
20516
|
cursor: disabled ? "default" : "pointer",
|
|
20201
20517
|
background: "#ffffff",
|
|
20202
|
-
color:
|
|
20518
|
+
color: OHW_BLUE_DARK,
|
|
20203
20519
|
opacity: disabled ? 0.4 : 1,
|
|
20204
20520
|
fontSize: 12,
|
|
20205
20521
|
lineHeight: "16px",
|
|
@@ -20242,8 +20558,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20242
20558
|
onCommit(id);
|
|
20243
20559
|
}
|
|
20244
20560
|
};
|
|
20245
|
-
return /* @__PURE__ */
|
|
20246
|
-
/* @__PURE__ */
|
|
20561
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20562
|
+
/* @__PURE__ */ jsxs14(
|
|
20247
20563
|
"div",
|
|
20248
20564
|
{
|
|
20249
20565
|
style: {
|
|
@@ -20259,12 +20575,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20259
20575
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20260
20576
|
},
|
|
20261
20577
|
children: [
|
|
20262
|
-
/* @__PURE__ */
|
|
20578
|
+
/* @__PURE__ */ jsx23(
|
|
20263
20579
|
"span",
|
|
20264
20580
|
{
|
|
20265
20581
|
style: {
|
|
20266
20582
|
flex: "0 0 auto",
|
|
20267
|
-
color:
|
|
20583
|
+
color: OHW_BLUE_DARK,
|
|
20268
20584
|
fontSize: 10,
|
|
20269
20585
|
lineHeight: "16px",
|
|
20270
20586
|
fontWeight: 700,
|
|
@@ -20274,7 +20590,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20274
20590
|
children: "Video"
|
|
20275
20591
|
}
|
|
20276
20592
|
),
|
|
20277
|
-
/* @__PURE__ */
|
|
20593
|
+
/* @__PURE__ */ jsx23(
|
|
20278
20594
|
"input",
|
|
20279
20595
|
{
|
|
20280
20596
|
type: "text",
|
|
@@ -20311,7 +20627,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20311
20627
|
]
|
|
20312
20628
|
}
|
|
20313
20629
|
),
|
|
20314
|
-
invalid && /* @__PURE__ */
|
|
20630
|
+
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
20631
|
] });
|
|
20316
20632
|
}
|
|
20317
20633
|
function VideoToolbar({
|
|
@@ -20321,7 +20637,7 @@ function VideoToolbar({
|
|
|
20321
20637
|
onSetVideoId,
|
|
20322
20638
|
onRemove
|
|
20323
20639
|
}) {
|
|
20324
|
-
return /* @__PURE__ */
|
|
20640
|
+
return /* @__PURE__ */ jsxs14(
|
|
20325
20641
|
"div",
|
|
20326
20642
|
{
|
|
20327
20643
|
"data-ohw-bridge": "",
|
|
@@ -20333,7 +20649,7 @@ function VideoToolbar({
|
|
|
20333
20649
|
gap: 6,
|
|
20334
20650
|
alignItems: "center",
|
|
20335
20651
|
width: 280,
|
|
20336
|
-
background:
|
|
20652
|
+
background: OHW_BLUE,
|
|
20337
20653
|
padding: 8,
|
|
20338
20654
|
borderRadius: 12,
|
|
20339
20655
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20341,9 +20657,9 @@ function VideoToolbar({
|
|
|
20341
20657
|
opacity: pending ? 0.6 : 1
|
|
20342
20658
|
},
|
|
20343
20659
|
children: [
|
|
20344
|
-
/* @__PURE__ */
|
|
20345
|
-
/* @__PURE__ */
|
|
20346
|
-
error && /* @__PURE__ */
|
|
20660
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20661
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20662
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20347
20663
|
]
|
|
20348
20664
|
}
|
|
20349
20665
|
);
|
|
@@ -20463,8 +20779,8 @@ function AiVideoOverlay({
|
|
|
20463
20779
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20464
20780
|
const TOOLBAR_APPROX_H = 90;
|
|
20465
20781
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20466
|
-
return /* @__PURE__ */
|
|
20467
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
20782
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
20783
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20468
20784
|
"button",
|
|
20469
20785
|
{
|
|
20470
20786
|
type: "button",
|
|
@@ -20492,15 +20808,15 @@ function AiVideoOverlay({
|
|
|
20492
20808
|
fontSize: 14,
|
|
20493
20809
|
fontWeight: 700
|
|
20494
20810
|
},
|
|
20495
|
-
children: /* @__PURE__ */
|
|
20811
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20496
20812
|
}
|
|
20497
20813
|
),
|
|
20498
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
20814
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20499
20815
|
ItemInteractionLayer,
|
|
20500
20816
|
{
|
|
20501
20817
|
rect: activeBlockRect,
|
|
20502
20818
|
state: toolbarState,
|
|
20503
|
-
toolbar: /* @__PURE__ */
|
|
20819
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20504
20820
|
VideoToolbar,
|
|
20505
20821
|
{
|
|
20506
20822
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20575,10 +20891,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20575
20891
|
}
|
|
20576
20892
|
|
|
20577
20893
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20578
|
-
import { Fragment as Fragment10, jsx as
|
|
20894
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20579
20895
|
var PRIMARY6 = "#0885FE";
|
|
20580
|
-
var
|
|
20581
|
-
var
|
|
20896
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
20897
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20582
20898
|
function findCarouselItemElement(sectionId, index) {
|
|
20583
20899
|
const sectionEl = findByInstanceId(sectionId);
|
|
20584
20900
|
if (!sectionEl) return null;
|
|
@@ -20657,8 +20973,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20657
20973
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20658
20974
|
});
|
|
20659
20975
|
}
|
|
20660
|
-
function
|
|
20661
|
-
return /* @__PURE__ */
|
|
20976
|
+
function Pill2({ label, onClick, disabled }) {
|
|
20977
|
+
return /* @__PURE__ */ jsx24(
|
|
20662
20978
|
"button",
|
|
20663
20979
|
{
|
|
20664
20980
|
type: "button",
|
|
@@ -20674,7 +20990,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20674
20990
|
border: "none",
|
|
20675
20991
|
cursor: disabled ? "default" : "pointer",
|
|
20676
20992
|
background: "#ffffff",
|
|
20677
|
-
color:
|
|
20993
|
+
color: OHW_BLUE_DARK2,
|
|
20678
20994
|
opacity: disabled ? 0.4 : 1,
|
|
20679
20995
|
fontSize: 12,
|
|
20680
20996
|
lineHeight: "16px",
|
|
@@ -20692,7 +21008,7 @@ function TogglePill({
|
|
|
20692
21008
|
onToggle,
|
|
20693
21009
|
disabled
|
|
20694
21010
|
}) {
|
|
20695
|
-
return /* @__PURE__ */
|
|
21011
|
+
return /* @__PURE__ */ jsxs15(
|
|
20696
21012
|
"button",
|
|
20697
21013
|
{
|
|
20698
21014
|
type: "button",
|
|
@@ -20711,7 +21027,7 @@ function TogglePill({
|
|
|
20711
21027
|
border: "none",
|
|
20712
21028
|
cursor: disabled ? "default" : "pointer",
|
|
20713
21029
|
background: "#ffffff",
|
|
20714
|
-
color:
|
|
21030
|
+
color: OHW_BLUE_DARK2,
|
|
20715
21031
|
opacity: disabled ? 0.4 : 1,
|
|
20716
21032
|
fontSize: 12,
|
|
20717
21033
|
lineHeight: "16px",
|
|
@@ -20721,7 +21037,7 @@ function TogglePill({
|
|
|
20721
21037
|
},
|
|
20722
21038
|
children: [
|
|
20723
21039
|
label,
|
|
20724
|
-
/* @__PURE__ */
|
|
21040
|
+
/* @__PURE__ */ jsx24(
|
|
20725
21041
|
"span",
|
|
20726
21042
|
{
|
|
20727
21043
|
"aria-hidden": true,
|
|
@@ -20734,10 +21050,10 @@ function TogglePill({
|
|
|
20734
21050
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20735
21051
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20736
21052
|
// "disabled control" rather than "switch that is off".
|
|
20737
|
-
background: on ?
|
|
21053
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20738
21054
|
transition: "background 120ms ease"
|
|
20739
21055
|
},
|
|
20740
|
-
children: /* @__PURE__ */
|
|
21056
|
+
children: /* @__PURE__ */ jsx24(
|
|
20741
21057
|
"span",
|
|
20742
21058
|
{
|
|
20743
21059
|
style: {
|
|
@@ -20766,7 +21082,7 @@ function CarouselSlideToolbar({
|
|
|
20766
21082
|
onChangeImage,
|
|
20767
21083
|
onToggleAutoplay
|
|
20768
21084
|
}) {
|
|
20769
|
-
return /* @__PURE__ */
|
|
21085
|
+
return /* @__PURE__ */ jsxs15(
|
|
20770
21086
|
"div",
|
|
20771
21087
|
{
|
|
20772
21088
|
"data-ohw-bridge": "",
|
|
@@ -20777,7 +21093,7 @@ function CarouselSlideToolbar({
|
|
|
20777
21093
|
flexDirection: "column",
|
|
20778
21094
|
gap: 6,
|
|
20779
21095
|
alignItems: "center",
|
|
20780
|
-
background:
|
|
21096
|
+
background: OHW_BLUE2,
|
|
20781
21097
|
padding: 8,
|
|
20782
21098
|
borderRadius: 12,
|
|
20783
21099
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20789,11 +21105,11 @@ function CarouselSlideToolbar({
|
|
|
20789
21105
|
pointerEvents: pending ? "none" : "auto"
|
|
20790
21106
|
},
|
|
20791
21107
|
children: [
|
|
20792
|
-
/* @__PURE__ */
|
|
20793
|
-
/* @__PURE__ */
|
|
20794
|
-
/* @__PURE__ */
|
|
21108
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21109
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21110
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20795
21111
|
] }),
|
|
20796
|
-
error && /* @__PURE__ */
|
|
21112
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20797
21113
|
]
|
|
20798
21114
|
}
|
|
20799
21115
|
);
|
|
@@ -20933,8 +21249,8 @@ function AiFadeCarouselOverlay({
|
|
|
20933
21249
|
const activeItemRect = useLiveItemRect2(active);
|
|
20934
21250
|
const TOOLBAR_APPROX_H = 90;
|
|
20935
21251
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20936
|
-
return /* @__PURE__ */
|
|
20937
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21252
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21253
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
20938
21254
|
"button",
|
|
20939
21255
|
{
|
|
20940
21256
|
type: "button",
|
|
@@ -20963,10 +21279,10 @@ function AiFadeCarouselOverlay({
|
|
|
20963
21279
|
fontSize: 14,
|
|
20964
21280
|
fontWeight: 700
|
|
20965
21281
|
},
|
|
20966
|
-
children: /* @__PURE__ */
|
|
21282
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
20967
21283
|
}
|
|
20968
21284
|
),
|
|
20969
|
-
swapping && /* @__PURE__ */
|
|
21285
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
20970
21286
|
"div",
|
|
20971
21287
|
{
|
|
20972
21288
|
ref: skeletonRef,
|
|
@@ -20984,15 +21300,15 @@ function AiFadeCarouselOverlay({
|
|
|
20984
21300
|
zIndex: 2147483646,
|
|
20985
21301
|
pointerEvents: "none"
|
|
20986
21302
|
},
|
|
20987
|
-
children: /* @__PURE__ */
|
|
21303
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
20988
21304
|
}
|
|
20989
21305
|
),
|
|
20990
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21306
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
20991
21307
|
ItemInteractionLayer,
|
|
20992
21308
|
{
|
|
20993
21309
|
rect: activeItemRect,
|
|
20994
21310
|
state: toolbarState,
|
|
20995
|
-
toolbar: /* @__PURE__ */
|
|
21311
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
20996
21312
|
CarouselSlideToolbar,
|
|
20997
21313
|
{
|
|
20998
21314
|
pending,
|
|
@@ -21183,118 +21499,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21183
21499
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21184
21500
|
import { useEffect as useEffect15 } from "react";
|
|
21185
21501
|
|
|
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;
|
|
21292
|
-
|
|
21293
21502
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21294
21503
|
import { Info, X as X4 } from "lucide-react";
|
|
21295
21504
|
|
|
21296
21505
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21297
|
-
import { ArrowRight as
|
|
21506
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21298
21507
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21299
21508
|
function DestinationBreadcrumb({
|
|
21300
21509
|
pageTitle,
|
|
@@ -21308,7 +21517,7 @@ function DestinationBreadcrumb({
|
|
|
21308
21517
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21309
21518
|
] }),
|
|
21310
21519
|
/* @__PURE__ */ jsx25(
|
|
21311
|
-
|
|
21520
|
+
ArrowRight3,
|
|
21312
21521
|
{
|
|
21313
21522
|
size: 16,
|
|
21314
21523
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21420,7 +21629,7 @@ function Label({ className, ...props }) {
|
|
|
21420
21629
|
}
|
|
21421
21630
|
|
|
21422
21631
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21423
|
-
import { ChevronDown as
|
|
21632
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21424
21633
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21425
21634
|
function FieldChevron({
|
|
21426
21635
|
onClick
|
|
@@ -21433,7 +21642,7 @@ function FieldChevron({
|
|
|
21433
21642
|
onClick,
|
|
21434
21643
|
"aria-label": "Open page list",
|
|
21435
21644
|
tabIndex: -1,
|
|
21436
|
-
children: /* @__PURE__ */ jsx29(
|
|
21645
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21437
21646
|
}
|
|
21438
21647
|
);
|
|
21439
21648
|
}
|
|
@@ -21663,7 +21872,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21663
21872
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21664
21873
|
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21665
21874
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21666
|
-
import { ArrowLeft as
|
|
21875
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21667
21876
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21668
21877
|
|
|
21669
21878
|
// src/lib/parent-scroll.ts
|
|
@@ -21940,7 +22149,7 @@ function SectionPickerOverlay({
|
|
|
21940
22149
|
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
22150
|
onClick: onBack,
|
|
21942
22151
|
children: [
|
|
21943
|
-
/* @__PURE__ */ jsx31(
|
|
22152
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
21944
22153
|
"Back"
|
|
21945
22154
|
]
|
|
21946
22155
|
}
|
|
@@ -22009,7 +22218,7 @@ function SectionPickerOverlay({
|
|
|
22009
22218
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22010
22219
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22011
22220
|
"aria-hidden": true,
|
|
22012
|
-
children: /* @__PURE__ */ jsx31(
|
|
22221
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22013
22222
|
}
|
|
22014
22223
|
) : null
|
|
22015
22224
|
]
|
|
@@ -22393,6 +22602,7 @@ function shouldUseDevFixtures() {
|
|
|
22393
22602
|
function getLogoElement(el) {
|
|
22394
22603
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22395
22604
|
if (marked) return marked;
|
|
22605
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22396
22606
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22397
22607
|
if (!root) return null;
|
|
22398
22608
|
const anchor = el.closest("a");
|
|
@@ -22462,7 +22672,7 @@ function addFooterColumnWithPersist({
|
|
|
22462
22672
|
import {
|
|
22463
22673
|
useCallback as useCallback9,
|
|
22464
22674
|
useEffect as useEffect16,
|
|
22465
|
-
useLayoutEffect as
|
|
22675
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22466
22676
|
useRef as useRef11,
|
|
22467
22677
|
useState as useState15
|
|
22468
22678
|
} from "react";
|
|
@@ -22559,7 +22769,7 @@ function FloatingPanel({
|
|
|
22559
22769
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22560
22770
|
}, [open]);
|
|
22561
22771
|
const positionRef = useRef11(position);
|
|
22562
|
-
|
|
22772
|
+
useLayoutEffect6(() => {
|
|
22563
22773
|
if (!open) {
|
|
22564
22774
|
positionRef.current = position;
|
|
22565
22775
|
return;
|
|
@@ -22569,7 +22779,7 @@ function FloatingPanel({
|
|
|
22569
22779
|
}
|
|
22570
22780
|
positionRef.current = position;
|
|
22571
22781
|
}, [open, position, liveScroll, parentScroll]);
|
|
22572
|
-
|
|
22782
|
+
useLayoutEffect6(() => {
|
|
22573
22783
|
if (!open || !panelRef.current) return;
|
|
22574
22784
|
const el = panelRef.current;
|
|
22575
22785
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22778,7 +22988,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
22778
22988
|
}
|
|
22779
22989
|
|
|
22780
22990
|
// src/ui/button-style-panel.tsx
|
|
22781
|
-
import { Check as
|
|
22991
|
+
import { Check as Check5 } from "lucide-react";
|
|
22782
22992
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22783
22993
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
22784
22994
|
function ButtonStylePanel({
|
|
@@ -22849,7 +23059,7 @@ function ButtonStylePanel({
|
|
|
22849
23059
|
{
|
|
22850
23060
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
22851
23061
|
"aria-hidden": true,
|
|
22852
|
-
children: /* @__PURE__ */ jsx35(
|
|
23062
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
22853
23063
|
}
|
|
22854
23064
|
) : null
|
|
22855
23065
|
]
|
|
@@ -23874,7 +24084,7 @@ function useSectionDrag({
|
|
|
23874
24084
|
}
|
|
23875
24085
|
|
|
23876
24086
|
// src/ui/footer-container-chrome.tsx
|
|
23877
|
-
import { Plus as
|
|
24087
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
23878
24088
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
23879
24089
|
function FooterContainerChrome({
|
|
23880
24090
|
rect,
|
|
@@ -23915,7 +24125,7 @@ function FooterContainerChrome({
|
|
|
23915
24125
|
if (addDisabled) return;
|
|
23916
24126
|
onAdd();
|
|
23917
24127
|
},
|
|
23918
|
-
children: /* @__PURE__ */ jsx36(
|
|
24128
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
23919
24129
|
}
|
|
23920
24130
|
) }),
|
|
23921
24131
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24093,6 +24303,138 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24093
24303
|
return false;
|
|
24094
24304
|
}
|
|
24095
24305
|
|
|
24306
|
+
// src/lib/build-page-sync.ts
|
|
24307
|
+
import { useEffect as useEffect19 } from "react";
|
|
24308
|
+
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24309
|
+
function normalisePath(path) {
|
|
24310
|
+
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
24311
|
+
if (!trimmed || trimmed === "/") return "/";
|
|
24312
|
+
return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
|
|
24313
|
+
}
|
|
24314
|
+
function isDeadPageHref(href, livePaths) {
|
|
24315
|
+
const value = href.trim();
|
|
24316
|
+
if (!value.startsWith("/") || value.startsWith("//")) return false;
|
|
24317
|
+
const path = normalisePath(value);
|
|
24318
|
+
if (path === "/") return false;
|
|
24319
|
+
return !livePaths.some((live) => {
|
|
24320
|
+
const p = normalisePath(live);
|
|
24321
|
+
return p === path || p !== "/" && path.startsWith(`${p}/`);
|
|
24322
|
+
});
|
|
24323
|
+
}
|
|
24324
|
+
var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
24325
|
+
function planBuildPageSync(links, msg) {
|
|
24326
|
+
const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
|
|
24327
|
+
const removed = new Set((msg.removed ?? []).map(normalisePath));
|
|
24328
|
+
const remove = [];
|
|
24329
|
+
const relabel = [];
|
|
24330
|
+
const retarget = [];
|
|
24331
|
+
const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
|
|
24332
|
+
for (const link of links) {
|
|
24333
|
+
const href = link.href.trim();
|
|
24334
|
+
const isPage = href.startsWith("/") && !href.startsWith("//");
|
|
24335
|
+
if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
|
|
24336
|
+
if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
|
|
24337
|
+
else remove.push(link.hrefKey);
|
|
24338
|
+
continue;
|
|
24339
|
+
}
|
|
24340
|
+
if (isPage) {
|
|
24341
|
+
const path = normalisePath(href);
|
|
24342
|
+
const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
|
|
24343
|
+
if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
|
|
24344
|
+
relabel.push({ hrefKey: link.hrefKey, label: rename.label });
|
|
24345
|
+
}
|
|
24346
|
+
continue;
|
|
24347
|
+
}
|
|
24348
|
+
if (href.startsWith("#") || href.startsWith("/#")) {
|
|
24349
|
+
const anchor = href.replace(/^\/?#/u, "").toLowerCase();
|
|
24350
|
+
const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
|
|
24351
|
+
if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
|
|
24352
|
+
relabel.push({ hrefKey: link.hrefKey, label: target.label });
|
|
24353
|
+
}
|
|
24354
|
+
}
|
|
24355
|
+
}
|
|
24356
|
+
return { remove, relabel, retarget };
|
|
24357
|
+
}
|
|
24358
|
+
function linkHref(el) {
|
|
24359
|
+
const key = el.getAttribute("data-ohw-href-key");
|
|
24360
|
+
const stored = key ? getStoredLinkHref(key) : void 0;
|
|
24361
|
+
return stored ?? el.getAttribute("href") ?? "";
|
|
24362
|
+
}
|
|
24363
|
+
function labelEl(anchor) {
|
|
24364
|
+
return anchor.querySelector('[data-ohw-editable="text"]');
|
|
24365
|
+
}
|
|
24366
|
+
function collectLinks() {
|
|
24367
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24368
|
+
const links = [];
|
|
24369
|
+
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
24370
|
+
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
24371
|
+
if (seen.has(hrefKey)) return;
|
|
24372
|
+
const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
24373
|
+
if (!area) return;
|
|
24374
|
+
const label = labelEl(el);
|
|
24375
|
+
if (!label && area !== "chrome") return;
|
|
24376
|
+
seen.add(hrefKey);
|
|
24377
|
+
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
24378
|
+
});
|
|
24379
|
+
return links;
|
|
24380
|
+
}
|
|
24381
|
+
function applyBuildPageSync(msg, deps) {
|
|
24382
|
+
const plan = planBuildPageSync(collectLinks(), msg);
|
|
24383
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
24384
|
+
for (const hrefKey of plan.remove) {
|
|
24385
|
+
const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
24386
|
+
if (!anchor) continue;
|
|
24387
|
+
const nav = isNavbarHrefKey(hrefKey);
|
|
24388
|
+
const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
|
|
24389
|
+
if (!result) continue;
|
|
24390
|
+
for (const key of result.removedKeys) {
|
|
24391
|
+
nodes.set(key, "");
|
|
24392
|
+
clearStoredLinkHref(key);
|
|
24393
|
+
}
|
|
24394
|
+
nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
|
|
24395
|
+
}
|
|
24396
|
+
for (const { hrefKey, label } of plan.relabel) {
|
|
24397
|
+
const labelKey = hrefKey.replace(/-href$/u, "-label");
|
|
24398
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24399
|
+
const el = labelEl(anchor);
|
|
24400
|
+
if (el) el.textContent = label;
|
|
24401
|
+
});
|
|
24402
|
+
nodes.set(labelKey, label);
|
|
24403
|
+
}
|
|
24404
|
+
for (const { hrefKey, href } of plan.retarget) {
|
|
24405
|
+
setStoredLinkHref(hrefKey, href);
|
|
24406
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24407
|
+
if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
|
|
24408
|
+
});
|
|
24409
|
+
nodes.set(hrefKey, href);
|
|
24410
|
+
}
|
|
24411
|
+
if (nodes.size === 0) return 0;
|
|
24412
|
+
deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
|
|
24413
|
+
deps.postToParent({
|
|
24414
|
+
type: "ow:change",
|
|
24415
|
+
nodes: [...nodes].map(([key, text]) => ({ key, text }))
|
|
24416
|
+
});
|
|
24417
|
+
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24418
|
+
}
|
|
24419
|
+
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24420
|
+
useEffect19(() => {
|
|
24421
|
+
if (!isEditMode) return;
|
|
24422
|
+
const onMessage = (e) => {
|
|
24423
|
+
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
24424
|
+
const changed = applyBuildPageSync(e.data, {
|
|
24425
|
+
getEditContent: () => editContentRef.current,
|
|
24426
|
+
setEditContent: (next) => {
|
|
24427
|
+
editContentRef.current = next;
|
|
24428
|
+
},
|
|
24429
|
+
postToParent: postToParent2
|
|
24430
|
+
});
|
|
24431
|
+
postToParent2({ type: "ow:pages-synced", changed });
|
|
24432
|
+
};
|
|
24433
|
+
window.addEventListener("message", onMessage);
|
|
24434
|
+
return () => window.removeEventListener("message", onMessage);
|
|
24435
|
+
}, [isEditMode, editContentRef, postToParent2]);
|
|
24436
|
+
}
|
|
24437
|
+
|
|
24096
24438
|
// src/lib/nav-page-sync.ts
|
|
24097
24439
|
function labelKeyFor(hrefKey) {
|
|
24098
24440
|
return hrefKey.replace(/-href$/, "-label");
|
|
@@ -24190,7 +24532,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24190
24532
|
}
|
|
24191
24533
|
|
|
24192
24534
|
// src/ui/navbar-container-chrome.tsx
|
|
24193
|
-
import { Plus as
|
|
24535
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24194
24536
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24195
24537
|
function NavbarContainerChrome({
|
|
24196
24538
|
rect,
|
|
@@ -24226,7 +24568,7 @@ function NavbarContainerChrome({
|
|
|
24226
24568
|
e.stopPropagation();
|
|
24227
24569
|
onAdd();
|
|
24228
24570
|
},
|
|
24229
|
-
children: /* @__PURE__ */ jsx37(
|
|
24571
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24230
24572
|
}
|
|
24231
24573
|
)
|
|
24232
24574
|
}
|
|
@@ -24298,7 +24640,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24298
24640
|
}
|
|
24299
24641
|
|
|
24300
24642
|
// src/OhhwellsBridge.tsx
|
|
24301
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
24643
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
|
|
24302
24644
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24303
24645
|
var PRIMARY7 = "#0885FE";
|
|
24304
24646
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25076,7 +25418,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25076
25418
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25077
25419
|
return resolveFooterLinksContainerFrom(el);
|
|
25078
25420
|
}
|
|
25079
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25421
|
+
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
25422
|
return getNavigationRoot(el);
|
|
25081
25423
|
}
|
|
25082
25424
|
return null;
|
|
@@ -25298,7 +25640,6 @@ var ICONS = {
|
|
|
25298
25640
|
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
25641
|
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
25642
|
};
|
|
25301
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25302
25643
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25303
25644
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25304
25645
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25396,7 +25737,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25396
25737
|
el.style.top = `${top}px`;
|
|
25397
25738
|
el.style.height = `${height}px`;
|
|
25398
25739
|
}
|
|
25399
|
-
var
|
|
25740
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25400
25741
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25401
25742
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25402
25743
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25423,8 +25764,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25423
25764
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25424
25765
|
const half = toolbarWidth / 2;
|
|
25425
25766
|
return Math.max(
|
|
25426
|
-
|
|
25427
|
-
Math.min(centerX, window.innerWidth -
|
|
25767
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
25768
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25428
25769
|
);
|
|
25429
25770
|
}
|
|
25430
25771
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25798,7 +26139,7 @@ function OhhwellsBridge() {
|
|
|
25798
26139
|
const searchParams = useSearchParams();
|
|
25799
26140
|
const isEditMode = isEditSessionActive();
|
|
25800
26141
|
const [bridgeRoot, setBridgeRoot] = useState18(null);
|
|
25801
|
-
|
|
26142
|
+
useEffect20(() => {
|
|
25802
26143
|
const figtreeFontId = "ohw-figtree-font";
|
|
25803
26144
|
if (!document.getElementById(figtreeFontId)) {
|
|
25804
26145
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25825,7 +26166,7 @@ function OhhwellsBridge() {
|
|
|
25825
26166
|
}, []);
|
|
25826
26167
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25827
26168
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
25828
|
-
|
|
26169
|
+
useLayoutEffect7(() => {
|
|
25829
26170
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25830
26171
|
if (next !== subdomain) setSubdomain(next);
|
|
25831
26172
|
if (next) return;
|
|
@@ -25837,7 +26178,7 @@ function OhhwellsBridge() {
|
|
|
25837
26178
|
}, 0);
|
|
25838
26179
|
return () => window.clearTimeout(t);
|
|
25839
26180
|
}, [subdomainFromQuery, subdomain]);
|
|
25840
|
-
|
|
26181
|
+
useEffect20(() => {
|
|
25841
26182
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
25842
26183
|
const url = new URL(window.location.href);
|
|
25843
26184
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -25857,14 +26198,14 @@ function OhhwellsBridge() {
|
|
|
25857
26198
|
const [fetchState, setFetchState] = useState18("idle");
|
|
25858
26199
|
const [showBranding, setShowBranding] = useState18(false);
|
|
25859
26200
|
const autoSaveTimers = useRef14(/* @__PURE__ */ new Map());
|
|
25860
|
-
|
|
26201
|
+
useEffect20(() => {
|
|
25861
26202
|
stampBridgeVersionOnDocument();
|
|
25862
26203
|
}, []);
|
|
25863
|
-
|
|
26204
|
+
useEffect20(() => {
|
|
25864
26205
|
if (isEditMode) return;
|
|
25865
26206
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
25866
26207
|
}, [isEditMode, subdomain, fetchState]);
|
|
25867
|
-
|
|
26208
|
+
useEffect20(() => {
|
|
25868
26209
|
if (isEditMode || !subdomain) return;
|
|
25869
26210
|
const onError = (event) => {
|
|
25870
26211
|
reportOutageBeacon({
|
|
@@ -26005,7 +26346,7 @@ function OhhwellsBridge() {
|
|
|
26005
26346
|
}, []);
|
|
26006
26347
|
const selectMediaElementRef = useRef14(selectMediaElement);
|
|
26007
26348
|
selectMediaElementRef.current = selectMediaElement;
|
|
26008
|
-
|
|
26349
|
+
useEffect20(() => {
|
|
26009
26350
|
if (!selectedMedia) return;
|
|
26010
26351
|
const update = () => {
|
|
26011
26352
|
const el = selectedMediaElRef.current;
|
|
@@ -26220,7 +26561,7 @@ function OhhwellsBridge() {
|
|
|
26220
26561
|
const [fieldDragging, setFieldDragging] = useState18(false);
|
|
26221
26562
|
const clearFormPickRef = useRef14(clearFormPick);
|
|
26222
26563
|
clearFormPickRef.current = clearFormPick;
|
|
26223
|
-
|
|
26564
|
+
useEffect20(() => {
|
|
26224
26565
|
const el = fieldPickElRef.current;
|
|
26225
26566
|
if (!el || fieldPickRect === null) return;
|
|
26226
26567
|
const observer = new ResizeObserver(() => {
|
|
@@ -26229,7 +26570,7 @@ function OhhwellsBridge() {
|
|
|
26229
26570
|
observer.observe(el);
|
|
26230
26571
|
return () => observer.disconnect();
|
|
26231
26572
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26232
|
-
|
|
26573
|
+
useEffect20(() => {
|
|
26233
26574
|
const el = formPickElRef.current;
|
|
26234
26575
|
if (!el || formPickRect === null) return;
|
|
26235
26576
|
const observer = new ResizeObserver(() => {
|
|
@@ -26256,7 +26597,7 @@ function OhhwellsBridge() {
|
|
|
26256
26597
|
const hoveredItemElRef = useRef14(null);
|
|
26257
26598
|
const [hoveredItemRect, setHoveredItemRect] = useState18(null);
|
|
26258
26599
|
const [hoveredTextRect, setHoveredTextRect] = useState18(null);
|
|
26259
|
-
|
|
26600
|
+
useEffect20(() => {
|
|
26260
26601
|
const sync = () => {
|
|
26261
26602
|
const el = document.querySelector(
|
|
26262
26603
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26306,21 +26647,6 @@ function OhhwellsBridge() {
|
|
|
26306
26647
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26307
26648
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26308
26649
|
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
26650
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26325
26651
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26326
26652
|
const footerDragRef = useRef14(null);
|
|
@@ -26334,6 +26660,7 @@ function OhhwellsBridge() {
|
|
|
26334
26660
|
const linkPopoverSessionRef = useRef14(null);
|
|
26335
26661
|
const addNavAfterAnchorRef = useRef14(null);
|
|
26336
26662
|
const editContentRef = useRef14({});
|
|
26663
|
+
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
26337
26664
|
const aiSectionsRef = useRef14("");
|
|
26338
26665
|
const aiFooterRef = useRef14("");
|
|
26339
26666
|
const applyTreeLocalRef = useRef14(
|
|
@@ -26346,6 +26673,21 @@ function OhhwellsBridge() {
|
|
|
26346
26673
|
const stylesRef = useRef14("");
|
|
26347
26674
|
const appliedDrawerRef = useRef14(null);
|
|
26348
26675
|
const pendingDeleteUndoRef = useRef14(null);
|
|
26676
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26677
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
26678
|
+
const floatingPanelRef = useRef14(null);
|
|
26679
|
+
floatingPanelRef.current = floatingPanel;
|
|
26680
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
26681
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26682
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
26683
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
26684
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26685
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26686
|
+
const buttonPointerDragRef = useRef14(null);
|
|
26687
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26688
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26689
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26690
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26349
26691
|
const [sitePages, setSitePages] = useState18([]);
|
|
26350
26692
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26351
26693
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26355,8 +26697,19 @@ function OhhwellsBridge() {
|
|
|
26355
26697
|
const linkPopoverOpenRef = useRef14(false);
|
|
26356
26698
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26357
26699
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26700
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26358
26701
|
linkPopoverSessionRef.current = linkPopover;
|
|
26359
|
-
|
|
26702
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26703
|
+
useEffect20(() => {
|
|
26704
|
+
const syncViewport = () => {
|
|
26705
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26706
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26707
|
+
};
|
|
26708
|
+
syncViewport();
|
|
26709
|
+
window.addEventListener("resize", syncViewport);
|
|
26710
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26711
|
+
}, []);
|
|
26712
|
+
useEffect20(() => {
|
|
26360
26713
|
setSectionOrderPersistHandler((entries) => {
|
|
26361
26714
|
const currentPath = window.location.pathname;
|
|
26362
26715
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26366,7 +26719,7 @@ function OhhwellsBridge() {
|
|
|
26366
26719
|
});
|
|
26367
26720
|
return () => setSectionOrderPersistHandler(null);
|
|
26368
26721
|
}, []);
|
|
26369
|
-
|
|
26722
|
+
useEffect20(() => {
|
|
26370
26723
|
setAiFooterMountOptions({
|
|
26371
26724
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26372
26725
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26450,7 +26803,7 @@ function OhhwellsBridge() {
|
|
|
26450
26803
|
}, [isEditMode, pathname]);
|
|
26451
26804
|
const runSectionsPrefetchRef = useRef14(runSectionsPrefetch);
|
|
26452
26805
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26453
|
-
|
|
26806
|
+
useEffect20(() => {
|
|
26454
26807
|
if (!linkPopover) {
|
|
26455
26808
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26456
26809
|
return;
|
|
@@ -26478,7 +26831,7 @@ function OhhwellsBridge() {
|
|
|
26478
26831
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26479
26832
|
};
|
|
26480
26833
|
}, [linkPopover, postToParent2]);
|
|
26481
|
-
|
|
26834
|
+
useEffect20(() => {
|
|
26482
26835
|
if (!isEditMode) return;
|
|
26483
26836
|
const useFixtures = shouldUseDevFixtures();
|
|
26484
26837
|
if (useFixtures) {
|
|
@@ -26504,7 +26857,7 @@ function OhhwellsBridge() {
|
|
|
26504
26857
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26505
26858
|
return () => window.removeEventListener("message", onSitePages);
|
|
26506
26859
|
}, [isEditMode, postToParent2]);
|
|
26507
|
-
|
|
26860
|
+
useEffect20(() => {
|
|
26508
26861
|
if (!isEditMode) return;
|
|
26509
26862
|
const deps = {
|
|
26510
26863
|
getEditContent: () => editContentRef.current,
|
|
@@ -26541,14 +26894,14 @@ function OhhwellsBridge() {
|
|
|
26541
26894
|
window.addEventListener("message", onPageMessage);
|
|
26542
26895
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26543
26896
|
}, [isEditMode, postToParent2]);
|
|
26544
|
-
|
|
26897
|
+
useEffect20(() => {
|
|
26545
26898
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26546
26899
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26547
26900
|
if (Object.keys(manifest).length === 0) return;
|
|
26548
26901
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26549
26902
|
});
|
|
26550
26903
|
}, [isEditMode]);
|
|
26551
|
-
|
|
26904
|
+
useEffect20(() => {
|
|
26552
26905
|
const update = () => {
|
|
26553
26906
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26554
26907
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27807,7 +28160,7 @@ function OhhwellsBridge() {
|
|
|
27807
28160
|
},
|
|
27808
28161
|
[postToParent2]
|
|
27809
28162
|
);
|
|
27810
|
-
|
|
28163
|
+
useEffect20(() => {
|
|
27811
28164
|
const onDragOver = (e) => {
|
|
27812
28165
|
const dragged = buttonCollectionDragRef.current;
|
|
27813
28166
|
if (!dragged) return;
|
|
@@ -27878,7 +28231,7 @@ function OhhwellsBridge() {
|
|
|
27878
28231
|
setLogoSizeDraft(null);
|
|
27879
28232
|
deselectRef.current();
|
|
27880
28233
|
}, []);
|
|
27881
|
-
|
|
28234
|
+
useEffect20(() => {
|
|
27882
28235
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
27883
28236
|
if (!session || !logoSizeDraft) {
|
|
27884
28237
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28036,7 +28389,7 @@ function OhhwellsBridge() {
|
|
|
28036
28389
|
deselectRef.current = deselect;
|
|
28037
28390
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28038
28391
|
const lastSiteWideScopeRef = useRef14(null);
|
|
28039
|
-
|
|
28392
|
+
useEffect20(() => {
|
|
28040
28393
|
if (!isEditMode) {
|
|
28041
28394
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28042
28395
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28062,7 +28415,7 @@ function OhhwellsBridge() {
|
|
|
28062
28415
|
isFooterFrameSelection,
|
|
28063
28416
|
postToParent2
|
|
28064
28417
|
]);
|
|
28065
|
-
|
|
28418
|
+
useLayoutEffect7(() => {
|
|
28066
28419
|
if (!subdomain || isEditMode) {
|
|
28067
28420
|
setFetchState("done");
|
|
28068
28421
|
return;
|
|
@@ -28089,6 +28442,7 @@ function OhhwellsBridge() {
|
|
|
28089
28442
|
applyAiFooterFromContent(content);
|
|
28090
28443
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28091
28444
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28445
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28092
28446
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28093
28447
|
}
|
|
28094
28448
|
applyBrandChrome(content);
|
|
@@ -28099,15 +28453,16 @@ function OhhwellsBridge() {
|
|
|
28099
28453
|
if (key === "__ohw_sections") continue;
|
|
28100
28454
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28101
28455
|
if (key === AI_FOOTER_KEY) continue;
|
|
28456
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28457
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28102
28458
|
if (key === BRAND_KIT_KEY) continue;
|
|
28103
28459
|
if (key === STYLE_STORE_KEY) continue;
|
|
28104
28460
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28105
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28106
28461
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28107
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28108
28462
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28109
28463
|
continue;
|
|
28110
28464
|
}
|
|
28465
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28111
28466
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28112
28467
|
if (applyCarouselNode(key, val)) continue;
|
|
28113
28468
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28147,6 +28502,7 @@ function OhhwellsBridge() {
|
|
|
28147
28502
|
});
|
|
28148
28503
|
applyLinkByKey(key, val);
|
|
28149
28504
|
}
|
|
28505
|
+
applySectionEmbeds(content);
|
|
28150
28506
|
applyLogoFromContent(content);
|
|
28151
28507
|
applyLogoSizes(content);
|
|
28152
28508
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28213,7 +28569,7 @@ function OhhwellsBridge() {
|
|
|
28213
28569
|
cancelled = true;
|
|
28214
28570
|
};
|
|
28215
28571
|
}, [subdomain, isEditMode]);
|
|
28216
|
-
|
|
28572
|
+
useEffect20(() => {
|
|
28217
28573
|
if (!isEditMode) return;
|
|
28218
28574
|
const resolveIndex = (form, clientY) => {
|
|
28219
28575
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28254,7 +28610,7 @@ function OhhwellsBridge() {
|
|
|
28254
28610
|
window.removeEventListener("drop", onDrop, true);
|
|
28255
28611
|
};
|
|
28256
28612
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28257
|
-
|
|
28613
|
+
useEffect20(() => {
|
|
28258
28614
|
if (!isEditMode) return;
|
|
28259
28615
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28260
28616
|
markFormFields(form);
|
|
@@ -28266,7 +28622,7 @@ function OhhwellsBridge() {
|
|
|
28266
28622
|
});
|
|
28267
28623
|
return () => observer.disconnect();
|
|
28268
28624
|
}, [isEditMode, fetchState, pathname]);
|
|
28269
|
-
|
|
28625
|
+
useEffect20(() => {
|
|
28270
28626
|
if (!isEditMode) return;
|
|
28271
28627
|
let saveTimer = null;
|
|
28272
28628
|
const onInput = (e) => {
|
|
@@ -28288,14 +28644,14 @@ function OhhwellsBridge() {
|
|
|
28288
28644
|
document.addEventListener("input", onInput, true);
|
|
28289
28645
|
return () => document.removeEventListener("input", onInput, true);
|
|
28290
28646
|
}, [isEditMode, persistFields]);
|
|
28291
|
-
|
|
28647
|
+
useEffect20(() => {
|
|
28292
28648
|
if (isEditMode || fetchState !== "done") return;
|
|
28293
28649
|
const content = contentCache.get(subdomain) ?? {};
|
|
28294
28650
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28295
28651
|
reconcileFieldsFromContent(form, content);
|
|
28296
28652
|
});
|
|
28297
28653
|
}, [isEditMode, fetchState, subdomain]);
|
|
28298
|
-
|
|
28654
|
+
useEffect20(() => {
|
|
28299
28655
|
if (!isEditMode) return;
|
|
28300
28656
|
const swallow = (e) => {
|
|
28301
28657
|
const target = e.target;
|
|
@@ -28304,14 +28660,14 @@ function OhhwellsBridge() {
|
|
|
28304
28660
|
document.addEventListener("submit", swallow, true);
|
|
28305
28661
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28306
28662
|
}, [isEditMode]);
|
|
28307
|
-
|
|
28663
|
+
useEffect20(() => {
|
|
28308
28664
|
if (isEditMode || fetchState !== "done") return;
|
|
28309
28665
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28310
28666
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28311
28667
|
console.log({ apiUrl, subdomain });
|
|
28312
28668
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28313
28669
|
}, [isEditMode, fetchState, subdomain]);
|
|
28314
|
-
|
|
28670
|
+
useEffect20(() => {
|
|
28315
28671
|
if (!subdomain || isEditMode) return;
|
|
28316
28672
|
let debounceTimer = null;
|
|
28317
28673
|
let observer = null;
|
|
@@ -28335,20 +28691,22 @@ function OhhwellsBridge() {
|
|
|
28335
28691
|
}
|
|
28336
28692
|
applyAiFooterFromContent(content);
|
|
28337
28693
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28694
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28338
28695
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28339
28696
|
}
|
|
28340
28697
|
for (const [key, val] of Object.entries(content)) {
|
|
28341
28698
|
if (key === "__ohw_sections") continue;
|
|
28342
28699
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28343
28700
|
if (key === AI_FOOTER_KEY) continue;
|
|
28701
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28702
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28344
28703
|
if (key === BRAND_KIT_KEY) continue;
|
|
28345
28704
|
if (key === STYLE_STORE_KEY) continue;
|
|
28346
28705
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28347
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28348
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28349
28706
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28350
28707
|
continue;
|
|
28351
28708
|
}
|
|
28709
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28352
28710
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28353
28711
|
if (applyCarouselNode(key, val)) continue;
|
|
28354
28712
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28373,6 +28731,7 @@ function OhhwellsBridge() {
|
|
|
28373
28731
|
});
|
|
28374
28732
|
applyLinkByKey(key, val);
|
|
28375
28733
|
}
|
|
28734
|
+
applySectionEmbeds(content);
|
|
28376
28735
|
applyLogoFromContent(content);
|
|
28377
28736
|
reconcileNavbarItemsFromContent(content);
|
|
28378
28737
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28428,16 +28787,16 @@ function OhhwellsBridge() {
|
|
|
28428
28787
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28429
28788
|
};
|
|
28430
28789
|
}, [subdomain, isEditMode, pathname]);
|
|
28431
|
-
|
|
28790
|
+
useLayoutEffect7(() => {
|
|
28432
28791
|
const el = document.getElementById("ohw-loader");
|
|
28433
28792
|
if (!el) return;
|
|
28434
28793
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28435
28794
|
el.style.display = visible ? "flex" : "none";
|
|
28436
28795
|
}, [subdomain, fetchState]);
|
|
28437
|
-
|
|
28796
|
+
useEffect20(() => {
|
|
28438
28797
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28439
28798
|
}, [pathname, postToParent2]);
|
|
28440
|
-
|
|
28799
|
+
useEffect20(() => {
|
|
28441
28800
|
if (!subdomain || isEditMode) return;
|
|
28442
28801
|
const content = contentCache.get(subdomain);
|
|
28443
28802
|
if (!content) return;
|
|
@@ -28455,7 +28814,7 @@ function OhhwellsBridge() {
|
|
|
28455
28814
|
}
|
|
28456
28815
|
applyAiFooterFromContent(content);
|
|
28457
28816
|
}, [pathname, subdomain, isEditMode]);
|
|
28458
|
-
|
|
28817
|
+
useEffect20(() => {
|
|
28459
28818
|
if (!isEditMode) return;
|
|
28460
28819
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28461
28820
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28463,12 +28822,12 @@ function OhhwellsBridge() {
|
|
|
28463
28822
|
deselectRef.current();
|
|
28464
28823
|
deactivateRef.current();
|
|
28465
28824
|
}, [pathname, isEditMode]);
|
|
28466
|
-
|
|
28825
|
+
useEffect20(() => {
|
|
28467
28826
|
if (!isEditMode) return;
|
|
28468
28827
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28469
28828
|
initItemInstancesFromContent(editContentRef.current);
|
|
28470
28829
|
}, [pathname, isEditMode]);
|
|
28471
|
-
|
|
28830
|
+
useEffect20(() => {
|
|
28472
28831
|
if (!isEditMode) return;
|
|
28473
28832
|
const observer = new MutationObserver(() => {
|
|
28474
28833
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28479,7 +28838,7 @@ function OhhwellsBridge() {
|
|
|
28479
28838
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28480
28839
|
return () => observer.disconnect();
|
|
28481
28840
|
}, [isEditMode, pathname]);
|
|
28482
|
-
|
|
28841
|
+
useEffect20(() => {
|
|
28483
28842
|
const contentForNav = () => {
|
|
28484
28843
|
if (isEditMode) return editContentRef.current;
|
|
28485
28844
|
if (!subdomain) return {};
|
|
@@ -28552,7 +28911,7 @@ function OhhwellsBridge() {
|
|
|
28552
28911
|
observer?.disconnect();
|
|
28553
28912
|
};
|
|
28554
28913
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28555
|
-
|
|
28914
|
+
useEffect20(() => {
|
|
28556
28915
|
if (!isEditMode) return;
|
|
28557
28916
|
let applying = false;
|
|
28558
28917
|
let rafId = null;
|
|
@@ -28590,7 +28949,7 @@ function OhhwellsBridge() {
|
|
|
28590
28949
|
observer.disconnect();
|
|
28591
28950
|
};
|
|
28592
28951
|
}, [isEditMode, pathname]);
|
|
28593
|
-
|
|
28952
|
+
useEffect20(() => {
|
|
28594
28953
|
if (!isEditMode) return;
|
|
28595
28954
|
let lastPosted = 0;
|
|
28596
28955
|
const measure = () => {
|
|
@@ -28612,29 +28971,14 @@ function OhhwellsBridge() {
|
|
|
28612
28971
|
const t2 = setTimeout(measure, 500);
|
|
28613
28972
|
const ro = new ResizeObserver(schedule);
|
|
28614
28973
|
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
28974
|
return () => {
|
|
28629
28975
|
clearTimeout(t1);
|
|
28630
28976
|
clearTimeout(t2);
|
|
28631
28977
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28632
28978
|
ro.disconnect();
|
|
28633
|
-
clearResizeTimers();
|
|
28634
|
-
window.removeEventListener("resize", handleResize);
|
|
28635
28979
|
};
|
|
28636
28980
|
}, [pathname, isEditMode, postToParent2]);
|
|
28637
|
-
|
|
28981
|
+
useEffect20(() => {
|
|
28638
28982
|
if (isEditMode) return;
|
|
28639
28983
|
const handleClick = (e) => {
|
|
28640
28984
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28648,7 +28992,7 @@ function OhhwellsBridge() {
|
|
|
28648
28992
|
document.addEventListener("click", handleClick, true);
|
|
28649
28993
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28650
28994
|
}, [isEditMode, router, pathname]);
|
|
28651
|
-
|
|
28995
|
+
useEffect20(() => {
|
|
28652
28996
|
if (!isEditMode) {
|
|
28653
28997
|
editStylesRef.current?.base.remove();
|
|
28654
28998
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -28928,6 +29272,13 @@ function OhhwellsBridge() {
|
|
|
28928
29272
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
28929
29273
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
28930
29274
|
if (isInsideLinkEditor(target)) return;
|
|
29275
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29276
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29277
|
+
if (target.closest(
|
|
29278
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29279
|
+
)) {
|
|
29280
|
+
return;
|
|
29281
|
+
}
|
|
28931
29282
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
28932
29283
|
clearMediaSelectionRef.current();
|
|
28933
29284
|
}
|
|
@@ -28951,8 +29302,6 @@ function OhhwellsBridge() {
|
|
|
28951
29302
|
return;
|
|
28952
29303
|
}
|
|
28953
29304
|
}
|
|
28954
|
-
if (isInsideFloatingPanel(target)) return;
|
|
28955
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
28956
29305
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
28957
29306
|
if (collectionItem) {
|
|
28958
29307
|
e.preventDefault();
|
|
@@ -28964,11 +29313,6 @@ function OhhwellsBridge() {
|
|
|
28964
29313
|
});
|
|
28965
29314
|
return;
|
|
28966
29315
|
}
|
|
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
29316
|
{
|
|
28973
29317
|
const formEl = getFormElement(target);
|
|
28974
29318
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29122,9 +29466,13 @@ function OhhwellsBridge() {
|
|
|
29122
29466
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29123
29467
|
e.preventDefault();
|
|
29124
29468
|
e.stopPropagation();
|
|
29125
|
-
selectIconElementRef.current(editable);
|
|
29126
29469
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29127
29470
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29471
|
+
if (aiIcon) {
|
|
29472
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29473
|
+
} else {
|
|
29474
|
+
selectIconElementRef.current(editable);
|
|
29475
|
+
}
|
|
29128
29476
|
postToParentRef.current({
|
|
29129
29477
|
type: "ow:icon-pick",
|
|
29130
29478
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29352,6 +29700,9 @@ function OhhwellsBridge() {
|
|
|
29352
29700
|
setHoveredItemRect(null);
|
|
29353
29701
|
hoveredNavContainerRef.current = null;
|
|
29354
29702
|
setHoveredNavContainerRect(null);
|
|
29703
|
+
siblingHintElRef.current = null;
|
|
29704
|
+
setSiblingHintRect(null);
|
|
29705
|
+
setSiblingHintRects([]);
|
|
29355
29706
|
return;
|
|
29356
29707
|
}
|
|
29357
29708
|
{
|
|
@@ -29472,7 +29823,6 @@ function OhhwellsBridge() {
|
|
|
29472
29823
|
hoveredNavContainerRef.current = null;
|
|
29473
29824
|
setHoveredNavContainerRect(null);
|
|
29474
29825
|
hoveredItemElRef.current = editable;
|
|
29475
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29476
29826
|
}
|
|
29477
29827
|
}
|
|
29478
29828
|
}
|
|
@@ -30182,7 +30532,11 @@ function OhhwellsBridge() {
|
|
|
30182
30532
|
};
|
|
30183
30533
|
const handleMouseMove = (e) => {
|
|
30184
30534
|
const { clientX, clientY } = e;
|
|
30185
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30535
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30536
|
+
dismissImageHover();
|
|
30537
|
+
clearImageHover();
|
|
30538
|
+
return;
|
|
30539
|
+
}
|
|
30186
30540
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30187
30541
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30188
30542
|
formHoverElRef.current = null;
|
|
@@ -30211,7 +30565,12 @@ function OhhwellsBridge() {
|
|
|
30211
30565
|
setHoveredItemRect(null);
|
|
30212
30566
|
hoveredNavContainerRef.current = null;
|
|
30213
30567
|
setHoveredNavContainerRect(null);
|
|
30568
|
+
siblingHintElRef.current = null;
|
|
30569
|
+
setSiblingHintRect(null);
|
|
30570
|
+
setSiblingHintRects([]);
|
|
30214
30571
|
dismissImageHover();
|
|
30572
|
+
clearImageHover();
|
|
30573
|
+
setSectionGap(null);
|
|
30215
30574
|
return;
|
|
30216
30575
|
}
|
|
30217
30576
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30223,7 +30582,11 @@ function OhhwellsBridge() {
|
|
|
30223
30582
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30224
30583
|
const { clientX, clientY } = e.data;
|
|
30225
30584
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30226
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30585
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30586
|
+
dismissImageHover();
|
|
30587
|
+
clearImageHover();
|
|
30588
|
+
return;
|
|
30589
|
+
}
|
|
30227
30590
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30228
30591
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30229
30592
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30603,6 +30966,7 @@ function OhhwellsBridge() {
|
|
|
30603
30966
|
applyAiFooterFromContent(content);
|
|
30604
30967
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30605
30968
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
30969
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30606
30970
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30607
30971
|
}
|
|
30608
30972
|
applyBrandChrome(content);
|
|
@@ -30617,15 +30981,16 @@ function OhhwellsBridge() {
|
|
|
30617
30981
|
}
|
|
30618
30982
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30619
30983
|
if (key === AI_FOOTER_KEY) continue;
|
|
30984
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30985
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30620
30986
|
if (key === BRAND_KIT_KEY) continue;
|
|
30621
30987
|
if (key === STYLE_STORE_KEY) continue;
|
|
30622
30988
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30623
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30624
30989
|
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
30990
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30627
30991
|
continue;
|
|
30628
30992
|
}
|
|
30993
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30629
30994
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30630
30995
|
if (applyCarouselNode(key, val)) continue;
|
|
30631
30996
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30651,6 +31016,7 @@ function OhhwellsBridge() {
|
|
|
30651
31016
|
});
|
|
30652
31017
|
applyLinkByKey(key, val);
|
|
30653
31018
|
}
|
|
31019
|
+
applySectionEmbeds(content);
|
|
30654
31020
|
applyLogoFromContent(content);
|
|
30655
31021
|
applyLogoSizes(content);
|
|
30656
31022
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31258,6 +31624,12 @@ function OhhwellsBridge() {
|
|
|
31258
31624
|
closeLinkPopoverRef.current();
|
|
31259
31625
|
return;
|
|
31260
31626
|
}
|
|
31627
|
+
if (floatingPanelOpenRef.current) {
|
|
31628
|
+
setFloatingPanelRef.current(null);
|
|
31629
|
+
deselectRef.current();
|
|
31630
|
+
deactivateRef.current();
|
|
31631
|
+
return;
|
|
31632
|
+
}
|
|
31261
31633
|
deselectRef.current();
|
|
31262
31634
|
deactivateRef.current();
|
|
31263
31635
|
clearMediaSelectionRef.current();
|
|
@@ -32093,17 +32465,17 @@ function OhhwellsBridge() {
|
|
|
32093
32465
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32094
32466
|
window.removeEventListener("message", handleDeactivate);
|
|
32095
32467
|
window.removeEventListener("message", handleSelectNav);
|
|
32096
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32097
32468
|
window.removeEventListener("message", handleToastAction);
|
|
32098
32469
|
window.removeEventListener("message", handleFormCount);
|
|
32099
32470
|
window.removeEventListener("message", handleUiEscape);
|
|
32471
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32100
32472
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32101
32473
|
autoSaveTimers.current.clear();
|
|
32102
32474
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
32103
32475
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32104
32476
|
};
|
|
32105
32477
|
}, [isEditMode, refreshStateRules]);
|
|
32106
|
-
|
|
32478
|
+
useEffect20(() => {
|
|
32107
32479
|
if (!isEditMode) return;
|
|
32108
32480
|
const THRESHOLD = 10;
|
|
32109
32481
|
const resolveWasSelected = (el) => {
|
|
@@ -32259,7 +32631,7 @@ function OhhwellsBridge() {
|
|
|
32259
32631
|
unlockFooterDragInteraction();
|
|
32260
32632
|
};
|
|
32261
32633
|
}, [isEditMode]);
|
|
32262
|
-
|
|
32634
|
+
useEffect20(() => {
|
|
32263
32635
|
if (!isEditMode) return;
|
|
32264
32636
|
const THRESHOLD = 10;
|
|
32265
32637
|
const onPointerDown = (e) => {
|
|
@@ -32350,7 +32722,7 @@ function OhhwellsBridge() {
|
|
|
32350
32722
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32351
32723
|
};
|
|
32352
32724
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32353
|
-
|
|
32725
|
+
useEffect20(() => {
|
|
32354
32726
|
const handler = (e) => {
|
|
32355
32727
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32356
32728
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32366,7 +32738,7 @@ function OhhwellsBridge() {
|
|
|
32366
32738
|
window.addEventListener("message", handler);
|
|
32367
32739
|
return () => window.removeEventListener("message", handler);
|
|
32368
32740
|
}, [processConfigRequest]);
|
|
32369
|
-
|
|
32741
|
+
useEffect20(() => {
|
|
32370
32742
|
if (!isEditMode) return;
|
|
32371
32743
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32372
32744
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32390,7 +32762,7 @@ function OhhwellsBridge() {
|
|
|
32390
32762
|
postToParent2({
|
|
32391
32763
|
type: "ow:ready",
|
|
32392
32764
|
version: "1",
|
|
32393
|
-
bridgeVersion: "0.1.
|
|
32765
|
+
bridgeVersion: "0.1.164-next.438",
|
|
32394
32766
|
path: pathname,
|
|
32395
32767
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32396
32768
|
sections
|
|
@@ -32402,7 +32774,7 @@ function OhhwellsBridge() {
|
|
|
32402
32774
|
clearTimeout(timer);
|
|
32403
32775
|
};
|
|
32404
32776
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32405
|
-
|
|
32777
|
+
useEffect20(() => {
|
|
32406
32778
|
scrollToHashSectionWhenReady();
|
|
32407
32779
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32408
32780
|
window.addEventListener("hashchange", onHashChange);
|
|
@@ -32444,7 +32816,7 @@ function OhhwellsBridge() {
|
|
|
32444
32816
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32445
32817
|
refreshActiveCommandsRef.current();
|
|
32446
32818
|
}, []);
|
|
32447
|
-
|
|
32819
|
+
useEffect20(() => {
|
|
32448
32820
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32449
32821
|
if (!session || !logoSizeDraft) return;
|
|
32450
32822
|
const onPanelAction = (e) => {
|
|
@@ -33125,7 +33497,7 @@ function OhhwellsBridge() {
|
|
|
33125
33497
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33126
33498
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33127
33499
|
"data-ohw-add-field": "",
|
|
33128
|
-
children: /* @__PURE__ */ jsx40(
|
|
33500
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33129
33501
|
}
|
|
33130
33502
|
),
|
|
33131
33503
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -33618,6 +33990,7 @@ export {
|
|
|
33618
33990
|
hasMountedContentNodes,
|
|
33619
33991
|
indexCollectionItems,
|
|
33620
33992
|
insertFooterHours,
|
|
33993
|
+
isDeadPageHref,
|
|
33621
33994
|
isEditSessionActive,
|
|
33622
33995
|
isPlainLeftClick,
|
|
33623
33996
|
isRenderableFooterTree,
|
|
@@ -33629,6 +34002,7 @@ export {
|
|
|
33629
34002
|
parseAiFooterState,
|
|
33630
34003
|
parseAiSectionsState,
|
|
33631
34004
|
parseTarget,
|
|
34005
|
+
planBuildPageSync,
|
|
33632
34006
|
recordOverriddenPaths,
|
|
33633
34007
|
releaseTemplateLogoIfReplaced,
|
|
33634
34008
|
removeFooterBlock,
|