@bravostudioai/react 0.1.35 → 0.1.38

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,6 +1,12 @@
1
- import { createContext as t } from "react";
2
- const o = t({});
1
+ import { createContext as e } from "react";
2
+ const d = e({
3
+ nodeData: void 0,
4
+ // Changed from null to undefined for consistency with other optional properties
5
+ textOverridesById: void 0,
6
+ arrayDataById: void 0,
7
+ embedsById: void 0
8
+ });
3
9
  export {
4
- o as default
10
+ d as default
5
11
  };
6
12
  //# sourceMappingURL=EncoreBindingContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EncoreBindingContext.js","sources":["../../src/contexts/EncoreBindingContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\n\ntype EncoreBindingContext = {};\nconst EncoreBindingContext = createContext({});\n\nexport default EncoreBindingContext;\n"],"names":["EncoreBindingContext","createContext"],"mappings":";AAKA,MAAMA,IAAuBC,EAAc,CAAA,CAAE;"}
1
+ {"version":3,"file":"EncoreBindingContext.js","sources":["../../src/contexts/EncoreBindingContext.ts"],"sourcesContent":["\"use client\";\n\nimport React, { createContext } from \"react\";\n\ntype EncoreBindingContextType = {\n nodeData?: any; // Assuming nodeData is part of the context based on the default value\n textOverridesById?: Record<string, string>; // Assuming textOverridesById is part of the context\n /**\n * Data provided by parent component (from `encore:data:array` tag)\n */\n arrayDataById?: Record<string, any[]>;\n /**\n * Embeddable components provided by parent component\n */\n embedsById?: Record<string, React.ReactNode>;\n};\n\nconst EncoreBindingContext = createContext<EncoreBindingContextType>({\n nodeData: undefined, // Changed from null to undefined for consistency with other optional properties\n textOverridesById: undefined,\n arrayDataById: undefined,\n embedsById: undefined,\n});\n\nexport default EncoreBindingContext;\n"],"names":["EncoreBindingContext","createContext"],"mappings":";AAiBA,MAAMA,IAAuBC,EAAwC;AAAA,EACnE,UAAU;AAAA;AAAA,EACV,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,YAAY;AACd,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/codegen/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,QAAQ,EACR,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAOjB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yBAAyB;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,kCAAkC;IAClC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,UAAU,EAAE,EACrB,oBAAoB,EAAE,aAAa,EAAE,EACrC,WAAW,EAAE,cAAc,EAAE,EAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,YAAY,EAAE,eAAe,EAAE,EAC/B,aAAa,EAAE,gBAAgB,EAAE,EACjC,IAAI,GAAE,MAAkB,EACxB,QAAQ,CAAC,EAAE;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,MAAM,CAoaR;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,UAAU,EAAE,EACrB,oBAAoB,EAAE,aAAa,EAAE,EACrC,WAAW,EAAE,cAAc,EAAE,EAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,YAAY,EAAE,eA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EAAE,MAAM,EAAE,GACnB,MAAM,CA8BR;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,MAAM,EAAE,EAAE,GACrB,MAAM,EAAE,CA6DV;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAG7D;AAED,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,MAAM,CA+BR;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAiBlE;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,GAAG,GAAG,UAAU,EAAE,CAoOtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,GAAG,GAAG,aAAa,EAAE,CA8GvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG,GAAG,cAAc,EAAE,CA0D/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,EAAE,CAkJnD;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,QAAQ,EAAE,GAChB,eAAe,EAAE,CAqEnB;AASD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,GAAG,gBAAgB,EAAE,CAuGnE;AASD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAIzD"}
@@ -45,6 +45,8 @@ export type EncoreAppProps = {
45
45
  componentCode?: string;
46
46
  /** Deployment mode: dynamic (default), optimistic, or production */
47
47
  mode?: "dynamic" | "optimistic" | "production";
48
+ /** Map of embedded components by ID */
49
+ embeds?: Record<string, React.ReactNode>;
48
50
  };
49
51
  type Props = EncoreAppProps;
