@symbiote-native/engine 0.1.7 → 0.2.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 (40) hide show
  1. package/build/alert/index.ios.js +10 -0
  2. package/build/animated/color.d.ts +2 -8
  3. package/build/animated/color.js +4 -45
  4. package/build/animated/easing.js +0 -8
  5. package/build/animated/graph.d.ts +13 -5
  6. package/build/animated/graph.js +85 -11
  7. package/build/animated/index.d.ts +2 -2
  8. package/build/animated/index.js +2 -2
  9. package/build/animated/interpolation.js +1 -1
  10. package/build/animated/leaf-lifecycle.d.ts +7 -0
  11. package/build/animated/leaf-lifecycle.js +185 -0
  12. package/build/animated/native/native-animated.js +1 -0
  13. package/build/animated/rgba.d.ts +8 -0
  14. package/build/animated/rgba.js +55 -0
  15. package/build/animated/value.js +12 -7
  16. package/build/commit.js +1 -5
  17. package/build/debug.d.ts +1 -1
  18. package/build/debug.js +10 -3
  19. package/build/events/index.js +0 -2
  20. package/build/index.d.ts +4 -2
  21. package/build/index.js +2 -1
  22. package/build/layout-animation/index.js +0 -1
  23. package/build/process-font-variant.js +0 -1
  24. package/build/process-transform/index.js +13 -19
  25. package/build/report-error.d.ts +5 -0
  26. package/build/report-error.js +60 -0
  27. package/build/status-bar/index.android.js +5 -6
  28. package/build/style-registry/index.js +95 -16
  29. package/build/style-sheet/index.js +4 -2
  30. package/build/surface.js +2 -1
  31. package/build/vibration/index.android.js +2 -3
  32. package/package.json +1 -1
  33. package/build/animated/interpolation-node.d.ts +0 -15
  34. package/build/animated/interpolation-node.js +0 -58
  35. package/build/style-registry/scope/index.d.ts +0 -3
  36. package/build/style-registry/scope/index.js +0 -41
  37. package/build/touch-history/index.d.ts +0 -23
  38. package/build/touch-history/index.js +0 -150
  39. package/build/type-guards/index.d.ts +0 -4
  40. package/build/type-guards/index.js +0 -15
