@ohhwells/bridge 0.1.71-next.218 → 0.1.72-next.225

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
@@ -533,6 +533,24 @@ var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.t
533
533
  var CHECK_MASK = `data:image/svg+xml,${encodeURIComponent(
534
534
  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>'
535
535
  )}`;
536
+ var AI_MOBILE_CSS = [
537
+ "@media (max-width: 768px){",
538
+ "[data-ai-section]{overflow-x:hidden}",
539
+ "[data-ai-container]{padding:0 20px !important}",
540
+ "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
541
+ "[data-ai-cell]{width:100%;min-width:0}",
542
+ "[data-ai-grid]{grid-template-columns:1fr !important}",
543
+ // Group containers flatten to a column on phones; span placements come along for free.
544
+ "[data-ai-group]{display:flex !important;flex-direction:column !important}",
545
+ "[data-ai-group] > *{grid-column:auto !important}",
546
+ // The 50:50 form collapses to a single stacked column on phones.
547
+ "[data-ai-form]{grid-template-columns:1fr !important}",
548
+ "[data-ai-section] img{max-width:100%}",
549
+ "}",
550
+ "@media (min-width: 769px) and (max-width: 1024px){",
551
+ "[data-ai-grid]{grid-template-columns:repeat(2, 1fr) !important}",
552
+ "}"
553
+ ].join("");
536
554
  var FEATURE_LINE_CSS = [
537
555
  "[data-ai-features]>div{position:relative;padding-left:40px;min-height:24px}",
538
556
  '[data-ai-features]>div::before{content:"";position:absolute;left:0;top:1px;width:24px;height:24px;',
@@ -1651,63 +1669,84 @@ function renderNode(node, ctx, path) {
1651
1669
  outline: "none",
1652
1670
  ...typeStyle(AI_TREE_TOKENS.type.bodyM, ctx.brand.fonts.body)
1653
1671
  };
1654
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { ...formAttrs, style: { display: "flex", flexDirection: "column", gap: AI_TREE_TOKENS.spacing4 }, children: (node.children ?? []).map((child, i) => {
1655
- if (child.type === "input") {
1656
- const cs2 = child.slots ?? {};
1657
- const kind = str(cs2.kind);
1658
- const label = str(cs2.label);
1659
- const placeholder = str(cs2.placeholder);
1660
- const name = label.toLowerCase().replace(/[^a-z0-9]+/gu, "-").replace(/^-+|-+$/gu, "") || `field-${i}`;
1661
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1662
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1663
- "label",
1672
+ const labelStyle = {
1673
+ ...typeStyle(AI_TREE_TOKENS.type.bodyMBold, ctx.brand.fonts.body),
1674
+ color: ctx.brand.palette.dark
1675
+ };
1676
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1677
+ "form",
1678
+ {
1679
+ ...formAttrs,
1680
+ "data-ai-form": "",
1681
+ style: {
1682
+ display: "grid",
1683
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
1684
+ columnGap: 64,
1685
+ rowGap: AI_TREE_TOKENS.spacing4
1686
+ },
1687
+ children: (node.children ?? []).map((child, i) => {
1688
+ if (child.type === "input") {
1689
+ const cs2 = child.slots ?? {};
1690
+ const kind = str(cs2.kind);
1691
+ const label = str(cs2.label);
1692
+ const placeholder = str(cs2.placeholder);
1693
+ const name = label.toLowerCase().replace(/[^a-z0-9]+/gu, "-").replace(/^-+|-+$/gu, "") || `field-${i}`;
1694
+ const isTextarea = kind === "textarea";
1695
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1696
+ "div",
1697
+ {
1698
+ style: {
1699
+ display: "flex",
1700
+ flexDirection: "column",
1701
+ gap: 8,
1702
+ ...isTextarea ? { gridColumn: "1 / -1", maxWidth: 780 } : {}
1703
+ },
1704
+ children: [
1705
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { ...textAttrs(ctx, `${path}.c${i}.label`), style: labelStyle, children: label }),
1706
+ isTextarea ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1707
+ "textarea",
1708
+ {
1709
+ name,
1710
+ placeholder,
1711
+ style: { ...fieldStyle, height: 140, resize: "vertical" }
1712
+ }
1713
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1714
+ "input",
1715
+ {
1716
+ name,
1717
+ type: kind === "email" ? "email" : "text",
1718
+ placeholder,
1719
+ style: { ...fieldStyle, height: 48 }
1720
+ }
1721
+ )
1722
+ ]
1723
+ },
1724
+ i
1725
+ );
1726
+ }
1727
+ const cs = child.slots ?? {};
1728
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1729
+ "button",
1664
1730
  {
1665
- ...textAttrs(ctx, `${path}.c${i}.label`),
1731
+ type: "submit",
1666
1732
  style: {
1667
- ...typeStyle(AI_TREE_TOKENS.type.bodyMBold, ctx.brand.fonts.body),
1668
- color: ctx.brand.palette.dark
1733
+ gridColumn: "1 / -1",
1734
+ justifySelf: "start",
1735
+ border: "none",
1736
+ cursor: "pointer",
1737
+ padding: `${AI_TREE_TOKENS.spacing3}px ${AI_TREE_TOKENS.spacing6}px`,
1738
+ borderRadius: AI_TREE_TOKENS.radiusButton,
1739
+ background: ctx.brand.palette.primary,
1740
+ color: AI_TREE_TOKENS.textPrimaryForeground,
1741
+ ...typeStyle(AI_TREE_TOKENS.type.button, ctx.brand.fonts.body)
1669
1742
  },
1670
- children: label
1671
- }
1672
- ),
1673
- kind === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1674
- "textarea",
1675
- {
1676
- name,
1677
- placeholder,
1678
- style: { ...fieldStyle, height: 140, resize: "vertical" }
1679
- }
1680
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1681
- "input",
1682
- {
1683
- name,
1684
- type: kind === "email" ? "email" : "text",
1685
- placeholder,
1686
- style: { ...fieldStyle, height: 48 }
1687
- }
1688
- )
1689
- ] }, i);
1743
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ...textAttrs(ctx, `${path}.c${i}.label`), children: str(cs.label) })
1744
+ },
1745
+ i
1746
+ );
1747
+ })
1690
1748
  }