50
52
  /**
@@ -81,6 +83,6 @@ type Props = EncoreAppProps;
81
83
  * }}
82
84
  * />
83
85
  */
84
- declare const EncoreApp: ({ appId, pageId, componentId, fallback, onSizeChange, onContentSizeChange, onAction, data, source, repeatingContainerControls, inputGroups, baseURL, appDefinition, pageDefinition, componentCode, mode, }: Props) => import("react/jsx-runtime").JSX.Element;
86
+ declare const EncoreApp: ({ appId, pageId, componentId, fallback, onSizeChange, onContentSizeChange, onAction, data, source, repeatingContainerControls, inputGroups, baseURL, appDefinition, pageDefinition, componentCode, mode, embeds, }: Props) => import("react/jsx-runtime").JSX.Element;
85
87
  export default EncoreApp;
86
88
  //# sourceMappingURL=EncoreApp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EncoreApp.d.ts","sourceRoot":"","sources":["../../../src/components/EncoreApp.tsx"],"names":[],"mappings":"AAIA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AA4B3E;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qDAAqD;IACrD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACjE,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACxE,oGAAoG;IACpG,QAA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EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,IAAI,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,YAAY,CAAC;IAC/C,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC1C,CAAC;AAEF,KAAK,KAAK,GAAG,cAAc,CAAC;AAe5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,QAAA,MAAM,SAAS,GAAI,oNAkBhB,KAAK,4CAwWP,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AAmkGf,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;AA8sGf,QAAA,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAuDxD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,4 +1,16 @@
1
- type EncoreBindingContext = {};
2
- declare const EncoreBindingContext: import("react").Context<{}>;
1
+ import React from "react";
2
+ type EncoreBindingContextType = {
3
+ nodeData?: any;
4
+ textOverridesById?: Record<string, string>;
5
+ /**
6
+ * Data provided by parent component (from `encore:data:array` tag)
7
+ */
8
+ arrayDataById?: Record<string, any[]>;
9
+ /**
10
+ * Embeddable components provided by parent component
11
+ */
12
+ embedsById?: Record<string, React.ReactNode>;
13
+ };
14
+ declare const EncoreBindingContext: React.Context<EncoreBindingContextType>;
3
15
  export default EncoreBindingContext;
4
16
  //# sourceMappingURL=EncoreBindingContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EncoreBindingContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/EncoreBindingContext.ts"],"names":[],"mappings":"AAIA,KAAK,oBAAoB,GAAG,EAAE,CAAC;AAC/B,QAAA,MAAM,oBAAoB,6BAAoB,CAAC;AAE/C,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"EncoreBindingContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/EncoreBindingContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAM,oBAAoB,yCAKxB,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const PACKAGE_VERSION = "0.1.35";
1
+ export declare const PACKAGE_VERSION = "0.1.38";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "0.1.35";
1
+ const o = "0.1.38";
2
2
  export {
3
3
  o as PACKAGE_VERSION
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = \"0.1.35\";\n"],"names":["PACKAGE_VERSION"],"mappings":"AAAO,MAAMA,IAAkB;"}
1
+ {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = \"0.1.38\";\n"],"names":["PACKAGE_VERSION"],"mappings":"AAAO,MAAMA,IAAkB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bravostudioai/react",
3
- "version": "0.1.35",
3
+ "version": "0.1.38",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -202,13 +202,25 @@ ${itemProps}
202
202
 
203
203
  // Generate data mapping
204
204
  const dataMapping: string[] = [];
205
+ const embedsMapping: string[] = [];
205
206
  const controlMapping: string[] = [];
206
207
 
207
208
  // Add standalone component mappings
