@ohhwells/bridge 0.1.168 → 0.1.169-next.449
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 +1118 -791
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1128 -785
- 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
|
@@ -307,6 +307,19 @@ function parseSectionsFromHtml(html) {
|
|
|
307
307
|
return parseSectionsFromRoot(doc);
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
// src/lib/soft-hide.ts
|
|
311
|
+
var PREV_DISPLAY_ATTR = "data-ohw-prev-display";
|
|
312
|
+
function softHide(el) {
|
|
313
|
+
if (!el.hasAttribute(PREV_DISPLAY_ATTR)) el.setAttribute(PREV_DISPLAY_ATTR, el.style.display);
|
|
314
|
+
el.style.display = "none";
|
|
315
|
+
}
|
|
316
|
+
function softUnhide(el) {
|
|
317
|
+
const prev = el.getAttribute(PREV_DISPLAY_ATTR);
|
|
318
|
+
el.removeAttribute(PREV_DISPLAY_ATTR);
|
|
319
|
+
if (prev) el.style.display = prev;
|
|
320
|
+
else el.style.removeProperty("display");
|
|
321
|
+
}
|
|
322
|
+
|
|
310
323
|
// src/lib/section-instances.ts
|
|
311
324
|
var SECTION_ORDER_KEY = "__ohw_section_order";
|
|
312
325
|
var REMOVED_ATTR = "data-ohw-section-removed";
|
|
@@ -378,14 +391,14 @@ function syncRemovedFlags(entries) {
|
|
|
378
391
|
const removedIds = new Set(entries.filter((e) => e.removed).map((e) => e.instanceId));
|
|
379
392
|
document.querySelectorAll(`[${REMOVED_ATTR}]`).forEach((el) => {
|
|
380
393
|
if (!removedIds.has(instanceIdOf(el))) {
|
|
381
|
-
el
|
|
394
|
+
softUnhide(el);
|
|
382
395
|
el.removeAttribute(REMOVED_ATTR);
|
|
383
396
|
}
|
|
384
397
|
});
|
|
385
398
|
for (const id of removedIds) {
|
|
386
399
|
const el = findByInstanceId(id);
|
|
387
400
|
if (el) {
|
|
388
|
-
el
|
|
401
|
+
softHide(el);
|
|
389
402
|
el.setAttribute(REMOVED_ATTR, "");
|
|
390
403
|
}
|
|
391
404
|
}
|
|
@@ -457,6 +470,15 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
|
|
|
457
470
|
function newInstanceId() {
|
|
458
471
|
return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `instance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
459
472
|
}
|
|
473
|
+
function orderBeforeMove(raw, currentPath) {
|
|
474
|
+
const entries = topLevelSections().map((el, order) => ({
|
|
475
|
+
instanceId: instanceIdOf(el),
|
|
476
|
+
type: sectionTypeOf(el),
|
|
477
|
+
order,
|
|
478
|
+
pagePath: currentPath
|
|
479
|
+
}));
|
|
480
|
+
return JSON.stringify(mergePageSectionOrder(raw, currentPath, entries));
|
|
481
|
+
}
|
|
460
482
|
function getPageSectionOrderEntries(raw, currentPath) {
|
|
461
483
|
if (!raw) return [];
|
|
462
484
|
try {
|
|
@@ -1216,21 +1238,21 @@ function chromeFrom(sample) {
|
|
|
1216
1238
|
};
|
|
1217
1239
|
}
|
|
1218
1240
|
function filledPrimary(seed) {
|
|
1219
|
-
const
|
|
1220
|
-
const luminance = relativeLuminance(
|
|
1241
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1242
|
+
const luminance = relativeLuminance(paint2);
|
|
1221
1243
|
return {
|
|
1222
|
-
background: toCss({ ...
|
|
1244
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1223
1245
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1224
1246
|
borderColor: TRANSPARENT,
|
|
1225
1247
|
borderWidth: "0px"
|
|
1226
1248
|
};
|
|
1227
1249
|
}
|
|
1228
1250
|
function generatedSecondary(primary) {
|
|
1229
|
-
const
|
|
1251
|
+
const paint2 = accentColor(primary);
|
|
1230
1252
|
return {
|
|
1231
1253
|
background: TRANSPARENT,
|
|
1232
|
-
color:
|
|
1233
|
-
borderColor:
|
|
1254
|
+
color: paint2,
|
|
1255
|
+
borderColor: paint2,
|
|
1234
1256
|
borderWidth: "1px"
|
|
1235
1257
|
};
|
|
1236
1258
|
}
|
|
@@ -1243,9 +1265,9 @@ function generatedGhost(primary) {
|
|
|
1243
1265
|
};
|
|
1244
1266
|
}
|
|
1245
1267
|
function normalizeOutlineChrome(outline, primary) {
|
|
1246
|
-
const
|
|
1268
|
+
const paint2 = accentColor(primary);
|
|
1247
1269
|
const text = parseColor(outline.color);
|
|
1248
|
-
const paintRgb = parseColor(
|
|
1270
|
+
const paintRgb = parseColor(paint2);
|
|
1249
1271
|
const primaryLabel = parseColor(primary.color);
|
|
1250
1272
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1251
1273
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1254,8 +1276,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1254
1276
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1255
1277
|
return {
|
|
1256
1278
|
...outline,
|
|
1257
|
-
color:
|
|
1258
|
-
borderColor: hasBorder ?
|
|
1279
|
+
color: paint2,
|
|
1280
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1259
1281
|
};
|
|
1260
1282
|
}
|
|
1261
1283
|
function generateButtonVariants(samples) {
|
|
@@ -1674,6 +1696,8 @@ function brandTrackedFontFamily(doc, stack) {
|
|
|
1674
1696
|
}
|
|
1675
1697
|
var paintLockByEl = /* @__PURE__ */ new WeakMap();
|
|
1676
1698
|
var paintObserverByEl = /* @__PURE__ */ new WeakMap();
|
|
1699
|
+
var prePaintByEl = /* @__PURE__ */ new WeakMap();
|
|
1700
|
+
var paintedEls = /* @__PURE__ */ new Set();
|
|
1677
1701
|
var PAINT_GUARD_ATTRS = {
|
|
1678
1702
|
attributes: true,
|
|
1679
1703
|
attributeFilter: ["style", "class"]
|
|
@@ -1737,6 +1761,18 @@ function paintedTokensOf(el) {
|
|
|
1737
1761
|
}
|
|
1738
1762
|
function applyButtonStyle(el, assignment, tokens) {
|
|
1739
1763
|
const doc = el.ownerDocument;
|
|
1764
|
+
if (!prePaintByEl.has(el)) {
|
|
1765
|
+
const label = labelElement(el);
|
|
1766
|
+
const ownLabel = label && label !== el ? label : null;
|
|
1767
|
+
prePaintByEl.set(el, {
|
|
1768
|
+
style: el.getAttribute("style"),
|
|
1769
|
+
variant: el.getAttribute("data-ohw-btn-variant"),
|
|
1770
|
+
size: el.getAttribute("data-ohw-btn-size"),
|
|
1771
|
+
label: ownLabel,
|
|
1772
|
+
labelStyle: ownLabel?.getAttribute("style") ?? null
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
paintedEls.add(el);
|
|
1740
1776
|
const tracked = {
|
|
1741
1777
|
...tokens,
|
|
1742
1778
|
variants: {
|
|
@@ -1756,6 +1792,31 @@ function applyButtonStylesFromContent(doc, content) {
|
|
|
1756
1792
|
if (!el) continue;
|
|
1757
1793
|
applyButtonStyle(el, assignment, tokensFromButton(el));
|
|
1758
1794
|
}
|
|
1795
|
+
for (const el of paintedEls) {
|
|
1796
|
+
if (!el.isConnected) {
|
|
1797
|
+
paintedEls.delete(el);
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
const id = buttonId(el);
|
|
1801
|
+
if (el.ownerDocument === doc && (!id || !assignments[id])) unpaintButton(el);
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
function unpaintButton(el) {
|
|
1805
|
+
paintObserverByEl.get(el)?.disconnect();
|
|
1806
|
+
paintObserverByEl.delete(el);
|
|
1807
|
+
paintLockByEl.delete(el);
|
|
1808
|
+
paintedEls.delete(el);
|
|
1809
|
+
const before = prePaintByEl.get(el);
|
|
1810
|
+
prePaintByEl.delete(el);
|
|
1811
|
+
if (!before) return;
|
|
1812
|
+
const restore = (target, name, value) => {
|
|
1813
|
+
if (value === null) target.removeAttribute(name);
|
|
1814
|
+
else target.setAttribute(name, value);
|
|
1815
|
+
};
|
|
1816
|
+
restore(el, "style", before.style);
|
|
1817
|
+
restore(el, "data-ohw-btn-variant", before.variant);
|
|
1818
|
+
restore(el, "data-ohw-btn-size", before.size);
|
|
1819
|
+
if (before.label?.isConnected) restore(before.label, "style", before.labelStyle);
|
|
1759
1820
|
}
|
|
1760
1821
|
function withAssignment(content, id, assignment) {
|
|
1761
1822
|
return { ...readAssignments(content), [id]: assignment };
|
|
@@ -2306,6 +2367,7 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2306
2367
|
}
|
|
2307
2368
|
const snapshots = readSnapshots(content);
|
|
2308
2369
|
const collections = readCollections(content);
|
|
2370
|
+
dropUnsavedCopies(doc, snapshots, collections);
|
|
2309
2371
|
for (const collectionState of Object.values(collections)) {
|
|
2310
2372
|
const live = collectionState.members.map((id) => findButton(doc, id) ?? restoreSnapshot(doc, snapshots[id], content)).filter((el) => Boolean(el && !hidden.has(buttonId(el) ?? "")));
|
|
2311
2373
|
if (live.length === 0) continue;
|
|
@@ -2330,6 +2392,18 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2330
2392
|
for (const member of live) setButtonDragAttr(member);
|
|
2331
2393
|
}
|
|
2332
2394
|
}
|
|
2395
|
+
function dropUnsavedCopies(doc, snapshots, collections) {
|
|
2396
|
+
const stale = Array.from(doc.querySelectorAll('[data-ohw-href-key*="-copy-"]')).filter((el) => {
|
|
2397
|
+
const id = buttonId(el);
|
|
2398
|
+
return Boolean(id && /-copy-\d+-href$/.test(id) && !snapshots[id]);
|
|
2399
|
+
});
|
|
2400
|
+
for (const el of stale) {
|
|
2401
|
+
const collection = buttonCollectionOf(el);
|
|
2402
|
+
el.remove();
|
|
2403
|
+
const id = collection?.getAttribute(COLLECTION_ATTR) ?? "";
|
|
2404
|
+
if (collection && !collections[id] && listCollectionMembers(collection).length <= 1) unwrapCollection(collection);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2333
2407
|
function restoreSnapshot(doc, snapshot, content) {
|
|
2334
2408
|
if (!snapshot) return null;
|
|
2335
2409
|
const existing = findButton(doc, snapshot.id);
|
|
@@ -5783,10 +5857,10 @@ function rekeyItemClone(clone, source, sibling, group, newIndex) {
|
|
|
5783
5857
|
function setRemoved(el, removed) {
|
|
5784
5858
|
if (removed) {
|
|
5785
5859
|
el.setAttribute(ITEM_REMOVED_ATTR, "");
|
|
5786
|
-
el
|
|
5860
|
+
softHide(el);
|
|
5787
5861
|
} else if (el.hasAttribute(ITEM_REMOVED_ATTR)) {
|
|
5788
5862
|
el.removeAttribute(ITEM_REMOVED_ATTR);
|
|
5789
|
-
el
|
|
5863
|
+
softUnhide(el);
|
|
5790
5864
|
}
|
|
5791
5865
|
}
|
|
5792
5866
|
function seedState(group) {
|
|
@@ -6796,6 +6870,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6796
6870
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6797
6871
|
return target ? pricingFeatureList(target).length : 0;
|
|
6798
6872
|
}
|
|
6873
|
+
function prevailingFeatureIcon(features) {
|
|
6874
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6875
|
+
for (const row of features) {
|
|
6876
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6877
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6878
|
+
entry.count += 1;
|
|
6879
|
+
counts.set(key, entry);
|
|
6880
|
+
}
|
|
6881
|
+
let best = null;
|
|
6882
|
+
for (const entry of counts.values()) {
|
|
6883
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6884
|
+
}
|
|
6885
|
+
if (!best) return {};
|
|
6886
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6887
|
+
}
|
|
6799
6888
|
function addPricingCardFeature(tree, index, text) {
|
|
6800
6889
|
return withPricingCollection(tree, (collection) => {
|
|
6801
6890
|
const children = collection.children;
|
|
@@ -6804,7 +6893,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6804
6893
|
const features = pricingFeatureList(target);
|
|
6805
6894
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6806
6895
|
target.slots = target.slots ?? {};
|
|
6807
|
-
target.slots.features = [...features, { text }];
|
|
6896
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6808
6897
|
return true;
|
|
6809
6898
|
});
|
|
6810
6899
|
}
|
|
@@ -7448,6 +7537,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7448
7537
|
);
|
|
7449
7538
|
}
|
|
7450
7539
|
|
|
7540
|
+
// src/lib/youtube.ts
|
|
7541
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7542
|
+
function extractYouTubeId(input) {
|
|
7543
|
+
const trimmed = input.trim();
|
|
7544
|
+
if (!trimmed) return null;
|
|
7545
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7546
|
+
let url;
|
|
7547
|
+
try {
|
|
7548
|
+
url = new URL(trimmed);
|
|
7549
|
+
} catch {
|
|
7550
|
+
return null;
|
|
7551
|
+
}
|
|
7552
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7553
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7554
|
+
return null;
|
|
7555
|
+
}
|
|
7556
|
+
let candidate = null;
|
|
7557
|
+
if (host === "youtu.be") {
|
|
7558
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7559
|
+
} else if (url.pathname === "/watch") {
|
|
7560
|
+
candidate = url.searchParams.get("v");
|
|
7561
|
+
} else {
|
|
7562
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7563
|
+
candidate = match ? match[1] : null;
|
|
7564
|
+
}
|
|
7565
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7566
|
+
}
|
|
7567
|
+
|
|
7568
|
+
// src/lib/section-embed.ts
|
|
7569
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7570
|
+
function readStoredEmbed(value) {
|
|
7571
|
+
if (value.startsWith("start\n")) {
|
|
7572
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7573
|
+
}
|
|
7574
|
+
return { raw: value, at: "end" };
|
|
7575
|
+
}
|
|
7576
|
+
function embedFrameSrc(value) {
|
|
7577
|
+
const videoId = extractYouTubeId(value);
|
|
7578
|
+
if (videoId) {
|
|
7579
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7580
|
+
}
|
|
7581
|
+
let url;
|
|
7582
|
+
try {
|
|
7583
|
+
url = new URL(value);
|
|
7584
|
+
} catch {
|
|
7585
|
+
return null;
|
|
7586
|
+
}
|
|
7587
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7588
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7589
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7590
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7591
|
+
return { src, title: "Map" };
|
|
7592
|
+
}
|
|
7593
|
+
if (host === "maps.app.goo.gl") {
|
|
7594
|
+
return { src: value, title: "Map" };
|
|
7595
|
+
}
|
|
7596
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7597
|
+
return { src: value, title: "Calendar" };
|
|
7598
|
+
}
|
|
7599
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7600
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7601
|
+
}
|
|
7602
|
+
if (host === "forms.gle") {
|
|
7603
|
+
return { src: value, title: "Form" };
|
|
7604
|
+
}
|
|
7605
|
+
return null;
|
|
7606
|
+
}
|
|
7607
|
+
function place(section, box, at) {
|
|
7608
|
+
if (at === "start") {
|
|
7609
|
+
section.insertBefore(box, section.firstChild);
|
|
7610
|
+
return;
|
|
7611
|
+
}
|
|
7612
|
+
section.appendChild(box);
|
|
7613
|
+
}
|
|
7614
|
+
function paint(section, key, src, title, at) {
|
|
7615
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7616
|
+
const frame = existing?.querySelector("iframe");
|
|
7617
|
+
if (existing && frame) {
|
|
7618
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7619
|
+
frame.title = title;
|
|
7620
|
+
place(section, existing, at);
|
|
7621
|
+
return;
|
|
7622
|
+
}
|
|
7623
|
+
existing?.remove();
|
|
7624
|
+
const box = document.createElement("div");
|
|
7625
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7626
|
+
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;";
|
|
7627
|
+
const frameWrap = document.createElement("div");
|
|
7628
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7629
|
+
const iframe = document.createElement("iframe");
|
|
7630
|
+
iframe.src = src;
|
|
7631
|
+
iframe.title = title;
|
|
7632
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7633
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7634
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7635
|
+
frameWrap.appendChild(iframe);
|
|
7636
|
+
box.appendChild(frameWrap);
|
|
7637
|
+
place(section, box, at);
|
|
7638
|
+
}
|
|
7639
|
+
function applySectionEmbeds(content) {
|
|
7640
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7641
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7642
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7643
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7644
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7645
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7646
|
+
if (!section || !stored || !frame) {
|
|
7647
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7648
|
+
continue;
|
|
7649
|
+
}
|
|
7650
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7651
|
+
}
|
|
7652
|
+
}
|
|
7653
|
+
|
|
7451
7654
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7452
7655
|
var import_react_dom = require("react-dom");
|
|
7453
7656
|
var import_client = require("react-dom/client");
|
|
@@ -8021,7 +8224,7 @@ var AI_MOBILE_CSS = [
|
|
|
8021
8224
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
8022
8225
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
8023
8226
|
// 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-
|
|
8227
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
8025
8228
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
8026
8229
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
8027
8230
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8037,8 +8240,10 @@ var AI_MOBILE_CSS = [
|
|
|
8037
8240
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8038
8241
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8039
8242
|
// 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
|
-
|
|
8243
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8244
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8245
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8246
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
8042
8247
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8043
8248
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8044
8249
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8243,6 +8448,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8243
8448
|
function textAttrs(ctx, path) {
|
|
8244
8449
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8245
8450
|
}
|
|
8451
|
+
var AI_RESPONSIVE_CSS = [
|
|
8452
|
+
"@media (max-width: 960px) {",
|
|
8453
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8454
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8455
|
+
"}",
|
|
8456
|
+
"@media (max-width: 640px) {",
|
|
8457
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8458
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8459
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8460
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8461
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8462
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8463
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8464
|
+
// layered text used to be.
|
|
8465
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8466
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8467
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8468
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8469
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8470
|
+
// other rule had already been taught to stand down.
|
|
8471
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8472
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8473
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8474
|
+
"}"
|
|
8475
|
+
].join("\n");
|
|
8246
8476
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8247
8477
|
function MediaBox({
|
|
8248
8478
|
refValue,
|
|
@@ -8297,7 +8527,7 @@ function MediaBox({
|
|
|
8297
8527
|
position: fill ? "absolute" : void 0,
|
|
8298
8528
|
inset: fill ? 0 : void 0,
|
|
8299
8529
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8300
|
-
height: fill ? "100%" : void 0,
|
|
8530
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8301
8531
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8302
8532
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8303
8533
|
borderRadius: radius,
|
|
@@ -9793,7 +10023,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9793
10023
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9794
10024
|
"div",
|
|
9795
10025
|
{
|
|
9796
|
-
"data-ai-grid":
|
|
10026
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9797
10027
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9798
10028
|
style: {
|
|
9799
10029
|
display: "grid",
|
|
@@ -10095,7 +10325,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10095
10325
|
},
|
|
10096
10326
|
children: [
|
|
10097
10327
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10098
|
-
// The section's `data-ai-
|
|
10328
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
10099
10329
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10100
10330
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10101
10331
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10514,6 +10744,7 @@ function AiTreeRenderer({
|
|
|
10514
10744
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10515
10745
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10516
10746
|
...bgAttrs,
|
|
10747
|
+
"data-ai-responsive": "",
|
|
10517
10748
|
style: {
|
|
10518
10749
|
position: "relative",
|
|
10519
10750
|
padding: `${padCss} 0`,
|
|
@@ -10527,12 +10758,13 @@ function AiTreeRenderer({
|
|
|
10527
10758
|
...fillHeight ? { display: "grid" } : {}
|
|
10528
10759
|
},
|
|
10529
10760
|
children: [
|
|
10530
|
-
|
|
10761
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10531
10762
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10763
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10532
10764
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10533
10765
|
"div",
|
|
10534
10766
|
{
|
|
10535
|
-
"data-ai-
|
|
10767
|
+
"data-ai-section-inner": "",
|
|
10536
10768
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10537
10769
|
style: {
|
|
10538
10770
|
position: "relative",
|
|
@@ -10549,7 +10781,7 @@ function AiTreeRenderer({
|
|
|
10549
10781
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10550
10782
|
"div",
|
|
10551
10783
|
{
|
|
10552
|
-
"data-ai-
|
|
10784
|
+
"data-ai-columns": "",
|
|
10553
10785
|
style: {
|
|
10554
10786
|
display: "grid",
|
|
10555
10787
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11211,9 +11443,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11211
11443
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11212
11444
|
continue;
|
|
11213
11445
|
}
|
|
11214
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11215
11446
|
let container = existing?.container;
|
|
11447
|
+
let isNewMount = false;
|
|
11216
11448
|
if (!container || !container.isConnected) {
|
|
11449
|
+
isNewMount = true;
|
|
11217
11450
|
existing?.root.unmount();
|
|
11218
11451
|
container?.remove();
|
|
11219
11452
|
container = document.createElement("div");
|
|
@@ -11551,6 +11784,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11551
11784
|
return 3;
|
|
11552
11785
|
}
|
|
11553
11786
|
}
|
|
11787
|
+
function readLiveSocialItems() {
|
|
11788
|
+
const root = getFooterRoot();
|
|
11789
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11790
|
+
if (!row) return [];
|
|
11791
|
+
const items = [];
|
|
11792
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11793
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11794
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11795
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11796
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11797
|
+
items.push({ platform, href });
|
|
11798
|
+
}
|
|
11799
|
+
return items;
|
|
11800
|
+
}
|
|
11801
|
+
function syncSocialRowsFromDom(tree) {
|
|
11802
|
+
const root = getFooterRoot();
|
|
11803
|
+
if (!root) return;
|
|
11804
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11805
|
+
const live = readLiveSocialItems();
|
|
11806
|
+
if (row && live.length === 0) return;
|
|
11807
|
+
for (const col of tree.columns) {
|
|
11808
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11809
|
+
if (block.type !== "social-row") return [block];
|
|
11810
|
+
if (!row) return [];
|
|
11811
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11812
|
+
});
|
|
11813
|
+
}
|
|
11814
|
+
}
|
|
11554
11815
|
function collectBrandBlocks(tree) {
|
|
11555
11816
|
const brand = [];
|
|
11556
11817
|
for (const col of tree.columns) {
|
|
@@ -11796,6 +12057,7 @@ function textOf2(el) {
|
|
|
11796
12057
|
}
|
|
11797
12058
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11798
12059
|
const next = cloneTree(tree);
|
|
12060
|
+
syncSocialRowsFromDom(next);
|
|
11799
12061
|
const domCols = listFooterColumns().map((col) => {
|
|
11800
12062
|
const heading = getFooterColumnHeadingEl(col);
|
|
11801
12063
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -17608,7 +17870,7 @@ function apiBase() {
|
|
|
17608
17870
|
function bridgeVersion() {
|
|
17609
17871
|
try {
|
|
17610
17872
|
if (true) {
|
|
17611
|
-
return "0.1.
|
|
17873
|
+
return "0.1.169-next.449";
|
|
17612
17874
|
}
|
|
17613
17875
|
} catch {
|
|
17614
17876
|
}
|
|
@@ -17622,7 +17884,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17622
17884
|
return;
|
|
17623
17885
|
}
|
|
17624
17886
|
try {
|
|
17625
|
-
const v = true ? "0.1.
|
|
17887
|
+
const v = true ? "0.1.169-next.449" : "";
|
|
17626
17888
|
if (v) {
|
|
17627
17889
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17628
17890
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18300,6 +18562,7 @@ function MediaOverlay({
|
|
|
18300
18562
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18301
18563
|
);
|
|
18302
18564
|
}, [isVideo]);
|
|
18565
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18303
18566
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18304
18567
|
const box = {
|
|
18305
18568
|
position: "fixed",
|
|
@@ -18398,11 +18661,10 @@ function MediaOverlay({
|
|
|
18398
18661
|
className: "flex items-center justify-center cursor-pointer",
|
|
18399
18662
|
style: {
|
|
18400
18663
|
...box,
|
|
18401
|
-
//
|
|
18402
|
-
//
|
|
18403
|
-
//
|
|
18404
|
-
|
|
18405
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18664
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18665
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18666
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18667
|
+
pointerEvents: "none",
|
|
18406
18668
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18407
18669
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18408
18670
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18429,17 +18691,17 @@ function MediaOverlay({
|
|
|
18429
18691
|
},
|
|
18430
18692
|
children: [
|
|
18431
18693
|
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
|
-
|
|
18694
|
+
replaceLabel
|
|
18433
18695
|
]
|
|
18434
18696
|
}
|
|
18435
18697
|
),
|
|
18436
|
-
replaceMode
|
|
18698
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18437
18699
|
Button,
|
|
18438
18700
|
{
|
|
18439
18701
|
"data-ohw-media-overlay": "",
|
|
18440
18702
|
variant: "outline",
|
|
18441
18703
|
size: "sm",
|
|
18442
|
-
"aria-label":
|
|
18704
|
+
"aria-label": replaceLabel,
|
|
18443
18705
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18444
18706
|
style: {
|
|
18445
18707
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18462,7 +18724,7 @@ function MediaOverlay({
|
|
|
18462
18724
|
},
|
|
18463
18725
|
children: [
|
|
18464
18726
|
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" ?
|
|
18727
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18466
18728
|
]
|
|
18467
18729
|
}
|
|
18468
18730
|
)
|
|
@@ -18604,7 +18866,13 @@ function highlightChangedElements(keys, item, sectionId) {
|
|
|
18604
18866
|
clearTimer = setTimeout(clearChangeHighlight, HIGHLIGHT_MS);
|
|
18605
18867
|
return targets.length;
|
|
18606
18868
|
}
|
|
18607
|
-
function
|
|
18869
|
+
function highlightedRect() {
|
|
18870
|
+
const first = document.querySelector(`[${MARK_ATTR}]`);
|
|
18871
|
+
if (!first) return null;
|
|
18872
|
+
const rect = first.getBoundingClientRect();
|
|
18873
|
+
return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
|
|
18874
|
+
}
|
|
18875
|
+
function installAiChangeHighlight(select) {
|
|
18608
18876
|
const onMessage = (e) => {
|
|
18609
18877
|
const data = e.data;
|
|
18610
18878
|
if (data?.type !== "ow:ai-highlight") return;
|
|
@@ -18613,12 +18881,37 @@ function installAiChangeHighlight() {
|
|
|
18613
18881
|
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;
|
|
18614
18882
|
const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
|
|
18615
18883
|
const found = highlightChangedElements(keys, item, sectionId);
|
|
18616
|
-
|
|
18884
|
+
const first = data.select === true ? document.querySelector(`[${MARK_ATTR}]`) : null;
|
|
18885
|
+
if (first) select?.(first);
|
|
18886
|
+
const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
|
|
18887
|
+
window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
|
|
18617
18888
|
};
|
|
18618
18889
|
window.addEventListener("message", onMessage);
|
|
18619
18890
|
return () => window.removeEventListener("message", onMessage);
|
|
18620
18891
|
}
|
|
18621
18892
|
|
|
18893
|
+
// src/lib/history-key-relay.ts
|
|
18894
|
+
var isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent);
|
|
18895
|
+
function historyActionFor(e, mac = isMac()) {
|
|
18896
|
+
const mod = mac ? e.metaKey : e.ctrlKey;
|
|
18897
|
+
if (!mod || e.altKey) return null;
|
|
18898
|
+
const key = e.key.toLowerCase();
|
|
18899
|
+
if (key === "z") return e.shiftKey ? "redo" : "undo";
|
|
18900
|
+
if (key === "y" && !mac) return "redo";
|
|
18901
|
+
return null;
|
|
18902
|
+
}
|
|
18903
|
+
var isEditingText = (el) => !!el && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLElement && el.isContentEditable);
|
|
18904
|
+
function installHistoryKeyRelay() {
|
|
18905
|
+
const onKeyDown = (e) => {
|
|
18906
|
+
const action = historyActionFor(e);
|
|
18907
|
+
if (!action || isEditingText(document.activeElement)) return;
|
|
18908
|
+
e.preventDefault();
|
|
18909
|
+
window.parent?.postMessage({ type: "ow:history-key", action }, "*");
|
|
18910
|
+
};
|
|
18911
|
+
window.addEventListener("keydown", onKeyDown);
|
|
18912
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
18913
|
+
}
|
|
18914
|
+
|
|
18622
18915
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18623
18916
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
18624
18917
|
var findSectionElement = findByInstanceId;
|
|
@@ -18871,7 +19164,8 @@ function AiSectionOverlay({
|
|
|
18871
19164
|
window.addEventListener("message", onMessage);
|
|
18872
19165
|
return () => window.removeEventListener("message", onMessage);
|
|
18873
19166
|
}, [postToParent2]);
|
|
18874
|
-
(0, import_react12.useEffect)(() => installAiChangeHighlight(), []);
|
|
19167
|
+
(0, import_react12.useEffect)(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
|
|
19168
|
+
(0, import_react12.useEffect)(() => installHistoryKeyRelay(), []);
|
|
18875
19169
|
const [hoveredId, setHoveredId] = (0, import_react12.useState)(null);
|
|
18876
19170
|
(0, import_react12.useEffect)(() => {
|
|
18877
19171
|
const onMove = (e) => {
|
|
@@ -19062,7 +19356,7 @@ function AiSectionOverlay({
|
|
|
19062
19356
|
|
|
19063
19357
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19064
19358
|
var import_react13 = require("react");
|
|
19065
|
-
var
|
|
19359
|
+
var import_lucide_react9 = require("lucide-react");
|
|
19066
19360
|
|
|
19067
19361
|
// src/lib/ai-media-strip-tree.ts
|
|
19068
19362
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19176,14 +19470,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19176
19470
|
return true;
|
|
19177
19471
|
});
|
|
19178
19472
|
}
|
|
19179
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19180
|
-
return withMediaStrip(tree, (block) => {
|
|
19181
|
-
const items = block.items;
|
|
19182
|
-
if (index < 0 || index >= items.length) return false;
|
|
19183
|
-
items[index] = { ...items[index], alt };
|
|
19184
|
-
return true;
|
|
19185
|
-
});
|
|
19186
|
-
}
|
|
19187
19473
|
function setMediaStripItemLink(tree, index, link) {
|
|
19188
19474
|
return withMediaStrip(tree, (block) => {
|
|
19189
19475
|
const items = block.items;
|
|
@@ -19201,11 +19487,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19201
19487
|
});
|
|
19202
19488
|
}
|
|
19203
19489
|
|
|
19204
|
-
// src/ui/
|
|
19490
|
+
// src/ui/dialog.tsx
|
|
19491
|
+
var React9 = __toESM(require("react"), 1);
|
|
19492
|
+
var import_radix_ui6 = require("radix-ui");
|
|
19493
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19205
19494
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19206
|
-
|
|
19207
|
-
|
|
19208
|
-
|
|
19495
|
+
function Dialog2({
|
|
19496
|
+
...props
|
|
19497
|
+
}) {
|
|
19498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19499
|
+
}
|
|
19500
|
+
function DialogPortal({
|
|
19501
|
+
...props
|
|
19502
|
+
}) {
|
|
19503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19504
|
+
}
|
|
19505
|
+
function DialogOverlay({
|
|
19506
|
+
className,
|
|
19507
|
+
...props
|
|
19508
|
+
}) {
|
|
19509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19510
|
+
import_radix_ui6.Dialog.Overlay,
|
|
19511
|
+
{
|
|
19512
|
+
"data-slot": "dialog-overlay",
|
|
19513
|
+
"data-ohw-link-modal-root": "",
|
|
19514
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19515
|
+
...props
|
|
19516
|
+
}
|
|
19517
|
+
);
|
|
19518
|
+
}
|
|
19519
|
+
var DialogContent = React9.forwardRef(
|
|
19520
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19521
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19523
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19524
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19525
|
+
import_radix_ui6.Dialog.Content,
|
|
19526
|
+
{
|
|
19527
|
+
ref,
|
|
19528
|
+
"data-slot": "dialog-content",
|
|
19529
|
+
className: cn(
|
|
19530
|
+
positionMode,
|
|
19531
|
+
"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",
|
|
19532
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19533
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19534
|
+
className
|
|
19535
|
+
),
|
|
19536
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19537
|
+
...props,
|
|
19538
|
+
children: [
|
|
19539
|
+
children,
|
|
19540
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19541
|
+
import_radix_ui6.Dialog.Close,
|
|
19542
|
+
{
|
|
19543
|
+
type: "button",
|
|
19544
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19545
|
+
"aria-label": "Close",
|
|
19546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19547
|
+
}
|
|
19548
|
+
) : null
|
|
19549
|
+
]
|
|
19550
|
+
}
|
|
19551
|
+
)
|
|
19552
|
+
] });
|
|
19553
|
+
}
|
|
19554
|
+
);
|
|
19555
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19556
|
+
function DialogHeader({
|
|
19557
|
+
className,
|
|
19558
|
+
...props
|
|
19559
|
+
}) {
|
|
19560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19561
|
+
}
|
|
19562
|
+
function DialogFooter({
|
|
19563
|
+
className,
|
|
19564
|
+
...props
|
|
19565
|
+
}) {
|
|
19566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19567
|
+
"div",
|
|
19568
|
+
{
|
|
19569
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19570
|
+
...props
|
|
19571
|
+
}
|
|
19572
|
+
);
|
|
19573
|
+
}
|
|
19574
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19575
|
+
import_radix_ui6.Dialog.Title,
|
|
19576
|
+
{
|
|
19577
|
+
ref,
|
|
19578
|
+
className: cn(
|
|
19579
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19580
|
+
className
|
|
19581
|
+
),
|
|
19582
|
+
...props
|
|
19583
|
+
}
|
|
19584
|
+
));
|
|
19585
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19586
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19587
|
+
import_radix_ui6.Dialog.Description,
|
|
19588
|
+
{
|
|
19589
|
+
ref,
|
|
19590
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19591
|
+
...props
|
|
19592
|
+
}
|
|
19593
|
+
));
|
|
19594
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19595
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19596
|
+
|
|
19597
|
+
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19598
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
19599
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19600
|
+
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]";
|
|
19209
19601
|
function findMediaStripItemElement(sectionId, index) {
|
|
19210
19602
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19211
19603
|
if (!sectionEl2) return null;
|
|
@@ -19215,14 +19607,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19215
19607
|
}
|
|
19216
19608
|
return null;
|
|
19217
19609
|
}
|
|
19218
|
-
function
|
|
19219
|
-
|
|
19610
|
+
function itemRefFromTarget(target) {
|
|
19611
|
+
if (!(target instanceof Element)) return null;
|
|
19612
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19613
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19614
|
+
if (!itemEl) return null;
|
|
19615
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19616
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19617
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19618
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19619
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19620
|
+
return { sectionId, index };
|
|
19621
|
+
}
|
|
19622
|
+
function sameRef(a, b) {
|
|
19623
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19624
|
+
}
|
|
19625
|
+
function rectOf(el) {
|
|
19220
19626
|
if (!el) return null;
|
|
19221
19627
|
const r2 = el.getBoundingClientRect();
|
|
19222
19628
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19223
19629
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19224
19630
|
}
|
|
19225
|
-
function
|
|
19631
|
+
function readRect2(ref) {
|
|
19632
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19633
|
+
}
|
|
19634
|
+
function readStripRect(ref) {
|
|
19635
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19636
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19637
|
+
}
|
|
19638
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19226
19639
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
19227
19640
|
(0, import_react13.useEffect)(() => {
|
|
19228
19641
|
if (!ref) {
|
|
@@ -19230,7 +19643,7 @@ function useLiveItemRect(ref) {
|
|
|
19230
19643
|
return;
|
|
19231
19644
|
}
|
|
19232
19645
|
const update = () => {
|
|
19233
|
-
const next = readRect2(ref);
|
|
19646
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19234
19647
|
setRect(
|
|
19235
19648
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19236
19649
|
);
|
|
@@ -19245,37 +19658,77 @@ function useLiveItemRect(ref) {
|
|
|
19245
19658
|
window.removeEventListener("resize", update);
|
|
19246
19659
|
clearInterval(interval);
|
|
19247
19660
|
};
|
|
19248
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19661
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19249
19662
|
return rect;
|
|
19250
19663
|
}
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
}
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19664
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19665
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19666
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19667
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19668
|
+
const slotRef = (0, import_react13.useRef)(null);
|
|
19669
|
+
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
19670
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19671
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
19672
|
+
const slot = slotRef.current;
|
|
19673
|
+
if (!slot) return;
|
|
19674
|
+
const clamp = () => {
|
|
19675
|
+
const w = slot.offsetWidth;
|
|
19676
|
+
if (w <= 0) return;
|
|
19677
|
+
const half = w / 2;
|
|
19678
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19679
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19680
|
+
};
|
|
19681
|
+
clamp();
|
|
19682
|
+
const ro = new ResizeObserver(clamp);
|
|
19683
|
+
ro.observe(slot);
|
|
19684
|
+
return () => ro.disconnect();
|
|
19685
|
+
}, [centerX, children]);
|
|
19686
|
+
const mobile = window.innerWidth <= 480;
|
|
19687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19688
|
+
"div",
|
|
19689
|
+
{
|
|
19690
|
+
ref: slotRef,
|
|
19691
|
+
"data-ohw-bridge": "",
|
|
19692
|
+
"data-ohw-item-interaction": "",
|
|
19693
|
+
className: "pointer-events-auto fixed",
|
|
19694
|
+
style: {
|
|
19695
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19696
|
+
left: centerX + shift,
|
|
19697
|
+
transform: "translate(-50%, -100%)",
|
|
19698
|
+
zIndex: 2147483645
|
|
19699
|
+
},
|
|
19700
|
+
children
|
|
19701
|
+
}
|
|
19702
|
+
);
|
|
19703
|
+
}
|
|
19704
|
+
function requestValidateTree(postToParent2, tree) {
|
|
19705
|
+
return new Promise((resolve) => {
|
|
19706
|
+
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
19707
|
+
const timeout = window.setTimeout(() => {
|
|
19708
|
+
window.removeEventListener("message", onMessage);
|
|
19709
|
+
resolve({ ok: false, reasons: ["Validation request timed out."] });
|
|
19710
|
+
}, 8e3);
|
|
19711
|
+
function onMessage(e) {
|
|
19712
|
+
if (e.data?.type !== "ow:ai-validate-tree-result" || e.data.id !== id) return;
|
|
19713
|
+
window.clearTimeout(timeout);
|
|
19714
|
+
window.removeEventListener("message", onMessage);
|
|
19715
|
+
resolve({ ok: e.data.ok === true, reasons: Array.isArray(e.data.reasons) ? e.data.reasons : [] });
|
|
19716
|
+
}
|
|
19717
|
+
window.addEventListener("message", onMessage);
|
|
19718
|
+
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
19719
|
+
});
|
|
19720
|
+
}
|
|
19721
|
+
function requestAssetPick(postToParent2) {
|
|
19722
|
+
return new Promise((resolve) => {
|
|
19723
|
+
const id = `ai-asset-pick-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
19724
|
+
const timeout = window.setTimeout(() => {
|
|
19725
|
+
window.removeEventListener("message", onMessage);
|
|
19726
|
+
resolve(null);
|
|
19727
|
+
}, 3e5);
|
|
19728
|
+
function onMessage(e) {
|
|
19729
|
+
if (e.data?.type !== "ow:asset-picked" || e.data.id !== id) return;
|
|
19730
|
+
window.clearTimeout(timeout);
|
|
19731
|
+
window.removeEventListener("message", onMessage);
|
|
19279
19732
|
resolve(
|
|
19280
19733
|
typeof e.data.assetId === "string" && typeof e.data.url === "string" ? { assetId: e.data.assetId, url: e.data.url } : null
|
|
19281
19734
|
);
|
|
@@ -19284,116 +19737,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19284
19737
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19285
19738
|
});
|
|
19286
19739
|
}
|
|
19287
|
-
function
|
|
19740
|
+
function ToolbarAction({
|
|
19288
19741
|
label,
|
|
19289
19742
|
onClick,
|
|
19290
|
-
disabled,
|
|
19291
|
-
active
|
|
19743
|
+
disabled = false,
|
|
19744
|
+
active = false,
|
|
19745
|
+
children
|
|
19292
19746
|
}) {
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
{
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
disabled,
|
|
19299
|
-
style: {
|
|
19300
|
-
height: 28,
|
|
19301
|
-
padding: "0 10px",
|
|
19302
|
-
display: "inline-flex",
|
|
19303
|
-
alignItems: "center",
|
|
19304
|
-
gap: 4,
|
|
19305
|
-
borderRadius: 999,
|
|
19306
|
-
border: "none",
|
|
19307
|
-
cursor: disabled ? "default" : "pointer",
|
|
19308
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19309
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19310
|
-
opacity: disabled ? 0.4 : 1,
|
|
19311
|
-
fontSize: 12,
|
|
19312
|
-
lineHeight: "16px",
|
|
19313
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19314
|
-
whiteSpace: "nowrap",
|
|
19315
|
-
flex: "0 0 auto"
|
|
19316
|
-
},
|
|
19317
|
-
children: label
|
|
19318
|
-
}
|
|
19319
|
-
);
|
|
19747
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19749
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
19750
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19751
|
+
] });
|
|
19320
19752
|
}
|
|
19321
|
-
function
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
|
|
19347
|
-
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
},
|
|
19351
|
-
children: "Alt"
|
|
19352
|
-
}
|
|
19353
|
-
),
|
|
19354
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19355
|
-
"input",
|
|
19753
|
+
function ToolbarSeparator() {
|
|
19754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19755
|
+
}
|
|
19756
|
+
function OptionMenu({
|
|
19757
|
+
label,
|
|
19758
|
+
value,
|
|
19759
|
+
options,
|
|
19760
|
+
onChange
|
|
19761
|
+
}) {
|
|
19762
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19764
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19765
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
19766
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19767
|
+
"button",
|
|
19768
|
+
{
|
|
19769
|
+
type: "button",
|
|
19770
|
+
"aria-label": label,
|
|
19771
|
+
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",
|
|
19772
|
+
children: [
|
|
19773
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
19774
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
19775
|
+
]
|
|
19776
|
+
}
|
|
19777
|
+
) }),
|
|
19778
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19779
|
+
const selected = option.value === value;
|
|
19780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19781
|
+
DropdownMenuItem,
|
|
19356
19782
|
{
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
"aria-label": "Image alt text",
|
|
19372
|
-
style: {
|
|
19373
|
-
flex: 1,
|
|
19374
|
-
minWidth: 0,
|
|
19375
|
-
border: "none",
|
|
19376
|
-
outline: "none",
|
|
19377
|
-
background: "transparent",
|
|
19378
|
-
fontSize: 12,
|
|
19379
|
-
lineHeight: "16px",
|
|
19380
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19381
|
-
color: "#1f2937"
|
|
19382
|
-
}
|
|
19383
|
-
}
|
|
19384
|
-
)
|
|
19385
|
-
]
|
|
19386
|
-
}
|
|
19387
|
-
);
|
|
19783
|
+
role: "menuitemradio",
|
|
19784
|
+
"aria-checked": selected,
|
|
19785
|
+
onSelect: () => onChange(option.value),
|
|
19786
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19787
|
+
children: [
|
|
19788
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
|
|
19789
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
19790
|
+
]
|
|
19791
|
+
},
|
|
19792
|
+
option.value
|
|
19793
|
+
);
|
|
19794
|
+
}) })
|
|
19795
|
+
] })
|
|
19796
|
+
] });
|
|
19388
19797
|
}
|
|
19389
19798
|
var VARIANTS = [
|
|
19390
19799
|
{ value: "logos", label: "Logos" },
|
|
19391
19800
|
{ value: "reel", label: "Reel" }
|
|
19392
19801
|
];
|
|
19393
19802
|
var ALIGNS = [
|
|
19394
|
-
{ value: "left", label: "
|
|
19395
|
-
{ value: "center", label: "
|
|
19396
|
-
{ value: "right", label: "
|
|
19803
|
+
{ value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
|
|
19804
|
+
{ value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
|
|
19805
|
+
{ value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
|
|
19397
19806
|
];
|
|
19398
19807
|
var HOVERS = [
|
|
19399
19808
|
{ value: "none", label: "None" },
|
|
@@ -19401,104 +19810,104 @@ var HOVERS = [
|
|
|
19401
19810
|
{ value: "zoom", label: "Zoom" },
|
|
19402
19811
|
{ value: "fade", label: "Fade" }
|
|
19403
19812
|
];
|
|
19404
|
-
var TREATMENTS = [
|
|
19405
|
-
{ value: "color", label: "Color" },
|
|
19406
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19407
|
-
];
|
|
19408
19813
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19409
|
-
function
|
|
19410
|
-
|
|
19814
|
+
function LinkModal({
|
|
19815
|
+
href,
|
|
19816
|
+
linkTarget,
|
|
19817
|
+
onClose,
|
|
19818
|
+
onSave
|
|
19819
|
+
}) {
|
|
19820
|
+
const [draft, setDraft] = (0, import_react13.useState)(href);
|
|
19821
|
+
const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
|
|
19411
19822
|
const [invalid, setInvalid] = (0, import_react13.useState)(false);
|
|
19412
|
-
|
|
19413
|
-
setDraft(value);
|
|
19414
|
-
setInvalid(false);
|
|
19415
|
-
}, [value]);
|
|
19416
|
-
const commit2 = () => {
|
|
19823
|
+
const save = () => {
|
|
19417
19824
|
const next = draft.trim();
|
|
19418
|
-
if (next
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
onCommit(next);
|
|
19422
|
-
};
|
|
19423
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19424
|
-
"div",
|
|
19425
|
-
{
|
|
19426
|
-
style: {
|
|
19427
|
-
display: "flex",
|
|
19428
|
-
alignItems: "center",
|
|
19429
|
-
gap: 6,
|
|
19430
|
-
height: 28,
|
|
19431
|
-
padding: "0 12px",
|
|
19432
|
-
borderRadius: 999,
|
|
19433
|
-
background: "#ffffff",
|
|
19434
|
-
width: "100%",
|
|
19435
|
-
maxWidth: 260,
|
|
19436
|
-
boxSizing: "border-box",
|
|
19437
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19438
|
-
},
|
|
19439
|
-
children: [
|
|
19440
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19441
|
-
"span",
|
|
19442
|
-
{
|
|
19443
|
-
style: {
|
|
19444
|
-
flex: "0 0 auto",
|
|
19445
|
-
color: OHW_BLUE_DARK,
|
|
19446
|
-
fontSize: 10,
|
|
19447
|
-
fontWeight: 700,
|
|
19448
|
-
textTransform: "uppercase",
|
|
19449
|
-
letterSpacing: 0.4
|
|
19450
|
-
},
|
|
19451
|
-
children: "Link"
|
|
19452
|
-
}
|
|
19453
|
-
),
|
|
19454
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19455
|
-
"input",
|
|
19456
|
-
{
|
|
19457
|
-
type: "text",
|
|
19458
|
-
inputMode: "url",
|
|
19459
|
-
value: draft,
|
|
19460
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19461
|
-
onBlur: commit2,
|
|
19462
|
-
onKeyDown: (e) => {
|
|
19463
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19464
|
-
if (e.key === "Escape") {
|
|
19465
|
-
setDraft(value);
|
|
19466
|
-
setInvalid(false);
|
|
19467
|
-
e.currentTarget.blur();
|
|
19468
|
-
}
|
|
19469
|
-
},
|
|
19470
|
-
placeholder: "https://example.com",
|
|
19471
|
-
"aria-label": "Image link URL",
|
|
19472
|
-
"aria-invalid": invalid,
|
|
19473
|
-
style: {
|
|
19474
|
-
flex: 1,
|
|
19475
|
-
minWidth: 0,
|
|
19476
|
-
border: "none",
|
|
19477
|
-
outline: "none",
|
|
19478
|
-
background: "transparent",
|
|
19479
|
-
fontSize: 12,
|
|
19480
|
-
lineHeight: "16px",
|
|
19481
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19482
|
-
color: "#1f2937"
|
|
19483
|
-
}
|
|
19484
|
-
}
|
|
19485
|
-
)
|
|
19486
|
-
]
|
|
19825
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19826
|
+
setInvalid(true);
|
|
19827
|
+
return;
|
|
19487
19828
|
}
|
|
19488
|
-
|
|
19829
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19830
|
+
onClose();
|
|
19831
|
+
};
|
|
19832
|
+
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: [
|
|
19833
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19834
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
19835
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19836
|
+
"input",
|
|
19837
|
+
{
|
|
19838
|
+
autoFocus: true,
|
|
19839
|
+
type: "text",
|
|
19840
|
+
inputMode: "url",
|
|
19841
|
+
value: draft,
|
|
19842
|
+
onChange: (e) => {
|
|
19843
|
+
setDraft(e.target.value);
|
|
19844
|
+
setInvalid(false);
|
|
19845
|
+
},
|
|
19846
|
+
onKeyDown: (e) => {
|
|
19847
|
+
if (e.key === "Enter") save();
|
|
19848
|
+
},
|
|
19849
|
+
placeholder: "https://example.com",
|
|
19850
|
+
"aria-label": "Image link URL",
|
|
19851
|
+
"aria-invalid": invalid,
|
|
19852
|
+
className: cn(
|
|
19853
|
+
"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",
|
|
19854
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19855
|
+
)
|
|
19856
|
+
}
|
|
19857
|
+
),
|
|
19858
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19859
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19860
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19861
|
+
"Open in new tab"
|
|
19862
|
+
] })
|
|
19863
|
+
] }),
|
|
19864
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
|
|
19865
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19866
|
+
"button",
|
|
19867
|
+
{
|
|
19868
|
+
type: "button",
|
|
19869
|
+
onClick: () => {
|
|
19870
|
+
onSave("", "new-tab");
|
|
19871
|
+
onClose();
|
|
19872
|
+
},
|
|
19873
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19874
|
+
children: "Remove link"
|
|
19875
|
+
}
|
|
19876
|
+
),
|
|
19877
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19878
|
+
"button",
|
|
19879
|
+
{
|
|
19880
|
+
type: "button",
|
|
19881
|
+
onClick: onClose,
|
|
19882
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19883
|
+
children: "Cancel"
|
|
19884
|
+
}
|
|
19885
|
+
),
|
|
19886
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19887
|
+
"button",
|
|
19888
|
+
{
|
|
19889
|
+
type: "button",
|
|
19890
|
+
onClick: save,
|
|
19891
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19892
|
+
children: "Save"
|
|
19893
|
+
}
|
|
19894
|
+
)
|
|
19895
|
+
] })
|
|
19896
|
+
] }) });
|
|
19489
19897
|
}
|
|
19490
19898
|
function MediaStripToolbar({
|
|
19491
19899
|
entry,
|
|
19492
19900
|
index,
|
|
19493
19901
|
pending,
|
|
19494
19902
|
error,
|
|
19903
|
+
itemEditOn,
|
|
19904
|
+
onToggleItemEdit,
|
|
19495
19905
|
onSetVariant,
|
|
19496
19906
|
onSetAlign,
|
|
19497
19907
|
onSetHover,
|
|
19498
19908
|
onSetTreatment,
|
|
19499
19909
|
onResize,
|
|
19500
|
-
|
|
19501
|
-
onSetLink,
|
|
19910
|
+
onOpenLink,
|
|
19502
19911
|
onAddItem,
|
|
19503
19912
|
onRemoveItem,
|
|
19504
19913
|
onChangeImage,
|
|
@@ -19507,81 +19916,102 @@ function MediaStripToolbar({
|
|
|
19507
19916
|
}) {
|
|
19508
19917
|
const items = mediaStripItems(entry.tree);
|
|
19509
19918
|
const itemCount = items.length;
|
|
19510
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19511
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19512
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19513
19919
|
const slots = findMediaStripSlots(entry.tree);
|
|
19514
19920
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19515
19921
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19516
19922
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19517
19923
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19518
19924
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19519
|
-
const
|
|
19520
|
-
const
|
|
19521
|
-
|
|
19522
|
-
gap: 6,
|
|
19523
|
-
flexWrap: "nowrap",
|
|
19524
|
-
justifyContent: "center",
|
|
19525
|
-
overflowX: "auto",
|
|
19526
|
-
WebkitOverflowScrolling: "touch",
|
|
19527
|
-
width: "100%",
|
|
19528
|
-
scrollbarWidth: "none"
|
|
19529
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19530
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19925
|
+
const mobile = window.innerWidth <= 480;
|
|
19926
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19531
19928
|
"div",
|
|
19532
19929
|
{
|
|
19533
19930
|
"data-ohw-bridge": "",
|
|
19534
19931
|
"data-ohw-toolbar": "",
|
|
19535
19932
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
flexDirection: "column",
|
|
19539
|
-
gap: 6,
|
|
19540
|
-
alignItems: "center",
|
|
19541
|
-
background: OHW_BLUE,
|
|
19542
|
-
padding: 8,
|
|
19543
|
-
borderRadius: 12,
|
|
19544
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19545
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19546
|
-
opacity: pending ? 0.6 : 1,
|
|
19547
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19548
|
-
},
|
|
19933
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19934
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19549
19935
|
children: [
|
|
19550
|
-
/* @__PURE__ */ (0,
|
|
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
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19936
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19937
|
+
"div",
|
|
19938
|
+
{
|
|
19939
|
+
className: cn(
|
|
19940
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19941
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19942
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19943
|
+
),
|
|
19944
|
+
children: [
|
|
19945
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19946
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19947
|
+
CustomToolbarButton,
|
|
19948
|
+
{
|
|
19949
|
+
type: "button",
|
|
19950
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19951
|
+
"aria-pressed": itemEditOn,
|
|
19952
|
+
onClick: onToggleItemEdit,
|
|
19953
|
+
className: "group size-8",
|
|
19954
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19955
|
+
import_lucide_react9.Star,
|
|
19956
|
+
{
|
|
19957
|
+
size: 16,
|
|
19958
|
+
fill: "currentColor",
|
|
19959
|
+
strokeWidth: 0,
|
|
19960
|
+
className: cn(
|
|
19961
|
+
"transition-colors",
|
|
19962
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19963
|
+
),
|
|
19964
|
+
style: { pointerEvents: "none" }
|
|
19965
|
+
}
|
|
19966
|
+
)
|
|
19967
|
+
}
|
|
19968
|
+
) }),
|
|
19969
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19970
|
+
] }),
|
|
19971
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19972
|
+
/* @__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" } }) }),
|
|
19973
|
+
/* @__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" } }) }),
|
|
19974
|
+
/* @__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" } }) }),
|
|
19975
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19976
|
+
ToolbarAction,
|
|
19977
|
+
{
|
|
19978
|
+
label: gatedLabel("Move right"),
|
|
19979
|
+
onClick: onMoveRight,
|
|
19980
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19981
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
19982
|
+
}
|
|
19983
|
+
),
|
|
19984
|
+
/* @__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" } }) }),
|
|
19985
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19986
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19987
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19988
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19989
|
+
ToolbarAction,
|
|
19990
|
+
{
|
|
19991
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19992
|
+
active: treatment === "grayscale",
|
|
19993
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19994
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19995
|
+
}
|
|
19996
|
+
),
|
|
19997
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19998
|
+
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)),
|
|
19999
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20000
|
+
/* @__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" } }) }),
|
|
20001
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
20002
|
+
sizeValue,
|
|
20003
|
+
"px"
|
|
20004
|
+
] }),
|
|
20005
|
+
/* @__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" } }) }),
|
|
20006
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20007
|
+
/* @__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" } }) })
|
|
20008
|
+
]
|
|
20009
|
+
}
|
|
20010
|
+
),
|
|
20011
|
+
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 })
|
|
19582
20012
|
]
|
|
19583
20013
|
}
|
|
19584
|
-
);
|
|
20014
|
+
) });
|
|
19585
20015
|
}
|
|
19586
20016
|
function findMediaStripSlots(tree) {
|
|
19587
20017
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19600,31 +20030,23 @@ function AiMediaStripOverlay({
|
|
|
19600
20030
|
}) {
|
|
19601
20031
|
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
19602
20032
|
const [active, setActive] = (0, import_react13.useState)(null);
|
|
20033
|
+
const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
|
|
20034
|
+
const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
|
|
19603
20035
|
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
19604
20036
|
const [error, setError] = (0, import_react13.useState)(null);
|
|
19605
20037
|
const activeRef = (0, import_react13.useRef)(null);
|
|
19606
20038
|
activeRef.current = active;
|
|
20039
|
+
const linkOpenRef = (0, import_react13.useRef)(false);
|
|
20040
|
+
linkOpenRef.current = linkOpen;
|
|
19607
20041
|
(0, import_react13.useEffect)(() => {
|
|
19608
20042
|
const onMove = (e) => {
|
|
20043
|
+
const ref = itemRefFromTarget(e.target);
|
|
19609
20044
|
const t = e.target;
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
if (!itemEl) {
|
|
19616
|
-
setHover(null);
|
|
19617
|
-
return;
|
|
19618
|
-
}
|
|
19619
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19620
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19621
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19622
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19623
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19624
|
-
setHover(null);
|
|
19625
|
-
return;
|
|
19626
|
-
}
|
|
19627
|
-
setHover({ sectionId, index });
|
|
20045
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
20046
|
+
setHover((prev) => {
|
|
20047
|
+
const next = ref && !overEditable ? ref : null;
|
|
20048
|
+
return sameRef(prev, next) ? prev : next;
|
|
20049
|
+
});
|
|
19628
20050
|
};
|
|
19629
20051
|
const onLeave = () => setHover(null);
|
|
19630
20052
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19636,23 +20058,25 @@ function AiMediaStripOverlay({
|
|
|
19636
20058
|
}, []);
|
|
19637
20059
|
(0, import_react13.useEffect)(() => {
|
|
19638
20060
|
const onClick = (e) => {
|
|
19639
|
-
const current = activeRef.current;
|
|
19640
|
-
if (!current) return;
|
|
19641
20061
|
const t = e.target;
|
|
19642
|
-
if (!(t instanceof
|
|
19643
|
-
if (t.closest(
|
|
19644
|
-
const
|
|
19645
|
-
if (
|
|
19646
|
-
|
|
20062
|
+
if (!(t instanceof Element)) return;
|
|
20063
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
20064
|
+
const ref = itemRefFromTarget(t);
|
|
20065
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
20066
|
+
if (ref) clearInteractionChromeRef.current();
|
|
20067
|
+
setItemEditOn(false);
|
|
19647
20068
|
setError(null);
|
|
20069
|
+
setActive(ref);
|
|
19648
20070
|
};
|
|
19649
20071
|
document.addEventListener("click", onClick, true);
|
|
19650
20072
|
return () => document.removeEventListener("click", onClick, true);
|
|
19651
|
-
}, []);
|
|
20073
|
+
}, [clearInteractionChromeRef]);
|
|
19652
20074
|
(0, import_react13.useEffect)(() => {
|
|
19653
20075
|
const onBlur = () => {
|
|
19654
20076
|
if (!activeRef.current) return;
|
|
19655
20077
|
setActive(null);
|
|
20078
|
+
setItemEditOn(false);
|
|
20079
|
+
setLinkOpen(false);
|
|
19656
20080
|
setError(null);
|
|
19657
20081
|
};
|
|
19658
20082
|
window.addEventListener("blur", onBlur);
|
|
@@ -19662,7 +20086,10 @@ function AiMediaStripOverlay({
|
|
|
19662
20086
|
const onKeyDown = (e) => {
|
|
19663
20087
|
if (e.key !== "Escape") return;
|
|
19664
20088
|
if (!activeRef.current) return;
|
|
20089
|
+
if (linkOpenRef.current) return;
|
|
20090
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19665
20091
|
setActive(null);
|
|
20092
|
+
setItemEditOn(false);
|
|
19666
20093
|
setError(null);
|
|
19667
20094
|
};
|
|
19668
20095
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19696,137 +20123,133 @@ function AiMediaStripOverlay({
|
|
|
19696
20123
|
tree: nextTree,
|
|
19697
20124
|
label: entry.label,
|
|
19698
20125
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19699
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20126
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
20127
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20128
|
+
// on every edit reads as the section jumping around.
|
|
20129
|
+
skipScrollIntoView: true
|
|
19700
20130
|
});
|
|
19701
20131
|
return true;
|
|
19702
20132
|
},
|
|
19703
20133
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19704
20134
|
);
|
|
19705
20135
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19706
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19707
20136
|
const activeItemRect = useLiveItemRect(active);
|
|
19708
|
-
const
|
|
19709
|
-
const
|
|
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
|
-
|
|
19737
|
-
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19743
|
-
ItemInteractionLayer,
|
|
19744
|
-
{
|
|
19745
|
-
rect: activeItemRect,
|
|
19746
|
-
state: toolbarState,
|
|
19747
|
-
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19748
|
-
MediaStripToolbar,
|
|
19749
|
-
{
|
|
19750
|
-
entry: activeEntry,
|
|
19751
|
-
index: active.index,
|
|
19752
|
-
pending,
|
|
19753
|
-
error,
|
|
19754
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19755
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19756
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19757
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19758
|
-
onResize: (delta) => {
|
|
19759
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19760
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19761
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19762
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19763
|
-
},
|
|
19764
|
-
onSetAlt: (alt) => {
|
|
19765
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19766
|
-
},
|
|
19767
|
-
onSetLink: (href, linkTarget) => {
|
|
20137
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
20138
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20139
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
20140
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
20141
|
+
const activeHref = activeItem?.href ?? "";
|
|
20142
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
20143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20144
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20145
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20146
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
20147
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20148
|
+
MediaStripToolbar,
|
|
20149
|
+
{
|
|
20150
|
+
entry: activeEntry,
|
|
20151
|
+
index: active.index,
|
|
20152
|
+
pending,
|
|
20153
|
+
error,
|
|
20154
|
+
itemEditOn,
|
|
20155
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
20156
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
20157
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
20158
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
20159
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
20160
|
+
onResize: (delta) => {
|
|
20161
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
20162
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
20163
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
20164
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
20165
|
+
},
|
|
20166
|
+
onOpenLink: () => setLinkOpen(true),
|
|
20167
|
+
onAddItem: () => {
|
|
20168
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20169
|
+
if (!picked) return;
|
|
20170
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19768
20171
|
void runMutation(
|
|
19769
20172
|
active.sectionId,
|
|
19770
|
-
(tree) =>
|
|
19771
|
-
|
|
19772
|
-
|
|
19773
|
-
|
|
19774
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19775
|
-
if (!picked) return;
|
|
19776
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19777
|
-
void runMutation(
|
|
19778
|
-
active.sectionId,
|
|
19779
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19780
|
-
{ [picked.assetId]: picked.url }
|
|
19781
|
-
).then((applied) => {
|
|
19782
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19783
|
-
});
|
|
20173
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
20174
|
+
{ [picked.assetId]: picked.url }
|
|
20175
|
+
).then((applied) => {
|
|
20176
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19784
20177
|
});
|
|
19785
|
-
}
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19792
|
-
|
|
19793
|
-
|
|
19794
|
-
});
|
|
19795
|
-
},
|
|
19796
|
-
onRemoveItem: () => {
|
|
19797
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19798
|
-
(applied) => {
|
|
19799
|
-
if (applied) setActive(null);
|
|
19800
|
-
}
|
|
19801
|
-
);
|
|
19802
|
-
},
|
|
19803
|
-
onMoveLeft: () => {
|
|
19804
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19805
|
-
(applied) => {
|
|
19806
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19807
|
-
}
|
|
19808
|
-
);
|
|
19809
|
-
},
|
|
19810
|
-
onMoveRight: () => {
|
|
19811
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19812
|
-
(applied) => {
|
|
19813
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19814
|
-
}
|
|
20178
|
+
});
|
|
20179
|
+
},
|
|
20180
|
+
onChangeImage: () => {
|
|
20181
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20182
|
+
if (!picked) return;
|
|
20183
|
+
void runMutation(
|
|
20184
|
+
active.sectionId,
|
|
20185
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
20186
|
+
{ [picked.assetId]: picked.url }
|
|
19815
20187
|
);
|
|
19816
|
-
}
|
|
20188
|
+
});
|
|
20189
|
+
},
|
|
20190
|
+
onRemoveItem: () => {
|
|
20191
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
20192
|
+
(applied) => {
|
|
20193
|
+
if (applied) setActive(null);
|
|
20194
|
+
}
|
|
20195
|
+
);
|
|
20196
|
+
},
|
|
20197
|
+
onMoveLeft: () => {
|
|
20198
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
20199
|
+
(applied) => {
|
|
20200
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
20201
|
+
}
|
|
20202
|
+
);
|
|
20203
|
+
},
|
|
20204
|
+
onMoveRight: () => {
|
|
20205
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20206
|
+
(applied) => {
|
|
20207
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20208
|
+
}
|
|
20209
|
+
);
|
|
19817
20210
|
}
|
|
19818
|
-
|
|
19819
|
-
}
|
|
19820
|
-
|
|
20211
|
+
}
|
|
20212
|
+
) }),
|
|
20213
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20214
|
+
"div",
|
|
20215
|
+
{
|
|
20216
|
+
"data-ohw-bridge": "",
|
|
20217
|
+
"data-ohw-item-interaction": "",
|
|
20218
|
+
"aria-hidden": true,
|
|
20219
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20220
|
+
style: {
|
|
20221
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20222
|
+
left: activeItemRect.left - 5,
|
|
20223
|
+
background: PRIMARY3,
|
|
20224
|
+
zIndex: 2147483644
|
|
20225
|
+
},
|
|
20226
|
+
children: "Media item"
|
|
20227
|
+
}
|
|
20228
|
+
),
|
|
20229
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20230
|
+
LinkModal,
|
|
20231
|
+
{
|
|
20232
|
+
href: activeHref,
|
|
20233
|
+
linkTarget: activeTarget,
|
|
20234
|
+
onClose: () => setLinkOpen(false),
|
|
20235
|
+
onSave: (href, linkTarget) => {
|
|
20236
|
+
void runMutation(
|
|
20237
|
+
active.sectionId,
|
|
20238
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20239
|
+
);
|
|
20240
|
+
}
|
|
20241
|
+
}
|
|
20242
|
+
)
|
|
20243
|
+
] })
|
|
19821
20244
|
] });
|
|
19822
20245
|
}
|
|
19823
20246
|
|
|
19824
20247
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19825
20248
|
var import_react14 = require("react");
|
|
19826
|
-
var
|
|
19827
|
-
var
|
|
20249
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20250
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
19828
20251
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19829
|
-
var
|
|
20252
|
+
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]";
|
|
19830
20253
|
function findPricingCardElement(sectionId, index) {
|
|
19831
20254
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19832
20255
|
if (!sectionEl2) return null;
|
|
@@ -19838,7 +20261,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19838
20261
|
}
|
|
19839
20262
|
function cardRefFromTarget(target) {
|
|
19840
20263
|
if (!(target instanceof Element)) return null;
|
|
19841
|
-
if (target.closest(
|
|
20264
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19842
20265
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19843
20266
|
if (!cardEl) return null;
|
|
19844
20267
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -19848,21 +20271,21 @@ function cardRefFromTarget(target) {
|
|
|
19848
20271
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19849
20272
|
return { sectionId, index };
|
|
19850
20273
|
}
|
|
19851
|
-
function
|
|
20274
|
+
function sameRef2(a, b) {
|
|
19852
20275
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19853
20276
|
}
|
|
19854
|
-
function
|
|
20277
|
+
function rectOf2(el) {
|
|
19855
20278
|
if (!el) return null;
|
|
19856
20279
|
const r2 = el.getBoundingClientRect();
|
|
19857
20280
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19858
20281
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19859
20282
|
}
|
|
19860
20283
|
function readRect3(ref) {
|
|
19861
|
-
return
|
|
20284
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19862
20285
|
}
|
|
19863
20286
|
function readGridRect(ref) {
|
|
19864
20287
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19865
|
-
return
|
|
20288
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19866
20289
|
}
|
|
19867
20290
|
function useLiveCardRect(ref, grid = false) {
|
|
19868
20291
|
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
@@ -19892,7 +20315,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19892
20315
|
}
|
|
19893
20316
|
var TOOLBAR_GRID_GAP = 52;
|
|
19894
20317
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19895
|
-
var
|
|
20318
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19896
20319
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19897
20320
|
const slotRef = (0, import_react14.useRef)(null);
|
|
19898
20321
|
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
@@ -19904,7 +20327,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19904
20327
|
const w = slot.offsetWidth;
|
|
19905
20328
|
if (w <= 0) return;
|
|
19906
20329
|
const half = w / 2;
|
|
19907
|
-
const clamped = Math.max(
|
|
20330
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19908
20331
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19909
20332
|
};
|
|
19910
20333
|
clamp();
|
|
@@ -19913,7 +20336,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19913
20336
|
return () => ro.disconnect();
|
|
19914
20337
|
}, [centerX, children]);
|
|
19915
20338
|
const mobile = window.innerWidth <= 480;
|
|
19916
|
-
return /* @__PURE__ */ (0,
|
|
20339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19917
20340
|
"div",
|
|
19918
20341
|
{
|
|
19919
20342
|
ref: slotRef,
|
|
@@ -19948,7 +20371,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19948
20371
|
});
|
|
19949
20372
|
}
|
|
19950
20373
|
function StyleSwatch({ style }) {
|
|
19951
|
-
return /* @__PURE__ */ (0,
|
|
20374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19952
20375
|
"span",
|
|
19953
20376
|
{
|
|
19954
20377
|
"aria-hidden": true,
|
|
@@ -19962,35 +20385,35 @@ function StyleSwatch({ style }) {
|
|
|
19962
20385
|
);
|
|
19963
20386
|
}
|
|
19964
20387
|
function ButtonGlyph() {
|
|
19965
|
-
return /* @__PURE__ */ (0,
|
|
19966
|
-
/* @__PURE__ */ (0,
|
|
19967
|
-
/* @__PURE__ */ (0,
|
|
20388
|
+
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: [
|
|
20389
|
+
/* @__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" }),
|
|
20390
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19968
20391
|
] });
|
|
19969
20392
|
}
|
|
19970
20393
|
function FeatureGlyph({ mode }) {
|
|
19971
|
-
return /* @__PURE__ */ (0,
|
|
19972
|
-
/* @__PURE__ */ (0,
|
|
19973
|
-
/* @__PURE__ */ (0,
|
|
19974
|
-
/* @__PURE__ */ (0,
|
|
19975
|
-
/* @__PURE__ */ (0,
|
|
19976
|
-
/* @__PURE__ */ (0,
|
|
19977
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
20394
|
+
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: [
|
|
20395
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20396
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20397
|
+
/* @__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" }),
|
|
20398
|
+
/* @__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" }),
|
|
20399
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20400
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19978
20401
|
] });
|
|
19979
20402
|
}
|
|
19980
|
-
function
|
|
20403
|
+
function ToolbarAction2({
|
|
19981
20404
|
label,
|
|
19982
20405
|
onClick,
|
|
19983
20406
|
disabled = false,
|
|
19984
20407
|
children
|
|
19985
20408
|
}) {
|
|
19986
|
-
const button = /* @__PURE__ */ (0,
|
|
19987
|
-
return /* @__PURE__ */ (0,
|
|
19988
|
-
/* @__PURE__ */ (0,
|
|
19989
|
-
/* @__PURE__ */ (0,
|
|
20409
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20411
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20412
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19990
20413
|
] });
|
|
19991
20414
|
}
|
|
19992
|
-
function
|
|
19993
|
-
return /* @__PURE__ */ (0,
|
|
20415
|
+
function ToolbarSeparator2() {
|
|
20416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19994
20417
|
}
|
|
19995
20418
|
function CardStyleMenu({
|
|
19996
20419
|
value,
|
|
@@ -19998,7 +20421,7 @@ function CardStyleMenu({
|
|
|
19998
20421
|
disabled = false
|
|
19999
20422
|
}) {
|
|
20000
20423
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
20001
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20424
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20002
20425
|
"button",
|
|
20003
20426
|
{
|
|
20004
20427
|
type: "button",
|
|
@@ -20009,28 +20432,28 @@ function CardStyleMenu({
|
|
|
20009
20432
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20010
20433
|
),
|
|
20011
20434
|
children: [
|
|
20012
|
-
/* @__PURE__ */ (0,
|
|
20013
|
-
/* @__PURE__ */ (0,
|
|
20014
|
-
/* @__PURE__ */ (0,
|
|
20435
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
|
|
20436
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20437
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20015
20438
|
]
|
|
20016
20439
|
}
|
|
20017
20440
|
);
|
|
20018
20441
|
if (disabled) {
|
|
20019
|
-
return /* @__PURE__ */ (0,
|
|
20020
|
-
/* @__PURE__ */ (0,
|
|
20021
|
-
/* @__PURE__ */ (0,
|
|
20022
|
-
/* @__PURE__ */ (0,
|
|
20023
|
-
/* @__PURE__ */ (0,
|
|
20442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20443
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20444
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20445
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20446
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20024
20447
|
] })
|
|
20025
20448
|
] });
|
|
20026
20449
|
}
|
|
20027
|
-
return /* @__PURE__ */ (0,
|
|
20028
|
-
/* @__PURE__ */ (0,
|
|
20029
|
-
/* @__PURE__ */ (0,
|
|
20030
|
-
/* @__PURE__ */ (0,
|
|
20031
|
-
/* @__PURE__ */ (0,
|
|
20450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20451
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20452
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20453
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20454
|
+
/* @__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) => {
|
|
20032
20455
|
const selected = style.value === value;
|
|
20033
|
-
return /* @__PURE__ */ (0,
|
|
20456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20034
20457
|
DropdownMenuItem,
|
|
20035
20458
|
{
|
|
20036
20459
|
role: "menuitemradio",
|
|
@@ -20038,9 +20461,9 @@ function CardStyleMenu({
|
|
|
20038
20461
|
onSelect: () => onChange(style.value),
|
|
20039
20462
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20040
20463
|
children: [
|
|
20041
|
-
/* @__PURE__ */ (0,
|
|
20042
|
-
/* @__PURE__ */ (0,
|
|
20043
|
-
selected && /* @__PURE__ */ (0,
|
|
20464
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
|
|
20465
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
|
|
20466
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
|
|
20044
20467
|
]
|
|
20045
20468
|
},
|
|
20046
20469
|
style.value
|
|
@@ -20070,7 +20493,7 @@ function PricingCardToolbar({
|
|
|
20070
20493
|
const style = pricingCardStyle(entry.tree, index);
|
|
20071
20494
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20072
20495
|
const mobile = window.innerWidth <= 480;
|
|
20073
|
-
return /* @__PURE__ */ (0,
|
|
20496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20074
20497
|
"div",
|
|
20075
20498
|
{
|
|
20076
20499
|
"data-ohw-bridge": "",
|
|
@@ -20082,7 +20505,7 @@ function PricingCardToolbar({
|
|
|
20082
20505
|
),
|
|
20083
20506
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20084
20507
|
children: [
|
|
20085
|
-
/* @__PURE__ */ (0,
|
|
20508
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20086
20509
|
"div",
|
|
20087
20510
|
{
|
|
20088
20511
|
className: cn(
|
|
@@ -20091,8 +20514,8 @@ function PricingCardToolbar({
|
|
|
20091
20514
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20092
20515
|
),
|
|
20093
20516
|
children: [
|
|
20094
|
-
/* @__PURE__ */ (0,
|
|
20095
|
-
/* @__PURE__ */ (0,
|
|
20517
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20518
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20096
20519
|
CustomToolbarButton,
|
|
20097
20520
|
{
|
|
20098
20521
|
type: "button",
|
|
@@ -20100,8 +20523,8 @@ function PricingCardToolbar({
|
|
|
20100
20523
|
"aria-pressed": featuredTag,
|
|
20101
20524
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20102
20525
|
className: "group size-8",
|
|
20103
|
-
children: /* @__PURE__ */ (0,
|
|
20104
|
-
|
|
20526
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20527
|
+
import_lucide_react10.Star,
|
|
20105
20528
|
{
|
|
20106
20529
|
size: 16,
|
|
20107
20530
|
fill: "currentColor",
|
|
@@ -20115,25 +20538,25 @@ function PricingCardToolbar({
|
|
|
20115
20538
|
)
|
|
20116
20539
|
}
|
|
20117
20540
|
) }),
|
|
20118
|
-
/* @__PURE__ */ (0,
|
|
20541
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20119
20542
|
] }),
|
|
20120
|
-
/* @__PURE__ */ (0,
|
|
20121
|
-
/* @__PURE__ */ (0,
|
|
20122
|
-
/* @__PURE__ */ (0,
|
|
20123
|
-
/* @__PURE__ */ (0,
|
|
20124
|
-
/* @__PURE__ */ (0,
|
|
20125
|
-
/* @__PURE__ */ (0,
|
|
20126
|
-
/* @__PURE__ */ (0,
|
|
20543
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20544
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20545
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20546
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
|
|
20547
|
+
/* @__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: [
|
|
20548
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
|
|
20549
|
+
/* @__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" })
|
|
20127
20550
|
] }) }),
|
|
20128
|
-
/* @__PURE__ */ (0,
|
|
20129
|
-
/* @__PURE__ */ (0,
|
|
20130
|
-
/* @__PURE__ */ (0,
|
|
20131
|
-
/* @__PURE__ */ (0,
|
|
20132
|
-
/* @__PURE__ */ (0,
|
|
20551
|
+
/* @__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" }) }),
|
|
20552
|
+
/* @__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" }) }),
|
|
20553
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20554
|
+
/* @__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" } }) }),
|
|
20555
|
+
/* @__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" } }) })
|
|
20133
20556
|
]
|
|
20134
20557
|
}
|
|
20135
20558
|
),
|
|
20136
|
-
error && /* @__PURE__ */ (0,
|
|
20559
|
+
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 })
|
|
20137
20560
|
]
|
|
20138
20561
|
}
|
|
20139
20562
|
) });
|
|
@@ -20167,7 +20590,7 @@ function AiPricingCardOverlay({
|
|
|
20167
20590
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20168
20591
|
setHover((prev) => {
|
|
20169
20592
|
const next = ref && !overEditable ? ref : null;
|
|
20170
|
-
return
|
|
20593
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20171
20594
|
});
|
|
20172
20595
|
};
|
|
20173
20596
|
const onLeave = () => setHover(null);
|
|
@@ -20182,10 +20605,10 @@ function AiPricingCardOverlay({
|
|
|
20182
20605
|
const onClick = (e) => {
|
|
20183
20606
|
const t = e.target;
|
|
20184
20607
|
if (!(t instanceof Element)) return;
|
|
20185
|
-
if (t.closest(
|
|
20608
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20186
20609
|
const ref = cardRefFromTarget(t);
|
|
20187
|
-
setActive((prev) =>
|
|
20188
|
-
if (!ref || !
|
|
20610
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20611
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20189
20612
|
};
|
|
20190
20613
|
document.addEventListener("click", onClick, true);
|
|
20191
20614
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20250,12 +20673,12 @@ function AiPricingCardOverlay({
|
|
|
20250
20673
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20251
20674
|
const activeCardRect = useLiveCardRect(active);
|
|
20252
20675
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20253
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20254
|
-
return /* @__PURE__ */ (0,
|
|
20255
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20256
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20257
|
-
/* @__PURE__ */ (0,
|
|
20258
|
-
/* @__PURE__ */ (0,
|
|
20676
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20678
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20679
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20680
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20681
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20259
20682
|
PricingCardToolbar,
|
|
20260
20683
|
{
|
|
20261
20684
|
entry: activeEntry,
|
|
@@ -20283,7 +20706,7 @@ function AiPricingCardOverlay({
|
|
|
20283
20706
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20284
20707
|
}
|
|
20285
20708
|
) }),
|
|
20286
|
-
/* @__PURE__ */ (0,
|
|
20709
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20287
20710
|
"div",
|
|
20288
20711
|
{
|
|
20289
20712
|
"data-ohw-bridge": "",
|
|
@@ -20305,7 +20728,7 @@ function AiPricingCardOverlay({
|
|
|
20305
20728
|
|
|
20306
20729
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20307
20730
|
var import_react15 = require("react");
|
|
20308
|
-
var
|
|
20731
|
+
var import_lucide_react11 = require("lucide-react");
|
|
20309
20732
|
|
|
20310
20733
|
// src/lib/ai-video-tree.ts
|
|
20311
20734
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20347,39 +20770,11 @@ function clearVideo(tree, path) {
|
|
|
20347
20770
|
});
|
|
20348
20771
|
}
|
|
20349
20772
|
|
|
20350
|
-
// src/lib/youtube.ts
|
|
20351
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20352
|
-
function extractYouTubeId(input) {
|
|
20353
|
-
const trimmed = input.trim();
|
|
20354
|
-
if (!trimmed) return null;
|
|
20355
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20356
|
-
let url;
|
|
20357
|
-
try {
|
|
20358
|
-
url = new URL(trimmed);
|
|
20359
|
-
} catch {
|
|
20360
|
-
return null;
|
|
20361
|
-
}
|
|
20362
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20363
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20364
|
-
return null;
|
|
20365
|
-
}
|
|
20366
|
-
let candidate = null;
|
|
20367
|
-
if (host === "youtu.be") {
|
|
20368
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20369
|
-
} else if (url.pathname === "/watch") {
|
|
20370
|
-
candidate = url.searchParams.get("v");
|
|
20371
|
-
} else {
|
|
20372
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20373
|
-
candidate = match ? match[1] : null;
|
|
20374
|
-
}
|
|
20375
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20376
|
-
}
|
|
20377
|
-
|
|
20378
20773
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20379
|
-
var
|
|
20774
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
20380
20775
|
var PRIMARY5 = "#0885FE";
|
|
20381
|
-
var
|
|
20382
|
-
var
|
|
20776
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20777
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20383
20778
|
function findVideoBlockElement(sectionId, path) {
|
|
20384
20779
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20385
20780
|
if (!sectionEl2) return null;
|
|
@@ -20439,12 +20834,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20439
20834
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20440
20835
|
});
|
|
20441
20836
|
}
|
|
20442
|
-
function
|
|
20837
|
+
function Pill({
|
|
20443
20838
|
label,
|
|
20444
20839
|
onClick,
|
|
20445
20840
|
disabled
|
|
20446
20841
|
}) {
|
|
20447
|
-
return /* @__PURE__ */ (0,
|
|
20842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20448
20843
|
"button",
|
|
20449
20844
|
{
|
|
20450
20845
|
type: "button",
|
|
@@ -20460,7 +20855,7 @@ function Pill2({
|
|
|
20460
20855
|
border: "none",
|
|
20461
20856
|
cursor: disabled ? "default" : "pointer",
|
|
20462
20857
|
background: "#ffffff",
|
|
20463
|
-
color:
|
|
20858
|
+
color: OHW_BLUE_DARK,
|
|
20464
20859
|
opacity: disabled ? 0.4 : 1,
|
|
20465
20860
|
fontSize: 12,
|
|
20466
20861
|
lineHeight: "16px",
|
|
@@ -20503,8 +20898,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20503
20898
|
onCommit(id);
|
|
20504
20899
|
}
|
|
20505
20900
|
};
|
|
20506
|
-
return /* @__PURE__ */ (0,
|
|
20507
|
-
/* @__PURE__ */ (0,
|
|
20901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20902
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20508
20903
|
"div",
|
|
20509
20904
|
{
|
|
20510
20905
|
style: {
|
|
@@ -20520,12 +20915,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20520
20915
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20521
20916
|
},
|
|
20522
20917
|
children: [
|
|
20523
|
-
/* @__PURE__ */ (0,
|
|
20918
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20524
20919
|
"span",
|
|
20525
20920
|
{
|
|
20526
20921
|
style: {
|
|
20527
20922
|
flex: "0 0 auto",
|
|
20528
|
-
color:
|
|
20923
|
+
color: OHW_BLUE_DARK,
|
|
20529
20924
|
fontSize: 10,
|
|
20530
20925
|
lineHeight: "16px",
|
|
20531
20926
|
fontWeight: 700,
|
|
@@ -20535,7 +20930,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20535
20930
|
children: "Video"
|
|
20536
20931
|
}
|
|
20537
20932
|
),
|
|
20538
|
-
/* @__PURE__ */ (0,
|
|
20933
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20539
20934
|
"input",
|
|
20540
20935
|
{
|
|
20541
20936
|
type: "text",
|
|
@@ -20572,7 +20967,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20572
20967
|
]
|
|
20573
20968
|
}
|
|
20574
20969
|
),
|
|
20575
|
-
invalid && /* @__PURE__ */ (0,
|
|
20970
|
+
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." })
|
|
20576
20971
|
] });
|
|
20577
20972
|
}
|
|
20578
20973
|
function VideoToolbar({
|
|
@@ -20582,7 +20977,7 @@ function VideoToolbar({
|
|
|
20582
20977
|
onSetVideoId,
|
|
20583
20978
|
onRemove
|
|
20584
20979
|
}) {
|
|
20585
|
-
return /* @__PURE__ */ (0,
|
|
20980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20586
20981
|
"div",
|
|
20587
20982
|
{
|
|
20588
20983
|
"data-ohw-bridge": "",
|
|
@@ -20594,7 +20989,7 @@ function VideoToolbar({
|
|
|
20594
20989
|
gap: 6,
|
|
20595
20990
|
alignItems: "center",
|
|
20596
20991
|
width: 280,
|
|
20597
|
-
background:
|
|
20992
|
+
background: OHW_BLUE,
|
|
20598
20993
|
padding: 8,
|
|
20599
20994
|
borderRadius: 12,
|
|
20600
20995
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20602,9 +20997,9 @@ function VideoToolbar({
|
|
|
20602
20997
|
opacity: pending ? 0.6 : 1
|
|
20603
20998
|
},
|
|
20604
20999
|
children: [
|
|
20605
|
-
/* @__PURE__ */ (0,
|
|
20606
|
-
/* @__PURE__ */ (0,
|
|
20607
|
-
error && /* @__PURE__ */ (0,
|
|
21000
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
21001
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
21002
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20608
21003
|
]
|
|
20609
21004
|
}
|
|
20610
21005
|
);
|
|
@@ -20724,8 +21119,8 @@ function AiVideoOverlay({
|
|
|
20724
21119
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20725
21120
|
const TOOLBAR_APPROX_H = 90;
|
|
20726
21121
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20727
|
-
return /* @__PURE__ */ (0,
|
|
20728
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
21123
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20729
21124
|
"button",
|
|
20730
21125
|
{
|
|
20731
21126
|
type: "button",
|
|
@@ -20753,15 +21148,15 @@ function AiVideoOverlay({
|
|
|
20753
21148
|
fontSize: 14,
|
|
20754
21149
|
fontWeight: 700
|
|
20755
21150
|
},
|
|
20756
|
-
children: /* @__PURE__ */ (0,
|
|
21151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
20757
21152
|
}
|
|
20758
21153
|
),
|
|
20759
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21154
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20760
21155
|
ItemInteractionLayer,
|
|
20761
21156
|
{
|
|
20762
21157
|
rect: activeBlockRect,
|
|
20763
21158
|
state: toolbarState,
|
|
20764
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21159
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20765
21160
|
VideoToolbar,
|
|
20766
21161
|
{
|
|
20767
21162
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20785,7 +21180,7 @@ function AiVideoOverlay({
|
|
|
20785
21180
|
|
|
20786
21181
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20787
21182
|
var import_react16 = require("react");
|
|
20788
|
-
var
|
|
21183
|
+
var import_lucide_react12 = require("lucide-react");
|
|
20789
21184
|
|
|
20790
21185
|
// src/lib/ai-carousel-tree.ts
|
|
20791
21186
|
function isCarouselBlock(node) {
|
|
@@ -20836,10 +21231,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20836
21231
|
}
|
|
20837
21232
|
|
|
20838
21233
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20839
|
-
var
|
|
21234
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
20840
21235
|
var PRIMARY6 = "#0885FE";
|
|
20841
|
-
var
|
|
20842
|
-
var
|
|
21236
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21237
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20843
21238
|
function findCarouselItemElement(sectionId, index) {
|
|
20844
21239
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20845
21240
|
if (!sectionEl2) return null;
|
|
@@ -20918,8 +21313,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20918
21313
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20919
21314
|
});
|
|
20920
21315
|
}
|
|
20921
|
-
function
|
|
20922
|
-
return /* @__PURE__ */ (0,
|
|
21316
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20923
21318
|
"button",
|
|
20924
21319
|
{
|
|
20925
21320
|
type: "button",
|
|
@@ -20935,7 +21330,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20935
21330
|
border: "none",
|
|
20936
21331
|
cursor: disabled ? "default" : "pointer",
|
|
20937
21332
|
background: "#ffffff",
|
|
20938
|
-
color:
|
|
21333
|
+
color: OHW_BLUE_DARK2,
|
|
20939
21334
|
opacity: disabled ? 0.4 : 1,
|
|
20940
21335
|
fontSize: 12,
|
|
20941
21336
|
lineHeight: "16px",
|
|
@@ -20953,7 +21348,7 @@ function TogglePill({
|
|
|
20953
21348
|
onToggle,
|
|
20954
21349
|
disabled
|
|
20955
21350
|
}) {
|
|
20956
|
-
return /* @__PURE__ */ (0,
|
|
21351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
20957
21352
|
"button",
|
|
20958
21353
|
{
|
|
20959
21354
|
type: "button",
|
|
@@ -20972,7 +21367,7 @@ function TogglePill({
|
|
|
20972
21367
|
border: "none",
|
|
20973
21368
|
cursor: disabled ? "default" : "pointer",
|
|
20974
21369
|
background: "#ffffff",
|
|
20975
|
-
color:
|
|
21370
|
+
color: OHW_BLUE_DARK2,
|
|
20976
21371
|
opacity: disabled ? 0.4 : 1,
|
|
20977
21372
|
fontSize: 12,
|
|
20978
21373
|
lineHeight: "16px",
|
|
@@ -20982,7 +21377,7 @@ function TogglePill({
|
|
|
20982
21377
|
},
|
|
20983
21378
|
children: [
|
|
20984
21379
|
label,
|
|
20985
|
-
/* @__PURE__ */ (0,
|
|
21380
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20986
21381
|
"span",
|
|
20987
21382
|
{
|
|
20988
21383
|
"aria-hidden": true,
|
|
@@ -20995,10 +21390,10 @@ function TogglePill({
|
|
|
20995
21390
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20996
21391
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20997
21392
|
// "disabled control" rather than "switch that is off".
|
|
20998
|
-
background: on ?
|
|
21393
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20999
21394
|
transition: "background 120ms ease"
|
|
21000
21395
|
},
|
|
21001
|
-
children: /* @__PURE__ */ (0,
|
|
21396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21002
21397
|
"span",
|
|
21003
21398
|
{
|
|
21004
21399
|
style: {
|
|
@@ -21027,7 +21422,7 @@ function CarouselSlideToolbar({
|
|
|
21027
21422
|
onChangeImage,
|
|
21028
21423
|
onToggleAutoplay
|
|
21029
21424
|
}) {
|
|
21030
|
-
return /* @__PURE__ */ (0,
|
|
21425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21031
21426
|
"div",
|
|
21032
21427
|
{
|
|
21033
21428
|
"data-ohw-bridge": "",
|
|
@@ -21038,7 +21433,7 @@ function CarouselSlideToolbar({
|
|
|
21038
21433
|
flexDirection: "column",
|
|
21039
21434
|
gap: 6,
|
|
21040
21435
|
alignItems: "center",
|
|
21041
|
-
background:
|
|
21436
|
+
background: OHW_BLUE2,
|
|
21042
21437
|
padding: 8,
|
|
21043
21438
|
borderRadius: 12,
|
|
21044
21439
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21050,11 +21445,11 @@ function CarouselSlideToolbar({
|
|
|
21050
21445
|
pointerEvents: pending ? "none" : "auto"
|
|
21051
21446
|
},
|
|
21052
21447
|
children: [
|
|
21053
|
-
/* @__PURE__ */ (0,
|
|
21054
|
-
/* @__PURE__ */ (0,
|
|
21055
|
-
/* @__PURE__ */ (0,
|
|
21448
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21449
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21450
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21056
21451
|
] }),
|
|
21057
|
-
error && /* @__PURE__ */ (0,
|
|
21452
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21058
21453
|
]
|
|
21059
21454
|
}
|
|
21060
21455
|
);
|
|
@@ -21194,8 +21589,8 @@ function AiFadeCarouselOverlay({
|
|
|
21194
21589
|
const activeItemRect = useLiveItemRect2(active);
|
|
21195
21590
|
const TOOLBAR_APPROX_H = 90;
|
|
21196
21591
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21197
|
-
return /* @__PURE__ */ (0,
|
|
21198
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
21593
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21199
21594
|
"button",
|
|
21200
21595
|
{
|
|
21201
21596
|
type: "button",
|
|
@@ -21224,10 +21619,10 @@ function AiFadeCarouselOverlay({
|
|
|
21224
21619
|
fontSize: 14,
|
|
21225
21620
|
fontWeight: 700
|
|
21226
21621
|
},
|
|
21227
|
-
children: /* @__PURE__ */ (0,
|
|
21622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21228
21623
|
}
|
|
21229
21624
|
),
|
|
21230
|
-
swapping && /* @__PURE__ */ (0,
|
|
21625
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21231
21626
|
"div",
|
|
21232
21627
|
{
|
|
21233
21628
|
ref: skeletonRef,
|
|
@@ -21245,15 +21640,15 @@ function AiFadeCarouselOverlay({
|
|
|
21245
21640
|
zIndex: 2147483646,
|
|
21246
21641
|
pointerEvents: "none"
|
|
21247
21642
|
},
|
|
21248
|
-
children: /* @__PURE__ */ (0,
|
|
21643
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21249
21644
|
}
|
|
21250
21645
|
),
|
|
21251
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21646
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21252
21647
|
ItemInteractionLayer,
|
|
21253
21648
|
{
|
|
21254
21649
|
rect: activeItemRect,
|
|
21255
21650
|
state: toolbarState,
|
|
21256
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21651
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21257
21652
|
CarouselSlideToolbar,
|
|
21258
21653
|
{
|
|
21259
21654
|
pending,
|
|
@@ -21444,113 +21839,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21444
21839
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21445
21840
|
var import_react20 = require("react");
|
|
21446
21841
|
|
|
21447
|
-
// src/ui/dialog.tsx
|
|
21448
|
-
var React9 = __toESM(require("react"), 1);
|
|
21449
|
-
var import_radix_ui6 = require("radix-ui");
|
|
21450
|
-
var import_lucide_react12 = require("lucide-react");
|
|
21451
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
21452
|
-
function Dialog2({
|
|
21453
|
-
...props
|
|
21454
|
-
}) {
|
|
21455
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21456
|
-
}
|
|
21457
|
-
function DialogPortal({
|
|
21458
|
-
...props
|
|
21459
|
-
}) {
|
|
21460
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21461
|
-
}
|
|
21462
|
-
function DialogOverlay({
|
|
21463
|
-
className,
|
|
21464
|
-
...props
|
|
21465
|
-
}) {
|
|
21466
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21467
|
-
import_radix_ui6.Dialog.Overlay,
|
|
21468
|
-
{
|
|
21469
|
-
"data-slot": "dialog-overlay",
|
|
21470
|
-
"data-ohw-link-modal-root": "",
|
|
21471
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21472
|
-
...props
|
|
21473
|
-
}
|
|
21474
|
-
);
|
|
21475
|
-
}
|
|
21476
|
-
var DialogContent = React9.forwardRef(
|
|
21477
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21478
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21479
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21480
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21481
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21482
|
-
import_radix_ui6.Dialog.Content,
|
|
21483
|
-
{
|
|
21484
|
-
ref,
|
|
21485
|
-
"data-slot": "dialog-content",
|
|
21486
|
-
className: cn(
|
|
21487
|
-
positionMode,
|
|
21488
|
-
"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",
|
|
21489
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21490
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21491
|
-
className
|
|
21492
|
-
),
|
|
21493
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21494
|
-
...props,
|
|
21495
|
-
children: [
|
|
21496
|
-
children,
|
|
21497
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21498
|
-
import_radix_ui6.Dialog.Close,
|
|
21499
|
-
{
|
|
21500
|
-
type: "button",
|
|
21501
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21502
|
-
"aria-label": "Close",
|
|
21503
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
21504
|
-
}
|
|
21505
|
-
) : null
|
|
21506
|
-
]
|
|
21507
|
-
}
|
|
21508
|
-
)
|
|
21509
|
-
] });
|
|
21510
|
-
}
|
|
21511
|
-
);
|
|
21512
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21513
|
-
function DialogHeader({
|
|
21514
|
-
className,
|
|
21515
|
-
...props
|
|
21516
|
-
}) {
|
|
21517
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21518
|
-
}
|
|
21519
|
-
function DialogFooter({
|
|
21520
|
-
className,
|
|
21521
|
-
...props
|
|
21522
|
-
}) {
|
|
21523
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21524
|
-
"div",
|
|
21525
|
-
{
|
|
21526
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21527
|
-
...props
|
|
21528
|
-
}
|
|
21529
|
-
);
|
|
21530
|
-
}
|
|
21531
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21532
|
-
import_radix_ui6.Dialog.Title,
|
|
21533
|
-
{
|
|
21534
|
-
ref,
|
|
21535
|
-
className: cn(
|
|
21536
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21537
|
-
className
|
|
21538
|
-
),
|
|
21539
|
-
...props
|
|
21540
|
-
}
|
|
21541
|
-
));
|
|
21542
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21543
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21544
|
-
import_radix_ui6.Dialog.Description,
|
|
21545
|
-
{
|
|
21546
|
-
ref,
|
|
21547
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21548
|
-
...props
|
|
21549
|
-
}
|
|
21550
|
-
));
|
|
21551
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21552
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21553
|
-
|
|
21554
21842
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21555
21843
|
var import_lucide_react16 = require("lucide-react");
|
|
21556
21844
|
|
|
@@ -22654,6 +22942,7 @@ function shouldUseDevFixtures() {
|
|
|
22654
22942
|
function getLogoElement(el) {
|
|
22655
22943
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22656
22944
|
if (marked) return marked;
|
|
22945
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22657
22946
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22658
22947
|
if (!root) return null;
|
|
22659
22948
|
const anchor = el.closest("a");
|
|
@@ -23990,12 +24279,19 @@ function useSectionDrag({
|
|
|
23990
24279
|
clearSectionDragVisuals();
|
|
23991
24280
|
return;
|
|
23992
24281
|
}
|
|
24282
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
23993
24283
|
const orderJson = JSON.stringify(
|
|
23994
24284
|
mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname, entries)
|
|
23995
24285
|
);
|
|
23996
24286
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
23997
24287
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
23998
|
-
postToParentRef.current({
|
|
24288
|
+
postToParentRef.current({
|
|
24289
|
+
type: "ow:change",
|
|
24290
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
24291
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
24292
|
+
// Undo scrolls to this section; a one-place move swaps two, so the order alone can't say which.
|
|
24293
|
+
moved: session.instanceId
|
|
24294
|
+
});
|
|
23999
24295
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
24000
24296
|
clearSectionDragVisuals();
|
|
24001
24297
|
requestAnimationFrame(() => {
|
|
@@ -25463,7 +25759,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25463
25759
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25464
25760
|
return resolveFooterLinksContainerFrom(el);
|
|
25465
25761
|
}
|
|
25466
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25762
|
+
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)) {
|
|
25467
25763
|
return getNavigationRoot(el);
|
|
25468
25764
|
}
|
|
25469
25765
|
return null;
|
|
@@ -25685,7 +25981,6 @@ var ICONS = {
|
|
|
25685
25981
|
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"/>',
|
|
25686
25982
|
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"/>'
|
|
25687
25983
|
};
|
|
25688
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25689
25984
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25690
25985
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25691
25986
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25783,7 +26078,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25783
26078
|
el.style.top = `${top}px`;
|
|
25784
26079
|
el.style.height = `${height}px`;
|
|
25785
26080
|
}
|
|
25786
|
-
var
|
|
26081
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25787
26082
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25788
26083
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25789
26084
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25810,8 +26105,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25810
26105
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25811
26106
|
const half = toolbarWidth / 2;
|
|
25812
26107
|
return Math.max(
|
|
25813
|
-
|
|
25814
|
-
Math.min(centerX, window.innerWidth -
|
|
26108
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26109
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25815
26110
|
);
|
|
25816
26111
|
}
|
|
25817
26112
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -26694,21 +26989,6 @@ function OhhwellsBridge() {
|
|
|
26694
26989
|
const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
|
|
26695
26990
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
|
|
26696
26991
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26697
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26698
|
-
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26699
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26700
|
-
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26701
|
-
floatingPanelRef.current = floatingPanel;
|
|
26702
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26703
|
-
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26704
|
-
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26705
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26706
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26707
|
-
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26708
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26709
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26710
|
-
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26711
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26712
26992
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
|
|
26713
26993
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
|
|
26714
26994
|
const footerDragRef = (0, import_react25.useRef)(null);
|
|
@@ -26735,6 +27015,21 @@ function OhhwellsBridge() {
|
|
|
26735
27015
|
const stylesRef = (0, import_react25.useRef)("");
|
|
26736
27016
|
const appliedDrawerRef = (0, import_react25.useRef)(null);
|
|
26737
27017
|
const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
|
|
27018
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
27019
|
+
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
27020
|
+
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
27021
|
+
floatingPanelRef.current = floatingPanel;
|
|
27022
|
+
const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
|
|
27023
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
27024
|
+
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
27025
|
+
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
27026
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
27027
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
27028
|
+
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
27029
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
27030
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
27031
|
+
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
27032
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26738
27033
|
const [sitePages, setSitePages] = (0, import_react25.useState)([]);
|
|
26739
27034
|
const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
26740
27035
|
const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
|
|
@@ -26744,7 +27039,18 @@ function OhhwellsBridge() {
|
|
|
26744
27039
|
const linkPopoverOpenRef = (0, import_react25.useRef)(false);
|
|
26745
27040
|
const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
|
|
26746
27041
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27042
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26747
27043
|
linkPopoverSessionRef.current = linkPopover;
|
|
27044
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
27045
|
+
(0, import_react25.useEffect)(() => {
|
|
27046
|
+
const syncViewport = () => {
|
|
27047
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
27048
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
27049
|
+
};
|
|
27050
|
+
syncViewport();
|
|
27051
|
+
window.addEventListener("resize", syncViewport);
|
|
27052
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
27053
|
+
}, []);
|
|
26748
27054
|
(0, import_react25.useEffect)(() => {
|
|
26749
27055
|
setSectionOrderPersistHandler((entries) => {
|
|
26750
27056
|
const currentPath = window.location.pathname;
|
|
@@ -28478,6 +28784,7 @@ function OhhwellsBridge() {
|
|
|
28478
28784
|
applyAiFooterFromContent(content);
|
|
28479
28785
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28480
28786
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28787
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28481
28788
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28482
28789
|
}
|
|
28483
28790
|
applyBrandChrome(content);
|
|
@@ -28488,15 +28795,16 @@ function OhhwellsBridge() {
|
|
|
28488
28795
|
if (key === "__ohw_sections") continue;
|
|
28489
28796
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28490
28797
|
if (key === AI_FOOTER_KEY) continue;
|
|
28798
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28799
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28491
28800
|
if (key === BRAND_KIT_KEY) continue;
|
|
28492
28801
|
if (key === STYLE_STORE_KEY) continue;
|
|
28493
28802
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28494
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28495
28803
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28496
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28497
28804
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28498
28805
|
continue;
|
|
28499
28806
|
}
|
|
28807
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28500
28808
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28501
28809
|
if (applyCarouselNode(key, val)) continue;
|
|
28502
28810
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28536,6 +28844,7 @@ function OhhwellsBridge() {
|
|
|
28536
28844
|
});
|
|
28537
28845
|
applyLinkByKey(key, val);
|
|
28538
28846
|
}
|
|
28847
|
+
applySectionEmbeds(content);
|
|
28539
28848
|
applyLogoFromContent(content);
|
|
28540
28849
|
applyLogoSizes(content);
|
|
28541
28850
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28724,20 +29033,22 @@ function OhhwellsBridge() {
|
|
|
28724
29033
|
}
|
|
28725
29034
|
applyAiFooterFromContent(content);
|
|
28726
29035
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
29036
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28727
29037
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28728
29038
|
}
|
|
28729
29039
|
for (const [key, val] of Object.entries(content)) {
|
|
28730
29040
|
if (key === "__ohw_sections") continue;
|
|
28731
29041
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28732
29042
|
if (key === AI_FOOTER_KEY) continue;
|
|
29043
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29044
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28733
29045
|
if (key === BRAND_KIT_KEY) continue;
|
|
28734
29046
|
if (key === STYLE_STORE_KEY) continue;
|
|
28735
29047
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28736
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28737
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28738
29048
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28739
29049
|
continue;
|
|
28740
29050
|
}
|
|
29051
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28741
29052
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28742
29053
|
if (applyCarouselNode(key, val)) continue;
|
|
28743
29054
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28762,6 +29073,7 @@ function OhhwellsBridge() {
|
|
|
28762
29073
|
});
|
|
28763
29074
|
applyLinkByKey(key, val);
|
|
28764
29075
|
}
|
|
29076
|
+
applySectionEmbeds(content);
|
|
28765
29077
|
applyLogoFromContent(content);
|
|
28766
29078
|
reconcileNavbarItemsFromContent(content);
|
|
28767
29079
|
reconcileFooterOrderFromContent(content);
|
|
@@ -29001,26 +29313,11 @@ function OhhwellsBridge() {
|
|
|
29001
29313
|
const t2 = setTimeout(measure, 500);
|
|
29002
29314
|
const ro = new ResizeObserver(schedule);
|
|
29003
29315
|
ro.observe(document.body);
|
|
29004
|
-
let lastWidth = window.innerWidth;
|
|
29005
|
-
let resizeTimers = [];
|
|
29006
|
-
const clearResizeTimers = () => {
|
|
29007
|
-
resizeTimers.forEach(clearTimeout);
|
|
29008
|
-
resizeTimers = [];
|
|
29009
|
-
};
|
|
29010
|
-
const handleResize = () => {
|
|
29011
|
-
if (window.innerWidth === lastWidth) return;
|
|
29012
|
-
lastWidth = window.innerWidth;
|
|
29013
|
-
clearResizeTimers();
|
|
29014
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29015
|
-
};
|
|
29016
|
-
window.addEventListener("resize", handleResize);
|
|
29017
29316
|
return () => {
|
|
29018
29317
|
clearTimeout(t1);
|
|
29019
29318
|
clearTimeout(t2);
|
|
29020
29319
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29021
29320
|
ro.disconnect();
|
|
29022
|
-
clearResizeTimers();
|
|
29023
|
-
window.removeEventListener("resize", handleResize);
|
|
29024
29321
|
};
|
|
29025
29322
|
}, [pathname, isEditMode, postToParent2]);
|
|
29026
29323
|
(0, import_react25.useEffect)(() => {
|
|
@@ -29317,6 +29614,13 @@ function OhhwellsBridge() {
|
|
|
29317
29614
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29318
29615
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29319
29616
|
if (isInsideLinkEditor(target)) return;
|
|
29617
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29618
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29619
|
+
if (target.closest(
|
|
29620
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29621
|
+
)) {
|
|
29622
|
+
return;
|
|
29623
|
+
}
|
|
29320
29624
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29321
29625
|
clearMediaSelectionRef.current();
|
|
29322
29626
|
}
|
|
@@ -29340,8 +29644,6 @@ function OhhwellsBridge() {
|
|
|
29340
29644
|
return;
|
|
29341
29645
|
}
|
|
29342
29646
|
}
|
|
29343
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29344
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29345
29647
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29346
29648
|
if (collectionItem) {
|
|
29347
29649
|
e.preventDefault();
|
|
@@ -29353,11 +29655,6 @@ function OhhwellsBridge() {
|
|
|
29353
29655
|
});
|
|
29354
29656
|
return;
|
|
29355
29657
|
}
|
|
29356
|
-
if (target.closest(
|
|
29357
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29358
|
-
)) {
|
|
29359
|
-
return;
|
|
29360
|
-
}
|
|
29361
29658
|
{
|
|
29362
29659
|
const formEl = getFormElement(target);
|
|
29363
29660
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29511,9 +29808,13 @@ function OhhwellsBridge() {
|
|
|
29511
29808
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29512
29809
|
e.preventDefault();
|
|
29513
29810
|
e.stopPropagation();
|
|
29514
|
-
selectIconElementRef.current(editable);
|
|
29515
29811
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29516
29812
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29813
|
+
if (aiIcon) {
|
|
29814
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29815
|
+
} else {
|
|
29816
|
+
selectIconElementRef.current(editable);
|
|
29817
|
+
}
|
|
29517
29818
|
postToParentRef.current({
|
|
29518
29819
|
type: "ow:icon-pick",
|
|
29519
29820
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29741,6 +30042,9 @@ function OhhwellsBridge() {
|
|
|
29741
30042
|
setHoveredItemRect(null);
|
|
29742
30043
|
hoveredNavContainerRef.current = null;
|
|
29743
30044
|
setHoveredNavContainerRect(null);
|
|
30045
|
+
siblingHintElRef.current = null;
|
|
30046
|
+
setSiblingHintRect(null);
|
|
30047
|
+
setSiblingHintRects([]);
|
|
29744
30048
|
return;
|
|
29745
30049
|
}
|
|
29746
30050
|
{
|
|
@@ -29861,7 +30165,6 @@ function OhhwellsBridge() {
|
|
|
29861
30165
|
hoveredNavContainerRef.current = null;
|
|
29862
30166
|
setHoveredNavContainerRect(null);
|
|
29863
30167
|
hoveredItemElRef.current = editable;
|
|
29864
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29865
30168
|
}
|
|
29866
30169
|
}
|
|
29867
30170
|
}
|
|
@@ -30571,7 +30874,11 @@ function OhhwellsBridge() {
|
|
|
30571
30874
|
};
|
|
30572
30875
|
const handleMouseMove = (e) => {
|
|
30573
30876
|
const { clientX, clientY } = e;
|
|
30574
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30877
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30878
|
+
dismissImageHover();
|
|
30879
|
+
clearImageHover();
|
|
30880
|
+
return;
|
|
30881
|
+
}
|
|
30575
30882
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30576
30883
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30577
30884
|
formHoverElRef.current = null;
|
|
@@ -30600,7 +30907,12 @@ function OhhwellsBridge() {
|
|
|
30600
30907
|
setHoveredItemRect(null);
|
|
30601
30908
|
hoveredNavContainerRef.current = null;
|
|
30602
30909
|
setHoveredNavContainerRect(null);
|
|
30910
|
+
siblingHintElRef.current = null;
|
|
30911
|
+
setSiblingHintRect(null);
|
|
30912
|
+
setSiblingHintRects([]);
|
|
30603
30913
|
dismissImageHover();
|
|
30914
|
+
clearImageHover();
|
|
30915
|
+
setSectionGap(null);
|
|
30604
30916
|
return;
|
|
30605
30917
|
}
|
|
30606
30918
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30612,7 +30924,11 @@ function OhhwellsBridge() {
|
|
|
30612
30924
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30613
30925
|
const { clientX, clientY } = e.data;
|
|
30614
30926
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30615
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30927
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30928
|
+
dismissImageHover();
|
|
30929
|
+
clearImageHover();
|
|
30930
|
+
return;
|
|
30931
|
+
}
|
|
30616
30932
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30617
30933
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30618
30934
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30992,6 +31308,7 @@ function OhhwellsBridge() {
|
|
|
30992
31308
|
applyAiFooterFromContent(content);
|
|
30993
31309
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30994
31310
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31311
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30995
31312
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30996
31313
|
}
|
|
30997
31314
|
applyBrandChrome(content);
|
|
@@ -31006,15 +31323,16 @@ function OhhwellsBridge() {
|
|
|
31006
31323
|
}
|
|
31007
31324
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31008
31325
|
if (key === AI_FOOTER_KEY) continue;
|
|
31326
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31327
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31009
31328
|
if (key === BRAND_KIT_KEY) continue;
|
|
31010
31329
|
if (key === STYLE_STORE_KEY) continue;
|
|
31011
31330
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31012
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31013
31331
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31014
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31015
31332
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31016
31333
|
continue;
|
|
31017
31334
|
}
|
|
31335
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31018
31336
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31019
31337
|
if (applyCarouselNode(key, val)) continue;
|
|
31020
31338
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31040,6 +31358,7 @@ function OhhwellsBridge() {
|
|
|
31040
31358
|
});
|
|
31041
31359
|
applyLinkByKey(key, val);
|
|
31042
31360
|
}
|
|
31361
|
+
applySectionEmbeds(content);
|
|
31043
31362
|
applyLogoFromContent(content);
|
|
31044
31363
|
applyLogoSizes(content);
|
|
31045
31364
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31054,6 +31373,7 @@ function OhhwellsBridge() {
|
|
|
31054
31373
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
31055
31374
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
31056
31375
|
syncButtonsFromContent(document, editContentRef.current);
|
|
31376
|
+
if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
|
|
31057
31377
|
syncNavigationDragCursorAttrs();
|
|
31058
31378
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31059
31379
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -31485,6 +31805,7 @@ function OhhwellsBridge() {
|
|
|
31485
31805
|
const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
|
|
31486
31806
|
const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
|
|
31487
31807
|
if (!instanceId || !direction) return;
|
|
31808
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
31488
31809
|
const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
|
|
31489
31810
|
if (!entries) return;
|
|
31490
31811
|
const orderJson = JSON.stringify(
|
|
@@ -31493,7 +31814,12 @@ function OhhwellsBridge() {
|
|
|
31493
31814
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
31494
31815
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
31495
31816
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
31496
|
-
postToParentRef.current({
|
|
31817
|
+
postToParentRef.current({
|
|
31818
|
+
type: "ow:change",
|
|
31819
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
31820
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
31821
|
+
moved: instanceId
|
|
31822
|
+
});
|
|
31497
31823
|
window.dispatchEvent(new Event("resize"));
|
|
31498
31824
|
};
|
|
31499
31825
|
window.addEventListener("message", handleMoveSection);
|
|
@@ -31672,6 +31998,12 @@ function OhhwellsBridge() {
|
|
|
31672
31998
|
closeLinkPopoverRef.current();
|
|
31673
31999
|
return;
|
|
31674
32000
|
}
|
|
32001
|
+
if (floatingPanelOpenRef.current) {
|
|
32002
|
+
setFloatingPanelRef.current(null);
|
|
32003
|
+
deselectRef.current();
|
|
32004
|
+
deactivateRef.current();
|
|
32005
|
+
return;
|
|
32006
|
+
}
|
|
31675
32007
|
deselectRef.current();
|
|
31676
32008
|
deactivateRef.current();
|
|
31677
32009
|
clearMediaSelectionRef.current();
|
|
@@ -31856,12 +32188,6 @@ function OhhwellsBridge() {
|
|
|
31856
32188
|
return;
|
|
31857
32189
|
}
|
|
31858
32190
|
}
|
|
31859
|
-
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !activeElRef.current) {
|
|
31860
|
-
if (runPendingDeleteUndoRef.current()) {
|
|
31861
|
-
e.preventDefault();
|
|
31862
|
-
return;
|
|
31863
|
-
}
|
|
31864
|
-
}
|
|
31865
32191
|
if (e.key !== "Escape") return;
|
|
31866
32192
|
const el = activeElRef.current;
|
|
31867
32193
|
if (el && originalContentRef.current !== null) {
|
|
@@ -32508,10 +32834,10 @@ function OhhwellsBridge() {
|
|
|
32508
32834
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32509
32835
|
window.removeEventListener("message", handleDeactivate);
|
|
32510
32836
|
window.removeEventListener("message", handleSelectNav);
|
|
32511
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32512
32837
|
window.removeEventListener("message", handleToastAction);
|
|
32513
32838
|
window.removeEventListener("message", handleFormCount);
|
|
32514
32839
|
window.removeEventListener("message", handleUiEscape);
|
|
32840
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32515
32841
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32516
32842
|
autoSaveTimers.current.clear();
|
|
32517
32843
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32805,7 +33131,7 @@ function OhhwellsBridge() {
|
|
|
32805
33131
|
postToParent2({
|
|
32806
33132
|
type: "ow:ready",
|
|
32807
33133
|
version: "1",
|
|
32808
|
-
bridgeVersion: "0.1.
|
|
33134
|
+
bridgeVersion: "0.1.169-next.449",
|
|
32809
33135
|
path: pathname,
|
|
32810
33136
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32811
33137
|
sections
|
|
@@ -33006,7 +33332,7 @@ function OhhwellsBridge() {
|
|
|
33006
33332
|
const copyHref = result.copy.getAttribute("data-ohw-href-key");
|
|
33007
33333
|
const copyHrefVal = copyHref ? result.content[copyHref] : void 0;
|
|
33008
33334
|
if (copyHref && copyHrefVal !== void 0) applyLinkByKey(copyHref, copyHrefVal);
|
|
33009
|
-
postToParent2({ type: "ow:change", nodes: result.nodes });
|
|
33335
|
+
postToParent2({ type: "ow:change", nodes: result.nodes, label: "Button duplicated" });
|
|
33010
33336
|
enforceLinkHrefs();
|
|
33011
33337
|
requestAnimationFrame(() => {
|
|
33012
33338
|
selectRef.current(result.copy);
|
|
@@ -33055,7 +33381,7 @@ function OhhwellsBridge() {
|
|
|
33055
33381
|
...editContentRef.current,
|
|
33056
33382
|
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
33057
33383
|
};
|
|
33058
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33384
|
+
postToParent2({ type: "ow:change", nodes, label: "Social icon duplicated" });
|
|
33059
33385
|
enforceLinkHrefs();
|
|
33060
33386
|
const copyRow = findSocialsRow(result.item);
|
|
33061
33387
|
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
@@ -33105,7 +33431,7 @@ function OhhwellsBridge() {
|
|
|
33105
33431
|
[NAV_COUNT_KEY]: navCount,
|
|
33106
33432
|
[NAV_ORDER_KEY]: result.orderJson
|
|
33107
33433
|
};
|
|
33108
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33434
|
+
postToParent2({ type: "ow:change", nodes, label: "Link duplicated" });
|
|
33109
33435
|
enforceLinkHrefs();
|
|
33110
33436
|
if (isNestedNavChild(selected) || navItemOwnsDropdownPanel(selected)) {
|
|
33111
33437
|
setNavGroupForceOpen(selected, true);
|
|
@@ -33145,7 +33471,8 @@ function OhhwellsBridge() {
|
|
|
33145
33471
|
{ key: result.hrefKey, text: result.href },
|
|
33146
33472
|
{ key: result.labelKey, text: result.label },
|
|
33147
33473
|
{ key: FOOTER_ORDER_KEY, text: orderJson }
|
|
33148
|
-
]
|
|
33474
|
+
],
|
|
33475
|
+
label: "Link duplicated"
|
|
33149
33476
|
});
|
|
33150
33477
|
enforceLinkHrefs();
|
|
33151
33478
|
requestAnimationFrame(() => {
|