@ohhwells/bridge 0.1.169 → 0.1.170-next.453
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 +1119 -787
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1133 -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,9 +189,23 @@ 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";
|
|
208
|
+
var CLONE_ATTR = "data-ohw-section-clone";
|
|
195
209
|
function isRemovedSection(el) {
|
|
196
210
|
return el.hasAttribute(REMOVED_ATTR);
|
|
197
211
|
}
|
|
@@ -260,14 +274,14 @@ function syncRemovedFlags(entries) {
|
|
|
260
274
|
const removedIds = new Set(entries.filter((e) => e.removed).map((e) => e.instanceId));
|
|
261
275
|
document.querySelectorAll(`[${REMOVED_ATTR}]`).forEach((el) => {
|
|
262
276
|
if (!removedIds.has(instanceIdOf(el))) {
|
|
263
|
-
el
|
|
277
|
+
softUnhide(el);
|
|
264
278
|
el.removeAttribute(REMOVED_ATTR);
|
|
265
279
|
}
|
|
266
280
|
});
|
|
267
281
|
for (const id of removedIds) {
|
|
268
282
|
const el = findByInstanceId(id);
|
|
269
283
|
if (el) {
|
|
270
|
-
el
|
|
284
|
+
softHide(el);
|
|
271
285
|
el.setAttribute(REMOVED_ATTR, "");
|
|
272
286
|
}
|
|
273
287
|
}
|
|
@@ -320,6 +334,7 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
|
|
|
320
334
|
if (!original) return null;
|
|
321
335
|
const clone = original.cloneNode(true);
|
|
322
336
|
clone.setAttribute("data-ohw-instance", newId);
|
|
337
|
+
clone.setAttribute(CLONE_ATTR, "");
|
|
323
338
|
const keyRekeys = rekeySectionSubtree(clone, newId);
|
|
324
339
|
original.insertAdjacentElement("afterend", clone);
|
|
325
340
|
const byId = new Map(existingEntries.map((e) => [e.instanceId, e]));
|
|
@@ -339,6 +354,15 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
|
|
|
339
354
|
function newInstanceId() {
|
|
340
355
|
return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `instance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
341
356
|
}
|
|
357
|
+
function orderBeforeMove(raw, currentPath) {
|
|
358
|
+
const entries = topLevelSections().map((el, order) => ({
|
|
359
|
+
instanceId: instanceIdOf(el),
|
|
360
|
+
type: sectionTypeOf(el),
|
|
361
|
+
order,
|
|
362
|
+
pagePath: currentPath
|
|
363
|
+
}));
|
|
364
|
+
return JSON.stringify(mergePageSectionOrder(raw, currentPath, entries));
|
|
365
|
+
}
|
|
342
366
|
function getPageSectionOrderEntries(raw, currentPath) {
|
|
343
367
|
if (!raw) return [];
|
|
344
368
|
try {
|
|
@@ -390,6 +414,10 @@ function initSectionInstancesFromContent(content, currentPath) {
|
|
|
390
414
|
if (type) el.setAttribute("data-ohw-instance", type);
|
|
391
415
|
});
|
|
392
416
|
const entries = getPageSectionOrderEntries(content[SECTION_ORDER_KEY], currentPath);
|
|
417
|
+
const listed = new Set(entries.map((entry) => entry.instanceId));
|
|
418
|
+
document.querySelectorAll(`[${CLONE_ATTR}]`).forEach((clone) => {
|
|
419
|
+
if (!listed.has(instanceIdOf(clone))) clone.remove();
|
|
420
|
+
});
|
|
393
421
|
for (const entry of entries) {
|
|
394
422
|
if (entry.instanceId === entry.type) continue;
|
|
395
423
|
if (document.querySelector(`[data-ohw-instance="${CSS.escape(entry.instanceId)}"]`)) continue;
|
|
@@ -399,6 +427,7 @@ function initSectionInstancesFromContent(content, currentPath) {
|
|
|
399
427
|
if (!original) continue;
|
|
400
428
|
const clone = original.cloneNode(true);
|
|
401
429
|
clone.setAttribute("data-ohw-instance", entry.instanceId);
|
|
430
|
+
clone.setAttribute(CLONE_ATTR, "");
|
|
402
431
|
rekeySectionSubtree(clone, entry.instanceId);
|
|
403
432
|
original.insertAdjacentElement("afterend", clone);
|
|
404
433
|
}
|
|
@@ -1098,21 +1127,21 @@ function chromeFrom(sample) {
|
|
|
1098
1127
|
};
|
|
1099
1128
|
}
|
|
1100
1129
|
function filledPrimary(seed) {
|
|
1101
|
-
const
|
|
1102
|
-
const luminance = relativeLuminance(
|
|
1130
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1131
|
+
const luminance = relativeLuminance(paint2);
|
|
1103
1132
|
return {
|
|
1104
|
-
background: toCss({ ...
|
|
1133
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1105
1134
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1106
1135
|
borderColor: TRANSPARENT,
|
|
1107
1136
|
borderWidth: "0px"
|
|
1108
1137
|
};
|
|
1109
1138
|
}
|
|
1110
1139
|
function generatedSecondary(primary) {
|
|
1111
|
-
const
|
|
1140
|
+
const paint2 = accentColor(primary);
|
|
1112
1141
|
return {
|
|
1113
1142
|
background: TRANSPARENT,
|
|
1114
|
-
color:
|
|
1115
|
-
borderColor:
|
|
1143
|
+
color: paint2,
|
|
1144
|
+
borderColor: paint2,
|
|
1116
1145
|
borderWidth: "1px"
|
|
1117
1146
|
};
|
|
1118
1147
|
}
|
|
@@ -1125,9 +1154,9 @@ function generatedGhost(primary) {
|
|
|
1125
1154
|
};
|
|
1126
1155
|
}
|
|
1127
1156
|
function normalizeOutlineChrome(outline, primary) {
|
|
1128
|
-
const
|
|
1157
|
+
const paint2 = accentColor(primary);
|
|
1129
1158
|
const text = parseColor(outline.color);
|
|
1130
|
-
const paintRgb = parseColor(
|
|
1159
|
+
const paintRgb = parseColor(paint2);
|
|
1131
1160
|
const primaryLabel = parseColor(primary.color);
|
|
1132
1161
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1133
1162
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1136,8 +1165,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1136
1165
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1137
1166
|
return {
|
|
1138
1167
|
...outline,
|
|
1139
|
-
color:
|
|
1140
|
-
borderColor: hasBorder ?
|
|
1168
|
+
color: paint2,
|
|
1169
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1141
1170
|
};
|
|
1142
1171
|
}
|
|
1143
1172
|
function generateButtonVariants(samples) {
|
|
@@ -1556,6 +1585,8 @@ function brandTrackedFontFamily(doc, stack) {
|
|
|
1556
1585
|
}
|
|
1557
1586
|
var paintLockByEl = /* @__PURE__ */ new WeakMap();
|
|
1558
1587
|
var paintObserverByEl = /* @__PURE__ */ new WeakMap();
|
|
1588
|
+
var prePaintByEl = /* @__PURE__ */ new WeakMap();
|
|
1589
|
+
var paintedEls = /* @__PURE__ */ new Set();
|
|
1559
1590
|
var PAINT_GUARD_ATTRS = {
|
|
1560
1591
|
attributes: true,
|
|
1561
1592
|
attributeFilter: ["style", "class"]
|
|
@@ -1619,6 +1650,18 @@ function paintedTokensOf(el) {
|
|
|
1619
1650
|
}
|
|
1620
1651
|
function applyButtonStyle(el, assignment, tokens) {
|
|
1621
1652
|
const doc = el.ownerDocument;
|
|
1653
|
+
if (!prePaintByEl.has(el)) {
|
|
1654
|
+
const label = labelElement(el);
|
|
1655
|
+
const ownLabel = label && label !== el ? label : null;
|
|
1656
|
+
prePaintByEl.set(el, {
|
|
1657
|
+
style: el.getAttribute("style"),
|
|
1658
|
+
variant: el.getAttribute("data-ohw-btn-variant"),
|
|
1659
|
+
size: el.getAttribute("data-ohw-btn-size"),
|
|
1660
|
+
label: ownLabel,
|
|
1661
|
+
labelStyle: ownLabel?.getAttribute("style") ?? null
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
paintedEls.add(el);
|
|
1622
1665
|
const tracked = {
|
|
1623
1666
|
...tokens,
|
|
1624
1667
|
variants: {
|
|
@@ -1638,6 +1681,31 @@ function applyButtonStylesFromContent(doc, content) {
|
|
|
1638
1681
|
if (!el) continue;
|
|
1639
1682
|
applyButtonStyle(el, assignment, tokensFromButton(el));
|
|
1640
1683
|
}
|
|
1684
|
+
for (const el of paintedEls) {
|
|
1685
|
+
if (!el.isConnected) {
|
|
1686
|
+
paintedEls.delete(el);
|
|
1687
|
+
continue;
|
|
1688
|
+
}
|
|
1689
|
+
const id = buttonId(el);
|
|
1690
|
+
if (el.ownerDocument === doc && (!id || !assignments[id])) unpaintButton(el);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
function unpaintButton(el) {
|
|
1694
|
+
paintObserverByEl.get(el)?.disconnect();
|
|
1695
|
+
paintObserverByEl.delete(el);
|
|
1696
|
+
paintLockByEl.delete(el);
|
|
1697
|
+
paintedEls.delete(el);
|
|
1698
|
+
const before = prePaintByEl.get(el);
|
|
1699
|
+
prePaintByEl.delete(el);
|
|
1700
|
+
if (!before) return;
|
|
1701
|
+
const restore = (target, name, value) => {
|
|
1702
|
+
if (value === null) target.removeAttribute(name);
|
|
1703
|
+
else target.setAttribute(name, value);
|
|
1704
|
+
};
|
|
1705
|
+
restore(el, "style", before.style);
|
|
1706
|
+
restore(el, "data-ohw-btn-variant", before.variant);
|
|
1707
|
+
restore(el, "data-ohw-btn-size", before.size);
|
|
1708
|
+
if (before.label?.isConnected) restore(before.label, "style", before.labelStyle);
|
|
1641
1709
|
}
|
|
1642
1710
|
function withAssignment(content, id, assignment) {
|
|
1643
1711
|
return { ...readAssignments(content), [id]: assignment };
|
|
@@ -2188,6 +2256,7 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2188
2256
|
}
|
|
2189
2257
|
const snapshots = readSnapshots(content);
|
|
2190
2258
|
const collections = readCollections(content);
|
|
2259
|
+
dropUnsavedCopies(doc, snapshots, collections);
|
|
2191
2260
|
for (const collectionState of Object.values(collections)) {
|
|
2192
2261
|
const live = collectionState.members.map((id) => findButton(doc, id) ?? restoreSnapshot(doc, snapshots[id], content)).filter((el) => Boolean(el && !hidden.has(buttonId(el) ?? "")));
|
|
2193
2262
|
if (live.length === 0) continue;
|
|
@@ -2212,6 +2281,18 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2212
2281
|
for (const member of live) setButtonDragAttr(member);
|
|
2213
2282
|
}
|
|
2214
2283
|
}
|
|
2284
|
+
function dropUnsavedCopies(doc, snapshots, collections) {
|
|
2285
|
+
const stale = Array.from(doc.querySelectorAll('[data-ohw-href-key*="-copy-"]')).filter((el) => {
|
|
2286
|
+
const id = buttonId(el);
|
|
2287
|
+
return Boolean(id && /-copy-\d+-href$/.test(id) && !snapshots[id]);
|
|
2288
|
+
});
|
|
2289
|
+
for (const el of stale) {
|
|
2290
|
+
const collection = buttonCollectionOf(el);
|
|
2291
|
+
el.remove();
|
|
2292
|
+
const id = collection?.getAttribute(COLLECTION_ATTR) ?? "";
|
|
2293
|
+
if (collection && !collections[id] && listCollectionMembers(collection).length <= 1) unwrapCollection(collection);
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2215
2296
|
function restoreSnapshot(doc, snapshot, content) {
|
|
2216
2297
|
if (!snapshot) return null;
|
|
2217
2298
|
const existing = findButton(doc, snapshot.id);
|
|
@@ -4746,6 +4827,9 @@ function reconcileNavbarItemsFromContent(content) {
|
|
|
4746
4827
|
}
|
|
4747
4828
|
}
|
|
4748
4829
|
pruneNavbarItemsNotInOrder(allowed);
|
|
4830
|
+
for (const node of orderForest) {
|
|
4831
|
+
if (node.children.length === 0) collapseEmptyNavDropdownForParent(node.id);
|
|
4832
|
+
}
|
|
4749
4833
|
applyNavForest(orderForest);
|
|
4750
4834
|
for (const parentKey of openParentKeys) {
|
|
4751
4835
|
const trigger = document.querySelector(
|
|
@@ -5665,10 +5749,10 @@ function rekeyItemClone(clone, source, sibling, group, newIndex) {
|
|
|
5665
5749
|
function setRemoved(el, removed) {
|
|
5666
5750
|
if (removed) {
|
|
5667
5751
|
el.setAttribute(ITEM_REMOVED_ATTR, "");
|
|
5668
|
-
el
|
|
5752
|
+
softHide(el);
|
|
5669
5753
|
} else if (el.hasAttribute(ITEM_REMOVED_ATTR)) {
|
|
5670
5754
|
el.removeAttribute(ITEM_REMOVED_ATTR);
|
|
5671
|
-
el
|
|
5755
|
+
softUnhide(el);
|
|
5672
5756
|
}
|
|
5673
5757
|
}
|
|
5674
5758
|
function seedState(group) {
|
|
@@ -6678,6 +6762,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6678
6762
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6679
6763
|
return target ? pricingFeatureList(target).length : 0;
|
|
6680
6764
|
}
|
|
6765
|
+
function prevailingFeatureIcon(features) {
|
|
6766
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6767
|
+
for (const row of features) {
|
|
6768
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6769
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6770
|
+
entry.count += 1;
|
|
6771
|
+
counts.set(key, entry);
|
|
6772
|
+
}
|
|
6773
|
+
let best = null;
|
|
6774
|
+
for (const entry of counts.values()) {
|
|
6775
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6776
|
+
}
|
|
6777
|
+
if (!best) return {};
|
|
6778
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6779
|
+
}
|
|
6681
6780
|
function addPricingCardFeature(tree, index, text) {
|
|
6682
6781
|
return withPricingCollection(tree, (collection) => {
|
|
6683
6782
|
const children = collection.children;
|
|
@@ -6686,7 +6785,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6686
6785
|
const features = pricingFeatureList(target);
|
|
6687
6786
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6688
6787
|
target.slots = target.slots ?? {};
|
|
6689
|
-
target.slots.features = [...features, { text }];
|
|
6788
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6690
6789
|
return true;
|
|
6691
6790
|
});
|
|
6692
6791
|
}
|
|
@@ -7330,6 +7429,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7330
7429
|
);
|
|
7331
7430
|
}
|
|
7332
7431
|
|
|
7432
|
+
// src/lib/youtube.ts
|
|
7433
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7434
|
+
function extractYouTubeId(input) {
|
|
7435
|
+
const trimmed = input.trim();
|
|
7436
|
+
if (!trimmed) return null;
|
|
7437
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7438
|
+
let url;
|
|
7439
|
+
try {
|
|
7440
|
+
url = new URL(trimmed);
|
|
7441
|
+
} catch {
|
|
7442
|
+
return null;
|
|
7443
|
+
}
|
|
7444
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7445
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7446
|
+
return null;
|
|
7447
|
+
}
|
|
7448
|
+
let candidate = null;
|
|
7449
|
+
if (host === "youtu.be") {
|
|
7450
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7451
|
+
} else if (url.pathname === "/watch") {
|
|
7452
|
+
candidate = url.searchParams.get("v");
|
|
7453
|
+
} else {
|
|
7454
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7455
|
+
candidate = match ? match[1] : null;
|
|
7456
|
+
}
|
|
7457
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7458
|
+
}
|
|
7459
|
+
|
|
7460
|
+
// src/lib/section-embed.ts
|
|
7461
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7462
|
+
function readStoredEmbed(value) {
|
|
7463
|
+
if (value.startsWith("start\n")) {
|
|
7464
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7465
|
+
}
|
|
7466
|
+
return { raw: value, at: "end" };
|
|
7467
|
+
}
|
|
7468
|
+
function embedFrameSrc(value) {
|
|
7469
|
+
const videoId = extractYouTubeId(value);
|
|
7470
|
+
if (videoId) {
|
|
7471
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7472
|
+
}
|
|
7473
|
+
let url;
|
|
7474
|
+
try {
|
|
7475
|
+
url = new URL(value);
|
|
7476
|
+
} catch {
|
|
7477
|
+
return null;
|
|
7478
|
+
}
|
|
7479
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7480
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7481
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7482
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7483
|
+
return { src, title: "Map" };
|
|
7484
|
+
}
|
|
7485
|
+
if (host === "maps.app.goo.gl") {
|
|
7486
|
+
return { src: value, title: "Map" };
|
|
7487
|
+
}
|
|
7488
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7489
|
+
return { src: value, title: "Calendar" };
|
|
7490
|
+
}
|
|
7491
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7492
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7493
|
+
}
|
|
7494
|
+
if (host === "forms.gle") {
|
|
7495
|
+
return { src: value, title: "Form" };
|
|
7496
|
+
}
|
|
7497
|
+
return null;
|
|
7498
|
+
}
|
|
7499
|
+
function place(section, box, at) {
|
|
7500
|
+
if (at === "start") {
|
|
7501
|
+
section.insertBefore(box, section.firstChild);
|
|
7502
|
+
return;
|
|
7503
|
+
}
|
|
7504
|
+
section.appendChild(box);
|
|
7505
|
+
}
|
|
7506
|
+
function paint(section, key, src, title, at) {
|
|
7507
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7508
|
+
const frame = existing?.querySelector("iframe");
|
|
7509
|
+
if (existing && frame) {
|
|
7510
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7511
|
+
frame.title = title;
|
|
7512
|
+
place(section, existing, at);
|
|
7513
|
+
return;
|
|
7514
|
+
}
|
|
7515
|
+
existing?.remove();
|
|
7516
|
+
const box = document.createElement("div");
|
|
7517
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7518
|
+
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;";
|
|
7519
|
+
const frameWrap = document.createElement("div");
|
|
7520
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7521
|
+
const iframe = document.createElement("iframe");
|
|
7522
|
+
iframe.src = src;
|
|
7523
|
+
iframe.title = title;
|
|
7524
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7525
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7526
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7527
|
+
frameWrap.appendChild(iframe);
|
|
7528
|
+
box.appendChild(frameWrap);
|
|
7529
|
+
place(section, box, at);
|
|
7530
|
+
}
|
|
7531
|
+
function applySectionEmbeds(content) {
|
|
7532
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7533
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7534
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7535
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7536
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7537
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7538
|
+
if (!section || !stored || !frame) {
|
|
7539
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7540
|
+
continue;
|
|
7541
|
+
}
|
|
7542
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7543
|
+
}
|
|
7544
|
+
}
|
|
7545
|
+
|
|
7333
7546
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7334
7547
|
import { flushSync } from "react-dom";
|
|
7335
7548
|
import { createRoot } from "react-dom/client";
|
|
@@ -7903,7 +8116,7 @@ var AI_MOBILE_CSS = [
|
|
|
7903
8116
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7904
8117
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7905
8118
|
// 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-
|
|
8119
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7907
8120
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7908
8121
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7909
8122
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -7919,8 +8132,10 @@ var AI_MOBILE_CSS = [
|
|
|
7919
8132
|
"[data-ai-section]{overflow-x:hidden}",
|
|
7920
8133
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
7921
8134
|
// 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
|
-
|
|
8135
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8136
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8137
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8138
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
7924
8139
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
7925
8140
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
7926
8141
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8125,6 +8340,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8125
8340
|
function textAttrs(ctx, path) {
|
|
8126
8341
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8127
8342
|
}
|
|
8343
|
+
var AI_RESPONSIVE_CSS = [
|
|
8344
|
+
"@media (max-width: 960px) {",
|
|
8345
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8346
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8347
|
+
"}",
|
|
8348
|
+
"@media (max-width: 640px) {",
|
|
8349
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8350
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8351
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8352
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8353
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8354
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8355
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8356
|
+
// layered text used to be.
|
|
8357
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8358
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8359
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8360
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8361
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8362
|
+
// other rule had already been taught to stand down.
|
|
8363
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8364
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8365
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8366
|
+
"}"
|
|
8367
|
+
].join("\n");
|
|
8128
8368
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8129
8369
|
function MediaBox({
|
|
8130
8370
|
refValue,
|
|
@@ -8179,7 +8419,7 @@ function MediaBox({
|
|
|
8179
8419
|
position: fill ? "absolute" : void 0,
|
|
8180
8420
|
inset: fill ? 0 : void 0,
|
|
8181
8421
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8182
|
-
height: fill ? "100%" : void 0,
|
|
8422
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8183
8423
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8184
8424
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8185
8425
|
borderRadius: radius,
|
|
@@ -9675,7 +9915,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9675
9915
|
return /* @__PURE__ */ jsx(
|
|
9676
9916
|
"div",
|
|
9677
9917
|
{
|
|
9678
|
-
"data-ai-grid":
|
|
9918
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9679
9919
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9680
9920
|
style: {
|
|
9681
9921
|
display: "grid",
|
|
@@ -9977,7 +10217,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
9977
10217
|
},
|
|
9978
10218
|
children: [
|
|
9979
10219
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
9980
|
-
// The section's `data-ai-
|
|
10220
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
9981
10221
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
9982
10222
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
9983
10223
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10396,6 +10636,7 @@ function AiTreeRenderer({
|
|
|
10396
10636
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10397
10637
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10398
10638
|
...bgAttrs,
|
|
10639
|
+
"data-ai-responsive": "",
|
|
10399
10640
|
style: {
|
|
10400
10641
|
position: "relative",
|
|
10401
10642
|
padding: `${padCss} 0`,
|
|
@@ -10409,12 +10650,13 @@ function AiTreeRenderer({
|
|
|
10409
10650
|
...fillHeight ? { display: "grid" } : {}
|
|
10410
10651
|
},
|
|
10411
10652
|
children: [
|
|
10412
|
-
|
|
10653
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10413
10654
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
10655
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10414
10656
|
/* @__PURE__ */ jsx(
|
|
10415
10657
|
"div",
|
|
10416
10658
|
{
|
|
10417
|
-
"data-ai-
|
|
10659
|
+
"data-ai-section-inner": "",
|
|
10418
10660
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10419
10661
|
style: {
|
|
10420
10662
|
position: "relative",
|
|
@@ -10431,7 +10673,7 @@ function AiTreeRenderer({
|
|
|
10431
10673
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10432
10674
|
"div",
|
|
10433
10675
|
{
|
|
10434
|
-
"data-ai-
|
|
10676
|
+
"data-ai-columns": "",
|
|
10435
10677
|
style: {
|
|
10436
10678
|
display: "grid",
|
|
10437
10679
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11093,9 +11335,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11093
11335
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11094
11336
|
continue;
|
|
11095
11337
|
}
|
|
11096
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11097
11338
|
let container = existing?.container;
|
|
11339
|
+
let isNewMount = false;
|
|
11098
11340
|
if (!container || !container.isConnected) {
|
|
11341
|
+
isNewMount = true;
|
|
11099
11342
|
existing?.root.unmount();
|
|
11100
11343
|
container?.remove();
|
|
11101
11344
|
container = document.createElement("div");
|
|
@@ -11433,6 +11676,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11433
11676
|
return 3;
|
|
11434
11677
|
}
|
|
11435
11678
|
}
|
|
11679
|
+
function readLiveSocialItems() {
|
|
11680
|
+
const root = getFooterRoot();
|
|
11681
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11682
|
+
if (!row) return [];
|
|
11683
|
+
const items = [];
|
|
11684
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11685
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11686
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11687
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11688
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11689
|
+
items.push({ platform, href });
|
|
11690
|
+
}
|
|
11691
|
+
return items;
|
|
11692
|
+
}
|
|
11693
|
+
function syncSocialRowsFromDom(tree) {
|
|
11694
|
+
const root = getFooterRoot();
|
|
11695
|
+
if (!root) return;
|
|
11696
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11697
|
+
const live = readLiveSocialItems();
|
|
11698
|
+
if (row && live.length === 0) return;
|
|
11699
|
+
for (const col of tree.columns) {
|
|
11700
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11701
|
+
if (block.type !== "social-row") return [block];
|
|
11702
|
+
if (!row) return [];
|
|
11703
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11704
|
+
});
|
|
11705
|
+
}
|
|
11706
|
+
}
|
|
11436
11707
|
function collectBrandBlocks(tree) {
|
|
11437
11708
|
const brand = [];
|
|
11438
11709
|
for (const col of tree.columns) {
|
|
@@ -11678,6 +11949,7 @@ function textOf2(el) {
|
|
|
11678
11949
|
}
|
|
11679
11950
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11680
11951
|
const next = cloneTree(tree);
|
|
11952
|
+
syncSocialRowsFromDom(next);
|
|
11681
11953
|
const domCols = listFooterColumns().map((col) => {
|
|
11682
11954
|
const heading = getFooterColumnHeadingEl(col);
|
|
11683
11955
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -17490,7 +17762,7 @@ function apiBase() {
|
|
|
17490
17762
|
function bridgeVersion() {
|
|
17491
17763
|
try {
|
|
17492
17764
|
if (true) {
|
|
17493
|
-
return "0.1.
|
|
17765
|
+
return "0.1.170-next.453";
|
|
17494
17766
|
}
|
|
17495
17767
|
} catch {
|
|
17496
17768
|
}
|
|
@@ -17504,7 +17776,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17504
17776
|
return;
|
|
17505
17777
|
}
|
|
17506
17778
|
try {
|
|
17507
|
-
const v = true ? "0.1.
|
|
17779
|
+
const v = true ? "0.1.170-next.453" : "";
|
|
17508
17780
|
if (v) {
|
|
17509
17781
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17510
17782
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -17665,7 +17937,9 @@ function isFieldRequired(wrapper) {
|
|
|
17665
17937
|
function markFormFields(form) {
|
|
17666
17938
|
form.querySelectorAll("input, textarea").forEach((input) => {
|
|
17667
17939
|
const type = input.type;
|
|
17668
|
-
if (type === "submit" || type === "button" || type === "reset" || type === "hidden")
|
|
17940
|
+
if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
|
|
17941
|
+
return;
|
|
17942
|
+
}
|
|
17669
17943
|
if (getFieldWrapper(input)) return;
|
|
17670
17944
|
let wrapper = input;
|
|
17671
17945
|
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll("input, textarea").length === 1) {
|
|
@@ -18182,6 +18456,7 @@ function MediaOverlay({
|
|
|
18182
18456
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18183
18457
|
);
|
|
18184
18458
|
}, [isVideo]);
|
|
18459
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18185
18460
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18186
18461
|
const box = {
|
|
18187
18462
|
position: "fixed",
|
|
@@ -18280,11 +18555,10 @@ function MediaOverlay({
|
|
|
18280
18555
|
className: "flex items-center justify-center cursor-pointer",
|
|
18281
18556
|
style: {
|
|
18282
18557
|
...box,
|
|
18283
|
-
//
|
|
18284
|
-
//
|
|
18285
|
-
//
|
|
18286
|
-
|
|
18287
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18558
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18559
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18560
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18561
|
+
pointerEvents: "none",
|
|
18288
18562
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18289
18563
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18290
18564
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18311,17 +18585,17 @@ function MediaOverlay({
|
|
|
18311
18585
|
},
|
|
18312
18586
|
children: [
|
|
18313
18587
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18314
|
-
|
|
18588
|
+
replaceLabel
|
|
18315
18589
|
]
|
|
18316
18590
|
}
|
|
18317
18591
|
),
|
|
18318
|
-
replaceMode
|
|
18592
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18319
18593
|
Button,
|
|
18320
18594
|
{
|
|
18321
18595
|
"data-ohw-media-overlay": "",
|
|
18322
18596
|
variant: "outline",
|
|
18323
18597
|
size: "sm",
|
|
18324
|
-
"aria-label":
|
|
18598
|
+
"aria-label": replaceLabel,
|
|
18325
18599
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18326
18600
|
style: {
|
|
18327
18601
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18344,7 +18618,7 @@ function MediaOverlay({
|
|
|
18344
18618
|
},
|
|
18345
18619
|
children: [
|
|
18346
18620
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18347
|
-
replaceMode === "full" ?
|
|
18621
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18348
18622
|
]
|
|
18349
18623
|
}
|
|
18350
18624
|
)
|
|
@@ -18492,7 +18766,7 @@ function highlightedRect() {
|
|
|
18492
18766
|
const rect = first.getBoundingClientRect();
|
|
18493
18767
|
return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
|
|
18494
18768
|
}
|
|
18495
|
-
function installAiChangeHighlight() {
|
|
18769
|
+
function installAiChangeHighlight(select) {
|
|
18496
18770
|
const onMessage = (e) => {
|
|
18497
18771
|
const data = e.data;
|
|
18498
18772
|
if (data?.type !== "ow:ai-highlight") return;
|
|
@@ -18501,6 +18775,8 @@ function installAiChangeHighlight() {
|
|
|
18501
18775
|
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;
|
|
18502
18776
|
const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
|
|
18503
18777
|
const found = highlightChangedElements(keys, item, sectionId);
|
|
18778
|
+
const first = data.select === true ? document.querySelector(`[${MARK_ATTR}]`) : null;
|
|
18779
|
+
if (first) select?.(first);
|
|
18504
18780
|
const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
|
|
18505
18781
|
window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
|
|
18506
18782
|
};
|
|
@@ -18508,6 +18784,28 @@ function installAiChangeHighlight() {
|
|
|
18508
18784
|
return () => window.removeEventListener("message", onMessage);
|
|
18509
18785
|
}
|
|
18510
18786
|
|
|
18787
|
+
// src/lib/history-key-relay.ts
|
|
18788
|
+
var isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent);
|
|
18789
|
+
function historyActionFor(e, mac = isMac()) {
|
|
18790
|
+
const mod = mac ? e.metaKey : e.ctrlKey;
|
|
18791
|
+
if (!mod || e.altKey) return null;
|
|
18792
|
+
const key = e.key.toLowerCase();
|
|
18793
|
+
if (key === "z") return e.shiftKey ? "redo" : "undo";
|
|
18794
|
+
if (key === "y" && !mac) return "redo";
|
|
18795
|
+
return null;
|
|
18796
|
+
}
|
|
18797
|
+
var isEditingText = (el) => !!el && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLElement && el.isContentEditable);
|
|
18798
|
+
function installHistoryKeyRelay() {
|
|
18799
|
+
const onKeyDown = (e) => {
|
|
18800
|
+
const action = historyActionFor(e);
|
|
18801
|
+
if (!action || isEditingText(document.activeElement)) return;
|
|
18802
|
+
e.preventDefault();
|
|
18803
|
+
window.parent?.postMessage({ type: "ow:history-key", action }, "*");
|
|
18804
|
+
};
|
|
18805
|
+
window.addEventListener("keydown", onKeyDown);
|
|
18806
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
18807
|
+
}
|
|
18808
|
+
|
|
18511
18809
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18512
18810
|
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
18513
18811
|
var findSectionElement = findByInstanceId;
|
|
@@ -18760,7 +19058,8 @@ function AiSectionOverlay({
|
|
|
18760
19058
|
window.addEventListener("message", onMessage);
|
|
18761
19059
|
return () => window.removeEventListener("message", onMessage);
|
|
18762
19060
|
}, [postToParent2]);
|
|
18763
|
-
useEffect8(() => installAiChangeHighlight(), []);
|
|
19061
|
+
useEffect8(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
|
|
19062
|
+
useEffect8(() => installHistoryKeyRelay(), []);
|
|
18764
19063
|
const [hoveredId, setHoveredId] = useState7(null);
|
|
18765
19064
|
useEffect8(() => {
|
|
18766
19065
|
const onMove = (e) => {
|
|
@@ -18950,8 +19249,24 @@ function AiSectionOverlay({
|
|
|
18950
19249
|
}
|
|
18951
19250
|
|
|
18952
19251
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18953
|
-
import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
|
|
18954
|
-
import {
|
|
19252
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
19253
|
+
import {
|
|
19254
|
+
AlignCenter,
|
|
19255
|
+
AlignLeft,
|
|
19256
|
+
AlignRight,
|
|
19257
|
+
ArrowLeft as ArrowLeft2,
|
|
19258
|
+
ArrowRight as ArrowRight2,
|
|
19259
|
+
Check as Check2,
|
|
19260
|
+
ChevronDown as ChevronDown3,
|
|
19261
|
+
Image as ImageIcon2,
|
|
19262
|
+
ImageMinus,
|
|
19263
|
+
ImagePlus,
|
|
19264
|
+
Link as LinkIcon,
|
|
19265
|
+
Minus,
|
|
19266
|
+
Palette,
|
|
19267
|
+
Plus as Plus2,
|
|
19268
|
+
Star
|
|
19269
|
+
} from "lucide-react";
|
|
18955
19270
|
|
|
18956
19271
|
// src/lib/ai-media-strip-tree.ts
|
|
18957
19272
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19065,14 +19380,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19065
19380
|
return true;
|
|
19066
19381
|
});
|
|
19067
19382
|
}
|
|
19068
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19069
|
-
return withMediaStrip(tree, (block) => {
|
|
19070
|
-
const items = block.items;
|
|
19071
|
-
if (index < 0 || index >= items.length) return false;
|
|
19072
|
-
items[index] = { ...items[index], alt };
|
|
19073
|
-
return true;
|
|
19074
|
-
});
|
|
19075
|
-
}
|
|
19076
19383
|
function setMediaStripItemLink(tree, index, link) {
|
|
19077
19384
|
return withMediaStrip(tree, (block) => {
|
|
19078
19385
|
const items = block.items;
|
|
@@ -19090,11 +19397,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19090
19397
|
});
|
|
19091
19398
|
}
|
|
19092
19399
|
|
|
19400
|
+
// src/ui/dialog.tsx
|
|
19401
|
+
import * as React9 from "react";
|
|
19402
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19403
|
+
import { X as X2 } from "lucide-react";
|
|
19404
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19405
|
+
function Dialog2({
|
|
19406
|
+
...props
|
|
19407
|
+
}) {
|
|
19408
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19409
|
+
}
|
|
19410
|
+
function DialogPortal({
|
|
19411
|
+
...props
|
|
19412
|
+
}) {
|
|
19413
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19414
|
+
}
|
|
19415
|
+
function DialogOverlay({
|
|
19416
|
+
className,
|
|
19417
|
+
...props
|
|
19418
|
+
}) {
|
|
19419
|
+
return /* @__PURE__ */ jsx20(
|
|
19420
|
+
DialogPrimitive.Overlay,
|
|
19421
|
+
{
|
|
19422
|
+
"data-slot": "dialog-overlay",
|
|
19423
|
+
"data-ohw-link-modal-root": "",
|
|
19424
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19425
|
+
...props
|
|
19426
|
+
}
|
|
19427
|
+
);
|
|
19428
|
+
}
|
|
19429
|
+
var DialogContent = React9.forwardRef(
|
|
19430
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19431
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19432
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19433
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19434
|
+
/* @__PURE__ */ jsxs11(
|
|
19435
|
+
DialogPrimitive.Content,
|
|
19436
|
+
{
|
|
19437
|
+
ref,
|
|
19438
|
+
"data-slot": "dialog-content",
|
|
19439
|
+
className: cn(
|
|
19440
|
+
positionMode,
|
|
19441
|
+
"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",
|
|
19442
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19443
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19444
|
+
className
|
|
19445
|
+
),
|
|
19446
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19447
|
+
...props,
|
|
19448
|
+
children: [
|
|
19449
|
+
children,
|
|
19450
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19451
|
+
DialogPrimitive.Close,
|
|
19452
|
+
{
|
|
19453
|
+
type: "button",
|
|
19454
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19455
|
+
"aria-label": "Close",
|
|
19456
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19457
|
+
}
|
|
19458
|
+
) : null
|
|
19459
|
+
]
|
|
19460
|
+
}
|
|
19461
|
+
)
|
|
19462
|
+
] });
|
|
19463
|
+
}
|
|
19464
|
+
);
|
|
19465
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19466
|
+
function DialogHeader({
|
|
19467
|
+
className,
|
|
19468
|
+
...props
|
|
19469
|
+
}) {
|
|
19470
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19471
|
+
}
|
|
19472
|
+
function DialogFooter({
|
|
19473
|
+
className,
|
|
19474
|
+
...props
|
|
19475
|
+
}) {
|
|
19476
|
+
return /* @__PURE__ */ jsx20(
|
|
19477
|
+
"div",
|
|
19478
|
+
{
|
|
19479
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19480
|
+
...props
|
|
19481
|
+
}
|
|
19482
|
+
);
|
|
19483
|
+
}
|
|
19484
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19485
|
+
DialogPrimitive.Title,
|
|
19486
|
+
{
|
|
19487
|
+
ref,
|
|
19488
|
+
className: cn(
|
|
19489
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19490
|
+
className
|
|
19491
|
+
),
|
|
19492
|
+
...props
|
|
19493
|
+
}
|
|
19494
|
+
));
|
|
19495
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19496
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19497
|
+
DialogPrimitive.Description,
|
|
19498
|
+
{
|
|
19499
|
+
ref,
|
|
19500
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19501
|
+
...props
|
|
19502
|
+
}
|
|
19503
|
+
));
|
|
19504
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19505
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19506
|
+
|
|
19093
19507
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19094
|
-
import { Fragment as Fragment7, jsx as
|
|
19095
|
-
var PRIMARY3 = "#0885FE";
|
|
19096
|
-
var
|
|
19097
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19508
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19509
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19510
|
+
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]";
|
|
19098
19511
|
function findMediaStripItemElement(sectionId, index) {
|
|
19099
19512
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19100
19513
|
if (!sectionEl2) return null;
|
|
@@ -19104,14 +19517,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19104
19517
|
}
|
|
19105
19518
|
return null;
|
|
19106
19519
|
}
|
|
19107
|
-
function
|
|
19108
|
-
|
|
19520
|
+
function itemRefFromTarget(target) {
|
|
19521
|
+
if (!(target instanceof Element)) return null;
|
|
19522
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19523
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19524
|
+
if (!itemEl) return null;
|
|
19525
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19526
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19527
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19528
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19529
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19530
|
+
return { sectionId, index };
|
|
19531
|
+
}
|
|
19532
|
+
function sameRef(a, b) {
|
|
19533
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19534
|
+
}
|
|
19535
|
+
function rectOf(el) {
|
|
19109
19536
|
if (!el) return null;
|
|
19110
19537
|
const r2 = el.getBoundingClientRect();
|
|
19111
19538
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19112
19539
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19113
19540
|
}
|
|
19114
|
-
function
|
|
19541
|
+
function readRect2(ref) {
|
|
19542
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19543
|
+
}
|
|
19544
|
+
function readStripRect(ref) {
|
|
19545
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19546
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19547
|
+
}
|
|
19548
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19115
19549
|
const [rect, setRect] = useState8(null);
|
|
19116
19550
|
useEffect9(() => {
|
|
19117
19551
|
if (!ref) {
|
|
@@ -19119,7 +19553,7 @@ function useLiveItemRect(ref) {
|
|
|
19119
19553
|
return;
|
|
19120
19554
|
}
|
|
19121
19555
|
const update = () => {
|
|
19122
|
-
const next = readRect2(ref);
|
|
19556
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19123
19557
|
setRect(
|
|
19124
19558
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19125
19559
|
);
|
|
@@ -19134,9 +19568,49 @@ function useLiveItemRect(ref) {
|
|
|
19134
19568
|
window.removeEventListener("resize", update);
|
|
19135
19569
|
clearInterval(interval);
|
|
19136
19570
|
};
|
|
19137
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19571
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19138
19572
|
return rect;
|
|
19139
19573
|
}
|
|
19574
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19575
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19576
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19577
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19578
|
+
const slotRef = useRef5(null);
|
|
19579
|
+
const [shift, setShift] = useState8(0);
|
|
19580
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19581
|
+
useLayoutEffect4(() => {
|
|
19582
|
+
const slot = slotRef.current;
|
|
19583
|
+
if (!slot) return;
|
|
19584
|
+
const clamp = () => {
|
|
19585
|
+
const w = slot.offsetWidth;
|
|
19586
|
+
if (w <= 0) return;
|
|
19587
|
+
const half = w / 2;
|
|
19588
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19589
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19590
|
+
};
|
|
19591
|
+
clamp();
|
|
19592
|
+
const ro = new ResizeObserver(clamp);
|
|
19593
|
+
ro.observe(slot);
|
|
19594
|
+
return () => ro.disconnect();
|
|
19595
|
+
}, [centerX, children]);
|
|
19596
|
+
const mobile = window.innerWidth <= 480;
|
|
19597
|
+
return /* @__PURE__ */ jsx21(
|
|
19598
|
+
"div",
|
|
19599
|
+
{
|
|
19600
|
+
ref: slotRef,
|
|
19601
|
+
"data-ohw-bridge": "",
|
|
19602
|
+
"data-ohw-item-interaction": "",
|
|
19603
|
+
className: "pointer-events-auto fixed",
|
|
19604
|
+
style: {
|
|
19605
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19606
|
+
left: centerX + shift,
|
|
19607
|
+
transform: "translate(-50%, -100%)",
|
|
19608
|
+
zIndex: 2147483645
|
|
19609
|
+
},
|
|
19610
|
+
children
|
|
19611
|
+
}
|
|
19612
|
+
);
|
|
19613
|
+
}
|
|
19140
19614
|
function requestValidateTree(postToParent2, tree) {
|
|
19141
19615
|
return new Promise((resolve) => {
|
|
19142
19616
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19173,116 +19647,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19173
19647
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19174
19648
|
});
|
|
19175
19649
|
}
|
|
19176
|
-
function
|
|
19650
|
+
function ToolbarAction({
|
|
19177
19651
|
label,
|
|
19178
19652
|
onClick,
|
|
19179
|
-
disabled,
|
|
19180
|
-
active
|
|
19653
|
+
disabled = false,
|
|
19654
|
+
active = false,
|
|
19655
|
+
children
|
|
19181
19656
|
}) {
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
{
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
disabled,
|
|
19188
|
-
style: {
|
|
19189
|
-
height: 28,
|
|
19190
|
-
padding: "0 10px",
|
|
19191
|
-
display: "inline-flex",
|
|
19192
|
-
alignItems: "center",
|
|
19193
|
-
gap: 4,
|
|
19194
|
-
borderRadius: 999,
|
|
19195
|
-
border: "none",
|
|
19196
|
-
cursor: disabled ? "default" : "pointer",
|
|
19197
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19198
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19199
|
-
opacity: disabled ? 0.4 : 1,
|
|
19200
|
-
fontSize: 12,
|
|
19201
|
-
lineHeight: "16px",
|
|
19202
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19203
|
-
whiteSpace: "nowrap",
|
|
19204
|
-
flex: "0 0 auto"
|
|
19205
|
-
},
|
|
19206
|
-
children: label
|
|
19207
|
-
}
|
|
19208
|
-
);
|
|
19657
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19658
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19659
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19660
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19661
|
+
] });
|
|
19209
19662
|
}
|
|
19210
|
-
function
|
|
19211
|
-
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
|
|
19234
|
-
|
|
19235
|
-
|
|
19236
|
-
|
|
19237
|
-
|
|
19238
|
-
|
|
19239
|
-
},
|
|
19240
|
-
children: "Alt"
|
|
19241
|
-
}
|
|
19242
|
-
),
|
|
19243
|
-
/* @__PURE__ */ jsx20(
|
|
19244
|
-
"input",
|
|
19663
|
+
function ToolbarSeparator() {
|
|
19664
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19665
|
+
}
|
|
19666
|
+
function OptionMenu({
|
|
19667
|
+
label,
|
|
19668
|
+
value,
|
|
19669
|
+
options,
|
|
19670
|
+
onChange
|
|
19671
|
+
}) {
|
|
19672
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19673
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19674
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19675
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19676
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19677
|
+
"button",
|
|
19678
|
+
{
|
|
19679
|
+
type: "button",
|
|
19680
|
+
"aria-label": label,
|
|
19681
|
+
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",
|
|
19682
|
+
children: [
|
|
19683
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19684
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19685
|
+
]
|
|
19686
|
+
}
|
|
19687
|
+
) }),
|
|
19688
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19689
|
+
const selected = option.value === value;
|
|
19690
|
+
return /* @__PURE__ */ jsxs12(
|
|
19691
|
+
DropdownMenuItem,
|
|
19245
19692
|
{
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
"aria-label": "Image alt text",
|
|
19261
|
-
style: {
|
|
19262
|
-
flex: 1,
|
|
19263
|
-
minWidth: 0,
|
|
19264
|
-
border: "none",
|
|
19265
|
-
outline: "none",
|
|
19266
|
-
background: "transparent",
|
|
19267
|
-
fontSize: 12,
|
|
19268
|
-
lineHeight: "16px",
|
|
19269
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19270
|
-
color: "#1f2937"
|
|
19271
|
-
}
|
|
19272
|
-
}
|
|
19273
|
-
)
|
|
19274
|
-
]
|
|
19275
|
-
}
|
|
19276
|
-
);
|
|
19693
|
+
role: "menuitemradio",
|
|
19694
|
+
"aria-checked": selected,
|
|
19695
|
+
onSelect: () => onChange(option.value),
|
|
19696
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19697
|
+
children: [
|
|
19698
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19699
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19700
|
+
]
|
|
19701
|
+
},
|
|
19702
|
+
option.value
|
|
19703
|
+
);
|
|
19704
|
+
}) })
|
|
19705
|
+
] })
|
|
19706
|
+
] });
|
|
19277
19707
|
}
|
|
19278
19708
|
var VARIANTS = [
|
|
19279
19709
|
{ value: "logos", label: "Logos" },
|
|
19280
19710
|
{ value: "reel", label: "Reel" }
|
|
19281
19711
|
];
|
|
19282
19712
|
var ALIGNS = [
|
|
19283
|
-
{ value: "left", label: "
|
|
19284
|
-
{ value: "center", label: "
|
|
19285
|
-
{ value: "right", label: "
|
|
19713
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19714
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19715
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19286
19716
|
];
|
|
19287
19717
|
var HOVERS = [
|
|
19288
19718
|
{ value: "none", label: "None" },
|
|
@@ -19290,104 +19720,104 @@ var HOVERS = [
|
|
|
19290
19720
|
{ value: "zoom", label: "Zoom" },
|
|
19291
19721
|
{ value: "fade", label: "Fade" }
|
|
19292
19722
|
];
|
|
19293
|
-
var TREATMENTS = [
|
|
19294
|
-
{ value: "color", label: "Color" },
|
|
19295
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19296
|
-
];
|
|
19297
19723
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19298
|
-
function
|
|
19299
|
-
|
|
19724
|
+
function LinkModal({
|
|
19725
|
+
href,
|
|
19726
|
+
linkTarget,
|
|
19727
|
+
onClose,
|
|
19728
|
+
onSave
|
|
19729
|
+
}) {
|
|
19730
|
+
const [draft, setDraft] = useState8(href);
|
|
19731
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19300
19732
|
const [invalid, setInvalid] = useState8(false);
|
|
19301
|
-
|
|
19302
|
-
setDraft(value);
|
|
19303
|
-
setInvalid(false);
|
|
19304
|
-
}, [value]);
|
|
19305
|
-
const commit2 = () => {
|
|
19733
|
+
const save = () => {
|
|
19306
19734
|
const next = draft.trim();
|
|
19307
|
-
if (next
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
onCommit(next);
|
|
19311
|
-
};
|
|
19312
|
-
return /* @__PURE__ */ jsxs11(
|
|
19313
|
-
"div",
|
|
19314
|
-
{
|
|
19315
|
-
style: {
|
|
19316
|
-
display: "flex",
|
|
19317
|
-
alignItems: "center",
|
|
19318
|
-
gap: 6,
|
|
19319
|
-
height: 28,
|
|
19320
|
-
padding: "0 12px",
|
|
19321
|
-
borderRadius: 999,
|
|
19322
|
-
background: "#ffffff",
|
|
19323
|
-
width: "100%",
|
|
19324
|
-
maxWidth: 260,
|
|
19325
|
-
boxSizing: "border-box",
|
|
19326
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19327
|
-
},
|
|
19328
|
-
children: [
|
|
19329
|
-
/* @__PURE__ */ jsx20(
|
|
19330
|
-
"span",
|
|
19331
|
-
{
|
|
19332
|
-
style: {
|
|
19333
|
-
flex: "0 0 auto",
|
|
19334
|
-
color: OHW_BLUE_DARK,
|
|
19335
|
-
fontSize: 10,
|
|
19336
|
-
fontWeight: 700,
|
|
19337
|
-
textTransform: "uppercase",
|
|
19338
|
-
letterSpacing: 0.4
|
|
19339
|
-
},
|
|
19340
|
-
children: "Link"
|
|
19341
|
-
}
|
|
19342
|
-
),
|
|
19343
|
-
/* @__PURE__ */ jsx20(
|
|
19344
|
-
"input",
|
|
19345
|
-
{
|
|
19346
|
-
type: "text",
|
|
19347
|
-
inputMode: "url",
|
|
19348
|
-
value: draft,
|
|
19349
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19350
|
-
onBlur: commit2,
|
|
19351
|
-
onKeyDown: (e) => {
|
|
19352
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19353
|
-
if (e.key === "Escape") {
|
|
19354
|
-
setDraft(value);
|
|
19355
|
-
setInvalid(false);
|
|
19356
|
-
e.currentTarget.blur();
|
|
19357
|
-
}
|
|
19358
|
-
},
|
|
19359
|
-
placeholder: "https://example.com",
|
|
19360
|
-
"aria-label": "Image link URL",
|
|
19361
|
-
"aria-invalid": invalid,
|
|
19362
|
-
style: {
|
|
19363
|
-
flex: 1,
|
|
19364
|
-
minWidth: 0,
|
|
19365
|
-
border: "none",
|
|
19366
|
-
outline: "none",
|
|
19367
|
-
background: "transparent",
|
|
19368
|
-
fontSize: 12,
|
|
19369
|
-
lineHeight: "16px",
|
|
19370
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19371
|
-
color: "#1f2937"
|
|
19372
|
-
}
|
|
19373
|
-
}
|
|
19374
|
-
)
|
|
19375
|
-
]
|
|
19735
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19736
|
+
setInvalid(true);
|
|
19737
|
+
return;
|
|
19376
19738
|
}
|
|
19377
|
-
|
|
19739
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19740
|
+
onClose();
|
|
19741
|
+
};
|
|
19742
|
+
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: [
|
|
19743
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19744
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
19745
|
+
/* @__PURE__ */ jsx21(
|
|
19746
|
+
"input",
|
|
19747
|
+
{
|
|
19748
|
+
autoFocus: true,
|
|
19749
|
+
type: "text",
|
|
19750
|
+
inputMode: "url",
|
|
19751
|
+
value: draft,
|
|
19752
|
+
onChange: (e) => {
|
|
19753
|
+
setDraft(e.target.value);
|
|
19754
|
+
setInvalid(false);
|
|
19755
|
+
},
|
|
19756
|
+
onKeyDown: (e) => {
|
|
19757
|
+
if (e.key === "Enter") save();
|
|
19758
|
+
},
|
|
19759
|
+
placeholder: "https://example.com",
|
|
19760
|
+
"aria-label": "Image link URL",
|
|
19761
|
+
"aria-invalid": invalid,
|
|
19762
|
+
className: cn(
|
|
19763
|
+
"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",
|
|
19764
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19765
|
+
)
|
|
19766
|
+
}
|
|
19767
|
+
),
|
|
19768
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19769
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19770
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19771
|
+
"Open in new tab"
|
|
19772
|
+
] })
|
|
19773
|
+
] }),
|
|
19774
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
19775
|
+
href && /* @__PURE__ */ jsx21(
|
|
19776
|
+
"button",
|
|
19777
|
+
{
|
|
19778
|
+
type: "button",
|
|
19779
|
+
onClick: () => {
|
|
19780
|
+
onSave("", "new-tab");
|
|
19781
|
+
onClose();
|
|
19782
|
+
},
|
|
19783
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19784
|
+
children: "Remove link"
|
|
19785
|
+
}
|
|
19786
|
+
),
|
|
19787
|
+
/* @__PURE__ */ jsx21(
|
|
19788
|
+
"button",
|
|
19789
|
+
{
|
|
19790
|
+
type: "button",
|
|
19791
|
+
onClick: onClose,
|
|
19792
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19793
|
+
children: "Cancel"
|
|
19794
|
+
}
|
|
19795
|
+
),
|
|
19796
|
+
/* @__PURE__ */ jsx21(
|
|
19797
|
+
"button",
|
|
19798
|
+
{
|
|
19799
|
+
type: "button",
|
|
19800
|
+
onClick: save,
|
|
19801
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19802
|
+
children: "Save"
|
|
19803
|
+
}
|
|
19804
|
+
)
|
|
19805
|
+
] })
|
|
19806
|
+
] }) });
|
|
19378
19807
|
}
|
|
19379
19808
|
function MediaStripToolbar({
|
|
19380
19809
|
entry,
|
|
19381
19810
|
index,
|
|
19382
19811
|
pending,
|
|
19383
19812
|
error,
|
|
19813
|
+
itemEditOn,
|
|
19814
|
+
onToggleItemEdit,
|
|
19384
19815
|
onSetVariant,
|
|
19385
19816
|
onSetAlign,
|
|
19386
19817
|
onSetHover,
|
|
19387
19818
|
onSetTreatment,
|
|
19388
19819
|
onResize,
|
|
19389
|
-
|
|
19390
|
-
onSetLink,
|
|
19820
|
+
onOpenLink,
|
|
19391
19821
|
onAddItem,
|
|
19392
19822
|
onRemoveItem,
|
|
19393
19823
|
onChangeImage,
|
|
@@ -19396,81 +19826,102 @@ function MediaStripToolbar({
|
|
|
19396
19826
|
}) {
|
|
19397
19827
|
const items = mediaStripItems(entry.tree);
|
|
19398
19828
|
const itemCount = items.length;
|
|
19399
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19400
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19401
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19402
19829
|
const slots = findMediaStripSlots(entry.tree);
|
|
19403
19830
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19404
19831
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19405
19832
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19406
19833
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19407
19834
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19408
|
-
const
|
|
19409
|
-
const
|
|
19410
|
-
|
|
19411
|
-
gap: 6,
|
|
19412
|
-
flexWrap: "nowrap",
|
|
19413
|
-
justifyContent: "center",
|
|
19414
|
-
overflowX: "auto",
|
|
19415
|
-
WebkitOverflowScrolling: "touch",
|
|
19416
|
-
width: "100%",
|
|
19417
|
-
scrollbarWidth: "none"
|
|
19418
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19419
|
-
return /* @__PURE__ */ jsxs11(
|
|
19835
|
+
const mobile = window.innerWidth <= 480;
|
|
19836
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19837
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19420
19838
|
"div",
|
|
19421
19839
|
{
|
|
19422
19840
|
"data-ohw-bridge": "",
|
|
19423
19841
|
"data-ohw-toolbar": "",
|
|
19424
19842
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19425
|
-
|
|
19426
|
-
|
|
19427
|
-
flexDirection: "column",
|
|
19428
|
-
gap: 6,
|
|
19429
|
-
alignItems: "center",
|
|
19430
|
-
background: OHW_BLUE,
|
|
19431
|
-
padding: 8,
|
|
19432
|
-
borderRadius: 12,
|
|
19433
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19434
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19435
|
-
opacity: pending ? 0.6 : 1,
|
|
19436
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19437
|
-
},
|
|
19843
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19844
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19438
19845
|
children: [
|
|
19439
|
-
/* @__PURE__ */
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19846
|
+
/* @__PURE__ */ jsxs12(
|
|
19847
|
+
"div",
|
|
19848
|
+
{
|
|
19849
|
+
className: cn(
|
|
19850
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19851
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19852
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19853
|
+
),
|
|
19854
|
+
children: [
|
|
19855
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19856
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
19857
|
+
CustomToolbarButton,
|
|
19858
|
+
{
|
|
19859
|
+
type: "button",
|
|
19860
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19861
|
+
"aria-pressed": itemEditOn,
|
|
19862
|
+
onClick: onToggleItemEdit,
|
|
19863
|
+
className: "group size-8",
|
|
19864
|
+
children: /* @__PURE__ */ jsx21(
|
|
19865
|
+
Star,
|
|
19866
|
+
{
|
|
19867
|
+
size: 16,
|
|
19868
|
+
fill: "currentColor",
|
|
19869
|
+
strokeWidth: 0,
|
|
19870
|
+
className: cn(
|
|
19871
|
+
"transition-colors",
|
|
19872
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19873
|
+
),
|
|
19874
|
+
style: { pointerEvents: "none" }
|
|
19875
|
+
}
|
|
19876
|
+
)
|
|
19877
|
+
}
|
|
19878
|
+
) }),
|
|
19879
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19880
|
+
] }),
|
|
19881
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19882
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19883
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19884
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19885
|
+
/* @__PURE__ */ jsx21(
|
|
19886
|
+
ToolbarAction,
|
|
19887
|
+
{
|
|
19888
|
+
label: gatedLabel("Move right"),
|
|
19889
|
+
onClick: onMoveRight,
|
|
19890
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19891
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
19892
|
+
}
|
|
19893
|
+
),
|
|
19894
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19895
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19896
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19897
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19898
|
+
/* @__PURE__ */ jsx21(
|
|
19899
|
+
ToolbarAction,
|
|
19900
|
+
{
|
|
19901
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19902
|
+
active: treatment === "grayscale",
|
|
19903
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19904
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19905
|
+
}
|
|
19906
|
+
),
|
|
19907
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19908
|
+
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)),
|
|
19909
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19910
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19911
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19912
|
+
sizeValue,
|
|
19913
|
+
"px"
|
|
19914
|
+
] }),
|
|
19915
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19916
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19917
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19918
|
+
]
|
|
19919
|
+
}
|
|
19920
|
+
),
|
|
19921
|
+
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 })
|
|
19471
19922
|
]
|
|
19472
19923
|
}
|
|
19473
|
-
);
|
|
19924
|
+
) });
|
|
19474
19925
|
}
|
|
19475
19926
|
function findMediaStripSlots(tree) {
|
|
19476
19927
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19489,31 +19940,23 @@ function AiMediaStripOverlay({
|
|
|
19489
19940
|
}) {
|
|
19490
19941
|
const [hover, setHover] = useState8(null);
|
|
19491
19942
|
const [active, setActive] = useState8(null);
|
|
19943
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
19944
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19492
19945
|
const [pending, setPending] = useState8(false);
|
|
19493
19946
|
const [error, setError] = useState8(null);
|
|
19494
19947
|
const activeRef = useRef5(null);
|
|
19495
19948
|
activeRef.current = active;
|
|
19949
|
+
const linkOpenRef = useRef5(false);
|
|
19950
|
+
linkOpenRef.current = linkOpen;
|
|
19496
19951
|
useEffect9(() => {
|
|
19497
19952
|
const onMove = (e) => {
|
|
19953
|
+
const ref = itemRefFromTarget(e.target);
|
|
19498
19954
|
const t = e.target;
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
if (!itemEl) {
|
|
19505
|
-
setHover(null);
|
|
19506
|
-
return;
|
|
19507
|
-
}
|
|
19508
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19509
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19510
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19511
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19512
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19513
|
-
setHover(null);
|
|
19514
|
-
return;
|
|
19515
|
-
}
|
|
19516
|
-
setHover({ sectionId, index });
|
|
19955
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19956
|
+
setHover((prev) => {
|
|
19957
|
+
const next = ref && !overEditable ? ref : null;
|
|
19958
|
+
return sameRef(prev, next) ? prev : next;
|
|
19959
|
+
});
|
|
19517
19960
|
};
|
|
19518
19961
|
const onLeave = () => setHover(null);
|
|
19519
19962
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19525,23 +19968,25 @@ function AiMediaStripOverlay({
|
|
|
19525
19968
|
}, []);
|
|
19526
19969
|
useEffect9(() => {
|
|
19527
19970
|
const onClick = (e) => {
|
|
19528
|
-
const current = activeRef.current;
|
|
19529
|
-
if (!current) return;
|
|
19530
19971
|
const t = e.target;
|
|
19531
|
-
if (!(t instanceof
|
|
19532
|
-
if (t.closest(
|
|
19533
|
-
const
|
|
19534
|
-
if (
|
|
19535
|
-
|
|
19972
|
+
if (!(t instanceof Element)) return;
|
|
19973
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19974
|
+
const ref = itemRefFromTarget(t);
|
|
19975
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19976
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19977
|
+
setItemEditOn(false);
|
|
19536
19978
|
setError(null);
|
|
19979
|
+
setActive(ref);
|
|
19537
19980
|
};
|
|
19538
19981
|
document.addEventListener("click", onClick, true);
|
|
19539
19982
|
return () => document.removeEventListener("click", onClick, true);
|
|
19540
|
-
}, []);
|
|
19983
|
+
}, [clearInteractionChromeRef]);
|
|
19541
19984
|
useEffect9(() => {
|
|
19542
19985
|
const onBlur = () => {
|
|
19543
19986
|
if (!activeRef.current) return;
|
|
19544
19987
|
setActive(null);
|
|
19988
|
+
setItemEditOn(false);
|
|
19989
|
+
setLinkOpen(false);
|
|
19545
19990
|
setError(null);
|
|
19546
19991
|
};
|
|
19547
19992
|
window.addEventListener("blur", onBlur);
|
|
@@ -19551,7 +19996,10 @@ function AiMediaStripOverlay({
|
|
|
19551
19996
|
const onKeyDown = (e) => {
|
|
19552
19997
|
if (e.key !== "Escape") return;
|
|
19553
19998
|
if (!activeRef.current) return;
|
|
19999
|
+
if (linkOpenRef.current) return;
|
|
20000
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19554
20001
|
setActive(null);
|
|
20002
|
+
setItemEditOn(false);
|
|
19555
20003
|
setError(null);
|
|
19556
20004
|
};
|
|
19557
20005
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19585,137 +20033,133 @@ function AiMediaStripOverlay({
|
|
|
19585
20033
|
tree: nextTree,
|
|
19586
20034
|
label: entry.label,
|
|
19587
20035
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19588
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20036
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
20037
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20038
|
+
// on every edit reads as the section jumping around.
|
|
20039
|
+
skipScrollIntoView: true
|
|
19589
20040
|
});
|
|
19590
20041
|
return true;
|
|
19591
20042
|
},
|
|
19592
20043
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19593
20044
|
);
|
|
19594
20045
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19595
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19596
20046
|
const activeItemRect = useLiveItemRect(active);
|
|
19597
|
-
const
|
|
19598
|
-
const
|
|
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
|
-
|
|
19625
|
-
|
|
19626
|
-
|
|
19627
|
-
|
|
19628
|
-
|
|
19629
|
-
|
|
19630
|
-
|
|
19631
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19632
|
-
ItemInteractionLayer,
|
|
19633
|
-
{
|
|
19634
|
-
rect: activeItemRect,
|
|
19635
|
-
state: toolbarState,
|
|
19636
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19637
|
-
MediaStripToolbar,
|
|
19638
|
-
{
|
|
19639
|
-
entry: activeEntry,
|
|
19640
|
-
index: active.index,
|
|
19641
|
-
pending,
|
|
19642
|
-
error,
|
|
19643
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19644
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19645
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19646
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19647
|
-
onResize: (delta) => {
|
|
19648
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19649
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19650
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19651
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19652
|
-
},
|
|
19653
|
-
onSetAlt: (alt) => {
|
|
19654
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19655
|
-
},
|
|
19656
|
-
onSetLink: (href, linkTarget) => {
|
|
20047
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
20048
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20049
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
20050
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
20051
|
+
const activeHref = activeItem?.href ?? "";
|
|
20052
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
20053
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
20054
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20055
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
20056
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
20057
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
20058
|
+
MediaStripToolbar,
|
|
20059
|
+
{
|
|
20060
|
+
entry: activeEntry,
|
|
20061
|
+
index: active.index,
|
|
20062
|
+
pending,
|
|
20063
|
+
error,
|
|
20064
|
+
itemEditOn,
|
|
20065
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
20066
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
20067
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
20068
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
20069
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
20070
|
+
onResize: (delta) => {
|
|
20071
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
20072
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
20073
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
20074
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
20075
|
+
},
|
|
20076
|
+
onOpenLink: () => setLinkOpen(true),
|
|
20077
|
+
onAddItem: () => {
|
|
20078
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20079
|
+
if (!picked) return;
|
|
20080
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19657
20081
|
void runMutation(
|
|
19658
20082
|
active.sectionId,
|
|
19659
|
-
(tree) =>
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19664
|
-
if (!picked) return;
|
|
19665
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19666
|
-
void runMutation(
|
|
19667
|
-
active.sectionId,
|
|
19668
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19669
|
-
{ [picked.assetId]: picked.url }
|
|
19670
|
-
).then((applied) => {
|
|
19671
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19672
|
-
});
|
|
19673
|
-
});
|
|
19674
|
-
},
|
|
19675
|
-
onChangeImage: () => {
|
|
19676
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19677
|
-
if (!picked) return;
|
|
19678
|
-
void runMutation(
|
|
19679
|
-
active.sectionId,
|
|
19680
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19681
|
-
{ [picked.assetId]: picked.url }
|
|
19682
|
-
);
|
|
20083
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
20084
|
+
{ [picked.assetId]: picked.url }
|
|
20085
|
+
).then((applied) => {
|
|
20086
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19683
20087
|
});
|
|
19684
|
-
}
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
|
|
19688
|
-
|
|
19689
|
-
|
|
19690
|
-
|
|
19691
|
-
|
|
19692
|
-
|
|
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
|
-
}
|
|
19697
|
-
);
|
|
19698
|
-
},
|
|
19699
|
-
onMoveRight: () => {
|
|
19700
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19701
|
-
(applied) => {
|
|
19702
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19703
|
-
}
|
|
20088
|
+
});
|
|
20089
|
+
},
|
|
20090
|
+
onChangeImage: () => {
|
|
20091
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20092
|
+
if (!picked) return;
|
|
20093
|
+
void runMutation(
|
|
20094
|
+
active.sectionId,
|
|
20095
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
20096
|
+
{ [picked.assetId]: picked.url }
|
|
19704
20097
|
);
|
|
19705
|
-
}
|
|
20098
|
+
});
|
|
20099
|
+
},
|
|
20100
|
+
onRemoveItem: () => {
|
|
20101
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
20102
|
+
(applied) => {
|
|
20103
|
+
if (applied) setActive(null);
|
|
20104
|
+
}
|
|
20105
|
+
);
|
|
20106
|
+
},
|
|
20107
|
+
onMoveLeft: () => {
|
|
20108
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
20109
|
+
(applied) => {
|
|
20110
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
20111
|
+
}
|
|
20112
|
+
);
|
|
20113
|
+
},
|
|
20114
|
+
onMoveRight: () => {
|
|
20115
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20116
|
+
(applied) => {
|
|
20117
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20118
|
+
}
|
|
20119
|
+
);
|
|
19706
20120
|
}
|
|
19707
|
-
|
|
19708
|
-
}
|
|
19709
|
-
|
|
20121
|
+
}
|
|
20122
|
+
) }),
|
|
20123
|
+
/* @__PURE__ */ jsx21(
|
|
20124
|
+
"div",
|
|
20125
|
+
{
|
|
20126
|
+
"data-ohw-bridge": "",
|
|
20127
|
+
"data-ohw-item-interaction": "",
|
|
20128
|
+
"aria-hidden": true,
|
|
20129
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20130
|
+
style: {
|
|
20131
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20132
|
+
left: activeItemRect.left - 5,
|
|
20133
|
+
background: PRIMARY3,
|
|
20134
|
+
zIndex: 2147483644
|
|
20135
|
+
},
|
|
20136
|
+
children: "Media item"
|
|
20137
|
+
}
|
|
20138
|
+
),
|
|
20139
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
20140
|
+
LinkModal,
|
|
20141
|
+
{
|
|
20142
|
+
href: activeHref,
|
|
20143
|
+
linkTarget: activeTarget,
|
|
20144
|
+
onClose: () => setLinkOpen(false),
|
|
20145
|
+
onSave: (href, linkTarget) => {
|
|
20146
|
+
void runMutation(
|
|
20147
|
+
active.sectionId,
|
|
20148
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20149
|
+
);
|
|
20150
|
+
}
|
|
20151
|
+
}
|
|
20152
|
+
)
|
|
20153
|
+
] })
|
|
19710
20154
|
] });
|
|
19711
20155
|
}
|
|
19712
20156
|
|
|
19713
20157
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19714
|
-
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as
|
|
19715
|
-
import { Check as
|
|
19716
|
-
import { Fragment as Fragment8, jsx as
|
|
20158
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
20159
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
20160
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19717
20161
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19718
|
-
var
|
|
20162
|
+
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]";
|
|
19719
20163
|
function findPricingCardElement(sectionId, index) {
|
|
19720
20164
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19721
20165
|
if (!sectionEl2) return null;
|
|
@@ -19727,7 +20171,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19727
20171
|
}
|
|
19728
20172
|
function cardRefFromTarget(target) {
|
|
19729
20173
|
if (!(target instanceof Element)) return null;
|
|
19730
|
-
if (target.closest(
|
|
20174
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19731
20175
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19732
20176
|
if (!cardEl) return null;
|
|
19733
20177
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -19737,21 +20181,21 @@ function cardRefFromTarget(target) {
|
|
|
19737
20181
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19738
20182
|
return { sectionId, index };
|
|
19739
20183
|
}
|
|
19740
|
-
function
|
|
20184
|
+
function sameRef2(a, b) {
|
|
19741
20185
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19742
20186
|
}
|
|
19743
|
-
function
|
|
20187
|
+
function rectOf2(el) {
|
|
19744
20188
|
if (!el) return null;
|
|
19745
20189
|
const r2 = el.getBoundingClientRect();
|
|
19746
20190
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19747
20191
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19748
20192
|
}
|
|
19749
20193
|
function readRect3(ref) {
|
|
19750
|
-
return
|
|
20194
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19751
20195
|
}
|
|
19752
20196
|
function readGridRect(ref) {
|
|
19753
20197
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19754
|
-
return
|
|
20198
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19755
20199
|
}
|
|
19756
20200
|
function useLiveCardRect(ref, grid = false) {
|
|
19757
20201
|
const [rect, setRect] = useState9(null);
|
|
@@ -19781,19 +20225,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19781
20225
|
}
|
|
19782
20226
|
var TOOLBAR_GRID_GAP = 52;
|
|
19783
20227
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19784
|
-
var
|
|
20228
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19785
20229
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19786
20230
|
const slotRef = useRef6(null);
|
|
19787
20231
|
const [shift, setShift] = useState9(0);
|
|
19788
20232
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19789
|
-
|
|
20233
|
+
useLayoutEffect5(() => {
|
|
19790
20234
|
const slot = slotRef.current;
|
|
19791
20235
|
if (!slot) return;
|
|
19792
20236
|
const clamp = () => {
|
|
19793
20237
|
const w = slot.offsetWidth;
|
|
19794
20238
|
if (w <= 0) return;
|
|
19795
20239
|
const half = w / 2;
|
|
19796
|
-
const clamped = Math.max(
|
|
20240
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19797
20241
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19798
20242
|
};
|
|
19799
20243
|
clamp();
|
|
@@ -19802,7 +20246,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19802
20246
|
return () => ro.disconnect();
|
|
19803
20247
|
}, [centerX, children]);
|
|
19804
20248
|
const mobile = window.innerWidth <= 480;
|
|
19805
|
-
return /* @__PURE__ */
|
|
20249
|
+
return /* @__PURE__ */ jsx22(
|
|
19806
20250
|
"div",
|
|
19807
20251
|
{
|
|
19808
20252
|
ref: slotRef,
|
|
@@ -19837,7 +20281,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19837
20281
|
});
|
|
19838
20282
|
}
|
|
19839
20283
|
function StyleSwatch({ style }) {
|
|
19840
|
-
return /* @__PURE__ */
|
|
20284
|
+
return /* @__PURE__ */ jsx22(
|
|
19841
20285
|
"span",
|
|
19842
20286
|
{
|
|
19843
20287
|
"aria-hidden": true,
|
|
@@ -19851,35 +20295,35 @@ function StyleSwatch({ style }) {
|
|
|
19851
20295
|
);
|
|
19852
20296
|
}
|
|
19853
20297
|
function ButtonGlyph() {
|
|
19854
|
-
return /* @__PURE__ */
|
|
19855
|
-
/* @__PURE__ */
|
|
19856
|
-
/* @__PURE__ */
|
|
20298
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20299
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20300
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19857
20301
|
] });
|
|
19858
20302
|
}
|
|
19859
20303
|
function FeatureGlyph({ mode }) {
|
|
19860
|
-
return /* @__PURE__ */
|
|
19861
|
-
/* @__PURE__ */
|
|
19862
|
-
/* @__PURE__ */
|
|
19863
|
-
/* @__PURE__ */
|
|
19864
|
-
/* @__PURE__ */
|
|
19865
|
-
/* @__PURE__ */
|
|
19866
|
-
mode === "add" && /* @__PURE__ */
|
|
20304
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20305
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20306
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20307
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20308
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20309
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20310
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19867
20311
|
] });
|
|
19868
20312
|
}
|
|
19869
|
-
function
|
|
20313
|
+
function ToolbarAction2({
|
|
19870
20314
|
label,
|
|
19871
20315
|
onClick,
|
|
19872
20316
|
disabled = false,
|
|
19873
20317
|
children
|
|
19874
20318
|
}) {
|
|
19875
|
-
const button = /* @__PURE__ */
|
|
19876
|
-
return /* @__PURE__ */
|
|
19877
|
-
/* @__PURE__ */
|
|
19878
|
-
/* @__PURE__ */
|
|
20319
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20320
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20321
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20322
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19879
20323
|
] });
|
|
19880
20324
|
}
|
|
19881
|
-
function
|
|
19882
|
-
return /* @__PURE__ */
|
|
20325
|
+
function ToolbarSeparator2() {
|
|
20326
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19883
20327
|
}
|
|
19884
20328
|
function CardStyleMenu({
|
|
19885
20329
|
value,
|
|
@@ -19887,7 +20331,7 @@ function CardStyleMenu({
|
|
|
19887
20331
|
disabled = false
|
|
19888
20332
|
}) {
|
|
19889
20333
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19890
|
-
const trigger = /* @__PURE__ */
|
|
20334
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
19891
20335
|
"button",
|
|
19892
20336
|
{
|
|
19893
20337
|
type: "button",
|
|
@@ -19898,28 +20342,28 @@ function CardStyleMenu({
|
|
|
19898
20342
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19899
20343
|
),
|
|
19900
20344
|
children: [
|
|
19901
|
-
/* @__PURE__ */
|
|
19902
|
-
/* @__PURE__ */
|
|
19903
|
-
/* @__PURE__ */
|
|
20345
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20346
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20347
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
19904
20348
|
]
|
|
19905
20349
|
}
|
|
19906
20350
|
);
|
|
19907
20351
|
if (disabled) {
|
|
19908
|
-
return /* @__PURE__ */
|
|
19909
|
-
/* @__PURE__ */
|
|
19910
|
-
/* @__PURE__ */
|
|
19911
|
-
/* @__PURE__ */
|
|
19912
|
-
/* @__PURE__ */
|
|
20352
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20353
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20354
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20355
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20356
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19913
20357
|
] })
|
|
19914
20358
|
] });
|
|
19915
20359
|
}
|
|
19916
|
-
return /* @__PURE__ */
|
|
19917
|
-
/* @__PURE__ */
|
|
19918
|
-
/* @__PURE__ */
|
|
19919
|
-
/* @__PURE__ */
|
|
19920
|
-
/* @__PURE__ */
|
|
20360
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20361
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20362
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20363
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20364
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19921
20365
|
const selected = style.value === value;
|
|
19922
|
-
return /* @__PURE__ */
|
|
20366
|
+
return /* @__PURE__ */ jsxs13(
|
|
19923
20367
|
DropdownMenuItem,
|
|
19924
20368
|
{
|
|
19925
20369
|
role: "menuitemradio",
|
|
@@ -19927,9 +20371,9 @@ function CardStyleMenu({
|
|
|
19927
20371
|
onSelect: () => onChange(style.value),
|
|
19928
20372
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19929
20373
|
children: [
|
|
19930
|
-
/* @__PURE__ */
|
|
19931
|
-
/* @__PURE__ */
|
|
19932
|
-
selected && /* @__PURE__ */
|
|
20374
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20375
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20376
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
19933
20377
|
]
|
|
19934
20378
|
},
|
|
19935
20379
|
style.value
|
|
@@ -19959,7 +20403,7 @@ function PricingCardToolbar({
|
|
|
19959
20403
|
const style = pricingCardStyle(entry.tree, index);
|
|
19960
20404
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19961
20405
|
const mobile = window.innerWidth <= 480;
|
|
19962
|
-
return /* @__PURE__ */
|
|
20406
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
19963
20407
|
"div",
|
|
19964
20408
|
{
|
|
19965
20409
|
"data-ohw-bridge": "",
|
|
@@ -19971,7 +20415,7 @@ function PricingCardToolbar({
|
|
|
19971
20415
|
),
|
|
19972
20416
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19973
20417
|
children: [
|
|
19974
|
-
/* @__PURE__ */
|
|
20418
|
+
/* @__PURE__ */ jsxs13(
|
|
19975
20419
|
"div",
|
|
19976
20420
|
{
|
|
19977
20421
|
className: cn(
|
|
@@ -19980,8 +20424,8 @@ function PricingCardToolbar({
|
|
|
19980
20424
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19981
20425
|
),
|
|
19982
20426
|
children: [
|
|
19983
|
-
/* @__PURE__ */
|
|
19984
|
-
/* @__PURE__ */
|
|
20427
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20428
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
19985
20429
|
CustomToolbarButton,
|
|
19986
20430
|
{
|
|
19987
20431
|
type: "button",
|
|
@@ -19989,7 +20433,7 @@ function PricingCardToolbar({
|
|
|
19989
20433
|
"aria-pressed": featuredTag,
|
|
19990
20434
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19991
20435
|
className: "group size-8",
|
|
19992
|
-
children: /* @__PURE__ */
|
|
20436
|
+
children: /* @__PURE__ */ jsx22(
|
|
19993
20437
|
Star2,
|
|
19994
20438
|
{
|
|
19995
20439
|
size: 16,
|
|
@@ -20004,25 +20448,25 @@ function PricingCardToolbar({
|
|
|
20004
20448
|
)
|
|
20005
20449
|
}
|
|
20006
20450
|
) }),
|
|
20007
|
-
/* @__PURE__ */
|
|
20451
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20008
20452
|
] }),
|
|
20009
|
-
/* @__PURE__ */
|
|
20010
|
-
/* @__PURE__ */
|
|
20011
|
-
/* @__PURE__ */
|
|
20012
|
-
/* @__PURE__ */
|
|
20013
|
-
/* @__PURE__ */
|
|
20014
|
-
/* @__PURE__ */
|
|
20015
|
-
/* @__PURE__ */
|
|
20453
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20454
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20455
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20456
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20457
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20458
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20459
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
20016
20460
|
] }) }),
|
|
20017
|
-
/* @__PURE__ */
|
|
20018
|
-
/* @__PURE__ */
|
|
20019
|
-
/* @__PURE__ */
|
|
20020
|
-
/* @__PURE__ */
|
|
20021
|
-
/* @__PURE__ */
|
|
20461
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20462
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20463
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20464
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20465
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20022
20466
|
]
|
|
20023
20467
|
}
|
|
20024
20468
|
),
|
|
20025
|
-
error && /* @__PURE__ */
|
|
20469
|
+
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 })
|
|
20026
20470
|
]
|
|
20027
20471
|
}
|
|
20028
20472
|
) });
|
|
@@ -20056,7 +20500,7 @@ function AiPricingCardOverlay({
|
|
|
20056
20500
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20057
20501
|
setHover((prev) => {
|
|
20058
20502
|
const next = ref && !overEditable ? ref : null;
|
|
20059
|
-
return
|
|
20503
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20060
20504
|
});
|
|
20061
20505
|
};
|
|
20062
20506
|
const onLeave = () => setHover(null);
|
|
@@ -20071,10 +20515,10 @@ function AiPricingCardOverlay({
|
|
|
20071
20515
|
const onClick = (e) => {
|
|
20072
20516
|
const t = e.target;
|
|
20073
20517
|
if (!(t instanceof Element)) return;
|
|
20074
|
-
if (t.closest(
|
|
20518
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20075
20519
|
const ref = cardRefFromTarget(t);
|
|
20076
|
-
setActive((prev) =>
|
|
20077
|
-
if (!ref || !
|
|
20520
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20521
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20078
20522
|
};
|
|
20079
20523
|
document.addEventListener("click", onClick, true);
|
|
20080
20524
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20139,12 +20583,12 @@ function AiPricingCardOverlay({
|
|
|
20139
20583
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20140
20584
|
const activeCardRect = useLiveCardRect(active);
|
|
20141
20585
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20142
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20143
|
-
return /* @__PURE__ */
|
|
20144
|
-
hoverRect && /* @__PURE__ */
|
|
20145
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
20146
|
-
/* @__PURE__ */
|
|
20147
|
-
/* @__PURE__ */
|
|
20586
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20587
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20588
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20589
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20590
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20591
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
20148
20592
|
PricingCardToolbar,
|
|
20149
20593
|
{
|
|
20150
20594
|
entry: activeEntry,
|
|
@@ -20172,7 +20616,7 @@ function AiPricingCardOverlay({
|
|
|
20172
20616
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20173
20617
|
}
|
|
20174
20618
|
) }),
|
|
20175
|
-
/* @__PURE__ */
|
|
20619
|
+
/* @__PURE__ */ jsx22(
|
|
20176
20620
|
"div",
|
|
20177
20621
|
{
|
|
20178
20622
|
"data-ohw-bridge": "",
|
|
@@ -20236,39 +20680,11 @@ function clearVideo(tree, path) {
|
|
|
20236
20680
|
});
|
|
20237
20681
|
}
|
|
20238
20682
|
|
|
20239
|
-
// src/lib/youtube.ts
|
|
20240
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20241
|
-
function extractYouTubeId(input) {
|
|
20242
|
-
const trimmed = input.trim();
|
|
20243
|
-
if (!trimmed) return null;
|
|
20244
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20245
|
-
let url;
|
|
20246
|
-
try {
|
|
20247
|
-
url = new URL(trimmed);
|
|
20248
|
-
} catch {
|
|
20249
|
-
return null;
|
|
20250
|
-
}
|
|
20251
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20252
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20253
|
-
return null;
|
|
20254
|
-
}
|
|
20255
|
-
let candidate = null;
|
|
20256
|
-
if (host === "youtu.be") {
|
|
20257
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20258
|
-
} else if (url.pathname === "/watch") {
|
|
20259
|
-
candidate = url.searchParams.get("v");
|
|
20260
|
-
} else {
|
|
20261
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20262
|
-
candidate = match ? match[1] : null;
|
|
20263
|
-
}
|
|
20264
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20265
|
-
}
|
|
20266
|
-
|
|
20267
20683
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20268
|
-
import { Fragment as Fragment9, jsx as
|
|
20684
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20269
20685
|
var PRIMARY5 = "#0885FE";
|
|
20270
|
-
var
|
|
20271
|
-
var
|
|
20686
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20687
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20272
20688
|
function findVideoBlockElement(sectionId, path) {
|
|
20273
20689
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20274
20690
|
if (!sectionEl2) return null;
|
|
@@ -20328,12 +20744,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20328
20744
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20329
20745
|
});
|
|
20330
20746
|
}
|
|
20331
|
-
function
|
|
20747
|
+
function Pill({
|
|
20332
20748
|
label,
|
|
20333
20749
|
onClick,
|
|
20334
20750
|
disabled
|
|
20335
20751
|
}) {
|
|
20336
|
-
return /* @__PURE__ */
|
|
20752
|
+
return /* @__PURE__ */ jsx23(
|
|
20337
20753
|
"button",
|
|
20338
20754
|
{
|
|
20339
20755
|
type: "button",
|
|
@@ -20349,7 +20765,7 @@ function Pill2({
|
|
|
20349
20765
|
border: "none",
|
|
20350
20766
|
cursor: disabled ? "default" : "pointer",
|
|
20351
20767
|
background: "#ffffff",
|
|
20352
|
-
color:
|
|
20768
|
+
color: OHW_BLUE_DARK,
|
|
20353
20769
|
opacity: disabled ? 0.4 : 1,
|
|
20354
20770
|
fontSize: 12,
|
|
20355
20771
|
lineHeight: "16px",
|
|
@@ -20392,8 +20808,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20392
20808
|
onCommit(id);
|
|
20393
20809
|
}
|
|
20394
20810
|
};
|
|
20395
|
-
return /* @__PURE__ */
|
|
20396
|
-
/* @__PURE__ */
|
|
20811
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20812
|
+
/* @__PURE__ */ jsxs14(
|
|
20397
20813
|
"div",
|
|
20398
20814
|
{
|
|
20399
20815
|
style: {
|
|
@@ -20409,12 +20825,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20409
20825
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20410
20826
|
},
|
|
20411
20827
|
children: [
|
|
20412
|
-
/* @__PURE__ */
|
|
20828
|
+
/* @__PURE__ */ jsx23(
|
|
20413
20829
|
"span",
|
|
20414
20830
|
{
|
|
20415
20831
|
style: {
|
|
20416
20832
|
flex: "0 0 auto",
|
|
20417
|
-
color:
|
|
20833
|
+
color: OHW_BLUE_DARK,
|
|
20418
20834
|
fontSize: 10,
|
|
20419
20835
|
lineHeight: "16px",
|
|
20420
20836
|
fontWeight: 700,
|
|
@@ -20424,7 +20840,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20424
20840
|
children: "Video"
|
|
20425
20841
|
}
|
|
20426
20842
|
),
|
|
20427
|
-
/* @__PURE__ */
|
|
20843
|
+
/* @__PURE__ */ jsx23(
|
|
20428
20844
|
"input",
|
|
20429
20845
|
{
|
|
20430
20846
|
type: "text",
|
|
@@ -20461,7 +20877,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20461
20877
|
]
|
|
20462
20878
|
}
|
|
20463
20879
|
),
|
|
20464
|
-
invalid && /* @__PURE__ */
|
|
20880
|
+
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." })
|
|
20465
20881
|
] });
|
|
20466
20882
|
}
|
|
20467
20883
|
function VideoToolbar({
|
|
@@ -20471,7 +20887,7 @@ function VideoToolbar({
|
|
|
20471
20887
|
onSetVideoId,
|
|
20472
20888
|
onRemove
|
|
20473
20889
|
}) {
|
|
20474
|
-
return /* @__PURE__ */
|
|
20890
|
+
return /* @__PURE__ */ jsxs14(
|
|
20475
20891
|
"div",
|
|
20476
20892
|
{
|
|
20477
20893
|
"data-ohw-bridge": "",
|
|
@@ -20483,7 +20899,7 @@ function VideoToolbar({
|
|
|
20483
20899
|
gap: 6,
|
|
20484
20900
|
alignItems: "center",
|
|
20485
20901
|
width: 280,
|
|
20486
|
-
background:
|
|
20902
|
+
background: OHW_BLUE,
|
|
20487
20903
|
padding: 8,
|
|
20488
20904
|
borderRadius: 12,
|
|
20489
20905
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20491,9 +20907,9 @@ function VideoToolbar({
|
|
|
20491
20907
|
opacity: pending ? 0.6 : 1
|
|
20492
20908
|
},
|
|
20493
20909
|
children: [
|
|
20494
|
-
/* @__PURE__ */
|
|
20495
|
-
/* @__PURE__ */
|
|
20496
|
-
error && /* @__PURE__ */
|
|
20910
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20911
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20912
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20497
20913
|
]
|
|
20498
20914
|
}
|
|
20499
20915
|
);
|
|
@@ -20613,8 +21029,8 @@ function AiVideoOverlay({
|
|
|
20613
21029
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20614
21030
|
const TOOLBAR_APPROX_H = 90;
|
|
20615
21031
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20616
|
-
return /* @__PURE__ */
|
|
20617
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21032
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
21033
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20618
21034
|
"button",
|
|
20619
21035
|
{
|
|
20620
21036
|
type: "button",
|
|
@@ -20642,15 +21058,15 @@ function AiVideoOverlay({
|
|
|
20642
21058
|
fontSize: 14,
|
|
20643
21059
|
fontWeight: 700
|
|
20644
21060
|
},
|
|
20645
|
-
children: /* @__PURE__ */
|
|
21061
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20646
21062
|
}
|
|
20647
21063
|
),
|
|
20648
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
21064
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20649
21065
|
ItemInteractionLayer,
|
|
20650
21066
|
{
|
|
20651
21067
|
rect: activeBlockRect,
|
|
20652
21068
|
state: toolbarState,
|
|
20653
|
-
toolbar: /* @__PURE__ */
|
|
21069
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20654
21070
|
VideoToolbar,
|
|
20655
21071
|
{
|
|
20656
21072
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20725,10 +21141,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20725
21141
|
}
|
|
20726
21142
|
|
|
20727
21143
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20728
|
-
import { Fragment as Fragment10, jsx as
|
|
21144
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20729
21145
|
var PRIMARY6 = "#0885FE";
|
|
20730
|
-
var
|
|
20731
|
-
var
|
|
21146
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21147
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20732
21148
|
function findCarouselItemElement(sectionId, index) {
|
|
20733
21149
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20734
21150
|
if (!sectionEl2) return null;
|
|
@@ -20807,8 +21223,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20807
21223
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20808
21224
|
});
|
|
20809
21225
|
}
|
|
20810
|
-
function
|
|
20811
|
-
return /* @__PURE__ */
|
|
21226
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21227
|
+
return /* @__PURE__ */ jsx24(
|
|
20812
21228
|
"button",
|
|
20813
21229
|
{
|
|
20814
21230
|
type: "button",
|
|
@@ -20824,7 +21240,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20824
21240
|
border: "none",
|
|
20825
21241
|
cursor: disabled ? "default" : "pointer",
|
|
20826
21242
|
background: "#ffffff",
|
|
20827
|
-
color:
|
|
21243
|
+
color: OHW_BLUE_DARK2,
|
|
20828
21244
|
opacity: disabled ? 0.4 : 1,
|
|
20829
21245
|
fontSize: 12,
|
|
20830
21246
|
lineHeight: "16px",
|
|
@@ -20842,7 +21258,7 @@ function TogglePill({
|
|
|
20842
21258
|
onToggle,
|
|
20843
21259
|
disabled
|
|
20844
21260
|
}) {
|
|
20845
|
-
return /* @__PURE__ */
|
|
21261
|
+
return /* @__PURE__ */ jsxs15(
|
|
20846
21262
|
"button",
|
|
20847
21263
|
{
|
|
20848
21264
|
type: "button",
|
|
@@ -20861,7 +21277,7 @@ function TogglePill({
|
|
|
20861
21277
|
border: "none",
|
|
20862
21278
|
cursor: disabled ? "default" : "pointer",
|
|
20863
21279
|
background: "#ffffff",
|
|
20864
|
-
color:
|
|
21280
|
+
color: OHW_BLUE_DARK2,
|
|
20865
21281
|
opacity: disabled ? 0.4 : 1,
|
|
20866
21282
|
fontSize: 12,
|
|
20867
21283
|
lineHeight: "16px",
|
|
@@ -20871,7 +21287,7 @@ function TogglePill({
|
|
|
20871
21287
|
},
|
|
20872
21288
|
children: [
|
|
20873
21289
|
label,
|
|
20874
|
-
/* @__PURE__ */
|
|
21290
|
+
/* @__PURE__ */ jsx24(
|
|
20875
21291
|
"span",
|
|
20876
21292
|
{
|
|
20877
21293
|
"aria-hidden": true,
|
|
@@ -20884,10 +21300,10 @@ function TogglePill({
|
|
|
20884
21300
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20885
21301
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20886
21302
|
// "disabled control" rather than "switch that is off".
|
|
20887
|
-
background: on ?
|
|
21303
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20888
21304
|
transition: "background 120ms ease"
|
|
20889
21305
|
},
|
|
20890
|
-
children: /* @__PURE__ */
|
|
21306
|
+
children: /* @__PURE__ */ jsx24(
|
|
20891
21307
|
"span",
|
|
20892
21308
|
{
|
|
20893
21309
|
style: {
|
|
@@ -20916,7 +21332,7 @@ function CarouselSlideToolbar({
|
|
|
20916
21332
|
onChangeImage,
|
|
20917
21333
|
onToggleAutoplay
|
|
20918
21334
|
}) {
|
|
20919
|
-
return /* @__PURE__ */
|
|
21335
|
+
return /* @__PURE__ */ jsxs15(
|
|
20920
21336
|
"div",
|
|
20921
21337
|
{
|
|
20922
21338
|
"data-ohw-bridge": "",
|
|
@@ -20927,7 +21343,7 @@ function CarouselSlideToolbar({
|
|
|
20927
21343
|
flexDirection: "column",
|
|
20928
21344
|
gap: 6,
|
|
20929
21345
|
alignItems: "center",
|
|
20930
|
-
background:
|
|
21346
|
+
background: OHW_BLUE2,
|
|
20931
21347
|
padding: 8,
|
|
20932
21348
|
borderRadius: 12,
|
|
20933
21349
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20939,11 +21355,11 @@ function CarouselSlideToolbar({
|
|
|
20939
21355
|
pointerEvents: pending ? "none" : "auto"
|
|
20940
21356
|
},
|
|
20941
21357
|
children: [
|
|
20942
|
-
/* @__PURE__ */
|
|
20943
|
-
/* @__PURE__ */
|
|
20944
|
-
/* @__PURE__ */
|
|
21358
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21359
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21360
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20945
21361
|
] }),
|
|
20946
|
-
error && /* @__PURE__ */
|
|
21362
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20947
21363
|
]
|
|
20948
21364
|
}
|
|
20949
21365
|
);
|
|
@@ -21083,8 +21499,8 @@ function AiFadeCarouselOverlay({
|
|
|
21083
21499
|
const activeItemRect = useLiveItemRect2(active);
|
|
21084
21500
|
const TOOLBAR_APPROX_H = 90;
|
|
21085
21501
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21086
|
-
return /* @__PURE__ */
|
|
21087
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21502
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21503
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
21088
21504
|
"button",
|
|
21089
21505
|
{
|
|
21090
21506
|
type: "button",
|
|
@@ -21113,10 +21529,10 @@ function AiFadeCarouselOverlay({
|
|
|
21113
21529
|
fontSize: 14,
|
|
21114
21530
|
fontWeight: 700
|
|
21115
21531
|
},
|
|
21116
|
-
children: /* @__PURE__ */
|
|
21532
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
21117
21533
|
}
|
|
21118
21534
|
),
|
|
21119
|
-
swapping && /* @__PURE__ */
|
|
21535
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
21120
21536
|
"div",
|
|
21121
21537
|
{
|
|
21122
21538
|
ref: skeletonRef,
|
|
@@ -21134,15 +21550,15 @@ function AiFadeCarouselOverlay({
|
|
|
21134
21550
|
zIndex: 2147483646,
|
|
21135
21551
|
pointerEvents: "none"
|
|
21136
21552
|
},
|
|
21137
|
-
children: /* @__PURE__ */
|
|
21553
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
21138
21554
|
}
|
|
21139
21555
|
),
|
|
21140
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21556
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
21141
21557
|
ItemInteractionLayer,
|
|
21142
21558
|
{
|
|
21143
21559
|
rect: activeItemRect,
|
|
21144
21560
|
state: toolbarState,
|
|
21145
|
-
toolbar: /* @__PURE__ */
|
|
21561
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
21146
21562
|
CarouselSlideToolbar,
|
|
21147
21563
|
{
|
|
21148
21564
|
pending,
|
|
@@ -21333,118 +21749,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21333
21749
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21334
21750
|
import { useEffect as useEffect16 } from "react";
|
|
21335
21751
|
|
|
21336
|
-
// src/ui/dialog.tsx
|
|
21337
|
-
import * as React9 from "react";
|
|
21338
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21339
|
-
import { X as X2 } from "lucide-react";
|
|
21340
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21341
|
-
function Dialog2({
|
|
21342
|
-
...props
|
|
21343
|
-
}) {
|
|
21344
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21345
|
-
}
|
|
21346
|
-
function DialogPortal({
|
|
21347
|
-
...props
|
|
21348
|
-
}) {
|
|
21349
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21350
|
-
}
|
|
21351
|
-
function DialogOverlay({
|
|
21352
|
-
className,
|
|
21353
|
-
...props
|
|
21354
|
-
}) {
|
|
21355
|
-
return /* @__PURE__ */ jsx24(
|
|
21356
|
-
DialogPrimitive.Overlay,
|
|
21357
|
-
{
|
|
21358
|
-
"data-slot": "dialog-overlay",
|
|
21359
|
-
"data-ohw-link-modal-root": "",
|
|
21360
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21361
|
-
...props
|
|
21362
|
-
}
|
|
21363
|
-
);
|
|
21364
|
-
}
|
|
21365
|
-
var DialogContent = React9.forwardRef(
|
|
21366
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21367
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21368
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21369
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21370
|
-
/* @__PURE__ */ jsxs15(
|
|
21371
|
-
DialogPrimitive.Content,
|
|
21372
|
-
{
|
|
21373
|
-
ref,
|
|
21374
|
-
"data-slot": "dialog-content",
|
|
21375
|
-
className: cn(
|
|
21376
|
-
positionMode,
|
|
21377
|
-
"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",
|
|
21378
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21379
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21380
|
-
className
|
|
21381
|
-
),
|
|
21382
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21383
|
-
...props,
|
|
21384
|
-
children: [
|
|
21385
|
-
children,
|
|
21386
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21387
|
-
DialogPrimitive.Close,
|
|
21388
|
-
{
|
|
21389
|
-
type: "button",
|
|
21390
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21391
|
-
"aria-label": "Close",
|
|
21392
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21393
|
-
}
|
|
21394
|
-
) : null
|
|
21395
|
-
]
|
|
21396
|
-
}
|
|
21397
|
-
)
|
|
21398
|
-
] });
|
|
21399
|
-
}
|
|
21400
|
-
);
|
|
21401
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21402
|
-
function DialogHeader({
|
|
21403
|
-
className,
|
|
21404
|
-
...props
|
|
21405
|
-
}) {
|
|
21406
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21407
|
-
}
|
|
21408
|
-
function DialogFooter({
|
|
21409
|
-
className,
|
|
21410
|
-
...props
|
|
21411
|
-
}) {
|
|
21412
|
-
return /* @__PURE__ */ jsx24(
|
|
21413
|
-
"div",
|
|
21414
|
-
{
|
|
21415
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21416
|
-
...props
|
|
21417
|
-
}
|
|
21418
|
-
);
|
|
21419
|
-
}
|
|
21420
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21421
|
-
DialogPrimitive.Title,
|
|
21422
|
-
{
|
|
21423
|
-
ref,
|
|
21424
|
-
className: cn(
|
|
21425
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21426
|
-
className
|
|
21427
|
-
),
|
|
21428
|
-
...props
|
|
21429
|
-
}
|
|
21430
|
-
));
|
|
21431
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21432
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21433
|
-
DialogPrimitive.Description,
|
|
21434
|
-
{
|
|
21435
|
-
ref,
|
|
21436
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21437
|
-
...props
|
|
21438
|
-
}
|
|
21439
|
-
));
|
|
21440
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21441
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21442
|
-
|
|
21443
21752
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21444
21753
|
import { Info, X as X4 } from "lucide-react";
|
|
21445
21754
|
|
|
21446
21755
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21447
|
-
import { ArrowRight as
|
|
21756
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21448
21757
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21449
21758
|
function DestinationBreadcrumb({
|
|
21450
21759
|
pageTitle,
|
|
@@ -21458,7 +21767,7 @@ function DestinationBreadcrumb({
|
|
|
21458
21767
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21459
21768
|
] }),
|
|
21460
21769
|
/* @__PURE__ */ jsx25(
|
|
21461
|
-
|
|
21770
|
+
ArrowRight3,
|
|
21462
21771
|
{
|
|
21463
21772
|
size: 16,
|
|
21464
21773
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21570,7 +21879,7 @@ function Label({ className, ...props }) {
|
|
|
21570
21879
|
}
|
|
21571
21880
|
|
|
21572
21881
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21573
|
-
import { ChevronDown as
|
|
21882
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21574
21883
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21575
21884
|
function FieldChevron({
|
|
21576
21885
|
onClick
|
|
@@ -21583,7 +21892,7 @@ function FieldChevron({
|
|
|
21583
21892
|
onClick,
|
|
21584
21893
|
"aria-label": "Open page list",
|
|
21585
21894
|
tabIndex: -1,
|
|
21586
|
-
children: /* @__PURE__ */ jsx29(
|
|
21895
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21587
21896
|
}
|
|
21588
21897
|
);
|
|
21589
21898
|
}
|
|
@@ -21813,7 +22122,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21813
22122
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21814
22123
|
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21815
22124
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21816
|
-
import { ArrowLeft as
|
|
22125
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21817
22126
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21818
22127
|
|
|
21819
22128
|
// src/lib/parent-scroll.ts
|
|
@@ -22090,7 +22399,7 @@ function SectionPickerOverlay({
|
|
|
22090
22399
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
22091
22400
|
onClick: onBack,
|
|
22092
22401
|
children: [
|
|
22093
|
-
/* @__PURE__ */ jsx31(
|
|
22402
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
22094
22403
|
"Back"
|
|
22095
22404
|
]
|
|
22096
22405
|
}
|
|
@@ -22159,7 +22468,7 @@ function SectionPickerOverlay({
|
|
|
22159
22468
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22160
22469
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22161
22470
|
"aria-hidden": true,
|
|
22162
|
-
children: /* @__PURE__ */ jsx31(
|
|
22471
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22163
22472
|
}
|
|
22164
22473
|
) : null
|
|
22165
22474
|
]
|
|
@@ -22543,6 +22852,7 @@ function shouldUseDevFixtures() {
|
|
|
22543
22852
|
function getLogoElement(el) {
|
|
22544
22853
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22545
22854
|
if (marked) return marked;
|
|
22855
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22546
22856
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22547
22857
|
if (!root) return null;
|
|
22548
22858
|
const anchor = el.closest("a");
|
|
@@ -22612,7 +22922,7 @@ function addFooterColumnWithPersist({
|
|
|
22612
22922
|
import {
|
|
22613
22923
|
useCallback as useCallback9,
|
|
22614
22924
|
useEffect as useEffect17,
|
|
22615
|
-
useLayoutEffect as
|
|
22925
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22616
22926
|
useRef as useRef11,
|
|
22617
22927
|
useState as useState15
|
|
22618
22928
|
} from "react";
|
|
@@ -22709,7 +23019,7 @@ function FloatingPanel({
|
|
|
22709
23019
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22710
23020
|
}, [open]);
|
|
22711
23021
|
const positionRef = useRef11(position);
|
|
22712
|
-
|
|
23022
|
+
useLayoutEffect6(() => {
|
|
22713
23023
|
if (!open) {
|
|
22714
23024
|
positionRef.current = position;
|
|
22715
23025
|
return;
|
|
@@ -22719,7 +23029,7 @@ function FloatingPanel({
|
|
|
22719
23029
|
}
|
|
22720
23030
|
positionRef.current = position;
|
|
22721
23031
|
}, [open, position, liveScroll, parentScroll]);
|
|
22722
|
-
|
|
23032
|
+
useLayoutEffect6(() => {
|
|
22723
23033
|
if (!open || !panelRef.current) return;
|
|
22724
23034
|
const el = panelRef.current;
|
|
22725
23035
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22928,7 +23238,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
22928
23238
|
}
|
|
22929
23239
|
|
|
22930
23240
|
// src/ui/button-style-panel.tsx
|
|
22931
|
-
import { Check as
|
|
23241
|
+
import { Check as Check5 } from "lucide-react";
|
|
22932
23242
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22933
23243
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
22934
23244
|
function ButtonStylePanel({
|
|
@@ -22999,7 +23309,7 @@ function ButtonStylePanel({
|
|
|
22999
23309
|
{
|
|
23000
23310
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
23001
23311
|
"aria-hidden": true,
|
|
23002
|
-
children: /* @__PURE__ */ jsx35(
|
|
23312
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
23003
23313
|
}
|
|
23004
23314
|
) : null
|
|
23005
23315
|
]
|
|
@@ -23885,12 +24195,19 @@ function useSectionDrag({
|
|
|
23885
24195
|
clearSectionDragVisuals();
|
|
23886
24196
|
return;
|
|
23887
24197
|
}
|
|
24198
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
23888
24199
|
const orderJson = JSON.stringify(
|
|
23889
24200
|
mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname, entries)
|
|
23890
24201
|
);
|
|
23891
24202
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
23892
24203
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
23893
|
-
postToParentRef.current({
|
|
24204
|
+
postToParentRef.current({
|
|
24205
|
+
type: "ow:change",
|
|
24206
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
24207
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
24208
|
+
// Undo scrolls to this section; a one-place move swaps two, so the order alone can't say which.
|
|
24209
|
+
moved: session.instanceId
|
|
24210
|
+
});
|
|
23894
24211
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
23895
24212
|
clearSectionDragVisuals();
|
|
23896
24213
|
requestAnimationFrame(() => {
|
|
@@ -24024,7 +24341,7 @@ function useSectionDrag({
|
|
|
24024
24341
|
}
|
|
24025
24342
|
|
|
24026
24343
|
// src/ui/footer-container-chrome.tsx
|
|
24027
|
-
import { Plus as
|
|
24344
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
24028
24345
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
24029
24346
|
function FooterContainerChrome({
|
|
24030
24347
|
rect,
|
|
@@ -24065,7 +24382,7 @@ function FooterContainerChrome({
|
|
|
24065
24382
|
if (addDisabled) return;
|
|
24066
24383
|
onAdd();
|
|
24067
24384
|
},
|
|
24068
|
-
children: /* @__PURE__ */ jsx36(
|
|
24385
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24069
24386
|
}
|
|
24070
24387
|
) }),
|
|
24071
24388
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24472,7 +24789,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24472
24789
|
}
|
|
24473
24790
|
|
|
24474
24791
|
// src/ui/navbar-container-chrome.tsx
|
|
24475
|
-
import { Plus as
|
|
24792
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24476
24793
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24477
24794
|
function NavbarContainerChrome({
|
|
24478
24795
|
rect,
|
|
@@ -24508,7 +24825,7 @@ function NavbarContainerChrome({
|
|
|
24508
24825
|
e.stopPropagation();
|
|
24509
24826
|
onAdd();
|
|
24510
24827
|
},
|
|
24511
|
-
children: /* @__PURE__ */ jsx37(
|
|
24828
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24512
24829
|
}
|
|
24513
24830
|
)
|
|
24514
24831
|
}
|
|
@@ -24580,7 +24897,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24580
24897
|
}
|
|
24581
24898
|
|
|
24582
24899
|
// src/OhhwellsBridge.tsx
|
|
24583
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
24900
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
|
|
24584
24901
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24585
24902
|
var PRIMARY7 = "#0885FE";
|
|
24586
24903
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25358,7 +25675,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25358
25675
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25359
25676
|
return resolveFooterLinksContainerFrom(el);
|
|
25360
25677
|
}
|
|
25361
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25678
|
+
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)) {
|
|
25362
25679
|
return getNavigationRoot(el);
|
|
25363
25680
|
}
|
|
25364
25681
|
return null;
|
|
@@ -25580,7 +25897,6 @@ var ICONS = {
|
|
|
25580
25897
|
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"/>',
|
|
25581
25898
|
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"/>'
|
|
25582
25899
|
};
|
|
25583
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25584
25900
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25585
25901
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25586
25902
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25678,7 +25994,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25678
25994
|
el.style.top = `${top}px`;
|
|
25679
25995
|
el.style.height = `${height}px`;
|
|
25680
25996
|
}
|
|
25681
|
-
var
|
|
25997
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25682
25998
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25683
25999
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25684
26000
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25705,8 +26021,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25705
26021
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25706
26022
|
const half = toolbarWidth / 2;
|
|
25707
26023
|
return Math.max(
|
|
25708
|
-
|
|
25709
|
-
Math.min(centerX, window.innerWidth -
|
|
26024
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26025
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25710
26026
|
);
|
|
25711
26027
|
}
|
|
25712
26028
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -26107,7 +26423,7 @@ function OhhwellsBridge() {
|
|
|
26107
26423
|
}, []);
|
|
26108
26424
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26109
26425
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
26110
|
-
|
|
26426
|
+
useLayoutEffect7(() => {
|
|
26111
26427
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26112
26428
|
if (next !== subdomain) setSubdomain(next);
|
|
26113
26429
|
if (next) return;
|
|
@@ -26589,21 +26905,6 @@ function OhhwellsBridge() {
|
|
|
26589
26905
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26590
26906
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26591
26907
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26592
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26593
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26594
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26595
|
-
const floatingPanelRef = useRef14(null);
|
|
26596
|
-
floatingPanelRef.current = floatingPanel;
|
|
26597
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26598
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26599
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26600
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26601
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26602
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26603
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26604
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26605
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26606
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26607
26908
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26608
26909
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26609
26910
|
const footerDragRef = useRef14(null);
|
|
@@ -26630,6 +26931,21 @@ function OhhwellsBridge() {
|
|
|
26630
26931
|
const stylesRef = useRef14("");
|
|
26631
26932
|
const appliedDrawerRef = useRef14(null);
|
|
26632
26933
|
const pendingDeleteUndoRef = useRef14(null);
|
|
26934
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26935
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
26936
|
+
const floatingPanelRef = useRef14(null);
|
|
26937
|
+
floatingPanelRef.current = floatingPanel;
|
|
26938
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
26939
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26940
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
26941
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
26942
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26943
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26944
|
+
const buttonPointerDragRef = useRef14(null);
|
|
26945
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26946
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26947
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26948
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26633
26949
|
const [sitePages, setSitePages] = useState18([]);
|
|
26634
26950
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26635
26951
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26639,7 +26955,18 @@ function OhhwellsBridge() {
|
|
|
26639
26955
|
const linkPopoverOpenRef = useRef14(false);
|
|
26640
26956
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26641
26957
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26958
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26642
26959
|
linkPopoverSessionRef.current = linkPopover;
|
|
26960
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26961
|
+
useEffect21(() => {
|
|
26962
|
+
const syncViewport = () => {
|
|
26963
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26964
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26965
|
+
};
|
|
26966
|
+
syncViewport();
|
|
26967
|
+
window.addEventListener("resize", syncViewport);
|
|
26968
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26969
|
+
}, []);
|
|
26643
26970
|
useEffect21(() => {
|
|
26644
26971
|
setSectionOrderPersistHandler((entries) => {
|
|
26645
26972
|
const currentPath = window.location.pathname;
|
|
@@ -28346,7 +28673,7 @@ function OhhwellsBridge() {
|
|
|
28346
28673
|
isFooterFrameSelection,
|
|
28347
28674
|
postToParent2
|
|
28348
28675
|
]);
|
|
28349
|
-
|
|
28676
|
+
useLayoutEffect7(() => {
|
|
28350
28677
|
if (!subdomain || isEditMode) {
|
|
28351
28678
|
setFetchState("done");
|
|
28352
28679
|
return;
|
|
@@ -28373,6 +28700,7 @@ function OhhwellsBridge() {
|
|
|
28373
28700
|
applyAiFooterFromContent(content);
|
|
28374
28701
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28375
28702
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28703
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28376
28704
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28377
28705
|
}
|
|
28378
28706
|
applyBrandChrome(content);
|
|
@@ -28383,15 +28711,16 @@ function OhhwellsBridge() {
|
|
|
28383
28711
|
if (key === "__ohw_sections") continue;
|
|
28384
28712
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28385
28713
|
if (key === AI_FOOTER_KEY) continue;
|
|
28714
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28715
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28386
28716
|
if (key === BRAND_KIT_KEY) continue;
|
|
28387
28717
|
if (key === STYLE_STORE_KEY) continue;
|
|
28388
28718
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28389
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28390
28719
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28391
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28392
28720
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28393
28721
|
continue;
|
|
28394
28722
|
}
|
|
28723
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28395
28724
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28396
28725
|
if (applyCarouselNode(key, val)) continue;
|
|
28397
28726
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28431,6 +28760,7 @@ function OhhwellsBridge() {
|
|
|
28431
28760
|
});
|
|
28432
28761
|
applyLinkByKey(key, val);
|
|
28433
28762
|
}
|
|
28763
|
+
applySectionEmbeds(content);
|
|
28434
28764
|
applyLogoFromContent(content);
|
|
28435
28765
|
applyLogoSizes(content);
|
|
28436
28766
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28619,20 +28949,22 @@ function OhhwellsBridge() {
|
|
|
28619
28949
|
}
|
|
28620
28950
|
applyAiFooterFromContent(content);
|
|
28621
28951
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28952
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28622
28953
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28623
28954
|
}
|
|
28624
28955
|
for (const [key, val] of Object.entries(content)) {
|
|
28625
28956
|
if (key === "__ohw_sections") continue;
|
|
28626
28957
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28627
28958
|
if (key === AI_FOOTER_KEY) continue;
|
|
28959
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28960
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28628
28961
|
if (key === BRAND_KIT_KEY) continue;
|
|
28629
28962
|
if (key === STYLE_STORE_KEY) continue;
|
|
28630
28963
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28631
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28632
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28633
28964
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28634
28965
|
continue;
|
|
28635
28966
|
}
|
|
28967
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28636
28968
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28637
28969
|
if (applyCarouselNode(key, val)) continue;
|
|
28638
28970
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28657,6 +28989,7 @@ function OhhwellsBridge() {
|
|
|
28657
28989
|
});
|
|
28658
28990
|
applyLinkByKey(key, val);
|
|
28659
28991
|
}
|
|
28992
|
+
applySectionEmbeds(content);
|
|
28660
28993
|
applyLogoFromContent(content);
|
|
28661
28994
|
reconcileNavbarItemsFromContent(content);
|
|
28662
28995
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28712,7 +29045,7 @@ function OhhwellsBridge() {
|
|
|
28712
29045
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28713
29046
|
};
|
|
28714
29047
|
}, [subdomain, isEditMode, pathname]);
|
|
28715
|
-
|
|
29048
|
+
useLayoutEffect7(() => {
|
|
28716
29049
|
const el = document.getElementById("ohw-loader");
|
|
28717
29050
|
if (!el) return;
|
|
28718
29051
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
@@ -28896,26 +29229,11 @@ function OhhwellsBridge() {
|
|
|
28896
29229
|
const t2 = setTimeout(measure, 500);
|
|
28897
29230
|
const ro = new ResizeObserver(schedule);
|
|
28898
29231
|
ro.observe(document.body);
|
|
28899
|
-
let lastWidth = window.innerWidth;
|
|
28900
|
-
let resizeTimers = [];
|
|
28901
|
-
const clearResizeTimers = () => {
|
|
28902
|
-
resizeTimers.forEach(clearTimeout);
|
|
28903
|
-
resizeTimers = [];
|
|
28904
|
-
};
|
|
28905
|
-
const handleResize = () => {
|
|
28906
|
-
if (window.innerWidth === lastWidth) return;
|
|
28907
|
-
lastWidth = window.innerWidth;
|
|
28908
|
-
clearResizeTimers();
|
|
28909
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
28910
|
-
};
|
|
28911
|
-
window.addEventListener("resize", handleResize);
|
|
28912
29232
|
return () => {
|
|
28913
29233
|
clearTimeout(t1);
|
|
28914
29234
|
clearTimeout(t2);
|
|
28915
29235
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28916
29236
|
ro.disconnect();
|
|
28917
|
-
clearResizeTimers();
|
|
28918
|
-
window.removeEventListener("resize", handleResize);
|
|
28919
29237
|
};
|
|
28920
29238
|
}, [pathname, isEditMode, postToParent2]);
|
|
28921
29239
|
useEffect21(() => {
|
|
@@ -29212,6 +29530,13 @@ function OhhwellsBridge() {
|
|
|
29212
29530
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29213
29531
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29214
29532
|
if (isInsideLinkEditor(target)) return;
|
|
29533
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29534
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29535
|
+
if (target.closest(
|
|
29536
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29537
|
+
)) {
|
|
29538
|
+
return;
|
|
29539
|
+
}
|
|
29215
29540
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29216
29541
|
clearMediaSelectionRef.current();
|
|
29217
29542
|
}
|
|
@@ -29235,8 +29560,6 @@ function OhhwellsBridge() {
|
|
|
29235
29560
|
return;
|
|
29236
29561
|
}
|
|
29237
29562
|
}
|
|
29238
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29239
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29240
29563
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29241
29564
|
if (collectionItem) {
|
|
29242
29565
|
e.preventDefault();
|
|
@@ -29248,11 +29571,6 @@ function OhhwellsBridge() {
|
|
|
29248
29571
|
});
|
|
29249
29572
|
return;
|
|
29250
29573
|
}
|
|
29251
|
-
if (target.closest(
|
|
29252
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29253
|
-
)) {
|
|
29254
|
-
return;
|
|
29255
|
-
}
|
|
29256
29574
|
{
|
|
29257
29575
|
const formEl = getFormElement(target);
|
|
29258
29576
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29406,9 +29724,13 @@ function OhhwellsBridge() {
|
|
|
29406
29724
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29407
29725
|
e.preventDefault();
|
|
29408
29726
|
e.stopPropagation();
|
|
29409
|
-
selectIconElementRef.current(editable);
|
|
29410
29727
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29411
29728
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29729
|
+
if (aiIcon) {
|
|
29730
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29731
|
+
} else {
|
|
29732
|
+
selectIconElementRef.current(editable);
|
|
29733
|
+
}
|
|
29412
29734
|
postToParentRef.current({
|
|
29413
29735
|
type: "ow:icon-pick",
|
|
29414
29736
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29636,6 +29958,9 @@ function OhhwellsBridge() {
|
|
|
29636
29958
|
setHoveredItemRect(null);
|
|
29637
29959
|
hoveredNavContainerRef.current = null;
|
|
29638
29960
|
setHoveredNavContainerRect(null);
|
|
29961
|
+
siblingHintElRef.current = null;
|
|
29962
|
+
setSiblingHintRect(null);
|
|
29963
|
+
setSiblingHintRects([]);
|
|
29639
29964
|
return;
|
|
29640
29965
|
}
|
|
29641
29966
|
{
|
|
@@ -29756,7 +30081,6 @@ function OhhwellsBridge() {
|
|
|
29756
30081
|
hoveredNavContainerRef.current = null;
|
|
29757
30082
|
setHoveredNavContainerRect(null);
|
|
29758
30083
|
hoveredItemElRef.current = editable;
|
|
29759
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29760
30084
|
}
|
|
29761
30085
|
}
|
|
29762
30086
|
}
|
|
@@ -30466,7 +30790,11 @@ function OhhwellsBridge() {
|
|
|
30466
30790
|
};
|
|
30467
30791
|
const handleMouseMove = (e) => {
|
|
30468
30792
|
const { clientX, clientY } = e;
|
|
30469
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30793
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30794
|
+
dismissImageHover();
|
|
30795
|
+
clearImageHover();
|
|
30796
|
+
return;
|
|
30797
|
+
}
|
|
30470
30798
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30471
30799
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30472
30800
|
formHoverElRef.current = null;
|
|
@@ -30495,7 +30823,12 @@ function OhhwellsBridge() {
|
|
|
30495
30823
|
setHoveredItemRect(null);
|
|
30496
30824
|
hoveredNavContainerRef.current = null;
|
|
30497
30825
|
setHoveredNavContainerRect(null);
|
|
30826
|
+
siblingHintElRef.current = null;
|
|
30827
|
+
setSiblingHintRect(null);
|
|
30828
|
+
setSiblingHintRects([]);
|
|
30498
30829
|
dismissImageHover();
|
|
30830
|
+
clearImageHover();
|
|
30831
|
+
setSectionGap(null);
|
|
30499
30832
|
return;
|
|
30500
30833
|
}
|
|
30501
30834
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30507,7 +30840,11 @@ function OhhwellsBridge() {
|
|
|
30507
30840
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30508
30841
|
const { clientX, clientY } = e.data;
|
|
30509
30842
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30510
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30843
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30844
|
+
dismissImageHover();
|
|
30845
|
+
clearImageHover();
|
|
30846
|
+
return;
|
|
30847
|
+
}
|
|
30511
30848
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30512
30849
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30513
30850
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30887,6 +31224,7 @@ function OhhwellsBridge() {
|
|
|
30887
31224
|
applyAiFooterFromContent(content);
|
|
30888
31225
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30889
31226
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31227
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30890
31228
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30891
31229
|
}
|
|
30892
31230
|
applyBrandChrome(content);
|
|
@@ -30901,15 +31239,16 @@ function OhhwellsBridge() {
|
|
|
30901
31239
|
}
|
|
30902
31240
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30903
31241
|
if (key === AI_FOOTER_KEY) continue;
|
|
31242
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31243
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30904
31244
|
if (key === BRAND_KIT_KEY) continue;
|
|
30905
31245
|
if (key === STYLE_STORE_KEY) continue;
|
|
30906
31246
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30907
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30908
31247
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30909
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30910
31248
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30911
31249
|
continue;
|
|
30912
31250
|
}
|
|
31251
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30913
31252
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30914
31253
|
if (applyCarouselNode(key, val)) continue;
|
|
30915
31254
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30935,6 +31274,7 @@ function OhhwellsBridge() {
|
|
|
30935
31274
|
});
|
|
30936
31275
|
applyLinkByKey(key, val);
|
|
30937
31276
|
}
|
|
31277
|
+
applySectionEmbeds(content);
|
|
30938
31278
|
applyLogoFromContent(content);
|
|
30939
31279
|
applyLogoSizes(content);
|
|
30940
31280
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -30949,6 +31289,7 @@ function OhhwellsBridge() {
|
|
|
30949
31289
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
30950
31290
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
30951
31291
|
syncButtonsFromContent(document, editContentRef.current);
|
|
31292
|
+
if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
|
|
30952
31293
|
syncNavigationDragCursorAttrs();
|
|
30953
31294
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30954
31295
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -31380,6 +31721,7 @@ function OhhwellsBridge() {
|
|
|
31380
31721
|
const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
|
|
31381
31722
|
const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
|
|
31382
31723
|
if (!instanceId || !direction) return;
|
|
31724
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
31383
31725
|
const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
|
|
31384
31726
|
if (!entries) return;
|
|
31385
31727
|
const orderJson = JSON.stringify(
|
|
@@ -31388,7 +31730,12 @@ function OhhwellsBridge() {
|
|
|
31388
31730
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
31389
31731
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
31390
31732
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
31391
|
-
postToParentRef.current({
|
|
31733
|
+
postToParentRef.current({
|
|
31734
|
+
type: "ow:change",
|
|
31735
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
31736
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
31737
|
+
moved: instanceId
|
|
31738
|
+
});
|
|
31392
31739
|
window.dispatchEvent(new Event("resize"));
|
|
31393
31740
|
};
|
|
31394
31741
|
window.addEventListener("message", handleMoveSection);
|
|
@@ -31567,6 +31914,12 @@ function OhhwellsBridge() {
|
|
|
31567
31914
|
closeLinkPopoverRef.current();
|
|
31568
31915
|
return;
|
|
31569
31916
|
}
|
|
31917
|
+
if (floatingPanelOpenRef.current) {
|
|
31918
|
+
setFloatingPanelRef.current(null);
|
|
31919
|
+
deselectRef.current();
|
|
31920
|
+
deactivateRef.current();
|
|
31921
|
+
return;
|
|
31922
|
+
}
|
|
31570
31923
|
deselectRef.current();
|
|
31571
31924
|
deactivateRef.current();
|
|
31572
31925
|
clearMediaSelectionRef.current();
|
|
@@ -31751,12 +32104,6 @@ function OhhwellsBridge() {
|
|
|
31751
32104
|
return;
|
|
31752
32105
|
}
|
|
31753
32106
|
}
|
|
31754
|
-
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !activeElRef.current) {
|
|
31755
|
-
if (runPendingDeleteUndoRef.current()) {
|
|
31756
|
-
e.preventDefault();
|
|
31757
|
-
return;
|
|
31758
|
-
}
|
|
31759
|
-
}
|
|
31760
32107
|
if (e.key !== "Escape") return;
|
|
31761
32108
|
const el = activeElRef.current;
|
|
31762
32109
|
if (el && originalContentRef.current !== null) {
|
|
@@ -32403,10 +32750,10 @@ function OhhwellsBridge() {
|
|
|
32403
32750
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32404
32751
|
window.removeEventListener("message", handleDeactivate);
|
|
32405
32752
|
window.removeEventListener("message", handleSelectNav);
|
|
32406
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32407
32753
|
window.removeEventListener("message", handleToastAction);
|
|
32408
32754
|
window.removeEventListener("message", handleFormCount);
|
|
32409
32755
|
window.removeEventListener("message", handleUiEscape);
|
|
32756
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32410
32757
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32411
32758
|
autoSaveTimers.current.clear();
|
|
32412
32759
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32700,7 +33047,7 @@ function OhhwellsBridge() {
|
|
|
32700
33047
|
postToParent2({
|
|
32701
33048
|
type: "ow:ready",
|
|
32702
33049
|
version: "1",
|
|
32703
|
-
bridgeVersion: "0.1.
|
|
33050
|
+
bridgeVersion: "0.1.170-next.453",
|
|
32704
33051
|
path: pathname,
|
|
32705
33052
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32706
33053
|
sections
|
|
@@ -32901,7 +33248,7 @@ function OhhwellsBridge() {
|
|
|
32901
33248
|
const copyHref = result.copy.getAttribute("data-ohw-href-key");
|
|
32902
33249
|
const copyHrefVal = copyHref ? result.content[copyHref] : void 0;
|
|
32903
33250
|
if (copyHref && copyHrefVal !== void 0) applyLinkByKey(copyHref, copyHrefVal);
|
|
32904
|
-
postToParent2({ type: "ow:change", nodes: result.nodes });
|
|
33251
|
+
postToParent2({ type: "ow:change", nodes: result.nodes, label: "Button duplicated" });
|
|
32905
33252
|
enforceLinkHrefs();
|
|
32906
33253
|
requestAnimationFrame(() => {
|
|
32907
33254
|
selectRef.current(result.copy);
|
|
@@ -32950,7 +33297,7 @@ function OhhwellsBridge() {
|
|
|
32950
33297
|
...editContentRef.current,
|
|
32951
33298
|
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
32952
33299
|
};
|
|
32953
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33300
|
+
postToParent2({ type: "ow:change", nodes, label: "Social icon duplicated" });
|
|
32954
33301
|
enforceLinkHrefs();
|
|
32955
33302
|
const copyRow = findSocialsRow(result.item);
|
|
32956
33303
|
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
@@ -33000,7 +33347,7 @@ function OhhwellsBridge() {
|
|
|
33000
33347
|
[NAV_COUNT_KEY]: navCount,
|
|
33001
33348
|
[NAV_ORDER_KEY]: result.orderJson
|
|
33002
33349
|
};
|
|
33003
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33350
|
+
postToParent2({ type: "ow:change", nodes, label: "Link duplicated" });
|
|
33004
33351
|
enforceLinkHrefs();
|
|
33005
33352
|
if (isNestedNavChild(selected) || navItemOwnsDropdownPanel(selected)) {
|
|
33006
33353
|
setNavGroupForceOpen(selected, true);
|
|
@@ -33040,7 +33387,8 @@ function OhhwellsBridge() {
|
|
|
33040
33387
|
{ key: result.hrefKey, text: result.href },
|
|
33041
33388
|
{ key: result.labelKey, text: result.label },
|
|
33042
33389
|
{ key: FOOTER_ORDER_KEY, text: orderJson }
|
|
33043
|
-
]
|
|
33390
|
+
],
|
|
33391
|
+
label: "Link duplicated"
|
|
33044
33392
|
});
|
|
33045
33393
|
enforceLinkHrefs();
|
|
33046
33394
|
requestAnimationFrame(() => {
|
|
@@ -33435,7 +33783,7 @@ function OhhwellsBridge() {
|
|
|
33435
33783
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33436
33784
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33437
33785
|
"data-ohw-add-field": "",
|
|
33438
|
-
children: /* @__PURE__ */ jsx40(
|
|
33786
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33439
33787
|
}
|
|
33440
33788
|
),
|
|
33441
33789
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|