embedded-react 0.20.0 → 0.21.0

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 (74) hide show
  1. package/NOTICE +5 -0
  2. package/README.md +1 -0
  3. package/aot/app-file-loader.mjs +116 -0
  4. package/aot/compile.mjs +16 -46
  5. package/aot/compiler/animations.mjs +299 -57
  6. package/aot/compiler/boot.mjs +27 -2
  7. package/aot/compiler/check.mjs +61 -9
  8. package/aot/compiler/collect.mjs +516 -136
  9. package/aot/compiler/contexts.mjs +391 -0
  10. package/aot/compiler/control-flow.mjs +276 -117
  11. package/aot/compiler/custom-hooks.mjs +686 -0
  12. package/aot/compiler/elements/button.mjs +182 -0
  13. package/aot/compiler/elements/image-background.mjs +76 -0
  14. package/aot/compiler/elements/image.mjs +2 -1
  15. package/aot/compiler/elements/props.mjs +38 -3
  16. package/aot/compiler/elements/rewrite.mjs +118 -0
  17. package/aot/compiler/elements/section-list.mjs +370 -0
  18. package/aot/compiler/expressions.mjs +1351 -97
  19. package/aot/compiler/handlers.mjs +1761 -365
  20. package/aot/compiler/helper-values.mjs +312 -0
  21. package/aot/compiler/ir/nodes.mjs +40 -1
  22. package/aot/compiler/ir/reads.mjs +206 -5
  23. package/aot/compiler/ir/text.mjs +5 -1
  24. package/aot/compiler/ir/types.mjs +12 -0
  25. package/aot/compiler/kept-states.mjs +177 -0
  26. package/aot/compiler/list-items.mjs +226 -0
  27. package/aot/compiler/list-order.mjs +586 -0
  28. package/aot/compiler/list-split.mjs +259 -0
  29. package/aot/compiler/loops.mjs +582 -0
  30. package/aot/compiler/lower.mjs +191 -53
  31. package/aot/compiler/native-files.mjs +439 -0
  32. package/aot/compiler/native-header.mjs +335 -0
  33. package/aot/compiler/native-modules.mjs +1173 -0
  34. package/aot/compiler/nodes.mjs +28 -22
  35. package/aot/compiler/options.mjs +3 -2
  36. package/aot/compiler/out.mjs +14 -1
  37. package/aot/compiler/package/animations.mjs +133 -23
  38. package/aot/compiler/package/assemble.mjs +2 -4
  39. package/aot/compiler/package/bytecode.mjs +37 -8
  40. package/aot/compiler/package/checks.mjs +4 -0
  41. package/aot/compiler/package/codegen.mjs +870 -31
  42. package/aot/compiler/package/enums.mjs +10 -0
  43. package/aot/compiler/package/format.mjs +12 -1
  44. package/aot/compiler/package/lower.mjs +658 -161
  45. package/aot/compiler/package/string-caps.mjs +515 -0
  46. package/aot/compiler/package/tables.mjs +24 -0
  47. package/aot/compiler/package/writer.mjs +22 -0
  48. package/aot/compiler/parse.mjs +3 -1
  49. package/aot/compiler/record-shapes.mjs +246 -0
  50. package/aot/compiler/records.mjs +654 -0
  51. package/aot/compiler/reducers.mjs +272 -0
  52. package/aot/compiler/static-eval.mjs +315 -7
  53. package/aot/compiler/style-text.mjs +18 -3
  54. package/aot/compiler/svg.mjs +7 -4
  55. package/aot/compiler/switch-cases.mjs +198 -0
  56. package/aot/compiler/tagged-records.mjs +450 -0
  57. package/aot/compiler/typing.mjs +307 -0
  58. package/aot/compiler/updaters.mjs +320 -0
  59. package/aot/compiler/window-dimensions.mjs +94 -0
  60. package/aot/compiler/worked-values.mjs +319 -0
  61. package/aot/demo-file.mjs +30 -0
  62. package/aot/style-map.mjs +50 -2
  63. package/build.mjs +9 -1
  64. package/cli.mjs +44 -1
  65. package/hotreload/pack-split.mjs +29 -40
  66. package/pack-container.mjs +9 -1
  67. package/package.json +1 -1
  68. package/sim/embedded-react.wasm +0 -0
  69. package/sim-server.mjs +22 -22
  70. package/src/embedded-react/Dimensions.js +37 -0
  71. package/src/embedded-react/SectionList.js +1 -3
  72. package/src/embedded-react/index.d.ts +83 -3
  73. package/src/embedded-react/index.js +2 -0
  74. package/src/embedded-react/nativeModule.js +462 -0
