@ohhwells/bridge 0.1.112 → 0.1.113-next.292
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 +507 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +506 -176
- package/dist/index.js.map +1 -1
- package/dist/pages.cjs +141 -0
- package/dist/pages.cjs.map +1 -0
- package/dist/pages.d.cts +45 -0
- package/dist/pages.d.ts +45 -0
- package/dist/pages.js +107 -0
- package/dist/pages.js.map +1 -0
- package/dist/styles.css +116 -65
- package/package.json +8 -3
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
DropdownMenuItem: () => DropdownMenuItem,
|
|
47
47
|
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
|
48
48
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
49
|
+
EmptySection: () => EmptySection,
|
|
49
50
|
ItemActionToolbar: () => ItemActionToolbar,
|
|
50
51
|
ItemInteractionLayer: () => ItemInteractionLayer,
|
|
51
52
|
LinkEditorPanel: () => LinkEditorPanel,
|
|
@@ -352,16 +353,17 @@ var LEGACY_BRAND_VAR_NAMES = [
|
|
|
352
353
|
"text-muted",
|
|
353
354
|
"surface",
|
|
354
355
|
"border",
|
|
355
|
-
"on-primary"
|
|
356
|
-
"navbar-background"
|
|
356
|
+
"on-primary"
|
|
357
357
|
].map((role) => `--brand-${role}`);
|
|
358
358
|
var FONT_VARS = {
|
|
359
359
|
heading: ["--font-heading", "--font-display", "--brand-font-heading"],
|
|
360
360
|
body: ["--font-body", "--brand-font-body"]
|
|
361
361
|
};
|
|
362
362
|
var BRAND_FONT_LINK_ID = "ohw-brand-fonts";
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
var CUSTOM_FONT_STYLE_ID = "ohw-brand-custom-fonts";
|
|
364
|
+
var CUSTOM_FONT_FORMATS = /* @__PURE__ */ new Set(["woff2", "woff", "truetype", "opentype"]);
|
|
365
|
+
function brandColorVars(palette) {
|
|
366
|
+
const { dark, primary, accent, light } = palette;
|
|
365
367
|
const mix = (a, aPct, b) => `color-mix(in srgb, ${a} ${aPct}%, ${b})`;
|
|
366
368
|
const surface = mix(light, 95, dark);
|
|
367
369
|
const border = mix(light, 85, dark);
|
|
@@ -384,22 +386,42 @@ function brandColorVars(kit) {
|
|
|
384
386
|
"--brand-border": border,
|
|
385
387
|
// Buttons/bands painted in the primary colour assume it's dark/saturated enough to need
|
|
386
388
|
// light text on top — the same assumption LOGO_IMAGE's light-on-dark navbar mark makes.
|
|
387
|
-
"--brand-on-primary": light
|
|
388
|
-
"--brand-navbar-background": dark
|
|
389
|
+
"--brand-on-primary": light
|
|
389
390
|
};
|
|
390
391
|
}
|
|
392
|
+
function parseCustomFontWeight(raw) {
|
|
393
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
394
|
+
const w = raw;
|
|
395
|
+
if (typeof w.weight !== "number" || !Number.isFinite(w.weight)) return null;
|
|
396
|
+
if (typeof w.url !== "string" || !w.url) return null;
|
|
397
|
+
if (typeof w.format !== "string" || !CUSTOM_FONT_FORMATS.has(w.format)) return null;
|
|
398
|
+
const weightEnd = typeof w.weightEnd === "number" && Number.isFinite(w.weightEnd) && w.weightEnd > w.weight ? w.weightEnd : void 0;
|
|
399
|
+
return { weight: w.weight, ...weightEnd !== void 0 ? { weightEnd } : {}, url: w.url, format: w.format };
|
|
400
|
+
}
|
|
401
|
+
function parseCustomFont(raw) {
|
|
402
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
403
|
+
const f = raw;
|
|
404
|
+
if (typeof f.family !== "string" || !f.family) return null;
|
|
405
|
+
if (typeof f.label !== "string" || !f.label) return null;
|
|
406
|
+
if (!Array.isArray(f.weights)) return null;
|
|
407
|
+
const weights = f.weights.map(parseCustomFontWeight).filter((w) => w !== null);
|
|
408
|
+
if (weights.length === 0) return null;
|
|
409
|
+
return { family: f.family, label: f.label, weights };
|
|
410
|
+
}
|
|
391
411
|
function parseBrandKit(raw) {
|
|
392
412
|
if (!raw) return null;
|
|
393
413
|
try {
|
|
394
414
|
const parsed = JSON.parse(raw);
|
|
395
415
|
const p = parsed?.palette;
|
|
396
416
|
const f = parsed?.fonts;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
417
|
+
const palette = p && typeof p.dark === "string" && typeof p.primary === "string" && typeof p.accent === "string" && typeof p.light === "string" ? { dark: p.dark, primary: p.primary, accent: p.accent, light: p.light } : void 0;
|
|
418
|
+
const fonts = f && typeof f.heading === "string" && typeof f.body === "string" ? { heading: f.heading, body: f.body } : void 0;
|
|
419
|
+
const customFonts = Array.isArray(parsed?.customFonts) ? parsed.customFonts.map(parseCustomFont).filter((c) => c !== null) : void 0;
|
|
420
|
+
if (!palette && !fonts && !customFonts) return null;
|
|
400
421
|
return {
|
|
401
|
-
palette
|
|
402
|
-
fonts
|
|
422
|
+
...palette ? { palette } : {},
|
|
423
|
+
...fonts ? { fonts } : {},
|
|
424
|
+
...customFonts ? { customFonts } : {}
|
|
403
425
|
};
|
|
404
426
|
} catch {
|
|
405
427
|
return null;
|
|
@@ -409,11 +431,16 @@ function familyOf(stack) {
|
|
|
409
431
|
const first = stack.split(",")[0]?.trim() ?? "";
|
|
410
432
|
return first.replace(/^['"]|['"]$/g, "");
|
|
411
433
|
}
|
|
434
|
+
function quoteFamily(family) {
|
|
435
|
+
return `'${family.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
436
|
+
}
|
|
437
|
+
var WEIGHT_SCALE = [100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
412
438
|
function loadBrandFonts(families) {
|
|
413
439
|
const unique = [...new Set(families.map((f) => f.trim()).filter(Boolean))];
|
|
414
440
|
if (unique.length === 0) return;
|
|
415
|
-
const
|
|
416
|
-
const
|
|
441
|
+
const weights = WEIGHT_SCALE.join(";");
|
|
442
|
+
const spec = unique.map((f) => `family=${f.replace(/ /g, "+")}:wght@${weights}`).join("&");
|
|
443
|
+
const href = `https://fonts.googleapis.com/css2?${spec}&display=swap`;
|
|
417
444
|
let link = document.getElementById(BRAND_FONT_LINK_ID);
|
|
418
445
|
if (!link) {
|
|
419
446
|
link = document.createElement("link");
|
|
@@ -423,18 +450,54 @@ function loadBrandFonts(families) {
|
|
|
423
450
|
}
|
|
424
451
|
if (link.href !== href) link.href = href;
|
|
425
452
|
}
|
|
453
|
+
function escapeCssString(value) {
|
|
454
|
+
return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
455
|
+
}
|
|
456
|
+
function loadCustomFonts(fonts) {
|
|
457
|
+
const list = fonts ?? [];
|
|
458
|
+
let style = document.getElementById(CUSTOM_FONT_STYLE_ID);
|
|
459
|
+
if (list.length === 0) {
|
|
460
|
+
style?.remove();
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (!style) {
|
|
464
|
+
style = document.createElement("style");
|
|
465
|
+
style.id = CUSTOM_FONT_STYLE_ID;
|
|
466
|
+
document.head.appendChild(style);
|
|
467
|
+
}
|
|
468
|
+
style.textContent = list.flatMap(
|
|
469
|
+
(font) => font.weights.map((w) => {
|
|
470
|
+
const weightDescriptor = w.weightEnd ? `${w.weight} ${w.weightEnd}` : `${w.weight}`;
|
|
471
|
+
return `@font-face { font-family: '${escapeCssString(font.family)}'; src: url('${escapeCssString(w.url)}') format('${w.format}'); font-weight: ${weightDescriptor}; font-display: swap; }`;
|
|
472
|
+
})
|
|
473
|
+
).join("\n");
|
|
474
|
+
}
|
|
426
475
|
function applyBrandToDom(kit) {
|
|
427
476
|
const root = document.documentElement;
|
|
428
477
|
if (!kit) {
|
|
429
478
|
for (const name of [...BRAND_VAR_NAMES, ...LEGACY_BRAND_VAR_NAMES]) root.style.removeProperty(name);
|
|
430
479
|
for (const name of [...FONT_VARS.heading, ...FONT_VARS.body]) root.style.removeProperty(name);
|
|
431
480
|
document.getElementById(BRAND_FONT_LINK_ID)?.remove();
|
|
481
|
+
document.getElementById(CUSTOM_FONT_STYLE_ID)?.remove();
|
|
432
482
|
return;
|
|
433
483
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
484
|
+
if (kit.palette) {
|
|
485
|
+
for (const [name, value] of Object.entries(brandColorVars(kit.palette))) root.style.setProperty(name, value);
|
|
486
|
+
}
|
|
487
|
+
if (kit.customFonts) {
|
|
488
|
+
loadCustomFonts(kit.customFonts);
|
|
489
|
+
}
|
|
490
|
+
if (kit.fonts) {
|
|
491
|
+
const heading = quoteFamily(kit.fonts.heading);
|
|
492
|
+
const body = quoteFamily(kit.fonts.body);
|
|
493
|
+
for (const name of FONT_VARS.heading) root.style.setProperty(name, heading);
|
|
494
|
+
for (const name of FONT_VARS.body) root.style.setProperty(name, body);
|
|
495
|
+
const customFamilies = new Set((kit.customFonts ?? []).map((f) => f.family));
|
|
496
|
+
const googleFamilies = [familyOf(kit.fonts.heading), familyOf(kit.fonts.body)].filter(
|
|
497
|
+
(f) => !customFamilies.has(f)
|
|
498
|
+
);
|
|
499
|
+
loadBrandFonts(googleFamilies);
|
|
500
|
+
}
|
|
438
501
|
}
|
|
439
502
|
|
|
440
503
|
// src/lib/section-styles.ts
|
|
@@ -459,6 +522,20 @@ var BG_VALUES = {
|
|
|
459
522
|
accent: "var(--ohw-brand-primary, var(--color-primary, #0078E5))",
|
|
460
523
|
"accent-soft": "color-mix(in srgb, var(--ohw-brand-primary, var(--color-primary, #0078E5)) 12%, var(--ohw-brand-light, var(--color-light, #FFFFFF)))"
|
|
461
524
|
};
|
|
525
|
+
var NAVBAR_COLOR_TOKENS = ["dark", "primary", "accent", "light"];
|
|
526
|
+
function navbarColorVar(token) {
|
|
527
|
+
const fallback = {
|
|
528
|
+
dark: "#0C0A09",
|
|
529
|
+
primary: "#0078E5",
|
|
530
|
+
accent: "#0078E5",
|
|
531
|
+
light: "#FFFFFF"
|
|
532
|
+
};
|
|
533
|
+
return `var(--ohw-brand-${token}, var(--color-${token}, ${fallback[token]}))`;
|
|
534
|
+
}
|
|
535
|
+
function resolveNavbarValue(value) {
|
|
536
|
+
if (value === void 0) return void 0;
|
|
537
|
+
return NAVBAR_COLOR_TOKENS.includes(value) ? navbarColorVar(value) : value;
|
|
538
|
+
}
|
|
462
539
|
var HEADLINE_SIZES = { md: 24, lg: 32, xl: 40, display: 56 };
|
|
463
540
|
function styleSheetCss() {
|
|
464
541
|
const rules = [];
|
|
@@ -628,8 +705,16 @@ function applyStylesToDom(store) {
|
|
|
628
705
|
for (const [sectionId, override] of Object.entries(store.sections)) {
|
|
629
706
|
const escaped = CSS.escape(sectionId);
|
|
630
707
|
const byInstance = document.querySelectorAll(`[data-ohw-instance="${escaped}"]`);
|
|
631
|
-
const sections =
|
|
708
|
+
const sections = Array.from(
|
|
709
|
+
byInstance.length ? byInstance : document.querySelectorAll(`[data-ohw-section="${escaped}"]`)
|
|
710
|
+
);
|
|
711
|
+
const isNavbar = sectionId === "navbar";
|
|
712
|
+
if (isNavbar) {
|
|
713
|
+
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
714
|
+
if (drawer && !sections.includes(drawer)) sections.push(drawer);
|
|
715
|
+
}
|
|
632
716
|
for (const marker of Array.from(sections)) {
|
|
717
|
+
const isDrawerMarker = isNavbar && marker.hasAttribute("data-ohw-nav-drawer");
|
|
633
718
|
const section = marker.querySelector(":scope > [data-ai-section]") ?? marker;
|
|
634
719
|
for (const [prop, attr] of Object.entries(SECTION_ATTRS)) {
|
|
635
720
|
const value = override[prop];
|
|
@@ -637,19 +722,23 @@ function applyStylesToDom(store) {
|
|
|
637
722
|
if (prop === "sectionBackground" && override.sectionBackgroundColor !== void 0) continue;
|
|
638
723
|
section.setAttribute(attr, String(value).replace(":", "-"));
|
|
639
724
|
}
|
|
640
|
-
|
|
725
|
+
const bgOverride = isDrawerMarker ? override.navbarMobileBackground ?? override.sectionBackgroundColor : override.sectionBackgroundColor;
|
|
726
|
+
const textOverride = isDrawerMarker ? override.navbarMobileTextColor ?? override.textColor : override.textColor;
|
|
727
|
+
const bgValue = isNavbar ? resolveNavbarValue(bgOverride) : bgOverride;
|
|
728
|
+
const textValue = isNavbar ? resolveNavbarValue(textOverride) : textOverride;
|
|
729
|
+
if (bgValue !== void 0) {
|
|
641
730
|
saveInline(section, "background");
|
|
642
|
-
section.style.setProperty("background",
|
|
731
|
+
section.style.setProperty("background", bgValue, "important");
|
|
643
732
|
section.setAttribute("data-ohw-style-bgcolor", "");
|
|
644
733
|
}
|
|
645
|
-
if (
|
|
734
|
+
if (textValue !== void 0 || override.fontFamily !== void 0) {
|
|
646
735
|
const textEls = marker.querySelectorAll(
|
|
647
736
|
'[data-ohw-editable="text"], [data-ohw-editable="plain"], [data-ohw-field-label]'
|
|
648
737
|
);
|
|
649
738
|
for (const el of Array.from(textEls)) {
|
|
650
|
-
if (
|
|
739
|
+
if (textValue !== void 0) {
|
|
651
740
|
saveInline(el, "color");
|
|
652
|
-
el.style.setProperty("color",
|
|
741
|
+
el.style.setProperty("color", textValue, "important");
|
|
653
742
|
el.setAttribute(NODE_WROTE_ATTR, "");
|
|
654
743
|
}
|
|
655
744
|
if (override.fontFamily !== void 0) {
|
|
@@ -1355,6 +1444,22 @@ function accentBandContext(brand) {
|
|
|
1355
1444
|
function textAttrs(ctx, path) {
|
|
1356
1445
|
return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
|
|
1357
1446
|
}
|
|
1447
|
+
var AI_RESPONSIVE_CSS = [
|
|
1448
|
+
"@media (max-width: 960px) {",
|
|
1449
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
|
|
1450
|
+
' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
|
|
1451
|
+
"}",
|
|
1452
|
+
"@media (max-width: 640px) {",
|
|
1453
|
+
" [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
|
|
1454
|
+
" [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
|
|
1455
|
+
// Group containers flatten to a column on phones; span placements come along for free.
|
|
1456
|
+
" [data-ai-responsive] [data-ai-group] { display: flex !important; flex-direction: column !important; }",
|
|
1457
|
+
" [data-ai-responsive] [data-ai-group] > * { grid-column: auto !important; }",
|
|
1458
|
+
" [data-ai-responsive] [data-ai-section-inner] { padding-left: 20px !important; padding-right: 20px !important; }",
|
|
1459
|
+
" [data-ai-responsive] { overflow-x: hidden; }",
|
|
1460
|
+
" [data-ai-responsive] img { max-width: 100%; }",
|
|
1461
|
+
"}"
|
|
1462
|
+
].join("\n");
|
|
1358
1463
|
var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
1359
1464
|
function MediaBox({
|
|
1360
1465
|
refValue,
|
|
@@ -1367,13 +1472,17 @@ function MediaBox({
|
|
|
1367
1472
|
const url = refValue ? ctx.resolveMedia(refValue) : null;
|
|
1368
1473
|
const isIcon = /^(lucide|simple):/.test(refValue);
|
|
1369
1474
|
const aspectRatio = aspect && /^\d+:\d+$/.test(aspect) ? aspect.replace(":", " / ") : void 0;
|
|
1370
|
-
const editAttrs = ctx.keyFor && editPath
|
|
1475
|
+
const editAttrs = ctx.keyFor && editPath ? {
|
|
1476
|
+
"data-ohw-key": ctx.keyFor(editPath),
|
|
1477
|
+
"data-ohw-editable": isIcon ? "icon" : "image"
|
|
1478
|
+
} : {};
|
|
1371
1479
|
if (isIcon) {
|
|
1372
1480
|
const Icon = refValue.startsWith("lucide:") ? lucideByName(refValue.slice(7)) : null;
|
|
1373
1481
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1374
1482
|
"span",
|
|
1375
1483
|
{
|
|
1376
1484
|
"data-ai-icon": refValue,
|
|
1485
|
+
...editAttrs,
|
|
1377
1486
|
style: {
|
|
1378
1487
|
display: "inline-flex",
|
|
1379
1488
|
width: 48,
|
|
@@ -2266,7 +2375,7 @@ function CollectionBlock({ node, ctx, path }) {
|
|
|
2266
2375
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2267
2376
|
"div",
|
|
2268
2377
|
{
|
|
2269
|
-
"data-ai-grid":
|
|
2378
|
+
"data-ai-grid": String(itemsPerRow),
|
|
2270
2379
|
style: {
|
|
2271
2380
|
display: "grid",
|
|
2272
2381
|
gridTemplateColumns: `repeat(${itemsPerRow}, 1fr)`,
|
|
@@ -2619,6 +2728,7 @@ function AiTreeRenderer({
|
|
|
2619
2728
|
{
|
|
2620
2729
|
"data-ai-section": tree.tag ?? "",
|
|
2621
2730
|
...bgAttrs,
|
|
2731
|
+
"data-ai-responsive": "",
|
|
2622
2732
|
style: {
|
|
2623
2733
|
position: "relative",
|
|
2624
2734
|
padding: `${pad}px 0`,
|
|
@@ -2629,12 +2739,13 @@ function AiTreeRenderer({
|
|
|
2629
2739
|
color: settings.sectionBackground === "accent" ? blockBrand.palette.dark : void 0
|
|
2630
2740
|
},
|
|
2631
2741
|
children: [
|
|
2632
|
-
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
|
|
2633
2743
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
|
|
2744
|
+
isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
|
|
2634
2745
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2635
2746
|
"div",
|
|
2636
2747
|
{
|
|
2637
|
-
"data-ai-
|
|
2748
|
+
"data-ai-section-inner": "",
|
|
2638
2749
|
style: {
|
|
2639
2750
|
position: "relative",
|
|
2640
2751
|
maxWidth: AI_TREE_TOKENS.sectionMaxWidth,
|
|
@@ -2645,7 +2756,7 @@ function AiTreeRenderer({
|
|
|
2645
2756
|
children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2646
2757
|
"div",
|
|
2647
2758
|
{
|
|
2648
|
-
"data-ai-
|
|
2759
|
+
"data-ai-columns": "",
|
|
2649
2760
|
style: {
|
|
2650
2761
|
display: "grid",
|
|
2651
2762
|
gridTemplateColumns: "repeat(12, 1fr)",
|
|
@@ -2695,14 +2806,52 @@ function readRootVar(name) {
|
|
|
2695
2806
|
if (typeof document === "undefined") return "";
|
|
2696
2807
|
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
2697
2808
|
}
|
|
2809
|
+
function normalizeColorToHex(value) {
|
|
2810
|
+
if (!value || typeof document === "undefined") return value;
|
|
2811
|
+
const canvas = document.createElement("canvas");
|
|
2812
|
+
canvas.width = 1;
|
|
2813
|
+
canvas.height = 1;
|
|
2814
|
+
const ctx = canvas.getContext("2d");
|
|
2815
|
+
if (!ctx) return value;
|
|
2816
|
+
ctx.fillStyle = value;
|
|
2817
|
+
ctx.fillRect(0, 0, 1, 1);
|
|
2818
|
+
const [r2, g, b] = ctx.getImageData(0, 0, 1, 1).data;
|
|
2819
|
+
const toHex = (n) => n.toString(16).padStart(2, "0");
|
|
2820
|
+
return `#${toHex(r2)}${toHex(g)}${toHex(b)}`;
|
|
2821
|
+
}
|
|
2822
|
+
var GENERIC_FONT_KEYWORDS = /* @__PURE__ */ new Set([
|
|
2823
|
+
"serif",
|
|
2824
|
+
"sans-serif",
|
|
2825
|
+
"monospace",
|
|
2826
|
+
"cursive",
|
|
2827
|
+
"fantasy",
|
|
2828
|
+
"system-ui",
|
|
2829
|
+
"ui-serif",
|
|
2830
|
+
"ui-sans-serif",
|
|
2831
|
+
"ui-monospace",
|
|
2832
|
+
"ui-rounded",
|
|
2833
|
+
"math",
|
|
2834
|
+
"emoji",
|
|
2835
|
+
"fangsong"
|
|
2836
|
+
]);
|
|
2837
|
+
function primaryFontFamily(stack) {
|
|
2838
|
+
const first = stack.split(",").map((part) => part.trim().replace(/^["']|["']$/g, "")).find((part) => part && !GENERIC_FONT_KEYWORDS.has(part.toLowerCase()));
|
|
2839
|
+
return first ?? "";
|
|
2840
|
+
}
|
|
2841
|
+
function humanizeFontFamily(name) {
|
|
2842
|
+
return name.replace(/^__/, "").replace(/_[0-9a-f]{6}$/i, "").replace(/_/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().replace(/\s+/g, " ").replace(/(^|\s)([a-z])/g, (_, sep, c) => sep + c.toUpperCase());
|
|
2843
|
+
}
|
|
2844
|
+
function readFontVar(name) {
|
|
2845
|
+
return humanizeFontFamily(primaryFontFamily(readRootVar(name)));
|
|
2846
|
+
}
|
|
2698
2847
|
function deriveBrandOverride() {
|
|
2699
2848
|
const dark = readRootVar("--ohw-brand-dark");
|
|
2700
2849
|
const primary = readRootVar("--ohw-brand-primary");
|
|
2701
2850
|
const light = readRootVar("--ohw-brand-light");
|
|
2702
2851
|
if (!dark || !primary || !light) return null;
|
|
2703
2852
|
const accent = readRootVar("--ohw-brand-accent");
|
|
2704
|
-
const heading =
|
|
2705
|
-
const body =
|
|
2853
|
+
const heading = readFontVar("--font-heading") || readFontVar("--font-display");
|
|
2854
|
+
const body = readFontVar("--font-body");
|
|
2706
2855
|
return {
|
|
2707
2856
|
palette: { dark, primary, accent: accent || dark, light },
|
|
2708
2857
|
fonts: {
|
|
@@ -2711,22 +2860,55 @@ function deriveBrandOverride() {
|
|
|
2711
2860
|
}
|
|
2712
2861
|
};
|
|
2713
2862
|
}
|
|
2714
|
-
function
|
|
2863
|
+
function deriveTemplateBrandLive() {
|
|
2715
2864
|
const primary = readRootVar("--brand-primary") || readRootVar("--color-primary");
|
|
2716
2865
|
const dark = readRootVar("--brand-text") || readRootVar("--color-dark");
|
|
2717
2866
|
const light = readRootVar("--brand-background") || readRootVar("--color-light");
|
|
2718
2867
|
if (!dark || !primary || !light) return null;
|
|
2719
2868
|
const accent = readRootVar("--brand-accent") || readRootVar("--color-accent");
|
|
2720
|
-
const heading =
|
|
2721
|
-
const body =
|
|
2869
|
+
const heading = readFontVar("--brand-font-heading") || readFontVar("--font-heading") || readFontVar("--font-display");
|
|
2870
|
+
const body = readFontVar("--brand-font-body") || readFontVar("--font-body");
|
|
2722
2871
|
return {
|
|
2723
|
-
palette: {
|
|
2872
|
+
palette: {
|
|
2873
|
+
dark: normalizeColorToHex(dark),
|
|
2874
|
+
primary: normalizeColorToHex(primary),
|
|
2875
|
+
accent: normalizeColorToHex(accent || dark),
|
|
2876
|
+
light: normalizeColorToHex(light)
|
|
2877
|
+
},
|
|
2724
2878
|
fonts: {
|
|
2725
2879
|
heading: heading || AI_DEFAULT_BRAND.fonts.heading,
|
|
2726
2880
|
body: body || AI_DEFAULT_BRAND.fonts.body
|
|
2727
2881
|
}
|
|
2728
2882
|
};
|
|
2729
2883
|
}
|
|
2884
|
+
function deriveTemplateFontsLive() {
|
|
2885
|
+
const heading = readFontVar("--brand-font-heading") || readFontVar("--font-heading") || readFontVar("--font-display");
|
|
2886
|
+
const body = readFontVar("--brand-font-body") || readFontVar("--font-body");
|
|
2887
|
+
if (!heading && !body) return null;
|
|
2888
|
+
return {
|
|
2889
|
+
heading: heading || AI_DEFAULT_BRAND.fonts.heading,
|
|
2890
|
+
body: body || AI_DEFAULT_BRAND.fonts.body
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
var OVERRIDE_VAR_NAMES = [...BRAND_VAR_NAMES, ...LEGACY_BRAND_VAR_NAMES, ...FONT_VARS.heading, ...FONT_VARS.body];
|
|
2894
|
+
function withOverrideStripped(read) {
|
|
2895
|
+
const root = document.documentElement;
|
|
2896
|
+
const restore = OVERRIDE_VAR_NAMES.map((name) => [name, root.style.getPropertyValue(name)]);
|
|
2897
|
+
for (const name of OVERRIDE_VAR_NAMES) root.style.removeProperty(name);
|
|
2898
|
+
try {
|
|
2899
|
+
return read();
|
|
2900
|
+
} finally {
|
|
2901
|
+
for (const [name, value] of restore) if (value) root.style.setProperty(name, value);
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
var TEMPLATE_BRAND_SNAPSHOT = typeof document === "undefined" ? null : withOverrideStripped(deriveTemplateBrandLive);
|
|
2905
|
+
var TEMPLATE_FONTS_SNAPSHOT = typeof document === "undefined" ? null : withOverrideStripped(deriveTemplateFontsLive);
|
|
2906
|
+
function deriveTemplateBrand() {
|
|
2907
|
+
return TEMPLATE_BRAND_SNAPSHOT;
|
|
2908
|
+
}
|
|
2909
|
+
function deriveTemplateFonts() {
|
|
2910
|
+
return TEMPLATE_FONTS_SNAPSHOT;
|
|
2911
|
+
}
|
|
2730
2912
|
function deriveTemplateButtonStyle() {
|
|
2731
2913
|
if (typeof document === "undefined") return null;
|
|
2732
2914
|
const candidates = Array.from(
|
|
@@ -7224,12 +7406,12 @@ var cva = (base, config) => (props) => {
|
|
|
7224
7406
|
var import_radix_ui2 = require("radix-ui");
|
|
7225
7407
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
7226
7408
|
var toggleVariants = cva(
|
|
7227
|
-
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
7409
|
+
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-bridge-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
7228
7410
|
{
|
|
7229
7411
|
variants: {
|
|
7230
7412
|
variant: {
|
|
7231
7413
|
default: "bg-transparent border-0",
|
|
7232
|
-
outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
|
|
7414
|
+
outline: "border border-input bg-transparent shadow-xs hover:bg-bridge-accent hover:text-accent-foreground"
|
|
7233
7415
|
},
|
|
7234
7416
|
size: {
|
|
7235
7417
|
default: "px-2 py-1",
|
|
@@ -7322,10 +7504,10 @@ var DragHandle = React4.forwardRef(
|
|
|
7322
7504
|
type,
|
|
7323
7505
|
"data-slot": "drag-handle",
|
|
7324
7506
|
className: cn(
|
|
7325
|
-
"inline-flex h-7 w-4 shrink-0 items-center justify-center rounded-md transition-all duration-200 max-h-
|
|
7507
|
+
"inline-flex h-7 w-4 shrink-0 items-center justify-center rounded-md transition-all duration-200 max-h-7.5",
|
|
7326
7508
|
"bg-white border border-transparent text-stone-500 shadow-md cursor-grab",
|
|
7327
7509
|
"enabled:hover:border enabled:hover:border-stone-200 enabled:hover:text-stone-950",
|
|
7328
|
-
"enabled:active:border enabled:active:border-primary enabled:active:bg-primary-50 enabled:active:text-stone-950 enabled:active:shadow enabled:active:cursor-grabbing",
|
|
7510
|
+
"enabled:active:border enabled:active:border-bridge-primary enabled:active:bg-primary-50 enabled:active:text-stone-950 enabled:active:shadow enabled:active:cursor-grabbing",
|
|
7329
7511
|
"disabled:cursor-not-allowed disabled:opacity-40 disabled:text-stone-950 disabled:pointer-events-none",
|
|
7330
7512
|
className
|
|
7331
7513
|
),
|
|
@@ -7347,7 +7529,7 @@ var CustomToolbar = React5.forwardRef(({ className, onMouseDown, ...props }, ref
|
|
|
7347
7529
|
"data-ohw-toolbar": "",
|
|
7348
7530
|
className: cn(
|
|
7349
7531
|
// Figma: bg background, radius 8, gap-1, p-0.5, shadow-md — no border
|
|
7350
|
-
"inline-flex h-8 items-center gap-1 rounded-
|
|
7532
|
+
"inline-flex h-8 items-center gap-1 rounded-(--radius,0.5rem) bg-background p-0.5 font-sans whitespace-nowrap shadow-md",
|
|
7351
7533
|
className
|
|
7352
7534
|
),
|
|
7353
7535
|
onMouseDown: (e) => {
|
|
@@ -7376,7 +7558,7 @@ var CustomToolbarButton = React5.forwardRef(
|
|
|
7376
7558
|
type,
|
|
7377
7559
|
className: cn(
|
|
7378
7560
|
"inline-flex size-7 shrink-0 items-center justify-center rounded-[calc(var(--radius,0.5rem)-2px)] text-foreground transition-colors",
|
|
7379
|
-
active ? "bg-primary text-primary-foreground" : "bg-transparent hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-60",
|
|
7561
|
+
active ? "bg-bridge-primary text-primary-foreground" : "bg-transparent hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-60",
|
|
7380
7562
|
className
|
|
7381
7563
|
),
|
|
7382
7564
|
...props
|
|
@@ -8640,13 +8822,13 @@ function FormFieldToolbar({
|
|
|
8640
8822
|
]
|
|
8641
8823
|
}
|
|
8642
8824
|
) }),
|
|
8643
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-
|
|
8825
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-47.5 p-1", children: FIELD_TYPES.map((entry) => {
|
|
8644
8826
|
const Icon = TYPE_ICONS[entry.type];
|
|
8645
8827
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
8646
8828
|
DropdownMenuItem,
|
|
8647
8829
|
{
|
|
8648
8830
|
onSelect: () => onTypeChange(entry.type),
|
|
8649
|
-
className: "rounded-md py-2 text-[13px] " + (entry.type === type ? "bg-primary/10" : ""),
|
|
8831
|
+
className: "rounded-md py-2 text-[13px] " + (entry.type === type ? "bg-bridge-primary/10" : ""),
|
|
8650
8832
|
children: [
|
|
8651
8833
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
|
|
8652
8834
|
entry.label
|
|
@@ -8663,7 +8845,7 @@ function FormFieldToolbar({
|
|
|
8663
8845
|
type: "button",
|
|
8664
8846
|
"aria-pressed": required,
|
|
8665
8847
|
onClick: onRequiredToggle,
|
|
8666
|
-
className: "flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[13px] font-medium transition-colors " + (required ? "bg-primary/10 text-primary" : "text-foreground hover:bg-muted/70"),
|
|
8848
|
+
className: "flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[13px] font-medium transition-colors " + (required ? "bg-bridge-primary/10 text-bridge-primary" : "text-foreground hover:bg-muted/70"),
|
|
8667
8849
|
"data-ohw-field-required-toggle": "",
|
|
8668
8850
|
children: [
|
|
8669
8851
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Asterisk, { size: 14, strokeWidth: 2, "aria-hidden": true }),
|
|
@@ -8683,7 +8865,7 @@ function FormFieldToolbar({
|
|
|
8683
8865
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.MoreHorizontal, { size: 15, "aria-hidden": true })
|
|
8684
8866
|
}
|
|
8685
8867
|
) }),
|
|
8686
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-
|
|
8868
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-42.5 p-1", children: [
|
|
8687
8869
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuItem, { onSelect: onDuplicate, className: "rounded-md py-2 text-[13px]", children: [
|
|
8688
8870
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Copy, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
|
|
8689
8871
|
"Duplicate"
|
|
@@ -8711,7 +8893,7 @@ function FieldTypePicker({ onPick }) {
|
|
|
8711
8893
|
{
|
|
8712
8894
|
type: "button",
|
|
8713
8895
|
onClick: () => onPick(entry.type),
|
|
8714
|
-
className: "flex h-[76px] flex-col items-center justify-center gap-2 rounded-xl border border-border text-[15px] font-medium text-foreground transition-colors hover:border-primary hover:bg-primary/5",
|
|
8896
|
+
className: "flex h-[76px] flex-col items-center justify-center gap-2 rounded-xl border border-border text-[15px] font-medium text-foreground transition-colors hover:border-bridge-primary hover:bg-bridge-primary/5",
|
|
8715
8897
|
children: [
|
|
8716
8898
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { size: 26, strokeWidth: 1.5, "aria-hidden": true }),
|
|
8717
8899
|
entry.label
|
|
@@ -8737,7 +8919,7 @@ var buttonVariants = cva(
|
|
|
8737
8919
|
{
|
|
8738
8920
|
variants: {
|
|
8739
8921
|
variant: {
|
|
8740
|
-
default: "bg-primary text-primary-foreground hover:opacity-90",
|
|
8922
|
+
default: "bg-bridge-primary text-primary-foreground hover:opacity-90",
|
|
8741
8923
|
outline: "border border-border bg-background text-foreground shadow-sm hover:bg-muted/80",
|
|
8742
8924
|
ghost: "min-w-0 px-3 py-2 text-foreground hover:bg-muted/50"
|
|
8743
8925
|
},
|
|
@@ -8832,6 +9014,7 @@ function MediaOverlay({
|
|
|
8832
9014
|
(prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
|
|
8833
9015
|
);
|
|
8834
9016
|
}, [isVideo]);
|
|
9017
|
+
const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
|
|
8835
9018
|
const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
|
|
8836
9019
|
const box = {
|
|
8837
9020
|
position: "fixed",
|
|
@@ -8937,8 +9120,8 @@ function MediaOverlay({
|
|
|
8937
9120
|
pointerEvents: hover.hasTextOverlap ? "none" : "auto",
|
|
8938
9121
|
// Selected: a firm component ring with no wash, so the image reads as chosen rather
|
|
8939
9122
|
// than hovered. Hover keeps the existing tinted preview.
|
|
8940
|
-
boxShadow: selected ? "inset 0 0 0 2px var(--color-primary)" : "inset 0 0 0 1.5px var(--color-primary)",
|
|
8941
|
-
background: selected ? "transparent" : "color-mix(in srgb, var(--color-primary) 20%, transparent)"
|
|
9123
|
+
boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
9124
|
+
background: selected ? "transparent" : "color-mix(in srgb, var(--color-bridge-primary) 20%, transparent)"
|
|
8942
9125
|
},
|
|
8943
9126
|
onClick: () => onSelect && !selected ? onSelect(hover.key) : onReplace(hover.key),
|
|
8944
9127
|
children: [
|
|
@@ -8961,17 +9144,17 @@ function MediaOverlay({
|
|
|
8961
9144
|
},
|
|
8962
9145
|
children: [
|
|
8963
9146
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
8964
|
-
|
|
9147
|
+
replaceLabel
|
|
8965
9148
|
]
|
|
8966
9149
|
}
|
|
8967
9150
|
),
|
|
8968
|
-
replaceMode
|
|
9151
|
+
showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
8969
9152
|
Button,
|
|
8970
9153
|
{
|
|
8971
9154
|
"data-ohw-media-overlay": "",
|
|
8972
9155
|
variant: "outline",
|
|
8973
9156
|
size: "sm",
|
|
8974
|
-
"aria-label":
|
|
9157
|
+
"aria-label": replaceLabel,
|
|
8975
9158
|
className: "gap-1.5 cursor-pointer hover:bg-background",
|
|
8976
9159
|
style: {
|
|
8977
9160
|
...OVERLAY_BUTTON_STYLE,
|
|
@@ -8994,7 +9177,7 @@ function MediaOverlay({
|
|
|
8994
9177
|
},
|
|
8995
9178
|
children: [
|
|
8996
9179
|
isVideo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
|
|
8997
|
-
replaceMode === "full" ?
|
|
9180
|
+
replaceMode === "full" ? replaceLabel : null
|
|
8998
9181
|
]
|
|
8999
9182
|
}
|
|
9000
9183
|
)
|
|
@@ -9032,8 +9215,8 @@ function CarouselOverlay({
|
|
|
9032
9215
|
height: rect.height,
|
|
9033
9216
|
zIndex: 2147483646,
|
|
9034
9217
|
pointerEvents: "auto",
|
|
9035
|
-
boxShadow: "inset 0 0 0 1.5px var(--color-primary)",
|
|
9036
|
-
background: "color-mix(in srgb, var(--color-primary) 20%, transparent)"
|
|
9218
|
+
boxShadow: "inset 0 0 0 1.5px var(--color-bridge-primary)",
|
|
9219
|
+
background: "color-mix(in srgb, var(--color-bridge-primary) 20%, transparent)"
|
|
9037
9220
|
},
|
|
9038
9221
|
onClick: () => onEdit(hover.key),
|
|
9039
9222
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
@@ -9886,7 +10069,7 @@ function SectionTreeItem({
|
|
|
9886
10069
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9887
10070
|
"div",
|
|
9888
10071
|
{
|
|
9889
|
-
className: "mr-
|
|
10072
|
+
className: "-mr-px h-9 w-2 shrink-0 rounded-bl-sm border-b border-l border-border mb-4",
|
|
9890
10073
|
"aria-hidden": true
|
|
9891
10074
|
}
|
|
9892
10075
|
),
|
|
@@ -9905,7 +10088,7 @@ function SectionTreeItem({
|
|
|
9905
10088
|
className: cn(
|
|
9906
10089
|
"flex h-9 min-w-0 flex-1 items-center gap-2 rounded-md border border-border bg-background p-3",
|
|
9907
10090
|
interactive && "cursor-pointer hover:bg-muted/30",
|
|
9908
|
-
interactive && selected && "border-primary"
|
|
10091
|
+
interactive && selected && "border-bridge-primary"
|
|
9909
10092
|
),
|
|
9910
10093
|
children: [
|
|
9911
10094
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -10035,7 +10218,7 @@ function UrlOrPageInput({
|
|
|
10035
10218
|
};
|
|
10036
10219
|
const fieldClassName = cn(
|
|
10037
10220
|
"data-ohw-link-field flex h-[36px] w-full items-center overflow-hidden rounded-md border bg-background pl-3 pr-3 py-2 outline-none transition-[border-color,box-shadow]",
|
|
10038
|
-
urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
|
|
10221
|
+
urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-bridge-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
|
|
10039
10222
|
);
|
|
10040
10223
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex w-full flex-col gap-2 p-0", children: [
|
|
10041
10224
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label, { htmlFor: inputId, className: cn(urlError && "text-destructive"), children: "Destination" }),
|
|
@@ -13942,6 +14125,7 @@ function readLogoSizeState(content, placement) {
|
|
|
13942
14125
|
function getLogoElement(el) {
|
|
13943
14126
|
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
13944
14127
|
if (marked) return marked;
|
|
14128
|
+
if (el.closest('[data-ohw-editable="icon"]')) return null;
|
|
13945
14129
|
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
13946
14130
|
if (!root) return null;
|
|
13947
14131
|
const anchor = el.closest("a");
|
|
@@ -14229,7 +14413,7 @@ function DisplaySwitch({
|
|
|
14229
14413
|
onClick: () => onChange(!checked),
|
|
14230
14414
|
className: cn(
|
|
14231
14415
|
"relative h-5 w-9 shrink-0 rounded-full transition-colors",
|
|
14232
|
-
checked ? "bg-primary" : "bg-primary-50",
|
|
14416
|
+
checked ? "bg-bridge-primary" : "bg-primary-50",
|
|
14233
14417
|
disabled ? "cursor-default opacity-50" : "cursor-pointer"
|
|
14234
14418
|
),
|
|
14235
14419
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -14237,7 +14421,7 @@ function DisplaySwitch({
|
|
|
14237
14421
|
{
|
|
14238
14422
|
className: cn(
|
|
14239
14423
|
"absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all",
|
|
14240
|
-
checked ? "left-
|
|
14424
|
+
checked ? "left-4.5" : "left-0.5"
|
|
14241
14425
|
)
|
|
14242
14426
|
}
|
|
14243
14427
|
)
|
|
@@ -15872,7 +16056,7 @@ var badgeVariants = cva(
|
|
|
15872
16056
|
{
|
|
15873
16057
|
variants: {
|
|
15874
16058
|
variant: {
|
|
15875
|
-
default: "border-transparent bg-primary text-primary-foreground",
|
|
16059
|
+
default: "border-transparent bg-bridge-primary text-primary-foreground",
|
|
15876
16060
|
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
15877
16061
|
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
15878
16062
|
outline: "text-foreground"
|
|
@@ -16054,21 +16238,10 @@ function parseSchedulingInsertAfter(insertAfter) {
|
|
|
16054
16238
|
insertBefore: insertAfter.slice(idx + INSERT_BEFORE_MARKER.length)
|
|
16055
16239
|
};
|
|
16056
16240
|
}
|
|
16057
|
-
function
|
|
16058
|
-
|
|
16059
|
-
const
|
|
16060
|
-
|
|
16061
|
-
return { effectiveInsertAfter, insertBefore };
|
|
16062
|
-
}
|
|
16063
|
-
function getSchedulingMountPoint(insertAfter) {
|
|
16064
|
-
const { anchor } = parseSchedulingInsertAfter(insertAfter);
|
|
16065
|
-
let anchorEl = document.querySelector(`[data-ohw-section="${anchor}"]`);
|
|
16066
|
-
if (!anchorEl && anchor === "scheduling") {
|
|
16067
|
-
const widgets = Array.from(document.querySelectorAll('[data-ohw-section^="scheduling-"]'));
|
|
16068
|
-
anchorEl = widgets.at(-1) ?? null;
|
|
16069
|
-
}
|
|
16070
|
-
if (!anchorEl) return null;
|
|
16071
|
-
return anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
|
|
16241
|
+
function resolveEntryAnchor(entry) {
|
|
16242
|
+
if (entry.anchorId !== void 0) return { anchorId: entry.anchorId, beforeId: entry.beforeId ?? null };
|
|
16243
|
+
const parsed = parseSchedulingInsertAfter(entry.insertAfter);
|
|
16244
|
+
return { anchorId: parsed.anchor, beforeId: parsed.insertBefore };
|
|
16072
16245
|
}
|
|
16073
16246
|
function schedulingMountDepth(insertAfter) {
|
|
16074
16247
|
if (!insertAfter.includes(INSERT_BEFORE_MARKER)) return 0;
|
|
@@ -16085,8 +16258,7 @@ function getPageSchedulingEntries(raw) {
|
|
|
16085
16258
|
}
|
|
16086
16259
|
}
|
|
16087
16260
|
function isSchedulingWidgetMissing(entry) {
|
|
16088
|
-
|
|
16089
|
-
return !document.querySelector(`[data-ohw-section="${schedulingSectionId(effectiveInsertAfter)}"]`);
|
|
16261
|
+
return !document.querySelector(`[data-ohw-section="${schedulingSectionId(entry.insertAfter)}"]`);
|
|
16090
16262
|
}
|
|
16091
16263
|
function hasMissingSchedulingWidgets(entries) {
|
|
16092
16264
|
return entries.some(isSchedulingWidgetMissing);
|
|
@@ -16124,17 +16296,18 @@ function initSectionsFromContent(content, removeExisting = false, currentPath =
|
|
|
16124
16296
|
} catch {
|
|
16125
16297
|
}
|
|
16126
16298
|
}
|
|
16127
|
-
function mountSchedulingWidget(
|
|
16128
|
-
const
|
|
16129
|
-
const sectionId = schedulingSectionId(
|
|
16299
|
+
function mountSchedulingWidget(anchorId, notifyOnConnect = false, scheduleId, beforeId, existingWidgetId) {
|
|
16300
|
+
const widgetId = existingWidgetId ?? (beforeId ? `${anchorId}${INSERT_BEFORE_MARKER}${beforeId}` : anchorId);
|
|
16301
|
+
const sectionId = schedulingSectionId(widgetId);
|
|
16130
16302
|
if (document.querySelector(`[data-ohw-section="${sectionId}"]`)) return false;
|
|
16131
|
-
const
|
|
16132
|
-
if (!
|
|
16303
|
+
const anchorEl = document.querySelector(`[data-ohw-section="${anchorId}"]`);
|
|
16304
|
+
if (!anchorEl) return false;
|
|
16305
|
+
const mountPoint = anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
|
|
16133
16306
|
const container = document.createElement("div");
|
|
16134
16307
|
container.dataset.ohwSectionContainer = "scheduling";
|
|
16135
16308
|
container.dataset.ohwInstance = sectionId;
|
|
16136
|
-
if (
|
|
16137
|
-
const beforeAnchor = document.querySelector(`[data-ohw-section="${
|
|
16309
|
+
if (beforeId) {
|
|
16310
|
+
const beforeAnchor = document.querySelector(`[data-ohw-section="${beforeId}"]`);
|
|
16138
16311
|
const beforePoint = beforeAnchor?.closest('[data-ohw-section-container="scheduling"]') ?? beforeAnchor;
|
|
16139
16312
|
if (!beforePoint) return false;
|
|
16140
16313
|
beforePoint.insertAdjacentElement("beforebegin", container);
|
|
@@ -16145,20 +16318,26 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
|
|
|
16145
16318
|
}
|
|
16146
16319
|
tail.insertAdjacentElement("afterend", container);
|
|
16147
16320
|
}
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16321
|
+
try {
|
|
16322
|
+
const root = (0, import_client2.createRoot)(container);
|
|
16323
|
+
schedulingRoots.set(container, root);
|
|
16324
|
+
(0, import_react_dom4.flushSync)(() => {
|
|
16325
|
+
root.render(
|
|
16326
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
16327
|
+
SchedulingWidget,
|
|
16328
|
+
{
|
|
16329
|
+
notifyOnConnect,
|
|
16330
|
+
initialScheduleId: scheduleId,
|
|
16331
|
+
insertAfter: widgetId
|
|
16332
|
+
}
|
|
16333
|
+
)
|
|
16334
|
+
);
|
|
16335
|
+
});
|
|
16336
|
+
} catch (err) {
|
|
16337
|
+
console.error("[ow:scheduling] render threw", err);
|
|
16338
|
+
container.remove();
|
|
16339
|
+
return false;
|
|
16340
|
+
}
|
|
16162
16341
|
const tracker = getSectionsTracker();
|
|
16163
16342
|
let sections = [];
|
|
16164
16343
|
try {
|
|
@@ -16166,10 +16345,12 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
|
|
|
16166
16345
|
} catch {
|
|
16167
16346
|
}
|
|
16168
16347
|
const inEditor = typeof window !== "undefined" && window.self !== window.top;
|
|
16169
|
-
if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter ===
|
|
16348
|
+
if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter === widgetId)) {
|
|
16170
16349
|
sections.push({
|
|
16171
16350
|
type: "scheduling",
|
|
16172
|
-
insertAfter:
|
|
16351
|
+
insertAfter: widgetId,
|
|
16352
|
+
anchorId,
|
|
16353
|
+
beforeId: beforeId ?? null,
|
|
16173
16354
|
pagePath: window.location.pathname,
|
|
16174
16355
|
...scheduleId ? { scheduleId } : {}
|
|
16175
16356
|
});
|
|
@@ -16183,7 +16364,8 @@ function mountSchedulingEntries(entries, notifyOnConnect = false) {
|
|
|
16183
16364
|
for (let i = pending.length - 1; i >= 0; i--) {
|
|
16184
16365
|
const entry = pending[i];
|
|
16185
16366
|
const shouldNotify = typeof notifyOnConnect === "function" ? notifyOnConnect(entry) : notifyOnConnect;
|
|
16186
|
-
|
|
16367
|
+
const { anchorId, beforeId } = resolveEntryAnchor(entry);
|
|
16368
|
+
if (mountSchedulingWidget(anchorId, shouldNotify, entry.scheduleId ?? null, beforeId, entry.insertAfter)) {
|
|
16187
16369
|
pending.splice(i, 1);
|
|
16188
16370
|
}
|
|
16189
16371
|
}
|
|
@@ -16347,6 +16529,11 @@ function applyLinkByKey(key, val) {
|
|
|
16347
16529
|
hrefAnchors.forEach((el) => applyLinkHref(el, val));
|
|
16348
16530
|
}
|
|
16349
16531
|
}
|
|
16532
|
+
function isInsideLinkEditor(target) {
|
|
16533
|
+
return Boolean(
|
|
16534
|
+
target.closest("[data-ohw-link-popover-root]") || target.closest("[data-ohw-link-modal-root]") || target.closest("[data-ohw-link-page-dropdown]") || target.closest("[data-ohw-section-picker]") || target.closest("[data-ohw-navbar-container-chrome]") || target.closest("[data-ohw-navbar-add-button]") || target.closest("[data-ohw-footer-container-chrome]") || target.closest("[data-ohw-footer-add-button]") || target.closest("[data-ohw-more-menu]") || target.closest('[data-slot="dropdown-menu-content"]') || target.closest('[data-slot="popover-content"]') || target.closest('[data-slot="dialog-content"]') || target.closest('[data-slot="dialog-overlay"]')
|
|
16535
|
+
);
|
|
16536
|
+
}
|
|
16350
16537
|
function isInsideFloatingPanel(target) {
|
|
16351
16538
|
return Boolean(target.closest("[data-ohw-floating-panel]"));
|
|
16352
16539
|
}
|
|
@@ -16354,11 +16541,6 @@ function isPointOverFloatingPanel(clientX, clientY) {
|
|
|
16354
16541
|
const el = document.elementFromPoint(clientX, clientY);
|
|
16355
16542
|
return Boolean(el instanceof Element && el.closest("[data-ohw-floating-panel]"));
|
|
16356
16543
|
}
|
|
16357
|
-
function isInsideLinkEditor(target) {
|
|
16358
|
-
return Boolean(
|
|
16359
|
-
target.closest("[data-ohw-link-popover-root]") || target.closest("[data-ohw-link-modal-root]") || target.closest("[data-ohw-link-page-dropdown]") || target.closest("[data-ohw-section-picker]") || target.closest("[data-ohw-navbar-container-chrome]") || target.closest("[data-ohw-navbar-add-button]") || target.closest("[data-ohw-footer-container-chrome]") || target.closest("[data-ohw-footer-add-button]") || target.closest("[data-ohw-more-menu]") || target.closest('[data-slot="dropdown-menu-content"]') || target.closest('[data-slot="popover-content"]') || target.closest('[data-slot="dialog-content"]') || target.closest('[data-slot="dialog-overlay"]')
|
|
16360
|
-
);
|
|
16361
|
-
}
|
|
16362
16544
|
function getHrefKeyFromElement(el) {
|
|
16363
16545
|
if (!el) return null;
|
|
16364
16546
|
const anchor = el.closest("[data-ohw-href-key]");
|
|
@@ -16518,6 +16700,7 @@ function isFooterAddItemDisabled(selected) {
|
|
|
16518
16700
|
}
|
|
16519
16701
|
function resolveFooterColumnSelectionTarget(target, clientX, clientY) {
|
|
16520
16702
|
if (getNavigationItemAnchor(target)) return null;
|
|
16703
|
+
if (target.closest("[data-ohw-editable]")) return null;
|
|
16521
16704
|
const column = getFooterColumn(target);
|
|
16522
16705
|
if (!column) return null;
|
|
16523
16706
|
if (isPointOverNavItem(column, clientX, clientY)) return null;
|
|
@@ -16627,7 +16810,7 @@ function getNavigationSelectionParent(el) {
|
|
|
16627
16810
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
16628
16811
|
return getFooterLinksContainer();
|
|
16629
16812
|
}
|
|
16630
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
16813
|
+
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)) {
|
|
16631
16814
|
return getNavigationRoot(el);
|
|
16632
16815
|
}
|
|
16633
16816
|
return null;
|
|
@@ -16659,6 +16842,12 @@ function collectNavigationItemSiblingHintRects(selected) {
|
|
|
16659
16842
|
return [];
|
|
16660
16843
|
}).filter((el) => isNavigationItem2(el) && el !== selected).map((el) => el.getBoundingClientRect());
|
|
16661
16844
|
}
|
|
16845
|
+
if (selected.closest('footer, [data-ohw-section="footer"]')) {
|
|
16846
|
+
const group = findFooterItemGroup2(selected);
|
|
16847
|
+
if (group) {
|
|
16848
|
+
return Array.from(group.querySelectorAll("[data-ohw-href-key]")).filter((el) => isNavigationItem2(el) && el !== selected).map((el) => el.getBoundingClientRect());
|
|
16849
|
+
}
|
|
16850
|
+
}
|
|
16662
16851
|
return listNavigationItems().filter((el) => el !== selected && !el.closest("[data-ohw-nav-children]")).map((el) => el.getBoundingClientRect());
|
|
16663
16852
|
}
|
|
16664
16853
|
function placeCaretAtPoint(el, x, y) {
|
|
@@ -16843,7 +17032,6 @@ var ICONS = {
|
|
|
16843
17032
|
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"/>',
|
|
16844
17033
|
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"/>'
|
|
16845
17034
|
};
|
|
16846
|
-
var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
|
|
16847
17035
|
var SELECTION_CHROME_GAP2 = 4;
|
|
16848
17036
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
16849
17037
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -17227,6 +17415,7 @@ function StateToggle({
|
|
|
17227
17415
|
);
|
|
17228
17416
|
}
|
|
17229
17417
|
var contentCache = /* @__PURE__ */ new Map();
|
|
17418
|
+
var fetchedContentPaths = /* @__PURE__ */ new Set();
|
|
17230
17419
|
var brandingCache = /* @__PURE__ */ new Map();
|
|
17231
17420
|
var OHW_LOADER_STYLE = {
|
|
17232
17421
|
position: "fixed",
|
|
@@ -17348,19 +17537,37 @@ function MadeWithOhhWells() {
|
|
|
17348
17537
|
}
|
|
17349
17538
|
);
|
|
17350
17539
|
}
|
|
17351
|
-
var OHW_LOADER_PREHYDRATE_SCRIPT = `(function(){try{var p=location.hostname.split(".");var fromHost=
|
|
17540
|
+
var OHW_LOADER_PREHYDRATE_SCRIPT = `(function(){try{var fromGlobal=typeof window!=="undefined"&&window.__OHW_SUBDOMAIN__?String(window.__OHW_SUBDOMAIN__):"";var p=location.hostname.split(".");var fromHost=location.hostname.endsWith(".ohhwells.site")&&p[0]&&p[0]!=="www"?p[0]:"";var fromQuery=new URLSearchParams(location.search).get("subdomain")||"";var fromCookie=(document.cookie.match(/(?:^|; )ohw-subdomain=([^;]*)/)||[])[1];fromCookie=fromCookie?decodeURIComponent(fromCookie):"";if(!fromGlobal&&!fromHost&&!fromQuery&&!fromCookie)return;var e=document.getElementById("ohw-loader");if(e)e.style.display="flex"}catch(e){}})();`;
|
|
17541
|
+
function subdomainFromCookie() {
|
|
17542
|
+
if (typeof document === "undefined") return "";
|
|
17543
|
+
const match = document.cookie.match(/(?:^|; )ohw-subdomain=([^;]*)/);
|
|
17544
|
+
return match ? decodeURIComponent(match[1]) : "";
|
|
17545
|
+
}
|
|
17352
17546
|
function resolveSubdomain(subdomainFromQuery) {
|
|
17547
|
+
if (typeof window !== "undefined") {
|
|
17548
|
+
const fromGlobal = window.__OHW_SUBDOMAIN__;
|
|
17549
|
+
if (fromGlobal) return fromGlobal;
|
|
17550
|
+
}
|
|
17353
17551
|
if (subdomainFromQuery) return subdomainFromQuery;
|
|
17354
17552
|
if (typeof window !== "undefined") {
|
|
17355
|
-
const
|
|
17356
|
-
if (
|
|
17553
|
+
const host = window.location.hostname.toLowerCase();
|
|
17554
|
+
if (host.endsWith(".ohhwells.site")) {
|
|
17555
|
+
const label = host.slice(0, -".ohhwells.site".length).split(".").pop();
|
|
17556
|
+
if (label && label !== "www") return label;
|
|
17557
|
+
}
|
|
17558
|
+
const fromCookie = subdomainFromCookie();
|
|
17559
|
+
if (fromCookie) return fromCookie;
|
|
17560
|
+
const isPlatformHost = host.endsWith(".ohhwells.site") || host === "localhost" || host.endsWith(".localhost") || host.endsWith(".vercel.app");
|
|
17561
|
+
if (!isPlatformHost) return "";
|
|
17357
17562
|
}
|
|
17358
17563
|
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL;
|
|
17359
17564
|
if (siteUrl) {
|
|
17360
17565
|
try {
|
|
17361
17566
|
const host = new URL(siteUrl).hostname;
|
|
17362
|
-
|
|
17363
|
-
|
|
17567
|
+
if (host.endsWith(".ohhwells.site")) {
|
|
17568
|
+
const label = host.slice(0, -".ohhwells.site".length).split(".").pop();
|
|
17569
|
+
if (label && label !== "www") return label;
|
|
17570
|
+
}
|
|
17364
17571
|
} catch {
|
|
17365
17572
|
}
|
|
17366
17573
|
}
|
|
@@ -17398,7 +17605,26 @@ function OhhwellsBridge() {
|
|
|
17398
17605
|
};
|
|
17399
17606
|
}, []);
|
|
17400
17607
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
17401
|
-
const subdomain = resolveSubdomain(subdomainFromQuery);
|
|
17608
|
+
const [subdomain, setSubdomain] = (0, import_react17.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
17609
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
17610
|
+
const next = resolveSubdomain(subdomainFromQuery);
|
|
17611
|
+
if (next !== subdomain) setSubdomain(next);
|
|
17612
|
+
if (next) return;
|
|
17613
|
+
const host = window.location.hostname.toLowerCase();
|
|
17614
|
+
if (host.endsWith(".ohhwells.site")) return;
|
|
17615
|
+
const t = window.setTimeout(() => {
|
|
17616
|
+
const retry = resolveSubdomain(subdomainFromQuery);
|
|
17617
|
+
if (retry) setSubdomain(retry);
|
|
17618
|
+
}, 0);
|
|
17619
|
+
return () => window.clearTimeout(t);
|
|
17620
|
+
}, [subdomainFromQuery, subdomain]);
|
|
17621
|
+
(0, import_react17.useEffect)(() => {
|
|
17622
|
+
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
17623
|
+
const url = new URL(window.location.href);
|
|
17624
|
+
if (!url.searchParams.has("subdomain")) return;
|
|
17625
|
+
url.searchParams.delete("subdomain");
|
|
17626
|
+
window.history.replaceState(null, "", url.pathname + url.search + url.hash);
|
|
17627
|
+
}, [subdomainFromQuery]);
|
|
17402
17628
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
17403
17629
|
useSavedLinkNavigation(isEditMode);
|
|
17404
17630
|
const postToParent2 = (0, import_react17.useCallback)((data) => {
|
|
@@ -17775,13 +18001,6 @@ function OhhwellsBridge() {
|
|
|
17775
18001
|
const [isItemDragging, setIsItemDragging] = (0, import_react17.useState)(false);
|
|
17776
18002
|
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react17.useState)(false);
|
|
17777
18003
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
17778
|
-
const [floatingPanel, setFloatingPanel] = (0, import_react17.useState)(null);
|
|
17779
|
-
const floatingPanelOpenRef = (0, import_react17.useRef)(false);
|
|
17780
|
-
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
17781
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react17.useState)(null);
|
|
17782
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react17.useState)(null);
|
|
17783
|
-
const [editorViewport, setEditorViewport] = (0, import_react17.useState)("desktop");
|
|
17784
|
-
const [parentScrollSnap, setParentScrollSnap] = (0, import_react17.useState)(null);
|
|
17785
18004
|
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react17.useState)(null);
|
|
17786
18005
|
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react17.useState)(null);
|
|
17787
18006
|
const footerDragRef = (0, import_react17.useRef)(null);
|
|
@@ -17798,7 +18017,15 @@ function OhhwellsBridge() {
|
|
|
17798
18017
|
const aiSectionsRef = (0, import_react17.useRef)("");
|
|
17799
18018
|
const brandKitRef = (0, import_react17.useRef)("");
|
|
17800
18019
|
const stylesRef = (0, import_react17.useRef)("");
|
|
18020
|
+
const appliedDrawerRef = (0, import_react17.useRef)(null);
|
|
17801
18021
|
const pendingDeleteUndoRef = (0, import_react17.useRef)(null);
|
|
18022
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react17.useState)(null);
|
|
18023
|
+
const floatingPanelOpenRef = (0, import_react17.useRef)(false);
|
|
18024
|
+
const setFloatingPanelRef = (0, import_react17.useRef)(setFloatingPanel);
|
|
18025
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react17.useState)(null);
|
|
18026
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react17.useState)(null);
|
|
18027
|
+
const [editorViewport, setEditorViewport] = (0, import_react17.useState)("desktop");
|
|
18028
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react17.useState)(null);
|
|
17802
18029
|
const [sitePages, setSitePages] = (0, import_react17.useState)([]);
|
|
17803
18030
|
const [sectionsByPath, setSectionsByPath] = (0, import_react17.useState)({});
|
|
17804
18031
|
const sectionsPrefetchGenRef = (0, import_react17.useRef)(0);
|
|
@@ -17807,7 +18034,18 @@ function OhhwellsBridge() {
|
|
|
17807
18034
|
const linkPopoverOpenRef = (0, import_react17.useRef)(false);
|
|
17808
18035
|
const linkPopoverGraceUntilRef = (0, import_react17.useRef)(0);
|
|
17809
18036
|
setLinkPopoverRef.current = setLinkPopover;
|
|
18037
|
+
setFloatingPanelRef.current = setFloatingPanel;
|
|
17810
18038
|
linkPopoverSessionRef.current = linkPopover;
|
|
18039
|
+
floatingPanelOpenRef.current = Boolean(floatingPanel);
|
|
18040
|
+
(0, import_react17.useEffect)(() => {
|
|
18041
|
+
const syncViewport = () => {
|
|
18042
|
+
const next = window.innerWidth <= 480 ? "mobile" : "desktop";
|
|
18043
|
+
setEditorViewport((prev) => prev === next ? prev : next);
|
|
18044
|
+
};
|
|
18045
|
+
syncViewport();
|
|
18046
|
+
window.addEventListener("resize", syncViewport);
|
|
18047
|
+
return () => window.removeEventListener("resize", syncViewport);
|
|
18048
|
+
}, []);
|
|
17811
18049
|
const {
|
|
17812
18050
|
navDragRef,
|
|
17813
18051
|
navPointerDragRef,
|
|
@@ -19143,6 +19381,7 @@ function OhhwellsBridge() {
|
|
|
19143
19381
|
}
|
|
19144
19382
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
19145
19383
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
19384
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
19146
19385
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
19147
19386
|
}
|
|
19148
19387
|
applyBrandChrome(content);
|
|
@@ -19150,11 +19389,11 @@ function OhhwellsBridge() {
|
|
|
19150
19389
|
for (const [key, val] of Object.entries(content)) {
|
|
19151
19390
|
if (key === "__ohw_sections") continue;
|
|
19152
19391
|
if (key === AI_SECTIONS_KEY) continue;
|
|
19392
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
19393
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
19153
19394
|
if (key === BRAND_KIT_KEY) continue;
|
|
19154
19395
|
if (key === STYLE_STORE_KEY) continue;
|
|
19155
19396
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
19156
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
19157
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
19158
19397
|
if (applyVideoSettingNode(key, val)) continue;
|
|
19159
19398
|
if (applyCarouselNode(key, val)) continue;
|
|
19160
19399
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -19225,7 +19464,9 @@ function OhhwellsBridge() {
|
|
|
19225
19464
|
let cancelled = false;
|
|
19226
19465
|
setFetchState("loading");
|
|
19227
19466
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
19228
|
-
|
|
19467
|
+
const initialPath = pathname;
|
|
19468
|
+
fetchedContentPaths.add(`${subdomain}::${initialPath}`);
|
|
19469
|
+
fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(initialPath)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
19229
19470
|
if (cancelled) return;
|
|
19230
19471
|
const content = data?.content ?? {};
|
|
19231
19472
|
const branding = Boolean(data?.showBranding);
|
|
@@ -19334,7 +19575,9 @@ function OhhwellsBridge() {
|
|
|
19334
19575
|
}, [isEditMode]);
|
|
19335
19576
|
(0, import_react17.useEffect)(() => {
|
|
19336
19577
|
if (isEditMode || fetchState !== "done") return;
|
|
19578
|
+
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
19337
19579
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
19580
|
+
console.log({ apiUrl, subdomain });
|
|
19338
19581
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
19339
19582
|
}, [isEditMode, fetchState, subdomain]);
|
|
19340
19583
|
(0, import_react17.useEffect)(() => {
|
|
@@ -19359,16 +19602,17 @@ function OhhwellsBridge() {
|
|
|
19359
19602
|
applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
|
|
19360
19603
|
}
|
|
19361
19604
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
19605
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
19362
19606
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
19363
19607
|
}
|
|
19364
19608
|
for (const [key, val] of Object.entries(content)) {
|
|
19365
19609
|
if (key === "__ohw_sections") continue;
|
|
19366
19610
|
if (key === AI_SECTIONS_KEY) continue;
|
|
19611
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
19612
|
+
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
19367
19613
|
if (key === BRAND_KIT_KEY) continue;
|
|
19368
19614
|
if (key === STYLE_STORE_KEY) continue;
|
|
19369
19615
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
19370
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
19371
|
-
if (LOGO_IMAGE_KEYS.includes(key)) continue;
|
|
19372
19616
|
if (applyVideoSettingNode(key, val)) continue;
|
|
19373
19617
|
if (applyCarouselNode(key, val)) continue;
|
|
19374
19618
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -19419,6 +19663,17 @@ function OhhwellsBridge() {
|
|
|
19419
19663
|
debounceTimer = setTimeout(applyFromCache, 150);
|
|
19420
19664
|
};
|
|
19421
19665
|
applyFromCache();
|
|
19666
|
+
const pathCacheKey = `${subdomain}::${pathname}`;
|
|
19667
|
+
if (!fetchedContentPaths.has(pathCacheKey)) {
|
|
19668
|
+
fetchedContentPaths.add(pathCacheKey);
|
|
19669
|
+
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
19670
|
+
fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(pathname)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
|
|
19671
|
+
if (!data?.content) return;
|
|
19672
|
+
contentCache.set(subdomain, data.content);
|
|
19673
|
+
applyFromCache();
|
|
19674
|
+
}).catch(() => {
|
|
19675
|
+
});
|
|
19676
|
+
}
|
|
19422
19677
|
observer = new MutationObserver(scheduleApply);
|
|
19423
19678
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
19424
19679
|
return () => {
|
|
@@ -19463,6 +19718,17 @@ function OhhwellsBridge() {
|
|
|
19463
19718
|
if (!isEditMode) return;
|
|
19464
19719
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
19465
19720
|
}, [pathname, isEditMode]);
|
|
19721
|
+
(0, import_react17.useEffect)(() => {
|
|
19722
|
+
if (!isEditMode) return;
|
|
19723
|
+
const observer = new MutationObserver(() => {
|
|
19724
|
+
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
19725
|
+
if (!drawer || drawer === appliedDrawerRef.current) return;
|
|
19726
|
+
appliedDrawerRef.current = drawer;
|
|
19727
|
+
applyStylesToDom(parseStyleStore(stylesRef.current));
|
|
19728
|
+
});
|
|
19729
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
19730
|
+
return () => observer.disconnect();
|
|
19731
|
+
}, [isEditMode, pathname]);
|
|
19466
19732
|
(0, import_react17.useEffect)(() => {
|
|
19467
19733
|
const contentForNav = () => {
|
|
19468
19734
|
if (isEditMode) return editContentRef.current;
|
|
@@ -19554,26 +19820,11 @@ function OhhwellsBridge() {
|
|
|
19554
19820
|
const t2 = setTimeout(measure, 500);
|
|
19555
19821
|
const ro = new ResizeObserver(schedule);
|
|
19556
19822
|
ro.observe(document.body);
|
|
19557
|
-
let lastWidth = window.innerWidth;
|
|
19558
|
-
let resizeTimers = [];
|
|
19559
|
-
const clearResizeTimers = () => {
|
|
19560
|
-
resizeTimers.forEach(clearTimeout);
|
|
19561
|
-
resizeTimers = [];
|
|
19562
|
-
};
|
|
19563
|
-
const handleResize = () => {
|
|
19564
|
-
if (window.innerWidth === lastWidth) return;
|
|
19565
|
-
lastWidth = window.innerWidth;
|
|
19566
|
-
clearResizeTimers();
|
|
19567
|
-
resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
|
|
19568
|
-
};
|
|
19569
|
-
window.addEventListener("resize", handleResize);
|
|
19570
19823
|
return () => {
|
|
19571
19824
|
clearTimeout(t1);
|
|
19572
19825
|
clearTimeout(t2);
|
|
19573
19826
|
if (raf != null) cancelAnimationFrame(raf);
|
|
19574
19827
|
ro.disconnect();
|
|
19575
|
-
clearResizeTimers();
|
|
19576
|
-
window.removeEventListener("resize", handleResize);
|
|
19577
19828
|
};
|
|
19578
19829
|
}, [pathname, isEditMode, postToParent2]);
|
|
19579
19830
|
(0, import_react17.useEffect)(() => {
|
|
@@ -19868,9 +20119,6 @@ function OhhwellsBridge() {
|
|
|
19868
20119
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
19869
20120
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
19870
20121
|
if (isInsideLinkEditor(target)) return;
|
|
19871
|
-
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
19872
|
-
clearMediaSelectionRef.current();
|
|
19873
|
-
}
|
|
19874
20122
|
if (isInsideFloatingPanel(target)) return;
|
|
19875
20123
|
if (target.closest("[data-ohw-form-toolbar]")) return;
|
|
19876
20124
|
if (target.closest(
|
|
@@ -19878,6 +20126,9 @@ function OhhwellsBridge() {
|
|
|
19878
20126
|
)) {
|
|
19879
20127
|
return;
|
|
19880
20128
|
}
|
|
20129
|
+
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
20130
|
+
clearMediaSelectionRef.current();
|
|
20131
|
+
}
|
|
19881
20132
|
{
|
|
19882
20133
|
const formEl = getFormElement(target);
|
|
19883
20134
|
const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
|
|
@@ -20041,14 +20292,6 @@ function OhhwellsBridge() {
|
|
|
20041
20292
|
}
|
|
20042
20293
|
const clickedButton = findClosestButtonLike(target);
|
|
20043
20294
|
const buttonOnMedia = Boolean(clickedButton && isMediaEditable(editable) && editable.contains(clickedButton));
|
|
20044
|
-
console.log("[click-debug]", {
|
|
20045
|
-
editableType: editable.dataset.ohwEditable,
|
|
20046
|
-
editableTag: editable.tagName,
|
|
20047
|
-
targetTag: target.tagName,
|
|
20048
|
-
clickedButtonTag: clickedButton?.tagName ?? null,
|
|
20049
|
-
buttonOnMedia,
|
|
20050
|
-
isMediaEditableEditable: isMediaEditable(editable)
|
|
20051
|
-
});
|
|
20052
20295
|
if (isMediaEditable(editable) && !buttonOnMedia) {
|
|
20053
20296
|
e.preventDefault();
|
|
20054
20297
|
e.stopPropagation();
|
|
@@ -20075,11 +20318,6 @@ function OhhwellsBridge() {
|
|
|
20075
20318
|
const hrefLookupTarget = buttonOnMedia ? clickedButton : editable;
|
|
20076
20319
|
const hrefCtx = getHrefKeyFromElement(hrefLookupTarget);
|
|
20077
20320
|
const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
|
|
20078
|
-
console.log("[click-debug 2]", {
|
|
20079
|
-
hrefLookupTargetTag: hrefLookupTarget.tagName,
|
|
20080
|
-
hrefCtx: hrefCtx ? { key: hrefCtx.key } : null,
|
|
20081
|
-
navAnchorTag: navAnchor?.tagName ?? null
|
|
20082
|
-
});
|
|
20083
20321
|
if (navAnchor) {
|
|
20084
20322
|
e.preventDefault();
|
|
20085
20323
|
e.stopPropagation();
|
|
@@ -20121,7 +20359,7 @@ function OhhwellsBridge() {
|
|
|
20121
20359
|
return;
|
|
20122
20360
|
}
|
|
20123
20361
|
const footerColClick = target.closest("[data-ohw-footer-col]");
|
|
20124
|
-
if (footerColClick) {
|
|
20362
|
+
if (footerColClick && !target.closest("[data-ohw-editable]")) {
|
|
20125
20363
|
e.preventDefault();
|
|
20126
20364
|
e.stopPropagation();
|
|
20127
20365
|
selectFrameRef.current(footerColClick);
|
|
@@ -20249,6 +20487,9 @@ function OhhwellsBridge() {
|
|
|
20249
20487
|
setHoveredItemRect(null);
|
|
20250
20488
|
hoveredNavContainerRef.current = null;
|
|
20251
20489
|
setHoveredNavContainerRect(null);
|
|
20490
|
+
siblingHintElRef.current = null;
|
|
20491
|
+
setSiblingHintRect(null);
|
|
20492
|
+
setSiblingHintRects([]);
|
|
20252
20493
|
return;
|
|
20253
20494
|
}
|
|
20254
20495
|
{
|
|
@@ -20280,7 +20521,7 @@ function OhhwellsBridge() {
|
|
|
20280
20521
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
20281
20522
|
if (!navContainer) {
|
|
20282
20523
|
const footerLinks = target.closest("[data-ohw-footer-links], .rb-footer-links") ?? null;
|
|
20283
|
-
if (footerLinks && selected2 !== footerLinks && !getNavigationItemAnchor(target) && !target.closest("[data-ohw-footer-col], [data-ohw-footer-column]")) {
|
|
20524
|
+
if (footerLinks && selected2 !== footerLinks && !getNavigationItemAnchor(target) && !target.closest("[data-ohw-footer-col], [data-ohw-footer-column]") && !target.closest("[data-ohw-editable]")) {
|
|
20284
20525
|
hoveredNavContainerRef.current = footerLinks;
|
|
20285
20526
|
setHoveredNavContainerRect(footerLinks.getBoundingClientRect());
|
|
20286
20527
|
hoveredItemElRef.current = null;
|
|
@@ -20318,7 +20559,7 @@ function OhhwellsBridge() {
|
|
|
20318
20559
|
return;
|
|
20319
20560
|
}
|
|
20320
20561
|
const footerCol = target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
|
|
20321
|
-
if (footerCol) {
|
|
20562
|
+
if (footerCol && !target.closest("[data-ohw-editable]")) {
|
|
20322
20563
|
hoveredNavContainerRef.current = null;
|
|
20323
20564
|
setHoveredNavContainerRect(null);
|
|
20324
20565
|
if (selectedElRef.current === footerCol) return;
|
|
@@ -20369,7 +20610,6 @@ function OhhwellsBridge() {
|
|
|
20369
20610
|
hoveredNavContainerRef.current = null;
|
|
20370
20611
|
setHoveredNavContainerRect(null);
|
|
20371
20612
|
hoveredItemElRef.current = editable;
|
|
20372
|
-
setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
|
|
20373
20613
|
}
|
|
20374
20614
|
}
|
|
20375
20615
|
}
|
|
@@ -20666,7 +20906,7 @@ function OhhwellsBridge() {
|
|
|
20666
20906
|
}
|
|
20667
20907
|
};
|
|
20668
20908
|
const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
|
|
20669
|
-
if (linkPopoverOpenRef.current) {
|
|
20909
|
+
if (linkPopoverOpenRef.current || floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
|
|
20670
20910
|
if (hoveredImageRef.current) {
|
|
20671
20911
|
hoveredImageRef.current = null;
|
|
20672
20912
|
hoveredImageHasTextOverlapRef.current = false;
|
|
@@ -21039,8 +21279,7 @@ function OhhwellsBridge() {
|
|
|
21039
21279
|
};
|
|
21040
21280
|
const handleMouseMove = (e) => {
|
|
21041
21281
|
const { clientX, clientY } = e;
|
|
21042
|
-
if (
|
|
21043
|
-
if (isOverEditorChrome(clientX, clientY)) {
|
|
21282
|
+
if (document.documentElement.hasAttribute("data-ohw-panel-dragging") || floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY) || isOverEditorChrome(clientX, clientY)) {
|
|
21044
21283
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
21045
21284
|
formHoverElRef.current = null;
|
|
21046
21285
|
setFormHoverRect(null);
|
|
@@ -21048,7 +21287,12 @@ function OhhwellsBridge() {
|
|
|
21048
21287
|
setHoveredItemRect(null);
|
|
21049
21288
|
hoveredNavContainerRef.current = null;
|
|
21050
21289
|
setHoveredNavContainerRect(null);
|
|
21290
|
+
siblingHintElRef.current = null;
|
|
21291
|
+
setSiblingHintRect(null);
|
|
21292
|
+
setSiblingHintRects([]);
|
|
21051
21293
|
dismissImageHover();
|
|
21294
|
+
clearImageHover();
|
|
21295
|
+
setSectionGap(null);
|
|
21052
21296
|
return;
|
|
21053
21297
|
}
|
|
21054
21298
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
@@ -21060,7 +21304,11 @@ function OhhwellsBridge() {
|
|
|
21060
21304
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
21061
21305
|
const { clientX, clientY } = e.data;
|
|
21062
21306
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
21063
|
-
if (
|
|
21307
|
+
if (document.documentElement.hasAttribute("data-ohw-panel-dragging") || floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
|
|
21308
|
+
dismissImageHover();
|
|
21309
|
+
clearImageHover();
|
|
21310
|
+
return;
|
|
21311
|
+
}
|
|
21064
21312
|
if (probeSocialsRowAt(clientX, clientY)) return;
|
|
21065
21313
|
probeSectionGapAt(clientX, clientY);
|
|
21066
21314
|
probeImageAt(clientX, clientY);
|
|
@@ -21399,6 +21647,7 @@ function OhhwellsBridge() {
|
|
|
21399
21647
|
}
|
|
21400
21648
|
if (typeof content[STYLE_STORE_KEY] === "string") {
|
|
21401
21649
|
stylesRef.current = content[STYLE_STORE_KEY];
|
|
21650
|
+
document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
|
|
21402
21651
|
applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
|
|
21403
21652
|
}
|
|
21404
21653
|
applyBrandChrome(content);
|
|
@@ -21410,11 +21659,11 @@ function OhhwellsBridge() {
|
|
|
21410
21659
|
continue;
|
|
21411
21660
|
}
|
|
21412
21661
|
if (key === AI_SECTIONS_KEY) continue;
|
|
21662
|
+
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
21663
|
+
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
21413
21664
|
if (key === BRAND_KIT_KEY) continue;
|
|
21414
21665
|
if (key === STYLE_STORE_KEY) continue;
|
|
21415
21666
|
if (BRAND_CHROME_KEYS.has(key)) continue;
|
|
21416
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
21417
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
21418
21667
|
if (applyVideoSettingNode(key, val)) continue;
|
|
21419
21668
|
if (applyCarouselNode(key, val)) continue;
|
|
21420
21669
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -21639,10 +21888,26 @@ function OhhwellsBridge() {
|
|
|
21639
21888
|
const handleGetBrand = (e) => {
|
|
21640
21889
|
if (e.data?.type !== "ow:get-brand") return;
|
|
21641
21890
|
const template = deriveTemplateBrand();
|
|
21642
|
-
const
|
|
21891
|
+
const fallback = template ?? (() => {
|
|
21892
|
+
const fonts = deriveTemplateFonts();
|
|
21893
|
+
return fonts ? { palette: AI_DEFAULT_BRAND.palette, fonts } : null;
|
|
21894
|
+
})();
|
|
21895
|
+
const value = brandKitRef.current || (fallback ? JSON.stringify(fallback) : "");
|
|
21643
21896
|
postToParentRef.current({ type: "ow:brand-value", value });
|
|
21644
21897
|
};
|
|
21645
21898
|
window.addEventListener("message", handleGetBrand);
|
|
21899
|
+
const handleGetTemplateFonts = (e) => {
|
|
21900
|
+
if (e.data?.type !== "ow:get-template-fonts") return;
|
|
21901
|
+
const fonts = deriveTemplateFonts();
|
|
21902
|
+
postToParentRef.current({ type: "ow:template-fonts-value", value: fonts ? JSON.stringify(fonts) : "" });
|
|
21903
|
+
};
|
|
21904
|
+
window.addEventListener("message", handleGetTemplateFonts);
|
|
21905
|
+
const handleGetTemplateBrand = (e) => {
|
|
21906
|
+
if (e.data?.type !== "ow:get-template-brand") return;
|
|
21907
|
+
const brand = deriveTemplateBrand();
|
|
21908
|
+
postToParentRef.current({ type: "ow:template-brand-value", value: brand ? JSON.stringify(brand) : "" });
|
|
21909
|
+
};
|
|
21910
|
+
window.addEventListener("message", handleGetTemplateBrand);
|
|
21646
21911
|
const handleMoveSection = (e) => {
|
|
21647
21912
|
if (e.data?.type !== "ow:move-section") return;
|
|
21648
21913
|
const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
|
|
@@ -21835,6 +22100,12 @@ function OhhwellsBridge() {
|
|
|
21835
22100
|
closeLinkPopoverRef.current();
|
|
21836
22101
|
return;
|
|
21837
22102
|
}
|
|
22103
|
+
if (floatingPanelOpenRef.current) {
|
|
22104
|
+
setFloatingPanelRef.current(null);
|
|
22105
|
+
deselectRef.current();
|
|
22106
|
+
deactivateRef.current();
|
|
22107
|
+
return;
|
|
22108
|
+
}
|
|
21838
22109
|
deselectRef.current();
|
|
21839
22110
|
deactivateRef.current();
|
|
21840
22111
|
clearMediaSelectionRef.current();
|
|
@@ -22123,8 +22394,12 @@ function OhhwellsBridge() {
|
|
|
22123
22394
|
if (inserted) {
|
|
22124
22395
|
const tracker = getSectionsTracker();
|
|
22125
22396
|
postToParentRef.current({ type: "ow:change", nodes: [{ key: "__ohw_sections", text: tracker.textContent ?? "[]" }] });
|
|
22126
|
-
const
|
|
22127
|
-
|
|
22397
|
+
const reportHeight = () => {
|
|
22398
|
+
const h = document.body.scrollHeight;
|
|
22399
|
+
if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
|
|
22400
|
+
};
|
|
22401
|
+
reportHeight();
|
|
22402
|
+
setTimeout(reportHeight, 500);
|
|
22128
22403
|
}
|
|
22129
22404
|
};
|
|
22130
22405
|
const handleSwitchSchedule = (e) => {
|
|
@@ -22545,15 +22820,17 @@ function OhhwellsBridge() {
|
|
|
22545
22820
|
window.removeEventListener("message", handleAiSetBrand);
|
|
22546
22821
|
window.removeEventListener("message", handleAiSetStyles);
|
|
22547
22822
|
window.removeEventListener("message", handleGetBrand);
|
|
22823
|
+
window.removeEventListener("message", handleGetTemplateFonts);
|
|
22824
|
+
window.removeEventListener("message", handleGetTemplateBrand);
|
|
22548
22825
|
window.removeEventListener("message", handleMoveSection);
|
|
22549
22826
|
window.removeEventListener("message", handlePanelDragging);
|
|
22550
22827
|
window.removeEventListener("message", handleDeleteSection);
|
|
22551
22828
|
window.removeEventListener("message", handleDuplicateSection);
|
|
22552
22829
|
window.removeEventListener("message", handleDeactivate);
|
|
22553
|
-
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22554
22830
|
window.removeEventListener("message", handleToastAction);
|
|
22555
22831
|
window.removeEventListener("message", handleFormCount);
|
|
22556
22832
|
window.removeEventListener("message", handleUiEscape);
|
|
22833
|
+
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22557
22834
|
autoSaveTimers.current.forEach(clearTimeout);
|
|
22558
22835
|
autoSaveTimers.current.clear();
|
|
22559
22836
|
if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
|
|
@@ -22756,7 +23033,7 @@ function OhhwellsBridge() {
|
|
|
22756
23033
|
postToParent2({
|
|
22757
23034
|
type: "ow:ready",
|
|
22758
23035
|
version: "1",
|
|
22759
|
-
bridgeVersion: "0.1.
|
|
23036
|
+
bridgeVersion: "0.1.113",
|
|
22760
23037
|
path: pathname,
|
|
22761
23038
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22762
23039
|
sections
|
|
@@ -23372,7 +23649,7 @@ function OhhwellsBridge() {
|
|
|
23372
23649
|
"span",
|
|
23373
23650
|
{
|
|
23374
23651
|
"data-ohw-form-count": "",
|
|
23375
|
-
className: "ml-0.5 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground",
|
|
23652
|
+
className: "ml-0.5 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-bridge-primary px-1.5 text-[11px] font-semibold text-primary-foreground",
|
|
23376
23653
|
children: formPickCount
|
|
23377
23654
|
}
|
|
23378
23655
|
)
|
|
@@ -23610,11 +23887,11 @@ function OhhwellsBridge() {
|
|
|
23610
23887
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
23611
23888
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
23612
23889
|
children: [
|
|
23613
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
23890
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-bridge-primary", style: { height: 3 } }),
|
|
23614
23891
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
23615
23892
|
Badge,
|
|
23616
23893
|
{
|
|
23617
|
-
className: "px-8 py-1 bg-primary hover:bg-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
|
|
23894
|
+
className: "px-8 py-1 bg-bridge-primary hover:bg-bridge-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
|
|
23618
23895
|
onClick: () => {
|
|
23619
23896
|
window.parent.postMessage(
|
|
23620
23897
|
{
|
|
@@ -23628,7 +23905,7 @@ function OhhwellsBridge() {
|
|
|
23628
23905
|
children: "Add Section"
|
|
23629
23906
|
}
|
|
23630
23907
|
),
|
|
23631
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
23908
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-bridge-primary", style: { height: 3 } })
|
|
23632
23909
|
]
|
|
23633
23910
|
}
|
|
23634
23911
|
),
|
|
@@ -23676,6 +23953,59 @@ function OhhwellsBridge() {
|
|
|
23676
23953
|
) : null
|
|
23677
23954
|
] });
|
|
23678
23955
|
}
|
|
23956
|
+
|
|
23957
|
+
// src/ui/EmptySection.tsx
|
|
23958
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
23959
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
23960
|
+
function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey }) {
|
|
23961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
23962
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
23963
|
+
"p",
|
|
23964
|
+
{
|
|
23965
|
+
style: {
|
|
23966
|
+
fontFamily: "var(--brand-font-body)",
|
|
23967
|
+
fontSize: "0.75rem",
|
|
23968
|
+
fontWeight: 500,
|
|
23969
|
+
letterSpacing: "0.15em",
|
|
23970
|
+
textTransform: "uppercase",
|
|
23971
|
+
color: "var(--brand-accent)",
|
|
23972
|
+
marginBottom: "1.5rem"
|
|
23973
|
+
},
|
|
23974
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_link.default, { href: homeHref, style: { color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ...eyebrowKey ? { "data-ohw-editable": "text", "data-ohw-key": eyebrowKey } : {}, children: "Home" }) })
|
|
23975
|
+
}
|
|
23976
|
+
),
|
|
23977
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
23978
|
+
"h1",
|
|
23979
|
+
{
|
|
23980
|
+
style: {
|
|
23981
|
+
fontFamily: "var(--brand-font-heading)",
|
|
23982
|
+
fontSize: "clamp(2rem, 3.5vw, 2.75rem)",
|
|
23983
|
+
lineHeight: 1.1,
|
|
23984
|
+
letterSpacing: "-0.025em",
|
|
23985
|
+
color: "var(--brand-text)",
|
|
23986
|
+
marginBottom: "1rem"
|
|
23987
|
+
},
|
|
23988
|
+
...titleKey ? { "data-ohw-editable": "text", "data-ohw-key": titleKey, "data-ohw-max-length": 80 } : {},
|
|
23989
|
+
children: title
|
|
23990
|
+
}
|
|
23991
|
+
),
|
|
23992
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
23993
|
+
"p",
|
|
23994
|
+
{
|
|
23995
|
+
style: {
|
|
23996
|
+
fontFamily: "var(--brand-font-body)",
|
|
23997
|
+
fontSize: "1rem",
|
|
23998
|
+
lineHeight: 1.7,
|
|
23999
|
+
fontWeight: 300,
|
|
24000
|
+
color: "var(--brand-text-muted)",
|
|
24001
|
+
maxWidth: "340px"
|
|
24002
|
+
},
|
|
24003
|
+
...subtitleKey ? { "data-ohw-editable": "text", "data-ohw-key": subtitleKey, "data-ohw-max-length": 160 } : {},
|
|
24004
|
+
children: "This page doesn't have any content yet."
|
|
24005
|
+
}
|
|
24006
|
+
)
|
|
24007
|
+
] });
|
|
24008
|
+
}
|
|
23679
24009
|
// Annotate the CommonJS export names for ESM import in node:
|
|
23680
24010
|
0 && (module.exports = {
|
|
23681
24011
|
AI_DEFAULT_BRAND,
|
|
@@ -23693,6 +24023,7 @@ function OhhwellsBridge() {
|
|
|
23693
24023
|
DropdownMenuItem,
|
|
23694
24024
|
DropdownMenuSeparator,
|
|
23695
24025
|
DropdownMenuTrigger,
|
|
24026
|
+
EmptySection,
|
|
23696
24027
|
ItemActionToolbar,
|
|
23697
24028
|
ItemInteractionLayer,
|
|
23698
24029
|
LinkEditorPanel,
|