@@ -40,31 +40,6 @@ type VelocityEasingType = VelocityEasingFn
40
40
| string
41
41
| number [ ] ;
42
42
43
- /**
44
- * Chaining Velocity calls from various sources.
45
- */
46
- interface VelocityExtended < TNode extends Node = HTMLorSVGElement > {
47
- velocity : Velocity & {
48
- ( action : "finish" , queue ?: string ) : VelocityResult ;
49
- ( action : "option" , option : string ) : any ;
50
- ( action : "option" , option : string , value : any ) : VelocityResult ;
51
- ( action : "pause" , queue ?: string ) : VelocityResult ;
52
- ( action : "resume" , queue ?: string ) : VelocityResult ;
53
- ( action : "stop" , queue ?: string ) : VelocityResult ;
54
- ( action : string , ...args : any [ ] ) : VelocityResult ;
55
- ( propertyMap : string | VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , complete ?: ( ) => void ) : VelocityResult ;
56
- ( propertyMap : string | VelocityProperties , complete ?: ( ) => void ) : VelocityResult ;
57
- ( propertyMap : string | VelocityProperties , easing ?: VelocityEasingType , complete ?: ( ) => void ) : VelocityResult ;
58
- ( propertyMap : string | VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , easing ?: VelocityEasingType , complete ?: ( ) => void ) : VelocityResult ;
59
- ( propertyMap : string | VelocityProperties , option ?: VelocityOptions ) : VelocityResult ;
60
- /**
61
- * TODO: Decide if this should be public
62
- * @private
63
- */
64
- animations : AnimationCall [ ]
65
- }
66
- }
67
-
68
43
/**
69
44
* The return type of any velocity call. If this is called via a "utility"
70
45
* function (such a jQuery <code>$(elements).velocity(...)</code>) then it will
@@ -490,7 +465,7 @@ declare const enum AnimationFlags {
490
465
/**
491
466
* Set when an animation is manually stopped.
492
467
*/
493
- STOPPED = 1 << 4 ,
468
+ STOPPED = 1 << 4 ,
494
469
}
495
470
496
471
interface AnimationCall extends StrictVelocityOptions {
@@ -566,18 +541,40 @@ interface AnimationCall extends StrictVelocityOptions {
566
541
percentComplete ?: number ;
567
542
}
568
543
544
+ /**
545
+ * VelocityChain is used to extend the chained Velocity calls with specific
546
+ * actions and their arguments.
547
+ */
548
+ interface VelocityChain {
549
+ ( action : string , ...args : any [ ] ) : any | VelocityResult ;
550
+ ( propertyMap : string | VelocityProperties , complete ?: ( ) => void ) : VelocityResult ;
551
+ ( propertyMap : string | VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , complete ?: ( ) => void ) : VelocityResult ;
552
+ ( propertyMap : string | VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , easing ?: VelocityEasingType , complete ?: ( ) => void ) : VelocityResult ;
553
+ ( propertyMap : string | VelocityProperties , easing ?: VelocityEasingType , complete ?: ( ) => void ) : VelocityResult ;
554
+ ( propertyMap : string | VelocityProperties , option ?: VelocityOptions ) : VelocityResult ;
555
+ }
556
+
557
+ /**
558
+ * Direct Velocity access.
559
+ */
569
560
interface Velocity {
570
561
// TODO: Add all variations of the velocity argument formats allowed. Make them TYPE based as they're used in multiple places.
571
- ( options ?: VelocityObjectArgs | string ) : VelocityResult ;
572
- ( elements : VelocityElements , propertyMap : string | VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , complete ?: ( ) => void ) : VelocityResult ;
573
- ( elements : VelocityElements , propertyMap : string | VelocityProperties , complete ?: ( ) => void ) : VelocityResult ;
574
- ( elements : VelocityElements , propertyMap : string | VelocityProperties , easing ?: string | number [ ] , complete ?: ( ) => void ) : VelocityResult ;
575
- ( elements : VelocityElements , propertyMap : string | VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , easing ?: string | number [ ] , complete ?: ( ) => void ) : VelocityResult ;
576
- ( elements : VelocityElements , propertyMap : string | VelocityProperties ) : VelocityResult ;
577
- ( elements : VelocityElements , propertyMap : string | VelocityProperties , options : VelocityOptions ) : VelocityResult ;
578
- ( elements : VelocityElements , propertyMap : string , option : any , value : any ) : VelocityResult ;
579
-
580
- defaults : VelocityOptions & { reset : ( ) => void } ;
562
+ ( options : VelocityObjectArgs ) : VelocityResult ;
563
+ ( action : string , ...args : any [ ] ) : VelocityResult ;
564
+ ( elements : VelocityElements , action : string , ...args : any [ ] ) : VelocityResult ;
565
+ ( elements : VelocityElements , propertyMap : VelocityProperties , complete ?: ( ) => void ) : VelocityResult ;
566
+ ( elements : VelocityElements , propertyMap : VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , complete ?: ( ) => void ) : VelocityResult ;
567
+ ( elements : VelocityElements , propertyMap : VelocityProperties , duration ?: number | "fast" | "normal" | "slow" , easing ?: string | number [ ] , complete ?: ( ) => void ) : VelocityResult ;
568
+ ( elements : VelocityElements , propertyMap : VelocityProperties , easing ?: string | number [ ] , complete ?: ( ) => void ) : VelocityResult ;
569
+ ( elements : VelocityElements , propertyMap : VelocityProperties , options ?: VelocityOptions ) : VelocityResult ;
570
+
571
+ defaults : VelocityOptions & {
572
+ /**
573
+ * Provided in order to reset Velocity defaults back to their initial
574
+ * state.
575
+ */
576
+ reset : ( ) => void
577
+ } ;
581
578
582
579
queue ( element : HTMLorSVGElement , animation : AnimationCall , queue ?: string | boolean ) : void ;
583
580
dequeue ( element : HTMLorSVGElement , queue ?: string | boolean , skip ?: boolean ) : AnimationCall ;
@@ -587,34 +584,20 @@ interface Velocity {
587
584
RunSequence ( originalSequence ) : void ;
588
585
RegisterEffect ( effectName : string , properties ) : Velocity ;
589
586
590
- /**
591
- * Expose a style shortcut - can't be used with chaining, but might be of
592
- * use to people.
593
- */
594
- style ( elements : VelocityResult , property : { [ property : string ] : string } ) : VelocityResult ;
595
- style ( elements : VelocityResult , property : string ) : string | string [ ] ;
596
- style ( elements : VelocityResult , property : string , value : string ) : VelocityResult ;
597
-
598
587
/**
599
588
* Available to be able to check what version you're running against.
600
589
*/
601
- version : {
602
- major : number ;
603
- minor : number ;
604
- patch : number ;
590
+ readonly version : {
591
+ readonly major : number ;
592
+ readonly minor : number ;
593
+ readonly patch : number ;
605
594
}
606
595
607
596
CSS : {
608
597
getPropertyValue ( element : HTMLorSVGElement , property : string , rootPropertyValue ?: string , forceStyleLookup ?: boolean ) : string | number ;
609
598
getUnit ( str : string , start ?: number ) : string ;
610
599
fixColors ( str : string ) : string ;
611
600
Normalizations : { [ name : string ] : VelocityNormalizationsFn } ;
612
- // Hooks: {
613
- // getRoot(property: string): string;
614
- // cleanRootPropertyValue(rootProperty: string, rootPropertyValue: string): string;
615
- // extractValue(fullHookName: string, rootPropertyValue: string): string;
616
- // injectValue(fullHookName: string, hookValue: string, rootPropertyValue: string): string;
617
- // };
618
601
Names : {
619
602
camelCase ( property : string ) : string ;
620
603
SVGAttribute ( property : string ) : boolean ;
@@ -629,82 +612,219 @@ interface Velocity {
629
612
removeClass ( element : HTMLorSVGElement , className : string ) : void ;
630
613
} ;
631
614
} ;
632
- State : {
615
+ /**
616
+ * Current internal state of Velocity.
617
+ */
618
+ readonly State : {
633
619
/**
634
620
* Detect if this is a NodeJS or web browser
635
621
*/
636
- isClient : boolean ;
622
+ readonly isClient : boolean ;
637
623
/**
638
624
* Detect mobile devices to determine if mobileHA should be turned
639
625
* on.
640
626
*/
641
- isMobile : boolean ;
627
+ readonly isMobile : boolean ;
642
628
/**
643
629
* The mobileHA option's behavior changes on older Android devices
644
630
* (Gingerbread, versions 2.3.3-2.3.7).
645
631
*/
646
- isAndroid : boolean ;
632
+ readonly isAndroid : boolean ;
647
633
/**
648
634
* The mobileHA option's behavior changes on older Android devices
649
635
* (Gingerbread, versions 2.3.3-2.3.7).
650
636
*/
651
- isGingerbread : boolean ;
637
+ readonly isGingerbread : boolean ;
652
638
/**
653
639
* Chrome browser
654
640
*/
655
- isChrome : boolean ;
641
+ readonly isChrome : boolean ;
656
642
/**
657
643
* Firefox browser
658
644
*/
659
- isFirefox : boolean ;
645
+ readonly isFirefox : boolean ;
660
646
/**
661
647
* Create a cached element for re-use when checking for CSS property
662
648
* prefixes.
663
649
*/
664
- prefixElement : boolean ;
650
+ readonly prefixElement : boolean ;
665
651
/**
666
652
* Cache every prefix match to avoid repeating lookups.
667
653
*/
668
- prefixMatches : { [ property : string ] : string } ;
654
+ readonly prefixMatches : { [ property : string ] : string } ;
669
655
/**
670
656
* Retrieve the appropriate scroll anchor and property name for the
671
657
* browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY
658
+ *
659
+ * @deprecated
672
660
*/
673
661
windowScrollAnchor : boolean ;
674
662
/**
675
663
* Cache the anchor used for animating window scrolling.
664
+ *
665
+ * @deprecated
676
666
*/
677
667
scrollAnchor : Element ;
678
668
/**
679
669
* Cache the browser-specific property names associated with the
670
+ *
671
+ * @deprecated
680
672
* scroll anchor.
681
673
*/
682
674
scrollPropertyLeft : string ;
683
675
/**
684
676
* Cache the browser-specific property names associated with the
677
+ *
678
+ * @deprecated
685
679
* scroll anchor.
686
680
*/
687
681
scrollPropertyTop : string ;
688
682
/**
689
683
* Keep track of whether our RAF tick is running.
690
684
*/
691
- isTicking : boolean ;
685
+ readonly isTicking : boolean ;
692
686
/**
693
687
* Container for every in-progress call to Velocity.
694
688
*/
695
- first : AnimationCall ;
689
+ readonly first : AnimationCall ;
696
690
/**
697
691
* Container for every in-progress call to Velocity.
698
692
*/
699
- last : AnimationCall ;
693
+ readonly last : AnimationCall ;
700
694
/**
701
695
* First new animation - to shortcut starting them all up and push
702
696
* any css reads to the start of the tick
703
697
*/
704
- firstNew : AnimationCall ;
698
+ readonly firstNew : AnimationCall ;
705
699
} ;
706
700
}
707
701
702
+ /**
703
+ * Chaining Velocity calls from various sources.
704
+ */
705
+ interface VelocityExtended < TNode extends Node = HTMLorSVGElement > {
706
+ velocity : Velocity & VelocityChain & {
707
+ /**
708
+ * TODO: Decide if this should be public
709
+ * @private
710
+ */
711
+ animations : AnimationCall [ ]
712
+ }
713
+ }
714
+
715
+ ////////////////////
716
+ // Action: Finish //
717
+ ////////////////////
718
+ interface Velocity {
719
+ ( action : "finish" , queue ?: string ) : VelocityResult ;
720
+ ( elements : VelocityElements , action : "finish" , queue ?: string ) : VelocityResult ;
721
+ }
722
+
723
+ interface VelocityChain {
724
+ ( action : "finish" , queue ?: string ) : VelocityResult ;
725
+ }
726
+
727
+ ////////////////////
728
+ // Action: Option //
729
+ ////////////////////
730
+ interface Velocity {
731
+ ( action : "option" , option : string ) : any ;
732
+ ( action : "option" , option : string , value : any ) : VelocityResult ;
733
+ ( elements : VelocityElements , action : "option" , option : string ) : any ;
734
+ ( elements : VelocityElements , action : "option" , option : string , value : any ) : VelocityResult ;
735
+ }
736
+
737
+ interface VelocityChain {
738
+ ( action : "option" , option : string ) : any ;
739
+ ( action : "option" , option : string , value : any ) : VelocityResult ;
740
+ }
741
+
742
+ ///////////////////
743
+ // Action: Pause //
744
+ ///////////////////
745
+ interface Velocity {
746
+ ( action : "pause" , queue ?: string ) : VelocityResult ;
747
+ ( elements : VelocityElements , action : "pause" , queue ?: string ) : VelocityResult ;
748
+ }
749
+
750
+ interface VelocityChain {
751
+ ( action : "pause" , queue ?: string ) : VelocityResult ;
752
+ }
753
+
754
+ ////////////////////
755
+ // Action: Resume //
756
+ ////////////////////
757
+ interface Velocity {
758
+ ( action : "resume" , queue ?: string ) : VelocityResult ;
759
+ ( elements : VelocityElements , action : "resume" , queue ?: string ) : VelocityResult ;
760
+ }
761
+
762
+ interface VelocityChain {
763
+ ( action : "resume" , queue ?: string ) : VelocityResult ;
764
+ }
765
+
766
+ ////////////////////
767
+ // Action: Resume //
768
+ ////////////////////
769
+ interface Velocity {
770
+ ( action : "resume" , queue ?: string ) : VelocityResult ;
771
+ ( elements : VelocityElements , action : "resume" , queue ?: string ) : VelocityResult ;
772
+ }
773
+
774
+ interface VelocityChain {
775
+ ( action : "resume" , queue ?: string ) : VelocityResult ;
776
+ }
777
+
778
+ //////////////////
779
+ // Action: Stop //
780
+ //////////////////
781
+ interface Velocity {
782
+ ( action : "stop" , queue ?: string ) : VelocityResult ;
783
+ ( elements : VelocityElements , action : "stop" , queue ?: string ) : VelocityResult ;
784
+ }
785
+
786
+ interface VelocityChain {
787
+ ( action : "stop" , queue ?: string ) : VelocityResult ;
788
+ }
789
+
790
+ ///////////////////
791
+ // Action: Style //
792
+ ///////////////////
793
+ interface Velocity {
794
+ ( action : "style" , property : { [ property : string ] : string } ) : VelocityResult ;
795
+ ( action : "style" , property : string ) : string | string [ ] ;
796
+ ( action : "style" , property : string , value : string ) : VelocityResult ;
797
+ ( element : HTMLorSVGElement , action : "style" , property : string ) : string ;
798
+ ( elements : VelocityElements , action : "style" , property : { [ property : string ] : string } ) : VelocityResult ;
799
+ ( elements : VelocityElements , action : "style" , property : string ) : string | string [ ] ;
800
+ ( elements : VelocityElements , action : "style" , property : string , value : string ) : VelocityResult ;
801
+
802
+ style ( elements : VelocityResult , property : { [ property : string ] : string } ) : VelocityResult ;
803
+ style ( elements : VelocityResult , property : string ) : string | string [ ] ;
804
+ style ( elements : VelocityResult , property : string , value : string ) : VelocityResult ;
805
+ }
806
+
807
+ interface VelocityChain {
808
+ ( action : "style" , property : { [ property : string ] : string } ) : VelocityResult ;
809
+ ( action : "style" , property : string ) : string | string [ ] ;
810
+ ( action : "style" , property : string , value : string ) : VelocityResult ;
811
+ }
812
+
813
+ ///////////////////
814
+ // Action: Tween //
815
+ ///////////////////
816
+ interface Velocity {
817
+ ( action : "tween" , percentComplete : number , property : string , value : VelocityPropertyValue , easing ?: VelocityEasingType ) : string ;
818
+ ( action : "tween" , percentComplete : number , propertyMap : VelocityProperties , easing ?: VelocityEasingType ) : { [ property in keyof CSSStyleDeclaration ] ?: string } ;
819
+ ( elements : VelocityElements , action : "tween" , percentComplete : number , property : string , value : VelocityPropertyValue , easing ?: VelocityEasingType ) : string ;
820
+ ( elements : VelocityElements , action : "tween" , percentComplete : number , propertyMap : VelocityProperties , easing ?: VelocityEasingType ) : { [ property in keyof CSSStyleDeclaration ] ?: string } ;
821
+ }
822
+
823
+ interface VelocityChain {
824
+ ( action : "tween" , percentComplete : number , property : string , value : VelocityPropertyValue , easing ?: VelocityEasingType ) : string ;
825
+ ( action : "tween" , percentComplete : number , propertyMap : VelocityProperties , easing ?: VelocityEasingType ) : { [ property in keyof CSSStyleDeclaration ] ?: string } ;
826
+ }
827
+
708
828
/**
709
829
* Extend the return value from <code>document.querySelectorAll()</code>.
710
830
*/
@@ -715,7 +835,6 @@ interface NodeListOf<TNode extends Node> extends VelocityExtended<TNode> {}
715
835
*/
716
836
interface Element extends VelocityExtended < Element > { }
717
837
718
-
719
838
/**
720
839
* Extend <code>Element</code> directly.
721
840
*/
0 commit comments