@rootnative/inertia 0.0.2 → 0.0.4
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/CHANGELOG.md +63 -5
- package/README.md +5 -3
- package/dist/{chunk-ZN3PNGHQ.mjs → chunk-4ASOELLA.mjs} +1 -1
- package/dist/{chunk-LYMLQ6WQ.mjs → chunk-55W7BNO2.mjs} +604 -106
- package/dist/chunk-5SRD2WCO.js +8 -0
- package/dist/{chunk-PTRF47DA.js → chunk-7A6WTXNK.js} +10 -3
- package/dist/{chunk-NKA6XR77.js → chunk-CENTULW6.js} +2 -2
- package/dist/{chunk-4PEHWDAZ.js → chunk-D5KAHWMC.js} +7 -7
- package/dist/{chunk-2DHKV2XY.mjs → chunk-J5Q46OPW.mjs} +1 -1
- package/dist/{chunk-RGNX6UZN.mjs → chunk-K3CLP74S.mjs} +2 -2
- package/dist/{chunk-IWLU3VDE.js → chunk-MYE5NMXW.js} +623 -123
- package/dist/{chunk-HFDZAHWP.mjs → chunk-NAOXQJ7U.mjs} +1 -1
- package/dist/{chunk-R63GIUNU.mjs → chunk-QKC3APP4.mjs} +1 -1
- package/dist/{chunk-V6BTXHZK.mjs → chunk-RF7J5FRM.mjs} +1 -1
- package/dist/{chunk-CY7Y64C3.mjs → chunk-TU2XFPAK.mjs} +10 -4
- package/dist/chunk-TVFNJ25Z.js +8 -0
- package/dist/chunk-VLDIFL3F.js +8 -0
- package/dist/{chunk-7AOERN53.js → chunk-WVRCKOPO.js} +3 -3
- package/dist/{chunk-TUYHTHVV.js → chunk-XMEVPEMH.js} +2 -2
- package/dist/{chunk-TUMNV4P7.mjs → chunk-YKGY22SB.mjs} +1 -1
- package/dist/gestureLayer/index.d.mts +2 -2
- package/dist/gestureLayer/index.d.ts +2 -2
- package/dist/gestureLayer/index.js +10 -10
- package/dist/gestureLayer/index.mjs +3 -3
- package/dist/index.d.mts +14 -12
- package/dist/index.d.ts +14 -12
- package/dist/index.js +68 -176
- package/dist/index.mjs +40 -147
- package/dist/motion/Image.d.mts +1 -1
- package/dist/motion/Image.d.ts +1 -1
- package/dist/motion/Image.js +5 -5
- package/dist/motion/Image.mjs +4 -4
- package/dist/motion/Pressable.d.mts +1 -1
- package/dist/motion/Pressable.d.ts +1 -1
- package/dist/motion/Pressable.js +5 -5
- package/dist/motion/Pressable.mjs +4 -4
- package/dist/motion/ScrollView.d.mts +1 -1
- package/dist/motion/ScrollView.d.ts +1 -1
- package/dist/motion/ScrollView.js +5 -5
- package/dist/motion/ScrollView.mjs +4 -4
- package/dist/motion/Text.d.mts +1 -1
- package/dist/motion/Text.d.ts +1 -1
- package/dist/motion/Text.js +5 -5
- package/dist/motion/Text.mjs +4 -4
- package/dist/motion/View.d.mts +1 -1
- package/dist/motion/View.d.ts +1 -1
- package/dist/motion/View.js +5 -5
- package/dist/motion/View.mjs +4 -4
- package/dist/touch/index.d.mts +1 -1
- package/dist/touch/index.d.ts +1 -1
- package/dist/touch/index.js +3 -3
- package/dist/touch/index.mjs +1 -1
- package/dist/{types-G1dBU2IQ.d.mts → types-37pN82yh.d.mts} +49 -14
- package/dist/{types-G1dBU2IQ.d.ts → types-37pN82yh.d.ts} +49 -14
- package/dist/{useGesture-D1e4ixJo.d.ts → useGesture-Cl4uzZIr.d.ts} +1 -1
- package/dist/{useGesture-RFY6kTL3.d.mts → useGesture-_IKkS8Dv.d.mts} +1 -1
- package/llms.txt +3 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/internal/boxShadow.ts +177 -6
- package/src/internal/nonWorkletWarning.ts +4 -6
- package/src/internal/warnOnce.ts +28 -0
- package/src/layout/index.ts +11 -0
- package/src/layout/measureWindow.ts +135 -0
- package/src/layout/sharedRegistry.ts +156 -18
- package/src/layout/useSharedLayout.ts +256 -91
- package/src/motion/createMotionComponent.tsx +550 -55
- package/src/motion/installCheck.ts +1 -1
- package/src/presence/Presence.tsx +73 -10
- package/src/transitions/index.ts +1 -1
- package/src/types.ts +52 -12
- package/src/values/useAnimator.ts +25 -14
- package/src/values/useColorCascade.ts +34 -16
- package/src/values/useColorTransition.ts +1 -1
- package/dist/chunk-34Q4UM6V.js +0 -8
- package/dist/chunk-KYJROYCG.js +0 -8
- package/dist/chunk-X5J5M3K3.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stableSig, isTopLevelTransition } from './chunk-
|
|
1
|
+
import { stableSig, isTopLevelTransition } from './chunk-TU2XFPAK.mjs';
|
|
2
2
|
import { createContext, useContext, useMemo } from 'react';
|
|
3
3
|
import { useReducedMotion } from 'react-native-reanimated';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -3,16 +3,22 @@ import { withSequence, Easing, withDecay, withTiming, withSpring, withRepeat, wi
|
|
|
3
3
|
|
|
4
4
|
// src/transitions/easing.ts
|
|
5
5
|
|
|
6
|
-
// src/internal/
|
|
6
|
+
// src/internal/warnOnce.ts
|
|
7
7
|
var warned = /* @__PURE__ */ new Set();
|
|
8
|
-
function
|
|
8
|
+
function warnOnce(key, message) {
|
|
9
9
|
if (!__DEV__) return;
|
|
10
|
-
if (typeof process !== "undefined" && process.env?.JEST_WORKER_ID) return;
|
|
11
10
|
if (warned.has(key)) return;
|
|
12
11
|
warned.add(key);
|
|
13
12
|
console.warn(message);
|
|
14
13
|
}
|
|
15
14
|
|
|
15
|
+
// src/internal/nonWorkletWarning.ts
|
|
16
|
+
function warnNonWorkletOnce(key, message) {
|
|
17
|
+
if (!__DEV__) return;
|
|
18
|
+
if (typeof process !== "undefined" && process.env?.JEST_WORKER_ID) return;
|
|
19
|
+
warnOnce(key, message);
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
// src/transitions/easing.ts
|
|
17
23
|
function ensureWorkletEasing(easing) {
|
|
18
24
|
if (!easing) return void 0;
|
|
@@ -270,4 +276,4 @@ function stableStringify(v) {
|
|
|
270
276
|
return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
|
|
271
277
|
}
|
|
272
278
|
|
|
273
|
-
export { DEFAULT_SPRING, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce };
|
|
279
|
+
export { DEFAULT_SPRING, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce, warnOnce };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7A6WTXNK_js = require('./chunk-7A6WTXNK.js');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -32,7 +32,7 @@ function MotionConfig({
|
|
|
32
32
|
children
|
|
33
33
|
}) {
|
|
34
34
|
const parent = useMotionConfig();
|
|
35
|
-
const transitionsSig =
|
|
35
|
+
const transitionsSig = chunk7A6WTXNK_js.stableSig(transitions);
|
|
36
36
|
const value = react.useMemo(
|
|
37
37
|
() => ({
|
|
38
38
|
reducedMotion: reducedMotion ?? parent.reducedMotion,
|
|
@@ -66,7 +66,7 @@ function resolveNamedTransitionProp(transition, registry) {
|
|
|
66
66
|
if (typeof transition === "string") {
|
|
67
67
|
return lookupNamedTransition(transition, registry);
|
|
68
68
|
}
|
|
69
|
-
if (
|
|
69
|
+
if (chunk7A6WTXNK_js.isTopLevelTransition(transition)) return transition;
|
|
70
70
|
const map = transition;
|
|
71
71
|
let out = null;
|
|
72
72
|
for (const key in map) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMYE5NMXW_js = require('./chunk-MYE5NMXW.js');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
|
|
6
|
-
var MotionScrollView =
|
|
6
|
+
var MotionScrollView = chunkMYE5NMXW_js.createMotionComponent(reactNative.ScrollView);
|
|
7
7
|
|
|
8
8
|
exports.MotionScrollView = MotionScrollView;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
|
|
2
|
-
import { U as UseGestureHandlers } from '../useGesture-
|
|
3
|
-
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-
|
|
2
|
+
import { U as UseGestureHandlers } from '../useGesture-_IKkS8Dv.mjs';
|
|
3
|
+
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-37pN82yh.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
|
|
2
|
-
import { U as UseGestureHandlers } from '../useGesture-
|
|
3
|
-
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-
|
|
2
|
+
import { U as UseGestureHandlers } from '../useGesture-Cl4uzZIr.js';
|
|
3
|
+
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-37pN82yh.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkD5KAHWMC_js = require('../chunk-D5KAHWMC.js');
|
|
4
|
+
var chunkWVRCKOPO_js = require('../chunk-WVRCKOPO.js');
|
|
5
|
+
var chunk7A6WTXNK_js = require('../chunk-7A6WTXNK.js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
8
8
|
|
|
9
9
|
function useGestureLayer(states, options = {}) {
|
|
10
10
|
const { disabled: isDisabled = false, transition: transitionInput } = options;
|
|
11
|
-
const shouldReduceMotion =
|
|
12
|
-
const transition =
|
|
11
|
+
const shouldReduceMotion = chunkWVRCKOPO_js.useShouldReduceMotion();
|
|
12
|
+
const transition = chunkWVRCKOPO_js.resolveNamedTransitionProp(
|
|
13
13
|
transitionInput,
|
|
14
|
-
|
|
14
|
+
chunkWVRCKOPO_js.useNamedTransitions()
|
|
15
15
|
);
|
|
16
|
-
const gesture =
|
|
16
|
+
const gesture = chunkD5KAHWMC_js.useGesture(transition);
|
|
17
17
|
const disabledProgress = reactNativeReanimated.useSharedValue(0);
|
|
18
|
-
const transitionSig =
|
|
18
|
+
const transitionSig = chunk7A6WTXNK_js.stableSig(transition);
|
|
19
19
|
react.useEffect(() => {
|
|
20
20
|
const target = isDisabled ? 1 : 0;
|
|
21
21
|
const cfg = shouldReduceMotion ? { type: "no-animation" } : disabledTransition(transition) ?? { type: "spring" };
|
|
22
|
-
disabledProgress.value =
|
|
22
|
+
disabledProgress.value = chunk7A6WTXNK_js.resolveTransition(cfg, target);
|
|
23
23
|
}, [isDisabled, shouldReduceMotion, transitionSig, disabledProgress]);
|
|
24
24
|
const meta = react.useMemo(() => {
|
|
25
25
|
const layers = {
|
|
@@ -154,7 +154,7 @@ function useGestureLayer(states, options = {}) {
|
|
|
154
154
|
}
|
|
155
155
|
function disabledTransition(transition) {
|
|
156
156
|
if (!transition) return void 0;
|
|
157
|
-
if (
|
|
157
|
+
if (chunk7A6WTXNK_js.isTopLevelTransition(transition)) return transition;
|
|
158
158
|
return void 0;
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useGesture } from '../chunk-
|
|
2
|
-
import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions } from '../chunk-
|
|
3
|
-
import { stableSig, resolveTransition, isTopLevelTransition } from '../chunk-
|
|
1
|
+
import { useGesture } from '../chunk-K3CLP74S.mjs';
|
|
2
|
+
import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions } from '../chunk-QKC3APP4.mjs';
|
|
3
|
+
import { stableSig, resolveTransition, isTopLevelTransition } from '../chunk-TU2XFPAK.mjs';
|
|
4
4
|
import { useEffect, useMemo } from 'react';
|
|
5
5
|
import { useSharedValue, useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -2,11 +2,11 @@ import * as react from 'react';
|
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
|
|
5
|
-
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-
|
|
6
|
-
export { c as AnimateStyle, d as AnimationCallbackInfo, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-
|
|
5
|
+
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-37pN82yh.mjs';
|
|
6
|
+
export { c as AnimateStyle, d as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-37pN82yh.mjs';
|
|
7
7
|
import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
|
|
8
8
|
export { SharedValue } from 'react-native-reanimated';
|
|
9
|
-
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-
|
|
9
|
+
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-_IKkS8Dv.mjs';
|
|
10
10
|
export { MotionImage } from './motion/Image.mjs';
|
|
11
11
|
export { MotionPressable } from './motion/Pressable.mjs';
|
|
12
12
|
export { MotionScrollView } from './motion/ScrollView.mjs';
|
|
@@ -355,9 +355,11 @@ declare function useAnimation(target: number, transition?: TransitionInput): Sha
|
|
|
355
355
|
* `<MotionConfig reducedMotion>`. Hand-rolled `resolveTransition` writes
|
|
356
356
|
* silently bypass that setting — a correctness bug this hook fixes.
|
|
357
357
|
*
|
|
358
|
-
* The returned callback is stable
|
|
359
|
-
* the reduced-motion flag
|
|
360
|
-
*
|
|
358
|
+
* The returned callback is identity-stable for the lifetime of the component —
|
|
359
|
+
* it reads the registry and the reduced-motion flag out of refs at call time,
|
|
360
|
+
* so neither a new `<MotionConfig transitions>` map nor a reduced-motion change
|
|
361
|
+
* gives it a new identity. Drop it straight into memoized handlers or a
|
|
362
|
+
* `useCallback` dependency list without churning them.
|
|
361
363
|
*
|
|
362
364
|
* This is not a new animation API — it starts animations in Inertia's existing
|
|
363
365
|
* transition vocabulary, so it does not conflict with the "no imperative-only
|
|
@@ -412,7 +414,7 @@ declare function useBooleanSpring(active: boolean, springConfig?: SpringTransiti
|
|
|
412
414
|
|
|
413
415
|
/**
|
|
414
416
|
* Color style keys understood by React Native that this hook can target.
|
|
415
|
-
* Sticks to the keys that exist on the
|
|
417
|
+
* Sticks to the keys that exist on the animatable surface so the
|
|
416
418
|
* returned style fragment is always a legal RN style.
|
|
417
419
|
*/
|
|
418
420
|
type ColorStyleKey = 'backgroundColor' | 'color' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'tintColor' | 'shadowColor';
|
|
@@ -501,11 +503,11 @@ interface UseColorCascadeOptions {
|
|
|
501
503
|
* hook is not a replacement for it. For a mixed numeric + color cascade, or
|
|
502
504
|
* function-valued layers, drop to a hand-rolled `useAnimatedStyle`.
|
|
503
505
|
*
|
|
504
|
-
* The layer chain is resolved once on the JS thread and
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
* `
|
|
508
|
-
*
|
|
506
|
+
* The layer chain is resolved once on the JS thread and kept identity-stable,
|
|
507
|
+
* so a fresh-but-equal `layers` array each render produces no new UI-thread
|
|
508
|
+
* closure (CLAUDE.md principle 8). Changing a colour, the `key`, the base
|
|
509
|
+
* `rest`, the layer count, or **which shared value drives a layer** all rewire
|
|
510
|
+
* the worklet as you'd expect.
|
|
509
511
|
*/
|
|
510
512
|
declare function useColorCascade(rest: string, layers: readonly ColorCascadeLayer[], options?: UseColorCascadeOptions): ReturnType<typeof useAnimatedStyle>;
|
|
511
513
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import * as react from 'react';
|
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
|
|
5
|
-
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-
|
|
6
|
-
export { c as AnimateStyle, d as AnimationCallbackInfo, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-
|
|
5
|
+
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-37pN82yh.js';
|
|
6
|
+
export { c as AnimateStyle, d as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-37pN82yh.js';
|
|
7
7
|
import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
|
|
8
8
|
export { SharedValue } from 'react-native-reanimated';
|
|
9
|
-
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-
|
|
9
|
+
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-Cl4uzZIr.js';
|
|
10
10
|
export { MotionImage } from './motion/Image.js';
|
|
11
11
|
export { MotionPressable } from './motion/Pressable.js';
|
|
12
12
|
export { MotionScrollView } from './motion/ScrollView.js';
|
|
@@ -355,9 +355,11 @@ declare function useAnimation(target: number, transition?: TransitionInput): Sha
|
|
|
355
355
|
* `<MotionConfig reducedMotion>`. Hand-rolled `resolveTransition` writes
|
|
356
356
|
* silently bypass that setting — a correctness bug this hook fixes.
|
|
357
357
|
*
|
|
358
|
-
* The returned callback is stable
|
|
359
|
-
* the reduced-motion flag
|
|
360
|
-
*
|
|
358
|
+
* The returned callback is identity-stable for the lifetime of the component —
|
|
359
|
+
* it reads the registry and the reduced-motion flag out of refs at call time,
|
|
360
|
+
* so neither a new `<MotionConfig transitions>` map nor a reduced-motion change
|
|
361
|
+
* gives it a new identity. Drop it straight into memoized handlers or a
|
|
362
|
+
* `useCallback` dependency list without churning them.
|
|
361
363
|
*
|
|
362
364
|
* This is not a new animation API — it starts animations in Inertia's existing
|
|
363
365
|
* transition vocabulary, so it does not conflict with the "no imperative-only
|
|
@@ -412,7 +414,7 @@ declare function useBooleanSpring(active: boolean, springConfig?: SpringTransiti
|
|
|
412
414
|
|
|
413
415
|
/**
|
|
414
416
|
* Color style keys understood by React Native that this hook can target.
|
|
415
|
-
* Sticks to the keys that exist on the
|
|
417
|
+
* Sticks to the keys that exist on the animatable surface so the
|
|
416
418
|
* returned style fragment is always a legal RN style.
|
|
417
419
|
*/
|
|
418
420
|
type ColorStyleKey = 'backgroundColor' | 'color' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'tintColor' | 'shadowColor';
|
|
@@ -501,11 +503,11 @@ interface UseColorCascadeOptions {
|
|
|
501
503
|
* hook is not a replacement for it. For a mixed numeric + color cascade, or
|
|
502
504
|
* function-valued layers, drop to a hand-rolled `useAnimatedStyle`.
|
|
503
505
|
*
|
|
504
|
-
* The layer chain is resolved once on the JS thread and
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
* `
|
|
508
|
-
*
|
|
506
|
+
* The layer chain is resolved once on the JS thread and kept identity-stable,
|
|
507
|
+
* so a fresh-but-equal `layers` array each render produces no new UI-thread
|
|
508
|
+
* closure (CLAUDE.md principle 8). Changing a colour, the `key`, the base
|
|
509
|
+
* `rest`, the layer count, or **which shared value drives a layer** all rewire
|
|
510
|
+
* the worklet as you'd expect.
|
|
509
511
|
*/
|
|
510
512
|
declare function useColorCascade(rest: string, layers: readonly ColorCascadeLayer[], options?: UseColorCascadeOptions): ReturnType<typeof useAnimatedStyle>;
|
|
511
513
|
|