@@ -102,6 +102,13 @@ export function internedStates(app) {
102
102
  if (!isRead(node.initializer)) {
103
103
  walk(node.initializer);
104
104
  }
105
+ walk(node.text);
106
+ return;
107
+ case 'assignLocal':
108
+ if (!isRead(node.value)) {
109
+ walk(node.value);
110
+ }
111
+ walk(node.text);
105
112
  return;
106
113
  }
107
114
  // A text's value part prints the state's string, which the set holds.
@@ -123,6 +130,7 @@ export function internedStates(app) {
123
130
  nodesOf(app.root),
124
131
  output.handlers,
125
132
  output.timerFunctions,
133
+ output.nativeEventHandlers,
126
134
  output.effectFunctions,
127
135
  output.mountEffects,
128
136
  output.dependencyEffects,
@@ -130,6 +138,8 @@ export function internedStates(app) {
130
138
  output.panResponders,
131
139
  output.vectors,
132
140
  app.boot,
141
+ app.state.flatMap(state => state.kind === 'list' && state.derived ? [state.derived] : []),
142
+ app.state.flatMap(state => state.kind === 'scalar' && state.worked ? [state.worked] : []),
133
143
  ]);
134
144
  for (const state of refused) {
135
145
  values.delete(state);
@@ -23,7 +23,7 @@
23
23
  - Versions and container
24
24
  ---------------------------------------------------------------------------------------------------------------------*/
25
25
  export const FORMAT_MAJOR = 1;
26
- export const FORMAT_MINOR = 6;
26
+ export const FORMAT_MINOR = 15;
27
27
  /** The engine ABI level the package is built against (er_scene.h's ER_ABI). */
28
28
  export const ENGINE_ABI = 1;
29
29
  export const PACKAGE_TAG = 'erb';
@@ -95,6 +95,7 @@ export const Table = {
95
95
  interpolations: 18,
96
96
  keyboard: 19,
97
97
  checks: 20,
98
+ nativeEvents: 21,
98
99
  };
99
100
  /** Arena region kinds, written in this order. */
100
101
  export const Region = {
@@ -211,6 +212,7 @@ export const FunctionKind = {
211
212
  boot: 0x83,
212
213
  helper: 0x84,
213
214
  animationDone: 0x85,
215
+ nativeEvent: 0x86,
214
216
  };
215
217
  /** Event data fields EVT reads. */
216
218
  export const EventField = {
@@ -448,6 +450,15 @@ export const OPCODES = [
448
450
  ['VGRAD', 'abc', 1],
449
451
  ['VCOMMITP', 'abx', 1],
450
452
  ['SCREEN', 'abx', 1],
453
+ ['FMTUPPER', 'abc', 1],
454
+ ['FMTSLICE', 'abc', 1],
455
+ ['SHAS', 'abc', 1],
456
+ ['REMOVE', 'abx', 1],
457
+ ['SCMP', 'abc', 1],
458
+ ['SPLIT', 'abc', 2],
459
+ ['AVAIL', 'abx', 1],
460
+ ['CALLNS', 'abx', 2],
461
+ ['FMTLOG', 'abc', 1],
451
462
  ];
452
463
  /** The props with ids 1 to 150, in id order, as erb_props.c lists them, with each enum's largest value. */
453
464
  const PROPS_IN_ORDER = [