208
209
  standaloneComponents.forEach((comp) => {
209
210
  const propKey = getComponentPropName(comp.type);
210
- dataMapping.push(` // ${comp.name}
211
+ if (
212
+ comp.type === "component:webview" ||
213
+ comp.type === "component:web-view"
214
+ ) {
215
+ dataMapping.push(` // ${comp.name}
216
+ ...(props.${comp.propName} !== undefined && { "${comp.id}": { params: { url: props.${comp.propName} } } as any }),`);
217
+ } else if (comp.type === "component:embed") {
218
+ embedsMapping.push(` // ${comp.name}
219
+ ...(props.${comp.propName} !== undefined && { "${comp.id}": props.${comp.propName} }),`);
220
+ } else {
221
+ dataMapping.push(` // ${comp.name}
211
222
  ...(props.${comp.propName} !== undefined && { "${comp.id}": { ${propKey}: props.${comp.propName} } as any }),`);
223
+ }
212
224
  });
213
225
 
214
226
  // Add select input mappings (for controlled values and options)
@@ -228,6 +240,15 @@ ${itemProps}
228
240
  const itemMapping = container.components
229
241
  .map((comp) => {
230
242
  const propKey = getComponentPropName(comp.type);
243
+ if (
244
+ comp.type === "component:webview" ||
245
+ comp.type === "component:web-view"
246
+ ) {
247
+ return ` // ${comp.name}
248
+ "${comp.id}": {
249
+ params: { url: item.${comp.propName} },
250
+ }`;
251
+ }
231
252
  return ` // ${comp.name}
232
253
  "${comp.id}": {
233
254
  ${propKey}: item.${comp.propName},
@@ -445,6 +466,13 @@ ${inputGroupMapping.join("\n")}
445
466
  const onActionCode =
446
467
  inputGroupHandlers.length > 0 ? `\n onAction={handleAction}` : "";
447
468
 
469
+ const embedsCode =
470
+ embedsMapping.length > 0
471
+ ? `\n embeds={{
472
+ ${embedsMapping.join("\n")}
473
+ }}`
474
+ : "";
475
+
448
476
  const propsParameter = hasProps ? `props: ${componentName}Props` : "";
449
477
  const propsInterfaceSection = propsInterface ? `${propsInterface}\n\n` : "";
450
478
 
@@ -480,7 +508,7 @@ ${inputGroupHandlers.length > 0 ? inputGroupHandlers.join("\n") : ""}
480
508
  }
481
509
  data={{
482
510
  ${dataMapping.join("\n")}
483
- }}${repeatingContainerControlsCode}${inputGroupsCode}${onActionCode}
511
+ }}${repeatingContainerControlsCode}${inputGroupsCode}${onActionCode}${embedsCode}
484
512
  />
485
513
  );
486
514
  }
@@ -181,6 +181,21 @@ export function getComponentPropType(
181
181
  }
182
182
  return "string"; // text inputs, email, password, etc.
183
183
  }
184
+ if (
185
+ componentType === "component:webview" ||
186
+ componentType === "component:web-view"
187
+ ) {
188
+ return "string"; // url
189
+ }
190
+ if (componentType === "component:video") {
191
+ return "string"; // videoUrl
192
+ }
193
+ if (componentType === "component:video") {
194
+ return "string"; // videoUrl
195
+ }
196
+ if (componentType === "component:embed") {
197
+ return "React.ReactNode";
198
+ }
184
199
  // Default to any for unknown types
185
200
  return "any";
186
201
  }
@@ -192,6 +207,15 @@ export function getComponentPropName(componentType: string): string {
192
207
  if (componentType === "component:text") {
193
208
  return "text";
194
209
  }
210
+ if (
211
+ componentType === "component:webview" ||
212
+ componentType === "component:web-view"
213
+ ) {
214
+ return "url";
215
+ }
216
+ if (componentType === "component:video") {
217
+ return "videoUrl";
218
+ }
195
219
  return "value";
196
220
  }
197
221
 
