@pyreon/kinetic-presets 0.11.4 → 0.11.6
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 +13 -7
- package/lib/index.d.ts +1 -1
- package/package.json +19 -19
- package/src/__tests__/factories.test.ts +99 -99
- package/src/__tests__/presets.test.ts +274 -274
- package/src/__tests__/utils.test.ts +164 -164
- package/src/factories.ts +28 -28
- package/src/index.ts +4 -4
- package/src/presets.ts +386 -386
- package/src/types.ts +1 -1
- package/src/utils.ts +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, it } from
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
2
|
import {
|
|
3
3
|
backInDown,
|
|
4
4
|
backInLeft,
|
|
@@ -123,8 +123,8 @@ import {
|
|
|
123
123
|
zoomOutLeft,
|
|
124
124
|
zoomOutRight,
|
|
125
125
|
zoomOutUp,
|
|
126
|
-
} from
|
|
127
|
-
import type { Preset } from
|
|
126
|
+
} from '../index'
|
|
127
|
+
import type { Preset } from '../types'
|
|
128
128
|
|
|
129
129
|
// ─── Helpers ────────────────────────────────────────────────────────
|
|
130
130
|
|
|
@@ -145,921 +145,921 @@ const assertSymmetric = (preset: Preset) => {
|
|
|
145
145
|
|
|
146
146
|
// ─── Preset count ───────────────────────────────────────────────────
|
|
147
147
|
|
|
148
|
-
describe(
|
|
149
|
-
it(
|
|
148
|
+
describe('presets — count', () => {
|
|
149
|
+
it('exports 122 presets in the presets object', () => {
|
|
150
150
|
expect(Object.keys(presets)).toHaveLength(122)
|
|
151
151
|
})
|
|
152
152
|
})
|
|
153
153
|
|
|
154
154
|
// ─── All presets have correct shape ─────────────────────────────────
|
|
155
155
|
|
|
156
|
-
describe(
|
|
156
|
+
describe('presets — shape', () => {
|
|
157
157
|
const allPresets = Object.entries(presets)
|
|
158
158
|
|
|
159
|
-
it.each(allPresets)(
|
|
159
|
+
it.each(allPresets)('%s has required style+transition fields', (_, preset) => {
|
|
160
160
|
assertPresetShape(preset)
|
|
161
161
|
})
|
|
162
162
|
|
|
163
|
-
it.each(allPresets)(
|
|
163
|
+
it.each(allPresets)('%s is symmetric (leave reverses enter)', (_, preset) => {
|
|
164
164
|
assertSymmetric(preset)
|
|
165
165
|
})
|
|
166
166
|
|
|
167
|
-
it.each(allPresets)(
|
|
167
|
+
it.each(allPresets)('%s has enter transition string', (_, preset) => {
|
|
168
168
|
expect(preset.enterTransition).toMatch(/\d+m?s/)
|
|
169
169
|
})
|
|
170
170
|
|
|
171
|
-
it.each(allPresets)(
|
|
171
|
+
it.each(allPresets)('%s has leave transition string', (_, preset) => {
|
|
172
172
|
expect(preset.leaveTransition).toMatch(/\d+m?s/)
|
|
173
173
|
})
|
|
174
174
|
})
|
|
175
175
|
|
|
176
176
|
// ─── Fades ──────────────────────────────────────────────────────────
|
|
177
177
|
|
|
178
|
-
describe(
|
|
179
|
-
it(
|
|
178
|
+
describe('presets — fades', () => {
|
|
179
|
+
it('fade is pure opacity', () => {
|
|
180
180
|
expect(fade.enterStyle).toEqual({ opacity: 0 })
|
|
181
181
|
expect(fade.enterToStyle).toEqual({ opacity: 1 })
|
|
182
182
|
})
|
|
183
183
|
|
|
184
|
-
it(
|
|
184
|
+
it('fadeUp translates from 16px below', () => {
|
|
185
185
|
expect(fadeUp.enterStyle).toEqual({
|
|
186
186
|
opacity: 0,
|
|
187
|
-
transform:
|
|
187
|
+
transform: 'translateY(16px)',
|
|
188
188
|
})
|
|
189
189
|
})
|
|
190
190
|
|
|
191
|
-
it(
|
|
191
|
+
it('fadeDown translates from 16px above', () => {
|
|
192
192
|
expect(fadeDown.enterStyle).toEqual({
|
|
193
193
|
opacity: 0,
|
|
194
|
-
transform:
|
|
194
|
+
transform: 'translateY(-16px)',
|
|
195
195
|
})
|
|
196
196
|
})
|
|
197
197
|
|
|
198
|
-
it(
|
|
198
|
+
it('fadeLeft translates from 16px right', () => {
|
|
199
199
|
expect(fadeLeft.enterStyle).toEqual({
|
|
200
200
|
opacity: 0,
|
|
201
|
-
transform:
|
|
201
|
+
transform: 'translateX(16px)',
|
|
202
202
|
})
|
|
203
203
|
})
|
|
204
204
|
|
|
205
|
-
it(
|
|
205
|
+
it('fadeRight translates from 16px left', () => {
|
|
206
206
|
expect(fadeRight.enterStyle).toEqual({
|
|
207
207
|
opacity: 0,
|
|
208
|
-
transform:
|
|
208
|
+
transform: 'translateX(-16px)',
|
|
209
209
|
})
|
|
210
210
|
})
|
|
211
211
|
|
|
212
|
-
it(
|
|
212
|
+
it('big variants use 48px distance', () => {
|
|
213
213
|
expect(fadeUpBig.enterStyle).toEqual({
|
|
214
214
|
opacity: 0,
|
|
215
|
-
transform:
|
|
215
|
+
transform: 'translateY(48px)',
|
|
216
216
|
})
|
|
217
217
|
expect(fadeDownBig.enterStyle).toEqual({
|
|
218
218
|
opacity: 0,
|
|
219
|
-
transform:
|
|
219
|
+
transform: 'translateY(-48px)',
|
|
220
220
|
})
|
|
221
221
|
expect(fadeLeftBig.enterStyle).toEqual({
|
|
222
222
|
opacity: 0,
|
|
223
|
-
transform:
|
|
223
|
+
transform: 'translateX(48px)',
|
|
224
224
|
})
|
|
225
225
|
expect(fadeRightBig.enterStyle).toEqual({
|
|
226
226
|
opacity: 0,
|
|
227
|
-
transform:
|
|
227
|
+
transform: 'translateX(-48px)',
|
|
228
228
|
})
|
|
229
229
|
})
|
|
230
230
|
|
|
231
|
-
it(
|
|
231
|
+
it('fadeScale uses scale(0.95)', () => {
|
|
232
232
|
expect(fadeScale.enterStyle).toEqual({
|
|
233
233
|
opacity: 0,
|
|
234
|
-
transform:
|
|
234
|
+
transform: 'scale(0.95)',
|
|
235
235
|
})
|
|
236
236
|
})
|
|
237
237
|
})
|
|
238
238
|
|
|
239
239
|
// ─── Slides ─────────────────────────────────────────────────────────
|
|
240
240
|
|
|
241
|
-
describe(
|
|
242
|
-
it(
|
|
241
|
+
describe('presets — slides', () => {
|
|
242
|
+
it('slideUp translates from 16px below', () => {
|
|
243
243
|
expect(slideUp.enterStyle).toEqual({
|
|
244
244
|
opacity: 0,
|
|
245
|
-
transform:
|
|
245
|
+
transform: 'translateY(16px)',
|
|
246
246
|
})
|
|
247
247
|
})
|
|
248
248
|
|
|
249
|
-
it(
|
|
249
|
+
it('slideDown translates from 16px above', () => {
|
|
250
250
|
expect(slideDown.enterStyle).toEqual({
|
|
251
251
|
opacity: 0,
|
|
252
|
-
transform:
|
|
252
|
+
transform: 'translateY(-16px)',
|
|
253
253
|
})
|
|
254
254
|
})
|
|
255
255
|
|
|
256
|
-
it(
|
|
256
|
+
it('slideLeft translates from 16px right', () => {
|
|
257
257
|
expect(slideLeft.enterStyle).toEqual({
|
|
258
258
|
opacity: 0,
|
|
259
|
-
transform:
|
|
259
|
+
transform: 'translateX(16px)',
|
|
260
260
|
})
|
|
261
261
|
})
|
|
262
262
|
|
|
263
|
-
it(
|
|
263
|
+
it('slideRight translates from 16px left', () => {
|
|
264
264
|
expect(slideRight.enterStyle).toEqual({
|
|
265
265
|
opacity: 0,
|
|
266
|
-
transform:
|
|
266
|
+
transform: 'translateX(-16px)',
|
|
267
267
|
})
|
|
268
268
|
})
|
|
269
269
|
|
|
270
|
-
it(
|
|
270
|
+
it('big variants use 48px', () => {
|
|
271
271
|
expect(slideUpBig.enterStyle).toEqual({
|
|
272
272
|
opacity: 0,
|
|
273
|
-
transform:
|
|
273
|
+
transform: 'translateY(48px)',
|
|
274
274
|
})
|
|
275
275
|
expect(slideDownBig.enterStyle).toEqual({
|
|
276
276
|
opacity: 0,
|
|
277
|
-
transform:
|
|
277
|
+
transform: 'translateY(-48px)',
|
|
278
278
|
})
|
|
279
279
|
expect(slideLeftBig.enterStyle).toEqual({
|
|
280
280
|
opacity: 0,
|
|
281
|
-
transform:
|
|
281
|
+
transform: 'translateX(48px)',
|
|
282
282
|
})
|
|
283
283
|
expect(slideRightBig.enterStyle).toEqual({
|
|
284
284
|
opacity: 0,
|
|
285
|
-
transform:
|
|
285
|
+
transform: 'translateX(-48px)',
|
|
286
286
|
})
|
|
287
287
|
})
|
|
288
288
|
})
|
|
289
289
|
|
|
290
290
|
// ─── Scales ─────────────────────────────────────────────────────────
|
|
291
291
|
|
|
292
|
-
describe(
|
|
293
|
-
it(
|
|
292
|
+
describe('presets — scales', () => {
|
|
293
|
+
it('scaleIn from 0.9', () => {
|
|
294
294
|
expect(scaleIn.enterStyle).toEqual({
|
|
295
295
|
opacity: 0,
|
|
296
|
-
transform:
|
|
296
|
+
transform: 'scale(0.9)',
|
|
297
297
|
})
|
|
298
298
|
})
|
|
299
299
|
|
|
300
|
-
it(
|
|
300
|
+
it('scaleOut from 1.1', () => {
|
|
301
301
|
expect(scaleOut.enterStyle).toEqual({
|
|
302
302
|
opacity: 0,
|
|
303
|
-
transform:
|
|
303
|
+
transform: 'scale(1.1)',
|
|
304
304
|
})
|
|
305
305
|
})
|
|
306
306
|
|
|
307
|
-
it(
|
|
307
|
+
it('scaleUp from 0.5 (dramatic)', () => {
|
|
308
308
|
expect(scaleUp.enterStyle).toEqual({
|
|
309
309
|
opacity: 0,
|
|
310
|
-
transform:
|
|
310
|
+
transform: 'scale(0.5)',
|
|
311
311
|
})
|
|
312
312
|
})
|
|
313
313
|
|
|
314
|
-
it(
|
|
314
|
+
it('scaleDown from 1.5 (dramatic)', () => {
|
|
315
315
|
expect(scaleDown.enterStyle).toEqual({
|
|
316
316
|
opacity: 0,
|
|
317
|
-
transform:
|
|
317
|
+
transform: 'scale(1.5)',
|
|
318
318
|
})
|
|
319
319
|
})
|
|
320
320
|
|
|
321
|
-
it(
|
|
321
|
+
it('directional scales combine scale + translate', () => {
|
|
322
322
|
expect(scaleInUp.enterStyle).toEqual({
|
|
323
323
|
opacity: 0,
|
|
324
|
-
transform:
|
|
324
|
+
transform: 'scale(0.9) translateY(16px)',
|
|
325
325
|
})
|
|
326
326
|
expect(scaleInDown.enterStyle).toEqual({
|
|
327
327
|
opacity: 0,
|
|
328
|
-
transform:
|
|
328
|
+
transform: 'scale(0.9) translateY(-16px)',
|
|
329
329
|
})
|
|
330
330
|
expect(scaleInLeft.enterStyle).toEqual({
|
|
331
331
|
opacity: 0,
|
|
332
|
-
transform:
|
|
332
|
+
transform: 'scale(0.9) translateX(16px)',
|
|
333
333
|
})
|
|
334
334
|
expect(scaleInRight.enterStyle).toEqual({
|
|
335
335
|
opacity: 0,
|
|
336
|
-
transform:
|
|
336
|
+
transform: 'scale(0.9) translateX(-16px)',
|
|
337
337
|
})
|
|
338
338
|
})
|
|
339
339
|
})
|
|
340
340
|
|
|
341
341
|
// ─── Zooms ──────────────────────────────────────────────────────────
|
|
342
342
|
|
|
343
|
-
describe(
|
|
344
|
-
it(
|
|
343
|
+
describe('presets — zooms', () => {
|
|
344
|
+
it('zoomIn starts at scale(0)', () => {
|
|
345
345
|
expect(zoomIn.enterStyle).toEqual({
|
|
346
346
|
opacity: 0,
|
|
347
|
-
transform:
|
|
347
|
+
transform: 'scale(0)',
|
|
348
348
|
})
|
|
349
349
|
})
|
|
350
350
|
|
|
351
|
-
it(
|
|
351
|
+
it('zoomOut starts at scale(2)', () => {
|
|
352
352
|
expect(zoomOut.enterStyle).toEqual({
|
|
353
353
|
opacity: 0,
|
|
354
|
-
transform:
|
|
354
|
+
transform: 'scale(2)',
|
|
355
355
|
})
|
|
356
356
|
})
|
|
357
357
|
|
|
358
|
-
it(
|
|
358
|
+
it('directional zooms use 48px and scale(0.5)', () => {
|
|
359
359
|
expect(zoomInUp.enterStyle).toEqual({
|
|
360
360
|
opacity: 0,
|
|
361
|
-
transform:
|
|
361
|
+
transform: 'scale(0.5) translateY(48px)',
|
|
362
362
|
})
|
|
363
363
|
expect(zoomInDown.enterStyle).toEqual({
|
|
364
364
|
opacity: 0,
|
|
365
|
-
transform:
|
|
365
|
+
transform: 'scale(0.5) translateY(-48px)',
|
|
366
366
|
})
|
|
367
367
|
expect(zoomInLeft.enterStyle).toEqual({
|
|
368
368
|
opacity: 0,
|
|
369
|
-
transform:
|
|
369
|
+
transform: 'scale(0.5) translateX(48px)',
|
|
370
370
|
})
|
|
371
371
|
expect(zoomInRight.enterStyle).toEqual({
|
|
372
372
|
opacity: 0,
|
|
373
|
-
transform:
|
|
373
|
+
transform: 'scale(0.5) translateX(-48px)',
|
|
374
374
|
})
|
|
375
375
|
})
|
|
376
376
|
|
|
377
|
-
it(
|
|
378
|
-
expect(zoomIn.enterTransition).toContain(
|
|
377
|
+
it('zooms have longer duration (400ms)', () => {
|
|
378
|
+
expect(zoomIn.enterTransition).toContain('400ms')
|
|
379
379
|
})
|
|
380
380
|
})
|
|
381
381
|
|
|
382
382
|
// ─── Flips ──────────────────────────────────────────────────────────
|
|
383
383
|
|
|
384
|
-
describe(
|
|
385
|
-
it(
|
|
384
|
+
describe('presets — flips', () => {
|
|
385
|
+
it('flipX uses perspective + rotateX', () => {
|
|
386
386
|
expect(flipX.enterStyle).toEqual({
|
|
387
387
|
opacity: 0,
|
|
388
|
-
transform:
|
|
388
|
+
transform: 'perspective(600px) rotateX(90deg)',
|
|
389
389
|
})
|
|
390
390
|
expect(flipX.enterToStyle).toEqual({
|
|
391
391
|
opacity: 1,
|
|
392
|
-
transform:
|
|
392
|
+
transform: 'perspective(600px) rotateX(0)',
|
|
393
393
|
})
|
|
394
394
|
})
|
|
395
395
|
|
|
396
|
-
it(
|
|
396
|
+
it('flipY uses perspective + rotateY', () => {
|
|
397
397
|
expect(flipY.enterStyle).toEqual({
|
|
398
398
|
opacity: 0,
|
|
399
|
-
transform:
|
|
399
|
+
transform: 'perspective(600px) rotateY(90deg)',
|
|
400
400
|
})
|
|
401
401
|
})
|
|
402
402
|
|
|
403
|
-
it(
|
|
403
|
+
it('reverse variants use negative angles', () => {
|
|
404
404
|
expect(flipXReverse.enterStyle).toEqual({
|
|
405
405
|
opacity: 0,
|
|
406
|
-
transform:
|
|
406
|
+
transform: 'perspective(600px) rotateX(-90deg)',
|
|
407
407
|
})
|
|
408
408
|
expect(flipYReverse.enterStyle).toEqual({
|
|
409
409
|
opacity: 0,
|
|
410
|
-
transform:
|
|
410
|
+
transform: 'perspective(600px) rotateY(-90deg)',
|
|
411
411
|
})
|
|
412
412
|
})
|
|
413
413
|
})
|
|
414
414
|
|
|
415
415
|
// ─── Rotations ──────────────────────────────────────────────────────
|
|
416
416
|
|
|
417
|
-
describe(
|
|
418
|
-
it(
|
|
417
|
+
describe('presets — rotations', () => {
|
|
418
|
+
it('rotateIn uses -15deg', () => {
|
|
419
419
|
expect(rotateIn.enterStyle).toEqual({
|
|
420
420
|
opacity: 0,
|
|
421
|
-
transform:
|
|
421
|
+
transform: 'rotate(-15deg)',
|
|
422
422
|
})
|
|
423
423
|
})
|
|
424
424
|
|
|
425
|
-
it(
|
|
425
|
+
it('rotateInReverse uses +15deg', () => {
|
|
426
426
|
expect(rotateInReverse.enterStyle).toEqual({
|
|
427
427
|
opacity: 0,
|
|
428
|
-
transform:
|
|
428
|
+
transform: 'rotate(15deg)',
|
|
429
429
|
})
|
|
430
430
|
})
|
|
431
431
|
|
|
432
|
-
it(
|
|
432
|
+
it('directional rotations combine rotate + translate', () => {
|
|
433
433
|
expect(rotateInUp.enterStyle).toEqual({
|
|
434
434
|
opacity: 0,
|
|
435
|
-
transform:
|
|
435
|
+
transform: 'rotate(-5deg) translateY(16px)',
|
|
436
436
|
})
|
|
437
437
|
expect(rotateInDown.enterStyle).toEqual({
|
|
438
438
|
opacity: 0,
|
|
439
|
-
transform:
|
|
439
|
+
transform: 'rotate(5deg) translateY(-16px)',
|
|
440
440
|
})
|
|
441
441
|
})
|
|
442
442
|
|
|
443
|
-
it(
|
|
443
|
+
it('spins use 180deg', () => {
|
|
444
444
|
expect(spinIn.enterStyle).toEqual({
|
|
445
445
|
opacity: 0,
|
|
446
|
-
transform:
|
|
446
|
+
transform: 'rotate(-180deg)',
|
|
447
447
|
})
|
|
448
448
|
expect(spinInReverse.enterStyle).toEqual({
|
|
449
449
|
opacity: 0,
|
|
450
|
-
transform:
|
|
450
|
+
transform: 'rotate(180deg)',
|
|
451
451
|
})
|
|
452
452
|
})
|
|
453
453
|
})
|
|
454
454
|
|
|
455
455
|
// ─── Bounce / Spring ────────────────────────────────────────────────
|
|
456
456
|
|
|
457
|
-
describe(
|
|
458
|
-
it(
|
|
459
|
-
expect(bounceIn.enterTransition).toContain(
|
|
457
|
+
describe('presets — bounce/spring', () => {
|
|
458
|
+
it('bounceIn uses bounce easing', () => {
|
|
459
|
+
expect(bounceIn.enterTransition).toContain('cubic-bezier(0.68, -0.55, 0.265, 1.55)')
|
|
460
460
|
})
|
|
461
461
|
|
|
462
|
-
it(
|
|
462
|
+
it('all bounce variants use bounce easing', () => {
|
|
463
463
|
const bouncePresets = [bounceIn, bounceInUp, bounceInDown, bounceInLeft, bounceInRight]
|
|
464
464
|
for (const p of bouncePresets) {
|
|
465
|
-
expect(p.enterTransition).toContain(
|
|
465
|
+
expect(p.enterTransition).toContain('cubic-bezier(0.68, -0.55, 0.265, 1.55)')
|
|
466
466
|
}
|
|
467
467
|
})
|
|
468
468
|
|
|
469
|
-
it(
|
|
470
|
-
expect(springIn.enterTransition).toContain(
|
|
469
|
+
it('springIn uses spring easing', () => {
|
|
470
|
+
expect(springIn.enterTransition).toContain('cubic-bezier(0.34, 1.56, 0.64, 1)')
|
|
471
471
|
})
|
|
472
472
|
|
|
473
|
-
it(
|
|
473
|
+
it('bounceIn scales from 0.5', () => {
|
|
474
474
|
expect(bounceIn.enterStyle).toEqual({
|
|
475
475
|
opacity: 0,
|
|
476
|
-
transform:
|
|
476
|
+
transform: 'scale(0.5)',
|
|
477
477
|
})
|
|
478
478
|
})
|
|
479
479
|
|
|
480
|
-
it(
|
|
480
|
+
it('springIn scales from 0.8', () => {
|
|
481
481
|
expect(springIn.enterStyle).toEqual({
|
|
482
482
|
opacity: 0,
|
|
483
|
-
transform:
|
|
483
|
+
transform: 'scale(0.8)',
|
|
484
484
|
})
|
|
485
485
|
})
|
|
486
486
|
})
|
|
487
487
|
|
|
488
488
|
// ─── Blur ───────────────────────────────────────────────────────────
|
|
489
489
|
|
|
490
|
-
describe(
|
|
491
|
-
it(
|
|
490
|
+
describe('presets — blur', () => {
|
|
491
|
+
it('blurIn uses filter: blur(8px)', () => {
|
|
492
492
|
expect(blurIn.enterStyle).toEqual({
|
|
493
493
|
opacity: 0,
|
|
494
|
-
filter:
|
|
494
|
+
filter: 'blur(8px)',
|
|
495
495
|
})
|
|
496
496
|
expect(blurIn.enterToStyle).toEqual({
|
|
497
497
|
opacity: 1,
|
|
498
|
-
filter:
|
|
498
|
+
filter: 'blur(0px)',
|
|
499
499
|
})
|
|
500
500
|
})
|
|
501
501
|
|
|
502
|
-
it(
|
|
502
|
+
it('directional blurs combine blur + translate', () => {
|
|
503
503
|
expect(blurInUp.enterStyle).toEqual({
|
|
504
504
|
opacity: 0,
|
|
505
|
-
filter:
|
|
506
|
-
transform:
|
|
505
|
+
filter: 'blur(8px)',
|
|
506
|
+
transform: 'translateY(16px)',
|
|
507
507
|
})
|
|
508
508
|
expect(blurInDown.enterStyle).toEqual({
|
|
509
509
|
opacity: 0,
|
|
510
|
-
filter:
|
|
511
|
-
transform:
|
|
510
|
+
filter: 'blur(8px)',
|
|
511
|
+
transform: 'translateY(-16px)',
|
|
512
512
|
})
|
|
513
513
|
})
|
|
514
514
|
|
|
515
|
-
it(
|
|
515
|
+
it('blurScale combines blur + scale', () => {
|
|
516
516
|
expect(blurScale.enterStyle).toEqual({
|
|
517
517
|
opacity: 0,
|
|
518
|
-
filter:
|
|
519
|
-
transform:
|
|
518
|
+
filter: 'blur(8px)',
|
|
519
|
+
transform: 'scale(0.95)',
|
|
520
520
|
})
|
|
521
521
|
})
|
|
522
522
|
})
|
|
523
523
|
|
|
524
524
|
// ─── Clip Path ──────────────────────────────────────────────────────
|
|
525
525
|
|
|
526
|
-
describe(
|
|
527
|
-
it(
|
|
526
|
+
describe('presets — clip path', () => {
|
|
527
|
+
it('clipTop reveals from top', () => {
|
|
528
528
|
expect(clipTop.enterStyle).toEqual({
|
|
529
|
-
clipPath:
|
|
529
|
+
clipPath: 'inset(0 0 100% 0)',
|
|
530
530
|
})
|
|
531
531
|
expect(clipTop.enterToStyle).toEqual({
|
|
532
|
-
clipPath:
|
|
532
|
+
clipPath: 'inset(0 0 0 0)',
|
|
533
533
|
})
|
|
534
534
|
})
|
|
535
535
|
|
|
536
|
-
it(
|
|
536
|
+
it('clipBottom reveals from bottom', () => {
|
|
537
537
|
expect(clipBottom.enterStyle).toEqual({
|
|
538
|
-
clipPath:
|
|
538
|
+
clipPath: 'inset(100% 0 0 0)',
|
|
539
539
|
})
|
|
540
540
|
})
|
|
541
541
|
|
|
542
|
-
it(
|
|
542
|
+
it('clipLeft reveals from left', () => {
|
|
543
543
|
expect(clipLeft.enterStyle).toEqual({
|
|
544
|
-
clipPath:
|
|
544
|
+
clipPath: 'inset(0 100% 0 0)',
|
|
545
545
|
})
|
|
546
546
|
})
|
|
547
547
|
|
|
548
|
-
it(
|
|
548
|
+
it('clipRight reveals from right', () => {
|
|
549
549
|
expect(clipRight.enterStyle).toEqual({
|
|
550
|
-
clipPath:
|
|
550
|
+
clipPath: 'inset(0 0 0 100%)',
|
|
551
551
|
})
|
|
552
552
|
})
|
|
553
553
|
|
|
554
|
-
it(
|
|
554
|
+
it('clip presets do NOT include opacity (pure reveal)', () => {
|
|
555
555
|
const clips = [clipTop, clipBottom, clipLeft, clipRight]
|
|
556
556
|
for (const c of clips) {
|
|
557
|
-
expect(c.enterStyle).not.toHaveProperty(
|
|
557
|
+
expect(c.enterStyle).not.toHaveProperty('opacity')
|
|
558
558
|
}
|
|
559
559
|
})
|
|
560
560
|
})
|
|
561
561
|
|
|
562
562
|
// ─── Perspective ────────────────────────────────────────────────────
|
|
563
563
|
|
|
564
|
-
describe(
|
|
565
|
-
it(
|
|
564
|
+
describe('presets — perspective', () => {
|
|
565
|
+
it('perspectiveUp tilts from above', () => {
|
|
566
566
|
expect(perspectiveUp.enterStyle).toEqual({
|
|
567
567
|
opacity: 0,
|
|
568
|
-
transform:
|
|
568
|
+
transform: 'perspective(600px) rotateX(15deg)',
|
|
569
569
|
})
|
|
570
570
|
})
|
|
571
571
|
|
|
572
|
-
it(
|
|
572
|
+
it('perspectiveDown tilts from below', () => {
|
|
573
573
|
expect(perspectiveDown.enterStyle).toEqual({
|
|
574
574
|
opacity: 0,
|
|
575
|
-
transform:
|
|
575
|
+
transform: 'perspective(600px) rotateX(-15deg)',
|
|
576
576
|
})
|
|
577
577
|
})
|
|
578
578
|
|
|
579
|
-
it(
|
|
579
|
+
it('perspectiveLeft tilts from left', () => {
|
|
580
580
|
expect(perspectiveLeft.enterStyle).toEqual({
|
|
581
581
|
opacity: 0,
|
|
582
|
-
transform:
|
|
582
|
+
transform: 'perspective(600px) rotateY(-15deg)',
|
|
583
583
|
})
|
|
584
584
|
})
|
|
585
585
|
|
|
586
|
-
it(
|
|
586
|
+
it('perspectiveRight tilts from right', () => {
|
|
587
587
|
expect(perspectiveRight.enterStyle).toEqual({
|
|
588
588
|
opacity: 0,
|
|
589
|
-
transform:
|
|
589
|
+
transform: 'perspective(600px) rotateY(15deg)',
|
|
590
590
|
})
|
|
591
591
|
})
|
|
592
592
|
})
|
|
593
593
|
|
|
594
594
|
// ─── Expand / Skew / Drop / Rise ────────────────────────────────────
|
|
595
595
|
|
|
596
|
-
describe(
|
|
597
|
-
it(
|
|
596
|
+
describe('presets — expand', () => {
|
|
597
|
+
it('expandX uses scaleX(0)', () => {
|
|
598
598
|
expect(expandX.enterStyle).toEqual({
|
|
599
599
|
opacity: 0,
|
|
600
|
-
transform:
|
|
600
|
+
transform: 'scaleX(0)',
|
|
601
601
|
})
|
|
602
602
|
})
|
|
603
603
|
|
|
604
|
-
it(
|
|
604
|
+
it('expandY uses scaleY(0)', () => {
|
|
605
605
|
expect(expandY.enterStyle).toEqual({
|
|
606
606
|
opacity: 0,
|
|
607
|
-
transform:
|
|
607
|
+
transform: 'scaleY(0)',
|
|
608
608
|
})
|
|
609
609
|
})
|
|
610
610
|
})
|
|
611
611
|
|
|
612
|
-
describe(
|
|
613
|
-
it(
|
|
612
|
+
describe('presets — skew', () => {
|
|
613
|
+
it('skewIn uses skewX(-5deg)', () => {
|
|
614
614
|
expect(skewIn.enterStyle).toEqual({
|
|
615
615
|
opacity: 0,
|
|
616
|
-
transform:
|
|
616
|
+
transform: 'skewX(-5deg)',
|
|
617
617
|
})
|
|
618
618
|
})
|
|
619
619
|
|
|
620
|
-
it(
|
|
620
|
+
it('skewInReverse uses skewX(5deg)', () => {
|
|
621
621
|
expect(skewInReverse.enterStyle).toEqual({
|
|
622
622
|
opacity: 0,
|
|
623
|
-
transform:
|
|
623
|
+
transform: 'skewX(5deg)',
|
|
624
624
|
})
|
|
625
625
|
})
|
|
626
626
|
})
|
|
627
627
|
|
|
628
|
-
describe(
|
|
629
|
-
it(
|
|
628
|
+
describe('presets — drop/rise', () => {
|
|
629
|
+
it('drop uses translateY(-100%)', () => {
|
|
630
630
|
expect(drop.enterStyle).toEqual({
|
|
631
631
|
opacity: 0,
|
|
632
|
-
transform:
|
|
632
|
+
transform: 'translateY(-100%)',
|
|
633
633
|
})
|
|
634
634
|
})
|
|
635
635
|
|
|
636
|
-
it(
|
|
636
|
+
it('rise uses translateY(100%)', () => {
|
|
637
637
|
expect(rise.enterStyle).toEqual({
|
|
638
638
|
opacity: 0,
|
|
639
|
-
transform:
|
|
639
|
+
transform: 'translateY(100%)',
|
|
640
640
|
})
|
|
641
641
|
})
|
|
642
642
|
})
|
|
643
643
|
|
|
644
644
|
// ─── Diagonal fades ─────────────────────────────────────────────────
|
|
645
645
|
|
|
646
|
-
describe(
|
|
647
|
-
it(
|
|
646
|
+
describe('presets — diagonal fades', () => {
|
|
647
|
+
it('fadeUpLeft translates from 16px diagonal', () => {
|
|
648
648
|
expect(fadeUpLeft.enterStyle).toEqual({
|
|
649
649
|
opacity: 0,
|
|
650
|
-
transform:
|
|
650
|
+
transform: 'translate(16px, 16px)',
|
|
651
651
|
})
|
|
652
652
|
})
|
|
653
653
|
|
|
654
|
-
it(
|
|
654
|
+
it('fadeUpRight translates from -16px x, 16px y', () => {
|
|
655
655
|
expect(fadeUpRight.enterStyle).toEqual({
|
|
656
656
|
opacity: 0,
|
|
657
|
-
transform:
|
|
657
|
+
transform: 'translate(-16px, 16px)',
|
|
658
658
|
})
|
|
659
659
|
})
|
|
660
660
|
|
|
661
|
-
it(
|
|
661
|
+
it('fadeDownLeft translates from 16px x, -16px y', () => {
|
|
662
662
|
expect(fadeDownLeft.enterStyle).toEqual({
|
|
663
663
|
opacity: 0,
|
|
664
|
-
transform:
|
|
664
|
+
transform: 'translate(16px, -16px)',
|
|
665
665
|
})
|
|
666
666
|
})
|
|
667
667
|
|
|
668
|
-
it(
|
|
668
|
+
it('fadeDownRight translates from -16px diagonal', () => {
|
|
669
669
|
expect(fadeDownRight.enterStyle).toEqual({
|
|
670
670
|
opacity: 0,
|
|
671
|
-
transform:
|
|
671
|
+
transform: 'translate(-16px, -16px)',
|
|
672
672
|
})
|
|
673
673
|
})
|
|
674
674
|
})
|
|
675
675
|
|
|
676
676
|
// ─── Zoom out directional ───────────────────────────────────────────
|
|
677
677
|
|
|
678
|
-
describe(
|
|
679
|
-
it(
|
|
678
|
+
describe('presets — zoom out directional', () => {
|
|
679
|
+
it('zoomOutUp uses scale(2) + translateY', () => {
|
|
680
680
|
expect(zoomOutUp.enterStyle).toEqual({
|
|
681
681
|
opacity: 0,
|
|
682
|
-
transform:
|
|
682
|
+
transform: 'scale(2) translateY(48px)',
|
|
683
683
|
})
|
|
684
684
|
})
|
|
685
685
|
|
|
686
|
-
it(
|
|
686
|
+
it('all zoom out variants have 400ms enter', () => {
|
|
687
687
|
for (const p of [zoomOutUp, zoomOutDown, zoomOutLeft, zoomOutRight]) {
|
|
688
|
-
expect(p.enterTransition).toContain(
|
|
688
|
+
expect(p.enterTransition).toContain('400ms')
|
|
689
689
|
}
|
|
690
690
|
})
|
|
691
691
|
})
|
|
692
692
|
|
|
693
693
|
// ─── Blur horizontal ────────────────────────────────────────────────
|
|
694
694
|
|
|
695
|
-
describe(
|
|
696
|
-
it(
|
|
695
|
+
describe('presets — blur horizontal', () => {
|
|
696
|
+
it('blurInLeft combines blur + translateX', () => {
|
|
697
697
|
expect(blurInLeft.enterStyle).toEqual({
|
|
698
698
|
opacity: 0,
|
|
699
|
-
filter:
|
|
700
|
-
transform:
|
|
699
|
+
filter: 'blur(8px)',
|
|
700
|
+
transform: 'translateX(16px)',
|
|
701
701
|
})
|
|
702
702
|
})
|
|
703
703
|
|
|
704
|
-
it(
|
|
704
|
+
it('blurInRight combines blur + translateX', () => {
|
|
705
705
|
expect(blurInRight.enterStyle).toEqual({
|
|
706
706
|
opacity: 0,
|
|
707
|
-
filter:
|
|
708
|
-
transform:
|
|
707
|
+
filter: 'blur(8px)',
|
|
708
|
+
transform: 'translateX(-16px)',
|
|
709
709
|
})
|
|
710
710
|
})
|
|
711
711
|
})
|
|
712
712
|
|
|
713
713
|
// ─── Skew Y ─────────────────────────────────────────────────────────
|
|
714
714
|
|
|
715
|
-
describe(
|
|
716
|
-
it(
|
|
715
|
+
describe('presets — skew Y', () => {
|
|
716
|
+
it('skewInY uses skewY(-5deg)', () => {
|
|
717
717
|
expect(skewInY.enterStyle).toEqual({
|
|
718
718
|
opacity: 0,
|
|
719
|
-
transform:
|
|
719
|
+
transform: 'skewY(-5deg)',
|
|
720
720
|
})
|
|
721
721
|
})
|
|
722
722
|
|
|
723
|
-
it(
|
|
723
|
+
it('skewInYReverse uses skewY(5deg)', () => {
|
|
724
724
|
expect(skewInYReverse.enterStyle).toEqual({
|
|
725
725
|
opacity: 0,
|
|
726
|
-
transform:
|
|
726
|
+
transform: 'skewY(5deg)',
|
|
727
727
|
})
|
|
728
728
|
})
|
|
729
729
|
})
|
|
730
730
|
|
|
731
731
|
// ─── Back ───────────────────────────────────────────────────────────
|
|
732
732
|
|
|
733
|
-
describe(
|
|
734
|
-
it(
|
|
733
|
+
describe('presets — back', () => {
|
|
734
|
+
it('backInUp uses scale(0.7) + large translate', () => {
|
|
735
735
|
expect(backInUp.enterStyle).toEqual({
|
|
736
736
|
opacity: 0,
|
|
737
|
-
transform:
|
|
737
|
+
transform: 'scale(0.7) translateY(80px)',
|
|
738
738
|
})
|
|
739
739
|
})
|
|
740
740
|
|
|
741
|
-
it(
|
|
741
|
+
it('all back variants use 400ms enter', () => {
|
|
742
742
|
for (const p of [backInUp, backInDown, backInLeft, backInRight]) {
|
|
743
|
-
expect(p.enterTransition).toContain(
|
|
743
|
+
expect(p.enterTransition).toContain('400ms')
|
|
744
744
|
}
|
|
745
745
|
})
|
|
746
746
|
})
|
|
747
747
|
|
|
748
748
|
// ─── Light speed ────────────────────────────────────────────────────
|
|
749
749
|
|
|
750
|
-
describe(
|
|
751
|
-
it(
|
|
750
|
+
describe('presets — light speed', () => {
|
|
751
|
+
it('lightSpeedInLeft uses translateX + skewX', () => {
|
|
752
752
|
expect(lightSpeedInLeft.enterStyle).toEqual({
|
|
753
753
|
opacity: 0,
|
|
754
|
-
transform:
|
|
754
|
+
transform: 'translateX(100%) skewX(-30deg)',
|
|
755
755
|
})
|
|
756
756
|
})
|
|
757
757
|
|
|
758
|
-
it(
|
|
758
|
+
it('lightSpeedInRight uses opposite direction', () => {
|
|
759
759
|
expect(lightSpeedInRight.enterStyle).toEqual({
|
|
760
760
|
opacity: 0,
|
|
761
|
-
transform:
|
|
761
|
+
transform: 'translateX(-100%) skewX(30deg)',
|
|
762
762
|
})
|
|
763
763
|
})
|
|
764
764
|
})
|
|
765
765
|
|
|
766
766
|
// ─── Roll ───────────────────────────────────────────────────────────
|
|
767
767
|
|
|
768
|
-
describe(
|
|
769
|
-
it(
|
|
768
|
+
describe('presets — roll', () => {
|
|
769
|
+
it('rollInLeft uses translateX + rotate', () => {
|
|
770
770
|
expect(rollInLeft.enterStyle).toEqual({
|
|
771
771
|
opacity: 0,
|
|
772
|
-
transform:
|
|
772
|
+
transform: 'translateX(-100%) rotate(-120deg)',
|
|
773
773
|
})
|
|
774
774
|
})
|
|
775
775
|
|
|
776
|
-
it(
|
|
776
|
+
it('rollInRight uses opposite direction', () => {
|
|
777
777
|
expect(rollInRight.enterStyle).toEqual({
|
|
778
778
|
opacity: 0,
|
|
779
|
-
transform:
|
|
779
|
+
transform: 'translateX(100%) rotate(120deg)',
|
|
780
780
|
})
|
|
781
781
|
})
|
|
782
782
|
})
|
|
783
783
|
|
|
784
784
|
// ─── Clip path shapes ───────────────────────────────────────────────
|
|
785
785
|
|
|
786
|
-
describe(
|
|
787
|
-
it(
|
|
786
|
+
describe('presets — clip path shapes', () => {
|
|
787
|
+
it('clipCircle uses circle()', () => {
|
|
788
788
|
expect(clipCircle.enterStyle).toEqual({
|
|
789
|
-
clipPath:
|
|
789
|
+
clipPath: 'circle(0% at 50% 50%)',
|
|
790
790
|
})
|
|
791
791
|
})
|
|
792
792
|
|
|
793
|
-
it(
|
|
793
|
+
it('clipCenter uses inset from center', () => {
|
|
794
794
|
expect(clipCenter.enterStyle).toEqual({
|
|
795
|
-
clipPath:
|
|
795
|
+
clipPath: 'inset(50% 50% 50% 50%)',
|
|
796
796
|
})
|
|
797
797
|
})
|
|
798
798
|
|
|
799
|
-
it(
|
|
799
|
+
it('clipDiamond uses polygon', () => {
|
|
800
800
|
expect(clipDiamond.enterStyle).toEqual({
|
|
801
|
-
clipPath:
|
|
801
|
+
clipPath: 'polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%)',
|
|
802
802
|
})
|
|
803
803
|
})
|
|
804
804
|
|
|
805
|
-
it(
|
|
805
|
+
it('clipCorner expands from corner', () => {
|
|
806
806
|
expect(clipCorner.enterStyle).toEqual({
|
|
807
|
-
clipPath:
|
|
807
|
+
clipPath: 'polygon(0 0, 0 0, 0 0, 0 0)',
|
|
808
808
|
})
|
|
809
809
|
})
|
|
810
810
|
|
|
811
|
-
it(
|
|
811
|
+
it('shape clips do NOT include opacity', () => {
|
|
812
812
|
for (const c of [clipCircle, clipCenter, clipDiamond, clipCorner]) {
|
|
813
|
-
expect(c.enterStyle).not.toHaveProperty(
|
|
813
|
+
expect(c.enterStyle).not.toHaveProperty('opacity')
|
|
814
814
|
}
|
|
815
815
|
})
|
|
816
816
|
})
|
|
817
817
|
|
|
818
818
|
// ─── Puff ───────────────────────────────────────────────────────────
|
|
819
819
|
|
|
820
|
-
describe(
|
|
821
|
-
it(
|
|
820
|
+
describe('presets — puff', () => {
|
|
821
|
+
it('puffIn uses blur + scale(1.5)', () => {
|
|
822
822
|
expect(puffIn.enterStyle).toEqual({
|
|
823
823
|
opacity: 0,
|
|
824
|
-
filter:
|
|
825
|
-
transform:
|
|
824
|
+
filter: 'blur(4px)',
|
|
825
|
+
transform: 'scale(1.5)',
|
|
826
826
|
})
|
|
827
827
|
})
|
|
828
828
|
|
|
829
|
-
it(
|
|
829
|
+
it('puffOut uses blur + scale(0.5)', () => {
|
|
830
830
|
expect(puffOut.enterStyle).toEqual({
|
|
831
831
|
opacity: 0,
|
|
832
|
-
filter:
|
|
833
|
-
transform:
|
|
832
|
+
filter: 'blur(4px)',
|
|
833
|
+
transform: 'scale(0.5)',
|
|
834
834
|
})
|
|
835
835
|
})
|
|
836
836
|
})
|
|
837
837
|
|
|
838
838
|
// ─── Swing ──────────────────────────────────────────────────────────
|
|
839
839
|
|
|
840
|
-
describe(
|
|
841
|
-
it(
|
|
840
|
+
describe('presets — swing', () => {
|
|
841
|
+
it('swingInTop uses rotateX with transformOrigin top', () => {
|
|
842
842
|
expect(swingInTop.enterStyle).toEqual({
|
|
843
843
|
opacity: 0,
|
|
844
|
-
transform:
|
|
845
|
-
transformOrigin:
|
|
844
|
+
transform: 'perspective(600px) rotateX(-90deg)',
|
|
845
|
+
transformOrigin: 'top',
|
|
846
846
|
})
|
|
847
847
|
})
|
|
848
848
|
|
|
849
|
-
it(
|
|
849
|
+
it('swingInLeft uses rotateY with transformOrigin left', () => {
|
|
850
850
|
expect(swingInLeft.enterStyle).toEqual({
|
|
851
851
|
opacity: 0,
|
|
852
|
-
transform:
|
|
853
|
-
transformOrigin:
|
|
852
|
+
transform: 'perspective(600px) rotateY(90deg)',
|
|
853
|
+
transformOrigin: 'left',
|
|
854
854
|
})
|
|
855
855
|
})
|
|
856
856
|
|
|
857
|
-
it(
|
|
857
|
+
it('all swing variants have 500ms enter', () => {
|
|
858
858
|
for (const p of [swingInTop, swingInBottom, swingInLeft, swingInRight]) {
|
|
859
|
-
expect(p.enterTransition).toContain(
|
|
859
|
+
expect(p.enterTransition).toContain('500ms')
|
|
860
860
|
}
|
|
861
861
|
})
|
|
862
862
|
})
|
|
863
863
|
|
|
864
864
|
// ─── Slit ───────────────────────────────────────────────────────────
|
|
865
865
|
|
|
866
|
-
describe(
|
|
867
|
-
it(
|
|
866
|
+
describe('presets — slit', () => {
|
|
867
|
+
it('slitHorizontal uses rotateY + scaleX', () => {
|
|
868
868
|
expect(slitHorizontal.enterStyle).toEqual({
|
|
869
869
|
opacity: 0,
|
|
870
|
-
transform:
|
|
870
|
+
transform: 'perspective(600px) rotateY(90deg) scaleX(0)',
|
|
871
871
|
})
|
|
872
872
|
})
|
|
873
873
|
|
|
874
|
-
it(
|
|
874
|
+
it('slitVertical uses rotateX + scaleY', () => {
|
|
875
875
|
expect(slitVertical.enterStyle).toEqual({
|
|
876
876
|
opacity: 0,
|
|
877
|
-
transform:
|
|
877
|
+
transform: 'perspective(600px) rotateX(90deg) scaleY(0)',
|
|
878
878
|
})
|
|
879
879
|
})
|
|
880
880
|
})
|
|
881
881
|
|
|
882
882
|
// ─── Swirl ──────────────────────────────────────────────────────────
|
|
883
883
|
|
|
884
|
-
describe(
|
|
885
|
-
it(
|
|
884
|
+
describe('presets — swirl', () => {
|
|
885
|
+
it('swirlIn uses -540deg rotation + scale(0)', () => {
|
|
886
886
|
expect(swirlIn.enterStyle).toEqual({
|
|
887
887
|
opacity: 0,
|
|
888
|
-
transform:
|
|
888
|
+
transform: 'rotate(-540deg) scale(0)',
|
|
889
889
|
})
|
|
890
890
|
})
|
|
891
891
|
|
|
892
|
-
it(
|
|
892
|
+
it('swirlInReverse uses +540deg', () => {
|
|
893
893
|
expect(swirlInReverse.enterStyle).toEqual({
|
|
894
894
|
opacity: 0,
|
|
895
|
-
transform:
|
|
895
|
+
transform: 'rotate(540deg) scale(0)',
|
|
896
896
|
})
|
|
897
897
|
})
|
|
898
898
|
})
|
|
899
899
|
|
|
900
900
|
// ─── Flip diagonal ─────────────────────────────────────────────────
|
|
901
901
|
|
|
902
|
-
describe(
|
|
903
|
-
it(
|
|
902
|
+
describe('presets — flip diagonal', () => {
|
|
903
|
+
it('flipDiagonal uses rotate3d(1,1,0)', () => {
|
|
904
904
|
expect(flipDiagonal.enterStyle).toEqual({
|
|
905
905
|
opacity: 0,
|
|
906
|
-
transform:
|
|
906
|
+
transform: 'perspective(600px) rotate3d(1, 1, 0, 90deg)',
|
|
907
907
|
})
|
|
908
908
|
})
|
|
909
909
|
|
|
910
|
-
it(
|
|
910
|
+
it('flipDiagonalReverse uses rotate3d(1,-1,0)', () => {
|
|
911
911
|
expect(flipDiagonalReverse.enterStyle).toEqual({
|
|
912
912
|
opacity: 0,
|
|
913
|
-
transform:
|
|
913
|
+
transform: 'perspective(600px) rotate3d(1, -1, 0, 90deg)',
|
|
914
914
|
})
|
|
915
915
|
})
|
|
916
916
|
})
|
|
917
917
|
|
|
918
918
|
// ─── Tilt ───────────────────────────────────────────────────────────
|
|
919
919
|
|
|
920
|
-
describe(
|
|
921
|
-
it(
|
|
920
|
+
describe('presets — tilt', () => {
|
|
921
|
+
it('tiltInUp combines perspective rotateX + translateY', () => {
|
|
922
922
|
expect(tiltInUp.enterStyle).toEqual({
|
|
923
923
|
opacity: 0,
|
|
924
|
-
transform:
|
|
924
|
+
transform: 'perspective(600px) rotateX(15deg) translateY(24px)',
|
|
925
925
|
})
|
|
926
926
|
})
|
|
927
927
|
|
|
928
|
-
it(
|
|
928
|
+
it('tiltInDown combines perspective rotateX + negative translateY', () => {
|
|
929
929
|
expect(tiltInDown.enterStyle).toEqual({
|
|
930
930
|
opacity: 0,
|
|
931
|
-
transform:
|
|
931
|
+
transform: 'perspective(600px) rotateX(-15deg) translateY(-24px)',
|
|
932
932
|
})
|
|
933
933
|
})
|
|
934
934
|
|
|
935
|
-
it(
|
|
935
|
+
it('tiltInLeft combines perspective rotateY + translateX', () => {
|
|
936
936
|
expect(tiltInLeft.enterStyle).toEqual({
|
|
937
937
|
opacity: 0,
|
|
938
|
-
transform:
|
|
938
|
+
transform: 'perspective(600px) rotateY(-15deg) translateX(24px)',
|
|
939
939
|
})
|
|
940
940
|
})
|
|
941
941
|
|
|
942
|
-
it(
|
|
942
|
+
it('tiltInRight combines perspective rotateY + negative translateX', () => {
|
|
943
943
|
expect(tiltInRight.enterStyle).toEqual({
|
|
944
944
|
opacity: 0,
|
|
945
|
-
transform:
|
|
945
|
+
transform: 'perspective(600px) rotateY(15deg) translateX(-24px)',
|
|
946
946
|
})
|
|
947
947
|
})
|
|
948
948
|
})
|
|
949
949
|
|
|
950
950
|
// ─── Fly ────────────────────────────────────────────────────────────
|
|
951
951
|
|
|
952
|
-
describe(
|
|
953
|
-
it(
|
|
952
|
+
describe('presets — fly', () => {
|
|
953
|
+
it('flyInUp uses 100vh', () => {
|
|
954
954
|
expect(flyInUp.enterStyle).toEqual({
|
|
955
955
|
opacity: 0,
|
|
956
|
-
transform:
|
|
956
|
+
transform: 'translateY(100vh)',
|
|
957
957
|
})
|
|
958
958
|
})
|
|
959
959
|
|
|
960
|
-
it(
|
|
960
|
+
it('flyInDown uses -100vh', () => {
|
|
961
961
|
expect(flyInDown.enterStyle).toEqual({
|
|
962
962
|
opacity: 0,
|
|
963
|
-
transform:
|
|
963
|
+
transform: 'translateY(-100vh)',
|
|
964
964
|
})
|
|
965
965
|
})
|
|
966
966
|
|
|
967
|
-
it(
|
|
967
|
+
it('flyInLeft uses 100vw', () => {
|
|
968
968
|
expect(flyInLeft.enterStyle).toEqual({
|
|
969
969
|
opacity: 0,
|
|
970
|
-
transform:
|
|
970
|
+
transform: 'translateX(100vw)',
|
|
971
971
|
})
|
|
972
972
|
})
|
|
973
973
|
|
|
974
|
-
it(
|
|
974
|
+
it('flyInRight uses -100vw', () => {
|
|
975
975
|
expect(flyInRight.enterStyle).toEqual({
|
|
976
976
|
opacity: 0,
|
|
977
|
-
transform:
|
|
977
|
+
transform: 'translateX(-100vw)',
|
|
978
978
|
})
|
|
979
979
|
})
|
|
980
980
|
})
|
|
981
981
|
|
|
982
982
|
// ─── Pop / Rubber / Squish ──────────────────────────────────────────
|
|
983
983
|
|
|
984
|
-
describe(
|
|
985
|
-
it(
|
|
984
|
+
describe('presets — pop/rubber/squish', () => {
|
|
985
|
+
it('popIn uses spring easing + scale(0.3)', () => {
|
|
986
986
|
expect(popIn.enterStyle).toEqual({
|
|
987
987
|
opacity: 0,
|
|
988
|
-
transform:
|
|
988
|
+
transform: 'scale(0.3)',
|
|
989
989
|
})
|
|
990
|
-
expect(popIn.enterTransition).toContain(
|
|
990
|
+
expect(popIn.enterTransition).toContain('cubic-bezier(0.34, 1.56, 0.64, 1)')
|
|
991
991
|
})
|
|
992
992
|
|
|
993
|
-
it(
|
|
994
|
-
expect(rubberIn.enterTransition).toContain(
|
|
993
|
+
it('rubberIn uses elastic easing', () => {
|
|
994
|
+
expect(rubberIn.enterTransition).toContain('cubic-bezier(0.175, 0.885, 0.32, 1.275)')
|
|
995
995
|
})
|
|
996
996
|
|
|
997
|
-
it(
|
|
997
|
+
it('squishX uses non-uniform scale', () => {
|
|
998
998
|
expect(squishX.enterStyle).toEqual({
|
|
999
999
|
opacity: 0,
|
|
1000
|
-
transform:
|
|
1000
|
+
transform: 'scaleX(1.4) scaleY(0.6)',
|
|
1001
1001
|
})
|
|
1002
1002
|
})
|
|
1003
1003
|
|
|
1004
|
-
it(
|
|
1004
|
+
it('squishY uses non-uniform scale (inverted)', () => {
|
|
1005
1005
|
expect(squishY.enterStyle).toEqual({
|
|
1006
1006
|
opacity: 0,
|
|
1007
|
-
transform:
|
|
1007
|
+
transform: 'scaleX(0.6) scaleY(1.4)',
|
|
1008
1008
|
})
|
|
1009
1009
|
})
|
|
1010
1010
|
})
|
|
1011
1011
|
|
|
1012
1012
|
// ─── Scale rotate / newspaper ───────────────────────────────────────
|
|
1013
1013
|
|
|
1014
|
-
describe(
|
|
1015
|
-
it(
|
|
1014
|
+
describe('presets — scaleRotate/newspaper', () => {
|
|
1015
|
+
it('scaleRotateIn uses scale(0) + rotate(-180deg)', () => {
|
|
1016
1016
|
expect(scaleRotateIn.enterStyle).toEqual({
|
|
1017
1017
|
opacity: 0,
|
|
1018
|
-
transform:
|
|
1018
|
+
transform: 'scale(0) rotate(-180deg)',
|
|
1019
1019
|
})
|
|
1020
1020
|
})
|
|
1021
1021
|
|
|
1022
|
-
it(
|
|
1022
|
+
it('newspaperIn uses scale(0) + rotate(-720deg)', () => {
|
|
1023
1023
|
expect(newspaperIn.enterStyle).toEqual({
|
|
1024
1024
|
opacity: 0,
|
|
1025
|
-
transform:
|
|
1025
|
+
transform: 'scale(0) rotate(-720deg)',
|
|
1026
1026
|
})
|
|
1027
|
-
expect(newspaperIn.enterTransition).toContain(
|
|
1027
|
+
expect(newspaperIn.enterTransition).toContain('700ms')
|
|
1028
1028
|
})
|
|
1029
1029
|
})
|
|
1030
1030
|
|
|
1031
1031
|
// ─── Float ──────────────────────────────────────────────────────────
|
|
1032
1032
|
|
|
1033
|
-
describe(
|
|
1034
|
-
it(
|
|
1033
|
+
describe('presets — float', () => {
|
|
1034
|
+
it('floatUp uses premium easing + translateY + scale', () => {
|
|
1035
1035
|
expect(floatUp.enterStyle).toEqual({
|
|
1036
1036
|
opacity: 0,
|
|
1037
|
-
transform:
|
|
1037
|
+
transform: 'translateY(32px) scale(0.97)',
|
|
1038
1038
|
})
|
|
1039
|
-
expect(floatUp.enterTransition).toContain(
|
|
1039
|
+
expect(floatUp.enterTransition).toContain('cubic-bezier(0.23, 1, 0.32, 1)')
|
|
1040
1040
|
})
|
|
1041
1041
|
|
|
1042
|
-
it(
|
|
1042
|
+
it('all float variants use premium easing', () => {
|
|
1043
1043
|
for (const p of [floatUp, floatDown, floatLeft, floatRight]) {
|
|
1044
|
-
expect(p.enterTransition).toContain(
|
|
1044
|
+
expect(p.enterTransition).toContain('cubic-bezier(0.23, 1, 0.32, 1)')
|
|
1045
1045
|
}
|
|
1046
1046
|
})
|
|
1047
1047
|
})
|
|
1048
1048
|
|
|
1049
1049
|
// ─── Push ───────────────────────────────────────────────────────────
|
|
1050
1050
|
|
|
1051
|
-
describe(
|
|
1052
|
-
it(
|
|
1051
|
+
describe('presets — push', () => {
|
|
1052
|
+
it('pushInLeft uses translateX(-48px) + scale(0.9)', () => {
|
|
1053
1053
|
expect(pushInLeft.enterStyle).toEqual({
|
|
1054
1054
|
opacity: 0,
|
|
1055
|
-
transform:
|
|
1055
|
+
transform: 'translateX(-48px) scale(0.9)',
|
|
1056
1056
|
})
|
|
1057
1057
|
})
|
|
1058
1058
|
|
|
1059
|
-
it(
|
|
1059
|
+
it('pushInRight uses translateX(48px) + scale(0.9)', () => {
|
|
1060
1060
|
expect(pushInRight.enterStyle).toEqual({
|
|
1061
1061
|
opacity: 0,
|
|
1062
|
-
transform:
|
|
1062
|
+
transform: 'translateX(48px) scale(0.9)',
|
|
1063
1063
|
})
|
|
1064
1064
|
})
|
|
1065
1065
|
})
|