@ohhwells/bridge 0.1.129 → 0.1.130

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 CHANGED
@@ -1903,6 +1903,29 @@ var typeStyle = (spec, font) => ({
1903
1903
  lineHeight: spec.line,
1904
1904
  fontWeight: spec.weight
1905
1905
  });
1906
+ function quotedFont(font) {
1907
+ const cleaned = font.replace(/["']/g, "").trim();
1908
+ return cleaned ? `"${cleaned}"` : "sans-serif";
1909
+ }
1910
+ function footerLogoStyle(fallbackFont, fallbackColor) {
1911
+ return {
1912
+ fontFamily: `var(--brand-font-heading, var(--font-heading, var(--font-display, ${quotedFont(fallbackFont)})))`,
1913
+ fontSize: "var(--text-h3, 1.75rem)",
1914
+ lineHeight: "var(--text-h3--line-height, 1.2)",
1915
+ letterSpacing: "-0.02em",
1916
+ fontWeight: 400,
1917
+ color: `var(--brand-primary, ${fallbackColor})`
1918
+ };
1919
+ }
1920
+ function footerBodyStyle(fallbackFont, color, weight = 500) {
1921
+ return {
1922
+ fontFamily: `var(--brand-font-body, var(--font-body, ${quotedFont(fallbackFont)}))`,
1923
+ fontSize: "var(--text-body-md, 16px)",
1924
+ lineHeight: 1.5,
1925
+ fontWeight: weight,
1926
+ color
1927
+ };
1928
+ }
1906
1929
  var str = (value) => typeof value === "string" ? value : "";
1907
1930
  var cardRadius = (slots) => slots.cornerStyle === "sharp" ? 0 : AI_TREE_TOKENS.radiusCard;
1908
1931
  var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.trim()).filter(Boolean);
@@ -1926,7 +1949,9 @@ var AI_FOOTER_MOBILE_CSS = [
1926
1949
  "@media (max-width: 768px){",
1927
1950
  "[data-ai-footer]{overflow-x:hidden}",
1928
1951
  "[data-ai-footer-top]{display:flex !important;flex-direction:column !important;gap:32px !important}",
1929
- "[data-ai-footer-brand],[data-ohw-footer-links]{width:100%;min-width:0}",
1952
+ // Column flex-basis (420px / 220px) is height once the row stacks — drop it so
1953
+ // the column is only as tall as its links.
1954
+ "[data-ai-footer-brand],[data-ohw-footer-links],[data-ai-footer-col]{flex:0 1 auto !important;width:100%;min-width:0}",
1930
1955
  "[data-ohw-footer-links]{display:flex !important;flex-direction:column !important;gap:24px !important}",
1931
1956
  "[data-ai-footer] img{max-width:100%}",
1932
1957
  "}"
@@ -3317,7 +3342,7 @@ function FooterLinkListBlock({
3317
3342
  "p",
3318
3343
  {
3319
3344
  ...textAttrs(ctx, `${path}.title`),
3320
- style: { ...typeStyle(AI_TREE_TOKENS.type.bodyMBold, ctx.brand.fonts.body), margin: 0, color: ctx.brand.palette.dark },
3345
+ style: { ...footerBodyStyle(ctx.brand.fonts.body, `var(--surface-fg, ${ctx.brand.palette.dark})`, 600), margin: 0 },
3321
3346
  children: title
3322
3347
  }
3323
3348
  ) : null,
@@ -3331,8 +3356,7 @@ function FooterLinkListBlock({
3331
3356
  href: footerLinkHref(href, ctx),
3332
3357
  ...ctx.keyFor ? { "data-ohw-href-key": ctx.keyFor(`${path}.items.${i}.href`) } : {},
3333
3358
  style: {
3334
- ...typeStyle(AI_TREE_TOKENS.type.bodyM, ctx.brand.fonts.body),
3335
- color: ctx.brand.palette.dark,
3359
+ ...footerBodyStyle(ctx.brand.fonts.body, `var(--surface-fg, ${ctx.brand.palette.dark})`),
3336
3360
  textDecoration: "none"
3337
3361
  },
3338
3362
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -3363,7 +3387,7 @@ function FooterHoursBlock({
3363
3387
  "p",
3364
3388
  {
3365
3389
  ...textAttrs(ctx, `${path}.title`),
3366
- style: { ...typeStyle(AI_TREE_TOKENS.type.bodyMBold, ctx.brand.fonts.body), margin: 0, color: ctx.brand.palette.dark },
3390
+ style: { ...footerBodyStyle(ctx.brand.fonts.body, `var(--surface-fg, ${ctx.brand.palette.dark})`, 600), margin: 0 },
3367
3391
  children: title
3368
3392
  }
3369
3393
  ) : null,
@@ -3378,8 +3402,7 @@ function FooterHoursBlock({
3378
3402
  display: "flex",
3379
3403
  justifyContent: "space-between",
3380
3404
  gap: AI_TREE_TOKENS.spacing4,
3381
- ...typeStyle(AI_TREE_TOKENS.type.bodyM, ctx.brand.fonts.body),
3382
- color: ctx.brand.palette.dark
3405
+ ...footerBodyStyle(ctx.brand.fonts.body, `var(--surface-fg, ${ctx.brand.palette.dark})`)
3383
3406
  },
3384
3407
  children: [
3385
3408
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { ...textAttrs(ctx, `${path}.items.${i}.day`), style: { margin: 0 }, children: day }),
@@ -3403,15 +3426,17 @@ function FooterLogoBlock({
3403
3426
  {
3404
3427
  src: url,
3405
3428
  alt,
3406
- ...ctx.keyFor ? { "data-ohw-key": ctx.keyFor(`${path}.alt`), "data-ohw-role": "logo" } : { "data-ohw-role": "logo" },
3407
- style: { display: "block", maxHeight: 40, width: "auto", maxWidth: "100%" }
3429
+ "data-ohw-key": "footer-logo-img",
3430
+ "data-ohw-editable": "image",
3431
+ "data-ohw-role": "logo",
3432
+ style: { display: "block", height: "2.25rem", width: "auto", maxWidth: "100%" }
3408
3433
  }
3409
3434
  ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
3410
3435
  "span",
3411
3436
  {
3412
3437
  ...textAttrs(ctx, `${path}.alt`),
3413
3438
  "data-ohw-role": "logo",
3414
- style: { ...typeStyle(AI_TREE_TOKENS.type.h3, ctx.brand.fonts.heading), color: ctx.brand.palette.dark },
3439
+ style: footerLogoStyle(ctx.brand.fonts.heading, ctx.brand.palette.primary),
3415
3440
  children: alt
3416
3441
  }
3417
3442
  ) });
@@ -4044,9 +4069,8 @@ function AiFooterRenderer({
4044
4069
  "data-ohw-key": `footer-${colIndex}-heading`,
4045
4070
  "data-ohw-editable": "text",
4046
4071
  style: {
4047
- ...typeStyle(AI_TREE_TOKENS.type.bodyMBold, resolvedBrand.fonts.body),
4048
- margin: 0,
4049
- color: bandText
4072
+ ...footerBodyStyle(resolvedBrand.fonts.body, bandText, 600),
4073
+ margin: 0
4050
4074
  },
4051
4075
  children: title
4052
4076
  }
@@ -4061,8 +4085,7 @@ function AiFooterRenderer({
4061
4085
  href: footerLinkHref(href, ctx),
4062
4086
  "data-ohw-href-key": `footer-${colIndex}-${i}-href`,
4063
4087
  style: {
4064
- ...typeStyle(AI_TREE_TOKENS.type.bodyM, resolvedBrand.fonts.body),
4065
- color: bandText,
4088
+ ...footerBodyStyle(resolvedBrand.fonts.body, bandText),
4066
4089
  textDecoration: "none"
4067
4090
  },
4068
4091
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -4108,9 +4131,8 @@ function AiFooterRenderer({
4108
4131
  "data-ohw-key": "footer-copyright",
4109
4132
  "data-ohw-editable": "text",
4110
4133
  style: {
4111
- ...typeStyle(AI_TREE_TOKENS.type.bodyM, resolvedBrand.fonts.body),
4112
- margin: 0,
4113
- color: `color-mix(in srgb, ${bandText} 75%, transparent)`
4134
+ ...footerBodyStyle(resolvedBrand.fonts.body, bandText),
4135
+ margin: 0
4114
4136
  },
4115
4137
  children: copyright
4116
4138
  }
@@ -4122,8 +4144,7 @@ function AiFooterRenderer({
4122
4144
  href: item.href,
4123
4145
  "data-ohw-footer-legal-link": item.key,
4124
4146
  style: {
4125
- ...typeStyle(AI_TREE_TOKENS.type.bodyM, resolvedBrand.fonts.body),
4126
- color: `color-mix(in srgb, ${bandText} 75%, transparent)`,
4147
+ ...footerBodyStyle(resolvedBrand.fonts.body, bandText),
4127
4148
  textDecoration: "none"
4128
4149
  },
4129
4150
  children: item.label
@@ -4136,8 +4157,7 @@ function AiFooterRenderer({
4136
4157
  "data-ohw-footer-legal-link": item.key,
4137
4158
  onClick: item.onClick,
4138
4159
  style: {
4139
- ...typeStyle(AI_TREE_TOKENS.type.bodyM, resolvedBrand.fonts.body),
4140
- color: `color-mix(in srgb, ${bandText} 75%, transparent)`,
4160
+ ...footerBodyStyle(resolvedBrand.fonts.body, bandText),
4141
4161
  background: "none",
4142
4162
  border: "none",
4143
4163
  padding: 0,
@@ -4892,8 +4912,32 @@ function defaultLegal() {
4892
4912
  }
4893
4913
  };
4894
4914
  }
4895
- function resolveLogoFromContent(content) {
4915
+ var FOOTER_LOGO_CONTENT_KEYS = ["footer-logo-img", "footer-logo-image", "footer-logo"];
4916
+ function logoSrcFromFooterDom(footer) {
4917
+ if (!footer) return null;
4918
+ const img = footer.querySelector(
4919
+ '[data-ohw-key="footer-logo-img"], [data-ohw-key="footer-logo-image"], [data-ohw-role="logo"] img'
4920
+ );
4921
+ const raw = (img?.currentSrc || img?.getAttribute("src") || "").trim();
4922
+ if (!raw) return null;
4923
+ try {
4924
+ const url = new URL(raw, window.location.href);
4925
+ const wrapped = url.pathname.endsWith("/_next/image") ? url.searchParams.get("url") : null;
4926
+ if (wrapped) return decodeURIComponent(wrapped);
4927
+ } catch {
4928
+ }
4929
+ return raw;
4930
+ }
4931
+ function resolveLogoFromContent(content, footer) {
4896
4932
  if (mountOptions.logoUrl) return mountOptions.logoUrl;
4933
+ if (content) {
4934
+ for (const key of FOOTER_LOGO_CONTENT_KEYS) {
4935
+ const value = content[key];
4936
+ if (typeof value === "string" && value.trim()) return value.trim();
4937
+ }
4938
+ }
4939
+ const fromDom = logoSrcFromFooterDom(footer);
4940
+ if (fromDom) return fromDom;
4897
4941
  if (!content) return null;
4898
4942
  const canonical = content[LOGO_IMAGE_URL_KEY];
4899
4943
  if (typeof canonical === "string" && canonical.trim()) return canonical.trim();
@@ -4916,11 +4960,11 @@ function applyAiFooterToDom(state, content) {
4916
4960
  unmountAiFooter();
4917
4961
  return;
4918
4962
  }
4919
- const brand = mountOptions.brand ?? deriveTemplateBrand();
4920
- const logoUrl = resolveLogoFromContent(content);
4921
4963
  const templateFooter = findTemplateFooter();
4922
4964
  captureTemplateFooterSurface(templateFooter);
4923
4965
  const surface = capturedSurface ?? null;
4966
+ const brand = mountOptions.brand ?? deriveTemplateBrand();
4967
+ const logoUrl = resolveLogoFromContent(content, templateFooter);
4924
4968
  const serialized = JSON.stringify(state) + JSON.stringify(brand ?? null) + (logoUrl ?? "") + JSON.stringify(surface) + JSON.stringify(defaultLegal());
4925
4969
  if (mounted2 && mounted2.serialized === serialized && mounted2.container.isConnected) {
4926
4970
  hideTemplateFooter(templateFooter);
@@ -29193,7 +29237,7 @@ function OhhwellsBridge() {
29193
29237
  postToParent2({
29194
29238
  type: "ow:ready",
29195
29239
  version: "1",
29196
- bridgeVersion: "0.1.128",
29240
+ bridgeVersion: "0.1.129",
29197
29241
  path: pathname,
29198
29242
  nodes: collectEditableNodes(editContentRef.current),
29199
29243
  sections