@@ -466,11 +490,18 @@ export function findStandaloneComponents(pageData: any): ComponentInfo[] {
466
490
  // Skip if we're inside a slider
467
491
  if (parentId && sliderIds.has(parentId)) return;
468
492
 
469
- // Check if this component has bravo:data tag
470
- if (
493
+ // Check if this component has bravo:data tag OR is an embed component
494
+ const hasDataTag =
471
495
  Array.isArray(node.tags) &&
472
- (node.tags.includes("encore:data") || node.tags.includes("bravo:data")) &&
473
- (node.type === "component:text" || node.type === "component:image")
496
+ (node.tags.includes("encore:data") || node.tags.includes("bravo:data"));
497
+
498
+ if (
499
+ node.type === "component:embed" ||
500
+ node.type === "component:webview" ||
501
+ node.type === "component:web-view" ||
502
+ node.type === "component:video" ||
503
+ (hasDataTag &&
504
+ (node.type === "component:text" || node.type === "component:image"))
474
505
  ) {
475
506
  const basePropName = sanitizePropName(node.name || "item");
476
507
  const propType = getComponentPropType(node.type, node.name);
@@ -857,9 +888,26 @@ function qualifySelectInputs(selectInputs: SelectInputInfo[]): void {
857
888
  export function findActionButtons(pageData: any): ActionButtonInfo[] {
858
889
  const buttons: ActionButtonInfo[] = [];
859
890
 
891
+ console.log(
892
+ "[DEBUG] local encore-lib findActionButtons running via alias. Check node.actions support."
893
+ );
894
+
860
895
  function traverse(node: any, parentPath: string[] = []): void {
861
896
  if (!node || typeof node !== "object") return;
862
897
 
898
+ // Log nodes with potentially interesting properties for debugging
899
+ if (
900
+ node.id === "01KF5PAFFVFSKY6QJZXQTC99P5" ||
901
+ (node.tags && node.tags.some((t: string) => t.includes("action")))
902
+ ) {
903
+ console.log(`[DEBUG] traverse node ${node.name} (${node.id})`, {
904
+ type: node.type,
905
+ tags: node.tags,
906
+ hasActions: !!node.actions,
907
+ actionsKeys: node.actions ? Object.keys(node.actions) : [],
908
+ });
909
+ }
910
+
863
911
  // Check if this component has an action tag or actions defined
864
912
  const hasActionTag =
865
913
  Array.isArray(node.tags) &&
@@ -881,6 +929,12 @@ export function findActionButtons(pageData: any): ActionButtonInfo[] {
881
929
  actionType = node.actions.tap.action;
882
930
  }
883
931
 
932
+ console.log(`[DEBUG] Found action button: ${node.name} (${node.id})`, {
933
+ actionType,
934
+ hasActionTag,
935
+ hasActions,
936
+ });
937
+
884
938
  const basePropName = sanitizePropName(node.name || "button");
885
939
  buttons.push({
886
940
  id: node.id,
@@ -78,6 +78,8 @@ export type EncoreAppProps = {
78
78
  componentCode?: string;
79
79
  /** Deployment mode: dynamic (default), optimistic, or production */
80
80
  mode?: "dynamic" | "optimistic" | "production";
81
+ /** Map of embedded components by ID */
82
+ embeds?: Record<string, React.ReactNode>;
81
83
  };
82
84
 
83
85
  type Props = EncoreAppProps;
@@ -146,6 +148,7 @@ const EncoreApp = ({
146
148
  pageDefinition,
147
149
  componentCode,
148
150
  mode,
151
+ embeds,
149
152
  }: Props) => {
150
153
  logger.debug("EncoreApp render", { appId, pageId, mode });
151
154
 
@@ -389,8 +392,10 @@ const EncoreApp = ({
389
392
  arrayDataById: data,
390
393
  // Support for standalone component data binding (encore:data tags at root level)
391
394
  rootData: data,
395
+ // Support for embedded components
396
+ embedsById: embeds,
392
397
  };
393
- }, [pageData.data?.clientData, data]);
398
+ }, [pageData.data?.clientData, data, embeds]);
394
399
 
395
400
  // Manage repeating container controls (sliders, lists)
396
401
  const repeatingContainerContextValue = useRepeatingContainers(
@@ -434,17 +434,46 @@ const useEncoreStyle = (
434
434
  }
435
435
 
436
436
  if (style.opacity) result.opacity = style.opacity * 0.01;
437
- if (style.fontId) {
438
- const fontFamily = fontIdToFamily[style.fontId] || "sans-serif";
439
- // Ensure font family name is quoted for names with spaces/special characters
440
- result.fontFamily = `"${fontFamily}"`;
441
-
442
- console.log(`[AG_DEBUG] [useEncoreStyle] Font Resolution:`, {
443
- fontId: style.fontId,
444
- resolvedFamily: fontFamily,
445
- fontWeight: style.fontWeight,
446
- finalStyle: result.fontFamily,
447
- });
437
+ // Font Family Resolution
438
+ const resolvedFontFamily =
439
+ (style.fontId ? fontIdToFamily[style.fontId] : undefined) ||
440
+ style.fontFamily ||
441
+ undefined;
442
+
443
+ if (resolvedFontFamily) {
444
+ const genericFamilies = [
445
+ "sans-serif",
446
+ "serif",
447
+ "monospace",
448
+ "cursive",
449
+ "fantasy",
450
+ "system-ui",
451
+ "ui-sans-serif",
452
+ "ui-serif",
453
+ "ui-monospace",
454
+ "ui-rounded",
455
+ ];
456
+
457
+ if (genericFamilies.includes(resolvedFontFamily.toLowerCase())) {
458
+ result.fontFamily = resolvedFontFamily;
459
+ } else {
460
+ // Ensure font family name is quoted for names with spaces/special characters
461
+ // AND append sans-serif fallback
462
+ result.fontFamily = `"${resolvedFontFamily}", sans-serif`;
463
+ }
464
+
465
+ // Keep debug log
466
+ if (opts.debug || style.fontId) {
467
+ console.log(`[AG_DEBUG] [useEncoreStyle] Font Resolution:`, {
468
+ fontId: style.fontId,
469
+ resolvedFamily: resolvedFontFamily,
470
+ styleFontFamily: style.fontFamily,
471
+ finalStyle: result.fontFamily,
472
+ });
473
+ }
474
+ } else {
475
+ // Fallback if no font is specified at all: prevent browser default Serif
476
+ result.fontFamily = "sans-serif";
448
477
  }
449
478
  if (style.borderRadius) {
450
479
  result.borderRadius = percentOfParentWidthToPx(style.borderRadius);
@@ -1050,7 +1079,8 @@ const EncoreLinkActionWrapper: React.FC<{
1050
1079
  };
1051
1080
 
1052
1081
  const WebViewComponent: React.FC<ComponentProps> = ({ id, name, nodeData }) => {
1053
- const style = useEncoreStyle(nodeData.style, {
1082
+ const { patchedNodeData } = useEncoreBinding({ id, nodeData });
1083
+ const style = useEncoreStyle(patchedNodeData.style, {
1054
1084
  debug: false,
1055
1085
  });
1056
1086
 
@@ -1060,7 +1090,59 @@ const WebViewComponent: React.FC<ComponentProps> = ({ id, name, nodeData }) => {
1060
1090
  data-name={name}
1061
1091
  data-type="WebViewComponent"
1062
1092
  style={{ border: "none", ...style }}
1063
- src={nodeData.data?.params?.url}
1093
+ src={
1094
+ patchedNodeData.data?.params?.url ||
1095
+ patchedNodeData.data?.url ||
1096
+ patchedNodeData.encoreData?.url
1097
+ }
1098
+ />
1099
+ );
1100
+ };
1101
+
1102
+ const VideoComponent: React.FC<ComponentProps> = ({ id, name, nodeData }) => {
1103
+ const { patchedNodeData } = useEncoreBinding({ id, nodeData });
1104
+ nodeData = patchedNodeData;
1105
+
1106
+ const style = useEncoreStyle(nodeData.style, {
1107
+ debug: false,
1108
+ });
1109
+ const assetsById = useEncoreState((state) => state.assetsById);
1110
+
1111
+ // Honor scale mode semantics (similar to ImageComponent)
1112
+ const scaleMode = nodeData.style?.scaleMode || "fill";
1113
+ if (scaleMode === "fill") {
1114
+ style.objectFit = "cover";
1115
+ } else if (scaleMode === "fit") {
1116
+ style.objectFit = "contain";
1117
+ }
1118
+ style.objectPosition = "center";
1119
+
1120
+ // Resolve video URL
1121
+ let videoUrl = nodeData.data?.videoUrl;
1122
+
1123
+ if (!videoUrl && nodeData.encoreData?.video) {
1124
+ videoUrl = nodeData.encoreData.video;
1125
+ }
1126
+
1127
+ // Fallback to asset URL if no encore data
1128
+ if (!videoUrl) {
1129
+ videoUrl = assetsById[nodeData.assetId]?.url;
1130
+ }
1131
+
1132
+ // Only render if we have a URL or a placeholder color/border
1133
+ if (!videoUrl && !style.backgroundColor && !style.borderColor) {
1134
+ return null;
1135
+ }
1136
+
1137
+ return (
1138
+ <video
1139
+ data-id={id}
1140
+ data-name={name}
1141
+ data-type="VideoComponent"
1142
+ style={{ ...style }}
1143
+ src={videoUrl}
1144
+ controls
1145
+ playsInline
1064
1146
  />
1065
1147
  );
1066
1148
  };
@@ -2897,8 +2979,8 @@ const PageComponent = ({ id, name, nodeData, children }) => {
2897
2979
  // Get parent container dimensions as fallback (more accurate than viewport)
2898
2980
  const parentContainerContext = useContext(EncoreContainerContext);
2899
2981
 
2900
- const originalWidth = nodeData.style.originalSize?.[0] || 1;
2901
- const originalHeight = nodeData.style.originalSize?.[1] || 1;
2982
+ const originalWidth = nodeData.style.originalSize?.[0] || 375;
2983
+ const originalHeight = nodeData.style.originalSize?.[1] || 812;
2902
2984
 
2903
2985
  // Prefer measured dimensions, then parent container dimensions, then viewport
2904
2986
  // BUT: If parent container has a fixed width that's much smaller than viewport,
@@ -2938,10 +3020,26 @@ const PageComponent = ({ id, name, nodeData, children }) => {
2938
3020
  measuredHeight = viewportHeight;
2939
3021
  }
2940
3022
 
2941
- // Calculate scale factor
2942
- const fitScale =
2943
- Math.min(measuredWidth / originalWidth, measuredHeight / originalHeight) ||
2944
- 1;
3023
+ // CHECK: Is this a mobile-first design?
3024
+ // Reuse existing originalWidth (defaults to 1 if missing)
3025
+ const isMobileDesign = originalWidth < 768; // Standard tablet/mobile threshold
3026
+
3027
+ let effectiveWidth = measuredWidth;
3028
+ let containerMaxWidth: string | number = "100%";
3029
+
3030
+ // RESPONSIVE FIX: If mobile design is viewed on a wide screen, constrain it.
3031
+ // We allow scaling up to 1.5x original size (for tablets/large phones), but not infinite stretching.
3032
+ if (isMobileDesign && measuredWidth > originalWidth * 1.5) {
3033
+ const maxAllowed = Math.round(originalWidth * 1.5);
3034
+ effectiveWidth = maxAllowed;
3035
+ containerMaxWidth = maxAllowed;
3036
+ // console.log(`[Encore] Constraining mobile page width to ${maxAllowed}px (viewport: ${measuredWidth}px)`);
3037
+ }
3038
+
3039
+ // Calculate scale factor using the effective (constrained) width
3040
+ // Use width-based scaling (Fit Width) instead of Contain (Math.min)
3041
+ // This ensures scrollable pages are not shrunk to fit the viewport height
3042
+ const fitScale = effectiveWidth / originalWidth || 1;
2945
3043
  const context = { scaleFactor: fitScale };
2946
3044
 
2947
3045
  // If componentId is specified, render only that child without page container
@@ -3056,6 +3154,11 @@ const PageComponent = ({ id, name, nodeData, children }) => {
3056
3154
  style={{
3057
3155
  width: "100%",
3058
3156
  height: "100%",
3157
+ maxWidth:
3158
+ typeof containerMaxWidth === "number"
3159
+ ? `${containerMaxWidth}px`
3160
+ : containerMaxWidth,
3161
+ margin: isMobileDesign ? "0 auto" : 0,
3059
3162
  position: "relative",
3060
3163
  overflow: "hidden",
3061
3164
  // Only use flex if we have non-background nonScrollableChildren (like top-bar)
@@ -3144,7 +3247,44 @@ const PageComponent = ({ id, name, nodeData, children }) => {
3144
3247
  );
3145
3248
  };
3146
3249
 
3250
+ const EmbedComponent: React.FC<ComponentProps> = ({
3251
+ id,
3252
+ nodeData,
3253
+ children,
3254
+ }) => {
3255
+ const bindingContext = useContext(EncoreBindingContext);
3256
+ const embed = bindingContext?.embedsById?.[id];
3257
+
3258
+ const style = useEncoreStyle(nodeData.style, { debug: false });
3259
+
3260
+ if (embed) {
3261
+ return (
3262
+ <div
3263
+ style={{
3264
+ ...style,
3265
+ display: "flex",
3266
+ flexDirection: "column",
3267
+ // Reset positioning if provided by wrapper
3268
+ position: "absolute",
3269
+ }}
3270
+ data-type="EmbedComponent"
3271
+ data-id={id}
3272
+ >
3273
+ {embed}
3274
+ </div>
3275
+ );
3276
+ }
3277
+
3278
+ // Fallback to children or empty
3279
+ return (
3280
+ <div style={style} data-type="EmbedComponent-Empty" data-id={id}>
3281
+ {children}
3282
+ </div>
3283
+ );
3284
+ };
3285
+
3147
3286
  const components: Record<string, React.ComponentType<any>> = {
3287
+ EmbedComponent,
3148
3288
  WebViewComponent,
3149
3289
  ColorComponent,
3150
3290
  GradientComponent,
@@ -3187,6 +3327,7 @@ const components: Record<string, React.ComponentType<any>> = {
3187
3327
  "component:stateful-compound": StatefulCompoundComponent,
3188
3328
  "component:slider": SliderComponent,
3189
3329
  "component:webview": WebViewComponent,
3330
+ "component:video": VideoComponent,
3190
3331
  "component:lottie": LottieComponent,
3191
3332
  "component:email-input": EmailInputComponent,
3192
3333
  "component:text-input": TextInputComponent,
@@ -3195,6 +3336,7 @@ const components: Record<string, React.ComponentType<any>> = {
3195
3336
  "component:image-input": ImageInputComponent,
3196
3337
  "component:hidden-input": HiddenInputComponent,
3197
3338
  "component:tabs-menu": TabsMenuComponent,
3339
+ "component:embed": EmbedComponent,
3198
3340
  ContainerSliderComponent: SliderComponent,
3199
3341
  };
3200
3342
 
@@ -1,8 +1,25 @@
1
1
  "use client";
2
2
 
3
- import { createContext } from "react";
3
+ import React, { createContext } from "react";
4
4
 
5
- type EncoreBindingContext = {};
6
- const EncoreBindingContext = createContext({});
5
+ type EncoreBindingContextType = {
6
+ nodeData?: any; // Assuming nodeData is part of the context based on the default value
7
+ textOverridesById?: Record<string, string>; // Assuming textOverridesById is part of the context
8
+ /**
9
+ * Data provided by parent component (from `encore:data:array` tag)
10
+ */
11
+ arrayDataById?: Record<string, any[]>;
12
+ /**
13
+ * Embeddable components provided by parent component
14
+ */
15
+ embedsById?: Record<string, React.ReactNode>;
16
+ };
17
+
18
+ const EncoreBindingContext = createContext<EncoreBindingContextType>({
19
+ nodeData: undefined, // Changed from null to undefined for consistency with other optional properties
20
+ textOverridesById: undefined,
21
+ arrayDataById: undefined,
22
+ embedsById: undefined,
23
+ });
7
24
 
8
25
  export default EncoreBindingContext;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = "0.1.35";
1
+ export const PACKAGE_VERSION = "0.1.38";