@@ -9,16 +9,6 @@ import {
9
9
CUSTOM_CSS_PROPERTIES ,
10
10
} from './globals.js' ;
11
11
12
- // import { initParentResize, endParentResize } from './resize-parent.js';
13
-
14
- // import {
15
- // // removeInlineTransition,
16
- // // appendTransition,
17
- // // getCurrentTransition,
18
- // } from './transitions.js';
19
-
20
- // import { setParentMaxMeasures } from './measurements.js';
21
-
22
12
/**
23
13
* Contains the default value for each custom option.
24
14
* Those values can be overwritten by the user by calling jsCssAnimations.config()
@@ -293,20 +283,6 @@ const isVisibility = animType => animType === 'visibility';
293
283
*/
294
284
const isMotion = animType => animType === 'motion' ;
295
285
296
- /**
297
- * Removes the current motion animation CSS class from the element
298
- * @param {HTMLElement } element - The DOM element being animated
299
- */
300
- const removeMotionCssClass = element => {
301
- const className = [ ...element . classList ] . find ( cl =>
302
- cl . match ( / j s \- a n i m \- \- ( r o t a t e | s c a l e ) / )
303
- ) ;
304
- if ( className ) element . classList . remove ( className ) ;
305
- if ( className === CLASS_NAMES . move [ MOTION_ANIMS_ID . rotate ] ) {
306
- element . style . removeProperty ( PROPERTY_NAMES . angle ) ;
307
- }
308
- } ;
309
-
310
286
/**
311
287
* Sets an attribute to indicate that the element is currently being animated
312
288
* and so can not perform any other animations
@@ -332,14 +308,6 @@ const enable = element => {
332
308
const isEnabled = element =>
333
309
! ( element . getAttribute ( 'js-anim--disabled' ) === 'true' ) ;
334
310
335
- /**
336
- * Adds a CSS class which will set the overflow property to 'clip' (or 'hidden')
337
- * @param {HTMLElement } el - The DOM element which will receive the CSS class
338
- */
339
- const setOverflowHidden = el => {
340
- el . classList . add ( CLASS_NAMES . overflowHidden ) ;
341
- } ;
342
-
343
311
/**
344
312
* Removes the CSS class which sets the overflow property to 'clip' (or 'hidden')
345
313
* @param {HTMLElement } el - The DOM element with the CSS class to remove
@@ -348,62 +316,6 @@ const removeOverflowHidden = el => {
348
316
el . classList . remove ( CLASS_NAMES . overflowHidden ) ;
349
317
} ;
350
318
351
- /**
352
- * Verifies if an element has defined an iteration CSS property
353
- * @param {HTMLElement } element
354
- * @returns True if the element has an iteration CSS property set, False otherwise
355
- */
356
- const hasIterationProp = element => {
357
- const iterationProperty = element . style . getPropertyValue (
358
- PROPERTY_NAMES . iteration
359
- ) ;
360
- return (
361
- iterationProperty != '1' &&
362
- iterationProperty . match ( / ^ ( i n f i n i t e | \d + ) $ / ) !== null
363
- ) ;
364
- } ;
365
-
366
- /**
367
- * Sets the parent element dimensions, if needed.
368
- *
369
- * Removes the collapsed or hidden class from the element, when necessary
370
- * @param {HTMLElement } element - The DOM element being animated
371
- * @param {{
372
- * parentState: string,
373
- * element: HTMLElement,
374
- * parentMeasures: Object,
375
- * action: string,
376
- * dimension: string | undefined
377
- * }} args - All the necessary arguments
378
- */
379
- const handleVisibilityToggle = ( element , args ) => {
380
- setTimeout ( ( ) => {
381
- if ( args . dimension ) setParentMaxMeasures ( args ) ;
382
- if ( args . action === 'show' ) {
383
- element . classList . remove ( CLASS_NAMES . hidden , CLASS_NAMES . collapsed ) ;
384
- }
385
- } , 0 ) ;
386
- } ;
387
-
388
- /**
389
- * Adds the hidden or collapsed class, when necessary.
390
- * Finalize parent element's resize operations, if needed.
391
- * @param {HTMLElement } element - The DOM element being animated
392
- * @param {Object } opts - All the necessary options
393
- */
394
- const endVisibilityToggle = ( element , opts ) => {
395
- if ( opts . action === 'hide' ) {
396
- opts . maintainSpace
397
- ? element . classList . add ( CLASS_NAMES . hidden )
398
- : element . classList . add ( CLASS_NAMES . collapsed ) ;
399
- }
400
- if ( opts . heightTransition || opts . widthTransition )
401
- endParentResize ( element , opts ) ;
402
-
403
- if ( opts . overflowHidden && element . parentElement )
404
- removeOverflowHidden ( element . parentElement ) ;
405
- } ;
406
-
407
319
/**
408
320
* Executes a given callback, checking, when necessary, if the callback was already
409
321
* executed by another element being animated by the same trigger button
@@ -503,7 +415,6 @@ const animate = async (element, action, id, opts = {}) => {
503
415
move : 'moveBack' ,
504
416
moveBack : 'move' ,
505
417
} ) ;
506
- // let parentMeasures, dimension, currentTransition;
507
418
508
419
if ( trigger ) TARGETS_STACK . add ( element , trigger ) ;
509
420
@@ -517,72 +428,6 @@ const animate = async (element, action, id, opts = {}) => {
517
428
maintainSpace,
518
429
} ) ;
519
430
520
- // const handleAnimation = {
521
- // begining: {
522
- // visibility: () => {
523
- // if (widthTransition || heightTransition) {
524
- // ({ parentMeasures, dimension } = initParentResize({
525
- // element,
526
- // action,
527
- // widthTransition,
528
- // heightTransition,
529
- // }));
530
- // }
531
-
532
- // if (overflowHidden && element.parentElement)
533
- // setOverflowHidden(element.parentElement);
534
- // },
535
- // motion: () => {
536
- // currentTransition = getCurrentTransition(element);
537
- // removeMotionCssClass(element);
538
- // },
539
- // },
540
- // middle: {
541
- // visibility: () => {
542
- // handleVisibilityToggle(element, {
543
- // parentState: 'final',
544
- // element,
545
- // parentMeasures,
546
- // action,
547
- // dimension,
548
- // });
549
- // },
550
- // motion: () => {
551
- // if (currentTransition) {
552
- // appendTransition(element, CLASS_NAMES[action][id], currentTransition);
553
- // }
554
- // if (action === 'move') element.classList.add(CLASS_NAMES.moved);
555
- // },
556
- // },
557
- // end: {
558
- // visibility: () => {
559
- // endVisibilityToggle(element, {
560
- // action,
561
- // maintainSpace,
562
- // widthTransition,
563
- // heightTransition,
564
- // overflowHidden,
565
- // });
566
- // if (!hasIterationProp(element))
567
- // element.classList.remove(CLASS_NAMES[action][id]);
568
- // },
569
- // motion: () => {
570
- // if (action === 'moveBack') element.classList.remove(CLASS_NAMES.moved);
571
- // },
572
- // },
573
- // conclude: () => {
574
- // if (trigger && opts.queryIndex === opts.totalTargets - 1) {
575
- // opts.staggerDelay
576
- // ? CALLBACK_TRACKER.remove(trigger)
577
- // : setTimeout(() => CALLBACK_TRACKER.remove(trigger), delay);
578
- // TARGETS_STACK.get(trigger).forEach(el => enable(el));
579
- // TARGETS_STACK.remove(trigger);
580
- // } else if (!trigger) {
581
- // enable(element);
582
- // }
583
- // },
584
- // };
585
-
586
431
const concludeAnimation = ( ) => {
587
432
if ( trigger && opts . queryIndex === opts . totalTargets - 1 ) {
588
433
opts . staggerDelay
0 commit comments