@@ -1,23 +0,0 @@
1
- interface ITouchRecord {
2
- touchActive: boolean;
3
- startPageX: number;
4
- startPageY: number;
5
- startTimeStamp: number;
6
- currentPageX: number;
7
- currentPageY: number;
8
- currentTimeStamp: number;
9
- previousPageX: number;
10
- previousPageY: number;
11
- previousTimeStamp: number;
12
- }
13
- interface ITouchHistory {
14
- touchBank: ITouchRecord[];
15
- numberActiveTouches: number;
16
- indexOfSingleActiveTouch: number;
17
- mostRecentTimeStamp: number;
18
- }
19
- export declare const touchHistory: ITouchHistory;
20
- export declare function recordTouchTrack(kind: 'start' | 'move' | 'end', nativeEvent: Record<string, unknown>): void;
21
- export declare function resetTouchHistory(): void;
22
- export declare function attachTouchHistory(nativeEvent: Record<string, unknown>): void;
23
- export {};
@@ -1,150 +0,0 @@
1
- // Per-touch position/time tracking, ported from RN's
2
- // react-native-renderer/.../legacy-events/ResponderTouchHistoryStore.js. PanResponder's
3
- // multitouch dx/vx math needs each touch's own previous->current delta (RN counts only
4
- // touches that moved since `_accountsForMovesUpTo`), which a grant-relative centroid of
5
- // ALL live touches cannot reconstruct. We maintain the bank as touches flow and ATTACH
6
- // `touchHistory` onto the nativeEvent reaching responder handlers, exactly how
7
- // ResponderEventPlugin.js sets `*.touchHistory`.
8
- //
9
- // events/index.ts consumes only this file's public surface (recordTouchTrack,
10
- // attachTouchHistory, resetTouchHistory, touchHistory); everything else here is a
11
- // private implementation detail of the bank.
12
- import { isRecord } from '../type-guards.js';
13
- // RN's bank is indexed by touch identifier and warns above 20; we never warn (headless
14
- // events may carry larger or absent ids), we just skip anything out of a sane range.
15
- const MAX_TOUCH_BANK = 20;
16
- const touchBank = [];
17
- export const touchHistory = {
18
- touchBank,
19
- numberActiveTouches: 0,
20
- indexOfSingleActiveTouch: -1,
21
- mostRecentTimeStamp: 0,
22
- };
23
- function toFiniteNumber(value) {
24
- return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
25
- }
26
- // Pull a recordable touch out of an untyped entry. RN's getTouchIdentifier throws on
27
- // a null id; we skip instead, so events without touch geometry leave the bank untouched.
28
- function normalizeTouch(raw) {
29
- if (!isRecord(raw))
30
- return undefined;
31
- const identifier = toFiniteNumber(raw.identifier);
32
- const pageX = toFiniteNumber(raw.pageX);
33
- const pageY = toFiniteNumber(raw.pageY);
34
- if (identifier === undefined || pageX === undefined || pageY === undefined)
35
- return undefined;
36
- if (identifier < 0 || identifier > MAX_TOUCH_BANK)
37
- return undefined;
38
- return { identifier, pageX, pageY, timestamp: toFiniteNumber(raw.timestamp) ?? 0 };
39
- }
40
- // The changed touches for this frame (start/move/end), defensively read.
41
- function changedTouchesOf(nativeEvent) {
42
- const raw = nativeEvent.changedTouches;
43
- if (!Array.isArray(raw))
44
- return [];
45
- const out = [];
46
- for (const entry of raw) {
47
- const touch = normalizeTouch(entry);
48
- if (touch !== undefined)
49
- out.push(touch);
50
- }
51
- return out;
52
- }
53
- // Count of all touches still down (RN reads nativeEvent.touches.length directly).
54
- function activeTouchCount(nativeEvent) {
55
- const raw = nativeEvent.touches;
56
- return Array.isArray(raw) ? raw.length : 0;
57
- }
58
- function recordTouchStart(touch) {
59
- const record = touchBank[touch.identifier];
60
- if (record) {
61
- record.touchActive = true;
62
- record.startPageX = touch.pageX;
63
- record.startPageY = touch.pageY;
64
- record.startTimeStamp = touch.timestamp;
65
- record.currentPageX = touch.pageX;
66
- record.currentPageY = touch.pageY;
67
- record.currentTimeStamp = touch.timestamp;
68
- record.previousPageX = touch.pageX;
69
- record.previousPageY = touch.pageY;
70
- record.previousTimeStamp = touch.timestamp;
71
- }
72
- else {
73
- touchBank[touch.identifier] = {
74
- touchActive: true,
75
- startPageX: touch.pageX,
76
- startPageY: touch.pageY,
77
- startTimeStamp: touch.timestamp,
78
- currentPageX: touch.pageX,
79
- currentPageY: touch.pageY,
80
- currentTimeStamp: touch.timestamp,
81
- previousPageX: touch.pageX,
82
- previousPageY: touch.pageY,
83
- previousTimeStamp: touch.timestamp,
84
- };
85
- }
86
- touchHistory.mostRecentTimeStamp = touch.timestamp;
87
- }
88
- // Move and end share the previous<-current shift; only `touchActive` differs.
89
- function shiftTouchRecord(touch, active) {
90
- const record = touchBank[touch.identifier];
91
- if (!record)
92
- return;
93
- record.touchActive = active;
94
- record.previousPageX = record.currentPageX;
95
- record.previousPageY = record.currentPageY;
96
- record.previousTimeStamp = record.currentTimeStamp;
97
- record.currentPageX = touch.pageX;
98
- record.currentPageY = touch.pageY;
99
- record.currentTimeStamp = touch.timestamp;
100
- touchHistory.mostRecentTimeStamp = touch.timestamp;
101
- }
102
- function arrayFirst(value) {
103
- return Array.isArray(value) ? value[0] : undefined;
104
- }
105
- // Maintain the bank as a touch frame flows. Mirrors RN's recordTouchTrack: moveish
106
- // shifts records, startish records + recomputes numberActiveTouches, endish marks the
107
- // record inactive + rescans for the single remaining touch. `kind` is the touch phase.
108
- export function recordTouchTrack(kind, nativeEvent) {
109
- if (kind === 'move') {
110
- for (const touch of changedTouchesOf(nativeEvent))
111
- shiftTouchRecord(touch, true);
112
- return;
113
- }
114
- if (kind === 'start') {
115
- for (const touch of changedTouchesOf(nativeEvent))
116
- recordTouchStart(touch);
117
- touchHistory.numberActiveTouches = activeTouchCount(nativeEvent);
118
- if (touchHistory.numberActiveTouches === 1) {
119
- const first = normalizeTouch(arrayFirst(nativeEvent.touches));
120
- touchHistory.indexOfSingleActiveTouch = first?.identifier ?? -1;
121
- }
122
- return;
123
- }
124
- for (const touch of changedTouchesOf(nativeEvent))
125
- shiftTouchRecord(touch, false);
126
- touchHistory.numberActiveTouches = activeTouchCount(nativeEvent);
127
- if (touchHistory.numberActiveTouches === 1) {
128
- for (let i = 0; i < touchBank.length; i++) {
129
- const record = touchBank[i];
130
- if (record !== undefined && record.touchActive) {
131
- touchHistory.indexOfSingleActiveTouch = i;
132
- break;
133
- }
134
- }
135
- }
136
- }
137
- // Drop all touch state. Called on a fully-released / cancelled gesture so a stale bank
138
- // never leaks geometry into the next gesture's first frame.
139
- export function resetTouchHistory() {
140
- touchBank.length = 0;
141
- touchHistory.numberActiveTouches = 0;
142
- touchHistory.indexOfSingleActiveTouch = -1;
143
- touchHistory.mostRecentTimeStamp = 0;
144
- }
145
- // Attach the live touch history onto the event the responder handlers receive, matching
146
- // ResponderEventPlugin.js (`grantEvent.touchHistory = ...`, etc.). PanResponder reads
147
- // it for the per-touch dx/vx math; handlers that ignore it are unaffected.
148
- export function attachTouchHistory(nativeEvent) {
149
- nativeEvent.touchHistory = touchHistory;
150
- }
@@ -1,4 +0,0 @@
1
- export declare function isRecord(value: unknown): value is Record<string, unknown>;
2
- export declare function isBoolean(value: unknown): value is boolean;
3
- export declare function isNumber(value: unknown): value is number;
4
- export declare function isString(value: unknown): value is string;
@@ -1,15 +0,0 @@
1
- // Runtime guards to narrow `unknown` at trust boundaries (native payloads, ViewConfig
2
- // attributes, style values) without an `as` cast. `isRecord` excludes arrays - most
3
- // call sites mean "a native payload keyed by string," never a list.
4
- export function isRecord(value) {
5
- return typeof value === 'object' && value !== null && !Array.isArray(value);
6
- }
7
- export function isBoolean(value) {
8
- return typeof value === 'boolean';
9
- }
10
- export function isNumber(value) {
11
- return typeof value === 'number';
12
- }
13
- export function isString(value) {
14
- return typeof value === 'string';
15
- }