1691
- const cs = child.slots ?? {};
1692
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1693
- "button",
1694
- {
1695
- type: "submit",
1696
- style: {
1697
- alignSelf: "flex-start",
1698
- border: "none",
1699
- cursor: "pointer",
1700
- padding: `${AI_TREE_TOKENS.spacing3}px ${AI_TREE_TOKENS.spacing6}px`,
1701
- borderRadius: AI_TREE_TOKENS.radiusButton,
1702
- background: ctx.brand.palette.primary,
1703
- color: AI_TREE_TOKENS.textPrimaryForeground,
1704
- ...typeStyle(AI_TREE_TOKENS.type.button, ctx.brand.fonts.body)
1705
- },
1706
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ...textAttrs(ctx, `${path}.c${i}.label`), children: str(cs.label) })
1707
- },
1708
- i
1709
- );
1710
- }) });
1749
+ );
1711
1750
  }
1712
1751
  case "schedule-widget":
1713
1752
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1780,6 +1819,7 @@ function AiTreeRenderer({ tree, brand, resolveMedia, editKeyPrefix }) {
1780
1819
  },
1781
1820
  children: [
1782
1821
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
1822
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
1783
1823
  isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
1784
1824
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1785
1825
  "div",
@@ -17755,6 +17795,9 @@ function OhhwellsBridge() {
17755
17795
  if (typeof content[BRAND_KIT_KEY] === "string") {
17756
17796
  brandKitRef.current = content[BRAND_KIT_KEY];
17757
17797
  applyBrandToDom(parseBrandKit(content[BRAND_KIT_KEY]));
17798
+ } else {
17799
+ brandKitRef.current = "";
17800
+ applyBrandToDom(null);
17758
17801
  }
17759
17802
  if (typeof content[AI_SECTIONS_KEY] === "string") {
17760
17803
  aiSectionsRef.current = content[AI_SECTIONS_KEY];
@@ -17958,6 +18001,8 @@ function OhhwellsBridge() {
17958
18001
  applyBrandChrome(content);
17959
18002
  if (typeof content[BRAND_KIT_KEY] === "string") {
17960
18003
  applyBrandToDom(parseBrandKit(content[BRAND_KIT_KEY]));
18004
+ } else {
18005
+ applyBrandToDom(null);
17961
18006
  }
17962
18007
  if (typeof content[AI_SECTIONS_KEY] === "string") {
17963
18008
  applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
@@ -19848,6 +19893,9 @@ function OhhwellsBridge() {
19848
19893
  if (typeof content[BRAND_KIT_KEY] === "string") {
19849
19894
  brandKitRef.current = content[BRAND_KIT_KEY];
19850
19895
  applyBrandToDom(parseBrandKit(content[BRAND_KIT_KEY]));
19896
+ } else {
19897
+ brandKitRef.current = "";
19898
+ applyBrandToDom(null);
19851
19899
  }
19852
19900
  if (typeof content[AI_SECTIONS_KEY] === "string") {
19853
19901
  aiSectionsRef.current = content[AI_SECTIONS_KEY];
@@ -21023,7 +21071,7 @@ function OhhwellsBridge() {
21023
21071
  postToParent2({
21024
21072
  type: "ow:ready",
21025
21073
  version: "1",
21026
- bridgeVersion: "0.1.71-next.218",
21074
+ bridgeVersion: "0.1.72",
21027
21075
  path: pathname,
21028
21076
  nodes: collectEditableNodes(editContentRef.current),
21029
21077
  sections