embedded-react 0.20.0 → 0.22.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 (140) hide show
  1. package/NOTICE +5 -0
  2. package/README.md +3 -2
  3. package/aot/app-file-loader.mjs +116 -0
  4. package/aot/compile.mjs +17 -47
  5. package/aot/compiler/alerts.mjs +604 -0
  6. package/aot/compiler/animations.mjs +299 -57
  7. package/aot/compiler/boot.mjs +27 -2
  8. package/aot/compiler/check.mjs +62 -10
  9. package/aot/compiler/collect.mjs +517 -137
  10. package/aot/compiler/contexts.mjs +391 -0
  11. package/aot/compiler/control-flow.mjs +276 -117
  12. package/aot/compiler/custom-hooks.mjs +686 -0
  13. package/aot/compiler/elements/button.mjs +182 -0
  14. package/aot/compiler/elements/image-background.mjs +76 -0
  15. package/aot/compiler/elements/image.mjs +2 -1
  16. package/aot/compiler/elements/props.mjs +47 -8
  17. package/aot/compiler/elements/rewrite.mjs +118 -0
  18. package/aot/compiler/elements/section-list.mjs +370 -0
  19. package/aot/compiler/expressions.mjs +1378 -97
  20. package/aot/compiler/handlers.mjs +1807 -354
  21. package/aot/compiler/helper-values.mjs +312 -0
  22. package/aot/compiler/ir/nodes.mjs +40 -1
  23. package/aot/compiler/ir/reads.mjs +206 -5
  24. package/aot/compiler/ir/text.mjs +5 -1
  25. package/aot/compiler/ir/types.mjs +12 -0
  26. package/aot/compiler/kept-states.mjs +177 -0
  27. package/aot/compiler/keyboard-dismiss.mjs +99 -0
  28. package/aot/compiler/keyboard.mjs +1 -1
  29. package/aot/compiler/list-items.mjs +226 -0
  30. package/aot/compiler/list-order.mjs +586 -0
  31. package/aot/compiler/list-split.mjs +259 -0
  32. package/aot/compiler/loops.mjs +582 -0
  33. package/aot/compiler/lower.mjs +203 -53
  34. package/aot/compiler/native-files.mjs +439 -0
  35. package/aot/compiler/native-header.mjs +335 -0
  36. package/aot/compiler/native-modules.mjs +1173 -0
  37. package/aot/compiler/nodes.mjs +45 -31
  38. package/aot/compiler/options.mjs +3 -2
  39. package/aot/compiler/out.mjs +18 -1
  40. package/aot/compiler/package/animations.mjs +133 -23
  41. package/aot/compiler/package/assemble.mjs +2 -4
  42. package/aot/compiler/package/bytecode.mjs +37 -8
  43. package/aot/compiler/package/checks.mjs +4 -0
  44. package/aot/compiler/package/codegen.mjs +906 -33
  45. package/aot/compiler/package/enums.mjs +10 -0
  46. package/aot/compiler/package/format.mjs +16 -3
  47. package/aot/compiler/package/lower.mjs +707 -176
  48. package/aot/compiler/package/string-caps.mjs +515 -0
  49. package/aot/compiler/package/tables.mjs +24 -0
  50. package/aot/compiler/package/writer.mjs +22 -0
  51. package/aot/compiler/parse.mjs +3 -1
  52. package/aot/compiler/record-shapes.mjs +246 -0
  53. package/aot/compiler/records.mjs +654 -0
  54. package/aot/compiler/reducers.mjs +272 -0
  55. package/aot/compiler/scroll-to.mjs +112 -0
  56. package/aot/compiler/static-eval.mjs +315 -7
  57. package/aot/compiler/style-text.mjs +20 -5
  58. package/aot/compiler/svg.mjs +13 -7
  59. package/aot/compiler/switch-cases.mjs +198 -0
  60. package/aot/compiler/tagged-records.mjs +450 -0
  61. package/aot/compiler/typing.mjs +307 -0
  62. package/aot/compiler/updaters.mjs +321 -0
  63. package/aot/compiler/window-dimensions.mjs +94 -0
  64. package/aot/compiler/worked-values.mjs +319 -0
  65. package/aot/demo-file.mjs +30 -0
  66. package/aot/style-map.mjs +94 -3
  67. package/assets/bake-font.mjs +187 -244
  68. package/assets/bake-image.mjs +47 -71
  69. package/assets/bake-svg.mjs +465 -533
  70. package/assets/build-builtin-font.mjs +14 -27
  71. package/assets/emit-c.mjs +124 -204
  72. package/assets/emit-container.mjs +129 -197
  73. package/assets/emit-pack.mjs +92 -136
  74. package/assets/font-config.mjs +19 -27
  75. package/assets/font-sizes.mjs +432 -507
  76. package/assets/glyph-coverage.mjs +170 -214
  77. package/assets/index.mjs +52 -97
  78. package/assets/rasterize.mjs +173 -194
  79. package/assets/svg-loader.mjs +42 -48
  80. package/build.mjs +85 -94
  81. package/cli.mjs +490 -586
  82. package/compile-bin.mjs +24 -36
  83. package/flash.mjs +297 -401
  84. package/hotreload/dev-device.mjs +229 -270
  85. package/hotreload/pack-app.mjs +118 -159
  86. package/hotreload/pack-split.mjs +146 -213
  87. package/hotreload/package-transfer.mjs +128 -131
  88. package/hotreload/protocol.mjs +118 -118
  89. package/hotreload/uploader.mjs +132 -159
  90. package/hotreload/watch-tree.mjs +56 -65
  91. package/pack-container.mjs +94 -116
  92. package/package.json +19 -16
  93. package/persist-transform.mjs +89 -105
  94. package/qjsc-wasm.mjs +47 -72
  95. package/sim/embedded-react.wasm +0 -0
  96. package/sim/index.html +1 -1
  97. package/sim-server.mjs +260 -354
  98. package/src/embedded-react/Alert.mjs +112 -0
  99. package/src/embedded-react/Animated.mjs +412 -0
  100. package/src/embedded-react/{AppRegistry.js → AppRegistry.mjs} +26 -25
  101. package/src/embedded-react/{Button.js → Button.mjs} +29 -53
  102. package/src/embedded-react/Dimensions.mjs +32 -0
  103. package/src/embedded-react/Easing.mjs +34 -0
  104. package/src/embedded-react/{FlatList.js → FlatList.mjs} +25 -42
  105. package/src/embedded-react/{ImageBackground.js → ImageBackground.mjs} +11 -22
  106. package/src/embedded-react/Keyboard.mjs +82 -0
  107. package/src/embedded-react/{LayoutAnimation.js → LayoutAnimation.mjs} +17 -28
  108. package/src/embedded-react/PanResponder.mjs +256 -0
  109. package/src/embedded-react/{Platform.js → Platform.mjs} +8 -9
  110. package/src/embedded-react/{Pressable.js → Pressable.mjs} +12 -25
  111. package/src/embedded-react/SectionList.mjs +103 -0
  112. package/src/embedded-react/{StyleSheet.js → StyleSheet.mjs} +16 -20
  113. package/src/embedded-react/{TouchableOpacity.js → TouchableOpacity.mjs} +47 -83
  114. package/src/embedded-react/background-image.mjs +321 -0
  115. package/src/embedded-react/{components.js → components.mjs} +1 -3
  116. package/src/embedded-react/{imperative.js → imperative.mjs} +27 -38
  117. package/src/embedded-react/index.d.ts +238 -5
  118. package/src/embedded-react/index.js +26 -17
  119. package/src/embedded-react/layout-anim-config.mjs +85 -0
  120. package/src/embedded-react/{list-child.js → list-child.mjs} +11 -20
  121. package/src/embedded-react/{named-colors.js → named-colors.mjs} +2 -6
  122. package/src/embedded-react/nativeModule.mjs +371 -0
  123. package/src/embedded-react/split-style.mjs +57 -0
  124. package/src/embedded-react/svg-ops.mjs +1075 -0
  125. package/src/embedded-react/{useHostValue.js → useHostValue.mjs} +2 -4
  126. package/src/embedded-react/{usePersistentState.js → usePersistentState.mjs} +34 -38
  127. package/src/embedded-react/{warn-props.js → warn-props.mjs} +32 -39
  128. package/src/host-config.mjs +512 -0
  129. package/src/{native-ui.js → native-ui.mjs} +1 -8
  130. package/src/props.mjs +341 -0
  131. package/src/{renderer.js → renderer.mjs} +30 -44
  132. package/src/embedded-react/Animated.js +0 -440
  133. package/src/embedded-react/Easing.js +0 -39
  134. package/src/embedded-react/PanResponder.js +0 -330
  135. package/src/embedded-react/SectionList.js +0 -148
  136. package/src/embedded-react/layout-anim-config.js +0 -101
  137. package/src/embedded-react/split-style.js +0 -58
  138. package/src/embedded-react/svg-ops.js +0 -1295
  139. package/src/host-config.js +0 -548
  140. package/src/props.js +0 -306
