@ohhwells/bridge 0.1.171 → 0.1.172-next.456
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 +1560 -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 +1582 -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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as
|
|
4
|
+
import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
|
|
5
5
|
import { createRoot as createRoot3 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync3 } from "react-dom";
|
|
7
7
|
|
|
@@ -1127,21 +1127,21 @@ function chromeFrom(sample) {
|
|
|
1127
1127
|
};
|
|
1128
1128
|
}
|
|
1129
1129
|
function filledPrimary(seed) {
|
|
1130
|
-
const
|
|
1131
|
-
const luminance = relativeLuminance(
|
|
1130
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1131
|
+
const luminance = relativeLuminance(paint2);
|
|
1132
1132
|
return {
|
|
1133
|
-
background: toCss({ ...
|
|
1133
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1134
1134
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1135
1135
|
borderColor: TRANSPARENT,
|
|
1136
1136
|
borderWidth: "0px"
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
1139
|
function generatedSecondary(primary) {
|
|
1140
|
-
const
|
|
1140
|
+
const paint2 = accentColor(primary);
|
|
1141
1141
|
return {
|
|
1142
1142
|
background: TRANSPARENT,
|
|
1143
|
-
color:
|
|
1144
|
-
borderColor:
|
|
1143
|
+
color: paint2,
|
|
1144
|
+
borderColor: paint2,
|
|
1145
1145
|
borderWidth: "1px"
|
|
1146
1146
|
};
|
|
1147
1147
|
}
|
|
@@ -1154,9 +1154,9 @@ function generatedGhost(primary) {
|
|
|
1154
1154
|
};
|
|
1155
1155
|
}
|
|
1156
1156
|
function normalizeOutlineChrome(outline, primary) {
|
|
1157
|
-
const
|
|
1157
|
+
const paint2 = accentColor(primary);
|
|
1158
1158
|
const text = parseColor(outline.color);
|
|
1159
|
-
const paintRgb = parseColor(
|
|
1159
|
+
const paintRgb = parseColor(paint2);
|
|
1160
1160
|
const primaryLabel = parseColor(primary.color);
|
|
1161
1161
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1162
1162
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1165,8 +1165,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1165
1165
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1166
1166
|
return {
|
|
1167
1167
|
...outline,
|
|
1168
|
-
color:
|
|
1169
|
-
borderColor: hasBorder ?
|
|
1168
|
+
color: paint2,
|
|
1169
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1170
1170
|
};
|
|
1171
1171
|
}
|
|
1172
1172
|
function generateButtonVariants(samples) {
|
|
@@ -5199,6 +5199,118 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5199
5199
|
};
|
|
5200
5200
|
}
|
|
5201
5201
|
|
|
5202
|
+
// src/lib/hidden-editables.ts
|
|
5203
|
+
var HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
|
|
5204
|
+
var HIDDEN_ATTR = "data-ohw-editable-hidden";
|
|
5205
|
+
var FORM_SELECTOR = '[data-ohw-editable="form"]';
|
|
5206
|
+
function parseJson3(raw) {
|
|
5207
|
+
if (!raw) return null;
|
|
5208
|
+
try {
|
|
5209
|
+
return JSON.parse(raw);
|
|
5210
|
+
} catch {
|
|
5211
|
+
return null;
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
function readHiddenEditables(content) {
|
|
5215
|
+
const parsed = parseJson3(content?.[HIDDEN_EDITABLES_KEY]);
|
|
5216
|
+
if (!Array.isArray(parsed)) return [];
|
|
5217
|
+
return [...new Set(parsed.filter((key) => typeof key === "string" && key.length > 0))];
|
|
5218
|
+
}
|
|
5219
|
+
function isEditableKeyHidden(content, key) {
|
|
5220
|
+
if (!key) return false;
|
|
5221
|
+
return readHiddenEditables(content).includes(key);
|
|
5222
|
+
}
|
|
5223
|
+
function resolveSoftHideTarget(el) {
|
|
5224
|
+
const cta = el.closest(CTA_BUTTON_SELECTOR);
|
|
5225
|
+
if (cta) return cta;
|
|
5226
|
+
const form = el.closest(FORM_SELECTOR);
|
|
5227
|
+
if (form) return form;
|
|
5228
|
+
return el;
|
|
5229
|
+
}
|
|
5230
|
+
function canSoftHideEditable(el, opts) {
|
|
5231
|
+
if (!el) return false;
|
|
5232
|
+
const target = resolveSoftHideTarget(el);
|
|
5233
|
+
const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
|
|
5234
|
+
if (!key) return false;
|
|
5235
|
+
if (key.startsWith("ai.")) return false;
|
|
5236
|
+
if (key.startsWith("__ohw_")) return false;
|
|
5237
|
+
if (el.hasAttribute("data-ohw-section") || target.hasAttribute("data-ohw-section")) return false;
|
|
5238
|
+
if (el.closest("[data-ohw-social-item]")) return false;
|
|
5239
|
+
if (target.matches(FORM_SELECTOR) || el.dataset.ohwEditable === "form") return true;
|
|
5240
|
+
const cta = el.closest(CTA_BUTTON_SELECTOR);
|
|
5241
|
+
if (cta) return !isLastNavbarButton(cta);
|
|
5242
|
+
if (opts?.isNavFooterItem) return false;
|
|
5243
|
+
if (el.closest("[data-ohw-nav-container], [data-ohw-nav-drawer], [data-ohw-nav-root], nav")) {
|
|
5244
|
+
if (el.closest("[data-ohw-href-key], [data-ohw-nav-item], [data-ohw-nav-group]")) return false;
|
|
5245
|
+
}
|
|
5246
|
+
if (el.closest("footer, [data-ai-footer]")) {
|
|
5247
|
+
if (el.closest("[data-ohw-href-key], [data-ohw-footer-item], [data-ohw-social-item]")) return false;
|
|
5248
|
+
}
|
|
5249
|
+
const kind = el.dataset.ohwEditable;
|
|
5250
|
+
return kind === "text" || kind === "plain" || kind === "image" || kind === "bg-image" || kind === "video" || kind === "icon" || kind === "link" || kind === "map";
|
|
5251
|
+
}
|
|
5252
|
+
function withHiddenEditable(content, key) {
|
|
5253
|
+
const hidden = readHiddenEditables(content);
|
|
5254
|
+
if (hidden.includes(key)) {
|
|
5255
|
+
return {
|
|
5256
|
+
content,
|
|
5257
|
+
nodes: [{ key: HIDDEN_EDITABLES_KEY, text: content[HIDDEN_EDITABLES_KEY] ?? "[]" }],
|
|
5258
|
+
added: false
|
|
5259
|
+
};
|
|
5260
|
+
}
|
|
5261
|
+
const nextHidden = [...hidden, key];
|
|
5262
|
+
const text = JSON.stringify(nextHidden);
|
|
5263
|
+
return {
|
|
5264
|
+
content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
|
|
5265
|
+
nodes: [{ key: HIDDEN_EDITABLES_KEY, text }],
|
|
5266
|
+
added: true
|
|
5267
|
+
};
|
|
5268
|
+
}
|
|
5269
|
+
function withoutHiddenEditable(content, key) {
|
|
5270
|
+
const nextHidden = readHiddenEditables(content).filter((entry) => entry !== key);
|
|
5271
|
+
const text = JSON.stringify(nextHidden);
|
|
5272
|
+
return {
|
|
5273
|
+
content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
|
|
5274
|
+
nodes: [{ key: HIDDEN_EDITABLES_KEY, text }]
|
|
5275
|
+
};
|
|
5276
|
+
}
|
|
5277
|
+
function escapeAttrValue(value) {
|
|
5278
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
5279
|
+
}
|
|
5280
|
+
function markHidden(el) {
|
|
5281
|
+
softHide(el);
|
|
5282
|
+
el.setAttribute(HIDDEN_ATTR, "");
|
|
5283
|
+
}
|
|
5284
|
+
function markVisible(el) {
|
|
5285
|
+
softUnhide(el);
|
|
5286
|
+
el.removeAttribute(HIDDEN_ATTR);
|
|
5287
|
+
}
|
|
5288
|
+
function applyHiddenEditablesToDom(content, root = document) {
|
|
5289
|
+
const hidden = readHiddenEditables(content);
|
|
5290
|
+
root.querySelectorAll(`[${HIDDEN_ATTR}]`).forEach((el) => markVisible(el));
|
|
5291
|
+
for (const key of hidden) {
|
|
5292
|
+
root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
|
|
5293
|
+
markHidden(resolveSoftHideTarget(el));
|
|
5294
|
+
});
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
function softHideEditableInDom(el, content) {
|
|
5298
|
+
if (!canSoftHideEditable(el)) return null;
|
|
5299
|
+
const target = resolveSoftHideTarget(el);
|
|
5300
|
+
const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
|
|
5301
|
+
if (!key) return null;
|
|
5302
|
+
const next = withHiddenEditable(content, key);
|
|
5303
|
+
markHidden(target);
|
|
5304
|
+
return { content: next.content, nodes: next.nodes, key, target };
|
|
5305
|
+
}
|
|
5306
|
+
function softUnhideEditableInDom(key, content, root = document) {
|
|
5307
|
+
const next = withoutHiddenEditable(content, key);
|
|
5308
|
+
root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
|
|
5309
|
+
markVisible(resolveSoftHideTarget(el));
|
|
5310
|
+
});
|
|
5311
|
+
return next;
|
|
5312
|
+
}
|
|
5313
|
+
|
|
5202
5314
|
// src/lib/collect-editable-nodes.ts
|
|
5203
5315
|
var VIDEO_AUTOPLAY_SUFFIX = "__ohw_autoplay";
|
|
5204
5316
|
var VIDEO_MUTED_SUFFIX = "__ohw_muted";
|
|
@@ -5277,7 +5389,9 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
5277
5389
|
BUTTON_ASSIGNMENTS_KEY,
|
|
5278
5390
|
BUTTON_COLLECTIONS_KEY,
|
|
5279
5391
|
BUTTON_SNAPSHOTS_KEY,
|
|
5280
|
-
BUTTON_HIDDEN_KEY
|
|
5392
|
+
BUTTON_HIDDEN_KEY,
|
|
5393
|
+
// Soft-hidden template slots (non-AI Delete) — no DOM marker when hidden.
|
|
5394
|
+
HIDDEN_EDITABLES_KEY
|
|
5281
5395
|
]) {
|
|
5282
5396
|
const text = extraContent[key];
|
|
5283
5397
|
if (typeof text === "string" && text.length > 0) {
|
|
@@ -6762,6 +6876,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6762
6876
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6763
6877
|
return target ? pricingFeatureList(target).length : 0;
|
|
6764
6878
|
}
|
|
6879
|
+
function prevailingFeatureIcon(features) {
|
|
6880
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6881
|
+
for (const row of features) {
|
|
6882
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6883
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6884
|
+
entry.count += 1;
|
|
6885
|
+
counts.set(key, entry);
|
|
6886
|
+
}
|
|
6887
|
+
let best = null;
|
|
6888
|
+
for (const entry of counts.values()) {
|
|
6889
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6890
|
+
}
|
|
6891
|
+
if (!best) return {};
|
|
6892
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6893
|
+
}
|
|
6765
6894
|
function addPricingCardFeature(tree, index, text) {
|
|
6766
6895
|
return withPricingCollection(tree, (collection) => {
|
|
6767
6896
|
const children = collection.children;
|
|
@@ -6770,7 +6899,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6770
6899
|
const features = pricingFeatureList(target);
|
|
6771
6900
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6772
6901
|
target.slots = target.slots ?? {};
|
|
6773
|
-
target.slots.features = [...features, { text }];
|
|
6902
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6774
6903
|
return true;
|
|
6775
6904
|
});
|
|
6776
6905
|
}
|
|
@@ -6837,6 +6966,127 @@ function rewriteIconSlot(tree, path, ref) {
|
|
|
6837
6966
|
return next;
|
|
6838
6967
|
}
|
|
6839
6968
|
|
|
6969
|
+
// src/lib/ai-remove-block.ts
|
|
6970
|
+
function blockPathFromEditKey(sectionId, key) {
|
|
6971
|
+
const prefix = aiSlotKeyPrefixFor(sectionId);
|
|
6972
|
+
if (!key.startsWith(prefix)) return void 0;
|
|
6973
|
+
const path = [];
|
|
6974
|
+
for (const part of key.slice(prefix.length).split(".")) {
|
|
6975
|
+
if (/^[rbc]\d+$/.test(part)) path.push(part);
|
|
6976
|
+
else break;
|
|
6977
|
+
}
|
|
6978
|
+
if (path.length < 2 || !/^r\d+$/.test(path[0]) || !/^b\d+$/.test(path[1])) return void 0;
|
|
6979
|
+
return path.join(".");
|
|
6980
|
+
}
|
|
6981
|
+
function parseBlockPath(path) {
|
|
6982
|
+
const segs = [];
|
|
6983
|
+
for (const part of path.split(".")) {
|
|
6984
|
+
const match = part.match(/^([rbc])(\d+)$/);
|
|
6985
|
+
if (!match) return void 0;
|
|
6986
|
+
segs.push({ kind: match[1], index: Number(match[2]) });
|
|
6987
|
+
}
|
|
6988
|
+
if (segs.length < 2 || segs[0].kind !== "r" || segs[1].kind !== "b") return void 0;
|
|
6989
|
+
return segs;
|
|
6990
|
+
}
|
|
6991
|
+
function cloneTree(tree) {
|
|
6992
|
+
return JSON.parse(JSON.stringify(tree));
|
|
6993
|
+
}
|
|
6994
|
+
function nodeAtPath2(tree, segs) {
|
|
6995
|
+
let node = tree.rows?.[segs[0].index]?.blocks?.[segs[1].index];
|
|
6996
|
+
for (let i = 2; i < segs.length; i += 1) {
|
|
6997
|
+
if (segs[i].kind !== "c") return null;
|
|
6998
|
+
node = node?.children?.[segs[i].index];
|
|
6999
|
+
}
|
|
7000
|
+
return node ?? null;
|
|
7001
|
+
}
|
|
7002
|
+
function unwrapPromoted(node) {
|
|
7003
|
+
if (node.promoted === true && node.slots?.layout === "stack" && (node.children?.length ?? 0) === 1) {
|
|
7004
|
+
const only = { ...node.children[0] };
|
|
7005
|
+
if (node.slot) only.slot = node.slot;
|
|
7006
|
+
only.span = node.span;
|
|
7007
|
+
return only;
|
|
7008
|
+
}
|
|
7009
|
+
return node;
|
|
7010
|
+
}
|
|
7011
|
+
function removeBlockAtPath(tree, path) {
|
|
7012
|
+
const segs = parseBlockPath(path);
|
|
7013
|
+
if (!segs) return { ok: false, reasons: [`invalid block path "${path}"`] };
|
|
7014
|
+
const next = cloneTree(tree);
|
|
7015
|
+
const rowIndex = segs[0].index;
|
|
7016
|
+
const row = next.rows[rowIndex];
|
|
7017
|
+
if (!row) return { ok: false, reasons: [`row ${rowIndex} not found`] };
|
|
7018
|
+
if (segs.length === 2) {
|
|
7019
|
+
const blockIndex = segs[1].index;
|
|
7020
|
+
if (!row.blocks[blockIndex]) return { ok: false, reasons: [`block ${path} not found`] };
|
|
7021
|
+
row.blocks.splice(blockIndex, 1);
|
|
7022
|
+
if (row.blocks.length === 0) {
|
|
7023
|
+
next.rows.splice(rowIndex, 1);
|
|
7024
|
+
} else if (row.blocks.length === 1) {
|
|
7025
|
+
row.blocks[0] = { ...row.blocks[0], span: 12 };
|
|
7026
|
+
delete row.blocks[0].slot;
|
|
7027
|
+
}
|
|
7028
|
+
} else {
|
|
7029
|
+
let parent = row.blocks[segs[1].index];
|
|
7030
|
+
for (let i = 2; i < segs.length - 1; i += 1) {
|
|
7031
|
+
if (!parent?.children || segs[i].kind !== "c") {
|
|
7032
|
+
return { ok: false, reasons: [`block ${path} not found`] };
|
|
7033
|
+
}
|
|
7034
|
+
parent = parent.children[segs[i].index];
|
|
7035
|
+
}
|
|
7036
|
+
const childIndex = segs[segs.length - 1].index;
|
|
7037
|
+
if (!parent?.children || segs[segs.length - 1].kind !== "c" || !parent.children[childIndex]) {
|
|
7038
|
+
return { ok: false, reasons: [`block ${path} not found`] };
|
|
7039
|
+
}
|
|
7040
|
+
parent.children.splice(childIndex, 1);
|
|
7041
|
+
if (segs.length === 3) {
|
|
7042
|
+
row.blocks[segs[1].index] = unwrapPromoted(parent);
|
|
7043
|
+
if (row.blocks[segs[1].index].type === "group" && (row.blocks[segs[1].index].children?.length ?? 0) === 0) {
|
|
7044
|
+
row.blocks.splice(segs[1].index, 1);
|
|
7045
|
+
if (row.blocks.length === 0) next.rows.splice(rowIndex, 1);
|
|
7046
|
+
}
|
|
7047
|
+
if (next.rows[rowIndex]?.blocks.length === 1) {
|
|
7048
|
+
next.rows[rowIndex].blocks[0] = { ...next.rows[rowIndex].blocks[0], span: 12 };
|
|
7049
|
+
delete next.rows[rowIndex].blocks[0].slot;
|
|
7050
|
+
}
|
|
7051
|
+
} else {
|
|
7052
|
+
const grand = row.blocks[segs[1].index];
|
|
7053
|
+
let cursor = grand;
|
|
7054
|
+
for (let i = 2; i < segs.length - 2; i += 1) {
|
|
7055
|
+
cursor = cursor?.children?.[segs[i].index];
|
|
7056
|
+
}
|
|
7057
|
+
const containerIndex = segs[segs.length - 2].index;
|
|
7058
|
+
if (cursor?.children?.[containerIndex]) {
|
|
7059
|
+
cursor.children[containerIndex] = unwrapPromoted(parent);
|
|
7060
|
+
}
|
|
7061
|
+
}
|
|
7062
|
+
}
|
|
7063
|
+
if (next.rows.length === 0) {
|
|
7064
|
+
return { ok: false, reasons: ["a section must keep at least one block"] };
|
|
7065
|
+
}
|
|
7066
|
+
return { ok: true, tree: next };
|
|
7067
|
+
}
|
|
7068
|
+
function planAiBlockRemoval(aiSectionsRaw, editKey) {
|
|
7069
|
+
if (!editKey || !editKey.startsWith("ai.")) return null;
|
|
7070
|
+
const state = parseAiSectionsState(aiSectionsRaw);
|
|
7071
|
+
const entry = state.sections.find((s) => editKey.startsWith(aiSlotKeyPrefixFor(s.id)));
|
|
7072
|
+
if (!entry) return null;
|
|
7073
|
+
const path = blockPathFromEditKey(entry.id, editKey);
|
|
7074
|
+
if (!path) return null;
|
|
7075
|
+
const segs = parseBlockPath(path);
|
|
7076
|
+
if (!segs) return null;
|
|
7077
|
+
const node = nodeAtPath2(entry.tree, segs);
|
|
7078
|
+
if (!node) return null;
|
|
7079
|
+
const removed = removeBlockAtPath(entry.tree, path);
|
|
7080
|
+
if (!removed.ok) return removed;
|
|
7081
|
+
return { ok: true, tree: removed.tree, path, entry };
|
|
7082
|
+
}
|
|
7083
|
+
var planAiTextBlockRemoval = planAiBlockRemoval;
|
|
7084
|
+
function canRemoveAiBlock(aiSectionsRaw, editKey) {
|
|
7085
|
+
const plan = planAiBlockRemoval(aiSectionsRaw, editKey);
|
|
7086
|
+
return plan?.ok === true;
|
|
7087
|
+
}
|
|
7088
|
+
var canRemoveAiTextBlock = canRemoveAiBlock;
|
|
7089
|
+
|
|
6840
7090
|
// src/lib/ai-footer-tree.ts
|
|
6841
7091
|
var FOOTER_COLUMN_SPANS = [12, 6, 4, 3];
|
|
6842
7092
|
var FOOTER_COLUMN_BLOCKS = [
|
|
@@ -7414,6 +7664,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7414
7664
|
);
|
|
7415
7665
|
}
|
|
7416
7666
|
|
|
7667
|
+
// src/lib/youtube.ts
|
|
7668
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7669
|
+
function extractYouTubeId(input) {
|
|
7670
|
+
const trimmed = input.trim();
|
|
7671
|
+
if (!trimmed) return null;
|
|
7672
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7673
|
+
let url;
|
|
7674
|
+
try {
|
|
7675
|
+
url = new URL(trimmed);
|
|
7676
|
+
} catch {
|
|
7677
|
+
return null;
|
|
7678
|
+
}
|
|
7679
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7680
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7681
|
+
return null;
|
|
7682
|
+
}
|
|
7683
|
+
let candidate = null;
|
|
7684
|
+
if (host === "youtu.be") {
|
|
7685
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7686
|
+
} else if (url.pathname === "/watch") {
|
|
7687
|
+
candidate = url.searchParams.get("v");
|
|
7688
|
+
} else {
|
|
7689
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7690
|
+
candidate = match ? match[1] : null;
|
|
7691
|
+
}
|
|
7692
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7693
|
+
}
|
|
7694
|
+
|
|
7695
|
+
// src/lib/section-embed.ts
|
|
7696
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7697
|
+
function readStoredEmbed(value) {
|
|
7698
|
+
if (value.startsWith("start\n")) {
|
|
7699
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7700
|
+
}
|
|
7701
|
+
return { raw: value, at: "end" };
|
|
7702
|
+
}
|
|
7703
|
+
function embedFrameSrc(value) {
|
|
7704
|
+
const videoId = extractYouTubeId(value);
|
|
7705
|
+
if (videoId) {
|
|
7706
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7707
|
+
}
|
|
7708
|
+
let url;
|
|
7709
|
+
try {
|
|
7710
|
+
url = new URL(value);
|
|
7711
|
+
} catch {
|
|
7712
|
+
return null;
|
|
7713
|
+
}
|
|
7714
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7715
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7716
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7717
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7718
|
+
return { src, title: "Map" };
|
|
7719
|
+
}
|
|
7720
|
+
if (host === "maps.app.goo.gl") {
|
|
7721
|
+
return { src: value, title: "Map" };
|
|
7722
|
+
}
|
|
7723
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7724
|
+
return { src: value, title: "Calendar" };
|
|
7725
|
+
}
|
|
7726
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7727
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7728
|
+
}
|
|
7729
|
+
if (host === "forms.gle") {
|
|
7730
|
+
return { src: value, title: "Form" };
|
|
7731
|
+
}
|
|
7732
|
+
return null;
|
|
7733
|
+
}
|
|
7734
|
+
function place(section, box, at) {
|
|
7735
|
+
if (at === "start") {
|
|
7736
|
+
section.insertBefore(box, section.firstChild);
|
|
7737
|
+
return;
|
|
7738
|
+
}
|
|
7739
|
+
section.appendChild(box);
|
|
7740
|
+
}
|
|
7741
|
+
function paint(section, key, src, title, at) {
|
|
7742
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7743
|
+
const frame = existing?.querySelector("iframe");
|
|
7744
|
+
if (existing && frame) {
|
|
7745
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7746
|
+
frame.title = title;
|
|
7747
|
+
place(section, existing, at);
|
|
7748
|
+
return;
|
|
7749
|
+
}
|
|
7750
|
+
existing?.remove();
|
|
7751
|
+
const box = document.createElement("div");
|
|
7752
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7753
|
+
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;";
|
|
7754
|
+
const frameWrap = document.createElement("div");
|
|
7755
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7756
|
+
const iframe = document.createElement("iframe");
|
|
7757
|
+
iframe.src = src;
|
|
7758
|
+
iframe.title = title;
|
|
7759
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7760
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7761
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7762
|
+
frameWrap.appendChild(iframe);
|
|
7763
|
+
box.appendChild(frameWrap);
|
|
7764
|
+
place(section, box, at);
|
|
7765
|
+
}
|
|
7766
|
+
function applySectionEmbeds(content) {
|
|
7767
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7768
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7769
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7770
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7771
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7772
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7773
|
+
if (!section || !stored || !frame) {
|
|
7774
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7775
|
+
continue;
|
|
7776
|
+
}
|
|
7777
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
7780
|
+
|
|
7417
7781
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7418
7782
|
import { flushSync } from "react-dom";
|
|
7419
7783
|
import { createRoot } from "react-dom/client";
|
|
@@ -7936,12 +8300,19 @@ function footerBodyStyle(fallbackFont, color, weight = 500) {
|
|
|
7936
8300
|
}
|
|
7937
8301
|
var str = (value) => typeof value === "string" ? value : "";
|
|
7938
8302
|
var cardRadius = (slots) => slots.cornerStyle === "sharp" ? 0 : AI_TREE_TOKENS.radiusCard;
|
|
7939
|
-
var
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
8303
|
+
var HUG_ALIGN_TYPES = /* @__PURE__ */ new Set(["button", "button-row", "rating"]);
|
|
8304
|
+
var blockAlignStyle = (blockAlign, blockType) => {
|
|
8305
|
+
if (!blockAlign) return {};
|
|
8306
|
+
if (blockType && HUG_ALIGN_TYPES.has(blockType)) {
|
|
8307
|
+
return {
|
|
8308
|
+
display: "flex",
|
|
8309
|
+
flexDirection: "column",
|
|
8310
|
+
alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
|
|
8311
|
+
textAlign: blockAlign
|
|
8312
|
+
};
|
|
8313
|
+
}
|
|
8314
|
+
return { width: "100%", textAlign: blockAlign, boxSizing: "border-box" };
|
|
8315
|
+
};
|
|
7945
8316
|
var fullBleedBlock = (block) => block.type === "carousel" || block.type === "group" && str(block.slots?.layout) === "overlap";
|
|
7946
8317
|
var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.trim()).filter(Boolean);
|
|
7947
8318
|
var AI_MOBILE_CSS = [
|
|
@@ -7987,7 +8358,7 @@ var AI_MOBILE_CSS = [
|
|
|
7987
8358
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7988
8359
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7989
8360
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
7990
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8361
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7991
8362
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7992
8363
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7993
8364
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8003,8 +8374,10 @@ var AI_MOBILE_CSS = [
|
|
|
8003
8374
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8004
8375
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8005
8376
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
8006
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
8007
|
-
|
|
8377
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8378
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8379
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8380
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
8008
8381
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8009
8382
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8010
8383
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8209,6 +8582,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8209
8582
|
function textAttrs(ctx, path) {
|
|
8210
8583
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8211
8584
|
}
|
|
8585
|
+
var AI_RESPONSIVE_CSS = [
|
|
8586
|
+
"@media (max-width: 960px) {",
|
|
8587
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8588
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8589
|
+
"}",
|
|
8590
|
+
"@media (max-width: 640px) {",
|
|
8591
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8592
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8593
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8594
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8595
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8596
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8597
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8598
|
+
// layered text used to be.
|
|
8599
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8600
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8601
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8602
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8603
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8604
|
+
// other rule had already been taught to stand down.
|
|
8605
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8606
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8607
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8608
|
+
"}"
|
|
8609
|
+
].join("\n");
|
|
8212
8610
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8213
8611
|
function MediaBox({
|
|
8214
8612
|
refValue,
|
|
@@ -8263,7 +8661,7 @@ function MediaBox({
|
|
|
8263
8661
|
position: fill ? "absolute" : void 0,
|
|
8264
8662
|
inset: fill ? 0 : void 0,
|
|
8265
8663
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8266
|
-
height: fill ? "100%" : void 0,
|
|
8664
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8267
8665
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8268
8666
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8269
8667
|
borderRadius: radius,
|
|
@@ -8464,7 +8862,13 @@ function TextBlock({
|
|
|
8464
8862
|
"div",
|
|
8465
8863
|
{
|
|
8466
8864
|
...textAttrs(ctx, `${path}.content`),
|
|
8467
|
-
style: {
|
|
8865
|
+
style: {
|
|
8866
|
+
...typeStyle(spec, font),
|
|
8867
|
+
color: ctx.brand.palette.dark,
|
|
8868
|
+
textAlign: align,
|
|
8869
|
+
width: "100%",
|
|
8870
|
+
boxSizing: "border-box"
|
|
8871
|
+
},
|
|
8468
8872
|
dangerouslySetInnerHTML: { __html: str(slots.content) }
|
|
8469
8873
|
}
|
|
8470
8874
|
);
|
|
@@ -8475,7 +8879,7 @@ function SectionHeaderBlock({ node, ctx, path }) {
|
|
|
8475
8879
|
const children = node.children ?? [];
|
|
8476
8880
|
const buttonRowIdx = children.findIndex((c) => c.type === "button-row");
|
|
8477
8881
|
const buttonRow = buttonRowIdx >= 0 ? children[buttonRowIdx] : void 0;
|
|
8478
|
-
return /* @__PURE__ */ jsxs("div", { style: { textAlign: align }, children: [
|
|
8882
|
+
return /* @__PURE__ */ jsxs("div", { style: { textAlign: align, width: "100%", boxSizing: "border-box" }, children: [
|
|
8479
8883
|
str(slots.tagline) && /* @__PURE__ */ jsx(
|
|
8480
8884
|
"div",
|
|
8481
8885
|
{
|
|
@@ -9759,7 +10163,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9759
10163
|
return /* @__PURE__ */ jsx(
|
|
9760
10164
|
"div",
|
|
9761
10165
|
{
|
|
9762
|
-
"data-ai-grid":
|
|
10166
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9763
10167
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9764
10168
|
style: {
|
|
9765
10169
|
display: "grid",
|
|
@@ -10061,7 +10465,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10061
10465
|
},
|
|
10062
10466
|
children: [
|
|
10063
10467
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10064
|
-
// The section's `data-ai-
|
|
10468
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
10065
10469
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10066
10470
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10067
10471
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10094,10 +10498,10 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10094
10498
|
gridColumn: `span ${typeof child.span === "number" ? Math.min(12, Math.max(1, child.span)) : 12}`,
|
|
10095
10499
|
minWidth: 0
|
|
10096
10500
|
} : { minWidth: 0 },
|
|
10097
|
-
//
|
|
10098
|
-
//
|
|
10099
|
-
//
|
|
10100
|
-
...blockAlignStyle(child.align ?? ambientAlign)
|
|
10501
|
+
// Same ambient as renderNode below: child's own align, else the group's, else the
|
|
10502
|
+
// inherited ambient (overlap overlay / section). Copy fills the column; button-row
|
|
10503
|
+
// etc. still hug via flex alignItems.
|
|
10504
|
+
...blockAlignStyle(child.align ?? node.align ?? ambientAlign, child.type)
|
|
10101
10505
|
},
|
|
10102
10506
|
children: renderNode(child, ctx, `${path}.c${i}`, node.align ?? ambientAlign)
|
|
10103
10507
|
},
|
|
@@ -10466,12 +10870,7 @@ function AiTreeRenderer({
|
|
|
10466
10870
|
if (fillHeight) return "stretch";
|
|
10467
10871
|
return (distributed ?? settings.verticalPosition) === "top" ? "start" : "center";
|
|
10468
10872
|
};
|
|
10469
|
-
const cellAlignStyle = (blockAlign) => blockAlign
|
|
10470
|
-
display: "flex",
|
|
10471
|
-
flexDirection: "column",
|
|
10472
|
-
alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
|
|
10473
|
-
textAlign: blockAlign
|
|
10474
|
-
} : {};
|
|
10873
|
+
const cellAlignStyle = (blockAlign, blockType) => blockAlignStyle(blockAlign, blockType);
|
|
10475
10874
|
const needsOverlayClearance = fillHeight && pad === 0;
|
|
10476
10875
|
return /* @__PURE__ */ jsxs(
|
|
10477
10876
|
"section",
|
|
@@ -10480,6 +10879,7 @@ function AiTreeRenderer({
|
|
|
10480
10879
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10481
10880
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10482
10881
|
...bgAttrs,
|
|
10882
|
+
"data-ai-responsive": "",
|
|
10483
10883
|
style: {
|
|
10484
10884
|
position: "relative",
|
|
10485
10885
|
padding: `${padCss} 0`,
|
|
@@ -10493,12 +10893,13 @@ function AiTreeRenderer({
|
|
|
10493
10893
|
...fillHeight ? { display: "grid" } : {}
|
|
10494
10894
|
},
|
|
10495
10895
|
children: [
|
|
10496
|
-
|
|
10896
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10497
10897
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
10898
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10498
10899
|
/* @__PURE__ */ jsx(
|
|
10499
10900
|
"div",
|
|
10500
10901
|
{
|
|
10501
|
-
"data-ai-
|
|
10902
|
+
"data-ai-section-inner": "",
|
|
10502
10903
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10503
10904
|
style: {
|
|
10504
10905
|
position: "relative",
|
|
@@ -10515,7 +10916,7 @@ function AiTreeRenderer({
|
|
|
10515
10916
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10516
10917
|
"div",
|
|
10517
10918
|
{
|
|
10518
|
-
"data-ai-
|
|
10919
|
+
"data-ai-columns": "",
|
|
10519
10920
|
style: {
|
|
10520
10921
|
display: "grid",
|
|
10521
10922
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -10531,11 +10932,11 @@ function AiTreeRenderer({
|
|
|
10531
10932
|
gridColumn: `span ${Math.min(12, Math.max(1, block.span))}`,
|
|
10532
10933
|
minWidth: 0,
|
|
10533
10934
|
// Cascades the section's min-height stretch (see `fillHeight` above) down to
|
|
10534
|
-
// this cell; `cellAlignStyle` below overrides
|
|
10535
|
-
//
|
|
10935
|
+
// this cell; `cellAlignStyle` below overrides when the block also has its own
|
|
10936
|
+
// horizontal `align` (flex hug for buttons; width 100% for text).
|
|
10536
10937
|
...fillHeight ? { display: "grid" } : {},
|
|
10537
10938
|
// Horizontal placement of the block's content within its column.
|
|
10538
|
-
...fullBleedBlock(block) ? {} : cellAlignStyle(block.align),
|
|
10939
|
+
...fullBleedBlock(block) ? {} : cellAlignStyle(block.align, block.type),
|
|
10539
10940
|
// space-between: each column becomes a flex column whose content spreads over
|
|
10540
10941
|
// the full row height instead of clumping at the top.
|
|
10541
10942
|
...distributed === "space-between" ? { display: "flex", flexDirection: "column", justifyContent: "space-between" } : {}
|
|
@@ -11177,9 +11578,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11177
11578
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11178
11579
|
continue;
|
|
11179
11580
|
}
|
|
11180
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11181
11581
|
let container = existing?.container;
|
|
11582
|
+
let isNewMount = false;
|
|
11182
11583
|
if (!container || !container.isConnected) {
|
|
11584
|
+
isNewMount = true;
|
|
11183
11585
|
existing?.root.unmount();
|
|
11184
11586
|
container?.remove();
|
|
11185
11587
|
container = document.createElement("div");
|
|
@@ -11259,7 +11661,7 @@ import { createRoot as createRoot2 } from "react-dom/client";
|
|
|
11259
11661
|
import { flushSync as flushSync2 } from "react-dom";
|
|
11260
11662
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
11261
11663
|
var CONTAINER_ATTR2 = "data-ohw-ai-footer";
|
|
11262
|
-
var
|
|
11664
|
+
var HIDDEN_ATTR2 = "data-ohw-ai-footer-replaced";
|
|
11263
11665
|
var mounted2 = null;
|
|
11264
11666
|
var mountOptions = {};
|
|
11265
11667
|
var capturedSurface;
|
|
@@ -11289,12 +11691,12 @@ function findTemplateFooter() {
|
|
|
11289
11691
|
function hideTemplateFooter(footer) {
|
|
11290
11692
|
if (!footer) return;
|
|
11291
11693
|
footer.style.display = "none";
|
|
11292
|
-
footer.setAttribute(
|
|
11694
|
+
footer.setAttribute(HIDDEN_ATTR2, "");
|
|
11293
11695
|
}
|
|
11294
11696
|
function showTemplateFooter() {
|
|
11295
|
-
for (const el of document.querySelectorAll(`[${
|
|
11697
|
+
for (const el of document.querySelectorAll(`[${HIDDEN_ATTR2}]`)) {
|
|
11296
11698
|
el.style.removeProperty("display");
|
|
11297
|
-
el.removeAttribute(
|
|
11699
|
+
el.removeAttribute(HIDDEN_ATTR2);
|
|
11298
11700
|
}
|
|
11299
11701
|
}
|
|
11300
11702
|
function unmountAiFooter() {
|
|
@@ -11489,7 +11891,7 @@ function pickFooterColumnIndex(columnBlockCounts) {
|
|
|
11489
11891
|
}
|
|
11490
11892
|
|
|
11491
11893
|
// src/lib/ai-footer-edits.ts
|
|
11492
|
-
function
|
|
11894
|
+
function cloneTree2(tree) {
|
|
11493
11895
|
return JSON.parse(JSON.stringify(tree));
|
|
11494
11896
|
}
|
|
11495
11897
|
function rebalanceFooterColumnSpans(columns) {
|
|
@@ -11517,6 +11919,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11517
11919
|
return 3;
|
|
11518
11920
|
}
|
|
11519
11921
|
}
|
|
11922
|
+
function readLiveSocialItems() {
|
|
11923
|
+
const root = getFooterRoot();
|
|
11924
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11925
|
+
if (!row) return [];
|
|
11926
|
+
const items = [];
|
|
11927
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11928
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11929
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11930
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11931
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11932
|
+
items.push({ platform, href });
|
|
11933
|
+
}
|
|
11934
|
+
return items;
|
|
11935
|
+
}
|
|
11936
|
+
function syncSocialRowsFromDom(tree) {
|
|
11937
|
+
const root = getFooterRoot();
|
|
11938
|
+
if (!root) return;
|
|
11939
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11940
|
+
const live = readLiveSocialItems();
|
|
11941
|
+
if (row && live.length === 0) return;
|
|
11942
|
+
for (const col of tree.columns) {
|
|
11943
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11944
|
+
if (block.type !== "social-row") return [block];
|
|
11945
|
+
if (!row) return [];
|
|
11946
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11947
|
+
});
|
|
11948
|
+
}
|
|
11949
|
+
}
|
|
11520
11950
|
function collectBrandBlocks(tree) {
|
|
11521
11951
|
const brand = [];
|
|
11522
11952
|
for (const col of tree.columns) {
|
|
@@ -11539,7 +11969,7 @@ function countFooterLinkLists(tree) {
|
|
|
11539
11969
|
return collectLinkListBlocks(tree).length;
|
|
11540
11970
|
}
|
|
11541
11971
|
function packFooterTreeBrand(tree) {
|
|
11542
|
-
const next =
|
|
11972
|
+
const next = cloneTree2(tree);
|
|
11543
11973
|
const brand = collectBrandBlocks(next);
|
|
11544
11974
|
const lists = collectLinkListBlocks(next);
|
|
11545
11975
|
if (lists.length === 0) {
|
|
@@ -11624,7 +12054,7 @@ function ensureFooterTree(tree, opts) {
|
|
|
11624
12054
|
return tree ?? buildDefaultFooterTree(opts);
|
|
11625
12055
|
}
|
|
11626
12056
|
function appendFooterSocial(tree, entry) {
|
|
11627
|
-
const next =
|
|
12057
|
+
const next = cloneTree2(tree);
|
|
11628
12058
|
const platform = entry.platform.trim().toLowerCase();
|
|
11629
12059
|
const href = entry.href.trim();
|
|
11630
12060
|
for (const col2 of next.columns) {
|
|
@@ -11653,7 +12083,7 @@ function appendFooterSocial(tree, entry) {
|
|
|
11653
12083
|
return next;
|
|
11654
12084
|
}
|
|
11655
12085
|
function insertFooterHours(tree, hours, title = "Hours") {
|
|
11656
|
-
const next =
|
|
12086
|
+
const next = cloneTree2(tree);
|
|
11657
12087
|
const idx = pickFooterColumnIndex(next.columns.map((c) => c.blocks.length));
|
|
11658
12088
|
const col = next.columns[idx] ?? next.columns[0];
|
|
11659
12089
|
if (!col) return next;
|
|
@@ -11680,7 +12110,7 @@ function addFooterLinkColumn(tree, column) {
|
|
|
11680
12110
|
return next;
|
|
11681
12111
|
}
|
|
11682
12112
|
function removeFooterBlock(tree, predicate) {
|
|
11683
|
-
const next =
|
|
12113
|
+
const next = cloneTree2(tree);
|
|
11684
12114
|
for (let c = 0; c < next.columns.length; c++) {
|
|
11685
12115
|
const col = next.columns[c];
|
|
11686
12116
|
if (!col) continue;
|
|
@@ -11716,7 +12146,7 @@ function foldAiFooterSlotOverride(tree, key, value) {
|
|
|
11716
12146
|
const path = key.slice(prefix.length);
|
|
11717
12147
|
const brandMatch = path.match(/^brand\.b(\d+)\.(.+)$/);
|
|
11718
12148
|
if (!brandMatch) return null;
|
|
11719
|
-
const next =
|
|
12149
|
+
const next = cloneTree2(tree);
|
|
11720
12150
|
const brands = [];
|
|
11721
12151
|
for (const col of next.columns) {
|
|
11722
12152
|
for (const block2 of col.blocks) {
|
|
@@ -11761,7 +12191,8 @@ function textOf2(el) {
|
|
|
11761
12191
|
return (el?.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
11762
12192
|
}
|
|
11763
12193
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11764
|
-
const next =
|
|
12194
|
+
const next = cloneTree2(tree);
|
|
12195
|
+
syncSocialRowsFromDom(next);
|
|
11765
12196
|
const domCols = listFooterColumns().map((col) => {
|
|
11766
12197
|
const heading = getFooterColumnHeadingEl(col);
|
|
11767
12198
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -12242,7 +12673,7 @@ var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
|
12242
12673
|
var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
|
|
12243
12674
|
var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
|
|
12244
12675
|
var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
|
|
12245
|
-
var
|
|
12676
|
+
var HIDDEN_ATTR3 = "data-ohw-placeholder-hidden";
|
|
12246
12677
|
function hasPlaceholder(text) {
|
|
12247
12678
|
return HAS_PLACEHOLDER_RE.test(text);
|
|
12248
12679
|
}
|
|
@@ -12261,10 +12692,10 @@ function skipped(el) {
|
|
|
12261
12692
|
}
|
|
12262
12693
|
function hideIfEmptied(el) {
|
|
12263
12694
|
const control = el?.closest("a, button");
|
|
12264
|
-
if (!control || control.hasAttribute(
|
|
12695
|
+
if (!control || control.hasAttribute(HIDDEN_ATTR3)) return;
|
|
12265
12696
|
if ((control.textContent ?? "").trim()) return;
|
|
12266
12697
|
if (control.querySelector("img, svg, picture, video")) return;
|
|
12267
|
-
control.setAttribute(
|
|
12698
|
+
control.setAttribute(HIDDEN_ATTR3, "");
|
|
12268
12699
|
control.style.display = "none";
|
|
12269
12700
|
}
|
|
12270
12701
|
function stripElementAttrs(el) {
|
|
@@ -17413,10 +17844,10 @@ function ItemInteractionLayer({
|
|
|
17413
17844
|
}
|
|
17414
17845
|
|
|
17415
17846
|
// src/lib/forms.ts
|
|
17416
|
-
var
|
|
17847
|
+
var FORM_SELECTOR2 = '[data-ohw-editable="form"]';
|
|
17417
17848
|
function getFormElement(el) {
|
|
17418
17849
|
if (!el) return null;
|
|
17419
|
-
return el.closest(
|
|
17850
|
+
return el.closest(FORM_SELECTOR2);
|
|
17420
17851
|
}
|
|
17421
17852
|
function formKeyOf(form) {
|
|
17422
17853
|
return form.getAttribute("data-ohw-key");
|
|
@@ -17477,7 +17908,7 @@ function clearSubmitError(form) {
|
|
|
17477
17908
|
if (note) note.style.display = "none";
|
|
17478
17909
|
}
|
|
17479
17910
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17480
|
-
var
|
|
17911
|
+
var HIDDEN_ATTR4 = "data-ohw-form-hidden";
|
|
17481
17912
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17482
17913
|
function formSuccessKey(formKey) {
|
|
17483
17914
|
return `${formKey}-success`;
|
|
@@ -17503,13 +17934,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17503
17934
|
Array.from(form.children).forEach((child) => {
|
|
17504
17935
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17505
17936
|
if (state === "success") {
|
|
17506
|
-
if (!child.hasAttribute(
|
|
17507
|
-
child.setAttribute(
|
|
17937
|
+
if (!child.hasAttribute(HIDDEN_ATTR4)) {
|
|
17938
|
+
child.setAttribute(HIDDEN_ATTR4, child.style.display);
|
|
17508
17939
|
child.style.display = "none";
|
|
17509
17940
|
}
|
|
17510
|
-
} else if (child.hasAttribute(
|
|
17511
|
-
child.style.display = child.getAttribute(
|
|
17512
|
-
child.removeAttribute(
|
|
17941
|
+
} else if (child.hasAttribute(HIDDEN_ATTR4)) {
|
|
17942
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR4) ?? "";
|
|
17943
|
+
child.removeAttribute(HIDDEN_ATTR4);
|
|
17513
17944
|
}
|
|
17514
17945
|
});
|
|
17515
17946
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17528,7 +17959,7 @@ function bindPublishedForms(apiUrl, subdomain, content = {}) {
|
|
|
17528
17959
|
"submit",
|
|
17529
17960
|
async (e) => {
|
|
17530
17961
|
const target = e.target;
|
|
17531
|
-
const form = target?.closest(
|
|
17962
|
+
const form = target?.closest(FORM_SELECTOR2);
|
|
17532
17963
|
if (!form || !(form instanceof HTMLFormElement)) return;
|
|
17533
17964
|
const formKey = formKeyOf(form);
|
|
17534
17965
|
if (!formKey) return;
|
|
@@ -17574,7 +18005,7 @@ function apiBase() {
|
|
|
17574
18005
|
function bridgeVersion() {
|
|
17575
18006
|
try {
|
|
17576
18007
|
if (true) {
|
|
17577
|
-
return "0.1.
|
|
18008
|
+
return "0.1.172-next.456";
|
|
17578
18009
|
}
|
|
17579
18010
|
} catch {
|
|
17580
18011
|
}
|
|
@@ -17588,7 +18019,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17588
18019
|
return;
|
|
17589
18020
|
}
|
|
17590
18021
|
try {
|
|
17591
|
-
const v = true ? "0.1.
|
|
18022
|
+
const v = true ? "0.1.172-next.456" : "";
|
|
17592
18023
|
if (v) {
|
|
17593
18024
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17594
18025
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18159,7 +18590,7 @@ function FieldTypePicker({ onPick }) {
|
|
|
18159
18590
|
|
|
18160
18591
|
// src/ui/MediaOverlay.tsx
|
|
18161
18592
|
import * as React8 from "react";
|
|
18162
|
-
import { Film, ImageIcon, Pause, Play as Play2, Volume2, VolumeX } from "lucide-react";
|
|
18593
|
+
import { Film, ImageIcon, Pause, Play as Play2, Trash2 as Trash23, Volume2, VolumeX } from "lucide-react";
|
|
18163
18594
|
|
|
18164
18595
|
// src/ui/button.tsx
|
|
18165
18596
|
import * as React7 from "react";
|
|
@@ -18249,6 +18680,7 @@ function MediaOverlay({
|
|
|
18249
18680
|
onFadeOutComplete,
|
|
18250
18681
|
onReplace,
|
|
18251
18682
|
onSelect,
|
|
18683
|
+
onDelete,
|
|
18252
18684
|
onVideoSettingsChange
|
|
18253
18685
|
}) {
|
|
18254
18686
|
const { rect } = hover;
|
|
@@ -18268,6 +18700,7 @@ function MediaOverlay({
|
|
|
18268
18700
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18269
18701
|
);
|
|
18270
18702
|
}, [isVideo]);
|
|
18703
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18271
18704
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18272
18705
|
const box = {
|
|
18273
18706
|
position: "fixed",
|
|
@@ -18366,11 +18799,10 @@ function MediaOverlay({
|
|
|
18366
18799
|
className: "flex items-center justify-center cursor-pointer",
|
|
18367
18800
|
style: {
|
|
18368
18801
|
...box,
|
|
18369
|
-
//
|
|
18370
|
-
//
|
|
18371
|
-
//
|
|
18372
|
-
|
|
18373
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18802
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18803
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18804
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18805
|
+
pointerEvents: "none",
|
|
18374
18806
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18375
18807
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18376
18808
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18397,40 +18829,74 @@ function MediaOverlay({
|
|
|
18397
18829
|
},
|
|
18398
18830
|
children: [
|
|
18399
18831
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18400
|
-
|
|
18832
|
+
replaceLabel
|
|
18401
18833
|
]
|
|
18402
18834
|
}
|
|
18403
18835
|
),
|
|
18404
|
-
replaceMode
|
|
18405
|
-
|
|
18836
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18837
|
+
"div",
|
|
18406
18838
|
{
|
|
18407
|
-
"
|
|
18408
|
-
variant: "outline",
|
|
18409
|
-
size: "sm",
|
|
18410
|
-
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
18411
|
-
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18839
|
+
className: "flex items-center gap-1.5",
|
|
18412
18840
|
style: {
|
|
18413
|
-
|
|
18414
|
-
// Icon-only is a square of the same height, so the pair can never differ vertically.
|
|
18415
|
-
// `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
|
|
18416
|
-
// minimum beats a width — the square came out wider than the avatar it sat on.
|
|
18417
|
-
...replaceMode === "icon" && buttonSize ? {
|
|
18418
|
-
width: buttonSize.height,
|
|
18419
|
-
minWidth: buttonSize.height,
|
|
18420
|
-
padding: 0,
|
|
18421
|
-
justifyContent: "center"
|
|
18422
|
-
} : null,
|
|
18423
|
-
// Don't let Replace steal clicks when text (e.g. nav) sits on top of this media.
|
|
18841
|
+
// Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
|
|
18424
18842
|
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
|
|
18425
18843
|
},
|
|
18426
|
-
|
|
18427
|
-
onClick: (e) => {
|
|
18428
|
-
e.stopPropagation();
|
|
18429
|
-
onReplace(hover.key);
|
|
18430
|
-
},
|
|
18844
|
+
onClick: (e) => e.stopPropagation(),
|
|
18431
18845
|
children: [
|
|
18432
|
-
|
|
18433
|
-
|
|
18846
|
+
/* @__PURE__ */ jsxs8(
|
|
18847
|
+
Button,
|
|
18848
|
+
{
|
|
18849
|
+
"data-ohw-media-overlay": "",
|
|
18850
|
+
variant: "outline",
|
|
18851
|
+
size: "sm",
|
|
18852
|
+
"aria-label": replaceLabel,
|
|
18853
|
+
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18854
|
+
style: {
|
|
18855
|
+
...OVERLAY_BUTTON_STYLE,
|
|
18856
|
+
// Icon-only is a square of the same height, so the pair can never differ vertically.
|
|
18857
|
+
// `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
|
|
18858
|
+
// minimum beats a width — the square came out wider than the avatar it sat on.
|
|
18859
|
+
...replaceMode === "icon" && buttonSize ? {
|
|
18860
|
+
width: buttonSize.height,
|
|
18861
|
+
minWidth: buttonSize.height,
|
|
18862
|
+
padding: 0,
|
|
18863
|
+
justifyContent: "center"
|
|
18864
|
+
} : null
|
|
18865
|
+
},
|
|
18866
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
18867
|
+
onClick: (e) => {
|
|
18868
|
+
e.stopPropagation();
|
|
18869
|
+
onReplace(hover.key);
|
|
18870
|
+
},
|
|
18871
|
+
children: [
|
|
18872
|
+
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18873
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18874
|
+
]
|
|
18875
|
+
}
|
|
18876
|
+
),
|
|
18877
|
+
selected && onDelete ? /* @__PURE__ */ jsx17(
|
|
18878
|
+
Button,
|
|
18879
|
+
{
|
|
18880
|
+
"data-ohw-media-overlay": "",
|
|
18881
|
+
variant: "outline",
|
|
18882
|
+
size: "sm",
|
|
18883
|
+
"aria-label": "Delete",
|
|
18884
|
+
title: "Delete",
|
|
18885
|
+
className: "cursor-pointer hover:bg-background",
|
|
18886
|
+
style: {
|
|
18887
|
+
...OVERLAY_BUTTON_STYLE,
|
|
18888
|
+
minWidth: 0,
|
|
18889
|
+
padding: buttonSize ? `0 ${(buttonSize.height - 14) / 2}px` : "0 8px",
|
|
18890
|
+
height: buttonSize?.height
|
|
18891
|
+
},
|
|
18892
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
18893
|
+
onClick: (e) => {
|
|
18894
|
+
e.stopPropagation();
|
|
18895
|
+
onDelete(hover.key);
|
|
18896
|
+
},
|
|
18897
|
+
children: /* @__PURE__ */ jsx17(Trash23, { size: 14 })
|
|
18898
|
+
}
|
|
18899
|
+
) : null
|
|
18434
18900
|
]
|
|
18435
18901
|
}
|
|
18436
18902
|
)
|
|
@@ -19061,8 +19527,24 @@ function AiSectionOverlay({
|
|
|
19061
19527
|
}
|
|
19062
19528
|
|
|
19063
19529
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19064
|
-
import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
|
|
19065
|
-
import {
|
|
19530
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
19531
|
+
import {
|
|
19532
|
+
AlignCenter,
|
|
19533
|
+
AlignLeft,
|
|
19534
|
+
AlignRight,
|
|
19535
|
+
ArrowLeft as ArrowLeft2,
|
|
19536
|
+
ArrowRight as ArrowRight2,
|
|
19537
|
+
Check as Check2,
|
|
19538
|
+
ChevronDown as ChevronDown3,
|
|
19539
|
+
Image as ImageIcon2,
|
|
19540
|
+
ImageMinus,
|
|
19541
|
+
ImagePlus,
|
|
19542
|
+
Link as LinkIcon,
|
|
19543
|
+
Minus,
|
|
19544
|
+
Palette,
|
|
19545
|
+
Plus as Plus2,
|
|
19546
|
+
Star
|
|
19547
|
+
} from "lucide-react";
|
|
19066
19548
|
|
|
19067
19549
|
// src/lib/ai-media-strip-tree.ts
|
|
19068
19550
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19176,14 +19658,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19176
19658
|
return true;
|
|
19177
19659
|
});
|
|
19178
19660
|
}
|
|
19179
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19180
|
-
return withMediaStrip(tree, (block) => {
|
|
19181
|
-
const items = block.items;
|
|
19182
|
-
if (index < 0 || index >= items.length) return false;
|
|
19183
|
-
items[index] = { ...items[index], alt };
|
|
19184
|
-
return true;
|
|
19185
|
-
});
|
|
19186
|
-
}
|
|
19187
19661
|
function setMediaStripItemLink(tree, index, link) {
|
|
19188
19662
|
return withMediaStrip(tree, (block) => {
|
|
19189
19663
|
const items = block.items;
|
|
@@ -19201,11 +19675,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19201
19675
|
});
|
|
19202
19676
|
}
|
|
19203
19677
|
|
|
19678
|
+
// src/ui/dialog.tsx
|
|
19679
|
+
import * as React9 from "react";
|
|
19680
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19681
|
+
import { X as X2 } from "lucide-react";
|
|
19682
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19683
|
+
function Dialog2({
|
|
19684
|
+
...props
|
|
19685
|
+
}) {
|
|
19686
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19687
|
+
}
|
|
19688
|
+
function DialogPortal({
|
|
19689
|
+
...props
|
|
19690
|
+
}) {
|
|
19691
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19692
|
+
}
|
|
19693
|
+
function DialogOverlay({
|
|
19694
|
+
className,
|
|
19695
|
+
...props
|
|
19696
|
+
}) {
|
|
19697
|
+
return /* @__PURE__ */ jsx20(
|
|
19698
|
+
DialogPrimitive.Overlay,
|
|
19699
|
+
{
|
|
19700
|
+
"data-slot": "dialog-overlay",
|
|
19701
|
+
"data-ohw-link-modal-root": "",
|
|
19702
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19703
|
+
...props
|
|
19704
|
+
}
|
|
19705
|
+
);
|
|
19706
|
+
}
|
|
19707
|
+
var DialogContent = React9.forwardRef(
|
|
19708
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19709
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19710
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19711
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19712
|
+
/* @__PURE__ */ jsxs11(
|
|
19713
|
+
DialogPrimitive.Content,
|
|
19714
|
+
{
|
|
19715
|
+
ref,
|
|
19716
|
+
"data-slot": "dialog-content",
|
|
19717
|
+
className: cn(
|
|
19718
|
+
positionMode,
|
|
19719
|
+
"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",
|
|
19720
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19721
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19722
|
+
className
|
|
19723
|
+
),
|
|
19724
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19725
|
+
...props,
|
|
19726
|
+
children: [
|
|
19727
|
+
children,
|
|
19728
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19729
|
+
DialogPrimitive.Close,
|
|
19730
|
+
{
|
|
19731
|
+
type: "button",
|
|
19732
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19733
|
+
"aria-label": "Close",
|
|
19734
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19735
|
+
}
|
|
19736
|
+
) : null
|
|
19737
|
+
]
|
|
19738
|
+
}
|
|
19739
|
+
)
|
|
19740
|
+
] });
|
|
19741
|
+
}
|
|
19742
|
+
);
|
|
19743
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19744
|
+
function DialogHeader({
|
|
19745
|
+
className,
|
|
19746
|
+
...props
|
|
19747
|
+
}) {
|
|
19748
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19749
|
+
}
|
|
19750
|
+
function DialogFooter({
|
|
19751
|
+
className,
|
|
19752
|
+
...props
|
|
19753
|
+
}) {
|
|
19754
|
+
return /* @__PURE__ */ jsx20(
|
|
19755
|
+
"div",
|
|
19756
|
+
{
|
|
19757
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19758
|
+
...props
|
|
19759
|
+
}
|
|
19760
|
+
);
|
|
19761
|
+
}
|
|
19762
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19763
|
+
DialogPrimitive.Title,
|
|
19764
|
+
{
|
|
19765
|
+
ref,
|
|
19766
|
+
className: cn(
|
|
19767
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19768
|
+
className
|
|
19769
|
+
),
|
|
19770
|
+
...props
|
|
19771
|
+
}
|
|
19772
|
+
));
|
|
19773
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19774
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19775
|
+
DialogPrimitive.Description,
|
|
19776
|
+
{
|
|
19777
|
+
ref,
|
|
19778
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19779
|
+
...props
|
|
19780
|
+
}
|
|
19781
|
+
));
|
|
19782
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19783
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19784
|
+
|
|
19204
19785
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19205
|
-
import { Fragment as Fragment7, jsx as
|
|
19206
|
-
var PRIMARY3 = "#0885FE";
|
|
19207
|
-
var
|
|
19208
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19786
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19787
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19788
|
+
var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
|
|
19209
19789
|
function findMediaStripItemElement(sectionId, index) {
|
|
19210
19790
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19211
19791
|
if (!sectionEl2) return null;
|
|
@@ -19215,14 +19795,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19215
19795
|
}
|
|
19216
19796
|
return null;
|
|
19217
19797
|
}
|
|
19218
|
-
function
|
|
19219
|
-
|
|
19798
|
+
function itemRefFromTarget(target) {
|
|
19799
|
+
if (!(target instanceof Element)) return null;
|
|
19800
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19801
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19802
|
+
if (!itemEl) return null;
|
|
19803
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19804
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19805
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19806
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19807
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19808
|
+
return { sectionId, index };
|
|
19809
|
+
}
|
|
19810
|
+
function sameRef(a, b) {
|
|
19811
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19812
|
+
}
|
|
19813
|
+
function rectOf(el) {
|
|
19220
19814
|
if (!el) return null;
|
|
19221
19815
|
const r2 = el.getBoundingClientRect();
|
|
19222
19816
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19223
19817
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19224
19818
|
}
|
|
19225
|
-
function
|
|
19819
|
+
function readRect2(ref) {
|
|
19820
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19821
|
+
}
|
|
19822
|
+
function readStripRect(ref) {
|
|
19823
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19824
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19825
|
+
}
|
|
19826
|
+
function useLiveItemRect(ref, strip = false) {
|
|
19226
19827
|
const [rect, setRect] = useState8(null);
|
|
19227
19828
|
useEffect9(() => {
|
|
19228
19829
|
if (!ref) {
|
|
@@ -19230,7 +19831,7 @@ function useLiveItemRect(ref) {
|
|
|
19230
19831
|
return;
|
|
19231
19832
|
}
|
|
19232
19833
|
const update = () => {
|
|
19233
|
-
const next = readRect2(ref);
|
|
19834
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19234
19835
|
setRect(
|
|
19235
19836
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19236
19837
|
);
|
|
@@ -19245,9 +19846,49 @@ function useLiveItemRect(ref) {
|
|
|
19245
19846
|
window.removeEventListener("resize", update);
|
|
19246
19847
|
clearInterval(interval);
|
|
19247
19848
|
};
|
|
19248
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19849
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19249
19850
|
return rect;
|
|
19250
19851
|
}
|
|
19852
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19853
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19854
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19855
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19856
|
+
const slotRef = useRef5(null);
|
|
19857
|
+
const [shift, setShift] = useState8(0);
|
|
19858
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19859
|
+
useLayoutEffect4(() => {
|
|
19860
|
+
const slot = slotRef.current;
|
|
19861
|
+
if (!slot) return;
|
|
19862
|
+
const clamp = () => {
|
|
19863
|
+
const w = slot.offsetWidth;
|
|
19864
|
+
if (w <= 0) return;
|
|
19865
|
+
const half = w / 2;
|
|
19866
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19867
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19868
|
+
};
|
|
19869
|
+
clamp();
|
|
19870
|
+
const ro = new ResizeObserver(clamp);
|
|
19871
|
+
ro.observe(slot);
|
|
19872
|
+
return () => ro.disconnect();
|
|
19873
|
+
}, [centerX, children]);
|
|
19874
|
+
const mobile = window.innerWidth <= 480;
|
|
19875
|
+
return /* @__PURE__ */ jsx21(
|
|
19876
|
+
"div",
|
|
19877
|
+
{
|
|
19878
|
+
ref: slotRef,
|
|
19879
|
+
"data-ohw-bridge": "",
|
|
19880
|
+
"data-ohw-item-interaction": "",
|
|
19881
|
+
className: "pointer-events-auto fixed",
|
|
19882
|
+
style: {
|
|
19883
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19884
|
+
left: centerX + shift,
|
|
19885
|
+
transform: "translate(-50%, -100%)",
|
|
19886
|
+
zIndex: 2147483645
|
|
19887
|
+
},
|
|
19888
|
+
children
|
|
19889
|
+
}
|
|
19890
|
+
);
|
|
19891
|
+
}
|
|
19251
19892
|
function requestValidateTree(postToParent2, tree) {
|
|
19252
19893
|
return new Promise((resolve) => {
|
|
19253
19894
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19284,116 +19925,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19284
19925
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19285
19926
|
});
|
|
19286
19927
|
}
|
|
19287
|
-
function
|
|
19928
|
+
function ToolbarAction({
|
|
19288
19929
|
label,
|
|
19289
19930
|
onClick,
|
|
19290
|
-
disabled,
|
|
19291
|
-
active
|
|
19931
|
+
disabled = false,
|
|
19932
|
+
active = false,
|
|
19933
|
+
children
|
|
19292
19934
|
}) {
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
{
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
disabled,
|
|
19299
|
-
style: {
|
|
19300
|
-
height: 28,
|
|
19301
|
-
padding: "0 10px",
|
|
19302
|
-
display: "inline-flex",
|
|
19303
|
-
alignItems: "center",
|
|
19304
|
-
gap: 4,
|
|
19305
|
-
borderRadius: 999,
|
|
19306
|
-
border: "none",
|
|
19307
|
-
cursor: disabled ? "default" : "pointer",
|
|
19308
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19309
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19310
|
-
opacity: disabled ? 0.4 : 1,
|
|
19311
|
-
fontSize: 12,
|
|
19312
|
-
lineHeight: "16px",
|
|
19313
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19314
|
-
whiteSpace: "nowrap",
|
|
19315
|
-
flex: "0 0 auto"
|
|
19316
|
-
},
|
|
19317
|
-
children: label
|
|
19318
|
-
}
|
|
19319
|
-
);
|
|
19935
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19936
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19937
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19938
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19939
|
+
] });
|
|
19320
19940
|
}
|
|
19321
|
-
function
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
|
|
19347
|
-
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
},
|
|
19351
|
-
children: "Alt"
|
|
19352
|
-
}
|
|
19353
|
-
),
|
|
19354
|
-
/* @__PURE__ */ jsx20(
|
|
19355
|
-
"input",
|
|
19941
|
+
function ToolbarSeparator() {
|
|
19942
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19943
|
+
}
|
|
19944
|
+
function OptionMenu({
|
|
19945
|
+
label,
|
|
19946
|
+
value,
|
|
19947
|
+
options,
|
|
19948
|
+
onChange
|
|
19949
|
+
}) {
|
|
19950
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19951
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19952
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19953
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19954
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19955
|
+
"button",
|
|
19956
|
+
{
|
|
19957
|
+
type: "button",
|
|
19958
|
+
"aria-label": label,
|
|
19959
|
+
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",
|
|
19960
|
+
children: [
|
|
19961
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19962
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19963
|
+
]
|
|
19964
|
+
}
|
|
19965
|
+
) }),
|
|
19966
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19967
|
+
const selected = option.value === value;
|
|
19968
|
+
return /* @__PURE__ */ jsxs12(
|
|
19969
|
+
DropdownMenuItem,
|
|
19356
19970
|
{
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
"aria-label": "Image alt text",
|
|
19372
|
-
style: {
|
|
19373
|
-
flex: 1,
|
|
19374
|
-
minWidth: 0,
|
|
19375
|
-
border: "none",
|
|
19376
|
-
outline: "none",
|
|
19377
|
-
background: "transparent",
|
|
19378
|
-
fontSize: 12,
|
|
19379
|
-
lineHeight: "16px",
|
|
19380
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19381
|
-
color: "#1f2937"
|
|
19382
|
-
}
|
|
19383
|
-
}
|
|
19384
|
-
)
|
|
19385
|
-
]
|
|
19386
|
-
}
|
|
19387
|
-
);
|
|
19971
|
+
role: "menuitemradio",
|
|
19972
|
+
"aria-checked": selected,
|
|
19973
|
+
onSelect: () => onChange(option.value),
|
|
19974
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19975
|
+
children: [
|
|
19976
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19977
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19978
|
+
]
|
|
19979
|
+
},
|
|
19980
|
+
option.value
|
|
19981
|
+
);
|
|
19982
|
+
}) })
|
|
19983
|
+
] })
|
|
19984
|
+
] });
|
|
19388
19985
|
}
|
|
19389
19986
|
var VARIANTS = [
|
|
19390
19987
|
{ value: "logos", label: "Logos" },
|
|
19391
19988
|
{ value: "reel", label: "Reel" }
|
|
19392
19989
|
];
|
|
19393
19990
|
var ALIGNS = [
|
|
19394
|
-
{ value: "left", label: "
|
|
19395
|
-
{ value: "center", label: "
|
|
19396
|
-
{ value: "right", label: "
|
|
19991
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19992
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19993
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19397
19994
|
];
|
|
19398
19995
|
var HOVERS = [
|
|
19399
19996
|
{ value: "none", label: "None" },
|
|
@@ -19401,104 +19998,104 @@ var HOVERS = [
|
|
|
19401
19998
|
{ value: "zoom", label: "Zoom" },
|
|
19402
19999
|
{ value: "fade", label: "Fade" }
|
|
19403
20000
|
];
|
|
19404
|
-
var TREATMENTS = [
|
|
19405
|
-
{ value: "color", label: "Color" },
|
|
19406
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19407
|
-
];
|
|
19408
20001
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19409
|
-
function
|
|
19410
|
-
|
|
20002
|
+
function LinkModal({
|
|
20003
|
+
href,
|
|
20004
|
+
linkTarget,
|
|
20005
|
+
onClose,
|
|
20006
|
+
onSave
|
|
20007
|
+
}) {
|
|
20008
|
+
const [draft, setDraft] = useState8(href);
|
|
20009
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19411
20010
|
const [invalid, setInvalid] = useState8(false);
|
|
19412
|
-
|
|
19413
|
-
setDraft(value);
|
|
19414
|
-
setInvalid(false);
|
|
19415
|
-
}, [value]);
|
|
19416
|
-
const commit2 = () => {
|
|
20011
|
+
const save = () => {
|
|
19417
20012
|
const next = draft.trim();
|
|
19418
|
-
if (next
|
|
19419
|
-
|
|
19420
|
-
|
|
19421
|
-
onCommit(next);
|
|
19422
|
-
};
|
|
19423
|
-
return /* @__PURE__ */ jsxs11(
|
|
19424
|
-
"div",
|
|
19425
|
-
{
|
|
19426
|
-
style: {
|
|
19427
|
-
display: "flex",
|
|
19428
|
-
alignItems: "center",
|
|
19429
|
-
gap: 6,
|
|
19430
|
-
height: 28,
|
|
19431
|
-
padding: "0 12px",
|
|
19432
|
-
borderRadius: 999,
|
|
19433
|
-
background: "#ffffff",
|
|
19434
|
-
width: "100%",
|
|
19435
|
-
maxWidth: 260,
|
|
19436
|
-
boxSizing: "border-box",
|
|
19437
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19438
|
-
},
|
|
19439
|
-
children: [
|
|
19440
|
-
/* @__PURE__ */ jsx20(
|
|
19441
|
-
"span",
|
|
19442
|
-
{
|
|
19443
|
-
style: {
|
|
19444
|
-
flex: "0 0 auto",
|
|
19445
|
-
color: OHW_BLUE_DARK,
|
|
19446
|
-
fontSize: 10,
|
|
19447
|
-
fontWeight: 700,
|
|
19448
|
-
textTransform: "uppercase",
|
|
19449
|
-
letterSpacing: 0.4
|
|
19450
|
-
},
|
|
19451
|
-
children: "Link"
|
|
19452
|
-
}
|
|
19453
|
-
),
|
|
19454
|
-
/* @__PURE__ */ jsx20(
|
|
19455
|
-
"input",
|
|
19456
|
-
{
|
|
19457
|
-
type: "text",
|
|
19458
|
-
inputMode: "url",
|
|
19459
|
-
value: draft,
|
|
19460
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19461
|
-
onBlur: commit2,
|
|
19462
|
-
onKeyDown: (e) => {
|
|
19463
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19464
|
-
if (e.key === "Escape") {
|
|
19465
|
-
setDraft(value);
|
|
19466
|
-
setInvalid(false);
|
|
19467
|
-
e.currentTarget.blur();
|
|
19468
|
-
}
|
|
19469
|
-
},
|
|
19470
|
-
placeholder: "https://example.com",
|
|
19471
|
-
"aria-label": "Image link URL",
|
|
19472
|
-
"aria-invalid": invalid,
|
|
19473
|
-
style: {
|
|
19474
|
-
flex: 1,
|
|
19475
|
-
minWidth: 0,
|
|
19476
|
-
border: "none",
|
|
19477
|
-
outline: "none",
|
|
19478
|
-
background: "transparent",
|
|
19479
|
-
fontSize: 12,
|
|
19480
|
-
lineHeight: "16px",
|
|
19481
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19482
|
-
color: "#1f2937"
|
|
19483
|
-
}
|
|
19484
|
-
}
|
|
19485
|
-
)
|
|
19486
|
-
]
|
|
20013
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
20014
|
+
setInvalid(true);
|
|
20015
|
+
return;
|
|
19487
20016
|
}
|
|
19488
|
-
|
|
20017
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
20018
|
+
onClose();
|
|
20019
|
+
};
|
|
20020
|
+
return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
20021
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
20022
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
20023
|
+
/* @__PURE__ */ jsx21(
|
|
20024
|
+
"input",
|
|
20025
|
+
{
|
|
20026
|
+
autoFocus: true,
|
|
20027
|
+
type: "text",
|
|
20028
|
+
inputMode: "url",
|
|
20029
|
+
value: draft,
|
|
20030
|
+
onChange: (e) => {
|
|
20031
|
+
setDraft(e.target.value);
|
|
20032
|
+
setInvalid(false);
|
|
20033
|
+
},
|
|
20034
|
+
onKeyDown: (e) => {
|
|
20035
|
+
if (e.key === "Enter") save();
|
|
20036
|
+
},
|
|
20037
|
+
placeholder: "https://example.com",
|
|
20038
|
+
"aria-label": "Image link URL",
|
|
20039
|
+
"aria-invalid": invalid,
|
|
20040
|
+
className: cn(
|
|
20041
|
+
"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",
|
|
20042
|
+
invalid && "border-destructive focus:border-destructive"
|
|
20043
|
+
)
|
|
20044
|
+
}
|
|
20045
|
+
),
|
|
20046
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
20047
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
20048
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
20049
|
+
"Open in new tab"
|
|
20050
|
+
] })
|
|
20051
|
+
] }),
|
|
20052
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
20053
|
+
href && /* @__PURE__ */ jsx21(
|
|
20054
|
+
"button",
|
|
20055
|
+
{
|
|
20056
|
+
type: "button",
|
|
20057
|
+
onClick: () => {
|
|
20058
|
+
onSave("", "new-tab");
|
|
20059
|
+
onClose();
|
|
20060
|
+
},
|
|
20061
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
20062
|
+
children: "Remove link"
|
|
20063
|
+
}
|
|
20064
|
+
),
|
|
20065
|
+
/* @__PURE__ */ jsx21(
|
|
20066
|
+
"button",
|
|
20067
|
+
{
|
|
20068
|
+
type: "button",
|
|
20069
|
+
onClick: onClose,
|
|
20070
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
20071
|
+
children: "Cancel"
|
|
20072
|
+
}
|
|
20073
|
+
),
|
|
20074
|
+
/* @__PURE__ */ jsx21(
|
|
20075
|
+
"button",
|
|
20076
|
+
{
|
|
20077
|
+
type: "button",
|
|
20078
|
+
onClick: save,
|
|
20079
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
20080
|
+
children: "Save"
|
|
20081
|
+
}
|
|
20082
|
+
)
|
|
20083
|
+
] })
|
|
20084
|
+
] }) });
|
|
19489
20085
|
}
|
|
19490
20086
|
function MediaStripToolbar({
|
|
19491
20087
|
entry,
|
|
19492
20088
|
index,
|
|
19493
20089
|
pending,
|
|
19494
20090
|
error,
|
|
20091
|
+
itemEditOn,
|
|
20092
|
+
onToggleItemEdit,
|
|
19495
20093
|
onSetVariant,
|
|
19496
20094
|
onSetAlign,
|
|
19497
20095
|
onSetHover,
|
|
19498
20096
|
onSetTreatment,
|
|
19499
20097
|
onResize,
|
|
19500
|
-
|
|
19501
|
-
onSetLink,
|
|
20098
|
+
onOpenLink,
|
|
19502
20099
|
onAddItem,
|
|
19503
20100
|
onRemoveItem,
|
|
19504
20101
|
onChangeImage,
|
|
@@ -19507,81 +20104,102 @@ function MediaStripToolbar({
|
|
|
19507
20104
|
}) {
|
|
19508
20105
|
const items = mediaStripItems(entry.tree);
|
|
19509
20106
|
const itemCount = items.length;
|
|
19510
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19511
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19512
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19513
20107
|
const slots = findMediaStripSlots(entry.tree);
|
|
19514
20108
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19515
20109
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19516
20110
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19517
20111
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19518
20112
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19519
|
-
const
|
|
19520
|
-
const
|
|
19521
|
-
|
|
19522
|
-
gap: 6,
|
|
19523
|
-
flexWrap: "nowrap",
|
|
19524
|
-
justifyContent: "center",
|
|
19525
|
-
overflowX: "auto",
|
|
19526
|
-
WebkitOverflowScrolling: "touch",
|
|
19527
|
-
width: "100%",
|
|
19528
|
-
scrollbarWidth: "none"
|
|
19529
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19530
|
-
return /* @__PURE__ */ jsxs11(
|
|
20113
|
+
const mobile = window.innerWidth <= 480;
|
|
20114
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
20115
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19531
20116
|
"div",
|
|
19532
20117
|
{
|
|
19533
20118
|
"data-ohw-bridge": "",
|
|
19534
20119
|
"data-ohw-toolbar": "",
|
|
19535
20120
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
flexDirection: "column",
|
|
19539
|
-
gap: 6,
|
|
19540
|
-
alignItems: "center",
|
|
19541
|
-
background: OHW_BLUE,
|
|
19542
|
-
padding: 8,
|
|
19543
|
-
borderRadius: 12,
|
|
19544
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19545
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19546
|
-
opacity: pending ? 0.6 : 1,
|
|
19547
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19548
|
-
},
|
|
20121
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
20122
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19549
20123
|
children: [
|
|
19550
|
-
/* @__PURE__ */
|
|
19551
|
-
|
|
19552
|
-
|
|
19553
|
-
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
20124
|
+
/* @__PURE__ */ jsxs12(
|
|
20125
|
+
"div",
|
|
20126
|
+
{
|
|
20127
|
+
className: cn(
|
|
20128
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
20129
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
20130
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20131
|
+
),
|
|
20132
|
+
children: [
|
|
20133
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
20134
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
20135
|
+
CustomToolbarButton,
|
|
20136
|
+
{
|
|
20137
|
+
type: "button",
|
|
20138
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
20139
|
+
"aria-pressed": itemEditOn,
|
|
20140
|
+
onClick: onToggleItemEdit,
|
|
20141
|
+
className: "group size-8",
|
|
20142
|
+
children: /* @__PURE__ */ jsx21(
|
|
20143
|
+
Star,
|
|
20144
|
+
{
|
|
20145
|
+
size: 16,
|
|
20146
|
+
fill: "currentColor",
|
|
20147
|
+
strokeWidth: 0,
|
|
20148
|
+
className: cn(
|
|
20149
|
+
"transition-colors",
|
|
20150
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
20151
|
+
),
|
|
20152
|
+
style: { pointerEvents: "none" }
|
|
20153
|
+
}
|
|
20154
|
+
)
|
|
20155
|
+
}
|
|
20156
|
+
) }),
|
|
20157
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
20158
|
+
] }),
|
|
20159
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
20160
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20161
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20162
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20163
|
+
/* @__PURE__ */ jsx21(
|
|
20164
|
+
ToolbarAction,
|
|
20165
|
+
{
|
|
20166
|
+
label: gatedLabel("Move right"),
|
|
20167
|
+
onClick: onMoveRight,
|
|
20168
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
20169
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
20170
|
+
}
|
|
20171
|
+
),
|
|
20172
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20173
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
20174
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
20175
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
20176
|
+
/* @__PURE__ */ jsx21(
|
|
20177
|
+
ToolbarAction,
|
|
20178
|
+
{
|
|
20179
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
20180
|
+
active: treatment === "grayscale",
|
|
20181
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
20182
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
20183
|
+
}
|
|
20184
|
+
),
|
|
20185
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
20186
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
20187
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
20188
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20189
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
20190
|
+
sizeValue,
|
|
20191
|
+
"px"
|
|
20192
|
+
] }),
|
|
20193
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20194
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
20195
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20196
|
+
]
|
|
20197
|
+
}
|
|
20198
|
+
),
|
|
20199
|
+
error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19582
20200
|
]
|
|
19583
20201
|
}
|
|
19584
|
-
);
|
|
20202
|
+
) });
|
|
19585
20203
|
}
|
|
19586
20204
|
function findMediaStripSlots(tree) {
|
|
19587
20205
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19600,31 +20218,23 @@ function AiMediaStripOverlay({
|
|
|
19600
20218
|
}) {
|
|
19601
20219
|
const [hover, setHover] = useState8(null);
|
|
19602
20220
|
const [active, setActive] = useState8(null);
|
|
20221
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
20222
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19603
20223
|
const [pending, setPending] = useState8(false);
|
|
19604
20224
|
const [error, setError] = useState8(null);
|
|
19605
20225
|
const activeRef = useRef5(null);
|
|
19606
20226
|
activeRef.current = active;
|
|
20227
|
+
const linkOpenRef = useRef5(false);
|
|
20228
|
+
linkOpenRef.current = linkOpen;
|
|
19607
20229
|
useEffect9(() => {
|
|
19608
20230
|
const onMove = (e) => {
|
|
20231
|
+
const ref = itemRefFromTarget(e.target);
|
|
19609
20232
|
const t = e.target;
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
if (!itemEl) {
|
|
19616
|
-
setHover(null);
|
|
19617
|
-
return;
|
|
19618
|
-
}
|
|
19619
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19620
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19621
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19622
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19623
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19624
|
-
setHover(null);
|
|
19625
|
-
return;
|
|
19626
|
-
}
|
|
19627
|
-
setHover({ sectionId, index });
|
|
20233
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
20234
|
+
setHover((prev) => {
|
|
20235
|
+
const next = ref && !overEditable ? ref : null;
|
|
20236
|
+
return sameRef(prev, next) ? prev : next;
|
|
20237
|
+
});
|
|
19628
20238
|
};
|
|
19629
20239
|
const onLeave = () => setHover(null);
|
|
19630
20240
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19636,23 +20246,25 @@ function AiMediaStripOverlay({
|
|
|
19636
20246
|
}, []);
|
|
19637
20247
|
useEffect9(() => {
|
|
19638
20248
|
const onClick = (e) => {
|
|
19639
|
-
const current = activeRef.current;
|
|
19640
|
-
if (!current) return;
|
|
19641
20249
|
const t = e.target;
|
|
19642
|
-
if (!(t instanceof
|
|
19643
|
-
if (t.closest(
|
|
19644
|
-
const
|
|
19645
|
-
if (
|
|
19646
|
-
|
|
20250
|
+
if (!(t instanceof Element)) return;
|
|
20251
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
20252
|
+
const ref = itemRefFromTarget(t);
|
|
20253
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
20254
|
+
if (ref) clearInteractionChromeRef.current();
|
|
20255
|
+
setItemEditOn(false);
|
|
19647
20256
|
setError(null);
|
|
20257
|
+
setActive(ref);
|
|
19648
20258
|
};
|
|
19649
20259
|
document.addEventListener("click", onClick, true);
|
|
19650
20260
|
return () => document.removeEventListener("click", onClick, true);
|
|
19651
|
-
}, []);
|
|
20261
|
+
}, [clearInteractionChromeRef]);
|
|
19652
20262
|
useEffect9(() => {
|
|
19653
20263
|
const onBlur = () => {
|
|
19654
20264
|
if (!activeRef.current) return;
|
|
19655
20265
|
setActive(null);
|
|
20266
|
+
setItemEditOn(false);
|
|
20267
|
+
setLinkOpen(false);
|
|
19656
20268
|
setError(null);
|
|
19657
20269
|
};
|
|
19658
20270
|
window.addEventListener("blur", onBlur);
|
|
@@ -19662,7 +20274,10 @@ function AiMediaStripOverlay({
|
|
|
19662
20274
|
const onKeyDown = (e) => {
|
|
19663
20275
|
if (e.key !== "Escape") return;
|
|
19664
20276
|
if (!activeRef.current) return;
|
|
20277
|
+
if (linkOpenRef.current) return;
|
|
20278
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19665
20279
|
setActive(null);
|
|
20280
|
+
setItemEditOn(false);
|
|
19666
20281
|
setError(null);
|
|
19667
20282
|
};
|
|
19668
20283
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19696,137 +20311,133 @@ function AiMediaStripOverlay({
|
|
|
19696
20311
|
tree: nextTree,
|
|
19697
20312
|
label: entry.label,
|
|
19698
20313
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19699
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20314
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
20315
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20316
|
+
// on every edit reads as the section jumping around.
|
|
20317
|
+
skipScrollIntoView: true
|
|
19700
20318
|
});
|
|
19701
20319
|
return true;
|
|
19702
20320
|
},
|
|
19703
20321
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19704
20322
|
);
|
|
19705
20323
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19706
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19707
20324
|
const activeItemRect = useLiveItemRect(active);
|
|
19708
|
-
const
|
|
19709
|
-
const
|
|
19710
|
-
|
|
19711
|
-
|
|
19712
|
-
|
|
19713
|
-
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
|
|
19721
|
-
|
|
19722
|
-
|
|
19723
|
-
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
|
|
19737
|
-
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19743
|
-
ItemInteractionLayer,
|
|
19744
|
-
{
|
|
19745
|
-
rect: activeItemRect,
|
|
19746
|
-
state: toolbarState,
|
|
19747
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19748
|
-
MediaStripToolbar,
|
|
19749
|
-
{
|
|
19750
|
-
entry: activeEntry,
|
|
19751
|
-
index: active.index,
|
|
19752
|
-
pending,
|
|
19753
|
-
error,
|
|
19754
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19755
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19756
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19757
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19758
|
-
onResize: (delta) => {
|
|
19759
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19760
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19761
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19762
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19763
|
-
},
|
|
19764
|
-
onSetAlt: (alt) => {
|
|
19765
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19766
|
-
},
|
|
19767
|
-
onSetLink: (href, linkTarget) => {
|
|
20325
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
20326
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20327
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
20328
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
20329
|
+
const activeHref = activeItem?.href ?? "";
|
|
20330
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
20331
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
20332
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20333
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
20334
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
20335
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
20336
|
+
MediaStripToolbar,
|
|
20337
|
+
{
|
|
20338
|
+
entry: activeEntry,
|
|
20339
|
+
index: active.index,
|
|
20340
|
+
pending,
|
|
20341
|
+
error,
|
|
20342
|
+
itemEditOn,
|
|
20343
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
20344
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
20345
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
20346
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
20347
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
20348
|
+
onResize: (delta) => {
|
|
20349
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
20350
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
20351
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
20352
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
20353
|
+
},
|
|
20354
|
+
onOpenLink: () => setLinkOpen(true),
|
|
20355
|
+
onAddItem: () => {
|
|
20356
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20357
|
+
if (!picked) return;
|
|
20358
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19768
20359
|
void runMutation(
|
|
19769
20360
|
active.sectionId,
|
|
19770
|
-
(tree) =>
|
|
19771
|
-
|
|
19772
|
-
|
|
19773
|
-
|
|
19774
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19775
|
-
if (!picked) return;
|
|
19776
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19777
|
-
void runMutation(
|
|
19778
|
-
active.sectionId,
|
|
19779
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19780
|
-
{ [picked.assetId]: picked.url }
|
|
19781
|
-
).then((applied) => {
|
|
19782
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19783
|
-
});
|
|
20361
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
20362
|
+
{ [picked.assetId]: picked.url }
|
|
20363
|
+
).then((applied) => {
|
|
20364
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19784
20365
|
});
|
|
19785
|
-
}
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19792
|
-
|
|
19793
|
-
|
|
19794
|
-
});
|
|
19795
|
-
},
|
|
19796
|
-
onRemoveItem: () => {
|
|
19797
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19798
|
-
(applied) => {
|
|
19799
|
-
if (applied) setActive(null);
|
|
19800
|
-
}
|
|
19801
|
-
);
|
|
19802
|
-
},
|
|
19803
|
-
onMoveLeft: () => {
|
|
19804
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19805
|
-
(applied) => {
|
|
19806
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19807
|
-
}
|
|
19808
|
-
);
|
|
19809
|
-
},
|
|
19810
|
-
onMoveRight: () => {
|
|
19811
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19812
|
-
(applied) => {
|
|
19813
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19814
|
-
}
|
|
20366
|
+
});
|
|
20367
|
+
},
|
|
20368
|
+
onChangeImage: () => {
|
|
20369
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
20370
|
+
if (!picked) return;
|
|
20371
|
+
void runMutation(
|
|
20372
|
+
active.sectionId,
|
|
20373
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
20374
|
+
{ [picked.assetId]: picked.url }
|
|
19815
20375
|
);
|
|
19816
|
-
}
|
|
20376
|
+
});
|
|
20377
|
+
},
|
|
20378
|
+
onRemoveItem: () => {
|
|
20379
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
20380
|
+
(applied) => {
|
|
20381
|
+
if (applied) setActive(null);
|
|
20382
|
+
}
|
|
20383
|
+
);
|
|
20384
|
+
},
|
|
20385
|
+
onMoveLeft: () => {
|
|
20386
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
20387
|
+
(applied) => {
|
|
20388
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
20389
|
+
}
|
|
20390
|
+
);
|
|
20391
|
+
},
|
|
20392
|
+
onMoveRight: () => {
|
|
20393
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20394
|
+
(applied) => {
|
|
20395
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20396
|
+
}
|
|
20397
|
+
);
|
|
19817
20398
|
}
|
|
19818
|
-
|
|
19819
|
-
}
|
|
19820
|
-
|
|
20399
|
+
}
|
|
20400
|
+
) }),
|
|
20401
|
+
/* @__PURE__ */ jsx21(
|
|
20402
|
+
"div",
|
|
20403
|
+
{
|
|
20404
|
+
"data-ohw-bridge": "",
|
|
20405
|
+
"data-ohw-item-interaction": "",
|
|
20406
|
+
"aria-hidden": true,
|
|
20407
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20408
|
+
style: {
|
|
20409
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20410
|
+
left: activeItemRect.left - 5,
|
|
20411
|
+
background: PRIMARY3,
|
|
20412
|
+
zIndex: 2147483644
|
|
20413
|
+
},
|
|
20414
|
+
children: "Media item"
|
|
20415
|
+
}
|
|
20416
|
+
),
|
|
20417
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
20418
|
+
LinkModal,
|
|
20419
|
+
{
|
|
20420
|
+
href: activeHref,
|
|
20421
|
+
linkTarget: activeTarget,
|
|
20422
|
+
onClose: () => setLinkOpen(false),
|
|
20423
|
+
onSave: (href, linkTarget) => {
|
|
20424
|
+
void runMutation(
|
|
20425
|
+
active.sectionId,
|
|
20426
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20427
|
+
);
|
|
20428
|
+
}
|
|
20429
|
+
}
|
|
20430
|
+
)
|
|
20431
|
+
] })
|
|
19821
20432
|
] });
|
|
19822
20433
|
}
|
|
19823
20434
|
|
|
19824
20435
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19825
|
-
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as
|
|
19826
|
-
import { Check as
|
|
19827
|
-
import { Fragment as Fragment8, jsx as
|
|
20436
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
20437
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
20438
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19828
20439
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19829
|
-
var
|
|
20440
|
+
var CHROME_SELECTOR2 = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
|
|
19830
20441
|
function findPricingCardElement(sectionId, index) {
|
|
19831
20442
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19832
20443
|
if (!sectionEl2) return null;
|
|
@@ -19838,7 +20449,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19838
20449
|
}
|
|
19839
20450
|
function cardRefFromTarget(target) {
|
|
19840
20451
|
if (!(target instanceof Element)) return null;
|
|
19841
|
-
if (target.closest(
|
|
20452
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19842
20453
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19843
20454
|
if (!cardEl) return null;
|
|
19844
20455
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -19848,21 +20459,21 @@ function cardRefFromTarget(target) {
|
|
|
19848
20459
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19849
20460
|
return { sectionId, index };
|
|
19850
20461
|
}
|
|
19851
|
-
function
|
|
20462
|
+
function sameRef2(a, b) {
|
|
19852
20463
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19853
20464
|
}
|
|
19854
|
-
function
|
|
20465
|
+
function rectOf2(el) {
|
|
19855
20466
|
if (!el) return null;
|
|
19856
20467
|
const r2 = el.getBoundingClientRect();
|
|
19857
20468
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19858
20469
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19859
20470
|
}
|
|
19860
20471
|
function readRect3(ref) {
|
|
19861
|
-
return
|
|
20472
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19862
20473
|
}
|
|
19863
20474
|
function readGridRect(ref) {
|
|
19864
20475
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19865
|
-
return
|
|
20476
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19866
20477
|
}
|
|
19867
20478
|
function useLiveCardRect(ref, grid = false) {
|
|
19868
20479
|
const [rect, setRect] = useState9(null);
|
|
@@ -19892,19 +20503,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19892
20503
|
}
|
|
19893
20504
|
var TOOLBAR_GRID_GAP = 52;
|
|
19894
20505
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19895
|
-
var
|
|
20506
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19896
20507
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19897
20508
|
const slotRef = useRef6(null);
|
|
19898
20509
|
const [shift, setShift] = useState9(0);
|
|
19899
20510
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19900
|
-
|
|
20511
|
+
useLayoutEffect5(() => {
|
|
19901
20512
|
const slot = slotRef.current;
|
|
19902
20513
|
if (!slot) return;
|
|
19903
20514
|
const clamp = () => {
|
|
19904
20515
|
const w = slot.offsetWidth;
|
|
19905
20516
|
if (w <= 0) return;
|
|
19906
20517
|
const half = w / 2;
|
|
19907
|
-
const clamped = Math.max(
|
|
20518
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19908
20519
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19909
20520
|
};
|
|
19910
20521
|
clamp();
|
|
@@ -19913,7 +20524,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19913
20524
|
return () => ro.disconnect();
|
|
19914
20525
|
}, [centerX, children]);
|
|
19915
20526
|
const mobile = window.innerWidth <= 480;
|
|
19916
|
-
return /* @__PURE__ */
|
|
20527
|
+
return /* @__PURE__ */ jsx22(
|
|
19917
20528
|
"div",
|
|
19918
20529
|
{
|
|
19919
20530
|
ref: slotRef,
|
|
@@ -19948,7 +20559,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19948
20559
|
});
|
|
19949
20560
|
}
|
|
19950
20561
|
function StyleSwatch({ style }) {
|
|
19951
|
-
return /* @__PURE__ */
|
|
20562
|
+
return /* @__PURE__ */ jsx22(
|
|
19952
20563
|
"span",
|
|
19953
20564
|
{
|
|
19954
20565
|
"aria-hidden": true,
|
|
@@ -19962,35 +20573,35 @@ function StyleSwatch({ style }) {
|
|
|
19962
20573
|
);
|
|
19963
20574
|
}
|
|
19964
20575
|
function ButtonGlyph() {
|
|
19965
|
-
return /* @__PURE__ */
|
|
19966
|
-
/* @__PURE__ */
|
|
19967
|
-
/* @__PURE__ */
|
|
20576
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20577
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20578
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19968
20579
|
] });
|
|
19969
20580
|
}
|
|
19970
20581
|
function FeatureGlyph({ mode }) {
|
|
19971
|
-
return /* @__PURE__ */
|
|
19972
|
-
/* @__PURE__ */
|
|
19973
|
-
/* @__PURE__ */
|
|
19974
|
-
/* @__PURE__ */
|
|
19975
|
-
/* @__PURE__ */
|
|
19976
|
-
/* @__PURE__ */
|
|
19977
|
-
mode === "add" && /* @__PURE__ */
|
|
20582
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20583
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20584
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20585
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20586
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20587
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20588
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19978
20589
|
] });
|
|
19979
20590
|
}
|
|
19980
|
-
function
|
|
20591
|
+
function ToolbarAction2({
|
|
19981
20592
|
label,
|
|
19982
20593
|
onClick,
|
|
19983
20594
|
disabled = false,
|
|
19984
20595
|
children
|
|
19985
20596
|
}) {
|
|
19986
|
-
const button = /* @__PURE__ */
|
|
19987
|
-
return /* @__PURE__ */
|
|
19988
|
-
/* @__PURE__ */
|
|
19989
|
-
/* @__PURE__ */
|
|
20597
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20598
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20599
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20600
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19990
20601
|
] });
|
|
19991
20602
|
}
|
|
19992
|
-
function
|
|
19993
|
-
return /* @__PURE__ */
|
|
20603
|
+
function ToolbarSeparator2() {
|
|
20604
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19994
20605
|
}
|
|
19995
20606
|
function CardStyleMenu({
|
|
19996
20607
|
value,
|
|
@@ -19998,7 +20609,7 @@ function CardStyleMenu({
|
|
|
19998
20609
|
disabled = false
|
|
19999
20610
|
}) {
|
|
20000
20611
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
20001
|
-
const trigger = /* @__PURE__ */
|
|
20612
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
20002
20613
|
"button",
|
|
20003
20614
|
{
|
|
20004
20615
|
type: "button",
|
|
@@ -20009,28 +20620,28 @@ function CardStyleMenu({
|
|
|
20009
20620
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20010
20621
|
),
|
|
20011
20622
|
children: [
|
|
20012
|
-
/* @__PURE__ */
|
|
20013
|
-
/* @__PURE__ */
|
|
20014
|
-
/* @__PURE__ */
|
|
20623
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20624
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20625
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
20015
20626
|
]
|
|
20016
20627
|
}
|
|
20017
20628
|
);
|
|
20018
20629
|
if (disabled) {
|
|
20019
|
-
return /* @__PURE__ */
|
|
20020
|
-
/* @__PURE__ */
|
|
20021
|
-
/* @__PURE__ */
|
|
20022
|
-
/* @__PURE__ */
|
|
20023
|
-
/* @__PURE__ */
|
|
20630
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20631
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20632
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20633
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20634
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20024
20635
|
] })
|
|
20025
20636
|
] });
|
|
20026
20637
|
}
|
|
20027
|
-
return /* @__PURE__ */
|
|
20028
|
-
/* @__PURE__ */
|
|
20029
|
-
/* @__PURE__ */
|
|
20030
|
-
/* @__PURE__ */
|
|
20031
|
-
/* @__PURE__ */
|
|
20638
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20639
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20640
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20641
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20642
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
20032
20643
|
const selected = style.value === value;
|
|
20033
|
-
return /* @__PURE__ */
|
|
20644
|
+
return /* @__PURE__ */ jsxs13(
|
|
20034
20645
|
DropdownMenuItem,
|
|
20035
20646
|
{
|
|
20036
20647
|
role: "menuitemradio",
|
|
@@ -20038,9 +20649,9 @@ function CardStyleMenu({
|
|
|
20038
20649
|
onSelect: () => onChange(style.value),
|
|
20039
20650
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20040
20651
|
children: [
|
|
20041
|
-
/* @__PURE__ */
|
|
20042
|
-
/* @__PURE__ */
|
|
20043
|
-
selected && /* @__PURE__ */
|
|
20652
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20653
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20654
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
20044
20655
|
]
|
|
20045
20656
|
},
|
|
20046
20657
|
style.value
|
|
@@ -20070,7 +20681,7 @@ function PricingCardToolbar({
|
|
|
20070
20681
|
const style = pricingCardStyle(entry.tree, index);
|
|
20071
20682
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20072
20683
|
const mobile = window.innerWidth <= 480;
|
|
20073
|
-
return /* @__PURE__ */
|
|
20684
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
20074
20685
|
"div",
|
|
20075
20686
|
{
|
|
20076
20687
|
"data-ohw-bridge": "",
|
|
@@ -20082,7 +20693,7 @@ function PricingCardToolbar({
|
|
|
20082
20693
|
),
|
|
20083
20694
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20084
20695
|
children: [
|
|
20085
|
-
/* @__PURE__ */
|
|
20696
|
+
/* @__PURE__ */ jsxs13(
|
|
20086
20697
|
"div",
|
|
20087
20698
|
{
|
|
20088
20699
|
className: cn(
|
|
@@ -20091,8 +20702,8 @@ function PricingCardToolbar({
|
|
|
20091
20702
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20092
20703
|
),
|
|
20093
20704
|
children: [
|
|
20094
|
-
/* @__PURE__ */
|
|
20095
|
-
/* @__PURE__ */
|
|
20705
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20706
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
20096
20707
|
CustomToolbarButton,
|
|
20097
20708
|
{
|
|
20098
20709
|
type: "button",
|
|
@@ -20100,7 +20711,7 @@ function PricingCardToolbar({
|
|
|
20100
20711
|
"aria-pressed": featuredTag,
|
|
20101
20712
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20102
20713
|
className: "group size-8",
|
|
20103
|
-
children: /* @__PURE__ */
|
|
20714
|
+
children: /* @__PURE__ */ jsx22(
|
|
20104
20715
|
Star2,
|
|
20105
20716
|
{
|
|
20106
20717
|
size: 16,
|
|
@@ -20115,25 +20726,25 @@ function PricingCardToolbar({
|
|
|
20115
20726
|
)
|
|
20116
20727
|
}
|
|
20117
20728
|
) }),
|
|
20118
|
-
/* @__PURE__ */
|
|
20729
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20119
20730
|
] }),
|
|
20120
|
-
/* @__PURE__ */
|
|
20121
|
-
/* @__PURE__ */
|
|
20122
|
-
/* @__PURE__ */
|
|
20123
|
-
/* @__PURE__ */
|
|
20124
|
-
/* @__PURE__ */
|
|
20125
|
-
/* @__PURE__ */
|
|
20126
|
-
/* @__PURE__ */
|
|
20731
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20732
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20733
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20734
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20735
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20736
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20737
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
20127
20738
|
] }) }),
|
|
20128
|
-
/* @__PURE__ */
|
|
20129
|
-
/* @__PURE__ */
|
|
20130
|
-
/* @__PURE__ */
|
|
20131
|
-
/* @__PURE__ */
|
|
20132
|
-
/* @__PURE__ */
|
|
20739
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20740
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20741
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20742
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20743
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20133
20744
|
]
|
|
20134
20745
|
}
|
|
20135
20746
|
),
|
|
20136
|
-
error && /* @__PURE__ */
|
|
20747
|
+
error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
20137
20748
|
]
|
|
20138
20749
|
}
|
|
20139
20750
|
) });
|
|
@@ -20167,7 +20778,7 @@ function AiPricingCardOverlay({
|
|
|
20167
20778
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20168
20779
|
setHover((prev) => {
|
|
20169
20780
|
const next = ref && !overEditable ? ref : null;
|
|
20170
|
-
return
|
|
20781
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20171
20782
|
});
|
|
20172
20783
|
};
|
|
20173
20784
|
const onLeave = () => setHover(null);
|
|
@@ -20182,10 +20793,10 @@ function AiPricingCardOverlay({
|
|
|
20182
20793
|
const onClick = (e) => {
|
|
20183
20794
|
const t = e.target;
|
|
20184
20795
|
if (!(t instanceof Element)) return;
|
|
20185
|
-
if (t.closest(
|
|
20796
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20186
20797
|
const ref = cardRefFromTarget(t);
|
|
20187
|
-
setActive((prev) =>
|
|
20188
|
-
if (!ref || !
|
|
20798
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20799
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20189
20800
|
};
|
|
20190
20801
|
document.addEventListener("click", onClick, true);
|
|
20191
20802
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20250,12 +20861,12 @@ function AiPricingCardOverlay({
|
|
|
20250
20861
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20251
20862
|
const activeCardRect = useLiveCardRect(active);
|
|
20252
20863
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20253
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20254
|
-
return /* @__PURE__ */
|
|
20255
|
-
hoverRect && /* @__PURE__ */
|
|
20256
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
20257
|
-
/* @__PURE__ */
|
|
20258
|
-
/* @__PURE__ */
|
|
20864
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20865
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20866
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20867
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20868
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20869
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
20259
20870
|
PricingCardToolbar,
|
|
20260
20871
|
{
|
|
20261
20872
|
entry: activeEntry,
|
|
@@ -20283,7 +20894,7 @@ function AiPricingCardOverlay({
|
|
|
20283
20894
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20284
20895
|
}
|
|
20285
20896
|
) }),
|
|
20286
|
-
/* @__PURE__ */
|
|
20897
|
+
/* @__PURE__ */ jsx22(
|
|
20287
20898
|
"div",
|
|
20288
20899
|
{
|
|
20289
20900
|
"data-ohw-bridge": "",
|
|
@@ -20347,39 +20958,11 @@ function clearVideo(tree, path) {
|
|
|
20347
20958
|
});
|
|
20348
20959
|
}
|
|
20349
20960
|
|
|
20350
|
-
// src/lib/youtube.ts
|
|
20351
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20352
|
-
function extractYouTubeId(input) {
|
|
20353
|
-
const trimmed = input.trim();
|
|
20354
|
-
if (!trimmed) return null;
|
|
20355
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20356
|
-
let url;
|
|
20357
|
-
try {
|
|
20358
|
-
url = new URL(trimmed);
|
|
20359
|
-
} catch {
|
|
20360
|
-
return null;
|
|
20361
|
-
}
|
|
20362
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20363
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20364
|
-
return null;
|
|
20365
|
-
}
|
|
20366
|
-
let candidate = null;
|
|
20367
|
-
if (host === "youtu.be") {
|
|
20368
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20369
|
-
} else if (url.pathname === "/watch") {
|
|
20370
|
-
candidate = url.searchParams.get("v");
|
|
20371
|
-
} else {
|
|
20372
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20373
|
-
candidate = match ? match[1] : null;
|
|
20374
|
-
}
|
|
20375
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20376
|
-
}
|
|
20377
|
-
|
|
20378
20961
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20379
|
-
import { Fragment as Fragment9, jsx as
|
|
20962
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20380
20963
|
var PRIMARY5 = "#0885FE";
|
|
20381
|
-
var
|
|
20382
|
-
var
|
|
20964
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20965
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20383
20966
|
function findVideoBlockElement(sectionId, path) {
|
|
20384
20967
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20385
20968
|
if (!sectionEl2) return null;
|
|
@@ -20439,12 +21022,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20439
21022
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20440
21023
|
});
|
|
20441
21024
|
}
|
|
20442
|
-
function
|
|
21025
|
+
function Pill({
|
|
20443
21026
|
label,
|
|
20444
21027
|
onClick,
|
|
20445
21028
|
disabled
|
|
20446
21029
|
}) {
|
|
20447
|
-
return /* @__PURE__ */
|
|
21030
|
+
return /* @__PURE__ */ jsx23(
|
|
20448
21031
|
"button",
|
|
20449
21032
|
{
|
|
20450
21033
|
type: "button",
|
|
@@ -20460,7 +21043,7 @@ function Pill2({
|
|
|
20460
21043
|
border: "none",
|
|
20461
21044
|
cursor: disabled ? "default" : "pointer",
|
|
20462
21045
|
background: "#ffffff",
|
|
20463
|
-
color:
|
|
21046
|
+
color: OHW_BLUE_DARK,
|
|
20464
21047
|
opacity: disabled ? 0.4 : 1,
|
|
20465
21048
|
fontSize: 12,
|
|
20466
21049
|
lineHeight: "16px",
|
|
@@ -20503,8 +21086,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20503
21086
|
onCommit(id);
|
|
20504
21087
|
}
|
|
20505
21088
|
};
|
|
20506
|
-
return /* @__PURE__ */
|
|
20507
|
-
/* @__PURE__ */
|
|
21089
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
21090
|
+
/* @__PURE__ */ jsxs14(
|
|
20508
21091
|
"div",
|
|
20509
21092
|
{
|
|
20510
21093
|
style: {
|
|
@@ -20520,12 +21103,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20520
21103
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20521
21104
|
},
|
|
20522
21105
|
children: [
|
|
20523
|
-
/* @__PURE__ */
|
|
21106
|
+
/* @__PURE__ */ jsx23(
|
|
20524
21107
|
"span",
|
|
20525
21108
|
{
|
|
20526
21109
|
style: {
|
|
20527
21110
|
flex: "0 0 auto",
|
|
20528
|
-
color:
|
|
21111
|
+
color: OHW_BLUE_DARK,
|
|
20529
21112
|
fontSize: 10,
|
|
20530
21113
|
lineHeight: "16px",
|
|
20531
21114
|
fontWeight: 700,
|
|
@@ -20535,7 +21118,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20535
21118
|
children: "Video"
|
|
20536
21119
|
}
|
|
20537
21120
|
),
|
|
20538
|
-
/* @__PURE__ */
|
|
21121
|
+
/* @__PURE__ */ jsx23(
|
|
20539
21122
|
"input",
|
|
20540
21123
|
{
|
|
20541
21124
|
type: "text",
|
|
@@ -20572,7 +21155,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20572
21155
|
]
|
|
20573
21156
|
}
|
|
20574
21157
|
),
|
|
20575
|
-
invalid && /* @__PURE__ */
|
|
21158
|
+
invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20576
21159
|
] });
|
|
20577
21160
|
}
|
|
20578
21161
|
function VideoToolbar({
|
|
@@ -20582,7 +21165,7 @@ function VideoToolbar({
|
|
|
20582
21165
|
onSetVideoId,
|
|
20583
21166
|
onRemove
|
|
20584
21167
|
}) {
|
|
20585
|
-
return /* @__PURE__ */
|
|
21168
|
+
return /* @__PURE__ */ jsxs14(
|
|
20586
21169
|
"div",
|
|
20587
21170
|
{
|
|
20588
21171
|
"data-ohw-bridge": "",
|
|
@@ -20594,7 +21177,7 @@ function VideoToolbar({
|
|
|
20594
21177
|
gap: 6,
|
|
20595
21178
|
alignItems: "center",
|
|
20596
21179
|
width: 280,
|
|
20597
|
-
background:
|
|
21180
|
+
background: OHW_BLUE,
|
|
20598
21181
|
padding: 8,
|
|
20599
21182
|
borderRadius: 12,
|
|
20600
21183
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20602,9 +21185,9 @@ function VideoToolbar({
|
|
|
20602
21185
|
opacity: pending ? 0.6 : 1
|
|
20603
21186
|
},
|
|
20604
21187
|
children: [
|
|
20605
|
-
/* @__PURE__ */
|
|
20606
|
-
/* @__PURE__ */
|
|
20607
|
-
error && /* @__PURE__ */
|
|
21188
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
21189
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
21190
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20608
21191
|
]
|
|
20609
21192
|
}
|
|
20610
21193
|
);
|
|
@@ -20724,8 +21307,8 @@ function AiVideoOverlay({
|
|
|
20724
21307
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20725
21308
|
const TOOLBAR_APPROX_H = 90;
|
|
20726
21309
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20727
|
-
return /* @__PURE__ */
|
|
20728
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21310
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
21311
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20729
21312
|
"button",
|
|
20730
21313
|
{
|
|
20731
21314
|
type: "button",
|
|
@@ -20753,15 +21336,15 @@ function AiVideoOverlay({
|
|
|
20753
21336
|
fontSize: 14,
|
|
20754
21337
|
fontWeight: 700
|
|
20755
21338
|
},
|
|
20756
|
-
children: /* @__PURE__ */
|
|
21339
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20757
21340
|
}
|
|
20758
21341
|
),
|
|
20759
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
21342
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20760
21343
|
ItemInteractionLayer,
|
|
20761
21344
|
{
|
|
20762
21345
|
rect: activeBlockRect,
|
|
20763
21346
|
state: toolbarState,
|
|
20764
|
-
toolbar: /* @__PURE__ */
|
|
21347
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20765
21348
|
VideoToolbar,
|
|
20766
21349
|
{
|
|
20767
21350
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20836,10 +21419,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20836
21419
|
}
|
|
20837
21420
|
|
|
20838
21421
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20839
|
-
import { Fragment as Fragment10, jsx as
|
|
21422
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20840
21423
|
var PRIMARY6 = "#0885FE";
|
|
20841
|
-
var
|
|
20842
|
-
var
|
|
21424
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21425
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20843
21426
|
function findCarouselItemElement(sectionId, index) {
|
|
20844
21427
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20845
21428
|
if (!sectionEl2) return null;
|
|
@@ -20918,8 +21501,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20918
21501
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20919
21502
|
});
|
|
20920
21503
|
}
|
|
20921
|
-
function
|
|
20922
|
-
return /* @__PURE__ */
|
|
21504
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21505
|
+
return /* @__PURE__ */ jsx24(
|
|
20923
21506
|
"button",
|
|
20924
21507
|
{
|
|
20925
21508
|
type: "button",
|
|
@@ -20935,7 +21518,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20935
21518
|
border: "none",
|
|
20936
21519
|
cursor: disabled ? "default" : "pointer",
|
|
20937
21520
|
background: "#ffffff",
|
|
20938
|
-
color:
|
|
21521
|
+
color: OHW_BLUE_DARK2,
|
|
20939
21522
|
opacity: disabled ? 0.4 : 1,
|
|
20940
21523
|
fontSize: 12,
|
|
20941
21524
|
lineHeight: "16px",
|
|
@@ -20953,7 +21536,7 @@ function TogglePill({
|
|
|
20953
21536
|
onToggle,
|
|
20954
21537
|
disabled
|
|
20955
21538
|
}) {
|
|
20956
|
-
return /* @__PURE__ */
|
|
21539
|
+
return /* @__PURE__ */ jsxs15(
|
|
20957
21540
|
"button",
|
|
20958
21541
|
{
|
|
20959
21542
|
type: "button",
|
|
@@ -20972,7 +21555,7 @@ function TogglePill({
|
|
|
20972
21555
|
border: "none",
|
|
20973
21556
|
cursor: disabled ? "default" : "pointer",
|
|
20974
21557
|
background: "#ffffff",
|
|
20975
|
-
color:
|
|
21558
|
+
color: OHW_BLUE_DARK2,
|
|
20976
21559
|
opacity: disabled ? 0.4 : 1,
|
|
20977
21560
|
fontSize: 12,
|
|
20978
21561
|
lineHeight: "16px",
|
|
@@ -20982,7 +21565,7 @@ function TogglePill({
|
|
|
20982
21565
|
},
|
|
20983
21566
|
children: [
|
|
20984
21567
|
label,
|
|
20985
|
-
/* @__PURE__ */
|
|
21568
|
+
/* @__PURE__ */ jsx24(
|
|
20986
21569
|
"span",
|
|
20987
21570
|
{
|
|
20988
21571
|
"aria-hidden": true,
|
|
@@ -20995,10 +21578,10 @@ function TogglePill({
|
|
|
20995
21578
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20996
21579
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20997
21580
|
// "disabled control" rather than "switch that is off".
|
|
20998
|
-
background: on ?
|
|
21581
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20999
21582
|
transition: "background 120ms ease"
|
|
21000
21583
|
},
|
|
21001
|
-
children: /* @__PURE__ */
|
|
21584
|
+
children: /* @__PURE__ */ jsx24(
|
|
21002
21585
|
"span",
|
|
21003
21586
|
{
|
|
21004
21587
|
style: {
|
|
@@ -21027,7 +21610,7 @@ function CarouselSlideToolbar({
|
|
|
21027
21610
|
onChangeImage,
|
|
21028
21611
|
onToggleAutoplay
|
|
21029
21612
|
}) {
|
|
21030
|
-
return /* @__PURE__ */
|
|
21613
|
+
return /* @__PURE__ */ jsxs15(
|
|
21031
21614
|
"div",
|
|
21032
21615
|
{
|
|
21033
21616
|
"data-ohw-bridge": "",
|
|
@@ -21038,7 +21621,7 @@ function CarouselSlideToolbar({
|
|
|
21038
21621
|
flexDirection: "column",
|
|
21039
21622
|
gap: 6,
|
|
21040
21623
|
alignItems: "center",
|
|
21041
|
-
background:
|
|
21624
|
+
background: OHW_BLUE2,
|
|
21042
21625
|
padding: 8,
|
|
21043
21626
|
borderRadius: 12,
|
|
21044
21627
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21050,11 +21633,11 @@ function CarouselSlideToolbar({
|
|
|
21050
21633
|
pointerEvents: pending ? "none" : "auto"
|
|
21051
21634
|
},
|
|
21052
21635
|
children: [
|
|
21053
|
-
/* @__PURE__ */
|
|
21054
|
-
/* @__PURE__ */
|
|
21055
|
-
/* @__PURE__ */
|
|
21636
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21637
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21638
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21056
21639
|
] }),
|
|
21057
|
-
error && /* @__PURE__ */
|
|
21640
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21058
21641
|
]
|
|
21059
21642
|
}
|
|
21060
21643
|
);
|
|
@@ -21194,8 +21777,8 @@ function AiFadeCarouselOverlay({
|
|
|
21194
21777
|
const activeItemRect = useLiveItemRect2(active);
|
|
21195
21778
|
const TOOLBAR_APPROX_H = 90;
|
|
21196
21779
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21197
|
-
return /* @__PURE__ */
|
|
21198
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21780
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21781
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
21199
21782
|
"button",
|
|
21200
21783
|
{
|
|
21201
21784
|
type: "button",
|
|
@@ -21224,10 +21807,10 @@ function AiFadeCarouselOverlay({
|
|
|
21224
21807
|
fontSize: 14,
|
|
21225
21808
|
fontWeight: 700
|
|
21226
21809
|
},
|
|
21227
|
-
children: /* @__PURE__ */
|
|
21810
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
21228
21811
|
}
|
|
21229
21812
|
),
|
|
21230
|
-
swapping && /* @__PURE__ */
|
|
21813
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
21231
21814
|
"div",
|
|
21232
21815
|
{
|
|
21233
21816
|
ref: skeletonRef,
|
|
@@ -21245,15 +21828,15 @@ function AiFadeCarouselOverlay({
|
|
|
21245
21828
|
zIndex: 2147483646,
|
|
21246
21829
|
pointerEvents: "none"
|
|
21247
21830
|
},
|
|
21248
|
-
children: /* @__PURE__ */
|
|
21831
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
21249
21832
|
}
|
|
21250
21833
|
),
|
|
21251
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21834
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
21252
21835
|
ItemInteractionLayer,
|
|
21253
21836
|
{
|
|
21254
21837
|
rect: activeItemRect,
|
|
21255
21838
|
state: toolbarState,
|
|
21256
|
-
toolbar: /* @__PURE__ */
|
|
21839
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
21257
21840
|
CarouselSlideToolbar,
|
|
21258
21841
|
{
|
|
21259
21842
|
pending,
|
|
@@ -21444,118 +22027,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21444
22027
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21445
22028
|
import { useEffect as useEffect16 } from "react";
|
|
21446
22029
|
|
|
21447
|
-
// src/ui/dialog.tsx
|
|
21448
|
-
import * as React9 from "react";
|
|
21449
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21450
|
-
import { X as X2 } from "lucide-react";
|
|
21451
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21452
|
-
function Dialog2({
|
|
21453
|
-
...props
|
|
21454
|
-
}) {
|
|
21455
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21456
|
-
}
|
|
21457
|
-
function DialogPortal({
|
|
21458
|
-
...props
|
|
21459
|
-
}) {
|
|
21460
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21461
|
-
}
|
|
21462
|
-
function DialogOverlay({
|
|
21463
|
-
className,
|
|
21464
|
-
...props
|
|
21465
|
-
}) {
|
|
21466
|
-
return /* @__PURE__ */ jsx24(
|
|
21467
|
-
DialogPrimitive.Overlay,
|
|
21468
|
-
{
|
|
21469
|
-
"data-slot": "dialog-overlay",
|
|
21470
|
-
"data-ohw-link-modal-root": "",
|
|
21471
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21472
|
-
...props
|
|
21473
|
-
}
|
|
21474
|
-
);
|
|
21475
|
-
}
|
|
21476
|
-
var DialogContent = React9.forwardRef(
|
|
21477
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21478
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21479
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21480
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21481
|
-
/* @__PURE__ */ jsxs15(
|
|
21482
|
-
DialogPrimitive.Content,
|
|
21483
|
-
{
|
|
21484
|
-
ref,
|
|
21485
|
-
"data-slot": "dialog-content",
|
|
21486
|
-
className: cn(
|
|
21487
|
-
positionMode,
|
|
21488
|
-
"left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
|
|
21489
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21490
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21491
|
-
className
|
|
21492
|
-
),
|
|
21493
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21494
|
-
...props,
|
|
21495
|
-
children: [
|
|
21496
|
-
children,
|
|
21497
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21498
|
-
DialogPrimitive.Close,
|
|
21499
|
-
{
|
|
21500
|
-
type: "button",
|
|
21501
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21502
|
-
"aria-label": "Close",
|
|
21503
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21504
|
-
}
|
|
21505
|
-
) : null
|
|
21506
|
-
]
|
|
21507
|
-
}
|
|
21508
|
-
)
|
|
21509
|
-
] });
|
|
21510
|
-
}
|
|
21511
|
-
);
|
|
21512
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21513
|
-
function DialogHeader({
|
|
21514
|
-
className,
|
|
21515
|
-
...props
|
|
21516
|
-
}) {
|
|
21517
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21518
|
-
}
|
|
21519
|
-
function DialogFooter({
|
|
21520
|
-
className,
|
|
21521
|
-
...props
|
|
21522
|
-
}) {
|
|
21523
|
-
return /* @__PURE__ */ jsx24(
|
|
21524
|
-
"div",
|
|
21525
|
-
{
|
|
21526
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21527
|
-
...props
|
|
21528
|
-
}
|
|
21529
|
-
);
|
|
21530
|
-
}
|
|
21531
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21532
|
-
DialogPrimitive.Title,
|
|
21533
|
-
{
|
|
21534
|
-
ref,
|
|
21535
|
-
className: cn(
|
|
21536
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21537
|
-
className
|
|
21538
|
-
),
|
|
21539
|
-
...props
|
|
21540
|
-
}
|
|
21541
|
-
));
|
|
21542
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21543
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21544
|
-
DialogPrimitive.Description,
|
|
21545
|
-
{
|
|
21546
|
-
ref,
|
|
21547
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21548
|
-
...props
|
|
21549
|
-
}
|
|
21550
|
-
));
|
|
21551
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21552
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21553
|
-
|
|
21554
22030
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21555
22031
|
import { Info, X as X4 } from "lucide-react";
|
|
21556
22032
|
|
|
21557
22033
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21558
|
-
import { ArrowRight as
|
|
22034
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21559
22035
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21560
22036
|
function DestinationBreadcrumb({
|
|
21561
22037
|
pageTitle,
|
|
@@ -21569,7 +22045,7 @@ function DestinationBreadcrumb({
|
|
|
21569
22045
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21570
22046
|
] }),
|
|
21571
22047
|
/* @__PURE__ */ jsx25(
|
|
21572
|
-
|
|
22048
|
+
ArrowRight3,
|
|
21573
22049
|
{
|
|
21574
22050
|
size: 16,
|
|
21575
22051
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21681,7 +22157,7 @@ function Label({ className, ...props }) {
|
|
|
21681
22157
|
}
|
|
21682
22158
|
|
|
21683
22159
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21684
|
-
import { ChevronDown as
|
|
22160
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21685
22161
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21686
22162
|
function FieldChevron({
|
|
21687
22163
|
onClick
|
|
@@ -21694,7 +22170,7 @@ function FieldChevron({
|
|
|
21694
22170
|
onClick,
|
|
21695
22171
|
"aria-label": "Open page list",
|
|
21696
22172
|
tabIndex: -1,
|
|
21697
|
-
children: /* @__PURE__ */ jsx29(
|
|
22173
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21698
22174
|
}
|
|
21699
22175
|
);
|
|
21700
22176
|
}
|
|
@@ -21924,7 +22400,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21924
22400
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21925
22401
|
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21926
22402
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21927
|
-
import { ArrowLeft as
|
|
22403
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21928
22404
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21929
22405
|
|
|
21930
22406
|
// src/lib/parent-scroll.ts
|
|
@@ -22201,7 +22677,7 @@ function SectionPickerOverlay({
|
|
|
22201
22677
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
22202
22678
|
onClick: onBack,
|
|
22203
22679
|
children: [
|
|
22204
|
-
/* @__PURE__ */ jsx31(
|
|
22680
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
22205
22681
|
"Back"
|
|
22206
22682
|
]
|
|
22207
22683
|
}
|
|
@@ -22270,7 +22746,7 @@ function SectionPickerOverlay({
|
|
|
22270
22746
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22271
22747
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22272
22748
|
"aria-hidden": true,
|
|
22273
|
-
children: /* @__PURE__ */ jsx31(
|
|
22749
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22274
22750
|
}
|
|
22275
22751
|
) : null
|
|
22276
22752
|
]
|
|
@@ -22654,6 +23130,7 @@ function shouldUseDevFixtures() {
|
|
|
22654
23130
|
function getLogoElement(el) {
|
|
22655
23131
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22656
23132
|
if (marked) return marked;
|
|
23133
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22657
23134
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22658
23135
|
if (!root) return null;
|
|
22659
23136
|
const anchor = el.closest("a");
|
|
@@ -22723,7 +23200,7 @@ function addFooterColumnWithPersist({
|
|
|
22723
23200
|
import {
|
|
22724
23201
|
useCallback as useCallback9,
|
|
22725
23202
|
useEffect as useEffect17,
|
|
22726
|
-
useLayoutEffect as
|
|
23203
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22727
23204
|
useRef as useRef11,
|
|
22728
23205
|
useState as useState15
|
|
22729
23206
|
} from "react";
|
|
@@ -22820,7 +23297,7 @@ function FloatingPanel({
|
|
|
22820
23297
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22821
23298
|
}, [open]);
|
|
22822
23299
|
const positionRef = useRef11(position);
|
|
22823
|
-
|
|
23300
|
+
useLayoutEffect6(() => {
|
|
22824
23301
|
if (!open) {
|
|
22825
23302
|
positionRef.current = position;
|
|
22826
23303
|
return;
|
|
@@ -22830,7 +23307,7 @@ function FloatingPanel({
|
|
|
22830
23307
|
}
|
|
22831
23308
|
positionRef.current = position;
|
|
22832
23309
|
}, [open, position, liveScroll, parentScroll]);
|
|
22833
|
-
|
|
23310
|
+
useLayoutEffect6(() => {
|
|
22834
23311
|
if (!open || !panelRef.current) return;
|
|
22835
23312
|
const el = panelRef.current;
|
|
22836
23313
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -23039,7 +23516,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
23039
23516
|
}
|
|
23040
23517
|
|
|
23041
23518
|
// src/ui/button-style-panel.tsx
|
|
23042
|
-
import { Check as
|
|
23519
|
+
import { Check as Check5 } from "lucide-react";
|
|
23043
23520
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
23044
23521
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
23045
23522
|
function ButtonStylePanel({
|
|
@@ -23110,7 +23587,7 @@ function ButtonStylePanel({
|
|
|
23110
23587
|
{
|
|
23111
23588
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
23112
23589
|
"aria-hidden": true,
|
|
23113
|
-
children: /* @__PURE__ */ jsx35(
|
|
23590
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
23114
23591
|
}
|
|
23115
23592
|
) : null
|
|
23116
23593
|
]
|
|
@@ -24142,7 +24619,7 @@ function useSectionDrag({
|
|
|
24142
24619
|
}
|
|
24143
24620
|
|
|
24144
24621
|
// src/ui/footer-container-chrome.tsx
|
|
24145
|
-
import { Plus as
|
|
24622
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
24146
24623
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
24147
24624
|
function FooterContainerChrome({
|
|
24148
24625
|
rect,
|
|
@@ -24183,7 +24660,7 @@ function FooterContainerChrome({
|
|
|
24183
24660
|
if (addDisabled) return;
|
|
24184
24661
|
onAdd();
|
|
24185
24662
|
},
|
|
24186
|
-
children: /* @__PURE__ */ jsx36(
|
|
24663
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24187
24664
|
}
|
|
24188
24665
|
) }),
|
|
24189
24666
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24590,7 +25067,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24590
25067
|
}
|
|
24591
25068
|
|
|
24592
25069
|
// src/ui/navbar-container-chrome.tsx
|
|
24593
|
-
import { Plus as
|
|
25070
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24594
25071
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24595
25072
|
function NavbarContainerChrome({
|
|
24596
25073
|
rect,
|
|
@@ -24626,7 +25103,7 @@ function NavbarContainerChrome({
|
|
|
24626
25103
|
e.stopPropagation();
|
|
24627
25104
|
onAdd();
|
|
24628
25105
|
},
|
|
24629
|
-
children: /* @__PURE__ */ jsx37(
|
|
25106
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24630
25107
|
}
|
|
24631
25108
|
)
|
|
24632
25109
|
}
|
|
@@ -24698,7 +25175,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24698
25175
|
}
|
|
24699
25176
|
|
|
24700
25177
|
// src/OhhwellsBridge.tsx
|
|
24701
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
25178
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings, Trash2 as Trash24 } from "lucide-react";
|
|
24702
25179
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24703
25180
|
var PRIMARY7 = "#0885FE";
|
|
24704
25181
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25476,7 +25953,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25476
25953
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25477
25954
|
return resolveFooterLinksContainerFrom(el);
|
|
25478
25955
|
}
|
|
25479
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25956
|
+
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)) {
|
|
25480
25957
|
return getNavigationRoot(el);
|
|
25481
25958
|
}
|
|
25482
25959
|
return null;
|
|
@@ -25698,7 +26175,6 @@ var ICONS = {
|
|
|
25698
26175
|
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"/>',
|
|
25699
26176
|
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"/>'
|
|
25700
26177
|
};
|
|
25701
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25702
26178
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25703
26179
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25704
26180
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25796,7 +26272,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25796
26272
|
el.style.top = `${top}px`;
|
|
25797
26273
|
el.style.height = `${height}px`;
|
|
25798
26274
|
}
|
|
25799
|
-
var
|
|
26275
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25800
26276
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25801
26277
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25802
26278
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25823,8 +26299,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25823
26299
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25824
26300
|
const half = toolbarWidth / 2;
|
|
25825
26301
|
return Math.max(
|
|
25826
|
-
|
|
25827
|
-
Math.min(centerX, window.innerWidth -
|
|
26302
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26303
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25828
26304
|
);
|
|
25829
26305
|
}
|
|
25830
26306
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25946,7 +26422,10 @@ function FloatingToolbar({
|
|
|
25946
26422
|
onCommand,
|
|
25947
26423
|
activeCommands,
|
|
25948
26424
|
showEditLink,
|
|
25949
|
-
onEditLink
|
|
26425
|
+
onEditLink,
|
|
26426
|
+
showDelete,
|
|
26427
|
+
onDelete,
|
|
26428
|
+
deleteDisabled
|
|
25950
26429
|
}) {
|
|
25951
26430
|
const localRef = React12.useRef(null);
|
|
25952
26431
|
const [measuredW, setMeasuredW] = React12.useState(330);
|
|
@@ -25973,7 +26452,7 @@ function FloatingToolbar({
|
|
|
25973
26452
|
const ro = new ResizeObserver(update);
|
|
25974
26453
|
ro.observe(node);
|
|
25975
26454
|
return () => ro.disconnect();
|
|
25976
|
-
}, [showEditLink, activeCommands]);
|
|
26455
|
+
}, [showEditLink, showDelete, activeCommands]);
|
|
25977
26456
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
25978
26457
|
return /* @__PURE__ */ jsx40(
|
|
25979
26458
|
"div",
|
|
@@ -26038,7 +26517,28 @@ function FloatingToolbar({
|
|
|
26038
26517
|
},
|
|
26039
26518
|
children: /* @__PURE__ */ jsx40(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
26040
26519
|
}
|
|
26041
|
-
) : null
|
|
26520
|
+
) : null,
|
|
26521
|
+
showDelete ? /* @__PURE__ */ jsxs26(Fragment13, { children: [
|
|
26522
|
+
/* @__PURE__ */ jsx40(CustomToolbarDivider, {}),
|
|
26523
|
+
/* @__PURE__ */ jsx40(
|
|
26524
|
+
CustomToolbarButton,
|
|
26525
|
+
{
|
|
26526
|
+
type: "button",
|
|
26527
|
+
title: "Delete",
|
|
26528
|
+
disabled: deleteDisabled,
|
|
26529
|
+
onMouseDown: (e) => {
|
|
26530
|
+
e.preventDefault();
|
|
26531
|
+
e.stopPropagation();
|
|
26532
|
+
if (!deleteDisabled) onDelete?.();
|
|
26533
|
+
},
|
|
26534
|
+
onClick: (e) => {
|
|
26535
|
+
e.preventDefault();
|
|
26536
|
+
e.stopPropagation();
|
|
26537
|
+
},
|
|
26538
|
+
children: /* @__PURE__ */ jsx40(Trash24, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
26539
|
+
}
|
|
26540
|
+
)
|
|
26541
|
+
] }) : null
|
|
26042
26542
|
] })
|
|
26043
26543
|
}
|
|
26044
26544
|
);
|
|
@@ -26225,7 +26725,7 @@ function OhhwellsBridge() {
|
|
|
26225
26725
|
}, []);
|
|
26226
26726
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26227
26727
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
26228
|
-
|
|
26728
|
+
useLayoutEffect7(() => {
|
|
26229
26729
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26230
26730
|
if (next !== subdomain) setSubdomain(next);
|
|
26231
26731
|
if (next) return;
|
|
@@ -26652,6 +27152,8 @@ function OhhwellsBridge() {
|
|
|
26652
27152
|
const [activeCommands, setActiveCommands] = useState18(/* @__PURE__ */ new Set());
|
|
26653
27153
|
const [sectionGap, setSectionGap] = useState18(null);
|
|
26654
27154
|
const [toolbarShowEditLink, setToolbarShowEditLink] = useState18(false);
|
|
27155
|
+
const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = useState18(false);
|
|
27156
|
+
const deletingAiBlockRef = useRef14(false);
|
|
26655
27157
|
const hoveredNavContainerRef = useRef14(null);
|
|
26656
27158
|
const [hoveredNavContainerRect, setHoveredNavContainerRect] = useState18(null);
|
|
26657
27159
|
const hoveredItemElRef = useRef14(null);
|
|
@@ -26707,21 +27209,6 @@ function OhhwellsBridge() {
|
|
|
26707
27209
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26708
27210
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26709
27211
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26710
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26711
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26712
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26713
|
-
const floatingPanelRef = useRef14(null);
|
|
26714
|
-
floatingPanelRef.current = floatingPanel;
|
|
26715
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26716
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26717
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26718
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26719
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26720
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26721
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26722
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26723
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26724
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26725
27212
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26726
27213
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26727
27214
|
const footerDragRef = useRef14(null);
|
|
@@ -26748,6 +27235,21 @@ function OhhwellsBridge() {
|
|
|
26748
27235
|
const stylesRef = useRef14("");
|
|
26749
27236
|
const appliedDrawerRef = useRef14(null);
|
|
26750
27237
|
const pendingDeleteUndoRef = useRef14(null);
|
|
27238
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
27239
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
27240
|
+
const floatingPanelRef = useRef14(null);
|
|
27241
|
+
floatingPanelRef.current = floatingPanel;
|
|
27242
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
27243
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
27244
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
27245
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
27246
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
27247
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
27248
|
+
const buttonPointerDragRef = useRef14(null);
|
|
27249
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
27250
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
27251
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
27252
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26751
27253
|
const [sitePages, setSitePages] = useState18([]);
|
|
26752
27254
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26753
27255
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26757,7 +27259,18 @@ function OhhwellsBridge() {
|
|
|
26757
27259
|
const linkPopoverOpenRef = useRef14(false);
|
|
26758
27260
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26759
27261
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27262
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26760
27263
|
linkPopoverSessionRef.current = linkPopover;
|
|
27264
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
27265
|
+
useEffect21(() => {
|
|
27266
|
+
const syncViewport = () => {
|
|
27267
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
27268
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
27269
|
+
};
|
|
27270
|
+
syncViewport();
|
|
27271
|
+
window.addEventListener("resize", syncViewport);
|
|
27272
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
27273
|
+
}, []);
|
|
26761
27274
|
useEffect21(() => {
|
|
26762
27275
|
setSectionOrderPersistHandler((entries) => {
|
|
26763
27276
|
const currentPath = window.location.pathname;
|
|
@@ -27064,6 +27577,7 @@ function OhhwellsBridge() {
|
|
|
27064
27577
|
setMaxBadge(null);
|
|
27065
27578
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27066
27579
|
setToolbarShowEditLink(false);
|
|
27580
|
+
setToolbarShowAiBlockDelete(false);
|
|
27067
27581
|
postToParent2({ type: "ow:exit-edit" });
|
|
27068
27582
|
}, [postToParent2]);
|
|
27069
27583
|
const clearSelectedAttr = useCallback12(() => {
|
|
@@ -27234,6 +27748,7 @@ function OhhwellsBridge() {
|
|
|
27234
27748
|
setMaxBadge(null);
|
|
27235
27749
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27236
27750
|
setToolbarShowEditLink(false);
|
|
27751
|
+
setToolbarShowAiBlockDelete(false);
|
|
27237
27752
|
postToParent2({ type: "ow:exit-edit" });
|
|
27238
27753
|
reselectNavigationItem(navAnchor);
|
|
27239
27754
|
}, [postToParent2, reselectNavigationItem]);
|
|
@@ -28404,6 +28919,13 @@ function OhhwellsBridge() {
|
|
|
28404
28919
|
}
|
|
28405
28920
|
}
|
|
28406
28921
|
setToolbarShowEditLink(Boolean(getHrefKeyFromElement(el)));
|
|
28922
|
+
setToolbarShowAiBlockDelete(
|
|
28923
|
+
canRemoveAiBlock(aiSectionsRef.current, el.dataset.ohwKey ?? null) || canSoftHideEditable(el, {
|
|
28924
|
+
isNavFooterItem: Boolean(
|
|
28925
|
+
getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
|
|
28926
|
+
)
|
|
28927
|
+
})
|
|
28928
|
+
);
|
|
28407
28929
|
const navAnchor = getNavigationItemAnchor(el);
|
|
28408
28930
|
if (navAnchor) {
|
|
28409
28931
|
if (isNestedNavChild(navAnchor)) {
|
|
@@ -28464,7 +28986,7 @@ function OhhwellsBridge() {
|
|
|
28464
28986
|
isFooterFrameSelection,
|
|
28465
28987
|
postToParent2
|
|
28466
28988
|
]);
|
|
28467
|
-
|
|
28989
|
+
useLayoutEffect7(() => {
|
|
28468
28990
|
if (!subdomain || isEditMode) {
|
|
28469
28991
|
setFetchState("done");
|
|
28470
28992
|
return;
|
|
@@ -28491,6 +29013,7 @@ function OhhwellsBridge() {
|
|
|
28491
29013
|
applyAiFooterFromContent(content);
|
|
28492
29014
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28493
29015
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
29016
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28494
29017
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28495
29018
|
}
|
|
28496
29019
|
applyBrandChrome(content);
|
|
@@ -28501,15 +29024,16 @@ function OhhwellsBridge() {
|
|
|
28501
29024
|
if (key === "__ohw_sections") continue;
|
|
28502
29025
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28503
29026
|
if (key === AI_FOOTER_KEY) continue;
|
|
29027
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29028
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28504
29029
|
if (key === BRAND_KIT_KEY) continue;
|
|
28505
29030
|
if (key === STYLE_STORE_KEY) continue;
|
|
28506
29031
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28507
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28508
29032
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28509
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28510
29033
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28511
29034
|
continue;
|
|
28512
29035
|
}
|
|
29036
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28513
29037
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28514
29038
|
if (applyCarouselNode(key, val)) continue;
|
|
28515
29039
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28549,6 +29073,7 @@ function OhhwellsBridge() {
|
|
|
28549
29073
|
});
|
|
28550
29074
|
applyLinkByKey(key, val);
|
|
28551
29075
|
}
|
|
29076
|
+
applySectionEmbeds(content);
|
|
28552
29077
|
applyLogoFromContent(content);
|
|
28553
29078
|
applyLogoSizes(content);
|
|
28554
29079
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28557,6 +29082,7 @@ function OhhwellsBridge() {
|
|
|
28557
29082
|
applySocialsDisplayFromContent(content);
|
|
28558
29083
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28559
29084
|
syncButtonsFromContent(document, content);
|
|
29085
|
+
applyHiddenEditablesToDom(content);
|
|
28560
29086
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28561
29087
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28562
29088
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -28737,20 +29263,22 @@ function OhhwellsBridge() {
|
|
|
28737
29263
|
}
|
|
28738
29264
|
applyAiFooterFromContent(content);
|
|
28739
29265
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
29266
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28740
29267
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28741
29268
|
}
|
|
28742
29269
|
for (const [key, val] of Object.entries(content)) {
|
|
28743
29270
|
if (key === "__ohw_sections") continue;
|
|
28744
29271
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28745
29272
|
if (key === AI_FOOTER_KEY) continue;
|
|
29273
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29274
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28746
29275
|
if (key === BRAND_KIT_KEY) continue;
|
|
28747
29276
|
if (key === STYLE_STORE_KEY) continue;
|
|
28748
29277
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28749
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28750
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28751
29278
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28752
29279
|
continue;
|
|
28753
29280
|
}
|
|
29281
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28754
29282
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28755
29283
|
if (applyCarouselNode(key, val)) continue;
|
|
28756
29284
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28775,6 +29303,7 @@ function OhhwellsBridge() {
|
|
|
28775
29303
|
});
|
|
28776
29304
|
applyLinkByKey(key, val);
|
|
28777
29305
|
}
|
|
29306
|
+
applySectionEmbeds(content);
|
|
28778
29307
|
applyLogoFromContent(content);
|
|
28779
29308
|
reconcileNavbarItemsFromContent(content);
|
|
28780
29309
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28782,6 +29311,7 @@ function OhhwellsBridge() {
|
|
|
28782
29311
|
applySocialsDisplayFromContent(content);
|
|
28783
29312
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28784
29313
|
syncButtonsFromContent(document, content);
|
|
29314
|
+
applyHiddenEditablesToDom(content);
|
|
28785
29315
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28786
29316
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28787
29317
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -28830,7 +29360,7 @@ function OhhwellsBridge() {
|
|
|
28830
29360
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28831
29361
|
};
|
|
28832
29362
|
}, [subdomain, isEditMode, pathname]);
|
|
28833
|
-
|
|
29363
|
+
useLayoutEffect7(() => {
|
|
28834
29364
|
const el = document.getElementById("ohw-loader");
|
|
28835
29365
|
if (!el) return;
|
|
28836
29366
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
@@ -28920,6 +29450,7 @@ function OhhwellsBridge() {
|
|
|
28920
29450
|
applySocialsDisplayFromContent(content);
|
|
28921
29451
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28922
29452
|
syncButtonsFromContent(document, content);
|
|
29453
|
+
applyHiddenEditablesToDom(content);
|
|
28923
29454
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28924
29455
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
28925
29456
|
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
|
|
@@ -29014,26 +29545,11 @@ function OhhwellsBridge() {
|
|
|
29014
29545
|
const t2 = setTimeout(measure, 500);
|
|
29015
29546
|
const ro = new ResizeObserver(schedule);
|
|
29016
29547
|
ro.observe(document.body);
|
|
29017
|
-
let lastWidth = window.innerWidth;
|
|
29018
|
-
let resizeTimers = [];
|
|
29019
|
-
const clearResizeTimers = () => {
|
|
29020
|
-
resizeTimers.forEach(clearTimeout);
|
|
29021
|
-
resizeTimers = [];
|
|
29022
|
-
};
|
|
29023
|
-
const handleResize = () => {
|
|
29024
|
-
if (window.innerWidth === lastWidth) return;
|
|
29025
|
-
lastWidth = window.innerWidth;
|
|
29026
|
-
clearResizeTimers();
|
|
29027
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29028
|
-
};
|
|
29029
|
-
window.addEventListener("resize", handleResize);
|
|
29030
29548
|
return () => {
|
|
29031
29549
|
clearTimeout(t1);
|
|
29032
29550
|
clearTimeout(t2);
|
|
29033
29551
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29034
29552
|
ro.disconnect();
|
|
29035
|
-
clearResizeTimers();
|
|
29036
|
-
window.removeEventListener("resize", handleResize);
|
|
29037
29553
|
};
|
|
29038
29554
|
}, [pathname, isEditMode, postToParent2]);
|
|
29039
29555
|
useEffect21(() => {
|
|
@@ -29330,6 +29846,13 @@ function OhhwellsBridge() {
|
|
|
29330
29846
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29331
29847
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29332
29848
|
if (isInsideLinkEditor(target)) return;
|
|
29849
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29850
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29851
|
+
if (target.closest(
|
|
29852
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29853
|
+
)) {
|
|
29854
|
+
return;
|
|
29855
|
+
}
|
|
29333
29856
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29334
29857
|
clearMediaSelectionRef.current();
|
|
29335
29858
|
}
|
|
@@ -29353,8 +29876,6 @@ function OhhwellsBridge() {
|
|
|
29353
29876
|
return;
|
|
29354
29877
|
}
|
|
29355
29878
|
}
|
|
29356
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29357
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29358
29879
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29359
29880
|
if (collectionItem) {
|
|
29360
29881
|
e.preventDefault();
|
|
@@ -29366,11 +29887,6 @@ function OhhwellsBridge() {
|
|
|
29366
29887
|
});
|
|
29367
29888
|
return;
|
|
29368
29889
|
}
|
|
29369
|
-
if (target.closest(
|
|
29370
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29371
|
-
)) {
|
|
29372
|
-
return;
|
|
29373
|
-
}
|
|
29374
29890
|
{
|
|
29375
29891
|
const formEl = getFormElement(target);
|
|
29376
29892
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29524,9 +30040,13 @@ function OhhwellsBridge() {
|
|
|
29524
30040
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29525
30041
|
e.preventDefault();
|
|
29526
30042
|
e.stopPropagation();
|
|
29527
|
-
selectIconElementRef.current(editable);
|
|
29528
30043
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29529
30044
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
30045
|
+
if (aiIcon) {
|
|
30046
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
30047
|
+
} else {
|
|
30048
|
+
selectIconElementRef.current(editable);
|
|
30049
|
+
}
|
|
29530
30050
|
postToParentRef.current({
|
|
29531
30051
|
type: "ow:icon-pick",
|
|
29532
30052
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29754,6 +30274,9 @@ function OhhwellsBridge() {
|
|
|
29754
30274
|
setHoveredItemRect(null);
|
|
29755
30275
|
hoveredNavContainerRef.current = null;
|
|
29756
30276
|
setHoveredNavContainerRect(null);
|
|
30277
|
+
siblingHintElRef.current = null;
|
|
30278
|
+
setSiblingHintRect(null);
|
|
30279
|
+
setSiblingHintRects([]);
|
|
29757
30280
|
return;
|
|
29758
30281
|
}
|
|
29759
30282
|
{
|
|
@@ -29874,7 +30397,6 @@ function OhhwellsBridge() {
|
|
|
29874
30397
|
hoveredNavContainerRef.current = null;
|
|
29875
30398
|
setHoveredNavContainerRect(null);
|
|
29876
30399
|
hoveredItemElRef.current = editable;
|
|
29877
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29878
30400
|
}
|
|
29879
30401
|
}
|
|
29880
30402
|
}
|
|
@@ -30584,7 +31106,11 @@ function OhhwellsBridge() {
|
|
|
30584
31106
|
};
|
|
30585
31107
|
const handleMouseMove = (e) => {
|
|
30586
31108
|
const { clientX, clientY } = e;
|
|
30587
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31109
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31110
|
+
dismissImageHover();
|
|
31111
|
+
clearImageHover();
|
|
31112
|
+
return;
|
|
31113
|
+
}
|
|
30588
31114
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30589
31115
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30590
31116
|
formHoverElRef.current = null;
|
|
@@ -30613,7 +31139,12 @@ function OhhwellsBridge() {
|
|
|
30613
31139
|
setHoveredItemRect(null);
|
|
30614
31140
|
hoveredNavContainerRef.current = null;
|
|
30615
31141
|
setHoveredNavContainerRect(null);
|
|
31142
|
+
siblingHintElRef.current = null;
|
|
31143
|
+
setSiblingHintRect(null);
|
|
31144
|
+
setSiblingHintRects([]);
|
|
30616
31145
|
dismissImageHover();
|
|
31146
|
+
clearImageHover();
|
|
31147
|
+
setSectionGap(null);
|
|
30617
31148
|
return;
|
|
30618
31149
|
}
|
|
30619
31150
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30625,7 +31156,11 @@ function OhhwellsBridge() {
|
|
|
30625
31156
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30626
31157
|
const { clientX, clientY } = e.data;
|
|
30627
31158
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30628
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31159
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31160
|
+
dismissImageHover();
|
|
31161
|
+
clearImageHover();
|
|
31162
|
+
return;
|
|
31163
|
+
}
|
|
30629
31164
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30630
31165
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30631
31166
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -31005,6 +31540,7 @@ function OhhwellsBridge() {
|
|
|
31005
31540
|
applyAiFooterFromContent(content);
|
|
31006
31541
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31007
31542
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31543
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31008
31544
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31009
31545
|
}
|
|
31010
31546
|
applyBrandChrome(content);
|
|
@@ -31019,15 +31555,16 @@ function OhhwellsBridge() {
|
|
|
31019
31555
|
}
|
|
31020
31556
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31021
31557
|
if (key === AI_FOOTER_KEY) continue;
|
|
31558
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31559
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31022
31560
|
if (key === BRAND_KIT_KEY) continue;
|
|
31023
31561
|
if (key === STYLE_STORE_KEY) continue;
|
|
31024
31562
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31025
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31026
31563
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31027
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31028
31564
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31029
31565
|
continue;
|
|
31030
31566
|
}
|
|
31567
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31031
31568
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31032
31569
|
if (applyCarouselNode(key, val)) continue;
|
|
31033
31570
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31053,6 +31590,7 @@ function OhhwellsBridge() {
|
|
|
31053
31590
|
});
|
|
31054
31591
|
applyLinkByKey(key, val);
|
|
31055
31592
|
}
|
|
31593
|
+
applySectionEmbeds(content);
|
|
31056
31594
|
applyLogoFromContent(content);
|
|
31057
31595
|
applyLogoSizes(content);
|
|
31058
31596
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31067,6 +31605,7 @@ function OhhwellsBridge() {
|
|
|
31067
31605
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
31068
31606
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
31069
31607
|
syncButtonsFromContent(document, editContentRef.current);
|
|
31608
|
+
applyHiddenEditablesToDom(editContentRef.current);
|
|
31070
31609
|
if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
|
|
31071
31610
|
syncNavigationDragCursorAttrs();
|
|
31072
31611
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
@@ -31692,6 +32231,12 @@ function OhhwellsBridge() {
|
|
|
31692
32231
|
closeLinkPopoverRef.current();
|
|
31693
32232
|
return;
|
|
31694
32233
|
}
|
|
32234
|
+
if (floatingPanelOpenRef.current) {
|
|
32235
|
+
setFloatingPanelRef.current(null);
|
|
32236
|
+
deselectRef.current();
|
|
32237
|
+
deactivateRef.current();
|
|
32238
|
+
return;
|
|
32239
|
+
}
|
|
31695
32240
|
deselectRef.current();
|
|
31696
32241
|
deactivateRef.current();
|
|
31697
32242
|
clearMediaSelectionRef.current();
|
|
@@ -31870,7 +32415,7 @@ function OhhwellsBridge() {
|
|
|
31870
32415
|
return;
|
|
31871
32416
|
}
|
|
31872
32417
|
}
|
|
31873
|
-
if ((e.key === "Delete" || e.key === "Backspace") &&
|
|
32418
|
+
if ((e.key === "Delete" || e.key === "Backspace") && !activeElRef.current && !linkPopoverOpenRef.current && (selectedElRef.current || selectedMediaElRef.current || selectedIconElRef.current)) {
|
|
31874
32419
|
if (handleDeleteSelectedRef.current()) {
|
|
31875
32420
|
e.preventDefault();
|
|
31876
32421
|
return;
|
|
@@ -32522,10 +33067,10 @@ function OhhwellsBridge() {
|
|
|
32522
33067
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32523
33068
|
window.removeEventListener("message", handleDeactivate);
|
|
32524
33069
|
window.removeEventListener("message", handleSelectNav);
|
|
32525
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32526
33070
|
window.removeEventListener("message", handleToastAction);
|
|
32527
33071
|
window.removeEventListener("message", handleFormCount);
|
|
32528
33072
|
window.removeEventListener("message", handleUiEscape);
|
|
33073
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32529
33074
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32530
33075
|
autoSaveTimers.current.clear();
|
|
32531
33076
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32819,7 +33364,7 @@ function OhhwellsBridge() {
|
|
|
32819
33364
|
postToParent2({
|
|
32820
33365
|
type: "ow:ready",
|
|
32821
33366
|
version: "1",
|
|
32822
|
-
bridgeVersion: "0.1.
|
|
33367
|
+
bridgeVersion: "0.1.172-next.456",
|
|
32823
33368
|
path: pathname,
|
|
32824
33369
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32825
33370
|
sections
|
|
@@ -33176,7 +33721,154 @@ function OhhwellsBridge() {
|
|
|
33176
33721
|
enforceLinkHrefs();
|
|
33177
33722
|
return true;
|
|
33178
33723
|
}, []);
|
|
33724
|
+
const deleteAiBlock = useCallback12(
|
|
33725
|
+
(editKey, opts) => {
|
|
33726
|
+
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33727
|
+
if (deletingAiBlockRef.current) return false;
|
|
33728
|
+
const plan = planAiBlockRemoval(aiSectionsRef.current, editKey);
|
|
33729
|
+
if (!plan) return false;
|
|
33730
|
+
if (!plan.ok) {
|
|
33731
|
+
postToParent2({
|
|
33732
|
+
type: "ow:toast",
|
|
33733
|
+
title: plan.reasons[0] ?? "That block cannot be deleted",
|
|
33734
|
+
toastType: "error"
|
|
33735
|
+
});
|
|
33736
|
+
return true;
|
|
33737
|
+
}
|
|
33738
|
+
const { tree: nextTree, entry } = plan;
|
|
33739
|
+
const previous = aiSectionsRef.current;
|
|
33740
|
+
deletingAiBlockRef.current = true;
|
|
33741
|
+
void requestValidateTree5(postToParent2, nextTree).then(({ ok, reasons }) => {
|
|
33742
|
+
deletingAiBlockRef.current = false;
|
|
33743
|
+
if (!ok) {
|
|
33744
|
+
postToParent2({
|
|
33745
|
+
type: "ow:toast",
|
|
33746
|
+
title: reasons[0] ?? "That change is not allowed.",
|
|
33747
|
+
toastType: "error"
|
|
33748
|
+
});
|
|
33749
|
+
return;
|
|
33750
|
+
}
|
|
33751
|
+
clearMediaSelectionRef.current();
|
|
33752
|
+
clearIconSelectionRef.current();
|
|
33753
|
+
applyTreeLocalRef.current?.({
|
|
33754
|
+
id: entry.id,
|
|
33755
|
+
mode: "replace",
|
|
33756
|
+
targetSectionId: entry.id,
|
|
33757
|
+
tree: nextTree,
|
|
33758
|
+
label: entry.label,
|
|
33759
|
+
media: entry.media,
|
|
33760
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
33761
|
+
skipScrollIntoView: true
|
|
33762
|
+
});
|
|
33763
|
+
const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `delete-block-${Date.now()}`;
|
|
33764
|
+
pendingDeleteUndoRef.current = {
|
|
33765
|
+
actionId,
|
|
33766
|
+
restore: () => {
|
|
33767
|
+
clearInteractionChromeRef.current();
|
|
33768
|
+
aiSectionsRef.current = previous;
|
|
33769
|
+
applyAiSectionsToDom(parseAiSectionsState(previous));
|
|
33770
|
+
const restoreHeight = document.body.scrollHeight;
|
|
33771
|
+
if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
|
|
33772
|
+
postToParent2({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: previous }] });
|
|
33773
|
+
postToParent2({
|
|
33774
|
+
type: "ow:ai-sections-changed",
|
|
33775
|
+
sections: collectSections(),
|
|
33776
|
+
nodes: collectEditableNodes(editContentRef.current)
|
|
33777
|
+
});
|
|
33778
|
+
}
|
|
33779
|
+
};
|
|
33780
|
+
postToParent2({
|
|
33781
|
+
type: "ow:toast",
|
|
33782
|
+
title: "Block deleted",
|
|
33783
|
+
toastType: "success",
|
|
33784
|
+
actionLabel: "Undo",
|
|
33785
|
+
actionId,
|
|
33786
|
+
duration: 6e3
|
|
33787
|
+
});
|
|
33788
|
+
});
|
|
33789
|
+
return true;
|
|
33790
|
+
},
|
|
33791
|
+
[postToParent2]
|
|
33792
|
+
);
|
|
33793
|
+
const softHideTemplateEditable = useCallback12(
|
|
33794
|
+
(el, opts) => {
|
|
33795
|
+
if (!opts?.fromToolbar && activeElRef.current) return false;
|
|
33796
|
+
if (!canSoftHideEditable(el, {
|
|
33797
|
+
isNavFooterItem: Boolean(
|
|
33798
|
+
getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
|
|
33799
|
+
)
|
|
33800
|
+
})) {
|
|
33801
|
+
return false;
|
|
33802
|
+
}
|
|
33803
|
+
const previousContent = editContentRef.current;
|
|
33804
|
+
const result = softHideEditableInDom(el, previousContent);
|
|
33805
|
+
if (!result) return false;
|
|
33806
|
+
editContentRef.current = result.content;
|
|
33807
|
+
postToParent2({ type: "ow:change", nodes: result.nodes });
|
|
33808
|
+
clearMediaSelectionRef.current();
|
|
33809
|
+
clearIconSelectionRef.current();
|
|
33810
|
+
clearInteractionChromeRef.current();
|
|
33811
|
+
clearFormPickRef.current?.();
|
|
33812
|
+
deselectRef.current();
|
|
33813
|
+
const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `hide-editable-${Date.now()}`;
|
|
33814
|
+
const hiddenKey = result.key;
|
|
33815
|
+
pendingDeleteUndoRef.current = {
|
|
33816
|
+
actionId,
|
|
33817
|
+
restore: () => {
|
|
33818
|
+
clearInteractionChromeRef.current();
|
|
33819
|
+
const restored = softUnhideEditableInDom(hiddenKey, editContentRef.current);
|
|
33820
|
+
editContentRef.current = restored.content;
|
|
33821
|
+
postToParent2({ type: "ow:change", nodes: restored.nodes });
|
|
33822
|
+
const restoreHeight = document.body.scrollHeight;
|
|
33823
|
+
if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
|
|
33824
|
+
}
|
|
33825
|
+
};
|
|
33826
|
+
postToParent2({
|
|
33827
|
+
type: "ow:toast",
|
|
33828
|
+
title: "Block deleted",
|
|
33829
|
+
toastType: "success",
|
|
33830
|
+
actionLabel: "Undo",
|
|
33831
|
+
actionId,
|
|
33832
|
+
duration: 6e3
|
|
33833
|
+
});
|
|
33834
|
+
return true;
|
|
33835
|
+
},
|
|
33836
|
+
[postToParent2]
|
|
33837
|
+
);
|
|
33838
|
+
const deleteFromToolbar = useCallback12(
|
|
33839
|
+
(editKey, el) => {
|
|
33840
|
+
if (!editKey && !el) return false;
|
|
33841
|
+
if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
|
|
33842
|
+
return deleteAiBlock(editKey, { fromToolbar: true });
|
|
33843
|
+
}
|
|
33844
|
+
const target = el ?? (editKey ? document.querySelector(`[data-ohw-key="${editKey.replace(/"/g, '\\"')}"]`) : null);
|
|
33845
|
+
if (target) return softHideTemplateEditable(target, { fromToolbar: true });
|
|
33846
|
+
return false;
|
|
33847
|
+
},
|
|
33848
|
+
[deleteAiBlock, softHideTemplateEditable]
|
|
33849
|
+
);
|
|
33850
|
+
const resolveSelectedAiBlockKey = useCallback12(() => {
|
|
33851
|
+
const candidates = [
|
|
33852
|
+
activeElRef.current?.dataset.ohwKey,
|
|
33853
|
+
selectedMediaElRef.current?.dataset.ohwKey,
|
|
33854
|
+
selectedMedia?.key,
|
|
33855
|
+
selectedIconElRef.current?.dataset.ohwKey,
|
|
33856
|
+
selectedElRef.current?.getAttribute("data-ohw-href-key"),
|
|
33857
|
+
selectedElRef.current?.dataset.ohwKey,
|
|
33858
|
+
selectedElRef.current?.querySelector("[data-ohw-key]")?.dataset.ohwKey
|
|
33859
|
+
];
|
|
33860
|
+
for (const key of candidates) {
|
|
33861
|
+
if (key && canRemoveAiBlock(aiSectionsRef.current, key)) return key;
|
|
33862
|
+
}
|
|
33863
|
+
return null;
|
|
33864
|
+
}, [selectedMedia]);
|
|
33179
33865
|
const handleDeleteSelected = useCallback12(() => {
|
|
33866
|
+
if (!activeElRef.current) {
|
|
33867
|
+
const aiKey = resolveSelectedAiBlockKey();
|
|
33868
|
+
if (aiKey && deleteAiBlock(aiKey)) return true;
|
|
33869
|
+
const mediaEl = selectedMediaElRef.current;
|
|
33870
|
+
if (mediaEl && softHideTemplateEditable(mediaEl, { fromToolbar: true })) return true;
|
|
33871
|
+
}
|
|
33180
33872
|
const selected = selectedElRef.current;
|
|
33181
33873
|
if (!selected) return false;
|
|
33182
33874
|
if (isCtaButton(selected)) {
|
|
@@ -33235,7 +33927,7 @@ function OhhwellsBridge() {
|
|
|
33235
33927
|
}
|
|
33236
33928
|
}
|
|
33237
33929
|
return deleted;
|
|
33238
|
-
}, [postToParent2]);
|
|
33930
|
+
}, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
|
|
33239
33931
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
33240
33932
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
33241
33933
|
const handleLinkPopoverSubmit = useCallback12(
|
|
@@ -33453,6 +34145,13 @@ function OhhwellsBridge() {
|
|
|
33453
34145
|
isUploading: false,
|
|
33454
34146
|
onReplace: handleMediaReplace,
|
|
33455
34147
|
onSelect: handleMediaSelect,
|
|
34148
|
+
onDelete: canRemoveAiBlock(aiSectionsRef.current, selectedMedia.key) || selectedMediaElRef.current != null && canSoftHideEditable(selectedMediaElRef.current, {
|
|
34149
|
+
isNavFooterItem: Boolean(
|
|
34150
|
+
getNavigationItemAnchor(selectedMediaElRef.current) && isNavFooterScopedNavigationItem(selectedMediaElRef.current) && !isCtaButton(selectedMediaElRef.current)
|
|
34151
|
+
)
|
|
34152
|
+
}) ? (key) => {
|
|
34153
|
+
deleteFromToolbar(key, selectedMediaElRef.current);
|
|
34154
|
+
} : void 0,
|
|
33456
34155
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
33457
34156
|
}
|
|
33458
34157
|
),
|
|
@@ -33555,7 +34254,7 @@ function OhhwellsBridge() {
|
|
|
33555
34254
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33556
34255
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33557
34256
|
"data-ohw-add-field": "",
|
|
33558
|
-
children: /* @__PURE__ */ jsx40(
|
|
34257
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33559
34258
|
}
|
|
33560
34259
|
),
|
|
33561
34260
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -33617,7 +34316,24 @@ function OhhwellsBridge() {
|
|
|
33617
34316
|
children: state
|
|
33618
34317
|
},
|
|
33619
34318
|
state
|
|
33620
|
-
)) })
|
|
34319
|
+
)) }),
|
|
34320
|
+
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
34321
|
+
/* @__PURE__ */ jsx40(
|
|
34322
|
+
"button",
|
|
34323
|
+
{
|
|
34324
|
+
type: "button",
|
|
34325
|
+
"aria-label": "Delete form",
|
|
34326
|
+
title: "Delete",
|
|
34327
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
34328
|
+
onClick: () => {
|
|
34329
|
+
setFieldTypePickerOpen(false);
|
|
34330
|
+
const form = formPickElRef.current;
|
|
34331
|
+
if (!form) return;
|
|
34332
|
+
softHideTemplateEditable(form, { fromToolbar: true });
|
|
34333
|
+
},
|
|
34334
|
+
children: /* @__PURE__ */ jsx40(Trash24, { size: 15, "aria-hidden": true })
|
|
34335
|
+
}
|
|
34336
|
+
)
|
|
33621
34337
|
]
|
|
33622
34338
|
}
|
|
33623
34339
|
)
|
|
@@ -33786,7 +34502,15 @@ function OhhwellsBridge() {
|
|
|
33786
34502
|
onCommand: handleCommand,
|
|
33787
34503
|
activeCommands,
|
|
33788
34504
|
showEditLink,
|
|
33789
|
-
onEditLink: openLinkPopoverForActive
|
|
34505
|
+
onEditLink: openLinkPopoverForActive,
|
|
34506
|
+
showDelete: toolbarShowAiBlockDelete,
|
|
34507
|
+
deleteDisabled: deletingAiBlockRef.current,
|
|
34508
|
+
onDelete: () => {
|
|
34509
|
+
const el = activeElRef.current;
|
|
34510
|
+
const key = el?.dataset.ohwKey;
|
|
34511
|
+
if (!key) return;
|
|
34512
|
+
deleteFromToolbar(key, el);
|
|
34513
|
+
}
|
|
33790
34514
|
}
|
|
33791
34515
|
)
|
|
33792
34516
|
] }),
|
|
@@ -34015,6 +34739,7 @@ export {
|
|
|
34015
34739
|
FOOTER_COLUMN_BLOCKS,
|
|
34016
34740
|
FOOTER_COLUMN_SPANS,
|
|
34017
34741
|
FOOTER_SOCIAL_PLATFORMS,
|
|
34742
|
+
HIDDEN_EDITABLES_KEY,
|
|
34018
34743
|
ItemActionToolbar,
|
|
34019
34744
|
ItemInteractionLayer,
|
|
34020
34745
|
LinkEditorPanel,
|
|
@@ -34037,9 +34762,14 @@ export {
|
|
|
34037
34762
|
addFooterLinkColumn,
|
|
34038
34763
|
appendFooterSocial,
|
|
34039
34764
|
applyBrandChrome,
|
|
34765
|
+
applyHiddenEditablesToDom,
|
|
34040
34766
|
applyStickySearchParams,
|
|
34767
|
+
blockPathFromEditKey,
|
|
34041
34768
|
buildDefaultFooterTree,
|
|
34042
34769
|
buildTarget,
|
|
34770
|
+
canRemoveAiBlock,
|
|
34771
|
+
canRemoveAiTextBlock,
|
|
34772
|
+
canSoftHideEditable,
|
|
34043
34773
|
dropIndicatorVariants,
|
|
34044
34774
|
ensureFooterTree,
|
|
34045
34775
|
filterAvailablePages,
|
|
@@ -34050,6 +34780,7 @@ export {
|
|
|
34050
34780
|
insertFooterHours,
|
|
34051
34781
|
isDeadPageHref,
|
|
34052
34782
|
isEditSessionActive,
|
|
34783
|
+
isEditableKeyHidden,
|
|
34053
34784
|
isPlainLeftClick,
|
|
34054
34785
|
isRenderableFooterTree,
|
|
34055
34786
|
isRenderableTree,
|
|
@@ -34060,15 +34791,22 @@ export {
|
|
|
34060
34791
|
parseAiFooterState,
|
|
34061
34792
|
parseAiSectionsState,
|
|
34062
34793
|
parseTarget,
|
|
34794
|
+
planAiBlockRemoval,
|
|
34795
|
+
planAiTextBlockRemoval,
|
|
34063
34796
|
planBuildPageSync,
|
|
34797
|
+
readHiddenEditables,
|
|
34064
34798
|
recordOverriddenPaths,
|
|
34065
34799
|
releaseTemplateLogoIfReplaced,
|
|
34800
|
+
removeBlockAtPath,
|
|
34066
34801
|
removeFooterBlock,
|
|
34067
34802
|
resetOverriddenPathsCache,
|
|
34068
34803
|
resolveFooterCopyright,
|
|
34804
|
+
resolveSoftHideTarget,
|
|
34069
34805
|
resolveStickyNavigation,
|
|
34070
34806
|
serializeAiFooterState,
|
|
34071
34807
|
shouldFetchContentForPath,
|
|
34808
|
+
softHideEditableInDom,
|
|
34809
|
+
softUnhideEditableInDom,
|
|
34072
34810
|
stepViableSlide,
|
|
34073
34811
|
stripPlaceholderText,
|
|
34074
34812
|
stripPlaceholders,
|
|
@@ -34076,6 +34814,8 @@ export {
|
|
|
34076
34814
|
toggleVariants,
|
|
34077
34815
|
useOhwCarousel,
|
|
34078
34816
|
validateUrlInput,
|
|
34079
|
-
viableSlides
|
|
34817
|
+
viableSlides,
|
|
34818
|
+
withHiddenEditable,
|
|
34819
|
+
withoutHiddenEditable
|
|
34080
34820
|
};
|
|
34081
34821
|
//# sourceMappingURL=index.js.map
|