@ohhwells/bridge 0.1.161 → 0.1.163-next.434
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/README.md +1 -1
- package/dist/index.cjs +1518 -1032
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.js +1323 -823
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs +9 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.d.cts +2 -0
- package/dist/pages.d.ts +2 -0
- package/dist/pages.js +9 -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 useEffect20, 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
|
|
|
@@ -840,6 +840,10 @@ function useOhwCarousel(key, initial) {
|
|
|
840
840
|
if (Array.isArray(detail?.images)) setImages(detail.images);
|
|
841
841
|
};
|
|
842
842
|
el.addEventListener(CAROUSEL_EVENT, onChange);
|
|
843
|
+
const pending = parseSlides(el.getAttribute(CAROUSEL_VALUE_ATTR));
|
|
844
|
+
if (pending.length > 0) {
|
|
845
|
+
setImages((prev) => JSON.stringify(prev) === JSON.stringify(pending) ? prev : pending);
|
|
846
|
+
}
|
|
843
847
|
return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
|
|
844
848
|
}, [key]);
|
|
845
849
|
const bind = {
|
|
@@ -1094,21 +1098,21 @@ function chromeFrom(sample) {
|
|
|
1094
1098
|
};
|
|
1095
1099
|
}
|
|
1096
1100
|
function filledPrimary(seed) {
|
|
1097
|
-
const
|
|
1098
|
-
const luminance = relativeLuminance(
|
|
1101
|
+
const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
|
|
1102
|
+
const luminance = relativeLuminance(paint2);
|
|
1099
1103
|
return {
|
|
1100
|
-
background: toCss({ ...
|
|
1104
|
+
background: toCss({ ...paint2, a: 1 }),
|
|
1101
1105
|
color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
|
|
1102
1106
|
borderColor: TRANSPARENT,
|
|
1103
1107
|
borderWidth: "0px"
|
|
1104
1108
|
};
|
|
1105
1109
|
}
|
|
1106
1110
|
function generatedSecondary(primary) {
|
|
1107
|
-
const
|
|
1111
|
+
const paint2 = accentColor(primary);
|
|
1108
1112
|
return {
|
|
1109
1113
|
background: TRANSPARENT,
|
|
1110
|
-
color:
|
|
1111
|
-
borderColor:
|
|
1114
|
+
color: paint2,
|
|
1115
|
+
borderColor: paint2,
|
|
1112
1116
|
borderWidth: "1px"
|
|
1113
1117
|
};
|
|
1114
1118
|
}
|
|
@@ -1121,9 +1125,9 @@ function generatedGhost(primary) {
|
|
|
1121
1125
|
};
|
|
1122
1126
|
}
|
|
1123
1127
|
function normalizeOutlineChrome(outline, primary) {
|
|
1124
|
-
const
|
|
1128
|
+
const paint2 = accentColor(primary);
|
|
1125
1129
|
const text = parseColor(outline.color);
|
|
1126
|
-
const paintRgb = parseColor(
|
|
1130
|
+
const paintRgb = parseColor(paint2);
|
|
1127
1131
|
const primaryLabel = parseColor(primary.color);
|
|
1128
1132
|
const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
|
|
1129
1133
|
const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
|
|
@@ -1132,8 +1136,8 @@ function normalizeOutlineChrome(outline, primary) {
|
|
|
1132
1136
|
const hasBorder = parseFloat(outline.borderWidth) > 0;
|
|
1133
1137
|
return {
|
|
1134
1138
|
...outline,
|
|
1135
|
-
color:
|
|
1136
|
-
borderColor: hasBorder ?
|
|
1139
|
+
color: paint2,
|
|
1140
|
+
borderColor: hasBorder ? paint2 : outline.borderColor
|
|
1137
1141
|
};
|
|
1138
1142
|
}
|
|
1139
1143
|
function generateButtonVariants(samples) {
|
|
@@ -3496,11 +3500,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
|
|
|
3496
3500
|
container.appendChild(column);
|
|
3497
3501
|
return { column, firstLink };
|
|
3498
3502
|
}
|
|
3499
|
-
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL,
|
|
3503
|
+
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
|
|
3500
3504
|
if (!canAddFooterColumn()) {
|
|
3501
3505
|
throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
|
|
3502
3506
|
}
|
|
3503
|
-
const resolvedHref =
|
|
3507
|
+
const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
|
|
3504
3508
|
const colIndex = getNextFooterColumnIndex();
|
|
3505
3509
|
const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
|
|
3506
3510
|
if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
|
|
@@ -3879,8 +3883,8 @@ function duplicateFooterItem(sourceAnchor) {
|
|
|
3879
3883
|
const column = findFooterColumnForLink(sourceAnchor);
|
|
3880
3884
|
if (!column) return null;
|
|
3881
3885
|
const href = getLinkHref(sourceAnchor);
|
|
3882
|
-
const
|
|
3883
|
-
const label = (
|
|
3886
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
3887
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
3884
3888
|
return insertFooterItem(column, href || "/", label, sourceAnchor);
|
|
3885
3889
|
}
|
|
3886
3890
|
function footerLabelKeyFromHrefKey(hrefKey) {
|
|
@@ -3890,8 +3894,8 @@ function deleteFooterItem(sourceAnchor) {
|
|
|
3890
3894
|
if (!isFooterLinkAnchor(sourceAnchor)) return null;
|
|
3891
3895
|
const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
3892
3896
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
|
|
3893
|
-
const
|
|
3894
|
-
const label = (
|
|
3897
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
3898
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
3895
3899
|
const labelKey = footerLabelKeyFromHrefKey(hrefKey);
|
|
3896
3900
|
const previousOrder = getFooterOrderFromDom();
|
|
3897
3901
|
const previousOrderJson = JSON.stringify(previousOrder);
|
|
@@ -4859,8 +4863,8 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4859
4863
|
const mapped = keyMap.get(oldHrefKey);
|
|
4860
4864
|
if (!mapped) return;
|
|
4861
4865
|
el.setAttribute("data-ohw-href-key", mapped.hrefKey);
|
|
4862
|
-
const
|
|
4863
|
-
if (
|
|
4866
|
+
const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
|
|
4867
|
+
if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
|
|
4864
4868
|
};
|
|
4865
4869
|
if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
|
|
4866
4870
|
root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
|
|
@@ -4868,10 +4872,10 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4868
4872
|
function readNavLinkSnapshot(hrefKey) {
|
|
4869
4873
|
const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
4870
4874
|
if (!el) return { href: "/", label: "Untitled" };
|
|
4871
|
-
const
|
|
4875
|
+
const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
|
|
4872
4876
|
return {
|
|
4873
4877
|
href: getLinkHref2(el),
|
|
4874
|
-
label: (
|
|
4878
|
+
label: (labelEl2?.textContent ?? "").trim() || "Untitled"
|
|
4875
4879
|
};
|
|
4876
4880
|
}
|
|
4877
4881
|
function findClonedNavAnchor(unit, hrefKey) {
|
|
@@ -5045,8 +5049,8 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5045
5049
|
if (!isNavbarLinkItem(sourceAnchor)) return null;
|
|
5046
5050
|
const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
5047
5051
|
if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
|
|
5048
|
-
const
|
|
5049
|
-
const label = (
|
|
5052
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
5053
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
5050
5054
|
const previousForest = getNavForestFromDom();
|
|
5051
5055
|
const previousOrderJson = serializeNavOrder(previousForest);
|
|
5052
5056
|
const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
|
|
@@ -6649,6 +6653,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
6649
6653
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
6650
6654
|
return target ? pricingFeatureList(target).length : 0;
|
|
6651
6655
|
}
|
|
6656
|
+
function prevailingFeatureIcon(features) {
|
|
6657
|
+
const counts = /* @__PURE__ */ new Map();
|
|
6658
|
+
for (const row of features) {
|
|
6659
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
6660
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
6661
|
+
entry.count += 1;
|
|
6662
|
+
counts.set(key, entry);
|
|
6663
|
+
}
|
|
6664
|
+
let best = null;
|
|
6665
|
+
for (const entry of counts.values()) {
|
|
6666
|
+
if (!best || entry.count > best.count) best = entry;
|
|
6667
|
+
}
|
|
6668
|
+
if (!best) return {};
|
|
6669
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
6670
|
+
}
|
|
6652
6671
|
function addPricingCardFeature(tree, index, text) {
|
|
6653
6672
|
return withPricingCollection(tree, (collection) => {
|
|
6654
6673
|
const children = collection.children;
|
|
@@ -6657,7 +6676,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
6657
6676
|
const features = pricingFeatureList(target);
|
|
6658
6677
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
6659
6678
|
target.slots = target.slots ?? {};
|
|
6660
|
-
target.slots.features = [...features, { text }];
|
|
6679
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
6661
6680
|
return true;
|
|
6662
6681
|
});
|
|
6663
6682
|
}
|
|
@@ -7301,6 +7320,120 @@ function findSelectableNavContainer(doc = document) {
|
|
|
7301
7320
|
);
|
|
7302
7321
|
}
|
|
7303
7322
|
|
|
7323
|
+
// src/lib/youtube.ts
|
|
7324
|
+
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
7325
|
+
function extractYouTubeId(input) {
|
|
7326
|
+
const trimmed = input.trim();
|
|
7327
|
+
if (!trimmed) return null;
|
|
7328
|
+
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
7329
|
+
let url;
|
|
7330
|
+
try {
|
|
7331
|
+
url = new URL(trimmed);
|
|
7332
|
+
} catch {
|
|
7333
|
+
return null;
|
|
7334
|
+
}
|
|
7335
|
+
const host = url.hostname.replace(/^www\./, "");
|
|
7336
|
+
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
7337
|
+
return null;
|
|
7338
|
+
}
|
|
7339
|
+
let candidate = null;
|
|
7340
|
+
if (host === "youtu.be") {
|
|
7341
|
+
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
7342
|
+
} else if (url.pathname === "/watch") {
|
|
7343
|
+
candidate = url.searchParams.get("v");
|
|
7344
|
+
} else {
|
|
7345
|
+
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
7346
|
+
candidate = match ? match[1] : null;
|
|
7347
|
+
}
|
|
7348
|
+
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
7349
|
+
}
|
|
7350
|
+
|
|
7351
|
+
// src/lib/section-embed.ts
|
|
7352
|
+
var SECTION_EMBED_SUFFIX = "__ohw_embed";
|
|
7353
|
+
function readStoredEmbed(value) {
|
|
7354
|
+
if (value.startsWith("start\n")) {
|
|
7355
|
+
return { raw: value.slice("start\n".length), at: "start" };
|
|
7356
|
+
}
|
|
7357
|
+
return { raw: value, at: "end" };
|
|
7358
|
+
}
|
|
7359
|
+
function embedFrameSrc(value) {
|
|
7360
|
+
const videoId = extractYouTubeId(value);
|
|
7361
|
+
if (videoId) {
|
|
7362
|
+
return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
|
|
7363
|
+
}
|
|
7364
|
+
let url;
|
|
7365
|
+
try {
|
|
7366
|
+
url = new URL(value);
|
|
7367
|
+
} catch {
|
|
7368
|
+
return null;
|
|
7369
|
+
}
|
|
7370
|
+
const host = url.hostname.replace(/^www\./, "").toLowerCase();
|
|
7371
|
+
if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
|
|
7372
|
+
const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
|
|
7373
|
+
const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
|
|
7374
|
+
return { src, title: "Map" };
|
|
7375
|
+
}
|
|
7376
|
+
if (host === "maps.app.goo.gl") {
|
|
7377
|
+
return { src: value, title: "Map" };
|
|
7378
|
+
}
|
|
7379
|
+
if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
|
|
7380
|
+
return { src: value, title: "Calendar" };
|
|
7381
|
+
}
|
|
7382
|
+
if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
|
|
7383
|
+
return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
|
|
7384
|
+
}
|
|
7385
|
+
if (host === "forms.gle") {
|
|
7386
|
+
return { src: value, title: "Form" };
|
|
7387
|
+
}
|
|
7388
|
+
return null;
|
|
7389
|
+
}
|
|
7390
|
+
function place(section, box, at) {
|
|
7391
|
+
if (at === "start") {
|
|
7392
|
+
section.insertBefore(box, section.firstChild);
|
|
7393
|
+
return;
|
|
7394
|
+
}
|
|
7395
|
+
section.appendChild(box);
|
|
7396
|
+
}
|
|
7397
|
+
function paint(section, key, src, title, at) {
|
|
7398
|
+
const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
|
|
7399
|
+
const frame = existing?.querySelector("iframe");
|
|
7400
|
+
if (existing && frame) {
|
|
7401
|
+
if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
|
|
7402
|
+
frame.title = title;
|
|
7403
|
+
place(section, existing, at);
|
|
7404
|
+
return;
|
|
7405
|
+
}
|
|
7406
|
+
existing?.remove();
|
|
7407
|
+
const box = document.createElement("div");
|
|
7408
|
+
box.setAttribute("data-ohw-section-embed", key);
|
|
7409
|
+
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;";
|
|
7410
|
+
const frameWrap = document.createElement("div");
|
|
7411
|
+
frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
|
|
7412
|
+
const iframe = document.createElement("iframe");
|
|
7413
|
+
iframe.src = src;
|
|
7414
|
+
iframe.title = title;
|
|
7415
|
+
iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
|
|
7416
|
+
iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
|
|
7417
|
+
iframe.setAttribute("allowfullscreen", "");
|
|
7418
|
+
frameWrap.appendChild(iframe);
|
|
7419
|
+
box.appendChild(frameWrap);
|
|
7420
|
+
place(section, box, at);
|
|
7421
|
+
}
|
|
7422
|
+
function applySectionEmbeds(content) {
|
|
7423
|
+
for (const [key, val] of Object.entries(content)) {
|
|
7424
|
+
if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
7425
|
+
const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
|
|
7426
|
+
const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
7427
|
+
const stored = typeof val === "string" ? readStoredEmbed(val) : null;
|
|
7428
|
+
const frame = stored ? embedFrameSrc(stored.raw) : null;
|
|
7429
|
+
if (!section || !stored || !frame) {
|
|
7430
|
+
section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
|
|
7431
|
+
continue;
|
|
7432
|
+
}
|
|
7433
|
+
paint(section, key, frame.src, frame.title, stored.at);
|
|
7434
|
+
}
|
|
7435
|
+
}
|
|
7436
|
+
|
|
7304
7437
|
// src/ui/ai-tree/aiSectionsManager.tsx
|
|
7305
7438
|
import { flushSync } from "react-dom";
|
|
7306
7439
|
import { createRoot } from "react-dom/client";
|
|
@@ -7874,7 +8007,7 @@ var AI_MOBILE_CSS = [
|
|
|
7874
8007
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
7875
8008
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
7876
8009
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
7877
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
8010
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
7878
8011
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
7879
8012
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
7880
8013
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -7890,8 +8023,10 @@ var AI_MOBILE_CSS = [
|
|
|
7890
8023
|
"[data-ai-section]{overflow-x:hidden}",
|
|
7891
8024
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
7892
8025
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
7893
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
7894
|
-
|
|
8026
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
8027
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
8028
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
8029
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
7895
8030
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
7896
8031
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
7897
8032
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -8096,6 +8231,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
8096
8231
|
function textAttrs(ctx, path) {
|
|
8097
8232
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
8098
8233
|
}
|
|
8234
|
+
var AI_RESPONSIVE_CSS = [
|
|
8235
|
+
"@media (max-width: 960px) {",
|
|
8236
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
8237
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
8238
|
+
"}",
|
|
8239
|
+
"@media (max-width: 640px) {",
|
|
8240
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
8241
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
8242
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
8243
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
8244
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
8245
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
8246
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
8247
|
+
// layered text used to be.
|
|
8248
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
8249
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
8250
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
8251
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
8252
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
8253
|
+
// other rule had already been taught to stand down.
|
|
8254
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
8255
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
8256
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
8257
|
+
"}"
|
|
8258
|
+
].join("\n");
|
|
8099
8259
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
8100
8260
|
function MediaBox({
|
|
8101
8261
|
refValue,
|
|
@@ -8150,7 +8310,7 @@ function MediaBox({
|
|
|
8150
8310
|
position: fill ? "absolute" : void 0,
|
|
8151
8311
|
inset: fill ? 0 : void 0,
|
|
8152
8312
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
8153
|
-
height: fill ? "100%" : void 0,
|
|
8313
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
8154
8314
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
8155
8315
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
8156
8316
|
borderRadius: radius,
|
|
@@ -9646,7 +9806,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
9646
9806
|
return /* @__PURE__ */ jsx(
|
|
9647
9807
|
"div",
|
|
9648
9808
|
{
|
|
9649
|
-
"data-ai-grid":
|
|
9809
|
+
"data-ai-grid": String(itemsPerRow),
|
|
9650
9810
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
9651
9811
|
style: {
|
|
9652
9812
|
display: "grid",
|
|
@@ -9948,7 +10108,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
9948
10108
|
},
|
|
9949
10109
|
children: [
|
|
9950
10110
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
9951
|
-
// The section's `data-ai-
|
|
10111
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
9952
10112
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
9953
10113
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
9954
10114
|
// the full section width instead of reading at the usual content width.
|
|
@@ -10367,6 +10527,7 @@ function AiTreeRenderer({
|
|
|
10367
10527
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
10368
10528
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
10369
10529
|
...bgAttrs,
|
|
10530
|
+
"data-ai-responsive": "",
|
|
10370
10531
|
style: {
|
|
10371
10532
|
position: "relative",
|
|
10372
10533
|
padding: `${padCss} 0`,
|
|
@@ -10380,12 +10541,13 @@ function AiTreeRenderer({
|
|
|
10380
10541
|
...fillHeight ? { display: "grid" } : {}
|
|
10381
10542
|
},
|
|
10382
10543
|
children: [
|
|
10383
|
-
|
|
10544
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
10384
10545
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
10546
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
10385
10547
|
/* @__PURE__ */ jsx(
|
|
10386
10548
|
"div",
|
|
10387
10549
|
{
|
|
10388
|
-
"data-ai-
|
|
10550
|
+
"data-ai-section-inner": "",
|
|
10389
10551
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
10390
10552
|
style: {
|
|
10391
10553
|
position: "relative",
|
|
@@ -10402,7 +10564,7 @@ function AiTreeRenderer({
|
|
|
10402
10564
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
10403
10565
|
"div",
|
|
10404
10566
|
{
|
|
10405
|
-
"data-ai-
|
|
10567
|
+
"data-ai-columns": "",
|
|
10406
10568
|
style: {
|
|
10407
10569
|
display: "grid",
|
|
10408
10570
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -11064,9 +11226,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
11064
11226
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
11065
11227
|
continue;
|
|
11066
11228
|
}
|
|
11067
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
11068
11229
|
let container = existing?.container;
|
|
11230
|
+
let isNewMount = false;
|
|
11069
11231
|
if (!container || !container.isConnected) {
|
|
11232
|
+
isNewMount = true;
|
|
11070
11233
|
existing?.root.unmount();
|
|
11071
11234
|
container?.remove();
|
|
11072
11235
|
container = document.createElement("div");
|
|
@@ -11404,6 +11567,34 @@ function minSpanForFooterBlock(type) {
|
|
|
11404
11567
|
return 3;
|
|
11405
11568
|
}
|
|
11406
11569
|
}
|
|
11570
|
+
function readLiveSocialItems() {
|
|
11571
|
+
const root = getFooterRoot();
|
|
11572
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
11573
|
+
if (!row) return [];
|
|
11574
|
+
const items = [];
|
|
11575
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
11576
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
11577
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
11578
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
11579
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
11580
|
+
items.push({ platform, href });
|
|
11581
|
+
}
|
|
11582
|
+
return items;
|
|
11583
|
+
}
|
|
11584
|
+
function syncSocialRowsFromDom(tree) {
|
|
11585
|
+
const root = getFooterRoot();
|
|
11586
|
+
if (!root) return;
|
|
11587
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
11588
|
+
const live = readLiveSocialItems();
|
|
11589
|
+
if (row && live.length === 0) return;
|
|
11590
|
+
for (const col of tree.columns) {
|
|
11591
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
11592
|
+
if (block.type !== "social-row") return [block];
|
|
11593
|
+
if (!row) return [];
|
|
11594
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
11595
|
+
});
|
|
11596
|
+
}
|
|
11597
|
+
}
|
|
11407
11598
|
function collectBrandBlocks(tree) {
|
|
11408
11599
|
const brand = [];
|
|
11409
11600
|
for (const col of tree.columns) {
|
|
@@ -11649,12 +11840,13 @@ function textOf2(el) {
|
|
|
11649
11840
|
}
|
|
11650
11841
|
function syncFooterTreeLinksFromDom(tree) {
|
|
11651
11842
|
const next = cloneTree(tree);
|
|
11843
|
+
syncSocialRowsFromDom(next);
|
|
11652
11844
|
const domCols = listFooterColumns().map((col) => {
|
|
11653
11845
|
const heading = getFooterColumnHeadingEl(col);
|
|
11654
11846
|
const title = heading ? textOf2(heading) : void 0;
|
|
11655
11847
|
const items = listFooterLinksInColumn(col).map((anchor) => {
|
|
11656
|
-
const
|
|
11657
|
-
const label = textOf2(
|
|
11848
|
+
const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11849
|
+
const label = textOf2(labelEl2) || textOf2(anchor);
|
|
11658
11850
|
const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
|
|
11659
11851
|
return label ? { label, href: href || "home" } : null;
|
|
11660
11852
|
}).filter((x) => Boolean(x));
|
|
@@ -17353,7 +17545,7 @@ function apiBase() {
|
|
|
17353
17545
|
function bridgeVersion() {
|
|
17354
17546
|
try {
|
|
17355
17547
|
if (true) {
|
|
17356
|
-
return "0.1.
|
|
17548
|
+
return "0.1.163-next.434";
|
|
17357
17549
|
}
|
|
17358
17550
|
} catch {
|
|
17359
17551
|
}
|
|
@@ -17367,7 +17559,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17367
17559
|
return;
|
|
17368
17560
|
}
|
|
17369
17561
|
try {
|
|
17370
|
-
const v = true ? "0.1.
|
|
17562
|
+
const v = true ? "0.1.163-next.434" : "";
|
|
17371
17563
|
if (v) {
|
|
17372
17564
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17373
17565
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18045,6 +18237,7 @@ function MediaOverlay({
|
|
|
18045
18237
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
18046
18238
|
);
|
|
18047
18239
|
}, [isVideo]);
|
|
18240
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
18048
18241
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
18049
18242
|
const box = {
|
|
18050
18243
|
position: "fixed",
|
|
@@ -18143,11 +18336,10 @@ function MediaOverlay({
|
|
|
18143
18336
|
className: "flex items-center justify-center cursor-pointer",
|
|
18144
18337
|
style: {
|
|
18145
18338
|
...box,
|
|
18146
|
-
//
|
|
18147
|
-
//
|
|
18148
|
-
//
|
|
18149
|
-
|
|
18150
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
18339
|
+
// Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
|
|
18340
|
+
// (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
|
|
18341
|
+
// and cueOnly also need clicks to fall through — Replace / video controls opt back in.
|
|
18342
|
+
pointerEvents: "none",
|
|
18151
18343
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
18152
18344
|
// than hovered. Hover keeps the existing tinted preview.
|
|
18153
18345
|
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
@@ -18174,17 +18366,17 @@ function MediaOverlay({
|
|
|
18174
18366
|
},
|
|
18175
18367
|
children: [
|
|
18176
18368
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18177
|
-
|
|
18369
|
+
replaceLabel
|
|
18178
18370
|
]
|
|
18179
18371
|
}
|
|
18180
18372
|
),
|
|
18181
|
-
replaceMode
|
|
18373
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
18182
18374
|
Button,
|
|
18183
18375
|
{
|
|
18184
18376
|
"data-ohw-media-overlay": "",
|
|
18185
18377
|
variant: "outline",
|
|
18186
18378
|
size: "sm",
|
|
18187
|
-
"aria-label":
|
|
18379
|
+
"aria-label": replaceLabel,
|
|
18188
18380
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
18189
18381
|
style: {
|
|
18190
18382
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -18207,7 +18399,7 @@ function MediaOverlay({
|
|
|
18207
18399
|
},
|
|
18208
18400
|
children: [
|
|
18209
18401
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
18210
|
-
replaceMode === "full" ?
|
|
18402
|
+
replaceMode === "full" ? replaceLabel : null
|
|
18211
18403
|
]
|
|
18212
18404
|
}
|
|
18213
18405
|
)
|
|
@@ -18800,8 +18992,24 @@ function AiSectionOverlay({
|
|
|
18800
18992
|
}
|
|
18801
18993
|
|
|
18802
18994
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18803
|
-
import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef5, useState as useState8 } from "react";
|
|
18804
|
-
import {
|
|
18995
|
+
import { useCallback as useCallback3, useEffect as useEffect8, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
18996
|
+
import {
|
|
18997
|
+
AlignCenter,
|
|
18998
|
+
AlignLeft,
|
|
18999
|
+
AlignRight,
|
|
19000
|
+
ArrowLeft as ArrowLeft2,
|
|
19001
|
+
ArrowRight as ArrowRight2,
|
|
19002
|
+
Check as Check2,
|
|
19003
|
+
ChevronDown as ChevronDown3,
|
|
19004
|
+
Image as ImageIcon2,
|
|
19005
|
+
ImageMinus,
|
|
19006
|
+
ImagePlus,
|
|
19007
|
+
Link as LinkIcon,
|
|
19008
|
+
Minus,
|
|
19009
|
+
Palette,
|
|
19010
|
+
Plus as Plus2,
|
|
19011
|
+
Star
|
|
19012
|
+
} from "lucide-react";
|
|
18805
19013
|
|
|
18806
19014
|
// src/lib/ai-media-strip-tree.ts
|
|
18807
19015
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -18915,14 +19123,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
18915
19123
|
return true;
|
|
18916
19124
|
});
|
|
18917
19125
|
}
|
|
18918
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
18919
|
-
return withMediaStrip(tree, (block) => {
|
|
18920
|
-
const items = block.items;
|
|
18921
|
-
if (index < 0 || index >= items.length) return false;
|
|
18922
|
-
items[index] = { ...items[index], alt };
|
|
18923
|
-
return true;
|
|
18924
|
-
});
|
|
18925
|
-
}
|
|
18926
19126
|
function setMediaStripItemLink(tree, index, link) {
|
|
18927
19127
|
return withMediaStrip(tree, (block) => {
|
|
18928
19128
|
const items = block.items;
|
|
@@ -18940,11 +19140,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
18940
19140
|
});
|
|
18941
19141
|
}
|
|
18942
19142
|
|
|
19143
|
+
// src/ui/dialog.tsx
|
|
19144
|
+
import * as React9 from "react";
|
|
19145
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
19146
|
+
import { X as X2 } from "lucide-react";
|
|
19147
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
19148
|
+
function Dialog2({
|
|
19149
|
+
...props
|
|
19150
|
+
}) {
|
|
19151
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
19152
|
+
}
|
|
19153
|
+
function DialogPortal({
|
|
19154
|
+
...props
|
|
19155
|
+
}) {
|
|
19156
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
19157
|
+
}
|
|
19158
|
+
function DialogOverlay({
|
|
19159
|
+
className,
|
|
19160
|
+
...props
|
|
19161
|
+
}) {
|
|
19162
|
+
return /* @__PURE__ */ jsx20(
|
|
19163
|
+
DialogPrimitive.Overlay,
|
|
19164
|
+
{
|
|
19165
|
+
"data-slot": "dialog-overlay",
|
|
19166
|
+
"data-ohw-link-modal-root": "",
|
|
19167
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
19168
|
+
...props
|
|
19169
|
+
}
|
|
19170
|
+
);
|
|
19171
|
+
}
|
|
19172
|
+
var DialogContent = React9.forwardRef(
|
|
19173
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
19174
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
19175
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
19176
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
19177
|
+
/* @__PURE__ */ jsxs11(
|
|
19178
|
+
DialogPrimitive.Content,
|
|
19179
|
+
{
|
|
19180
|
+
ref,
|
|
19181
|
+
"data-slot": "dialog-content",
|
|
19182
|
+
className: cn(
|
|
19183
|
+
positionMode,
|
|
19184
|
+
"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",
|
|
19185
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
19186
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
19187
|
+
className
|
|
19188
|
+
),
|
|
19189
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19190
|
+
...props,
|
|
19191
|
+
children: [
|
|
19192
|
+
children,
|
|
19193
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
19194
|
+
DialogPrimitive.Close,
|
|
19195
|
+
{
|
|
19196
|
+
type: "button",
|
|
19197
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
19198
|
+
"aria-label": "Close",
|
|
19199
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
19200
|
+
}
|
|
19201
|
+
) : null
|
|
19202
|
+
]
|
|
19203
|
+
}
|
|
19204
|
+
)
|
|
19205
|
+
] });
|
|
19206
|
+
}
|
|
19207
|
+
);
|
|
19208
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
19209
|
+
function DialogHeader({
|
|
19210
|
+
className,
|
|
19211
|
+
...props
|
|
19212
|
+
}) {
|
|
19213
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
19214
|
+
}
|
|
19215
|
+
function DialogFooter({
|
|
19216
|
+
className,
|
|
19217
|
+
...props
|
|
19218
|
+
}) {
|
|
19219
|
+
return /* @__PURE__ */ jsx20(
|
|
19220
|
+
"div",
|
|
19221
|
+
{
|
|
19222
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
19223
|
+
...props
|
|
19224
|
+
}
|
|
19225
|
+
);
|
|
19226
|
+
}
|
|
19227
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19228
|
+
DialogPrimitive.Title,
|
|
19229
|
+
{
|
|
19230
|
+
ref,
|
|
19231
|
+
className: cn(
|
|
19232
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
19233
|
+
className
|
|
19234
|
+
),
|
|
19235
|
+
...props
|
|
19236
|
+
}
|
|
19237
|
+
));
|
|
19238
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
19239
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
19240
|
+
DialogPrimitive.Description,
|
|
19241
|
+
{
|
|
19242
|
+
ref,
|
|
19243
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
19244
|
+
...props
|
|
19245
|
+
}
|
|
19246
|
+
));
|
|
19247
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
19248
|
+
var DialogClose = DialogPrimitive.Close;
|
|
19249
|
+
|
|
18943
19250
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18944
|
-
import { Fragment as Fragment7, jsx as
|
|
18945
|
-
var PRIMARY3 = "#0885FE";
|
|
18946
|
-
var
|
|
18947
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
19251
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19252
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
19253
|
+
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]";
|
|
18948
19254
|
function findMediaStripItemElement(sectionId, index) {
|
|
18949
19255
|
const sectionEl = findByInstanceId(sectionId);
|
|
18950
19256
|
if (!sectionEl) return null;
|
|
@@ -18954,14 +19260,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
18954
19260
|
}
|
|
18955
19261
|
return null;
|
|
18956
19262
|
}
|
|
18957
|
-
function
|
|
18958
|
-
|
|
19263
|
+
function itemRefFromTarget(target) {
|
|
19264
|
+
if (!(target instanceof Element)) return null;
|
|
19265
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
19266
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
19267
|
+
if (!itemEl) return null;
|
|
19268
|
+
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19269
|
+
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19270
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19271
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19272
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
19273
|
+
return { sectionId, index };
|
|
19274
|
+
}
|
|
19275
|
+
function sameRef(a, b) {
|
|
19276
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19277
|
+
}
|
|
19278
|
+
function rectOf(el) {
|
|
18959
19279
|
if (!el) return null;
|
|
18960
19280
|
const r2 = el.getBoundingClientRect();
|
|
18961
19281
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
18962
19282
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
18963
19283
|
}
|
|
18964
|
-
function
|
|
19284
|
+
function readRect2(ref) {
|
|
19285
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
19286
|
+
}
|
|
19287
|
+
function readStripRect(ref) {
|
|
19288
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
19289
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
19290
|
+
}
|
|
19291
|
+
function useLiveItemRect(ref, strip = false) {
|
|
18965
19292
|
const [rect, setRect] = useState8(null);
|
|
18966
19293
|
useEffect8(() => {
|
|
18967
19294
|
if (!ref) {
|
|
@@ -18969,7 +19296,7 @@ function useLiveItemRect(ref) {
|
|
|
18969
19296
|
return;
|
|
18970
19297
|
}
|
|
18971
19298
|
const update = () => {
|
|
18972
|
-
const next = readRect2(ref);
|
|
19299
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
18973
19300
|
setRect(
|
|
18974
19301
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
18975
19302
|
);
|
|
@@ -18984,9 +19311,49 @@ function useLiveItemRect(ref) {
|
|
|
18984
19311
|
window.removeEventListener("resize", update);
|
|
18985
19312
|
clearInterval(interval);
|
|
18986
19313
|
};
|
|
18987
|
-
}, [ref?.sectionId, ref?.index]);
|
|
19314
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
18988
19315
|
return rect;
|
|
18989
19316
|
}
|
|
19317
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
19318
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
19319
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
19320
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
19321
|
+
const slotRef = useRef5(null);
|
|
19322
|
+
const [shift, setShift] = useState8(0);
|
|
19323
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
19324
|
+
useLayoutEffect4(() => {
|
|
19325
|
+
const slot = slotRef.current;
|
|
19326
|
+
if (!slot) return;
|
|
19327
|
+
const clamp = () => {
|
|
19328
|
+
const w = slot.offsetWidth;
|
|
19329
|
+
if (w <= 0) return;
|
|
19330
|
+
const half = w / 2;
|
|
19331
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
19332
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19333
|
+
};
|
|
19334
|
+
clamp();
|
|
19335
|
+
const ro = new ResizeObserver(clamp);
|
|
19336
|
+
ro.observe(slot);
|
|
19337
|
+
return () => ro.disconnect();
|
|
19338
|
+
}, [centerX, children]);
|
|
19339
|
+
const mobile = window.innerWidth <= 480;
|
|
19340
|
+
return /* @__PURE__ */ jsx21(
|
|
19341
|
+
"div",
|
|
19342
|
+
{
|
|
19343
|
+
ref: slotRef,
|
|
19344
|
+
"data-ohw-bridge": "",
|
|
19345
|
+
"data-ohw-item-interaction": "",
|
|
19346
|
+
className: "pointer-events-auto fixed",
|
|
19347
|
+
style: {
|
|
19348
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
19349
|
+
left: centerX + shift,
|
|
19350
|
+
transform: "translate(-50%, -100%)",
|
|
19351
|
+
zIndex: 2147483645
|
|
19352
|
+
},
|
|
19353
|
+
children
|
|
19354
|
+
}
|
|
19355
|
+
);
|
|
19356
|
+
}
|
|
18990
19357
|
function requestValidateTree(postToParent2, tree) {
|
|
18991
19358
|
return new Promise((resolve) => {
|
|
18992
19359
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -19023,116 +19390,72 @@ function requestAssetPick(postToParent2) {
|
|
|
19023
19390
|
postToParent2({ type: "ow:asset-pick", id });
|
|
19024
19391
|
});
|
|
19025
19392
|
}
|
|
19026
|
-
function
|
|
19393
|
+
function ToolbarAction({
|
|
19027
19394
|
label,
|
|
19028
19395
|
onClick,
|
|
19029
|
-
disabled,
|
|
19030
|
-
active
|
|
19396
|
+
disabled = false,
|
|
19397
|
+
active = false,
|
|
19398
|
+
children
|
|
19031
19399
|
}) {
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
{
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
disabled,
|
|
19038
|
-
style: {
|
|
19039
|
-
height: 28,
|
|
19040
|
-
padding: "0 10px",
|
|
19041
|
-
display: "inline-flex",
|
|
19042
|
-
alignItems: "center",
|
|
19043
|
-
gap: 4,
|
|
19044
|
-
borderRadius: 999,
|
|
19045
|
-
border: "none",
|
|
19046
|
-
cursor: disabled ? "default" : "pointer",
|
|
19047
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
19048
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
19049
|
-
opacity: disabled ? 0.4 : 1,
|
|
19050
|
-
fontSize: 12,
|
|
19051
|
-
lineHeight: "16px",
|
|
19052
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19053
|
-
whiteSpace: "nowrap",
|
|
19054
|
-
flex: "0 0 auto"
|
|
19055
|
-
},
|
|
19056
|
-
children: label
|
|
19057
|
-
}
|
|
19058
|
-
);
|
|
19400
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
19401
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19402
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
19403
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19404
|
+
] });
|
|
19059
19405
|
}
|
|
19060
|
-
function
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
},
|
|
19090
|
-
children: "Alt"
|
|
19091
|
-
}
|
|
19092
|
-
),
|
|
19093
|
-
/* @__PURE__ */ jsx20(
|
|
19094
|
-
"input",
|
|
19406
|
+
function ToolbarSeparator() {
|
|
19407
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19408
|
+
}
|
|
19409
|
+
function OptionMenu({
|
|
19410
|
+
label,
|
|
19411
|
+
value,
|
|
19412
|
+
options,
|
|
19413
|
+
onChange
|
|
19414
|
+
}) {
|
|
19415
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
19416
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
19417
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
19418
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
19419
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
19420
|
+
"button",
|
|
19421
|
+
{
|
|
19422
|
+
type: "button",
|
|
19423
|
+
"aria-label": label,
|
|
19424
|
+
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",
|
|
19425
|
+
children: [
|
|
19426
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
19427
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
19428
|
+
]
|
|
19429
|
+
}
|
|
19430
|
+
) }),
|
|
19431
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
19432
|
+
const selected = option.value === value;
|
|
19433
|
+
return /* @__PURE__ */ jsxs12(
|
|
19434
|
+
DropdownMenuItem,
|
|
19095
19435
|
{
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
"aria-label": "Image alt text",
|
|
19111
|
-
style: {
|
|
19112
|
-
flex: 1,
|
|
19113
|
-
minWidth: 0,
|
|
19114
|
-
border: "none",
|
|
19115
|
-
outline: "none",
|
|
19116
|
-
background: "transparent",
|
|
19117
|
-
fontSize: 12,
|
|
19118
|
-
lineHeight: "16px",
|
|
19119
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19120
|
-
color: "#1f2937"
|
|
19121
|
-
}
|
|
19122
|
-
}
|
|
19123
|
-
)
|
|
19124
|
-
]
|
|
19125
|
-
}
|
|
19126
|
-
);
|
|
19436
|
+
role: "menuitemradio",
|
|
19437
|
+
"aria-checked": selected,
|
|
19438
|
+
onSelect: () => onChange(option.value),
|
|
19439
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19440
|
+
children: [
|
|
19441
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
19442
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
19443
|
+
]
|
|
19444
|
+
},
|
|
19445
|
+
option.value
|
|
19446
|
+
);
|
|
19447
|
+
}) })
|
|
19448
|
+
] })
|
|
19449
|
+
] });
|
|
19127
19450
|
}
|
|
19128
19451
|
var VARIANTS = [
|
|
19129
19452
|
{ value: "logos", label: "Logos" },
|
|
19130
19453
|
{ value: "reel", label: "Reel" }
|
|
19131
19454
|
];
|
|
19132
19455
|
var ALIGNS = [
|
|
19133
|
-
{ value: "left", label: "
|
|
19134
|
-
{ value: "center", label: "
|
|
19135
|
-
{ value: "right", label: "
|
|
19456
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
19457
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
19458
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
19136
19459
|
];
|
|
19137
19460
|
var HOVERS = [
|
|
19138
19461
|
{ value: "none", label: "None" },
|
|
@@ -19140,104 +19463,104 @@ var HOVERS = [
|
|
|
19140
19463
|
{ value: "zoom", label: "Zoom" },
|
|
19141
19464
|
{ value: "fade", label: "Fade" }
|
|
19142
19465
|
];
|
|
19143
|
-
var TREATMENTS = [
|
|
19144
|
-
{ value: "color", label: "Color" },
|
|
19145
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
19146
|
-
];
|
|
19147
19466
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
19148
|
-
function
|
|
19149
|
-
|
|
19467
|
+
function LinkModal({
|
|
19468
|
+
href,
|
|
19469
|
+
linkTarget,
|
|
19470
|
+
onClose,
|
|
19471
|
+
onSave
|
|
19472
|
+
}) {
|
|
19473
|
+
const [draft, setDraft] = useState8(href);
|
|
19474
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
19150
19475
|
const [invalid, setInvalid] = useState8(false);
|
|
19151
|
-
|
|
19152
|
-
setDraft(value);
|
|
19153
|
-
setInvalid(false);
|
|
19154
|
-
}, [value]);
|
|
19155
|
-
const commit = () => {
|
|
19476
|
+
const save = () => {
|
|
19156
19477
|
const next = draft.trim();
|
|
19157
|
-
if (next
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
onCommit(next);
|
|
19161
|
-
};
|
|
19162
|
-
return /* @__PURE__ */ jsxs11(
|
|
19163
|
-
"div",
|
|
19164
|
-
{
|
|
19165
|
-
style: {
|
|
19166
|
-
display: "flex",
|
|
19167
|
-
alignItems: "center",
|
|
19168
|
-
gap: 6,
|
|
19169
|
-
height: 28,
|
|
19170
|
-
padding: "0 12px",
|
|
19171
|
-
borderRadius: 999,
|
|
19172
|
-
background: "#ffffff",
|
|
19173
|
-
width: "100%",
|
|
19174
|
-
maxWidth: 260,
|
|
19175
|
-
boxSizing: "border-box",
|
|
19176
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
19177
|
-
},
|
|
19178
|
-
children: [
|
|
19179
|
-
/* @__PURE__ */ jsx20(
|
|
19180
|
-
"span",
|
|
19181
|
-
{
|
|
19182
|
-
style: {
|
|
19183
|
-
flex: "0 0 auto",
|
|
19184
|
-
color: OHW_BLUE_DARK,
|
|
19185
|
-
fontSize: 10,
|
|
19186
|
-
fontWeight: 700,
|
|
19187
|
-
textTransform: "uppercase",
|
|
19188
|
-
letterSpacing: 0.4
|
|
19189
|
-
},
|
|
19190
|
-
children: "Link"
|
|
19191
|
-
}
|
|
19192
|
-
),
|
|
19193
|
-
/* @__PURE__ */ jsx20(
|
|
19194
|
-
"input",
|
|
19195
|
-
{
|
|
19196
|
-
type: "text",
|
|
19197
|
-
inputMode: "url",
|
|
19198
|
-
value: draft,
|
|
19199
|
-
onChange: (e) => setDraft(e.target.value),
|
|
19200
|
-
onBlur: commit,
|
|
19201
|
-
onKeyDown: (e) => {
|
|
19202
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
19203
|
-
if (e.key === "Escape") {
|
|
19204
|
-
setDraft(value);
|
|
19205
|
-
setInvalid(false);
|
|
19206
|
-
e.currentTarget.blur();
|
|
19207
|
-
}
|
|
19208
|
-
},
|
|
19209
|
-
placeholder: "https://example.com",
|
|
19210
|
-
"aria-label": "Image link URL",
|
|
19211
|
-
"aria-invalid": invalid,
|
|
19212
|
-
style: {
|
|
19213
|
-
flex: 1,
|
|
19214
|
-
minWidth: 0,
|
|
19215
|
-
border: "none",
|
|
19216
|
-
outline: "none",
|
|
19217
|
-
background: "transparent",
|
|
19218
|
-
fontSize: 12,
|
|
19219
|
-
lineHeight: "16px",
|
|
19220
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
19221
|
-
color: "#1f2937"
|
|
19222
|
-
}
|
|
19223
|
-
}
|
|
19224
|
-
)
|
|
19225
|
-
]
|
|
19478
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
19479
|
+
setInvalid(true);
|
|
19480
|
+
return;
|
|
19226
19481
|
}
|
|
19227
|
-
|
|
19482
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
19483
|
+
onClose();
|
|
19484
|
+
};
|
|
19485
|
+
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: [
|
|
19486
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
19487
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
19488
|
+
/* @__PURE__ */ jsx21(
|
|
19489
|
+
"input",
|
|
19490
|
+
{
|
|
19491
|
+
autoFocus: true,
|
|
19492
|
+
type: "text",
|
|
19493
|
+
inputMode: "url",
|
|
19494
|
+
value: draft,
|
|
19495
|
+
onChange: (e) => {
|
|
19496
|
+
setDraft(e.target.value);
|
|
19497
|
+
setInvalid(false);
|
|
19498
|
+
},
|
|
19499
|
+
onKeyDown: (e) => {
|
|
19500
|
+
if (e.key === "Enter") save();
|
|
19501
|
+
},
|
|
19502
|
+
placeholder: "https://example.com",
|
|
19503
|
+
"aria-label": "Image link URL",
|
|
19504
|
+
"aria-invalid": invalid,
|
|
19505
|
+
className: cn(
|
|
19506
|
+
"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",
|
|
19507
|
+
invalid && "border-destructive focus:border-destructive"
|
|
19508
|
+
)
|
|
19509
|
+
}
|
|
19510
|
+
),
|
|
19511
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
19512
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
19513
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
19514
|
+
"Open in new tab"
|
|
19515
|
+
] })
|
|
19516
|
+
] }),
|
|
19517
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
19518
|
+
href && /* @__PURE__ */ jsx21(
|
|
19519
|
+
"button",
|
|
19520
|
+
{
|
|
19521
|
+
type: "button",
|
|
19522
|
+
onClick: () => {
|
|
19523
|
+
onSave("", "new-tab");
|
|
19524
|
+
onClose();
|
|
19525
|
+
},
|
|
19526
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
19527
|
+
children: "Remove link"
|
|
19528
|
+
}
|
|
19529
|
+
),
|
|
19530
|
+
/* @__PURE__ */ jsx21(
|
|
19531
|
+
"button",
|
|
19532
|
+
{
|
|
19533
|
+
type: "button",
|
|
19534
|
+
onClick: onClose,
|
|
19535
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
19536
|
+
children: "Cancel"
|
|
19537
|
+
}
|
|
19538
|
+
),
|
|
19539
|
+
/* @__PURE__ */ jsx21(
|
|
19540
|
+
"button",
|
|
19541
|
+
{
|
|
19542
|
+
type: "button",
|
|
19543
|
+
onClick: save,
|
|
19544
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
19545
|
+
children: "Save"
|
|
19546
|
+
}
|
|
19547
|
+
)
|
|
19548
|
+
] })
|
|
19549
|
+
] }) });
|
|
19228
19550
|
}
|
|
19229
19551
|
function MediaStripToolbar({
|
|
19230
19552
|
entry,
|
|
19231
19553
|
index,
|
|
19232
19554
|
pending,
|
|
19233
19555
|
error,
|
|
19556
|
+
itemEditOn,
|
|
19557
|
+
onToggleItemEdit,
|
|
19234
19558
|
onSetVariant,
|
|
19235
19559
|
onSetAlign,
|
|
19236
19560
|
onSetHover,
|
|
19237
19561
|
onSetTreatment,
|
|
19238
19562
|
onResize,
|
|
19239
|
-
|
|
19240
|
-
onSetLink,
|
|
19563
|
+
onOpenLink,
|
|
19241
19564
|
onAddItem,
|
|
19242
19565
|
onRemoveItem,
|
|
19243
19566
|
onChangeImage,
|
|
@@ -19246,81 +19569,102 @@ function MediaStripToolbar({
|
|
|
19246
19569
|
}) {
|
|
19247
19570
|
const items = mediaStripItems(entry.tree);
|
|
19248
19571
|
const itemCount = items.length;
|
|
19249
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
19250
|
-
const currentHref = items[index]?.href ?? "";
|
|
19251
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19252
19572
|
const slots = findMediaStripSlots(entry.tree);
|
|
19253
19573
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19254
19574
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
19255
19575
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
19256
19576
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
19257
19577
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19258
|
-
const
|
|
19259
|
-
const
|
|
19260
|
-
|
|
19261
|
-
gap: 6,
|
|
19262
|
-
flexWrap: "nowrap",
|
|
19263
|
-
justifyContent: "center",
|
|
19264
|
-
overflowX: "auto",
|
|
19265
|
-
WebkitOverflowScrolling: "touch",
|
|
19266
|
-
width: "100%",
|
|
19267
|
-
scrollbarWidth: "none"
|
|
19268
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
19269
|
-
return /* @__PURE__ */ jsxs11(
|
|
19578
|
+
const mobile = window.innerWidth <= 480;
|
|
19579
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
19580
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
19270
19581
|
"div",
|
|
19271
19582
|
{
|
|
19272
19583
|
"data-ohw-bridge": "",
|
|
19273
19584
|
"data-ohw-toolbar": "",
|
|
19274
19585
|
onMouseDown: (e) => e.stopPropagation(),
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
flexDirection: "column",
|
|
19278
|
-
gap: 6,
|
|
19279
|
-
alignItems: "center",
|
|
19280
|
-
background: OHW_BLUE,
|
|
19281
|
-
padding: 8,
|
|
19282
|
-
borderRadius: 12,
|
|
19283
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
19284
|
-
pointerEvents: pending ? "none" : "auto",
|
|
19285
|
-
opacity: pending ? 0.6 : 1,
|
|
19286
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
19287
|
-
},
|
|
19586
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
19587
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19288
19588
|
children: [
|
|
19289
|
-
/* @__PURE__ */
|
|
19290
|
-
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19297
|
-
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
|
|
19319
|
-
|
|
19320
|
-
|
|
19589
|
+
/* @__PURE__ */ jsxs12(
|
|
19590
|
+
"div",
|
|
19591
|
+
{
|
|
19592
|
+
className: cn(
|
|
19593
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
19594
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
19595
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19596
|
+
),
|
|
19597
|
+
children: [
|
|
19598
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
19599
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
19600
|
+
CustomToolbarButton,
|
|
19601
|
+
{
|
|
19602
|
+
type: "button",
|
|
19603
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
19604
|
+
"aria-pressed": itemEditOn,
|
|
19605
|
+
onClick: onToggleItemEdit,
|
|
19606
|
+
className: "group size-8",
|
|
19607
|
+
children: /* @__PURE__ */ jsx21(
|
|
19608
|
+
Star,
|
|
19609
|
+
{
|
|
19610
|
+
size: 16,
|
|
19611
|
+
fill: "currentColor",
|
|
19612
|
+
strokeWidth: 0,
|
|
19613
|
+
className: cn(
|
|
19614
|
+
"transition-colors",
|
|
19615
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
19616
|
+
),
|
|
19617
|
+
style: { pointerEvents: "none" }
|
|
19618
|
+
}
|
|
19619
|
+
)
|
|
19620
|
+
}
|
|
19621
|
+
) }),
|
|
19622
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
19623
|
+
] }),
|
|
19624
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19625
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19626
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19627
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19628
|
+
/* @__PURE__ */ jsx21(
|
|
19629
|
+
ToolbarAction,
|
|
19630
|
+
{
|
|
19631
|
+
label: gatedLabel("Move right"),
|
|
19632
|
+
onClick: onMoveRight,
|
|
19633
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
19634
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
19635
|
+
}
|
|
19636
|
+
),
|
|
19637
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19638
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19639
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
19640
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
19641
|
+
/* @__PURE__ */ jsx21(
|
|
19642
|
+
ToolbarAction,
|
|
19643
|
+
{
|
|
19644
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
19645
|
+
active: treatment === "grayscale",
|
|
19646
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
19647
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
19648
|
+
}
|
|
19649
|
+
),
|
|
19650
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19651
|
+
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)),
|
|
19652
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19653
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19654
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
19655
|
+
sizeValue,
|
|
19656
|
+
"px"
|
|
19657
|
+
] }),
|
|
19658
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
19659
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
19660
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19661
|
+
]
|
|
19662
|
+
}
|
|
19663
|
+
),
|
|
19664
|
+
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 })
|
|
19321
19665
|
]
|
|
19322
19666
|
}
|
|
19323
|
-
);
|
|
19667
|
+
) });
|
|
19324
19668
|
}
|
|
19325
19669
|
function findMediaStripSlots(tree) {
|
|
19326
19670
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -19339,31 +19683,23 @@ function AiMediaStripOverlay({
|
|
|
19339
19683
|
}) {
|
|
19340
19684
|
const [hover, setHover] = useState8(null);
|
|
19341
19685
|
const [active, setActive] = useState8(null);
|
|
19686
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
19687
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
19342
19688
|
const [pending, setPending] = useState8(false);
|
|
19343
19689
|
const [error, setError] = useState8(null);
|
|
19344
19690
|
const activeRef = useRef5(null);
|
|
19345
19691
|
activeRef.current = active;
|
|
19692
|
+
const linkOpenRef = useRef5(false);
|
|
19693
|
+
linkOpenRef.current = linkOpen;
|
|
19346
19694
|
useEffect8(() => {
|
|
19347
19695
|
const onMove = (e) => {
|
|
19696
|
+
const ref = itemRefFromTarget(e.target);
|
|
19348
19697
|
const t = e.target;
|
|
19349
|
-
|
|
19350
|
-
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
if (!itemEl) {
|
|
19355
|
-
setHover(null);
|
|
19356
|
-
return;
|
|
19357
|
-
}
|
|
19358
|
-
const sectionEl = itemEl.closest("[data-ohw-section]");
|
|
19359
|
-
const unit = sectionEl ? movableUnit(sectionEl) : null;
|
|
19360
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
19361
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
19362
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
19363
|
-
setHover(null);
|
|
19364
|
-
return;
|
|
19365
|
-
}
|
|
19366
|
-
setHover({ sectionId, index });
|
|
19698
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
19699
|
+
setHover((prev) => {
|
|
19700
|
+
const next = ref && !overEditable ? ref : null;
|
|
19701
|
+
return sameRef(prev, next) ? prev : next;
|
|
19702
|
+
});
|
|
19367
19703
|
};
|
|
19368
19704
|
const onLeave = () => setHover(null);
|
|
19369
19705
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -19375,23 +19711,25 @@ function AiMediaStripOverlay({
|
|
|
19375
19711
|
}, []);
|
|
19376
19712
|
useEffect8(() => {
|
|
19377
19713
|
const onClick = (e) => {
|
|
19378
|
-
const current = activeRef.current;
|
|
19379
|
-
if (!current) return;
|
|
19380
19714
|
const t = e.target;
|
|
19381
|
-
if (!(t instanceof
|
|
19382
|
-
if (t.closest(
|
|
19383
|
-
const
|
|
19384
|
-
if (
|
|
19385
|
-
|
|
19715
|
+
if (!(t instanceof Element)) return;
|
|
19716
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
19717
|
+
const ref = itemRefFromTarget(t);
|
|
19718
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
19719
|
+
if (ref) clearInteractionChromeRef.current();
|
|
19720
|
+
setItemEditOn(false);
|
|
19386
19721
|
setError(null);
|
|
19722
|
+
setActive(ref);
|
|
19387
19723
|
};
|
|
19388
19724
|
document.addEventListener("click", onClick, true);
|
|
19389
19725
|
return () => document.removeEventListener("click", onClick, true);
|
|
19390
|
-
}, []);
|
|
19726
|
+
}, [clearInteractionChromeRef]);
|
|
19391
19727
|
useEffect8(() => {
|
|
19392
19728
|
const onBlur = () => {
|
|
19393
19729
|
if (!activeRef.current) return;
|
|
19394
19730
|
setActive(null);
|
|
19731
|
+
setItemEditOn(false);
|
|
19732
|
+
setLinkOpen(false);
|
|
19395
19733
|
setError(null);
|
|
19396
19734
|
};
|
|
19397
19735
|
window.addEventListener("blur", onBlur);
|
|
@@ -19401,7 +19739,10 @@ function AiMediaStripOverlay({
|
|
|
19401
19739
|
const onKeyDown = (e) => {
|
|
19402
19740
|
if (e.key !== "Escape") return;
|
|
19403
19741
|
if (!activeRef.current) return;
|
|
19742
|
+
if (linkOpenRef.current) return;
|
|
19743
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
19404
19744
|
setActive(null);
|
|
19745
|
+
setItemEditOn(false);
|
|
19405
19746
|
setError(null);
|
|
19406
19747
|
};
|
|
19407
19748
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -19435,137 +19776,133 @@ function AiMediaStripOverlay({
|
|
|
19435
19776
|
tree: nextTree,
|
|
19436
19777
|
label: entry.label,
|
|
19437
19778
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
19438
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
19779
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
19780
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
19781
|
+
// on every edit reads as the section jumping around.
|
|
19782
|
+
skipScrollIntoView: true
|
|
19439
19783
|
});
|
|
19440
19784
|
return true;
|
|
19441
19785
|
},
|
|
19442
19786
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
19443
19787
|
);
|
|
19444
19788
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19445
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
19446
19789
|
const activeItemRect = useLiveItemRect(active);
|
|
19447
|
-
const
|
|
19448
|
-
const
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
19482
|
-
ItemInteractionLayer,
|
|
19483
|
-
{
|
|
19484
|
-
rect: activeItemRect,
|
|
19485
|
-
state: toolbarState,
|
|
19486
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
19487
|
-
MediaStripToolbar,
|
|
19488
|
-
{
|
|
19489
|
-
entry: activeEntry,
|
|
19490
|
-
index: active.index,
|
|
19491
|
-
pending,
|
|
19492
|
-
error,
|
|
19493
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19494
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19495
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19496
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19497
|
-
onResize: (delta) => {
|
|
19498
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19499
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19500
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19501
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19502
|
-
},
|
|
19503
|
-
onSetAlt: (alt) => {
|
|
19504
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
19505
|
-
},
|
|
19506
|
-
onSetLink: (href, linkTarget) => {
|
|
19790
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
19791
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
19792
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
19793
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
19794
|
+
const activeHref = activeItem?.href ?? "";
|
|
19795
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
19796
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19797
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
19798
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
19799
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
19800
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
19801
|
+
MediaStripToolbar,
|
|
19802
|
+
{
|
|
19803
|
+
entry: activeEntry,
|
|
19804
|
+
index: active.index,
|
|
19805
|
+
pending,
|
|
19806
|
+
error,
|
|
19807
|
+
itemEditOn,
|
|
19808
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
19809
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
19810
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
19811
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
19812
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
19813
|
+
onResize: (delta) => {
|
|
19814
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
19815
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
19816
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
19817
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
19818
|
+
},
|
|
19819
|
+
onOpenLink: () => setLinkOpen(true),
|
|
19820
|
+
onAddItem: () => {
|
|
19821
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19822
|
+
if (!picked) return;
|
|
19823
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19507
19824
|
void runMutation(
|
|
19508
19825
|
active.sectionId,
|
|
19509
|
-
(tree) =>
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
19514
|
-
if (!picked) return;
|
|
19515
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
19516
|
-
void runMutation(
|
|
19517
|
-
active.sectionId,
|
|
19518
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19519
|
-
{ [picked.assetId]: picked.url }
|
|
19520
|
-
).then((applied) => {
|
|
19521
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19522
|
-
});
|
|
19826
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
19827
|
+
{ [picked.assetId]: picked.url }
|
|
19828
|
+
).then((applied) => {
|
|
19829
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19523
19830
|
});
|
|
19524
|
-
}
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
});
|
|
19534
|
-
},
|
|
19535
|
-
onRemoveItem: () => {
|
|
19536
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19537
|
-
(applied) => {
|
|
19538
|
-
if (applied) setActive(null);
|
|
19539
|
-
}
|
|
19540
|
-
);
|
|
19541
|
-
},
|
|
19542
|
-
onMoveLeft: () => {
|
|
19543
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19544
|
-
(applied) => {
|
|
19545
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19546
|
-
}
|
|
19547
|
-
);
|
|
19548
|
-
},
|
|
19549
|
-
onMoveRight: () => {
|
|
19550
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19551
|
-
(applied) => {
|
|
19552
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19553
|
-
}
|
|
19831
|
+
});
|
|
19832
|
+
},
|
|
19833
|
+
onChangeImage: () => {
|
|
19834
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
19835
|
+
if (!picked) return;
|
|
19836
|
+
void runMutation(
|
|
19837
|
+
active.sectionId,
|
|
19838
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
19839
|
+
{ [picked.assetId]: picked.url }
|
|
19554
19840
|
);
|
|
19555
|
-
}
|
|
19841
|
+
});
|
|
19842
|
+
},
|
|
19843
|
+
onRemoveItem: () => {
|
|
19844
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
19845
|
+
(applied) => {
|
|
19846
|
+
if (applied) setActive(null);
|
|
19847
|
+
}
|
|
19848
|
+
);
|
|
19849
|
+
},
|
|
19850
|
+
onMoveLeft: () => {
|
|
19851
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
19852
|
+
(applied) => {
|
|
19853
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
19854
|
+
}
|
|
19855
|
+
);
|
|
19856
|
+
},
|
|
19857
|
+
onMoveRight: () => {
|
|
19858
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
19859
|
+
(applied) => {
|
|
19860
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
19861
|
+
}
|
|
19862
|
+
);
|
|
19556
19863
|
}
|
|
19557
|
-
|
|
19558
|
-
}
|
|
19559
|
-
|
|
19864
|
+
}
|
|
19865
|
+
) }),
|
|
19866
|
+
/* @__PURE__ */ jsx21(
|
|
19867
|
+
"div",
|
|
19868
|
+
{
|
|
19869
|
+
"data-ohw-bridge": "",
|
|
19870
|
+
"data-ohw-item-interaction": "",
|
|
19871
|
+
"aria-hidden": true,
|
|
19872
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
19873
|
+
style: {
|
|
19874
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
19875
|
+
left: activeItemRect.left - 5,
|
|
19876
|
+
background: PRIMARY3,
|
|
19877
|
+
zIndex: 2147483644
|
|
19878
|
+
},
|
|
19879
|
+
children: "Media item"
|
|
19880
|
+
}
|
|
19881
|
+
),
|
|
19882
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
19883
|
+
LinkModal,
|
|
19884
|
+
{
|
|
19885
|
+
href: activeHref,
|
|
19886
|
+
linkTarget: activeTarget,
|
|
19887
|
+
onClose: () => setLinkOpen(false),
|
|
19888
|
+
onSave: (href, linkTarget) => {
|
|
19889
|
+
void runMutation(
|
|
19890
|
+
active.sectionId,
|
|
19891
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
19892
|
+
);
|
|
19893
|
+
}
|
|
19894
|
+
}
|
|
19895
|
+
)
|
|
19896
|
+
] })
|
|
19560
19897
|
] });
|
|
19561
19898
|
}
|
|
19562
19899
|
|
|
19563
19900
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19564
|
-
import { useCallback as useCallback4, useEffect as useEffect9, useLayoutEffect as
|
|
19565
|
-
import { Check as
|
|
19566
|
-
import { Fragment as Fragment8, jsx as
|
|
19901
|
+
import { useCallback as useCallback4, useEffect as useEffect9, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
19902
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
19903
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
19567
19904
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
19568
|
-
var
|
|
19905
|
+
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]";
|
|
19569
19906
|
function findPricingCardElement(sectionId, index) {
|
|
19570
19907
|
const sectionEl = findByInstanceId(sectionId);
|
|
19571
19908
|
if (!sectionEl) return null;
|
|
@@ -19577,7 +19914,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
19577
19914
|
}
|
|
19578
19915
|
function cardRefFromTarget(target) {
|
|
19579
19916
|
if (!(target instanceof Element)) return null;
|
|
19580
|
-
if (target.closest(
|
|
19917
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
19581
19918
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
19582
19919
|
if (!cardEl) return null;
|
|
19583
19920
|
const sectionEl = cardEl.closest("[data-ohw-section]");
|
|
@@ -19587,21 +19924,21 @@ function cardRefFromTarget(target) {
|
|
|
19587
19924
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
19588
19925
|
return { sectionId, index };
|
|
19589
19926
|
}
|
|
19590
|
-
function
|
|
19927
|
+
function sameRef2(a, b) {
|
|
19591
19928
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
19592
19929
|
}
|
|
19593
|
-
function
|
|
19930
|
+
function rectOf2(el) {
|
|
19594
19931
|
if (!el) return null;
|
|
19595
19932
|
const r2 = el.getBoundingClientRect();
|
|
19596
19933
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
19597
19934
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
19598
19935
|
}
|
|
19599
19936
|
function readRect3(ref) {
|
|
19600
|
-
return
|
|
19937
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
19601
19938
|
}
|
|
19602
19939
|
function readGridRect(ref) {
|
|
19603
19940
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
19604
|
-
return
|
|
19941
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
19605
19942
|
}
|
|
19606
19943
|
function useLiveCardRect(ref, grid = false) {
|
|
19607
19944
|
const [rect, setRect] = useState9(null);
|
|
@@ -19631,19 +19968,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
19631
19968
|
}
|
|
19632
19969
|
var TOOLBAR_GRID_GAP = 52;
|
|
19633
19970
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
19634
|
-
var
|
|
19971
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
19635
19972
|
function GridToolbarSlot({ gridRect, children }) {
|
|
19636
19973
|
const slotRef = useRef6(null);
|
|
19637
19974
|
const [shift, setShift] = useState9(0);
|
|
19638
19975
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
19639
|
-
|
|
19976
|
+
useLayoutEffect5(() => {
|
|
19640
19977
|
const slot = slotRef.current;
|
|
19641
19978
|
if (!slot) return;
|
|
19642
19979
|
const clamp = () => {
|
|
19643
19980
|
const w = slot.offsetWidth;
|
|
19644
19981
|
if (w <= 0) return;
|
|
19645
19982
|
const half = w / 2;
|
|
19646
|
-
const clamped = Math.max(
|
|
19983
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
19647
19984
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
19648
19985
|
};
|
|
19649
19986
|
clamp();
|
|
@@ -19652,7 +19989,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
19652
19989
|
return () => ro.disconnect();
|
|
19653
19990
|
}, [centerX, children]);
|
|
19654
19991
|
const mobile = window.innerWidth <= 480;
|
|
19655
|
-
return /* @__PURE__ */
|
|
19992
|
+
return /* @__PURE__ */ jsx22(
|
|
19656
19993
|
"div",
|
|
19657
19994
|
{
|
|
19658
19995
|
ref: slotRef,
|
|
@@ -19687,7 +20024,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
19687
20024
|
});
|
|
19688
20025
|
}
|
|
19689
20026
|
function StyleSwatch({ style }) {
|
|
19690
|
-
return /* @__PURE__ */
|
|
20027
|
+
return /* @__PURE__ */ jsx22(
|
|
19691
20028
|
"span",
|
|
19692
20029
|
{
|
|
19693
20030
|
"aria-hidden": true,
|
|
@@ -19701,35 +20038,35 @@ function StyleSwatch({ style }) {
|
|
|
19701
20038
|
);
|
|
19702
20039
|
}
|
|
19703
20040
|
function ButtonGlyph() {
|
|
19704
|
-
return /* @__PURE__ */
|
|
19705
|
-
/* @__PURE__ */
|
|
19706
|
-
/* @__PURE__ */
|
|
20041
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20042
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20043
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19707
20044
|
] });
|
|
19708
20045
|
}
|
|
19709
20046
|
function FeatureGlyph({ mode }) {
|
|
19710
|
-
return /* @__PURE__ */
|
|
19711
|
-
/* @__PURE__ */
|
|
19712
|
-
/* @__PURE__ */
|
|
19713
|
-
/* @__PURE__ */
|
|
19714
|
-
/* @__PURE__ */
|
|
19715
|
-
/* @__PURE__ */
|
|
19716
|
-
mode === "add" && /* @__PURE__ */
|
|
20047
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
20048
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
20049
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
20050
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
20051
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
20052
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
20053
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
19717
20054
|
] });
|
|
19718
20055
|
}
|
|
19719
|
-
function
|
|
20056
|
+
function ToolbarAction2({
|
|
19720
20057
|
label,
|
|
19721
20058
|
onClick,
|
|
19722
20059
|
disabled = false,
|
|
19723
20060
|
children
|
|
19724
20061
|
}) {
|
|
19725
|
-
const button = /* @__PURE__ */
|
|
19726
|
-
return /* @__PURE__ */
|
|
19727
|
-
/* @__PURE__ */
|
|
19728
|
-
/* @__PURE__ */
|
|
20062
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
20063
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20064
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
20065
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
19729
20066
|
] });
|
|
19730
20067
|
}
|
|
19731
|
-
function
|
|
19732
|
-
return /* @__PURE__ */
|
|
20068
|
+
function ToolbarSeparator2() {
|
|
20069
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
19733
20070
|
}
|
|
19734
20071
|
function CardStyleMenu({
|
|
19735
20072
|
value,
|
|
@@ -19737,7 +20074,7 @@ function CardStyleMenu({
|
|
|
19737
20074
|
disabled = false
|
|
19738
20075
|
}) {
|
|
19739
20076
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
19740
|
-
const trigger = /* @__PURE__ */
|
|
20077
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
19741
20078
|
"button",
|
|
19742
20079
|
{
|
|
19743
20080
|
type: "button",
|
|
@@ -19748,28 +20085,28 @@ function CardStyleMenu({
|
|
|
19748
20085
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
19749
20086
|
),
|
|
19750
20087
|
children: [
|
|
19751
|
-
/* @__PURE__ */
|
|
19752
|
-
/* @__PURE__ */
|
|
19753
|
-
/* @__PURE__ */
|
|
20088
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
20089
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
20090
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
19754
20091
|
]
|
|
19755
20092
|
}
|
|
19756
20093
|
);
|
|
19757
20094
|
if (disabled) {
|
|
19758
|
-
return /* @__PURE__ */
|
|
19759
|
-
/* @__PURE__ */
|
|
19760
|
-
/* @__PURE__ */
|
|
19761
|
-
/* @__PURE__ */
|
|
19762
|
-
/* @__PURE__ */
|
|
20095
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20096
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
20097
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20098
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
20099
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
19763
20100
|
] })
|
|
19764
20101
|
] });
|
|
19765
20102
|
}
|
|
19766
|
-
return /* @__PURE__ */
|
|
19767
|
-
/* @__PURE__ */
|
|
19768
|
-
/* @__PURE__ */
|
|
19769
|
-
/* @__PURE__ */
|
|
19770
|
-
/* @__PURE__ */
|
|
20103
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
20104
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
20105
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
20106
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
20107
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
19771
20108
|
const selected = style.value === value;
|
|
19772
|
-
return /* @__PURE__ */
|
|
20109
|
+
return /* @__PURE__ */ jsxs13(
|
|
19773
20110
|
DropdownMenuItem,
|
|
19774
20111
|
{
|
|
19775
20112
|
role: "menuitemradio",
|
|
@@ -19777,9 +20114,9 @@ function CardStyleMenu({
|
|
|
19777
20114
|
onSelect: () => onChange(style.value),
|
|
19778
20115
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
19779
20116
|
children: [
|
|
19780
|
-
/* @__PURE__ */
|
|
19781
|
-
/* @__PURE__ */
|
|
19782
|
-
selected && /* @__PURE__ */
|
|
20117
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
20118
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
20119
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
19783
20120
|
]
|
|
19784
20121
|
},
|
|
19785
20122
|
style.value
|
|
@@ -19809,7 +20146,7 @@ function PricingCardToolbar({
|
|
|
19809
20146
|
const style = pricingCardStyle(entry.tree, index);
|
|
19810
20147
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
19811
20148
|
const mobile = window.innerWidth <= 480;
|
|
19812
|
-
return /* @__PURE__ */
|
|
20149
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
19813
20150
|
"div",
|
|
19814
20151
|
{
|
|
19815
20152
|
"data-ohw-bridge": "",
|
|
@@ -19821,7 +20158,7 @@ function PricingCardToolbar({
|
|
|
19821
20158
|
),
|
|
19822
20159
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
19823
20160
|
children: [
|
|
19824
|
-
/* @__PURE__ */
|
|
20161
|
+
/* @__PURE__ */ jsxs13(
|
|
19825
20162
|
"div",
|
|
19826
20163
|
{
|
|
19827
20164
|
className: cn(
|
|
@@ -19830,8 +20167,8 @@ function PricingCardToolbar({
|
|
|
19830
20167
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
19831
20168
|
),
|
|
19832
20169
|
children: [
|
|
19833
|
-
/* @__PURE__ */
|
|
19834
|
-
/* @__PURE__ */
|
|
20170
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
20171
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
19835
20172
|
CustomToolbarButton,
|
|
19836
20173
|
{
|
|
19837
20174
|
type: "button",
|
|
@@ -19839,7 +20176,7 @@ function PricingCardToolbar({
|
|
|
19839
20176
|
"aria-pressed": featuredTag,
|
|
19840
20177
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
19841
20178
|
className: "group size-8",
|
|
19842
|
-
children: /* @__PURE__ */
|
|
20179
|
+
children: /* @__PURE__ */ jsx22(
|
|
19843
20180
|
Star2,
|
|
19844
20181
|
{
|
|
19845
20182
|
size: 16,
|
|
@@ -19854,25 +20191,25 @@ function PricingCardToolbar({
|
|
|
19854
20191
|
)
|
|
19855
20192
|
}
|
|
19856
20193
|
) }),
|
|
19857
|
-
/* @__PURE__ */
|
|
20194
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
19858
20195
|
] }),
|
|
19859
|
-
/* @__PURE__ */
|
|
19860
|
-
/* @__PURE__ */
|
|
19861
|
-
/* @__PURE__ */
|
|
19862
|
-
/* @__PURE__ */
|
|
19863
|
-
/* @__PURE__ */
|
|
19864
|
-
/* @__PURE__ */
|
|
19865
|
-
/* @__PURE__ */
|
|
20196
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20197
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
20198
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20199
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
20200
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
20201
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
20202
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
19866
20203
|
] }) }),
|
|
19867
|
-
/* @__PURE__ */
|
|
19868
|
-
/* @__PURE__ */
|
|
19869
|
-
/* @__PURE__ */
|
|
19870
|
-
/* @__PURE__ */
|
|
19871
|
-
/* @__PURE__ */
|
|
20204
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
20205
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
20206
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
20207
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
20208
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
19872
20209
|
]
|
|
19873
20210
|
}
|
|
19874
20211
|
),
|
|
19875
|
-
error && /* @__PURE__ */
|
|
20212
|
+
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 })
|
|
19876
20213
|
]
|
|
19877
20214
|
}
|
|
19878
20215
|
) });
|
|
@@ -19906,7 +20243,7 @@ function AiPricingCardOverlay({
|
|
|
19906
20243
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
19907
20244
|
setHover((prev) => {
|
|
19908
20245
|
const next = ref && !overEditable ? ref : null;
|
|
19909
|
-
return
|
|
20246
|
+
return sameRef2(prev, next) ? prev : next;
|
|
19910
20247
|
});
|
|
19911
20248
|
};
|
|
19912
20249
|
const onLeave = () => setHover(null);
|
|
@@ -19921,10 +20258,10 @@ function AiPricingCardOverlay({
|
|
|
19921
20258
|
const onClick = (e) => {
|
|
19922
20259
|
const t = e.target;
|
|
19923
20260
|
if (!(t instanceof Element)) return;
|
|
19924
|
-
if (t.closest(
|
|
20261
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
19925
20262
|
const ref = cardRefFromTarget(t);
|
|
19926
|
-
setActive((prev) =>
|
|
19927
|
-
if (!ref || !
|
|
20263
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
20264
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
19928
20265
|
};
|
|
19929
20266
|
document.addEventListener("click", onClick, true);
|
|
19930
20267
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -19989,12 +20326,12 @@ function AiPricingCardOverlay({
|
|
|
19989
20326
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
19990
20327
|
const activeCardRect = useLiveCardRect(active);
|
|
19991
20328
|
const activeGridRect = useLiveCardRect(active, true);
|
|
19992
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
19993
|
-
return /* @__PURE__ */
|
|
19994
|
-
hoverRect && /* @__PURE__ */
|
|
19995
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
19996
|
-
/* @__PURE__ */
|
|
19997
|
-
/* @__PURE__ */
|
|
20329
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
20330
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20331
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
20332
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
20333
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
20334
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
19998
20335
|
PricingCardToolbar,
|
|
19999
20336
|
{
|
|
20000
20337
|
entry: activeEntry,
|
|
@@ -20022,7 +20359,7 @@ function AiPricingCardOverlay({
|
|
|
20022
20359
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
20023
20360
|
}
|
|
20024
20361
|
) }),
|
|
20025
|
-
/* @__PURE__ */
|
|
20362
|
+
/* @__PURE__ */ jsx22(
|
|
20026
20363
|
"div",
|
|
20027
20364
|
{
|
|
20028
20365
|
"data-ohw-bridge": "",
|
|
@@ -20086,39 +20423,11 @@ function clearVideo(tree, path) {
|
|
|
20086
20423
|
});
|
|
20087
20424
|
}
|
|
20088
20425
|
|
|
20089
|
-
// src/lib/youtube.ts
|
|
20090
|
-
var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
|
|
20091
|
-
function extractYouTubeId(input) {
|
|
20092
|
-
const trimmed = input.trim();
|
|
20093
|
-
if (!trimmed) return null;
|
|
20094
|
-
if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
|
|
20095
|
-
let url;
|
|
20096
|
-
try {
|
|
20097
|
-
url = new URL(trimmed);
|
|
20098
|
-
} catch {
|
|
20099
|
-
return null;
|
|
20100
|
-
}
|
|
20101
|
-
const host = url.hostname.replace(/^www\./, "");
|
|
20102
|
-
if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
|
|
20103
|
-
return null;
|
|
20104
|
-
}
|
|
20105
|
-
let candidate = null;
|
|
20106
|
-
if (host === "youtu.be") {
|
|
20107
|
-
candidate = url.pathname.slice(1).split("/")[0] ?? null;
|
|
20108
|
-
} else if (url.pathname === "/watch") {
|
|
20109
|
-
candidate = url.searchParams.get("v");
|
|
20110
|
-
} else {
|
|
20111
|
-
const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
|
|
20112
|
-
candidate = match ? match[1] : null;
|
|
20113
|
-
}
|
|
20114
|
-
return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
|
|
20115
|
-
}
|
|
20116
|
-
|
|
20117
20426
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20118
|
-
import { Fragment as Fragment9, jsx as
|
|
20427
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
20119
20428
|
var PRIMARY5 = "#0885FE";
|
|
20120
|
-
var
|
|
20121
|
-
var
|
|
20429
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
20430
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
20122
20431
|
function findVideoBlockElement(sectionId, path) {
|
|
20123
20432
|
const sectionEl = findByInstanceId(sectionId);
|
|
20124
20433
|
if (!sectionEl) return null;
|
|
@@ -20178,12 +20487,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
20178
20487
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
20179
20488
|
});
|
|
20180
20489
|
}
|
|
20181
|
-
function
|
|
20490
|
+
function Pill({
|
|
20182
20491
|
label,
|
|
20183
20492
|
onClick,
|
|
20184
20493
|
disabled
|
|
20185
20494
|
}) {
|
|
20186
|
-
return /* @__PURE__ */
|
|
20495
|
+
return /* @__PURE__ */ jsx23(
|
|
20187
20496
|
"button",
|
|
20188
20497
|
{
|
|
20189
20498
|
type: "button",
|
|
@@ -20199,7 +20508,7 @@ function Pill2({
|
|
|
20199
20508
|
border: "none",
|
|
20200
20509
|
cursor: disabled ? "default" : "pointer",
|
|
20201
20510
|
background: "#ffffff",
|
|
20202
|
-
color:
|
|
20511
|
+
color: OHW_BLUE_DARK,
|
|
20203
20512
|
opacity: disabled ? 0.4 : 1,
|
|
20204
20513
|
fontSize: 12,
|
|
20205
20514
|
lineHeight: "16px",
|
|
@@ -20221,7 +20530,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20221
20530
|
setDraft(value ? watchUrl(value) : "");
|
|
20222
20531
|
setInvalid(false);
|
|
20223
20532
|
}, [value]);
|
|
20224
|
-
const
|
|
20533
|
+
const commit2 = () => {
|
|
20225
20534
|
const next = draft.trim();
|
|
20226
20535
|
if (!next) {
|
|
20227
20536
|
setInvalid(false);
|
|
@@ -20242,8 +20551,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20242
20551
|
onCommit(id);
|
|
20243
20552
|
}
|
|
20244
20553
|
};
|
|
20245
|
-
return /* @__PURE__ */
|
|
20246
|
-
/* @__PURE__ */
|
|
20554
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
20555
|
+
/* @__PURE__ */ jsxs14(
|
|
20247
20556
|
"div",
|
|
20248
20557
|
{
|
|
20249
20558
|
style: {
|
|
@@ -20259,12 +20568,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20259
20568
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
20260
20569
|
},
|
|
20261
20570
|
children: [
|
|
20262
|
-
/* @__PURE__ */
|
|
20571
|
+
/* @__PURE__ */ jsx23(
|
|
20263
20572
|
"span",
|
|
20264
20573
|
{
|
|
20265
20574
|
style: {
|
|
20266
20575
|
flex: "0 0 auto",
|
|
20267
|
-
color:
|
|
20576
|
+
color: OHW_BLUE_DARK,
|
|
20268
20577
|
fontSize: 10,
|
|
20269
20578
|
lineHeight: "16px",
|
|
20270
20579
|
fontWeight: 700,
|
|
@@ -20274,14 +20583,14 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20274
20583
|
children: "Video"
|
|
20275
20584
|
}
|
|
20276
20585
|
),
|
|
20277
|
-
/* @__PURE__ */
|
|
20586
|
+
/* @__PURE__ */ jsx23(
|
|
20278
20587
|
"input",
|
|
20279
20588
|
{
|
|
20280
20589
|
type: "text",
|
|
20281
20590
|
inputMode: "url",
|
|
20282
20591
|
value: draft,
|
|
20283
20592
|
onChange: (e) => handleChange(e.target.value),
|
|
20284
|
-
onBlur:
|
|
20593
|
+
onBlur: commit2,
|
|
20285
20594
|
onKeyDown: (e) => {
|
|
20286
20595
|
if (e.key === "Enter") e.currentTarget.blur();
|
|
20287
20596
|
if (e.key === "Escape") {
|
|
@@ -20311,7 +20620,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
20311
20620
|
]
|
|
20312
20621
|
}
|
|
20313
20622
|
),
|
|
20314
|
-
invalid && /* @__PURE__ */
|
|
20623
|
+
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." })
|
|
20315
20624
|
] });
|
|
20316
20625
|
}
|
|
20317
20626
|
function VideoToolbar({
|
|
@@ -20321,7 +20630,7 @@ function VideoToolbar({
|
|
|
20321
20630
|
onSetVideoId,
|
|
20322
20631
|
onRemove
|
|
20323
20632
|
}) {
|
|
20324
|
-
return /* @__PURE__ */
|
|
20633
|
+
return /* @__PURE__ */ jsxs14(
|
|
20325
20634
|
"div",
|
|
20326
20635
|
{
|
|
20327
20636
|
"data-ohw-bridge": "",
|
|
@@ -20333,7 +20642,7 @@ function VideoToolbar({
|
|
|
20333
20642
|
gap: 6,
|
|
20334
20643
|
alignItems: "center",
|
|
20335
20644
|
width: 280,
|
|
20336
|
-
background:
|
|
20645
|
+
background: OHW_BLUE,
|
|
20337
20646
|
padding: 8,
|
|
20338
20647
|
borderRadius: 12,
|
|
20339
20648
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20341,9 +20650,9 @@ function VideoToolbar({
|
|
|
20341
20650
|
opacity: pending ? 0.6 : 1
|
|
20342
20651
|
},
|
|
20343
20652
|
children: [
|
|
20344
|
-
/* @__PURE__ */
|
|
20345
|
-
/* @__PURE__ */
|
|
20346
|
-
error && /* @__PURE__ */
|
|
20653
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
20654
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
20655
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20347
20656
|
]
|
|
20348
20657
|
}
|
|
20349
20658
|
);
|
|
@@ -20463,8 +20772,8 @@ function AiVideoOverlay({
|
|
|
20463
20772
|
const activeBlockRect = useLiveBlockRect(active);
|
|
20464
20773
|
const TOOLBAR_APPROX_H = 90;
|
|
20465
20774
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20466
|
-
return /* @__PURE__ */
|
|
20467
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
20775
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
20776
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
20468
20777
|
"button",
|
|
20469
20778
|
{
|
|
20470
20779
|
type: "button",
|
|
@@ -20492,15 +20801,15 @@ function AiVideoOverlay({
|
|
|
20492
20801
|
fontSize: 14,
|
|
20493
20802
|
fontWeight: 700
|
|
20494
20803
|
},
|
|
20495
|
-
children: /* @__PURE__ */
|
|
20804
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
20496
20805
|
}
|
|
20497
20806
|
),
|
|
20498
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
20807
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
20499
20808
|
ItemInteractionLayer,
|
|
20500
20809
|
{
|
|
20501
20810
|
rect: activeBlockRect,
|
|
20502
20811
|
state: toolbarState,
|
|
20503
|
-
toolbar: /* @__PURE__ */
|
|
20812
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
20504
20813
|
VideoToolbar,
|
|
20505
20814
|
{
|
|
20506
20815
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -20575,10 +20884,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
20575
20884
|
}
|
|
20576
20885
|
|
|
20577
20886
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20578
|
-
import { Fragment as Fragment10, jsx as
|
|
20887
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
20579
20888
|
var PRIMARY6 = "#0885FE";
|
|
20580
|
-
var
|
|
20581
|
-
var
|
|
20889
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
20890
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
20582
20891
|
function findCarouselItemElement(sectionId, index) {
|
|
20583
20892
|
const sectionEl = findByInstanceId(sectionId);
|
|
20584
20893
|
if (!sectionEl) return null;
|
|
@@ -20657,8 +20966,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
20657
20966
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20658
20967
|
});
|
|
20659
20968
|
}
|
|
20660
|
-
function
|
|
20661
|
-
return /* @__PURE__ */
|
|
20969
|
+
function Pill2({ label, onClick, disabled }) {
|
|
20970
|
+
return /* @__PURE__ */ jsx24(
|
|
20662
20971
|
"button",
|
|
20663
20972
|
{
|
|
20664
20973
|
type: "button",
|
|
@@ -20674,7 +20983,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
20674
20983
|
border: "none",
|
|
20675
20984
|
cursor: disabled ? "default" : "pointer",
|
|
20676
20985
|
background: "#ffffff",
|
|
20677
|
-
color:
|
|
20986
|
+
color: OHW_BLUE_DARK2,
|
|
20678
20987
|
opacity: disabled ? 0.4 : 1,
|
|
20679
20988
|
fontSize: 12,
|
|
20680
20989
|
lineHeight: "16px",
|
|
@@ -20692,7 +21001,7 @@ function TogglePill({
|
|
|
20692
21001
|
onToggle,
|
|
20693
21002
|
disabled
|
|
20694
21003
|
}) {
|
|
20695
|
-
return /* @__PURE__ */
|
|
21004
|
+
return /* @__PURE__ */ jsxs15(
|
|
20696
21005
|
"button",
|
|
20697
21006
|
{
|
|
20698
21007
|
type: "button",
|
|
@@ -20711,7 +21020,7 @@ function TogglePill({
|
|
|
20711
21020
|
border: "none",
|
|
20712
21021
|
cursor: disabled ? "default" : "pointer",
|
|
20713
21022
|
background: "#ffffff",
|
|
20714
|
-
color:
|
|
21023
|
+
color: OHW_BLUE_DARK2,
|
|
20715
21024
|
opacity: disabled ? 0.4 : 1,
|
|
20716
21025
|
fontSize: 12,
|
|
20717
21026
|
lineHeight: "16px",
|
|
@@ -20721,7 +21030,7 @@ function TogglePill({
|
|
|
20721
21030
|
},
|
|
20722
21031
|
children: [
|
|
20723
21032
|
label,
|
|
20724
|
-
/* @__PURE__ */
|
|
21033
|
+
/* @__PURE__ */ jsx24(
|
|
20725
21034
|
"span",
|
|
20726
21035
|
{
|
|
20727
21036
|
"aria-hidden": true,
|
|
@@ -20734,10 +21043,10 @@ function TogglePill({
|
|
|
20734
21043
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
20735
21044
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
20736
21045
|
// "disabled control" rather than "switch that is off".
|
|
20737
|
-
background: on ?
|
|
21046
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
20738
21047
|
transition: "background 120ms ease"
|
|
20739
21048
|
},
|
|
20740
|
-
children: /* @__PURE__ */
|
|
21049
|
+
children: /* @__PURE__ */ jsx24(
|
|
20741
21050
|
"span",
|
|
20742
21051
|
{
|
|
20743
21052
|
style: {
|
|
@@ -20766,7 +21075,7 @@ function CarouselSlideToolbar({
|
|
|
20766
21075
|
onChangeImage,
|
|
20767
21076
|
onToggleAutoplay
|
|
20768
21077
|
}) {
|
|
20769
|
-
return /* @__PURE__ */
|
|
21078
|
+
return /* @__PURE__ */ jsxs15(
|
|
20770
21079
|
"div",
|
|
20771
21080
|
{
|
|
20772
21081
|
"data-ohw-bridge": "",
|
|
@@ -20777,7 +21086,7 @@ function CarouselSlideToolbar({
|
|
|
20777
21086
|
flexDirection: "column",
|
|
20778
21087
|
gap: 6,
|
|
20779
21088
|
alignItems: "center",
|
|
20780
|
-
background:
|
|
21089
|
+
background: OHW_BLUE2,
|
|
20781
21090
|
padding: 8,
|
|
20782
21091
|
borderRadius: 12,
|
|
20783
21092
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -20789,11 +21098,11 @@ function CarouselSlideToolbar({
|
|
|
20789
21098
|
pointerEvents: pending ? "none" : "auto"
|
|
20790
21099
|
},
|
|
20791
21100
|
children: [
|
|
20792
|
-
/* @__PURE__ */
|
|
20793
|
-
/* @__PURE__ */
|
|
20794
|
-
/* @__PURE__ */
|
|
21101
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21102
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
21103
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
20795
21104
|
] }),
|
|
20796
|
-
error && /* @__PURE__ */
|
|
21105
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
20797
21106
|
]
|
|
20798
21107
|
}
|
|
20799
21108
|
);
|
|
@@ -20933,8 +21242,8 @@ function AiFadeCarouselOverlay({
|
|
|
20933
21242
|
const activeItemRect = useLiveItemRect2(active);
|
|
20934
21243
|
const TOOLBAR_APPROX_H = 90;
|
|
20935
21244
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
20936
|
-
return /* @__PURE__ */
|
|
20937
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
21245
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
21246
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
20938
21247
|
"button",
|
|
20939
21248
|
{
|
|
20940
21249
|
type: "button",
|
|
@@ -20963,10 +21272,10 @@ function AiFadeCarouselOverlay({
|
|
|
20963
21272
|
fontSize: 14,
|
|
20964
21273
|
fontWeight: 700
|
|
20965
21274
|
},
|
|
20966
|
-
children: /* @__PURE__ */
|
|
21275
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
20967
21276
|
}
|
|
20968
21277
|
),
|
|
20969
|
-
swapping && /* @__PURE__ */
|
|
21278
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
20970
21279
|
"div",
|
|
20971
21280
|
{
|
|
20972
21281
|
ref: skeletonRef,
|
|
@@ -20984,15 +21293,15 @@ function AiFadeCarouselOverlay({
|
|
|
20984
21293
|
zIndex: 2147483646,
|
|
20985
21294
|
pointerEvents: "none"
|
|
20986
21295
|
},
|
|
20987
|
-
children: /* @__PURE__ */
|
|
21296
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
20988
21297
|
}
|
|
20989
21298
|
),
|
|
20990
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
21299
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
20991
21300
|
ItemInteractionLayer,
|
|
20992
21301
|
{
|
|
20993
21302
|
rect: activeItemRect,
|
|
20994
21303
|
state: toolbarState,
|
|
20995
|
-
toolbar: /* @__PURE__ */
|
|
21304
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
20996
21305
|
CarouselSlideToolbar,
|
|
20997
21306
|
{
|
|
20998
21307
|
pending,
|
|
@@ -21183,118 +21492,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21183
21492
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21184
21493
|
import { useEffect as useEffect15 } from "react";
|
|
21185
21494
|
|
|
21186
|
-
// src/ui/dialog.tsx
|
|
21187
|
-
import * as React9 from "react";
|
|
21188
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21189
|
-
import { X as X2 } from "lucide-react";
|
|
21190
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21191
|
-
function Dialog2({
|
|
21192
|
-
...props
|
|
21193
|
-
}) {
|
|
21194
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21195
|
-
}
|
|
21196
|
-
function DialogPortal({
|
|
21197
|
-
...props
|
|
21198
|
-
}) {
|
|
21199
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
21200
|
-
}
|
|
21201
|
-
function DialogOverlay({
|
|
21202
|
-
className,
|
|
21203
|
-
...props
|
|
21204
|
-
}) {
|
|
21205
|
-
return /* @__PURE__ */ jsx24(
|
|
21206
|
-
DialogPrimitive.Overlay,
|
|
21207
|
-
{
|
|
21208
|
-
"data-slot": "dialog-overlay",
|
|
21209
|
-
"data-ohw-link-modal-root": "",
|
|
21210
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21211
|
-
...props
|
|
21212
|
-
}
|
|
21213
|
-
);
|
|
21214
|
-
}
|
|
21215
|
-
var DialogContent = React9.forwardRef(
|
|
21216
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21217
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21218
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
21219
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21220
|
-
/* @__PURE__ */ jsxs15(
|
|
21221
|
-
DialogPrimitive.Content,
|
|
21222
|
-
{
|
|
21223
|
-
ref,
|
|
21224
|
-
"data-slot": "dialog-content",
|
|
21225
|
-
className: cn(
|
|
21226
|
-
positionMode,
|
|
21227
|
-
"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",
|
|
21228
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21229
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21230
|
-
className
|
|
21231
|
-
),
|
|
21232
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21233
|
-
...props,
|
|
21234
|
-
children: [
|
|
21235
|
-
children,
|
|
21236
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
21237
|
-
DialogPrimitive.Close,
|
|
21238
|
-
{
|
|
21239
|
-
type: "button",
|
|
21240
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21241
|
-
"aria-label": "Close",
|
|
21242
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
21243
|
-
}
|
|
21244
|
-
) : null
|
|
21245
|
-
]
|
|
21246
|
-
}
|
|
21247
|
-
)
|
|
21248
|
-
] });
|
|
21249
|
-
}
|
|
21250
|
-
);
|
|
21251
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21252
|
-
function DialogHeader({
|
|
21253
|
-
className,
|
|
21254
|
-
...props
|
|
21255
|
-
}) {
|
|
21256
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21257
|
-
}
|
|
21258
|
-
function DialogFooter({
|
|
21259
|
-
className,
|
|
21260
|
-
...props
|
|
21261
|
-
}) {
|
|
21262
|
-
return /* @__PURE__ */ jsx24(
|
|
21263
|
-
"div",
|
|
21264
|
-
{
|
|
21265
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21266
|
-
...props
|
|
21267
|
-
}
|
|
21268
|
-
);
|
|
21269
|
-
}
|
|
21270
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21271
|
-
DialogPrimitive.Title,
|
|
21272
|
-
{
|
|
21273
|
-
ref,
|
|
21274
|
-
className: cn(
|
|
21275
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21276
|
-
className
|
|
21277
|
-
),
|
|
21278
|
-
...props
|
|
21279
|
-
}
|
|
21280
|
-
));
|
|
21281
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21282
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
21283
|
-
DialogPrimitive.Description,
|
|
21284
|
-
{
|
|
21285
|
-
ref,
|
|
21286
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21287
|
-
...props
|
|
21288
|
-
}
|
|
21289
|
-
));
|
|
21290
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21291
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21292
|
-
|
|
21293
21495
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
21294
21496
|
import { Info, X as X4 } from "lucide-react";
|
|
21295
21497
|
|
|
21296
21498
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
21297
|
-
import { ArrowRight as
|
|
21499
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
21298
21500
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
21299
21501
|
function DestinationBreadcrumb({
|
|
21300
21502
|
pageTitle,
|
|
@@ -21308,7 +21510,7 @@ function DestinationBreadcrumb({
|
|
|
21308
21510
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
21309
21511
|
] }),
|
|
21310
21512
|
/* @__PURE__ */ jsx25(
|
|
21311
|
-
|
|
21513
|
+
ArrowRight3,
|
|
21312
21514
|
{
|
|
21313
21515
|
size: 16,
|
|
21314
21516
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -21420,7 +21622,7 @@ function Label({ className, ...props }) {
|
|
|
21420
21622
|
}
|
|
21421
21623
|
|
|
21422
21624
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21423
|
-
import { ChevronDown as
|
|
21625
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
21424
21626
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
21425
21627
|
function FieldChevron({
|
|
21426
21628
|
onClick
|
|
@@ -21433,7 +21635,7 @@ function FieldChevron({
|
|
|
21433
21635
|
onClick,
|
|
21434
21636
|
"aria-label": "Open page list",
|
|
21435
21637
|
tabIndex: -1,
|
|
21436
|
-
children: /* @__PURE__ */ jsx29(
|
|
21638
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
21437
21639
|
}
|
|
21438
21640
|
);
|
|
21439
21641
|
}
|
|
@@ -21663,7 +21865,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21663
21865
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21664
21866
|
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21665
21867
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21666
|
-
import { ArrowLeft as
|
|
21868
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
21667
21869
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
21668
21870
|
|
|
21669
21871
|
// src/lib/parent-scroll.ts
|
|
@@ -21940,7 +22142,7 @@ function SectionPickerOverlay({
|
|
|
21940
22142
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
21941
22143
|
onClick: onBack,
|
|
21942
22144
|
children: [
|
|
21943
|
-
/* @__PURE__ */ jsx31(
|
|
22145
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
21944
22146
|
"Back"
|
|
21945
22147
|
]
|
|
21946
22148
|
}
|
|
@@ -22009,7 +22211,7 @@ function SectionPickerOverlay({
|
|
|
22009
22211
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
22010
22212
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
22011
22213
|
"aria-hidden": true,
|
|
22012
|
-
children: /* @__PURE__ */ jsx31(
|
|
22214
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
22013
22215
|
}
|
|
22014
22216
|
) : null
|
|
22015
22217
|
]
|
|
@@ -22393,6 +22595,7 @@ function shouldUseDevFixtures() {
|
|
|
22393
22595
|
function getLogoElement(el) {
|
|
22394
22596
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
22395
22597
|
if (marked) return marked;
|
|
22598
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
22396
22599
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
22397
22600
|
if (!root) return null;
|
|
22398
22601
|
const anchor = el.closest("a");
|
|
@@ -22462,7 +22665,7 @@ function addFooterColumnWithPersist({
|
|
|
22462
22665
|
import {
|
|
22463
22666
|
useCallback as useCallback9,
|
|
22464
22667
|
useEffect as useEffect16,
|
|
22465
|
-
useLayoutEffect as
|
|
22668
|
+
useLayoutEffect as useLayoutEffect6,
|
|
22466
22669
|
useRef as useRef11,
|
|
22467
22670
|
useState as useState15
|
|
22468
22671
|
} from "react";
|
|
@@ -22559,7 +22762,7 @@ function FloatingPanel({
|
|
|
22559
22762
|
return () => window.removeEventListener("message", onParentScroll);
|
|
22560
22763
|
}, [open]);
|
|
22561
22764
|
const positionRef = useRef11(position);
|
|
22562
|
-
|
|
22765
|
+
useLayoutEffect6(() => {
|
|
22563
22766
|
if (!open) {
|
|
22564
22767
|
positionRef.current = position;
|
|
22565
22768
|
return;
|
|
@@ -22569,7 +22772,7 @@ function FloatingPanel({
|
|
|
22569
22772
|
}
|
|
22570
22773
|
positionRef.current = position;
|
|
22571
22774
|
}, [open, position, liveScroll, parentScroll]);
|
|
22572
|
-
|
|
22775
|
+
useLayoutEffect6(() => {
|
|
22573
22776
|
if (!open || !panelRef.current) return;
|
|
22574
22777
|
const el = panelRef.current;
|
|
22575
22778
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -22778,7 +22981,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
22778
22981
|
}
|
|
22779
22982
|
|
|
22780
22983
|
// src/ui/button-style-panel.tsx
|
|
22781
|
-
import { Check as
|
|
22984
|
+
import { Check as Check5 } from "lucide-react";
|
|
22782
22985
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
22783
22986
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
22784
22987
|
function ButtonStylePanel({
|
|
@@ -22849,7 +23052,7 @@ function ButtonStylePanel({
|
|
|
22849
23052
|
{
|
|
22850
23053
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
22851
23054
|
"aria-hidden": true,
|
|
22852
|
-
children: /* @__PURE__ */ jsx35(
|
|
23055
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
22853
23056
|
}
|
|
22854
23057
|
) : null
|
|
22855
23058
|
]
|
|
@@ -23874,7 +24077,7 @@ function useSectionDrag({
|
|
|
23874
24077
|
}
|
|
23875
24078
|
|
|
23876
24079
|
// src/ui/footer-container-chrome.tsx
|
|
23877
|
-
import { Plus as
|
|
24080
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
23878
24081
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
23879
24082
|
function FooterContainerChrome({
|
|
23880
24083
|
rect,
|
|
@@ -23915,7 +24118,7 @@ function FooterContainerChrome({
|
|
|
23915
24118
|
if (addDisabled) return;
|
|
23916
24119
|
onAdd();
|
|
23917
24120
|
},
|
|
23918
|
-
children: /* @__PURE__ */ jsx36(
|
|
24121
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
23919
24122
|
}
|
|
23920
24123
|
) }),
|
|
23921
24124
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -24093,8 +24296,236 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24093
24296
|
return false;
|
|
24094
24297
|
}
|
|
24095
24298
|
|
|
24299
|
+
// src/lib/build-page-sync.ts
|
|
24300
|
+
import { useEffect as useEffect19 } from "react";
|
|
24301
|
+
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24302
|
+
function normalisePath(path) {
|
|
24303
|
+
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
24304
|
+
if (!trimmed || trimmed === "/") return "/";
|
|
24305
|
+
return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
|
|
24306
|
+
}
|
|
24307
|
+
function isDeadPageHref(href, livePaths) {
|
|
24308
|
+
const value = href.trim();
|
|
24309
|
+
if (!value.startsWith("/") || value.startsWith("//")) return false;
|
|
24310
|
+
const path = normalisePath(value);
|
|
24311
|
+
if (path === "/") return false;
|
|
24312
|
+
return !livePaths.some((live) => {
|
|
24313
|
+
const p = normalisePath(live);
|
|
24314
|
+
return p === path || p !== "/" && path.startsWith(`${p}/`);
|
|
24315
|
+
});
|
|
24316
|
+
}
|
|
24317
|
+
var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
24318
|
+
function planBuildPageSync(links, msg) {
|
|
24319
|
+
const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
|
|
24320
|
+
const removed = new Set((msg.removed ?? []).map(normalisePath));
|
|
24321
|
+
const remove = [];
|
|
24322
|
+
const relabel = [];
|
|
24323
|
+
const retarget = [];
|
|
24324
|
+
const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
|
|
24325
|
+
for (const link of links) {
|
|
24326
|
+
const href = link.href.trim();
|
|
24327
|
+
const isPage = href.startsWith("/") && !href.startsWith("//");
|
|
24328
|
+
if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
|
|
24329
|
+
if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
|
|
24330
|
+
else remove.push(link.hrefKey);
|
|
24331
|
+
continue;
|
|
24332
|
+
}
|
|
24333
|
+
if (isPage) {
|
|
24334
|
+
const path = normalisePath(href);
|
|
24335
|
+
const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
|
|
24336
|
+
if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
|
|
24337
|
+
relabel.push({ hrefKey: link.hrefKey, label: rename.label });
|
|
24338
|
+
}
|
|
24339
|
+
continue;
|
|
24340
|
+
}
|
|
24341
|
+
if (href.startsWith("#") || href.startsWith("/#")) {
|
|
24342
|
+
const anchor = href.replace(/^\/?#/u, "").toLowerCase();
|
|
24343
|
+
const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
|
|
24344
|
+
if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
|
|
24345
|
+
relabel.push({ hrefKey: link.hrefKey, label: target.label });
|
|
24346
|
+
}
|
|
24347
|
+
}
|
|
24348
|
+
}
|
|
24349
|
+
return { remove, relabel, retarget };
|
|
24350
|
+
}
|
|
24351
|
+
function linkHref(el) {
|
|
24352
|
+
const key = el.getAttribute("data-ohw-href-key");
|
|
24353
|
+
const stored = key ? getStoredLinkHref(key) : void 0;
|
|
24354
|
+
return stored ?? el.getAttribute("href") ?? "";
|
|
24355
|
+
}
|
|
24356
|
+
function labelEl(anchor) {
|
|
24357
|
+
return anchor.querySelector('[data-ohw-editable="text"]');
|
|
24358
|
+
}
|
|
24359
|
+
function collectLinks() {
|
|
24360
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24361
|
+
const links = [];
|
|
24362
|
+
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
24363
|
+
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
24364
|
+
if (seen.has(hrefKey)) return;
|
|
24365
|
+
const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
24366
|
+
if (!area) return;
|
|
24367
|
+
const label = labelEl(el);
|
|
24368
|
+
if (!label && area !== "chrome") return;
|
|
24369
|
+
seen.add(hrefKey);
|
|
24370
|
+
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
24371
|
+
});
|
|
24372
|
+
return links;
|
|
24373
|
+
}
|
|
24374
|
+
function applyBuildPageSync(msg, deps) {
|
|
24375
|
+
const plan = planBuildPageSync(collectLinks(), msg);
|
|
24376
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
24377
|
+
for (const hrefKey of plan.remove) {
|
|
24378
|
+
const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
24379
|
+
if (!anchor) continue;
|
|
24380
|
+
const nav = isNavbarHrefKey(hrefKey);
|
|
24381
|
+
const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
|
|
24382
|
+
if (!result) continue;
|
|
24383
|
+
for (const key of result.removedKeys) {
|
|
24384
|
+
nodes.set(key, "");
|
|
24385
|
+
clearStoredLinkHref(key);
|
|
24386
|
+
}
|
|
24387
|
+
nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
|
|
24388
|
+
}
|
|
24389
|
+
for (const { hrefKey, label } of plan.relabel) {
|
|
24390
|
+
const labelKey = hrefKey.replace(/-href$/u, "-label");
|
|
24391
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24392
|
+
const el = labelEl(anchor);
|
|
24393
|
+
if (el) el.textContent = label;
|
|
24394
|
+
});
|
|
24395
|
+
nodes.set(labelKey, label);
|
|
24396
|
+
}
|
|
24397
|
+
for (const { hrefKey, href } of plan.retarget) {
|
|
24398
|
+
setStoredLinkHref(hrefKey, href);
|
|
24399
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24400
|
+
if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
|
|
24401
|
+
});
|
|
24402
|
+
nodes.set(hrefKey, href);
|
|
24403
|
+
}
|
|
24404
|
+
if (nodes.size === 0) return 0;
|
|
24405
|
+
deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
|
|
24406
|
+
deps.postToParent({
|
|
24407
|
+
type: "ow:change",
|
|
24408
|
+
nodes: [...nodes].map(([key, text]) => ({ key, text }))
|
|
24409
|
+
});
|
|
24410
|
+
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24411
|
+
}
|
|
24412
|
+
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24413
|
+
useEffect19(() => {
|
|
24414
|
+
if (!isEditMode) return;
|
|
24415
|
+
const onMessage = (e) => {
|
|
24416
|
+
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
24417
|
+
const changed = applyBuildPageSync(e.data, {
|
|
24418
|
+
getEditContent: () => editContentRef.current,
|
|
24419
|
+
setEditContent: (next) => {
|
|
24420
|
+
editContentRef.current = next;
|
|
24421
|
+
},
|
|
24422
|
+
postToParent: postToParent2
|
|
24423
|
+
});
|
|
24424
|
+
postToParent2({ type: "ow:pages-synced", changed });
|
|
24425
|
+
};
|
|
24426
|
+
window.addEventListener("message", onMessage);
|
|
24427
|
+
return () => window.removeEventListener("message", onMessage);
|
|
24428
|
+
}, [isEditMode, editContentRef, postToParent2]);
|
|
24429
|
+
}
|
|
24430
|
+
|
|
24431
|
+
// src/lib/nav-page-sync.ts
|
|
24432
|
+
function labelKeyFor(hrefKey) {
|
|
24433
|
+
return hrefKey.replace(/-href$/, "-label");
|
|
24434
|
+
}
|
|
24435
|
+
function isPageLinkKey(key) {
|
|
24436
|
+
return isNavbarHrefKey(key) || isFooterHrefKey(key);
|
|
24437
|
+
}
|
|
24438
|
+
function currentHref(key, anchor, content) {
|
|
24439
|
+
const stored = content[key];
|
|
24440
|
+
if (typeof stored === "string" && stored.length > 0) return stored;
|
|
24441
|
+
return anchor.getAttribute("href") ?? "";
|
|
24442
|
+
}
|
|
24443
|
+
function normalizePath2(value) {
|
|
24444
|
+
if (value.length > 1 && value.endsWith("/")) return value.slice(0, -1);
|
|
24445
|
+
return value;
|
|
24446
|
+
}
|
|
24447
|
+
function pointsAt(href, path) {
|
|
24448
|
+
const normalized = normalizePath2(href);
|
|
24449
|
+
const target = normalizePath2(path);
|
|
24450
|
+
if (normalized === target) return true;
|
|
24451
|
+
return (normalized.startsWith(`${target}#`) || normalized.startsWith(`${target}?`)) && target !== "/";
|
|
24452
|
+
}
|
|
24453
|
+
function retargetHref(href, oldPath, newPath) {
|
|
24454
|
+
const normalized = normalizePath2(href);
|
|
24455
|
+
const target = normalizePath2(oldPath);
|
|
24456
|
+
if (normalized === target) return newPath;
|
|
24457
|
+
return `${newPath}${normalized.slice(target.length)}`;
|
|
24458
|
+
}
|
|
24459
|
+
function setLabelText(key, text) {
|
|
24460
|
+
document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
|
|
24461
|
+
el.textContent = text;
|
|
24462
|
+
});
|
|
24463
|
+
}
|
|
24464
|
+
function commit(delta, deps) {
|
|
24465
|
+
if (Object.keys(delta).length === 0) return;
|
|
24466
|
+
deps.setEditContent({ ...deps.getEditContent(), ...delta });
|
|
24467
|
+
deps.postToParent({
|
|
24468
|
+
type: "ow:change",
|
|
24469
|
+
nodes: Object.entries(delta).map(([key, text]) => ({ key, text }))
|
|
24470
|
+
});
|
|
24471
|
+
}
|
|
24472
|
+
function navLinksTo(path, content) {
|
|
24473
|
+
return Array.from(document.querySelectorAll("[data-ohw-href-key]")).filter((anchor) => {
|
|
24474
|
+
const key = anchor.getAttribute("data-ohw-href-key");
|
|
24475
|
+
return isNavbarHrefKey(key) && pointsAt(currentHref(key, anchor, content), path);
|
|
24476
|
+
}).map((anchor) => anchor.getAttribute("data-ohw-href-key"));
|
|
24477
|
+
}
|
|
24478
|
+
function addNavLinkForPage(page, deps) {
|
|
24479
|
+
const content = deps.getEditContent();
|
|
24480
|
+
if (navLinksTo(page.path, content).length > 0) return false;
|
|
24481
|
+
const roots = listNavbarRootItems();
|
|
24482
|
+
const afterAnchor = roots[roots.length - 1] ?? null;
|
|
24483
|
+
let inserted;
|
|
24484
|
+
try {
|
|
24485
|
+
inserted = insertNavbarItem(page.path, page.title, afterAnchor);
|
|
24486
|
+
} catch {
|
|
24487
|
+
return false;
|
|
24488
|
+
}
|
|
24489
|
+
const { hrefKey, labelKey, index } = inserted;
|
|
24490
|
+
deps.applyLinkByKey(hrefKey, page.path);
|
|
24491
|
+
setLabelText(labelKey, page.title);
|
|
24492
|
+
commit(
|
|
24493
|
+
{
|
|
24494
|
+
[hrefKey]: page.path,
|
|
24495
|
+
[labelKey]: page.title,
|
|
24496
|
+
[NAV_COUNT_KEY]: String(index + 1),
|
|
24497
|
+
[NAV_ORDER_KEY]: getNavbarOrderJson()
|
|
24498
|
+
},
|
|
24499
|
+
deps
|
|
24500
|
+
);
|
|
24501
|
+
return true;
|
|
24502
|
+
}
|
|
24503
|
+
function retargetPageLinks(change, deps) {
|
|
24504
|
+
const { oldPath, newPath, oldTitle, newTitle } = change;
|
|
24505
|
+
if (!oldPath || !newPath || normalizePath2(oldPath) === normalizePath2(newPath)) return 0;
|
|
24506
|
+
const content = deps.getEditContent();
|
|
24507
|
+
const delta = {};
|
|
24508
|
+
for (const anchor of Array.from(document.querySelectorAll("[data-ohw-href-key]"))) {
|
|
24509
|
+
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
24510
|
+
if (!isPageLinkKey(hrefKey)) continue;
|
|
24511
|
+
const href = currentHref(hrefKey, anchor, content);
|
|
24512
|
+
if (!pointsAt(href, oldPath)) continue;
|
|
24513
|
+
const nextHref = retargetHref(href, oldPath, newPath);
|
|
24514
|
+
deps.applyLinkByKey(hrefKey, nextHref);
|
|
24515
|
+
delta[hrefKey] = nextHref;
|
|
24516
|
+
if (!oldTitle || !newTitle) continue;
|
|
24517
|
+
const labelKey = labelKeyFor(hrefKey);
|
|
24518
|
+
const label = content[labelKey] ?? anchor.querySelector('[data-ohw-editable="text"]')?.textContent ?? "";
|
|
24519
|
+
if (label.trim() !== oldTitle) continue;
|
|
24520
|
+
setLabelText(labelKey, newTitle);
|
|
24521
|
+
delta[labelKey] = newTitle;
|
|
24522
|
+
}
|
|
24523
|
+
commit(delta, deps);
|
|
24524
|
+
return Object.keys(delta).filter((key) => key.endsWith("-href")).length;
|
|
24525
|
+
}
|
|
24526
|
+
|
|
24096
24527
|
// src/ui/navbar-container-chrome.tsx
|
|
24097
|
-
import { Plus as
|
|
24528
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
24098
24529
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
24099
24530
|
function NavbarContainerChrome({
|
|
24100
24531
|
rect,
|
|
@@ -24130,7 +24561,7 @@ function NavbarContainerChrome({
|
|
|
24130
24561
|
e.stopPropagation();
|
|
24131
24562
|
onAdd();
|
|
24132
24563
|
},
|
|
24133
|
-
children: /* @__PURE__ */ jsx37(
|
|
24564
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
24134
24565
|
}
|
|
24135
24566
|
)
|
|
24136
24567
|
}
|
|
@@ -24202,7 +24633,7 @@ function Badge({ className, variant, ...props }) {
|
|
|
24202
24633
|
}
|
|
24203
24634
|
|
|
24204
24635
|
// src/OhhwellsBridge.tsx
|
|
24205
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
24636
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
|
|
24206
24637
|
import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
24207
24638
|
var PRIMARY7 = "#0885FE";
|
|
24208
24639
|
var IMAGE_FADE_MS = 300;
|
|
@@ -24980,7 +25411,7 @@ function getNavigationSelectionParent(el) {
|
|
|
24980
25411
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
24981
25412
|
return resolveFooterLinksContainerFrom(el);
|
|
24982
25413
|
}
|
|
24983
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
25414
|
+
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)) {
|
|
24984
25415
|
return getNavigationRoot(el);
|
|
24985
25416
|
}
|
|
24986
25417
|
return null;
|
|
@@ -25202,7 +25633,6 @@ var ICONS = {
|
|
|
25202
25633
|
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"/>',
|
|
25203
25634
|
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"/>'
|
|
25204
25635
|
};
|
|
25205
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
25206
25636
|
var SELECTION_CHROME_GAP2 = 4;
|
|
25207
25637
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
25208
25638
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -25300,7 +25730,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
25300
25730
|
el.style.top = `${top}px`;
|
|
25301
25731
|
el.style.height = `${height}px`;
|
|
25302
25732
|
}
|
|
25303
|
-
var
|
|
25733
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
25304
25734
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
25305
25735
|
const isAbove = transform.includes("translateY(-100%)");
|
|
25306
25736
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -25327,8 +25757,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
25327
25757
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
25328
25758
|
const half = toolbarWidth / 2;
|
|
25329
25759
|
return Math.max(
|
|
25330
|
-
|
|
25331
|
-
Math.min(centerX, window.innerWidth -
|
|
25760
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
25761
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
25332
25762
|
);
|
|
25333
25763
|
}
|
|
25334
25764
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -25702,7 +26132,7 @@ function OhhwellsBridge() {
|
|
|
25702
26132
|
const searchParams = useSearchParams();
|
|
25703
26133
|
const isEditMode = isEditSessionActive();
|
|
25704
26134
|
const [bridgeRoot, setBridgeRoot] = useState18(null);
|
|
25705
|
-
|
|
26135
|
+
useEffect20(() => {
|
|
25706
26136
|
const figtreeFontId = "ohw-figtree-font";
|
|
25707
26137
|
if (!document.getElementById(figtreeFontId)) {
|
|
25708
26138
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25729,7 +26159,7 @@ function OhhwellsBridge() {
|
|
|
25729
26159
|
}, []);
|
|
25730
26160
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25731
26161
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
25732
|
-
|
|
26162
|
+
useLayoutEffect7(() => {
|
|
25733
26163
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25734
26164
|
if (next !== subdomain) setSubdomain(next);
|
|
25735
26165
|
if (next) return;
|
|
@@ -25741,7 +26171,7 @@ function OhhwellsBridge() {
|
|
|
25741
26171
|
}, 0);
|
|
25742
26172
|
return () => window.clearTimeout(t);
|
|
25743
26173
|
}, [subdomainFromQuery, subdomain]);
|
|
25744
|
-
|
|
26174
|
+
useEffect20(() => {
|
|
25745
26175
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
25746
26176
|
const url = new URL(window.location.href);
|
|
25747
26177
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -25761,14 +26191,14 @@ function OhhwellsBridge() {
|
|
|
25761
26191
|
const [fetchState, setFetchState] = useState18("idle");
|
|
25762
26192
|
const [showBranding, setShowBranding] = useState18(false);
|
|
25763
26193
|
const autoSaveTimers = useRef14(/* @__PURE__ */ new Map());
|
|
25764
|
-
|
|
26194
|
+
useEffect20(() => {
|
|
25765
26195
|
stampBridgeVersionOnDocument();
|
|
25766
26196
|
}, []);
|
|
25767
|
-
|
|
26197
|
+
useEffect20(() => {
|
|
25768
26198
|
if (isEditMode) return;
|
|
25769
26199
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
25770
26200
|
}, [isEditMode, subdomain, fetchState]);
|
|
25771
|
-
|
|
26201
|
+
useEffect20(() => {
|
|
25772
26202
|
if (isEditMode || !subdomain) return;
|
|
25773
26203
|
const onError = (event) => {
|
|
25774
26204
|
reportOutageBeacon({
|
|
@@ -25909,7 +26339,7 @@ function OhhwellsBridge() {
|
|
|
25909
26339
|
}, []);
|
|
25910
26340
|
const selectMediaElementRef = useRef14(selectMediaElement);
|
|
25911
26341
|
selectMediaElementRef.current = selectMediaElement;
|
|
25912
|
-
|
|
26342
|
+
useEffect20(() => {
|
|
25913
26343
|
if (!selectedMedia) return;
|
|
25914
26344
|
const update = () => {
|
|
25915
26345
|
const el = selectedMediaElRef.current;
|
|
@@ -26124,7 +26554,7 @@ function OhhwellsBridge() {
|
|
|
26124
26554
|
const [fieldDragging, setFieldDragging] = useState18(false);
|
|
26125
26555
|
const clearFormPickRef = useRef14(clearFormPick);
|
|
26126
26556
|
clearFormPickRef.current = clearFormPick;
|
|
26127
|
-
|
|
26557
|
+
useEffect20(() => {
|
|
26128
26558
|
const el = fieldPickElRef.current;
|
|
26129
26559
|
if (!el || fieldPickRect === null) return;
|
|
26130
26560
|
const observer = new ResizeObserver(() => {
|
|
@@ -26133,7 +26563,7 @@ function OhhwellsBridge() {
|
|
|
26133
26563
|
observer.observe(el);
|
|
26134
26564
|
return () => observer.disconnect();
|
|
26135
26565
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26136
|
-
|
|
26566
|
+
useEffect20(() => {
|
|
26137
26567
|
const el = formPickElRef.current;
|
|
26138
26568
|
if (!el || formPickRect === null) return;
|
|
26139
26569
|
const observer = new ResizeObserver(() => {
|
|
@@ -26160,7 +26590,7 @@ function OhhwellsBridge() {
|
|
|
26160
26590
|
const hoveredItemElRef = useRef14(null);
|
|
26161
26591
|
const [hoveredItemRect, setHoveredItemRect] = useState18(null);
|
|
26162
26592
|
const [hoveredTextRect, setHoveredTextRect] = useState18(null);
|
|
26163
|
-
|
|
26593
|
+
useEffect20(() => {
|
|
26164
26594
|
const sync = () => {
|
|
26165
26595
|
const el = document.querySelector(
|
|
26166
26596
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26210,21 +26640,6 @@ function OhhwellsBridge() {
|
|
|
26210
26640
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
26211
26641
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
26212
26642
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26213
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26214
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
26215
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26216
|
-
const floatingPanelRef = useRef14(null);
|
|
26217
|
-
floatingPanelRef.current = floatingPanel;
|
|
26218
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26219
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
26220
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
26221
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26222
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26223
|
-
const buttonPointerDragRef = useRef14(null);
|
|
26224
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26225
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26226
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26227
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26228
26643
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
26229
26644
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
26230
26645
|
const footerDragRef = useRef14(null);
|
|
@@ -26238,6 +26653,7 @@ function OhhwellsBridge() {
|
|
|
26238
26653
|
const linkPopoverSessionRef = useRef14(null);
|
|
26239
26654
|
const addNavAfterAnchorRef = useRef14(null);
|
|
26240
26655
|
const editContentRef = useRef14({});
|
|
26656
|
+
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
26241
26657
|
const aiSectionsRef = useRef14("");
|
|
26242
26658
|
const aiFooterRef = useRef14("");
|
|
26243
26659
|
const applyTreeLocalRef = useRef14(
|
|
@@ -26250,6 +26666,21 @@ function OhhwellsBridge() {
|
|
|
26250
26666
|
const stylesRef = useRef14("");
|
|
26251
26667
|
const appliedDrawerRef = useRef14(null);
|
|
26252
26668
|
const pendingDeleteUndoRef = useRef14(null);
|
|
26669
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
26670
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
26671
|
+
const floatingPanelRef = useRef14(null);
|
|
26672
|
+
floatingPanelRef.current = floatingPanel;
|
|
26673
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
26674
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
26675
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
26676
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
26677
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
26678
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
26679
|
+
const buttonPointerDragRef = useRef14(null);
|
|
26680
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
26681
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
26682
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
26683
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
26253
26684
|
const [sitePages, setSitePages] = useState18([]);
|
|
26254
26685
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
26255
26686
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -26259,8 +26690,19 @@ function OhhwellsBridge() {
|
|
|
26259
26690
|
const linkPopoverOpenRef = useRef14(false);
|
|
26260
26691
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26261
26692
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26693
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
26262
26694
|
linkPopoverSessionRef.current = linkPopover;
|
|
26263
|
-
|
|
26695
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
26696
|
+
useEffect20(() => {
|
|
26697
|
+
const syncViewport = () => {
|
|
26698
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
26699
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
26700
|
+
};
|
|
26701
|
+
syncViewport();
|
|
26702
|
+
window.addEventListener("resize", syncViewport);
|
|
26703
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
26704
|
+
}, []);
|
|
26705
|
+
useEffect20(() => {
|
|
26264
26706
|
setSectionOrderPersistHandler((entries) => {
|
|
26265
26707
|
const currentPath = window.location.pathname;
|
|
26266
26708
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26270,7 +26712,7 @@ function OhhwellsBridge() {
|
|
|
26270
26712
|
});
|
|
26271
26713
|
return () => setSectionOrderPersistHandler(null);
|
|
26272
26714
|
}, []);
|
|
26273
|
-
|
|
26715
|
+
useEffect20(() => {
|
|
26274
26716
|
setAiFooterMountOptions({
|
|
26275
26717
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26276
26718
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26354,7 +26796,7 @@ function OhhwellsBridge() {
|
|
|
26354
26796
|
}, [isEditMode, pathname]);
|
|
26355
26797
|
const runSectionsPrefetchRef = useRef14(runSectionsPrefetch);
|
|
26356
26798
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26357
|
-
|
|
26799
|
+
useEffect20(() => {
|
|
26358
26800
|
if (!linkPopover) {
|
|
26359
26801
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26360
26802
|
return;
|
|
@@ -26382,7 +26824,7 @@ function OhhwellsBridge() {
|
|
|
26382
26824
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26383
26825
|
};
|
|
26384
26826
|
}, [linkPopover, postToParent2]);
|
|
26385
|
-
|
|
26827
|
+
useEffect20(() => {
|
|
26386
26828
|
if (!isEditMode) return;
|
|
26387
26829
|
const useFixtures = shouldUseDevFixtures();
|
|
26388
26830
|
if (useFixtures) {
|
|
@@ -26408,14 +26850,51 @@ function OhhwellsBridge() {
|
|
|
26408
26850
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26409
26851
|
return () => window.removeEventListener("message", onSitePages);
|
|
26410
26852
|
}, [isEditMode, postToParent2]);
|
|
26411
|
-
|
|
26853
|
+
useEffect20(() => {
|
|
26854
|
+
if (!isEditMode) return;
|
|
26855
|
+
const deps = {
|
|
26856
|
+
getEditContent: () => editContentRef.current,
|
|
26857
|
+
setEditContent: (next) => {
|
|
26858
|
+
editContentRef.current = next;
|
|
26859
|
+
},
|
|
26860
|
+
applyLinkByKey,
|
|
26861
|
+
postToParent: postToParent2
|
|
26862
|
+
};
|
|
26863
|
+
const onPageMessage = (e) => {
|
|
26864
|
+
if (e.data?.type === "ow:page-created") {
|
|
26865
|
+
const { path, title } = e.data;
|
|
26866
|
+
if (typeof path !== "string" || !path) return;
|
|
26867
|
+
if (addNavLinkForPage({ path, title: typeof title === "string" && title ? title : path }, deps)) {
|
|
26868
|
+
enforceLinkHrefs();
|
|
26869
|
+
}
|
|
26870
|
+
return;
|
|
26871
|
+
}
|
|
26872
|
+
if (e.data?.type === "ow:page-renamed") {
|
|
26873
|
+
const { oldPath, newPath, oldTitle, newTitle } = e.data;
|
|
26874
|
+
if (typeof oldPath !== "string" || typeof newPath !== "string") return;
|
|
26875
|
+
const moved = retargetPageLinks(
|
|
26876
|
+
{
|
|
26877
|
+
oldPath,
|
|
26878
|
+
newPath,
|
|
26879
|
+
oldTitle: typeof oldTitle === "string" ? oldTitle : void 0,
|
|
26880
|
+
newTitle: typeof newTitle === "string" ? newTitle : void 0
|
|
26881
|
+
},
|
|
26882
|
+
deps
|
|
26883
|
+
);
|
|
26884
|
+
if (moved > 0) enforceLinkHrefs();
|
|
26885
|
+
}
|
|
26886
|
+
};
|
|
26887
|
+
window.addEventListener("message", onPageMessage);
|
|
26888
|
+
return () => window.removeEventListener("message", onPageMessage);
|
|
26889
|
+
}, [isEditMode, postToParent2]);
|
|
26890
|
+
useEffect20(() => {
|
|
26412
26891
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26413
26892
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26414
26893
|
if (Object.keys(manifest).length === 0) return;
|
|
26415
26894
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26416
26895
|
});
|
|
26417
26896
|
}, [isEditMode]);
|
|
26418
|
-
|
|
26897
|
+
useEffect20(() => {
|
|
26419
26898
|
const update = () => {
|
|
26420
26899
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26421
26900
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27674,7 +28153,7 @@ function OhhwellsBridge() {
|
|
|
27674
28153
|
},
|
|
27675
28154
|
[postToParent2]
|
|
27676
28155
|
);
|
|
27677
|
-
|
|
28156
|
+
useEffect20(() => {
|
|
27678
28157
|
const onDragOver = (e) => {
|
|
27679
28158
|
const dragged = buttonCollectionDragRef.current;
|
|
27680
28159
|
if (!dragged) return;
|
|
@@ -27745,7 +28224,7 @@ function OhhwellsBridge() {
|
|
|
27745
28224
|
setLogoSizeDraft(null);
|
|
27746
28225
|
deselectRef.current();
|
|
27747
28226
|
}, []);
|
|
27748
|
-
|
|
28227
|
+
useEffect20(() => {
|
|
27749
28228
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
27750
28229
|
if (!session || !logoSizeDraft) {
|
|
27751
28230
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -27903,7 +28382,7 @@ function OhhwellsBridge() {
|
|
|
27903
28382
|
deselectRef.current = deselect;
|
|
27904
28383
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
27905
28384
|
const lastSiteWideScopeRef = useRef14(null);
|
|
27906
|
-
|
|
28385
|
+
useEffect20(() => {
|
|
27907
28386
|
if (!isEditMode) {
|
|
27908
28387
|
if (lastSiteWideScopeRef.current !== false) {
|
|
27909
28388
|
lastSiteWideScopeRef.current = false;
|
|
@@ -27929,7 +28408,7 @@ function OhhwellsBridge() {
|
|
|
27929
28408
|
isFooterFrameSelection,
|
|
27930
28409
|
postToParent2
|
|
27931
28410
|
]);
|
|
27932
|
-
|
|
28411
|
+
useLayoutEffect7(() => {
|
|
27933
28412
|
if (!subdomain || isEditMode) {
|
|
27934
28413
|
setFetchState("done");
|
|
27935
28414
|
return;
|
|
@@ -27956,6 +28435,7 @@ function OhhwellsBridge() {
|
|
|
27956
28435
|
applyAiFooterFromContent(content);
|
|
27957
28436
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
27958
28437
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
28438
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
27959
28439
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
27960
28440
|
}
|
|
27961
28441
|
applyBrandChrome(content);
|
|
@@ -27966,15 +28446,16 @@ function OhhwellsBridge() {
|
|
|
27966
28446
|
if (key === "__ohw_sections") continue;
|
|
27967
28447
|
if (key === AI_SECTIONS_KEY) continue;
|
|
27968
28448
|
if (key === AI_FOOTER_KEY) continue;
|
|
28449
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28450
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
27969
28451
|
if (key === BRAND_KIT_KEY) continue;
|
|
27970
28452
|
if (key === STYLE_STORE_KEY) continue;
|
|
27971
28453
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
27972
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
27973
28454
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
27974
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
27975
28455
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
27976
28456
|
continue;
|
|
27977
28457
|
}
|
|
28458
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
27978
28459
|
if (applyVideoSettingNode(key, val)) continue;
|
|
27979
28460
|
if (applyCarouselNode(key, val)) continue;
|
|
27980
28461
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28014,6 +28495,7 @@ function OhhwellsBridge() {
|
|
|
28014
28495
|
});
|
|
28015
28496
|
applyLinkByKey(key, val);
|
|
28016
28497
|
}
|
|
28498
|
+
applySectionEmbeds(content);
|
|
28017
28499
|
applyLogoFromContent(content);
|
|
28018
28500
|
applyLogoSizes(content);
|
|
28019
28501
|
reconcileNavbarItemsFromContent(content);
|
|
@@ -28080,7 +28562,7 @@ function OhhwellsBridge() {
|
|
|
28080
28562
|
cancelled = true;
|
|
28081
28563
|
};
|
|
28082
28564
|
}, [subdomain, isEditMode]);
|
|
28083
|
-
|
|
28565
|
+
useEffect20(() => {
|
|
28084
28566
|
if (!isEditMode) return;
|
|
28085
28567
|
const resolveIndex = (form, clientY) => {
|
|
28086
28568
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28121,7 +28603,7 @@ function OhhwellsBridge() {
|
|
|
28121
28603
|
window.removeEventListener("drop", onDrop, true);
|
|
28122
28604
|
};
|
|
28123
28605
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28124
|
-
|
|
28606
|
+
useEffect20(() => {
|
|
28125
28607
|
if (!isEditMode) return;
|
|
28126
28608
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28127
28609
|
markFormFields(form);
|
|
@@ -28133,7 +28615,7 @@ function OhhwellsBridge() {
|
|
|
28133
28615
|
});
|
|
28134
28616
|
return () => observer.disconnect();
|
|
28135
28617
|
}, [isEditMode, fetchState, pathname]);
|
|
28136
|
-
|
|
28618
|
+
useEffect20(() => {
|
|
28137
28619
|
if (!isEditMode) return;
|
|
28138
28620
|
let saveTimer = null;
|
|
28139
28621
|
const onInput = (e) => {
|
|
@@ -28155,14 +28637,14 @@ function OhhwellsBridge() {
|
|
|
28155
28637
|
document.addEventListener("input", onInput, true);
|
|
28156
28638
|
return () => document.removeEventListener("input", onInput, true);
|
|
28157
28639
|
}, [isEditMode, persistFields]);
|
|
28158
|
-
|
|
28640
|
+
useEffect20(() => {
|
|
28159
28641
|
if (isEditMode || fetchState !== "done") return;
|
|
28160
28642
|
const content = contentCache.get(subdomain) ?? {};
|
|
28161
28643
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28162
28644
|
reconcileFieldsFromContent(form, content);
|
|
28163
28645
|
});
|
|
28164
28646
|
}, [isEditMode, fetchState, subdomain]);
|
|
28165
|
-
|
|
28647
|
+
useEffect20(() => {
|
|
28166
28648
|
if (!isEditMode) return;
|
|
28167
28649
|
const swallow = (e) => {
|
|
28168
28650
|
const target = e.target;
|
|
@@ -28171,14 +28653,14 @@ function OhhwellsBridge() {
|
|
|
28171
28653
|
document.addEventListener("submit", swallow, true);
|
|
28172
28654
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28173
28655
|
}, [isEditMode]);
|
|
28174
|
-
|
|
28656
|
+
useEffect20(() => {
|
|
28175
28657
|
if (isEditMode || fetchState !== "done") return;
|
|
28176
28658
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28177
28659
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28178
28660
|
console.log({ apiUrl, subdomain });
|
|
28179
28661
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28180
28662
|
}, [isEditMode, fetchState, subdomain]);
|
|
28181
|
-
|
|
28663
|
+
useEffect20(() => {
|
|
28182
28664
|
if (!subdomain || isEditMode) return;
|
|
28183
28665
|
let debounceTimer = null;
|
|
28184
28666
|
let observer = null;
|
|
@@ -28202,20 +28684,22 @@ function OhhwellsBridge() {
|
|
|
28202
28684
|
}
|
|
28203
28685
|
applyAiFooterFromContent(content);
|
|
28204
28686
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
28687
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
28205
28688
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
28206
28689
|
}
|
|
28207
28690
|
for (const [key, val] of Object.entries(content)) {
|
|
28208
28691
|
if (key === "__ohw_sections") continue;
|
|
28209
28692
|
if (key === AI_SECTIONS_KEY) continue;
|
|
28210
28693
|
if (key === AI_FOOTER_KEY) continue;
|
|
28694
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28695
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28211
28696
|
if (key === BRAND_KIT_KEY) continue;
|
|
28212
28697
|
if (key === STYLE_STORE_KEY) continue;
|
|
28213
28698
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
28214
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
28215
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
28216
28699
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
28217
28700
|
continue;
|
|
28218
28701
|
}
|
|
28702
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
28219
28703
|
if (applyVideoSettingNode(key, val)) continue;
|
|
28220
28704
|
if (applyCarouselNode(key, val)) continue;
|
|
28221
28705
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -28240,6 +28724,7 @@ function OhhwellsBridge() {
|
|
|
28240
28724
|
});
|
|
28241
28725
|
applyLinkByKey(key, val);
|
|
28242
28726
|
}
|
|
28727
|
+
applySectionEmbeds(content);
|
|
28243
28728
|
applyLogoFromContent(content);
|
|
28244
28729
|
reconcileNavbarItemsFromContent(content);
|
|
28245
28730
|
reconcileFooterOrderFromContent(content);
|
|
@@ -28295,16 +28780,16 @@ function OhhwellsBridge() {
|
|
|
28295
28780
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28296
28781
|
};
|
|
28297
28782
|
}, [subdomain, isEditMode, pathname]);
|
|
28298
|
-
|
|
28783
|
+
useLayoutEffect7(() => {
|
|
28299
28784
|
const el = document.getElementById("ohw-loader");
|
|
28300
28785
|
if (!el) return;
|
|
28301
28786
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28302
28787
|
el.style.display = visible ? "flex" : "none";
|
|
28303
28788
|
}, [subdomain, fetchState]);
|
|
28304
|
-
|
|
28789
|
+
useEffect20(() => {
|
|
28305
28790
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28306
28791
|
}, [pathname, postToParent2]);
|
|
28307
|
-
|
|
28792
|
+
useEffect20(() => {
|
|
28308
28793
|
if (!subdomain || isEditMode) return;
|
|
28309
28794
|
const content = contentCache.get(subdomain);
|
|
28310
28795
|
if (!content) return;
|
|
@@ -28322,7 +28807,7 @@ function OhhwellsBridge() {
|
|
|
28322
28807
|
}
|
|
28323
28808
|
applyAiFooterFromContent(content);
|
|
28324
28809
|
}, [pathname, subdomain, isEditMode]);
|
|
28325
|
-
|
|
28810
|
+
useEffect20(() => {
|
|
28326
28811
|
if (!isEditMode) return;
|
|
28327
28812
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28328
28813
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28330,12 +28815,12 @@ function OhhwellsBridge() {
|
|
|
28330
28815
|
deselectRef.current();
|
|
28331
28816
|
deactivateRef.current();
|
|
28332
28817
|
}, [pathname, isEditMode]);
|
|
28333
|
-
|
|
28818
|
+
useEffect20(() => {
|
|
28334
28819
|
if (!isEditMode) return;
|
|
28335
28820
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28336
28821
|
initItemInstancesFromContent(editContentRef.current);
|
|
28337
28822
|
}, [pathname, isEditMode]);
|
|
28338
|
-
|
|
28823
|
+
useEffect20(() => {
|
|
28339
28824
|
if (!isEditMode) return;
|
|
28340
28825
|
const observer = new MutationObserver(() => {
|
|
28341
28826
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28346,7 +28831,7 @@ function OhhwellsBridge() {
|
|
|
28346
28831
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28347
28832
|
return () => observer.disconnect();
|
|
28348
28833
|
}, [isEditMode, pathname]);
|
|
28349
|
-
|
|
28834
|
+
useEffect20(() => {
|
|
28350
28835
|
const contentForNav = () => {
|
|
28351
28836
|
if (isEditMode) return editContentRef.current;
|
|
28352
28837
|
if (!subdomain) return {};
|
|
@@ -28419,7 +28904,7 @@ function OhhwellsBridge() {
|
|
|
28419
28904
|
observer?.disconnect();
|
|
28420
28905
|
};
|
|
28421
28906
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28422
|
-
|
|
28907
|
+
useEffect20(() => {
|
|
28423
28908
|
if (!isEditMode) return;
|
|
28424
28909
|
let applying = false;
|
|
28425
28910
|
let rafId = null;
|
|
@@ -28457,7 +28942,7 @@ function OhhwellsBridge() {
|
|
|
28457
28942
|
observer.disconnect();
|
|
28458
28943
|
};
|
|
28459
28944
|
}, [isEditMode, pathname]);
|
|
28460
|
-
|
|
28945
|
+
useEffect20(() => {
|
|
28461
28946
|
if (!isEditMode) return;
|
|
28462
28947
|
let lastPosted = 0;
|
|
28463
28948
|
const measure = () => {
|
|
@@ -28479,29 +28964,14 @@ function OhhwellsBridge() {
|
|
|
28479
28964
|
const t2 = setTimeout(measure, 500);
|
|
28480
28965
|
const ro = new ResizeObserver(schedule);
|
|
28481
28966
|
ro.observe(document.body);
|
|
28482
|
-
let lastWidth = window.innerWidth;
|
|
28483
|
-
let resizeTimers = [];
|
|
28484
|
-
const clearResizeTimers = () => {
|
|
28485
|
-
resizeTimers.forEach(clearTimeout);
|
|
28486
|
-
resizeTimers = [];
|
|
28487
|
-
};
|
|
28488
|
-
const handleResize = () => {
|
|
28489
|
-
if (window.innerWidth === lastWidth) return;
|
|
28490
|
-
lastWidth = window.innerWidth;
|
|
28491
|
-
clearResizeTimers();
|
|
28492
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
28493
|
-
};
|
|
28494
|
-
window.addEventListener("resize", handleResize);
|
|
28495
28967
|
return () => {
|
|
28496
28968
|
clearTimeout(t1);
|
|
28497
28969
|
clearTimeout(t2);
|
|
28498
28970
|
if (raf != null) cancelAnimationFrame(raf);
|
|
28499
28971
|
ro.disconnect();
|
|
28500
|
-
clearResizeTimers();
|
|
28501
|
-
window.removeEventListener("resize", handleResize);
|
|
28502
28972
|
};
|
|
28503
28973
|
}, [pathname, isEditMode, postToParent2]);
|
|
28504
|
-
|
|
28974
|
+
useEffect20(() => {
|
|
28505
28975
|
if (isEditMode) return;
|
|
28506
28976
|
const handleClick = (e) => {
|
|
28507
28977
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28515,7 +28985,7 @@ function OhhwellsBridge() {
|
|
|
28515
28985
|
document.addEventListener("click", handleClick, true);
|
|
28516
28986
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28517
28987
|
}, [isEditMode, router, pathname]);
|
|
28518
|
-
|
|
28988
|
+
useEffect20(() => {
|
|
28519
28989
|
if (!isEditMode) {
|
|
28520
28990
|
editStylesRef.current?.base.remove();
|
|
28521
28991
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -28795,6 +29265,13 @@ function OhhwellsBridge() {
|
|
|
28795
29265
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
28796
29266
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
28797
29267
|
if (isInsideLinkEditor(target)) return;
|
|
29268
|
+
if (isInsideFloatingPanel(target)) return;
|
|
29269
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
29270
|
+
if (target.closest(
|
|
29271
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
29272
|
+
)) {
|
|
29273
|
+
return;
|
|
29274
|
+
}
|
|
28798
29275
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
28799
29276
|
clearMediaSelectionRef.current();
|
|
28800
29277
|
}
|
|
@@ -28818,8 +29295,6 @@ function OhhwellsBridge() {
|
|
|
28818
29295
|
return;
|
|
28819
29296
|
}
|
|
28820
29297
|
}
|
|
28821
|
-
if (isInsideFloatingPanel(target)) return;
|
|
28822
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
28823
29298
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
28824
29299
|
if (collectionItem) {
|
|
28825
29300
|
e.preventDefault();
|
|
@@ -28831,11 +29306,6 @@ function OhhwellsBridge() {
|
|
|
28831
29306
|
});
|
|
28832
29307
|
return;
|
|
28833
29308
|
}
|
|
28834
|
-
if (target.closest(
|
|
28835
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
28836
|
-
)) {
|
|
28837
|
-
return;
|
|
28838
|
-
}
|
|
28839
29309
|
{
|
|
28840
29310
|
const formEl = getFormElement(target);
|
|
28841
29311
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -28989,9 +29459,13 @@ function OhhwellsBridge() {
|
|
|
28989
29459
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
28990
29460
|
e.preventDefault();
|
|
28991
29461
|
e.stopPropagation();
|
|
28992
|
-
selectIconElementRef.current(editable);
|
|
28993
29462
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
28994
29463
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
29464
|
+
if (aiIcon) {
|
|
29465
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
29466
|
+
} else {
|
|
29467
|
+
selectIconElementRef.current(editable);
|
|
29468
|
+
}
|
|
28995
29469
|
postToParentRef.current({
|
|
28996
29470
|
type: "ow:icon-pick",
|
|
28997
29471
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -29219,6 +29693,9 @@ function OhhwellsBridge() {
|
|
|
29219
29693
|
setHoveredItemRect(null);
|
|
29220
29694
|
hoveredNavContainerRef.current = null;
|
|
29221
29695
|
setHoveredNavContainerRect(null);
|
|
29696
|
+
siblingHintElRef.current = null;
|
|
29697
|
+
setSiblingHintRect(null);
|
|
29698
|
+
setSiblingHintRects([]);
|
|
29222
29699
|
return;
|
|
29223
29700
|
}
|
|
29224
29701
|
{
|
|
@@ -29339,7 +29816,6 @@ function OhhwellsBridge() {
|
|
|
29339
29816
|
hoveredNavContainerRef.current = null;
|
|
29340
29817
|
setHoveredNavContainerRect(null);
|
|
29341
29818
|
hoveredItemElRef.current = editable;
|
|
29342
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
29343
29819
|
}
|
|
29344
29820
|
}
|
|
29345
29821
|
}
|
|
@@ -30049,7 +30525,11 @@ function OhhwellsBridge() {
|
|
|
30049
30525
|
};
|
|
30050
30526
|
const handleMouseMove = (e) => {
|
|
30051
30527
|
const { clientX, clientY } = e;
|
|
30052
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30528
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30529
|
+
dismissImageHover();
|
|
30530
|
+
clearImageHover();
|
|
30531
|
+
return;
|
|
30532
|
+
}
|
|
30053
30533
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
30054
30534
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
30055
30535
|
formHoverElRef.current = null;
|
|
@@ -30078,7 +30558,12 @@ function OhhwellsBridge() {
|
|
|
30078
30558
|
setHoveredItemRect(null);
|
|
30079
30559
|
hoveredNavContainerRef.current = null;
|
|
30080
30560
|
setHoveredNavContainerRect(null);
|
|
30561
|
+
siblingHintElRef.current = null;
|
|
30562
|
+
setSiblingHintRect(null);
|
|
30563
|
+
setSiblingHintRects([]);
|
|
30081
30564
|
dismissImageHover();
|
|
30565
|
+
clearImageHover();
|
|
30566
|
+
setSectionGap(null);
|
|
30082
30567
|
return;
|
|
30083
30568
|
}
|
|
30084
30569
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -30090,7 +30575,11 @@ function OhhwellsBridge() {
|
|
|
30090
30575
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
30091
30576
|
const { clientX, clientY } = e.data;
|
|
30092
30577
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
30093
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
30578
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
30579
|
+
dismissImageHover();
|
|
30580
|
+
clearImageHover();
|
|
30581
|
+
return;
|
|
30582
|
+
}
|
|
30094
30583
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
30095
30584
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
30096
30585
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -30470,6 +30959,7 @@ function OhhwellsBridge() {
|
|
|
30470
30959
|
applyAiFooterFromContent(content);
|
|
30471
30960
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30472
30961
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
30962
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30473
30963
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30474
30964
|
}
|
|
30475
30965
|
applyBrandChrome(content);
|
|
@@ -30484,15 +30974,16 @@ function OhhwellsBridge() {
|
|
|
30484
30974
|
}
|
|
30485
30975
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30486
30976
|
if (key === AI_FOOTER_KEY) continue;
|
|
30977
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30978
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30487
30979
|
if (key === BRAND_KIT_KEY) continue;
|
|
30488
30980
|
if (key === STYLE_STORE_KEY) continue;
|
|
30489
30981
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30490
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30491
30982
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30492
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
30493
30983
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30494
30984
|
continue;
|
|
30495
30985
|
}
|
|
30986
|
+
if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
|
|
30496
30987
|
if (applyVideoSettingNode(key, val)) continue;
|
|
30497
30988
|
if (applyCarouselNode(key, val)) continue;
|
|
30498
30989
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -30518,6 +31009,7 @@ function OhhwellsBridge() {
|
|
|
30518
31009
|
});
|
|
30519
31010
|
applyLinkByKey(key, val);
|
|
30520
31011
|
}
|
|
31012
|
+
applySectionEmbeds(content);
|
|
30521
31013
|
applyLogoFromContent(content);
|
|
30522
31014
|
applyLogoSizes(content);
|
|
30523
31015
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
@@ -31125,6 +31617,12 @@ function OhhwellsBridge() {
|
|
|
31125
31617
|
closeLinkPopoverRef.current();
|
|
31126
31618
|
return;
|
|
31127
31619
|
}
|
|
31620
|
+
if (floatingPanelOpenRef.current) {
|
|
31621
|
+
setFloatingPanelRef.current(null);
|
|
31622
|
+
deselectRef.current();
|
|
31623
|
+
deactivateRef.current();
|
|
31624
|
+
return;
|
|
31625
|
+
}
|
|
31128
31626
|
deselectRef.current();
|
|
31129
31627
|
deactivateRef.current();
|
|
31130
31628
|
clearMediaSelectionRef.current();
|
|
@@ -31960,17 +32458,17 @@ function OhhwellsBridge() {
|
|
|
31960
32458
|
window.removeEventListener("message", handleDuplicateSection);
|
|
31961
32459
|
window.removeEventListener("message", handleDeactivate);
|
|
31962
32460
|
window.removeEventListener("message", handleSelectNav);
|
|
31963
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
31964
32461
|
window.removeEventListener("message", handleToastAction);
|
|
31965
32462
|
window.removeEventListener("message", handleFormCount);
|
|
31966
32463
|
window.removeEventListener("message", handleUiEscape);
|
|
32464
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
31967
32465
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
31968
32466
|
autoSaveTimers.current.clear();
|
|
31969
32467
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
31970
32468
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
31971
32469
|
};
|
|
31972
32470
|
}, [isEditMode, refreshStateRules]);
|
|
31973
|
-
|
|
32471
|
+
useEffect20(() => {
|
|
31974
32472
|
if (!isEditMode) return;
|
|
31975
32473
|
const THRESHOLD = 10;
|
|
31976
32474
|
const resolveWasSelected = (el) => {
|
|
@@ -32126,7 +32624,7 @@ function OhhwellsBridge() {
|
|
|
32126
32624
|
unlockFooterDragInteraction();
|
|
32127
32625
|
};
|
|
32128
32626
|
}, [isEditMode]);
|
|
32129
|
-
|
|
32627
|
+
useEffect20(() => {
|
|
32130
32628
|
if (!isEditMode) return;
|
|
32131
32629
|
const THRESHOLD = 10;
|
|
32132
32630
|
const onPointerDown = (e) => {
|
|
@@ -32217,7 +32715,7 @@ function OhhwellsBridge() {
|
|
|
32217
32715
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32218
32716
|
};
|
|
32219
32717
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32220
|
-
|
|
32718
|
+
useEffect20(() => {
|
|
32221
32719
|
const handler = (e) => {
|
|
32222
32720
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32223
32721
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32233,7 +32731,7 @@ function OhhwellsBridge() {
|
|
|
32233
32731
|
window.addEventListener("message", handler);
|
|
32234
32732
|
return () => window.removeEventListener("message", handler);
|
|
32235
32733
|
}, [processConfigRequest]);
|
|
32236
|
-
|
|
32734
|
+
useEffect20(() => {
|
|
32237
32735
|
if (!isEditMode) return;
|
|
32238
32736
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32239
32737
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32257,7 +32755,7 @@ function OhhwellsBridge() {
|
|
|
32257
32755
|
postToParent2({
|
|
32258
32756
|
type: "ow:ready",
|
|
32259
32757
|
version: "1",
|
|
32260
|
-
bridgeVersion: "0.1.
|
|
32758
|
+
bridgeVersion: "0.1.163-next.434",
|
|
32261
32759
|
path: pathname,
|
|
32262
32760
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32263
32761
|
sections
|
|
@@ -32269,7 +32767,7 @@ function OhhwellsBridge() {
|
|
|
32269
32767
|
clearTimeout(timer);
|
|
32270
32768
|
};
|
|
32271
32769
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32272
|
-
|
|
32770
|
+
useEffect20(() => {
|
|
32273
32771
|
scrollToHashSectionWhenReady();
|
|
32274
32772
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32275
32773
|
window.addEventListener("hashchange", onHashChange);
|
|
@@ -32311,7 +32809,7 @@ function OhhwellsBridge() {
|
|
|
32311
32809
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32312
32810
|
refreshActiveCommandsRef.current();
|
|
32313
32811
|
}, []);
|
|
32314
|
-
|
|
32812
|
+
useEffect20(() => {
|
|
32315
32813
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32316
32814
|
if (!session || !logoSizeDraft) return;
|
|
32317
32815
|
const onPanelAction = (e) => {
|
|
@@ -32992,7 +33490,7 @@ function OhhwellsBridge() {
|
|
|
32992
33490
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
32993
33491
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
32994
33492
|
"data-ohw-add-field": "",
|
|
32995
|
-
children: /* @__PURE__ */ jsx40(
|
|
33493
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
32996
33494
|
}
|
|
32997
33495
|
),
|
|
32998
33496
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -33485,6 +33983,7 @@ export {
|
|
|
33485
33983
|
hasMountedContentNodes,
|
|
33486
33984
|
indexCollectionItems,
|
|
33487
33985
|
insertFooterHours,
|
|
33986
|
+
isDeadPageHref,
|
|
33488
33987
|
isEditSessionActive,
|
|
33489
33988
|
isPlainLeftClick,
|
|
33490
33989
|
isRenderableFooterTree,
|
|
@@ -33496,6 +33995,7 @@ export {
|
|
|
33496
33995
|
parseAiFooterState,
|
|
33497
33996
|
parseAiSectionsState,
|
|
33498
33997
|
parseTarget,
|
|
33998
|
+
planBuildPageSync,
|
|
33499
33999
|
recordOverriddenPaths,
|
|
33500
34000
|
releaseTemplateLogoIfReplaced,
|
|
33501
34001
|
removeFooterBlock,
|