@ohhwells/bridge 0.1.166 → 0.1.167-next.444
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 +1664 -1333
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1306 -961
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +116 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React12, { useCallback as useCallback12, useEffect as
|
|
4
|
+
import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
|
|
5
5
|
import { createRoot as createRoot3 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync3 } from "react-dom";
|
|
7
7
|
|
|
@@ -1098,21 +1098,21 @@ function chromeFrom(sample) {
|
|
|
1098
1098
|
};
|
|
1099
1099
|
}
|
|
1100
1100
|
function filledPrimary(seed) {
|
|
1101
|
-
const
|
|
1102
|
-
const luminance = relativeLuminance(
|
|
1101
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1102
|
+
const luminance = relativeLuminance(paint2);
|
|
1103
1103
|
return {
|
|
1104
|
-
background: toCss({ ...
|
|
1104
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1105
1105
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1106
1106
|
borderColor: TRANSPARENT,
|
|
1107
1107
|
borderWidth: "0px"
|
|
1108
1108
|
};
|
|
1109
1109
|
}
|
|
1110
1110
|
function generatedSecondary(primary) {
|
|
1111
|
-
const
|
|
1111
|
+
const paint2 = accentColor(primary);
|
|
1112
1112
|
return {
|
|
1113
1113
|
background: TRANSPARENT,
|
|
1114
|
-
color:
|
|
1115
|
-
borderColor:
|
|
1114
|
+
color: paint2,
|
|
1115
|
+
borderColor: paint2,
|
|
1116
1116
|
borderWidth: "1px"
|
|
1117
1117
|
};
|
|
1118
1118
|
}
|
|
@@ -1125,9 +1125,9 @@ function generatedGhost(primary) {
|
|
|
1125
1125
|
};
|
|
1126
1126
|
}
|
|
1127
1127
|
function normalizeOutlineChrome(outline, primary) {
|
|
1128
|
-
const
|
|
1128
|
+
const paint2 = accentColor(primary);
|
|
1129
1129
|
const text = parseColor(outline.color);
|
|
1130
|
-
const paintRgb = parseColor(
|
|
1130
|
+
const paintRgb = parseColor(paint2);
|
|
1131
1131
|
const primaryLabel = parseColor(primary.color);
|
|
1132
1132
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1133
1133
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1136,8 +1136,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1136
1136
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1137
1137
|
return {
|
|
1138
1138
|
...outline,
|
|
1139
|
-
color:
|
|
1140
|
-
borderColor: hasBorder ?
|
|
1139
|
+
color: paint2,
|
|
1140
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1141
1141
|
};
|
|
1142
1142
|
}
|
|
1143
1143
|
function generateButtonVariants(samples) {
|
|
@@ -5431,14 +5431,14 @@ function singleIndexSegment(key) {
|
|
|
5431
5431
|
function indexFromKey(key, position) {
|
|
5432
5432
|
return parseInt(baseKey(key).split("-")[position] ?? "", 10);
|
|
5433
5433
|
}
|
|
5434
|
-
function detectItemGroups(
|
|
5435
|
-
if (isGeneratedSection(
|
|
5434
|
+
function detectItemGroups(sectionEl2) {
|
|
5435
|
+
if (isGeneratedSection(sectionEl2)) return detectGeneratedCards(sectionEl2);
|
|
5436
5436
|
const groups = [];
|
|
5437
5437
|
const seenParents = /* @__PURE__ */ new Set();
|
|
5438
5438
|
const parents = /* @__PURE__ */ new Set();
|
|
5439
|
-
|
|
5439
|
+
sectionEl2.querySelectorAll("[data-ohw-key], [data-ohw-href-key]").forEach((keyedEl) => {
|
|
5440
5440
|
let el = keyedEl;
|
|
5441
|
-
while (el && el !==
|
|
5441
|
+
while (el && el !== sectionEl2) {
|
|
5442
5442
|
if (el.parentElement) parents.add(el.parentElement);
|
|
5443
5443
|
el = el.parentElement;
|
|
5444
5444
|
}
|
|
@@ -5528,8 +5528,8 @@ function detectItemGroups(sectionEl) {
|
|
|
5528
5528
|
}
|
|
5529
5529
|
return groups.sort((a, b) => a.nested === b.nested ? 0 : a.nested ? 1 : -1);
|
|
5530
5530
|
}
|
|
5531
|
-
function detectGeneratedCards(
|
|
5532
|
-
const cards = Array.from(
|
|
5531
|
+
function detectGeneratedCards(sectionEl2) {
|
|
5532
|
+
const cards = Array.from(sectionEl2.querySelectorAll("[data-ohw-card]")).filter(
|
|
5533
5533
|
(el) => !el.parentElement?.closest("[data-ohw-card]")
|
|
5534
5534
|
);
|
|
5535
5535
|
if (cards.length === 0) return [];
|
|
@@ -5538,7 +5538,7 @@ function detectGeneratedCards(sectionEl) {
|
|
|
5538
5538
|
item.el.setAttribute(ITEM_ATTR, `card:${item.index}`);
|
|
5539
5539
|
item.el.setAttribute(ITEM_SURFACE_ATTR, "");
|
|
5540
5540
|
}
|
|
5541
|
-
return [{ group: "card", parent: cards[0].parentElement ??
|
|
5541
|
+
return [{ group: "card", parent: cards[0].parentElement ?? sectionEl2, nested: false, items, generated: true }];
|
|
5542
5542
|
}
|
|
5543
5543
|
function firstTextLabel(item) {
|
|
5544
5544
|
for (const k of item.keyed) {
|
|
@@ -5554,13 +5554,13 @@ function findItemSection(sectionId) {
|
|
|
5554
5554
|
const escaped = CSS.escape(sectionId);
|
|
5555
5555
|
return document.querySelector(`[data-ohw-instance="${escaped}"]`) ?? document.querySelector(`[data-ohw-section="${escaped}"]`);
|
|
5556
5556
|
}
|
|
5557
|
-
function isGeneratedSection(
|
|
5558
|
-
return !!
|
|
5557
|
+
function isGeneratedSection(sectionEl2) {
|
|
5558
|
+
return !!sectionEl2.closest("[data-ohw-ai-generated]") || sectionEl2.hasAttribute("data-ai-section");
|
|
5559
5559
|
}
|
|
5560
|
-
function collectItemGroups(
|
|
5561
|
-
if (isChromeSection(
|
|
5562
|
-
const sectionId = instanceIdOf(
|
|
5563
|
-
return detectItemGroups(
|
|
5560
|
+
function collectItemGroups(sectionEl2) {
|
|
5561
|
+
if (isChromeSection(sectionEl2)) return [];
|
|
5562
|
+
const sectionId = instanceIdOf(sectionEl2);
|
|
5563
|
+
return detectItemGroups(sectionEl2).map((g) => ({
|
|
5564
5564
|
sectionId,
|
|
5565
5565
|
group: g.group,
|
|
5566
5566
|
nested: g.nested,
|
|
@@ -5729,11 +5729,11 @@ function initItemInstancesFromContent(content) {
|
|
|
5729
5729
|
document.querySelectorAll(`[${ITEM_REMOVED_ATTR}]`).forEach((el) => setRemoved(el, false));
|
|
5730
5730
|
if (!store) return;
|
|
5731
5731
|
for (const [sectionId, groups] of Object.entries(store.sections)) {
|
|
5732
|
-
const
|
|
5733
|
-
if (!
|
|
5732
|
+
const sectionEl2 = findItemSection(sectionId);
|
|
5733
|
+
if (!sectionEl2) continue;
|
|
5734
5734
|
const ordered = Object.entries(groups).sort(([a], [b]) => a.length - b.length);
|
|
5735
5735
|
for (const [group, state] of ordered) {
|
|
5736
|
-
const found = detectItemGroups(
|
|
5736
|
+
const found = detectItemGroups(sectionEl2).find((g) => g.group === group);
|
|
5737
5737
|
if (!found || found.generated) continue;
|
|
5738
5738
|
syncGroup(found, state);
|
|
5739
5739
|
}
|
|
@@ -5773,9 +5773,9 @@ function writeValue(el, attr, value) {
|
|
|
5773
5773
|
}
|
|
5774
5774
|
}
|
|
5775
5775
|
function applyItemOps(store, ops, currentContent) {
|
|
5776
|
-
const
|
|
5777
|
-
if (!
|
|
5778
|
-
const detected = detectItemGroups(
|
|
5776
|
+
const sectionEl2 = findItemSection(ops.sectionId);
|
|
5777
|
+
if (!sectionEl2) return null;
|
|
5778
|
+
const detected = detectItemGroups(sectionEl2).find((g) => g.group === ops.group);
|
|
5779
5779
|
if (!detected || detected.generated) return null;
|
|
5780
5780
|
const next = { v: 1, sections: { ...store?.sections ?? {} } };
|
|
5781
5781
|
const groups = { ...next.sections[ops.sectionId] ?? {} };
|
|
@@ -6185,10 +6185,10 @@ function applyStylesToDom(store) {
|
|
|
6185
6185
|
if (bar === -1) continue;
|
|
6186
6186
|
const sectionId = key.slice(0, bar);
|
|
6187
6187
|
const stamp = key.slice(bar + 1);
|
|
6188
|
-
const
|
|
6189
|
-
if (!
|
|
6190
|
-
detectItemGroups(
|
|
6191
|
-
const item =
|
|
6188
|
+
const sectionEl2 = findItemSection(sectionId);
|
|
6189
|
+
if (!sectionEl2) continue;
|
|
6190
|
+
detectItemGroups(sectionEl2);
|
|
6191
|
+
const item = sectionEl2.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
|
|
6192
6192
|
if (!item) continue;
|
|
6193
6193
|
saveInline(item, "background");
|
|
6194
6194
|
item.style.setProperty("background", override.backgroundColor, "important");
|
|
@@ -6678,6 +6678,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6678
6678
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6679
6679
|
return target ? pricingFeatureList(target).length : 0;
|
|
6680
6680
|
}
|
|
6681
|
+
function prevailingFeatureIcon(features) {
|
|
6682
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6683
|
+
for (const row of features) {
|
|
6684
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6685
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6686
|
+
entry.count += 1;
|
|
6687
|
+
counts.set(key, entry);
|
|
6688
|
+
}
|
|
6689
|
+
let best = null;
|
|
6690
|
+
for (const entry of counts.values()) {
|
|
6691
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6692
|
+
}
|
|
6693
|
+
if (!best) return {};
|
|
6694
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6695
|
+
}
|
|
6681
6696
|
function addPricingCardFeature(tree, index, text) {
|
|
6682
6697
|
return withPricingCollection(tree, (collection) => {
|
|
6683
6698
|
const children = collection.children;
|
|
@@ -6686,7 +6701,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6686
6701
|
const features = pricingFeatureList(target);
|
|
6687
6702
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6688
6703
|
target.slots = target.slots ?? {};
|
|
6689
|
-
target.slots.features = [...features, { text }];
|
|
6704
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6690
6705
|
return true;
|
|
6691
6706
|
});
|
|
6692
6707
|
}
|
|
@@ -7330,6 +7345,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7330
7345
|
);
|
|
7331
7346
|
}
|
|
7332
7347
|
|
|
7348
|
+
// src/lib/youtube.ts
|
|
7349
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7350
|
+
function extractYouTubeId(input) {
|
|
7351
|
+
const trimmed = input.trim();
|
|
7352
|
+
if (!trimmed) return null;
|
|
7353
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7354
|
+
let url;
|
|
7355
|
+
try {
|
|
7356
|
+
url = new URL(trimmed);
|
|
7357
|
+
} catch {
|
|
7358
|
+
return null;
|
|
7359
|
+
}
|
|
7360
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7361
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7362
|
+
return null;
|
|
7363
|
+
}
|
|
7364
|
+
let candidate = null;
|
|
7365
|
+
if (host === "youtu.be") {
|
|
7366
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7367
|
+
} else if (url.pathname === "/watch") {
|
|
7368
|
+
candidate = url.searchParams.get("v");
|
|
7369
|
+
} else {
|
|
7370
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7371
|
+
candidate = match ? match[1] : null;
|
|
7372
|
+
}
|
|
7373
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7376
|
+
// src/lib/section-embed.ts
|
|
7377
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7378
|
+
function readStoredEmbed(value) {
|
|
7379
|
+
if (value.startsWith("start\n")) {
|
|
7380
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7381
|
+
}
|
|
7382
|
+
return { raw: value, at: "end" };
|
|
7383
|
+
}
|
|
7384
|
+
function embedFrameSrc(value) {
|
|
7385
|
+
const videoId = extractYouTubeId(value);
|
|
7386
|
+
if (videoId) {
|
|
7387
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7388
|
+
}
|
|
7389
|
+
let url;
|
|
7390
|
+
try {
|
|
7391
|
+
url = new URL(value);
|
|
7392
|
+
} catch {
|
|
7393
|
+
return null;
|
|
7394
|
+
}
|
|
7395
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7396
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7397
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7398
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7399
|
+
return { src, title: "Map" };
|
|
7400
|
+
}
|
|
7401
|
+
if (host === "maps.app.goo.gl") {
|
|
7402
|
+
return { src: value, title: "Map" };
|
|
7403
|
+
}
|
|
7404
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7405
|
+
return { src: value, title: "Calendar" };
|
|
7406
|
+
}
|
|
7407
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7408
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7409
|
+
}
|
|
7410
|
+
if (host === "forms.gle") {
|
|
7411
|
+
return { src: value, title: "Form" };
|
|
7412
|
+
}
|
|
7413
|
+
return null;
|
|
7414
|
+
}
|
|
7415
|
+
function place(section, box, at) {
|
|
7416
|
+
if (at === "start") {
|
|
7417
|
+
section.insertBefore(box, section.firstChild);
|
|
7418
|
+
return;
|
|
7419
|
+
}
|
|
7420
|
+
section.appendChild(box);
|
|
7421
|
+
}
|
|
7422
|
+
function paint(section, key, src, title, at) {
|
|
7423
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7424
|
+
const frame = existing?.querySelector("iframe");
|
|
7425
|
+
if (existing && frame) {
|
|
7426
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7427
|
+
frame.title = title;
|
|
7428
|
+
place(section, existing, at);
|
|
7429
|
+
return;
|
|
7430
|
+
}
|
|
7431
|
+
existing?.remove();
|
|
7432
|
+
const box = document.createElement("div");
|
|
7433
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7434
|
+
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;";
|
|
7435
|
+
const frameWrap = document.createElement("div");
|
|
7436
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7437
|
+
const iframe = document.createElement("iframe");
|
|
7438
|
+
iframe.src = src;
|
|
7439
|
+
iframe.title = title;
|
|
7440
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7441
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7442
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7443
|
+
frameWrap.appendChild(iframe);
|
|
7444
|
+
box.appendChild(frameWrap);
|
|
7445
|
+
place(section, box, at);
|
|
7446
|
+
}
|
|
7447
|
+
function applySectionEmbeds(content) {
|
|
7448
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7449
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7450
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7451
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7452
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7453
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7454
|
+
if (!section || !stored || !frame) {
|
|
7455
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7456
|
+
continue;
|
|
7457
|
+
}
|
|
7458
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7461
|
+
|
|
7333
7462
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7334
7463
|
import { flushSync } from "react-dom";
|
|
7335
7464
|
import { createRoot } from "react-dom/client";
|
|
@@ -7903,7 +8032,7 @@ var AI_MOBILE_CSS = [
|
|
|
7903
8032
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7904
8033
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7905
8034
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
7906
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8035
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7907
8036
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7908
8037
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7909
8038
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -7919,8 +8048,10 @@ var AI_MOBILE_CSS = [
|
|
|
7919
8048
|
"[data-ai-section]{overflow-x:hidden}",
|
|
7920
8049
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
7921
8050
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
7922
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
7923
|
-
|
|
8051
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8052
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8053
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8054
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
7924
8055
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
7925
8056
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
7926
8057
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8125,6 +8256,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8125
8256
|
function textAttrs(ctx, path) {
|
|
8126
8257
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8127
8258
|
}
|
|
8259
|
+
var AI_RESPONSIVE_CSS = [
|
|
8260
|
+
"@media (max-width: 960px) {",
|
|
8261
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8262
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8263
|
+
"}",
|
|
8264
|
+
"@media (max-width: 640px) {",
|
|
8265
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8266
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8267
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8268
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8269
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8270
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8271
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8272
|
+
// layered text used to be.
|
|
8273
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8274
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8275
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8276
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8277
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8278
|
+
// other rule had already been taught to stand down.
|
|
8279
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8280
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8281
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8282
|
+
"}"
|
|
8283
|
+
].join("\n");
|
|
8128
8284
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8129
8285
|
function MediaBox({
|
|
8130
8286
|
refValue,
|
|
@@ -8179,7 +8335,7 @@ function MediaBox({
|
|
|
8179
8335
|
position: fill ? "absolute" : void 0,
|
|
8180
8336
|
inset: fill ? 0 : void 0,
|
|
8181
8337
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8182
|
-
height: fill ? "100%" : void 0,
|
|
8338
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8183
8339
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8184
8340
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8185
8341
|
borderRadius: radius,
|
|
@@ -9675,7 +9831,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9675
9831
|
return /* @__PURE__ */ jsx(
|
|
9676
9832
|
"div",
|
|
9677
9833
|
{
|
|
9678
|
-
"data-ai-grid":
|
|
9834
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9679
9835
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9680
9836
|
style: {
|
|
9681
9837
|
display: "grid",
|
|
@@ -9977,7 +10133,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
9977
10133
|
},
|
|
9978
10134
|
children: [
|
|
9979
10135
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
9980
|
-
// The section's `data-ai-
|
|
10136
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
9981
10137
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
9982
10138
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
9983
10139
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10396,6 +10552,7 @@ function AiTreeRenderer({
|
|
|
10396
10552
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10397
10553
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10398
10554
|
...bgAttrs,
|
|
10555
|
+
"data-ai-responsive": "",
|
|
10399
10556
|
style: {
|
|
10400
10557
|
position: "relative",
|
|
10401
10558
|
padding: `${padCss} 0`,
|
|
@@ -10409,12 +10566,13 @@ function AiTreeRenderer({
|
|
|
10409
10566
|
...fillHeight ? { display: "grid" } : {}
|
|
10410
10567
|
},
|
|
10411
10568
|
children: [
|
|
10412
|
-
|
|
10569
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10413
10570
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
10571
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10414
10572
|
/* @__PURE__ */ jsx(
|
|
10415
10573
|
"div",
|
|
10416
10574
|
{
|
|
10417
|
-
"data-ai-
|
|
10575
|
+
"data-ai-section-inner": "",
|
|
10418
10576
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10419
10577
|
style: {
|
|
10420
10578
|
position: "relative",
|
|
@@ -10431,7 +10589,7 @@ function AiTreeRenderer({
|
|
|
10431
10589
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10432
10590
|
"div",
|
|
10433
10591
|
{
|
|
10434
|
-
"data-ai-
|
|
10592
|
+
"data-ai-columns": "",
|
|
10435
10593
|
style: {
|
|
10436
10594
|
display: "grid",
|
|
10437
10595
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11093,9 +11251,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11093
11251
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11094
11252
|
continue;
|
|
11095
11253
|
}
|
|
11096
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11097
11254
|
let container = existing?.container;
|
|
11255
|
+
let isNewMount = false;
|
|
11098
11256
|
if (!container || !container.isConnected) {
|
|
11257
|
+
isNewMount = true;
|
|
11099
11258
|
existing?.root.unmount();
|
|
11100
11259
|
container?.remove();
|
|
11101
11260
|
container = document.createElement("div");
|
|
@@ -11433,6 +11592,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11433
11592
|
return 3;
|
|
11434
11593
|
}
|
|
11435
11594
|
}
|
|
11595
|
+
function readLiveSocialItems() {
|
|
11596
|
+
const root = getFooterRoot();
|
|
11597
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11598
|
+
if (!row) return [];
|
|
11599
|
+
const items = [];
|
|
11600
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11601
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11602
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11603
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11604
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11605
|
+
items.push({ platform, href });
|
|
11606
|
+
}
|
|
11607
|
+
return items;
|
|
11608
|
+
}
|
|
11609
|
+
function syncSocialRowsFromDom(tree) {
|
|
11610
|
+
const root = getFooterRoot();
|
|
11611
|
+
if (!root) return;
|
|
11612
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11613
|
+
const live = readLiveSocialItems();
|
|
11614
|
+
if (row && live.length === 0) return;
|
|
11615
|
+
for (const col of tree.columns) {
|
|
11616
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11617
|
+
if (block.type !== "social-row") return [block];
|
|
11618
|
+
if (!row) return [];
|
|
11619
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11620
|
+
});
|
|
11621
|
+
}
|
|
11622
|
+
}
|
|
11436
11623
|
function collectBrandBlocks(tree) {
|
|
11437
11624
|
const brand = [];
|
|
11438
11625
|
for (const col of tree.columns) {
|
|
@@ -11678,6 +11865,7 @@ function textOf2(el) {
|
|
|
11678
11865
|
}
|
|
11679
11866
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11680
11867
|
const next = cloneTree(tree);
|
|
11868
|
+
syncSocialRowsFromDom(next);
|
|
11681
11869
|
const domCols = listFooterColumns().map((col) => {
|
|
11682
11870
|
const heading = getFooterColumnHeadingEl(col);
|
|
11683
11871
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -12150,8 +12338,116 @@ function useHashLinkScroll(isEditMode) {
|
|
|
12150
12338
|
}, [isEditMode]);
|
|
12151
12339
|
}
|
|
12152
12340
|
|
|
12341
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12342
|
+
import { useEffect as useEffect5 } from "react";
|
|
12343
|
+
|
|
12344
|
+
// src/lib/strip-placeholders.ts
|
|
12345
|
+
var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
12346
|
+
var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
|
|
12347
|
+
var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
|
|
12348
|
+
var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
|
|
12349
|
+
var HIDDEN_ATTR2 = "data-ohw-placeholder-hidden";
|
|
12350
|
+
function hasPlaceholder(text) {
|
|
12351
|
+
return HAS_PLACEHOLDER_RE.test(text);
|
|
12352
|
+
}
|
|
12353
|
+
function stripPlaceholderText(text) {
|
|
12354
|
+
if (!hasPlaceholder(text)) return text;
|
|
12355
|
+
const lead = text.match(/^\s*/)?.[0] ?? "";
|
|
12356
|
+
const trail = lead.length === text.length ? "" : text.match(/\s*$/)?.[0] ?? "";
|
|
12357
|
+
const body = text.slice(lead.length, text.length - trail.length).replace(PLACEHOLDER_RE, "").replace(/\(\s*\)|\[\s*\]/g, "").replace(/[ \t]{2,}/g, " ").replace(/[ \t]+([.,;:!?])/g, "$1").trim();
|
|
12358
|
+
return body ? `${lead}${body}${trail}` : lead || trail ? " " : "";
|
|
12359
|
+
}
|
|
12360
|
+
function skipped(el) {
|
|
12361
|
+
for (let node = el; node; node = node.parentElement) {
|
|
12362
|
+
if (SKIPPED_TAGS.has(node.tagName)) return true;
|
|
12363
|
+
}
|
|
12364
|
+
return false;
|
|
12365
|
+
}
|
|
12366
|
+
function hideIfEmptied(el) {
|
|
12367
|
+
const control = el?.closest("a, button");
|
|
12368
|
+
if (!control || control.hasAttribute(HIDDEN_ATTR2)) return;
|
|
12369
|
+
if ((control.textContent ?? "").trim()) return;
|
|
12370
|
+
if (control.querySelector("img, svg, picture, video")) return;
|
|
12371
|
+
control.setAttribute(HIDDEN_ATTR2, "");
|
|
12372
|
+
control.style.display = "none";
|
|
12373
|
+
}
|
|
12374
|
+
function stripElementAttrs(el) {
|
|
12375
|
+
let changed = false;
|
|
12376
|
+
const href = el.getAttribute("href");
|
|
12377
|
+
if (href && hasPlaceholder(decodeSafely(href))) {
|
|
12378
|
+
el.removeAttribute("href");
|
|
12379
|
+
changed = true;
|
|
12380
|
+
}
|
|
12381
|
+
for (const name of TEXT_ATTRS) {
|
|
12382
|
+
const value = el.getAttribute(name);
|
|
12383
|
+
if (value && hasPlaceholder(value)) {
|
|
12384
|
+
el.setAttribute(name, stripPlaceholderText(value).trim());
|
|
12385
|
+
changed = true;
|
|
12386
|
+
}
|
|
12387
|
+
}
|
|
12388
|
+
return changed;
|
|
12389
|
+
}
|
|
12390
|
+
function decodeSafely(value) {
|
|
12391
|
+
try {
|
|
12392
|
+
return decodeURIComponent(value);
|
|
12393
|
+
} catch {
|
|
12394
|
+
return value;
|
|
12395
|
+
}
|
|
12396
|
+
}
|
|
12397
|
+
function stripPlaceholders(root) {
|
|
12398
|
+
const doc = root.ownerDocument ?? root;
|
|
12399
|
+
let changed = 0;
|
|
12400
|
+
if (root.nodeType === 3) {
|
|
12401
|
+
return stripTextNode(root) ? 1 : 0;
|
|
12402
|
+
}
|
|
12403
|
+
if (root.nodeType !== 1 && root.nodeType !== 9) return 0;
|
|
12404
|
+
const rootEl = root.nodeType === 1 ? root : root.documentElement;
|
|
12405
|
+
if (!rootEl || skipped(rootEl)) return 0;
|
|
12406
|
+
for (const el of [rootEl, ...Array.from(rootEl.querySelectorAll("[href], [alt], [title], [aria-label], [placeholder]"))]) {
|
|
12407
|
+
if (!skipped(el) && stripElementAttrs(el)) changed++;
|
|
12408
|
+
}
|
|
12409
|
+
const walker = doc.createTreeWalker(rootEl, 4);
|
|
12410
|
+
const texts = [];
|
|
12411
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
12412
|
+
if (node.nodeValue && node.nodeValue.includes("[")) texts.push(node);
|
|
12413
|
+
}
|
|
12414
|
+
for (const node of texts) {
|
|
12415
|
+
if (stripTextNode(node)) changed++;
|
|
12416
|
+
}
|
|
12417
|
+
return changed;
|
|
12418
|
+
}
|
|
12419
|
+
function stripTextNode(node) {
|
|
12420
|
+
const value = node.nodeValue ?? "";
|
|
12421
|
+
if (!value.includes("[") || !hasPlaceholder(value) || skipped(node.parentElement)) return false;
|
|
12422
|
+
node.nodeValue = stripPlaceholderText(value);
|
|
12423
|
+
hideIfEmptied(node.parentElement);
|
|
12424
|
+
return true;
|
|
12425
|
+
}
|
|
12426
|
+
|
|
12427
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12428
|
+
function usePublishedPlaceholderStrip(isEditMode) {
|
|
12429
|
+
useEffect5(() => {
|
|
12430
|
+
if (isEditMode) return;
|
|
12431
|
+
stripPlaceholders(document.body);
|
|
12432
|
+
const observer = new MutationObserver((records) => {
|
|
12433
|
+
for (const record of records) {
|
|
12434
|
+
if (record.type === "childList") record.addedNodes.forEach((node) => stripPlaceholders(node));
|
|
12435
|
+
else stripPlaceholders(record.target);
|
|
12436
|
+
}
|
|
12437
|
+
});
|
|
12438
|
+
observer.observe(document.body, {
|
|
12439
|
+
childList: true,
|
|
12440
|
+
subtree: true,
|
|
12441
|
+
characterData: true,
|
|
12442
|
+
attributes: true,
|
|
12443
|
+
attributeFilter: ["href", "alt", "title", "aria-label", "placeholder"]
|
|
12444
|
+
});
|
|
12445
|
+
return () => observer.disconnect();
|
|
12446
|
+
}, [isEditMode]);
|
|
12447
|
+
}
|
|
12448
|
+
|
|
12153
12449
|
// src/ui/SchedulingWidget.tsx
|
|
12154
|
-
import { useCallback, useEffect as
|
|
12450
|
+
import { useCallback, useEffect as useEffect6, useId, useMemo, useRef, useState as useState3 } from "react";
|
|
12155
12451
|
|
|
12156
12452
|
// src/ui/EmailCaptureModal.tsx
|
|
12157
12453
|
import { useState as useState2 } from "react";
|
|
@@ -12469,7 +12765,7 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12469
12765
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
12470
12766
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
12471
12767
|
};
|
|
12472
|
-
|
|
12768
|
+
useEffect6(() => {
|
|
12473
12769
|
const el = scrollRef.current;
|
|
12474
12770
|
if (!el) return;
|
|
12475
12771
|
updateScrollState();
|
|
@@ -12727,7 +13023,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12727
13023
|
});
|
|
12728
13024
|
}, []);
|
|
12729
13025
|
const [selectedIdx, setSelectedIdx] = useState3(0);
|
|
12730
|
-
|
|
13026
|
+
useEffect6(() => {
|
|
12731
13027
|
if (!schedule?.classes) return;
|
|
12732
13028
|
for (let i = 0; i < dates.length; i++) {
|
|
12733
13029
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -12736,7 +13032,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12736
13032
|
}
|
|
12737
13033
|
}
|
|
12738
13034
|
}, [schedule, dates]);
|
|
12739
|
-
|
|
13035
|
+
useEffect6(() => {
|
|
12740
13036
|
if (typeof window === "undefined") return;
|
|
12741
13037
|
const onVisible = () => {
|
|
12742
13038
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -12748,7 +13044,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12748
13044
|
document.removeEventListener("visibilitychange", onVisible);
|
|
12749
13045
|
};
|
|
12750
13046
|
}, [refetchLiveSchedule]);
|
|
12751
|
-
|
|
13047
|
+
useEffect6(() => {
|
|
12752
13048
|
if (typeof window === "undefined") return;
|
|
12753
13049
|
const isInEditor = window.self !== window.top;
|
|
12754
13050
|
setInEditor(isInEditor);
|
|
@@ -17285,7 +17581,7 @@ function clearSubmitError(form) {
|
|
|
17285
17581
|
if (note) note.style.display = "none";
|
|
17286
17582
|
}
|
|
17287
17583
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17288
|
-
var
|
|
17584
|
+
var HIDDEN_ATTR3 = "data-ohw-form-hidden";
|
|
17289
17585
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17290
17586
|
function formSuccessKey(formKey) {
|
|
17291
17587
|
return `${formKey}-success`;
|
|
@@ -17311,13 +17607,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17311
17607
|
Array.from(form.children).forEach((child) => {
|
|
17312
17608
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17313
17609
|
if (state === "success") {
|
|
17314
|
-
if (!child.hasAttribute(
|
|
17315
|
-
child.setAttribute(
|
|
17610
|
+
if (!child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17611
|
+
child.setAttribute(HIDDEN_ATTR3, child.style.display);
|
|
17316
17612
|
child.style.display = "none";
|
|
17317
17613
|
}
|
|
17318
|
-
} else if (child.hasAttribute(
|
|
17319
|
-
child.style.display = child.getAttribute(
|
|
17320
|
-
child.removeAttribute(
|
|
17614
|
+
} else if (child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17615
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
|
|
17616
|
+
child.removeAttribute(HIDDEN_ATTR3);
|
|
17321
17617
|
}
|
|
17322
17618
|
});
|
|
17323
17619
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17382,7 +17678,7 @@ function apiBase() {
|
|
|
17382
17678
|
function bridgeVersion() {
|
|
17383
17679
|
try {
|
|
17384
17680
|
if (true) {
|
|
17385
|
-
return "0.1.
|
|
17681
|
+
return "0.1.167-next.444";
|
|
17386
17682
|
}
|
|
17387
17683
|
} catch {
|
|
17388
17684
|
}
|
|
@@ -17396,7 +17692,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17396
17692
|
return;
|
|
17397
17693
|
}
|
|
17398
17694
|
try {
|
|
17399
|
-
const v = true ? "0.1.
|
|
17695
|
+
const v = true ? "0.1.167-next.444" : "";
|
|
17400
17696
|
if (v) {
|
|
17401
17697
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17402
17698
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18074,6 +18370,7 @@ function MediaOverlay({
|
|
|
18074
18370
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18075
18371
|
);
|
|
18076
18372
|
}, [isVideo]);
|
|
18373
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18077
18374
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18078
18375
|
const box = {
|
|
18079
18376
|
position: "fixed",
|
|
@@ -18172,11 +18469,10 @@ function MediaOverlay({
|
|
|
18172
18469
|
className: "flex items-center justify-center cursor-pointer",
|
|
18173
18470
|
style: {
|
|
18174
18471
|
...box,
|
|
18175
|
-
//
|
|
18176
|
-
//
|
|
18177
|
-
//
|
|
18178
|
-
|
|
18179
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18472
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18473
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18474
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18475
|
+
pointerEvents: "none",
|
|
18180
18476
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18181
18477
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18182
18478
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18203,17 +18499,17 @@ function MediaOverlay({
|
|
|
18203
18499
|
},
|
|
18204
18500
|
children: [
|
|
18205
18501
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18206
|
-
|
|
18502
|
+
replaceLabel
|
|
18207
18503
|
]
|
|
18208
18504
|
}
|
|
18209
18505
|
),
|
|
18210
|
-
replaceMode
|
|
18506
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18211
18507
|
Button,
|
|
18212
18508
|
{
|
|
18213
18509
|
"data-ohw-media-overlay": "",
|
|
18214
18510
|
variant: "outline",
|
|
18215
18511
|
size: "sm",
|
|
18216
|
-
"aria-label":
|
|
18512
|
+
"aria-label": replaceLabel,
|
|
18217
18513
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18218
18514
|
style: {
|
|
18219
18515
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18236,7 +18532,7 @@ function MediaOverlay({
|
|
|
18236
18532
|
},
|
|
18237
18533
|
children: [
|
|
18238
18534
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18239
|
-
replaceMode === "full" ?
|
|
18535
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18240
18536
|
]
|
|
18241
18537
|
}
|
|
18242
18538
|
)
|
|
@@ -18303,7 +18599,7 @@ function CarouselOverlay({
|
|
|
18303
18599
|
}
|
|
18304
18600
|
|
|
18305
18601
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18306
|
-
import { useCallback as useCallback2, useEffect as
|
|
18602
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useRef as useRef4, useState as useState7 } from "react";
|
|
18307
18603
|
import { Check, X } from "lucide-react";
|
|
18308
18604
|
|
|
18309
18605
|
// src/lib/ai-change-highlight.ts
|
|
@@ -18332,7 +18628,8 @@ function ensureStyleSheet2() {
|
|
|
18332
18628
|
el.textContent = HIGHLIGHT_CSS;
|
|
18333
18629
|
document.head.appendChild(el);
|
|
18334
18630
|
}
|
|
18335
|
-
|
|
18631
|
+
var sectionEl = (id) => document.querySelector(`[data-ohw-instance="${CSS.escape(id)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(id)}"]`);
|
|
18632
|
+
function targetsFor(keys, item, sectionId) {
|
|
18336
18633
|
const out = /* @__PURE__ */ new Set();
|
|
18337
18634
|
for (const key of keys) {
|
|
18338
18635
|
if (!key) continue;
|
|
@@ -18343,11 +18640,15 @@ function targetsFor(keys, item) {
|
|
|
18343
18640
|
}
|
|
18344
18641
|
}
|
|
18345
18642
|
if (item) {
|
|
18346
|
-
const section =
|
|
18643
|
+
const section = sectionEl(item.sectionId);
|
|
18347
18644
|
const stamp = `${item.group}:${item.index}`;
|
|
18348
18645
|
const el = section?.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
|
|
18349
18646
|
if (el) out.add(el);
|
|
18350
18647
|
}
|
|
18648
|
+
if (out.size === 0 && sectionId) {
|
|
18649
|
+
const section = sectionEl(sectionId);
|
|
18650
|
+
if (section) out.add(section);
|
|
18651
|
+
}
|
|
18351
18652
|
return [...out];
|
|
18352
18653
|
}
|
|
18353
18654
|
var clearTimer = null;
|
|
@@ -18360,9 +18661,9 @@ function clearChangeHighlight() {
|
|
|
18360
18661
|
el.removeAttribute(MARK_ATTR);
|
|
18361
18662
|
}
|
|
18362
18663
|
}
|
|
18363
|
-
function highlightChangedElements(keys, item) {
|
|
18664
|
+
function highlightChangedElements(keys, item, sectionId) {
|
|
18364
18665
|
clearChangeHighlight();
|
|
18365
|
-
const targets = targetsFor(keys, item);
|
|
18666
|
+
const targets = targetsFor(keys, item, sectionId);
|
|
18366
18667
|
if (targets.length === 0) return 0;
|
|
18367
18668
|
ensureStyleSheet2();
|
|
18368
18669
|
for (const el of targets) el.setAttribute(MARK_ATTR, "");
|
|
@@ -18380,7 +18681,8 @@ function installAiChangeHighlight() {
|
|
|
18380
18681
|
const keys = Array.isArray(data.keys) ? data.keys.filter((k) => typeof k === "string") : [];
|
|
18381
18682
|
const raw = data.item;
|
|
18382
18683
|
const item = raw && typeof raw.sectionId === "string" && typeof raw.group === "string" && typeof raw.index === "number" ? { sectionId: raw.sectionId, group: raw.group, index: raw.index } : void 0;
|
|
18383
|
-
const
|
|
18684
|
+
const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
|
|
18685
|
+
const found = highlightChangedElements(keys, item, sectionId);
|
|
18384
18686
|
window.parent?.postMessage({ type: "ow:ai-highlight-done", found }, "*");
|
|
18385
18687
|
};
|
|
18386
18688
|
window.addEventListener("message", onMessage);
|
|
@@ -18399,7 +18701,7 @@ function readRect(instanceId) {
|
|
|
18399
18701
|
}
|
|
18400
18702
|
function useLiveSectionRect(sectionId) {
|
|
18401
18703
|
const [rect, setRect] = useState7(null);
|
|
18402
|
-
|
|
18704
|
+
useEffect8(() => {
|
|
18403
18705
|
if (!sectionId) {
|
|
18404
18706
|
setRect(null);
|
|
18405
18707
|
return;
|
|
@@ -18439,7 +18741,7 @@ function readNavToggleRect() {
|
|
|
18439
18741
|
}
|
|
18440
18742
|
function useLiveNavToggleHole(active) {
|
|
18441
18743
|
const [rect, setRect] = useState7(null);
|
|
18442
|
-
|
|
18744
|
+
useEffect8(() => {
|
|
18443
18745
|
if (!active) {
|
|
18444
18746
|
setRect(null);
|
|
18445
18747
|
return;
|
|
@@ -18563,7 +18865,7 @@ function AiSectionOverlay({
|
|
|
18563
18865
|
reviewIdRef.current = reviewId;
|
|
18564
18866
|
const selectedIdRef = useRef4(null);
|
|
18565
18867
|
selectedIdRef.current = selectedId;
|
|
18566
|
-
|
|
18868
|
+
useEffect8(() => {
|
|
18567
18869
|
onSelectionChange?.(selectedId);
|
|
18568
18870
|
}, [selectedId, onSelectionChange]);
|
|
18569
18871
|
const report = useCallback2(
|
|
@@ -18580,28 +18882,28 @@ function AiSectionOverlay({
|
|
|
18580
18882
|
const selectFromElement = useCallback2(
|
|
18581
18883
|
(el, options) => {
|
|
18582
18884
|
const inner = el?.closest("[data-ohw-section]") ?? null;
|
|
18583
|
-
const
|
|
18584
|
-
const id =
|
|
18885
|
+
const sectionEl2 = inner ? movableUnit(inner) : null;
|
|
18886
|
+
const id = sectionEl2 ? instanceIdOf(sectionEl2) || null : null;
|
|
18585
18887
|
if (id === selectedIdRef.current) return;
|
|
18586
18888
|
selectedIdRef.current = id;
|
|
18587
18889
|
setSelectedId(id);
|
|
18588
|
-
if (options?.report !== false) report(
|
|
18890
|
+
if (options?.report !== false) report(sectionEl2);
|
|
18589
18891
|
},
|
|
18590
18892
|
[report]
|
|
18591
18893
|
);
|
|
18592
|
-
|
|
18894
|
+
useEffect8(() => {
|
|
18593
18895
|
apiRef.current = {
|
|
18594
18896
|
selectFromElement,
|
|
18595
18897
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
18596
|
-
let
|
|
18597
|
-
if (!
|
|
18898
|
+
let sectionEl2 = target?.closest("[data-ohw-section]") ?? null;
|
|
18899
|
+
if (!sectionEl2 && clientX !== void 0 && clientY !== void 0) {
|
|
18598
18900
|
const beneath = document.elementsFromPoint(clientX, clientY).find(
|
|
18599
18901
|
(el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
|
|
18600
18902
|
);
|
|
18601
|
-
|
|
18903
|
+
sectionEl2 = beneath?.closest("[data-ohw-section]") ?? null;
|
|
18602
18904
|
}
|
|
18603
|
-
selectFromElement(
|
|
18604
|
-
return
|
|
18905
|
+
selectFromElement(sectionEl2);
|
|
18906
|
+
return sectionEl2 != null;
|
|
18605
18907
|
},
|
|
18606
18908
|
clear: () => {
|
|
18607
18909
|
selectedIdRef.current = null;
|
|
@@ -18614,7 +18916,7 @@ function AiSectionOverlay({
|
|
|
18614
18916
|
apiRef.current = null;
|
|
18615
18917
|
};
|
|
18616
18918
|
}, [apiRef, selectFromElement, report]);
|
|
18617
|
-
|
|
18919
|
+
useEffect8(() => {
|
|
18618
18920
|
const onMessage = (e) => {
|
|
18619
18921
|
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
18620
18922
|
selectedIdRef.current = null;
|
|
@@ -18639,9 +18941,9 @@ function AiSectionOverlay({
|
|
|
18639
18941
|
window.addEventListener("message", onMessage);
|
|
18640
18942
|
return () => window.removeEventListener("message", onMessage);
|
|
18641
18943
|
}, [postToParent2]);
|
|
18642
|
-
|
|
18944
|
+
useEffect8(() => installAiChangeHighlight(), []);
|
|
18643
18945
|
const [hoveredId, setHoveredId] = useState7(null);
|
|
18644
|
-
|
|
18946
|
+
useEffect8(() => {
|
|
18645
18947
|
const onMove = (e) => {
|
|
18646
18948
|
const t = e.target;
|
|
18647
18949
|
if (!(t instanceof Element)) return;
|
|
@@ -18666,7 +18968,7 @@ function AiSectionOverlay({
|
|
|
18666
18968
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
18667
18969
|
};
|
|
18668
18970
|
}, []);
|
|
18669
|
-
|
|
18971
|
+
useEffect8(() => {
|
|
18670
18972
|
const onKeyDown = (e) => {
|
|
18671
18973
|
if (e.key !== "Escape") return;
|
|
18672
18974
|
if (reviewIdRef.current) return;
|
|
@@ -18690,7 +18992,7 @@ function AiSectionOverlay({
|
|
|
18690
18992
|
[postToParent2]
|
|
18691
18993
|
);
|
|
18692
18994
|
const [navDropdownForceOpen, setNavDropdownForceOpen] = useState7(false);
|
|
18693
|
-
|
|
18995
|
+
useEffect8(() => {
|
|
18694
18996
|
const update = () => {
|
|
18695
18997
|
setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
|
|
18696
18998
|
};
|
|
@@ -18709,7 +19011,7 @@ function AiSectionOverlay({
|
|
|
18709
19011
|
const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
|
|
18710
19012
|
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
18711
19013
|
const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
|
|
18712
|
-
|
|
19014
|
+
useEffect8(() => {
|
|
18713
19015
|
const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
|
|
18714
19016
|
if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
|
|
18715
19017
|
postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
|
|
@@ -18829,8 +19131,24 @@ function AiSectionOverlay({
|
|
|
18829
19131
|
}
|
|
18830
19132
|
|
|
18831
19133
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18832
|
-
import { useCallback as useCallback3, useEffect as
|
|
18833
|
-
import {
|
|
19134
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
19135
|
+
import {
|
|
19136
|
+
AlignCenter,
|
|
19137
|
+
AlignLeft,
|
|
19138
|
+
AlignRight,
|
|
19139
|
+
ArrowLeft as ArrowLeft2,
|
|
19140
|
+
ArrowRight as ArrowRight2,
|
|
19141
|
+
Check as Check2,
|
|
19142
|
+
ChevronDown as ChevronDown3,
|
|
19143
|
+
Image as ImageIcon2,
|
|
19144
|
+
ImageMinus,
|
|
19145
|
+
ImagePlus,
|
|
19146
|
+
Link as LinkIcon,
|
|
19147
|
+
Minus,
|
|
19148
|
+
Palette,
|
|
19149
|
+
Plus as Plus2,
|
|
19150
|
+
Star
|
|
19151
|
+
} from "lucide-react";
|
|
18834
19152
|
|
|
18835
19153
|
// src/lib/ai-media-strip-tree.ts
|
|
18836
19154
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -18944,14 +19262,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
18944
19262
|
return true;
|
|
18945
19263
|
});
|
|
18946
19264
|
}
|
|
18947
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
18948
|
-
return withMediaStrip(tree, (block) => {
|
|
18949
|
-
const items = block.items;
|
|
18950
|
-
if (index < 0 || index >= items.length) return false;
|
|
18951
|
-
items[index] = { ...items[index], alt };
|
|
18952
|
-
return true;
|
|
18953
|
-
});
|
|
18954
|
-
}
|
|
18955
19265
|
function setMediaStripItemLink(tree, index, link) {
|
|
18956
19266
|
return withMediaStrip(tree, (block) => {
|
|
18957
19267
|
const items = block.items;
|
|
@@ -18969,36 +19279,163 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
18969
19279
|
});
|
|
18970
19280
|
}
|
|
18971
19281
|
|
|
19282
|
+
// src/ui/dialog.tsx
|
|
19283
|
+
import * as React9 from "react";
|
|
19284
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19285
|
+
import { X as X2 } from "lucide-react";
|
|
19286
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19287
|
+
function Dialog2({
|
|
19288
|
+
...props
|
|
19289
|
+
}) {
|
|
19290
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19291
|
+
}
|
|
19292
|
+
function DialogPortal({
|
|
19293
|
+
...props
|
|
19294
|
+
}) {
|
|
19295
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19296
|
+
}
|
|
19297
|
+
function DialogOverlay({
|
|
19298
|
+
className,
|
|
19299
|
+
...props
|
|
19300
|
+
}) {
|
|
19301
|
+
return /* @__PURE__ */ jsx20(
|
|
19302
|
+
DialogPrimitive.Overlay,
|
|
19303
|
+
{
|
|
19304
|
+
"data-slot": "dialog-overlay",
|
|
19305
|
+
"data-ohw-link-modal-root": "",
|
|
19306
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19307
|
+
...props
|
|
19308
|
+
}
|
|
19309
|
+
);
|
|
19310
|
+
}
|
|
19311
|
+
var DialogContent = React9.forwardRef(
|
|
19312
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19313
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19314
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19315
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19316
|
+
/* @__PURE__ */ jsxs11(
|
|
19317
|
+
DialogPrimitive.Content,
|
|
19318
|
+
{
|
|
19319
|
+
ref,
|
|
19320
|
+
"data-slot": "dialog-content",
|
|
19321
|
+
className: cn(
|
|
19322
|
+
positionMode,
|
|
19323
|
+
"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",
|
|
19324
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19325
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19326
|
+
className
|
|
19327
|
+
),
|
|
19328
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19329
|
+
...props,
|
|
19330
|
+
children: [
|
|
19331
|
+
children,
|
|
19332
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19333
|
+
DialogPrimitive.Close,
|
|
19334
|
+
{
|
|
19335
|
+
type: "button",
|
|
19336
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19337
|
+
"aria-label": "Close",
|
|
19338
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19339
|
+
}
|
|
19340
|
+
) : null
|
|
19341
|
+
]
|
|
19342
|
+
}
|
|
19343
|
+
)
|
|
19344
|
+
] });
|
|
19345
|
+
}
|
|
19346
|
+
);
|
|
19347
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19348
|
+
function DialogHeader({
|
|
19349
|
+
className,
|
|
19350
|
+
...props
|
|
19351
|
+
}) {
|
|
19352
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19353
|
+
}
|
|
19354
|
+
function DialogFooter({
|
|
19355
|
+
className,
|
|
19356
|
+
...props
|
|
19357
|
+
}) {
|
|
19358
|
+
return /* @__PURE__ */ jsx20(
|
|
19359
|
+
"div",
|
|
19360
|
+
{
|
|
19361
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19362
|
+
...props
|
|
19363
|
+
}
|
|
19364
|
+
);
|
|
19365
|
+
}
|
|
19366
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19367
|
+
DialogPrimitive.Title,
|
|
19368
|
+
{
|
|
19369
|
+
ref,
|
|
19370
|
+
className: cn(
|
|
19371
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19372
|
+
className
|
|
19373
|
+
),
|
|
19374
|
+
...props
|
|
19375
|
+
}
|
|
19376
|
+
));
|
|
19377
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19378
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19379
|
+
DialogPrimitive.Description,
|
|
19380
|
+
{
|
|
19381
|
+
ref,
|
|
19382
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19383
|
+
...props
|
|
19384
|
+
}
|
|
19385
|
+
));
|
|
19386
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19387
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19388
|
+
|
|
18972
19389
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18973
|
-
import { Fragment as Fragment7, jsx as
|
|
18974
|
-
var PRIMARY3 = "#0885FE";
|
|
18975
|
-
var
|
|
18976
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19390
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19391
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19392
|
+
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]";
|
|
18977
19393
|
function findMediaStripItemElement(sectionId, index) {
|
|
18978
|
-
const
|
|
18979
|
-
if (!
|
|
18980
|
-
const items =
|
|
19394
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
19395
|
+
if (!sectionEl2) return null;
|
|
19396
|
+
const items = sectionEl2.querySelectorAll("[data-ohw-media-strip-item]");
|
|
18981
19397
|
for (const el of Array.from(items)) {
|
|
18982
19398
|
if (Number(el.dataset.ohwMediaStripIndex) === index) return el;
|
|
18983
19399
|
}
|
|
18984
19400
|
return null;
|
|
18985
19401
|
}
|
|
18986
|
-
function
|
|
18987
|
-
|
|
19402
|
+
function itemRefFromTarget(target) {
|
|
19403
|
+
if (!(target instanceof Element)) return null;
|
|
19404
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19405
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19406
|
+
if (!itemEl) return null;
|
|
19407
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
19408
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19409
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19410
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19411
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19412
|
+
return { sectionId, index };
|
|
19413
|
+
}
|
|
19414
|
+
function sameRef(a, b) {
|
|
19415
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19416
|
+
}
|
|
19417
|
+
function rectOf(el) {
|
|
18988
19418
|
if (!el) return null;
|
|
18989
19419
|
const r2 = el.getBoundingClientRect();
|
|
18990
19420
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
18991
19421
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18992
19422
|
}
|
|
18993
|
-
function
|
|
19423
|
+
function readRect2(ref) {
|
|
19424
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19425
|
+
}
|
|
19426
|
+
function readStripRect(ref) {
|
|
19427
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19428
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19429
|
+
}
|
|
19430
|
+
function useLiveItemRect(ref, strip = false) {
|
|
18994
19431
|
const [rect, setRect] = useState8(null);
|
|
18995
|
-
|
|
19432
|
+
useEffect9(() => {
|
|
18996
19433
|
if (!ref) {
|
|
18997
19434
|
setRect(null);
|
|
18998
19435
|
return;
|
|
18999
19436
|
}
|
|
19000
19437
|
const update = () => {
|
|
19001
|
-
const next = readRect2(ref);
|
|
19438
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
19002
19439
|
setRect(
|
|
19003
19440
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
19004
19441
|
);
|
|
@@ -19013,9 +19450,49 @@ function useLiveItemRect(ref) {
|
|
|
19013
19450
|
window.removeEventListener("resize", update);
|
|
19014
19451
|
clearInterval(interval);
|
|
19015
19452
|
};
|
|
19016
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19453
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
19017
19454
|
return rect;
|
|
19018
19455
|
}
|
|
19456
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19457
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19458
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19459
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19460
|
+
const slotRef = useRef5(null);
|
|
19461
|
+
const [shift, setShift] = useState8(0);
|
|
19462
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19463
|
+
useLayoutEffect4(() => {
|
|
19464
|
+
const slot = slotRef.current;
|
|
19465
|
+
if (!slot) return;
|
|
19466
|
+
const clamp = () => {
|
|
19467
|
+
const w = slot.offsetWidth;
|
|
19468
|
+
if (w <= 0) return;
|
|
19469
|
+
const half = w / 2;
|
|
19470
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19471
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19472
|
+
};
|
|
19473
|
+
clamp();
|
|
19474
|
+
const ro = new ResizeObserver(clamp);
|
|
19475
|
+
ro.observe(slot);
|
|
19476
|
+
return () => ro.disconnect();
|
|
19477
|
+
}, [centerX, children]);
|
|
19478
|
+
const mobile = window.innerWidth <= 480;
|
|
19479
|
+
return /* @__PURE__ */ jsx21(
|
|
19480
|
+
"div",
|
|
19481
|
+
{
|
|
19482
|
+
ref: slotRef,
|
|
19483
|
+
"data-ohw-bridge": "",
|
|
19484
|
+
"data-ohw-item-interaction": "",
|
|
19485
|
+
className: "pointer-events-auto fixed",
|
|
19486
|
+
style: {
|
|
19487
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19488
|
+
left: centerX + shift,
|
|
19489
|
+
transform: "translate(-50%, -100%)",
|
|
19490
|
+
zIndex: 2147483645
|
|
19491
|
+
},
|
|
19492
|
+
children
|
|
19493
|
+
}
|
|
19494
|
+
);
|
|
19495
|
+
}
|
|
19019
19496
|
function requestValidateTree(postToParent2, tree) {
|
|
19020
19497
|
return new Promise((resolve) => {
|
|
19021
19498
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19052,116 +19529,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19052
19529
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19053
19530
|
});
|
|
19054
19531
|
}
|
|
19055
|
-
function
|
|
19532
|
+
function ToolbarAction({
|
|
19056
19533
|
label,
|
|
19057
19534
|
onClick,
|
|
19058
|
-
disabled,
|
|
19059
|
-
active
|
|
19535
|
+
disabled = false,
|
|
19536
|
+
active = false,
|
|
19537
|
+
children
|
|
19060
19538
|
}) {
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
{
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
disabled,
|
|
19067
|
-
style: {
|
|
19068
|
-
height: 28,
|
|
19069
|
-
padding: "0 10px",
|
|
19070
|
-
display: "inline-flex",
|
|
19071
|
-
alignItems: "center",
|
|
19072
|
-
gap: 4,
|
|
19073
|
-
borderRadius: 999,
|
|
19074
|
-
border: "none",
|
|
19075
|
-
cursor: disabled ? "default" : "pointer",
|
|
19076
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19077
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19078
|
-
opacity: disabled ? 0.4 : 1,
|
|
19079
|
-
fontSize: 12,
|
|
19080
|
-
lineHeight: "16px",
|
|
19081
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19082
|
-
whiteSpace: "nowrap",
|
|
19083
|
-
flex: "0 0 auto"
|
|
19084
|
-
},
|
|
19085
|
-
children: label
|
|
19086
|
-
}
|
|
19087
|
-
);
|
|
19539
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19540
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19541
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19542
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19543
|
+
] });
|
|
19088
19544
|
}
|
|
19089
|
-
function
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
},
|
|
19119
|
-
children: "Alt"
|
|
19120
|
-
}
|
|
19121
|
-
),
|
|
19122
|
-
/* @__PURE__ */ jsx20(
|
|
19123
|
-
"input",
|
|
19545
|
+
function ToolbarSeparator() {
|
|
19546
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19547
|
+
}
|
|
19548
|
+
function OptionMenu({
|
|
19549
|
+
label,
|
|
19550
|
+
value,
|
|
19551
|
+
options,
|
|
19552
|
+
onChange
|
|
19553
|
+
}) {
|
|
19554
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19555
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19556
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19557
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19558
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19559
|
+
"button",
|
|
19560
|
+
{
|
|
19561
|
+
type: "button",
|
|
19562
|
+
"aria-label": label,
|
|
19563
|
+
className: "inline-flex h-8 min-w-[76px] items-center gap-[7px] rounded-[6px] bg-transparent px-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted data-[state=open]:bg-muted",
|
|
19564
|
+
children: [
|
|
19565
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19566
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19567
|
+
]
|
|
19568
|
+
}
|
|
19569
|
+
) }),
|
|
19570
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19571
|
+
const selected = option.value === value;
|
|
19572
|
+
return /* @__PURE__ */ jsxs12(
|
|
19573
|
+
DropdownMenuItem,
|
|
19124
19574
|
{
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
"aria-label": "Image alt text",
|
|
19140
|
-
style: {
|
|
19141
|
-
flex: 1,
|
|
19142
|
-
minWidth: 0,
|
|
19143
|
-
border: "none",
|
|
19144
|
-
outline: "none",
|
|
19145
|
-
background: "transparent",
|
|
19146
|
-
fontSize: 12,
|
|
19147
|
-
lineHeight: "16px",
|
|
19148
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19149
|
-
color: "#1f2937"
|
|
19150
|
-
}
|
|
19151
|
-
}
|
|
19152
|
-
)
|
|
19153
|
-
]
|
|
19154
|
-
}
|
|
19155
|
-
);
|
|
19575
|
+
role: "menuitemradio",
|
|
19576
|
+
"aria-checked": selected,
|
|
19577
|
+
onSelect: () => onChange(option.value),
|
|
19578
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19579
|
+
children: [
|
|
19580
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19581
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19582
|
+
]
|
|
19583
|
+
},
|
|
19584
|
+
option.value
|
|
19585
|
+
);
|
|
19586
|
+
}) })
|
|
19587
|
+
] })
|
|
19588
|
+
] });
|
|
19156
19589
|
}
|
|
19157
19590
|
var VARIANTS = [
|
|
19158
19591
|
{ value: "logos", label: "Logos" },
|
|
19159
19592
|
{ value: "reel", label: "Reel" }
|
|
19160
19593
|
];
|
|
19161
19594
|
var ALIGNS = [
|
|
19162
|
-
{ value: "left", label: "
|
|
19163
|
-
{ value: "center", label: "
|
|
19164
|
-
{ value: "right", label: "
|
|
19595
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19596
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19597
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19165
19598
|
];
|
|
19166
19599
|
var HOVERS = [
|
|
19167
19600
|
{ value: "none", label: "None" },
|
|
@@ -19169,104 +19602,104 @@ var HOVERS = [
|
|
|
19169
19602
|
{ value: "zoom", label: "Zoom" },
|
|
19170
19603
|
{ value: "fade", label: "Fade" }
|
|
19171
19604
|
];
|
|
19172
|
-
var TREATMENTS = [
|
|
19173
|
-
{ value: "color", label: "Color" },
|
|
19174
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19175
|
-
];
|
|
19176
19605
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19177
|
-
function
|
|
19178
|
-
|
|
19606
|
+
function LinkModal({
|
|
19607
|
+
href,
|
|
19608
|
+
linkTarget,
|
|
19609
|
+
onClose,
|
|
19610
|
+
onSave
|
|
19611
|
+
}) {
|
|
19612
|
+
const [draft, setDraft] = useState8(href);
|
|
19613
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19179
19614
|
const [invalid, setInvalid] = useState8(false);
|
|
19180
|
-
|
|
19181
|
-
setDraft(value);
|
|
19182
|
-
setInvalid(false);
|
|
19183
|
-
}, [value]);
|
|
19184
|
-
const commit2 = () => {
|
|
19615
|
+
const save = () => {
|
|
19185
19616
|
const next = draft.trim();
|
|
19186
|
-
if (next
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
onCommit(next);
|
|
19190
|
-
};
|
|
19191
|
-
return /* @__PURE__ */ jsxs11(
|
|
19192
|
-
"div",
|
|
19193
|
-
{
|
|
19194
|
-
style: {
|
|
19195
|
-
display: "flex",
|
|
19196
|
-
alignItems: "center",
|
|
19197
|
-
gap: 6,
|
|
19198
|
-
height: 28,
|
|
19199
|
-
padding: "0 12px",
|
|
19200
|
-
borderRadius: 999,
|
|
19201
|
-
background: "#ffffff",
|
|
19202
|
-
width: "100%",
|
|
19203
|
-
maxWidth: 260,
|
|
19204
|
-
boxSizing: "border-box",
|
|
19205
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19206
|
-
},
|
|
19207
|
-
children: [
|
|
19208
|
-
/* @__PURE__ */ jsx20(
|
|
19209
|
-
"span",
|
|
19210
|
-
{
|
|
19211
|
-
style: {
|
|
19212
|
-
flex: "0 0 auto",
|
|
19213
|
-
color: OHW_BLUE_DARK,
|
|
19214
|
-
fontSize: 10,
|
|
19215
|
-
fontWeight: 700,
|
|
19216
|
-
textTransform: "uppercase",
|
|
19217
|
-
letterSpacing: 0.4
|
|
19218
|
-
},
|
|
19219
|
-
children: "Link"
|
|
19220
|
-
}
|
|
19221
|
-
),
|
|
19222
|
-
/* @__PURE__ */ jsx20(
|
|
19223
|
-
"input",
|
|
19224
|
-
{
|
|
19225
|
-
type: "text",
|
|
19226
|
-
inputMode: "url",
|
|
19227
|
-
value: draft,
|
|
19228
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19229
|
-
onBlur: commit2,
|
|
19230
|
-
onKeyDown: (e) => {
|
|
19231
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19232
|
-
if (e.key === "Escape") {
|
|
19233
|
-
setDraft(value);
|
|
19234
|
-
setInvalid(false);
|
|
19235
|
-
e.currentTarget.blur();
|
|
19236
|
-
}
|
|
19237
|
-
},
|
|
19238
|
-
placeholder: "https://example.com",
|
|
19239
|
-
"aria-label": "Image link URL",
|
|
19240
|
-
"aria-invalid": invalid,
|
|
19241
|
-
style: {
|
|
19242
|
-
flex: 1,
|
|
19243
|
-
minWidth: 0,
|
|
19244
|
-
border: "none",
|
|
19245
|
-
outline: "none",
|
|
19246
|
-
background: "transparent",
|
|
19247
|
-
fontSize: 12,
|
|
19248
|
-
lineHeight: "16px",
|
|
19249
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19250
|
-
color: "#1f2937"
|
|
19251
|
-
}
|
|
19252
|
-
}
|
|
19253
|
-
)
|
|
19254
|
-
]
|
|
19617
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19618
|
+
setInvalid(true);
|
|
19619
|
+
return;
|
|
19255
19620
|
}
|
|
19256
|
-
|
|
19621
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19622
|
+
onClose();
|
|
19623
|
+
};
|
|
19624
|
+
return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
19625
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19626
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
19627
|
+
/* @__PURE__ */ jsx21(
|
|
19628
|
+
"input",
|
|
19629
|
+
{
|
|
19630
|
+
autoFocus: true,
|
|
19631
|
+
type: "text",
|
|
19632
|
+
inputMode: "url",
|
|
19633
|
+
value: draft,
|
|
19634
|
+
onChange: (e) => {
|
|
19635
|
+
setDraft(e.target.value);
|
|
19636
|
+
setInvalid(false);
|
|
19637
|
+
},
|
|
19638
|
+
onKeyDown: (e) => {
|
|
19639
|
+
if (e.key === "Enter") save();
|
|
19640
|
+
},
|
|
19641
|
+
placeholder: "https://example.com",
|
|
19642
|
+
"aria-label": "Image link URL",
|
|
19643
|
+
"aria-invalid": invalid,
|
|
19644
|
+
className: cn(
|
|
19645
|
+
"h-9 w-full rounded-[6px] border border-border bg-background px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:border-bridge-primary",
|
|
19646
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19647
|
+
)
|
|
19648
|
+
}
|
|
19649
|
+
),
|
|
19650
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19651
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19652
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19653
|
+
"Open in new tab"
|
|
19654
|
+
] })
|
|
19655
|
+
] }),
|
|
19656
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
19657
|
+
href && /* @__PURE__ */ jsx21(
|
|
19658
|
+
"button",
|
|
19659
|
+
{
|
|
19660
|
+
type: "button",
|
|
19661
|
+
onClick: () => {
|
|
19662
|
+
onSave("", "new-tab");
|
|
19663
|
+
onClose();
|
|
19664
|
+
},
|
|
19665
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19666
|
+
children: "Remove link"
|
|
19667
|
+
}
|
|
19668
|
+
),
|
|
19669
|
+
/* @__PURE__ */ jsx21(
|
|
19670
|
+
"button",
|
|
19671
|
+
{
|
|
19672
|
+
type: "button",
|
|
19673
|
+
onClick: onClose,
|
|
19674
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19675
|
+
children: "Cancel"
|
|
19676
|
+
}
|
|
19677
|
+
),
|
|
19678
|
+
/* @__PURE__ */ jsx21(
|
|
19679
|
+
"button",
|
|
19680
|
+
{
|
|
19681
|
+
type: "button",
|
|
19682
|
+
onClick: save,
|
|
19683
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19684
|
+
children: "Save"
|
|
19685
|
+
}
|
|
19686
|
+
)
|
|
19687
|
+
] })
|
|
19688
|
+
] }) });
|
|
19257
19689
|
}
|
|
19258
19690
|
function MediaStripToolbar({
|
|
19259
19691
|
entry,
|
|
19260
19692
|
index,
|
|
19261
19693
|
pending,
|
|
19262
19694
|
error,
|
|
19695
|
+
itemEditOn,
|
|
19696
|
+
onToggleItemEdit,
|
|
19263
19697
|
onSetVariant,
|
|
19264
19698
|
onSetAlign,
|
|
19265
19699
|
onSetHover,
|
|
19266
19700
|
onSetTreatment,
|
|
19267
19701
|
onResize,
|
|
19268
|
-
|
|
19269
|
-
onSetLink,
|
|
19702
|
+
onOpenLink,
|
|
19270
19703
|
onAddItem,
|
|
19271
19704
|
onRemoveItem,
|
|
19272
19705
|
onChangeImage,
|
|
@@ -19275,81 +19708,102 @@ function MediaStripToolbar({
|
|
|
19275
19708
|
}) {
|
|
19276
19709
|
const items = mediaStripItems(entry.tree);
|
|
19277
19710
|
const itemCount = items.length;
|
|
19278
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19279
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19280
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19281
19711
|
const slots = findMediaStripSlots(entry.tree);
|
|
19282
19712
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19283
19713
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19284
19714
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19285
19715
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19286
19716
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19287
|
-
const
|
|
19288
|
-
const
|
|
19289
|
-
|
|
19290
|
-
gap: 6,
|
|
19291
|
-
flexWrap: "nowrap",
|
|
19292
|
-
justifyContent: "center",
|
|
19293
|
-
overflowX: "auto",
|
|
19294
|
-
WebkitOverflowScrolling: "touch",
|
|
19295
|
-
width: "100%",
|
|
19296
|
-
scrollbarWidth: "none"
|
|
19297
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19298
|
-
return /* @__PURE__ */ jsxs11(
|
|
19717
|
+
const mobile = window.innerWidth <= 480;
|
|
19718
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19719
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19299
19720
|
"div",
|
|
19300
19721
|
{
|
|
19301
19722
|
"data-ohw-bridge": "",
|
|
19302
19723
|
"data-ohw-toolbar": "",
|
|
19303
19724
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
flexDirection: "column",
|
|
19307
|
-
gap: 6,
|
|
19308
|
-
alignItems: "center",
|
|
19309
|
-
background: OHW_BLUE,
|
|
19310
|
-
padding: 8,
|
|
19311
|
-
borderRadius: 12,
|
|
19312
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19313
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19314
|
-
opacity: pending ? 0.6 : 1,
|
|
19315
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19316
|
-
},
|
|
19725
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19726
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19317
19727
|
children: [
|
|
19318
|
-
/* @__PURE__ */
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
|
|
19347
|
-
|
|
19348
|
-
|
|
19349
|
-
|
|
19728
|
+
/* @__PURE__ */ jsxs12(
|
|
19729
|
+
"div",
|
|
19730
|
+
{
|
|
19731
|
+
className: cn(
|
|
19732
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19733
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19734
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19735
|
+
),
|
|
19736
|
+
children: [
|
|
19737
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19738
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
19739
|
+
CustomToolbarButton,
|
|
19740
|
+
{
|
|
19741
|
+
type: "button",
|
|
19742
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19743
|
+
"aria-pressed": itemEditOn,
|
|
19744
|
+
onClick: onToggleItemEdit,
|
|
19745
|
+
className: "group size-8",
|
|
19746
|
+
children: /* @__PURE__ */ jsx21(
|
|
19747
|
+
Star,
|
|
19748
|
+
{
|
|
19749
|
+
size: 16,
|
|
19750
|
+
fill: "currentColor",
|
|
19751
|
+
strokeWidth: 0,
|
|
19752
|
+
className: cn(
|
|
19753
|
+
"transition-colors",
|
|
19754
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19755
|
+
),
|
|
19756
|
+
style: { pointerEvents: "none" }
|
|
19757
|
+
}
|
|
19758
|
+
)
|
|
19759
|
+
}
|
|
19760
|
+
) }),
|
|
19761
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19762
|
+
] }),
|
|
19763
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19764
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19765
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19766
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19767
|
+
/* @__PURE__ */ jsx21(
|
|
19768
|
+
ToolbarAction,
|
|
19769
|
+
{
|
|
19770
|
+
label: gatedLabel("Move right"),
|
|
19771
|
+
onClick: onMoveRight,
|
|
19772
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19773
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
19774
|
+
}
|
|
19775
|
+
),
|
|
19776
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19777
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19778
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19779
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19780
|
+
/* @__PURE__ */ jsx21(
|
|
19781
|
+
ToolbarAction,
|
|
19782
|
+
{
|
|
19783
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19784
|
+
active: treatment === "grayscale",
|
|
19785
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19786
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19787
|
+
}
|
|
19788
|
+
),
|
|
19789
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19790
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
19791
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19792
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19793
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19794
|
+
sizeValue,
|
|
19795
|
+
"px"
|
|
19796
|
+
] }),
|
|
19797
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19798
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19799
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19800
|
+
]
|
|
19801
|
+
}
|
|
19802
|
+
),
|
|
19803
|
+
error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19350
19804
|
]
|
|
19351
19805
|
}
|
|
19352
|
-
);
|
|
19806
|
+
) });
|
|
19353
19807
|
}
|
|
19354
19808
|
function findMediaStripSlots(tree) {
|
|
19355
19809
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19368,31 +19822,23 @@ function AiMediaStripOverlay({
|
|
|
19368
19822
|
}) {
|
|
19369
19823
|
const [hover, setHover] = useState8(null);
|
|
19370
19824
|
const [active, setActive] = useState8(null);
|
|
19825
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
19826
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19371
19827
|
const [pending, setPending] = useState8(false);
|
|
19372
19828
|
const [error, setError] = useState8(null);
|
|
19373
19829
|
const activeRef = useRef5(null);
|
|
19374
19830
|
activeRef.current = active;
|
|
19375
|
-
|
|
19831
|
+
const linkOpenRef = useRef5(false);
|
|
19832
|
+
linkOpenRef.current = linkOpen;
|
|
19833
|
+
useEffect9(() => {
|
|
19376
19834
|
const onMove = (e) => {
|
|
19835
|
+
const ref = itemRefFromTarget(e.target);
|
|
19377
19836
|
const t = e.target;
|
|
19378
|
-
|
|
19379
|
-
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
if (!itemEl) {
|
|
19384
|
-
setHover(null);
|
|
19385
|
-
return;
|
|
19386
|
-
}
|
|
19387
|
-
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19388
|
-
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19389
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19390
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19391
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19392
|
-
setHover(null);
|
|
19393
|
-
return;
|
|
19394
|
-
}
|
|
19395
|
-
setHover({ sectionId, index });
|
|
19837
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19838
|
+
setHover((prev) => {
|
|
19839
|
+
const next = ref && !overEditable ? ref : null;
|
|
19840
|
+
return sameRef(prev, next) ? prev : next;
|
|
19841
|
+
});
|
|
19396
19842
|
};
|
|
19397
19843
|
const onLeave = () => setHover(null);
|
|
19398
19844
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19402,35 +19848,40 @@ function AiMediaStripOverlay({
|
|
|
19402
19848
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19403
19849
|
};
|
|
19404
19850
|
}, []);
|
|
19405
|
-
|
|
19851
|
+
useEffect9(() => {
|
|
19406
19852
|
const onClick = (e) => {
|
|
19407
|
-
const current = activeRef.current;
|
|
19408
|
-
if (!current) return;
|
|
19409
19853
|
const t = e.target;
|
|
19410
|
-
if (!(t instanceof
|
|
19411
|
-
if (t.closest(
|
|
19412
|
-
const
|
|
19413
|
-
if (
|
|
19414
|
-
|
|
19854
|
+
if (!(t instanceof Element)) return;
|
|
19855
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19856
|
+
const ref = itemRefFromTarget(t);
|
|
19857
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19858
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19859
|
+
setItemEditOn(false);
|
|
19415
19860
|
setError(null);
|
|
19861
|
+
setActive(ref);
|
|
19416
19862
|
};
|
|
19417
19863
|
document.addEventListener("click", onClick, true);
|
|
19418
19864
|
return () => document.removeEventListener("click", onClick, true);
|
|
19419
|
-
}, []);
|
|
19420
|
-
|
|
19865
|
+
}, [clearInteractionChromeRef]);
|
|
19866
|
+
useEffect9(() => {
|
|
19421
19867
|
const onBlur = () => {
|
|
19422
19868
|
if (!activeRef.current) return;
|
|
19423
19869
|
setActive(null);
|
|
19870
|
+
setItemEditOn(false);
|
|
19871
|
+
setLinkOpen(false);
|
|
19424
19872
|
setError(null);
|
|
19425
19873
|
};
|
|
19426
19874
|
window.addEventListener("blur", onBlur);
|
|
19427
19875
|
return () => window.removeEventListener("blur", onBlur);
|
|
19428
19876
|
}, []);
|
|
19429
|
-
|
|
19877
|
+
useEffect9(() => {
|
|
19430
19878
|
const onKeyDown = (e) => {
|
|
19431
19879
|
if (e.key !== "Escape") return;
|
|
19432
19880
|
if (!activeRef.current) return;
|
|
19881
|
+
if (linkOpenRef.current) return;
|
|
19882
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19433
19883
|
setActive(null);
|
|
19884
|
+
setItemEditOn(false);
|
|
19434
19885
|
setError(null);
|
|
19435
19886
|
};
|
|
19436
19887
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19464,141 +19915,137 @@ function AiMediaStripOverlay({
|
|
|
19464
19915
|
tree: nextTree,
|
|
19465
19916
|
label: entry.label,
|
|
19466
19917
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19467
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19918
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
19919
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19920
|
+
// on every edit reads as the section jumping around.
|
|
19921
|
+
skipScrollIntoView: true
|
|
19468
19922
|
});
|
|
19469
19923
|
return true;
|
|
19470
19924
|
},
|
|
19471
19925
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19472
19926
|
);
|
|
19473
19927
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19474
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19475
19928
|
const activeItemRect = useLiveItemRect(active);
|
|
19476
|
-
const
|
|
19477
|
-
const
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19511
|
-
ItemInteractionLayer,
|
|
19512
|
-
{
|
|
19513
|
-
rect: activeItemRect,
|
|
19514
|
-
state: toolbarState,
|
|
19515
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19516
|
-
MediaStripToolbar,
|
|
19517
|
-
{
|
|
19518
|
-
entry: activeEntry,
|
|
19519
|
-
index: active.index,
|
|
19520
|
-
pending,
|
|
19521
|
-
error,
|
|
19522
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19523
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19524
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19525
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19526
|
-
onResize: (delta) => {
|
|
19527
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19528
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19529
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19530
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19531
|
-
},
|
|
19532
|
-
onSetAlt: (alt) => {
|
|
19533
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19534
|
-
},
|
|
19535
|
-
onSetLink: (href, linkTarget) => {
|
|
19929
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
19930
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
19931
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
19932
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
19933
|
+
const activeHref = activeItem?.href ?? "";
|
|
19934
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19935
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19936
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
19937
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19938
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
19939
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
19940
|
+
MediaStripToolbar,
|
|
19941
|
+
{
|
|
19942
|
+
entry: activeEntry,
|
|
19943
|
+
index: active.index,
|
|
19944
|
+
pending,
|
|
19945
|
+
error,
|
|
19946
|
+
itemEditOn,
|
|
19947
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
19948
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19949
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19950
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19951
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19952
|
+
onResize: (delta) => {
|
|
19953
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19954
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19955
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19956
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19957
|
+
},
|
|
19958
|
+
onOpenLink: () => setLinkOpen(true),
|
|
19959
|
+
onAddItem: () => {
|
|
19960
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19961
|
+
if (!picked) return;
|
|
19962
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19536
19963
|
void runMutation(
|
|
19537
19964
|
active.sectionId,
|
|
19538
|
-
(tree) =>
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19543
|
-
if (!picked) return;
|
|
19544
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19545
|
-
void runMutation(
|
|
19546
|
-
active.sectionId,
|
|
19547
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19548
|
-
{ [picked.assetId]: picked.url }
|
|
19549
|
-
).then((applied) => {
|
|
19550
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19551
|
-
});
|
|
19552
|
-
});
|
|
19553
|
-
},
|
|
19554
|
-
onChangeImage: () => {
|
|
19555
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19556
|
-
if (!picked) return;
|
|
19557
|
-
void runMutation(
|
|
19558
|
-
active.sectionId,
|
|
19559
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19560
|
-
{ [picked.assetId]: picked.url }
|
|
19561
|
-
);
|
|
19965
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19966
|
+
{ [picked.assetId]: picked.url }
|
|
19967
|
+
).then((applied) => {
|
|
19968
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19562
19969
|
});
|
|
19563
|
-
}
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19573
|
-
(applied) => {
|
|
19574
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19575
|
-
}
|
|
19576
|
-
);
|
|
19577
|
-
},
|
|
19578
|
-
onMoveRight: () => {
|
|
19579
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19580
|
-
(applied) => {
|
|
19581
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19582
|
-
}
|
|
19970
|
+
});
|
|
19971
|
+
},
|
|
19972
|
+
onChangeImage: () => {
|
|
19973
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19974
|
+
if (!picked) return;
|
|
19975
|
+
void runMutation(
|
|
19976
|
+
active.sectionId,
|
|
19977
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19978
|
+
{ [picked.assetId]: picked.url }
|
|
19583
19979
|
);
|
|
19584
|
-
}
|
|
19980
|
+
});
|
|
19981
|
+
},
|
|
19982
|
+
onRemoveItem: () => {
|
|
19983
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19984
|
+
(applied) => {
|
|
19985
|
+
if (applied) setActive(null);
|
|
19986
|
+
}
|
|
19987
|
+
);
|
|
19988
|
+
},
|
|
19989
|
+
onMoveLeft: () => {
|
|
19990
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19991
|
+
(applied) => {
|
|
19992
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19993
|
+
}
|
|
19994
|
+
);
|
|
19995
|
+
},
|
|
19996
|
+
onMoveRight: () => {
|
|
19997
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19998
|
+
(applied) => {
|
|
19999
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
20000
|
+
}
|
|
20001
|
+
);
|
|
19585
20002
|
}
|
|
19586
|
-
|
|
19587
|
-
}
|
|
19588
|
-
|
|
20003
|
+
}
|
|
20004
|
+
) }),
|
|
20005
|
+
/* @__PURE__ */ jsx21(
|
|
20006
|
+
"div",
|
|
20007
|
+
{
|
|
20008
|
+
"data-ohw-bridge": "",
|
|
20009
|
+
"data-ohw-item-interaction": "",
|
|
20010
|
+
"aria-hidden": true,
|
|
20011
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20012
|
+
style: {
|
|
20013
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20014
|
+
left: activeItemRect.left - 5,
|
|
20015
|
+
background: PRIMARY3,
|
|
20016
|
+
zIndex: 2147483644
|
|
20017
|
+
},
|
|
20018
|
+
children: "Media item"
|
|
20019
|
+
}
|
|
20020
|
+
),
|
|
20021
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
20022
|
+
LinkModal,
|
|
20023
|
+
{
|
|
20024
|
+
href: activeHref,
|
|
20025
|
+
linkTarget: activeTarget,
|
|
20026
|
+
onClose: () => setLinkOpen(false),
|
|
20027
|
+
onSave: (href, linkTarget) => {
|
|
20028
|
+
void runMutation(
|
|
20029
|
+
active.sectionId,
|
|
20030
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20031
|
+
);
|
|
20032
|
+
}
|
|
20033
|
+
}
|
|
20034
|
+
)
|
|
20035
|
+
] })
|
|
19589
20036
|
] });
|
|
19590
20037
|
}
|
|
19591
20038
|
|
|
19592
20039
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19593
|
-
import { useCallback as useCallback4, useEffect as
|
|
19594
|
-
import { Check as
|
|
19595
|
-
import { Fragment as Fragment8, jsx as
|
|
20040
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
20041
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
20042
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19596
20043
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19597
|
-
var
|
|
20044
|
+
var CHROME_SELECTOR2 = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
|
|
19598
20045
|
function findPricingCardElement(sectionId, index) {
|
|
19599
|
-
const
|
|
19600
|
-
if (!
|
|
19601
|
-
const cards =
|
|
20046
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
20047
|
+
if (!sectionEl2) return null;
|
|
20048
|
+
const cards = sectionEl2.querySelectorAll("[data-ohw-pricing-card]");
|
|
19602
20049
|
for (const el of Array.from(cards)) {
|
|
19603
20050
|
if (Number(el.dataset.ohwPricingIndex) === index) return el;
|
|
19604
20051
|
}
|
|
@@ -19606,35 +20053,35 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19606
20053
|
}
|
|
19607
20054
|
function cardRefFromTarget(target) {
|
|
19608
20055
|
if (!(target instanceof Element)) return null;
|
|
19609
|
-
if (target.closest(
|
|
20056
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19610
20057
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19611
20058
|
if (!cardEl) return null;
|
|
19612
|
-
const
|
|
19613
|
-
const unit =
|
|
20059
|
+
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
20060
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
19614
20061
|
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19615
20062
|
const index = Number(cardEl.dataset.ohwPricingIndex);
|
|
19616
20063
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19617
20064
|
return { sectionId, index };
|
|
19618
20065
|
}
|
|
19619
|
-
function
|
|
20066
|
+
function sameRef2(a, b) {
|
|
19620
20067
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19621
20068
|
}
|
|
19622
|
-
function
|
|
20069
|
+
function rectOf2(el) {
|
|
19623
20070
|
if (!el) return null;
|
|
19624
20071
|
const r2 = el.getBoundingClientRect();
|
|
19625
20072
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19626
20073
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19627
20074
|
}
|
|
19628
20075
|
function readRect3(ref) {
|
|
19629
|
-
return
|
|
20076
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19630
20077
|
}
|
|
19631
20078
|
function readGridRect(ref) {
|
|
19632
20079
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19633
|
-
return
|
|
20080
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19634
20081
|
}
|
|
19635
20082
|
function useLiveCardRect(ref, grid = false) {
|
|
19636
20083
|
const [rect, setRect] = useState9(null);
|
|
19637
|
-
|
|
20084
|
+
useEffect10(() => {
|
|
19638
20085
|
if (!ref) {
|
|
19639
20086
|
setRect(null);
|
|
19640
20087
|
return;
|
|
@@ -19660,19 +20107,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19660
20107
|
}
|
|
19661
20108
|
var TOOLBAR_GRID_GAP = 52;
|
|
19662
20109
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19663
|
-
var
|
|
20110
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19664
20111
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19665
20112
|
const slotRef = useRef6(null);
|
|
19666
20113
|
const [shift, setShift] = useState9(0);
|
|
19667
20114
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19668
|
-
|
|
20115
|
+
useLayoutEffect5(() => {
|
|
19669
20116
|
const slot = slotRef.current;
|
|
19670
20117
|
if (!slot) return;
|
|
19671
20118
|
const clamp = () => {
|
|
19672
20119
|
const w = slot.offsetWidth;
|
|
19673
20120
|
if (w <= 0) return;
|
|
19674
20121
|
const half = w / 2;
|
|
19675
|
-
const clamped = Math.max(
|
|
20122
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19676
20123
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19677
20124
|
};
|
|
19678
20125
|
clamp();
|
|
@@ -19681,7 +20128,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19681
20128
|
return () => ro.disconnect();
|
|
19682
20129
|
}, [centerX, children]);
|
|
19683
20130
|
const mobile = window.innerWidth <= 480;
|
|
19684
|
-
return /* @__PURE__ */
|
|
20131
|
+
return /* @__PURE__ */ jsx22(
|
|
19685
20132
|
"div",
|
|
19686
20133
|
{
|
|
19687
20134
|
ref: slotRef,
|
|
@@ -19716,7 +20163,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19716
20163
|
});
|
|
19717
20164
|
}
|
|
19718
20165
|
function StyleSwatch({ style }) {
|
|
19719
|
-
return /* @__PURE__ */
|
|
20166
|
+
return /* @__PURE__ */ jsx22(
|
|
19720
20167
|
"span",
|
|
19721
20168
|
{
|
|
19722
20169
|
"aria-hidden": true,
|
|
@@ -19730,35 +20177,35 @@ function StyleSwatch({ style }) {
|
|
|
19730
20177
|
);
|
|
19731
20178
|
}
|
|
19732
20179
|
function ButtonGlyph() {
|
|
19733
|
-
return /* @__PURE__ */
|
|
19734
|
-
/* @__PURE__ */
|
|
19735
|
-
/* @__PURE__ */
|
|
20180
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20181
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20182
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19736
20183
|
] });
|
|
19737
20184
|
}
|
|
19738
20185
|
function FeatureGlyph({ mode }) {
|
|
19739
|
-
return /* @__PURE__ */
|
|
19740
|
-
/* @__PURE__ */
|
|
19741
|
-
/* @__PURE__ */
|
|
19742
|
-
/* @__PURE__ */
|
|
19743
|
-
/* @__PURE__ */
|
|
19744
|
-
/* @__PURE__ */
|
|
19745
|
-
mode === "add" && /* @__PURE__ */
|
|
20186
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20187
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20188
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20189
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20190
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20191
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20192
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19746
20193
|
] });
|
|
19747
20194
|
}
|
|
19748
|
-
function
|
|
20195
|
+
function ToolbarAction2({
|
|
19749
20196
|
label,
|
|
19750
20197
|
onClick,
|
|
19751
20198
|
disabled = false,
|
|
19752
20199
|
children
|
|
19753
20200
|
}) {
|
|
19754
|
-
const button = /* @__PURE__ */
|
|
19755
|
-
return /* @__PURE__ */
|
|
19756
|
-
/* @__PURE__ */
|
|
19757
|
-
/* @__PURE__ */
|
|
20201
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20202
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20203
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20204
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19758
20205
|
] });
|
|
19759
20206
|
}
|
|
19760
|
-
function
|
|
19761
|
-
return /* @__PURE__ */
|
|
20207
|
+
function ToolbarSeparator2() {
|
|
20208
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19762
20209
|
}
|
|
19763
20210
|
function CardStyleMenu({
|
|
19764
20211
|
value,
|
|
@@ -19766,7 +20213,7 @@ function CardStyleMenu({
|
|
|
19766
20213
|
disabled = false
|
|
19767
20214
|
}) {
|
|
19768
20215
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19769
|
-
const trigger = /* @__PURE__ */
|
|
20216
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
19770
20217
|
"button",
|
|
19771
20218
|
{
|
|
19772
20219
|
type: "button",
|
|
@@ -19777,28 +20224,28 @@ function CardStyleMenu({
|
|
|
19777
20224
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19778
20225
|
),
|
|
19779
20226
|
children: [
|
|
19780
|
-
/* @__PURE__ */
|
|
19781
|
-
/* @__PURE__ */
|
|
19782
|
-
/* @__PURE__ */
|
|
20227
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20228
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20229
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
19783
20230
|
]
|
|
19784
20231
|
}
|
|
19785
20232
|
);
|
|
19786
20233
|
if (disabled) {
|
|
19787
|
-
return /* @__PURE__ */
|
|
19788
|
-
/* @__PURE__ */
|
|
19789
|
-
/* @__PURE__ */
|
|
19790
|
-
/* @__PURE__ */
|
|
19791
|
-
/* @__PURE__ */
|
|
20234
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20235
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20236
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20237
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20238
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19792
20239
|
] })
|
|
19793
20240
|
] });
|
|
19794
20241
|
}
|
|
19795
|
-
return /* @__PURE__ */
|
|
19796
|
-
/* @__PURE__ */
|
|
19797
|
-
/* @__PURE__ */
|
|
19798
|
-
/* @__PURE__ */
|
|
19799
|
-
/* @__PURE__ */
|
|
20242
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20243
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20244
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20245
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20246
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19800
20247
|
const selected = style.value === value;
|
|
19801
|
-
return /* @__PURE__ */
|
|
20248
|
+
return /* @__PURE__ */ jsxs13(
|
|
19802
20249
|
DropdownMenuItem,
|
|
19803
20250
|
{
|
|
19804
20251
|
role: "menuitemradio",
|
|
@@ -19806,9 +20253,9 @@ function CardStyleMenu({
|
|
|
19806
20253
|
onSelect: () => onChange(style.value),
|
|
19807
20254
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19808
20255
|
children: [
|
|
19809
|
-
/* @__PURE__ */
|
|
19810
|
-
/* @__PURE__ */
|
|
19811
|
-
selected && /* @__PURE__ */
|
|
20256
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20257
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20258
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
19812
20259
|
]
|
|
19813
20260
|
},
|
|
19814
20261
|
style.value
|
|
@@ -19838,7 +20285,7 @@ function PricingCardToolbar({
|
|
|
19838
20285
|
const style = pricingCardStyle(entry.tree, index);
|
|
19839
20286
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19840
20287
|
const mobile = window.innerWidth <= 480;
|
|
19841
|
-
return /* @__PURE__ */
|
|
20288
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
19842
20289
|
"div",
|
|
19843
20290
|
{
|
|
19844
20291
|
"data-ohw-bridge": "",
|
|
@@ -19850,7 +20297,7 @@ function PricingCardToolbar({
|
|
|
19850
20297
|
),
|
|
19851
20298
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19852
20299
|
children: [
|
|
19853
|
-
/* @__PURE__ */
|
|
20300
|
+
/* @__PURE__ */ jsxs13(
|
|
19854
20301
|
"div",
|
|
19855
20302
|
{
|
|
19856
20303
|
className: cn(
|
|
@@ -19859,8 +20306,8 @@ function PricingCardToolbar({
|
|
|
19859
20306
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19860
20307
|
),
|
|
19861
20308
|
children: [
|
|
19862
|
-
/* @__PURE__ */
|
|
19863
|
-
/* @__PURE__ */
|
|
20309
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20310
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
19864
20311
|
CustomToolbarButton,
|
|
19865
20312
|
{
|
|
19866
20313
|
type: "button",
|
|
@@ -19868,7 +20315,7 @@ function PricingCardToolbar({
|
|
|
19868
20315
|
"aria-pressed": featuredTag,
|
|
19869
20316
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19870
20317
|
className: "group size-8",
|
|
19871
|
-
children: /* @__PURE__ */
|
|
20318
|
+
children: /* @__PURE__ */ jsx22(
|
|
19872
20319
|
Star2,
|
|
19873
20320
|
{
|
|
19874
20321
|
size: 16,
|
|
@@ -19883,25 +20330,25 @@ function PricingCardToolbar({
|
|
|
19883
20330
|
)
|
|
19884
20331
|
}
|
|
19885
20332
|
) }),
|
|
19886
|
-
/* @__PURE__ */
|
|
20333
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
19887
20334
|
] }),
|
|
19888
|
-
/* @__PURE__ */
|
|
19889
|
-
/* @__PURE__ */
|
|
19890
|
-
/* @__PURE__ */
|
|
19891
|
-
/* @__PURE__ */
|
|
19892
|
-
/* @__PURE__ */
|
|
19893
|
-
/* @__PURE__ */
|
|
19894
|
-
/* @__PURE__ */
|
|
20335
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20336
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20337
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20338
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20339
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20340
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20341
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
19895
20342
|
] }) }),
|
|
19896
|
-
/* @__PURE__ */
|
|
19897
|
-
/* @__PURE__ */
|
|
19898
|
-
/* @__PURE__ */
|
|
19899
|
-
/* @__PURE__ */
|
|
19900
|
-
/* @__PURE__ */
|
|
20343
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20344
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20345
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20346
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20347
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19901
20348
|
]
|
|
19902
20349
|
}
|
|
19903
20350
|
),
|
|
19904
|
-
error && /* @__PURE__ */
|
|
20351
|
+
error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
19905
20352
|
]
|
|
19906
20353
|
}
|
|
19907
20354
|
) });
|
|
@@ -19928,14 +20375,14 @@ function AiPricingCardOverlay({
|
|
|
19928
20375
|
const [error, setError] = useState9(null);
|
|
19929
20376
|
const activeRef = useRef6(null);
|
|
19930
20377
|
activeRef.current = active;
|
|
19931
|
-
|
|
20378
|
+
useEffect10(() => {
|
|
19932
20379
|
const onMove = (e) => {
|
|
19933
20380
|
const ref = cardRefFromTarget(e.target);
|
|
19934
20381
|
const t = e.target;
|
|
19935
20382
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
19936
20383
|
setHover((prev) => {
|
|
19937
20384
|
const next = ref && !overEditable ? ref : null;
|
|
19938
|
-
return
|
|
20385
|
+
return sameRef2(prev, next) ? prev : next;
|
|
19939
20386
|
});
|
|
19940
20387
|
};
|
|
19941
20388
|
const onLeave = () => setHover(null);
|
|
@@ -19946,19 +20393,19 @@ function AiPricingCardOverlay({
|
|
|
19946
20393
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19947
20394
|
};
|
|
19948
20395
|
}, []);
|
|
19949
|
-
|
|
20396
|
+
useEffect10(() => {
|
|
19950
20397
|
const onClick = (e) => {
|
|
19951
20398
|
const t = e.target;
|
|
19952
20399
|
if (!(t instanceof Element)) return;
|
|
19953
|
-
if (t.closest(
|
|
20400
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
19954
20401
|
const ref = cardRefFromTarget(t);
|
|
19955
|
-
setActive((prev) =>
|
|
19956
|
-
if (!ref || !
|
|
20402
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20403
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
19957
20404
|
};
|
|
19958
20405
|
document.addEventListener("click", onClick, true);
|
|
19959
20406
|
return () => document.removeEventListener("click", onClick, true);
|
|
19960
20407
|
}, []);
|
|
19961
|
-
|
|
20408
|
+
useEffect10(() => {
|
|
19962
20409
|
const onBlur = () => {
|
|
19963
20410
|
if (!activeRef.current) return;
|
|
19964
20411
|
setActive(null);
|
|
@@ -19967,7 +20414,7 @@ function AiPricingCardOverlay({
|
|
|
19967
20414
|
window.addEventListener("blur", onBlur);
|
|
19968
20415
|
return () => window.removeEventListener("blur", onBlur);
|
|
19969
20416
|
}, []);
|
|
19970
|
-
|
|
20417
|
+
useEffect10(() => {
|
|
19971
20418
|
const onKeyDown = (e) => {
|
|
19972
20419
|
if (e.key !== "Escape") return;
|
|
19973
20420
|
if (!activeRef.current) return;
|
|
@@ -20018,12 +20465,12 @@ function AiPricingCardOverlay({
|
|
|
20018
20465
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20019
20466
|
const activeCardRect = useLiveCardRect(active);
|
|
20020
20467
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20021
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20022
|
-
return /* @__PURE__ */
|
|
20023
|
-
hoverRect && /* @__PURE__ */
|
|
20024
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
20025
|
-
/* @__PURE__ */
|
|
20026
|
-
/* @__PURE__ */
|
|
20468
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20469
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20470
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20471
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20472
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20473
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
20027
20474
|
PricingCardToolbar,
|
|
20028
20475
|
{
|
|
20029
20476
|
entry: activeEntry,
|
|
@@ -20051,7 +20498,7 @@ function AiPricingCardOverlay({
|
|
|
20051
20498
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20052
20499
|
}
|
|
20053
20500
|
) }),
|
|
20054
|
-
/* @__PURE__ */
|
|
20501
|
+
/* @__PURE__ */ jsx22(
|
|
20055
20502
|
"div",
|
|
20056
20503
|
{
|
|
20057
20504
|
"data-ohw-bridge": "",
|
|
@@ -20072,7 +20519,7 @@ function AiPricingCardOverlay({
|
|
|
20072
20519
|
}
|
|
20073
20520
|
|
|
20074
20521
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20075
|
-
import { useCallback as useCallback5, useEffect as
|
|
20522
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef7, useState as useState10 } from "react";
|
|
20076
20523
|
import { Star as Star3 } from "lucide-react";
|
|
20077
20524
|
|
|
20078
20525
|
// src/lib/ai-video-tree.ts
|
|
@@ -20115,43 +20562,15 @@ function clearVideo(tree, path) {
|
|
|
20115
20562
|
});
|
|
20116
20563
|
}
|
|
20117
20564
|
|
|
20118
|
-
// src/lib/youtube.ts
|
|
20119
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20120
|
-
function extractYouTubeId(input) {
|
|
20121
|
-
const trimmed = input.trim();
|
|
20122
|
-
if (!trimmed) return null;
|
|
20123
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20124
|
-
let url;
|
|
20125
|
-
try {
|
|
20126
|
-
url = new URL(trimmed);
|
|
20127
|
-
} catch {
|
|
20128
|
-
return null;
|
|
20129
|
-
}
|
|
20130
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20131
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20132
|
-
return null;
|
|
20133
|
-
}
|
|
20134
|
-
let candidate = null;
|
|
20135
|
-
if (host === "youtu.be") {
|
|
20136
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20137
|
-
} else if (url.pathname === "/watch") {
|
|
20138
|
-
candidate = url.searchParams.get("v");
|
|
20139
|
-
} else {
|
|
20140
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20141
|
-
candidate = match ? match[1] : null;
|
|
20142
|
-
}
|
|
20143
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20144
|
-
}
|
|
20145
|
-
|
|
20146
20565
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20147
|
-
import { Fragment as Fragment9, jsx as
|
|
20566
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20148
20567
|
var PRIMARY5 = "#0885FE";
|
|
20149
|
-
var
|
|
20150
|
-
var
|
|
20568
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20569
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20151
20570
|
function findVideoBlockElement(sectionId, path) {
|
|
20152
|
-
const
|
|
20153
|
-
if (!
|
|
20154
|
-
const items =
|
|
20571
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
20572
|
+
if (!sectionEl2) return null;
|
|
20573
|
+
const items = sectionEl2.querySelectorAll("[data-ohw-video-block]");
|
|
20155
20574
|
for (const el of Array.from(items)) {
|
|
20156
20575
|
if (el.dataset.ohwVideoPath === path) return el;
|
|
20157
20576
|
}
|
|
@@ -20166,7 +20585,7 @@ function readRect4(ref) {
|
|
|
20166
20585
|
}
|
|
20167
20586
|
function useLiveBlockRect(ref) {
|
|
20168
20587
|
const [rect, setRect] = useState10(null);
|
|
20169
|
-
|
|
20588
|
+
useEffect11(() => {
|
|
20170
20589
|
if (!ref) {
|
|
20171
20590
|
setRect(null);
|
|
20172
20591
|
return;
|
|
@@ -20207,12 +20626,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20207
20626
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20208
20627
|
});
|
|
20209
20628
|
}
|
|
20210
|
-
function
|
|
20629
|
+
function Pill({
|
|
20211
20630
|
label,
|
|
20212
20631
|
onClick,
|
|
20213
20632
|
disabled
|
|
20214
20633
|
}) {
|
|
20215
|
-
return /* @__PURE__ */
|
|
20634
|
+
return /* @__PURE__ */ jsx23(
|
|
20216
20635
|
"button",
|
|
20217
20636
|
{
|
|
20218
20637
|
type: "button",
|
|
@@ -20228,7 +20647,7 @@ function Pill2({
|
|
|
20228
20647
|
border: "none",
|
|
20229
20648
|
cursor: disabled ? "default" : "pointer",
|
|
20230
20649
|
background: "#ffffff",
|
|
20231
|
-
color:
|
|
20650
|
+
color: OHW_BLUE_DARK,
|
|
20232
20651
|
opacity: disabled ? 0.4 : 1,
|
|
20233
20652
|
fontSize: 12,
|
|
20234
20653
|
lineHeight: "16px",
|
|
@@ -20246,7 +20665,7 @@ function watchUrl(id) {
|
|
|
20246
20665
|
function VideoUrlInput({ value, onCommit }) {
|
|
20247
20666
|
const [draft, setDraft] = useState10(value ? watchUrl(value) : "");
|
|
20248
20667
|
const [invalid, setInvalid] = useState10(false);
|
|
20249
|
-
|
|
20668
|
+
useEffect11(() => {
|
|
20250
20669
|
setDraft(value ? watchUrl(value) : "");
|
|
20251
20670
|
setInvalid(false);
|
|
20252
20671
|
}, [value]);
|
|
@@ -20271,8 +20690,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20271
20690
|
onCommit(id);
|
|
20272
20691
|
}
|
|
20273
20692
|
};
|
|
20274
|
-
return /* @__PURE__ */
|
|
20275
|
-
/* @__PURE__ */
|
|
20693
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20694
|
+
/* @__PURE__ */ jsxs14(
|
|
20276
20695
|
"div",
|
|
20277
20696
|
{
|
|
20278
20697
|
style: {
|
|
@@ -20288,12 +20707,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20288
20707
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20289
20708
|
},
|
|
20290
20709
|
children: [
|
|
20291
|
-
/* @__PURE__ */
|
|
20710
|
+
/* @__PURE__ */ jsx23(
|
|
20292
20711
|
"span",
|
|
20293
20712
|
{
|
|
20294
20713
|
style: {
|
|
20295
20714
|
flex: "0 0 auto",
|
|
20296
|
-
color:
|
|
20715
|
+
color: OHW_BLUE_DARK,
|
|
20297
20716
|
fontSize: 10,
|
|
20298
20717
|
lineHeight: "16px",
|
|
20299
20718
|
fontWeight: 700,
|
|
@@ -20303,7 +20722,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20303
20722
|
children: "Video"
|
|
20304
20723
|
}
|
|
20305
20724
|
),
|
|
20306
|
-
/* @__PURE__ */
|
|
20725
|
+
/* @__PURE__ */ jsx23(
|
|
20307
20726
|
"input",
|
|
20308
20727
|
{
|
|
20309
20728
|
type: "text",
|
|
@@ -20340,7 +20759,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20340
20759
|
]
|
|
20341
20760
|
}
|
|
20342
20761
|
),
|
|
20343
|
-
invalid && /* @__PURE__ */
|
|
20762
|
+
invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
20344
20763
|
] });
|
|
20345
20764
|
}
|
|
20346
20765
|
function VideoToolbar({
|
|
@@ -20350,7 +20769,7 @@ function VideoToolbar({
|
|
|
20350
20769
|
onSetVideoId,
|
|
20351
20770
|
onRemove
|
|
20352
20771
|
}) {
|
|
20353
|
-
return /* @__PURE__ */
|
|
20772
|
+
return /* @__PURE__ */ jsxs14(
|
|
20354
20773
|
"div",
|
|
20355
20774
|
{
|
|
20356
20775
|
"data-ohw-bridge": "",
|
|
@@ -20362,7 +20781,7 @@ function VideoToolbar({
|
|
|
20362
20781
|
gap: 6,
|
|
20363
20782
|
alignItems: "center",
|
|
20364
20783
|
width: 280,
|
|
20365
|
-
background:
|
|
20784
|
+
background: OHW_BLUE,
|
|
20366
20785
|
padding: 8,
|
|
20367
20786
|
borderRadius: 12,
|
|
20368
20787
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20370,9 +20789,9 @@ function VideoToolbar({
|
|
|
20370
20789
|
opacity: pending ? 0.6 : 1
|
|
20371
20790
|
},
|
|
20372
20791
|
children: [
|
|
20373
|
-
/* @__PURE__ */
|
|
20374
|
-
/* @__PURE__ */
|
|
20375
|
-
error && /* @__PURE__ */
|
|
20792
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20793
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20794
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20376
20795
|
]
|
|
20377
20796
|
}
|
|
20378
20797
|
);
|
|
@@ -20389,7 +20808,7 @@ function AiVideoOverlay({
|
|
|
20389
20808
|
const [error, setError] = useState10(null);
|
|
20390
20809
|
const activeRef = useRef7(null);
|
|
20391
20810
|
activeRef.current = active;
|
|
20392
|
-
|
|
20811
|
+
useEffect11(() => {
|
|
20393
20812
|
const onMove = (e) => {
|
|
20394
20813
|
const t = e.target;
|
|
20395
20814
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -20401,8 +20820,8 @@ function AiVideoOverlay({
|
|
|
20401
20820
|
setHover(null);
|
|
20402
20821
|
return;
|
|
20403
20822
|
}
|
|
20404
|
-
const
|
|
20405
|
-
const unit =
|
|
20823
|
+
const sectionEl2 = blockEl.closest("[data-ohw-section]");
|
|
20824
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
20406
20825
|
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
20407
20826
|
const path = blockEl.dataset.ohwVideoPath;
|
|
20408
20827
|
if (!sectionId || !path) {
|
|
@@ -20419,7 +20838,7 @@ function AiVideoOverlay({
|
|
|
20419
20838
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20420
20839
|
};
|
|
20421
20840
|
}, []);
|
|
20422
|
-
|
|
20841
|
+
useEffect11(() => {
|
|
20423
20842
|
const onClick = (e) => {
|
|
20424
20843
|
const current = activeRef.current;
|
|
20425
20844
|
if (!current) return;
|
|
@@ -20434,7 +20853,7 @@ function AiVideoOverlay({
|
|
|
20434
20853
|
document.addEventListener("click", onClick, true);
|
|
20435
20854
|
return () => document.removeEventListener("click", onClick, true);
|
|
20436
20855
|
}, []);
|
|
20437
|
-
|
|
20856
|
+
useEffect11(() => {
|
|
20438
20857
|
const onBlur = () => {
|
|
20439
20858
|
if (!activeRef.current) return;
|
|
20440
20859
|
setActive(null);
|
|
@@ -20443,7 +20862,7 @@ function AiVideoOverlay({
|
|
|
20443
20862
|
window.addEventListener("blur", onBlur);
|
|
20444
20863
|
return () => window.removeEventListener("blur", onBlur);
|
|
20445
20864
|
}, []);
|
|
20446
|
-
|
|
20865
|
+
useEffect11(() => {
|
|
20447
20866
|
const onKeyDown = (e) => {
|
|
20448
20867
|
if (e.key !== "Escape") return;
|
|
20449
20868
|
if (!activeRef.current) return;
|
|
@@ -20492,8 +20911,8 @@ function AiVideoOverlay({
|
|
|
20492
20911
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20493
20912
|
const TOOLBAR_APPROX_H = 90;
|
|
20494
20913
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20495
|
-
return /* @__PURE__ */
|
|
20496
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
20914
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
20915
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20497
20916
|
"button",
|
|
20498
20917
|
{
|
|
20499
20918
|
type: "button",
|
|
@@ -20521,15 +20940,15 @@ function AiVideoOverlay({
|
|
|
20521
20940
|
fontSize: 14,
|
|
20522
20941
|
fontWeight: 700
|
|
20523
20942
|
},
|
|
20524
|
-
children: /* @__PURE__ */
|
|
20943
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20525
20944
|
}
|
|
20526
20945
|
),
|
|
20527
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
20946
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20528
20947
|
ItemInteractionLayer,
|
|
20529
20948
|
{
|
|
20530
20949
|
rect: activeBlockRect,
|
|
20531
20950
|
state: toolbarState,
|
|
20532
|
-
toolbar: /* @__PURE__ */
|
|
20951
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20533
20952
|
VideoToolbar,
|
|
20534
20953
|
{
|
|
20535
20954
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20552,7 +20971,7 @@ function AiVideoOverlay({
|
|
|
20552
20971
|
}
|
|
20553
20972
|
|
|
20554
20973
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20555
|
-
import { useCallback as useCallback6, useEffect as
|
|
20974
|
+
import { useCallback as useCallback6, useEffect as useEffect12, useRef as useRef8, useState as useState11 } from "react";
|
|
20556
20975
|
import { Star as Star4 } from "lucide-react";
|
|
20557
20976
|
|
|
20558
20977
|
// src/lib/ai-carousel-tree.ts
|
|
@@ -20604,14 +21023,14 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20604
21023
|
}
|
|
20605
21024
|
|
|
20606
21025
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20607
|
-
import { Fragment as Fragment10, jsx as
|
|
21026
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20608
21027
|
var PRIMARY6 = "#0885FE";
|
|
20609
|
-
var
|
|
20610
|
-
var
|
|
21028
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21029
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20611
21030
|
function findCarouselItemElement(sectionId, index) {
|
|
20612
|
-
const
|
|
20613
|
-
if (!
|
|
20614
|
-
const items =
|
|
21031
|
+
const sectionEl2 = findByInstanceId(sectionId);
|
|
21032
|
+
if (!sectionEl2) return null;
|
|
21033
|
+
const items = sectionEl2.querySelectorAll("[data-ohw-fade-carousel-item]");
|
|
20615
21034
|
for (const el of Array.from(items)) {
|
|
20616
21035
|
if (Number(el.dataset.ohwFadeCarouselIndex) === index) return el;
|
|
20617
21036
|
}
|
|
@@ -20626,7 +21045,7 @@ function readRect5(ref) {
|
|
|
20626
21045
|
}
|
|
20627
21046
|
function useLiveItemRect2(ref) {
|
|
20628
21047
|
const [rect, setRect] = useState11(null);
|
|
20629
|
-
|
|
21048
|
+
useEffect12(() => {
|
|
20630
21049
|
if (!ref) {
|
|
20631
21050
|
setRect(null);
|
|
20632
21051
|
return;
|
|
@@ -20686,8 +21105,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20686
21105
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20687
21106
|
});
|
|
20688
21107
|
}
|
|
20689
|
-
function
|
|
20690
|
-
return /* @__PURE__ */
|
|
21108
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21109
|
+
return /* @__PURE__ */ jsx24(
|
|
20691
21110
|
"button",
|
|
20692
21111
|
{
|
|
20693
21112
|
type: "button",
|
|
@@ -20703,7 +21122,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20703
21122
|
border: "none",
|
|
20704
21123
|
cursor: disabled ? "default" : "pointer",
|
|
20705
21124
|
background: "#ffffff",
|
|
20706
|
-
color:
|
|
21125
|
+
color: OHW_BLUE_DARK2,
|
|
20707
21126
|
opacity: disabled ? 0.4 : 1,
|
|
20708
21127
|
fontSize: 12,
|
|
20709
21128
|
lineHeight: "16px",
|
|
@@ -20721,7 +21140,7 @@ function TogglePill({
|
|
|
20721
21140
|
onToggle,
|
|
20722
21141
|
disabled
|
|
20723
21142
|
}) {
|
|
20724
|
-
return /* @__PURE__ */
|
|
21143
|
+
return /* @__PURE__ */ jsxs15(
|
|
20725
21144
|
"button",
|
|
20726
21145
|
{
|
|
20727
21146
|
type: "button",
|
|
@@ -20740,7 +21159,7 @@ function TogglePill({
|
|
|
20740
21159
|
border: "none",
|
|
20741
21160
|
cursor: disabled ? "default" : "pointer",
|
|
20742
21161
|
background: "#ffffff",
|
|
20743
|
-
color:
|
|
21162
|
+
color: OHW_BLUE_DARK2,
|
|
20744
21163
|
opacity: disabled ? 0.4 : 1,
|
|
20745
21164
|
fontSize: 12,
|
|
20746
21165
|
lineHeight: "16px",
|
|
@@ -20750,7 +21169,7 @@ function TogglePill({
|
|
|
20750
21169
|
},
|
|
20751
21170
|
children: [
|
|
20752
21171
|
label,
|
|
20753
|
-
/* @__PURE__ */
|
|
21172
|
+
/* @__PURE__ */ jsx24(
|
|
20754
21173
|
"span",
|
|
20755
21174
|
{
|
|
20756
21175
|
"aria-hidden": true,
|
|
@@ -20763,10 +21182,10 @@ function TogglePill({
|
|
|
20763
21182
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20764
21183
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20765
21184
|
// "disabled control" rather than "switch that is off".
|
|
20766
|
-
background: on ?
|
|
21185
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20767
21186
|
transition: "background 120ms ease"
|
|
20768
21187
|
},
|
|
20769
|
-
children: /* @__PURE__ */
|
|
21188
|
+
children: /* @__PURE__ */ jsx24(
|
|
20770
21189
|
"span",
|
|
20771
21190
|
{
|
|
20772
21191
|
style: {
|
|
@@ -20795,7 +21214,7 @@ function CarouselSlideToolbar({
|
|
|
20795
21214
|
onChangeImage,
|
|
20796
21215
|
onToggleAutoplay
|
|
20797
21216
|
}) {
|
|
20798
|
-
return /* @__PURE__ */
|
|
21217
|
+
return /* @__PURE__ */ jsxs15(
|
|
20799
21218
|
"div",
|
|
20800
21219
|
{
|
|
20801
21220
|
"data-ohw-bridge": "",
|
|
@@ -20806,7 +21225,7 @@ function CarouselSlideToolbar({
|
|
|
20806
21225
|
flexDirection: "column",
|
|
20807
21226
|
gap: 6,
|
|
20808
21227
|
alignItems: "center",
|
|
20809
|
-
background:
|
|
21228
|
+
background: OHW_BLUE2,
|
|
20810
21229
|
padding: 8,
|
|
20811
21230
|
borderRadius: 12,
|
|
20812
21231
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20818,11 +21237,11 @@ function CarouselSlideToolbar({
|
|
|
20818
21237
|
pointerEvents: pending ? "none" : "auto"
|
|
20819
21238
|
},
|
|
20820
21239
|
children: [
|
|
20821
|
-
/* @__PURE__ */
|
|
20822
|
-
/* @__PURE__ */
|
|
20823
|
-
/* @__PURE__ */
|
|
21240
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21241
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21242
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20824
21243
|
] }),
|
|
20825
|
-
error && /* @__PURE__ */
|
|
21244
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20826
21245
|
]
|
|
20827
21246
|
}
|
|
20828
21247
|
);
|
|
@@ -20842,10 +21261,10 @@ function AiFadeCarouselOverlay({
|
|
|
20842
21261
|
const skeletonRef = useRef8(null);
|
|
20843
21262
|
const activeRef = useRef8(null);
|
|
20844
21263
|
activeRef.current = active;
|
|
20845
|
-
|
|
21264
|
+
useEffect12(() => {
|
|
20846
21265
|
setAutoplayOverride(null);
|
|
20847
21266
|
}, [active?.sectionId, active?.index]);
|
|
20848
|
-
|
|
21267
|
+
useEffect12(() => {
|
|
20849
21268
|
if (!swapping?.fadingOut || !skeletonRef.current) return;
|
|
20850
21269
|
const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
20851
21270
|
duration: MEDIA_UPLOAD_FADE_MS,
|
|
@@ -20855,7 +21274,7 @@ function AiFadeCarouselOverlay({
|
|
|
20855
21274
|
anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
|
|
20856
21275
|
return () => anim.cancel();
|
|
20857
21276
|
}, [swapping?.fadingOut]);
|
|
20858
|
-
|
|
21277
|
+
useEffect12(() => {
|
|
20859
21278
|
const onMove = (e) => {
|
|
20860
21279
|
const t = e.target;
|
|
20861
21280
|
if (!(t instanceof Element)) return;
|
|
@@ -20871,8 +21290,8 @@ function AiFadeCarouselOverlay({
|
|
|
20871
21290
|
setHover(null);
|
|
20872
21291
|
return;
|
|
20873
21292
|
}
|
|
20874
|
-
const
|
|
20875
|
-
const unit =
|
|
21293
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21294
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
20876
21295
|
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
20877
21296
|
const index = Number(itemEl.dataset.ohwFadeCarouselIndex);
|
|
20878
21297
|
if (!sectionId || Number.isNaN(index)) {
|
|
@@ -20889,7 +21308,7 @@ function AiFadeCarouselOverlay({
|
|
|
20889
21308
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20890
21309
|
};
|
|
20891
21310
|
}, []);
|
|
20892
|
-
|
|
21311
|
+
useEffect12(() => {
|
|
20893
21312
|
const onClick = (e) => {
|
|
20894
21313
|
const current = activeRef.current;
|
|
20895
21314
|
if (!current) return;
|
|
@@ -20904,7 +21323,7 @@ function AiFadeCarouselOverlay({
|
|
|
20904
21323
|
document.addEventListener("click", onClick, true);
|
|
20905
21324
|
return () => document.removeEventListener("click", onClick, true);
|
|
20906
21325
|
}, []);
|
|
20907
|
-
|
|
21326
|
+
useEffect12(() => {
|
|
20908
21327
|
const onBlur = () => {
|
|
20909
21328
|
if (!activeRef.current) return;
|
|
20910
21329
|
setActive(null);
|
|
@@ -20913,7 +21332,7 @@ function AiFadeCarouselOverlay({
|
|
|
20913
21332
|
window.addEventListener("blur", onBlur);
|
|
20914
21333
|
return () => window.removeEventListener("blur", onBlur);
|
|
20915
21334
|
}, []);
|
|
20916
|
-
|
|
21335
|
+
useEffect12(() => {
|
|
20917
21336
|
const onKeyDown = (e) => {
|
|
20918
21337
|
if (e.key !== "Escape") return;
|
|
20919
21338
|
if (!activeRef.current) return;
|
|
@@ -20962,8 +21381,8 @@ function AiFadeCarouselOverlay({
|
|
|
20962
21381
|
const activeItemRect = useLiveItemRect2(active);
|
|
20963
21382
|
const TOOLBAR_APPROX_H = 90;
|
|
20964
21383
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20965
|
-
return /* @__PURE__ */
|
|
20966
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21384
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21385
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
20967
21386
|
"button",
|
|
20968
21387
|
{
|
|
20969
21388
|
type: "button",
|
|
@@ -20992,10 +21411,10 @@ function AiFadeCarouselOverlay({
|
|
|
20992
21411
|
fontSize: 14,
|
|
20993
21412
|
fontWeight: 700
|
|
20994
21413
|
},
|
|
20995
|
-
children: /* @__PURE__ */
|
|
21414
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
20996
21415
|
}
|
|
20997
21416
|
),
|
|
20998
|
-
swapping && /* @__PURE__ */
|
|
21417
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
20999
21418
|
"div",
|
|
21000
21419
|
{
|
|
21001
21420
|
ref: skeletonRef,
|
|
@@ -21013,15 +21432,15 @@ function AiFadeCarouselOverlay({
|
|
|
21013
21432
|
zIndex: 2147483646,
|
|
21014
21433
|
pointerEvents: "none"
|
|
21015
21434
|
},
|
|
21016
|
-
children: /* @__PURE__ */
|
|
21435
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
21017
21436
|
}
|
|
21018
21437
|
),
|
|
21019
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21438
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
21020
21439
|
ItemInteractionLayer,
|
|
21021
21440
|
{
|
|
21022
21441
|
rect: activeItemRect,
|
|
21023
21442
|
state: toolbarState,
|
|
21024
|
-
toolbar: /* @__PURE__ */
|
|
21443
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
21025
21444
|
CarouselSlideToolbar,
|
|
21026
21445
|
{
|
|
21027
21446
|
pending,
|
|
@@ -21210,120 +21629,13 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21210
21629
|
}
|
|
21211
21630
|
|
|
21212
21631
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21213
|
-
import { useEffect as
|
|
21214
|
-
|
|
21215
|
-
// src/ui/dialog.tsx
|
|
21216
|
-
import * as React9 from "react";
|
|
21217
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21218
|
-
import { X as X2 } from "lucide-react";
|
|
21219
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21220
|
-
function Dialog2({
|
|
21221
|
-
...props
|
|
21222
|
-
}) {
|
|
21223
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21224
|
-
}
|
|
21225
|
-
function DialogPortal({
|
|
21226
|
-
...props
|
|
21227
|
-
}) {
|
|
21228
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21229
|
-
}
|
|
21230
|
-
function DialogOverlay({
|
|
21231
|
-
className,
|
|
21232
|
-
...props
|
|
21233
|
-
}) {
|
|
21234
|
-
return /* @__PURE__ */ jsx24(
|
|
21235
|
-
DialogPrimitive.Overlay,
|
|
21236
|
-
{
|
|
21237
|
-
"data-slot": "dialog-overlay",
|
|
21238
|
-
"data-ohw-link-modal-root": "",
|
|
21239
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21240
|
-
...props
|
|
21241
|
-
}
|
|
21242
|
-
);
|
|
21243
|
-
}
|
|
21244
|
-
var DialogContent = React9.forwardRef(
|
|
21245
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21246
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21247
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21248
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21249
|
-
/* @__PURE__ */ jsxs15(
|
|
21250
|
-
DialogPrimitive.Content,
|
|
21251
|
-
{
|
|
21252
|
-
ref,
|
|
21253
|
-
"data-slot": "dialog-content",
|
|
21254
|
-
className: cn(
|
|
21255
|
-
positionMode,
|
|
21256
|
-
"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",
|
|
21257
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21258
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21259
|
-
className
|
|
21260
|
-
),
|
|
21261
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21262
|
-
...props,
|
|
21263
|
-
children: [
|
|
21264
|
-
children,
|
|
21265
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21266
|
-
DialogPrimitive.Close,
|
|
21267
|
-
{
|
|
21268
|
-
type: "button",
|
|
21269
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21270
|
-
"aria-label": "Close",
|
|
21271
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21272
|
-
}
|
|
21273
|
-
) : null
|
|
21274
|
-
]
|
|
21275
|
-
}
|
|
21276
|
-
)
|
|
21277
|
-
] });
|
|
21278
|
-
}
|
|
21279
|
-
);
|
|
21280
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21281
|
-
function DialogHeader({
|
|
21282
|
-
className,
|
|
21283
|
-
...props
|
|
21284
|
-
}) {
|
|
21285
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21286
|
-
}
|
|
21287
|
-
function DialogFooter({
|
|
21288
|
-
className,
|
|
21289
|
-
...props
|
|
21290
|
-
}) {
|
|
21291
|
-
return /* @__PURE__ */ jsx24(
|
|
21292
|
-
"div",
|
|
21293
|
-
{
|
|
21294
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21295
|
-
...props
|
|
21296
|
-
}
|
|
21297
|
-
);
|
|
21298
|
-
}
|
|
21299
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21300
|
-
DialogPrimitive.Title,
|
|
21301
|
-
{
|
|
21302
|
-
ref,
|
|
21303
|
-
className: cn(
|
|
21304
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21305
|
-
className
|
|
21306
|
-
),
|
|
21307
|
-
...props
|
|
21308
|
-
}
|
|
21309
|
-
));
|
|
21310
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21311
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21312
|
-
DialogPrimitive.Description,
|
|
21313
|
-
{
|
|
21314
|
-
ref,
|
|
21315
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21316
|
-
...props
|
|
21317
|
-
}
|
|
21318
|
-
));
|
|
21319
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21320
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21632
|
+
import { useEffect as useEffect16 } from "react";
|
|
21321
21633
|
|
|
21322
21634
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21323
21635
|
import { Info, X as X4 } from "lucide-react";
|
|
21324
21636
|
|
|
21325
21637
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21326
|
-
import { ArrowRight as
|
|
21638
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21327
21639
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21328
21640
|
function DestinationBreadcrumb({
|
|
21329
21641
|
pageTitle,
|
|
@@ -21337,7 +21649,7 @@ function DestinationBreadcrumb({
|
|
|
21337
21649
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21338
21650
|
] }),
|
|
21339
21651
|
/* @__PURE__ */ jsx25(
|
|
21340
|
-
|
|
21652
|
+
ArrowRight3,
|
|
21341
21653
|
{
|
|
21342
21654
|
size: 16,
|
|
21343
21655
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21410,7 +21722,7 @@ function SectionTreeItem({
|
|
|
21410
21722
|
}
|
|
21411
21723
|
|
|
21412
21724
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21413
|
-
import { useEffect as
|
|
21725
|
+
import { useEffect as useEffect13, useId as useId2, useRef as useRef9, useState as useState12 } from "react";
|
|
21414
21726
|
|
|
21415
21727
|
// src/ui/input.tsx
|
|
21416
21728
|
import * as React10 from "react";
|
|
@@ -21449,7 +21761,7 @@ function Label({ className, ...props }) {
|
|
|
21449
21761
|
}
|
|
21450
21762
|
|
|
21451
21763
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21452
|
-
import { ChevronDown as
|
|
21764
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21453
21765
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21454
21766
|
function FieldChevron({
|
|
21455
21767
|
onClick
|
|
@@ -21462,7 +21774,7 @@ function FieldChevron({
|
|
|
21462
21774
|
onClick,
|
|
21463
21775
|
"aria-label": "Open page list",
|
|
21464
21776
|
tabIndex: -1,
|
|
21465
|
-
children: /* @__PURE__ */ jsx29(
|
|
21777
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21466
21778
|
}
|
|
21467
21779
|
);
|
|
21468
21780
|
}
|
|
@@ -21482,7 +21794,7 @@ function UrlOrPageInput({
|
|
|
21482
21794
|
const inputRef = useRef9(null);
|
|
21483
21795
|
const rootRef = useRef9(null);
|
|
21484
21796
|
const [isFocused, setIsFocused] = useState12(false);
|
|
21485
|
-
|
|
21797
|
+
useEffect13(() => {
|
|
21486
21798
|
if (!dropdownOpen) return;
|
|
21487
21799
|
const isOutside = (e) => {
|
|
21488
21800
|
const root = rootRef.current;
|
|
@@ -21690,9 +22002,9 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21690
22002
|
}
|
|
21691
22003
|
|
|
21692
22004
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21693
|
-
import { useCallback as useCallback7, useEffect as
|
|
22005
|
+
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21694
22006
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21695
|
-
import { ArrowLeft as
|
|
22007
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21696
22008
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21697
22009
|
|
|
21698
22010
|
// src/lib/parent-scroll.ts
|
|
@@ -21752,7 +22064,7 @@ function useSectionRects(sectionIdsKey, enabled) {
|
|
|
21752
22064
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
21753
22065
|
[sectionIdsKey]
|
|
21754
22066
|
);
|
|
21755
|
-
|
|
22067
|
+
useEffect14(() => {
|
|
21756
22068
|
if (!enabled || sectionIds.length === 0) {
|
|
21757
22069
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
21758
22070
|
return;
|
|
@@ -21807,12 +22119,12 @@ function SectionPickerOverlay({
|
|
|
21807
22119
|
);
|
|
21808
22120
|
const normalizedTarget = normalizePath(pagePath);
|
|
21809
22121
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
21810
|
-
|
|
22122
|
+
useEffect14(() => {
|
|
21811
22123
|
if (isOnTargetPage) return;
|
|
21812
22124
|
const search = readPreservedSearch();
|
|
21813
22125
|
router.push(`${normalizedTarget}${search}`);
|
|
21814
22126
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
21815
|
-
|
|
22127
|
+
useEffect14(() => {
|
|
21816
22128
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
21817
22129
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
21818
22130
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -21850,7 +22162,7 @@ function SectionPickerOverlay({
|
|
|
21850
22162
|
},
|
|
21851
22163
|
[]
|
|
21852
22164
|
);
|
|
21853
|
-
|
|
22165
|
+
useEffect14(() => {
|
|
21854
22166
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
|
|
21855
22167
|
const next = getIframeVisibleClip({
|
|
21856
22168
|
iframeOffsetTop,
|
|
@@ -21894,12 +22206,12 @@ function SectionPickerOverlay({
|
|
|
21894
22206
|
window.removeEventListener("resize", onResize);
|
|
21895
22207
|
};
|
|
21896
22208
|
}, [applyHoverAt]);
|
|
21897
|
-
|
|
22209
|
+
useEffect14(() => {
|
|
21898
22210
|
const ptr = pointerRef.current;
|
|
21899
22211
|
if (!ptr) return;
|
|
21900
22212
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
21901
22213
|
}, [rects, applyHoverAt]);
|
|
21902
|
-
|
|
22214
|
+
useEffect14(() => {
|
|
21903
22215
|
const rememberPointer = (clientX, clientY) => {
|
|
21904
22216
|
pointerRef.current = { x: clientX, y: clientY };
|
|
21905
22217
|
const top = iframeOffsetTopRef.current;
|
|
@@ -21931,7 +22243,7 @@ function SectionPickerOverlay({
|
|
|
21931
22243
|
},
|
|
21932
22244
|
[selectedId, onSelect]
|
|
21933
22245
|
);
|
|
21934
|
-
|
|
22246
|
+
useEffect14(() => {
|
|
21935
22247
|
const onKeyDown = (e) => {
|
|
21936
22248
|
if (e.key === "Escape") {
|
|
21937
22249
|
e.preventDefault();
|
|
@@ -21969,7 +22281,7 @@ function SectionPickerOverlay({
|
|
|
21969
22281
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
21970
22282
|
onClick: onBack,
|
|
21971
22283
|
children: [
|
|
21972
|
-
/* @__PURE__ */ jsx31(
|
|
22284
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
21973
22285
|
"Back"
|
|
21974
22286
|
]
|
|
21975
22287
|
}
|
|
@@ -22038,7 +22350,7 @@ function SectionPickerOverlay({
|
|
|
22038
22350
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22039
22351
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22040
22352
|
"aria-hidden": true,
|
|
22041
|
-
children: /* @__PURE__ */ jsx31(
|
|
22353
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22042
22354
|
}
|
|
22043
22355
|
) : null
|
|
22044
22356
|
]
|
|
@@ -22054,7 +22366,7 @@ function SectionPickerOverlay({
|
|
|
22054
22366
|
}
|
|
22055
22367
|
|
|
22056
22368
|
// src/ui/link-modal/useLinkModalState.ts
|
|
22057
|
-
import { useCallback as useCallback8, useEffect as
|
|
22369
|
+
import { useCallback as useCallback8, useEffect as useEffect15, useMemo as useMemo3, useState as useState14 } from "react";
|
|
22058
22370
|
function useLinkModalState({
|
|
22059
22371
|
open,
|
|
22060
22372
|
mode,
|
|
@@ -22081,7 +22393,7 @@ function useLinkModalState({
|
|
|
22081
22393
|
setDropdownOpen(false);
|
|
22082
22394
|
setUrlError("");
|
|
22083
22395
|
}, []);
|
|
22084
|
-
|
|
22396
|
+
useEffect15(() => {
|
|
22085
22397
|
if (!open) return;
|
|
22086
22398
|
if (mode === "edit" && initialTarget) {
|
|
22087
22399
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -22247,7 +22559,7 @@ function LinkPopover({
|
|
|
22247
22559
|
onSubmit
|
|
22248
22560
|
});
|
|
22249
22561
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
22250
|
-
|
|
22562
|
+
useEffect16(() => {
|
|
22251
22563
|
if (!open) return;
|
|
22252
22564
|
if (sectionPickerActive) {
|
|
22253
22565
|
postToParent({ type: "ui:unlock" });
|
|
@@ -22422,6 +22734,7 @@ function shouldUseDevFixtures() {
|
|
|
22422
22734
|
function getLogoElement(el) {
|
|
22423
22735
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22424
22736
|
if (marked) return marked;
|
|
22737
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22425
22738
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22426
22739
|
if (!root) return null;
|
|
22427
22740
|
const anchor = el.closest("a");
|
|
@@ -22490,8 +22803,8 @@ function addFooterColumnWithPersist({
|
|
|
22490
22803
|
// src/ui/FloatingPanel.tsx
|
|
22491
22804
|
import {
|
|
22492
22805
|
useCallback as useCallback9,
|
|
22493
|
-
useEffect as
|
|
22494
|
-
useLayoutEffect as
|
|
22806
|
+
useEffect as useEffect17,
|
|
22807
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22495
22808
|
useRef as useRef11,
|
|
22496
22809
|
useState as useState15
|
|
22497
22810
|
} from "react";
|
|
@@ -22574,10 +22887,10 @@ function FloatingPanel({
|
|
|
22574
22887
|
x: clampX(home.x, measured.w),
|
|
22575
22888
|
y: fittedY
|
|
22576
22889
|
};
|
|
22577
|
-
|
|
22890
|
+
useEffect17(() => {
|
|
22578
22891
|
setLiveScroll(parentScroll);
|
|
22579
22892
|
}, [parentScroll]);
|
|
22580
|
-
|
|
22893
|
+
useEffect17(() => {
|
|
22581
22894
|
if (!open) return;
|
|
22582
22895
|
const onParentScroll = (e) => {
|
|
22583
22896
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
@@ -22588,7 +22901,7 @@ function FloatingPanel({
|
|
|
22588
22901
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22589
22902
|
}, [open]);
|
|
22590
22903
|
const positionRef = useRef11(position);
|
|
22591
|
-
|
|
22904
|
+
useLayoutEffect6(() => {
|
|
22592
22905
|
if (!open) {
|
|
22593
22906
|
positionRef.current = position;
|
|
22594
22907
|
return;
|
|
@@ -22598,7 +22911,7 @@ function FloatingPanel({
|
|
|
22598
22911
|
}
|
|
22599
22912
|
positionRef.current = position;
|
|
22600
22913
|
}, [open, position, liveScroll, parentScroll]);
|
|
22601
|
-
|
|
22914
|
+
useLayoutEffect6(() => {
|
|
22602
22915
|
if (!open || !panelRef.current) return;
|
|
22603
22916
|
const el = panelRef.current;
|
|
22604
22917
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22662,11 +22975,11 @@ function FloatingPanel({
|
|
|
22662
22975
|
} catch {
|
|
22663
22976
|
}
|
|
22664
22977
|
}, []);
|
|
22665
|
-
|
|
22978
|
+
useEffect17(() => {
|
|
22666
22979
|
if (open) return;
|
|
22667
22980
|
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22668
22981
|
}, [open]);
|
|
22669
|
-
|
|
22982
|
+
useEffect17(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
|
|
22670
22983
|
if (!open) return null;
|
|
22671
22984
|
return /* @__PURE__ */ jsxs22(
|
|
22672
22985
|
"div",
|
|
@@ -22807,7 +23120,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
22807
23120
|
}
|
|
22808
23121
|
|
|
22809
23122
|
// src/ui/button-style-panel.tsx
|
|
22810
|
-
import { Check as
|
|
23123
|
+
import { Check as Check5 } from "lucide-react";
|
|
22811
23124
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22812
23125
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
22813
23126
|
function ButtonStylePanel({
|
|
@@ -22878,7 +23191,7 @@ function ButtonStylePanel({
|
|
|
22878
23191
|
{
|
|
22879
23192
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
22880
23193
|
"aria-hidden": true,
|
|
22881
|
-
children: /* @__PURE__ */ jsx35(
|
|
23194
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
22882
23195
|
}
|
|
22883
23196
|
) : null
|
|
22884
23197
|
]
|
|
@@ -23186,7 +23499,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
|
|
|
23186
23499
|
}
|
|
23187
23500
|
|
|
23188
23501
|
// src/useNavItemDrag.ts
|
|
23189
|
-
import { useCallback as useCallback10, useEffect as
|
|
23502
|
+
import { useCallback as useCallback10, useEffect as useEffect18, useRef as useRef12, useState as useState16 } from "react";
|
|
23190
23503
|
function useNavItemDrag({
|
|
23191
23504
|
isEditMode,
|
|
23192
23505
|
editContentRef,
|
|
@@ -23419,7 +23732,7 @@ function useNavItemDrag({
|
|
|
23419
23732
|
},
|
|
23420
23733
|
[]
|
|
23421
23734
|
);
|
|
23422
|
-
|
|
23735
|
+
useEffect18(() => {
|
|
23423
23736
|
if (!isEditMode) return;
|
|
23424
23737
|
const THRESHOLD = 10;
|
|
23425
23738
|
const resolveWasSelected = (el) => {
|
|
@@ -23578,7 +23891,7 @@ function useNavItemDrag({
|
|
|
23578
23891
|
}
|
|
23579
23892
|
|
|
23580
23893
|
// src/useSectionDrag.ts
|
|
23581
|
-
import { useCallback as useCallback11, useEffect as
|
|
23894
|
+
import { useCallback as useCallback11, useEffect as useEffect19, useRef as useRef13, useState as useState17 } from "react";
|
|
23582
23895
|
|
|
23583
23896
|
// src/lib/section-dnd.ts
|
|
23584
23897
|
function isFooterSection(el) {
|
|
@@ -23798,7 +24111,7 @@ function useSectionDrag({
|
|
|
23798
24111
|
},
|
|
23799
24112
|
[footerDragRef, navDragRef]
|
|
23800
24113
|
);
|
|
23801
|
-
|
|
24114
|
+
useEffect19(() => {
|
|
23802
24115
|
if (!isEditMode) return;
|
|
23803
24116
|
const onPointerDown = (e) => {
|
|
23804
24117
|
if (e.button !== 0) return;
|
|
@@ -23809,9 +24122,9 @@ function useSectionDrag({
|
|
|
23809
24122
|
if (target.closest(SECTION_DRAG_EXCLUDED_SELECTOR)) return;
|
|
23810
24123
|
const inner = target.closest("[data-ohw-section]");
|
|
23811
24124
|
if (!inner || isChromeSection(inner) || inner.dataset.ohwSection === "footer") return;
|
|
23812
|
-
const
|
|
23813
|
-
if (!topLevelSections().includes(
|
|
23814
|
-
startSectionPressDrag(
|
|
24125
|
+
const sectionEl2 = movableUnit(inner);
|
|
24126
|
+
if (!topLevelSections().includes(sectionEl2)) return;
|
|
24127
|
+
startSectionPressDrag(sectionEl2, e.clientX, e.clientY, e.pointerId);
|
|
23815
24128
|
};
|
|
23816
24129
|
const onPointerMove = (e) => {
|
|
23817
24130
|
const pending = sectionPointerDragRef.current;
|
|
@@ -23903,7 +24216,7 @@ function useSectionDrag({
|
|
|
23903
24216
|
}
|
|
23904
24217
|
|
|
23905
24218
|
// src/ui/footer-container-chrome.tsx
|
|
23906
|
-
import { Plus as
|
|
24219
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
23907
24220
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
23908
24221
|
function FooterContainerChrome({
|
|
23909
24222
|
rect,
|
|
@@ -23944,7 +24257,7 @@ function FooterContainerChrome({
|
|
|
23944
24257
|
if (addDisabled) return;
|
|
23945
24258
|
onAdd();
|
|
23946
24259
|
},
|
|
23947
|
-
children: /* @__PURE__ */ jsx36(
|
|
24260
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
23948
24261
|
}
|
|
23949
24262
|
) }),
|
|
23950
24263
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24123,7 +24436,7 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24123
24436
|
}
|
|
24124
24437
|
|
|
24125
24438
|
// src/lib/build-page-sync.ts
|
|
24126
|
-
import { useEffect as
|
|
24439
|
+
import { useEffect as useEffect20 } from "react";
|
|
24127
24440
|
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24128
24441
|
function normalisePath(path) {
|
|
24129
24442
|
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
@@ -24236,7 +24549,7 @@ function applyBuildPageSync(msg, deps) {
|
|
|
24236
24549
|
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24237
24550
|
}
|
|
24238
24551
|
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24239
|
-
|
|
24552
|
+
useEffect20(() => {
|
|
24240
24553
|
if (!isEditMode) return;
|
|
24241
24554
|
const onMessage = (e) => {
|
|
24242
24555
|
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
@@ -24351,7 +24664,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24351
24664
|
}
|
|
24352
24665
|
|
|
24353
24666
|
// src/ui/navbar-container-chrome.tsx
|
|
24354
|
-
import { Plus as
|
|
24667
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24355
24668
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24356
24669
|
function NavbarContainerChrome({
|
|
24357
24670
|
rect,
|
|
@@ -24387,7 +24700,7 @@ function NavbarContainerChrome({
|
|
|
24387
24700
|
e.stopPropagation();
|
|
24388
24701
|
onAdd();
|
|
24389
24702
|
},
|
|
24390
|
-
children: /* @__PURE__ */ jsx37(
|
|
24703
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24391
24704
|
}
|
|
24392
24705
|
)
|
|
24393
24706
|
}
|
|
@@ -24459,7 +24772,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24459
24772
|
}
|
|
24460
24773
|
|
|
24461
24774
|
// src/OhhwellsBridge.tsx
|
|
24462
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
24775
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
|
|
24463
24776
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24464
24777
|
var PRIMARY7 = "#0885FE";
|
|
24465
24778
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25237,7 +25550,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25237
25550
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25238
25551
|
return resolveFooterLinksContainerFrom(el);
|
|
25239
25552
|
}
|
|
25240
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25553
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isFooterLinksContainer(el) || isInferredFooterGroup2(el)) {
|
|
25241
25554
|
return getNavigationRoot(el);
|
|
25242
25555
|
}
|
|
25243
25556
|
return null;
|
|
@@ -25459,7 +25772,6 @@ var ICONS = {
|
|
|
25459
25772
|
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"/>',
|
|
25460
25773
|
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"/>'
|
|
25461
25774
|
};
|
|
25462
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25463
25775
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25464
25776
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25465
25777
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25557,7 +25869,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25557
25869
|
el.style.top = `${top}px`;
|
|
25558
25870
|
el.style.height = `${height}px`;
|
|
25559
25871
|
}
|
|
25560
|
-
var
|
|
25872
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25561
25873
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25562
25874
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25563
25875
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25584,8 +25896,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25584
25896
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25585
25897
|
const half = toolbarWidth / 2;
|
|
25586
25898
|
return Math.max(
|
|
25587
|
-
|
|
25588
|
-
Math.min(centerX, window.innerWidth -
|
|
25899
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
25900
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25589
25901
|
);
|
|
25590
25902
|
}
|
|
25591
25903
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25959,7 +26271,7 @@ function OhhwellsBridge() {
|
|
|
25959
26271
|
const searchParams = useSearchParams();
|
|
25960
26272
|
const isEditMode = isEditSessionActive();
|
|
25961
26273
|
const [bridgeRoot, setBridgeRoot] = useState18(null);
|
|
25962
|
-
|
|
26274
|
+
useEffect21(() => {
|
|
25963
26275
|
const figtreeFontId = "ohw-figtree-font";
|
|
25964
26276
|
if (!document.getElementById(figtreeFontId)) {
|
|
25965
26277
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25986,7 +26298,7 @@ function OhhwellsBridge() {
|
|
|
25986
26298
|
}, []);
|
|
25987
26299
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25988
26300
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
25989
|
-
|
|
26301
|
+
useLayoutEffect7(() => {
|
|
25990
26302
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25991
26303
|
if (next !== subdomain) setSubdomain(next);
|
|
25992
26304
|
if (next) return;
|
|
@@ -25998,7 +26310,7 @@ function OhhwellsBridge() {
|
|
|
25998
26310
|
}, 0);
|
|
25999
26311
|
return () => window.clearTimeout(t);
|
|
26000
26312
|
}, [subdomainFromQuery, subdomain]);
|
|
26001
|
-
|
|
26313
|
+
useEffect21(() => {
|
|
26002
26314
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
26003
26315
|
const url = new URL(window.location.href);
|
|
26004
26316
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -26010,6 +26322,7 @@ function OhhwellsBridge() {
|
|
|
26010
26322
|
useSavedLinkNavigation(isEditMode);
|
|
26011
26323
|
useNavDropdownToggle(isEditMode);
|
|
26012
26324
|
useHashLinkScroll(isEditMode);
|
|
26325
|
+
usePublishedPlaceholderStrip(isEditMode);
|
|
26013
26326
|
const postToParent2 = useCallback12((data) => {
|
|
26014
26327
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
26015
26328
|
window.parent.postMessage(data, "*");
|
|
@@ -26018,14 +26331,14 @@ function OhhwellsBridge() {
|
|
|
26018
26331
|
const [fetchState, setFetchState] = useState18("idle");
|
|
26019
26332
|
const [showBranding, setShowBranding] = useState18(false);
|
|
26020
26333
|
const autoSaveTimers = useRef14(/* @__PURE__ */ new Map());
|
|
26021
|
-
|
|
26334
|
+
useEffect21(() => {
|
|
26022
26335
|
stampBridgeVersionOnDocument();
|
|
26023
26336
|
}, []);
|
|
26024
|
-
|
|
26337
|
+
useEffect21(() => {
|
|
26025
26338
|
if (isEditMode) return;
|
|
26026
26339
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
26027
26340
|
}, [isEditMode, subdomain, fetchState]);
|
|
26028
|
-
|
|
26341
|
+
useEffect21(() => {
|
|
26029
26342
|
if (isEditMode || !subdomain) return;
|
|
26030
26343
|
const onError = (event) => {
|
|
26031
26344
|
reportOutageBeacon({
|
|
@@ -26080,9 +26393,9 @@ function OhhwellsBridge() {
|
|
|
26080
26393
|
const selectedIconElRef = useRef14(null);
|
|
26081
26394
|
const selectedSocialElRef = useRef14(null);
|
|
26082
26395
|
const queueSectionKeyDrop = useCallback12((prev) => {
|
|
26083
|
-
const
|
|
26084
|
-
if (!
|
|
26085
|
-
const sectionInstanceId = instanceIdOf(movableUnit(
|
|
26396
|
+
const sectionEl2 = prev?.closest("[data-ohw-section]") ?? null;
|
|
26397
|
+
if (!sectionEl2) return;
|
|
26398
|
+
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl2)) || null;
|
|
26086
26399
|
if (!sectionInstanceId) return;
|
|
26087
26400
|
const token = ++mediaKeyDropTokenRef.current;
|
|
26088
26401
|
const onQueueDrained = (e) => {
|
|
@@ -26092,8 +26405,8 @@ function OhhwellsBridge() {
|
|
|
26092
26405
|
if (selectedMediaElRef.current || selectedIconElRef.current || selectedSocialElRef.current) return;
|
|
26093
26406
|
postToParentRef.current({
|
|
26094
26407
|
type: "ow:section-selected",
|
|
26095
|
-
sectionId:
|
|
26096
|
-
sectionLabel:
|
|
26408
|
+
sectionId: sectionEl2.dataset.ohwSection ?? null,
|
|
26409
|
+
sectionLabel: sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? ""),
|
|
26097
26410
|
key: null
|
|
26098
26411
|
});
|
|
26099
26412
|
};
|
|
@@ -26127,12 +26440,12 @@ function OhhwellsBridge() {
|
|
|
26127
26440
|
const selectIconElement = useCallback12((el) => {
|
|
26128
26441
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26129
26442
|
selectedIconElRef.current = el;
|
|
26130
|
-
const
|
|
26443
|
+
const sectionEl2 = el.closest("[data-ohw-section]");
|
|
26131
26444
|
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
26132
26445
|
postToParentRef.current({
|
|
26133
26446
|
type: "ow:section-selected",
|
|
26134
|
-
sectionId:
|
|
26135
|
-
sectionLabel:
|
|
26447
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
26448
|
+
sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
|
|
26136
26449
|
key: el.dataset.ohwKey ?? null,
|
|
26137
26450
|
keyLabel: "Icon"
|
|
26138
26451
|
});
|
|
@@ -26152,12 +26465,12 @@ function OhhwellsBridge() {
|
|
|
26152
26465
|
isDragOver: false,
|
|
26153
26466
|
...video ? { videoAutoplay: video.autoplay, videoMuted: video.muted } : {}
|
|
26154
26467
|
});
|
|
26155
|
-
const
|
|
26468
|
+
const sectionEl2 = el.closest("[data-ohw-section]");
|
|
26156
26469
|
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
26157
26470
|
postToParentRef.current({
|
|
26158
26471
|
type: "ow:section-selected",
|
|
26159
|
-
sectionId:
|
|
26160
|
-
sectionLabel:
|
|
26472
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
26473
|
+
sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
|
|
26161
26474
|
key: el.dataset.ohwKey ?? null,
|
|
26162
26475
|
// Display name for the pill — the raw key prettifies into fragments ("Img"); the
|
|
26163
26476
|
// bridge knows what the node IS, so it names it.
|
|
@@ -26166,7 +26479,7 @@ function OhhwellsBridge() {
|
|
|
26166
26479
|
}, []);
|
|
26167
26480
|
const selectMediaElementRef = useRef14(selectMediaElement);
|
|
26168
26481
|
selectMediaElementRef.current = selectMediaElement;
|
|
26169
|
-
|
|
26482
|
+
useEffect21(() => {
|
|
26170
26483
|
if (!selectedMedia) return;
|
|
26171
26484
|
const update = () => {
|
|
26172
26485
|
const el = selectedMediaElRef.current;
|
|
@@ -26381,7 +26694,7 @@ function OhhwellsBridge() {
|
|
|
26381
26694
|
const [fieldDragging, setFieldDragging] = useState18(false);
|
|
26382
26695
|
const clearFormPickRef = useRef14(clearFormPick);
|
|
26383
26696
|
clearFormPickRef.current = clearFormPick;
|
|
26384
|
-
|
|
26697
|
+
useEffect21(() => {
|
|
26385
26698
|
const el = fieldPickElRef.current;
|
|
26386
26699
|
if (!el || fieldPickRect === null) return;
|
|
26387
26700
|
const observer = new ResizeObserver(() => {
|
|
@@ -26390,7 +26703,7 @@ function OhhwellsBridge() {
|
|
|
26390
26703
|
observer.observe(el);
|
|
26391
26704
|
return () => observer.disconnect();
|
|
26392
26705
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26393
|
-
|
|
26706
|
+
useEffect21(() => {
|
|
26394
26707
|
const el = formPickElRef.current;
|
|
26395
26708
|
if (!el || formPickRect === null) return;
|
|
26396
26709
|
const observer = new ResizeObserver(() => {
|
|
@@ -26417,7 +26730,7 @@ function OhhwellsBridge() {
|
|
|
26417
26730
|
const hoveredItemElRef = useRef14(null);
|
|
26418
26731
|
const [hoveredItemRect, setHoveredItemRect] = useState18(null);
|
|
26419
26732
|
const [hoveredTextRect, setHoveredTextRect] = useState18(null);
|
|
26420
|
-
|
|
26733
|
+
useEffect21(() => {
|
|
26421
26734
|
const sync = () => {
|
|
26422
26735
|
const el = document.querySelector(
|
|
26423
26736
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26467,21 +26780,6 @@ function OhhwellsBridge() {
|
|
|
26467
26780
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26468
26781
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26469
26782
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26470
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26471
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26472
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26473
|
-
const floatingPanelRef = useRef14(null);
|
|
26474
|
-
floatingPanelRef.current = floatingPanel;
|
|
26475
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26476
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26477
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26478
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26479
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26480
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26481
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26482
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26483
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26484
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26485
26783
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26486
26784
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26487
26785
|
const footerDragRef = useRef14(null);
|
|
@@ -26508,6 +26806,21 @@ function OhhwellsBridge() {
|
|
|
26508
26806
|
const stylesRef = useRef14("");
|
|
26509
26807
|
const appliedDrawerRef = useRef14(null);
|
|
26510
26808
|
const pendingDeleteUndoRef = useRef14(null);
|
|
26809
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26810
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
26811
|
+
const floatingPanelRef = useRef14(null);
|
|
26812
|
+
floatingPanelRef.current = floatingPanel;
|
|
26813
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
26814
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26815
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
26816
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
26817
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26818
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26819
|
+
const buttonPointerDragRef = useRef14(null);
|
|
26820
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26821
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26822
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26823
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26511
26824
|
const [sitePages, setSitePages] = useState18([]);
|
|
26512
26825
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26513
26826
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26517,8 +26830,19 @@ function OhhwellsBridge() {
|
|
|
26517
26830
|
const linkPopoverOpenRef = useRef14(false);
|
|
26518
26831
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26519
26832
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26833
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26520
26834
|
linkPopoverSessionRef.current = linkPopover;
|
|
26521
|
-
|
|
26835
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26836
|
+
useEffect21(() => {
|
|
26837
|
+
const syncViewport = () => {
|
|
26838
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26839
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26840
|
+
};
|
|
26841
|
+
syncViewport();
|
|
26842
|
+
window.addEventListener("resize", syncViewport);
|
|
26843
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26844
|
+
}, []);
|
|
26845
|
+
useEffect21(() => {
|
|
26522
26846
|
setSectionOrderPersistHandler((entries) => {
|
|
26523
26847
|
const currentPath = window.location.pathname;
|
|
26524
26848
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26528,7 +26852,7 @@ function OhhwellsBridge() {
|
|
|
26528
26852
|
});
|
|
26529
26853
|
return () => setSectionOrderPersistHandler(null);
|
|
26530
26854
|
}, []);
|
|
26531
|
-
|
|
26855
|
+
useEffect21(() => {
|
|
26532
26856
|
setAiFooterMountOptions({
|
|
26533
26857
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26534
26858
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26612,7 +26936,7 @@ function OhhwellsBridge() {
|
|
|
26612
26936
|
}, [isEditMode, pathname]);
|
|
26613
26937
|
const runSectionsPrefetchRef = useRef14(runSectionsPrefetch);
|
|
26614
26938
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26615
|
-
|
|
26939
|
+
useEffect21(() => {
|
|
26616
26940
|
if (!linkPopover) {
|
|
26617
26941
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26618
26942
|
return;
|
|
@@ -26640,7 +26964,7 @@ function OhhwellsBridge() {
|
|
|
26640
26964
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26641
26965
|
};
|
|
26642
26966
|
}, [linkPopover, postToParent2]);
|
|
26643
|
-
|
|
26967
|
+
useEffect21(() => {
|
|
26644
26968
|
if (!isEditMode) return;
|
|
26645
26969
|
const useFixtures = shouldUseDevFixtures();
|
|
26646
26970
|
if (useFixtures) {
|
|
@@ -26666,7 +26990,7 @@ function OhhwellsBridge() {
|
|
|
26666
26990
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26667
26991
|
return () => window.removeEventListener("message", onSitePages);
|
|
26668
26992
|
}, [isEditMode, postToParent2]);
|
|
26669
|
-
|
|
26993
|
+
useEffect21(() => {
|
|
26670
26994
|
if (!isEditMode) return;
|
|
26671
26995
|
const deps = {
|
|
26672
26996
|
getEditContent: () => editContentRef.current,
|
|
@@ -26703,14 +27027,14 @@ function OhhwellsBridge() {
|
|
|
26703
27027
|
window.addEventListener("message", onPageMessage);
|
|
26704
27028
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26705
27029
|
}, [isEditMode, postToParent2]);
|
|
26706
|
-
|
|
27030
|
+
useEffect21(() => {
|
|
26707
27031
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26708
27032
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26709
27033
|
if (Object.keys(manifest).length === 0) return;
|
|
26710
27034
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26711
27035
|
});
|
|
26712
27036
|
}, [isEditMode]);
|
|
26713
|
-
|
|
27037
|
+
useEffect21(() => {
|
|
26714
27038
|
const update = () => {
|
|
26715
27039
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26716
27040
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27743,12 +28067,12 @@ function OhhwellsBridge() {
|
|
|
27743
28067
|
const socialItem = getSocialItem(anchor);
|
|
27744
28068
|
if (socialItem) {
|
|
27745
28069
|
selectedSocialElRef.current = socialItem;
|
|
27746
|
-
const
|
|
28070
|
+
const sectionEl2 = socialItem.closest("[data-ohw-section]");
|
|
27747
28071
|
aiSectionApiRef.current?.selectFromElement(anchor, { report: false });
|
|
27748
28072
|
postToParentRef.current({
|
|
27749
28073
|
type: "ow:section-selected",
|
|
27750
|
-
sectionId:
|
|
27751
|
-
sectionLabel:
|
|
28074
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
28075
|
+
sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
|
|
27752
28076
|
key: socialIconKey(socialItem) ?? socialItem.getAttribute("data-ohw-href-key"),
|
|
27753
28077
|
keyLabel: socialPlatformLabel(socialItem, editContentRef.current)
|
|
27754
28078
|
});
|
|
@@ -27969,7 +28293,7 @@ function OhhwellsBridge() {
|
|
|
27969
28293
|
},
|
|
27970
28294
|
[postToParent2]
|
|
27971
28295
|
);
|
|
27972
|
-
|
|
28296
|
+
useEffect21(() => {
|
|
27973
28297
|
const onDragOver = (e) => {
|
|
27974
28298
|
const dragged = buttonCollectionDragRef.current;
|
|
27975
28299
|
if (!dragged) return;
|
|
@@ -28040,7 +28364,7 @@ function OhhwellsBridge() {
|
|
|
28040
28364
|
setLogoSizeDraft(null);
|
|
28041
28365
|
deselectRef.current();
|
|
28042
28366
|
}, []);
|
|
28043
|
-
|
|
28367
|
+
useEffect21(() => {
|
|
28044
28368
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
28045
28369
|
if (!session || !logoSizeDraft) {
|
|
28046
28370
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28178,13 +28502,13 @@ function OhhwellsBridge() {
|
|
|
28178
28502
|
setReorderDragDisabled(reorderDisabled);
|
|
28179
28503
|
}
|
|
28180
28504
|
setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
28181
|
-
const
|
|
28505
|
+
const sectionEl2 = el.closest("[data-ohw-section]");
|
|
28182
28506
|
postToParent2({
|
|
28183
28507
|
type: "ow:enter-edit",
|
|
28184
28508
|
key: el.dataset.ohwKey,
|
|
28185
28509
|
// Section the edited element belongs to, so the editor can scope AI prompts to it.
|
|
28186
|
-
sectionId:
|
|
28187
|
-
sectionLabel:
|
|
28510
|
+
sectionId: sectionEl2?.dataset.ohwSection ?? null,
|
|
28511
|
+
sectionLabel: sectionEl2?.dataset.ohwSectionLabel ?? null
|
|
28188
28512
|
});
|
|
28189
28513
|
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
28190
28514
|
requestAnimationFrame(() => refreshActiveCommandsRef.current());
|
|
@@ -28198,7 +28522,7 @@ function OhhwellsBridge() {
|
|
|
28198
28522
|
deselectRef.current = deselect;
|
|
28199
28523
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28200
28524
|
const lastSiteWideScopeRef = useRef14(null);
|
|
28201
|
-
|
|
28525
|
+
useEffect21(() => {
|
|
28202
28526
|
if (!isEditMode) {
|
|
28203
28527
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28204
28528
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28224,7 +28548,7 @@ function OhhwellsBridge() {
|
|
|
28224
28548
|
isFooterFrameSelection,
|
|
28225
28549
|
postToParent2
|
|
28226
28550
|
]);
|
|
28227
|
-
|
|
28551
|
+
useLayoutEffect7(() => {
|
|
28228
28552
|
if (!subdomain || isEditMode) {
|
|
28229
28553
|
setFetchState("done");
|
|
28230
28554
|
return;
|
|
@@ -28251,6 +28575,7 @@ function OhhwellsBridge() {
|
|
|
28251
28575
|
applyAiFooterFromContent(content);
|
|
28252
28576
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28253
28577
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28578
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28254
28579
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28255
28580
|
}
|
|
28256
28581
|
applyBrandChrome(content);
|
|
@@ -28261,15 +28586,16 @@ function OhhwellsBridge() {
|
|
|
28261
28586
|
if (key === "__ohw_sections") continue;
|
|
28262
28587
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28263
28588
|
if (key === AI_FOOTER_KEY) continue;
|
|
28589
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28590
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28264
28591
|
if (key === BRAND_KIT_KEY) continue;
|
|
28265
28592
|
if (key === STYLE_STORE_KEY) continue;
|
|
28266
28593
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28267
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28268
28594
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28269
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28270
28595
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28271
28596
|
continue;
|
|
28272
28597
|
}
|
|
28598
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28273
28599
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28274
28600
|
if (applyCarouselNode(key, val)) continue;
|
|
28275
28601
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28309,6 +28635,7 @@ function OhhwellsBridge() {
|
|
|
28309
28635
|
});
|
|
28310
28636
|
applyLinkByKey(key, val);
|
|
28311
28637
|
}
|
|
28638
|
+
applySectionEmbeds(content);
|
|
28312
28639
|
applyLogoFromContent(content);
|
|
28313
28640
|
applyLogoSizes(content);
|
|
28314
28641
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28375,7 +28702,7 @@ function OhhwellsBridge() {
|
|
|
28375
28702
|
cancelled = true;
|
|
28376
28703
|
};
|
|
28377
28704
|
}, [subdomain, isEditMode]);
|
|
28378
|
-
|
|
28705
|
+
useEffect21(() => {
|
|
28379
28706
|
if (!isEditMode) return;
|
|
28380
28707
|
const resolveIndex = (form, clientY) => {
|
|
28381
28708
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28416,7 +28743,7 @@ function OhhwellsBridge() {
|
|
|
28416
28743
|
window.removeEventListener("drop", onDrop, true);
|
|
28417
28744
|
};
|
|
28418
28745
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28419
|
-
|
|
28746
|
+
useEffect21(() => {
|
|
28420
28747
|
if (!isEditMode) return;
|
|
28421
28748
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28422
28749
|
markFormFields(form);
|
|
@@ -28428,7 +28755,7 @@ function OhhwellsBridge() {
|
|
|
28428
28755
|
});
|
|
28429
28756
|
return () => observer.disconnect();
|
|
28430
28757
|
}, [isEditMode, fetchState, pathname]);
|
|
28431
|
-
|
|
28758
|
+
useEffect21(() => {
|
|
28432
28759
|
if (!isEditMode) return;
|
|
28433
28760
|
let saveTimer = null;
|
|
28434
28761
|
const onInput = (e) => {
|
|
@@ -28450,14 +28777,14 @@ function OhhwellsBridge() {
|
|
|
28450
28777
|
document.addEventListener("input", onInput, true);
|
|
28451
28778
|
return () => document.removeEventListener("input", onInput, true);
|
|
28452
28779
|
}, [isEditMode, persistFields]);
|
|
28453
|
-
|
|
28780
|
+
useEffect21(() => {
|
|
28454
28781
|
if (isEditMode || fetchState !== "done") return;
|
|
28455
28782
|
const content = contentCache.get(subdomain) ?? {};
|
|
28456
28783
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28457
28784
|
reconcileFieldsFromContent(form, content);
|
|
28458
28785
|
});
|
|
28459
28786
|
}, [isEditMode, fetchState, subdomain]);
|
|
28460
|
-
|
|
28787
|
+
useEffect21(() => {
|
|
28461
28788
|
if (!isEditMode) return;
|
|
28462
28789
|
const swallow = (e) => {
|
|
28463
28790
|
const target = e.target;
|
|
@@ -28466,14 +28793,14 @@ function OhhwellsBridge() {
|
|
|
28466
28793
|
document.addEventListener("submit", swallow, true);
|
|
28467
28794
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28468
28795
|
}, [isEditMode]);
|
|
28469
|
-
|
|
28796
|
+
useEffect21(() => {
|
|
28470
28797
|
if (isEditMode || fetchState !== "done") return;
|
|
28471
28798
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28472
28799
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28473
28800
|
console.log({ apiUrl, subdomain });
|
|
28474
28801
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28475
28802
|
}, [isEditMode, fetchState, subdomain]);
|
|
28476
|
-
|
|
28803
|
+
useEffect21(() => {
|
|
28477
28804
|
if (!subdomain || isEditMode) return;
|
|
28478
28805
|
let debounceTimer = null;
|
|
28479
28806
|
let observer = null;
|
|
@@ -28497,20 +28824,22 @@ function OhhwellsBridge() {
|
|
|
28497
28824
|
}
|
|
28498
28825
|
applyAiFooterFromContent(content);
|
|
28499
28826
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28827
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28500
28828
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28501
28829
|
}
|
|
28502
28830
|
for (const [key, val] of Object.entries(content)) {
|
|
28503
28831
|
if (key === "__ohw_sections") continue;
|
|
28504
28832
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28505
28833
|
if (key === AI_FOOTER_KEY) continue;
|
|
28834
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28835
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28506
28836
|
if (key === BRAND_KIT_KEY) continue;
|
|
28507
28837
|
if (key === STYLE_STORE_KEY) continue;
|
|
28508
28838
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28509
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28510
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28511
28839
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28512
28840
|
continue;
|
|
28513
28841
|
}
|
|
28842
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28514
28843
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28515
28844
|
if (applyCarouselNode(key, val)) continue;
|
|
28516
28845
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28535,6 +28864,7 @@ function OhhwellsBridge() {
|
|
|
28535
28864
|
});
|
|
28536
28865
|
applyLinkByKey(key, val);
|
|
28537
28866
|
}
|
|
28867
|
+
applySectionEmbeds(content);
|
|
28538
28868
|
applyLogoFromContent(content);
|
|
28539
28869
|
reconcileNavbarItemsFromContent(content);
|
|
28540
28870
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28590,16 +28920,16 @@ function OhhwellsBridge() {
|
|
|
28590
28920
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28591
28921
|
};
|
|
28592
28922
|
}, [subdomain, isEditMode, pathname]);
|
|
28593
|
-
|
|
28923
|
+
useLayoutEffect7(() => {
|
|
28594
28924
|
const el = document.getElementById("ohw-loader");
|
|
28595
28925
|
if (!el) return;
|
|
28596
28926
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28597
28927
|
el.style.display = visible ? "flex" : "none";
|
|
28598
28928
|
}, [subdomain, fetchState]);
|
|
28599
|
-
|
|
28929
|
+
useEffect21(() => {
|
|
28600
28930
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28601
28931
|
}, [pathname, postToParent2]);
|
|
28602
|
-
|
|
28932
|
+
useEffect21(() => {
|
|
28603
28933
|
if (!subdomain || isEditMode) return;
|
|
28604
28934
|
const content = contentCache.get(subdomain);
|
|
28605
28935
|
if (!content) return;
|
|
@@ -28617,7 +28947,7 @@ function OhhwellsBridge() {
|
|
|
28617
28947
|
}
|
|
28618
28948
|
applyAiFooterFromContent(content);
|
|
28619
28949
|
}, [pathname, subdomain, isEditMode]);
|
|
28620
|
-
|
|
28950
|
+
useEffect21(() => {
|
|
28621
28951
|
if (!isEditMode) return;
|
|
28622
28952
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28623
28953
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28625,12 +28955,12 @@ function OhhwellsBridge() {
|
|
|
28625
28955
|
deselectRef.current();
|
|
28626
28956
|
deactivateRef.current();
|
|
28627
28957
|
}, [pathname, isEditMode]);
|
|
28628
|
-
|
|
28958
|
+
useEffect21(() => {
|
|
28629
28959
|
if (!isEditMode) return;
|
|
28630
28960
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28631
28961
|
initItemInstancesFromContent(editContentRef.current);
|
|
28632
28962
|
}, [pathname, isEditMode]);
|
|
28633
|
-
|
|
28963
|
+
useEffect21(() => {
|
|
28634
28964
|
if (!isEditMode) return;
|
|
28635
28965
|
const observer = new MutationObserver(() => {
|
|
28636
28966
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28641,7 +28971,7 @@ function OhhwellsBridge() {
|
|
|
28641
28971
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28642
28972
|
return () => observer.disconnect();
|
|
28643
28973
|
}, [isEditMode, pathname]);
|
|
28644
|
-
|
|
28974
|
+
useEffect21(() => {
|
|
28645
28975
|
const contentForNav = () => {
|
|
28646
28976
|
if (isEditMode) return editContentRef.current;
|
|
28647
28977
|
if (!subdomain) return {};
|
|
@@ -28714,7 +29044,7 @@ function OhhwellsBridge() {
|
|
|
28714
29044
|
observer?.disconnect();
|
|
28715
29045
|
};
|
|
28716
29046
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28717
|
-
|
|
29047
|
+
useEffect21(() => {
|
|
28718
29048
|
if (!isEditMode) return;
|
|
28719
29049
|
let applying = false;
|
|
28720
29050
|
let rafId = null;
|
|
@@ -28752,7 +29082,7 @@ function OhhwellsBridge() {
|
|
|
28752
29082
|
observer.disconnect();
|
|
28753
29083
|
};
|
|
28754
29084
|
}, [isEditMode, pathname]);
|
|
28755
|
-
|
|
29085
|
+
useEffect21(() => {
|
|
28756
29086
|
if (!isEditMode) return;
|
|
28757
29087
|
let lastPosted = 0;
|
|
28758
29088
|
const measure = () => {
|
|
@@ -28774,29 +29104,14 @@ function OhhwellsBridge() {
|
|
|
28774
29104
|
const t2 = setTimeout(measure, 500);
|
|
28775
29105
|
const ro = new ResizeObserver(schedule);
|
|
28776
29106
|
ro.observe(document.body);
|
|
28777
|
-
let lastWidth = window.innerWidth;
|
|
28778
|
-
let resizeTimers = [];
|
|
28779
|
-
const clearResizeTimers = () => {
|
|
28780
|
-
resizeTimers.forEach(clearTimeout);
|
|
28781
|
-
resizeTimers = [];
|
|
28782
|
-
};
|
|
28783
|
-
const handleResize = () => {
|
|
28784
|
-
if (window.innerWidth === lastWidth) return;
|
|
28785
|
-
lastWidth = window.innerWidth;
|
|
28786
|
-
clearResizeTimers();
|
|
28787
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
28788
|
-
};
|
|
28789
|
-
window.addEventListener("resize", handleResize);
|
|
28790
29107
|
return () => {
|
|
28791
29108
|
clearTimeout(t1);
|
|
28792
29109
|
clearTimeout(t2);
|
|
28793
29110
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28794
29111
|
ro.disconnect();
|
|
28795
|
-
clearResizeTimers();
|
|
28796
|
-
window.removeEventListener("resize", handleResize);
|
|
28797
29112
|
};
|
|
28798
29113
|
}, [pathname, isEditMode, postToParent2]);
|
|
28799
|
-
|
|
29114
|
+
useEffect21(() => {
|
|
28800
29115
|
if (isEditMode) return;
|
|
28801
29116
|
const handleClick = (e) => {
|
|
28802
29117
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28810,7 +29125,7 @@ function OhhwellsBridge() {
|
|
|
28810
29125
|
document.addEventListener("click", handleClick, true);
|
|
28811
29126
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28812
29127
|
}, [isEditMode, router, pathname]);
|
|
28813
|
-
|
|
29128
|
+
useEffect21(() => {
|
|
28814
29129
|
if (!isEditMode) {
|
|
28815
29130
|
editStylesRef.current?.base.remove();
|
|
28816
29131
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -29090,6 +29405,13 @@ function OhhwellsBridge() {
|
|
|
29090
29405
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29091
29406
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29092
29407
|
if (isInsideLinkEditor(target)) return;
|
|
29408
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29409
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29410
|
+
if (target.closest(
|
|
29411
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29412
|
+
)) {
|
|
29413
|
+
return;
|
|
29414
|
+
}
|
|
29093
29415
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29094
29416
|
clearMediaSelectionRef.current();
|
|
29095
29417
|
}
|
|
@@ -29113,8 +29435,6 @@ function OhhwellsBridge() {
|
|
|
29113
29435
|
return;
|
|
29114
29436
|
}
|
|
29115
29437
|
}
|
|
29116
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29117
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29118
29438
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29119
29439
|
if (collectionItem) {
|
|
29120
29440
|
e.preventDefault();
|
|
@@ -29126,11 +29446,6 @@ function OhhwellsBridge() {
|
|
|
29126
29446
|
});
|
|
29127
29447
|
return;
|
|
29128
29448
|
}
|
|
29129
|
-
if (target.closest(
|
|
29130
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29131
|
-
)) {
|
|
29132
|
-
return;
|
|
29133
|
-
}
|
|
29134
29449
|
{
|
|
29135
29450
|
const formEl = getFormElement(target);
|
|
29136
29451
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29284,9 +29599,13 @@ function OhhwellsBridge() {
|
|
|
29284
29599
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29285
29600
|
e.preventDefault();
|
|
29286
29601
|
e.stopPropagation();
|
|
29287
|
-
selectIconElementRef.current(editable);
|
|
29288
29602
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29289
29603
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29604
|
+
if (aiIcon) {
|
|
29605
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29606
|
+
} else {
|
|
29607
|
+
selectIconElementRef.current(editable);
|
|
29608
|
+
}
|
|
29290
29609
|
postToParentRef.current({
|
|
29291
29610
|
type: "ow:icon-pick",
|
|
29292
29611
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29514,6 +29833,9 @@ function OhhwellsBridge() {
|
|
|
29514
29833
|
setHoveredItemRect(null);
|
|
29515
29834
|
hoveredNavContainerRef.current = null;
|
|
29516
29835
|
setHoveredNavContainerRect(null);
|
|
29836
|
+
siblingHintElRef.current = null;
|
|
29837
|
+
setSiblingHintRect(null);
|
|
29838
|
+
setSiblingHintRects([]);
|
|
29517
29839
|
return;
|
|
29518
29840
|
}
|
|
29519
29841
|
{
|
|
@@ -29634,7 +29956,6 @@ function OhhwellsBridge() {
|
|
|
29634
29956
|
hoveredNavContainerRef.current = null;
|
|
29635
29957
|
setHoveredNavContainerRect(null);
|
|
29636
29958
|
hoveredItemElRef.current = editable;
|
|
29637
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29638
29959
|
}
|
|
29639
29960
|
}
|
|
29640
29961
|
}
|
|
@@ -30344,7 +30665,11 @@ function OhhwellsBridge() {
|
|
|
30344
30665
|
};
|
|
30345
30666
|
const handleMouseMove = (e) => {
|
|
30346
30667
|
const { clientX, clientY } = e;
|
|
30347
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30668
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30669
|
+
dismissImageHover();
|
|
30670
|
+
clearImageHover();
|
|
30671
|
+
return;
|
|
30672
|
+
}
|
|
30348
30673
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30349
30674
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30350
30675
|
formHoverElRef.current = null;
|
|
@@ -30373,7 +30698,12 @@ function OhhwellsBridge() {
|
|
|
30373
30698
|
setHoveredItemRect(null);
|
|
30374
30699
|
hoveredNavContainerRef.current = null;
|
|
30375
30700
|
setHoveredNavContainerRect(null);
|
|
30701
|
+
siblingHintElRef.current = null;
|
|
30702
|
+
setSiblingHintRect(null);
|
|
30703
|
+
setSiblingHintRects([]);
|
|
30376
30704
|
dismissImageHover();
|
|
30705
|
+
clearImageHover();
|
|
30706
|
+
setSectionGap(null);
|
|
30377
30707
|
return;
|
|
30378
30708
|
}
|
|
30379
30709
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30385,7 +30715,11 @@ function OhhwellsBridge() {
|
|
|
30385
30715
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30386
30716
|
const { clientX, clientY } = e.data;
|
|
30387
30717
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30388
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30718
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30719
|
+
dismissImageHover();
|
|
30720
|
+
clearImageHover();
|
|
30721
|
+
return;
|
|
30722
|
+
}
|
|
30389
30723
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30390
30724
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30391
30725
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30765,6 +31099,7 @@ function OhhwellsBridge() {
|
|
|
30765
31099
|
applyAiFooterFromContent(content);
|
|
30766
31100
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30767
31101
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31102
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30768
31103
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30769
31104
|
}
|
|
30770
31105
|
applyBrandChrome(content);
|
|
@@ -30779,15 +31114,16 @@ function OhhwellsBridge() {
|
|
|
30779
31114
|
}
|
|
30780
31115
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30781
31116
|
if (key === AI_FOOTER_KEY) continue;
|
|
31117
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31118
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30782
31119
|
if (key === BRAND_KIT_KEY) continue;
|
|
30783
31120
|
if (key === STYLE_STORE_KEY) continue;
|
|
30784
31121
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30785
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30786
31122
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30787
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30788
31123
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30789
31124
|
continue;
|
|
30790
31125
|
}
|
|
31126
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30791
31127
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30792
31128
|
if (applyCarouselNode(key, val)) continue;
|
|
30793
31129
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30813,6 +31149,7 @@ function OhhwellsBridge() {
|
|
|
30813
31149
|
});
|
|
30814
31150
|
applyLinkByKey(key, val);
|
|
30815
31151
|
}
|
|
31152
|
+
applySectionEmbeds(content);
|
|
30816
31153
|
applyLogoFromContent(content);
|
|
30817
31154
|
applyLogoSizes(content);
|
|
30818
31155
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31445,6 +31782,12 @@ function OhhwellsBridge() {
|
|
|
31445
31782
|
closeLinkPopoverRef.current();
|
|
31446
31783
|
return;
|
|
31447
31784
|
}
|
|
31785
|
+
if (floatingPanelOpenRef.current) {
|
|
31786
|
+
setFloatingPanelRef.current(null);
|
|
31787
|
+
deselectRef.current();
|
|
31788
|
+
deactivateRef.current();
|
|
31789
|
+
return;
|
|
31790
|
+
}
|
|
31448
31791
|
deselectRef.current();
|
|
31449
31792
|
deactivateRef.current();
|
|
31450
31793
|
clearMediaSelectionRef.current();
|
|
@@ -31830,12 +32173,12 @@ function OhhwellsBridge() {
|
|
|
31830
32173
|
`[data-ohw-instance="${escapedSectionId}"]`
|
|
31831
32174
|
);
|
|
31832
32175
|
const foundEl = instanceEl ? sectionElementOf(instanceEl) : document.querySelector(`[data-ohw-section="${escapedSectionId}"]`);
|
|
31833
|
-
const
|
|
31834
|
-
const nodes =
|
|
32176
|
+
const sectionEl2 = foundEl && !foundEl.hasAttribute("data-ohw-ai-template-hidden") && !foundEl.hasAttribute("data-ohw-ai-removed") && !foundEl.hasAttribute("data-ohw-ai-replaced-by") ? foundEl : null;
|
|
32177
|
+
const nodes = sectionEl2 ? collectEditableNodes(void 0, sectionEl2).filter(
|
|
31835
32178
|
(n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "video-setting"].includes(n.type)
|
|
31836
|
-
).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n,
|
|
31837
|
-
const items =
|
|
31838
|
-
const box =
|
|
32179
|
+
).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl2)) : [];
|
|
32180
|
+
const items = sectionEl2 ? collectItemGroups(sectionEl2) : [];
|
|
32181
|
+
const box = sectionEl2?.getBoundingClientRect();
|
|
31839
32182
|
const rect = box ? {
|
|
31840
32183
|
top: box.top + window.scrollY,
|
|
31841
32184
|
left: box.left + window.scrollX,
|
|
@@ -31851,7 +32194,7 @@ function OhhwellsBridge() {
|
|
|
31851
32194
|
postToParentRef.current({
|
|
31852
32195
|
type: "ow:section-nodes",
|
|
31853
32196
|
sectionId,
|
|
31854
|
-
found: !!
|
|
32197
|
+
found: !!sectionEl2,
|
|
31855
32198
|
nodes,
|
|
31856
32199
|
rect,
|
|
31857
32200
|
...settings ? { settings } : {},
|
|
@@ -31859,7 +32202,7 @@ function OhhwellsBridge() {
|
|
|
31859
32202
|
// The section's repeated-item groups (cards, rows, FAQ entries) — what lets a prompt add
|
|
31860
32203
|
// or remove items on a template section without regenerating it. Empty for generated
|
|
31861
32204
|
// sections, whose items live in the tree.
|
|
31862
|
-
...
|
|
32205
|
+
...sectionEl2 && items.length ? { items } : {}
|
|
31863
32206
|
});
|
|
31864
32207
|
};
|
|
31865
32208
|
const handleCollectItems = (e) => {
|
|
@@ -32281,17 +32624,17 @@ function OhhwellsBridge() {
|
|
|
32281
32624
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32282
32625
|
window.removeEventListener("message", handleDeactivate);
|
|
32283
32626
|
window.removeEventListener("message", handleSelectNav);
|
|
32284
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32285
32627
|
window.removeEventListener("message", handleToastAction);
|
|
32286
32628
|
window.removeEventListener("message", handleFormCount);
|
|
32287
32629
|
window.removeEventListener("message", handleUiEscape);
|
|
32630
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32288
32631
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32289
32632
|
autoSaveTimers.current.clear();
|
|
32290
32633
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
32291
32634
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32292
32635
|
};
|
|
32293
32636
|
}, [isEditMode, refreshStateRules]);
|
|
32294
|
-
|
|
32637
|
+
useEffect21(() => {
|
|
32295
32638
|
if (!isEditMode) return;
|
|
32296
32639
|
const THRESHOLD = 10;
|
|
32297
32640
|
const resolveWasSelected = (el) => {
|
|
@@ -32447,7 +32790,7 @@ function OhhwellsBridge() {
|
|
|
32447
32790
|
unlockFooterDragInteraction();
|
|
32448
32791
|
};
|
|
32449
32792
|
}, [isEditMode]);
|
|
32450
|
-
|
|
32793
|
+
useEffect21(() => {
|
|
32451
32794
|
if (!isEditMode) return;
|
|
32452
32795
|
const THRESHOLD = 10;
|
|
32453
32796
|
const onPointerDown = (e) => {
|
|
@@ -32538,7 +32881,7 @@ function OhhwellsBridge() {
|
|
|
32538
32881
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32539
32882
|
};
|
|
32540
32883
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32541
|
-
|
|
32884
|
+
useEffect21(() => {
|
|
32542
32885
|
const handler = (e) => {
|
|
32543
32886
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32544
32887
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32554,7 +32897,7 @@ function OhhwellsBridge() {
|
|
|
32554
32897
|
window.addEventListener("message", handler);
|
|
32555
32898
|
return () => window.removeEventListener("message", handler);
|
|
32556
32899
|
}, [processConfigRequest]);
|
|
32557
|
-
|
|
32900
|
+
useEffect21(() => {
|
|
32558
32901
|
if (!isEditMode) return;
|
|
32559
32902
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32560
32903
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32578,7 +32921,7 @@ function OhhwellsBridge() {
|
|
|
32578
32921
|
postToParent2({
|
|
32579
32922
|
type: "ow:ready",
|
|
32580
32923
|
version: "1",
|
|
32581
|
-
bridgeVersion: "0.1.
|
|
32924
|
+
bridgeVersion: "0.1.167-next.444",
|
|
32582
32925
|
path: pathname,
|
|
32583
32926
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32584
32927
|
sections
|
|
@@ -32590,7 +32933,7 @@ function OhhwellsBridge() {
|
|
|
32590
32933
|
clearTimeout(timer);
|
|
32591
32934
|
};
|
|
32592
32935
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32593
|
-
|
|
32936
|
+
useEffect21(() => {
|
|
32594
32937
|
scrollToHashSectionWhenReady();
|
|
32595
32938
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32596
32939
|
window.addEventListener("hashchange", onHashChange);
|
|
@@ -32632,7 +32975,7 @@ function OhhwellsBridge() {
|
|
|
32632
32975
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32633
32976
|
refreshActiveCommandsRef.current();
|
|
32634
32977
|
}, []);
|
|
32635
|
-
|
|
32978
|
+
useEffect21(() => {
|
|
32636
32979
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32637
32980
|
if (!session || !logoSizeDraft) return;
|
|
32638
32981
|
const onPanelAction = (e) => {
|
|
@@ -33313,7 +33656,7 @@ function OhhwellsBridge() {
|
|
|
33313
33656
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33314
33657
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33315
33658
|
"data-ohw-add-field": "",
|
|
33316
|
-
children: /* @__PURE__ */ jsx40(
|
|
33659
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33317
33660
|
}
|
|
33318
33661
|
),
|
|
33319
33662
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -33828,6 +34171,8 @@ export {
|
|
|
33828
34171
|
serializeAiFooterState,
|
|
33829
34172
|
shouldFetchContentForPath,
|
|
33830
34173
|
stepViableSlide,
|
|
34174
|
+
stripPlaceholderText,
|
|
34175
|
+
stripPlaceholders,
|
|
33831
34176
|
stripTextAlignCss,
|
|
33832
34177
|
toggleVariants,
|
|
33833
34178
|
useOhwCarousel,
|