@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.cjs
CHANGED
|
@@ -1435,7 +1435,8 @@ function toneOverlayLogos(deps, root, photoSections, boxes) {
|
|
|
1435
1435
|
if (root.matches(OVERLAY_LOGO_SELECTOR)) logos.unshift(root);
|
|
1436
1436
|
for (const logo of logos) {
|
|
1437
1437
|
if (onOwnSurface(deps, logo, root)) {
|
|
1438
|
-
logo.removeAttribute(OVERLAY_TONE_ATTR);
|
|
1438
|
+
if (paintOver(deps.style(logo), { r: 0, g: 0, b: 0, a: 0 }).painted) logo.removeAttribute(OVERLAY_TONE_ATTR);
|
|
1439
|
+
else clearOverlayTone(logo);
|
|
1439
1440
|
continue;
|
|
1440
1441
|
}
|
|
1441
1442
|
const box = deps.rect(logo);
|
|
@@ -8233,6 +8234,21 @@ function pricingCardFeatureCount(tree, index) {
|
|
|
8233
8234
|
const target = findPricingCollection(tree)?.children?.[index];
|
|
8234
8235
|
return target ? pricingFeatureList(target).length : 0;
|
|
8235
8236
|
}
|
|
8237
|
+
function prevailingFeatureIcon(features) {
|
|
8238
|
+
const counts = /* @__PURE__ */ new Map();
|
|
8239
|
+
for (const row of features) {
|
|
8240
|
+
const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
|
|
8241
|
+
const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
|
|
8242
|
+
entry.count += 1;
|
|
8243
|
+
counts.set(key, entry);
|
|
8244
|
+
}
|
|
8245
|
+
let best = null;
|
|
8246
|
+
for (const entry of counts.values()) {
|
|
8247
|
+
if (!best || entry.count > best.count) best = entry;
|
|
8248
|
+
}
|
|
8249
|
+
if (!best) return {};
|
|
8250
|
+
return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
|
|
8251
|
+
}
|
|
8236
8252
|
function addPricingCardFeature(tree, index, text) {
|
|
8237
8253
|
return withPricingCollection(tree, (collection) => {
|
|
8238
8254
|
const children = collection.children;
|
|
@@ -8241,7 +8257,7 @@ function addPricingCardFeature(tree, index, text) {
|
|
|
8241
8257
|
const features = pricingFeatureList(target);
|
|
8242
8258
|
if (features.length >= PRICING_FEATURES_MAX) return false;
|
|
8243
8259
|
target.slots = target.slots ?? {};
|
|
8244
|
-
target.slots.features = [...features, { text }];
|
|
8260
|
+
target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
|
|
8245
8261
|
return true;
|
|
8246
8262
|
});
|
|
8247
8263
|
}
|
|
@@ -9776,7 +9792,7 @@ var AI_MOBILE_CSS = [
|
|
|
9776
9792
|
// page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
|
|
9777
9793
|
// template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
|
|
9778
9794
|
// an exact figure from (no live measurement exists), so this is a safe approximation, not a
|
|
9779
|
-
// pixel-exact fit. Horizontal spacing already comes from `data-ai-
|
|
9795
|
+
// pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
|
|
9780
9796
|
'[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
|
|
9781
9797
|
// A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
|
|
9782
9798
|
// window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
|
|
@@ -9792,8 +9808,10 @@ var AI_MOBILE_CSS = [
|
|
|
9792
9808
|
"[data-ai-section]{overflow-x:hidden}",
|
|
9793
9809
|
// `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
|
|
9794
9810
|
// full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
|
|
9795
|
-
// still got a 20px band of section background down both sides on a phone.
|
|
9796
|
-
|
|
9811
|
+
// still got a 20px band of section background down both sides on a phone. The footer's own
|
|
9812
|
+
// container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
|
|
9813
|
+
"[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
|
|
9814
|
+
"[data-ai-container]{padding:0 20px !important}",
|
|
9797
9815
|
"[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
|
|
9798
9816
|
"[data-ai-cell]{width:100%;min-width:0}",
|
|
9799
9817
|
// The rule above turns every row into a COLUMN flex container on phones, which silently breaks
|
|
@@ -9998,6 +10016,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
|
|
|
9998
10016
|
function textAttrs(ctx, path) {
|
|
9999
10017
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
10000
10018
|
}
|
|
10019
|
+
var AI_RESPONSIVE_CSS = [
|
|
10020
|
+
"@media (max-width: 960px) {",
|
|
10021
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
10022
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
10023
|
+
"}",
|
|
10024
|
+
"@media (max-width: 640px) {",
|
|
10025
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
10026
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
10027
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
10028
|
+
// `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
|
|
10029
|
+
// the comment there. This sheet's copy is the narrower selector, so without the exemption it
|
|
10030
|
+
// flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
|
|
10031
|
+
// viewport with the heading/CTA in flow *under* the image, 219px of section background where the
|
|
10032
|
+
// layered text used to be.
|
|
10033
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
|
|
10034
|
+
' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
|
|
10035
|
+
// `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
|
|
10036
|
+
// is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
|
|
10037
|
+
// a full-bleed hero gets its 20px side band back below 640px only — the one width where the
|
|
10038
|
+
// other rule had already been taught to stand down.
|
|
10039
|
+
" [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
10040
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
10041
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
10042
|
+
"}"
|
|
10043
|
+
].join("\n");
|
|
10001
10044
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
10002
10045
|
function MediaBox({
|
|
10003
10046
|
refValue,
|
|
@@ -10052,7 +10095,7 @@ function MediaBox({
|
|
|
10052
10095
|
position: fill ? "absolute" : void 0,
|
|
10053
10096
|
inset: fill ? 0 : void 0,
|
|
10054
10097
|
width: fill ? "100%" : fixedSize ? "auto" : "100%",
|
|
10055
|
-
height: fill ? "100%" : void 0,
|
|
10098
|
+
height: fill ? "100%" : fixedSize ? height : void 0,
|
|
10056
10099
|
aspectRatio: fill ? void 0 : aspectRatio,
|
|
10057
10100
|
minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
|
|
10058
10101
|
borderRadius: radius,
|
|
@@ -11554,7 +11597,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
11554
11597
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
11555
11598
|
"div",
|
|
11556
11599
|
{
|
|
11557
|
-
"data-ai-grid":
|
|
11600
|
+
"data-ai-grid": String(itemsPerRow),
|
|
11558
11601
|
"data-ohw-pricing-collection": isPricing ? "" : void 0,
|
|
11559
11602
|
style: {
|
|
11560
11603
|
display: "grid",
|
|
@@ -11856,7 +11899,7 @@ function renderNode(node, ctx, path, ambientAlign) {
|
|
|
11856
11899
|
},
|
|
11857
11900
|
children: [
|
|
11858
11901
|
i > 0 && ctx.heroOverlapFullBleed ? (
|
|
11859
|
-
// The section's `data-ai-
|
|
11902
|
+
// The section's `data-ai-section-inner` gave up its max-width/gutter so the base
|
|
11860
11903
|
// layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
|
|
11861
11904
|
// scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
|
|
11862
11905
|
// the full section width instead of reading at the usual content width.
|
|
@@ -12270,6 +12313,7 @@ function AiTreeRenderer({
|
|
|
12270
12313
|
...fillHeight ? { "data-ai-fill-height": "" } : {},
|
|
12271
12314
|
...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
|
|
12272
12315
|
...bgAttrs,
|
|
12316
|
+
"data-ai-responsive": "",
|
|
12273
12317
|
style: {
|
|
12274
12318
|
position: "relative",
|
|
12275
12319
|
padding: `${padCss} 0`,
|
|
@@ -12283,12 +12327,13 @@ function AiTreeRenderer({
|
|
|
12283
12327
|
...fillHeight ? { display: "grid" } : {}
|
|
12284
12328
|
},
|
|
12285
12329
|
children: [
|
|
12286
|
-
|
|
12330
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
12287
12331
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
12332
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
12288
12333
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
12289
12334
|
"div",
|
|
12290
12335
|
{
|
|
12291
|
-
"data-ai-
|
|
12336
|
+
"data-ai-section-inner": "",
|
|
12292
12337
|
...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
|
|
12293
12338
|
style: {
|
|
12294
12339
|
position: "relative",
|
|
@@ -12305,7 +12350,7 @@ function AiTreeRenderer({
|
|
|
12305
12350
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
12306
12351
|
"div",
|
|
12307
12352
|
{
|
|
12308
|
-
"data-ai-
|
|
12353
|
+
"data-ai-columns": "",
|
|
12309
12354
|
style: {
|
|
12310
12355
|
display: "grid",
|
|
12311
12356
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -12967,9 +13012,10 @@ function applyAiSectionsToDom(state, options) {
|
|
|
12967
13012
|
if (existing && existing.serialized === serialized && existing.container.isConnected) {
|
|
12968
13013
|
continue;
|
|
12969
13014
|
}
|
|
12970
|
-
const isNewMount = !existing || !existing.container.isConnected;
|
|
12971
13015
|
let container = existing?.container;
|
|
13016
|
+
let isNewMount = false;
|
|
12972
13017
|
if (!container || !container.isConnected) {
|
|
13018
|
+
isNewMount = true;
|
|
12973
13019
|
existing?.root.unmount();
|
|
12974
13020
|
container?.remove();
|
|
12975
13021
|
container = document.createElement("div");
|
|
@@ -13307,6 +13353,34 @@ function minSpanForFooterBlock(type) {
|
|
|
13307
13353
|
return 3;
|
|
13308
13354
|
}
|
|
13309
13355
|
}
|
|
13356
|
+
function readLiveSocialItems() {
|
|
13357
|
+
const root = getFooterRoot();
|
|
13358
|
+
const row = root?.querySelector("[data-ohw-socials-row]");
|
|
13359
|
+
if (!row) return [];
|
|
13360
|
+
const items = [];
|
|
13361
|
+
for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
|
|
13362
|
+
const href = anchor.getAttribute("href")?.trim() ?? "";
|
|
13363
|
+
const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
|
|
13364
|
+
const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
|
|
13365
|
+
if (!platform || !/^https?:\/\//i.test(href)) continue;
|
|
13366
|
+
items.push({ platform, href });
|
|
13367
|
+
}
|
|
13368
|
+
return items;
|
|
13369
|
+
}
|
|
13370
|
+
function syncSocialRowsFromDom(tree) {
|
|
13371
|
+
const root = getFooterRoot();
|
|
13372
|
+
if (!root) return;
|
|
13373
|
+
const row = root.querySelector("[data-ohw-socials-row]");
|
|
13374
|
+
const live = readLiveSocialItems();
|
|
13375
|
+
if (row && live.length === 0) return;
|
|
13376
|
+
for (const col of tree.columns) {
|
|
13377
|
+
col.blocks = col.blocks.flatMap((block) => {
|
|
13378
|
+
if (block.type !== "social-row") return [block];
|
|
13379
|
+
if (!row) return [];
|
|
13380
|
+
return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
|
|
13381
|
+
});
|
|
13382
|
+
}
|
|
13383
|
+
}
|
|
13310
13384
|
function collectBrandBlocks(tree) {
|
|
13311
13385
|
const brand = [];
|
|
13312
13386
|
for (const col of tree.columns) {
|
|
@@ -13552,6 +13626,7 @@ function textOf2(el) {
|
|
|
13552
13626
|
}
|
|
13553
13627
|
function syncFooterTreeLinksFromDom(tree) {
|
|
13554
13628
|
const next = cloneTree2(tree);
|
|
13629
|
+
syncSocialRowsFromDom(next);
|
|
13555
13630
|
const domCols = listFooterColumns().map((col) => {
|
|
13556
13631
|
const heading = getFooterColumnHeadingEl(col);
|
|
13557
13632
|
const title = heading ? textOf2(heading) : void 0;
|
|
@@ -19377,7 +19452,7 @@ function apiBase() {
|
|
|
19377
19452
|
function bridgeVersion() {
|
|
19378
19453
|
try {
|
|
19379
19454
|
if (true) {
|
|
19380
|
-
return "0.1.
|
|
19455
|
+
return "0.1.179-next.474";
|
|
19381
19456
|
}
|
|
19382
19457
|
} catch {
|
|
19383
19458
|
}
|
|
@@ -19391,7 +19466,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
19391
19466
|
return;
|
|
19392
19467
|
}
|
|
19393
19468
|
try {
|
|
19394
|
-
const v = true ? "0.1.
|
|
19469
|
+
const v = true ? "0.1.179-next.474" : "";
|
|
19395
19470
|
if (v) {
|
|
19396
19471
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
19397
19472
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -19470,32 +19545,42 @@ function armLoaderHangBeacon(subdomain, fetchState, hangMs = 15e3) {
|
|
|
19470
19545
|
}
|
|
19471
19546
|
|
|
19472
19547
|
// src/lib/form-fields.ts
|
|
19548
|
+
var DEFAULT_DROPDOWN_OPTIONS = ["Option 1", "Option 2", "Option 3"];
|
|
19473
19549
|
var FIELD_DEFAULTS = {
|
|
19474
19550
|
"short-text": { label: "Short text", placeholder: "Type placeholder text..." },
|
|
19475
19551
|
"long-text": { label: "Long text", placeholder: "How can we help?" },
|
|
19476
19552
|
email: { label: "Email", placeholder: "hello@example.com" },
|
|
19477
|
-
phone: { label: "Phone number", placeholder: "(555) 000-0000" }
|
|
19553
|
+
phone: { label: "Phone number", placeholder: "(555) 000-0000" },
|
|
19554
|
+
dropdown: { label: "Dropdown", placeholder: "" }
|
|
19478
19555
|
};
|
|
19479
19556
|
var FIELD_TYPES = [
|
|
19480
19557
|
{ type: "short-text", label: "Short text" },
|
|
19481
19558
|
{ type: "long-text", label: "Long text" },
|
|
19482
19559
|
{ type: "email", label: "Email" },
|
|
19483
|
-
{ type: "phone", label: "Phone" }
|
|
19560
|
+
{ type: "phone", label: "Phone" },
|
|
19561
|
+
{ type: "dropdown", label: "Dropdown" }
|
|
19484
19562
|
];
|
|
19485
19563
|
var FIELD_ATTR = "data-ohw-form-field";
|
|
19486
19564
|
var FIELD_TYPE_ATTR = "data-ohw-field-type";
|
|
19487
19565
|
var PLACEHOLDER_EDIT_ATTR = "data-ohw-placeholder-edit";
|
|
19566
|
+
var DROPDOWN_PANEL_ATTR = "data-ohw-dropdown-panel";
|
|
19567
|
+
var DROPDOWN_OPTION_ATTR = "data-ohw-dropdown-option";
|
|
19568
|
+
var DROPDOWN_OPEN_ATTR = "data-ohw-dropdown-open";
|
|
19569
|
+
var DROPDOWN_OPTION_SELECTED_ATTR = "data-ohw-dropdown-option-selected";
|
|
19570
|
+
var CONTROL_SELECTOR = "input, textarea, select";
|
|
19488
19571
|
var seedFieldByForm = /* @__PURE__ */ new WeakMap();
|
|
19489
19572
|
function fieldsKey(formKey) {
|
|
19490
19573
|
return `${formKey}-fields`;
|
|
19491
19574
|
}
|
|
19492
19575
|
function inputTagFor(type) {
|
|
19576
|
+
if (type === "dropdown") return { tag: "select" };
|
|
19493
19577
|
if (type === "long-text") return { tag: "textarea" };
|
|
19494
19578
|
if (type === "email") return { tag: "input", inputType: "email" };
|
|
19495
19579
|
if (type === "phone") return { tag: "input", inputType: "tel" };
|
|
19496
19580
|
return { tag: "input", inputType: "text" };
|
|
19497
19581
|
}
|
|
19498
19582
|
function inferType(input) {
|
|
19583
|
+
if (input.tagName === "SELECT") return "dropdown";
|
|
19499
19584
|
if (input.tagName === "TEXTAREA") return "long-text";
|
|
19500
19585
|
const type = input.type;
|
|
19501
19586
|
if (type === "email") return "email";
|
|
@@ -19511,7 +19596,7 @@ function ensureFieldLabel(wrapper, key) {
|
|
|
19511
19596
|
}
|
|
19512
19597
|
return existing;
|
|
19513
19598
|
}
|
|
19514
|
-
const input =
|
|
19599
|
+
const input = fieldControlOf(wrapper);
|
|
19515
19600
|
const label = document.createElement("label");
|
|
19516
19601
|
label.setAttribute("data-ohw-editable", "text");
|
|
19517
19602
|
label.setAttribute("data-ohw-key", `${key}-label`);
|
|
@@ -19521,7 +19606,7 @@ function ensureFieldLabel(wrapper, key) {
|
|
|
19521
19606
|
label.style.fontSize = "13px";
|
|
19522
19607
|
label.style.fontWeight = "500";
|
|
19523
19608
|
label.style.lineHeight = "1.3";
|
|
19524
|
-
const fromPlaceholder = input
|
|
19609
|
+
const fromPlaceholder = input && "getAttribute" in input ? input.getAttribute("placeholder")?.trim() : void 0;
|
|
19525
19610
|
const text = fromPlaceholder && fromPlaceholder.length < 40 ? fromPlaceholder : key.replace(/[-_]/g, " ");
|
|
19526
19611
|
label.textContent = text;
|
|
19527
19612
|
if (input && input.parentElement === wrapper) wrapper.insertBefore(label, input);
|
|
@@ -19534,8 +19619,13 @@ function listFieldWrappers(form) {
|
|
|
19534
19619
|
function getFieldWrapper(el) {
|
|
19535
19620
|
return el?.closest(`[${FIELD_ATTR}]`) ?? null;
|
|
19536
19621
|
}
|
|
19622
|
+
function fieldControlOf(wrapper) {
|
|
19623
|
+
return wrapper.querySelector(CONTROL_SELECTOR);
|
|
19624
|
+
}
|
|
19537
19625
|
function fieldInputOf(wrapper) {
|
|
19538
|
-
|
|
19626
|
+
const control = fieldControlOf(wrapper);
|
|
19627
|
+
if (!control || control.tagName === "SELECT") return null;
|
|
19628
|
+
return control;
|
|
19539
19629
|
}
|
|
19540
19630
|
function fieldLabelOf(wrapper) {
|
|
19541
19631
|
return wrapper.querySelector("label");
|
|
@@ -19547,17 +19637,208 @@ function fieldTypeOf(wrapper) {
|
|
|
19547
19637
|
return wrapper.getAttribute(FIELD_TYPE_ATTR) ?? "short-text";
|
|
19548
19638
|
}
|
|
19549
19639
|
function isFieldRequired(wrapper) {
|
|
19550
|
-
return
|
|
19640
|
+
return fieldControlOf(wrapper)?.hasAttribute("required") ?? false;
|
|
19641
|
+
}
|
|
19642
|
+
function optionFallbackLabel(index) {
|
|
19643
|
+
return `Option ${index + 1}`;
|
|
19644
|
+
}
|
|
19645
|
+
function normalizeOptionText(text, index) {
|
|
19646
|
+
const trimmed = text.replace(/\u00a0/g, " ").trim();
|
|
19647
|
+
return trimmed || optionFallbackLabel(index);
|
|
19648
|
+
}
|
|
19649
|
+
function readDropdownOptions(wrapper) {
|
|
19650
|
+
const select = fieldControlOf(wrapper);
|
|
19651
|
+
if (!select || select.tagName !== "SELECT") return [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19652
|
+
const options = Array.from(select.options).map(
|
|
19653
|
+
(opt, i) => normalizeOptionText(opt.textContent ?? "", i)
|
|
19654
|
+
);
|
|
19655
|
+
return options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19656
|
+
}
|
|
19657
|
+
function fillSelectOptions(select, options) {
|
|
19658
|
+
select.replaceChildren();
|
|
19659
|
+
options.forEach((text, i) => {
|
|
19660
|
+
const opt = document.createElement("option");
|
|
19661
|
+
const label = normalizeOptionText(text, i);
|
|
19662
|
+
opt.value = label;
|
|
19663
|
+
opt.textContent = label;
|
|
19664
|
+
select.appendChild(opt);
|
|
19665
|
+
});
|
|
19666
|
+
if (select.options.length > 0) select.selectedIndex = 0;
|
|
19667
|
+
}
|
|
19668
|
+
function styleDropdownPanelFromSelect(panel, select) {
|
|
19669
|
+
const cs = getComputedStyle(select);
|
|
19670
|
+
panel.style.boxSizing = "border-box";
|
|
19671
|
+
panel.style.width = "100%";
|
|
19672
|
+
panel.style.marginTop = "4px";
|
|
19673
|
+
panel.style.overflow = "hidden";
|
|
19674
|
+
panel.style.borderStyle = cs.borderStyle || "solid";
|
|
19675
|
+
panel.style.borderWidth = cs.borderWidth || "1px";
|
|
19676
|
+
panel.style.borderColor = cs.borderColor;
|
|
19677
|
+
panel.style.borderRadius = cs.borderRadius;
|
|
19678
|
+
panel.style.backgroundColor = cs.backgroundColor;
|
|
19679
|
+
panel.style.fontFamily = cs.fontFamily;
|
|
19680
|
+
panel.style.fontSize = cs.fontSize;
|
|
19681
|
+
panel.style.fontWeight = cs.fontWeight;
|
|
19682
|
+
panel.style.lineHeight = cs.lineHeight;
|
|
19683
|
+
panel.style.color = cs.color;
|
|
19684
|
+
panel.style.boxShadow = cs.boxShadow && cs.boxShadow !== "none" ? cs.boxShadow : "0 8px 24px color-mix(in srgb, #000 12%, transparent)";
|
|
19685
|
+
}
|
|
19686
|
+
function styleDropdownOptionFromSelect(row, select) {
|
|
19687
|
+
const cs = getComputedStyle(select);
|
|
19688
|
+
row.style.paddingTop = cs.paddingTop || "10px";
|
|
19689
|
+
row.style.paddingBottom = cs.paddingBottom || "10px";
|
|
19690
|
+
row.style.paddingLeft = cs.paddingLeft || "12px";
|
|
19691
|
+
row.style.paddingRight = cs.paddingRight || "12px";
|
|
19692
|
+
row.style.fontFamily = cs.fontFamily;
|
|
19693
|
+
row.style.fontSize = cs.fontSize;
|
|
19694
|
+
row.style.fontWeight = cs.fontWeight;
|
|
19695
|
+
row.style.lineHeight = cs.lineHeight;
|
|
19696
|
+
row.style.color = cs.color;
|
|
19697
|
+
row.style.background = "transparent";
|
|
19698
|
+
row.style.border = "none";
|
|
19699
|
+
row.style.outline = "none";
|
|
19700
|
+
row.style.cursor = "text";
|
|
19701
|
+
}
|
|
19702
|
+
function syncDropdownPanel(wrapper) {
|
|
19703
|
+
if (fieldTypeOf(wrapper) !== "dropdown") {
|
|
19704
|
+
wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
|
|
19705
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19706
|
+
return null;
|
|
19707
|
+
}
|
|
19708
|
+
const select = fieldControlOf(wrapper);
|
|
19709
|
+
if (!select || select.tagName !== "SELECT") return null;
|
|
19710
|
+
let panel = wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`);
|
|
19711
|
+
if (!panel) {
|
|
19712
|
+
panel = document.createElement("div");
|
|
19713
|
+
panel.setAttribute(DROPDOWN_PANEL_ATTR, "");
|
|
19714
|
+
select.after(panel);
|
|
19715
|
+
}
|
|
19716
|
+
styleDropdownPanelFromSelect(panel, select);
|
|
19717
|
+
const options = readDropdownOptions(wrapper);
|
|
19718
|
+
const selected = selectedDropdownOptionIndex(wrapper);
|
|
19719
|
+
panel.replaceChildren();
|
|
19720
|
+
options.forEach((text, i) => {
|
|
19721
|
+
panel.appendChild(createDropdownOptionRow(text, i, select));
|
|
19722
|
+
});
|
|
19723
|
+
if (selected != null && selected >= 0 && selected < options.length) {
|
|
19724
|
+
const row = panel.querySelector(`[${DROPDOWN_OPTION_ATTR}="${selected}"]`);
|
|
19725
|
+
row?.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
|
|
19726
|
+
}
|
|
19727
|
+
return panel;
|
|
19728
|
+
}
|
|
19729
|
+
function createDropdownOptionRow(text, index, select) {
|
|
19730
|
+
const row = document.createElement("div");
|
|
19731
|
+
row.setAttribute(DROPDOWN_OPTION_ATTR, String(index));
|
|
19732
|
+
row.setAttribute("contenteditable", "true");
|
|
19733
|
+
row.setAttribute("spellcheck", "false");
|
|
19734
|
+
row.textContent = text;
|
|
19735
|
+
styleDropdownOptionFromSelect(row, select);
|
|
19736
|
+
return row;
|
|
19737
|
+
}
|
|
19738
|
+
function setDropdownPreviewOpen(wrapper, open) {
|
|
19739
|
+
if (fieldTypeOf(wrapper) !== "dropdown") return;
|
|
19740
|
+
syncDropdownPanel(wrapper);
|
|
19741
|
+
if (open) wrapper.setAttribute(DROPDOWN_OPEN_ATTR, "");
|
|
19742
|
+
else {
|
|
19743
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19744
|
+
clearDropdownOptionSelection(wrapper);
|
|
19745
|
+
}
|
|
19746
|
+
}
|
|
19747
|
+
function isDropdownPreviewOpen(wrapper) {
|
|
19748
|
+
return wrapper.hasAttribute(DROPDOWN_OPEN_ATTR);
|
|
19749
|
+
}
|
|
19750
|
+
function listDropdownOptionRows(wrapper) {
|
|
19751
|
+
return Array.from(wrapper.querySelectorAll(`[${DROPDOWN_OPTION_ATTR}]`));
|
|
19752
|
+
}
|
|
19753
|
+
function getDropdownOptionIndex(el) {
|
|
19754
|
+
const row = el?.closest(`[${DROPDOWN_OPTION_ATTR}]`);
|
|
19755
|
+
if (!row) return null;
|
|
19756
|
+
const raw = row.getAttribute(DROPDOWN_OPTION_ATTR);
|
|
19757
|
+
if (raw == null || raw === "") return null;
|
|
19758
|
+
const index = Number(raw);
|
|
19759
|
+
return Number.isFinite(index) ? index : null;
|
|
19760
|
+
}
|
|
19761
|
+
function selectDropdownOption(wrapper, index) {
|
|
19762
|
+
listDropdownOptionRows(wrapper).forEach((row, i) => {
|
|
19763
|
+
if (i === index) row.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
|
|
19764
|
+
else row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR);
|
|
19765
|
+
});
|
|
19766
|
+
}
|
|
19767
|
+
function clearDropdownOptionSelection(wrapper) {
|
|
19768
|
+
if (!wrapper) return;
|
|
19769
|
+
listDropdownOptionRows(wrapper).forEach((row) => row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR));
|
|
19770
|
+
}
|
|
19771
|
+
function selectedDropdownOptionIndex(wrapper) {
|
|
19772
|
+
const row = wrapper.querySelector(`[${DROPDOWN_OPTION_SELECTED_ATTR}]`);
|
|
19773
|
+
return getDropdownOptionIndex(row);
|
|
19774
|
+
}
|
|
19775
|
+
function commitDropdownOptionsFromPanel(wrapper, finalize = false) {
|
|
19776
|
+
const select = fieldControlOf(wrapper);
|
|
19777
|
+
if (!select || select.tagName !== "SELECT") return readDropdownOptions(wrapper);
|
|
19778
|
+
const rows = listDropdownOptionRows(wrapper);
|
|
19779
|
+
const options = rows.length > 0 ? rows.map((row, i) => {
|
|
19780
|
+
const trimmed = (row.textContent ?? "").replace(/\u00a0/g, " ").trim();
|
|
19781
|
+
return finalize ? normalizeOptionText(trimmed, i) : trimmed || optionFallbackLabel(i);
|
|
19782
|
+
}) : readDropdownOptions(wrapper);
|
|
19783
|
+
fillSelectOptions(select, options);
|
|
19784
|
+
if (finalize) {
|
|
19785
|
+
const panelRows = listDropdownOptionRows(wrapper);
|
|
19786
|
+
if (panelRows.length !== select.options.length) {
|
|
19787
|
+
syncDropdownPanel(wrapper);
|
|
19788
|
+
} else {
|
|
19789
|
+
panelRows.forEach((row, i) => {
|
|
19790
|
+
const label = options[i] ?? optionFallbackLabel(i);
|
|
19791
|
+
if (row.textContent !== label) row.textContent = label;
|
|
19792
|
+
row.setAttribute(DROPDOWN_OPTION_ATTR, String(i));
|
|
19793
|
+
});
|
|
19794
|
+
}
|
|
19795
|
+
}
|
|
19796
|
+
return readDropdownOptions(wrapper);
|
|
19797
|
+
}
|
|
19798
|
+
function writeDropdownOptions(wrapper, options) {
|
|
19799
|
+
const select = fieldControlOf(wrapper);
|
|
19800
|
+
if (!select || select.tagName !== "SELECT") return;
|
|
19801
|
+
const normalized = (options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS]).map(
|
|
19802
|
+
(text, i) => normalizeOptionText(text, i)
|
|
19803
|
+
);
|
|
19804
|
+
fillSelectOptions(select, normalized);
|
|
19805
|
+
syncDropdownPanel(wrapper);
|
|
19806
|
+
}
|
|
19807
|
+
function currentDropdownOptions(wrapper) {
|
|
19808
|
+
const rows = listDropdownOptionRows(wrapper);
|
|
19809
|
+
if (rows.length === 0) return readDropdownOptions(wrapper);
|
|
19810
|
+
return rows.map((row, i) => normalizeOptionText(row.textContent ?? "", i));
|
|
19811
|
+
}
|
|
19812
|
+
function duplicateDropdownOption(wrapper, index) {
|
|
19813
|
+
const options = currentDropdownOptions(wrapper);
|
|
19814
|
+
if (index < 0 || index >= options.length) return index;
|
|
19815
|
+
const next = [...options];
|
|
19816
|
+
next.splice(index + 1, 0, options[index]);
|
|
19817
|
+
writeDropdownOptions(wrapper, next);
|
|
19818
|
+
selectDropdownOption(wrapper, index + 1);
|
|
19819
|
+
return index + 1;
|
|
19820
|
+
}
|
|
19821
|
+
function removeDropdownOption(wrapper, index) {
|
|
19822
|
+
const options = currentDropdownOptions(wrapper);
|
|
19823
|
+
if (options.length <= 1 || index < 0 || index >= options.length) {
|
|
19824
|
+
selectDropdownOption(wrapper, Math.max(0, Math.min(index, options.length - 1)));
|
|
19825
|
+
return selectedDropdownOptionIndex(wrapper);
|
|
19826
|
+
}
|
|
19827
|
+
const next = options.filter((_, i) => i !== index);
|
|
19828
|
+
writeDropdownOptions(wrapper, next);
|
|
19829
|
+
const nextIndex = Math.min(index, next.length - 1);
|
|
19830
|
+
selectDropdownOption(wrapper, nextIndex);
|
|
19831
|
+
return nextIndex;
|
|
19551
19832
|
}
|
|
19552
19833
|
function markFormFields(form) {
|
|
19553
|
-
form.querySelectorAll(
|
|
19834
|
+
form.querySelectorAll(CONTROL_SELECTOR).forEach((input) => {
|
|
19554
19835
|
const type = input.type;
|
|
19555
19836
|
if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
|
|
19556
19837
|
return;
|
|
19557
19838
|
}
|
|
19558
19839
|
if (getFieldWrapper(input)) return;
|
|
19559
19840
|
let wrapper = input;
|
|
19560
|
-
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll(
|
|
19841
|
+
while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll(CONTROL_SELECTOR).length === 1) {
|
|
19561
19842
|
wrapper = wrapper.parentElement;
|
|
19562
19843
|
}
|
|
19563
19844
|
if (wrapper === input) {
|
|
@@ -19571,6 +19852,7 @@ function markFormFields(form) {
|
|
|
19571
19852
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
19572
19853
|
wrapper.setAttribute(FIELD_TYPE_ATTR, inferType(input));
|
|
19573
19854
|
ensureFieldLabel(wrapper, key);
|
|
19855
|
+
if (inferType(input) === "dropdown") syncDropdownPanel(wrapper);
|
|
19574
19856
|
syncRequiredMark(wrapper);
|
|
19575
19857
|
});
|
|
19576
19858
|
const wrappers = listFieldWrappers(form);
|
|
@@ -19581,16 +19863,20 @@ function markFormFields(form) {
|
|
|
19581
19863
|
}
|
|
19582
19864
|
function readFieldsFromDom(form) {
|
|
19583
19865
|
return listFieldWrappers(form).map((wrapper) => {
|
|
19584
|
-
const
|
|
19866
|
+
const type = fieldTypeOf(wrapper);
|
|
19867
|
+
const control = fieldControlOf(wrapper);
|
|
19868
|
+
const isDropdown = type === "dropdown";
|
|
19869
|
+
if (isDropdown) commitDropdownOptionsFromPanel(wrapper, true);
|
|
19585
19870
|
return {
|
|
19586
19871
|
key: fieldKeyOf(wrapper),
|
|
19587
|
-
type
|
|
19872
|
+
type,
|
|
19588
19873
|
label: fieldLabelText(fieldLabelOf(wrapper)).trim(),
|
|
19589
19874
|
// While a field is selected its placeholder text lives in the value (see
|
|
19590
19875
|
// beginPlaceholderEdit), so reading the attribute would store an empty one — whoever
|
|
19591
19876
|
// happens to save at that moment must still record what the owner typed.
|
|
19592
|
-
placeholder:
|
|
19593
|
-
required: Boolean(
|
|
19877
|
+
placeholder: !isDropdown && control && control.tagName !== "SELECT" ? control.hasAttribute(PLACEHOLDER_EDIT_ATTR) ? control.value : control.getAttribute("placeholder") ?? "" : "",
|
|
19878
|
+
required: Boolean(control?.hasAttribute("required")),
|
|
19879
|
+
...isDropdown ? { options: readDropdownOptions(wrapper) } : {}
|
|
19594
19880
|
};
|
|
19595
19881
|
});
|
|
19596
19882
|
}
|
|
@@ -19608,8 +19894,8 @@ function isDefaultText(value, pick) {
|
|
|
19608
19894
|
if (!trimmed) return true;
|
|
19609
19895
|
return Object.values(FIELD_DEFAULTS).some((defaults) => pick(defaults) === trimmed);
|
|
19610
19896
|
}
|
|
19611
|
-
function applyFieldType(wrapper, type) {
|
|
19612
|
-
const input =
|
|
19897
|
+
function applyFieldType(wrapper, type, options) {
|
|
19898
|
+
const input = fieldControlOf(wrapper);
|
|
19613
19899
|
if (!input) return;
|
|
19614
19900
|
const defaults = FIELD_DEFAULTS[type];
|
|
19615
19901
|
const placeholder = input.getAttribute("placeholder") ?? "";
|
|
@@ -19621,6 +19907,10 @@ function applyFieldType(wrapper, type) {
|
|
|
19621
19907
|
};
|
|
19622
19908
|
const { tag, inputType } = inputTagFor(type);
|
|
19623
19909
|
wrapper.setAttribute(FIELD_TYPE_ATTR, type);
|
|
19910
|
+
if (type !== "dropdown") {
|
|
19911
|
+
wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
|
|
19912
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19913
|
+
}
|
|
19624
19914
|
const shedSize = (el) => {
|
|
19625
19915
|
if (type === "long-text") return;
|
|
19626
19916
|
el.style.removeProperty("height");
|
|
@@ -19632,28 +19922,39 @@ function applyFieldType(wrapper, type) {
|
|
|
19632
19922
|
}
|
|
19633
19923
|
};
|
|
19634
19924
|
const applyDefaults = (el) => {
|
|
19925
|
+
if (type === "dropdown") return;
|
|
19635
19926
|
el.setAttribute("placeholder", defaults.placeholder);
|
|
19636
19927
|
if (label && followsDefaults.label) {
|
|
19637
19928
|
label.textContent = defaults.label;
|
|
19638
19929
|
}
|
|
19639
19930
|
};
|
|
19931
|
+
const applyDropdown = (select) => {
|
|
19932
|
+
const nextOptions = options && options.length > 0 ? options.map((text, i) => normalizeOptionText(text, i)) : [...DEFAULT_DROPDOWN_OPTIONS];
|
|
19933
|
+
fillSelectOptions(select, nextOptions);
|
|
19934
|
+
select.removeAttribute("placeholder");
|
|
19935
|
+
if (label && followsDefaults.label) label.textContent = defaults.label;
|
|
19936
|
+
syncDropdownPanel(wrapper);
|
|
19937
|
+
};
|
|
19640
19938
|
if (input.tagName.toLowerCase() === tag) {
|
|
19641
19939
|
if (inputType) input.type = inputType;
|
|
19642
19940
|
shedSize(input);
|
|
19643
|
-
|
|
19941
|
+
if (type === "dropdown") applyDropdown(input);
|
|
19942
|
+
else applyDefaults(input);
|
|
19644
19943
|
requireIfEmail(wrapper, type);
|
|
19645
19944
|
return;
|
|
19646
19945
|
}
|
|
19647
19946
|
const next = document.createElement(tag);
|
|
19648
19947
|
Array.from(input.attributes).forEach((attr) => {
|
|
19649
19948
|
if (attr.name === "type") return;
|
|
19949
|
+
if (tag === "select" && (attr.name === "value" || attr.name === "placeholder")) return;
|
|
19650
19950
|
next.setAttribute(attr.name, attr.value);
|
|
19651
19951
|
});
|
|
19652
19952
|
if (inputType) next.setAttribute("type", inputType);
|
|
19653
19953
|
shedSize(next);
|
|
19654
19954
|
if (type === "long-text") next.setAttribute("rows", "4");
|
|
19655
19955
|
input.replaceWith(next);
|
|
19656
|
-
|
|
19956
|
+
if (type === "dropdown") applyDropdown(next);
|
|
19957
|
+
else applyDefaults(next);
|
|
19657
19958
|
requireIfEmail(wrapper, type);
|
|
19658
19959
|
}
|
|
19659
19960
|
function requireIfEmail(wrapper, type) {
|
|
@@ -19675,7 +19976,7 @@ function syncRequiredMark(wrapper) {
|
|
|
19675
19976
|
else label.removeAttribute(REQUIRED_MARK_ATTR);
|
|
19676
19977
|
}
|
|
19677
19978
|
function setFieldRequired(wrapper, required) {
|
|
19678
|
-
const input =
|
|
19979
|
+
const input = fieldControlOf(wrapper);
|
|
19679
19980
|
const label = fieldLabelOf(wrapper);
|
|
19680
19981
|
if (!input) return;
|
|
19681
19982
|
if (required) input.setAttribute("required", "");
|
|
@@ -19683,6 +19984,7 @@ function setFieldRequired(wrapper, required) {
|
|
|
19683
19984
|
if (label) syncRequiredMark(wrapper);
|
|
19684
19985
|
}
|
|
19685
19986
|
function beginPlaceholderEdit(wrapper) {
|
|
19987
|
+
if (fieldTypeOf(wrapper) === "dropdown") return;
|
|
19686
19988
|
const input = fieldInputOf(wrapper);
|
|
19687
19989
|
if (!input || input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return;
|
|
19688
19990
|
input.style.setProperty("--ohw-placeholder-edit-color", getComputedStyle(input).color);
|
|
@@ -19692,6 +19994,11 @@ function beginPlaceholderEdit(wrapper) {
|
|
|
19692
19994
|
}
|
|
19693
19995
|
function commitPlaceholderEdit(wrapper) {
|
|
19694
19996
|
if (!wrapper) return false;
|
|
19997
|
+
if (fieldTypeOf(wrapper) === "dropdown") {
|
|
19998
|
+
const before = readDropdownOptions(wrapper).join("\0");
|
|
19999
|
+
const after = commitDropdownOptionsFromPanel(wrapper, true).join("\0");
|
|
20000
|
+
return before !== after;
|
|
20001
|
+
}
|
|
19695
20002
|
const input = fieldInputOf(wrapper);
|
|
19696
20003
|
if (!input || !input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return false;
|
|
19697
20004
|
const typed = input.value;
|
|
@@ -19703,6 +20010,7 @@ function commitPlaceholderEdit(wrapper) {
|
|
|
19703
20010
|
return previous !== typed;
|
|
19704
20011
|
}
|
|
19705
20012
|
function setFieldPlaceholder(wrapper, placeholder) {
|
|
20013
|
+
if (fieldTypeOf(wrapper) === "dropdown") return;
|
|
19706
20014
|
fieldInputOf(wrapper)?.setAttribute("placeholder", placeholder);
|
|
19707
20015
|
}
|
|
19708
20016
|
function uniqueKey(form, base) {
|
|
@@ -19746,14 +20054,17 @@ function insertField(form, type) {
|
|
|
19746
20054
|
}
|
|
19747
20055
|
wrapper.setAttribute(FIELD_ATTR, key);
|
|
19748
20056
|
wrapper.setAttribute(FIELD_TYPE_ATTR, type);
|
|
20057
|
+
wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19749
20058
|
applyFieldType(wrapper, type);
|
|
19750
20059
|
const defaults = FIELD_DEFAULTS[type];
|
|
19751
|
-
const input =
|
|
20060
|
+
const input = fieldControlOf(wrapper);
|
|
19752
20061
|
if (input) {
|
|
19753
20062
|
input.setAttribute("name", key);
|
|
19754
20063
|
input.removeAttribute("required");
|
|
19755
|
-
|
|
19756
|
-
|
|
20064
|
+
if (type !== "dropdown") {
|
|
20065
|
+
input.setAttribute("placeholder", defaults.placeholder);
|
|
20066
|
+
if (input.tagName !== "SELECT") input.value = "";
|
|
20067
|
+
}
|
|
19757
20068
|
}
|
|
19758
20069
|
const label = ensureFieldLabel(wrapper, key);
|
|
19759
20070
|
label.textContent = defaults.label;
|
|
@@ -19762,18 +20073,22 @@ function insertField(form, type) {
|
|
|
19762
20073
|
return wrapper;
|
|
19763
20074
|
}
|
|
19764
20075
|
function duplicateField(form, wrapper) {
|
|
20076
|
+
if (fieldTypeOf(wrapper) === "dropdown") commitDropdownOptionsFromPanel(wrapper);
|
|
19765
20077
|
const copy = wrapper.cloneNode(true);
|
|
19766
20078
|
const key = uniqueKey(form, `${fieldKeyOf(wrapper)}-copy`);
|
|
19767
20079
|
copy.setAttribute(FIELD_ATTR, key);
|
|
19768
|
-
|
|
20080
|
+
copy.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
20081
|
+
clearDropdownOptionSelection(copy);
|
|
20082
|
+
const input = fieldControlOf(copy);
|
|
19769
20083
|
if (input) {
|
|
19770
20084
|
input.setAttribute("name", key);
|
|
19771
20085
|
input.removeAttribute("data-ohw-key");
|
|
19772
|
-
input.value = "";
|
|
20086
|
+
if (input.tagName !== "SELECT") input.value = "";
|
|
19773
20087
|
}
|
|
19774
20088
|
const label = fieldLabelOf(copy);
|
|
19775
20089
|
if (label) label.setAttribute("data-ohw-key", `${key}-label`);
|
|
19776
20090
|
wrapper.after(copy);
|
|
20091
|
+
if (fieldTypeOf(copy) === "dropdown") syncDropdownPanel(copy);
|
|
19777
20092
|
return copy;
|
|
19778
20093
|
}
|
|
19779
20094
|
function removeField(wrapper) {
|
|
@@ -19812,16 +20127,22 @@ function reconcileFieldsFromContent(form, content) {
|
|
|
19812
20127
|
wrapper = insertField(form, spec.type);
|
|
19813
20128
|
if (!wrapper) return;
|
|
19814
20129
|
wrapper.setAttribute(FIELD_ATTR, spec.key);
|
|
19815
|
-
const input =
|
|
20130
|
+
const input = fieldControlOf(wrapper);
|
|
19816
20131
|
if (input) {
|
|
19817
20132
|
input.setAttribute("name", spec.key);
|
|
19818
20133
|
}
|
|
19819
20134
|
fieldLabelOf(wrapper)?.setAttribute("data-ohw-key", `${spec.key}-label`);
|
|
19820
20135
|
byKey.set(spec.key, wrapper);
|
|
19821
20136
|
}
|
|
19822
|
-
|
|
20137
|
+
const dropdownWasOpen = wrapper.hasAttribute(DROPDOWN_OPEN_ATTR);
|
|
20138
|
+
applyFieldType(wrapper, spec.type, spec.type === "dropdown" ? spec.options : void 0);
|
|
19823
20139
|
setFieldRequired(wrapper, spec.required);
|
|
19824
20140
|
setFieldPlaceholder(wrapper, spec.placeholder);
|
|
20141
|
+
if (spec.type === "dropdown") {
|
|
20142
|
+
writeDropdownOptions(wrapper, spec.options?.length ? spec.options : [...DEFAULT_DROPDOWN_OPTIONS]);
|
|
20143
|
+
}
|
|
20144
|
+
if (spec.type === "dropdown" && dropdownWasOpen) setDropdownPreviewOpen(wrapper, true);
|
|
20145
|
+
else wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
|
|
19825
20146
|
const label = fieldLabelOf(wrapper);
|
|
19826
20147
|
if (label && spec.label) label.textContent = spec.label.replace(/\s*\*\s*$/, "").trimEnd();
|
|
19827
20148
|
syncRequiredMark(wrapper);
|
|
@@ -19844,11 +20165,14 @@ var TYPE_ICONS = {
|
|
|
19844
20165
|
"short-text": import_lucide_react4.Type,
|
|
19845
20166
|
"long-text": import_lucide_react4.TextQuote,
|
|
19846
20167
|
email: import_lucide_react4.AtSign,
|
|
19847
|
-
phone: import_lucide_react4.Phone
|
|
20168
|
+
phone: import_lucide_react4.Phone,
|
|
20169
|
+
dropdown: import_lucide_react4.ChevronDown
|
|
19848
20170
|
};
|
|
19849
20171
|
function FormFieldToolbar({
|
|
19850
20172
|
type,
|
|
19851
20173
|
required,
|
|
20174
|
+
dropdownOpen = null,
|
|
20175
|
+
onDropdownOpenChange,
|
|
19852
20176
|
onTypeChange,
|
|
19853
20177
|
onRequiredToggle,
|
|
19854
20178
|
onDuplicate,
|
|
@@ -19856,6 +20180,7 @@ function FormFieldToolbar({
|
|
|
19856
20180
|
}) {
|
|
19857
20181
|
const TypeIcon = TYPE_ICONS[type];
|
|
19858
20182
|
const typeLabel = FIELD_TYPES.find((entry) => entry.type === type)?.label ?? "Short text";
|
|
20183
|
+
const showDropdownToggle = type === "dropdown" && dropdownOpen !== null && dropdownOpen !== void 0;
|
|
19859
20184
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
19860
20185
|
"div",
|
|
19861
20186
|
{
|
|
@@ -19907,29 +20232,131 @@ function FormFieldToolbar({
|
|
|
19907
20232
|
]
|
|
19908
20233
|
}
|
|
19909
20234
|
),
|
|
19910
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
19911
|
-
|
|
19912
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
19913
|
-
|
|
20235
|
+
showDropdownToggle ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
20236
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
20237
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
20238
|
+
ToggleGroup,
|
|
19914
20239
|
{
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
className: "
|
|
19919
|
-
|
|
20240
|
+
value: dropdownOpen ? "open" : "closed",
|
|
20241
|
+
onValueChange: () => {
|
|
20242
|
+
},
|
|
20243
|
+
className: "h-7 gap-0.5 rounded-[calc(var(--radius,0.5rem)-2px)] bg-muted p-0.5",
|
|
20244
|
+
onMouseDown: (e) => {
|
|
20245
|
+
e.preventDefault();
|
|
20246
|
+
e.stopPropagation();
|
|
20247
|
+
},
|
|
20248
|
+
children: [
|
|
20249
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
20250
|
+
ToggleGroupItem,
|
|
20251
|
+
{
|
|
20252
|
+
value: "closed",
|
|
20253
|
+
size: "sm",
|
|
20254
|
+
"aria-label": "Closed",
|
|
20255
|
+
className: "h-6 min-w-0 px-2 text-xs font-medium",
|
|
20256
|
+
onMouseDown: (e) => {
|
|
20257
|
+
e.preventDefault();
|
|
20258
|
+
e.stopPropagation();
|
|
20259
|
+
if (dropdownOpen !== false) onDropdownOpenChange?.(false);
|
|
20260
|
+
},
|
|
20261
|
+
onClick: (e) => {
|
|
20262
|
+
e.preventDefault();
|
|
20263
|
+
e.stopPropagation();
|
|
20264
|
+
},
|
|
20265
|
+
children: "Closed"
|
|
20266
|
+
}
|
|
20267
|
+
),
|
|
20268
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
20269
|
+
ToggleGroupItem,
|
|
20270
|
+
{
|
|
20271
|
+
value: "open",
|
|
20272
|
+
size: "sm",
|
|
20273
|
+
"aria-label": "Open",
|
|
20274
|
+
className: "h-6 min-w-0 px-2 text-xs font-medium",
|
|
20275
|
+
onMouseDown: (e) => {
|
|
20276
|
+
e.preventDefault();
|
|
20277
|
+
e.stopPropagation();
|
|
20278
|
+
if (dropdownOpen !== true) onDropdownOpenChange?.(true);
|
|
20279
|
+
},
|
|
20280
|
+
onClick: (e) => {
|
|
20281
|
+
e.preventDefault();
|
|
20282
|
+
e.stopPropagation();
|
|
20283
|
+
},
|
|
20284
|
+
children: "Open"
|
|
20285
|
+
}
|
|
20286
|
+
)
|
|
20287
|
+
]
|
|
19920
20288
|
}
|
|
19921
|
-
)
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
|
|
20289
|
+
)
|
|
20290
|
+
] }) : null,
|
|
20291
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
|
|
20292
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
20293
|
+
"button",
|
|
20294
|
+
{
|
|
20295
|
+
type: "button",
|
|
20296
|
+
title: "Duplicate",
|
|
20297
|
+
"aria-label": "Duplicate",
|
|
20298
|
+
onClick: onDuplicate,
|
|
20299
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Copy, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20301
|
+
}
|
|
20302
|
+
),
|
|
20303
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
20304
|
+
"button",
|
|
20305
|
+
{
|
|
20306
|
+
type: "button",
|
|
20307
|
+
title: "Delete",
|
|
20308
|
+
"aria-label": "Delete",
|
|
20309
|
+
onClick: onDelete,
|
|
20310
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Trash2, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20312
|
+
}
|
|
20313
|
+
)
|
|
20314
|
+
]
|
|
20315
|
+
}
|
|
20316
|
+
);
|
|
20317
|
+
}
|
|
20318
|
+
function DropdownOptionToolbar({
|
|
20319
|
+
canDelete,
|
|
20320
|
+
onDuplicate,
|
|
20321
|
+
onDelete
|
|
20322
|
+
}) {
|
|
20323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
20324
|
+
"div",
|
|
20325
|
+
{
|
|
20326
|
+
"data-ohw-dropdown-option-toolbar": "",
|
|
20327
|
+
className: "pointer-events-auto flex items-center gap-0.5 whitespace-nowrap rounded-lg border border-border bg-background p-1 shadow-md",
|
|
20328
|
+
children: [
|
|
20329
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
20330
|
+
"button",
|
|
20331
|
+
{
|
|
20332
|
+
type: "button",
|
|
20333
|
+
title: "Duplicate",
|
|
20334
|
+
"aria-label": "Duplicate",
|
|
20335
|
+
onMouseDown: (e) => {
|
|
20336
|
+
e.preventDefault();
|
|
20337
|
+
e.stopPropagation();
|
|
20338
|
+
onDuplicate();
|
|
20339
|
+
},
|
|
20340
|
+
className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
|
|
20341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Copy, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20342
|
+
}
|
|
20343
|
+
),
|
|
20344
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
20345
|
+
"button",
|
|
20346
|
+
{
|
|
20347
|
+
type: "button",
|
|
20348
|
+
title: "Delete",
|
|
20349
|
+
"aria-label": "Delete",
|
|
20350
|
+
disabled: !canDelete,
|
|
20351
|
+
onMouseDown: (e) => {
|
|
20352
|
+
e.preventDefault();
|
|
20353
|
+
e.stopPropagation();
|
|
20354
|
+
if (canDelete) onDelete();
|
|
20355
|
+
},
|
|
20356
|
+
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"),
|
|
20357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Trash2, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
|
|
20358
|
+
}
|
|
20359
|
+
)
|
|
19933
20360
|
]
|
|
19934
20361
|
}
|
|
19935
20362
|
);
|
|
@@ -20072,6 +20499,7 @@ function MediaOverlay({
|
|
|
20072
20499
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
20073
20500
|
);
|
|
20074
20501
|
}, [isVideo]);
|
|
20502
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
20075
20503
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
20076
20504
|
const box = {
|
|
20077
20505
|
position: "fixed",
|
|
@@ -20170,10 +20598,9 @@ function MediaOverlay({
|
|
|
20170
20598
|
className: "flex items-center justify-center cursor-pointer",
|
|
20171
20599
|
style: {
|
|
20172
20600
|
...box,
|
|
20173
|
-
//
|
|
20174
|
-
//
|
|
20175
|
-
//
|
|
20176
|
-
// Replace still works.
|
|
20601
|
+
// Bare media takes the click: the first selects it, the next opens the picker. Text on
|
|
20602
|
+
// top and cueOnly let clicks fall through. Navbar, logo and buttons over a hero image
|
|
20603
|
+
// never reach here: probeImageAt dismisses the overlay before it can cover them.
|
|
20177
20604
|
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
|
|
20178
20605
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
20179
20606
|
// than hovered. Hover keeps the existing tinted preview.
|
|
@@ -20201,15 +20628,18 @@ function MediaOverlay({
|
|
|
20201
20628
|
},
|
|
20202
20629
|
children: [
|
|
20203
20630
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
20204
|
-
|
|
20631
|
+
replaceLabel
|
|
20205
20632
|
]
|
|
20206
20633
|
}
|
|
20207
20634
|
),
|
|
20208
|
-
replaceMode
|
|
20635
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
20209
20636
|
"div",
|
|
20210
20637
|
{
|
|
20211
20638
|
className: "flex items-center gap-1.5",
|
|
20212
|
-
style: {
|
|
20639
|
+
style: {
|
|
20640
|
+
// Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
|
|
20641
|
+
pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
|
|
20642
|
+
},
|
|
20213
20643
|
onClick: (e) => e.stopPropagation(),
|
|
20214
20644
|
children: [
|
|
20215
20645
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
@@ -20218,7 +20648,7 @@ function MediaOverlay({
|
|
|
20218
20648
|
"data-ohw-media-overlay": "",
|
|
20219
20649
|
variant: "outline",
|
|
20220
20650
|
size: "sm",
|
|
20221
|
-
"aria-label":
|
|
20651
|
+
"aria-label": replaceLabel,
|
|
20222
20652
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
20223
20653
|
style: {
|
|
20224
20654
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -20239,7 +20669,7 @@ function MediaOverlay({
|
|
|
20239
20669
|
},
|
|
20240
20670
|
children: [
|
|
20241
20671
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
20242
|
-
replaceMode === "full" ?
|
|
20672
|
+
replaceMode === "full" ? replaceLabel : null
|
|
20243
20673
|
]
|
|
20244
20674
|
}
|
|
20245
20675
|
),
|
|
@@ -20897,7 +21327,7 @@ function AiSectionOverlay({
|
|
|
20897
21327
|
|
|
20898
21328
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
20899
21329
|
var import_react14 = require("react");
|
|
20900
|
-
var
|
|
21330
|
+
var import_lucide_react9 = require("lucide-react");
|
|
20901
21331
|
|
|
20902
21332
|
// src/lib/ai-media-strip-tree.ts
|
|
20903
21333
|
var MEDIA_STRIP_ITEM_MIN = 1;
|
|
@@ -21011,14 +21441,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
|
|
|
21011
21441
|
return true;
|
|
21012
21442
|
});
|
|
21013
21443
|
}
|
|
21014
|
-
function setMediaStripItemAlt(tree, index, alt) {
|
|
21015
|
-
return withMediaStrip(tree, (block) => {
|
|
21016
|
-
const items = block.items;
|
|
21017
|
-
if (index < 0 || index >= items.length) return false;
|
|
21018
|
-
items[index] = { ...items[index], alt };
|
|
21019
|
-
return true;
|
|
21020
|
-
});
|
|
21021
|
-
}
|
|
21022
21444
|
function setMediaStripItemLink(tree, index, link) {
|
|
21023
21445
|
return withMediaStrip(tree, (block) => {
|
|
21024
21446
|
const items = block.items;
|
|
@@ -21036,11 +21458,117 @@ function setMediaStripItemLink(tree, index, link) {
|
|
|
21036
21458
|
});
|
|
21037
21459
|
}
|
|
21038
21460
|
|
|
21039
|
-
// src/ui/
|
|
21461
|
+
// src/ui/dialog.tsx
|
|
21462
|
+
var React9 = __toESM(require("react"), 1);
|
|
21463
|
+
var import_radix_ui6 = require("radix-ui");
|
|
21464
|
+
var import_lucide_react8 = require("lucide-react");
|
|
21040
21465
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
21466
|
+
function Dialog2({
|
|
21467
|
+
...props
|
|
21468
|
+
}) {
|
|
21469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
21470
|
+
}
|
|
21471
|
+
function DialogPortal({
|
|
21472
|
+
...props
|
|
21473
|
+
}) {
|
|
21474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
21475
|
+
}
|
|
21476
|
+
function DialogOverlay({
|
|
21477
|
+
className,
|
|
21478
|
+
...props
|
|
21479
|
+
}) {
|
|
21480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21481
|
+
import_radix_ui6.Dialog.Overlay,
|
|
21482
|
+
{
|
|
21483
|
+
"data-slot": "dialog-overlay",
|
|
21484
|
+
"data-ohw-link-modal-root": "",
|
|
21485
|
+
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
21486
|
+
...props
|
|
21487
|
+
}
|
|
21488
|
+
);
|
|
21489
|
+
}
|
|
21490
|
+
var DialogContent = React9.forwardRef(
|
|
21491
|
+
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
21492
|
+
const positionMode = container ? "absolute" : "fixed";
|
|
21493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
21494
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
21495
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
21496
|
+
import_radix_ui6.Dialog.Content,
|
|
21497
|
+
{
|
|
21498
|
+
ref,
|
|
21499
|
+
"data-slot": "dialog-content",
|
|
21500
|
+
className: cn(
|
|
21501
|
+
positionMode,
|
|
21502
|
+
"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",
|
|
21503
|
+
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
21504
|
+
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
21505
|
+
className
|
|
21506
|
+
),
|
|
21507
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
21508
|
+
...props,
|
|
21509
|
+
children: [
|
|
21510
|
+
children,
|
|
21511
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21512
|
+
import_radix_ui6.Dialog.Close,
|
|
21513
|
+
{
|
|
21514
|
+
type: "button",
|
|
21515
|
+
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
21516
|
+
"aria-label": "Close",
|
|
21517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
|
|
21518
|
+
}
|
|
21519
|
+
) : null
|
|
21520
|
+
]
|
|
21521
|
+
}
|
|
21522
|
+
)
|
|
21523
|
+
] });
|
|
21524
|
+
}
|
|
21525
|
+
);
|
|
21526
|
+
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
21527
|
+
function DialogHeader({
|
|
21528
|
+
className,
|
|
21529
|
+
...props
|
|
21530
|
+
}) {
|
|
21531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
21532
|
+
}
|
|
21533
|
+
function DialogFooter({
|
|
21534
|
+
className,
|
|
21535
|
+
...props
|
|
21536
|
+
}) {
|
|
21537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21538
|
+
"div",
|
|
21539
|
+
{
|
|
21540
|
+
className: cn("flex items-center justify-end gap-2", className),
|
|
21541
|
+
...props
|
|
21542
|
+
}
|
|
21543
|
+
);
|
|
21544
|
+
}
|
|
21545
|
+
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21546
|
+
import_radix_ui6.Dialog.Title,
|
|
21547
|
+
{
|
|
21548
|
+
ref,
|
|
21549
|
+
className: cn(
|
|
21550
|
+
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
21551
|
+
className
|
|
21552
|
+
),
|
|
21553
|
+
...props
|
|
21554
|
+
}
|
|
21555
|
+
));
|
|
21556
|
+
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
21557
|
+
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21558
|
+
import_radix_ui6.Dialog.Description,
|
|
21559
|
+
{
|
|
21560
|
+
ref,
|
|
21561
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
21562
|
+
...props
|
|
21563
|
+
}
|
|
21564
|
+
));
|
|
21565
|
+
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
21566
|
+
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
21567
|
+
|
|
21568
|
+
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
21569
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
21570
|
+
var PRIMARY3 = "var(--ohw-primary, #0885FE)";
|
|
21571
|
+
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]";
|
|
21044
21572
|
function findMediaStripItemElement(sectionId, index) {
|
|
21045
21573
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
21046
21574
|
if (!sectionEl2) return null;
|
|
@@ -21050,14 +21578,35 @@ function findMediaStripItemElement(sectionId, index) {
|
|
|
21050
21578
|
}
|
|
21051
21579
|
return null;
|
|
21052
21580
|
}
|
|
21053
|
-
function
|
|
21054
|
-
|
|
21581
|
+
function itemRefFromTarget(target) {
|
|
21582
|
+
if (!(target instanceof Element)) return null;
|
|
21583
|
+
if (target.closest(CHROME_SELECTOR)) return null;
|
|
21584
|
+
const itemEl = target.closest("[data-ohw-media-strip-item]");
|
|
21585
|
+
if (!itemEl) return null;
|
|
21586
|
+
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21587
|
+
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
21588
|
+
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
21589
|
+
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
21590
|
+
if (!sectionId || Number.isNaN(index)) return null;
|
|
21591
|
+
return { sectionId, index };
|
|
21592
|
+
}
|
|
21593
|
+
function sameRef(a, b) {
|
|
21594
|
+
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
21595
|
+
}
|
|
21596
|
+
function rectOf(el) {
|
|
21055
21597
|
if (!el) return null;
|
|
21056
21598
|
const r2 = el.getBoundingClientRect();
|
|
21057
21599
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
21058
21600
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
21059
21601
|
}
|
|
21060
|
-
function
|
|
21602
|
+
function readRect2(ref) {
|
|
21603
|
+
return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
|
|
21604
|
+
}
|
|
21605
|
+
function readStripRect(ref) {
|
|
21606
|
+
const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
|
|
21607
|
+
return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
|
|
21608
|
+
}
|
|
21609
|
+
function useLiveItemRect(ref, strip = false) {
|
|
21061
21610
|
const [rect, setRect] = (0, import_react14.useState)(null);
|
|
21062
21611
|
(0, import_react14.useEffect)(() => {
|
|
21063
21612
|
if (!ref) {
|
|
@@ -21065,7 +21614,7 @@ function useLiveItemRect(ref) {
|
|
|
21065
21614
|
return;
|
|
21066
21615
|
}
|
|
21067
21616
|
const update = () => {
|
|
21068
|
-
const next = readRect2(ref);
|
|
21617
|
+
const next = strip ? readStripRect(ref) : readRect2(ref);
|
|
21069
21618
|
setRect(
|
|
21070
21619
|
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
21071
21620
|
);
|
|
@@ -21080,9 +21629,49 @@ function useLiveItemRect(ref) {
|
|
|
21080
21629
|
window.removeEventListener("resize", update);
|
|
21081
21630
|
clearInterval(interval);
|
|
21082
21631
|
};
|
|
21083
|
-
}, [ref?.sectionId, ref?.index]);
|
|
21632
|
+
}, [ref?.sectionId, ref?.index, strip]);
|
|
21084
21633
|
return rect;
|
|
21085
21634
|
}
|
|
21635
|
+
var TOOLBAR_STRIP_GAP = 52;
|
|
21636
|
+
var TOOLBAR_STRIP_GAP_MOBILE = 42;
|
|
21637
|
+
var TOOLBAR_EDGE_MARGIN2 = 4;
|
|
21638
|
+
function StripToolbarSlot({ stripRect, children }) {
|
|
21639
|
+
const slotRef = (0, import_react14.useRef)(null);
|
|
21640
|
+
const [shift, setShift] = (0, import_react14.useState)(0);
|
|
21641
|
+
const centerX = stripRect.left + stripRect.width / 2;
|
|
21642
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
21643
|
+
const slot = slotRef.current;
|
|
21644
|
+
if (!slot) return;
|
|
21645
|
+
const clamp = () => {
|
|
21646
|
+
const w = slot.offsetWidth;
|
|
21647
|
+
if (w <= 0) return;
|
|
21648
|
+
const half = w / 2;
|
|
21649
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
|
|
21650
|
+
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
21651
|
+
};
|
|
21652
|
+
clamp();
|
|
21653
|
+
const ro = new ResizeObserver(clamp);
|
|
21654
|
+
ro.observe(slot);
|
|
21655
|
+
return () => ro.disconnect();
|
|
21656
|
+
}, [centerX, children]);
|
|
21657
|
+
const mobile = window.innerWidth <= 480;
|
|
21658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21659
|
+
"div",
|
|
21660
|
+
{
|
|
21661
|
+
ref: slotRef,
|
|
21662
|
+
"data-ohw-bridge": "",
|
|
21663
|
+
"data-ohw-item-interaction": "",
|
|
21664
|
+
className: "pointer-events-auto fixed",
|
|
21665
|
+
style: {
|
|
21666
|
+
top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
|
|
21667
|
+
left: centerX + shift,
|
|
21668
|
+
transform: "translate(-50%, -100%)",
|
|
21669
|
+
zIndex: 2147483645
|
|
21670
|
+
},
|
|
21671
|
+
children
|
|
21672
|
+
}
|
|
21673
|
+
);
|
|
21674
|
+
}
|
|
21086
21675
|
function requestValidateTree(postToParent2, tree) {
|
|
21087
21676
|
return new Promise((resolve) => {
|
|
21088
21677
|
const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -21119,116 +21708,72 @@ function requestAssetPick(postToParent2) {
|
|
|
21119
21708
|
postToParent2({ type: "ow:asset-pick", id });
|
|
21120
21709
|
});
|
|
21121
21710
|
}
|
|
21122
|
-
function
|
|
21711
|
+
function ToolbarAction({
|
|
21123
21712
|
label,
|
|
21124
21713
|
onClick,
|
|
21125
|
-
disabled,
|
|
21126
|
-
active
|
|
21714
|
+
disabled = false,
|
|
21715
|
+
active = false,
|
|
21716
|
+
children
|
|
21127
21717
|
}) {
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
{
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
disabled,
|
|
21134
|
-
style: {
|
|
21135
|
-
height: 28,
|
|
21136
|
-
padding: "0 10px",
|
|
21137
|
-
display: "inline-flex",
|
|
21138
|
-
alignItems: "center",
|
|
21139
|
-
gap: 4,
|
|
21140
|
-
borderRadius: 999,
|
|
21141
|
-
border: "none",
|
|
21142
|
-
cursor: disabled ? "default" : "pointer",
|
|
21143
|
-
background: active ? OHW_BLUE_DARK : "#ffffff",
|
|
21144
|
-
color: active ? "#ffffff" : OHW_BLUE_DARK,
|
|
21145
|
-
opacity: disabled ? 0.4 : 1,
|
|
21146
|
-
fontSize: 12,
|
|
21147
|
-
lineHeight: "16px",
|
|
21148
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21149
|
-
whiteSpace: "nowrap",
|
|
21150
|
-
flex: "0 0 auto"
|
|
21151
|
-
},
|
|
21152
|
-
children: label
|
|
21153
|
-
}
|
|
21154
|
-
);
|
|
21718
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
|
|
21719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
21720
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
21721
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
21722
|
+
] });
|
|
21155
21723
|
}
|
|
21156
|
-
function
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
21164
|
-
|
|
21165
|
-
|
|
21166
|
-
|
|
21167
|
-
|
|
21168
|
-
|
|
21169
|
-
|
|
21170
|
-
|
|
21171
|
-
|
|
21172
|
-
|
|
21173
|
-
|
|
21174
|
-
|
|
21175
|
-
|
|
21176
|
-
|
|
21177
|
-
|
|
21178
|
-
|
|
21179
|
-
|
|
21180
|
-
|
|
21181
|
-
|
|
21182
|
-
|
|
21183
|
-
|
|
21184
|
-
|
|
21185
|
-
},
|
|
21186
|
-
children: "Alt"
|
|
21187
|
-
}
|
|
21188
|
-
),
|
|
21189
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21190
|
-
"input",
|
|
21724
|
+
function ToolbarSeparator() {
|
|
21725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
21726
|
+
}
|
|
21727
|
+
function OptionMenu({
|
|
21728
|
+
label,
|
|
21729
|
+
value,
|
|
21730
|
+
options,
|
|
21731
|
+
onChange
|
|
21732
|
+
}) {
|
|
21733
|
+
const current = options.find((o) => o.value === value) ?? options[0];
|
|
21734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
21735
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
|
|
21736
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
|
|
21737
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
21738
|
+
"button",
|
|
21739
|
+
{
|
|
21740
|
+
type: "button",
|
|
21741
|
+
"aria-label": label,
|
|
21742
|
+
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",
|
|
21743
|
+
children: [
|
|
21744
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
21745
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
21746
|
+
]
|
|
21747
|
+
}
|
|
21748
|
+
) }),
|
|
21749
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
|
|
21750
|
+
const selected = option.value === value;
|
|
21751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
21752
|
+
DropdownMenuItem,
|
|
21191
21753
|
{
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
|
|
21195
|
-
|
|
21196
|
-
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
|
|
21205
|
-
|
|
21206
|
-
"aria-label": "Image alt text",
|
|
21207
|
-
style: {
|
|
21208
|
-
flex: 1,
|
|
21209
|
-
minWidth: 0,
|
|
21210
|
-
border: "none",
|
|
21211
|
-
outline: "none",
|
|
21212
|
-
background: "transparent",
|
|
21213
|
-
fontSize: 12,
|
|
21214
|
-
lineHeight: "16px",
|
|
21215
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21216
|
-
color: "#1f2937"
|
|
21217
|
-
}
|
|
21218
|
-
}
|
|
21219
|
-
)
|
|
21220
|
-
]
|
|
21221
|
-
}
|
|
21222
|
-
);
|
|
21754
|
+
role: "menuitemradio",
|
|
21755
|
+
"aria-checked": selected,
|
|
21756
|
+
onSelect: () => onChange(option.value),
|
|
21757
|
+
className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
21758
|
+
children: [
|
|
21759
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
|
|
21760
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
|
|
21761
|
+
]
|
|
21762
|
+
},
|
|
21763
|
+
option.value
|
|
21764
|
+
);
|
|
21765
|
+
}) })
|
|
21766
|
+
] })
|
|
21767
|
+
] });
|
|
21223
21768
|
}
|
|
21224
21769
|
var VARIANTS = [
|
|
21225
21770
|
{ value: "logos", label: "Logos" },
|
|
21226
21771
|
{ value: "reel", label: "Reel" }
|
|
21227
21772
|
];
|
|
21228
21773
|
var ALIGNS = [
|
|
21229
|
-
{ value: "left", label: "
|
|
21230
|
-
{ value: "center", label: "
|
|
21231
|
-
{ value: "right", label: "
|
|
21774
|
+
{ value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
|
|
21775
|
+
{ value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
|
|
21776
|
+
{ value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
|
|
21232
21777
|
];
|
|
21233
21778
|
var HOVERS = [
|
|
21234
21779
|
{ value: "none", label: "None" },
|
|
@@ -21236,104 +21781,104 @@ var HOVERS = [
|
|
|
21236
21781
|
{ value: "zoom", label: "Zoom" },
|
|
21237
21782
|
{ value: "fade", label: "Fade" }
|
|
21238
21783
|
];
|
|
21239
|
-
var TREATMENTS = [
|
|
21240
|
-
{ value: "color", label: "Color" },
|
|
21241
|
-
{ value: "grayscale", label: "Grayscale" }
|
|
21242
|
-
];
|
|
21243
21784
|
var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
21244
|
-
function
|
|
21245
|
-
|
|
21785
|
+
function LinkModal({
|
|
21786
|
+
href,
|
|
21787
|
+
linkTarget,
|
|
21788
|
+
onClose,
|
|
21789
|
+
onSave
|
|
21790
|
+
}) {
|
|
21791
|
+
const [draft, setDraft] = (0, import_react14.useState)(href);
|
|
21792
|
+
const [newTab, setNewTab] = (0, import_react14.useState)(linkTarget !== "same-tab");
|
|
21246
21793
|
const [invalid, setInvalid] = (0, import_react14.useState)(false);
|
|
21247
|
-
|
|
21248
|
-
setDraft(value);
|
|
21249
|
-
setInvalid(false);
|
|
21250
|
-
}, [value]);
|
|
21251
|
-
const commit2 = () => {
|
|
21794
|
+
const save = () => {
|
|
21252
21795
|
const next = draft.trim();
|
|
21253
|
-
if (next
|
|
21254
|
-
|
|
21255
|
-
|
|
21256
|
-
onCommit(next);
|
|
21257
|
-
};
|
|
21258
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
21259
|
-
"div",
|
|
21260
|
-
{
|
|
21261
|
-
style: {
|
|
21262
|
-
display: "flex",
|
|
21263
|
-
alignItems: "center",
|
|
21264
|
-
gap: 6,
|
|
21265
|
-
height: 28,
|
|
21266
|
-
padding: "0 12px",
|
|
21267
|
-
borderRadius: 999,
|
|
21268
|
-
background: "#ffffff",
|
|
21269
|
-
width: "100%",
|
|
21270
|
-
maxWidth: 260,
|
|
21271
|
-
boxSizing: "border-box",
|
|
21272
|
-
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
21273
|
-
},
|
|
21274
|
-
children: [
|
|
21275
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21276
|
-
"span",
|
|
21277
|
-
{
|
|
21278
|
-
style: {
|
|
21279
|
-
flex: "0 0 auto",
|
|
21280
|
-
color: OHW_BLUE_DARK,
|
|
21281
|
-
fontSize: 10,
|
|
21282
|
-
fontWeight: 700,
|
|
21283
|
-
textTransform: "uppercase",
|
|
21284
|
-
letterSpacing: 0.4
|
|
21285
|
-
},
|
|
21286
|
-
children: "Link"
|
|
21287
|
-
}
|
|
21288
|
-
),
|
|
21289
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21290
|
-
"input",
|
|
21291
|
-
{
|
|
21292
|
-
type: "text",
|
|
21293
|
-
inputMode: "url",
|
|
21294
|
-
value: draft,
|
|
21295
|
-
onChange: (e) => setDraft(e.target.value),
|
|
21296
|
-
onBlur: commit2,
|
|
21297
|
-
onKeyDown: (e) => {
|
|
21298
|
-
if (e.key === "Enter") e.currentTarget.blur();
|
|
21299
|
-
if (e.key === "Escape") {
|
|
21300
|
-
setDraft(value);
|
|
21301
|
-
setInvalid(false);
|
|
21302
|
-
e.currentTarget.blur();
|
|
21303
|
-
}
|
|
21304
|
-
},
|
|
21305
|
-
placeholder: "https://example.com",
|
|
21306
|
-
"aria-label": "Image link URL",
|
|
21307
|
-
"aria-invalid": invalid,
|
|
21308
|
-
style: {
|
|
21309
|
-
flex: 1,
|
|
21310
|
-
minWidth: 0,
|
|
21311
|
-
border: "none",
|
|
21312
|
-
outline: "none",
|
|
21313
|
-
background: "transparent",
|
|
21314
|
-
fontSize: 12,
|
|
21315
|
-
lineHeight: "16px",
|
|
21316
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
21317
|
-
color: "#1f2937"
|
|
21318
|
-
}
|
|
21319
|
-
}
|
|
21320
|
-
)
|
|
21321
|
-
]
|
|
21796
|
+
if (next && !HTTP_URL_RE.test(next)) {
|
|
21797
|
+
setInvalid(true);
|
|
21798
|
+
return;
|
|
21322
21799
|
}
|
|
21323
|
-
|
|
21800
|
+
onSave(next, newTab ? "new-tab" : "same-tab");
|
|
21801
|
+
onClose();
|
|
21802
|
+
};
|
|
21803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
|
|
21804
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
|
|
21805
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
21806
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21807
|
+
"input",
|
|
21808
|
+
{
|
|
21809
|
+
autoFocus: true,
|
|
21810
|
+
type: "text",
|
|
21811
|
+
inputMode: "url",
|
|
21812
|
+
value: draft,
|
|
21813
|
+
onChange: (e) => {
|
|
21814
|
+
setDraft(e.target.value);
|
|
21815
|
+
setInvalid(false);
|
|
21816
|
+
},
|
|
21817
|
+
onKeyDown: (e) => {
|
|
21818
|
+
if (e.key === "Enter") save();
|
|
21819
|
+
},
|
|
21820
|
+
placeholder: "https://example.com",
|
|
21821
|
+
"aria-label": "Image link URL",
|
|
21822
|
+
"aria-invalid": invalid,
|
|
21823
|
+
className: cn(
|
|
21824
|
+
"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",
|
|
21825
|
+
invalid && "border-destructive focus:border-destructive"
|
|
21826
|
+
)
|
|
21827
|
+
}
|
|
21828
|
+
),
|
|
21829
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
|
|
21830
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
|
|
21831
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
|
|
21832
|
+
"Open in new tab"
|
|
21833
|
+
] })
|
|
21834
|
+
] }),
|
|
21835
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
|
|
21836
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21837
|
+
"button",
|
|
21838
|
+
{
|
|
21839
|
+
type: "button",
|
|
21840
|
+
onClick: () => {
|
|
21841
|
+
onSave("", "new-tab");
|
|
21842
|
+
onClose();
|
|
21843
|
+
},
|
|
21844
|
+
className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
|
|
21845
|
+
children: "Remove link"
|
|
21846
|
+
}
|
|
21847
|
+
),
|
|
21848
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21849
|
+
"button",
|
|
21850
|
+
{
|
|
21851
|
+
type: "button",
|
|
21852
|
+
onClick: onClose,
|
|
21853
|
+
className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
|
|
21854
|
+
children: "Cancel"
|
|
21855
|
+
}
|
|
21856
|
+
),
|
|
21857
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21858
|
+
"button",
|
|
21859
|
+
{
|
|
21860
|
+
type: "button",
|
|
21861
|
+
onClick: save,
|
|
21862
|
+
className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
|
|
21863
|
+
children: "Save"
|
|
21864
|
+
}
|
|
21865
|
+
)
|
|
21866
|
+
] })
|
|
21867
|
+
] }) });
|
|
21324
21868
|
}
|
|
21325
21869
|
function MediaStripToolbar({
|
|
21326
21870
|
entry,
|
|
21327
21871
|
index,
|
|
21328
21872
|
pending,
|
|
21329
21873
|
error,
|
|
21874
|
+
itemEditOn,
|
|
21875
|
+
onToggleItemEdit,
|
|
21330
21876
|
onSetVariant,
|
|
21331
21877
|
onSetAlign,
|
|
21332
21878
|
onSetHover,
|
|
21333
21879
|
onSetTreatment,
|
|
21334
21880
|
onResize,
|
|
21335
|
-
|
|
21336
|
-
onSetLink,
|
|
21881
|
+
onOpenLink,
|
|
21337
21882
|
onAddItem,
|
|
21338
21883
|
onRemoveItem,
|
|
21339
21884
|
onChangeImage,
|
|
@@ -21342,81 +21887,102 @@ function MediaStripToolbar({
|
|
|
21342
21887
|
}) {
|
|
21343
21888
|
const items = mediaStripItems(entry.tree);
|
|
21344
21889
|
const itemCount = items.length;
|
|
21345
|
-
const currentAlt = items[index]?.alt ?? "";
|
|
21346
|
-
const currentHref2 = items[index]?.href ?? "";
|
|
21347
|
-
const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
21348
21890
|
const slots = findMediaStripSlots(entry.tree);
|
|
21349
21891
|
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
21350
21892
|
const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
|
|
21351
21893
|
const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
|
|
21352
21894
|
const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
|
|
21353
21895
|
const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
21354
|
-
const
|
|
21355
|
-
const
|
|
21356
|
-
|
|
21357
|
-
gap: 6,
|
|
21358
|
-
flexWrap: "nowrap",
|
|
21359
|
-
justifyContent: "center",
|
|
21360
|
-
overflowX: "auto",
|
|
21361
|
-
WebkitOverflowScrolling: "touch",
|
|
21362
|
-
width: "100%",
|
|
21363
|
-
scrollbarWidth: "none"
|
|
21364
|
-
} : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
|
|
21365
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
21896
|
+
const mobile = window.innerWidth <= 480;
|
|
21897
|
+
const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
|
|
21898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
21366
21899
|
"div",
|
|
21367
21900
|
{
|
|
21368
21901
|
"data-ohw-bridge": "",
|
|
21369
21902
|
"data-ohw-toolbar": "",
|
|
21370
21903
|
onMouseDown: (e) => e.stopPropagation(),
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
flexDirection: "column",
|
|
21374
|
-
gap: 6,
|
|
21375
|
-
alignItems: "center",
|
|
21376
|
-
background: OHW_BLUE,
|
|
21377
|
-
padding: 8,
|
|
21378
|
-
borderRadius: 12,
|
|
21379
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
21380
|
-
pointerEvents: pending ? "none" : "auto",
|
|
21381
|
-
opacity: pending ? 0.6 : 1,
|
|
21382
|
-
maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
|
|
21383
|
-
},
|
|
21904
|
+
className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
|
|
21905
|
+
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
21384
21906
|
children: [
|
|
21385
|
-
/* @__PURE__ */ (0,
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21405
|
-
|
|
21406
|
-
|
|
21407
|
-
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
|
|
21411
|
-
|
|
21412
|
-
|
|
21413
|
-
|
|
21414
|
-
|
|
21415
|
-
|
|
21416
|
-
|
|
21907
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
21908
|
+
"div",
|
|
21909
|
+
{
|
|
21910
|
+
className: cn(
|
|
21911
|
+
"flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
|
|
21912
|
+
"shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
|
|
21913
|
+
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
21914
|
+
),
|
|
21915
|
+
children: [
|
|
21916
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
21917
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21918
|
+
CustomToolbarButton,
|
|
21919
|
+
{
|
|
21920
|
+
type: "button",
|
|
21921
|
+
"aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
|
|
21922
|
+
"aria-pressed": itemEditOn,
|
|
21923
|
+
onClick: onToggleItemEdit,
|
|
21924
|
+
className: "group size-8",
|
|
21925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21926
|
+
import_lucide_react9.Star,
|
|
21927
|
+
{
|
|
21928
|
+
size: 16,
|
|
21929
|
+
fill: "currentColor",
|
|
21930
|
+
strokeWidth: 0,
|
|
21931
|
+
className: cn(
|
|
21932
|
+
"transition-colors",
|
|
21933
|
+
itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
|
|
21934
|
+
),
|
|
21935
|
+
style: { pointerEvents: "none" }
|
|
21936
|
+
}
|
|
21937
|
+
)
|
|
21938
|
+
}
|
|
21939
|
+
) }),
|
|
21940
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
|
|
21941
|
+
] }),
|
|
21942
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
21943
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21944
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21945
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21946
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21947
|
+
ToolbarAction,
|
|
21948
|
+
{
|
|
21949
|
+
label: gatedLabel("Move right"),
|
|
21950
|
+
onClick: onMoveRight,
|
|
21951
|
+
disabled: !itemEditOn || index >= itemCount - 1,
|
|
21952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
|
|
21953
|
+
}
|
|
21954
|
+
),
|
|
21955
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21956
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
21957
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
|
|
21958
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
|
|
21959
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
21960
|
+
ToolbarAction,
|
|
21961
|
+
{
|
|
21962
|
+
label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
|
|
21963
|
+
active: treatment === "grayscale",
|
|
21964
|
+
onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
|
|
21965
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
|
|
21966
|
+
}
|
|
21967
|
+
),
|
|
21968
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
21969
|
+
ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
|
|
21970
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
21971
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21972
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
|
|
21973
|
+
sizeValue,
|
|
21974
|
+
"px"
|
|
21975
|
+
] }),
|
|
21976
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
21977
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
|
|
21978
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
21979
|
+
]
|
|
21980
|
+
}
|
|
21981
|
+
),
|
|
21982
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
21417
21983
|
]
|
|
21418
21984
|
}
|
|
21419
|
-
);
|
|
21985
|
+
) });
|
|
21420
21986
|
}
|
|
21421
21987
|
function findMediaStripSlots(tree) {
|
|
21422
21988
|
const stack = tree.rows.flatMap((row) => row.blocks);
|
|
@@ -21435,31 +22001,23 @@ function AiMediaStripOverlay({
|
|
|
21435
22001
|
}) {
|
|
21436
22002
|
const [hover, setHover] = (0, import_react14.useState)(null);
|
|
21437
22003
|
const [active, setActive] = (0, import_react14.useState)(null);
|
|
22004
|
+
const [itemEditOn, setItemEditOn] = (0, import_react14.useState)(false);
|
|
22005
|
+
const [linkOpen, setLinkOpen] = (0, import_react14.useState)(false);
|
|
21438
22006
|
const [pending, setPending] = (0, import_react14.useState)(false);
|
|
21439
22007
|
const [error, setError] = (0, import_react14.useState)(null);
|
|
21440
22008
|
const activeRef = (0, import_react14.useRef)(null);
|
|
21441
22009
|
activeRef.current = active;
|
|
22010
|
+
const linkOpenRef = (0, import_react14.useRef)(false);
|
|
22011
|
+
linkOpenRef.current = linkOpen;
|
|
21442
22012
|
(0, import_react14.useEffect)(() => {
|
|
21443
22013
|
const onMove = (e) => {
|
|
22014
|
+
const ref = itemRefFromTarget(e.target);
|
|
21444
22015
|
const t = e.target;
|
|
21445
|
-
|
|
21446
|
-
|
|
21447
|
-
|
|
21448
|
-
|
|
21449
|
-
|
|
21450
|
-
if (!itemEl) {
|
|
21451
|
-
setHover(null);
|
|
21452
|
-
return;
|
|
21453
|
-
}
|
|
21454
|
-
const sectionEl2 = itemEl.closest("[data-ohw-section]");
|
|
21455
|
-
const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
|
|
21456
|
-
const sectionId = unit ? instanceIdOf(unit) || null : null;
|
|
21457
|
-
const index = Number(itemEl.dataset.ohwMediaStripIndex);
|
|
21458
|
-
if (!sectionId || Number.isNaN(index)) {
|
|
21459
|
-
setHover(null);
|
|
21460
|
-
return;
|
|
21461
|
-
}
|
|
21462
|
-
setHover({ sectionId, index });
|
|
22016
|
+
const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
|
|
22017
|
+
setHover((prev) => {
|
|
22018
|
+
const next = ref && !overEditable ? ref : null;
|
|
22019
|
+
return sameRef(prev, next) ? prev : next;
|
|
22020
|
+
});
|
|
21463
22021
|
};
|
|
21464
22022
|
const onLeave = () => setHover(null);
|
|
21465
22023
|
document.addEventListener("mousemove", onMove, { passive: true });
|
|
@@ -21471,23 +22029,25 @@ function AiMediaStripOverlay({
|
|
|
21471
22029
|
}, []);
|
|
21472
22030
|
(0, import_react14.useEffect)(() => {
|
|
21473
22031
|
const onClick = (e) => {
|
|
21474
|
-
const current = activeRef.current;
|
|
21475
|
-
if (!current) return;
|
|
21476
22032
|
const t = e.target;
|
|
21477
|
-
if (!(t instanceof
|
|
21478
|
-
if (t.closest(
|
|
21479
|
-
const
|
|
21480
|
-
if (
|
|
21481
|
-
|
|
22033
|
+
if (!(t instanceof Element)) return;
|
|
22034
|
+
if (t.closest(CHROME_SELECTOR)) return;
|
|
22035
|
+
const ref = itemRefFromTarget(t);
|
|
22036
|
+
if (sameRef(activeRef.current, ref)) return;
|
|
22037
|
+
if (ref) clearInteractionChromeRef.current();
|
|
22038
|
+
setItemEditOn(false);
|
|
21482
22039
|
setError(null);
|
|
22040
|
+
setActive(ref);
|
|
21483
22041
|
};
|
|
21484
22042
|
document.addEventListener("click", onClick, true);
|
|
21485
22043
|
return () => document.removeEventListener("click", onClick, true);
|
|
21486
|
-
}, []);
|
|
22044
|
+
}, [clearInteractionChromeRef]);
|
|
21487
22045
|
(0, import_react14.useEffect)(() => {
|
|
21488
22046
|
const onBlur = () => {
|
|
21489
22047
|
if (!activeRef.current) return;
|
|
21490
22048
|
setActive(null);
|
|
22049
|
+
setItemEditOn(false);
|
|
22050
|
+
setLinkOpen(false);
|
|
21491
22051
|
setError(null);
|
|
21492
22052
|
};
|
|
21493
22053
|
window.addEventListener("blur", onBlur);
|
|
@@ -21497,7 +22057,10 @@ function AiMediaStripOverlay({
|
|
|
21497
22057
|
const onKeyDown = (e) => {
|
|
21498
22058
|
if (e.key !== "Escape") return;
|
|
21499
22059
|
if (!activeRef.current) return;
|
|
22060
|
+
if (linkOpenRef.current) return;
|
|
22061
|
+
if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
|
|
21500
22062
|
setActive(null);
|
|
22063
|
+
setItemEditOn(false);
|
|
21501
22064
|
setError(null);
|
|
21502
22065
|
};
|
|
21503
22066
|
document.addEventListener("keydown", onKeyDown);
|
|
@@ -21531,137 +22094,133 @@ function AiMediaStripOverlay({
|
|
|
21531
22094
|
tree: nextTree,
|
|
21532
22095
|
label: entry.label,
|
|
21533
22096
|
media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
|
|
21534
|
-
...entry.brand ? { brand: entry.brand } : {}
|
|
22097
|
+
...entry.brand ? { brand: entry.brand } : {},
|
|
22098
|
+
// The user is already looking at the strip they just edited — recentering the viewport
|
|
22099
|
+
// on every edit reads as the section jumping around.
|
|
22100
|
+
skipScrollIntoView: true
|
|
21535
22101
|
});
|
|
21536
22102
|
return true;
|
|
21537
22103
|
},
|
|
21538
22104
|
[findEntry, postToParent2, applyTreeLocalRef]
|
|
21539
22105
|
);
|
|
21540
22106
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
21541
|
-
const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
|
|
21542
22107
|
const activeItemRect = useLiveItemRect(active);
|
|
21543
|
-
const
|
|
21544
|
-
const
|
|
21545
|
-
|
|
21546
|
-
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21557
|
-
|
|
21558
|
-
|
|
21559
|
-
|
|
21560
|
-
|
|
21561
|
-
|
|
21562
|
-
|
|
21563
|
-
|
|
21564
|
-
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
|
|
21568
|
-
|
|
21569
|
-
|
|
21570
|
-
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21578
|
-
ItemInteractionLayer,
|
|
21579
|
-
{
|
|
21580
|
-
rect: activeItemRect,
|
|
21581
|
-
state: toolbarState,
|
|
21582
|
-
toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
21583
|
-
MediaStripToolbar,
|
|
21584
|
-
{
|
|
21585
|
-
entry: activeEntry,
|
|
21586
|
-
index: active.index,
|
|
21587
|
-
pending,
|
|
21588
|
-
error,
|
|
21589
|
-
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
21590
|
-
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
21591
|
-
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
21592
|
-
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
21593
|
-
onResize: (delta) => {
|
|
21594
|
-
const slots = findMediaStripSlots(activeEntry.tree);
|
|
21595
|
-
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
21596
|
-
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
21597
|
-
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
21598
|
-
},
|
|
21599
|
-
onSetAlt: (alt) => {
|
|
21600
|
-
void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
|
|
21601
|
-
},
|
|
21602
|
-
onSetLink: (href, linkTarget) => {
|
|
22108
|
+
const activeStripRect = useLiveItemRect(active, true);
|
|
22109
|
+
const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
|
|
22110
|
+
const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
|
|
22111
|
+
const activeItem = active ? activeItems[active.index] : void 0;
|
|
22112
|
+
const activeHref = activeItem?.href ?? "";
|
|
22113
|
+
const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
|
|
22114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
22115
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
22116
|
+
activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
22117
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
|
|
22118
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
22119
|
+
MediaStripToolbar,
|
|
22120
|
+
{
|
|
22121
|
+
entry: activeEntry,
|
|
22122
|
+
index: active.index,
|
|
22123
|
+
pending,
|
|
22124
|
+
error,
|
|
22125
|
+
itemEditOn,
|
|
22126
|
+
onToggleItemEdit: () => setItemEditOn((on) => !on),
|
|
22127
|
+
onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
|
|
22128
|
+
onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
|
|
22129
|
+
onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
|
|
22130
|
+
onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
|
|
22131
|
+
onResize: (delta) => {
|
|
22132
|
+
const slots = findMediaStripSlots(activeEntry.tree);
|
|
22133
|
+
const variant = slots?.variant === "reel" ? "reel" : "logos";
|
|
22134
|
+
const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
|
|
22135
|
+
void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
|
|
22136
|
+
},
|
|
22137
|
+
onOpenLink: () => setLinkOpen(true),
|
|
22138
|
+
onAddItem: () => {
|
|
22139
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
22140
|
+
if (!picked) return;
|
|
22141
|
+
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
21603
22142
|
void runMutation(
|
|
21604
22143
|
active.sectionId,
|
|
21605
|
-
(tree) =>
|
|
21606
|
-
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
void requestAssetPick(postToParent2).then((picked) => {
|
|
21610
|
-
if (!picked) return;
|
|
21611
|
-
const item = { assetId: picked.assetId, alt: "Logo" };
|
|
21612
|
-
void runMutation(
|
|
21613
|
-
active.sectionId,
|
|
21614
|
-
(tree) => addMediaStripItem(tree, item, active.index),
|
|
21615
|
-
{ [picked.assetId]: picked.url }
|
|
21616
|
-
).then((applied) => {
|
|
21617
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21618
|
-
});
|
|
22144
|
+
(tree) => addMediaStripItem(tree, item, active.index),
|
|
22145
|
+
{ [picked.assetId]: picked.url }
|
|
22146
|
+
).then((applied) => {
|
|
22147
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21619
22148
|
});
|
|
21620
|
-
}
|
|
21621
|
-
|
|
21622
|
-
|
|
21623
|
-
|
|
21624
|
-
|
|
21625
|
-
|
|
21626
|
-
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
});
|
|
21630
|
-
},
|
|
21631
|
-
onRemoveItem: () => {
|
|
21632
|
-
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
21633
|
-
(applied) => {
|
|
21634
|
-
if (applied) setActive(null);
|
|
21635
|
-
}
|
|
21636
|
-
);
|
|
21637
|
-
},
|
|
21638
|
-
onMoveLeft: () => {
|
|
21639
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
21640
|
-
(applied) => {
|
|
21641
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
21642
|
-
}
|
|
21643
|
-
);
|
|
21644
|
-
},
|
|
21645
|
-
onMoveRight: () => {
|
|
21646
|
-
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
21647
|
-
(applied) => {
|
|
21648
|
-
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
21649
|
-
}
|
|
22149
|
+
});
|
|
22150
|
+
},
|
|
22151
|
+
onChangeImage: () => {
|
|
22152
|
+
void requestAssetPick(postToParent2).then((picked) => {
|
|
22153
|
+
if (!picked) return;
|
|
22154
|
+
void runMutation(
|
|
22155
|
+
active.sectionId,
|
|
22156
|
+
(tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
|
|
22157
|
+
{ [picked.assetId]: picked.url }
|
|
21650
22158
|
);
|
|
21651
|
-
}
|
|
22159
|
+
});
|
|
22160
|
+
},
|
|
22161
|
+
onRemoveItem: () => {
|
|
22162
|
+
void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
|
|
22163
|
+
(applied) => {
|
|
22164
|
+
if (applied) setActive(null);
|
|
22165
|
+
}
|
|
22166
|
+
);
|
|
22167
|
+
},
|
|
22168
|
+
onMoveLeft: () => {
|
|
22169
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
|
|
22170
|
+
(applied) => {
|
|
22171
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
|
|
22172
|
+
}
|
|
22173
|
+
);
|
|
22174
|
+
},
|
|
22175
|
+
onMoveRight: () => {
|
|
22176
|
+
void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
|
|
22177
|
+
(applied) => {
|
|
22178
|
+
if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
|
|
22179
|
+
}
|
|
22180
|
+
);
|
|
21652
22181
|
}
|
|
21653
|
-
|
|
21654
|
-
}
|
|
21655
|
-
|
|
22182
|
+
}
|
|
22183
|
+
) }),
|
|
22184
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
22185
|
+
"div",
|
|
22186
|
+
{
|
|
22187
|
+
"data-ohw-bridge": "",
|
|
22188
|
+
"data-ohw-item-interaction": "",
|
|
22189
|
+
"aria-hidden": true,
|
|
22190
|
+
className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
|
|
22191
|
+
style: {
|
|
22192
|
+
top: activeItemRect.top + activeItemRect.height + 10,
|
|
22193
|
+
left: activeItemRect.left - 5,
|
|
22194
|
+
background: PRIMARY3,
|
|
22195
|
+
zIndex: 2147483644
|
|
22196
|
+
},
|
|
22197
|
+
children: "Media item"
|
|
22198
|
+
}
|
|
22199
|
+
),
|
|
22200
|
+
linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
22201
|
+
LinkModal,
|
|
22202
|
+
{
|
|
22203
|
+
href: activeHref,
|
|
22204
|
+
linkTarget: activeTarget,
|
|
22205
|
+
onClose: () => setLinkOpen(false),
|
|
22206
|
+
onSave: (href, linkTarget) => {
|
|
22207
|
+
void runMutation(
|
|
22208
|
+
active.sectionId,
|
|
22209
|
+
(tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
|
|
22210
|
+
);
|
|
22211
|
+
}
|
|
22212
|
+
}
|
|
22213
|
+
)
|
|
22214
|
+
] })
|
|
21656
22215
|
] });
|
|
21657
22216
|
}
|
|
21658
22217
|
|
|
21659
22218
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
21660
22219
|
var import_react15 = require("react");
|
|
21661
|
-
var
|
|
21662
|
-
var
|
|
22220
|
+
var import_lucide_react10 = require("lucide-react");
|
|
22221
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
21663
22222
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
21664
|
-
var
|
|
22223
|
+
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]";
|
|
21665
22224
|
function findPricingCardElement(sectionId, index) {
|
|
21666
22225
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
21667
22226
|
if (!sectionEl2) return null;
|
|
@@ -21673,7 +22232,7 @@ function findPricingCardElement(sectionId, index) {
|
|
|
21673
22232
|
}
|
|
21674
22233
|
function cardRefFromTarget(target) {
|
|
21675
22234
|
if (!(target instanceof Element)) return null;
|
|
21676
|
-
if (target.closest(
|
|
22235
|
+
if (target.closest(CHROME_SELECTOR2)) return null;
|
|
21677
22236
|
const cardEl = target.closest("[data-ohw-pricing-card]");
|
|
21678
22237
|
if (!cardEl) return null;
|
|
21679
22238
|
const sectionEl2 = cardEl.closest("[data-ohw-section]");
|
|
@@ -21683,21 +22242,21 @@ function cardRefFromTarget(target) {
|
|
|
21683
22242
|
if (!sectionId || Number.isNaN(index)) return null;
|
|
21684
22243
|
return { sectionId, index };
|
|
21685
22244
|
}
|
|
21686
|
-
function
|
|
22245
|
+
function sameRef2(a, b) {
|
|
21687
22246
|
return a?.sectionId === b?.sectionId && a?.index === b?.index;
|
|
21688
22247
|
}
|
|
21689
|
-
function
|
|
22248
|
+
function rectOf2(el) {
|
|
21690
22249
|
if (!el) return null;
|
|
21691
22250
|
const r2 = el.getBoundingClientRect();
|
|
21692
22251
|
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
21693
22252
|
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
21694
22253
|
}
|
|
21695
22254
|
function readRect3(ref) {
|
|
21696
|
-
return
|
|
22255
|
+
return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
|
|
21697
22256
|
}
|
|
21698
22257
|
function readGridRect(ref) {
|
|
21699
22258
|
const card = ref && findPricingCardElement(ref.sectionId, ref.index);
|
|
21700
|
-
return
|
|
22259
|
+
return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
|
|
21701
22260
|
}
|
|
21702
22261
|
function useLiveCardRect(ref, grid = false) {
|
|
21703
22262
|
const [rect, setRect] = (0, import_react15.useState)(null);
|
|
@@ -21727,7 +22286,7 @@ function useLiveCardRect(ref, grid = false) {
|
|
|
21727
22286
|
}
|
|
21728
22287
|
var TOOLBAR_GRID_GAP = 52;
|
|
21729
22288
|
var TOOLBAR_GRID_GAP_MOBILE = 42;
|
|
21730
|
-
var
|
|
22289
|
+
var TOOLBAR_EDGE_MARGIN3 = 4;
|
|
21731
22290
|
function GridToolbarSlot({ gridRect, children }) {
|
|
21732
22291
|
const slotRef = (0, import_react15.useRef)(null);
|
|
21733
22292
|
const [shift, setShift] = (0, import_react15.useState)(0);
|
|
@@ -21739,7 +22298,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
21739
22298
|
const w = slot.offsetWidth;
|
|
21740
22299
|
if (w <= 0) return;
|
|
21741
22300
|
const half = w / 2;
|
|
21742
|
-
const clamped = Math.max(
|
|
22301
|
+
const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
|
|
21743
22302
|
setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
|
|
21744
22303
|
};
|
|
21745
22304
|
clamp();
|
|
@@ -21748,7 +22307,7 @@ function GridToolbarSlot({ gridRect, children }) {
|
|
|
21748
22307
|
return () => ro.disconnect();
|
|
21749
22308
|
}, [centerX, children]);
|
|
21750
22309
|
const mobile = window.innerWidth <= 480;
|
|
21751
|
-
return /* @__PURE__ */ (0,
|
|
22310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21752
22311
|
"div",
|
|
21753
22312
|
{
|
|
21754
22313
|
ref: slotRef,
|
|
@@ -21783,7 +22342,7 @@ function requestValidateTree2(postToParent2, tree) {
|
|
|
21783
22342
|
});
|
|
21784
22343
|
}
|
|
21785
22344
|
function StyleSwatch({ style }) {
|
|
21786
|
-
return /* @__PURE__ */ (0,
|
|
22345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21787
22346
|
"span",
|
|
21788
22347
|
{
|
|
21789
22348
|
"aria-hidden": true,
|
|
@@ -21797,35 +22356,35 @@ function StyleSwatch({ style }) {
|
|
|
21797
22356
|
);
|
|
21798
22357
|
}
|
|
21799
22358
|
function ButtonGlyph() {
|
|
21800
|
-
return /* @__PURE__ */ (0,
|
|
21801
|
-
/* @__PURE__ */ (0,
|
|
21802
|
-
/* @__PURE__ */ (0,
|
|
22359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
22360
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
22361
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
21803
22362
|
] });
|
|
21804
22363
|
}
|
|
21805
22364
|
function FeatureGlyph({ mode }) {
|
|
21806
|
-
return /* @__PURE__ */ (0,
|
|
21807
|
-
/* @__PURE__ */ (0,
|
|
21808
|
-
/* @__PURE__ */ (0,
|
|
21809
|
-
/* @__PURE__ */ (0,
|
|
21810
|
-
/* @__PURE__ */ (0,
|
|
21811
|
-
/* @__PURE__ */ (0,
|
|
21812
|
-
mode === "add" && /* @__PURE__ */ (0,
|
|
22365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
|
|
22366
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
22367
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
22368
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
|
|
22369
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
|
|
22370
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
22371
|
+
mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
21813
22372
|
] });
|
|
21814
22373
|
}
|
|
21815
|
-
function
|
|
22374
|
+
function ToolbarAction2({
|
|
21816
22375
|
label,
|
|
21817
22376
|
onClick,
|
|
21818
22377
|
disabled = false,
|
|
21819
22378
|
children
|
|
21820
22379
|
}) {
|
|
21821
|
-
const button = /* @__PURE__ */ (0,
|
|
21822
|
-
return /* @__PURE__ */ (0,
|
|
21823
|
-
/* @__PURE__ */ (0,
|
|
21824
|
-
/* @__PURE__ */ (0,
|
|
22380
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
|
|
22381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
22382
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
|
|
22383
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
|
|
21825
22384
|
] });
|
|
21826
22385
|
}
|
|
21827
|
-
function
|
|
21828
|
-
return /* @__PURE__ */ (0,
|
|
22386
|
+
function ToolbarSeparator2() {
|
|
22387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
|
|
21829
22388
|
}
|
|
21830
22389
|
function CardStyleMenu({
|
|
21831
22390
|
value,
|
|
@@ -21833,7 +22392,7 @@ function CardStyleMenu({
|
|
|
21833
22392
|
disabled = false
|
|
21834
22393
|
}) {
|
|
21835
22394
|
const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
|
|
21836
|
-
const trigger = /* @__PURE__ */ (0,
|
|
22395
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
21837
22396
|
"button",
|
|
21838
22397
|
{
|
|
21839
22398
|
type: "button",
|
|
@@ -21844,28 +22403,28 @@ function CardStyleMenu({
|
|
|
21844
22403
|
disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
|
|
21845
22404
|
),
|
|
21846
22405
|
children: [
|
|
21847
|
-
/* @__PURE__ */ (0,
|
|
21848
|
-
/* @__PURE__ */ (0,
|
|
21849
|
-
/* @__PURE__ */ (0,
|
|
22406
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
|
|
22407
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
|
|
22408
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
|
|
21850
22409
|
]
|
|
21851
22410
|
}
|
|
21852
22411
|
);
|
|
21853
22412
|
if (disabled) {
|
|
21854
|
-
return /* @__PURE__ */ (0,
|
|
21855
|
-
/* @__PURE__ */ (0,
|
|
21856
|
-
/* @__PURE__ */ (0,
|
|
21857
|
-
/* @__PURE__ */ (0,
|
|
21858
|
-
/* @__PURE__ */ (0,
|
|
22413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
22414
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
|
|
22415
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
22416
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
|
|
22417
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
|
|
21859
22418
|
] })
|
|
21860
22419
|
] });
|
|
21861
22420
|
}
|
|
21862
|
-
return /* @__PURE__ */ (0,
|
|
21863
|
-
/* @__PURE__ */ (0,
|
|
21864
|
-
/* @__PURE__ */ (0,
|
|
21865
|
-
/* @__PURE__ */ (0,
|
|
21866
|
-
/* @__PURE__ */ (0,
|
|
22421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
|
|
22422
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
|
|
22423
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
|
|
22424
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
|
|
22425
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
|
|
21867
22426
|
const selected = style.value === value;
|
|
21868
|
-
return /* @__PURE__ */ (0,
|
|
22427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
21869
22428
|
DropdownMenuItem,
|
|
21870
22429
|
{
|
|
21871
22430
|
role: "menuitemradio",
|
|
@@ -21873,9 +22432,9 @@ function CardStyleMenu({
|
|
|
21873
22432
|
onSelect: () => onChange(style.value),
|
|
21874
22433
|
className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
|
|
21875
22434
|
children: [
|
|
21876
|
-
/* @__PURE__ */ (0,
|
|
21877
|
-
/* @__PURE__ */ (0,
|
|
21878
|
-
selected && /* @__PURE__ */ (0,
|
|
22435
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
|
|
22436
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
|
|
22437
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
|
|
21879
22438
|
]
|
|
21880
22439
|
},
|
|
21881
22440
|
style.value
|
|
@@ -21905,7 +22464,7 @@ function PricingCardToolbar({
|
|
|
21905
22464
|
const style = pricingCardStyle(entry.tree, index);
|
|
21906
22465
|
const featuredTag = pricingCardFeaturedTag(entry.tree, index);
|
|
21907
22466
|
const mobile = window.innerWidth <= 480;
|
|
21908
|
-
return /* @__PURE__ */ (0,
|
|
22467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
21909
22468
|
"div",
|
|
21910
22469
|
{
|
|
21911
22470
|
"data-ohw-bridge": "",
|
|
@@ -21917,7 +22476,7 @@ function PricingCardToolbar({
|
|
|
21917
22476
|
),
|
|
21918
22477
|
style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
|
|
21919
22478
|
children: [
|
|
21920
|
-
/* @__PURE__ */ (0,
|
|
22479
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
21921
22480
|
"div",
|
|
21922
22481
|
{
|
|
21923
22482
|
className: cn(
|
|
@@ -21926,8 +22485,8 @@ function PricingCardToolbar({
|
|
|
21926
22485
|
mobile ? "flex-wrap justify-center" : "flex-nowrap"
|
|
21927
22486
|
),
|
|
21928
22487
|
children: [
|
|
21929
|
-
/* @__PURE__ */ (0,
|
|
21930
|
-
/* @__PURE__ */ (0,
|
|
22488
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
|
|
22489
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
21931
22490
|
CustomToolbarButton,
|
|
21932
22491
|
{
|
|
21933
22492
|
type: "button",
|
|
@@ -21935,8 +22494,8 @@ function PricingCardToolbar({
|
|
|
21935
22494
|
"aria-pressed": featuredTag,
|
|
21936
22495
|
onClick: () => onSetFeaturedTag(!featuredTag),
|
|
21937
22496
|
className: "group size-8",
|
|
21938
|
-
children: /* @__PURE__ */ (0,
|
|
21939
|
-
|
|
22497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
22498
|
+
import_lucide_react10.Star,
|
|
21940
22499
|
{
|
|
21941
22500
|
size: 16,
|
|
21942
22501
|
fill: "currentColor",
|
|
@@ -21950,25 +22509,25 @@ function PricingCardToolbar({
|
|
|
21950
22509
|
)
|
|
21951
22510
|
}
|
|
21952
22511
|
) }),
|
|
21953
|
-
/* @__PURE__ */ (0,
|
|
22512
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
|
|
21954
22513
|
] }),
|
|
21955
|
-
/* @__PURE__ */ (0,
|
|
21956
|
-
/* @__PURE__ */ (0,
|
|
21957
|
-
/* @__PURE__ */ (0,
|
|
21958
|
-
/* @__PURE__ */ (0,
|
|
21959
|
-
/* @__PURE__ */ (0,
|
|
21960
|
-
/* @__PURE__ */ (0,
|
|
21961
|
-
/* @__PURE__ */ (0,
|
|
22514
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
22515
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
|
|
22516
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
22517
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
|
|
22518
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
|
|
22519
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
|
|
22520
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
|
|
21962
22521
|
] }) }),
|
|
21963
|
-
/* @__PURE__ */ (0,
|
|
21964
|
-
/* @__PURE__ */ (0,
|
|
21965
|
-
/* @__PURE__ */ (0,
|
|
21966
|
-
/* @__PURE__ */ (0,
|
|
21967
|
-
/* @__PURE__ */ (0,
|
|
22522
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
|
|
22523
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
|
|
22524
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
|
|
22525
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
|
|
22526
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
|
|
21968
22527
|
]
|
|
21969
22528
|
}
|
|
21970
22529
|
),
|
|
21971
|
-
error && /* @__PURE__ */ (0,
|
|
22530
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
|
|
21972
22531
|
]
|
|
21973
22532
|
}
|
|
21974
22533
|
) });
|
|
@@ -22002,7 +22561,7 @@ function AiPricingCardOverlay({
|
|
|
22002
22561
|
const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
|
|
22003
22562
|
setHover((prev) => {
|
|
22004
22563
|
const next = ref && !overEditable ? ref : null;
|
|
22005
|
-
return
|
|
22564
|
+
return sameRef2(prev, next) ? prev : next;
|
|
22006
22565
|
});
|
|
22007
22566
|
};
|
|
22008
22567
|
const onLeave = () => setHover(null);
|
|
@@ -22017,10 +22576,10 @@ function AiPricingCardOverlay({
|
|
|
22017
22576
|
const onClick = (e) => {
|
|
22018
22577
|
const t = e.target;
|
|
22019
22578
|
if (!(t instanceof Element)) return;
|
|
22020
|
-
if (t.closest(
|
|
22579
|
+
if (t.closest(CHROME_SELECTOR2)) return;
|
|
22021
22580
|
const ref = cardRefFromTarget(t);
|
|
22022
|
-
setActive((prev) =>
|
|
22023
|
-
if (!ref || !
|
|
22581
|
+
setActive((prev) => sameRef2(prev, ref) ? prev : ref);
|
|
22582
|
+
if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
|
|
22024
22583
|
};
|
|
22025
22584
|
document.addEventListener("click", onClick, true);
|
|
22026
22585
|
return () => document.removeEventListener("click", onClick, true);
|
|
@@ -22085,12 +22644,12 @@ function AiPricingCardOverlay({
|
|
|
22085
22644
|
const activeEntry = active ? findEntry(active.sectionId) : null;
|
|
22086
22645
|
const activeCardRect = useLiveCardRect(active);
|
|
22087
22646
|
const activeGridRect = useLiveCardRect(active, true);
|
|
22088
|
-
const hoverRect = useLiveCardRect(hover && !
|
|
22089
|
-
return /* @__PURE__ */ (0,
|
|
22090
|
-
hoverRect && /* @__PURE__ */ (0,
|
|
22091
|
-
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
22092
|
-
/* @__PURE__ */ (0,
|
|
22093
|
-
/* @__PURE__ */ (0,
|
|
22647
|
+
const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
|
|
22648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
22649
|
+
hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
|
|
22650
|
+
activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
22651
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
|
|
22652
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
22094
22653
|
PricingCardToolbar,
|
|
22095
22654
|
{
|
|
22096
22655
|
entry: activeEntry,
|
|
@@ -22118,7 +22677,7 @@ function AiPricingCardOverlay({
|
|
|
22118
22677
|
onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
|
|
22119
22678
|
}
|
|
22120
22679
|
) }),
|
|
22121
|
-
/* @__PURE__ */ (0,
|
|
22680
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
22122
22681
|
"div",
|
|
22123
22682
|
{
|
|
22124
22683
|
"data-ohw-bridge": "",
|
|
@@ -22140,7 +22699,7 @@ function AiPricingCardOverlay({
|
|
|
22140
22699
|
|
|
22141
22700
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
22142
22701
|
var import_react16 = require("react");
|
|
22143
|
-
var
|
|
22702
|
+
var import_lucide_react11 = require("lucide-react");
|
|
22144
22703
|
|
|
22145
22704
|
// src/lib/ai-video-tree.ts
|
|
22146
22705
|
function resolveVideoBlock(tree, path) {
|
|
@@ -22183,10 +22742,10 @@ function clearVideo(tree, path) {
|
|
|
22183
22742
|
}
|
|
22184
22743
|
|
|
22185
22744
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
22186
|
-
var
|
|
22745
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
22187
22746
|
var PRIMARY5 = "#0885FE";
|
|
22188
|
-
var
|
|
22189
|
-
var
|
|
22747
|
+
var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
|
|
22748
|
+
var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
|
|
22190
22749
|
function findVideoBlockElement(sectionId, path) {
|
|
22191
22750
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
22192
22751
|
if (!sectionEl2) return null;
|
|
@@ -22246,12 +22805,12 @@ function requestValidateTree3(postToParent2, tree) {
|
|
|
22246
22805
|
postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
|
|
22247
22806
|
});
|
|
22248
22807
|
}
|
|
22249
|
-
function
|
|
22808
|
+
function Pill({
|
|
22250
22809
|
label,
|
|
22251
22810
|
onClick,
|
|
22252
22811
|
disabled
|
|
22253
22812
|
}) {
|
|
22254
|
-
return /* @__PURE__ */ (0,
|
|
22813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
22255
22814
|
"button",
|
|
22256
22815
|
{
|
|
22257
22816
|
type: "button",
|
|
@@ -22267,7 +22826,7 @@ function Pill2({
|
|
|
22267
22826
|
border: "none",
|
|
22268
22827
|
cursor: disabled ? "default" : "pointer",
|
|
22269
22828
|
background: "#ffffff",
|
|
22270
|
-
color:
|
|
22829
|
+
color: OHW_BLUE_DARK,
|
|
22271
22830
|
opacity: disabled ? 0.4 : 1,
|
|
22272
22831
|
fontSize: 12,
|
|
22273
22832
|
lineHeight: "16px",
|
|
@@ -22310,8 +22869,8 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22310
22869
|
onCommit(id);
|
|
22311
22870
|
}
|
|
22312
22871
|
};
|
|
22313
|
-
return /* @__PURE__ */ (0,
|
|
22314
|
-
/* @__PURE__ */ (0,
|
|
22872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
|
|
22873
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
22315
22874
|
"div",
|
|
22316
22875
|
{
|
|
22317
22876
|
style: {
|
|
@@ -22327,12 +22886,12 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22327
22886
|
boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
|
|
22328
22887
|
},
|
|
22329
22888
|
children: [
|
|
22330
|
-
/* @__PURE__ */ (0,
|
|
22889
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
22331
22890
|
"span",
|
|
22332
22891
|
{
|
|
22333
22892
|
style: {
|
|
22334
22893
|
flex: "0 0 auto",
|
|
22335
|
-
color:
|
|
22894
|
+
color: OHW_BLUE_DARK,
|
|
22336
22895
|
fontSize: 10,
|
|
22337
22896
|
lineHeight: "16px",
|
|
22338
22897
|
fontWeight: 700,
|
|
@@ -22342,7 +22901,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22342
22901
|
children: "Video"
|
|
22343
22902
|
}
|
|
22344
22903
|
),
|
|
22345
|
-
/* @__PURE__ */ (0,
|
|
22904
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
22346
22905
|
"input",
|
|
22347
22906
|
{
|
|
22348
22907
|
type: "text",
|
|
@@ -22379,7 +22938,7 @@ function VideoUrlInput({ value, onCommit }) {
|
|
|
22379
22938
|
]
|
|
22380
22939
|
}
|
|
22381
22940
|
),
|
|
22382
|
-
invalid && /* @__PURE__ */ (0,
|
|
22941
|
+
invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
|
|
22383
22942
|
] });
|
|
22384
22943
|
}
|
|
22385
22944
|
function VideoToolbar({
|
|
@@ -22389,7 +22948,7 @@ function VideoToolbar({
|
|
|
22389
22948
|
onSetVideoId,
|
|
22390
22949
|
onRemove
|
|
22391
22950
|
}) {
|
|
22392
|
-
return /* @__PURE__ */ (0,
|
|
22951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
22393
22952
|
"div",
|
|
22394
22953
|
{
|
|
22395
22954
|
"data-ohw-bridge": "",
|
|
@@ -22401,7 +22960,7 @@ function VideoToolbar({
|
|
|
22401
22960
|
gap: 6,
|
|
22402
22961
|
alignItems: "center",
|
|
22403
22962
|
width: 280,
|
|
22404
|
-
background:
|
|
22963
|
+
background: OHW_BLUE,
|
|
22405
22964
|
padding: 8,
|
|
22406
22965
|
borderRadius: 12,
|
|
22407
22966
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -22409,9 +22968,9 @@ function VideoToolbar({
|
|
|
22409
22968
|
opacity: pending ? 0.6 : 1
|
|
22410
22969
|
},
|
|
22411
22970
|
children: [
|
|
22412
|
-
/* @__PURE__ */ (0,
|
|
22413
|
-
/* @__PURE__ */ (0,
|
|
22414
|
-
error && /* @__PURE__ */ (0,
|
|
22971
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
|
|
22972
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
|
|
22973
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
22415
22974
|
]
|
|
22416
22975
|
}
|
|
22417
22976
|
);
|
|
@@ -22531,8 +23090,8 @@ function AiVideoOverlay({
|
|
|
22531
23090
|
const activeBlockRect = useLiveBlockRect(active);
|
|
22532
23091
|
const TOOLBAR_APPROX_H = 90;
|
|
22533
23092
|
const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
22534
|
-
return /* @__PURE__ */ (0,
|
|
22535
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
23093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
23094
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
22536
23095
|
"button",
|
|
22537
23096
|
{
|
|
22538
23097
|
type: "button",
|
|
@@ -22560,15 +23119,15 @@ function AiVideoOverlay({
|
|
|
22560
23119
|
fontSize: 14,
|
|
22561
23120
|
fontWeight: 700
|
|
22562
23121
|
},
|
|
22563
|
-
children: /* @__PURE__ */ (0,
|
|
23122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
22564
23123
|
}
|
|
22565
23124
|
),
|
|
22566
|
-
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
23125
|
+
activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
22567
23126
|
ItemInteractionLayer,
|
|
22568
23127
|
{
|
|
22569
23128
|
rect: activeBlockRect,
|
|
22570
23129
|
state: toolbarState,
|
|
22571
|
-
toolbar: /* @__PURE__ */ (0,
|
|
23130
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
22572
23131
|
VideoToolbar,
|
|
22573
23132
|
{
|
|
22574
23133
|
videoId: videoIdAt(activeEntry.tree, active.path),
|
|
@@ -22592,7 +23151,7 @@ function AiVideoOverlay({
|
|
|
22592
23151
|
|
|
22593
23152
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
22594
23153
|
var import_react17 = require("react");
|
|
22595
|
-
var
|
|
23154
|
+
var import_lucide_react12 = require("lucide-react");
|
|
22596
23155
|
|
|
22597
23156
|
// src/lib/ai-carousel-tree.ts
|
|
22598
23157
|
function isCarouselBlock(node) {
|
|
@@ -22643,10 +23202,10 @@ function setCarouselAutoplay(tree, on) {
|
|
|
22643
23202
|
}
|
|
22644
23203
|
|
|
22645
23204
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
22646
|
-
var
|
|
23205
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
22647
23206
|
var PRIMARY6 = "#0885FE";
|
|
22648
|
-
var
|
|
22649
|
-
var
|
|
23207
|
+
var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
|
|
23208
|
+
var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
|
|
22650
23209
|
function findCarouselItemElement(sectionId, index) {
|
|
22651
23210
|
const sectionEl2 = findByInstanceId(sectionId);
|
|
22652
23211
|
if (!sectionEl2) return null;
|
|
@@ -22725,8 +23284,8 @@ function requestAssetPick2(postToParent2) {
|
|
|
22725
23284
|
postToParent2({ type: "ow:asset-pick", id });
|
|
22726
23285
|
});
|
|
22727
23286
|
}
|
|
22728
|
-
function
|
|
22729
|
-
return /* @__PURE__ */ (0,
|
|
23287
|
+
function Pill2({ label, onClick, disabled }) {
|
|
23288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
22730
23289
|
"button",
|
|
22731
23290
|
{
|
|
22732
23291
|
type: "button",
|
|
@@ -22742,7 +23301,7 @@ function Pill3({ label, onClick, disabled }) {
|
|
|
22742
23301
|
border: "none",
|
|
22743
23302
|
cursor: disabled ? "default" : "pointer",
|
|
22744
23303
|
background: "#ffffff",
|
|
22745
|
-
color:
|
|
23304
|
+
color: OHW_BLUE_DARK2,
|
|
22746
23305
|
opacity: disabled ? 0.4 : 1,
|
|
22747
23306
|
fontSize: 12,
|
|
22748
23307
|
lineHeight: "16px",
|
|
@@ -22760,7 +23319,7 @@ function TogglePill({
|
|
|
22760
23319
|
onToggle,
|
|
22761
23320
|
disabled
|
|
22762
23321
|
}) {
|
|
22763
|
-
return /* @__PURE__ */ (0,
|
|
23322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
22764
23323
|
"button",
|
|
22765
23324
|
{
|
|
22766
23325
|
type: "button",
|
|
@@ -22779,7 +23338,7 @@ function TogglePill({
|
|
|
22779
23338
|
border: "none",
|
|
22780
23339
|
cursor: disabled ? "default" : "pointer",
|
|
22781
23340
|
background: "#ffffff",
|
|
22782
|
-
color:
|
|
23341
|
+
color: OHW_BLUE_DARK2,
|
|
22783
23342
|
opacity: disabled ? 0.4 : 1,
|
|
22784
23343
|
fontSize: 12,
|
|
22785
23344
|
lineHeight: "16px",
|
|
@@ -22789,7 +23348,7 @@ function TogglePill({
|
|
|
22789
23348
|
},
|
|
22790
23349
|
children: [
|
|
22791
23350
|
label,
|
|
22792
|
-
/* @__PURE__ */ (0,
|
|
23351
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
22793
23352
|
"span",
|
|
22794
23353
|
{
|
|
22795
23354
|
"aria-hidden": true,
|
|
@@ -22802,10 +23361,10 @@ function TogglePill({
|
|
|
22802
23361
|
// Off is a grey track, not a washed-out blue: the pill's own white background already
|
|
22803
23362
|
// carries the brand colour in the text, and a pale blue track next to it read as
|
|
22804
23363
|
// "disabled control" rather than "switch that is off".
|
|
22805
|
-
background: on ?
|
|
23364
|
+
background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
|
|
22806
23365
|
transition: "background 120ms ease"
|
|
22807
23366
|
},
|
|
22808
|
-
children: /* @__PURE__ */ (0,
|
|
23367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
22809
23368
|
"span",
|
|
22810
23369
|
{
|
|
22811
23370
|
style: {
|
|
@@ -22834,7 +23393,7 @@ function CarouselSlideToolbar({
|
|
|
22834
23393
|
onChangeImage,
|
|
22835
23394
|
onToggleAutoplay
|
|
22836
23395
|
}) {
|
|
22837
|
-
return /* @__PURE__ */ (0,
|
|
23396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
22838
23397
|
"div",
|
|
22839
23398
|
{
|
|
22840
23399
|
"data-ohw-bridge": "",
|
|
@@ -22845,7 +23404,7 @@ function CarouselSlideToolbar({
|
|
|
22845
23404
|
flexDirection: "column",
|
|
22846
23405
|
gap: 6,
|
|
22847
23406
|
alignItems: "center",
|
|
22848
|
-
background:
|
|
23407
|
+
background: OHW_BLUE2,
|
|
22849
23408
|
padding: 8,
|
|
22850
23409
|
borderRadius: 12,
|
|
22851
23410
|
boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
|
|
@@ -22857,11 +23416,11 @@ function CarouselSlideToolbar({
|
|
|
22857
23416
|
pointerEvents: pending ? "none" : "auto"
|
|
22858
23417
|
},
|
|
22859
23418
|
children: [
|
|
22860
|
-
/* @__PURE__ */ (0,
|
|
22861
|
-
/* @__PURE__ */ (0,
|
|
22862
|
-
/* @__PURE__ */ (0,
|
|
23419
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
23420
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
|
|
23421
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
|
|
22863
23422
|
] }),
|
|
22864
|
-
error && /* @__PURE__ */ (0,
|
|
23423
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
|
|
22865
23424
|
]
|
|
22866
23425
|
}
|
|
22867
23426
|
);
|
|
@@ -23001,8 +23560,8 @@ function AiFadeCarouselOverlay({
|
|
|
23001
23560
|
const activeItemRect = useLiveItemRect2(active);
|
|
23002
23561
|
const TOOLBAR_APPROX_H = 90;
|
|
23003
23562
|
const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
|
|
23004
|
-
return /* @__PURE__ */ (0,
|
|
23005
|
-
hoverHandleRect && hover && /* @__PURE__ */ (0,
|
|
23563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
23564
|
+
hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23006
23565
|
"button",
|
|
23007
23566
|
{
|
|
23008
23567
|
type: "button",
|
|
@@ -23031,10 +23590,10 @@ function AiFadeCarouselOverlay({
|
|
|
23031
23590
|
fontSize: 14,
|
|
23032
23591
|
fontWeight: 700
|
|
23033
23592
|
},
|
|
23034
|
-
children: /* @__PURE__ */ (0,
|
|
23593
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
|
|
23035
23594
|
}
|
|
23036
23595
|
),
|
|
23037
|
-
swapping && /* @__PURE__ */ (0,
|
|
23596
|
+
swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23038
23597
|
"div",
|
|
23039
23598
|
{
|
|
23040
23599
|
ref: skeletonRef,
|
|
@@ -23052,15 +23611,15 @@ function AiFadeCarouselOverlay({
|
|
|
23052
23611
|
zIndex: 2147483646,
|
|
23053
23612
|
pointerEvents: "none"
|
|
23054
23613
|
},
|
|
23055
|
-
children: /* @__PURE__ */ (0,
|
|
23614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
|
|
23056
23615
|
}
|
|
23057
23616
|
),
|
|
23058
|
-
activeItemRect && active && activeEntry && /* @__PURE__ */ (0,
|
|
23617
|
+
activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23059
23618
|
ItemInteractionLayer,
|
|
23060
23619
|
{
|
|
23061
23620
|
rect: activeItemRect,
|
|
23062
23621
|
state: toolbarState,
|
|
23063
|
-
toolbar: /* @__PURE__ */ (0,
|
|
23622
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23064
23623
|
CarouselSlideToolbar,
|
|
23065
23624
|
{
|
|
23066
23625
|
pending,
|
|
@@ -23298,113 +23857,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
23298
23857
|
// src/ui/link-modal/LinkPopover.tsx
|
|
23299
23858
|
var import_react21 = require("react");
|
|
23300
23859
|
|
|
23301
|
-
// src/ui/dialog.tsx
|
|
23302
|
-
var React9 = __toESM(require("react"), 1);
|
|
23303
|
-
var import_radix_ui6 = require("radix-ui");
|
|
23304
|
-
var import_lucide_react12 = require("lucide-react");
|
|
23305
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
23306
|
-
function Dialog2({
|
|
23307
|
-
...props
|
|
23308
|
-
}) {
|
|
23309
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
23310
|
-
}
|
|
23311
|
-
function DialogPortal({
|
|
23312
|
-
...props
|
|
23313
|
-
}) {
|
|
23314
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
|
|
23315
|
-
}
|
|
23316
|
-
function DialogOverlay({
|
|
23317
|
-
className,
|
|
23318
|
-
...props
|
|
23319
|
-
}) {
|
|
23320
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23321
|
-
import_radix_ui6.Dialog.Overlay,
|
|
23322
|
-
{
|
|
23323
|
-
"data-slot": "dialog-overlay",
|
|
23324
|
-
"data-ohw-link-modal-root": "",
|
|
23325
|
-
className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
|
|
23326
|
-
...props
|
|
23327
|
-
}
|
|
23328
|
-
);
|
|
23329
|
-
}
|
|
23330
|
-
var DialogContent = React9.forwardRef(
|
|
23331
|
-
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
23332
|
-
const positionMode = container ? "absolute" : "fixed";
|
|
23333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
|
|
23334
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
23335
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
23336
|
-
import_radix_ui6.Dialog.Content,
|
|
23337
|
-
{
|
|
23338
|
-
ref,
|
|
23339
|
-
"data-slot": "dialog-content",
|
|
23340
|
-
className: cn(
|
|
23341
|
-
positionMode,
|
|
23342
|
-
"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",
|
|
23343
|
-
"rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
|
|
23344
|
-
container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
|
|
23345
|
-
className
|
|
23346
|
-
),
|
|
23347
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
23348
|
-
...props,
|
|
23349
|
-
children: [
|
|
23350
|
-
children,
|
|
23351
|
-
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23352
|
-
import_radix_ui6.Dialog.Close,
|
|
23353
|
-
{
|
|
23354
|
-
type: "button",
|
|
23355
|
-
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
23356
|
-
"aria-label": "Close",
|
|
23357
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
|
|
23358
|
-
}
|
|
23359
|
-
) : null
|
|
23360
|
-
]
|
|
23361
|
-
}
|
|
23362
|
-
)
|
|
23363
|
-
] });
|
|
23364
|
-
}
|
|
23365
|
-
);
|
|
23366
|
-
DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
|
|
23367
|
-
function DialogHeader({
|
|
23368
|
-
className,
|
|
23369
|
-
...props
|
|
23370
|
-
}) {
|
|
23371
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
23372
|
-
}
|
|
23373
|
-
function DialogFooter({
|
|
23374
|
-
className,
|
|
23375
|
-
...props
|
|
23376
|
-
}) {
|
|
23377
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23378
|
-
"div",
|
|
23379
|
-
{
|
|
23380
|
-
className: cn("flex items-center justify-end gap-2", className),
|
|
23381
|
-
...props
|
|
23382
|
-
}
|
|
23383
|
-
);
|
|
23384
|
-
}
|
|
23385
|
-
var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23386
|
-
import_radix_ui6.Dialog.Title,
|
|
23387
|
-
{
|
|
23388
|
-
ref,
|
|
23389
|
-
className: cn(
|
|
23390
|
-
"text-lg font-semibold leading-none tracking-tight text-card-foreground",
|
|
23391
|
-
className
|
|
23392
|
-
),
|
|
23393
|
-
...props
|
|
23394
|
-
}
|
|
23395
|
-
));
|
|
23396
|
-
DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
|
|
23397
|
-
var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
23398
|
-
import_radix_ui6.Dialog.Description,
|
|
23399
|
-
{
|
|
23400
|
-
ref,
|
|
23401
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
23402
|
-
...props
|
|
23403
|
-
}
|
|
23404
|
-
));
|
|
23405
|
-
DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
|
|
23406
|
-
var DialogClose = import_radix_ui6.Dialog.Close;
|
|
23407
|
-
|
|
23408
23860
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
23409
23861
|
var import_lucide_react16 = require("lucide-react");
|
|
23410
23862
|
|
|
@@ -24508,6 +24960,7 @@ function shouldUseDevFixtures() {
|
|
|
24508
24960
|
function getLogoElement(el) {
|
|
24509
24961
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
24510
24962
|
if (marked) return marked;
|
|
24963
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
24511
24964
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
24512
24965
|
if (!root) return null;
|
|
24513
24966
|
const anchor = el.closest("a");
|
|
@@ -26958,7 +27411,7 @@ function isIconEditable(el) {
|
|
|
26958
27411
|
return el.dataset.ohwEditable === "icon";
|
|
26959
27412
|
}
|
|
26960
27413
|
var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [data-ohw-editable="video"]';
|
|
26961
|
-
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"]';
|
|
27414
|
+
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"]';
|
|
26962
27415
|
function isOverEditorChrome(x, y) {
|
|
26963
27416
|
return document.elementsFromPoint(x, y).some((el) => el instanceof HTMLElement && el.matches(EDITOR_CHROME_SELECTOR));
|
|
26964
27417
|
}
|
|
@@ -27324,7 +27777,7 @@ function getNavigationSelectionParent(el) {
|
|
|
27324
27777
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
27325
27778
|
return resolveFooterLinksContainerFrom(el);
|
|
27326
27779
|
}
|
|
27327
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
27780
|
+
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)) {
|
|
27328
27781
|
return getNavigationRoot(el);
|
|
27329
27782
|
}
|
|
27330
27783
|
return null;
|
|
@@ -27546,7 +27999,6 @@ var ICONS = {
|
|
|
27546
27999
|
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"/>',
|
|
27547
28000
|
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"/>'
|
|
27548
28001
|
};
|
|
27549
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
27550
28002
|
var SELECTION_CHROME_GAP2 = 4;
|
|
27551
28003
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
27552
28004
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -27644,7 +28096,7 @@ function applyVisibleViewport(el, parentScroll) {
|
|
|
27644
28096
|
el.style.top = `${top}px`;
|
|
27645
28097
|
el.style.height = `${height}px`;
|
|
27646
28098
|
}
|
|
27647
|
-
var
|
|
28099
|
+
var TOOLBAR_EDGE_MARGIN4 = 4;
|
|
27648
28100
|
function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
27649
28101
|
const isAbove = transform.includes("translateY(-100%)");
|
|
27650
28102
|
let visualTop = isAbove ? top - approxH : top;
|
|
@@ -27671,8 +28123,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
|
|
|
27671
28123
|
function clampToolbarLeft(centerX, toolbarWidth) {
|
|
27672
28124
|
const half = toolbarWidth / 2;
|
|
27673
28125
|
return Math.max(
|
|
27674
|
-
|
|
27675
|
-
Math.min(centerX, window.innerWidth -
|
|
28126
|
+
TOOLBAR_EDGE_MARGIN4 + half,
|
|
28127
|
+
Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
|
|
27676
28128
|
);
|
|
27677
28129
|
}
|
|
27678
28130
|
function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
|
|
@@ -28347,10 +28799,14 @@ function OhhwellsBridge() {
|
|
|
28347
28799
|
const [fieldPickRect, setFieldPickRect] = (0, import_react26.useState)(null);
|
|
28348
28800
|
const fieldPickElRef = (0, import_react26.useRef)(null);
|
|
28349
28801
|
const [fieldPickState, setFieldPickState] = (0, import_react26.useState)(null);
|
|
28802
|
+
const [dropdownOptionPick, setDropdownOptionPick] = (0, import_react26.useState)(null);
|
|
28350
28803
|
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react26.useState)(false);
|
|
28351
28804
|
const clearFormPick = (0, import_react26.useCallback)(() => {
|
|
28352
28805
|
const form = formPickElRef.current;
|
|
28353
28806
|
const editing = fieldPickElRef.current;
|
|
28807
|
+
if (editing && fieldTypeOf(editing) === "dropdown") {
|
|
28808
|
+
setDropdownPreviewOpen(editing, false);
|
|
28809
|
+
}
|
|
28354
28810
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
28355
28811
|
const owner = editing.closest('[data-ohw-editable="form"]');
|
|
28356
28812
|
if (owner) persistFieldsRef.current(owner);
|
|
@@ -28362,6 +28818,7 @@ function OhhwellsBridge() {
|
|
|
28362
28818
|
setFormViewStateUi("default");
|
|
28363
28819
|
setFormPickCount(null);
|
|
28364
28820
|
setFieldTypePickerOpen(false);
|
|
28821
|
+
setDropdownOptionPick(null);
|
|
28365
28822
|
fieldPickElRef.current = null;
|
|
28366
28823
|
setFieldPickRect(null);
|
|
28367
28824
|
setFieldPickState(null);
|
|
@@ -28370,10 +28827,14 @@ function OhhwellsBridge() {
|
|
|
28370
28827
|
}, []);
|
|
28371
28828
|
const clearFieldPick = (0, import_react26.useCallback)(() => {
|
|
28372
28829
|
const wrapper = fieldPickElRef.current;
|
|
28830
|
+
if (wrapper && fieldTypeOf(wrapper) === "dropdown") {
|
|
28831
|
+
setDropdownPreviewOpen(wrapper, false);
|
|
28832
|
+
}
|
|
28373
28833
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
28374
28834
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
28375
28835
|
if (form) persistFieldsRef.current(form);
|
|
28376
28836
|
}
|
|
28837
|
+
setDropdownOptionPick(null);
|
|
28377
28838
|
fieldPickElRef.current = null;
|
|
28378
28839
|
setFieldPickRect(null);
|
|
28379
28840
|
setFieldPickState(null);
|
|
@@ -28391,17 +28852,50 @@ function OhhwellsBridge() {
|
|
|
28391
28852
|
[]
|
|
28392
28853
|
);
|
|
28393
28854
|
persistFieldsRef.current = persistFields;
|
|
28855
|
+
const refreshDropdownOptionPick = (0, import_react26.useCallback)((wrapper, index) => {
|
|
28856
|
+
if (index == null || fieldTypeOf(wrapper) !== "dropdown") {
|
|
28857
|
+
clearDropdownOptionSelection(wrapper);
|
|
28858
|
+
setDropdownOptionPick(null);
|
|
28859
|
+
return;
|
|
28860
|
+
}
|
|
28861
|
+
selectDropdownOption(wrapper, index);
|
|
28862
|
+
const row = listDropdownOptionRows(wrapper)[index];
|
|
28863
|
+
if (!row) {
|
|
28864
|
+
setDropdownOptionPick(null);
|
|
28865
|
+
return;
|
|
28866
|
+
}
|
|
28867
|
+
setDropdownOptionPick({
|
|
28868
|
+
index,
|
|
28869
|
+
rect: row.getBoundingClientRect(),
|
|
28870
|
+
canDelete: listDropdownOptionRows(wrapper).length > 1
|
|
28871
|
+
});
|
|
28872
|
+
setFieldPickRect(null);
|
|
28873
|
+
}, []);
|
|
28394
28874
|
const selectField = (0, import_react26.useCallback)((wrapper) => {
|
|
28395
28875
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
28396
|
-
|
|
28876
|
+
const prev = fieldPickElRef.current;
|
|
28877
|
+
if (fieldTypeOf(prev) === "dropdown") setDropdownPreviewOpen(prev, false);
|
|
28878
|
+
commitPlaceholderEdit(prev);
|
|
28397
28879
|
}
|
|
28398
28880
|
syncRequiredMark(wrapper);
|
|
28399
|
-
|
|
28881
|
+
const type = fieldTypeOf(wrapper);
|
|
28882
|
+
if (type === "dropdown") {
|
|
28883
|
+
syncDropdownPanel(wrapper);
|
|
28884
|
+
if (!isDropdownPreviewOpen(wrapper)) setDropdownPreviewOpen(wrapper, false);
|
|
28885
|
+
} else {
|
|
28886
|
+
beginPlaceholderEdit(wrapper);
|
|
28887
|
+
}
|
|
28400
28888
|
formHoverElRef.current = null;
|
|
28401
28889
|
setFormHoverRect(null);
|
|
28890
|
+
setDropdownOptionPick(null);
|
|
28891
|
+
clearDropdownOptionSelection(wrapper);
|
|
28402
28892
|
fieldPickElRef.current = wrapper;
|
|
28403
28893
|
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
28404
|
-
setFieldPickState({
|
|
28894
|
+
setFieldPickState({
|
|
28895
|
+
type,
|
|
28896
|
+
required: isFieldRequired(wrapper),
|
|
28897
|
+
dropdownOpen: type === "dropdown" ? isDropdownPreviewOpen(wrapper) : null
|
|
28898
|
+
});
|
|
28405
28899
|
setFieldTypePickerOpen(false);
|
|
28406
28900
|
}, []);
|
|
28407
28901
|
const withSelectedField = (0, import_react26.useCallback)(
|
|
@@ -28431,6 +28925,31 @@ function OhhwellsBridge() {
|
|
|
28431
28925
|
}),
|
|
28432
28926
|
[selectField, withSelectedField]
|
|
28433
28927
|
);
|
|
28928
|
+
const handleFieldDropdownOpenChange = (0, import_react26.useCallback)((open) => {
|
|
28929
|
+
const wrapper = fieldPickElRef.current;
|
|
28930
|
+
if (!wrapper || fieldTypeOf(wrapper) !== "dropdown") return;
|
|
28931
|
+
if (!open) {
|
|
28932
|
+
commitDropdownOptionsFromPanel(wrapper, true);
|
|
28933
|
+
const form = formPickElRef.current;
|
|
28934
|
+
if (form) persistFieldsRef.current(form);
|
|
28935
|
+
}
|
|
28936
|
+
setDropdownPreviewOpen(wrapper, open);
|
|
28937
|
+
setDropdownOptionPick(null);
|
|
28938
|
+
clearDropdownOptionSelection(wrapper);
|
|
28939
|
+
suppressNextClickRef.current = true;
|
|
28940
|
+
suppressClickUntilRef.current = Date.now() + 400;
|
|
28941
|
+
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
28942
|
+
setFieldPickState({
|
|
28943
|
+
type: "dropdown",
|
|
28944
|
+
required: isFieldRequired(wrapper),
|
|
28945
|
+
dropdownOpen: open
|
|
28946
|
+
});
|
|
28947
|
+
requestAnimationFrame(() => {
|
|
28948
|
+
if (fieldPickElRef.current === wrapper) {
|
|
28949
|
+
setFieldPickRect(wrapper.getBoundingClientRect());
|
|
28950
|
+
}
|
|
28951
|
+
});
|
|
28952
|
+
}, []);
|
|
28434
28953
|
const handleFieldDuplicate = (0, import_react26.useCallback)(
|
|
28435
28954
|
() => withSelectedField((form, wrapper) => {
|
|
28436
28955
|
const copy = duplicateField(form, wrapper);
|
|
@@ -28446,6 +28965,28 @@ function OhhwellsBridge() {
|
|
|
28446
28965
|
}),
|
|
28447
28966
|
[clearFieldPick, withSelectedField]
|
|
28448
28967
|
);
|
|
28968
|
+
const handleDropdownOptionDuplicate = (0, import_react26.useCallback)(() => {
|
|
28969
|
+
const wrapper = fieldPickElRef.current;
|
|
28970
|
+
const form = formPickElRef.current;
|
|
28971
|
+
if (!wrapper || !form || !dropdownOptionPick) return;
|
|
28972
|
+
suppressNextClickRef.current = true;
|
|
28973
|
+
suppressClickUntilRef.current = Date.now() + 400;
|
|
28974
|
+
const nextIndex = duplicateDropdownOption(wrapper, dropdownOptionPick.index);
|
|
28975
|
+
persistFields(form);
|
|
28976
|
+
setDropdownPreviewOpen(wrapper, true);
|
|
28977
|
+
requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
|
|
28978
|
+
}, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
|
|
28979
|
+
const handleDropdownOptionDelete = (0, import_react26.useCallback)(() => {
|
|
28980
|
+
const wrapper = fieldPickElRef.current;
|
|
28981
|
+
const form = formPickElRef.current;
|
|
28982
|
+
if (!wrapper || !form || !dropdownOptionPick || !dropdownOptionPick.canDelete) return;
|
|
28983
|
+
suppressNextClickRef.current = true;
|
|
28984
|
+
suppressClickUntilRef.current = Date.now() + 400;
|
|
28985
|
+
const nextIndex = removeDropdownOption(wrapper, dropdownOptionPick.index);
|
|
28986
|
+
persistFields(form);
|
|
28987
|
+
setDropdownPreviewOpen(wrapper, true);
|
|
28988
|
+
requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
|
|
28989
|
+
}, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
|
|
28449
28990
|
const handleAddField = (0, import_react26.useCallback)(
|
|
28450
28991
|
(type) => {
|
|
28451
28992
|
const form = formPickElRef.current;
|
|
@@ -28584,21 +29125,6 @@ function OhhwellsBridge() {
|
|
|
28584
29125
|
const [isItemDragging, setIsItemDragging] = (0, import_react26.useState)(false);
|
|
28585
29126
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react26.useState)(false);
|
|
28586
29127
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
28587
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react26.useState)(null);
|
|
28588
|
-
const floatingPanelOpenRef = (0, import_react26.useRef)(false);
|
|
28589
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
28590
|
-
const floatingPanelRef = (0, import_react26.useRef)(null);
|
|
28591
|
-
floatingPanelRef.current = floatingPanel;
|
|
28592
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react26.useState)(null);
|
|
28593
|
-
const buttonCollectionDragRef = (0, import_react26.useRef)(null);
|
|
28594
|
-
const buttonDropInsertIndexRef = (0, import_react26.useRef)(null);
|
|
28595
|
-
const [buttonDropSlots, setButtonDropSlots] = (0, import_react26.useState)([]);
|
|
28596
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react26.useState)(null);
|
|
28597
|
-
const buttonPointerDragRef = (0, import_react26.useRef)(null);
|
|
28598
|
-
const [buttonStyleTick, setButtonStyleTick] = (0, import_react26.useState)(0);
|
|
28599
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react26.useState)(null);
|
|
28600
|
-
const [editorViewport, setEditorViewport] = (0, import_react26.useState)("desktop");
|
|
28601
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react26.useState)(null);
|
|
28602
29128
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react26.useState)(null);
|
|
28603
29129
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react26.useState)(null);
|
|
28604
29130
|
const footerDragRef = (0, import_react26.useRef)(null);
|
|
@@ -28625,6 +29151,21 @@ function OhhwellsBridge() {
|
|
|
28625
29151
|
const stylesRef = (0, import_react26.useRef)("");
|
|
28626
29152
|
const appliedDrawerRef = (0, import_react26.useRef)(null);
|
|
28627
29153
|
const pendingDeleteUndoRef = (0, import_react26.useRef)(null);
|
|
29154
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react26.useState)(null);
|
|
29155
|
+
const floatingPanelOpenRef = (0, import_react26.useRef)(false);
|
|
29156
|
+
const floatingPanelRef = (0, import_react26.useRef)(null);
|
|
29157
|
+
floatingPanelRef.current = floatingPanel;
|
|
29158
|
+
const setFloatingPanelRef = (0, import_react26.useRef)(setFloatingPanel);
|
|
29159
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react26.useState)(null);
|
|
29160
|
+
const buttonCollectionDragRef = (0, import_react26.useRef)(null);
|
|
29161
|
+
const buttonDropInsertIndexRef = (0, import_react26.useRef)(null);
|
|
29162
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react26.useState)([]);
|
|
29163
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react26.useState)(null);
|
|
29164
|
+
const buttonPointerDragRef = (0, import_react26.useRef)(null);
|
|
29165
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react26.useState)(0);
|
|
29166
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react26.useState)(null);
|
|
29167
|
+
const [editorViewport, setEditorViewport] = (0, import_react26.useState)("desktop");
|
|
29168
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react26.useState)(null);
|
|
28628
29169
|
const [sitePages, setSitePages] = (0, import_react26.useState)([]);
|
|
28629
29170
|
const collectionItemsRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
|
|
28630
29171
|
const [sectionsByPath, setSectionsByPath] = (0, import_react26.useState)({});
|
|
@@ -28634,7 +29175,18 @@ function OhhwellsBridge() {
|
|
|
28634
29175
|
const linkPopoverOpenRef = (0, import_react26.useRef)(false);
|
|
28635
29176
|
const linkPopoverGraceUntilRef = (0, import_react26.useRef)(0);
|
|
28636
29177
|
setLinkPopoverRef.current = setLinkPopover;
|
|
29178
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
28637
29179
|
linkPopoverSessionRef.current = linkPopover;
|
|
29180
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
29181
|
+
(0, import_react26.useEffect)(() => {
|
|
29182
|
+
const syncViewport = () => {
|
|
29183
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
29184
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
29185
|
+
};
|
|
29186
|
+
syncViewport();
|
|
29187
|
+
window.addEventListener("resize", syncViewport);
|
|
29188
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
29189
|
+
}, []);
|
|
28638
29190
|
(0, import_react26.useEffect)(() => {
|
|
28639
29191
|
setSectionOrderPersistHandler((entries) => {
|
|
28640
29192
|
const currentPath = window.location.pathname;
|
|
@@ -30377,6 +30929,7 @@ function OhhwellsBridge() {
|
|
|
30377
30929
|
applyAiFooterFromContent(content);
|
|
30378
30930
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
30379
30931
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
30932
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30380
30933
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30381
30934
|
}
|
|
30382
30935
|
applyBrandChrome(content);
|
|
@@ -30387,12 +30940,12 @@ function OhhwellsBridge() {
|
|
|
30387
30940
|
if (key === "__ohw_sections") continue;
|
|
30388
30941
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30389
30942
|
if (key === AI_FOOTER_KEY) continue;
|
|
30943
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30944
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30390
30945
|
if (key === BRAND_KIT_KEY) continue;
|
|
30391
30946
|
if (key === STYLE_STORE_KEY) continue;
|
|
30392
30947
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30393
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30394
30948
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
30395
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30396
30949
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30397
30950
|
continue;
|
|
30398
30951
|
}
|
|
@@ -30562,8 +31115,32 @@ function OhhwellsBridge() {
|
|
|
30562
31115
|
if (!isEditMode) return;
|
|
30563
31116
|
let saveTimer = null;
|
|
30564
31117
|
const onInput = (e) => {
|
|
30565
|
-
const
|
|
30566
|
-
if (!
|
|
31118
|
+
const target = e.target;
|
|
31119
|
+
if (!target) return;
|
|
31120
|
+
const optionIndex = getDropdownOptionIndex(target);
|
|
31121
|
+
if (optionIndex != null) {
|
|
31122
|
+
const wrapper2 = getFieldWrapper(target);
|
|
31123
|
+
if (!wrapper2 || wrapper2 !== fieldPickElRef.current) return;
|
|
31124
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
31125
|
+
const owner2 = wrapper2.closest('[data-ohw-editable="form"]');
|
|
31126
|
+
saveTimer = setTimeout(() => {
|
|
31127
|
+
const form = owner2 ?? formPickElRef.current;
|
|
31128
|
+
if (!form) return;
|
|
31129
|
+
commitDropdownOptionsFromPanel(wrapper2);
|
|
31130
|
+
persistFields(form);
|
|
31131
|
+
const row = listDropdownOptionRows(wrapper2)[optionIndex];
|
|
31132
|
+
if (row) {
|
|
31133
|
+
setDropdownOptionPick({
|
|
31134
|
+
index: optionIndex,
|
|
31135
|
+
rect: row.getBoundingClientRect(),
|
|
31136
|
+
canDelete: listDropdownOptionRows(wrapper2).length > 1
|
|
31137
|
+
});
|
|
31138
|
+
}
|
|
31139
|
+
}, 400);
|
|
31140
|
+
return;
|
|
31141
|
+
}
|
|
31142
|
+
const input = target;
|
|
31143
|
+
if (!("value" in input)) return;
|
|
30567
31144
|
const wrapper = getFieldWrapper(input);
|
|
30568
31145
|
if (!wrapper || wrapper !== fieldPickElRef.current) return;
|
|
30569
31146
|
if (saveTimer) clearTimeout(saveTimer);
|
|
@@ -30627,17 +31204,18 @@ function OhhwellsBridge() {
|
|
|
30627
31204
|
}
|
|
30628
31205
|
applyAiFooterFromContent(content);
|
|
30629
31206
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
31207
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
30630
31208
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
30631
31209
|
}
|
|
30632
31210
|
for (const [key, val] of Object.entries(content)) {
|
|
30633
31211
|
if (key === "__ohw_sections") continue;
|
|
30634
31212
|
if (key === AI_SECTIONS_KEY) continue;
|
|
30635
31213
|
if (key === AI_FOOTER_KEY) continue;
|
|
31214
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
31215
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30636
31216
|
if (key === BRAND_KIT_KEY) continue;
|
|
30637
31217
|
if (key === STYLE_STORE_KEY) continue;
|
|
30638
31218
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
30639
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
30640
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
30641
31219
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
30642
31220
|
continue;
|
|
30643
31221
|
}
|
|
@@ -30909,26 +31487,11 @@ function OhhwellsBridge() {
|
|
|
30909
31487
|
const t2 = setTimeout(measure, 500);
|
|
30910
31488
|
const ro = new ResizeObserver(schedule);
|
|
30911
31489
|
ro.observe(document.body);
|
|
30912
|
-
let lastWidth = window.innerWidth;
|
|
30913
|
-
let resizeTimers = [];
|
|
30914
|
-
const clearResizeTimers = () => {
|
|
30915
|
-
resizeTimers.forEach(clearTimeout);
|
|
30916
|
-
resizeTimers = [];
|
|
30917
|
-
};
|
|
30918
|
-
const handleResize = () => {
|
|
30919
|
-
if (window.innerWidth === lastWidth) return;
|
|
30920
|
-
lastWidth = window.innerWidth;
|
|
30921
|
-
clearResizeTimers();
|
|
30922
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
30923
|
-
};
|
|
30924
|
-
window.addEventListener("resize", handleResize);
|
|
30925
31490
|
return () => {
|
|
30926
31491
|
clearTimeout(t1);
|
|
30927
31492
|
clearTimeout(t2);
|
|
30928
31493
|
if (raf != null) cancelAnimationFrame(raf);
|
|
30929
31494
|
ro.disconnect();
|
|
30930
|
-
clearResizeTimers();
|
|
30931
|
-
window.removeEventListener("resize", handleResize);
|
|
30932
31495
|
};
|
|
30933
31496
|
}, [pathname, isEditMode, postToParent2]);
|
|
30934
31497
|
(0, import_react26.useEffect)(() => {
|
|
@@ -31089,6 +31652,7 @@ function OhhwellsBridge() {
|
|
|
31089
31652
|
field can be picked and hovered from anywhere inside it (OHH-642). */
|
|
31090
31653
|
[data-ohw-editable="form"] [data-ohw-form-field] input,
|
|
31091
31654
|
[data-ohw-editable="form"] [data-ohw-form-field] textarea,
|
|
31655
|
+
[data-ohw-editable="form"] [data-ohw-form-field] select,
|
|
31092
31656
|
[data-ohw-editable="form"] [data-ohw-form-field] label {
|
|
31093
31657
|
pointer-events: auto !important;
|
|
31094
31658
|
cursor: pointer !important;
|
|
@@ -31102,10 +31666,35 @@ function OhhwellsBridge() {
|
|
|
31102
31666
|
max-width: 100% !important;
|
|
31103
31667
|
}
|
|
31104
31668
|
[data-ohw-editable="form"] [data-ohw-form-field] input,
|
|
31105
|
-
[data-ohw-editable="form"] [data-ohw-form-field] textarea
|
|
31669
|
+
[data-ohw-editable="form"] [data-ohw-form-field] textarea,
|
|
31670
|
+
[data-ohw-editable="form"] [data-ohw-form-field] select {
|
|
31106
31671
|
box-sizing: border-box !important;
|
|
31107
31672
|
width: 100% !important;
|
|
31108
31673
|
}
|
|
31674
|
+
/* Dropdown field editor (OHH-919): Closed = select alone; Open = select + panel below.
|
|
31675
|
+
Caret only \u2014 keep the template's own background/border/type on the select. */
|
|
31676
|
+
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-field-type="dropdown"] select {
|
|
31677
|
+
appearance: none !important;
|
|
31678
|
+
-webkit-appearance: none !important;
|
|
31679
|
+
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;
|
|
31680
|
+
background-repeat: no-repeat !important;
|
|
31681
|
+
background-position: right 12px center !important;
|
|
31682
|
+
padding-right: 36px !important;
|
|
31683
|
+
pointer-events: none !important;
|
|
31684
|
+
}
|
|
31685
|
+
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] select {
|
|
31686
|
+
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;
|
|
31687
|
+
}
|
|
31688
|
+
[data-ohw-editable="form"] [data-ohw-form-field] [data-ohw-dropdown-panel] {
|
|
31689
|
+
display: none !important;
|
|
31690
|
+
}
|
|
31691
|
+
[data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] [data-ohw-dropdown-panel] {
|
|
31692
|
+
display: block !important;
|
|
31693
|
+
}
|
|
31694
|
+
[data-ohw-editable="form"] [data-ohw-dropdown-option] {
|
|
31695
|
+
cursor: text !important;
|
|
31696
|
+
outline: none !important;
|
|
31697
|
+
}
|
|
31109
31698
|
/* Somewhere to click the block itself, on every side (OHH-642) \u2014 editor only. */
|
|
31110
31699
|
[data-ohw-editable="form"] {
|
|
31111
31700
|
padding: 18px !important;
|
|
@@ -31113,13 +31702,14 @@ function OhhwellsBridge() {
|
|
|
31113
31702
|
flex-wrap: wrap !important;
|
|
31114
31703
|
align-items: flex-end !important;
|
|
31115
31704
|
}
|
|
31116
|
-
/*
|
|
31117
|
-
flex
|
|
31118
|
-
there and inflates every field to the tallest one's size. */
|
|
31705
|
+
/* Width floor for horizontal rows \u2014 never flex-basis. On a column form
|
|
31706
|
+
'flex-basis: 12rem' becomes HEIGHT and fields grow empty space (OHH-919). */
|
|
31119
31707
|
[data-ohw-editable="form"]:not([data-ai-form]) [data-ohw-form-field] {
|
|
31120
|
-
flex: 1 1
|
|
31708
|
+
flex: 1 1 auto !important;
|
|
31121
31709
|
min-width: min(12rem, 100%) !important;
|
|
31122
31710
|
max-width: 100% !important;
|
|
31711
|
+
height: auto !important;
|
|
31712
|
+
align-self: flex-start !important;
|
|
31123
31713
|
}
|
|
31124
31714
|
/* Placeholder text lives in the value while selected. currentColor inside color-mix
|
|
31125
31715
|
resolves to the *inherited* color, so reverse-print footers washed it out on white
|
|
@@ -31225,6 +31815,13 @@ function OhhwellsBridge() {
|
|
|
31225
31815
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
31226
31816
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
31227
31817
|
if (isInsideLinkEditor(target)) return;
|
|
31818
|
+
if (isInsideFloatingPanel(target)) return;
|
|
31819
|
+
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
31820
|
+
if (target.closest(
|
|
31821
|
+
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
31822
|
+
)) {
|
|
31823
|
+
return;
|
|
31824
|
+
}
|
|
31228
31825
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
31229
31826
|
clearMediaSelectionRef.current();
|
|
31230
31827
|
}
|
|
@@ -31248,8 +31845,6 @@ function OhhwellsBridge() {
|
|
|
31248
31845
|
return;
|
|
31249
31846
|
}
|
|
31250
31847
|
}
|
|
31251
|
-
if (isInsideFloatingPanel(target)) return;
|
|
31252
|
-
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
31253
31848
|
const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
|
|
31254
31849
|
if (collectionItem) {
|
|
31255
31850
|
e.preventDefault();
|
|
@@ -31262,7 +31857,7 @@ function OhhwellsBridge() {
|
|
|
31262
31857
|
return;
|
|
31263
31858
|
}
|
|
31264
31859
|
if (target.closest(
|
|
31265
|
-
'[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
|
|
31860
|
+
'[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"]'
|
|
31266
31861
|
)) {
|
|
31267
31862
|
return;
|
|
31268
31863
|
}
|
|
@@ -31272,8 +31867,29 @@ function OhhwellsBridge() {
|
|
|
31272
31867
|
if (formEl && formKeyOf(formEl) && !onSuccessText && !isCtaButton(target)) {
|
|
31273
31868
|
const fieldEl = getFieldWrapper(target);
|
|
31274
31869
|
if (fieldEl) {
|
|
31870
|
+
const optionIndex = getDropdownOptionIndex(target);
|
|
31871
|
+
if (optionIndex != null && fieldTypeOf(fieldEl) === "dropdown" && isDropdownPreviewOpen(fieldEl)) {
|
|
31872
|
+
e.preventDefault();
|
|
31873
|
+
e.stopPropagation();
|
|
31874
|
+
deactivateRef.current();
|
|
31875
|
+
deselectRef.current();
|
|
31876
|
+
formPickElRef.current = formEl;
|
|
31877
|
+
setFormPickRect(null);
|
|
31878
|
+
if (fieldPickElRef.current !== fieldEl) selectField(fieldEl);
|
|
31879
|
+
setDropdownPreviewOpen(fieldEl, true);
|
|
31880
|
+
setFieldPickState({
|
|
31881
|
+
type: "dropdown",
|
|
31882
|
+
required: isFieldRequired(fieldEl),
|
|
31883
|
+
dropdownOpen: true
|
|
31884
|
+
});
|
|
31885
|
+
refreshDropdownOptionPick(fieldEl, optionIndex);
|
|
31886
|
+
listDropdownOptionRows(fieldEl)[optionIndex]?.focus();
|
|
31887
|
+
return;
|
|
31888
|
+
}
|
|
31275
31889
|
const label = target.closest("label");
|
|
31276
|
-
if (label && fieldPickElRef.current === fieldEl)
|
|
31890
|
+
if (label && fieldPickElRef.current === fieldEl && selectedDropdownOptionIndex(fieldEl) == null) {
|
|
31891
|
+
return;
|
|
31892
|
+
}
|
|
31277
31893
|
e.preventDefault();
|
|
31278
31894
|
e.stopPropagation();
|
|
31279
31895
|
deactivateRef.current();
|
|
@@ -31281,7 +31897,9 @@ function OhhwellsBridge() {
|
|
|
31281
31897
|
formPickElRef.current = formEl;
|
|
31282
31898
|
setFormPickRect(null);
|
|
31283
31899
|
selectField(fieldEl);
|
|
31284
|
-
if (!label
|
|
31900
|
+
if (!label && fieldTypeOf(fieldEl) !== "dropdown") {
|
|
31901
|
+
fieldEl.querySelector("input, textarea")?.focus();
|
|
31902
|
+
}
|
|
31285
31903
|
return;
|
|
31286
31904
|
}
|
|
31287
31905
|
clearFieldPick();
|
|
@@ -31429,9 +32047,13 @@ function OhhwellsBridge() {
|
|
|
31429
32047
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
31430
32048
|
e.preventDefault();
|
|
31431
32049
|
e.stopPropagation();
|
|
31432
|
-
selectIconElementRef.current(editable);
|
|
31433
32050
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
31434
32051
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
32052
|
+
if (aiIcon) {
|
|
32053
|
+
aiSectionApiRef.current?.selectFromElement(editable);
|
|
32054
|
+
} else {
|
|
32055
|
+
selectIconElementRef.current(editable);
|
|
32056
|
+
}
|
|
31435
32057
|
postToParentRef.current({
|
|
31436
32058
|
type: "ow:icon-pick",
|
|
31437
32059
|
key: editable.dataset.ohwKey ?? "",
|
|
@@ -31659,6 +32281,9 @@ function OhhwellsBridge() {
|
|
|
31659
32281
|
setHoveredItemRect(null);
|
|
31660
32282
|
hoveredNavContainerRef.current = null;
|
|
31661
32283
|
setHoveredNavContainerRect(null);
|
|
32284
|
+
siblingHintElRef.current = null;
|
|
32285
|
+
setSiblingHintRect(null);
|
|
32286
|
+
setSiblingHintRects([]);
|
|
31662
32287
|
return;
|
|
31663
32288
|
}
|
|
31664
32289
|
{
|
|
@@ -31781,7 +32406,6 @@ function OhhwellsBridge() {
|
|
|
31781
32406
|
hoveredNavContainerRef.current = null;
|
|
31782
32407
|
setHoveredNavContainerRect(null);
|
|
31783
32408
|
hoveredItemElRef.current = editable;
|
|
31784
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
31785
32409
|
}
|
|
31786
32410
|
}
|
|
31787
32411
|
}
|
|
@@ -32488,7 +33112,11 @@ function OhhwellsBridge() {
|
|
|
32488
33112
|
};
|
|
32489
33113
|
const handleMouseMove = (e) => {
|
|
32490
33114
|
const { clientX, clientY } = e;
|
|
32491
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
33115
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
33116
|
+
dismissImageHover();
|
|
33117
|
+
clearImageHover();
|
|
33118
|
+
return;
|
|
33119
|
+
}
|
|
32492
33120
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
|
|
32493
33121
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
32494
33122
|
formHoverElRef.current = null;
|
|
@@ -32517,7 +33145,12 @@ function OhhwellsBridge() {
|
|
|
32517
33145
|
setHoveredItemRect(null);
|
|
32518
33146
|
hoveredNavContainerRef.current = null;
|
|
32519
33147
|
setHoveredNavContainerRect(null);
|
|
33148
|
+
siblingHintElRef.current = null;
|
|
33149
|
+
setSiblingHintRect(null);
|
|
33150
|
+
setSiblingHintRects([]);
|
|
32520
33151
|
dismissImageHover();
|
|
33152
|
+
clearImageHover();
|
|
33153
|
+
setSectionGap(null);
|
|
32521
33154
|
return;
|
|
32522
33155
|
}
|
|
32523
33156
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -32529,7 +33162,11 @@ function OhhwellsBridge() {
|
|
|
32529
33162
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
32530
33163
|
const { clientX, clientY } = e.data;
|
|
32531
33164
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
32532
|
-
if (pointOwnedByFloatingPanel(clientX, clientY))
|
|
33165
|
+
if (pointOwnedByFloatingPanel(clientX, clientY)) {
|
|
33166
|
+
dismissImageHover();
|
|
33167
|
+
clearImageHover();
|
|
33168
|
+
return;
|
|
33169
|
+
}
|
|
32533
33170
|
if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
|
|
32534
33171
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
32535
33172
|
probeSectionGapAt(clientX, clientY);
|
|
@@ -32909,6 +33546,7 @@ function OhhwellsBridge() {
|
|
|
32909
33546
|
applyAiFooterFromContent(content);
|
|
32910
33547
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
32911
33548
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
33549
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
32912
33550
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
32913
33551
|
}
|
|
32914
33552
|
applyBrandChrome(content);
|
|
@@ -32923,12 +33561,12 @@ function OhhwellsBridge() {
|
|
|
32923
33561
|
}
|
|
32924
33562
|
if (key === AI_SECTIONS_KEY) continue;
|
|
32925
33563
|
if (key === AI_FOOTER_KEY) continue;
|
|
33564
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
33565
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
32926
33566
|
if (key === BRAND_KIT_KEY) continue;
|
|
32927
33567
|
if (key === STYLE_STORE_KEY) continue;
|
|
32928
33568
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
32929
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
32930
33569
|
if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
|
|
32931
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
32932
33570
|
if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
|
|
32933
33571
|
continue;
|
|
32934
33572
|
}
|
|
@@ -33601,6 +34239,12 @@ function OhhwellsBridge() {
|
|
|
33601
34239
|
closeLinkPopoverRef.current();
|
|
33602
34240
|
return;
|
|
33603
34241
|
}
|
|
34242
|
+
if (floatingPanelOpenRef.current) {
|
|
34243
|
+
setFloatingPanelRef.current(null);
|
|
34244
|
+
deselectRef.current();
|
|
34245
|
+
deactivateRef.current();
|
|
34246
|
+
return;
|
|
34247
|
+
}
|
|
33604
34248
|
deselectRef.current();
|
|
33605
34249
|
deactivateRef.current();
|
|
33606
34250
|
clearMediaSelectionRef.current();
|
|
@@ -34430,10 +35074,10 @@ function OhhwellsBridge() {
|
|
|
34430
35074
|
window.removeEventListener("message", handleDuplicateSection);
|
|
34431
35075
|
window.removeEventListener("message", handleDeactivate);
|
|
34432
35076
|
window.removeEventListener("message", handleSelectNav);
|
|
34433
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
34434
35077
|
window.removeEventListener("message", handleToastAction);
|
|
34435
35078
|
window.removeEventListener("message", handleFormCount);
|
|
34436
35079
|
window.removeEventListener("message", handleUiEscape);
|
|
35080
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
34437
35081
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
34438
35082
|
autoSaveTimers.current.clear();
|
|
34439
35083
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -34727,7 +35371,7 @@ function OhhwellsBridge() {
|
|
|
34727
35371
|
postToParent2({
|
|
34728
35372
|
type: "ow:ready",
|
|
34729
35373
|
version: "1",
|
|
34730
|
-
bridgeVersion: "0.1.
|
|
35374
|
+
bridgeVersion: "0.1.179-next.474",
|
|
34731
35375
|
path: pathname,
|
|
34732
35376
|
nodes: collectEditableNodes(editContentRef.current),
|
|
34733
35377
|
sections
|
|
@@ -35711,7 +36355,7 @@ function OhhwellsBridge() {
|
|
|
35711
36355
|
chromeGap: formHoverElRef.current && getFieldWrapper(formHoverElRef.current) ? 8 : 24
|
|
35712
36356
|
}
|
|
35713
36357
|
),
|
|
35714
|
-
fieldPickRect && fieldPickState && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
36358
|
+
fieldPickRect && fieldPickState && !dropdownOptionPick && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
35715
36359
|
ItemInteractionLayer,
|
|
35716
36360
|
{
|
|
35717
36361
|
rect: fieldPickRect,
|
|
@@ -35728,6 +36372,8 @@ function OhhwellsBridge() {
|
|
|
35728
36372
|
{
|
|
35729
36373
|
type: fieldPickState.type,
|
|
35730
36374
|
required: fieldPickState.required,
|
|
36375
|
+
dropdownOpen: fieldPickState.dropdownOpen,
|
|
36376
|
+
onDropdownOpenChange: handleFieldDropdownOpenChange,
|
|
35731
36377
|
onTypeChange: handleFieldTypeChange,
|
|
35732
36378
|
onRequiredToggle: handleFieldRequiredToggle,
|
|
35733
36379
|
onDuplicate: handleFieldDuplicate,
|
|
@@ -35736,6 +36382,25 @@ function OhhwellsBridge() {
|
|
|
35736
36382
|
)
|
|
35737
36383
|
}
|
|
35738
36384
|
),
|
|
36385
|
+
dropdownOptionPick && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
36386
|
+
ItemInteractionLayer,
|
|
36387
|
+
{
|
|
36388
|
+
rect: dropdownOptionPick.rect,
|
|
36389
|
+
state: "active-top",
|
|
36390
|
+
itemDragSurface: false,
|
|
36391
|
+
toolbarAlign: "center",
|
|
36392
|
+
chromeGap: 4,
|
|
36393
|
+
showHandle: false,
|
|
36394
|
+
toolbar: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
36395
|
+
DropdownOptionToolbar,
|
|
36396
|
+
{
|
|
36397
|
+
canDelete: dropdownOptionPick.canDelete,
|
|
36398
|
+
onDuplicate: handleDropdownOptionDuplicate,
|
|
36399
|
+
onDelete: handleDropdownOptionDelete
|
|
36400
|
+
}
|
|
36401
|
+
)
|
|
36402
|
+
}
|
|
36403
|
+
),
|
|
35739
36404
|
fieldDragging ? fieldDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
35740
36405
|
"div",
|
|
35741
36406
|
{
|