@ohhwells/bridge 0.1.169-next.450 → 0.1.170
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 +745 -957
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +766 -994
- 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 +0 -116
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1245,21 +1245,21 @@ function chromeFrom(sample) {
|
|
|
1245
1245
|
};
|
|
1246
1246
|
}
|
|
1247
1247
|
function filledPrimary(seed) {
|
|
1248
|
-
const
|
|
1249
|
-
const luminance = relativeLuminance(
|
|
1248
|
+
const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1249
|
+
const luminance = relativeLuminance(paint);
|
|
1250
1250
|
return {
|
|
1251
|
-
background: toCss({ ...
|
|
1251
|
+
background: toCss({ ...paint, a: 1 }),
|
|
1252
1252
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1253
1253
|
borderColor: TRANSPARENT,
|
|
1254
1254
|
borderWidth: "0px"
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
1257
|
function generatedSecondary(primary) {
|
|
1258
|
-
const
|
|
1258
|
+
const paint = accentColor(primary);
|
|
1259
1259
|
return {
|
|
1260
1260
|
background: TRANSPARENT,
|
|
1261
|
-
color:
|
|
1262
|
-
borderColor:
|
|
1261
|
+
color: paint,
|
|
1262
|
+
borderColor: paint,
|
|
1263
1263
|
borderWidth: "1px"
|
|
1264
1264
|
};
|
|
1265
1265
|
}
|
|
@@ -1272,9 +1272,9 @@ function generatedGhost(primary) {
|
|
|
1272
1272
|
};
|
|
1273
1273
|
}
|
|
1274
1274
|
function normalizeOutlineChrome(outline, primary) {
|
|
1275
|
-
const
|
|
1275
|
+
const paint = accentColor(primary);
|
|
1276
1276
|
const text = parseColor(outline.color);
|
|
1277
|
-
const paintRgb = parseColor(
|
|
1277
|
+
const paintRgb = parseColor(paint);
|
|
1278
1278
|
const primaryLabel = parseColor(primary.color);
|
|
1279
1279
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1280
1280
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1283,8 +1283,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1283
1283
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1284
1284
|
return {
|
|
1285
1285
|
...outline,
|
|
1286
|
-
color:
|
|
1287
|
-
borderColor: hasBorder ?
|
|
1286
|
+
color: paint,
|
|
1287
|
+
borderColor: hasBorder ? paint : outline.borderColor
|
|
1288
1288
|
};
|
|
1289
1289
|
}
|
|
1290
1290
|
function generateButtonVariants(samples) {
|
|
@@ -6880,21 +6880,6 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6880
6880
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6881
6881
|
return target ? pricingFeatureList(target).length : 0;
|
|
6882
6882
|
}
|
|
6883
|
-
function prevailingFeatureIcon(features) {
|
|
6884
|
-
const counts = /* @__PURE__ */ new Map();
|
|
6885
|
-
for (const row of features) {
|
|
6886
|
-
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6887
|
-
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6888
|
-
entry.count += 1;
|
|
6889
|
-
counts.set(key, entry);
|
|
6890
|
-
}
|
|
6891
|
-
let best = null;
|
|
6892
|
-
for (const entry of counts.values()) {
|
|
6893
|
-
if (!best || entry.count > best.count) best = entry;
|
|
6894
|
-
}
|
|
6895
|
-
if (!best) return {};
|
|
6896
|
-
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6897
|
-
}
|
|
6898
6883
|
function addPricingCardFeature(tree, index, text) {
|
|
6899
6884
|
return withPricingCollection(tree, (collection) => {
|
|
6900
6885
|
const children = collection.children;
|
|
@@ -6903,7 +6888,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6903
6888
|
const features = pricingFeatureList(target);
|
|
6904
6889
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6905
6890
|
target.slots = target.slots ?? {};
|
|
6906
|
-
target.slots.features = [...features, { text
|
|
6891
|
+
target.slots.features = [...features, { text }];
|
|
6907
6892
|
return true;
|
|
6908
6893
|
});
|
|
6909
6894
|
}
|
|
@@ -7547,120 +7532,6 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7547
7532
|
);
|
|
7548
7533
|
}
|
|
7549
7534
|
|
|
7550
|
-
// src/lib/youtube.ts
|
|
7551
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7552
|
-
function extractYouTubeId(input) {
|
|
7553
|
-
const trimmed = input.trim();
|
|
7554
|
-
if (!trimmed) return null;
|
|
7555
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7556
|
-
let url;
|
|
7557
|
-
try {
|
|
7558
|
-
url = new URL(trimmed);
|
|
7559
|
-
} catch {
|
|
7560
|
-
return null;
|
|
7561
|
-
}
|
|
7562
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
7563
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7564
|
-
return null;
|
|
7565
|
-
}
|
|
7566
|
-
let candidate = null;
|
|
7567
|
-
if (host === "youtu.be") {
|
|
7568
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7569
|
-
} else if (url.pathname === "/watch") {
|
|
7570
|
-
candidate = url.searchParams.get("v");
|
|
7571
|
-
} else {
|
|
7572
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7573
|
-
candidate = match ? match[1] : null;
|
|
7574
|
-
}
|
|
7575
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7576
|
-
}
|
|
7577
|
-
|
|
7578
|
-
// src/lib/section-embed.ts
|
|
7579
|
-
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7580
|
-
function readStoredEmbed(value) {
|
|
7581
|
-
if (value.startsWith("start\n")) {
|
|
7582
|
-
return { raw: value.slice("start\n".length), at: "start" };
|
|
7583
|
-
}
|
|
7584
|
-
return { raw: value, at: "end" };
|
|
7585
|
-
}
|
|
7586
|
-
function embedFrameSrc(value) {
|
|
7587
|
-
const videoId = extractYouTubeId(value);
|
|
7588
|
-
if (videoId) {
|
|
7589
|
-
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7590
|
-
}
|
|
7591
|
-
let url;
|
|
7592
|
-
try {
|
|
7593
|
-
url = new URL(value);
|
|
7594
|
-
} catch {
|
|
7595
|
-
return null;
|
|
7596
|
-
}
|
|
7597
|
-
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7598
|
-
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7599
|
-
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7600
|
-
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7601
|
-
return { src, title: "Map" };
|
|
7602
|
-
}
|
|
7603
|
-
if (host === "maps.app.goo.gl") {
|
|
7604
|
-
return { src: value, title: "Map" };
|
|
7605
|
-
}
|
|
7606
|
-
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7607
|
-
return { src: value, title: "Calendar" };
|
|
7608
|
-
}
|
|
7609
|
-
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7610
|
-
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7611
|
-
}
|
|
7612
|
-
if (host === "forms.gle") {
|
|
7613
|
-
return { src: value, title: "Form" };
|
|
7614
|
-
}
|
|
7615
|
-
return null;
|
|
7616
|
-
}
|
|
7617
|
-
function place(section, box, at) {
|
|
7618
|
-
if (at === "start") {
|
|
7619
|
-
section.insertBefore(box, section.firstChild);
|
|
7620
|
-
return;
|
|
7621
|
-
}
|
|
7622
|
-
section.appendChild(box);
|
|
7623
|
-
}
|
|
7624
|
-
function paint(section, key, src, title, at) {
|
|
7625
|
-
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7626
|
-
const frame = existing?.querySelector("iframe");
|
|
7627
|
-
if (existing && frame) {
|
|
7628
|
-
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7629
|
-
frame.title = title;
|
|
7630
|
-
place(section, existing, at);
|
|
7631
|
-
return;
|
|
7632
|
-
}
|
|
7633
|
-
existing?.remove();
|
|
7634
|
-
const box = document.createElement("div");
|
|
7635
|
-
box.setAttribute("data-ohw-section-embed", key);
|
|
7636
|
-
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;";
|
|
7637
|
-
const frameWrap = document.createElement("div");
|
|
7638
|
-
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7639
|
-
const iframe = document.createElement("iframe");
|
|
7640
|
-
iframe.src = src;
|
|
7641
|
-
iframe.title = title;
|
|
7642
|
-
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7643
|
-
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7644
|
-
iframe.setAttribute("allowfullscreen", "");
|
|
7645
|
-
frameWrap.appendChild(iframe);
|
|
7646
|
-
box.appendChild(frameWrap);
|
|
7647
|
-
place(section, box, at);
|
|
7648
|
-
}
|
|
7649
|
-
function applySectionEmbeds(content) {
|
|
7650
|
-
for (const [key, val] of Object.entries(content)) {
|
|
7651
|
-
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7652
|
-
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7653
|
-
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7654
|
-
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7655
|
-
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7656
|
-
if (!section || !stored || !frame) {
|
|
7657
|
-
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7658
|
-
continue;
|
|
7659
|
-
}
|
|
7660
|
-
paint(section, key, frame.src, frame.title, stored.at);
|
|
7661
|
-
}
|
|
7662
|
-
}
|
|
7663
|
-
|
|
7664
7535
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7665
7536
|
var import_react_dom = require("react-dom");
|
|
7666
7537
|
var import_client = require("react-dom/client");
|
|
@@ -8234,7 +8105,7 @@ var AI_MOBILE_CSS = [
|
|
|
8234
8105
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
8235
8106
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
8236
8107
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
8237
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8108
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
|
|
8238
8109
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
8239
8110
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
8240
8111
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -8250,10 +8121,8 @@ var AI_MOBILE_CSS = [
|
|
|
8250
8121
|
"[data-ai-section]{overflow-x:hidden}",
|
|
8251
8122
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
8252
8123
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
8253
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
8254
|
-
|
|
8255
|
-
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8256
|
-
"[data-ai-container]{padding:0 20px !important}",
|
|
8124
|
+
// still got a 20px band of section background down both sides on a phone.
|
|
8125
|
+
"[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8257
8126
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
8258
8127
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
8259
8128
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8458,31 +8327,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8458
8327
|
function textAttrs(ctx, path) {
|
|
8459
8328
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8460
8329
|
}
|
|
8461
|
-
var AI_RESPONSIVE_CSS = [
|
|
8462
|
-
"@media (max-width: 960px) {",
|
|
8463
|
-
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8464
|
-
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8465
|
-
"}",
|
|
8466
|
-
"@media (max-width: 640px) {",
|
|
8467
|
-
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8468
|
-
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8469
|
-
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8470
|
-
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8471
|
-
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8472
|
-
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8473
|
-
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8474
|
-
// layered text used to be.
|
|
8475
|
-
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8476
|
-
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8477
|
-
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8478
|
-
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8479
|
-
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8480
|
-
// other rule had already been taught to stand down.
|
|
8481
|
-
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8482
|
-
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8483
|
-
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8484
|
-
"}"
|
|
8485
|
-
].join("\n");
|
|
8486
8330
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8487
8331
|
function MediaBox({
|
|
8488
8332
|
refValue,
|
|
@@ -8537,7 +8381,7 @@ function MediaBox({
|
|
|
8537
8381
|
position: fill ? "absolute" : void 0,
|
|
8538
8382
|
inset: fill ? 0 : void 0,
|
|
8539
8383
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8540
|
-
height: fill ? "100%" :
|
|
8384
|
+
height: fill ? "100%" : void 0,
|
|
8541
8385
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8542
8386
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8543
8387
|
borderRadius: radius,
|
|
@@ -10033,7 +9877,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
10033
9877
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10034
9878
|
"div",
|
|
10035
9879
|
{
|
|
10036
|
-
"data-ai-grid":
|
|
9880
|
+
"data-ai-grid": "",
|
|
10037
9881
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
10038
9882
|
style: {
|
|
10039
9883
|
display: "grid",
|
|
@@ -10335,7 +10179,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
10335
10179
|
},
|
|
10336
10180
|
children: [
|
|
10337
10181
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
10338
|
-
// The section's `data-ai-
|
|
10182
|
+
// The section's `data-ai-container` gave up its max-width/gutter so the base
|
|
10339
10183
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
10340
10184
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
10341
10185
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10754,7 +10598,6 @@ function AiTreeRenderer({
|
|
|
10754
10598
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10755
10599
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10756
10600
|
...bgAttrs,
|
|
10757
|
-
"data-ai-responsive": "",
|
|
10758
10601
|
style: {
|
|
10759
10602
|
position: "relative",
|
|
10760
10603
|
padding: `${padCss} 0`,
|
|
@@ -10768,13 +10611,12 @@ function AiTreeRenderer({
|
|
|
10768
10611
|
...fillHeight ? { display: "grid" } : {}
|
|
10769
10612
|
},
|
|
10770
10613
|
children: [
|
|
10771
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
10772
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10773
10614
|
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10615
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
10774
10616
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10775
10617
|
"div",
|
|
10776
10618
|
{
|
|
10777
|
-
"data-ai-
|
|
10619
|
+
"data-ai-container": "",
|
|
10778
10620
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10779
10621
|
style: {
|
|
10780
10622
|
position: "relative",
|
|
@@ -10791,7 +10633,7 @@ function AiTreeRenderer({
|
|
|
10791
10633
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
10792
10634
|
"div",
|
|
10793
10635
|
{
|
|
10794
|
-
"data-ai-
|
|
10636
|
+
"data-ai-row": "",
|
|
10795
10637
|
style: {
|
|
10796
10638
|
display: "grid",
|
|
10797
10639
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11453,10 +11295,9 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11453
11295
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11454
11296
|
continue;
|
|
11455
11297
|
}
|
|
11298
|
+
const isNewMount = !existing || !existing.container.isConnected;
|
|
11456
11299
|
let container = existing?.container;
|
|
11457
|
-
let isNewMount = false;
|
|
11458
11300
|
if (!container || !container.isConnected) {
|
|
11459
|
-
isNewMount = true;
|
|
11460
11301
|
existing?.root.unmount();
|
|
11461
11302
|
container?.remove();
|
|
11462
11303
|
container = document.createElement("div");
|
|
@@ -11794,34 +11635,6 @@ function minSpanForFooterBlock(type) {
|
|
|
11794
11635
|
return 3;
|
|
11795
11636
|
}
|
|
11796
11637
|
}
|
|
11797
|
-
function readLiveSocialItems() {
|
|
11798
|
-
const root = getFooterRoot();
|
|
11799
|
-
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11800
|
-
if (!row) return [];
|
|
11801
|
-
const items = [];
|
|
11802
|
-
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11803
|
-
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11804
|
-
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11805
|
-
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11806
|
-
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11807
|
-
items.push({ platform, href });
|
|
11808
|
-
}
|
|
11809
|
-
return items;
|
|
11810
|
-
}
|
|
11811
|
-
function syncSocialRowsFromDom(tree) {
|
|
11812
|
-
const root = getFooterRoot();
|
|
11813
|
-
if (!root) return;
|
|
11814
|
-
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11815
|
-
const live = readLiveSocialItems();
|
|
11816
|
-
if (row && live.length === 0) return;
|
|
11817
|
-
for (const col of tree.columns) {
|
|
11818
|
-
col.blocks = col.blocks.flatMap((block) => {
|
|
11819
|
-
if (block.type !== "social-row") return [block];
|
|
11820
|
-
if (!row) return [];
|
|
11821
|
-
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11822
|
-
});
|
|
11823
|
-
}
|
|
11824
|
-
}
|
|
11825
11638
|
function collectBrandBlocks(tree) {
|
|
11826
11639
|
const brand = [];
|
|
11827
11640
|
for (const col of tree.columns) {
|
|
@@ -12067,7 +11880,6 @@ function textOf2(el) {
|
|
|
12067
11880
|
}
|
|
12068
11881
|
function syncFooterTreeLinksFromDom(tree) {
|
|
12069
11882
|
const next = cloneTree(tree);
|
|
12070
|
-
syncSocialRowsFromDom(next);
|
|
12071
11883
|
const domCols = listFooterColumns().map((col) => {
|
|
12072
11884
|
const heading = getFooterColumnHeadingEl(col);
|
|
12073
11885
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -17880,7 +17692,7 @@ function apiBase() {
|
|
|
17880
17692
|
function bridgeVersion() {
|
|
17881
17693
|
try {
|
|
17882
17694
|
if (true) {
|
|
17883
|
-
return "0.1.
|
|
17695
|
+
return "0.1.170";
|
|
17884
17696
|
}
|
|
17885
17697
|
} catch {
|
|
17886
17698
|
}
|
|
@@ -17894,7 +17706,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17894
17706
|
return;
|
|
17895
17707
|
}
|
|
17896
17708
|
try {
|
|
17897
|
-
const v = true ? "0.1.
|
|
17709
|
+
const v = true ? "0.1.170" : "";
|
|
17898
17710
|
if (v) {
|
|
17899
17711
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17900
17712
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18572,7 +18384,6 @@ function MediaOverlay({
|
|
|
18572
18384
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18573
18385
|
);
|
|
18574
18386
|
}, [isVideo]);
|
|
18575
|
-
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18576
18387
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18577
18388
|
const box = {
|
|
18578
18389
|
position: "fixed",
|
|
@@ -18671,10 +18482,11 @@ function MediaOverlay({
|
|
|
18671
18482
|
className: "flex items-center justify-center cursor-pointer",
|
|
18672
18483
|
style: {
|
|
18673
18484
|
...box,
|
|
18674
|
-
//
|
|
18675
|
-
//
|
|
18676
|
-
//
|
|
18677
|
-
|
|
18485
|
+
// When text overlays this media, let clicks fall THROUGH to the text underneath. In the
|
|
18486
|
+
// parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
|
|
18487
|
+
// in-document, pointer-events does it natively. The button below opts back in, so
|
|
18488
|
+
// Replace still works.
|
|
18489
|
+
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18678
18490
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18679
18491
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18680
18492
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18701,17 +18513,17 @@ function MediaOverlay({
|
|
|
18701
18513
|
},
|
|
18702
18514
|
children: [
|
|
18703
18515
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
18704
|
-
|
|
18516
|
+
isVideo ? "Replace video" : "Replace image"
|
|
18705
18517
|
]
|
|
18706
18518
|
}
|
|
18707
18519
|
),
|
|
18708
|
-
|
|
18520
|
+
replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18709
18521
|
Button,
|
|
18710
18522
|
{
|
|
18711
18523
|
"data-ohw-media-overlay": "",
|
|
18712
18524
|
variant: "outline",
|
|
18713
18525
|
size: "sm",
|
|
18714
|
-
"aria-label":
|
|
18526
|
+
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
18715
18527
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18716
18528
|
style: {
|
|
18717
18529
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18734,7 +18546,7 @@ function MediaOverlay({
|
|
|
18734
18546
|
},
|
|
18735
18547
|
children: [
|
|
18736
18548
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
18737
|
-
replaceMode === "full" ?
|
|
18549
|
+
replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
|
|
18738
18550
|
]
|
|
18739
18551
|
}
|
|
18740
18552
|
)
|
|
@@ -19366,7 +19178,7 @@ function AiSectionOverlay({
|
|
|
19366
19178
|
|
|
19367
19179
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19368
19180
|
var import_react13 = require("react");
|
|
19369
|
-
var
|
|
19181
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19370
19182
|
|
|
19371
19183
|
// src/lib/ai-media-strip-tree.ts
|
|
19372
19184
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19480,6 +19292,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19480
19292
|
return true;
|
|
19481
19293
|
});
|
|
19482
19294
|
}
|
|
19295
|
+
function setMediaStripItemAlt(tree, index, alt) {
|
|
19296
|
+
return withMediaStrip(tree, (block) => {
|
|
19297
|
+
const items = block.items;
|
|
19298
|
+
if (index < 0 || index >= items.length) return false;
|
|
19299
|
+
items[index] = { ...items[index], alt };
|
|
19300
|
+
return true;
|
|
19301
|
+
});
|
|
19302
|
+
}
|
|
19483
19303
|
function setMediaStripItemLink(tree, index, link) {
|
|
19484
19304
|
return withMediaStrip(tree, (block) => {
|
|
19485
19305
|
const items = block.items;
|
|
@@ -19497,117 +19317,11 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19497
19317
|
});
|
|
19498
19318
|
}
|
|
19499
19319
|
|
|
19500
|
-
// src/ui/dialog.tsx
|
|
19501
|
-
var React9 = __toESM(require("react"), 1);
|
|
19502
|
-
var import_radix_ui6 = require("radix-ui");
|
|
19503
|
-
var import_lucide_react8 = require("lucide-react");
|
|
19504
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19505
|
-
function Dialog2({
|
|
19506
|
-
...props
|
|
19507
|
-
}) {
|
|
19508
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19509
|
-
}
|
|
19510
|
-
function DialogPortal({
|
|
19511
|
-
...props
|
|
19512
|
-
}) {
|
|
19513
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19514
|
-
}
|
|
19515
|
-
function DialogOverlay({
|
|
19516
|
-
className,
|
|
19517
|
-
...props
|
|
19518
|
-
}) {
|
|
19519
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19520
|
-
import_radix_ui6.Dialog.Overlay,
|
|
19521
|
-
{
|
|
19522
|
-
"data-slot": "dialog-overlay",
|
|
19523
|
-
"data-ohw-link-modal-root": "",
|
|
19524
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19525
|
-
...props
|
|
19526
|
-
}
|
|
19527
|
-
);
|
|
19528
|
-
}
|
|
19529
|
-
var DialogContent = React9.forwardRef(
|
|
19530
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19531
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
19532
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19533
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19534
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19535
|
-
import_radix_ui6.Dialog.Content,
|
|
19536
|
-
{
|
|
19537
|
-
ref,
|
|
19538
|
-
"data-slot": "dialog-content",
|
|
19539
|
-
className: cn(
|
|
19540
|
-
positionMode,
|
|
19541
|
-
"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",
|
|
19542
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19543
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19544
|
-
className
|
|
19545
|
-
),
|
|
19546
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
19547
|
-
...props,
|
|
19548
|
-
children: [
|
|
19549
|
-
children,
|
|
19550
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19551
|
-
import_radix_ui6.Dialog.Close,
|
|
19552
|
-
{
|
|
19553
|
-
type: "button",
|
|
19554
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19555
|
-
"aria-label": "Close",
|
|
19556
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19557
|
-
}
|
|
19558
|
-
) : null
|
|
19559
|
-
]
|
|
19560
|
-
}
|
|
19561
|
-
)
|
|
19562
|
-
] });
|
|
19563
|
-
}
|
|
19564
|
-
);
|
|
19565
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19566
|
-
function DialogHeader({
|
|
19567
|
-
className,
|
|
19568
|
-
...props
|
|
19569
|
-
}) {
|
|
19570
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19571
|
-
}
|
|
19572
|
-
function DialogFooter({
|
|
19573
|
-
className,
|
|
19574
|
-
...props
|
|
19575
|
-
}) {
|
|
19576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19577
|
-
"div",
|
|
19578
|
-
{
|
|
19579
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
19580
|
-
...props
|
|
19581
|
-
}
|
|
19582
|
-
);
|
|
19583
|
-
}
|
|
19584
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19585
|
-
import_radix_ui6.Dialog.Title,
|
|
19586
|
-
{
|
|
19587
|
-
ref,
|
|
19588
|
-
className: cn(
|
|
19589
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19590
|
-
className
|
|
19591
|
-
),
|
|
19592
|
-
...props
|
|
19593
|
-
}
|
|
19594
|
-
));
|
|
19595
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19596
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19597
|
-
import_radix_ui6.Dialog.Description,
|
|
19598
|
-
{
|
|
19599
|
-
ref,
|
|
19600
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
19601
|
-
...props
|
|
19602
|
-
}
|
|
19603
|
-
));
|
|
19604
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19605
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19606
|
-
|
|
19607
19320
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19608
|
-
var
|
|
19609
|
-
var PRIMARY3 = "
|
|
19610
|
-
var
|
|
19321
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19322
|
+
var PRIMARY3 = "#0885FE";
|
|
19323
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
|
|
19324
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19611
19325
|
function findMediaStripItemElement(sectionId, index) {
|
|
19612
19326
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19613
19327
|
if (!sectionEl2) return null;
|
|
@@ -19617,35 +19331,14 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19617
19331
|
}
|
|
19618
19332
|
return null;
|
|
19619
19333
|
}
|
|
19620
|
-
function
|
|
19621
|
-
|
|
19622
|
-
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19623
|
-
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19624
|
-
if (!itemEl) return null;
|
|
19625
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19626
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19627
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19628
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19629
|
-
if (!sectionId || Number.isNaN(index)) return null;
|
|
19630
|
-
return { sectionId, index };
|
|
19631
|
-
}
|
|
19632
|
-
function sameRef(a, b) {
|
|
19633
|
-
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19634
|
-
}
|
|
19635
|
-
function rectOf(el) {
|
|
19334
|
+
function readRect2(ref) {
|
|
19335
|
+
const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19636
19336
|
if (!el) return null;
|
|
19637
19337
|
const r2 = el.getBoundingClientRect();
|
|
19638
19338
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19639
19339
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19640
19340
|
}
|
|
19641
|
-
function
|
|
19642
|
-
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19643
|
-
}
|
|
19644
|
-
function readStripRect(ref) {
|
|
19645
|
-
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19646
|
-
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19647
|
-
}
|
|
19648
|
-
function useLiveItemRect(ref, strip = false) {
|
|
19341
|
+
function useLiveItemRect(ref) {
|
|
19649
19342
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
19650
19343
|
(0, import_react13.useEffect)(() => {
|
|
19651
19344
|
if (!ref) {
|
|
@@ -19653,7 +19346,7 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
19653
19346
|
return;
|
|
19654
19347
|
}
|
|
19655
19348
|
const update = () => {
|
|
19656
|
-
const next =
|
|
19349
|
+
const next = readRect2(ref);
|
|
19657
19350
|
setRect(
|
|
19658
19351
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19659
19352
|
);
|
|
@@ -19668,49 +19361,9 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
19668
19361
|
window.removeEventListener("resize", update);
|
|
19669
19362
|
clearInterval(interval);
|
|
19670
19363
|
};
|
|
19671
|
-
}, [ref?.sectionId, ref?.index
|
|
19364
|
+
}, [ref?.sectionId, ref?.index]);
|
|
19672
19365
|
return rect;
|
|
19673
19366
|
}
|
|
19674
|
-
var TOOLBAR_STRIP_GAP = 52;
|
|
19675
|
-
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19676
|
-
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19677
|
-
function StripToolbarSlot({ stripRect, children }) {
|
|
19678
|
-
const slotRef = (0, import_react13.useRef)(null);
|
|
19679
|
-
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
19680
|
-
const centerX = stripRect.left + stripRect.width / 2;
|
|
19681
|
-
(0, import_react13.useLayoutEffect)(() => {
|
|
19682
|
-
const slot = slotRef.current;
|
|
19683
|
-
if (!slot) return;
|
|
19684
|
-
const clamp = () => {
|
|
19685
|
-
const w = slot.offsetWidth;
|
|
19686
|
-
if (w <= 0) return;
|
|
19687
|
-
const half = w / 2;
|
|
19688
|
-
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19689
|
-
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19690
|
-
};
|
|
19691
|
-
clamp();
|
|
19692
|
-
const ro = new ResizeObserver(clamp);
|
|
19693
|
-
ro.observe(slot);
|
|
19694
|
-
return () => ro.disconnect();
|
|
19695
|
-
}, [centerX, children]);
|
|
19696
|
-
const mobile = window.innerWidth <= 480;
|
|
19697
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19698
|
-
"div",
|
|
19699
|
-
{
|
|
19700
|
-
ref: slotRef,
|
|
19701
|
-
"data-ohw-bridge": "",
|
|
19702
|
-
"data-ohw-item-interaction": "",
|
|
19703
|
-
className: "pointer-events-auto fixed",
|
|
19704
|
-
style: {
|
|
19705
|
-
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19706
|
-
left: centerX + shift,
|
|
19707
|
-
transform: "translate(-50%, -100%)",
|
|
19708
|
-
zIndex: 2147483645
|
|
19709
|
-
},
|
|
19710
|
-
children
|
|
19711
|
-
}
|
|
19712
|
-
);
|
|
19713
|
-
}
|
|
19714
19367
|
function requestValidateTree(postToParent2, tree) {
|
|
19715
19368
|
return new Promise((resolve) => {
|
|
19716
19369
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19747,72 +19400,116 @@ function requestAssetPick(postToParent2) {
|
|
|
19747
19400
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19748
19401
|
});
|
|
19749
19402
|
}
|
|
19750
|
-
function
|
|
19403
|
+
function Pill({
|
|
19751
19404
|
label,
|
|
19752
19405
|
onClick,
|
|
19753
|
-
disabled
|
|
19754
|
-
active
|
|
19755
|
-
children
|
|
19756
|
-
}) {
|
|
19757
|
-
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19758
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19759
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
19760
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19761
|
-
] });
|
|
19762
|
-
}
|
|
19763
|
-
function ToolbarSeparator() {
|
|
19764
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19765
|
-
}
|
|
19766
|
-
function OptionMenu({
|
|
19767
|
-
label,
|
|
19768
|
-
value,
|
|
19769
|
-
options,
|
|
19770
|
-
onChange
|
|
19406
|
+
disabled,
|
|
19407
|
+
active
|
|
19771
19408
|
}) {
|
|
19772
|
-
|
|
19773
|
-
|
|
19774
|
-
|
|
19775
|
-
|
|
19776
|
-
|
|
19777
|
-
|
|
19778
|
-
|
|
19779
|
-
|
|
19780
|
-
|
|
19781
|
-
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19410
|
+
"button",
|
|
19411
|
+
{
|
|
19412
|
+
type: "button",
|
|
19413
|
+
onClick,
|
|
19414
|
+
disabled,
|
|
19415
|
+
style: {
|
|
19416
|
+
height: 28,
|
|
19417
|
+
padding: "0 10px",
|
|
19418
|
+
display: "inline-flex",
|
|
19419
|
+
alignItems: "center",
|
|
19420
|
+
gap: 4,
|
|
19421
|
+
borderRadius: 999,
|
|
19422
|
+
border: "none",
|
|
19423
|
+
cursor: disabled ? "default" : "pointer",
|
|
19424
|
+
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19425
|
+
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19426
|
+
opacity: disabled ? 0.4 : 1,
|
|
19427
|
+
fontSize: 12,
|
|
19428
|
+
lineHeight: "16px",
|
|
19429
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19430
|
+
whiteSpace: "nowrap",
|
|
19431
|
+
flex: "0 0 auto"
|
|
19432
|
+
},
|
|
19433
|
+
children: label
|
|
19434
|
+
}
|
|
19435
|
+
);
|
|
19436
|
+
}
|
|
19437
|
+
function AltInput({ value, onCommit }) {
|
|
19438
|
+
const [draft, setDraft] = (0, import_react13.useState)(value);
|
|
19439
|
+
(0, import_react13.useEffect)(() => setDraft(value), [value]);
|
|
19440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19441
|
+
"div",
|
|
19442
|
+
{
|
|
19443
|
+
style: {
|
|
19444
|
+
display: "flex",
|
|
19445
|
+
alignItems: "center",
|
|
19446
|
+
gap: 6,
|
|
19447
|
+
height: 28,
|
|
19448
|
+
padding: "0 12px",
|
|
19449
|
+
borderRadius: 999,
|
|
19450
|
+
background: "#ffffff",
|
|
19451
|
+
width: "100%",
|
|
19452
|
+
maxWidth: 260,
|
|
19453
|
+
boxSizing: "border-box"
|
|
19454
|
+
},
|
|
19455
|
+
children: [
|
|
19456
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19457
|
+
"span",
|
|
19792
19458
|
{
|
|
19793
|
-
|
|
19794
|
-
|
|
19795
|
-
|
|
19796
|
-
|
|
19797
|
-
|
|
19798
|
-
|
|
19799
|
-
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
|
|
19803
|
-
)
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19459
|
+
style: {
|
|
19460
|
+
flex: "0 0 auto",
|
|
19461
|
+
color: OHW_BLUE_DARK,
|
|
19462
|
+
fontSize: 10,
|
|
19463
|
+
fontWeight: 700,
|
|
19464
|
+
textTransform: "uppercase",
|
|
19465
|
+
letterSpacing: 0.4
|
|
19466
|
+
},
|
|
19467
|
+
children: "Alt"
|
|
19468
|
+
}
|
|
19469
|
+
),
|
|
19470
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19471
|
+
"input",
|
|
19472
|
+
{
|
|
19473
|
+
type: "text",
|
|
19474
|
+
value: draft,
|
|
19475
|
+
onChange: (e) => setDraft(e.target.value),
|
|
19476
|
+
onBlur: () => {
|
|
19477
|
+
if (draft !== value) onCommit(draft);
|
|
19478
|
+
},
|
|
19479
|
+
onKeyDown: (e) => {
|
|
19480
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
19481
|
+
if (e.key === "Escape") {
|
|
19482
|
+
setDraft(value);
|
|
19483
|
+
e.currentTarget.blur();
|
|
19484
|
+
}
|
|
19485
|
+
},
|
|
19486
|
+
placeholder: "Describe this image",
|
|
19487
|
+
"aria-label": "Image alt text",
|
|
19488
|
+
style: {
|
|
19489
|
+
flex: 1,
|
|
19490
|
+
minWidth: 0,
|
|
19491
|
+
border: "none",
|
|
19492
|
+
outline: "none",
|
|
19493
|
+
background: "transparent",
|
|
19494
|
+
fontSize: 12,
|
|
19495
|
+
lineHeight: "16px",
|
|
19496
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19497
|
+
color: "#1f2937"
|
|
19498
|
+
}
|
|
19499
|
+
}
|
|
19500
|
+
)
|
|
19501
|
+
]
|
|
19502
|
+
}
|
|
19503
|
+
);
|
|
19807
19504
|
}
|
|
19808
19505
|
var VARIANTS = [
|
|
19809
19506
|
{ value: "logos", label: "Logos" },
|
|
19810
19507
|
{ value: "reel", label: "Reel" }
|
|
19811
19508
|
];
|
|
19812
19509
|
var ALIGNS = [
|
|
19813
|
-
{ value: "left", label: "
|
|
19814
|
-
{ value: "center", label: "
|
|
19815
|
-
{ value: "right", label: "
|
|
19510
|
+
{ value: "left", label: "Left" },
|
|
19511
|
+
{ value: "center", label: "Center" },
|
|
19512
|
+
{ value: "right", label: "Right" }
|
|
19816
19513
|
];
|
|
19817
19514
|
var HOVERS = [
|
|
19818
19515
|
{ value: "none", label: "None" },
|
|
@@ -19820,104 +19517,104 @@ var HOVERS = [
|
|
|
19820
19517
|
{ value: "zoom", label: "Zoom" },
|
|
19821
19518
|
{ value: "fade", label: "Fade" }
|
|
19822
19519
|
];
|
|
19520
|
+
var TREATMENTS = [
|
|
19521
|
+
{ value: "color", label: "Color" },
|
|
19522
|
+
{ value: "grayscale", label: "Grayscale" }
|
|
19523
|
+
];
|
|
19823
19524
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19824
|
-
function
|
|
19825
|
-
|
|
19826
|
-
linkTarget,
|
|
19827
|
-
onClose,
|
|
19828
|
-
onSave
|
|
19829
|
-
}) {
|
|
19830
|
-
const [draft, setDraft] = (0, import_react13.useState)(href);
|
|
19831
|
-
const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
|
|
19525
|
+
function LinkInput({ value, onCommit }) {
|
|
19526
|
+
const [draft, setDraft] = (0, import_react13.useState)(value);
|
|
19832
19527
|
const [invalid, setInvalid] = (0, import_react13.useState)(false);
|
|
19833
|
-
|
|
19528
|
+
(0, import_react13.useEffect)(() => {
|
|
19529
|
+
setDraft(value);
|
|
19530
|
+
setInvalid(false);
|
|
19531
|
+
}, [value]);
|
|
19532
|
+
const commit2 = () => {
|
|
19834
19533
|
const next = draft.trim();
|
|
19835
|
-
if (next
|
|
19836
|
-
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19840
|
-
onClose();
|
|
19534
|
+
if (next === value) return setInvalid(false);
|
|
19535
|
+
if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
|
|
19536
|
+
setInvalid(false);
|
|
19537
|
+
onCommit(next);
|
|
19841
19538
|
};
|
|
19842
|
-
return /* @__PURE__ */ (0,
|
|
19843
|
-
|
|
19844
|
-
|
|
19845
|
-
|
|
19846
|
-
"
|
|
19847
|
-
|
|
19848
|
-
|
|
19849
|
-
|
|
19850
|
-
|
|
19851
|
-
|
|
19852
|
-
|
|
19853
|
-
|
|
19854
|
-
|
|
19855
|
-
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
"
|
|
19861
|
-
|
|
19862
|
-
|
|
19863
|
-
|
|
19864
|
-
|
|
19865
|
-
|
|
19866
|
-
|
|
19867
|
-
|
|
19868
|
-
|
|
19869
|
-
|
|
19870
|
-
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
|
|
19880
|
-
|
|
19881
|
-
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
|
|
19890
|
-
|
|
19891
|
-
|
|
19892
|
-
|
|
19893
|
-
|
|
19894
|
-
|
|
19895
|
-
|
|
19896
|
-
|
|
19897
|
-
|
|
19898
|
-
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19540
|
+
"div",
|
|
19541
|
+
{
|
|
19542
|
+
style: {
|
|
19543
|
+
display: "flex",
|
|
19544
|
+
alignItems: "center",
|
|
19545
|
+
gap: 6,
|
|
19546
|
+
height: 28,
|
|
19547
|
+
padding: "0 12px",
|
|
19548
|
+
borderRadius: 999,
|
|
19549
|
+
background: "#ffffff",
|
|
19550
|
+
width: "100%",
|
|
19551
|
+
maxWidth: 260,
|
|
19552
|
+
boxSizing: "border-box",
|
|
19553
|
+
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19554
|
+
},
|
|
19555
|
+
children: [
|
|
19556
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19557
|
+
"span",
|
|
19558
|
+
{
|
|
19559
|
+
style: {
|
|
19560
|
+
flex: "0 0 auto",
|
|
19561
|
+
color: OHW_BLUE_DARK,
|
|
19562
|
+
fontSize: 10,
|
|
19563
|
+
fontWeight: 700,
|
|
19564
|
+
textTransform: "uppercase",
|
|
19565
|
+
letterSpacing: 0.4
|
|
19566
|
+
},
|
|
19567
|
+
children: "Link"
|
|
19568
|
+
}
|
|
19569
|
+
),
|
|
19570
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19571
|
+
"input",
|
|
19572
|
+
{
|
|
19573
|
+
type: "text",
|
|
19574
|
+
inputMode: "url",
|
|
19575
|
+
value: draft,
|
|
19576
|
+
onChange: (e) => setDraft(e.target.value),
|
|
19577
|
+
onBlur: commit2,
|
|
19578
|
+
onKeyDown: (e) => {
|
|
19579
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
19580
|
+
if (e.key === "Escape") {
|
|
19581
|
+
setDraft(value);
|
|
19582
|
+
setInvalid(false);
|
|
19583
|
+
e.currentTarget.blur();
|
|
19584
|
+
}
|
|
19585
|
+
},
|
|
19586
|
+
placeholder: "https://example.com",
|
|
19587
|
+
"aria-label": "Image link URL",
|
|
19588
|
+
"aria-invalid": invalid,
|
|
19589
|
+
style: {
|
|
19590
|
+
flex: 1,
|
|
19591
|
+
minWidth: 0,
|
|
19592
|
+
border: "none",
|
|
19593
|
+
outline: "none",
|
|
19594
|
+
background: "transparent",
|
|
19595
|
+
fontSize: 12,
|
|
19596
|
+
lineHeight: "16px",
|
|
19597
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19598
|
+
color: "#1f2937"
|
|
19599
|
+
}
|
|
19600
|
+
}
|
|
19601
|
+
)
|
|
19602
|
+
]
|
|
19603
|
+
}
|
|
19604
|
+
);
|
|
19907
19605
|
}
|
|
19908
19606
|
function MediaStripToolbar({
|
|
19909
19607
|
entry,
|
|
19910
19608
|
index,
|
|
19911
19609
|
pending,
|
|
19912
19610
|
error,
|
|
19913
|
-
itemEditOn,
|
|
19914
|
-
onToggleItemEdit,
|
|
19915
19611
|
onSetVariant,
|
|
19916
19612
|
onSetAlign,
|
|
19917
19613
|
onSetHover,
|
|
19918
19614
|
onSetTreatment,
|
|
19919
19615
|
onResize,
|
|
19920
|
-
|
|
19616
|
+
onSetAlt,
|
|
19617
|
+
onSetLink,
|
|
19921
19618
|
onAddItem,
|
|
19922
19619
|
onRemoveItem,
|
|
19923
19620
|
onChangeImage,
|
|
@@ -19926,102 +19623,81 @@ function MediaStripToolbar({
|
|
|
19926
19623
|
}) {
|
|
19927
19624
|
const items = mediaStripItems(entry.tree);
|
|
19928
19625
|
const itemCount = items.length;
|
|
19626
|
+
const currentAlt = items[index]?.alt ?? "";
|
|
19627
|
+
const currentHref2 = items[index]?.href ?? "";
|
|
19628
|
+
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19929
19629
|
const slots = findMediaStripSlots(entry.tree);
|
|
19930
19630
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19931
19631
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19932
19632
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19933
19633
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19934
19634
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19935
|
-
const
|
|
19936
|
-
const
|
|
19937
|
-
|
|
19635
|
+
const isMobile = window.innerWidth <= 480;
|
|
19636
|
+
const rowStyle = isMobile ? {
|
|
19637
|
+
display: "flex",
|
|
19638
|
+
gap: 6,
|
|
19639
|
+
flexWrap: "nowrap",
|
|
19640
|
+
justifyContent: "center",
|
|
19641
|
+
overflowX: "auto",
|
|
19642
|
+
WebkitOverflowScrolling: "touch",
|
|
19643
|
+
width: "100%",
|
|
19644
|
+
scrollbarWidth: "none"
|
|
19645
|
+
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19938
19647
|
"div",
|
|
19939
19648
|
{
|
|
19940
19649
|
"data-ohw-bridge": "",
|
|
19941
19650
|
"data-ohw-toolbar": "",
|
|
19942
19651
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19943
|
-
|
|
19944
|
-
|
|
19652
|
+
style: {
|
|
19653
|
+
display: "flex",
|
|
19654
|
+
flexDirection: "column",
|
|
19655
|
+
gap: 6,
|
|
19656
|
+
alignItems: "center",
|
|
19657
|
+
background: OHW_BLUE,
|
|
19658
|
+
padding: 8,
|
|
19659
|
+
borderRadius: 12,
|
|
19660
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19661
|
+
pointerEvents: pending ? "none" : "auto",
|
|
19662
|
+
opacity: pending ? 0.6 : 1,
|
|
19663
|
+
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19664
|
+
},
|
|
19945
19665
|
children: [
|
|
19946
|
-
/* @__PURE__ */ (0,
|
|
19947
|
-
|
|
19948
|
-
{
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
|
|
19952
|
-
|
|
19953
|
-
|
|
19954
|
-
|
|
19955
|
-
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
19959
|
-
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
|
|
19964
|
-
|
|
19965
|
-
|
|
19966
|
-
|
|
19967
|
-
|
|
19968
|
-
|
|
19969
|
-
|
|
19970
|
-
|
|
19971
|
-
|
|
19972
|
-
|
|
19973
|
-
|
|
19974
|
-
|
|
19975
|
-
|
|
19976
|
-
|
|
19977
|
-
|
|
19978
|
-
) }),
|
|
19979
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19980
|
-
] }),
|
|
19981
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19982
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19983
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19984
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19985
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19986
|
-
ToolbarAction,
|
|
19987
|
-
{
|
|
19988
|
-
label: gatedLabel("Move right"),
|
|
19989
|
-
onClick: onMoveRight,
|
|
19990
|
-
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19991
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
19992
|
-
}
|
|
19993
|
-
),
|
|
19994
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19995
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19996
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19997
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19998
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19999
|
-
ToolbarAction,
|
|
20000
|
-
{
|
|
20001
|
-
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
20002
|
-
active: treatment === "grayscale",
|
|
20003
|
-
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
20004
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
20005
|
-
}
|
|
20006
|
-
),
|
|
20007
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20008
|
-
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
20009
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20010
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20011
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
20012
|
-
sizeValue,
|
|
20013
|
-
"px"
|
|
20014
|
-
] }),
|
|
20015
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20016
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20017
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20018
|
-
]
|
|
20019
|
-
}
|
|
20020
|
-
),
|
|
20021
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19666
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19667
|
+
VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
|
|
19668
|
+
ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
|
|
19669
|
+
] }),
|
|
19670
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19671
|
+
HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
|
|
19672
|
+
TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
|
|
19673
|
+
] }),
|
|
19674
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
19675
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
|
|
19676
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
|
|
19677
|
+
sizeValue,
|
|
19678
|
+
"px"
|
|
19679
|
+
] }),
|
|
19680
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
|
|
19681
|
+
] }),
|
|
19682
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
|
|
19683
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
|
|
19684
|
+
currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19685
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
|
|
19686
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
|
|
19687
|
+
] }),
|
|
19688
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19689
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
|
|
19690
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
|
|
19691
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
|
|
19692
|
+
] }),
|
|
19693
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19694
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
|
|
19695
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
|
|
19696
|
+
] }),
|
|
19697
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20022
19698
|
]
|
|
20023
19699
|
}
|
|
20024
|
-
)
|
|
19700
|
+
);
|
|
20025
19701
|
}
|
|
20026
19702
|
function findMediaStripSlots(tree) {
|
|
20027
19703
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -20040,23 +19716,31 @@ function AiMediaStripOverlay({
|
|
|
20040
19716
|
}) {
|
|
20041
19717
|
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
20042
19718
|
const [active, setActive] = (0, import_react13.useState)(null);
|
|
20043
|
-
const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
|
|
20044
|
-
const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
|
|
20045
19719
|
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
20046
19720
|
const [error, setError] = (0, import_react13.useState)(null);
|
|
20047
19721
|
const activeRef = (0, import_react13.useRef)(null);
|
|
20048
19722
|
activeRef.current = active;
|
|
20049
|
-
const linkOpenRef = (0, import_react13.useRef)(false);
|
|
20050
|
-
linkOpenRef.current = linkOpen;
|
|
20051
19723
|
(0, import_react13.useEffect)(() => {
|
|
20052
19724
|
const onMove = (e) => {
|
|
20053
|
-
const ref = itemRefFromTarget(e.target);
|
|
20054
19725
|
const t = e.target;
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
19726
|
+
if (!(t instanceof HTMLElement)) return;
|
|
19727
|
+
if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
|
|
19728
|
+
return;
|
|
19729
|
+
}
|
|
19730
|
+
const itemEl = t.closest("[data-ohw-media-strip-item]");
|
|
19731
|
+
if (!itemEl) {
|
|
19732
|
+
setHover(null);
|
|
19733
|
+
return;
|
|
19734
|
+
}
|
|
19735
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19736
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19737
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19738
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19739
|
+
if (!sectionId || Number.isNaN(index)) {
|
|
19740
|
+
setHover(null);
|
|
19741
|
+
return;
|
|
19742
|
+
}
|
|
19743
|
+
setHover({ sectionId, index });
|
|
20060
19744
|
};
|
|
20061
19745
|
const onLeave = () => setHover(null);
|
|
20062
19746
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -20068,25 +19752,23 @@ function AiMediaStripOverlay({
|
|
|
20068
19752
|
}, []);
|
|
20069
19753
|
(0, import_react13.useEffect)(() => {
|
|
20070
19754
|
const onClick = (e) => {
|
|
19755
|
+
const current = activeRef.current;
|
|
19756
|
+
if (!current) return;
|
|
20071
19757
|
const t = e.target;
|
|
20072
|
-
if (!(t instanceof
|
|
20073
|
-
if (t.closest(
|
|
20074
|
-
const
|
|
20075
|
-
if (
|
|
20076
|
-
|
|
20077
|
-
setItemEditOn(false);
|
|
19758
|
+
if (!(t instanceof HTMLElement)) return;
|
|
19759
|
+
if (t.closest("[data-ohw-item-interaction]")) return;
|
|
19760
|
+
const itemEl = findMediaStripItemElement(current.sectionId, current.index);
|
|
19761
|
+
if (itemEl && itemEl.contains(t)) return;
|
|
19762
|
+
setActive(null);
|
|
20078
19763
|
setError(null);
|
|
20079
|
-
setActive(ref);
|
|
20080
19764
|
};
|
|
20081
19765
|
document.addEventListener("click", onClick, true);
|
|
20082
19766
|
return () => document.removeEventListener("click", onClick, true);
|
|
20083
|
-
}, [
|
|
19767
|
+
}, []);
|
|
20084
19768
|
(0, import_react13.useEffect)(() => {
|
|
20085
19769
|
const onBlur = () => {
|
|
20086
19770
|
if (!activeRef.current) return;
|
|
20087
19771
|
setActive(null);
|
|
20088
|
-
setItemEditOn(false);
|
|
20089
|
-
setLinkOpen(false);
|
|
20090
19772
|
setError(null);
|
|
20091
19773
|
};
|
|
20092
19774
|
window.addEventListener("blur", onBlur);
|
|
@@ -20096,10 +19778,7 @@ function AiMediaStripOverlay({
|
|
|
20096
19778
|
const onKeyDown = (e) => {
|
|
20097
19779
|
if (e.key !== "Escape") return;
|
|
20098
19780
|
if (!activeRef.current) return;
|
|
20099
|
-
if (linkOpenRef.current) return;
|
|
20100
|
-
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
20101
19781
|
setActive(null);
|
|
20102
|
-
setItemEditOn(false);
|
|
20103
19782
|
setError(null);
|
|
20104
19783
|
};
|
|
20105
19784
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -20133,133 +19812,137 @@ function AiMediaStripOverlay({
|
|
|
20133
19812
|
tree: nextTree,
|
|
20134
19813
|
label: entry.label,
|
|
20135
19814
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
20136
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20137
|
-
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20138
|
-
// on every edit reads as the section jumping around.
|
|
20139
|
-
skipScrollIntoView: true
|
|
19815
|
+
...entry.brand ? { brand: entry.brand } : {}
|
|
20140
19816
|
});
|
|
20141
19817
|
return true;
|
|
20142
19818
|
},
|
|
20143
19819
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
20144
19820
|
);
|
|
20145
19821
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19822
|
+
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
20146
19823
|
const activeItemRect = useLiveItemRect(active);
|
|
20147
|
-
const
|
|
20148
|
-
const
|
|
20149
|
-
|
|
20150
|
-
|
|
20151
|
-
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
|
|
20157
|
-
|
|
20158
|
-
|
|
20159
|
-
|
|
20160
|
-
|
|
20161
|
-
|
|
20162
|
-
|
|
20163
|
-
|
|
20164
|
-
|
|
20165
|
-
|
|
20166
|
-
|
|
20167
|
-
|
|
20168
|
-
|
|
20169
|
-
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
20180
|
-
|
|
19824
|
+
const TOOLBAR_APPROX_H = 170;
|
|
19825
|
+
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
19826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
19827
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19828
|
+
"button",
|
|
19829
|
+
{
|
|
19830
|
+
type: "button",
|
|
19831
|
+
"data-ohw-toolbar": "",
|
|
19832
|
+
onClick: () => {
|
|
19833
|
+
clearInteractionChromeRef.current();
|
|
19834
|
+
setActive(hover);
|
|
19835
|
+
},
|
|
19836
|
+
"aria-label": "Configure media item",
|
|
19837
|
+
style: {
|
|
19838
|
+
position: "fixed",
|
|
19839
|
+
top: hoverHandleRect.top + 8,
|
|
19840
|
+
left: hoverHandleRect.left + hoverHandleRect.width - 36,
|
|
19841
|
+
width: 28,
|
|
19842
|
+
height: 28,
|
|
19843
|
+
borderRadius: 8,
|
|
19844
|
+
border: `1.5px dashed ${PRIMARY3}`,
|
|
19845
|
+
background: "#ffffff",
|
|
19846
|
+
color: PRIMARY3,
|
|
19847
|
+
display: "flex",
|
|
19848
|
+
alignItems: "center",
|
|
19849
|
+
justifyContent: "center",
|
|
19850
|
+
cursor: "pointer",
|
|
19851
|
+
zIndex: 2147483643,
|
|
19852
|
+
fontSize: 14,
|
|
19853
|
+
fontWeight: 700
|
|
19854
|
+
},
|
|
19855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
19856
|
+
}
|
|
19857
|
+
),
|
|
19858
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19859
|
+
ItemInteractionLayer,
|
|
19860
|
+
{
|
|
19861
|
+
rect: activeItemRect,
|
|
19862
|
+
state: toolbarState,
|
|
19863
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19864
|
+
MediaStripToolbar,
|
|
19865
|
+
{
|
|
19866
|
+
entry: activeEntry,
|
|
19867
|
+
index: active.index,
|
|
19868
|
+
pending,
|
|
19869
|
+
error,
|
|
19870
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19871
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19872
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19873
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19874
|
+
onResize: (delta) => {
|
|
19875
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19876
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19877
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19878
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19879
|
+
},
|
|
19880
|
+
onSetAlt: (alt) => {
|
|
19881
|
+
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19882
|
+
},
|
|
19883
|
+
onSetLink: (href, linkTarget) => {
|
|
20181
19884
|
void runMutation(
|
|
20182
19885
|
active.sectionId,
|
|
20183
|
-
(tree) =>
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
|
|
19886
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
19887
|
+
);
|
|
19888
|
+
},
|
|
19889
|
+
onAddItem: () => {
|
|
19890
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19891
|
+
if (!picked) return;
|
|
19892
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19893
|
+
void runMutation(
|
|
19894
|
+
active.sectionId,
|
|
19895
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19896
|
+
{ [picked.assetId]: picked.url }
|
|
19897
|
+
).then((applied) => {
|
|
19898
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19899
|
+
});
|
|
20187
19900
|
});
|
|
20188
|
-
}
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
|
|
20193
|
-
|
|
20194
|
-
|
|
20195
|
-
|
|
20196
|
-
|
|
19901
|
+
},
|
|
19902
|
+
onChangeImage: () => {
|
|
19903
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19904
|
+
if (!picked) return;
|
|
19905
|
+
void runMutation(
|
|
19906
|
+
active.sectionId,
|
|
19907
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19908
|
+
{ [picked.assetId]: picked.url }
|
|
19909
|
+
);
|
|
19910
|
+
});
|
|
19911
|
+
},
|
|
19912
|
+
onRemoveItem: () => {
|
|
19913
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19914
|
+
(applied) => {
|
|
19915
|
+
if (applied) setActive(null);
|
|
19916
|
+
}
|
|
20197
19917
|
);
|
|
20198
|
-
}
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20212
|
-
|
|
20213
|
-
},
|
|
20214
|
-
onMoveRight: () => {
|
|
20215
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20216
|
-
(applied) => {
|
|
20217
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20218
|
-
}
|
|
20219
|
-
);
|
|
20220
|
-
}
|
|
20221
|
-
}
|
|
20222
|
-
) }),
|
|
20223
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20224
|
-
"div",
|
|
20225
|
-
{
|
|
20226
|
-
"data-ohw-bridge": "",
|
|
20227
|
-
"data-ohw-item-interaction": "",
|
|
20228
|
-
"aria-hidden": true,
|
|
20229
|
-
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20230
|
-
style: {
|
|
20231
|
-
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20232
|
-
left: activeItemRect.left - 5,
|
|
20233
|
-
background: PRIMARY3,
|
|
20234
|
-
zIndex: 2147483644
|
|
20235
|
-
},
|
|
20236
|
-
children: "Media item"
|
|
20237
|
-
}
|
|
20238
|
-
),
|
|
20239
|
-
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20240
|
-
LinkModal,
|
|
20241
|
-
{
|
|
20242
|
-
href: activeHref,
|
|
20243
|
-
linkTarget: activeTarget,
|
|
20244
|
-
onClose: () => setLinkOpen(false),
|
|
20245
|
-
onSave: (href, linkTarget) => {
|
|
20246
|
-
void runMutation(
|
|
20247
|
-
active.sectionId,
|
|
20248
|
-
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20249
|
-
);
|
|
19918
|
+
},
|
|
19919
|
+
onMoveLeft: () => {
|
|
19920
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19921
|
+
(applied) => {
|
|
19922
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19923
|
+
}
|
|
19924
|
+
);
|
|
19925
|
+
},
|
|
19926
|
+
onMoveRight: () => {
|
|
19927
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19928
|
+
(applied) => {
|
|
19929
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19930
|
+
}
|
|
19931
|
+
);
|
|
19932
|
+
}
|
|
20250
19933
|
}
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
19934
|
+
)
|
|
19935
|
+
}
|
|
19936
|
+
)
|
|
20254
19937
|
] });
|
|
20255
19938
|
}
|
|
20256
19939
|
|
|
20257
19940
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
20258
19941
|
var import_react14 = require("react");
|
|
20259
|
-
var
|
|
20260
|
-
var
|
|
19942
|
+
var import_lucide_react9 = require("lucide-react");
|
|
19943
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
20261
19944
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
20262
|
-
var
|
|
19945
|
+
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]";
|
|
20263
19946
|
function findPricingCardElement(sectionId, index) {
|
|
20264
19947
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20265
19948
|
if (!sectionEl2) return null;
|
|
@@ -20271,7 +19954,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
20271
19954
|
}
|
|
20272
19955
|
function cardRefFromTarget(target) {
|
|
20273
19956
|
if (!(target instanceof Element)) return null;
|
|
20274
|
-
if (target.closest(
|
|
19957
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
20275
19958
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
20276
19959
|
if (!cardEl) return null;
|
|
20277
19960
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -20281,21 +19964,21 @@ function cardRefFromTarget(target) {
|
|
|
20281
19964
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
20282
19965
|
return { sectionId, index };
|
|
20283
19966
|
}
|
|
20284
|
-
function
|
|
19967
|
+
function sameRef(a, b) {
|
|
20285
19968
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
20286
19969
|
}
|
|
20287
|
-
function
|
|
19970
|
+
function rectOf(el) {
|
|
20288
19971
|
if (!el) return null;
|
|
20289
19972
|
const r2 = el.getBoundingClientRect();
|
|
20290
19973
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
20291
19974
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20292
19975
|
}
|
|
20293
19976
|
function readRect3(ref) {
|
|
20294
|
-
return
|
|
19977
|
+
return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
20295
19978
|
}
|
|
20296
19979
|
function readGridRect(ref) {
|
|
20297
19980
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
20298
|
-
return
|
|
19981
|
+
return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
20299
19982
|
}
|
|
20300
19983
|
function useLiveCardRect(ref, grid = false) {
|
|
20301
19984
|
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
@@ -20325,7 +20008,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
20325
20008
|
}
|
|
20326
20009
|
var TOOLBAR_GRID_GAP = 52;
|
|
20327
20010
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
20328
|
-
var
|
|
20011
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
20329
20012
|
function GridToolbarSlot({ gridRect, children }) {
|
|
20330
20013
|
const slotRef = (0, import_react14.useRef)(null);
|
|
20331
20014
|
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
@@ -20337,7 +20020,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20337
20020
|
const w = slot.offsetWidth;
|
|
20338
20021
|
if (w <= 0) return;
|
|
20339
20022
|
const half = w / 2;
|
|
20340
|
-
const clamped = Math.max(
|
|
20023
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
20341
20024
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
20342
20025
|
};
|
|
20343
20026
|
clamp();
|
|
@@ -20346,7 +20029,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20346
20029
|
return () => ro.disconnect();
|
|
20347
20030
|
}, [centerX, children]);
|
|
20348
20031
|
const mobile = window.innerWidth <= 480;
|
|
20349
|
-
return /* @__PURE__ */ (0,
|
|
20032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20350
20033
|
"div",
|
|
20351
20034
|
{
|
|
20352
20035
|
ref: slotRef,
|
|
@@ -20381,7 +20064,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
20381
20064
|
});
|
|
20382
20065
|
}
|
|
20383
20066
|
function StyleSwatch({ style }) {
|
|
20384
|
-
return /* @__PURE__ */ (0,
|
|
20067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20385
20068
|
"span",
|
|
20386
20069
|
{
|
|
20387
20070
|
"aria-hidden": true,
|
|
@@ -20395,35 +20078,35 @@ function StyleSwatch({ style }) {
|
|
|
20395
20078
|
);
|
|
20396
20079
|
}
|
|
20397
20080
|
function ButtonGlyph() {
|
|
20398
|
-
return /* @__PURE__ */ (0,
|
|
20399
|
-
/* @__PURE__ */ (0,
|
|
20400
|
-
/* @__PURE__ */ (0,
|
|
20081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20082
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20083
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20401
20084
|
] });
|
|
20402
20085
|
}
|
|
20403
20086
|
function FeatureGlyph({ mode }) {
|
|
20404
|
-
return /* @__PURE__ */ (0,
|
|
20405
|
-
/* @__PURE__ */ (0,
|
|
20406
|
-
/* @__PURE__ */ (0,
|
|
20407
|
-
/* @__PURE__ */ (0,
|
|
20408
|
-
/* @__PURE__ */ (0,
|
|
20409
|
-
/* @__PURE__ */ (0,
|
|
20410
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
20087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20088
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20089
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20090
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20091
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20092
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20093
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20411
20094
|
] });
|
|
20412
20095
|
}
|
|
20413
|
-
function
|
|
20096
|
+
function ToolbarAction({
|
|
20414
20097
|
label,
|
|
20415
20098
|
onClick,
|
|
20416
20099
|
disabled = false,
|
|
20417
20100
|
children
|
|
20418
20101
|
}) {
|
|
20419
|
-
const button = /* @__PURE__ */ (0,
|
|
20420
|
-
return /* @__PURE__ */ (0,
|
|
20421
|
-
/* @__PURE__ */ (0,
|
|
20422
|
-
/* @__PURE__ */ (0,
|
|
20102
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20104
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20105
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
20423
20106
|
] });
|
|
20424
20107
|
}
|
|
20425
|
-
function
|
|
20426
|
-
return /* @__PURE__ */ (0,
|
|
20108
|
+
function ToolbarSeparator() {
|
|
20109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
20427
20110
|
}
|
|
20428
20111
|
function CardStyleMenu({
|
|
20429
20112
|
value,
|
|
@@ -20431,7 +20114,7 @@ function CardStyleMenu({
|
|
|
20431
20114
|
disabled = false
|
|
20432
20115
|
}) {
|
|
20433
20116
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
20434
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20117
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20435
20118
|
"button",
|
|
20436
20119
|
{
|
|
20437
20120
|
type: "button",
|
|
@@ -20442,28 +20125,28 @@ function CardStyleMenu({
|
|
|
20442
20125
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20443
20126
|
),
|
|
20444
20127
|
children: [
|
|
20445
|
-
/* @__PURE__ */ (0,
|
|
20446
|
-
/* @__PURE__ */ (0,
|
|
20447
|
-
/* @__PURE__ */ (0,
|
|
20128
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
|
|
20129
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20130
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20448
20131
|
]
|
|
20449
20132
|
}
|
|
20450
20133
|
);
|
|
20451
20134
|
if (disabled) {
|
|
20452
|
-
return /* @__PURE__ */ (0,
|
|
20453
|
-
/* @__PURE__ */ (0,
|
|
20454
|
-
/* @__PURE__ */ (0,
|
|
20455
|
-
/* @__PURE__ */ (0,
|
|
20456
|
-
/* @__PURE__ */ (0,
|
|
20135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20136
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20137
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20138
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20139
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20457
20140
|
] })
|
|
20458
20141
|
] });
|
|
20459
20142
|
}
|
|
20460
|
-
return /* @__PURE__ */ (0,
|
|
20461
|
-
/* @__PURE__ */ (0,
|
|
20462
|
-
/* @__PURE__ */ (0,
|
|
20463
|
-
/* @__PURE__ */ (0,
|
|
20464
|
-
/* @__PURE__ */ (0,
|
|
20143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20144
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20145
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20146
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20147
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
20465
20148
|
const selected = style.value === value;
|
|
20466
|
-
return /* @__PURE__ */ (0,
|
|
20149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20467
20150
|
DropdownMenuItem,
|
|
20468
20151
|
{
|
|
20469
20152
|
role: "menuitemradio",
|
|
@@ -20471,9 +20154,9 @@ function CardStyleMenu({
|
|
|
20471
20154
|
onSelect: () => onChange(style.value),
|
|
20472
20155
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20473
20156
|
children: [
|
|
20474
|
-
/* @__PURE__ */ (0,
|
|
20475
|
-
/* @__PURE__ */ (0,
|
|
20476
|
-
selected && /* @__PURE__ */ (0,
|
|
20157
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
|
|
20158
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
|
|
20159
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
20477
20160
|
]
|
|
20478
20161
|
},
|
|
20479
20162
|
style.value
|
|
@@ -20503,7 +20186,7 @@ function PricingCardToolbar({
|
|
|
20503
20186
|
const style = pricingCardStyle(entry.tree, index);
|
|
20504
20187
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20505
20188
|
const mobile = window.innerWidth <= 480;
|
|
20506
|
-
return /* @__PURE__ */ (0,
|
|
20189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20507
20190
|
"div",
|
|
20508
20191
|
{
|
|
20509
20192
|
"data-ohw-bridge": "",
|
|
@@ -20515,7 +20198,7 @@ function PricingCardToolbar({
|
|
|
20515
20198
|
),
|
|
20516
20199
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20517
20200
|
children: [
|
|
20518
|
-
/* @__PURE__ */ (0,
|
|
20201
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20519
20202
|
"div",
|
|
20520
20203
|
{
|
|
20521
20204
|
className: cn(
|
|
@@ -20524,8 +20207,8 @@ function PricingCardToolbar({
|
|
|
20524
20207
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20525
20208
|
),
|
|
20526
20209
|
children: [
|
|
20527
|
-
/* @__PURE__ */ (0,
|
|
20528
|
-
/* @__PURE__ */ (0,
|
|
20210
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20211
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20529
20212
|
CustomToolbarButton,
|
|
20530
20213
|
{
|
|
20531
20214
|
type: "button",
|
|
@@ -20533,8 +20216,8 @@ function PricingCardToolbar({
|
|
|
20533
20216
|
"aria-pressed": featuredTag,
|
|
20534
20217
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20535
20218
|
className: "group size-8",
|
|
20536
|
-
children: /* @__PURE__ */ (0,
|
|
20537
|
-
|
|
20219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20220
|
+
import_lucide_react9.Star,
|
|
20538
20221
|
{
|
|
20539
20222
|
size: 16,
|
|
20540
20223
|
fill: "currentColor",
|
|
@@ -20548,25 +20231,25 @@ function PricingCardToolbar({
|
|
|
20548
20231
|
)
|
|
20549
20232
|
}
|
|
20550
20233
|
) }),
|
|
20551
|
-
/* @__PURE__ */ (0,
|
|
20234
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20552
20235
|
] }),
|
|
20553
|
-
/* @__PURE__ */ (0,
|
|
20554
|
-
/* @__PURE__ */ (0,
|
|
20555
|
-
/* @__PURE__ */ (0,
|
|
20556
|
-
/* @__PURE__ */ (0,
|
|
20557
|
-
/* @__PURE__ */ (0,
|
|
20558
|
-
/* @__PURE__ */ (0,
|
|
20559
|
-
/* @__PURE__ */ (0,
|
|
20236
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20237
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20238
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20239
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
|
|
20240
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "relative inline-flex", children: [
|
|
20241
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
|
|
20242
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
20560
20243
|
] }) }),
|
|
20561
|
-
/* @__PURE__ */ (0,
|
|
20562
|
-
/* @__PURE__ */ (0,
|
|
20563
|
-
/* @__PURE__ */ (0,
|
|
20564
|
-
/* @__PURE__ */ (0,
|
|
20565
|
-
/* @__PURE__ */ (0,
|
|
20244
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "add" }) }),
|
|
20245
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "remove" }) }),
|
|
20246
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20247
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20248
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
20566
20249
|
]
|
|
20567
20250
|
}
|
|
20568
20251
|
),
|
|
20569
|
-
error && /* @__PURE__ */ (0,
|
|
20252
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
20570
20253
|
]
|
|
20571
20254
|
}
|
|
20572
20255
|
) });
|
|
@@ -20600,7 +20283,7 @@ function AiPricingCardOverlay({
|
|
|
20600
20283
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20601
20284
|
setHover((prev) => {
|
|
20602
20285
|
const next = ref && !overEditable ? ref : null;
|
|
20603
|
-
return
|
|
20286
|
+
return sameRef(prev, next) ? prev : next;
|
|
20604
20287
|
});
|
|
20605
20288
|
};
|
|
20606
20289
|
const onLeave = () => setHover(null);
|
|
@@ -20615,10 +20298,10 @@ function AiPricingCardOverlay({
|
|
|
20615
20298
|
const onClick = (e) => {
|
|
20616
20299
|
const t = e.target;
|
|
20617
20300
|
if (!(t instanceof Element)) return;
|
|
20618
|
-
if (t.closest(
|
|
20301
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
20619
20302
|
const ref = cardRefFromTarget(t);
|
|
20620
|
-
setActive((prev) =>
|
|
20621
|
-
if (!ref || !
|
|
20303
|
+
setActive((prev) => sameRef(prev, ref) ? prev : ref);
|
|
20304
|
+
if (!ref || !sameRef(activeRef.current, ref)) setError(null);
|
|
20622
20305
|
};
|
|
20623
20306
|
document.addEventListener("click", onClick, true);
|
|
20624
20307
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20683,12 +20366,12 @@ function AiPricingCardOverlay({
|
|
|
20683
20366
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20684
20367
|
const activeCardRect = useLiveCardRect(active);
|
|
20685
20368
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20686
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20687
|
-
return /* @__PURE__ */ (0,
|
|
20688
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20689
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20690
|
-
/* @__PURE__ */ (0,
|
|
20691
|
-
/* @__PURE__ */ (0,
|
|
20369
|
+
const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20371
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20372
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20373
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20374
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20692
20375
|
PricingCardToolbar,
|
|
20693
20376
|
{
|
|
20694
20377
|
entry: activeEntry,
|
|
@@ -20716,7 +20399,7 @@ function AiPricingCardOverlay({
|
|
|
20716
20399
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20717
20400
|
}
|
|
20718
20401
|
) }),
|
|
20719
|
-
/* @__PURE__ */ (0,
|
|
20402
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20720
20403
|
"div",
|
|
20721
20404
|
{
|
|
20722
20405
|
"data-ohw-bridge": "",
|
|
@@ -20738,7 +20421,7 @@ function AiPricingCardOverlay({
|
|
|
20738
20421
|
|
|
20739
20422
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20740
20423
|
var import_react15 = require("react");
|
|
20741
|
-
var
|
|
20424
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20742
20425
|
|
|
20743
20426
|
// src/lib/ai-video-tree.ts
|
|
20744
20427
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20780,11 +20463,39 @@ function clearVideo(tree, path) {
|
|
|
20780
20463
|
});
|
|
20781
20464
|
}
|
|
20782
20465
|
|
|
20466
|
+
// src/lib/youtube.ts
|
|
20467
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20468
|
+
function extractYouTubeId(input) {
|
|
20469
|
+
const trimmed = input.trim();
|
|
20470
|
+
if (!trimmed) return null;
|
|
20471
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20472
|
+
let url;
|
|
20473
|
+
try {
|
|
20474
|
+
url = new URL(trimmed);
|
|
20475
|
+
} catch {
|
|
20476
|
+
return null;
|
|
20477
|
+
}
|
|
20478
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
20479
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20480
|
+
return null;
|
|
20481
|
+
}
|
|
20482
|
+
let candidate = null;
|
|
20483
|
+
if (host === "youtu.be") {
|
|
20484
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20485
|
+
} else if (url.pathname === "/watch") {
|
|
20486
|
+
candidate = url.searchParams.get("v");
|
|
20487
|
+
} else {
|
|
20488
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20489
|
+
candidate = match ? match[1] : null;
|
|
20490
|
+
}
|
|
20491
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20492
|
+
}
|
|
20493
|
+
|
|
20783
20494
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20784
|
-
var
|
|
20495
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
20785
20496
|
var PRIMARY5 = "#0885FE";
|
|
20786
|
-
var
|
|
20787
|
-
var
|
|
20497
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20498
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20788
20499
|
function findVideoBlockElement(sectionId, path) {
|
|
20789
20500
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20790
20501
|
if (!sectionEl2) return null;
|
|
@@ -20844,12 +20555,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20844
20555
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20845
20556
|
});
|
|
20846
20557
|
}
|
|
20847
|
-
function
|
|
20558
|
+
function Pill2({
|
|
20848
20559
|
label,
|
|
20849
20560
|
onClick,
|
|
20850
20561
|
disabled
|
|
20851
20562
|
}) {
|
|
20852
|
-
return /* @__PURE__ */ (0,
|
|
20563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20853
20564
|
"button",
|
|
20854
20565
|
{
|
|
20855
20566
|
type: "button",
|
|
@@ -20865,7 +20576,7 @@ function Pill({
|
|
|
20865
20576
|
border: "none",
|
|
20866
20577
|
cursor: disabled ? "default" : "pointer",
|
|
20867
20578
|
background: "#ffffff",
|
|
20868
|
-
color:
|
|
20579
|
+
color: OHW_BLUE_DARK2,
|
|
20869
20580
|
opacity: disabled ? 0.4 : 1,
|
|
20870
20581
|
fontSize: 12,
|
|
20871
20582
|
lineHeight: "16px",
|
|
@@ -20908,8 +20619,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20908
20619
|
onCommit(id);
|
|
20909
20620
|
}
|
|
20910
20621
|
};
|
|
20911
|
-
return /* @__PURE__ */ (0,
|
|
20912
|
-
/* @__PURE__ */ (0,
|
|
20622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20623
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20913
20624
|
"div",
|
|
20914
20625
|
{
|
|
20915
20626
|
style: {
|
|
@@ -20925,12 +20636,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20925
20636
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20926
20637
|
},
|
|
20927
20638
|
children: [
|
|
20928
|
-
/* @__PURE__ */ (0,
|
|
20639
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20929
20640
|
"span",
|
|
20930
20641
|
{
|
|
20931
20642
|
style: {
|
|
20932
20643
|
flex: "0 0 auto",
|
|
20933
|
-
color:
|
|
20644
|
+
color: OHW_BLUE_DARK2,
|
|
20934
20645
|
fontSize: 10,
|
|
20935
20646
|
lineHeight: "16px",
|
|
20936
20647
|
fontWeight: 700,
|
|
@@ -20940,7 +20651,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20940
20651
|
children: "Video"
|
|
20941
20652
|
}
|
|
20942
20653
|
),
|
|
20943
|
-
/* @__PURE__ */ (0,
|
|
20654
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20944
20655
|
"input",
|
|
20945
20656
|
{
|
|
20946
20657
|
type: "text",
|
|
@@ -20977,7 +20688,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20977
20688
|
]
|
|
20978
20689
|
}
|
|
20979
20690
|
),
|
|
20980
|
-
invalid && /* @__PURE__ */ (0,
|
|
20691
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20981
20692
|
] });
|
|
20982
20693
|
}
|
|
20983
20694
|
function VideoToolbar({
|
|
@@ -20987,7 +20698,7 @@ function VideoToolbar({
|
|
|
20987
20698
|
onSetVideoId,
|
|
20988
20699
|
onRemove
|
|
20989
20700
|
}) {
|
|
20990
|
-
return /* @__PURE__ */ (0,
|
|
20701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20991
20702
|
"div",
|
|
20992
20703
|
{
|
|
20993
20704
|
"data-ohw-bridge": "",
|
|
@@ -20999,7 +20710,7 @@ function VideoToolbar({
|
|
|
20999
20710
|
gap: 6,
|
|
21000
20711
|
alignItems: "center",
|
|
21001
20712
|
width: 280,
|
|
21002
|
-
background:
|
|
20713
|
+
background: OHW_BLUE2,
|
|
21003
20714
|
padding: 8,
|
|
21004
20715
|
borderRadius: 12,
|
|
21005
20716
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21007,9 +20718,9 @@ function VideoToolbar({
|
|
|
21007
20718
|
opacity: pending ? 0.6 : 1
|
|
21008
20719
|
},
|
|
21009
20720
|
children: [
|
|
21010
|
-
/* @__PURE__ */ (0,
|
|
21011
|
-
/* @__PURE__ */ (0,
|
|
21012
|
-
error && /* @__PURE__ */ (0,
|
|
20721
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20722
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20723
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21013
20724
|
]
|
|
21014
20725
|
}
|
|
21015
20726
|
);
|
|
@@ -21129,8 +20840,8 @@ function AiVideoOverlay({
|
|
|
21129
20840
|
const activeBlockRect = useLiveBlockRect(active);
|
|
21130
20841
|
const TOOLBAR_APPROX_H = 90;
|
|
21131
20842
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21132
|
-
return /* @__PURE__ */ (0,
|
|
21133
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
20843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20844
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21134
20845
|
"button",
|
|
21135
20846
|
{
|
|
21136
20847
|
type: "button",
|
|
@@ -21158,15 +20869,15 @@ function AiVideoOverlay({
|
|
|
21158
20869
|
fontSize: 14,
|
|
21159
20870
|
fontWeight: 700
|
|
21160
20871
|
},
|
|
21161
|
-
children: /* @__PURE__ */ (0,
|
|
20872
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21162
20873
|
}
|
|
21163
20874
|
),
|
|
21164
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20875
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21165
20876
|
ItemInteractionLayer,
|
|
21166
20877
|
{
|
|
21167
20878
|
rect: activeBlockRect,
|
|
21168
20879
|
state: toolbarState,
|
|
21169
|
-
toolbar: /* @__PURE__ */ (0,
|
|
20880
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21170
20881
|
VideoToolbar,
|
|
21171
20882
|
{
|
|
21172
20883
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -21190,7 +20901,7 @@ function AiVideoOverlay({
|
|
|
21190
20901
|
|
|
21191
20902
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
21192
20903
|
var import_react16 = require("react");
|
|
21193
|
-
var
|
|
20904
|
+
var import_lucide_react11 = require("lucide-react");
|
|
21194
20905
|
|
|
21195
20906
|
// src/lib/ai-carousel-tree.ts
|
|
21196
20907
|
function isCarouselBlock(node) {
|
|
@@ -21241,10 +20952,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
21241
20952
|
}
|
|
21242
20953
|
|
|
21243
20954
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
21244
|
-
var
|
|
20955
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
21245
20956
|
var PRIMARY6 = "#0885FE";
|
|
21246
|
-
var
|
|
21247
|
-
var
|
|
20957
|
+
var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
20958
|
+
var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
21248
20959
|
function findCarouselItemElement(sectionId, index) {
|
|
21249
20960
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
21250
20961
|
if (!sectionEl2) return null;
|
|
@@ -21323,8 +21034,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
21323
21034
|
postToParent2({ type: "ow:asset-pick", id });
|
|
21324
21035
|
});
|
|
21325
21036
|
}
|
|
21326
|
-
function
|
|
21327
|
-
return /* @__PURE__ */ (0,
|
|
21037
|
+
function Pill3({ label, onClick, disabled }) {
|
|
21038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21328
21039
|
"button",
|
|
21329
21040
|
{
|
|
21330
21041
|
type: "button",
|
|
@@ -21340,7 +21051,7 @@ function Pill2({ label, onClick, disabled }) {
|
|
|
21340
21051
|
border: "none",
|
|
21341
21052
|
cursor: disabled ? "default" : "pointer",
|
|
21342
21053
|
background: "#ffffff",
|
|
21343
|
-
color:
|
|
21054
|
+
color: OHW_BLUE_DARK3,
|
|
21344
21055
|
opacity: disabled ? 0.4 : 1,
|
|
21345
21056
|
fontSize: 12,
|
|
21346
21057
|
lineHeight: "16px",
|
|
@@ -21358,7 +21069,7 @@ function TogglePill({
|
|
|
21358
21069
|
onToggle,
|
|
21359
21070
|
disabled
|
|
21360
21071
|
}) {
|
|
21361
|
-
return /* @__PURE__ */ (0,
|
|
21072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
21362
21073
|
"button",
|
|
21363
21074
|
{
|
|
21364
21075
|
type: "button",
|
|
@@ -21377,7 +21088,7 @@ function TogglePill({
|
|
|
21377
21088
|
border: "none",
|
|
21378
21089
|
cursor: disabled ? "default" : "pointer",
|
|
21379
21090
|
background: "#ffffff",
|
|
21380
|
-
color:
|
|
21091
|
+
color: OHW_BLUE_DARK3,
|
|
21381
21092
|
opacity: disabled ? 0.4 : 1,
|
|
21382
21093
|
fontSize: 12,
|
|
21383
21094
|
lineHeight: "16px",
|
|
@@ -21387,7 +21098,7 @@ function TogglePill({
|
|
|
21387
21098
|
},
|
|
21388
21099
|
children: [
|
|
21389
21100
|
label,
|
|
21390
|
-
/* @__PURE__ */ (0,
|
|
21101
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21391
21102
|
"span",
|
|
21392
21103
|
{
|
|
21393
21104
|
"aria-hidden": true,
|
|
@@ -21400,10 +21111,10 @@ function TogglePill({
|
|
|
21400
21111
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
21401
21112
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
21402
21113
|
// "disabled control" rather than "switch that is off".
|
|
21403
|
-
background: on ?
|
|
21114
|
+
background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
|
|
21404
21115
|
transition: "background 120ms ease"
|
|
21405
21116
|
},
|
|
21406
|
-
children: /* @__PURE__ */ (0,
|
|
21117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21407
21118
|
"span",
|
|
21408
21119
|
{
|
|
21409
21120
|
style: {
|
|
@@ -21432,7 +21143,7 @@ function CarouselSlideToolbar({
|
|
|
21432
21143
|
onChangeImage,
|
|
21433
21144
|
onToggleAutoplay
|
|
21434
21145
|
}) {
|
|
21435
|
-
return /* @__PURE__ */ (0,
|
|
21146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
21436
21147
|
"div",
|
|
21437
21148
|
{
|
|
21438
21149
|
"data-ohw-bridge": "",
|
|
@@ -21443,7 +21154,7 @@ function CarouselSlideToolbar({
|
|
|
21443
21154
|
flexDirection: "column",
|
|
21444
21155
|
gap: 6,
|
|
21445
21156
|
alignItems: "center",
|
|
21446
|
-
background:
|
|
21157
|
+
background: OHW_BLUE3,
|
|
21447
21158
|
padding: 8,
|
|
21448
21159
|
borderRadius: 12,
|
|
21449
21160
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21455,11 +21166,11 @@ function CarouselSlideToolbar({
|
|
|
21455
21166
|
pointerEvents: pending ? "none" : "auto"
|
|
21456
21167
|
},
|
|
21457
21168
|
children: [
|
|
21458
|
-
/* @__PURE__ */ (0,
|
|
21459
|
-
/* @__PURE__ */ (0,
|
|
21460
|
-
/* @__PURE__ */ (0,
|
|
21169
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21170
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
|
|
21171
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21461
21172
|
] }),
|
|
21462
|
-
error && /* @__PURE__ */ (0,
|
|
21173
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21463
21174
|
]
|
|
21464
21175
|
}
|
|
21465
21176
|
);
|
|
@@ -21599,8 +21310,8 @@ function AiFadeCarouselOverlay({
|
|
|
21599
21310
|
const activeItemRect = useLiveItemRect2(active);
|
|
21600
21311
|
const TOOLBAR_APPROX_H = 90;
|
|
21601
21312
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21602
|
-
return /* @__PURE__ */ (0,
|
|
21603
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
21314
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21604
21315
|
"button",
|
|
21605
21316
|
{
|
|
21606
21317
|
type: "button",
|
|
@@ -21629,10 +21340,10 @@ function AiFadeCarouselOverlay({
|
|
|
21629
21340
|
fontSize: 14,
|
|
21630
21341
|
fontWeight: 700
|
|
21631
21342
|
},
|
|
21632
|
-
children: /* @__PURE__ */ (0,
|
|
21343
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21633
21344
|
}
|
|
21634
21345
|
),
|
|
21635
|
-
swapping && /* @__PURE__ */ (0,
|
|
21346
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21636
21347
|
"div",
|
|
21637
21348
|
{
|
|
21638
21349
|
ref: skeletonRef,
|
|
@@ -21650,15 +21361,15 @@ function AiFadeCarouselOverlay({
|
|
|
21650
21361
|
zIndex: 2147483646,
|
|
21651
21362
|
pointerEvents: "none"
|
|
21652
21363
|
},
|
|
21653
|
-
children: /* @__PURE__ */ (0,
|
|
21364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21654
21365
|
}
|
|
21655
21366
|
),
|
|
21656
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21367
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21657
21368
|
ItemInteractionLayer,
|
|
21658
21369
|
{
|
|
21659
21370
|
rect: activeItemRect,
|
|
21660
21371
|
state: toolbarState,
|
|
21661
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21372
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21662
21373
|
CarouselSlideToolbar,
|
|
21663
21374
|
{
|
|
21664
21375
|
pending,
|
|
@@ -21849,6 +21560,113 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21849
21560
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21850
21561
|
var import_react20 = require("react");
|
|
21851
21562
|
|
|
21563
|
+
// src/ui/dialog.tsx
|
|
21564
|
+
var React9 = __toESM(require("react"), 1);
|
|
21565
|
+
var import_radix_ui6 = require("radix-ui");
|
|
21566
|
+
var import_lucide_react12 = require("lucide-react");
|
|
21567
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
21568
|
+
function Dialog2({
|
|
21569
|
+
...props
|
|
21570
|
+
}) {
|
|
21571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21572
|
+
}
|
|
21573
|
+
function DialogPortal({
|
|
21574
|
+
...props
|
|
21575
|
+
}) {
|
|
21576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21577
|
+
}
|
|
21578
|
+
function DialogOverlay({
|
|
21579
|
+
className,
|
|
21580
|
+
...props
|
|
21581
|
+
}) {
|
|
21582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21583
|
+
import_radix_ui6.Dialog.Overlay,
|
|
21584
|
+
{
|
|
21585
|
+
"data-slot": "dialog-overlay",
|
|
21586
|
+
"data-ohw-link-modal-root": "",
|
|
21587
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21588
|
+
...props
|
|
21589
|
+
}
|
|
21590
|
+
);
|
|
21591
|
+
}
|
|
21592
|
+
var DialogContent = React9.forwardRef(
|
|
21593
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21594
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
21595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21596
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21597
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21598
|
+
import_radix_ui6.Dialog.Content,
|
|
21599
|
+
{
|
|
21600
|
+
ref,
|
|
21601
|
+
"data-slot": "dialog-content",
|
|
21602
|
+
className: cn(
|
|
21603
|
+
positionMode,
|
|
21604
|
+
"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",
|
|
21605
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21606
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21607
|
+
className
|
|
21608
|
+
),
|
|
21609
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
21610
|
+
...props,
|
|
21611
|
+
children: [
|
|
21612
|
+
children,
|
|
21613
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21614
|
+
import_radix_ui6.Dialog.Close,
|
|
21615
|
+
{
|
|
21616
|
+
type: "button",
|
|
21617
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21618
|
+
"aria-label": "Close",
|
|
21619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
21620
|
+
}
|
|
21621
|
+
) : null
|
|
21622
|
+
]
|
|
21623
|
+
}
|
|
21624
|
+
)
|
|
21625
|
+
] });
|
|
21626
|
+
}
|
|
21627
|
+
);
|
|
21628
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21629
|
+
function DialogHeader({
|
|
21630
|
+
className,
|
|
21631
|
+
...props
|
|
21632
|
+
}) {
|
|
21633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21634
|
+
}
|
|
21635
|
+
function DialogFooter({
|
|
21636
|
+
className,
|
|
21637
|
+
...props
|
|
21638
|
+
}) {
|
|
21639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21640
|
+
"div",
|
|
21641
|
+
{
|
|
21642
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
21643
|
+
...props
|
|
21644
|
+
}
|
|
21645
|
+
);
|
|
21646
|
+
}
|
|
21647
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21648
|
+
import_radix_ui6.Dialog.Title,
|
|
21649
|
+
{
|
|
21650
|
+
ref,
|
|
21651
|
+
className: cn(
|
|
21652
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21653
|
+
className
|
|
21654
|
+
),
|
|
21655
|
+
...props
|
|
21656
|
+
}
|
|
21657
|
+
));
|
|
21658
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21659
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21660
|
+
import_radix_ui6.Dialog.Description,
|
|
21661
|
+
{
|
|
21662
|
+
ref,
|
|
21663
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
21664
|
+
...props
|
|
21665
|
+
}
|
|
21666
|
+
));
|
|
21667
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21668
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21669
|
+
|
|
21852
21670
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21853
21671
|
var import_lucide_react16 = require("lucide-react");
|
|
21854
21672
|
|
|
@@ -22952,7 +22770,6 @@ function shouldUseDevFixtures() {
|
|
|
22952
22770
|
function getLogoElement(el) {
|
|
22953
22771
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22954
22772
|
if (marked) return marked;
|
|
22955
|
-
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22956
22773
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22957
22774
|
if (!root) return null;
|
|
22958
22775
|
const anchor = el.closest("a");
|
|
@@ -25769,7 +25586,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25769
25586
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25770
25587
|
return resolveFooterLinksContainerFrom(el);
|
|
25771
25588
|
}
|
|
25772
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") ||
|
|
25589
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25773
25590
|
return getNavigationRoot(el);
|
|
25774
25591
|
}
|
|
25775
25592
|
return null;
|
|
@@ -25991,6 +25808,7 @@ var ICONS = {
|
|
|
25991
25808
|
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"/>',
|
|
25992
25809
|
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"/>'
|
|
25993
25810
|
};
|
|
25811
|
+
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25994
25812
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25995
25813
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25996
25814
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -26088,7 +25906,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
26088
25906
|
el.style.top = `${top}px`;
|
|
26089
25907
|
el.style.height = `${height}px`;
|
|
26090
25908
|
}
|
|
26091
|
-
var
|
|
25909
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
26092
25910
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
26093
25911
|
const isAbove = transform.includes("translateY(-100%)");
|
|
26094
25912
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -26115,8 +25933,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
26115
25933
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
26116
25934
|
const half = toolbarWidth / 2;
|
|
26117
25935
|
return Math.max(
|
|
26118
|
-
|
|
26119
|
-
Math.min(centerX, window.innerWidth -
|
|
25936
|
+
TOOLBAR_EDGE_MARGIN3 + half,
|
|
25937
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
|
|
26120
25938
|
);
|
|
26121
25939
|
}
|
|
26122
25940
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -26999,6 +26817,21 @@ function OhhwellsBridge() {
|
|
|
26999
26817
|
const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
|
|
27000
26818
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
|
|
27001
26819
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26820
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26821
|
+
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26822
|
+
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26823
|
+
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26824
|
+
floatingPanelRef.current = floatingPanel;
|
|
26825
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26826
|
+
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26827
|
+
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26828
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26829
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26830
|
+
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26831
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26832
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26833
|
+
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26834
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
27002
26835
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
|
|
27003
26836
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
|
|
27004
26837
|
const footerDragRef = (0, import_react25.useRef)(null);
|
|
@@ -27025,21 +26858,6 @@ function OhhwellsBridge() {
|
|
|
27025
26858
|
const stylesRef = (0, import_react25.useRef)("");
|
|
27026
26859
|
const appliedDrawerRef = (0, import_react25.useRef)(null);
|
|
27027
26860
|
const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
|
|
27028
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
27029
|
-
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
27030
|
-
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
27031
|
-
floatingPanelRef.current = floatingPanel;
|
|
27032
|
-
const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
|
|
27033
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
27034
|
-
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
27035
|
-
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
27036
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
27037
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
27038
|
-
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
27039
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
27040
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
27041
|
-
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
27042
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
27043
26861
|
const [sitePages, setSitePages] = (0, import_react25.useState)([]);
|
|
27044
26862
|
const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
27045
26863
|
const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
|
|
@@ -27049,18 +26867,7 @@ function OhhwellsBridge() {
|
|
|
27049
26867
|
const linkPopoverOpenRef = (0, import_react25.useRef)(false);
|
|
27050
26868
|
const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
|
|
27051
26869
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27052
|
-
setFloatingPanelRef.current = setFloatingPanel;
|
|
27053
26870
|
linkPopoverSessionRef.current = linkPopover;
|
|
27054
|
-
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
27055
|
-
(0, import_react25.useEffect)(() => {
|
|
27056
|
-
const syncViewport = () => {
|
|
27057
|
-
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
27058
|
-
setEditorViewport((prev) => prev === next ? prev : next);
|
|
27059
|
-
};
|
|
27060
|
-
syncViewport();
|
|
27061
|
-
window.addEventListener("resize", syncViewport);
|
|
27062
|
-
return () => window.removeEventListener("resize", syncViewport);
|
|
27063
|
-
}, []);
|
|
27064
26871
|
(0, import_react25.useEffect)(() => {
|
|
27065
26872
|
setSectionOrderPersistHandler((entries) => {
|
|
27066
26873
|
const currentPath = window.location.pathname;
|
|
@@ -28794,7 +28601,6 @@ function OhhwellsBridge() {
|
|
|
28794
28601
|
applyAiFooterFromContent(content);
|
|
28795
28602
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28796
28603
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28797
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28798
28604
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28799
28605
|
}
|
|
28800
28606
|
applyBrandChrome(content);
|
|
@@ -28805,16 +28611,15 @@ function OhhwellsBridge() {
|
|
|
28805
28611
|
if (key === "__ohw_sections") continue;
|
|
28806
28612
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28807
28613
|
if (key === AI_FOOTER_KEY) continue;
|
|
28808
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28809
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28810
28614
|
if (key === BRAND_KIT_KEY) continue;
|
|
28811
28615
|
if (key === STYLE_STORE_KEY) continue;
|
|
28812
28616
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28617
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28813
28618
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28619
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28814
28620
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28815
28621
|
continue;
|
|
28816
28622
|
}
|
|
28817
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28818
28623
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28819
28624
|
if (applyCarouselNode(key, val)) continue;
|
|
28820
28625
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28854,7 +28659,6 @@ function OhhwellsBridge() {
|
|
|
28854
28659
|
});
|
|
28855
28660
|
applyLinkByKey(key, val);
|
|
28856
28661
|
}
|
|
28857
|
-
applySectionEmbeds(content);
|
|
28858
28662
|
applyLogoFromContent(content);
|
|
28859
28663
|
applyLogoSizes(content);
|
|
28860
28664
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -29043,22 +28847,20 @@ function OhhwellsBridge() {
|
|
|
29043
28847
|
}
|
|
29044
28848
|
applyAiFooterFromContent(content);
|
|
29045
28849
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
29046
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
29047
28850
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
29048
28851
|
}
|
|
29049
28852
|
for (const [key, val] of Object.entries(content)) {
|
|
29050
28853
|
if (key === "__ohw_sections") continue;
|
|
29051
28854
|
if (key === AI_SECTIONS_KEY) continue;
|
|
29052
28855
|
if (key === AI_FOOTER_KEY) continue;
|
|
29053
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29054
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
29055
28856
|
if (key === BRAND_KIT_KEY) continue;
|
|
29056
28857
|
if (key === STYLE_STORE_KEY) continue;
|
|
29057
28858
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28859
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28860
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
29058
28861
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
29059
28862
|
continue;
|
|
29060
28863
|
}
|
|
29061
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
29062
28864
|
if (applyVideoSettingNode(key, val)) continue;
|
|
29063
28865
|
if (applyCarouselNode(key, val)) continue;
|
|
29064
28866
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -29083,7 +28885,6 @@ function OhhwellsBridge() {
|
|
|
29083
28885
|
});
|
|
29084
28886
|
applyLinkByKey(key, val);
|
|
29085
28887
|
}
|
|
29086
|
-
applySectionEmbeds(content);
|
|
29087
28888
|
applyLogoFromContent(content);
|
|
29088
28889
|
reconcileNavbarItemsFromContent(content);
|
|
29089
28890
|
reconcileFooterOrderFromContent(content);
|
|
@@ -29323,11 +29124,26 @@ function OhhwellsBridge() {
|
|
|
29323
29124
|
const t2 = setTimeout(measure, 500);
|
|
29324
29125
|
const ro = new ResizeObserver(schedule);
|
|
29325
29126
|
ro.observe(document.body);
|
|
29127
|
+
let lastWidth = window.innerWidth;
|
|
29128
|
+
let resizeTimers = [];
|
|
29129
|
+
const clearResizeTimers = () => {
|
|
29130
|
+
resizeTimers.forEach(clearTimeout);
|
|
29131
|
+
resizeTimers = [];
|
|
29132
|
+
};
|
|
29133
|
+
const handleResize = () => {
|
|
29134
|
+
if (window.innerWidth === lastWidth) return;
|
|
29135
|
+
lastWidth = window.innerWidth;
|
|
29136
|
+
clearResizeTimers();
|
|
29137
|
+
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29138
|
+
};
|
|
29139
|
+
window.addEventListener("resize", handleResize);
|
|
29326
29140
|
return () => {
|
|
29327
29141
|
clearTimeout(t1);
|
|
29328
29142
|
clearTimeout(t2);
|
|
29329
29143
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29330
29144
|
ro.disconnect();
|
|
29145
|
+
clearResizeTimers();
|
|
29146
|
+
window.removeEventListener("resize", handleResize);
|
|
29331
29147
|
};
|
|
29332
29148
|
}, [pathname, isEditMode, postToParent2]);
|
|
29333
29149
|
(0, import_react25.useEffect)(() => {
|
|
@@ -29624,13 +29440,6 @@ function OhhwellsBridge() {
|
|
|
29624
29440
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29625
29441
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29626
29442
|
if (isInsideLinkEditor(target)) return;
|
|
29627
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29628
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29629
|
-
if (target.closest(
|
|
29630
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29631
|
-
)) {
|
|
29632
|
-
return;
|
|
29633
|
-
}
|
|
29634
29443
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29635
29444
|
clearMediaSelectionRef.current();
|
|
29636
29445
|
}
|
|
@@ -29654,6 +29463,8 @@ function OhhwellsBridge() {
|
|
|
29654
29463
|
return;
|
|
29655
29464
|
}
|
|
29656
29465
|
}
|
|
29466
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29467
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29657
29468
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29658
29469
|
if (collectionItem) {
|
|
29659
29470
|
e.preventDefault();
|
|
@@ -29665,6 +29476,11 @@ function OhhwellsBridge() {
|
|
|
29665
29476
|
});
|
|
29666
29477
|
return;
|
|
29667
29478
|
}
|
|
29479
|
+
if (target.closest(
|
|
29480
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29481
|
+
)) {
|
|
29482
|
+
return;
|
|
29483
|
+
}
|
|
29668
29484
|
{
|
|
29669
29485
|
const formEl = getFormElement(target);
|
|
29670
29486
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29818,13 +29634,9 @@ function OhhwellsBridge() {
|
|
|
29818
29634
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29819
29635
|
e.preventDefault();
|
|
29820
29636
|
e.stopPropagation();
|
|
29637
|
+
selectIconElementRef.current(editable);
|
|
29821
29638
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29822
29639
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29823
|
-
if (aiIcon) {
|
|
29824
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29825
|
-
} else {
|
|
29826
|
-
selectIconElementRef.current(editable);
|
|
29827
|
-
}
|
|
29828
29640
|
postToParentRef.current({
|
|
29829
29641
|
type: "ow:icon-pick",
|
|
29830
29642
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -30052,9 +29864,6 @@ function OhhwellsBridge() {
|
|
|
30052
29864
|
setHoveredItemRect(null);
|
|
30053
29865
|
hoveredNavContainerRef.current = null;
|
|
30054
29866
|
setHoveredNavContainerRect(null);
|
|
30055
|
-
siblingHintElRef.current = null;
|
|
30056
|
-
setSiblingHintRect(null);
|
|
30057
|
-
setSiblingHintRects([]);
|
|
30058
29867
|
return;
|
|
30059
29868
|
}
|
|
30060
29869
|
{
|
|
@@ -30175,6 +29984,7 @@ function OhhwellsBridge() {
|
|
|
30175
29984
|
hoveredNavContainerRef.current = null;
|
|
30176
29985
|
setHoveredNavContainerRect(null);
|
|
30177
29986
|
hoveredItemElRef.current = editable;
|
|
29987
|
+
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
30178
29988
|
}
|
|
30179
29989
|
}
|
|
30180
29990
|
}
|
|
@@ -30884,11 +30694,7 @@ function OhhwellsBridge() {
|
|
|
30884
30694
|
};
|
|
30885
30695
|
const handleMouseMove = (e) => {
|
|
30886
30696
|
const { clientX, clientY } = e;
|
|
30887
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30888
|
-
dismissImageHover();
|
|
30889
|
-
clearImageHover();
|
|
30890
|
-
return;
|
|
30891
|
-
}
|
|
30697
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
30892
30698
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30893
30699
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30894
30700
|
formHoverElRef.current = null;
|
|
@@ -30917,12 +30723,7 @@ function OhhwellsBridge() {
|
|
|
30917
30723
|
setHoveredItemRect(null);
|
|
30918
30724
|
hoveredNavContainerRef.current = null;
|
|
30919
30725
|
setHoveredNavContainerRect(null);
|
|
30920
|
-
siblingHintElRef.current = null;
|
|
30921
|
-
setSiblingHintRect(null);
|
|
30922
|
-
setSiblingHintRects([]);
|
|
30923
30726
|
dismissImageHover();
|
|
30924
|
-
clearImageHover();
|
|
30925
|
-
setSectionGap(null);
|
|
30926
30727
|
return;
|
|
30927
30728
|
}
|
|
30928
30729
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30934,11 +30735,7 @@ function OhhwellsBridge() {
|
|
|
30934
30735
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30935
30736
|
const { clientX, clientY } = e.data;
|
|
30936
30737
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30937
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30938
|
-
dismissImageHover();
|
|
30939
|
-
clearImageHover();
|
|
30940
|
-
return;
|
|
30941
|
-
}
|
|
30738
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
30942
30739
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30943
30740
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30944
30741
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -31318,7 +31115,6 @@ function OhhwellsBridge() {
|
|
|
31318
31115
|
applyAiFooterFromContent(content);
|
|
31319
31116
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31320
31117
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31321
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31322
31118
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31323
31119
|
}
|
|
31324
31120
|
applyBrandChrome(content);
|
|
@@ -31333,16 +31129,15 @@ function OhhwellsBridge() {
|
|
|
31333
31129
|
}
|
|
31334
31130
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31335
31131
|
if (key === AI_FOOTER_KEY) continue;
|
|
31336
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31337
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31338
31132
|
if (key === BRAND_KIT_KEY) continue;
|
|
31339
31133
|
if (key === STYLE_STORE_KEY) continue;
|
|
31340
31134
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31135
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31341
31136
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31137
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31342
31138
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31343
31139
|
continue;
|
|
31344
31140
|
}
|
|
31345
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31346
31141
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31347
31142
|
if (applyCarouselNode(key, val)) continue;
|
|
31348
31143
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31368,7 +31163,6 @@ function OhhwellsBridge() {
|
|
|
31368
31163
|
});
|
|
31369
31164
|
applyLinkByKey(key, val);
|
|
31370
31165
|
}
|
|
31371
|
-
applySectionEmbeds(content);
|
|
31372
31166
|
applyLogoFromContent(content);
|
|
31373
31167
|
applyLogoSizes(content);
|
|
31374
31168
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -32008,12 +31802,6 @@ function OhhwellsBridge() {
|
|
|
32008
31802
|
closeLinkPopoverRef.current();
|
|
32009
31803
|
return;
|
|
32010
31804
|
}
|
|
32011
|
-
if (floatingPanelOpenRef.current) {
|
|
32012
|
-
setFloatingPanelRef.current(null);
|
|
32013
|
-
deselectRef.current();
|
|
32014
|
-
deactivateRef.current();
|
|
32015
|
-
return;
|
|
32016
|
-
}
|
|
32017
31805
|
deselectRef.current();
|
|
32018
31806
|
deactivateRef.current();
|
|
32019
31807
|
clearMediaSelectionRef.current();
|
|
@@ -32844,10 +32632,10 @@ function OhhwellsBridge() {
|
|
|
32844
32632
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32845
32633
|
window.removeEventListener("message", handleDeactivate);
|
|
32846
32634
|
window.removeEventListener("message", handleSelectNav);
|
|
32635
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32847
32636
|
window.removeEventListener("message", handleToastAction);
|
|
32848
32637
|
window.removeEventListener("message", handleFormCount);
|
|
32849
32638
|
window.removeEventListener("message", handleUiEscape);
|
|
32850
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32851
32639
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32852
32640
|
autoSaveTimers.current.clear();
|
|
32853
32641
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -33141,7 +32929,7 @@ function OhhwellsBridge() {
|
|
|
33141
32929
|
postToParent2({
|
|
33142
32930
|
type: "ow:ready",
|
|
33143
32931
|
version: "1",
|
|
33144
|
-
bridgeVersion: "0.1.
|
|
32932
|
+
bridgeVersion: "0.1.170",
|
|
33145
32933
|
path: pathname,
|
|
33146
32934
|
nodes: collectEditableNodes(editContentRef.current),
|
|
33147
32935
|
sections
|