react-native-theme-transition 1.0.6 → 2.0.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.
- package/README.md +55 -43
- package/README.npm.md +55 -43
- package/dist/constants.d.ts +1 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/createThemeTransition.d.ts +6 -18
- package/dist/createThemeTransition.d.ts.map +1 -1
- package/dist/createThemeTransition.js +37 -35
- package/dist/createThemeTransition.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/overlay/SkiaOverlay.d.ts +17 -0
- package/dist/overlay/SkiaOverlay.d.ts.map +1 -0
- package/dist/overlay/SkiaOverlay.js +297 -0
- package/dist/overlay/SkiaOverlay.js.map +1 -0
- package/dist/overlay/captureView.d.ts +7 -0
- package/dist/overlay/captureView.d.ts.map +1 -0
- package/dist/overlay/captureView.js +31 -0
- package/dist/overlay/captureView.js.map +1 -0
- package/dist/overlay/resolveOrigin.d.ts +8 -0
- package/dist/overlay/resolveOrigin.d.ts.map +1 -0
- package/dist/overlay/resolveOrigin.js +68 -0
- package/dist/overlay/resolveOrigin.js.map +1 -0
- package/dist/overlay/types.d.ts +15 -0
- package/dist/overlay/types.d.ts.map +1 -0
- package/dist/overlay/types.js +61 -0
- package/dist/overlay/types.js.map +1 -0
- package/dist/setThemeDecision.d.ts +14 -0
- package/dist/setThemeDecision.d.ts.map +1 -0
- package/dist/setThemeDecision.js +27 -0
- package/dist/setThemeDecision.js.map +1 -0
- package/dist/transitionEngine.d.ts +48 -17
- package/dist/transitionEngine.d.ts.map +1 -1
- package/dist/transitionEngine.js +279 -208
- package/dist/transitionEngine.js.map +1 -1
- package/dist/transitionMeta.d.ts +136 -0
- package/dist/transitionMeta.d.ts.map +1 -0
- package/dist/transitionMeta.js +131 -0
- package/dist/transitionMeta.js.map +1 -0
- package/dist/types.d.ts +254 -193
- package/dist/types.d.ts.map +1 -1
- package/dist/validateSetThemeOptions.d.ts +15 -0
- package/dist/validateSetThemeOptions.d.ts.map +1 -0
- package/dist/validateSetThemeOptions.js +54 -0
- package/dist/validateSetThemeOptions.js.map +1 -0
- package/package.json +14 -6
- package/src/constants.ts +6 -0
- package/src/createThemeTransition.ts +57 -39
- package/src/index.ts +12 -9
- package/src/overlay/SkiaOverlay.tsx +629 -0
- package/src/overlay/captureView.ts +32 -0
- package/src/overlay/resolveOrigin.ts +81 -0
- package/src/overlay/types.ts +83 -0
- package/src/setThemeDecision.ts +48 -0
- package/src/transitionEngine.tsx +390 -247
- package/src/transitionMeta.ts +176 -0
- package/src/types.ts +272 -193
- package/src/validateSetThemeOptions.ts +76 -0
- package/dist/hooks/useTheme.d.ts +0 -14
- package/dist/hooks/useTheme.d.ts.map +0 -1
- package/dist/hooks/useTheme.js +0 -46
- package/dist/hooks/useTheme.js.map +0 -1
- package/src/hooks/useTheme.ts +0 -72
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Canvas, Circle, Fill, Group, ImageShader, Rect, Shader, Skia, Image as SkiaImage, usePathInterpolation, } from '@shopify/react-native-skia';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { useDerivedValue } from 'react-native-reanimated';
|
|
5
|
+
import { ABSOLUTE_FILL } from '../constants';
|
|
6
|
+
/** @internal Frozen style for the Canvas. Hoisted so JSX never reallocates. */
|
|
7
|
+
const CANVAS_STYLE = [ABSOLUTE_FILL, { pointerEvents: 'none' }];
|
|
8
|
+
/** @internal Static input domain for `usePathInterpolation`. */
|
|
9
|
+
const KEYFRAME_INPUT = [0, 1];
|
|
10
|
+
// ───────────────────────────── Path builders ──────────────────────────────
|
|
11
|
+
/**
|
|
12
|
+
* @internal Empirically tuned heart bezier reach factors. The bounding
|
|
13
|
+
* math in `useHeartSize` reads these to compute the smallest scale at
|
|
14
|
+
* which the path covers every screen corner. Kept next to the path
|
|
15
|
+
* builder so the bounds and the curve stay in sync when either is
|
|
16
|
+
* tweaked.
|
|
17
|
+
*/
|
|
18
|
+
const HEART_REACH = {
|
|
19
|
+
/** Bottom tip y-distance from `cy`, in heart-units. */
|
|
20
|
+
bottomTip: 0.7,
|
|
21
|
+
/** Top notch dip from `cy`, in heart-units (negative y). */
|
|
22
|
+
topNotch: 0.55,
|
|
23
|
+
/** Outer lobe x-reach in heart-units. */
|
|
24
|
+
lobeX: 1.2,
|
|
25
|
+
/** Outer lobe y-reach above `cy`, in heart-units. */
|
|
26
|
+
lobeY: 0.9,
|
|
27
|
+
/** Bezier control x for the inner curve into the bottom tip. */
|
|
28
|
+
innerLobeX: 0.7,
|
|
29
|
+
/** Y-reach factor for the bottom corners (`+y` direction). */
|
|
30
|
+
bottomCornerY: 0.65,
|
|
31
|
+
/** Y-reach factor for the top corners (`-y` direction, lobe rises higher). */
|
|
32
|
+
topCornerY: 0.75,
|
|
33
|
+
};
|
|
34
|
+
function makeHeartPath(cx, cy, w, h) {
|
|
35
|
+
const p = Skia.Path.Make();
|
|
36
|
+
p.moveTo(cx, cy + h * HEART_REACH.bottomTip);
|
|
37
|
+
p.cubicTo(cx - w * HEART_REACH.lobeX, cy + h * 0.1, cx - w * HEART_REACH.innerLobeX, cy - h * HEART_REACH.lobeY, cx, cy - h * HEART_REACH.topNotch);
|
|
38
|
+
p.cubicTo(cx + w * HEART_REACH.innerLobeX, cy - h * HEART_REACH.lobeY, cx + w * HEART_REACH.lobeX, cy + h * 0.1, cx, cy + h * HEART_REACH.bottomTip);
|
|
39
|
+
p.close();
|
|
40
|
+
return p;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @internal Star geometry. `INNER_RATIO` is the valley-to-tip ratio
|
|
44
|
+
* (5-point star with deep valleys). `OUTER_PADDING` over-extends the
|
|
45
|
+
* tips past the screen corner so the inner valleys still cover them.
|
|
46
|
+
*/
|
|
47
|
+
const STAR_GEOMETRY = { points: 5, innerRatio: 0.4, outerPadding: 1.05 };
|
|
48
|
+
function makeStarPath(cx, cy, rOuter, rInner) {
|
|
49
|
+
const p = Skia.Path.Make();
|
|
50
|
+
const step = Math.PI / STAR_GEOMETRY.points;
|
|
51
|
+
const start = -Math.PI / 2;
|
|
52
|
+
for (let i = 0; i < STAR_GEOMETRY.points * 2; i++) {
|
|
53
|
+
const r = i % 2 === 0 ? rOuter : rInner;
|
|
54
|
+
const a = start + i * step;
|
|
55
|
+
const x = cx + Math.cos(a) * r;
|
|
56
|
+
const y = cy + Math.sin(a) * r;
|
|
57
|
+
if (i === 0)
|
|
58
|
+
p.moveTo(x, y);
|
|
59
|
+
else
|
|
60
|
+
p.lineTo(x, y);
|
|
61
|
+
}
|
|
62
|
+
p.close();
|
|
63
|
+
return p;
|
|
64
|
+
}
|
|
65
|
+
/** @internal Order keyframes so `progress` 0 → 1 grows the shape (or shrinks if inverted). */
|
|
66
|
+
function orderKeyframes(inverted, tiny, full) {
|
|
67
|
+
return inverted ? [full, tiny] : [tiny, full];
|
|
68
|
+
}
|
|
69
|
+
// ──────────────────────────── Runtime shaders ─────────────────────────────
|
|
70
|
+
/**
|
|
71
|
+
* @internal Pixelize shader. Samples both the old and new snapshots at
|
|
72
|
+
* a shared block-cell center and crossfades them. `blockSize` follows a
|
|
73
|
+
* triangle curve so both images are chunkiest at the midpoint and clear
|
|
74
|
+
* at the endpoints; `blend` slides linearly from 0 (all old) to 1 (all
|
|
75
|
+
* new).
|
|
76
|
+
*/
|
|
77
|
+
const pixelizeShader = Skia.RuntimeEffect.Make(`
|
|
78
|
+
uniform shader imgOld;
|
|
79
|
+
uniform shader imgNew;
|
|
80
|
+
uniform float blockSize;
|
|
81
|
+
uniform float blend;
|
|
82
|
+
uniform float2 size;
|
|
83
|
+
|
|
84
|
+
half4 main(float2 xy) {
|
|
85
|
+
float2 cell = (floor(xy / blockSize) + 0.5) * blockSize;
|
|
86
|
+
cell = clamp(cell, float2(0.5), size - 0.5);
|
|
87
|
+
half4 a = imgOld.eval(cell);
|
|
88
|
+
half4 b = imgNew.eval(cell);
|
|
89
|
+
return a * (1.0 - blend) + b * blend;
|
|
90
|
+
}
|
|
91
|
+
`);
|
|
92
|
+
/**
|
|
93
|
+
* @internal Dissolve shader. Discards fragments whose deterministic
|
|
94
|
+
* noise value is below the current threshold, so the image disintegrates
|
|
95
|
+
* as `progress` rises.
|
|
96
|
+
*/
|
|
97
|
+
const dissolveShader = Skia.RuntimeEffect.Make(`
|
|
98
|
+
uniform shader img;
|
|
99
|
+
uniform float threshold;
|
|
100
|
+
uniform float grain;
|
|
101
|
+
|
|
102
|
+
half4 main(float2 xy) {
|
|
103
|
+
float2 cell = floor(xy / grain);
|
|
104
|
+
float n = fract(sin(dot(cell, float2(12.9898, 78.233))) * 43758.5453);
|
|
105
|
+
if (n < threshold) return half4(0.0);
|
|
106
|
+
return img.eval(xy);
|
|
107
|
+
}
|
|
108
|
+
`);
|
|
109
|
+
/** @internal Renders the active-mode subtree. Hooks are scoped per mode. */
|
|
110
|
+
export function SkiaOverlay({ image, imageNew, progress, params }) {
|
|
111
|
+
return (_jsx(Canvas, { style: CANVAS_STYLE, children: image && (_jsx(ActiveMode, { image: image, imageNew: imageNew, progress: progress, params: params })) }));
|
|
112
|
+
}
|
|
113
|
+
function ActiveMode({ image, imageNew, progress, params }) {
|
|
114
|
+
switch (params.mode) {
|
|
115
|
+
case 'fade':
|
|
116
|
+
return _jsx(FadeMode, { image: image, progress: progress, params: params });
|
|
117
|
+
case 'circularReveal':
|
|
118
|
+
return _jsx(CircularRevealMode, { image: image, progress: progress, params: params });
|
|
119
|
+
case 'wipe':
|
|
120
|
+
return _jsx(WipeMode, { image: image, progress: progress, params: params });
|
|
121
|
+
case 'slide':
|
|
122
|
+
return _jsx(SlideMode, { image: image, imageNew: imageNew, progress: progress, params: params });
|
|
123
|
+
case 'split':
|
|
124
|
+
return _jsx(SplitMode, { image: image, progress: progress, params: params });
|
|
125
|
+
case 'heart':
|
|
126
|
+
return _jsx(HeartMode, { image: image, progress: progress, params: params });
|
|
127
|
+
case 'star':
|
|
128
|
+
return _jsx(StarMode, { image: image, progress: progress, params: params });
|
|
129
|
+
case 'pixelize':
|
|
130
|
+
return _jsx(PixelizeMode, { image: image, imageNew: imageNew, progress: progress, params: params });
|
|
131
|
+
case 'dissolve':
|
|
132
|
+
return _jsx(DissolveMode, { image: image, progress: progress, params: params });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function FadeMode({ image, progress, params }) {
|
|
136
|
+
const { screenWidth, screenHeight } = params;
|
|
137
|
+
const opacity = useDerivedValue(() => 1 - progress.value);
|
|
138
|
+
return (_jsx(Group, { opacity: opacity, children: _jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }) }));
|
|
139
|
+
}
|
|
140
|
+
function CircularRevealMode({ image, progress, params }) {
|
|
141
|
+
const { origin, maxRadius, screenWidth, screenHeight, inverted } = params;
|
|
142
|
+
const radius = useDerivedValue(() => inverted ? (1 - progress.value) * maxRadius : progress.value * maxRadius);
|
|
143
|
+
if (inverted) {
|
|
144
|
+
return (_jsx(Circle, { cx: origin.x, cy: origin.y, r: radius, children: _jsx(ImageShader, { image: image, fit: "cover", width: screenWidth, height: screenHeight }) }));
|
|
145
|
+
}
|
|
146
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }), _jsx(Circle, { cx: origin.x, cy: origin.y, r: radius, blendMode: "clear", color: "black" })] }));
|
|
147
|
+
}
|
|
148
|
+
function WipeMode({ image, progress, params }) {
|
|
149
|
+
const { screenWidth, screenHeight, direction } = params;
|
|
150
|
+
const horizontal = direction === 'left' || direction === 'right';
|
|
151
|
+
const vertical = direction === 'up' || direction === 'down';
|
|
152
|
+
const x = useDerivedValue(() => (direction === 'left' ? screenWidth * (1 - progress.value) : 0));
|
|
153
|
+
const y = useDerivedValue(() => (direction === 'up' ? screenHeight * (1 - progress.value) : 0));
|
|
154
|
+
const width = useDerivedValue(() => (horizontal ? screenWidth * progress.value : screenWidth));
|
|
155
|
+
const height = useDerivedValue(() => (vertical ? screenHeight * progress.value : screenHeight));
|
|
156
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }), _jsx(Rect, { x: x, y: y, width: width, height: height, blendMode: "clear", color: "black" })] }));
|
|
157
|
+
}
|
|
158
|
+
function SlideMode({ image, imageNew, progress, params }) {
|
|
159
|
+
const { screenWidth, screenHeight, direction } = params;
|
|
160
|
+
const oldOffset = useSlideOffset(progress, direction, screenWidth, screenHeight, 'old');
|
|
161
|
+
const newOffset = useSlideOffset(progress, direction, screenWidth, screenHeight, 'new');
|
|
162
|
+
// Before the second snapshot lands we render only the old image so
|
|
163
|
+
// the inner tree (already swapped) stays hidden.
|
|
164
|
+
if (!imageNew) {
|
|
165
|
+
return (_jsx(SkiaImage, { image: image, x: oldOffset.x, y: oldOffset.y, width: screenWidth, height: screenHeight, fit: "cover" }));
|
|
166
|
+
}
|
|
167
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkiaImage, { image: image, x: oldOffset.x, y: oldOffset.y, width: screenWidth, height: screenHeight, fit: "cover" }), _jsx(SkiaImage, { image: imageNew, x: newOffset.x, y: newOffset.y, width: screenWidth, height: screenHeight, fit: "cover" })] }));
|
|
168
|
+
}
|
|
169
|
+
function useSlideOffset(progress, direction, screenWidth, screenHeight, which) {
|
|
170
|
+
const x = useDerivedValue(() => {
|
|
171
|
+
if (direction !== 'left' && direction !== 'right')
|
|
172
|
+
return 0;
|
|
173
|
+
const sign = direction === 'right' ? 1 : -1;
|
|
174
|
+
return which === 'old'
|
|
175
|
+
? sign * progress.value * screenWidth
|
|
176
|
+
: sign * -(1 - progress.value) * screenWidth;
|
|
177
|
+
});
|
|
178
|
+
const y = useDerivedValue(() => {
|
|
179
|
+
if (direction !== 'up' && direction !== 'down')
|
|
180
|
+
return 0;
|
|
181
|
+
const sign = direction === 'down' ? 1 : -1;
|
|
182
|
+
return which === 'old'
|
|
183
|
+
? sign * progress.value * screenHeight
|
|
184
|
+
: sign * -(1 - progress.value) * screenHeight;
|
|
185
|
+
});
|
|
186
|
+
return { x, y };
|
|
187
|
+
}
|
|
188
|
+
function SplitMode({ image, progress, params }) {
|
|
189
|
+
const { screenWidth, screenHeight, splitMode, inverted } = params;
|
|
190
|
+
if (splitMode === 'top-bottom') {
|
|
191
|
+
return (_jsx(SplitTopBottom, { image: image, progress: progress, screenWidth: screenWidth, screenHeight: screenHeight, inverted: inverted }));
|
|
192
|
+
}
|
|
193
|
+
return (_jsx(SplitLeftRight, { image: image, progress: progress, screenWidth: screenWidth, screenHeight: screenHeight, inverted: inverted }));
|
|
194
|
+
}
|
|
195
|
+
function SplitTopBottom({ image, progress, screenWidth, screenHeight, inverted }) {
|
|
196
|
+
const halfH = screenHeight / 2;
|
|
197
|
+
const stripH = useDerivedValue(() => halfH * progress.value);
|
|
198
|
+
const topY = useDerivedValue(() => (inverted ? 0 : halfH - halfH * progress.value));
|
|
199
|
+
const bottomY = useDerivedValue(() => (inverted ? screenHeight - halfH * progress.value : halfH));
|
|
200
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }), _jsx(Rect, { x: 0, y: topY, width: screenWidth, height: stripH, blendMode: "clear", color: "black" }), _jsx(Rect, { x: 0, y: bottomY, width: screenWidth, height: stripH, blendMode: "clear", color: "black" })] }));
|
|
201
|
+
}
|
|
202
|
+
function SplitLeftRight({ image, progress, screenWidth, screenHeight, inverted }) {
|
|
203
|
+
const halfW = screenWidth / 2;
|
|
204
|
+
const stripW = useDerivedValue(() => halfW * progress.value);
|
|
205
|
+
const leftX = useDerivedValue(() => (inverted ? 0 : halfW - halfW * progress.value));
|
|
206
|
+
const rightX = useDerivedValue(() => (inverted ? screenWidth - halfW * progress.value : halfW));
|
|
207
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }), _jsx(Rect, { x: leftX, y: 0, width: stripW, height: screenHeight, blendMode: "clear", color: "black" }), _jsx(Rect, { x: rightX, y: 0, width: stripW, height: screenHeight, blendMode: "clear", color: "black" })] }));
|
|
208
|
+
}
|
|
209
|
+
function HeartMode({ image, progress, params }) {
|
|
210
|
+
const { origin, screenWidth, screenHeight, inverted } = params;
|
|
211
|
+
const path = useHeartPath(origin.x, origin.y, screenWidth, screenHeight, inverted, progress);
|
|
212
|
+
return (_jsx(ShapeClip, { image: image, path: path, inverted: inverted, screenWidth: screenWidth, screenHeight: screenHeight }));
|
|
213
|
+
}
|
|
214
|
+
function StarMode({ image, progress, params }) {
|
|
215
|
+
const { origin, maxRadius, screenWidth, screenHeight, inverted } = params;
|
|
216
|
+
const path = useStarPath(origin.x, origin.y, maxRadius, inverted, progress);
|
|
217
|
+
return (_jsx(ShapeClip, { image: image, path: path, inverted: inverted, screenWidth: screenWidth, screenHeight: screenHeight }));
|
|
218
|
+
}
|
|
219
|
+
function ShapeClip({ image, path, inverted, screenWidth, screenHeight }) {
|
|
220
|
+
if (inverted) {
|
|
221
|
+
return (_jsx(Group, { clip: path, children: _jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }) }));
|
|
222
|
+
}
|
|
223
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }), _jsx(Group, { clip: path, children: _jsx(Rect, { x: 0, y: 0, width: screenWidth, height: screenHeight, blendMode: "clear", color: "black" }) })] }));
|
|
224
|
+
}
|
|
225
|
+
function useHeartPath(originX, originY, screenWidth, screenHeight, inverted, progress) {
|
|
226
|
+
// Smallest heart scale that covers all four corners AND the top
|
|
227
|
+
// notch from a low origin. Reach factors live next to the path
|
|
228
|
+
// builder so the math stays in sync with the curve.
|
|
229
|
+
const heartSize = useMemo(() => {
|
|
230
|
+
const cornerSize = (dx, dy) => {
|
|
231
|
+
const fy = dy < 0 ? HEART_REACH.topCornerY : HEART_REACH.bottomCornerY;
|
|
232
|
+
return Math.abs(dx) + Math.abs(dy) / fy;
|
|
233
|
+
};
|
|
234
|
+
const notch = originY / HEART_REACH.topNotch;
|
|
235
|
+
return (Math.max(cornerSize(-originX, -originY), cornerSize(screenWidth - originX, -originY), cornerSize(-originX, screenHeight - originY), cornerSize(screenWidth - originX, screenHeight - originY), notch) * 1.05);
|
|
236
|
+
}, [originX, originY, screenWidth, screenHeight]);
|
|
237
|
+
const keyframes = useMemo(() => orderKeyframes(inverted, makeHeartPath(originX, originY, 1, 1), makeHeartPath(originX, originY, heartSize, heartSize)), [originX, originY, heartSize, inverted]);
|
|
238
|
+
return usePathInterpolation(progress, KEYFRAME_INPUT, keyframes);
|
|
239
|
+
}
|
|
240
|
+
function useStarPath(originX, originY, maxRadius, inverted, progress) {
|
|
241
|
+
const { outer, inner } = useMemo(() => {
|
|
242
|
+
const outerR = (maxRadius / STAR_GEOMETRY.innerRatio) * STAR_GEOMETRY.outerPadding;
|
|
243
|
+
return { outer: outerR, inner: outerR * STAR_GEOMETRY.innerRatio };
|
|
244
|
+
}, [maxRadius]);
|
|
245
|
+
const keyframes = useMemo(() => orderKeyframes(inverted, makeStarPath(originX, originY, 1, STAR_GEOMETRY.innerRatio), makeStarPath(originX, originY, outer, inner)), [originX, originY, outer, inner, inverted]);
|
|
246
|
+
return usePathInterpolation(progress, KEYFRAME_INPUT, keyframes);
|
|
247
|
+
}
|
|
248
|
+
function PixelizeMode({ image, imageNew, progress, params }) {
|
|
249
|
+
const { screenWidth, screenHeight, blockSize } = params;
|
|
250
|
+
const screenSize = useMemo(() => [screenWidth, screenHeight], [screenWidth, screenHeight]);
|
|
251
|
+
// Triangle curve on `blockSize`: linear ramp up to the midpoint, cubic
|
|
252
|
+
// ease-out on the way back so the back half spends more time near
|
|
253
|
+
// "clear" than near "chunky" - masks the disappearance pop.
|
|
254
|
+
const uniforms = useDerivedValue(() => {
|
|
255
|
+
const p = progress.value;
|
|
256
|
+
let tri;
|
|
257
|
+
if (p < 0.5) {
|
|
258
|
+
tri = p / 0.5;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
const t = (p - 0.5) / 0.5;
|
|
262
|
+
const inv = 1 - t;
|
|
263
|
+
tri = inv * inv * inv;
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
blockSize: 2 + tri * (blockSize - 2),
|
|
267
|
+
blend: p,
|
|
268
|
+
size: screenSize,
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
// Linear opacity fade over the last 15% so the unmount at p=1 doesn't
|
|
272
|
+
// pop a frame between the shader output and the real underlying view.
|
|
273
|
+
const opacity = useDerivedValue(() => {
|
|
274
|
+
if (progress.value <= 0.85)
|
|
275
|
+
return 1;
|
|
276
|
+
return 1 - (progress.value - 0.85) / 0.15;
|
|
277
|
+
});
|
|
278
|
+
// Until the second snapshot lands we hold the old image at full
|
|
279
|
+
// opacity - the inner tree has already been swapped, so it must stay
|
|
280
|
+
// hidden under the overlay.
|
|
281
|
+
if (!imageNew || !pixelizeShader) {
|
|
282
|
+
return (_jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }));
|
|
283
|
+
}
|
|
284
|
+
return (_jsx(Group, { opacity: opacity, children: _jsx(Fill, { children: _jsxs(Shader, { source: pixelizeShader, uniforms: uniforms, children: [_jsx(ImageShader, { image: image, fit: "cover", width: screenWidth, height: screenHeight, tx: "clamp", ty: "clamp" }), _jsx(ImageShader, { image: imageNew, fit: "cover", width: screenWidth, height: screenHeight, tx: "clamp", ty: "clamp" })] }) }) }));
|
|
285
|
+
}
|
|
286
|
+
function DissolveMode({ image, progress, params }) {
|
|
287
|
+
const { screenWidth, screenHeight, noiseSize } = params;
|
|
288
|
+
const uniforms = useDerivedValue(() => ({
|
|
289
|
+
threshold: progress.value,
|
|
290
|
+
grain: noiseSize,
|
|
291
|
+
}));
|
|
292
|
+
if (!dissolveShader) {
|
|
293
|
+
return (_jsx(SkiaImage, { image: image, x: 0, y: 0, width: screenWidth, height: screenHeight, fit: "cover" }));
|
|
294
|
+
}
|
|
295
|
+
return (_jsx(Fill, { children: _jsx(Shader, { source: dissolveShader, uniforms: uniforms, children: _jsx(ImageShader, { image: image, fit: "cover", width: screenWidth, height: screenHeight, tx: "clamp", ty: "clamp" }) }) }));
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=SkiaOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkiaOverlay.js","sourceRoot":"","sources":["../../src/overlay/SkiaOverlay.tsx"],"names":[],"mappings":";AAiBA,OAAO,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EACL,WAAW,EACX,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,IAAI,SAAS,EAClB,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAI5C,+EAA+E;AAC/E,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,MAAe,EAAE,CAAC,CAAA;AACxE,gEAAgE;AAChE,MAAM,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAE7B,6EAA6E;AAE7E;;;;;;GAMG;AACH,MAAM,WAAW,GAAG;IAClB,uDAAuD;IACvD,SAAS,EAAE,GAAG;IACd,4DAA4D;IAC5D,QAAQ,EAAE,IAAI;IACd,yCAAyC;IACzC,KAAK,EAAE,GAAG;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c,EAAE,QAAQ,EAAE,QAAQ,YAChD,KAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAC,OAAO,EACX,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,EAAE,EAAC,OAAO,EACV,EAAE,EAAC,OAAO,GACV,GACK,GACJ,CACR,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureView.d.ts","sourceRoot":"","sources":["../../src/overlay/captureView.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View-snapshot capture via Skia's `makeImageFromView`.
|
|
3
|
+
* @module
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
import { makeImageFromView } from '@shopify/react-native-skia';
|
|
7
|
+
/**
|
|
8
|
+
* Captures a CPU-backed snapshot of the given view. Returns `null` if the
|
|
9
|
+
* capture fails (e.g. the view has unmounted or Skia is unavailable).
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export async function captureView(ref) {
|
|
13
|
+
try {
|
|
14
|
+
const gpuImage = await makeImageFromView(ref);
|
|
15
|
+
if (!gpuImage)
|
|
16
|
+
return null;
|
|
17
|
+
// Convert to CPU-backed so the snapshot renders in a separate GL
|
|
18
|
+
// context (Skia Canvas). `finally` guarantees the GPU image is
|
|
19
|
+
// released even if the conversion throws.
|
|
20
|
+
try {
|
|
21
|
+
return gpuImage.makeNonTextureImage();
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
gpuImage.dispose();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=captureView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureView.js","sourceRoot":"","sources":["../../src/overlay/captureView.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAI9D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAA2B;IAC3D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAC7C,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAA;QAC1B,iEAAiE;QACjE,+DAA+D;QAC/D,0CAA0C;QAC1C,IAAI,CAAC;YACH,OAAO,QAAQ,CAAC,mBAAmB,EAAE,CAAA;QACvC,CAAC;gBAAS,CAAC;YACT,QAAQ,CAAC,OAAO,EAAE,CAAA;QACpB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOrigin.d.ts","sourceRoot":"","sources":["../../src/overlay/resolveOrigin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Origin resolution for transitions that emanate from a point
|
|
3
|
+
* (`circularReveal`, `heart`, `star`).
|
|
4
|
+
* @module
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Measures the center point of a View ref. Returns `null` if the ref is
|
|
9
|
+
* unmounted or `measure` throws.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* `measure` invokes its callback asynchronously on Paper but synchronously on
|
|
13
|
+
* Fabric, because Fabric reaches the Shadow Tree without a bridge hop. v2's
|
|
14
|
+
* peer deps (`react-native >= 0.78.0`, `@shopify/react-native-skia >= 2.0.0`)
|
|
15
|
+
* both require Fabric, so the callback runs before `measure` returns and
|
|
16
|
+
* `result` is already set at the return site. Paper is not a supported target.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export function measureCenter(ref) {
|
|
21
|
+
if (!ref.current)
|
|
22
|
+
return null;
|
|
23
|
+
try {
|
|
24
|
+
let result = null;
|
|
25
|
+
ref.current.measure((_x, _y, w, h, pageX, pageY) => {
|
|
26
|
+
result = { x: pageX + w / 2, y: pageY + h / 2 };
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Type guard: is this `OriginSpec` a ref rather than a `{x,y}` point? @internal */
|
|
35
|
+
export function isOriginRef(value) {
|
|
36
|
+
return 'current' in value;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolves an {@link OriginSpec} (point or ref) to concrete coordinates.
|
|
40
|
+
* Falls back to the screen center if `origin` is missing or the ref
|
|
41
|
+
* measurement fails.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export function resolveOrigin(origin, screenWidth, screenHeight) {
|
|
45
|
+
if (origin) {
|
|
46
|
+
if (isOriginRef(origin)) {
|
|
47
|
+
const measured = measureCenter(origin);
|
|
48
|
+
if (measured)
|
|
49
|
+
return measured;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return origin;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return { x: screenWidth / 2, y: screenHeight / 2 };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Radius from `origin` to the farthest screen corner.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* A circular reveal with this radius is guaranteed to fully cover the
|
|
62
|
+
* screen at the end frame.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export function calculateMaxRadius(ox, oy, screenWidth, screenHeight) {
|
|
66
|
+
return Math.hypot(Math.max(ox, screenWidth - ox), Math.max(oy, screenHeight - oy));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=resolve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AED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,EAAU,EACV,EAAU,EACV,WAAmB,EACnB,YAAoB;IAEpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,YAAY,GAAG,EAAE,CAAC,CAAC,CAAA;AACpF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal types and defaults for the Skia overlay pipeline.
|
|
3
|
+
*
|
|
4
|
+
* `OverlayParams` is the frozen snapshot of a single transition's
|
|
5
|
+
* parameters, constructed by the engine in `runTransition` and
|
|
6
|
+
* consumed by `SkiaOverlay`. Everything the overlay needs to render a
|
|
7
|
+
* single animation lives here, so rotation / orientation changes
|
|
8
|
+
* mid-transition can't drift between the engine's measurements and the
|
|
9
|
+
* overlay's render.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/overlay/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal types and defaults for the Skia overlay pipeline.
|
|
3
|
+
*
|
|
4
|
+
* `OverlayParams` is the frozen snapshot of a single transition's
|
|
5
|
+
* parameters, constructed by the engine in `runTransition` and
|
|
6
|
+
* consumed by `SkiaOverlay`. Everything the overlay needs to render a
|
|
7
|
+
* single animation lives here, so rotation / orientation changes
|
|
8
|
+
* mid-transition can't drift between the engine's measurements and the
|
|
9
|
+
* overlay's render.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @internal Pixelize shader fallback block size in points. 52 tuned
|
|
16
|
+
* empirically on a 390pt-wide viewport: large enough to fully dissolve
|
|
17
|
+
* face-level detail at the peak of the animation, small enough to avoid
|
|
18
|
+
* obvious banding on smaller devices.
|
|
19
|
+
*/
|
|
20
|
+
export const DEFAULT_PIXELIZE_BLOCK_SIZE = 52;
|
|
21
|
+
/**
|
|
22
|
+
* @internal Dissolve shader fallback noise cell size in points. 5 reads
|
|
23
|
+
* as visible grain without collapsing into chunky tiles on hi-DPI
|
|
24
|
+
* screens. Smaller values approach per-pixel noise.
|
|
25
|
+
*/
|
|
26
|
+
export const DEFAULT_DISSOLVE_NOISE_SIZE = 5;
|
|
27
|
+
/**
|
|
28
|
+
* @internal Wipe/slide fallback direction. `'right'` matches the LTR
|
|
29
|
+
* reading order where new content flows in from the left and progresses
|
|
30
|
+
* rightward. The mental model: `setTheme(x, { direction: 'right' })`
|
|
31
|
+
* means the new theme enters from the left edge. RTL-aware flipping
|
|
32
|
+
* is left to the consumer.
|
|
33
|
+
*/
|
|
34
|
+
export const DEFAULT_DIRECTION = 'right';
|
|
35
|
+
/**
|
|
36
|
+
* @internal Split fallback mode. `'left-right'` splits the screen into
|
|
37
|
+
* left and right halves (split line runs vertically). Consistent with
|
|
38
|
+
* the wipe/slide rightward default: both strip transitions progress
|
|
39
|
+
* along the horizontal axis unless the consumer asks otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export const DEFAULT_SPLIT_MODE = 'left-right';
|
|
42
|
+
/**
|
|
43
|
+
* Initial overlay params used while no transition is active. The Canvas
|
|
44
|
+
* stays mounted with these defaults so that starting a transition doesn't
|
|
45
|
+
* need a native-view layout pass (which would cause a "new theme flash"
|
|
46
|
+
* on Android).
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export const DEFAULT_OVERLAY_PARAMS = {
|
|
50
|
+
mode: 'fade',
|
|
51
|
+
origin: { x: 0, y: 0 },
|
|
52
|
+
maxRadius: 0,
|
|
53
|
+
screenWidth: 0,
|
|
54
|
+
screenHeight: 0,
|
|
55
|
+
inverted: false,
|
|
56
|
+
direction: DEFAULT_DIRECTION,
|
|
57
|
+
splitMode: DEFAULT_SPLIT_MODE,
|
|
58
|
+
blockSize: DEFAULT_PIXELIZE_BLOCK_SIZE,
|
|
59
|
+
noiseSize: DEFAULT_DISSOLVE_NOISE_SIZE,
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/overlay/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAA;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkB,OAAO,CAAA;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAc,YAAY,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IACtB,SAAS,EAAE,CAAC;IACZ,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAE,2BAA2B;IACtC,SAAS,EAAE,2BAA2B;CACvC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure decision helper for `setTheme`. Given the current engine state
|
|
3
|
+
* and the requested change, returns what the engine should do: ignore
|
|
4
|
+
* the call, accept it as a no-op mode flip (only `preference` updates,
|
|
5
|
+
* no animated transition), or proceed with a real theme swap.
|
|
6
|
+
*
|
|
7
|
+
* Extracted from the `setTheme` closure in `transitionEngine.tsx` so
|
|
8
|
+
* the guard rules can be unit-tested without mounting the provider.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=setThemeDecision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setThemeDecision.d.ts","sourceRoot":"","sources":["../src/setThemeDecision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure decision helper for `setTheme`. Given the current engine state
|
|
3
|
+
* and the requested change, returns what the engine should do: ignore
|
|
4
|
+
* the call, accept it as a no-op mode flip (only `preference` updates,
|
|
5
|
+
* no animated transition), or proceed with a real theme swap.
|
|
6
|
+
*
|
|
7
|
+
* Extracted from the `setTheme` closure in `transitionEngine.tsx` so
|
|
8
|
+
* the guard rules can be unit-tested without mounting the provider.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Pure guard logic for `setTheme`. No side effects, no refs, no React.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export function decideSetTheme(input) {
|
|
18
|
+
if (input.transitioning)
|
|
19
|
+
return { status: 'ignored', reason: 'transitioning' };
|
|
20
|
+
if (input.resolvedTarget === input.currentIntended) {
|
|
21
|
+
return input.modeFlipped
|
|
22
|
+
? { status: 'accepted', path: 'mode-flip-noop' }
|
|
23
|
+
: { status: 'ignored', reason: 'same-theme' };
|
|
24
|
+
}
|
|
25
|
+
return { status: 'accepted', path: 'proceed' };
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=setThemeDecision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setThemeDecision.js","sourceRoot":"","sources":["../src/setThemeDecision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAS9B;IACC,IAAI,KAAK,CAAC,aAAa;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,CAAA;IAC9E,IAAI,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,eAAe,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC,WAAW;YACtB,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE;YAChD,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA;IACjD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AAChD,CAAC"}
|