1 | import { TweenLite, TweenMax, TimelineLite, TimelineMax } from 'gsap';
|
2 |
|
3 | declare var spirit: spirit.SpiritStatic;
|
4 |
|
5 | export = spirit;
|
6 |
|
7 | export as namespace spirit;
|
8 |
|
9 | declare namespace spirit {
|
10 | type gsapTween = TweenLite | TweenMax;
|
11 |
|
12 | type gsapTimeline = TimelineLite | TimelineMax;
|
13 |
|
14 | interface SpiritStatic {
|
15 | config: Config;
|
16 |
|
17 | version: string;
|
18 |
|
19 | setup(config: ({ tween?: gsapTween, timeline?: gsapTimeline })): Promise<void>;
|
20 |
|
21 | create(data: DataGroup | DataGroup[], element?: Element): Groups;
|
22 |
|
23 | load(url: string, element?: Element): Promise<Groups>;
|
24 |
|
25 | groups: Groups;
|
26 | }
|
27 |
|
28 | interface EvalMap {
|
29 | regex: RegExp;
|
30 |
|
31 | map: any;
|
32 | }
|
33 |
|
34 | type sortFn = (a: number | object, b: number | object) => number | boolean
|
35 |
|
36 | interface List<T> extends Iterable<T> {
|
37 | [key: number]: T;
|
38 |
|
39 | [Symbol.iterator](): Iterator<T>;
|
40 |
|
41 | duplicates: boolean | object;
|
42 |
|
43 | checkOnDuplicates(): void;
|
44 |
|
45 | sortOn: boolean | string | sortFn
|
46 |
|
47 | sort(): void;
|
48 |
|
49 | linkedList: boolean;
|
50 |
|
51 | linkItems(): void;
|
52 |
|
53 | list: T[];
|
54 |
|
55 | length: number;
|
56 |
|
57 | at(index: number): T;
|
58 |
|
59 | add(item: T | object | Array<T | object>): T | T[];
|
60 |
|
61 | remove(item: T | T[]): T | T[];
|
62 |
|
63 | clear(): void;
|
64 |
|
65 | each<K>(callback: (item: T) => K): K[];
|
66 |
|
67 | toArray(): T[];
|
68 | }
|
69 |
|
70 | interface Props extends List<Prop> {
|
71 | mappings: EvalMap[];
|
72 |
|
73 | get(name: string): Prop;
|
74 |
|
75 | haveProp(name: string): boolean;
|
76 |
|
77 | toObject(): object;
|
78 |
|
79 | destroy(): void;
|
80 | }
|
81 |
|
82 | interface Prop {
|
83 | keyframes: Keyframes;
|
84 |
|
85 | list: Props;
|
86 |
|
87 | next(): Prop | null;
|
88 |
|
89 | prev(): Prop | null;
|
90 |
|
91 | setupBubbleEvents(): void;
|
92 |
|
93 | toObject(): object;
|
94 |
|
95 | isCSSTransform(): boolean;
|
96 |
|
97 | destroy(): void;
|
98 | }
|
99 |
|
100 | interface Keyframes extends List<Keyframe> {
|
101 | get(time: string | number): Keyframe;
|
102 |
|
103 | mappings(): EvalMap[];
|
104 |
|
105 | toObject(): object;
|
106 |
|
107 | destroy(): void;
|
108 | }
|
109 |
|
110 | interface Keyframe {
|
111 | time: number;
|
112 |
|
113 | ease?: string;
|
114 |
|
115 | value: any;
|
116 |
|
117 | list: Keyframes;
|
118 |
|
119 | prev(): Keyframe | null;
|
120 |
|
121 | next(): Keyframe | null;
|
122 |
|
123 | isEval(): boolean;
|
124 |
|
125 | toObject(): object;
|
126 |
|
127 | destroy(): void;
|
128 | }
|
129 |
|
130 | interface Timelines extends List<Timeline> {
|
131 | get(transformObject: Element | object): Timeline;
|
132 | }
|
133 |
|
134 | interface Timeline {
|
135 | type: 'dom' | 'object';
|
136 |
|
137 | transferObject: Element | object | null;
|
138 |
|
139 | label?: string;
|
140 |
|
141 | path: string;
|
142 |
|
143 | id?: string;
|
144 |
|
145 | props: Props;
|
146 |
|
147 | toObject(): object;
|
148 |
|
149 | destroy(): void;
|
150 | }
|
151 |
|
152 | interface Config {
|
153 | gsap: {
|
154 | tween: gsapTween;
|
155 |
|
156 | timeline: gsapTimeline;
|
157 |
|
158 | autoInject: boolean;
|
159 |
|
160 | autoInjectUrl: string;
|
161 | }
|
162 | }
|
163 |
|
164 | interface Groups extends List<Group> {
|
165 | get(name: string): Group;
|
166 |
|
167 | groupNames(): string[];
|
168 | }
|
169 |
|
170 | interface Group {
|
171 | timeline: gsapTimeline;
|
172 |
|
173 | timelines: Timelines;
|
174 |
|
175 | timeScale: number;
|
176 |
|
177 | duration: number;
|
178 |
|
179 | list: Groups;
|
180 |
|
181 | name: string;
|
182 |
|
183 | toObject(): object;
|
184 |
|
185 | construct(): gsapTimeline;
|
186 | }
|
187 |
|
188 | interface DataTimeline {
|
189 | type: 'dom' | 'object';
|
190 |
|
191 | id?: string;
|
192 |
|
193 | label?: string;
|
194 |
|
195 | path?: string;
|
196 |
|
197 | props?: object;
|
198 | }
|
199 |
|
200 | interface DataGroup {
|
201 | name: string;
|
202 |
|
203 | timeScale?: number;
|
204 |
|
205 | timelines?: DataTimeline[];
|
206 | }
|
207 | }
|
208 |
|
\ | No newline at end of file |