@ohhwells/bridge 0.1.170 → 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 +1563 -821
- 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 +1585 -843
- 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;
|
|
@@ -17749,7 +18180,9 @@ function isFieldRequired(wrapper) {
|
|
|
17749
18180
|
function markFormFields(form) {
|
|
17750
18181
|
form.querySelectorAll("input, textarea").forEach((input) => {
|
|
17751
18182
|
const type = input.type;
|
|
17752
|
-
if (type === "submit" || type === "button" || type === "reset" || type === "hidden")
|
|
18183
|
+
if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
|
|
18184
|
+
return;
|
|
18185
|
+
}
|
|
17753
18186
|
if (getFieldWrapper(input)) return;
|
|
17754
18187
|
let wrapper = input;
|
|
17755
18188
|
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll("input, textarea").length === 1) {
|
|
@@ -18157,7 +18590,7 @@ function FieldTypePicker({ onPick }) {
|
|
|
18157
18590
|
|
|
18158
18591
|
// src/ui/MediaOverlay.tsx
|
|
18159
18592
|
import * as React8 from "react";
|
|
18160
|
-
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";
|
|
18161
18594
|
|
|
18162
18595
|
// src/ui/button.tsx
|
|
18163
18596
|
import * as React7 from "react";
|
|
@@ -18247,6 +18680,7 @@ function MediaOverlay({
|
|
|
18247
18680
|
onFadeOutComplete,
|
|
18248
18681
|
onReplace,
|
|
18249
18682
|
onSelect,
|
|
18683
|
+
onDelete,
|
|
18250
18684
|
onVideoSettingsChange
|
|
18251
18685
|
}) {
|
|
18252
18686
|
const { rect } = hover;
|
|
@@ -18266,6 +18700,7 @@ function MediaOverlay({
|
|
|
18266
18700
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18267
18701
|
);
|
|
18268
18702
|
}, [isVideo]);
|
|
18703
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18269
18704
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18270
18705
|
const box = {
|
|
18271
18706
|
position: "fixed",
|
|
@@ -18364,11 +18799,10 @@ function MediaOverlay({
|
|
|
18364
18799
|
className: "flex items-center justify-center cursor-pointer",
|
|
18365
18800
|
style: {
|
|
18366
18801
|
...box,
|
|
18367
|
-
//
|
|
18368
|
-
//
|
|
18369
|
-
//
|
|
18370
|
-
|
|
18371
|
-
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",
|
|
18372
18806
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18373
18807
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18374
18808
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18395,40 +18829,74 @@ function MediaOverlay({
|
|
|
18395
18829
|
},
|
|
18396
18830
|
children: [
|
|
18397
18831
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18398
|
-
|
|
18832
|
+
replaceLabel
|
|
18399
18833
|
]
|
|
18400
18834
|
}
|
|
18401
18835
|
),
|
|
18402
|
-
replaceMode
|
|
18403
|
-
|
|
18836
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18837
|
+
"div",
|
|
18404
18838
|
{
|
|
18405
|
-
"
|
|
18406
|
-
variant: "outline",
|
|
18407
|
-
size: "sm",
|
|
18408
|
-
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
18409
|
-
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18839
|
+
className: "flex items-center gap-1.5",
|
|
18410
18840
|
style: {
|
|
18411
|
-
|
|
18412
|
-
// Icon-only is a square of the same height, so the pair can never differ vertically.
|
|
18413
|
-
// `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
|
|
18414
|
-
// minimum beats a width — the square came out wider than the avatar it sat on.
|
|
18415
|
-
...replaceMode === "icon" && buttonSize ? {
|
|
18416
|
-
width: buttonSize.height,
|
|
18417
|
-
minWidth: buttonSize.height,
|
|
18418
|
-
padding: 0,
|
|
18419
|
-
justifyContent: "center"
|
|
18420
|
-
} : null,
|
|
18421
|
-
// 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).
|
|
18422
18842
|
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
|
|
18423
18843
|
},
|
|
18424
|
-
|
|
18425
|
-
onClick: (e) => {
|
|
18426
|
-
e.stopPropagation();
|
|
18427
|
-
onReplace(hover.key);
|
|
18428
|
-
},
|
|
18844
|
+
onClick: (e) => e.stopPropagation(),
|
|
18429
18845
|
children: [
|
|
18430
|
-
|
|
18431
|
-
|
|
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
|
|
18432
18900
|
]
|
|
18433
18901
|
}
|
|
18434
18902
|
)
|
|
@@ -19059,8 +19527,24 @@ function AiSectionOverlay({
|
|
|
19059
19527
|
}
|
|
19060
19528
|
|
|
19061
19529
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19062
|
-
import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
|
|
19063
|
-
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";
|
|
19064
19548
|
|
|
19065
19549
|
// src/lib/ai-media-strip-tree.ts
|
|
19066
19550
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19174,14 +19658,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19174
19658
|
return true;
|
|
19175
19659
|
});
|
|
19176
19660
|
}
|
|
19177
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
19178
|
-
return withMediaStrip(tree, (block) => {
|
|
19179
|
-
const items = block.items;
|
|
19180
|
-
if (index < 0 || index >= items.length) return false;
|
|
19181
|
-
items[index] = { ...items[index], alt };
|
|
19182
|
-
return true;
|
|
19183
|
-
});
|
|
19184
|
-
}
|
|
19185
19661
|
function setMediaStripItemLink(tree, index, link) {
|
|
19186
19662
|
return withMediaStrip(tree, (block) => {
|
|
19187
19663
|
const items = block.items;
|
|
@@ -19199,11 +19675,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19199
19675
|
});
|
|
19200
19676
|
}
|
|
19201
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
|
+
|
|
19202
19785
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19203
|
-
import { Fragment as Fragment7, jsx as
|
|
19204
|
-
var PRIMARY3 = "#0885FE";
|
|
19205
|
-
var
|
|
19206
|
-
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]";
|
|
19207
19789
|
function findMediaStripItemElement(sectionId, index) {
|
|
19208
19790
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19209
19791
|
if (!sectionEl2) return null;
|
|
@@ -19213,14 +19795,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19213
19795
|
}
|
|
19214
19796
|
return null;
|
|
19215
19797
|
}
|
|
19216
|
-
function
|
|
19217
|
-
|
|
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) {
|
|
19218
19814
|
if (!el) return null;
|
|
19219
19815
|
const r2 = el.getBoundingClientRect();
|
|
19220
19816
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19221
19817
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19222
19818
|
}
|
|
19223
|
-
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) {
|
|
19224
19827
|
const [rect, setRect] = useState8(null);
|
|
19225
19828
|
useEffect9(() => {
|
|
19226
19829
|
if (!ref) {
|
|
@@ -19228,7 +19831,7 @@ function useLiveItemRect(ref) {
|
|
|
19228
19831
|
return;
|
|
19229
19832
|
}
|
|
19230
19833
|
const update = () => {
|
|
19231
|
-
const next = readRect2(ref);
|
|
19834
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19232
19835
|
setRect(
|
|
19233
19836
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19234
19837
|
);
|
|
@@ -19243,9 +19846,49 @@ function useLiveItemRect(ref) {
|
|
|
19243
19846
|
window.removeEventListener("resize", update);
|
|
19244
19847
|
clearInterval(interval);
|
|
19245
19848
|
};
|
|
19246
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19849
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19247
19850
|
return rect;
|
|
19248
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
|
+
}
|
|
19249
19892
|
function requestValidateTree(postToParent2, tree) {
|
|
19250
19893
|
return new Promise((resolve) => {
|
|
19251
19894
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19282,116 +19925,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19282
19925
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19283
19926
|
});
|
|
19284
19927
|
}
|
|
19285
|
-
function
|
|
19928
|
+
function ToolbarAction({
|
|
19286
19929
|
label,
|
|
19287
19930
|
onClick,
|
|
19288
|
-
disabled,
|
|
19289
|
-
active
|
|
19931
|
+
disabled = false,
|
|
19932
|
+
active = false,
|
|
19933
|
+
children
|
|
19290
19934
|
}) {
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
{
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
disabled,
|
|
19297
|
-
style: {
|
|
19298
|
-
height: 28,
|
|
19299
|
-
padding: "0 10px",
|
|
19300
|
-
display: "inline-flex",
|
|
19301
|
-
alignItems: "center",
|
|
19302
|
-
gap: 4,
|
|
19303
|
-
borderRadius: 999,
|
|
19304
|
-
border: "none",
|
|
19305
|
-
cursor: disabled ? "default" : "pointer",
|
|
19306
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19307
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19308
|
-
opacity: disabled ? 0.4 : 1,
|
|
19309
|
-
fontSize: 12,
|
|
19310
|
-
lineHeight: "16px",
|
|
19311
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19312
|
-
whiteSpace: "nowrap",
|
|
19313
|
-
flex: "0 0 auto"
|
|
19314
|
-
},
|
|
19315
|
-
children: label
|
|
19316
|
-
}
|
|
19317
|
-
);
|
|
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
|
+
] });
|
|
19318
19940
|
}
|
|
19319
|
-
function
|
|
19320
|
-
|
|
19321
|
-
|
|
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
|
-
children: "Alt"
|
|
19350
|
-
}
|
|
19351
|
-
),
|
|
19352
|
-
/* @__PURE__ */ jsx20(
|
|
19353
|
-
"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,
|
|
19354
19970
|
{
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
"aria-label": "Image alt text",
|
|
19370
|
-
style: {
|
|
19371
|
-
flex: 1,
|
|
19372
|
-
minWidth: 0,
|
|
19373
|
-
border: "none",
|
|
19374
|
-
outline: "none",
|
|
19375
|
-
background: "transparent",
|
|
19376
|
-
fontSize: 12,
|
|
19377
|
-
lineHeight: "16px",
|
|
19378
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19379
|
-
color: "#1f2937"
|
|
19380
|
-
}
|
|
19381
|
-
}
|
|
19382
|
-
)
|
|
19383
|
-
]
|
|
19384
|
-
}
|
|
19385
|
-
);
|
|
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
|
+
] });
|
|
19386
19985
|
}
|
|
19387
19986
|
var VARIANTS = [
|
|
19388
19987
|
{ value: "logos", label: "Logos" },
|
|
19389
19988
|
{ value: "reel", label: "Reel" }
|
|
19390
19989
|
];
|
|
19391
19990
|
var ALIGNS = [
|
|
19392
|
-
{ value: "left", label: "
|
|
19393
|
-
{ value: "center", label: "
|
|
19394
|
-
{ 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 }
|
|
19395
19994
|
];
|
|
19396
19995
|
var HOVERS = [
|
|
19397
19996
|
{ value: "none", label: "None" },
|
|
@@ -19399,104 +19998,104 @@ var HOVERS = [
|
|
|
19399
19998
|
{ value: "zoom", label: "Zoom" },
|
|
19400
19999
|
{ value: "fade", label: "Fade" }
|
|
19401
20000
|
];
|
|
19402
|
-
var TREATMENTS = [
|
|
19403
|
-
{ value: "color", label: "Color" },
|
|
19404
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19405
|
-
];
|
|
19406
20001
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19407
|
-
function
|
|
19408
|
-
|
|
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");
|
|
19409
20010
|
const [invalid, setInvalid] = useState8(false);
|
|
19410
|
-
|
|
19411
|
-
setDraft(value);
|
|
19412
|
-
setInvalid(false);
|
|
19413
|
-
}, [value]);
|
|
19414
|
-
const commit2 = () => {
|
|
20011
|
+
const save = () => {
|
|
19415
20012
|
const next = draft.trim();
|
|
19416
|
-
if (next
|
|
19417
|
-
|
|
19418
|
-
|
|
19419
|
-
onCommit(next);
|
|
19420
|
-
};
|
|
19421
|
-
return /* @__PURE__ */ jsxs11(
|
|
19422
|
-
"div",
|
|
19423
|
-
{
|
|
19424
|
-
style: {
|
|
19425
|
-
display: "flex",
|
|
19426
|
-
alignItems: "center",
|
|
19427
|
-
gap: 6,
|
|
19428
|
-
height: 28,
|
|
19429
|
-
padding: "0 12px",
|
|
19430
|
-
borderRadius: 999,
|
|
19431
|
-
background: "#ffffff",
|
|
19432
|
-
width: "100%",
|
|
19433
|
-
maxWidth: 260,
|
|
19434
|
-
boxSizing: "border-box",
|
|
19435
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19436
|
-
},
|
|
19437
|
-
children: [
|
|
19438
|
-
/* @__PURE__ */ jsx20(
|
|
19439
|
-
"span",
|
|
19440
|
-
{
|
|
19441
|
-
style: {
|
|
19442
|
-
flex: "0 0 auto",
|
|
19443
|
-
color: OHW_BLUE_DARK,
|
|
19444
|
-
fontSize: 10,
|
|
19445
|
-
fontWeight: 700,
|
|
19446
|
-
textTransform: "uppercase",
|
|
19447
|
-
letterSpacing: 0.4
|
|
19448
|
-
},
|
|
19449
|
-
children: "Link"
|
|
19450
|
-
}
|
|
19451
|
-
),
|
|
19452
|
-
/* @__PURE__ */ jsx20(
|
|
19453
|
-
"input",
|
|
19454
|
-
{
|
|
19455
|
-
type: "text",
|
|
19456
|
-
inputMode: "url",
|
|
19457
|
-
value: draft,
|
|
19458
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19459
|
-
onBlur: commit2,
|
|
19460
|
-
onKeyDown: (e) => {
|
|
19461
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19462
|
-
if (e.key === "Escape") {
|
|
19463
|
-
setDraft(value);
|
|
19464
|
-
setInvalid(false);
|
|
19465
|
-
e.currentTarget.blur();
|
|
19466
|
-
}
|
|
19467
|
-
},
|
|
19468
|
-
placeholder: "https://example.com",
|
|
19469
|
-
"aria-label": "Image link URL",
|
|
19470
|
-
"aria-invalid": invalid,
|
|
19471
|
-
style: {
|
|
19472
|
-
flex: 1,
|
|
19473
|
-
minWidth: 0,
|
|
19474
|
-
border: "none",
|
|
19475
|
-
outline: "none",
|
|
19476
|
-
background: "transparent",
|
|
19477
|
-
fontSize: 12,
|
|
19478
|
-
lineHeight: "16px",
|
|
19479
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19480
|
-
color: "#1f2937"
|
|
19481
|
-
}
|
|
19482
|
-
}
|
|
19483
|
-
)
|
|
19484
|
-
]
|
|
20013
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
20014
|
+
setInvalid(true);
|
|
20015
|
+
return;
|
|
19485
20016
|
}
|
|
19486
|
-
|
|
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
|
+
] }) });
|
|
19487
20085
|
}
|
|
19488
20086
|
function MediaStripToolbar({
|
|
19489
20087
|
entry,
|
|
19490
20088
|
index,
|
|
19491
20089
|
pending,
|
|
19492
20090
|
error,
|
|
20091
|
+
itemEditOn,
|
|
20092
|
+
onToggleItemEdit,
|
|
19493
20093
|
onSetVariant,
|
|
19494
20094
|
onSetAlign,
|
|
19495
20095
|
onSetHover,
|
|
19496
20096
|
onSetTreatment,
|
|
19497
20097
|
onResize,
|
|
19498
|
-
|
|
19499
|
-
onSetLink,
|
|
20098
|
+
onOpenLink,
|
|
19500
20099
|
onAddItem,
|
|
19501
20100
|
onRemoveItem,
|
|
19502
20101
|
onChangeImage,
|
|
@@ -19505,81 +20104,102 @@ function MediaStripToolbar({
|
|
|
19505
20104
|
}) {
|
|
19506
20105
|
const items = mediaStripItems(entry.tree);
|
|
19507
20106
|
const itemCount = items.length;
|
|
19508
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19509
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19510
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19511
20107
|
const slots = findMediaStripSlots(entry.tree);
|
|
19512
20108
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19513
20109
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19514
20110
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19515
20111
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19516
20112
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19517
|
-
const
|
|
19518
|
-
const
|
|
19519
|
-
|
|
19520
|
-
gap: 6,
|
|
19521
|
-
flexWrap: "nowrap",
|
|
19522
|
-
justifyContent: "center",
|
|
19523
|
-
overflowX: "auto",
|
|
19524
|
-
WebkitOverflowScrolling: "touch",
|
|
19525
|
-
width: "100%",
|
|
19526
|
-
scrollbarWidth: "none"
|
|
19527
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19528
|
-
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(
|
|
19529
20116
|
"div",
|
|
19530
20117
|
{
|
|
19531
20118
|
"data-ohw-bridge": "",
|
|
19532
20119
|
"data-ohw-toolbar": "",
|
|
19533
20120
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
flexDirection: "column",
|
|
19537
|
-
gap: 6,
|
|
19538
|
-
alignItems: "center",
|
|
19539
|
-
background: OHW_BLUE,
|
|
19540
|
-
padding: 8,
|
|
19541
|
-
borderRadius: 12,
|
|
19542
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19543
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19544
|
-
opacity: pending ? 0.6 : 1,
|
|
19545
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19546
|
-
},
|
|
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 },
|
|
19547
20123
|
children: [
|
|
19548
|
-
/* @__PURE__ */
|
|
19549
|
-
|
|
19550
|
-
|
|
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
|
-
|
|
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 })
|
|
19580
20200
|
]
|
|
19581
20201
|
}
|
|
19582
|
-
);
|
|
20202
|
+
) });
|
|
19583
20203
|
}
|
|
19584
20204
|
function findMediaStripSlots(tree) {
|
|
19585
20205
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19598,31 +20218,23 @@ function AiMediaStripOverlay({
|
|
|
19598
20218
|
}) {
|
|
19599
20219
|
const [hover, setHover] = useState8(null);
|
|
19600
20220
|
const [active, setActive] = useState8(null);
|
|
20221
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
20222
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19601
20223
|
const [pending, setPending] = useState8(false);
|
|
19602
20224
|
const [error, setError] = useState8(null);
|
|
19603
20225
|
const activeRef = useRef5(null);
|
|
19604
20226
|
activeRef.current = active;
|
|
20227
|
+
const linkOpenRef = useRef5(false);
|
|
20228
|
+
linkOpenRef.current = linkOpen;
|
|
19605
20229
|
useEffect9(() => {
|
|
19606
20230
|
const onMove = (e) => {
|
|
20231
|
+
const ref = itemRefFromTarget(e.target);
|
|
19607
20232
|
const t = e.target;
|
|
19608
|
-
|
|
19609
|
-
|
|
19610
|
-
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
if (!itemEl) {
|
|
19614
|
-
setHover(null);
|
|
19615
|
-
return;
|
|
19616
|
-
}
|
|
19617
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19618
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19619
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19620
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19621
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19622
|
-
setHover(null);
|
|
19623
|
-
return;
|
|
19624
|
-
}
|
|
19625
|
-
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
|
+
});
|
|
19626
20238
|
};
|
|
19627
20239
|
const onLeave = () => setHover(null);
|
|
19628
20240
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19634,23 +20246,25 @@ function AiMediaStripOverlay({
|
|
|
19634
20246
|
}, []);
|
|
19635
20247
|
useEffect9(() => {
|
|
19636
20248
|
const onClick = (e) => {
|
|
19637
|
-
const current = activeRef.current;
|
|
19638
|
-
if (!current) return;
|
|
19639
20249
|
const t = e.target;
|
|
19640
|
-
if (!(t instanceof
|
|
19641
|
-
if (t.closest(
|
|
19642
|
-
const
|
|
19643
|
-
if (
|
|
19644
|
-
|
|
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);
|
|
19645
20256
|
setError(null);
|
|
20257
|
+
setActive(ref);
|
|
19646
20258
|
};
|
|
19647
20259
|
document.addEventListener("click", onClick, true);
|
|
19648
20260
|
return () => document.removeEventListener("click", onClick, true);
|
|
19649
|
-
}, []);
|
|
20261
|
+
}, [clearInteractionChromeRef]);
|
|
19650
20262
|
useEffect9(() => {
|
|
19651
20263
|
const onBlur = () => {
|
|
19652
20264
|
if (!activeRef.current) return;
|
|
19653
20265
|
setActive(null);
|
|
20266
|
+
setItemEditOn(false);
|
|
20267
|
+
setLinkOpen(false);
|
|
19654
20268
|
setError(null);
|
|
19655
20269
|
};
|
|
19656
20270
|
window.addEventListener("blur", onBlur);
|
|
@@ -19660,7 +20274,10 @@ function AiMediaStripOverlay({
|
|
|
19660
20274
|
const onKeyDown = (e) => {
|
|
19661
20275
|
if (e.key !== "Escape") return;
|
|
19662
20276
|
if (!activeRef.current) return;
|
|
20277
|
+
if (linkOpenRef.current) return;
|
|
20278
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19663
20279
|
setActive(null);
|
|
20280
|
+
setItemEditOn(false);
|
|
19664
20281
|
setError(null);
|
|
19665
20282
|
};
|
|
19666
20283
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19694,137 +20311,133 @@ function AiMediaStripOverlay({
|
|
|
19694
20311
|
tree: nextTree,
|
|
19695
20312
|
label: entry.label,
|
|
19696
20313
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19697
|
-
...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
|
|
19698
20318
|
});
|
|
19699
20319
|
return true;
|
|
19700
20320
|
},
|
|
19701
20321
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19702
20322
|
);
|
|
19703
20323
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19704
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19705
20324
|
const activeItemRect = useLiveItemRect(active);
|
|
19706
|
-
const
|
|
19707
|
-
const
|
|
19708
|
-
|
|
19709
|
-
|
|
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
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19741
|
-
ItemInteractionLayer,
|
|
19742
|
-
{
|
|
19743
|
-
rect: activeItemRect,
|
|
19744
|
-
state: toolbarState,
|
|
19745
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19746
|
-
MediaStripToolbar,
|
|
19747
|
-
{
|
|
19748
|
-
entry: activeEntry,
|
|
19749
|
-
index: active.index,
|
|
19750
|
-
pending,
|
|
19751
|
-
error,
|
|
19752
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19753
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19754
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19755
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19756
|
-
onResize: (delta) => {
|
|
19757
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19758
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19759
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19760
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19761
|
-
},
|
|
19762
|
-
onSetAlt: (alt) => {
|
|
19763
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19764
|
-
},
|
|
19765
|
-
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" };
|
|
19766
20359
|
void runMutation(
|
|
19767
20360
|
active.sectionId,
|
|
19768
|
-
(tree) =>
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19773
|
-
if (!picked) return;
|
|
19774
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19775
|
-
void runMutation(
|
|
19776
|
-
active.sectionId,
|
|
19777
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19778
|
-
{ [picked.assetId]: picked.url }
|
|
19779
|
-
).then((applied) => {
|
|
19780
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19781
|
-
});
|
|
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 });
|
|
19782
20365
|
});
|
|
19783
|
-
}
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19792
|
-
});
|
|
19793
|
-
},
|
|
19794
|
-
onRemoveItem: () => {
|
|
19795
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19796
|
-
(applied) => {
|
|
19797
|
-
if (applied) setActive(null);
|
|
19798
|
-
}
|
|
19799
|
-
);
|
|
19800
|
-
},
|
|
19801
|
-
onMoveLeft: () => {
|
|
19802
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19803
|
-
(applied) => {
|
|
19804
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19805
|
-
}
|
|
19806
|
-
);
|
|
19807
|
-
},
|
|
19808
|
-
onMoveRight: () => {
|
|
19809
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19810
|
-
(applied) => {
|
|
19811
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19812
|
-
}
|
|
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 }
|
|
19813
20375
|
);
|
|
19814
|
-
}
|
|
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
|
+
);
|
|
19815
20398
|
}
|
|
19816
|
-
|
|
19817
|
-
}
|
|
19818
|
-
|
|
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
|
+
] })
|
|
19819
20432
|
] });
|
|
19820
20433
|
}
|
|
19821
20434
|
|
|
19822
20435
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19823
|
-
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as
|
|
19824
|
-
import { Check as
|
|
19825
|
-
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";
|
|
19826
20439
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19827
|
-
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]";
|
|
19828
20441
|
function findPricingCardElement(sectionId, index) {
|
|
19829
20442
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19830
20443
|
if (!sectionEl2) return null;
|
|
@@ -19836,7 +20449,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19836
20449
|
}
|
|
19837
20450
|
function cardRefFromTarget(target) {
|
|
19838
20451
|
if (!(target instanceof Element)) return null;
|
|
19839
|
-
if (target.closest(
|
|
20452
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19840
20453
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19841
20454
|
if (!cardEl) return null;
|
|
19842
20455
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -19846,21 +20459,21 @@ function cardRefFromTarget(target) {
|
|
|
19846
20459
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19847
20460
|
return { sectionId, index };
|
|
19848
20461
|
}
|
|
19849
|
-
function
|
|
20462
|
+
function sameRef2(a, b) {
|
|
19850
20463
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19851
20464
|
}
|
|
19852
|
-
function
|
|
20465
|
+
function rectOf2(el) {
|
|
19853
20466
|
if (!el) return null;
|
|
19854
20467
|
const r2 = el.getBoundingClientRect();
|
|
19855
20468
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19856
20469
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19857
20470
|
}
|
|
19858
20471
|
function readRect3(ref) {
|
|
19859
|
-
return
|
|
20472
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19860
20473
|
}
|
|
19861
20474
|
function readGridRect(ref) {
|
|
19862
20475
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19863
|
-
return
|
|
20476
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19864
20477
|
}
|
|
19865
20478
|
function useLiveCardRect(ref, grid = false) {
|
|
19866
20479
|
const [rect, setRect] = useState9(null);
|
|
@@ -19890,19 +20503,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19890
20503
|
}
|
|
19891
20504
|
var TOOLBAR_GRID_GAP = 52;
|
|
19892
20505
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19893
|
-
var
|
|
20506
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19894
20507
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19895
20508
|
const slotRef = useRef6(null);
|
|
19896
20509
|
const [shift, setShift] = useState9(0);
|
|
19897
20510
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19898
|
-
|
|
20511
|
+
useLayoutEffect5(() => {
|
|
19899
20512
|
const slot = slotRef.current;
|
|
19900
20513
|
if (!slot) return;
|
|
19901
20514
|
const clamp = () => {
|
|
19902
20515
|
const w = slot.offsetWidth;
|
|
19903
20516
|
if (w <= 0) return;
|
|
19904
20517
|
const half = w / 2;
|
|
19905
|
-
const clamped = Math.max(
|
|
20518
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19906
20519
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19907
20520
|
};
|
|
19908
20521
|
clamp();
|
|
@@ -19911,7 +20524,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19911
20524
|
return () => ro.disconnect();
|
|
19912
20525
|
}, [centerX, children]);
|
|
19913
20526
|
const mobile = window.innerWidth <= 480;
|
|
19914
|
-
return /* @__PURE__ */
|
|
20527
|
+
return /* @__PURE__ */ jsx22(
|
|
19915
20528
|
"div",
|
|
19916
20529
|
{
|
|
19917
20530
|
ref: slotRef,
|
|
@@ -19946,7 +20559,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19946
20559
|
});
|
|
19947
20560
|
}
|
|
19948
20561
|
function StyleSwatch({ style }) {
|
|
19949
|
-
return /* @__PURE__ */
|
|
20562
|
+
return /* @__PURE__ */ jsx22(
|
|
19950
20563
|
"span",
|
|
19951
20564
|
{
|
|
19952
20565
|
"aria-hidden": true,
|
|
@@ -19960,35 +20573,35 @@ function StyleSwatch({ style }) {
|
|
|
19960
20573
|
);
|
|
19961
20574
|
}
|
|
19962
20575
|
function ButtonGlyph() {
|
|
19963
|
-
return /* @__PURE__ */
|
|
19964
|
-
/* @__PURE__ */
|
|
19965
|
-
/* @__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" })
|
|
19966
20579
|
] });
|
|
19967
20580
|
}
|
|
19968
20581
|
function FeatureGlyph({ mode }) {
|
|
19969
|
-
return /* @__PURE__ */
|
|
19970
|
-
/* @__PURE__ */
|
|
19971
|
-
/* @__PURE__ */
|
|
19972
|
-
/* @__PURE__ */
|
|
19973
|
-
/* @__PURE__ */
|
|
19974
|
-
/* @__PURE__ */
|
|
19975
|
-
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" })
|
|
19976
20589
|
] });
|
|
19977
20590
|
}
|
|
19978
|
-
function
|
|
20591
|
+
function ToolbarAction2({
|
|
19979
20592
|
label,
|
|
19980
20593
|
onClick,
|
|
19981
20594
|
disabled = false,
|
|
19982
20595
|
children
|
|
19983
20596
|
}) {
|
|
19984
|
-
const button = /* @__PURE__ */
|
|
19985
|
-
return /* @__PURE__ */
|
|
19986
|
-
/* @__PURE__ */
|
|
19987
|
-
/* @__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 })
|
|
19988
20601
|
] });
|
|
19989
20602
|
}
|
|
19990
|
-
function
|
|
19991
|
-
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" });
|
|
19992
20605
|
}
|
|
19993
20606
|
function CardStyleMenu({
|
|
19994
20607
|
value,
|
|
@@ -19996,7 +20609,7 @@ function CardStyleMenu({
|
|
|
19996
20609
|
disabled = false
|
|
19997
20610
|
}) {
|
|
19998
20611
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19999
|
-
const trigger = /* @__PURE__ */
|
|
20612
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
20000
20613
|
"button",
|
|
20001
20614
|
{
|
|
20002
20615
|
type: "button",
|
|
@@ -20007,28 +20620,28 @@ function CardStyleMenu({
|
|
|
20007
20620
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20008
20621
|
),
|
|
20009
20622
|
children: [
|
|
20010
|
-
/* @__PURE__ */
|
|
20011
|
-
/* @__PURE__ */
|
|
20012
|
-
/* @__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" } })
|
|
20013
20626
|
]
|
|
20014
20627
|
}
|
|
20015
20628
|
);
|
|
20016
20629
|
if (disabled) {
|
|
20017
|
-
return /* @__PURE__ */
|
|
20018
|
-
/* @__PURE__ */
|
|
20019
|
-
/* @__PURE__ */
|
|
20020
|
-
/* @__PURE__ */
|
|
20021
|
-
/* @__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" })
|
|
20022
20635
|
] })
|
|
20023
20636
|
] });
|
|
20024
20637
|
}
|
|
20025
|
-
return /* @__PURE__ */
|
|
20026
|
-
/* @__PURE__ */
|
|
20027
|
-
/* @__PURE__ */
|
|
20028
|
-
/* @__PURE__ */
|
|
20029
|
-
/* @__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) => {
|
|
20030
20643
|
const selected = style.value === value;
|
|
20031
|
-
return /* @__PURE__ */
|
|
20644
|
+
return /* @__PURE__ */ jsxs13(
|
|
20032
20645
|
DropdownMenuItem,
|
|
20033
20646
|
{
|
|
20034
20647
|
role: "menuitemradio",
|
|
@@ -20036,9 +20649,9 @@ function CardStyleMenu({
|
|
|
20036
20649
|
onSelect: () => onChange(style.value),
|
|
20037
20650
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20038
20651
|
children: [
|
|
20039
|
-
/* @__PURE__ */
|
|
20040
|
-
/* @__PURE__ */
|
|
20041
|
-
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" })
|
|
20042
20655
|
]
|
|
20043
20656
|
},
|
|
20044
20657
|
style.value
|
|
@@ -20068,7 +20681,7 @@ function PricingCardToolbar({
|
|
|
20068
20681
|
const style = pricingCardStyle(entry.tree, index);
|
|
20069
20682
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20070
20683
|
const mobile = window.innerWidth <= 480;
|
|
20071
|
-
return /* @__PURE__ */
|
|
20684
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
20072
20685
|
"div",
|
|
20073
20686
|
{
|
|
20074
20687
|
"data-ohw-bridge": "",
|
|
@@ -20080,7 +20693,7 @@ function PricingCardToolbar({
|
|
|
20080
20693
|
),
|
|
20081
20694
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20082
20695
|
children: [
|
|
20083
|
-
/* @__PURE__ */
|
|
20696
|
+
/* @__PURE__ */ jsxs13(
|
|
20084
20697
|
"div",
|
|
20085
20698
|
{
|
|
20086
20699
|
className: cn(
|
|
@@ -20089,8 +20702,8 @@ function PricingCardToolbar({
|
|
|
20089
20702
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20090
20703
|
),
|
|
20091
20704
|
children: [
|
|
20092
|
-
/* @__PURE__ */
|
|
20093
|
-
/* @__PURE__ */
|
|
20705
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20706
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
20094
20707
|
CustomToolbarButton,
|
|
20095
20708
|
{
|
|
20096
20709
|
type: "button",
|
|
@@ -20098,7 +20711,7 @@ function PricingCardToolbar({
|
|
|
20098
20711
|
"aria-pressed": featuredTag,
|
|
20099
20712
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20100
20713
|
className: "group size-8",
|
|
20101
|
-
children: /* @__PURE__ */
|
|
20714
|
+
children: /* @__PURE__ */ jsx22(
|
|
20102
20715
|
Star2,
|
|
20103
20716
|
{
|
|
20104
20717
|
size: 16,
|
|
@@ -20113,25 +20726,25 @@ function PricingCardToolbar({
|
|
|
20113
20726
|
)
|
|
20114
20727
|
}
|
|
20115
20728
|
) }),
|
|
20116
|
-
/* @__PURE__ */
|
|
20729
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20117
20730
|
] }),
|
|
20118
|
-
/* @__PURE__ */
|
|
20119
|
-
/* @__PURE__ */
|
|
20120
|
-
/* @__PURE__ */
|
|
20121
|
-
/* @__PURE__ */
|
|
20122
|
-
/* @__PURE__ */
|
|
20123
|
-
/* @__PURE__ */
|
|
20124
|
-
/* @__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" })
|
|
20125
20738
|
] }) }),
|
|
20126
|
-
/* @__PURE__ */
|
|
20127
|
-
/* @__PURE__ */
|
|
20128
|
-
/* @__PURE__ */
|
|
20129
|
-
/* @__PURE__ */
|
|
20130
|
-
/* @__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" } }) })
|
|
20131
20744
|
]
|
|
20132
20745
|
}
|
|
20133
20746
|
),
|
|
20134
|
-
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 })
|
|
20135
20748
|
]
|
|
20136
20749
|
}
|
|
20137
20750
|
) });
|
|
@@ -20165,7 +20778,7 @@ function AiPricingCardOverlay({
|
|
|
20165
20778
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20166
20779
|
setHover((prev) => {
|
|
20167
20780
|
const next = ref && !overEditable ? ref : null;
|
|
20168
|
-
return
|
|
20781
|
+
return sameRef2(prev, next) ? prev : next;
|
|
20169
20782
|
});
|
|
20170
20783
|
};
|
|
20171
20784
|
const onLeave = () => setHover(null);
|
|
@@ -20180,10 +20793,10 @@ function AiPricingCardOverlay({
|
|
|
20180
20793
|
const onClick = (e) => {
|
|
20181
20794
|
const t = e.target;
|
|
20182
20795
|
if (!(t instanceof Element)) return;
|
|
20183
|
-
if (t.closest(
|
|
20796
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
20184
20797
|
const ref = cardRefFromTarget(t);
|
|
20185
|
-
setActive((prev) =>
|
|
20186
|
-
if (!ref || !
|
|
20798
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20799
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
20187
20800
|
};
|
|
20188
20801
|
document.addEventListener("click", onClick, true);
|
|
20189
20802
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20248,12 +20861,12 @@ function AiPricingCardOverlay({
|
|
|
20248
20861
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20249
20862
|
const activeCardRect = useLiveCardRect(active);
|
|
20250
20863
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20251
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20252
|
-
return /* @__PURE__ */
|
|
20253
|
-
hoverRect && /* @__PURE__ */
|
|
20254
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
20255
|
-
/* @__PURE__ */
|
|
20256
|
-
/* @__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(
|
|
20257
20870
|
PricingCardToolbar,
|
|
20258
20871
|
{
|
|
20259
20872
|
entry: activeEntry,
|
|
@@ -20281,7 +20894,7 @@ function AiPricingCardOverlay({
|
|
|
20281
20894
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20282
20895
|
}
|
|
20283
20896
|
) }),
|
|
20284
|
-
/* @__PURE__ */
|
|
20897
|
+
/* @__PURE__ */ jsx22(
|
|
20285
20898
|
"div",
|
|
20286
20899
|
{
|
|
20287
20900
|
"data-ohw-bridge": "",
|
|
@@ -20345,39 +20958,11 @@ function clearVideo(tree, path) {
|
|
|
20345
20958
|
});
|
|
20346
20959
|
}
|
|
20347
20960
|
|
|
20348
|
-
// src/lib/youtube.ts
|
|
20349
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20350
|
-
function extractYouTubeId(input) {
|
|
20351
|
-
const trimmed = input.trim();
|
|
20352
|
-
if (!trimmed) return null;
|
|
20353
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20354
|
-
let url;
|
|
20355
|
-
try {
|
|
20356
|
-
url = new URL(trimmed);
|
|
20357
|
-
} catch {
|
|
20358
|
-
return null;
|
|
20359
|
-
}
|
|
20360
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20361
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20362
|
-
return null;
|
|
20363
|
-
}
|
|
20364
|
-
let candidate = null;
|
|
20365
|
-
if (host === "youtu.be") {
|
|
20366
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20367
|
-
} else if (url.pathname === "/watch") {
|
|
20368
|
-
candidate = url.searchParams.get("v");
|
|
20369
|
-
} else {
|
|
20370
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20371
|
-
candidate = match ? match[1] : null;
|
|
20372
|
-
}
|
|
20373
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20374
|
-
}
|
|
20375
|
-
|
|
20376
20961
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20377
|
-
import { Fragment as Fragment9, jsx as
|
|
20962
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20378
20963
|
var PRIMARY5 = "#0885FE";
|
|
20379
|
-
var
|
|
20380
|
-
var
|
|
20964
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20965
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20381
20966
|
function findVideoBlockElement(sectionId, path) {
|
|
20382
20967
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20383
20968
|
if (!sectionEl2) return null;
|
|
@@ -20437,12 +21022,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20437
21022
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20438
21023
|
});
|
|
20439
21024
|
}
|
|
20440
|
-
function
|
|
21025
|
+
function Pill({
|
|
20441
21026
|
label,
|
|
20442
21027
|
onClick,
|
|
20443
21028
|
disabled
|
|
20444
21029
|
}) {
|
|
20445
|
-
return /* @__PURE__ */
|
|
21030
|
+
return /* @__PURE__ */ jsx23(
|
|
20446
21031
|
"button",
|
|
20447
21032
|
{
|
|
20448
21033
|
type: "button",
|
|
@@ -20458,7 +21043,7 @@ function Pill2({
|
|
|
20458
21043
|
border: "none",
|
|
20459
21044
|
cursor: disabled ? "default" : "pointer",
|
|
20460
21045
|
background: "#ffffff",
|
|
20461
|
-
color:
|
|
21046
|
+
color: OHW_BLUE_DARK,
|
|
20462
21047
|
opacity: disabled ? 0.4 : 1,
|
|
20463
21048
|
fontSize: 12,
|
|
20464
21049
|
lineHeight: "16px",
|
|
@@ -20501,8 +21086,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20501
21086
|
onCommit(id);
|
|
20502
21087
|
}
|
|
20503
21088
|
};
|
|
20504
|
-
return /* @__PURE__ */
|
|
20505
|
-
/* @__PURE__ */
|
|
21089
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
21090
|
+
/* @__PURE__ */ jsxs14(
|
|
20506
21091
|
"div",
|
|
20507
21092
|
{
|
|
20508
21093
|
style: {
|
|
@@ -20518,12 +21103,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20518
21103
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20519
21104
|
},
|
|
20520
21105
|
children: [
|
|
20521
|
-
/* @__PURE__ */
|
|
21106
|
+
/* @__PURE__ */ jsx23(
|
|
20522
21107
|
"span",
|
|
20523
21108
|
{
|
|
20524
21109
|
style: {
|
|
20525
21110
|
flex: "0 0 auto",
|
|
20526
|
-
color:
|
|
21111
|
+
color: OHW_BLUE_DARK,
|
|
20527
21112
|
fontSize: 10,
|
|
20528
21113
|
lineHeight: "16px",
|
|
20529
21114
|
fontWeight: 700,
|
|
@@ -20533,7 +21118,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20533
21118
|
children: "Video"
|
|
20534
21119
|
}
|
|
20535
21120
|
),
|
|
20536
|
-
/* @__PURE__ */
|
|
21121
|
+
/* @__PURE__ */ jsx23(
|
|
20537
21122
|
"input",
|
|
20538
21123
|
{
|
|
20539
21124
|
type: "text",
|
|
@@ -20570,7 +21155,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20570
21155
|
]
|
|
20571
21156
|
}
|
|
20572
21157
|
),
|
|
20573
|
-
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." })
|
|
20574
21159
|
] });
|
|
20575
21160
|
}
|
|
20576
21161
|
function VideoToolbar({
|
|
@@ -20580,7 +21165,7 @@ function VideoToolbar({
|
|
|
20580
21165
|
onSetVideoId,
|
|
20581
21166
|
onRemove
|
|
20582
21167
|
}) {
|
|
20583
|
-
return /* @__PURE__ */
|
|
21168
|
+
return /* @__PURE__ */ jsxs14(
|
|
20584
21169
|
"div",
|
|
20585
21170
|
{
|
|
20586
21171
|
"data-ohw-bridge": "",
|
|
@@ -20592,7 +21177,7 @@ function VideoToolbar({
|
|
|
20592
21177
|
gap: 6,
|
|
20593
21178
|
alignItems: "center",
|
|
20594
21179
|
width: 280,
|
|
20595
|
-
background:
|
|
21180
|
+
background: OHW_BLUE,
|
|
20596
21181
|
padding: 8,
|
|
20597
21182
|
borderRadius: 12,
|
|
20598
21183
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20600,9 +21185,9 @@ function VideoToolbar({
|
|
|
20600
21185
|
opacity: pending ? 0.6 : 1
|
|
20601
21186
|
},
|
|
20602
21187
|
children: [
|
|
20603
|
-
/* @__PURE__ */
|
|
20604
|
-
/* @__PURE__ */
|
|
20605
|
-
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 })
|
|
20606
21191
|
]
|
|
20607
21192
|
}
|
|
20608
21193
|
);
|
|
@@ -20722,8 +21307,8 @@ function AiVideoOverlay({
|
|
|
20722
21307
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20723
21308
|
const TOOLBAR_APPROX_H = 90;
|
|
20724
21309
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20725
|
-
return /* @__PURE__ */
|
|
20726
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21310
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
21311
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20727
21312
|
"button",
|
|
20728
21313
|
{
|
|
20729
21314
|
type: "button",
|
|
@@ -20751,15 +21336,15 @@ function AiVideoOverlay({
|
|
|
20751
21336
|
fontSize: 14,
|
|
20752
21337
|
fontWeight: 700
|
|
20753
21338
|
},
|
|
20754
|
-
children: /* @__PURE__ */
|
|
21339
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20755
21340
|
}
|
|
20756
21341
|
),
|
|
20757
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
21342
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20758
21343
|
ItemInteractionLayer,
|
|
20759
21344
|
{
|
|
20760
21345
|
rect: activeBlockRect,
|
|
20761
21346
|
state: toolbarState,
|
|
20762
|
-
toolbar: /* @__PURE__ */
|
|
21347
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20763
21348
|
VideoToolbar,
|
|
20764
21349
|
{
|
|
20765
21350
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20834,10 +21419,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20834
21419
|
}
|
|
20835
21420
|
|
|
20836
21421
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20837
|
-
import { Fragment as Fragment10, jsx as
|
|
21422
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20838
21423
|
var PRIMARY6 = "#0885FE";
|
|
20839
|
-
var
|
|
20840
|
-
var
|
|
21424
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21425
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20841
21426
|
function findCarouselItemElement(sectionId, index) {
|
|
20842
21427
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20843
21428
|
if (!sectionEl2) return null;
|
|
@@ -20916,8 +21501,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20916
21501
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20917
21502
|
});
|
|
20918
21503
|
}
|
|
20919
|
-
function
|
|
20920
|
-
return /* @__PURE__ */
|
|
21504
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21505
|
+
return /* @__PURE__ */ jsx24(
|
|
20921
21506
|
"button",
|
|
20922
21507
|
{
|
|
20923
21508
|
type: "button",
|
|
@@ -20933,7 +21518,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20933
21518
|
border: "none",
|
|
20934
21519
|
cursor: disabled ? "default" : "pointer",
|
|
20935
21520
|
background: "#ffffff",
|
|
20936
|
-
color:
|
|
21521
|
+
color: OHW_BLUE_DARK2,
|
|
20937
21522
|
opacity: disabled ? 0.4 : 1,
|
|
20938
21523
|
fontSize: 12,
|
|
20939
21524
|
lineHeight: "16px",
|
|
@@ -20951,7 +21536,7 @@ function TogglePill({
|
|
|
20951
21536
|
onToggle,
|
|
20952
21537
|
disabled
|
|
20953
21538
|
}) {
|
|
20954
|
-
return /* @__PURE__ */
|
|
21539
|
+
return /* @__PURE__ */ jsxs15(
|
|
20955
21540
|
"button",
|
|
20956
21541
|
{
|
|
20957
21542
|
type: "button",
|
|
@@ -20970,7 +21555,7 @@ function TogglePill({
|
|
|
20970
21555
|
border: "none",
|
|
20971
21556
|
cursor: disabled ? "default" : "pointer",
|
|
20972
21557
|
background: "#ffffff",
|
|
20973
|
-
color:
|
|
21558
|
+
color: OHW_BLUE_DARK2,
|
|
20974
21559
|
opacity: disabled ? 0.4 : 1,
|
|
20975
21560
|
fontSize: 12,
|
|
20976
21561
|
lineHeight: "16px",
|
|
@@ -20980,7 +21565,7 @@ function TogglePill({
|
|
|
20980
21565
|
},
|
|
20981
21566
|
children: [
|
|
20982
21567
|
label,
|
|
20983
|
-
/* @__PURE__ */
|
|
21568
|
+
/* @__PURE__ */ jsx24(
|
|
20984
21569
|
"span",
|
|
20985
21570
|
{
|
|
20986
21571
|
"aria-hidden": true,
|
|
@@ -20993,10 +21578,10 @@ function TogglePill({
|
|
|
20993
21578
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20994
21579
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20995
21580
|
// "disabled control" rather than "switch that is off".
|
|
20996
|
-
background: on ?
|
|
21581
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20997
21582
|
transition: "background 120ms ease"
|
|
20998
21583
|
},
|
|
20999
|
-
children: /* @__PURE__ */
|
|
21584
|
+
children: /* @__PURE__ */ jsx24(
|
|
21000
21585
|
"span",
|
|
21001
21586
|
{
|
|
21002
21587
|
style: {
|
|
@@ -21025,7 +21610,7 @@ function CarouselSlideToolbar({
|
|
|
21025
21610
|
onChangeImage,
|
|
21026
21611
|
onToggleAutoplay
|
|
21027
21612
|
}) {
|
|
21028
|
-
return /* @__PURE__ */
|
|
21613
|
+
return /* @__PURE__ */ jsxs15(
|
|
21029
21614
|
"div",
|
|
21030
21615
|
{
|
|
21031
21616
|
"data-ohw-bridge": "",
|
|
@@ -21036,7 +21621,7 @@ function CarouselSlideToolbar({
|
|
|
21036
21621
|
flexDirection: "column",
|
|
21037
21622
|
gap: 6,
|
|
21038
21623
|
alignItems: "center",
|
|
21039
|
-
background:
|
|
21624
|
+
background: OHW_BLUE2,
|
|
21040
21625
|
padding: 8,
|
|
21041
21626
|
borderRadius: 12,
|
|
21042
21627
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21048,11 +21633,11 @@ function CarouselSlideToolbar({
|
|
|
21048
21633
|
pointerEvents: pending ? "none" : "auto"
|
|
21049
21634
|
},
|
|
21050
21635
|
children: [
|
|
21051
|
-
/* @__PURE__ */
|
|
21052
|
-
/* @__PURE__ */
|
|
21053
|
-
/* @__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 })
|
|
21054
21639
|
] }),
|
|
21055
|
-
error && /* @__PURE__ */
|
|
21640
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21056
21641
|
]
|
|
21057
21642
|
}
|
|
21058
21643
|
);
|
|
@@ -21192,8 +21777,8 @@ function AiFadeCarouselOverlay({
|
|
|
21192
21777
|
const activeItemRect = useLiveItemRect2(active);
|
|
21193
21778
|
const TOOLBAR_APPROX_H = 90;
|
|
21194
21779
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21195
|
-
return /* @__PURE__ */
|
|
21196
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21780
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21781
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
21197
21782
|
"button",
|
|
21198
21783
|
{
|
|
21199
21784
|
type: "button",
|
|
@@ -21222,10 +21807,10 @@ function AiFadeCarouselOverlay({
|
|
|
21222
21807
|
fontSize: 14,
|
|
21223
21808
|
fontWeight: 700
|
|
21224
21809
|
},
|
|
21225
|
-
children: /* @__PURE__ */
|
|
21810
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
21226
21811
|
}
|
|
21227
21812
|
),
|
|
21228
|
-
swapping && /* @__PURE__ */
|
|
21813
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
21229
21814
|
"div",
|
|
21230
21815
|
{
|
|
21231
21816
|
ref: skeletonRef,
|
|
@@ -21243,15 +21828,15 @@ function AiFadeCarouselOverlay({
|
|
|
21243
21828
|
zIndex: 2147483646,
|
|
21244
21829
|
pointerEvents: "none"
|
|
21245
21830
|
},
|
|
21246
|
-
children: /* @__PURE__ */
|
|
21831
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
21247
21832
|
}
|
|
21248
21833
|
),
|
|
21249
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21834
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
21250
21835
|
ItemInteractionLayer,
|
|
21251
21836
|
{
|
|
21252
21837
|
rect: activeItemRect,
|
|
21253
21838
|
state: toolbarState,
|
|
21254
|
-
toolbar: /* @__PURE__ */
|
|
21839
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
21255
21840
|
CarouselSlideToolbar,
|
|
21256
21841
|
{
|
|
21257
21842
|
pending,
|
|
@@ -21442,118 +22027,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21442
22027
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21443
22028
|
import { useEffect as useEffect16 } from "react";
|
|
21444
22029
|
|
|
21445
|
-
// src/ui/dialog.tsx
|
|
21446
|
-
import * as React9 from "react";
|
|
21447
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21448
|
-
import { X as X2 } from "lucide-react";
|
|
21449
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21450
|
-
function Dialog2({
|
|
21451
|
-
...props
|
|
21452
|
-
}) {
|
|
21453
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21454
|
-
}
|
|
21455
|
-
function DialogPortal({
|
|
21456
|
-
...props
|
|
21457
|
-
}) {
|
|
21458
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21459
|
-
}
|
|
21460
|
-
function DialogOverlay({
|
|
21461
|
-
className,
|
|
21462
|
-
...props
|
|
21463
|
-
}) {
|
|
21464
|
-
return /* @__PURE__ */ jsx24(
|
|
21465
|
-
DialogPrimitive.Overlay,
|
|
21466
|
-
{
|
|
21467
|
-
"data-slot": "dialog-overlay",
|
|
21468
|
-
"data-ohw-link-modal-root": "",
|
|
21469
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21470
|
-
...props
|
|
21471
|
-
}
|
|
21472
|
-
);
|
|
21473
|
-
}
|
|
21474
|
-
var DialogContent = React9.forwardRef(
|
|
21475
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21476
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21477
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21478
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21479
|
-
/* @__PURE__ */ jsxs15(
|
|
21480
|
-
DialogPrimitive.Content,
|
|
21481
|
-
{
|
|
21482
|
-
ref,
|
|
21483
|
-
"data-slot": "dialog-content",
|
|
21484
|
-
className: cn(
|
|
21485
|
-
positionMode,
|
|
21486
|
-
"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",
|
|
21487
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21488
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21489
|
-
className
|
|
21490
|
-
),
|
|
21491
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21492
|
-
...props,
|
|
21493
|
-
children: [
|
|
21494
|
-
children,
|
|
21495
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21496
|
-
DialogPrimitive.Close,
|
|
21497
|
-
{
|
|
21498
|
-
type: "button",
|
|
21499
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21500
|
-
"aria-label": "Close",
|
|
21501
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21502
|
-
}
|
|
21503
|
-
) : null
|
|
21504
|
-
]
|
|
21505
|
-
}
|
|
21506
|
-
)
|
|
21507
|
-
] });
|
|
21508
|
-
}
|
|
21509
|
-
);
|
|
21510
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21511
|
-
function DialogHeader({
|
|
21512
|
-
className,
|
|
21513
|
-
...props
|
|
21514
|
-
}) {
|
|
21515
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21516
|
-
}
|
|
21517
|
-
function DialogFooter({
|
|
21518
|
-
className,
|
|
21519
|
-
...props
|
|
21520
|
-
}) {
|
|
21521
|
-
return /* @__PURE__ */ jsx24(
|
|
21522
|
-
"div",
|
|
21523
|
-
{
|
|
21524
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21525
|
-
...props
|
|
21526
|
-
}
|
|
21527
|
-
);
|
|
21528
|
-
}
|
|
21529
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21530
|
-
DialogPrimitive.Title,
|
|
21531
|
-
{
|
|
21532
|
-
ref,
|
|
21533
|
-
className: cn(
|
|
21534
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21535
|
-
className
|
|
21536
|
-
),
|
|
21537
|
-
...props
|
|
21538
|
-
}
|
|
21539
|
-
));
|
|
21540
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21541
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21542
|
-
DialogPrimitive.Description,
|
|
21543
|
-
{
|
|
21544
|
-
ref,
|
|
21545
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21546
|
-
...props
|
|
21547
|
-
}
|
|
21548
|
-
));
|
|
21549
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21550
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21551
|
-
|
|
21552
22030
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21553
22031
|
import { Info, X as X4 } from "lucide-react";
|
|
21554
22032
|
|
|
21555
22033
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21556
|
-
import { ArrowRight as
|
|
22034
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21557
22035
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21558
22036
|
function DestinationBreadcrumb({
|
|
21559
22037
|
pageTitle,
|
|
@@ -21567,7 +22045,7 @@ function DestinationBreadcrumb({
|
|
|
21567
22045
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21568
22046
|
] }),
|
|
21569
22047
|
/* @__PURE__ */ jsx25(
|
|
21570
|
-
|
|
22048
|
+
ArrowRight3,
|
|
21571
22049
|
{
|
|
21572
22050
|
size: 16,
|
|
21573
22051
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21679,7 +22157,7 @@ function Label({ className, ...props }) {
|
|
|
21679
22157
|
}
|
|
21680
22158
|
|
|
21681
22159
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21682
|
-
import { ChevronDown as
|
|
22160
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21683
22161
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21684
22162
|
function FieldChevron({
|
|
21685
22163
|
onClick
|
|
@@ -21692,7 +22170,7 @@ function FieldChevron({
|
|
|
21692
22170
|
onClick,
|
|
21693
22171
|
"aria-label": "Open page list",
|
|
21694
22172
|
tabIndex: -1,
|
|
21695
|
-
children: /* @__PURE__ */ jsx29(
|
|
22173
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21696
22174
|
}
|
|
21697
22175
|
);
|
|
21698
22176
|
}
|
|
@@ -21922,7 +22400,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21922
22400
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21923
22401
|
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21924
22402
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21925
|
-
import { ArrowLeft as
|
|
22403
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21926
22404
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21927
22405
|
|
|
21928
22406
|
// src/lib/parent-scroll.ts
|
|
@@ -22199,7 +22677,7 @@ function SectionPickerOverlay({
|
|
|
22199
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",
|
|
22200
22678
|
onClick: onBack,
|
|
22201
22679
|
children: [
|
|
22202
|
-
/* @__PURE__ */ jsx31(
|
|
22680
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
22203
22681
|
"Back"
|
|
22204
22682
|
]
|
|
22205
22683
|
}
|
|
@@ -22268,7 +22746,7 @@ function SectionPickerOverlay({
|
|
|
22268
22746
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22269
22747
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22270
22748
|
"aria-hidden": true,
|
|
22271
|
-
children: /* @__PURE__ */ jsx31(
|
|
22749
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22272
22750
|
}
|
|
22273
22751
|
) : null
|
|
22274
22752
|
]
|
|
@@ -22652,6 +23130,7 @@ function shouldUseDevFixtures() {
|
|
|
22652
23130
|
function getLogoElement(el) {
|
|
22653
23131
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22654
23132
|
if (marked) return marked;
|
|
23133
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22655
23134
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22656
23135
|
if (!root) return null;
|
|
22657
23136
|
const anchor = el.closest("a");
|
|
@@ -22721,7 +23200,7 @@ function addFooterColumnWithPersist({
|
|
|
22721
23200
|
import {
|
|
22722
23201
|
useCallback as useCallback9,
|
|
22723
23202
|
useEffect as useEffect17,
|
|
22724
|
-
useLayoutEffect as
|
|
23203
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22725
23204
|
useRef as useRef11,
|
|
22726
23205
|
useState as useState15
|
|
22727
23206
|
} from "react";
|
|
@@ -22818,7 +23297,7 @@ function FloatingPanel({
|
|
|
22818
23297
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22819
23298
|
}, [open]);
|
|
22820
23299
|
const positionRef = useRef11(position);
|
|
22821
|
-
|
|
23300
|
+
useLayoutEffect6(() => {
|
|
22822
23301
|
if (!open) {
|
|
22823
23302
|
positionRef.current = position;
|
|
22824
23303
|
return;
|
|
@@ -22828,7 +23307,7 @@ function FloatingPanel({
|
|
|
22828
23307
|
}
|
|
22829
23308
|
positionRef.current = position;
|
|
22830
23309
|
}, [open, position, liveScroll, parentScroll]);
|
|
22831
|
-
|
|
23310
|
+
useLayoutEffect6(() => {
|
|
22832
23311
|
if (!open || !panelRef.current) return;
|
|
22833
23312
|
const el = panelRef.current;
|
|
22834
23313
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -23037,7 +23516,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
23037
23516
|
}
|
|
23038
23517
|
|
|
23039
23518
|
// src/ui/button-style-panel.tsx
|
|
23040
|
-
import { Check as
|
|
23519
|
+
import { Check as Check5 } from "lucide-react";
|
|
23041
23520
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
23042
23521
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
23043
23522
|
function ButtonStylePanel({
|
|
@@ -23108,7 +23587,7 @@ function ButtonStylePanel({
|
|
|
23108
23587
|
{
|
|
23109
23588
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
23110
23589
|
"aria-hidden": true,
|
|
23111
|
-
children: /* @__PURE__ */ jsx35(
|
|
23590
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
23112
23591
|
}
|
|
23113
23592
|
) : null
|
|
23114
23593
|
]
|
|
@@ -24140,7 +24619,7 @@ function useSectionDrag({
|
|
|
24140
24619
|
}
|
|
24141
24620
|
|
|
24142
24621
|
// src/ui/footer-container-chrome.tsx
|
|
24143
|
-
import { Plus as
|
|
24622
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
24144
24623
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
24145
24624
|
function FooterContainerChrome({
|
|
24146
24625
|
rect,
|
|
@@ -24181,7 +24660,7 @@ function FooterContainerChrome({
|
|
|
24181
24660
|
if (addDisabled) return;
|
|
24182
24661
|
onAdd();
|
|
24183
24662
|
},
|
|
24184
|
-
children: /* @__PURE__ */ jsx36(
|
|
24663
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24185
24664
|
}
|
|
24186
24665
|
) }),
|
|
24187
24666
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24588,7 +25067,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24588
25067
|
}
|
|
24589
25068
|
|
|
24590
25069
|
// src/ui/navbar-container-chrome.tsx
|
|
24591
|
-
import { Plus as
|
|
25070
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24592
25071
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24593
25072
|
function NavbarContainerChrome({
|
|
24594
25073
|
rect,
|
|
@@ -24624,7 +25103,7 @@ function NavbarContainerChrome({
|
|
|
24624
25103
|
e.stopPropagation();
|
|
24625
25104
|
onAdd();
|
|
24626
25105
|
},
|
|
24627
|
-
children: /* @__PURE__ */ jsx37(
|
|
25106
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24628
25107
|
}
|
|
24629
25108
|
)
|
|
24630
25109
|
}
|
|
@@ -24696,7 +25175,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24696
25175
|
}
|
|
24697
25176
|
|
|
24698
25177
|
// src/OhhwellsBridge.tsx
|
|
24699
|
-
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";
|
|
24700
25179
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24701
25180
|
var PRIMARY7 = "#0885FE";
|
|
24702
25181
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25474,7 +25953,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25474
25953
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25475
25954
|
return resolveFooterLinksContainerFrom(el);
|
|
25476
25955
|
}
|
|
25477
|
-
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)) {
|
|
25478
25957
|
return getNavigationRoot(el);
|
|
25479
25958
|
}
|
|
25480
25959
|
return null;
|
|
@@ -25696,7 +26175,6 @@ var ICONS = {
|
|
|
25696
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"/>',
|
|
25697
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"/>'
|
|
25698
26177
|
};
|
|
25699
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25700
26178
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25701
26179
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25702
26180
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25794,7 +26272,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25794
26272
|
el.style.top = `${top}px`;
|
|
25795
26273
|
el.style.height = `${height}px`;
|
|
25796
26274
|
}
|
|
25797
|
-
var
|
|
26275
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25798
26276
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25799
26277
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25800
26278
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25821,8 +26299,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25821
26299
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25822
26300
|
const half = toolbarWidth / 2;
|
|
25823
26301
|
return Math.max(
|
|
25824
|
-
|
|
25825
|
-
Math.min(centerX, window.innerWidth -
|
|
26302
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
26303
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25826
26304
|
);
|
|
25827
26305
|
}
|
|
25828
26306
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25944,7 +26422,10 @@ function FloatingToolbar({
|
|
|
25944
26422
|
onCommand,
|
|
25945
26423
|
activeCommands,
|
|
25946
26424
|
showEditLink,
|
|
25947
|
-
onEditLink
|
|
26425
|
+
onEditLink,
|
|
26426
|
+
showDelete,
|
|
26427
|
+
onDelete,
|
|
26428
|
+
deleteDisabled
|
|
25948
26429
|
}) {
|
|
25949
26430
|
const localRef = React12.useRef(null);
|
|
25950
26431
|
const [measuredW, setMeasuredW] = React12.useState(330);
|
|
@@ -25971,7 +26452,7 @@ function FloatingToolbar({
|
|
|
25971
26452
|
const ro = new ResizeObserver(update);
|
|
25972
26453
|
ro.observe(node);
|
|
25973
26454
|
return () => ro.disconnect();
|
|
25974
|
-
}, [showEditLink, activeCommands]);
|
|
26455
|
+
}, [showEditLink, showDelete, activeCommands]);
|
|
25975
26456
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
25976
26457
|
return /* @__PURE__ */ jsx40(
|
|
25977
26458
|
"div",
|
|
@@ -26036,7 +26517,28 @@ function FloatingToolbar({
|
|
|
26036
26517
|
},
|
|
26037
26518
|
children: /* @__PURE__ */ jsx40(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
26038
26519
|
}
|
|
26039
|
-
) : 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
|
|
26040
26542
|
] })
|
|
26041
26543
|
}
|
|
26042
26544
|
);
|
|
@@ -26223,7 +26725,7 @@ function OhhwellsBridge() {
|
|
|
26223
26725
|
}, []);
|
|
26224
26726
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
26225
26727
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
26226
|
-
|
|
26728
|
+
useLayoutEffect7(() => {
|
|
26227
26729
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
26228
26730
|
if (next !== subdomain) setSubdomain(next);
|
|
26229
26731
|
if (next) return;
|
|
@@ -26650,6 +27152,8 @@ function OhhwellsBridge() {
|
|
|
26650
27152
|
const [activeCommands, setActiveCommands] = useState18(/* @__PURE__ */ new Set());
|
|
26651
27153
|
const [sectionGap, setSectionGap] = useState18(null);
|
|
26652
27154
|
const [toolbarShowEditLink, setToolbarShowEditLink] = useState18(false);
|
|
27155
|
+
const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = useState18(false);
|
|
27156
|
+
const deletingAiBlockRef = useRef14(false);
|
|
26653
27157
|
const hoveredNavContainerRef = useRef14(null);
|
|
26654
27158
|
const [hoveredNavContainerRect, setHoveredNavContainerRect] = useState18(null);
|
|
26655
27159
|
const hoveredItemElRef = useRef14(null);
|
|
@@ -26705,21 +27209,6 @@ function OhhwellsBridge() {
|
|
|
26705
27209
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26706
27210
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26707
27211
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26708
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26709
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26710
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26711
|
-
const floatingPanelRef = useRef14(null);
|
|
26712
|
-
floatingPanelRef.current = floatingPanel;
|
|
26713
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26714
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26715
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26716
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26717
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26718
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26719
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26720
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26721
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26722
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26723
27212
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26724
27213
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26725
27214
|
const footerDragRef = useRef14(null);
|
|
@@ -26746,6 +27235,21 @@ function OhhwellsBridge() {
|
|
|
26746
27235
|
const stylesRef = useRef14("");
|
|
26747
27236
|
const appliedDrawerRef = useRef14(null);
|
|
26748
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);
|
|
26749
27253
|
const [sitePages, setSitePages] = useState18([]);
|
|
26750
27254
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26751
27255
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26755,7 +27259,18 @@ function OhhwellsBridge() {
|
|
|
26755
27259
|
const linkPopoverOpenRef = useRef14(false);
|
|
26756
27260
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26757
27261
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27262
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26758
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
|
+
}, []);
|
|
26759
27274
|
useEffect21(() => {
|
|
26760
27275
|
setSectionOrderPersistHandler((entries) => {
|
|
26761
27276
|
const currentPath = window.location.pathname;
|
|
@@ -27062,6 +27577,7 @@ function OhhwellsBridge() {
|
|
|
27062
27577
|
setMaxBadge(null);
|
|
27063
27578
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27064
27579
|
setToolbarShowEditLink(false);
|
|
27580
|
+
setToolbarShowAiBlockDelete(false);
|
|
27065
27581
|
postToParent2({ type: "ow:exit-edit" });
|
|
27066
27582
|
}, [postToParent2]);
|
|
27067
27583
|
const clearSelectedAttr = useCallback12(() => {
|
|
@@ -27232,6 +27748,7 @@ function OhhwellsBridge() {
|
|
|
27232
27748
|
setMaxBadge(null);
|
|
27233
27749
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
27234
27750
|
setToolbarShowEditLink(false);
|
|
27751
|
+
setToolbarShowAiBlockDelete(false);
|
|
27235
27752
|
postToParent2({ type: "ow:exit-edit" });
|
|
27236
27753
|
reselectNavigationItem(navAnchor);
|
|
27237
27754
|
}, [postToParent2, reselectNavigationItem]);
|
|
@@ -28402,6 +28919,13 @@ function OhhwellsBridge() {
|
|
|
28402
28919
|
}
|
|
28403
28920
|
}
|
|
28404
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
|
+
);
|
|
28405
28929
|
const navAnchor = getNavigationItemAnchor(el);
|
|
28406
28930
|
if (navAnchor) {
|
|
28407
28931
|
if (isNestedNavChild(navAnchor)) {
|
|
@@ -28462,7 +28986,7 @@ function OhhwellsBridge() {
|
|
|
28462
28986
|
isFooterFrameSelection,
|
|
28463
28987
|
postToParent2
|
|
28464
28988
|
]);
|
|
28465
|
-
|
|
28989
|
+
useLayoutEffect7(() => {
|
|
28466
28990
|
if (!subdomain || isEditMode) {
|
|
28467
28991
|
setFetchState("done");
|
|
28468
28992
|
return;
|
|
@@ -28489,6 +29013,7 @@ function OhhwellsBridge() {
|
|
|
28489
29013
|
applyAiFooterFromContent(content);
|
|
28490
29014
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28491
29015
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
29016
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28492
29017
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28493
29018
|
}
|
|
28494
29019
|
applyBrandChrome(content);
|
|
@@ -28499,15 +29024,16 @@ function OhhwellsBridge() {
|
|
|
28499
29024
|
if (key === "__ohw_sections") continue;
|
|
28500
29025
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28501
29026
|
if (key === AI_FOOTER_KEY) continue;
|
|
29027
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29028
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28502
29029
|
if (key === BRAND_KIT_KEY) continue;
|
|
28503
29030
|
if (key === STYLE_STORE_KEY) continue;
|
|
28504
29031
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28505
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28506
29032
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28507
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28508
29033
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28509
29034
|
continue;
|
|
28510
29035
|
}
|
|
29036
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28511
29037
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28512
29038
|
if (applyCarouselNode(key, val)) continue;
|
|
28513
29039
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28547,6 +29073,7 @@ function OhhwellsBridge() {
|
|
|
28547
29073
|
});
|
|
28548
29074
|
applyLinkByKey(key, val);
|
|
28549
29075
|
}
|
|
29076
|
+
applySectionEmbeds(content);
|
|
28550
29077
|
applyLogoFromContent(content);
|
|
28551
29078
|
applyLogoSizes(content);
|
|
28552
29079
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28555,6 +29082,7 @@ function OhhwellsBridge() {
|
|
|
28555
29082
|
applySocialsDisplayFromContent(content);
|
|
28556
29083
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28557
29084
|
syncButtonsFromContent(document, content);
|
|
29085
|
+
applyHiddenEditablesToDom(content);
|
|
28558
29086
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28559
29087
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28560
29088
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -28735,20 +29263,22 @@ function OhhwellsBridge() {
|
|
|
28735
29263
|
}
|
|
28736
29264
|
applyAiFooterFromContent(content);
|
|
28737
29265
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
29266
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28738
29267
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28739
29268
|
}
|
|
28740
29269
|
for (const [key, val] of Object.entries(content)) {
|
|
28741
29270
|
if (key === "__ohw_sections") continue;
|
|
28742
29271
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28743
29272
|
if (key === AI_FOOTER_KEY) continue;
|
|
29273
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29274
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28744
29275
|
if (key === BRAND_KIT_KEY) continue;
|
|
28745
29276
|
if (key === STYLE_STORE_KEY) continue;
|
|
28746
29277
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28747
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28748
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28749
29278
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28750
29279
|
continue;
|
|
28751
29280
|
}
|
|
29281
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28752
29282
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28753
29283
|
if (applyCarouselNode(key, val)) continue;
|
|
28754
29284
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28773,6 +29303,7 @@ function OhhwellsBridge() {
|
|
|
28773
29303
|
});
|
|
28774
29304
|
applyLinkByKey(key, val);
|
|
28775
29305
|
}
|
|
29306
|
+
applySectionEmbeds(content);
|
|
28776
29307
|
applyLogoFromContent(content);
|
|
28777
29308
|
reconcileNavbarItemsFromContent(content);
|
|
28778
29309
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28780,6 +29311,7 @@ function OhhwellsBridge() {
|
|
|
28780
29311
|
applySocialsDisplayFromContent(content);
|
|
28781
29312
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28782
29313
|
syncButtonsFromContent(document, content);
|
|
29314
|
+
applyHiddenEditablesToDom(content);
|
|
28783
29315
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28784
29316
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28785
29317
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
@@ -28828,7 +29360,7 @@ function OhhwellsBridge() {
|
|
|
28828
29360
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28829
29361
|
};
|
|
28830
29362
|
}, [subdomain, isEditMode, pathname]);
|
|
28831
|
-
|
|
29363
|
+
useLayoutEffect7(() => {
|
|
28832
29364
|
const el = document.getElementById("ohw-loader");
|
|
28833
29365
|
if (!el) return;
|
|
28834
29366
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
@@ -28918,6 +29450,7 @@ function OhhwellsBridge() {
|
|
|
28918
29450
|
applySocialsDisplayFromContent(content);
|
|
28919
29451
|
applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
|
|
28920
29452
|
syncButtonsFromContent(document, content);
|
|
29453
|
+
applyHiddenEditablesToDom(content);
|
|
28921
29454
|
if (isEditModeRef.current) requestMissingSocialIconsRef.current();
|
|
28922
29455
|
document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
|
|
28923
29456
|
if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
|
|
@@ -29012,26 +29545,11 @@ function OhhwellsBridge() {
|
|
|
29012
29545
|
const t2 = setTimeout(measure, 500);
|
|
29013
29546
|
const ro = new ResizeObserver(schedule);
|
|
29014
29547
|
ro.observe(document.body);
|
|
29015
|
-
let lastWidth = window.innerWidth;
|
|
29016
|
-
let resizeTimers = [];
|
|
29017
|
-
const clearResizeTimers = () => {
|
|
29018
|
-
resizeTimers.forEach(clearTimeout);
|
|
29019
|
-
resizeTimers = [];
|
|
29020
|
-
};
|
|
29021
|
-
const handleResize = () => {
|
|
29022
|
-
if (window.innerWidth === lastWidth) return;
|
|
29023
|
-
lastWidth = window.innerWidth;
|
|
29024
|
-
clearResizeTimers();
|
|
29025
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29026
|
-
};
|
|
29027
|
-
window.addEventListener("resize", handleResize);
|
|
29028
29548
|
return () => {
|
|
29029
29549
|
clearTimeout(t1);
|
|
29030
29550
|
clearTimeout(t2);
|
|
29031
29551
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29032
29552
|
ro.disconnect();
|
|
29033
|
-
clearResizeTimers();
|
|
29034
|
-
window.removeEventListener("resize", handleResize);
|
|
29035
29553
|
};
|
|
29036
29554
|
}, [pathname, isEditMode, postToParent2]);
|
|
29037
29555
|
useEffect21(() => {
|
|
@@ -29328,6 +29846,13 @@ function OhhwellsBridge() {
|
|
|
29328
29846
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29329
29847
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29330
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
|
+
}
|
|
29331
29856
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29332
29857
|
clearMediaSelectionRef.current();
|
|
29333
29858
|
}
|
|
@@ -29351,8 +29876,6 @@ function OhhwellsBridge() {
|
|
|
29351
29876
|
return;
|
|
29352
29877
|
}
|
|
29353
29878
|
}
|
|
29354
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29355
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29356
29879
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29357
29880
|
if (collectionItem) {
|
|
29358
29881
|
e.preventDefault();
|
|
@@ -29364,11 +29887,6 @@ function OhhwellsBridge() {
|
|
|
29364
29887
|
});
|
|
29365
29888
|
return;
|
|
29366
29889
|
}
|
|
29367
|
-
if (target.closest(
|
|
29368
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29369
|
-
)) {
|
|
29370
|
-
return;
|
|
29371
|
-
}
|
|
29372
29890
|
{
|
|
29373
29891
|
const formEl = getFormElement(target);
|
|
29374
29892
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29522,9 +30040,13 @@ function OhhwellsBridge() {
|
|
|
29522
30040
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29523
30041
|
e.preventDefault();
|
|
29524
30042
|
e.stopPropagation();
|
|
29525
|
-
selectIconElementRef.current(editable);
|
|
29526
30043
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29527
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
|
+
}
|
|
29528
30050
|
postToParentRef.current({
|
|
29529
30051
|
type: "ow:icon-pick",
|
|
29530
30052
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29752,6 +30274,9 @@ function OhhwellsBridge() {
|
|
|
29752
30274
|
setHoveredItemRect(null);
|
|
29753
30275
|
hoveredNavContainerRef.current = null;
|
|
29754
30276
|
setHoveredNavContainerRect(null);
|
|
30277
|
+
siblingHintElRef.current = null;
|
|
30278
|
+
setSiblingHintRect(null);
|
|
30279
|
+
setSiblingHintRects([]);
|
|
29755
30280
|
return;
|
|
29756
30281
|
}
|
|
29757
30282
|
{
|
|
@@ -29872,7 +30397,6 @@ function OhhwellsBridge() {
|
|
|
29872
30397
|
hoveredNavContainerRef.current = null;
|
|
29873
30398
|
setHoveredNavContainerRect(null);
|
|
29874
30399
|
hoveredItemElRef.current = editable;
|
|
29875
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29876
30400
|
}
|
|
29877
30401
|
}
|
|
29878
30402
|
}
|
|
@@ -30582,7 +31106,11 @@ function OhhwellsBridge() {
|
|
|
30582
31106
|
};
|
|
30583
31107
|
const handleMouseMove = (e) => {
|
|
30584
31108
|
const { clientX, clientY } = e;
|
|
30585
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31109
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31110
|
+
dismissImageHover();
|
|
31111
|
+
clearImageHover();
|
|
31112
|
+
return;
|
|
31113
|
+
}
|
|
30586
31114
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30587
31115
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30588
31116
|
formHoverElRef.current = null;
|
|
@@ -30611,7 +31139,12 @@ function OhhwellsBridge() {
|
|
|
30611
31139
|
setHoveredItemRect(null);
|
|
30612
31140
|
hoveredNavContainerRef.current = null;
|
|
30613
31141
|
setHoveredNavContainerRect(null);
|
|
31142
|
+
siblingHintElRef.current = null;
|
|
31143
|
+
setSiblingHintRect(null);
|
|
31144
|
+
setSiblingHintRects([]);
|
|
30614
31145
|
dismissImageHover();
|
|
31146
|
+
clearImageHover();
|
|
31147
|
+
setSectionGap(null);
|
|
30615
31148
|
return;
|
|
30616
31149
|
}
|
|
30617
31150
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30623,7 +31156,11 @@ function OhhwellsBridge() {
|
|
|
30623
31156
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30624
31157
|
const { clientX, clientY } = e.data;
|
|
30625
31158
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30626
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
31159
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
31160
|
+
dismissImageHover();
|
|
31161
|
+
clearImageHover();
|
|
31162
|
+
return;
|
|
31163
|
+
}
|
|
30627
31164
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30628
31165
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30629
31166
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -31003,6 +31540,7 @@ function OhhwellsBridge() {
|
|
|
31003
31540
|
applyAiFooterFromContent(content);
|
|
31004
31541
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31005
31542
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31543
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31006
31544
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31007
31545
|
}
|
|
31008
31546
|
applyBrandChrome(content);
|
|
@@ -31017,15 +31555,16 @@ function OhhwellsBridge() {
|
|
|
31017
31555
|
}
|
|
31018
31556
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31019
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;
|
|
31020
31560
|
if (key === BRAND_KIT_KEY) continue;
|
|
31021
31561
|
if (key === STYLE_STORE_KEY) continue;
|
|
31022
31562
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31023
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31024
31563
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31025
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31026
31564
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31027
31565
|
continue;
|
|
31028
31566
|
}
|
|
31567
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31029
31568
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31030
31569
|
if (applyCarouselNode(key, val)) continue;
|
|
31031
31570
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31051,6 +31590,7 @@ function OhhwellsBridge() {
|
|
|
31051
31590
|
});
|
|
31052
31591
|
applyLinkByKey(key, val);
|
|
31053
31592
|
}
|
|
31593
|
+
applySectionEmbeds(content);
|
|
31054
31594
|
applyLogoFromContent(content);
|
|
31055
31595
|
applyLogoSizes(content);
|
|
31056
31596
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31065,6 +31605,7 @@ function OhhwellsBridge() {
|
|
|
31065
31605
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
31066
31606
|
reconcileFooterOrderFromContent(editContentRef.current);
|
|
31067
31607
|
syncButtonsFromContent(document, editContentRef.current);
|
|
31608
|
+
applyHiddenEditablesToDom(editContentRef.current);
|
|
31068
31609
|
if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
|
|
31069
31610
|
syncNavigationDragCursorAttrs();
|
|
31070
31611
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
@@ -31690,6 +32231,12 @@ function OhhwellsBridge() {
|
|
|
31690
32231
|
closeLinkPopoverRef.current();
|
|
31691
32232
|
return;
|
|
31692
32233
|
}
|
|
32234
|
+
if (floatingPanelOpenRef.current) {
|
|
32235
|
+
setFloatingPanelRef.current(null);
|
|
32236
|
+
deselectRef.current();
|
|
32237
|
+
deactivateRef.current();
|
|
32238
|
+
return;
|
|
32239
|
+
}
|
|
31693
32240
|
deselectRef.current();
|
|
31694
32241
|
deactivateRef.current();
|
|
31695
32242
|
clearMediaSelectionRef.current();
|
|
@@ -31868,7 +32415,7 @@ function OhhwellsBridge() {
|
|
|
31868
32415
|
return;
|
|
31869
32416
|
}
|
|
31870
32417
|
}
|
|
31871
|
-
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)) {
|
|
31872
32419
|
if (handleDeleteSelectedRef.current()) {
|
|
31873
32420
|
e.preventDefault();
|
|
31874
32421
|
return;
|
|
@@ -32520,10 +33067,10 @@ function OhhwellsBridge() {
|
|
|
32520
33067
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32521
33068
|
window.removeEventListener("message", handleDeactivate);
|
|
32522
33069
|
window.removeEventListener("message", handleSelectNav);
|
|
32523
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32524
33070
|
window.removeEventListener("message", handleToastAction);
|
|
32525
33071
|
window.removeEventListener("message", handleFormCount);
|
|
32526
33072
|
window.removeEventListener("message", handleUiEscape);
|
|
33073
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32527
33074
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32528
33075
|
autoSaveTimers.current.clear();
|
|
32529
33076
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -32817,7 +33364,7 @@ function OhhwellsBridge() {
|
|
|
32817
33364
|
postToParent2({
|
|
32818
33365
|
type: "ow:ready",
|
|
32819
33366
|
version: "1",
|
|
32820
|
-
bridgeVersion: "0.1.
|
|
33367
|
+
bridgeVersion: "0.1.172-next.456",
|
|
32821
33368
|
path: pathname,
|
|
32822
33369
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32823
33370
|
sections
|
|
@@ -33174,7 +33721,154 @@ function OhhwellsBridge() {
|
|
|
33174
33721
|
enforceLinkHrefs();
|
|
33175
33722
|
return true;
|
|
33176
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]);
|
|
33177
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
|
+
}
|
|
33178
33872
|
const selected = selectedElRef.current;
|
|
33179
33873
|
if (!selected) return false;
|
|
33180
33874
|
if (isCtaButton(selected)) {
|
|
@@ -33233,7 +33927,7 @@ function OhhwellsBridge() {
|
|
|
33233
33927
|
}
|
|
33234
33928
|
}
|
|
33235
33929
|
return deleted;
|
|
33236
|
-
}, [postToParent2]);
|
|
33930
|
+
}, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
|
|
33237
33931
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
33238
33932
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
33239
33933
|
const handleLinkPopoverSubmit = useCallback12(
|
|
@@ -33451,6 +34145,13 @@ function OhhwellsBridge() {
|
|
|
33451
34145
|
isUploading: false,
|
|
33452
34146
|
onReplace: handleMediaReplace,
|
|
33453
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,
|
|
33454
34155
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
33455
34156
|
}
|
|
33456
34157
|
),
|
|
@@ -33553,7 +34254,7 @@ function OhhwellsBridge() {
|
|
|
33553
34254
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33554
34255
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33555
34256
|
"data-ohw-add-field": "",
|
|
33556
|
-
children: /* @__PURE__ */ jsx40(
|
|
34257
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33557
34258
|
}
|
|
33558
34259
|
),
|
|
33559
34260
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -33615,7 +34316,24 @@ function OhhwellsBridge() {
|
|
|
33615
34316
|
children: state
|
|
33616
34317
|
},
|
|
33617
34318
|
state
|
|
33618
|
-
)) })
|
|
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
|
+
)
|
|
33619
34337
|
]
|
|
33620
34338
|
}
|
|
33621
34339
|
)
|
|
@@ -33784,7 +34502,15 @@ function OhhwellsBridge() {
|
|
|
33784
34502
|
onCommand: handleCommand,
|
|
33785
34503
|
activeCommands,
|
|
33786
34504
|
showEditLink,
|
|
33787
|
-
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
|
+
}
|
|
33788
34514
|
}
|
|
33789
34515
|
)
|
|
33790
34516
|
] }),
|
|
@@ -34013,6 +34739,7 @@ export {
|
|
|
34013
34739
|
FOOTER_COLUMN_BLOCKS,
|
|
34014
34740
|
FOOTER_COLUMN_SPANS,
|
|
34015
34741
|
FOOTER_SOCIAL_PLATFORMS,
|
|
34742
|
+
HIDDEN_EDITABLES_KEY,
|
|
34016
34743
|
ItemActionToolbar,
|
|
34017
34744
|
ItemInteractionLayer,
|
|
34018
34745
|
LinkEditorPanel,
|
|
@@ -34035,9 +34762,14 @@ export {
|
|
|
34035
34762
|
addFooterLinkColumn,
|
|
34036
34763
|
appendFooterSocial,
|
|
34037
34764
|
applyBrandChrome,
|
|
34765
|
+
applyHiddenEditablesToDom,
|
|
34038
34766
|
applyStickySearchParams,
|
|
34767
|
+
blockPathFromEditKey,
|
|
34039
34768
|
buildDefaultFooterTree,
|
|
34040
34769
|
buildTarget,
|
|
34770
|
+
canRemoveAiBlock,
|
|
34771
|
+
canRemoveAiTextBlock,
|
|
34772
|
+
canSoftHideEditable,
|
|
34041
34773
|
dropIndicatorVariants,
|
|
34042
34774
|
ensureFooterTree,
|
|
34043
34775
|
filterAvailablePages,
|
|
@@ -34048,6 +34780,7 @@ export {
|
|
|
34048
34780
|
insertFooterHours,
|
|
34049
34781
|
isDeadPageHref,
|
|
34050
34782
|
isEditSessionActive,
|
|
34783
|
+
isEditableKeyHidden,
|
|
34051
34784
|
isPlainLeftClick,
|
|
34052
34785
|
isRenderableFooterTree,
|
|
34053
34786
|
isRenderableTree,
|
|
@@ -34058,15 +34791,22 @@ export {
|
|
|
34058
34791
|
parseAiFooterState,
|
|
34059
34792
|
parseAiSectionsState,
|
|
34060
34793
|
parseTarget,
|
|
34794
|
+
planAiBlockRemoval,
|
|
34795
|
+
planAiTextBlockRemoval,
|
|
34061
34796
|
planBuildPageSync,
|
|
34797
|
+
readHiddenEditables,
|
|
34062
34798
|
recordOverriddenPaths,
|
|
34063
34799
|
releaseTemplateLogoIfReplaced,
|
|
34800
|
+
removeBlockAtPath,
|
|
34064
34801
|
removeFooterBlock,
|
|
34065
34802
|
resetOverriddenPathsCache,
|
|
34066
34803
|
resolveFooterCopyright,
|
|
34804
|
+
resolveSoftHideTarget,
|
|
34067
34805
|
resolveStickyNavigation,
|
|
34068
34806
|
serializeAiFooterState,
|
|
34069
34807
|
shouldFetchContentForPath,
|
|
34808
|
+
softHideEditableInDom,
|
|
34809
|
+
softUnhideEditableInDom,
|
|
34070
34810
|
stepViableSlide,
|
|
34071
34811
|
stripPlaceholderText,
|
|
34072
34812
|
stripPlaceholders,
|
|
@@ -34074,6 +34814,8 @@ export {
|
|
|
34074
34814
|
toggleVariants,
|
|
34075
34815
|
useOhwCarousel,
|
|
34076
34816
|
validateUrlInput,
|
|
34077
|
-
viableSlides
|
|
34817
|
+
viableSlides,
|
|
34818
|
+
withHiddenEditable,
|
|
34819
|
+
withoutHiddenEditable
|
|
34078
34820
|
};
|
|
34079
34821
|
//# sourceMappingURL=index.js.map
|