@bravostudioai/react 0.1.13 → 0.1.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,0DACsB,CAAC;AAE1D,eAAO,MAAM,wBAAwB,oDACc,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,0DACsB,CAAC;AAG1D,eAAO,MAAM,wBAAwB,oDACc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EncoreActionContext.js","sources":["../../src/contexts/EncoreActionContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport type EncoreActionPayload = {\n bravo: {\n cancel: () => void;\n action: any;\n };\n};\n\ntype EncoreActionContextType = {\n onAction?: (payload: EncoreActionPayload) => void | Promise<void>;\n};\n\nconst EncoreActionContext = React.createContext<EncoreActionContextType>({});\n\nexport default EncoreActionContext;\n\n\n"],"names":["EncoreActionContext","React"],"mappings":";AAaA,MAAMA,IAAsBC,EAAM,cAAuC,CAAA,CAAE;"}
1
+ {"version":3,"file":"EncoreActionContext.js","sources":["../../src/contexts/EncoreActionContext.ts"],"sourcesContent":["import React from \"react\";\n\nexport type EncoreActionPayload = {\n bravo: {\n cancel: () => void;\n action: any;\n componentId?: string; // ID of the component that triggered the action\n };\n};\n\ntype EncoreActionContextType = {\n onAction?: (payload: EncoreActionPayload) => void | Promise<void>;\n};\n\nconst EncoreActionContext = React.createContext<EncoreActionContextType>({});\n\nexport default EncoreActionContext;\n"],"names":["EncoreActionContext","React"],"mappings":";AAcA,MAAMA,IAAsBC,EAAM,cAAuC,CAAA,CAAE;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../constants.ts"],"sourcesContent":["export const CONST_APPS_SERVICE_URL =\n \"https://apps-service-585087176299.us-central1.run.app\";\n\nexport const CONST_COMPONENTS_CDN_URL =\n \"https://bsai-public.sfo3.digitaloceanspaces.com\";\n"],"names":["CONST_APPS_SERVICE_URL","CONST_COMPONENTS_CDN_URL"],"mappings":"AAAO,MAAMA,IACX,yDAEWC,IACX;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../constants.ts"],"sourcesContent":["export const CONST_APPS_SERVICE_URL =\n \"https://apps-service-585087176299.us-central1.run.app\";\n// export const CONST_APPS_SERVICE_URL = \"http://localhost:3001\";\n\nexport const CONST_COMPONENTS_CDN_URL =\n \"https://bsai-public.sfo3.digitaloceanspaces.com\";\n"],"names":["CONST_APPS_SERVICE_URL","CONST_COMPONENTS_CDN_URL"],"mappings":"AAAO,MAAMA,IACX,yDAGWC,IACX;"}
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AA6hGf,QAAA,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAoDxD,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AA6jGf,QAAA,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAoDxD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -3,6 +3,7 @@ export type EncoreActionPayload = {
3
3
  bravo: {
4
4
  cancel: () => void;
5
5
  action: any;
6
+ componentId?: string;
6
7
  };
7
8
  };
8
9
  type EncoreActionContextType = {
@@ -1 +1 @@
1
- {"version":3,"file":"EncoreActionContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/EncoreActionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,MAAM,EAAE,GAAG,CAAC;KACb,CAAC;CACH,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC;AAEF,QAAA,MAAM,mBAAmB,wCAAmD,CAAC;AAE7E,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"EncoreActionContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/EncoreActionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,MAAM,EAAE,GAAG,CAAC;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC;AAEF,QAAA,MAAM,mBAAmB,wCAAmD,CAAC;AAE7E,eAAe,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bravostudioai/react",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -136,12 +136,7 @@ const useEncoreStyle = (
136
136
 
137
137
  if (!style) return undefined;
138
138
 
139
- // DEBUG: Log style for specific components
140
- const debugIds = [
141
- "01KB929X1DQJN954WNGF5AH38B", // Slider
142
- "01KB929X1KK5TX0K8VBNP6ZDPG", // Hero Container
143
- "01KB929X17VWVF3A2J2DY0KHC5", // Page
144
- ];
139
+ if (!style) return undefined;
145
140
  // We don't have 'id' here directly in useEncoreStyle, but we can try to infer or pass it.
146
141
  // Actually, let's just log if we see interesting positioning values or if we can pass ID.
147
142
  // Since we can't easily pass ID without changing signature, let's add logging in the components themselves.
@@ -196,10 +191,18 @@ const useEncoreStyle = (
196
191
  : style.positioning.left;
197
192
 
198
193
  // HEURISTIC: Detect if element should be centered horizontally
194
+ let shouldCenterHorizontally = false;
195
+
196
+ // Explicit valid check from StyleDto
197
+ if (style.horizontalPosition === "center") {
198
+ shouldCenterHorizontally = true;
199
+ }
200
+
199
201
  // If element has explicit width that's nearly full-width (>= 95% of container) and left position
200
202
  // is in the range 15-35% (which suggests the element should be centered but is
201
203
  // currently positioned from its left edge), center it using transform
202
204
  if (
205
+ !shouldCenterHorizontally &&
203
206
  hasExplicitDimensions &&
204
207
  style.layout?.layoutSizingHorizontal === "FIXED" &&
205
208
  style.layout?.size?.x
@@ -250,6 +253,7 @@ const useEncoreStyle = (
250
253
  result.left = "50%";
251
254
  result.right = "auto";
252
255
  }
256
+ result.transform = "translateX(-50%)";
253
257
  } else {
254
258
  if (hasInset) {
255
259
  // Preserve original inset if not centering
@@ -401,6 +405,12 @@ const useEncoreStyle = (
401
405
  result.width = style.layout.size.x * scale;
402
406
  }
403
407
 
408
+ // HUG sizing: explicitly do NOT set width
409
+ // Let flex layout determine width based on content
410
+ if (style.layout?.layoutSizingHorizontal === "HUG") {
411
+ // Don't set result.width
412
+ }
413
+
404
414
  if (style.layout?.layoutSizingVertical === "FIXED") {
405
415
  const scale = pageContext.scaleFactor ?? 1;
406
416
  result.height = style.layout.size.y * scale;
@@ -1578,6 +1588,7 @@ const TextComponent: React.FC<ComponentProps> = ({ id, name, nodeData }) => {
1578
1588
  const styleWithFont = nodeData.fontId
1579
1589
  ? { ...bravoStyle, fontId: nodeData.fontId }
1580
1590
  : bravoStyle;
1591
+
1581
1592
  const style = useEncoreStyle(styleWithFont, {
1582
1593
  debug: false,
1583
1594
  });