@ohhwells/bridge 0.1.179-next.476 → 0.1.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +763 -1471
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +803 -1527
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +3 -116
- 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 React13, { useCallback as useCallback12, useEffect as useEffect22, useLayoutEffect as
|
|
4
|
+
import React13, { useCallback as useCallback12, useEffect as useEffect22, useLayoutEffect as useLayoutEffect6, 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
|
|
|
@@ -8067,21 +8067,6 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
8067
8067
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
8068
8068
|
return target ? pricingFeatureList(target).length : 0;
|
|
8069
8069
|
}
|
|
8070
|
-
function prevailingFeatureIcon(features) {
|
|
8071
|
-
const counts = /* @__PURE__ */ new Map();
|
|
8072
|
-
for (const row of features) {
|
|
8073
|
-
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
8074
|
-
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
8075
|
-
entry.count += 1;
|
|
8076
|
-
counts.set(key, entry);
|
|
8077
|
-
}
|
|
8078
|
-
let best = null;
|
|
8079
|
-
for (const entry of counts.values()) {
|
|
8080
|
-
if (!best || entry.count > best.count) best = entry;
|
|
8081
|
-
}
|
|
8082
|
-
if (!best) return {};
|
|
8083
|
-
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
8084
|
-
}
|
|
8085
8070
|
function addPricingCardFeature(tree, index, text) {
|
|
8086
8071
|
return withPricingCollection(tree, (collection) => {
|
|
8087
8072
|
const children = collection.children;
|
|
@@ -8090,7 +8075,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
8090
8075
|
const features = pricingFeatureList(target);
|
|
8091
8076
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
8092
8077
|
target.slots = target.slots ?? {};
|
|
8093
|
-
target.slots.features = [...features, { text
|
|
8078
|
+
target.slots.features = [...features, { text }];
|
|
8094
8079
|
return true;
|
|
8095
8080
|
});
|
|
8096
8081
|
}
|
|
@@ -9788,7 +9773,7 @@ var AI_MOBILE_CSS = [
|
|
|
9788
9773
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
9789
9774
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
9790
9775
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
9791
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
9776
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
|
|
9792
9777
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
9793
9778
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
9794
9779
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -9810,10 +9795,8 @@ var AI_MOBILE_CSS = [
|
|
|
9810
9795
|
"[data-ai-section]{overflow-x:hidden}",
|
|
9811
9796
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
9812
9797
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
9813
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
9814
|
-
|
|
9815
|
-
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
9816
|
-
"[data-ai-container]{padding:0 20px !important}",
|
|
9798
|
+
// still got a 20px band of section background down both sides on a phone.
|
|
9799
|
+
"[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
9817
9800
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
9818
9801
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
9819
9802
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -10022,31 +10005,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
10022
10005
|
function textAttrs(ctx, path) {
|
|
10023
10006
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
10024
10007
|
}
|
|
10025
|
-
var AI_RESPONSIVE_CSS = [
|
|
10026
|
-
"@media (max-width: 960px) {",
|
|
10027
|
-
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
10028
|
-
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
10029
|
-
"}",
|
|
10030
|
-
"@media (max-width: 640px) {",
|
|
10031
|
-
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
10032
|
-
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
10033
|
-
// Group containers flatten to a column on phones; span placements come along for free.
|
|
10034
|
-
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
10035
|
-
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
10036
|
-
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
10037
|
-
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
10038
|
-
// layered text used to be.
|
|
10039
|
-
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
10040
|
-
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
10041
|
-
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
10042
|
-
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
10043
|
-
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
10044
|
-
// other rule had already been taught to stand down.
|
|
10045
|
-
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
10046
|
-
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
10047
|
-
" [data-ai-responsive] img { max-width: 100%; }",
|
|
10048
|
-
"}"
|
|
10049
|
-
].join("\n");
|
|
10050
10008
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
10051
10009
|
function MediaBox({
|
|
10052
10010
|
refValue,
|
|
@@ -10101,7 +10059,7 @@ function MediaBox({
|
|
|
10101
10059
|
position: fill ? "absolute" : void 0,
|
|
10102
10060
|
inset: fill ? 0 : void 0,
|
|
10103
10061
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
10104
|
-
height: fill ? "100%" :
|
|
10062
|
+
height: fill ? "100%" : void 0,
|
|
10105
10063
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
10106
10064
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
10107
10065
|
borderRadius: radius,
|
|
@@ -11679,7 +11637,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
11679
11637
|
return /* @__PURE__ */ jsx2(
|
|
11680
11638
|
"div",
|
|
11681
11639
|
{
|
|
11682
|
-
"data-ai-grid":
|
|
11640
|
+
"data-ai-grid": "",
|
|
11683
11641
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
11684
11642
|
style: {
|
|
11685
11643
|
display: "grid",
|
|
@@ -11981,7 +11939,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
11981
11939
|
},
|
|
11982
11940
|
children: [
|
|
11983
11941
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
11984
|
-
// The section's `data-ai-
|
|
11942
|
+
// The section's `data-ai-container` gave up its max-width/gutter so the base
|
|
11985
11943
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
11986
11944
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
11987
11945
|
// the full section width instead of reading at the usual content width.
|
|
@@ -12408,7 +12366,6 @@ function AiTreeRenderer({
|
|
|
12408
12366
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
12409
12367
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
12410
12368
|
...bgAttrs,
|
|
12411
|
-
"data-ai-responsive": "",
|
|
12412
12369
|
style: {
|
|
12413
12370
|
position: "relative",
|
|
12414
12371
|
padding: `${padCss} 0`,
|
|
@@ -12422,13 +12379,12 @@ function AiTreeRenderer({
|
|
|
12422
12379
|
...fillHeight ? { display: "grid" } : {}
|
|
12423
12380
|
},
|
|
12424
12381
|
children: [
|
|
12425
|
-
/* @__PURE__ */ jsx2("style", { children: AI_RESPONSIVE_CSS }),
|
|
12426
|
-
/* @__PURE__ */ jsx2("style", { children: AI_MOBILE_CSS }),
|
|
12427
12382
|
isOverlay && backgroundUrl && /* @__PURE__ */ jsx2("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
12383
|
+
/* @__PURE__ */ jsx2("style", { children: AI_MOBILE_CSS }),
|
|
12428
12384
|
/* @__PURE__ */ jsx2(
|
|
12429
12385
|
"div",
|
|
12430
12386
|
{
|
|
12431
|
-
"data-ai-
|
|
12387
|
+
"data-ai-container": "",
|
|
12432
12388
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
12433
12389
|
style: {
|
|
12434
12390
|
position: "relative",
|
|
@@ -12494,7 +12450,7 @@ function AiTreeRenderer({
|
|
|
12494
12450
|
return /* @__PURE__ */ jsx2(
|
|
12495
12451
|
"div",
|
|
12496
12452
|
{
|
|
12497
|
-
"data-ai-
|
|
12453
|
+
"data-ai-row": "",
|
|
12498
12454
|
style: {
|
|
12499
12455
|
display: "grid",
|
|
12500
12456
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -13165,10 +13121,9 @@ function applyAiSectionsToDom(state, options) {
|
|
|
13165
13121
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
13166
13122
|
continue;
|
|
13167
13123
|
}
|
|
13124
|
+
const isNewMount = !existing || !existing.container.isConnected;
|
|
13168
13125
|
let container = existing?.container;
|
|
13169
|
-
let isNewMount = false;
|
|
13170
13126
|
if (!container || !container.isConnected) {
|
|
13171
|
-
isNewMount = true;
|
|
13172
13127
|
existing?.root.unmount();
|
|
13173
13128
|
container?.remove();
|
|
13174
13129
|
container = document.createElement("div");
|
|
@@ -13506,34 +13461,6 @@ function minSpanForFooterBlock(type) {
|
|
|
13506
13461
|
return 3;
|
|
13507
13462
|
}
|
|
13508
13463
|
}
|
|
13509
|
-
function readLiveSocialItems() {
|
|
13510
|
-
const root = getFooterRoot();
|
|
13511
|
-
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
13512
|
-
if (!row) return [];
|
|
13513
|
-
const items = [];
|
|
13514
|
-
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
13515
|
-
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
13516
|
-
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
13517
|
-
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
13518
|
-
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
13519
|
-
items.push({ platform, href });
|
|
13520
|
-
}
|
|
13521
|
-
return items;
|
|
13522
|
-
}
|
|
13523
|
-
function syncSocialRowsFromDom(tree) {
|
|
13524
|
-
const root = getFooterRoot();
|
|
13525
|
-
if (!root) return;
|
|
13526
|
-
const row = root.querySelector("[data-ohw-socials-row]");
|
|
13527
|
-
const live = readLiveSocialItems();
|
|
13528
|
-
if (row && live.length === 0) return;
|
|
13529
|
-
for (const col of tree.columns) {
|
|
13530
|
-
col.blocks = col.blocks.flatMap((block) => {
|
|
13531
|
-
if (block.type !== "social-row") return [block];
|
|
13532
|
-
if (!row) return [];
|
|
13533
|
-
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
13534
|
-
});
|
|
13535
|
-
}
|
|
13536
|
-
}
|
|
13537
13464
|
function collectBrandBlocks(tree) {
|
|
13538
13465
|
const brand = [];
|
|
13539
13466
|
for (const col of tree.columns) {
|
|
@@ -13779,7 +13706,6 @@ function textOf2(el) {
|
|
|
13779
13706
|
}
|
|
13780
13707
|
function syncFooterTreeLinksFromDom(tree) {
|
|
13781
13708
|
const next = cloneTree2(tree);
|
|
13782
|
-
syncSocialRowsFromDom(next);
|
|
13783
13709
|
const domCols = listFooterColumns().map((col) => {
|
|
13784
13710
|
const heading = getFooterColumnHeadingEl(col);
|
|
13785
13711
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -19370,16 +19296,7 @@ function ItemInteractionLayer({
|
|
|
19370
19296
|
{
|
|
19371
19297
|
"aria-hidden": true,
|
|
19372
19298
|
className: "absolute inset-0",
|
|
19373
|
-
style: {
|
|
19374
|
-
...getChromeStyle(state),
|
|
19375
|
-
// Draw the stroke inside the measured rect so chromeGap={0} (dropdown options)
|
|
19376
|
-
// does not stick past the list edges (OHH-919 QA).
|
|
19377
|
-
boxSizing: "border-box",
|
|
19378
|
-
borderRadius: CHROME_RADIUS,
|
|
19379
|
-
// Soft ring still paints outside the border box — drop it when flush with the
|
|
19380
|
-
// target so the blue frame stays within the row.
|
|
19381
|
-
...gap === 0 ? { boxShadow: "none" } : null
|
|
19382
|
-
}
|
|
19299
|
+
style: { ...getChromeStyle(state), borderRadius: CHROME_RADIUS }
|
|
19383
19300
|
}
|
|
19384
19301
|
),
|
|
19385
19302
|
itemDragEnabled && /* @__PURE__ */ jsx15(
|
|
@@ -19614,7 +19531,7 @@ function apiBase() {
|
|
|
19614
19531
|
function bridgeVersion() {
|
|
19615
19532
|
try {
|
|
19616
19533
|
if (true) {
|
|
19617
|
-
return "0.1.
|
|
19534
|
+
return "0.1.180";
|
|
19618
19535
|
}
|
|
19619
19536
|
} catch {
|
|
19620
19537
|
}
|
|
@@ -19628,7 +19545,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
19628
19545
|
return;
|
|
19629
19546
|
}
|
|
19630
19547
|
try {
|
|
19631
|
-
const v = true ? "0.1.
|
|
19548
|
+
const v = true ? "0.1.180" : "";
|
|
19632
19549
|
if (v) {
|
|
19633
19550
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
19634
19551
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -19707,42 +19624,32 @@ function armLoaderHangBeacon(subdomain, fetchState, hangMs = 15e3) {
|
|
|
19707
19624
|
}
|
|
19708
19625
|
|
|
19709
19626
|
// src/lib/form-fields.ts
|
|
19710
|
-
var DEFAULT_DROPDOWN_OPTIONS = ["Option 1", "Option 2", "Option 3"];
|
|
19711
19627
|
var FIELD_DEFAULTS = {
|
|
19712
19628
|
"short-text": { label: "Short text", placeholder: "Type placeholder text..." },
|
|
19713
19629
|
"long-text": { label: "Long text", placeholder: "How can we help?" },
|
|
19714
19630
|
email: { label: "Email", placeholder: "hello@example.com" },
|
|
19715
|
-
phone: { label: "Phone number", placeholder: "(555) 000-0000" }
|
|
19716
|
-
dropdown: { label: "Dropdown", placeholder: "" }
|
|
19631
|
+
phone: { label: "Phone number", placeholder: "(555) 000-0000" }
|
|
19717
19632
|
};
|
|
19718
19633
|
var FIELD_TYPES = [
|
|
19719
19634
|
{ type: "short-text", label: "Short text" },
|
|
19720
19635
|
{ type: "long-text", label: "Long text" },
|
|
19721
19636
|
{ type: "email", label: "Email" },
|
|
19722
|
-
{ type: "phone", label: "Phone" }
|
|
19723
|
-
{ type: "dropdown", label: "Dropdown" }
|
|
19637
|
+
{ type: "phone", label: "Phone" }
|
|
19724
19638
|
];
|
|
19725
19639
|
var FIELD_ATTR = "data-ohw-form-field";
|
|
19726
19640
|
var FIELD_TYPE_ATTR = "data-ohw-field-type";
|
|
19727
19641
|
var PLACEHOLDER_EDIT_ATTR = "data-ohw-placeholder-edit";
|
|
19728
|
-
var DROPDOWN_PANEL_ATTR = "data-ohw-dropdown-panel";
|
|
19729
|
-
var DROPDOWN_OPTION_ATTR = "data-ohw-dropdown-option";
|
|
19730
|
-
var DROPDOWN_OPEN_ATTR = "data-ohw-dropdown-open";
|
|
19731
|
-
var DROPDOWN_OPTION_SELECTED_ATTR = "data-ohw-dropdown-option-selected";
|
|
19732
|
-
var CONTROL_SELECTOR = "input, textarea, select";
|
|
19733
19642
|
var seedFieldByForm = /* @__PURE__ */ new WeakMap();
|
|
19734
19643
|
function fieldsKey(formKey) {
|
|
19735
19644
|
return `${formKey}-fields`;
|
|
19736
19645
|
}
|
|
19737
19646
|
function inputTagFor(type) {
|
|
19738
|
-
if (type === "dropdown") return { tag: "select" };
|
|
19739
19647
|
if (type === "long-text") return { tag: "textarea" };
|
|
19740
19648
|
if (type === "email") return { tag: "input", inputType: "email" };
|
|
19741
19649
|
if (type === "phone") return { tag: "input", inputType: "tel" };
|
|
19742
19650
|
return { tag: "input", inputType: "text" };
|
|
19743
19651
|
}
|
|
19744
19652
|
function inferType(input) {
|
|
19745
|
-
if (input.tagName === "SELECT") return "dropdown";
|
|
19746
19653
|
if (input.tagName === "TEXTAREA") return "long-text";
|
|
19747
19654
|
const type = input.type;
|
|
19748
19655
|
if (type === "email") return "email";
|
|
@@ -19758,7 +19665,7 @@ function ensureFieldLabel(wrapper, key) {
|
|
|
19758
19665
|
}
|
|
19759
19666
|
return existing;
|
|
19760
19667
|
}
|
|
19761
|
-
const input =
|
|
19668
|
+
const input = fieldInputOf(wrapper);
|
|
19762
19669
|
const label = document.createElement("label");
|
|
19763
19670
|
label.setAttribute("data-ohw-editable", "text");
|
|
19764
19671
|
label.setAttribute("data-ohw-key", `${key}-label`);
|
|
@@ -19768,7 +19675,7 @@ function ensureFieldLabel(wrapper, key) {
|
|
|
19768
19675
|
label.style.fontSize = "13px";
|
|
19769
19676
|
label.style.fontWeight = "500";
|
|
19770
19677
|
label.style.lineHeight = "1.3";
|
|
19771
|
-
const fromPlaceholder = input
|
|
19678
|
+
const fromPlaceholder = input?.getAttribute("placeholder")?.trim();
|
|
19772
19679
|
const text = fromPlaceholder && fromPlaceholder.length < 40 ? fromPlaceholder : key.replace(/[-_]/g, " ");
|
|
19773
19680
|
label.textContent = text;
|
|
19774
19681
|
if (input && input.parentElement === wrapper) wrapper.insertBefore(label, input);
|
|
@@ -19781,13 +19688,8 @@ function listFieldWrappers(form) {
|
|
|
19781
19688
|
function getFieldWrapper(el) {
|
|
19782
19689
|
return el?.closest(`[${FIELD_ATTR}]`) ?? null;
|
|
19783
19690
|
}
|
|
19784
|
-
function fieldControlOf(wrapper) {
|
|
19785
|
-
return wrapper.querySelector(CONTROL_SELECTOR);
|
|
19786
|
-
}
|
|
19787
19691
|
function fieldInputOf(wrapper) {
|
|
19788
|
-
|
|
19789
|
-
if (!control || control.tagName === "SELECT") return null;
|
|
19790
|
-
return control;
|
|
19692
|
+
return wrapper.querySelector("input, textarea");
|
|
19791
19693
|
}
|
|
19792
19694
|
function fieldLabelOf(wrapper) {
|
|
19793
19695
|
return wrapper.querySelector("label");
|
|
@@ -19799,236 +19701,17 @@ function fieldTypeOf(wrapper) {
|
|
|
19799
19701
|
return wrapper.getAttribute(FIELD_TYPE_ATTR) ?? "short-text";
|
|
19800
19702
|
}
|
|
19801
19703
|
function isFieldRequired(wrapper) {
|
|
19802
|
-
return
|
|
19803
|
-
}
|
|
19804
|
-
function optionFallbackLabel(index) {
|
|
19805
|
-
return `Option ${index + 1}`;
|
|
19806
|
-
}
|
|
19807
|
-
function normalizeOptionText(text, index) {
|
|
19808
|
-
const trimmed = text.replace(/\u00a0/g, " ").trim();
|
|
19809
|
-
return trimmed || optionFallbackLabel(index);
|
|
19810
|
-
}
|
|
19811
|
-
function isPromptOption(opt) {
|
|
19812
|
-
return opt.disabled && opt.value === "";
|
|
19813
|
-
}
|
|
19814
|
-
function readDropdownPrompt(wrapper) {
|
|
19815
|
-
const select = fieldControlOf(wrapper);
|
|
19816
|
-
if (!select || select.tagName !== "SELECT") return "";
|
|
19817
|
-
const prompt = Array.from(select.options).find(isPromptOption);
|
|
19818
|
-
return (prompt?.textContent ?? "").replace(/\u00a0/g, " ").trim();
|
|
19819
|
-
}
|
|
19820
|
-
function readDropdownOptions(wrapper) {
|
|
19821
|
-
const select = fieldControlOf(wrapper);
|
|
19822
|
-
if (!select || select.tagName !== "SELECT") return [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19823
|
-
const options = Array.from(select.options).filter((opt) => !isPromptOption(opt)).map((opt, i) => normalizeOptionText(opt.textContent ?? "", i));
|
|
19824
|
-
return options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19825
|
-
}
|
|
19826
|
-
function fillSelectOptions(select, options, prompt) {
|
|
19827
|
-
const keepPrompt = prompt === void 0 ? (() => {
|
|
19828
|
-
const existing = Array.from(select.options).find(isPromptOption);
|
|
19829
|
-
return existing ? (existing.textContent ?? "").replace(/\u00a0/g, " ").trim() : "";
|
|
19830
|
-
})() : (prompt ?? "").trim();
|
|
19831
|
-
select.replaceChildren();
|
|
19832
|
-
if (keepPrompt) {
|
|
19833
|
-
const opt = document.createElement("option");
|
|
19834
|
-
opt.value = "";
|
|
19835
|
-
opt.disabled = true;
|
|
19836
|
-
opt.selected = true;
|
|
19837
|
-
opt.textContent = keepPrompt;
|
|
19838
|
-
select.appendChild(opt);
|
|
19839
|
-
}
|
|
19840
|
-
options.forEach((text, i) => {
|
|
19841
|
-
const opt = document.createElement("option");
|
|
19842
|
-
const label = normalizeOptionText(text, i);
|
|
19843
|
-
opt.value = label;
|
|
19844
|
-
opt.textContent = label;
|
|
19845
|
-
select.appendChild(opt);
|
|
19846
|
-
});
|
|
19847
|
-
if (!keepPrompt && select.options.length > 0) select.selectedIndex = 0;
|
|
19848
|
-
}
|
|
19849
|
-
function removeDropdownEditorPanel(wrapper) {
|
|
19850
|
-
wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
|
|
19851
|
-
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19852
|
-
}
|
|
19853
|
-
function styleDropdownPanelFromSelect(panel, select) {
|
|
19854
|
-
const cs = getComputedStyle(select);
|
|
19855
|
-
panel.style.boxSizing = "border-box";
|
|
19856
|
-
panel.style.width = "100%";
|
|
19857
|
-
panel.style.marginTop = "4px";
|
|
19858
|
-
panel.style.overflow = "hidden";
|
|
19859
|
-
panel.style.borderStyle = cs.borderStyle || "solid";
|
|
19860
|
-
panel.style.borderWidth = cs.borderWidth || "1px";
|
|
19861
|
-
panel.style.borderColor = cs.borderColor;
|
|
19862
|
-
panel.style.borderRadius = cs.borderRadius;
|
|
19863
|
-
panel.style.backgroundColor = cs.backgroundColor;
|
|
19864
|
-
panel.style.fontFamily = cs.fontFamily;
|
|
19865
|
-
panel.style.fontSize = cs.fontSize;
|
|
19866
|
-
panel.style.fontWeight = cs.fontWeight;
|
|
19867
|
-
panel.style.lineHeight = cs.lineHeight;
|
|
19868
|
-
panel.style.color = cs.color;
|
|
19869
|
-
panel.style.boxShadow = cs.boxShadow && cs.boxShadow !== "none" ? cs.boxShadow : "0 8px 24px color-mix(in srgb, #000 12%, transparent)";
|
|
19870
|
-
}
|
|
19871
|
-
function styleDropdownOptionFromSelect(row, select) {
|
|
19872
|
-
const cs = getComputedStyle(select);
|
|
19873
|
-
row.style.paddingTop = cs.paddingTop || "10px";
|
|
19874
|
-
row.style.paddingBottom = cs.paddingBottom || "10px";
|
|
19875
|
-
row.style.paddingLeft = cs.paddingLeft || "12px";
|
|
19876
|
-
row.style.paddingRight = cs.paddingRight || "12px";
|
|
19877
|
-
row.style.fontFamily = cs.fontFamily;
|
|
19878
|
-
row.style.fontSize = cs.fontSize;
|
|
19879
|
-
row.style.fontWeight = cs.fontWeight;
|
|
19880
|
-
row.style.lineHeight = cs.lineHeight;
|
|
19881
|
-
row.style.color = cs.color;
|
|
19882
|
-
row.style.background = "transparent";
|
|
19883
|
-
row.style.border = "none";
|
|
19884
|
-
row.style.outline = "none";
|
|
19885
|
-
row.style.cursor = "text";
|
|
19886
|
-
}
|
|
19887
|
-
function syncDropdownPanel(wrapper) {
|
|
19888
|
-
if (fieldTypeOf(wrapper) !== "dropdown") {
|
|
19889
|
-
wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
|
|
19890
|
-
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19891
|
-
return null;
|
|
19892
|
-
}
|
|
19893
|
-
const select = fieldControlOf(wrapper);
|
|
19894
|
-
if (!select || select.tagName !== "SELECT") return null;
|
|
19895
|
-
let panel = wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`);
|
|
19896
|
-
if (!panel) {
|
|
19897
|
-
panel = document.createElement("div");
|
|
19898
|
-
panel.setAttribute(DROPDOWN_PANEL_ATTR, "");
|
|
19899
|
-
select.after(panel);
|
|
19900
|
-
}
|
|
19901
|
-
styleDropdownPanelFromSelect(panel, select);
|
|
19902
|
-
const options = readDropdownOptions(wrapper);
|
|
19903
|
-
const selected = selectedDropdownOptionIndex(wrapper);
|
|
19904
|
-
panel.replaceChildren();
|
|
19905
|
-
options.forEach((text, i) => {
|
|
19906
|
-
panel.appendChild(createDropdownOptionRow(text, i, select));
|
|
19907
|
-
});
|
|
19908
|
-
if (selected != null && selected >= 0 && selected < options.length) {
|
|
19909
|
-
const row = panel.querySelector(`[${DROPDOWN_OPTION_ATTR}="${selected}"]`);
|
|
19910
|
-
row?.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
|
|
19911
|
-
}
|
|
19912
|
-
return panel;
|
|
19913
|
-
}
|
|
19914
|
-
function createDropdownOptionRow(text, index, select) {
|
|
19915
|
-
const row = document.createElement("div");
|
|
19916
|
-
row.setAttribute(DROPDOWN_OPTION_ATTR, String(index));
|
|
19917
|
-
row.setAttribute("contenteditable", "true");
|
|
19918
|
-
row.setAttribute("spellcheck", "false");
|
|
19919
|
-
row.textContent = text;
|
|
19920
|
-
styleDropdownOptionFromSelect(row, select);
|
|
19921
|
-
return row;
|
|
19922
|
-
}
|
|
19923
|
-
function setDropdownPreviewOpen(wrapper, open) {
|
|
19924
|
-
if (fieldTypeOf(wrapper) !== "dropdown") return;
|
|
19925
|
-
if (open) {
|
|
19926
|
-
if (!wrapper.hasAttribute(DROPDOWN_OPEN_ATTR) || !wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)) {
|
|
19927
|
-
syncDropdownPanel(wrapper);
|
|
19928
|
-
}
|
|
19929
|
-
wrapper.setAttribute(DROPDOWN_OPEN_ATTR, "");
|
|
19930
|
-
} else {
|
|
19931
|
-
removeDropdownEditorPanel(wrapper);
|
|
19932
|
-
}
|
|
19933
|
-
}
|
|
19934
|
-
function isDropdownPreviewOpen(wrapper) {
|
|
19935
|
-
return wrapper.hasAttribute(DROPDOWN_OPEN_ATTR);
|
|
19936
|
-
}
|
|
19937
|
-
function listDropdownOptionRows(wrapper) {
|
|
19938
|
-
return Array.from(wrapper.querySelectorAll(`[${DROPDOWN_OPTION_ATTR}]`));
|
|
19939
|
-
}
|
|
19940
|
-
function getDropdownOptionIndex(el) {
|
|
19941
|
-
const row = el?.closest(`[${DROPDOWN_OPTION_ATTR}]`);
|
|
19942
|
-
if (!row) return null;
|
|
19943
|
-
const raw = row.getAttribute(DROPDOWN_OPTION_ATTR);
|
|
19944
|
-
if (raw == null || raw === "") return null;
|
|
19945
|
-
const index = Number(raw);
|
|
19946
|
-
return Number.isFinite(index) ? index : null;
|
|
19947
|
-
}
|
|
19948
|
-
function selectDropdownOption(wrapper, index) {
|
|
19949
|
-
listDropdownOptionRows(wrapper).forEach((row, i) => {
|
|
19950
|
-
if (i === index) row.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
|
|
19951
|
-
else row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR);
|
|
19952
|
-
});
|
|
19953
|
-
}
|
|
19954
|
-
function clearDropdownOptionSelection(wrapper) {
|
|
19955
|
-
if (!wrapper) return;
|
|
19956
|
-
listDropdownOptionRows(wrapper).forEach((row) => row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR));
|
|
19957
|
-
}
|
|
19958
|
-
function selectedDropdownOptionIndex(wrapper) {
|
|
19959
|
-
const row = wrapper.querySelector(`[${DROPDOWN_OPTION_SELECTED_ATTR}]`);
|
|
19960
|
-
return getDropdownOptionIndex(row);
|
|
19961
|
-
}
|
|
19962
|
-
function commitDropdownOptionsFromPanel(wrapper, finalize = false) {
|
|
19963
|
-
const select = fieldControlOf(wrapper);
|
|
19964
|
-
if (!select || select.tagName !== "SELECT") return readDropdownOptions(wrapper);
|
|
19965
|
-
const rows = listDropdownOptionRows(wrapper);
|
|
19966
|
-
const options = rows.length > 0 ? rows.map((row, i) => {
|
|
19967
|
-
const trimmed = (row.textContent ?? "").replace(/\u00a0/g, " ").trim();
|
|
19968
|
-
return finalize ? normalizeOptionText(trimmed, i) : trimmed || optionFallbackLabel(i);
|
|
19969
|
-
}) : readDropdownOptions(wrapper);
|
|
19970
|
-
fillSelectOptions(select, options);
|
|
19971
|
-
if (finalize) {
|
|
19972
|
-
const panelRows = listDropdownOptionRows(wrapper);
|
|
19973
|
-
const realCount = Array.from(select.options).filter(
|
|
19974
|
-
(opt) => !isPromptOption(opt)
|
|
19975
|
-
).length;
|
|
19976
|
-
if (panelRows.length !== realCount) {
|
|
19977
|
-
syncDropdownPanel(wrapper);
|
|
19978
|
-
} else {
|
|
19979
|
-
panelRows.forEach((row, i) => {
|
|
19980
|
-
const label = options[i] ?? optionFallbackLabel(i);
|
|
19981
|
-
if (row.textContent !== label) row.textContent = label;
|
|
19982
|
-
row.setAttribute(DROPDOWN_OPTION_ATTR, String(i));
|
|
19983
|
-
});
|
|
19984
|
-
}
|
|
19985
|
-
}
|
|
19986
|
-
return readDropdownOptions(wrapper);
|
|
19987
|
-
}
|
|
19988
|
-
function writeDropdownOptions(wrapper, options, prompt) {
|
|
19989
|
-
const select = fieldControlOf(wrapper);
|
|
19990
|
-
if (!select || select.tagName !== "SELECT") return;
|
|
19991
|
-
const normalized = (options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS]).map(
|
|
19992
|
-
(text, i) => normalizeOptionText(text, i)
|
|
19993
|
-
);
|
|
19994
|
-
fillSelectOptions(select, normalized, prompt);
|
|
19995
|
-
if (wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)) syncDropdownPanel(wrapper);
|
|
19996
|
-
}
|
|
19997
|
-
function currentDropdownOptions(wrapper) {
|
|
19998
|
-
const rows = listDropdownOptionRows(wrapper);
|
|
19999
|
-
if (rows.length === 0) return readDropdownOptions(wrapper);
|
|
20000
|
-
return rows.map((row, i) => normalizeOptionText(row.textContent ?? "", i));
|
|
20001
|
-
}
|
|
20002
|
-
function duplicateDropdownOption(wrapper, index) {
|
|
20003
|
-
const options = currentDropdownOptions(wrapper);
|
|
20004
|
-
if (index < 0 || index >= options.length) return index;
|
|
20005
|
-
const next = [...options];
|
|
20006
|
-
next.splice(index + 1, 0, options[index]);
|
|
20007
|
-
writeDropdownOptions(wrapper, next);
|
|
20008
|
-
selectDropdownOption(wrapper, index + 1);
|
|
20009
|
-
return index + 1;
|
|
20010
|
-
}
|
|
20011
|
-
function removeDropdownOption(wrapper, index) {
|
|
20012
|
-
const options = currentDropdownOptions(wrapper);
|
|
20013
|
-
if (options.length <= 1 || index < 0 || index >= options.length) {
|
|
20014
|
-
selectDropdownOption(wrapper, Math.max(0, Math.min(index, options.length - 1)));
|
|
20015
|
-
return selectedDropdownOptionIndex(wrapper);
|
|
20016
|
-
}
|
|
20017
|
-
const next = options.filter((_, i) => i !== index);
|
|
20018
|
-
writeDropdownOptions(wrapper, next);
|
|
20019
|
-
const nextIndex = Math.min(index, next.length - 1);
|
|
20020
|
-
selectDropdownOption(wrapper, nextIndex);
|
|
20021
|
-
return nextIndex;
|
|
19704
|
+
return fieldInputOf(wrapper)?.hasAttribute("required") ?? false;
|
|
20022
19705
|
}
|
|
20023
19706
|
function markFormFields(form) {
|
|
20024
|
-
form.querySelectorAll(
|
|
19707
|
+
form.querySelectorAll("input, textarea").forEach((input) => {
|
|
20025
19708
|
const type = input.type;
|
|
20026
19709
|
if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
|
|
20027
19710
|
return;
|
|
20028
19711
|
}
|
|
20029
19712
|
if (getFieldWrapper(input)) return;
|
|
20030
19713
|
let wrapper = input;
|
|
20031
|
-
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll(
|
|
19714
|
+
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll("input, textarea").length === 1) {
|
|
20032
19715
|
wrapper = wrapper.parentElement;
|
|
20033
19716
|
}
|
|
20034
19717
|
if (wrapper === input) {
|
|
@@ -20042,7 +19725,6 @@ function markFormFields(form) {
|
|
|
20042
19725
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
20043
19726
|
wrapper.setAttribute(FIELD_TYPE_ATTR, inferType(input));
|
|
20044
19727
|
ensureFieldLabel(wrapper, key);
|
|
20045
|
-
if (inferType(input) === "dropdown") removeDropdownEditorPanel(wrapper);
|
|
20046
19728
|
syncRequiredMark(wrapper);
|
|
20047
19729
|
});
|
|
20048
19730
|
const wrappers = listFieldWrappers(form);
|
|
@@ -20053,21 +19735,16 @@ function markFormFields(form) {
|
|
|
20053
19735
|
}
|
|
20054
19736
|
function readFieldsFromDom(form) {
|
|
20055
19737
|
return listFieldWrappers(form).map((wrapper) => {
|
|
20056
|
-
const
|
|
20057
|
-
const control = fieldControlOf(wrapper);
|
|
20058
|
-
const isDropdown = type === "dropdown";
|
|
20059
|
-
if (isDropdown) commitDropdownOptionsFromPanel(wrapper, true);
|
|
19738
|
+
const input = fieldInputOf(wrapper);
|
|
20060
19739
|
return {
|
|
20061
19740
|
key: fieldKeyOf(wrapper),
|
|
20062
|
-
type,
|
|
19741
|
+
type: fieldTypeOf(wrapper),
|
|
20063
19742
|
label: fieldLabelText(fieldLabelOf(wrapper)).trim(),
|
|
20064
19743
|
// While a field is selected its placeholder text lives in the value (see
|
|
20065
19744
|
// beginPlaceholderEdit), so reading the attribute would store an empty one — whoever
|
|
20066
19745
|
// happens to save at that moment must still record what the owner typed.
|
|
20067
|
-
|
|
20068
|
-
|
|
20069
|
-
required: Boolean(control?.hasAttribute("required")),
|
|
20070
|
-
...isDropdown ? { options: readDropdownOptions(wrapper) } : {}
|
|
19746
|
+
placeholder: input ? input.hasAttribute(PLACEHOLDER_EDIT_ATTR) ? input.value : input.getAttribute("placeholder") ?? "" : "",
|
|
19747
|
+
required: Boolean(input?.hasAttribute("required"))
|
|
20071
19748
|
};
|
|
20072
19749
|
});
|
|
20073
19750
|
}
|
|
@@ -20085,8 +19762,8 @@ function isDefaultText(value, pick) {
|
|
|
20085
19762
|
if (!trimmed) return true;
|
|
20086
19763
|
return Object.values(FIELD_DEFAULTS).some((defaults) => pick(defaults) === trimmed);
|
|
20087
19764
|
}
|
|
20088
|
-
function applyFieldType(wrapper, type
|
|
20089
|
-
const input =
|
|
19765
|
+
function applyFieldType(wrapper, type) {
|
|
19766
|
+
const input = fieldInputOf(wrapper);
|
|
20090
19767
|
if (!input) return;
|
|
20091
19768
|
const defaults = FIELD_DEFAULTS[type];
|
|
20092
19769
|
const placeholder = input.getAttribute("placeholder") ?? "";
|
|
@@ -20098,10 +19775,6 @@ function applyFieldType(wrapper, type, options) {
|
|
|
20098
19775
|
};
|
|
20099
19776
|
const { tag, inputType } = inputTagFor(type);
|
|
20100
19777
|
wrapper.setAttribute(FIELD_TYPE_ATTR, type);
|
|
20101
|
-
if (type !== "dropdown") {
|
|
20102
|
-
wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
|
|
20103
|
-
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
20104
|
-
}
|
|
20105
19778
|
const shedSize = (el) => {
|
|
20106
19779
|
if (type === "long-text") return;
|
|
20107
19780
|
el.style.removeProperty("height");
|
|
@@ -20113,40 +19786,28 @@ function applyFieldType(wrapper, type, options) {
|
|
|
20113
19786
|
}
|
|
20114
19787
|
};
|
|
20115
19788
|
const applyDefaults = (el) => {
|
|
20116
|
-
if (type === "dropdown") return;
|
|
20117
19789
|
el.setAttribute("placeholder", defaults.placeholder);
|
|
20118
19790
|
if (label && followsDefaults.label) {
|
|
20119
19791
|
label.textContent = defaults.label;
|
|
20120
19792
|
}
|
|
20121
19793
|
};
|
|
20122
|
-
const applyDropdown = (select) => {
|
|
20123
|
-
const nextOptions = options && options.length > 0 ? options.map((text, i) => normalizeOptionText(text, i)) : [...DEFAULT_DROPDOWN_OPTIONS];
|
|
20124
|
-
fillSelectOptions(select, nextOptions, options !== void 0 ? void 0 : null);
|
|
20125
|
-
select.removeAttribute("placeholder");
|
|
20126
|
-
if (label && followsDefaults.label) label.textContent = defaults.label;
|
|
20127
|
-
if (wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)) syncDropdownPanel(wrapper);
|
|
20128
|
-
else removeDropdownEditorPanel(wrapper);
|
|
20129
|
-
};
|
|
20130
19794
|
if (input.tagName.toLowerCase() === tag) {
|
|
20131
19795
|
if (inputType) input.type = inputType;
|
|
20132
19796
|
shedSize(input);
|
|
20133
|
-
|
|
20134
|
-
else applyDefaults(input);
|
|
19797
|
+
applyDefaults(input);
|
|
20135
19798
|
requireIfEmail(wrapper, type);
|
|
20136
19799
|
return;
|
|
20137
19800
|
}
|
|
20138
19801
|
const next = document.createElement(tag);
|
|
20139
19802
|
Array.from(input.attributes).forEach((attr) => {
|
|
20140
19803
|
if (attr.name === "type") return;
|
|
20141
|
-
if (tag === "select" && (attr.name === "value" || attr.name === "placeholder")) return;
|
|
20142
19804
|
next.setAttribute(attr.name, attr.value);
|
|
20143
19805
|
});
|
|
20144
19806
|
if (inputType) next.setAttribute("type", inputType);
|
|
20145
19807
|
shedSize(next);
|
|
20146
19808
|
if (type === "long-text") next.setAttribute("rows", "4");
|
|
20147
19809
|
input.replaceWith(next);
|
|
20148
|
-
|
|
20149
|
-
else applyDefaults(next);
|
|
19810
|
+
applyDefaults(next);
|
|
20150
19811
|
requireIfEmail(wrapper, type);
|
|
20151
19812
|
}
|
|
20152
19813
|
function requireIfEmail(wrapper, type) {
|
|
@@ -20168,7 +19829,7 @@ function syncRequiredMark(wrapper) {
|
|
|
20168
19829
|
else label.removeAttribute(REQUIRED_MARK_ATTR);
|
|
20169
19830
|
}
|
|
20170
19831
|
function setFieldRequired(wrapper, required) {
|
|
20171
|
-
const input =
|
|
19832
|
+
const input = fieldInputOf(wrapper);
|
|
20172
19833
|
const label = fieldLabelOf(wrapper);
|
|
20173
19834
|
if (!input) return;
|
|
20174
19835
|
if (required) input.setAttribute("required", "");
|
|
@@ -20176,7 +19837,6 @@ function setFieldRequired(wrapper, required) {
|
|
|
20176
19837
|
if (label) syncRequiredMark(wrapper);
|
|
20177
19838
|
}
|
|
20178
19839
|
function beginPlaceholderEdit(wrapper) {
|
|
20179
|
-
if (fieldTypeOf(wrapper) === "dropdown") return;
|
|
20180
19840
|
const input = fieldInputOf(wrapper);
|
|
20181
19841
|
if (!input || input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return;
|
|
20182
19842
|
input.style.setProperty("--ohw-placeholder-edit-color", getComputedStyle(input).color);
|
|
@@ -20186,11 +19846,6 @@ function beginPlaceholderEdit(wrapper) {
|
|
|
20186
19846
|
}
|
|
20187
19847
|
function commitPlaceholderEdit(wrapper) {
|
|
20188
19848
|
if (!wrapper) return false;
|
|
20189
|
-
if (fieldTypeOf(wrapper) === "dropdown") {
|
|
20190
|
-
const before = readDropdownOptions(wrapper).join("\0");
|
|
20191
|
-
const after = commitDropdownOptionsFromPanel(wrapper, true).join("\0");
|
|
20192
|
-
return before !== after;
|
|
20193
|
-
}
|
|
20194
19849
|
const input = fieldInputOf(wrapper);
|
|
20195
19850
|
if (!input || !input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return false;
|
|
20196
19851
|
const typed = input.value;
|
|
@@ -20202,10 +19857,6 @@ function commitPlaceholderEdit(wrapper) {
|
|
|
20202
19857
|
return previous !== typed;
|
|
20203
19858
|
}
|
|
20204
19859
|
function setFieldPlaceholder(wrapper, placeholder) {
|
|
20205
|
-
if (fieldTypeOf(wrapper) === "dropdown") {
|
|
20206
|
-
writeDropdownOptions(wrapper, readDropdownOptions(wrapper), placeholder || null);
|
|
20207
|
-
return;
|
|
20208
|
-
}
|
|
20209
19860
|
fieldInputOf(wrapper)?.setAttribute("placeholder", placeholder);
|
|
20210
19861
|
}
|
|
20211
19862
|
function uniqueKey(form, base) {
|
|
@@ -20249,17 +19900,14 @@ function insertField(form, type) {
|
|
|
20249
19900
|
}
|
|
20250
19901
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
20251
19902
|
wrapper.setAttribute(FIELD_TYPE_ATTR, type);
|
|
20252
|
-
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
20253
19903
|
applyFieldType(wrapper, type);
|
|
20254
19904
|
const defaults = FIELD_DEFAULTS[type];
|
|
20255
|
-
const input =
|
|
19905
|
+
const input = fieldInputOf(wrapper);
|
|
20256
19906
|
if (input) {
|
|
20257
19907
|
input.setAttribute("name", key);
|
|
20258
19908
|
input.removeAttribute("required");
|
|
20259
|
-
|
|
20260
|
-
|
|
20261
|
-
if (input.tagName !== "SELECT") input.value = "";
|
|
20262
|
-
}
|
|
19909
|
+
input.setAttribute("placeholder", defaults.placeholder);
|
|
19910
|
+
input.value = "";
|
|
20263
19911
|
}
|
|
20264
19912
|
const label = ensureFieldLabel(wrapper, key);
|
|
20265
19913
|
label.textContent = defaults.label;
|
|
@@ -20268,22 +19916,18 @@ function insertField(form, type) {
|
|
|
20268
19916
|
return wrapper;
|
|
20269
19917
|
}
|
|
20270
19918
|
function duplicateField(form, wrapper) {
|
|
20271
|
-
if (fieldTypeOf(wrapper) === "dropdown") commitDropdownOptionsFromPanel(wrapper);
|
|
20272
19919
|
const copy = wrapper.cloneNode(true);
|
|
20273
19920
|
const key = uniqueKey(form, `${fieldKeyOf(wrapper)}-copy`);
|
|
20274
19921
|
copy.setAttribute(FIELD_ATTR, key);
|
|
20275
|
-
copy
|
|
20276
|
-
clearDropdownOptionSelection(copy);
|
|
20277
|
-
const input = fieldControlOf(copy);
|
|
19922
|
+
const input = fieldInputOf(copy);
|
|
20278
19923
|
if (input) {
|
|
20279
19924
|
input.setAttribute("name", key);
|
|
20280
19925
|
input.removeAttribute("data-ohw-key");
|
|
20281
|
-
|
|
19926
|
+
input.value = "";
|
|
20282
19927
|
}
|
|
20283
19928
|
const label = fieldLabelOf(copy);
|
|
20284
19929
|
if (label) label.setAttribute("data-ohw-key", `${key}-label`);
|
|
20285
19930
|
wrapper.after(copy);
|
|
20286
|
-
if (fieldTypeOf(copy) === "dropdown") removeDropdownEditorPanel(copy);
|
|
20287
19931
|
return copy;
|
|
20288
19932
|
}
|
|
20289
19933
|
function removeField(wrapper) {
|
|
@@ -20322,27 +19966,16 @@ function reconcileFieldsFromContent(form, content) {
|
|
|
20322
19966
|
wrapper = insertField(form, spec.type);
|
|
20323
19967
|
if (!wrapper) return;
|
|
20324
19968
|
wrapper.setAttribute(FIELD_ATTR, spec.key);
|
|
20325
|
-
const input =
|
|
19969
|
+
const input = fieldInputOf(wrapper);
|
|
20326
19970
|
if (input) {
|
|
20327
19971
|
input.setAttribute("name", spec.key);
|
|
20328
19972
|
}
|
|
20329
19973
|
fieldLabelOf(wrapper)?.setAttribute("data-ohw-key", `${spec.key}-label`);
|
|
20330
19974
|
byKey.set(spec.key, wrapper);
|
|
20331
19975
|
}
|
|
20332
|
-
|
|
20333
|
-
applyFieldType(wrapper, spec.type, spec.type === "dropdown" ? spec.options : void 0);
|
|
19976
|
+
applyFieldType(wrapper, spec.type);
|
|
20334
19977
|
setFieldRequired(wrapper, spec.required);
|
|
20335
19978
|
setFieldPlaceholder(wrapper, spec.placeholder);
|
|
20336
|
-
if (spec.type === "dropdown") {
|
|
20337
|
-
writeDropdownOptions(
|
|
20338
|
-
wrapper,
|
|
20339
|
-
spec.options?.length ? spec.options : [...DEFAULT_DROPDOWN_OPTIONS],
|
|
20340
|
-
spec.placeholder || null
|
|
20341
|
-
);
|
|
20342
|
-
}
|
|
20343
|
-
if (spec.type === "dropdown" && dropdownWasOpen) setDropdownPreviewOpen(wrapper, true);
|
|
20344
|
-
else if (spec.type === "dropdown") removeDropdownEditorPanel(wrapper);
|
|
20345
|
-
else wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
20346
19979
|
const label = fieldLabelOf(wrapper);
|
|
20347
19980
|
if (label && spec.label) label.textContent = spec.label.replace(/\s*\*\s*$/, "").trimEnd();
|
|
20348
19981
|
syncRequiredMark(wrapper);
|
|
@@ -20359,20 +19992,17 @@ function reconcileFieldsFromContent(form, content) {
|
|
|
20359
19992
|
}
|
|
20360
19993
|
|
|
20361
19994
|
// src/ui/form-field-toolbar.tsx
|
|
20362
|
-
import { AtSign, Asterisk, ChevronDown as ChevronDown2, Copy as Copy2, Phone, TextQuote, Trash2 as Trash22, Type } from "lucide-react";
|
|
20363
|
-
import {
|
|
19995
|
+
import { AtSign, Asterisk, ChevronDown as ChevronDown2, Copy as Copy2, MoreHorizontal as MoreHorizontal2, Phone, TextQuote, Trash2 as Trash22, Type } from "lucide-react";
|
|
19996
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
20364
19997
|
var TYPE_ICONS = {
|
|
20365
19998
|
"short-text": Type,
|
|
20366
19999
|
"long-text": TextQuote,
|
|
20367
20000
|
email: AtSign,
|
|
20368
|
-
phone: Phone
|
|
20369
|
-
dropdown: ChevronDown2
|
|
20001
|
+
phone: Phone
|
|
20370
20002
|
};
|
|
20371
20003
|
function FormFieldToolbar({
|
|
20372
20004
|
type,
|
|
20373
20005
|
required,
|
|
20374
|
-
dropdownOpen = null,
|
|
20375
|
-
onDropdownOpenChange,
|
|
20376
20006
|
onTypeChange,
|
|
20377
20007
|
onRequiredToggle,
|
|
20378
20008
|
onDuplicate,
|
|
@@ -20380,7 +20010,6 @@ function FormFieldToolbar({
|
|
|
20380
20010
|
}) {
|
|
20381
20011
|
const TypeIcon = TYPE_ICONS[type];
|
|
20382
20012
|
const typeLabel = FIELD_TYPES.find((entry) => entry.type === type)?.label ?? "Short text";
|
|
20383
|
-
const showDropdownToggle = type === "dropdown" && dropdownOpen !== null && dropdownOpen !== void 0;
|
|
20384
20013
|
return /* @__PURE__ */ jsxs8(
|
|
20385
20014
|
"div",
|
|
20386
20015
|
{
|
|
@@ -20432,131 +20061,29 @@ function FormFieldToolbar({
|
|
|
20432
20061
|
]
|
|
20433
20062
|
}
|
|
20434
20063
|
),
|
|
20435
|
-
|
|
20436
|
-
|
|
20437
|
-
/* @__PURE__ */
|
|
20438
|
-
|
|
20064
|
+
/* @__PURE__ */ jsx16("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
20065
|
+
/* @__PURE__ */ jsxs8(DropdownMenu, { children: [
|
|
20066
|
+
/* @__PURE__ */ jsx16(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx16(
|
|
20067
|
+
"button",
|
|
20439
20068
|
{
|
|
20440
|
-
|
|
20441
|
-
|
|
20442
|
-
|
|
20443
|
-
className: "h-7
|
|
20444
|
-
|
|
20445
|
-
e.preventDefault();
|
|
20446
|
-
e.stopPropagation();
|
|
20447
|
-
},
|
|
20448
|
-
children: [
|
|
20449
|
-
/* @__PURE__ */ jsx16(
|
|
20450
|
-
ToggleGroupItem,
|
|
20451
|
-
{
|
|
20452
|
-
value: "closed",
|
|
20453
|
-
size: "sm",
|
|
20454
|
-
"aria-label": "Closed",
|
|
20455
|
-
className: "h-6 min-w-0 px-2 text-xs font-medium",
|
|
20456
|
-
onMouseDown: (e) => {
|
|
20457
|
-
e.preventDefault();
|
|
20458
|
-
e.stopPropagation();
|
|
20459
|
-
if (dropdownOpen !== false) onDropdownOpenChange?.(false);
|
|
20460
|
-
},
|
|
20461
|
-
onClick: (e) => {
|
|
20462
|
-
e.preventDefault();
|
|
20463
|
-
e.stopPropagation();
|
|
20464
|
-
},
|
|
20465
|
-
children: "Closed"
|
|
20466
|
-
}
|
|
20467
|
-
),
|
|
20468
|
-
/* @__PURE__ */ jsx16(
|
|
20469
|
-
ToggleGroupItem,
|
|
20470
|
-
{
|
|
20471
|
-
value: "open",
|
|
20472
|
-
size: "sm",
|
|
20473
|
-
"aria-label": "Open",
|
|
20474
|
-
className: "h-6 min-w-0 px-2 text-xs font-medium",
|
|
20475
|
-
onMouseDown: (e) => {
|
|
20476
|
-
e.preventDefault();
|
|
20477
|
-
e.stopPropagation();
|
|
20478
|
-
if (dropdownOpen !== true) onDropdownOpenChange?.(true);
|
|
20479
|
-
},
|
|
20480
|
-
onClick: (e) => {
|
|
20481
|
-
e.preventDefault();
|
|
20482
|
-
e.stopPropagation();
|
|
20483
|
-
},
|
|
20484
|
-
children: "Open"
|
|
20485
|
-
}
|
|
20486
|
-
)
|
|
20487
|
-
]
|
|
20069
|
+
type: "button",
|
|
20070
|
+
title: "More",
|
|
20071
|
+
"aria-label": "More",
|
|
20072
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20073
|
+
children: /* @__PURE__ */ jsx16(MoreHorizontal2, { size: 15, "aria-hidden": true })
|
|
20488
20074
|
}
|
|
20489
|
-
)
|
|
20490
|
-
|
|
20491
|
-
|
|
20492
|
-
|
|
20493
|
-
|
|
20494
|
-
|
|
20495
|
-
|
|
20496
|
-
|
|
20497
|
-
|
|
20498
|
-
|
|
20499
|
-
|
|
20500
|
-
|
|
20501
|
-
}
|
|
20502
|
-
),
|
|
20503
|
-
/* @__PURE__ */ jsx16(
|
|
20504
|
-
"button",
|
|
20505
|
-
{
|
|
20506
|
-
type: "button",
|
|
20507
|
-
title: "Delete",
|
|
20508
|
-
"aria-label": "Delete",
|
|
20509
|
-
onClick: onDelete,
|
|
20510
|
-
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20511
|
-
children: /* @__PURE__ */ jsx16(Trash22, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20512
|
-
}
|
|
20513
|
-
)
|
|
20514
|
-
]
|
|
20515
|
-
}
|
|
20516
|
-
);
|
|
20517
|
-
}
|
|
20518
|
-
function DropdownOptionToolbar({
|
|
20519
|
-
canDelete,
|
|
20520
|
-
onDuplicate,
|
|
20521
|
-
onDelete
|
|
20522
|
-
}) {
|
|
20523
|
-
return /* @__PURE__ */ jsxs8(
|
|
20524
|
-
"div",
|
|
20525
|
-
{
|
|
20526
|
-
"data-ohw-dropdown-option-toolbar": "",
|
|
20527
|
-
className: "pointer-events-auto flex items-center gap-0.5 whitespace-nowrap rounded-lg border border-border bg-background p-1 shadow-md",
|
|
20528
|
-
children: [
|
|
20529
|
-
/* @__PURE__ */ jsx16(
|
|
20530
|
-
"button",
|
|
20531
|
-
{
|
|
20532
|
-
type: "button",
|
|
20533
|
-
title: "Duplicate",
|
|
20534
|
-
"aria-label": "Duplicate",
|
|
20535
|
-
onMouseDown: (e) => {
|
|
20536
|
-
e.preventDefault();
|
|
20537
|
-
e.stopPropagation();
|
|
20538
|
-
onDuplicate();
|
|
20539
|
-
},
|
|
20540
|
-
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20541
|
-
children: /* @__PURE__ */ jsx16(Copy2, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20542
|
-
}
|
|
20543
|
-
),
|
|
20544
|
-
/* @__PURE__ */ jsx16(
|
|
20545
|
-
"button",
|
|
20546
|
-
{
|
|
20547
|
-
type: "button",
|
|
20548
|
-
title: "Delete",
|
|
20549
|
-
"aria-label": "Delete",
|
|
20550
|
-
disabled: !canDelete,
|
|
20551
|
-
onMouseDown: (e) => {
|
|
20552
|
-
e.preventDefault();
|
|
20553
|
-
e.stopPropagation();
|
|
20554
|
-
if (canDelete) onDelete();
|
|
20555
|
-
},
|
|
20556
|
-
className: "flex h-7 w-7 items-center justify-center rounded-md transition-colors " + (canDelete ? "text-foreground hover:bg-muted/70" : "cursor-not-allowed text-muted-foreground opacity-40"),
|
|
20557
|
-
children: /* @__PURE__ */ jsx16(Trash22, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20558
|
-
}
|
|
20559
|
-
)
|
|
20075
|
+
) }),
|
|
20076
|
+
/* @__PURE__ */ jsxs8(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-42.5 p-1", children: [
|
|
20077
|
+
/* @__PURE__ */ jsxs8(DropdownMenuItem, { onSelect: onDuplicate, className: "rounded-md py-2 text-[13px]", children: [
|
|
20078
|
+
/* @__PURE__ */ jsx16(Copy2, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
|
|
20079
|
+
"Duplicate"
|
|
20080
|
+
] }),
|
|
20081
|
+
/* @__PURE__ */ jsxs8(DropdownMenuItem, { variant: "destructive", onSelect: onDelete, className: "rounded-md py-2 text-[13px]", children: [
|
|
20082
|
+
/* @__PURE__ */ jsx16(Trash22, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
|
|
20083
|
+
"Delete"
|
|
20084
|
+
] })
|
|
20085
|
+
] })
|
|
20086
|
+
] })
|
|
20560
20087
|
]
|
|
20561
20088
|
}
|
|
20562
20089
|
);
|
|
@@ -20652,7 +20179,7 @@ var MEDIA_SKELETON_CSS = `
|
|
|
20652
20179
|
`;
|
|
20653
20180
|
|
|
20654
20181
|
// src/ui/MediaOverlay.tsx
|
|
20655
|
-
import { Fragment as
|
|
20182
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
20656
20183
|
var VIDEO_SETTINGS_BAR_INSET = 8;
|
|
20657
20184
|
var OVERLAY_BUTTON_STYLE = {
|
|
20658
20185
|
pointerEvents: "auto",
|
|
@@ -20699,7 +20226,6 @@ function MediaOverlay({
|
|
|
20699
20226
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
20700
20227
|
);
|
|
20701
20228
|
}, [isVideo]);
|
|
20702
|
-
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
20703
20229
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
20704
20230
|
const box = {
|
|
20705
20231
|
position: "fixed",
|
|
@@ -20788,7 +20314,7 @@ function MediaOverlay({
|
|
|
20788
20314
|
]
|
|
20789
20315
|
}
|
|
20790
20316
|
) : null;
|
|
20791
|
-
return /* @__PURE__ */ jsxs9(
|
|
20317
|
+
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
20792
20318
|
settingsBar,
|
|
20793
20319
|
/* @__PURE__ */ jsxs9(
|
|
20794
20320
|
"div",
|
|
@@ -20798,9 +20324,10 @@ function MediaOverlay({
|
|
|
20798
20324
|
className: "flex items-center justify-center cursor-pointer",
|
|
20799
20325
|
style: {
|
|
20800
20326
|
...box,
|
|
20801
|
-
//
|
|
20802
|
-
//
|
|
20803
|
-
//
|
|
20327
|
+
// When text overlays this media, let clicks fall THROUGH to the text underneath. In the
|
|
20328
|
+
// parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
|
|
20329
|
+
// in-document, pointer-events does it natively. The button below opts back in, so
|
|
20330
|
+
// Replace still works.
|
|
20804
20331
|
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
20805
20332
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
20806
20333
|
// than hovered. Hover keeps the existing tinted preview.
|
|
@@ -20828,18 +20355,15 @@ function MediaOverlay({
|
|
|
20828
20355
|
},
|
|
20829
20356
|
children: [
|
|
20830
20357
|
isVideo ? /* @__PURE__ */ jsx18(Film, { size: 14 }) : /* @__PURE__ */ jsx18(ImageIcon, { size: 14 }),
|
|
20831
|
-
|
|
20358
|
+
isVideo ? "Replace video" : "Replace image"
|
|
20832
20359
|
]
|
|
20833
20360
|
}
|
|
20834
20361
|
),
|
|
20835
|
-
|
|
20362
|
+
replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ jsxs9(
|
|
20836
20363
|
"div",
|
|
20837
20364
|
{
|
|
20838
20365
|
className: "flex items-center gap-1.5",
|
|
20839
|
-
style: {
|
|
20840
|
-
// Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
|
|
20841
|
-
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
|
|
20842
|
-
},
|
|
20366
|
+
style: { pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto" },
|
|
20843
20367
|
onClick: (e) => e.stopPropagation(),
|
|
20844
20368
|
children: [
|
|
20845
20369
|
/* @__PURE__ */ jsxs9(
|
|
@@ -20848,7 +20372,7 @@ function MediaOverlay({
|
|
|
20848
20372
|
"data-ohw-media-overlay": "",
|
|
20849
20373
|
variant: "outline",
|
|
20850
20374
|
size: "sm",
|
|
20851
|
-
"aria-label":
|
|
20375
|
+
"aria-label": isVideo ? "Replace video" : "Replace image",
|
|
20852
20376
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
20853
20377
|
style: {
|
|
20854
20378
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -20869,7 +20393,7 @@ function MediaOverlay({
|
|
|
20869
20393
|
},
|
|
20870
20394
|
children: [
|
|
20871
20395
|
isVideo ? /* @__PURE__ */ jsx18(Film, { size: 14 }) : /* @__PURE__ */ jsx18(ImageIcon, { size: 14 }),
|
|
20872
|
-
replaceMode === "full" ?
|
|
20396
|
+
replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
|
|
20873
20397
|
]
|
|
20874
20398
|
}
|
|
20875
20399
|
),
|
|
@@ -21084,7 +20608,7 @@ function installHistoryKeyRelay() {
|
|
|
21084
20608
|
}
|
|
21085
20609
|
|
|
21086
20610
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
21087
|
-
import { Fragment as
|
|
20611
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
21088
20612
|
var findSectionElement = findByInstanceId;
|
|
21089
20613
|
function readRect(instanceId) {
|
|
21090
20614
|
const el = findSectionElement(instanceId);
|
|
@@ -21426,7 +20950,7 @@ function AiSectionOverlay({
|
|
|
21426
20950
|
isLast
|
|
21427
20951
|
});
|
|
21428
20952
|
}, [activeSelectionId, selectionRect, postToParent2]);
|
|
21429
|
-
return /* @__PURE__ */ jsxs11(
|
|
20953
|
+
return /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
21430
20954
|
hoverRect && /* @__PURE__ */ jsx20(
|
|
21431
20955
|
"div",
|
|
21432
20956
|
{
|
|
@@ -21463,7 +20987,7 @@ function AiSectionOverlay({
|
|
|
21463
20987
|
}
|
|
21464
20988
|
}
|
|
21465
20989
|
),
|
|
21466
|
-
reviewRect && /* @__PURE__ */ jsxs11(
|
|
20990
|
+
reviewRect && /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
21467
20991
|
subtractRect(reviewRect, navToggleHole).map((r2, i) => /* @__PURE__ */ jsx20(
|
|
21468
20992
|
"div",
|
|
21469
20993
|
{
|
|
@@ -21526,24 +21050,8 @@ function AiSectionOverlay({
|
|
|
21526
21050
|
}
|
|
21527
21051
|
|
|
21528
21052
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
21529
|
-
import { useCallback as useCallback3, useEffect as useEffect10,
|
|
21530
|
-
import {
|
|
21531
|
-
AlignCenter,
|
|
21532
|
-
AlignLeft,
|
|
21533
|
-
AlignRight,
|
|
21534
|
-
ArrowLeft as ArrowLeft2,
|
|
21535
|
-
ArrowRight as ArrowRight2,
|
|
21536
|
-
Check as Check2,
|
|
21537
|
-
ChevronDown as ChevronDown3,
|
|
21538
|
-
Image as ImageIcon2,
|
|
21539
|
-
ImageMinus,
|
|
21540
|
-
ImagePlus,
|
|
21541
|
-
Link as LinkIcon,
|
|
21542
|
-
Minus,
|
|
21543
|
-
Palette,
|
|
21544
|
-
Plus as Plus2,
|
|
21545
|
-
Star
|
|
21546
|
-
} from "lucide-react";
|
|
21053
|
+
import { useCallback as useCallback3, useEffect as useEffect10, useRef as useRef5, useState as useState8 } from "react";
|
|
21054
|
+
import { Star } from "lucide-react";
|
|
21547
21055
|
|
|
21548
21056
|
// src/lib/ai-media-strip-tree.ts
|
|
21549
21057
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -21657,6 +21165,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
21657
21165
|
return true;
|
|
21658
21166
|
});
|
|
21659
21167
|
}
|
|
21168
|
+
function setMediaStripItemAlt(tree, index, alt) {
|
|
21169
|
+
return withMediaStrip(tree, (block) => {
|
|
21170
|
+
const items = block.items;
|
|
21171
|
+
if (index < 0 || index >= items.length) return false;
|
|
21172
|
+
items[index] = { ...items[index], alt };
|
|
21173
|
+
return true;
|
|
21174
|
+
});
|
|
21175
|
+
}
|
|
21660
21176
|
function setMediaStripItemLink(tree, index, link) {
|
|
21661
21177
|
return withMediaStrip(tree, (block) => {
|
|
21662
21178
|
const items = block.items;
|
|
@@ -21674,117 +21190,11 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
21674
21190
|
});
|
|
21675
21191
|
}
|
|
21676
21192
|
|
|
21677
|
-
// src/ui/dialog.tsx
|
|
21678
|
-
import * as React10 from "react";
|
|
21679
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21680
|
-
import { X as X2 } from "lucide-react";
|
|
21681
|
-
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
21682
|
-
function Dialog2({
|
|
21683
|
-
...props
|
|
21684
|
-
}) {
|
|
21685
|
-
return /* @__PURE__ */ jsx21(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21686
|
-
}
|
|
21687
|
-
function DialogPortal({
|
|
21688
|
-
...props
|
|
21689
|
-
}) {
|
|
21690
|
-
return /* @__PURE__ */ jsx21(DialogPrimitive.Portal, { ...props });
|
|
21691
|
-
}
|
|
21692
|
-
function DialogOverlay({
|
|
21693
|
-
className,
|
|
21694
|
-
...props
|
|
21695
|
-
}) {
|
|
21696
|
-
return /* @__PURE__ */ jsx21(
|
|
21697
|
-
DialogPrimitive.Overlay,
|
|
21698
|
-
{
|
|
21699
|
-
"data-slot": "dialog-overlay",
|
|
21700
|
-
"data-ohw-link-modal-root": "",
|
|
21701
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21702
|
-
...props
|
|
21703
|
-
}
|
|
21704
|
-
);
|
|
21705
|
-
}
|
|
21706
|
-
var DialogContent = React10.forwardRef(
|
|
21707
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21708
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
21709
|
-
return /* @__PURE__ */ jsxs12(DialogPortal, { container: container ?? void 0, children: [
|
|
21710
|
-
/* @__PURE__ */ jsx21(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21711
|
-
/* @__PURE__ */ jsxs12(
|
|
21712
|
-
DialogPrimitive.Content,
|
|
21713
|
-
{
|
|
21714
|
-
ref,
|
|
21715
|
-
"data-slot": "dialog-content",
|
|
21716
|
-
className: cn(
|
|
21717
|
-
positionMode,
|
|
21718
|
-
"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",
|
|
21719
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21720
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21721
|
-
className
|
|
21722
|
-
),
|
|
21723
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
21724
|
-
...props,
|
|
21725
|
-
children: [
|
|
21726
|
-
children,
|
|
21727
|
-
showCloseButton ? /* @__PURE__ */ jsx21(
|
|
21728
|
-
DialogPrimitive.Close,
|
|
21729
|
-
{
|
|
21730
|
-
type: "button",
|
|
21731
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21732
|
-
"aria-label": "Close",
|
|
21733
|
-
children: /* @__PURE__ */ jsx21(X2, { size: 16, "aria-hidden": true })
|
|
21734
|
-
}
|
|
21735
|
-
) : null
|
|
21736
|
-
]
|
|
21737
|
-
}
|
|
21738
|
-
)
|
|
21739
|
-
] });
|
|
21740
|
-
}
|
|
21741
|
-
);
|
|
21742
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21743
|
-
function DialogHeader({
|
|
21744
|
-
className,
|
|
21745
|
-
...props
|
|
21746
|
-
}) {
|
|
21747
|
-
return /* @__PURE__ */ jsx21("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21748
|
-
}
|
|
21749
|
-
function DialogFooter({
|
|
21750
|
-
className,
|
|
21751
|
-
...props
|
|
21752
|
-
}) {
|
|
21753
|
-
return /* @__PURE__ */ jsx21(
|
|
21754
|
-
"div",
|
|
21755
|
-
{
|
|
21756
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
21757
|
-
...props
|
|
21758
|
-
}
|
|
21759
|
-
);
|
|
21760
|
-
}
|
|
21761
|
-
var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
21762
|
-
DialogPrimitive.Title,
|
|
21763
|
-
{
|
|
21764
|
-
ref,
|
|
21765
|
-
className: cn(
|
|
21766
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21767
|
-
className
|
|
21768
|
-
),
|
|
21769
|
-
...props
|
|
21770
|
-
}
|
|
21771
|
-
));
|
|
21772
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21773
|
-
var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx21(
|
|
21774
|
-
DialogPrimitive.Description,
|
|
21775
|
-
{
|
|
21776
|
-
ref,
|
|
21777
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
21778
|
-
...props
|
|
21779
|
-
}
|
|
21780
|
-
));
|
|
21781
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21782
|
-
var DialogClose = DialogPrimitive.Close;
|
|
21783
|
-
|
|
21784
21193
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
21785
|
-
import { Fragment as
|
|
21786
|
-
var PRIMARY3 = "
|
|
21787
|
-
var
|
|
21194
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
21195
|
+
var PRIMARY3 = "#0885FE";
|
|
21196
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
|
|
21197
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
21788
21198
|
function findMediaStripItemElement(sectionId, index) {
|
|
21789
21199
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
21790
21200
|
if (!sectionEl2) return null;
|
|
@@ -21794,35 +21204,14 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
21794
21204
|
}
|
|
21795
21205
|
return null;
|
|
21796
21206
|
}
|
|
21797
|
-
function
|
|
21798
|
-
|
|
21799
|
-
if (target.closest(CHROME_SELECTOR)) return null;
|
|
21800
|
-
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
21801
|
-
if (!itemEl) return null;
|
|
21802
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21803
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
21804
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
21805
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
21806
|
-
if (!sectionId || Number.isNaN(index)) return null;
|
|
21807
|
-
return { sectionId, index };
|
|
21808
|
-
}
|
|
21809
|
-
function sameRef(a, b) {
|
|
21810
|
-
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
21811
|
-
}
|
|
21812
|
-
function rectOf(el) {
|
|
21207
|
+
function readRect2(ref) {
|
|
21208
|
+
const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
21813
21209
|
if (!el) return null;
|
|
21814
21210
|
const r2 = el.getBoundingClientRect();
|
|
21815
21211
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
21816
21212
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
21817
21213
|
}
|
|
21818
|
-
function
|
|
21819
|
-
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
21820
|
-
}
|
|
21821
|
-
function readStripRect(ref) {
|
|
21822
|
-
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
21823
|
-
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
21824
|
-
}
|
|
21825
|
-
function useLiveItemRect(ref, strip = false) {
|
|
21214
|
+
function useLiveItemRect(ref) {
|
|
21826
21215
|
const [rect, setRect] = useState8(null);
|
|
21827
21216
|
useEffect10(() => {
|
|
21828
21217
|
if (!ref) {
|
|
@@ -21830,7 +21219,7 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
21830
21219
|
return;
|
|
21831
21220
|
}
|
|
21832
21221
|
const update = () => {
|
|
21833
|
-
const next =
|
|
21222
|
+
const next = readRect2(ref);
|
|
21834
21223
|
setRect(
|
|
21835
21224
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
21836
21225
|
);
|
|
@@ -21845,49 +21234,9 @@ function useLiveItemRect(ref, strip = false) {
|
|
|
21845
21234
|
window.removeEventListener("resize", update);
|
|
21846
21235
|
clearInterval(interval);
|
|
21847
21236
|
};
|
|
21848
|
-
}, [ref?.sectionId, ref?.index
|
|
21237
|
+
}, [ref?.sectionId, ref?.index]);
|
|
21849
21238
|
return rect;
|
|
21850
21239
|
}
|
|
21851
|
-
var TOOLBAR_STRIP_GAP = 52;
|
|
21852
|
-
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
21853
|
-
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
21854
|
-
function StripToolbarSlot({ stripRect, children }) {
|
|
21855
|
-
const slotRef = useRef5(null);
|
|
21856
|
-
const [shift, setShift] = useState8(0);
|
|
21857
|
-
const centerX = stripRect.left + stripRect.width / 2;
|
|
21858
|
-
useLayoutEffect4(() => {
|
|
21859
|
-
const slot = slotRef.current;
|
|
21860
|
-
if (!slot) return;
|
|
21861
|
-
const clamp = () => {
|
|
21862
|
-
const w = slot.offsetWidth;
|
|
21863
|
-
if (w <= 0) return;
|
|
21864
|
-
const half = w / 2;
|
|
21865
|
-
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
21866
|
-
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
21867
|
-
};
|
|
21868
|
-
clamp();
|
|
21869
|
-
const ro = new ResizeObserver(clamp);
|
|
21870
|
-
ro.observe(slot);
|
|
21871
|
-
return () => ro.disconnect();
|
|
21872
|
-
}, [centerX, children]);
|
|
21873
|
-
const mobile = window.innerWidth <= 480;
|
|
21874
|
-
return /* @__PURE__ */ jsx22(
|
|
21875
|
-
"div",
|
|
21876
|
-
{
|
|
21877
|
-
ref: slotRef,
|
|
21878
|
-
"data-ohw-bridge": "",
|
|
21879
|
-
"data-ohw-item-interaction": "",
|
|
21880
|
-
className: "pointer-events-auto fixed",
|
|
21881
|
-
style: {
|
|
21882
|
-
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
21883
|
-
left: centerX + shift,
|
|
21884
|
-
transform: "translate(-50%, -100%)",
|
|
21885
|
-
zIndex: 2147483645
|
|
21886
|
-
},
|
|
21887
|
-
children
|
|
21888
|
-
}
|
|
21889
|
-
);
|
|
21890
|
-
}
|
|
21891
21240
|
function requestValidateTree(postToParent2, tree) {
|
|
21892
21241
|
return new Promise((resolve) => {
|
|
21893
21242
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -21924,72 +21273,116 @@ function requestAssetPick(postToParent2) {
|
|
|
21924
21273
|
postToParent2({ type: "ow:asset-pick", id });
|
|
21925
21274
|
});
|
|
21926
21275
|
}
|
|
21927
|
-
function
|
|
21276
|
+
function Pill({
|
|
21928
21277
|
label,
|
|
21929
21278
|
onClick,
|
|
21930
|
-
disabled
|
|
21931
|
-
active
|
|
21932
|
-
children
|
|
21279
|
+
disabled,
|
|
21280
|
+
active
|
|
21933
21281
|
}) {
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
|
|
21940
|
-
|
|
21941
|
-
|
|
21282
|
+
return /* @__PURE__ */ jsx21(
|
|
21283
|
+
"button",
|
|
21284
|
+
{
|
|
21285
|
+
type: "button",
|
|
21286
|
+
onClick,
|
|
21287
|
+
disabled,
|
|
21288
|
+
style: {
|
|
21289
|
+
height: 28,
|
|
21290
|
+
padding: "0 10px",
|
|
21291
|
+
display: "inline-flex",
|
|
21292
|
+
alignItems: "center",
|
|
21293
|
+
gap: 4,
|
|
21294
|
+
borderRadius: 999,
|
|
21295
|
+
border: "none",
|
|
21296
|
+
cursor: disabled ? "default" : "pointer",
|
|
21297
|
+
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
21298
|
+
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
21299
|
+
opacity: disabled ? 0.4 : 1,
|
|
21300
|
+
fontSize: 12,
|
|
21301
|
+
lineHeight: "16px",
|
|
21302
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21303
|
+
whiteSpace: "nowrap",
|
|
21304
|
+
flex: "0 0 auto"
|
|
21305
|
+
},
|
|
21306
|
+
children: label
|
|
21307
|
+
}
|
|
21308
|
+
);
|
|
21942
21309
|
}
|
|
21943
|
-
function
|
|
21944
|
-
|
|
21945
|
-
value,
|
|
21946
|
-
|
|
21947
|
-
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
|
|
21951
|
-
|
|
21952
|
-
|
|
21953
|
-
|
|
21954
|
-
"
|
|
21955
|
-
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
) }),
|
|
21965
|
-
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
21966
|
-
const selected = option.value === value;
|
|
21967
|
-
return /* @__PURE__ */ jsxs13(
|
|
21968
|
-
DropdownMenuItem,
|
|
21310
|
+
function AltInput({ value, onCommit }) {
|
|
21311
|
+
const [draft, setDraft] = useState8(value);
|
|
21312
|
+
useEffect10(() => setDraft(value), [value]);
|
|
21313
|
+
return /* @__PURE__ */ jsxs12(
|
|
21314
|
+
"div",
|
|
21315
|
+
{
|
|
21316
|
+
style: {
|
|
21317
|
+
display: "flex",
|
|
21318
|
+
alignItems: "center",
|
|
21319
|
+
gap: 6,
|
|
21320
|
+
height: 28,
|
|
21321
|
+
padding: "0 12px",
|
|
21322
|
+
borderRadius: 999,
|
|
21323
|
+
background: "#ffffff",
|
|
21324
|
+
width: "100%",
|
|
21325
|
+
maxWidth: 260,
|
|
21326
|
+
boxSizing: "border-box"
|
|
21327
|
+
},
|
|
21328
|
+
children: [
|
|
21329
|
+
/* @__PURE__ */ jsx21(
|
|
21330
|
+
"span",
|
|
21969
21331
|
{
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
)
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21332
|
+
style: {
|
|
21333
|
+
flex: "0 0 auto",
|
|
21334
|
+
color: OHW_BLUE_DARK,
|
|
21335
|
+
fontSize: 10,
|
|
21336
|
+
fontWeight: 700,
|
|
21337
|
+
textTransform: "uppercase",
|
|
21338
|
+
letterSpacing: 0.4
|
|
21339
|
+
},
|
|
21340
|
+
children: "Alt"
|
|
21341
|
+
}
|
|
21342
|
+
),
|
|
21343
|
+
/* @__PURE__ */ jsx21(
|
|
21344
|
+
"input",
|
|
21345
|
+
{
|
|
21346
|
+
type: "text",
|
|
21347
|
+
value: draft,
|
|
21348
|
+
onChange: (e) => setDraft(e.target.value),
|
|
21349
|
+
onBlur: () => {
|
|
21350
|
+
if (draft !== value) onCommit(draft);
|
|
21351
|
+
},
|
|
21352
|
+
onKeyDown: (e) => {
|
|
21353
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
21354
|
+
if (e.key === "Escape") {
|
|
21355
|
+
setDraft(value);
|
|
21356
|
+
e.currentTarget.blur();
|
|
21357
|
+
}
|
|
21358
|
+
},
|
|
21359
|
+
placeholder: "Describe this image",
|
|
21360
|
+
"aria-label": "Image alt text",
|
|
21361
|
+
style: {
|
|
21362
|
+
flex: 1,
|
|
21363
|
+
minWidth: 0,
|
|
21364
|
+
border: "none",
|
|
21365
|
+
outline: "none",
|
|
21366
|
+
background: "transparent",
|
|
21367
|
+
fontSize: 12,
|
|
21368
|
+
lineHeight: "16px",
|
|
21369
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21370
|
+
color: "#1f2937"
|
|
21371
|
+
}
|
|
21372
|
+
}
|
|
21373
|
+
)
|
|
21374
|
+
]
|
|
21375
|
+
}
|
|
21376
|
+
);
|
|
21984
21377
|
}
|
|
21985
21378
|
var VARIANTS = [
|
|
21986
21379
|
{ value: "logos", label: "Logos" },
|
|
21987
21380
|
{ value: "reel", label: "Reel" }
|
|
21988
21381
|
];
|
|
21989
21382
|
var ALIGNS = [
|
|
21990
|
-
{ value: "left", label: "
|
|
21991
|
-
{ value: "center", label: "
|
|
21992
|
-
{ value: "right", label: "
|
|
21383
|
+
{ value: "left", label: "Left" },
|
|
21384
|
+
{ value: "center", label: "Center" },
|
|
21385
|
+
{ value: "right", label: "Right" }
|
|
21993
21386
|
];
|
|
21994
21387
|
var HOVERS = [
|
|
21995
21388
|
{ value: "none", label: "None" },
|
|
@@ -21997,104 +21390,104 @@ var HOVERS = [
|
|
|
21997
21390
|
{ value: "zoom", label: "Zoom" },
|
|
21998
21391
|
{ value: "fade", label: "Fade" }
|
|
21999
21392
|
];
|
|
21393
|
+
var TREATMENTS = [
|
|
21394
|
+
{ value: "color", label: "Color" },
|
|
21395
|
+
{ value: "grayscale", label: "Grayscale" }
|
|
21396
|
+
];
|
|
22000
21397
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
22001
|
-
function
|
|
22002
|
-
|
|
22003
|
-
linkTarget,
|
|
22004
|
-
onClose,
|
|
22005
|
-
onSave
|
|
22006
|
-
}) {
|
|
22007
|
-
const [draft, setDraft] = useState8(href);
|
|
22008
|
-
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
21398
|
+
function LinkInput({ value, onCommit }) {
|
|
21399
|
+
const [draft, setDraft] = useState8(value);
|
|
22009
21400
|
const [invalid, setInvalid] = useState8(false);
|
|
22010
|
-
|
|
21401
|
+
useEffect10(() => {
|
|
21402
|
+
setDraft(value);
|
|
21403
|
+
setInvalid(false);
|
|
21404
|
+
}, [value]);
|
|
21405
|
+
const commit2 = () => {
|
|
22011
21406
|
const next = draft.trim();
|
|
22012
|
-
if (next
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
22017
|
-
onClose();
|
|
21407
|
+
if (next === value) return setInvalid(false);
|
|
21408
|
+
if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
|
|
21409
|
+
setInvalid(false);
|
|
21410
|
+
onCommit(next);
|
|
22018
21411
|
};
|
|
22019
|
-
return /* @__PURE__ */
|
|
22020
|
-
|
|
22021
|
-
|
|
22022
|
-
|
|
22023
|
-
"
|
|
22024
|
-
|
|
22025
|
-
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
|
|
22031
|
-
|
|
22032
|
-
|
|
22033
|
-
|
|
22034
|
-
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
"
|
|
22038
|
-
|
|
22039
|
-
|
|
22040
|
-
|
|
22041
|
-
|
|
22042
|
-
|
|
22043
|
-
|
|
22044
|
-
|
|
22045
|
-
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
|
|
22050
|
-
|
|
22051
|
-
|
|
22052
|
-
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
|
|
22058
|
-
|
|
22059
|
-
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22075
|
-
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22083
|
-
|
|
21412
|
+
return /* @__PURE__ */ jsxs12(
|
|
21413
|
+
"div",
|
|
21414
|
+
{
|
|
21415
|
+
style: {
|
|
21416
|
+
display: "flex",
|
|
21417
|
+
alignItems: "center",
|
|
21418
|
+
gap: 6,
|
|
21419
|
+
height: 28,
|
|
21420
|
+
padding: "0 12px",
|
|
21421
|
+
borderRadius: 999,
|
|
21422
|
+
background: "#ffffff",
|
|
21423
|
+
width: "100%",
|
|
21424
|
+
maxWidth: 260,
|
|
21425
|
+
boxSizing: "border-box",
|
|
21426
|
+
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
21427
|
+
},
|
|
21428
|
+
children: [
|
|
21429
|
+
/* @__PURE__ */ jsx21(
|
|
21430
|
+
"span",
|
|
21431
|
+
{
|
|
21432
|
+
style: {
|
|
21433
|
+
flex: "0 0 auto",
|
|
21434
|
+
color: OHW_BLUE_DARK,
|
|
21435
|
+
fontSize: 10,
|
|
21436
|
+
fontWeight: 700,
|
|
21437
|
+
textTransform: "uppercase",
|
|
21438
|
+
letterSpacing: 0.4
|
|
21439
|
+
},
|
|
21440
|
+
children: "Link"
|
|
21441
|
+
}
|
|
21442
|
+
),
|
|
21443
|
+
/* @__PURE__ */ jsx21(
|
|
21444
|
+
"input",
|
|
21445
|
+
{
|
|
21446
|
+
type: "text",
|
|
21447
|
+
inputMode: "url",
|
|
21448
|
+
value: draft,
|
|
21449
|
+
onChange: (e) => setDraft(e.target.value),
|
|
21450
|
+
onBlur: commit2,
|
|
21451
|
+
onKeyDown: (e) => {
|
|
21452
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
21453
|
+
if (e.key === "Escape") {
|
|
21454
|
+
setDraft(value);
|
|
21455
|
+
setInvalid(false);
|
|
21456
|
+
e.currentTarget.blur();
|
|
21457
|
+
}
|
|
21458
|
+
},
|
|
21459
|
+
placeholder: "https://example.com",
|
|
21460
|
+
"aria-label": "Image link URL",
|
|
21461
|
+
"aria-invalid": invalid,
|
|
21462
|
+
style: {
|
|
21463
|
+
flex: 1,
|
|
21464
|
+
minWidth: 0,
|
|
21465
|
+
border: "none",
|
|
21466
|
+
outline: "none",
|
|
21467
|
+
background: "transparent",
|
|
21468
|
+
fontSize: 12,
|
|
21469
|
+
lineHeight: "16px",
|
|
21470
|
+
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21471
|
+
color: "#1f2937"
|
|
21472
|
+
}
|
|
21473
|
+
}
|
|
21474
|
+
)
|
|
21475
|
+
]
|
|
21476
|
+
}
|
|
21477
|
+
);
|
|
22084
21478
|
}
|
|
22085
21479
|
function MediaStripToolbar({
|
|
22086
21480
|
entry,
|
|
22087
21481
|
index,
|
|
22088
21482
|
pending,
|
|
22089
21483
|
error,
|
|
22090
|
-
itemEditOn,
|
|
22091
|
-
onToggleItemEdit,
|
|
22092
21484
|
onSetVariant,
|
|
22093
21485
|
onSetAlign,
|
|
22094
21486
|
onSetHover,
|
|
22095
21487
|
onSetTreatment,
|
|
22096
21488
|
onResize,
|
|
22097
|
-
|
|
21489
|
+
onSetAlt,
|
|
21490
|
+
onSetLink,
|
|
22098
21491
|
onAddItem,
|
|
22099
21492
|
onRemoveItem,
|
|
22100
21493
|
onChangeImage,
|
|
@@ -22103,102 +21496,81 @@ function MediaStripToolbar({
|
|
|
22103
21496
|
}) {
|
|
22104
21497
|
const items = mediaStripItems(entry.tree);
|
|
22105
21498
|
const itemCount = items.length;
|
|
21499
|
+
const currentAlt = items[index]?.alt ?? "";
|
|
21500
|
+
const currentHref2 = items[index]?.href ?? "";
|
|
21501
|
+
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
22106
21502
|
const slots = findMediaStripSlots(entry.tree);
|
|
22107
21503
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
22108
21504
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
22109
21505
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
22110
21506
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
22111
21507
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
22112
|
-
const
|
|
22113
|
-
const
|
|
22114
|
-
|
|
21508
|
+
const isMobile = window.innerWidth <= 480;
|
|
21509
|
+
const rowStyle = isMobile ? {
|
|
21510
|
+
display: "flex",
|
|
21511
|
+
gap: 6,
|
|
21512
|
+
flexWrap: "nowrap",
|
|
21513
|
+
justifyContent: "center",
|
|
21514
|
+
overflowX: "auto",
|
|
21515
|
+
WebkitOverflowScrolling: "touch",
|
|
21516
|
+
width: "100%",
|
|
21517
|
+
scrollbarWidth: "none"
|
|
21518
|
+
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
21519
|
+
return /* @__PURE__ */ jsxs12(
|
|
22115
21520
|
"div",
|
|
22116
21521
|
{
|
|
22117
21522
|
"data-ohw-bridge": "",
|
|
22118
21523
|
"data-ohw-toolbar": "",
|
|
22119
21524
|
onMouseDown: (e) => e.stopPropagation(),
|
|
22120
|
-
|
|
22121
|
-
|
|
21525
|
+
style: {
|
|
21526
|
+
display: "flex",
|
|
21527
|
+
flexDirection: "column",
|
|
21528
|
+
gap: 6,
|
|
21529
|
+
alignItems: "center",
|
|
21530
|
+
background: OHW_BLUE,
|
|
21531
|
+
padding: 8,
|
|
21532
|
+
borderRadius: 12,
|
|
21533
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
21534
|
+
pointerEvents: pending ? "none" : "auto",
|
|
21535
|
+
opacity: pending ? 0.6 : 1,
|
|
21536
|
+
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
21537
|
+
},
|
|
22122
21538
|
children: [
|
|
22123
|
-
/* @__PURE__ */
|
|
22124
|
-
|
|
22125
|
-
{
|
|
22126
|
-
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
|
|
22131
|
-
|
|
22132
|
-
|
|
22133
|
-
|
|
22134
|
-
|
|
22135
|
-
|
|
22136
|
-
|
|
22137
|
-
|
|
22138
|
-
|
|
22139
|
-
|
|
22140
|
-
|
|
22141
|
-
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
|
|
22146
|
-
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
|
|
22150
|
-
|
|
22151
|
-
|
|
22152
|
-
|
|
22153
|
-
|
|
22154
|
-
|
|
22155
|
-
) }),
|
|
22156
|
-
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
22157
|
-
] }),
|
|
22158
|
-
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22159
|
-
/* @__PURE__ */ jsx22(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx22(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22160
|
-
/* @__PURE__ */ jsx22(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx22(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22161
|
-
/* @__PURE__ */ jsx22(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx22(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22162
|
-
/* @__PURE__ */ jsx22(
|
|
22163
|
-
ToolbarAction,
|
|
22164
|
-
{
|
|
22165
|
-
label: gatedLabel("Move right"),
|
|
22166
|
-
onClick: onMoveRight,
|
|
22167
|
-
disabled: !itemEditOn || index >= itemCount - 1,
|
|
22168
|
-
children: /* @__PURE__ */ jsx22(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
22169
|
-
}
|
|
22170
|
-
),
|
|
22171
|
-
/* @__PURE__ */ jsx22(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx22(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22172
|
-
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22173
|
-
/* @__PURE__ */ jsx22(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
22174
|
-
/* @__PURE__ */ jsx22(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
22175
|
-
/* @__PURE__ */ jsx22(
|
|
22176
|
-
ToolbarAction,
|
|
22177
|
-
{
|
|
22178
|
-
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
22179
|
-
active: treatment === "grayscale",
|
|
22180
|
-
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
22181
|
-
children: /* @__PURE__ */ jsx22(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
22182
|
-
}
|
|
22183
|
-
),
|
|
22184
|
-
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22185
|
-
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx22(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx22(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
22186
|
-
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22187
|
-
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx22(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22188
|
-
/* @__PURE__ */ jsxs13("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
22189
|
-
sizeValue,
|
|
22190
|
-
"px"
|
|
22191
|
-
] }),
|
|
22192
|
-
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx22(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22193
|
-
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22194
|
-
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx22(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
22195
|
-
]
|
|
22196
|
-
}
|
|
22197
|
-
),
|
|
22198
|
-
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 })
|
|
21539
|
+
/* @__PURE__ */ jsxs12("div", { style: rowStyle, children: [
|
|
21540
|
+
VARIANTS.map((v) => /* @__PURE__ */ jsx21(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
|
|
21541
|
+
ALIGNS.map((a) => /* @__PURE__ */ jsx21(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
|
|
21542
|
+
] }),
|
|
21543
|
+
/* @__PURE__ */ jsxs12("div", { style: rowStyle, children: [
|
|
21544
|
+
HOVERS.map((h) => /* @__PURE__ */ jsx21(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
|
|
21545
|
+
TREATMENTS.map((t) => /* @__PURE__ */ jsx21(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
|
|
21546
|
+
] }),
|
|
21547
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
21548
|
+
/* @__PURE__ */ jsx21(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
|
|
21549
|
+
/* @__PURE__ */ jsxs12("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
|
|
21550
|
+
sizeValue,
|
|
21551
|
+
"px"
|
|
21552
|
+
] }),
|
|
21553
|
+
/* @__PURE__ */ jsx21(Pill, { label: "+", onClick: () => onResize(8) })
|
|
21554
|
+
] }),
|
|
21555
|
+
/* @__PURE__ */ jsx21("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx21(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
|
|
21556
|
+
/* @__PURE__ */ jsx21("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx21(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
|
|
21557
|
+
currentHref2 && /* @__PURE__ */ jsxs12("div", { style: rowStyle, children: [
|
|
21558
|
+
/* @__PURE__ */ jsx21(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
|
|
21559
|
+
/* @__PURE__ */ jsx21(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
|
|
21560
|
+
] }),
|
|
21561
|
+
/* @__PURE__ */ jsxs12("div", { style: rowStyle, children: [
|
|
21562
|
+
/* @__PURE__ */ jsx21(Pill, { label: "Change Image", onClick: onChangeImage }),
|
|
21563
|
+
/* @__PURE__ */ jsx21(Pill, { label: "+ Item", onClick: onAddItem }),
|
|
21564
|
+
/* @__PURE__ */ jsx21(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
|
|
21565
|
+
] }),
|
|
21566
|
+
/* @__PURE__ */ jsxs12("div", { style: rowStyle, children: [
|
|
21567
|
+
/* @__PURE__ */ jsx21(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
|
|
21568
|
+
/* @__PURE__ */ jsx21(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
|
|
21569
|
+
] }),
|
|
21570
|
+
error && /* @__PURE__ */ jsx21("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
22199
21571
|
]
|
|
22200
21572
|
}
|
|
22201
|
-
)
|
|
21573
|
+
);
|
|
22202
21574
|
}
|
|
22203
21575
|
function findMediaStripSlots(tree) {
|
|
22204
21576
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -22217,23 +21589,31 @@ function AiMediaStripOverlay({
|
|
|
22217
21589
|
}) {
|
|
22218
21590
|
const [hover, setHover] = useState8(null);
|
|
22219
21591
|
const [active, setActive] = useState8(null);
|
|
22220
|
-
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
22221
|
-
const [linkOpen, setLinkOpen] = useState8(false);
|
|
22222
21592
|
const [pending, setPending] = useState8(false);
|
|
22223
21593
|
const [error, setError] = useState8(null);
|
|
22224
21594
|
const activeRef = useRef5(null);
|
|
22225
21595
|
activeRef.current = active;
|
|
22226
|
-
const linkOpenRef = useRef5(false);
|
|
22227
|
-
linkOpenRef.current = linkOpen;
|
|
22228
21596
|
useEffect10(() => {
|
|
22229
21597
|
const onMove = (e) => {
|
|
22230
|
-
const ref = itemRefFromTarget(e.target);
|
|
22231
21598
|
const t = e.target;
|
|
22232
|
-
|
|
22233
|
-
|
|
22234
|
-
|
|
22235
|
-
|
|
22236
|
-
|
|
21599
|
+
if (!(t instanceof HTMLElement)) return;
|
|
21600
|
+
if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
|
|
21601
|
+
return;
|
|
21602
|
+
}
|
|
21603
|
+
const itemEl = t.closest("[data-ohw-media-strip-item]");
|
|
21604
|
+
if (!itemEl) {
|
|
21605
|
+
setHover(null);
|
|
21606
|
+
return;
|
|
21607
|
+
}
|
|
21608
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21609
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
21610
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
21611
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
21612
|
+
if (!sectionId || Number.isNaN(index)) {
|
|
21613
|
+
setHover(null);
|
|
21614
|
+
return;
|
|
21615
|
+
}
|
|
21616
|
+
setHover({ sectionId, index });
|
|
22237
21617
|
};
|
|
22238
21618
|
const onLeave = () => setHover(null);
|
|
22239
21619
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -22245,25 +21625,23 @@ function AiMediaStripOverlay({
|
|
|
22245
21625
|
}, []);
|
|
22246
21626
|
useEffect10(() => {
|
|
22247
21627
|
const onClick = (e) => {
|
|
21628
|
+
const current = activeRef.current;
|
|
21629
|
+
if (!current) return;
|
|
22248
21630
|
const t = e.target;
|
|
22249
|
-
if (!(t instanceof
|
|
22250
|
-
if (t.closest(
|
|
22251
|
-
const
|
|
22252
|
-
if (
|
|
22253
|
-
|
|
22254
|
-
setItemEditOn(false);
|
|
21631
|
+
if (!(t instanceof HTMLElement)) return;
|
|
21632
|
+
if (t.closest("[data-ohw-item-interaction]")) return;
|
|
21633
|
+
const itemEl = findMediaStripItemElement(current.sectionId, current.index);
|
|
21634
|
+
if (itemEl && itemEl.contains(t)) return;
|
|
21635
|
+
setActive(null);
|
|
22255
21636
|
setError(null);
|
|
22256
|
-
setActive(ref);
|
|
22257
21637
|
};
|
|
22258
21638
|
document.addEventListener("click", onClick, true);
|
|
22259
21639
|
return () => document.removeEventListener("click", onClick, true);
|
|
22260
|
-
}, [
|
|
21640
|
+
}, []);
|
|
22261
21641
|
useEffect10(() => {
|
|
22262
21642
|
const onBlur = () => {
|
|
22263
21643
|
if (!activeRef.current) return;
|
|
22264
21644
|
setActive(null);
|
|
22265
|
-
setItemEditOn(false);
|
|
22266
|
-
setLinkOpen(false);
|
|
22267
21645
|
setError(null);
|
|
22268
21646
|
};
|
|
22269
21647
|
window.addEventListener("blur", onBlur);
|
|
@@ -22273,10 +21651,7 @@ function AiMediaStripOverlay({
|
|
|
22273
21651
|
const onKeyDown = (e) => {
|
|
22274
21652
|
if (e.key !== "Escape") return;
|
|
22275
21653
|
if (!activeRef.current) return;
|
|
22276
|
-
if (linkOpenRef.current) return;
|
|
22277
|
-
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
22278
21654
|
setActive(null);
|
|
22279
|
-
setItemEditOn(false);
|
|
22280
21655
|
setError(null);
|
|
22281
21656
|
};
|
|
22282
21657
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -22310,133 +21685,137 @@ function AiMediaStripOverlay({
|
|
|
22310
21685
|
tree: nextTree,
|
|
22311
21686
|
label: entry.label,
|
|
22312
21687
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
22313
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
22314
|
-
// The user is already looking at the strip they just edited — recentering the viewport
|
|
22315
|
-
// on every edit reads as the section jumping around.
|
|
22316
|
-
skipScrollIntoView: true
|
|
21688
|
+
...entry.brand ? { brand: entry.brand } : {}
|
|
22317
21689
|
});
|
|
22318
21690
|
return true;
|
|
22319
21691
|
},
|
|
22320
21692
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
22321
21693
|
);
|
|
22322
21694
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
21695
|
+
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
22323
21696
|
const activeItemRect = useLiveItemRect(active);
|
|
22324
|
-
const
|
|
22325
|
-
const
|
|
22326
|
-
|
|
22327
|
-
|
|
22328
|
-
|
|
22329
|
-
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
|
|
22334
|
-
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
|
|
22345
|
-
|
|
22346
|
-
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
|
|
22350
|
-
|
|
22351
|
-
|
|
22352
|
-
|
|
22353
|
-
|
|
22354
|
-
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
21697
|
+
const TOOLBAR_APPROX_H = 170;
|
|
21698
|
+
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
21699
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
21700
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx21(
|
|
21701
|
+
"button",
|
|
21702
|
+
{
|
|
21703
|
+
type: "button",
|
|
21704
|
+
"data-ohw-toolbar": "",
|
|
21705
|
+
onClick: () => {
|
|
21706
|
+
clearInteractionChromeRef.current();
|
|
21707
|
+
setActive(hover);
|
|
21708
|
+
},
|
|
21709
|
+
"aria-label": "Configure media item",
|
|
21710
|
+
style: {
|
|
21711
|
+
position: "fixed",
|
|
21712
|
+
top: hoverHandleRect.top + 8,
|
|
21713
|
+
left: hoverHandleRect.left + hoverHandleRect.width - 36,
|
|
21714
|
+
width: 28,
|
|
21715
|
+
height: 28,
|
|
21716
|
+
borderRadius: 8,
|
|
21717
|
+
border: `1.5px dashed ${PRIMARY3}`,
|
|
21718
|
+
background: "#ffffff",
|
|
21719
|
+
color: PRIMARY3,
|
|
21720
|
+
display: "flex",
|
|
21721
|
+
alignItems: "center",
|
|
21722
|
+
justifyContent: "center",
|
|
21723
|
+
cursor: "pointer",
|
|
21724
|
+
zIndex: 2147483643,
|
|
21725
|
+
fontSize: 14,
|
|
21726
|
+
fontWeight: 700
|
|
21727
|
+
},
|
|
21728
|
+
children: /* @__PURE__ */ jsx21(Star, { size: 14, style: { pointerEvents: "none" } })
|
|
21729
|
+
}
|
|
21730
|
+
),
|
|
21731
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx21(
|
|
21732
|
+
ItemInteractionLayer,
|
|
21733
|
+
{
|
|
21734
|
+
rect: activeItemRect,
|
|
21735
|
+
state: toolbarState,
|
|
21736
|
+
toolbar: /* @__PURE__ */ jsx21(
|
|
21737
|
+
MediaStripToolbar,
|
|
21738
|
+
{
|
|
21739
|
+
entry: activeEntry,
|
|
21740
|
+
index: active.index,
|
|
21741
|
+
pending,
|
|
21742
|
+
error,
|
|
21743
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
21744
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
21745
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
21746
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
21747
|
+
onResize: (delta) => {
|
|
21748
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
21749
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
21750
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
21751
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
21752
|
+
},
|
|
21753
|
+
onSetAlt: (alt) => {
|
|
21754
|
+
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
21755
|
+
},
|
|
21756
|
+
onSetLink: (href, linkTarget) => {
|
|
22358
21757
|
void runMutation(
|
|
22359
21758
|
active.sectionId,
|
|
22360
|
-
(tree) =>
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
|
|
21759
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
21760
|
+
);
|
|
21761
|
+
},
|
|
21762
|
+
onAddItem: () => {
|
|
21763
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
21764
|
+
if (!picked) return;
|
|
21765
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
21766
|
+
void runMutation(
|
|
21767
|
+
active.sectionId,
|
|
21768
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
21769
|
+
{ [picked.assetId]: picked.url }
|
|
21770
|
+
).then((applied) => {
|
|
21771
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21772
|
+
});
|
|
22364
21773
|
});
|
|
22365
|
-
}
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
21774
|
+
},
|
|
21775
|
+
onChangeImage: () => {
|
|
21776
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
21777
|
+
if (!picked) return;
|
|
21778
|
+
void runMutation(
|
|
21779
|
+
active.sectionId,
|
|
21780
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
21781
|
+
{ [picked.assetId]: picked.url }
|
|
21782
|
+
);
|
|
21783
|
+
});
|
|
21784
|
+
},
|
|
21785
|
+
onRemoveItem: () => {
|
|
21786
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
21787
|
+
(applied) => {
|
|
21788
|
+
if (applied) setActive(null);
|
|
21789
|
+
}
|
|
22374
21790
|
);
|
|
22375
|
-
}
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
},
|
|
22391
|
-
onMoveRight: () => {
|
|
22392
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
22393
|
-
(applied) => {
|
|
22394
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
22395
|
-
}
|
|
22396
|
-
);
|
|
22397
|
-
}
|
|
22398
|
-
}
|
|
22399
|
-
) }),
|
|
22400
|
-
/* @__PURE__ */ jsx22(
|
|
22401
|
-
"div",
|
|
22402
|
-
{
|
|
22403
|
-
"data-ohw-bridge": "",
|
|
22404
|
-
"data-ohw-item-interaction": "",
|
|
22405
|
-
"aria-hidden": true,
|
|
22406
|
-
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
22407
|
-
style: {
|
|
22408
|
-
top: activeItemRect.top + activeItemRect.height + 10,
|
|
22409
|
-
left: activeItemRect.left - 5,
|
|
22410
|
-
background: PRIMARY3,
|
|
22411
|
-
zIndex: 2147483644
|
|
22412
|
-
},
|
|
22413
|
-
children: "Media item"
|
|
22414
|
-
}
|
|
22415
|
-
),
|
|
22416
|
-
linkOpen && /* @__PURE__ */ jsx22(
|
|
22417
|
-
LinkModal,
|
|
22418
|
-
{
|
|
22419
|
-
href: activeHref,
|
|
22420
|
-
linkTarget: activeTarget,
|
|
22421
|
-
onClose: () => setLinkOpen(false),
|
|
22422
|
-
onSave: (href, linkTarget) => {
|
|
22423
|
-
void runMutation(
|
|
22424
|
-
active.sectionId,
|
|
22425
|
-
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
22426
|
-
);
|
|
21791
|
+
},
|
|
21792
|
+
onMoveLeft: () => {
|
|
21793
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
21794
|
+
(applied) => {
|
|
21795
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
21796
|
+
}
|
|
21797
|
+
);
|
|
21798
|
+
},
|
|
21799
|
+
onMoveRight: () => {
|
|
21800
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
21801
|
+
(applied) => {
|
|
21802
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21803
|
+
}
|
|
21804
|
+
);
|
|
21805
|
+
}
|
|
22427
21806
|
}
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
21807
|
+
)
|
|
21808
|
+
}
|
|
21809
|
+
)
|
|
22431
21810
|
] });
|
|
22432
21811
|
}
|
|
22433
21812
|
|
|
22434
21813
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
22435
|
-
import { useCallback as useCallback4, useEffect as useEffect11, useLayoutEffect as
|
|
22436
|
-
import { Check as
|
|
22437
|
-
import { Fragment as
|
|
21814
|
+
import { useCallback as useCallback4, useEffect as useEffect11, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
|
|
21815
|
+
import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
|
|
21816
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
22438
21817
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
22439
|
-
var
|
|
21818
|
+
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]";
|
|
22440
21819
|
function findPricingCardElement(sectionId, index) {
|
|
22441
21820
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
22442
21821
|
if (!sectionEl2) return null;
|
|
@@ -22448,7 +21827,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
22448
21827
|
}
|
|
22449
21828
|
function cardRefFromTarget(target) {
|
|
22450
21829
|
if (!(target instanceof Element)) return null;
|
|
22451
|
-
if (target.closest(
|
|
21830
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
22452
21831
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
22453
21832
|
if (!cardEl) return null;
|
|
22454
21833
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -22458,21 +21837,21 @@ function cardRefFromTarget(target) {
|
|
|
22458
21837
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
22459
21838
|
return { sectionId, index };
|
|
22460
21839
|
}
|
|
22461
|
-
function
|
|
21840
|
+
function sameRef(a, b) {
|
|
22462
21841
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
22463
21842
|
}
|
|
22464
|
-
function
|
|
21843
|
+
function rectOf(el) {
|
|
22465
21844
|
if (!el) return null;
|
|
22466
21845
|
const r2 = el.getBoundingClientRect();
|
|
22467
21846
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
22468
21847
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
22469
21848
|
}
|
|
22470
21849
|
function readRect3(ref) {
|
|
22471
|
-
return
|
|
21850
|
+
return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
22472
21851
|
}
|
|
22473
21852
|
function readGridRect(ref) {
|
|
22474
21853
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
22475
|
-
return
|
|
21854
|
+
return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
22476
21855
|
}
|
|
22477
21856
|
function useLiveCardRect(ref, grid = false) {
|
|
22478
21857
|
const [rect, setRect] = useState9(null);
|
|
@@ -22502,19 +21881,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
22502
21881
|
}
|
|
22503
21882
|
var TOOLBAR_GRID_GAP = 52;
|
|
22504
21883
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
22505
|
-
var
|
|
21884
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
22506
21885
|
function GridToolbarSlot({ gridRect, children }) {
|
|
22507
21886
|
const slotRef = useRef6(null);
|
|
22508
21887
|
const [shift, setShift] = useState9(0);
|
|
22509
21888
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
22510
|
-
|
|
21889
|
+
useLayoutEffect4(() => {
|
|
22511
21890
|
const slot = slotRef.current;
|
|
22512
21891
|
if (!slot) return;
|
|
22513
21892
|
const clamp = () => {
|
|
22514
21893
|
const w = slot.offsetWidth;
|
|
22515
21894
|
if (w <= 0) return;
|
|
22516
21895
|
const half = w / 2;
|
|
22517
|
-
const clamped = Math.max(
|
|
21896
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
22518
21897
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
22519
21898
|
};
|
|
22520
21899
|
clamp();
|
|
@@ -22523,7 +21902,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
22523
21902
|
return () => ro.disconnect();
|
|
22524
21903
|
}, [centerX, children]);
|
|
22525
21904
|
const mobile = window.innerWidth <= 480;
|
|
22526
|
-
return /* @__PURE__ */
|
|
21905
|
+
return /* @__PURE__ */ jsx22(
|
|
22527
21906
|
"div",
|
|
22528
21907
|
{
|
|
22529
21908
|
ref: slotRef,
|
|
@@ -22558,7 +21937,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
22558
21937
|
});
|
|
22559
21938
|
}
|
|
22560
21939
|
function StyleSwatch({ style }) {
|
|
22561
|
-
return /* @__PURE__ */
|
|
21940
|
+
return /* @__PURE__ */ jsx22(
|
|
22562
21941
|
"span",
|
|
22563
21942
|
{
|
|
22564
21943
|
"aria-hidden": true,
|
|
@@ -22572,35 +21951,35 @@ function StyleSwatch({ style }) {
|
|
|
22572
21951
|
);
|
|
22573
21952
|
}
|
|
22574
21953
|
function ButtonGlyph() {
|
|
22575
|
-
return /* @__PURE__ */
|
|
22576
|
-
/* @__PURE__ */
|
|
22577
|
-
/* @__PURE__ */
|
|
21954
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
21955
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
21956
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
22578
21957
|
] });
|
|
22579
21958
|
}
|
|
22580
21959
|
function FeatureGlyph({ mode }) {
|
|
22581
|
-
return /* @__PURE__ */
|
|
22582
|
-
/* @__PURE__ */
|
|
22583
|
-
/* @__PURE__ */
|
|
22584
|
-
/* @__PURE__ */
|
|
22585
|
-
/* @__PURE__ */
|
|
22586
|
-
/* @__PURE__ */
|
|
22587
|
-
mode === "add" && /* @__PURE__ */
|
|
21960
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
21961
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
21962
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
21963
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
21964
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
21965
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
21966
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
22588
21967
|
] });
|
|
22589
21968
|
}
|
|
22590
|
-
function
|
|
21969
|
+
function ToolbarAction({
|
|
22591
21970
|
label,
|
|
22592
21971
|
onClick,
|
|
22593
21972
|
disabled = false,
|
|
22594
21973
|
children
|
|
22595
21974
|
}) {
|
|
22596
|
-
const button = /* @__PURE__ */
|
|
22597
|
-
return /* @__PURE__ */
|
|
22598
|
-
/* @__PURE__ */
|
|
22599
|
-
/* @__PURE__ */
|
|
21975
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
21976
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
21977
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
21978
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
22600
21979
|
] });
|
|
22601
21980
|
}
|
|
22602
|
-
function
|
|
22603
|
-
return /* @__PURE__ */
|
|
21981
|
+
function ToolbarSeparator() {
|
|
21982
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
22604
21983
|
}
|
|
22605
21984
|
function CardStyleMenu({
|
|
22606
21985
|
value,
|
|
@@ -22608,7 +21987,7 @@ function CardStyleMenu({
|
|
|
22608
21987
|
disabled = false
|
|
22609
21988
|
}) {
|
|
22610
21989
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
22611
|
-
const trigger = /* @__PURE__ */
|
|
21990
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
22612
21991
|
"button",
|
|
22613
21992
|
{
|
|
22614
21993
|
type: "button",
|
|
@@ -22619,28 +21998,28 @@ function CardStyleMenu({
|
|
|
22619
21998
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
22620
21999
|
),
|
|
22621
22000
|
children: [
|
|
22622
|
-
/* @__PURE__ */
|
|
22623
|
-
/* @__PURE__ */
|
|
22624
|
-
/* @__PURE__ */
|
|
22001
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
22002
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
22003
|
+
/* @__PURE__ */ jsx22(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
22625
22004
|
]
|
|
22626
22005
|
}
|
|
22627
22006
|
);
|
|
22628
22007
|
if (disabled) {
|
|
22629
|
-
return /* @__PURE__ */
|
|
22630
|
-
/* @__PURE__ */
|
|
22631
|
-
/* @__PURE__ */
|
|
22632
|
-
/* @__PURE__ */
|
|
22633
|
-
/* @__PURE__ */
|
|
22008
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
22009
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
22010
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
22011
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
22012
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
22634
22013
|
] })
|
|
22635
22014
|
] });
|
|
22636
22015
|
}
|
|
22637
|
-
return /* @__PURE__ */
|
|
22638
|
-
/* @__PURE__ */
|
|
22639
|
-
/* @__PURE__ */
|
|
22640
|
-
/* @__PURE__ */
|
|
22641
|
-
/* @__PURE__ */
|
|
22016
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
22017
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
22018
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
22019
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
22020
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
22642
22021
|
const selected = style.value === value;
|
|
22643
|
-
return /* @__PURE__ */
|
|
22022
|
+
return /* @__PURE__ */ jsxs13(
|
|
22644
22023
|
DropdownMenuItem,
|
|
22645
22024
|
{
|
|
22646
22025
|
role: "menuitemradio",
|
|
@@ -22648,9 +22027,9 @@ function CardStyleMenu({
|
|
|
22648
22027
|
onSelect: () => onChange(style.value),
|
|
22649
22028
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
22650
22029
|
children: [
|
|
22651
|
-
/* @__PURE__ */
|
|
22652
|
-
/* @__PURE__ */
|
|
22653
|
-
selected && /* @__PURE__ */
|
|
22030
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
22031
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
22032
|
+
selected && /* @__PURE__ */ jsx22(Check2, { size: 16, className: "text-bridge-primary" })
|
|
22654
22033
|
]
|
|
22655
22034
|
},
|
|
22656
22035
|
style.value
|
|
@@ -22680,7 +22059,7 @@ function PricingCardToolbar({
|
|
|
22680
22059
|
const style = pricingCardStyle(entry.tree, index);
|
|
22681
22060
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
22682
22061
|
const mobile = window.innerWidth <= 480;
|
|
22683
|
-
return /* @__PURE__ */
|
|
22062
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
22684
22063
|
"div",
|
|
22685
22064
|
{
|
|
22686
22065
|
"data-ohw-bridge": "",
|
|
@@ -22692,7 +22071,7 @@ function PricingCardToolbar({
|
|
|
22692
22071
|
),
|
|
22693
22072
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
22694
22073
|
children: [
|
|
22695
|
-
/* @__PURE__ */
|
|
22074
|
+
/* @__PURE__ */ jsxs13(
|
|
22696
22075
|
"div",
|
|
22697
22076
|
{
|
|
22698
22077
|
className: cn(
|
|
@@ -22701,8 +22080,8 @@ function PricingCardToolbar({
|
|
|
22701
22080
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
22702
22081
|
),
|
|
22703
22082
|
children: [
|
|
22704
|
-
/* @__PURE__ */
|
|
22705
|
-
/* @__PURE__ */
|
|
22083
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
22084
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
22706
22085
|
CustomToolbarButton,
|
|
22707
22086
|
{
|
|
22708
22087
|
type: "button",
|
|
@@ -22710,7 +22089,7 @@ function PricingCardToolbar({
|
|
|
22710
22089
|
"aria-pressed": featuredTag,
|
|
22711
22090
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
22712
22091
|
className: "group size-8",
|
|
22713
|
-
children: /* @__PURE__ */
|
|
22092
|
+
children: /* @__PURE__ */ jsx22(
|
|
22714
22093
|
Star2,
|
|
22715
22094
|
{
|
|
22716
22095
|
size: 16,
|
|
@@ -22725,25 +22104,25 @@ function PricingCardToolbar({
|
|
|
22725
22104
|
)
|
|
22726
22105
|
}
|
|
22727
22106
|
) }),
|
|
22728
|
-
/* @__PURE__ */
|
|
22107
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
22729
22108
|
] }),
|
|
22730
|
-
/* @__PURE__ */
|
|
22731
|
-
/* @__PURE__ */
|
|
22732
|
-
/* @__PURE__ */
|
|
22733
|
-
/* @__PURE__ */
|
|
22734
|
-
/* @__PURE__ */
|
|
22735
|
-
/* @__PURE__ */
|
|
22736
|
-
/* @__PURE__ */
|
|
22109
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22110
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
22111
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22112
|
+
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
22113
|
+
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
22114
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
22115
|
+
/* @__PURE__ */ jsx22(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
22737
22116
|
] }) }),
|
|
22738
|
-
/* @__PURE__ */
|
|
22739
|
-
/* @__PURE__ */
|
|
22740
|
-
/* @__PURE__ */
|
|
22741
|
-
/* @__PURE__ */
|
|
22742
|
-
/* @__PURE__ */
|
|
22117
|
+
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
22118
|
+
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
22119
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator, {}),
|
|
22120
|
+
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22121
|
+
/* @__PURE__ */ jsx22(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
22743
22122
|
]
|
|
22744
22123
|
}
|
|
22745
22124
|
),
|
|
22746
|
-
error && /* @__PURE__ */
|
|
22125
|
+
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 })
|
|
22747
22126
|
]
|
|
22748
22127
|
}
|
|
22749
22128
|
) });
|
|
@@ -22777,7 +22156,7 @@ function AiPricingCardOverlay({
|
|
|
22777
22156
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
22778
22157
|
setHover((prev) => {
|
|
22779
22158
|
const next = ref && !overEditable ? ref : null;
|
|
22780
|
-
return
|
|
22159
|
+
return sameRef(prev, next) ? prev : next;
|
|
22781
22160
|
});
|
|
22782
22161
|
};
|
|
22783
22162
|
const onLeave = () => setHover(null);
|
|
@@ -22792,10 +22171,10 @@ function AiPricingCardOverlay({
|
|
|
22792
22171
|
const onClick = (e) => {
|
|
22793
22172
|
const t = e.target;
|
|
22794
22173
|
if (!(t instanceof Element)) return;
|
|
22795
|
-
if (t.closest(
|
|
22174
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
22796
22175
|
const ref = cardRefFromTarget(t);
|
|
22797
|
-
setActive((prev) =>
|
|
22798
|
-
if (!ref || !
|
|
22176
|
+
setActive((prev) => sameRef(prev, ref) ? prev : ref);
|
|
22177
|
+
if (!ref || !sameRef(activeRef.current, ref)) setError(null);
|
|
22799
22178
|
};
|
|
22800
22179
|
document.addEventListener("click", onClick, true);
|
|
22801
22180
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -22860,12 +22239,12 @@ function AiPricingCardOverlay({
|
|
|
22860
22239
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
22861
22240
|
const activeCardRect = useLiveCardRect(active);
|
|
22862
22241
|
const activeGridRect = useLiveCardRect(active, true);
|
|
22863
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
22864
|
-
return /* @__PURE__ */
|
|
22865
|
-
hoverRect && /* @__PURE__ */
|
|
22866
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
22867
|
-
/* @__PURE__ */
|
|
22868
|
-
/* @__PURE__ */
|
|
22242
|
+
const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
|
|
22243
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
22244
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
22245
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
22246
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
22247
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
22869
22248
|
PricingCardToolbar,
|
|
22870
22249
|
{
|
|
22871
22250
|
entry: activeEntry,
|
|
@@ -22893,7 +22272,7 @@ function AiPricingCardOverlay({
|
|
|
22893
22272
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
22894
22273
|
}
|
|
22895
22274
|
) }),
|
|
22896
|
-
/* @__PURE__ */
|
|
22275
|
+
/* @__PURE__ */ jsx22(
|
|
22897
22276
|
"div",
|
|
22898
22277
|
{
|
|
22899
22278
|
"data-ohw-bridge": "",
|
|
@@ -22958,10 +22337,10 @@ function clearVideo(tree, path) {
|
|
|
22958
22337
|
}
|
|
22959
22338
|
|
|
22960
22339
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
22961
|
-
import { Fragment as
|
|
22340
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
22962
22341
|
var PRIMARY5 = "#0885FE";
|
|
22963
|
-
var
|
|
22964
|
-
var
|
|
22342
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
|
|
22343
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
22965
22344
|
function findVideoBlockElement(sectionId, path) {
|
|
22966
22345
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
22967
22346
|
if (!sectionEl2) return null;
|
|
@@ -23021,12 +22400,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
23021
22400
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
23022
22401
|
});
|
|
23023
22402
|
}
|
|
23024
|
-
function
|
|
22403
|
+
function Pill2({
|
|
23025
22404
|
label,
|
|
23026
22405
|
onClick,
|
|
23027
22406
|
disabled
|
|
23028
22407
|
}) {
|
|
23029
|
-
return /* @__PURE__ */
|
|
22408
|
+
return /* @__PURE__ */ jsx23(
|
|
23030
22409
|
"button",
|
|
23031
22410
|
{
|
|
23032
22411
|
type: "button",
|
|
@@ -23042,7 +22421,7 @@ function Pill({
|
|
|
23042
22421
|
border: "none",
|
|
23043
22422
|
cursor: disabled ? "default" : "pointer",
|
|
23044
22423
|
background: "#ffffff",
|
|
23045
|
-
color:
|
|
22424
|
+
color: OHW_BLUE_DARK2,
|
|
23046
22425
|
opacity: disabled ? 0.4 : 1,
|
|
23047
22426
|
fontSize: 12,
|
|
23048
22427
|
lineHeight: "16px",
|
|
@@ -23085,8 +22464,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
23085
22464
|
onCommit(id);
|
|
23086
22465
|
}
|
|
23087
22466
|
};
|
|
23088
|
-
return /* @__PURE__ */
|
|
23089
|
-
/* @__PURE__ */
|
|
22467
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
22468
|
+
/* @__PURE__ */ jsxs14(
|
|
23090
22469
|
"div",
|
|
23091
22470
|
{
|
|
23092
22471
|
style: {
|
|
@@ -23102,12 +22481,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
23102
22481
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
23103
22482
|
},
|
|
23104
22483
|
children: [
|
|
23105
|
-
/* @__PURE__ */
|
|
22484
|
+
/* @__PURE__ */ jsx23(
|
|
23106
22485
|
"span",
|
|
23107
22486
|
{
|
|
23108
22487
|
style: {
|
|
23109
22488
|
flex: "0 0 auto",
|
|
23110
|
-
color:
|
|
22489
|
+
color: OHW_BLUE_DARK2,
|
|
23111
22490
|
fontSize: 10,
|
|
23112
22491
|
lineHeight: "16px",
|
|
23113
22492
|
fontWeight: 700,
|
|
@@ -23117,7 +22496,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
23117
22496
|
children: "Video"
|
|
23118
22497
|
}
|
|
23119
22498
|
),
|
|
23120
|
-
/* @__PURE__ */
|
|
22499
|
+
/* @__PURE__ */ jsx23(
|
|
23121
22500
|
"input",
|
|
23122
22501
|
{
|
|
23123
22502
|
type: "text",
|
|
@@ -23154,7 +22533,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
23154
22533
|
]
|
|
23155
22534
|
}
|
|
23156
22535
|
),
|
|
23157
|
-
invalid && /* @__PURE__ */
|
|
22536
|
+
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." })
|
|
23158
22537
|
] });
|
|
23159
22538
|
}
|
|
23160
22539
|
function VideoToolbar({
|
|
@@ -23164,7 +22543,7 @@ function VideoToolbar({
|
|
|
23164
22543
|
onSetVideoId,
|
|
23165
22544
|
onRemove
|
|
23166
22545
|
}) {
|
|
23167
|
-
return /* @__PURE__ */
|
|
22546
|
+
return /* @__PURE__ */ jsxs14(
|
|
23168
22547
|
"div",
|
|
23169
22548
|
{
|
|
23170
22549
|
"data-ohw-bridge": "",
|
|
@@ -23176,7 +22555,7 @@ function VideoToolbar({
|
|
|
23176
22555
|
gap: 6,
|
|
23177
22556
|
alignItems: "center",
|
|
23178
22557
|
width: 280,
|
|
23179
|
-
background:
|
|
22558
|
+
background: OHW_BLUE2,
|
|
23180
22559
|
padding: 8,
|
|
23181
22560
|
borderRadius: 12,
|
|
23182
22561
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -23184,9 +22563,9 @@ function VideoToolbar({
|
|
|
23184
22563
|
opacity: pending ? 0.6 : 1
|
|
23185
22564
|
},
|
|
23186
22565
|
children: [
|
|
23187
|
-
/* @__PURE__ */
|
|
23188
|
-
/* @__PURE__ */
|
|
23189
|
-
error && /* @__PURE__ */
|
|
22566
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
22567
|
+
/* @__PURE__ */ jsx23(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
22568
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
23190
22569
|
]
|
|
23191
22570
|
}
|
|
23192
22571
|
);
|
|
@@ -23306,8 +22685,8 @@ function AiVideoOverlay({
|
|
|
23306
22685
|
const activeBlockRect = useLiveBlockRect(active);
|
|
23307
22686
|
const TOOLBAR_APPROX_H = 90;
|
|
23308
22687
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
23309
|
-
return /* @__PURE__ */
|
|
23310
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
22688
|
+
return /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
22689
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
23311
22690
|
"button",
|
|
23312
22691
|
{
|
|
23313
22692
|
type: "button",
|
|
@@ -23335,15 +22714,15 @@ function AiVideoOverlay({
|
|
|
23335
22714
|
fontSize: 14,
|
|
23336
22715
|
fontWeight: 700
|
|
23337
22716
|
},
|
|
23338
|
-
children: /* @__PURE__ */
|
|
22717
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
23339
22718
|
}
|
|
23340
22719
|
),
|
|
23341
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
22720
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
23342
22721
|
ItemInteractionLayer,
|
|
23343
22722
|
{
|
|
23344
22723
|
rect: activeBlockRect,
|
|
23345
22724
|
state: toolbarState,
|
|
23346
|
-
toolbar: /* @__PURE__ */
|
|
22725
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
23347
22726
|
VideoToolbar,
|
|
23348
22727
|
{
|
|
23349
22728
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -23418,10 +22797,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
23418
22797
|
}
|
|
23419
22798
|
|
|
23420
22799
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
23421
|
-
import { Fragment as
|
|
22800
|
+
import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
23422
22801
|
var PRIMARY6 = "#0885FE";
|
|
23423
|
-
var
|
|
23424
|
-
var
|
|
22802
|
+
var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
22803
|
+
var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
23425
22804
|
function findCarouselItemElement(sectionId, index) {
|
|
23426
22805
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
23427
22806
|
if (!sectionEl2) return null;
|
|
@@ -23500,8 +22879,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
23500
22879
|
postToParent2({ type: "ow:asset-pick", id });
|
|
23501
22880
|
});
|
|
23502
22881
|
}
|
|
23503
|
-
function
|
|
23504
|
-
return /* @__PURE__ */
|
|
22882
|
+
function Pill3({ label, onClick, disabled }) {
|
|
22883
|
+
return /* @__PURE__ */ jsx24(
|
|
23505
22884
|
"button",
|
|
23506
22885
|
{
|
|
23507
22886
|
type: "button",
|
|
@@ -23517,7 +22896,7 @@ function Pill2({ label, onClick, disabled }) {
|
|
|
23517
22896
|
border: "none",
|
|
23518
22897
|
cursor: disabled ? "default" : "pointer",
|
|
23519
22898
|
background: "#ffffff",
|
|
23520
|
-
color:
|
|
22899
|
+
color: OHW_BLUE_DARK3,
|
|
23521
22900
|
opacity: disabled ? 0.4 : 1,
|
|
23522
22901
|
fontSize: 12,
|
|
23523
22902
|
lineHeight: "16px",
|
|
@@ -23535,7 +22914,7 @@ function TogglePill({
|
|
|
23535
22914
|
onToggle,
|
|
23536
22915
|
disabled
|
|
23537
22916
|
}) {
|
|
23538
|
-
return /* @__PURE__ */
|
|
22917
|
+
return /* @__PURE__ */ jsxs15(
|
|
23539
22918
|
"button",
|
|
23540
22919
|
{
|
|
23541
22920
|
type: "button",
|
|
@@ -23554,7 +22933,7 @@ function TogglePill({
|
|
|
23554
22933
|
border: "none",
|
|
23555
22934
|
cursor: disabled ? "default" : "pointer",
|
|
23556
22935
|
background: "#ffffff",
|
|
23557
|
-
color:
|
|
22936
|
+
color: OHW_BLUE_DARK3,
|
|
23558
22937
|
opacity: disabled ? 0.4 : 1,
|
|
23559
22938
|
fontSize: 12,
|
|
23560
22939
|
lineHeight: "16px",
|
|
@@ -23564,7 +22943,7 @@ function TogglePill({
|
|
|
23564
22943
|
},
|
|
23565
22944
|
children: [
|
|
23566
22945
|
label,
|
|
23567
|
-
/* @__PURE__ */
|
|
22946
|
+
/* @__PURE__ */ jsx24(
|
|
23568
22947
|
"span",
|
|
23569
22948
|
{
|
|
23570
22949
|
"aria-hidden": true,
|
|
@@ -23577,10 +22956,10 @@ function TogglePill({
|
|
|
23577
22956
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
23578
22957
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
23579
22958
|
// "disabled control" rather than "switch that is off".
|
|
23580
|
-
background: on ?
|
|
22959
|
+
background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
|
|
23581
22960
|
transition: "background 120ms ease"
|
|
23582
22961
|
},
|
|
23583
|
-
children: /* @__PURE__ */
|
|
22962
|
+
children: /* @__PURE__ */ jsx24(
|
|
23584
22963
|
"span",
|
|
23585
22964
|
{
|
|
23586
22965
|
style: {
|
|
@@ -23609,7 +22988,7 @@ function CarouselSlideToolbar({
|
|
|
23609
22988
|
onChangeImage,
|
|
23610
22989
|
onToggleAutoplay
|
|
23611
22990
|
}) {
|
|
23612
|
-
return /* @__PURE__ */
|
|
22991
|
+
return /* @__PURE__ */ jsxs15(
|
|
23613
22992
|
"div",
|
|
23614
22993
|
{
|
|
23615
22994
|
"data-ohw-bridge": "",
|
|
@@ -23620,7 +22999,7 @@ function CarouselSlideToolbar({
|
|
|
23620
22999
|
flexDirection: "column",
|
|
23621
23000
|
gap: 6,
|
|
23622
23001
|
alignItems: "center",
|
|
23623
|
-
background:
|
|
23002
|
+
background: OHW_BLUE3,
|
|
23624
23003
|
padding: 8,
|
|
23625
23004
|
borderRadius: 12,
|
|
23626
23005
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -23632,11 +23011,11 @@ function CarouselSlideToolbar({
|
|
|
23632
23011
|
pointerEvents: pending ? "none" : "auto"
|
|
23633
23012
|
},
|
|
23634
23013
|
children: [
|
|
23635
|
-
/* @__PURE__ */
|
|
23636
|
-
/* @__PURE__ */
|
|
23637
|
-
/* @__PURE__ */
|
|
23014
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
23015
|
+
/* @__PURE__ */ jsx24(Pill3, { label: "Change Image", onClick: onChangeImage }),
|
|
23016
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
23638
23017
|
] }),
|
|
23639
|
-
error && /* @__PURE__ */
|
|
23018
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
23640
23019
|
]
|
|
23641
23020
|
}
|
|
23642
23021
|
);
|
|
@@ -23776,8 +23155,8 @@ function AiFadeCarouselOverlay({
|
|
|
23776
23155
|
const activeItemRect = useLiveItemRect2(active);
|
|
23777
23156
|
const TOOLBAR_APPROX_H = 90;
|
|
23778
23157
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
23779
|
-
return /* @__PURE__ */
|
|
23780
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
23158
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
23159
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
23781
23160
|
"button",
|
|
23782
23161
|
{
|
|
23783
23162
|
type: "button",
|
|
@@ -23806,10 +23185,10 @@ function AiFadeCarouselOverlay({
|
|
|
23806
23185
|
fontSize: 14,
|
|
23807
23186
|
fontWeight: 700
|
|
23808
23187
|
},
|
|
23809
|
-
children: /* @__PURE__ */
|
|
23188
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
23810
23189
|
}
|
|
23811
23190
|
),
|
|
23812
|
-
swapping && /* @__PURE__ */
|
|
23191
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
23813
23192
|
"div",
|
|
23814
23193
|
{
|
|
23815
23194
|
ref: skeletonRef,
|
|
@@ -23827,15 +23206,15 @@ function AiFadeCarouselOverlay({
|
|
|
23827
23206
|
zIndex: 2147483646,
|
|
23828
23207
|
pointerEvents: "none"
|
|
23829
23208
|
},
|
|
23830
|
-
children: /* @__PURE__ */
|
|
23209
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
23831
23210
|
}
|
|
23832
23211
|
),
|
|
23833
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
23212
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
23834
23213
|
ItemInteractionLayer,
|
|
23835
23214
|
{
|
|
23836
23215
|
rect: activeItemRect,
|
|
23837
23216
|
state: toolbarState,
|
|
23838
|
-
toolbar: /* @__PURE__ */
|
|
23217
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
23839
23218
|
CarouselSlideToolbar,
|
|
23840
23219
|
{
|
|
23841
23220
|
pending,
|
|
@@ -24073,11 +23452,118 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
24073
23452
|
// src/ui/link-modal/LinkPopover.tsx
|
|
24074
23453
|
import { useEffect as useEffect17 } from "react";
|
|
24075
23454
|
|
|
23455
|
+
// src/ui/dialog.tsx
|
|
23456
|
+
import * as React10 from "react";
|
|
23457
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
23458
|
+
import { X as X2 } from "lucide-react";
|
|
23459
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
23460
|
+
function Dialog2({
|
|
23461
|
+
...props
|
|
23462
|
+
}) {
|
|
23463
|
+
return /* @__PURE__ */ jsx25(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
23464
|
+
}
|
|
23465
|
+
function DialogPortal({
|
|
23466
|
+
...props
|
|
23467
|
+
}) {
|
|
23468
|
+
return /* @__PURE__ */ jsx25(DialogPrimitive.Portal, { ...props });
|
|
23469
|
+
}
|
|
23470
|
+
function DialogOverlay({
|
|
23471
|
+
className,
|
|
23472
|
+
...props
|
|
23473
|
+
}) {
|
|
23474
|
+
return /* @__PURE__ */ jsx25(
|
|
23475
|
+
DialogPrimitive.Overlay,
|
|
23476
|
+
{
|
|
23477
|
+
"data-slot": "dialog-overlay",
|
|
23478
|
+
"data-ohw-link-modal-root": "",
|
|
23479
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
23480
|
+
...props
|
|
23481
|
+
}
|
|
23482
|
+
);
|
|
23483
|
+
}
|
|
23484
|
+
var DialogContent = React10.forwardRef(
|
|
23485
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
23486
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
23487
|
+
return /* @__PURE__ */ jsxs16(DialogPortal, { container: container ?? void 0, children: [
|
|
23488
|
+
/* @__PURE__ */ jsx25(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
23489
|
+
/* @__PURE__ */ jsxs16(
|
|
23490
|
+
DialogPrimitive.Content,
|
|
23491
|
+
{
|
|
23492
|
+
ref,
|
|
23493
|
+
"data-slot": "dialog-content",
|
|
23494
|
+
className: cn(
|
|
23495
|
+
positionMode,
|
|
23496
|
+
"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",
|
|
23497
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
23498
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
23499
|
+
className
|
|
23500
|
+
),
|
|
23501
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
23502
|
+
...props,
|
|
23503
|
+
children: [
|
|
23504
|
+
children,
|
|
23505
|
+
showCloseButton ? /* @__PURE__ */ jsx25(
|
|
23506
|
+
DialogPrimitive.Close,
|
|
23507
|
+
{
|
|
23508
|
+
type: "button",
|
|
23509
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
23510
|
+
"aria-label": "Close",
|
|
23511
|
+
children: /* @__PURE__ */ jsx25(X2, { size: 16, "aria-hidden": true })
|
|
23512
|
+
}
|
|
23513
|
+
) : null
|
|
23514
|
+
]
|
|
23515
|
+
}
|
|
23516
|
+
)
|
|
23517
|
+
] });
|
|
23518
|
+
}
|
|
23519
|
+
);
|
|
23520
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
23521
|
+
function DialogHeader({
|
|
23522
|
+
className,
|
|
23523
|
+
...props
|
|
23524
|
+
}) {
|
|
23525
|
+
return /* @__PURE__ */ jsx25("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
23526
|
+
}
|
|
23527
|
+
function DialogFooter({
|
|
23528
|
+
className,
|
|
23529
|
+
...props
|
|
23530
|
+
}) {
|
|
23531
|
+
return /* @__PURE__ */ jsx25(
|
|
23532
|
+
"div",
|
|
23533
|
+
{
|
|
23534
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
23535
|
+
...props
|
|
23536
|
+
}
|
|
23537
|
+
);
|
|
23538
|
+
}
|
|
23539
|
+
var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
23540
|
+
DialogPrimitive.Title,
|
|
23541
|
+
{
|
|
23542
|
+
ref,
|
|
23543
|
+
className: cn(
|
|
23544
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
23545
|
+
className
|
|
23546
|
+
),
|
|
23547
|
+
...props
|
|
23548
|
+
}
|
|
23549
|
+
));
|
|
23550
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
23551
|
+
var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
23552
|
+
DialogPrimitive.Description,
|
|
23553
|
+
{
|
|
23554
|
+
ref,
|
|
23555
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
23556
|
+
...props
|
|
23557
|
+
}
|
|
23558
|
+
));
|
|
23559
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
23560
|
+
var DialogClose = DialogPrimitive.Close;
|
|
23561
|
+
|
|
24076
23562
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
24077
23563
|
import { Info, X as X4 } from "lucide-react";
|
|
24078
23564
|
|
|
24079
23565
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
24080
|
-
import { ArrowRight as
|
|
23566
|
+
import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
|
|
24081
23567
|
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
24082
23568
|
function DestinationBreadcrumb({
|
|
24083
23569
|
pageTitle,
|
|
@@ -24091,7 +23577,7 @@ function DestinationBreadcrumb({
|
|
|
24091
23577
|
/* @__PURE__ */ jsx26("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
24092
23578
|
] }),
|
|
24093
23579
|
/* @__PURE__ */ jsx26(
|
|
24094
|
-
|
|
23580
|
+
ArrowRight2,
|
|
24095
23581
|
{
|
|
24096
23582
|
size: 16,
|
|
24097
23583
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -24203,7 +23689,7 @@ function Label({ className, ...props }) {
|
|
|
24203
23689
|
}
|
|
24204
23690
|
|
|
24205
23691
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
24206
|
-
import { ChevronDown as
|
|
23692
|
+
import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
|
|
24207
23693
|
import { jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
24208
23694
|
function FieldChevron({
|
|
24209
23695
|
onClick
|
|
@@ -24216,7 +23702,7 @@ function FieldChevron({
|
|
|
24216
23702
|
onClick,
|
|
24217
23703
|
"aria-label": "Open page list",
|
|
24218
23704
|
tabIndex: -1,
|
|
24219
|
-
children: /* @__PURE__ */ jsx30(
|
|
23705
|
+
children: /* @__PURE__ */ jsx30(ChevronDown4, { size: 16 })
|
|
24220
23706
|
}
|
|
24221
23707
|
);
|
|
24222
23708
|
}
|
|
@@ -24355,10 +23841,10 @@ function UrlOrPageInput({
|
|
|
24355
23841
|
}
|
|
24356
23842
|
|
|
24357
23843
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
24358
|
-
import { Fragment as
|
|
23844
|
+
import { Fragment as Fragment11, jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
24359
23845
|
function LinkEditorPanel({ state, onClose }) {
|
|
24360
23846
|
const isCancel = state.secondaryLabel === "Cancel" || state.secondaryLabel === "Back to sections";
|
|
24361
|
-
return /* @__PURE__ */ jsxs20(
|
|
23847
|
+
return /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
24362
23848
|
/* @__PURE__ */ jsx31(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx31(
|
|
24363
23849
|
"button",
|
|
24364
23850
|
{
|
|
@@ -24446,7 +23932,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
24446
23932
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
24447
23933
|
import { useCallback as useCallback7, useEffect as useEffect15, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
24448
23934
|
import { createPortal as createPortal2 } from "react-dom";
|
|
24449
|
-
import { ArrowLeft as
|
|
23935
|
+
import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
|
|
24450
23936
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
24451
23937
|
|
|
24452
23938
|
// src/lib/parent-scroll.ts
|
|
@@ -24723,7 +24209,7 @@ function SectionPickerOverlay({
|
|
|
24723
24209
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
24724
24210
|
onClick: onBack,
|
|
24725
24211
|
children: [
|
|
24726
|
-
/* @__PURE__ */ jsx32(
|
|
24212
|
+
/* @__PURE__ */ jsx32(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
24727
24213
|
"Back"
|
|
24728
24214
|
]
|
|
24729
24215
|
}
|
|
@@ -24792,7 +24278,7 @@ function SectionPickerOverlay({
|
|
|
24792
24278
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
24793
24279
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
24794
24280
|
"aria-hidden": true,
|
|
24795
|
-
children: /* @__PURE__ */ jsx32(
|
|
24281
|
+
children: /* @__PURE__ */ jsx32(Check3, { className: "size-5" })
|
|
24796
24282
|
}
|
|
24797
24283
|
) : null
|
|
24798
24284
|
]
|
|
@@ -24972,7 +24458,7 @@ function useLinkModalState({
|
|
|
24972
24458
|
}
|
|
24973
24459
|
|
|
24974
24460
|
// src/ui/link-modal/LinkPopover.tsx
|
|
24975
|
-
import { Fragment as
|
|
24461
|
+
import { Fragment as Fragment12, jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
24976
24462
|
function postToParent(data) {
|
|
24977
24463
|
window.parent?.postMessage(data, "*");
|
|
24978
24464
|
}
|
|
@@ -25068,7 +24554,7 @@ function LinkPopover({
|
|
|
25068
24554
|
);
|
|
25069
24555
|
};
|
|
25070
24556
|
}, [open, sectionPickerActive]);
|
|
25071
|
-
return /* @__PURE__ */ jsxs22(
|
|
24557
|
+
return /* @__PURE__ */ jsxs22(Fragment12, { children: [
|
|
25072
24558
|
/* @__PURE__ */ jsx33(
|
|
25073
24559
|
Dialog2,
|
|
25074
24560
|
{
|
|
@@ -25176,7 +24662,6 @@ function shouldUseDevFixtures() {
|
|
|
25176
24662
|
function getLogoElement(el) {
|
|
25177
24663
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
25178
24664
|
if (marked) return marked;
|
|
25179
|
-
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
25180
24665
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
25181
24666
|
if (!root) return null;
|
|
25182
24667
|
const anchor = el.closest("a");
|
|
@@ -25246,7 +24731,7 @@ function addFooterColumnWithPersist({
|
|
|
25246
24731
|
import {
|
|
25247
24732
|
useCallback as useCallback9,
|
|
25248
24733
|
useEffect as useEffect18,
|
|
25249
|
-
useLayoutEffect as
|
|
24734
|
+
useLayoutEffect as useLayoutEffect5,
|
|
25250
24735
|
useRef as useRef11,
|
|
25251
24736
|
useState as useState15
|
|
25252
24737
|
} from "react";
|
|
@@ -25343,7 +24828,7 @@ function FloatingPanel({
|
|
|
25343
24828
|
return () => window.removeEventListener("message", onParentScroll);
|
|
25344
24829
|
}, [open]);
|
|
25345
24830
|
const positionRef = useRef11(position);
|
|
25346
|
-
|
|
24831
|
+
useLayoutEffect5(() => {
|
|
25347
24832
|
if (!open) {
|
|
25348
24833
|
positionRef.current = position;
|
|
25349
24834
|
return;
|
|
@@ -25353,7 +24838,7 @@ function FloatingPanel({
|
|
|
25353
24838
|
}
|
|
25354
24839
|
positionRef.current = position;
|
|
25355
24840
|
}, [open, position, liveScroll, parentScroll]);
|
|
25356
|
-
|
|
24841
|
+
useLayoutEffect5(() => {
|
|
25357
24842
|
if (!open || !panelRef.current) return;
|
|
25358
24843
|
const el = panelRef.current;
|
|
25359
24844
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -25562,7 +25047,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
25562
25047
|
}
|
|
25563
25048
|
|
|
25564
25049
|
// src/ui/button-style-panel.tsx
|
|
25565
|
-
import { Check as
|
|
25050
|
+
import { Check as Check4 } from "lucide-react";
|
|
25566
25051
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
25567
25052
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
25568
25053
|
function ButtonStylePanel({
|
|
@@ -25633,7 +25118,7 @@ function ButtonStylePanel({
|
|
|
25633
25118
|
{
|
|
25634
25119
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
25635
25120
|
"aria-hidden": true,
|
|
25636
|
-
children: /* @__PURE__ */ jsx36(
|
|
25121
|
+
children: /* @__PURE__ */ jsx36(Check4, { className: "size-3", strokeWidth: 3 })
|
|
25637
25122
|
}
|
|
25638
25123
|
) : null
|
|
25639
25124
|
]
|
|
@@ -26665,7 +26150,7 @@ function useSectionDrag({
|
|
|
26665
26150
|
}
|
|
26666
26151
|
|
|
26667
26152
|
// src/ui/footer-container-chrome.tsx
|
|
26668
|
-
import { Plus as
|
|
26153
|
+
import { Plus as Plus3 } from "lucide-react";
|
|
26669
26154
|
import { jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
26670
26155
|
function FooterContainerChrome({
|
|
26671
26156
|
rect,
|
|
@@ -26706,7 +26191,7 @@ function FooterContainerChrome({
|
|
|
26706
26191
|
if (addDisabled) return;
|
|
26707
26192
|
onAdd();
|
|
26708
26193
|
},
|
|
26709
|
-
children: /* @__PURE__ */ jsx37(
|
|
26194
|
+
children: /* @__PURE__ */ jsx37(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
26710
26195
|
}
|
|
26711
26196
|
) }),
|
|
26712
26197
|
/* @__PURE__ */ jsx37(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -27113,7 +26598,7 @@ function retargetPageLinks(change, deps) {
|
|
|
27113
26598
|
}
|
|
27114
26599
|
|
|
27115
26600
|
// src/ui/navbar-container-chrome.tsx
|
|
27116
|
-
import { Plus as
|
|
26601
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
27117
26602
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
27118
26603
|
function NavbarContainerChrome({
|
|
27119
26604
|
rect,
|
|
@@ -27149,7 +26634,7 @@ function NavbarContainerChrome({
|
|
|
27149
26634
|
e.stopPropagation();
|
|
27150
26635
|
onAdd();
|
|
27151
26636
|
},
|
|
27152
|
-
children: /* @__PURE__ */ jsx38(
|
|
26637
|
+
children: /* @__PURE__ */ jsx38(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
27153
26638
|
}
|
|
27154
26639
|
)
|
|
27155
26640
|
}
|
|
@@ -27221,8 +26706,8 @@ function Badge({ className, variant, ...props }) {
|
|
|
27221
26706
|
}
|
|
27222
26707
|
|
|
27223
26708
|
// src/OhhwellsBridge.tsx
|
|
27224
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
27225
|
-
import { Fragment as
|
|
26709
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings, Trash2 as Trash24 } from "lucide-react";
|
|
26710
|
+
import { Fragment as Fragment13, jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
27226
26711
|
var PRIMARY7 = "#0885FE";
|
|
27227
26712
|
var IMAGE_FADE_MS = 300;
|
|
27228
26713
|
var MEDIA_SETTLE_TIMEOUT_MS = 2500;
|
|
@@ -27633,7 +27118,7 @@ function isIconEditable(el) {
|
|
|
27633
27118
|
return el.dataset.ohwEditable === "icon";
|
|
27634
27119
|
}
|
|
27635
27120
|
var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [data-ohw-editable="video"]';
|
|
27636
|
-
var EDITOR_CHROME_SELECTOR = '[data-ohw-toolbar], [data-ohw-form-toolbar], [data-ohw-field-toolbar], [data-ohw-
|
|
27121
|
+
var EDITOR_CHROME_SELECTOR = '[data-ohw-toolbar], [data-ohw-form-toolbar], [data-ohw-field-toolbar], [data-ohw-item-toolbar], [data-ohw-more-menu], [data-ohw-state-toggle], [data-ohw-max-badge], [data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-item"]';
|
|
27637
27122
|
function isOverEditorChrome(x, y) {
|
|
27638
27123
|
return document.elementsFromPoint(x, y).some((el) => el instanceof HTMLElement && el.matches(EDITOR_CHROME_SELECTOR));
|
|
27639
27124
|
}
|
|
@@ -27999,7 +27484,7 @@ function getNavigationSelectionParent(el) {
|
|
|
27999
27484
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
28000
27485
|
return resolveFooterLinksContainerFrom(el);
|
|
28001
27486
|
}
|
|
28002
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") ||
|
|
27487
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
28003
27488
|
return getNavigationRoot(el);
|
|
28004
27489
|
}
|
|
28005
27490
|
return null;
|
|
@@ -28221,6 +27706,7 @@ var ICONS = {
|
|
|
28221
27706
|
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"/>',
|
|
28222
27707
|
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"/>'
|
|
28223
27708
|
};
|
|
27709
|
+
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
28224
27710
|
var SELECTION_CHROME_GAP2 = 4;
|
|
28225
27711
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
28226
27712
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -28318,7 +27804,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
28318
27804
|
el.style.top = `${top}px`;
|
|
28319
27805
|
el.style.height = `${height}px`;
|
|
28320
27806
|
}
|
|
28321
|
-
var
|
|
27807
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
28322
27808
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
28323
27809
|
const isAbove = transform.includes("translateY(-100%)");
|
|
28324
27810
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -28345,8 +27831,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
28345
27831
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
28346
27832
|
const half = toolbarWidth / 2;
|
|
28347
27833
|
return Math.max(
|
|
28348
|
-
|
|
28349
|
-
Math.min(centerX, window.innerWidth -
|
|
27834
|
+
TOOLBAR_EDGE_MARGIN3 + half,
|
|
27835
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
|
|
28350
27836
|
);
|
|
28351
27837
|
}
|
|
28352
27838
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -28564,7 +28050,7 @@ function FloatingToolbar({
|
|
|
28564
28050
|
children: /* @__PURE__ */ jsx41(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
28565
28051
|
}
|
|
28566
28052
|
) : null,
|
|
28567
|
-
showDelete ? /* @__PURE__ */ jsxs27(
|
|
28053
|
+
showDelete ? /* @__PURE__ */ jsxs27(Fragment13, { children: [
|
|
28568
28054
|
/* @__PURE__ */ jsx41(CustomToolbarDivider, {}),
|
|
28569
28055
|
/* @__PURE__ */ jsx41(
|
|
28570
28056
|
CustomToolbarButton,
|
|
@@ -28771,7 +28257,7 @@ function OhhwellsBridge() {
|
|
|
28771
28257
|
}, []);
|
|
28772
28258
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
28773
28259
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
28774
|
-
|
|
28260
|
+
useLayoutEffect6(() => {
|
|
28775
28261
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
28776
28262
|
if (next !== subdomain) setSubdomain(next);
|
|
28777
28263
|
if (next) return;
|
|
@@ -29021,14 +28507,10 @@ function OhhwellsBridge() {
|
|
|
29021
28507
|
const [fieldPickRect, setFieldPickRect] = useState18(null);
|
|
29022
28508
|
const fieldPickElRef = useRef14(null);
|
|
29023
28509
|
const [fieldPickState, setFieldPickState] = useState18(null);
|
|
29024
|
-
const [dropdownOptionPick, setDropdownOptionPick] = useState18(null);
|
|
29025
28510
|
const [fieldTypePickerOpen, setFieldTypePickerOpen] = useState18(false);
|
|
29026
28511
|
const clearFormPick = useCallback12(() => {
|
|
29027
28512
|
const form = formPickElRef.current;
|
|
29028
28513
|
const editing = fieldPickElRef.current;
|
|
29029
|
-
if (editing && fieldTypeOf(editing) === "dropdown") {
|
|
29030
|
-
setDropdownPreviewOpen(editing, false);
|
|
29031
|
-
}
|
|
29032
28514
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
29033
28515
|
const owner = editing.closest('[data-ohw-editable="form"]');
|
|
29034
28516
|
if (owner) persistFieldsRef.current(owner);
|
|
@@ -29040,7 +28522,6 @@ function OhhwellsBridge() {
|
|
|
29040
28522
|
setFormViewStateUi("default");
|
|
29041
28523
|
setFormPickCount(null);
|
|
29042
28524
|
setFieldTypePickerOpen(false);
|
|
29043
|
-
setDropdownOptionPick(null);
|
|
29044
28525
|
fieldPickElRef.current = null;
|
|
29045
28526
|
setFieldPickRect(null);
|
|
29046
28527
|
setFieldPickState(null);
|
|
@@ -29049,14 +28530,10 @@ function OhhwellsBridge() {
|
|
|
29049
28530
|
}, []);
|
|
29050
28531
|
const clearFieldPick = useCallback12(() => {
|
|
29051
28532
|
const wrapper = fieldPickElRef.current;
|
|
29052
|
-
if (wrapper && fieldTypeOf(wrapper) === "dropdown") {
|
|
29053
|
-
setDropdownPreviewOpen(wrapper, false);
|
|
29054
|
-
}
|
|
29055
28533
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
29056
28534
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
29057
28535
|
if (form) persistFieldsRef.current(form);
|
|
29058
28536
|
}
|
|
29059
|
-
setDropdownOptionPick(null);
|
|
29060
28537
|
fieldPickElRef.current = null;
|
|
29061
28538
|
setFieldPickRect(null);
|
|
29062
28539
|
setFieldPickState(null);
|
|
@@ -29074,50 +28551,17 @@ function OhhwellsBridge() {
|
|
|
29074
28551
|
[]
|
|
29075
28552
|
);
|
|
29076
28553
|
persistFieldsRef.current = persistFields;
|
|
29077
|
-
const refreshDropdownOptionPick = useCallback12((wrapper, index) => {
|
|
29078
|
-
if (index == null || fieldTypeOf(wrapper) !== "dropdown") {
|
|
29079
|
-
clearDropdownOptionSelection(wrapper);
|
|
29080
|
-
setDropdownOptionPick(null);
|
|
29081
|
-
return;
|
|
29082
|
-
}
|
|
29083
|
-
selectDropdownOption(wrapper, index);
|
|
29084
|
-
const row = listDropdownOptionRows(wrapper)[index];
|
|
29085
|
-
if (!row) {
|
|
29086
|
-
setDropdownOptionPick(null);
|
|
29087
|
-
return;
|
|
29088
|
-
}
|
|
29089
|
-
setDropdownOptionPick({
|
|
29090
|
-
index,
|
|
29091
|
-
rect: row.getBoundingClientRect(),
|
|
29092
|
-
canDelete: listDropdownOptionRows(wrapper).length > 1
|
|
29093
|
-
});
|
|
29094
|
-
setFieldPickRect(null);
|
|
29095
|
-
}, []);
|
|
29096
28554
|
const selectField = useCallback12((wrapper) => {
|
|
29097
28555
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
29098
|
-
|
|
29099
|
-
if (fieldTypeOf(prev) === "dropdown") setDropdownPreviewOpen(prev, false);
|
|
29100
|
-
commitPlaceholderEdit(prev);
|
|
28556
|
+
commitPlaceholderEdit(fieldPickElRef.current);
|
|
29101
28557
|
}
|
|
29102
28558
|
syncRequiredMark(wrapper);
|
|
29103
|
-
|
|
29104
|
-
if (type === "dropdown") {
|
|
29105
|
-
syncDropdownPanel(wrapper);
|
|
29106
|
-
if (!isDropdownPreviewOpen(wrapper)) setDropdownPreviewOpen(wrapper, false);
|
|
29107
|
-
} else {
|
|
29108
|
-
beginPlaceholderEdit(wrapper);
|
|
29109
|
-
}
|
|
28559
|
+
beginPlaceholderEdit(wrapper);
|
|
29110
28560
|
formHoverElRef.current = null;
|
|
29111
28561
|
setFormHoverRect(null);
|
|
29112
|
-
setDropdownOptionPick(null);
|
|
29113
|
-
clearDropdownOptionSelection(wrapper);
|
|
29114
28562
|
fieldPickElRef.current = wrapper;
|
|
29115
28563
|
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
29116
|
-
setFieldPickState({
|
|
29117
|
-
type,
|
|
29118
|
-
required: isFieldRequired(wrapper),
|
|
29119
|
-
dropdownOpen: type === "dropdown" ? isDropdownPreviewOpen(wrapper) : null
|
|
29120
|
-
});
|
|
28564
|
+
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
29121
28565
|
setFieldTypePickerOpen(false);
|
|
29122
28566
|
}, []);
|
|
29123
28567
|
const withSelectedField = useCallback12(
|
|
@@ -29147,31 +28591,6 @@ function OhhwellsBridge() {
|
|
|
29147
28591
|
}),
|
|
29148
28592
|
[selectField, withSelectedField]
|
|
29149
28593
|
);
|
|
29150
|
-
const handleFieldDropdownOpenChange = useCallback12((open) => {
|
|
29151
|
-
const wrapper = fieldPickElRef.current;
|
|
29152
|
-
if (!wrapper || fieldTypeOf(wrapper) !== "dropdown") return;
|
|
29153
|
-
if (!open) {
|
|
29154
|
-
commitDropdownOptionsFromPanel(wrapper, true);
|
|
29155
|
-
const form = formPickElRef.current;
|
|
29156
|
-
if (form) persistFieldsRef.current(form);
|
|
29157
|
-
}
|
|
29158
|
-
setDropdownPreviewOpen(wrapper, open);
|
|
29159
|
-
setDropdownOptionPick(null);
|
|
29160
|
-
clearDropdownOptionSelection(wrapper);
|
|
29161
|
-
suppressNextClickRef.current = true;
|
|
29162
|
-
suppressClickUntilRef.current = Date.now() + 400;
|
|
29163
|
-
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
29164
|
-
setFieldPickState({
|
|
29165
|
-
type: "dropdown",
|
|
29166
|
-
required: isFieldRequired(wrapper),
|
|
29167
|
-
dropdownOpen: open
|
|
29168
|
-
});
|
|
29169
|
-
requestAnimationFrame(() => {
|
|
29170
|
-
if (fieldPickElRef.current === wrapper) {
|
|
29171
|
-
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
29172
|
-
}
|
|
29173
|
-
});
|
|
29174
|
-
}, []);
|
|
29175
28594
|
const handleFieldDuplicate = useCallback12(
|
|
29176
28595
|
() => withSelectedField((form, wrapper) => {
|
|
29177
28596
|
const copy = duplicateField(form, wrapper);
|
|
@@ -29187,28 +28606,6 @@ function OhhwellsBridge() {
|
|
|
29187
28606
|
}),
|
|
29188
28607
|
[clearFieldPick, withSelectedField]
|
|
29189
28608
|
);
|
|
29190
|
-
const handleDropdownOptionDuplicate = useCallback12(() => {
|
|
29191
|
-
const wrapper = fieldPickElRef.current;
|
|
29192
|
-
const form = formPickElRef.current;
|
|
29193
|
-
if (!wrapper || !form || !dropdownOptionPick) return;
|
|
29194
|
-
suppressNextClickRef.current = true;
|
|
29195
|
-
suppressClickUntilRef.current = Date.now() + 400;
|
|
29196
|
-
const nextIndex = duplicateDropdownOption(wrapper, dropdownOptionPick.index);
|
|
29197
|
-
persistFields(form);
|
|
29198
|
-
setDropdownPreviewOpen(wrapper, true);
|
|
29199
|
-
requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
|
|
29200
|
-
}, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
|
|
29201
|
-
const handleDropdownOptionDelete = useCallback12(() => {
|
|
29202
|
-
const wrapper = fieldPickElRef.current;
|
|
29203
|
-
const form = formPickElRef.current;
|
|
29204
|
-
if (!wrapper || !form || !dropdownOptionPick || !dropdownOptionPick.canDelete) return;
|
|
29205
|
-
suppressNextClickRef.current = true;
|
|
29206
|
-
suppressClickUntilRef.current = Date.now() + 400;
|
|
29207
|
-
const nextIndex = removeDropdownOption(wrapper, dropdownOptionPick.index);
|
|
29208
|
-
persistFields(form);
|
|
29209
|
-
setDropdownPreviewOpen(wrapper, true);
|
|
29210
|
-
requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
|
|
29211
|
-
}, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
|
|
29212
28609
|
const handleAddField = useCallback12(
|
|
29213
28610
|
(type) => {
|
|
29214
28611
|
const form = formPickElRef.current;
|
|
@@ -29347,6 +28744,21 @@ function OhhwellsBridge() {
|
|
|
29347
28744
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
29348
28745
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
29349
28746
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
28747
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
28748
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
28749
|
+
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
28750
|
+
const floatingPanelRef = useRef14(null);
|
|
28751
|
+
floatingPanelRef.current = floatingPanel;
|
|
28752
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
28753
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
28754
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
28755
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
28756
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
28757
|
+
const buttonPointerDragRef = useRef14(null);
|
|
28758
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
28759
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
28760
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
28761
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
29350
28762
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
29351
28763
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
29352
28764
|
const footerDragRef = useRef14(null);
|
|
@@ -29373,21 +28785,6 @@ function OhhwellsBridge() {
|
|
|
29373
28785
|
const stylesRef = useRef14("");
|
|
29374
28786
|
const appliedDrawerRef = useRef14(null);
|
|
29375
28787
|
const pendingDeleteUndoRef = useRef14(null);
|
|
29376
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
29377
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
29378
|
-
const floatingPanelRef = useRef14(null);
|
|
29379
|
-
floatingPanelRef.current = floatingPanel;
|
|
29380
|
-
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
29381
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
29382
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
29383
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
29384
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
29385
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
29386
|
-
const buttonPointerDragRef = useRef14(null);
|
|
29387
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
29388
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
29389
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
29390
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
29391
28788
|
const [sitePages, setSitePages] = useState18([]);
|
|
29392
28789
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
29393
28790
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -29397,18 +28794,7 @@ function OhhwellsBridge() {
|
|
|
29397
28794
|
const linkPopoverOpenRef = useRef14(false);
|
|
29398
28795
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
29399
28796
|
setLinkPopoverRef.current = setLinkPopover;
|
|
29400
|
-
setFloatingPanelRef.current = setFloatingPanel;
|
|
29401
28797
|
linkPopoverSessionRef.current = linkPopover;
|
|
29402
|
-
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
29403
|
-
useEffect22(() => {
|
|
29404
|
-
const syncViewport = () => {
|
|
29405
|
-
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
29406
|
-
setEditorViewport((prev) => prev === next ? prev : next);
|
|
29407
|
-
};
|
|
29408
|
-
syncViewport();
|
|
29409
|
-
window.addEventListener("resize", syncViewport);
|
|
29410
|
-
return () => window.removeEventListener("resize", syncViewport);
|
|
29411
|
-
}, []);
|
|
29412
28798
|
useEffect22(() => {
|
|
29413
28799
|
setSectionOrderPersistHandler((entries) => {
|
|
29414
28800
|
const currentPath = window.location.pathname;
|
|
@@ -31124,7 +30510,7 @@ function OhhwellsBridge() {
|
|
|
31124
30510
|
isFooterFrameSelection,
|
|
31125
30511
|
postToParent2
|
|
31126
30512
|
]);
|
|
31127
|
-
|
|
30513
|
+
useLayoutEffect6(() => {
|
|
31128
30514
|
if (!subdomain || isEditMode) {
|
|
31129
30515
|
setFetchState("done");
|
|
31130
30516
|
return;
|
|
@@ -31151,7 +30537,6 @@ function OhhwellsBridge() {
|
|
|
31151
30537
|
applyAiFooterFromContent(content);
|
|
31152
30538
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31153
30539
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
31154
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31155
30540
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31156
30541
|
}
|
|
31157
30542
|
applyBrandChrome(content);
|
|
@@ -31162,12 +30547,12 @@ function OhhwellsBridge() {
|
|
|
31162
30547
|
if (key === "__ohw_sections") continue;
|
|
31163
30548
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31164
30549
|
if (key === AI_FOOTER_KEY) continue;
|
|
31165
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31166
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
31167
30550
|
if (key === BRAND_KIT_KEY) continue;
|
|
31168
30551
|
if (key === STYLE_STORE_KEY) continue;
|
|
31169
30552
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30553
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31170
30554
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30555
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
31171
30556
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31172
30557
|
continue;
|
|
31173
30558
|
}
|
|
@@ -31337,32 +30722,8 @@ function OhhwellsBridge() {
|
|
|
31337
30722
|
if (!isEditMode) return;
|
|
31338
30723
|
let saveTimer = null;
|
|
31339
30724
|
const onInput = (e) => {
|
|
31340
|
-
const
|
|
31341
|
-
if (!
|
|
31342
|
-
const optionIndex = getDropdownOptionIndex(target);
|
|
31343
|
-
if (optionIndex != null) {
|
|
31344
|
-
const wrapper2 = getFieldWrapper(target);
|
|
31345
|
-
if (!wrapper2 || wrapper2 !== fieldPickElRef.current) return;
|
|
31346
|
-
if (saveTimer) clearTimeout(saveTimer);
|
|
31347
|
-
const owner2 = wrapper2.closest('[data-ohw-editable="form"]');
|
|
31348
|
-
saveTimer = setTimeout(() => {
|
|
31349
|
-
const form = owner2 ?? formPickElRef.current;
|
|
31350
|
-
if (!form) return;
|
|
31351
|
-
commitDropdownOptionsFromPanel(wrapper2);
|
|
31352
|
-
persistFields(form);
|
|
31353
|
-
const row = listDropdownOptionRows(wrapper2)[optionIndex];
|
|
31354
|
-
if (row) {
|
|
31355
|
-
setDropdownOptionPick({
|
|
31356
|
-
index: optionIndex,
|
|
31357
|
-
rect: row.getBoundingClientRect(),
|
|
31358
|
-
canDelete: listDropdownOptionRows(wrapper2).length > 1
|
|
31359
|
-
});
|
|
31360
|
-
}
|
|
31361
|
-
}, 400);
|
|
31362
|
-
return;
|
|
31363
|
-
}
|
|
31364
|
-
const input = target;
|
|
31365
|
-
if (!("value" in input)) return;
|
|
30725
|
+
const input = e.target;
|
|
30726
|
+
if (!input || !("value" in input)) return;
|
|
31366
30727
|
const wrapper = getFieldWrapper(input);
|
|
31367
30728
|
if (!wrapper || wrapper !== fieldPickElRef.current) return;
|
|
31368
30729
|
if (saveTimer) clearTimeout(saveTimer);
|
|
@@ -31426,18 +30787,17 @@ function OhhwellsBridge() {
|
|
|
31426
30787
|
}
|
|
31427
30788
|
applyAiFooterFromContent(content);
|
|
31428
30789
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31429
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
31430
30790
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
31431
30791
|
}
|
|
31432
30792
|
for (const [key, val] of Object.entries(content)) {
|
|
31433
30793
|
if (key === "__ohw_sections") continue;
|
|
31434
30794
|
if (key === AI_SECTIONS_KEY) continue;
|
|
31435
30795
|
if (key === AI_FOOTER_KEY) continue;
|
|
31436
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31437
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
31438
30796
|
if (key === BRAND_KIT_KEY) continue;
|
|
31439
30797
|
if (key === STYLE_STORE_KEY) continue;
|
|
31440
30798
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30799
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30800
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
31441
30801
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
31442
30802
|
continue;
|
|
31443
30803
|
}
|
|
@@ -31524,7 +30884,7 @@ function OhhwellsBridge() {
|
|
|
31524
30884
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
31525
30885
|
};
|
|
31526
30886
|
}, [subdomain, isEditMode, pathname]);
|
|
31527
|
-
|
|
30887
|
+
useLayoutEffect6(() => {
|
|
31528
30888
|
const el = document.getElementById("ohw-loader");
|
|
31529
30889
|
if (!el) return;
|
|
31530
30890
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
@@ -31709,11 +31069,26 @@ function OhhwellsBridge() {
|
|
|
31709
31069
|
const t2 = setTimeout(measure, 500);
|
|
31710
31070
|
const ro = new ResizeObserver(schedule);
|
|
31711
31071
|
ro.observe(document.body);
|
|
31072
|
+
let lastWidth = window.innerWidth;
|
|
31073
|
+
let resizeTimers = [];
|
|
31074
|
+
const clearResizeTimers = () => {
|
|
31075
|
+
resizeTimers.forEach(clearTimeout);
|
|
31076
|
+
resizeTimers = [];
|
|
31077
|
+
};
|
|
31078
|
+
const handleResize = () => {
|
|
31079
|
+
if (window.innerWidth === lastWidth) return;
|
|
31080
|
+
lastWidth = window.innerWidth;
|
|
31081
|
+
clearResizeTimers();
|
|
31082
|
+
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
31083
|
+
};
|
|
31084
|
+
window.addEventListener("resize", handleResize);
|
|
31712
31085
|
return () => {
|
|
31713
31086
|
clearTimeout(t1);
|
|
31714
31087
|
clearTimeout(t2);
|
|
31715
31088
|
if (raf != null) cancelAnimationFrame(raf);
|
|
31716
31089
|
ro.disconnect();
|
|
31090
|
+
clearResizeTimers();
|
|
31091
|
+
window.removeEventListener("resize", handleResize);
|
|
31717
31092
|
};
|
|
31718
31093
|
}, [pathname, isEditMode, postToParent2]);
|
|
31719
31094
|
useEffect22(() => {
|
|
@@ -31874,7 +31249,6 @@ function OhhwellsBridge() {
|
|
|
31874
31249
|
field can be picked and hovered from anywhere inside it (OHH-642). */
|
|
31875
31250
|
[data-ohw-editable="form"] [data-ohw-form-field] input,
|
|
31876
31251
|
[data-ohw-editable="form"] [data-ohw-form-field] textarea,
|
|
31877
|
-
[data-ohw-editable="form"] [data-ohw-form-field] select,
|
|
31878
31252
|
[data-ohw-editable="form"] [data-ohw-form-field] label {
|
|
31879
31253
|
pointer-events: auto !important;
|
|
31880
31254
|
cursor: pointer !important;
|
|
@@ -31888,35 +31262,10 @@ function OhhwellsBridge() {
|
|
|
31888
31262
|
max-width: 100% !important;
|
|
31889
31263
|
}
|
|
31890
31264
|
[data-ohw-editable="form"] [data-ohw-form-field] input,
|
|
31891
|
-
[data-ohw-editable="form"] [data-ohw-form-field] textarea
|
|
31892
|
-
[data-ohw-editable="form"] [data-ohw-form-field] select {
|
|
31265
|
+
[data-ohw-editable="form"] [data-ohw-form-field] textarea {
|
|
31893
31266
|
box-sizing: border-box !important;
|
|
31894
31267
|
width: 100% !important;
|
|
31895
31268
|
}
|
|
31896
|
-
/* Dropdown field editor (OHH-919): Closed = select alone; Open = select + panel below.
|
|
31897
|
-
Caret only \u2014 keep the template's own background/border/type on the select. */
|
|
31898
|
-
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-field-type="dropdown"] select {
|
|
31899
|
-
appearance: none !important;
|
|
31900
|
-
-webkit-appearance: none !important;
|
|
31901
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
|
|
31902
|
-
background-repeat: no-repeat !important;
|
|
31903
|
-
background-position: right 12px center !important;
|
|
31904
|
-
padding-right: 36px !important;
|
|
31905
|
-
pointer-events: none !important;
|
|
31906
|
-
}
|
|
31907
|
-
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] select {
|
|
31908
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E") !important;
|
|
31909
|
-
}
|
|
31910
|
-
[data-ohw-editable="form"] [data-ohw-form-field] [data-ohw-dropdown-panel] {
|
|
31911
|
-
display: none !important;
|
|
31912
|
-
}
|
|
31913
|
-
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] [data-ohw-dropdown-panel] {
|
|
31914
|
-
display: block !important;
|
|
31915
|
-
}
|
|
31916
|
-
[data-ohw-editable="form"] [data-ohw-dropdown-option] {
|
|
31917
|
-
cursor: text !important;
|
|
31918
|
-
outline: none !important;
|
|
31919
|
-
}
|
|
31920
31269
|
/* Somewhere to click the block itself, on every side (OHH-642) \u2014 editor only. */
|
|
31921
31270
|
[data-ohw-editable="form"] {
|
|
31922
31271
|
padding: 18px !important;
|
|
@@ -31924,14 +31273,13 @@ function OhhwellsBridge() {
|
|
|
31924
31273
|
flex-wrap: wrap !important;
|
|
31925
31274
|
align-items: flex-end !important;
|
|
31926
31275
|
}
|
|
31927
|
-
/*
|
|
31928
|
-
|
|
31276
|
+
/* Generated forms are excluded: they are always a single column, so the 12rem
|
|
31277
|
+
flex BASIS \u2014 a minimum width in a horizontal row \u2014 reads as a 12rem HEIGHT
|
|
31278
|
+
there and inflates every field to the tallest one's size. */
|
|
31929
31279
|
[data-ohw-editable="form"]:not([data-ai-form]) [data-ohw-form-field] {
|
|
31930
|
-
flex: 1 1
|
|
31280
|
+
flex: 1 1 12rem !important;
|
|
31931
31281
|
min-width: min(12rem, 100%) !important;
|
|
31932
31282
|
max-width: 100% !important;
|
|
31933
|
-
height: auto !important;
|
|
31934
|
-
align-self: flex-start !important;
|
|
31935
31283
|
}
|
|
31936
31284
|
/* Placeholder text lives in the value while selected. currentColor inside color-mix
|
|
31937
31285
|
resolves to the *inherited* color, so reverse-print footers washed it out on white
|
|
@@ -32037,13 +31385,6 @@ function OhhwellsBridge() {
|
|
|
32037
31385
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
32038
31386
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
32039
31387
|
if (isInsideLinkEditor(target)) return;
|
|
32040
|
-
if (isInsideFloatingPanel(target)) return;
|
|
32041
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
32042
|
-
if (target.closest(
|
|
32043
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
32044
|
-
)) {
|
|
32045
|
-
return;
|
|
32046
|
-
}
|
|
32047
31388
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
32048
31389
|
clearMediaSelectionRef.current();
|
|
32049
31390
|
}
|
|
@@ -32067,6 +31408,8 @@ function OhhwellsBridge() {
|
|
|
32067
31408
|
return;
|
|
32068
31409
|
}
|
|
32069
31410
|
}
|
|
31411
|
+
if (isInsideFloatingPanel(target)) return;
|
|
31412
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
32070
31413
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
32071
31414
|
if (collectionItem) {
|
|
32072
31415
|
e.preventDefault();
|
|
@@ -32079,7 +31422,7 @@ function OhhwellsBridge() {
|
|
|
32079
31422
|
return;
|
|
32080
31423
|
}
|
|
32081
31424
|
if (target.closest(
|
|
32082
|
-
'[data-ohw-field-toolbar], [data-ohw-
|
|
31425
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
32083
31426
|
)) {
|
|
32084
31427
|
return;
|
|
32085
31428
|
}
|
|
@@ -32089,26 +31432,8 @@ function OhhwellsBridge() {
|
|
|
32089
31432
|
if (formEl && formKeyOf(formEl) && !onSuccessText && !isCtaButton(target)) {
|
|
32090
31433
|
const fieldEl = getFieldWrapper(target);
|
|
32091
31434
|
if (fieldEl) {
|
|
32092
|
-
const optionIndex = getDropdownOptionIndex(target);
|
|
32093
|
-
if (optionIndex != null && fieldTypeOf(fieldEl) === "dropdown" && isDropdownPreviewOpen(fieldEl)) {
|
|
32094
|
-
deactivateRef.current();
|
|
32095
|
-
deselectRef.current();
|
|
32096
|
-
formPickElRef.current = formEl;
|
|
32097
|
-
setFormPickRect(null);
|
|
32098
|
-
if (fieldPickElRef.current !== fieldEl) selectField(fieldEl);
|
|
32099
|
-
setDropdownPreviewOpen(fieldEl, true);
|
|
32100
|
-
setFieldPickState({
|
|
32101
|
-
type: "dropdown",
|
|
32102
|
-
required: isFieldRequired(fieldEl),
|
|
32103
|
-
dropdownOpen: true
|
|
32104
|
-
});
|
|
32105
|
-
refreshDropdownOptionPick(fieldEl, optionIndex);
|
|
32106
|
-
return;
|
|
32107
|
-
}
|
|
32108
31435
|
const label = target.closest("label");
|
|
32109
|
-
if (label && fieldPickElRef.current === fieldEl
|
|
32110
|
-
return;
|
|
32111
|
-
}
|
|
31436
|
+
if (label && fieldPickElRef.current === fieldEl) return;
|
|
32112
31437
|
e.preventDefault();
|
|
32113
31438
|
e.stopPropagation();
|
|
32114
31439
|
deactivateRef.current();
|
|
@@ -32116,9 +31441,7 @@ function OhhwellsBridge() {
|
|
|
32116
31441
|
formPickElRef.current = formEl;
|
|
32117
31442
|
setFormPickRect(null);
|
|
32118
31443
|
selectField(fieldEl);
|
|
32119
|
-
if (!label
|
|
32120
|
-
fieldEl.querySelector("input, textarea")?.focus();
|
|
32121
|
-
}
|
|
31444
|
+
if (!label) fieldEl.querySelector("input, textarea")?.focus();
|
|
32122
31445
|
return;
|
|
32123
31446
|
}
|
|
32124
31447
|
clearFieldPick();
|
|
@@ -32266,13 +31589,9 @@ function OhhwellsBridge() {
|
|
|
32266
31589
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
32267
31590
|
e.preventDefault();
|
|
32268
31591
|
e.stopPropagation();
|
|
31592
|
+
selectIconElementRef.current(editable);
|
|
32269
31593
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
32270
31594
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
32271
|
-
if (aiIcon) {
|
|
32272
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
32273
|
-
} else {
|
|
32274
|
-
selectIconElementRef.current(editable);
|
|
32275
|
-
}
|
|
32276
31595
|
postToParentRef.current({
|
|
32277
31596
|
type: "ow:icon-pick",
|
|
32278
31597
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -32500,9 +31819,6 @@ function OhhwellsBridge() {
|
|
|
32500
31819
|
setHoveredItemRect(null);
|
|
32501
31820
|
hoveredNavContainerRef.current = null;
|
|
32502
31821
|
setHoveredNavContainerRect(null);
|
|
32503
|
-
siblingHintElRef.current = null;
|
|
32504
|
-
setSiblingHintRect(null);
|
|
32505
|
-
setSiblingHintRects([]);
|
|
32506
31822
|
return;
|
|
32507
31823
|
}
|
|
32508
31824
|
{
|
|
@@ -32625,6 +31941,7 @@ function OhhwellsBridge() {
|
|
|
32625
31941
|
hoveredNavContainerRef.current = null;
|
|
32626
31942
|
setHoveredNavContainerRect(null);
|
|
32627
31943
|
hoveredItemElRef.current = editable;
|
|
31944
|
+
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
32628
31945
|
}
|
|
32629
31946
|
}
|
|
32630
31947
|
}
|
|
@@ -33331,11 +32648,7 @@ function OhhwellsBridge() {
|
|
|
33331
32648
|
};
|
|
33332
32649
|
const handleMouseMove = (e) => {
|
|
33333
32650
|
const { clientX, clientY } = e;
|
|
33334
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
33335
|
-
dismissImageHover();
|
|
33336
|
-
clearImageHover();
|
|
33337
|
-
return;
|
|
33338
|
-
}
|
|
32651
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
33339
32652
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
33340
32653
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
33341
32654
|
formHoverElRef.current = null;
|
|
@@ -33364,12 +32677,7 @@ function OhhwellsBridge() {
|
|
|
33364
32677
|
setHoveredItemRect(null);
|
|
33365
32678
|
hoveredNavContainerRef.current = null;
|
|
33366
32679
|
setHoveredNavContainerRect(null);
|
|
33367
|
-
siblingHintElRef.current = null;
|
|
33368
|
-
setSiblingHintRect(null);
|
|
33369
|
-
setSiblingHintRects([]);
|
|
33370
32680
|
dismissImageHover();
|
|
33371
|
-
clearImageHover();
|
|
33372
|
-
setSectionGap(null);
|
|
33373
32681
|
return;
|
|
33374
32682
|
}
|
|
33375
32683
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -33381,11 +32689,7 @@ function OhhwellsBridge() {
|
|
|
33381
32689
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
33382
32690
|
const { clientX, clientY } = e.data;
|
|
33383
32691
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
33384
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
33385
|
-
dismissImageHover();
|
|
33386
|
-
clearImageHover();
|
|
33387
|
-
return;
|
|
33388
|
-
}
|
|
32692
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) return;
|
|
33389
32693
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
33390
32694
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
33391
32695
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -33765,7 +33069,6 @@ function OhhwellsBridge() {
|
|
|
33765
33069
|
applyAiFooterFromContent(content);
|
|
33766
33070
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
33767
33071
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
33768
|
-
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
33769
33072
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
33770
33073
|
}
|
|
33771
33074
|
applyBrandChrome(content);
|
|
@@ -33780,12 +33083,12 @@ function OhhwellsBridge() {
|
|
|
33780
33083
|
}
|
|
33781
33084
|
if (key === AI_SECTIONS_KEY) continue;
|
|
33782
33085
|
if (key === AI_FOOTER_KEY) continue;
|
|
33783
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
33784
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
33785
33086
|
if (key === BRAND_KIT_KEY) continue;
|
|
33786
33087
|
if (key === STYLE_STORE_KEY) continue;
|
|
33787
33088
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
33089
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
33788
33090
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
33091
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
33789
33092
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
33790
33093
|
continue;
|
|
33791
33094
|
}
|
|
@@ -34458,12 +33761,6 @@ function OhhwellsBridge() {
|
|
|
34458
33761
|
closeLinkPopoverRef.current();
|
|
34459
33762
|
return;
|
|
34460
33763
|
}
|
|
34461
|
-
if (floatingPanelOpenRef.current) {
|
|
34462
|
-
setFloatingPanelRef.current(null);
|
|
34463
|
-
deselectRef.current();
|
|
34464
|
-
deactivateRef.current();
|
|
34465
|
-
return;
|
|
34466
|
-
}
|
|
34467
33764
|
deselectRef.current();
|
|
34468
33765
|
deactivateRef.current();
|
|
34469
33766
|
clearMediaSelectionRef.current();
|
|
@@ -35293,10 +34590,10 @@ function OhhwellsBridge() {
|
|
|
35293
34590
|
window.removeEventListener("message", handleDuplicateSection);
|
|
35294
34591
|
window.removeEventListener("message", handleDeactivate);
|
|
35295
34592
|
window.removeEventListener("message", handleSelectNav);
|
|
34593
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
35296
34594
|
window.removeEventListener("message", handleToastAction);
|
|
35297
34595
|
window.removeEventListener("message", handleFormCount);
|
|
35298
34596
|
window.removeEventListener("message", handleUiEscape);
|
|
35299
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
35300
34597
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
35301
34598
|
autoSaveTimers.current.clear();
|
|
35302
34599
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -35590,7 +34887,7 @@ function OhhwellsBridge() {
|
|
|
35590
34887
|
postToParent2({
|
|
35591
34888
|
type: "ow:ready",
|
|
35592
34889
|
version: "1",
|
|
35593
|
-
bridgeVersion: "0.1.
|
|
34890
|
+
bridgeVersion: "0.1.180",
|
|
35594
34891
|
path: pathname,
|
|
35595
34892
|
nodes: collectEditableNodes(editContentRef.current),
|
|
35596
34893
|
sections
|
|
@@ -36276,11 +35573,11 @@ function OhhwellsBridge() {
|
|
|
36276
35573
|
},
|
|
36277
35574
|
[postToParent2]
|
|
36278
35575
|
);
|
|
36279
|
-
return /* @__PURE__ */ jsxs27(
|
|
35576
|
+
return /* @__PURE__ */ jsxs27(Fragment13, { children: [
|
|
36280
35577
|
/* @__PURE__ */ jsx41(OhwLoaderSurface, {}),
|
|
36281
35578
|
subdomain && !isEditMode && showBranding && /* @__PURE__ */ jsx41(MadeWithOhhWells, {}),
|
|
36282
35579
|
bridgeRoot ? createPortal3(
|
|
36283
|
-
/* @__PURE__ */ jsxs27(
|
|
35580
|
+
/* @__PURE__ */ jsxs27(Fragment13, { children: [
|
|
36284
35581
|
/* @__PURE__ */ jsx41("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
36285
35582
|
isEditMode && /* @__PURE__ */ jsx41(
|
|
36286
35583
|
AiSectionOverlay,
|
|
@@ -36481,7 +35778,7 @@ function OhhwellsBridge() {
|
|
|
36481
35778
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
36482
35779
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
36483
35780
|
"data-ohw-add-field": "",
|
|
36484
|
-
children: /* @__PURE__ */ jsx41(
|
|
35781
|
+
children: /* @__PURE__ */ jsx41(Plus5, { size: 15, "aria-hidden": true })
|
|
36485
35782
|
}
|
|
36486
35783
|
),
|
|
36487
35784
|
/* @__PURE__ */ jsx41("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -36574,7 +35871,7 @@ function OhhwellsBridge() {
|
|
|
36574
35871
|
chromeGap: formHoverElRef.current && getFieldWrapper(formHoverElRef.current) ? 8 : 24
|
|
36575
35872
|
}
|
|
36576
35873
|
),
|
|
36577
|
-
fieldPickRect && fieldPickState && !
|
|
35874
|
+
fieldPickRect && fieldPickState && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ jsx41(
|
|
36578
35875
|
ItemInteractionLayer,
|
|
36579
35876
|
{
|
|
36580
35877
|
rect: fieldPickRect,
|
|
@@ -36591,8 +35888,6 @@ function OhhwellsBridge() {
|
|
|
36591
35888
|
{
|
|
36592
35889
|
type: fieldPickState.type,
|
|
36593
35890
|
required: fieldPickState.required,
|
|
36594
|
-
dropdownOpen: fieldPickState.dropdownOpen,
|
|
36595
|
-
onDropdownOpenChange: handleFieldDropdownOpenChange,
|
|
36596
35891
|
onTypeChange: handleFieldTypeChange,
|
|
36597
35892
|
onRequiredToggle: handleFieldRequiredToggle,
|
|
36598
35893
|
onDuplicate: handleFieldDuplicate,
|
|
@@ -36601,25 +35896,6 @@ function OhhwellsBridge() {
|
|
|
36601
35896
|
)
|
|
36602
35897
|
}
|
|
36603
35898
|
),
|
|
36604
|
-
dropdownOptionPick && !isItemDragging && /* @__PURE__ */ jsx41(
|
|
36605
|
-
ItemInteractionLayer,
|
|
36606
|
-
{
|
|
36607
|
-
rect: dropdownOptionPick.rect,
|
|
36608
|
-
state: "active-top",
|
|
36609
|
-
itemDragSurface: false,
|
|
36610
|
-
toolbarAlign: "center",
|
|
36611
|
-
chromeGap: 0,
|
|
36612
|
-
showHandle: false,
|
|
36613
|
-
toolbar: /* @__PURE__ */ jsx41(
|
|
36614
|
-
DropdownOptionToolbar,
|
|
36615
|
-
{
|
|
36616
|
-
canDelete: dropdownOptionPick.canDelete,
|
|
36617
|
-
onDuplicate: handleDropdownOptionDuplicate,
|
|
36618
|
-
onDelete: handleDropdownOptionDelete
|
|
36619
|
-
}
|
|
36620
|
-
)
|
|
36621
|
-
}
|
|
36622
|
-
),
|
|
36623
35899
|
fieldDragging ? fieldDropSlots.map((slot, i) => /* @__PURE__ */ jsx41(
|
|
36624
35900
|
"div",
|
|
36625
35901
|
{
|
|
@@ -36730,7 +36006,7 @@ function OhhwellsBridge() {
|
|
|
36730
36006
|
) : void 0
|
|
36731
36007
|
}
|
|
36732
36008
|
),
|
|
36733
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && !isRectOutsideClip(toolbarRect, getIframeVisibleClip(parentScrollRef.current)) && /* @__PURE__ */ jsxs27(
|
|
36009
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && !isRectOutsideClip(toolbarRect, getIframeVisibleClip(parentScrollRef.current)) && /* @__PURE__ */ jsxs27(Fragment13, { children: [
|
|
36734
36010
|
/* @__PURE__ */ jsx41(
|
|
36735
36011
|
EditGlowChrome,
|
|
36736
36012
|
{
|
|
@@ -36914,9 +36190,9 @@ function OhhwellsBridge() {
|
|
|
36914
36190
|
|
|
36915
36191
|
// src/ui/EmptySection.tsx
|
|
36916
36192
|
import Link3 from "next/link";
|
|
36917
|
-
import { Fragment as
|
|
36193
|
+
import { Fragment as Fragment14, jsx as jsx42, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
36918
36194
|
function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey }) {
|
|
36919
|
-
return /* @__PURE__ */ jsxs28(
|
|
36195
|
+
return /* @__PURE__ */ jsxs28(Fragment14, { children: [
|
|
36920
36196
|
/* @__PURE__ */ jsx42(
|
|
36921
36197
|
"p",
|
|
36922
36198
|
{
|