@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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as
|
|
4
|
+
import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
|
|
5
5
|
import { createRoot as createRoot3 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync3 } from "react-dom";
|
|
7
7
|
|
|
@@ -189,6 +189,19 @@ function parseSectionsFromHtml(html) {
|
|
|
189
189
|
return parseSectionsFromRoot(doc);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
// src/lib/soft-hide.ts
|
|
193
|
+
var PREV_DISPLAY_ATTR = "data-ohw-prev-display";
|
|
194
|
+
function softHide(el) {
|
|
195
|
+
if (!el.hasAttribute(PREV_DISPLAY_ATTR)) el.setAttribute(PREV_DISPLAY_ATTR, el.style.display);
|
|
196
|
+
el.style.display = "none";
|
|
197
|
+
}
|
|
198
|
+
function softUnhide(el) {
|
|
199
|
+
const prev = el.getAttribute(PREV_DISPLAY_ATTR);
|
|
200
|
+
el.removeAttribute(PREV_DISPLAY_ATTR);
|
|
201
|
+
if (prev) el.style.display = prev;
|
|
202
|
+
else el.style.removeProperty("display");
|
|
203
|
+
}
|
|
204
|
+
|
|
192
205
|
// src/lib/section-instances.ts
|
|
193
206
|
var SECTION_ORDER_KEY = "__ohw_section_order";
|
|
194
207
|
var REMOVED_ATTR = "data-ohw-section-removed";
|
|
@@ -260,14 +273,14 @@ function syncRemovedFlags(entries) {
|
|
|
260
273
|
const removedIds = new Set(entries.filter((e) => e.removed).map((e) => e.instanceId));
|
|
261
274
|
document.querySelectorAll(`[${REMOVED_ATTR}]`).forEach((el) => {
|
|
262
275
|
if (!removedIds.has(instanceIdOf(el))) {
|
|
263
|
-
el
|
|
276
|
+
softUnhide(el);
|
|
264
277
|
el.removeAttribute(REMOVED_ATTR);
|
|
265
278
|
}
|
|
266
279
|
});
|
|
267
280
|
for (const id of removedIds) {
|
|
268
281
|
const el = findByInstanceId(id);
|
|
269
282
|
if (el) {
|
|
270
|
-
el
|
|
283
|
+
softHide(el);
|
|
271
284
|
el.setAttribute(REMOVED_ATTR, "");
|
|
272
285
|
}
|
|
273
286
|
}
|
|
@@ -339,6 +352,15 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
|
|
|
339
352
|
function newInstanceId() {
|
|
340
353
|
return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `instance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
341
354
|
}
|
|
355
|
+
function orderBeforeMove(raw, currentPath) {
|
|
356
|
+
const entries = topLevelSections().map((el, order) => ({
|
|
357
|
+
instanceId: instanceIdOf(el),
|
|
358
|
+
type: sectionTypeOf(el),
|
|
359
|
+
order,
|
|
360
|
+
pagePath: currentPath
|
|
361
|
+
}));
|
|
362
|
+
return JSON.stringify(mergePageSectionOrder(raw, currentPath, entries));
|
|
363
|
+
}
|
|
342
364
|
function getPageSectionOrderEntries(raw, currentPath) {
|
|
343
365
|
if (!raw) return [];
|
|
344
366
|
try {
|
|
@@ -1098,21 +1120,21 @@ function chromeFrom(sample) {
|
|
|
1098
1120
|
};
|
|
1099
1121
|
}
|
|
1100
1122
|
function filledPrimary(seed) {
|
|
1101
|
-
const
|
|
1102
|
-
const luminance = relativeLuminance(
|
|
1123
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1124
|
+
const luminance = relativeLuminance(paint2);
|
|
1103
1125
|
return {
|
|
1104
|
-
background: toCss({ ...
|
|
1126
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1105
1127
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1106
1128
|
borderColor: TRANSPARENT,
|
|
1107
1129
|
borderWidth: "0px"
|
|
1108
1130
|
};
|
|
1109
1131
|
}
|
|
1110
1132
|
function generatedSecondary(primary) {
|
|
1111
|
-
const
|
|
1133
|
+
const paint2 = accentColor(primary);
|
|
1112
1134
|
return {
|
|
1113
1135
|
background: TRANSPARENT,
|
|
1114
|
-
color:
|
|
1115
|
-
borderColor:
|
|
1136
|
+
color: paint2,
|
|
1137
|
+
borderColor: paint2,
|
|
1116
1138
|
borderWidth: "1px"
|
|
1117
1139
|
};
|
|
1118
1140
|
}
|
|
@@ -1125,9 +1147,9 @@ function generatedGhost(primary) {
|
|
|
1125
1147
|
};
|
|
1126
1148
|
}
|
|
1127
1149
|
function normalizeOutlineChrome(outline, primary) {
|
|
1128
|
-
const
|
|
1150
|
+
const paint2 = accentColor(primary);
|
|
1129
1151
|
const text = parseColor(outline.color);
|
|
1130
|
-
const paintRgb = parseColor(
|
|
1152
|
+
const paintRgb = parseColor(paint2);
|
|
1131
1153
|
const primaryLabel = parseColor(primary.color);
|
|
1132
1154
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1133
1155
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1136,8 +1158,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1136
1158
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1137
1159
|
return {
|
|
1138
1160
|
...outline,
|
|
1139
|
-
color:
|
|
1140
|
-
borderColor: hasBorder ?
|
|
1161
|
+
color: paint2,
|
|
1162
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1141
1163
|
};
|
|
1142
1164
|
}
|
|
1143
1165
|
function generateButtonVariants(samples) {
|
|
@@ -1556,6 +1578,8 @@ function brandTrackedFontFamily(doc, stack) {
|
|
|
1556
1578
|
}
|
|
1557
1579
|
var paintLockByEl = /* @__PURE__ */ new WeakMap();
|
|
1558
1580
|
var paintObserverByEl = /* @__PURE__ */ new WeakMap();
|
|
1581
|
+
var prePaintByEl = /* @__PURE__ */ new WeakMap();
|
|
1582
|
+
var paintedEls = /* @__PURE__ */ new Set();
|
|
1559
1583
|
var PAINT_GUARD_ATTRS = {
|
|
1560
1584
|
attributes: true,
|
|
1561
1585
|
attributeFilter: ["style", "class"]
|
|
@@ -1619,6 +1643,18 @@ function paintedTokensOf(el) {
|
|
|
1619
1643
|
}
|
|
1620
1644
|
function applyButtonStyle(el, assignment, tokens) {
|
|
1621
1645
|
const doc = el.ownerDocument;
|
|
1646
|
+
if (!prePaintByEl.has(el)) {
|
|
1647
|
+
const label = labelElement(el);
|
|
1648
|
+
const ownLabel = label && label !== el ? label : null;
|
|
1649
|
+
prePaintByEl.set(el, {
|
|
1650
|
+
style: el.getAttribute("style"),
|
|
1651
|
+
variant: el.getAttribute("data-ohw-btn-variant"),
|
|
1652
|
+
size: el.getAttribute("data-ohw-btn-size"),
|
|
1653
|
+
label: ownLabel,
|
|
1654
|
+
labelStyle: ownLabel?.getAttribute("style") ?? null
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
paintedEls.add(el);
|
|
1622
1658
|
const tracked = {
|
|
1623
1659
|
...tokens,
|
|
1624
1660
|
variants: {
|
|
@@ -1638,6 +1674,31 @@ function applyButtonStylesFromContent(doc, content) {
|
|
|
1638
1674
|
if (!el) continue;
|
|
1639
1675
|
applyButtonStyle(el, assignment, tokensFromButton(el));
|
|
1640
1676
|
}
|
|
1677
|
+
for (const el of paintedEls) {
|
|
1678
|
+
if (!el.isConnected) {
|
|
1679
|
+
paintedEls.delete(el);
|
|
1680
|
+
continue;
|
|
1681
|
+
}
|
|
1682
|
+
const id = buttonId(el);
|
|
1683
|
+
if (el.ownerDocument === doc && (!id || !assignments[id])) unpaintButton(el);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
function unpaintButton(el) {
|
|
1687
|
+
paintObserverByEl.get(el)?.disconnect();
|
|
1688
|
+
paintObserverByEl.delete(el);
|
|
1689
|
+
paintLockByEl.delete(el);
|
|
1690
|
+
paintedEls.delete(el);
|
|
1691
|
+
const before = prePaintByEl.get(el);
|
|
1692
|
+
prePaintByEl.delete(el);
|
|
1693
|
+
if (!before) return;
|
|
1694
|
+
const restore = (target, name, value) => {
|
|
1695
|
+
if (value === null) target.removeAttribute(name);
|
|
1696
|
+
else target.setAttribute(name, value);
|
|
1697
|
+
};
|
|
1698
|
+
restore(el, "style", before.style);
|
|
1699
|
+
restore(el, "data-ohw-btn-variant", before.variant);
|
|
1700
|
+
restore(el, "data-ohw-btn-size", before.size);
|
|
1701
|
+
if (before.label?.isConnected) restore(before.label, "style", before.labelStyle);
|
|
1641
1702
|
}
|
|
1642
1703
|
function withAssignment(content, id, assignment) {
|
|
1643
1704
|
return { ...readAssignments(content), [id]: assignment };
|
|
@@ -2188,6 +2249,7 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2188
2249
|
}
|
|
2189
2250
|
const snapshots = readSnapshots(content);
|
|
2190
2251
|
const collections = readCollections(content);
|
|
2252
|
+
dropUnsavedCopies(doc, snapshots, collections);
|
|
2191
2253
|
for (const collectionState of Object.values(collections)) {
|
|
2192
2254
|
const live = collectionState.members.map((id) => findButton(doc, id) ?? restoreSnapshot(doc, snapshots[id], content)).filter((el) => Boolean(el && !hidden.has(buttonId(el) ?? "")));
|
|
2193
2255
|
if (live.length === 0) continue;
|
|
@@ -2212,6 +2274,18 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2212
2274
|
for (const member of live) setButtonDragAttr(member);
|
|
2213
2275
|
}
|
|
2214
2276
|
}
|
|
2277
|
+
function dropUnsavedCopies(doc, snapshots, collections) {
|
|
2278
|
+
const stale = Array.from(doc.querySelectorAll('[data-ohw-href-key*="-copy-"]')).filter((el) => {
|
|
2279
|
+
const id = buttonId(el);
|
|
2280
|
+
return Boolean(id && /-copy-\d+-href$/.test(id) && !snapshots[id]);
|
|
2281
|
+
});
|
|
2282
|
+
for (const el of stale) {
|
|
2283
|
+
const collection = buttonCollectionOf(el);
|
|
2284
|
+
el.remove();
|
|
2285
|
+
const id = collection?.getAttribute(COLLECTION_ATTR) ?? "";
|
|
2286
|
+
if (collection && !collections[id] && listCollectionMembers(collection).length <= 1) unwrapCollection(collection);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2215
2289
|
function restoreSnapshot(doc, snapshot, content) {
|
|
2216
2290
|
if (!snapshot) return null;
|
|
2217
2291
|
const existing = findButton(doc, snapshot.id);
|
|
@@ -5665,10 +5739,10 @@ function rekeyItemClone(clone, source, sibling, group, newIndex) {
|
|
|
5665
5739
|
function setRemoved(el, removed) {
|
|
5666
5740
|
if (removed) {
|
|
5667
5741
|
el.setAttribute(ITEM_REMOVED_ATTR, "");
|
|
5668
|
-
el
|
|
5742
|
+
softHide(el);
|
|
5669
5743
|
} else if (el.hasAttribute(ITEM_REMOVED_ATTR)) {
|
|
5670
5744
|
el.removeAttribute(ITEM_REMOVED_ATTR);
|
|
5671
|
-
el
|
|
5745
|
+
softUnhide(el);
|
|
5672
5746
|
}
|
|
5673
5747
|
}
|
|
5674
5748
|
function seedState(group) {
|
|
@@ -6678,6 +6752,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6678
6752
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6679
6753
|
return target ? pricingFeatureList(target).length : 0;
|
|
6680
6754
|
}
|
|
6755
|
+
function prevailingFeatureIcon(features) {
|
|
6756
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6757
|
+
for (const row of features) {
|
|
6758
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6759
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6760
|
+
entry.count += 1;
|
|
6761
|
+
counts.set(key, entry);
|
|
6762
|
+
}
|
|
6763
|
+
let best = null;
|
|
6764
|
+
for (const entry of counts.values()) {
|
|
6765
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6766
|
+
}
|
|
6767
|
+
if (!best) return {};
|
|
6768
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6769
|
+
}
|
|
6681
6770
|
function addPricingCardFeature(tree, index, text) {
|
|
6682
6771
|
return withPricingCollection(tree, (collection) => {
|
|
6683
6772
|
const children = collection.children;
|
|
@@ -6686,7 +6775,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6686
6775
|
const features = pricingFeatureList(target);
|
|
6687
6776
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6688
6777
|
target.slots = target.slots ?? {};
|
|
6689
|
-
target.slots.features = [...features, { text }];
|
|
6778
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6690
6779
|
return true;
|
|
6691
6780
|
});
|
|
6692
6781
|
}
|
|
@@ -7330,6 +7419,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7330
7419
|
);
|
|
7331
7420
|
}
|
|
7332
7421
|
|
|
7422
|
+
// src/lib/youtube.ts
|
|
7423
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7424
|
+
function extractYouTubeId(input) {
|
|
7425
|
+
const trimmed = input.trim();
|
|
7426
|
+
if (!trimmed) return null;
|
|
7427
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7428
|
+
let url;
|
|
7429
|
+
try {
|
|
7430
|
+
url = new URL(trimmed);
|
|
7431
|
+
} catch {
|
|
7432
|
+
return null;
|
|
7433
|
+
}
|
|
7434
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7435
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7436
|
+
return null;
|
|
7437
|
+
}
|
|
7438
|
+
let candidate = null;
|
|
7439
|
+
if (host === "youtu.be") {
|
|
7440
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7441
|
+
} else if (url.pathname === "/watch") {
|
|
7442
|
+
candidate = url.searchParams.get("v");
|
|
7443
|
+
} else {
|
|
7444
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7445
|
+
candidate = match ? match[1] : null;
|
|
7446
|
+
}
|
|
7447
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7448
|
+
}
|
|
7449
|
+
|
|
7450
|
+
// src/lib/section-embed.ts
|
|
7451
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7452
|
+
function readStoredEmbed(value) {
|
|
7453
|
+
if (value.startsWith("start\n")) {
|
|
7454
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7455
|
+
}
|
|
7456
|
+
return { raw: value, at: "end" };
|
|
7457
|
+
}
|
|
7458
|
+
function embedFrameSrc(value) {
|
|
7459
|
+
const videoId = extractYouTubeId(value);
|
|
7460
|
+
if (videoId) {
|
|
7461
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7462
|
+
}
|
|
7463
|
+
let url;
|
|
7464
|
+
try {
|
|
7465
|
+
url = new URL(value);
|
|
7466
|
+
} catch {
|
|
7467
|
+
return null;
|
|
7468
|
+
}
|
|
7469
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7470
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7471
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7472
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7473
|
+
return { src, title: "Map" };
|
|
7474
|
+
}
|
|
7475
|
+
if (host === "maps.app.goo.gl") {
|
|
7476
|
+
return { src: value, title: "Map" };
|
|
7477
|
+
}
|
|
7478
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7479
|
+
return { src: value, title: "Calendar" };
|
|
7480
|
+
}
|
|
7481
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7482
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7483
|
+
}
|
|
7484
|
+
if (host === "forms.gle") {
|
|
7485
|
+
return { src: value, title: "Form" };
|
|
7486
|
+
}
|
|
7487
|
+
return null;
|
|
7488
|
+
}
|
|
7489
|
+
function place(section, box, at) {
|
|
7490
|
+
if (at === "start") {
|
|
7491
|
+
section.insertBefore(box, section.firstChild);
|
|
7492
|
+
return;
|
|
7493
|
+
}
|
|
7494
|
+
section.appendChild(box);
|
|
7495
|
+
}
|
|
7496
|
+
function paint(section, key, src, title, at) {
|
|
7497
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7498
|
+
const frame = existing?.querySelector("iframe");
|
|
7499
|
+
if (existing && frame) {
|
|
7500
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7501
|
+
frame.title = title;
|
|
7502
|
+
place(section, existing, at);
|
|
7503
|
+
return;
|
|
7504
|
+
}
|
|
7505
|
+
existing?.remove();
|
|
7506
|
+
const box = document.createElement("div");
|
|
7507
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7508
|
+
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;";
|
|
7509
|
+
const frameWrap = document.createElement("div");
|
|
7510
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7511
|
+
const iframe = document.createElement("iframe");
|
|
7512
|
+
iframe.src = src;
|
|
7513
|
+
iframe.title = title;
|
|
7514
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7515
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7516
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7517
|
+
frameWrap.appendChild(iframe);
|
|
7518
|
+
box.appendChild(frameWrap);
|
|
7519
|
+
place(section, box, at);
|
|
7520
|
+
}
|
|
7521
|
+
function applySectionEmbeds(content) {
|
|
7522
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7523
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7524
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7525
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7526
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7527
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7528
|
+
if (!section || !stored || !frame) {
|
|
7529
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7530
|
+
continue;
|
|
7531
|
+
}
|
|
7532
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7533
|
+
}
|
|
7534
|
+
}
|
|
7535
|
+
|
|
7333
7536
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7334
7537
|
import { flushSync } from "react-dom";
|
|
7335
7538
|
import { createRoot } from "react-dom/client";
|
|
@@ -7903,7 +8106,7 @@ var AI_MOBILE_CSS = [
|
|
|
7903
8106
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7904
8107
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7905
8108
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
7906
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8109
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7907
8110
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7908
8111
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7909
8112
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -7919,8 +8122,10 @@ var AI_MOBILE_CSS = [
|
|
|
7919
8122
|
"[data-ai-section]{overflow-x:hidden}",
|
|
7920
8123
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
7921
8124
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
7922
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
7923
|
-
|
|
8125
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8126
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8127
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8128
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
7924
8129
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
7925
8130
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
7926
8131
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8125,6 +8330,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8125
8330
|
function textAttrs(ctx, path) {
|
|
8126
8331
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8127
8332
|
}
|
|
8333
|
+
var AI_RESPONSIVE_CSS = [
|
|
8334
|
+
"@media (max-width: 960px) {",
|
|
8335
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8336
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8337
|
+
"}",
|
|
8338
|
+
"@media (max-width: 640px) {",
|
|
8339
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8340
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8341
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8342
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8343
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8344
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8345
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8346
|
+
// layered text used to be.
|
|
8347
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8348
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8349
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8350
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8351
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8352
|
+
// other rule had already been taught to stand down.
|
|
8353
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8354
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8355
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8356
|
+
"}"
|
|
8357
|
+
].join("\n");
|
|
8128
8358
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8129
8359
|
function MediaBox({
|
|
8130
8360
|
refValue,
|
|
@@ -8179,7 +8409,7 @@ function MediaBox({
|
|
|
8179
8409
|
position: fill ? "absolute" : void 0,
|
|
8180
8410
|
inset: fill ? 0 : void 0,
|
|
8181
8411
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8182
|
-
height: fill ? "100%" : void 0,
|
|
8412
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8183
8413
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8184
8414
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8185
8415
|
borderRadius: radius,
|
|
@@ -9675,7 +9905,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9675
9905
|
return /* @__PURE__ */ jsx(
|
|
9676
9906
|
"div",
|
|
9677
9907
|
{
|
|
9678
|
-
"data-ai-grid":
|
|
9908
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9679
9909
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9680
9910
|
style: {
|
|
9681
9911
|
display: "grid",
|
|
@@ -9977,7 +10207,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
9977
10207
|
},
|
|
9978
10208
|
children: [
|
|
9979
10209
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
9980
|
-
// The section's `data-ai-
|
|
10210
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
9981
10211
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
9982
10212
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
9983
10213
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10396,6 +10626,7 @@ function AiTreeRenderer({
|
|
|
10396
10626
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10397
10627
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10398
10628
|
...bgAttrs,
|
|
10629
|
+
"data-ai-responsive": "",
|
|
10399
10630
|
style: {
|
|
10400
10631
|
position: "relative",
|
|
10401
10632
|
padding: `${padCss} 0`,
|
|
@@ -10409,12 +10640,13 @@ function AiTreeRenderer({
|
|
|
10409
10640
|
...fillHeight ? { display: "grid" } : {}
|
|
10410
10641
|
},
|
|
10411
10642
|
children: [
|
|
10412
|
-
|
|
10643
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10413
10644
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
10645
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10414
10646
|
/* @__PURE__ */ jsx(
|
|
10415
10647
|
"div",
|
|
10416
10648
|
{
|
|
10417
|
-
"data-ai-
|
|
10649
|
+
"data-ai-section-inner": "",
|
|
10418
10650
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10419
10651
|
style: {
|
|
10420
10652
|
position: "relative",
|
|
@@ -10431,7 +10663,7 @@ function AiTreeRenderer({
|
|
|
10431
10663
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10432
10664
|
"div",
|
|
10433
10665
|
{
|
|
10434
|
-
"data-ai-
|
|
10666
|
+
"data-ai-columns": "",
|
|
10435
10667
|
style: {
|
|
10436
10668
|
display: "grid",
|
|
10437
10669
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11093,9 +11325,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11093
11325
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11094
11326
|
continue;
|
|
11095
11327
|
}
|
|
11096
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11097
11328
|
let container = existing?.container;
|
|
11329
|
+
let isNewMount = false;
|
|
11098
11330
|
if (!container || !container.isConnected) {
|
|
11331
|
+
isNewMount = true;
|
|
11099
11332
|
existing?.root.unmount();
|
|
11100
11333
|
container?.remove();
|
|
11101
11334
|
container = document.createElement("div");
|
|
@@ -11433,6 +11666,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11433
11666
|
return 3;
|
|
11434
11667
|
}
|
|
11435
11668
|
}
|
|
11669
|
+
function readLiveSocialItems() {
|
|
11670
|
+
const root = getFooterRoot();
|
|
11671
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11672
|
+
if (!row) return [];
|
|
11673
|
+
const items = [];
|
|
11674
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11675
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11676
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11677
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11678
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11679
|
+
items.push({ platform, href });
|
|
11680
|
+
}
|
|
11681
|
+
return items;
|
|
11682
|
+
}
|
|
11683
|
+
function syncSocialRowsFromDom(tree) {
|
|
11684
|
+
const root = getFooterRoot();
|
|
11685
|
+
if (!root) return;
|
|
11686
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11687
|
+
const live = readLiveSocialItems();
|
|
11688
|
+
if (row && live.length === 0) return;
|
|
11689
|
+
for (const col of tree.columns) {
|
|
11690
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11691
|
+
if (block.type !== "social-row") return [block];
|
|
11692
|
+
if (!row) return [];
|
|
11693
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11694
|
+
});
|
|
11695
|
+
}
|
|
11696
|
+
}
|
|
11436
11697
|
function collectBrandBlocks(tree) {
|
|
11437
11698
|
const brand = [];
|
|
11438
11699
|
for (const col of tree.columns) {
|
|
@@ -11678,6 +11939,7 @@ function textOf2(el) {
|
|
|
11678
11939
|
}
|
|
11679
11940
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11680
11941
|
const next = cloneTree(tree);
|
|
11942
|
+
syncSocialRowsFromDom(next);
|
|
11681
11943
|
const domCols = listFooterColumns().map((col) => {
|
|
11682
11944
|
const heading = getFooterColumnHeadingEl(col);
|
|
11683
11945
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -17490,7 +17752,7 @@ function apiBase() {
|
|
|
17490
17752
|
function bridgeVersion() {
|
|
17491
17753
|
try {
|
|
17492
17754
|
if (true) {
|
|
17493
|
-
return "0.1.
|
|
17755
|
+
return "0.1.169-next.449";
|
|
17494
17756
|
}
|
|
17495
17757
|
} catch {
|
|
17496
17758
|
}
|
|
@@ -17504,7 +17766,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17504
17766
|
return;
|
|
17505
17767
|
}
|
|
17506
17768
|
try {
|
|
17507
|
-
const v = true ? "0.1.
|
|
17769
|
+
const v = true ? "0.1.169-next.449" : "";
|
|
17508
17770
|
if (v) {
|
|
17509
17771
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17510
17772
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18182,6 +18444,7 @@ function MediaOverlay({
|
|
|
18182
18444
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18183
18445
|
);
|
|
18184
18446
|
}, [isVideo]);
|
|
18447
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18185
18448
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18186
18449
|
const box = {
|
|
18187
18450
|
position: "fixed",
|
|
@@ -18280,11 +18543,10 @@ function MediaOverlay({
|
|
|
18280
18543
|
className: "flex items-center justify-center cursor-pointer",
|
|
18281
18544
|
style: {
|
|
18282
18545
|
...box,
|
|
18283
|
-
//
|
|
18284
|
-
//
|
|
18285
|
-
//
|
|
18286
|
-
|
|
18287
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18546
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18547
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18548
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18549
|
+
pointerEvents: "none",
|
|
18288
18550
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18289
18551
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18290
18552
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18311,17 +18573,17 @@ function MediaOverlay({
|
|
|
18311
18573
|
},
|
|
18312
18574
|
children: [
|
|
18313
18575
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18314
|
-
|
|
18576
|
+
replaceLabel
|
|
18315
18577
|
]
|
|
18316
18578
|
}
|
|
18317
18579
|
),
|
|
18318
|
-
replaceMode
|
|
18580
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18319
18581
|
Button,
|
|
18320
18582
|
{
|
|
18321
18583
|
"data-ohw-media-overlay": "",
|
|
18322
18584
|
variant: "outline",
|
|
18323
18585
|
size: "sm",
|
|
18324
|
-
"aria-label":
|
|
18586
|
+
"aria-label": replaceLabel,
|
|
18325
18587
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18326
18588
|
style: {
|
|
18327
18589
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18344,7 +18606,7 @@ function MediaOverlay({
|
|
|
18344
18606
|
},
|
|
18345
18607
|
children: [
|
|
18346
18608
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18347
|
-
replaceMode === "full" ?
|
|
18609
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18348
18610
|
]
|
|
18349
18611
|
}
|
|
18350
18612
|
)
|
|
@@ -18486,7 +18748,13 @@ function highlightChangedElements(keys, item, sectionId) {
|
|
|
18486
18748
|
clearTimer = setTimeout(clearChangeHighlight, HIGHLIGHT_MS);
|
|
18487
18749
|
return targets.length;
|
|
18488
18750
|
}
|
|
18489
|
-
function
|
|
18751
|
+
function highlightedRect() {
|
|
18752
|
+
const first = document.querySelector(`[${MARK_ATTR}]`);
|
|
18753
|
+
if (!first) return null;
|
|
18754
|
+
const rect = first.getBoundingClientRect();
|
|
18755
|
+
return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
|
|
18756
|
+
}
|
|
18757
|
+
function installAiChangeHighlight(select) {
|
|
18490
18758
|
const onMessage = (e) => {
|
|
18491
18759
|
const data = e.data;
|
|
18492
18760
|
if (data?.type !== "ow:ai-highlight") return;
|
|
@@ -18495,12 +18763,37 @@ function installAiChangeHighlight() {
|
|
|
18495
18763
|
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;
|
|
18496
18764
|
const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
|
|
18497
18765
|
const found = highlightChangedElements(keys, item, sectionId);
|
|
18498
|
-
|
|
18766
|
+
const first = data.select === true ? document.querySelector(`[${MARK_ATTR}]`) : null;
|
|
18767
|
+
if (first) select?.(first);
|
|
18768
|
+
const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
|
|
18769
|
+
window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
|
|
18499
18770
|
};
|
|
18500
18771
|
window.addEventListener("message", onMessage);
|
|
18501
18772
|
return () => window.removeEventListener("message", onMessage);
|
|
18502
18773
|
}
|
|
18503
18774
|
|
|
18775
|
+
// src/lib/history-key-relay.ts
|
|
18776
|
+
var isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent);
|
|
18777
|
+
function historyActionFor(e, mac = isMac()) {
|
|
18778
|
+
const mod = mac ? e.metaKey : e.ctrlKey;
|
|
18779
|
+
if (!mod || e.altKey) return null;
|
|
18780
|
+
const key = e.key.toLowerCase();
|
|
18781
|
+
if (key === "z") return e.shiftKey ? "redo" : "undo";
|
|
18782
|
+
if (key === "y" && !mac) return "redo";
|
|
18783
|
+
return null;
|
|
18784
|
+
}
|
|
18785
|
+
var isEditingText = (el) => !!el && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLElement && el.isContentEditable);
|
|
18786
|
+
function installHistoryKeyRelay() {
|
|
18787
|
+
const onKeyDown = (e) => {
|
|
18788
|
+
const action = historyActionFor(e);
|
|
18789
|
+
if (!action || isEditingText(document.activeElement)) return;
|
|
18790
|
+
e.preventDefault();
|
|
18791
|
+
window.parent?.postMessage({ type: "ow:history-key", action }, "*");
|
|
18792
|
+
};
|
|
18793
|
+
window.addEventListener("keydown", onKeyDown);
|
|
18794
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
18795
|
+
}
|
|
18796
|
+
|
|
18504
18797
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18505
18798
|
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
18506
18799
|
var findSectionElement = findByInstanceId;
|
|
@@ -18753,7 +19046,8 @@ function AiSectionOverlay({
|
|
|
18753
19046
|
window.addEventListener("message", onMessage);
|
|
18754
19047
|
return () => window.removeEventListener("message", onMessage);
|
|
18755
19048
|
}, [postToParent2]);
|
|
18756
|
-
useEffect8(() => installAiChangeHighlight(), []);
|
|
19049
|
+
useEffect8(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
|
|
19050
|
+
useEffect8(() => installHistoryKeyRelay(), []);
|
|
18757
19051
|
const [hoveredId, setHoveredId] = useState7(null);
|
|
18758
19052
|
useEffect8(() => {
|
|
18759
19053
|
const onMove = (e) => {
|
|
@@ -18943,8 +19237,24 @@ function AiSectionOverlay({
|
|
|
18943
19237
|
}
|
|
18944
19238
|
|
|
18945
19239
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18946
|
-
import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
|
|
18947
|
-
import {
|
|
19240
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
19241
|
+
import {
|
|
19242
|
+
AlignCenter,
|
|
19243
|
+
AlignLeft,
|
|
19244
|
+
AlignRight,
|
|
19245
|
+
ArrowLeft as ArrowLeft2,
|
|
19246
|
+
ArrowRight as ArrowRight2,
|
|
19247
|
+
Check as Check2,
|
|
19248
|
+
ChevronDown as ChevronDown3,
|
|
19249
|
+
Image as ImageIcon2,
|
|
19250
|
+
ImageMinus,
|
|
19251
|
+
ImagePlus,
|
|
19252
|
+
Link as LinkIcon,
|
|
19253
|
+
Minus,
|
|
19254
|
+
Palette,
|
|
19255
|
+
Plus as Plus2,
|
|
19256
|
+
Star
|
|
19257
|
+
} from "lucide-react";
|
|
18948
19258
|
|
|
18949
19259
|
// src/lib/ai-media-strip-tree.ts
|
|
18950
19260
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19058,14 +19368,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19058
19368
|
return true;
|
|
19059
19369
|
});
|
|
19060
19370
|
}
|
|
19061
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19062
|
-
return withMediaStrip(tree, (block) => {
|
|
19063
|
-
const items = block.items;
|
|
19064
|
-
if (index < 0 || index >= items.length) return false;
|
|
19065
|
-
items[index] = { ...items[index], alt };
|
|
19066
|
-
return true;
|
|
19067
|
-
});
|
|
19068
|
-
}
|
|
19069
19371
|
function setMediaStripItemLink(tree, index, link) {
|
|
19070
19372
|
return withMediaStrip(tree, (block) => {
|
|
19071
19373
|
const items = block.items;
|
|
@@ -19083,11 +19385,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19083
19385
|
});
|
|
19084
19386
|
}
|
|
19085
19387
|
|
|
19388
|
+
// src/ui/dialog.tsx
|
|
19389
|
+
import * as React9 from "react";
|
|
19390
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19391
|
+
import { X as X2 } from "lucide-react";
|
|
19392
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19393
|
+
function Dialog2({
|
|
19394
|
+
...props
|
|
19395
|
+
}) {
|
|
19396
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19397
|
+
}
|
|
19398
|
+
function DialogPortal({
|
|
19399
|
+
...props
|
|
19400
|
+
}) {
|
|
19401
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19402
|
+
}
|
|
19403
|
+
function DialogOverlay({
|
|
19404
|
+
className,
|
|
19405
|
+
...props
|
|
19406
|
+
}) {
|
|
19407
|
+
return /* @__PURE__ */ jsx20(
|
|
19408
|
+
DialogPrimitive.Overlay,
|
|
19409
|
+
{
|
|
19410
|
+
"data-slot": "dialog-overlay",
|
|
19411
|
+
"data-ohw-link-modal-root": "",
|
|
19412
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19413
|
+
...props
|
|
19414
|
+
}
|
|
19415
|
+
);
|
|
19416
|
+
}
|
|
19417
|
+
var DialogContent = React9.forwardRef(
|
|
19418
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19419
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19420
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19421
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19422
|
+
/* @__PURE__ */ jsxs11(
|
|
19423
|
+
DialogPrimitive.Content,
|
|
19424
|
+
{
|
|
19425
|
+
ref,
|
|
19426
|
+
"data-slot": "dialog-content",
|
|
19427
|
+
className: cn(
|
|
19428
|
+
positionMode,
|
|
19429
|
+
"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",
|
|
19430
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19431
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19432
|
+
className
|
|
19433
|
+
),
|
|
19434
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19435
|
+
...props,
|
|
19436
|
+
children: [
|
|
19437
|
+
children,
|
|
19438
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19439
|
+
DialogPrimitive.Close,
|
|
19440
|
+
{
|
|
19441
|
+
type: "button",
|
|
19442
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19443
|
+
"aria-label": "Close",
|
|
19444
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19445
|
+
}
|
|
19446
|
+
) : null
|
|
19447
|
+
]
|
|
19448
|
+
}
|
|
19449
|
+
)
|
|
19450
|
+
] });
|
|
19451
|
+
}
|
|
19452
|
+
);
|
|
19453
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19454
|
+
function DialogHeader({
|
|
19455
|
+
className,
|
|
19456
|
+
...props
|
|
19457
|
+
}) {
|
|
19458
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19459
|
+
}
|
|
19460
|
+
function DialogFooter({
|
|
19461
|
+
className,
|
|
19462
|
+
...props
|
|
19463
|
+
}) {
|
|
19464
|
+
return /* @__PURE__ */ jsx20(
|
|
19465
|
+
"div",
|
|
19466
|
+
{
|
|
19467
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19468
|
+
...props
|
|
19469
|
+
}
|
|
19470
|
+
);
|
|
19471
|
+
}
|
|
19472
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19473
|
+
DialogPrimitive.Title,
|
|
19474
|
+
{
|
|
19475
|
+
ref,
|
|
19476
|
+
className: cn(
|
|
19477
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19478
|
+
className
|
|
19479
|
+
),
|
|
19480
|
+
...props
|
|
19481
|
+
}
|
|
19482
|
+
));
|
|
19483
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19484
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19485
|
+
DialogPrimitive.Description,
|
|
19486
|
+
{
|
|
19487
|
+
ref,
|
|
19488
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19489
|
+
...props
|
|
19490
|
+
}
|
|
19491
|
+
));
|
|
19492
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19493
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19494
|
+
|
|
19086
19495
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19087
|
-
import { Fragment as Fragment7, jsx as
|
|
19088
|
-
var PRIMARY3 = "#0885FE";
|
|
19089
|
-
var
|
|
19090
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19496
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19497
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19498
|
+
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]";
|
|
19091
19499
|
function findMediaStripItemElement(sectionId, index) {
|
|
19092
19500
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19093
19501
|
if (!sectionEl2) return null;
|
|
@@ -19097,14 +19505,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19097
19505
|
}
|
|
19098
19506
|
return null;
|
|
19099
19507
|
}
|
|
19100
|
-
function
|
|
19101
|
-
|
|
19508
|
+
function itemRefFromTarget(target) {
|
|
19509
|
+
if (!(target instanceof Element)) return null;
|
|
19510
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19511
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19512
|
+
if (!itemEl) return null;
|
|
19513
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19514
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19515
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19516
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19517
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19518
|
+
return { sectionId, index };
|
|
19519
|
+
}
|
|
19520
|
+
function sameRef(a, b) {
|
|
19521
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19522
|
+
}
|
|
19523
|
+
function rectOf(el) {
|
|
19102
19524
|
if (!el) return null;
|
|
19103
19525
|
const r2 = el.getBoundingClientRect();
|
|
19104
19526
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19105
19527
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19106
19528
|
}
|
|
19107
|
-
function
|
|
19529
|
+
function readRect2(ref) {
|
|
19530
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19531
|
+
}
|
|
19532
|
+
function readStripRect(ref) {
|
|
19533
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19534
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19535
|
+
}
|
|
19536
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19108
19537
|
const [rect, setRect] = useState8(null);
|
|
19109
19538
|
useEffect9(() => {
|
|
19110
19539
|
if (!ref) {
|
|
@@ -19112,7 +19541,7 @@ function useLiveItemRect(ref) {
|
|
|
19112
19541
|
return;
|
|
19113
19542
|
}
|
|
19114
19543
|
const update = () => {
|
|
19115
|
-
const next = readRect2(ref);
|
|
19544
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19116
19545
|
setRect(
|
|
19117
19546
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19118
19547
|
);
|
|
@@ -19127,9 +19556,49 @@ function useLiveItemRect(ref) {
|
|
|
19127
19556
|
window.removeEventListener("resize", update);
|
|
19128
19557
|
clearInterval(interval);
|
|
19129
19558
|
};
|
|
19130
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19559
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19131
19560
|
return rect;
|
|
19132
19561
|
}
|
|
19562
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19563
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19564
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19565
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19566
|
+
const slotRef = useRef5(null);
|
|
19567
|
+
const [shift, setShift] = useState8(0);
|
|
19568
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19569
|
+
useLayoutEffect4(() => {
|
|
19570
|
+
const slot = slotRef.current;
|
|
19571
|
+
if (!slot) return;
|
|
19572
|
+
const clamp = () => {
|
|
19573
|
+
const w = slot.offsetWidth;
|
|
19574
|
+
if (w <= 0) return;
|
|
19575
|
+
const half = w / 2;
|
|
19576
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19577
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19578
|
+
};
|
|
19579
|
+
clamp();
|
|
19580
|
+
const ro = new ResizeObserver(clamp);
|
|
19581
|
+
ro.observe(slot);
|
|
19582
|
+
return () => ro.disconnect();
|
|
19583
|
+
}, [centerX, children]);
|
|
19584
|
+
const mobile = window.innerWidth <= 480;
|
|
19585
|
+
return /* @__PURE__ */ jsx21(
|
|
19586
|
+
"div",
|
|
19587
|
+
{
|
|
19588
|
+
ref: slotRef,
|
|
19589
|
+
"data-ohw-bridge": "",
|
|
19590
|
+
"data-ohw-item-interaction": "",
|
|
19591
|
+
className: "pointer-events-auto fixed",
|
|
19592
|
+
style: {
|
|
19593
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19594
|
+
left: centerX + shift,
|
|
19595
|
+
transform: "translate(-50%, -100%)",
|
|
19596
|
+
zIndex: 2147483645
|
|
19597
|
+
},
|
|
19598
|
+
children
|
|
19599
|
+
}
|
|
19600
|
+
);
|
|
19601
|
+
}
|
|
19133
19602
|
function requestValidateTree(postToParent2, tree) {
|
|
19134
19603
|
return new Promise((resolve) => {
|
|
19135
19604
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19166,116 +19635,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19166
19635
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19167
19636
|
});
|
|
19168
19637
|
}
|
|
19169
|
-
function
|
|
19638
|
+
function ToolbarAction({
|
|
19170
19639
|
label,
|
|
19171
19640
|
onClick,
|
|
19172
|
-
disabled,
|
|
19173
|
-
active
|
|
19641
|
+
disabled = false,
|
|
19642
|
+
active = false,
|
|
19643
|
+
children
|
|
19174
19644
|
}) {
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
{
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
disabled,
|
|
19181
|
-
style: {
|
|
19182
|
-
height: 28,
|
|
19183
|
-
padding: "0 10px",
|
|
19184
|
-
display: "inline-flex",
|
|
19185
|
-
alignItems: "center",
|
|
19186
|
-
gap: 4,
|
|
19187
|
-
borderRadius: 999,
|
|
19188
|
-
border: "none",
|
|
19189
|
-
cursor: disabled ? "default" : "pointer",
|
|
19190
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19191
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19192
|
-
opacity: disabled ? 0.4 : 1,
|
|
19193
|
-
fontSize: 12,
|
|
19194
|
-
lineHeight: "16px",
|
|
19195
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19196
|
-
whiteSpace: "nowrap",
|
|
19197
|
-
flex: "0 0 auto"
|
|
19198
|
-
},
|
|
19199
|
-
children: label
|
|
19200
|
-
}
|
|
19201
|
-
);
|
|
19645
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19646
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19647
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19648
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19649
|
+
] });
|
|
19202
19650
|
}
|
|
19203
|
-
function
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
},
|
|
19233
|
-
children: "Alt"
|
|
19234
|
-
}
|
|
19235
|
-
),
|
|
19236
|
-
/* @__PURE__ */ jsx20(
|
|
19237
|
-
"input",
|
|
19651
|
+
function ToolbarSeparator() {
|
|
19652
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19653
|
+
}
|
|
19654
|
+
function OptionMenu({
|
|
19655
|
+
label,
|
|
19656
|
+
value,
|
|
19657
|
+
options,
|
|
19658
|
+
onChange
|
|
19659
|
+
}) {
|
|
19660
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19661
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19662
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19663
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19664
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19665
|
+
"button",
|
|
19666
|
+
{
|
|
19667
|
+
type: "button",
|
|
19668
|
+
"aria-label": label,
|
|
19669
|
+
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",
|
|
19670
|
+
children: [
|
|
19671
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19672
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19673
|
+
]
|
|
19674
|
+
}
|
|
19675
|
+
) }),
|
|
19676
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19677
|
+
const selected = option.value === value;
|
|
19678
|
+
return /* @__PURE__ */ jsxs12(
|
|
19679
|
+
DropdownMenuItem,
|
|
19238
19680
|
{
|
|
19239
|
-
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
"aria-label": "Image alt text",
|
|
19254
|
-
style: {
|
|
19255
|
-
flex: 1,
|
|
19256
|
-
minWidth: 0,
|
|
19257
|
-
border: "none",
|
|
19258
|
-
outline: "none",
|
|
19259
|
-
background: "transparent",
|
|
19260
|
-
fontSize: 12,
|
|
19261
|
-
lineHeight: "16px",
|
|
19262
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19263
|
-
color: "#1f2937"
|
|
19264
|
-
}
|
|
19265
|
-
}
|
|
19266
|
-
)
|
|
19267
|
-
]
|
|
19268
|
-
}
|
|
19269
|
-
);
|
|
19681
|
+
role: "menuitemradio",
|
|
19682
|
+
"aria-checked": selected,
|
|
19683
|
+
onSelect: () => onChange(option.value),
|
|
19684
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19685
|
+
children: [
|
|
19686
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19687
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19688
|
+
]
|
|
19689
|
+
},
|
|
19690
|
+
option.value
|
|
19691
|
+
);
|
|
19692
|
+
}) })
|
|
19693
|
+
] })
|
|
19694
|
+
] });
|
|
19270
19695
|
}
|
|
19271
19696
|
var VARIANTS = [
|
|
19272
19697
|
{ value: "logos", label: "Logos" },
|
|
19273
19698
|
{ value: "reel", label: "Reel" }
|
|
19274
19699
|
];
|
|
19275
19700
|
var ALIGNS = [
|
|
19276
|
-
{ value: "left", label: "
|
|
19277
|
-
{ value: "center", label: "
|
|
19278
|
-
{ value: "right", label: "
|
|
19701
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19702
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19703
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19279
19704
|
];
|
|
19280
19705
|
var HOVERS = [
|
|
19281
19706
|
{ value: "none", label: "None" },
|
|
@@ -19283,104 +19708,104 @@ var HOVERS = [
|
|
|
19283
19708
|
{ value: "zoom", label: "Zoom" },
|
|
19284
19709
|
{ value: "fade", label: "Fade" }
|
|
19285
19710
|
];
|
|
19286
|
-
var TREATMENTS = [
|
|
19287
|
-
{ value: "color", label: "Color" },
|
|
19288
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19289
|
-
];
|
|
19290
19711
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19291
|
-
function
|
|
19292
|
-
|
|
19712
|
+
function LinkModal({
|
|
19713
|
+
href,
|
|
19714
|
+
linkTarget,
|
|
19715
|
+
onClose,
|
|
19716
|
+
onSave
|
|
19717
|
+
}) {
|
|
19718
|
+
const [draft, setDraft] = useState8(href);
|
|
19719
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19293
19720
|
const [invalid, setInvalid] = useState8(false);
|
|
19294
|
-
|
|
19295
|
-
setDraft(value);
|
|
19296
|
-
setInvalid(false);
|
|
19297
|
-
}, [value]);
|
|
19298
|
-
const commit2 = () => {
|
|
19721
|
+
const save = () => {
|
|
19299
19722
|
const next = draft.trim();
|
|
19300
|
-
if (next
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
onCommit(next);
|
|
19304
|
-
};
|
|
19305
|
-
return /* @__PURE__ */ jsxs11(
|
|
19306
|
-
"div",
|
|
19307
|
-
{
|
|
19308
|
-
style: {
|
|
19309
|
-
display: "flex",
|
|
19310
|
-
alignItems: "center",
|
|
19311
|
-
gap: 6,
|
|
19312
|
-
height: 28,
|
|
19313
|
-
padding: "0 12px",
|
|
19314
|
-
borderRadius: 999,
|
|
19315
|
-
background: "#ffffff",
|
|
19316
|
-
width: "100%",
|
|
19317
|
-
maxWidth: 260,
|
|
19318
|
-
boxSizing: "border-box",
|
|
19319
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19320
|
-
},
|
|
19321
|
-
children: [
|
|
19322
|
-
/* @__PURE__ */ jsx20(
|
|
19323
|
-
"span",
|
|
19324
|
-
{
|
|
19325
|
-
style: {
|
|
19326
|
-
flex: "0 0 auto",
|
|
19327
|
-
color: OHW_BLUE_DARK,
|
|
19328
|
-
fontSize: 10,
|
|
19329
|
-
fontWeight: 700,
|
|
19330
|
-
textTransform: "uppercase",
|
|
19331
|
-
letterSpacing: 0.4
|
|
19332
|
-
},
|
|
19333
|
-
children: "Link"
|
|
19334
|
-
}
|
|
19335
|
-
),
|
|
19336
|
-
/* @__PURE__ */ jsx20(
|
|
19337
|
-
"input",
|
|
19338
|
-
{
|
|
19339
|
-
type: "text",
|
|
19340
|
-
inputMode: "url",
|
|
19341
|
-
value: draft,
|
|
19342
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19343
|
-
onBlur: commit2,
|
|
19344
|
-
onKeyDown: (e) => {
|
|
19345
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19346
|
-
if (e.key === "Escape") {
|
|
19347
|
-
setDraft(value);
|
|
19348
|
-
setInvalid(false);
|
|
19349
|
-
e.currentTarget.blur();
|
|
19350
|
-
}
|
|
19351
|
-
},
|
|
19352
|
-
placeholder: "https://example.com",
|
|
19353
|
-
"aria-label": "Image link URL",
|
|
19354
|
-
"aria-invalid": invalid,
|
|
19355
|
-
style: {
|
|
19356
|
-
flex: 1,
|
|
19357
|
-
minWidth: 0,
|
|
19358
|
-
border: "none",
|
|
19359
|
-
outline: "none",
|
|
19360
|
-
background: "transparent",
|
|
19361
|
-
fontSize: 12,
|
|
19362
|
-
lineHeight: "16px",
|
|
19363
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19364
|
-
color: "#1f2937"
|
|
19365
|
-
}
|
|
19366
|
-
}
|
|
19367
|
-
)
|
|
19368
|
-
]
|
|
19723
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19724
|
+
setInvalid(true);
|
|
19725
|
+
return;
|
|
19369
19726
|
}
|
|
19370
|
-
|
|
19727
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19728
|
+
onClose();
|
|
19729
|
+
};
|
|
19730
|
+
return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
19731
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19732
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
19733
|
+
/* @__PURE__ */ jsx21(
|
|
19734
|
+
"input",
|
|
19735
|
+
{
|
|
19736
|
+
autoFocus: true,
|
|
19737
|
+
type: "text",
|
|
19738
|
+
inputMode: "url",
|
|
19739
|
+
value: draft,
|
|
19740
|
+
onChange: (e) => {
|
|
19741
|
+
setDraft(e.target.value);
|
|
19742
|
+
setInvalid(false);
|
|
19743
|
+
},
|
|
19744
|
+
onKeyDown: (e) => {
|
|
19745
|
+
if (e.key === "Enter") save();
|
|
19746
|
+
},
|
|
19747
|
+
placeholder: "https://example.com",
|
|
19748
|
+
"aria-label": "Image link URL",
|
|
19749
|
+
"aria-invalid": invalid,
|
|
19750
|
+
className: cn(
|
|
19751
|
+
"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",
|
|
19752
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19753
|
+
)
|
|
19754
|
+
}
|
|
19755
|
+
),
|
|
19756
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19757
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19758
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19759
|
+
"Open in new tab"
|
|
19760
|
+
] })
|
|
19761
|
+
] }),
|
|
19762
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
19763
|
+
href && /* @__PURE__ */ jsx21(
|
|
19764
|
+
"button",
|
|
19765
|
+
{
|
|
19766
|
+
type: "button",
|
|
19767
|
+
onClick: () => {
|
|
19768
|
+
onSave("", "new-tab");
|
|
19769
|
+
onClose();
|
|
19770
|
+
},
|
|
19771
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19772
|
+
children: "Remove link"
|
|
19773
|
+
}
|
|
19774
|
+
),
|
|
19775
|
+
/* @__PURE__ */ jsx21(
|
|
19776
|
+
"button",
|
|
19777
|
+
{
|
|
19778
|
+
type: "button",
|
|
19779
|
+
onClick: onClose,
|
|
19780
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19781
|
+
children: "Cancel"
|
|
19782
|
+
}
|
|
19783
|
+
),
|
|
19784
|
+
/* @__PURE__ */ jsx21(
|
|
19785
|
+
"button",
|
|
19786
|
+
{
|
|
19787
|
+
type: "button",
|
|
19788
|
+
onClick: save,
|
|
19789
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19790
|
+
children: "Save"
|
|
19791
|
+
}
|
|
19792
|
+
)
|
|
19793
|
+
] })
|
|
19794
|
+
] }) });
|
|
19371
19795
|
}
|
|
19372
19796
|
function MediaStripToolbar({
|
|
19373
19797
|
entry,
|
|
19374
19798
|
index,
|
|
19375
19799
|
pending,
|
|
19376
19800
|
error,
|
|
19801
|
+
itemEditOn,
|
|
19802
|
+
onToggleItemEdit,
|
|
19377
19803
|
onSetVariant,
|
|
19378
19804
|
onSetAlign,
|
|
19379
19805
|
onSetHover,
|
|
19380
19806
|
onSetTreatment,
|
|
19381
19807
|
onResize,
|
|
19382
|
-
|
|
19383
|
-
onSetLink,
|
|
19808
|
+
onOpenLink,
|
|
19384
19809
|
onAddItem,
|
|
19385
19810
|
onRemoveItem,
|
|
19386
19811
|
onChangeImage,
|
|
@@ -19389,81 +19814,102 @@ function MediaStripToolbar({
|
|
|
19389
19814
|
}) {
|
|
19390
19815
|
const items = mediaStripItems(entry.tree);
|
|
19391
19816
|
const itemCount = items.length;
|
|
19392
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19393
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19394
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19395
19817
|
const slots = findMediaStripSlots(entry.tree);
|
|
19396
19818
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19397
19819
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19398
19820
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19399
19821
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19400
19822
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19401
|
-
const
|
|
19402
|
-
const
|
|
19403
|
-
|
|
19404
|
-
gap: 6,
|
|
19405
|
-
flexWrap: "nowrap",
|
|
19406
|
-
justifyContent: "center",
|
|
19407
|
-
overflowX: "auto",
|
|
19408
|
-
WebkitOverflowScrolling: "touch",
|
|
19409
|
-
width: "100%",
|
|
19410
|
-
scrollbarWidth: "none"
|
|
19411
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19412
|
-
return /* @__PURE__ */ jsxs11(
|
|
19823
|
+
const mobile = window.innerWidth <= 480;
|
|
19824
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19825
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19413
19826
|
"div",
|
|
19414
19827
|
{
|
|
19415
19828
|
"data-ohw-bridge": "",
|
|
19416
19829
|
"data-ohw-toolbar": "",
|
|
19417
19830
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19418
|
-
|
|
19419
|
-
|
|
19420
|
-
flexDirection: "column",
|
|
19421
|
-
gap: 6,
|
|
19422
|
-
alignItems: "center",
|
|
19423
|
-
background: OHW_BLUE,
|
|
19424
|
-
padding: 8,
|
|
19425
|
-
borderRadius: 12,
|
|
19426
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19427
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19428
|
-
opacity: pending ? 0.6 : 1,
|
|
19429
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19430
|
-
},
|
|
19831
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19832
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19431
19833
|
children: [
|
|
19432
|
-
/* @__PURE__ */
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19834
|
+
/* @__PURE__ */ jsxs12(
|
|
19835
|
+
"div",
|
|
19836
|
+
{
|
|
19837
|
+
className: cn(
|
|
19838
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19839
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19840
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19841
|
+
),
|
|
19842
|
+
children: [
|
|
19843
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19844
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
19845
|
+
CustomToolbarButton,
|
|
19846
|
+
{
|
|
19847
|
+
type: "button",
|
|
19848
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19849
|
+
"aria-pressed": itemEditOn,
|
|
19850
|
+
onClick: onToggleItemEdit,
|
|
19851
|
+
className: "group size-8",
|
|
19852
|
+
children: /* @__PURE__ */ jsx21(
|
|
19853
|
+
Star,
|
|
19854
|
+
{
|
|
19855
|
+
size: 16,
|
|
19856
|
+
fill: "currentColor",
|
|
19857
|
+
strokeWidth: 0,
|
|
19858
|
+
className: cn(
|
|
19859
|
+
"transition-colors",
|
|
19860
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19861
|
+
),
|
|
19862
|
+
style: { pointerEvents: "none" }
|
|
19863
|
+
}
|
|
19864
|
+
)
|
|
19865
|
+
}
|
|
19866
|
+
) }),
|
|
19867
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19868
|
+
] }),
|
|
19869
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19870
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19871
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19872
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19873
|
+
/* @__PURE__ */ jsx21(
|
|
19874
|
+
ToolbarAction,
|
|
19875
|
+
{
|
|
19876
|
+
label: gatedLabel("Move right"),
|
|
19877
|
+
onClick: onMoveRight,
|
|
19878
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19879
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
19880
|
+
}
|
|
19881
|
+
),
|
|
19882
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19883
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19884
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19885
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19886
|
+
/* @__PURE__ */ jsx21(
|
|
19887
|
+
ToolbarAction,
|
|
19888
|
+
{
|
|
19889
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19890
|
+
active: treatment === "grayscale",
|
|
19891
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19892
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19893
|
+
}
|
|
19894
|
+
),
|
|
19895
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19896
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
19897
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19898
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19899
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19900
|
+
sizeValue,
|
|
19901
|
+
"px"
|
|
19902
|
+
] }),
|
|
19903
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19904
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19905
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19906
|
+
]
|
|
19907
|
+
}
|
|
19908
|
+
),
|
|
19909
|
+
error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19464
19910
|
]
|
|
19465
19911
|
}
|
|
19466
|
-
);
|
|
19912
|
+
) });
|
|
19467
19913
|
}
|
|
19468
19914
|
function findMediaStripSlots(tree) {
|
|
19469
19915
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19482,31 +19928,23 @@ function AiMediaStripOverlay({
|
|
|
19482
19928
|
}) {
|
|
19483
19929
|
const [hover, setHover] = useState8(null);
|
|
19484
19930
|
const [active, setActive] = useState8(null);
|
|
19931
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
19932
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19485
19933
|
const [pending, setPending] = useState8(false);
|
|
19486
19934
|
const [error, setError] = useState8(null);
|
|
19487
19935
|
const activeRef = useRef5(null);
|
|
19488
19936
|
activeRef.current = active;
|
|
19937
|
+
const linkOpenRef = useRef5(false);
|
|
19938
|
+
linkOpenRef.current = linkOpen;
|
|
19489
19939
|
useEffect9(() => {
|
|
19490
19940
|
const onMove = (e) => {
|
|
19941
|
+
const ref = itemRefFromTarget(e.target);
|
|
19491
19942
|
const t = e.target;
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
if (!itemEl) {
|
|
19498
|
-
setHover(null);
|
|
19499
|
-
return;
|
|
19500
|
-
}
|
|
19501
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19502
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19503
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19504
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19505
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19506
|
-
setHover(null);
|
|
19507
|
-
return;
|
|
19508
|
-
}
|
|
19509
|
-
setHover({ sectionId, index });
|
|
19943
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19944
|
+
setHover((prev) => {
|
|
19945
|
+
const next = ref && !overEditable ? ref : null;
|
|
19946
|
+
return sameRef(prev, next) ? prev : next;
|
|
19947
|
+
});
|
|
19510
19948
|
};
|
|
19511
19949
|
const onLeave = () => setHover(null);
|
|
19512
19950
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19518,23 +19956,25 @@ function AiMediaStripOverlay({
|
|
|
19518
19956
|
}, []);
|
|
19519
19957
|
useEffect9(() => {
|
|
19520
19958
|
const onClick = (e) => {
|
|
19521
|
-
const current = activeRef.current;
|
|
19522
|
-
if (!current) return;
|
|
19523
19959
|
const t = e.target;
|
|
19524
|
-
if (!(t instanceof
|
|
19525
|
-
if (t.closest(
|
|
19526
|
-
const
|
|
19527
|
-
if (
|
|
19528
|
-
|
|
19960
|
+
if (!(t instanceof Element)) return;
|
|
19961
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19962
|
+
const ref = itemRefFromTarget(t);
|
|
19963
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19964
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19965
|
+
setItemEditOn(false);
|
|
19529
19966
|
setError(null);
|
|
19967
|
+
setActive(ref);
|
|
19530
19968
|
};
|
|
19531
19969
|
document.addEventListener("click", onClick, true);
|
|
19532
19970
|
return () => document.removeEventListener("click", onClick, true);
|
|
19533
|
-
}, []);
|
|
19971
|
+
}, [clearInteractionChromeRef]);
|
|
19534
19972
|
useEffect9(() => {
|
|
19535
19973
|
const onBlur = () => {
|
|
19536
19974
|
if (!activeRef.current) return;
|
|
19537
19975
|
setActive(null);
|
|
19976
|
+
setItemEditOn(false);
|
|
19977
|
+
setLinkOpen(false);
|
|
19538
19978
|
setError(null);
|
|
19539
19979
|
};
|
|
19540
19980
|
window.addEventListener("blur", onBlur);
|
|
@@ -19544,7 +19984,10 @@ function AiMediaStripOverlay({
|
|
|
19544
19984
|
const onKeyDown = (e) => {
|
|
19545
19985
|
if (e.key !== "Escape") return;
|
|
19546
19986
|
if (!activeRef.current) return;
|
|
19987
|
+
if (linkOpenRef.current) return;
|
|
19988
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19547
19989
|
setActive(null);
|
|
19990
|
+
setItemEditOn(false);
|
|
19548
19991
|
setError(null);
|
|
19549
19992
|
};
|
|
19550
19993
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19578,137 +20021,133 @@ function AiMediaStripOverlay({
|
|
|
19578
20021
|
tree: nextTree,
|
|
19579
20022
|
label: entry.label,
|
|
19580
20023
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19581
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20024
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
20025
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20026
|
+
// on every edit reads as the section jumping around.
|
|
20027
|
+
skipScrollIntoView: true
|
|
19582
20028
|
});
|
|
19583
20029
|
return true;
|
|
19584
20030
|
},
|
|
19585
20031
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19586
20032
|
);
|
|
19587
20033
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19588
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19589
20034
|
const activeItemRect = useLiveItemRect(active);
|
|
19590
|
-
const
|
|
19591
|
-
const
|
|
19592
|
-
|
|
19593
|
-
|
|
19594
|
-
|
|
19595
|
-
|
|
19596
|
-
|
|
19597
|
-
|
|
19598
|
-
|
|
19599
|
-
|
|
19600
|
-
|
|
19601
|
-
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
|
|
19608
|
-
|
|
19609
|
-
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
|
|
19623
|
-
|
|
19624
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19625
|
-
ItemInteractionLayer,
|
|
19626
|
-
{
|
|
19627
|
-
rect: activeItemRect,
|
|
19628
|
-
state: toolbarState,
|
|
19629
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19630
|
-
MediaStripToolbar,
|
|
19631
|
-
{
|
|
19632
|
-
entry: activeEntry,
|
|
19633
|
-
index: active.index,
|
|
19634
|
-
pending,
|
|
19635
|
-
error,
|
|
19636
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19637
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19638
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19639
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19640
|
-
onResize: (delta) => {
|
|
19641
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19642
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19643
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19644
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19645
|
-
},
|
|
19646
|
-
onSetAlt: (alt) => {
|
|
19647
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19648
|
-
},
|
|
19649
|
-
onSetLink: (href, linkTarget) => {
|
|
20035
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
20036
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20037
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
20038
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
20039
|
+
const activeHref = activeItem?.href ?? "";
|
|
20040
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
20041
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
20042
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20043
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
20044
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
20045
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
20046
|
+
MediaStripToolbar,
|
|
20047
|
+
{
|
|
20048
|
+
entry: activeEntry,
|
|
20049
|
+
index: active.index,
|
|
20050
|
+
pending,
|
|
20051
|
+
error,
|
|
20052
|
+
itemEditOn,
|
|
20053
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
20054
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
20055
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
20056
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
20057
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
20058
|
+
onResize: (delta) => {
|
|
20059
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
20060
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
20061
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
20062
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
20063
|
+
},
|
|
20064
|
+
onOpenLink: () => setLinkOpen(true),
|
|
20065
|
+
onAddItem: () => {
|
|
20066
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20067
|
+
if (!picked) return;
|
|
20068
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19650
20069
|
void runMutation(
|
|
19651
20070
|
active.sectionId,
|
|
19652
|
-
(tree) =>
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19657
|
-
if (!picked) return;
|
|
19658
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19659
|
-
void runMutation(
|
|
19660
|
-
active.sectionId,
|
|
19661
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19662
|
-
{ [picked.assetId]: picked.url }
|
|
19663
|
-
).then((applied) => {
|
|
19664
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19665
|
-
});
|
|
19666
|
-
});
|
|
19667
|
-
},
|
|
19668
|
-
onChangeImage: () => {
|
|
19669
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19670
|
-
if (!picked) return;
|
|
19671
|
-
void runMutation(
|
|
19672
|
-
active.sectionId,
|
|
19673
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19674
|
-
{ [picked.assetId]: picked.url }
|
|
19675
|
-
);
|
|
20071
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
20072
|
+
{ [picked.assetId]: picked.url }
|
|
20073
|
+
).then((applied) => {
|
|
20074
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19676
20075
|
});
|
|
19677
|
-
}
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19687
|
-
(applied) => {
|
|
19688
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19689
|
-
}
|
|
19690
|
-
);
|
|
19691
|
-
},
|
|
19692
|
-
onMoveRight: () => {
|
|
19693
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19694
|
-
(applied) => {
|
|
19695
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19696
|
-
}
|
|
20076
|
+
});
|
|
20077
|
+
},
|
|
20078
|
+
onChangeImage: () => {
|
|
20079
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20080
|
+
if (!picked) return;
|
|
20081
|
+
void runMutation(
|
|
20082
|
+
active.sectionId,
|
|
20083
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
20084
|
+
{ [picked.assetId]: picked.url }
|
|
19697
20085
|
);
|
|
19698
|
-
}
|
|
20086
|
+
});
|
|
20087
|
+
},
|
|
20088
|
+
onRemoveItem: () => {
|
|
20089
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
20090
|
+
(applied) => {
|
|
20091
|
+
if (applied) setActive(null);
|
|
20092
|
+
}
|
|
20093
|
+
);
|
|
20094
|
+
},
|
|
20095
|
+
onMoveLeft: () => {
|
|
20096
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
20097
|
+
(applied) => {
|
|
20098
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
20099
|
+
}
|
|
20100
|
+
);
|
|
20101
|
+
},
|
|
20102
|
+
onMoveRight: () => {
|
|
20103
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20104
|
+
(applied) => {
|
|
20105
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20106
|
+
}
|
|
20107
|
+
);
|
|
19699
20108
|
}
|
|
19700
|
-
|
|
19701
|
-
}
|
|
19702
|
-
|
|
20109
|
+
}
|
|
20110
|
+
) }),
|
|
20111
|
+
/* @__PURE__ */ jsx21(
|
|
20112
|
+
"div",
|
|
20113
|
+
{
|
|
20114
|
+
"data-ohw-bridge": "",
|
|
20115
|
+
"data-ohw-item-interaction": "",
|
|
20116
|
+
"aria-hidden": true,
|
|
20117
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20118
|
+
style: {
|
|
20119
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20120
|
+
left: activeItemRect.left - 5,
|
|
20121
|
+
background: PRIMARY3,
|
|
20122
|
+
zIndex: 2147483644
|
|
20123
|
+
},
|
|
20124
|
+
children: "Media item"
|
|
20125
|
+
}
|
|
20126
|
+
),
|
|
20127
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
20128
|
+
LinkModal,
|
|
20129
|
+
{
|
|
20130
|
+
href: activeHref,
|
|
20131
|
+
linkTarget: activeTarget,
|
|
20132
|
+
onClose: () => setLinkOpen(false),
|
|
20133
|
+
onSave: (href, linkTarget) => {
|
|
20134
|
+
void runMutation(
|
|
20135
|
+
active.sectionId,
|
|
20136
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20137
|
+
);
|
|
20138
|
+
}
|
|
20139
|
+
}
|
|
20140
|
+
)
|
|
20141
|
+
] })
|
|
19703
20142
|
] });
|
|
19704
20143
|
}
|
|
19705
20144
|
|
|
19706
20145
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19707
|
-
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as
|
|
19708
|
-
import { Check as
|
|
19709
|
-
import { Fragment as Fragment8, jsx as
|
|
20146
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
20147
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
20148
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19710
20149
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19711
|
-
var
|
|
20150
|
+
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]";
|
|
19712
20151
|
function findPricingCardElement(sectionId, index) {
|
|
19713
20152
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19714
20153
|
if (!sectionEl2) return null;
|
|
@@ -19720,7 +20159,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19720
20159
|
}
|
|
19721
20160
|
function cardRefFromTarget(target) {
|
|
19722
20161
|
if (!(target instanceof Element)) return null;
|
|
19723
|
-
if (target.closest(
|
|
20162
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19724
20163
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19725
20164
|
if (!cardEl) return null;
|
|
19726
20165
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -19730,21 +20169,21 @@ function cardRefFromTarget(target) {
|
|
|
19730
20169
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19731
20170
|
return { sectionId, index };
|
|
19732
20171
|
}
|
|
19733
|
-
function
|
|
20172
|
+
function sameRef2(a, b) {
|
|
19734
20173
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19735
20174
|
}
|
|
19736
|
-
function
|
|
20175
|
+
function rectOf2(el) {
|
|
19737
20176
|
if (!el) return null;
|
|
19738
20177
|
const r2 = el.getBoundingClientRect();
|
|
19739
20178
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19740
20179
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19741
20180
|
}
|
|
19742
20181
|
function readRect3(ref) {
|
|
19743
|
-
return
|
|
20182
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19744
20183
|
}
|
|
19745
20184
|
function readGridRect(ref) {
|
|
19746
20185
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19747
|
-
return
|
|
20186
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19748
20187
|
}
|
|
19749
20188
|
function useLiveCardRect(ref, grid = false) {
|
|
19750
20189
|
const [rect, setRect] = useState9(null);
|
|
@@ -19774,19 +20213,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19774
20213
|
}
|
|
19775
20214
|
var TOOLBAR_GRID_GAP = 52;
|
|
19776
20215
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19777
|
-
var
|
|
20216
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19778
20217
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19779
20218
|
const slotRef = useRef6(null);
|
|
19780
20219
|
const [shift, setShift] = useState9(0);
|
|
19781
20220
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19782
|
-
|
|
20221
|
+
useLayoutEffect5(() => {
|
|
19783
20222
|
const slot = slotRef.current;
|
|
19784
20223
|
if (!slot) return;
|
|
19785
20224
|
const clamp = () => {
|
|
19786
20225
|
const w = slot.offsetWidth;
|
|
19787
20226
|
if (w <= 0) return;
|
|
19788
20227
|
const half = w / 2;
|
|
19789
|
-
const clamped = Math.max(
|
|
20228
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19790
20229
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19791
20230
|
};
|
|
19792
20231
|
clamp();
|
|
@@ -19795,7 +20234,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19795
20234
|
return () => ro.disconnect();
|
|
19796
20235
|
}, [centerX, children]);
|
|
19797
20236
|
const mobile = window.innerWidth <= 480;
|
|
19798
|
-
return /* @__PURE__ */
|
|
20237
|
+
return /* @__PURE__ */ jsx22(
|
|
19799
20238
|
"div",
|
|
19800
20239
|
{
|
|
19801
20240
|
ref: slotRef,
|
|
@@ -19830,7 +20269,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19830
20269
|
});
|
|
19831
20270
|
}
|
|
19832
20271
|
function StyleSwatch({ style }) {
|
|
19833
|
-
return /* @__PURE__ */
|
|
20272
|
+
return /* @__PURE__ */ jsx22(
|
|
19834
20273
|
"span",
|
|
19835
20274
|
{
|
|
19836
20275
|
"aria-hidden": true,
|
|
@@ -19844,35 +20283,35 @@ function StyleSwatch({ style }) {
|
|
|
19844
20283
|
);
|
|
19845
20284
|
}
|
|
19846
20285
|
function ButtonGlyph() {
|
|
19847
|
-
return /* @__PURE__ */
|
|
19848
|
-
/* @__PURE__ */
|
|
19849
|
-
/* @__PURE__ */
|
|
20286
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20287
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20288
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19850
20289
|
] });
|
|
19851
20290
|
}
|
|
19852
20291
|
function FeatureGlyph({ mode }) {
|
|
19853
|
-
return /* @__PURE__ */
|
|
19854
|
-
/* @__PURE__ */
|
|
19855
|
-
/* @__PURE__ */
|
|
19856
|
-
/* @__PURE__ */
|
|
19857
|
-
/* @__PURE__ */
|
|
19858
|
-
/* @__PURE__ */
|
|
19859
|
-
mode === "add" && /* @__PURE__ */
|
|
20292
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20293
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20294
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20295
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20296
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20297
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20298
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19860
20299
|
] });
|
|
19861
20300
|
}
|
|
19862
|
-
function
|
|
20301
|
+
function ToolbarAction2({
|
|
19863
20302
|
label,
|
|
19864
20303
|
onClick,
|
|
19865
20304
|
disabled = false,
|
|
19866
20305
|
children
|
|
19867
20306
|
}) {
|
|
19868
|
-
const button = /* @__PURE__ */
|
|
19869
|
-
return /* @__PURE__ */
|
|
19870
|
-
/* @__PURE__ */
|
|
19871
|
-
/* @__PURE__ */
|
|
20307
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20308
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20309
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20310
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19872
20311
|
] });
|
|
19873
20312
|
}
|
|
19874
|
-
function
|
|
19875
|
-
return /* @__PURE__ */
|
|
20313
|
+
function ToolbarSeparator2() {
|
|
20314
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19876
20315
|
}
|
|
19877
20316
|
function CardStyleMenu({
|
|
19878
20317
|
value,
|
|
@@ -19880,7 +20319,7 @@ function CardStyleMenu({
|
|
|
19880
20319
|
disabled = false
|
|
19881
20320
|
}) {
|
|
19882
20321
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19883
|
-
const trigger = /* @__PURE__ */
|
|
20322
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
19884
20323
|
"button",
|
|
19885
20324
|
{
|
|
19886
20325
|
type: "button",
|
|
@@ -19891,28 +20330,28 @@ function CardStyleMenu({
|
|
|
19891
20330
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19892
20331
|
),
|
|
19893
20332
|
children: [
|
|
19894
|
-
/* @__PURE__ */
|
|
19895
|
-
/* @__PURE__ */
|
|
19896
|
-
/* @__PURE__ */
|
|
20333
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20334
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20335
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
19897
20336
|
]
|
|
19898
20337
|
}
|
|
19899
20338
|
);
|
|
19900
20339
|
if (disabled) {
|
|
19901
|
-
return /* @__PURE__ */
|
|
19902
|
-
/* @__PURE__ */
|
|
19903
|
-
/* @__PURE__ */
|
|
19904
|
-
/* @__PURE__ */
|
|
19905
|
-
/* @__PURE__ */
|
|
20340
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20341
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20342
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20343
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20344
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19906
20345
|
] })
|
|
19907
20346
|
] });
|
|
19908
20347
|
}
|
|
19909
|
-
return /* @__PURE__ */
|
|
19910
|
-
/* @__PURE__ */
|
|
19911
|
-
/* @__PURE__ */
|
|
19912
|
-
/* @__PURE__ */
|
|
19913
|
-
/* @__PURE__ */
|
|
20348
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20349
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20350
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20351
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20352
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19914
20353
|
const selected = style.value === value;
|
|
19915
|
-
return /* @__PURE__ */
|
|
20354
|
+
return /* @__PURE__ */ jsxs13(
|
|
19916
20355
|
DropdownMenuItem,
|
|
19917
20356
|
{
|
|
19918
20357
|
role: "menuitemradio",
|
|
@@ -19920,9 +20359,9 @@ function CardStyleMenu({
|
|
|
19920
20359
|
onSelect: () => onChange(style.value),
|
|
19921
20360
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19922
20361
|
children: [
|
|
19923
|
-
/* @__PURE__ */
|
|
19924
|
-
/* @__PURE__ */
|
|
19925
|
-
selected && /* @__PURE__ */
|
|
20362
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20363
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20364
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
19926
20365
|
]
|
|
19927
20366
|
},
|
|
19928
20367
|
style.value
|
|
@@ -19952,7 +20391,7 @@ function PricingCardToolbar({
|
|
|
19952
20391
|
const style = pricingCardStyle(entry.tree, index);
|
|
19953
20392
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19954
20393
|
const mobile = window.innerWidth <= 480;
|
|
19955
|
-
return /* @__PURE__ */
|
|
20394
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
19956
20395
|
"div",
|
|
19957
20396
|
{
|
|
19958
20397
|
"data-ohw-bridge": "",
|
|
@@ -19964,7 +20403,7 @@ function PricingCardToolbar({
|
|
|
19964
20403
|
),
|
|
19965
20404
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19966
20405
|
children: [
|
|
19967
|
-
/* @__PURE__ */
|
|
20406
|
+
/* @__PURE__ */ jsxs13(
|
|
19968
20407
|
"div",
|
|
19969
20408
|
{
|
|
19970
20409
|
className: cn(
|
|
@@ -19973,8 +20412,8 @@ function PricingCardToolbar({
|
|
|
19973
20412
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19974
20413
|
),
|
|
19975
20414
|
children: [
|
|
19976
|
-
/* @__PURE__ */
|
|
19977
|
-
/* @__PURE__ */
|
|
20415
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20416
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
19978
20417
|
CustomToolbarButton,
|
|
19979
20418
|
{
|
|
19980
20419
|
type: "button",
|
|
@@ -19982,7 +20421,7 @@ function PricingCardToolbar({
|
|
|
19982
20421
|
"aria-pressed": featuredTag,
|
|
19983
20422
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19984
20423
|
className: "group size-8",
|
|
19985
|
-
children: /* @__PURE__ */
|
|
20424
|
+
children: /* @__PURE__ */ jsx22(
|
|
19986
20425
|
Star2,
|
|
19987
20426
|
{
|
|
19988
20427
|
size: 16,
|
|
@@ -19997,25 +20436,25 @@ function PricingCardToolbar({
|
|
|
19997
20436
|
)
|
|
19998
20437
|
}
|
|
19999
20438
|
) }),
|
|
20000
|
-
/* @__PURE__ */
|
|
20439
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20001
20440
|
] }),
|
|
20002
|
-
/* @__PURE__ */
|
|
20003
|
-
/* @__PURE__ */
|
|
20004
|
-
/* @__PURE__ */
|
|
20005
|
-
/* @__PURE__ */
|
|
20006
|
-
/* @__PURE__ */
|
|
20007
|
-
/* @__PURE__ */
|
|
20008
|
-
/* @__PURE__ */
|
|
20441
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20442
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20443
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20444
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20445
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20446
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20447
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
20009
20448
|
] }) }),
|
|
20010
|
-
/* @__PURE__ */
|
|
20011
|
-
/* @__PURE__ */
|
|
20012
|
-
/* @__PURE__ */
|
|
20013
|
-
/* @__PURE__ */
|
|
20014
|
-
/* @__PURE__ */
|
|
20449
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20450
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20451
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20452
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20453
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20015
20454
|
]
|
|
20016
20455
|
}
|
|
20017
20456
|
),
|
|
20018
|
-
error && /* @__PURE__ */
|
|
20457
|
+
error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
20019
20458
|
]
|
|
20020
20459
|
}
|
|
20021
20460
|
) });
|
|
@@ -20049,7 +20488,7 @@ function AiPricingCardOverlay({
|
|
|
20049
20488
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20050
20489
|
setHover((prev) => {
|
|
20051
20490
|
const next = ref && !overEditable ? ref : null;
|
|
20052
|
-
return
|
|
20491
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20053
20492
|
});
|
|
20054
20493
|
};
|
|
20055
20494
|
const onLeave = () => setHover(null);
|
|
@@ -20064,10 +20503,10 @@ function AiPricingCardOverlay({
|
|
|
20064
20503
|
const onClick = (e) => {
|
|
20065
20504
|
const t = e.target;
|
|
20066
20505
|
if (!(t instanceof Element)) return;
|
|
20067
|
-
if (t.closest(
|
|
20506
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20068
20507
|
const ref = cardRefFromTarget(t);
|
|
20069
|
-
setActive((prev) =>
|
|
20070
|
-
if (!ref || !
|
|
20508
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20509
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20071
20510
|
};
|
|
20072
20511
|
document.addEventListener("click", onClick, true);
|
|
20073
20512
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20132,12 +20571,12 @@ function AiPricingCardOverlay({
|
|
|
20132
20571
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20133
20572
|
const activeCardRect = useLiveCardRect(active);
|
|
20134
20573
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20135
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20136
|
-
return /* @__PURE__ */
|
|
20137
|
-
hoverRect && /* @__PURE__ */
|
|
20138
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
20139
|
-
/* @__PURE__ */
|
|
20140
|
-
/* @__PURE__ */
|
|
20574
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20575
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20576
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20577
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20578
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20579
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
20141
20580
|
PricingCardToolbar,
|
|
20142
20581
|
{
|
|
20143
20582
|
entry: activeEntry,
|
|
@@ -20165,7 +20604,7 @@ function AiPricingCardOverlay({
|
|
|
20165
20604
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20166
20605
|
}
|
|
20167
20606
|
) }),
|
|
20168
|
-
/* @__PURE__ */
|
|
20607
|
+
/* @__PURE__ */ jsx22(
|
|
20169
20608
|
"div",
|
|
20170
20609
|
{
|
|
20171
20610
|
"data-ohw-bridge": "",
|
|
@@ -20229,39 +20668,11 @@ function clearVideo(tree, path) {
|
|
|
20229
20668
|
});
|
|
20230
20669
|
}
|
|
20231
20670
|
|
|
20232
|
-
// src/lib/youtube.ts
|
|
20233
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20234
|
-
function extractYouTubeId(input) {
|
|
20235
|
-
const trimmed = input.trim();
|
|
20236
|
-
if (!trimmed) return null;
|
|
20237
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20238
|
-
let url;
|
|
20239
|
-
try {
|
|
20240
|
-
url = new URL(trimmed);
|
|
20241
|
-
} catch {
|
|
20242
|
-
return null;
|
|
20243
|
-
}
|
|
20244
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20245
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20246
|
-
return null;
|
|
20247
|
-
}
|
|
20248
|
-
let candidate = null;
|
|
20249
|
-
if (host === "youtu.be") {
|
|
20250
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20251
|
-
} else if (url.pathname === "/watch") {
|
|
20252
|
-
candidate = url.searchParams.get("v");
|
|
20253
|
-
} else {
|
|
20254
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20255
|
-
candidate = match ? match[1] : null;
|
|
20256
|
-
}
|
|
20257
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20258
|
-
}
|
|
20259
|
-
|
|
20260
20671
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20261
|
-
import { Fragment as Fragment9, jsx as
|
|
20672
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20262
20673
|
var PRIMARY5 = "#0885FE";
|
|
20263
|
-
var
|
|
20264
|
-
var
|
|
20674
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20675
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20265
20676
|
function findVideoBlockElement(sectionId, path) {
|
|
20266
20677
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20267
20678
|
if (!sectionEl2) return null;
|
|
@@ -20321,12 +20732,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20321
20732
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20322
20733
|
});
|
|
20323
20734
|
}
|
|
20324
|
-
function
|
|
20735
|
+
function Pill({
|
|
20325
20736
|
label,
|
|
20326
20737
|
onClick,
|
|
20327
20738
|
disabled
|
|
20328
20739
|
}) {
|
|
20329
|
-
return /* @__PURE__ */
|
|
20740
|
+
return /* @__PURE__ */ jsx23(
|
|
20330
20741
|
"button",
|
|
20331
20742
|
{
|
|
20332
20743
|
type: "button",
|
|
@@ -20342,7 +20753,7 @@ function Pill2({
|
|
|
20342
20753
|
border: "none",
|
|
20343
20754
|
cursor: disabled ? "default" : "pointer",
|
|
20344
20755
|
background: "#ffffff",
|
|
20345
|
-
color:
|
|
20756
|
+
color: OHW_BLUE_DARK,
|
|
20346
20757
|
opacity: disabled ? 0.4 : 1,
|
|
20347
20758
|
fontSize: 12,
|
|
20348
20759
|
lineHeight: "16px",
|
|
@@ -20385,8 +20796,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20385
20796
|
onCommit(id);
|
|
20386
20797
|
}
|
|
20387
20798
|
};
|
|
20388
|
-
return /* @__PURE__ */
|
|
20389
|
-
/* @__PURE__ */
|
|
20799
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20800
|
+
/* @__PURE__ */ jsxs14(
|
|
20390
20801
|
"div",
|
|
20391
20802
|
{
|
|
20392
20803
|
style: {
|
|
@@ -20402,12 +20813,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20402
20813
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20403
20814
|
},
|
|
20404
20815
|
children: [
|
|
20405
|
-
/* @__PURE__ */
|
|
20816
|
+
/* @__PURE__ */ jsx23(
|
|
20406
20817
|
"span",
|
|
20407
20818
|
{
|
|
20408
20819
|
style: {
|
|
20409
20820
|
flex: "0 0 auto",
|
|
20410
|
-
color:
|
|
20821
|
+
color: OHW_BLUE_DARK,
|
|
20411
20822
|
fontSize: 10,
|
|
20412
20823
|
lineHeight: "16px",
|
|
20413
20824
|
fontWeight: 700,
|
|
@@ -20417,7 +20828,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20417
20828
|
children: "Video"
|
|
20418
20829
|
}
|
|
20419
20830
|
),
|
|
20420
|
-
/* @__PURE__ */
|
|
20831
|
+
/* @__PURE__ */ jsx23(
|
|
20421
20832
|
"input",
|
|
20422
20833
|
{
|
|
20423
20834
|
type: "text",
|
|
@@ -20454,7 +20865,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20454
20865
|
]
|
|
20455
20866
|
}
|
|
20456
20867
|
),
|
|
20457
|
-
invalid && /* @__PURE__ */
|
|
20868
|
+
invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20458
20869
|
] });
|
|
20459
20870
|
}
|
|
20460
20871
|
function VideoToolbar({
|
|
@@ -20464,7 +20875,7 @@ function VideoToolbar({
|
|
|
20464
20875
|
onSetVideoId,
|
|
20465
20876
|
onRemove
|
|
20466
20877
|
}) {
|
|
20467
|
-
return /* @__PURE__ */
|
|
20878
|
+
return /* @__PURE__ */ jsxs14(
|
|
20468
20879
|
"div",
|
|
20469
20880
|
{
|
|
20470
20881
|
"data-ohw-bridge": "",
|
|
@@ -20476,7 +20887,7 @@ function VideoToolbar({
|
|
|
20476
20887
|
gap: 6,
|
|
20477
20888
|
alignItems: "center",
|
|
20478
20889
|
width: 280,
|
|
20479
|
-
background:
|
|
20890
|
+
background: OHW_BLUE,
|
|
20480
20891
|
padding: 8,
|
|
20481
20892
|
borderRadius: 12,
|
|
20482
20893
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20484,9 +20895,9 @@ function VideoToolbar({
|
|
|
20484
20895
|
opacity: pending ? 0.6 : 1
|
|
20485
20896
|
},
|
|
20486
20897
|
children: [
|
|
20487
|
-
/* @__PURE__ */
|
|
20488
|
-
/* @__PURE__ */
|
|
20489
|
-
error && /* @__PURE__ */
|
|
20898
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20899
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20900
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20490
20901
|
]
|
|
20491
20902
|
}
|
|
20492
20903
|
);
|
|
@@ -20606,8 +21017,8 @@ function AiVideoOverlay({
|
|
|
20606
21017
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20607
21018
|
const TOOLBAR_APPROX_H = 90;
|
|
20608
21019
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20609
|
-
return /* @__PURE__ */
|
|
20610
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21020
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
21021
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20611
21022
|
"button",
|
|
20612
21023
|
{
|
|
20613
21024
|
type: "button",
|
|
@@ -20635,15 +21046,15 @@ function AiVideoOverlay({
|
|
|
20635
21046
|
fontSize: 14,
|
|
20636
21047
|
fontWeight: 700
|
|
20637
21048
|
},
|
|
20638
|
-
children: /* @__PURE__ */
|
|
21049
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20639
21050
|
}
|
|
20640
21051
|
),
|
|
20641
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
21052
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20642
21053
|
ItemInteractionLayer,
|
|
20643
21054
|
{
|
|
20644
21055
|
rect: activeBlockRect,
|
|
20645
21056
|
state: toolbarState,
|
|
20646
|
-
toolbar: /* @__PURE__ */
|
|
21057
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20647
21058
|
VideoToolbar,
|
|
20648
21059
|
{
|
|
20649
21060
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20718,10 +21129,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20718
21129
|
}
|
|
20719
21130
|
|
|
20720
21131
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20721
|
-
import { Fragment as Fragment10, jsx as
|
|
21132
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20722
21133
|
var PRIMARY6 = "#0885FE";
|
|
20723
|
-
var
|
|
20724
|
-
var
|
|
21134
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21135
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20725
21136
|
function findCarouselItemElement(sectionId, index) {
|
|
20726
21137
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20727
21138
|
if (!sectionEl2) return null;
|
|
@@ -20800,8 +21211,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20800
21211
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20801
21212
|
});
|
|
20802
21213
|
}
|
|
20803
|
-
function
|
|
20804
|
-
return /* @__PURE__ */
|
|
21214
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21215
|
+
return /* @__PURE__ */ jsx24(
|
|
20805
21216
|
"button",
|
|
20806
21217
|
{
|
|
20807
21218
|
type: "button",
|
|
@@ -20817,7 +21228,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20817
21228
|
border: "none",
|
|
20818
21229
|
cursor: disabled ? "default" : "pointer",
|
|
20819
21230
|
background: "#ffffff",
|
|
20820
|
-
color:
|
|
21231
|
+
color: OHW_BLUE_DARK2,
|
|
20821
21232
|
opacity: disabled ? 0.4 : 1,
|
|
20822
21233
|
fontSize: 12,
|
|
20823
21234
|
lineHeight: "16px",
|
|
@@ -20835,7 +21246,7 @@ function TogglePill({
|
|
|
20835
21246
|
onToggle,
|
|
20836
21247
|
disabled
|
|
20837
21248
|
}) {
|
|
20838
|
-
return /* @__PURE__ */
|
|
21249
|
+
return /* @__PURE__ */ jsxs15(
|
|
20839
21250
|
"button",
|
|
20840
21251
|
{
|
|
20841
21252
|
type: "button",
|
|
@@ -20854,7 +21265,7 @@ function TogglePill({
|
|
|
20854
21265
|
border: "none",
|
|
20855
21266
|
cursor: disabled ? "default" : "pointer",
|
|
20856
21267
|
background: "#ffffff",
|
|
20857
|
-
color:
|
|
21268
|
+
color: OHW_BLUE_DARK2,
|
|
20858
21269
|
opacity: disabled ? 0.4 : 1,
|
|
20859
21270
|
fontSize: 12,
|
|
20860
21271
|
lineHeight: "16px",
|
|
@@ -20864,7 +21275,7 @@ function TogglePill({
|
|
|
20864
21275
|
},
|
|
20865
21276
|
children: [
|
|
20866
21277
|
label,
|
|
20867
|
-
/* @__PURE__ */
|
|
21278
|
+
/* @__PURE__ */ jsx24(
|
|
20868
21279
|
"span",
|
|
20869
21280
|
{
|
|
20870
21281
|
"aria-hidden": true,
|
|
@@ -20877,10 +21288,10 @@ function TogglePill({
|
|
|
20877
21288
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20878
21289
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20879
21290
|
// "disabled control" rather than "switch that is off".
|
|
20880
|
-
background: on ?
|
|
21291
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20881
21292
|
transition: "background 120ms ease"
|
|
20882
21293
|
},
|
|
20883
|
-
children: /* @__PURE__ */
|
|
21294
|
+
children: /* @__PURE__ */ jsx24(
|
|
20884
21295
|
"span",
|
|
20885
21296
|
{
|
|
20886
21297
|
style: {
|
|
@@ -20909,7 +21320,7 @@ function CarouselSlideToolbar({
|
|
|
20909
21320
|
onChangeImage,
|
|
20910
21321
|
onToggleAutoplay
|
|
20911
21322
|
}) {
|
|
20912
|
-
return /* @__PURE__ */
|
|
21323
|
+
return /* @__PURE__ */ jsxs15(
|
|
20913
21324
|
"div",
|
|
20914
21325
|
{
|
|
20915
21326
|
"data-ohw-bridge": "",
|
|
@@ -20920,7 +21331,7 @@ function CarouselSlideToolbar({
|
|
|
20920
21331
|
flexDirection: "column",
|
|
20921
21332
|
gap: 6,
|
|
20922
21333
|
alignItems: "center",
|
|
20923
|
-
background:
|
|
21334
|
+
background: OHW_BLUE2,
|
|
20924
21335
|
padding: 8,
|
|
20925
21336
|
borderRadius: 12,
|
|
20926
21337
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20932,11 +21343,11 @@ function CarouselSlideToolbar({
|
|
|
20932
21343
|
pointerEvents: pending ? "none" : "auto"
|
|
20933
21344
|
},
|
|
20934
21345
|
children: [
|
|
20935
|
-
/* @__PURE__ */
|
|
20936
|
-
/* @__PURE__ */
|
|
20937
|
-
/* @__PURE__ */
|
|
21346
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21347
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21348
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20938
21349
|
] }),
|
|
20939
|
-
error && /* @__PURE__ */
|
|
21350
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20940
21351
|
]
|
|
20941
21352
|
}
|
|
20942
21353
|
);
|
|
@@ -21076,8 +21487,8 @@ function AiFadeCarouselOverlay({
|
|
|
21076
21487
|
const activeItemRect = useLiveItemRect2(active);
|
|
21077
21488
|
const TOOLBAR_APPROX_H = 90;
|
|
21078
21489
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21079
|
-
return /* @__PURE__ */
|
|
21080
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21490
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21491
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
21081
21492
|
"button",
|
|
21082
21493
|
{
|
|
21083
21494
|
type: "button",
|
|
@@ -21106,10 +21517,10 @@ function AiFadeCarouselOverlay({
|
|
|
21106
21517
|
fontSize: 14,
|
|
21107
21518
|
fontWeight: 700
|
|
21108
21519
|
},
|
|
21109
|
-
children: /* @__PURE__ */
|
|
21520
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
21110
21521
|
}
|
|
21111
21522
|
),
|
|
21112
|
-
swapping && /* @__PURE__ */
|
|
21523
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
21113
21524
|
"div",
|
|
21114
21525
|
{
|
|
21115
21526
|
ref: skeletonRef,
|
|
@@ -21127,15 +21538,15 @@ function AiFadeCarouselOverlay({
|
|
|
21127
21538
|
zIndex: 2147483646,
|
|
21128
21539
|
pointerEvents: "none"
|
|
21129
21540
|
},
|
|
21130
|
-
children: /* @__PURE__ */
|
|
21541
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
21131
21542
|
}
|
|
21132
21543
|
),
|
|
21133
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21544
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
21134
21545
|
ItemInteractionLayer,
|
|
21135
21546
|
{
|
|
21136
21547
|
rect: activeItemRect,
|
|
21137
21548
|
state: toolbarState,
|
|
21138
|
-
toolbar: /* @__PURE__ */
|
|
21549
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
21139
21550
|
CarouselSlideToolbar,
|
|
21140
21551
|
{
|
|
21141
21552
|
pending,
|
|
@@ -21326,118 +21737,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21326
21737
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21327
21738
|
import { useEffect as useEffect16 } from "react";
|
|
21328
21739
|
|
|
21329
|
-
// src/ui/dialog.tsx
|
|
21330
|
-
import * as React9 from "react";
|
|
21331
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21332
|
-
import { X as X2 } from "lucide-react";
|
|
21333
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21334
|
-
function Dialog2({
|
|
21335
|
-
...props
|
|
21336
|
-
}) {
|
|
21337
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21338
|
-
}
|
|
21339
|
-
function DialogPortal({
|
|
21340
|
-
...props
|
|
21341
|
-
}) {
|
|
21342
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21343
|
-
}
|
|
21344
|
-
function DialogOverlay({
|
|
21345
|
-
className,
|
|
21346
|
-
...props
|
|
21347
|
-
}) {
|
|
21348
|
-
return /* @__PURE__ */ jsx24(
|
|
21349
|
-
DialogPrimitive.Overlay,
|
|
21350
|
-
{
|
|
21351
|
-
"data-slot": "dialog-overlay",
|
|
21352
|
-
"data-ohw-link-modal-root": "",
|
|
21353
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21354
|
-
...props
|
|
21355
|
-
}
|
|
21356
|
-
);
|
|
21357
|
-
}
|
|
21358
|
-
var DialogContent = React9.forwardRef(
|
|
21359
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21360
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21361
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21362
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21363
|
-
/* @__PURE__ */ jsxs15(
|
|
21364
|
-
DialogPrimitive.Content,
|
|
21365
|
-
{
|
|
21366
|
-
ref,
|
|
21367
|
-
"data-slot": "dialog-content",
|
|
21368
|
-
className: cn(
|
|
21369
|
-
positionMode,
|
|
21370
|
-
"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",
|
|
21371
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21372
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21373
|
-
className
|
|
21374
|
-
),
|
|
21375
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21376
|
-
...props,
|
|
21377
|
-
children: [
|
|
21378
|
-
children,
|
|
21379
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21380
|
-
DialogPrimitive.Close,
|
|
21381
|
-
{
|
|
21382
|
-
type: "button",
|
|
21383
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21384
|
-
"aria-label": "Close",
|
|
21385
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21386
|
-
}
|
|
21387
|
-
) : null
|
|
21388
|
-
]
|
|
21389
|
-
}
|
|
21390
|
-
)
|
|
21391
|
-
] });
|
|
21392
|
-
}
|
|
21393
|
-
);
|
|
21394
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21395
|
-
function DialogHeader({
|
|
21396
|
-
className,
|
|
21397
|
-
...props
|
|
21398
|
-
}) {
|
|
21399
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21400
|
-
}
|
|
21401
|
-
function DialogFooter({
|
|
21402
|
-
className,
|
|
21403
|
-
...props
|
|
21404
|
-
}) {
|
|
21405
|
-
return /* @__PURE__ */ jsx24(
|
|
21406
|
-
"div",
|
|
21407
|
-
{
|
|
21408
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21409
|
-
...props
|
|
21410
|
-
}
|
|
21411
|
-
);
|
|
21412
|
-
}
|
|
21413
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21414
|
-
DialogPrimitive.Title,
|
|
21415
|
-
{
|
|
21416
|
-
ref,
|
|
21417
|
-
className: cn(
|
|
21418
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21419
|
-
className
|
|
21420
|
-
),
|
|
21421
|
-
...props
|
|
21422
|
-
}
|
|
21423
|
-
));
|
|
21424
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21425
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21426
|
-
DialogPrimitive.Description,
|
|
21427
|
-
{
|
|
21428
|
-
ref,
|
|
21429
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21430
|
-
...props
|
|
21431
|
-
}
|
|
21432
|
-
));
|
|
21433
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21434
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21435
|
-
|
|
21436
21740
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21437
21741
|
import { Info, X as X4 } from "lucide-react";
|
|
21438
21742
|
|
|
21439
21743
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21440
|
-
import { ArrowRight as
|
|
21744
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21441
21745
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21442
21746
|
function DestinationBreadcrumb({
|
|
21443
21747
|
pageTitle,
|
|
@@ -21451,7 +21755,7 @@ function DestinationBreadcrumb({
|
|
|
21451
21755
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21452
21756
|
] }),
|
|
21453
21757
|
/* @__PURE__ */ jsx25(
|
|
21454
|
-
|
|
21758
|
+
ArrowRight3,
|
|
21455
21759
|
{
|
|
21456
21760
|
size: 16,
|
|
21457
21761
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21563,7 +21867,7 @@ function Label({ className, ...props }) {
|
|
|
21563
21867
|
}
|
|
21564
21868
|
|
|
21565
21869
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21566
|
-
import { ChevronDown as
|
|
21870
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21567
21871
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21568
21872
|
function FieldChevron({
|
|
21569
21873
|
onClick
|
|
@@ -21576,7 +21880,7 @@ function FieldChevron({
|
|
|
21576
21880
|
onClick,
|
|
21577
21881
|
"aria-label": "Open page list",
|
|
21578
21882
|
tabIndex: -1,
|
|
21579
|
-
children: /* @__PURE__ */ jsx29(
|
|
21883
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21580
21884
|
}
|
|
21581
21885
|
);
|
|
21582
21886
|
}
|
|
@@ -21806,7 +22110,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21806
22110
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21807
22111
|
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21808
22112
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21809
|
-
import { ArrowLeft as
|
|
22113
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21810
22114
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21811
22115
|
|
|
21812
22116
|
// src/lib/parent-scroll.ts
|
|
@@ -22083,7 +22387,7 @@ function SectionPickerOverlay({
|
|
|
22083
22387
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
22084
22388
|
onClick: onBack,
|
|
22085
22389
|
children: [
|
|
22086
|
-
/* @__PURE__ */ jsx31(
|
|
22390
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
22087
22391
|
"Back"
|
|
22088
22392
|
]
|
|
22089
22393
|
}
|
|
@@ -22152,7 +22456,7 @@ function SectionPickerOverlay({
|
|
|
22152
22456
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22153
22457
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22154
22458
|
"aria-hidden": true,
|
|
22155
|
-
children: /* @__PURE__ */ jsx31(
|
|
22459
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22156
22460
|
}
|
|
22157
22461
|
) : null
|
|
22158
22462
|
]
|
|
@@ -22536,6 +22840,7 @@ function shouldUseDevFixtures() {
|
|
|
22536
22840
|
function getLogoElement(el) {
|
|
22537
22841
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22538
22842
|
if (marked) return marked;
|
|
22843
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22539
22844
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22540
22845
|
if (!root) return null;
|
|
22541
22846
|
const anchor = el.closest("a");
|
|
@@ -22605,7 +22910,7 @@ function addFooterColumnWithPersist({
|
|
|
22605
22910
|
import {
|
|
22606
22911
|
useCallback as useCallback9,
|
|
22607
22912
|
useEffect as useEffect17,
|
|
22608
|
-
useLayoutEffect as
|
|
22913
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22609
22914
|
useRef as useRef11,
|
|
22610
22915
|
useState as useState15
|
|
22611
22916
|
} from "react";
|
|
@@ -22702,7 +23007,7 @@ function FloatingPanel({
|
|
|
22702
23007
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22703
23008
|
}, [open]);
|
|
22704
23009
|
const positionRef = useRef11(position);
|
|
22705
|
-
|
|
23010
|
+
useLayoutEffect6(() => {
|
|
22706
23011
|
if (!open) {
|
|
22707
23012
|
positionRef.current = position;
|
|
22708
23013
|
return;
|
|
@@ -22712,7 +23017,7 @@ function FloatingPanel({
|
|
|
22712
23017
|
}
|
|
22713
23018
|
positionRef.current = position;
|
|
22714
23019
|
}, [open, position, liveScroll, parentScroll]);
|
|
22715
|
-
|
|
23020
|
+
useLayoutEffect6(() => {
|
|
22716
23021
|
if (!open || !panelRef.current) return;
|
|
22717
23022
|
const el = panelRef.current;
|
|
22718
23023
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22921,7 +23226,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
22921
23226
|
}
|
|
22922
23227
|
|
|
22923
23228
|
// src/ui/button-style-panel.tsx
|
|
22924
|
-
import { Check as
|
|
23229
|
+
import { Check as Check5 } from "lucide-react";
|
|
22925
23230
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22926
23231
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
22927
23232
|
function ButtonStylePanel({
|
|
@@ -22992,7 +23297,7 @@ function ButtonStylePanel({
|
|
|
22992
23297
|
{
|
|
22993
23298
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
22994
23299
|
"aria-hidden": true,
|
|
22995
|
-
children: /* @__PURE__ */ jsx35(
|
|
23300
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
22996
23301
|
}
|
|
22997
23302
|
) : null
|
|
22998
23303
|
]
|
|
@@ -23878,12 +24183,19 @@ function useSectionDrag({
|
|
|
23878
24183
|
clearSectionDragVisuals();
|
|
23879
24184
|
return;
|
|
23880
24185
|
}
|
|
24186
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
23881
24187
|
const orderJson = JSON.stringify(
|
|
23882
24188
|
mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname, entries)
|
|
23883
24189
|
);
|
|
23884
24190
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
23885
24191
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
23886
|
-
postToParentRef.current({
|
|
24192
|
+
postToParentRef.current({
|
|
24193
|
+
type: "ow:change",
|
|
24194
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
24195
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
24196
|
+
// Undo scrolls to this section; a one-place move swaps two, so the order alone can't say which.
|
|
24197
|
+
moved: session.instanceId
|
|
24198
|
+
});
|
|
23887
24199
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
23888
24200
|
clearSectionDragVisuals();
|
|
23889
24201
|
requestAnimationFrame(() => {
|
|
@@ -24017,7 +24329,7 @@ function useSectionDrag({
|
|
|
24017
24329
|
}
|
|
24018
24330
|
|
|
24019
24331
|
// src/ui/footer-container-chrome.tsx
|
|
24020
|
-
import { Plus as
|
|
24332
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
24021
24333
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
24022
24334
|
function FooterContainerChrome({
|
|
24023
24335
|
rect,
|
|
@@ -24058,7 +24370,7 @@ function FooterContainerChrome({
|
|
|
24058
24370
|
if (addDisabled) return;
|
|
24059
24371
|
onAdd();
|
|
24060
24372
|
},
|
|
24061
|
-
children: /* @__PURE__ */ jsx36(
|
|
24373
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24062
24374
|
}
|
|
24063
24375
|
) }),
|
|
24064
24376
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24465,7 +24777,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24465
24777
|
}
|
|
24466
24778
|
|
|
24467
24779
|
// src/ui/navbar-container-chrome.tsx
|
|
24468
|
-
import { Plus as
|
|
24780
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24469
24781
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24470
24782
|
function NavbarContainerChrome({
|
|
24471
24783
|
rect,
|
|
@@ -24501,7 +24813,7 @@ function NavbarContainerChrome({
|
|
|
24501
24813
|
e.stopPropagation();
|
|
24502
24814
|
onAdd();
|
|
24503
24815
|
},
|
|
24504
|
-
children: /* @__PURE__ */ jsx37(
|
|
24816
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24505
24817
|
}
|
|
24506
24818
|
)
|
|
24507
24819
|
}
|
|
@@ -24573,7 +24885,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24573
24885
|
}
|
|
24574
24886
|
|
|
24575
24887
|
// src/OhhwellsBridge.tsx
|
|
24576
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
24888
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
|
|
24577
24889
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24578
24890
|
var PRIMARY7 = "#0885FE";
|
|
24579
24891
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25351,7 +25663,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25351
25663
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25352
25664
|
return resolveFooterLinksContainerFrom(el);
|
|
25353
25665
|
}
|
|
25354
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25666
|
+
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)) {
|
|
25355
25667
|
return getNavigationRoot(el);
|
|
25356
25668
|
}
|
|
25357
25669
|
return null;
|
|
@@ -25573,7 +25885,6 @@ var ICONS = {
|
|
|
25573
25885
|
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"/>',
|
|
25574
25886
|
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"/>'
|
|
25575
25887
|
};
|
|
25576
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25577
25888
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25578
25889
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25579
25890
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25671,7 +25982,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25671
25982
|
el.style.top = `${top}px`;
|
|
25672
25983
|
el.style.height = `${height}px`;
|
|
25673
25984
|
}
|
|
25674
|
-
var
|
|
25985
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25675
25986
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25676
25987
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25677
25988
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25698,8 +26009,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25698
26009
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25699
26010
|
const half = toolbarWidth / 2;
|
|
25700
26011
|
return Math.max(
|
|
25701
|
-
|
|
25702
|
-
Math.min(centerX, window.innerWidth -
|
|
26012
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26013
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25703
26014
|
);
|
|
25704
26015
|
}
|
|
25705
26016
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -26100,7 +26411,7 @@ function OhhwellsBridge() {
|
|
|
26100
26411
|
}, []);
|
|
26101
26412
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26102
26413
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
26103
|
-
|
|
26414
|
+
useLayoutEffect7(() => {
|
|
26104
26415
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26105
26416
|
if (next !== subdomain) setSubdomain(next);
|
|
26106
26417
|
if (next) return;
|
|
@@ -26582,21 +26893,6 @@ function OhhwellsBridge() {
|
|
|
26582
26893
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26583
26894
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26584
26895
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26585
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26586
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26587
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26588
|
-
const floatingPanelRef = useRef14(null);
|
|
26589
|
-
floatingPanelRef.current = floatingPanel;
|
|
26590
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26591
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26592
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26593
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26594
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26595
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26596
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26597
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26598
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26599
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26600
26896
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26601
26897
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26602
26898
|
const footerDragRef = useRef14(null);
|
|
@@ -26623,6 +26919,21 @@ function OhhwellsBridge() {
|
|
|
26623
26919
|
const stylesRef = useRef14("");
|
|
26624
26920
|
const appliedDrawerRef = useRef14(null);
|
|
26625
26921
|
const pendingDeleteUndoRef = useRef14(null);
|
|
26922
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26923
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
26924
|
+
const floatingPanelRef = useRef14(null);
|
|
26925
|
+
floatingPanelRef.current = floatingPanel;
|
|
26926
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
26927
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26928
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
26929
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
26930
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26931
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26932
|
+
const buttonPointerDragRef = useRef14(null);
|
|
26933
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26934
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26935
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26936
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26626
26937
|
const [sitePages, setSitePages] = useState18([]);
|
|
26627
26938
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26628
26939
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26632,7 +26943,18 @@ function OhhwellsBridge() {
|
|
|
26632
26943
|
const linkPopoverOpenRef = useRef14(false);
|
|
26633
26944
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26634
26945
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26946
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26635
26947
|
linkPopoverSessionRef.current = linkPopover;
|
|
26948
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26949
|
+
useEffect21(() => {
|
|
26950
|
+
const syncViewport = () => {
|
|
26951
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26952
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26953
|
+
};
|
|
26954
|
+
syncViewport();
|
|
26955
|
+
window.addEventListener("resize", syncViewport);
|
|
26956
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26957
|
+
}, []);
|
|
26636
26958
|
useEffect21(() => {
|
|
26637
26959
|
setSectionOrderPersistHandler((entries) => {
|
|
26638
26960
|
const currentPath = window.location.pathname;
|
|
@@ -28339,7 +28661,7 @@ function OhhwellsBridge() {
|
|
|
28339
28661
|
isFooterFrameSelection,
|
|
28340
28662
|
postToParent2
|
|
28341
28663
|
]);
|
|
28342
|
-
|
|
28664
|
+
useLayoutEffect7(() => {
|
|
28343
28665
|
if (!subdomain || isEditMode) {
|
|
28344
28666
|
setFetchState("done");
|
|
28345
28667
|
return;
|
|
@@ -28366,6 +28688,7 @@ function OhhwellsBridge() {
|
|
|
28366
28688
|
applyAiFooterFromContent(content);
|
|
28367
28689
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28368
28690
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28691
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28369
28692
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28370
28693
|
}
|
|
28371
28694
|
applyBrandChrome(content);
|
|
@@ -28376,15 +28699,16 @@ function OhhwellsBridge() {
|
|
|
28376
28699
|
if (key === "__ohw_sections") continue;
|
|
28377
28700
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28378
28701
|
if (key === AI_FOOTER_KEY) continue;
|
|
28702
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28703
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28379
28704
|
if (key === BRAND_KIT_KEY) continue;
|
|
28380
28705
|
if (key === STYLE_STORE_KEY) continue;
|
|
28381
28706
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28382
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28383
28707
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28384
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28385
28708
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28386
28709
|
continue;
|
|
28387
28710
|
}
|
|
28711
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28388
28712
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28389
28713
|
if (applyCarouselNode(key, val)) continue;
|
|
28390
28714
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28424,6 +28748,7 @@ function OhhwellsBridge() {
|
|
|
28424
28748
|
});
|
|
28425
28749
|
applyLinkByKey(key, val);
|
|
28426
28750
|
}
|
|
28751
|
+
applySectionEmbeds(content);
|
|
28427
28752
|
applyLogoFromContent(content);
|
|
28428
28753
|
applyLogoSizes(content);
|
|
28429
28754
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28612,20 +28937,22 @@ function OhhwellsBridge() {
|
|
|
28612
28937
|
}
|
|
28613
28938
|
applyAiFooterFromContent(content);
|
|
28614
28939
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28940
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28615
28941
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28616
28942
|
}
|
|
28617
28943
|
for (const [key, val] of Object.entries(content)) {
|
|
28618
28944
|
if (key === "__ohw_sections") continue;
|
|
28619
28945
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28620
28946
|
if (key === AI_FOOTER_KEY) continue;
|
|
28947
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28948
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28621
28949
|
if (key === BRAND_KIT_KEY) continue;
|
|
28622
28950
|
if (key === STYLE_STORE_KEY) continue;
|
|
28623
28951
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28624
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28625
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28626
28952
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28627
28953
|
continue;
|
|
28628
28954
|
}
|
|
28955
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28629
28956
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28630
28957
|
if (applyCarouselNode(key, val)) continue;
|
|
28631
28958
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28650,6 +28977,7 @@ function OhhwellsBridge() {
|
|
|
28650
28977
|
});
|
|
28651
28978
|
applyLinkByKey(key, val);
|
|
28652
28979
|
}
|
|
28980
|
+
applySectionEmbeds(content);
|
|
28653
28981
|
applyLogoFromContent(content);
|
|
28654
28982
|
reconcileNavbarItemsFromContent(content);
|
|
28655
28983
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28705,7 +29033,7 @@ function OhhwellsBridge() {
|
|
|
28705
29033
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28706
29034
|
};
|
|
28707
29035
|
}, [subdomain, isEditMode, pathname]);
|
|
28708
|
-
|
|
29036
|
+
useLayoutEffect7(() => {
|
|
28709
29037
|
const el = document.getElementById("ohw-loader");
|
|
28710
29038
|
if (!el) return;
|
|
28711
29039
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
@@ -28889,26 +29217,11 @@ function OhhwellsBridge() {
|
|
|
28889
29217
|
const t2 = setTimeout(measure, 500);
|
|
28890
29218
|
const ro = new ResizeObserver(schedule);
|
|
28891
29219
|
ro.observe(document.body);
|
|
28892
|
-
let lastWidth = window.innerWidth;
|
|
28893
|
-
let resizeTimers = [];
|
|
28894
|
-
const clearResizeTimers = () => {
|
|
28895
|
-
resizeTimers.forEach(clearTimeout);
|
|
28896
|
-
resizeTimers = [];
|
|
28897
|
-
};
|
|
28898
|
-
const handleResize = () => {
|
|
28899
|
-
if (window.innerWidth === lastWidth) return;
|
|
28900
|
-
lastWidth = window.innerWidth;
|
|
28901
|
-
clearResizeTimers();
|
|
28902
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
28903
|
-
};
|
|
28904
|
-
window.addEventListener("resize", handleResize);
|
|
28905
29220
|
return () => {
|
|
28906
29221
|
clearTimeout(t1);
|
|
28907
29222
|
clearTimeout(t2);
|
|
28908
29223
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28909
29224
|
ro.disconnect();
|
|
28910
|
-
clearResizeTimers();
|
|
28911
|
-
window.removeEventListener("resize", handleResize);
|
|
28912
29225
|
};
|
|
28913
29226
|
}, [pathname, isEditMode, postToParent2]);
|
|
28914
29227
|
useEffect21(() => {
|
|
@@ -29205,6 +29518,13 @@ function OhhwellsBridge() {
|
|
|
29205
29518
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29206
29519
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29207
29520
|
if (isInsideLinkEditor(target)) return;
|
|
29521
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29522
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29523
|
+
if (target.closest(
|
|
29524
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29525
|
+
)) {
|
|
29526
|
+
return;
|
|
29527
|
+
}
|
|
29208
29528
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29209
29529
|
clearMediaSelectionRef.current();
|
|
29210
29530
|
}
|
|
@@ -29228,8 +29548,6 @@ function OhhwellsBridge() {
|
|
|
29228
29548
|
return;
|
|
29229
29549
|
}
|
|
29230
29550
|
}
|
|
29231
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29232
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29233
29551
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29234
29552
|
if (collectionItem) {
|
|
29235
29553
|
e.preventDefault();
|
|
@@ -29241,11 +29559,6 @@ function OhhwellsBridge() {
|
|
|
29241
29559
|
});
|
|
29242
29560
|
return;
|
|
29243
29561
|
}
|
|
29244
|
-
if (target.closest(
|
|
29245
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29246
|
-
)) {
|
|
29247
|
-
return;
|
|
29248
|
-
}
|
|
29249
29562
|
{
|
|
29250
29563
|
const formEl = getFormElement(target);
|
|
29251
29564
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29399,9 +29712,13 @@ function OhhwellsBridge() {
|
|
|
29399
29712
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29400
29713
|
e.preventDefault();
|
|
29401
29714
|
e.stopPropagation();
|
|
29402
|
-
selectIconElementRef.current(editable);
|
|
29403
29715
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29404
29716
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29717
|
+
if (aiIcon) {
|
|
29718
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29719
|
+
} else {
|
|
29720
|
+
selectIconElementRef.current(editable);
|
|
29721
|
+
}
|
|
29405
29722
|
postToParentRef.current({
|
|
29406
29723
|
type: "ow:icon-pick",
|
|
29407
29724
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29629,6 +29946,9 @@ function OhhwellsBridge() {
|
|
|
29629
29946
|
setHoveredItemRect(null);
|
|
29630
29947
|
hoveredNavContainerRef.current = null;
|
|
29631
29948
|
setHoveredNavContainerRect(null);
|
|
29949
|
+
siblingHintElRef.current = null;
|
|
29950
|
+
setSiblingHintRect(null);
|
|
29951
|
+
setSiblingHintRects([]);
|
|
29632
29952
|
return;
|
|
29633
29953
|
}
|
|
29634
29954
|
{
|
|
@@ -29749,7 +30069,6 @@ function OhhwellsBridge() {
|
|
|
29749
30069
|
hoveredNavContainerRef.current = null;
|
|
29750
30070
|
setHoveredNavContainerRect(null);
|
|
29751
30071
|
hoveredItemElRef.current = editable;
|
|
29752
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29753
30072
|
}
|
|
29754
30073
|
}
|
|
29755
30074
|
}
|
|
@@ -30459,7 +30778,11 @@ function OhhwellsBridge() {
|
|
|
30459
30778
|
};
|
|
30460
30779
|
const handleMouseMove = (e) => {
|
|
30461
30780
|
const { clientX, clientY } = e;
|
|
30462
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30781
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30782
|
+
dismissImageHover();
|
|
30783
|
+
clearImageHover();
|
|
30784
|
+
return;
|
|
30785
|
+
}
|
|
30463
30786
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30464
30787
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30465
30788
|
formHoverElRef.current = null;
|
|
@@ -30488,7 +30811,12 @@ function OhhwellsBridge() {
|
|
|
30488
30811
|
setHoveredItemRect(null);
|
|
30489
30812
|
hoveredNavContainerRef.current = null;
|
|
30490
30813
|
setHoveredNavContainerRect(null);
|
|
30814
|
+
siblingHintElRef.current = null;
|
|
30815
|
+
setSiblingHintRect(null);
|
|
30816
|
+
setSiblingHintRects([]);
|
|
30491
30817
|
dismissImageHover();
|
|
30818
|
+
clearImageHover();
|
|
30819
|
+
setSectionGap(null);
|
|
30492
30820
|
return;
|
|
30493
30821
|
}
|
|
30494
30822
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30500,7 +30828,11 @@ function OhhwellsBridge() {
|
|
|
30500
30828
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30501
30829
|
const { clientX, clientY } = e.data;
|
|
30502
30830
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30503
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30831
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30832
|
+
dismissImageHover();
|
|
30833
|
+
clearImageHover();
|
|
30834
|
+
return;
|
|
30835
|
+
}
|
|
30504
30836
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30505
30837
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30506
30838
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30880,6 +31212,7 @@ function OhhwellsBridge() {
|
|
|
30880
31212
|
applyAiFooterFromContent(content);
|
|
30881
31213
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30882
31214
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31215
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30883
31216
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30884
31217
|
}
|
|
30885
31218
|
applyBrandChrome(content);
|
|
@@ -30894,15 +31227,16 @@ function OhhwellsBridge() {
|
|
|
30894
31227
|
}
|
|
30895
31228
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30896
31229
|
if (key === AI_FOOTER_KEY) continue;
|
|
31230
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31231
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30897
31232
|
if (key === BRAND_KIT_KEY) continue;
|
|
30898
31233
|
if (key === STYLE_STORE_KEY) continue;
|
|
30899
31234
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30900
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30901
31235
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30902
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30903
31236
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30904
31237
|
continue;
|
|
30905
31238
|
}
|
|
31239
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30906
31240
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30907
31241
|
if (applyCarouselNode(key, val)) continue;
|
|
30908
31242
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30928,6 +31262,7 @@ function OhhwellsBridge() {
|
|
|
30928
31262
|
});
|
|
30929
31263
|
applyLinkByKey(key, val);
|
|
30930
31264
|
}
|
|
31265
|
+
applySectionEmbeds(content);
|
|
30931
31266
|
applyLogoFromContent(content);
|
|
30932
31267
|
applyLogoSizes(content);
|
|
30933
31268
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -30942,6 +31277,7 @@ function OhhwellsBridge() {
|
|
|
30942
31277
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
30943
31278
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
30944
31279
|
syncButtonsFromContent(document, editContentRef.current);
|
|
31280
|
+
if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
|
|
30945
31281
|
syncNavigationDragCursorAttrs();
|
|
30946
31282
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30947
31283
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -31373,6 +31709,7 @@ function OhhwellsBridge() {
|
|
|
31373
31709
|
const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
|
|
31374
31710
|
const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
|
|
31375
31711
|
if (!instanceId || !direction) return;
|
|
31712
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
31376
31713
|
const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
|
|
31377
31714
|
if (!entries) return;
|
|
31378
31715
|
const orderJson = JSON.stringify(
|
|
@@ -31381,7 +31718,12 @@ function OhhwellsBridge() {
|
|
|
31381
31718
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
31382
31719
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
31383
31720
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
31384
|
-
postToParentRef.current({
|
|
31721
|
+
postToParentRef.current({
|
|
31722
|
+
type: "ow:change",
|
|
31723
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
31724
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
31725
|
+
moved: instanceId
|
|
31726
|
+
});
|
|
31385
31727
|
window.dispatchEvent(new Event("resize"));
|
|
31386
31728
|
};
|
|
31387
31729
|
window.addEventListener("message", handleMoveSection);
|
|
@@ -31560,6 +31902,12 @@ function OhhwellsBridge() {
|
|
|
31560
31902
|
closeLinkPopoverRef.current();
|
|
31561
31903
|
return;
|
|
31562
31904
|
}
|
|
31905
|
+
if (floatingPanelOpenRef.current) {
|
|
31906
|
+
setFloatingPanelRef.current(null);
|
|
31907
|
+
deselectRef.current();
|
|
31908
|
+
deactivateRef.current();
|
|
31909
|
+
return;
|
|
31910
|
+
}
|
|
31563
31911
|
deselectRef.current();
|
|
31564
31912
|
deactivateRef.current();
|
|
31565
31913
|
clearMediaSelectionRef.current();
|
|
@@ -31744,12 +32092,6 @@ function OhhwellsBridge() {
|
|
|
31744
32092
|
return;
|
|
31745
32093
|
}
|
|
31746
32094
|
}
|
|
31747
|
-
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !activeElRef.current) {
|
|
31748
|
-
if (runPendingDeleteUndoRef.current()) {
|
|
31749
|
-
e.preventDefault();
|
|
31750
|
-
return;
|
|
31751
|
-
}
|
|
31752
|
-
}
|
|
31753
32095
|
if (e.key !== "Escape") return;
|
|
31754
32096
|
const el = activeElRef.current;
|
|
31755
32097
|
if (el && originalContentRef.current !== null) {
|
|
@@ -32396,10 +32738,10 @@ function OhhwellsBridge() {
|
|
|
32396
32738
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32397
32739
|
window.removeEventListener("message", handleDeactivate);
|
|
32398
32740
|
window.removeEventListener("message", handleSelectNav);
|
|
32399
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32400
32741
|
window.removeEventListener("message", handleToastAction);
|
|
32401
32742
|
window.removeEventListener("message", handleFormCount);
|
|
32402
32743
|
window.removeEventListener("message", handleUiEscape);
|
|
32744
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32403
32745
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32404
32746
|
autoSaveTimers.current.clear();
|
|
32405
32747
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32693,7 +33035,7 @@ function OhhwellsBridge() {
|
|
|
32693
33035
|
postToParent2({
|
|
32694
33036
|
type: "ow:ready",
|
|
32695
33037
|
version: "1",
|
|
32696
|
-
bridgeVersion: "0.1.
|
|
33038
|
+
bridgeVersion: "0.1.169-next.449",
|
|
32697
33039
|
path: pathname,
|
|
32698
33040
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32699
33041
|
sections
|
|
@@ -32894,7 +33236,7 @@ function OhhwellsBridge() {
|
|
|
32894
33236
|
const copyHref = result.copy.getAttribute("data-ohw-href-key");
|
|
32895
33237
|
const copyHrefVal = copyHref ? result.content[copyHref] : void 0;
|
|
32896
33238
|
if (copyHref && copyHrefVal !== void 0) applyLinkByKey(copyHref, copyHrefVal);
|
|
32897
|
-
postToParent2({ type: "ow:change", nodes: result.nodes });
|
|
33239
|
+
postToParent2({ type: "ow:change", nodes: result.nodes, label: "Button duplicated" });
|
|
32898
33240
|
enforceLinkHrefs();
|
|
32899
33241
|
requestAnimationFrame(() => {
|
|
32900
33242
|
selectRef.current(result.copy);
|
|
@@ -32943,7 +33285,7 @@ function OhhwellsBridge() {
|
|
|
32943
33285
|
...editContentRef.current,
|
|
32944
33286
|
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
32945
33287
|
};
|
|
32946
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33288
|
+
postToParent2({ type: "ow:change", nodes, label: "Social icon duplicated" });
|
|
32947
33289
|
enforceLinkHrefs();
|
|
32948
33290
|
const copyRow = findSocialsRow(result.item);
|
|
32949
33291
|
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
@@ -32993,7 +33335,7 @@ function OhhwellsBridge() {
|
|
|
32993
33335
|
[NAV_COUNT_KEY]: navCount,
|
|
32994
33336
|
[NAV_ORDER_KEY]: result.orderJson
|
|
32995
33337
|
};
|
|
32996
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33338
|
+
postToParent2({ type: "ow:change", nodes, label: "Link duplicated" });
|
|
32997
33339
|
enforceLinkHrefs();
|
|
32998
33340
|
if (isNestedNavChild(selected) || navItemOwnsDropdownPanel(selected)) {
|
|
32999
33341
|
setNavGroupForceOpen(selected, true);
|
|
@@ -33033,7 +33375,8 @@ function OhhwellsBridge() {
|
|
|
33033
33375
|
{ key: result.hrefKey, text: result.href },
|
|
33034
33376
|
{ key: result.labelKey, text: result.label },
|
|
33035
33377
|
{ key: FOOTER_ORDER_KEY, text: orderJson }
|
|
33036
|
-
]
|
|
33378
|
+
],
|
|
33379
|
+
label: "Link duplicated"
|
|
33037
33380
|
});
|
|
33038
33381
|
enforceLinkHrefs();
|
|
33039
33382
|
requestAnimationFrame(() => {
|
|
@@ -33428,7 +33771,7 @@ function OhhwellsBridge() {
|
|
|
33428
33771
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33429
33772
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33430
33773
|
"data-ohw-add-field": "",
|
|
33431
|
-
children: /* @__PURE__ */ jsx40(
|
|
33774
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33432
33775
|
}
|
|
33433
33776
|
),
|
|
33434
33777
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|