@ohhwells/bridge 0.1.170-next.453 → 0.1.171
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.171";
|
|
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.171" : "";
|
|
17898
17710
|
if (v) {
|
|
17899
17711
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17900
17712
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18574,7 +18386,6 @@ function MediaOverlay({
|
|
|
18574
18386
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18575
18387
|
);
|
|
18576
18388
|
}, [isVideo]);
|
|
18577
|
-
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18578
18389
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18579
18390
|
const box = {
|
|
18580
18391
|
position: "fixed",
|
|
@@ -18673,10 +18484,11 @@ function MediaOverlay({
|
|
|
18673
18484
|
className: "flex items-center justify-center cursor-pointer",
|
|
18674
18485
|
style: {
|
|
18675
18486
|
...box,
|
|
18676
|
-
//
|
|
18677
|
-
//
|
|
18678
|
-
//
|
|
18679
|
-
|
|
18487
|
+
// When text overlays this media, let clicks fall THROUGH to the text underneath. In the
|
|
18488
|
+
// parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
|
|
18489
|
+
// in-document, pointer-events does it natively. The button below opts back in, so
|
|
18490
|
+
// Replace still works.
|
|
18491
|
+
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18680
18492
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18681
18493
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18682
18494
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18703,17 +18515,17 @@ function MediaOverlay({
|
|
|
18703
18515
|
},
|
|
18704
18516
|
children: [
|
|
18705
18517
|
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 }),
|
|
18706
|
-
|
|
18518
|
+
isVideo ? "Replace video" : "Replace image"
|
|
18707
18519
|
]
|
|
18708
18520
|
}
|
|
18709
18521
|
),
|
|
18710
|
-
|
|
18522
|
+
replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
18711
18523
|
Button,
|
|
18712
18524
|
{
|
|
18713
18525
|
"data-ohw-media-overlay": "",
|
|
18714
18526
|
variant: "outline",
|
|
18715
18527
|
size: "sm",
|
|
18716
|
-
"aria-label":
|
|
18528
|
+
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
18717
18529
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18718
18530
|
style: {
|
|
18719
18531
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18736,7 +18548,7 @@ function MediaOverlay({
|
|
|
18736
18548
|
},
|
|
18737
18549
|
children: [
|
|
18738
18550
|
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 }),
|
|
18739
|
-
replaceMode === "full" ?
|
|
18551
|
+
replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
|
|
18740
18552
|
]
|
|
18741
18553
|
}
|
|
18742
18554
|
)
|
|
@@ -19368,7 +19180,7 @@ function AiSectionOverlay({
|
|
|
19368
19180
|
|
|
19369
19181
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19370
19182
|
var import_react13 = require("react");
|
|
19371
|
-
var
|
|
19183
|
+
var import_lucide_react8 = require("lucide-react");
|
|
19372
19184
|
|
|
19373
19185
|
// src/lib/ai-media-strip-tree.ts
|
|
19374
19186
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -19482,6 +19294,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
19482
19294
|
return true;
|
|
19483
19295
|
});
|
|
19484
19296
|
}
|
|
19297
|
+
function setMediaStripItemAlt(tree, index, alt) {
|
|
19298
|
+
return withMediaStrip(tree, (block) => {
|
|
19299
|
+
const items = block.items;
|
|
19300
|
+
if (index < 0 || index >= items.length) return false;
|
|
19301
|
+
items[index] = { ...items[index], alt };
|
|
19302
|
+
return true;
|
|
19303
|
+
});
|
|
19304
|
+
}
|
|
19485
19305
|
function setMediaStripItemLink(tree, index, link) {
|
|
19486
19306
|
return withMediaStrip(tree, (block) => {
|
|
19487
19307
|
const items = block.items;
|
|
@@ -19499,117 +19319,11 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
19499
19319
|
});
|
|
19500
19320
|
}
|
|
19501
19321
|
|
|
19502
|
-
// src/ui/dialog.tsx
|
|
19503
|
-
var React9 = __toESM(require("react"), 1);
|
|
19504
|
-
var import_radix_ui6 = require("radix-ui");
|
|
19505
|
-
var import_lucide_react8 = require("lucide-react");
|
|
19506
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19507
|
-
function Dialog2({
|
|
19508
|
-
...props
|
|
19509
|
-
}) {
|
|
19510
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
19511
|
-
}
|
|
19512
|
-
function DialogPortal({
|
|
19513
|
-
...props
|
|
19514
|
-
}) {
|
|
19515
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
19516
|
-
}
|
|
19517
|
-
function DialogOverlay({
|
|
19518
|
-
className,
|
|
19519
|
-
...props
|
|
19520
|
-
}) {
|
|
19521
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19522
|
-
import_radix_ui6.Dialog.Overlay,
|
|
19523
|
-
{
|
|
19524
|
-
"data-slot": "dialog-overlay",
|
|
19525
|
-
"data-ohw-link-modal-root": "",
|
|
19526
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19527
|
-
...props
|
|
19528
|
-
}
|
|
19529
|
-
);
|
|
19530
|
-
}
|
|
19531
|
-
var DialogContent = React9.forwardRef(
|
|
19532
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19533
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
19534
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
19535
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19536
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19537
|
-
import_radix_ui6.Dialog.Content,
|
|
19538
|
-
{
|
|
19539
|
-
ref,
|
|
19540
|
-
"data-slot": "dialog-content",
|
|
19541
|
-
className: cn(
|
|
19542
|
-
positionMode,
|
|
19543
|
-
"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",
|
|
19544
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19545
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19546
|
-
className
|
|
19547
|
-
),
|
|
19548
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
19549
|
-
...props,
|
|
19550
|
-
children: [
|
|
19551
|
-
children,
|
|
19552
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19553
|
-
import_radix_ui6.Dialog.Close,
|
|
19554
|
-
{
|
|
19555
|
-
type: "button",
|
|
19556
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19557
|
-
"aria-label": "Close",
|
|
19558
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
19559
|
-
}
|
|
19560
|
-
) : null
|
|
19561
|
-
]
|
|
19562
|
-
}
|
|
19563
|
-
)
|
|
19564
|
-
] });
|
|
19565
|
-
}
|
|
19566
|
-
);
|
|
19567
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
19568
|
-
function DialogHeader({
|
|
19569
|
-
className,
|
|
19570
|
-
...props
|
|
19571
|
-
}) {
|
|
19572
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19573
|
-
}
|
|
19574
|
-
function DialogFooter({
|
|
19575
|
-
className,
|
|
19576
|
-
...props
|
|
19577
|
-
}) {
|
|
19578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19579
|
-
"div",
|
|
19580
|
-
{
|
|
19581
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
19582
|
-
...props
|
|
19583
|
-
}
|
|
19584
|
-
);
|
|
19585
|
-
}
|
|
19586
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19587
|
-
import_radix_ui6.Dialog.Title,
|
|
19588
|
-
{
|
|
19589
|
-
ref,
|
|
19590
|
-
className: cn(
|
|
19591
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19592
|
-
className
|
|
19593
|
-
),
|
|
19594
|
-
...props
|
|
19595
|
-
}
|
|
19596
|
-
));
|
|
19597
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
19598
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19599
|
-
import_radix_ui6.Dialog.Description,
|
|
19600
|
-
{
|
|
19601
|
-
ref,
|
|
19602
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
19603
|
-
...props
|
|
19604
|
-
}
|
|
19605
|
-
));
|
|
19606
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
19607
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
19608
|
-
|
|
19609
19322
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
19610
|
-
var
|
|
19611
|
-
var PRIMARY3 = "
|
|
19612
|
-
var
|
|
19323
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
19324
|
+
var PRIMARY3 = "#0885FE";
|
|
19325
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
|
|
19326
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19613
19327
|
function findMediaStripItemElement(sectionId, index) {
|
|
19614
19328
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
19615
19329
|
if (!sectionEl2) return null;
|
|
@@ -19619,35 +19333,14 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
19619
19333
|
}
|
|
19620
19334
|
return null;
|
|
19621
19335
|
}
|
|
19622
|
-
function
|
|
19623
|
-
|
|
19624
|
-
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19625
|
-
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19626
|
-
if (!itemEl) return null;
|
|
19627
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19628
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19629
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19630
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19631
|
-
if (!sectionId || Number.isNaN(index)) return null;
|
|
19632
|
-
return { sectionId, index };
|
|
19633
|
-
}
|
|
19634
|
-
function sameRef(a, b) {
|
|
19635
|
-
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19636
|
-
}
|
|
19637
|
-
function rectOf(el) {
|
|
19336
|
+
function readRect2(ref) {
|
|
19337
|
+
const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19638
19338
|
if (!el) return null;
|
|
19639
19339
|
const r2 = el.getBoundingClientRect();
|
|
19640
19340
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19641
19341
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19642
19342
|
}
|
|
19643
|
-
function
|
|
19644
|
-
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19645
|
-
}
|
|
19646
|
-
function readStripRect(ref) {
|
|
19647
|
-
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19648
|
-
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19649
|
-
}
|
|
19650
|
-
function useLiveItemRect(ref, strip = false) {
|
|
19343
|
+
function useLiveItemRect(ref) {
|
|
19651
19344
|
const [rect, setRect] = (0, import_react13.useState)(null);
|
|
19652
19345
|
(0, import_react13.useEffect)(() => {
|
|
19653
19346
|
if (!ref) {
|
|
@@ -19655,7 +19348,7 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
19655
19348
|
return;
|
|
19656
19349
|
}
|
|
19657
19350
|
const update = () => {
|
|
19658
|
-
const next =
|
|
19351
|
+
const next = readRect2(ref);
|
|
19659
19352
|
setRect(
|
|
19660
19353
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19661
19354
|
);
|
|
@@ -19670,49 +19363,9 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
19670
19363
|
window.removeEventListener("resize", update);
|
|
19671
19364
|
clearInterval(interval);
|
|
19672
19365
|
};
|
|
19673
|
-
}, [ref?.sectionId, ref?.index
|
|
19366
|
+
}, [ref?.sectionId, ref?.index]);
|
|
19674
19367
|
return rect;
|
|
19675
19368
|
}
|
|
19676
|
-
var TOOLBAR_STRIP_GAP = 52;
|
|
19677
|
-
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19678
|
-
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19679
|
-
function StripToolbarSlot({ stripRect, children }) {
|
|
19680
|
-
const slotRef = (0, import_react13.useRef)(null);
|
|
19681
|
-
const [shift, setShift] = (0, import_react13.useState)(0);
|
|
19682
|
-
const centerX = stripRect.left + stripRect.width / 2;
|
|
19683
|
-
(0, import_react13.useLayoutEffect)(() => {
|
|
19684
|
-
const slot = slotRef.current;
|
|
19685
|
-
if (!slot) return;
|
|
19686
|
-
const clamp = () => {
|
|
19687
|
-
const w = slot.offsetWidth;
|
|
19688
|
-
if (w <= 0) return;
|
|
19689
|
-
const half = w / 2;
|
|
19690
|
-
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19691
|
-
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19692
|
-
};
|
|
19693
|
-
clamp();
|
|
19694
|
-
const ro = new ResizeObserver(clamp);
|
|
19695
|
-
ro.observe(slot);
|
|
19696
|
-
return () => ro.disconnect();
|
|
19697
|
-
}, [centerX, children]);
|
|
19698
|
-
const mobile = window.innerWidth <= 480;
|
|
19699
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19700
|
-
"div",
|
|
19701
|
-
{
|
|
19702
|
-
ref: slotRef,
|
|
19703
|
-
"data-ohw-bridge": "",
|
|
19704
|
-
"data-ohw-item-interaction": "",
|
|
19705
|
-
className: "pointer-events-auto fixed",
|
|
19706
|
-
style: {
|
|
19707
|
-
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19708
|
-
left: centerX + shift,
|
|
19709
|
-
transform: "translate(-50%, -100%)",
|
|
19710
|
-
zIndex: 2147483645
|
|
19711
|
-
},
|
|
19712
|
-
children
|
|
19713
|
-
}
|
|
19714
|
-
);
|
|
19715
|
-
}
|
|
19716
19369
|
function requestValidateTree(postToParent2, tree) {
|
|
19717
19370
|
return new Promise((resolve) => {
|
|
19718
19371
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19749,72 +19402,116 @@ function requestAssetPick(postToParent2) {
|
|
|
19749
19402
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19750
19403
|
});
|
|
19751
19404
|
}
|
|
19752
|
-
function
|
|
19405
|
+
function Pill({
|
|
19753
19406
|
label,
|
|
19754
19407
|
onClick,
|
|
19755
|
-
disabled
|
|
19756
|
-
active
|
|
19757
|
-
children
|
|
19758
|
-
}) {
|
|
19759
|
-
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19760
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
19761
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
19762
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19763
|
-
] });
|
|
19764
|
-
}
|
|
19765
|
-
function ToolbarSeparator() {
|
|
19766
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19767
|
-
}
|
|
19768
|
-
function OptionMenu({
|
|
19769
|
-
label,
|
|
19770
|
-
value,
|
|
19771
|
-
options,
|
|
19772
|
-
onChange
|
|
19408
|
+
disabled,
|
|
19409
|
+
active
|
|
19773
19410
|
}) {
|
|
19774
|
-
|
|
19775
|
-
|
|
19776
|
-
|
|
19777
|
-
|
|
19778
|
-
|
|
19779
|
-
|
|
19780
|
-
|
|
19781
|
-
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19792
|
-
|
|
19793
|
-
|
|
19411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19412
|
+
"button",
|
|
19413
|
+
{
|
|
19414
|
+
type: "button",
|
|
19415
|
+
onClick,
|
|
19416
|
+
disabled,
|
|
19417
|
+
style: {
|
|
19418
|
+
height: 28,
|
|
19419
|
+
padding: "0 10px",
|
|
19420
|
+
display: "inline-flex",
|
|
19421
|
+
alignItems: "center",
|
|
19422
|
+
gap: 4,
|
|
19423
|
+
borderRadius: 999,
|
|
19424
|
+
border: "none",
|
|
19425
|
+
cursor: disabled ? "default" : "pointer",
|
|
19426
|
+
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19427
|
+
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19428
|
+
opacity: disabled ? 0.4 : 1,
|
|
19429
|
+
fontSize: 12,
|
|
19430
|
+
lineHeight: "16px",
|
|
19431
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19432
|
+
whiteSpace: "nowrap",
|
|
19433
|
+
flex: "0 0 auto"
|
|
19434
|
+
},
|
|
19435
|
+
children: label
|
|
19436
|
+
}
|
|
19437
|
+
);
|
|
19438
|
+
}
|
|
19439
|
+
function AltInput({ value, onCommit }) {
|
|
19440
|
+
const [draft, setDraft] = (0, import_react13.useState)(value);
|
|
19441
|
+
(0, import_react13.useEffect)(() => setDraft(value), [value]);
|
|
19442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19443
|
+
"div",
|
|
19444
|
+
{
|
|
19445
|
+
style: {
|
|
19446
|
+
display: "flex",
|
|
19447
|
+
alignItems: "center",
|
|
19448
|
+
gap: 6,
|
|
19449
|
+
height: 28,
|
|
19450
|
+
padding: "0 12px",
|
|
19451
|
+
borderRadius: 999,
|
|
19452
|
+
background: "#ffffff",
|
|
19453
|
+
width: "100%",
|
|
19454
|
+
maxWidth: 260,
|
|
19455
|
+
boxSizing: "border-box"
|
|
19456
|
+
},
|
|
19457
|
+
children: [
|
|
19458
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19459
|
+
"span",
|
|
19794
19460
|
{
|
|
19795
|
-
|
|
19796
|
-
|
|
19797
|
-
|
|
19798
|
-
|
|
19799
|
-
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
)
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19461
|
+
style: {
|
|
19462
|
+
flex: "0 0 auto",
|
|
19463
|
+
color: OHW_BLUE_DARK,
|
|
19464
|
+
fontSize: 10,
|
|
19465
|
+
fontWeight: 700,
|
|
19466
|
+
textTransform: "uppercase",
|
|
19467
|
+
letterSpacing: 0.4
|
|
19468
|
+
},
|
|
19469
|
+
children: "Alt"
|
|
19470
|
+
}
|
|
19471
|
+
),
|
|
19472
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19473
|
+
"input",
|
|
19474
|
+
{
|
|
19475
|
+
type: "text",
|
|
19476
|
+
value: draft,
|
|
19477
|
+
onChange: (e) => setDraft(e.target.value),
|
|
19478
|
+
onBlur: () => {
|
|
19479
|
+
if (draft !== value) onCommit(draft);
|
|
19480
|
+
},
|
|
19481
|
+
onKeyDown: (e) => {
|
|
19482
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
19483
|
+
if (e.key === "Escape") {
|
|
19484
|
+
setDraft(value);
|
|
19485
|
+
e.currentTarget.blur();
|
|
19486
|
+
}
|
|
19487
|
+
},
|
|
19488
|
+
placeholder: "Describe this image",
|
|
19489
|
+
"aria-label": "Image alt text",
|
|
19490
|
+
style: {
|
|
19491
|
+
flex: 1,
|
|
19492
|
+
minWidth: 0,
|
|
19493
|
+
border: "none",
|
|
19494
|
+
outline: "none",
|
|
19495
|
+
background: "transparent",
|
|
19496
|
+
fontSize: 12,
|
|
19497
|
+
lineHeight: "16px",
|
|
19498
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19499
|
+
color: "#1f2937"
|
|
19500
|
+
}
|
|
19501
|
+
}
|
|
19502
|
+
)
|
|
19503
|
+
]
|
|
19504
|
+
}
|
|
19505
|
+
);
|
|
19809
19506
|
}
|
|
19810
19507
|
var VARIANTS = [
|
|
19811
19508
|
{ value: "logos", label: "Logos" },
|
|
19812
19509
|
{ value: "reel", label: "Reel" }
|
|
19813
19510
|
];
|
|
19814
19511
|
var ALIGNS = [
|
|
19815
|
-
{ value: "left", label: "
|
|
19816
|
-
{ value: "center", label: "
|
|
19817
|
-
{ value: "right", label: "
|
|
19512
|
+
{ value: "left", label: "Left" },
|
|
19513
|
+
{ value: "center", label: "Center" },
|
|
19514
|
+
{ value: "right", label: "Right" }
|
|
19818
19515
|
];
|
|
19819
19516
|
var HOVERS = [
|
|
19820
19517
|
{ value: "none", label: "None" },
|
|
@@ -19822,104 +19519,104 @@ var HOVERS = [
|
|
|
19822
19519
|
{ value: "zoom", label: "Zoom" },
|
|
19823
19520
|
{ value: "fade", label: "Fade" }
|
|
19824
19521
|
];
|
|
19522
|
+
var TREATMENTS = [
|
|
19523
|
+
{ value: "color", label: "Color" },
|
|
19524
|
+
{ value: "grayscale", label: "Grayscale" }
|
|
19525
|
+
];
|
|
19825
19526
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19826
|
-
function
|
|
19827
|
-
|
|
19828
|
-
linkTarget,
|
|
19829
|
-
onClose,
|
|
19830
|
-
onSave
|
|
19831
|
-
}) {
|
|
19832
|
-
const [draft, setDraft] = (0, import_react13.useState)(href);
|
|
19833
|
-
const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
|
|
19527
|
+
function LinkInput({ value, onCommit }) {
|
|
19528
|
+
const [draft, setDraft] = (0, import_react13.useState)(value);
|
|
19834
19529
|
const [invalid, setInvalid] = (0, import_react13.useState)(false);
|
|
19835
|
-
|
|
19530
|
+
(0, import_react13.useEffect)(() => {
|
|
19531
|
+
setDraft(value);
|
|
19532
|
+
setInvalid(false);
|
|
19533
|
+
}, [value]);
|
|
19534
|
+
const commit2 = () => {
|
|
19836
19535
|
const next = draft.trim();
|
|
19837
|
-
if (next
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19842
|
-
onClose();
|
|
19536
|
+
if (next === value) return setInvalid(false);
|
|
19537
|
+
if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
|
|
19538
|
+
setInvalid(false);
|
|
19539
|
+
onCommit(next);
|
|
19843
19540
|
};
|
|
19844
|
-
return /* @__PURE__ */ (0,
|
|
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
|
-
|
|
19907
|
-
|
|
19908
|
-
|
|
19541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19542
|
+
"div",
|
|
19543
|
+
{
|
|
19544
|
+
style: {
|
|
19545
|
+
display: "flex",
|
|
19546
|
+
alignItems: "center",
|
|
19547
|
+
gap: 6,
|
|
19548
|
+
height: 28,
|
|
19549
|
+
padding: "0 12px",
|
|
19550
|
+
borderRadius: 999,
|
|
19551
|
+
background: "#ffffff",
|
|
19552
|
+
width: "100%",
|
|
19553
|
+
maxWidth: 260,
|
|
19554
|
+
boxSizing: "border-box",
|
|
19555
|
+
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19556
|
+
},
|
|
19557
|
+
children: [
|
|
19558
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19559
|
+
"span",
|
|
19560
|
+
{
|
|
19561
|
+
style: {
|
|
19562
|
+
flex: "0 0 auto",
|
|
19563
|
+
color: OHW_BLUE_DARK,
|
|
19564
|
+
fontSize: 10,
|
|
19565
|
+
fontWeight: 700,
|
|
19566
|
+
textTransform: "uppercase",
|
|
19567
|
+
letterSpacing: 0.4
|
|
19568
|
+
},
|
|
19569
|
+
children: "Link"
|
|
19570
|
+
}
|
|
19571
|
+
),
|
|
19572
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19573
|
+
"input",
|
|
19574
|
+
{
|
|
19575
|
+
type: "text",
|
|
19576
|
+
inputMode: "url",
|
|
19577
|
+
value: draft,
|
|
19578
|
+
onChange: (e) => setDraft(e.target.value),
|
|
19579
|
+
onBlur: commit2,
|
|
19580
|
+
onKeyDown: (e) => {
|
|
19581
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
19582
|
+
if (e.key === "Escape") {
|
|
19583
|
+
setDraft(value);
|
|
19584
|
+
setInvalid(false);
|
|
19585
|
+
e.currentTarget.blur();
|
|
19586
|
+
}
|
|
19587
|
+
},
|
|
19588
|
+
placeholder: "https://example.com",
|
|
19589
|
+
"aria-label": "Image link URL",
|
|
19590
|
+
"aria-invalid": invalid,
|
|
19591
|
+
style: {
|
|
19592
|
+
flex: 1,
|
|
19593
|
+
minWidth: 0,
|
|
19594
|
+
border: "none",
|
|
19595
|
+
outline: "none",
|
|
19596
|
+
background: "transparent",
|
|
19597
|
+
fontSize: 12,
|
|
19598
|
+
lineHeight: "16px",
|
|
19599
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19600
|
+
color: "#1f2937"
|
|
19601
|
+
}
|
|
19602
|
+
}
|
|
19603
|
+
)
|
|
19604
|
+
]
|
|
19605
|
+
}
|
|
19606
|
+
);
|
|
19909
19607
|
}
|
|
19910
19608
|
function MediaStripToolbar({
|
|
19911
19609
|
entry,
|
|
19912
19610
|
index,
|
|
19913
19611
|
pending,
|
|
19914
19612
|
error,
|
|
19915
|
-
itemEditOn,
|
|
19916
|
-
onToggleItemEdit,
|
|
19917
19613
|
onSetVariant,
|
|
19918
19614
|
onSetAlign,
|
|
19919
19615
|
onSetHover,
|
|
19920
19616
|
onSetTreatment,
|
|
19921
19617
|
onResize,
|
|
19922
|
-
|
|
19618
|
+
onSetAlt,
|
|
19619
|
+
onSetLink,
|
|
19923
19620
|
onAddItem,
|
|
19924
19621
|
onRemoveItem,
|
|
19925
19622
|
onChangeImage,
|
|
@@ -19928,102 +19625,81 @@ function MediaStripToolbar({
|
|
|
19928
19625
|
}) {
|
|
19929
19626
|
const items = mediaStripItems(entry.tree);
|
|
19930
19627
|
const itemCount = items.length;
|
|
19628
|
+
const currentAlt = items[index]?.alt ?? "";
|
|
19629
|
+
const currentHref2 = items[index]?.href ?? "";
|
|
19630
|
+
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19931
19631
|
const slots = findMediaStripSlots(entry.tree);
|
|
19932
19632
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19933
19633
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19934
19634
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19935
19635
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19936
19636
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19937
|
-
const
|
|
19938
|
-
const
|
|
19939
|
-
|
|
19637
|
+
const isMobile = window.innerWidth <= 480;
|
|
19638
|
+
const rowStyle = isMobile ? {
|
|
19639
|
+
display: "flex",
|
|
19640
|
+
gap: 6,
|
|
19641
|
+
flexWrap: "nowrap",
|
|
19642
|
+
justifyContent: "center",
|
|
19643
|
+
overflowX: "auto",
|
|
19644
|
+
WebkitOverflowScrolling: "touch",
|
|
19645
|
+
width: "100%",
|
|
19646
|
+
scrollbarWidth: "none"
|
|
19647
|
+
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
19940
19649
|
"div",
|
|
19941
19650
|
{
|
|
19942
19651
|
"data-ohw-bridge": "",
|
|
19943
19652
|
"data-ohw-toolbar": "",
|
|
19944
19653
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19945
|
-
|
|
19946
|
-
|
|
19654
|
+
style: {
|
|
19655
|
+
display: "flex",
|
|
19656
|
+
flexDirection: "column",
|
|
19657
|
+
gap: 6,
|
|
19658
|
+
alignItems: "center",
|
|
19659
|
+
background: OHW_BLUE,
|
|
19660
|
+
padding: 8,
|
|
19661
|
+
borderRadius: 12,
|
|
19662
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19663
|
+
pointerEvents: pending ? "none" : "auto",
|
|
19664
|
+
opacity: pending ? 0.6 : 1,
|
|
19665
|
+
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19666
|
+
},
|
|
19947
19667
|
children: [
|
|
19948
|
-
/* @__PURE__ */ (0,
|
|
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
|
-
|
|
19980
|
-
) }),
|
|
19981
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19982
|
-
] }),
|
|
19983
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19984
|
-
/* @__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" } }) }),
|
|
19985
|
-
/* @__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" } }) }),
|
|
19986
|
-
/* @__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" } }) }),
|
|
19987
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
19988
|
-
ToolbarAction,
|
|
19989
|
-
{
|
|
19990
|
-
label: gatedLabel("Move right"),
|
|
19991
|
-
onClick: onMoveRight,
|
|
19992
|
-
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19993
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
19994
|
-
}
|
|
19995
|
-
),
|
|
19996
|
-
/* @__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" } }) }),
|
|
19997
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
19998
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19999
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
20000
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20001
|
-
ToolbarAction,
|
|
20002
|
-
{
|
|
20003
|
-
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
20004
|
-
active: treatment === "grayscale",
|
|
20005
|
-
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
20006
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
20007
|
-
}
|
|
20008
|
-
),
|
|
20009
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20010
|
-
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)),
|
|
20011
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20012
|
-
/* @__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" } }) }),
|
|
20013
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
20014
|
-
sizeValue,
|
|
20015
|
-
"px"
|
|
20016
|
-
] }),
|
|
20017
|
-
/* @__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" } }) }),
|
|
20018
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20019
|
-
/* @__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" } }) })
|
|
20020
|
-
]
|
|
20021
|
-
}
|
|
20022
|
-
),
|
|
20023
|
-
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 })
|
|
19668
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19669
|
+
VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
|
|
19670
|
+
ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
|
|
19671
|
+
] }),
|
|
19672
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19673
|
+
HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
|
|
19674
|
+
TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
|
|
19675
|
+
] }),
|
|
19676
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
19677
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
|
|
19678
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
|
|
19679
|
+
sizeValue,
|
|
19680
|
+
"px"
|
|
19681
|
+
] }),
|
|
19682
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
|
|
19683
|
+
] }),
|
|
19684
|
+
/* @__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 }) }),
|
|
19685
|
+
/* @__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) }) }),
|
|
19686
|
+
currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19687
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
|
|
19688
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
|
|
19689
|
+
] }),
|
|
19690
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19691
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
|
|
19692
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
|
|
19693
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
|
|
19694
|
+
] }),
|
|
19695
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
|
|
19696
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
|
|
19697
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
|
|
19698
|
+
] }),
|
|
19699
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20024
19700
|
]
|
|
20025
19701
|
}
|
|
20026
|
-
)
|
|
19702
|
+
);
|
|
20027
19703
|
}
|
|
20028
19704
|
function findMediaStripSlots(tree) {
|
|
20029
19705
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -20042,23 +19718,31 @@ function AiMediaStripOverlay({
|
|
|
20042
19718
|
}) {
|
|
20043
19719
|
const [hover, setHover] = (0, import_react13.useState)(null);
|
|
20044
19720
|
const [active, setActive] = (0, import_react13.useState)(null);
|
|
20045
|
-
const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
|
|
20046
|
-
const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
|
|
20047
19721
|
const [pending, setPending] = (0, import_react13.useState)(false);
|
|
20048
19722
|
const [error, setError] = (0, import_react13.useState)(null);
|
|
20049
19723
|
const activeRef = (0, import_react13.useRef)(null);
|
|
20050
19724
|
activeRef.current = active;
|
|
20051
|
-
const linkOpenRef = (0, import_react13.useRef)(false);
|
|
20052
|
-
linkOpenRef.current = linkOpen;
|
|
20053
19725
|
(0, import_react13.useEffect)(() => {
|
|
20054
19726
|
const onMove = (e) => {
|
|
20055
|
-
const ref = itemRefFromTarget(e.target);
|
|
20056
19727
|
const t = e.target;
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20060
|
-
|
|
20061
|
-
|
|
19728
|
+
if (!(t instanceof HTMLElement)) return;
|
|
19729
|
+
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]")) {
|
|
19730
|
+
return;
|
|
19731
|
+
}
|
|
19732
|
+
const itemEl = t.closest("[data-ohw-media-strip-item]");
|
|
19733
|
+
if (!itemEl) {
|
|
19734
|
+
setHover(null);
|
|
19735
|
+
return;
|
|
19736
|
+
}
|
|
19737
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19738
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19739
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19740
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19741
|
+
if (!sectionId || Number.isNaN(index)) {
|
|
19742
|
+
setHover(null);
|
|
19743
|
+
return;
|
|
19744
|
+
}
|
|
19745
|
+
setHover({ sectionId, index });
|
|
20062
19746
|
};
|
|
20063
19747
|
const onLeave = () => setHover(null);
|
|
20064
19748
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -20070,25 +19754,23 @@ function AiMediaStripOverlay({
|
|
|
20070
19754
|
}, []);
|
|
20071
19755
|
(0, import_react13.useEffect)(() => {
|
|
20072
19756
|
const onClick = (e) => {
|
|
19757
|
+
const current = activeRef.current;
|
|
19758
|
+
if (!current) return;
|
|
20073
19759
|
const t = e.target;
|
|
20074
|
-
if (!(t instanceof
|
|
20075
|
-
if (t.closest(
|
|
20076
|
-
const
|
|
20077
|
-
if (
|
|
20078
|
-
|
|
20079
|
-
setItemEditOn(false);
|
|
19760
|
+
if (!(t instanceof HTMLElement)) return;
|
|
19761
|
+
if (t.closest("[data-ohw-item-interaction]")) return;
|
|
19762
|
+
const itemEl = findMediaStripItemElement(current.sectionId, current.index);
|
|
19763
|
+
if (itemEl && itemEl.contains(t)) return;
|
|
19764
|
+
setActive(null);
|
|
20080
19765
|
setError(null);
|
|
20081
|
-
setActive(ref);
|
|
20082
19766
|
};
|
|
20083
19767
|
document.addEventListener("click", onClick, true);
|
|
20084
19768
|
return () => document.removeEventListener("click", onClick, true);
|
|
20085
|
-
}, [
|
|
19769
|
+
}, []);
|
|
20086
19770
|
(0, import_react13.useEffect)(() => {
|
|
20087
19771
|
const onBlur = () => {
|
|
20088
19772
|
if (!activeRef.current) return;
|
|
20089
19773
|
setActive(null);
|
|
20090
|
-
setItemEditOn(false);
|
|
20091
|
-
setLinkOpen(false);
|
|
20092
19774
|
setError(null);
|
|
20093
19775
|
};
|
|
20094
19776
|
window.addEventListener("blur", onBlur);
|
|
@@ -20098,10 +19780,7 @@ function AiMediaStripOverlay({
|
|
|
20098
19780
|
const onKeyDown = (e) => {
|
|
20099
19781
|
if (e.key !== "Escape") return;
|
|
20100
19782
|
if (!activeRef.current) return;
|
|
20101
|
-
if (linkOpenRef.current) return;
|
|
20102
|
-
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
20103
19783
|
setActive(null);
|
|
20104
|
-
setItemEditOn(false);
|
|
20105
19784
|
setError(null);
|
|
20106
19785
|
};
|
|
20107
19786
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -20135,133 +19814,137 @@ function AiMediaStripOverlay({
|
|
|
20135
19814
|
tree: nextTree,
|
|
20136
19815
|
label: entry.label,
|
|
20137
19816
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
20138
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
20139
|
-
// The user is already looking at the strip they just edited — recentering the viewport
|
|
20140
|
-
// on every edit reads as the section jumping around.
|
|
20141
|
-
skipScrollIntoView: true
|
|
19817
|
+
...entry.brand ? { brand: entry.brand } : {}
|
|
20142
19818
|
});
|
|
20143
19819
|
return true;
|
|
20144
19820
|
},
|
|
20145
19821
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
20146
19822
|
);
|
|
20147
19823
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19824
|
+
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
20148
19825
|
const activeItemRect = useLiveItemRect(active);
|
|
20149
|
-
const
|
|
20150
|
-
const
|
|
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
|
-
|
|
20181
|
-
|
|
20182
|
-
|
|
19826
|
+
const TOOLBAR_APPROX_H = 170;
|
|
19827
|
+
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
19828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
19829
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19830
|
+
"button",
|
|
19831
|
+
{
|
|
19832
|
+
type: "button",
|
|
19833
|
+
"data-ohw-toolbar": "",
|
|
19834
|
+
onClick: () => {
|
|
19835
|
+
clearInteractionChromeRef.current();
|
|
19836
|
+
setActive(hover);
|
|
19837
|
+
},
|
|
19838
|
+
"aria-label": "Configure media item",
|
|
19839
|
+
style: {
|
|
19840
|
+
position: "fixed",
|
|
19841
|
+
top: hoverHandleRect.top + 8,
|
|
19842
|
+
left: hoverHandleRect.left + hoverHandleRect.width - 36,
|
|
19843
|
+
width: 28,
|
|
19844
|
+
height: 28,
|
|
19845
|
+
borderRadius: 8,
|
|
19846
|
+
border: `1.5px dashed ${PRIMARY3}`,
|
|
19847
|
+
background: "#ffffff",
|
|
19848
|
+
color: PRIMARY3,
|
|
19849
|
+
display: "flex",
|
|
19850
|
+
alignItems: "center",
|
|
19851
|
+
justifyContent: "center",
|
|
19852
|
+
cursor: "pointer",
|
|
19853
|
+
zIndex: 2147483643,
|
|
19854
|
+
fontSize: 14,
|
|
19855
|
+
fontWeight: 700
|
|
19856
|
+
},
|
|
19857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
19858
|
+
}
|
|
19859
|
+
),
|
|
19860
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19861
|
+
ItemInteractionLayer,
|
|
19862
|
+
{
|
|
19863
|
+
rect: activeItemRect,
|
|
19864
|
+
state: toolbarState,
|
|
19865
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
19866
|
+
MediaStripToolbar,
|
|
19867
|
+
{
|
|
19868
|
+
entry: activeEntry,
|
|
19869
|
+
index: active.index,
|
|
19870
|
+
pending,
|
|
19871
|
+
error,
|
|
19872
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19873
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19874
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19875
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19876
|
+
onResize: (delta) => {
|
|
19877
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19878
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19879
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19880
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19881
|
+
},
|
|
19882
|
+
onSetAlt: (alt) => {
|
|
19883
|
+
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19884
|
+
},
|
|
19885
|
+
onSetLink: (href, linkTarget) => {
|
|
20183
19886
|
void runMutation(
|
|
20184
19887
|
active.sectionId,
|
|
20185
|
-
(tree) =>
|
|
20186
|
-
|
|
20187
|
-
|
|
20188
|
-
|
|
19888
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
19889
|
+
);
|
|
19890
|
+
},
|
|
19891
|
+
onAddItem: () => {
|
|
19892
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19893
|
+
if (!picked) return;
|
|
19894
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19895
|
+
void runMutation(
|
|
19896
|
+
active.sectionId,
|
|
19897
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19898
|
+
{ [picked.assetId]: picked.url }
|
|
19899
|
+
).then((applied) => {
|
|
19900
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19901
|
+
});
|
|
20189
19902
|
});
|
|
20190
|
-
}
|
|
20191
|
-
|
|
20192
|
-
|
|
20193
|
-
|
|
20194
|
-
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
19903
|
+
},
|
|
19904
|
+
onChangeImage: () => {
|
|
19905
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19906
|
+
if (!picked) return;
|
|
19907
|
+
void runMutation(
|
|
19908
|
+
active.sectionId,
|
|
19909
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19910
|
+
{ [picked.assetId]: picked.url }
|
|
19911
|
+
);
|
|
19912
|
+
});
|
|
19913
|
+
},
|
|
19914
|
+
onRemoveItem: () => {
|
|
19915
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19916
|
+
(applied) => {
|
|
19917
|
+
if (applied) setActive(null);
|
|
19918
|
+
}
|
|
20199
19919
|
);
|
|
20200
|
-
}
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20212
|
-
|
|
20213
|
-
|
|
20214
|
-
|
|
20215
|
-
},
|
|
20216
|
-
onMoveRight: () => {
|
|
20217
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
20218
|
-
(applied) => {
|
|
20219
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20220
|
-
}
|
|
20221
|
-
);
|
|
20222
|
-
}
|
|
20223
|
-
}
|
|
20224
|
-
) }),
|
|
20225
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20226
|
-
"div",
|
|
20227
|
-
{
|
|
20228
|
-
"data-ohw-bridge": "",
|
|
20229
|
-
"data-ohw-item-interaction": "",
|
|
20230
|
-
"aria-hidden": true,
|
|
20231
|
-
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20232
|
-
style: {
|
|
20233
|
-
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20234
|
-
left: activeItemRect.left - 5,
|
|
20235
|
-
background: PRIMARY3,
|
|
20236
|
-
zIndex: 2147483644
|
|
20237
|
-
},
|
|
20238
|
-
children: "Media item"
|
|
20239
|
-
}
|
|
20240
|
-
),
|
|
20241
|
-
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20242
|
-
LinkModal,
|
|
20243
|
-
{
|
|
20244
|
-
href: activeHref,
|
|
20245
|
-
linkTarget: activeTarget,
|
|
20246
|
-
onClose: () => setLinkOpen(false),
|
|
20247
|
-
onSave: (href, linkTarget) => {
|
|
20248
|
-
void runMutation(
|
|
20249
|
-
active.sectionId,
|
|
20250
|
-
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20251
|
-
);
|
|
19920
|
+
},
|
|
19921
|
+
onMoveLeft: () => {
|
|
19922
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19923
|
+
(applied) => {
|
|
19924
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19925
|
+
}
|
|
19926
|
+
);
|
|
19927
|
+
},
|
|
19928
|
+
onMoveRight: () => {
|
|
19929
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19930
|
+
(applied) => {
|
|
19931
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19932
|
+
}
|
|
19933
|
+
);
|
|
19934
|
+
}
|
|
20252
19935
|
}
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
19936
|
+
)
|
|
19937
|
+
}
|
|
19938
|
+
)
|
|
20256
19939
|
] });
|
|
20257
19940
|
}
|
|
20258
19941
|
|
|
20259
19942
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
20260
19943
|
var import_react14 = require("react");
|
|
20261
|
-
var
|
|
20262
|
-
var
|
|
19944
|
+
var import_lucide_react9 = require("lucide-react");
|
|
19945
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
20263
19946
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
20264
|
-
var
|
|
19947
|
+
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]";
|
|
20265
19948
|
function findPricingCardElement(sectionId, index) {
|
|
20266
19949
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20267
19950
|
if (!sectionEl2) return null;
|
|
@@ -20273,7 +19956,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
20273
19956
|
}
|
|
20274
19957
|
function cardRefFromTarget(target) {
|
|
20275
19958
|
if (!(target instanceof Element)) return null;
|
|
20276
|
-
if (target.closest(
|
|
19959
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
20277
19960
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
20278
19961
|
if (!cardEl) return null;
|
|
20279
19962
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -20283,21 +19966,21 @@ function cardRefFromTarget(target) {
|
|
|
20283
19966
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
20284
19967
|
return { sectionId, index };
|
|
20285
19968
|
}
|
|
20286
|
-
function
|
|
19969
|
+
function sameRef(a, b) {
|
|
20287
19970
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
20288
19971
|
}
|
|
20289
|
-
function
|
|
19972
|
+
function rectOf(el) {
|
|
20290
19973
|
if (!el) return null;
|
|
20291
19974
|
const r2 = el.getBoundingClientRect();
|
|
20292
19975
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
20293
19976
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20294
19977
|
}
|
|
20295
19978
|
function readRect3(ref) {
|
|
20296
|
-
return
|
|
19979
|
+
return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
20297
19980
|
}
|
|
20298
19981
|
function readGridRect(ref) {
|
|
20299
19982
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
20300
|
-
return
|
|
19983
|
+
return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
20301
19984
|
}
|
|
20302
19985
|
function useLiveCardRect(ref, grid = false) {
|
|
20303
19986
|
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
@@ -20327,7 +20010,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
20327
20010
|
}
|
|
20328
20011
|
var TOOLBAR_GRID_GAP = 52;
|
|
20329
20012
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
20330
|
-
var
|
|
20013
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
20331
20014
|
function GridToolbarSlot({ gridRect, children }) {
|
|
20332
20015
|
const slotRef = (0, import_react14.useRef)(null);
|
|
20333
20016
|
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
@@ -20339,7 +20022,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20339
20022
|
const w = slot.offsetWidth;
|
|
20340
20023
|
if (w <= 0) return;
|
|
20341
20024
|
const half = w / 2;
|
|
20342
|
-
const clamped = Math.max(
|
|
20025
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
20343
20026
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
20344
20027
|
};
|
|
20345
20028
|
clamp();
|
|
@@ -20348,7 +20031,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
20348
20031
|
return () => ro.disconnect();
|
|
20349
20032
|
}, [centerX, children]);
|
|
20350
20033
|
const mobile = window.innerWidth <= 480;
|
|
20351
|
-
return /* @__PURE__ */ (0,
|
|
20034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20352
20035
|
"div",
|
|
20353
20036
|
{
|
|
20354
20037
|
ref: slotRef,
|
|
@@ -20383,7 +20066,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
20383
20066
|
});
|
|
20384
20067
|
}
|
|
20385
20068
|
function StyleSwatch({ style }) {
|
|
20386
|
-
return /* @__PURE__ */ (0,
|
|
20069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20387
20070
|
"span",
|
|
20388
20071
|
{
|
|
20389
20072
|
"aria-hidden": true,
|
|
@@ -20397,35 +20080,35 @@ function StyleSwatch({ style }) {
|
|
|
20397
20080
|
);
|
|
20398
20081
|
}
|
|
20399
20082
|
function ButtonGlyph() {
|
|
20400
|
-
return /* @__PURE__ */ (0,
|
|
20401
|
-
/* @__PURE__ */ (0,
|
|
20402
|
-
/* @__PURE__ */ (0,
|
|
20083
|
+
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: [
|
|
20084
|
+
/* @__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" }),
|
|
20085
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20403
20086
|
] });
|
|
20404
20087
|
}
|
|
20405
20088
|
function FeatureGlyph({ mode }) {
|
|
20406
|
-
return /* @__PURE__ */ (0,
|
|
20407
|
-
/* @__PURE__ */ (0,
|
|
20408
|
-
/* @__PURE__ */ (0,
|
|
20409
|
-
/* @__PURE__ */ (0,
|
|
20410
|
-
/* @__PURE__ */ (0,
|
|
20411
|
-
/* @__PURE__ */ (0,
|
|
20412
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
20089
|
+
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: [
|
|
20090
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20091
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20092
|
+
/* @__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" }),
|
|
20093
|
+
/* @__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" }),
|
|
20094
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20095
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
20413
20096
|
] });
|
|
20414
20097
|
}
|
|
20415
|
-
function
|
|
20098
|
+
function ToolbarAction({
|
|
20416
20099
|
label,
|
|
20417
20100
|
onClick,
|
|
20418
20101
|
disabled = false,
|
|
20419
20102
|
children
|
|
20420
20103
|
}) {
|
|
20421
|
-
const button = /* @__PURE__ */ (0,
|
|
20422
|
-
return /* @__PURE__ */ (0,
|
|
20423
|
-
/* @__PURE__ */ (0,
|
|
20424
|
-
/* @__PURE__ */ (0,
|
|
20104
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20106
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
20107
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
20425
20108
|
] });
|
|
20426
20109
|
}
|
|
20427
|
-
function
|
|
20428
|
-
return /* @__PURE__ */ (0,
|
|
20110
|
+
function ToolbarSeparator() {
|
|
20111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
20429
20112
|
}
|
|
20430
20113
|
function CardStyleMenu({
|
|
20431
20114
|
value,
|
|
@@ -20433,7 +20116,7 @@ function CardStyleMenu({
|
|
|
20433
20116
|
disabled = false
|
|
20434
20117
|
}) {
|
|
20435
20118
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
20436
|
-
const trigger = /* @__PURE__ */ (0,
|
|
20119
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20437
20120
|
"button",
|
|
20438
20121
|
{
|
|
20439
20122
|
type: "button",
|
|
@@ -20444,28 +20127,28 @@ function CardStyleMenu({
|
|
|
20444
20127
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
20445
20128
|
),
|
|
20446
20129
|
children: [
|
|
20447
|
-
/* @__PURE__ */ (0,
|
|
20448
|
-
/* @__PURE__ */ (0,
|
|
20449
|
-
/* @__PURE__ */ (0,
|
|
20130
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
|
|
20131
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
20132
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
20450
20133
|
]
|
|
20451
20134
|
}
|
|
20452
20135
|
);
|
|
20453
20136
|
if (disabled) {
|
|
20454
|
-
return /* @__PURE__ */ (0,
|
|
20455
|
-
/* @__PURE__ */ (0,
|
|
20456
|
-
/* @__PURE__ */ (0,
|
|
20457
|
-
/* @__PURE__ */ (0,
|
|
20458
|
-
/* @__PURE__ */ (0,
|
|
20137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20138
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20139
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20140
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
20141
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
20459
20142
|
] })
|
|
20460
20143
|
] });
|
|
20461
20144
|
}
|
|
20462
|
-
return /* @__PURE__ */ (0,
|
|
20463
|
-
/* @__PURE__ */ (0,
|
|
20464
|
-
/* @__PURE__ */ (0,
|
|
20465
|
-
/* @__PURE__ */ (0,
|
|
20466
|
-
/* @__PURE__ */ (0,
|
|
20145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20146
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20147
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
20148
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20149
|
+
/* @__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) => {
|
|
20467
20150
|
const selected = style.value === value;
|
|
20468
|
-
return /* @__PURE__ */ (0,
|
|
20151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20469
20152
|
DropdownMenuItem,
|
|
20470
20153
|
{
|
|
20471
20154
|
role: "menuitemradio",
|
|
@@ -20473,9 +20156,9 @@ function CardStyleMenu({
|
|
|
20473
20156
|
onSelect: () => onChange(style.value),
|
|
20474
20157
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
20475
20158
|
children: [
|
|
20476
|
-
/* @__PURE__ */ (0,
|
|
20477
|
-
/* @__PURE__ */ (0,
|
|
20478
|
-
selected && /* @__PURE__ */ (0,
|
|
20159
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
|
|
20160
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
|
|
20161
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
20479
20162
|
]
|
|
20480
20163
|
},
|
|
20481
20164
|
style.value
|
|
@@ -20505,7 +20188,7 @@ function PricingCardToolbar({
|
|
|
20505
20188
|
const style = pricingCardStyle(entry.tree, index);
|
|
20506
20189
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
20507
20190
|
const mobile = window.innerWidth <= 480;
|
|
20508
|
-
return /* @__PURE__ */ (0,
|
|
20191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20509
20192
|
"div",
|
|
20510
20193
|
{
|
|
20511
20194
|
"data-ohw-bridge": "",
|
|
@@ -20517,7 +20200,7 @@ function PricingCardToolbar({
|
|
|
20517
20200
|
),
|
|
20518
20201
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
20519
20202
|
children: [
|
|
20520
|
-
/* @__PURE__ */ (0,
|
|
20203
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
20521
20204
|
"div",
|
|
20522
20205
|
{
|
|
20523
20206
|
className: cn(
|
|
@@ -20526,8 +20209,8 @@ function PricingCardToolbar({
|
|
|
20526
20209
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
20527
20210
|
),
|
|
20528
20211
|
children: [
|
|
20529
|
-
/* @__PURE__ */ (0,
|
|
20530
|
-
/* @__PURE__ */ (0,
|
|
20212
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
20213
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20531
20214
|
CustomToolbarButton,
|
|
20532
20215
|
{
|
|
20533
20216
|
type: "button",
|
|
@@ -20535,8 +20218,8 @@ function PricingCardToolbar({
|
|
|
20535
20218
|
"aria-pressed": featuredTag,
|
|
20536
20219
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
20537
20220
|
className: "group size-8",
|
|
20538
|
-
children: /* @__PURE__ */ (0,
|
|
20539
|
-
|
|
20221
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20222
|
+
import_lucide_react9.Star,
|
|
20540
20223
|
{
|
|
20541
20224
|
size: 16,
|
|
20542
20225
|
fill: "currentColor",
|
|
@@ -20550,25 +20233,25 @@ function PricingCardToolbar({
|
|
|
20550
20233
|
)
|
|
20551
20234
|
}
|
|
20552
20235
|
) }),
|
|
20553
|
-
/* @__PURE__ */ (0,
|
|
20236
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
20554
20237
|
] }),
|
|
20555
|
-
/* @__PURE__ */ (0,
|
|
20556
|
-
/* @__PURE__ */ (0,
|
|
20557
|
-
/* @__PURE__ */ (0,
|
|
20558
|
-
/* @__PURE__ */ (0,
|
|
20559
|
-
/* @__PURE__ */ (0,
|
|
20560
|
-
/* @__PURE__ */ (0,
|
|
20561
|
-
/* @__PURE__ */ (0,
|
|
20238
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20239
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20240
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20241
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
|
|
20242
|
+
/* @__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: [
|
|
20243
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
|
|
20244
|
+
/* @__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" })
|
|
20562
20245
|
] }) }),
|
|
20563
|
-
/* @__PURE__ */ (0,
|
|
20564
|
-
/* @__PURE__ */ (0,
|
|
20565
|
-
/* @__PURE__ */ (0,
|
|
20566
|
-
/* @__PURE__ */ (0,
|
|
20567
|
-
/* @__PURE__ */ (0,
|
|
20246
|
+
/* @__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" }) }),
|
|
20247
|
+
/* @__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" }) }),
|
|
20248
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
20249
|
+
/* @__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" } }) }),
|
|
20250
|
+
/* @__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" } }) })
|
|
20568
20251
|
]
|
|
20569
20252
|
}
|
|
20570
20253
|
),
|
|
20571
|
-
error && /* @__PURE__ */ (0,
|
|
20254
|
+
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 })
|
|
20572
20255
|
]
|
|
20573
20256
|
}
|
|
20574
20257
|
) });
|
|
@@ -20602,7 +20285,7 @@ function AiPricingCardOverlay({
|
|
|
20602
20285
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
20603
20286
|
setHover((prev) => {
|
|
20604
20287
|
const next = ref && !overEditable ? ref : null;
|
|
20605
|
-
return
|
|
20288
|
+
return sameRef(prev, next) ? prev : next;
|
|
20606
20289
|
});
|
|
20607
20290
|
};
|
|
20608
20291
|
const onLeave = () => setHover(null);
|
|
@@ -20617,10 +20300,10 @@ function AiPricingCardOverlay({
|
|
|
20617
20300
|
const onClick = (e) => {
|
|
20618
20301
|
const t = e.target;
|
|
20619
20302
|
if (!(t instanceof Element)) return;
|
|
20620
|
-
if (t.closest(
|
|
20303
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
20621
20304
|
const ref = cardRefFromTarget(t);
|
|
20622
|
-
setActive((prev) =>
|
|
20623
|
-
if (!ref || !
|
|
20305
|
+
setActive((prev) => sameRef(prev, ref) ? prev : ref);
|
|
20306
|
+
if (!ref || !sameRef(activeRef.current, ref)) setError(null);
|
|
20624
20307
|
};
|
|
20625
20308
|
document.addEventListener("click", onClick, true);
|
|
20626
20309
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -20685,12 +20368,12 @@ function AiPricingCardOverlay({
|
|
|
20685
20368
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20686
20369
|
const activeCardRect = useLiveCardRect(active);
|
|
20687
20370
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20688
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20689
|
-
return /* @__PURE__ */ (0,
|
|
20690
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
20691
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20692
|
-
/* @__PURE__ */ (0,
|
|
20693
|
-
/* @__PURE__ */ (0,
|
|
20371
|
+
const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
|
|
20372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20373
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20374
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
20375
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20376
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20694
20377
|
PricingCardToolbar,
|
|
20695
20378
|
{
|
|
20696
20379
|
entry: activeEntry,
|
|
@@ -20718,7 +20401,7 @@ function AiPricingCardOverlay({
|
|
|
20718
20401
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20719
20402
|
}
|
|
20720
20403
|
) }),
|
|
20721
|
-
/* @__PURE__ */ (0,
|
|
20404
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
20722
20405
|
"div",
|
|
20723
20406
|
{
|
|
20724
20407
|
"data-ohw-bridge": "",
|
|
@@ -20740,7 +20423,7 @@ function AiPricingCardOverlay({
|
|
|
20740
20423
|
|
|
20741
20424
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20742
20425
|
var import_react15 = require("react");
|
|
20743
|
-
var
|
|
20426
|
+
var import_lucide_react10 = require("lucide-react");
|
|
20744
20427
|
|
|
20745
20428
|
// src/lib/ai-video-tree.ts
|
|
20746
20429
|
function resolveVideoBlock(tree, path) {
|
|
@@ -20782,11 +20465,39 @@ function clearVideo(tree, path) {
|
|
|
20782
20465
|
});
|
|
20783
20466
|
}
|
|
20784
20467
|
|
|
20468
|
+
// src/lib/youtube.ts
|
|
20469
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20470
|
+
function extractYouTubeId(input) {
|
|
20471
|
+
const trimmed = input.trim();
|
|
20472
|
+
if (!trimmed) return null;
|
|
20473
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20474
|
+
let url;
|
|
20475
|
+
try {
|
|
20476
|
+
url = new URL(trimmed);
|
|
20477
|
+
} catch {
|
|
20478
|
+
return null;
|
|
20479
|
+
}
|
|
20480
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
20481
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20482
|
+
return null;
|
|
20483
|
+
}
|
|
20484
|
+
let candidate = null;
|
|
20485
|
+
if (host === "youtu.be") {
|
|
20486
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20487
|
+
} else if (url.pathname === "/watch") {
|
|
20488
|
+
candidate = url.searchParams.get("v");
|
|
20489
|
+
} else {
|
|
20490
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20491
|
+
candidate = match ? match[1] : null;
|
|
20492
|
+
}
|
|
20493
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20494
|
+
}
|
|
20495
|
+
|
|
20785
20496
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20786
|
-
var
|
|
20497
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
20787
20498
|
var PRIMARY5 = "#0885FE";
|
|
20788
|
-
var
|
|
20789
|
-
var
|
|
20499
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20500
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20790
20501
|
function findVideoBlockElement(sectionId, path) {
|
|
20791
20502
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20792
20503
|
if (!sectionEl2) return null;
|
|
@@ -20846,12 +20557,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20846
20557
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20847
20558
|
});
|
|
20848
20559
|
}
|
|
20849
|
-
function
|
|
20560
|
+
function Pill2({
|
|
20850
20561
|
label,
|
|
20851
20562
|
onClick,
|
|
20852
20563
|
disabled
|
|
20853
20564
|
}) {
|
|
20854
|
-
return /* @__PURE__ */ (0,
|
|
20565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20855
20566
|
"button",
|
|
20856
20567
|
{
|
|
20857
20568
|
type: "button",
|
|
@@ -20867,7 +20578,7 @@ function Pill({
|
|
|
20867
20578
|
border: "none",
|
|
20868
20579
|
cursor: disabled ? "default" : "pointer",
|
|
20869
20580
|
background: "#ffffff",
|
|
20870
|
-
color:
|
|
20581
|
+
color: OHW_BLUE_DARK2,
|
|
20871
20582
|
opacity: disabled ? 0.4 : 1,
|
|
20872
20583
|
fontSize: 12,
|
|
20873
20584
|
lineHeight: "16px",
|
|
@@ -20910,8 +20621,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20910
20621
|
onCommit(id);
|
|
20911
20622
|
}
|
|
20912
20623
|
};
|
|
20913
|
-
return /* @__PURE__ */ (0,
|
|
20914
|
-
/* @__PURE__ */ (0,
|
|
20624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20625
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20915
20626
|
"div",
|
|
20916
20627
|
{
|
|
20917
20628
|
style: {
|
|
@@ -20927,12 +20638,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20927
20638
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20928
20639
|
},
|
|
20929
20640
|
children: [
|
|
20930
|
-
/* @__PURE__ */ (0,
|
|
20641
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20931
20642
|
"span",
|
|
20932
20643
|
{
|
|
20933
20644
|
style: {
|
|
20934
20645
|
flex: "0 0 auto",
|
|
20935
|
-
color:
|
|
20646
|
+
color: OHW_BLUE_DARK2,
|
|
20936
20647
|
fontSize: 10,
|
|
20937
20648
|
lineHeight: "16px",
|
|
20938
20649
|
fontWeight: 700,
|
|
@@ -20942,7 +20653,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20942
20653
|
children: "Video"
|
|
20943
20654
|
}
|
|
20944
20655
|
),
|
|
20945
|
-
/* @__PURE__ */ (0,
|
|
20656
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
20946
20657
|
"input",
|
|
20947
20658
|
{
|
|
20948
20659
|
type: "text",
|
|
@@ -20979,7 +20690,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20979
20690
|
]
|
|
20980
20691
|
}
|
|
20981
20692
|
),
|
|
20982
|
-
invalid && /* @__PURE__ */ (0,
|
|
20693
|
+
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." })
|
|
20983
20694
|
] });
|
|
20984
20695
|
}
|
|
20985
20696
|
function VideoToolbar({
|
|
@@ -20989,7 +20700,7 @@ function VideoToolbar({
|
|
|
20989
20700
|
onSetVideoId,
|
|
20990
20701
|
onRemove
|
|
20991
20702
|
}) {
|
|
20992
|
-
return /* @__PURE__ */ (0,
|
|
20703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
20993
20704
|
"div",
|
|
20994
20705
|
{
|
|
20995
20706
|
"data-ohw-bridge": "",
|
|
@@ -21001,7 +20712,7 @@ function VideoToolbar({
|
|
|
21001
20712
|
gap: 6,
|
|
21002
20713
|
alignItems: "center",
|
|
21003
20714
|
width: 280,
|
|
21004
|
-
background:
|
|
20715
|
+
background: OHW_BLUE2,
|
|
21005
20716
|
padding: 8,
|
|
21006
20717
|
borderRadius: 12,
|
|
21007
20718
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21009,9 +20720,9 @@ function VideoToolbar({
|
|
|
21009
20720
|
opacity: pending ? 0.6 : 1
|
|
21010
20721
|
},
|
|
21011
20722
|
children: [
|
|
21012
|
-
/* @__PURE__ */ (0,
|
|
21013
|
-
/* @__PURE__ */ (0,
|
|
21014
|
-
error && /* @__PURE__ */ (0,
|
|
20723
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20724
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20725
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21015
20726
|
]
|
|
21016
20727
|
}
|
|
21017
20728
|
);
|
|
@@ -21131,8 +20842,8 @@ function AiVideoOverlay({
|
|
|
21131
20842
|
const activeBlockRect = useLiveBlockRect(active);
|
|
21132
20843
|
const TOOLBAR_APPROX_H = 90;
|
|
21133
20844
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21134
|
-
return /* @__PURE__ */ (0,
|
|
21135
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
20845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
20846
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21136
20847
|
"button",
|
|
21137
20848
|
{
|
|
21138
20849
|
type: "button",
|
|
@@ -21160,15 +20871,15 @@ function AiVideoOverlay({
|
|
|
21160
20871
|
fontSize: 14,
|
|
21161
20872
|
fontWeight: 700
|
|
21162
20873
|
},
|
|
21163
|
-
children: /* @__PURE__ */ (0,
|
|
20874
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21164
20875
|
}
|
|
21165
20876
|
),
|
|
21166
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
20877
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21167
20878
|
ItemInteractionLayer,
|
|
21168
20879
|
{
|
|
21169
20880
|
rect: activeBlockRect,
|
|
21170
20881
|
state: toolbarState,
|
|
21171
|
-
toolbar: /* @__PURE__ */ (0,
|
|
20882
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21172
20883
|
VideoToolbar,
|
|
21173
20884
|
{
|
|
21174
20885
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -21192,7 +20903,7 @@ function AiVideoOverlay({
|
|
|
21192
20903
|
|
|
21193
20904
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
21194
20905
|
var import_react16 = require("react");
|
|
21195
|
-
var
|
|
20906
|
+
var import_lucide_react11 = require("lucide-react");
|
|
21196
20907
|
|
|
21197
20908
|
// src/lib/ai-carousel-tree.ts
|
|
21198
20909
|
function isCarouselBlock(node) {
|
|
@@ -21243,10 +20954,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
21243
20954
|
}
|
|
21244
20955
|
|
|
21245
20956
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
21246
|
-
var
|
|
20957
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
21247
20958
|
var PRIMARY6 = "#0885FE";
|
|
21248
|
-
var
|
|
21249
|
-
var
|
|
20959
|
+
var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
20960
|
+
var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
21250
20961
|
function findCarouselItemElement(sectionId, index) {
|
|
21251
20962
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
21252
20963
|
if (!sectionEl2) return null;
|
|
@@ -21325,8 +21036,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
21325
21036
|
postToParent2({ type: "ow:asset-pick", id });
|
|
21326
21037
|
});
|
|
21327
21038
|
}
|
|
21328
|
-
function
|
|
21329
|
-
return /* @__PURE__ */ (0,
|
|
21039
|
+
function Pill3({ label, onClick, disabled }) {
|
|
21040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21330
21041
|
"button",
|
|
21331
21042
|
{
|
|
21332
21043
|
type: "button",
|
|
@@ -21342,7 +21053,7 @@ function Pill2({ label, onClick, disabled }) {
|
|
|
21342
21053
|
border: "none",
|
|
21343
21054
|
cursor: disabled ? "default" : "pointer",
|
|
21344
21055
|
background: "#ffffff",
|
|
21345
|
-
color:
|
|
21056
|
+
color: OHW_BLUE_DARK3,
|
|
21346
21057
|
opacity: disabled ? 0.4 : 1,
|
|
21347
21058
|
fontSize: 12,
|
|
21348
21059
|
lineHeight: "16px",
|
|
@@ -21360,7 +21071,7 @@ function TogglePill({
|
|
|
21360
21071
|
onToggle,
|
|
21361
21072
|
disabled
|
|
21362
21073
|
}) {
|
|
21363
|
-
return /* @__PURE__ */ (0,
|
|
21074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
21364
21075
|
"button",
|
|
21365
21076
|
{
|
|
21366
21077
|
type: "button",
|
|
@@ -21379,7 +21090,7 @@ function TogglePill({
|
|
|
21379
21090
|
border: "none",
|
|
21380
21091
|
cursor: disabled ? "default" : "pointer",
|
|
21381
21092
|
background: "#ffffff",
|
|
21382
|
-
color:
|
|
21093
|
+
color: OHW_BLUE_DARK3,
|
|
21383
21094
|
opacity: disabled ? 0.4 : 1,
|
|
21384
21095
|
fontSize: 12,
|
|
21385
21096
|
lineHeight: "16px",
|
|
@@ -21389,7 +21100,7 @@ function TogglePill({
|
|
|
21389
21100
|
},
|
|
21390
21101
|
children: [
|
|
21391
21102
|
label,
|
|
21392
|
-
/* @__PURE__ */ (0,
|
|
21103
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21393
21104
|
"span",
|
|
21394
21105
|
{
|
|
21395
21106
|
"aria-hidden": true,
|
|
@@ -21402,10 +21113,10 @@ function TogglePill({
|
|
|
21402
21113
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
21403
21114
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
21404
21115
|
// "disabled control" rather than "switch that is off".
|
|
21405
|
-
background: on ?
|
|
21116
|
+
background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
|
|
21406
21117
|
transition: "background 120ms ease"
|
|
21407
21118
|
},
|
|
21408
|
-
children: /* @__PURE__ */ (0,
|
|
21119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21409
21120
|
"span",
|
|
21410
21121
|
{
|
|
21411
21122
|
style: {
|
|
@@ -21434,7 +21145,7 @@ function CarouselSlideToolbar({
|
|
|
21434
21145
|
onChangeImage,
|
|
21435
21146
|
onToggleAutoplay
|
|
21436
21147
|
}) {
|
|
21437
|
-
return /* @__PURE__ */ (0,
|
|
21148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
21438
21149
|
"div",
|
|
21439
21150
|
{
|
|
21440
21151
|
"data-ohw-bridge": "",
|
|
@@ -21445,7 +21156,7 @@ function CarouselSlideToolbar({
|
|
|
21445
21156
|
flexDirection: "column",
|
|
21446
21157
|
gap: 6,
|
|
21447
21158
|
alignItems: "center",
|
|
21448
|
-
background:
|
|
21159
|
+
background: OHW_BLUE3,
|
|
21449
21160
|
padding: 8,
|
|
21450
21161
|
borderRadius: 12,
|
|
21451
21162
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -21457,11 +21168,11 @@ function CarouselSlideToolbar({
|
|
|
21457
21168
|
pointerEvents: pending ? "none" : "auto"
|
|
21458
21169
|
},
|
|
21459
21170
|
children: [
|
|
21460
|
-
/* @__PURE__ */ (0,
|
|
21461
|
-
/* @__PURE__ */ (0,
|
|
21462
|
-
/* @__PURE__ */ (0,
|
|
21171
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21172
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
|
|
21173
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
21463
21174
|
] }),
|
|
21464
|
-
error && /* @__PURE__ */ (0,
|
|
21175
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
21465
21176
|
]
|
|
21466
21177
|
}
|
|
21467
21178
|
);
|
|
@@ -21601,8 +21312,8 @@ function AiFadeCarouselOverlay({
|
|
|
21601
21312
|
const activeItemRect = useLiveItemRect2(active);
|
|
21602
21313
|
const TOOLBAR_APPROX_H = 90;
|
|
21603
21314
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21604
|
-
return /* @__PURE__ */ (0,
|
|
21605
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
21315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
21316
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21606
21317
|
"button",
|
|
21607
21318
|
{
|
|
21608
21319
|
type: "button",
|
|
@@ -21631,10 +21342,10 @@ function AiFadeCarouselOverlay({
|
|
|
21631
21342
|
fontSize: 14,
|
|
21632
21343
|
fontWeight: 700
|
|
21633
21344
|
},
|
|
21634
|
-
children: /* @__PURE__ */ (0,
|
|
21345
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21635
21346
|
}
|
|
21636
21347
|
),
|
|
21637
|
-
swapping && /* @__PURE__ */ (0,
|
|
21348
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21638
21349
|
"div",
|
|
21639
21350
|
{
|
|
21640
21351
|
ref: skeletonRef,
|
|
@@ -21652,15 +21363,15 @@ function AiFadeCarouselOverlay({
|
|
|
21652
21363
|
zIndex: 2147483646,
|
|
21653
21364
|
pointerEvents: "none"
|
|
21654
21365
|
},
|
|
21655
|
-
children: /* @__PURE__ */ (0,
|
|
21366
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
21656
21367
|
}
|
|
21657
21368
|
),
|
|
21658
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
21369
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21659
21370
|
ItemInteractionLayer,
|
|
21660
21371
|
{
|
|
21661
21372
|
rect: activeItemRect,
|
|
21662
21373
|
state: toolbarState,
|
|
21663
|
-
toolbar: /* @__PURE__ */ (0,
|
|
21374
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
21664
21375
|
CarouselSlideToolbar,
|
|
21665
21376
|
{
|
|
21666
21377
|
pending,
|
|
@@ -21851,6 +21562,113 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21851
21562
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21852
21563
|
var import_react20 = require("react");
|
|
21853
21564
|
|
|
21565
|
+
// src/ui/dialog.tsx
|
|
21566
|
+
var React9 = __toESM(require("react"), 1);
|
|
21567
|
+
var import_radix_ui6 = require("radix-ui");
|
|
21568
|
+
var import_lucide_react12 = require("lucide-react");
|
|
21569
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
21570
|
+
function Dialog2({
|
|
21571
|
+
...props
|
|
21572
|
+
}) {
|
|
21573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21574
|
+
}
|
|
21575
|
+
function DialogPortal({
|
|
21576
|
+
...props
|
|
21577
|
+
}) {
|
|
21578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21579
|
+
}
|
|
21580
|
+
function DialogOverlay({
|
|
21581
|
+
className,
|
|
21582
|
+
...props
|
|
21583
|
+
}) {
|
|
21584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21585
|
+
import_radix_ui6.Dialog.Overlay,
|
|
21586
|
+
{
|
|
21587
|
+
"data-slot": "dialog-overlay",
|
|
21588
|
+
"data-ohw-link-modal-root": "",
|
|
21589
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21590
|
+
...props
|
|
21591
|
+
}
|
|
21592
|
+
);
|
|
21593
|
+
}
|
|
21594
|
+
var DialogContent = React9.forwardRef(
|
|
21595
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21596
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
21597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21598
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21599
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
21600
|
+
import_radix_ui6.Dialog.Content,
|
|
21601
|
+
{
|
|
21602
|
+
ref,
|
|
21603
|
+
"data-slot": "dialog-content",
|
|
21604
|
+
className: cn(
|
|
21605
|
+
positionMode,
|
|
21606
|
+
"left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
|
|
21607
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21608
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21609
|
+
className
|
|
21610
|
+
),
|
|
21611
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
21612
|
+
...props,
|
|
21613
|
+
children: [
|
|
21614
|
+
children,
|
|
21615
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21616
|
+
import_radix_ui6.Dialog.Close,
|
|
21617
|
+
{
|
|
21618
|
+
type: "button",
|
|
21619
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21620
|
+
"aria-label": "Close",
|
|
21621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
21622
|
+
}
|
|
21623
|
+
) : null
|
|
21624
|
+
]
|
|
21625
|
+
}
|
|
21626
|
+
)
|
|
21627
|
+
] });
|
|
21628
|
+
}
|
|
21629
|
+
);
|
|
21630
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21631
|
+
function DialogHeader({
|
|
21632
|
+
className,
|
|
21633
|
+
...props
|
|
21634
|
+
}) {
|
|
21635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21636
|
+
}
|
|
21637
|
+
function DialogFooter({
|
|
21638
|
+
className,
|
|
21639
|
+
...props
|
|
21640
|
+
}) {
|
|
21641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21642
|
+
"div",
|
|
21643
|
+
{
|
|
21644
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
21645
|
+
...props
|
|
21646
|
+
}
|
|
21647
|
+
);
|
|
21648
|
+
}
|
|
21649
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21650
|
+
import_radix_ui6.Dialog.Title,
|
|
21651
|
+
{
|
|
21652
|
+
ref,
|
|
21653
|
+
className: cn(
|
|
21654
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21655
|
+
className
|
|
21656
|
+
),
|
|
21657
|
+
...props
|
|
21658
|
+
}
|
|
21659
|
+
));
|
|
21660
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21661
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
21662
|
+
import_radix_ui6.Dialog.Description,
|
|
21663
|
+
{
|
|
21664
|
+
ref,
|
|
21665
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
21666
|
+
...props
|
|
21667
|
+
}
|
|
21668
|
+
));
|
|
21669
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21670
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21671
|
+
|
|
21854
21672
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21855
21673
|
var import_lucide_react16 = require("lucide-react");
|
|
21856
21674
|
|
|
@@ -22954,7 +22772,6 @@ function shouldUseDevFixtures() {
|
|
|
22954
22772
|
function getLogoElement(el) {
|
|
22955
22773
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22956
22774
|
if (marked) return marked;
|
|
22957
|
-
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22958
22775
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22959
22776
|
if (!root) return null;
|
|
22960
22777
|
const anchor = el.closest("a");
|
|
@@ -25771,7 +25588,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25771
25588
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25772
25589
|
return resolveFooterLinksContainerFrom(el);
|
|
25773
25590
|
}
|
|
25774
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") ||
|
|
25591
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25775
25592
|
return getNavigationRoot(el);
|
|
25776
25593
|
}
|
|
25777
25594
|
return null;
|
|
@@ -25993,6 +25810,7 @@ var ICONS = {
|
|
|
25993
25810
|
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"/>',
|
|
25994
25811
|
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"/>'
|
|
25995
25812
|
};
|
|
25813
|
+
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25996
25814
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25997
25815
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25998
25816
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -26090,7 +25908,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
26090
25908
|
el.style.top = `${top}px`;
|
|
26091
25909
|
el.style.height = `${height}px`;
|
|
26092
25910
|
}
|
|
26093
|
-
var
|
|
25911
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
26094
25912
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
26095
25913
|
const isAbove = transform.includes("translateY(-100%)");
|
|
26096
25914
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -26117,8 +25935,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
26117
25935
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
26118
25936
|
const half = toolbarWidth / 2;
|
|
26119
25937
|
return Math.max(
|
|
26120
|
-
|
|
26121
|
-
Math.min(centerX, window.innerWidth -
|
|
25938
|
+
TOOLBAR_EDGE_MARGIN3 + half,
|
|
25939
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
|
|
26122
25940
|
);
|
|
26123
25941
|
}
|
|
26124
25942
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -27001,6 +26819,21 @@ function OhhwellsBridge() {
|
|
|
27001
26819
|
const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
|
|
27002
26820
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
|
|
27003
26821
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26822
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
26823
|
+
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
26824
|
+
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26825
|
+
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
26826
|
+
floatingPanelRef.current = floatingPanel;
|
|
26827
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
26828
|
+
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
26829
|
+
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
26830
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
26831
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
26832
|
+
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
26833
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
26834
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
26835
|
+
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
26836
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
27004
26837
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
|
|
27005
26838
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
|
|
27006
26839
|
const footerDragRef = (0, import_react25.useRef)(null);
|
|
@@ -27027,21 +26860,6 @@ function OhhwellsBridge() {
|
|
|
27027
26860
|
const stylesRef = (0, import_react25.useRef)("");
|
|
27028
26861
|
const appliedDrawerRef = (0, import_react25.useRef)(null);
|
|
27029
26862
|
const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
|
|
27030
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
|
|
27031
|
-
const floatingPanelOpenRef = (0, import_react25.useRef)(false);
|
|
27032
|
-
const floatingPanelRef = (0, import_react25.useRef)(null);
|
|
27033
|
-
floatingPanelRef.current = floatingPanel;
|
|
27034
|
-
const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
|
|
27035
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
|
|
27036
|
-
const buttonCollectionDragRef = (0, import_react25.useRef)(null);
|
|
27037
|
-
const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
|
|
27038
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
|
|
27039
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
|
|
27040
|
-
const buttonPointerDragRef = (0, import_react25.useRef)(null);
|
|
27041
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
|
|
27042
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
|
|
27043
|
-
const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
|
|
27044
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
|
|
27045
26863
|
const [sitePages, setSitePages] = (0, import_react25.useState)([]);
|
|
27046
26864
|
const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
27047
26865
|
const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
|
|
@@ -27051,18 +26869,7 @@ function OhhwellsBridge() {
|
|
|
27051
26869
|
const linkPopoverOpenRef = (0, import_react25.useRef)(false);
|
|
27052
26870
|
const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
|
|
27053
26871
|
setLinkPopoverRef.current = setLinkPopover;
|
|
27054
|
-
setFloatingPanelRef.current = setFloatingPanel;
|
|
27055
26872
|
linkPopoverSessionRef.current = linkPopover;
|
|
27056
|
-
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
27057
|
-
(0, import_react25.useEffect)(() => {
|
|
27058
|
-
const syncViewport = () => {
|
|
27059
|
-
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
27060
|
-
setEditorViewport((prev) => prev === next ? prev : next);
|
|
27061
|
-
};
|
|
27062
|
-
syncViewport();
|
|
27063
|
-
window.addEventListener("resize", syncViewport);
|
|
27064
|
-
return () => window.removeEventListener("resize", syncViewport);
|
|
27065
|
-
}, []);
|
|
27066
26873
|
(0, import_react25.useEffect)(() => {
|
|
27067
26874
|
setSectionOrderPersistHandler((entries) => {
|
|
27068
26875
|
const currentPath = window.location.pathname;
|
|
@@ -28796,7 +28603,6 @@ function OhhwellsBridge() {
|
|
|
28796
28603
|
applyAiFooterFromContent(content);
|
|
28797
28604
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28798
28605
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28799
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28800
28606
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28801
28607
|
}
|
|
28802
28608
|
applyBrandChrome(content);
|
|
@@ -28807,16 +28613,15 @@ function OhhwellsBridge() {
|
|
|
28807
28613
|
if (key === "__ohw_sections") continue;
|
|
28808
28614
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28809
28615
|
if (key === AI_FOOTER_KEY) continue;
|
|
28810
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28811
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28812
28616
|
if (key === BRAND_KIT_KEY) continue;
|
|
28813
28617
|
if (key === STYLE_STORE_KEY) continue;
|
|
28814
28618
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28619
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28815
28620
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28621
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28816
28622
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28817
28623
|
continue;
|
|
28818
28624
|
}
|
|
28819
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28820
28625
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28821
28626
|
if (applyCarouselNode(key, val)) continue;
|
|
28822
28627
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28856,7 +28661,6 @@ function OhhwellsBridge() {
|
|
|
28856
28661
|
});
|
|
28857
28662
|
applyLinkByKey(key, val);
|
|
28858
28663
|
}
|
|
28859
|
-
applySectionEmbeds(content);
|
|
28860
28664
|
applyLogoFromContent(content);
|
|
28861
28665
|
applyLogoSizes(content);
|
|
28862
28666
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -29045,22 +28849,20 @@ function OhhwellsBridge() {
|
|
|
29045
28849
|
}
|
|
29046
28850
|
applyAiFooterFromContent(content);
|
|
29047
28851
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
29048
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
29049
28852
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
29050
28853
|
}
|
|
29051
28854
|
for (const [key, val] of Object.entries(content)) {
|
|
29052
28855
|
if (key === "__ohw_sections") continue;
|
|
29053
28856
|
if (key === AI_SECTIONS_KEY) continue;
|
|
29054
28857
|
if (key === AI_FOOTER_KEY) continue;
|
|
29055
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
29056
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
29057
28858
|
if (key === BRAND_KIT_KEY) continue;
|
|
29058
28859
|
if (key === STYLE_STORE_KEY) continue;
|
|
29059
28860
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28861
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28862
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
29060
28863
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
29061
28864
|
continue;
|
|
29062
28865
|
}
|
|
29063
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
29064
28866
|
if (applyVideoSettingNode(key, val)) continue;
|
|
29065
28867
|
if (applyCarouselNode(key, val)) continue;
|
|
29066
28868
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -29085,7 +28887,6 @@ function OhhwellsBridge() {
|
|
|
29085
28887
|
});
|
|
29086
28888
|
applyLinkByKey(key, val);
|
|
29087
28889
|
}
|
|
29088
|
-
applySectionEmbeds(content);
|
|
29089
28890
|
applyLogoFromContent(content);
|
|
29090
28891
|
reconcileNavbarItemsFromContent(content);
|
|
29091
28892
|
reconcileFooterOrderFromContent(content);
|
|
@@ -29325,11 +29126,26 @@ function OhhwellsBridge() {
|
|
|
29325
29126
|
const t2 = setTimeout(measure, 500);
|
|
29326
29127
|
const ro = new ResizeObserver(schedule);
|
|
29327
29128
|
ro.observe(document.body);
|
|
29129
|
+
let lastWidth = window.innerWidth;
|
|
29130
|
+
let resizeTimers = [];
|
|
29131
|
+
const clearResizeTimers = () => {
|
|
29132
|
+
resizeTimers.forEach(clearTimeout);
|
|
29133
|
+
resizeTimers = [];
|
|
29134
|
+
};
|
|
29135
|
+
const handleResize = () => {
|
|
29136
|
+
if (window.innerWidth === lastWidth) return;
|
|
29137
|
+
lastWidth = window.innerWidth;
|
|
29138
|
+
clearResizeTimers();
|
|
29139
|
+
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
29140
|
+
};
|
|
29141
|
+
window.addEventListener("resize", handleResize);
|
|
29328
29142
|
return () => {
|
|
29329
29143
|
clearTimeout(t1);
|
|
29330
29144
|
clearTimeout(t2);
|
|
29331
29145
|
if (raf != null) cancelAnimationFrame(raf);
|
|
29332
29146
|
ro.disconnect();
|
|
29147
|
+
clearResizeTimers();
|
|
29148
|
+
window.removeEventListener("resize", handleResize);
|
|
29333
29149
|
};
|
|
29334
29150
|
}, [pathname, isEditMode, postToParent2]);
|
|
29335
29151
|
(0, import_react25.useEffect)(() => {
|
|
@@ -29626,13 +29442,6 @@ function OhhwellsBridge() {
|
|
|
29626
29442
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29627
29443
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29628
29444
|
if (isInsideLinkEditor(target)) return;
|
|
29629
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29630
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29631
|
-
if (target.closest(
|
|
29632
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29633
|
-
)) {
|
|
29634
|
-
return;
|
|
29635
|
-
}
|
|
29636
29445
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29637
29446
|
clearMediaSelectionRef.current();
|
|
29638
29447
|
}
|
|
@@ -29656,6 +29465,8 @@ function OhhwellsBridge() {
|
|
|
29656
29465
|
return;
|
|
29657
29466
|
}
|
|
29658
29467
|
}
|
|
29468
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29469
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29659
29470
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29660
29471
|
if (collectionItem) {
|
|
29661
29472
|
e.preventDefault();
|
|
@@ -29667,6 +29478,11 @@ function OhhwellsBridge() {
|
|
|
29667
29478
|
});
|
|
29668
29479
|
return;
|
|
29669
29480
|
}
|
|
29481
|
+
if (target.closest(
|
|
29482
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29483
|
+
)) {
|
|
29484
|
+
return;
|
|
29485
|
+
}
|
|
29670
29486
|
{
|
|
29671
29487
|
const formEl = getFormElement(target);
|
|
29672
29488
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29820,13 +29636,9 @@ function OhhwellsBridge() {
|
|
|
29820
29636
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29821
29637
|
e.preventDefault();
|
|
29822
29638
|
e.stopPropagation();
|
|
29639
|
+
selectIconElementRef.current(editable);
|
|
29823
29640
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29824
29641
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29825
|
-
if (aiIcon) {
|
|
29826
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29827
|
-
} else {
|
|
29828
|
-
selectIconElementRef.current(editable);
|
|
29829
|
-
}
|
|
29830
29642
|
postToParentRef.current({
|
|
29831
29643
|
type: "ow:icon-pick",
|
|
29832
29644
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -30054,9 +29866,6 @@ function OhhwellsBridge() {
|
|
|
30054
29866
|
setHoveredItemRect(null);
|
|
30055
29867
|
hoveredNavContainerRef.current = null;
|
|
30056
29868
|
setHoveredNavContainerRect(null);
|
|
30057
|
-
siblingHintElRef.current = null;
|
|
30058
|
-
setSiblingHintRect(null);
|
|
30059
|
-
setSiblingHintRects([]);
|
|
30060
29869
|
return;
|
|
30061
29870
|
}
|
|
30062
29871
|
{
|
|
@@ -30177,6 +29986,7 @@ function OhhwellsBridge() {
|
|
|
30177
29986
|
hoveredNavContainerRef.current = null;
|
|
30178
29987
|
setHoveredNavContainerRect(null);
|
|
30179
29988
|
hoveredItemElRef.current = editable;
|
|
29989
|
+
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
30180
29990
|
}
|
|
30181
29991
|
}
|
|
30182
29992
|
}
|
|
@@ -30886,11 +30696,7 @@ function OhhwellsBridge() {
|
|
|
30886
30696
|
};
|
|
30887
30697
|
const handleMouseMove = (e) => {
|
|
30888
30698
|
const { clientX, clientY } = e;
|
|
30889
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30890
|
-
dismissImageHover();
|
|
30891
|
-
clearImageHover();
|
|
30892
|
-
return;
|
|
30893
|
-
}
|
|
30699
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
30894
30700
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30895
30701
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30896
30702
|
formHoverElRef.current = null;
|
|
@@ -30919,12 +30725,7 @@ function OhhwellsBridge() {
|
|
|
30919
30725
|
setHoveredItemRect(null);
|
|
30920
30726
|
hoveredNavContainerRef.current = null;
|
|
30921
30727
|
setHoveredNavContainerRect(null);
|
|
30922
|
-
siblingHintElRef.current = null;
|
|
30923
|
-
setSiblingHintRect(null);
|
|
30924
|
-
setSiblingHintRects([]);
|
|
30925
30728
|
dismissImageHover();
|
|
30926
|
-
clearImageHover();
|
|
30927
|
-
setSectionGap(null);
|
|
30928
30729
|
return;
|
|
30929
30730
|
}
|
|
30930
30731
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30936,11 +30737,7 @@ function OhhwellsBridge() {
|
|
|
30936
30737
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30937
30738
|
const { clientX, clientY } = e.data;
|
|
30938
30739
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30939
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30940
|
-
dismissImageHover();
|
|
30941
|
-
clearImageHover();
|
|
30942
|
-
return;
|
|
30943
|
-
}
|
|
30740
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
30944
30741
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30945
30742
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30946
30743
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -31320,7 +31117,6 @@ function OhhwellsBridge() {
|
|
|
31320
31117
|
applyAiFooterFromContent(content);
|
|
31321
31118
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31322
31119
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31323
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31324
31120
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31325
31121
|
}
|
|
31326
31122
|
applyBrandChrome(content);
|
|
@@ -31335,16 +31131,15 @@ function OhhwellsBridge() {
|
|
|
31335
31131
|
}
|
|
31336
31132
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31337
31133
|
if (key === AI_FOOTER_KEY) continue;
|
|
31338
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31339
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31340
31134
|
if (key === BRAND_KIT_KEY) continue;
|
|
31341
31135
|
if (key === STYLE_STORE_KEY) continue;
|
|
31342
31136
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
31137
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31343
31138
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
31139
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
31344
31140
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31345
31141
|
continue;
|
|
31346
31142
|
}
|
|
31347
|
-
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
31348
31143
|
if (applyVideoSettingNode(key, val)) continue;
|
|
31349
31144
|
if (applyCarouselNode(key, val)) continue;
|
|
31350
31145
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -31370,7 +31165,6 @@ function OhhwellsBridge() {
|
|
|
31370
31165
|
});
|
|
31371
31166
|
applyLinkByKey(key, val);
|
|
31372
31167
|
}
|
|
31373
|
-
applySectionEmbeds(content);
|
|
31374
31168
|
applyLogoFromContent(content);
|
|
31375
31169
|
applyLogoSizes(content);
|
|
31376
31170
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -32010,12 +31804,6 @@ function OhhwellsBridge() {
|
|
|
32010
31804
|
closeLinkPopoverRef.current();
|
|
32011
31805
|
return;
|
|
32012
31806
|
}
|
|
32013
|
-
if (floatingPanelOpenRef.current) {
|
|
32014
|
-
setFloatingPanelRef.current(null);
|
|
32015
|
-
deselectRef.current();
|
|
32016
|
-
deactivateRef.current();
|
|
32017
|
-
return;
|
|
32018
|
-
}
|
|
32019
31807
|
deselectRef.current();
|
|
32020
31808
|
deactivateRef.current();
|
|
32021
31809
|
clearMediaSelectionRef.current();
|
|
@@ -32846,10 +32634,10 @@ function OhhwellsBridge() {
|
|
|
32846
32634
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32847
32635
|
window.removeEventListener("message", handleDeactivate);
|
|
32848
32636
|
window.removeEventListener("message", handleSelectNav);
|
|
32637
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32849
32638
|
window.removeEventListener("message", handleToastAction);
|
|
32850
32639
|
window.removeEventListener("message", handleFormCount);
|
|
32851
32640
|
window.removeEventListener("message", handleUiEscape);
|
|
32852
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32853
32641
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32854
32642
|
autoSaveTimers.current.clear();
|
|
32855
32643
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -33143,7 +32931,7 @@ function OhhwellsBridge() {
|
|
|
33143
32931
|
postToParent2({
|
|
33144
32932
|
type: "ow:ready",
|
|
33145
32933
|
version: "1",
|
|
33146
|
-
bridgeVersion: "0.1.
|
|
32934
|
+
bridgeVersion: "0.1.171",
|
|
33147
32935
|
path: pathname,
|
|
33148
32936
|
nodes: collectEditableNodes(editContentRef.current),
|
|
33149
32937
|
sections
|