@symbiote-native/engine 1.3.0 → 1.3.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.
- package/build/accessibility-props.d.ts +0 -11
- package/build/accessibility-props.js +30 -68
- package/build/animated/graph.js +1 -1
- package/build/animated/leaf-lifecycle.js +2 -2
- package/build/asset-source-resolver.d.ts +2 -0
- package/build/asset-source-resolver.js +13 -0
- package/build/back-handler/index.d.ts +1 -5
- package/build/back-handler/index.js +0 -6
- package/build/debug.js +8 -22
- package/build/dispatch.js +3 -9
- package/build/events/index.js +2 -2
- package/build/fabric-props.js +74 -179
- package/build/fabric.d.ts +0 -13
- package/build/fabric.js +18 -38
- package/build/host-access.d.ts +1 -128
- package/build/host-access.js +96 -205
- package/build/host-behavior.d.ts +0 -100
- package/build/host-behavior.js +125 -311
- package/build/image-loader.js +10 -23
- package/build/image-source-resolver.js +3 -7
- package/build/image-source-write.d.ts +0 -11
- package/build/image-source-write.js +14 -34
- package/build/imperative.d.ts +0 -28
- package/build/imperative.js +42 -92
- package/build/index.d.ts +1 -0
- package/build/index.js +24 -37
- package/build/mutation-buffer.d.ts +0 -177
- package/build/mutation-buffer.js +137 -308
- package/build/native-engine.d.ts +0 -102
- package/build/native-engine.js +38 -98
- package/build/native-events.js +9 -18
- package/build/native-tree-host.d.ts +0 -21
- package/build/native-tree-host.js +14 -31
- package/build/node.d.ts +0 -212
- package/build/node.js +338 -774
- package/build/post-commit.js +3 -8
- package/build/process-aspect-ratio.js +3 -7
- package/build/process-background-longhands.js +10 -19
- package/build/process-filter.js +11 -19
- package/build/process-font-variant.js +3 -7
- package/build/registry.d.ts +0 -33
- package/build/registry.js +22 -57
- package/build/report-error.js +4 -18
- package/build/structured-style.d.ts +0 -9
- package/build/structured-style.js +16 -31
- package/build/styles.js +3 -6
- package/build/surface.d.ts +0 -26
- package/build/surface.js +29 -76
- package/build/text-input-state.js +4 -8
- package/build/touch-history.js +5 -11
- package/build/tree-host.d.ts +0 -270
- package/build/tree-host.js +63 -153
- package/build/view-config.js +17 -37
- package/package.json +2 -2
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The opcodes. These numbers ARE the contract: renumbering here without renumbering the C++ commits
|
|
3
|
-
* a different tree, silently, and no test in either language can see across the boundary.
|
|
4
|
-
*
|
|
5
|
-
* Stride is fixed so the ops array is addressable as memory rather than parsed. Operands are either
|
|
6
|
-
* a SLOT (an index into the batch's `handles` array — see below) or an index into a side table.
|
|
7
|
-
*/
|
|
8
1
|
export declare const OP_STRIDE = 6;
|
|
9
2
|
export declare const OP_CREATE_ELEMENT = 0;
|
|
10
3
|
export declare const OP_CREATE_RAW_TEXT = 1;
|
|
@@ -16,120 +9,14 @@ export declare const OP_SET_PROP = 6;
|
|
|
16
9
|
export declare const OP_SET_TEXT = 7;
|
|
17
10
|
export declare const OP_COMMIT = 8;
|
|
18
11
|
export declare const OP_SET_COMPONENT = 9;
|
|
19
|
-
/**
|
|
20
|
-
* The INTRINSIC TAG this node came from — `pressable`, not `RCTView`. `[slot, tag]`.
|
|
21
|
-
*
|
|
22
|
-
* Emitted only for a node a host behavior actually attached to, from `attachHostBehavior`, which is
|
|
23
|
-
* where the tag is already in hand and already matched. Every other node pays nothing.
|
|
24
|
-
*
|
|
25
|
-
* WHY THE TAG HAS TO CROSS AT ALL. A tag's platform props are resolved natively now, and the native
|
|
26
|
-
* side keys them off what it knows the node IS. For `<text-input>` the Fabric view name answers
|
|
27
|
-
* that by itself (`RCTSinglelineTextInputView` names nothing else); for `<pressable>` it does not —
|
|
28
|
-
* it commits as `RCTView`, byte-identical to a plain view. The tag is the only fact that separates
|
|
29
|
-
* them, and it is the same fact a browser keys user-agent behavior off.
|
|
30
|
-
*/
|
|
31
12
|
export declare const OP_SET_TAG = 10;
|
|
32
|
-
/**
|
|
33
|
-
* An app callback appeared on, or disappeared from, an event name the behavior OWNS.
|
|
34
|
-
* `[slot, name, present]`. See `recordSetOwnedListener` for why the bit crosses and the closure
|
|
35
|
-
* does not.
|
|
36
|
-
*/
|
|
37
13
|
export declare const OP_SET_OWNED_LISTENER = 11;
|
|
38
|
-
/**
|
|
39
|
-
* A behavior's FEEDBACK state flipped — TouchableHighlight's underlay is showing, or stopped.
|
|
40
|
-
* `[slot, shown]`.
|
|
41
|
-
*
|
|
42
|
-
* The second bit to cross for the same reason the first did. `OP_SET_OWNED_LISTENER` carries whether
|
|
43
|
-
* the app wired a handler; this carries whether the control is currently giving feedback, which is
|
|
44
|
-
* the platform's own `:active` in everything but the timing. `setNodePressed`'s header already calls
|
|
45
|
-
* the press state "the engine-owned half of what `:active` is on the web", and this is its twin for
|
|
46
|
-
* the one control whose feedback does NOT track the press exactly: RN holds the underlay past
|
|
47
|
-
* release so a fast tap still flashes (`TouchableHighlight.js:270-293`).
|
|
48
|
-
*
|
|
49
|
-
* THE TIMER STAYS IN JS and that is the boundary, not an omission. WHEN the bit flips is Pressability
|
|
50
|
-
* plus a `delayPressOut` hold, running at gesture rate and calling back into app code
|
|
51
|
-
* (`onShowUnderlay` / `onHideUnderlay`). WHAT a showing underlay looks like — a background colour and
|
|
52
|
-
* a dimmed child, from two props no ViewConfig declares — is the platform's, and it is
|
|
53
|
-
* `foldTouchableHighlightUnderlay` now.
|
|
54
|
-
*
|
|
55
|
-
* A flip is a GESTURE-rate event rather than a per-render one: twice a tap, against a `payloadFold`
|
|
56
|
-
* that was charged on every commit the node was dirty in for the life of the screen.
|
|
57
|
-
*/
|
|
58
14
|
export declare const OP_SET_UNDERLAY_SHOWN = 12;
|
|
59
|
-
/**
|
|
60
|
-
* A VOID node: commits nothing of its own AND does not hoist its children into Fabric either —
|
|
61
|
-
* unlike an anchor, which hoists. `[slot]`.
|
|
62
|
-
*
|
|
63
|
-
* `InputAccessoryView.js` renders `null` on Android: the whole component, children included,
|
|
64
|
-
* contributes nothing to the host tree. An anchor cannot express that — it exists precisely to hand
|
|
65
|
-
* its children up in its own place — so a node whose entire subtree must vanish from Fabric needs
|
|
66
|
-
* its own kind. Everything else about it (the retained JS tree, `appendChild`, adapter bookkeeping)
|
|
67
|
-
* is unaffected; only the commit walk treats it as contributing zero Fabric nodes, recursively.
|
|
68
|
-
*/
|
|
69
15
|
export declare const OP_CREATE_VOID = 13;
|
|
70
|
-
/**
|
|
71
|
-
* A `setProp` whose value slot is this DELETES the key.
|
|
72
|
-
*
|
|
73
|
-
* `undefined` cannot carry it: `null` is a legitimate Fabric prop value meaning "reset to the
|
|
74
|
-
* default", and the two must stay distinguishable — `cloneNodeWithNewProps` merges, so a removed
|
|
75
|
-
* key has to be sent as an explicit `null` while a key that was never there must not be sent at
|
|
76
|
-
* all. The JS `setProp` already collapses `undefined` to a delete before anything is encoded.
|
|
77
|
-
*/
|
|
78
16
|
export declare const NO_VALUE = -1;
|
|
79
|
-
/**
|
|
80
|
-
* A node kind. Native needs it because two of the three never become a Fabric node the same way,
|
|
81
|
-
* and both rules are decided at INSERT or at child-set build — never by a walk:
|
|
82
|
-
*
|
|
83
|
-
* ELEMENT an ordinary view. Its Fabric view name is fixed at creation, with ONE exception:
|
|
84
|
-
* a text element inside another text element commits as `RCTVirtualText` instead of
|
|
85
|
-
* `RCTText`. Native resolves that when the node acquires a parent, because that is when
|
|
86
|
-
* it first knows the answer, and re-resolves it on a reparent.
|
|
87
|
-
* RAW_TEXT an `RCTRawText` leaf. Skipped from its parent's child set when its text is empty —
|
|
88
|
-
* an empty one would paint.
|
|
89
|
-
* ANCHOR a position marker the frameworks insert (`{#if}`, a fragment, a `{@render}` slot).
|
|
90
|
-
* It never becomes a Fabric node at all: native keeps it in ITS OWN structure so
|
|
91
|
-
* `insertBefore(parent, node, anchor)` resolves, and hoists its children into its
|
|
92
|
-
* parent's child list when building the child set. This is why our own store cannot BE
|
|
93
|
-
* the Fabric tree — there is no Fabric node to hold an anchor, which is the one thing
|
|
94
|
-
* `IMirror` was genuinely for.
|
|
95
|
-
*
|
|
96
|
-
* A SURFACE is an anchor too, and that is not a trick: an anchor is a node whose children belong to
|
|
97
|
-
* its parent's list, and a surface is a node whose children belong to the root's child set. Same
|
|
98
|
-
* shape, so `OP_COMMIT` names one and the native side needs no `rootTag -> node` map — which keeps
|
|
99
|
-
* the applier stateless, the property the whole lifetime design rests on.
|
|
100
|
-
*/
|
|
101
17
|
export declare const KIND_ELEMENT = 0;
|
|
102
18
|
export declare const KIND_RAW_TEXT = 1;
|
|
103
19
|
export declare const KIND_ANCHOR = 2;
|
|
104
|
-
/**
|
|
105
|
-
* One recorded batch, flat.
|
|
106
|
-
*
|
|
107
|
-
* `handles` is the load-bearing table and it travels OUT rather than back: it holds the placeholder
|
|
108
|
-
* object for every slot the ops address, and native attaches each created node to the object at
|
|
109
|
-
* that slot as JSI `NativeState`. So the objects the adapter is already holding become the handles
|
|
110
|
-
* in place, their lifetime is the nodes' lifetime, and nothing has to be freed explicitly.
|
|
111
|
-
*
|
|
112
|
-
* A slot is an index into THIS batch and is meaningless outside it. That is deliberate: an id that
|
|
113
|
-
* outlives a batch forces a table on the far side, and a table is a second owner with nothing to
|
|
114
|
-
* tell it when the first one let go — which is exactly the leak that took the previous applier from
|
|
115
|
-
* 792 to 1492 MB.
|
|
116
|
-
*
|
|
117
|
-
* `values` carries whatever a prop is: a string, a number, a boolean, `null`, a style object, an
|
|
118
|
-
* array. Native converts each to `folly::dynamic` ONCE, when the op is applied — never again per
|
|
119
|
-
* commit, which is the half that ships today.
|
|
120
|
-
*/
|
|
121
|
-
/**
|
|
122
|
-
* What the buffer needs a handle to BE.
|
|
123
|
-
*
|
|
124
|
-
* Still an identity and nothing else as far as the ops are concerned — no parent, no children, no
|
|
125
|
-
* order. The two fields are the buffer's own scratch space for `slotOf`, written by this file and
|
|
126
|
-
* read by nobody else; `ISymbioteNode` declares them from its constructor so every real handle
|
|
127
|
-
* carries the pair on one hidden class.
|
|
128
|
-
*
|
|
129
|
-
* Spelled as a requirement rather than as optional fields on purpose: a handle that cannot hold its
|
|
130
|
-
* slot would fall back to nothing, and the failure would be a silently re-pushed node rather than a
|
|
131
|
-
* type error.
|
|
132
|
-
*/
|
|
133
20
|
export type IMutationHandle = {
|
|
134
21
|
slot: number;
|
|
135
22
|
slotBatch: number;
|
|
@@ -141,35 +28,13 @@ export type IMutationBatch = {
|
|
|
141
28
|
readonly instanceHandles: readonly unknown[];
|
|
142
29
|
readonly handles: readonly object[];
|
|
143
30
|
};
|
|
144
|
-
/**
|
|
145
|
-
* What native answers back, for the four things JS still asks.
|
|
146
|
-
*
|
|
147
|
-
* All four are per-node and none of them is structural — no parent, no children, no order. They
|
|
148
|
-
* exist because a host behavior runs in JS and has to see the props it reacts to, and because an
|
|
149
|
-
* app can measure a ref.
|
|
150
|
-
*
|
|
151
|
-
* Called at GESTURE rate, not commit rate, which is what makes the crossing cost irrelevant: ~10
|
|
152
|
-
* reads per touch against the 19 009 per commit this whole design exists to remove.
|
|
153
|
-
*/
|
|
154
31
|
export type INativeTree = {
|
|
155
32
|
applyOps: (batch: IMutationBatch) => void;
|
|
156
33
|
getProp: (handle: IMutationHandle, key: string) => unknown;
|
|
157
|
-
/** The resolved Fabric view name, which native may have changed at insert (see `KIND_ELEMENT`). */
|
|
158
34
|
getViewName: (handle: IMutationHandle) => string;
|
|
159
35
|
};
|
|
160
|
-
/** Whether a commit would publish anything. See `changedSinceCommit`. */
|
|
161
36
|
export declare function hasChangedSinceCommit(): boolean;
|
|
162
|
-
/**
|
|
163
|
-
* Called by `commitSurfaceOps` once it has drained. Separate from `takeBatch` because a READ drains
|
|
164
|
-
* too, and a read is not a commit — clearing there would make the next commit believe its work had
|
|
165
|
-
* already been published.
|
|
166
|
-
*/
|
|
167
37
|
export declare function noteCommitDrained(): void;
|
|
168
|
-
/**
|
|
169
|
-
* The one dirtying route that writes no op: a behavior with a DERIVED payload asks the host to
|
|
170
|
-
* rebuild a node the buffer never named. Without this the commit that follows would look idle and
|
|
171
|
-
* be skipped, and the derived payload would sit unpublished until something unrelated changed.
|
|
172
|
-
*/
|
|
173
38
|
export declare function noteHostSideChange(): void;
|
|
174
39
|
/** Does the pending batch hold anything that could change what the host says this node's parent is? */
|
|
175
40
|
export declare function hasPendingPlacement(handle: IMutationHandle): boolean;
|
|
@@ -183,56 +48,14 @@ export declare function recordRemoveChild(parent: IMutationHandle, child: IMutat
|
|
|
183
48
|
/** `undefined` DELETES the key — the collapse `setProp` has always performed, spelled on the wire. */
|
|
184
49
|
export declare function recordSetProp(handle: IMutationHandle, key: string, value: unknown): void;
|
|
185
50
|
export declare function recordSetText(handle: IMutationHandle, text: string): void;
|
|
186
|
-
/**
|
|
187
|
-
* Change a node's Fabric view name after creation.
|
|
188
|
-
*
|
|
189
|
-
* It exists for exactly one thing and would not otherwise: `TextInput`'s `multiline` decides between
|
|
190
|
-
* `RCTSinglelineTextInputView` and `RCTMultilineTextInputView`, and an app can flip it. No prop write
|
|
191
|
-
* moves a node between native views, so the host has to RE-CREATE the node under the new name and
|
|
192
|
-
* re-parent its children — which is the same path a reparent already takes, and why this needs no
|
|
193
|
-
* new machinery on the far side beyond honouring the name.
|
|
194
|
-
*
|
|
195
|
-
* A JS-only workaround was the alternative and it is the one thing this design rules out: to know
|
|
196
|
-
* what to rebuild, JS would have to hold the tree.
|
|
197
|
-
*/
|
|
198
51
|
export declare function recordSetComponent(handle: IMutationHandle, viewName: string): void;
|
|
199
52
|
export declare function recordSetTag(handle: IMutationHandle, tag: string): void;
|
|
200
|
-
/**
|
|
201
|
-
* Whether an app callback is currently wired to an event name the BEHAVIOR owns. `[slot, name,
|
|
202
|
-
* present]`, `present` being 1 or 0.
|
|
203
|
-
*
|
|
204
|
-
* The EXISTENCE, never the function. A name a behavior owns is diverted into a JS stash by
|
|
205
|
-
* `setEventListener` and never becomes a prop, so the payload builder sees no trace of it — and
|
|
206
|
-
* `focusable` on a touchable is `focusable !== false && onPress !== undefined && !disabled`
|
|
207
|
-
* (`TouchableOpacity.js:336-339`), two props and one thing only JS knew. This is the one bit that
|
|
208
|
-
* closes that gap.
|
|
209
|
-
*
|
|
210
|
-
* The browser is the argument rather than convenience: a UA computes focusability itself and CAN,
|
|
211
|
-
* because `addEventListener` is its own API — it knows which elements carry a click handler, while
|
|
212
|
-
* the handler's body stays the application's. Same split.
|
|
213
|
-
*
|
|
214
|
-
* Emitted on a FLIP only, from `setEventListener`, which already refuses to notify on listener
|
|
215
|
-
* identity because a framework hands a fresh closure nearly every render. So this is a mount-time
|
|
216
|
-
* op, not a per-render one — against the per-commit fold it replaces.
|
|
217
|
-
*/
|
|
218
53
|
export declare function recordSetOwnedListener(handle: IMutationHandle, name: string, isPresent: boolean): void;
|
|
219
54
|
/** See `OP_SET_UNDERLAY_SHOWN`. Emitted on a flip only, from the behavior that owns the timer. */
|
|
220
55
|
export declare function recordSetUnderlayShown(handle: IMutationHandle, shown: boolean): void;
|
|
221
56
|
export declare function recordCommit(rootTag: number, surface: IMutationHandle): void;
|
|
222
57
|
/** Whether anything is pending. The commit path asks before paying for a drain. */
|
|
223
58
|
export declare function hasPendingOps(): boolean;
|
|
224
|
-
/**
|
|
225
|
-
* Drain the buffer.
|
|
226
|
-
*
|
|
227
|
-
* Fresh arrays rather than reused ones: the batch outlives this call on the native path (`applyOps`
|
|
228
|
-
* reads `handles` while attaching state), and a recycled array would be mutated under it by the next
|
|
229
|
-
* mutation the adapter makes.
|
|
230
|
-
*
|
|
231
|
-
* `slice` for the ops and not `subarray` for exactly that reason — a subarray would share the
|
|
232
|
-
* backing store the very next `push` writes into. It is a typed-array copy rather than the
|
|
233
|
-
* element-by-element iterator walk this used to be, and the ops buffer itself is KEPT so its
|
|
234
|
-
* capacity survives the drain.
|
|
235
|
-
*/
|
|
236
59
|
export declare function takeBatch(): IMutationBatch;
|
|
237
60
|
/** Test seam. Drops everything pending without applying it. */
|
|
238
61
|
export declare function resetMutationBuffer(): void;
|