@ohhwells/bridge 0.1.167 → 0.1.168-next.447
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 +1051 -826
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1089 -848
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +116 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1216,21 +1216,21 @@ function chromeFrom(sample) {
|
|
|
1216
1216
|
};
|
|
1217
1217
|
}
|
|
1218
1218
|
function filledPrimary(seed) {
|
|
1219
|
-
const
|
|
1220
|
-
const luminance = relativeLuminance(
|
|
1219
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1220
|
+
const luminance = relativeLuminance(paint2);
|
|
1221
1221
|
return {
|
|
1222
|
-
background: toCss({ ...
|
|
1222
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1223
1223
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1224
1224
|
borderColor: TRANSPARENT,
|
|
1225
1225
|
borderWidth: "0px"
|
|
1226
1226
|
};
|
|
1227
1227
|
}
|
|
1228
1228
|
function generatedSecondary(primary) {
|
|
1229
|
-
const
|
|
1229
|
+
const paint2 = accentColor(primary);
|
|
1230
1230
|
return {
|
|
1231
1231
|
background: TRANSPARENT,
|
|
1232
|
-
color:
|
|
1233
|
-
borderColor:
|
|
1232
|
+
color: paint2,
|
|
1233
|
+
borderColor: paint2,
|
|
1234
1234
|
borderWidth: "1px"
|
|
1235
1235
|
};
|
|
1236
1236
|
}
|
|
@@ -1243,9 +1243,9 @@ function generatedGhost(primary) {
|
|
|
1243
1243
|
};
|
|
1244
1244
|
}
|
|
1245
1245
|
function normalizeOutlineChrome(outline, primary) {
|
|
1246
|
-
const
|
|
1246
|
+
const paint2 = accentColor(primary);
|
|
1247
1247
|
const text = parseColor(outline.color);
|
|
1248
|
-
const paintRgb = parseColor(
|
|
1248
|
+
const paintRgb = parseColor(paint2);
|
|
1249
1249
|
const primaryLabel = parseColor(primary.color);
|
|
1250
1250
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1251
1251
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1254,8 +1254,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1254
1254
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1255
1255
|
return {
|
|
1256
1256
|
...outline,
|
|
1257
|
-
color:
|
|
1258
|
-
borderColor: hasBorder ?
|
|
1257
|
+
color: paint2,
|
|
1258
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1259
1259
|
};
|
|
1260
1260
|
}
|
|
1261
1261
|
function generateButtonVariants(samples) {
|
|
@@ -5549,14 +5549,14 @@ function singleIndexSegment(key) {
|
|
|
5549
5549
|
function indexFromKey(key, position) {
|
|
5550
5550
|
return parseInt(baseKey(key).split("-")[position] ?? "", 10);
|
|
5551
5551
|
}
|
|
5552
|
-
function detectItemGroups(
|
|
5553
|
-
if (isGeneratedSection(
|
|
5552
|
+
function detectItemGroups(sectionEl2) {
|
|
5553
|
+
if (isGeneratedSection(sectionEl2)) return detectGeneratedCards(sectionEl2);
|
|
5554
5554
|
const groups = [];
|
|
5555
5555
|
const seenParents = /* @__PURE__ */ new Set();
|
|
5556
5556
|
const parents = /* @__PURE__ */ new Set();
|
|
5557
|
-
|
|
5557
|
+
sectionEl2.querySelectorAll("[data-ohw-key], [data-ohw-href-key]").forEach((keyedEl) => {
|
|
5558
5558
|
let el = keyedEl;
|
|
5559
|
-
while (el && el !==
|
|
5559
|
+
while (el && el !== sectionEl2) {
|
|
5560
5560
|
if (el.parentElement) parents.add(el.parentElement);
|
|
5561
5561
|
el = el.parentElement;
|
|
5562
5562
|
}
|
|
@@ -5646,8 +5646,8 @@ function detectItemGroups(sectionEl) {
|
|
|
5646
5646
|
}
|
|
5647
5647
|
return groups.sort((a, b) => a.nested === b.nested ? 0 : a.nested ? 1 : -1);
|
|
5648
5648
|
}
|
|
5649
|
-
function detectGeneratedCards(
|
|
5650
|
-
const cards = Array.from(
|
|
5649
|
+
function detectGeneratedCards(sectionEl2) {
|
|
5650
|
+
const cards = Array.from(sectionEl2.querySelectorAll("[data-ohw-card]")).filter(
|
|
5651
5651
|
(el) => !el.parentElement?.closest("[data-ohw-card]")
|
|
5652
5652
|
);
|
|
5653
5653
|
if (cards.length === 0) return [];
|
|
@@ -5656,7 +5656,7 @@ function detectGeneratedCards(sectionEl) {
|
|
|
5656
5656
|
item.el.setAttribute(ITEM_ATTR, `card:${item.index}`);
|
|
5657
5657
|
item.el.setAttribute(ITEM_SURFACE_ATTR, "");
|
|
5658
5658
|
}
|
|
5659
|
-
return [{ group: "card", parent: cards[0].parentElement ??
|
|
5659
|
+
return [{ group: "card", parent: cards[0].parentElement ?? sectionEl2, nested: false, items, generated: true }];
|
|
5660
5660
|
}
|
|
5661
5661
|
function firstTextLabel(item) {
|
|
5662
5662
|
for (const k of item.keyed) {
|
|
@@ -5672,13 +5672,13 @@ function findItemSection(sectionId) {
|
|
|
5672
5672
|
const escaped = CSS.escape(sectionId);
|
|
5673
5673
|
return document.querySelector(`[data-ohw-instance="${escaped}"]`) ?? document.querySelector(`[data-ohw-section="${escaped}"]`);
|
|
5674
5674
|
}
|
|
5675
|
-
function isGeneratedSection(
|
|
5676
|
-
return !!
|
|
5675
|
+
function isGeneratedSection(sectionEl2) {
|
|
5676
|
+
return !!sectionEl2.closest("[data-ohw-ai-generated]") || sectionEl2.hasAttribute("data-ai-section");
|
|
5677
5677
|
}
|
|
5678
|
-
function collectItemGroups(
|
|
5679
|
-
if (isChromeSection(
|
|
5680
|
-
const sectionId = instanceIdOf(
|
|
5681
|
-
return detectItemGroups(
|
|
5678
|
+
function collectItemGroups(sectionEl2) {
|
|
5679
|
+
if (isChromeSection(sectionEl2)) return [];
|
|
5680
|
+
const sectionId = instanceIdOf(sectionEl2);
|
|
5681
|
+
return detectItemGroups(sectionEl2).map((g) => ({
|
|
5682
5682
|
sectionId,
|
|
5683
5683
|
group: g.group,
|
|
5684
5684
|
nested: g.nested,
|
|
@@ -5847,11 +5847,11 @@ function initItemInstancesFromContent(content) {
|
|
|
5847
5847
|
document.querySelectorAll(`[${ITEM_REMOVED_ATTR}]`).forEach((el) => setRemoved(el, false));
|
|
5848
5848
|
if (!store) return;
|
|
5849
5849
|
for (const [sectionId, groups] of Object.entries(store.sections)) {
|
|
5850
|
-
const
|
|
5851
|
-
if (!
|
|
5850
|
+
const sectionEl2 = findItemSection(sectionId);
|
|
5851
|
+
if (!sectionEl2) continue;
|
|
5852
5852
|
const ordered = Object.entries(groups).sort(([a], [b]) => a.length - b.length);
|
|
5853
5853
|
for (const [group, state] of ordered) {
|
|
5854
|
-
const found = detectItemGroups(
|
|
5854
|
+
const found = detectItemGroups(sectionEl2).find((g) => g.group === group);
|
|
5855
5855
|
if (!found || found.generated) continue;
|
|
5856
5856
|
syncGroup(found, state);
|
|
5857
5857
|
}
|
|
@@ -5891,9 +5891,9 @@ function writeValue(el, attr, value) {
|
|
|
5891
5891
|
}
|
|
5892
5892
|
}
|
|
5893
5893
|
function applyItemOps(store, ops, currentContent) {
|
|
5894
|
-
const
|
|
5895
|
-
if (!
|
|
5896
|
-
const detected = detectItemGroups(
|
|
5894
|
+
const sectionEl2 = findItemSection(ops.sectionId);
|
|
5895
|
+
if (!sectionEl2) return null;
|
|
5896
|
+
const detected = detectItemGroups(sectionEl2).find((g) => g.group === ops.group);
|
|
5897
5897
|
if (!detected || detected.generated) return null;
|
|
5898
5898
|
const next = { v: 1, sections: { ...store?.sections ?? {} } };
|
|
5899
5899
|
const groups = { ...next.sections[ops.sectionId] ?? {} };
|
|
@@ -6303,10 +6303,10 @@ function applyStylesToDom(store) {
|
|
|
6303
6303
|
if (bar === -1) continue;
|
|
6304
6304
|
const sectionId = key.slice(0, bar);
|
|
6305
6305
|
const stamp = key.slice(bar + 1);
|
|
6306
|
-
const
|
|
6307
|
-
if (!
|
|
6308
|
-
detectItemGroups(
|
|
6309
|
-
const item =
|
|
6306
|
+
const sectionEl2 = findItemSection(sectionId);
|
|
6307
|
+
if (!sectionEl2) continue;
|
|
6308
|
+
detectItemGroups(sectionEl2);
|
|
6309
|
+
const item = sectionEl2.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
|
|
6310
6310
|
if (!item) continue;
|
|
6311
6311
|
saveInline(item, "background");
|
|
6312
6312
|
item.style.setProperty("background", override.backgroundColor, "important");
|
|
@@ -6796,6 +6796,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6796
6796
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6797
6797
|
return target ? pricingFeatureList(target).length : 0;
|
|
6798
6798
|
}
|
|
6799
|
+
function prevailingFeatureIcon(features) {
|
|
6800
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6801
|
+
for (const row of features) {
|
|
6802
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6803
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6804
|
+
entry.count += 1;
|
|
6805
|
+
counts.set(key, entry);
|
|
6806
|
+
}
|
|
6807
|
+
let best = null;
|
|
6808
|
+
for (const entry of counts.values()) {
|
|
6809
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6810
|
+
}
|
|
6811
|
+
if (!best) return {};
|
|
6812
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6813
|
+
}
|
|
6799
6814
|
function addPricingCardFeature(tree, index, text) {
|
|
6800
6815
|
return withPricingCollection(tree, (collection) => {
|
|
6801
6816
|
const children = collection.children;
|
|
@@ -6804,7 +6819,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6804
6819
|
const features = pricingFeatureList(target);
|
|
6805
6820
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6806
6821
|
target.slots = target.slots ?? {};
|
|
6807
|
-
target.slots.features = [...features, { text }];
|
|
6822
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6808
6823
|
return true;
|
|
6809
6824
|
});
|
|
6810
6825
|
}
|
|
@@ -7448,6 +7463,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7448
7463
|
);
|
|
7449
7464
|
}
|
|
7450
7465
|
|
|
7466
|
+
// src/lib/youtube.ts
|
|
7467
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7468
|
+
function extractYouTubeId(input) {
|
|
7469
|
+
const trimmed = input.trim();
|
|
7470
|
+
if (!trimmed) return null;
|
|
7471
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7472
|
+
let url;
|
|
7473
|
+
try {
|
|
7474
|
+
url = new URL(trimmed);
|
|
7475
|
+
} catch {
|
|
7476
|
+
return null;
|
|
7477
|
+
}
|
|
7478
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7479
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7480
|
+
return null;
|
|
7481
|
+
}
|
|
7482
|
+
let candidate = null;
|
|
7483
|
+
if (host === "youtu.be") {
|
|
7484
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7485
|
+
} else if (url.pathname === "/watch") {
|
|
7486
|
+
candidate = url.searchParams.get("v");
|
|
7487
|
+
} else {
|
|
7488
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7489
|
+
candidate = match ? match[1] : null;
|
|
7490
|
+
}
|
|
7491
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7492
|
+
}
|
|
7493
|
+
|
|
7494
|
+
// src/lib/section-embed.ts
|
|
7495
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7496
|
+
function readStoredEmbed(value) {
|
|
7497
|
+
if (value.startsWith("start\n")) {
|
|
7498
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7499
|
+
}
|
|
7500
|
+
return { raw: value, at: "end" };
|
|
7501
|
+
}
|
|
7502
|
+
function embedFrameSrc(value) {
|
|
7503
|
+
const videoId = extractYouTubeId(value);
|
|
7504
|
+
if (videoId) {
|
|
7505
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7506
|
+
}
|
|
7507
|
+
let url;
|
|
7508
|
+
try {
|
|
7509
|
+
url = new URL(value);
|
|
7510
|
+
} catch {
|
|
7511
|
+
return null;
|
|
7512
|
+
}
|
|
7513
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7514
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7515
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7516
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7517
|
+
return { src, title: "Map" };
|
|
7518
|
+
}
|
|
7519
|
+
if (host === "maps.app.goo.gl") {
|
|
7520
|
+
return { src: value, title: "Map" };
|
|
7521
|
+
}
|
|
7522
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7523
|
+
return { src: value, title: "Calendar" };
|
|
7524
|
+
}
|
|
7525
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7526
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7527
|
+
}
|
|
7528
|
+
if (host === "forms.gle") {
|
|
7529
|
+
return { src: value, title: "Form" };
|
|
7530
|
+
}
|
|
7531
|
+
return null;
|
|
7532
|
+
}
|
|
7533
|
+
function place(section, box, at) {
|
|
7534
|
+
if (at === "start") {
|
|
7535
|
+
section.insertBefore(box, section.firstChild);
|
|
7536
|
+
return;
|
|
7537
|
+
}
|
|
7538
|
+
section.appendChild(box);
|
|
7539
|
+
}
|
|
7540
|
+
function paint(section, key, src, title, at) {
|
|
7541
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7542
|
+
const frame = existing?.querySelector("iframe");
|
|
7543
|
+
if (existing && frame) {
|
|
7544
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7545
|
+
frame.title = title;
|
|
7546
|
+
place(section, existing, at);
|
|
7547
|
+
return;
|
|
7548
|
+
}
|
|
7549
|
+
existing?.remove();
|
|
7550
|
+
const box = document.createElement("div");
|
|
7551
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7552
|
+
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;";
|
|
7553
|
+
const frameWrap = document.createElement("div");
|
|
7554
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7555
|
+
const iframe = document.createElement("iframe");
|
|
7556
|
+
iframe.src = src;
|
|
7557
|
+
iframe.title = title;
|
|
7558
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7559
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7560
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7561
|
+
frameWrap.appendChild(iframe);
|
|
7562
|
+
box.appendChild(frameWrap);
|
|
7563
|
+
place(section, box, at);
|
|
7564
|
+
}
|
|
7565
|
+
function applySectionEmbeds(content) {
|
|
7566
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7567
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7568
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7569
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7570
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7571
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7572
|
+
if (!section || !stored || !frame) {
|
|
7573
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7574
|
+
continue;
|
|
7575
|
+
}
|
|
7576
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7577
|
+
}
|
|
7578
|
+
}
|
|
7579
|
+
|
|
7451
7580
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7452
7581
|
var import_react_dom = require("react-dom");
|
|
7453
7582
|
var import_client = require("react-dom/client");
|
|
@@ -8021,7 +8150,7 @@ var AI_MOBILE_CSS = [
|
|
|
8021
8150
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
8022
8151
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
8023
8152
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
8024
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8153
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
8025
8154
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
8026
8155
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
8027
8156
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8037,8 +8166,10 @@ var AI_MOBILE_CSS = [
|
|
|
8037
8166
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8038
8167
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8039
8168
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
8040
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
8041
|
-
|
|
8169
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8170
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8171
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8172
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
8042
8173
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8043
8174
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8044
8175
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8243,6 +8374,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8243
8374
|
function textAttrs(ctx, path) {
|
|
8244
8375
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8245
8376
|
}
|
|
8377
|
+
var AI_RESPONSIVE_CSS = [
|
|
8378
|
+
"@media (max-width: 960px) {",
|
|
8379
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8380
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8381
|
+
"}",
|
|
8382
|
+
"@media (max-width: 640px) {",
|
|
8383
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8384
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8385
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8386
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8387
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8388
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8389
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8390
|
+
// layered text used to be.
|
|
8391
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8392
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8393
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8394
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8395
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8396
|
+
// other rule had already been taught to stand down.
|
|
8397
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8398
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8399
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8400
|
+
"}"
|
|
8401
|
+
].join("\n");
|
|
8246
8402
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8247
8403
|
function MediaBox({
|
|
8248
8404
|
refValue,
|
|
@@ -8297,7 +8453,7 @@ function MediaBox({
|
|
|
8297
8453
|
position: fill ? "absolute" : void 0,
|
|
8298
8454
|
inset: fill ? 0 : void 0,
|
|
8299
8455
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8300
|
-
height: fill ? "100%" : void 0,
|
|
8456
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8301
8457
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8302
8458
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8303
8459
|
borderRadius: radius,
|
|
@@ -9793,7 +9949,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9793
9949
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9794
9950
|
"div",
|
|
9795
9951
|
{
|
|
9796
|
-
"data-ai-grid":
|
|
9952
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9797
9953
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9798
9954
|
style: {
|
|
9799
9955
|
display: "grid",
|
|
@@ -10095,7 +10251,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10095
10251
|
},
|
|
10096
10252
|
children: [
|
|
10097
10253
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10098
|
-
// The section's `data-ai-
|
|
10254
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
10099
10255
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10100
10256
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10101
10257
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10514,6 +10670,7 @@ function AiTreeRenderer({
|
|
|
10514
10670
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10515
10671
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10516
10672
|
...bgAttrs,
|
|
10673
|
+
"data-ai-responsive": "",
|
|
10517
10674
|
style: {
|
|
10518
10675
|
position: "relative",
|
|
10519
10676
|
padding: `${padCss} 0`,
|
|
@@ -10527,12 +10684,13 @@ function AiTreeRenderer({
|
|
|
10527
10684
|
...fillHeight ? { display: "grid" } : {}
|
|
10528
10685
|
},
|
|
10529
10686
|
children: [
|
|
10530
|
-
|
|
10687
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10531
10688
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10689
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10532
10690
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10533
10691
|
"div",
|
|
10534
10692
|
{
|
|
10535
|
-
"data-ai-
|
|
10693
|
+
"data-ai-section-inner": "",
|
|
10536
10694
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10537
10695
|
style: {
|
|
10538
10696
|
position: "relative",
|
|
@@ -10549,7 +10707,7 @@ function AiTreeRenderer({
|
|
|
10549
10707
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10550
10708
|
"div",
|
|
10551
10709
|
{
|
|
10552
|
-
"data-ai-
|
|
10710
|
+
"data-ai-columns": "",
|
|
10553
10711
|
style: {
|
|
10554
10712
|
display: "grid",
|
|
10555
10713
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11211,9 +11369,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11211
11369
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11212
11370
|
continue;
|
|
11213
11371
|
}
|
|
11214
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11215
11372
|
let container = existing?.container;
|
|
11373
|
+
let isNewMount = false;
|
|
11216
11374
|
if (!container || !container.isConnected) {
|
|
11375
|
+
isNewMount = true;
|
|
11217
11376
|
existing?.root.unmount();
|
|
11218
11377
|
container?.remove();
|
|
11219
11378
|
container = document.createElement("div");
|
|
@@ -11551,6 +11710,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11551
11710
|
return 3;
|
|
11552
11711
|
}
|
|
11553
11712
|
}
|
|
11713
|
+
function readLiveSocialItems() {
|
|
11714
|
+
const root = getFooterRoot();
|
|
11715
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11716
|
+
if (!row) return [];
|
|
11717
|
+
const items = [];
|
|
11718
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11719
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11720
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11721
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11722
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11723
|
+
items.push({ platform, href });
|
|
11724
|
+
}
|
|
11725
|
+
return items;
|
|
11726
|
+
}
|
|
11727
|
+
function syncSocialRowsFromDom(tree) {
|
|
11728
|
+
const root = getFooterRoot();
|
|
11729
|
+
if (!root) return;
|
|
11730
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11731
|
+
const live = readLiveSocialItems();
|
|
11732
|
+
if (row && live.length === 0) return;
|
|
11733
|
+
for (const col of tree.columns) {
|
|
11734
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11735
|
+
if (block.type !== "social-row") return [block];
|
|
11736
|
+
if (!row) return [];
|
|
11737
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11738
|
+
});
|
|
11739
|
+
}
|
|
11740
|
+
}
|
|
11554
11741
|
function collectBrandBlocks(tree) {
|
|
11555
11742
|
const brand = [];
|
|
11556
11743
|
for (const col of tree.columns) {
|
|
@@ -11796,6 +11983,7 @@ function textOf2(el) {
|
|
|
11796
11983
|
}
|
|
11797
11984
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11798
11985
|
const next = cloneTree(tree);
|
|
11986
|
+
syncSocialRowsFromDom(next);
|
|
11799
11987
|
const domCols = listFooterColumns().map((col) => {
|
|
11800
11988
|
const heading = getFooterColumnHeadingEl(col);
|
|
11801
11989
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -17608,7 +17796,7 @@ function apiBase() {
|
|
|
17608
17796
|
function bridgeVersion() {
|
|
17609
17797
|
try {
|
|
17610
17798
|
if (true) {
|
|
17611
|
-
return "0.1.
|
|
17799
|
+
return "0.1.168-next.447";
|
|
17612
17800
|
}
|
|
17613
17801
|
} catch {
|
|
17614
17802
|
}
|
|
@@ -17622,7 +17810,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17622
17810
|
return;
|
|
17623
17811
|
}
|
|
17624
17812
|
try {
|
|
17625
|
-
const v = true ? "0.1.
|
|
17813
|
+
const v = true ? "0.1.168-next.447" : "";
|
|
17626
17814
|
if (v) {
|
|
17627
17815
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17628
17816
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18300,6 +18488,7 @@ function MediaOverlay({
|
|
|
18300
18488
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18301
18489
|
);
|
|
18302
18490
|
}, [isVideo]);
|
|
18491
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18303
18492
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18304
18493
|
const box = {
|
|
18305
18494
|
position: "fixed",
|
|
@@ -18398,11 +18587,10 @@ function MediaOverlay({
|
|
|
18398
18587
|
className: "flex items-center justify-center cursor-pointer",
|
|
18399
18588
|
style: {
|
|
18400
18589
|
...box,
|
|
18401
|
-
//
|
|
18402
|
-
//
|
|
18403
|
-
//
|
|
18404
|
-
|
|
18405
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18590
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18591
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18592
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18593
|
+
pointerEvents: "none",
|
|
18406
18594
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18407
18595
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18408
18596
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18429,17 +18617,17 @@ function MediaOverlay({
|
|
|
18429
18617
|
},
|
|
18430
18618
|
children: [
|
|
18431
18619
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
18432
|
-
|
|
18620
|
+
replaceLabel
|
|
18433
18621
|
]
|
|
18434
18622
|
}
|
|
18435
18623
|
),
|
|
18436
|
-
replaceMode
|
|
18624
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18437
18625
|
Button,
|
|
18438
18626
|
{
|
|
18439
18627
|
"data-ohw-media-overlay": "",
|
|
18440
18628
|
variant: "outline",
|
|
18441
18629
|
size: "sm",
|
|
18442
|
-
"aria-label":
|
|
18630
|
+
"aria-label": replaceLabel,
|
|
18443
18631
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18444
18632
|
style: {
|
|
18445
18633
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18462,7 +18650,7 @@ function MediaOverlay({
|
|
|
18462
18650
|
},
|
|
18463
18651
|
children: [
|
|
18464
18652
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
18465
|
-
replaceMode === "full" ?
|
|
18653
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18466
18654
|
]
|
|
18467
18655
|
}
|
|
18468
18656
|
)
|
|
@@ -18558,7 +18746,8 @@ function ensureStyleSheet2() {
|
|
|
18558
18746
|
el.textContent = HIGHLIGHT_CSS;
|
|
18559
18747
|
document.head.appendChild(el);
|
|
18560
18748
|
}
|
|
18561
|
-
|
|
18749
|
+
var sectionEl = (id) => document.querySelector(`[data-ohw-instance="${CSS.escape(id)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(id)}"]`);
|
|
18750
|
+
function targetsFor(keys, item, sectionId) {
|
|
18562
18751
|
const out = /* @__PURE__ */ new Set();
|
|
18563
18752
|
for (const key of keys) {
|
|
18564
18753
|
if (!key) continue;
|
|
@@ -18569,11 +18758,15 @@ function targetsFor(keys, item) {
|
|
|
18569
18758
|
}
|
|
18570
18759
|
}
|
|
18571
18760
|
if (item) {
|
|
18572
|
-
const section =
|
|
18761
|
+
const section = sectionEl(item.sectionId);
|
|
18573
18762
|
const stamp = `${item.group}:${item.index}`;
|
|
18574
18763
|
const el = section?.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
|
|
18575
18764
|
if (el) out.add(el);
|
|
18576
18765
|
}
|
|
18766
|
+
if (out.size === 0 && sectionId) {
|
|
18767
|
+
const section = sectionEl(sectionId);
|
|
18768
|
+
if (section) out.add(section);
|
|
18769
|
+
}
|
|
18577
18770
|
return [...out];
|
|
18578
18771
|
}
|
|
18579
18772
|
var clearTimer = null;
|
|
@@ -18586,9 +18779,9 @@ function clearChangeHighlight() {
|
|
|
18586
18779
|
el.removeAttribute(MARK_ATTR);
|
|
18587
18780
|
}
|
|
18588
18781
|
}
|
|
18589
|
-
function highlightChangedElements(keys, item) {
|
|
18782
|
+
function highlightChangedElements(keys, item, sectionId) {
|
|
18590
18783
|
clearChangeHighlight();
|
|
18591
|
-
const targets = targetsFor(keys, item);
|
|
18784
|
+
const targets = targetsFor(keys, item, sectionId);
|
|
18592
18785
|
if (targets.length === 0) return 0;
|
|
18593
18786
|
ensureStyleSheet2();
|
|
18594
18787
|
for (const el of targets) el.setAttribute(MARK_ATTR, "");
|
|
@@ -18599,6 +18792,12 @@ function highlightChangedElements(keys, item) {
|
|
|
18599
18792
|
clearTimer = setTimeout(clearChangeHighlight, HIGHLIGHT_MS);
|
|
18600
18793
|
return targets.length;
|
|
18601
18794
|
}
|
|
18795
|
+
function highlightedRect() {
|
|
18796
|
+
const first = document.querySelector(`[${MARK_ATTR}]`);
|
|
18797
|
+
if (!first) return null;
|
|
18798
|
+
const rect = first.getBoundingClientRect();
|
|
18799
|
+
return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
|
|
18800
|
+
}
|
|
18602
18801
|
function installAiChangeHighlight() {
|
|
18603
18802
|
const onMessage = (e) => {
|
|
18604
18803
|
const data = e.data;
|
|
@@ -18606,8 +18805,10 @@ function installAiChangeHighlight() {
|
|
|
18606
18805
|
const keys = Array.isArray(data.keys) ? data.keys.filter((k) => typeof k === "string") : [];
|
|
18607
18806
|
const raw = data.item;
|
|
18608
18807
|
const item = raw && typeof raw.sectionId === "string" && typeof raw.group === "string" && typeof raw.index === "number" ? { sectionId: raw.sectionId, group: raw.group, index: raw.index } : void 0;
|
|
18609
|
-
const
|
|
18610
|
-
|
|
18808
|
+
const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
|
|
18809
|
+
const found = highlightChangedElements(keys, item, sectionId);
|
|
18810
|
+
const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
|
|
18811
|
+
window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
|
|
18611
18812
|
};
|
|
18612
18813
|
window.addEventListener("message", onMessage);
|
|
18613
18814
|
return () => window.removeEventListener("message", onMessage);
|
|
@@ -18806,12 +19007,12 @@ function AiSectionOverlay({
|
|
|
18806
19007
|
const selectFromElement = (0, import_react12.useCallback)(
|
|
18807
19008
|
(el, options) => {
|
|
18808
19009
|
const inner = el?.closest("[data-ohw-section]") ?? null;
|
|
18809
|
-
const
|
|
18810
|
-
const id =
|
|
19010
|
+
const sectionEl2 = inner ? movableUnit(inner) : null;
|
|
19011
|
+
const id = sectionEl2 ? instanceIdOf(sectionEl2) || null : null;
|
|
18811
19012
|
if (id === selectedIdRef.current) return;
|
|
18812
19013
|
selectedIdRef.current = id;
|
|
18813
19014
|
setSelectedId(id);
|
|
18814
|
-
if (options?.report !== false) report(
|
|
19015
|
+
if (options?.report !== false) report(sectionEl2);
|
|
18815
19016
|
},
|
|
18816
19017
|
[report]
|
|
18817
19018
|
);
|
|
@@ -18819,15 +19020,15 @@ function AiSectionOverlay({
|
|
|
18819
19020
|
apiRef.current = {
|
|
18820
19021
|
selectFromElement,
|
|
18821
19022
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
18822
|
-
let
|
|
18823
|
-
if (!
|
|
19023
|
+
let sectionEl2 = target?.closest("[data-ohw-section]") ?? null;
|
|
19024
|
+
if (!sectionEl2 && clientX !== void 0 && clientY !== void 0) {
|
|
18824
19025
|
const beneath = document.elementsFromPoint(clientX, clientY).find(
|
|
18825
19026
|
(el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
|
|
18826
19027
|
);
|
|
18827
|
-
|
|
19028
|
+
sectionEl2 = beneath?.closest("[data-ohw-section]") ?? null;
|
|
18828
19029
|
}
|
|
18829
|
-
selectFromElement(
|
|
18830
|
-
return
|
|
19030
|
+
selectFromElement(sectionEl2);
|
|
19031
|
+
return sectionEl2 != null;
|
|
18831
19032
|
},
|
|
18832
19033
|
clear: () => {
|
|
18833
19034
|
selectedIdRef.current = null;
|
|
@@ -19056,7 +19257,7 @@ function AiSectionOverlay({
|
|
|
19056
19257
|
|
|
19057
19258
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19058
19259
|
var import_react13 = require("react");
|
|
19059
|
-
var
|
|
19260
|
+
var import_lucide_react9 = require("lucide-react");
|
|
19060
19261
|
|
|
19061
19262
|
// src/lib/ai-media-strip-tree.ts
|
|
19062
19263
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19170,14 +19371,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19170
19371
|
return true;
|
|
19171
19372
|
});
|
|
19172
19373
|
}
|
|
19173
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19174
|
-
return withMediaStrip(tree, (block) => {
|
|
19175
|
-
const items = block.items;
|
|
19176
|
-
if (index < 0 || index >= items.length) return false;
|
|
19177
|
-
items[index] = { ...items[index], alt };
|
|
19178
|
-
return true;
|
|
19179
|
-
});
|
|
19180
|
-
}
|
|
19181
19374
|
function setMediaStripItemLink(tree, index, link) {
|
|
19182
19375
|
return withMediaStrip(tree, (block) => {
|
|
19183
19376
|
const items = block.items;
|
|
@@ -19195,28 +19388,155 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19195
19388
|
});
|
|
19196
19389
|
}
|
|
19197
19390
|
|
|
19198
|
-
// src/ui/
|
|
19391
|
+
// src/ui/dialog.tsx
|
|
19392
|
+
var React9 = __toESM(require("react"), 1);
|
|
19393
|
+
var import_radix_ui6 = require("radix-ui");
|
|
19394
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19199
19395
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19200
|
-
|
|
19201
|
-
|
|
19202
|
-
|
|
19396
|
+
function Dialog2({
|
|
19397
|
+
...props
|
|
19398
|
+
}) {
|
|
19399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19400
|
+
}
|
|
19401
|
+
function DialogPortal({
|
|
19402
|
+
...props
|
|
19403
|
+
}) {
|
|
19404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19405
|
+
}
|
|
19406
|
+
function DialogOverlay({
|
|
19407
|
+
className,
|
|
19408
|
+
...props
|
|
19409
|
+
}) {
|
|
19410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19411
|
+
import_radix_ui6.Dialog.Overlay,
|
|
19412
|
+
{
|
|
19413
|
+
"data-slot": "dialog-overlay",
|
|
19414
|
+
"data-ohw-link-modal-root": "",
|
|
19415
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19416
|
+
...props
|
|
19417
|
+
}
|
|
19418
|
+
);
|
|
19419
|
+
}
|
|
19420
|
+
var DialogContent = React9.forwardRef(
|
|
19421
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19422
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19424
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19425
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19426
|
+
import_radix_ui6.Dialog.Content,
|
|
19427
|
+
{
|
|
19428
|
+
ref,
|
|
19429
|
+
"data-slot": "dialog-content",
|
|
19430
|
+
className: cn(
|
|
19431
|
+
positionMode,
|
|
19432
|
+
"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",
|
|
19433
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19434
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19435
|
+
className
|
|
19436
|
+
),
|
|
19437
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19438
|
+
...props,
|
|
19439
|
+
children: [
|
|
19440
|
+
children,
|
|
19441
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19442
|
+
import_radix_ui6.Dialog.Close,
|
|
19443
|
+
{
|
|
19444
|
+
type: "button",
|
|
19445
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19446
|
+
"aria-label": "Close",
|
|
19447
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19448
|
+
}
|
|
19449
|
+
) : null
|
|
19450
|
+
]
|
|
19451
|
+
}
|
|
19452
|
+
)
|
|
19453
|
+
] });
|
|
19454
|
+
}
|
|
19455
|
+
);
|
|
19456
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19457
|
+
function DialogHeader({
|
|
19458
|
+
className,
|
|
19459
|
+
...props
|
|
19460
|
+
}) {
|
|
19461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19462
|
+
}
|
|
19463
|
+
function DialogFooter({
|
|
19464
|
+
className,
|
|
19465
|
+
...props
|
|
19466
|
+
}) {
|
|
19467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19468
|
+
"div",
|
|
19469
|
+
{
|
|
19470
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19471
|
+
...props
|
|
19472
|
+
}
|
|
19473
|
+
);
|
|
19474
|
+
}
|
|
19475
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19476
|
+
import_radix_ui6.Dialog.Title,
|
|
19477
|
+
{
|
|
19478
|
+
ref,
|
|
19479
|
+
className: cn(
|
|
19480
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19481
|
+
className
|
|
19482
|
+
),
|
|
19483
|
+
...props
|
|
19484
|
+
}
|
|
19485
|
+
));
|
|
19486
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19487
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19488
|
+
import_radix_ui6.Dialog.Description,
|
|
19489
|
+
{
|
|
19490
|
+
ref,
|
|
19491
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19492
|
+
...props
|
|
19493
|
+
}
|
|
19494
|
+
));
|
|
19495
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19496
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19497
|
+
|
|
19498
|
+
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19499
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
19500
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19501
|
+
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]";
|
|
19203
19502
|
function findMediaStripItemElement(sectionId, index) {
|
|
19204
|
-
const
|
|
19205
|
-
if (!
|
|
19206
|
-
const items =
|
|
19503
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
19504
|
+
if (!sectionEl2) return null;
|
|
19505
|
+
const items = sectionEl2.querySelectorAll("[data-ohw-media-strip-item]");
|
|
19207
19506
|
for (const el of Array.from(items)) {
|
|
19208
19507
|
if (Number(el.dataset.ohwMediaStripIndex) === index) return el;
|
|
19209
19508
|
}
|
|
19210
19509
|
return null;
|
|
19211
19510
|
}
|
|
19212
|
-
function
|
|
19213
|
-
|
|
19511
|
+
function itemRefFromTarget(target) {
|
|
19512
|
+
if (!(target instanceof Element)) return null;
|
|
19513
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19514
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19515
|
+
if (!itemEl) return null;
|
|
19516
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19517
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19518
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19519
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19520
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19521
|
+
return { sectionId, index };
|
|
19522
|
+
}
|
|
19523
|
+
function sameRef(a, b) {
|
|
19524
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19525
|
+
}
|
|
19526
|
+
function rectOf(el) {
|
|
19214
19527
|
if (!el) return null;
|
|
19215
19528
|
const r2 = el.getBoundingClientRect();
|
|
19216
19529
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19217
19530
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19218
19531
|
}
|
|
19219
|
-
function
|
|
19532
|
+
function readRect2(ref) {
|
|
19533
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19534
|
+
}
|
|
19535
|
+
function readStripRect(ref) {
|
|
19536
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19537
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19538
|
+
}
|
|
19539
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19220
19540
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
19221
19541
|
(0, import_react13.useEffect)(() => {
|
|
19222
19542
|
if (!ref) {
|
|
@@ -19224,7 +19544,7 @@ function useLiveItemRect(ref) {
|
|
|
19224
19544
|
return;
|
|
19225
19545
|
}
|
|
19226
19546
|
const update = () => {
|
|
19227
|
-
const next = readRect2(ref);
|
|
19547
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19228
19548
|
setRect(
|
|
19229
19549
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19230
19550
|
);
|
|
@@ -19239,9 +19559,49 @@ function useLiveItemRect(ref) {
|
|
|
19239
19559
|
window.removeEventListener("resize", update);
|
|
19240
19560
|
clearInterval(interval);
|
|
19241
19561
|
};
|
|
19242
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19562
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19243
19563
|
return rect;
|
|
19244
19564
|
}
|
|
19565
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19566
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19567
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19568
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19569
|
+
const slotRef = (0, import_react13.useRef)(null);
|
|
19570
|
+
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
19571
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19572
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
19573
|
+
const slot = slotRef.current;
|
|
19574
|
+
if (!slot) return;
|
|
19575
|
+
const clamp = () => {
|
|
19576
|
+
const w = slot.offsetWidth;
|
|
19577
|
+
if (w <= 0) return;
|
|
19578
|
+
const half = w / 2;
|
|
19579
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19580
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19581
|
+
};
|
|
19582
|
+
clamp();
|
|
19583
|
+
const ro = new ResizeObserver(clamp);
|
|
19584
|
+
ro.observe(slot);
|
|
19585
|
+
return () => ro.disconnect();
|
|
19586
|
+
}, [centerX, children]);
|
|
19587
|
+
const mobile = window.innerWidth <= 480;
|
|
19588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19589
|
+
"div",
|
|
19590
|
+
{
|
|
19591
|
+
ref: slotRef,
|
|
19592
|
+
"data-ohw-bridge": "",
|
|
19593
|
+
"data-ohw-item-interaction": "",
|
|
19594
|
+
className: "pointer-events-auto fixed",
|
|
19595
|
+
style: {
|
|
19596
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19597
|
+
left: centerX + shift,
|
|
19598
|
+
transform: "translate(-50%, -100%)",
|
|
19599
|
+
zIndex: 2147483645
|
|
19600
|
+
},
|
|
19601
|
+
children
|
|
19602
|
+
}
|
|
19603
|
+
);
|
|
19604
|
+
}
|
|
19245
19605
|
function requestValidateTree(postToParent2, tree) {
|
|
19246
19606
|
return new Promise((resolve) => {
|
|
19247
19607
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19278,116 +19638,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19278
19638
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19279
19639
|
});
|
|
19280
19640
|
}
|
|
19281
|
-
function
|
|
19641
|
+
function ToolbarAction({
|
|
19282
19642
|
label,
|
|
19283
19643
|
onClick,
|
|
19284
|
-
disabled,
|
|
19285
|
-
active
|
|
19644
|
+
disabled = false,
|
|
19645
|
+
active = false,
|
|
19646
|
+
children
|
|
19286
19647
|
}) {
|
|
19287
|
-
|
|
19288
|
-
|
|
19289
|
-
{
|
|
19290
|
-
|
|
19291
|
-
|
|
19292
|
-
disabled,
|
|
19293
|
-
style: {
|
|
19294
|
-
height: 28,
|
|
19295
|
-
padding: "0 10px",
|
|
19296
|
-
display: "inline-flex",
|
|
19297
|
-
alignItems: "center",
|
|
19298
|
-
gap: 4,
|
|
19299
|
-
borderRadius: 999,
|
|
19300
|
-
border: "none",
|
|
19301
|
-
cursor: disabled ? "default" : "pointer",
|
|
19302
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19303
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19304
|
-
opacity: disabled ? 0.4 : 1,
|
|
19305
|
-
fontSize: 12,
|
|
19306
|
-
lineHeight: "16px",
|
|
19307
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19308
|
-
whiteSpace: "nowrap",
|
|
19309
|
-
flex: "0 0 auto"
|
|
19310
|
-
},
|
|
19311
|
-
children: label
|
|
19312
|
-
}
|
|
19313
|
-
);
|
|
19648
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19650
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
19651
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19652
|
+
] });
|
|
19314
19653
|
}
|
|
19315
|
-
function
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
|
|
19344
|
-
},
|
|
19345
|
-
children: "Alt"
|
|
19346
|
-
}
|
|
19347
|
-
),
|
|
19348
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19349
|
-
"input",
|
|
19654
|
+
function ToolbarSeparator() {
|
|
19655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19656
|
+
}
|
|
19657
|
+
function OptionMenu({
|
|
19658
|
+
label,
|
|
19659
|
+
value,
|
|
19660
|
+
options,
|
|
19661
|
+
onChange
|
|
19662
|
+
}) {
|
|
19663
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19665
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19666
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
19667
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19668
|
+
"button",
|
|
19669
|
+
{
|
|
19670
|
+
type: "button",
|
|
19671
|
+
"aria-label": label,
|
|
19672
|
+
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",
|
|
19673
|
+
children: [
|
|
19674
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
19675
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
19676
|
+
]
|
|
19677
|
+
}
|
|
19678
|
+
) }),
|
|
19679
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19680
|
+
const selected = option.value === value;
|
|
19681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19682
|
+
DropdownMenuItem,
|
|
19350
19683
|
{
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
"aria-label": "Image alt text",
|
|
19366
|
-
style: {
|
|
19367
|
-
flex: 1,
|
|
19368
|
-
minWidth: 0,
|
|
19369
|
-
border: "none",
|
|
19370
|
-
outline: "none",
|
|
19371
|
-
background: "transparent",
|
|
19372
|
-
fontSize: 12,
|
|
19373
|
-
lineHeight: "16px",
|
|
19374
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19375
|
-
color: "#1f2937"
|
|
19376
|
-
}
|
|
19377
|
-
}
|
|
19378
|
-
)
|
|
19379
|
-
]
|
|
19380
|
-
}
|
|
19381
|
-
);
|
|
19684
|
+
role: "menuitemradio",
|
|
19685
|
+
"aria-checked": selected,
|
|
19686
|
+
onSelect: () => onChange(option.value),
|
|
19687
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19688
|
+
children: [
|
|
19689
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
|
|
19690
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
19691
|
+
]
|
|
19692
|
+
},
|
|
19693
|
+
option.value
|
|
19694
|
+
);
|
|
19695
|
+
}) })
|
|
19696
|
+
] })
|
|
19697
|
+
] });
|
|
19382
19698
|
}
|
|
19383
19699
|
var VARIANTS = [
|
|
19384
19700
|
{ value: "logos", label: "Logos" },
|
|
19385
19701
|
{ value: "reel", label: "Reel" }
|
|
19386
19702
|
];
|
|
19387
19703
|
var ALIGNS = [
|
|
19388
|
-
{ value: "left", label: "
|
|
19389
|
-
{ value: "center", label: "
|
|
19390
|
-
{ value: "right", label: "
|
|
19704
|
+
{ value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
|
|
19705
|
+
{ value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
|
|
19706
|
+
{ value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
|
|
19391
19707
|
];
|
|
19392
19708
|
var HOVERS = [
|
|
19393
19709
|
{ value: "none", label: "None" },
|
|
@@ -19395,104 +19711,104 @@ var HOVERS = [
|
|
|
19395
19711
|
{ value: "zoom", label: "Zoom" },
|
|
19396
19712
|
{ value: "fade", label: "Fade" }
|
|
19397
19713
|
];
|
|
19398
|
-
var TREATMENTS = [
|
|
19399
|
-
{ value: "color", label: "Color" },
|
|
19400
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19401
|
-
];
|
|
19402
19714
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19403
|
-
function
|
|
19404
|
-
|
|
19715
|
+
function LinkModal({
|
|
19716
|
+
href,
|
|
19717
|
+
linkTarget,
|
|
19718
|
+
onClose,
|
|
19719
|
+
onSave
|
|
19720
|
+
}) {
|
|
19721
|
+
const [draft, setDraft] = (0, import_react13.useState)(href);
|
|
19722
|
+
const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
|
|
19405
19723
|
const [invalid, setInvalid] = (0, import_react13.useState)(false);
|
|
19406
|
-
|
|
19407
|
-
setDraft(value);
|
|
19408
|
-
setInvalid(false);
|
|
19409
|
-
}, [value]);
|
|
19410
|
-
const commit2 = () => {
|
|
19724
|
+
const save = () => {
|
|
19411
19725
|
const next = draft.trim();
|
|
19412
|
-
if (next
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
onCommit(next);
|
|
19416
|
-
};
|
|
19417
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19418
|
-
"div",
|
|
19419
|
-
{
|
|
19420
|
-
style: {
|
|
19421
|
-
display: "flex",
|
|
19422
|
-
alignItems: "center",
|
|
19423
|
-
gap: 6,
|
|
19424
|
-
height: 28,
|
|
19425
|
-
padding: "0 12px",
|
|
19426
|
-
borderRadius: 999,
|
|
19427
|
-
background: "#ffffff",
|
|
19428
|
-
width: "100%",
|
|
19429
|
-
maxWidth: 260,
|
|
19430
|
-
boxSizing: "border-box",
|
|
19431
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19432
|
-
},
|
|
19433
|
-
children: [
|
|
19434
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19435
|
-
"span",
|
|
19436
|
-
{
|
|
19437
|
-
style: {
|
|
19438
|
-
flex: "0 0 auto",
|
|
19439
|
-
color: OHW_BLUE_DARK,
|
|
19440
|
-
fontSize: 10,
|
|
19441
|
-
fontWeight: 700,
|
|
19442
|
-
textTransform: "uppercase",
|
|
19443
|
-
letterSpacing: 0.4
|
|
19444
|
-
},
|
|
19445
|
-
children: "Link"
|
|
19446
|
-
}
|
|
19447
|
-
),
|
|
19448
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19449
|
-
"input",
|
|
19450
|
-
{
|
|
19451
|
-
type: "text",
|
|
19452
|
-
inputMode: "url",
|
|
19453
|
-
value: draft,
|
|
19454
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19455
|
-
onBlur: commit2,
|
|
19456
|
-
onKeyDown: (e) => {
|
|
19457
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19458
|
-
if (e.key === "Escape") {
|
|
19459
|
-
setDraft(value);
|
|
19460
|
-
setInvalid(false);
|
|
19461
|
-
e.currentTarget.blur();
|
|
19462
|
-
}
|
|
19463
|
-
},
|
|
19464
|
-
placeholder: "https://example.com",
|
|
19465
|
-
"aria-label": "Image link URL",
|
|
19466
|
-
"aria-invalid": invalid,
|
|
19467
|
-
style: {
|
|
19468
|
-
flex: 1,
|
|
19469
|
-
minWidth: 0,
|
|
19470
|
-
border: "none",
|
|
19471
|
-
outline: "none",
|
|
19472
|
-
background: "transparent",
|
|
19473
|
-
fontSize: 12,
|
|
19474
|
-
lineHeight: "16px",
|
|
19475
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19476
|
-
color: "#1f2937"
|
|
19477
|
-
}
|
|
19478
|
-
}
|
|
19479
|
-
)
|
|
19480
|
-
]
|
|
19726
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19727
|
+
setInvalid(true);
|
|
19728
|
+
return;
|
|
19481
19729
|
}
|
|
19482
|
-
|
|
19730
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19731
|
+
onClose();
|
|
19732
|
+
};
|
|
19733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
19734
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19735
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
19736
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19737
|
+
"input",
|
|
19738
|
+
{
|
|
19739
|
+
autoFocus: true,
|
|
19740
|
+
type: "text",
|
|
19741
|
+
inputMode: "url",
|
|
19742
|
+
value: draft,
|
|
19743
|
+
onChange: (e) => {
|
|
19744
|
+
setDraft(e.target.value);
|
|
19745
|
+
setInvalid(false);
|
|
19746
|
+
},
|
|
19747
|
+
onKeyDown: (e) => {
|
|
19748
|
+
if (e.key === "Enter") save();
|
|
19749
|
+
},
|
|
19750
|
+
placeholder: "https://example.com",
|
|
19751
|
+
"aria-label": "Image link URL",
|
|
19752
|
+
"aria-invalid": invalid,
|
|
19753
|
+
className: cn(
|
|
19754
|
+
"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",
|
|
19755
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19756
|
+
)
|
|
19757
|
+
}
|
|
19758
|
+
),
|
|
19759
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19760
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19761
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19762
|
+
"Open in new tab"
|
|
19763
|
+
] })
|
|
19764
|
+
] }),
|
|
19765
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
|
|
19766
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19767
|
+
"button",
|
|
19768
|
+
{
|
|
19769
|
+
type: "button",
|
|
19770
|
+
onClick: () => {
|
|
19771
|
+
onSave("", "new-tab");
|
|
19772
|
+
onClose();
|
|
19773
|
+
},
|
|
19774
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19775
|
+
children: "Remove link"
|
|
19776
|
+
}
|
|
19777
|
+
),
|
|
19778
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19779
|
+
"button",
|
|
19780
|
+
{
|
|
19781
|
+
type: "button",
|
|
19782
|
+
onClick: onClose,
|
|
19783
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19784
|
+
children: "Cancel"
|
|
19785
|
+
}
|
|
19786
|
+
),
|
|
19787
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19788
|
+
"button",
|
|
19789
|
+
{
|
|
19790
|
+
type: "button",
|
|
19791
|
+
onClick: save,
|
|
19792
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19793
|
+
children: "Save"
|
|
19794
|
+
}
|
|
19795
|
+
)
|
|
19796
|
+
] })
|
|
19797
|
+
] }) });
|
|
19483
19798
|
}
|
|
19484
19799
|
function MediaStripToolbar({
|
|
19485
19800
|
entry,
|
|
19486
19801
|
index,
|
|
19487
19802
|
pending,
|
|
19488
19803
|
error,
|
|
19804
|
+
itemEditOn,
|
|
19805
|
+
onToggleItemEdit,
|
|
19489
19806
|
onSetVariant,
|
|
19490
19807
|
onSetAlign,
|
|
19491
19808
|
onSetHover,
|
|
19492
19809
|
onSetTreatment,
|
|
19493
19810
|
onResize,
|
|
19494
|
-
|
|
19495
|
-
onSetLink,
|
|
19811
|
+
onOpenLink,
|
|
19496
19812
|
onAddItem,
|
|
19497
19813
|
onRemoveItem,
|
|
19498
19814
|
onChangeImage,
|
|
@@ -19501,81 +19817,102 @@ function MediaStripToolbar({
|
|
|
19501
19817
|
}) {
|
|
19502
19818
|
const items = mediaStripItems(entry.tree);
|
|
19503
19819
|
const itemCount = items.length;
|
|
19504
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19505
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19506
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19507
19820
|
const slots = findMediaStripSlots(entry.tree);
|
|
19508
19821
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19509
19822
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19510
19823
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19511
19824
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19512
19825
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19513
|
-
const
|
|
19514
|
-
const
|
|
19515
|
-
|
|
19516
|
-
gap: 6,
|
|
19517
|
-
flexWrap: "nowrap",
|
|
19518
|
-
justifyContent: "center",
|
|
19519
|
-
overflowX: "auto",
|
|
19520
|
-
WebkitOverflowScrolling: "touch",
|
|
19521
|
-
width: "100%",
|
|
19522
|
-
scrollbarWidth: "none"
|
|
19523
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19826
|
+
const mobile = window.innerWidth <= 480;
|
|
19827
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19525
19829
|
"div",
|
|
19526
19830
|
{
|
|
19527
19831
|
"data-ohw-bridge": "",
|
|
19528
19832
|
"data-ohw-toolbar": "",
|
|
19529
19833
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
flexDirection: "column",
|
|
19533
|
-
gap: 6,
|
|
19534
|
-
alignItems: "center",
|
|
19535
|
-
background: OHW_BLUE,
|
|
19536
|
-
padding: 8,
|
|
19537
|
-
borderRadius: 12,
|
|
19538
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19539
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19540
|
-
opacity: pending ? 0.6 : 1,
|
|
19541
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19542
|
-
},
|
|
19834
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19835
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19543
19836
|
children: [
|
|
19544
|
-
/* @__PURE__ */ (0,
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
|
|
19549
|
-
|
|
19550
|
-
|
|
19551
|
-
|
|
19552
|
-
|
|
19553
|
-
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19837
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19838
|
+
"div",
|
|
19839
|
+
{
|
|
19840
|
+
className: cn(
|
|
19841
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19842
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19843
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19844
|
+
),
|
|
19845
|
+
children: [
|
|
19846
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19847
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19848
|
+
CustomToolbarButton,
|
|
19849
|
+
{
|
|
19850
|
+
type: "button",
|
|
19851
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19852
|
+
"aria-pressed": itemEditOn,
|
|
19853
|
+
onClick: onToggleItemEdit,
|
|
19854
|
+
className: "group size-8",
|
|
19855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19856
|
+
import_lucide_react9.Star,
|
|
19857
|
+
{
|
|
19858
|
+
size: 16,
|
|
19859
|
+
fill: "currentColor",
|
|
19860
|
+
strokeWidth: 0,
|
|
19861
|
+
className: cn(
|
|
19862
|
+
"transition-colors",
|
|
19863
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19864
|
+
),
|
|
19865
|
+
style: { pointerEvents: "none" }
|
|
19866
|
+
}
|
|
19867
|
+
)
|
|
19868
|
+
}
|
|
19869
|
+
) }),
|
|
19870
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19871
|
+
] }),
|
|
19872
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19873
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19874
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19875
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19876
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19877
|
+
ToolbarAction,
|
|
19878
|
+
{
|
|
19879
|
+
label: gatedLabel("Move right"),
|
|
19880
|
+
onClick: onMoveRight,
|
|
19881
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19882
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
19883
|
+
}
|
|
19884
|
+
),
|
|
19885
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19886
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19887
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19888
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19889
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19890
|
+
ToolbarAction,
|
|
19891
|
+
{
|
|
19892
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19893
|
+
active: treatment === "grayscale",
|
|
19894
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19895
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19896
|
+
}
|
|
19897
|
+
),
|
|
19898
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19899
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
19900
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19901
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19902
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19903
|
+
sizeValue,
|
|
19904
|
+
"px"
|
|
19905
|
+
] }),
|
|
19906
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19907
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19908
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19909
|
+
]
|
|
19910
|
+
}
|
|
19911
|
+
),
|
|
19912
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19576
19913
|
]
|
|
19577
19914
|
}
|
|
19578
|
-
);
|
|
19915
|
+
) });
|
|
19579
19916
|
}
|
|
19580
19917
|
function findMediaStripSlots(tree) {
|
|
19581
19918
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19594,31 +19931,23 @@ function AiMediaStripOverlay({
|
|
|
19594
19931
|
}) {
|
|
19595
19932
|
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
19596
19933
|
const [active, setActive] = (0, import_react13.useState)(null);
|
|
19934
|
+
const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
|
|
19935
|
+
const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
|
|
19597
19936
|
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
19598
19937
|
const [error, setError] = (0, import_react13.useState)(null);
|
|
19599
19938
|
const activeRef = (0, import_react13.useRef)(null);
|
|
19600
19939
|
activeRef.current = active;
|
|
19940
|
+
const linkOpenRef = (0, import_react13.useRef)(false);
|
|
19941
|
+
linkOpenRef.current = linkOpen;
|
|
19601
19942
|
(0, import_react13.useEffect)(() => {
|
|
19602
19943
|
const onMove = (e) => {
|
|
19944
|
+
const ref = itemRefFromTarget(e.target);
|
|
19603
19945
|
const t = e.target;
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
|
|
19609
|
-
if (!itemEl) {
|
|
19610
|
-
setHover(null);
|
|
19611
|
-
return;
|
|
19612
|
-
}
|
|
19613
|
-
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19614
|
-
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19615
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19616
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19617
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19618
|
-
setHover(null);
|
|
19619
|
-
return;
|
|
19620
|
-
}
|
|
19621
|
-
setHover({ sectionId, index });
|
|
19946
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19947
|
+
setHover((prev) => {
|
|
19948
|
+
const next = ref && !overEditable ? ref : null;
|
|
19949
|
+
return sameRef(prev, next) ? prev : next;
|
|
19950
|
+
});
|
|
19622
19951
|
};
|
|
19623
19952
|
const onLeave = () => setHover(null);
|
|
19624
19953
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19630,23 +19959,25 @@ function AiMediaStripOverlay({
|
|
|
19630
19959
|
}, []);
|
|
19631
19960
|
(0, import_react13.useEffect)(() => {
|
|
19632
19961
|
const onClick = (e) => {
|
|
19633
|
-
const current = activeRef.current;
|
|
19634
|
-
if (!current) return;
|
|
19635
19962
|
const t = e.target;
|
|
19636
|
-
if (!(t instanceof
|
|
19637
|
-
if (t.closest(
|
|
19638
|
-
const
|
|
19639
|
-
if (
|
|
19640
|
-
|
|
19963
|
+
if (!(t instanceof Element)) return;
|
|
19964
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19965
|
+
const ref = itemRefFromTarget(t);
|
|
19966
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19967
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19968
|
+
setItemEditOn(false);
|
|
19641
19969
|
setError(null);
|
|
19970
|
+
setActive(ref);
|
|
19642
19971
|
};
|
|
19643
19972
|
document.addEventListener("click", onClick, true);
|
|
19644
19973
|
return () => document.removeEventListener("click", onClick, true);
|
|
19645
|
-
}, []);
|
|
19974
|
+
}, [clearInteractionChromeRef]);
|
|
19646
19975
|
(0, import_react13.useEffect)(() => {
|
|
19647
19976
|
const onBlur = () => {
|
|
19648
19977
|
if (!activeRef.current) return;
|
|
19649
19978
|
setActive(null);
|
|
19979
|
+
setItemEditOn(false);
|
|
19980
|
+
setLinkOpen(false);
|
|
19650
19981
|
setError(null);
|
|
19651
19982
|
};
|
|
19652
19983
|
window.addEventListener("blur", onBlur);
|
|
@@ -19656,7 +19987,10 @@ function AiMediaStripOverlay({
|
|
|
19656
19987
|
const onKeyDown = (e) => {
|
|
19657
19988
|
if (e.key !== "Escape") return;
|
|
19658
19989
|
if (!activeRef.current) return;
|
|
19990
|
+
if (linkOpenRef.current) return;
|
|
19991
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19659
19992
|
setActive(null);
|
|
19993
|
+
setItemEditOn(false);
|
|
19660
19994
|
setError(null);
|
|
19661
19995
|
};
|
|
19662
19996
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19690,141 +20024,137 @@ function AiMediaStripOverlay({
|
|
|
19690
20024
|
tree: nextTree,
|
|
19691
20025
|
label: entry.label,
|
|
19692
20026
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19693
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20027
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
20028
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20029
|
+
// on every edit reads as the section jumping around.
|
|
20030
|
+
skipScrollIntoView: true
|
|
19694
20031
|
});
|
|
19695
20032
|
return true;
|
|
19696
20033
|
},
|
|
19697
20034
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19698
20035
|
);
|
|
19699
20036
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19700
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19701
20037
|
const activeItemRect = useLiveItemRect(active);
|
|
19702
|
-
const
|
|
19703
|
-
const
|
|
19704
|
-
|
|
19705
|
-
|
|
19706
|
-
|
|
19707
|
-
|
|
19708
|
-
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
|
|
19712
|
-
|
|
19713
|
-
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
|
|
19721
|
-
|
|
19722
|
-
|
|
19723
|
-
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19737
|
-
ItemInteractionLayer,
|
|
19738
|
-
{
|
|
19739
|
-
rect: activeItemRect,
|
|
19740
|
-
state: toolbarState,
|
|
19741
|
-
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19742
|
-
MediaStripToolbar,
|
|
19743
|
-
{
|
|
19744
|
-
entry: activeEntry,
|
|
19745
|
-
index: active.index,
|
|
19746
|
-
pending,
|
|
19747
|
-
error,
|
|
19748
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19749
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19750
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19751
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19752
|
-
onResize: (delta) => {
|
|
19753
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19754
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19755
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19756
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19757
|
-
},
|
|
19758
|
-
onSetAlt: (alt) => {
|
|
19759
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19760
|
-
},
|
|
19761
|
-
onSetLink: (href, linkTarget) => {
|
|
20038
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
20039
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20040
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
20041
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
20042
|
+
const activeHref = activeItem?.href ?? "";
|
|
20043
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
20044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20045
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20046
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20047
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
20048
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20049
|
+
MediaStripToolbar,
|
|
20050
|
+
{
|
|
20051
|
+
entry: activeEntry,
|
|
20052
|
+
index: active.index,
|
|
20053
|
+
pending,
|
|
20054
|
+
error,
|
|
20055
|
+
itemEditOn,
|
|
20056
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
20057
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
20058
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
20059
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
20060
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
20061
|
+
onResize: (delta) => {
|
|
20062
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
20063
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
20064
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
20065
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
20066
|
+
},
|
|
20067
|
+
onOpenLink: () => setLinkOpen(true),
|
|
20068
|
+
onAddItem: () => {
|
|
20069
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20070
|
+
if (!picked) return;
|
|
20071
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19762
20072
|
void runMutation(
|
|
19763
20073
|
active.sectionId,
|
|
19764
|
-
(tree) =>
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19769
|
-
if (!picked) return;
|
|
19770
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19771
|
-
void runMutation(
|
|
19772
|
-
active.sectionId,
|
|
19773
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19774
|
-
{ [picked.assetId]: picked.url }
|
|
19775
|
-
).then((applied) => {
|
|
19776
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19777
|
-
});
|
|
20074
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
20075
|
+
{ [picked.assetId]: picked.url }
|
|
20076
|
+
).then((applied) => {
|
|
20077
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19778
20078
|
});
|
|
19779
|
-
}
|
|
19780
|
-
|
|
19781
|
-
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
});
|
|
19789
|
-
},
|
|
19790
|
-
onRemoveItem: () => {
|
|
19791
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19792
|
-
(applied) => {
|
|
19793
|
-
if (applied) setActive(null);
|
|
19794
|
-
}
|
|
19795
|
-
);
|
|
19796
|
-
},
|
|
19797
|
-
onMoveLeft: () => {
|
|
19798
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19799
|
-
(applied) => {
|
|
19800
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19801
|
-
}
|
|
19802
|
-
);
|
|
19803
|
-
},
|
|
19804
|
-
onMoveRight: () => {
|
|
19805
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19806
|
-
(applied) => {
|
|
19807
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19808
|
-
}
|
|
20079
|
+
});
|
|
20080
|
+
},
|
|
20081
|
+
onChangeImage: () => {
|
|
20082
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20083
|
+
if (!picked) return;
|
|
20084
|
+
void runMutation(
|
|
20085
|
+
active.sectionId,
|
|
20086
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
20087
|
+
{ [picked.assetId]: picked.url }
|
|
19809
20088
|
);
|
|
19810
|
-
}
|
|
20089
|
+
});
|
|
20090
|
+
},
|
|
20091
|
+
onRemoveItem: () => {
|
|
20092
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
20093
|
+
(applied) => {
|
|
20094
|
+
if (applied) setActive(null);
|
|
20095
|
+
}
|
|
20096
|
+
);
|
|
20097
|
+
},
|
|
20098
|
+
onMoveLeft: () => {
|
|
20099
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
20100
|
+
(applied) => {
|
|
20101
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
20102
|
+
}
|
|
20103
|
+
);
|
|
20104
|
+
},
|
|
20105
|
+
onMoveRight: () => {
|
|
20106
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20107
|
+
(applied) => {
|
|
20108
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20109
|
+
}
|
|
20110
|
+
);
|
|
19811
20111
|
}
|
|
19812
|
-
|
|
19813
|
-
}
|
|
19814
|
-
|
|
20112
|
+
}
|
|
20113
|
+
) }),
|
|
20114
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20115
|
+
"div",
|
|
20116
|
+
{
|
|
20117
|
+
"data-ohw-bridge": "",
|
|
20118
|
+
"data-ohw-item-interaction": "",
|
|
20119
|
+
"aria-hidden": true,
|
|
20120
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20121
|
+
style: {
|
|
20122
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20123
|
+
left: activeItemRect.left - 5,
|
|
20124
|
+
background: PRIMARY3,
|
|
20125
|
+
zIndex: 2147483644
|
|
20126
|
+
},
|
|
20127
|
+
children: "Media item"
|
|
20128
|
+
}
|
|
20129
|
+
),
|
|
20130
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20131
|
+
LinkModal,
|
|
20132
|
+
{
|
|
20133
|
+
href: activeHref,
|
|
20134
|
+
linkTarget: activeTarget,
|
|
20135
|
+
onClose: () => setLinkOpen(false),
|
|
20136
|
+
onSave: (href, linkTarget) => {
|
|
20137
|
+
void runMutation(
|
|
20138
|
+
active.sectionId,
|
|
20139
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20140
|
+
);
|
|
20141
|
+
}
|
|
20142
|
+
}
|
|
20143
|
+
)
|
|
20144
|
+
] })
|
|
19815
20145
|
] });
|
|
19816
20146
|
}
|
|
19817
20147
|
|
|
19818
20148
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19819
20149
|
var import_react14 = require("react");
|
|
19820
|
-
var
|
|
19821
|
-
var
|
|
20150
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20151
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
19822
20152
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19823
|
-
var
|
|
20153
|
+
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]";
|
|
19824
20154
|
function findPricingCardElement(sectionId, index) {
|
|
19825
|
-
const
|
|
19826
|
-
if (!
|
|
19827
|
-
const cards =
|
|
20155
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
20156
|
+
if (!sectionEl2) return null;
|
|
20157
|
+
const cards = sectionEl2.querySelectorAll("[data-ohw-pricing-card]");
|
|
19828
20158
|
for (const el of Array.from(cards)) {
|
|
19829
20159
|
if (Number(el.dataset.ohwPricingIndex) === index) return el;
|
|
19830
20160
|
}
|
|
@@ -19832,31 +20162,31 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19832
20162
|
}
|
|
19833
20163
|
function cardRefFromTarget(target) {
|
|
19834
20164
|
if (!(target instanceof Element)) return null;
|
|
19835
|
-
if (target.closest(
|
|
20165
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19836
20166
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19837
20167
|
if (!cardEl) return null;
|
|
19838
|
-
const
|
|
19839
|
-
const unit =
|
|
20168
|
+
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
20169
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19840
20170
|
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19841
20171
|
const index = Number(cardEl.dataset.ohwPricingIndex);
|
|
19842
20172
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19843
20173
|
return { sectionId, index };
|
|
19844
20174
|
}
|
|
19845
|
-
function
|
|
20175
|
+
function sameRef2(a, b) {
|
|
19846
20176
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19847
20177
|
}
|
|
19848
|
-
function
|
|
20178
|
+
function rectOf2(el) {
|
|
19849
20179
|
if (!el) return null;
|
|
19850
20180
|
const r2 = el.getBoundingClientRect();
|
|
19851
20181
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19852
20182
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19853
20183
|
}
|
|
19854
20184
|
function readRect3(ref) {
|
|
19855
|
-
return
|
|
20185
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19856
20186
|
}
|
|
19857
20187
|
function readGridRect(ref) {
|
|
19858
20188
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19859
|
-
return
|
|
20189
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19860
20190
|
}
|
|
19861
20191
|
function useLiveCardRect(ref, grid = false) {
|
|
19862
20192
|
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
@@ -19886,7 +20216,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19886
20216
|
}
|
|
19887
20217
|
var TOOLBAR_GRID_GAP = 52;
|
|
19888
20218
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19889
|
-
var
|
|
20219
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19890
20220
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19891
20221
|
const slotRef = (0, import_react14.useRef)(null);
|
|
19892
20222
|
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
@@ -19898,7 +20228,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19898
20228
|
const w = slot.offsetWidth;
|
|
19899
20229
|
if (w <= 0) return;
|
|
19900
20230
|
const half = w / 2;
|
|
19901
|
-
const clamped = Math.max(
|
|
20231
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19902
20232
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19903
20233
|
};
|
|
19904
20234
|
clamp();
|
|
@@ -19907,7 +20237,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19907
20237
|
return () => ro.disconnect();
|
|
19908
20238
|
}, [centerX, children]);
|
|
19909
20239
|
const mobile = window.innerWidth <= 480;
|
|
19910
|
-
return /* @__PURE__ */ (0,
|
|
20240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19911
20241
|
"div",
|
|
19912
20242
|
{
|
|
19913
20243
|
ref: slotRef,
|
|
@@ -19942,7 +20272,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19942
20272
|
});
|
|
19943
20273
|
}
|
|
19944
20274
|
function StyleSwatch({ style }) {
|
|
19945
|
-
return /* @__PURE__ */ (0,
|
|
20275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19946
20276
|
"span",
|
|
19947
20277
|
{
|
|
19948
20278
|
"aria-hidden": true,
|
|
@@ -19956,35 +20286,35 @@ function StyleSwatch({ style }) {
|
|
|
19956
20286
|
);
|
|
19957
20287
|
}
|
|
19958
20288
|
function ButtonGlyph() {
|
|
19959
|
-
return /* @__PURE__ */ (0,
|
|
19960
|
-
/* @__PURE__ */ (0,
|
|
19961
|
-
/* @__PURE__ */ (0,
|
|
20289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20290
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20291
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19962
20292
|
] });
|
|
19963
20293
|
}
|
|
19964
20294
|
function FeatureGlyph({ mode }) {
|
|
19965
|
-
return /* @__PURE__ */ (0,
|
|
19966
|
-
/* @__PURE__ */ (0,
|
|
19967
|
-
/* @__PURE__ */ (0,
|
|
19968
|
-
/* @__PURE__ */ (0,
|
|
19969
|
-
/* @__PURE__ */ (0,
|
|
19970
|
-
/* @__PURE__ */ (0,
|
|
19971
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
20295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20296
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20297
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20298
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20299
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20300
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20301
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19972
20302
|
] });
|
|
19973
20303
|
}
|
|
19974
|
-
function
|
|
20304
|
+
function ToolbarAction2({
|
|
19975
20305
|
label,
|
|
19976
20306
|
onClick,
|
|
19977
20307
|
disabled = false,
|
|
19978
20308
|
children
|
|
19979
20309
|
}) {
|
|
19980
|
-
const button = /* @__PURE__ */ (0,
|
|
19981
|
-
return /* @__PURE__ */ (0,
|
|
19982
|
-
/* @__PURE__ */ (0,
|
|
19983
|
-
/* @__PURE__ */ (0,
|
|
20310
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20312
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20313
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19984
20314
|
] });
|
|
19985
20315
|
}
|
|
19986
|
-
function
|
|
19987
|
-
return /* @__PURE__ */ (0,
|
|
20316
|
+
function ToolbarSeparator2() {
|
|
20317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19988
20318
|
}
|
|
19989
20319
|
function CardStyleMenu({
|
|
19990
20320
|
value,
|
|
@@ -19992,7 +20322,7 @@ function CardStyleMenu({
|
|
|
19992
20322
|
disabled = false
|
|
19993
20323
|
}) {
|
|
19994
20324
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19995
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20325
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
19996
20326
|
"button",
|
|
19997
20327
|
{
|
|
19998
20328
|
type: "button",
|
|
@@ -20003,28 +20333,28 @@ function CardStyleMenu({
|
|
|
20003
20333
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20004
20334
|
),
|
|
20005
20335
|
children: [
|
|
20006
|
-
/* @__PURE__ */ (0,
|
|
20007
|
-
/* @__PURE__ */ (0,
|
|
20008
|
-
/* @__PURE__ */ (0,
|
|
20336
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
|
|
20337
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20338
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20009
20339
|
]
|
|
20010
20340
|
}
|
|
20011
20341
|
);
|
|
20012
20342
|
if (disabled) {
|
|
20013
|
-
return /* @__PURE__ */ (0,
|
|
20014
|
-
/* @__PURE__ */ (0,
|
|
20015
|
-
/* @__PURE__ */ (0,
|
|
20016
|
-
/* @__PURE__ */ (0,
|
|
20017
|
-
/* @__PURE__ */ (0,
|
|
20343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20344
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20345
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20346
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20347
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20018
20348
|
] })
|
|
20019
20349
|
] });
|
|
20020
20350
|
}
|
|
20021
|
-
return /* @__PURE__ */ (0,
|
|
20022
|
-
/* @__PURE__ */ (0,
|
|
20023
|
-
/* @__PURE__ */ (0,
|
|
20024
|
-
/* @__PURE__ */ (0,
|
|
20025
|
-
/* @__PURE__ */ (0,
|
|
20351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20352
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20353
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20354
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20355
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
20026
20356
|
const selected = style.value === value;
|
|
20027
|
-
return /* @__PURE__ */ (0,
|
|
20357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20028
20358
|
DropdownMenuItem,
|
|
20029
20359
|
{
|
|
20030
20360
|
role: "menuitemradio",
|
|
@@ -20032,9 +20362,9 @@ function CardStyleMenu({
|
|
|
20032
20362
|
onSelect: () => onChange(style.value),
|
|
20033
20363
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20034
20364
|
children: [
|
|
20035
|
-
/* @__PURE__ */ (0,
|
|
20036
|
-
/* @__PURE__ */ (0,
|
|
20037
|
-
selected && /* @__PURE__ */ (0,
|
|
20365
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
|
|
20366
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
|
|
20367
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
|
|
20038
20368
|
]
|
|
20039
20369
|
},
|
|
20040
20370
|
style.value
|
|
@@ -20064,7 +20394,7 @@ function PricingCardToolbar({
|
|
|
20064
20394
|
const style = pricingCardStyle(entry.tree, index);
|
|
20065
20395
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20066
20396
|
const mobile = window.innerWidth <= 480;
|
|
20067
|
-
return /* @__PURE__ */ (0,
|
|
20397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20068
20398
|
"div",
|
|
20069
20399
|
{
|
|
20070
20400
|
"data-ohw-bridge": "",
|
|
@@ -20076,7 +20406,7 @@ function PricingCardToolbar({
|
|
|
20076
20406
|
),
|
|
20077
20407
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20078
20408
|
children: [
|
|
20079
|
-
/* @__PURE__ */ (0,
|
|
20409
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20080
20410
|
"div",
|
|
20081
20411
|
{
|
|
20082
20412
|
className: cn(
|
|
@@ -20085,8 +20415,8 @@ function PricingCardToolbar({
|
|
|
20085
20415
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20086
20416
|
),
|
|
20087
20417
|
children: [
|
|
20088
|
-
/* @__PURE__ */ (0,
|
|
20089
|
-
/* @__PURE__ */ (0,
|
|
20418
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20419
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20090
20420
|
CustomToolbarButton,
|
|
20091
20421
|
{
|
|
20092
20422
|
type: "button",
|
|
@@ -20094,8 +20424,8 @@ function PricingCardToolbar({
|
|
|
20094
20424
|
"aria-pressed": featuredTag,
|
|
20095
20425
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20096
20426
|
className: "group size-8",
|
|
20097
|
-
children: /* @__PURE__ */ (0,
|
|
20098
|
-
|
|
20427
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20428
|
+
import_lucide_react10.Star,
|
|
20099
20429
|
{
|
|
20100
20430
|
size: 16,
|
|
20101
20431
|
fill: "currentColor",
|
|
@@ -20109,25 +20439,25 @@ function PricingCardToolbar({
|
|
|
20109
20439
|
)
|
|
20110
20440
|
}
|
|
20111
20441
|
) }),
|
|
20112
|
-
/* @__PURE__ */ (0,
|
|
20442
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20113
20443
|
] }),
|
|
20114
|
-
/* @__PURE__ */ (0,
|
|
20115
|
-
/* @__PURE__ */ (0,
|
|
20116
|
-
/* @__PURE__ */ (0,
|
|
20117
|
-
/* @__PURE__ */ (0,
|
|
20118
|
-
/* @__PURE__ */ (0,
|
|
20119
|
-
/* @__PURE__ */ (0,
|
|
20120
|
-
/* @__PURE__ */ (0,
|
|
20444
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20445
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20446
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20447
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
|
|
20448
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
|
|
20449
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
|
|
20450
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
20121
20451
|
] }) }),
|
|
20122
|
-
/* @__PURE__ */ (0,
|
|
20123
|
-
/* @__PURE__ */ (0,
|
|
20124
|
-
/* @__PURE__ */ (0,
|
|
20125
|
-
/* @__PURE__ */ (0,
|
|
20126
|
-
/* @__PURE__ */ (0,
|
|
20452
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
|
|
20453
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
|
|
20454
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20455
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20456
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20127
20457
|
]
|
|
20128
20458
|
}
|
|
20129
20459
|
),
|
|
20130
|
-
error && /* @__PURE__ */ (0,
|
|
20460
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
20131
20461
|
]
|
|
20132
20462
|
}
|
|
20133
20463
|
) });
|
|
@@ -20161,7 +20491,7 @@ function AiPricingCardOverlay({
|
|
|
20161
20491
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20162
20492
|
setHover((prev) => {
|
|
20163
20493
|
const next = ref && !overEditable ? ref : null;
|
|
20164
|
-
return
|
|
20494
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20165
20495
|
});
|
|
20166
20496
|
};
|
|
20167
20497
|
const onLeave = () => setHover(null);
|
|
@@ -20176,10 +20506,10 @@ function AiPricingCardOverlay({
|
|
|
20176
20506
|
const onClick = (e) => {
|
|
20177
20507
|
const t = e.target;
|
|
20178
20508
|
if (!(t instanceof Element)) return;
|
|
20179
|
-
if (t.closest(
|
|
20509
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20180
20510
|
const ref = cardRefFromTarget(t);
|
|
20181
|
-
setActive((prev) =>
|
|
20182
|
-
if (!ref || !
|
|
20511
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20512
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20183
20513
|
};
|
|
20184
20514
|
document.addEventListener("click", onClick, true);
|
|
20185
20515
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20244,12 +20574,12 @@ function AiPricingCardOverlay({
|
|
|
20244
20574
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20245
20575
|
const activeCardRect = useLiveCardRect(active);
|
|
20246
20576
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20247
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20248
|
-
return /* @__PURE__ */ (0,
|
|
20249
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20250
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20251
|
-
/* @__PURE__ */ (0,
|
|
20252
|
-
/* @__PURE__ */ (0,
|
|
20577
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20579
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20580
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20581
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20582
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20253
20583
|
PricingCardToolbar,
|
|
20254
20584
|
{
|
|
20255
20585
|
entry: activeEntry,
|
|
@@ -20277,7 +20607,7 @@ function AiPricingCardOverlay({
|
|
|
20277
20607
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20278
20608
|
}
|
|
20279
20609
|
) }),
|
|
20280
|
-
/* @__PURE__ */ (0,
|
|
20610
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20281
20611
|
"div",
|
|
20282
20612
|
{
|
|
20283
20613
|
"data-ohw-bridge": "",
|
|
@@ -20299,7 +20629,7 @@ function AiPricingCardOverlay({
|
|
|
20299
20629
|
|
|
20300
20630
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20301
20631
|
var import_react15 = require("react");
|
|
20302
|
-
var
|
|
20632
|
+
var import_lucide_react11 = require("lucide-react");
|
|
20303
20633
|
|
|
20304
20634
|
// src/lib/ai-video-tree.ts
|
|
20305
20635
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20341,43 +20671,15 @@ function clearVideo(tree, path) {
|
|
|
20341
20671
|
});
|
|
20342
20672
|
}
|
|
20343
20673
|
|
|
20344
|
-
// src/lib/youtube.ts
|
|
20345
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20346
|
-
function extractYouTubeId(input) {
|
|
20347
|
-
const trimmed = input.trim();
|
|
20348
|
-
if (!trimmed) return null;
|
|
20349
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20350
|
-
let url;
|
|
20351
|
-
try {
|
|
20352
|
-
url = new URL(trimmed);
|
|
20353
|
-
} catch {
|
|
20354
|
-
return null;
|
|
20355
|
-
}
|
|
20356
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20357
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20358
|
-
return null;
|
|
20359
|
-
}
|
|
20360
|
-
let candidate = null;
|
|
20361
|
-
if (host === "youtu.be") {
|
|
20362
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20363
|
-
} else if (url.pathname === "/watch") {
|
|
20364
|
-
candidate = url.searchParams.get("v");
|
|
20365
|
-
} else {
|
|
20366
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20367
|
-
candidate = match ? match[1] : null;
|
|
20368
|
-
}
|
|
20369
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20370
|
-
}
|
|
20371
|
-
|
|
20372
20674
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20373
|
-
var
|
|
20675
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
20374
20676
|
var PRIMARY5 = "#0885FE";
|
|
20375
|
-
var
|
|
20376
|
-
var
|
|
20677
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20678
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20377
20679
|
function findVideoBlockElement(sectionId, path) {
|
|
20378
|
-
const
|
|
20379
|
-
if (!
|
|
20380
|
-
const items =
|
|
20680
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
20681
|
+
if (!sectionEl2) return null;
|
|
20682
|
+
const items = sectionEl2.querySelectorAll("[data-ohw-video-block]");
|
|
20381
20683
|
for (const el of Array.from(items)) {
|
|
20382
20684
|
if (el.dataset.ohwVideoPath === path) return el;
|
|
20383
20685
|
}
|
|
@@ -20433,12 +20735,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20433
20735
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20434
20736
|
});
|
|
20435
20737
|
}
|
|
20436
|
-
function
|
|
20738
|
+
function Pill({
|
|
20437
20739
|
label,
|
|
20438
20740
|
onClick,
|
|
20439
20741
|
disabled
|
|
20440
20742
|
}) {
|
|
20441
|
-
return /* @__PURE__ */ (0,
|
|
20743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20442
20744
|
"button",
|
|
20443
20745
|
{
|
|
20444
20746
|
type: "button",
|
|
@@ -20454,7 +20756,7 @@ function Pill2({
|
|
|
20454
20756
|
border: "none",
|
|
20455
20757
|
cursor: disabled ? "default" : "pointer",
|
|
20456
20758
|
background: "#ffffff",
|
|
20457
|
-
color:
|
|
20759
|
+
color: OHW_BLUE_DARK,
|
|
20458
20760
|
opacity: disabled ? 0.4 : 1,
|
|
20459
20761
|
fontSize: 12,
|
|
20460
20762
|
lineHeight: "16px",
|
|
@@ -20497,8 +20799,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20497
20799
|
onCommit(id);
|
|
20498
20800
|
}
|
|
20499
20801
|
};
|
|
20500
|
-
return /* @__PURE__ */ (0,
|
|
20501
|
-
/* @__PURE__ */ (0,
|
|
20802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20803
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20502
20804
|
"div",
|
|
20503
20805
|
{
|
|
20504
20806
|
style: {
|
|
@@ -20514,12 +20816,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20514
20816
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20515
20817
|
},
|
|
20516
20818
|
children: [
|
|
20517
|
-
/* @__PURE__ */ (0,
|
|
20819
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20518
20820
|
"span",
|
|
20519
20821
|
{
|
|
20520
20822
|
style: {
|
|
20521
20823
|
flex: "0 0 auto",
|
|
20522
|
-
color:
|
|
20824
|
+
color: OHW_BLUE_DARK,
|
|
20523
20825
|
fontSize: 10,
|
|
20524
20826
|
lineHeight: "16px",
|
|
20525
20827
|
fontWeight: 700,
|
|
@@ -20529,7 +20831,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20529
20831
|
children: "Video"
|
|
20530
20832
|
}
|
|
20531
20833
|
),
|
|
20532
|
-
/* @__PURE__ */ (0,
|
|
20834
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20533
20835
|
"input",
|
|
20534
20836
|
{
|
|
20535
20837
|
type: "text",
|
|
@@ -20566,7 +20868,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20566
20868
|
]
|
|
20567
20869
|
}
|
|
20568
20870
|
),
|
|
20569
|
-
invalid && /* @__PURE__ */ (0,
|
|
20871
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20570
20872
|
] });
|
|
20571
20873
|
}
|
|
20572
20874
|
function VideoToolbar({
|
|
@@ -20576,7 +20878,7 @@ function VideoToolbar({
|
|
|
20576
20878
|
onSetVideoId,
|
|
20577
20879
|
onRemove
|
|
20578
20880
|
}) {
|
|
20579
|
-
return /* @__PURE__ */ (0,
|
|
20881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20580
20882
|
"div",
|
|
20581
20883
|
{
|
|
20582
20884
|
"data-ohw-bridge": "",
|
|
@@ -20588,7 +20890,7 @@ function VideoToolbar({
|
|
|
20588
20890
|
gap: 6,
|
|
20589
20891
|
alignItems: "center",
|
|
20590
20892
|
width: 280,
|
|
20591
|
-
background:
|
|
20893
|
+
background: OHW_BLUE,
|
|
20592
20894
|
padding: 8,
|
|
20593
20895
|
borderRadius: 12,
|
|
20594
20896
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20596,9 +20898,9 @@ function VideoToolbar({
|
|
|
20596
20898
|
opacity: pending ? 0.6 : 1
|
|
20597
20899
|
},
|
|
20598
20900
|
children: [
|
|
20599
|
-
/* @__PURE__ */ (0,
|
|
20600
|
-
/* @__PURE__ */ (0,
|
|
20601
|
-
error && /* @__PURE__ */ (0,
|
|
20901
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20902
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20903
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20602
20904
|
]
|
|
20603
20905
|
}
|
|
20604
20906
|
);
|
|
@@ -20627,8 +20929,8 @@ function AiVideoOverlay({
|
|
|
20627
20929
|
setHover(null);
|
|
20628
20930
|
return;
|
|
20629
20931
|
}
|
|
20630
|
-
const
|
|
20631
|
-
const unit =
|
|
20932
|
+
const sectionEl2 = blockEl.closest("[data-ohw-section]");
|
|
20933
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
20632
20934
|
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
20633
20935
|
const path = blockEl.dataset.ohwVideoPath;
|
|
20634
20936
|
if (!sectionId || !path) {
|
|
@@ -20718,8 +21020,8 @@ function AiVideoOverlay({
|
|
|
20718
21020
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20719
21021
|
const TOOLBAR_APPROX_H = 90;
|
|
20720
21022
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20721
|
-
return /* @__PURE__ */ (0,
|
|
20722
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
21024
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20723
21025
|
"button",
|
|
20724
21026
|
{
|
|
20725
21027
|
type: "button",
|
|
@@ -20747,15 +21049,15 @@ function AiVideoOverlay({
|
|
|
20747
21049
|
fontSize: 14,
|
|
20748
21050
|
fontWeight: 700
|
|
20749
21051
|
},
|
|
20750
|
-
children: /* @__PURE__ */ (0,
|
|
21052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
20751
21053
|
}
|
|
20752
21054
|
),
|
|
20753
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21055
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20754
21056
|
ItemInteractionLayer,
|
|
20755
21057
|
{
|
|
20756
21058
|
rect: activeBlockRect,
|
|
20757
21059
|
state: toolbarState,
|
|
20758
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21060
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20759
21061
|
VideoToolbar,
|
|
20760
21062
|
{
|
|
20761
21063
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20779,7 +21081,7 @@ function AiVideoOverlay({
|
|
|
20779
21081
|
|
|
20780
21082
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20781
21083
|
var import_react16 = require("react");
|
|
20782
|
-
var
|
|
21084
|
+
var import_lucide_react12 = require("lucide-react");
|
|
20783
21085
|
|
|
20784
21086
|
// src/lib/ai-carousel-tree.ts
|
|
20785
21087
|
function isCarouselBlock(node) {
|
|
@@ -20830,14 +21132,14 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20830
21132
|
}
|
|
20831
21133
|
|
|
20832
21134
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20833
|
-
var
|
|
21135
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
20834
21136
|
var PRIMARY6 = "#0885FE";
|
|
20835
|
-
var
|
|
20836
|
-
var
|
|
21137
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21138
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20837
21139
|
function findCarouselItemElement(sectionId, index) {
|
|
20838
|
-
const
|
|
20839
|
-
if (!
|
|
20840
|
-
const items =
|
|
21140
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
21141
|
+
if (!sectionEl2) return null;
|
|
21142
|
+
const items = sectionEl2.querySelectorAll("[data-ohw-fade-carousel-item]");
|
|
20841
21143
|
for (const el of Array.from(items)) {
|
|
20842
21144
|
if (Number(el.dataset.ohwFadeCarouselIndex) === index) return el;
|
|
20843
21145
|
}
|
|
@@ -20912,8 +21214,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20912
21214
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20913
21215
|
});
|
|
20914
21216
|
}
|
|
20915
|
-
function
|
|
20916
|
-
return /* @__PURE__ */ (0,
|
|
21217
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20917
21219
|
"button",
|
|
20918
21220
|
{
|
|
20919
21221
|
type: "button",
|
|
@@ -20929,7 +21231,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20929
21231
|
border: "none",
|
|
20930
21232
|
cursor: disabled ? "default" : "pointer",
|
|
20931
21233
|
background: "#ffffff",
|
|
20932
|
-
color:
|
|
21234
|
+
color: OHW_BLUE_DARK2,
|
|
20933
21235
|
opacity: disabled ? 0.4 : 1,
|
|
20934
21236
|
fontSize: 12,
|
|
20935
21237
|
lineHeight: "16px",
|
|
@@ -20947,7 +21249,7 @@ function TogglePill({
|
|
|
20947
21249
|
onToggle,
|
|
20948
21250
|
disabled
|
|
20949
21251
|
}) {
|
|
20950
|
-
return /* @__PURE__ */ (0,
|
|
21252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
20951
21253
|
"button",
|
|
20952
21254
|
{
|
|
20953
21255
|
type: "button",
|
|
@@ -20966,7 +21268,7 @@ function TogglePill({
|
|
|
20966
21268
|
border: "none",
|
|
20967
21269
|
cursor: disabled ? "default" : "pointer",
|
|
20968
21270
|
background: "#ffffff",
|
|
20969
|
-
color:
|
|
21271
|
+
color: OHW_BLUE_DARK2,
|
|
20970
21272
|
opacity: disabled ? 0.4 : 1,
|
|
20971
21273
|
fontSize: 12,
|
|
20972
21274
|
lineHeight: "16px",
|
|
@@ -20976,7 +21278,7 @@ function TogglePill({
|
|
|
20976
21278
|
},
|
|
20977
21279
|
children: [
|
|
20978
21280
|
label,
|
|
20979
|
-
/* @__PURE__ */ (0,
|
|
21281
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20980
21282
|
"span",
|
|
20981
21283
|
{
|
|
20982
21284
|
"aria-hidden": true,
|
|
@@ -20989,10 +21291,10 @@ function TogglePill({
|
|
|
20989
21291
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20990
21292
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20991
21293
|
// "disabled control" rather than "switch that is off".
|
|
20992
|
-
background: on ?
|
|
21294
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20993
21295
|
transition: "background 120ms ease"
|
|
20994
21296
|
},
|
|
20995
|
-
children: /* @__PURE__ */ (0,
|
|
21297
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20996
21298
|
"span",
|
|
20997
21299
|
{
|
|
20998
21300
|
style: {
|
|
@@ -21021,7 +21323,7 @@ function CarouselSlideToolbar({
|
|
|
21021
21323
|
onChangeImage,
|
|
21022
21324
|
onToggleAutoplay
|
|
21023
21325
|
}) {
|
|
21024
|
-
return /* @__PURE__ */ (0,
|
|
21326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21025
21327
|
"div",
|
|
21026
21328
|
{
|
|
21027
21329
|
"data-ohw-bridge": "",
|
|
@@ -21032,7 +21334,7 @@ function CarouselSlideToolbar({
|
|
|
21032
21334
|
flexDirection: "column",
|
|
21033
21335
|
gap: 6,
|
|
21034
21336
|
alignItems: "center",
|
|
21035
|
-
background:
|
|
21337
|
+
background: OHW_BLUE2,
|
|
21036
21338
|
padding: 8,
|
|
21037
21339
|
borderRadius: 12,
|
|
21038
21340
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21044,11 +21346,11 @@ function CarouselSlideToolbar({
|
|
|
21044
21346
|
pointerEvents: pending ? "none" : "auto"
|
|
21045
21347
|
},
|
|
21046
21348
|
children: [
|
|
21047
|
-
/* @__PURE__ */ (0,
|
|
21048
|
-
/* @__PURE__ */ (0,
|
|
21049
|
-
/* @__PURE__ */ (0,
|
|
21349
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21350
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21351
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21050
21352
|
] }),
|
|
21051
|
-
error && /* @__PURE__ */ (0,
|
|
21353
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21052
21354
|
]
|
|
21053
21355
|
}
|
|
21054
21356
|
);
|
|
@@ -21097,8 +21399,8 @@ function AiFadeCarouselOverlay({
|
|
|
21097
21399
|
setHover(null);
|
|
21098
21400
|
return;
|
|
21099
21401
|
}
|
|
21100
|
-
const
|
|
21101
|
-
const unit =
|
|
21402
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21403
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
21102
21404
|
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
21103
21405
|
const index = Number(itemEl.dataset.ohwFadeCarouselIndex);
|
|
21104
21406
|
if (!sectionId || Number.isNaN(index)) {
|
|
@@ -21188,8 +21490,8 @@ function AiFadeCarouselOverlay({
|
|
|
21188
21490
|
const activeItemRect = useLiveItemRect2(active);
|
|
21189
21491
|
const TOOLBAR_APPROX_H = 90;
|
|
21190
21492
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21191
|
-
return /* @__PURE__ */ (0,
|
|
21192
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
21494
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21193
21495
|
"button",
|
|
21194
21496
|
{
|
|
21195
21497
|
type: "button",
|
|
@@ -21218,10 +21520,10 @@ function AiFadeCarouselOverlay({
|
|
|
21218
21520
|
fontSize: 14,
|
|
21219
21521
|
fontWeight: 700
|
|
21220
21522
|
},
|
|
21221
|
-
children: /* @__PURE__ */ (0,
|
|
21523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21222
21524
|
}
|
|
21223
21525
|
),
|
|
21224
|
-
swapping && /* @__PURE__ */ (0,
|
|
21526
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21225
21527
|
"div",
|
|
21226
21528
|
{
|
|
21227
21529
|
ref: skeletonRef,
|
|
@@ -21239,15 +21541,15 @@ function AiFadeCarouselOverlay({
|
|
|
21239
21541
|
zIndex: 2147483646,
|
|
21240
21542
|
pointerEvents: "none"
|
|
21241
21543
|
},
|
|
21242
|
-
children: /* @__PURE__ */ (0,
|
|
21544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21243
21545
|
}
|
|
21244
21546
|
),
|
|
21245
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21547
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21246
21548
|
ItemInteractionLayer,
|
|
21247
21549
|
{
|
|
21248
21550
|
rect: activeItemRect,
|
|
21249
21551
|
state: toolbarState,
|
|
21250
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21552
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21251
21553
|
CarouselSlideToolbar,
|
|
21252
21554
|
{
|
|
21253
21555
|
pending,
|
|
@@ -21438,113 +21740,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21438
21740
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21439
21741
|
var import_react20 = require("react");
|
|
21440
21742
|
|
|
21441
|
-
// src/ui/dialog.tsx
|
|
21442
|
-
var React9 = __toESM(require("react"), 1);
|
|
21443
|
-
var import_radix_ui6 = require("radix-ui");
|
|
21444
|
-
var import_lucide_react12 = require("lucide-react");
|
|
21445
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
21446
|
-
function Dialog2({
|
|
21447
|
-
...props
|
|
21448
|
-
}) {
|
|
21449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21450
|
-
}
|
|
21451
|
-
function DialogPortal({
|
|
21452
|
-
...props
|
|
21453
|
-
}) {
|
|
21454
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21455
|
-
}
|
|
21456
|
-
function DialogOverlay({
|
|
21457
|
-
className,
|
|
21458
|
-
...props
|
|
21459
|
-
}) {
|
|
21460
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21461
|
-
import_radix_ui6.Dialog.Overlay,
|
|
21462
|
-
{
|
|
21463
|
-
"data-slot": "dialog-overlay",
|
|
21464
|
-
"data-ohw-link-modal-root": "",
|
|
21465
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21466
|
-
...props
|
|
21467
|
-
}
|
|
21468
|
-
);
|
|
21469
|
-
}
|
|
21470
|
-
var DialogContent = React9.forwardRef(
|
|
21471
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21472
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21473
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21474
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21475
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21476
|
-
import_radix_ui6.Dialog.Content,
|
|
21477
|
-
{
|
|
21478
|
-
ref,
|
|
21479
|
-
"data-slot": "dialog-content",
|
|
21480
|
-
className: cn(
|
|
21481
|
-
positionMode,
|
|
21482
|
-
"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",
|
|
21483
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21484
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21485
|
-
className
|
|
21486
|
-
),
|
|
21487
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21488
|
-
...props,
|
|
21489
|
-
children: [
|
|
21490
|
-
children,
|
|
21491
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21492
|
-
import_radix_ui6.Dialog.Close,
|
|
21493
|
-
{
|
|
21494
|
-
type: "button",
|
|
21495
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21496
|
-
"aria-label": "Close",
|
|
21497
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
21498
|
-
}
|
|
21499
|
-
) : null
|
|
21500
|
-
]
|
|
21501
|
-
}
|
|
21502
|
-
)
|
|
21503
|
-
] });
|
|
21504
|
-
}
|
|
21505
|
-
);
|
|
21506
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21507
|
-
function DialogHeader({
|
|
21508
|
-
className,
|
|
21509
|
-
...props
|
|
21510
|
-
}) {
|
|
21511
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21512
|
-
}
|
|
21513
|
-
function DialogFooter({
|
|
21514
|
-
className,
|
|
21515
|
-
...props
|
|
21516
|
-
}) {
|
|
21517
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21518
|
-
"div",
|
|
21519
|
-
{
|
|
21520
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21521
|
-
...props
|
|
21522
|
-
}
|
|
21523
|
-
);
|
|
21524
|
-
}
|
|
21525
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21526
|
-
import_radix_ui6.Dialog.Title,
|
|
21527
|
-
{
|
|
21528
|
-
ref,
|
|
21529
|
-
className: cn(
|
|
21530
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21531
|
-
className
|
|
21532
|
-
),
|
|
21533
|
-
...props
|
|
21534
|
-
}
|
|
21535
|
-
));
|
|
21536
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21537
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21538
|
-
import_radix_ui6.Dialog.Description,
|
|
21539
|
-
{
|
|
21540
|
-
ref,
|
|
21541
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21542
|
-
...props
|
|
21543
|
-
}
|
|
21544
|
-
));
|
|
21545
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21546
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21547
|
-
|
|
21548
21743
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21549
21744
|
var import_lucide_react16 = require("lucide-react");
|
|
21550
21745
|
|
|
@@ -22648,6 +22843,7 @@ function shouldUseDevFixtures() {
|
|
|
22648
22843
|
function getLogoElement(el) {
|
|
22649
22844
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22650
22845
|
if (marked) return marked;
|
|
22846
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22651
22847
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22652
22848
|
if (!root) return null;
|
|
22653
22849
|
const anchor = el.closest("a");
|
|
@@ -24029,9 +24225,9 @@ function useSectionDrag({
|
|
|
24029
24225
|
if (target.closest(SECTION_DRAG_EXCLUDED_SELECTOR)) return;
|
|
24030
24226
|
const inner = target.closest("[data-ohw-section]");
|
|
24031
24227
|
if (!inner || isChromeSection(inner) || inner.dataset.ohwSection === "footer") return;
|
|
24032
|
-
const
|
|
24033
|
-
if (!topLevelSections().includes(
|
|
24034
|
-
startSectionPressDrag(
|
|
24228
|
+
const sectionEl2 = movableUnit(inner);
|
|
24229
|
+
if (!topLevelSections().includes(sectionEl2)) return;
|
|
24230
|
+
startSectionPressDrag(sectionEl2, e.clientX, e.clientY, e.pointerId);
|
|
24035
24231
|
};
|
|
24036
24232
|
const onPointerMove = (e) => {
|
|
24037
24233
|
const pending = sectionPointerDragRef.current;
|
|
@@ -25457,7 +25653,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25457
25653
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25458
25654
|
return resolveFooterLinksContainerFrom(el);
|
|
25459
25655
|
}
|
|
25460
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25656
|
+
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)) {
|
|
25461
25657
|
return getNavigationRoot(el);
|
|
25462
25658
|
}
|
|
25463
25659
|
return null;
|
|
@@ -25679,7 +25875,6 @@ var ICONS = {
|
|
|
25679
25875
|
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"/>',
|
|
25680
25876
|
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"/>'
|
|
25681
25877
|
};
|
|
25682
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25683
25878
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25684
25879
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25685
25880
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25777,7 +25972,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25777
25972
|
el.style.top = `${top}px`;
|
|
25778
25973
|
el.style.height = `${height}px`;
|
|
25779
25974
|
}
|
|
25780
|
-
var
|
|
25975
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25781
25976
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25782
25977
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25783
25978
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25804,8 +25999,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25804
25999
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25805
26000
|
const half = toolbarWidth / 2;
|
|
25806
26001
|
return Math.max(
|
|
25807
|
-
|
|
25808
|
-
Math.min(centerX, window.innerWidth -
|
|
26002
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26003
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25809
26004
|
);
|
|
25810
26005
|
}
|
|
25811
26006
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -26301,9 +26496,9 @@ function OhhwellsBridge() {
|
|
|
26301
26496
|
const selectedIconElRef = (0, import_react25.useRef)(null);
|
|
26302
26497
|
const selectedSocialElRef = (0, import_react25.useRef)(null);
|
|
26303
26498
|
const queueSectionKeyDrop = (0, import_react25.useCallback)((prev) => {
|
|
26304
|
-
const
|
|
26305
|
-
if (!
|
|
26306
|
-
const sectionInstanceId = instanceIdOf(movableUnit(
|
|
26499
|
+
const sectionEl2 = prev?.closest("[data-ohw-section]") ?? null;
|
|
26500
|
+
if (!sectionEl2) return;
|
|
26501
|
+
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl2)) || null;
|
|
26307
26502
|
if (!sectionInstanceId) return;
|
|
26308
26503
|
const token = ++mediaKeyDropTokenRef.current;
|
|
26309
26504
|
const onQueueDrained = (e) => {
|
|
@@ -26313,8 +26508,8 @@ function OhhwellsBridge() {
|
|
|
26313
26508
|
if (selectedMediaElRef.current || selectedIconElRef.current || selectedSocialElRef.current) return;
|
|
26314
26509
|
postToParentRef.current({
|
|
26315
26510
|
type: "ow:section-selected",
|
|
26316
|
-
sectionId:
|
|
26317
|
-
sectionLabel:
|
|
26511
|
+
sectionId: sectionEl2.dataset.ohwSection ?? null,
|
|
26512
|
+
sectionLabel: sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? ""),
|
|
26318
26513
|
key: null
|
|
26319
26514
|
});
|
|
26320
26515
|
};
|
|
@@ -26348,12 +26543,12 @@ function OhhwellsBridge() {
|
|
|
26348
26543
|
const selectIconElement = (0, import_react25.useCallback)((el) => {
|
|
26349
26544
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26350
26545
|
selectedIconElRef.current = el;
|
|
26351
|
-
const
|
|
26546
|
+
const sectionEl2 = el.closest("[data-ohw-section]");
|
|
26352
26547
|
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
26353
26548
|
postToParentRef.current({
|
|
26354
26549
|
type: "ow:section-selected",
|
|
26355
|
-
sectionId:
|
|
26356
|
-
sectionLabel:
|
|
26550
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
26551
|
+
sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
|
|
26357
26552
|
key: el.dataset.ohwKey ?? null,
|
|
26358
26553
|
keyLabel: "Icon"
|
|
26359
26554
|
});
|
|
@@ -26373,12 +26568,12 @@ function OhhwellsBridge() {
|
|
|
26373
26568
|
isDragOver: false,
|
|
26374
26569
|
...video ? { videoAutoplay: video.autoplay, videoMuted: video.muted } : {}
|
|
26375
26570
|
});
|
|
26376
|
-
const
|
|
26571
|
+
const sectionEl2 = el.closest("[data-ohw-section]");
|
|
26377
26572
|
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
26378
26573
|
postToParentRef.current({
|
|
26379
26574
|
type: "ow:section-selected",
|
|
26380
|
-
sectionId:
|
|
26381
|
-
sectionLabel:
|
|
26575
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
26576
|
+
sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
|
|
26382
26577
|
key: el.dataset.ohwKey ?? null,
|
|
26383
26578
|
// Display name for the pill — the raw key prettifies into fragments ("Img"); the
|
|
26384
26579
|
// bridge knows what the node IS, so it names it.
|
|
@@ -26688,21 +26883,6 @@ function OhhwellsBridge() {
|
|
|
26688
26883
|
const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
|
|
26689
26884
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
|
|
26690
26885
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26691
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26692
|
-
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26693
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26694
|
-
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26695
|
-
floatingPanelRef.current = floatingPanel;
|
|
26696
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26697
|
-
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26698
|
-
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26699
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26700
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26701
|
-
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26702
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26703
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26704
|
-
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26705
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26706
26886
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
|
|
26707
26887
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
|
|
26708
26888
|
const footerDragRef = (0, import_react25.useRef)(null);
|
|
@@ -26729,6 +26909,21 @@ function OhhwellsBridge() {
|
|
|
26729
26909
|
const stylesRef = (0, import_react25.useRef)("");
|
|
26730
26910
|
const appliedDrawerRef = (0, import_react25.useRef)(null);
|
|
26731
26911
|
const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
|
|
26912
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26913
|
+
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26914
|
+
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26915
|
+
floatingPanelRef.current = floatingPanel;
|
|
26916
|
+
const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
|
|
26917
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26918
|
+
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26919
|
+
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26920
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26921
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26922
|
+
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26923
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26924
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26925
|
+
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26926
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26732
26927
|
const [sitePages, setSitePages] = (0, import_react25.useState)([]);
|
|
26733
26928
|
const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
26734
26929
|
const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
|
|
@@ -26738,7 +26933,18 @@ function OhhwellsBridge() {
|
|
|
26738
26933
|
const linkPopoverOpenRef = (0, import_react25.useRef)(false);
|
|
26739
26934
|
const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
|
|
26740
26935
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26936
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26741
26937
|
linkPopoverSessionRef.current = linkPopover;
|
|
26938
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26939
|
+
(0, import_react25.useEffect)(() => {
|
|
26940
|
+
const syncViewport = () => {
|
|
26941
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26942
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26943
|
+
};
|
|
26944
|
+
syncViewport();
|
|
26945
|
+
window.addEventListener("resize", syncViewport);
|
|
26946
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26947
|
+
}, []);
|
|
26742
26948
|
(0, import_react25.useEffect)(() => {
|
|
26743
26949
|
setSectionOrderPersistHandler((entries) => {
|
|
26744
26950
|
const currentPath = window.location.pathname;
|
|
@@ -27964,12 +28170,12 @@ function OhhwellsBridge() {
|
|
|
27964
28170
|
const socialItem = getSocialItem(anchor);
|
|
27965
28171
|
if (socialItem) {
|
|
27966
28172
|
selectedSocialElRef.current = socialItem;
|
|
27967
|
-
const
|
|
28173
|
+
const sectionEl2 = socialItem.closest("[data-ohw-section]");
|
|
27968
28174
|
aiSectionApiRef.current?.selectFromElement(anchor, { report: false });
|
|
27969
28175
|
postToParentRef.current({
|
|
27970
28176
|
type: "ow:section-selected",
|
|
27971
|
-
sectionId:
|
|
27972
|
-
sectionLabel:
|
|
28177
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
28178
|
+
sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
|
|
27973
28179
|
key: socialIconKey(socialItem) ?? socialItem.getAttribute("data-ohw-href-key"),
|
|
27974
28180
|
keyLabel: socialPlatformLabel(socialItem, editContentRef.current)
|
|
27975
28181
|
});
|
|
@@ -28399,13 +28605,13 @@ function OhhwellsBridge() {
|
|
|
28399
28605
|
setReorderDragDisabled(reorderDisabled);
|
|
28400
28606
|
}
|
|
28401
28607
|
setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
28402
|
-
const
|
|
28608
|
+
const sectionEl2 = el.closest("[data-ohw-section]");
|
|
28403
28609
|
postToParent2({
|
|
28404
28610
|
type: "ow:enter-edit",
|
|
28405
28611
|
key: el.dataset.ohwKey,
|
|
28406
28612
|
// Section the edited element belongs to, so the editor can scope AI prompts to it.
|
|
28407
|
-
sectionId:
|
|
28408
|
-
sectionLabel:
|
|
28613
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
28614
|
+
sectionLabel: sectionEl2?.dataset.ohwSectionLabel ?? null
|
|
28409
28615
|
});
|
|
28410
28616
|
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
28411
28617
|
requestAnimationFrame(() => refreshActiveCommandsRef.current());
|
|
@@ -28472,6 +28678,7 @@ function OhhwellsBridge() {
|
|
|
28472
28678
|
applyAiFooterFromContent(content);
|
|
28473
28679
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28474
28680
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28681
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28475
28682
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28476
28683
|
}
|
|
28477
28684
|
applyBrandChrome(content);
|
|
@@ -28482,15 +28689,16 @@ function OhhwellsBridge() {
|
|
|
28482
28689
|
if (key === "__ohw_sections") continue;
|
|
28483
28690
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28484
28691
|
if (key === AI_FOOTER_KEY) continue;
|
|
28692
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28693
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28485
28694
|
if (key === BRAND_KIT_KEY) continue;
|
|
28486
28695
|
if (key === STYLE_STORE_KEY) continue;
|
|
28487
28696
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28488
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28489
28697
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28490
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28491
28698
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28492
28699
|
continue;
|
|
28493
28700
|
}
|
|
28701
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28494
28702
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28495
28703
|
if (applyCarouselNode(key, val)) continue;
|
|
28496
28704
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28530,6 +28738,7 @@ function OhhwellsBridge() {
|
|
|
28530
28738
|
});
|
|
28531
28739
|
applyLinkByKey(key, val);
|
|
28532
28740
|
}
|
|
28741
|
+
applySectionEmbeds(content);
|
|
28533
28742
|
applyLogoFromContent(content);
|
|
28534
28743
|
applyLogoSizes(content);
|
|
28535
28744
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28718,20 +28927,22 @@ function OhhwellsBridge() {
|
|
|
28718
28927
|
}
|
|
28719
28928
|
applyAiFooterFromContent(content);
|
|
28720
28929
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28930
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28721
28931
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28722
28932
|
}
|
|
28723
28933
|
for (const [key, val] of Object.entries(content)) {
|
|
28724
28934
|
if (key === "__ohw_sections") continue;
|
|
28725
28935
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28726
28936
|
if (key === AI_FOOTER_KEY) continue;
|
|
28937
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28938
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28727
28939
|
if (key === BRAND_KIT_KEY) continue;
|
|
28728
28940
|
if (key === STYLE_STORE_KEY) continue;
|
|
28729
28941
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28730
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28731
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28732
28942
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28733
28943
|
continue;
|
|
28734
28944
|
}
|
|
28945
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28735
28946
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28736
28947
|
if (applyCarouselNode(key, val)) continue;
|
|
28737
28948
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28756,6 +28967,7 @@ function OhhwellsBridge() {
|
|
|
28756
28967
|
});
|
|
28757
28968
|
applyLinkByKey(key, val);
|
|
28758
28969
|
}
|
|
28970
|
+
applySectionEmbeds(content);
|
|
28759
28971
|
applyLogoFromContent(content);
|
|
28760
28972
|
reconcileNavbarItemsFromContent(content);
|
|
28761
28973
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28995,26 +29207,11 @@ function OhhwellsBridge() {
|
|
|
28995
29207
|
const t2 = setTimeout(measure, 500);
|
|
28996
29208
|
const ro = new ResizeObserver(schedule);
|
|
28997
29209
|
ro.observe(document.body);
|
|
28998
|
-
let lastWidth = window.innerWidth;
|
|
28999
|
-
let resizeTimers = [];
|
|
29000
|
-
const clearResizeTimers = () => {
|
|
29001
|
-
resizeTimers.forEach(clearTimeout);
|
|
29002
|
-
resizeTimers = [];
|
|
29003
|
-
};
|
|
29004
|
-
const handleResize = () => {
|
|
29005
|
-
if (window.innerWidth === lastWidth) return;
|
|
29006
|
-
lastWidth = window.innerWidth;
|
|
29007
|
-
clearResizeTimers();
|
|
29008
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29009
|
-
};
|
|
29010
|
-
window.addEventListener("resize", handleResize);
|
|
29011
29210
|
return () => {
|
|
29012
29211
|
clearTimeout(t1);
|
|
29013
29212
|
clearTimeout(t2);
|
|
29014
29213
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29015
29214
|
ro.disconnect();
|
|
29016
|
-
clearResizeTimers();
|
|
29017
|
-
window.removeEventListener("resize", handleResize);
|
|
29018
29215
|
};
|
|
29019
29216
|
}, [pathname, isEditMode, postToParent2]);
|
|
29020
29217
|
(0, import_react25.useEffect)(() => {
|
|
@@ -29311,6 +29508,13 @@ function OhhwellsBridge() {
|
|
|
29311
29508
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29312
29509
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29313
29510
|
if (isInsideLinkEditor(target)) return;
|
|
29511
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29512
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29513
|
+
if (target.closest(
|
|
29514
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29515
|
+
)) {
|
|
29516
|
+
return;
|
|
29517
|
+
}
|
|
29314
29518
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29315
29519
|
clearMediaSelectionRef.current();
|
|
29316
29520
|
}
|
|
@@ -29334,8 +29538,6 @@ function OhhwellsBridge() {
|
|
|
29334
29538
|
return;
|
|
29335
29539
|
}
|
|
29336
29540
|
}
|
|
29337
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29338
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29339
29541
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29340
29542
|
if (collectionItem) {
|
|
29341
29543
|
e.preventDefault();
|
|
@@ -29347,11 +29549,6 @@ function OhhwellsBridge() {
|
|
|
29347
29549
|
});
|
|
29348
29550
|
return;
|
|
29349
29551
|
}
|
|
29350
|
-
if (target.closest(
|
|
29351
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29352
|
-
)) {
|
|
29353
|
-
return;
|
|
29354
|
-
}
|
|
29355
29552
|
{
|
|
29356
29553
|
const formEl = getFormElement(target);
|
|
29357
29554
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29505,9 +29702,13 @@ function OhhwellsBridge() {
|
|
|
29505
29702
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29506
29703
|
e.preventDefault();
|
|
29507
29704
|
e.stopPropagation();
|
|
29508
|
-
selectIconElementRef.current(editable);
|
|
29509
29705
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29510
29706
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29707
|
+
if (aiIcon) {
|
|
29708
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29709
|
+
} else {
|
|
29710
|
+
selectIconElementRef.current(editable);
|
|
29711
|
+
}
|
|
29511
29712
|
postToParentRef.current({
|
|
29512
29713
|
type: "ow:icon-pick",
|
|
29513
29714
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29735,6 +29936,9 @@ function OhhwellsBridge() {
|
|
|
29735
29936
|
setHoveredItemRect(null);
|
|
29736
29937
|
hoveredNavContainerRef.current = null;
|
|
29737
29938
|
setHoveredNavContainerRect(null);
|
|
29939
|
+
siblingHintElRef.current = null;
|
|
29940
|
+
setSiblingHintRect(null);
|
|
29941
|
+
setSiblingHintRects([]);
|
|
29738
29942
|
return;
|
|
29739
29943
|
}
|
|
29740
29944
|
{
|
|
@@ -29855,7 +30059,6 @@ function OhhwellsBridge() {
|
|
|
29855
30059
|
hoveredNavContainerRef.current = null;
|
|
29856
30060
|
setHoveredNavContainerRect(null);
|
|
29857
30061
|
hoveredItemElRef.current = editable;
|
|
29858
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29859
30062
|
}
|
|
29860
30063
|
}
|
|
29861
30064
|
}
|
|
@@ -30565,7 +30768,11 @@ function OhhwellsBridge() {
|
|
|
30565
30768
|
};
|
|
30566
30769
|
const handleMouseMove = (e) => {
|
|
30567
30770
|
const { clientX, clientY } = e;
|
|
30568
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30771
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30772
|
+
dismissImageHover();
|
|
30773
|
+
clearImageHover();
|
|
30774
|
+
return;
|
|
30775
|
+
}
|
|
30569
30776
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30570
30777
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30571
30778
|
formHoverElRef.current = null;
|
|
@@ -30594,7 +30801,12 @@ function OhhwellsBridge() {
|
|
|
30594
30801
|
setHoveredItemRect(null);
|
|
30595
30802
|
hoveredNavContainerRef.current = null;
|
|
30596
30803
|
setHoveredNavContainerRect(null);
|
|
30804
|
+
siblingHintElRef.current = null;
|
|
30805
|
+
setSiblingHintRect(null);
|
|
30806
|
+
setSiblingHintRects([]);
|
|
30597
30807
|
dismissImageHover();
|
|
30808
|
+
clearImageHover();
|
|
30809
|
+
setSectionGap(null);
|
|
30598
30810
|
return;
|
|
30599
30811
|
}
|
|
30600
30812
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30606,7 +30818,11 @@ function OhhwellsBridge() {
|
|
|
30606
30818
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30607
30819
|
const { clientX, clientY } = e.data;
|
|
30608
30820
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30609
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30821
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30822
|
+
dismissImageHover();
|
|
30823
|
+
clearImageHover();
|
|
30824
|
+
return;
|
|
30825
|
+
}
|
|
30610
30826
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30611
30827
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30612
30828
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30986,6 +31202,7 @@ function OhhwellsBridge() {
|
|
|
30986
31202
|
applyAiFooterFromContent(content);
|
|
30987
31203
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30988
31204
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31205
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30989
31206
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30990
31207
|
}
|
|
30991
31208
|
applyBrandChrome(content);
|
|
@@ -31000,15 +31217,16 @@ function OhhwellsBridge() {
|
|
|
31000
31217
|
}
|
|
31001
31218
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31002
31219
|
if (key === AI_FOOTER_KEY) continue;
|
|
31220
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31221
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31003
31222
|
if (key === BRAND_KIT_KEY) continue;
|
|
31004
31223
|
if (key === STYLE_STORE_KEY) continue;
|
|
31005
31224
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31006
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31007
31225
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31008
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31009
31226
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31010
31227
|
continue;
|
|
31011
31228
|
}
|
|
31229
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31012
31230
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31013
31231
|
if (applyCarouselNode(key, val)) continue;
|
|
31014
31232
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31034,6 +31252,7 @@ function OhhwellsBridge() {
|
|
|
31034
31252
|
});
|
|
31035
31253
|
applyLinkByKey(key, val);
|
|
31036
31254
|
}
|
|
31255
|
+
applySectionEmbeds(content);
|
|
31037
31256
|
applyLogoFromContent(content);
|
|
31038
31257
|
applyLogoSizes(content);
|
|
31039
31258
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31666,6 +31885,12 @@ function OhhwellsBridge() {
|
|
|
31666
31885
|
closeLinkPopoverRef.current();
|
|
31667
31886
|
return;
|
|
31668
31887
|
}
|
|
31888
|
+
if (floatingPanelOpenRef.current) {
|
|
31889
|
+
setFloatingPanelRef.current(null);
|
|
31890
|
+
deselectRef.current();
|
|
31891
|
+
deactivateRef.current();
|
|
31892
|
+
return;
|
|
31893
|
+
}
|
|
31669
31894
|
deselectRef.current();
|
|
31670
31895
|
deactivateRef.current();
|
|
31671
31896
|
clearMediaSelectionRef.current();
|
|
@@ -32051,12 +32276,12 @@ function OhhwellsBridge() {
|
|
|
32051
32276
|
`[data-ohw-instance="${escapedSectionId}"]`
|
|
32052
32277
|
);
|
|
32053
32278
|
const foundEl = instanceEl ? sectionElementOf(instanceEl) : document.querySelector(`[data-ohw-section="${escapedSectionId}"]`);
|
|
32054
|
-
const
|
|
32055
|
-
const nodes =
|
|
32279
|
+
const sectionEl2 = foundEl && !foundEl.hasAttribute("data-ohw-ai-template-hidden") && !foundEl.hasAttribute("data-ohw-ai-removed") && !foundEl.hasAttribute("data-ohw-ai-replaced-by") ? foundEl : null;
|
|
32280
|
+
const nodes = sectionEl2 ? collectEditableNodes(void 0, sectionEl2).filter(
|
|
32056
32281
|
(n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "video-setting"].includes(n.type)
|
|
32057
|
-
).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n,
|
|
32058
|
-
const items =
|
|
32059
|
-
const box =
|
|
32282
|
+
).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl2)) : [];
|
|
32283
|
+
const items = sectionEl2 ? collectItemGroups(sectionEl2) : [];
|
|
32284
|
+
const box = sectionEl2?.getBoundingClientRect();
|
|
32060
32285
|
const rect = box ? {
|
|
32061
32286
|
top: box.top + window.scrollY,
|
|
32062
32287
|
left: box.left + window.scrollX,
|
|
@@ -32072,7 +32297,7 @@ function OhhwellsBridge() {
|
|
|
32072
32297
|
postToParentRef.current({
|
|
32073
32298
|
type: "ow:section-nodes",
|
|
32074
32299
|
sectionId,
|
|
32075
|
-
found: !!
|
|
32300
|
+
found: !!sectionEl2,
|
|
32076
32301
|
nodes,
|
|
32077
32302
|
rect,
|
|
32078
32303
|
...settings ? { settings } : {},
|
|
@@ -32080,7 +32305,7 @@ function OhhwellsBridge() {
|
|
|
32080
32305
|
// The section's repeated-item groups (cards, rows, FAQ entries) — what lets a prompt add
|
|
32081
32306
|
// or remove items on a template section without regenerating it. Empty for generated
|
|
32082
32307
|
// sections, whose items live in the tree.
|
|
32083
|
-
...
|
|
32308
|
+
...sectionEl2 && items.length ? { items } : {}
|
|
32084
32309
|
});
|
|
32085
32310
|
};
|
|
32086
32311
|
const handleCollectItems = (e) => {
|
|
@@ -32502,10 +32727,10 @@ function OhhwellsBridge() {
|
|
|
32502
32727
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32503
32728
|
window.removeEventListener("message", handleDeactivate);
|
|
32504
32729
|
window.removeEventListener("message", handleSelectNav);
|
|
32505
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32506
32730
|
window.removeEventListener("message", handleToastAction);
|
|
32507
32731
|
window.removeEventListener("message", handleFormCount);
|
|
32508
32732
|
window.removeEventListener("message", handleUiEscape);
|
|
32733
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32509
32734
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32510
32735
|
autoSaveTimers.current.clear();
|
|
32511
32736
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32799,7 +33024,7 @@ function OhhwellsBridge() {
|
|
|
32799
33024
|
postToParent2({
|
|
32800
33025
|
type: "ow:ready",
|
|
32801
33026
|
version: "1",
|
|
32802
|
-
bridgeVersion: "0.1.
|
|
33027
|
+
bridgeVersion: "0.1.168-next.447",
|
|
32803
33028
|
path: pathname,
|
|
32804
33029
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32805
33030
|
sections
|