@ohhwells/bridge 0.1.165 → 0.1.166-next.442
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 +1621 -1252
- 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 +1263 -880
- 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) {
|
|
@@ -6432,6 +6432,24 @@ function deleteSectionFromState(state, sectionId) {
|
|
|
6432
6432
|
if (removed.includes(sectionId)) return state;
|
|
6433
6433
|
return { ...state, v: 1, sections: state.sections, removed: [...removed, sectionId] };
|
|
6434
6434
|
}
|
|
6435
|
+
function moveSectionInState(state, sectionId, targetPath) {
|
|
6436
|
+
const entry = state.sections.find((section) => section.id === sectionId);
|
|
6437
|
+
if (!entry) return null;
|
|
6438
|
+
const moved = {
|
|
6439
|
+
id: entry.id,
|
|
6440
|
+
label: entry.label,
|
|
6441
|
+
path: targetPath,
|
|
6442
|
+
afterSection: null,
|
|
6443
|
+
tree: entry.tree,
|
|
6444
|
+
media: entry.media,
|
|
6445
|
+
...entry.brand ? { brand: entry.brand } : {}
|
|
6446
|
+
};
|
|
6447
|
+
return {
|
|
6448
|
+
...state,
|
|
6449
|
+
v: 1,
|
|
6450
|
+
sections: state.sections.map((section) => section.id === sectionId ? moved : section)
|
|
6451
|
+
};
|
|
6452
|
+
}
|
|
6435
6453
|
function reapRemovedAiSections(state, store, removedIds, excludeIds = /* @__PURE__ */ new Set()) {
|
|
6436
6454
|
const generated = new Set(state.sections.map((entry) => entry.id));
|
|
6437
6455
|
const reapedIds = [...new Set(removedIds)].filter((id) => generated.has(id) && !excludeIds.has(id));
|
|
@@ -6660,6 +6678,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6660
6678
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6661
6679
|
return target ? pricingFeatureList(target).length : 0;
|
|
6662
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
|
+
}
|
|
6663
6696
|
function addPricingCardFeature(tree, index, text) {
|
|
6664
6697
|
return withPricingCollection(tree, (collection) => {
|
|
6665
6698
|
const children = collection.children;
|
|
@@ -6668,7 +6701,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6668
6701
|
const features = pricingFeatureList(target);
|
|
6669
6702
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6670
6703
|
target.slots = target.slots ?? {};
|
|
6671
|
-
target.slots.features = [...features, { text }];
|
|
6704
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6672
6705
|
return true;
|
|
6673
6706
|
});
|
|
6674
6707
|
}
|
|
@@ -7312,6 +7345,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7312
7345
|
);
|
|
7313
7346
|
}
|
|
7314
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
|
+
|
|
7315
7462
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7316
7463
|
import { flushSync } from "react-dom";
|
|
7317
7464
|
import { createRoot } from "react-dom/client";
|
|
@@ -7885,7 +8032,7 @@ var AI_MOBILE_CSS = [
|
|
|
7885
8032
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7886
8033
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7887
8034
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
7888
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8035
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7889
8036
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7890
8037
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7891
8038
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -7901,8 +8048,10 @@ var AI_MOBILE_CSS = [
|
|
|
7901
8048
|
"[data-ai-section]{overflow-x:hidden}",
|
|
7902
8049
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
7903
8050
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
7904
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
7905
|
-
|
|
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}",
|
|
7906
8055
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
7907
8056
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
7908
8057
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8107,6 +8256,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8107
8256
|
function textAttrs(ctx, path) {
|
|
8108
8257
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8109
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");
|
|
8110
8284
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8111
8285
|
function MediaBox({
|
|
8112
8286
|
refValue,
|
|
@@ -8161,7 +8335,7 @@ function MediaBox({
|
|
|
8161
8335
|
position: fill ? "absolute" : void 0,
|
|
8162
8336
|
inset: fill ? 0 : void 0,
|
|
8163
8337
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8164
|
-
height: fill ? "100%" : void 0,
|
|
8338
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8165
8339
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8166
8340
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8167
8341
|
borderRadius: radius,
|
|
@@ -9657,7 +9831,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9657
9831
|
return /* @__PURE__ */ jsx(
|
|
9658
9832
|
"div",
|
|
9659
9833
|
{
|
|
9660
|
-
"data-ai-grid":
|
|
9834
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9661
9835
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9662
9836
|
style: {
|
|
9663
9837
|
display: "grid",
|
|
@@ -9959,7 +10133,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
9959
10133
|
},
|
|
9960
10134
|
children: [
|
|
9961
10135
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
9962
|
-
// The section's `data-ai-
|
|
10136
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
9963
10137
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
9964
10138
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
9965
10139
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10378,6 +10552,7 @@ function AiTreeRenderer({
|
|
|
10378
10552
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10379
10553
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10380
10554
|
...bgAttrs,
|
|
10555
|
+
"data-ai-responsive": "",
|
|
10381
10556
|
style: {
|
|
10382
10557
|
position: "relative",
|
|
10383
10558
|
padding: `${padCss} 0`,
|
|
@@ -10391,12 +10566,13 @@ function AiTreeRenderer({
|
|
|
10391
10566
|
...fillHeight ? { display: "grid" } : {}
|
|
10392
10567
|
},
|
|
10393
10568
|
children: [
|
|
10394
|
-
|
|
10569
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10395
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})` } }),
|
|
10396
10572
|
/* @__PURE__ */ jsx(
|
|
10397
10573
|
"div",
|
|
10398
10574
|
{
|
|
10399
|
-
"data-ai-
|
|
10575
|
+
"data-ai-section-inner": "",
|
|
10400
10576
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10401
10577
|
style: {
|
|
10402
10578
|
position: "relative",
|
|
@@ -10413,7 +10589,7 @@ function AiTreeRenderer({
|
|
|
10413
10589
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10414
10590
|
"div",
|
|
10415
10591
|
{
|
|
10416
|
-
"data-ai-
|
|
10592
|
+
"data-ai-columns": "",
|
|
10417
10593
|
style: {
|
|
10418
10594
|
display: "grid",
|
|
10419
10595
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11075,9 +11251,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11075
11251
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11076
11252
|
continue;
|
|
11077
11253
|
}
|
|
11078
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11079
11254
|
let container = existing?.container;
|
|
11255
|
+
let isNewMount = false;
|
|
11080
11256
|
if (!container || !container.isConnected) {
|
|
11257
|
+
isNewMount = true;
|
|
11081
11258
|
existing?.root.unmount();
|
|
11082
11259
|
container?.remove();
|
|
11083
11260
|
container = document.createElement("div");
|
|
@@ -11415,6 +11592,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11415
11592
|
return 3;
|
|
11416
11593
|
}
|
|
11417
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
|
+
}
|
|
11418
11623
|
function collectBrandBlocks(tree) {
|
|
11419
11624
|
const brand = [];
|
|
11420
11625
|
for (const col of tree.columns) {
|
|
@@ -11660,6 +11865,7 @@ function textOf2(el) {
|
|
|
11660
11865
|
}
|
|
11661
11866
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11662
11867
|
const next = cloneTree(tree);
|
|
11868
|
+
syncSocialRowsFromDom(next);
|
|
11663
11869
|
const domCols = listFooterColumns().map((col) => {
|
|
11664
11870
|
const heading = getFooterColumnHeadingEl(col);
|
|
11665
11871
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -12132,8 +12338,116 @@ function useHashLinkScroll(isEditMode) {
|
|
|
12132
12338
|
}, [isEditMode]);
|
|
12133
12339
|
}
|
|
12134
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
|
+
|
|
12135
12449
|
// src/ui/SchedulingWidget.tsx
|
|
12136
|
-
import { useCallback, useEffect as
|
|
12450
|
+
import { useCallback, useEffect as useEffect6, useId, useMemo, useRef, useState as useState3 } from "react";
|
|
12137
12451
|
|
|
12138
12452
|
// src/ui/EmailCaptureModal.tsx
|
|
12139
12453
|
import { useState as useState2 } from "react";
|
|
@@ -12451,7 +12765,7 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12451
12765
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
12452
12766
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
12453
12767
|
};
|
|
12454
|
-
|
|
12768
|
+
useEffect6(() => {
|
|
12455
12769
|
const el = scrollRef.current;
|
|
12456
12770
|
if (!el) return;
|
|
12457
12771
|
updateScrollState();
|
|
@@ -12709,7 +13023,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12709
13023
|
});
|
|
12710
13024
|
}, []);
|
|
12711
13025
|
const [selectedIdx, setSelectedIdx] = useState3(0);
|
|
12712
|
-
|
|
13026
|
+
useEffect6(() => {
|
|
12713
13027
|
if (!schedule?.classes) return;
|
|
12714
13028
|
for (let i = 0; i < dates.length; i++) {
|
|
12715
13029
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -12718,7 +13032,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12718
13032
|
}
|
|
12719
13033
|
}
|
|
12720
13034
|
}, [schedule, dates]);
|
|
12721
|
-
|
|
13035
|
+
useEffect6(() => {
|
|
12722
13036
|
if (typeof window === "undefined") return;
|
|
12723
13037
|
const onVisible = () => {
|
|
12724
13038
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -12730,7 +13044,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12730
13044
|
document.removeEventListener("visibilitychange", onVisible);
|
|
12731
13045
|
};
|
|
12732
13046
|
}, [refetchLiveSchedule]);
|
|
12733
|
-
|
|
13047
|
+
useEffect6(() => {
|
|
12734
13048
|
if (typeof window === "undefined") return;
|
|
12735
13049
|
const isInEditor = window.self !== window.top;
|
|
12736
13050
|
setInEditor(isInEditor);
|
|
@@ -17267,7 +17581,7 @@ function clearSubmitError(form) {
|
|
|
17267
17581
|
if (note) note.style.display = "none";
|
|
17268
17582
|
}
|
|
17269
17583
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17270
|
-
var
|
|
17584
|
+
var HIDDEN_ATTR3 = "data-ohw-form-hidden";
|
|
17271
17585
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17272
17586
|
function formSuccessKey(formKey) {
|
|
17273
17587
|
return `${formKey}-success`;
|
|
@@ -17293,13 +17607,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17293
17607
|
Array.from(form.children).forEach((child) => {
|
|
17294
17608
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17295
17609
|
if (state === "success") {
|
|
17296
|
-
if (!child.hasAttribute(
|
|
17297
|
-
child.setAttribute(
|
|
17610
|
+
if (!child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17611
|
+
child.setAttribute(HIDDEN_ATTR3, child.style.display);
|
|
17298
17612
|
child.style.display = "none";
|
|
17299
17613
|
}
|
|
17300
|
-
} else if (child.hasAttribute(
|
|
17301
|
-
child.style.display = child.getAttribute(
|
|
17302
|
-
child.removeAttribute(
|
|
17614
|
+
} else if (child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17615
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
|
|
17616
|
+
child.removeAttribute(HIDDEN_ATTR3);
|
|
17303
17617
|
}
|
|
17304
17618
|
});
|
|
17305
17619
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17364,7 +17678,7 @@ function apiBase() {
|
|
|
17364
17678
|
function bridgeVersion() {
|
|
17365
17679
|
try {
|
|
17366
17680
|
if (true) {
|
|
17367
|
-
return "0.1.
|
|
17681
|
+
return "0.1.166-next.442";
|
|
17368
17682
|
}
|
|
17369
17683
|
} catch {
|
|
17370
17684
|
}
|
|
@@ -17378,7 +17692,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17378
17692
|
return;
|
|
17379
17693
|
}
|
|
17380
17694
|
try {
|
|
17381
|
-
const v = true ? "0.1.
|
|
17695
|
+
const v = true ? "0.1.166-next.442" : "";
|
|
17382
17696
|
if (v) {
|
|
17383
17697
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17384
17698
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18056,6 +18370,7 @@ function MediaOverlay({
|
|
|
18056
18370
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18057
18371
|
);
|
|
18058
18372
|
}, [isVideo]);
|
|
18373
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18059
18374
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18060
18375
|
const box = {
|
|
18061
18376
|
position: "fixed",
|
|
@@ -18154,11 +18469,10 @@ function MediaOverlay({
|
|
|
18154
18469
|
className: "flex items-center justify-center cursor-pointer",
|
|
18155
18470
|
style: {
|
|
18156
18471
|
...box,
|
|
18157
|
-
//
|
|
18158
|
-
//
|
|
18159
|
-
//
|
|
18160
|
-
|
|
18161
|
-
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",
|
|
18162
18476
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18163
18477
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18164
18478
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18185,17 +18499,17 @@ function MediaOverlay({
|
|
|
18185
18499
|
},
|
|
18186
18500
|
children: [
|
|
18187
18501
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18188
|
-
|
|
18502
|
+
replaceLabel
|
|
18189
18503
|
]
|
|
18190
18504
|
}
|
|
18191
18505
|
),
|
|
18192
|
-
replaceMode
|
|
18506
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18193
18507
|
Button,
|
|
18194
18508
|
{
|
|
18195
18509
|
"data-ohw-media-overlay": "",
|
|
18196
18510
|
variant: "outline",
|
|
18197
18511
|
size: "sm",
|
|
18198
|
-
"aria-label":
|
|
18512
|
+
"aria-label": replaceLabel,
|
|
18199
18513
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18200
18514
|
style: {
|
|
18201
18515
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18218,7 +18532,7 @@ function MediaOverlay({
|
|
|
18218
18532
|
},
|
|
18219
18533
|
children: [
|
|
18220
18534
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18221
|
-
replaceMode === "full" ?
|
|
18535
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18222
18536
|
]
|
|
18223
18537
|
}
|
|
18224
18538
|
)
|
|
@@ -18285,7 +18599,7 @@ function CarouselOverlay({
|
|
|
18285
18599
|
}
|
|
18286
18600
|
|
|
18287
18601
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18288
|
-
import { useCallback as useCallback2, useEffect as
|
|
18602
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useRef as useRef4, useState as useState7 } from "react";
|
|
18289
18603
|
import { Check, X } from "lucide-react";
|
|
18290
18604
|
|
|
18291
18605
|
// src/lib/ai-change-highlight.ts
|
|
@@ -18381,7 +18695,7 @@ function readRect(instanceId) {
|
|
|
18381
18695
|
}
|
|
18382
18696
|
function useLiveSectionRect(sectionId) {
|
|
18383
18697
|
const [rect, setRect] = useState7(null);
|
|
18384
|
-
|
|
18698
|
+
useEffect8(() => {
|
|
18385
18699
|
if (!sectionId) {
|
|
18386
18700
|
setRect(null);
|
|
18387
18701
|
return;
|
|
@@ -18421,7 +18735,7 @@ function readNavToggleRect() {
|
|
|
18421
18735
|
}
|
|
18422
18736
|
function useLiveNavToggleHole(active) {
|
|
18423
18737
|
const [rect, setRect] = useState7(null);
|
|
18424
|
-
|
|
18738
|
+
useEffect8(() => {
|
|
18425
18739
|
if (!active) {
|
|
18426
18740
|
setRect(null);
|
|
18427
18741
|
return;
|
|
@@ -18545,7 +18859,7 @@ function AiSectionOverlay({
|
|
|
18545
18859
|
reviewIdRef.current = reviewId;
|
|
18546
18860
|
const selectedIdRef = useRef4(null);
|
|
18547
18861
|
selectedIdRef.current = selectedId;
|
|
18548
|
-
|
|
18862
|
+
useEffect8(() => {
|
|
18549
18863
|
onSelectionChange?.(selectedId);
|
|
18550
18864
|
}, [selectedId, onSelectionChange]);
|
|
18551
18865
|
const report = useCallback2(
|
|
@@ -18571,7 +18885,7 @@ function AiSectionOverlay({
|
|
|
18571
18885
|
},
|
|
18572
18886
|
[report]
|
|
18573
18887
|
);
|
|
18574
|
-
|
|
18888
|
+
useEffect8(() => {
|
|
18575
18889
|
apiRef.current = {
|
|
18576
18890
|
selectFromElement,
|
|
18577
18891
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
@@ -18596,7 +18910,7 @@ function AiSectionOverlay({
|
|
|
18596
18910
|
apiRef.current = null;
|
|
18597
18911
|
};
|
|
18598
18912
|
}, [apiRef, selectFromElement, report]);
|
|
18599
|
-
|
|
18913
|
+
useEffect8(() => {
|
|
18600
18914
|
const onMessage = (e) => {
|
|
18601
18915
|
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
18602
18916
|
selectedIdRef.current = null;
|
|
@@ -18621,9 +18935,9 @@ function AiSectionOverlay({
|
|
|
18621
18935
|
window.addEventListener("message", onMessage);
|
|
18622
18936
|
return () => window.removeEventListener("message", onMessage);
|
|
18623
18937
|
}, [postToParent2]);
|
|
18624
|
-
|
|
18938
|
+
useEffect8(() => installAiChangeHighlight(), []);
|
|
18625
18939
|
const [hoveredId, setHoveredId] = useState7(null);
|
|
18626
|
-
|
|
18940
|
+
useEffect8(() => {
|
|
18627
18941
|
const onMove = (e) => {
|
|
18628
18942
|
const t = e.target;
|
|
18629
18943
|
if (!(t instanceof Element)) return;
|
|
@@ -18648,7 +18962,7 @@ function AiSectionOverlay({
|
|
|
18648
18962
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
18649
18963
|
};
|
|
18650
18964
|
}, []);
|
|
18651
|
-
|
|
18965
|
+
useEffect8(() => {
|
|
18652
18966
|
const onKeyDown = (e) => {
|
|
18653
18967
|
if (e.key !== "Escape") return;
|
|
18654
18968
|
if (reviewIdRef.current) return;
|
|
@@ -18672,7 +18986,7 @@ function AiSectionOverlay({
|
|
|
18672
18986
|
[postToParent2]
|
|
18673
18987
|
);
|
|
18674
18988
|
const [navDropdownForceOpen, setNavDropdownForceOpen] = useState7(false);
|
|
18675
|
-
|
|
18989
|
+
useEffect8(() => {
|
|
18676
18990
|
const update = () => {
|
|
18677
18991
|
setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
|
|
18678
18992
|
};
|
|
@@ -18691,7 +19005,7 @@ function AiSectionOverlay({
|
|
|
18691
19005
|
const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
|
|
18692
19006
|
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
18693
19007
|
const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
|
|
18694
|
-
|
|
19008
|
+
useEffect8(() => {
|
|
18695
19009
|
const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
|
|
18696
19010
|
if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
|
|
18697
19011
|
postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
|
|
@@ -18811,8 +19125,24 @@ function AiSectionOverlay({
|
|
|
18811
19125
|
}
|
|
18812
19126
|
|
|
18813
19127
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18814
|
-
import { useCallback as useCallback3, useEffect as
|
|
18815
|
-
import {
|
|
19128
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
19129
|
+
import {
|
|
19130
|
+
AlignCenter,
|
|
19131
|
+
AlignLeft,
|
|
19132
|
+
AlignRight,
|
|
19133
|
+
ArrowLeft as ArrowLeft2,
|
|
19134
|
+
ArrowRight as ArrowRight2,
|
|
19135
|
+
Check as Check2,
|
|
19136
|
+
ChevronDown as ChevronDown3,
|
|
19137
|
+
Image as ImageIcon2,
|
|
19138
|
+
ImageMinus,
|
|
19139
|
+
ImagePlus,
|
|
19140
|
+
Link as LinkIcon,
|
|
19141
|
+
Minus,
|
|
19142
|
+
Palette,
|
|
19143
|
+
Plus as Plus2,
|
|
19144
|
+
Star
|
|
19145
|
+
} from "lucide-react";
|
|
18816
19146
|
|
|
18817
19147
|
// src/lib/ai-media-strip-tree.ts
|
|
18818
19148
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -18926,14 +19256,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
18926
19256
|
return true;
|
|
18927
19257
|
});
|
|
18928
19258
|
}
|
|
18929
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
18930
|
-
return withMediaStrip(tree, (block) => {
|
|
18931
|
-
const items = block.items;
|
|
18932
|
-
if (index < 0 || index >= items.length) return false;
|
|
18933
|
-
items[index] = { ...items[index], alt };
|
|
18934
|
-
return true;
|
|
18935
|
-
});
|
|
18936
|
-
}
|
|
18937
19259
|
function setMediaStripItemLink(tree, index, link) {
|
|
18938
19260
|
return withMediaStrip(tree, (block) => {
|
|
18939
19261
|
const items = block.items;
|
|
@@ -18951,11 +19273,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
18951
19273
|
});
|
|
18952
19274
|
}
|
|
18953
19275
|
|
|
19276
|
+
// src/ui/dialog.tsx
|
|
19277
|
+
import * as React9 from "react";
|
|
19278
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19279
|
+
import { X as X2 } from "lucide-react";
|
|
19280
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19281
|
+
function Dialog2({
|
|
19282
|
+
...props
|
|
19283
|
+
}) {
|
|
19284
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19285
|
+
}
|
|
19286
|
+
function DialogPortal({
|
|
19287
|
+
...props
|
|
19288
|
+
}) {
|
|
19289
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19290
|
+
}
|
|
19291
|
+
function DialogOverlay({
|
|
19292
|
+
className,
|
|
19293
|
+
...props
|
|
19294
|
+
}) {
|
|
19295
|
+
return /* @__PURE__ */ jsx20(
|
|
19296
|
+
DialogPrimitive.Overlay,
|
|
19297
|
+
{
|
|
19298
|
+
"data-slot": "dialog-overlay",
|
|
19299
|
+
"data-ohw-link-modal-root": "",
|
|
19300
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19301
|
+
...props
|
|
19302
|
+
}
|
|
19303
|
+
);
|
|
19304
|
+
}
|
|
19305
|
+
var DialogContent = React9.forwardRef(
|
|
19306
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19307
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19308
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19309
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19310
|
+
/* @__PURE__ */ jsxs11(
|
|
19311
|
+
DialogPrimitive.Content,
|
|
19312
|
+
{
|
|
19313
|
+
ref,
|
|
19314
|
+
"data-slot": "dialog-content",
|
|
19315
|
+
className: cn(
|
|
19316
|
+
positionMode,
|
|
19317
|
+
"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",
|
|
19318
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19319
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19320
|
+
className
|
|
19321
|
+
),
|
|
19322
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19323
|
+
...props,
|
|
19324
|
+
children: [
|
|
19325
|
+
children,
|
|
19326
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19327
|
+
DialogPrimitive.Close,
|
|
19328
|
+
{
|
|
19329
|
+
type: "button",
|
|
19330
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19331
|
+
"aria-label": "Close",
|
|
19332
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19333
|
+
}
|
|
19334
|
+
) : null
|
|
19335
|
+
]
|
|
19336
|
+
}
|
|
19337
|
+
)
|
|
19338
|
+
] });
|
|
19339
|
+
}
|
|
19340
|
+
);
|
|
19341
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19342
|
+
function DialogHeader({
|
|
19343
|
+
className,
|
|
19344
|
+
...props
|
|
19345
|
+
}) {
|
|
19346
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19347
|
+
}
|
|
19348
|
+
function DialogFooter({
|
|
19349
|
+
className,
|
|
19350
|
+
...props
|
|
19351
|
+
}) {
|
|
19352
|
+
return /* @__PURE__ */ jsx20(
|
|
19353
|
+
"div",
|
|
19354
|
+
{
|
|
19355
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19356
|
+
...props
|
|
19357
|
+
}
|
|
19358
|
+
);
|
|
19359
|
+
}
|
|
19360
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19361
|
+
DialogPrimitive.Title,
|
|
19362
|
+
{
|
|
19363
|
+
ref,
|
|
19364
|
+
className: cn(
|
|
19365
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19366
|
+
className
|
|
19367
|
+
),
|
|
19368
|
+
...props
|
|
19369
|
+
}
|
|
19370
|
+
));
|
|
19371
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19372
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19373
|
+
DialogPrimitive.Description,
|
|
19374
|
+
{
|
|
19375
|
+
ref,
|
|
19376
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19377
|
+
...props
|
|
19378
|
+
}
|
|
19379
|
+
));
|
|
19380
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19381
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19382
|
+
|
|
18954
19383
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18955
|
-
import { Fragment as Fragment7, jsx as
|
|
18956
|
-
var PRIMARY3 = "#0885FE";
|
|
18957
|
-
var
|
|
18958
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19384
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19385
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19386
|
+
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]";
|
|
18959
19387
|
function findMediaStripItemElement(sectionId, index) {
|
|
18960
19388
|
const sectionEl = findByInstanceId(sectionId);
|
|
18961
19389
|
if (!sectionEl) return null;
|
|
@@ -18965,22 +19393,43 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
18965
19393
|
}
|
|
18966
19394
|
return null;
|
|
18967
19395
|
}
|
|
18968
|
-
function
|
|
18969
|
-
|
|
19396
|
+
function itemRefFromTarget(target) {
|
|
19397
|
+
if (!(target instanceof Element)) return null;
|
|
19398
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19399
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19400
|
+
if (!itemEl) return null;
|
|
19401
|
+
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19402
|
+
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19403
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19404
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19405
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19406
|
+
return { sectionId, index };
|
|
19407
|
+
}
|
|
19408
|
+
function sameRef(a, b) {
|
|
19409
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19410
|
+
}
|
|
19411
|
+
function rectOf(el) {
|
|
18970
19412
|
if (!el) return null;
|
|
18971
19413
|
const r2 = el.getBoundingClientRect();
|
|
18972
19414
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
18973
19415
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18974
19416
|
}
|
|
18975
|
-
function
|
|
19417
|
+
function readRect2(ref) {
|
|
19418
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19419
|
+
}
|
|
19420
|
+
function readStripRect(ref) {
|
|
19421
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19422
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19423
|
+
}
|
|
19424
|
+
function useLiveItemRect(ref, strip = false) {
|
|
18976
19425
|
const [rect, setRect] = useState8(null);
|
|
18977
|
-
|
|
19426
|
+
useEffect9(() => {
|
|
18978
19427
|
if (!ref) {
|
|
18979
19428
|
setRect(null);
|
|
18980
19429
|
return;
|
|
18981
19430
|
}
|
|
18982
19431
|
const update = () => {
|
|
18983
|
-
const next = readRect2(ref);
|
|
19432
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
18984
19433
|
setRect(
|
|
18985
19434
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
18986
19435
|
);
|
|
@@ -18995,9 +19444,49 @@ function useLiveItemRect(ref) {
|
|
|
18995
19444
|
window.removeEventListener("resize", update);
|
|
18996
19445
|
clearInterval(interval);
|
|
18997
19446
|
};
|
|
18998
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19447
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
18999
19448
|
return rect;
|
|
19000
19449
|
}
|
|
19450
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19451
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19452
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19453
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19454
|
+
const slotRef = useRef5(null);
|
|
19455
|
+
const [shift, setShift] = useState8(0);
|
|
19456
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19457
|
+
useLayoutEffect4(() => {
|
|
19458
|
+
const slot = slotRef.current;
|
|
19459
|
+
if (!slot) return;
|
|
19460
|
+
const clamp = () => {
|
|
19461
|
+
const w = slot.offsetWidth;
|
|
19462
|
+
if (w <= 0) return;
|
|
19463
|
+
const half = w / 2;
|
|
19464
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19465
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19466
|
+
};
|
|
19467
|
+
clamp();
|
|
19468
|
+
const ro = new ResizeObserver(clamp);
|
|
19469
|
+
ro.observe(slot);
|
|
19470
|
+
return () => ro.disconnect();
|
|
19471
|
+
}, [centerX, children]);
|
|
19472
|
+
const mobile = window.innerWidth <= 480;
|
|
19473
|
+
return /* @__PURE__ */ jsx21(
|
|
19474
|
+
"div",
|
|
19475
|
+
{
|
|
19476
|
+
ref: slotRef,
|
|
19477
|
+
"data-ohw-bridge": "",
|
|
19478
|
+
"data-ohw-item-interaction": "",
|
|
19479
|
+
className: "pointer-events-auto fixed",
|
|
19480
|
+
style: {
|
|
19481
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19482
|
+
left: centerX + shift,
|
|
19483
|
+
transform: "translate(-50%, -100%)",
|
|
19484
|
+
zIndex: 2147483645
|
|
19485
|
+
},
|
|
19486
|
+
children
|
|
19487
|
+
}
|
|
19488
|
+
);
|
|
19489
|
+
}
|
|
19001
19490
|
function requestValidateTree(postToParent2, tree) {
|
|
19002
19491
|
return new Promise((resolve) => {
|
|
19003
19492
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19034,116 +19523,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19034
19523
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19035
19524
|
});
|
|
19036
19525
|
}
|
|
19037
|
-
function
|
|
19526
|
+
function ToolbarAction({
|
|
19038
19527
|
label,
|
|
19039
19528
|
onClick,
|
|
19040
|
-
disabled,
|
|
19041
|
-
active
|
|
19529
|
+
disabled = false,
|
|
19530
|
+
active = false,
|
|
19531
|
+
children
|
|
19042
19532
|
}) {
|
|
19043
|
-
|
|
19044
|
-
|
|
19045
|
-
{
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
disabled,
|
|
19049
|
-
style: {
|
|
19050
|
-
height: 28,
|
|
19051
|
-
padding: "0 10px",
|
|
19052
|
-
display: "inline-flex",
|
|
19053
|
-
alignItems: "center",
|
|
19054
|
-
gap: 4,
|
|
19055
|
-
borderRadius: 999,
|
|
19056
|
-
border: "none",
|
|
19057
|
-
cursor: disabled ? "default" : "pointer",
|
|
19058
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19059
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19060
|
-
opacity: disabled ? 0.4 : 1,
|
|
19061
|
-
fontSize: 12,
|
|
19062
|
-
lineHeight: "16px",
|
|
19063
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19064
|
-
whiteSpace: "nowrap",
|
|
19065
|
-
flex: "0 0 auto"
|
|
19066
|
-
},
|
|
19067
|
-
children: label
|
|
19068
|
-
}
|
|
19069
|
-
);
|
|
19533
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19534
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19535
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19536
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19537
|
+
] });
|
|
19070
19538
|
}
|
|
19071
|
-
function
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
},
|
|
19101
|
-
children: "Alt"
|
|
19102
|
-
}
|
|
19103
|
-
),
|
|
19104
|
-
/* @__PURE__ */ jsx20(
|
|
19105
|
-
"input",
|
|
19539
|
+
function ToolbarSeparator() {
|
|
19540
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19541
|
+
}
|
|
19542
|
+
function OptionMenu({
|
|
19543
|
+
label,
|
|
19544
|
+
value,
|
|
19545
|
+
options,
|
|
19546
|
+
onChange
|
|
19547
|
+
}) {
|
|
19548
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19549
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19550
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19551
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19552
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19553
|
+
"button",
|
|
19554
|
+
{
|
|
19555
|
+
type: "button",
|
|
19556
|
+
"aria-label": label,
|
|
19557
|
+
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",
|
|
19558
|
+
children: [
|
|
19559
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19560
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19561
|
+
]
|
|
19562
|
+
}
|
|
19563
|
+
) }),
|
|
19564
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19565
|
+
const selected = option.value === value;
|
|
19566
|
+
return /* @__PURE__ */ jsxs12(
|
|
19567
|
+
DropdownMenuItem,
|
|
19106
19568
|
{
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
"aria-label": "Image alt text",
|
|
19122
|
-
style: {
|
|
19123
|
-
flex: 1,
|
|
19124
|
-
minWidth: 0,
|
|
19125
|
-
border: "none",
|
|
19126
|
-
outline: "none",
|
|
19127
|
-
background: "transparent",
|
|
19128
|
-
fontSize: 12,
|
|
19129
|
-
lineHeight: "16px",
|
|
19130
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19131
|
-
color: "#1f2937"
|
|
19132
|
-
}
|
|
19133
|
-
}
|
|
19134
|
-
)
|
|
19135
|
-
]
|
|
19136
|
-
}
|
|
19137
|
-
);
|
|
19569
|
+
role: "menuitemradio",
|
|
19570
|
+
"aria-checked": selected,
|
|
19571
|
+
onSelect: () => onChange(option.value),
|
|
19572
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19573
|
+
children: [
|
|
19574
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19575
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19576
|
+
]
|
|
19577
|
+
},
|
|
19578
|
+
option.value
|
|
19579
|
+
);
|
|
19580
|
+
}) })
|
|
19581
|
+
] })
|
|
19582
|
+
] });
|
|
19138
19583
|
}
|
|
19139
19584
|
var VARIANTS = [
|
|
19140
19585
|
{ value: "logos", label: "Logos" },
|
|
19141
19586
|
{ value: "reel", label: "Reel" }
|
|
19142
19587
|
];
|
|
19143
19588
|
var ALIGNS = [
|
|
19144
|
-
{ value: "left", label: "
|
|
19145
|
-
{ value: "center", label: "
|
|
19146
|
-
{ value: "right", label: "
|
|
19589
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19590
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19591
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19147
19592
|
];
|
|
19148
19593
|
var HOVERS = [
|
|
19149
19594
|
{ value: "none", label: "None" },
|
|
@@ -19151,104 +19596,104 @@ var HOVERS = [
|
|
|
19151
19596
|
{ value: "zoom", label: "Zoom" },
|
|
19152
19597
|
{ value: "fade", label: "Fade" }
|
|
19153
19598
|
];
|
|
19154
|
-
var TREATMENTS = [
|
|
19155
|
-
{ value: "color", label: "Color" },
|
|
19156
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19157
|
-
];
|
|
19158
19599
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19159
|
-
function
|
|
19160
|
-
|
|
19600
|
+
function LinkModal({
|
|
19601
|
+
href,
|
|
19602
|
+
linkTarget,
|
|
19603
|
+
onClose,
|
|
19604
|
+
onSave
|
|
19605
|
+
}) {
|
|
19606
|
+
const [draft, setDraft] = useState8(href);
|
|
19607
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19161
19608
|
const [invalid, setInvalid] = useState8(false);
|
|
19162
|
-
|
|
19163
|
-
setDraft(value);
|
|
19164
|
-
setInvalid(false);
|
|
19165
|
-
}, [value]);
|
|
19166
|
-
const commit2 = () => {
|
|
19609
|
+
const save = () => {
|
|
19167
19610
|
const next = draft.trim();
|
|
19168
|
-
if (next
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
onCommit(next);
|
|
19172
|
-
};
|
|
19173
|
-
return /* @__PURE__ */ jsxs11(
|
|
19174
|
-
"div",
|
|
19175
|
-
{
|
|
19176
|
-
style: {
|
|
19177
|
-
display: "flex",
|
|
19178
|
-
alignItems: "center",
|
|
19179
|
-
gap: 6,
|
|
19180
|
-
height: 28,
|
|
19181
|
-
padding: "0 12px",
|
|
19182
|
-
borderRadius: 999,
|
|
19183
|
-
background: "#ffffff",
|
|
19184
|
-
width: "100%",
|
|
19185
|
-
maxWidth: 260,
|
|
19186
|
-
boxSizing: "border-box",
|
|
19187
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19188
|
-
},
|
|
19189
|
-
children: [
|
|
19190
|
-
/* @__PURE__ */ jsx20(
|
|
19191
|
-
"span",
|
|
19192
|
-
{
|
|
19193
|
-
style: {
|
|
19194
|
-
flex: "0 0 auto",
|
|
19195
|
-
color: OHW_BLUE_DARK,
|
|
19196
|
-
fontSize: 10,
|
|
19197
|
-
fontWeight: 700,
|
|
19198
|
-
textTransform: "uppercase",
|
|
19199
|
-
letterSpacing: 0.4
|
|
19200
|
-
},
|
|
19201
|
-
children: "Link"
|
|
19202
|
-
}
|
|
19203
|
-
),
|
|
19204
|
-
/* @__PURE__ */ jsx20(
|
|
19205
|
-
"input",
|
|
19206
|
-
{
|
|
19207
|
-
type: "text",
|
|
19208
|
-
inputMode: "url",
|
|
19209
|
-
value: draft,
|
|
19210
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19211
|
-
onBlur: commit2,
|
|
19212
|
-
onKeyDown: (e) => {
|
|
19213
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19214
|
-
if (e.key === "Escape") {
|
|
19215
|
-
setDraft(value);
|
|
19216
|
-
setInvalid(false);
|
|
19217
|
-
e.currentTarget.blur();
|
|
19218
|
-
}
|
|
19219
|
-
},
|
|
19220
|
-
placeholder: "https://example.com",
|
|
19221
|
-
"aria-label": "Image link URL",
|
|
19222
|
-
"aria-invalid": invalid,
|
|
19223
|
-
style: {
|
|
19224
|
-
flex: 1,
|
|
19225
|
-
minWidth: 0,
|
|
19226
|
-
border: "none",
|
|
19227
|
-
outline: "none",
|
|
19228
|
-
background: "transparent",
|
|
19229
|
-
fontSize: 12,
|
|
19230
|
-
lineHeight: "16px",
|
|
19231
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19232
|
-
color: "#1f2937"
|
|
19233
|
-
}
|
|
19234
|
-
}
|
|
19235
|
-
)
|
|
19236
|
-
]
|
|
19611
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19612
|
+
setInvalid(true);
|
|
19613
|
+
return;
|
|
19237
19614
|
}
|
|
19238
|
-
|
|
19615
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19616
|
+
onClose();
|
|
19617
|
+
};
|
|
19618
|
+
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: [
|
|
19619
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19620
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
19621
|
+
/* @__PURE__ */ jsx21(
|
|
19622
|
+
"input",
|
|
19623
|
+
{
|
|
19624
|
+
autoFocus: true,
|
|
19625
|
+
type: "text",
|
|
19626
|
+
inputMode: "url",
|
|
19627
|
+
value: draft,
|
|
19628
|
+
onChange: (e) => {
|
|
19629
|
+
setDraft(e.target.value);
|
|
19630
|
+
setInvalid(false);
|
|
19631
|
+
},
|
|
19632
|
+
onKeyDown: (e) => {
|
|
19633
|
+
if (e.key === "Enter") save();
|
|
19634
|
+
},
|
|
19635
|
+
placeholder: "https://example.com",
|
|
19636
|
+
"aria-label": "Image link URL",
|
|
19637
|
+
"aria-invalid": invalid,
|
|
19638
|
+
className: cn(
|
|
19639
|
+
"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",
|
|
19640
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19641
|
+
)
|
|
19642
|
+
}
|
|
19643
|
+
),
|
|
19644
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19645
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19646
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19647
|
+
"Open in new tab"
|
|
19648
|
+
] })
|
|
19649
|
+
] }),
|
|
19650
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
19651
|
+
href && /* @__PURE__ */ jsx21(
|
|
19652
|
+
"button",
|
|
19653
|
+
{
|
|
19654
|
+
type: "button",
|
|
19655
|
+
onClick: () => {
|
|
19656
|
+
onSave("", "new-tab");
|
|
19657
|
+
onClose();
|
|
19658
|
+
},
|
|
19659
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19660
|
+
children: "Remove link"
|
|
19661
|
+
}
|
|
19662
|
+
),
|
|
19663
|
+
/* @__PURE__ */ jsx21(
|
|
19664
|
+
"button",
|
|
19665
|
+
{
|
|
19666
|
+
type: "button",
|
|
19667
|
+
onClick: onClose,
|
|
19668
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19669
|
+
children: "Cancel"
|
|
19670
|
+
}
|
|
19671
|
+
),
|
|
19672
|
+
/* @__PURE__ */ jsx21(
|
|
19673
|
+
"button",
|
|
19674
|
+
{
|
|
19675
|
+
type: "button",
|
|
19676
|
+
onClick: save,
|
|
19677
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19678
|
+
children: "Save"
|
|
19679
|
+
}
|
|
19680
|
+
)
|
|
19681
|
+
] })
|
|
19682
|
+
] }) });
|
|
19239
19683
|
}
|
|
19240
19684
|
function MediaStripToolbar({
|
|
19241
19685
|
entry,
|
|
19242
19686
|
index,
|
|
19243
19687
|
pending,
|
|
19244
19688
|
error,
|
|
19689
|
+
itemEditOn,
|
|
19690
|
+
onToggleItemEdit,
|
|
19245
19691
|
onSetVariant,
|
|
19246
19692
|
onSetAlign,
|
|
19247
19693
|
onSetHover,
|
|
19248
19694
|
onSetTreatment,
|
|
19249
19695
|
onResize,
|
|
19250
|
-
|
|
19251
|
-
onSetLink,
|
|
19696
|
+
onOpenLink,
|
|
19252
19697
|
onAddItem,
|
|
19253
19698
|
onRemoveItem,
|
|
19254
19699
|
onChangeImage,
|
|
@@ -19257,81 +19702,102 @@ function MediaStripToolbar({
|
|
|
19257
19702
|
}) {
|
|
19258
19703
|
const items = mediaStripItems(entry.tree);
|
|
19259
19704
|
const itemCount = items.length;
|
|
19260
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19261
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
19262
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19263
19705
|
const slots = findMediaStripSlots(entry.tree);
|
|
19264
19706
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19265
19707
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19266
19708
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19267
19709
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19268
19710
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19269
|
-
const
|
|
19270
|
-
const
|
|
19271
|
-
|
|
19272
|
-
gap: 6,
|
|
19273
|
-
flexWrap: "nowrap",
|
|
19274
|
-
justifyContent: "center",
|
|
19275
|
-
overflowX: "auto",
|
|
19276
|
-
WebkitOverflowScrolling: "touch",
|
|
19277
|
-
width: "100%",
|
|
19278
|
-
scrollbarWidth: "none"
|
|
19279
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19280
|
-
return /* @__PURE__ */ jsxs11(
|
|
19711
|
+
const mobile = window.innerWidth <= 480;
|
|
19712
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19713
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19281
19714
|
"div",
|
|
19282
19715
|
{
|
|
19283
19716
|
"data-ohw-bridge": "",
|
|
19284
19717
|
"data-ohw-toolbar": "",
|
|
19285
19718
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19286
|
-
|
|
19287
|
-
|
|
19288
|
-
flexDirection: "column",
|
|
19289
|
-
gap: 6,
|
|
19290
|
-
alignItems: "center",
|
|
19291
|
-
background: OHW_BLUE,
|
|
19292
|
-
padding: 8,
|
|
19293
|
-
borderRadius: 12,
|
|
19294
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19295
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19296
|
-
opacity: pending ? 0.6 : 1,
|
|
19297
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19298
|
-
},
|
|
19719
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19720
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19299
19721
|
children: [
|
|
19300
|
-
/* @__PURE__ */
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19722
|
+
/* @__PURE__ */ jsxs12(
|
|
19723
|
+
"div",
|
|
19724
|
+
{
|
|
19725
|
+
className: cn(
|
|
19726
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19727
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19728
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19729
|
+
),
|
|
19730
|
+
children: [
|
|
19731
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19732
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
19733
|
+
CustomToolbarButton,
|
|
19734
|
+
{
|
|
19735
|
+
type: "button",
|
|
19736
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19737
|
+
"aria-pressed": itemEditOn,
|
|
19738
|
+
onClick: onToggleItemEdit,
|
|
19739
|
+
className: "group size-8",
|
|
19740
|
+
children: /* @__PURE__ */ jsx21(
|
|
19741
|
+
Star,
|
|
19742
|
+
{
|
|
19743
|
+
size: 16,
|
|
19744
|
+
fill: "currentColor",
|
|
19745
|
+
strokeWidth: 0,
|
|
19746
|
+
className: cn(
|
|
19747
|
+
"transition-colors",
|
|
19748
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19749
|
+
),
|
|
19750
|
+
style: { pointerEvents: "none" }
|
|
19751
|
+
}
|
|
19752
|
+
)
|
|
19753
|
+
}
|
|
19754
|
+
) }),
|
|
19755
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19756
|
+
] }),
|
|
19757
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19758
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19759
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19760
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19761
|
+
/* @__PURE__ */ jsx21(
|
|
19762
|
+
ToolbarAction,
|
|
19763
|
+
{
|
|
19764
|
+
label: gatedLabel("Move right"),
|
|
19765
|
+
onClick: onMoveRight,
|
|
19766
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19767
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
19768
|
+
}
|
|
19769
|
+
),
|
|
19770
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19771
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19772
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19773
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19774
|
+
/* @__PURE__ */ jsx21(
|
|
19775
|
+
ToolbarAction,
|
|
19776
|
+
{
|
|
19777
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19778
|
+
active: treatment === "grayscale",
|
|
19779
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19780
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19781
|
+
}
|
|
19782
|
+
),
|
|
19783
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19784
|
+
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)),
|
|
19785
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19786
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19787
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19788
|
+
sizeValue,
|
|
19789
|
+
"px"
|
|
19790
|
+
] }),
|
|
19791
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19792
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19793
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19794
|
+
]
|
|
19795
|
+
}
|
|
19796
|
+
),
|
|
19797
|
+
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 })
|
|
19332
19798
|
]
|
|
19333
19799
|
}
|
|
19334
|
-
);
|
|
19800
|
+
) });
|
|
19335
19801
|
}
|
|
19336
19802
|
function findMediaStripSlots(tree) {
|
|
19337
19803
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19350,31 +19816,23 @@ function AiMediaStripOverlay({
|
|
|
19350
19816
|
}) {
|
|
19351
19817
|
const [hover, setHover] = useState8(null);
|
|
19352
19818
|
const [active, setActive] = useState8(null);
|
|
19819
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
19820
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19353
19821
|
const [pending, setPending] = useState8(false);
|
|
19354
19822
|
const [error, setError] = useState8(null);
|
|
19355
19823
|
const activeRef = useRef5(null);
|
|
19356
19824
|
activeRef.current = active;
|
|
19357
|
-
|
|
19825
|
+
const linkOpenRef = useRef5(false);
|
|
19826
|
+
linkOpenRef.current = linkOpen;
|
|
19827
|
+
useEffect9(() => {
|
|
19358
19828
|
const onMove = (e) => {
|
|
19829
|
+
const ref = itemRefFromTarget(e.target);
|
|
19359
19830
|
const t = e.target;
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
if (!itemEl) {
|
|
19366
|
-
setHover(null);
|
|
19367
|
-
return;
|
|
19368
|
-
}
|
|
19369
|
-
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19370
|
-
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19371
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19372
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19373
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19374
|
-
setHover(null);
|
|
19375
|
-
return;
|
|
19376
|
-
}
|
|
19377
|
-
setHover({ sectionId, index });
|
|
19831
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19832
|
+
setHover((prev) => {
|
|
19833
|
+
const next = ref && !overEditable ? ref : null;
|
|
19834
|
+
return sameRef(prev, next) ? prev : next;
|
|
19835
|
+
});
|
|
19378
19836
|
};
|
|
19379
19837
|
const onLeave = () => setHover(null);
|
|
19380
19838
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19384,35 +19842,40 @@ function AiMediaStripOverlay({
|
|
|
19384
19842
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19385
19843
|
};
|
|
19386
19844
|
}, []);
|
|
19387
|
-
|
|
19845
|
+
useEffect9(() => {
|
|
19388
19846
|
const onClick = (e) => {
|
|
19389
|
-
const current = activeRef.current;
|
|
19390
|
-
if (!current) return;
|
|
19391
19847
|
const t = e.target;
|
|
19392
|
-
if (!(t instanceof
|
|
19393
|
-
if (t.closest(
|
|
19394
|
-
const
|
|
19395
|
-
if (
|
|
19396
|
-
|
|
19848
|
+
if (!(t instanceof Element)) return;
|
|
19849
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19850
|
+
const ref = itemRefFromTarget(t);
|
|
19851
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19852
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19853
|
+
setItemEditOn(false);
|
|
19397
19854
|
setError(null);
|
|
19855
|
+
setActive(ref);
|
|
19398
19856
|
};
|
|
19399
19857
|
document.addEventListener("click", onClick, true);
|
|
19400
19858
|
return () => document.removeEventListener("click", onClick, true);
|
|
19401
|
-
}, []);
|
|
19402
|
-
|
|
19859
|
+
}, [clearInteractionChromeRef]);
|
|
19860
|
+
useEffect9(() => {
|
|
19403
19861
|
const onBlur = () => {
|
|
19404
19862
|
if (!activeRef.current) return;
|
|
19405
19863
|
setActive(null);
|
|
19864
|
+
setItemEditOn(false);
|
|
19865
|
+
setLinkOpen(false);
|
|
19406
19866
|
setError(null);
|
|
19407
19867
|
};
|
|
19408
19868
|
window.addEventListener("blur", onBlur);
|
|
19409
19869
|
return () => window.removeEventListener("blur", onBlur);
|
|
19410
19870
|
}, []);
|
|
19411
|
-
|
|
19871
|
+
useEffect9(() => {
|
|
19412
19872
|
const onKeyDown = (e) => {
|
|
19413
19873
|
if (e.key !== "Escape") return;
|
|
19414
19874
|
if (!activeRef.current) return;
|
|
19875
|
+
if (linkOpenRef.current) return;
|
|
19876
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19415
19877
|
setActive(null);
|
|
19878
|
+
setItemEditOn(false);
|
|
19416
19879
|
setError(null);
|
|
19417
19880
|
};
|
|
19418
19881
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19446,137 +19909,133 @@ function AiMediaStripOverlay({
|
|
|
19446
19909
|
tree: nextTree,
|
|
19447
19910
|
label: entry.label,
|
|
19448
19911
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19449
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19912
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
19913
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19914
|
+
// on every edit reads as the section jumping around.
|
|
19915
|
+
skipScrollIntoView: true
|
|
19450
19916
|
});
|
|
19451
19917
|
return true;
|
|
19452
19918
|
},
|
|
19453
19919
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19454
19920
|
);
|
|
19455
19921
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19456
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19457
19922
|
const activeItemRect = useLiveItemRect(active);
|
|
19458
|
-
const
|
|
19459
|
-
const
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19493
|
-
ItemInteractionLayer,
|
|
19494
|
-
{
|
|
19495
|
-
rect: activeItemRect,
|
|
19496
|
-
state: toolbarState,
|
|
19497
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19498
|
-
MediaStripToolbar,
|
|
19499
|
-
{
|
|
19500
|
-
entry: activeEntry,
|
|
19501
|
-
index: active.index,
|
|
19502
|
-
pending,
|
|
19503
|
-
error,
|
|
19504
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19505
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19506
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19507
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19508
|
-
onResize: (delta) => {
|
|
19509
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19510
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19511
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19512
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19513
|
-
},
|
|
19514
|
-
onSetAlt: (alt) => {
|
|
19515
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19516
|
-
},
|
|
19517
|
-
onSetLink: (href, linkTarget) => {
|
|
19923
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
19924
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
19925
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
19926
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
19927
|
+
const activeHref = activeItem?.href ?? "";
|
|
19928
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19929
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19930
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
19931
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19932
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
19933
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
19934
|
+
MediaStripToolbar,
|
|
19935
|
+
{
|
|
19936
|
+
entry: activeEntry,
|
|
19937
|
+
index: active.index,
|
|
19938
|
+
pending,
|
|
19939
|
+
error,
|
|
19940
|
+
itemEditOn,
|
|
19941
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
19942
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19943
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19944
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19945
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19946
|
+
onResize: (delta) => {
|
|
19947
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19948
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19949
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19950
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19951
|
+
},
|
|
19952
|
+
onOpenLink: () => setLinkOpen(true),
|
|
19953
|
+
onAddItem: () => {
|
|
19954
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19955
|
+
if (!picked) return;
|
|
19956
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19518
19957
|
void runMutation(
|
|
19519
19958
|
active.sectionId,
|
|
19520
|
-
(tree) =>
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19525
|
-
if (!picked) return;
|
|
19526
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19527
|
-
void runMutation(
|
|
19528
|
-
active.sectionId,
|
|
19529
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19530
|
-
{ [picked.assetId]: picked.url }
|
|
19531
|
-
).then((applied) => {
|
|
19532
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19533
|
-
});
|
|
19534
|
-
});
|
|
19535
|
-
},
|
|
19536
|
-
onChangeImage: () => {
|
|
19537
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19538
|
-
if (!picked) return;
|
|
19539
|
-
void runMutation(
|
|
19540
|
-
active.sectionId,
|
|
19541
|
-
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19542
|
-
{ [picked.assetId]: picked.url }
|
|
19543
|
-
);
|
|
19959
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19960
|
+
{ [picked.assetId]: picked.url }
|
|
19961
|
+
).then((applied) => {
|
|
19962
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19544
19963
|
});
|
|
19545
|
-
}
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
|
|
19549
|
-
|
|
19550
|
-
|
|
19551
|
-
|
|
19552
|
-
|
|
19553
|
-
|
|
19554
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19555
|
-
(applied) => {
|
|
19556
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19557
|
-
}
|
|
19558
|
-
);
|
|
19559
|
-
},
|
|
19560
|
-
onMoveRight: () => {
|
|
19561
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19562
|
-
(applied) => {
|
|
19563
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19564
|
-
}
|
|
19964
|
+
});
|
|
19965
|
+
},
|
|
19966
|
+
onChangeImage: () => {
|
|
19967
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19968
|
+
if (!picked) return;
|
|
19969
|
+
void runMutation(
|
|
19970
|
+
active.sectionId,
|
|
19971
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19972
|
+
{ [picked.assetId]: picked.url }
|
|
19565
19973
|
);
|
|
19566
|
-
}
|
|
19974
|
+
});
|
|
19975
|
+
},
|
|
19976
|
+
onRemoveItem: () => {
|
|
19977
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19978
|
+
(applied) => {
|
|
19979
|
+
if (applied) setActive(null);
|
|
19980
|
+
}
|
|
19981
|
+
);
|
|
19982
|
+
},
|
|
19983
|
+
onMoveLeft: () => {
|
|
19984
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19985
|
+
(applied) => {
|
|
19986
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19987
|
+
}
|
|
19988
|
+
);
|
|
19989
|
+
},
|
|
19990
|
+
onMoveRight: () => {
|
|
19991
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19992
|
+
(applied) => {
|
|
19993
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19994
|
+
}
|
|
19995
|
+
);
|
|
19567
19996
|
}
|
|
19568
|
-
|
|
19569
|
-
}
|
|
19570
|
-
|
|
19997
|
+
}
|
|
19998
|
+
) }),
|
|
19999
|
+
/* @__PURE__ */ jsx21(
|
|
20000
|
+
"div",
|
|
20001
|
+
{
|
|
20002
|
+
"data-ohw-bridge": "",
|
|
20003
|
+
"data-ohw-item-interaction": "",
|
|
20004
|
+
"aria-hidden": true,
|
|
20005
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
20006
|
+
style: {
|
|
20007
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
20008
|
+
left: activeItemRect.left - 5,
|
|
20009
|
+
background: PRIMARY3,
|
|
20010
|
+
zIndex: 2147483644
|
|
20011
|
+
},
|
|
20012
|
+
children: "Media item"
|
|
20013
|
+
}
|
|
20014
|
+
),
|
|
20015
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
20016
|
+
LinkModal,
|
|
20017
|
+
{
|
|
20018
|
+
href: activeHref,
|
|
20019
|
+
linkTarget: activeTarget,
|
|
20020
|
+
onClose: () => setLinkOpen(false),
|
|
20021
|
+
onSave: (href, linkTarget) => {
|
|
20022
|
+
void runMutation(
|
|
20023
|
+
active.sectionId,
|
|
20024
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
20025
|
+
);
|
|
20026
|
+
}
|
|
20027
|
+
}
|
|
20028
|
+
)
|
|
20029
|
+
] })
|
|
19571
20030
|
] });
|
|
19572
20031
|
}
|
|
19573
20032
|
|
|
19574
20033
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19575
|
-
import { useCallback as useCallback4, useEffect as
|
|
19576
|
-
import { Check as
|
|
19577
|
-
import { Fragment as Fragment8, jsx as
|
|
20034
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
20035
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
20036
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19578
20037
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19579
|
-
var
|
|
20038
|
+
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]";
|
|
19580
20039
|
function findPricingCardElement(sectionId, index) {
|
|
19581
20040
|
const sectionEl = findByInstanceId(sectionId);
|
|
19582
20041
|
if (!sectionEl) return null;
|
|
@@ -19588,7 +20047,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19588
20047
|
}
|
|
19589
20048
|
function cardRefFromTarget(target) {
|
|
19590
20049
|
if (!(target instanceof Element)) return null;
|
|
19591
|
-
if (target.closest(
|
|
20050
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19592
20051
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19593
20052
|
if (!cardEl) return null;
|
|
19594
20053
|
const sectionEl = cardEl.closest("[data-ohw-section]");
|
|
@@ -19598,25 +20057,25 @@ function cardRefFromTarget(target) {
|
|
|
19598
20057
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19599
20058
|
return { sectionId, index };
|
|
19600
20059
|
}
|
|
19601
|
-
function
|
|
20060
|
+
function sameRef2(a, b) {
|
|
19602
20061
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19603
20062
|
}
|
|
19604
|
-
function
|
|
20063
|
+
function rectOf2(el) {
|
|
19605
20064
|
if (!el) return null;
|
|
19606
20065
|
const r2 = el.getBoundingClientRect();
|
|
19607
20066
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19608
20067
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19609
20068
|
}
|
|
19610
20069
|
function readRect3(ref) {
|
|
19611
|
-
return
|
|
20070
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19612
20071
|
}
|
|
19613
20072
|
function readGridRect(ref) {
|
|
19614
20073
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19615
|
-
return
|
|
20074
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19616
20075
|
}
|
|
19617
20076
|
function useLiveCardRect(ref, grid = false) {
|
|
19618
20077
|
const [rect, setRect] = useState9(null);
|
|
19619
|
-
|
|
20078
|
+
useEffect10(() => {
|
|
19620
20079
|
if (!ref) {
|
|
19621
20080
|
setRect(null);
|
|
19622
20081
|
return;
|
|
@@ -19642,19 +20101,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19642
20101
|
}
|
|
19643
20102
|
var TOOLBAR_GRID_GAP = 52;
|
|
19644
20103
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19645
|
-
var
|
|
20104
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19646
20105
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19647
20106
|
const slotRef = useRef6(null);
|
|
19648
20107
|
const [shift, setShift] = useState9(0);
|
|
19649
20108
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19650
|
-
|
|
20109
|
+
useLayoutEffect5(() => {
|
|
19651
20110
|
const slot = slotRef.current;
|
|
19652
20111
|
if (!slot) return;
|
|
19653
20112
|
const clamp = () => {
|
|
19654
20113
|
const w = slot.offsetWidth;
|
|
19655
20114
|
if (w <= 0) return;
|
|
19656
20115
|
const half = w / 2;
|
|
19657
|
-
const clamped = Math.max(
|
|
20116
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19658
20117
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19659
20118
|
};
|
|
19660
20119
|
clamp();
|
|
@@ -19663,7 +20122,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19663
20122
|
return () => ro.disconnect();
|
|
19664
20123
|
}, [centerX, children]);
|
|
19665
20124
|
const mobile = window.innerWidth <= 480;
|
|
19666
|
-
return /* @__PURE__ */
|
|
20125
|
+
return /* @__PURE__ */ jsx22(
|
|
19667
20126
|
"div",
|
|
19668
20127
|
{
|
|
19669
20128
|
ref: slotRef,
|
|
@@ -19698,7 +20157,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19698
20157
|
});
|
|
19699
20158
|
}
|
|
19700
20159
|
function StyleSwatch({ style }) {
|
|
19701
|
-
return /* @__PURE__ */
|
|
20160
|
+
return /* @__PURE__ */ jsx22(
|
|
19702
20161
|
"span",
|
|
19703
20162
|
{
|
|
19704
20163
|
"aria-hidden": true,
|
|
@@ -19712,35 +20171,35 @@ function StyleSwatch({ style }) {
|
|
|
19712
20171
|
);
|
|
19713
20172
|
}
|
|
19714
20173
|
function ButtonGlyph() {
|
|
19715
|
-
return /* @__PURE__ */
|
|
19716
|
-
/* @__PURE__ */
|
|
19717
|
-
/* @__PURE__ */
|
|
20174
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20175
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20176
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19718
20177
|
] });
|
|
19719
20178
|
}
|
|
19720
20179
|
function FeatureGlyph({ mode }) {
|
|
19721
|
-
return /* @__PURE__ */
|
|
19722
|
-
/* @__PURE__ */
|
|
19723
|
-
/* @__PURE__ */
|
|
19724
|
-
/* @__PURE__ */
|
|
19725
|
-
/* @__PURE__ */
|
|
19726
|
-
/* @__PURE__ */
|
|
19727
|
-
mode === "add" && /* @__PURE__ */
|
|
20180
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20181
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20182
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20183
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20184
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20185
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20186
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19728
20187
|
] });
|
|
19729
20188
|
}
|
|
19730
|
-
function
|
|
20189
|
+
function ToolbarAction2({
|
|
19731
20190
|
label,
|
|
19732
20191
|
onClick,
|
|
19733
20192
|
disabled = false,
|
|
19734
20193
|
children
|
|
19735
20194
|
}) {
|
|
19736
|
-
const button = /* @__PURE__ */
|
|
19737
|
-
return /* @__PURE__ */
|
|
19738
|
-
/* @__PURE__ */
|
|
19739
|
-
/* @__PURE__ */
|
|
20195
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20196
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20197
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20198
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19740
20199
|
] });
|
|
19741
20200
|
}
|
|
19742
|
-
function
|
|
19743
|
-
return /* @__PURE__ */
|
|
20201
|
+
function ToolbarSeparator2() {
|
|
20202
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19744
20203
|
}
|
|
19745
20204
|
function CardStyleMenu({
|
|
19746
20205
|
value,
|
|
@@ -19748,7 +20207,7 @@ function CardStyleMenu({
|
|
|
19748
20207
|
disabled = false
|
|
19749
20208
|
}) {
|
|
19750
20209
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19751
|
-
const trigger = /* @__PURE__ */
|
|
20210
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
19752
20211
|
"button",
|
|
19753
20212
|
{
|
|
19754
20213
|
type: "button",
|
|
@@ -19759,28 +20218,28 @@ function CardStyleMenu({
|
|
|
19759
20218
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19760
20219
|
),
|
|
19761
20220
|
children: [
|
|
19762
|
-
/* @__PURE__ */
|
|
19763
|
-
/* @__PURE__ */
|
|
19764
|
-
/* @__PURE__ */
|
|
20221
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20222
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20223
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
19765
20224
|
]
|
|
19766
20225
|
}
|
|
19767
20226
|
);
|
|
19768
20227
|
if (disabled) {
|
|
19769
|
-
return /* @__PURE__ */
|
|
19770
|
-
/* @__PURE__ */
|
|
19771
|
-
/* @__PURE__ */
|
|
19772
|
-
/* @__PURE__ */
|
|
19773
|
-
/* @__PURE__ */
|
|
20228
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20229
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20230
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20231
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20232
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19774
20233
|
] })
|
|
19775
20234
|
] });
|
|
19776
20235
|
}
|
|
19777
|
-
return /* @__PURE__ */
|
|
19778
|
-
/* @__PURE__ */
|
|
19779
|
-
/* @__PURE__ */
|
|
19780
|
-
/* @__PURE__ */
|
|
19781
|
-
/* @__PURE__ */
|
|
20236
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20237
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20238
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20239
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20240
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19782
20241
|
const selected = style.value === value;
|
|
19783
|
-
return /* @__PURE__ */
|
|
20242
|
+
return /* @__PURE__ */ jsxs13(
|
|
19784
20243
|
DropdownMenuItem,
|
|
19785
20244
|
{
|
|
19786
20245
|
role: "menuitemradio",
|
|
@@ -19788,9 +20247,9 @@ function CardStyleMenu({
|
|
|
19788
20247
|
onSelect: () => onChange(style.value),
|
|
19789
20248
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19790
20249
|
children: [
|
|
19791
|
-
/* @__PURE__ */
|
|
19792
|
-
/* @__PURE__ */
|
|
19793
|
-
selected && /* @__PURE__ */
|
|
20250
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20251
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20252
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
19794
20253
|
]
|
|
19795
20254
|
},
|
|
19796
20255
|
style.value
|
|
@@ -19820,7 +20279,7 @@ function PricingCardToolbar({
|
|
|
19820
20279
|
const style = pricingCardStyle(entry.tree, index);
|
|
19821
20280
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19822
20281
|
const mobile = window.innerWidth <= 480;
|
|
19823
|
-
return /* @__PURE__ */
|
|
20282
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
19824
20283
|
"div",
|
|
19825
20284
|
{
|
|
19826
20285
|
"data-ohw-bridge": "",
|
|
@@ -19832,7 +20291,7 @@ function PricingCardToolbar({
|
|
|
19832
20291
|
),
|
|
19833
20292
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19834
20293
|
children: [
|
|
19835
|
-
/* @__PURE__ */
|
|
20294
|
+
/* @__PURE__ */ jsxs13(
|
|
19836
20295
|
"div",
|
|
19837
20296
|
{
|
|
19838
20297
|
className: cn(
|
|
@@ -19841,8 +20300,8 @@ function PricingCardToolbar({
|
|
|
19841
20300
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19842
20301
|
),
|
|
19843
20302
|
children: [
|
|
19844
|
-
/* @__PURE__ */
|
|
19845
|
-
/* @__PURE__ */
|
|
20303
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20304
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
19846
20305
|
CustomToolbarButton,
|
|
19847
20306
|
{
|
|
19848
20307
|
type: "button",
|
|
@@ -19850,7 +20309,7 @@ function PricingCardToolbar({
|
|
|
19850
20309
|
"aria-pressed": featuredTag,
|
|
19851
20310
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19852
20311
|
className: "group size-8",
|
|
19853
|
-
children: /* @__PURE__ */
|
|
20312
|
+
children: /* @__PURE__ */ jsx22(
|
|
19854
20313
|
Star2,
|
|
19855
20314
|
{
|
|
19856
20315
|
size: 16,
|
|
@@ -19865,25 +20324,25 @@ function PricingCardToolbar({
|
|
|
19865
20324
|
)
|
|
19866
20325
|
}
|
|
19867
20326
|
) }),
|
|
19868
|
-
/* @__PURE__ */
|
|
20327
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
19869
20328
|
] }),
|
|
19870
|
-
/* @__PURE__ */
|
|
19871
|
-
/* @__PURE__ */
|
|
19872
|
-
/* @__PURE__ */
|
|
19873
|
-
/* @__PURE__ */
|
|
19874
|
-
/* @__PURE__ */
|
|
19875
|
-
/* @__PURE__ */
|
|
19876
|
-
/* @__PURE__ */
|
|
20329
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20330
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20331
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20332
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20333
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20334
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20335
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
19877
20336
|
] }) }),
|
|
19878
|
-
/* @__PURE__ */
|
|
19879
|
-
/* @__PURE__ */
|
|
19880
|
-
/* @__PURE__ */
|
|
19881
|
-
/* @__PURE__ */
|
|
19882
|
-
/* @__PURE__ */
|
|
20337
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20338
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20339
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20340
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20341
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19883
20342
|
]
|
|
19884
20343
|
}
|
|
19885
20344
|
),
|
|
19886
|
-
error && /* @__PURE__ */
|
|
20345
|
+
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 })
|
|
19887
20346
|
]
|
|
19888
20347
|
}
|
|
19889
20348
|
) });
|
|
@@ -19910,14 +20369,14 @@ function AiPricingCardOverlay({
|
|
|
19910
20369
|
const [error, setError] = useState9(null);
|
|
19911
20370
|
const activeRef = useRef6(null);
|
|
19912
20371
|
activeRef.current = active;
|
|
19913
|
-
|
|
20372
|
+
useEffect10(() => {
|
|
19914
20373
|
const onMove = (e) => {
|
|
19915
20374
|
const ref = cardRefFromTarget(e.target);
|
|
19916
20375
|
const t = e.target;
|
|
19917
20376
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
19918
20377
|
setHover((prev) => {
|
|
19919
20378
|
const next = ref && !overEditable ? ref : null;
|
|
19920
|
-
return
|
|
20379
|
+
return sameRef2(prev, next) ? prev : next;
|
|
19921
20380
|
});
|
|
19922
20381
|
};
|
|
19923
20382
|
const onLeave = () => setHover(null);
|
|
@@ -19928,19 +20387,19 @@ function AiPricingCardOverlay({
|
|
|
19928
20387
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19929
20388
|
};
|
|
19930
20389
|
}, []);
|
|
19931
|
-
|
|
20390
|
+
useEffect10(() => {
|
|
19932
20391
|
const onClick = (e) => {
|
|
19933
20392
|
const t = e.target;
|
|
19934
20393
|
if (!(t instanceof Element)) return;
|
|
19935
|
-
if (t.closest(
|
|
20394
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
19936
20395
|
const ref = cardRefFromTarget(t);
|
|
19937
|
-
setActive((prev) =>
|
|
19938
|
-
if (!ref || !
|
|
20396
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20397
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
19939
20398
|
};
|
|
19940
20399
|
document.addEventListener("click", onClick, true);
|
|
19941
20400
|
return () => document.removeEventListener("click", onClick, true);
|
|
19942
20401
|
}, []);
|
|
19943
|
-
|
|
20402
|
+
useEffect10(() => {
|
|
19944
20403
|
const onBlur = () => {
|
|
19945
20404
|
if (!activeRef.current) return;
|
|
19946
20405
|
setActive(null);
|
|
@@ -19949,7 +20408,7 @@ function AiPricingCardOverlay({
|
|
|
19949
20408
|
window.addEventListener("blur", onBlur);
|
|
19950
20409
|
return () => window.removeEventListener("blur", onBlur);
|
|
19951
20410
|
}, []);
|
|
19952
|
-
|
|
20411
|
+
useEffect10(() => {
|
|
19953
20412
|
const onKeyDown = (e) => {
|
|
19954
20413
|
if (e.key !== "Escape") return;
|
|
19955
20414
|
if (!activeRef.current) return;
|
|
@@ -20000,12 +20459,12 @@ function AiPricingCardOverlay({
|
|
|
20000
20459
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
20001
20460
|
const activeCardRect = useLiveCardRect(active);
|
|
20002
20461
|
const activeGridRect = useLiveCardRect(active, true);
|
|
20003
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
20004
|
-
return /* @__PURE__ */
|
|
20005
|
-
hoverRect && /* @__PURE__ */
|
|
20006
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
20007
|
-
/* @__PURE__ */
|
|
20008
|
-
/* @__PURE__ */
|
|
20462
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20463
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20464
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20465
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20466
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20467
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
20009
20468
|
PricingCardToolbar,
|
|
20010
20469
|
{
|
|
20011
20470
|
entry: activeEntry,
|
|
@@ -20033,7 +20492,7 @@ function AiPricingCardOverlay({
|
|
|
20033
20492
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20034
20493
|
}
|
|
20035
20494
|
) }),
|
|
20036
|
-
/* @__PURE__ */
|
|
20495
|
+
/* @__PURE__ */ jsx22(
|
|
20037
20496
|
"div",
|
|
20038
20497
|
{
|
|
20039
20498
|
"data-ohw-bridge": "",
|
|
@@ -20054,7 +20513,7 @@ function AiPricingCardOverlay({
|
|
|
20054
20513
|
}
|
|
20055
20514
|
|
|
20056
20515
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20057
|
-
import { useCallback as useCallback5, useEffect as
|
|
20516
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef7, useState as useState10 } from "react";
|
|
20058
20517
|
import { Star as Star3 } from "lucide-react";
|
|
20059
20518
|
|
|
20060
20519
|
// src/lib/ai-video-tree.ts
|
|
@@ -20097,39 +20556,11 @@ function clearVideo(tree, path) {
|
|
|
20097
20556
|
});
|
|
20098
20557
|
}
|
|
20099
20558
|
|
|
20100
|
-
// src/lib/youtube.ts
|
|
20101
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20102
|
-
function extractYouTubeId(input) {
|
|
20103
|
-
const trimmed = input.trim();
|
|
20104
|
-
if (!trimmed) return null;
|
|
20105
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20106
|
-
let url;
|
|
20107
|
-
try {
|
|
20108
|
-
url = new URL(trimmed);
|
|
20109
|
-
} catch {
|
|
20110
|
-
return null;
|
|
20111
|
-
}
|
|
20112
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20113
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20114
|
-
return null;
|
|
20115
|
-
}
|
|
20116
|
-
let candidate = null;
|
|
20117
|
-
if (host === "youtu.be") {
|
|
20118
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20119
|
-
} else if (url.pathname === "/watch") {
|
|
20120
|
-
candidate = url.searchParams.get("v");
|
|
20121
|
-
} else {
|
|
20122
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20123
|
-
candidate = match ? match[1] : null;
|
|
20124
|
-
}
|
|
20125
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20126
|
-
}
|
|
20127
|
-
|
|
20128
20559
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20129
|
-
import { Fragment as Fragment9, jsx as
|
|
20560
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20130
20561
|
var PRIMARY5 = "#0885FE";
|
|
20131
|
-
var
|
|
20132
|
-
var
|
|
20562
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20563
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20133
20564
|
function findVideoBlockElement(sectionId, path) {
|
|
20134
20565
|
const sectionEl = findByInstanceId(sectionId);
|
|
20135
20566
|
if (!sectionEl) return null;
|
|
@@ -20148,7 +20579,7 @@ function readRect4(ref) {
|
|
|
20148
20579
|
}
|
|
20149
20580
|
function useLiveBlockRect(ref) {
|
|
20150
20581
|
const [rect, setRect] = useState10(null);
|
|
20151
|
-
|
|
20582
|
+
useEffect11(() => {
|
|
20152
20583
|
if (!ref) {
|
|
20153
20584
|
setRect(null);
|
|
20154
20585
|
return;
|
|
@@ -20189,12 +20620,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20189
20620
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20190
20621
|
});
|
|
20191
20622
|
}
|
|
20192
|
-
function
|
|
20623
|
+
function Pill({
|
|
20193
20624
|
label,
|
|
20194
20625
|
onClick,
|
|
20195
20626
|
disabled
|
|
20196
20627
|
}) {
|
|
20197
|
-
return /* @__PURE__ */
|
|
20628
|
+
return /* @__PURE__ */ jsx23(
|
|
20198
20629
|
"button",
|
|
20199
20630
|
{
|
|
20200
20631
|
type: "button",
|
|
@@ -20210,7 +20641,7 @@ function Pill2({
|
|
|
20210
20641
|
border: "none",
|
|
20211
20642
|
cursor: disabled ? "default" : "pointer",
|
|
20212
20643
|
background: "#ffffff",
|
|
20213
|
-
color:
|
|
20644
|
+
color: OHW_BLUE_DARK,
|
|
20214
20645
|
opacity: disabled ? 0.4 : 1,
|
|
20215
20646
|
fontSize: 12,
|
|
20216
20647
|
lineHeight: "16px",
|
|
@@ -20228,7 +20659,7 @@ function watchUrl(id) {
|
|
|
20228
20659
|
function VideoUrlInput({ value, onCommit }) {
|
|
20229
20660
|
const [draft, setDraft] = useState10(value ? watchUrl(value) : "");
|
|
20230
20661
|
const [invalid, setInvalid] = useState10(false);
|
|
20231
|
-
|
|
20662
|
+
useEffect11(() => {
|
|
20232
20663
|
setDraft(value ? watchUrl(value) : "");
|
|
20233
20664
|
setInvalid(false);
|
|
20234
20665
|
}, [value]);
|
|
@@ -20253,8 +20684,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20253
20684
|
onCommit(id);
|
|
20254
20685
|
}
|
|
20255
20686
|
};
|
|
20256
|
-
return /* @__PURE__ */
|
|
20257
|
-
/* @__PURE__ */
|
|
20687
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20688
|
+
/* @__PURE__ */ jsxs14(
|
|
20258
20689
|
"div",
|
|
20259
20690
|
{
|
|
20260
20691
|
style: {
|
|
@@ -20270,12 +20701,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20270
20701
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20271
20702
|
},
|
|
20272
20703
|
children: [
|
|
20273
|
-
/* @__PURE__ */
|
|
20704
|
+
/* @__PURE__ */ jsx23(
|
|
20274
20705
|
"span",
|
|
20275
20706
|
{
|
|
20276
20707
|
style: {
|
|
20277
20708
|
flex: "0 0 auto",
|
|
20278
|
-
color:
|
|
20709
|
+
color: OHW_BLUE_DARK,
|
|
20279
20710
|
fontSize: 10,
|
|
20280
20711
|
lineHeight: "16px",
|
|
20281
20712
|
fontWeight: 700,
|
|
@@ -20285,7 +20716,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20285
20716
|
children: "Video"
|
|
20286
20717
|
}
|
|
20287
20718
|
),
|
|
20288
|
-
/* @__PURE__ */
|
|
20719
|
+
/* @__PURE__ */ jsx23(
|
|
20289
20720
|
"input",
|
|
20290
20721
|
{
|
|
20291
20722
|
type: "text",
|
|
@@ -20322,7 +20753,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20322
20753
|
]
|
|
20323
20754
|
}
|
|
20324
20755
|
),
|
|
20325
|
-
invalid && /* @__PURE__ */
|
|
20756
|
+
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." })
|
|
20326
20757
|
] });
|
|
20327
20758
|
}
|
|
20328
20759
|
function VideoToolbar({
|
|
@@ -20332,7 +20763,7 @@ function VideoToolbar({
|
|
|
20332
20763
|
onSetVideoId,
|
|
20333
20764
|
onRemove
|
|
20334
20765
|
}) {
|
|
20335
|
-
return /* @__PURE__ */
|
|
20766
|
+
return /* @__PURE__ */ jsxs14(
|
|
20336
20767
|
"div",
|
|
20337
20768
|
{
|
|
20338
20769
|
"data-ohw-bridge": "",
|
|
@@ -20344,7 +20775,7 @@ function VideoToolbar({
|
|
|
20344
20775
|
gap: 6,
|
|
20345
20776
|
alignItems: "center",
|
|
20346
20777
|
width: 280,
|
|
20347
|
-
background:
|
|
20778
|
+
background: OHW_BLUE,
|
|
20348
20779
|
padding: 8,
|
|
20349
20780
|
borderRadius: 12,
|
|
20350
20781
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20352,9 +20783,9 @@ function VideoToolbar({
|
|
|
20352
20783
|
opacity: pending ? 0.6 : 1
|
|
20353
20784
|
},
|
|
20354
20785
|
children: [
|
|
20355
|
-
/* @__PURE__ */
|
|
20356
|
-
/* @__PURE__ */
|
|
20357
|
-
error && /* @__PURE__ */
|
|
20786
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20787
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20788
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20358
20789
|
]
|
|
20359
20790
|
}
|
|
20360
20791
|
);
|
|
@@ -20371,7 +20802,7 @@ function AiVideoOverlay({
|
|
|
20371
20802
|
const [error, setError] = useState10(null);
|
|
20372
20803
|
const activeRef = useRef7(null);
|
|
20373
20804
|
activeRef.current = active;
|
|
20374
|
-
|
|
20805
|
+
useEffect11(() => {
|
|
20375
20806
|
const onMove = (e) => {
|
|
20376
20807
|
const t = e.target;
|
|
20377
20808
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -20401,7 +20832,7 @@ function AiVideoOverlay({
|
|
|
20401
20832
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20402
20833
|
};
|
|
20403
20834
|
}, []);
|
|
20404
|
-
|
|
20835
|
+
useEffect11(() => {
|
|
20405
20836
|
const onClick = (e) => {
|
|
20406
20837
|
const current = activeRef.current;
|
|
20407
20838
|
if (!current) return;
|
|
@@ -20416,7 +20847,7 @@ function AiVideoOverlay({
|
|
|
20416
20847
|
document.addEventListener("click", onClick, true);
|
|
20417
20848
|
return () => document.removeEventListener("click", onClick, true);
|
|
20418
20849
|
}, []);
|
|
20419
|
-
|
|
20850
|
+
useEffect11(() => {
|
|
20420
20851
|
const onBlur = () => {
|
|
20421
20852
|
if (!activeRef.current) return;
|
|
20422
20853
|
setActive(null);
|
|
@@ -20425,7 +20856,7 @@ function AiVideoOverlay({
|
|
|
20425
20856
|
window.addEventListener("blur", onBlur);
|
|
20426
20857
|
return () => window.removeEventListener("blur", onBlur);
|
|
20427
20858
|
}, []);
|
|
20428
|
-
|
|
20859
|
+
useEffect11(() => {
|
|
20429
20860
|
const onKeyDown = (e) => {
|
|
20430
20861
|
if (e.key !== "Escape") return;
|
|
20431
20862
|
if (!activeRef.current) return;
|
|
@@ -20474,8 +20905,8 @@ function AiVideoOverlay({
|
|
|
20474
20905
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20475
20906
|
const TOOLBAR_APPROX_H = 90;
|
|
20476
20907
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20477
|
-
return /* @__PURE__ */
|
|
20478
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
20908
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
20909
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20479
20910
|
"button",
|
|
20480
20911
|
{
|
|
20481
20912
|
type: "button",
|
|
@@ -20503,15 +20934,15 @@ function AiVideoOverlay({
|
|
|
20503
20934
|
fontSize: 14,
|
|
20504
20935
|
fontWeight: 700
|
|
20505
20936
|
},
|
|
20506
|
-
children: /* @__PURE__ */
|
|
20937
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20507
20938
|
}
|
|
20508
20939
|
),
|
|
20509
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
20940
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20510
20941
|
ItemInteractionLayer,
|
|
20511
20942
|
{
|
|
20512
20943
|
rect: activeBlockRect,
|
|
20513
20944
|
state: toolbarState,
|
|
20514
|
-
toolbar: /* @__PURE__ */
|
|
20945
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20515
20946
|
VideoToolbar,
|
|
20516
20947
|
{
|
|
20517
20948
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20534,7 +20965,7 @@ function AiVideoOverlay({
|
|
|
20534
20965
|
}
|
|
20535
20966
|
|
|
20536
20967
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20537
|
-
import { useCallback as useCallback6, useEffect as
|
|
20968
|
+
import { useCallback as useCallback6, useEffect as useEffect12, useRef as useRef8, useState as useState11 } from "react";
|
|
20538
20969
|
import { Star as Star4 } from "lucide-react";
|
|
20539
20970
|
|
|
20540
20971
|
// src/lib/ai-carousel-tree.ts
|
|
@@ -20586,10 +21017,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20586
21017
|
}
|
|
20587
21018
|
|
|
20588
21019
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20589
|
-
import { Fragment as Fragment10, jsx as
|
|
21020
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20590
21021
|
var PRIMARY6 = "#0885FE";
|
|
20591
|
-
var
|
|
20592
|
-
var
|
|
21022
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
21023
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20593
21024
|
function findCarouselItemElement(sectionId, index) {
|
|
20594
21025
|
const sectionEl = findByInstanceId(sectionId);
|
|
20595
21026
|
if (!sectionEl) return null;
|
|
@@ -20608,7 +21039,7 @@ function readRect5(ref) {
|
|
|
20608
21039
|
}
|
|
20609
21040
|
function useLiveItemRect2(ref) {
|
|
20610
21041
|
const [rect, setRect] = useState11(null);
|
|
20611
|
-
|
|
21042
|
+
useEffect12(() => {
|
|
20612
21043
|
if (!ref) {
|
|
20613
21044
|
setRect(null);
|
|
20614
21045
|
return;
|
|
@@ -20668,8 +21099,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20668
21099
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20669
21100
|
});
|
|
20670
21101
|
}
|
|
20671
|
-
function
|
|
20672
|
-
return /* @__PURE__ */
|
|
21102
|
+
function Pill2({ label, onClick, disabled }) {
|
|
21103
|
+
return /* @__PURE__ */ jsx24(
|
|
20673
21104
|
"button",
|
|
20674
21105
|
{
|
|
20675
21106
|
type: "button",
|
|
@@ -20685,7 +21116,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20685
21116
|
border: "none",
|
|
20686
21117
|
cursor: disabled ? "default" : "pointer",
|
|
20687
21118
|
background: "#ffffff",
|
|
20688
|
-
color:
|
|
21119
|
+
color: OHW_BLUE_DARK2,
|
|
20689
21120
|
opacity: disabled ? 0.4 : 1,
|
|
20690
21121
|
fontSize: 12,
|
|
20691
21122
|
lineHeight: "16px",
|
|
@@ -20703,7 +21134,7 @@ function TogglePill({
|
|
|
20703
21134
|
onToggle,
|
|
20704
21135
|
disabled
|
|
20705
21136
|
}) {
|
|
20706
|
-
return /* @__PURE__ */
|
|
21137
|
+
return /* @__PURE__ */ jsxs15(
|
|
20707
21138
|
"button",
|
|
20708
21139
|
{
|
|
20709
21140
|
type: "button",
|
|
@@ -20722,7 +21153,7 @@ function TogglePill({
|
|
|
20722
21153
|
border: "none",
|
|
20723
21154
|
cursor: disabled ? "default" : "pointer",
|
|
20724
21155
|
background: "#ffffff",
|
|
20725
|
-
color:
|
|
21156
|
+
color: OHW_BLUE_DARK2,
|
|
20726
21157
|
opacity: disabled ? 0.4 : 1,
|
|
20727
21158
|
fontSize: 12,
|
|
20728
21159
|
lineHeight: "16px",
|
|
@@ -20732,7 +21163,7 @@ function TogglePill({
|
|
|
20732
21163
|
},
|
|
20733
21164
|
children: [
|
|
20734
21165
|
label,
|
|
20735
|
-
/* @__PURE__ */
|
|
21166
|
+
/* @__PURE__ */ jsx24(
|
|
20736
21167
|
"span",
|
|
20737
21168
|
{
|
|
20738
21169
|
"aria-hidden": true,
|
|
@@ -20745,10 +21176,10 @@ function TogglePill({
|
|
|
20745
21176
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20746
21177
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20747
21178
|
// "disabled control" rather than "switch that is off".
|
|
20748
|
-
background: on ?
|
|
21179
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20749
21180
|
transition: "background 120ms ease"
|
|
20750
21181
|
},
|
|
20751
|
-
children: /* @__PURE__ */
|
|
21182
|
+
children: /* @__PURE__ */ jsx24(
|
|
20752
21183
|
"span",
|
|
20753
21184
|
{
|
|
20754
21185
|
style: {
|
|
@@ -20777,7 +21208,7 @@ function CarouselSlideToolbar({
|
|
|
20777
21208
|
onChangeImage,
|
|
20778
21209
|
onToggleAutoplay
|
|
20779
21210
|
}) {
|
|
20780
|
-
return /* @__PURE__ */
|
|
21211
|
+
return /* @__PURE__ */ jsxs15(
|
|
20781
21212
|
"div",
|
|
20782
21213
|
{
|
|
20783
21214
|
"data-ohw-bridge": "",
|
|
@@ -20788,7 +21219,7 @@ function CarouselSlideToolbar({
|
|
|
20788
21219
|
flexDirection: "column",
|
|
20789
21220
|
gap: 6,
|
|
20790
21221
|
alignItems: "center",
|
|
20791
|
-
background:
|
|
21222
|
+
background: OHW_BLUE2,
|
|
20792
21223
|
padding: 8,
|
|
20793
21224
|
borderRadius: 12,
|
|
20794
21225
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20800,11 +21231,11 @@ function CarouselSlideToolbar({
|
|
|
20800
21231
|
pointerEvents: pending ? "none" : "auto"
|
|
20801
21232
|
},
|
|
20802
21233
|
children: [
|
|
20803
|
-
/* @__PURE__ */
|
|
20804
|
-
/* @__PURE__ */
|
|
20805
|
-
/* @__PURE__ */
|
|
21234
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21235
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21236
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20806
21237
|
] }),
|
|
20807
|
-
error && /* @__PURE__ */
|
|
21238
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20808
21239
|
]
|
|
20809
21240
|
}
|
|
20810
21241
|
);
|
|
@@ -20824,10 +21255,10 @@ function AiFadeCarouselOverlay({
|
|
|
20824
21255
|
const skeletonRef = useRef8(null);
|
|
20825
21256
|
const activeRef = useRef8(null);
|
|
20826
21257
|
activeRef.current = active;
|
|
20827
|
-
|
|
21258
|
+
useEffect12(() => {
|
|
20828
21259
|
setAutoplayOverride(null);
|
|
20829
21260
|
}, [active?.sectionId, active?.index]);
|
|
20830
|
-
|
|
21261
|
+
useEffect12(() => {
|
|
20831
21262
|
if (!swapping?.fadingOut || !skeletonRef.current) return;
|
|
20832
21263
|
const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
20833
21264
|
duration: MEDIA_UPLOAD_FADE_MS,
|
|
@@ -20837,7 +21268,7 @@ function AiFadeCarouselOverlay({
|
|
|
20837
21268
|
anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
|
|
20838
21269
|
return () => anim.cancel();
|
|
20839
21270
|
}, [swapping?.fadingOut]);
|
|
20840
|
-
|
|
21271
|
+
useEffect12(() => {
|
|
20841
21272
|
const onMove = (e) => {
|
|
20842
21273
|
const t = e.target;
|
|
20843
21274
|
if (!(t instanceof Element)) return;
|
|
@@ -20871,7 +21302,7 @@ function AiFadeCarouselOverlay({
|
|
|
20871
21302
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20872
21303
|
};
|
|
20873
21304
|
}, []);
|
|
20874
|
-
|
|
21305
|
+
useEffect12(() => {
|
|
20875
21306
|
const onClick = (e) => {
|
|
20876
21307
|
const current = activeRef.current;
|
|
20877
21308
|
if (!current) return;
|
|
@@ -20886,7 +21317,7 @@ function AiFadeCarouselOverlay({
|
|
|
20886
21317
|
document.addEventListener("click", onClick, true);
|
|
20887
21318
|
return () => document.removeEventListener("click", onClick, true);
|
|
20888
21319
|
}, []);
|
|
20889
|
-
|
|
21320
|
+
useEffect12(() => {
|
|
20890
21321
|
const onBlur = () => {
|
|
20891
21322
|
if (!activeRef.current) return;
|
|
20892
21323
|
setActive(null);
|
|
@@ -20895,7 +21326,7 @@ function AiFadeCarouselOverlay({
|
|
|
20895
21326
|
window.addEventListener("blur", onBlur);
|
|
20896
21327
|
return () => window.removeEventListener("blur", onBlur);
|
|
20897
21328
|
}, []);
|
|
20898
|
-
|
|
21329
|
+
useEffect12(() => {
|
|
20899
21330
|
const onKeyDown = (e) => {
|
|
20900
21331
|
if (e.key !== "Escape") return;
|
|
20901
21332
|
if (!activeRef.current) return;
|
|
@@ -20944,8 +21375,8 @@ function AiFadeCarouselOverlay({
|
|
|
20944
21375
|
const activeItemRect = useLiveItemRect2(active);
|
|
20945
21376
|
const TOOLBAR_APPROX_H = 90;
|
|
20946
21377
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20947
|
-
return /* @__PURE__ */
|
|
20948
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21378
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21379
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
20949
21380
|
"button",
|
|
20950
21381
|
{
|
|
20951
21382
|
type: "button",
|
|
@@ -20974,10 +21405,10 @@ function AiFadeCarouselOverlay({
|
|
|
20974
21405
|
fontSize: 14,
|
|
20975
21406
|
fontWeight: 700
|
|
20976
21407
|
},
|
|
20977
|
-
children: /* @__PURE__ */
|
|
21408
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
20978
21409
|
}
|
|
20979
21410
|
),
|
|
20980
|
-
swapping && /* @__PURE__ */
|
|
21411
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
20981
21412
|
"div",
|
|
20982
21413
|
{
|
|
20983
21414
|
ref: skeletonRef,
|
|
@@ -20995,15 +21426,15 @@ function AiFadeCarouselOverlay({
|
|
|
20995
21426
|
zIndex: 2147483646,
|
|
20996
21427
|
pointerEvents: "none"
|
|
20997
21428
|
},
|
|
20998
|
-
children: /* @__PURE__ */
|
|
21429
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
20999
21430
|
}
|
|
21000
21431
|
),
|
|
21001
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21432
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
21002
21433
|
ItemInteractionLayer,
|
|
21003
21434
|
{
|
|
21004
21435
|
rect: activeItemRect,
|
|
21005
21436
|
state: toolbarState,
|
|
21006
|
-
toolbar: /* @__PURE__ */
|
|
21437
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
21007
21438
|
CarouselSlideToolbar,
|
|
21008
21439
|
{
|
|
21009
21440
|
pending,
|
|
@@ -21192,120 +21623,13 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21192
21623
|
}
|
|
21193
21624
|
|
|
21194
21625
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21195
|
-
import { useEffect as
|
|
21196
|
-
|
|
21197
|
-
// src/ui/dialog.tsx
|
|
21198
|
-
import * as React9 from "react";
|
|
21199
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21200
|
-
import { X as X2 } from "lucide-react";
|
|
21201
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21202
|
-
function Dialog2({
|
|
21203
|
-
...props
|
|
21204
|
-
}) {
|
|
21205
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21206
|
-
}
|
|
21207
|
-
function DialogPortal({
|
|
21208
|
-
...props
|
|
21209
|
-
}) {
|
|
21210
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21211
|
-
}
|
|
21212
|
-
function DialogOverlay({
|
|
21213
|
-
className,
|
|
21214
|
-
...props
|
|
21215
|
-
}) {
|
|
21216
|
-
return /* @__PURE__ */ jsx24(
|
|
21217
|
-
DialogPrimitive.Overlay,
|
|
21218
|
-
{
|
|
21219
|
-
"data-slot": "dialog-overlay",
|
|
21220
|
-
"data-ohw-link-modal-root": "",
|
|
21221
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21222
|
-
...props
|
|
21223
|
-
}
|
|
21224
|
-
);
|
|
21225
|
-
}
|
|
21226
|
-
var DialogContent = React9.forwardRef(
|
|
21227
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21228
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21229
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21230
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21231
|
-
/* @__PURE__ */ jsxs15(
|
|
21232
|
-
DialogPrimitive.Content,
|
|
21233
|
-
{
|
|
21234
|
-
ref,
|
|
21235
|
-
"data-slot": "dialog-content",
|
|
21236
|
-
className: cn(
|
|
21237
|
-
positionMode,
|
|
21238
|
-
"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",
|
|
21239
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21240
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21241
|
-
className
|
|
21242
|
-
),
|
|
21243
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21244
|
-
...props,
|
|
21245
|
-
children: [
|
|
21246
|
-
children,
|
|
21247
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21248
|
-
DialogPrimitive.Close,
|
|
21249
|
-
{
|
|
21250
|
-
type: "button",
|
|
21251
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21252
|
-
"aria-label": "Close",
|
|
21253
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21254
|
-
}
|
|
21255
|
-
) : null
|
|
21256
|
-
]
|
|
21257
|
-
}
|
|
21258
|
-
)
|
|
21259
|
-
] });
|
|
21260
|
-
}
|
|
21261
|
-
);
|
|
21262
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21263
|
-
function DialogHeader({
|
|
21264
|
-
className,
|
|
21265
|
-
...props
|
|
21266
|
-
}) {
|
|
21267
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21268
|
-
}
|
|
21269
|
-
function DialogFooter({
|
|
21270
|
-
className,
|
|
21271
|
-
...props
|
|
21272
|
-
}) {
|
|
21273
|
-
return /* @__PURE__ */ jsx24(
|
|
21274
|
-
"div",
|
|
21275
|
-
{
|
|
21276
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21277
|
-
...props
|
|
21278
|
-
}
|
|
21279
|
-
);
|
|
21280
|
-
}
|
|
21281
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21282
|
-
DialogPrimitive.Title,
|
|
21283
|
-
{
|
|
21284
|
-
ref,
|
|
21285
|
-
className: cn(
|
|
21286
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21287
|
-
className
|
|
21288
|
-
),
|
|
21289
|
-
...props
|
|
21290
|
-
}
|
|
21291
|
-
));
|
|
21292
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21293
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21294
|
-
DialogPrimitive.Description,
|
|
21295
|
-
{
|
|
21296
|
-
ref,
|
|
21297
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21298
|
-
...props
|
|
21299
|
-
}
|
|
21300
|
-
));
|
|
21301
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21302
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21626
|
+
import { useEffect as useEffect16 } from "react";
|
|
21303
21627
|
|
|
21304
21628
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21305
21629
|
import { Info, X as X4 } from "lucide-react";
|
|
21306
21630
|
|
|
21307
21631
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21308
|
-
import { ArrowRight as
|
|
21632
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21309
21633
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21310
21634
|
function DestinationBreadcrumb({
|
|
21311
21635
|
pageTitle,
|
|
@@ -21319,7 +21643,7 @@ function DestinationBreadcrumb({
|
|
|
21319
21643
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21320
21644
|
] }),
|
|
21321
21645
|
/* @__PURE__ */ jsx25(
|
|
21322
|
-
|
|
21646
|
+
ArrowRight3,
|
|
21323
21647
|
{
|
|
21324
21648
|
size: 16,
|
|
21325
21649
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21392,7 +21716,7 @@ function SectionTreeItem({
|
|
|
21392
21716
|
}
|
|
21393
21717
|
|
|
21394
21718
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21395
|
-
import { useEffect as
|
|
21719
|
+
import { useEffect as useEffect13, useId as useId2, useRef as useRef9, useState as useState12 } from "react";
|
|
21396
21720
|
|
|
21397
21721
|
// src/ui/input.tsx
|
|
21398
21722
|
import * as React10 from "react";
|
|
@@ -21431,7 +21755,7 @@ function Label({ className, ...props }) {
|
|
|
21431
21755
|
}
|
|
21432
21756
|
|
|
21433
21757
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21434
|
-
import { ChevronDown as
|
|
21758
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21435
21759
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21436
21760
|
function FieldChevron({
|
|
21437
21761
|
onClick
|
|
@@ -21444,7 +21768,7 @@ function FieldChevron({
|
|
|
21444
21768
|
onClick,
|
|
21445
21769
|
"aria-label": "Open page list",
|
|
21446
21770
|
tabIndex: -1,
|
|
21447
|
-
children: /* @__PURE__ */ jsx29(
|
|
21771
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21448
21772
|
}
|
|
21449
21773
|
);
|
|
21450
21774
|
}
|
|
@@ -21464,7 +21788,7 @@ function UrlOrPageInput({
|
|
|
21464
21788
|
const inputRef = useRef9(null);
|
|
21465
21789
|
const rootRef = useRef9(null);
|
|
21466
21790
|
const [isFocused, setIsFocused] = useState12(false);
|
|
21467
|
-
|
|
21791
|
+
useEffect13(() => {
|
|
21468
21792
|
if (!dropdownOpen) return;
|
|
21469
21793
|
const isOutside = (e) => {
|
|
21470
21794
|
const root = rootRef.current;
|
|
@@ -21672,9 +21996,9 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21672
21996
|
}
|
|
21673
21997
|
|
|
21674
21998
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21675
|
-
import { useCallback as useCallback7, useEffect as
|
|
21999
|
+
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21676
22000
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21677
|
-
import { ArrowLeft as
|
|
22001
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21678
22002
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21679
22003
|
|
|
21680
22004
|
// src/lib/parent-scroll.ts
|
|
@@ -21734,7 +22058,7 @@ function useSectionRects(sectionIdsKey, enabled) {
|
|
|
21734
22058
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
21735
22059
|
[sectionIdsKey]
|
|
21736
22060
|
);
|
|
21737
|
-
|
|
22061
|
+
useEffect14(() => {
|
|
21738
22062
|
if (!enabled || sectionIds.length === 0) {
|
|
21739
22063
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
21740
22064
|
return;
|
|
@@ -21789,12 +22113,12 @@ function SectionPickerOverlay({
|
|
|
21789
22113
|
);
|
|
21790
22114
|
const normalizedTarget = normalizePath(pagePath);
|
|
21791
22115
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
21792
|
-
|
|
22116
|
+
useEffect14(() => {
|
|
21793
22117
|
if (isOnTargetPage) return;
|
|
21794
22118
|
const search = readPreservedSearch();
|
|
21795
22119
|
router.push(`${normalizedTarget}${search}`);
|
|
21796
22120
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
21797
|
-
|
|
22121
|
+
useEffect14(() => {
|
|
21798
22122
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
21799
22123
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
21800
22124
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -21832,7 +22156,7 @@ function SectionPickerOverlay({
|
|
|
21832
22156
|
},
|
|
21833
22157
|
[]
|
|
21834
22158
|
);
|
|
21835
|
-
|
|
22159
|
+
useEffect14(() => {
|
|
21836
22160
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
|
|
21837
22161
|
const next = getIframeVisibleClip({
|
|
21838
22162
|
iframeOffsetTop,
|
|
@@ -21876,12 +22200,12 @@ function SectionPickerOverlay({
|
|
|
21876
22200
|
window.removeEventListener("resize", onResize);
|
|
21877
22201
|
};
|
|
21878
22202
|
}, [applyHoverAt]);
|
|
21879
|
-
|
|
22203
|
+
useEffect14(() => {
|
|
21880
22204
|
const ptr = pointerRef.current;
|
|
21881
22205
|
if (!ptr) return;
|
|
21882
22206
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
21883
22207
|
}, [rects, applyHoverAt]);
|
|
21884
|
-
|
|
22208
|
+
useEffect14(() => {
|
|
21885
22209
|
const rememberPointer = (clientX, clientY) => {
|
|
21886
22210
|
pointerRef.current = { x: clientX, y: clientY };
|
|
21887
22211
|
const top = iframeOffsetTopRef.current;
|
|
@@ -21913,7 +22237,7 @@ function SectionPickerOverlay({
|
|
|
21913
22237
|
},
|
|
21914
22238
|
[selectedId, onSelect]
|
|
21915
22239
|
);
|
|
21916
|
-
|
|
22240
|
+
useEffect14(() => {
|
|
21917
22241
|
const onKeyDown = (e) => {
|
|
21918
22242
|
if (e.key === "Escape") {
|
|
21919
22243
|
e.preventDefault();
|
|
@@ -21951,7 +22275,7 @@ function SectionPickerOverlay({
|
|
|
21951
22275
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
21952
22276
|
onClick: onBack,
|
|
21953
22277
|
children: [
|
|
21954
|
-
/* @__PURE__ */ jsx31(
|
|
22278
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
21955
22279
|
"Back"
|
|
21956
22280
|
]
|
|
21957
22281
|
}
|
|
@@ -22020,7 +22344,7 @@ function SectionPickerOverlay({
|
|
|
22020
22344
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22021
22345
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22022
22346
|
"aria-hidden": true,
|
|
22023
|
-
children: /* @__PURE__ */ jsx31(
|
|
22347
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22024
22348
|
}
|
|
22025
22349
|
) : null
|
|
22026
22350
|
]
|
|
@@ -22036,7 +22360,7 @@ function SectionPickerOverlay({
|
|
|
22036
22360
|
}
|
|
22037
22361
|
|
|
22038
22362
|
// src/ui/link-modal/useLinkModalState.ts
|
|
22039
|
-
import { useCallback as useCallback8, useEffect as
|
|
22363
|
+
import { useCallback as useCallback8, useEffect as useEffect15, useMemo as useMemo3, useState as useState14 } from "react";
|
|
22040
22364
|
function useLinkModalState({
|
|
22041
22365
|
open,
|
|
22042
22366
|
mode,
|
|
@@ -22063,7 +22387,7 @@ function useLinkModalState({
|
|
|
22063
22387
|
setDropdownOpen(false);
|
|
22064
22388
|
setUrlError("");
|
|
22065
22389
|
}, []);
|
|
22066
|
-
|
|
22390
|
+
useEffect15(() => {
|
|
22067
22391
|
if (!open) return;
|
|
22068
22392
|
if (mode === "edit" && initialTarget) {
|
|
22069
22393
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -22229,7 +22553,7 @@ function LinkPopover({
|
|
|
22229
22553
|
onSubmit
|
|
22230
22554
|
});
|
|
22231
22555
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
22232
|
-
|
|
22556
|
+
useEffect16(() => {
|
|
22233
22557
|
if (!open) return;
|
|
22234
22558
|
if (sectionPickerActive) {
|
|
22235
22559
|
postToParent({ type: "ui:unlock" });
|
|
@@ -22404,6 +22728,7 @@ function shouldUseDevFixtures() {
|
|
|
22404
22728
|
function getLogoElement(el) {
|
|
22405
22729
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22406
22730
|
if (marked) return marked;
|
|
22731
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22407
22732
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22408
22733
|
if (!root) return null;
|
|
22409
22734
|
const anchor = el.closest("a");
|
|
@@ -22472,8 +22797,8 @@ function addFooterColumnWithPersist({
|
|
|
22472
22797
|
// src/ui/FloatingPanel.tsx
|
|
22473
22798
|
import {
|
|
22474
22799
|
useCallback as useCallback9,
|
|
22475
|
-
useEffect as
|
|
22476
|
-
useLayoutEffect as
|
|
22800
|
+
useEffect as useEffect17,
|
|
22801
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22477
22802
|
useRef as useRef11,
|
|
22478
22803
|
useState as useState15
|
|
22479
22804
|
} from "react";
|
|
@@ -22556,10 +22881,10 @@ function FloatingPanel({
|
|
|
22556
22881
|
x: clampX(home.x, measured.w),
|
|
22557
22882
|
y: fittedY
|
|
22558
22883
|
};
|
|
22559
|
-
|
|
22884
|
+
useEffect17(() => {
|
|
22560
22885
|
setLiveScroll(parentScroll);
|
|
22561
22886
|
}, [parentScroll]);
|
|
22562
|
-
|
|
22887
|
+
useEffect17(() => {
|
|
22563
22888
|
if (!open) return;
|
|
22564
22889
|
const onParentScroll = (e) => {
|
|
22565
22890
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
@@ -22570,7 +22895,7 @@ function FloatingPanel({
|
|
|
22570
22895
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22571
22896
|
}, [open]);
|
|
22572
22897
|
const positionRef = useRef11(position);
|
|
22573
|
-
|
|
22898
|
+
useLayoutEffect6(() => {
|
|
22574
22899
|
if (!open) {
|
|
22575
22900
|
positionRef.current = position;
|
|
22576
22901
|
return;
|
|
@@ -22580,7 +22905,7 @@ function FloatingPanel({
|
|
|
22580
22905
|
}
|
|
22581
22906
|
positionRef.current = position;
|
|
22582
22907
|
}, [open, position, liveScroll, parentScroll]);
|
|
22583
|
-
|
|
22908
|
+
useLayoutEffect6(() => {
|
|
22584
22909
|
if (!open || !panelRef.current) return;
|
|
22585
22910
|
const el = panelRef.current;
|
|
22586
22911
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22644,11 +22969,11 @@ function FloatingPanel({
|
|
|
22644
22969
|
} catch {
|
|
22645
22970
|
}
|
|
22646
22971
|
}, []);
|
|
22647
|
-
|
|
22972
|
+
useEffect17(() => {
|
|
22648
22973
|
if (open) return;
|
|
22649
22974
|
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22650
22975
|
}, [open]);
|
|
22651
|
-
|
|
22976
|
+
useEffect17(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
|
|
22652
22977
|
if (!open) return null;
|
|
22653
22978
|
return /* @__PURE__ */ jsxs22(
|
|
22654
22979
|
"div",
|
|
@@ -22789,7 +23114,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
22789
23114
|
}
|
|
22790
23115
|
|
|
22791
23116
|
// src/ui/button-style-panel.tsx
|
|
22792
|
-
import { Check as
|
|
23117
|
+
import { Check as Check5 } from "lucide-react";
|
|
22793
23118
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22794
23119
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
22795
23120
|
function ButtonStylePanel({
|
|
@@ -22860,7 +23185,7 @@ function ButtonStylePanel({
|
|
|
22860
23185
|
{
|
|
22861
23186
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
22862
23187
|
"aria-hidden": true,
|
|
22863
|
-
children: /* @__PURE__ */ jsx35(
|
|
23188
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
22864
23189
|
}
|
|
22865
23190
|
) : null
|
|
22866
23191
|
]
|
|
@@ -23168,7 +23493,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
|
|
|
23168
23493
|
}
|
|
23169
23494
|
|
|
23170
23495
|
// src/useNavItemDrag.ts
|
|
23171
|
-
import { useCallback as useCallback10, useEffect as
|
|
23496
|
+
import { useCallback as useCallback10, useEffect as useEffect18, useRef as useRef12, useState as useState16 } from "react";
|
|
23172
23497
|
function useNavItemDrag({
|
|
23173
23498
|
isEditMode,
|
|
23174
23499
|
editContentRef,
|
|
@@ -23401,7 +23726,7 @@ function useNavItemDrag({
|
|
|
23401
23726
|
},
|
|
23402
23727
|
[]
|
|
23403
23728
|
);
|
|
23404
|
-
|
|
23729
|
+
useEffect18(() => {
|
|
23405
23730
|
if (!isEditMode) return;
|
|
23406
23731
|
const THRESHOLD = 10;
|
|
23407
23732
|
const resolveWasSelected = (el) => {
|
|
@@ -23560,7 +23885,7 @@ function useNavItemDrag({
|
|
|
23560
23885
|
}
|
|
23561
23886
|
|
|
23562
23887
|
// src/useSectionDrag.ts
|
|
23563
|
-
import { useCallback as useCallback11, useEffect as
|
|
23888
|
+
import { useCallback as useCallback11, useEffect as useEffect19, useRef as useRef13, useState as useState17 } from "react";
|
|
23564
23889
|
|
|
23565
23890
|
// src/lib/section-dnd.ts
|
|
23566
23891
|
function isFooterSection(el) {
|
|
@@ -23780,7 +24105,7 @@ function useSectionDrag({
|
|
|
23780
24105
|
},
|
|
23781
24106
|
[footerDragRef, navDragRef]
|
|
23782
24107
|
);
|
|
23783
|
-
|
|
24108
|
+
useEffect19(() => {
|
|
23784
24109
|
if (!isEditMode) return;
|
|
23785
24110
|
const onPointerDown = (e) => {
|
|
23786
24111
|
if (e.button !== 0) return;
|
|
@@ -23885,7 +24210,7 @@ function useSectionDrag({
|
|
|
23885
24210
|
}
|
|
23886
24211
|
|
|
23887
24212
|
// src/ui/footer-container-chrome.tsx
|
|
23888
|
-
import { Plus as
|
|
24213
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
23889
24214
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
23890
24215
|
function FooterContainerChrome({
|
|
23891
24216
|
rect,
|
|
@@ -23926,7 +24251,7 @@ function FooterContainerChrome({
|
|
|
23926
24251
|
if (addDisabled) return;
|
|
23927
24252
|
onAdd();
|
|
23928
24253
|
},
|
|
23929
|
-
children: /* @__PURE__ */ jsx36(
|
|
24254
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
23930
24255
|
}
|
|
23931
24256
|
) }),
|
|
23932
24257
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24105,7 +24430,7 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24105
24430
|
}
|
|
24106
24431
|
|
|
24107
24432
|
// src/lib/build-page-sync.ts
|
|
24108
|
-
import { useEffect as
|
|
24433
|
+
import { useEffect as useEffect20 } from "react";
|
|
24109
24434
|
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24110
24435
|
function normalisePath(path) {
|
|
24111
24436
|
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
@@ -24218,7 +24543,7 @@ function applyBuildPageSync(msg, deps) {
|
|
|
24218
24543
|
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24219
24544
|
}
|
|
24220
24545
|
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24221
|
-
|
|
24546
|
+
useEffect20(() => {
|
|
24222
24547
|
if (!isEditMode) return;
|
|
24223
24548
|
const onMessage = (e) => {
|
|
24224
24549
|
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
@@ -24333,7 +24658,7 @@ function retargetPageLinks(change, deps) {
|
|
|
24333
24658
|
}
|
|
24334
24659
|
|
|
24335
24660
|
// src/ui/navbar-container-chrome.tsx
|
|
24336
|
-
import { Plus as
|
|
24661
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24337
24662
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24338
24663
|
function NavbarContainerChrome({
|
|
24339
24664
|
rect,
|
|
@@ -24369,7 +24694,7 @@ function NavbarContainerChrome({
|
|
|
24369
24694
|
e.stopPropagation();
|
|
24370
24695
|
onAdd();
|
|
24371
24696
|
},
|
|
24372
|
-
children: /* @__PURE__ */ jsx37(
|
|
24697
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24373
24698
|
}
|
|
24374
24699
|
)
|
|
24375
24700
|
}
|
|
@@ -24441,7 +24766,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24441
24766
|
}
|
|
24442
24767
|
|
|
24443
24768
|
// src/OhhwellsBridge.tsx
|
|
24444
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
24769
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
|
|
24445
24770
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24446
24771
|
var PRIMARY7 = "#0885FE";
|
|
24447
24772
|
var IMAGE_FADE_MS = 300;
|
|
@@ -25219,7 +25544,7 @@ function getNavigationSelectionParent(el) {
|
|
|
25219
25544
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
25220
25545
|
return resolveFooterLinksContainerFrom(el);
|
|
25221
25546
|
}
|
|
25222
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25547
|
+
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)) {
|
|
25223
25548
|
return getNavigationRoot(el);
|
|
25224
25549
|
}
|
|
25225
25550
|
return null;
|
|
@@ -25441,7 +25766,6 @@ var ICONS = {
|
|
|
25441
25766
|
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"/>',
|
|
25442
25767
|
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"/>'
|
|
25443
25768
|
};
|
|
25444
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25445
25769
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25446
25770
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25447
25771
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25539,7 +25863,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25539
25863
|
el.style.top = `${top}px`;
|
|
25540
25864
|
el.style.height = `${height}px`;
|
|
25541
25865
|
}
|
|
25542
|
-
var
|
|
25866
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25543
25867
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25544
25868
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25545
25869
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25566,8 +25890,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25566
25890
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25567
25891
|
const half = toolbarWidth / 2;
|
|
25568
25892
|
return Math.max(
|
|
25569
|
-
|
|
25570
|
-
Math.min(centerX, window.innerWidth -
|
|
25893
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
25894
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25571
25895
|
);
|
|
25572
25896
|
}
|
|
25573
25897
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25941,7 +26265,7 @@ function OhhwellsBridge() {
|
|
|
25941
26265
|
const searchParams = useSearchParams();
|
|
25942
26266
|
const isEditMode = isEditSessionActive();
|
|
25943
26267
|
const [bridgeRoot, setBridgeRoot] = useState18(null);
|
|
25944
|
-
|
|
26268
|
+
useEffect21(() => {
|
|
25945
26269
|
const figtreeFontId = "ohw-figtree-font";
|
|
25946
26270
|
if (!document.getElementById(figtreeFontId)) {
|
|
25947
26271
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25968,7 +26292,7 @@ function OhhwellsBridge() {
|
|
|
25968
26292
|
}, []);
|
|
25969
26293
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25970
26294
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
25971
|
-
|
|
26295
|
+
useLayoutEffect7(() => {
|
|
25972
26296
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25973
26297
|
if (next !== subdomain) setSubdomain(next);
|
|
25974
26298
|
if (next) return;
|
|
@@ -25980,7 +26304,7 @@ function OhhwellsBridge() {
|
|
|
25980
26304
|
}, 0);
|
|
25981
26305
|
return () => window.clearTimeout(t);
|
|
25982
26306
|
}, [subdomainFromQuery, subdomain]);
|
|
25983
|
-
|
|
26307
|
+
useEffect21(() => {
|
|
25984
26308
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
25985
26309
|
const url = new URL(window.location.href);
|
|
25986
26310
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -25992,6 +26316,7 @@ function OhhwellsBridge() {
|
|
|
25992
26316
|
useSavedLinkNavigation(isEditMode);
|
|
25993
26317
|
useNavDropdownToggle(isEditMode);
|
|
25994
26318
|
useHashLinkScroll(isEditMode);
|
|
26319
|
+
usePublishedPlaceholderStrip(isEditMode);
|
|
25995
26320
|
const postToParent2 = useCallback12((data) => {
|
|
25996
26321
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
25997
26322
|
window.parent.postMessage(data, "*");
|
|
@@ -26000,14 +26325,14 @@ function OhhwellsBridge() {
|
|
|
26000
26325
|
const [fetchState, setFetchState] = useState18("idle");
|
|
26001
26326
|
const [showBranding, setShowBranding] = useState18(false);
|
|
26002
26327
|
const autoSaveTimers = useRef14(/* @__PURE__ */ new Map());
|
|
26003
|
-
|
|
26328
|
+
useEffect21(() => {
|
|
26004
26329
|
stampBridgeVersionOnDocument();
|
|
26005
26330
|
}, []);
|
|
26006
|
-
|
|
26331
|
+
useEffect21(() => {
|
|
26007
26332
|
if (isEditMode) return;
|
|
26008
26333
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
26009
26334
|
}, [isEditMode, subdomain, fetchState]);
|
|
26010
|
-
|
|
26335
|
+
useEffect21(() => {
|
|
26011
26336
|
if (isEditMode || !subdomain) return;
|
|
26012
26337
|
const onError = (event) => {
|
|
26013
26338
|
reportOutageBeacon({
|
|
@@ -26148,7 +26473,7 @@ function OhhwellsBridge() {
|
|
|
26148
26473
|
}, []);
|
|
26149
26474
|
const selectMediaElementRef = useRef14(selectMediaElement);
|
|
26150
26475
|
selectMediaElementRef.current = selectMediaElement;
|
|
26151
|
-
|
|
26476
|
+
useEffect21(() => {
|
|
26152
26477
|
if (!selectedMedia) return;
|
|
26153
26478
|
const update = () => {
|
|
26154
26479
|
const el = selectedMediaElRef.current;
|
|
@@ -26363,7 +26688,7 @@ function OhhwellsBridge() {
|
|
|
26363
26688
|
const [fieldDragging, setFieldDragging] = useState18(false);
|
|
26364
26689
|
const clearFormPickRef = useRef14(clearFormPick);
|
|
26365
26690
|
clearFormPickRef.current = clearFormPick;
|
|
26366
|
-
|
|
26691
|
+
useEffect21(() => {
|
|
26367
26692
|
const el = fieldPickElRef.current;
|
|
26368
26693
|
if (!el || fieldPickRect === null) return;
|
|
26369
26694
|
const observer = new ResizeObserver(() => {
|
|
@@ -26372,7 +26697,7 @@ function OhhwellsBridge() {
|
|
|
26372
26697
|
observer.observe(el);
|
|
26373
26698
|
return () => observer.disconnect();
|
|
26374
26699
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26375
|
-
|
|
26700
|
+
useEffect21(() => {
|
|
26376
26701
|
const el = formPickElRef.current;
|
|
26377
26702
|
if (!el || formPickRect === null) return;
|
|
26378
26703
|
const observer = new ResizeObserver(() => {
|
|
@@ -26399,7 +26724,7 @@ function OhhwellsBridge() {
|
|
|
26399
26724
|
const hoveredItemElRef = useRef14(null);
|
|
26400
26725
|
const [hoveredItemRect, setHoveredItemRect] = useState18(null);
|
|
26401
26726
|
const [hoveredTextRect, setHoveredTextRect] = useState18(null);
|
|
26402
|
-
|
|
26727
|
+
useEffect21(() => {
|
|
26403
26728
|
const sync = () => {
|
|
26404
26729
|
const el = document.querySelector(
|
|
26405
26730
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26449,21 +26774,6 @@ function OhhwellsBridge() {
|
|
|
26449
26774
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26450
26775
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26451
26776
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26452
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26453
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26454
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26455
|
-
const floatingPanelRef = useRef14(null);
|
|
26456
|
-
floatingPanelRef.current = floatingPanel;
|
|
26457
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26458
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26459
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26460
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26461
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26462
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26463
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26464
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26465
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26466
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26467
26777
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26468
26778
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26469
26779
|
const footerDragRef = useRef14(null);
|
|
@@ -26490,6 +26800,21 @@ function OhhwellsBridge() {
|
|
|
26490
26800
|
const stylesRef = useRef14("");
|
|
26491
26801
|
const appliedDrawerRef = useRef14(null);
|
|
26492
26802
|
const pendingDeleteUndoRef = useRef14(null);
|
|
26803
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26804
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
26805
|
+
const floatingPanelRef = useRef14(null);
|
|
26806
|
+
floatingPanelRef.current = floatingPanel;
|
|
26807
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
26808
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26809
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
26810
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
26811
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26812
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26813
|
+
const buttonPointerDragRef = useRef14(null);
|
|
26814
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26815
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26816
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26817
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26493
26818
|
const [sitePages, setSitePages] = useState18([]);
|
|
26494
26819
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26495
26820
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26499,8 +26824,19 @@ function OhhwellsBridge() {
|
|
|
26499
26824
|
const linkPopoverOpenRef = useRef14(false);
|
|
26500
26825
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26501
26826
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26827
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26502
26828
|
linkPopoverSessionRef.current = linkPopover;
|
|
26503
|
-
|
|
26829
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26830
|
+
useEffect21(() => {
|
|
26831
|
+
const syncViewport = () => {
|
|
26832
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26833
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26834
|
+
};
|
|
26835
|
+
syncViewport();
|
|
26836
|
+
window.addEventListener("resize", syncViewport);
|
|
26837
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26838
|
+
}, []);
|
|
26839
|
+
useEffect21(() => {
|
|
26504
26840
|
setSectionOrderPersistHandler((entries) => {
|
|
26505
26841
|
const currentPath = window.location.pathname;
|
|
26506
26842
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26510,7 +26846,7 @@ function OhhwellsBridge() {
|
|
|
26510
26846
|
});
|
|
26511
26847
|
return () => setSectionOrderPersistHandler(null);
|
|
26512
26848
|
}, []);
|
|
26513
|
-
|
|
26849
|
+
useEffect21(() => {
|
|
26514
26850
|
setAiFooterMountOptions({
|
|
26515
26851
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26516
26852
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26594,7 +26930,7 @@ function OhhwellsBridge() {
|
|
|
26594
26930
|
}, [isEditMode, pathname]);
|
|
26595
26931
|
const runSectionsPrefetchRef = useRef14(runSectionsPrefetch);
|
|
26596
26932
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26597
|
-
|
|
26933
|
+
useEffect21(() => {
|
|
26598
26934
|
if (!linkPopover) {
|
|
26599
26935
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26600
26936
|
return;
|
|
@@ -26622,7 +26958,7 @@ function OhhwellsBridge() {
|
|
|
26622
26958
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26623
26959
|
};
|
|
26624
26960
|
}, [linkPopover, postToParent2]);
|
|
26625
|
-
|
|
26961
|
+
useEffect21(() => {
|
|
26626
26962
|
if (!isEditMode) return;
|
|
26627
26963
|
const useFixtures = shouldUseDevFixtures();
|
|
26628
26964
|
if (useFixtures) {
|
|
@@ -26648,7 +26984,7 @@ function OhhwellsBridge() {
|
|
|
26648
26984
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26649
26985
|
return () => window.removeEventListener("message", onSitePages);
|
|
26650
26986
|
}, [isEditMode, postToParent2]);
|
|
26651
|
-
|
|
26987
|
+
useEffect21(() => {
|
|
26652
26988
|
if (!isEditMode) return;
|
|
26653
26989
|
const deps = {
|
|
26654
26990
|
getEditContent: () => editContentRef.current,
|
|
@@ -26685,14 +27021,14 @@ function OhhwellsBridge() {
|
|
|
26685
27021
|
window.addEventListener("message", onPageMessage);
|
|
26686
27022
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26687
27023
|
}, [isEditMode, postToParent2]);
|
|
26688
|
-
|
|
27024
|
+
useEffect21(() => {
|
|
26689
27025
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26690
27026
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26691
27027
|
if (Object.keys(manifest).length === 0) return;
|
|
26692
27028
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26693
27029
|
});
|
|
26694
27030
|
}, [isEditMode]);
|
|
26695
|
-
|
|
27031
|
+
useEffect21(() => {
|
|
26696
27032
|
const update = () => {
|
|
26697
27033
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26698
27034
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27951,7 +28287,7 @@ function OhhwellsBridge() {
|
|
|
27951
28287
|
},
|
|
27952
28288
|
[postToParent2]
|
|
27953
28289
|
);
|
|
27954
|
-
|
|
28290
|
+
useEffect21(() => {
|
|
27955
28291
|
const onDragOver = (e) => {
|
|
27956
28292
|
const dragged = buttonCollectionDragRef.current;
|
|
27957
28293
|
if (!dragged) return;
|
|
@@ -28022,7 +28358,7 @@ function OhhwellsBridge() {
|
|
|
28022
28358
|
setLogoSizeDraft(null);
|
|
28023
28359
|
deselectRef.current();
|
|
28024
28360
|
}, []);
|
|
28025
|
-
|
|
28361
|
+
useEffect21(() => {
|
|
28026
28362
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
28027
28363
|
if (!session || !logoSizeDraft) {
|
|
28028
28364
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28180,7 +28516,7 @@ function OhhwellsBridge() {
|
|
|
28180
28516
|
deselectRef.current = deselect;
|
|
28181
28517
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28182
28518
|
const lastSiteWideScopeRef = useRef14(null);
|
|
28183
|
-
|
|
28519
|
+
useEffect21(() => {
|
|
28184
28520
|
if (!isEditMode) {
|
|
28185
28521
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28186
28522
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28206,7 +28542,7 @@ function OhhwellsBridge() {
|
|
|
28206
28542
|
isFooterFrameSelection,
|
|
28207
28543
|
postToParent2
|
|
28208
28544
|
]);
|
|
28209
|
-
|
|
28545
|
+
useLayoutEffect7(() => {
|
|
28210
28546
|
if (!subdomain || isEditMode) {
|
|
28211
28547
|
setFetchState("done");
|
|
28212
28548
|
return;
|
|
@@ -28233,6 +28569,7 @@ function OhhwellsBridge() {
|
|
|
28233
28569
|
applyAiFooterFromContent(content);
|
|
28234
28570
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28235
28571
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28572
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28236
28573
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28237
28574
|
}
|
|
28238
28575
|
applyBrandChrome(content);
|
|
@@ -28243,15 +28580,16 @@ function OhhwellsBridge() {
|
|
|
28243
28580
|
if (key === "__ohw_sections") continue;
|
|
28244
28581
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28245
28582
|
if (key === AI_FOOTER_KEY) continue;
|
|
28583
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28584
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28246
28585
|
if (key === BRAND_KIT_KEY) continue;
|
|
28247
28586
|
if (key === STYLE_STORE_KEY) continue;
|
|
28248
28587
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28249
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28250
28588
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
28251
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28252
28589
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28253
28590
|
continue;
|
|
28254
28591
|
}
|
|
28592
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28255
28593
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28256
28594
|
if (applyCarouselNode(key, val)) continue;
|
|
28257
28595
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28291,6 +28629,7 @@ function OhhwellsBridge() {
|
|
|
28291
28629
|
});
|
|
28292
28630
|
applyLinkByKey(key, val);
|
|
28293
28631
|
}
|
|
28632
|
+
applySectionEmbeds(content);
|
|
28294
28633
|
applyLogoFromContent(content);
|
|
28295
28634
|
applyLogoSizes(content);
|
|
28296
28635
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28357,7 +28696,7 @@ function OhhwellsBridge() {
|
|
|
28357
28696
|
cancelled = true;
|
|
28358
28697
|
};
|
|
28359
28698
|
}, [subdomain, isEditMode]);
|
|
28360
|
-
|
|
28699
|
+
useEffect21(() => {
|
|
28361
28700
|
if (!isEditMode) return;
|
|
28362
28701
|
const resolveIndex = (form, clientY) => {
|
|
28363
28702
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28398,7 +28737,7 @@ function OhhwellsBridge() {
|
|
|
28398
28737
|
window.removeEventListener("drop", onDrop, true);
|
|
28399
28738
|
};
|
|
28400
28739
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28401
|
-
|
|
28740
|
+
useEffect21(() => {
|
|
28402
28741
|
if (!isEditMode) return;
|
|
28403
28742
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28404
28743
|
markFormFields(form);
|
|
@@ -28410,7 +28749,7 @@ function OhhwellsBridge() {
|
|
|
28410
28749
|
});
|
|
28411
28750
|
return () => observer.disconnect();
|
|
28412
28751
|
}, [isEditMode, fetchState, pathname]);
|
|
28413
|
-
|
|
28752
|
+
useEffect21(() => {
|
|
28414
28753
|
if (!isEditMode) return;
|
|
28415
28754
|
let saveTimer = null;
|
|
28416
28755
|
const onInput = (e) => {
|
|
@@ -28432,14 +28771,14 @@ function OhhwellsBridge() {
|
|
|
28432
28771
|
document.addEventListener("input", onInput, true);
|
|
28433
28772
|
return () => document.removeEventListener("input", onInput, true);
|
|
28434
28773
|
}, [isEditMode, persistFields]);
|
|
28435
|
-
|
|
28774
|
+
useEffect21(() => {
|
|
28436
28775
|
if (isEditMode || fetchState !== "done") return;
|
|
28437
28776
|
const content = contentCache.get(subdomain) ?? {};
|
|
28438
28777
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28439
28778
|
reconcileFieldsFromContent(form, content);
|
|
28440
28779
|
});
|
|
28441
28780
|
}, [isEditMode, fetchState, subdomain]);
|
|
28442
|
-
|
|
28781
|
+
useEffect21(() => {
|
|
28443
28782
|
if (!isEditMode) return;
|
|
28444
28783
|
const swallow = (e) => {
|
|
28445
28784
|
const target = e.target;
|
|
@@ -28448,14 +28787,14 @@ function OhhwellsBridge() {
|
|
|
28448
28787
|
document.addEventListener("submit", swallow, true);
|
|
28449
28788
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28450
28789
|
}, [isEditMode]);
|
|
28451
|
-
|
|
28790
|
+
useEffect21(() => {
|
|
28452
28791
|
if (isEditMode || fetchState !== "done") return;
|
|
28453
28792
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28454
28793
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28455
28794
|
console.log({ apiUrl, subdomain });
|
|
28456
28795
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28457
28796
|
}, [isEditMode, fetchState, subdomain]);
|
|
28458
|
-
|
|
28797
|
+
useEffect21(() => {
|
|
28459
28798
|
if (!subdomain || isEditMode) return;
|
|
28460
28799
|
let debounceTimer = null;
|
|
28461
28800
|
let observer = null;
|
|
@@ -28479,20 +28818,22 @@ function OhhwellsBridge() {
|
|
|
28479
28818
|
}
|
|
28480
28819
|
applyAiFooterFromContent(content);
|
|
28481
28820
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28821
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28482
28822
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28483
28823
|
}
|
|
28484
28824
|
for (const [key, val] of Object.entries(content)) {
|
|
28485
28825
|
if (key === "__ohw_sections") continue;
|
|
28486
28826
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28487
28827
|
if (key === AI_FOOTER_KEY) continue;
|
|
28828
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28829
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28488
28830
|
if (key === BRAND_KIT_KEY) continue;
|
|
28489
28831
|
if (key === STYLE_STORE_KEY) continue;
|
|
28490
28832
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28491
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28492
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28493
28833
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28494
28834
|
continue;
|
|
28495
28835
|
}
|
|
28836
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28496
28837
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28497
28838
|
if (applyCarouselNode(key, val)) continue;
|
|
28498
28839
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28517,6 +28858,7 @@ function OhhwellsBridge() {
|
|
|
28517
28858
|
});
|
|
28518
28859
|
applyLinkByKey(key, val);
|
|
28519
28860
|
}
|
|
28861
|
+
applySectionEmbeds(content);
|
|
28520
28862
|
applyLogoFromContent(content);
|
|
28521
28863
|
reconcileNavbarItemsFromContent(content);
|
|
28522
28864
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28572,16 +28914,16 @@ function OhhwellsBridge() {
|
|
|
28572
28914
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28573
28915
|
};
|
|
28574
28916
|
}, [subdomain, isEditMode, pathname]);
|
|
28575
|
-
|
|
28917
|
+
useLayoutEffect7(() => {
|
|
28576
28918
|
const el = document.getElementById("ohw-loader");
|
|
28577
28919
|
if (!el) return;
|
|
28578
28920
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28579
28921
|
el.style.display = visible ? "flex" : "none";
|
|
28580
28922
|
}, [subdomain, fetchState]);
|
|
28581
|
-
|
|
28923
|
+
useEffect21(() => {
|
|
28582
28924
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28583
28925
|
}, [pathname, postToParent2]);
|
|
28584
|
-
|
|
28926
|
+
useEffect21(() => {
|
|
28585
28927
|
if (!subdomain || isEditMode) return;
|
|
28586
28928
|
const content = contentCache.get(subdomain);
|
|
28587
28929
|
if (!content) return;
|
|
@@ -28599,7 +28941,7 @@ function OhhwellsBridge() {
|
|
|
28599
28941
|
}
|
|
28600
28942
|
applyAiFooterFromContent(content);
|
|
28601
28943
|
}, [pathname, subdomain, isEditMode]);
|
|
28602
|
-
|
|
28944
|
+
useEffect21(() => {
|
|
28603
28945
|
if (!isEditMode) return;
|
|
28604
28946
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28605
28947
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28607,12 +28949,12 @@ function OhhwellsBridge() {
|
|
|
28607
28949
|
deselectRef.current();
|
|
28608
28950
|
deactivateRef.current();
|
|
28609
28951
|
}, [pathname, isEditMode]);
|
|
28610
|
-
|
|
28952
|
+
useEffect21(() => {
|
|
28611
28953
|
if (!isEditMode) return;
|
|
28612
28954
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28613
28955
|
initItemInstancesFromContent(editContentRef.current);
|
|
28614
28956
|
}, [pathname, isEditMode]);
|
|
28615
|
-
|
|
28957
|
+
useEffect21(() => {
|
|
28616
28958
|
if (!isEditMode) return;
|
|
28617
28959
|
const observer = new MutationObserver(() => {
|
|
28618
28960
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28623,7 +28965,7 @@ function OhhwellsBridge() {
|
|
|
28623
28965
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28624
28966
|
return () => observer.disconnect();
|
|
28625
28967
|
}, [isEditMode, pathname]);
|
|
28626
|
-
|
|
28968
|
+
useEffect21(() => {
|
|
28627
28969
|
const contentForNav = () => {
|
|
28628
28970
|
if (isEditMode) return editContentRef.current;
|
|
28629
28971
|
if (!subdomain) return {};
|
|
@@ -28696,7 +29038,7 @@ function OhhwellsBridge() {
|
|
|
28696
29038
|
observer?.disconnect();
|
|
28697
29039
|
};
|
|
28698
29040
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28699
|
-
|
|
29041
|
+
useEffect21(() => {
|
|
28700
29042
|
if (!isEditMode) return;
|
|
28701
29043
|
let applying = false;
|
|
28702
29044
|
let rafId = null;
|
|
@@ -28734,7 +29076,7 @@ function OhhwellsBridge() {
|
|
|
28734
29076
|
observer.disconnect();
|
|
28735
29077
|
};
|
|
28736
29078
|
}, [isEditMode, pathname]);
|
|
28737
|
-
|
|
29079
|
+
useEffect21(() => {
|
|
28738
29080
|
if (!isEditMode) return;
|
|
28739
29081
|
let lastPosted = 0;
|
|
28740
29082
|
const measure = () => {
|
|
@@ -28756,29 +29098,14 @@ function OhhwellsBridge() {
|
|
|
28756
29098
|
const t2 = setTimeout(measure, 500);
|
|
28757
29099
|
const ro = new ResizeObserver(schedule);
|
|
28758
29100
|
ro.observe(document.body);
|
|
28759
|
-
let lastWidth = window.innerWidth;
|
|
28760
|
-
let resizeTimers = [];
|
|
28761
|
-
const clearResizeTimers = () => {
|
|
28762
|
-
resizeTimers.forEach(clearTimeout);
|
|
28763
|
-
resizeTimers = [];
|
|
28764
|
-
};
|
|
28765
|
-
const handleResize = () => {
|
|
28766
|
-
if (window.innerWidth === lastWidth) return;
|
|
28767
|
-
lastWidth = window.innerWidth;
|
|
28768
|
-
clearResizeTimers();
|
|
28769
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
28770
|
-
};
|
|
28771
|
-
window.addEventListener("resize", handleResize);
|
|
28772
29101
|
return () => {
|
|
28773
29102
|
clearTimeout(t1);
|
|
28774
29103
|
clearTimeout(t2);
|
|
28775
29104
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28776
29105
|
ro.disconnect();
|
|
28777
|
-
clearResizeTimers();
|
|
28778
|
-
window.removeEventListener("resize", handleResize);
|
|
28779
29106
|
};
|
|
28780
29107
|
}, [pathname, isEditMode, postToParent2]);
|
|
28781
|
-
|
|
29108
|
+
useEffect21(() => {
|
|
28782
29109
|
if (isEditMode) return;
|
|
28783
29110
|
const handleClick = (e) => {
|
|
28784
29111
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28792,7 +29119,7 @@ function OhhwellsBridge() {
|
|
|
28792
29119
|
document.addEventListener("click", handleClick, true);
|
|
28793
29120
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28794
29121
|
}, [isEditMode, router, pathname]);
|
|
28795
|
-
|
|
29122
|
+
useEffect21(() => {
|
|
28796
29123
|
if (!isEditMode) {
|
|
28797
29124
|
editStylesRef.current?.base.remove();
|
|
28798
29125
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -29072,6 +29399,13 @@ function OhhwellsBridge() {
|
|
|
29072
29399
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
29073
29400
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
29074
29401
|
if (isInsideLinkEditor(target)) return;
|
|
29402
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29403
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29404
|
+
if (target.closest(
|
|
29405
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29406
|
+
)) {
|
|
29407
|
+
return;
|
|
29408
|
+
}
|
|
29075
29409
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
29076
29410
|
clearMediaSelectionRef.current();
|
|
29077
29411
|
}
|
|
@@ -29095,8 +29429,6 @@ function OhhwellsBridge() {
|
|
|
29095
29429
|
return;
|
|
29096
29430
|
}
|
|
29097
29431
|
}
|
|
29098
|
-
if (isInsideFloatingPanel(target)) return;
|
|
29099
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29100
29432
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
29101
29433
|
if (collectionItem) {
|
|
29102
29434
|
e.preventDefault();
|
|
@@ -29108,11 +29440,6 @@ function OhhwellsBridge() {
|
|
|
29108
29440
|
});
|
|
29109
29441
|
return;
|
|
29110
29442
|
}
|
|
29111
|
-
if (target.closest(
|
|
29112
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29113
|
-
)) {
|
|
29114
|
-
return;
|
|
29115
|
-
}
|
|
29116
29443
|
{
|
|
29117
29444
|
const formEl = getFormElement(target);
|
|
29118
29445
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -29266,9 +29593,13 @@ function OhhwellsBridge() {
|
|
|
29266
29593
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
29267
29594
|
e.preventDefault();
|
|
29268
29595
|
e.stopPropagation();
|
|
29269
|
-
selectIconElementRef.current(editable);
|
|
29270
29596
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
29271
29597
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29598
|
+
if (aiIcon) {
|
|
29599
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29600
|
+
} else {
|
|
29601
|
+
selectIconElementRef.current(editable);
|
|
29602
|
+
}
|
|
29272
29603
|
postToParentRef.current({
|
|
29273
29604
|
type: "ow:icon-pick",
|
|
29274
29605
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29496,6 +29827,9 @@ function OhhwellsBridge() {
|
|
|
29496
29827
|
setHoveredItemRect(null);
|
|
29497
29828
|
hoveredNavContainerRef.current = null;
|
|
29498
29829
|
setHoveredNavContainerRect(null);
|
|
29830
|
+
siblingHintElRef.current = null;
|
|
29831
|
+
setSiblingHintRect(null);
|
|
29832
|
+
setSiblingHintRects([]);
|
|
29499
29833
|
return;
|
|
29500
29834
|
}
|
|
29501
29835
|
{
|
|
@@ -29616,7 +29950,6 @@ function OhhwellsBridge() {
|
|
|
29616
29950
|
hoveredNavContainerRef.current = null;
|
|
29617
29951
|
setHoveredNavContainerRect(null);
|
|
29618
29952
|
hoveredItemElRef.current = editable;
|
|
29619
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29620
29953
|
}
|
|
29621
29954
|
}
|
|
29622
29955
|
}
|
|
@@ -30326,7 +30659,11 @@ function OhhwellsBridge() {
|
|
|
30326
30659
|
};
|
|
30327
30660
|
const handleMouseMove = (e) => {
|
|
30328
30661
|
const { clientX, clientY } = e;
|
|
30329
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30662
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30663
|
+
dismissImageHover();
|
|
30664
|
+
clearImageHover();
|
|
30665
|
+
return;
|
|
30666
|
+
}
|
|
30330
30667
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30331
30668
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30332
30669
|
formHoverElRef.current = null;
|
|
@@ -30355,7 +30692,12 @@ function OhhwellsBridge() {
|
|
|
30355
30692
|
setHoveredItemRect(null);
|
|
30356
30693
|
hoveredNavContainerRef.current = null;
|
|
30357
30694
|
setHoveredNavContainerRect(null);
|
|
30695
|
+
siblingHintElRef.current = null;
|
|
30696
|
+
setSiblingHintRect(null);
|
|
30697
|
+
setSiblingHintRects([]);
|
|
30358
30698
|
dismissImageHover();
|
|
30699
|
+
clearImageHover();
|
|
30700
|
+
setSectionGap(null);
|
|
30359
30701
|
return;
|
|
30360
30702
|
}
|
|
30361
30703
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30367,7 +30709,11 @@ function OhhwellsBridge() {
|
|
|
30367
30709
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30368
30710
|
const { clientX, clientY } = e.data;
|
|
30369
30711
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30370
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30712
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30713
|
+
dismissImageHover();
|
|
30714
|
+
clearImageHover();
|
|
30715
|
+
return;
|
|
30716
|
+
}
|
|
30371
30717
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30372
30718
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30373
30719
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30747,6 +31093,7 @@ function OhhwellsBridge() {
|
|
|
30747
31093
|
applyAiFooterFromContent(content);
|
|
30748
31094
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30749
31095
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31096
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30750
31097
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30751
31098
|
}
|
|
30752
31099
|
applyBrandChrome(content);
|
|
@@ -30761,15 +31108,16 @@ function OhhwellsBridge() {
|
|
|
30761
31108
|
}
|
|
30762
31109
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30763
31110
|
if (key === AI_FOOTER_KEY) continue;
|
|
31111
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31112
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30764
31113
|
if (key === BRAND_KIT_KEY) continue;
|
|
30765
31114
|
if (key === STYLE_STORE_KEY) continue;
|
|
30766
31115
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30767
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30768
31116
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30769
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30770
31117
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30771
31118
|
continue;
|
|
30772
31119
|
}
|
|
31120
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30773
31121
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30774
31122
|
if (applyCarouselNode(key, val)) continue;
|
|
30775
31123
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30795,6 +31143,7 @@ function OhhwellsBridge() {
|
|
|
30795
31143
|
});
|
|
30796
31144
|
applyLinkByKey(key, val);
|
|
30797
31145
|
}
|
|
31146
|
+
applySectionEmbeds(content);
|
|
30798
31147
|
applyLogoFromContent(content);
|
|
30799
31148
|
applyLogoSizes(content);
|
|
30800
31149
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31022,6 +31371,31 @@ function OhhwellsBridge() {
|
|
|
31022
31371
|
postAiSectionsChanged();
|
|
31023
31372
|
};
|
|
31024
31373
|
window.addEventListener("message", handleAiDeleteSection);
|
|
31374
|
+
const handleAiMoveSection = (e) => {
|
|
31375
|
+
if (e.data?.type !== "ow:ai-move-section") return;
|
|
31376
|
+
const sectionId = typeof e.data.sectionId === "string" ? e.data.sectionId : "";
|
|
31377
|
+
const targetPage = typeof e.data.targetPage === "string" ? e.data.targetPage : "";
|
|
31378
|
+
if (!sectionId || !targetPage) return;
|
|
31379
|
+
const previous = aiSectionsRef.current;
|
|
31380
|
+
const nextState = moveSectionInState(parseAiSectionsState(previous), sectionId, targetPage);
|
|
31381
|
+
if (!nextState) return;
|
|
31382
|
+
clearInteractionChrome();
|
|
31383
|
+
const nextValue = serializeAiSectionsState(nextState);
|
|
31384
|
+
aiSectionsRef.current = nextValue;
|
|
31385
|
+
applyAiSectionsToDom(nextState);
|
|
31386
|
+
const newHeight = document.body.scrollHeight;
|
|
31387
|
+
if (newHeight > 50) postToParentRef.current({ type: "ow:height", height: newHeight });
|
|
31388
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: nextValue }] });
|
|
31389
|
+
postToParentRef.current({
|
|
31390
|
+
type: "ow:ai-section-moved",
|
|
31391
|
+
sectionId,
|
|
31392
|
+
targetPage,
|
|
31393
|
+
previous,
|
|
31394
|
+
value: nextValue
|
|
31395
|
+
});
|
|
31396
|
+
postAiSectionsChanged();
|
|
31397
|
+
};
|
|
31398
|
+
window.addEventListener("message", handleAiMoveSection);
|
|
31025
31399
|
const handleAiSetSections = (e) => {
|
|
31026
31400
|
if (e.data?.type !== "ow:ai-set-sections") return;
|
|
31027
31401
|
const value = typeof e.data.value === "string" ? e.data.value : "";
|
|
@@ -31402,6 +31776,12 @@ function OhhwellsBridge() {
|
|
|
31402
31776
|
closeLinkPopoverRef.current();
|
|
31403
31777
|
return;
|
|
31404
31778
|
}
|
|
31779
|
+
if (floatingPanelOpenRef.current) {
|
|
31780
|
+
setFloatingPanelRef.current(null);
|
|
31781
|
+
deselectRef.current();
|
|
31782
|
+
deactivateRef.current();
|
|
31783
|
+
return;
|
|
31784
|
+
}
|
|
31405
31785
|
deselectRef.current();
|
|
31406
31786
|
deactivateRef.current();
|
|
31407
31787
|
clearMediaSelectionRef.current();
|
|
@@ -32221,6 +32601,7 @@ function OhhwellsBridge() {
|
|
|
32221
32601
|
window.removeEventListener("message", handleAiApplyTree);
|
|
32222
32602
|
window.removeEventListener("message", handleAiApplyFooter);
|
|
32223
32603
|
window.removeEventListener("message", handleAiDeleteSection);
|
|
32604
|
+
window.removeEventListener("message", handleAiMoveSection);
|
|
32224
32605
|
window.removeEventListener("message", handleAiSetSections);
|
|
32225
32606
|
window.removeEventListener("message", handleAiSetBrand);
|
|
32226
32607
|
window.removeEventListener("message", handleAiSetStyles);
|
|
@@ -32237,17 +32618,17 @@ function OhhwellsBridge() {
|
|
|
32237
32618
|
window.removeEventListener("message", handleDuplicateSection);
|
|
32238
32619
|
window.removeEventListener("message", handleDeactivate);
|
|
32239
32620
|
window.removeEventListener("message", handleSelectNav);
|
|
32240
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32241
32621
|
window.removeEventListener("message", handleToastAction);
|
|
32242
32622
|
window.removeEventListener("message", handleFormCount);
|
|
32243
32623
|
window.removeEventListener("message", handleUiEscape);
|
|
32624
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
32244
32625
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
32245
32626
|
autoSaveTimers.current.clear();
|
|
32246
32627
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
32247
32628
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32248
32629
|
};
|
|
32249
32630
|
}, [isEditMode, refreshStateRules]);
|
|
32250
|
-
|
|
32631
|
+
useEffect21(() => {
|
|
32251
32632
|
if (!isEditMode) return;
|
|
32252
32633
|
const THRESHOLD = 10;
|
|
32253
32634
|
const resolveWasSelected = (el) => {
|
|
@@ -32403,7 +32784,7 @@ function OhhwellsBridge() {
|
|
|
32403
32784
|
unlockFooterDragInteraction();
|
|
32404
32785
|
};
|
|
32405
32786
|
}, [isEditMode]);
|
|
32406
|
-
|
|
32787
|
+
useEffect21(() => {
|
|
32407
32788
|
if (!isEditMode) return;
|
|
32408
32789
|
const THRESHOLD = 10;
|
|
32409
32790
|
const onPointerDown = (e) => {
|
|
@@ -32494,7 +32875,7 @@ function OhhwellsBridge() {
|
|
|
32494
32875
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32495
32876
|
};
|
|
32496
32877
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32497
|
-
|
|
32878
|
+
useEffect21(() => {
|
|
32498
32879
|
const handler = (e) => {
|
|
32499
32880
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32500
32881
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32510,7 +32891,7 @@ function OhhwellsBridge() {
|
|
|
32510
32891
|
window.addEventListener("message", handler);
|
|
32511
32892
|
return () => window.removeEventListener("message", handler);
|
|
32512
32893
|
}, [processConfigRequest]);
|
|
32513
|
-
|
|
32894
|
+
useEffect21(() => {
|
|
32514
32895
|
if (!isEditMode) return;
|
|
32515
32896
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32516
32897
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32534,7 +32915,7 @@ function OhhwellsBridge() {
|
|
|
32534
32915
|
postToParent2({
|
|
32535
32916
|
type: "ow:ready",
|
|
32536
32917
|
version: "1",
|
|
32537
|
-
bridgeVersion: "0.1.
|
|
32918
|
+
bridgeVersion: "0.1.166-next.442",
|
|
32538
32919
|
path: pathname,
|
|
32539
32920
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32540
32921
|
sections
|
|
@@ -32546,7 +32927,7 @@ function OhhwellsBridge() {
|
|
|
32546
32927
|
clearTimeout(timer);
|
|
32547
32928
|
};
|
|
32548
32929
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32549
|
-
|
|
32930
|
+
useEffect21(() => {
|
|
32550
32931
|
scrollToHashSectionWhenReady();
|
|
32551
32932
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32552
32933
|
window.addEventListener("hashchange", onHashChange);
|
|
@@ -32588,7 +32969,7 @@ function OhhwellsBridge() {
|
|
|
32588
32969
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32589
32970
|
refreshActiveCommandsRef.current();
|
|
32590
32971
|
}, []);
|
|
32591
|
-
|
|
32972
|
+
useEffect21(() => {
|
|
32592
32973
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32593
32974
|
if (!session || !logoSizeDraft) return;
|
|
32594
32975
|
const onPanelAction = (e) => {
|
|
@@ -33269,7 +33650,7 @@ function OhhwellsBridge() {
|
|
|
33269
33650
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
33270
33651
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
33271
33652
|
"data-ohw-add-field": "",
|
|
33272
|
-
children: /* @__PURE__ */ jsx40(
|
|
33653
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
33273
33654
|
}
|
|
33274
33655
|
),
|
|
33275
33656
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -33784,6 +34165,8 @@ export {
|
|
|
33784
34165
|
serializeAiFooterState,
|
|
33785
34166
|
shouldFetchContentForPath,
|
|
33786
34167
|
stepViableSlide,
|
|
34168
|
+
stripPlaceholderText,
|
|
34169
|
+
stripPlaceholders,
|
|
33787
34170
|
stripTextAlignCss,
|
|
33788
34171
|
toggleVariants,
|
|
33789
34172
|
useOhwCarousel,
|