@@ -12,25 +12,7 @@ export function outroAndDestroyBlock(block, lookup) {
12
12
}
13
13
14
14
export function fixAndOutroAndDestroyBlock ( block , lookup ) {
15
- const { node } = block ;
16
- const style = getComputedStyle ( node ) ;
17
-
18
- if ( style . position !== 'absolute' && style . position !== 'fixed' ) {
19
- const { width, height } = style ;
20
- const a = node . getBoundingClientRect ( ) ;
21
- node . style . position = 'absolute' ;
22
- node . style . width = width ;
23
- node . style . height = height ;
24
- const b = node . getBoundingClientRect ( ) ;
25
-
26
- if ( a . left !== b . left || a . top !== b . top ) {
27
- const style = getComputedStyle ( node ) ;
28
- const transform = style . transform === 'none' ? '' : style . transform ;
29
-
30
- node . style . transform = `${ transform } translate(${ a . left - b . left } px, ${ a . top - b . top } px)` ;
31
- }
32
- }
33
-
15
+ block . f ( ) ;
34
16
outroAndDestroyBlock ( block , lookup ) ;
35
17
}
36
18
@@ -121,10 +103,10 @@ export function updateKeyedEach(old_blocks, component, changed, get_key, dynamic
121
103
}
122
104
123
105
export function measure ( blocks ) {
124
- const measurements = { } ;
106
+ const rects = { } ;
125
107
let i = blocks . length ;
126
- while ( i -- ) measurements [ blocks [ i ] . key ] = blocks [ i ] . node . getBoundingClientRect ( ) ;
127
- return measurements ;
108
+ while ( i -- ) rects [ blocks [ i ] . key ] = blocks [ i ] . node . getBoundingClientRect ( ) ;
109
+ return rects ;
128
110
}
129
111
130
112
export function animate ( blocks , rects , fn , params ) {
@@ -138,67 +120,6 @@ export function animate(blocks, rects, fn, params) {
138
120
139
121
if ( from . left === to . left && from . right === to . right && from . top === to . top && from . bottom === to . bottom ) continue ;
140
122
141
- const info = fn ( block . node , { from, to } , params ) ;
142
-
143
- const duration = 'duration' in info ? info . duration : 300 ;
144
- const delay = 'delay' in info ? info . delay : 0 ;
145
- const ease = info . easing || linear ;
146
- const start = window . performance . now ( ) + delay ;
147
- const end = start + duration ;
148
-
149
- const program = {
150
- a : 0 ,
151
- t : 0 ,
152
- b : 1 ,
153
- delta : 1 ,
154
- duration,
155
- start,
156
- end
157
- } ;
158
-
159
- const animation = {
160
- pending : delay ? program : null ,
161
- program : delay ? null : program ,
162
- running : ! delay ,
163
-
164
- start ( ) {
165
- if ( info . css ) {
166
- const rule = generateRule ( program , ease , info . css ) ;
167
- program . name = `__svelte_${ hash ( rule ) } ` ;
168
-
169
- transitionManager . addRule ( rule , program . name ) ;
170
-
171
- block . node . style . animation = ( block . node . style . animation || '' )
172
- . split ( ', ' )
173
- . filter ( anim => anim && ( program . delta < 0 || ! / _ _ s v e l t e / . test ( anim ) ) )
174
- . concat ( `${ program . name } ${ program . duration } ms linear 1 forwards` )
175
- . join ( ', ' ) ;
176
- }
177
- } ,
178
-
179
- update : now => {
180
- const p = now - program . start ;
181
- const t = program . a + program . delta * ease ( p / program . duration ) ;
182
- if ( info . tick ) info . tick ( t , 1 - t ) ;
183
- } ,
184
-
185
- done ( ) {
186
- if ( info . css ) {
187
- transitionManager . deleteRule ( block . node , program . name ) ;
188
- }
189
-
190
- if ( info . tick ) {
191
- info . tick ( 1 , 0 ) ;
192
- }
193
-
194
- animation . running = false ;
195
- }
196
- } ;
197
-
198
- transitionManager . add ( animation ) ;
199
-
200
- if ( info . tick ) info . tick ( 0 , 1 ) ;
201
-
202
- if ( ! delay ) animation . start ( ) ;
123
+
203
124
}
204
125
}
0 commit comments