imxc 0.4.0 → 0.4.1

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.
Files changed (2) hide show
  1. package/dist/lowering.js +9 -2
  2. package/package.json +1 -1
package/dist/lowering.js CHANGED
@@ -727,8 +727,15 @@ function lowerTextElement(node, body, ctx, loc) {
727
727
  args.push(cppExpr);
728
728
  break;
729
729
  case 'float':
730
- format += '%.2f';
731
- args.push(cppExpr);
730
+ if (cppExpr.startsWith('props.')) {
731
+ // Props fields: number could be int or float in C++, cast to double for safe printf
732
+ format += '%g';
733
+ args.push(`(double)${cppExpr}`);
734
+ }
735
+ else {
736
+ format += '%.2f';
737
+ args.push(cppExpr);
738
+ }
732
739
  break;
733
740
  case 'bool':
734
741
  format += '%s';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imxc",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Compiler for IMX — compiles React-like .tsx to native Dear ImGui C++",
5
5
  "type": "module",
6
6
  "bin": {