@bravostudioai/react 0.1.34 → 0.1.36
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/README.md +84 -35
- package/dist/codegen/generator.js +243 -234
- package/dist/codegen/generator.js.map +1 -1
- package/dist/codegen/parser.js +150 -149
- package/dist/codegen/parser.js.map +1 -1
- package/dist/components/EncoreApp.js +61 -58
- package/dist/components/EncoreApp.js.map +1 -1
- package/dist/components.js +512 -449
- package/dist/components.js.map +1 -1
- package/dist/contexts/EncoreBindingContext.js +9 -3
- package/dist/contexts/EncoreBindingContext.js.map +1 -1
- package/dist/src/codegen/generator.d.ts.map +1 -1
- package/dist/src/codegen/parser.d.ts.map +1 -1
- package/dist/src/components/EncoreApp.d.ts +3 -1
- package/dist/src/components/EncoreApp.d.ts.map +1 -1
- package/dist/src/components.d.ts.map +1 -1
- package/dist/src/contexts/EncoreBindingContext.d.ts +14 -2
- package/dist/src/contexts/EncoreBindingContext.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/codegen/generator.ts +24 -2
- package/src/codegen/parser.ts +29 -4
- package/src/components/EncoreApp.tsx +6 -1
- package/src/components.tsx +131 -4
- package/src/contexts/EncoreBindingContext.ts +20 -3
- package/src/version.ts +1 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { createContext as
|
|
2
|
-
const
|
|
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
|
-
|
|
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
|
|
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,M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AAQ,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,CAgFnE;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.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E,CAAC,CAAC;IAC/C,sEAAsE;IACtE,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC5B,qFAAqF;IACrF,0BAA0B,CAAC,EAAE,MAAM,CACjC,MAAM,EACN;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CACnE,CAAC;IACF,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,6FAA6F;IAC7F,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,4FAA4F;IAC5F,aAAa,CAAC,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;
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,MAAM,OAAO,CAAC;AA+rGf,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
|
-
|
|
2
|
-
|
|
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":"
|
|
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"}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "0.1.
|
|
1
|
+
export declare const PACKAGE_VERSION = "0.1.35";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = \"0.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;"}
|
package/package.json
CHANGED
package/src/codegen/generator.ts
CHANGED
|
@@ -202,13 +202,22 @@ ${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
|
-
|
|
211
|
+
if (comp.type === "component:webview") {
|
|
212
|
+
dataMapping.push(` // ${comp.name}
|
|
213
|
+
...(props.${comp.propName} !== undefined && { "${comp.id}": { params: { url: props.${comp.propName} } } as any }),`);
|
|
214
|
+
} else if (comp.type === "component:embed") {
|
|
215
|
+
embedsMapping.push(` // ${comp.name}
|
|
216
|
+
...(props.${comp.propName} !== undefined && { "${comp.id}": props.${comp.propName} }),`);
|
|
217
|
+
} else {
|
|
218
|
+
dataMapping.push(` // ${comp.name}
|
|
211
219
|
...(props.${comp.propName} !== undefined && { "${comp.id}": { ${propKey}: props.${comp.propName} } as any }),`);
|
|
220
|
+
}
|
|
212
221
|
});
|
|
213
222
|
|
|
214
223
|
// Add select input mappings (for controlled values and options)
|
|
@@ -228,6 +237,12 @@ ${itemProps}
|
|
|
228
237
|
const itemMapping = container.components
|
|
229
238
|
.map((comp) => {
|
|
230
239
|
const propKey = getComponentPropName(comp.type);
|
|
240
|
+
if (comp.type === "component:webview") {
|
|
241
|
+
return ` // ${comp.name}
|
|
242
|
+
"${comp.id}": {
|
|
243
|
+
params: { url: item.${comp.propName} },
|
|
244
|
+
}`;
|
|
245
|
+
}
|
|
231
246
|
return ` // ${comp.name}
|
|
232
247
|
"${comp.id}": {
|
|
233
248
|
${propKey}: item.${comp.propName},
|
|
@@ -445,6 +460,13 @@ ${inputGroupMapping.join("\n")}
|
|
|
445
460
|
const onActionCode =
|
|
446
461
|
inputGroupHandlers.length > 0 ? `\n onAction={handleAction}` : "";
|
|
447
462
|
|
|
463
|
+
const embedsCode =
|
|
464
|
+
embedsMapping.length > 0
|
|
465
|
+
? `\n embeds={{
|
|
466
|
+
${embedsMapping.join("\n")}
|
|
467
|
+
}}`
|
|
468
|
+
: "";
|
|
469
|
+
|
|
448
470
|
const propsParameter = hasProps ? `props: ${componentName}Props` : "";
|
|
449
471
|
const propsInterfaceSection = propsInterface ? `${propsInterface}\n\n` : "";
|
|
450
472
|
|
|
@@ -480,7 +502,7 @@ ${inputGroupHandlers.length > 0 ? inputGroupHandlers.join("\n") : ""}
|
|
|
480
502
|
}
|
|
481
503
|
data={{
|
|
482
504
|
${dataMapping.join("\n")}
|
|
483
|
-
}}${repeatingContainerControlsCode}${inputGroupsCode}${onActionCode}
|
|
505
|
+
}}${repeatingContainerControlsCode}${inputGroupsCode}${onActionCode}${embedsCode}
|
|
484
506
|
/>
|
|
485
507
|
);
|
|
486
508
|
}
|
package/src/codegen/parser.ts
CHANGED
|
@@ -181,6 +181,18 @@ export function getComponentPropType(
|
|
|
181
181
|
}
|
|
182
182
|
return "string"; // text inputs, email, password, etc.
|
|
183
183
|
}
|
|
184
|
+
if (componentType === "component:webview") {
|
|
185
|
+
return "string"; // url
|
|
186
|
+
}
|
|
187
|
+
if (componentType === "component:video") {
|
|
188
|
+
return "string"; // videoUrl
|
|
189
|
+
}
|
|
190
|
+
if (componentType === "component:video") {
|
|
191
|
+
return "string"; // videoUrl
|
|
192
|
+
}
|
|
193
|
+
if (componentType === "component:embed") {
|
|
194
|
+
return "React.ReactNode";
|
|
195
|
+
}
|
|
184
196
|
// Default to any for unknown types
|
|
185
197
|
return "any";
|
|
186
198
|
}
|
|
@@ -192,6 +204,12 @@ export function getComponentPropName(componentType: string): string {
|
|
|
192
204
|
if (componentType === "component:text") {
|
|
193
205
|
return "text";
|
|
194
206
|
}
|
|
207
|
+
if (componentType === "component:webview") {
|
|
208
|
+
return "url";
|
|
209
|
+
}
|
|
210
|
+
if (componentType === "component:video") {
|
|
211
|
+
return "videoUrl";
|
|
212
|
+
}
|
|
195
213
|
return "value";
|
|
196
214
|
}
|
|
197
215
|
|
|
@@ -466,11 +484,18 @@ export function findStandaloneComponents(pageData: any): ComponentInfo[] {
|
|
|
466
484
|
// Skip if we're inside a slider
|
|
467
485
|
if (parentId && sliderIds.has(parentId)) return;
|
|
468
486
|
|
|
469
|
-
// Check if this component has bravo:data tag
|
|
470
|
-
|
|
487
|
+
// Check if this component has bravo:data tag OR is an embed component
|
|
488
|
+
const hasDataTag =
|
|
471
489
|
Array.isArray(node.tags) &&
|
|
472
|
-
(node.tags.includes("encore:data") || node.tags.includes("bravo:data"))
|
|
473
|
-
|
|
490
|
+
(node.tags.includes("encore:data") || node.tags.includes("bravo:data"));
|
|
491
|
+
|
|
492
|
+
if (
|
|
493
|
+
node.type === "component:embed" ||
|
|
494
|
+
(hasDataTag &&
|
|
495
|
+
(node.type === "component:text" ||
|
|
496
|
+
node.type === "component:image" ||
|
|
497
|
+
node.type === "component:webview" ||
|
|
498
|
+
node.type === "component:video"))
|
|
474
499
|
) {
|
|
475
500
|
const basePropName = sanitizePropName(node.name || "item");
|
|
476
501
|
const propType = getComponentPropType(node.type, node.name);
|
|
@@ -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(
|
package/src/components.tsx
CHANGED
|
@@ -436,8 +436,27 @@ const useEncoreStyle = (
|
|
|
436
436
|
if (style.opacity) result.opacity = style.opacity * 0.01;
|
|
437
437
|
if (style.fontId) {
|
|
438
438
|
const fontFamily = fontIdToFamily[style.fontId] || "sans-serif";
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
|
|
440
|
+
// Check for generic font families that should NOT be quoted
|
|
441
|
+
// These need to be unquoted for the browser to recognize them as keywords rather than custom font names
|
|
442
|
+
const genericFamilies = [
|
|
443
|
+
"sans-serif",
|
|
444
|
+
"serif",
|
|
445
|
+
"monospace",
|
|
446
|
+
"cursive",
|
|
447
|
+
"fantasy",
|
|
448
|
+
"system-ui",
|
|
449
|
+
"ui-sans-serif",
|
|
450
|
+
"ui-serif",
|
|
451
|
+
"ui-monospace",
|
|
452
|
+
"ui-rounded",
|
|
453
|
+
];
|
|
454
|
+
if (genericFamilies.includes(fontFamily.toLowerCase())) {
|
|
455
|
+
result.fontFamily = fontFamily;
|
|
456
|
+
} else {
|
|
457
|
+
// Ensure font family name is quoted for names with spaces/special characters
|
|
458
|
+
result.fontFamily = `"${fontFamily}"`;
|
|
459
|
+
}
|
|
441
460
|
|
|
442
461
|
console.log(`[AG_DEBUG] [useEncoreStyle] Font Resolution:`, {
|
|
443
462
|
fontId: style.fontId,
|
|
@@ -1065,6 +1084,54 @@ const WebViewComponent: React.FC<ComponentProps> = ({ id, name, nodeData }) => {
|
|
|
1065
1084
|
);
|
|
1066
1085
|
};
|
|
1067
1086
|
|
|
1087
|
+
const VideoComponent: React.FC<ComponentProps> = ({ id, name, nodeData }) => {
|
|
1088
|
+
const { patchedNodeData } = useEncoreBinding({ id, nodeData });
|
|
1089
|
+
nodeData = patchedNodeData;
|
|
1090
|
+
|
|
1091
|
+
const style = useEncoreStyle(nodeData.style, {
|
|
1092
|
+
debug: false,
|
|
1093
|
+
});
|
|
1094
|
+
const assetsById = useEncoreState((state) => state.assetsById);
|
|
1095
|
+
|
|
1096
|
+
// Honor scale mode semantics (similar to ImageComponent)
|
|
1097
|
+
const scaleMode = nodeData.style?.scaleMode || "fill";
|
|
1098
|
+
if (scaleMode === "fill") {
|
|
1099
|
+
style.objectFit = "cover";
|
|
1100
|
+
} else if (scaleMode === "fit") {
|
|
1101
|
+
style.objectFit = "contain";
|
|
1102
|
+
}
|
|
1103
|
+
style.objectPosition = "center";
|
|
1104
|
+
|
|
1105
|
+
// Resolve video URL
|
|
1106
|
+
let videoUrl = nodeData.data?.videoUrl;
|
|
1107
|
+
|
|
1108
|
+
if (!videoUrl && nodeData.encoreData?.video) {
|
|
1109
|
+
videoUrl = nodeData.encoreData.video;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// Fallback to asset URL if no encore data
|
|
1113
|
+
if (!videoUrl) {
|
|
1114
|
+
videoUrl = assetsById[nodeData.assetId]?.url;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
// Only render if we have a URL or a placeholder color/border
|
|
1118
|
+
if (!videoUrl && !style.backgroundColor && !style.borderColor) {
|
|
1119
|
+
return null;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
return (
|
|
1123
|
+
<video
|
|
1124
|
+
data-id={id}
|
|
1125
|
+
data-name={name}
|
|
1126
|
+
data-type="VideoComponent"
|
|
1127
|
+
style={{ ...style }}
|
|
1128
|
+
src={videoUrl}
|
|
1129
|
+
controls
|
|
1130
|
+
playsInline
|
|
1131
|
+
/>
|
|
1132
|
+
);
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1068
1135
|
const ColorComponent: React.FC<ComponentProps> = ({ id, name, nodeData }) => {
|
|
1069
1136
|
const style = useEncoreStyle(nodeData.style, {
|
|
1070
1137
|
debug: false,
|
|
@@ -2938,9 +3005,25 @@ const PageComponent = ({ id, name, nodeData, children }) => {
|
|
|
2938
3005
|
measuredHeight = viewportHeight;
|
|
2939
3006
|
}
|
|
2940
3007
|
|
|
2941
|
-
//
|
|
3008
|
+
// CHECK: Is this a mobile-first design?
|
|
3009
|
+
// Reuse existing originalWidth (defaults to 1 if missing)
|
|
3010
|
+
const isMobileDesign = originalWidth < 768; // Standard tablet/mobile threshold
|
|
3011
|
+
|
|
3012
|
+
let effectiveWidth = measuredWidth;
|
|
3013
|
+
let containerMaxWidth: string | number = "100%";
|
|
3014
|
+
|
|
3015
|
+
// RESPONSIVE FIX: If mobile design is viewed on a wide screen, constrain it.
|
|
3016
|
+
// We allow scaling up to 1.5x original size (for tablets/large phones), but not infinite stretching.
|
|
3017
|
+
if (isMobileDesign && measuredWidth > originalWidth * 1.5) {
|
|
3018
|
+
const maxAllowed = Math.round(originalWidth * 1.5);
|
|
3019
|
+
effectiveWidth = maxAllowed;
|
|
3020
|
+
containerMaxWidth = maxAllowed;
|
|
3021
|
+
// console.log(`[Encore] Constraining mobile page width to ${maxAllowed}px (viewport: ${measuredWidth}px)`);
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
// Calculate scale factor using the effective (constrained) width
|
|
2942
3025
|
const fitScale =
|
|
2943
|
-
Math.min(
|
|
3026
|
+
Math.min(effectiveWidth / originalWidth, measuredHeight / originalHeight) ||
|
|
2944
3027
|
1;
|
|
2945
3028
|
const context = { scaleFactor: fitScale };
|
|
2946
3029
|
|
|
@@ -3056,6 +3139,11 @@ const PageComponent = ({ id, name, nodeData, children }) => {
|
|
|
3056
3139
|
style={{
|
|
3057
3140
|
width: "100%",
|
|
3058
3141
|
height: "100%",
|
|
3142
|
+
maxWidth:
|
|
3143
|
+
typeof containerMaxWidth === "number"
|
|
3144
|
+
? `${containerMaxWidth}px`
|
|
3145
|
+
: containerMaxWidth,
|
|
3146
|
+
margin: isMobileDesign ? "0 auto" : 0,
|
|
3059
3147
|
position: "relative",
|
|
3060
3148
|
overflow: "hidden",
|
|
3061
3149
|
// Only use flex if we have non-background nonScrollableChildren (like top-bar)
|
|
@@ -3144,7 +3232,44 @@ const PageComponent = ({ id, name, nodeData, children }) => {
|
|
|
3144
3232
|
);
|
|
3145
3233
|
};
|
|
3146
3234
|
|
|
3235
|
+
const EmbedComponent: React.FC<ComponentProps> = ({
|
|
3236
|
+
id,
|
|
3237
|
+
nodeData,
|
|
3238
|
+
children,
|
|
3239
|
+
}) => {
|
|
3240
|
+
const bindingContext = useContext(EncoreBindingContext);
|
|
3241
|
+
const embed = bindingContext?.embedsById?.[id];
|
|
3242
|
+
|
|
3243
|
+
const style = useEncoreStyle(nodeData.style, { debug: false });
|
|
3244
|
+
|
|
3245
|
+
if (embed) {
|
|
3246
|
+
return (
|
|
3247
|
+
<div
|
|
3248
|
+
style={{
|
|
3249
|
+
...style,
|
|
3250
|
+
display: "flex",
|
|
3251
|
+
flexDirection: "column",
|
|
3252
|
+
// Reset positioning if provided by wrapper
|
|
3253
|
+
position: "absolute",
|
|
3254
|
+
}}
|
|
3255
|
+
data-type="EmbedComponent"
|
|
3256
|
+
data-id={id}
|
|
3257
|
+
>
|
|
3258
|
+
{embed}
|
|
3259
|
+
</div>
|
|
3260
|
+
);
|
|
3261
|
+
}
|
|
3262
|
+
|
|
3263
|
+
// Fallback to children or empty
|
|
3264
|
+
return (
|
|
3265
|
+
<div style={style} data-type="EmbedComponent-Empty" data-id={id}>
|
|
3266
|
+
{children}
|
|
3267
|
+
</div>
|
|
3268
|
+
);
|
|
3269
|
+
};
|
|
3270
|
+
|
|
3147
3271
|
const components: Record<string, React.ComponentType<any>> = {
|
|
3272
|
+
EmbedComponent,
|
|
3148
3273
|
WebViewComponent,
|
|
3149
3274
|
ColorComponent,
|
|
3150
3275
|
GradientComponent,
|
|
@@ -3187,6 +3312,7 @@ const components: Record<string, React.ComponentType<any>> = {
|
|
|
3187
3312
|
"component:stateful-compound": StatefulCompoundComponent,
|
|
3188
3313
|
"component:slider": SliderComponent,
|
|
3189
3314
|
"component:webview": WebViewComponent,
|
|
3315
|
+
"component:video": VideoComponent,
|
|
3190
3316
|
"component:lottie": LottieComponent,
|
|
3191
3317
|
"component:email-input": EmailInputComponent,
|
|
3192
3318
|
"component:text-input": TextInputComponent,
|
|
@@ -3195,6 +3321,7 @@ const components: Record<string, React.ComponentType<any>> = {
|
|
|
3195
3321
|
"component:image-input": ImageInputComponent,
|
|
3196
3322
|
"component:hidden-input": HiddenInputComponent,
|
|
3197
3323
|
"component:tabs-menu": TabsMenuComponent,
|
|
3324
|
+
"component:embed": EmbedComponent,
|
|
3198
3325
|
ContainerSliderComponent: SliderComponent,
|
|
3199
3326
|
};
|
|
3200
3327
|
|
|
@@ -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
|
|
6
|
-
|
|
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.
|
|
1
|
+
export const PACKAGE_VERSION = "0.1.36";
|