spotifyplus 0.1.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/animated.d.ts +8 -0
- package/animated.js +25164 -0
- package/components.d.ts +283 -0
- package/components.js +25272 -0
- package/entities.d.ts +103 -0
- package/entities.js +131 -0
- package/index.cjs +39 -0
- package/index.d.ts +1 -0
- package/internal/components.d.ts +1115 -0
- package/internal/legacy-animated.d.ts +217 -0
- package/internal/native-animation-core.d.ts +129 -0
- package/internal/native-animation.d.ts +8 -0
- package/internal/renderer.d.ts +163 -0
- package/internal/script-api.d.ts +72 -0
- package/internal/script-registry.d.ts +5 -0
- package/package.json +113 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type EndCallback = (result: {
|
|
3
|
+
finished: boolean;
|
|
4
|
+
}) => void;
|
|
5
|
+
export type EasingFunction = (value: number) => number;
|
|
6
|
+
export type ExtrapolateType = "extend" | "clamp" | "identity";
|
|
7
|
+
export type AnimatedNodeLike = AnimatedNode;
|
|
8
|
+
export type ListenerCallback = (state: {
|
|
9
|
+
value: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
export type AnimationConfig = {
|
|
12
|
+
useNativeDriver?: boolean;
|
|
13
|
+
isInteraction?: boolean;
|
|
14
|
+
delay?: number;
|
|
15
|
+
};
|
|
16
|
+
export type TimingAnimationConfig = AnimationConfig & {
|
|
17
|
+
toValue: number | Value;
|
|
18
|
+
duration?: number;
|
|
19
|
+
easing?: EasingFunction;
|
|
20
|
+
};
|
|
21
|
+
export type SpringAnimationConfig = AnimationConfig & {
|
|
22
|
+
toValue: number | Value;
|
|
23
|
+
velocity?: number;
|
|
24
|
+
tension?: number;
|
|
25
|
+
friction?: number;
|
|
26
|
+
stiffness?: number;
|
|
27
|
+
damping?: number;
|
|
28
|
+
mass?: number;
|
|
29
|
+
overshootClamping?: boolean;
|
|
30
|
+
restSpeedThreshold?: number;
|
|
31
|
+
restDisplacementThreshold?: number;
|
|
32
|
+
duration?: number;
|
|
33
|
+
};
|
|
34
|
+
export type DecayAnimationConfig = AnimationConfig & {
|
|
35
|
+
velocity: number;
|
|
36
|
+
deceleration?: number;
|
|
37
|
+
};
|
|
38
|
+
export type InterpolationConfig = {
|
|
39
|
+
inputRange: number[];
|
|
40
|
+
outputRange: Array<number | string>;
|
|
41
|
+
easing?: EasingFunction;
|
|
42
|
+
extrapolate?: ExtrapolateType;
|
|
43
|
+
extrapolateLeft?: ExtrapolateType;
|
|
44
|
+
extrapolateRight?: ExtrapolateType;
|
|
45
|
+
};
|
|
46
|
+
export type CompositeAnimation = {
|
|
47
|
+
start(callback?: EndCallback): void;
|
|
48
|
+
stop(): void;
|
|
49
|
+
reset(): void;
|
|
50
|
+
};
|
|
51
|
+
type Binding = {
|
|
52
|
+
id: number;
|
|
53
|
+
nodeId: number;
|
|
54
|
+
prop: string;
|
|
55
|
+
node: AnimatedNode;
|
|
56
|
+
};
|
|
57
|
+
type RunningAnimation = {
|
|
58
|
+
stop(): void;
|
|
59
|
+
reset?(): void;
|
|
60
|
+
};
|
|
61
|
+
export declare abstract class AnimatedNode {
|
|
62
|
+
readonly __isSpotifyPlusAnimatedNode = true;
|
|
63
|
+
protected bindings: Set<Binding>;
|
|
64
|
+
protected children: Set<AnimatedNode>;
|
|
65
|
+
protected listeners: Map<string, ListenerCallback>;
|
|
66
|
+
abstract __getValue(): any;
|
|
67
|
+
__attachChild(child: AnimatedNode): void;
|
|
68
|
+
__detachChild(child: AnimatedNode): void;
|
|
69
|
+
__addBinding(binding: Binding): void;
|
|
70
|
+
__removeBinding(binding: Binding): void;
|
|
71
|
+
__getValueAtRoot(root: Value, rootValue: number): any;
|
|
72
|
+
__collectBindings(out: Binding[]): void;
|
|
73
|
+
__notify(): void;
|
|
74
|
+
addListener(callback: ListenerCallback): string;
|
|
75
|
+
removeListener(id: string): void;
|
|
76
|
+
removeAllListeners(): void;
|
|
77
|
+
interpolate(config: InterpolationConfig): AnimatedInterpolation;
|
|
78
|
+
}
|
|
79
|
+
export declare class Value extends AnimatedNode {
|
|
80
|
+
private value;
|
|
81
|
+
private offset;
|
|
82
|
+
private animation;
|
|
83
|
+
constructor(value: number);
|
|
84
|
+
__getValue(): number;
|
|
85
|
+
__getOffset(): number;
|
|
86
|
+
__setValue(value: number, notify?: boolean): void;
|
|
87
|
+
__getValueAtRoot(root: Value, rootValue: number): any;
|
|
88
|
+
__stopCurrentAnimation(): void;
|
|
89
|
+
__setRunningAnimation(animation: RunningAnimation | null): void;
|
|
90
|
+
setValue(value: number): void;
|
|
91
|
+
setOffset(offset: number): void;
|
|
92
|
+
flattenOffset(): void;
|
|
93
|
+
extractOffset(): void;
|
|
94
|
+
stopAnimation(callback?: (value: number) => void): void;
|
|
95
|
+
resetAnimation(callback?: (value: number) => void): void;
|
|
96
|
+
}
|
|
97
|
+
declare class AnimatedInterpolation extends AnimatedNode {
|
|
98
|
+
private parent;
|
|
99
|
+
private config;
|
|
100
|
+
constructor(parent: AnimatedNode, config: InterpolationConfig);
|
|
101
|
+
__getValue(): string | number;
|
|
102
|
+
__getValueAtRoot(root: Value, rootValue: number): any;
|
|
103
|
+
}
|
|
104
|
+
declare class AnimatedBinaryOp extends AnimatedNode {
|
|
105
|
+
private left;
|
|
106
|
+
private right;
|
|
107
|
+
private op;
|
|
108
|
+
constructor(left: number | AnimatedNode, right: number | AnimatedNode, op: (a: number, b: number) => number);
|
|
109
|
+
__getValue(): number;
|
|
110
|
+
__getValueAtRoot(root: Value, rootValue: number): any;
|
|
111
|
+
}
|
|
112
|
+
export declare class ValueXY {
|
|
113
|
+
x: Value;
|
|
114
|
+
y: Value;
|
|
115
|
+
constructor(value?: {
|
|
116
|
+
x?: number;
|
|
117
|
+
y?: number;
|
|
118
|
+
});
|
|
119
|
+
setValue(value: {
|
|
120
|
+
x: number;
|
|
121
|
+
y: number;
|
|
122
|
+
}): void;
|
|
123
|
+
setOffset(value: {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
}): void;
|
|
127
|
+
flattenOffset(): void;
|
|
128
|
+
extractOffset(): void;
|
|
129
|
+
stopAnimation(callback?: (value: {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
}) => void): void;
|
|
133
|
+
getLayout(): {
|
|
134
|
+
left: Value;
|
|
135
|
+
top: Value;
|
|
136
|
+
};
|
|
137
|
+
getTranslateTransform(): ({
|
|
138
|
+
translateX: Value;
|
|
139
|
+
translateY?: undefined;
|
|
140
|
+
} | {
|
|
141
|
+
translateY: Value;
|
|
142
|
+
translateX?: undefined;
|
|
143
|
+
})[];
|
|
144
|
+
}
|
|
145
|
+
export declare const Easing: {
|
|
146
|
+
linear: (t: number) => number;
|
|
147
|
+
ease: (t: number) => number;
|
|
148
|
+
quad: (t: number) => number;
|
|
149
|
+
cubic: (t: number) => number;
|
|
150
|
+
sin: (t: number) => number;
|
|
151
|
+
circle: (t: number) => number;
|
|
152
|
+
exp: (t: number) => number;
|
|
153
|
+
back: (s?: number) => (t: number) => number;
|
|
154
|
+
bounce: (t: number) => number;
|
|
155
|
+
in: (easing: EasingFunction) => (t: number) => number;
|
|
156
|
+
out: (easing: EasingFunction) => (t: number) => number;
|
|
157
|
+
inOut: (easing: EasingFunction) => (t: number) => number;
|
|
158
|
+
};
|
|
159
|
+
export declare function timing(value: Value, config: TimingAnimationConfig): CompositeAnimation;
|
|
160
|
+
export declare function spring(value: Value, config: SpringAnimationConfig): CompositeAnimation;
|
|
161
|
+
export declare function decay(value: Value, config: DecayAnimationConfig): CompositeAnimation;
|
|
162
|
+
export declare function delay(time: number): CompositeAnimation;
|
|
163
|
+
export declare function sequence(animations: CompositeAnimation[]): CompositeAnimation;
|
|
164
|
+
export declare function parallel(animations: CompositeAnimation[], config?: {
|
|
165
|
+
stopTogether?: boolean;
|
|
166
|
+
}): CompositeAnimation;
|
|
167
|
+
export declare function stagger(time: number, animations: CompositeAnimation[]): CompositeAnimation;
|
|
168
|
+
export declare function loop(animation: CompositeAnimation, config?: {
|
|
169
|
+
iterations?: number;
|
|
170
|
+
}): CompositeAnimation;
|
|
171
|
+
export declare function add(a: number | AnimatedNode, b: number | AnimatedNode): AnimatedBinaryOp;
|
|
172
|
+
export declare function subtract(a: number | AnimatedNode, b: number | AnimatedNode): AnimatedBinaryOp;
|
|
173
|
+
export declare function multiply(a: number | AnimatedNode, b: number | AnimatedNode): AnimatedBinaryOp;
|
|
174
|
+
export declare function divide(a: number | AnimatedNode, b: number | AnimatedNode): AnimatedBinaryOp;
|
|
175
|
+
export declare function modulo(a: number | AnimatedNode, b: number | AnimatedNode): AnimatedBinaryOp;
|
|
176
|
+
export declare function event(mapping: any[], config?: {
|
|
177
|
+
listener?: (...args: any[]) => void;
|
|
178
|
+
}): (...args: any[]) => void;
|
|
179
|
+
export declare function createAnimatedComponent<P extends {
|
|
180
|
+
style?: any;
|
|
181
|
+
}>(Component: React.ComponentType<P>): React.ComponentType<P>;
|
|
182
|
+
export declare function useAnimatedValue(initialValue: number): Value;
|
|
183
|
+
declare const Animated: {
|
|
184
|
+
Value: typeof Value;
|
|
185
|
+
ValueXY: typeof ValueXY;
|
|
186
|
+
timing: typeof timing;
|
|
187
|
+
spring: typeof spring;
|
|
188
|
+
decay: typeof decay;
|
|
189
|
+
delay: typeof delay;
|
|
190
|
+
sequence: typeof sequence;
|
|
191
|
+
parallel: typeof parallel;
|
|
192
|
+
stagger: typeof stagger;
|
|
193
|
+
loop: typeof loop;
|
|
194
|
+
add: typeof add;
|
|
195
|
+
subtract: typeof subtract;
|
|
196
|
+
multiply: typeof multiply;
|
|
197
|
+
divide: typeof divide;
|
|
198
|
+
modulo: typeof modulo;
|
|
199
|
+
event: typeof event;
|
|
200
|
+
createAnimatedComponent: typeof createAnimatedComponent;
|
|
201
|
+
useAnimatedValue: typeof useAnimatedValue;
|
|
202
|
+
Easing: {
|
|
203
|
+
linear: (t: number) => number;
|
|
204
|
+
ease: (t: number) => number;
|
|
205
|
+
quad: (t: number) => number;
|
|
206
|
+
cubic: (t: number) => number;
|
|
207
|
+
sin: (t: number) => number;
|
|
208
|
+
circle: (t: number) => number;
|
|
209
|
+
exp: (t: number) => number;
|
|
210
|
+
back: (s?: number) => (t: number) => number;
|
|
211
|
+
bounce: (t: number) => number;
|
|
212
|
+
in: (easing: EasingFunction) => (t: number) => number;
|
|
213
|
+
out: (easing: EasingFunction) => (t: number) => number;
|
|
214
|
+
inOut: (easing: EasingFunction) => (t: number) => number;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
export default Animated;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type NativeComponentRef } from "spotifyplus/internal/renderer";
|
|
3
|
+
declare const EXPRESSION: unique symbol;
|
|
4
|
+
declare const ANIMATED_STYLE: unique symbol;
|
|
5
|
+
declare const ANIMATED_PROPS: unique symbol;
|
|
6
|
+
export type Extrapolate = "extend" | "clamp" | "identity";
|
|
7
|
+
export type AnimatedPrimitive = number | string | boolean | null;
|
|
8
|
+
export type AnimatedJSON = AnimatedPrimitive | AnimatedJSON[] | {
|
|
9
|
+
[key: string]: AnimatedJSON;
|
|
10
|
+
};
|
|
11
|
+
export type AnimatedExpr = AnimatedJSON | {
|
|
12
|
+
$a: "value";
|
|
13
|
+
id: number;
|
|
14
|
+
initial: AnimatedJSON;
|
|
15
|
+
} | {
|
|
16
|
+
$a: "derived";
|
|
17
|
+
id: number;
|
|
18
|
+
expr: AnimatedExpr;
|
|
19
|
+
} | {
|
|
20
|
+
$a: "const";
|
|
21
|
+
value: AnimatedJSON;
|
|
22
|
+
} | {
|
|
23
|
+
$a: "playbackClock";
|
|
24
|
+
unit?: "ms" | "seconds";
|
|
25
|
+
offset?: number;
|
|
26
|
+
} | {
|
|
27
|
+
$a: "add" | "sub" | "mul" | "div" | "mod";
|
|
28
|
+
values: AnimatedExpr[];
|
|
29
|
+
} | {
|
|
30
|
+
$a: "clamp";
|
|
31
|
+
input: AnimatedExpr;
|
|
32
|
+
min: number;
|
|
33
|
+
max: number;
|
|
34
|
+
} | {
|
|
35
|
+
$a: "interpolate" | "interpolateColor";
|
|
36
|
+
input: AnimatedExpr;
|
|
37
|
+
inputRange: number[];
|
|
38
|
+
outputRange: Array<number | string>;
|
|
39
|
+
extrapolateLeft?: Extrapolate;
|
|
40
|
+
extrapolateRight?: Extrapolate;
|
|
41
|
+
};
|
|
42
|
+
export type TimingConfig = {
|
|
43
|
+
duration?: number;
|
|
44
|
+
delay?: number;
|
|
45
|
+
easing?: "linear" | "ease" | "easeIn" | "easeOut" | "easeInOut";
|
|
46
|
+
};
|
|
47
|
+
export type SpringConfig = {
|
|
48
|
+
stiffness?: number;
|
|
49
|
+
damping?: number;
|
|
50
|
+
mass?: number;
|
|
51
|
+
velocity?: number;
|
|
52
|
+
overshootClamping?: boolean;
|
|
53
|
+
restSpeedThreshold?: number;
|
|
54
|
+
restDisplacementThreshold?: number;
|
|
55
|
+
delay?: number;
|
|
56
|
+
};
|
|
57
|
+
export type InterpolateOptions = {
|
|
58
|
+
extrapolate?: Extrapolate;
|
|
59
|
+
extrapolateLeft?: Extrapolate;
|
|
60
|
+
extrapolateRight?: Extrapolate;
|
|
61
|
+
};
|
|
62
|
+
export type AnimatedStylePayload<T extends Record<string, any> = Record<string, any>> = {
|
|
63
|
+
readonly [ANIMATED_STYLE]: true;
|
|
64
|
+
readonly id: number;
|
|
65
|
+
readonly value: T;
|
|
66
|
+
};
|
|
67
|
+
export type AnimatedPropsPayload<T extends Record<string, any> = Record<string, any>> = {
|
|
68
|
+
readonly [ANIMATED_PROPS]: true;
|
|
69
|
+
readonly id: number;
|
|
70
|
+
readonly value: T;
|
|
71
|
+
};
|
|
72
|
+
export type NativeAnimatedNodeLike<T = any> = AnimatedExpression<T> | SharedValue<T> | DerivedValue<T>;
|
|
73
|
+
export type AnimatedResolvedValue<T> = T extends AnimatedExpression<infer U> ? AnimatedResolvedValue<U> : T;
|
|
74
|
+
export type AnimationDescriptor<T = any> = {
|
|
75
|
+
readonly __spotifyPlusAnimation: true;
|
|
76
|
+
readonly node: Record<string, any>;
|
|
77
|
+
readonly toValue?: T;
|
|
78
|
+
};
|
|
79
|
+
export declare class AnimatedExpression<T = any> {
|
|
80
|
+
readonly node: AnimatedExpr;
|
|
81
|
+
readonly [EXPRESSION] = true;
|
|
82
|
+
constructor(node: AnimatedExpr);
|
|
83
|
+
}
|
|
84
|
+
export declare class SharedValue<T = any> extends AnimatedExpression<T> {
|
|
85
|
+
readonly id: number;
|
|
86
|
+
private current;
|
|
87
|
+
constructor(id: number, initial: T);
|
|
88
|
+
get value(): T;
|
|
89
|
+
set value(next: T | AnimationDescriptor<T> | AnimatedExpression<T>);
|
|
90
|
+
get(): T;
|
|
91
|
+
set(next: T | AnimationDescriptor<T> | AnimatedExpression<T>): void;
|
|
92
|
+
}
|
|
93
|
+
export declare class DerivedValue<T = any> extends AnimatedExpression<T> {
|
|
94
|
+
readonly id: number;
|
|
95
|
+
constructor(id: number, expr: AnimatedExpr);
|
|
96
|
+
get value(): T;
|
|
97
|
+
}
|
|
98
|
+
export declare function isAnimatedNodeLike(value: unknown): value is NativeAnimatedNodeLike;
|
|
99
|
+
export declare function serializeAnimatedNode(value: unknown): any;
|
|
100
|
+
export declare function useSharedValue<T = number>(initial: T): SharedValue<T>;
|
|
101
|
+
export declare function useDerivedValue<T = any>(factory: () => T, deps?: React.DependencyList): DerivedValue<AnimatedResolvedValue<T>>;
|
|
102
|
+
export declare function useAnimatedStyle<T extends Record<string, any>>(factory: () => T, deps?: React.DependencyList): AnimatedStylePayload<T>;
|
|
103
|
+
export declare function useAnimatedProps<T extends Record<string, any>>(factory: () => T, deps?: React.DependencyList): AnimatedPropsPayload<T>;
|
|
104
|
+
export declare function playbackClock(options?: {
|
|
105
|
+
unit?: "ms" | "seconds";
|
|
106
|
+
offset?: number;
|
|
107
|
+
}): AnimatedExpression<number>;
|
|
108
|
+
export declare function interpolate(value: unknown, inputRange: number[], outputRange: number[], options?: InterpolateOptions): AnimatedExpression<number>;
|
|
109
|
+
export declare function interpolateColor(value: unknown, inputRange: number[], outputRange: Array<string | number>, options?: InterpolateOptions): AnimatedExpression<string | number>;
|
|
110
|
+
export declare const add: (...values: unknown[]) => AnimatedExpression<number>;
|
|
111
|
+
export declare const subtract: (...values: unknown[]) => AnimatedExpression<number>;
|
|
112
|
+
export declare const multiply: (...values: unknown[]) => AnimatedExpression<number>;
|
|
113
|
+
export declare const divide: (...values: unknown[]) => AnimatedExpression<number>;
|
|
114
|
+
export declare const modulo: (...values: unknown[]) => AnimatedExpression<number>;
|
|
115
|
+
export declare const clamp: (input: unknown, min: number, max: number) => AnimatedExpression<number>;
|
|
116
|
+
export declare function withTiming<T = number>(toValue: T | AnimatedExpression<T>, config?: TimingConfig): AnimationDescriptor<T>;
|
|
117
|
+
export declare function withSpring<T = number>(toValue: T | AnimatedExpression<T>, config?: SpringConfig): AnimationDescriptor<T>;
|
|
118
|
+
export declare function withDelay<T = any>(delayMs: number, child: AnimationDescriptor<T>): AnimationDescriptor<T>;
|
|
119
|
+
export declare function withSequence<T = any>(...animations: AnimationDescriptor<T>[]): AnimationDescriptor<T>;
|
|
120
|
+
export declare function cancelAnimation(sharedValue: SharedValue<any>): void;
|
|
121
|
+
export declare function runOnUI<T extends (...args: any[]) => any>(fn: T): T;
|
|
122
|
+
export type AnimatedComponentProps<P> = P & {
|
|
123
|
+
animatedProps?: AnimatedPropsPayload | Record<string, any>;
|
|
124
|
+
ref?: React.Ref<NativeComponentRef>;
|
|
125
|
+
};
|
|
126
|
+
export declare function createAnimatedComponent<P extends {
|
|
127
|
+
style?: any;
|
|
128
|
+
}>(Component: React.ComponentType<P>): React.ComponentType<AnimatedComponentProps<P>>;
|
|
129
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Animated } from "spotifyplus/internal/components";
|
|
2
|
+
export * from "spotifyplus/react/Animated/core";
|
|
3
|
+
export declare const View: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<import("spotifyplus/internal/components").RefableProps<import("spotifyplus/internal/components").ViewProps, import("spotifyplus/internal/components").View>>>, Text: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<import("spotifyplus/internal/components").RefableProps<import("spotifyplus/internal/components").TextProps, import("spotifyplus/internal/components").Text>>>, Image: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<import("spotifyplus/internal/components").RefableProps<import("spotifyplus/internal/components").ImageProps, import("spotifyplus/internal/components").Image>>>, ScriptView: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<import("spotifyplus/internal/components").RefableProps<import("spotifyplus/internal/components").ScriptViewProps, import("spotifyplus/internal/components").ScriptView>>>, RenderView: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<import("spotifyplus/internal/components").RefableProps<import("spotifyplus/internal/components").ScriptViewProps, import("spotifyplus/internal/components").RenderView>>>, CanvasView: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<import("spotifyplus/internal/components").RefableProps<import("spotifyplus/internal/components").ScriptViewProps, import("spotifyplus/internal/components").CanvasView>>>, ScrollView: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<{
|
|
4
|
+
style?: any;
|
|
5
|
+
}>>, FlatList: import("react").ComponentType<import("spotifyplus/react/Animated/core").AnimatedComponentProps<{
|
|
6
|
+
style?: any;
|
|
7
|
+
}>>, createAnimatedComponent: typeof import("spotifyplus/react/Animated/core").createAnimatedComponent, useSharedValue: typeof import("spotifyplus/react/Animated/core").useSharedValue, useDerivedValue: typeof import("spotifyplus/react/Animated/core").useDerivedValue, useAnimatedStyle: typeof import("spotifyplus/react/Animated/core").useAnimatedStyle, useAnimatedProps: typeof import("spotifyplus/react/Animated/core").useAnimatedProps, interpolate: typeof import("spotifyplus/react/Animated/core").interpolate, interpolateColor: typeof import("spotifyplus/react/Animated/core").interpolateColor, withTiming: typeof import("spotifyplus/react/Animated/core").withTiming, withSpring: typeof import("spotifyplus/react/Animated/core").withSpring, withDelay: typeof import("spotifyplus/react/Animated/core").withDelay, withSequence: typeof import("spotifyplus/react/Animated/core").withSequence, cancelAnimation: typeof import("spotifyplus/react/Animated/core").cancelAnimation, runOnUI: typeof import("spotifyplus/react/Animated/core").runOnUI, playbackClock: typeof import("spotifyplus/react/Animated/core").playbackClock;
|
|
8
|
+
export default Animated;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type MeasureCallback = (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void;
|
|
3
|
+
export type MeasureInWindowCallback = (x: number, y: number, width: number, height: number) => void;
|
|
4
|
+
export type ScrollToOptions = {
|
|
5
|
+
x?: number;
|
|
6
|
+
y?: number;
|
|
7
|
+
animated?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type ScrollToEndOptions = {
|
|
10
|
+
animated?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ScrollToIndexOptions = {
|
|
13
|
+
index: number;
|
|
14
|
+
animated?: boolean;
|
|
15
|
+
viewOffset?: number;
|
|
16
|
+
viewPosition?: number;
|
|
17
|
+
};
|
|
18
|
+
export type ScrollToOffsetOptions = {
|
|
19
|
+
offset: number;
|
|
20
|
+
animated?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export interface NativeComponentRef {
|
|
23
|
+
readonly nodeId: number;
|
|
24
|
+
readonly type: string;
|
|
25
|
+
readonly mounted: boolean;
|
|
26
|
+
getNativeNodeId(): number;
|
|
27
|
+
setNativeProps(props: Record<string, any>): void;
|
|
28
|
+
focus(): void;
|
|
29
|
+
blur(): void;
|
|
30
|
+
measure(callback: MeasureCallback): void;
|
|
31
|
+
measureInWindow(callback: MeasureInWindowCallback): void;
|
|
32
|
+
scrollTo(options?: ScrollToOptions | number, y?: number, animated?: boolean): void;
|
|
33
|
+
scrollToEnd(options?: ScrollToEndOptions): void;
|
|
34
|
+
flashScrollIndicators(): void;
|
|
35
|
+
dispatchCommand(command: string, args?: Record<string, any>, callback?: (payload: any) => void): void;
|
|
36
|
+
command(command: string, args?: Record<string, any>, callback?: (payload: any) => void): void;
|
|
37
|
+
}
|
|
38
|
+
export declare function dispatchReactEvent(eventId: number, payload?: any): void;
|
|
39
|
+
export type MutationOp = {
|
|
40
|
+
op: 'createNode';
|
|
41
|
+
id: number;
|
|
42
|
+
type: string;
|
|
43
|
+
props: Record<string, any>;
|
|
44
|
+
} | {
|
|
45
|
+
op: 'createText';
|
|
46
|
+
id: number;
|
|
47
|
+
text: string;
|
|
48
|
+
} | {
|
|
49
|
+
op: 'appendChild';
|
|
50
|
+
parentId: number;
|
|
51
|
+
childId: number;
|
|
52
|
+
} | {
|
|
53
|
+
op: 'appendToRoot';
|
|
54
|
+
childId: number;
|
|
55
|
+
} | {
|
|
56
|
+
op: 'insertBefore';
|
|
57
|
+
parentId: number;
|
|
58
|
+
childId: number;
|
|
59
|
+
beforeChildId: number;
|
|
60
|
+
} | {
|
|
61
|
+
op: 'insertInRootBefore';
|
|
62
|
+
childId: number;
|
|
63
|
+
beforeChildId: number;
|
|
64
|
+
} | {
|
|
65
|
+
op: 'removeChild';
|
|
66
|
+
parentId: number;
|
|
67
|
+
childId: number;
|
|
68
|
+
} | {
|
|
69
|
+
op: 'removeFromRoot';
|
|
70
|
+
childId: number;
|
|
71
|
+
} | {
|
|
72
|
+
op: 'updateProps';
|
|
73
|
+
id: number;
|
|
74
|
+
props: Record<string, any>;
|
|
75
|
+
} | {
|
|
76
|
+
op: 'updateText';
|
|
77
|
+
id: number;
|
|
78
|
+
text: string;
|
|
79
|
+
} | {
|
|
80
|
+
op: 'setAnimatedProps';
|
|
81
|
+
nodeId: number;
|
|
82
|
+
props: Record<string, any>;
|
|
83
|
+
} | {
|
|
84
|
+
op: 'removeAnimatedProps';
|
|
85
|
+
nodeId: number;
|
|
86
|
+
} | {
|
|
87
|
+
op: 'updateAnimatedValue';
|
|
88
|
+
valueId: number;
|
|
89
|
+
value: any;
|
|
90
|
+
animation?: Record<string, any>;
|
|
91
|
+
} | {
|
|
92
|
+
op: 'cancelAnimatedValue';
|
|
93
|
+
valueId: number;
|
|
94
|
+
} | {
|
|
95
|
+
op: 'updateSharedValue';
|
|
96
|
+
valueId: number;
|
|
97
|
+
value: any;
|
|
98
|
+
animation?: Record<string, any>;
|
|
99
|
+
} | {
|
|
100
|
+
op: 'startNativeAnimation';
|
|
101
|
+
nodeId: number;
|
|
102
|
+
animationId: number;
|
|
103
|
+
type?: string;
|
|
104
|
+
duration?: number;
|
|
105
|
+
delay?: number;
|
|
106
|
+
easing?: string;
|
|
107
|
+
tracks: Array<{
|
|
108
|
+
property: string;
|
|
109
|
+
from: number;
|
|
110
|
+
to: number;
|
|
111
|
+
}>;
|
|
112
|
+
} | {
|
|
113
|
+
op: 'stopNativeAnimation';
|
|
114
|
+
animationId: number;
|
|
115
|
+
} | {
|
|
116
|
+
op: 'scriptViewCommand';
|
|
117
|
+
nodeId: number;
|
|
118
|
+
command: string;
|
|
119
|
+
args?: Record<string, any>;
|
|
120
|
+
} | {
|
|
121
|
+
op: 'destroyNode';
|
|
122
|
+
id: number;
|
|
123
|
+
} | {
|
|
124
|
+
op: 'viewCommand';
|
|
125
|
+
nodeId: number;
|
|
126
|
+
command: string;
|
|
127
|
+
args?: Record<string, any>;
|
|
128
|
+
eventId?: number;
|
|
129
|
+
};
|
|
130
|
+
type CommitDispatcher = (surfaceId: string, ops: MutationOp[]) => void;
|
|
131
|
+
export declare function setCommitDispatcher(dispatcher: CommitDispatcher | null): void;
|
|
132
|
+
type CommitListener = (ops: MutationOp[], tree: any | null) => void;
|
|
133
|
+
export declare function setCommitListener(surfaceId: string, listener: CommitListener): void;
|
|
134
|
+
export declare function clearCommitListener(surfaceId: string): void;
|
|
135
|
+
export declare function dispatchSurfaceOps(surfaceId: string, ops: MutationOp[]): void;
|
|
136
|
+
export declare function dispatchViewCommand(nodeId: number, command: string, args?: Record<string, any>, callback?: (payload: any) => void): void;
|
|
137
|
+
export declare function updateNodeProps(nodeId: number, props: Record<string, any>): void;
|
|
138
|
+
export declare function setAnimatedProps(nodeId: number, props: Record<string, any>): void;
|
|
139
|
+
export declare function removeAnimatedProps(nodeId: number): void;
|
|
140
|
+
export declare function updateAnimatedValue(valueId: number, value: any, animation?: Record<string, any>): void;
|
|
141
|
+
export declare function cancelAnimatedValue(valueId: number): void;
|
|
142
|
+
export declare function updateSharedValue(valueId: number, value: any, animation?: Record<string, any>): void;
|
|
143
|
+
export declare function startNativeAnimation(nodeId: number, config: {
|
|
144
|
+
animationId: number;
|
|
145
|
+
type?: string;
|
|
146
|
+
duration?: number;
|
|
147
|
+
delay?: number;
|
|
148
|
+
easing?: string;
|
|
149
|
+
tracks: Array<{
|
|
150
|
+
property: string;
|
|
151
|
+
from: number;
|
|
152
|
+
to: number;
|
|
153
|
+
}>;
|
|
154
|
+
}): void;
|
|
155
|
+
export declare function stopNativeAnimation(animationId: number): void;
|
|
156
|
+
export declare function dispatchScriptViewCommand(nodeId: number, command: string, args?: Record<string, any>): void;
|
|
157
|
+
export interface RenderRoot {
|
|
158
|
+
render(element: React.ReactNode): void;
|
|
159
|
+
unmount(): void;
|
|
160
|
+
getTree(): any;
|
|
161
|
+
}
|
|
162
|
+
export declare function createRoot(surfaceId: string): RenderRoot;
|
|
163
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ContextMenu, OnClickCallback, PlatformData, Session, ShouldAddCallback, SideDrawerItem, SideOnClickCallback, SpotifyTrack } from "spotifyplus/entities";
|
|
2
|
+
import type { EventHandler, SurfaceRenderer } from "spotifyplus/internal/script-registry";
|
|
3
|
+
|
|
4
|
+
export interface ScriptConsole {
|
|
5
|
+
log: (...args: unknown[]) => void;
|
|
6
|
+
warn: (...args: unknown[]) => void;
|
|
7
|
+
error: (...args: unknown[]) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ContextMenuConstructor {
|
|
11
|
+
new(name: string, onClick: OnClickCallback, shouldAdd?: ShouldAddCallback, disabled?: boolean): ContextMenu;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SideDrawerConstructor {
|
|
15
|
+
new(name: string, onClick: SideOnClickCallback): SideDrawerItem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ScriptGlobals {
|
|
19
|
+
SpotifyPlus: SpotifyPlusApi;
|
|
20
|
+
console: ScriptConsole;
|
|
21
|
+
setTimeout: typeof setTimeout;
|
|
22
|
+
setInterval: typeof setInterval;
|
|
23
|
+
clearTimeout: typeof clearTimeout;
|
|
24
|
+
clearInterval: typeof clearInterval;
|
|
25
|
+
global: unknown;
|
|
26
|
+
globalThis: unknown;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface SpotifyPlusApi {
|
|
30
|
+
readonly scriptId: string;
|
|
31
|
+
readonly version: number;
|
|
32
|
+
log(...args: unknown[]): void;
|
|
33
|
+
warn(...args: unknown[]): void;
|
|
34
|
+
error(...args: unknown[]): void;
|
|
35
|
+
on(eventName: string, handler: EventHandler): void;
|
|
36
|
+
off(eventName: string, handler: EventHandler): void;
|
|
37
|
+
request<TPayload = unknown>(name: string, payload?: unknown): Promise<TPayload>;
|
|
38
|
+
toast(text: string, length?: 'short' | 'long'): void;
|
|
39
|
+
openUri(uri: string): void;
|
|
40
|
+
emit(eventName: string, payload?: unknown): void;
|
|
41
|
+
Platform: {
|
|
42
|
+
PlatformData: PlatformData;
|
|
43
|
+
Session: Session;
|
|
44
|
+
Storage: {
|
|
45
|
+
set(key: string, value: any): void;
|
|
46
|
+
get<T = any>(key: string): Promise<T | null>;
|
|
47
|
+
remove(key: string): void;
|
|
48
|
+
write(path: string, value: string): void;
|
|
49
|
+
write<T = any>(path: string, value: T): void;
|
|
50
|
+
write(path: string, data: Uint8Array | ArrayBuffer): void;
|
|
51
|
+
read<T = any>(path: string): Promise<T | string | Uint8Array | null>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
Internal: {
|
|
55
|
+
getTrack(uri: string): Promise<SpotifyTrack | null>;
|
|
56
|
+
};
|
|
57
|
+
Player: {
|
|
58
|
+
getCurrentTrack(): SpotifyTrack;
|
|
59
|
+
getProgress(): number;
|
|
60
|
+
seek(position: number): void;
|
|
61
|
+
play(): void;
|
|
62
|
+
pause(): void;
|
|
63
|
+
togglePlay(): void;
|
|
64
|
+
skipNext(): void;
|
|
65
|
+
skipPrevious(): void;
|
|
66
|
+
};
|
|
67
|
+
Surfaces: {
|
|
68
|
+
register(surfaceType: string, renderer: SurfaceRenderer<any>): void;
|
|
69
|
+
};
|
|
70
|
+
ContextMenu: ContextMenuConstructor;
|
|
71
|
+
SideDrawer: SideDrawerConstructor;
|
|
72
|
+
}
|