@bravostudioai/react 0.1.46 → 0.1.48
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/components/EncoreApp.js +81 -79
- package/dist/components/EncoreApp.js.map +1 -1
- package/dist/components.js +1 -1
- package/dist/components.js.map +1 -1
- package/dist/src/components/EncoreApp.d.ts.map +1 -1
- package/dist/src/components.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/components/EncoreApp.tsx +26 -18
- package/src/components.tsx +4 -1
- package/src/version.ts +1 -1
|
@@ -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,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,G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,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,4CAgXP,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+uGf,QAAA,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAwDxD,CAAC;AAEF,eAAe,UAAU,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.48";
|
|
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.48\";\n"],"names":["PACKAGE_VERSION"],"mappings":"AAAO,MAAMA,IAAkB;"}
|
package/package.json
CHANGED
|
@@ -207,14 +207,6 @@ const EncoreApp = ({
|
|
|
207
207
|
setReloadKey((prev) => (typeof prev === "number" ? prev + 1 : Date.now()));
|
|
208
208
|
}, []);
|
|
209
209
|
|
|
210
|
-
// Only enable Pusher in remote mode - it doesn't make sense in local mode
|
|
211
|
-
usePusherUpdates({
|
|
212
|
-
appId,
|
|
213
|
-
pageId: pageId || undefined,
|
|
214
|
-
enabled: !isLocalMode() && !appDefinition,
|
|
215
|
-
onUpdate: handleUpdate,
|
|
216
|
-
});
|
|
217
|
-
|
|
218
210
|
const useLocalFlag = source === "local" || isLocalMode();
|
|
219
211
|
|
|
220
212
|
// Determine if we should fetch app definition
|
|
@@ -235,6 +227,14 @@ const EncoreApp = ({
|
|
|
235
227
|
// Default to dynamic if not specified
|
|
236
228
|
const isDynamicMode = !isProductionMode && !isOptimisticMode;
|
|
237
229
|
|
|
230
|
+
// Only enable Pusher in remote mode - it doesn't make sense in local mode
|
|
231
|
+
usePusherUpdates({
|
|
232
|
+
appId,
|
|
233
|
+
pageId: pageId || undefined,
|
|
234
|
+
enabled: isOptimisticMode || (!isLocalMode() && !appDefinition),
|
|
235
|
+
onUpdate: handleUpdate,
|
|
236
|
+
});
|
|
237
|
+
|
|
238
238
|
const shouldFetchApp = !isProductionMode && appId;
|
|
239
239
|
const appUrl = shouldFetchApp
|
|
240
240
|
? `/devices/apps/${appId}${useLocalFlag ? "?useLocal=1" : ""}`
|
|
@@ -281,7 +281,7 @@ const EncoreApp = ({
|
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
return Promise.resolve();
|
|
284
|
-
})
|
|
284
|
+
}),
|
|
285
285
|
);
|
|
286
286
|
})();
|
|
287
287
|
}, [assetsById]);
|
|
@@ -316,7 +316,7 @@ const EncoreApp = ({
|
|
|
316
316
|
// We want: render with initial componentCode, BUT ALSO fetch new code, and when valid, switch to it.
|
|
317
317
|
|
|
318
318
|
const [optimisticCode, setOptimisticCode] = useState<string | undefined>(
|
|
319
|
-
componentCode
|
|
319
|
+
componentCode,
|
|
320
320
|
);
|
|
321
321
|
|
|
322
322
|
useEffect(() => {
|
|
@@ -341,11 +341,19 @@ const EncoreApp = ({
|
|
|
341
341
|
const resp = await fetch(url);
|
|
342
342
|
if (resp.ok) {
|
|
343
343
|
const text = await resp.text();
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
setOptimisticCode(
|
|
348
|
-
|
|
344
|
+
// Check if code is different from what we have (either bundled or previously fetched)
|
|
345
|
+
// Use strict equality as strings are primitives.
|
|
346
|
+
// If the server returns identical code, we skip the update to avoid re-rendering.
|
|
347
|
+
setOptimisticCode((currentCode) => {
|
|
348
|
+
if (text === currentCode) {
|
|
349
|
+
logger.debug("Optimistic code is up to date");
|
|
350
|
+
return currentCode;
|
|
351
|
+
}
|
|
352
|
+
logger.debug(
|
|
353
|
+
"Refreshed optimistic component code (new version found)",
|
|
354
|
+
);
|
|
355
|
+
return text;
|
|
356
|
+
});
|
|
349
357
|
}
|
|
350
358
|
} catch (e) {
|
|
351
359
|
logger.warn("Failed to background refresh optimistic component", e);
|
|
@@ -357,7 +365,7 @@ const EncoreApp = ({
|
|
|
357
365
|
// If prop changes (e.g. from HMR or parent), sync it
|
|
358
366
|
setOptimisticCode(componentCode);
|
|
359
367
|
}
|
|
360
|
-
}, [componentCode, isOptimisticMode, appId, pageId]);
|
|
368
|
+
}, [componentCode, isOptimisticMode, appId, pageId, reloadKey]);
|
|
361
369
|
|
|
362
370
|
// Use the calculated optimistic code or the passed prop depending on mode
|
|
363
371
|
const effectiveComponentCode = isOptimisticMode
|
|
@@ -399,7 +407,7 @@ const EncoreApp = ({
|
|
|
399
407
|
|
|
400
408
|
// Manage repeating container controls (sliders, lists)
|
|
401
409
|
const repeatingContainerContextValue = useRepeatingContainers(
|
|
402
|
-
repeatingContainerControls
|
|
410
|
+
repeatingContainerControls,
|
|
403
411
|
);
|
|
404
412
|
|
|
405
413
|
// Sync input groups from props to store
|
|
@@ -452,7 +460,7 @@ const EncoreApp = ({
|
|
|
452
460
|
{(isLocalMode()
|
|
453
461
|
? // Local mode: app.json provides pages under app.data.pages
|
|
454
462
|
((app?.data as any)?.app?.data?.pages || []).map(
|
|
455
|
-
(pg: any) => pg?.id
|
|
463
|
+
(pg: any) => pg?.id,
|
|
456
464
|
)
|
|
457
465
|
: app?.data?.app.pageIds || []
|
|
458
466
|
).map((p: string) => (
|
package/src/components.tsx
CHANGED
|
@@ -2037,7 +2037,10 @@ const ContainerComponent = ({
|
|
|
2037
2037
|
nodeData.style.layout?.layoutSizingHorizontal ||
|
|
2038
2038
|
nodeData.style.layout?.layoutSizingVertical;
|
|
2039
2039
|
const shouldBeAbsolute =
|
|
2040
|
-
nodeData.style.positioning &&
|
|
2040
|
+
nodeData.style.positioning &&
|
|
2041
|
+
!isFlex &&
|
|
2042
|
+
!parentIsFlex &&
|
|
2043
|
+
(hasLayoutSizing || true);
|
|
2041
2044
|
|
|
2042
2045
|
// Only force position: relative if the element shouldn't be absolutely positioned.
|
|
2043
2046
|
// This allows absolutely positioned children (with layout sizing) to remain absolute.
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = "0.1.
|
|
1
|
+
export const PACKAGE_VERSION = "0.1.48";
|