@@ -1,440 +0,0 @@
1
- /*
2
- * Copyright 2026 Cory Lamming
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- // Animated — the React Native analog, backed by the engine's native-driver value system
18
- // (er_animation_value_*). An Animated.Value is a handle to an engine-side float; binding it to a node
19
- // prop (via Animated.View) lets the engine advance the animation each frame with NO per-frame JS.
20
- import {createElement, useRef, useEffect} from 'react';
21
- import {NativeUI} from '../native-ui.js';
22
- import {deepEqualProps} from '../props.js';
23
-
24
- // The style keys an animated value can drive only through an interpolation onto colors.
25
- const COLOR_PROPS = new Set(['backgroundColor', 'color']);
26
-
27
- let _warnedColorBind = false;
28
- let _warnedNumberBind = false;
29
-
30
- /** Warns once that `prop` takes a color, which a plain float or a numeric outputRange cannot give it. */
31
- function warnColorBind(prop) {
32
- if (_warnedColorBind) return;
33
- _warnedColorBind = true;
34
- console.warn(
35
- `embedded-react: an animated "${prop}" needs colors: bind value.interpolate({inputRange, ` +
36
- `outputRange: ['#000', '#fff']}) rather than the value itself, which is ignored.`,
37
- );
38
- }
39
-
40
- /** Warns once that `prop` takes numbers, which an outputRange holding anything else cannot give it. */
41
- function warnNumberBind(prop) {
42
- if (_warnedNumberBind) return;
43
- _warnedNumberBind = true;
44
- console.warn(
45
- `embedded-react: an animated "${prop}" takes an outputRange of numbers; this one is ignored.`,
46
- );
47
- }
48
-
49
- /** A standalone animatable value bound to an engine-side float. */
50
- export class AnimatedValue {
51
- constructor(initial = 0) {
52
- this.__animated = true;
53
- this._handle = NativeUI.animValueCreate(initial);
54
- this._value = initial;
55
- this._destroyed = false;
56
- }
57
-
58
- setValue(value) {
59
- this._value = value;
60
- NativeUI.animValueSet(this._handle, value);
61
- }
62
-
63
- /**
64
- * Releases the engine-side value slot. The engine's value pool is fixed-size (unlike RN, where the
65
- * JS value is simply garbage-collected), so a value tied to a mounting/unmounting component must be
66
- * freed explicitly — see useAnimatedValue. Idempotent; the value must not be used after destroy().
67
- */
68
- destroy() {
69
- if (this._destroyed) return;
70
- this._destroyed = true;
71
- NativeUI.animValueDestroy(this._handle);
72
- }
73
-
74
- __getValue() {
75
- return NativeUI.animValueGet(this._handle);
76
- }
77
-
78
- __bind(node, prop) {
79
- // The engine applies the current value on bind and ignores duplicate (node, prop) pairs, so
80
- // this is safe to call on every render.
81
- if (COLOR_PROPS.has(prop)) {
82
- warnColorBind(prop);
83
- return;
84
- }
85
- NativeUI.animValueBind(this._handle, node, prop);
86
- }
87
-
88
- interpolate(config) {
89
- return new AnimatedInterpolation(this, config);
90
- }
91
- }
92
-
93
- /**
94
- * A value derived from a parent Animated.Value through a piecewise-linear interpolation.
95
- * config = { inputRange, outputRange, extrapolate?, extrapolateLeft?, extrapolateRight? }; the
96
- * extrapolate tokens ('extend' | 'clamp' | 'identity') control behavior outside the input range.
97
- */
98
- export class AnimatedInterpolation {
99
- constructor(parent, config) {
100
- this.__animated = true;
101
- this._parent = parent;
102
- this._config = config;
103
- }
104
-
105
- __bind(node, prop) {
106
- const outputRange = this._config?.outputRange;
107
- if (Array.isArray(outputRange)) {
108
- if (COLOR_PROPS.has(prop)) {
109
- if (outputRange.some(output => typeof output !== 'string')) {
110
- warnColorBind(prop);
111
- return;
112
- }
113
- } else if (outputRange.some(output => typeof output !== 'number')) {
114
- warnNumberBind(prop);
115
- return;
116
- }
117
- }
118
- NativeUI.animValueBindInterpolated(
119
- this._parent._handle,
120
- node,
121
- prop,
122
- this._config,
123
- );
124
- }
125
-
126
- /**
127
- * Two interpolations drive a prop identically when they map the same parent value through the same
128
- * config. The host config asks because `value.interpolate(...)` builds a fresh object on every
129
- * render: without this an unchanged interpolated style would be unbound and re-bound each commit.
130
- */
131
- __bindEq(other) {
132
- return (
133
- other instanceof AnimatedInterpolation &&
134
- other._parent === this._parent &&
135
- deepEqualProps(this._config, other._config)
136
- );
137
- }
138
-
139
- interpolate(config) {
140
- // Chained interpolation isn't supported by the engine; re-map against the same parent.
141
- return new AnimatedInterpolation(this._parent, config);
142
- }
143
- }
144
-
145
- /** Wraps callback so it runs at most once, regardless of how many times it is invoked. */
146
- function once(callback) {
147
- let called = false;
148
- return argument => {
149
- if (called) return;
150
- called = true;
151
- if (callback) callback(argument);
152
- };
153
- }
154
-
155
- /**
156
- * Wraps a NativeUI animation call in an object with start()/stop() (RN's animation handle shape).
157
- *
158
- * start(onComplete) wires the engine's completion callback through the bridge: onComplete is called
159
- * with `{ finished }` when the animation ends naturally (finished: true) or is interrupted by a new
160
- * animation / stop() (finished: false). `_value` is exposed so Animated.loop can reset it between
161
- * iterations.
162
- */
163
- function makeAnimation(value, toValue, config) {
164
- let handle = 0;
165
- return {
166
- _value: value,
167
- start(onComplete) {
168
- // Always pass a wrapper so we can null out the (possibly recycled) handle on completion.
169
- const onEnd = finished => {
170
- handle = 0;
171
- if (onComplete) onComplete({finished: !!finished});
172
- };
173
- handle = NativeUI.animValueAnimate(value._handle, toValue, config, onEnd);
174
- },
175
- stop() {
176
- if (handle) NativeUI.animStop(handle);
177
- },
178
- };
179
- }
180
-
181
- export function timing(value, config = {}) {
182
- const {toValue = 0, useNativeDriver, ...rest} = config;
183
- return makeAnimation(value, toValue, {type: 'timing', ...rest});
184
- }
185
-
186
- export function spring(value, config = {}) {
187
- const {toValue = 0, useNativeDriver, ...rest} = config;
188
- return makeAnimation(value, toValue, {type: 'spring', ...rest});
189
- }
190
-
191
- export function decay(value, config = {}) {
192
- const {useNativeDriver, ...rest} = config;
193
- // Decay coasts from its velocity; the engine ignores the target, so pass the current value.
194
- return makeAnimation(value, value.__getValue(), {type: 'decay', ...rest});
195
- }
196
-
197
- // --- Composition -------------------------------------------------------------------------------
198
- // These are pure JS over each child animation's start()/stop() + the §2 timer globals. The engine
199
- // deactivates a finished animation before firing its completion callback, so chaining the next
200
- // animation from inside a completion handler is safe (no per-frame JS — each child still runs in C).
201
-
202
- /** Runs animations one after another; each starts when the previous finishes. */
203
- export function sequence(animations) {
204
- let current = 0;
205
- let stopped = false;
206
- return {
207
- start(onComplete) {
208
- // Reset the per-run state so the sequence is restartable — e.g., each iteration of Animated.loop calls
209
- // start() again. Without this, `current` stays at animations.length from the previous run, so the next
210
- // start() completes instantly and the loop re-enters synchronously → stack overflow.
211
- current = 0;
212
- stopped = false;
213
- const done = once(onComplete);
214
- const next = result => {
215
- if (stopped || !result || result.finished === false) {
216
- done({finished: false});
217
- return;
218
- }
219
- if (current >= animations.length) {
220
- done({finished: true});
221
- return;
222
- }
223
- animations[current++].start(next);
224
- };
225
- next({finished: true}); // kick off the first entry
226
- },
227
- stop() {
228
- stopped = true;
229
- if (current > 0 && current <= animations.length)
230
- animations[current - 1].stop();
231
- },
232
- };
233
- }
234
-
235
- /** Runs animations simultaneously; completes when all finish. stopTogether (default true). */
236
- export function parallel(animations, config) {
237
- const stopTogether = !config || config.stopTogether !== false;
238
- let stopped = false;
239
- return {
240
- start(onComplete) {
241
- const done = once(onComplete);
242
- const total = animations.length;
243
- if (total === 0) {
244
- done({finished: true});
245
- return;
246
- }
247
- let doneCount = 0;
248
- let anyUnfinished = false;
249
- const onChild = result => {
250
- doneCount++;
251
- if (!result || result.finished === false) {
252
- anyUnfinished = true;
253
- if (stopTogether && !stopped) {
254
- stopped = true;
255
- for (const animation of animations) animation.stop();
256
- }
257
- }
258
- if (doneCount >= total) done({finished: !anyUnfinished});
259
- };
260
- for (const animation of animations) animation.start(onChild);
261
- },
262
- stop() {
263
- stopped = true;
264
- for (const animation of animations) animation.stop();
265
- },
266
- };
267
- }
268
-
269
- /** Like parallel, but each animation starts `delay` ms after the previous one (uses setTimeout). */
270
- export function stagger(delay, animations) {
271
- let stopped = false;
272
- const timers = [];
273
- return {
274
- start(onComplete) {
275
- const done = once(onComplete);
276
- const total = animations.length;
277
- if (total === 0) {
278
- done({finished: true});
279
- return;
280
- }
281
- let doneCount = 0;
282
- let anyUnfinished = false;
283
- const onChild = result => {
284
- doneCount++;
285
- if (!result || result.finished === false) anyUnfinished = true;
286
- if (doneCount >= total) done({finished: !anyUnfinished});
287
- };
288
- animations.forEach((animation, index) => {
289
- if (index === 0) {
290
- animation.start(onChild);
291
- } else {
292
- timers.push(
293
- setTimeout(() => {
294
- if (!stopped) animation.start(onChild);
295
- }, delay * index),
296
- );
297
- }
298
- });
299
- },
300
- stop() {
301
- stopped = true;
302
- for (const timer of timers) clearTimeout(timer);
303
- for (const animation of animations) animation.stop();
304
- },
305
- };
306
- }
307
-
308
- /** An animation that simply waits `time` ms — useful as a spacer inside sequence (uses setTimeout). */
309
- export function delay(time) {
310
- let timer = 0;
311
- return {
312
- start(onComplete) {
313
- const done = once(onComplete);
314
- timer = setTimeout(() => {
315
- timer = 0;
316
- done({finished: true});
317
- }, time);
318
- },
319
- stop() {
320
- if (timer) {
321
- clearTimeout(timer);
322
- timer = 0;
323
- }
324
- },
325
- };
326
- }
327
-
328
- /**
329
- * Repeats an animation. iterations: -1 (default) loops forever; otherwise that many times.
330
- * By default the underlying value is reset to its loop-start position before each iteration
331
- * (resetBeforeIteration), matching RN — so a timing 0→1 repeats 0→1 rather than ping-ponging.
332
- */
333
- export function loop(animation, config) {
334
- const iterations =
335
- config && Number.isInteger(config.iterations) ? config.iterations : -1;
336
- const resetBeforeIteration = !config || config.resetBeforeIteration !== false;
337
- let stopped = false;
338
- return {
339
- _value: animation._value,
340
- start(onComplete) {
341
- const done = once(onComplete);
342
- const startValue =
343
- resetBeforeIteration && animation._value
344
- ? animation._value.__getValue()
345
- : null;
346
- let count = 0;
347
- const startIteration = () => {
348
- if (stopped) {
349
- done({finished: false});
350
- return;
351
- }
352
- if (iterations >= 0 && count >= iterations) {
353
- done({finished: true});
354
- return;
355
- }
356
- count++;
357
- if (
358
- resetBeforeIteration &&
359
- animation._value &&
360
- startValue != null &&
361
- count > 1
362
- ) {
363
- animation._value.setValue(startValue);
364
- }
365
- animation.start(onIterationDone);
366
- };
367
- const onIterationDone = result => {
368
- if (stopped || !result || result.finished === false) {
369
- done({finished: false});
370
- return;
371
- }
372
- // Defer the next iteration to a fresh task instead of starting it inline. A child animation can
373
- // complete *synchronously* (a long-duration timing finishing inside one large catch-up frame in
374
- // the simulator), and starting the next iteration from within, that completion callback would
375
- // recurse — loop → child → completion → loop → … — until the stack overflows. setTimeout breaks
376
- // the chain: the host pump runs it on the next frame, by which point real time has advanced so
377
- // the animation runs its full duration again. (Negligible cost in the normal async case.)
378
- setTimeout(startIteration, 0);
379
- };
380
- startIteration();
381
- },
382
- stop() {
383
- stopped = true;
384
- animation.stop();
385
- },
386
- };
387
- }
388
-
389
- /**
390
- * Returns a stable Animated.Value that persists across renders (the analog of
391
- * `useRef(new Animated.Value(initial)).current`), and frees the engine-side value slot when the
392
- * component unmounts. The unmount cleanup matters here in a way it doesn't in React Native: the
393
- * engine's value pool is fixed-size, so a value owned by a mounting/unmounting component (e.g., a list
394
- * row or a tab screen) would otherwise leak a slot on every unmount.
395
- */
396
- export function useAnimatedValue(initial = 0) {
397
- const ref = useRef(null);
398
- if (ref.current == null) {
399
- ref.current = new AnimatedValue(initial);
400
- }
401
- // Empty deps → the cleanup runs only on unmount. `initial` is read once on the first render (matching
402
- // useRef semantics); later changes don't recreate the value, as in React Native.
403
- useEffect(() => {
404
- const value = ref.current;
405
- return () => value.destroy();
406
- }, []);
407
- return ref.current;
408
- }
409
-
410
- /**
411
- * Wraps a host component for RN API parity. The style is forwarded untouched: the host config splits
412
- * the animated values out of ANY element's style and binds them (native driver), so `<Animated.View
413
- * style={{opacity: v}}>` and `<View style={{opacity: v}}>` render identically.
414
- *
415
- * The wrapper used to strip the bindings itself and apply them through a ref. Binding in two places
416
- * was the reason a prop that stopped being animated kept following its old value: the ref knew what it
417
- * had bound, but it ran after the commit had already written the props, and the host config — the only
418
- * side that sees the PREVIOUS render — never saw those bindings at all, so nothing released them.
419
- */
420
- export function createAnimatedComponent(Component) {
421
- return function AnimatedComponent(props) {
422
- return createElement(Component, props);
423
- };
424
- }
425
-
426
- export const Animated = {
427
- Value: AnimatedValue,
428
- View: createAnimatedComponent('View'),
429
- Text: createAnimatedComponent('Text'),
430
- Image: createAnimatedComponent('Image'),
431
- timing,
432
- spring,
433
- decay,
434
- sequence,
435
- parallel,
436
- stagger,
437
- delay,
438
- loop,
439
- createAnimatedComponent,
440
- };
@@ -1,39 +0,0 @@
1
- /*
2
- * Copyright 2026 Cory Lamming
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- // Easing tokens. The engine implements a fixed set of easing curves (ERAnimationEasing), so unlike RN's
18
- // composable Easing functions these are string tokens the bridge maps to the engine enum. `bezier`
19
- // returns a control-point object the bridge reads as a custom cubic-bezier curve.
20
- export const Easing = {
21
- linear: 'linear',
22
- ease: 'ease',
23
- easeIn: 'easeIn',
24
- easeOut: 'easeOut',
25
- easeInOut: 'easeInOut',
26
- quadIn: 'quadIn',
27
- quadOut: 'quadOut',
28
- quadInOut: 'quadInOut',
29
- cubicIn: 'cubicIn',
30
- cubicOut: 'cubicOut',
31
- cubicInOut: 'cubicInOut',
32
- bounceOut: 'bounceOut',
33
- elasticOut: 'elasticOut',
34
-
35
- /** Custom cubic-bezier curve via control points. */
36
- bezier(x1, y1, x2, y2) {
37
- return {x1, y1, x2, y2};
38
- },
39
- };