@ohhwells/bridge 0.1.79-next.241 → 0.1.80-next.242

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
@@ -407,7 +407,19 @@ var SECTION_ATTRS = {
407
407
  spacing: "data-ohw-style-spacing"
408
408
  };
409
409
  var NODE_WROTE_ATTR = "data-ohw-style-node";
410
- var NODE_PROPS = ["color", "font-family", "font-size", "background"];
410
+ var NODE_PROPS = [
411
+ "color",
412
+ "font-family",
413
+ "font-size",
414
+ "background",
415
+ "text-align",
416
+ "justify-content"
417
+ ];
418
+ var ALIGN_JUSTIFY = {
419
+ left: "flex-start",
420
+ center: "center",
421
+ right: "flex-end"
422
+ };
411
423
  function saveInline(el, prop) {
412
424
  const attr = `data-ohw-style-prev-${prop}`;
413
425
  if (el.hasAttribute(attr)) return;
@@ -496,6 +508,13 @@ function applyStylesToDom(store) {
496
508
  el.style.setProperty("font-size", `${override.fontSize}px`, "important");
497
509
  el.setAttribute(NODE_WROTE_ATTR, "");
498
510
  }
511
+ if (override.align !== void 0) {
512
+ saveInline(el, "text-align");
513
+ saveInline(el, "justify-content");
514
+ el.style.setProperty("text-align", override.align, "important");
515
+ el.style.setProperty("justify-content", ALIGN_JUSTIFY[override.align] ?? "flex-start", "important");
516
+ el.setAttribute(NODE_WROTE_ATTR, "");
517
+ }
499
518
  if (override.buttonBackground !== void 0 || override.buttonText !== void 0) {
500
519
  const surface = buttonSurfaceOf(el);
501
520
  if (override.buttonBackground !== void 0) {
@@ -1820,6 +1839,19 @@ function AiTreeRenderer({
1820
1839
  }
1821
1840
  })();
1822
1841
  const distributed = !isOverlay && settings.textDistribution;
1842
+ const rowAlignItems = (rowAlign) => {
1843
+ if (rowAlign === "top") return "start";
1844
+ if (rowAlign === "bottom") return "end";
1845
+ if (rowAlign === "center" || rowAlign === "stretch") return rowAlign;
1846
+ if (distributed === "space-between") return "stretch";
1847
+ return (distributed ?? settings.verticalPosition) === "top" ? "start" : "center";
1848
+ };
1849
+ const cellAlignStyle = (blockAlign) => blockAlign ? {
1850
+ display: "flex",
1851
+ flexDirection: "column",
1852
+ alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
1853
+ textAlign: blockAlign
1854
+ } : {};
1823
1855
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1824
1856
  "section",
1825
1857
  {
@@ -1858,7 +1890,7 @@ function AiTreeRenderer({
1858
1890
  display: "grid",
1859
1891
  gridTemplateColumns: "repeat(12, 1fr)",
1860
1892
  gap: AI_TREE_TOKENS.spacing6,
1861
- alignItems: distributed === "space-between" ? "stretch" : (distributed ?? settings.verticalPosition) === "top" ? "start" : "center",
1893
+ alignItems: rowAlignItems(row.align),
1862
1894
  marginTop: r2 > 0 ? AI_TREE_TOKENS.spacing8 : 0
1863
1895
  },
1864
1896
  children: (row.blocks ?? []).map((block, b) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1868,6 +1900,8 @@ function AiTreeRenderer({
1868
1900
  style: {
1869
1901
  gridColumn: `span ${Math.min(12, Math.max(1, block.span))}`,
1870
1902
  minWidth: 0,
1903
+ // Horizontal placement of the block's content within its column.
1904
+ ...cellAlignStyle(block.align),
1871
1905
  // space-between: each column becomes a flex column whose content spreads over
1872
1906
  // the full row height instead of clumping at the top.
1873
1907
  ...distributed === "space-between" ? { display: "flex", flexDirection: "column", justifyContent: "space-between" } : {}
@@ -21227,7 +21261,7 @@ function OhhwellsBridge() {
21227
21261
  postToParent2({
21228
21262
  type: "ow:ready",
21229
21263
  version: "1",
21230
- bridgeVersion: "0.1.79",
21264
+ bridgeVersion: "0.1.80",
21231
21265
  path: pathname,
21232
21266
  nodes: collectEditableNodes(editContentRef.current),
21233
21267
  sections