@symbiote-native/components 3.0.0 → 3.0.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.
@@ -224,7 +224,25 @@ function dispatch(node, state, key, args) {
224
224
  //
225
225
  // The engine event names, not the `onX` prop spellings. `buildPressableListeners` speaks the prop
226
226
  // spelling, so the two are mapped here rather than guessed at either end.
227
- const KEY_BY_EVENT = new Map([
227
+ /**
228
+ * Engine event name -> the app-facing callback key its dispatcher routes to.
229
+ *
230
+ * AN ARRAY OF PAIRS RATHER THAN A `Map`, and the reason is measured rather than stylistic.
231
+ * `installListeners` below is the only reader, and it runs once per node that carries a press
232
+ * machine — which is every `<TextInput>` on the screen, not just every `<Pressable>`. A `for…of` over
233
+ * a `Map` builds a fresh two-element array per entry for the destructuring to read back: seven
234
+ * allocations per node, for seven fixed pairs that never change. The tuples here already exist, so
235
+ * the same loop allocates nothing but its iterator.
236
+ *
237
+ * Priced on `-O` Hermes by `text-input-attach-ladder.itest.ts`, one pass over the seven pairs:
238
+ * `Map` 1.04 us, this 0.39, two parallel arrays 0.29. The parallel arrays are cheapest and give up
239
+ * the pairing, which is not worth 0.1 us on a table that a drift would silently unwire.
240
+ *
241
+ * NOT the same list as `createPressBehavior`'s `ownedListeners`, and they must not be merged: that
242
+ * one is every name the machine takes as an INPUT (`pressMove` and `longPress` included), this one
243
+ * is only the names it installs a dispatcher for.
244
+ */
245
+ const EVENT_KEY_PAIRS = [
228
246
  ['press', 'onPress'],
229
247
  ['pressIn', 'onPressIn'],
230
248
  ['pressOut', 'onPressOut'],
@@ -232,9 +250,9 @@ const KEY_BY_EVENT = new Map([
232
250
  ['responderMove', 'onResponderMove'],
233
251
  ['responderTerminationRequest', 'onResponderTerminationRequest'],
234
252
  ['responderGrant', 'onResponderGrant'],
235
- ]);
253
+ ];
236
254
  function installListeners(node, state) {
237
- for (const [event, key] of KEY_BY_EVENT) {
255
+ for (const [event, key] of EVENT_KEY_PAIRS) {
238
256
  setBehaviorListener(node, event, symbioteEvent => dispatch(node, state, key, [symbioteEvent]));
239
257
  }
240
258
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/components",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Framework-agnostic component logic (state machines + render functions) for SymbioteNative — written once, inherited by every adapter (React, Vue, Angular, ...).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -59,11 +59,11 @@
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react-native": ">=0.86",
62
- "@symbiote-native/engine": "^1.0.0"
62
+ "@symbiote-native/engine": "^1.2.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@types/node": "^26.0.0",
66
- "@symbiote-native/engine": "1.0.0"
66
+ "@symbiote-native/engine": "1.2.0"
67
67
  },
68
68
  "scripts": {
69
69
  "typecheck": "tsc --build",