@ohhwells/bridge 0.1.178 → 0.1.179-next.474
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 +1428 -763
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1484 -803
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs.map +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/styles.css +116 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React12, { useCallback as useCallback12, useEffect as useEffect22, useLayoutEffect as
|
|
4
|
+
import React12, { useCallback as useCallback12, useEffect as useEffect22, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
|
|
5
5
|
import { createRoot as createRoot3 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync3 } from "react-dom";
|
|
7
7
|
|
|
@@ -1266,7 +1266,8 @@ function toneOverlayLogos(deps, root, photoSections, boxes) {
|
|
|
1266
1266
|
if (root.matches(OVERLAY_LOGO_SELECTOR)) logos.unshift(root);
|
|
1267
1267
|
for (const logo of logos) {
|
|
1268
1268
|
if (onOwnSurface(deps, logo, root)) {
|
|
1269
|
-
logo.removeAttribute(OVERLAY_TONE_ATTR);
|
|
1269
|
+
if (paintOver(deps.style(logo), { r: 0, g: 0, b: 0, a: 0 }).painted) logo.removeAttribute(OVERLAY_TONE_ATTR);
|
|
1270
|
+
else clearOverlayTone(logo);
|
|
1270
1271
|
continue;
|
|
1271
1272
|
}
|
|
1272
1273
|
const box = deps.rect(logo);
|
|
@@ -8064,6 +8065,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
8064
8065
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
8065
8066
|
return target ? pricingFeatureList(target).length : 0;
|
|
8066
8067
|
}
|
|
8068
|
+
function prevailingFeatureIcon(features) {
|
|
8069
|
+
const counts = /* @__PURE__ */ new Map();
|
|
8070
|
+
for (const row of features) {
|
|
8071
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
8072
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
8073
|
+
entry.count += 1;
|
|
8074
|
+
counts.set(key, entry);
|
|
8075
|
+
}
|
|
8076
|
+
let best = null;
|
|
8077
|
+
for (const entry of counts.values()) {
|
|
8078
|
+
if (!best || entry.count > best.count) best = entry;
|
|
8079
|
+
}
|
|
8080
|
+
if (!best) return {};
|
|
8081
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
8082
|
+
}
|
|
8067
8083
|
function addPricingCardFeature(tree, index, text) {
|
|
8068
8084
|
return withPricingCollection(tree, (collection) => {
|
|
8069
8085
|
const children = collection.children;
|
|
@@ -8072,7 +8088,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
8072
8088
|
const features = pricingFeatureList(target);
|
|
8073
8089
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
8074
8090
|
target.slots = target.slots ?? {};
|
|
8075
|
-
target.slots.features = [...features, { text }];
|
|
8091
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
8076
8092
|
return true;
|
|
8077
8093
|
});
|
|
8078
8094
|
}
|
|
@@ -9607,7 +9623,7 @@ var AI_MOBILE_CSS = [
|
|
|
9607
9623
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
9608
9624
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
9609
9625
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
9610
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
9626
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
9611
9627
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
9612
9628
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
9613
9629
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -9623,8 +9639,10 @@ var AI_MOBILE_CSS = [
|
|
|
9623
9639
|
"[data-ai-section]{overflow-x:hidden}",
|
|
9624
9640
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
9625
9641
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
9626
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
9627
|
-
|
|
9642
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
9643
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
9644
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
9645
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
9628
9646
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
9629
9647
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
9630
9648
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -9829,6 +9847,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
9829
9847
|
function textAttrs(ctx, path) {
|
|
9830
9848
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
9831
9849
|
}
|
|
9850
|
+
var AI_RESPONSIVE_CSS = [
|
|
9851
|
+
"@media (max-width: 960px) {",
|
|
9852
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
9853
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
9854
|
+
"}",
|
|
9855
|
+
"@media (max-width: 640px) {",
|
|
9856
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
9857
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
9858
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
9859
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
9860
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
9861
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
9862
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
9863
|
+
// layered text used to be.
|
|
9864
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
9865
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
9866
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
9867
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
9868
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
9869
|
+
// other rule had already been taught to stand down.
|
|
9870
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
9871
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
9872
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
9873
|
+
"}"
|
|
9874
|
+
].join("\n");
|
|
9832
9875
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
9833
9876
|
function MediaBox({
|
|
9834
9877
|
refValue,
|
|
@@ -9883,7 +9926,7 @@ function MediaBox({
|
|
|
9883
9926
|
position: fill ? "absolute" : void 0,
|
|
9884
9927
|
inset: fill ? 0 : void 0,
|
|
9885
9928
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
9886
|
-
height: fill ? "100%" : void 0,
|
|
9929
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
9887
9930
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
9888
9931
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
9889
9932
|
borderRadius: radius,
|
|
@@ -11385,7 +11428,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
11385
11428
|
return /* @__PURE__ */ jsx(
|
|
11386
11429
|
"div",
|
|
11387
11430
|
{
|
|
11388
|
-
"data-ai-grid":
|
|
11431
|
+
"data-ai-grid": String(itemsPerRow),
|
|
11389
11432
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
11390
11433
|
style: {
|
|
11391
11434
|
display: "grid",
|
|
@@ -11687,7 +11730,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
11687
11730
|
},
|
|
11688
11731
|
children: [
|
|
11689
11732
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
11690
|
-
// The section's `data-ai-
|
|
11733
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
11691
11734
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
11692
11735
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
11693
11736
|
// the full section width instead of reading at the usual content width.
|
|
@@ -12101,6 +12144,7 @@ function AiTreeRenderer({
|
|
|
12101
12144
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
12102
12145
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
12103
12146
|
...bgAttrs,
|
|
12147
|
+
"data-ai-responsive": "",
|
|
12104
12148
|
style: {
|
|
12105
12149
|
position: "relative",
|
|
12106
12150
|
padding: `${padCss} 0`,
|
|
@@ -12114,12 +12158,13 @@ function AiTreeRenderer({
|
|
|
12114
12158
|
...fillHeight ? { display: "grid" } : {}
|
|
12115
12159
|
},
|
|
12116
12160
|
children: [
|
|
12117
|
-
|
|
12161
|
+
/* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
|
|
12118
12162
|
/* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
|
|
12163
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
12119
12164
|
/* @__PURE__ */ jsx(
|
|
12120
12165
|
"div",
|
|
12121
12166
|
{
|
|
12122
|
-
"data-ai-
|
|
12167
|
+
"data-ai-section-inner": "",
|
|
12123
12168
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
12124
12169
|
style: {
|
|
12125
12170
|
position: "relative",
|
|
@@ -12136,7 +12181,7 @@ function AiTreeRenderer({
|
|
|
12136
12181
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
|
|
12137
12182
|
"div",
|
|
12138
12183
|
{
|
|
12139
|
-
"data-ai-
|
|
12184
|
+
"data-ai-columns": "",
|
|
12140
12185
|
style: {
|
|
12141
12186
|
display: "grid",
|
|
12142
12187
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -12798,9 +12843,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
12798
12843
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
12799
12844
|
continue;
|
|
12800
12845
|
}
|
|
12801
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
12802
12846
|
let container = existing?.container;
|
|
12847
|
+
let isNewMount = false;
|
|
12803
12848
|
if (!container || !container.isConnected) {
|
|
12849
|
+
isNewMount = true;
|
|
12804
12850
|
existing?.root.unmount();
|
|
12805
12851
|
container?.remove();
|
|
12806
12852
|
container = document.createElement("div");
|
|
@@ -13138,6 +13184,34 @@ function minSpanForFooterBlock(type) {
|
|
|
13138
13184
|
return 3;
|
|
13139
13185
|
}
|
|
13140
13186
|
}
|
|
13187
|
+
function readLiveSocialItems() {
|
|
13188
|
+
const root = getFooterRoot();
|
|
13189
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
13190
|
+
if (!row) return [];
|
|
13191
|
+
const items = [];
|
|
13192
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
13193
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
13194
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
13195
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
13196
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
13197
|
+
items.push({ platform, href });
|
|
13198
|
+
}
|
|
13199
|
+
return items;
|
|
13200
|
+
}
|
|
13201
|
+
function syncSocialRowsFromDom(tree) {
|
|
13202
|
+
const root = getFooterRoot();
|
|
13203
|
+
if (!root) return;
|
|
13204
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
13205
|
+
const live = readLiveSocialItems();
|
|
13206
|
+
if (row && live.length === 0) return;
|
|
13207
|
+
for (const col of tree.columns) {
|
|
13208
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
13209
|
+
if (block.type !== "social-row") return [block];
|
|
13210
|
+
if (!row) return [];
|
|
13211
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
13212
|
+
});
|
|
13213
|
+
}
|
|
13214
|
+
}
|
|
13141
13215
|
function collectBrandBlocks(tree) {
|
|
13142
13216
|
const brand = [];
|
|
13143
13217
|
for (const col of tree.columns) {
|
|
@@ -13383,6 +13457,7 @@ function textOf2(el) {
|
|
|
13383
13457
|
}
|
|
13384
13458
|
function syncFooterTreeLinksFromDom(tree) {
|
|
13385
13459
|
const next = cloneTree2(tree);
|
|
13460
|
+
syncSocialRowsFromDom(next);
|
|
13386
13461
|
const domCols = listFooterColumns().map((col) => {
|
|
13387
13462
|
const heading = getFooterColumnHeadingEl(col);
|
|
13388
13463
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -19208,7 +19283,7 @@ function apiBase() {
|
|
|
19208
19283
|
function bridgeVersion() {
|
|
19209
19284
|
try {
|
|
19210
19285
|
if (true) {
|
|
19211
|
-
return "0.1.
|
|
19286
|
+
return "0.1.179-next.474";
|
|
19212
19287
|
}
|
|
19213
19288
|
} catch {
|
|
19214
19289
|
}
|
|
@@ -19222,7 +19297,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
19222
19297
|
return;
|
|
19223
19298
|
}
|
|
19224
19299
|
try {
|
|
19225
|
-
const v = true ? "0.1.
|
|
19300
|
+
const v = true ? "0.1.179-next.474" : "";
|
|
19226
19301
|
if (v) {
|
|
19227
19302
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
19228
19303
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -19301,32 +19376,42 @@ function armLoaderHangBeacon(subdomain, fetchState, hangMs = 15e3) {
|
|
|
19301
19376
|
}
|
|
19302
19377
|
|
|
19303
19378
|
// src/lib/form-fields.ts
|
|
19379
|
+
var DEFAULT_DROPDOWN_OPTIONS = ["Option 1", "Option 2", "Option 3"];
|
|
19304
19380
|
var FIELD_DEFAULTS = {
|
|
19305
19381
|
"short-text": { label: "Short text", placeholder: "Type placeholder text..." },
|
|
19306
19382
|
"long-text": { label: "Long text", placeholder: "How can we help?" },
|
|
19307
19383
|
email: { label: "Email", placeholder: "hello@example.com" },
|
|
19308
|
-
phone: { label: "Phone number", placeholder: "(555) 000-0000" }
|
|
19384
|
+
phone: { label: "Phone number", placeholder: "(555) 000-0000" },
|
|
19385
|
+
dropdown: { label: "Dropdown", placeholder: "" }
|
|
19309
19386
|
};
|
|
19310
19387
|
var FIELD_TYPES = [
|
|
19311
19388
|
{ type: "short-text", label: "Short text" },
|
|
19312
19389
|
{ type: "long-text", label: "Long text" },
|
|
19313
19390
|
{ type: "email", label: "Email" },
|
|
19314
|
-
{ type: "phone", label: "Phone" }
|
|
19391
|
+
{ type: "phone", label: "Phone" },
|
|
19392
|
+
{ type: "dropdown", label: "Dropdown" }
|
|
19315
19393
|
];
|
|
19316
19394
|
var FIELD_ATTR = "data-ohw-form-field";
|
|
19317
19395
|
var FIELD_TYPE_ATTR = "data-ohw-field-type";
|
|
19318
19396
|
var PLACEHOLDER_EDIT_ATTR = "data-ohw-placeholder-edit";
|
|
19397
|
+
var DROPDOWN_PANEL_ATTR = "data-ohw-dropdown-panel";
|
|
19398
|
+
var DROPDOWN_OPTION_ATTR = "data-ohw-dropdown-option";
|
|
19399
|
+
var DROPDOWN_OPEN_ATTR = "data-ohw-dropdown-open";
|
|
19400
|
+
var DROPDOWN_OPTION_SELECTED_ATTR = "data-ohw-dropdown-option-selected";
|
|
19401
|
+
var CONTROL_SELECTOR = "input, textarea, select";
|
|
19319
19402
|
var seedFieldByForm = /* @__PURE__ */ new WeakMap();
|
|
19320
19403
|
function fieldsKey(formKey) {
|
|
19321
19404
|
return `${formKey}-fields`;
|
|
19322
19405
|
}
|
|
19323
19406
|
function inputTagFor(type) {
|
|
19407
|
+
if (type === "dropdown") return { tag: "select" };
|
|
19324
19408
|
if (type === "long-text") return { tag: "textarea" };
|
|
19325
19409
|
if (type === "email") return { tag: "input", inputType: "email" };
|
|
19326
19410
|
if (type === "phone") return { tag: "input", inputType: "tel" };
|
|
19327
19411
|
return { tag: "input", inputType: "text" };
|
|
19328
19412
|
}
|
|
19329
19413
|
function inferType(input) {
|
|
19414
|
+
if (input.tagName === "SELECT") return "dropdown";
|
|
19330
19415
|
if (input.tagName === "TEXTAREA") return "long-text";
|
|
19331
19416
|
const type = input.type;
|
|
19332
19417
|
if (type === "email") return "email";
|
|
@@ -19342,7 +19427,7 @@ function ensureFieldLabel(wrapper, key) {
|
|
|
19342
19427
|
}
|
|
19343
19428
|
return existing;
|
|
19344
19429
|
}
|
|
19345
|
-
const input =
|
|
19430
|
+
const input = fieldControlOf(wrapper);
|
|
19346
19431
|
const label = document.createElement("label");
|
|
19347
19432
|
label.setAttribute("data-ohw-editable", "text");
|
|
19348
19433
|
label.setAttribute("data-ohw-key", `${key}-label`);
|
|
@@ -19352,7 +19437,7 @@ function ensureFieldLabel(wrapper, key) {
|
|
|
19352
19437
|
label.style.fontSize = "13px";
|
|
19353
19438
|
label.style.fontWeight = "500";
|
|
19354
19439
|
label.style.lineHeight = "1.3";
|
|
19355
|
-
const fromPlaceholder = input
|
|
19440
|
+
const fromPlaceholder = input && "getAttribute" in input ? input.getAttribute("placeholder")?.trim() : void 0;
|
|
19356
19441
|
const text = fromPlaceholder && fromPlaceholder.length < 40 ? fromPlaceholder : key.replace(/[-_]/g, " ");
|
|
19357
19442
|
label.textContent = text;
|
|
19358
19443
|
if (input && input.parentElement === wrapper) wrapper.insertBefore(label, input);
|
|
@@ -19365,8 +19450,13 @@ function listFieldWrappers(form) {
|
|
|
19365
19450
|
function getFieldWrapper(el) {
|
|
19366
19451
|
return el?.closest(`[${FIELD_ATTR}]`) ?? null;
|
|
19367
19452
|
}
|
|
19453
|
+
function fieldControlOf(wrapper) {
|
|
19454
|
+
return wrapper.querySelector(CONTROL_SELECTOR);
|
|
19455
|
+
}
|
|
19368
19456
|
function fieldInputOf(wrapper) {
|
|
19369
|
-
|
|
19457
|
+
const control = fieldControlOf(wrapper);
|
|
19458
|
+
if (!control || control.tagName === "SELECT") return null;
|
|
19459
|
+
return control;
|
|
19370
19460
|
}
|
|
19371
19461
|
function fieldLabelOf(wrapper) {
|
|
19372
19462
|
return wrapper.querySelector("label");
|
|
@@ -19378,17 +19468,208 @@ function fieldTypeOf(wrapper) {
|
|
|
19378
19468
|
return wrapper.getAttribute(FIELD_TYPE_ATTR) ?? "short-text";
|
|
19379
19469
|
}
|
|
19380
19470
|
function isFieldRequired(wrapper) {
|
|
19381
|
-
return
|
|
19471
|
+
return fieldControlOf(wrapper)?.hasAttribute("required") ?? false;
|
|
19472
|
+
}
|
|
19473
|
+
function optionFallbackLabel(index) {
|
|
19474
|
+
return `Option ${index + 1}`;
|
|
19475
|
+
}
|
|
19476
|
+
function normalizeOptionText(text, index) {
|
|
19477
|
+
const trimmed = text.replace(/\u00a0/g, " ").trim();
|
|
19478
|
+
return trimmed || optionFallbackLabel(index);
|
|
19479
|
+
}
|
|
19480
|
+
function readDropdownOptions(wrapper) {
|
|
19481
|
+
const select = fieldControlOf(wrapper);
|
|
19482
|
+
if (!select || select.tagName !== "SELECT") return [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19483
|
+
const options = Array.from(select.options).map(
|
|
19484
|
+
(opt, i) => normalizeOptionText(opt.textContent ?? "", i)
|
|
19485
|
+
);
|
|
19486
|
+
return options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19487
|
+
}
|
|
19488
|
+
function fillSelectOptions(select, options) {
|
|
19489
|
+
select.replaceChildren();
|
|
19490
|
+
options.forEach((text, i) => {
|
|
19491
|
+
const opt = document.createElement("option");
|
|
19492
|
+
const label = normalizeOptionText(text, i);
|
|
19493
|
+
opt.value = label;
|
|
19494
|
+
opt.textContent = label;
|
|
19495
|
+
select.appendChild(opt);
|
|
19496
|
+
});
|
|
19497
|
+
if (select.options.length > 0) select.selectedIndex = 0;
|
|
19498
|
+
}
|
|
19499
|
+
function styleDropdownPanelFromSelect(panel, select) {
|
|
19500
|
+
const cs = getComputedStyle(select);
|
|
19501
|
+
panel.style.boxSizing = "border-box";
|
|
19502
|
+
panel.style.width = "100%";
|
|
19503
|
+
panel.style.marginTop = "4px";
|
|
19504
|
+
panel.style.overflow = "hidden";
|
|
19505
|
+
panel.style.borderStyle = cs.borderStyle || "solid";
|
|
19506
|
+
panel.style.borderWidth = cs.borderWidth || "1px";
|
|
19507
|
+
panel.style.borderColor = cs.borderColor;
|
|
19508
|
+
panel.style.borderRadius = cs.borderRadius;
|
|
19509
|
+
panel.style.backgroundColor = cs.backgroundColor;
|
|
19510
|
+
panel.style.fontFamily = cs.fontFamily;
|
|
19511
|
+
panel.style.fontSize = cs.fontSize;
|
|
19512
|
+
panel.style.fontWeight = cs.fontWeight;
|
|
19513
|
+
panel.style.lineHeight = cs.lineHeight;
|
|
19514
|
+
panel.style.color = cs.color;
|
|
19515
|
+
panel.style.boxShadow = cs.boxShadow && cs.boxShadow !== "none" ? cs.boxShadow : "0 8px 24px color-mix(in srgb, #000 12%, transparent)";
|
|
19516
|
+
}
|
|
19517
|
+
function styleDropdownOptionFromSelect(row, select) {
|
|
19518
|
+
const cs = getComputedStyle(select);
|
|
19519
|
+
row.style.paddingTop = cs.paddingTop || "10px";
|
|
19520
|
+
row.style.paddingBottom = cs.paddingBottom || "10px";
|
|
19521
|
+
row.style.paddingLeft = cs.paddingLeft || "12px";
|
|
19522
|
+
row.style.paddingRight = cs.paddingRight || "12px";
|
|
19523
|
+
row.style.fontFamily = cs.fontFamily;
|
|
19524
|
+
row.style.fontSize = cs.fontSize;
|
|
19525
|
+
row.style.fontWeight = cs.fontWeight;
|
|
19526
|
+
row.style.lineHeight = cs.lineHeight;
|
|
19527
|
+
row.style.color = cs.color;
|
|
19528
|
+
row.style.background = "transparent";
|
|
19529
|
+
row.style.border = "none";
|
|
19530
|
+
row.style.outline = "none";
|
|
19531
|
+
row.style.cursor = "text";
|
|
19532
|
+
}
|
|
19533
|
+
function syncDropdownPanel(wrapper) {
|
|
19534
|
+
if (fieldTypeOf(wrapper) !== "dropdown") {
|
|
19535
|
+
wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
|
|
19536
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19537
|
+
return null;
|
|
19538
|
+
}
|
|
19539
|
+
const select = fieldControlOf(wrapper);
|
|
19540
|
+
if (!select || select.tagName !== "SELECT") return null;
|
|
19541
|
+
let panel = wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`);
|
|
19542
|
+
if (!panel) {
|
|
19543
|
+
panel = document.createElement("div");
|
|
19544
|
+
panel.setAttribute(DROPDOWN_PANEL_ATTR, "");
|
|
19545
|
+
select.after(panel);
|
|
19546
|
+
}
|
|
19547
|
+
styleDropdownPanelFromSelect(panel, select);
|
|
19548
|
+
const options = readDropdownOptions(wrapper);
|
|
19549
|
+
const selected = selectedDropdownOptionIndex(wrapper);
|
|
19550
|
+
panel.replaceChildren();
|
|
19551
|
+
options.forEach((text, i) => {
|
|
19552
|
+
panel.appendChild(createDropdownOptionRow(text, i, select));
|
|
19553
|
+
});
|
|
19554
|
+
if (selected != null && selected >= 0 && selected < options.length) {
|
|
19555
|
+
const row = panel.querySelector(`[${DROPDOWN_OPTION_ATTR}="${selected}"]`);
|
|
19556
|
+
row?.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
|
|
19557
|
+
}
|
|
19558
|
+
return panel;
|
|
19559
|
+
}
|
|
19560
|
+
function createDropdownOptionRow(text, index, select) {
|
|
19561
|
+
const row = document.createElement("div");
|
|
19562
|
+
row.setAttribute(DROPDOWN_OPTION_ATTR, String(index));
|
|
19563
|
+
row.setAttribute("contenteditable", "true");
|
|
19564
|
+
row.setAttribute("spellcheck", "false");
|
|
19565
|
+
row.textContent = text;
|
|
19566
|
+
styleDropdownOptionFromSelect(row, select);
|
|
19567
|
+
return row;
|
|
19568
|
+
}
|
|
19569
|
+
function setDropdownPreviewOpen(wrapper, open) {
|
|
19570
|
+
if (fieldTypeOf(wrapper) !== "dropdown") return;
|
|
19571
|
+
syncDropdownPanel(wrapper);
|
|
19572
|
+
if (open) wrapper.setAttribute(DROPDOWN_OPEN_ATTR, "");
|
|
19573
|
+
else {
|
|
19574
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19575
|
+
clearDropdownOptionSelection(wrapper);
|
|
19576
|
+
}
|
|
19577
|
+
}
|
|
19578
|
+
function isDropdownPreviewOpen(wrapper) {
|
|
19579
|
+
return wrapper.hasAttribute(DROPDOWN_OPEN_ATTR);
|
|
19580
|
+
}
|
|
19581
|
+
function listDropdownOptionRows(wrapper) {
|
|
19582
|
+
return Array.from(wrapper.querySelectorAll(`[${DROPDOWN_OPTION_ATTR}]`));
|
|
19583
|
+
}
|
|
19584
|
+
function getDropdownOptionIndex(el) {
|
|
19585
|
+
const row = el?.closest(`[${DROPDOWN_OPTION_ATTR}]`);
|
|
19586
|
+
if (!row) return null;
|
|
19587
|
+
const raw = row.getAttribute(DROPDOWN_OPTION_ATTR);
|
|
19588
|
+
if (raw == null || raw === "") return null;
|
|
19589
|
+
const index = Number(raw);
|
|
19590
|
+
return Number.isFinite(index) ? index : null;
|
|
19591
|
+
}
|
|
19592
|
+
function selectDropdownOption(wrapper, index) {
|
|
19593
|
+
listDropdownOptionRows(wrapper).forEach((row, i) => {
|
|
19594
|
+
if (i === index) row.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
|
|
19595
|
+
else row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR);
|
|
19596
|
+
});
|
|
19597
|
+
}
|
|
19598
|
+
function clearDropdownOptionSelection(wrapper) {
|
|
19599
|
+
if (!wrapper) return;
|
|
19600
|
+
listDropdownOptionRows(wrapper).forEach((row) => row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR));
|
|
19601
|
+
}
|
|
19602
|
+
function selectedDropdownOptionIndex(wrapper) {
|
|
19603
|
+
const row = wrapper.querySelector(`[${DROPDOWN_OPTION_SELECTED_ATTR}]`);
|
|
19604
|
+
return getDropdownOptionIndex(row);
|
|
19605
|
+
}
|
|
19606
|
+
function commitDropdownOptionsFromPanel(wrapper, finalize = false) {
|
|
19607
|
+
const select = fieldControlOf(wrapper);
|
|
19608
|
+
if (!select || select.tagName !== "SELECT") return readDropdownOptions(wrapper);
|
|
19609
|
+
const rows = listDropdownOptionRows(wrapper);
|
|
19610
|
+
const options = rows.length > 0 ? rows.map((row, i) => {
|
|
19611
|
+
const trimmed = (row.textContent ?? "").replace(/\u00a0/g, " ").trim();
|
|
19612
|
+
return finalize ? normalizeOptionText(trimmed, i) : trimmed || optionFallbackLabel(i);
|
|
19613
|
+
}) : readDropdownOptions(wrapper);
|
|
19614
|
+
fillSelectOptions(select, options);
|
|
19615
|
+
if (finalize) {
|
|
19616
|
+
const panelRows = listDropdownOptionRows(wrapper);
|
|
19617
|
+
if (panelRows.length !== select.options.length) {
|
|
19618
|
+
syncDropdownPanel(wrapper);
|
|
19619
|
+
} else {
|
|
19620
|
+
panelRows.forEach((row, i) => {
|
|
19621
|
+
const label = options[i] ?? optionFallbackLabel(i);
|
|
19622
|
+
if (row.textContent !== label) row.textContent = label;
|
|
19623
|
+
row.setAttribute(DROPDOWN_OPTION_ATTR, String(i));
|
|
19624
|
+
});
|
|
19625
|
+
}
|
|
19626
|
+
}
|
|
19627
|
+
return readDropdownOptions(wrapper);
|
|
19628
|
+
}
|
|
19629
|
+
function writeDropdownOptions(wrapper, options) {
|
|
19630
|
+
const select = fieldControlOf(wrapper);
|
|
19631
|
+
if (!select || select.tagName !== "SELECT") return;
|
|
19632
|
+
const normalized = (options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS]).map(
|
|
19633
|
+
(text, i) => normalizeOptionText(text, i)
|
|
19634
|
+
);
|
|
19635
|
+
fillSelectOptions(select, normalized);
|
|
19636
|
+
syncDropdownPanel(wrapper);
|
|
19637
|
+
}
|
|
19638
|
+
function currentDropdownOptions(wrapper) {
|
|
19639
|
+
const rows = listDropdownOptionRows(wrapper);
|
|
19640
|
+
if (rows.length === 0) return readDropdownOptions(wrapper);
|
|
19641
|
+
return rows.map((row, i) => normalizeOptionText(row.textContent ?? "", i));
|
|
19642
|
+
}
|
|
19643
|
+
function duplicateDropdownOption(wrapper, index) {
|
|
19644
|
+
const options = currentDropdownOptions(wrapper);
|
|
19645
|
+
if (index < 0 || index >= options.length) return index;
|
|
19646
|
+
const next = [...options];
|
|
19647
|
+
next.splice(index + 1, 0, options[index]);
|
|
19648
|
+
writeDropdownOptions(wrapper, next);
|
|
19649
|
+
selectDropdownOption(wrapper, index + 1);
|
|
19650
|
+
return index + 1;
|
|
19651
|
+
}
|
|
19652
|
+
function removeDropdownOption(wrapper, index) {
|
|
19653
|
+
const options = currentDropdownOptions(wrapper);
|
|
19654
|
+
if (options.length <= 1 || index < 0 || index >= options.length) {
|
|
19655
|
+
selectDropdownOption(wrapper, Math.max(0, Math.min(index, options.length - 1)));
|
|
19656
|
+
return selectedDropdownOptionIndex(wrapper);
|
|
19657
|
+
}
|
|
19658
|
+
const next = options.filter((_, i) => i !== index);
|
|
19659
|
+
writeDropdownOptions(wrapper, next);
|
|
19660
|
+
const nextIndex = Math.min(index, next.length - 1);
|
|
19661
|
+
selectDropdownOption(wrapper, nextIndex);
|
|
19662
|
+
return nextIndex;
|
|
19382
19663
|
}
|
|
19383
19664
|
function markFormFields(form) {
|
|
19384
|
-
form.querySelectorAll(
|
|
19665
|
+
form.querySelectorAll(CONTROL_SELECTOR).forEach((input) => {
|
|
19385
19666
|
const type = input.type;
|
|
19386
19667
|
if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
|
|
19387
19668
|
return;
|
|
19388
19669
|
}
|
|
19389
19670
|
if (getFieldWrapper(input)) return;
|
|
19390
19671
|
let wrapper = input;
|
|
19391
|
-
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll(
|
|
19672
|
+
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll(CONTROL_SELECTOR).length === 1) {
|
|
19392
19673
|
wrapper = wrapper.parentElement;
|
|
19393
19674
|
}
|
|
19394
19675
|
if (wrapper === input) {
|
|
@@ -19402,6 +19683,7 @@ function markFormFields(form) {
|
|
|
19402
19683
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
19403
19684
|
wrapper.setAttribute(FIELD_TYPE_ATTR, inferType(input));
|
|
19404
19685
|
ensureFieldLabel(wrapper, key);
|
|
19686
|
+
if (inferType(input) === "dropdown") syncDropdownPanel(wrapper);
|
|
19405
19687
|
syncRequiredMark(wrapper);
|
|
19406
19688
|
});
|
|
19407
19689
|
const wrappers = listFieldWrappers(form);
|
|
@@ -19412,16 +19694,20 @@ function markFormFields(form) {
|
|
|
19412
19694
|
}
|
|
19413
19695
|
function readFieldsFromDom(form) {
|
|
19414
19696
|
return listFieldWrappers(form).map((wrapper) => {
|
|
19415
|
-
const
|
|
19697
|
+
const type = fieldTypeOf(wrapper);
|
|
19698
|
+
const control = fieldControlOf(wrapper);
|
|
19699
|
+
const isDropdown = type === "dropdown";
|
|
19700
|
+
if (isDropdown) commitDropdownOptionsFromPanel(wrapper, true);
|
|
19416
19701
|
return {
|
|
19417
19702
|
key: fieldKeyOf(wrapper),
|
|
19418
|
-
type
|
|
19703
|
+
type,
|
|
19419
19704
|
label: fieldLabelText(fieldLabelOf(wrapper)).trim(),
|
|
19420
19705
|
// While a field is selected its placeholder text lives in the value (see
|
|
19421
19706
|
// beginPlaceholderEdit), so reading the attribute would store an empty one — whoever
|
|
19422
19707
|
// happens to save at that moment must still record what the owner typed.
|
|
19423
|
-
placeholder:
|
|
19424
|
-
required: Boolean(
|
|
19708
|
+
placeholder: !isDropdown && control && control.tagName !== "SELECT" ? control.hasAttribute(PLACEHOLDER_EDIT_ATTR) ? control.value : control.getAttribute("placeholder") ?? "" : "",
|
|
19709
|
+
required: Boolean(control?.hasAttribute("required")),
|
|
19710
|
+
...isDropdown ? { options: readDropdownOptions(wrapper) } : {}
|
|
19425
19711
|
};
|
|
19426
19712
|
});
|
|
19427
19713
|
}
|
|
@@ -19439,8 +19725,8 @@ function isDefaultText(value, pick) {
|
|
|
19439
19725
|
if (!trimmed) return true;
|
|
19440
19726
|
return Object.values(FIELD_DEFAULTS).some((defaults) => pick(defaults) === trimmed);
|
|
19441
19727
|
}
|
|
19442
|
-
function applyFieldType(wrapper, type) {
|
|
19443
|
-
const input =
|
|
19728
|
+
function applyFieldType(wrapper, type, options) {
|
|
19729
|
+
const input = fieldControlOf(wrapper);
|
|
19444
19730
|
if (!input) return;
|
|
19445
19731
|
const defaults = FIELD_DEFAULTS[type];
|
|
19446
19732
|
const placeholder = input.getAttribute("placeholder") ?? "";
|
|
@@ -19452,6 +19738,10 @@ function applyFieldType(wrapper, type) {
|
|
|
19452
19738
|
};
|
|
19453
19739
|
const { tag, inputType } = inputTagFor(type);
|
|
19454
19740
|
wrapper.setAttribute(FIELD_TYPE_ATTR, type);
|
|
19741
|
+
if (type !== "dropdown") {
|
|
19742
|
+
wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
|
|
19743
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19744
|
+
}
|
|
19455
19745
|
const shedSize = (el) => {
|
|
19456
19746
|
if (type === "long-text") return;
|
|
19457
19747
|
el.style.removeProperty("height");
|
|
@@ -19463,28 +19753,39 @@ function applyFieldType(wrapper, type) {
|
|
|
19463
19753
|
}
|
|
19464
19754
|
};
|
|
19465
19755
|
const applyDefaults = (el) => {
|
|
19756
|
+
if (type === "dropdown") return;
|
|
19466
19757
|
el.setAttribute("placeholder", defaults.placeholder);
|
|
19467
19758
|
if (label && followsDefaults.label) {
|
|
19468
19759
|
label.textContent = defaults.label;
|
|
19469
19760
|
}
|
|
19470
19761
|
};
|
|
19762
|
+
const applyDropdown = (select) => {
|
|
19763
|
+
const nextOptions = options && options.length > 0 ? options.map((text, i) => normalizeOptionText(text, i)) : [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19764
|
+
fillSelectOptions(select, nextOptions);
|
|
19765
|
+
select.removeAttribute("placeholder");
|
|
19766
|
+
if (label && followsDefaults.label) label.textContent = defaults.label;
|
|
19767
|
+
syncDropdownPanel(wrapper);
|
|
19768
|
+
};
|
|
19471
19769
|
if (input.tagName.toLowerCase() === tag) {
|
|
19472
19770
|
if (inputType) input.type = inputType;
|
|
19473
19771
|
shedSize(input);
|
|
19474
|
-
|
|
19772
|
+
if (type === "dropdown") applyDropdown(input);
|
|
19773
|
+
else applyDefaults(input);
|
|
19475
19774
|
requireIfEmail(wrapper, type);
|
|
19476
19775
|
return;
|
|
19477
19776
|
}
|
|
19478
19777
|
const next = document.createElement(tag);
|
|
19479
19778
|
Array.from(input.attributes).forEach((attr) => {
|
|
19480
19779
|
if (attr.name === "type") return;
|
|
19780
|
+
if (tag === "select" && (attr.name === "value" || attr.name === "placeholder")) return;
|
|
19481
19781
|
next.setAttribute(attr.name, attr.value);
|
|
19482
19782
|
});
|
|
19483
19783
|
if (inputType) next.setAttribute("type", inputType);
|
|
19484
19784
|
shedSize(next);
|
|
19485
19785
|
if (type === "long-text") next.setAttribute("rows", "4");
|
|
19486
19786
|
input.replaceWith(next);
|
|
19487
|
-
|
|
19787
|
+
if (type === "dropdown") applyDropdown(next);
|
|
19788
|
+
else applyDefaults(next);
|
|
19488
19789
|
requireIfEmail(wrapper, type);
|
|
19489
19790
|
}
|
|
19490
19791
|
function requireIfEmail(wrapper, type) {
|
|
@@ -19506,7 +19807,7 @@ function syncRequiredMark(wrapper) {
|
|
|
19506
19807
|
else label.removeAttribute(REQUIRED_MARK_ATTR);
|
|
19507
19808
|
}
|
|
19508
19809
|
function setFieldRequired(wrapper, required) {
|
|
19509
|
-
const input =
|
|
19810
|
+
const input = fieldControlOf(wrapper);
|
|
19510
19811
|
const label = fieldLabelOf(wrapper);
|
|
19511
19812
|
if (!input) return;
|
|
19512
19813
|
if (required) input.setAttribute("required", "");
|
|
@@ -19514,6 +19815,7 @@ function setFieldRequired(wrapper, required) {
|
|
|
19514
19815
|
if (label) syncRequiredMark(wrapper);
|
|
19515
19816
|
}
|
|
19516
19817
|
function beginPlaceholderEdit(wrapper) {
|
|
19818
|
+
if (fieldTypeOf(wrapper) === "dropdown") return;
|
|
19517
19819
|
const input = fieldInputOf(wrapper);
|
|
19518
19820
|
if (!input || input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return;
|
|
19519
19821
|
input.style.setProperty("--ohw-placeholder-edit-color", getComputedStyle(input).color);
|
|
@@ -19523,6 +19825,11 @@ function beginPlaceholderEdit(wrapper) {
|
|
|
19523
19825
|
}
|
|
19524
19826
|
function commitPlaceholderEdit(wrapper) {
|
|
19525
19827
|
if (!wrapper) return false;
|
|
19828
|
+
if (fieldTypeOf(wrapper) === "dropdown") {
|
|
19829
|
+
const before = readDropdownOptions(wrapper).join("\0");
|
|
19830
|
+
const after = commitDropdownOptionsFromPanel(wrapper, true).join("\0");
|
|
19831
|
+
return before !== after;
|
|
19832
|
+
}
|
|
19526
19833
|
const input = fieldInputOf(wrapper);
|
|
19527
19834
|
if (!input || !input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return false;
|
|
19528
19835
|
const typed = input.value;
|
|
@@ -19534,6 +19841,7 @@ function commitPlaceholderEdit(wrapper) {
|
|
|
19534
19841
|
return previous !== typed;
|
|
19535
19842
|
}
|
|
19536
19843
|
function setFieldPlaceholder(wrapper, placeholder) {
|
|
19844
|
+
if (fieldTypeOf(wrapper) === "dropdown") return;
|
|
19537
19845
|
fieldInputOf(wrapper)?.setAttribute("placeholder", placeholder);
|
|
19538
19846
|
}
|
|
19539
19847
|
function uniqueKey(form, base) {
|
|
@@ -19577,14 +19885,17 @@ function insertField(form, type) {
|
|
|
19577
19885
|
}
|
|
19578
19886
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
19579
19887
|
wrapper.setAttribute(FIELD_TYPE_ATTR, type);
|
|
19888
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19580
19889
|
applyFieldType(wrapper, type);
|
|
19581
19890
|
const defaults = FIELD_DEFAULTS[type];
|
|
19582
|
-
const input =
|
|
19891
|
+
const input = fieldControlOf(wrapper);
|
|
19583
19892
|
if (input) {
|
|
19584
19893
|
input.setAttribute("name", key);
|
|
19585
19894
|
input.removeAttribute("required");
|
|
19586
|
-
|
|
19587
|
-
|
|
19895
|
+
if (type !== "dropdown") {
|
|
19896
|
+
input.setAttribute("placeholder", defaults.placeholder);
|
|
19897
|
+
if (input.tagName !== "SELECT") input.value = "";
|
|
19898
|
+
}
|
|
19588
19899
|
}
|
|
19589
19900
|
const label = ensureFieldLabel(wrapper, key);
|
|
19590
19901
|
label.textContent = defaults.label;
|
|
@@ -19593,18 +19904,22 @@ function insertField(form, type) {
|
|
|
19593
19904
|
return wrapper;
|
|
19594
19905
|
}
|
|
19595
19906
|
function duplicateField(form, wrapper) {
|
|
19907
|
+
if (fieldTypeOf(wrapper) === "dropdown") commitDropdownOptionsFromPanel(wrapper);
|
|
19596
19908
|
const copy = wrapper.cloneNode(true);
|
|
19597
19909
|
const key = uniqueKey(form, `${fieldKeyOf(wrapper)}-copy`);
|
|
19598
19910
|
copy.setAttribute(FIELD_ATTR, key);
|
|
19599
|
-
|
|
19911
|
+
copy.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19912
|
+
clearDropdownOptionSelection(copy);
|
|
19913
|
+
const input = fieldControlOf(copy);
|
|
19600
19914
|
if (input) {
|
|
19601
19915
|
input.setAttribute("name", key);
|
|
19602
19916
|
input.removeAttribute("data-ohw-key");
|
|
19603
|
-
input.value = "";
|
|
19917
|
+
if (input.tagName !== "SELECT") input.value = "";
|
|
19604
19918
|
}
|
|
19605
19919
|
const label = fieldLabelOf(copy);
|
|
19606
19920
|
if (label) label.setAttribute("data-ohw-key", `${key}-label`);
|
|
19607
19921
|
wrapper.after(copy);
|
|
19922
|
+
if (fieldTypeOf(copy) === "dropdown") syncDropdownPanel(copy);
|
|
19608
19923
|
return copy;
|
|
19609
19924
|
}
|
|
19610
19925
|
function removeField(wrapper) {
|
|
@@ -19643,16 +19958,22 @@ function reconcileFieldsFromContent(form, content) {
|
|
|
19643
19958
|
wrapper = insertField(form, spec.type);
|
|
19644
19959
|
if (!wrapper) return;
|
|
19645
19960
|
wrapper.setAttribute(FIELD_ATTR, spec.key);
|
|
19646
|
-
const input =
|
|
19961
|
+
const input = fieldControlOf(wrapper);
|
|
19647
19962
|
if (input) {
|
|
19648
19963
|
input.setAttribute("name", spec.key);
|
|
19649
19964
|
}
|
|
19650
19965
|
fieldLabelOf(wrapper)?.setAttribute("data-ohw-key", `${spec.key}-label`);
|
|
19651
19966
|
byKey.set(spec.key, wrapper);
|
|
19652
19967
|
}
|
|
19653
|
-
|
|
19968
|
+
const dropdownWasOpen = wrapper.hasAttribute(DROPDOWN_OPEN_ATTR);
|
|
19969
|
+
applyFieldType(wrapper, spec.type, spec.type === "dropdown" ? spec.options : void 0);
|
|
19654
19970
|
setFieldRequired(wrapper, spec.required);
|
|
19655
19971
|
setFieldPlaceholder(wrapper, spec.placeholder);
|
|
19972
|
+
if (spec.type === "dropdown") {
|
|
19973
|
+
writeDropdownOptions(wrapper, spec.options?.length ? spec.options : [...DEFAULT_DROPDOWN_OPTIONS]);
|
|
19974
|
+
}
|
|
19975
|
+
if (spec.type === "dropdown" && dropdownWasOpen) setDropdownPreviewOpen(wrapper, true);
|
|
19976
|
+
else wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19656
19977
|
const label = fieldLabelOf(wrapper);
|
|
19657
19978
|
if (label && spec.label) label.textContent = spec.label.replace(/\s*\*\s*$/, "").trimEnd();
|
|
19658
19979
|
syncRequiredMark(wrapper);
|
|
@@ -19669,17 +19990,20 @@ function reconcileFieldsFromContent(form, content) {
|
|
|
19669
19990
|
}
|
|
19670
19991
|
|
|
19671
19992
|
// src/ui/form-field-toolbar.tsx
|
|
19672
|
-
import { AtSign, Asterisk, ChevronDown as ChevronDown2, Copy as Copy2,
|
|
19673
|
-
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
19993
|
+
import { AtSign, Asterisk, ChevronDown as ChevronDown2, Copy as Copy2, Phone, TextQuote, Trash2 as Trash22, Type } from "lucide-react";
|
|
19994
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
19674
19995
|
var TYPE_ICONS = {
|
|
19675
19996
|
"short-text": Type,
|
|
19676
19997
|
"long-text": TextQuote,
|
|
19677
19998
|
email: AtSign,
|
|
19678
|
-
phone: Phone
|
|
19999
|
+
phone: Phone,
|
|
20000
|
+
dropdown: ChevronDown2
|
|
19679
20001
|
};
|
|
19680
20002
|
function FormFieldToolbar({
|
|
19681
20003
|
type,
|
|
19682
20004
|
required,
|
|
20005
|
+
dropdownOpen = null,
|
|
20006
|
+
onDropdownOpenChange,
|
|
19683
20007
|
onTypeChange,
|
|
19684
20008
|
onRequiredToggle,
|
|
19685
20009
|
onDuplicate,
|
|
@@ -19687,6 +20011,7 @@ function FormFieldToolbar({
|
|
|
19687
20011
|
}) {
|
|
19688
20012
|
const TypeIcon = TYPE_ICONS[type];
|
|
19689
20013
|
const typeLabel = FIELD_TYPES.find((entry) => entry.type === type)?.label ?? "Short text";
|
|
20014
|
+
const showDropdownToggle = type === "dropdown" && dropdownOpen !== null && dropdownOpen !== void 0;
|
|
19690
20015
|
return /* @__PURE__ */ jsxs7(
|
|
19691
20016
|
"div",
|
|
19692
20017
|
{
|
|
@@ -19738,29 +20063,131 @@ function FormFieldToolbar({
|
|
|
19738
20063
|
]
|
|
19739
20064
|
}
|
|
19740
20065
|
),
|
|
19741
|
-
/* @__PURE__ */
|
|
19742
|
-
|
|
19743
|
-
/* @__PURE__ */
|
|
19744
|
-
|
|
20066
|
+
showDropdownToggle ? /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
20067
|
+
/* @__PURE__ */ jsx15("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
20068
|
+
/* @__PURE__ */ jsxs7(
|
|
20069
|
+
ToggleGroup,
|
|
19745
20070
|
{
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
|
|
19749
|
-
className: "
|
|
19750
|
-
|
|
20071
|
+
value: dropdownOpen ? "open" : "closed",
|
|
20072
|
+
onValueChange: () => {
|
|
20073
|
+
},
|
|
20074
|
+
className: "h-7 gap-0.5 rounded-[calc(var(--radius,0.5rem)-2px)] bg-muted p-0.5",
|
|
20075
|
+
onMouseDown: (e) => {
|
|
20076
|
+
e.preventDefault();
|
|
20077
|
+
e.stopPropagation();
|
|
20078
|
+
},
|
|
20079
|
+
children: [
|
|
20080
|
+
/* @__PURE__ */ jsx15(
|
|
20081
|
+
ToggleGroupItem,
|
|
20082
|
+
{
|
|
20083
|
+
value: "closed",
|
|
20084
|
+
size: "sm",
|
|
20085
|
+
"aria-label": "Closed",
|
|
20086
|
+
className: "h-6 min-w-0 px-2 text-xs font-medium",
|
|
20087
|
+
onMouseDown: (e) => {
|
|
20088
|
+
e.preventDefault();
|
|
20089
|
+
e.stopPropagation();
|
|
20090
|
+
if (dropdownOpen !== false) onDropdownOpenChange?.(false);
|
|
20091
|
+
},
|
|
20092
|
+
onClick: (e) => {
|
|
20093
|
+
e.preventDefault();
|
|
20094
|
+
e.stopPropagation();
|
|
20095
|
+
},
|
|
20096
|
+
children: "Closed"
|
|
20097
|
+
}
|
|
20098
|
+
),
|
|
20099
|
+
/* @__PURE__ */ jsx15(
|
|
20100
|
+
ToggleGroupItem,
|
|
20101
|
+
{
|
|
20102
|
+
value: "open",
|
|
20103
|
+
size: "sm",
|
|
20104
|
+
"aria-label": "Open",
|
|
20105
|
+
className: "h-6 min-w-0 px-2 text-xs font-medium",
|
|
20106
|
+
onMouseDown: (e) => {
|
|
20107
|
+
e.preventDefault();
|
|
20108
|
+
e.stopPropagation();
|
|
20109
|
+
if (dropdownOpen !== true) onDropdownOpenChange?.(true);
|
|
20110
|
+
},
|
|
20111
|
+
onClick: (e) => {
|
|
20112
|
+
e.preventDefault();
|
|
20113
|
+
e.stopPropagation();
|
|
20114
|
+
},
|
|
20115
|
+
children: "Open"
|
|
20116
|
+
}
|
|
20117
|
+
)
|
|
20118
|
+
]
|
|
19751
20119
|
}
|
|
19752
|
-
)
|
|
19753
|
-
|
|
19754
|
-
|
|
19755
|
-
|
|
19756
|
-
|
|
19757
|
-
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
|
|
19761
|
-
|
|
19762
|
-
|
|
19763
|
-
|
|
20120
|
+
)
|
|
20121
|
+
] }) : null,
|
|
20122
|
+
/* @__PURE__ */ jsx15("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
20123
|
+
/* @__PURE__ */ jsx15(
|
|
20124
|
+
"button",
|
|
20125
|
+
{
|
|
20126
|
+
type: "button",
|
|
20127
|
+
title: "Duplicate",
|
|
20128
|
+
"aria-label": "Duplicate",
|
|
20129
|
+
onClick: onDuplicate,
|
|
20130
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20131
|
+
children: /* @__PURE__ */ jsx15(Copy2, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20132
|
+
}
|
|
20133
|
+
),
|
|
20134
|
+
/* @__PURE__ */ jsx15(
|
|
20135
|
+
"button",
|
|
20136
|
+
{
|
|
20137
|
+
type: "button",
|
|
20138
|
+
title: "Delete",
|
|
20139
|
+
"aria-label": "Delete",
|
|
20140
|
+
onClick: onDelete,
|
|
20141
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20142
|
+
children: /* @__PURE__ */ jsx15(Trash22, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20143
|
+
}
|
|
20144
|
+
)
|
|
20145
|
+
]
|
|
20146
|
+
}
|
|
20147
|
+
);
|
|
20148
|
+
}
|
|
20149
|
+
function DropdownOptionToolbar({
|
|
20150
|
+
canDelete,
|
|
20151
|
+
onDuplicate,
|
|
20152
|
+
onDelete
|
|
20153
|
+
}) {
|
|
20154
|
+
return /* @__PURE__ */ jsxs7(
|
|
20155
|
+
"div",
|
|
20156
|
+
{
|
|
20157
|
+
"data-ohw-dropdown-option-toolbar": "",
|
|
20158
|
+
className: "pointer-events-auto flex items-center gap-0.5 whitespace-nowrap rounded-lg border border-border bg-background p-1 shadow-md",
|
|
20159
|
+
children: [
|
|
20160
|
+
/* @__PURE__ */ jsx15(
|
|
20161
|
+
"button",
|
|
20162
|
+
{
|
|
20163
|
+
type: "button",
|
|
20164
|
+
title: "Duplicate",
|
|
20165
|
+
"aria-label": "Duplicate",
|
|
20166
|
+
onMouseDown: (e) => {
|
|
20167
|
+
e.preventDefault();
|
|
20168
|
+
e.stopPropagation();
|
|
20169
|
+
onDuplicate();
|
|
20170
|
+
},
|
|
20171
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20172
|
+
children: /* @__PURE__ */ jsx15(Copy2, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20173
|
+
}
|
|
20174
|
+
),
|
|
20175
|
+
/* @__PURE__ */ jsx15(
|
|
20176
|
+
"button",
|
|
20177
|
+
{
|
|
20178
|
+
type: "button",
|
|
20179
|
+
title: "Delete",
|
|
20180
|
+
"aria-label": "Delete",
|
|
20181
|
+
disabled: !canDelete,
|
|
20182
|
+
onMouseDown: (e) => {
|
|
20183
|
+
e.preventDefault();
|
|
20184
|
+
e.stopPropagation();
|
|
20185
|
+
if (canDelete) onDelete();
|
|
20186
|
+
},
|
|
20187
|
+
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"),
|
|
20188
|
+
children: /* @__PURE__ */ jsx15(Trash22, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20189
|
+
}
|
|
20190
|
+
)
|
|
19764
20191
|
]
|
|
19765
20192
|
}
|
|
19766
20193
|
);
|
|
@@ -19856,7 +20283,7 @@ var MEDIA_SKELETON_CSS = `
|
|
|
19856
20283
|
`;
|
|
19857
20284
|
|
|
19858
20285
|
// src/ui/MediaOverlay.tsx
|
|
19859
|
-
import { Fragment as
|
|
20286
|
+
import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
19860
20287
|
var VIDEO_SETTINGS_BAR_INSET = 8;
|
|
19861
20288
|
var OVERLAY_BUTTON_STYLE = {
|
|
19862
20289
|
pointerEvents: "auto",
|
|
@@ -19903,6 +20330,7 @@ function MediaOverlay({
|
|
|
19903
20330
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
19904
20331
|
);
|
|
19905
20332
|
}, [isVideo]);
|
|
20333
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
19906
20334
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
19907
20335
|
const box = {
|
|
19908
20336
|
position: "fixed",
|
|
@@ -19991,7 +20419,7 @@ function MediaOverlay({
|
|
|
19991
20419
|
]
|
|
19992
20420
|
}
|
|
19993
20421
|
) : null;
|
|
19994
|
-
return /* @__PURE__ */ jsxs8(
|
|
20422
|
+
return /* @__PURE__ */ jsxs8(Fragment6, { children: [
|
|
19995
20423
|
settingsBar,
|
|
19996
20424
|
/* @__PURE__ */ jsxs8(
|
|
19997
20425
|
"div",
|
|
@@ -20001,10 +20429,9 @@ function MediaOverlay({
|
|
|
20001
20429
|
className: "flex items-center justify-center cursor-pointer",
|
|
20002
20430
|
style: {
|
|
20003
20431
|
...box,
|
|
20004
|
-
//
|
|
20005
|
-
//
|
|
20006
|
-
//
|
|
20007
|
-
// Replace still works.
|
|
20432
|
+
// Bare media takes the click: the first selects it, the next opens the picker. Text on
|
|
20433
|
+
// top and cueOnly let clicks fall through. Navbar, logo and buttons over a hero image
|
|
20434
|
+
// never reach here: probeImageAt dismisses the overlay before it can cover them.
|
|
20008
20435
|
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
20009
20436
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
20010
20437
|
// than hovered. Hover keeps the existing tinted preview.
|
|
@@ -20032,15 +20459,18 @@ function MediaOverlay({
|
|
|
20032
20459
|
},
|
|
20033
20460
|
children: [
|
|
20034
20461
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
20035
|
-
|
|
20462
|
+
replaceLabel
|
|
20036
20463
|
]
|
|
20037
20464
|
}
|
|
20038
20465
|
),
|
|
20039
|
-
replaceMode
|
|
20466
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
|
|
20040
20467
|
"div",
|
|
20041
20468
|
{
|
|
20042
20469
|
className: "flex items-center gap-1.5",
|
|
20043
|
-
style: {
|
|
20470
|
+
style: {
|
|
20471
|
+
// Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
|
|
20472
|
+
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
|
|
20473
|
+
},
|
|
20044
20474
|
onClick: (e) => e.stopPropagation(),
|
|
20045
20475
|
children: [
|
|
20046
20476
|
/* @__PURE__ */ jsxs8(
|
|
@@ -20049,7 +20479,7 @@ function MediaOverlay({
|
|
|
20049
20479
|
"data-ohw-media-overlay": "",
|
|
20050
20480
|
variant: "outline",
|
|
20051
20481
|
size: "sm",
|
|
20052
|
-
"aria-label":
|
|
20482
|
+
"aria-label": replaceLabel,
|
|
20053
20483
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
20054
20484
|
style: {
|
|
20055
20485
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -20070,7 +20500,7 @@ function MediaOverlay({
|
|
|
20070
20500
|
},
|
|
20071
20501
|
children: [
|
|
20072
20502
|
isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
|
|
20073
|
-
replaceMode === "full" ?
|
|
20503
|
+
replaceMode === "full" ? replaceLabel : null
|
|
20074
20504
|
]
|
|
20075
20505
|
}
|
|
20076
20506
|
),
|
|
@@ -20285,7 +20715,7 @@ function installHistoryKeyRelay() {
|
|
|
20285
20715
|
}
|
|
20286
20716
|
|
|
20287
20717
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
20288
|
-
import { Fragment as
|
|
20718
|
+
import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
20289
20719
|
var findSectionElement = findByInstanceId;
|
|
20290
20720
|
function readRect(instanceId) {
|
|
20291
20721
|
const el = findSectionElement(instanceId);
|
|
@@ -20627,7 +21057,7 @@ function AiSectionOverlay({
|
|
|
20627
21057
|
isLast
|
|
20628
21058
|
});
|
|
20629
21059
|
}, [activeSelectionId, selectionRect, postToParent2]);
|
|
20630
|
-
return /* @__PURE__ */ jsxs10(
|
|
21060
|
+
return /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
20631
21061
|
hoverRect && /* @__PURE__ */ jsx19(
|
|
20632
21062
|
"div",
|
|
20633
21063
|
{
|
|
@@ -20664,7 +21094,7 @@ function AiSectionOverlay({
|
|
|
20664
21094
|
}
|
|
20665
21095
|
}
|
|
20666
21096
|
),
|
|
20667
|
-
reviewRect && /* @__PURE__ */ jsxs10(
|
|
21097
|
+
reviewRect && /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
20668
21098
|
subtractRect(reviewRect, navToggleHole).map((r2, i) => /* @__PURE__ */ jsx19(
|
|
20669
21099
|
"div",
|
|
20670
21100
|
{
|
|
@@ -20727,8 +21157,24 @@ function AiSectionOverlay({
|
|
|
20727
21157
|
}
|
|
20728
21158
|
|
|
20729
21159
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
20730
|
-
import { useCallback as useCallback3, useEffect as useEffect10, useRef as useRef5, useState as useState8 } from "react";
|
|
20731
|
-
import {
|
|
21160
|
+
import { useCallback as useCallback3, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
21161
|
+
import {
|
|
21162
|
+
AlignCenter,
|
|
21163
|
+
AlignLeft,
|
|
21164
|
+
AlignRight,
|
|
21165
|
+
ArrowLeft as ArrowLeft2,
|
|
21166
|
+
ArrowRight as ArrowRight2,
|
|
21167
|
+
Check as Check2,
|
|
21168
|
+
ChevronDown as ChevronDown3,
|
|
21169
|
+
Image as ImageIcon2,
|
|
21170
|
+
ImageMinus,
|
|
21171
|
+
ImagePlus,
|
|
21172
|
+
Link as LinkIcon,
|
|
21173
|
+
Minus,
|
|
21174
|
+
Palette,
|
|
21175
|
+
Plus as Plus2,
|
|
21176
|
+
Star
|
|
21177
|
+
} from "lucide-react";
|
|
20732
21178
|
|
|
20733
21179
|
// src/lib/ai-media-strip-tree.ts
|
|
20734
21180
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -20842,14 +21288,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
20842
21288
|
return true;
|
|
20843
21289
|
});
|
|
20844
21290
|
}
|
|
20845
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
20846
|
-
return withMediaStrip(tree, (block) => {
|
|
20847
|
-
const items = block.items;
|
|
20848
|
-
if (index < 0 || index >= items.length) return false;
|
|
20849
|
-
items[index] = { ...items[index], alt };
|
|
20850
|
-
return true;
|
|
20851
|
-
});
|
|
20852
|
-
}
|
|
20853
21291
|
function setMediaStripItemLink(tree, index, link) {
|
|
20854
21292
|
return withMediaStrip(tree, (block) => {
|
|
20855
21293
|
const items = block.items;
|
|
@@ -20867,11 +21305,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
20867
21305
|
});
|
|
20868
21306
|
}
|
|
20869
21307
|
|
|
21308
|
+
// src/ui/dialog.tsx
|
|
21309
|
+
import * as React9 from "react";
|
|
21310
|
+
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
21311
|
+
import { X as X2 } from "lucide-react";
|
|
21312
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
21313
|
+
function Dialog2({
|
|
21314
|
+
...props
|
|
21315
|
+
}) {
|
|
21316
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
21317
|
+
}
|
|
21318
|
+
function DialogPortal({
|
|
21319
|
+
...props
|
|
21320
|
+
}) {
|
|
21321
|
+
return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
|
|
21322
|
+
}
|
|
21323
|
+
function DialogOverlay({
|
|
21324
|
+
className,
|
|
21325
|
+
...props
|
|
21326
|
+
}) {
|
|
21327
|
+
return /* @__PURE__ */ jsx20(
|
|
21328
|
+
DialogPrimitive.Overlay,
|
|
21329
|
+
{
|
|
21330
|
+
"data-slot": "dialog-overlay",
|
|
21331
|
+
"data-ohw-link-modal-root": "",
|
|
21332
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21333
|
+
...props
|
|
21334
|
+
}
|
|
21335
|
+
);
|
|
21336
|
+
}
|
|
21337
|
+
var DialogContent = React9.forwardRef(
|
|
21338
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21339
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
21340
|
+
return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
|
|
21341
|
+
/* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21342
|
+
/* @__PURE__ */ jsxs11(
|
|
21343
|
+
DialogPrimitive.Content,
|
|
21344
|
+
{
|
|
21345
|
+
ref,
|
|
21346
|
+
"data-slot": "dialog-content",
|
|
21347
|
+
className: cn(
|
|
21348
|
+
positionMode,
|
|
21349
|
+
"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",
|
|
21350
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21351
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21352
|
+
className
|
|
21353
|
+
),
|
|
21354
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
21355
|
+
...props,
|
|
21356
|
+
children: [
|
|
21357
|
+
children,
|
|
21358
|
+
showCloseButton ? /* @__PURE__ */ jsx20(
|
|
21359
|
+
DialogPrimitive.Close,
|
|
21360
|
+
{
|
|
21361
|
+
type: "button",
|
|
21362
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21363
|
+
"aria-label": "Close",
|
|
21364
|
+
children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
|
|
21365
|
+
}
|
|
21366
|
+
) : null
|
|
21367
|
+
]
|
|
21368
|
+
}
|
|
21369
|
+
)
|
|
21370
|
+
] });
|
|
21371
|
+
}
|
|
21372
|
+
);
|
|
21373
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
21374
|
+
function DialogHeader({
|
|
21375
|
+
className,
|
|
21376
|
+
...props
|
|
21377
|
+
}) {
|
|
21378
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21379
|
+
}
|
|
21380
|
+
function DialogFooter({
|
|
21381
|
+
className,
|
|
21382
|
+
...props
|
|
21383
|
+
}) {
|
|
21384
|
+
return /* @__PURE__ */ jsx20(
|
|
21385
|
+
"div",
|
|
21386
|
+
{
|
|
21387
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
21388
|
+
...props
|
|
21389
|
+
}
|
|
21390
|
+
);
|
|
21391
|
+
}
|
|
21392
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
21393
|
+
DialogPrimitive.Title,
|
|
21394
|
+
{
|
|
21395
|
+
ref,
|
|
21396
|
+
className: cn(
|
|
21397
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21398
|
+
className
|
|
21399
|
+
),
|
|
21400
|
+
...props
|
|
21401
|
+
}
|
|
21402
|
+
));
|
|
21403
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21404
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
21405
|
+
DialogPrimitive.Description,
|
|
21406
|
+
{
|
|
21407
|
+
ref,
|
|
21408
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
21409
|
+
...props
|
|
21410
|
+
}
|
|
21411
|
+
));
|
|
21412
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
21413
|
+
var DialogClose = DialogPrimitive.Close;
|
|
21414
|
+
|
|
20870
21415
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
20871
|
-
import { Fragment as
|
|
20872
|
-
var PRIMARY3 = "#0885FE";
|
|
20873
|
-
var
|
|
20874
|
-
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
|
|
21416
|
+
import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
21417
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
21418
|
+
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]";
|
|
20875
21419
|
function findMediaStripItemElement(sectionId, index) {
|
|
20876
21420
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
20877
21421
|
if (!sectionEl2) return null;
|
|
@@ -20881,14 +21425,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
20881
21425
|
}
|
|
20882
21426
|
return null;
|
|
20883
21427
|
}
|
|
20884
|
-
function
|
|
20885
|
-
|
|
21428
|
+
function itemRefFromTarget(target) {
|
|
21429
|
+
if (!(target instanceof Element)) return null;
|
|
21430
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
21431
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
21432
|
+
if (!itemEl) return null;
|
|
21433
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21434
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
21435
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
21436
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
21437
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
21438
|
+
return { sectionId, index };
|
|
21439
|
+
}
|
|
21440
|
+
function sameRef(a, b) {
|
|
21441
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
21442
|
+
}
|
|
21443
|
+
function rectOf(el) {
|
|
20886
21444
|
if (!el) return null;
|
|
20887
21445
|
const r2 = el.getBoundingClientRect();
|
|
20888
21446
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
20889
21447
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
20890
21448
|
}
|
|
20891
|
-
function
|
|
21449
|
+
function readRect2(ref) {
|
|
21450
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
21451
|
+
}
|
|
21452
|
+
function readStripRect(ref) {
|
|
21453
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
21454
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
21455
|
+
}
|
|
21456
|
+
function useLiveItemRect(ref, strip = false) {
|
|
20892
21457
|
const [rect, setRect] = useState8(null);
|
|
20893
21458
|
useEffect10(() => {
|
|
20894
21459
|
if (!ref) {
|
|
@@ -20896,7 +21461,7 @@ function useLiveItemRect(ref) {
|
|
|
20896
21461
|
return;
|
|
20897
21462
|
}
|
|
20898
21463
|
const update = () => {
|
|
20899
|
-
const next = readRect2(ref);
|
|
21464
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
20900
21465
|
setRect(
|
|
20901
21466
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
20902
21467
|
);
|
|
@@ -20911,9 +21476,49 @@ function useLiveItemRect(ref) {
|
|
|
20911
21476
|
window.removeEventListener("resize", update);
|
|
20912
21477
|
clearInterval(interval);
|
|
20913
21478
|
};
|
|
20914
|
-
}, [ref?.sectionId, ref?.index]);
|
|
21479
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
20915
21480
|
return rect;
|
|
20916
21481
|
}
|
|
21482
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
21483
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
21484
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
21485
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
21486
|
+
const slotRef = useRef5(null);
|
|
21487
|
+
const [shift, setShift] = useState8(0);
|
|
21488
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
21489
|
+
useLayoutEffect4(() => {
|
|
21490
|
+
const slot = slotRef.current;
|
|
21491
|
+
if (!slot) return;
|
|
21492
|
+
const clamp = () => {
|
|
21493
|
+
const w = slot.offsetWidth;
|
|
21494
|
+
if (w <= 0) return;
|
|
21495
|
+
const half = w / 2;
|
|
21496
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
21497
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
21498
|
+
};
|
|
21499
|
+
clamp();
|
|
21500
|
+
const ro = new ResizeObserver(clamp);
|
|
21501
|
+
ro.observe(slot);
|
|
21502
|
+
return () => ro.disconnect();
|
|
21503
|
+
}, [centerX, children]);
|
|
21504
|
+
const mobile = window.innerWidth <= 480;
|
|
21505
|
+
return /* @__PURE__ */ jsx21(
|
|
21506
|
+
"div",
|
|
21507
|
+
{
|
|
21508
|
+
ref: slotRef,
|
|
21509
|
+
"data-ohw-bridge": "",
|
|
21510
|
+
"data-ohw-item-interaction": "",
|
|
21511
|
+
className: "pointer-events-auto fixed",
|
|
21512
|
+
style: {
|
|
21513
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
21514
|
+
left: centerX + shift,
|
|
21515
|
+
transform: "translate(-50%, -100%)",
|
|
21516
|
+
zIndex: 2147483645
|
|
21517
|
+
},
|
|
21518
|
+
children
|
|
21519
|
+
}
|
|
21520
|
+
);
|
|
21521
|
+
}
|
|
20917
21522
|
function requestValidateTree(postToParent2, tree) {
|
|
20918
21523
|
return new Promise((resolve) => {
|
|
20919
21524
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -20950,116 +21555,72 @@ function requestAssetPick(postToParent2) {
|
|
|
20950
21555
|
postToParent2({ type: "ow:asset-pick", id });
|
|
20951
21556
|
});
|
|
20952
21557
|
}
|
|
20953
|
-
function
|
|
21558
|
+
function ToolbarAction({
|
|
20954
21559
|
label,
|
|
20955
21560
|
onClick,
|
|
20956
|
-
disabled,
|
|
20957
|
-
active
|
|
21561
|
+
disabled = false,
|
|
21562
|
+
active = false,
|
|
21563
|
+
children
|
|
20958
21564
|
}) {
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
{
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
disabled,
|
|
20965
|
-
style: {
|
|
20966
|
-
height: 28,
|
|
20967
|
-
padding: "0 10px",
|
|
20968
|
-
display: "inline-flex",
|
|
20969
|
-
alignItems: "center",
|
|
20970
|
-
gap: 4,
|
|
20971
|
-
borderRadius: 999,
|
|
20972
|
-
border: "none",
|
|
20973
|
-
cursor: disabled ? "default" : "pointer",
|
|
20974
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
20975
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
20976
|
-
opacity: disabled ? 0.4 : 1,
|
|
20977
|
-
fontSize: 12,
|
|
20978
|
-
lineHeight: "16px",
|
|
20979
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
20980
|
-
whiteSpace: "nowrap",
|
|
20981
|
-
flex: "0 0 auto"
|
|
20982
|
-
},
|
|
20983
|
-
children: label
|
|
20984
|
-
}
|
|
20985
|
-
);
|
|
21565
|
+
const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
21566
|
+
return /* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
21567
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
|
|
21568
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
21569
|
+
] });
|
|
20986
21570
|
}
|
|
20987
|
-
function
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
},
|
|
21017
|
-
children: "Alt"
|
|
21018
|
-
}
|
|
21019
|
-
),
|
|
21020
|
-
/* @__PURE__ */ jsx20(
|
|
21021
|
-
"input",
|
|
21571
|
+
function ToolbarSeparator() {
|
|
21572
|
+
return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
21573
|
+
}
|
|
21574
|
+
function OptionMenu({
|
|
21575
|
+
label,
|
|
21576
|
+
value,
|
|
21577
|
+
options,
|
|
21578
|
+
onChange
|
|
21579
|
+
}) {
|
|
21580
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
21581
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
21582
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
21583
|
+
/* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
|
|
21584
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
21585
|
+
"button",
|
|
21586
|
+
{
|
|
21587
|
+
type: "button",
|
|
21588
|
+
"aria-label": label,
|
|
21589
|
+
className: "inline-flex h-8 min-w-[76px] items-center gap-[7px] rounded-[6px] bg-transparent px-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted data-[state=open]:bg-muted",
|
|
21590
|
+
children: [
|
|
21591
|
+
/* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
|
|
21592
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
|
|
21593
|
+
]
|
|
21594
|
+
}
|
|
21595
|
+
) }),
|
|
21596
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
21597
|
+
const selected = option.value === value;
|
|
21598
|
+
return /* @__PURE__ */ jsxs12(
|
|
21599
|
+
DropdownMenuItem,
|
|
21022
21600
|
{
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
"aria-label": "Image alt text",
|
|
21038
|
-
style: {
|
|
21039
|
-
flex: 1,
|
|
21040
|
-
minWidth: 0,
|
|
21041
|
-
border: "none",
|
|
21042
|
-
outline: "none",
|
|
21043
|
-
background: "transparent",
|
|
21044
|
-
fontSize: 12,
|
|
21045
|
-
lineHeight: "16px",
|
|
21046
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21047
|
-
color: "#1f2937"
|
|
21048
|
-
}
|
|
21049
|
-
}
|
|
21050
|
-
)
|
|
21051
|
-
]
|
|
21052
|
-
}
|
|
21053
|
-
);
|
|
21601
|
+
role: "menuitemradio",
|
|
21602
|
+
"aria-checked": selected,
|
|
21603
|
+
onSelect: () => onChange(option.value),
|
|
21604
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
21605
|
+
children: [
|
|
21606
|
+
/* @__PURE__ */ jsx21("span", { children: option.label }),
|
|
21607
|
+
selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
|
|
21608
|
+
]
|
|
21609
|
+
},
|
|
21610
|
+
option.value
|
|
21611
|
+
);
|
|
21612
|
+
}) })
|
|
21613
|
+
] })
|
|
21614
|
+
] });
|
|
21054
21615
|
}
|
|
21055
21616
|
var VARIANTS = [
|
|
21056
21617
|
{ value: "logos", label: "Logos" },
|
|
21057
21618
|
{ value: "reel", label: "Reel" }
|
|
21058
21619
|
];
|
|
21059
21620
|
var ALIGNS = [
|
|
21060
|
-
{ value: "left", label: "
|
|
21061
|
-
{ value: "center", label: "
|
|
21062
|
-
{ value: "right", label: "
|
|
21621
|
+
{ value: "left", label: "Align left", Icon: AlignLeft },
|
|
21622
|
+
{ value: "center", label: "Align center", Icon: AlignCenter },
|
|
21623
|
+
{ value: "right", label: "Align right", Icon: AlignRight }
|
|
21063
21624
|
];
|
|
21064
21625
|
var HOVERS = [
|
|
21065
21626
|
{ value: "none", label: "None" },
|
|
@@ -21067,104 +21628,104 @@ var HOVERS = [
|
|
|
21067
21628
|
{ value: "zoom", label: "Zoom" },
|
|
21068
21629
|
{ value: "fade", label: "Fade" }
|
|
21069
21630
|
];
|
|
21070
|
-
var TREATMENTS = [
|
|
21071
|
-
{ value: "color", label: "Color" },
|
|
21072
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
21073
|
-
];
|
|
21074
21631
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
21075
|
-
function
|
|
21076
|
-
|
|
21632
|
+
function LinkModal({
|
|
21633
|
+
href,
|
|
21634
|
+
linkTarget,
|
|
21635
|
+
onClose,
|
|
21636
|
+
onSave
|
|
21637
|
+
}) {
|
|
21638
|
+
const [draft, setDraft] = useState8(href);
|
|
21639
|
+
const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
|
|
21077
21640
|
const [invalid, setInvalid] = useState8(false);
|
|
21078
|
-
|
|
21079
|
-
setDraft(value);
|
|
21080
|
-
setInvalid(false);
|
|
21081
|
-
}, [value]);
|
|
21082
|
-
const commit2 = () => {
|
|
21641
|
+
const save = () => {
|
|
21083
21642
|
const next = draft.trim();
|
|
21084
|
-
if (next
|
|
21085
|
-
|
|
21086
|
-
|
|
21087
|
-
onCommit(next);
|
|
21088
|
-
};
|
|
21089
|
-
return /* @__PURE__ */ jsxs11(
|
|
21090
|
-
"div",
|
|
21091
|
-
{
|
|
21092
|
-
style: {
|
|
21093
|
-
display: "flex",
|
|
21094
|
-
alignItems: "center",
|
|
21095
|
-
gap: 6,
|
|
21096
|
-
height: 28,
|
|
21097
|
-
padding: "0 12px",
|
|
21098
|
-
borderRadius: 999,
|
|
21099
|
-
background: "#ffffff",
|
|
21100
|
-
width: "100%",
|
|
21101
|
-
maxWidth: 260,
|
|
21102
|
-
boxSizing: "border-box",
|
|
21103
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
21104
|
-
},
|
|
21105
|
-
children: [
|
|
21106
|
-
/* @__PURE__ */ jsx20(
|
|
21107
|
-
"span",
|
|
21108
|
-
{
|
|
21109
|
-
style: {
|
|
21110
|
-
flex: "0 0 auto",
|
|
21111
|
-
color: OHW_BLUE_DARK,
|
|
21112
|
-
fontSize: 10,
|
|
21113
|
-
fontWeight: 700,
|
|
21114
|
-
textTransform: "uppercase",
|
|
21115
|
-
letterSpacing: 0.4
|
|
21116
|
-
},
|
|
21117
|
-
children: "Link"
|
|
21118
|
-
}
|
|
21119
|
-
),
|
|
21120
|
-
/* @__PURE__ */ jsx20(
|
|
21121
|
-
"input",
|
|
21122
|
-
{
|
|
21123
|
-
type: "text",
|
|
21124
|
-
inputMode: "url",
|
|
21125
|
-
value: draft,
|
|
21126
|
-
onChange: (e) => setDraft(e.target.value),
|
|
21127
|
-
onBlur: commit2,
|
|
21128
|
-
onKeyDown: (e) => {
|
|
21129
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
21130
|
-
if (e.key === "Escape") {
|
|
21131
|
-
setDraft(value);
|
|
21132
|
-
setInvalid(false);
|
|
21133
|
-
e.currentTarget.blur();
|
|
21134
|
-
}
|
|
21135
|
-
},
|
|
21136
|
-
placeholder: "https://example.com",
|
|
21137
|
-
"aria-label": "Image link URL",
|
|
21138
|
-
"aria-invalid": invalid,
|
|
21139
|
-
style: {
|
|
21140
|
-
flex: 1,
|
|
21141
|
-
minWidth: 0,
|
|
21142
|
-
border: "none",
|
|
21143
|
-
outline: "none",
|
|
21144
|
-
background: "transparent",
|
|
21145
|
-
fontSize: 12,
|
|
21146
|
-
lineHeight: "16px",
|
|
21147
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21148
|
-
color: "#1f2937"
|
|
21149
|
-
}
|
|
21150
|
-
}
|
|
21151
|
-
)
|
|
21152
|
-
]
|
|
21643
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
21644
|
+
setInvalid(true);
|
|
21645
|
+
return;
|
|
21153
21646
|
}
|
|
21154
|
-
|
|
21647
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
21648
|
+
onClose();
|
|
21649
|
+
};
|
|
21650
|
+
return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
21651
|
+
/* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
21652
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
|
|
21653
|
+
/* @__PURE__ */ jsx21(
|
|
21654
|
+
"input",
|
|
21655
|
+
{
|
|
21656
|
+
autoFocus: true,
|
|
21657
|
+
type: "text",
|
|
21658
|
+
inputMode: "url",
|
|
21659
|
+
value: draft,
|
|
21660
|
+
onChange: (e) => {
|
|
21661
|
+
setDraft(e.target.value);
|
|
21662
|
+
setInvalid(false);
|
|
21663
|
+
},
|
|
21664
|
+
onKeyDown: (e) => {
|
|
21665
|
+
if (e.key === "Enter") save();
|
|
21666
|
+
},
|
|
21667
|
+
placeholder: "https://example.com",
|
|
21668
|
+
"aria-label": "Image link URL",
|
|
21669
|
+
"aria-invalid": invalid,
|
|
21670
|
+
className: cn(
|
|
21671
|
+
"h-9 w-full rounded-[6px] border border-border bg-background px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:border-bridge-primary",
|
|
21672
|
+
invalid && "border-destructive focus:border-destructive"
|
|
21673
|
+
)
|
|
21674
|
+
}
|
|
21675
|
+
),
|
|
21676
|
+
invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
21677
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
21678
|
+
/* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
21679
|
+
"Open in new tab"
|
|
21680
|
+
] })
|
|
21681
|
+
] }),
|
|
21682
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
21683
|
+
href && /* @__PURE__ */ jsx21(
|
|
21684
|
+
"button",
|
|
21685
|
+
{
|
|
21686
|
+
type: "button",
|
|
21687
|
+
onClick: () => {
|
|
21688
|
+
onSave("", "new-tab");
|
|
21689
|
+
onClose();
|
|
21690
|
+
},
|
|
21691
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
21692
|
+
children: "Remove link"
|
|
21693
|
+
}
|
|
21694
|
+
),
|
|
21695
|
+
/* @__PURE__ */ jsx21(
|
|
21696
|
+
"button",
|
|
21697
|
+
{
|
|
21698
|
+
type: "button",
|
|
21699
|
+
onClick: onClose,
|
|
21700
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
21701
|
+
children: "Cancel"
|
|
21702
|
+
}
|
|
21703
|
+
),
|
|
21704
|
+
/* @__PURE__ */ jsx21(
|
|
21705
|
+
"button",
|
|
21706
|
+
{
|
|
21707
|
+
type: "button",
|
|
21708
|
+
onClick: save,
|
|
21709
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
21710
|
+
children: "Save"
|
|
21711
|
+
}
|
|
21712
|
+
)
|
|
21713
|
+
] })
|
|
21714
|
+
] }) });
|
|
21155
21715
|
}
|
|
21156
21716
|
function MediaStripToolbar({
|
|
21157
21717
|
entry,
|
|
21158
21718
|
index,
|
|
21159
21719
|
pending,
|
|
21160
21720
|
error,
|
|
21721
|
+
itemEditOn,
|
|
21722
|
+
onToggleItemEdit,
|
|
21161
21723
|
onSetVariant,
|
|
21162
21724
|
onSetAlign,
|
|
21163
21725
|
onSetHover,
|
|
21164
21726
|
onSetTreatment,
|
|
21165
21727
|
onResize,
|
|
21166
|
-
|
|
21167
|
-
onSetLink,
|
|
21728
|
+
onOpenLink,
|
|
21168
21729
|
onAddItem,
|
|
21169
21730
|
onRemoveItem,
|
|
21170
21731
|
onChangeImage,
|
|
@@ -21173,81 +21734,102 @@ function MediaStripToolbar({
|
|
|
21173
21734
|
}) {
|
|
21174
21735
|
const items = mediaStripItems(entry.tree);
|
|
21175
21736
|
const itemCount = items.length;
|
|
21176
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
21177
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
21178
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
21179
21737
|
const slots = findMediaStripSlots(entry.tree);
|
|
21180
21738
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
21181
21739
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
21182
21740
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
21183
21741
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
21184
21742
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
21185
|
-
const
|
|
21186
|
-
const
|
|
21187
|
-
|
|
21188
|
-
gap: 6,
|
|
21189
|
-
flexWrap: "nowrap",
|
|
21190
|
-
justifyContent: "center",
|
|
21191
|
-
overflowX: "auto",
|
|
21192
|
-
WebkitOverflowScrolling: "touch",
|
|
21193
|
-
width: "100%",
|
|
21194
|
-
scrollbarWidth: "none"
|
|
21195
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
21196
|
-
return /* @__PURE__ */ jsxs11(
|
|
21743
|
+
const mobile = window.innerWidth <= 480;
|
|
21744
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
21745
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
|
|
21197
21746
|
"div",
|
|
21198
21747
|
{
|
|
21199
21748
|
"data-ohw-bridge": "",
|
|
21200
21749
|
"data-ohw-toolbar": "",
|
|
21201
21750
|
onMouseDown: (e) => e.stopPropagation(),
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
flexDirection: "column",
|
|
21205
|
-
gap: 6,
|
|
21206
|
-
alignItems: "center",
|
|
21207
|
-
background: OHW_BLUE,
|
|
21208
|
-
padding: 8,
|
|
21209
|
-
borderRadius: 12,
|
|
21210
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
21211
|
-
pointerEvents: pending ? "none" : "auto",
|
|
21212
|
-
opacity: pending ? 0.6 : 1,
|
|
21213
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
21214
|
-
},
|
|
21751
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
21752
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
21215
21753
|
children: [
|
|
21216
|
-
/* @__PURE__ */
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
|
|
21220
|
-
|
|
21221
|
-
|
|
21222
|
-
|
|
21223
|
-
|
|
21224
|
-
|
|
21225
|
-
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
|
|
21229
|
-
|
|
21230
|
-
|
|
21231
|
-
|
|
21232
|
-
|
|
21233
|
-
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21237
|
-
|
|
21238
|
-
|
|
21239
|
-
|
|
21240
|
-
|
|
21241
|
-
|
|
21242
|
-
|
|
21243
|
-
|
|
21244
|
-
|
|
21245
|
-
|
|
21246
|
-
|
|
21247
|
-
|
|
21754
|
+
/* @__PURE__ */ jsxs12(
|
|
21755
|
+
"div",
|
|
21756
|
+
{
|
|
21757
|
+
className: cn(
|
|
21758
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
21759
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
21760
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
21761
|
+
),
|
|
21762
|
+
children: [
|
|
21763
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
21764
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
21765
|
+
CustomToolbarButton,
|
|
21766
|
+
{
|
|
21767
|
+
type: "button",
|
|
21768
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
21769
|
+
"aria-pressed": itemEditOn,
|
|
21770
|
+
onClick: onToggleItemEdit,
|
|
21771
|
+
className: "group size-8",
|
|
21772
|
+
children: /* @__PURE__ */ jsx21(
|
|
21773
|
+
Star,
|
|
21774
|
+
{
|
|
21775
|
+
size: 16,
|
|
21776
|
+
fill: "currentColor",
|
|
21777
|
+
strokeWidth: 0,
|
|
21778
|
+
className: cn(
|
|
21779
|
+
"transition-colors",
|
|
21780
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
21781
|
+
),
|
|
21782
|
+
style: { pointerEvents: "none" }
|
|
21783
|
+
}
|
|
21784
|
+
)
|
|
21785
|
+
}
|
|
21786
|
+
) }),
|
|
21787
|
+
/* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
21788
|
+
] }),
|
|
21789
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
21790
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21791
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21792
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21793
|
+
/* @__PURE__ */ jsx21(
|
|
21794
|
+
ToolbarAction,
|
|
21795
|
+
{
|
|
21796
|
+
label: gatedLabel("Move right"),
|
|
21797
|
+
onClick: onMoveRight,
|
|
21798
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
21799
|
+
children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
|
|
21800
|
+
}
|
|
21801
|
+
),
|
|
21802
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21803
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
21804
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
21805
|
+
/* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
21806
|
+
/* @__PURE__ */ jsx21(
|
|
21807
|
+
ToolbarAction,
|
|
21808
|
+
{
|
|
21809
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
21810
|
+
active: treatment === "grayscale",
|
|
21811
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
21812
|
+
children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
21813
|
+
}
|
|
21814
|
+
),
|
|
21815
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
21816
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
21817
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
21818
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21819
|
+
/* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
21820
|
+
sizeValue,
|
|
21821
|
+
"px"
|
|
21822
|
+
] }),
|
|
21823
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21824
|
+
/* @__PURE__ */ jsx21(ToolbarSeparator, {}),
|
|
21825
|
+
/* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
21826
|
+
]
|
|
21827
|
+
}
|
|
21828
|
+
),
|
|
21829
|
+
error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
21248
21830
|
]
|
|
21249
21831
|
}
|
|
21250
|
-
);
|
|
21832
|
+
) });
|
|
21251
21833
|
}
|
|
21252
21834
|
function findMediaStripSlots(tree) {
|
|
21253
21835
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -21266,31 +21848,23 @@ function AiMediaStripOverlay({
|
|
|
21266
21848
|
}) {
|
|
21267
21849
|
const [hover, setHover] = useState8(null);
|
|
21268
21850
|
const [active, setActive] = useState8(null);
|
|
21851
|
+
const [itemEditOn, setItemEditOn] = useState8(false);
|
|
21852
|
+
const [linkOpen, setLinkOpen] = useState8(false);
|
|
21269
21853
|
const [pending, setPending] = useState8(false);
|
|
21270
21854
|
const [error, setError] = useState8(null);
|
|
21271
21855
|
const activeRef = useRef5(null);
|
|
21272
21856
|
activeRef.current = active;
|
|
21857
|
+
const linkOpenRef = useRef5(false);
|
|
21858
|
+
linkOpenRef.current = linkOpen;
|
|
21273
21859
|
useEffect10(() => {
|
|
21274
21860
|
const onMove = (e) => {
|
|
21861
|
+
const ref = itemRefFromTarget(e.target);
|
|
21275
21862
|
const t = e.target;
|
|
21276
|
-
|
|
21277
|
-
|
|
21278
|
-
|
|
21279
|
-
|
|
21280
|
-
|
|
21281
|
-
if (!itemEl) {
|
|
21282
|
-
setHover(null);
|
|
21283
|
-
return;
|
|
21284
|
-
}
|
|
21285
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21286
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
21287
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
21288
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
21289
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
21290
|
-
setHover(null);
|
|
21291
|
-
return;
|
|
21292
|
-
}
|
|
21293
|
-
setHover({ sectionId, index });
|
|
21863
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
21864
|
+
setHover((prev) => {
|
|
21865
|
+
const next = ref && !overEditable ? ref : null;
|
|
21866
|
+
return sameRef(prev, next) ? prev : next;
|
|
21867
|
+
});
|
|
21294
21868
|
};
|
|
21295
21869
|
const onLeave = () => setHover(null);
|
|
21296
21870
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -21302,23 +21876,25 @@ function AiMediaStripOverlay({
|
|
|
21302
21876
|
}, []);
|
|
21303
21877
|
useEffect10(() => {
|
|
21304
21878
|
const onClick = (e) => {
|
|
21305
|
-
const current = activeRef.current;
|
|
21306
|
-
if (!current) return;
|
|
21307
21879
|
const t = e.target;
|
|
21308
|
-
if (!(t instanceof
|
|
21309
|
-
if (t.closest(
|
|
21310
|
-
const
|
|
21311
|
-
if (
|
|
21312
|
-
|
|
21880
|
+
if (!(t instanceof Element)) return;
|
|
21881
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
21882
|
+
const ref = itemRefFromTarget(t);
|
|
21883
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
21884
|
+
if (ref) clearInteractionChromeRef.current();
|
|
21885
|
+
setItemEditOn(false);
|
|
21313
21886
|
setError(null);
|
|
21887
|
+
setActive(ref);
|
|
21314
21888
|
};
|
|
21315
21889
|
document.addEventListener("click", onClick, true);
|
|
21316
21890
|
return () => document.removeEventListener("click", onClick, true);
|
|
21317
|
-
}, []);
|
|
21891
|
+
}, [clearInteractionChromeRef]);
|
|
21318
21892
|
useEffect10(() => {
|
|
21319
21893
|
const onBlur = () => {
|
|
21320
21894
|
if (!activeRef.current) return;
|
|
21321
21895
|
setActive(null);
|
|
21896
|
+
setItemEditOn(false);
|
|
21897
|
+
setLinkOpen(false);
|
|
21322
21898
|
setError(null);
|
|
21323
21899
|
};
|
|
21324
21900
|
window.addEventListener("blur", onBlur);
|
|
@@ -21328,7 +21904,10 @@ function AiMediaStripOverlay({
|
|
|
21328
21904
|
const onKeyDown = (e) => {
|
|
21329
21905
|
if (e.key !== "Escape") return;
|
|
21330
21906
|
if (!activeRef.current) return;
|
|
21907
|
+
if (linkOpenRef.current) return;
|
|
21908
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
21331
21909
|
setActive(null);
|
|
21910
|
+
setItemEditOn(false);
|
|
21332
21911
|
setError(null);
|
|
21333
21912
|
};
|
|
21334
21913
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -21362,137 +21941,133 @@ function AiMediaStripOverlay({
|
|
|
21362
21941
|
tree: nextTree,
|
|
21363
21942
|
label: entry.label,
|
|
21364
21943
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
21365
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
21944
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
21945
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
21946
|
+
// on every edit reads as the section jumping around.
|
|
21947
|
+
skipScrollIntoView: true
|
|
21366
21948
|
});
|
|
21367
21949
|
return true;
|
|
21368
21950
|
},
|
|
21369
21951
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
21370
21952
|
);
|
|
21371
21953
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
21372
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
21373
21954
|
const activeItemRect = useLiveItemRect(active);
|
|
21374
|
-
const
|
|
21375
|
-
const
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21384
|
-
|
|
21385
|
-
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21405
|
-
|
|
21406
|
-
|
|
21407
|
-
|
|
21408
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
|
|
21409
|
-
ItemInteractionLayer,
|
|
21410
|
-
{
|
|
21411
|
-
rect: activeItemRect,
|
|
21412
|
-
state: toolbarState,
|
|
21413
|
-
toolbar: /* @__PURE__ */ jsx20(
|
|
21414
|
-
MediaStripToolbar,
|
|
21415
|
-
{
|
|
21416
|
-
entry: activeEntry,
|
|
21417
|
-
index: active.index,
|
|
21418
|
-
pending,
|
|
21419
|
-
error,
|
|
21420
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
21421
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
21422
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
21423
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
21424
|
-
onResize: (delta) => {
|
|
21425
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
21426
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
21427
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
21428
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
21429
|
-
},
|
|
21430
|
-
onSetAlt: (alt) => {
|
|
21431
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
21432
|
-
},
|
|
21433
|
-
onSetLink: (href, linkTarget) => {
|
|
21955
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
21956
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
21957
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
21958
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
21959
|
+
const activeHref = activeItem?.href ?? "";
|
|
21960
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
21961
|
+
return /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
21962
|
+
hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
21963
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
21964
|
+
/* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
21965
|
+
/* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
|
|
21966
|
+
MediaStripToolbar,
|
|
21967
|
+
{
|
|
21968
|
+
entry: activeEntry,
|
|
21969
|
+
index: active.index,
|
|
21970
|
+
pending,
|
|
21971
|
+
error,
|
|
21972
|
+
itemEditOn,
|
|
21973
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
21974
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
21975
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
21976
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
21977
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
21978
|
+
onResize: (delta) => {
|
|
21979
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
21980
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
21981
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
21982
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
21983
|
+
},
|
|
21984
|
+
onOpenLink: () => setLinkOpen(true),
|
|
21985
|
+
onAddItem: () => {
|
|
21986
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
21987
|
+
if (!picked) return;
|
|
21988
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
21434
21989
|
void runMutation(
|
|
21435
21990
|
active.sectionId,
|
|
21436
|
-
(tree) =>
|
|
21437
|
-
|
|
21438
|
-
|
|
21439
|
-
|
|
21440
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
21441
|
-
if (!picked) return;
|
|
21442
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
21443
|
-
void runMutation(
|
|
21444
|
-
active.sectionId,
|
|
21445
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
21446
|
-
{ [picked.assetId]: picked.url }
|
|
21447
|
-
).then((applied) => {
|
|
21448
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21449
|
-
});
|
|
21991
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
21992
|
+
{ [picked.assetId]: picked.url }
|
|
21993
|
+
).then((applied) => {
|
|
21994
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21450
21995
|
});
|
|
21451
|
-
}
|
|
21452
|
-
|
|
21453
|
-
|
|
21454
|
-
|
|
21455
|
-
|
|
21456
|
-
|
|
21457
|
-
|
|
21458
|
-
|
|
21459
|
-
|
|
21460
|
-
});
|
|
21461
|
-
},
|
|
21462
|
-
onRemoveItem: () => {
|
|
21463
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
21464
|
-
(applied) => {
|
|
21465
|
-
if (applied) setActive(null);
|
|
21466
|
-
}
|
|
21467
|
-
);
|
|
21468
|
-
},
|
|
21469
|
-
onMoveLeft: () => {
|
|
21470
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
21471
|
-
(applied) => {
|
|
21472
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
21473
|
-
}
|
|
21474
|
-
);
|
|
21475
|
-
},
|
|
21476
|
-
onMoveRight: () => {
|
|
21477
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
21478
|
-
(applied) => {
|
|
21479
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21480
|
-
}
|
|
21996
|
+
});
|
|
21997
|
+
},
|
|
21998
|
+
onChangeImage: () => {
|
|
21999
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
22000
|
+
if (!picked) return;
|
|
22001
|
+
void runMutation(
|
|
22002
|
+
active.sectionId,
|
|
22003
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
22004
|
+
{ [picked.assetId]: picked.url }
|
|
21481
22005
|
);
|
|
21482
|
-
}
|
|
22006
|
+
});
|
|
22007
|
+
},
|
|
22008
|
+
onRemoveItem: () => {
|
|
22009
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
22010
|
+
(applied) => {
|
|
22011
|
+
if (applied) setActive(null);
|
|
22012
|
+
}
|
|
22013
|
+
);
|
|
22014
|
+
},
|
|
22015
|
+
onMoveLeft: () => {
|
|
22016
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
22017
|
+
(applied) => {
|
|
22018
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
22019
|
+
}
|
|
22020
|
+
);
|
|
22021
|
+
},
|
|
22022
|
+
onMoveRight: () => {
|
|
22023
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
22024
|
+
(applied) => {
|
|
22025
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
22026
|
+
}
|
|
22027
|
+
);
|
|
21483
22028
|
}
|
|
21484
|
-
|
|
21485
|
-
}
|
|
21486
|
-
|
|
22029
|
+
}
|
|
22030
|
+
) }),
|
|
22031
|
+
/* @__PURE__ */ jsx21(
|
|
22032
|
+
"div",
|
|
22033
|
+
{
|
|
22034
|
+
"data-ohw-bridge": "",
|
|
22035
|
+
"data-ohw-item-interaction": "",
|
|
22036
|
+
"aria-hidden": true,
|
|
22037
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
22038
|
+
style: {
|
|
22039
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
22040
|
+
left: activeItemRect.left - 5,
|
|
22041
|
+
background: PRIMARY3,
|
|
22042
|
+
zIndex: 2147483644
|
|
22043
|
+
},
|
|
22044
|
+
children: "Media item"
|
|
22045
|
+
}
|
|
22046
|
+
),
|
|
22047
|
+
linkOpen && /* @__PURE__ */ jsx21(
|
|
22048
|
+
LinkModal,
|
|
22049
|
+
{
|
|
22050
|
+
href: activeHref,
|
|
22051
|
+
linkTarget: activeTarget,
|
|
22052
|
+
onClose: () => setLinkOpen(false),
|
|
22053
|
+
onSave: (href, linkTarget) => {
|
|
22054
|
+
void runMutation(
|
|
22055
|
+
active.sectionId,
|
|
22056
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
22057
|
+
);
|
|
22058
|
+
}
|
|
22059
|
+
}
|
|
22060
|
+
)
|
|
22061
|
+
] })
|
|
21487
22062
|
] });
|
|
21488
22063
|
}
|
|
21489
22064
|
|
|
21490
22065
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
21491
|
-
import { useCallback as useCallback4, useEffect as useEffect11, useLayoutEffect as
|
|
21492
|
-
import { Check as
|
|
21493
|
-
import { Fragment as
|
|
22066
|
+
import { useCallback as useCallback4, useEffect as useEffect11, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
22067
|
+
import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
|
|
22068
|
+
import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
21494
22069
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
21495
|
-
var
|
|
22070
|
+
var CHROME_SELECTOR2 = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
|
|
21496
22071
|
function findPricingCardElement(sectionId, index) {
|
|
21497
22072
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
21498
22073
|
if (!sectionEl2) return null;
|
|
@@ -21504,7 +22079,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
21504
22079
|
}
|
|
21505
22080
|
function cardRefFromTarget(target) {
|
|
21506
22081
|
if (!(target instanceof Element)) return null;
|
|
21507
|
-
if (target.closest(
|
|
22082
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
21508
22083
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
21509
22084
|
if (!cardEl) return null;
|
|
21510
22085
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -21514,21 +22089,21 @@ function cardRefFromTarget(target) {
|
|
|
21514
22089
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
21515
22090
|
return { sectionId, index };
|
|
21516
22091
|
}
|
|
21517
|
-
function
|
|
22092
|
+
function sameRef2(a, b) {
|
|
21518
22093
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
21519
22094
|
}
|
|
21520
|
-
function
|
|
22095
|
+
function rectOf2(el) {
|
|
21521
22096
|
if (!el) return null;
|
|
21522
22097
|
const r2 = el.getBoundingClientRect();
|
|
21523
22098
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
21524
22099
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
21525
22100
|
}
|
|
21526
22101
|
function readRect3(ref) {
|
|
21527
|
-
return
|
|
22102
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
21528
22103
|
}
|
|
21529
22104
|
function readGridRect(ref) {
|
|
21530
22105
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
21531
|
-
return
|
|
22106
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
21532
22107
|
}
|
|
21533
22108
|
function useLiveCardRect(ref, grid = false) {
|
|
21534
22109
|
const [rect, setRect] = useState9(null);
|
|
@@ -21558,19 +22133,19 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
21558
22133
|
}
|
|
21559
22134
|
var TOOLBAR_GRID_GAP = 52;
|
|
21560
22135
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
21561
|
-
var
|
|
22136
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
21562
22137
|
function GridToolbarSlot({ gridRect, children }) {
|
|
21563
22138
|
const slotRef = useRef6(null);
|
|
21564
22139
|
const [shift, setShift] = useState9(0);
|
|
21565
22140
|
const centerX = gridRect.left + gridRect.width / 2;
|
|
21566
|
-
|
|
22141
|
+
useLayoutEffect5(() => {
|
|
21567
22142
|
const slot = slotRef.current;
|
|
21568
22143
|
if (!slot) return;
|
|
21569
22144
|
const clamp = () => {
|
|
21570
22145
|
const w = slot.offsetWidth;
|
|
21571
22146
|
if (w <= 0) return;
|
|
21572
22147
|
const half = w / 2;
|
|
21573
|
-
const clamped = Math.max(
|
|
22148
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
21574
22149
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
21575
22150
|
};
|
|
21576
22151
|
clamp();
|
|
@@ -21579,7 +22154,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
21579
22154
|
return () => ro.disconnect();
|
|
21580
22155
|
}, [centerX, children]);
|
|
21581
22156
|
const mobile = window.innerWidth <= 480;
|
|
21582
|
-
return /* @__PURE__ */
|
|
22157
|
+
return /* @__PURE__ */ jsx22(
|
|
21583
22158
|
"div",
|
|
21584
22159
|
{
|
|
21585
22160
|
ref: slotRef,
|
|
@@ -21614,7 +22189,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
21614
22189
|
});
|
|
21615
22190
|
}
|
|
21616
22191
|
function StyleSwatch({ style }) {
|
|
21617
|
-
return /* @__PURE__ */
|
|
22192
|
+
return /* @__PURE__ */ jsx22(
|
|
21618
22193
|
"span",
|
|
21619
22194
|
{
|
|
21620
22195
|
"aria-hidden": true,
|
|
@@ -21628,35 +22203,35 @@ function StyleSwatch({ style }) {
|
|
|
21628
22203
|
);
|
|
21629
22204
|
}
|
|
21630
22205
|
function ButtonGlyph() {
|
|
21631
|
-
return /* @__PURE__ */
|
|
21632
|
-
/* @__PURE__ */
|
|
21633
|
-
/* @__PURE__ */
|
|
22206
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
22207
|
+
/* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
22208
|
+
/* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
21634
22209
|
] });
|
|
21635
22210
|
}
|
|
21636
22211
|
function FeatureGlyph({ mode }) {
|
|
21637
|
-
return /* @__PURE__ */
|
|
21638
|
-
/* @__PURE__ */
|
|
21639
|
-
/* @__PURE__ */
|
|
21640
|
-
/* @__PURE__ */
|
|
21641
|
-
/* @__PURE__ */
|
|
21642
|
-
/* @__PURE__ */
|
|
21643
|
-
mode === "add" && /* @__PURE__ */
|
|
22212
|
+
return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
22213
|
+
/* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
22214
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
22215
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
22216
|
+
/* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
22217
|
+
/* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
22218
|
+
mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
21644
22219
|
] });
|
|
21645
22220
|
}
|
|
21646
|
-
function
|
|
22221
|
+
function ToolbarAction2({
|
|
21647
22222
|
label,
|
|
21648
22223
|
onClick,
|
|
21649
22224
|
disabled = false,
|
|
21650
22225
|
children
|
|
21651
22226
|
}) {
|
|
21652
|
-
const button = /* @__PURE__ */
|
|
21653
|
-
return /* @__PURE__ */
|
|
21654
|
-
/* @__PURE__ */
|
|
21655
|
-
/* @__PURE__ */
|
|
22227
|
+
const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
22228
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
22229
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
|
|
22230
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
21656
22231
|
] });
|
|
21657
22232
|
}
|
|
21658
|
-
function
|
|
21659
|
-
return /* @__PURE__ */
|
|
22233
|
+
function ToolbarSeparator2() {
|
|
22234
|
+
return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
21660
22235
|
}
|
|
21661
22236
|
function CardStyleMenu({
|
|
21662
22237
|
value,
|
|
@@ -21664,7 +22239,7 @@ function CardStyleMenu({
|
|
|
21664
22239
|
disabled = false
|
|
21665
22240
|
}) {
|
|
21666
22241
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
21667
|
-
const trigger = /* @__PURE__ */
|
|
22242
|
+
const trigger = /* @__PURE__ */ jsxs13(
|
|
21668
22243
|
"button",
|
|
21669
22244
|
{
|
|
21670
22245
|
type: "button",
|
|
@@ -21675,28 +22250,28 @@ function CardStyleMenu({
|
|
|
21675
22250
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
21676
22251
|
),
|
|
21677
22252
|
children: [
|
|
21678
|
-
/* @__PURE__ */
|
|
21679
|
-
/* @__PURE__ */
|
|
21680
|
-
/* @__PURE__ */
|
|
22253
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
|
|
22254
|
+
/* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
|
|
22255
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
|
|
21681
22256
|
]
|
|
21682
22257
|
}
|
|
21683
22258
|
);
|
|
21684
22259
|
if (disabled) {
|
|
21685
|
-
return /* @__PURE__ */
|
|
21686
|
-
/* @__PURE__ */
|
|
21687
|
-
/* @__PURE__ */
|
|
21688
|
-
/* @__PURE__ */
|
|
21689
|
-
/* @__PURE__ */
|
|
22260
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
22261
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
22262
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
22263
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
|
|
22264
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
21690
22265
|
] })
|
|
21691
22266
|
] });
|
|
21692
22267
|
}
|
|
21693
|
-
return /* @__PURE__ */
|
|
21694
|
-
/* @__PURE__ */
|
|
21695
|
-
/* @__PURE__ */
|
|
21696
|
-
/* @__PURE__ */
|
|
21697
|
-
/* @__PURE__ */
|
|
22268
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
22269
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
22270
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
22271
|
+
/* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
22272
|
+
/* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
21698
22273
|
const selected = style.value === value;
|
|
21699
|
-
return /* @__PURE__ */
|
|
22274
|
+
return /* @__PURE__ */ jsxs13(
|
|
21700
22275
|
DropdownMenuItem,
|
|
21701
22276
|
{
|
|
21702
22277
|
role: "menuitemradio",
|
|
@@ -21704,9 +22279,9 @@ function CardStyleMenu({
|
|
|
21704
22279
|
onSelect: () => onChange(style.value),
|
|
21705
22280
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
21706
22281
|
children: [
|
|
21707
|
-
/* @__PURE__ */
|
|
21708
|
-
/* @__PURE__ */
|
|
21709
|
-
selected && /* @__PURE__ */
|
|
22282
|
+
/* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
|
|
22283
|
+
/* @__PURE__ */ jsx22("span", { children: style.label }),
|
|
22284
|
+
selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
|
|
21710
22285
|
]
|
|
21711
22286
|
},
|
|
21712
22287
|
style.value
|
|
@@ -21736,7 +22311,7 @@ function PricingCardToolbar({
|
|
|
21736
22311
|
const style = pricingCardStyle(entry.tree, index);
|
|
21737
22312
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
21738
22313
|
const mobile = window.innerWidth <= 480;
|
|
21739
|
-
return /* @__PURE__ */
|
|
22314
|
+
return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
|
|
21740
22315
|
"div",
|
|
21741
22316
|
{
|
|
21742
22317
|
"data-ohw-bridge": "",
|
|
@@ -21748,7 +22323,7 @@ function PricingCardToolbar({
|
|
|
21748
22323
|
),
|
|
21749
22324
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
21750
22325
|
children: [
|
|
21751
|
-
/* @__PURE__ */
|
|
22326
|
+
/* @__PURE__ */ jsxs13(
|
|
21752
22327
|
"div",
|
|
21753
22328
|
{
|
|
21754
22329
|
className: cn(
|
|
@@ -21757,8 +22332,8 @@ function PricingCardToolbar({
|
|
|
21757
22332
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
21758
22333
|
),
|
|
21759
22334
|
children: [
|
|
21760
|
-
/* @__PURE__ */
|
|
21761
|
-
/* @__PURE__ */
|
|
22335
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
22336
|
+
/* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
|
|
21762
22337
|
CustomToolbarButton,
|
|
21763
22338
|
{
|
|
21764
22339
|
type: "button",
|
|
@@ -21766,7 +22341,7 @@ function PricingCardToolbar({
|
|
|
21766
22341
|
"aria-pressed": featuredTag,
|
|
21767
22342
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
21768
22343
|
className: "group size-8",
|
|
21769
|
-
children: /* @__PURE__ */
|
|
22344
|
+
children: /* @__PURE__ */ jsx22(
|
|
21770
22345
|
Star2,
|
|
21771
22346
|
{
|
|
21772
22347
|
size: 16,
|
|
@@ -21781,25 +22356,25 @@ function PricingCardToolbar({
|
|
|
21781
22356
|
)
|
|
21782
22357
|
}
|
|
21783
22358
|
) }),
|
|
21784
|
-
/* @__PURE__ */
|
|
22359
|
+
/* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
21785
22360
|
] }),
|
|
21786
|
-
/* @__PURE__ */
|
|
21787
|
-
/* @__PURE__ */
|
|
21788
|
-
/* @__PURE__ */
|
|
21789
|
-
/* @__PURE__ */
|
|
21790
|
-
/* @__PURE__ */
|
|
21791
|
-
/* @__PURE__ */
|
|
21792
|
-
/* @__PURE__ */
|
|
22361
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
22362
|
+
/* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
22363
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
22364
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
|
|
22365
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
|
|
22366
|
+
/* @__PURE__ */ jsx22(ButtonGlyph, {}),
|
|
22367
|
+
/* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
21793
22368
|
] }) }),
|
|
21794
|
-
/* @__PURE__ */
|
|
21795
|
-
/* @__PURE__ */
|
|
21796
|
-
/* @__PURE__ */
|
|
21797
|
-
/* @__PURE__ */
|
|
21798
|
-
/* @__PURE__ */
|
|
22369
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
|
|
22370
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
|
|
22371
|
+
/* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
|
|
22372
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22373
|
+
/* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
|
|
21799
22374
|
]
|
|
21800
22375
|
}
|
|
21801
22376
|
),
|
|
21802
|
-
error && /* @__PURE__ */
|
|
22377
|
+
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 })
|
|
21803
22378
|
]
|
|
21804
22379
|
}
|
|
21805
22380
|
) });
|
|
@@ -21833,7 +22408,7 @@ function AiPricingCardOverlay({
|
|
|
21833
22408
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
21834
22409
|
setHover((prev) => {
|
|
21835
22410
|
const next = ref && !overEditable ? ref : null;
|
|
21836
|
-
return
|
|
22411
|
+
return sameRef2(prev, next) ? prev : next;
|
|
21837
22412
|
});
|
|
21838
22413
|
};
|
|
21839
22414
|
const onLeave = () => setHover(null);
|
|
@@ -21848,10 +22423,10 @@ function AiPricingCardOverlay({
|
|
|
21848
22423
|
const onClick = (e) => {
|
|
21849
22424
|
const t = e.target;
|
|
21850
22425
|
if (!(t instanceof Element)) return;
|
|
21851
|
-
if (t.closest(
|
|
22426
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
21852
22427
|
const ref = cardRefFromTarget(t);
|
|
21853
|
-
setActive((prev) =>
|
|
21854
|
-
if (!ref || !
|
|
22428
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
22429
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
21855
22430
|
};
|
|
21856
22431
|
document.addEventListener("click", onClick, true);
|
|
21857
22432
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -21916,12 +22491,12 @@ function AiPricingCardOverlay({
|
|
|
21916
22491
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
21917
22492
|
const activeCardRect = useLiveCardRect(active);
|
|
21918
22493
|
const activeGridRect = useLiveCardRect(active, true);
|
|
21919
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
21920
|
-
return /* @__PURE__ */
|
|
21921
|
-
hoverRect && /* @__PURE__ */
|
|
21922
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */
|
|
21923
|
-
/* @__PURE__ */
|
|
21924
|
-
/* @__PURE__ */
|
|
22494
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
22495
|
+
return /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
22496
|
+
hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
22497
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
22498
|
+
/* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
22499
|
+
/* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
|
|
21925
22500
|
PricingCardToolbar,
|
|
21926
22501
|
{
|
|
21927
22502
|
entry: activeEntry,
|
|
@@ -21949,7 +22524,7 @@ function AiPricingCardOverlay({
|
|
|
21949
22524
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
21950
22525
|
}
|
|
21951
22526
|
) }),
|
|
21952
|
-
/* @__PURE__ */
|
|
22527
|
+
/* @__PURE__ */ jsx22(
|
|
21953
22528
|
"div",
|
|
21954
22529
|
{
|
|
21955
22530
|
"data-ohw-bridge": "",
|
|
@@ -22014,10 +22589,10 @@ function clearVideo(tree, path) {
|
|
|
22014
22589
|
}
|
|
22015
22590
|
|
|
22016
22591
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
22017
|
-
import { Fragment as
|
|
22592
|
+
import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
22018
22593
|
var PRIMARY5 = "#0885FE";
|
|
22019
|
-
var
|
|
22020
|
-
var
|
|
22594
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
22595
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
22021
22596
|
function findVideoBlockElement(sectionId, path) {
|
|
22022
22597
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
22023
22598
|
if (!sectionEl2) return null;
|
|
@@ -22077,12 +22652,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
22077
22652
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
22078
22653
|
});
|
|
22079
22654
|
}
|
|
22080
|
-
function
|
|
22655
|
+
function Pill({
|
|
22081
22656
|
label,
|
|
22082
22657
|
onClick,
|
|
22083
22658
|
disabled
|
|
22084
22659
|
}) {
|
|
22085
|
-
return /* @__PURE__ */
|
|
22660
|
+
return /* @__PURE__ */ jsx23(
|
|
22086
22661
|
"button",
|
|
22087
22662
|
{
|
|
22088
22663
|
type: "button",
|
|
@@ -22098,7 +22673,7 @@ function Pill2({
|
|
|
22098
22673
|
border: "none",
|
|
22099
22674
|
cursor: disabled ? "default" : "pointer",
|
|
22100
22675
|
background: "#ffffff",
|
|
22101
|
-
color:
|
|
22676
|
+
color: OHW_BLUE_DARK,
|
|
22102
22677
|
opacity: disabled ? 0.4 : 1,
|
|
22103
22678
|
fontSize: 12,
|
|
22104
22679
|
lineHeight: "16px",
|
|
@@ -22141,8 +22716,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22141
22716
|
onCommit(id);
|
|
22142
22717
|
}
|
|
22143
22718
|
};
|
|
22144
|
-
return /* @__PURE__ */
|
|
22145
|
-
/* @__PURE__ */
|
|
22719
|
+
return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
22720
|
+
/* @__PURE__ */ jsxs14(
|
|
22146
22721
|
"div",
|
|
22147
22722
|
{
|
|
22148
22723
|
style: {
|
|
@@ -22158,12 +22733,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22158
22733
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
22159
22734
|
},
|
|
22160
22735
|
children: [
|
|
22161
|
-
/* @__PURE__ */
|
|
22736
|
+
/* @__PURE__ */ jsx23(
|
|
22162
22737
|
"span",
|
|
22163
22738
|
{
|
|
22164
22739
|
style: {
|
|
22165
22740
|
flex: "0 0 auto",
|
|
22166
|
-
color:
|
|
22741
|
+
color: OHW_BLUE_DARK,
|
|
22167
22742
|
fontSize: 10,
|
|
22168
22743
|
lineHeight: "16px",
|
|
22169
22744
|
fontWeight: 700,
|
|
@@ -22173,7 +22748,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22173
22748
|
children: "Video"
|
|
22174
22749
|
}
|
|
22175
22750
|
),
|
|
22176
|
-
/* @__PURE__ */
|
|
22751
|
+
/* @__PURE__ */ jsx23(
|
|
22177
22752
|
"input",
|
|
22178
22753
|
{
|
|
22179
22754
|
type: "text",
|
|
@@ -22210,7 +22785,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22210
22785
|
]
|
|
22211
22786
|
}
|
|
22212
22787
|
),
|
|
22213
|
-
invalid && /* @__PURE__ */
|
|
22788
|
+
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." })
|
|
22214
22789
|
] });
|
|
22215
22790
|
}
|
|
22216
22791
|
function VideoToolbar({
|
|
@@ -22220,7 +22795,7 @@ function VideoToolbar({
|
|
|
22220
22795
|
onSetVideoId,
|
|
22221
22796
|
onRemove
|
|
22222
22797
|
}) {
|
|
22223
|
-
return /* @__PURE__ */
|
|
22798
|
+
return /* @__PURE__ */ jsxs14(
|
|
22224
22799
|
"div",
|
|
22225
22800
|
{
|
|
22226
22801
|
"data-ohw-bridge": "",
|
|
@@ -22232,7 +22807,7 @@ function VideoToolbar({
|
|
|
22232
22807
|
gap: 6,
|
|
22233
22808
|
alignItems: "center",
|
|
22234
22809
|
width: 280,
|
|
22235
|
-
background:
|
|
22810
|
+
background: OHW_BLUE,
|
|
22236
22811
|
padding: 8,
|
|
22237
22812
|
borderRadius: 12,
|
|
22238
22813
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -22240,9 +22815,9 @@ function VideoToolbar({
|
|
|
22240
22815
|
opacity: pending ? 0.6 : 1
|
|
22241
22816
|
},
|
|
22242
22817
|
children: [
|
|
22243
|
-
/* @__PURE__ */
|
|
22244
|
-
/* @__PURE__ */
|
|
22245
|
-
error && /* @__PURE__ */
|
|
22818
|
+
/* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
22819
|
+
/* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
22820
|
+
error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
22246
22821
|
]
|
|
22247
22822
|
}
|
|
22248
22823
|
);
|
|
@@ -22362,8 +22937,8 @@ function AiVideoOverlay({
|
|
|
22362
22937
|
const activeBlockRect = useLiveBlockRect(active);
|
|
22363
22938
|
const TOOLBAR_APPROX_H = 90;
|
|
22364
22939
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
22365
|
-
return /* @__PURE__ */
|
|
22366
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
22940
|
+
return /* @__PURE__ */ jsxs14(Fragment10, { children: [
|
|
22941
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx23(
|
|
22367
22942
|
"button",
|
|
22368
22943
|
{
|
|
22369
22944
|
type: "button",
|
|
@@ -22391,15 +22966,15 @@ function AiVideoOverlay({
|
|
|
22391
22966
|
fontSize: 14,
|
|
22392
22967
|
fontWeight: 700
|
|
22393
22968
|
},
|
|
22394
|
-
children: /* @__PURE__ */
|
|
22969
|
+
children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
|
|
22395
22970
|
}
|
|
22396
22971
|
),
|
|
22397
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */
|
|
22972
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
|
|
22398
22973
|
ItemInteractionLayer,
|
|
22399
22974
|
{
|
|
22400
22975
|
rect: activeBlockRect,
|
|
22401
22976
|
state: toolbarState,
|
|
22402
|
-
toolbar: /* @__PURE__ */
|
|
22977
|
+
toolbar: /* @__PURE__ */ jsx23(
|
|
22403
22978
|
VideoToolbar,
|
|
22404
22979
|
{
|
|
22405
22980
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -22474,10 +23049,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
22474
23049
|
}
|
|
22475
23050
|
|
|
22476
23051
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
22477
|
-
import { Fragment as
|
|
23052
|
+
import { Fragment as Fragment11, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
22478
23053
|
var PRIMARY6 = "#0885FE";
|
|
22479
|
-
var
|
|
22480
|
-
var
|
|
23054
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
23055
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
22481
23056
|
function findCarouselItemElement(sectionId, index) {
|
|
22482
23057
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
22483
23058
|
if (!sectionEl2) return null;
|
|
@@ -22556,8 +23131,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
22556
23131
|
postToParent2({ type: "ow:asset-pick", id });
|
|
22557
23132
|
});
|
|
22558
23133
|
}
|
|
22559
|
-
function
|
|
22560
|
-
return /* @__PURE__ */
|
|
23134
|
+
function Pill2({ label, onClick, disabled }) {
|
|
23135
|
+
return /* @__PURE__ */ jsx24(
|
|
22561
23136
|
"button",
|
|
22562
23137
|
{
|
|
22563
23138
|
type: "button",
|
|
@@ -22573,7 +23148,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
22573
23148
|
border: "none",
|
|
22574
23149
|
cursor: disabled ? "default" : "pointer",
|
|
22575
23150
|
background: "#ffffff",
|
|
22576
|
-
color:
|
|
23151
|
+
color: OHW_BLUE_DARK2,
|
|
22577
23152
|
opacity: disabled ? 0.4 : 1,
|
|
22578
23153
|
fontSize: 12,
|
|
22579
23154
|
lineHeight: "16px",
|
|
@@ -22591,7 +23166,7 @@ function TogglePill({
|
|
|
22591
23166
|
onToggle,
|
|
22592
23167
|
disabled
|
|
22593
23168
|
}) {
|
|
22594
|
-
return /* @__PURE__ */
|
|
23169
|
+
return /* @__PURE__ */ jsxs15(
|
|
22595
23170
|
"button",
|
|
22596
23171
|
{
|
|
22597
23172
|
type: "button",
|
|
@@ -22610,7 +23185,7 @@ function TogglePill({
|
|
|
22610
23185
|
border: "none",
|
|
22611
23186
|
cursor: disabled ? "default" : "pointer",
|
|
22612
23187
|
background: "#ffffff",
|
|
22613
|
-
color:
|
|
23188
|
+
color: OHW_BLUE_DARK2,
|
|
22614
23189
|
opacity: disabled ? 0.4 : 1,
|
|
22615
23190
|
fontSize: 12,
|
|
22616
23191
|
lineHeight: "16px",
|
|
@@ -22620,7 +23195,7 @@ function TogglePill({
|
|
|
22620
23195
|
},
|
|
22621
23196
|
children: [
|
|
22622
23197
|
label,
|
|
22623
|
-
/* @__PURE__ */
|
|
23198
|
+
/* @__PURE__ */ jsx24(
|
|
22624
23199
|
"span",
|
|
22625
23200
|
{
|
|
22626
23201
|
"aria-hidden": true,
|
|
@@ -22633,10 +23208,10 @@ function TogglePill({
|
|
|
22633
23208
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
22634
23209
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
22635
23210
|
// "disabled control" rather than "switch that is off".
|
|
22636
|
-
background: on ?
|
|
23211
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
22637
23212
|
transition: "background 120ms ease"
|
|
22638
23213
|
},
|
|
22639
|
-
children: /* @__PURE__ */
|
|
23214
|
+
children: /* @__PURE__ */ jsx24(
|
|
22640
23215
|
"span",
|
|
22641
23216
|
{
|
|
22642
23217
|
style: {
|
|
@@ -22665,7 +23240,7 @@ function CarouselSlideToolbar({
|
|
|
22665
23240
|
onChangeImage,
|
|
22666
23241
|
onToggleAutoplay
|
|
22667
23242
|
}) {
|
|
22668
|
-
return /* @__PURE__ */
|
|
23243
|
+
return /* @__PURE__ */ jsxs15(
|
|
22669
23244
|
"div",
|
|
22670
23245
|
{
|
|
22671
23246
|
"data-ohw-bridge": "",
|
|
@@ -22676,7 +23251,7 @@ function CarouselSlideToolbar({
|
|
|
22676
23251
|
flexDirection: "column",
|
|
22677
23252
|
gap: 6,
|
|
22678
23253
|
alignItems: "center",
|
|
22679
|
-
background:
|
|
23254
|
+
background: OHW_BLUE2,
|
|
22680
23255
|
padding: 8,
|
|
22681
23256
|
borderRadius: 12,
|
|
22682
23257
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -22688,11 +23263,11 @@ function CarouselSlideToolbar({
|
|
|
22688
23263
|
pointerEvents: pending ? "none" : "auto"
|
|
22689
23264
|
},
|
|
22690
23265
|
children: [
|
|
22691
|
-
/* @__PURE__ */
|
|
22692
|
-
/* @__PURE__ */
|
|
22693
|
-
/* @__PURE__ */
|
|
23266
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
23267
|
+
/* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
23268
|
+
/* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
22694
23269
|
] }),
|
|
22695
|
-
error && /* @__PURE__ */
|
|
23270
|
+
error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
22696
23271
|
]
|
|
22697
23272
|
}
|
|
22698
23273
|
);
|
|
@@ -22832,8 +23407,8 @@ function AiFadeCarouselOverlay({
|
|
|
22832
23407
|
const activeItemRect = useLiveItemRect2(active);
|
|
22833
23408
|
const TOOLBAR_APPROX_H = 90;
|
|
22834
23409
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
22835
|
-
return /* @__PURE__ */
|
|
22836
|
-
hoverHandleRect && hover && /* @__PURE__ */
|
|
23410
|
+
return /* @__PURE__ */ jsxs15(Fragment11, { children: [
|
|
23411
|
+
hoverHandleRect && hover && /* @__PURE__ */ jsx24(
|
|
22837
23412
|
"button",
|
|
22838
23413
|
{
|
|
22839
23414
|
type: "button",
|
|
@@ -22862,10 +23437,10 @@ function AiFadeCarouselOverlay({
|
|
|
22862
23437
|
fontSize: 14,
|
|
22863
23438
|
fontWeight: 700
|
|
22864
23439
|
},
|
|
22865
|
-
children: /* @__PURE__ */
|
|
23440
|
+
children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
|
|
22866
23441
|
}
|
|
22867
23442
|
),
|
|
22868
|
-
swapping && /* @__PURE__ */
|
|
23443
|
+
swapping && /* @__PURE__ */ jsx24(
|
|
22869
23444
|
"div",
|
|
22870
23445
|
{
|
|
22871
23446
|
ref: skeletonRef,
|
|
@@ -22883,15 +23458,15 @@ function AiFadeCarouselOverlay({
|
|
|
22883
23458
|
zIndex: 2147483646,
|
|
22884
23459
|
pointerEvents: "none"
|
|
22885
23460
|
},
|
|
22886
|
-
children: /* @__PURE__ */
|
|
23461
|
+
children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
|
|
22887
23462
|
}
|
|
22888
23463
|
),
|
|
22889
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */
|
|
23464
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
|
|
22890
23465
|
ItemInteractionLayer,
|
|
22891
23466
|
{
|
|
22892
23467
|
rect: activeItemRect,
|
|
22893
23468
|
state: toolbarState,
|
|
22894
|
-
toolbar: /* @__PURE__ */
|
|
23469
|
+
toolbar: /* @__PURE__ */ jsx24(
|
|
22895
23470
|
CarouselSlideToolbar,
|
|
22896
23471
|
{
|
|
22897
23472
|
pending,
|
|
@@ -23129,118 +23704,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
23129
23704
|
// src/ui/link-modal/LinkPopover.tsx
|
|
23130
23705
|
import { useEffect as useEffect17 } from "react";
|
|
23131
23706
|
|
|
23132
|
-
// src/ui/dialog.tsx
|
|
23133
|
-
import * as React9 from "react";
|
|
23134
|
-
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
23135
|
-
import { X as X2 } from "lucide-react";
|
|
23136
|
-
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
23137
|
-
function Dialog2({
|
|
23138
|
-
...props
|
|
23139
|
-
}) {
|
|
23140
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
23141
|
-
}
|
|
23142
|
-
function DialogPortal({
|
|
23143
|
-
...props
|
|
23144
|
-
}) {
|
|
23145
|
-
return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
|
|
23146
|
-
}
|
|
23147
|
-
function DialogOverlay({
|
|
23148
|
-
className,
|
|
23149
|
-
...props
|
|
23150
|
-
}) {
|
|
23151
|
-
return /* @__PURE__ */ jsx24(
|
|
23152
|
-
DialogPrimitive.Overlay,
|
|
23153
|
-
{
|
|
23154
|
-
"data-slot": "dialog-overlay",
|
|
23155
|
-
"data-ohw-link-modal-root": "",
|
|
23156
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
23157
|
-
...props
|
|
23158
|
-
}
|
|
23159
|
-
);
|
|
23160
|
-
}
|
|
23161
|
-
var DialogContent = React9.forwardRef(
|
|
23162
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
23163
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
23164
|
-
return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
|
|
23165
|
-
/* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
23166
|
-
/* @__PURE__ */ jsxs15(
|
|
23167
|
-
DialogPrimitive.Content,
|
|
23168
|
-
{
|
|
23169
|
-
ref,
|
|
23170
|
-
"data-slot": "dialog-content",
|
|
23171
|
-
className: cn(
|
|
23172
|
-
positionMode,
|
|
23173
|
-
"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",
|
|
23174
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
23175
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
23176
|
-
className
|
|
23177
|
-
),
|
|
23178
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
23179
|
-
...props,
|
|
23180
|
-
children: [
|
|
23181
|
-
children,
|
|
23182
|
-
showCloseButton ? /* @__PURE__ */ jsx24(
|
|
23183
|
-
DialogPrimitive.Close,
|
|
23184
|
-
{
|
|
23185
|
-
type: "button",
|
|
23186
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
23187
|
-
"aria-label": "Close",
|
|
23188
|
-
children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
|
|
23189
|
-
}
|
|
23190
|
-
) : null
|
|
23191
|
-
]
|
|
23192
|
-
}
|
|
23193
|
-
)
|
|
23194
|
-
] });
|
|
23195
|
-
}
|
|
23196
|
-
);
|
|
23197
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
23198
|
-
function DialogHeader({
|
|
23199
|
-
className,
|
|
23200
|
-
...props
|
|
23201
|
-
}) {
|
|
23202
|
-
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
23203
|
-
}
|
|
23204
|
-
function DialogFooter({
|
|
23205
|
-
className,
|
|
23206
|
-
...props
|
|
23207
|
-
}) {
|
|
23208
|
-
return /* @__PURE__ */ jsx24(
|
|
23209
|
-
"div",
|
|
23210
|
-
{
|
|
23211
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
23212
|
-
...props
|
|
23213
|
-
}
|
|
23214
|
-
);
|
|
23215
|
-
}
|
|
23216
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
23217
|
-
DialogPrimitive.Title,
|
|
23218
|
-
{
|
|
23219
|
-
ref,
|
|
23220
|
-
className: cn(
|
|
23221
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
23222
|
-
className
|
|
23223
|
-
),
|
|
23224
|
-
...props
|
|
23225
|
-
}
|
|
23226
|
-
));
|
|
23227
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
23228
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
23229
|
-
DialogPrimitive.Description,
|
|
23230
|
-
{
|
|
23231
|
-
ref,
|
|
23232
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
23233
|
-
...props
|
|
23234
|
-
}
|
|
23235
|
-
));
|
|
23236
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
23237
|
-
var DialogClose = DialogPrimitive.Close;
|
|
23238
|
-
|
|
23239
23707
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
23240
23708
|
import { Info, X as X4 } from "lucide-react";
|
|
23241
23709
|
|
|
23242
23710
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
23243
|
-
import { ArrowRight as
|
|
23711
|
+
import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
|
|
23244
23712
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
23245
23713
|
function DestinationBreadcrumb({
|
|
23246
23714
|
pageTitle,
|
|
@@ -23254,7 +23722,7 @@ function DestinationBreadcrumb({
|
|
|
23254
23722
|
/* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
23255
23723
|
] }),
|
|
23256
23724
|
/* @__PURE__ */ jsx25(
|
|
23257
|
-
|
|
23725
|
+
ArrowRight3,
|
|
23258
23726
|
{
|
|
23259
23727
|
size: 16,
|
|
23260
23728
|
className: "shrink-0 text-muted-foreground",
|
|
@@ -23366,7 +23834,7 @@ function Label({ className, ...props }) {
|
|
|
23366
23834
|
}
|
|
23367
23835
|
|
|
23368
23836
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
23369
|
-
import { ChevronDown as
|
|
23837
|
+
import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
|
|
23370
23838
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
23371
23839
|
function FieldChevron({
|
|
23372
23840
|
onClick
|
|
@@ -23379,7 +23847,7 @@ function FieldChevron({
|
|
|
23379
23847
|
onClick,
|
|
23380
23848
|
"aria-label": "Open page list",
|
|
23381
23849
|
tabIndex: -1,
|
|
23382
|
-
children: /* @__PURE__ */ jsx29(
|
|
23850
|
+
children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
|
|
23383
23851
|
}
|
|
23384
23852
|
);
|
|
23385
23853
|
}
|
|
@@ -23518,10 +23986,10 @@ function UrlOrPageInput({
|
|
|
23518
23986
|
}
|
|
23519
23987
|
|
|
23520
23988
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
23521
|
-
import { Fragment as
|
|
23989
|
+
import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
23522
23990
|
function LinkEditorPanel({ state, onClose }) {
|
|
23523
23991
|
const isCancel = state.secondaryLabel === "Cancel" || state.secondaryLabel === "Back to sections";
|
|
23524
|
-
return /* @__PURE__ */ jsxs19(
|
|
23992
|
+
return /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
23525
23993
|
/* @__PURE__ */ jsx30(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx30(
|
|
23526
23994
|
"button",
|
|
23527
23995
|
{
|
|
@@ -23609,7 +24077,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
23609
24077
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
23610
24078
|
import { useCallback as useCallback7, useEffect as useEffect15, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
23611
24079
|
import { createPortal as createPortal2 } from "react-dom";
|
|
23612
|
-
import { ArrowLeft as
|
|
24080
|
+
import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
|
|
23613
24081
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
23614
24082
|
|
|
23615
24083
|
// src/lib/parent-scroll.ts
|
|
@@ -23886,7 +24354,7 @@ function SectionPickerOverlay({
|
|
|
23886
24354
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
23887
24355
|
onClick: onBack,
|
|
23888
24356
|
children: [
|
|
23889
|
-
/* @__PURE__ */ jsx31(
|
|
24357
|
+
/* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
23890
24358
|
"Back"
|
|
23891
24359
|
]
|
|
23892
24360
|
}
|
|
@@ -23955,7 +24423,7 @@ function SectionPickerOverlay({
|
|
|
23955
24423
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
23956
24424
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
23957
24425
|
"aria-hidden": true,
|
|
23958
|
-
children: /* @__PURE__ */ jsx31(
|
|
24426
|
+
children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
|
|
23959
24427
|
}
|
|
23960
24428
|
) : null
|
|
23961
24429
|
]
|
|
@@ -24135,7 +24603,7 @@ function useLinkModalState({
|
|
|
24135
24603
|
}
|
|
24136
24604
|
|
|
24137
24605
|
// src/ui/link-modal/LinkPopover.tsx
|
|
24138
|
-
import { Fragment as
|
|
24606
|
+
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
24139
24607
|
function postToParent(data) {
|
|
24140
24608
|
window.parent?.postMessage(data, "*");
|
|
24141
24609
|
}
|
|
@@ -24231,7 +24699,7 @@ function LinkPopover({
|
|
|
24231
24699
|
);
|
|
24232
24700
|
};
|
|
24233
24701
|
}, [open, sectionPickerActive]);
|
|
24234
|
-
return /* @__PURE__ */ jsxs21(
|
|
24702
|
+
return /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
24235
24703
|
/* @__PURE__ */ jsx32(
|
|
24236
24704
|
Dialog2,
|
|
24237
24705
|
{
|
|
@@ -24339,6 +24807,7 @@ function shouldUseDevFixtures() {
|
|
|
24339
24807
|
function getLogoElement(el) {
|
|
24340
24808
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
24341
24809
|
if (marked) return marked;
|
|
24810
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
24342
24811
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
24343
24812
|
if (!root) return null;
|
|
24344
24813
|
const anchor = el.closest("a");
|
|
@@ -24408,7 +24877,7 @@ function addFooterColumnWithPersist({
|
|
|
24408
24877
|
import {
|
|
24409
24878
|
useCallback as useCallback9,
|
|
24410
24879
|
useEffect as useEffect18,
|
|
24411
|
-
useLayoutEffect as
|
|
24880
|
+
useLayoutEffect as useLayoutEffect6,
|
|
24412
24881
|
useRef as useRef11,
|
|
24413
24882
|
useState as useState15
|
|
24414
24883
|
} from "react";
|
|
@@ -24505,7 +24974,7 @@ function FloatingPanel({
|
|
|
24505
24974
|
return () => window.removeEventListener("message", onParentScroll);
|
|
24506
24975
|
}, [open]);
|
|
24507
24976
|
const positionRef = useRef11(position);
|
|
24508
|
-
|
|
24977
|
+
useLayoutEffect6(() => {
|
|
24509
24978
|
if (!open) {
|
|
24510
24979
|
positionRef.current = position;
|
|
24511
24980
|
return;
|
|
@@ -24515,7 +24984,7 @@ function FloatingPanel({
|
|
|
24515
24984
|
}
|
|
24516
24985
|
positionRef.current = position;
|
|
24517
24986
|
}, [open, position, liveScroll, parentScroll]);
|
|
24518
|
-
|
|
24987
|
+
useLayoutEffect6(() => {
|
|
24519
24988
|
if (!open || !panelRef.current) return;
|
|
24520
24989
|
const el = panelRef.current;
|
|
24521
24990
|
const header = el.querySelector("[data-ohw-floating-panel-header]");
|
|
@@ -24724,7 +25193,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
|
|
|
24724
25193
|
}
|
|
24725
25194
|
|
|
24726
25195
|
// src/ui/button-style-panel.tsx
|
|
24727
|
-
import { Check as
|
|
25196
|
+
import { Check as Check5 } from "lucide-react";
|
|
24728
25197
|
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
24729
25198
|
var SIZE_LABEL = { s: "S", m: "M", l: "L" };
|
|
24730
25199
|
function ButtonStylePanel({
|
|
@@ -24795,7 +25264,7 @@ function ButtonStylePanel({
|
|
|
24795
25264
|
{
|
|
24796
25265
|
className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
|
|
24797
25266
|
"aria-hidden": true,
|
|
24798
|
-
children: /* @__PURE__ */ jsx35(
|
|
25267
|
+
children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
|
|
24799
25268
|
}
|
|
24800
25269
|
) : null
|
|
24801
25270
|
]
|
|
@@ -25827,7 +26296,7 @@ function useSectionDrag({
|
|
|
25827
26296
|
}
|
|
25828
26297
|
|
|
25829
26298
|
// src/ui/footer-container-chrome.tsx
|
|
25830
|
-
import { Plus as
|
|
26299
|
+
import { Plus as Plus4 } from "lucide-react";
|
|
25831
26300
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
25832
26301
|
function FooterContainerChrome({
|
|
25833
26302
|
rect,
|
|
@@ -25868,7 +26337,7 @@ function FooterContainerChrome({
|
|
|
25868
26337
|
if (addDisabled) return;
|
|
25869
26338
|
onAdd();
|
|
25870
26339
|
},
|
|
25871
|
-
children: /* @__PURE__ */ jsx36(
|
|
26340
|
+
children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
25872
26341
|
}
|
|
25873
26342
|
) }),
|
|
25874
26343
|
/* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
@@ -26275,7 +26744,7 @@ function retargetPageLinks(change, deps) {
|
|
|
26275
26744
|
}
|
|
26276
26745
|
|
|
26277
26746
|
// src/ui/navbar-container-chrome.tsx
|
|
26278
|
-
import { Plus as
|
|
26747
|
+
import { Plus as Plus5 } from "lucide-react";
|
|
26279
26748
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
26280
26749
|
function NavbarContainerChrome({
|
|
26281
26750
|
rect,
|
|
@@ -26311,7 +26780,7 @@ function NavbarContainerChrome({
|
|
|
26311
26780
|
e.stopPropagation();
|
|
26312
26781
|
onAdd();
|
|
26313
26782
|
},
|
|
26314
|
-
children: /* @__PURE__ */ jsx37(
|
|
26783
|
+
children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
26315
26784
|
}
|
|
26316
26785
|
)
|
|
26317
26786
|
}
|
|
@@ -26383,8 +26852,8 @@ function Badge({ className, variant, ...props }) {
|
|
|
26383
26852
|
}
|
|
26384
26853
|
|
|
26385
26854
|
// src/OhhwellsBridge.tsx
|
|
26386
|
-
import { Brush as Brush2, Link as Link2, Plus as
|
|
26387
|
-
import { Fragment as
|
|
26855
|
+
import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings, Trash2 as Trash24 } from "lucide-react";
|
|
26856
|
+
import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
26388
26857
|
var PRIMARY7 = "#0885FE";
|
|
26389
26858
|
var IMAGE_FADE_MS = 300;
|
|
26390
26859
|
var MEDIA_SETTLE_TIMEOUT_MS = 2500;
|
|
@@ -26795,7 +27264,7 @@ function isIconEditable(el) {
|
|
|
26795
27264
|
return el.dataset.ohwEditable === "icon";
|
|
26796
27265
|
}
|
|
26797
27266
|
var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [data-ohw-editable="video"]';
|
|
26798
|
-
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"]';
|
|
27267
|
+
var EDITOR_CHROME_SELECTOR = '[data-ohw-toolbar], [data-ohw-form-toolbar], [data-ohw-field-toolbar], [data-ohw-dropdown-option-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"]';
|
|
26799
27268
|
function isOverEditorChrome(x, y) {
|
|
26800
27269
|
return document.elementsFromPoint(x, y).some((el) => el instanceof HTMLElement && el.matches(EDITOR_CHROME_SELECTOR));
|
|
26801
27270
|
}
|
|
@@ -27161,7 +27630,7 @@ function getNavigationSelectionParent(el) {
|
|
|
27161
27630
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
27162
27631
|
return resolveFooterLinksContainerFrom(el);
|
|
27163
27632
|
}
|
|
27164
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
27633
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isFooterLinksContainer(el) || isInferredFooterGroup2(el)) {
|
|
27165
27634
|
return getNavigationRoot(el);
|
|
27166
27635
|
}
|
|
27167
27636
|
return null;
|
|
@@ -27383,7 +27852,6 @@ var ICONS = {
|
|
|
27383
27852
|
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"/>',
|
|
27384
27853
|
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"/>'
|
|
27385
27854
|
};
|
|
27386
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
27387
27855
|
var SELECTION_CHROME_GAP2 = 4;
|
|
27388
27856
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
27389
27857
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -27481,7 +27949,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
27481
27949
|
el.style.top = `${top}px`;
|
|
27482
27950
|
el.style.height = `${height}px`;
|
|
27483
27951
|
}
|
|
27484
|
-
var
|
|
27952
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
27485
27953
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
27486
27954
|
const isAbove = transform.includes("translateY(-100%)");
|
|
27487
27955
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -27508,8 +27976,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
27508
27976
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
27509
27977
|
const half = toolbarWidth / 2;
|
|
27510
27978
|
return Math.max(
|
|
27511
|
-
|
|
27512
|
-
Math.min(centerX, window.innerWidth -
|
|
27979
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
27980
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
27513
27981
|
);
|
|
27514
27982
|
}
|
|
27515
27983
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -27727,7 +28195,7 @@ function FloatingToolbar({
|
|
|
27727
28195
|
children: /* @__PURE__ */ jsx40(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
27728
28196
|
}
|
|
27729
28197
|
) : null,
|
|
27730
|
-
showDelete ? /* @__PURE__ */ jsxs26(
|
|
28198
|
+
showDelete ? /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
27731
28199
|
/* @__PURE__ */ jsx40(CustomToolbarDivider, {}),
|
|
27732
28200
|
/* @__PURE__ */ jsx40(
|
|
27733
28201
|
CustomToolbarButton,
|
|
@@ -27934,7 +28402,7 @@ function OhhwellsBridge() {
|
|
|
27934
28402
|
}, []);
|
|
27935
28403
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
27936
28404
|
const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
|
|
27937
|
-
|
|
28405
|
+
useLayoutEffect7(() => {
|
|
27938
28406
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
27939
28407
|
if (next !== subdomain) setSubdomain(next);
|
|
27940
28408
|
if (next) return;
|
|
@@ -28184,10 +28652,14 @@ function OhhwellsBridge() {
|
|
|
28184
28652
|
const [fieldPickRect, setFieldPickRect] = useState18(null);
|
|
28185
28653
|
const fieldPickElRef = useRef14(null);
|
|
28186
28654
|
const [fieldPickState, setFieldPickState] = useState18(null);
|
|
28655
|
+
const [dropdownOptionPick, setDropdownOptionPick] = useState18(null);
|
|
28187
28656
|
const [fieldTypePickerOpen, setFieldTypePickerOpen] = useState18(false);
|
|
28188
28657
|
const clearFormPick = useCallback12(() => {
|
|
28189
28658
|
const form = formPickElRef.current;
|
|
28190
28659
|
const editing = fieldPickElRef.current;
|
|
28660
|
+
if (editing && fieldTypeOf(editing) === "dropdown") {
|
|
28661
|
+
setDropdownPreviewOpen(editing, false);
|
|
28662
|
+
}
|
|
28191
28663
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
28192
28664
|
const owner = editing.closest('[data-ohw-editable="form"]');
|
|
28193
28665
|
if (owner) persistFieldsRef.current(owner);
|
|
@@ -28199,6 +28671,7 @@ function OhhwellsBridge() {
|
|
|
28199
28671
|
setFormViewStateUi("default");
|
|
28200
28672
|
setFormPickCount(null);
|
|
28201
28673
|
setFieldTypePickerOpen(false);
|
|
28674
|
+
setDropdownOptionPick(null);
|
|
28202
28675
|
fieldPickElRef.current = null;
|
|
28203
28676
|
setFieldPickRect(null);
|
|
28204
28677
|
setFieldPickState(null);
|
|
@@ -28207,10 +28680,14 @@ function OhhwellsBridge() {
|
|
|
28207
28680
|
}, []);
|
|
28208
28681
|
const clearFieldPick = useCallback12(() => {
|
|
28209
28682
|
const wrapper = fieldPickElRef.current;
|
|
28683
|
+
if (wrapper && fieldTypeOf(wrapper) === "dropdown") {
|
|
28684
|
+
setDropdownPreviewOpen(wrapper, false);
|
|
28685
|
+
}
|
|
28210
28686
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
28211
28687
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
28212
28688
|
if (form) persistFieldsRef.current(form);
|
|
28213
28689
|
}
|
|
28690
|
+
setDropdownOptionPick(null);
|
|
28214
28691
|
fieldPickElRef.current = null;
|
|
28215
28692
|
setFieldPickRect(null);
|
|
28216
28693
|
setFieldPickState(null);
|
|
@@ -28228,17 +28705,50 @@ function OhhwellsBridge() {
|
|
|
28228
28705
|
[]
|
|
28229
28706
|
);
|
|
28230
28707
|
persistFieldsRef.current = persistFields;
|
|
28708
|
+
const refreshDropdownOptionPick = useCallback12((wrapper, index) => {
|
|
28709
|
+
if (index == null || fieldTypeOf(wrapper) !== "dropdown") {
|
|
28710
|
+
clearDropdownOptionSelection(wrapper);
|
|
28711
|
+
setDropdownOptionPick(null);
|
|
28712
|
+
return;
|
|
28713
|
+
}
|
|
28714
|
+
selectDropdownOption(wrapper, index);
|
|
28715
|
+
const row = listDropdownOptionRows(wrapper)[index];
|
|
28716
|
+
if (!row) {
|
|
28717
|
+
setDropdownOptionPick(null);
|
|
28718
|
+
return;
|
|
28719
|
+
}
|
|
28720
|
+
setDropdownOptionPick({
|
|
28721
|
+
index,
|
|
28722
|
+
rect: row.getBoundingClientRect(),
|
|
28723
|
+
canDelete: listDropdownOptionRows(wrapper).length > 1
|
|
28724
|
+
});
|
|
28725
|
+
setFieldPickRect(null);
|
|
28726
|
+
}, []);
|
|
28231
28727
|
const selectField = useCallback12((wrapper) => {
|
|
28232
28728
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
28233
|
-
|
|
28729
|
+
const prev = fieldPickElRef.current;
|
|
28730
|
+
if (fieldTypeOf(prev) === "dropdown") setDropdownPreviewOpen(prev, false);
|
|
28731
|
+
commitPlaceholderEdit(prev);
|
|
28234
28732
|
}
|
|
28235
28733
|
syncRequiredMark(wrapper);
|
|
28236
|
-
|
|
28734
|
+
const type = fieldTypeOf(wrapper);
|
|
28735
|
+
if (type === "dropdown") {
|
|
28736
|
+
syncDropdownPanel(wrapper);
|
|
28737
|
+
if (!isDropdownPreviewOpen(wrapper)) setDropdownPreviewOpen(wrapper, false);
|
|
28738
|
+
} else {
|
|
28739
|
+
beginPlaceholderEdit(wrapper);
|
|
28740
|
+
}
|
|
28237
28741
|
formHoverElRef.current = null;
|
|
28238
28742
|
setFormHoverRect(null);
|
|
28743
|
+
setDropdownOptionPick(null);
|
|
28744
|
+
clearDropdownOptionSelection(wrapper);
|
|
28239
28745
|
fieldPickElRef.current = wrapper;
|
|
28240
28746
|
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
28241
|
-
setFieldPickState({
|
|
28747
|
+
setFieldPickState({
|
|
28748
|
+
type,
|
|
28749
|
+
required: isFieldRequired(wrapper),
|
|
28750
|
+
dropdownOpen: type === "dropdown" ? isDropdownPreviewOpen(wrapper) : null
|
|
28751
|
+
});
|
|
28242
28752
|
setFieldTypePickerOpen(false);
|
|
28243
28753
|
}, []);
|
|
28244
28754
|
const withSelectedField = useCallback12(
|
|
@@ -28268,6 +28778,31 @@ function OhhwellsBridge() {
|
|
|
28268
28778
|
}),
|
|
28269
28779
|
[selectField, withSelectedField]
|
|
28270
28780
|
);
|
|
28781
|
+
const handleFieldDropdownOpenChange = useCallback12((open) => {
|
|
28782
|
+
const wrapper = fieldPickElRef.current;
|
|
28783
|
+
if (!wrapper || fieldTypeOf(wrapper) !== "dropdown") return;
|
|
28784
|
+
if (!open) {
|
|
28785
|
+
commitDropdownOptionsFromPanel(wrapper, true);
|
|
28786
|
+
const form = formPickElRef.current;
|
|
28787
|
+
if (form) persistFieldsRef.current(form);
|
|
28788
|
+
}
|
|
28789
|
+
setDropdownPreviewOpen(wrapper, open);
|
|
28790
|
+
setDropdownOptionPick(null);
|
|
28791
|
+
clearDropdownOptionSelection(wrapper);
|
|
28792
|
+
suppressNextClickRef.current = true;
|
|
28793
|
+
suppressClickUntilRef.current = Date.now() + 400;
|
|
28794
|
+
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
28795
|
+
setFieldPickState({
|
|
28796
|
+
type: "dropdown",
|
|
28797
|
+
required: isFieldRequired(wrapper),
|
|
28798
|
+
dropdownOpen: open
|
|
28799
|
+
});
|
|
28800
|
+
requestAnimationFrame(() => {
|
|
28801
|
+
if (fieldPickElRef.current === wrapper) {
|
|
28802
|
+
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
28803
|
+
}
|
|
28804
|
+
});
|
|
28805
|
+
}, []);
|
|
28271
28806
|
const handleFieldDuplicate = useCallback12(
|
|
28272
28807
|
() => withSelectedField((form, wrapper) => {
|
|
28273
28808
|
const copy = duplicateField(form, wrapper);
|
|
@@ -28283,6 +28818,28 @@ function OhhwellsBridge() {
|
|
|
28283
28818
|
}),
|
|
28284
28819
|
[clearFieldPick, withSelectedField]
|
|
28285
28820
|
);
|
|
28821
|
+
const handleDropdownOptionDuplicate = useCallback12(() => {
|
|
28822
|
+
const wrapper = fieldPickElRef.current;
|
|
28823
|
+
const form = formPickElRef.current;
|
|
28824
|
+
if (!wrapper || !form || !dropdownOptionPick) return;
|
|
28825
|
+
suppressNextClickRef.current = true;
|
|
28826
|
+
suppressClickUntilRef.current = Date.now() + 400;
|
|
28827
|
+
const nextIndex = duplicateDropdownOption(wrapper, dropdownOptionPick.index);
|
|
28828
|
+
persistFields(form);
|
|
28829
|
+
setDropdownPreviewOpen(wrapper, true);
|
|
28830
|
+
requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
|
|
28831
|
+
}, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
|
|
28832
|
+
const handleDropdownOptionDelete = useCallback12(() => {
|
|
28833
|
+
const wrapper = fieldPickElRef.current;
|
|
28834
|
+
const form = formPickElRef.current;
|
|
28835
|
+
if (!wrapper || !form || !dropdownOptionPick || !dropdownOptionPick.canDelete) return;
|
|
28836
|
+
suppressNextClickRef.current = true;
|
|
28837
|
+
suppressClickUntilRef.current = Date.now() + 400;
|
|
28838
|
+
const nextIndex = removeDropdownOption(wrapper, dropdownOptionPick.index);
|
|
28839
|
+
persistFields(form);
|
|
28840
|
+
setDropdownPreviewOpen(wrapper, true);
|
|
28841
|
+
requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
|
|
28842
|
+
}, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
|
|
28286
28843
|
const handleAddField = useCallback12(
|
|
28287
28844
|
(type) => {
|
|
28288
28845
|
const form = formPickElRef.current;
|
|
@@ -28421,21 +28978,6 @@ function OhhwellsBridge() {
|
|
|
28421
28978
|
const [isItemDragging, setIsItemDragging] = useState18(false);
|
|
28422
28979
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
|
|
28423
28980
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
28424
|
-
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
28425
|
-
const floatingPanelOpenRef = useRef14(false);
|
|
28426
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
28427
|
-
const floatingPanelRef = useRef14(null);
|
|
28428
|
-
floatingPanelRef.current = floatingPanel;
|
|
28429
|
-
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
28430
|
-
const buttonCollectionDragRef = useRef14(null);
|
|
28431
|
-
const buttonDropInsertIndexRef = useRef14(null);
|
|
28432
|
-
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
28433
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
28434
|
-
const buttonPointerDragRef = useRef14(null);
|
|
28435
|
-
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
28436
|
-
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
28437
|
-
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
28438
|
-
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
28439
28981
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
|
|
28440
28982
|
const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
|
|
28441
28983
|
const footerDragRef = useRef14(null);
|
|
@@ -28462,6 +29004,21 @@ function OhhwellsBridge() {
|
|
|
28462
29004
|
const stylesRef = useRef14("");
|
|
28463
29005
|
const appliedDrawerRef = useRef14(null);
|
|
28464
29006
|
const pendingDeleteUndoRef = useRef14(null);
|
|
29007
|
+
const [floatingPanel, setFloatingPanel] = useState18(null);
|
|
29008
|
+
const floatingPanelOpenRef = useRef14(false);
|
|
29009
|
+
const floatingPanelRef = useRef14(null);
|
|
29010
|
+
floatingPanelRef.current = floatingPanel;
|
|
29011
|
+
const setFloatingPanelRef = useRef14(setFloatingPanel);
|
|
29012
|
+
const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
|
|
29013
|
+
const buttonCollectionDragRef = useRef14(null);
|
|
29014
|
+
const buttonDropInsertIndexRef = useRef14(null);
|
|
29015
|
+
const [buttonDropSlots, setButtonDropSlots] = useState18([]);
|
|
29016
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
|
|
29017
|
+
const buttonPointerDragRef = useRef14(null);
|
|
29018
|
+
const [buttonStyleTick, setButtonStyleTick] = useState18(0);
|
|
29019
|
+
const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
|
|
29020
|
+
const [editorViewport, setEditorViewport] = useState18("desktop");
|
|
29021
|
+
const [parentScrollSnap, setParentScrollSnap] = useState18(null);
|
|
28465
29022
|
const [sitePages, setSitePages] = useState18([]);
|
|
28466
29023
|
const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
|
|
28467
29024
|
const [sectionsByPath, setSectionsByPath] = useState18({});
|
|
@@ -28471,7 +29028,18 @@ function OhhwellsBridge() {
|
|
|
28471
29028
|
const linkPopoverOpenRef = useRef14(false);
|
|
28472
29029
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
28473
29030
|
setLinkPopoverRef.current = setLinkPopover;
|
|
29031
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
28474
29032
|
linkPopoverSessionRef.current = linkPopover;
|
|
29033
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
29034
|
+
useEffect22(() => {
|
|
29035
|
+
const syncViewport = () => {
|
|
29036
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
29037
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
29038
|
+
};
|
|
29039
|
+
syncViewport();
|
|
29040
|
+
window.addEventListener("resize", syncViewport);
|
|
29041
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
29042
|
+
}, []);
|
|
28475
29043
|
useEffect22(() => {
|
|
28476
29044
|
setSectionOrderPersistHandler((entries) => {
|
|
28477
29045
|
const currentPath = window.location.pathname;
|
|
@@ -30187,7 +30755,7 @@ function OhhwellsBridge() {
|
|
|
30187
30755
|
isFooterFrameSelection,
|
|
30188
30756
|
postToParent2
|
|
30189
30757
|
]);
|
|
30190
|
-
|
|
30758
|
+
useLayoutEffect7(() => {
|
|
30191
30759
|
if (!subdomain || isEditMode) {
|
|
30192
30760
|
setFetchState("done");
|
|
30193
30761
|
return;
|
|
@@ -30214,6 +30782,7 @@ function OhhwellsBridge() {
|
|
|
30214
30782
|
applyAiFooterFromContent(content);
|
|
30215
30783
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30216
30784
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
30785
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30217
30786
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30218
30787
|
}
|
|
30219
30788
|
applyBrandChrome(content);
|
|
@@ -30224,12 +30793,12 @@ function OhhwellsBridge() {
|
|
|
30224
30793
|
if (key === "__ohw_sections") continue;
|
|
30225
30794
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30226
30795
|
if (key === AI_FOOTER_KEY) continue;
|
|
30796
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30797
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30227
30798
|
if (key === BRAND_KIT_KEY) continue;
|
|
30228
30799
|
if (key === STYLE_STORE_KEY) continue;
|
|
30229
30800
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30230
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30231
30801
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30232
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30233
30802
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30234
30803
|
continue;
|
|
30235
30804
|
}
|
|
@@ -30399,8 +30968,32 @@ function OhhwellsBridge() {
|
|
|
30399
30968
|
if (!isEditMode) return;
|
|
30400
30969
|
let saveTimer = null;
|
|
30401
30970
|
const onInput = (e) => {
|
|
30402
|
-
const
|
|
30403
|
-
if (!
|
|
30971
|
+
const target = e.target;
|
|
30972
|
+
if (!target) return;
|
|
30973
|
+
const optionIndex = getDropdownOptionIndex(target);
|
|
30974
|
+
if (optionIndex != null) {
|
|
30975
|
+
const wrapper2 = getFieldWrapper(target);
|
|
30976
|
+
if (!wrapper2 || wrapper2 !== fieldPickElRef.current) return;
|
|
30977
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
30978
|
+
const owner2 = wrapper2.closest('[data-ohw-editable="form"]');
|
|
30979
|
+
saveTimer = setTimeout(() => {
|
|
30980
|
+
const form = owner2 ?? formPickElRef.current;
|
|
30981
|
+
if (!form) return;
|
|
30982
|
+
commitDropdownOptionsFromPanel(wrapper2);
|
|
30983
|
+
persistFields(form);
|
|
30984
|
+
const row = listDropdownOptionRows(wrapper2)[optionIndex];
|
|
30985
|
+
if (row) {
|
|
30986
|
+
setDropdownOptionPick({
|
|
30987
|
+
index: optionIndex,
|
|
30988
|
+
rect: row.getBoundingClientRect(),
|
|
30989
|
+
canDelete: listDropdownOptionRows(wrapper2).length > 1
|
|
30990
|
+
});
|
|
30991
|
+
}
|
|
30992
|
+
}, 400);
|
|
30993
|
+
return;
|
|
30994
|
+
}
|
|
30995
|
+
const input = target;
|
|
30996
|
+
if (!("value" in input)) return;
|
|
30404
30997
|
const wrapper = getFieldWrapper(input);
|
|
30405
30998
|
if (!wrapper || wrapper !== fieldPickElRef.current) return;
|
|
30406
30999
|
if (saveTimer) clearTimeout(saveTimer);
|
|
@@ -30464,17 +31057,18 @@ function OhhwellsBridge() {
|
|
|
30464
31057
|
}
|
|
30465
31058
|
applyAiFooterFromContent(content);
|
|
30466
31059
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31060
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30467
31061
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30468
31062
|
}
|
|
30469
31063
|
for (const [key, val] of Object.entries(content)) {
|
|
30470
31064
|
if (key === "__ohw_sections") continue;
|
|
30471
31065
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30472
31066
|
if (key === AI_FOOTER_KEY) continue;
|
|
31067
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31068
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30473
31069
|
if (key === BRAND_KIT_KEY) continue;
|
|
30474
31070
|
if (key === STYLE_STORE_KEY) continue;
|
|
30475
31071
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30476
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30477
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30478
31072
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30479
31073
|
continue;
|
|
30480
31074
|
}
|
|
@@ -30561,7 +31155,7 @@ function OhhwellsBridge() {
|
|
|
30561
31155
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
30562
31156
|
};
|
|
30563
31157
|
}, [subdomain, isEditMode, pathname]);
|
|
30564
|
-
|
|
31158
|
+
useLayoutEffect7(() => {
|
|
30565
31159
|
const el = document.getElementById("ohw-loader");
|
|
30566
31160
|
if (!el) return;
|
|
30567
31161
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
@@ -30746,26 +31340,11 @@ function OhhwellsBridge() {
|
|
|
30746
31340
|
const t2 = setTimeout(measure, 500);
|
|
30747
31341
|
const ro = new ResizeObserver(schedule);
|
|
30748
31342
|
ro.observe(document.body);
|
|
30749
|
-
let lastWidth = window.innerWidth;
|
|
30750
|
-
let resizeTimers = [];
|
|
30751
|
-
const clearResizeTimers = () => {
|
|
30752
|
-
resizeTimers.forEach(clearTimeout);
|
|
30753
|
-
resizeTimers = [];
|
|
30754
|
-
};
|
|
30755
|
-
const handleResize = () => {
|
|
30756
|
-
if (window.innerWidth === lastWidth) return;
|
|
30757
|
-
lastWidth = window.innerWidth;
|
|
30758
|
-
clearResizeTimers();
|
|
30759
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
30760
|
-
};
|
|
30761
|
-
window.addEventListener("resize", handleResize);
|
|
30762
31343
|
return () => {
|
|
30763
31344
|
clearTimeout(t1);
|
|
30764
31345
|
clearTimeout(t2);
|
|
30765
31346
|
if (raf != null) cancelAnimationFrame(raf);
|
|
30766
31347
|
ro.disconnect();
|
|
30767
|
-
clearResizeTimers();
|
|
30768
|
-
window.removeEventListener("resize", handleResize);
|
|
30769
31348
|
};
|
|
30770
31349
|
}, [pathname, isEditMode, postToParent2]);
|
|
30771
31350
|
useEffect22(() => {
|
|
@@ -30926,6 +31505,7 @@ function OhhwellsBridge() {
|
|
|
30926
31505
|
field can be picked and hovered from anywhere inside it (OHH-642). */
|
|
30927
31506
|
[data-ohw-editable="form"] [data-ohw-form-field] input,
|
|
30928
31507
|
[data-ohw-editable="form"] [data-ohw-form-field] textarea,
|
|
31508
|
+
[data-ohw-editable="form"] [data-ohw-form-field] select,
|
|
30929
31509
|
[data-ohw-editable="form"] [data-ohw-form-field] label {
|
|
30930
31510
|
pointer-events: auto !important;
|
|
30931
31511
|
cursor: pointer !important;
|
|
@@ -30939,10 +31519,35 @@ function OhhwellsBridge() {
|
|
|
30939
31519
|
max-width: 100% !important;
|
|
30940
31520
|
}
|
|
30941
31521
|
[data-ohw-editable="form"] [data-ohw-form-field] input,
|
|
30942
|
-
[data-ohw-editable="form"] [data-ohw-form-field] textarea
|
|
31522
|
+
[data-ohw-editable="form"] [data-ohw-form-field] textarea,
|
|
31523
|
+
[data-ohw-editable="form"] [data-ohw-form-field] select {
|
|
30943
31524
|
box-sizing: border-box !important;
|
|
30944
31525
|
width: 100% !important;
|
|
30945
31526
|
}
|
|
31527
|
+
/* Dropdown field editor (OHH-919): Closed = select alone; Open = select + panel below.
|
|
31528
|
+
Caret only \u2014 keep the template's own background/border/type on the select. */
|
|
31529
|
+
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-field-type="dropdown"] select {
|
|
31530
|
+
appearance: none !important;
|
|
31531
|
+
-webkit-appearance: none !important;
|
|
31532
|
+
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;
|
|
31533
|
+
background-repeat: no-repeat !important;
|
|
31534
|
+
background-position: right 12px center !important;
|
|
31535
|
+
padding-right: 36px !important;
|
|
31536
|
+
pointer-events: none !important;
|
|
31537
|
+
}
|
|
31538
|
+
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] select {
|
|
31539
|
+
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;
|
|
31540
|
+
}
|
|
31541
|
+
[data-ohw-editable="form"] [data-ohw-form-field] [data-ohw-dropdown-panel] {
|
|
31542
|
+
display: none !important;
|
|
31543
|
+
}
|
|
31544
|
+
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] [data-ohw-dropdown-panel] {
|
|
31545
|
+
display: block !important;
|
|
31546
|
+
}
|
|
31547
|
+
[data-ohw-editable="form"] [data-ohw-dropdown-option] {
|
|
31548
|
+
cursor: text !important;
|
|
31549
|
+
outline: none !important;
|
|
31550
|
+
}
|
|
30946
31551
|
/* Somewhere to click the block itself, on every side (OHH-642) \u2014 editor only. */
|
|
30947
31552
|
[data-ohw-editable="form"] {
|
|
30948
31553
|
padding: 18px !important;
|
|
@@ -30950,13 +31555,14 @@ function OhhwellsBridge() {
|
|
|
30950
31555
|
flex-wrap: wrap !important;
|
|
30951
31556
|
align-items: flex-end !important;
|
|
30952
31557
|
}
|
|
30953
|
-
/*
|
|
30954
|
-
flex
|
|
30955
|
-
there and inflates every field to the tallest one's size. */
|
|
31558
|
+
/* Width floor for horizontal rows \u2014 never flex-basis. On a column form
|
|
31559
|
+
'flex-basis: 12rem' becomes HEIGHT and fields grow empty space (OHH-919). */
|
|
30956
31560
|
[data-ohw-editable="form"]:not([data-ai-form]) [data-ohw-form-field] {
|
|
30957
|
-
flex: 1 1
|
|
31561
|
+
flex: 1 1 auto !important;
|
|
30958
31562
|
min-width: min(12rem, 100%) !important;
|
|
30959
31563
|
max-width: 100% !important;
|
|
31564
|
+
height: auto !important;
|
|
31565
|
+
align-self: flex-start !important;
|
|
30960
31566
|
}
|
|
30961
31567
|
/* Placeholder text lives in the value while selected. currentColor inside color-mix
|
|
30962
31568
|
resolves to the *inherited* color, so reverse-print footers washed it out on white
|
|
@@ -31062,6 +31668,13 @@ function OhhwellsBridge() {
|
|
|
31062
31668
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
31063
31669
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
31064
31670
|
if (isInsideLinkEditor(target)) return;
|
|
31671
|
+
if (isInsideFloatingPanel(target)) return;
|
|
31672
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
31673
|
+
if (target.closest(
|
|
31674
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
31675
|
+
)) {
|
|
31676
|
+
return;
|
|
31677
|
+
}
|
|
31065
31678
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
31066
31679
|
clearMediaSelectionRef.current();
|
|
31067
31680
|
}
|
|
@@ -31085,8 +31698,6 @@ function OhhwellsBridge() {
|
|
|
31085
31698
|
return;
|
|
31086
31699
|
}
|
|
31087
31700
|
}
|
|
31088
|
-
if (isInsideFloatingPanel(target)) return;
|
|
31089
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
31090
31701
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
31091
31702
|
if (collectionItem) {
|
|
31092
31703
|
e.preventDefault();
|
|
@@ -31099,7 +31710,7 @@ function OhhwellsBridge() {
|
|
|
31099
31710
|
return;
|
|
31100
31711
|
}
|
|
31101
31712
|
if (target.closest(
|
|
31102
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
31713
|
+
'[data-ohw-field-toolbar], [data-ohw-dropdown-option-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
31103
31714
|
)) {
|
|
31104
31715
|
return;
|
|
31105
31716
|
}
|
|
@@ -31109,8 +31720,29 @@ function OhhwellsBridge() {
|
|
|
31109
31720
|
if (formEl && formKeyOf(formEl) && !onSuccessText && !isCtaButton(target)) {
|
|
31110
31721
|
const fieldEl = getFieldWrapper(target);
|
|
31111
31722
|
if (fieldEl) {
|
|
31723
|
+
const optionIndex = getDropdownOptionIndex(target);
|
|
31724
|
+
if (optionIndex != null && fieldTypeOf(fieldEl) === "dropdown" && isDropdownPreviewOpen(fieldEl)) {
|
|
31725
|
+
e.preventDefault();
|
|
31726
|
+
e.stopPropagation();
|
|
31727
|
+
deactivateRef.current();
|
|
31728
|
+
deselectRef.current();
|
|
31729
|
+
formPickElRef.current = formEl;
|
|
31730
|
+
setFormPickRect(null);
|
|
31731
|
+
if (fieldPickElRef.current !== fieldEl) selectField(fieldEl);
|
|
31732
|
+
setDropdownPreviewOpen(fieldEl, true);
|
|
31733
|
+
setFieldPickState({
|
|
31734
|
+
type: "dropdown",
|
|
31735
|
+
required: isFieldRequired(fieldEl),
|
|
31736
|
+
dropdownOpen: true
|
|
31737
|
+
});
|
|
31738
|
+
refreshDropdownOptionPick(fieldEl, optionIndex);
|
|
31739
|
+
listDropdownOptionRows(fieldEl)[optionIndex]?.focus();
|
|
31740
|
+
return;
|
|
31741
|
+
}
|
|
31112
31742
|
const label = target.closest("label");
|
|
31113
|
-
if (label && fieldPickElRef.current === fieldEl)
|
|
31743
|
+
if (label && fieldPickElRef.current === fieldEl && selectedDropdownOptionIndex(fieldEl) == null) {
|
|
31744
|
+
return;
|
|
31745
|
+
}
|
|
31114
31746
|
e.preventDefault();
|
|
31115
31747
|
e.stopPropagation();
|
|
31116
31748
|
deactivateRef.current();
|
|
@@ -31118,7 +31750,9 @@ function OhhwellsBridge() {
|
|
|
31118
31750
|
formPickElRef.current = formEl;
|
|
31119
31751
|
setFormPickRect(null);
|
|
31120
31752
|
selectField(fieldEl);
|
|
31121
|
-
if (!label
|
|
31753
|
+
if (!label && fieldTypeOf(fieldEl) !== "dropdown") {
|
|
31754
|
+
fieldEl.querySelector("input, textarea")?.focus();
|
|
31755
|
+
}
|
|
31122
31756
|
return;
|
|
31123
31757
|
}
|
|
31124
31758
|
clearFieldPick();
|
|
@@ -31266,9 +31900,13 @@ function OhhwellsBridge() {
|
|
|
31266
31900
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
31267
31901
|
e.preventDefault();
|
|
31268
31902
|
e.stopPropagation();
|
|
31269
|
-
selectIconElementRef.current(editable);
|
|
31270
31903
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
31271
31904
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
31905
|
+
if (aiIcon) {
|
|
31906
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
31907
|
+
} else {
|
|
31908
|
+
selectIconElementRef.current(editable);
|
|
31909
|
+
}
|
|
31272
31910
|
postToParentRef.current({
|
|
31273
31911
|
type: "ow:icon-pick",
|
|
31274
31912
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -31496,6 +32134,9 @@ function OhhwellsBridge() {
|
|
|
31496
32134
|
setHoveredItemRect(null);
|
|
31497
32135
|
hoveredNavContainerRef.current = null;
|
|
31498
32136
|
setHoveredNavContainerRect(null);
|
|
32137
|
+
siblingHintElRef.current = null;
|
|
32138
|
+
setSiblingHintRect(null);
|
|
32139
|
+
setSiblingHintRects([]);
|
|
31499
32140
|
return;
|
|
31500
32141
|
}
|
|
31501
32142
|
{
|
|
@@ -31618,7 +32259,6 @@ function OhhwellsBridge() {
|
|
|
31618
32259
|
hoveredNavContainerRef.current = null;
|
|
31619
32260
|
setHoveredNavContainerRect(null);
|
|
31620
32261
|
hoveredItemElRef.current = editable;
|
|
31621
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
31622
32262
|
}
|
|
31623
32263
|
}
|
|
31624
32264
|
}
|
|
@@ -32325,7 +32965,11 @@ function OhhwellsBridge() {
|
|
|
32325
32965
|
};
|
|
32326
32966
|
const handleMouseMove = (e) => {
|
|
32327
32967
|
const { clientX, clientY } = e;
|
|
32328
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
32968
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
32969
|
+
dismissImageHover();
|
|
32970
|
+
clearImageHover();
|
|
32971
|
+
return;
|
|
32972
|
+
}
|
|
32329
32973
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
32330
32974
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
32331
32975
|
formHoverElRef.current = null;
|
|
@@ -32354,7 +32998,12 @@ function OhhwellsBridge() {
|
|
|
32354
32998
|
setHoveredItemRect(null);
|
|
32355
32999
|
hoveredNavContainerRef.current = null;
|
|
32356
33000
|
setHoveredNavContainerRect(null);
|
|
33001
|
+
siblingHintElRef.current = null;
|
|
33002
|
+
setSiblingHintRect(null);
|
|
33003
|
+
setSiblingHintRects([]);
|
|
32357
33004
|
dismissImageHover();
|
|
33005
|
+
clearImageHover();
|
|
33006
|
+
setSectionGap(null);
|
|
32358
33007
|
return;
|
|
32359
33008
|
}
|
|
32360
33009
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -32366,7 +33015,11 @@ function OhhwellsBridge() {
|
|
|
32366
33015
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
32367
33016
|
const { clientX, clientY } = e.data;
|
|
32368
33017
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
32369
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
33018
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
33019
|
+
dismissImageHover();
|
|
33020
|
+
clearImageHover();
|
|
33021
|
+
return;
|
|
33022
|
+
}
|
|
32370
33023
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
32371
33024
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
32372
33025
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -32746,6 +33399,7 @@ function OhhwellsBridge() {
|
|
|
32746
33399
|
applyAiFooterFromContent(content);
|
|
32747
33400
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
32748
33401
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
33402
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
32749
33403
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
32750
33404
|
}
|
|
32751
33405
|
applyBrandChrome(content);
|
|
@@ -32760,12 +33414,12 @@ function OhhwellsBridge() {
|
|
|
32760
33414
|
}
|
|
32761
33415
|
if (key === AI_SECTIONS_KEY) continue;
|
|
32762
33416
|
if (key === AI_FOOTER_KEY) continue;
|
|
33417
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
33418
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
32763
33419
|
if (key === BRAND_KIT_KEY) continue;
|
|
32764
33420
|
if (key === STYLE_STORE_KEY) continue;
|
|
32765
33421
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
32766
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
32767
33422
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
32768
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
32769
33423
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
32770
33424
|
continue;
|
|
32771
33425
|
}
|
|
@@ -33438,6 +34092,12 @@ function OhhwellsBridge() {
|
|
|
33438
34092
|
closeLinkPopoverRef.current();
|
|
33439
34093
|
return;
|
|
33440
34094
|
}
|
|
34095
|
+
if (floatingPanelOpenRef.current) {
|
|
34096
|
+
setFloatingPanelRef.current(null);
|
|
34097
|
+
deselectRef.current();
|
|
34098
|
+
deactivateRef.current();
|
|
34099
|
+
return;
|
|
34100
|
+
}
|
|
33441
34101
|
deselectRef.current();
|
|
33442
34102
|
deactivateRef.current();
|
|
33443
34103
|
clearMediaSelectionRef.current();
|
|
@@ -34267,10 +34927,10 @@ function OhhwellsBridge() {
|
|
|
34267
34927
|
window.removeEventListener("message", handleDuplicateSection);
|
|
34268
34928
|
window.removeEventListener("message", handleDeactivate);
|
|
34269
34929
|
window.removeEventListener("message", handleSelectNav);
|
|
34270
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
34271
34930
|
window.removeEventListener("message", handleToastAction);
|
|
34272
34931
|
window.removeEventListener("message", handleFormCount);
|
|
34273
34932
|
window.removeEventListener("message", handleUiEscape);
|
|
34933
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
34274
34934
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
34275
34935
|
autoSaveTimers.current.clear();
|
|
34276
34936
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -34564,7 +35224,7 @@ function OhhwellsBridge() {
|
|
|
34564
35224
|
postToParent2({
|
|
34565
35225
|
type: "ow:ready",
|
|
34566
35226
|
version: "1",
|
|
34567
|
-
bridgeVersion: "0.1.
|
|
35227
|
+
bridgeVersion: "0.1.179-next.474",
|
|
34568
35228
|
path: pathname,
|
|
34569
35229
|
nodes: collectEditableNodes(editContentRef.current),
|
|
34570
35230
|
sections
|
|
@@ -35250,11 +35910,11 @@ function OhhwellsBridge() {
|
|
|
35250
35910
|
},
|
|
35251
35911
|
[postToParent2]
|
|
35252
35912
|
);
|
|
35253
|
-
return /* @__PURE__ */ jsxs26(
|
|
35913
|
+
return /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
35254
35914
|
/* @__PURE__ */ jsx40(OhwLoaderSurface, {}),
|
|
35255
35915
|
subdomain && !isEditMode && showBranding && /* @__PURE__ */ jsx40(MadeWithOhhWells, {}),
|
|
35256
35916
|
bridgeRoot ? createPortal3(
|
|
35257
|
-
/* @__PURE__ */ jsxs26(
|
|
35917
|
+
/* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
35258
35918
|
/* @__PURE__ */ jsx40("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
35259
35919
|
isEditMode && /* @__PURE__ */ jsx40(
|
|
35260
35920
|
AiSectionOverlay,
|
|
@@ -35455,7 +36115,7 @@ function OhhwellsBridge() {
|
|
|
35455
36115
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
|
|
35456
36116
|
onClick: () => setFieldTypePickerOpen((open) => !open),
|
|
35457
36117
|
"data-ohw-add-field": "",
|
|
35458
|
-
children: /* @__PURE__ */ jsx40(
|
|
36118
|
+
children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
|
|
35459
36119
|
}
|
|
35460
36120
|
),
|
|
35461
36121
|
/* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
@@ -35548,7 +36208,7 @@ function OhhwellsBridge() {
|
|
|
35548
36208
|
chromeGap: formHoverElRef.current && getFieldWrapper(formHoverElRef.current) ? 8 : 24
|
|
35549
36209
|
}
|
|
35550
36210
|
),
|
|
35551
|
-
fieldPickRect && fieldPickState && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ jsx40(
|
|
36211
|
+
fieldPickRect && fieldPickState && !dropdownOptionPick && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ jsx40(
|
|
35552
36212
|
ItemInteractionLayer,
|
|
35553
36213
|
{
|
|
35554
36214
|
rect: fieldPickRect,
|
|
@@ -35565,6 +36225,8 @@ function OhhwellsBridge() {
|
|
|
35565
36225
|
{
|
|
35566
36226
|
type: fieldPickState.type,
|
|
35567
36227
|
required: fieldPickState.required,
|
|
36228
|
+
dropdownOpen: fieldPickState.dropdownOpen,
|
|
36229
|
+
onDropdownOpenChange: handleFieldDropdownOpenChange,
|
|
35568
36230
|
onTypeChange: handleFieldTypeChange,
|
|
35569
36231
|
onRequiredToggle: handleFieldRequiredToggle,
|
|
35570
36232
|
onDuplicate: handleFieldDuplicate,
|
|
@@ -35573,6 +36235,25 @@ function OhhwellsBridge() {
|
|
|
35573
36235
|
)
|
|
35574
36236
|
}
|
|
35575
36237
|
),
|
|
36238
|
+
dropdownOptionPick && !isItemDragging && /* @__PURE__ */ jsx40(
|
|
36239
|
+
ItemInteractionLayer,
|
|
36240
|
+
{
|
|
36241
|
+
rect: dropdownOptionPick.rect,
|
|
36242
|
+
state: "active-top",
|
|
36243
|
+
itemDragSurface: false,
|
|
36244
|
+
toolbarAlign: "center",
|
|
36245
|
+
chromeGap: 4,
|
|
36246
|
+
showHandle: false,
|
|
36247
|
+
toolbar: /* @__PURE__ */ jsx40(
|
|
36248
|
+
DropdownOptionToolbar,
|
|
36249
|
+
{
|
|
36250
|
+
canDelete: dropdownOptionPick.canDelete,
|
|
36251
|
+
onDuplicate: handleDropdownOptionDuplicate,
|
|
36252
|
+
onDelete: handleDropdownOptionDelete
|
|
36253
|
+
}
|
|
36254
|
+
)
|
|
36255
|
+
}
|
|
36256
|
+
),
|
|
35576
36257
|
fieldDragging ? fieldDropSlots.map((slot, i) => /* @__PURE__ */ jsx40(
|
|
35577
36258
|
"div",
|
|
35578
36259
|
{
|
|
@@ -35683,7 +36364,7 @@ function OhhwellsBridge() {
|
|
|
35683
36364
|
) : void 0
|
|
35684
36365
|
}
|
|
35685
36366
|
),
|
|
35686
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && !isRectOutsideClip(toolbarRect, getIframeVisibleClip(parentScrollRef.current)) && /* @__PURE__ */ jsxs26(
|
|
36367
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && !isRectOutsideClip(toolbarRect, getIframeVisibleClip(parentScrollRef.current)) && /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
35687
36368
|
/* @__PURE__ */ jsx40(
|
|
35688
36369
|
EditGlowChrome,
|
|
35689
36370
|
{
|
|
@@ -35867,9 +36548,9 @@ function OhhwellsBridge() {
|
|
|
35867
36548
|
|
|
35868
36549
|
// src/ui/EmptySection.tsx
|
|
35869
36550
|
import Link3 from "next/link";
|
|
35870
|
-
import { Fragment as
|
|
36551
|
+
import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
35871
36552
|
function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey }) {
|
|
35872
|
-
return /* @__PURE__ */ jsxs27(
|
|
36553
|
+
return /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
35873
36554
|
/* @__PURE__ */ jsx41(
|
|
35874
36555
|
"p",
|
|
35875
36556
|
{
|