@ohhwells/bridge 0.1.169 → 0.1.170-next.454
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 +1699 -839
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -1
- package/dist/index.d.ts +84 -1
- package/dist/index.js +1721 -861
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +116 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -53,6 +53,7 @@ __export(index_exports, {
|
|
|
53
53
|
FOOTER_COLUMN_BLOCKS: () => FOOTER_COLUMN_BLOCKS,
|
|
54
54
|
FOOTER_COLUMN_SPANS: () => FOOTER_COLUMN_SPANS,
|
|
55
55
|
FOOTER_SOCIAL_PLATFORMS: () => FOOTER_SOCIAL_PLATFORMS,
|
|
56
|
+
HIDDEN_EDITABLES_KEY: () => HIDDEN_EDITABLES_KEY,
|
|
56
57
|
ItemActionToolbar: () => ItemActionToolbar,
|
|
57
58
|
ItemInteractionLayer: () => ItemInteractionLayer,
|
|
58
59
|
LinkEditorPanel: () => LinkEditorPanel,
|
|
@@ -75,9 +76,14 @@ __export(index_exports, {
|
|
|
75
76
|
addFooterLinkColumn: () => addFooterLinkColumn,
|
|
76
77
|
appendFooterSocial: () => appendFooterSocial,
|
|
77
78
|
applyBrandChrome: () => applyBrandChrome,
|
|
79
|
+
applyHiddenEditablesToDom: () => applyHiddenEditablesToDom,
|
|
78
80
|
applyStickySearchParams: () => applyStickySearchParams,
|
|
81
|
+
blockPathFromEditKey: () => blockPathFromEditKey,
|
|
79
82
|
buildDefaultFooterTree: () => buildDefaultFooterTree,
|
|
80
83
|
buildTarget: () => buildTarget,
|
|
84
|
+
canRemoveAiBlock: () => canRemoveAiBlock,
|
|
85
|
+
canRemoveAiTextBlock: () => canRemoveAiTextBlock,
|
|
86
|
+
canSoftHideEditable: () => canSoftHideEditable,
|
|
81
87
|
dropIndicatorVariants: () => dropIndicatorVariants,
|
|
82
88
|
ensureFooterTree: () => ensureFooterTree,
|
|
83
89
|
filterAvailablePages: () => filterAvailablePages,
|
|
@@ -88,6 +94,7 @@ __export(index_exports, {
|
|
|
88
94
|
insertFooterHours: () => insertFooterHours,
|
|
89
95
|
isDeadPageHref: () => isDeadPageHref,
|
|
90
96
|
isEditSessionActive: () => isEditSessionActive,
|
|
97
|
+
isEditableKeyHidden: () => isEditableKeyHidden,
|
|
91
98
|
isPlainLeftClick: () => isPlainLeftClick,
|
|
92
99
|
isRenderableFooterTree: () => isRenderableFooterTree,
|
|
93
100
|
isRenderableTree: () => isRenderableTree,
|
|
@@ -98,15 +105,22 @@ __export(index_exports, {
|
|
|
98
105
|
parseAiFooterState: () => parseAiFooterState,
|
|
99
106
|
parseAiSectionsState: () => parseAiSectionsState,
|
|
100
107
|
parseTarget: () => parseTarget,
|
|
108
|
+
planAiBlockRemoval: () => planAiBlockRemoval,
|
|
109
|
+
planAiTextBlockRemoval: () => planAiTextBlockRemoval,
|
|
101
110
|
planBuildPageSync: () => planBuildPageSync,
|
|
111
|
+
readHiddenEditables: () => readHiddenEditables,
|
|
102
112
|
recordOverriddenPaths: () => recordOverriddenPaths,
|
|
103
113
|
releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
|
|
114
|
+
removeBlockAtPath: () => removeBlockAtPath,
|
|
104
115
|
removeFooterBlock: () => removeFooterBlock,
|
|
105
116
|
resetOverriddenPathsCache: () => resetOverriddenPathsCache,
|
|
106
117
|
resolveFooterCopyright: () => resolveFooterCopyright,
|
|
118
|
+
resolveSoftHideTarget: () => resolveSoftHideTarget,
|
|
107
119
|
resolveStickyNavigation: () => resolveStickyNavigation,
|
|
108
120
|
serializeAiFooterState: () => serializeAiFooterState,
|
|
109
121
|
shouldFetchContentForPath: () => shouldFetchContentForPath,
|
|
122
|
+
softHideEditableInDom: () => softHideEditableInDom,
|
|
123
|
+
softUnhideEditableInDom: () => softUnhideEditableInDom,
|
|
110
124
|
stepViableSlide: () => stepViableSlide,
|
|
111
125
|
stripPlaceholderText: () => stripPlaceholderText,
|
|
112
126
|
stripPlaceholders: () => stripPlaceholders,
|
|
@@ -114,7 +128,9 @@ __export(index_exports, {
|
|
|
114
128
|
toggleVariants: () => toggleVariants,
|
|
115
129
|
useOhwCarousel: () => useOhwCarousel,
|
|
116
130
|
validateUrlInput: () => validateUrlInput,
|
|
117
|
-
viableSlides: () => viableSlides
|
|
131
|
+
viableSlides: () => viableSlides,
|
|
132
|
+
withHiddenEditable: () => withHiddenEditable,
|
|
133
|
+
withoutHiddenEditable: () => withoutHiddenEditable
|
|
118
134
|
});
|
|
119
135
|
module.exports = __toCommonJS(index_exports);
|
|
120
136
|
|
|
@@ -307,9 +323,23 @@ function parseSectionsFromHtml(html) {
|
|
|
307
323
|
return parseSectionsFromRoot(doc);
|
|
308
324
|
}
|
|
309
325
|
|
|
326
|
+
// src/lib/soft-hide.ts
|
|
327
|
+
var PREV_DISPLAY_ATTR = "data-ohw-prev-display";
|
|
328
|
+
function softHide(el) {
|
|
329
|
+
if (!el.hasAttribute(PREV_DISPLAY_ATTR)) el.setAttribute(PREV_DISPLAY_ATTR, el.style.display);
|
|
330
|
+
el.style.display = "none";
|
|
331
|
+
}
|
|
332
|
+
function softUnhide(el) {
|
|
333
|
+
const prev = el.getAttribute(PREV_DISPLAY_ATTR);
|
|
334
|
+
el.removeAttribute(PREV_DISPLAY_ATTR);
|
|
335
|
+
if (prev) el.style.display = prev;
|
|
336
|
+
else el.style.removeProperty("display");
|
|
337
|
+
}
|
|
338
|
+
|
|
310
339
|
// src/lib/section-instances.ts
|
|
311
340
|
var SECTION_ORDER_KEY = "__ohw_section_order";
|
|
312
341
|
var REMOVED_ATTR = "data-ohw-section-removed";
|
|
342
|
+
var CLONE_ATTR = "data-ohw-section-clone";
|
|
313
343
|
function isRemovedSection(el) {
|
|
314
344
|
return el.hasAttribute(REMOVED_ATTR);
|
|
315
345
|
}
|
|
@@ -378,14 +408,14 @@ function syncRemovedFlags(entries) {
|
|
|
378
408
|
const removedIds = new Set(entries.filter((e) => e.removed).map((e) => e.instanceId));
|
|
379
409
|
document.querySelectorAll(`[${REMOVED_ATTR}]`).forEach((el) => {
|
|
380
410
|
if (!removedIds.has(instanceIdOf(el))) {
|
|
381
|
-
el
|
|
411
|
+
softUnhide(el);
|
|
382
412
|
el.removeAttribute(REMOVED_ATTR);
|
|
383
413
|
}
|
|
384
414
|
});
|
|
385
415
|
for (const id of removedIds) {
|
|
386
416
|
const el = findByInstanceId(id);
|
|
387
417
|
if (el) {
|
|
388
|
-
el
|
|
418
|
+
softHide(el);
|
|
389
419
|
el.setAttribute(REMOVED_ATTR, "");
|
|
390
420
|
}
|
|
391
421
|
}
|
|
@@ -438,6 +468,7 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
|
|
|
438
468
|
if (!original) return null;
|
|
439
469
|
const clone = original.cloneNode(true);
|
|
440
470
|
clone.setAttribute("data-ohw-instance", newId);
|
|
471
|
+
clone.setAttribute(CLONE_ATTR, "");
|
|
441
472
|
const keyRekeys = rekeySectionSubtree(clone, newId);
|
|
442
473
|
original.insertAdjacentElement("afterend", clone);
|
|
443
474
|
const byId = new Map(existingEntries.map((e) => [e.instanceId, e]));
|
|
@@ -457,6 +488,15 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
|
|
|
457
488
|
function newInstanceId() {
|
|
458
489
|
return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `instance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
459
490
|
}
|
|
491
|
+
function orderBeforeMove(raw, currentPath) {
|
|
492
|
+
const entries = topLevelSections().map((el, order) => ({
|
|
493
|
+
instanceId: instanceIdOf(el),
|
|
494
|
+
type: sectionTypeOf(el),
|
|
495
|
+
order,
|
|
496
|
+
pagePath: currentPath
|
|
497
|
+
}));
|
|
498
|
+
return JSON.stringify(mergePageSectionOrder(raw, currentPath, entries));
|
|
499
|
+
}
|
|
460
500
|
function getPageSectionOrderEntries(raw, currentPath) {
|
|
461
501
|
if (!raw) return [];
|
|
462
502
|
try {
|
|
@@ -508,6 +548,10 @@ function initSectionInstancesFromContent(content, currentPath) {
|
|
|
508
548
|
if (type) el.setAttribute("data-ohw-instance", type);
|
|
509
549
|
});
|
|
510
550
|
const entries = getPageSectionOrderEntries(content[SECTION_ORDER_KEY], currentPath);
|
|
551
|
+
const listed = new Set(entries.map((entry) => entry.instanceId));
|
|
552
|
+
document.querySelectorAll(`[${CLONE_ATTR}]`).forEach((clone) => {
|
|
553
|
+
if (!listed.has(instanceIdOf(clone))) clone.remove();
|
|
554
|
+
});
|
|
511
555
|
for (const entry of entries) {
|
|
512
556
|
if (entry.instanceId === entry.type) continue;
|
|
513
557
|
if (document.querySelector(`[data-ohw-instance="${CSS.escape(entry.instanceId)}"]`)) continue;
|
|
@@ -517,6 +561,7 @@ function initSectionInstancesFromContent(content, currentPath) {
|
|
|
517
561
|
if (!original) continue;
|
|
518
562
|
const clone = original.cloneNode(true);
|
|
519
563
|
clone.setAttribute("data-ohw-instance", entry.instanceId);
|
|
564
|
+
clone.setAttribute(CLONE_ATTR, "");
|
|
520
565
|
rekeySectionSubtree(clone, entry.instanceId);
|
|
521
566
|
original.insertAdjacentElement("afterend", clone);
|
|
522
567
|
}
|
|
@@ -1216,21 +1261,21 @@ function chromeFrom(sample) {
|
|
|
1216
1261
|
};
|
|
1217
1262
|
}
|
|
1218
1263
|
function filledPrimary(seed) {
|
|
1219
|
-
const
|
|
1220
|
-
const luminance = relativeLuminance(
|
|
1264
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1265
|
+
const luminance = relativeLuminance(paint2);
|
|
1221
1266
|
return {
|
|
1222
|
-
background: toCss({ ...
|
|
1267
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1223
1268
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1224
1269
|
borderColor: TRANSPARENT,
|
|
1225
1270
|
borderWidth: "0px"
|
|
1226
1271
|
};
|
|
1227
1272
|
}
|
|
1228
1273
|
function generatedSecondary(primary) {
|
|
1229
|
-
const
|
|
1274
|
+
const paint2 = accentColor(primary);
|
|
1230
1275
|
return {
|
|
1231
1276
|
background: TRANSPARENT,
|
|
1232
|
-
color:
|
|
1233
|
-
borderColor:
|
|
1277
|
+
color: paint2,
|
|
1278
|
+
borderColor: paint2,
|
|
1234
1279
|
borderWidth: "1px"
|
|
1235
1280
|
};
|
|
1236
1281
|
}
|
|
@@ -1243,9 +1288,9 @@ function generatedGhost(primary) {
|
|
|
1243
1288
|
};
|
|
1244
1289
|
}
|
|
1245
1290
|
function normalizeOutlineChrome(outline, primary) {
|
|
1246
|
-
const
|
|
1291
|
+
const paint2 = accentColor(primary);
|
|
1247
1292
|
const text = parseColor(outline.color);
|
|
1248
|
-
const paintRgb = parseColor(
|
|
1293
|
+
const paintRgb = parseColor(paint2);
|
|
1249
1294
|
const primaryLabel = parseColor(primary.color);
|
|
1250
1295
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1251
1296
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1254,8 +1299,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1254
1299
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1255
1300
|
return {
|
|
1256
1301
|
...outline,
|
|
1257
|
-
color:
|
|
1258
|
-
borderColor: hasBorder ?
|
|
1302
|
+
color: paint2,
|
|
1303
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1259
1304
|
};
|
|
1260
1305
|
}
|
|
1261
1306
|
function generateButtonVariants(samples) {
|
|
@@ -1674,6 +1719,8 @@ function brandTrackedFontFamily(doc, stack) {
|
|
|
1674
1719
|
}
|
|
1675
1720
|
var paintLockByEl = /* @__PURE__ */ new WeakMap();
|
|
1676
1721
|
var paintObserverByEl = /* @__PURE__ */ new WeakMap();
|
|
1722
|
+
var prePaintByEl = /* @__PURE__ */ new WeakMap();
|
|
1723
|
+
var paintedEls = /* @__PURE__ */ new Set();
|
|
1677
1724
|
var PAINT_GUARD_ATTRS = {
|
|
1678
1725
|
attributes: true,
|
|
1679
1726
|
attributeFilter: ["style", "class"]
|
|
@@ -1737,6 +1784,18 @@ function paintedTokensOf(el) {
|
|
|
1737
1784
|
}
|
|
1738
1785
|
function applyButtonStyle(el, assignment, tokens) {
|
|
1739
1786
|
const doc = el.ownerDocument;
|
|
1787
|
+
if (!prePaintByEl.has(el)) {
|
|
1788
|
+
const label = labelElement(el);
|
|
1789
|
+
const ownLabel = label && label !== el ? label : null;
|
|
1790
|
+
prePaintByEl.set(el, {
|
|
1791
|
+
style: el.getAttribute("style"),
|
|
1792
|
+
variant: el.getAttribute("data-ohw-btn-variant"),
|
|
1793
|
+
size: el.getAttribute("data-ohw-btn-size"),
|
|
1794
|
+
label: ownLabel,
|
|
1795
|
+
labelStyle: ownLabel?.getAttribute("style") ?? null
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
paintedEls.add(el);
|
|
1740
1799
|
const tracked = {
|
|
1741
1800
|
...tokens,
|
|
1742
1801
|
variants: {
|
|
@@ -1756,6 +1815,31 @@ function applyButtonStylesFromContent(doc, content) {
|
|
|
1756
1815
|
if (!el) continue;
|
|
1757
1816
|
applyButtonStyle(el, assignment, tokensFromButton(el));
|
|
1758
1817
|
}
|
|
1818
|
+
for (const el of paintedEls) {
|
|
1819
|
+
if (!el.isConnected) {
|
|
1820
|
+
paintedEls.delete(el);
|
|
1821
|
+
continue;
|
|
1822
|
+
}
|
|
1823
|
+
const id = buttonId(el);
|
|
1824
|
+
if (el.ownerDocument === doc && (!id || !assignments[id])) unpaintButton(el);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
function unpaintButton(el) {
|
|
1828
|
+
paintObserverByEl.get(el)?.disconnect();
|
|
1829
|
+
paintObserverByEl.delete(el);
|
|
1830
|
+
paintLockByEl.delete(el);
|
|
1831
|
+
paintedEls.delete(el);
|
|
1832
|
+
const before = prePaintByEl.get(el);
|
|
1833
|
+
prePaintByEl.delete(el);
|
|
1834
|
+
if (!before) return;
|
|
1835
|
+
const restore = (target, name, value) => {
|
|
1836
|
+
if (value === null) target.removeAttribute(name);
|
|
1837
|
+
else target.setAttribute(name, value);
|
|
1838
|
+
};
|
|
1839
|
+
restore(el, "style", before.style);
|
|
1840
|
+
restore(el, "data-ohw-btn-variant", before.variant);
|
|
1841
|
+
restore(el, "data-ohw-btn-size", before.size);
|
|
1842
|
+
if (before.label?.isConnected) restore(before.label, "style", before.labelStyle);
|
|
1759
1843
|
}
|
|
1760
1844
|
function withAssignment(content, id, assignment) {
|
|
1761
1845
|
return { ...readAssignments(content), [id]: assignment };
|
|
@@ -2306,6 +2390,7 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2306
2390
|
}
|
|
2307
2391
|
const snapshots = readSnapshots(content);
|
|
2308
2392
|
const collections = readCollections(content);
|
|
2393
|
+
dropUnsavedCopies(doc, snapshots, collections);
|
|
2309
2394
|
for (const collectionState of Object.values(collections)) {
|
|
2310
2395
|
const live = collectionState.members.map((id) => findButton(doc, id) ?? restoreSnapshot(doc, snapshots[id], content)).filter((el) => Boolean(el && !hidden.has(buttonId(el) ?? "")));
|
|
2311
2396
|
if (live.length === 0) continue;
|
|
@@ -2330,6 +2415,18 @@ function reconcileButtonCollections(doc, content) {
|
|
|
2330
2415
|
for (const member of live) setButtonDragAttr(member);
|
|
2331
2416
|
}
|
|
2332
2417
|
}
|
|
2418
|
+
function dropUnsavedCopies(doc, snapshots, collections) {
|
|
2419
|
+
const stale = Array.from(doc.querySelectorAll('[data-ohw-href-key*="-copy-"]')).filter((el) => {
|
|
2420
|
+
const id = buttonId(el);
|
|
2421
|
+
return Boolean(id && /-copy-\d+-href$/.test(id) && !snapshots[id]);
|
|
2422
|
+
});
|
|
2423
|
+
for (const el of stale) {
|
|
2424
|
+
const collection = buttonCollectionOf(el);
|
|
2425
|
+
el.remove();
|
|
2426
|
+
const id = collection?.getAttribute(COLLECTION_ATTR) ?? "";
|
|
2427
|
+
if (collection && !collections[id] && listCollectionMembers(collection).length <= 1) unwrapCollection(collection);
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2333
2430
|
function restoreSnapshot(doc, snapshot, content) {
|
|
2334
2431
|
if (!snapshot) return null;
|
|
2335
2432
|
const existing = findButton(doc, snapshot.id);
|
|
@@ -4864,6 +4961,9 @@ function reconcileNavbarItemsFromContent(content) {
|
|
|
4864
4961
|
}
|
|
4865
4962
|
}
|
|
4866
4963
|
pruneNavbarItemsNotInOrder(allowed);
|
|
4964
|
+
for (const node of orderForest) {
|
|
4965
|
+
if (node.children.length === 0) collapseEmptyNavDropdownForParent(node.id);
|
|
4966
|
+
}
|
|
4867
4967
|
applyNavForest(orderForest);
|
|
4868
4968
|
for (const parentKey of openParentKeys) {
|
|
4869
4969
|
const trigger = document.querySelector(
|
|
@@ -5233,6 +5333,118 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5233
5333
|
};
|
|
5234
5334
|
}
|
|
5235
5335
|
|
|
5336
|
+
// src/lib/hidden-editables.ts
|
|
5337
|
+
var HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
|
|
5338
|
+
var HIDDEN_ATTR = "data-ohw-editable-hidden";
|
|
5339
|
+
var FORM_SELECTOR = '[data-ohw-editable="form"]';
|
|
5340
|
+
function parseJson3(raw) {
|
|
5341
|
+
if (!raw) return null;
|
|
5342
|
+
try {
|
|
5343
|
+
return JSON.parse(raw);
|
|
5344
|
+
} catch {
|
|
5345
|
+
return null;
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
function readHiddenEditables(content) {
|
|
5349
|
+
const parsed = parseJson3(content?.[HIDDEN_EDITABLES_KEY]);
|
|
5350
|
+
if (!Array.isArray(parsed)) return [];
|
|
5351
|
+
return [...new Set(parsed.filter((key) => typeof key === "string" && key.length > 0))];
|
|
5352
|
+
}
|
|
5353
|
+
function isEditableKeyHidden(content, key) {
|
|
5354
|
+
if (!key) return false;
|
|
5355
|
+
return readHiddenEditables(content).includes(key);
|
|
5356
|
+
}
|
|
5357
|
+
function resolveSoftHideTarget(el) {
|
|
5358
|
+
const cta = el.closest(CTA_BUTTON_SELECTOR);
|
|
5359
|
+
if (cta) return cta;
|
|
5360
|
+
const form = el.closest(FORM_SELECTOR);
|
|
5361
|
+
if (form) return form;
|
|
5362
|
+
return el;
|
|
5363
|
+
}
|
|
5364
|
+
function canSoftHideEditable(el, opts) {
|
|
5365
|
+
if (!el) return false;
|
|
5366
|
+
const target = resolveSoftHideTarget(el);
|
|
5367
|
+
const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
|
|
5368
|
+
if (!key) return false;
|
|
5369
|
+
if (key.startsWith("ai.")) return false;
|
|
5370
|
+
if (key.startsWith("__ohw_")) return false;
|
|
5371
|
+
if (el.hasAttribute("data-ohw-section") || target.hasAttribute("data-ohw-section")) return false;
|
|
5372
|
+
if (el.closest("[data-ohw-social-item]")) return false;
|
|
5373
|
+
if (target.matches(FORM_SELECTOR) || el.dataset.ohwEditable === "form") return true;
|
|
5374
|
+
const cta = el.closest(CTA_BUTTON_SELECTOR);
|
|
5375
|
+
if (cta) return !isLastNavbarButton(cta);
|
|
5376
|
+
if (opts?.isNavFooterItem) return false;
|
|
5377
|
+
if (el.closest("[data-ohw-nav-container], [data-ohw-nav-drawer], [data-ohw-nav-root], nav")) {
|
|
5378
|
+
if (el.closest("[data-ohw-href-key], [data-ohw-nav-item], [data-ohw-nav-group]")) return false;
|
|
5379
|
+
}
|
|
5380
|
+
if (el.closest("footer, [data-ai-footer]")) {
|
|
5381
|
+
if (el.closest("[data-ohw-href-key], [data-ohw-footer-item], [data-ohw-social-item]")) return false;
|
|
5382
|
+
}
|
|
5383
|
+
const kind = el.dataset.ohwEditable;
|
|
5384
|
+
return kind === "text" || kind === "plain" || kind === "image" || kind === "bg-image" || kind === "video" || kind === "icon" || kind === "link" || kind === "map";
|
|
5385
|
+
}
|
|
5386
|
+
function withHiddenEditable(content, key) {
|
|
5387
|
+
const hidden = readHiddenEditables(content);
|
|
5388
|
+
if (hidden.includes(key)) {
|
|
5389
|
+
return {
|
|
5390
|
+
content,
|
|
5391
|
+
nodes: [{ key: HIDDEN_EDITABLES_KEY, text: content[HIDDEN_EDITABLES_KEY] ?? "[]" }],
|
|
5392
|
+
added: false
|
|
5393
|
+
};
|
|
5394
|
+
}
|
|
5395
|
+
const nextHidden = [...hidden, key];
|
|
5396
|
+
const text = JSON.stringify(nextHidden);
|
|
5397
|
+
return {
|
|
5398
|
+
content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
|
|
5399
|
+
nodes: [{ key: HIDDEN_EDITABLES_KEY, text }],
|
|
5400
|
+
added: true
|
|
5401
|
+
};
|
|
5402
|
+
}
|
|
5403
|
+
function withoutHiddenEditable(content, key) {
|
|
5404
|
+
const nextHidden = readHiddenEditables(content).filter((entry) => entry !== key);
|
|
5405
|
+
const text = JSON.stringify(nextHidden);
|
|
5406
|
+
return {
|
|
5407
|
+
content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
|
|
5408
|
+
nodes: [{ key: HIDDEN_EDITABLES_KEY, text }]
|
|
5409
|
+
};
|
|
5410
|
+
}
|
|
5411
|
+
function escapeAttrValue(value) {
|
|
5412
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
5413
|
+
}
|
|
5414
|
+
function markHidden(el) {
|
|
5415
|
+
softHide(el);
|
|
5416
|
+
el.setAttribute(HIDDEN_ATTR, "");
|
|
5417
|
+
}
|
|
5418
|
+
function markVisible(el) {
|
|
5419
|
+
softUnhide(el);
|
|
5420
|
+
el.removeAttribute(HIDDEN_ATTR);
|
|
5421
|
+
}
|
|
5422
|
+
function applyHiddenEditablesToDom(content, root = document) {
|
|
5423
|
+
const hidden = readHiddenEditables(content);
|
|
5424
|
+
root.querySelectorAll(`[${HIDDEN_ATTR}]`).forEach((el) => markVisible(el));
|
|
5425
|
+
for (const key of hidden) {
|
|
5426
|
+
root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
|
|
5427
|
+
markHidden(resolveSoftHideTarget(el));
|
|
5428
|
+
});
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
function softHideEditableInDom(el, content) {
|
|
5432
|
+
if (!canSoftHideEditable(el)) return null;
|
|
5433
|
+
const target = resolveSoftHideTarget(el);
|
|
5434
|
+
const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
|
|
5435
|
+
if (!key) return null;
|
|
5436
|
+
const next = withHiddenEditable(content, key);
|
|
5437
|
+
markHidden(target);
|
|
5438
|
+
return { content: next.content, nodes: next.nodes, key, target };
|
|
5439
|
+
}
|
|
5440
|
+
function softUnhideEditableInDom(key, content, root = document) {
|
|
5441
|
+
const next = withoutHiddenEditable(content, key);
|
|
5442
|
+
root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
|
|
5443
|
+
markVisible(resolveSoftHideTarget(el));
|
|
5444
|
+
});
|
|
5445
|
+
return next;
|
|
5446
|
+
}
|
|
5447
|
+
|
|
5236
5448
|
// src/lib/collect-editable-nodes.ts
|
|
5237
5449
|
var VIDEO_AUTOPLAY_SUFFIX = "__ohw_autoplay";
|
|
5238
5450
|
var VIDEO_MUTED_SUFFIX = "__ohw_muted";
|
|
@@ -5311,7 +5523,9 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
5311
5523
|
BUTTON_ASSIGNMENTS_KEY,
|
|
5312
5524
|
BUTTON_COLLECTIONS_KEY,
|
|
5313
5525
|
BUTTON_SNAPSHOTS_KEY,
|
|
5314
|
-
BUTTON_HIDDEN_KEY
|
|
5526
|
+
BUTTON_HIDDEN_KEY,
|
|
5527
|
+
// Soft-hidden template slots (non-AI Delete) — no DOM marker when hidden.
|
|
5528
|
+
HIDDEN_EDITABLES_KEY
|
|
5315
5529
|
]) {
|
|
5316
5530
|
const text = extraContent[key];
|
|
5317
5531
|
if (typeof text === "string" && text.length > 0) {
|
|
@@ -5783,10 +5997,10 @@ function rekeyItemClone(clone, source, sibling, group, newIndex) {
|
|
|
5783
5997
|
function setRemoved(el, removed) {
|
|
5784
5998
|
if (removed) {
|
|
5785
5999
|
el.setAttribute(ITEM_REMOVED_ATTR, "");
|
|
5786
|
-
el
|
|
6000
|
+
softHide(el);
|
|
5787
6001
|
} else if (el.hasAttribute(ITEM_REMOVED_ATTR)) {
|
|
5788
6002
|
el.removeAttribute(ITEM_REMOVED_ATTR);
|
|
5789
|
-
el
|
|
6003
|
+
softUnhide(el);
|
|
5790
6004
|
}
|
|
5791
6005
|
}
|
|
5792
6006
|
function seedState(group) {
|
|
@@ -6796,6 +7010,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6796
7010
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6797
7011
|
return target ? pricingFeatureList(target).length : 0;
|
|
6798
7012
|
}
|
|
7013
|
+
function prevailingFeatureIcon(features) {
|
|
7014
|
+
const counts = /* @__PURE__ */ new Map();
|
|
7015
|
+
for (const row of features) {
|
|
7016
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
7017
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
7018
|
+
entry.count += 1;
|
|
7019
|
+
counts.set(key, entry);
|
|
7020
|
+
}
|
|
7021
|
+
let best = null;
|
|
7022
|
+
for (const entry of counts.values()) {
|
|
7023
|
+
if (!best || entry.count > best.count) best = entry;
|
|
7024
|
+
}
|
|
7025
|
+
if (!best) return {};
|
|
7026
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
7027
|
+
}
|
|
6799
7028
|
function addPricingCardFeature(tree, index, text) {
|
|
6800
7029
|
return withPricingCollection(tree, (collection) => {
|
|
6801
7030
|
const children = collection.children;
|
|
@@ -6804,7 +7033,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6804
7033
|
const features = pricingFeatureList(target);
|
|
6805
7034
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6806
7035
|
target.slots = target.slots ?? {};
|
|
6807
|
-
target.slots.features = [...features, { text }];
|
|
7036
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6808
7037
|
return true;
|
|
6809
7038
|
});
|
|
6810
7039
|
}
|
|
@@ -6871,6 +7100,127 @@ function rewriteIconSlot(tree, path, ref) {
|
|
|
6871
7100
|
return next;
|
|
6872
7101
|
}
|
|
6873
7102
|
|
|
7103
|
+
// src/lib/ai-remove-block.ts
|
|
7104
|
+
function blockPathFromEditKey(sectionId, key) {
|
|
7105
|
+
const prefix = aiSlotKeyPrefixFor(sectionId);
|
|
7106
|
+
if (!key.startsWith(prefix)) return void 0;
|
|
7107
|
+
const path = [];
|
|
7108
|
+
for (const part of key.slice(prefix.length).split(".")) {
|
|
7109
|
+
if (/^[rbc]\d+$/.test(part)) path.push(part);
|
|
7110
|
+
else break;
|
|
7111
|
+
}
|
|
7112
|
+
if (path.length < 2 || !/^r\d+$/.test(path[0]) || !/^b\d+$/.test(path[1])) return void 0;
|
|
7113
|
+
return path.join(".");
|
|
7114
|
+
}
|
|
7115
|
+
function parseBlockPath(path) {
|
|
7116
|
+
const segs = [];
|
|
7117
|
+
for (const part of path.split(".")) {
|
|
7118
|
+
const match = part.match(/^([rbc])(\d+)$/);
|
|
7119
|
+
if (!match) return void 0;
|
|
7120
|
+
segs.push({ kind: match[1], index: Number(match[2]) });
|
|
7121
|
+
}
|
|
7122
|
+
if (segs.length < 2 || segs[0].kind !== "r" || segs[1].kind !== "b") return void 0;
|
|
7123
|
+
return segs;
|
|
7124
|
+
}
|
|
7125
|
+
function cloneTree(tree) {
|
|
7126
|
+
return JSON.parse(JSON.stringify(tree));
|
|
7127
|
+
}
|
|
7128
|
+
function nodeAtPath2(tree, segs) {
|
|
7129
|
+
let node = tree.rows?.[segs[0].index]?.blocks?.[segs[1].index];
|
|
7130
|
+
for (let i = 2; i < segs.length; i += 1) {
|
|
7131
|
+
if (segs[i].kind !== "c") return null;
|
|
7132
|
+
node = node?.children?.[segs[i].index];
|
|
7133
|
+
}
|
|
7134
|
+
return node ?? null;
|
|
7135
|
+
}
|
|
7136
|
+
function unwrapPromoted(node) {
|
|
7137
|
+
if (node.promoted === true && node.slots?.layout === "stack" && (node.children?.length ?? 0) === 1) {
|
|
7138
|
+
const only = { ...node.children[0] };
|
|
7139
|
+
if (node.slot) only.slot = node.slot;
|
|
7140
|
+
only.span = node.span;
|
|
7141
|
+
return only;
|
|
7142
|
+
}
|
|
7143
|
+
return node;
|
|
7144
|
+
}
|
|
7145
|
+
function removeBlockAtPath(tree, path) {
|
|
7146
|
+
const segs = parseBlockPath(path);
|
|
7147
|
+
if (!segs) return { ok: false, reasons: [`invalid block path "${path}"`] };
|
|
7148
|
+
const next = cloneTree(tree);
|
|
7149
|
+
const rowIndex = segs[0].index;
|
|
7150
|
+
const row = next.rows[rowIndex];
|
|
7151
|
+
if (!row) return { ok: false, reasons: [`row ${rowIndex} not found`] };
|
|
7152
|
+
if (segs.length === 2) {
|
|
7153
|
+
const blockIndex = segs[1].index;
|
|
7154
|
+
if (!row.blocks[blockIndex]) return { ok: false, reasons: [`block ${path} not found`] };
|
|
7155
|
+
row.blocks.splice(blockIndex, 1);
|
|
7156
|
+
if (row.blocks.length === 0) {
|
|
7157
|
+
next.rows.splice(rowIndex, 1);
|
|
7158
|
+
} else if (row.blocks.length === 1) {
|
|
7159
|
+
row.blocks[0] = { ...row.blocks[0], span: 12 };
|
|
7160
|
+
delete row.blocks[0].slot;
|
|
7161
|
+
}
|
|
7162
|
+
} else {
|
|
7163
|
+
let parent = row.blocks[segs[1].index];
|
|
7164
|
+
for (let i = 2; i < segs.length - 1; i += 1) {
|
|
7165
|
+
if (!parent?.children || segs[i].kind !== "c") {
|
|
7166
|
+
return { ok: false, reasons: [`block ${path} not found`] };
|
|
7167
|
+
}
|
|
7168
|
+
parent = parent.children[segs[i].index];
|
|
7169
|
+
}
|
|
7170
|
+
const childIndex = segs[segs.length - 1].index;
|
|
7171
|
+
if (!parent?.children || segs[segs.length - 1].kind !== "c" || !parent.children[childIndex]) {
|
|
7172
|
+
return { ok: false, reasons: [`block ${path} not found`] };
|
|
7173
|
+
}
|
|
7174
|
+
parent.children.splice(childIndex, 1);
|
|
7175
|
+
if (segs.length === 3) {
|
|
7176
|
+
row.blocks[segs[1].index] = unwrapPromoted(parent);
|
|
7177
|
+
if (row.blocks[segs[1].index].type === "group" && (row.blocks[segs[1].index].children?.length ?? 0) === 0) {
|
|
7178
|
+
row.blocks.splice(segs[1].index, 1);
|
|
7179
|
+
if (row.blocks.length === 0) next.rows.splice(rowIndex, 1);
|
|
7180
|
+
}
|
|
7181
|
+
if (next.rows[rowIndex]?.blocks.length === 1) {
|
|
7182
|
+
next.rows[rowIndex].blocks[0] = { ...next.rows[rowIndex].blocks[0], span: 12 };
|
|
7183
|
+
delete next.rows[rowIndex].blocks[0].slot;
|
|
7184
|
+
}
|
|
7185
|
+
} else {
|
|
7186
|
+
const grand = row.blocks[segs[1].index];
|
|
7187
|
+
let cursor = grand;
|
|
7188
|
+
for (let i = 2; i < segs.length - 2; i += 1) {
|
|
7189
|
+
cursor = cursor?.children?.[segs[i].index];
|
|
7190
|
+
}
|
|
7191
|
+
const containerIndex = segs[segs.length - 2].index;
|
|
7192
|
+
if (cursor?.children?.[containerIndex]) {
|
|
7193
|
+
cursor.children[containerIndex] = unwrapPromoted(parent);
|
|
7194
|
+
}
|
|
7195
|
+
}
|
|
7196
|
+
}
|
|
7197
|
+
if (next.rows.length === 0) {
|
|
7198
|
+
return { ok: false, reasons: ["a section must keep at least one block"] };
|
|
7199
|
+
}
|
|
7200
|
+
return { ok: true, tree: next };
|
|
7201
|
+
}
|
|
7202
|
+
function planAiBlockRemoval(aiSectionsRaw, editKey) {
|
|
7203
|
+
if (!editKey || !editKey.startsWith("ai.")) return null;
|
|
7204
|
+
const state = parseAiSectionsState(aiSectionsRaw);
|
|
7205
|
+
const entry = state.sections.find((s) => editKey.startsWith(aiSlotKeyPrefixFor(s.id)));
|
|
7206
|
+
if (!entry) return null;
|
|
7207
|
+
const path = blockPathFromEditKey(entry.id, editKey);
|
|
7208
|
+
if (!path) return null;
|
|
7209
|
+
const segs = parseBlockPath(path);
|
|
7210
|
+
if (!segs) return null;
|
|
7211
|
+
const node = nodeAtPath2(entry.tree, segs);
|
|
7212
|
+
if (!node) return null;
|
|
7213
|
+
const removed = removeBlockAtPath(entry.tree, path);
|
|
7214
|
+
if (!removed.ok) return removed;
|
|
7215
|
+
return { ok: true, tree: removed.tree, path, entry };
|
|
7216
|
+
}
|
|
7217
|
+
var planAiTextBlockRemoval = planAiBlockRemoval;
|
|
7218
|
+
function canRemoveAiBlock(aiSectionsRaw, editKey) {
|
|
7219
|
+
const plan = planAiBlockRemoval(aiSectionsRaw, editKey);
|
|
7220
|
+
return plan?.ok === true;
|
|
7221
|
+
}
|
|
7222
|
+
var canRemoveAiTextBlock = canRemoveAiBlock;
|
|
7223
|
+
|
|
6874
7224
|
// src/lib/ai-footer-tree.ts
|
|
6875
7225
|
var FOOTER_COLUMN_SPANS = [12, 6, 4, 3];
|
|
6876
7226
|
var FOOTER_COLUMN_BLOCKS = [
|
|
@@ -7448,6 +7798,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7448
7798
|
);
|
|
7449
7799
|
}
|
|
7450
7800
|
|
|
7801
|
+
// src/lib/youtube.ts
|
|
7802
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7803
|
+
function extractYouTubeId(input) {
|
|
7804
|
+
const trimmed = input.trim();
|
|
7805
|
+
if (!trimmed) return null;
|
|
7806
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7807
|
+
let url;
|
|
7808
|
+
try {
|
|
7809
|
+
url = new URL(trimmed);
|
|
7810
|
+
} catch {
|
|
7811
|
+
return null;
|
|
7812
|
+
}
|
|
7813
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7814
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7815
|
+
return null;
|
|
7816
|
+
}
|
|
7817
|
+
let candidate = null;
|
|
7818
|
+
if (host === "youtu.be") {
|
|
7819
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7820
|
+
} else if (url.pathname === "/watch") {
|
|
7821
|
+
candidate = url.searchParams.get("v");
|
|
7822
|
+
} else {
|
|
7823
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7824
|
+
candidate = match ? match[1] : null;
|
|
7825
|
+
}
|
|
7826
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7827
|
+
}
|
|
7828
|
+
|
|
7829
|
+
// src/lib/section-embed.ts
|
|
7830
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7831
|
+
function readStoredEmbed(value) {
|
|
7832
|
+
if (value.startsWith("start\n")) {
|
|
7833
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7834
|
+
}
|
|
7835
|
+
return { raw: value, at: "end" };
|
|
7836
|
+
}
|
|
7837
|
+
function embedFrameSrc(value) {
|
|
7838
|
+
const videoId = extractYouTubeId(value);
|
|
7839
|
+
if (videoId) {
|
|
7840
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7841
|
+
}
|
|
7842
|
+
let url;
|
|
7843
|
+
try {
|
|
7844
|
+
url = new URL(value);
|
|
7845
|
+
} catch {
|
|
7846
|
+
return null;
|
|
7847
|
+
}
|
|
7848
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7849
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7850
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7851
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7852
|
+
return { src, title: "Map" };
|
|
7853
|
+
}
|
|
7854
|
+
if (host === "maps.app.goo.gl") {
|
|
7855
|
+
return { src: value, title: "Map" };
|
|
7856
|
+
}
|
|
7857
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7858
|
+
return { src: value, title: "Calendar" };
|
|
7859
|
+
}
|
|
7860
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7861
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7862
|
+
}
|
|
7863
|
+
if (host === "forms.gle") {
|
|
7864
|
+
return { src: value, title: "Form" };
|
|
7865
|
+
}
|
|
7866
|
+
return null;
|
|
7867
|
+
}
|
|
7868
|
+
function place(section, box, at) {
|
|
7869
|
+
if (at === "start") {
|
|
7870
|
+
section.insertBefore(box, section.firstChild);
|
|
7871
|
+
return;
|
|
7872
|
+
}
|
|
7873
|
+
section.appendChild(box);
|
|
7874
|
+
}
|
|
7875
|
+
function paint(section, key, src, title, at) {
|
|
7876
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7877
|
+
const frame = existing?.querySelector("iframe");
|
|
7878
|
+
if (existing && frame) {
|
|
7879
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7880
|
+
frame.title = title;
|
|
7881
|
+
place(section, existing, at);
|
|
7882
|
+
return;
|
|
7883
|
+
}
|
|
7884
|
+
existing?.remove();
|
|
7885
|
+
const box = document.createElement("div");
|
|
7886
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7887
|
+
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;";
|
|
7888
|
+
const frameWrap = document.createElement("div");
|
|
7889
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7890
|
+
const iframe = document.createElement("iframe");
|
|
7891
|
+
iframe.src = src;
|
|
7892
|
+
iframe.title = title;
|
|
7893
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7894
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7895
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7896
|
+
frameWrap.appendChild(iframe);
|
|
7897
|
+
box.appendChild(frameWrap);
|
|
7898
|
+
place(section, box, at);
|
|
7899
|
+
}
|
|
7900
|
+
function applySectionEmbeds(content) {
|
|
7901
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7902
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7903
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7904
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7905
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7906
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7907
|
+
if (!section || !stored || !frame) {
|
|
7908
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7909
|
+
continue;
|
|
7910
|
+
}
|
|
7911
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7912
|
+
}
|
|
7913
|
+
}
|
|
7914
|
+
|
|
7451
7915
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7452
7916
|
var import_react_dom = require("react-dom");
|
|
7453
7917
|
var import_client = require("react-dom/client");
|
|
@@ -7970,12 +8434,19 @@ function footerBodyStyle(fallbackFont, color, weight = 500) {
|
|
|
7970
8434
|
}
|
|
7971
8435
|
var str = (value) => typeof value === "string" ? value : "";
|
|
7972
8436
|
var cardRadius = (slots) => slots.cornerStyle === "sharp" ? 0 : AI_TREE_TOKENS.radiusCard;
|
|
7973
|
-
var
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
8437
|
+
var HUG_ALIGN_TYPES = /* @__PURE__ */ new Set(["button", "button-row", "rating"]);
|
|
8438
|
+
var blockAlignStyle = (blockAlign, blockType) => {
|
|
8439
|
+
if (!blockAlign) return {};
|
|
8440
|
+
if (blockType && HUG_ALIGN_TYPES.has(blockType)) {
|
|
8441
|
+
return {
|
|
8442
|
+
display: "flex",
|
|
8443
|
+
flexDirection: "column",
|
|
8444
|
+
alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
|
|
8445
|
+
textAlign: blockAlign
|
|
8446
|
+
};
|
|
8447
|
+
}
|
|
8448
|
+
return { width: "100%", textAlign: blockAlign, boxSizing: "border-box" };
|
|
8449
|
+
};
|
|
7979
8450
|
var fullBleedBlock = (block) => block.type === "carousel" || block.type === "group" && str(block.slots?.layout) === "overlap";
|
|
7980
8451
|
var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.trim()).filter(Boolean);
|
|
7981
8452
|
var AI_MOBILE_CSS = [
|
|
@@ -8021,7 +8492,7 @@ var AI_MOBILE_CSS = [
|
|
|
8021
8492
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
8022
8493
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
8023
8494
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
8024
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8495
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
8025
8496
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
8026
8497
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
8027
8498
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8037,8 +8508,10 @@ var AI_MOBILE_CSS = [
|
|
|
8037
8508
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8038
8509
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8039
8510
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
8040
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
8041
|
-
|
|
8511
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8512
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8513
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8514
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
8042
8515
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8043
8516
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8044
8517
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8243,6 +8716,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8243
8716
|
function textAttrs(ctx, path) {
|
|
8244
8717
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8245
8718
|
}
|
|
8719
|
+
var AI_RESPONSIVE_CSS = [
|
|
8720
|
+
"@media (max-width: 960px) {",
|
|
8721
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8722
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8723
|
+
"}",
|
|
8724
|
+
"@media (max-width: 640px) {",
|
|
8725
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8726
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8727
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8728
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8729
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8730
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8731
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8732
|
+
// layered text used to be.
|
|
8733
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8734
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8735
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8736
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8737
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8738
|
+
// other rule had already been taught to stand down.
|
|
8739
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8740
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8741
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8742
|
+
"}"
|
|
8743
|
+
].join("\n");
|
|
8246
8744
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8247
8745
|
function MediaBox({
|
|
8248
8746
|
refValue,
|
|
@@ -8297,7 +8795,7 @@ function MediaBox({
|
|
|
8297
8795
|
position: fill ? "absolute" : void 0,
|
|
8298
8796
|
inset: fill ? 0 : void 0,
|
|
8299
8797
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8300
|
-
height: fill ? "100%" : void 0,
|
|
8798
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8301
8799
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8302
8800
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8303
8801
|
borderRadius: radius,
|
|
@@ -8498,7 +8996,13 @@ function TextBlock({
|
|
|
8498
8996
|
"div",
|
|
8499
8997
|
{
|
|
8500
8998
|
...textAttrs(ctx, `${path}.content`),
|
|
8501
|
-
style: {
|
|
8999
|
+
style: {
|
|
9000
|
+
...typeStyle(spec, font),
|
|
9001
|
+
color: ctx.brand.palette.dark,
|
|
9002
|
+
textAlign: align,
|
|
9003
|
+
width: "100%",
|
|
9004
|
+
boxSizing: "border-box"
|
|
9005
|
+
},
|
|
8502
9006
|
dangerouslySetInnerHTML: { __html: str(slots.content) }
|
|
8503
9007
|
}
|
|
8504
9008
|
);
|
|
@@ -8509,7 +9013,7 @@ function SectionHeaderBlock({ node, ctx, path }) {
|
|
|
8509
9013
|
const children = node.children ?? [];
|
|
8510
9014
|
const buttonRowIdx = children.findIndex((c) => c.type === "button-row");
|
|
8511
9015
|
const buttonRow = buttonRowIdx >= 0 ? children[buttonRowIdx] : void 0;
|
|
8512
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align }, children: [
|
|
9016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align, width: "100%", boxSizing: "border-box" }, children: [
|
|
8513
9017
|
str(slots.tagline) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
8514
9018
|
"div",
|
|
8515
9019
|
{
|
|
@@ -9793,7 +10297,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9793
10297
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9794
10298
|
"div",
|
|
9795
10299
|
{
|
|
9796
|
-
"data-ai-grid":
|
|
10300
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9797
10301
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9798
10302
|
style: {
|
|
9799
10303
|
display: "grid",
|
|
@@ -10095,7 +10599,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10095
10599
|
},
|
|
10096
10600
|
children: [
|
|
10097
10601
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10098
|
-
// The section's `data-ai-
|
|
10602
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
10099
10603
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10100
10604
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10101
10605
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10128,10 +10632,10 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10128
10632
|
gridColumn: `span ${typeof child.span === "number" ? Math.min(12, Math.max(1, child.span)) : 12}`,
|
|
10129
10633
|
minWidth: 0
|
|
10130
10634
|
} : { minWidth: 0 },
|
|
10131
|
-
//
|
|
10132
|
-
//
|
|
10133
|
-
//
|
|
10134
|
-
...blockAlignStyle(child.align ?? ambientAlign)
|
|
10635
|
+
// Same ambient as renderNode below: child's own align, else the group's, else the
|
|
10636
|
+
// inherited ambient (overlap overlay / section). Copy fills the column; button-row
|
|
10637
|
+
// etc. still hug via flex alignItems.
|
|
10638
|
+
...blockAlignStyle(child.align ?? node.align ?? ambientAlign, child.type)
|
|
10135
10639
|
},
|
|
10136
10640
|
children: renderNode(child, ctx, `${path}.c${i}`, node.align ?? ambientAlign)
|
|
10137
10641
|
},
|
|
@@ -10500,12 +11004,7 @@ function AiTreeRenderer({
|
|
|
10500
11004
|
if (fillHeight) return "stretch";
|
|
10501
11005
|
return (distributed ?? settings.verticalPosition) === "top" ? "start" : "center";
|
|
10502
11006
|
};
|
|
10503
|
-
const cellAlignStyle = (blockAlign) => blockAlign
|
|
10504
|
-
display: "flex",
|
|
10505
|
-
flexDirection: "column",
|
|
10506
|
-
alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
|
|
10507
|
-
textAlign: blockAlign
|
|
10508
|
-
} : {};
|
|
11007
|
+
const cellAlignStyle = (blockAlign, blockType) => blockAlignStyle(blockAlign, blockType);
|
|
10509
11008
|
const needsOverlayClearance = fillHeight && pad === 0;
|
|
10510
11009
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
10511
11010
|
"section",
|
|
@@ -10514,6 +11013,7 @@ function AiTreeRenderer({
|
|
|
10514
11013
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10515
11014
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10516
11015
|
...bgAttrs,
|
|
11016
|
+
"data-ai-responsive": "",
|
|
10517
11017
|
style: {
|
|
10518
11018
|
position: "relative",
|
|
10519
11019
|
padding: `${padCss} 0`,
|
|
@@ -10527,12 +11027,13 @@ function AiTreeRenderer({
|
|
|
10527
11027
|
...fillHeight ? { display: "grid" } : {}
|
|
10528
11028
|
},
|
|
10529
11029
|
children: [
|
|
10530
|
-
|
|
11030
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10531
11031
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
11032
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10532
11033
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10533
11034
|
"div",
|
|
10534
11035
|
{
|
|
10535
|
-
"data-ai-
|
|
11036
|
+
"data-ai-section-inner": "",
|
|
10536
11037
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10537
11038
|
style: {
|
|
10538
11039
|
position: "relative",
|
|
@@ -10549,7 +11050,7 @@ function AiTreeRenderer({
|
|
|
10549
11050
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10550
11051
|
"div",
|
|
10551
11052
|
{
|
|
10552
|
-
"data-ai-
|
|
11053
|
+
"data-ai-columns": "",
|
|
10553
11054
|
style: {
|
|
10554
11055
|
display: "grid",
|
|
10555
11056
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -10565,11 +11066,11 @@ function AiTreeRenderer({
|
|
|
10565
11066
|
gridColumn: `span ${Math.min(12, Math.max(1, block.span))}`,
|
|
10566
11067
|
minWidth: 0,
|
|
10567
11068
|
// Cascades the section's min-height stretch (see `fillHeight` above) down to
|
|
10568
|
-
// this cell; `cellAlignStyle` below overrides
|
|
10569
|
-
//
|
|
11069
|
+
// this cell; `cellAlignStyle` below overrides when the block also has its own
|
|
11070
|
+
// horizontal `align` (flex hug for buttons; width 100% for text).
|
|
10570
11071
|
...fillHeight ? { display: "grid" } : {},
|
|
10571
11072
|
// Horizontal placement of the block's content within its column.
|
|
10572
|
-
...fullBleedBlock(block) ? {} : cellAlignStyle(block.align),
|
|
11073
|
+
...fullBleedBlock(block) ? {} : cellAlignStyle(block.align, block.type),
|
|
10573
11074
|
// space-between: each column becomes a flex column whose content spreads over
|
|
10574
11075
|
// the full row height instead of clumping at the top.
|
|
10575
11076
|
...distributed === "space-between" ? { display: "flex", flexDirection: "column", justifyContent: "space-between" } : {}
|
|
@@ -11211,9 +11712,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11211
11712
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11212
11713
|
continue;
|
|
11213
11714
|
}
|
|
11214
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11215
11715
|
let container = existing?.container;
|
|
11716
|
+
let isNewMount = false;
|
|
11216
11717
|
if (!container || !container.isConnected) {
|
|
11718
|
+
isNewMount = true;
|
|
11217
11719
|
existing?.root.unmount();
|
|
11218
11720
|
container?.remove();
|
|
11219
11721
|
container = document.createElement("div");
|
|
@@ -11293,7 +11795,7 @@ var import_client2 = require("react-dom/client");
|
|
|
11293
11795
|
var import_react_dom2 = require("react-dom");
|
|
11294
11796
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
11295
11797
|
var CONTAINER_ATTR2 = "data-ohw-ai-footer";
|
|
11296
|
-
var
|
|
11798
|
+
var HIDDEN_ATTR2 = "data-ohw-ai-footer-replaced";
|
|
11297
11799
|
var mounted2 = null;
|
|
11298
11800
|
var mountOptions = {};
|
|
11299
11801
|
var capturedSurface;
|
|
@@ -11323,12 +11825,12 @@ function findTemplateFooter() {
|
|
|
11323
11825
|
function hideTemplateFooter(footer) {
|
|
11324
11826
|
if (!footer) return;
|
|
11325
11827
|
footer.style.display = "none";
|
|
11326
|
-
footer.setAttribute(
|
|
11828
|
+
footer.setAttribute(HIDDEN_ATTR2, "");
|
|
11327
11829
|
}
|
|
11328
11830
|
function showTemplateFooter() {
|
|
11329
|
-
for (const el of document.querySelectorAll(`[${
|
|
11831
|
+
for (const el of document.querySelectorAll(`[${HIDDEN_ATTR2}]`)) {
|
|
11330
11832
|
el.style.removeProperty("display");
|
|
11331
|
-
el.removeAttribute(
|
|
11833
|
+
el.removeAttribute(HIDDEN_ATTR2);
|
|
11332
11834
|
}
|
|
11333
11835
|
}
|
|
11334
11836
|
function unmountAiFooter() {
|
|
@@ -11523,7 +12025,7 @@ function pickFooterColumnIndex(columnBlockCounts) {
|
|
|
11523
12025
|
}
|
|
11524
12026
|
|
|
11525
12027
|
// src/lib/ai-footer-edits.ts
|
|
11526
|
-
function
|
|
12028
|
+
function cloneTree2(tree) {
|
|
11527
12029
|
return JSON.parse(JSON.stringify(tree));
|
|
11528
12030
|
}
|
|
11529
12031
|
function rebalanceFooterColumnSpans(columns) {
|
|
@@ -11551,6 +12053,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11551
12053
|
return 3;
|
|
11552
12054
|
}
|
|
11553
12055
|
}
|
|
12056
|
+
function readLiveSocialItems() {
|
|
12057
|
+
const root = getFooterRoot();
|
|
12058
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
12059
|
+
if (!row) return [];
|
|
12060
|
+
const items = [];
|
|
12061
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
12062
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
12063
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
12064
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
12065
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
12066
|
+
items.push({ platform, href });
|
|
12067
|
+
}
|
|
12068
|
+
return items;
|
|
12069
|
+
}
|
|
12070
|
+
function syncSocialRowsFromDom(tree) {
|
|
12071
|
+
const root = getFooterRoot();
|
|
12072
|
+
if (!root) return;
|
|
12073
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
12074
|
+
const live = readLiveSocialItems();
|
|
12075
|
+
if (row && live.length === 0) return;
|
|
12076
|
+
for (const col of tree.columns) {
|
|
12077
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
12078
|
+
if (block.type !== "social-row") return [block];
|
|
12079
|
+
if (!row) return [];
|
|
12080
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
12081
|
+
});
|
|
12082
|
+
}
|
|
12083
|
+
}
|
|
11554
12084
|
function collectBrandBlocks(tree) {
|
|
11555
12085
|
const brand = [];
|
|
11556
12086
|
for (const col of tree.columns) {
|
|
@@ -11573,7 +12103,7 @@ function countFooterLinkLists(tree) {
|
|
|
11573
12103
|
return collectLinkListBlocks(tree).length;
|
|
11574
12104
|
}
|
|
11575
12105
|
function packFooterTreeBrand(tree) {
|
|
11576
|
-
const next =
|
|
12106
|
+
const next = cloneTree2(tree);
|
|
11577
12107
|
const brand = collectBrandBlocks(next);
|
|
11578
12108
|
const lists = collectLinkListBlocks(next);
|
|
11579
12109
|
if (lists.length === 0) {
|
|
@@ -11658,7 +12188,7 @@ function ensureFooterTree(tree, opts) {
|
|
|
11658
12188
|
return tree ?? buildDefaultFooterTree(opts);
|
|
11659
12189
|
}
|
|
11660
12190
|
function appendFooterSocial(tree, entry) {
|
|
11661
|
-
const next =
|
|
12191
|
+
const next = cloneTree2(tree);
|
|
11662
12192
|
const platform = entry.platform.trim().toLowerCase();
|
|
11663
12193
|
const href = entry.href.trim();
|
|
11664
12194
|
for (const col2 of next.columns) {
|
|
@@ -11687,7 +12217,7 @@ function appendFooterSocial(tree, entry) {
|
|
|
11687
12217
|
return next;
|
|
11688
12218
|
}
|
|
11689
12219
|
function insertFooterHours(tree, hours, title = "Hours") {
|
|
11690
|
-
const next =
|
|
12220
|
+
const next = cloneTree2(tree);
|
|
11691
12221
|
const idx = pickFooterColumnIndex(next.columns.map((c) => c.blocks.length));
|
|
11692
12222
|
const col = next.columns[idx] ?? next.columns[0];
|
|
11693
12223
|
if (!col) return next;
|
|
@@ -11714,7 +12244,7 @@ function addFooterLinkColumn(tree, column) {
|
|
|
11714
12244
|
return next;
|
|
11715
12245
|
}
|
|
11716
12246
|
function removeFooterBlock(tree, predicate) {
|
|
11717
|
-
const next =
|
|
12247
|
+
const next = cloneTree2(tree);
|
|
11718
12248
|
for (let c = 0; c < next.columns.length; c++) {
|
|
11719
12249
|
const col = next.columns[c];
|
|
11720
12250
|
if (!col) continue;
|
|
@@ -11750,7 +12280,7 @@ function foldAiFooterSlotOverride(tree, key, value) {
|
|
|
11750
12280
|
const path = key.slice(prefix.length);
|
|
11751
12281
|
const brandMatch = path.match(/^brand\.b(\d+)\.(.+)$/);
|
|
11752
12282
|
if (!brandMatch) return null;
|
|
11753
|
-
const next =
|
|
12283
|
+
const next = cloneTree2(tree);
|
|
11754
12284
|
const brands = [];
|
|
11755
12285
|
for (const col of next.columns) {
|
|
11756
12286
|
for (const block2 of col.blocks) {
|
|
@@ -11795,7 +12325,8 @@ function textOf2(el) {
|
|
|
11795
12325
|
return (el?.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
11796
12326
|
}
|
|
11797
12327
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11798
|
-
const next =
|
|
12328
|
+
const next = cloneTree2(tree);
|
|
12329
|
+
syncSocialRowsFromDom(next);
|
|
11799
12330
|
const domCols = listFooterColumns().map((col) => {
|
|
11800
12331
|
const heading = getFooterColumnHeadingEl(col);
|
|
11801
12332
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -12276,7 +12807,7 @@ var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
|
12276
12807
|
var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
|
|
12277
12808
|
var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
|
|
12278
12809
|
var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
|
|
12279
|
-
var
|
|
12810
|
+
var HIDDEN_ATTR3 = "data-ohw-placeholder-hidden";
|
|
12280
12811
|
function hasPlaceholder(text) {
|
|
12281
12812
|
return HAS_PLACEHOLDER_RE.test(text);
|
|
12282
12813
|
}
|
|
@@ -12295,10 +12826,10 @@ function skipped(el) {
|
|
|
12295
12826
|
}
|
|
12296
12827
|
function hideIfEmptied(el) {
|
|
12297
12828
|
const control = el?.closest("a, button");
|
|
12298
|
-
if (!control || control.hasAttribute(
|
|
12829
|
+
if (!control || control.hasAttribute(HIDDEN_ATTR3)) return;
|
|
12299
12830
|
if ((control.textContent ?? "").trim()) return;
|
|
12300
12831
|
if (control.querySelector("img, svg, picture, video")) return;
|
|
12301
|
-
control.setAttribute(
|
|
12832
|
+
control.setAttribute(HIDDEN_ATTR3, "");
|
|
12302
12833
|
control.style.display = "none";
|
|
12303
12834
|
}
|
|
12304
12835
|
function stripElementAttrs(el) {
|
|
@@ -17447,10 +17978,10 @@ function ItemInteractionLayer({
|
|
|
17447
17978
|
}
|
|
17448
17979
|
|
|
17449
17980
|
// src/lib/forms.ts
|
|
17450
|
-
var
|
|
17981
|
+
var FORM_SELECTOR2 = '[data-ohw-editable="form"]';
|
|
17451
17982
|
function getFormElement(el) {
|
|
17452
17983
|
if (!el) return null;
|
|
17453
|
-
return el.closest(
|
|
17984
|
+
return el.closest(FORM_SELECTOR2);
|
|
17454
17985
|
}
|
|
17455
17986
|
function formKeyOf(form) {
|
|
17456
17987
|
return form.getAttribute("data-ohw-key");
|
|
@@ -17511,7 +18042,7 @@ function clearSubmitError(form) {
|
|
|
17511
18042
|
if (note) note.style.display = "none";
|
|
17512
18043
|
}
|
|
17513
18044
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17514
|
-
var
|
|
18045
|
+
var HIDDEN_ATTR4 = "data-ohw-form-hidden";
|
|
17515
18046
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17516
18047
|
function formSuccessKey(formKey) {
|
|
17517
18048
|
return `${formKey}-success`;
|
|
@@ -17537,13 +18068,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17537
18068
|
Array.from(form.children).forEach((child) => {
|
|
17538
18069
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17539
18070
|
if (state === "success") {
|
|
17540
|
-
if (!child.hasAttribute(
|
|
17541
|
-
child.setAttribute(
|
|
18071
|
+
if (!child.hasAttribute(HIDDEN_ATTR4)) {
|
|
18072
|
+
child.setAttribute(HIDDEN_ATTR4, child.style.display);
|
|
17542
18073
|
child.style.display = "none";
|
|
17543
18074
|
}
|
|
17544
|
-
} else if (child.hasAttribute(
|
|
17545
|
-
child.style.display = child.getAttribute(
|
|
17546
|
-
child.removeAttribute(
|
|
18075
|
+
} else if (child.hasAttribute(HIDDEN_ATTR4)) {
|
|
18076
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR4) ?? "";
|
|
18077
|
+
child.removeAttribute(HIDDEN_ATTR4);
|
|
17547
18078
|
}
|
|
17548
18079
|
});
|
|
17549
18080
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17562,7 +18093,7 @@ function bindPublishedForms(apiUrl, subdomain, content = {}) {
|
|
|
17562
18093
|
"submit",
|
|
17563
18094
|
async (e) => {
|
|
17564
18095
|
const target = e.target;
|
|
17565
|
-
const form = target?.closest(
|
|
18096
|
+
const form = target?.closest(FORM_SELECTOR2);
|
|
17566
18097
|
if (!form || !(form instanceof HTMLFormElement)) return;
|
|
17567
18098
|
const formKey = formKeyOf(form);
|
|
17568
18099
|
if (!formKey) return;
|
|
@@ -17608,7 +18139,7 @@ function apiBase() {
|
|
|
17608
18139
|
function bridgeVersion() {
|
|
17609
18140
|
try {
|
|
17610
18141
|
if (true) {
|
|
17611
|
-
return "0.1.
|
|
18142
|
+
return "0.1.170-next.454";
|
|
17612
18143
|
}
|
|
17613
18144
|
} catch {
|
|
17614
18145
|
}
|
|
@@ -17622,7 +18153,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17622
18153
|
return;
|
|
17623
18154
|
}
|
|
17624
18155
|
try {
|
|
17625
|
-
const v = true ? "0.1.
|
|
18156
|
+
const v = true ? "0.1.170-next.454" : "";
|
|
17626
18157
|
if (v) {
|
|
17627
18158
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17628
18159
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -17783,7 +18314,9 @@ function isFieldRequired(wrapper) {
|
|
|
17783
18314
|
function markFormFields(form) {
|
|
17784
18315
|
form.querySelectorAll("input, textarea").forEach((input) => {
|
|
17785
18316
|
const type = input.type;
|
|
17786
|
-
if (type === "submit" || type === "button" || type === "reset" || type === "hidden")
|
|
18317
|
+
if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
|
|
18318
|
+
return;
|
|
18319
|
+
}
|
|
17787
18320
|
if (getFieldWrapper(input)) return;
|
|
17788
18321
|
let wrapper = input;
|
|
17789
18322
|
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll("input, textarea").length === 1) {
|
|
@@ -18281,6 +18814,7 @@ function MediaOverlay({
|
|
|
18281
18814
|
onFadeOutComplete,
|
|
18282
18815
|
onReplace,
|
|
18283
18816
|
onSelect,
|
|
18817
|
+
onDelete,
|
|
18284
18818
|
onVideoSettingsChange
|
|
18285
18819
|
}) {
|
|
18286
18820
|
const { rect } = hover;
|
|
@@ -18300,6 +18834,7 @@ function MediaOverlay({
|
|
|
18300
18834
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18301
18835
|
);
|
|
18302
18836
|
}, [isVideo]);
|
|
18837
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18303
18838
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18304
18839
|
const box = {
|
|
18305
18840
|
position: "fixed",
|
|
@@ -18398,11 +18933,10 @@ function MediaOverlay({
|
|
|
18398
18933
|
className: "flex items-center justify-center cursor-pointer",
|
|
18399
18934
|
style: {
|
|
18400
18935
|
...box,
|
|
18401
|
-
//
|
|
18402
|
-
//
|
|
18403
|
-
//
|
|
18404
|
-
|
|
18405
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18936
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18937
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18938
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18939
|
+
pointerEvents: "none",
|
|
18406
18940
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18407
18941
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18408
18942
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18429,40 +18963,74 @@ function MediaOverlay({
|
|
|
18429
18963
|
},
|
|
18430
18964
|
children: [
|
|
18431
18965
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
18432
|
-
|
|
18966
|
+
replaceLabel
|
|
18433
18967
|
]
|
|
18434
18968
|
}
|
|
18435
18969
|
),
|
|
18436
|
-
replaceMode
|
|
18437
|
-
|
|
18970
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18971
|
+
"div",
|
|
18438
18972
|
{
|
|
18439
|
-
"
|
|
18440
|
-
variant: "outline",
|
|
18441
|
-
size: "sm",
|
|
18442
|
-
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
18443
|
-
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18973
|
+
className: "flex items-center gap-1.5",
|
|
18444
18974
|
style: {
|
|
18445
|
-
|
|
18446
|
-
// Icon-only is a square of the same height, so the pair can never differ vertically.
|
|
18447
|
-
// `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
|
|
18448
|
-
// minimum beats a width — the square came out wider than the avatar it sat on.
|
|
18449
|
-
...replaceMode === "icon" && buttonSize ? {
|
|
18450
|
-
width: buttonSize.height,
|
|
18451
|
-
minWidth: buttonSize.height,
|
|
18452
|
-
padding: 0,
|
|
18453
|
-
justifyContent: "center"
|
|
18454
|
-
} : null,
|
|
18455
|
-
// Don't let Replace steal clicks when text (e.g. nav) sits on top of this media.
|
|
18975
|
+
// Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
|
|
18456
18976
|
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
|
|
18457
18977
|
},
|
|
18458
|
-
|
|
18459
|
-
onClick: (e) => {
|
|
18460
|
-
e.stopPropagation();
|
|
18461
|
-
onReplace(hover.key);
|
|
18462
|
-
},
|
|
18978
|
+
onClick: (e) => e.stopPropagation(),
|
|
18463
18979
|
children: [
|
|
18464
|
-
|
|
18465
|
-
|
|
18980
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18981
|
+
Button,
|
|
18982
|
+
{
|
|
18983
|
+
"data-ohw-media-overlay": "",
|
|
18984
|
+
variant: "outline",
|
|
18985
|
+
size: "sm",
|
|
18986
|
+
"aria-label": replaceLabel,
|
|
18987
|
+
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18988
|
+
style: {
|
|
18989
|
+
...OVERLAY_BUTTON_STYLE,
|
|
18990
|
+
// Icon-only is a square of the same height, so the pair can never differ vertically.
|
|
18991
|
+
// `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
|
|
18992
|
+
// minimum beats a width — the square came out wider than the avatar it sat on.
|
|
18993
|
+
...replaceMode === "icon" && buttonSize ? {
|
|
18994
|
+
width: buttonSize.height,
|
|
18995
|
+
minWidth: buttonSize.height,
|
|
18996
|
+
padding: 0,
|
|
18997
|
+
justifyContent: "center"
|
|
18998
|
+
} : null
|
|
18999
|
+
},
|
|
19000
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
19001
|
+
onClick: (e) => {
|
|
19002
|
+
e.stopPropagation();
|
|
19003
|
+
onReplace(hover.key);
|
|
19004
|
+
},
|
|
19005
|
+
children: [
|
|
19006
|
+
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
19007
|
+
replaceMode === "full" ? replaceLabel : null
|
|
19008
|
+
]
|
|
19009
|
+
}
|
|
19010
|
+
),
|
|
19011
|
+
selected && onDelete ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
19012
|
+
Button,
|
|
19013
|
+
{
|
|
19014
|
+
"data-ohw-media-overlay": "",
|
|
19015
|
+
variant: "outline",
|
|
19016
|
+
size: "sm",
|
|
19017
|
+
"aria-label": "Delete",
|
|
19018
|
+
title: "Delete",
|
|
19019
|
+
className: "cursor-pointer hover:bg-background",
|
|
19020
|
+
style: {
|
|
19021
|
+
...OVERLAY_BUTTON_STYLE,
|
|
19022
|
+
minWidth: 0,
|
|
19023
|
+
padding: buttonSize ? `0 ${(buttonSize.height - 14) / 2}px` : "0 8px",
|
|
19024
|
+
height: buttonSize?.height
|
|
19025
|
+
},
|
|
19026
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
19027
|
+
onClick: (e) => {
|
|
19028
|
+
e.stopPropagation();
|
|
19029
|
+
onDelete(hover.key);
|
|
19030
|
+
},
|
|
19031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Trash2, { size: 14 })
|
|
19032
|
+
}
|
|
19033
|
+
) : null
|
|
18466
19034
|
]
|
|
18467
19035
|
}
|
|
18468
19036
|
)
|
|
@@ -18610,7 +19178,7 @@ function highlightedRect() {
|
|
|
18610
19178
|
const rect = first.getBoundingClientRect();
|
|
18611
19179
|
return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
|
|
18612
19180
|
}
|
|
18613
|
-
function installAiChangeHighlight() {
|
|
19181
|
+
function installAiChangeHighlight(select) {
|
|
18614
19182
|
const onMessage = (e) => {
|
|
18615
19183
|
const data = e.data;
|
|
18616
19184
|
if (data?.type !== "ow:ai-highlight") return;
|
|
@@ -18619,6 +19187,8 @@ function installAiChangeHighlight() {
|
|
|
18619
19187
|
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;
|
|
18620
19188
|
const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
|
|
18621
19189
|
const found = highlightChangedElements(keys, item, sectionId);
|
|
19190
|
+
const first = data.select === true ? document.querySelector(`[${MARK_ATTR}]`) : null;
|
|
19191
|
+
if (first) select?.(first);
|
|
18622
19192
|
const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
|
|
18623
19193
|
window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
|
|
18624
19194
|
};
|
|
@@ -18626,6 +19196,28 @@ function installAiChangeHighlight() {
|
|
|
18626
19196
|
return () => window.removeEventListener("message", onMessage);
|
|
18627
19197
|
}
|
|
18628
19198
|
|
|
19199
|
+
// src/lib/history-key-relay.ts
|
|
19200
|
+
var isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent);
|
|
19201
|
+
function historyActionFor(e, mac = isMac()) {
|
|
19202
|
+
const mod = mac ? e.metaKey : e.ctrlKey;
|
|
19203
|
+
if (!mod || e.altKey) return null;
|
|
19204
|
+
const key = e.key.toLowerCase();
|
|
19205
|
+
if (key === "z") return e.shiftKey ? "redo" : "undo";
|
|
19206
|
+
if (key === "y" && !mac) return "redo";
|
|
19207
|
+
return null;
|
|
19208
|
+
}
|
|
19209
|
+
var isEditingText = (el) => !!el && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLElement && el.isContentEditable);
|
|
19210
|
+
function installHistoryKeyRelay() {
|
|
19211
|
+
const onKeyDown = (e) => {
|
|
19212
|
+
const action = historyActionFor(e);
|
|
19213
|
+
if (!action || isEditingText(document.activeElement)) return;
|
|
19214
|
+
e.preventDefault();
|
|
19215
|
+
window.parent?.postMessage({ type: "ow:history-key", action }, "*");
|
|
19216
|
+
};
|
|
19217
|
+
window.addEventListener("keydown", onKeyDown);
|
|
19218
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
19219
|
+
}
|
|
19220
|
+
|
|
18629
19221
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18630
19222
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
18631
19223
|
var findSectionElement = findByInstanceId;
|
|
@@ -18878,7 +19470,8 @@ function AiSectionOverlay({
|
|
|
18878
19470
|
window.addEventListener("message", onMessage);
|
|
18879
19471
|
return () => window.removeEventListener("message", onMessage);
|
|
18880
19472
|
}, [postToParent2]);
|
|
18881
|
-
(0, import_react12.useEffect)(() => installAiChangeHighlight(), []);
|
|
19473
|
+
(0, import_react12.useEffect)(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
|
|
19474
|
+
(0, import_react12.useEffect)(() => installHistoryKeyRelay(), []);
|
|
18882
19475
|
const [hoveredId, setHoveredId] = (0, import_react12.useState)(null);
|
|
18883
19476
|
(0, import_react12.useEffect)(() => {
|
|
18884
19477
|
const onMove = (e) => {
|
|
@@ -19069,7 +19662,7 @@ function AiSectionOverlay({
|
|
|
19069
19662
|
|
|
19070
19663
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19071
19664
|
var import_react13 = require("react");
|
|
19072
|
-
var
|
|
19665
|
+
var import_lucide_react9 = require("lucide-react");
|
|
19073
19666
|
|
|
19074
19667
|
// src/lib/ai-media-strip-tree.ts
|
|
19075
19668
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19183,14 +19776,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19183
19776
|
return true;
|
|
19184
19777
|
});
|
|
19185
19778
|
}
|
|
19186
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19187
|
-
return withMediaStrip(tree, (block) => {
|
|
19188
|
-
const items = block.items;
|
|
19189
|
-
if (index < 0 || index >= items.length) return false;
|
|
19190
|
-
items[index] = { ...items[index], alt };
|
|
19191
|
-
return true;
|
|
19192
|
-
});
|
|
19193
|
-
}
|
|
19194
19779
|
function setMediaStripItemLink(tree, index, link) {
|
|
19195
19780
|
return withMediaStrip(tree, (block) => {
|
|
19196
19781
|
const items = block.items;
|
|
@@ -19208,11 +19793,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19208
19793
|
});
|
|
19209
19794
|
}
|
|
19210
19795
|
|
|
19211
|
-
// src/ui/
|
|
19796
|
+
// src/ui/dialog.tsx
|
|
19797
|
+
var React9 = __toESM(require("react"), 1);
|
|
19798
|
+
var import_radix_ui6 = require("radix-ui");
|
|
19799
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19212
19800
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19801
|
+
function Dialog2({
|
|
19802
|
+
...props
|
|
19803
|
+
}) {
|
|
19804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19805
|
+
}
|
|
19806
|
+
function DialogPortal({
|
|
19807
|
+
...props
|
|
19808
|
+
}) {
|
|
19809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19810
|
+
}
|
|
19811
|
+
function DialogOverlay({
|
|
19812
|
+
className,
|
|
19813
|
+
...props
|
|
19814
|
+
}) {
|
|
19815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19816
|
+
import_radix_ui6.Dialog.Overlay,
|
|
19817
|
+
{
|
|
19818
|
+
"data-slot": "dialog-overlay",
|
|
19819
|
+
"data-ohw-link-modal-root": "",
|
|
19820
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19821
|
+
...props
|
|
19822
|
+
}
|
|
19823
|
+
);
|
|
19824
|
+
}
|
|
19825
|
+
var DialogContent = React9.forwardRef(
|
|
19826
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19827
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19829
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19830
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19831
|
+
import_radix_ui6.Dialog.Content,
|
|
19832
|
+
{
|
|
19833
|
+
ref,
|
|
19834
|
+
"data-slot": "dialog-content",
|
|
19835
|
+
className: cn(
|
|
19836
|
+
positionMode,
|
|
19837
|
+
"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",
|
|
19838
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19839
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19840
|
+
className
|
|
19841
|
+
),
|
|
19842
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19843
|
+
...props,
|
|
19844
|
+
children: [
|
|
19845
|
+
children,
|
|
19846
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19847
|
+
import_radix_ui6.Dialog.Close,
|
|
19848
|
+
{
|
|
19849
|
+
type: "button",
|
|
19850
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19851
|
+
"aria-label": "Close",
|
|
19852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19853
|
+
}
|
|
19854
|
+
) : null
|
|
19855
|
+
]
|
|
19856
|
+
}
|
|
19857
|
+
)
|
|
19858
|
+
] });
|
|
19859
|
+
}
|
|
19860
|
+
);
|
|
19861
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19862
|
+
function DialogHeader({
|
|
19863
|
+
className,
|
|
19864
|
+
...props
|
|
19865
|
+
}) {
|
|
19866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19867
|
+
}
|
|
19868
|
+
function DialogFooter({
|
|
19869
|
+
className,
|
|
19870
|
+
...props
|
|
19871
|
+
}) {
|
|
19872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19873
|
+
"div",
|
|
19874
|
+
{
|
|
19875
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19876
|
+
...props
|
|
19877
|
+
}
|
|
19878
|
+
);
|
|
19879
|
+
}
|
|
19880
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19881
|
+
import_radix_ui6.Dialog.Title,
|
|
19882
|
+
{
|
|
19883
|
+
ref,
|
|
19884
|
+
className: cn(
|
|
19885
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19886
|
+
className
|
|
19887
|
+
),
|
|
19888
|
+
...props
|
|
19889
|
+
}
|
|
19890
|
+
));
|
|
19891
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19892
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19893
|
+
import_radix_ui6.Dialog.Description,
|
|
19894
|
+
{
|
|
19895
|
+
ref,
|
|
19896
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19897
|
+
...props
|
|
19898
|
+
}
|
|
19899
|
+
));
|
|
19900
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19901
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19902
|
+
|
|
19903
|
+
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19904
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
19905
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19906
|
+
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]";
|
|
19216
19907
|
function findMediaStripItemElement(sectionId, index) {
|
|
19217
19908
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19218
19909
|
if (!sectionEl2) return null;
|
|
@@ -19222,14 +19913,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19222
19913
|
}
|
|
19223
19914
|
return null;
|
|
19224
19915
|
}
|
|
19225
|
-
function
|
|
19226
|
-
|
|
19916
|
+
function itemRefFromTarget(target) {
|
|
19917
|
+
if (!(target instanceof Element)) return null;
|
|
19918
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19919
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19920
|
+
if (!itemEl) return null;
|
|
19921
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19922
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19923
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19924
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19925
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19926
|
+
return { sectionId, index };
|
|
19927
|
+
}
|
|
19928
|
+
function sameRef(a, b) {
|
|
19929
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19930
|
+
}
|
|
19931
|
+
function rectOf(el) {
|
|
19227
19932
|
if (!el) return null;
|
|
19228
19933
|
const r2 = el.getBoundingClientRect();
|
|
19229
19934
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19230
19935
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19231
19936
|
}
|
|
19232
|
-
function
|
|
19937
|
+
function readRect2(ref) {
|
|
19938
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19939
|
+
}
|
|
19940
|
+
function readStripRect(ref) {
|
|
19941
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19942
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19943
|
+
}
|
|
19944
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19233
19945
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
19234
19946
|
(0, import_react13.useEffect)(() => {
|
|
19235
19947
|
if (!ref) {
|
|
@@ -19237,7 +19949,7 @@ function useLiveItemRect(ref) {
|
|
|
19237
19949
|
return;
|
|
19238
19950
|
}
|
|
19239
19951
|
const update = () => {
|
|
19240
|
-
const next = readRect2(ref);
|
|
19952
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19241
19953
|
setRect(
|
|
19242
19954
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19243
19955
|
);
|
|
@@ -19252,9 +19964,49 @@ function useLiveItemRect(ref) {
|
|
|
19252
19964
|
window.removeEventListener("resize", update);
|
|
19253
19965
|
clearInterval(interval);
|
|
19254
19966
|
};
|
|
19255
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19967
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19256
19968
|
return rect;
|
|
19257
19969
|
}
|
|
19970
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19971
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19972
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19973
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19974
|
+
const slotRef = (0, import_react13.useRef)(null);
|
|
19975
|
+
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
19976
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19977
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
19978
|
+
const slot = slotRef.current;
|
|
19979
|
+
if (!slot) return;
|
|
19980
|
+
const clamp = () => {
|
|
19981
|
+
const w = slot.offsetWidth;
|
|
19982
|
+
if (w <= 0) return;
|
|
19983
|
+
const half = w / 2;
|
|
19984
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19985
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19986
|
+
};
|
|
19987
|
+
clamp();
|
|
19988
|
+
const ro = new ResizeObserver(clamp);
|
|
19989
|
+
ro.observe(slot);
|
|
19990
|
+
return () => ro.disconnect();
|
|
19991
|
+
}, [centerX, children]);
|
|
19992
|
+
const mobile = window.innerWidth <= 480;
|
|
19993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19994
|
+
"div",
|
|
19995
|
+
{
|
|
19996
|
+
ref: slotRef,
|
|
19997
|
+
"data-ohw-bridge": "",
|
|
19998
|
+
"data-ohw-item-interaction": "",
|
|
19999
|
+
className: "pointer-events-auto fixed",
|
|
20000
|
+
style: {
|
|
20001
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
20002
|
+
left: centerX + shift,
|
|
20003
|
+
transform: "translate(-50%, -100%)",
|
|
20004
|
+
zIndex: 2147483645
|
|
20005
|
+
},
|
|
20006
|
+
children
|
|
20007
|
+
}
|
|
20008
|
+
);
|
|
20009
|
+
}
|
|
19258
20010
|
function requestValidateTree(postToParent2, tree) {
|
|
19259
20011
|
return new Promise((resolve) => {
|
|
19260
20012
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19291,116 +20043,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19291
20043
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19292
20044
|
});
|
|
19293
20045
|
}
|
|
19294
|
-
function
|
|
20046
|
+
function ToolbarAction({
|
|
19295
20047
|
label,
|
|
19296
20048
|
onClick,
|
|
19297
|
-
disabled,
|
|
19298
|
-
active
|
|
20049
|
+
disabled = false,
|
|
20050
|
+
active = false,
|
|
20051
|
+
children
|
|
19299
20052
|
}) {
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
{
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
disabled,
|
|
19306
|
-
style: {
|
|
19307
|
-
height: 28,
|
|
19308
|
-
padding: "0 10px",
|
|
19309
|
-
display: "inline-flex",
|
|
19310
|
-
alignItems: "center",
|
|
19311
|
-
gap: 4,
|
|
19312
|
-
borderRadius: 999,
|
|
19313
|
-
border: "none",
|
|
19314
|
-
cursor: disabled ? "default" : "pointer",
|
|
19315
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19316
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19317
|
-
opacity: disabled ? 0.4 : 1,
|
|
19318
|
-
fontSize: 12,
|
|
19319
|
-
lineHeight: "16px",
|
|
19320
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19321
|
-
whiteSpace: "nowrap",
|
|
19322
|
-
flex: "0 0 auto"
|
|
19323
|
-
},
|
|
19324
|
-
children: label
|
|
19325
|
-
}
|
|
19326
|
-
);
|
|
20053
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
20054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20055
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20056
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
20057
|
+
] });
|
|
19327
20058
|
}
|
|
19328
|
-
function
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
|
|
19347
|
-
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
},
|
|
19358
|
-
children: "Alt"
|
|
19359
|
-
}
|
|
19360
|
-
),
|
|
19361
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19362
|
-
"input",
|
|
20059
|
+
function ToolbarSeparator() {
|
|
20060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
20061
|
+
}
|
|
20062
|
+
function OptionMenu({
|
|
20063
|
+
label,
|
|
20064
|
+
value,
|
|
20065
|
+
options,
|
|
20066
|
+
onChange
|
|
20067
|
+
}) {
|
|
20068
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
20069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20070
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
20071
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20072
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20073
|
+
"button",
|
|
20074
|
+
{
|
|
20075
|
+
type: "button",
|
|
20076
|
+
"aria-label": label,
|
|
20077
|
+
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",
|
|
20078
|
+
children: [
|
|
20079
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20080
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20081
|
+
]
|
|
20082
|
+
}
|
|
20083
|
+
) }),
|
|
20084
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
20085
|
+
const selected = option.value === value;
|
|
20086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20087
|
+
DropdownMenuItem,
|
|
19363
20088
|
{
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
"aria-label": "Image alt text",
|
|
19379
|
-
style: {
|
|
19380
|
-
flex: 1,
|
|
19381
|
-
minWidth: 0,
|
|
19382
|
-
border: "none",
|
|
19383
|
-
outline: "none",
|
|
19384
|
-
background: "transparent",
|
|
19385
|
-
fontSize: 12,
|
|
19386
|
-
lineHeight: "16px",
|
|
19387
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19388
|
-
color: "#1f2937"
|
|
19389
|
-
}
|
|
19390
|
-
}
|
|
19391
|
-
)
|
|
19392
|
-
]
|
|
19393
|
-
}
|
|
19394
|
-
);
|
|
20089
|
+
role: "menuitemradio",
|
|
20090
|
+
"aria-checked": selected,
|
|
20091
|
+
onSelect: () => onChange(option.value),
|
|
20092
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20093
|
+
children: [
|
|
20094
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
|
|
20095
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
20096
|
+
]
|
|
20097
|
+
},
|
|
20098
|
+
option.value
|
|
20099
|
+
);
|
|
20100
|
+
}) })
|
|
20101
|
+
] })
|
|
20102
|
+
] });
|
|
19395
20103
|
}
|
|
19396
20104
|
var VARIANTS = [
|
|
19397
20105
|
{ value: "logos", label: "Logos" },
|
|
19398
20106
|
{ value: "reel", label: "Reel" }
|
|
19399
20107
|
];
|
|
19400
20108
|
var ALIGNS = [
|
|
19401
|
-
{ value: "left", label: "
|
|
19402
|
-
{ value: "center", label: "
|
|
19403
|
-
{ value: "right", label: "
|
|
20109
|
+
{ value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
|
|
20110
|
+
{ value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
|
|
20111
|
+
{ value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
|
|
19404
20112
|
];
|
|
19405
20113
|
var HOVERS = [
|
|
19406
20114
|
{ value: "none", label: "None" },
|
|
@@ -19408,104 +20116,104 @@ var HOVERS = [
|
|
|
19408
20116
|
{ value: "zoom", label: "Zoom" },
|
|
19409
20117
|
{ value: "fade", label: "Fade" }
|
|
19410
20118
|
];
|
|
19411
|
-
var TREATMENTS = [
|
|
19412
|
-
{ value: "color", label: "Color" },
|
|
19413
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19414
|
-
];
|
|
19415
20119
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19416
|
-
function
|
|
19417
|
-
|
|
20120
|
+
function LinkModal({
|
|
20121
|
+
href,
|
|
20122
|
+
linkTarget,
|
|
20123
|
+
onClose,
|
|
20124
|
+
onSave
|
|
20125
|
+
}) {
|
|
20126
|
+
const [draft, setDraft] = (0, import_react13.useState)(href);
|
|
20127
|
+
const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
|
|
19418
20128
|
const [invalid, setInvalid] = (0, import_react13.useState)(false);
|
|
19419
|
-
|
|
19420
|
-
setDraft(value);
|
|
19421
|
-
setInvalid(false);
|
|
19422
|
-
}, [value]);
|
|
19423
|
-
const commit2 = () => {
|
|
20129
|
+
const save = () => {
|
|
19424
20130
|
const next = draft.trim();
|
|
19425
|
-
if (next
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
onCommit(next);
|
|
19429
|
-
};
|
|
19430
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19431
|
-
"div",
|
|
19432
|
-
{
|
|
19433
|
-
style: {
|
|
19434
|
-
display: "flex",
|
|
19435
|
-
alignItems: "center",
|
|
19436
|
-
gap: 6,
|
|
19437
|
-
height: 28,
|
|
19438
|
-
padding: "0 12px",
|
|
19439
|
-
borderRadius: 999,
|
|
19440
|
-
background: "#ffffff",
|
|
19441
|
-
width: "100%",
|
|
19442
|
-
maxWidth: 260,
|
|
19443
|
-
boxSizing: "border-box",
|
|
19444
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19445
|
-
},
|
|
19446
|
-
children: [
|
|
19447
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19448
|
-
"span",
|
|
19449
|
-
{
|
|
19450
|
-
style: {
|
|
19451
|
-
flex: "0 0 auto",
|
|
19452
|
-
color: OHW_BLUE_DARK,
|
|
19453
|
-
fontSize: 10,
|
|
19454
|
-
fontWeight: 700,
|
|
19455
|
-
textTransform: "uppercase",
|
|
19456
|
-
letterSpacing: 0.4
|
|
19457
|
-
},
|
|
19458
|
-
children: "Link"
|
|
19459
|
-
}
|
|
19460
|
-
),
|
|
19461
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19462
|
-
"input",
|
|
19463
|
-
{
|
|
19464
|
-
type: "text",
|
|
19465
|
-
inputMode: "url",
|
|
19466
|
-
value: draft,
|
|
19467
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19468
|
-
onBlur: commit2,
|
|
19469
|
-
onKeyDown: (e) => {
|
|
19470
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19471
|
-
if (e.key === "Escape") {
|
|
19472
|
-
setDraft(value);
|
|
19473
|
-
setInvalid(false);
|
|
19474
|
-
e.currentTarget.blur();
|
|
19475
|
-
}
|
|
19476
|
-
},
|
|
19477
|
-
placeholder: "https://example.com",
|
|
19478
|
-
"aria-label": "Image link URL",
|
|
19479
|
-
"aria-invalid": invalid,
|
|
19480
|
-
style: {
|
|
19481
|
-
flex: 1,
|
|
19482
|
-
minWidth: 0,
|
|
19483
|
-
border: "none",
|
|
19484
|
-
outline: "none",
|
|
19485
|
-
background: "transparent",
|
|
19486
|
-
fontSize: 12,
|
|
19487
|
-
lineHeight: "16px",
|
|
19488
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19489
|
-
color: "#1f2937"
|
|
19490
|
-
}
|
|
19491
|
-
}
|
|
19492
|
-
)
|
|
19493
|
-
]
|
|
20131
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
20132
|
+
setInvalid(true);
|
|
20133
|
+
return;
|
|
19494
20134
|
}
|
|
19495
|
-
|
|
20135
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
20136
|
+
onClose();
|
|
20137
|
+
};
|
|
20138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
20139
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
20140
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
20141
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20142
|
+
"input",
|
|
20143
|
+
{
|
|
20144
|
+
autoFocus: true,
|
|
20145
|
+
type: "text",
|
|
20146
|
+
inputMode: "url",
|
|
20147
|
+
value: draft,
|
|
20148
|
+
onChange: (e) => {
|
|
20149
|
+
setDraft(e.target.value);
|
|
20150
|
+
setInvalid(false);
|
|
20151
|
+
},
|
|
20152
|
+
onKeyDown: (e) => {
|
|
20153
|
+
if (e.key === "Enter") save();
|
|
20154
|
+
},
|
|
20155
|
+
placeholder: "https://example.com",
|
|
20156
|
+
"aria-label": "Image link URL",
|
|
20157
|
+
"aria-invalid": invalid,
|
|
20158
|
+
className: cn(
|
|
20159
|
+
"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",
|
|
20160
|
+
invalid && "border-destructive focus:border-destructive"
|
|
20161
|
+
)
|
|
20162
|
+
}
|
|
20163
|
+
),
|
|
20164
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
20165
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
20166
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
20167
|
+
"Open in new tab"
|
|
20168
|
+
] })
|
|
20169
|
+
] }),
|
|
20170
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
|
|
20171
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20172
|
+
"button",
|
|
20173
|
+
{
|
|
20174
|
+
type: "button",
|
|
20175
|
+
onClick: () => {
|
|
20176
|
+
onSave("", "new-tab");
|
|
20177
|
+
onClose();
|
|
20178
|
+
},
|
|
20179
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
20180
|
+
children: "Remove link"
|
|
20181
|
+
}
|
|
20182
|
+
),
|
|
20183
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20184
|
+
"button",
|
|
20185
|
+
{
|
|
20186
|
+
type: "button",
|
|
20187
|
+
onClick: onClose,
|
|
20188
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
20189
|
+
children: "Cancel"
|
|
20190
|
+
}
|
|
20191
|
+
),
|
|
20192
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20193
|
+
"button",
|
|
20194
|
+
{
|
|
20195
|
+
type: "button",
|
|
20196
|
+
onClick: save,
|
|
20197
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
20198
|
+
children: "Save"
|
|
20199
|
+
}
|
|
20200
|
+
)
|
|
20201
|
+
] })
|
|
20202
|
+
] }) });
|
|
19496
20203
|
}
|
|
19497
20204
|
function MediaStripToolbar({
|
|
19498
20205
|
entry,
|
|
19499
20206
|
index,
|
|
19500
20207
|
pending,
|
|
19501
20208
|
error,
|
|
20209
|
+
itemEditOn,
|
|
20210
|
+
onToggleItemEdit,
|
|
19502
20211
|
onSetVariant,
|
|
19503
20212
|
onSetAlign,
|
|
19504
20213
|
onSetHover,
|
|
19505
20214
|
onSetTreatment,
|
|
19506
20215
|
onResize,
|
|
19507
|
-
|
|
19508
|
-
onSetLink,
|
|
20216
|
+
onOpenLink,
|
|
19509
20217
|
onAddItem,
|
|
19510
20218
|
onRemoveItem,
|
|
19511
20219
|
onChangeImage,
|
|
@@ -19514,81 +20222,102 @@ function MediaStripToolbar({
|
|
|
19514
20222
|
}) {
|
|
19515
20223
|
const items = mediaStripItems(entry.tree);
|
|
19516
20224
|
const itemCount = items.length;
|
|
19517
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19518
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19519
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19520
20225
|
const slots = findMediaStripSlots(entry.tree);
|
|
19521
20226
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19522
20227
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19523
20228
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19524
20229
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19525
20230
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19526
|
-
const
|
|
19527
|
-
const
|
|
19528
|
-
|
|
19529
|
-
gap: 6,
|
|
19530
|
-
flexWrap: "nowrap",
|
|
19531
|
-
justifyContent: "center",
|
|
19532
|
-
overflowX: "auto",
|
|
19533
|
-
WebkitOverflowScrolling: "touch",
|
|
19534
|
-
width: "100%",
|
|
19535
|
-
scrollbarWidth: "none"
|
|
19536
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19537
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
20231
|
+
const mobile = window.innerWidth <= 480;
|
|
20232
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
20233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19538
20234
|
"div",
|
|
19539
20235
|
{
|
|
19540
20236
|
"data-ohw-bridge": "",
|
|
19541
20237
|
"data-ohw-toolbar": "",
|
|
19542
20238
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19543
|
-
|
|
19544
|
-
|
|
19545
|
-
flexDirection: "column",
|
|
19546
|
-
gap: 6,
|
|
19547
|
-
alignItems: "center",
|
|
19548
|
-
background: OHW_BLUE,
|
|
19549
|
-
padding: 8,
|
|
19550
|
-
borderRadius: 12,
|
|
19551
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19552
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19553
|
-
opacity: pending ? 0.6 : 1,
|
|
19554
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19555
|
-
},
|
|
20239
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
20240
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19556
20241
|
children: [
|
|
19557
|
-
/* @__PURE__ */ (0,
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
20242
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20243
|
+
"div",
|
|
20244
|
+
{
|
|
20245
|
+
className: cn(
|
|
20246
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
20247
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
20248
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20249
|
+
),
|
|
20250
|
+
children: [
|
|
20251
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20252
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20253
|
+
CustomToolbarButton,
|
|
20254
|
+
{
|
|
20255
|
+
type: "button",
|
|
20256
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
20257
|
+
"aria-pressed": itemEditOn,
|
|
20258
|
+
onClick: onToggleItemEdit,
|
|
20259
|
+
className: "group size-8",
|
|
20260
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20261
|
+
import_lucide_react9.Star,
|
|
20262
|
+
{
|
|
20263
|
+
size: 16,
|
|
20264
|
+
fill: "currentColor",
|
|
20265
|
+
strokeWidth: 0,
|
|
20266
|
+
className: cn(
|
|
20267
|
+
"transition-colors",
|
|
20268
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
20269
|
+
),
|
|
20270
|
+
style: { pointerEvents: "none" }
|
|
20271
|
+
}
|
|
20272
|
+
)
|
|
20273
|
+
}
|
|
20274
|
+
) }),
|
|
20275
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
20276
|
+
] }),
|
|
20277
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20278
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20279
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20280
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20281
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20282
|
+
ToolbarAction,
|
|
20283
|
+
{
|
|
20284
|
+
label: gatedLabel("Move right"),
|
|
20285
|
+
onClick: onMoveRight,
|
|
20286
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
20287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
20288
|
+
}
|
|
20289
|
+
),
|
|
20290
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20291
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20292
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
20293
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
20294
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20295
|
+
ToolbarAction,
|
|
20296
|
+
{
|
|
20297
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
20298
|
+
active: treatment === "grayscale",
|
|
20299
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
20300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
20301
|
+
}
|
|
20302
|
+
),
|
|
20303
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20304
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
20305
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20306
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20307
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
20308
|
+
sizeValue,
|
|
20309
|
+
"px"
|
|
20310
|
+
] }),
|
|
20311
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20312
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20313
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20314
|
+
]
|
|
20315
|
+
}
|
|
20316
|
+
),
|
|
20317
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19589
20318
|
]
|
|
19590
20319
|
}
|
|
19591
|
-
);
|
|
20320
|
+
) });
|
|
19592
20321
|
}
|
|
19593
20322
|
function findMediaStripSlots(tree) {
|
|
19594
20323
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19607,31 +20336,23 @@ function AiMediaStripOverlay({
|
|
|
19607
20336
|
}) {
|
|
19608
20337
|
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
19609
20338
|
const [active, setActive] = (0, import_react13.useState)(null);
|
|
20339
|
+
const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
|
|
20340
|
+
const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
|
|
19610
20341
|
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
19611
20342
|
const [error, setError] = (0, import_react13.useState)(null);
|
|
19612
20343
|
const activeRef = (0, import_react13.useRef)(null);
|
|
19613
20344
|
activeRef.current = active;
|
|
20345
|
+
const linkOpenRef = (0, import_react13.useRef)(false);
|
|
20346
|
+
linkOpenRef.current = linkOpen;
|
|
19614
20347
|
(0, import_react13.useEffect)(() => {
|
|
19615
20348
|
const onMove = (e) => {
|
|
20349
|
+
const ref = itemRefFromTarget(e.target);
|
|
19616
20350
|
const t = e.target;
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
if (!itemEl) {
|
|
19623
|
-
setHover(null);
|
|
19624
|
-
return;
|
|
19625
|
-
}
|
|
19626
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19627
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19628
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19629
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19630
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19631
|
-
setHover(null);
|
|
19632
|
-
return;
|
|
19633
|
-
}
|
|
19634
|
-
setHover({ sectionId, index });
|
|
20351
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
20352
|
+
setHover((prev) => {
|
|
20353
|
+
const next = ref && !overEditable ? ref : null;
|
|
20354
|
+
return sameRef(prev, next) ? prev : next;
|
|
20355
|
+
});
|
|
19635
20356
|
};
|
|
19636
20357
|
const onLeave = () => setHover(null);
|
|
19637
20358
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19643,23 +20364,25 @@ function AiMediaStripOverlay({
|
|
|
19643
20364
|
}, []);
|
|
19644
20365
|
(0, import_react13.useEffect)(() => {
|
|
19645
20366
|
const onClick = (e) => {
|
|
19646
|
-
const current = activeRef.current;
|
|
19647
|
-
if (!current) return;
|
|
19648
20367
|
const t = e.target;
|
|
19649
|
-
if (!(t instanceof
|
|
19650
|
-
if (t.closest(
|
|
19651
|
-
const
|
|
19652
|
-
if (
|
|
19653
|
-
|
|
20368
|
+
if (!(t instanceof Element)) return;
|
|
20369
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
20370
|
+
const ref = itemRefFromTarget(t);
|
|
20371
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
20372
|
+
if (ref) clearInteractionChromeRef.current();
|
|
20373
|
+
setItemEditOn(false);
|
|
19654
20374
|
setError(null);
|
|
20375
|
+
setActive(ref);
|
|
19655
20376
|
};
|
|
19656
20377
|
document.addEventListener("click", onClick, true);
|
|
19657
20378
|
return () => document.removeEventListener("click", onClick, true);
|
|
19658
|
-
}, []);
|
|
20379
|
+
}, [clearInteractionChromeRef]);
|
|
19659
20380
|
(0, import_react13.useEffect)(() => {
|
|
19660
20381
|
const onBlur = () => {
|
|
19661
20382
|
if (!activeRef.current) return;
|
|
19662
20383
|
setActive(null);
|
|
20384
|
+
setItemEditOn(false);
|
|
20385
|
+
setLinkOpen(false);
|
|
19663
20386
|
setError(null);
|
|
19664
20387
|
};
|
|
19665
20388
|
window.addEventListener("blur", onBlur);
|
|
@@ -19669,7 +20392,10 @@ function AiMediaStripOverlay({
|
|
|
19669
20392
|
const onKeyDown = (e) => {
|
|
19670
20393
|
if (e.key !== "Escape") return;
|
|
19671
20394
|
if (!activeRef.current) return;
|
|
20395
|
+
if (linkOpenRef.current) return;
|
|
20396
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19672
20397
|
setActive(null);
|
|
20398
|
+
setItemEditOn(false);
|
|
19673
20399
|
setError(null);
|
|
19674
20400
|
};
|
|
19675
20401
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19703,137 +20429,133 @@ function AiMediaStripOverlay({
|
|
|
19703
20429
|
tree: nextTree,
|
|
19704
20430
|
label: entry.label,
|
|
19705
20431
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19706
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20432
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
20433
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20434
|
+
// on every edit reads as the section jumping around.
|
|
20435
|
+
skipScrollIntoView: true
|
|
19707
20436
|
});
|
|
19708
20437
|
return true;
|
|
19709
20438
|
},
|
|
19710
20439
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19711
20440
|
);
|
|
19712
20441
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19713
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19714
20442
|
const activeItemRect = useLiveItemRect(active);
|
|
19715
|
-
const
|
|
19716
|
-
const
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
|
|
19721
|
-
|
|
19722
|
-
|
|
19723
|
-
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
|
|
19737
|
-
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
|
|
19749
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19750
|
-
ItemInteractionLayer,
|
|
19751
|
-
{
|
|
19752
|
-
rect: activeItemRect,
|
|
19753
|
-
state: toolbarState,
|
|
19754
|
-
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19755
|
-
MediaStripToolbar,
|
|
19756
|
-
{
|
|
19757
|
-
entry: activeEntry,
|
|
19758
|
-
index: active.index,
|
|
19759
|
-
pending,
|
|
19760
|
-
error,
|
|
19761
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19762
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19763
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19764
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19765
|
-
onResize: (delta) => {
|
|
19766
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19767
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19768
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19769
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19770
|
-
},
|
|
19771
|
-
onSetAlt: (alt) => {
|
|
19772
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19773
|
-
},
|
|
19774
|
-
onSetLink: (href, linkTarget) => {
|
|
20443
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
20444
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20445
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
20446
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
20447
|
+
const activeHref = activeItem?.href ?? "";
|
|
20448
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
20449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20450
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20451
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20452
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
20453
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20454
|
+
MediaStripToolbar,
|
|
20455
|
+
{
|
|
20456
|
+
entry: activeEntry,
|
|
20457
|
+
index: active.index,
|
|
20458
|
+
pending,
|
|
20459
|
+
error,
|
|
20460
|
+
itemEditOn,
|
|
20461
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
20462
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
20463
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
20464
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
20465
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
20466
|
+
onResize: (delta) => {
|
|
20467
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
20468
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
20469
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
20470
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
20471
|
+
},
|
|
20472
|
+
onOpenLink: () => setLinkOpen(true),
|
|
20473
|
+
onAddItem: () => {
|
|
20474
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20475
|
+
if (!picked) return;
|
|
20476
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19775
20477
|
void runMutation(
|
|
19776
20478
|
active.sectionId,
|
|
19777
|
-
(tree) =>
|
|
19778
|
-
|
|
19779
|
-
|
|
19780
|
-
|
|
19781
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19782
|
-
if (!picked) return;
|
|
19783
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19784
|
-
void runMutation(
|
|
19785
|
-
active.sectionId,
|
|
19786
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19787
|
-
{ [picked.assetId]: picked.url }
|
|
19788
|
-
).then((applied) => {
|
|
19789
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19790
|
-
});
|
|
19791
|
-
});
|
|
19792
|
-
},
|
|
19793
|
-
onChangeImage: () => {
|
|
19794
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19795
|
-
if (!picked) return;
|
|
19796
|
-
void runMutation(
|
|
19797
|
-
active.sectionId,
|
|
19798
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19799
|
-
{ [picked.assetId]: picked.url }
|
|
19800
|
-
);
|
|
20479
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
20480
|
+
{ [picked.assetId]: picked.url }
|
|
20481
|
+
).then((applied) => {
|
|
20482
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19801
20483
|
});
|
|
19802
|
-
}
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19812
|
-
(applied) => {
|
|
19813
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19814
|
-
}
|
|
19815
|
-
);
|
|
19816
|
-
},
|
|
19817
|
-
onMoveRight: () => {
|
|
19818
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19819
|
-
(applied) => {
|
|
19820
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19821
|
-
}
|
|
20484
|
+
});
|
|
20485
|
+
},
|
|
20486
|
+
onChangeImage: () => {
|
|
20487
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20488
|
+
if (!picked) return;
|
|
20489
|
+
void runMutation(
|
|
20490
|
+
active.sectionId,
|
|
20491
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
20492
|
+
{ [picked.assetId]: picked.url }
|
|
19822
20493
|
);
|
|
19823
|
-
}
|
|
20494
|
+
});
|
|
20495
|
+
},
|
|
20496
|
+
onRemoveItem: () => {
|
|
20497
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
20498
|
+
(applied) => {
|
|
20499
|
+
if (applied) setActive(null);
|
|
20500
|
+
}
|
|
20501
|
+
);
|
|
20502
|
+
},
|
|
20503
|
+
onMoveLeft: () => {
|
|
20504
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
20505
|
+
(applied) => {
|
|
20506
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
20507
|
+
}
|
|
20508
|
+
);
|
|
20509
|
+
},
|
|
20510
|
+
onMoveRight: () => {
|
|
20511
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20512
|
+
(applied) => {
|
|
20513
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20514
|
+
}
|
|
20515
|
+
);
|
|
19824
20516
|
}
|
|
19825
|
-
|
|
19826
|
-
}
|
|
19827
|
-
|
|
20517
|
+
}
|
|
20518
|
+
) }),
|
|
20519
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20520
|
+
"div",
|
|
20521
|
+
{
|
|
20522
|
+
"data-ohw-bridge": "",
|
|
20523
|
+
"data-ohw-item-interaction": "",
|
|
20524
|
+
"aria-hidden": true,
|
|
20525
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20526
|
+
style: {
|
|
20527
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20528
|
+
left: activeItemRect.left - 5,
|
|
20529
|
+
background: PRIMARY3,
|
|
20530
|
+
zIndex: 2147483644
|
|
20531
|
+
},
|
|
20532
|
+
children: "Media item"
|
|
20533
|
+
}
|
|
20534
|
+
),
|
|
20535
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20536
|
+
LinkModal,
|
|
20537
|
+
{
|
|
20538
|
+
href: activeHref,
|
|
20539
|
+
linkTarget: activeTarget,
|
|
20540
|
+
onClose: () => setLinkOpen(false),
|
|
20541
|
+
onSave: (href, linkTarget) => {
|
|
20542
|
+
void runMutation(
|
|
20543
|
+
active.sectionId,
|
|
20544
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20545
|
+
);
|
|
20546
|
+
}
|
|
20547
|
+
}
|
|
20548
|
+
)
|
|
20549
|
+
] })
|
|
19828
20550
|
] });
|
|
19829
20551
|
}
|
|
19830
20552
|
|
|
19831
20553
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19832
20554
|
var import_react14 = require("react");
|
|
19833
|
-
var
|
|
19834
|
-
var
|
|
20555
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20556
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
19835
20557
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19836
|
-
var
|
|
20558
|
+
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]";
|
|
19837
20559
|
function findPricingCardElement(sectionId, index) {
|
|
19838
20560
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19839
20561
|
if (!sectionEl2) return null;
|
|
@@ -19845,7 +20567,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19845
20567
|
}
|
|
19846
20568
|
function cardRefFromTarget(target) {
|
|
19847
20569
|
if (!(target instanceof Element)) return null;
|
|
19848
|
-
if (target.closest(
|
|
20570
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19849
20571
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19850
20572
|
if (!cardEl) return null;
|
|
19851
20573
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -19855,21 +20577,21 @@ function cardRefFromTarget(target) {
|
|
|
19855
20577
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19856
20578
|
return { sectionId, index };
|
|
19857
20579
|
}
|
|
19858
|
-
function
|
|
20580
|
+
function sameRef2(a, b) {
|
|
19859
20581
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19860
20582
|
}
|
|
19861
|
-
function
|
|
20583
|
+
function rectOf2(el) {
|
|
19862
20584
|
if (!el) return null;
|
|
19863
20585
|
const r2 = el.getBoundingClientRect();
|
|
19864
20586
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19865
20587
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19866
20588
|
}
|
|
19867
20589
|
function readRect3(ref) {
|
|
19868
|
-
return
|
|
20590
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19869
20591
|
}
|
|
19870
20592
|
function readGridRect(ref) {
|
|
19871
20593
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19872
|
-
return
|
|
20594
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19873
20595
|
}
|
|
19874
20596
|
function useLiveCardRect(ref, grid = false) {
|
|
19875
20597
|
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
@@ -19899,7 +20621,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19899
20621
|
}
|
|
19900
20622
|
var TOOLBAR_GRID_GAP = 52;
|
|
19901
20623
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19902
|
-
var
|
|
20624
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19903
20625
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19904
20626
|
const slotRef = (0, import_react14.useRef)(null);
|
|
19905
20627
|
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
@@ -19911,7 +20633,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19911
20633
|
const w = slot.offsetWidth;
|
|
19912
20634
|
if (w <= 0) return;
|
|
19913
20635
|
const half = w / 2;
|
|
19914
|
-
const clamped = Math.max(
|
|
20636
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19915
20637
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19916
20638
|
};
|
|
19917
20639
|
clamp();
|
|
@@ -19920,7 +20642,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19920
20642
|
return () => ro.disconnect();
|
|
19921
20643
|
}, [centerX, children]);
|
|
19922
20644
|
const mobile = window.innerWidth <= 480;
|
|
19923
|
-
return /* @__PURE__ */ (0,
|
|
20645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19924
20646
|
"div",
|
|
19925
20647
|
{
|
|
19926
20648
|
ref: slotRef,
|
|
@@ -19955,7 +20677,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19955
20677
|
});
|
|
19956
20678
|
}
|
|
19957
20679
|
function StyleSwatch({ style }) {
|
|
19958
|
-
return /* @__PURE__ */ (0,
|
|
20680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
19959
20681
|
"span",
|
|
19960
20682
|
{
|
|
19961
20683
|
"aria-hidden": true,
|
|
@@ -19969,35 +20691,35 @@ function StyleSwatch({ style }) {
|
|
|
19969
20691
|
);
|
|
19970
20692
|
}
|
|
19971
20693
|
function ButtonGlyph() {
|
|
19972
|
-
return /* @__PURE__ */ (0,
|
|
19973
|
-
/* @__PURE__ */ (0,
|
|
19974
|
-
/* @__PURE__ */ (0,
|
|
20694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20695
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20696
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19975
20697
|
] });
|
|
19976
20698
|
}
|
|
19977
20699
|
function FeatureGlyph({ mode }) {
|
|
19978
|
-
return /* @__PURE__ */ (0,
|
|
19979
|
-
/* @__PURE__ */ (0,
|
|
19980
|
-
/* @__PURE__ */ (0,
|
|
19981
|
-
/* @__PURE__ */ (0,
|
|
19982
|
-
/* @__PURE__ */ (0,
|
|
19983
|
-
/* @__PURE__ */ (0,
|
|
19984
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
20700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20701
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20702
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20703
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20704
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20705
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20706
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19985
20707
|
] });
|
|
19986
20708
|
}
|
|
19987
|
-
function
|
|
20709
|
+
function ToolbarAction2({
|
|
19988
20710
|
label,
|
|
19989
20711
|
onClick,
|
|
19990
20712
|
disabled = false,
|
|
19991
20713
|
children
|
|
19992
20714
|
}) {
|
|
19993
|
-
const button = /* @__PURE__ */ (0,
|
|
19994
|
-
return /* @__PURE__ */ (0,
|
|
19995
|
-
/* @__PURE__ */ (0,
|
|
19996
|
-
/* @__PURE__ */ (0,
|
|
20715
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20717
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20718
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19997
20719
|
] });
|
|
19998
20720
|
}
|
|
19999
|
-
function
|
|
20000
|
-
return /* @__PURE__ */ (0,
|
|
20721
|
+
function ToolbarSeparator2() {
|
|
20722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
20001
20723
|
}
|
|
20002
20724
|
function CardStyleMenu({
|
|
20003
20725
|
value,
|
|
@@ -20005,7 +20727,7 @@ function CardStyleMenu({
|
|
|
20005
20727
|
disabled = false
|
|
20006
20728
|
}) {
|
|
20007
20729
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
20008
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20730
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20009
20731
|
"button",
|
|
20010
20732
|
{
|
|
20011
20733
|
type: "button",
|
|
@@ -20016,28 +20738,28 @@ function CardStyleMenu({
|
|
|
20016
20738
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20017
20739
|
),
|
|
20018
20740
|
children: [
|
|
20019
|
-
/* @__PURE__ */ (0,
|
|
20020
|
-
/* @__PURE__ */ (0,
|
|
20021
|
-
/* @__PURE__ */ (0,
|
|
20741
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
|
|
20742
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20743
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20022
20744
|
]
|
|
20023
20745
|
}
|
|
20024
20746
|
);
|
|
20025
20747
|
if (disabled) {
|
|
20026
|
-
return /* @__PURE__ */ (0,
|
|
20027
|
-
/* @__PURE__ */ (0,
|
|
20028
|
-
/* @__PURE__ */ (0,
|
|
20029
|
-
/* @__PURE__ */ (0,
|
|
20030
|
-
/* @__PURE__ */ (0,
|
|
20748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20749
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20750
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20751
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20752
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20031
20753
|
] })
|
|
20032
20754
|
] });
|
|
20033
20755
|
}
|
|
20034
|
-
return /* @__PURE__ */ (0,
|
|
20035
|
-
/* @__PURE__ */ (0,
|
|
20036
|
-
/* @__PURE__ */ (0,
|
|
20037
|
-
/* @__PURE__ */ (0,
|
|
20038
|
-
/* @__PURE__ */ (0,
|
|
20756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20757
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20758
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20759
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20760
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
20039
20761
|
const selected = style.value === value;
|
|
20040
|
-
return /* @__PURE__ */ (0,
|
|
20762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20041
20763
|
DropdownMenuItem,
|
|
20042
20764
|
{
|
|
20043
20765
|
role: "menuitemradio",
|
|
@@ -20045,9 +20767,9 @@ function CardStyleMenu({
|
|
|
20045
20767
|
onSelect: () => onChange(style.value),
|
|
20046
20768
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20047
20769
|
children: [
|
|
20048
|
-
/* @__PURE__ */ (0,
|
|
20049
|
-
/* @__PURE__ */ (0,
|
|
20050
|
-
selected && /* @__PURE__ */ (0,
|
|
20770
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
|
|
20771
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
|
|
20772
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
|
|
20051
20773
|
]
|
|
20052
20774
|
},
|
|
20053
20775
|
style.value
|
|
@@ -20077,7 +20799,7 @@ function PricingCardToolbar({
|
|
|
20077
20799
|
const style = pricingCardStyle(entry.tree, index);
|
|
20078
20800
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20079
20801
|
const mobile = window.innerWidth <= 480;
|
|
20080
|
-
return /* @__PURE__ */ (0,
|
|
20802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20081
20803
|
"div",
|
|
20082
20804
|
{
|
|
20083
20805
|
"data-ohw-bridge": "",
|
|
@@ -20089,7 +20811,7 @@ function PricingCardToolbar({
|
|
|
20089
20811
|
),
|
|
20090
20812
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20091
20813
|
children: [
|
|
20092
|
-
/* @__PURE__ */ (0,
|
|
20814
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20093
20815
|
"div",
|
|
20094
20816
|
{
|
|
20095
20817
|
className: cn(
|
|
@@ -20098,8 +20820,8 @@ function PricingCardToolbar({
|
|
|
20098
20820
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20099
20821
|
),
|
|
20100
20822
|
children: [
|
|
20101
|
-
/* @__PURE__ */ (0,
|
|
20102
|
-
/* @__PURE__ */ (0,
|
|
20823
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20824
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20103
20825
|
CustomToolbarButton,
|
|
20104
20826
|
{
|
|
20105
20827
|
type: "button",
|
|
@@ -20107,8 +20829,8 @@ function PricingCardToolbar({
|
|
|
20107
20829
|
"aria-pressed": featuredTag,
|
|
20108
20830
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20109
20831
|
className: "group size-8",
|
|
20110
|
-
children: /* @__PURE__ */ (0,
|
|
20111
|
-
|
|
20832
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20833
|
+
import_lucide_react10.Star,
|
|
20112
20834
|
{
|
|
20113
20835
|
size: 16,
|
|
20114
20836
|
fill: "currentColor",
|
|
@@ -20122,25 +20844,25 @@ function PricingCardToolbar({
|
|
|
20122
20844
|
)
|
|
20123
20845
|
}
|
|
20124
20846
|
) }),
|
|
20125
|
-
/* @__PURE__ */ (0,
|
|
20847
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20126
20848
|
] }),
|
|
20127
|
-
/* @__PURE__ */ (0,
|
|
20128
|
-
/* @__PURE__ */ (0,
|
|
20129
|
-
/* @__PURE__ */ (0,
|
|
20130
|
-
/* @__PURE__ */ (0,
|
|
20131
|
-
/* @__PURE__ */ (0,
|
|
20132
|
-
/* @__PURE__ */ (0,
|
|
20133
|
-
/* @__PURE__ */ (0,
|
|
20849
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20850
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20851
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20852
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
|
|
20853
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
|
|
20854
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
|
|
20855
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
20134
20856
|
] }) }),
|
|
20135
|
-
/* @__PURE__ */ (0,
|
|
20136
|
-
/* @__PURE__ */ (0,
|
|
20137
|
-
/* @__PURE__ */ (0,
|
|
20138
|
-
/* @__PURE__ */ (0,
|
|
20139
|
-
/* @__PURE__ */ (0,
|
|
20857
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
|
|
20858
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
|
|
20859
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20860
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20861
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20140
20862
|
]
|
|
20141
20863
|
}
|
|
20142
20864
|
),
|
|
20143
|
-
error && /* @__PURE__ */ (0,
|
|
20865
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
20144
20866
|
]
|
|
20145
20867
|
}
|
|
20146
20868
|
) });
|
|
@@ -20174,7 +20896,7 @@ function AiPricingCardOverlay({
|
|
|
20174
20896
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20175
20897
|
setHover((prev) => {
|
|
20176
20898
|
const next = ref && !overEditable ? ref : null;
|
|
20177
|
-
return
|
|
20899
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20178
20900
|
});
|
|
20179
20901
|
};
|
|
20180
20902
|
const onLeave = () => setHover(null);
|
|
@@ -20189,10 +20911,10 @@ function AiPricingCardOverlay({
|
|
|
20189
20911
|
const onClick = (e) => {
|
|
20190
20912
|
const t = e.target;
|
|
20191
20913
|
if (!(t instanceof Element)) return;
|
|
20192
|
-
if (t.closest(
|
|
20914
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20193
20915
|
const ref = cardRefFromTarget(t);
|
|
20194
|
-
setActive((prev) =>
|
|
20195
|
-
if (!ref || !
|
|
20916
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20917
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20196
20918
|
};
|
|
20197
20919
|
document.addEventListener("click", onClick, true);
|
|
20198
20920
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20257,12 +20979,12 @@ function AiPricingCardOverlay({
|
|
|
20257
20979
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20258
20980
|
const activeCardRect = useLiveCardRect(active);
|
|
20259
20981
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20260
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20261
|
-
return /* @__PURE__ */ (0,
|
|
20262
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20263
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20264
|
-
/* @__PURE__ */ (0,
|
|
20265
|
-
/* @__PURE__ */ (0,
|
|
20982
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20984
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20985
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20986
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20987
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20266
20988
|
PricingCardToolbar,
|
|
20267
20989
|
{
|
|
20268
20990
|
entry: activeEntry,
|
|
@@ -20290,7 +21012,7 @@ function AiPricingCardOverlay({
|
|
|
20290
21012
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20291
21013
|
}
|
|
20292
21014
|
) }),
|
|
20293
|
-
/* @__PURE__ */ (0,
|
|
21015
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20294
21016
|
"div",
|
|
20295
21017
|
{
|
|
20296
21018
|
"data-ohw-bridge": "",
|
|
@@ -20312,7 +21034,7 @@ function AiPricingCardOverlay({
|
|
|
20312
21034
|
|
|
20313
21035
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20314
21036
|
var import_react15 = require("react");
|
|
20315
|
-
var
|
|
21037
|
+
var import_lucide_react11 = require("lucide-react");
|
|
20316
21038
|
|
|
20317
21039
|
// src/lib/ai-video-tree.ts
|
|
20318
21040
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20354,39 +21076,11 @@ function clearVideo(tree, path) {
|
|
|
20354
21076
|
});
|
|
20355
21077
|
}
|
|
20356
21078
|
|
|
20357
|
-
// src/lib/youtube.ts
|
|
20358
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20359
|
-
function extractYouTubeId(input) {
|
|
20360
|
-
const trimmed = input.trim();
|
|
20361
|
-
if (!trimmed) return null;
|
|
20362
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20363
|
-
let url;
|
|
20364
|
-
try {
|
|
20365
|
-
url = new URL(trimmed);
|
|
20366
|
-
} catch {
|
|
20367
|
-
return null;
|
|
20368
|
-
}
|
|
20369
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20370
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20371
|
-
return null;
|
|
20372
|
-
}
|
|
20373
|
-
let candidate = null;
|
|
20374
|
-
if (host === "youtu.be") {
|
|
20375
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20376
|
-
} else if (url.pathname === "/watch") {
|
|
20377
|
-
candidate = url.searchParams.get("v");
|
|
20378
|
-
} else {
|
|
20379
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20380
|
-
candidate = match ? match[1] : null;
|
|
20381
|
-
}
|
|
20382
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20383
|
-
}
|
|
20384
|
-
|
|
20385
21079
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20386
|
-
var
|
|
21080
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
20387
21081
|
var PRIMARY5 = "#0885FE";
|
|
20388
|
-
var
|
|
20389
|
-
var
|
|
21082
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
21083
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20390
21084
|
function findVideoBlockElement(sectionId, path) {
|
|
20391
21085
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20392
21086
|
if (!sectionEl2) return null;
|
|
@@ -20446,12 +21140,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20446
21140
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20447
21141
|
});
|
|
20448
21142
|
}
|
|
20449
|
-
function
|
|
21143
|
+
function Pill({
|
|
20450
21144
|
label,
|
|
20451
21145
|
onClick,
|
|
20452
21146
|
disabled
|
|
20453
21147
|
}) {
|
|
20454
|
-
return /* @__PURE__ */ (0,
|
|
21148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20455
21149
|
"button",
|
|
20456
21150
|
{
|
|
20457
21151
|
type: "button",
|
|
@@ -20467,7 +21161,7 @@ function Pill2({
|
|
|
20467
21161
|
border: "none",
|
|
20468
21162
|
cursor: disabled ? "default" : "pointer",
|
|
20469
21163
|
background: "#ffffff",
|
|
20470
|
-
color:
|
|
21164
|
+
color: OHW_BLUE_DARK,
|
|
20471
21165
|
opacity: disabled ? 0.4 : 1,
|
|
20472
21166
|
fontSize: 12,
|
|
20473
21167
|
lineHeight: "16px",
|
|
@@ -20510,8 +21204,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20510
21204
|
onCommit(id);
|
|
20511
21205
|
}
|
|
20512
21206
|
};
|
|
20513
|
-
return /* @__PURE__ */ (0,
|
|
20514
|
-
/* @__PURE__ */ (0,
|
|
21207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
21208
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20515
21209
|
"div",
|
|
20516
21210
|
{
|
|
20517
21211
|
style: {
|
|
@@ -20527,12 +21221,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20527
21221
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20528
21222
|
},
|
|
20529
21223
|
children: [
|
|
20530
|
-
/* @__PURE__ */ (0,
|
|
21224
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20531
21225
|
"span",
|
|
20532
21226
|
{
|
|
20533
21227
|
style: {
|
|
20534
21228
|
flex: "0 0 auto",
|
|
20535
|
-
color:
|
|
21229
|
+
color: OHW_BLUE_DARK,
|
|
20536
21230
|
fontSize: 10,
|
|
20537
21231
|
lineHeight: "16px",
|
|
20538
21232
|
fontWeight: 700,
|
|
@@ -20542,7 +21236,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20542
21236
|
children: "Video"
|
|
20543
21237
|
}
|
|
20544
21238
|
),
|
|
20545
|
-
/* @__PURE__ */ (0,
|
|
21239
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20546
21240
|
"input",
|
|
20547
21241
|
{
|
|
20548
21242
|
type: "text",
|
|
@@ -20579,7 +21273,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20579
21273
|
]
|
|
20580
21274
|
}
|
|
20581
21275
|
),
|
|
20582
|
-
invalid && /* @__PURE__ */ (0,
|
|
21276
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20583
21277
|
] });
|
|
20584
21278
|
}
|
|
20585
21279
|
function VideoToolbar({
|
|
@@ -20589,7 +21283,7 @@ function VideoToolbar({
|
|
|
20589
21283
|
onSetVideoId,
|
|
20590
21284
|
onRemove
|
|
20591
21285
|
}) {
|
|
20592
|
-
return /* @__PURE__ */ (0,
|
|
21286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20593
21287
|
"div",
|
|
20594
21288
|
{
|
|
20595
21289
|
"data-ohw-bridge": "",
|
|
@@ -20601,7 +21295,7 @@ function VideoToolbar({
|
|
|
20601
21295
|
gap: 6,
|
|
20602
21296
|
alignItems: "center",
|
|
20603
21297
|
width: 280,
|
|
20604
|
-
background:
|
|
21298
|
+
background: OHW_BLUE,
|
|
20605
21299
|
padding: 8,
|
|
20606
21300
|
borderRadius: 12,
|
|
20607
21301
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20609,9 +21303,9 @@ function VideoToolbar({
|
|
|
20609
21303
|
opacity: pending ? 0.6 : 1
|
|
20610
21304
|
},
|
|
20611
21305
|
children: [
|
|
20612
|
-
/* @__PURE__ */ (0,
|
|
20613
|
-
/* @__PURE__ */ (0,
|
|
20614
|
-
error && /* @__PURE__ */ (0,
|
|
21306
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
21307
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
21308
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20615
21309
|
]
|
|
20616
21310
|
}
|
|
20617
21311
|
);
|
|
@@ -20731,8 +21425,8 @@ function AiVideoOverlay({
|
|
|
20731
21425
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20732
21426
|
const TOOLBAR_APPROX_H = 90;
|
|
20733
21427
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20734
|
-
return /* @__PURE__ */ (0,
|
|
20735
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
21429
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20736
21430
|
"button",
|
|
20737
21431
|
{
|
|
20738
21432
|
type: "button",
|
|
@@ -20760,15 +21454,15 @@ function AiVideoOverlay({
|
|
|
20760
21454
|
fontSize: 14,
|
|
20761
21455
|
fontWeight: 700
|
|
20762
21456
|
},
|
|
20763
|
-
children: /* @__PURE__ */ (0,
|
|
21457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
20764
21458
|
}
|
|
20765
21459
|
),
|
|
20766
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21460
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20767
21461
|
ItemInteractionLayer,
|
|
20768
21462
|
{
|
|
20769
21463
|
rect: activeBlockRect,
|
|
20770
21464
|
state: toolbarState,
|
|
20771
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21465
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20772
21466
|
VideoToolbar,
|
|
20773
21467
|
{
|
|
20774
21468
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20792,7 +21486,7 @@ function AiVideoOverlay({
|
|
|
20792
21486
|
|
|
20793
21487
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20794
21488
|
var import_react16 = require("react");
|
|
20795
|
-
var
|
|
21489
|
+
var import_lucide_react12 = require("lucide-react");
|
|
20796
21490
|
|
|
20797
21491
|
// src/lib/ai-carousel-tree.ts
|
|
20798
21492
|
function isCarouselBlock(node) {
|
|
@@ -20843,10 +21537,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20843
21537
|
}
|
|
20844
21538
|
|
|
20845
21539
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20846
|
-
var
|
|
21540
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
20847
21541
|
var PRIMARY6 = "#0885FE";
|
|
20848
|
-
var
|
|
20849
|
-
var
|
|
21542
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21543
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20850
21544
|
function findCarouselItemElement(sectionId, index) {
|
|
20851
21545
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20852
21546
|
if (!sectionEl2) return null;
|
|
@@ -20925,8 +21619,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20925
21619
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20926
21620
|
});
|
|
20927
21621
|
}
|
|
20928
|
-
function
|
|
20929
|
-
return /* @__PURE__ */ (0,
|
|
21622
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20930
21624
|
"button",
|
|
20931
21625
|
{
|
|
20932
21626
|
type: "button",
|
|
@@ -20942,7 +21636,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20942
21636
|
border: "none",
|
|
20943
21637
|
cursor: disabled ? "default" : "pointer",
|
|
20944
21638
|
background: "#ffffff",
|
|
20945
|
-
color:
|
|
21639
|
+
color: OHW_BLUE_DARK2,
|
|
20946
21640
|
opacity: disabled ? 0.4 : 1,
|
|
20947
21641
|
fontSize: 12,
|
|
20948
21642
|
lineHeight: "16px",
|
|
@@ -20960,7 +21654,7 @@ function TogglePill({
|
|
|
20960
21654
|
onToggle,
|
|
20961
21655
|
disabled
|
|
20962
21656
|
}) {
|
|
20963
|
-
return /* @__PURE__ */ (0,
|
|
21657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
20964
21658
|
"button",
|
|
20965
21659
|
{
|
|
20966
21660
|
type: "button",
|
|
@@ -20979,7 +21673,7 @@ function TogglePill({
|
|
|
20979
21673
|
border: "none",
|
|
20980
21674
|
cursor: disabled ? "default" : "pointer",
|
|
20981
21675
|
background: "#ffffff",
|
|
20982
|
-
color:
|
|
21676
|
+
color: OHW_BLUE_DARK2,
|
|
20983
21677
|
opacity: disabled ? 0.4 : 1,
|
|
20984
21678
|
fontSize: 12,
|
|
20985
21679
|
lineHeight: "16px",
|
|
@@ -20989,7 +21683,7 @@ function TogglePill({
|
|
|
20989
21683
|
},
|
|
20990
21684
|
children: [
|
|
20991
21685
|
label,
|
|
20992
|
-
/* @__PURE__ */ (0,
|
|
21686
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
20993
21687
|
"span",
|
|
20994
21688
|
{
|
|
20995
21689
|
"aria-hidden": true,
|
|
@@ -21002,10 +21696,10 @@ function TogglePill({
|
|
|
21002
21696
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
21003
21697
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
21004
21698
|
// "disabled control" rather than "switch that is off".
|
|
21005
|
-
background: on ?
|
|
21699
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
21006
21700
|
transition: "background 120ms ease"
|
|
21007
21701
|
},
|
|
21008
|
-
children: /* @__PURE__ */ (0,
|
|
21702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21009
21703
|
"span",
|
|
21010
21704
|
{
|
|
21011
21705
|
style: {
|
|
@@ -21034,7 +21728,7 @@ function CarouselSlideToolbar({
|
|
|
21034
21728
|
onChangeImage,
|
|
21035
21729
|
onToggleAutoplay
|
|
21036
21730
|
}) {
|
|
21037
|
-
return /* @__PURE__ */ (0,
|
|
21731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21038
21732
|
"div",
|
|
21039
21733
|
{
|
|
21040
21734
|
"data-ohw-bridge": "",
|
|
@@ -21045,7 +21739,7 @@ function CarouselSlideToolbar({
|
|
|
21045
21739
|
flexDirection: "column",
|
|
21046
21740
|
gap: 6,
|
|
21047
21741
|
alignItems: "center",
|
|
21048
|
-
background:
|
|
21742
|
+
background: OHW_BLUE2,
|
|
21049
21743
|
padding: 8,
|
|
21050
21744
|
borderRadius: 12,
|
|
21051
21745
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21057,11 +21751,11 @@ function CarouselSlideToolbar({
|
|
|
21057
21751
|
pointerEvents: pending ? "none" : "auto"
|
|
21058
21752
|
},
|
|
21059
21753
|
children: [
|
|
21060
|
-
/* @__PURE__ */ (0,
|
|
21061
|
-
/* @__PURE__ */ (0,
|
|
21062
|
-
/* @__PURE__ */ (0,
|
|
21754
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21755
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21756
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21063
21757
|
] }),
|
|
21064
|
-
error && /* @__PURE__ */ (0,
|
|
21758
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21065
21759
|
]
|
|
21066
21760
|
}
|
|
21067
21761
|
);
|
|
@@ -21201,8 +21895,8 @@ function AiFadeCarouselOverlay({
|
|
|
21201
21895
|
const activeItemRect = useLiveItemRect2(active);
|
|
21202
21896
|
const TOOLBAR_APPROX_H = 90;
|
|
21203
21897
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21204
|
-
return /* @__PURE__ */ (0,
|
|
21205
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
21899
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21206
21900
|
"button",
|
|
21207
21901
|
{
|
|
21208
21902
|
type: "button",
|
|
@@ -21231,10 +21925,10 @@ function AiFadeCarouselOverlay({
|
|
|
21231
21925
|
fontSize: 14,
|
|
21232
21926
|
fontWeight: 700
|
|
21233
21927
|
},
|
|
21234
|
-
children: /* @__PURE__ */ (0,
|
|
21928
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21235
21929
|
}
|
|
21236
21930
|
),
|
|
21237
|
-
swapping && /* @__PURE__ */ (0,
|
|
21931
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21238
21932
|
"div",
|
|
21239
21933
|
{
|
|
21240
21934
|
ref: skeletonRef,
|
|
@@ -21252,15 +21946,15 @@ function AiFadeCarouselOverlay({
|
|
|
21252
21946
|
zIndex: 2147483646,
|
|
21253
21947
|
pointerEvents: "none"
|
|
21254
21948
|
},
|
|
21255
|
-
children: /* @__PURE__ */ (0,
|
|
21949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21256
21950
|
}
|
|
21257
21951
|
),
|
|
21258
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21952
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21259
21953
|
ItemInteractionLayer,
|
|
21260
21954
|
{
|
|
21261
21955
|
rect: activeItemRect,
|
|
21262
21956
|
state: toolbarState,
|
|
21263
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21957
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21264
21958
|
CarouselSlideToolbar,
|
|
21265
21959
|
{
|
|
21266
21960
|
pending,
|
|
@@ -21451,113 +22145,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21451
22145
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21452
22146
|
var import_react20 = require("react");
|
|
21453
22147
|
|
|
21454
|
-
// src/ui/dialog.tsx
|
|
21455
|
-
var React9 = __toESM(require("react"), 1);
|
|
21456
|
-
var import_radix_ui6 = require("radix-ui");
|
|
21457
|
-
var import_lucide_react12 = require("lucide-react");
|
|
21458
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
21459
|
-
function Dialog2({
|
|
21460
|
-
...props
|
|
21461
|
-
}) {
|
|
21462
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21463
|
-
}
|
|
21464
|
-
function DialogPortal({
|
|
21465
|
-
...props
|
|
21466
|
-
}) {
|
|
21467
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21468
|
-
}
|
|
21469
|
-
function DialogOverlay({
|
|
21470
|
-
className,
|
|
21471
|
-
...props
|
|
21472
|
-
}) {
|
|
21473
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21474
|
-
import_radix_ui6.Dialog.Overlay,
|
|
21475
|
-
{
|
|
21476
|
-
"data-slot": "dialog-overlay",
|
|
21477
|
-
"data-ohw-link-modal-root": "",
|
|
21478
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21479
|
-
...props
|
|
21480
|
-
}
|
|
21481
|
-
);
|
|
21482
|
-
}
|
|
21483
|
-
var DialogContent = React9.forwardRef(
|
|
21484
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21485
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21486
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21487
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21488
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21489
|
-
import_radix_ui6.Dialog.Content,
|
|
21490
|
-
{
|
|
21491
|
-
ref,
|
|
21492
|
-
"data-slot": "dialog-content",
|
|
21493
|
-
className: cn(
|
|
21494
|
-
positionMode,
|
|
21495
|
-
"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",
|
|
21496
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21497
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21498
|
-
className
|
|
21499
|
-
),
|
|
21500
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21501
|
-
...props,
|
|
21502
|
-
children: [
|
|
21503
|
-
children,
|
|
21504
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21505
|
-
import_radix_ui6.Dialog.Close,
|
|
21506
|
-
{
|
|
21507
|
-
type: "button",
|
|
21508
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21509
|
-
"aria-label": "Close",
|
|
21510
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
21511
|
-
}
|
|
21512
|
-
) : null
|
|
21513
|
-
]
|
|
21514
|
-
}
|
|
21515
|
-
)
|
|
21516
|
-
] });
|
|
21517
|
-
}
|
|
21518
|
-
);
|
|
21519
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21520
|
-
function DialogHeader({
|
|
21521
|
-
className,
|
|
21522
|
-
...props
|
|
21523
|
-
}) {
|
|
21524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21525
|
-
}
|
|
21526
|
-
function DialogFooter({
|
|
21527
|
-
className,
|
|
21528
|
-
...props
|
|
21529
|
-
}) {
|
|
21530
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21531
|
-
"div",
|
|
21532
|
-
{
|
|
21533
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21534
|
-
...props
|
|
21535
|
-
}
|
|
21536
|
-
);
|
|
21537
|
-
}
|
|
21538
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21539
|
-
import_radix_ui6.Dialog.Title,
|
|
21540
|
-
{
|
|
21541
|
-
ref,
|
|
21542
|
-
className: cn(
|
|
21543
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21544
|
-
className
|
|
21545
|
-
),
|
|
21546
|
-
...props
|
|
21547
|
-
}
|
|
21548
|
-
));
|
|
21549
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21550
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21551
|
-
import_radix_ui6.Dialog.Description,
|
|
21552
|
-
{
|
|
21553
|
-
ref,
|
|
21554
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21555
|
-
...props
|
|
21556
|
-
}
|
|
21557
|
-
));
|
|
21558
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21559
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21560
|
-
|
|
21561
22148
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21562
22149
|
var import_lucide_react16 = require("lucide-react");
|
|
21563
22150
|
|
|
@@ -22661,6 +23248,7 @@ function shouldUseDevFixtures() {
|
|
|
22661
23248
|
function getLogoElement(el) {
|
|
22662
23249
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22663
23250
|
if (marked) return marked;
|
|
23251
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22664
23252
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22665
23253
|
if (!root) return null;
|
|
22666
23254
|
const anchor = el.closest("a");
|
|
@@ -23997,12 +24585,19 @@ function useSectionDrag({
|
|
|
23997
24585
|
clearSectionDragVisuals();
|
|
23998
24586
|
return;
|
|
23999
24587
|
}
|
|
24588
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
24000
24589
|
const orderJson = JSON.stringify(
|
|
24001
24590
|
mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname, entries)
|
|
24002
24591
|
);
|
|
24003
24592
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
24004
24593
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
24005
|
-
postToParentRef.current({
|
|
24594
|
+
postToParentRef.current({
|
|
24595
|
+
type: "ow:change",
|
|
24596
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
24597
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
24598
|
+
// Undo scrolls to this section; a one-place move swaps two, so the order alone can't say which.
|
|
24599
|
+
moved: session.instanceId
|
|
24600
|
+
});
|
|
24006
24601
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
24007
24602
|
clearSectionDragVisuals();
|
|
24008
24603
|
requestAnimationFrame(() => {
|
|
@@ -25470,7 +26065,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25470
26065
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25471
26066
|
return resolveFooterLinksContainerFrom(el);
|
|
25472
26067
|
}
|
|
25473
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
26068
|
+
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)) {
|
|
25474
26069
|
return getNavigationRoot(el);
|
|
25475
26070
|
}
|
|
25476
26071
|
return null;
|
|
@@ -25692,7 +26287,6 @@ var ICONS = {
|
|
|
25692
26287
|
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"/>',
|
|
25693
26288
|
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"/>'
|
|
25694
26289
|
};
|
|
25695
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25696
26290
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25697
26291
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25698
26292
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25790,7 +26384,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25790
26384
|
el.style.top = `${top}px`;
|
|
25791
26385
|
el.style.height = `${height}px`;
|
|
25792
26386
|
}
|
|
25793
|
-
var
|
|
26387
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25794
26388
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25795
26389
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25796
26390
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25817,8 +26411,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25817
26411
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25818
26412
|
const half = toolbarWidth / 2;
|
|
25819
26413
|
return Math.max(
|
|
25820
|
-
|
|
25821
|
-
Math.min(centerX, window.innerWidth -
|
|
26414
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26415
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25822
26416
|
);
|
|
25823
26417
|
}
|
|
25824
26418
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25940,7 +26534,10 @@ function FloatingToolbar({
|
|
|
25940
26534
|
onCommand,
|
|
25941
26535
|
activeCommands,
|
|
25942
26536
|
showEditLink,
|
|
25943
|
-
onEditLink
|
|
26537
|
+
onEditLink,
|
|
26538
|
+
showDelete,
|
|
26539
|
+
onDelete,
|
|
26540
|
+
deleteDisabled
|
|
25944
26541
|
}) {
|
|
25945
26542
|
const localRef = import_react25.default.useRef(null);
|
|
25946
26543
|
const [measuredW, setMeasuredW] = import_react25.default.useState(330);
|
|
@@ -25967,7 +26564,7 @@ function FloatingToolbar({
|
|
|
25967
26564
|
const ro = new ResizeObserver(update);
|
|
25968
26565
|
ro.observe(node);
|
|
25969
26566
|
return () => ro.disconnect();
|
|
25970
|
-
}, [showEditLink, activeCommands]);
|
|
26567
|
+
}, [showEditLink, showDelete, activeCommands]);
|
|
25971
26568
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
25972
26569
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
25973
26570
|
"div",
|
|
@@ -26032,7 +26629,28 @@ function FloatingToolbar({
|
|
|
26032
26629
|
},
|
|
26033
26630
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
26034
26631
|
}
|
|
26035
|
-
) : null
|
|
26632
|
+
) : null,
|
|
26633
|
+
showDelete ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
26634
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
26635
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
26636
|
+
CustomToolbarButton,
|
|
26637
|
+
{
|
|
26638
|
+
type: "button",
|
|
26639
|
+
title: "Delete",
|
|
26640
|
+
disabled: deleteDisabled,
|
|
26641
|
+
onMouseDown: (e) => {
|
|
26642
|
+
e.preventDefault();
|
|
26643
|
+
e.stopPropagation();
|
|
26644
|
+
if (!deleteDisabled) onDelete?.();
|
|
26645
|
+
},
|
|
26646
|
+
onClick: (e) => {
|
|
26647
|
+
e.preventDefault();
|
|
26648
|
+
e.stopPropagation();
|
|
26649
|
+
},
|
|
26650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
26651
|
+
}
|
|
26652
|
+
)
|
|
26653
|
+
] }) : null
|
|
26036
26654
|
] })
|
|
26037
26655
|
}
|
|
26038
26656
|
);
|
|
@@ -26646,6 +27264,8 @@ function OhhwellsBridge() {
|
|
|
26646
27264
|
const [activeCommands, setActiveCommands] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
|
|
26647
27265
|
const [sectionGap, setSectionGap] = (0, import_react25.useState)(null);
|
|
26648
27266
|
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react25.useState)(false);
|
|
27267
|
+
const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0, import_react25.useState)(false);
|
|
27268
|
+
const deletingAiBlockRef = (0, import_react25.useRef)(false);
|
|
26649
27269
|
const hoveredNavContainerRef = (0, import_react25.useRef)(null);
|
|
26650
27270
|
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react25.useState)(null);
|
|
26651
27271
|
const hoveredItemElRef = (0, import_react25.useRef)(null);
|
|
@@ -26701,21 +27321,6 @@ function OhhwellsBridge() {
|
|
|
26701
27321
|
const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
|
|
26702
27322
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
|
|
26703
27323
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26704
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26705
|
-
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26706
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26707
|
-
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26708
|
-
floatingPanelRef.current = floatingPanel;
|
|
26709
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26710
|
-
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26711
|
-
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26712
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26713
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26714
|
-
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26715
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26716
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26717
|
-
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26718
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26719
27324
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
|
|
26720
27325
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
|
|
26721
27326
|
const footerDragRef = (0, import_react25.useRef)(null);
|
|
@@ -26742,6 +27347,21 @@ function OhhwellsBridge() {
|
|
|
26742
27347
|
const stylesRef = (0, import_react25.useRef)("");
|
|
26743
27348
|
const appliedDrawerRef = (0, import_react25.useRef)(null);
|
|
26744
27349
|
const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
|
|
27350
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
27351
|
+
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
27352
|
+
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
27353
|
+
floatingPanelRef.current = floatingPanel;
|
|
27354
|
+
const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
|
|
27355
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
27356
|
+
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
27357
|
+
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
27358
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
27359
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
27360
|
+
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
27361
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
27362
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
27363
|
+
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
27364
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26745
27365
|
const [sitePages, setSitePages] = (0, import_react25.useState)([]);
|
|
26746
27366
|
const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
26747
27367
|
const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
|
|
@@ -26751,7 +27371,18 @@ function OhhwellsBridge() {
|
|
|
26751
27371
|
const linkPopoverOpenRef = (0, import_react25.useRef)(false);
|
|
26752
27372
|
const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
|
|
26753
27373
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27374
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26754
27375
|
linkPopoverSessionRef.current = linkPopover;
|
|
27376
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
27377
|
+
(0, import_react25.useEffect)(() => {
|
|
27378
|
+
const syncViewport = () => {
|
|
27379
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
27380
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
27381
|
+
};
|
|
27382
|
+
syncViewport();
|
|
27383
|
+
window.addEventListener("resize", syncViewport);
|
|
27384
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
27385
|
+
}, []);
|
|
26755
27386
|
(0, import_react25.useEffect)(() => {
|
|
26756
27387
|
setSectionOrderPersistHandler((entries) => {
|
|
26757
27388
|
const currentPath = window.location.pathname;
|
|
@@ -27058,6 +27689,7 @@ function OhhwellsBridge() {
|
|
|
27058
27689
|
setMaxBadge(null);
|
|
27059
27690
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27060
27691
|
setToolbarShowEditLink(false);
|
|
27692
|
+
setToolbarShowAiBlockDelete(false);
|
|
27061
27693
|
postToParent2({ type: "ow:exit-edit" });
|
|
27062
27694
|
}, [postToParent2]);
|
|
27063
27695
|
const clearSelectedAttr = (0, import_react25.useCallback)(() => {
|
|
@@ -27228,6 +27860,7 @@ function OhhwellsBridge() {
|
|
|
27228
27860
|
setMaxBadge(null);
|
|
27229
27861
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27230
27862
|
setToolbarShowEditLink(false);
|
|
27863
|
+
setToolbarShowAiBlockDelete(false);
|
|
27231
27864
|
postToParent2({ type: "ow:exit-edit" });
|
|
27232
27865
|
reselectNavigationItem(navAnchor);
|
|
27233
27866
|
}, [postToParent2, reselectNavigationItem]);
|
|
@@ -28398,6 +29031,13 @@ function OhhwellsBridge() {
|
|
|
28398
29031
|
}
|
|
28399
29032
|
}
|
|
28400
29033
|
setToolbarShowEditLink(Boolean(getHrefKeyFromElement(el)));
|
|
29034
|
+
setToolbarShowAiBlockDelete(
|
|
29035
|
+
canRemoveAiBlock(aiSectionsRef.current, el.dataset.ohwKey ?? null) || canSoftHideEditable(el, {
|
|
29036
|
+
isNavFooterItem: Boolean(
|
|
29037
|
+
getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
|
|
29038
|
+
)
|
|
29039
|
+
})
|
|
29040
|
+
);
|
|
28401
29041
|
const navAnchor = getNavigationItemAnchor(el);
|
|
28402
29042
|
if (navAnchor) {
|
|
28403
29043
|
if (isNestedNavChild(navAnchor)) {
|
|
@@ -28485,6 +29125,7 @@ function OhhwellsBridge() {
|
|
|
28485
29125
|
applyAiFooterFromContent(content);
|
|
28486
29126
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28487
29127
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
29128
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28488
29129
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28489
29130
|
}
|
|
28490
29131
|
applyBrandChrome(content);
|
|
@@ -28495,15 +29136,16 @@ function OhhwellsBridge() {
|
|
|
28495
29136
|
if (key === "__ohw_sections") continue;
|
|
28496
29137
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28497
29138
|
if (key === AI_FOOTER_KEY) continue;
|
|
29139
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29140
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28498
29141
|
if (key === BRAND_KIT_KEY) continue;
|
|
28499
29142
|
if (key === STYLE_STORE_KEY) continue;
|
|
28500
29143
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28501
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28502
29144
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28503
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28504
29145
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28505
29146
|
continue;
|
|
28506
29147
|
}
|
|
29148
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28507
29149
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28508
29150
|
if (applyCarouselNode(key, val)) continue;
|
|
28509
29151
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28543,6 +29185,7 @@ function OhhwellsBridge() {
|
|
|
28543
29185
|
});
|
|
28544
29186
|
applyLinkByKey(key, val);
|
|
28545
29187
|
}
|
|
29188
|
+
applySectionEmbeds(content);
|
|
28546
29189
|
applyLogoFromContent(content);
|
|
28547
29190
|
applyLogoSizes(content);
|
|
28548
29191
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28551,6 +29194,7 @@ function OhhwellsBridge() {
|
|
|
28551
29194
|
applySocialsDisplayFromContent(content);
|
|
28552
29195
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28553
29196
|
syncButtonsFromContent(document, content);
|
|
29197
|
+
applyHiddenEditablesToDom(content);
|
|
28554
29198
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28555
29199
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28556
29200
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -28731,20 +29375,22 @@ function OhhwellsBridge() {
|
|
|
28731
29375
|
}
|
|
28732
29376
|
applyAiFooterFromContent(content);
|
|
28733
29377
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
29378
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28734
29379
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28735
29380
|
}
|
|
28736
29381
|
for (const [key, val] of Object.entries(content)) {
|
|
28737
29382
|
if (key === "__ohw_sections") continue;
|
|
28738
29383
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28739
29384
|
if (key === AI_FOOTER_KEY) continue;
|
|
29385
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29386
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28740
29387
|
if (key === BRAND_KIT_KEY) continue;
|
|
28741
29388
|
if (key === STYLE_STORE_KEY) continue;
|
|
28742
29389
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28743
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28744
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28745
29390
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28746
29391
|
continue;
|
|
28747
29392
|
}
|
|
29393
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28748
29394
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28749
29395
|
if (applyCarouselNode(key, val)) continue;
|
|
28750
29396
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28769,6 +29415,7 @@ function OhhwellsBridge() {
|
|
|
28769
29415
|
});
|
|
28770
29416
|
applyLinkByKey(key, val);
|
|
28771
29417
|
}
|
|
29418
|
+
applySectionEmbeds(content);
|
|
28772
29419
|
applyLogoFromContent(content);
|
|
28773
29420
|
reconcileNavbarItemsFromContent(content);
|
|
28774
29421
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28776,6 +29423,7 @@ function OhhwellsBridge() {
|
|
|
28776
29423
|
applySocialsDisplayFromContent(content);
|
|
28777
29424
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28778
29425
|
syncButtonsFromContent(document, content);
|
|
29426
|
+
applyHiddenEditablesToDom(content);
|
|
28779
29427
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28780
29428
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28781
29429
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -28914,6 +29562,7 @@ function OhhwellsBridge() {
|
|
|
28914
29562
|
applySocialsDisplayFromContent(content);
|
|
28915
29563
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28916
29564
|
syncButtonsFromContent(document, content);
|
|
29565
|
+
applyHiddenEditablesToDom(content);
|
|
28917
29566
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28918
29567
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
28919
29568
|
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
|
|
@@ -29008,26 +29657,11 @@ function OhhwellsBridge() {
|
|
|
29008
29657
|
const t2 = setTimeout(measure, 500);
|
|
29009
29658
|
const ro = new ResizeObserver(schedule);
|
|
29010
29659
|
ro.observe(document.body);
|
|
29011
|
-
let lastWidth = window.innerWidth;
|
|
29012
|
-
let resizeTimers = [];
|
|
29013
|
-
const clearResizeTimers = () => {
|
|
29014
|
-
resizeTimers.forEach(clearTimeout);
|
|
29015
|
-
resizeTimers = [];
|
|
29016
|
-
};
|
|
29017
|
-
const handleResize = () => {
|
|
29018
|
-
if (window.innerWidth === lastWidth) return;
|
|
29019
|
-
lastWidth = window.innerWidth;
|
|
29020
|
-
clearResizeTimers();
|
|
29021
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29022
|
-
};
|
|
29023
|
-
window.addEventListener("resize", handleResize);
|
|
29024
29660
|
return () => {
|
|
29025
29661
|
clearTimeout(t1);
|
|
29026
29662
|
clearTimeout(t2);
|
|
29027
29663
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29028
29664
|
ro.disconnect();
|
|
29029
|
-
clearResizeTimers();
|
|
29030
|
-
window.removeEventListener("resize", handleResize);
|
|
29031
29665
|
};
|
|
29032
29666
|
}, [pathname, isEditMode, postToParent2]);
|
|
29033
29667
|
(0, import_react25.useEffect)(() => {
|
|
@@ -29324,6 +29958,13 @@ function OhhwellsBridge() {
|
|
|
29324
29958
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29325
29959
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29326
29960
|
if (isInsideLinkEditor(target)) return;
|
|
29961
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29962
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29963
|
+
if (target.closest(
|
|
29964
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29965
|
+
)) {
|
|
29966
|
+
return;
|
|
29967
|
+
}
|
|
29327
29968
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29328
29969
|
clearMediaSelectionRef.current();
|
|
29329
29970
|
}
|
|
@@ -29347,8 +29988,6 @@ function OhhwellsBridge() {
|
|
|
29347
29988
|
return;
|
|
29348
29989
|
}
|
|
29349
29990
|
}
|
|
29350
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29351
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29352
29991
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29353
29992
|
if (collectionItem) {
|
|
29354
29993
|
e.preventDefault();
|
|
@@ -29360,11 +29999,6 @@ function OhhwellsBridge() {
|
|
|
29360
29999
|
});
|
|
29361
30000
|
return;
|
|
29362
30001
|
}
|
|
29363
|
-
if (target.closest(
|
|
29364
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29365
|
-
)) {
|
|
29366
|
-
return;
|
|
29367
|
-
}
|
|
29368
30002
|
{
|
|
29369
30003
|
const formEl = getFormElement(target);
|
|
29370
30004
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29518,9 +30152,13 @@ function OhhwellsBridge() {
|
|
|
29518
30152
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29519
30153
|
e.preventDefault();
|
|
29520
30154
|
e.stopPropagation();
|
|
29521
|
-
selectIconElementRef.current(editable);
|
|
29522
30155
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29523
30156
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
30157
|
+
if (aiIcon) {
|
|
30158
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
30159
|
+
} else {
|
|
30160
|
+
selectIconElementRef.current(editable);
|
|
30161
|
+
}
|
|
29524
30162
|
postToParentRef.current({
|
|
29525
30163
|
type: "ow:icon-pick",
|
|
29526
30164
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29748,6 +30386,9 @@ function OhhwellsBridge() {
|
|
|
29748
30386
|
setHoveredItemRect(null);
|
|
29749
30387
|
hoveredNavContainerRef.current = null;
|
|
29750
30388
|
setHoveredNavContainerRect(null);
|
|
30389
|
+
siblingHintElRef.current = null;
|
|
30390
|
+
setSiblingHintRect(null);
|
|
30391
|
+
setSiblingHintRects([]);
|
|
29751
30392
|
return;
|
|
29752
30393
|
}
|
|
29753
30394
|
{
|
|
@@ -29868,7 +30509,6 @@ function OhhwellsBridge() {
|
|
|
29868
30509
|
hoveredNavContainerRef.current = null;
|
|
29869
30510
|
setHoveredNavContainerRect(null);
|
|
29870
30511
|
hoveredItemElRef.current = editable;
|
|
29871
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29872
30512
|
}
|
|
29873
30513
|
}
|
|
29874
30514
|
}
|
|
@@ -30578,7 +31218,11 @@ function OhhwellsBridge() {
|
|
|
30578
31218
|
};
|
|
30579
31219
|
const handleMouseMove = (e) => {
|
|
30580
31220
|
const { clientX, clientY } = e;
|
|
30581
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31221
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31222
|
+
dismissImageHover();
|
|
31223
|
+
clearImageHover();
|
|
31224
|
+
return;
|
|
31225
|
+
}
|
|
30582
31226
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30583
31227
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30584
31228
|
formHoverElRef.current = null;
|
|
@@ -30607,7 +31251,12 @@ function OhhwellsBridge() {
|
|
|
30607
31251
|
setHoveredItemRect(null);
|
|
30608
31252
|
hoveredNavContainerRef.current = null;
|
|
30609
31253
|
setHoveredNavContainerRect(null);
|
|
31254
|
+
siblingHintElRef.current = null;
|
|
31255
|
+
setSiblingHintRect(null);
|
|
31256
|
+
setSiblingHintRects([]);
|
|
30610
31257
|
dismissImageHover();
|
|
31258
|
+
clearImageHover();
|
|
31259
|
+
setSectionGap(null);
|
|
30611
31260
|
return;
|
|
30612
31261
|
}
|
|
30613
31262
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30619,7 +31268,11 @@ function OhhwellsBridge() {
|
|
|
30619
31268
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30620
31269
|
const { clientX, clientY } = e.data;
|
|
30621
31270
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30622
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31271
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31272
|
+
dismissImageHover();
|
|
31273
|
+
clearImageHover();
|
|
31274
|
+
return;
|
|
31275
|
+
}
|
|
30623
31276
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30624
31277
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30625
31278
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30999,6 +31652,7 @@ function OhhwellsBridge() {
|
|
|
30999
31652
|
applyAiFooterFromContent(content);
|
|
31000
31653
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31001
31654
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31655
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31002
31656
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31003
31657
|
}
|
|
31004
31658
|
applyBrandChrome(content);
|
|
@@ -31013,15 +31667,16 @@ function OhhwellsBridge() {
|
|
|
31013
31667
|
}
|
|
31014
31668
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31015
31669
|
if (key === AI_FOOTER_KEY) continue;
|
|
31670
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31671
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31016
31672
|
if (key === BRAND_KIT_KEY) continue;
|
|
31017
31673
|
if (key === STYLE_STORE_KEY) continue;
|
|
31018
31674
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31019
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31020
31675
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31021
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31022
31676
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31023
31677
|
continue;
|
|
31024
31678
|
}
|
|
31679
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31025
31680
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31026
31681
|
if (applyCarouselNode(key, val)) continue;
|
|
31027
31682
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31047,6 +31702,7 @@ function OhhwellsBridge() {
|
|
|
31047
31702
|
});
|
|
31048
31703
|
applyLinkByKey(key, val);
|
|
31049
31704
|
}
|
|
31705
|
+
applySectionEmbeds(content);
|
|
31050
31706
|
applyLogoFromContent(content);
|
|
31051
31707
|
applyLogoSizes(content);
|
|
31052
31708
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31061,6 +31717,8 @@ function OhhwellsBridge() {
|
|
|
31061
31717
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
31062
31718
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
31063
31719
|
syncButtonsFromContent(document, editContentRef.current);
|
|
31720
|
+
applyHiddenEditablesToDom(editContentRef.current);
|
|
31721
|
+
if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
|
|
31064
31722
|
syncNavigationDragCursorAttrs();
|
|
31065
31723
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31066
31724
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -31492,6 +32150,7 @@ function OhhwellsBridge() {
|
|
|
31492
32150
|
const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
|
|
31493
32151
|
const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
|
|
31494
32152
|
if (!instanceId || !direction) return;
|
|
32153
|
+
const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
|
|
31495
32154
|
const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
|
|
31496
32155
|
if (!entries) return;
|
|
31497
32156
|
const orderJson = JSON.stringify(
|
|
@@ -31500,7 +32159,12 @@ function OhhwellsBridge() {
|
|
|
31500
32159
|
editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
|
|
31501
32160
|
applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
|
|
31502
32161
|
setAiSectionOrder(orderJson, window.location.pathname);
|
|
31503
|
-
postToParentRef.current({
|
|
32162
|
+
postToParentRef.current({
|
|
32163
|
+
type: "ow:change",
|
|
32164
|
+
nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
|
|
32165
|
+
previous: { [SECTION_ORDER_KEY]: previous },
|
|
32166
|
+
moved: instanceId
|
|
32167
|
+
});
|
|
31504
32168
|
window.dispatchEvent(new Event("resize"));
|
|
31505
32169
|
};
|
|
31506
32170
|
window.addEventListener("message", handleMoveSection);
|
|
@@ -31679,6 +32343,12 @@ function OhhwellsBridge() {
|
|
|
31679
32343
|
closeLinkPopoverRef.current();
|
|
31680
32344
|
return;
|
|
31681
32345
|
}
|
|
32346
|
+
if (floatingPanelOpenRef.current) {
|
|
32347
|
+
setFloatingPanelRef.current(null);
|
|
32348
|
+
deselectRef.current();
|
|
32349
|
+
deactivateRef.current();
|
|
32350
|
+
return;
|
|
32351
|
+
}
|
|
31682
32352
|
deselectRef.current();
|
|
31683
32353
|
deactivateRef.current();
|
|
31684
32354
|
clearMediaSelectionRef.current();
|
|
@@ -31857,18 +32527,12 @@ function OhhwellsBridge() {
|
|
|
31857
32527
|
return;
|
|
31858
32528
|
}
|
|
31859
32529
|
}
|
|
31860
|
-
if ((e.key === "Delete" || e.key === "Backspace") &&
|
|
32530
|
+
if ((e.key === "Delete" || e.key === "Backspace") && !activeElRef.current && !linkPopoverOpenRef.current && (selectedElRef.current || selectedMediaElRef.current || selectedIconElRef.current)) {
|
|
31861
32531
|
if (handleDeleteSelectedRef.current()) {
|
|
31862
32532
|
e.preventDefault();
|
|
31863
32533
|
return;
|
|
31864
32534
|
}
|
|
31865
32535
|
}
|
|
31866
|
-
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !activeElRef.current) {
|
|
31867
|
-
if (runPendingDeleteUndoRef.current()) {
|
|
31868
|
-
e.preventDefault();
|
|
31869
|
-
return;
|
|
31870
|
-
}
|
|
31871
|
-
}
|
|
31872
32536
|
if (e.key !== "Escape") return;
|
|
31873
32537
|
const el = activeElRef.current;
|
|
31874
32538
|
if (el && originalContentRef.current !== null) {
|
|
@@ -32515,10 +33179,10 @@ function OhhwellsBridge() {
|
|
|
32515
33179
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32516
33180
|
window.removeEventListener("message", handleDeactivate);
|
|
32517
33181
|
window.removeEventListener("message", handleSelectNav);
|
|
32518
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32519
33182
|
window.removeEventListener("message", handleToastAction);
|
|
32520
33183
|
window.removeEventListener("message", handleFormCount);
|
|
32521
33184
|
window.removeEventListener("message", handleUiEscape);
|
|
33185
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32522
33186
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32523
33187
|
autoSaveTimers.current.clear();
|
|
32524
33188
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32812,7 +33476,7 @@ function OhhwellsBridge() {
|
|
|
32812
33476
|
postToParent2({
|
|
32813
33477
|
type: "ow:ready",
|
|
32814
33478
|
version: "1",
|
|
32815
|
-
bridgeVersion: "0.1.
|
|
33479
|
+
bridgeVersion: "0.1.170-next.454",
|
|
32816
33480
|
path: pathname,
|
|
32817
33481
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32818
33482
|
sections
|
|
@@ -33013,7 +33677,7 @@ function OhhwellsBridge() {
|
|
|
33013
33677
|
const copyHref = result.copy.getAttribute("data-ohw-href-key");
|
|
33014
33678
|
const copyHrefVal = copyHref ? result.content[copyHref] : void 0;
|
|
33015
33679
|
if (copyHref && copyHrefVal !== void 0) applyLinkByKey(copyHref, copyHrefVal);
|
|
33016
|
-
postToParent2({ type: "ow:change", nodes: result.nodes });
|
|
33680
|
+
postToParent2({ type: "ow:change", nodes: result.nodes, label: "Button duplicated" });
|
|
33017
33681
|
enforceLinkHrefs();
|
|
33018
33682
|
requestAnimationFrame(() => {
|
|
33019
33683
|
selectRef.current(result.copy);
|
|
@@ -33062,7 +33726,7 @@ function OhhwellsBridge() {
|
|
|
33062
33726
|
...editContentRef.current,
|
|
33063
33727
|
...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
|
|
33064
33728
|
};
|
|
33065
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33729
|
+
postToParent2({ type: "ow:change", nodes, label: "Social icon duplicated" });
|
|
33066
33730
|
enforceLinkHrefs();
|
|
33067
33731
|
const copyRow = findSocialsRow(result.item);
|
|
33068
33732
|
if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
|
|
@@ -33112,7 +33776,7 @@ function OhhwellsBridge() {
|
|
|
33112
33776
|
[NAV_COUNT_KEY]: navCount,
|
|
33113
33777
|
[NAV_ORDER_KEY]: result.orderJson
|
|
33114
33778
|
};
|
|
33115
|
-
postToParent2({ type: "ow:change", nodes });
|
|
33779
|
+
postToParent2({ type: "ow:change", nodes, label: "Link duplicated" });
|
|
33116
33780
|
enforceLinkHrefs();
|
|
33117
33781
|
if (isNestedNavChild(selected) || navItemOwnsDropdownPanel(selected)) {
|
|
33118
33782
|
setNavGroupForceOpen(selected, true);
|
|
@@ -33152,7 +33816,8 @@ function OhhwellsBridge() {
|
|
|
33152
33816
|
{ key: result.hrefKey, text: result.href },
|
|
33153
33817
|
{ key: result.labelKey, text: result.label },
|
|
33154
33818
|
{ key: FOOTER_ORDER_KEY, text: orderJson }
|
|
33155
|
-
]
|
|
33819
|
+
],
|
|
33820
|
+
label: "Link duplicated"
|
|
33156
33821
|
});
|
|
33157
33822
|
enforceLinkHrefs();
|
|
33158
33823
|
requestAnimationFrame(() => {
|
|
@@ -33168,7 +33833,154 @@ function OhhwellsBridge() {
|
|
|
33168
33833
|
enforceLinkHrefs();
|
|
33169
33834
|
return true;
|
|
33170
33835
|
}, []);
|
|
33836
|
+
const deleteAiBlock = (0, import_react25.useCallback)(
|
|
33837
|
+
(editKey, opts) => {
|
|
33838
|
+
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33839
|
+
if (deletingAiBlockRef.current) return false;
|
|
33840
|
+
const plan = planAiBlockRemoval(aiSectionsRef.current, editKey);
|
|
33841
|
+
if (!plan) return false;
|
|
33842
|
+
if (!plan.ok) {
|
|
33843
|
+
postToParent2({
|
|
33844
|
+
type: "ow:toast",
|
|
33845
|
+
title: plan.reasons[0] ?? "That block cannot be deleted",
|
|
33846
|
+
toastType: "error"
|
|
33847
|
+
});
|
|
33848
|
+
return true;
|
|
33849
|
+
}
|
|
33850
|
+
const { tree: nextTree, entry } = plan;
|
|
33851
|
+
const previous = aiSectionsRef.current;
|
|
33852
|
+
deletingAiBlockRef.current = true;
|
|
33853
|
+
void requestValidateTree5(postToParent2, nextTree).then(({ ok, reasons }) => {
|
|
33854
|
+
deletingAiBlockRef.current = false;
|
|
33855
|
+
if (!ok) {
|
|
33856
|
+
postToParent2({
|
|
33857
|
+
type: "ow:toast",
|
|
33858
|
+
title: reasons[0] ?? "That change is not allowed.",
|
|
33859
|
+
toastType: "error"
|
|
33860
|
+
});
|
|
33861
|
+
return;
|
|
33862
|
+
}
|
|
33863
|
+
clearMediaSelectionRef.current();
|
|
33864
|
+
clearIconSelectionRef.current();
|
|
33865
|
+
applyTreeLocalRef.current?.({
|
|
33866
|
+
id: entry.id,
|
|
33867
|
+
mode: "replace",
|
|
33868
|
+
targetSectionId: entry.id,
|
|
33869
|
+
tree: nextTree,
|
|
33870
|
+
label: entry.label,
|
|
33871
|
+
media: entry.media,
|
|
33872
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
33873
|
+
skipScrollIntoView: true
|
|
33874
|
+
});
|
|
33875
|
+
const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `delete-block-${Date.now()}`;
|
|
33876
|
+
pendingDeleteUndoRef.current = {
|
|
33877
|
+
actionId,
|
|
33878
|
+
restore: () => {
|
|
33879
|
+
clearInteractionChromeRef.current();
|
|
33880
|
+
aiSectionsRef.current = previous;
|
|
33881
|
+
applyAiSectionsToDom(parseAiSectionsState(previous));
|
|
33882
|
+
const restoreHeight = document.body.scrollHeight;
|
|
33883
|
+
if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
|
|
33884
|
+
postToParent2({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: previous }] });
|
|
33885
|
+
postToParent2({
|
|
33886
|
+
type: "ow:ai-sections-changed",
|
|
33887
|
+
sections: collectSections(),
|
|
33888
|
+
nodes: collectEditableNodes(editContentRef.current)
|
|
33889
|
+
});
|
|
33890
|
+
}
|
|
33891
|
+
};
|
|
33892
|
+
postToParent2({
|
|
33893
|
+
type: "ow:toast",
|
|
33894
|
+
title: "Block deleted",
|
|
33895
|
+
toastType: "success",
|
|
33896
|
+
actionLabel: "Undo",
|
|
33897
|
+
actionId,
|
|
33898
|
+
duration: 6e3
|
|
33899
|
+
});
|
|
33900
|
+
});
|
|
33901
|
+
return true;
|
|
33902
|
+
},
|
|
33903
|
+
[postToParent2]
|
|
33904
|
+
);
|
|
33905
|
+
const softHideTemplateEditable = (0, import_react25.useCallback)(
|
|
33906
|
+
(el, opts) => {
|
|
33907
|
+
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33908
|
+
if (!canSoftHideEditable(el, {
|
|
33909
|
+
isNavFooterItem: Boolean(
|
|
33910
|
+
getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
|
|
33911
|
+
)
|
|
33912
|
+
})) {
|
|
33913
|
+
return false;
|
|
33914
|
+
}
|
|
33915
|
+
const previousContent = editContentRef.current;
|
|
33916
|
+
const result = softHideEditableInDom(el, previousContent);
|
|
33917
|
+
if (!result) return false;
|
|
33918
|
+
editContentRef.current = result.content;
|
|
33919
|
+
postToParent2({ type: "ow:change", nodes: result.nodes });
|
|
33920
|
+
clearMediaSelectionRef.current();
|
|
33921
|
+
clearIconSelectionRef.current();
|
|
33922
|
+
clearInteractionChromeRef.current();
|
|
33923
|
+
clearFormPickRef.current?.();
|
|
33924
|
+
deselectRef.current();
|
|
33925
|
+
const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `hide-editable-${Date.now()}`;
|
|
33926
|
+
const hiddenKey = result.key;
|
|
33927
|
+
pendingDeleteUndoRef.current = {
|
|
33928
|
+
actionId,
|
|
33929
|
+
restore: () => {
|
|
33930
|
+
clearInteractionChromeRef.current();
|
|
33931
|
+
const restored = softUnhideEditableInDom(hiddenKey, editContentRef.current);
|
|
33932
|
+
editContentRef.current = restored.content;
|
|
33933
|
+
postToParent2({ type: "ow:change", nodes: restored.nodes });
|
|
33934
|
+
const restoreHeight = document.body.scrollHeight;
|
|
33935
|
+
if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
|
|
33936
|
+
}
|
|
33937
|
+
};
|
|
33938
|
+
postToParent2({
|
|
33939
|
+
type: "ow:toast",
|
|
33940
|
+
title: "Block deleted",
|
|
33941
|
+
toastType: "success",
|
|
33942
|
+
actionLabel: "Undo",
|
|
33943
|
+
actionId,
|
|
33944
|
+
duration: 6e3
|
|
33945
|
+
});
|
|
33946
|
+
return true;
|
|
33947
|
+
},
|
|
33948
|
+
[postToParent2]
|
|
33949
|
+
);
|
|
33950
|
+
const deleteFromToolbar = (0, import_react25.useCallback)(
|
|
33951
|
+
(editKey, el) => {
|
|
33952
|
+
if (!editKey && !el) return false;
|
|
33953
|
+
if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
|
|
33954
|
+
return deleteAiBlock(editKey, { fromToolbar: true });
|
|
33955
|
+
}
|
|
33956
|
+
const target = el ?? (editKey ? document.querySelector(`[data-ohw-key="${editKey.replace(/"/g, '\\"')}"]`) : null);
|
|
33957
|
+
if (target) return softHideTemplateEditable(target, { fromToolbar: true });
|
|
33958
|
+
return false;
|
|
33959
|
+
},
|
|
33960
|
+
[deleteAiBlock, softHideTemplateEditable]
|
|
33961
|
+
);
|
|
33962
|
+
const resolveSelectedAiBlockKey = (0, import_react25.useCallback)(() => {
|
|
33963
|
+
const candidates = [
|
|
33964
|
+
activeElRef.current?.dataset.ohwKey,
|
|
33965
|
+
selectedMediaElRef.current?.dataset.ohwKey,
|
|
33966
|
+
selectedMedia?.key,
|
|
33967
|
+
selectedIconElRef.current?.dataset.ohwKey,
|
|
33968
|
+
selectedElRef.current?.getAttribute("data-ohw-href-key"),
|
|
33969
|
+
selectedElRef.current?.dataset.ohwKey,
|
|
33970
|
+
selectedElRef.current?.querySelector("[data-ohw-key]")?.dataset.ohwKey
|
|
33971
|
+
];
|
|
33972
|
+
for (const key of candidates) {
|
|
33973
|
+
if (key && canRemoveAiBlock(aiSectionsRef.current, key)) return key;
|
|
33974
|
+
}
|
|
33975
|
+
return null;
|
|
33976
|
+
}, [selectedMedia]);
|
|
33171
33977
|
const handleDeleteSelected = (0, import_react25.useCallback)(() => {
|
|
33978
|
+
if (!activeElRef.current) {
|
|
33979
|
+
const aiKey = resolveSelectedAiBlockKey();
|
|
33980
|
+
if (aiKey && deleteAiBlock(aiKey)) return true;
|
|
33981
|
+
const mediaEl = selectedMediaElRef.current;
|
|
33982
|
+
if (mediaEl && softHideTemplateEditable(mediaEl, { fromToolbar: true })) return true;
|
|
33983
|
+
}
|
|
33172
33984
|
const selected = selectedElRef.current;
|
|
33173
33985
|
if (!selected) return false;
|
|
33174
33986
|
if (isCtaButton(selected)) {
|
|
@@ -33227,7 +34039,7 @@ function OhhwellsBridge() {
|
|
|
33227
34039
|
}
|
|
33228
34040
|
}
|
|
33229
34041
|
return deleted;
|
|
33230
|
-
}, [postToParent2]);
|
|
34042
|
+
}, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
|
|
33231
34043
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
33232
34044
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
33233
34045
|
const handleLinkPopoverSubmit = (0, import_react25.useCallback)(
|
|
@@ -33445,6 +34257,13 @@ function OhhwellsBridge() {
|
|
|
33445
34257
|
isUploading: false,
|
|
33446
34258
|
onReplace: handleMediaReplace,
|
|
33447
34259
|
onSelect: handleMediaSelect,
|
|
34260
|
+
onDelete: canRemoveAiBlock(aiSectionsRef.current, selectedMedia.key) || selectedMediaElRef.current != null && canSoftHideEditable(selectedMediaElRef.current, {
|
|
34261
|
+
isNavFooterItem: Boolean(
|
|
34262
|
+
getNavigationItemAnchor(selectedMediaElRef.current) && isNavFooterScopedNavigationItem(selectedMediaElRef.current) && !isCtaButton(selectedMediaElRef.current)
|
|
34263
|
+
)
|
|
34264
|
+
}) ? (key) => {
|
|
34265
|
+
deleteFromToolbar(key, selectedMediaElRef.current);
|
|
34266
|
+
} : void 0,
|
|
33448
34267
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
33449
34268
|
}
|
|
33450
34269
|
),
|
|
@@ -33609,7 +34428,24 @@ function OhhwellsBridge() {
|
|
|
33609
34428
|
children: state
|
|
33610
34429
|
},
|
|
33611
34430
|
state
|
|
33612
|
-
)) })
|
|
34431
|
+
)) }),
|
|
34432
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
34433
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34434
|
+
"button",
|
|
34435
|
+
{
|
|
34436
|
+
type: "button",
|
|
34437
|
+
"aria-label": "Delete form",
|
|
34438
|
+
title: "Delete",
|
|
34439
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
34440
|
+
onClick: () => {
|
|
34441
|
+
setFieldTypePickerOpen(false);
|
|
34442
|
+
const form = formPickElRef.current;
|
|
34443
|
+
if (!form) return;
|
|
34444
|
+
softHideTemplateEditable(form, { fromToolbar: true });
|
|
34445
|
+
},
|
|
34446
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { size: 15, "aria-hidden": true })
|
|
34447
|
+
}
|
|
34448
|
+
)
|
|
33613
34449
|
]
|
|
33614
34450
|
}
|
|
33615
34451
|
)
|
|
@@ -33778,7 +34614,15 @@ function OhhwellsBridge() {
|
|
|
33778
34614
|
onCommand: handleCommand,
|
|
33779
34615
|
activeCommands,
|
|
33780
34616
|
showEditLink,
|
|
33781
|
-
onEditLink: openLinkPopoverForActive
|
|
34617
|
+
onEditLink: openLinkPopoverForActive,
|
|
34618
|
+
showDelete: toolbarShowAiBlockDelete,
|
|
34619
|
+
deleteDisabled: deletingAiBlockRef.current,
|
|
34620
|
+
onDelete: () => {
|
|
34621
|
+
const el = activeElRef.current;
|
|
34622
|
+
const key = el?.dataset.ohwKey;
|
|
34623
|
+
if (!key) return;
|
|
34624
|
+
deleteFromToolbar(key, el);
|
|
34625
|
+
}
|
|
33782
34626
|
}
|
|
33783
34627
|
)
|
|
33784
34628
|
] }),
|
|
@@ -34008,6 +34852,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34008
34852
|
FOOTER_COLUMN_BLOCKS,
|
|
34009
34853
|
FOOTER_COLUMN_SPANS,
|
|
34010
34854
|
FOOTER_SOCIAL_PLATFORMS,
|
|
34855
|
+
HIDDEN_EDITABLES_KEY,
|
|
34011
34856
|
ItemActionToolbar,
|
|
34012
34857
|
ItemInteractionLayer,
|
|
34013
34858
|
LinkEditorPanel,
|
|
@@ -34030,9 +34875,14 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34030
34875
|
addFooterLinkColumn,
|
|
34031
34876
|
appendFooterSocial,
|
|
34032
34877
|
applyBrandChrome,
|
|
34878
|
+
applyHiddenEditablesToDom,
|
|
34033
34879
|
applyStickySearchParams,
|
|
34880
|
+
blockPathFromEditKey,
|
|
34034
34881
|
buildDefaultFooterTree,
|
|
34035
34882
|
buildTarget,
|
|
34883
|
+
canRemoveAiBlock,
|
|
34884
|
+
canRemoveAiTextBlock,
|
|
34885
|
+
canSoftHideEditable,
|
|
34036
34886
|
dropIndicatorVariants,
|
|
34037
34887
|
ensureFooterTree,
|
|
34038
34888
|
filterAvailablePages,
|
|
@@ -34043,6 +34893,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34043
34893
|
insertFooterHours,
|
|
34044
34894
|
isDeadPageHref,
|
|
34045
34895
|
isEditSessionActive,
|
|
34896
|
+
isEditableKeyHidden,
|
|
34046
34897
|
isPlainLeftClick,
|
|
34047
34898
|
isRenderableFooterTree,
|
|
34048
34899
|
isRenderableTree,
|
|
@@ -34053,15 +34904,22 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34053
34904
|
parseAiFooterState,
|
|
34054
34905
|
parseAiSectionsState,
|
|
34055
34906
|
parseTarget,
|
|
34907
|
+
planAiBlockRemoval,
|
|
34908
|
+
planAiTextBlockRemoval,
|
|
34056
34909
|
planBuildPageSync,
|
|
34910
|
+
readHiddenEditables,
|
|
34057
34911
|
recordOverriddenPaths,
|
|
34058
34912
|
releaseTemplateLogoIfReplaced,
|
|
34913
|
+
removeBlockAtPath,
|
|
34059
34914
|
removeFooterBlock,
|
|
34060
34915
|
resetOverriddenPathsCache,
|
|
34061
34916
|
resolveFooterCopyright,
|
|
34917
|
+
resolveSoftHideTarget,
|
|
34062
34918
|
resolveStickyNavigation,
|
|
34063
34919
|
serializeAiFooterState,
|
|
34064
34920
|
shouldFetchContentForPath,
|
|
34921
|
+
softHideEditableInDom,
|
|
34922
|
+
softUnhideEditableInDom,
|
|
34065
34923
|
stepViableSlide,
|
|
34066
34924
|
stripPlaceholderText,
|
|
34067
34925
|
stripPlaceholders,
|
|
@@ -34069,6 +34927,8 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34069
34927
|
toggleVariants,
|
|
34070
34928
|
useOhwCarousel,
|
|
34071
34929
|
validateUrlInput,
|
|
34072
|
-
viableSlides
|
|
34930
|
+
viableSlides,
|
|
34931
|
+
withHiddenEditable,
|
|
34932
|
+
withoutHiddenEditable
|
|
34073
34933
|
});
|
|
34074
34934
|
//# sourceMappingURL=index.cjs.map
|