@ohhwells/bridge 0.1.171 → 0.1.172-next.457
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 +1617 -820
- 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 +1639 -842
- 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
|
|
|
@@ -1245,21 +1261,21 @@ function chromeFrom(sample) {
|
|
|
1245
1261
|
};
|
|
1246
1262
|
}
|
|
1247
1263
|
function filledPrimary(seed) {
|
|
1248
|
-
const
|
|
1249
|
-
const luminance = relativeLuminance(
|
|
1264
|
+
const paint3 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1265
|
+
const luminance = relativeLuminance(paint3);
|
|
1250
1266
|
return {
|
|
1251
|
-
background: toCss({ ...
|
|
1267
|
+
background: toCss({ ...paint3, a: 1 }),
|
|
1252
1268
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1253
1269
|
borderColor: TRANSPARENT,
|
|
1254
1270
|
borderWidth: "0px"
|
|
1255
1271
|
};
|
|
1256
1272
|
}
|
|
1257
1273
|
function generatedSecondary(primary) {
|
|
1258
|
-
const
|
|
1274
|
+
const paint3 = accentColor(primary);
|
|
1259
1275
|
return {
|
|
1260
1276
|
background: TRANSPARENT,
|
|
1261
|
-
color:
|
|
1262
|
-
borderColor:
|
|
1277
|
+
color: paint3,
|
|
1278
|
+
borderColor: paint3,
|
|
1263
1279
|
borderWidth: "1px"
|
|
1264
1280
|
};
|
|
1265
1281
|
}
|
|
@@ -1272,9 +1288,9 @@ function generatedGhost(primary) {
|
|
|
1272
1288
|
};
|
|
1273
1289
|
}
|
|
1274
1290
|
function normalizeOutlineChrome(outline, primary) {
|
|
1275
|
-
const
|
|
1291
|
+
const paint3 = accentColor(primary);
|
|
1276
1292
|
const text = parseColor(outline.color);
|
|
1277
|
-
const paintRgb = parseColor(
|
|
1293
|
+
const paintRgb = parseColor(paint3);
|
|
1278
1294
|
const primaryLabel = parseColor(primary.color);
|
|
1279
1295
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1280
1296
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1283,8 +1299,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1283
1299
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1284
1300
|
return {
|
|
1285
1301
|
...outline,
|
|
1286
|
-
color:
|
|
1287
|
-
borderColor: hasBorder ?
|
|
1302
|
+
color: paint3,
|
|
1303
|
+
borderColor: hasBorder ? paint3 : outline.borderColor
|
|
1288
1304
|
};
|
|
1289
1305
|
}
|
|
1290
1306
|
function generateButtonVariants(samples) {
|
|
@@ -5317,6 +5333,118 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5317
5333
|
};
|
|
5318
5334
|
}
|
|
5319
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
|
+
|
|
5320
5448
|
// src/lib/collect-editable-nodes.ts
|
|
5321
5449
|
var VIDEO_AUTOPLAY_SUFFIX = "__ohw_autoplay";
|
|
5322
5450
|
var VIDEO_MUTED_SUFFIX = "__ohw_muted";
|
|
@@ -5395,7 +5523,9 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
5395
5523
|
BUTTON_ASSIGNMENTS_KEY,
|
|
5396
5524
|
BUTTON_COLLECTIONS_KEY,
|
|
5397
5525
|
BUTTON_SNAPSHOTS_KEY,
|
|
5398
|
-
BUTTON_HIDDEN_KEY
|
|
5526
|
+
BUTTON_HIDDEN_KEY,
|
|
5527
|
+
// Soft-hidden template slots (non-AI Delete) — no DOM marker when hidden.
|
|
5528
|
+
HIDDEN_EDITABLES_KEY
|
|
5399
5529
|
]) {
|
|
5400
5530
|
const text = extraContent[key];
|
|
5401
5531
|
if (typeof text === "string" && text.length > 0) {
|
|
@@ -6880,6 +7010,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6880
7010
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6881
7011
|
return target ? pricingFeatureList(target).length : 0;
|
|
6882
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
|
+
}
|
|
6883
7028
|
function addPricingCardFeature(tree, index, text) {
|
|
6884
7029
|
return withPricingCollection(tree, (collection) => {
|
|
6885
7030
|
const children = collection.children;
|
|
@@ -6888,7 +7033,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6888
7033
|
const features = pricingFeatureList(target);
|
|
6889
7034
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6890
7035
|
target.slots = target.slots ?? {};
|
|
6891
|
-
target.slots.features = [...features, { text }];
|
|
7036
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6892
7037
|
return true;
|
|
6893
7038
|
});
|
|
6894
7039
|
}
|
|
@@ -6955,6 +7100,127 @@ function rewriteIconSlot(tree, path, ref) {
|
|
|
6955
7100
|
return next;
|
|
6956
7101
|
}
|
|
6957
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
|
+
|
|
6958
7224
|
// src/lib/ai-footer-tree.ts
|
|
6959
7225
|
var FOOTER_COLUMN_SPANS = [12, 6, 4, 3];
|
|
6960
7226
|
var FOOTER_COLUMN_BLOCKS = [
|
|
@@ -7532,6 +7798,174 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7532
7798
|
);
|
|
7533
7799
|
}
|
|
7534
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
|
+
|
|
7915
|
+
// src/lib/section-extra.ts
|
|
7916
|
+
var SECTION_EXTRA_SUFFIX = "__ohw_extra";
|
|
7917
|
+
function placeUnderCards(section, box) {
|
|
7918
|
+
const cards = section.querySelector("[data-ohw-cards]");
|
|
7919
|
+
if (cards) {
|
|
7920
|
+
cards.after(box);
|
|
7921
|
+
return;
|
|
7922
|
+
}
|
|
7923
|
+
const viewAll = section.querySelector(".classes-viewall");
|
|
7924
|
+
if (viewAll && section.contains(viewAll)) {
|
|
7925
|
+
section.insertBefore(box, viewAll);
|
|
7926
|
+
return;
|
|
7927
|
+
}
|
|
7928
|
+
const copy = section.querySelector(".classes-copy");
|
|
7929
|
+
if (copy?.parentElement === section) {
|
|
7930
|
+
copy.after(box);
|
|
7931
|
+
return;
|
|
7932
|
+
}
|
|
7933
|
+
section.appendChild(box);
|
|
7934
|
+
}
|
|
7935
|
+
function paint2(section, key, text) {
|
|
7936
|
+
const existing = section.querySelector(`[data-ohw-section-extra="${CSS.escape(key)}"]`);
|
|
7937
|
+
if (existing) {
|
|
7938
|
+
const editable = existing.querySelector('[data-ohw-editable="text"]');
|
|
7939
|
+
if (editable && editable.innerHTML !== text) {
|
|
7940
|
+
editable.innerHTML = text;
|
|
7941
|
+
}
|
|
7942
|
+
placeUnderCards(section, existing);
|
|
7943
|
+
return;
|
|
7944
|
+
}
|
|
7945
|
+
const box = document.createElement("div");
|
|
7946
|
+
box.setAttribute("data-ohw-section-extra", key);
|
|
7947
|
+
box.style.cssText = "width:100%;max-width:720px;margin:48px auto 0;padding:0 48px;box-sizing:border-box;text-align:center;";
|
|
7948
|
+
const p = document.createElement("p");
|
|
7949
|
+
p.setAttribute("data-ohw-editable", "text");
|
|
7950
|
+
p.setAttribute("data-ohw-key", key);
|
|
7951
|
+
p.style.cssText = "font-family:var(--font-body, inherit);font-weight:400;font-size:clamp(15px,1.4vw,18px);line-height:1.55;margin:0;color:inherit;";
|
|
7952
|
+
p.innerHTML = text;
|
|
7953
|
+
box.appendChild(p);
|
|
7954
|
+
placeUnderCards(section, box);
|
|
7955
|
+
}
|
|
7956
|
+
function applySectionExtras(content) {
|
|
7957
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7958
|
+
if (!key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
|
|
7959
|
+
const sectionId = key.slice(0, -SECTION_EXTRA_SUFFIX.length);
|
|
7960
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7961
|
+
if (!section || typeof val !== "string" || !val.trim()) {
|
|
7962
|
+
section?.querySelector(`[data-ohw-section-extra="${CSS.escape(key)}"]`)?.remove();
|
|
7963
|
+
continue;
|
|
7964
|
+
}
|
|
7965
|
+
paint2(section, key, val);
|
|
7966
|
+
}
|
|
7967
|
+
}
|
|
7968
|
+
|
|
7535
7969
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7536
7970
|
var import_react_dom = require("react-dom");
|
|
7537
7971
|
var import_client = require("react-dom/client");
|
|
@@ -8054,12 +8488,19 @@ function footerBodyStyle(fallbackFont, color, weight = 500) {
|
|
|
8054
8488
|
}
|
|
8055
8489
|
var str = (value) => typeof value === "string" ? value : "";
|
|
8056
8490
|
var cardRadius = (slots) => slots.cornerStyle === "sharp" ? 0 : AI_TREE_TOKENS.radiusCard;
|
|
8057
|
-
var
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8491
|
+
var HUG_ALIGN_TYPES = /* @__PURE__ */ new Set(["button", "button-row", "rating"]);
|
|
8492
|
+
var blockAlignStyle = (blockAlign, blockType) => {
|
|
8493
|
+
if (!blockAlign) return {};
|
|
8494
|
+
if (blockType && HUG_ALIGN_TYPES.has(blockType)) {
|
|
8495
|
+
return {
|
|
8496
|
+
display: "flex",
|
|
8497
|
+
flexDirection: "column",
|
|
8498
|
+
alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
|
|
8499
|
+
textAlign: blockAlign
|
|
8500
|
+
};
|
|
8501
|
+
}
|
|
8502
|
+
return { width: "100%", textAlign: blockAlign, boxSizing: "border-box" };
|
|
8503
|
+
};
|
|
8063
8504
|
var fullBleedBlock = (block) => block.type === "carousel" || block.type === "group" && str(block.slots?.layout) === "overlap";
|
|
8064
8505
|
var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.trim()).filter(Boolean);
|
|
8065
8506
|
var AI_MOBILE_CSS = [
|
|
@@ -8105,7 +8546,7 @@ var AI_MOBILE_CSS = [
|
|
|
8105
8546
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
8106
8547
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
8107
8548
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
8108
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8549
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
8109
8550
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
8110
8551
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
8111
8552
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8121,8 +8562,10 @@ var AI_MOBILE_CSS = [
|
|
|
8121
8562
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8122
8563
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8123
8564
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
8124
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
8125
|
-
|
|
8565
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8566
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8567
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8568
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
8126
8569
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8127
8570
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8128
8571
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8327,6 +8770,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8327
8770
|
function textAttrs(ctx, path) {
|
|
8328
8771
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8329
8772
|
}
|
|
8773
|
+
var AI_RESPONSIVE_CSS = [
|
|
8774
|
+
"@media (max-width: 960px) {",
|
|
8775
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8776
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8777
|
+
"}",
|
|
8778
|
+
"@media (max-width: 640px) {",
|
|
8779
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8780
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8781
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8782
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8783
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8784
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8785
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8786
|
+
// layered text used to be.
|
|
8787
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8788
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8789
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8790
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8791
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8792
|
+
// other rule had already been taught to stand down.
|
|
8793
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8794
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8795
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8796
|
+
"}"
|
|
8797
|
+
].join("\n");
|
|
8330
8798
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8331
8799
|
function MediaBox({
|
|
8332
8800
|
refValue,
|
|
@@ -8381,7 +8849,7 @@ function MediaBox({
|
|
|
8381
8849
|
position: fill ? "absolute" : void 0,
|
|
8382
8850
|
inset: fill ? 0 : void 0,
|
|
8383
8851
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8384
|
-
height: fill ? "100%" : void 0,
|
|
8852
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8385
8853
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8386
8854
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8387
8855
|
borderRadius: radius,
|
|
@@ -8582,7 +9050,13 @@ function TextBlock({
|
|
|
8582
9050
|
"div",
|
|
8583
9051
|
{
|
|
8584
9052
|
...textAttrs(ctx, `${path}.content`),
|
|
8585
|
-
style: {
|
|
9053
|
+
style: {
|
|
9054
|
+
...typeStyle(spec, font),
|
|
9055
|
+
color: ctx.brand.palette.dark,
|
|
9056
|
+
textAlign: align,
|
|
9057
|
+
width: "100%",
|
|
9058
|
+
boxSizing: "border-box"
|
|
9059
|
+
},
|
|
8586
9060
|
dangerouslySetInnerHTML: { __html: str(slots.content) }
|
|
8587
9061
|
}
|
|
8588
9062
|
);
|
|
@@ -8593,7 +9067,7 @@ function SectionHeaderBlock({ node, ctx, path }) {
|
|
|
8593
9067
|
const children = node.children ?? [];
|
|
8594
9068
|
const buttonRowIdx = children.findIndex((c) => c.type === "button-row");
|
|
8595
9069
|
const buttonRow = buttonRowIdx >= 0 ? children[buttonRowIdx] : void 0;
|
|
8596
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align }, children: [
|
|
9070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align, width: "100%", boxSizing: "border-box" }, children: [
|
|
8597
9071
|
str(slots.tagline) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
8598
9072
|
"div",
|
|
8599
9073
|
{
|
|
@@ -9877,7 +10351,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9877
10351
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9878
10352
|
"div",
|
|
9879
10353
|
{
|
|
9880
|
-
"data-ai-grid":
|
|
10354
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9881
10355
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9882
10356
|
style: {
|
|
9883
10357
|
display: "grid",
|
|
@@ -10179,7 +10653,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10179
10653
|
},
|
|
10180
10654
|
children: [
|
|
10181
10655
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10182
|
-
// The section's `data-ai-
|
|
10656
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
10183
10657
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10184
10658
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10185
10659
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10212,10 +10686,10 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10212
10686
|
gridColumn: `span ${typeof child.span === "number" ? Math.min(12, Math.max(1, child.span)) : 12}`,
|
|
10213
10687
|
minWidth: 0
|
|
10214
10688
|
} : { minWidth: 0 },
|
|
10215
|
-
//
|
|
10216
|
-
//
|
|
10217
|
-
//
|
|
10218
|
-
...blockAlignStyle(child.align ?? ambientAlign)
|
|
10689
|
+
// Same ambient as renderNode below: child's own align, else the group's, else the
|
|
10690
|
+
// inherited ambient (overlap overlay / section). Copy fills the column; button-row
|
|
10691
|
+
// etc. still hug via flex alignItems.
|
|
10692
|
+
...blockAlignStyle(child.align ?? node.align ?? ambientAlign, child.type)
|
|
10219
10693
|
},
|
|
10220
10694
|
children: renderNode(child, ctx, `${path}.c${i}`, node.align ?? ambientAlign)
|
|
10221
10695
|
},
|
|
@@ -10584,12 +11058,7 @@ function AiTreeRenderer({
|
|
|
10584
11058
|
if (fillHeight) return "stretch";
|
|
10585
11059
|
return (distributed ?? settings.verticalPosition) === "top" ? "start" : "center";
|
|
10586
11060
|
};
|
|
10587
|
-
const cellAlignStyle = (blockAlign) => blockAlign
|
|
10588
|
-
display: "flex",
|
|
10589
|
-
flexDirection: "column",
|
|
10590
|
-
alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
|
|
10591
|
-
textAlign: blockAlign
|
|
10592
|
-
} : {};
|
|
11061
|
+
const cellAlignStyle = (blockAlign, blockType) => blockAlignStyle(blockAlign, blockType);
|
|
10593
11062
|
const needsOverlayClearance = fillHeight && pad === 0;
|
|
10594
11063
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
10595
11064
|
"section",
|
|
@@ -10598,6 +11067,7 @@ function AiTreeRenderer({
|
|
|
10598
11067
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10599
11068
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10600
11069
|
...bgAttrs,
|
|
11070
|
+
"data-ai-responsive": "",
|
|
10601
11071
|
style: {
|
|
10602
11072
|
position: "relative",
|
|
10603
11073
|
padding: `${padCss} 0`,
|
|
@@ -10611,12 +11081,13 @@ function AiTreeRenderer({
|
|
|
10611
11081
|
...fillHeight ? { display: "grid" } : {}
|
|
10612
11082
|
},
|
|
10613
11083
|
children: [
|
|
10614
|
-
|
|
11084
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10615
11085
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
11086
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10616
11087
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10617
11088
|
"div",
|
|
10618
11089
|
{
|
|
10619
|
-
"data-ai-
|
|
11090
|
+
"data-ai-section-inner": "",
|
|
10620
11091
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10621
11092
|
style: {
|
|
10622
11093
|
position: "relative",
|
|
@@ -10633,7 +11104,7 @@ function AiTreeRenderer({
|
|
|
10633
11104
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10634
11105
|
"div",
|
|
10635
11106
|
{
|
|
10636
|
-
"data-ai-
|
|
11107
|
+
"data-ai-columns": "",
|
|
10637
11108
|
style: {
|
|
10638
11109
|
display: "grid",
|
|
10639
11110
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -10649,11 +11120,11 @@ function AiTreeRenderer({
|
|
|
10649
11120
|
gridColumn: `span ${Math.min(12, Math.max(1, block.span))}`,
|
|
10650
11121
|
minWidth: 0,
|
|
10651
11122
|
// Cascades the section's min-height stretch (see `fillHeight` above) down to
|
|
10652
|
-
// this cell; `cellAlignStyle` below overrides
|
|
10653
|
-
//
|
|
11123
|
+
// this cell; `cellAlignStyle` below overrides when the block also has its own
|
|
11124
|
+
// horizontal `align` (flex hug for buttons; width 100% for text).
|
|
10654
11125
|
...fillHeight ? { display: "grid" } : {},
|
|
10655
11126
|
// Horizontal placement of the block's content within its column.
|
|
10656
|
-
...fullBleedBlock(block) ? {} : cellAlignStyle(block.align),
|
|
11127
|
+
...fullBleedBlock(block) ? {} : cellAlignStyle(block.align, block.type),
|
|
10657
11128
|
// space-between: each column becomes a flex column whose content spreads over
|
|
10658
11129
|
// the full row height instead of clumping at the top.
|
|
10659
11130
|
...distributed === "space-between" ? { display: "flex", flexDirection: "column", justifyContent: "space-between" } : {}
|
|
@@ -11295,9 +11766,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11295
11766
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11296
11767
|
continue;
|
|
11297
11768
|
}
|
|
11298
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11299
11769
|
let container = existing?.container;
|
|
11770
|
+
let isNewMount = false;
|
|
11300
11771
|
if (!container || !container.isConnected) {
|
|
11772
|
+
isNewMount = true;
|
|
11301
11773
|
existing?.root.unmount();
|
|
11302
11774
|
container?.remove();
|
|
11303
11775
|
container = document.createElement("div");
|
|
@@ -11377,7 +11849,7 @@ var import_client2 = require("react-dom/client");
|
|
|
11377
11849
|
var import_react_dom2 = require("react-dom");
|
|
11378
11850
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
11379
11851
|
var CONTAINER_ATTR2 = "data-ohw-ai-footer";
|
|
11380
|
-
var
|
|
11852
|
+
var HIDDEN_ATTR2 = "data-ohw-ai-footer-replaced";
|
|
11381
11853
|
var mounted2 = null;
|
|
11382
11854
|
var mountOptions = {};
|
|
11383
11855
|
var capturedSurface;
|
|
@@ -11407,12 +11879,12 @@ function findTemplateFooter() {
|
|
|
11407
11879
|
function hideTemplateFooter(footer) {
|
|
11408
11880
|
if (!footer) return;
|
|
11409
11881
|
footer.style.display = "none";
|
|
11410
|
-
footer.setAttribute(
|
|
11882
|
+
footer.setAttribute(HIDDEN_ATTR2, "");
|
|
11411
11883
|
}
|
|
11412
11884
|
function showTemplateFooter() {
|
|
11413
|
-
for (const el of document.querySelectorAll(`[${
|
|
11885
|
+
for (const el of document.querySelectorAll(`[${HIDDEN_ATTR2}]`)) {
|
|
11414
11886
|
el.style.removeProperty("display");
|
|
11415
|
-
el.removeAttribute(
|
|
11887
|
+
el.removeAttribute(HIDDEN_ATTR2);
|
|
11416
11888
|
}
|
|
11417
11889
|
}
|
|
11418
11890
|
function unmountAiFooter() {
|
|
@@ -11607,7 +12079,7 @@ function pickFooterColumnIndex(columnBlockCounts) {
|
|
|
11607
12079
|
}
|
|
11608
12080
|
|
|
11609
12081
|
// src/lib/ai-footer-edits.ts
|
|
11610
|
-
function
|
|
12082
|
+
function cloneTree2(tree) {
|
|
11611
12083
|
return JSON.parse(JSON.stringify(tree));
|
|
11612
12084
|
}
|
|
11613
12085
|
function rebalanceFooterColumnSpans(columns) {
|
|
@@ -11635,6 +12107,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11635
12107
|
return 3;
|
|
11636
12108
|
}
|
|
11637
12109
|
}
|
|
12110
|
+
function readLiveSocialItems() {
|
|
12111
|
+
const root = getFooterRoot();
|
|
12112
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
12113
|
+
if (!row) return [];
|
|
12114
|
+
const items = [];
|
|
12115
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
12116
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
12117
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
12118
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
12119
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
12120
|
+
items.push({ platform, href });
|
|
12121
|
+
}
|
|
12122
|
+
return items;
|
|
12123
|
+
}
|
|
12124
|
+
function syncSocialRowsFromDom(tree) {
|
|
12125
|
+
const root = getFooterRoot();
|
|
12126
|
+
if (!root) return;
|
|
12127
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
12128
|
+
const live = readLiveSocialItems();
|
|
12129
|
+
if (row && live.length === 0) return;
|
|
12130
|
+
for (const col of tree.columns) {
|
|
12131
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
12132
|
+
if (block.type !== "social-row") return [block];
|
|
12133
|
+
if (!row) return [];
|
|
12134
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
12135
|
+
});
|
|
12136
|
+
}
|
|
12137
|
+
}
|
|
11638
12138
|
function collectBrandBlocks(tree) {
|
|
11639
12139
|
const brand = [];
|
|
11640
12140
|
for (const col of tree.columns) {
|
|
@@ -11657,7 +12157,7 @@ function countFooterLinkLists(tree) {
|
|
|
11657
12157
|
return collectLinkListBlocks(tree).length;
|
|
11658
12158
|
}
|
|
11659
12159
|
function packFooterTreeBrand(tree) {
|
|
11660
|
-
const next =
|
|
12160
|
+
const next = cloneTree2(tree);
|
|
11661
12161
|
const brand = collectBrandBlocks(next);
|
|
11662
12162
|
const lists = collectLinkListBlocks(next);
|
|
11663
12163
|
if (lists.length === 0) {
|
|
@@ -11742,7 +12242,7 @@ function ensureFooterTree(tree, opts) {
|
|
|
11742
12242
|
return tree ?? buildDefaultFooterTree(opts);
|
|
11743
12243
|
}
|
|
11744
12244
|
function appendFooterSocial(tree, entry) {
|
|
11745
|
-
const next =
|
|
12245
|
+
const next = cloneTree2(tree);
|
|
11746
12246
|
const platform = entry.platform.trim().toLowerCase();
|
|
11747
12247
|
const href = entry.href.trim();
|
|
11748
12248
|
for (const col2 of next.columns) {
|
|
@@ -11771,7 +12271,7 @@ function appendFooterSocial(tree, entry) {
|
|
|
11771
12271
|
return next;
|
|
11772
12272
|
}
|
|
11773
12273
|
function insertFooterHours(tree, hours, title = "Hours") {
|
|
11774
|
-
const next =
|
|
12274
|
+
const next = cloneTree2(tree);
|
|
11775
12275
|
const idx = pickFooterColumnIndex(next.columns.map((c) => c.blocks.length));
|
|
11776
12276
|
const col = next.columns[idx] ?? next.columns[0];
|
|
11777
12277
|
if (!col) return next;
|
|
@@ -11798,7 +12298,7 @@ function addFooterLinkColumn(tree, column) {
|
|
|
11798
12298
|
return next;
|
|
11799
12299
|
}
|
|
11800
12300
|
function removeFooterBlock(tree, predicate) {
|
|
11801
|
-
const next =
|
|
12301
|
+
const next = cloneTree2(tree);
|
|
11802
12302
|
for (let c = 0; c < next.columns.length; c++) {
|
|
11803
12303
|
const col = next.columns[c];
|
|
11804
12304
|
if (!col) continue;
|
|
@@ -11834,7 +12334,7 @@ function foldAiFooterSlotOverride(tree, key, value) {
|
|
|
11834
12334
|
const path = key.slice(prefix.length);
|
|
11835
12335
|
const brandMatch = path.match(/^brand\.b(\d+)\.(.+)$/);
|
|
11836
12336
|
if (!brandMatch) return null;
|
|
11837
|
-
const next =
|
|
12337
|
+
const next = cloneTree2(tree);
|
|
11838
12338
|
const brands = [];
|
|
11839
12339
|
for (const col of next.columns) {
|
|
11840
12340
|
for (const block2 of col.blocks) {
|
|
@@ -11879,7 +12379,8 @@ function textOf2(el) {
|
|
|
11879
12379
|
return (el?.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
11880
12380
|
}
|
|
11881
12381
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11882
|
-
const next =
|
|
12382
|
+
const next = cloneTree2(tree);
|
|
12383
|
+
syncSocialRowsFromDom(next);
|
|
11883
12384
|
const domCols = listFooterColumns().map((col) => {
|
|
11884
12385
|
const heading = getFooterColumnHeadingEl(col);
|
|
11885
12386
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -12360,7 +12861,7 @@ var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
|
12360
12861
|
var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
|
|
12361
12862
|
var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
|
|
12362
12863
|
var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
|
|
12363
|
-
var
|
|
12864
|
+
var HIDDEN_ATTR3 = "data-ohw-placeholder-hidden";
|
|
12364
12865
|
function hasPlaceholder(text) {
|
|
12365
12866
|
return HAS_PLACEHOLDER_RE.test(text);
|
|
12366
12867
|
}
|
|
@@ -12379,10 +12880,10 @@ function skipped(el) {
|
|
|
12379
12880
|
}
|
|
12380
12881
|
function hideIfEmptied(el) {
|
|
12381
12882
|
const control = el?.closest("a, button");
|
|
12382
|
-
if (!control || control.hasAttribute(
|
|
12883
|
+
if (!control || control.hasAttribute(HIDDEN_ATTR3)) return;
|
|
12383
12884
|
if ((control.textContent ?? "").trim()) return;
|
|
12384
12885
|
if (control.querySelector("img, svg, picture, video")) return;
|
|
12385
|
-
control.setAttribute(
|
|
12886
|
+
control.setAttribute(HIDDEN_ATTR3, "");
|
|
12386
12887
|
control.style.display = "none";
|
|
12387
12888
|
}
|
|
12388
12889
|
function stripElementAttrs(el) {
|
|
@@ -17531,10 +18032,10 @@ function ItemInteractionLayer({
|
|
|
17531
18032
|
}
|
|
17532
18033
|
|
|
17533
18034
|
// src/lib/forms.ts
|
|
17534
|
-
var
|
|
18035
|
+
var FORM_SELECTOR2 = '[data-ohw-editable="form"]';
|
|
17535
18036
|
function getFormElement(el) {
|
|
17536
18037
|
if (!el) return null;
|
|
17537
|
-
return el.closest(
|
|
18038
|
+
return el.closest(FORM_SELECTOR2);
|
|
17538
18039
|
}
|
|
17539
18040
|
function formKeyOf(form) {
|
|
17540
18041
|
return form.getAttribute("data-ohw-key");
|
|
@@ -17595,7 +18096,7 @@ function clearSubmitError(form) {
|
|
|
17595
18096
|
if (note) note.style.display = "none";
|
|
17596
18097
|
}
|
|
17597
18098
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17598
|
-
var
|
|
18099
|
+
var HIDDEN_ATTR4 = "data-ohw-form-hidden";
|
|
17599
18100
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17600
18101
|
function formSuccessKey(formKey) {
|
|
17601
18102
|
return `${formKey}-success`;
|
|
@@ -17621,13 +18122,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17621
18122
|
Array.from(form.children).forEach((child) => {
|
|
17622
18123
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17623
18124
|
if (state === "success") {
|
|
17624
|
-
if (!child.hasAttribute(
|
|
17625
|
-
child.setAttribute(
|
|
18125
|
+
if (!child.hasAttribute(HIDDEN_ATTR4)) {
|
|
18126
|
+
child.setAttribute(HIDDEN_ATTR4, child.style.display);
|
|
17626
18127
|
child.style.display = "none";
|
|
17627
18128
|
}
|
|
17628
|
-
} else if (child.hasAttribute(
|
|
17629
|
-
child.style.display = child.getAttribute(
|
|
17630
|
-
child.removeAttribute(
|
|
18129
|
+
} else if (child.hasAttribute(HIDDEN_ATTR4)) {
|
|
18130
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR4) ?? "";
|
|
18131
|
+
child.removeAttribute(HIDDEN_ATTR4);
|
|
17631
18132
|
}
|
|
17632
18133
|
});
|
|
17633
18134
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17646,7 +18147,7 @@ function bindPublishedForms(apiUrl, subdomain, content = {}) {
|
|
|
17646
18147
|
"submit",
|
|
17647
18148
|
async (e) => {
|
|
17648
18149
|
const target = e.target;
|
|
17649
|
-
const form = target?.closest(
|
|
18150
|
+
const form = target?.closest(FORM_SELECTOR2);
|
|
17650
18151
|
if (!form || !(form instanceof HTMLFormElement)) return;
|
|
17651
18152
|
const formKey = formKeyOf(form);
|
|
17652
18153
|
if (!formKey) return;
|
|
@@ -17692,7 +18193,7 @@ function apiBase() {
|
|
|
17692
18193
|
function bridgeVersion() {
|
|
17693
18194
|
try {
|
|
17694
18195
|
if (true) {
|
|
17695
|
-
return "0.1.
|
|
18196
|
+
return "0.1.172-next.457";
|
|
17696
18197
|
}
|
|
17697
18198
|
} catch {
|
|
17698
18199
|
}
|
|
@@ -17706,7 +18207,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17706
18207
|
return;
|
|
17707
18208
|
}
|
|
17708
18209
|
try {
|
|
17709
|
-
const v = true ? "0.1.
|
|
18210
|
+
const v = true ? "0.1.172-next.457" : "";
|
|
17710
18211
|
if (v) {
|
|
17711
18212
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17712
18213
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18367,6 +18868,7 @@ function MediaOverlay({
|
|
|
18367
18868
|
onFadeOutComplete,
|
|
18368
18869
|
onReplace,
|
|
18369
18870
|
onSelect,
|
|
18871
|
+
onDelete,
|
|
18370
18872
|
onVideoSettingsChange
|
|
18371
18873
|
}) {
|
|
18372
18874
|
const { rect } = hover;
|
|
@@ -18386,6 +18888,7 @@ function MediaOverlay({
|
|
|
18386
18888
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18387
18889
|
);
|
|
18388
18890
|
}, [isVideo]);
|
|
18891
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18389
18892
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18390
18893
|
const box = {
|
|
18391
18894
|
position: "fixed",
|
|
@@ -18484,11 +18987,10 @@ function MediaOverlay({
|
|
|
18484
18987
|
className: "flex items-center justify-center cursor-pointer",
|
|
18485
18988
|
style: {
|
|
18486
18989
|
...box,
|
|
18487
|
-
//
|
|
18488
|
-
//
|
|
18489
|
-
//
|
|
18490
|
-
|
|
18491
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18990
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18991
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18992
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18993
|
+
pointerEvents: "none",
|
|
18492
18994
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18493
18995
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18494
18996
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18515,40 +19017,74 @@ function MediaOverlay({
|
|
|
18515
19017
|
},
|
|
18516
19018
|
children: [
|
|
18517
19019
|
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 }),
|
|
18518
|
-
|
|
19020
|
+
replaceLabel
|
|
18519
19021
|
]
|
|
18520
19022
|
}
|
|
18521
19023
|
),
|
|
18522
|
-
replaceMode
|
|
18523
|
-
|
|
19024
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
19025
|
+
"div",
|
|
18524
19026
|
{
|
|
18525
|
-
"
|
|
18526
|
-
variant: "outline",
|
|
18527
|
-
size: "sm",
|
|
18528
|
-
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
18529
|
-
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
19027
|
+
className: "flex items-center gap-1.5",
|
|
18530
19028
|
style: {
|
|
18531
|
-
|
|
18532
|
-
// Icon-only is a square of the same height, so the pair can never differ vertically.
|
|
18533
|
-
// `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
|
|
18534
|
-
// minimum beats a width — the square came out wider than the avatar it sat on.
|
|
18535
|
-
...replaceMode === "icon" && buttonSize ? {
|
|
18536
|
-
width: buttonSize.height,
|
|
18537
|
-
minWidth: buttonSize.height,
|
|
18538
|
-
padding: 0,
|
|
18539
|
-
justifyContent: "center"
|
|
18540
|
-
} : null,
|
|
18541
|
-
// Don't let Replace steal clicks when text (e.g. nav) sits on top of this media.
|
|
19029
|
+
// Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
|
|
18542
19030
|
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
|
|
18543
19031
|
},
|
|
18544
|
-
|
|
18545
|
-
onClick: (e) => {
|
|
18546
|
-
e.stopPropagation();
|
|
18547
|
-
onReplace(hover.key);
|
|
18548
|
-
},
|
|
19032
|
+
onClick: (e) => e.stopPropagation(),
|
|
18549
19033
|
children: [
|
|
18550
|
-
|
|
18551
|
-
|
|
19034
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
19035
|
+
Button,
|
|
19036
|
+
{
|
|
19037
|
+
"data-ohw-media-overlay": "",
|
|
19038
|
+
variant: "outline",
|
|
19039
|
+
size: "sm",
|
|
19040
|
+
"aria-label": replaceLabel,
|
|
19041
|
+
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
19042
|
+
style: {
|
|
19043
|
+
...OVERLAY_BUTTON_STYLE,
|
|
19044
|
+
// Icon-only is a square of the same height, so the pair can never differ vertically.
|
|
19045
|
+
// `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
|
|
19046
|
+
// minimum beats a width — the square came out wider than the avatar it sat on.
|
|
19047
|
+
...replaceMode === "icon" && buttonSize ? {
|
|
19048
|
+
width: buttonSize.height,
|
|
19049
|
+
minWidth: buttonSize.height,
|
|
19050
|
+
padding: 0,
|
|
19051
|
+
justifyContent: "center"
|
|
19052
|
+
} : null
|
|
19053
|
+
},
|
|
19054
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
19055
|
+
onClick: (e) => {
|
|
19056
|
+
e.stopPropagation();
|
|
19057
|
+
onReplace(hover.key);
|
|
19058
|
+
},
|
|
19059
|
+
children: [
|
|
19060
|
+
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 }),
|
|
19061
|
+
replaceMode === "full" ? replaceLabel : null
|
|
19062
|
+
]
|
|
19063
|
+
}
|
|
19064
|
+
),
|
|
19065
|
+
selected && onDelete ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
19066
|
+
Button,
|
|
19067
|
+
{
|
|
19068
|
+
"data-ohw-media-overlay": "",
|
|
19069
|
+
variant: "outline",
|
|
19070
|
+
size: "sm",
|
|
19071
|
+
"aria-label": "Delete",
|
|
19072
|
+
title: "Delete",
|
|
19073
|
+
className: "cursor-pointer hover:bg-background",
|
|
19074
|
+
style: {
|
|
19075
|
+
...OVERLAY_BUTTON_STYLE,
|
|
19076
|
+
minWidth: 0,
|
|
19077
|
+
padding: buttonSize ? `0 ${(buttonSize.height - 14) / 2}px` : "0 8px",
|
|
19078
|
+
height: buttonSize?.height
|
|
19079
|
+
},
|
|
19080
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
19081
|
+
onClick: (e) => {
|
|
19082
|
+
e.stopPropagation();
|
|
19083
|
+
onDelete(hover.key);
|
|
19084
|
+
},
|
|
19085
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Trash2, { size: 14 })
|
|
19086
|
+
}
|
|
19087
|
+
) : null
|
|
18552
19088
|
]
|
|
18553
19089
|
}
|
|
18554
19090
|
)
|
|
@@ -19180,7 +19716,7 @@ function AiSectionOverlay({
|
|
|
19180
19716
|
|
|
19181
19717
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19182
19718
|
var import_react13 = require("react");
|
|
19183
|
-
var
|
|
19719
|
+
var import_lucide_react9 = require("lucide-react");
|
|
19184
19720
|
|
|
19185
19721
|
// src/lib/ai-media-strip-tree.ts
|
|
19186
19722
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19294,14 +19830,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19294
19830
|
return true;
|
|
19295
19831
|
});
|
|
19296
19832
|
}
|
|
19297
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19298
|
-
return withMediaStrip(tree, (block) => {
|
|
19299
|
-
const items = block.items;
|
|
19300
|
-
if (index < 0 || index >= items.length) return false;
|
|
19301
|
-
items[index] = { ...items[index], alt };
|
|
19302
|
-
return true;
|
|
19303
|
-
});
|
|
19304
|
-
}
|
|
19305
19833
|
function setMediaStripItemLink(tree, index, link) {
|
|
19306
19834
|
return withMediaStrip(tree, (block) => {
|
|
19307
19835
|
const items = block.items;
|
|
@@ -19319,11 +19847,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19319
19847
|
});
|
|
19320
19848
|
}
|
|
19321
19849
|
|
|
19322
|
-
// src/ui/
|
|
19850
|
+
// src/ui/dialog.tsx
|
|
19851
|
+
var React9 = __toESM(require("react"), 1);
|
|
19852
|
+
var import_radix_ui6 = require("radix-ui");
|
|
19853
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19323
19854
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19855
|
+
function Dialog2({
|
|
19856
|
+
...props
|
|
19857
|
+
}) {
|
|
19858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19859
|
+
}
|
|
19860
|
+
function DialogPortal({
|
|
19861
|
+
...props
|
|
19862
|
+
}) {
|
|
19863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19864
|
+
}
|
|
19865
|
+
function DialogOverlay({
|
|
19866
|
+
className,
|
|
19867
|
+
...props
|
|
19868
|
+
}) {
|
|
19869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19870
|
+
import_radix_ui6.Dialog.Overlay,
|
|
19871
|
+
{
|
|
19872
|
+
"data-slot": "dialog-overlay",
|
|
19873
|
+
"data-ohw-link-modal-root": "",
|
|
19874
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19875
|
+
...props
|
|
19876
|
+
}
|
|
19877
|
+
);
|
|
19878
|
+
}
|
|
19879
|
+
var DialogContent = React9.forwardRef(
|
|
19880
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19881
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19883
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19884
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19885
|
+
import_radix_ui6.Dialog.Content,
|
|
19886
|
+
{
|
|
19887
|
+
ref,
|
|
19888
|
+
"data-slot": "dialog-content",
|
|
19889
|
+
className: cn(
|
|
19890
|
+
positionMode,
|
|
19891
|
+
"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",
|
|
19892
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19893
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19894
|
+
className
|
|
19895
|
+
),
|
|
19896
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19897
|
+
...props,
|
|
19898
|
+
children: [
|
|
19899
|
+
children,
|
|
19900
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19901
|
+
import_radix_ui6.Dialog.Close,
|
|
19902
|
+
{
|
|
19903
|
+
type: "button",
|
|
19904
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19905
|
+
"aria-label": "Close",
|
|
19906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19907
|
+
}
|
|
19908
|
+
) : null
|
|
19909
|
+
]
|
|
19910
|
+
}
|
|
19911
|
+
)
|
|
19912
|
+
] });
|
|
19913
|
+
}
|
|
19914
|
+
);
|
|
19915
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19916
|
+
function DialogHeader({
|
|
19917
|
+
className,
|
|
19918
|
+
...props
|
|
19919
|
+
}) {
|
|
19920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19921
|
+
}
|
|
19922
|
+
function DialogFooter({
|
|
19923
|
+
className,
|
|
19924
|
+
...props
|
|
19925
|
+
}) {
|
|
19926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19927
|
+
"div",
|
|
19928
|
+
{
|
|
19929
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19930
|
+
...props
|
|
19931
|
+
}
|
|
19932
|
+
);
|
|
19933
|
+
}
|
|
19934
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19935
|
+
import_radix_ui6.Dialog.Title,
|
|
19936
|
+
{
|
|
19937
|
+
ref,
|
|
19938
|
+
className: cn(
|
|
19939
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19940
|
+
className
|
|
19941
|
+
),
|
|
19942
|
+
...props
|
|
19943
|
+
}
|
|
19944
|
+
));
|
|
19945
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19946
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19947
|
+
import_radix_ui6.Dialog.Description,
|
|
19948
|
+
{
|
|
19949
|
+
ref,
|
|
19950
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19951
|
+
...props
|
|
19952
|
+
}
|
|
19953
|
+
));
|
|
19954
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19955
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19956
|
+
|
|
19957
|
+
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19958
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
19959
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19960
|
+
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]";
|
|
19327
19961
|
function findMediaStripItemElement(sectionId, index) {
|
|
19328
19962
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19329
19963
|
if (!sectionEl2) return null;
|
|
@@ -19333,14 +19967,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19333
19967
|
}
|
|
19334
19968
|
return null;
|
|
19335
19969
|
}
|
|
19336
|
-
function
|
|
19337
|
-
|
|
19970
|
+
function itemRefFromTarget(target) {
|
|
19971
|
+
if (!(target instanceof Element)) return null;
|
|
19972
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19973
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19974
|
+
if (!itemEl) return null;
|
|
19975
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19976
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19977
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19978
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19979
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19980
|
+
return { sectionId, index };
|
|
19981
|
+
}
|
|
19982
|
+
function sameRef(a, b) {
|
|
19983
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19984
|
+
}
|
|
19985
|
+
function rectOf(el) {
|
|
19338
19986
|
if (!el) return null;
|
|
19339
19987
|
const r2 = el.getBoundingClientRect();
|
|
19340
19988
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19341
19989
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19342
19990
|
}
|
|
19343
|
-
function
|
|
19991
|
+
function readRect2(ref) {
|
|
19992
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19993
|
+
}
|
|
19994
|
+
function readStripRect(ref) {
|
|
19995
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19996
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19997
|
+
}
|
|
19998
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19344
19999
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
19345
20000
|
(0, import_react13.useEffect)(() => {
|
|
19346
20001
|
if (!ref) {
|
|
@@ -19348,7 +20003,7 @@ function useLiveItemRect(ref) {
|
|
|
19348
20003
|
return;
|
|
19349
20004
|
}
|
|
19350
20005
|
const update = () => {
|
|
19351
|
-
const next = readRect2(ref);
|
|
20006
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19352
20007
|
setRect(
|
|
19353
20008
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19354
20009
|
);
|
|
@@ -19363,9 +20018,49 @@ function useLiveItemRect(ref) {
|
|
|
19363
20018
|
window.removeEventListener("resize", update);
|
|
19364
20019
|
clearInterval(interval);
|
|
19365
20020
|
};
|
|
19366
|
-
}, [ref?.sectionId, ref?.index]);
|
|
20021
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19367
20022
|
return rect;
|
|
19368
20023
|
}
|
|
20024
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
20025
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
20026
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
20027
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
20028
|
+
const slotRef = (0, import_react13.useRef)(null);
|
|
20029
|
+
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
20030
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
20031
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
20032
|
+
const slot = slotRef.current;
|
|
20033
|
+
if (!slot) return;
|
|
20034
|
+
const clamp = () => {
|
|
20035
|
+
const w = slot.offsetWidth;
|
|
20036
|
+
if (w <= 0) return;
|
|
20037
|
+
const half = w / 2;
|
|
20038
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
20039
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
20040
|
+
};
|
|
20041
|
+
clamp();
|
|
20042
|
+
const ro = new ResizeObserver(clamp);
|
|
20043
|
+
ro.observe(slot);
|
|
20044
|
+
return () => ro.disconnect();
|
|
20045
|
+
}, [centerX, children]);
|
|
20046
|
+
const mobile = window.innerWidth <= 480;
|
|
20047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20048
|
+
"div",
|
|
20049
|
+
{
|
|
20050
|
+
ref: slotRef,
|
|
20051
|
+
"data-ohw-bridge": "",
|
|
20052
|
+
"data-ohw-item-interaction": "",
|
|
20053
|
+
className: "pointer-events-auto fixed",
|
|
20054
|
+
style: {
|
|
20055
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
20056
|
+
left: centerX + shift,
|
|
20057
|
+
transform: "translate(-50%, -100%)",
|
|
20058
|
+
zIndex: 2147483645
|
|
20059
|
+
},
|
|
20060
|
+
children
|
|
20061
|
+
}
|
|
20062
|
+
);
|
|
20063
|
+
}
|
|
19369
20064
|
function requestValidateTree(postToParent2, tree) {
|
|
19370
20065
|
return new Promise((resolve) => {
|
|
19371
20066
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19402,116 +20097,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19402
20097
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19403
20098
|
});
|
|
19404
20099
|
}
|
|
19405
|
-
function
|
|
20100
|
+
function ToolbarAction({
|
|
19406
20101
|
label,
|
|
19407
20102
|
onClick,
|
|
19408
|
-
disabled,
|
|
19409
|
-
active
|
|
20103
|
+
disabled = false,
|
|
20104
|
+
active = false,
|
|
20105
|
+
children
|
|
19410
20106
|
}) {
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
{
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
disabled,
|
|
19417
|
-
style: {
|
|
19418
|
-
height: 28,
|
|
19419
|
-
padding: "0 10px",
|
|
19420
|
-
display: "inline-flex",
|
|
19421
|
-
alignItems: "center",
|
|
19422
|
-
gap: 4,
|
|
19423
|
-
borderRadius: 999,
|
|
19424
|
-
border: "none",
|
|
19425
|
-
cursor: disabled ? "default" : "pointer",
|
|
19426
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19427
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19428
|
-
opacity: disabled ? 0.4 : 1,
|
|
19429
|
-
fontSize: 12,
|
|
19430
|
-
lineHeight: "16px",
|
|
19431
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19432
|
-
whiteSpace: "nowrap",
|
|
19433
|
-
flex: "0 0 auto"
|
|
19434
|
-
},
|
|
19435
|
-
children: label
|
|
19436
|
-
}
|
|
19437
|
-
);
|
|
20107
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
20108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20109
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20110
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
20111
|
+
] });
|
|
19438
20112
|
}
|
|
19439
|
-
function
|
|
19440
|
-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19444
|
-
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
},
|
|
19469
|
-
children: "Alt"
|
|
19470
|
-
}
|
|
19471
|
-
),
|
|
19472
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19473
|
-
"input",
|
|
20113
|
+
function ToolbarSeparator() {
|
|
20114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
20115
|
+
}
|
|
20116
|
+
function OptionMenu({
|
|
20117
|
+
label,
|
|
20118
|
+
value,
|
|
20119
|
+
options,
|
|
20120
|
+
onChange
|
|
20121
|
+
}) {
|
|
20122
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
20123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20124
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
20125
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20126
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20127
|
+
"button",
|
|
20128
|
+
{
|
|
20129
|
+
type: "button",
|
|
20130
|
+
"aria-label": label,
|
|
20131
|
+
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",
|
|
20132
|
+
children: [
|
|
20133
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20134
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20135
|
+
]
|
|
20136
|
+
}
|
|
20137
|
+
) }),
|
|
20138
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
20139
|
+
const selected = option.value === value;
|
|
20140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20141
|
+
DropdownMenuItem,
|
|
19474
20142
|
{
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
"aria-label": "Image alt text",
|
|
19490
|
-
style: {
|
|
19491
|
-
flex: 1,
|
|
19492
|
-
minWidth: 0,
|
|
19493
|
-
border: "none",
|
|
19494
|
-
outline: "none",
|
|
19495
|
-
background: "transparent",
|
|
19496
|
-
fontSize: 12,
|
|
19497
|
-
lineHeight: "16px",
|
|
19498
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19499
|
-
color: "#1f2937"
|
|
19500
|
-
}
|
|
19501
|
-
}
|
|
19502
|
-
)
|
|
19503
|
-
]
|
|
19504
|
-
}
|
|
19505
|
-
);
|
|
20143
|
+
role: "menuitemradio",
|
|
20144
|
+
"aria-checked": selected,
|
|
20145
|
+
onSelect: () => onChange(option.value),
|
|
20146
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20147
|
+
children: [
|
|
20148
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
|
|
20149
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
20150
|
+
]
|
|
20151
|
+
},
|
|
20152
|
+
option.value
|
|
20153
|
+
);
|
|
20154
|
+
}) })
|
|
20155
|
+
] })
|
|
20156
|
+
] });
|
|
19506
20157
|
}
|
|
19507
20158
|
var VARIANTS = [
|
|
19508
20159
|
{ value: "logos", label: "Logos" },
|
|
19509
20160
|
{ value: "reel", label: "Reel" }
|
|
19510
20161
|
];
|
|
19511
20162
|
var ALIGNS = [
|
|
19512
|
-
{ value: "left", label: "
|
|
19513
|
-
{ value: "center", label: "
|
|
19514
|
-
{ value: "right", label: "
|
|
20163
|
+
{ value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
|
|
20164
|
+
{ value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
|
|
20165
|
+
{ value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
|
|
19515
20166
|
];
|
|
19516
20167
|
var HOVERS = [
|
|
19517
20168
|
{ value: "none", label: "None" },
|
|
@@ -19519,104 +20170,104 @@ var HOVERS = [
|
|
|
19519
20170
|
{ value: "zoom", label: "Zoom" },
|
|
19520
20171
|
{ value: "fade", label: "Fade" }
|
|
19521
20172
|
];
|
|
19522
|
-
var TREATMENTS = [
|
|
19523
|
-
{ value: "color", label: "Color" },
|
|
19524
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19525
|
-
];
|
|
19526
20173
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19527
|
-
function
|
|
19528
|
-
|
|
20174
|
+
function LinkModal({
|
|
20175
|
+
href,
|
|
20176
|
+
linkTarget,
|
|
20177
|
+
onClose,
|
|
20178
|
+
onSave
|
|
20179
|
+
}) {
|
|
20180
|
+
const [draft, setDraft] = (0, import_react13.useState)(href);
|
|
20181
|
+
const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
|
|
19529
20182
|
const [invalid, setInvalid] = (0, import_react13.useState)(false);
|
|
19530
|
-
|
|
19531
|
-
setDraft(value);
|
|
19532
|
-
setInvalid(false);
|
|
19533
|
-
}, [value]);
|
|
19534
|
-
const commit2 = () => {
|
|
20183
|
+
const save = () => {
|
|
19535
20184
|
const next = draft.trim();
|
|
19536
|
-
if (next
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
onCommit(next);
|
|
19540
|
-
};
|
|
19541
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19542
|
-
"div",
|
|
19543
|
-
{
|
|
19544
|
-
style: {
|
|
19545
|
-
display: "flex",
|
|
19546
|
-
alignItems: "center",
|
|
19547
|
-
gap: 6,
|
|
19548
|
-
height: 28,
|
|
19549
|
-
padding: "0 12px",
|
|
19550
|
-
borderRadius: 999,
|
|
19551
|
-
background: "#ffffff",
|
|
19552
|
-
width: "100%",
|
|
19553
|
-
maxWidth: 260,
|
|
19554
|
-
boxSizing: "border-box",
|
|
19555
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19556
|
-
},
|
|
19557
|
-
children: [
|
|
19558
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19559
|
-
"span",
|
|
19560
|
-
{
|
|
19561
|
-
style: {
|
|
19562
|
-
flex: "0 0 auto",
|
|
19563
|
-
color: OHW_BLUE_DARK,
|
|
19564
|
-
fontSize: 10,
|
|
19565
|
-
fontWeight: 700,
|
|
19566
|
-
textTransform: "uppercase",
|
|
19567
|
-
letterSpacing: 0.4
|
|
19568
|
-
},
|
|
19569
|
-
children: "Link"
|
|
19570
|
-
}
|
|
19571
|
-
),
|
|
19572
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19573
|
-
"input",
|
|
19574
|
-
{
|
|
19575
|
-
type: "text",
|
|
19576
|
-
inputMode: "url",
|
|
19577
|
-
value: draft,
|
|
19578
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19579
|
-
onBlur: commit2,
|
|
19580
|
-
onKeyDown: (e) => {
|
|
19581
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19582
|
-
if (e.key === "Escape") {
|
|
19583
|
-
setDraft(value);
|
|
19584
|
-
setInvalid(false);
|
|
19585
|
-
e.currentTarget.blur();
|
|
19586
|
-
}
|
|
19587
|
-
},
|
|
19588
|
-
placeholder: "https://example.com",
|
|
19589
|
-
"aria-label": "Image link URL",
|
|
19590
|
-
"aria-invalid": invalid,
|
|
19591
|
-
style: {
|
|
19592
|
-
flex: 1,
|
|
19593
|
-
minWidth: 0,
|
|
19594
|
-
border: "none",
|
|
19595
|
-
outline: "none",
|
|
19596
|
-
background: "transparent",
|
|
19597
|
-
fontSize: 12,
|
|
19598
|
-
lineHeight: "16px",
|
|
19599
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19600
|
-
color: "#1f2937"
|
|
19601
|
-
}
|
|
19602
|
-
}
|
|
19603
|
-
)
|
|
19604
|
-
]
|
|
20185
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
20186
|
+
setInvalid(true);
|
|
20187
|
+
return;
|
|
19605
20188
|
}
|
|
19606
|
-
|
|
20189
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
20190
|
+
onClose();
|
|
20191
|
+
};
|
|
20192
|
+
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: [
|
|
20193
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
20194
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
20195
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20196
|
+
"input",
|
|
20197
|
+
{
|
|
20198
|
+
autoFocus: true,
|
|
20199
|
+
type: "text",
|
|
20200
|
+
inputMode: "url",
|
|
20201
|
+
value: draft,
|
|
20202
|
+
onChange: (e) => {
|
|
20203
|
+
setDraft(e.target.value);
|
|
20204
|
+
setInvalid(false);
|
|
20205
|
+
},
|
|
20206
|
+
onKeyDown: (e) => {
|
|
20207
|
+
if (e.key === "Enter") save();
|
|
20208
|
+
},
|
|
20209
|
+
placeholder: "https://example.com",
|
|
20210
|
+
"aria-label": "Image link URL",
|
|
20211
|
+
"aria-invalid": invalid,
|
|
20212
|
+
className: cn(
|
|
20213
|
+
"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",
|
|
20214
|
+
invalid && "border-destructive focus:border-destructive"
|
|
20215
|
+
)
|
|
20216
|
+
}
|
|
20217
|
+
),
|
|
20218
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
20219
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
20220
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
20221
|
+
"Open in new tab"
|
|
20222
|
+
] })
|
|
20223
|
+
] }),
|
|
20224
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
|
|
20225
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20226
|
+
"button",
|
|
20227
|
+
{
|
|
20228
|
+
type: "button",
|
|
20229
|
+
onClick: () => {
|
|
20230
|
+
onSave("", "new-tab");
|
|
20231
|
+
onClose();
|
|
20232
|
+
},
|
|
20233
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
20234
|
+
children: "Remove link"
|
|
20235
|
+
}
|
|
20236
|
+
),
|
|
20237
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20238
|
+
"button",
|
|
20239
|
+
{
|
|
20240
|
+
type: "button",
|
|
20241
|
+
onClick: onClose,
|
|
20242
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
20243
|
+
children: "Cancel"
|
|
20244
|
+
}
|
|
20245
|
+
),
|
|
20246
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20247
|
+
"button",
|
|
20248
|
+
{
|
|
20249
|
+
type: "button",
|
|
20250
|
+
onClick: save,
|
|
20251
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
20252
|
+
children: "Save"
|
|
20253
|
+
}
|
|
20254
|
+
)
|
|
20255
|
+
] })
|
|
20256
|
+
] }) });
|
|
19607
20257
|
}
|
|
19608
20258
|
function MediaStripToolbar({
|
|
19609
20259
|
entry,
|
|
19610
20260
|
index,
|
|
19611
20261
|
pending,
|
|
19612
20262
|
error,
|
|
20263
|
+
itemEditOn,
|
|
20264
|
+
onToggleItemEdit,
|
|
19613
20265
|
onSetVariant,
|
|
19614
20266
|
onSetAlign,
|
|
19615
20267
|
onSetHover,
|
|
19616
20268
|
onSetTreatment,
|
|
19617
20269
|
onResize,
|
|
19618
|
-
|
|
19619
|
-
onSetLink,
|
|
20270
|
+
onOpenLink,
|
|
19620
20271
|
onAddItem,
|
|
19621
20272
|
onRemoveItem,
|
|
19622
20273
|
onChangeImage,
|
|
@@ -19625,81 +20276,102 @@ function MediaStripToolbar({
|
|
|
19625
20276
|
}) {
|
|
19626
20277
|
const items = mediaStripItems(entry.tree);
|
|
19627
20278
|
const itemCount = items.length;
|
|
19628
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19629
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19630
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19631
20279
|
const slots = findMediaStripSlots(entry.tree);
|
|
19632
20280
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19633
20281
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19634
20282
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19635
20283
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19636
20284
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19637
|
-
const
|
|
19638
|
-
const
|
|
19639
|
-
|
|
19640
|
-
gap: 6,
|
|
19641
|
-
flexWrap: "nowrap",
|
|
19642
|
-
justifyContent: "center",
|
|
19643
|
-
overflowX: "auto",
|
|
19644
|
-
WebkitOverflowScrolling: "touch",
|
|
19645
|
-
width: "100%",
|
|
19646
|
-
scrollbarWidth: "none"
|
|
19647
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19648
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
20285
|
+
const mobile = window.innerWidth <= 480;
|
|
20286
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
20287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
19649
20288
|
"div",
|
|
19650
20289
|
{
|
|
19651
20290
|
"data-ohw-bridge": "",
|
|
19652
20291
|
"data-ohw-toolbar": "",
|
|
19653
20292
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
flexDirection: "column",
|
|
19657
|
-
gap: 6,
|
|
19658
|
-
alignItems: "center",
|
|
19659
|
-
background: OHW_BLUE,
|
|
19660
|
-
padding: 8,
|
|
19661
|
-
borderRadius: 12,
|
|
19662
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19663
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19664
|
-
opacity: pending ? 0.6 : 1,
|
|
19665
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19666
|
-
},
|
|
20293
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
20294
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19667
20295
|
children: [
|
|
19668
|
-
/* @__PURE__ */ (0,
|
|
19669
|
-
|
|
19670
|
-
|
|
19671
|
-
|
|
19672
|
-
|
|
19673
|
-
|
|
19674
|
-
|
|
19675
|
-
|
|
19676
|
-
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
|
|
19688
|
-
|
|
19689
|
-
|
|
19690
|
-
|
|
19691
|
-
|
|
19692
|
-
|
|
19693
|
-
|
|
19694
|
-
|
|
19695
|
-
|
|
19696
|
-
|
|
19697
|
-
|
|
19698
|
-
|
|
19699
|
-
|
|
20296
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20297
|
+
"div",
|
|
20298
|
+
{
|
|
20299
|
+
className: cn(
|
|
20300
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
20301
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
20302
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20303
|
+
),
|
|
20304
|
+
children: [
|
|
20305
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20306
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20307
|
+
CustomToolbarButton,
|
|
20308
|
+
{
|
|
20309
|
+
type: "button",
|
|
20310
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
20311
|
+
"aria-pressed": itemEditOn,
|
|
20312
|
+
onClick: onToggleItemEdit,
|
|
20313
|
+
className: "group size-8",
|
|
20314
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20315
|
+
import_lucide_react9.Star,
|
|
20316
|
+
{
|
|
20317
|
+
size: 16,
|
|
20318
|
+
fill: "currentColor",
|
|
20319
|
+
strokeWidth: 0,
|
|
20320
|
+
className: cn(
|
|
20321
|
+
"transition-colors",
|
|
20322
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
20323
|
+
),
|
|
20324
|
+
style: { pointerEvents: "none" }
|
|
20325
|
+
}
|
|
20326
|
+
)
|
|
20327
|
+
}
|
|
20328
|
+
) }),
|
|
20329
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
20330
|
+
] }),
|
|
20331
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20332
|
+
/* @__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" } }) }),
|
|
20333
|
+
/* @__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" } }) }),
|
|
20334
|
+
/* @__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" } }) }),
|
|
20335
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20336
|
+
ToolbarAction,
|
|
20337
|
+
{
|
|
20338
|
+
label: gatedLabel("Move right"),
|
|
20339
|
+
onClick: onMoveRight,
|
|
20340
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
20341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
20342
|
+
}
|
|
20343
|
+
),
|
|
20344
|
+
/* @__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" } }) }),
|
|
20345
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20346
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
20347
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
20348
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20349
|
+
ToolbarAction,
|
|
20350
|
+
{
|
|
20351
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
20352
|
+
active: treatment === "grayscale",
|
|
20353
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
20354
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
20355
|
+
}
|
|
20356
|
+
),
|
|
20357
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20358
|
+
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)),
|
|
20359
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20360
|
+
/* @__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" } }) }),
|
|
20361
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
20362
|
+
sizeValue,
|
|
20363
|
+
"px"
|
|
20364
|
+
] }),
|
|
20365
|
+
/* @__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" } }) }),
|
|
20366
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20367
|
+
/* @__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" } }) })
|
|
20368
|
+
]
|
|
20369
|
+
}
|
|
20370
|
+
),
|
|
20371
|
+
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 })
|
|
19700
20372
|
]
|
|
19701
20373
|
}
|
|
19702
|
-
);
|
|
20374
|
+
) });
|
|
19703
20375
|
}
|
|
19704
20376
|
function findMediaStripSlots(tree) {
|
|
19705
20377
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19718,31 +20390,23 @@ function AiMediaStripOverlay({
|
|
|
19718
20390
|
}) {
|
|
19719
20391
|
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
19720
20392
|
const [active, setActive] = (0, import_react13.useState)(null);
|
|
20393
|
+
const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
|
|
20394
|
+
const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
|
|
19721
20395
|
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
19722
20396
|
const [error, setError] = (0, import_react13.useState)(null);
|
|
19723
20397
|
const activeRef = (0, import_react13.useRef)(null);
|
|
19724
20398
|
activeRef.current = active;
|
|
20399
|
+
const linkOpenRef = (0, import_react13.useRef)(false);
|
|
20400
|
+
linkOpenRef.current = linkOpen;
|
|
19725
20401
|
(0, import_react13.useEffect)(() => {
|
|
19726
20402
|
const onMove = (e) => {
|
|
20403
|
+
const ref = itemRefFromTarget(e.target);
|
|
19727
20404
|
const t = e.target;
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
if (!itemEl) {
|
|
19734
|
-
setHover(null);
|
|
19735
|
-
return;
|
|
19736
|
-
}
|
|
19737
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19738
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19739
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19740
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19741
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19742
|
-
setHover(null);
|
|
19743
|
-
return;
|
|
19744
|
-
}
|
|
19745
|
-
setHover({ sectionId, index });
|
|
20405
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
20406
|
+
setHover((prev) => {
|
|
20407
|
+
const next = ref && !overEditable ? ref : null;
|
|
20408
|
+
return sameRef(prev, next) ? prev : next;
|
|
20409
|
+
});
|
|
19746
20410
|
};
|
|
19747
20411
|
const onLeave = () => setHover(null);
|
|
19748
20412
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19754,23 +20418,25 @@ function AiMediaStripOverlay({
|
|
|
19754
20418
|
}, []);
|
|
19755
20419
|
(0, import_react13.useEffect)(() => {
|
|
19756
20420
|
const onClick = (e) => {
|
|
19757
|
-
const current = activeRef.current;
|
|
19758
|
-
if (!current) return;
|
|
19759
20421
|
const t = e.target;
|
|
19760
|
-
if (!(t instanceof
|
|
19761
|
-
if (t.closest(
|
|
19762
|
-
const
|
|
19763
|
-
if (
|
|
19764
|
-
|
|
20422
|
+
if (!(t instanceof Element)) return;
|
|
20423
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
20424
|
+
const ref = itemRefFromTarget(t);
|
|
20425
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
20426
|
+
if (ref) clearInteractionChromeRef.current();
|
|
20427
|
+
setItemEditOn(false);
|
|
19765
20428
|
setError(null);
|
|
20429
|
+
setActive(ref);
|
|
19766
20430
|
};
|
|
19767
20431
|
document.addEventListener("click", onClick, true);
|
|
19768
20432
|
return () => document.removeEventListener("click", onClick, true);
|
|
19769
|
-
}, []);
|
|
20433
|
+
}, [clearInteractionChromeRef]);
|
|
19770
20434
|
(0, import_react13.useEffect)(() => {
|
|
19771
20435
|
const onBlur = () => {
|
|
19772
20436
|
if (!activeRef.current) return;
|
|
19773
20437
|
setActive(null);
|
|
20438
|
+
setItemEditOn(false);
|
|
20439
|
+
setLinkOpen(false);
|
|
19774
20440
|
setError(null);
|
|
19775
20441
|
};
|
|
19776
20442
|
window.addEventListener("blur", onBlur);
|
|
@@ -19780,7 +20446,10 @@ function AiMediaStripOverlay({
|
|
|
19780
20446
|
const onKeyDown = (e) => {
|
|
19781
20447
|
if (e.key !== "Escape") return;
|
|
19782
20448
|
if (!activeRef.current) return;
|
|
20449
|
+
if (linkOpenRef.current) return;
|
|
20450
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19783
20451
|
setActive(null);
|
|
20452
|
+
setItemEditOn(false);
|
|
19784
20453
|
setError(null);
|
|
19785
20454
|
};
|
|
19786
20455
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19814,137 +20483,133 @@ function AiMediaStripOverlay({
|
|
|
19814
20483
|
tree: nextTree,
|
|
19815
20484
|
label: entry.label,
|
|
19816
20485
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19817
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20486
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
20487
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20488
|
+
// on every edit reads as the section jumping around.
|
|
20489
|
+
skipScrollIntoView: true
|
|
19818
20490
|
});
|
|
19819
20491
|
return true;
|
|
19820
20492
|
},
|
|
19821
20493
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19822
20494
|
);
|
|
19823
20495
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19824
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19825
20496
|
const activeItemRect = useLiveItemRect(active);
|
|
19826
|
-
const
|
|
19827
|
-
const
|
|
19828
|
-
|
|
19829
|
-
|
|
19830
|
-
|
|
19831
|
-
|
|
19832
|
-
|
|
19833
|
-
|
|
19834
|
-
|
|
19835
|
-
|
|
19836
|
-
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
|
|
19842
|
-
|
|
19843
|
-
|
|
19844
|
-
|
|
19845
|
-
|
|
19846
|
-
|
|
19847
|
-
|
|
19848
|
-
|
|
19849
|
-
|
|
19850
|
-
|
|
19851
|
-
|
|
19852
|
-
|
|
19853
|
-
|
|
19854
|
-
|
|
19855
|
-
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19861
|
-
ItemInteractionLayer,
|
|
19862
|
-
{
|
|
19863
|
-
rect: activeItemRect,
|
|
19864
|
-
state: toolbarState,
|
|
19865
|
-
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19866
|
-
MediaStripToolbar,
|
|
19867
|
-
{
|
|
19868
|
-
entry: activeEntry,
|
|
19869
|
-
index: active.index,
|
|
19870
|
-
pending,
|
|
19871
|
-
error,
|
|
19872
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19873
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19874
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19875
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19876
|
-
onResize: (delta) => {
|
|
19877
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19878
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19879
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19880
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19881
|
-
},
|
|
19882
|
-
onSetAlt: (alt) => {
|
|
19883
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19884
|
-
},
|
|
19885
|
-
onSetLink: (href, linkTarget) => {
|
|
20497
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
20498
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20499
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
20500
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
20501
|
+
const activeHref = activeItem?.href ?? "";
|
|
20502
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
20503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20504
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20505
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20506
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
20507
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20508
|
+
MediaStripToolbar,
|
|
20509
|
+
{
|
|
20510
|
+
entry: activeEntry,
|
|
20511
|
+
index: active.index,
|
|
20512
|
+
pending,
|
|
20513
|
+
error,
|
|
20514
|
+
itemEditOn,
|
|
20515
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
20516
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
20517
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
20518
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
20519
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
20520
|
+
onResize: (delta) => {
|
|
20521
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
20522
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
20523
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
20524
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
20525
|
+
},
|
|
20526
|
+
onOpenLink: () => setLinkOpen(true),
|
|
20527
|
+
onAddItem: () => {
|
|
20528
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20529
|
+
if (!picked) return;
|
|
20530
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19886
20531
|
void runMutation(
|
|
19887
20532
|
active.sectionId,
|
|
19888
|
-
(tree) =>
|
|
19889
|
-
|
|
19890
|
-
|
|
19891
|
-
|
|
19892
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19893
|
-
if (!picked) return;
|
|
19894
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19895
|
-
void runMutation(
|
|
19896
|
-
active.sectionId,
|
|
19897
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19898
|
-
{ [picked.assetId]: picked.url }
|
|
19899
|
-
).then((applied) => {
|
|
19900
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19901
|
-
});
|
|
19902
|
-
});
|
|
19903
|
-
},
|
|
19904
|
-
onChangeImage: () => {
|
|
19905
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19906
|
-
if (!picked) return;
|
|
19907
|
-
void runMutation(
|
|
19908
|
-
active.sectionId,
|
|
19909
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19910
|
-
{ [picked.assetId]: picked.url }
|
|
19911
|
-
);
|
|
20533
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
20534
|
+
{ [picked.assetId]: picked.url }
|
|
20535
|
+
).then((applied) => {
|
|
20536
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19912
20537
|
});
|
|
19913
|
-
}
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19923
|
-
(applied) => {
|
|
19924
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19925
|
-
}
|
|
19926
|
-
);
|
|
19927
|
-
},
|
|
19928
|
-
onMoveRight: () => {
|
|
19929
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19930
|
-
(applied) => {
|
|
19931
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19932
|
-
}
|
|
20538
|
+
});
|
|
20539
|
+
},
|
|
20540
|
+
onChangeImage: () => {
|
|
20541
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20542
|
+
if (!picked) return;
|
|
20543
|
+
void runMutation(
|
|
20544
|
+
active.sectionId,
|
|
20545
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
20546
|
+
{ [picked.assetId]: picked.url }
|
|
19933
20547
|
);
|
|
19934
|
-
}
|
|
20548
|
+
});
|
|
20549
|
+
},
|
|
20550
|
+
onRemoveItem: () => {
|
|
20551
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
20552
|
+
(applied) => {
|
|
20553
|
+
if (applied) setActive(null);
|
|
20554
|
+
}
|
|
20555
|
+
);
|
|
20556
|
+
},
|
|
20557
|
+
onMoveLeft: () => {
|
|
20558
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
20559
|
+
(applied) => {
|
|
20560
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
20561
|
+
}
|
|
20562
|
+
);
|
|
20563
|
+
},
|
|
20564
|
+
onMoveRight: () => {
|
|
20565
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20566
|
+
(applied) => {
|
|
20567
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20568
|
+
}
|
|
20569
|
+
);
|
|
19935
20570
|
}
|
|
19936
|
-
|
|
19937
|
-
}
|
|
19938
|
-
|
|
20571
|
+
}
|
|
20572
|
+
) }),
|
|
20573
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20574
|
+
"div",
|
|
20575
|
+
{
|
|
20576
|
+
"data-ohw-bridge": "",
|
|
20577
|
+
"data-ohw-item-interaction": "",
|
|
20578
|
+
"aria-hidden": true,
|
|
20579
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20580
|
+
style: {
|
|
20581
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20582
|
+
left: activeItemRect.left - 5,
|
|
20583
|
+
background: PRIMARY3,
|
|
20584
|
+
zIndex: 2147483644
|
|
20585
|
+
},
|
|
20586
|
+
children: "Media item"
|
|
20587
|
+
}
|
|
20588
|
+
),
|
|
20589
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20590
|
+
LinkModal,
|
|
20591
|
+
{
|
|
20592
|
+
href: activeHref,
|
|
20593
|
+
linkTarget: activeTarget,
|
|
20594
|
+
onClose: () => setLinkOpen(false),
|
|
20595
|
+
onSave: (href, linkTarget) => {
|
|
20596
|
+
void runMutation(
|
|
20597
|
+
active.sectionId,
|
|
20598
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20599
|
+
);
|
|
20600
|
+
}
|
|
20601
|
+
}
|
|
20602
|
+
)
|
|
20603
|
+
] })
|
|
19939
20604
|
] });
|
|
19940
20605
|
}
|
|
19941
20606
|
|
|
19942
20607
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19943
20608
|
var import_react14 = require("react");
|
|
19944
|
-
var
|
|
19945
|
-
var
|
|
20609
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20610
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
19946
20611
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19947
|
-
var
|
|
20612
|
+
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]";
|
|
19948
20613
|
function findPricingCardElement(sectionId, index) {
|
|
19949
20614
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19950
20615
|
if (!sectionEl2) return null;
|
|
@@ -19956,7 +20621,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19956
20621
|
}
|
|
19957
20622
|
function cardRefFromTarget(target) {
|
|
19958
20623
|
if (!(target instanceof Element)) return null;
|
|
19959
|
-
if (target.closest(
|
|
20624
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19960
20625
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19961
20626
|
if (!cardEl) return null;
|
|
19962
20627
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -19966,21 +20631,21 @@ function cardRefFromTarget(target) {
|
|
|
19966
20631
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19967
20632
|
return { sectionId, index };
|
|
19968
20633
|
}
|
|
19969
|
-
function
|
|
20634
|
+
function sameRef2(a, b) {
|
|
19970
20635
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19971
20636
|
}
|
|
19972
|
-
function
|
|
20637
|
+
function rectOf2(el) {
|
|
19973
20638
|
if (!el) return null;
|
|
19974
20639
|
const r2 = el.getBoundingClientRect();
|
|
19975
20640
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19976
20641
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19977
20642
|
}
|
|
19978
20643
|
function readRect3(ref) {
|
|
19979
|
-
return
|
|
20644
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19980
20645
|
}
|
|
19981
20646
|
function readGridRect(ref) {
|
|
19982
20647
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19983
|
-
return
|
|
20648
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19984
20649
|
}
|
|
19985
20650
|
function useLiveCardRect(ref, grid = false) {
|
|
19986
20651
|
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
@@ -20010,7 +20675,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
20010
20675
|
}
|
|
20011
20676
|
var TOOLBAR_GRID_GAP = 52;
|
|
20012
20677
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
20013
|
-
var
|
|
20678
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
20014
20679
|
function GridToolbarSlot({ gridRect, children }) {
|
|
20015
20680
|
const slotRef = (0, import_react14.useRef)(null);
|
|
20016
20681
|
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
@@ -20022,7 +20687,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20022
20687
|
const w = slot.offsetWidth;
|
|
20023
20688
|
if (w <= 0) return;
|
|
20024
20689
|
const half = w / 2;
|
|
20025
|
-
const clamped = Math.max(
|
|
20690
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
20026
20691
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
20027
20692
|
};
|
|
20028
20693
|
clamp();
|
|
@@ -20031,7 +20696,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20031
20696
|
return () => ro.disconnect();
|
|
20032
20697
|
}, [centerX, children]);
|
|
20033
20698
|
const mobile = window.innerWidth <= 480;
|
|
20034
|
-
return /* @__PURE__ */ (0,
|
|
20699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20035
20700
|
"div",
|
|
20036
20701
|
{
|
|
20037
20702
|
ref: slotRef,
|
|
@@ -20066,7 +20731,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
20066
20731
|
});
|
|
20067
20732
|
}
|
|
20068
20733
|
function StyleSwatch({ style }) {
|
|
20069
|
-
return /* @__PURE__ */ (0,
|
|
20734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20070
20735
|
"span",
|
|
20071
20736
|
{
|
|
20072
20737
|
"aria-hidden": true,
|
|
@@ -20080,35 +20745,35 @@ function StyleSwatch({ style }) {
|
|
|
20080
20745
|
);
|
|
20081
20746
|
}
|
|
20082
20747
|
function ButtonGlyph() {
|
|
20083
|
-
return /* @__PURE__ */ (0,
|
|
20084
|
-
/* @__PURE__ */ (0,
|
|
20085
|
-
/* @__PURE__ */ (0,
|
|
20748
|
+
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: [
|
|
20749
|
+
/* @__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" }),
|
|
20750
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20086
20751
|
] });
|
|
20087
20752
|
}
|
|
20088
20753
|
function FeatureGlyph({ mode }) {
|
|
20089
|
-
return /* @__PURE__ */ (0,
|
|
20090
|
-
/* @__PURE__ */ (0,
|
|
20091
|
-
/* @__PURE__ */ (0,
|
|
20092
|
-
/* @__PURE__ */ (0,
|
|
20093
|
-
/* @__PURE__ */ (0,
|
|
20094
|
-
/* @__PURE__ */ (0,
|
|
20095
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
20754
|
+
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: [
|
|
20755
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20756
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20757
|
+
/* @__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" }),
|
|
20758
|
+
/* @__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" }),
|
|
20759
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20760
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20096
20761
|
] });
|
|
20097
20762
|
}
|
|
20098
|
-
function
|
|
20763
|
+
function ToolbarAction2({
|
|
20099
20764
|
label,
|
|
20100
20765
|
onClick,
|
|
20101
20766
|
disabled = false,
|
|
20102
20767
|
children
|
|
20103
20768
|
}) {
|
|
20104
|
-
const button = /* @__PURE__ */ (0,
|
|
20105
|
-
return /* @__PURE__ */ (0,
|
|
20106
|
-
/* @__PURE__ */ (0,
|
|
20107
|
-
/* @__PURE__ */ (0,
|
|
20769
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20771
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20772
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
20108
20773
|
] });
|
|
20109
20774
|
}
|
|
20110
|
-
function
|
|
20111
|
-
return /* @__PURE__ */ (0,
|
|
20775
|
+
function ToolbarSeparator2() {
|
|
20776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
20112
20777
|
}
|
|
20113
20778
|
function CardStyleMenu({
|
|
20114
20779
|
value,
|
|
@@ -20116,7 +20781,7 @@ function CardStyleMenu({
|
|
|
20116
20781
|
disabled = false
|
|
20117
20782
|
}) {
|
|
20118
20783
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
20119
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20784
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20120
20785
|
"button",
|
|
20121
20786
|
{
|
|
20122
20787
|
type: "button",
|
|
@@ -20127,28 +20792,28 @@ function CardStyleMenu({
|
|
|
20127
20792
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20128
20793
|
),
|
|
20129
20794
|
children: [
|
|
20130
|
-
/* @__PURE__ */ (0,
|
|
20131
|
-
/* @__PURE__ */ (0,
|
|
20132
|
-
/* @__PURE__ */ (0,
|
|
20795
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
|
|
20796
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20797
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20133
20798
|
]
|
|
20134
20799
|
}
|
|
20135
20800
|
);
|
|
20136
20801
|
if (disabled) {
|
|
20137
|
-
return /* @__PURE__ */ (0,
|
|
20138
|
-
/* @__PURE__ */ (0,
|
|
20139
|
-
/* @__PURE__ */ (0,
|
|
20140
|
-
/* @__PURE__ */ (0,
|
|
20141
|
-
/* @__PURE__ */ (0,
|
|
20802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20803
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20804
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20805
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20806
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20142
20807
|
] })
|
|
20143
20808
|
] });
|
|
20144
20809
|
}
|
|
20145
|
-
return /* @__PURE__ */ (0,
|
|
20146
|
-
/* @__PURE__ */ (0,
|
|
20147
|
-
/* @__PURE__ */ (0,
|
|
20148
|
-
/* @__PURE__ */ (0,
|
|
20149
|
-
/* @__PURE__ */ (0,
|
|
20810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20811
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20812
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20813
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20814
|
+
/* @__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) => {
|
|
20150
20815
|
const selected = style.value === value;
|
|
20151
|
-
return /* @__PURE__ */ (0,
|
|
20816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20152
20817
|
DropdownMenuItem,
|
|
20153
20818
|
{
|
|
20154
20819
|
role: "menuitemradio",
|
|
@@ -20156,9 +20821,9 @@ function CardStyleMenu({
|
|
|
20156
20821
|
onSelect: () => onChange(style.value),
|
|
20157
20822
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20158
20823
|
children: [
|
|
20159
|
-
/* @__PURE__ */ (0,
|
|
20160
|
-
/* @__PURE__ */ (0,
|
|
20161
|
-
selected && /* @__PURE__ */ (0,
|
|
20824
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
|
|
20825
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
|
|
20826
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
|
|
20162
20827
|
]
|
|
20163
20828
|
},
|
|
20164
20829
|
style.value
|
|
@@ -20188,7 +20853,7 @@ function PricingCardToolbar({
|
|
|
20188
20853
|
const style = pricingCardStyle(entry.tree, index);
|
|
20189
20854
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20190
20855
|
const mobile = window.innerWidth <= 480;
|
|
20191
|
-
return /* @__PURE__ */ (0,
|
|
20856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20192
20857
|
"div",
|
|
20193
20858
|
{
|
|
20194
20859
|
"data-ohw-bridge": "",
|
|
@@ -20200,7 +20865,7 @@ function PricingCardToolbar({
|
|
|
20200
20865
|
),
|
|
20201
20866
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20202
20867
|
children: [
|
|
20203
|
-
/* @__PURE__ */ (0,
|
|
20868
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20204
20869
|
"div",
|
|
20205
20870
|
{
|
|
20206
20871
|
className: cn(
|
|
@@ -20209,8 +20874,8 @@ function PricingCardToolbar({
|
|
|
20209
20874
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20210
20875
|
),
|
|
20211
20876
|
children: [
|
|
20212
|
-
/* @__PURE__ */ (0,
|
|
20213
|
-
/* @__PURE__ */ (0,
|
|
20877
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
20878
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20214
20879
|
CustomToolbarButton,
|
|
20215
20880
|
{
|
|
20216
20881
|
type: "button",
|
|
@@ -20218,8 +20883,8 @@ function PricingCardToolbar({
|
|
|
20218
20883
|
"aria-pressed": featuredTag,
|
|
20219
20884
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20220
20885
|
className: "group size-8",
|
|
20221
|
-
children: /* @__PURE__ */ (0,
|
|
20222
|
-
|
|
20886
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20887
|
+
import_lucide_react10.Star,
|
|
20223
20888
|
{
|
|
20224
20889
|
size: 16,
|
|
20225
20890
|
fill: "currentColor",
|
|
@@ -20233,25 +20898,25 @@ function PricingCardToolbar({
|
|
|
20233
20898
|
)
|
|
20234
20899
|
}
|
|
20235
20900
|
) }),
|
|
20236
|
-
/* @__PURE__ */ (0,
|
|
20901
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20237
20902
|
] }),
|
|
20238
|
-
/* @__PURE__ */ (0,
|
|
20239
|
-
/* @__PURE__ */ (0,
|
|
20240
|
-
/* @__PURE__ */ (0,
|
|
20241
|
-
/* @__PURE__ */ (0,
|
|
20242
|
-
/* @__PURE__ */ (0,
|
|
20243
|
-
/* @__PURE__ */ (0,
|
|
20244
|
-
/* @__PURE__ */ (0,
|
|
20903
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20904
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20905
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20906
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
|
|
20907
|
+
/* @__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: [
|
|
20908
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
|
|
20909
|
+
/* @__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" })
|
|
20245
20910
|
] }) }),
|
|
20246
|
-
/* @__PURE__ */ (0,
|
|
20247
|
-
/* @__PURE__ */ (0,
|
|
20248
|
-
/* @__PURE__ */ (0,
|
|
20249
|
-
/* @__PURE__ */ (0,
|
|
20250
|
-
/* @__PURE__ */ (0,
|
|
20911
|
+
/* @__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" }) }),
|
|
20912
|
+
/* @__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" }) }),
|
|
20913
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
20914
|
+
/* @__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" } }) }),
|
|
20915
|
+
/* @__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" } }) })
|
|
20251
20916
|
]
|
|
20252
20917
|
}
|
|
20253
20918
|
),
|
|
20254
|
-
error && /* @__PURE__ */ (0,
|
|
20919
|
+
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 })
|
|
20255
20920
|
]
|
|
20256
20921
|
}
|
|
20257
20922
|
) });
|
|
@@ -20285,7 +20950,7 @@ function AiPricingCardOverlay({
|
|
|
20285
20950
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20286
20951
|
setHover((prev) => {
|
|
20287
20952
|
const next = ref && !overEditable ? ref : null;
|
|
20288
|
-
return
|
|
20953
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20289
20954
|
});
|
|
20290
20955
|
};
|
|
20291
20956
|
const onLeave = () => setHover(null);
|
|
@@ -20300,10 +20965,10 @@ function AiPricingCardOverlay({
|
|
|
20300
20965
|
const onClick = (e) => {
|
|
20301
20966
|
const t = e.target;
|
|
20302
20967
|
if (!(t instanceof Element)) return;
|
|
20303
|
-
if (t.closest(
|
|
20968
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20304
20969
|
const ref = cardRefFromTarget(t);
|
|
20305
|
-
setActive((prev) =>
|
|
20306
|
-
if (!ref || !
|
|
20970
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20971
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20307
20972
|
};
|
|
20308
20973
|
document.addEventListener("click", onClick, true);
|
|
20309
20974
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20368,12 +21033,12 @@ function AiPricingCardOverlay({
|
|
|
20368
21033
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20369
21034
|
const activeCardRect = useLiveCardRect(active);
|
|
20370
21035
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20371
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20372
|
-
return /* @__PURE__ */ (0,
|
|
20373
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20374
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20375
|
-
/* @__PURE__ */ (0,
|
|
20376
|
-
/* @__PURE__ */ (0,
|
|
21036
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
21037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
21038
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
21039
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
21040
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
21041
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20377
21042
|
PricingCardToolbar,
|
|
20378
21043
|
{
|
|
20379
21044
|
entry: activeEntry,
|
|
@@ -20401,7 +21066,7 @@ function AiPricingCardOverlay({
|
|
|
20401
21066
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20402
21067
|
}
|
|
20403
21068
|
) }),
|
|
20404
|
-
/* @__PURE__ */ (0,
|
|
21069
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20405
21070
|
"div",
|
|
20406
21071
|
{
|
|
20407
21072
|
"data-ohw-bridge": "",
|
|
@@ -20423,7 +21088,7 @@ function AiPricingCardOverlay({
|
|
|
20423
21088
|
|
|
20424
21089
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20425
21090
|
var import_react15 = require("react");
|
|
20426
|
-
var
|
|
21091
|
+
var import_lucide_react11 = require("lucide-react");
|
|
20427
21092
|
|
|
20428
21093
|
// src/lib/ai-video-tree.ts
|
|
20429
21094
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20465,39 +21130,11 @@ function clearVideo(tree, path) {
|
|
|
20465
21130
|
});
|
|
20466
21131
|
}
|
|
20467
21132
|
|
|
20468
|
-
// src/lib/youtube.ts
|
|
20469
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20470
|
-
function extractYouTubeId(input) {
|
|
20471
|
-
const trimmed = input.trim();
|
|
20472
|
-
if (!trimmed) return null;
|
|
20473
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20474
|
-
let url;
|
|
20475
|
-
try {
|
|
20476
|
-
url = new URL(trimmed);
|
|
20477
|
-
} catch {
|
|
20478
|
-
return null;
|
|
20479
|
-
}
|
|
20480
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20481
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20482
|
-
return null;
|
|
20483
|
-
}
|
|
20484
|
-
let candidate = null;
|
|
20485
|
-
if (host === "youtu.be") {
|
|
20486
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20487
|
-
} else if (url.pathname === "/watch") {
|
|
20488
|
-
candidate = url.searchParams.get("v");
|
|
20489
|
-
} else {
|
|
20490
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20491
|
-
candidate = match ? match[1] : null;
|
|
20492
|
-
}
|
|
20493
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20494
|
-
}
|
|
20495
|
-
|
|
20496
21133
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20497
|
-
var
|
|
21134
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
20498
21135
|
var PRIMARY5 = "#0885FE";
|
|
20499
|
-
var
|
|
20500
|
-
var
|
|
21136
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
21137
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20501
21138
|
function findVideoBlockElement(sectionId, path) {
|
|
20502
21139
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20503
21140
|
if (!sectionEl2) return null;
|
|
@@ -20557,12 +21194,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20557
21194
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20558
21195
|
});
|
|
20559
21196
|
}
|
|
20560
|
-
function
|
|
21197
|
+
function Pill({
|
|
20561
21198
|
label,
|
|
20562
21199
|
onClick,
|
|
20563
21200
|
disabled
|
|
20564
21201
|
}) {
|
|
20565
|
-
return /* @__PURE__ */ (0,
|
|
21202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20566
21203
|
"button",
|
|
20567
21204
|
{
|
|
20568
21205
|
type: "button",
|
|
@@ -20578,7 +21215,7 @@ function Pill2({
|
|
|
20578
21215
|
border: "none",
|
|
20579
21216
|
cursor: disabled ? "default" : "pointer",
|
|
20580
21217
|
background: "#ffffff",
|
|
20581
|
-
color:
|
|
21218
|
+
color: OHW_BLUE_DARK,
|
|
20582
21219
|
opacity: disabled ? 0.4 : 1,
|
|
20583
21220
|
fontSize: 12,
|
|
20584
21221
|
lineHeight: "16px",
|
|
@@ -20621,8 +21258,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20621
21258
|
onCommit(id);
|
|
20622
21259
|
}
|
|
20623
21260
|
};
|
|
20624
|
-
return /* @__PURE__ */ (0,
|
|
20625
|
-
/* @__PURE__ */ (0,
|
|
21261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
21262
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20626
21263
|
"div",
|
|
20627
21264
|
{
|
|
20628
21265
|
style: {
|
|
@@ -20638,12 +21275,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20638
21275
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20639
21276
|
},
|
|
20640
21277
|
children: [
|
|
20641
|
-
/* @__PURE__ */ (0,
|
|
21278
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20642
21279
|
"span",
|
|
20643
21280
|
{
|
|
20644
21281
|
style: {
|
|
20645
21282
|
flex: "0 0 auto",
|
|
20646
|
-
color:
|
|
21283
|
+
color: OHW_BLUE_DARK,
|
|
20647
21284
|
fontSize: 10,
|
|
20648
21285
|
lineHeight: "16px",
|
|
20649
21286
|
fontWeight: 700,
|
|
@@ -20653,7 +21290,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20653
21290
|
children: "Video"
|
|
20654
21291
|
}
|
|
20655
21292
|
),
|
|
20656
|
-
/* @__PURE__ */ (0,
|
|
21293
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20657
21294
|
"input",
|
|
20658
21295
|
{
|
|
20659
21296
|
type: "text",
|
|
@@ -20690,7 +21327,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20690
21327
|
]
|
|
20691
21328
|
}
|
|
20692
21329
|
),
|
|
20693
|
-
invalid && /* @__PURE__ */ (0,
|
|
21330
|
+
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." })
|
|
20694
21331
|
] });
|
|
20695
21332
|
}
|
|
20696
21333
|
function VideoToolbar({
|
|
@@ -20700,7 +21337,7 @@ function VideoToolbar({
|
|
|
20700
21337
|
onSetVideoId,
|
|
20701
21338
|
onRemove
|
|
20702
21339
|
}) {
|
|
20703
|
-
return /* @__PURE__ */ (0,
|
|
21340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
20704
21341
|
"div",
|
|
20705
21342
|
{
|
|
20706
21343
|
"data-ohw-bridge": "",
|
|
@@ -20712,7 +21349,7 @@ function VideoToolbar({
|
|
|
20712
21349
|
gap: 6,
|
|
20713
21350
|
alignItems: "center",
|
|
20714
21351
|
width: 280,
|
|
20715
|
-
background:
|
|
21352
|
+
background: OHW_BLUE,
|
|
20716
21353
|
padding: 8,
|
|
20717
21354
|
borderRadius: 12,
|
|
20718
21355
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20720,9 +21357,9 @@ function VideoToolbar({
|
|
|
20720
21357
|
opacity: pending ? 0.6 : 1
|
|
20721
21358
|
},
|
|
20722
21359
|
children: [
|
|
20723
|
-
/* @__PURE__ */ (0,
|
|
20724
|
-
/* @__PURE__ */ (0,
|
|
20725
|
-
error && /* @__PURE__ */ (0,
|
|
21360
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
21361
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
21362
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20726
21363
|
]
|
|
20727
21364
|
}
|
|
20728
21365
|
);
|
|
@@ -20842,8 +21479,8 @@ function AiVideoOverlay({
|
|
|
20842
21479
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20843
21480
|
const TOOLBAR_APPROX_H = 90;
|
|
20844
21481
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20845
|
-
return /* @__PURE__ */ (0,
|
|
20846
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
21483
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20847
21484
|
"button",
|
|
20848
21485
|
{
|
|
20849
21486
|
type: "button",
|
|
@@ -20871,15 +21508,15 @@ function AiVideoOverlay({
|
|
|
20871
21508
|
fontSize: 14,
|
|
20872
21509
|
fontWeight: 700
|
|
20873
21510
|
},
|
|
20874
|
-
children: /* @__PURE__ */ (0,
|
|
21511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
20875
21512
|
}
|
|
20876
21513
|
),
|
|
20877
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21514
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20878
21515
|
ItemInteractionLayer,
|
|
20879
21516
|
{
|
|
20880
21517
|
rect: activeBlockRect,
|
|
20881
21518
|
state: toolbarState,
|
|
20882
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21519
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
20883
21520
|
VideoToolbar,
|
|
20884
21521
|
{
|
|
20885
21522
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20903,7 +21540,7 @@ function AiVideoOverlay({
|
|
|
20903
21540
|
|
|
20904
21541
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20905
21542
|
var import_react16 = require("react");
|
|
20906
|
-
var
|
|
21543
|
+
var import_lucide_react12 = require("lucide-react");
|
|
20907
21544
|
|
|
20908
21545
|
// src/lib/ai-carousel-tree.ts
|
|
20909
21546
|
function isCarouselBlock(node) {
|
|
@@ -20954,10 +21591,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20954
21591
|
}
|
|
20955
21592
|
|
|
20956
21593
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20957
|
-
var
|
|
21594
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
20958
21595
|
var PRIMARY6 = "#0885FE";
|
|
20959
|
-
var
|
|
20960
|
-
var
|
|
21596
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21597
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20961
21598
|
function findCarouselItemElement(sectionId, index) {
|
|
20962
21599
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20963
21600
|
if (!sectionEl2) return null;
|
|
@@ -21036,8 +21673,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
21036
21673
|
postToParent2({ type: "ow:asset-pick", id });
|
|
21037
21674
|
});
|
|
21038
21675
|
}
|
|
21039
|
-
function
|
|
21040
|
-
return /* @__PURE__ */ (0,
|
|
21676
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21041
21678
|
"button",
|
|
21042
21679
|
{
|
|
21043
21680
|
type: "button",
|
|
@@ -21053,7 +21690,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
21053
21690
|
border: "none",
|
|
21054
21691
|
cursor: disabled ? "default" : "pointer",
|
|
21055
21692
|
background: "#ffffff",
|
|
21056
|
-
color:
|
|
21693
|
+
color: OHW_BLUE_DARK2,
|
|
21057
21694
|
opacity: disabled ? 0.4 : 1,
|
|
21058
21695
|
fontSize: 12,
|
|
21059
21696
|
lineHeight: "16px",
|
|
@@ -21071,7 +21708,7 @@ function TogglePill({
|
|
|
21071
21708
|
onToggle,
|
|
21072
21709
|
disabled
|
|
21073
21710
|
}) {
|
|
21074
|
-
return /* @__PURE__ */ (0,
|
|
21711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21075
21712
|
"button",
|
|
21076
21713
|
{
|
|
21077
21714
|
type: "button",
|
|
@@ -21090,7 +21727,7 @@ function TogglePill({
|
|
|
21090
21727
|
border: "none",
|
|
21091
21728
|
cursor: disabled ? "default" : "pointer",
|
|
21092
21729
|
background: "#ffffff",
|
|
21093
|
-
color:
|
|
21730
|
+
color: OHW_BLUE_DARK2,
|
|
21094
21731
|
opacity: disabled ? 0.4 : 1,
|
|
21095
21732
|
fontSize: 12,
|
|
21096
21733
|
lineHeight: "16px",
|
|
@@ -21100,7 +21737,7 @@ function TogglePill({
|
|
|
21100
21737
|
},
|
|
21101
21738
|
children: [
|
|
21102
21739
|
label,
|
|
21103
|
-
/* @__PURE__ */ (0,
|
|
21740
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21104
21741
|
"span",
|
|
21105
21742
|
{
|
|
21106
21743
|
"aria-hidden": true,
|
|
@@ -21113,10 +21750,10 @@ function TogglePill({
|
|
|
21113
21750
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
21114
21751
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
21115
21752
|
// "disabled control" rather than "switch that is off".
|
|
21116
|
-
background: on ?
|
|
21753
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
21117
21754
|
transition: "background 120ms ease"
|
|
21118
21755
|
},
|
|
21119
|
-
children: /* @__PURE__ */ (0,
|
|
21756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21120
21757
|
"span",
|
|
21121
21758
|
{
|
|
21122
21759
|
style: {
|
|
@@ -21145,7 +21782,7 @@ function CarouselSlideToolbar({
|
|
|
21145
21782
|
onChangeImage,
|
|
21146
21783
|
onToggleAutoplay
|
|
21147
21784
|
}) {
|
|
21148
|
-
return /* @__PURE__ */ (0,
|
|
21785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21149
21786
|
"div",
|
|
21150
21787
|
{
|
|
21151
21788
|
"data-ohw-bridge": "",
|
|
@@ -21156,7 +21793,7 @@ function CarouselSlideToolbar({
|
|
|
21156
21793
|
flexDirection: "column",
|
|
21157
21794
|
gap: 6,
|
|
21158
21795
|
alignItems: "center",
|
|
21159
|
-
background:
|
|
21796
|
+
background: OHW_BLUE2,
|
|
21160
21797
|
padding: 8,
|
|
21161
21798
|
borderRadius: 12,
|
|
21162
21799
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21168,11 +21805,11 @@ function CarouselSlideToolbar({
|
|
|
21168
21805
|
pointerEvents: pending ? "none" : "auto"
|
|
21169
21806
|
},
|
|
21170
21807
|
children: [
|
|
21171
|
-
/* @__PURE__ */ (0,
|
|
21172
|
-
/* @__PURE__ */ (0,
|
|
21173
|
-
/* @__PURE__ */ (0,
|
|
21808
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21809
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21810
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21174
21811
|
] }),
|
|
21175
|
-
error && /* @__PURE__ */ (0,
|
|
21812
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21176
21813
|
]
|
|
21177
21814
|
}
|
|
21178
21815
|
);
|
|
@@ -21312,8 +21949,8 @@ function AiFadeCarouselOverlay({
|
|
|
21312
21949
|
const activeItemRect = useLiveItemRect2(active);
|
|
21313
21950
|
const TOOLBAR_APPROX_H = 90;
|
|
21314
21951
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21315
|
-
return /* @__PURE__ */ (0,
|
|
21316
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
21953
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21317
21954
|
"button",
|
|
21318
21955
|
{
|
|
21319
21956
|
type: "button",
|
|
@@ -21342,10 +21979,10 @@ function AiFadeCarouselOverlay({
|
|
|
21342
21979
|
fontSize: 14,
|
|
21343
21980
|
fontWeight: 700
|
|
21344
21981
|
},
|
|
21345
|
-
children: /* @__PURE__ */ (0,
|
|
21982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21346
21983
|
}
|
|
21347
21984
|
),
|
|
21348
|
-
swapping && /* @__PURE__ */ (0,
|
|
21985
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21349
21986
|
"div",
|
|
21350
21987
|
{
|
|
21351
21988
|
ref: skeletonRef,
|
|
@@ -21363,15 +22000,15 @@ function AiFadeCarouselOverlay({
|
|
|
21363
22000
|
zIndex: 2147483646,
|
|
21364
22001
|
pointerEvents: "none"
|
|
21365
22002
|
},
|
|
21366
|
-
children: /* @__PURE__ */ (0,
|
|
22003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21367
22004
|
}
|
|
21368
22005
|
),
|
|
21369
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
22006
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21370
22007
|
ItemInteractionLayer,
|
|
21371
22008
|
{
|
|
21372
22009
|
rect: activeItemRect,
|
|
21373
22010
|
state: toolbarState,
|
|
21374
|
-
toolbar: /* @__PURE__ */ (0,
|
|
22011
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21375
22012
|
CarouselSlideToolbar,
|
|
21376
22013
|
{
|
|
21377
22014
|
pending,
|
|
@@ -21562,113 +22199,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21562
22199
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21563
22200
|
var import_react20 = require("react");
|
|
21564
22201
|
|
|
21565
|
-
// src/ui/dialog.tsx
|
|
21566
|
-
var React9 = __toESM(require("react"), 1);
|
|
21567
|
-
var import_radix_ui6 = require("radix-ui");
|
|
21568
|
-
var import_lucide_react12 = require("lucide-react");
|
|
21569
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
21570
|
-
function Dialog2({
|
|
21571
|
-
...props
|
|
21572
|
-
}) {
|
|
21573
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21574
|
-
}
|
|
21575
|
-
function DialogPortal({
|
|
21576
|
-
...props
|
|
21577
|
-
}) {
|
|
21578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21579
|
-
}
|
|
21580
|
-
function DialogOverlay({
|
|
21581
|
-
className,
|
|
21582
|
-
...props
|
|
21583
|
-
}) {
|
|
21584
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21585
|
-
import_radix_ui6.Dialog.Overlay,
|
|
21586
|
-
{
|
|
21587
|
-
"data-slot": "dialog-overlay",
|
|
21588
|
-
"data-ohw-link-modal-root": "",
|
|
21589
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21590
|
-
...props
|
|
21591
|
-
}
|
|
21592
|
-
);
|
|
21593
|
-
}
|
|
21594
|
-
var DialogContent = React9.forwardRef(
|
|
21595
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21596
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21597
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21598
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21599
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21600
|
-
import_radix_ui6.Dialog.Content,
|
|
21601
|
-
{
|
|
21602
|
-
ref,
|
|
21603
|
-
"data-slot": "dialog-content",
|
|
21604
|
-
className: cn(
|
|
21605
|
-
positionMode,
|
|
21606
|
-
"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",
|
|
21607
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21608
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21609
|
-
className
|
|
21610
|
-
),
|
|
21611
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21612
|
-
...props,
|
|
21613
|
-
children: [
|
|
21614
|
-
children,
|
|
21615
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21616
|
-
import_radix_ui6.Dialog.Close,
|
|
21617
|
-
{
|
|
21618
|
-
type: "button",
|
|
21619
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21620
|
-
"aria-label": "Close",
|
|
21621
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
21622
|
-
}
|
|
21623
|
-
) : null
|
|
21624
|
-
]
|
|
21625
|
-
}
|
|
21626
|
-
)
|
|
21627
|
-
] });
|
|
21628
|
-
}
|
|
21629
|
-
);
|
|
21630
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21631
|
-
function DialogHeader({
|
|
21632
|
-
className,
|
|
21633
|
-
...props
|
|
21634
|
-
}) {
|
|
21635
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21636
|
-
}
|
|
21637
|
-
function DialogFooter({
|
|
21638
|
-
className,
|
|
21639
|
-
...props
|
|
21640
|
-
}) {
|
|
21641
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21642
|
-
"div",
|
|
21643
|
-
{
|
|
21644
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21645
|
-
...props
|
|
21646
|
-
}
|
|
21647
|
-
);
|
|
21648
|
-
}
|
|
21649
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21650
|
-
import_radix_ui6.Dialog.Title,
|
|
21651
|
-
{
|
|
21652
|
-
ref,
|
|
21653
|
-
className: cn(
|
|
21654
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21655
|
-
className
|
|
21656
|
-
),
|
|
21657
|
-
...props
|
|
21658
|
-
}
|
|
21659
|
-
));
|
|
21660
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21661
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21662
|
-
import_radix_ui6.Dialog.Description,
|
|
21663
|
-
{
|
|
21664
|
-
ref,
|
|
21665
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21666
|
-
...props
|
|
21667
|
-
}
|
|
21668
|
-
));
|
|
21669
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21670
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21671
|
-
|
|
21672
22202
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21673
22203
|
var import_lucide_react16 = require("lucide-react");
|
|
21674
22204
|
|
|
@@ -22772,6 +23302,7 @@ function shouldUseDevFixtures() {
|
|
|
22772
23302
|
function getLogoElement(el) {
|
|
22773
23303
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22774
23304
|
if (marked) return marked;
|
|
23305
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22775
23306
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22776
23307
|
if (!root) return null;
|
|
22777
23308
|
const anchor = el.closest("a");
|
|
@@ -25588,7 +26119,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25588
26119
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25589
26120
|
return resolveFooterLinksContainerFrom(el);
|
|
25590
26121
|
}
|
|
25591
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
26122
|
+
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)) {
|
|
25592
26123
|
return getNavigationRoot(el);
|
|
25593
26124
|
}
|
|
25594
26125
|
return null;
|
|
@@ -25810,7 +26341,6 @@ var ICONS = {
|
|
|
25810
26341
|
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"/>',
|
|
25811
26342
|
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"/>'
|
|
25812
26343
|
};
|
|
25813
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25814
26344
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25815
26345
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25816
26346
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25908,7 +26438,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25908
26438
|
el.style.top = `${top}px`;
|
|
25909
26439
|
el.style.height = `${height}px`;
|
|
25910
26440
|
}
|
|
25911
|
-
var
|
|
26441
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25912
26442
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25913
26443
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25914
26444
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25935,8 +26465,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25935
26465
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25936
26466
|
const half = toolbarWidth / 2;
|
|
25937
26467
|
return Math.max(
|
|
25938
|
-
|
|
25939
|
-
Math.min(centerX, window.innerWidth -
|
|
26468
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26469
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25940
26470
|
);
|
|
25941
26471
|
}
|
|
25942
26472
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -26058,7 +26588,10 @@ function FloatingToolbar({
|
|
|
26058
26588
|
onCommand,
|
|
26059
26589
|
activeCommands,
|
|
26060
26590
|
showEditLink,
|
|
26061
|
-
onEditLink
|
|
26591
|
+
onEditLink,
|
|
26592
|
+
showDelete,
|
|
26593
|
+
onDelete,
|
|
26594
|
+
deleteDisabled
|
|
26062
26595
|
}) {
|
|
26063
26596
|
const localRef = import_react25.default.useRef(null);
|
|
26064
26597
|
const [measuredW, setMeasuredW] = import_react25.default.useState(330);
|
|
@@ -26085,7 +26618,7 @@ function FloatingToolbar({
|
|
|
26085
26618
|
const ro = new ResizeObserver(update);
|
|
26086
26619
|
ro.observe(node);
|
|
26087
26620
|
return () => ro.disconnect();
|
|
26088
|
-
}, [showEditLink, activeCommands]);
|
|
26621
|
+
}, [showEditLink, showDelete, activeCommands]);
|
|
26089
26622
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
26090
26623
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
26091
26624
|
"div",
|
|
@@ -26150,7 +26683,28 @@ function FloatingToolbar({
|
|
|
26150
26683
|
},
|
|
26151
26684
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
26152
26685
|
}
|
|
26153
|
-
) : null
|
|
26686
|
+
) : null,
|
|
26687
|
+
showDelete ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
26688
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
26689
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
26690
|
+
CustomToolbarButton,
|
|
26691
|
+
{
|
|
26692
|
+
type: "button",
|
|
26693
|
+
title: "Delete",
|
|
26694
|
+
disabled: deleteDisabled,
|
|
26695
|
+
onMouseDown: (e) => {
|
|
26696
|
+
e.preventDefault();
|
|
26697
|
+
e.stopPropagation();
|
|
26698
|
+
if (!deleteDisabled) onDelete?.();
|
|
26699
|
+
},
|
|
26700
|
+
onClick: (e) => {
|
|
26701
|
+
e.preventDefault();
|
|
26702
|
+
e.stopPropagation();
|
|
26703
|
+
},
|
|
26704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
26705
|
+
}
|
|
26706
|
+
)
|
|
26707
|
+
] }) : null
|
|
26154
26708
|
] })
|
|
26155
26709
|
}
|
|
26156
26710
|
);
|
|
@@ -26764,6 +27318,8 @@ function OhhwellsBridge() {
|
|
|
26764
27318
|
const [activeCommands, setActiveCommands] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
|
|
26765
27319
|
const [sectionGap, setSectionGap] = (0, import_react25.useState)(null);
|
|
26766
27320
|
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react25.useState)(false);
|
|
27321
|
+
const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0, import_react25.useState)(false);
|
|
27322
|
+
const deletingAiBlockRef = (0, import_react25.useRef)(false);
|
|
26767
27323
|
const hoveredNavContainerRef = (0, import_react25.useRef)(null);
|
|
26768
27324
|
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react25.useState)(null);
|
|
26769
27325
|
const hoveredItemElRef = (0, import_react25.useRef)(null);
|
|
@@ -26819,21 +27375,6 @@ function OhhwellsBridge() {
|
|
|
26819
27375
|
const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
|
|
26820
27376
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
|
|
26821
27377
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26822
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26823
|
-
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26824
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26825
|
-
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26826
|
-
floatingPanelRef.current = floatingPanel;
|
|
26827
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26828
|
-
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26829
|
-
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26830
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26831
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26832
|
-
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26833
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26834
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26835
|
-
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26836
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26837
27378
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
|
|
26838
27379
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
|
|
26839
27380
|
const footerDragRef = (0, import_react25.useRef)(null);
|
|
@@ -26860,6 +27401,21 @@ function OhhwellsBridge() {
|
|
|
26860
27401
|
const stylesRef = (0, import_react25.useRef)("");
|
|
26861
27402
|
const appliedDrawerRef = (0, import_react25.useRef)(null);
|
|
26862
27403
|
const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
|
|
27404
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
27405
|
+
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
27406
|
+
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
27407
|
+
floatingPanelRef.current = floatingPanel;
|
|
27408
|
+
const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
|
|
27409
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
27410
|
+
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
27411
|
+
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
27412
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
27413
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
27414
|
+
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
27415
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
27416
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
27417
|
+
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
27418
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
26863
27419
|
const [sitePages, setSitePages] = (0, import_react25.useState)([]);
|
|
26864
27420
|
const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
26865
27421
|
const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
|
|
@@ -26869,7 +27425,18 @@ function OhhwellsBridge() {
|
|
|
26869
27425
|
const linkPopoverOpenRef = (0, import_react25.useRef)(false);
|
|
26870
27426
|
const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
|
|
26871
27427
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27428
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26872
27429
|
linkPopoverSessionRef.current = linkPopover;
|
|
27430
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
27431
|
+
(0, import_react25.useEffect)(() => {
|
|
27432
|
+
const syncViewport = () => {
|
|
27433
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
27434
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
27435
|
+
};
|
|
27436
|
+
syncViewport();
|
|
27437
|
+
window.addEventListener("resize", syncViewport);
|
|
27438
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
27439
|
+
}, []);
|
|
26873
27440
|
(0, import_react25.useEffect)(() => {
|
|
26874
27441
|
setSectionOrderPersistHandler((entries) => {
|
|
26875
27442
|
const currentPath = window.location.pathname;
|
|
@@ -27176,6 +27743,7 @@ function OhhwellsBridge() {
|
|
|
27176
27743
|
setMaxBadge(null);
|
|
27177
27744
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27178
27745
|
setToolbarShowEditLink(false);
|
|
27746
|
+
setToolbarShowAiBlockDelete(false);
|
|
27179
27747
|
postToParent2({ type: "ow:exit-edit" });
|
|
27180
27748
|
}, [postToParent2]);
|
|
27181
27749
|
const clearSelectedAttr = (0, import_react25.useCallback)(() => {
|
|
@@ -27346,6 +27914,7 @@ function OhhwellsBridge() {
|
|
|
27346
27914
|
setMaxBadge(null);
|
|
27347
27915
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27348
27916
|
setToolbarShowEditLink(false);
|
|
27917
|
+
setToolbarShowAiBlockDelete(false);
|
|
27349
27918
|
postToParent2({ type: "ow:exit-edit" });
|
|
27350
27919
|
reselectNavigationItem(navAnchor);
|
|
27351
27920
|
}, [postToParent2, reselectNavigationItem]);
|
|
@@ -28516,6 +29085,13 @@ function OhhwellsBridge() {
|
|
|
28516
29085
|
}
|
|
28517
29086
|
}
|
|
28518
29087
|
setToolbarShowEditLink(Boolean(getHrefKeyFromElement(el)));
|
|
29088
|
+
setToolbarShowAiBlockDelete(
|
|
29089
|
+
canRemoveAiBlock(aiSectionsRef.current, el.dataset.ohwKey ?? null) || canSoftHideEditable(el, {
|
|
29090
|
+
isNavFooterItem: Boolean(
|
|
29091
|
+
getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
|
|
29092
|
+
)
|
|
29093
|
+
})
|
|
29094
|
+
);
|
|
28519
29095
|
const navAnchor = getNavigationItemAnchor(el);
|
|
28520
29096
|
if (navAnchor) {
|
|
28521
29097
|
if (isNestedNavChild(navAnchor)) {
|
|
@@ -28603,6 +29179,7 @@ function OhhwellsBridge() {
|
|
|
28603
29179
|
applyAiFooterFromContent(content);
|
|
28604
29180
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28605
29181
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
29182
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28606
29183
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28607
29184
|
}
|
|
28608
29185
|
applyBrandChrome(content);
|
|
@@ -28613,15 +29190,16 @@ function OhhwellsBridge() {
|
|
|
28613
29190
|
if (key === "__ohw_sections") continue;
|
|
28614
29191
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28615
29192
|
if (key === AI_FOOTER_KEY) continue;
|
|
29193
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29194
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28616
29195
|
if (key === BRAND_KIT_KEY) continue;
|
|
28617
29196
|
if (key === STYLE_STORE_KEY) continue;
|
|
28618
29197
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28619
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28620
29198
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28621
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28622
29199
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28623
29200
|
continue;
|
|
28624
29201
|
}
|
|
29202
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
|
|
28625
29203
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28626
29204
|
if (applyCarouselNode(key, val)) continue;
|
|
28627
29205
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28661,6 +29239,8 @@ function OhhwellsBridge() {
|
|
|
28661
29239
|
});
|
|
28662
29240
|
applyLinkByKey(key, val);
|
|
28663
29241
|
}
|
|
29242
|
+
applySectionEmbeds(content);
|
|
29243
|
+
applySectionExtras(content);
|
|
28664
29244
|
applyLogoFromContent(content);
|
|
28665
29245
|
applyLogoSizes(content);
|
|
28666
29246
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28669,6 +29249,7 @@ function OhhwellsBridge() {
|
|
|
28669
29249
|
applySocialsDisplayFromContent(content);
|
|
28670
29250
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28671
29251
|
syncButtonsFromContent(document, content);
|
|
29252
|
+
applyHiddenEditablesToDom(content);
|
|
28672
29253
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28673
29254
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28674
29255
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -28849,20 +29430,22 @@ function OhhwellsBridge() {
|
|
|
28849
29430
|
}
|
|
28850
29431
|
applyAiFooterFromContent(content);
|
|
28851
29432
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
29433
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28852
29434
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28853
29435
|
}
|
|
28854
29436
|
for (const [key, val] of Object.entries(content)) {
|
|
28855
29437
|
if (key === "__ohw_sections") continue;
|
|
28856
29438
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28857
29439
|
if (key === AI_FOOTER_KEY) continue;
|
|
29440
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29441
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28858
29442
|
if (key === BRAND_KIT_KEY) continue;
|
|
28859
29443
|
if (key === STYLE_STORE_KEY) continue;
|
|
28860
29444
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28861
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28862
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28863
29445
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28864
29446
|
continue;
|
|
28865
29447
|
}
|
|
29448
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
|
|
28866
29449
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28867
29450
|
if (applyCarouselNode(key, val)) continue;
|
|
28868
29451
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28887,6 +29470,8 @@ function OhhwellsBridge() {
|
|
|
28887
29470
|
});
|
|
28888
29471
|
applyLinkByKey(key, val);
|
|
28889
29472
|
}
|
|
29473
|
+
applySectionEmbeds(content);
|
|
29474
|
+
applySectionExtras(content);
|
|
28890
29475
|
applyLogoFromContent(content);
|
|
28891
29476
|
reconcileNavbarItemsFromContent(content);
|
|
28892
29477
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28894,6 +29479,7 @@ function OhhwellsBridge() {
|
|
|
28894
29479
|
applySocialsDisplayFromContent(content);
|
|
28895
29480
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28896
29481
|
syncButtonsFromContent(document, content);
|
|
29482
|
+
applyHiddenEditablesToDom(content);
|
|
28897
29483
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28898
29484
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28899
29485
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -29032,6 +29618,7 @@ function OhhwellsBridge() {
|
|
|
29032
29618
|
applySocialsDisplayFromContent(content);
|
|
29033
29619
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
29034
29620
|
syncButtonsFromContent(document, content);
|
|
29621
|
+
applyHiddenEditablesToDom(content);
|
|
29035
29622
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
29036
29623
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
29037
29624
|
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
|
|
@@ -29126,26 +29713,11 @@ function OhhwellsBridge() {
|
|
|
29126
29713
|
const t2 = setTimeout(measure, 500);
|
|
29127
29714
|
const ro = new ResizeObserver(schedule);
|
|
29128
29715
|
ro.observe(document.body);
|
|
29129
|
-
let lastWidth = window.innerWidth;
|
|
29130
|
-
let resizeTimers = [];
|
|
29131
|
-
const clearResizeTimers = () => {
|
|
29132
|
-
resizeTimers.forEach(clearTimeout);
|
|
29133
|
-
resizeTimers = [];
|
|
29134
|
-
};
|
|
29135
|
-
const handleResize = () => {
|
|
29136
|
-
if (window.innerWidth === lastWidth) return;
|
|
29137
|
-
lastWidth = window.innerWidth;
|
|
29138
|
-
clearResizeTimers();
|
|
29139
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29140
|
-
};
|
|
29141
|
-
window.addEventListener("resize", handleResize);
|
|
29142
29716
|
return () => {
|
|
29143
29717
|
clearTimeout(t1);
|
|
29144
29718
|
clearTimeout(t2);
|
|
29145
29719
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29146
29720
|
ro.disconnect();
|
|
29147
|
-
clearResizeTimers();
|
|
29148
|
-
window.removeEventListener("resize", handleResize);
|
|
29149
29721
|
};
|
|
29150
29722
|
}, [pathname, isEditMode, postToParent2]);
|
|
29151
29723
|
(0, import_react25.useEffect)(() => {
|
|
@@ -29442,6 +30014,13 @@ function OhhwellsBridge() {
|
|
|
29442
30014
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29443
30015
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29444
30016
|
if (isInsideLinkEditor(target)) return;
|
|
30017
|
+
if (isInsideFloatingPanel(target)) return;
|
|
30018
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
30019
|
+
if (target.closest(
|
|
30020
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
30021
|
+
)) {
|
|
30022
|
+
return;
|
|
30023
|
+
}
|
|
29445
30024
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29446
30025
|
clearMediaSelectionRef.current();
|
|
29447
30026
|
}
|
|
@@ -29465,8 +30044,6 @@ function OhhwellsBridge() {
|
|
|
29465
30044
|
return;
|
|
29466
30045
|
}
|
|
29467
30046
|
}
|
|
29468
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29469
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29470
30047
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29471
30048
|
if (collectionItem) {
|
|
29472
30049
|
e.preventDefault();
|
|
@@ -29478,11 +30055,6 @@ function OhhwellsBridge() {
|
|
|
29478
30055
|
});
|
|
29479
30056
|
return;
|
|
29480
30057
|
}
|
|
29481
|
-
if (target.closest(
|
|
29482
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29483
|
-
)) {
|
|
29484
|
-
return;
|
|
29485
|
-
}
|
|
29486
30058
|
{
|
|
29487
30059
|
const formEl = getFormElement(target);
|
|
29488
30060
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29636,9 +30208,13 @@ function OhhwellsBridge() {
|
|
|
29636
30208
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29637
30209
|
e.preventDefault();
|
|
29638
30210
|
e.stopPropagation();
|
|
29639
|
-
selectIconElementRef.current(editable);
|
|
29640
30211
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29641
30212
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
30213
|
+
if (aiIcon) {
|
|
30214
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
30215
|
+
} else {
|
|
30216
|
+
selectIconElementRef.current(editable);
|
|
30217
|
+
}
|
|
29642
30218
|
postToParentRef.current({
|
|
29643
30219
|
type: "ow:icon-pick",
|
|
29644
30220
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29866,6 +30442,9 @@ function OhhwellsBridge() {
|
|
|
29866
30442
|
setHoveredItemRect(null);
|
|
29867
30443
|
hoveredNavContainerRef.current = null;
|
|
29868
30444
|
setHoveredNavContainerRect(null);
|
|
30445
|
+
siblingHintElRef.current = null;
|
|
30446
|
+
setSiblingHintRect(null);
|
|
30447
|
+
setSiblingHintRects([]);
|
|
29869
30448
|
return;
|
|
29870
30449
|
}
|
|
29871
30450
|
{
|
|
@@ -29986,7 +30565,6 @@ function OhhwellsBridge() {
|
|
|
29986
30565
|
hoveredNavContainerRef.current = null;
|
|
29987
30566
|
setHoveredNavContainerRect(null);
|
|
29988
30567
|
hoveredItemElRef.current = editable;
|
|
29989
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29990
30568
|
}
|
|
29991
30569
|
}
|
|
29992
30570
|
}
|
|
@@ -30696,7 +31274,11 @@ function OhhwellsBridge() {
|
|
|
30696
31274
|
};
|
|
30697
31275
|
const handleMouseMove = (e) => {
|
|
30698
31276
|
const { clientX, clientY } = e;
|
|
30699
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31277
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31278
|
+
dismissImageHover();
|
|
31279
|
+
clearImageHover();
|
|
31280
|
+
return;
|
|
31281
|
+
}
|
|
30700
31282
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30701
31283
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30702
31284
|
formHoverElRef.current = null;
|
|
@@ -30725,7 +31307,12 @@ function OhhwellsBridge() {
|
|
|
30725
31307
|
setHoveredItemRect(null);
|
|
30726
31308
|
hoveredNavContainerRef.current = null;
|
|
30727
31309
|
setHoveredNavContainerRect(null);
|
|
31310
|
+
siblingHintElRef.current = null;
|
|
31311
|
+
setSiblingHintRect(null);
|
|
31312
|
+
setSiblingHintRects([]);
|
|
30728
31313
|
dismissImageHover();
|
|
31314
|
+
clearImageHover();
|
|
31315
|
+
setSectionGap(null);
|
|
30729
31316
|
return;
|
|
30730
31317
|
}
|
|
30731
31318
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30737,7 +31324,11 @@ function OhhwellsBridge() {
|
|
|
30737
31324
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30738
31325
|
const { clientX, clientY } = e.data;
|
|
30739
31326
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30740
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31327
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31328
|
+
dismissImageHover();
|
|
31329
|
+
clearImageHover();
|
|
31330
|
+
return;
|
|
31331
|
+
}
|
|
30741
31332
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30742
31333
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30743
31334
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -31117,6 +31708,7 @@ function OhhwellsBridge() {
|
|
|
31117
31708
|
applyAiFooterFromContent(content);
|
|
31118
31709
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31119
31710
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31711
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31120
31712
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31121
31713
|
}
|
|
31122
31714
|
applyBrandChrome(content);
|
|
@@ -31131,15 +31723,16 @@ function OhhwellsBridge() {
|
|
|
31131
31723
|
}
|
|
31132
31724
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31133
31725
|
if (key === AI_FOOTER_KEY) continue;
|
|
31726
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31727
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31134
31728
|
if (key === BRAND_KIT_KEY) continue;
|
|
31135
31729
|
if (key === STYLE_STORE_KEY) continue;
|
|
31136
31730
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31137
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31138
31731
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31139
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31140
31732
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31141
31733
|
continue;
|
|
31142
31734
|
}
|
|
31735
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
|
|
31143
31736
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31144
31737
|
if (applyCarouselNode(key, val)) continue;
|
|
31145
31738
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31165,6 +31758,8 @@ function OhhwellsBridge() {
|
|
|
31165
31758
|
});
|
|
31166
31759
|
applyLinkByKey(key, val);
|
|
31167
31760
|
}
|
|
31761
|
+
applySectionEmbeds(content);
|
|
31762
|
+
applySectionExtras(content);
|
|
31168
31763
|
applyLogoFromContent(content);
|
|
31169
31764
|
applyLogoSizes(content);
|
|
31170
31765
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31179,6 +31774,7 @@ function OhhwellsBridge() {
|
|
|
31179
31774
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
31180
31775
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
31181
31776
|
syncButtonsFromContent(document, editContentRef.current);
|
|
31777
|
+
applyHiddenEditablesToDom(editContentRef.current);
|
|
31182
31778
|
if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
|
|
31183
31779
|
syncNavigationDragCursorAttrs();
|
|
31184
31780
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
@@ -31804,6 +32400,12 @@ function OhhwellsBridge() {
|
|
|
31804
32400
|
closeLinkPopoverRef.current();
|
|
31805
32401
|
return;
|
|
31806
32402
|
}
|
|
32403
|
+
if (floatingPanelOpenRef.current) {
|
|
32404
|
+
setFloatingPanelRef.current(null);
|
|
32405
|
+
deselectRef.current();
|
|
32406
|
+
deactivateRef.current();
|
|
32407
|
+
return;
|
|
32408
|
+
}
|
|
31807
32409
|
deselectRef.current();
|
|
31808
32410
|
deactivateRef.current();
|
|
31809
32411
|
clearMediaSelectionRef.current();
|
|
@@ -31982,7 +32584,7 @@ function OhhwellsBridge() {
|
|
|
31982
32584
|
return;
|
|
31983
32585
|
}
|
|
31984
32586
|
}
|
|
31985
|
-
if ((e.key === "Delete" || e.key === "Backspace") &&
|
|
32587
|
+
if ((e.key === "Delete" || e.key === "Backspace") && !activeElRef.current && !linkPopoverOpenRef.current && (selectedElRef.current || selectedMediaElRef.current || selectedIconElRef.current)) {
|
|
31986
32588
|
if (handleDeleteSelectedRef.current()) {
|
|
31987
32589
|
e.preventDefault();
|
|
31988
32590
|
return;
|
|
@@ -32634,10 +33236,10 @@ function OhhwellsBridge() {
|
|
|
32634
33236
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32635
33237
|
window.removeEventListener("message", handleDeactivate);
|
|
32636
33238
|
window.removeEventListener("message", handleSelectNav);
|
|
32637
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32638
33239
|
window.removeEventListener("message", handleToastAction);
|
|
32639
33240
|
window.removeEventListener("message", handleFormCount);
|
|
32640
33241
|
window.removeEventListener("message", handleUiEscape);
|
|
33242
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32641
33243
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32642
33244
|
autoSaveTimers.current.clear();
|
|
32643
33245
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32931,7 +33533,7 @@ function OhhwellsBridge() {
|
|
|
32931
33533
|
postToParent2({
|
|
32932
33534
|
type: "ow:ready",
|
|
32933
33535
|
version: "1",
|
|
32934
|
-
bridgeVersion: "0.1.
|
|
33536
|
+
bridgeVersion: "0.1.172-next.457",
|
|
32935
33537
|
path: pathname,
|
|
32936
33538
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32937
33539
|
sections
|
|
@@ -33288,7 +33890,154 @@ function OhhwellsBridge() {
|
|
|
33288
33890
|
enforceLinkHrefs();
|
|
33289
33891
|
return true;
|
|
33290
33892
|
}, []);
|
|
33893
|
+
const deleteAiBlock = (0, import_react25.useCallback)(
|
|
33894
|
+
(editKey, opts) => {
|
|
33895
|
+
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33896
|
+
if (deletingAiBlockRef.current) return false;
|
|
33897
|
+
const plan = planAiBlockRemoval(aiSectionsRef.current, editKey);
|
|
33898
|
+
if (!plan) return false;
|
|
33899
|
+
if (!plan.ok) {
|
|
33900
|
+
postToParent2({
|
|
33901
|
+
type: "ow:toast",
|
|
33902
|
+
title: plan.reasons[0] ?? "That block cannot be deleted",
|
|
33903
|
+
toastType: "error"
|
|
33904
|
+
});
|
|
33905
|
+
return true;
|
|
33906
|
+
}
|
|
33907
|
+
const { tree: nextTree, entry } = plan;
|
|
33908
|
+
const previous = aiSectionsRef.current;
|
|
33909
|
+
deletingAiBlockRef.current = true;
|
|
33910
|
+
void requestValidateTree5(postToParent2, nextTree).then(({ ok, reasons }) => {
|
|
33911
|
+
deletingAiBlockRef.current = false;
|
|
33912
|
+
if (!ok) {
|
|
33913
|
+
postToParent2({
|
|
33914
|
+
type: "ow:toast",
|
|
33915
|
+
title: reasons[0] ?? "That change is not allowed.",
|
|
33916
|
+
toastType: "error"
|
|
33917
|
+
});
|
|
33918
|
+
return;
|
|
33919
|
+
}
|
|
33920
|
+
clearMediaSelectionRef.current();
|
|
33921
|
+
clearIconSelectionRef.current();
|
|
33922
|
+
applyTreeLocalRef.current?.({
|
|
33923
|
+
id: entry.id,
|
|
33924
|
+
mode: "replace",
|
|
33925
|
+
targetSectionId: entry.id,
|
|
33926
|
+
tree: nextTree,
|
|
33927
|
+
label: entry.label,
|
|
33928
|
+
media: entry.media,
|
|
33929
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
33930
|
+
skipScrollIntoView: true
|
|
33931
|
+
});
|
|
33932
|
+
const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `delete-block-${Date.now()}`;
|
|
33933
|
+
pendingDeleteUndoRef.current = {
|
|
33934
|
+
actionId,
|
|
33935
|
+
restore: () => {
|
|
33936
|
+
clearInteractionChromeRef.current();
|
|
33937
|
+
aiSectionsRef.current = previous;
|
|
33938
|
+
applyAiSectionsToDom(parseAiSectionsState(previous));
|
|
33939
|
+
const restoreHeight = document.body.scrollHeight;
|
|
33940
|
+
if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
|
|
33941
|
+
postToParent2({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: previous }] });
|
|
33942
|
+
postToParent2({
|
|
33943
|
+
type: "ow:ai-sections-changed",
|
|
33944
|
+
sections: collectSections(),
|
|
33945
|
+
nodes: collectEditableNodes(editContentRef.current)
|
|
33946
|
+
});
|
|
33947
|
+
}
|
|
33948
|
+
};
|
|
33949
|
+
postToParent2({
|
|
33950
|
+
type: "ow:toast",
|
|
33951
|
+
title: "Block deleted",
|
|
33952
|
+
toastType: "success",
|
|
33953
|
+
actionLabel: "Undo",
|
|
33954
|
+
actionId,
|
|
33955
|
+
duration: 6e3
|
|
33956
|
+
});
|
|
33957
|
+
});
|
|
33958
|
+
return true;
|
|
33959
|
+
},
|
|
33960
|
+
[postToParent2]
|
|
33961
|
+
);
|
|
33962
|
+
const softHideTemplateEditable = (0, import_react25.useCallback)(
|
|
33963
|
+
(el, opts) => {
|
|
33964
|
+
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33965
|
+
if (!canSoftHideEditable(el, {
|
|
33966
|
+
isNavFooterItem: Boolean(
|
|
33967
|
+
getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
|
|
33968
|
+
)
|
|
33969
|
+
})) {
|
|
33970
|
+
return false;
|
|
33971
|
+
}
|
|
33972
|
+
const previousContent = editContentRef.current;
|
|
33973
|
+
const result = softHideEditableInDom(el, previousContent);
|
|
33974
|
+
if (!result) return false;
|
|
33975
|
+
editContentRef.current = result.content;
|
|
33976
|
+
postToParent2({ type: "ow:change", nodes: result.nodes });
|
|
33977
|
+
clearMediaSelectionRef.current();
|
|
33978
|
+
clearIconSelectionRef.current();
|
|
33979
|
+
clearInteractionChromeRef.current();
|
|
33980
|
+
clearFormPickRef.current?.();
|
|
33981
|
+
deselectRef.current();
|
|
33982
|
+
const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `hide-editable-${Date.now()}`;
|
|
33983
|
+
const hiddenKey = result.key;
|
|
33984
|
+
pendingDeleteUndoRef.current = {
|
|
33985
|
+
actionId,
|
|
33986
|
+
restore: () => {
|
|
33987
|
+
clearInteractionChromeRef.current();
|
|
33988
|
+
const restored = softUnhideEditableInDom(hiddenKey, editContentRef.current);
|
|
33989
|
+
editContentRef.current = restored.content;
|
|
33990
|
+
postToParent2({ type: "ow:change", nodes: restored.nodes });
|
|
33991
|
+
const restoreHeight = document.body.scrollHeight;
|
|
33992
|
+
if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
|
|
33993
|
+
}
|
|
33994
|
+
};
|
|
33995
|
+
postToParent2({
|
|
33996
|
+
type: "ow:toast",
|
|
33997
|
+
title: "Block deleted",
|
|
33998
|
+
toastType: "success",
|
|
33999
|
+
actionLabel: "Undo",
|
|
34000
|
+
actionId,
|
|
34001
|
+
duration: 6e3
|
|
34002
|
+
});
|
|
34003
|
+
return true;
|
|
34004
|
+
},
|
|
34005
|
+
[postToParent2]
|
|
34006
|
+
);
|
|
34007
|
+
const deleteFromToolbar = (0, import_react25.useCallback)(
|
|
34008
|
+
(editKey, el) => {
|
|
34009
|
+
if (!editKey && !el) return false;
|
|
34010
|
+
if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
|
|
34011
|
+
return deleteAiBlock(editKey, { fromToolbar: true });
|
|
34012
|
+
}
|
|
34013
|
+
const target = el ?? (editKey ? document.querySelector(`[data-ohw-key="${editKey.replace(/"/g, '\\"')}"]`) : null);
|
|
34014
|
+
if (target) return softHideTemplateEditable(target, { fromToolbar: true });
|
|
34015
|
+
return false;
|
|
34016
|
+
},
|
|
34017
|
+
[deleteAiBlock, softHideTemplateEditable]
|
|
34018
|
+
);
|
|
34019
|
+
const resolveSelectedAiBlockKey = (0, import_react25.useCallback)(() => {
|
|
34020
|
+
const candidates = [
|
|
34021
|
+
activeElRef.current?.dataset.ohwKey,
|
|
34022
|
+
selectedMediaElRef.current?.dataset.ohwKey,
|
|
34023
|
+
selectedMedia?.key,
|
|
34024
|
+
selectedIconElRef.current?.dataset.ohwKey,
|
|
34025
|
+
selectedElRef.current?.getAttribute("data-ohw-href-key"),
|
|
34026
|
+
selectedElRef.current?.dataset.ohwKey,
|
|
34027
|
+
selectedElRef.current?.querySelector("[data-ohw-key]")?.dataset.ohwKey
|
|
34028
|
+
];
|
|
34029
|
+
for (const key of candidates) {
|
|
34030
|
+
if (key && canRemoveAiBlock(aiSectionsRef.current, key)) return key;
|
|
34031
|
+
}
|
|
34032
|
+
return null;
|
|
34033
|
+
}, [selectedMedia]);
|
|
33291
34034
|
const handleDeleteSelected = (0, import_react25.useCallback)(() => {
|
|
34035
|
+
if (!activeElRef.current) {
|
|
34036
|
+
const aiKey = resolveSelectedAiBlockKey();
|
|
34037
|
+
if (aiKey && deleteAiBlock(aiKey)) return true;
|
|
34038
|
+
const mediaEl = selectedMediaElRef.current;
|
|
34039
|
+
if (mediaEl && softHideTemplateEditable(mediaEl, { fromToolbar: true })) return true;
|
|
34040
|
+
}
|
|
33292
34041
|
const selected = selectedElRef.current;
|
|
33293
34042
|
if (!selected) return false;
|
|
33294
34043
|
if (isCtaButton(selected)) {
|
|
@@ -33347,7 +34096,7 @@ function OhhwellsBridge() {
|
|
|
33347
34096
|
}
|
|
33348
34097
|
}
|
|
33349
34098
|
return deleted;
|
|
33350
|
-
}, [postToParent2]);
|
|
34099
|
+
}, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
|
|
33351
34100
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
33352
34101
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
33353
34102
|
const handleLinkPopoverSubmit = (0, import_react25.useCallback)(
|
|
@@ -33565,6 +34314,13 @@ function OhhwellsBridge() {
|
|
|
33565
34314
|
isUploading: false,
|
|
33566
34315
|
onReplace: handleMediaReplace,
|
|
33567
34316
|
onSelect: handleMediaSelect,
|
|
34317
|
+
onDelete: canRemoveAiBlock(aiSectionsRef.current, selectedMedia.key) || selectedMediaElRef.current != null && canSoftHideEditable(selectedMediaElRef.current, {
|
|
34318
|
+
isNavFooterItem: Boolean(
|
|
34319
|
+
getNavigationItemAnchor(selectedMediaElRef.current) && isNavFooterScopedNavigationItem(selectedMediaElRef.current) && !isCtaButton(selectedMediaElRef.current)
|
|
34320
|
+
)
|
|
34321
|
+
}) ? (key) => {
|
|
34322
|
+
deleteFromToolbar(key, selectedMediaElRef.current);
|
|
34323
|
+
} : void 0,
|
|
33568
34324
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
33569
34325
|
}
|
|
33570
34326
|
),
|
|
@@ -33729,7 +34485,24 @@ function OhhwellsBridge() {
|
|
|
33729
34485
|
children: state
|
|
33730
34486
|
},
|
|
33731
34487
|
state
|
|
33732
|
-
)) })
|
|
34488
|
+
)) }),
|
|
34489
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
34490
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
34491
|
+
"button",
|
|
34492
|
+
{
|
|
34493
|
+
type: "button",
|
|
34494
|
+
"aria-label": "Delete form",
|
|
34495
|
+
title: "Delete",
|
|
34496
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
34497
|
+
onClick: () => {
|
|
34498
|
+
setFieldTypePickerOpen(false);
|
|
34499
|
+
const form = formPickElRef.current;
|
|
34500
|
+
if (!form) return;
|
|
34501
|
+
softHideTemplateEditable(form, { fromToolbar: true });
|
|
34502
|
+
},
|
|
34503
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { size: 15, "aria-hidden": true })
|
|
34504
|
+
}
|
|
34505
|
+
)
|
|
33733
34506
|
]
|
|
33734
34507
|
}
|
|
33735
34508
|
)
|
|
@@ -33898,7 +34671,15 @@ function OhhwellsBridge() {
|
|
|
33898
34671
|
onCommand: handleCommand,
|
|
33899
34672
|
activeCommands,
|
|
33900
34673
|
showEditLink,
|
|
33901
|
-
onEditLink: openLinkPopoverForActive
|
|
34674
|
+
onEditLink: openLinkPopoverForActive,
|
|
34675
|
+
showDelete: toolbarShowAiBlockDelete,
|
|
34676
|
+
deleteDisabled: deletingAiBlockRef.current,
|
|
34677
|
+
onDelete: () => {
|
|
34678
|
+
const el = activeElRef.current;
|
|
34679
|
+
const key = el?.dataset.ohwKey;
|
|
34680
|
+
if (!key) return;
|
|
34681
|
+
deleteFromToolbar(key, el);
|
|
34682
|
+
}
|
|
33902
34683
|
}
|
|
33903
34684
|
)
|
|
33904
34685
|
] }),
|
|
@@ -34128,6 +34909,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34128
34909
|
FOOTER_COLUMN_BLOCKS,
|
|
34129
34910
|
FOOTER_COLUMN_SPANS,
|
|
34130
34911
|
FOOTER_SOCIAL_PLATFORMS,
|
|
34912
|
+
HIDDEN_EDITABLES_KEY,
|
|
34131
34913
|
ItemActionToolbar,
|
|
34132
34914
|
ItemInteractionLayer,
|
|
34133
34915
|
LinkEditorPanel,
|
|
@@ -34150,9 +34932,14 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34150
34932
|
addFooterLinkColumn,
|
|
34151
34933
|
appendFooterSocial,
|
|
34152
34934
|
applyBrandChrome,
|
|
34935
|
+
applyHiddenEditablesToDom,
|
|
34153
34936
|
applyStickySearchParams,
|
|
34937
|
+
blockPathFromEditKey,
|
|
34154
34938
|
buildDefaultFooterTree,
|
|
34155
34939
|
buildTarget,
|
|
34940
|
+
canRemoveAiBlock,
|
|
34941
|
+
canRemoveAiTextBlock,
|
|
34942
|
+
canSoftHideEditable,
|
|
34156
34943
|
dropIndicatorVariants,
|
|
34157
34944
|
ensureFooterTree,
|
|
34158
34945
|
filterAvailablePages,
|
|
@@ -34163,6 +34950,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34163
34950
|
insertFooterHours,
|
|
34164
34951
|
isDeadPageHref,
|
|
34165
34952
|
isEditSessionActive,
|
|
34953
|
+
isEditableKeyHidden,
|
|
34166
34954
|
isPlainLeftClick,
|
|
34167
34955
|
isRenderableFooterTree,
|
|
34168
34956
|
isRenderableTree,
|
|
@@ -34173,15 +34961,22 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34173
34961
|
parseAiFooterState,
|
|
34174
34962
|
parseAiSectionsState,
|
|
34175
34963
|
parseTarget,
|
|
34964
|
+
planAiBlockRemoval,
|
|
34965
|
+
planAiTextBlockRemoval,
|
|
34176
34966
|
planBuildPageSync,
|
|
34967
|
+
readHiddenEditables,
|
|
34177
34968
|
recordOverriddenPaths,
|
|
34178
34969
|
releaseTemplateLogoIfReplaced,
|
|
34970
|
+
removeBlockAtPath,
|
|
34179
34971
|
removeFooterBlock,
|
|
34180
34972
|
resetOverriddenPathsCache,
|
|
34181
34973
|
resolveFooterCopyright,
|
|
34974
|
+
resolveSoftHideTarget,
|
|
34182
34975
|
resolveStickyNavigation,
|
|
34183
34976
|
serializeAiFooterState,
|
|
34184
34977
|
shouldFetchContentForPath,
|
|
34978
|
+
softHideEditableInDom,
|
|
34979
|
+
softUnhideEditableInDom,
|
|
34185
34980
|
stepViableSlide,
|
|
34186
34981
|
stripPlaceholderText,
|
|
34187
34982
|
stripPlaceholders,
|
|
@@ -34189,6 +34984,8 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
34189
34984
|
toggleVariants,
|
|
34190
34985
|
useOhwCarousel,
|
|
34191
34986
|
validateUrlInput,
|
|
34192
|
-
viableSlides
|
|
34987
|
+
viableSlides,
|
|
34988
|
+
withHiddenEditable,
|
|
34989
|
+
withoutHiddenEditable
|
|
34193
34990
|
});
|
|
34194
34991
|
//# sourceMappingURL=index.cjs.map
|