embedded-react 0.12.0 → 0.14.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.
- package/README.md +222 -6
- package/aot/compile.mjs +3316 -364
- package/aot/style-map.mjs +30 -6
- package/assets/bake-font.mjs +104 -12
- package/assets/bake-svg.mjs +11 -1
- package/assets/build-builtin-font.mjs +6 -12
- package/assets/emit-c.mjs +10 -2
- package/assets/emit-container.mjs +4 -2
- package/assets/font-config.mjs +49 -0
- package/assets/font-sizes.mjs +652 -0
- package/assets/glyph-coverage.mjs +281 -0
- package/assets/index.mjs +29 -5
- package/build.mjs +11 -21
- package/cli.mjs +41 -3
- package/compile-bin.mjs +71 -0
- package/hotreload/pack-app.mjs +8 -21
- package/hotreload/pack-split.mjs +12 -27
- package/pack-container.mjs +10 -47
- package/package.json +2 -1
- package/sim/embedded-react.wasm +0 -0
- package/sim/index.html +32 -3
- package/sim-server.mjs +33 -27
- package/src/embedded-react/Animated.js +23 -9
- package/src/embedded-react/Button.js +98 -0
- package/src/embedded-react/FlatList.js +88 -0
- package/src/embedded-react/ImageBackground.js +67 -0
- package/src/embedded-react/PanResponder.js +326 -0
- package/src/embedded-react/SectionList.js +148 -0
- package/src/embedded-react/TouchableOpacity.js +152 -0
- package/src/embedded-react/components.js +4 -3
- package/src/embedded-react/index.d.ts +867 -60
- package/src/embedded-react/index.js +7 -2
- package/src/embedded-react/list-child.js +54 -0
- package/src/embedded-react/svg-ops.js +309 -77
- package/src/embedded-react/warn-props.js +80 -0
- package/src/host-config.js +103 -3
- package/src/props.js +40 -0
- package/src/renderer.js +31 -0
package/README.md
CHANGED
|
@@ -37,6 +37,32 @@ AppRegistry.registerComponent('demo', () => App);
|
|
|
37
37
|
`embedded-react` resolves as a Node **package self-reference** (`package.json` `name` + `exports`),
|
|
38
38
|
so esbuild and Vitest find it with no aliases.
|
|
39
39
|
|
|
40
|
+
`<FlatList>` renders, but it is a thin `<ScrollView>` alias — no virtualization, every row mounts and
|
|
41
|
+
stays mounted, and only `data` / `renderItem` / `keyExtractor` / `style` are honored. See [`FlatList` is
|
|
42
|
+
a `ScrollView`
|
|
43
|
+
alias](https://github.com/TheMasterCoder007/embedded-react#flatlist-is-a-scrollview-alias) for the node
|
|
44
|
+
budget it costs and what to do with a long list.
|
|
45
|
+
|
|
46
|
+
`<Button>`, `<ImageBackground>` and `<SectionList>` are JavaScript wrappers over the primitives, the
|
|
47
|
+
way RN implements them — a styled `<Pressable>` + `<Text>`, a `<View>` with an absolutely-filled
|
|
48
|
+
`<Image>` behind its children, and a `<ScrollView>` whose sections lay out as flat siblings. They add
|
|
49
|
+
no engine node, they are **Flow A only** (the AOT names them and tells you the tree to write instead),
|
|
50
|
+
and `<SectionList>` inherits every `<FlatList>` caveat plus a header and footer per section. See
|
|
51
|
+
[`Button`, `ImageBackground` and `SectionList` are JSX, not
|
|
52
|
+
nodes](https://github.com/TheMasterCoder007/embedded-react#button-imagebackground-and-sectionlist-are-jsx-not-nodes).
|
|
53
|
+
|
|
54
|
+
`<TouchableOpacity>` is a wrapper too, but a cheaper one: it is a `<Pressable>` whose opacity is bound to
|
|
55
|
+
a press animation, so it costs no extra node and it compiles in **both flows**. The dim runs on the
|
|
56
|
+
native driver — no JS per frame — and every `<Pressable>` prop works on it unchanged. See
|
|
57
|
+
[`<TouchableOpacity>` dims on the native
|
|
58
|
+
driver](https://github.com/TheMasterCoder007/embedded-react#touchableopacity-dims-on-the-native-driver).
|
|
59
|
+
|
|
60
|
+
RN modules that wrap an operating system — `StatusBar`, `SafeAreaView`, `AppState`, `Appearance`,
|
|
61
|
+
`Linking`, `AccessibilityInfo` — are **intentionally absent**; a microcontroller has no OS for them to
|
|
62
|
+
wrap. See [Intentionally absent React Native
|
|
63
|
+
APIs](https://github.com/TheMasterCoder007/embedded-react#intentionally-absent-react-native-apis) for
|
|
64
|
+
the full list and what to use instead.
|
|
65
|
+
|
|
40
66
|
## Simulate — `npx embedded-react dev`
|
|
41
67
|
|
|
42
68
|
Run your app in a browser with hot reload — no native toolchain, no repo clone. The engine is compiled to
|
|
@@ -67,12 +93,13 @@ npx embedded-react export --out sim-export # then: npx serve sim-export (or d
|
|
|
67
93
|
```
|
|
68
94
|
src/
|
|
69
95
|
embedded-react/ the public package surface (what apps import)
|
|
70
|
-
index.js barrel: components, StyleSheet, Platform, AppRegistry, Animated, Easing
|
|
96
|
+
index.js barrel: components, StyleSheet, Platform, AppRegistry, Animated, PanResponder, Easing
|
|
71
97
|
components.js host component tags (View, Text, … → ERNodeType)
|
|
72
98
|
StyleSheet.js create() / flatten()
|
|
73
99
|
Platform.js { OS: 'embedded', select }
|
|
74
100
|
AppRegistry.js registerComponent(...) → mounts into a screen-sized root
|
|
75
101
|
Animated.js Value / timing / spring / decay / View|Text|Image / interpolate
|
|
102
|
+
PanResponder.js create(config) → panHandlers: drag/swipe/fling over the responder system
|
|
76
103
|
Easing.js easing tokens (+ bezier) → engine curves
|
|
77
104
|
split-style.js pure: split style into static props + animated bindings
|
|
78
105
|
__tests__/ co-located UNIT tests for the pure surface
|
|
@@ -94,6 +121,7 @@ assets/ build-time asset bakers (pure JS, no native deps) —
|
|
|
94
121
|
build.mjs esbuild a demo's index.jsx → dist/app.bundle.js + bake its imported assets
|
|
95
122
|
pack-container.mjs bundle + bytecode-compile + bake → dist/app.erpkg config container (npm run pack)
|
|
96
123
|
assets/emit-container.mjs ERCF container writer (sections + QuickJS version stamp + CRC32)
|
|
124
|
+
compile-bin.mjs finds er-bridge-quickjs-compile (shared with the parity harness)
|
|
97
125
|
vitest.config.js unit test config
|
|
98
126
|
```
|
|
99
127
|
|
|
@@ -123,10 +151,131 @@ page change. Hiding costs a repaint, and a hidden page costs nothing per frame e
|
|
|
123
151
|
rendering into it.
|
|
124
152
|
|
|
125
153
|
`visible={false}` is the same switch under the other spelling, with an explicit `style.display`
|
|
126
|
-
winning over it (`<Modal visible>` is unaffected — that is the Modal's own show/hide prop). Both work
|
|
154
|
+
winning over it (`<Modal visible>` is unaffected — that is the Modal's own show/hide prop). Both work
|
|
155
|
+
in Flow B too, where `display` can be static or state-driven — `display: page === 'home' ? 'flex' : 'none'`
|
|
156
|
+
compiles, but a state-driven one has to be a string literal or a ternary of them, whereas `visible` takes
|
|
157
|
+
any boolean expression. Either spelling lowers to a `p.display` write in `app_update`, so hiding costs no
|
|
158
|
+
node churn there either. The one gap is `visible` on an `<Svg>`, which the AOT rejects outright: wrap it
|
|
159
|
+
(`<View visible={…}><Svg …/></View>`) and the whole subtree goes with the View.
|
|
127
160
|
The trade is memory: a cached page holds its nodes for the life of the app, so cache
|
|
128
161
|
the pages you flip between, not every page.
|
|
129
162
|
|
|
163
|
+
### Gestures — `PanResponder`
|
|
164
|
+
|
|
165
|
+
The raw touch events already carry the travel and the speed (`e.dx`/`e.dy`, `e.vx`/`e.vy` — see below),
|
|
166
|
+
which is enough for a one-off flick. A real drag wants more: an anchor that starts at zero, however, the
|
|
167
|
+
gesture was won, ownership against a scrolling ancestor, and a teardown hook for when the gesture is
|
|
168
|
+
taken away. `PanResponder` is that, in the RN shape (and it compiles in Flow B as well as Flow A):
|
|
169
|
+
|
|
170
|
+
```jsx
|
|
171
|
+
const pan = useRef(
|
|
172
|
+
PanResponder.create({
|
|
173
|
+
onStartShouldSetPanResponder: () => true,
|
|
174
|
+
onPanResponderMove: (e, g) => setX(g.dx),
|
|
175
|
+
onPanResponderRelease: (e, g) => (g.vx > 0.5 ? next() : settle()),
|
|
176
|
+
}),
|
|
177
|
+
).current;
|
|
178
|
+
|
|
179
|
+
<View style={styles.overlay} {...pan.panHandlers} />;
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Create it **once** per component and keep it in a ref — the handlers close over one gesture state, so
|
|
183
|
+
re-creating it per render throws the drag away. `gestureState` carries `x0`/`y0` (the grant point),
|
|
184
|
+
`dx`/`dy` (travel since the grant), `vx`/`vy` (px per ms), `moveX`/`moveY`, `numberActiveTouches` and
|
|
185
|
+
`stateID`. Returning `true` from `onMoveShouldSetPanResponder` claims the gesture mid-pan and re-anchors
|
|
186
|
+
`dx`/`dy` at that point, so a slop threshold never shows up as a jump. With neither should-set callback
|
|
187
|
+
supplied nothing is ever granted — same as RN.
|
|
188
|
+
|
|
189
|
+
`panHandlers` are the RN **responder props** — should-set queries plus `onResponderGrant`/`Move`/
|
|
190
|
+
`Release`/`Terminate` — wired straight into the engine's C responder system, so claiming is real
|
|
191
|
+
*negotiation*, not just listening:
|
|
192
|
+
|
|
193
|
+
- **A granted pan OWNS the gesture.** A `ScrollView` ancestor will not auto-scroll under it, and a
|
|
194
|
+
`onMoveShouldSetPanResponder` claim takes the gesture *back* from a scroller that already started
|
|
195
|
+
(which then stops dead — no coasting).
|
|
196
|
+
- **Negotiation covers the subtree.** The engine asks every node on the hit chain — capture phase
|
|
197
|
+
root→leaf first (the `*Capture` config keys), then bubble leaf→root — so one responder on a wrapper
|
|
198
|
+
claims its children's touches, and an outer responder can pre-empt an inner one.
|
|
199
|
+
- **Losing and defending are callbacks.** A refused claim lands on `onPanResponderReject` (and is
|
|
200
|
+
re-asked on every later move while the predicate keeps returning true); a challenger asking for the
|
|
201
|
+
gesture hits the holder's `onPanResponderTerminationRequest` — return `false` to keep it (absent =
|
|
202
|
+
yield, as in RN).
|
|
203
|
+
- **`onPanResponderTerminate` is the undo hook.** It fires when the host cancels the touch sequence,
|
|
204
|
+
when a fresh touch-down arrives on a finger whose previous sequence never ended, and when the
|
|
205
|
+
responder yields to a challenger.
|
|
206
|
+
- **Single gesture.** The engine events carry no finger id, so extra fingers fold into ONE gesture:
|
|
207
|
+
`numberActiveTouches` counts them and the last to lift releases — both true in either flow. Flow A
|
|
208
|
+
additionally reports each join and leave through `onPanResponderStart`/`End`; Flow B has no
|
|
209
|
+
equivalent (next bullet).
|
|
210
|
+
- **Flow B compiles it too.** The AOT recognises `useRef(PanResponder.create({…})).current` and the
|
|
211
|
+
`{...pan.panHandlers}` spread as a whole and lowers them onto the same C responder system — the
|
|
212
|
+
should-set predicates become `er_responder_query_set` callbacks and the rest become responder event
|
|
213
|
+
handlers, with `g.dx`/`g.vx` reading the engine's own payload. No JS state machine is copied into the
|
|
214
|
+
generated C. Only `onPanResponderStart`/`End` — the two that fold EXTRA fingers into one gesture —
|
|
215
|
+
are Flow A only, and the AOT fails the build by name rather than dropping them. The watch-face demo's
|
|
216
|
+
swipe pager is the worked example: one source, both flows.
|
|
217
|
+
|
|
218
|
+
As promised above: the raw touch events carry the same fields the responder ones do — `e.dx`/`e.dy` from
|
|
219
|
+
touch-down and `e.vx`/`e.vy` in px per ms — so `onTouchEnd={e => e.vx > 0.4 && next()}` needs no
|
|
220
|
+
recognizer at all, in either flow.
|
|
221
|
+
|
|
222
|
+
The low-level responder props (`onStartShouldSetResponder`, `onResponderGrant`, …) are themselves
|
|
223
|
+
public on every component for gestures that don't fit the pan shape. Only RN's Android-specific
|
|
224
|
+
`onShouldBlockNativeResponder` is unsupported — holding the responder already blocks the native one
|
|
225
|
+
(the built-in adjustable-Arc drag deliberately still wins). Passing it, or a typo, warns.
|
|
226
|
+
|
|
227
|
+
### Dragging faster than React — `updateVector` / `updateText`
|
|
228
|
+
|
|
229
|
+
A render per pointer move is the expensive way to drive a gesture. Measured on an ESP32-S3 dragging a
|
|
230
|
+
JS-drawn knob (a `<Path d>` rebuilt every move, state at the root), one frame cost ~103 ms of JS —
|
|
231
|
+
roughly half React's render and half re-marshaling the tree — plus ~51 ms of engine commit. Pushing
|
|
232
|
+
the same geometry straight at the node instead costs **~10 µs of JS**, and about a third of the
|
|
233
|
+
raster, because only that node is dirtied rather than the whole tree.
|
|
234
|
+
|
|
235
|
+
Take a handle from a ref on the `<Svg>` and write to it during the gesture:
|
|
236
|
+
|
|
237
|
+
```jsx
|
|
238
|
+
const arc = useRef(0);
|
|
239
|
+
|
|
240
|
+
const pan = useRef(
|
|
241
|
+
PanResponder.create({
|
|
242
|
+
onStartShouldSetPanResponder: () => true,
|
|
243
|
+
onPanResponderMove: (e, g) => {
|
|
244
|
+
const deg = angleFor(g.moveX, g.moveY);
|
|
245
|
+
updateVector(arc.current, [
|
|
246
|
+
{arc: [CX, CY, R, 0, deg], stroke: '#f4a261', strokeWidth: 14, cap: 'round'},
|
|
247
|
+
{circle: [handleX(deg), handleY(deg), 8], fill: '#fff'},
|
|
248
|
+
]);
|
|
249
|
+
},
|
|
250
|
+
onPanResponderRelease: (e, g) => setValue(valueFor(g.moveX, g.moveY)), // re-sync React
|
|
251
|
+
}),
|
|
252
|
+
).current;
|
|
253
|
+
|
|
254
|
+
<View {...pan.panHandlers} style={{width: W, height: H}}>
|
|
255
|
+
<Svg ref={h => (arc.current = h)} width={W} height={H} />
|
|
256
|
+
</View>;
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Each shape is **one geometry key plus its paint** — `arc`/`circle`/`line`/`rect`/`path`, with
|
|
260
|
+
`fill`, `stroke`, `strokeWidth`, `cap`, `join`, `miter`, `fillRule`, `fillGrad`, `strokeGrad`. Note the
|
|
261
|
+
short paint spellings: this is the allocation-free path, not the JSX attribute set. `path` takes a `d`
|
|
262
|
+
string but pays the parser, so prefer the primitives on a hot path. **Arc angles are degrees clockwise
|
|
263
|
+
from 12 o'clock**, which is not the convention an SVG `A` command uses.
|
|
264
|
+
|
|
265
|
+
The optional third argument is a node-local `[x, y, w, h]` bounding the change — give it and only that
|
|
266
|
+
region repaints and flushes, which is a large win for a small update on a big vector node.
|
|
267
|
+
|
|
268
|
+
`updateText(handle, text)` is the same idea for a `<Text>`: it sets the content through a single
|
|
269
|
+
inherited span, so the node's own color/size are untouched.
|
|
270
|
+
|
|
271
|
+
This is a **write-through**, not a new source of truth: the node keeps what you pushed until React next
|
|
272
|
+
renders that element, which overwrites it cleanly. So commit the final value to state when the gesture
|
|
273
|
+
ends — the release handler above — and the declarative tree takes over again. Both flows compile it;
|
|
274
|
+
the AOT lowers `updateVector` the same way.
|
|
275
|
+
|
|
276
|
+
If the shape you are drawing is a dial, reach for `<Dial>` first — it tracks the finger and repaints
|
|
277
|
+
the arc in C, with no JS per move at all.
|
|
278
|
+
|
|
130
279
|
## Build
|
|
131
280
|
|
|
132
281
|
```
|
|
@@ -170,15 +319,26 @@ file's basename.
|
|
|
170
319
|
RGB565 images through its opaque copy fast path (no per-pixel blending).
|
|
171
320
|
- **Fonts:** TTF/OTF → pre-rasterized `BitmapFont` glyphs (`bake-font.mjs`, via `opentype.js` + a
|
|
172
321
|
pure-JS rasterizer). The engine has no runtime rasterizer, so the baker rasterizes **exactly the
|
|
173
|
-
|
|
174
|
-
|
|
322
|
+
`fontSize` values the app uses**. Discovery folds constants, so a token-driven type scale bakes
|
|
323
|
+
what it means — `const TYPE = {body: 14, title: 22}` read as `fontSize: TYPE.title`, including a
|
|
324
|
+
scale handed to a component as a prop, and both arms of a `screen.width` ternary. A size that only
|
|
325
|
+
exists at runtime can't be seen; the build **warns** and names the expression, because at runtime
|
|
326
|
+
it silently snaps to the nearest baked size. Sizes the bake missed are warned about the same way,
|
|
327
|
+
against your fonts or against the built-in one — pin them in `assets.config.js` if you want a
|
|
328
|
+
different set. Only the glyphs you ask for are baked: printable ASCII, plus a named symbol set and
|
|
329
|
+
any per-app characters you add.
|
|
175
330
|
|
|
176
331
|
Optional per-demo overrides live in `demos/<demo>/assets.config.js`:
|
|
177
332
|
|
|
178
333
|
```js
|
|
179
334
|
export default {
|
|
180
335
|
fonts: {
|
|
181
|
-
Inter: {
|
|
336
|
+
Inter: {
|
|
337
|
+
sizes: [14, 18, 24], // bpp 1|2|4|8 (4 default)
|
|
338
|
+
bpp: 4,
|
|
339
|
+
glyphs: 'common', // 'ascii'|'minimal'|'common'|'greek'|'common-greek'|[codepoints]
|
|
340
|
+
extraGlyphs: '⌘⏻№', // this app's own characters, on top of `glyphs`
|
|
341
|
+
},
|
|
182
342
|
},
|
|
183
343
|
images: {
|
|
184
344
|
bg: { format: 'rgb565' }, // 16-bit bake for opaque art; default is 'argb8888'
|
|
@@ -186,6 +346,21 @@ export default {
|
|
|
186
346
|
};
|
|
187
347
|
```
|
|
188
348
|
|
|
349
|
+
`extraGlyphs` takes the characters themselves or their codepoints (`[0x2318, '⏻']`) — the named sets
|
|
350
|
+
can't anticipate every UI. Every bake path checks the app's text against what it baked and **warns
|
|
351
|
+
about characters that have no glyph**, since the engine silently substitutes `?` for them on the
|
|
352
|
+
device and nothing else tells you:
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
embedded-react: 1 character(s) in the app's text have no baked glyph and will render as '?':
|
|
356
|
+
U+2318 '⌘' missing from Inter in "press ⌘S to save"
|
|
357
|
+
fix: assets.config.js → fonts: {Inter: {extraGlyphs: "⌘"}}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
The check reads string literals (and, for Flow B's unbundled JSX, element text), so text assembled
|
|
361
|
+
at runtime is out of its reach. It also says when the .ttf itself has no such glyph — then no config
|
|
362
|
+
change helps and the font is the thing to change.
|
|
363
|
+
|
|
189
364
|
The engine's **built-in default font** (`engine/font/font_data.c`, the Inter fallback used by any
|
|
190
365
|
text without a custom `fontFamily`) is generated by the same baker — regenerate it with
|
|
191
366
|
`npm run build:builtin-font` (then re-run the engine text tests, as glyph metrics shift slightly).
|
|
@@ -251,7 +426,10 @@ The runtime tiers need the harness exe built once (no SDL); `test:bytecode` also
|
|
|
251
426
|
cmake --build bridges/quickjs/build --target er-bridge-quickjs-runtest er-bridge-quickjs-compile
|
|
252
427
|
```
|
|
253
428
|
|
|
254
|
-
|
|
429
|
+
To use a bridge build in another directory, point `ER_BRIDGE_BUILD_DIR` at it. CI runs both runtime tiers
|
|
430
|
+
this way, against the bridge job's two Release builds on Linux (the native and the bare-metal allocator).
|
|
431
|
+
|
|
432
|
+
Pick the tier by what the code touches: pure marshaling/logic → a co-located `*.unit.test.js`;
|
|
255
433
|
anything that exercises the reconciler → engine pipeline → a `test/runtime/*.runtime.test.jsx`.
|
|
256
434
|
|
|
257
435
|
## Status & known gaps
|
|
@@ -264,6 +442,28 @@ anything that exercises the reconciler → engine pipeline → a `test/runtime/*
|
|
|
264
442
|
`clearInterval` and the Promise job queue are serviced each frame by the host pump
|
|
265
443
|
(`er_bridge_pump`, off the engine clock). React passive effects (`useEffect`) flush on the pump.
|
|
266
444
|
Covered by `timers.runtime.test.js` and `effects.runtime.test.jsx`.
|
|
445
|
+
- ✅ **`Date.now()` / `performance.now()` in both flows.** Both run on the engine clock, with the same
|
|
446
|
+
surface as the lite JS profile (no `Date` objects). Until the host sets the real time —
|
|
447
|
+
`er_runtime_set_wall_clock()` in Flow A, `er_app_set_wall_clock()` in Flow B — `Date.now()` reads as
|
|
448
|
+
uptime. Flow B holds a timestamp as 64-bit whole milliseconds: keep it in state, a ref, or a local,
|
|
449
|
+
compare it, show it in text, and divide it by a constant with `%` or `Math.floor`/`ceil`/`round`/
|
|
450
|
+
`trunc(a / b)`; a plain `/`, a divisor from state, or mixing it with a float or a boolean is a
|
|
451
|
+
compiler error. Covered by
|
|
452
|
+
`date-now.runtime.test.js`, the AOT's `date-now`, `cc-compile` and `text-lowering` cases, and the
|
|
453
|
+
engine's `test_node_pool`.
|
|
454
|
+
- ✅ **Whole-number math in Flow B is defined.** C leaves a signed overflow, a zero divisor and an
|
|
455
|
+
out-of-range float-to-int conversion undefined, so the generated C gives each an answer: `+`, `-`,
|
|
456
|
+
`*` and negation saturate at the limit of their C type (JS would keep a bigger number; the nearest
|
|
457
|
+
one the type holds keeps its sign and order); `%`, an int ref's `/=`, and `Math.floor`/`ceil`/`round`/
|
|
458
|
+
`trunc` of an int divided by an int give JS's result kept whole and exact, so `x % 0` is 0 and `x / 0`
|
|
459
|
+
saturates; and a float that is NaN or past the int range becomes 0 or
|
|
460
|
+
the nearest int. Constant math is worked out at compile time, as JS would, so `30 * DAY_MS` is an
|
|
461
|
+
exact 64-bit value. Beside a timestamp, or stored into a 64-bit slot, whole-number math is done in
|
|
462
|
+
64 bits all the way through: `+`, `-`, `*`, negation, `%`, and `Math.floor`/`ceil`/`round`/`trunc`/
|
|
463
|
+
`abs`/`min`/`max`, so `Date.now() + Math.trunc(n * 100000 / 2)` is exact. A handler local or a ternary
|
|
464
|
+
branch is still worked out on its own terms. `Math.abs`, `min` and `max` of ints stay whole numbers,
|
|
465
|
+
and `Math.round` rounds halves up, as JS does. Covered by the AOT's `compile`, `date-now`, `cc-compile` and `text-lowering` cases,
|
|
466
|
+
the last run under UBSan.
|
|
267
467
|
- ✅ **Animated composition + completion.** `sequence`/`parallel`/`stagger`/`delay`/`loop` and
|
|
268
468
|
`.start(({ finished }) => …)` all work — composition is pure JS over each child's start/stop, with
|
|
269
469
|
completion wired through the engine's `on_complete`. Covered by `anim-compose.runtime.test.js`.
|
|
@@ -275,6 +475,15 @@ anything that exercises the reconciler → engine pipeline → a `test/runtime/*
|
|
|
275
475
|
tweens every node whose computed rect moved on the next commit (in C — no per-frame JS). `Presets`
|
|
276
476
|
/ `create` / `Types` / `Properties` and the `easeInEaseOut`/`linear`/`spring` shorthands. Covered
|
|
277
477
|
by `layout-animation` unit + `layout-anim.runtime.test.jsx`.
|
|
478
|
+
- ✅ **`PanResponder` + the gesture responder system.** The full RN config minus only the
|
|
479
|
+
Android-specific `onShouldBlockNativeResponder`: should-set predicates (with `*Capture` variants),
|
|
480
|
+
grant / move / release / terminate / reject / termination-request, `onPanResponderStart`/`End` for
|
|
481
|
+
extra fingers, and a `gestureState` (`x0`/`y0`, `dx`/`dy`, `vx`/`vy`, `numberActiveTouches`) — wired
|
|
482
|
+
to the ENGINE's responder negotiation, so a granted pan blocks a ScrollView's auto-scroll and can
|
|
483
|
+
take a started scroll over. The low-level responder props are public on every component, and **Flow B
|
|
484
|
+
compiles the same config** — the AOT lowers it onto that C responder system, minus only
|
|
485
|
+
`onPanResponderStart`/`End`. Covered by `pan-responder` unit + `pan-responder.runtime.test.jsx` + the
|
|
486
|
+
AOT's `compile`/`cc-compile` PanResponder cases + the engine's `test_input` responder cases.
|
|
278
487
|
- ✅ **Interpolate `extrapolate`.** `interpolate({ inputRange, outputRange, extrapolate })` supports
|
|
279
488
|
`'extend'` (default) / `'clamp'` / `'identity'`, with per-end `extrapolateLeft`/`extrapolateRight`
|
|
280
489
|
overrides. Math is engine-tested (`test_interpolate`); the bridge path by
|
|
@@ -287,6 +496,13 @@ anything that exercises the reconciler → engine pipeline → a `test/runtime/*
|
|
|
287
496
|
it's just `useState`, so the same app code runs everywhere. `usePersistentState` is the underlying
|
|
288
497
|
helper, also exported for explicit use. See
|
|
289
498
|
[tools/simulator in the repo](https://github.com/TheMasterCoder007/embedded-react/blob/master/tools/simulator/README.md).
|
|
499
|
+
- ✅ **`<Dial>` — the native arc widget.** Dials, gauges and progress rings as ONE engine node
|
|
500
|
+
(`ER_NODE_ARC`) instead of a re-tessellated `<Svg>`: track + value indicator, optional backing band,
|
|
501
|
+
segment gaps, round caps, a circle / image / child-anchored knob, solid / conic / radial indicator paint.
|
|
502
|
+
`value` accepts an `Animated.Value` (bound natively — no JS per frame; each tick repaints only the swept
|
|
503
|
+
sliver), and `adjustable` gives built-in drag-to-set with the quantized value delivered to `onChange(v)`.
|
|
504
|
+
`<Switch onValueChange>` now also fires in Flow A (it was AOT-only). Covered by `dial.runtime.test.jsx`
|
|
505
|
+
and the engine's `test_arc`.
|
|
290
506
|
- ✅ **`npx embedded-react dev`** — the WASM simulator runs your app in a browser with hot reload, from your
|
|
291
507
|
own project directory, with the engine `.wasm` shipped prebuilt (no Emscripten for consumers). See above.
|
|
292
508
|
- ✅ **`npm create embedded-react@latest my-app`** — scaffolds a fresh standalone project (a styled card with a
|