sw2at-ui 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +21 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/app/assets/images/swat/loading-green.gif +0 -0
- data/app/assets/javascripts/swat/.bowerrc +3 -0
- data/app/assets/javascripts/swat/app/app.coffee +38 -0
- data/app/assets/javascripts/swat/app/controllers/revision.coffee +25 -0
- data/app/assets/javascripts/swat/app/controllers/revisions.coffee +10 -0
- data/app/assets/javascripts/swat/app/controllers/root.coffee +8 -0
- data/app/assets/javascripts/swat/app/factories/response.coffee +9 -0
- data/app/assets/javascripts/swat/app/factories/revision_model.coffee +20 -0
- data/app/assets/javascripts/swat/app/services/revision.coffee +16 -0
- data/app/assets/javascripts/swat/app/services/test_case.coffee +8 -0
- data/app/assets/javascripts/swat/application.coffee +5 -0
- data/app/assets/javascripts/swat/bower.json +16 -0
- data/app/assets/javascripts/swat/bower_components/angular/angular-csp.css +21 -0
- data/app/assets/javascripts/swat/bower_components/angular/angular.js +28133 -0
- data/app/assets/javascripts/swat/bower_components/angular/angular.min.js +289 -0
- data/app/assets/javascripts/swat/bower_components/angular/index.js +2 -0
- data/app/assets/javascripts/swat/bower_components/angular-animate/angular-animate.js +2137 -0
- data/app/assets/javascripts/swat/bower_components/angular-animate/angular-animate.min.js +33 -0
- data/app/assets/javascripts/swat/bower_components/angular-aria/angular-aria.js +339 -0
- data/app/assets/javascripts/swat/bower_components/angular-aria/angular-aria.min.js +12 -0
- data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap-csp.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap-tpls.js +4840 -0
- data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js +10 -0
- data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap.js +4461 -0
- data/app/assets/javascripts/swat/bower_components/angular-bootstrap/ui-bootstrap.min.js +9 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/LICENSE.txt +21 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.css +6228 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.js +8602 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/angular-material.min.js +277 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/default-theme.css +394 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/backdrop/backdrop-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/backdrop/backdrop.css +54 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/backdrop/backdrop.js +40 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet-default-theme.css +15 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet.css +161 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/bottomSheet/bottomSheet.js +263 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/button/button-default-theme.css +49 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/button/button.css +134 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/button/button.js +101 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/card/card-default-theme.css +10 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/card/card.css +26 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/card/card.js +60 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/checkbox/checkbox-default-theme.css +38 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/checkbox/checkbox.css +78 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/checkbox/checkbox.js +135 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/content/content-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/content/content.css +24 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/content/content.js +87 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/core/core.css +2736 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/core/core.js +3090 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/core/default-theme.js +1 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/dialog/dialog-default-theme.css +11 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/dialog/dialog.css +75 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/dialog/dialog.js +500 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/divider/divider-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/divider/divider.css +12 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/divider/divider.js +50 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/icon/icon.css +24 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/icon/icon.js +52 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/input/input-default-theme.css +39 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/input/input.css +113 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/input/input.js +355 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/list/list.css +56 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/list/list.js +96 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/menu/menu.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/menu/menu.js +29 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressCircular/progressCircular-default-theme.css +35 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressCircular/progressCircular.css +1395 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressCircular/progressCircular.js +129 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressLinear/progressLinear-default-theme.css +26 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressLinear/progressLinear.css +366 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/progressLinear/progressLinear.js +130 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/radioButton/radioButton-default-theme.css +39 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/radioButton/radioButton.css +66 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/radioButton/radioButton.js +302 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sidenav/sidenav-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sidenav/sidenav.css +86 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sidenav/sidenav.js +320 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/slider/slider-default-theme.css +55 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/slider/slider.css +210 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/slider/slider.js +391 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sticky/sticky.css +20 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/sticky/sticky.js +314 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/subheader/subheader-default-theme.css +15 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/subheader/subheader.css +62 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/subheader/subheader.js +89 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/swipe/swipe.js +79 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/switch/switch-default-theme.css +29 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/switch/switch.css +81 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/switch/switch.js +171 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tabs/tabs-default-theme.css +34 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tabs/tabs.css +171 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tabs/tabs.js +1009 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/textField/textField-default-theme.css +29 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/textField/textField.css +72 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/textField/textField.js +145 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toast/toast-default-theme.css +17 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toast/toast.css +110 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toast/toast.js +236 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toolbar/toolbar-default-theme.css +17 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toolbar/toolbar.css +69 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/toolbar/toolbar.js +161 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tooltip/tooltip-default-theme.css +10 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tooltip/tooltip.css +133 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/tooltip/tooltip.js +199 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/whiteframe/whiteframe.css +20 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/closure/whiteframe/whiteframe.js +17 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/css/angular-material-layout.css +2582 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.css +54 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.js +38 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/backdrop.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/backdrop/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet-default-theme.css +15 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.css +188 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.js +293 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bottomSheet.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/bottomSheet/bower.json +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button-default-theme.css +42 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.css +132 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.js +94 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/button/button.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card-default-theme.css +10 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.css +31 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.js +58 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/card/card.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox-default-theme.css +38 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.css +79 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.js +133 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/checkbox/checkbox.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.css +24 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.js +60 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/content/content.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.css +3067 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.js +2780 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/core.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/core/default-theme.js +1 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/bower.json +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog-default-theme.css +11 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.css +88 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.js +495 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/dialog/dialog.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.css +12 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.js +48 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/divider/divider.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.css +24 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.js +50 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/icon/icon.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input-default-theme.css +40 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.css +102 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.js +333 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/input/input.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.css +61 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.js +94 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/list/list.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/bower.json +5 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.js +27 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/menu/menu.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular-default-theme.css +35 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.css +1445 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.js +127 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressCircular/progressCircular.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear-default-theme.css +28 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.css +368 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.js +128 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/progressLinear/progressLinear.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton-default-theme.css +39 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.css +67 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.js +296 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/radioButton/radioButton.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/bower.json +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav-default-theme.css +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.css +90 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.js +302 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sidenav/sidenav.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider-default-theme.css +55 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.css +218 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.js +411 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/slider/slider.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/bower.json +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.css +20 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.js +309 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/sticky/sticky.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/bower.json +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader-default-theme.css +15 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.css +61 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.js +86 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/subheader/subheader.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/swipe/bower.json +5 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/swipe/swipe.js +213 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/swipe/swipe.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/bower.json +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch-default-theme.css +29 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.css +77 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.js +144 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/switch/switch.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs-default-theme.css +34 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.css +181 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.js +992 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tabs/tabs.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField-default-theme.css +29 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.css +76 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.js +143 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/textField/textField.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/bower.json +9 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast-default-theme.css +17 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.css +115 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.js +235 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toast/toast.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/bower.json +8 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar-default-theme.css +17 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.css +78 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.js +158 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/toolbar/toolbar.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/bower.json +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip-default-theme.css +10 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip-default-theme.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.css +136 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.js +197 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/tooltip/tooltip.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/bower.json +5 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.css +20 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.js +15 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.min.css +6 -0
- data/app/assets/javascripts/swat/bower_components/angular-material/modules/js/whiteframe/whiteframe.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-resource/angular-resource.js +668 -0
- data/app/assets/javascripts/swat/bower_components/angular-resource/angular-resource.min.js +13 -0
- data/app/assets/javascripts/swat/bower_components/angular-resource/index.js +2 -0
- data/app/assets/javascripts/swat/bower_components/angular-route/angular-route.js +991 -0
- data/app/assets/javascripts/swat/bower_components/angular-route/angular-route.min.js +15 -0
- data/app/assets/javascripts/swat/bower_components/angular-route/index.js +2 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/LICENSE.txt +21 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/api/angular-ui-router.d.ts +126 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/release/angular-ui-router.js +4370 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/release/angular-ui-router.min.js +7 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/common.js +292 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/resolve.js +252 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/state.js +1465 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/stateDirectives.js +285 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/stateFilters.js +39 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/templateFactory.js +110 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/urlMatcherFactory.js +1050 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/urlRouter.js +427 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/view.js +71 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/viewDirective.js +303 -0
- data/app/assets/javascripts/swat/bower_components/angular-ui-router/src/viewScroll.js +52 -0
- data/app/assets/javascripts/swat/bower_components/lodash/lodash.js +12235 -0
- data/app/assets/javascripts/swat/bower_components/lodash/lodash.min.js +98 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/.editorconfig +10 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/.gitignore +3 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/Gruntfile.js +96 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/dest/ng-clip.min.js +2 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/example/bootstrap-tooltip.html +49 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/example/index.html +68 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/example/ng-repeat.html +44 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/npm-debug.log +145 -0
- data/app/assets/javascripts/swat/bower_components/ng-clip/src/ngClip.js +84 -0
- data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/.jshintrc +70 -0
- data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.Core.js +2017 -0
- data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.Core.min.js +10 -0
- data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.js +2581 -0
- data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.min.js +10 -0
- data/app/assets/javascripts/swat/bower_components/zeroclipboard/dist/ZeroClipboard.swf +0 -0
- data/app/assets/javascripts/swat/bower_components.coffee +12 -0
- data/app/assets/stylesheets/swat/application.sass +59 -0
- data/app/assets/stylesheets/swat/default-theme.css +394 -0
- data/app/assets/stylesheets/swat/font-awesome.css +1801 -0
- data/app/assets/stylesheets/swat/fonts/FontAwesome.otf +0 -0
- data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.svg +565 -0
- data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/stylesheets/swat/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/assets/stylesheets/swat/swat_theme.sass +177 -0
- data/app/controllers/swat/api/revisions_controller.rb +27 -0
- data/app/controllers/swat/api/test_cases_controller.rb +20 -0
- data/app/controllers/swat/application_controller.rb +4 -0
- data/app/controllers/swat/info/states_controller.rb +12 -0
- data/app/controllers/swat/pages/base_pages_controller.rb +7 -0
- data/app/controllers/swat/pages/revisions_controller.rb +8 -0
- data/app/controllers/swat/revisions_controller.rb +4 -0
- data/app/helpers/swat/application_helper.rb +4 -0
- data/app/models/concerns/root_revision_ext.rb +14 -0
- data/app/models/full_revision.rb +88 -0
- data/app/models/revision.rb +84 -0
- data/app/models/revision_status_calculator.rb +98 -0
- data/app/models/test_case.rb +25 -0
- data/app/views/layouts/swat/application.slim +36 -0
- data/app/views/layouts/swat/page.slim +2 -0
- data/app/views/swat/application/index.slim +0 -0
- data/app/views/swat/pages/revisions/index.slim +25 -0
- data/app/views/swat/pages/revisions/show.slim +43 -0
- data/app/views/swat/shared/_footer.slim +5 -0
- data/app/views/swat/shared/_header.slim +9 -0
- data/bin/rails +12 -0
- data/config/routes.rb +38 -0
- data/fixtures/firebase_collection.rb +97 -0
- data/lib/sw2at-ui.rb +19 -0
- data/lib/swat/engine.rb +5 -0
- data/lib/swat/ui/config.rb +28 -0
- data/lib/swat/ui/rspec_commands.rb +191 -0
- data/lib/swat/ui/rspec_setup.rb +42 -0
- data/lib/swat/ui/stats_collector.rb +90 -0
- data/lib/swat/ui/version.rb +5 -0
- data/lib/tasks/swat_tasks.rake +36 -0
- data/spec/lib/commands_spec.rb +88 -0
- data/spec/models/calculator_spec.rb +130 -0
- data/spec/models/full_revision_spec.rb +263 -0
- data/spec/models/revision_spec.rb +59 -0
- data/spec/models/testcase_spec.rb +94 -0
- data/spec/spec_helper.rb +45 -0
- data/sw2at-ui.gemspec +465 -0
- data/test/helper.rb +34 -0
- data/test/test_sw2at-ui.rb +7 -0
- metadata +628 -0
@@ -0,0 +1,2137 @@
|
|
1
|
+
/**
|
2
|
+
* @license AngularJS v1.3.12
|
3
|
+
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
|
+
* License: MIT
|
5
|
+
*/
|
6
|
+
(function(window, angular, undefined) {'use strict';
|
7
|
+
|
8
|
+
/* jshint maxlen: false */
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @ngdoc module
|
12
|
+
* @name ngAnimate
|
13
|
+
* @description
|
14
|
+
*
|
15
|
+
* The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives.
|
16
|
+
*
|
17
|
+
* <div doc-module-components="ngAnimate"></div>
|
18
|
+
*
|
19
|
+
* # Usage
|
20
|
+
*
|
21
|
+
* To see animations in action, all that is required is to define the appropriate CSS classes
|
22
|
+
* or to register a JavaScript animation via the `myModule.animation()` function. The directives that support animation automatically are:
|
23
|
+
* `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation
|
24
|
+
* by using the `$animate` service.
|
25
|
+
*
|
26
|
+
* Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives:
|
27
|
+
*
|
28
|
+
* | Directive | Supported Animations |
|
29
|
+
* |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
|
30
|
+
* | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move |
|
31
|
+
* | {@link ngRoute.directive:ngView#animations ngView} | enter and leave |
|
32
|
+
* | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
|
33
|
+
* | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
|
34
|
+
* | {@link ng.directive:ngIf#animations ngIf} | enter and leave |
|
35
|
+
* | {@link ng.directive:ngClass#animations ngClass} | add and remove (the CSS class(es) present) |
|
36
|
+
* | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide} | add and remove (the ng-hide class value) |
|
37
|
+
* | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) |
|
38
|
+
* | {@link module:ngMessages#animations ngMessages} | add and remove (ng-active & ng-inactive) |
|
39
|
+
* | {@link module:ngMessages#animations ngMessage} | enter and leave |
|
40
|
+
*
|
41
|
+
* You can find out more information about animations upon visiting each directive page.
|
42
|
+
*
|
43
|
+
* Below is an example of how to apply animations to a directive that supports animation hooks:
|
44
|
+
*
|
45
|
+
* ```html
|
46
|
+
* <style type="text/css">
|
47
|
+
* .slide.ng-enter, .slide.ng-leave {
|
48
|
+
* -webkit-transition:0.5s linear all;
|
49
|
+
* transition:0.5s linear all;
|
50
|
+
* }
|
51
|
+
*
|
52
|
+
* .slide.ng-enter { } /* starting animations for enter */
|
53
|
+
* .slide.ng-enter.ng-enter-active { } /* terminal animations for enter */
|
54
|
+
* .slide.ng-leave { } /* starting animations for leave */
|
55
|
+
* .slide.ng-leave.ng-leave-active { } /* terminal animations for leave */
|
56
|
+
* </style>
|
57
|
+
*
|
58
|
+
* <!--
|
59
|
+
* the animate service will automatically add .ng-enter and .ng-leave to the element
|
60
|
+
* to trigger the CSS transition/animations
|
61
|
+
* -->
|
62
|
+
* <ANY class="slide" ng-include="..."></ANY>
|
63
|
+
* ```
|
64
|
+
*
|
65
|
+
* Keep in mind that, by default, if an animation is running, any child elements cannot be animated
|
66
|
+
* until the parent element's animation has completed. This blocking feature can be overridden by
|
67
|
+
* placing the `ng-animate-children` attribute on a parent container tag.
|
68
|
+
*
|
69
|
+
* ```html
|
70
|
+
* <div class="slide-animation" ng-if="on" ng-animate-children>
|
71
|
+
* <div class="fade-animation" ng-if="on">
|
72
|
+
* <div class="explode-animation" ng-if="on">
|
73
|
+
* ...
|
74
|
+
* </div>
|
75
|
+
* </div>
|
76
|
+
* </div>
|
77
|
+
* ```
|
78
|
+
*
|
79
|
+
* When the `on` expression value changes and an animation is triggered then each of the elements within
|
80
|
+
* will all animate without the block being applied to child elements.
|
81
|
+
*
|
82
|
+
* ## Are animations run when the application starts?
|
83
|
+
* No they are not. When an application is bootstrapped Angular will disable animations from running to avoid
|
84
|
+
* a frenzy of animations from being triggered as soon as the browser has rendered the screen. For this to work,
|
85
|
+
* Angular will wait for two digest cycles until enabling animations. From there on, any animation-triggering
|
86
|
+
* layout changes in the application will trigger animations as normal.
|
87
|
+
*
|
88
|
+
* In addition, upon bootstrap, if the routing system or any directives or load remote data (via $http) then Angular
|
89
|
+
* will automatically extend the wait time to enable animations once **all** of the outbound HTTP requests
|
90
|
+
* are complete.
|
91
|
+
*
|
92
|
+
* ## CSS-defined Animations
|
93
|
+
* The animate service will automatically apply two CSS classes to the animated element and these two CSS classes
|
94
|
+
* are designed to contain the start and end CSS styling. Both CSS transitions and keyframe animations are supported
|
95
|
+
* and can be used to play along with this naming structure.
|
96
|
+
*
|
97
|
+
* The following code below demonstrates how to perform animations using **CSS transitions** with Angular:
|
98
|
+
*
|
99
|
+
* ```html
|
100
|
+
* <style type="text/css">
|
101
|
+
* /*
|
102
|
+
* The animate class is apart of the element and the ng-enter class
|
103
|
+
* is attached to the element once the enter animation event is triggered
|
104
|
+
* */
|
105
|
+
* .reveal-animation.ng-enter {
|
106
|
+
* -webkit-transition: 1s linear all; /* Safari/Chrome */
|
107
|
+
* transition: 1s linear all; /* All other modern browsers and IE10+ */
|
108
|
+
*
|
109
|
+
* /* The animation preparation code */
|
110
|
+
* opacity: 0;
|
111
|
+
* }
|
112
|
+
*
|
113
|
+
* /*
|
114
|
+
* Keep in mind that you want to combine both CSS
|
115
|
+
* classes together to avoid any CSS-specificity
|
116
|
+
* conflicts
|
117
|
+
* */
|
118
|
+
* .reveal-animation.ng-enter.ng-enter-active {
|
119
|
+
* /* The animation code itself */
|
120
|
+
* opacity: 1;
|
121
|
+
* }
|
122
|
+
* </style>
|
123
|
+
*
|
124
|
+
* <div class="view-container">
|
125
|
+
* <div ng-view class="reveal-animation"></div>
|
126
|
+
* </div>
|
127
|
+
* ```
|
128
|
+
*
|
129
|
+
* The following code below demonstrates how to perform animations using **CSS animations** with Angular:
|
130
|
+
*
|
131
|
+
* ```html
|
132
|
+
* <style type="text/css">
|
133
|
+
* .reveal-animation.ng-enter {
|
134
|
+
* -webkit-animation: enter_sequence 1s linear; /* Safari/Chrome */
|
135
|
+
* animation: enter_sequence 1s linear; /* IE10+ and Future Browsers */
|
136
|
+
* }
|
137
|
+
* @-webkit-keyframes enter_sequence {
|
138
|
+
* from { opacity:0; }
|
139
|
+
* to { opacity:1; }
|
140
|
+
* }
|
141
|
+
* @keyframes enter_sequence {
|
142
|
+
* from { opacity:0; }
|
143
|
+
* to { opacity:1; }
|
144
|
+
* }
|
145
|
+
* </style>
|
146
|
+
*
|
147
|
+
* <div class="view-container">
|
148
|
+
* <div ng-view class="reveal-animation"></div>
|
149
|
+
* </div>
|
150
|
+
* ```
|
151
|
+
*
|
152
|
+
* Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing.
|
153
|
+
*
|
154
|
+
* Upon DOM mutation, the event class is added first (something like `ng-enter`), then the browser prepares itself to add
|
155
|
+
* the active class (in this case `ng-enter-active`) which then triggers the animation. The animation module will automatically
|
156
|
+
* detect the CSS code to determine when the animation ends. Once the animation is over then both CSS classes will be
|
157
|
+
* removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end
|
158
|
+
* immediately resulting in a DOM element that is at its final state. This final state is when the DOM element
|
159
|
+
* has no CSS transition/animation classes applied to it.
|
160
|
+
*
|
161
|
+
* ### Structural transition animations
|
162
|
+
*
|
163
|
+
* Structural transitions (such as enter, leave and move) will always apply a `0s none` transition
|
164
|
+
* value to force the browser into rendering the styles defined in the setup (`.ng-enter`, `.ng-leave`
|
165
|
+
* or `.ng-move`) class. This means that any active transition animations operating on the element
|
166
|
+
* will be cut off to make way for the enter, leave or move animation.
|
167
|
+
*
|
168
|
+
* ### Class-based transition animations
|
169
|
+
*
|
170
|
+
* Class-based transitions refer to transition animations that are triggered when a CSS class is
|
171
|
+
* added to or removed from the element (via `$animate.addClass`, `$animate.removeClass`,
|
172
|
+
* `$animate.setClass`, or by directives such as `ngClass`, `ngModel` and `form`).
|
173
|
+
* They are different when compared to structural animations since they **do not cancel existing
|
174
|
+
* animations** nor do they **block successive transitions** from rendering on the same element.
|
175
|
+
* This distinction allows for **multiple class-based transitions** to be performed on the same element.
|
176
|
+
*
|
177
|
+
* In addition to ngAnimate supporting the default (natural) functionality of class-based transition
|
178
|
+
* animations, ngAnimate also decorates the element with starting and ending CSS classes to aid the
|
179
|
+
* developer in further styling the element throughout the transition animation. Earlier versions
|
180
|
+
* of ngAnimate may have caused natural CSS transitions to break and not render properly due to
|
181
|
+
* $animate temporarily blocking transitions using `0s none` in order to allow the setup CSS class
|
182
|
+
* (the `-add` or `-remove` class) to be applied without triggering an animation. However, as of
|
183
|
+
* **version 1.3**, this workaround has been removed with ngAnimate and all non-ngAnimate CSS
|
184
|
+
* class transitions are compatible with ngAnimate.
|
185
|
+
*
|
186
|
+
* There is, however, one special case when dealing with class-based transitions in ngAnimate.
|
187
|
+
* When rendering class-based transitions that make use of the setup and active CSS classes
|
188
|
+
* (e.g. `.fade-add` and `.fade-add-active` for when `.fade` is added) be sure to define
|
189
|
+
* the transition value **on the active CSS class** and not the setup class.
|
190
|
+
*
|
191
|
+
* ```css
|
192
|
+
* .fade-add {
|
193
|
+
* /* remember to place a 0s transition here
|
194
|
+
* to ensure that the styles are applied instantly
|
195
|
+
* even if the element already has a transition style */
|
196
|
+
* transition:0s linear all;
|
197
|
+
*
|
198
|
+
* /* starting CSS styles */
|
199
|
+
* opacity:1;
|
200
|
+
* }
|
201
|
+
* .fade-add.fade-add-active {
|
202
|
+
* /* this will be the length of the animation */
|
203
|
+
* transition:1s linear all;
|
204
|
+
* opacity:0;
|
205
|
+
* }
|
206
|
+
* ```
|
207
|
+
*
|
208
|
+
* The setup CSS class (in this case `.fade-add`) also has a transition style property, however, it
|
209
|
+
* has a duration of zero. This may not be required, however, incase the browser is unable to render
|
210
|
+
* the styling present in this CSS class instantly then it could be that the browser is attempting
|
211
|
+
* to perform an unnecessary transition.
|
212
|
+
*
|
213
|
+
* This workaround, however, does not apply to standard class-based transitions that are rendered
|
214
|
+
* when a CSS class containing a transition is applied to an element:
|
215
|
+
*
|
216
|
+
* ```css
|
217
|
+
* /* this works as expected */
|
218
|
+
* .fade {
|
219
|
+
* transition:1s linear all;
|
220
|
+
* opacity:0;
|
221
|
+
* }
|
222
|
+
* ```
|
223
|
+
*
|
224
|
+
* Please keep this in mind when coding the CSS markup that will be used within class-based transitions.
|
225
|
+
* Also, try not to mix the two class-based animation flavors together since the CSS code may become
|
226
|
+
* overly complex.
|
227
|
+
*
|
228
|
+
*
|
229
|
+
* ### Preventing Collisions With Third Party Libraries
|
230
|
+
*
|
231
|
+
* Some third-party frameworks place animation duration defaults across many element or className
|
232
|
+
* selectors in order to make their code small and reuseable. This can lead to issues with ngAnimate, which
|
233
|
+
* is expecting actual animations on these elements and has to wait for their completion.
|
234
|
+
*
|
235
|
+
* You can prevent this unwanted behavior by using a prefix on all your animation classes:
|
236
|
+
*
|
237
|
+
* ```css
|
238
|
+
* /* prefixed with animate- */
|
239
|
+
* .animate-fade-add.animate-fade-add-active {
|
240
|
+
* transition:1s linear all;
|
241
|
+
* opacity:0;
|
242
|
+
* }
|
243
|
+
* ```
|
244
|
+
*
|
245
|
+
* You then configure `$animate` to enforce this prefix:
|
246
|
+
*
|
247
|
+
* ```js
|
248
|
+
* $animateProvider.classNameFilter(/animate-/);
|
249
|
+
* ```
|
250
|
+
* </div>
|
251
|
+
*
|
252
|
+
* ### CSS Staggering Animations
|
253
|
+
* A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a
|
254
|
+
* curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be
|
255
|
+
* performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for
|
256
|
+
* the animation. The style property expected within the stagger class can either be a **transition-delay** or an
|
257
|
+
* **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
|
258
|
+
*
|
259
|
+
* ```css
|
260
|
+
* .my-animation.ng-enter {
|
261
|
+
* /* standard transition code */
|
262
|
+
* -webkit-transition: 1s linear all;
|
263
|
+
* transition: 1s linear all;
|
264
|
+
* opacity:0;
|
265
|
+
* }
|
266
|
+
* .my-animation.ng-enter-stagger {
|
267
|
+
* /* this will have a 100ms delay between each successive leave animation */
|
268
|
+
* -webkit-transition-delay: 0.1s;
|
269
|
+
* transition-delay: 0.1s;
|
270
|
+
*
|
271
|
+
* /* in case the stagger doesn't work then these two values
|
272
|
+
* must be set to 0 to avoid an accidental CSS inheritance */
|
273
|
+
* -webkit-transition-duration: 0s;
|
274
|
+
* transition-duration: 0s;
|
275
|
+
* }
|
276
|
+
* .my-animation.ng-enter.ng-enter-active {
|
277
|
+
* /* standard transition styles */
|
278
|
+
* opacity:1;
|
279
|
+
* }
|
280
|
+
* ```
|
281
|
+
*
|
282
|
+
* Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations
|
283
|
+
* on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
|
284
|
+
* are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation
|
285
|
+
* will also be reset if more than 10ms has passed after the last animation has been fired.
|
286
|
+
*
|
287
|
+
* The following code will issue the **ng-leave-stagger** event on the element provided:
|
288
|
+
*
|
289
|
+
* ```js
|
290
|
+
* var kids = parent.children();
|
291
|
+
*
|
292
|
+
* $animate.leave(kids[0]); //stagger index=0
|
293
|
+
* $animate.leave(kids[1]); //stagger index=1
|
294
|
+
* $animate.leave(kids[2]); //stagger index=2
|
295
|
+
* $animate.leave(kids[3]); //stagger index=3
|
296
|
+
* $animate.leave(kids[4]); //stagger index=4
|
297
|
+
*
|
298
|
+
* $timeout(function() {
|
299
|
+
* //stagger has reset itself
|
300
|
+
* $animate.leave(kids[5]); //stagger index=0
|
301
|
+
* $animate.leave(kids[6]); //stagger index=1
|
302
|
+
* }, 100, false);
|
303
|
+
* ```
|
304
|
+
*
|
305
|
+
* Stagger animations are currently only supported within CSS-defined animations.
|
306
|
+
*
|
307
|
+
* ## JavaScript-defined Animations
|
308
|
+
* In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations on browsers that do not
|
309
|
+
* yet support CSS transitions/animations, then you can make use of JavaScript animations defined inside of your AngularJS module.
|
310
|
+
*
|
311
|
+
* ```js
|
312
|
+
* //!annotate="YourApp" Your AngularJS Module|Replace this or ngModule with the module that you used to define your application.
|
313
|
+
* var ngModule = angular.module('YourApp', ['ngAnimate']);
|
314
|
+
* ngModule.animation('.my-crazy-animation', function() {
|
315
|
+
* return {
|
316
|
+
* enter: function(element, done) {
|
317
|
+
* //run the animation here and call done when the animation is complete
|
318
|
+
* return function(cancelled) {
|
319
|
+
* //this (optional) function will be called when the animation
|
320
|
+
* //completes or when the animation is cancelled (the cancelled
|
321
|
+
* //flag will be set to true if cancelled).
|
322
|
+
* };
|
323
|
+
* },
|
324
|
+
* leave: function(element, done) { },
|
325
|
+
* move: function(element, done) { },
|
326
|
+
*
|
327
|
+
* //animation that can be triggered before the class is added
|
328
|
+
* beforeAddClass: function(element, className, done) { },
|
329
|
+
*
|
330
|
+
* //animation that can be triggered after the class is added
|
331
|
+
* addClass: function(element, className, done) { },
|
332
|
+
*
|
333
|
+
* //animation that can be triggered before the class is removed
|
334
|
+
* beforeRemoveClass: function(element, className, done) { },
|
335
|
+
*
|
336
|
+
* //animation that can be triggered after the class is removed
|
337
|
+
* removeClass: function(element, className, done) { }
|
338
|
+
* };
|
339
|
+
* });
|
340
|
+
* ```
|
341
|
+
*
|
342
|
+
* JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run
|
343
|
+
* a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits
|
344
|
+
* the element's CSS class attribute value and then run the matching animation event function (if found).
|
345
|
+
* In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function will
|
346
|
+
* be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported).
|
347
|
+
*
|
348
|
+
* Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.
|
349
|
+
* As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run,
|
350
|
+
* and the JavaScript animation is found, then the enter callback will handle that animation (in addition to the CSS keyframe animation
|
351
|
+
* or transition code that is defined via a stylesheet).
|
352
|
+
*
|
353
|
+
*
|
354
|
+
* ### Applying Directive-specific Styles to an Animation
|
355
|
+
* In some cases a directive or service may want to provide `$animate` with extra details that the animation will
|
356
|
+
* include into its animation. Let's say for example we wanted to render an animation that animates an element
|
357
|
+
* towards the mouse coordinates as to where the user clicked last. By collecting the X/Y coordinates of the click
|
358
|
+
* (via the event parameter) we can set the `top` and `left` styles into an object and pass that into our function
|
359
|
+
* call to `$animate.addClass`.
|
360
|
+
*
|
361
|
+
* ```js
|
362
|
+
* canvas.on('click', function(e) {
|
363
|
+
* $animate.addClass(element, 'on', {
|
364
|
+
* to: {
|
365
|
+
* left : e.client.x + 'px',
|
366
|
+
* top : e.client.y + 'px'
|
367
|
+
* }
|
368
|
+
* }):
|
369
|
+
* });
|
370
|
+
* ```
|
371
|
+
*
|
372
|
+
* Now when the animation runs, and a transition or keyframe animation is picked up, then the animation itself will
|
373
|
+
* also include and transition the styling of the `left` and `top` properties into its running animation. If we want
|
374
|
+
* to provide some starting animation values then we can do so by placing the starting animations styles into an object
|
375
|
+
* called `from` in the same object as the `to` animations.
|
376
|
+
*
|
377
|
+
* ```js
|
378
|
+
* canvas.on('click', function(e) {
|
379
|
+
* $animate.addClass(element, 'on', {
|
380
|
+
* from: {
|
381
|
+
* position: 'absolute',
|
382
|
+
* left: '0px',
|
383
|
+
* top: '0px'
|
384
|
+
* },
|
385
|
+
* to: {
|
386
|
+
* left : e.client.x + 'px',
|
387
|
+
* top : e.client.y + 'px'
|
388
|
+
* }
|
389
|
+
* }):
|
390
|
+
* });
|
391
|
+
* ```
|
392
|
+
*
|
393
|
+
* Once the animation is complete or cancelled then the union of both the before and after styles are applied to the
|
394
|
+
* element. If `ngAnimate` is not present then the styles will be applied immediately.
|
395
|
+
*
|
396
|
+
*/
|
397
|
+
|
398
|
+
angular.module('ngAnimate', ['ng'])
|
399
|
+
|
400
|
+
/**
|
401
|
+
* @ngdoc provider
|
402
|
+
* @name $animateProvider
|
403
|
+
* @description
|
404
|
+
*
|
405
|
+
* The `$animateProvider` allows developers to register JavaScript animation event handlers directly inside of a module.
|
406
|
+
* When an animation is triggered, the $animate service will query the $animate service to find any animations that match
|
407
|
+
* the provided name value.
|
408
|
+
*
|
409
|
+
* Requires the {@link ngAnimate `ngAnimate`} module to be installed.
|
410
|
+
*
|
411
|
+
* Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.
|
412
|
+
*
|
413
|
+
*/
|
414
|
+
.directive('ngAnimateChildren', function() {
|
415
|
+
var NG_ANIMATE_CHILDREN = '$$ngAnimateChildren';
|
416
|
+
return function(scope, element, attrs) {
|
417
|
+
var val = attrs.ngAnimateChildren;
|
418
|
+
if (angular.isString(val) && val.length === 0) { //empty attribute
|
419
|
+
element.data(NG_ANIMATE_CHILDREN, true);
|
420
|
+
} else {
|
421
|
+
scope.$watch(val, function(value) {
|
422
|
+
element.data(NG_ANIMATE_CHILDREN, !!value);
|
423
|
+
});
|
424
|
+
}
|
425
|
+
};
|
426
|
+
})
|
427
|
+
|
428
|
+
//this private service is only used within CSS-enabled animations
|
429
|
+
//IE8 + IE9 do not support rAF natively, but that is fine since they
|
430
|
+
//also don't support transitions and keyframes which means that the code
|
431
|
+
//below will never be used by the two browsers.
|
432
|
+
.factory('$$animateReflow', ['$$rAF', '$document', function($$rAF, $document) {
|
433
|
+
var bod = $document[0].body;
|
434
|
+
return function(fn) {
|
435
|
+
//the returned function acts as the cancellation function
|
436
|
+
return $$rAF(function() {
|
437
|
+
//the line below will force the browser to perform a repaint
|
438
|
+
//so that all the animated elements within the animation frame
|
439
|
+
//will be properly updated and drawn on screen. This is
|
440
|
+
//required to perform multi-class CSS based animations with
|
441
|
+
//Firefox. DO NOT REMOVE THIS LINE.
|
442
|
+
var a = bod.offsetWidth + 1;
|
443
|
+
fn();
|
444
|
+
});
|
445
|
+
};
|
446
|
+
}])
|
447
|
+
|
448
|
+
.config(['$provide', '$animateProvider', function($provide, $animateProvider) {
|
449
|
+
var noop = angular.noop;
|
450
|
+
var forEach = angular.forEach;
|
451
|
+
var selectors = $animateProvider.$$selectors;
|
452
|
+
var isArray = angular.isArray;
|
453
|
+
var isString = angular.isString;
|
454
|
+
var isObject = angular.isObject;
|
455
|
+
|
456
|
+
var ELEMENT_NODE = 1;
|
457
|
+
var NG_ANIMATE_STATE = '$$ngAnimateState';
|
458
|
+
var NG_ANIMATE_CHILDREN = '$$ngAnimateChildren';
|
459
|
+
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
|
460
|
+
var rootAnimateState = {running: true};
|
461
|
+
|
462
|
+
function extractElementNode(element) {
|
463
|
+
for (var i = 0; i < element.length; i++) {
|
464
|
+
var elm = element[i];
|
465
|
+
if (elm.nodeType == ELEMENT_NODE) {
|
466
|
+
return elm;
|
467
|
+
}
|
468
|
+
}
|
469
|
+
}
|
470
|
+
|
471
|
+
function prepareElement(element) {
|
472
|
+
return element && angular.element(element);
|
473
|
+
}
|
474
|
+
|
475
|
+
function stripCommentsFromElement(element) {
|
476
|
+
return angular.element(extractElementNode(element));
|
477
|
+
}
|
478
|
+
|
479
|
+
function isMatchingElement(elm1, elm2) {
|
480
|
+
return extractElementNode(elm1) == extractElementNode(elm2);
|
481
|
+
}
|
482
|
+
var $$jqLite;
|
483
|
+
$provide.decorator('$animate',
|
484
|
+
['$delegate', '$$q', '$injector', '$sniffer', '$rootElement', '$$asyncCallback', '$rootScope', '$document', '$templateRequest', '$$jqLite',
|
485
|
+
function($delegate, $$q, $injector, $sniffer, $rootElement, $$asyncCallback, $rootScope, $document, $templateRequest, $$$jqLite) {
|
486
|
+
|
487
|
+
$$jqLite = $$$jqLite;
|
488
|
+
$rootElement.data(NG_ANIMATE_STATE, rootAnimateState);
|
489
|
+
|
490
|
+
// Wait until all directive and route-related templates are downloaded and
|
491
|
+
// compiled. The $templateRequest.totalPendingRequests variable keeps track of
|
492
|
+
// all of the remote templates being currently downloaded. If there are no
|
493
|
+
// templates currently downloading then the watcher will still fire anyway.
|
494
|
+
var deregisterWatch = $rootScope.$watch(
|
495
|
+
function() { return $templateRequest.totalPendingRequests; },
|
496
|
+
function(val, oldVal) {
|
497
|
+
if (val !== 0) return;
|
498
|
+
deregisterWatch();
|
499
|
+
|
500
|
+
// Now that all templates have been downloaded, $animate will wait until
|
501
|
+
// the post digest queue is empty before enabling animations. By having two
|
502
|
+
// calls to $postDigest calls we can ensure that the flag is enabled at the
|
503
|
+
// very end of the post digest queue. Since all of the animations in $animate
|
504
|
+
// use $postDigest, it's important that the code below executes at the end.
|
505
|
+
// This basically means that the page is fully downloaded and compiled before
|
506
|
+
// any animations are triggered.
|
507
|
+
$rootScope.$$postDigest(function() {
|
508
|
+
$rootScope.$$postDigest(function() {
|
509
|
+
rootAnimateState.running = false;
|
510
|
+
});
|
511
|
+
});
|
512
|
+
}
|
513
|
+
);
|
514
|
+
|
515
|
+
var globalAnimationCounter = 0;
|
516
|
+
var classNameFilter = $animateProvider.classNameFilter();
|
517
|
+
var isAnimatableClassName = !classNameFilter
|
518
|
+
? function() { return true; }
|
519
|
+
: function(className) {
|
520
|
+
return classNameFilter.test(className);
|
521
|
+
};
|
522
|
+
|
523
|
+
function classBasedAnimationsBlocked(element, setter) {
|
524
|
+
var data = element.data(NG_ANIMATE_STATE) || {};
|
525
|
+
if (setter) {
|
526
|
+
data.running = true;
|
527
|
+
data.structural = true;
|
528
|
+
element.data(NG_ANIMATE_STATE, data);
|
529
|
+
}
|
530
|
+
return data.disabled || (data.running && data.structural);
|
531
|
+
}
|
532
|
+
|
533
|
+
function runAnimationPostDigest(fn) {
|
534
|
+
var cancelFn, defer = $$q.defer();
|
535
|
+
defer.promise.$$cancelFn = function() {
|
536
|
+
cancelFn && cancelFn();
|
537
|
+
};
|
538
|
+
$rootScope.$$postDigest(function() {
|
539
|
+
cancelFn = fn(function() {
|
540
|
+
defer.resolve();
|
541
|
+
});
|
542
|
+
});
|
543
|
+
return defer.promise;
|
544
|
+
}
|
545
|
+
|
546
|
+
function parseAnimateOptions(options) {
|
547
|
+
// some plugin code may still be passing in the callback
|
548
|
+
// function as the last param for the $animate methods so
|
549
|
+
// it's best to only allow string or array values for now
|
550
|
+
if (isObject(options)) {
|
551
|
+
if (options.tempClasses && isString(options.tempClasses)) {
|
552
|
+
options.tempClasses = options.tempClasses.split(/\s+/);
|
553
|
+
}
|
554
|
+
return options;
|
555
|
+
}
|
556
|
+
}
|
557
|
+
|
558
|
+
function resolveElementClasses(element, cache, runningAnimations) {
|
559
|
+
runningAnimations = runningAnimations || {};
|
560
|
+
|
561
|
+
var lookup = {};
|
562
|
+
forEach(runningAnimations, function(data, selector) {
|
563
|
+
forEach(selector.split(' '), function(s) {
|
564
|
+
lookup[s]=data;
|
565
|
+
});
|
566
|
+
});
|
567
|
+
|
568
|
+
var hasClasses = Object.create(null);
|
569
|
+
forEach((element.attr('class') || '').split(/\s+/), function(className) {
|
570
|
+
hasClasses[className] = true;
|
571
|
+
});
|
572
|
+
|
573
|
+
var toAdd = [], toRemove = [];
|
574
|
+
forEach((cache && cache.classes) || [], function(status, className) {
|
575
|
+
var hasClass = hasClasses[className];
|
576
|
+
var matchingAnimation = lookup[className] || {};
|
577
|
+
|
578
|
+
// When addClass and removeClass is called then $animate will check to
|
579
|
+
// see if addClass and removeClass cancel each other out. When there are
|
580
|
+
// more calls to removeClass than addClass then the count falls below 0
|
581
|
+
// and then the removeClass animation will be allowed. Otherwise if the
|
582
|
+
// count is above 0 then that means an addClass animation will commence.
|
583
|
+
// Once an animation is allowed then the code will also check to see if
|
584
|
+
// there exists any on-going animation that is already adding or remvoing
|
585
|
+
// the matching CSS class.
|
586
|
+
if (status === false) {
|
587
|
+
//does it have the class or will it have the class
|
588
|
+
if (hasClass || matchingAnimation.event == 'addClass') {
|
589
|
+
toRemove.push(className);
|
590
|
+
}
|
591
|
+
} else if (status === true) {
|
592
|
+
//is the class missing or will it be removed?
|
593
|
+
if (!hasClass || matchingAnimation.event == 'removeClass') {
|
594
|
+
toAdd.push(className);
|
595
|
+
}
|
596
|
+
}
|
597
|
+
});
|
598
|
+
|
599
|
+
return (toAdd.length + toRemove.length) > 0 && [toAdd.join(' '), toRemove.join(' ')];
|
600
|
+
}
|
601
|
+
|
602
|
+
function lookup(name) {
|
603
|
+
if (name) {
|
604
|
+
var matches = [],
|
605
|
+
flagMap = {},
|
606
|
+
classes = name.substr(1).split('.');
|
607
|
+
|
608
|
+
//the empty string value is the default animation
|
609
|
+
//operation which performs CSS transition and keyframe
|
610
|
+
//animations sniffing. This is always included for each
|
611
|
+
//element animation procedure if the browser supports
|
612
|
+
//transitions and/or keyframe animations. The default
|
613
|
+
//animation is added to the top of the list to prevent
|
614
|
+
//any previous animations from affecting the element styling
|
615
|
+
//prior to the element being animated.
|
616
|
+
if ($sniffer.transitions || $sniffer.animations) {
|
617
|
+
matches.push($injector.get(selectors['']));
|
618
|
+
}
|
619
|
+
|
620
|
+
for (var i=0; i < classes.length; i++) {
|
621
|
+
var klass = classes[i],
|
622
|
+
selectorFactoryName = selectors[klass];
|
623
|
+
if (selectorFactoryName && !flagMap[klass]) {
|
624
|
+
matches.push($injector.get(selectorFactoryName));
|
625
|
+
flagMap[klass] = true;
|
626
|
+
}
|
627
|
+
}
|
628
|
+
return matches;
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
function animationRunner(element, animationEvent, className, options) {
|
633
|
+
//transcluded directives may sometimes fire an animation using only comment nodes
|
634
|
+
//best to catch this early on to prevent any animation operations from occurring
|
635
|
+
var node = element[0];
|
636
|
+
if (!node) {
|
637
|
+
return;
|
638
|
+
}
|
639
|
+
|
640
|
+
if (options) {
|
641
|
+
options.to = options.to || {};
|
642
|
+
options.from = options.from || {};
|
643
|
+
}
|
644
|
+
|
645
|
+
var classNameAdd;
|
646
|
+
var classNameRemove;
|
647
|
+
if (isArray(className)) {
|
648
|
+
classNameAdd = className[0];
|
649
|
+
classNameRemove = className[1];
|
650
|
+
if (!classNameAdd) {
|
651
|
+
className = classNameRemove;
|
652
|
+
animationEvent = 'removeClass';
|
653
|
+
} else if (!classNameRemove) {
|
654
|
+
className = classNameAdd;
|
655
|
+
animationEvent = 'addClass';
|
656
|
+
} else {
|
657
|
+
className = classNameAdd + ' ' + classNameRemove;
|
658
|
+
}
|
659
|
+
}
|
660
|
+
|
661
|
+
var isSetClassOperation = animationEvent == 'setClass';
|
662
|
+
var isClassBased = isSetClassOperation
|
663
|
+
|| animationEvent == 'addClass'
|
664
|
+
|| animationEvent == 'removeClass'
|
665
|
+
|| animationEvent == 'animate';
|
666
|
+
|
667
|
+
var currentClassName = element.attr('class');
|
668
|
+
var classes = currentClassName + ' ' + className;
|
669
|
+
if (!isAnimatableClassName(classes)) {
|
670
|
+
return;
|
671
|
+
}
|
672
|
+
|
673
|
+
var beforeComplete = noop,
|
674
|
+
beforeCancel = [],
|
675
|
+
before = [],
|
676
|
+
afterComplete = noop,
|
677
|
+
afterCancel = [],
|
678
|
+
after = [];
|
679
|
+
|
680
|
+
var animationLookup = (' ' + classes).replace(/\s+/g,'.');
|
681
|
+
forEach(lookup(animationLookup), function(animationFactory) {
|
682
|
+
var created = registerAnimation(animationFactory, animationEvent);
|
683
|
+
if (!created && isSetClassOperation) {
|
684
|
+
registerAnimation(animationFactory, 'addClass');
|
685
|
+
registerAnimation(animationFactory, 'removeClass');
|
686
|
+
}
|
687
|
+
});
|
688
|
+
|
689
|
+
function registerAnimation(animationFactory, event) {
|
690
|
+
var afterFn = animationFactory[event];
|
691
|
+
var beforeFn = animationFactory['before' + event.charAt(0).toUpperCase() + event.substr(1)];
|
692
|
+
if (afterFn || beforeFn) {
|
693
|
+
if (event == 'leave') {
|
694
|
+
beforeFn = afterFn;
|
695
|
+
//when set as null then animation knows to skip this phase
|
696
|
+
afterFn = null;
|
697
|
+
}
|
698
|
+
after.push({
|
699
|
+
event: event, fn: afterFn
|
700
|
+
});
|
701
|
+
before.push({
|
702
|
+
event: event, fn: beforeFn
|
703
|
+
});
|
704
|
+
return true;
|
705
|
+
}
|
706
|
+
}
|
707
|
+
|
708
|
+
function run(fns, cancellations, allCompleteFn) {
|
709
|
+
var animations = [];
|
710
|
+
forEach(fns, function(animation) {
|
711
|
+
animation.fn && animations.push(animation);
|
712
|
+
});
|
713
|
+
|
714
|
+
var count = 0;
|
715
|
+
function afterAnimationComplete(index) {
|
716
|
+
if (cancellations) {
|
717
|
+
(cancellations[index] || noop)();
|
718
|
+
if (++count < animations.length) return;
|
719
|
+
cancellations = null;
|
720
|
+
}
|
721
|
+
allCompleteFn();
|
722
|
+
}
|
723
|
+
|
724
|
+
//The code below adds directly to the array in order to work with
|
725
|
+
//both sync and async animations. Sync animations are when the done()
|
726
|
+
//operation is called right away. DO NOT REFACTOR!
|
727
|
+
forEach(animations, function(animation, index) {
|
728
|
+
var progress = function() {
|
729
|
+
afterAnimationComplete(index);
|
730
|
+
};
|
731
|
+
switch (animation.event) {
|
732
|
+
case 'setClass':
|
733
|
+
cancellations.push(animation.fn(element, classNameAdd, classNameRemove, progress, options));
|
734
|
+
break;
|
735
|
+
case 'animate':
|
736
|
+
cancellations.push(animation.fn(element, className, options.from, options.to, progress));
|
737
|
+
break;
|
738
|
+
case 'addClass':
|
739
|
+
cancellations.push(animation.fn(element, classNameAdd || className, progress, options));
|
740
|
+
break;
|
741
|
+
case 'removeClass':
|
742
|
+
cancellations.push(animation.fn(element, classNameRemove || className, progress, options));
|
743
|
+
break;
|
744
|
+
default:
|
745
|
+
cancellations.push(animation.fn(element, progress, options));
|
746
|
+
break;
|
747
|
+
}
|
748
|
+
});
|
749
|
+
|
750
|
+
if (cancellations && cancellations.length === 0) {
|
751
|
+
allCompleteFn();
|
752
|
+
}
|
753
|
+
}
|
754
|
+
|
755
|
+
return {
|
756
|
+
node: node,
|
757
|
+
event: animationEvent,
|
758
|
+
className: className,
|
759
|
+
isClassBased: isClassBased,
|
760
|
+
isSetClassOperation: isSetClassOperation,
|
761
|
+
applyStyles: function() {
|
762
|
+
if (options) {
|
763
|
+
element.css(angular.extend(options.from || {}, options.to || {}));
|
764
|
+
}
|
765
|
+
},
|
766
|
+
before: function(allCompleteFn) {
|
767
|
+
beforeComplete = allCompleteFn;
|
768
|
+
run(before, beforeCancel, function() {
|
769
|
+
beforeComplete = noop;
|
770
|
+
allCompleteFn();
|
771
|
+
});
|
772
|
+
},
|
773
|
+
after: function(allCompleteFn) {
|
774
|
+
afterComplete = allCompleteFn;
|
775
|
+
run(after, afterCancel, function() {
|
776
|
+
afterComplete = noop;
|
777
|
+
allCompleteFn();
|
778
|
+
});
|
779
|
+
},
|
780
|
+
cancel: function() {
|
781
|
+
if (beforeCancel) {
|
782
|
+
forEach(beforeCancel, function(cancelFn) {
|
783
|
+
(cancelFn || noop)(true);
|
784
|
+
});
|
785
|
+
beforeComplete(true);
|
786
|
+
}
|
787
|
+
if (afterCancel) {
|
788
|
+
forEach(afterCancel, function(cancelFn) {
|
789
|
+
(cancelFn || noop)(true);
|
790
|
+
});
|
791
|
+
afterComplete(true);
|
792
|
+
}
|
793
|
+
}
|
794
|
+
};
|
795
|
+
}
|
796
|
+
|
797
|
+
/**
|
798
|
+
* @ngdoc service
|
799
|
+
* @name $animate
|
800
|
+
* @kind object
|
801
|
+
*
|
802
|
+
* @description
|
803
|
+
* The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move) as well as during addClass and removeClass operations.
|
804
|
+
* When any of these operations are run, the $animate service
|
805
|
+
* will examine any JavaScript-defined animations (which are defined by using the $animateProvider provider object)
|
806
|
+
* as well as any CSS-defined animations against the CSS classes present on the element once the DOM operation is run.
|
807
|
+
*
|
808
|
+
* The `$animate` service is used behind the scenes with pre-existing directives and animation with these directives
|
809
|
+
* will work out of the box without any extra configuration.
|
810
|
+
*
|
811
|
+
* Requires the {@link ngAnimate `ngAnimate`} module to be installed.
|
812
|
+
*
|
813
|
+
* Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.
|
814
|
+
* ## Callback Promises
|
815
|
+
* With AngularJS 1.3, each of the animation methods, on the `$animate` service, return a promise when called. The
|
816
|
+
* promise itself is then resolved once the animation has completed itself, has been cancelled or has been
|
817
|
+
* skipped due to animations being disabled. (Note that even if the animation is cancelled it will still
|
818
|
+
* call the resolve function of the animation.)
|
819
|
+
*
|
820
|
+
* ```js
|
821
|
+
* $animate.enter(element, container).then(function() {
|
822
|
+
* //...this is called once the animation is complete...
|
823
|
+
* });
|
824
|
+
* ```
|
825
|
+
*
|
826
|
+
* Also note that, due to the nature of the callback promise, if any Angular-specific code (like changing the scope,
|
827
|
+
* location of the page, etc...) is executed within the callback promise then be sure to wrap the code using
|
828
|
+
* `$scope.$apply(...)`;
|
829
|
+
*
|
830
|
+
* ```js
|
831
|
+
* $animate.leave(element).then(function() {
|
832
|
+
* $scope.$apply(function() {
|
833
|
+
* $location.path('/new-page');
|
834
|
+
* });
|
835
|
+
* });
|
836
|
+
* ```
|
837
|
+
*
|
838
|
+
* An animation can also be cancelled by calling the `$animate.cancel(promise)` method with the provided
|
839
|
+
* promise that was returned when the animation was started.
|
840
|
+
*
|
841
|
+
* ```js
|
842
|
+
* var promise = $animate.addClass(element, 'super-long-animation');
|
843
|
+
* promise.then(function() {
|
844
|
+
* //this will still be called even if cancelled
|
845
|
+
* });
|
846
|
+
*
|
847
|
+
* element.on('click', function() {
|
848
|
+
* //tooo lazy to wait for the animation to end
|
849
|
+
* $animate.cancel(promise);
|
850
|
+
* });
|
851
|
+
* ```
|
852
|
+
*
|
853
|
+
* (Keep in mind that the promise cancellation is unique to `$animate` since promises in
|
854
|
+
* general cannot be cancelled.)
|
855
|
+
*
|
856
|
+
*/
|
857
|
+
return {
|
858
|
+
/**
|
859
|
+
* @ngdoc method
|
860
|
+
* @name $animate#animate
|
861
|
+
* @kind function
|
862
|
+
*
|
863
|
+
* @description
|
864
|
+
* Performs an inline animation on the element which applies the provided `to` and `from` CSS styles to the element.
|
865
|
+
* If any detected CSS transition, keyframe or JavaScript matches the provided `className` value then the animation
|
866
|
+
* will take on the provided styles. For example, if a transition animation is set for the given className then the
|
867
|
+
* provided `from` and `to` styles will be applied alongside the given transition. If a JavaScript animation is
|
868
|
+
* detected then the provided styles will be given in as function paramters.
|
869
|
+
*
|
870
|
+
* ```js
|
871
|
+
* ngModule.animation('.my-inline-animation', function() {
|
872
|
+
* return {
|
873
|
+
* animate : function(element, className, from, to, done) {
|
874
|
+
* //styles
|
875
|
+
* }
|
876
|
+
* }
|
877
|
+
* });
|
878
|
+
* ```
|
879
|
+
*
|
880
|
+
* Below is a breakdown of each step that occurs during the `animate` animation:
|
881
|
+
*
|
882
|
+
* | Animation Step | What the element class attribute looks like |
|
883
|
+
* |-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
884
|
+
* | 1. `$animate.animate(...)` is called | `class="my-animation"` |
|
885
|
+
* | 2. `$animate` waits for the next digest to start the animation | `class="my-animation ng-animate"` |
|
886
|
+
* | 3. `$animate` runs the JavaScript-defined animations detected on the element | `class="my-animation ng-animate"` |
|
887
|
+
* | 4. the `className` class value is added to the element | `class="my-animation ng-animate className"` |
|
888
|
+
* | 5. `$animate` scans the element styles to get the CSS transition/animation duration and delay | `class="my-animation ng-animate className"` |
|
889
|
+
* | 6. `$animate` blocks all CSS transitions on the element to ensure the `.className` class styling is applied right away| `class="my-animation ng-animate className"` |
|
890
|
+
* | 7. `$animate` applies the provided collection of `from` CSS styles to the element | `class="my-animation ng-animate className"` |
|
891
|
+
* | 8. `$animate` waits for a single animation frame (this performs a reflow) | `class="my-animation ng-animate className"` |
|
892
|
+
* | 9. `$animate` removes the CSS transition block placed on the element | `class="my-animation ng-animate className"` |
|
893
|
+
* | 10. the `className-active` class is added (this triggers the CSS transition/animation) | `class="my-animation ng-animate className className-active"` |
|
894
|
+
* | 11. `$animate` applies the collection of `to` CSS styles to the element which are then handled by the transition | `class="my-animation ng-animate className className-active"` |
|
895
|
+
* | 12. `$animate` waits for the animation to complete (via events and timeout) | `class="my-animation ng-animate className className-active"` |
|
896
|
+
* | 13. The animation ends and all generated CSS classes are removed from the element | `class="my-animation"` |
|
897
|
+
* | 14. The returned promise is resolved. | `class="my-animation"` |
|
898
|
+
*
|
899
|
+
* @param {DOMElement} element the element that will be the focus of the enter animation
|
900
|
+
* @param {object} from a collection of CSS styles that will be applied to the element at the start of the animation
|
901
|
+
* @param {object} to a collection of CSS styles that the element will animate towards
|
902
|
+
* @param {string=} className an optional CSS class that will be added to the element for the duration of the animation (the default class is `ng-inline-animate`)
|
903
|
+
* @param {object=} options an optional collection of options that will be picked up by the CSS transition/animation
|
904
|
+
* @return {Promise} the animation callback promise
|
905
|
+
*/
|
906
|
+
animate: function(element, from, to, className, options) {
|
907
|
+
className = className || 'ng-inline-animate';
|
908
|
+
options = parseAnimateOptions(options) || {};
|
909
|
+
options.from = to ? from : null;
|
910
|
+
options.to = to ? to : from;
|
911
|
+
|
912
|
+
return runAnimationPostDigest(function(done) {
|
913
|
+
return performAnimation('animate', className, stripCommentsFromElement(element), null, null, noop, options, done);
|
914
|
+
});
|
915
|
+
},
|
916
|
+
|
917
|
+
/**
|
918
|
+
* @ngdoc method
|
919
|
+
* @name $animate#enter
|
920
|
+
* @kind function
|
921
|
+
*
|
922
|
+
* @description
|
923
|
+
* Appends the element to the parentElement element that resides in the document and then runs the enter animation. Once
|
924
|
+
* the animation is started, the following CSS classes will be present on the element for the duration of the animation:
|
925
|
+
*
|
926
|
+
* Below is a breakdown of each step that occurs during enter animation:
|
927
|
+
*
|
928
|
+
* | Animation Step | What the element class attribute looks like |
|
929
|
+
* |-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
|
930
|
+
* | 1. `$animate.enter(...)` is called | `class="my-animation"` |
|
931
|
+
* | 2. element is inserted into the `parentElement` element or beside the `afterElement` element | `class="my-animation"` |
|
932
|
+
* | 3. `$animate` waits for the next digest to start the animation | `class="my-animation ng-animate"` |
|
933
|
+
* | 4. `$animate` runs the JavaScript-defined animations detected on the element | `class="my-animation ng-animate"` |
|
934
|
+
* | 5. the `.ng-enter` class is added to the element | `class="my-animation ng-animate ng-enter"` |
|
935
|
+
* | 6. `$animate` scans the element styles to get the CSS transition/animation duration and delay | `class="my-animation ng-animate ng-enter"` |
|
936
|
+
* | 7. `$animate` blocks all CSS transitions on the element to ensure the `.ng-enter` class styling is applied right away | `class="my-animation ng-animate ng-enter"` |
|
937
|
+
* | 8. `$animate` waits for a single animation frame (this performs a reflow) | `class="my-animation ng-animate ng-enter"` |
|
938
|
+
* | 9. `$animate` removes the CSS transition block placed on the element | `class="my-animation ng-animate ng-enter"` |
|
939
|
+
* | 10. the `.ng-enter-active` class is added (this triggers the CSS transition/animation) | `class="my-animation ng-animate ng-enter ng-enter-active"` |
|
940
|
+
* | 11. `$animate` waits for the animation to complete (via events and timeout) | `class="my-animation ng-animate ng-enter ng-enter-active"` |
|
941
|
+
* | 12. The animation ends and all generated CSS classes are removed from the element | `class="my-animation"` |
|
942
|
+
* | 13. The returned promise is resolved. | `class="my-animation"` |
|
943
|
+
*
|
944
|
+
* @param {DOMElement} element the element that will be the focus of the enter animation
|
945
|
+
* @param {DOMElement} parentElement the parent element of the element that will be the focus of the enter animation
|
946
|
+
* @param {DOMElement} afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
|
947
|
+
* @param {object=} options an optional collection of options that will be picked up by the CSS transition/animation
|
948
|
+
* @return {Promise} the animation callback promise
|
949
|
+
*/
|
950
|
+
enter: function(element, parentElement, afterElement, options) {
|
951
|
+
options = parseAnimateOptions(options);
|
952
|
+
element = angular.element(element);
|
953
|
+
parentElement = prepareElement(parentElement);
|
954
|
+
afterElement = prepareElement(afterElement);
|
955
|
+
|
956
|
+
classBasedAnimationsBlocked(element, true);
|
957
|
+
$delegate.enter(element, parentElement, afterElement);
|
958
|
+
return runAnimationPostDigest(function(done) {
|
959
|
+
return performAnimation('enter', 'ng-enter', stripCommentsFromElement(element), parentElement, afterElement, noop, options, done);
|
960
|
+
});
|
961
|
+
},
|
962
|
+
|
963
|
+
/**
|
964
|
+
* @ngdoc method
|
965
|
+
* @name $animate#leave
|
966
|
+
* @kind function
|
967
|
+
*
|
968
|
+
* @description
|
969
|
+
* Runs the leave animation operation and, upon completion, removes the element from the DOM. Once
|
970
|
+
* the animation is started, the following CSS classes will be added for the duration of the animation:
|
971
|
+
*
|
972
|
+
* Below is a breakdown of each step that occurs during leave animation:
|
973
|
+
*
|
974
|
+
* | Animation Step | What the element class attribute looks like |
|
975
|
+
* |-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
|
976
|
+
* | 1. `$animate.leave(...)` is called | `class="my-animation"` |
|
977
|
+
* | 2. `$animate` runs the JavaScript-defined animations detected on the element | `class="my-animation ng-animate"` |
|
978
|
+
* | 3. `$animate` waits for the next digest to start the animation | `class="my-animation ng-animate"` |
|
979
|
+
* | 4. the `.ng-leave` class is added to the element | `class="my-animation ng-animate ng-leave"` |
|
980
|
+
* | 5. `$animate` scans the element styles to get the CSS transition/animation duration and delay | `class="my-animation ng-animate ng-leave"` |
|
981
|
+
* | 6. `$animate` blocks all CSS transitions on the element to ensure the `.ng-leave` class styling is applied right away | `class="my-animation ng-animate ng-leave"` |
|
982
|
+
* | 7. `$animate` waits for a single animation frame (this performs a reflow) | `class="my-animation ng-animate ng-leave"` |
|
983
|
+
* | 8. `$animate` removes the CSS transition block placed on the element | `class="my-animation ng-animate ng-leave"` |
|
984
|
+
* | 9. the `.ng-leave-active` class is added (this triggers the CSS transition/animation) | `class="my-animation ng-animate ng-leave ng-leave-active"` |
|
985
|
+
* | 10. `$animate` waits for the animation to complete (via events and timeout) | `class="my-animation ng-animate ng-leave ng-leave-active"` |
|
986
|
+
* | 11. The animation ends and all generated CSS classes are removed from the element | `class="my-animation"` |
|
987
|
+
* | 12. The element is removed from the DOM | ... |
|
988
|
+
* | 13. The returned promise is resolved. | ... |
|
989
|
+
*
|
990
|
+
* @param {DOMElement} element the element that will be the focus of the leave animation
|
991
|
+
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
|
992
|
+
* @return {Promise} the animation callback promise
|
993
|
+
*/
|
994
|
+
leave: function(element, options) {
|
995
|
+
options = parseAnimateOptions(options);
|
996
|
+
element = angular.element(element);
|
997
|
+
|
998
|
+
cancelChildAnimations(element);
|
999
|
+
classBasedAnimationsBlocked(element, true);
|
1000
|
+
return runAnimationPostDigest(function(done) {
|
1001
|
+
return performAnimation('leave', 'ng-leave', stripCommentsFromElement(element), null, null, function() {
|
1002
|
+
$delegate.leave(element);
|
1003
|
+
}, options, done);
|
1004
|
+
});
|
1005
|
+
},
|
1006
|
+
|
1007
|
+
/**
|
1008
|
+
* @ngdoc method
|
1009
|
+
* @name $animate#move
|
1010
|
+
* @kind function
|
1011
|
+
*
|
1012
|
+
* @description
|
1013
|
+
* Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the parentElement container or
|
1014
|
+
* add the element directly after the afterElement element if present. Then the move animation will be run. Once
|
1015
|
+
* the animation is started, the following CSS classes will be added for the duration of the animation:
|
1016
|
+
*
|
1017
|
+
* Below is a breakdown of each step that occurs during move animation:
|
1018
|
+
*
|
1019
|
+
* | Animation Step | What the element class attribute looks like |
|
1020
|
+
* |----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
|
1021
|
+
* | 1. `$animate.move(...)` is called | `class="my-animation"` |
|
1022
|
+
* | 2. element is moved into the parentElement element or beside the afterElement element | `class="my-animation"` |
|
1023
|
+
* | 3. `$animate` waits for the next digest to start the animation | `class="my-animation ng-animate"` |
|
1024
|
+
* | 4. `$animate` runs the JavaScript-defined animations detected on the element | `class="my-animation ng-animate"` |
|
1025
|
+
* | 5. the `.ng-move` class is added to the element | `class="my-animation ng-animate ng-move"` |
|
1026
|
+
* | 6. `$animate` scans the element styles to get the CSS transition/animation duration and delay | `class="my-animation ng-animate ng-move"` |
|
1027
|
+
* | 7. `$animate` blocks all CSS transitions on the element to ensure the `.ng-move` class styling is applied right away | `class="my-animation ng-animate ng-move"` |
|
1028
|
+
* | 8. `$animate` waits for a single animation frame (this performs a reflow) | `class="my-animation ng-animate ng-move"` |
|
1029
|
+
* | 9. `$animate` removes the CSS transition block placed on the element | `class="my-animation ng-animate ng-move"` |
|
1030
|
+
* | 10. the `.ng-move-active` class is added (this triggers the CSS transition/animation) | `class="my-animation ng-animate ng-move ng-move-active"` |
|
1031
|
+
* | 11. `$animate` waits for the animation to complete (via events and timeout) | `class="my-animation ng-animate ng-move ng-move-active"` |
|
1032
|
+
* | 12. The animation ends and all generated CSS classes are removed from the element | `class="my-animation"` |
|
1033
|
+
* | 13. The returned promise is resolved. | `class="my-animation"` |
|
1034
|
+
*
|
1035
|
+
* @param {DOMElement} element the element that will be the focus of the move animation
|
1036
|
+
* @param {DOMElement} parentElement the parentElement element of the element that will be the focus of the move animation
|
1037
|
+
* @param {DOMElement} afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
|
1038
|
+
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
|
1039
|
+
* @return {Promise} the animation callback promise
|
1040
|
+
*/
|
1041
|
+
move: function(element, parentElement, afterElement, options) {
|
1042
|
+
options = parseAnimateOptions(options);
|
1043
|
+
element = angular.element(element);
|
1044
|
+
parentElement = prepareElement(parentElement);
|
1045
|
+
afterElement = prepareElement(afterElement);
|
1046
|
+
|
1047
|
+
cancelChildAnimations(element);
|
1048
|
+
classBasedAnimationsBlocked(element, true);
|
1049
|
+
$delegate.move(element, parentElement, afterElement);
|
1050
|
+
return runAnimationPostDigest(function(done) {
|
1051
|
+
return performAnimation('move', 'ng-move', stripCommentsFromElement(element), parentElement, afterElement, noop, options, done);
|
1052
|
+
});
|
1053
|
+
},
|
1054
|
+
|
1055
|
+
/**
|
1056
|
+
* @ngdoc method
|
1057
|
+
* @name $animate#addClass
|
1058
|
+
*
|
1059
|
+
* @description
|
1060
|
+
* Triggers a custom animation event based off the className variable and then attaches the className value to the element as a CSS class.
|
1061
|
+
* Unlike the other animation methods, the animate service will suffix the className value with {@type -add} in order to provide
|
1062
|
+
* the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if no CSS transitions
|
1063
|
+
* or keyframes are defined on the -add-active or base CSS class).
|
1064
|
+
*
|
1065
|
+
* Below is a breakdown of each step that occurs during addClass animation:
|
1066
|
+
*
|
1067
|
+
* | Animation Step | What the element class attribute looks like |
|
1068
|
+
* |--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
|
1069
|
+
* | 1. `$animate.addClass(element, 'super')` is called | `class="my-animation"` |
|
1070
|
+
* | 2. `$animate` runs the JavaScript-defined animations detected on the element | `class="my-animation ng-animate"` |
|
1071
|
+
* | 3. the `.super-add` class is added to the element | `class="my-animation ng-animate super-add"` |
|
1072
|
+
* | 4. `$animate` waits for a single animation frame (this performs a reflow) | `class="my-animation ng-animate super-add"` |
|
1073
|
+
* | 5. the `.super` and `.super-add-active` classes are added (this triggers the CSS transition/animation) | `class="my-animation ng-animate super super-add super-add-active"` |
|
1074
|
+
* | 6. `$animate` scans the element styles to get the CSS transition/animation duration and delay | `class="my-animation ng-animate super super-add super-add-active"` |
|
1075
|
+
* | 7. `$animate` waits for the animation to complete (via events and timeout) | `class="my-animation ng-animate super super-add super-add-active"` |
|
1076
|
+
* | 8. The animation ends and all generated CSS classes are removed from the element | `class="my-animation super"` |
|
1077
|
+
* | 9. The super class is kept on the element | `class="my-animation super"` |
|
1078
|
+
* | 10. The returned promise is resolved. | `class="my-animation super"` |
|
1079
|
+
*
|
1080
|
+
* @param {DOMElement} element the element that will be animated
|
1081
|
+
* @param {string} className the CSS class that will be added to the element and then animated
|
1082
|
+
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
|
1083
|
+
* @return {Promise} the animation callback promise
|
1084
|
+
*/
|
1085
|
+
addClass: function(element, className, options) {
|
1086
|
+
return this.setClass(element, className, [], options);
|
1087
|
+
},
|
1088
|
+
|
1089
|
+
/**
|
1090
|
+
* @ngdoc method
|
1091
|
+
* @name $animate#removeClass
|
1092
|
+
*
|
1093
|
+
* @description
|
1094
|
+
* Triggers a custom animation event based off the className variable and then removes the CSS class provided by the className value
|
1095
|
+
* from the element. Unlike the other animation methods, the animate service will suffix the className value with {@type -remove} in
|
1096
|
+
* order to provide the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if
|
1097
|
+
* no CSS transitions or keyframes are defined on the -remove or base CSS classes).
|
1098
|
+
*
|
1099
|
+
* Below is a breakdown of each step that occurs during removeClass animation:
|
1100
|
+
*
|
1101
|
+
* | Animation Step | What the element class attribute looks like |
|
1102
|
+
* |----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
|
1103
|
+
* | 1. `$animate.removeClass(element, 'super')` is called | `class="my-animation super"` |
|
1104
|
+
* | 2. `$animate` runs the JavaScript-defined animations detected on the element | `class="my-animation super ng-animate"` |
|
1105
|
+
* | 3. the `.super-remove` class is added to the element | `class="my-animation super ng-animate super-remove"` |
|
1106
|
+
* | 4. `$animate` waits for a single animation frame (this performs a reflow) | `class="my-animation super ng-animate super-remove"` |
|
1107
|
+
* | 5. the `.super-remove-active` classes are added and `.super` is removed (this triggers the CSS transition/animation) | `class="my-animation ng-animate super-remove super-remove-active"` |
|
1108
|
+
* | 6. `$animate` scans the element styles to get the CSS transition/animation duration and delay | `class="my-animation ng-animate super-remove super-remove-active"` |
|
1109
|
+
* | 7. `$animate` waits for the animation to complete (via events and timeout) | `class="my-animation ng-animate super-remove super-remove-active"` |
|
1110
|
+
* | 8. The animation ends and all generated CSS classes are removed from the element | `class="my-animation"` |
|
1111
|
+
* | 9. The returned promise is resolved. | `class="my-animation"` |
|
1112
|
+
*
|
1113
|
+
*
|
1114
|
+
* @param {DOMElement} element the element that will be animated
|
1115
|
+
* @param {string} className the CSS class that will be animated and then removed from the element
|
1116
|
+
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
|
1117
|
+
* @return {Promise} the animation callback promise
|
1118
|
+
*/
|
1119
|
+
removeClass: function(element, className, options) {
|
1120
|
+
return this.setClass(element, [], className, options);
|
1121
|
+
},
|
1122
|
+
|
1123
|
+
/**
|
1124
|
+
*
|
1125
|
+
* @ngdoc method
|
1126
|
+
* @name $animate#setClass
|
1127
|
+
*
|
1128
|
+
* @description Adds and/or removes the given CSS classes to and from the element.
|
1129
|
+
* Once complete, the `done()` callback will be fired (if provided).
|
1130
|
+
*
|
1131
|
+
* | Animation Step | What the element class attribute looks like |
|
1132
|
+
* |----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
|
1133
|
+
* | 1. `$animate.setClass(element, 'on', 'off')` is called | `class="my-animation off"` |
|
1134
|
+
* | 2. `$animate` runs the JavaScript-defined animations detected on the element | `class="my-animation ng-animate off"` |
|
1135
|
+
* | 3. the `.on-add` and `.off-remove` classes are added to the element | `class="my-animation ng-animate on-add off-remove off"` |
|
1136
|
+
* | 4. `$animate` waits for a single animation frame (this performs a reflow) | `class="my-animation ng-animate on-add off-remove off"` |
|
1137
|
+
* | 5. the `.on`, `.on-add-active` and `.off-remove-active` classes are added and `.off` is removed (this triggers the CSS transition/animation) | `class="my-animation ng-animate on on-add on-add-active off-remove off-remove-active"` |
|
1138
|
+
* | 6. `$animate` scans the element styles to get the CSS transition/animation duration and delay | `class="my-animation ng-animate on on-add on-add-active off-remove off-remove-active"` |
|
1139
|
+
* | 7. `$animate` waits for the animation to complete (via events and timeout) | `class="my-animation ng-animate on on-add on-add-active off-remove off-remove-active"` |
|
1140
|
+
* | 8. The animation ends and all generated CSS classes are removed from the element | `class="my-animation on"` |
|
1141
|
+
* | 9. The returned promise is resolved. | `class="my-animation on"` |
|
1142
|
+
*
|
1143
|
+
* @param {DOMElement} element the element which will have its CSS classes changed
|
1144
|
+
* removed from it
|
1145
|
+
* @param {string} add the CSS classes which will be added to the element
|
1146
|
+
* @param {string} remove the CSS class which will be removed from the element
|
1147
|
+
* CSS classes have been set on the element
|
1148
|
+
* @param {object=} options an optional collection of styles that will be picked up by the CSS transition/animation
|
1149
|
+
* @return {Promise} the animation callback promise
|
1150
|
+
*/
|
1151
|
+
setClass: function(element, add, remove, options) {
|
1152
|
+
options = parseAnimateOptions(options);
|
1153
|
+
|
1154
|
+
var STORAGE_KEY = '$$animateClasses';
|
1155
|
+
element = angular.element(element);
|
1156
|
+
element = stripCommentsFromElement(element);
|
1157
|
+
|
1158
|
+
if (classBasedAnimationsBlocked(element)) {
|
1159
|
+
return $delegate.$$setClassImmediately(element, add, remove, options);
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
// we're using a combined array for both the add and remove
|
1163
|
+
// operations since the ORDER OF addClass and removeClass matters
|
1164
|
+
var classes, cache = element.data(STORAGE_KEY);
|
1165
|
+
var hasCache = !!cache;
|
1166
|
+
if (!cache) {
|
1167
|
+
cache = {};
|
1168
|
+
cache.classes = {};
|
1169
|
+
}
|
1170
|
+
classes = cache.classes;
|
1171
|
+
|
1172
|
+
add = isArray(add) ? add : add.split(' ');
|
1173
|
+
forEach(add, function(c) {
|
1174
|
+
if (c && c.length) {
|
1175
|
+
classes[c] = true;
|
1176
|
+
}
|
1177
|
+
});
|
1178
|
+
|
1179
|
+
remove = isArray(remove) ? remove : remove.split(' ');
|
1180
|
+
forEach(remove, function(c) {
|
1181
|
+
if (c && c.length) {
|
1182
|
+
classes[c] = false;
|
1183
|
+
}
|
1184
|
+
});
|
1185
|
+
|
1186
|
+
if (hasCache) {
|
1187
|
+
if (options && cache.options) {
|
1188
|
+
cache.options = angular.extend(cache.options || {}, options);
|
1189
|
+
}
|
1190
|
+
|
1191
|
+
//the digest cycle will combine all the animations into one function
|
1192
|
+
return cache.promise;
|
1193
|
+
} else {
|
1194
|
+
element.data(STORAGE_KEY, cache = {
|
1195
|
+
classes: classes,
|
1196
|
+
options: options
|
1197
|
+
});
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
return cache.promise = runAnimationPostDigest(function(done) {
|
1201
|
+
var parentElement = element.parent();
|
1202
|
+
var elementNode = extractElementNode(element);
|
1203
|
+
var parentNode = elementNode.parentNode;
|
1204
|
+
// TODO(matsko): move this code into the animationsDisabled() function once #8092 is fixed
|
1205
|
+
if (!parentNode || parentNode['$$NG_REMOVED'] || elementNode['$$NG_REMOVED']) {
|
1206
|
+
done();
|
1207
|
+
return;
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
var cache = element.data(STORAGE_KEY);
|
1211
|
+
element.removeData(STORAGE_KEY);
|
1212
|
+
|
1213
|
+
var state = element.data(NG_ANIMATE_STATE) || {};
|
1214
|
+
var classes = resolveElementClasses(element, cache, state.active);
|
1215
|
+
return !classes
|
1216
|
+
? done()
|
1217
|
+
: performAnimation('setClass', classes, element, parentElement, null, function() {
|
1218
|
+
if (classes[0]) $delegate.$$addClassImmediately(element, classes[0]);
|
1219
|
+
if (classes[1]) $delegate.$$removeClassImmediately(element, classes[1]);
|
1220
|
+
}, cache.options, done);
|
1221
|
+
});
|
1222
|
+
},
|
1223
|
+
|
1224
|
+
/**
|
1225
|
+
* @ngdoc method
|
1226
|
+
* @name $animate#cancel
|
1227
|
+
* @kind function
|
1228
|
+
*
|
1229
|
+
* @param {Promise} animationPromise The animation promise that is returned when an animation is started.
|
1230
|
+
*
|
1231
|
+
* @description
|
1232
|
+
* Cancels the provided animation.
|
1233
|
+
*/
|
1234
|
+
cancel: function(promise) {
|
1235
|
+
promise.$$cancelFn();
|
1236
|
+
},
|
1237
|
+
|
1238
|
+
/**
|
1239
|
+
* @ngdoc method
|
1240
|
+
* @name $animate#enabled
|
1241
|
+
* @kind function
|
1242
|
+
*
|
1243
|
+
* @param {boolean=} value If provided then set the animation on or off.
|
1244
|
+
* @param {DOMElement=} element If provided then the element will be used to represent the enable/disable operation
|
1245
|
+
* @return {boolean} Current animation state.
|
1246
|
+
*
|
1247
|
+
* @description
|
1248
|
+
* Globally enables/disables animations.
|
1249
|
+
*
|
1250
|
+
*/
|
1251
|
+
enabled: function(value, element) {
|
1252
|
+
switch (arguments.length) {
|
1253
|
+
case 2:
|
1254
|
+
if (value) {
|
1255
|
+
cleanup(element);
|
1256
|
+
} else {
|
1257
|
+
var data = element.data(NG_ANIMATE_STATE) || {};
|
1258
|
+
data.disabled = true;
|
1259
|
+
element.data(NG_ANIMATE_STATE, data);
|
1260
|
+
}
|
1261
|
+
break;
|
1262
|
+
|
1263
|
+
case 1:
|
1264
|
+
rootAnimateState.disabled = !value;
|
1265
|
+
break;
|
1266
|
+
|
1267
|
+
default:
|
1268
|
+
value = !rootAnimateState.disabled;
|
1269
|
+
break;
|
1270
|
+
}
|
1271
|
+
return !!value;
|
1272
|
+
}
|
1273
|
+
};
|
1274
|
+
|
1275
|
+
/*
|
1276
|
+
all animations call this shared animation triggering function internally.
|
1277
|
+
The animationEvent variable refers to the JavaScript animation event that will be triggered
|
1278
|
+
and the className value is the name of the animation that will be applied within the
|
1279
|
+
CSS code. Element, `parentElement` and `afterElement` are provided DOM elements for the animation
|
1280
|
+
and the onComplete callback will be fired once the animation is fully complete.
|
1281
|
+
*/
|
1282
|
+
function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, options, doneCallback) {
|
1283
|
+
var noopCancel = noop;
|
1284
|
+
var runner = animationRunner(element, animationEvent, className, options);
|
1285
|
+
if (!runner) {
|
1286
|
+
fireDOMOperation();
|
1287
|
+
fireBeforeCallbackAsync();
|
1288
|
+
fireAfterCallbackAsync();
|
1289
|
+
closeAnimation();
|
1290
|
+
return noopCancel;
|
1291
|
+
}
|
1292
|
+
|
1293
|
+
animationEvent = runner.event;
|
1294
|
+
className = runner.className;
|
1295
|
+
var elementEvents = angular.element._data(runner.node);
|
1296
|
+
elementEvents = elementEvents && elementEvents.events;
|
1297
|
+
|
1298
|
+
if (!parentElement) {
|
1299
|
+
parentElement = afterElement ? afterElement.parent() : element.parent();
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
//skip the animation if animations are disabled, a parent is already being animated,
|
1303
|
+
//the element is not currently attached to the document body or then completely close
|
1304
|
+
//the animation if any matching animations are not found at all.
|
1305
|
+
//NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case an animation was found.
|
1306
|
+
if (animationsDisabled(element, parentElement)) {
|
1307
|
+
fireDOMOperation();
|
1308
|
+
fireBeforeCallbackAsync();
|
1309
|
+
fireAfterCallbackAsync();
|
1310
|
+
closeAnimation();
|
1311
|
+
return noopCancel;
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
var ngAnimateState = element.data(NG_ANIMATE_STATE) || {};
|
1315
|
+
var runningAnimations = ngAnimateState.active || {};
|
1316
|
+
var totalActiveAnimations = ngAnimateState.totalActive || 0;
|
1317
|
+
var lastAnimation = ngAnimateState.last;
|
1318
|
+
var skipAnimation = false;
|
1319
|
+
|
1320
|
+
if (totalActiveAnimations > 0) {
|
1321
|
+
var animationsToCancel = [];
|
1322
|
+
if (!runner.isClassBased) {
|
1323
|
+
if (animationEvent == 'leave' && runningAnimations['ng-leave']) {
|
1324
|
+
skipAnimation = true;
|
1325
|
+
} else {
|
1326
|
+
//cancel all animations when a structural animation takes place
|
1327
|
+
for (var klass in runningAnimations) {
|
1328
|
+
animationsToCancel.push(runningAnimations[klass]);
|
1329
|
+
}
|
1330
|
+
ngAnimateState = {};
|
1331
|
+
cleanup(element, true);
|
1332
|
+
}
|
1333
|
+
} else if (lastAnimation.event == 'setClass') {
|
1334
|
+
animationsToCancel.push(lastAnimation);
|
1335
|
+
cleanup(element, className);
|
1336
|
+
} else if (runningAnimations[className]) {
|
1337
|
+
var current = runningAnimations[className];
|
1338
|
+
if (current.event == animationEvent) {
|
1339
|
+
skipAnimation = true;
|
1340
|
+
} else {
|
1341
|
+
animationsToCancel.push(current);
|
1342
|
+
cleanup(element, className);
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
|
1346
|
+
if (animationsToCancel.length > 0) {
|
1347
|
+
forEach(animationsToCancel, function(operation) {
|
1348
|
+
operation.cancel();
|
1349
|
+
});
|
1350
|
+
}
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
if (runner.isClassBased
|
1354
|
+
&& !runner.isSetClassOperation
|
1355
|
+
&& animationEvent != 'animate'
|
1356
|
+
&& !skipAnimation) {
|
1357
|
+
skipAnimation = (animationEvent == 'addClass') == element.hasClass(className); //opposite of XOR
|
1358
|
+
}
|
1359
|
+
|
1360
|
+
if (skipAnimation) {
|
1361
|
+
fireDOMOperation();
|
1362
|
+
fireBeforeCallbackAsync();
|
1363
|
+
fireAfterCallbackAsync();
|
1364
|
+
fireDoneCallbackAsync();
|
1365
|
+
return noopCancel;
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
runningAnimations = ngAnimateState.active || {};
|
1369
|
+
totalActiveAnimations = ngAnimateState.totalActive || 0;
|
1370
|
+
|
1371
|
+
if (animationEvent == 'leave') {
|
1372
|
+
//there's no need to ever remove the listener since the element
|
1373
|
+
//will be removed (destroyed) after the leave animation ends or
|
1374
|
+
//is cancelled midway
|
1375
|
+
element.one('$destroy', function(e) {
|
1376
|
+
var element = angular.element(this);
|
1377
|
+
var state = element.data(NG_ANIMATE_STATE);
|
1378
|
+
if (state) {
|
1379
|
+
var activeLeaveAnimation = state.active['ng-leave'];
|
1380
|
+
if (activeLeaveAnimation) {
|
1381
|
+
activeLeaveAnimation.cancel();
|
1382
|
+
cleanup(element, 'ng-leave');
|
1383
|
+
}
|
1384
|
+
}
|
1385
|
+
});
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
//the ng-animate class does nothing, but it's here to allow for
|
1389
|
+
//parent animations to find and cancel child animations when needed
|
1390
|
+
$$jqLite.addClass(element, NG_ANIMATE_CLASS_NAME);
|
1391
|
+
if (options && options.tempClasses) {
|
1392
|
+
forEach(options.tempClasses, function(className) {
|
1393
|
+
$$jqLite.addClass(element, className);
|
1394
|
+
});
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
var localAnimationCount = globalAnimationCounter++;
|
1398
|
+
totalActiveAnimations++;
|
1399
|
+
runningAnimations[className] = runner;
|
1400
|
+
|
1401
|
+
element.data(NG_ANIMATE_STATE, {
|
1402
|
+
last: runner,
|
1403
|
+
active: runningAnimations,
|
1404
|
+
index: localAnimationCount,
|
1405
|
+
totalActive: totalActiveAnimations
|
1406
|
+
});
|
1407
|
+
|
1408
|
+
//first we run the before animations and when all of those are complete
|
1409
|
+
//then we perform the DOM operation and run the next set of animations
|
1410
|
+
fireBeforeCallbackAsync();
|
1411
|
+
runner.before(function(cancelled) {
|
1412
|
+
var data = element.data(NG_ANIMATE_STATE);
|
1413
|
+
cancelled = cancelled ||
|
1414
|
+
!data || !data.active[className] ||
|
1415
|
+
(runner.isClassBased && data.active[className].event != animationEvent);
|
1416
|
+
|
1417
|
+
fireDOMOperation();
|
1418
|
+
if (cancelled === true) {
|
1419
|
+
closeAnimation();
|
1420
|
+
} else {
|
1421
|
+
fireAfterCallbackAsync();
|
1422
|
+
runner.after(closeAnimation);
|
1423
|
+
}
|
1424
|
+
});
|
1425
|
+
|
1426
|
+
return runner.cancel;
|
1427
|
+
|
1428
|
+
function fireDOMCallback(animationPhase) {
|
1429
|
+
var eventName = '$animate:' + animationPhase;
|
1430
|
+
if (elementEvents && elementEvents[eventName] && elementEvents[eventName].length > 0) {
|
1431
|
+
$$asyncCallback(function() {
|
1432
|
+
element.triggerHandler(eventName, {
|
1433
|
+
event: animationEvent,
|
1434
|
+
className: className
|
1435
|
+
});
|
1436
|
+
});
|
1437
|
+
}
|
1438
|
+
}
|
1439
|
+
|
1440
|
+
function fireBeforeCallbackAsync() {
|
1441
|
+
fireDOMCallback('before');
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
function fireAfterCallbackAsync() {
|
1445
|
+
fireDOMCallback('after');
|
1446
|
+
}
|
1447
|
+
|
1448
|
+
function fireDoneCallbackAsync() {
|
1449
|
+
fireDOMCallback('close');
|
1450
|
+
doneCallback();
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
//it is less complicated to use a flag than managing and canceling
|
1454
|
+
//timeouts containing multiple callbacks.
|
1455
|
+
function fireDOMOperation() {
|
1456
|
+
if (!fireDOMOperation.hasBeenRun) {
|
1457
|
+
fireDOMOperation.hasBeenRun = true;
|
1458
|
+
domOperation();
|
1459
|
+
}
|
1460
|
+
}
|
1461
|
+
|
1462
|
+
function closeAnimation() {
|
1463
|
+
if (!closeAnimation.hasBeenRun) {
|
1464
|
+
if (runner) { //the runner doesn't exist if it fails to instantiate
|
1465
|
+
runner.applyStyles();
|
1466
|
+
}
|
1467
|
+
|
1468
|
+
closeAnimation.hasBeenRun = true;
|
1469
|
+
if (options && options.tempClasses) {
|
1470
|
+
forEach(options.tempClasses, function(className) {
|
1471
|
+
$$jqLite.removeClass(element, className);
|
1472
|
+
});
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
var data = element.data(NG_ANIMATE_STATE);
|
1476
|
+
if (data) {
|
1477
|
+
|
1478
|
+
/* only structural animations wait for reflow before removing an
|
1479
|
+
animation, but class-based animations don't. An example of this
|
1480
|
+
failing would be when a parent HTML tag has a ng-class attribute
|
1481
|
+
causing ALL directives below to skip animations during the digest */
|
1482
|
+
if (runner && runner.isClassBased) {
|
1483
|
+
cleanup(element, className);
|
1484
|
+
} else {
|
1485
|
+
$$asyncCallback(function() {
|
1486
|
+
var data = element.data(NG_ANIMATE_STATE) || {};
|
1487
|
+
if (localAnimationCount == data.index) {
|
1488
|
+
cleanup(element, className, animationEvent);
|
1489
|
+
}
|
1490
|
+
});
|
1491
|
+
element.data(NG_ANIMATE_STATE, data);
|
1492
|
+
}
|
1493
|
+
}
|
1494
|
+
fireDoneCallbackAsync();
|
1495
|
+
}
|
1496
|
+
}
|
1497
|
+
}
|
1498
|
+
|
1499
|
+
function cancelChildAnimations(element) {
|
1500
|
+
var node = extractElementNode(element);
|
1501
|
+
if (node) {
|
1502
|
+
var nodes = angular.isFunction(node.getElementsByClassName) ?
|
1503
|
+
node.getElementsByClassName(NG_ANIMATE_CLASS_NAME) :
|
1504
|
+
node.querySelectorAll('.' + NG_ANIMATE_CLASS_NAME);
|
1505
|
+
forEach(nodes, function(element) {
|
1506
|
+
element = angular.element(element);
|
1507
|
+
var data = element.data(NG_ANIMATE_STATE);
|
1508
|
+
if (data && data.active) {
|
1509
|
+
forEach(data.active, function(runner) {
|
1510
|
+
runner.cancel();
|
1511
|
+
});
|
1512
|
+
}
|
1513
|
+
});
|
1514
|
+
}
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
function cleanup(element, className) {
|
1518
|
+
if (isMatchingElement(element, $rootElement)) {
|
1519
|
+
if (!rootAnimateState.disabled) {
|
1520
|
+
rootAnimateState.running = false;
|
1521
|
+
rootAnimateState.structural = false;
|
1522
|
+
}
|
1523
|
+
} else if (className) {
|
1524
|
+
var data = element.data(NG_ANIMATE_STATE) || {};
|
1525
|
+
|
1526
|
+
var removeAnimations = className === true;
|
1527
|
+
if (!removeAnimations && data.active && data.active[className]) {
|
1528
|
+
data.totalActive--;
|
1529
|
+
delete data.active[className];
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
if (removeAnimations || !data.totalActive) {
|
1533
|
+
$$jqLite.removeClass(element, NG_ANIMATE_CLASS_NAME);
|
1534
|
+
element.removeData(NG_ANIMATE_STATE);
|
1535
|
+
}
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
|
1539
|
+
function animationsDisabled(element, parentElement) {
|
1540
|
+
if (rootAnimateState.disabled) {
|
1541
|
+
return true;
|
1542
|
+
}
|
1543
|
+
|
1544
|
+
if (isMatchingElement(element, $rootElement)) {
|
1545
|
+
return rootAnimateState.running;
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
var allowChildAnimations, parentRunningAnimation, hasParent;
|
1549
|
+
do {
|
1550
|
+
//the element did not reach the root element which means that it
|
1551
|
+
//is not apart of the DOM. Therefore there is no reason to do
|
1552
|
+
//any animations on it
|
1553
|
+
if (parentElement.length === 0) break;
|
1554
|
+
|
1555
|
+
var isRoot = isMatchingElement(parentElement, $rootElement);
|
1556
|
+
var state = isRoot ? rootAnimateState : (parentElement.data(NG_ANIMATE_STATE) || {});
|
1557
|
+
if (state.disabled) {
|
1558
|
+
return true;
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
//no matter what, for an animation to work it must reach the root element
|
1562
|
+
//this implies that the element is attached to the DOM when the animation is run
|
1563
|
+
if (isRoot) {
|
1564
|
+
hasParent = true;
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
//once a flag is found that is strictly false then everything before
|
1568
|
+
//it will be discarded and all child animations will be restricted
|
1569
|
+
if (allowChildAnimations !== false) {
|
1570
|
+
var animateChildrenFlag = parentElement.data(NG_ANIMATE_CHILDREN);
|
1571
|
+
if (angular.isDefined(animateChildrenFlag)) {
|
1572
|
+
allowChildAnimations = animateChildrenFlag;
|
1573
|
+
}
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
parentRunningAnimation = parentRunningAnimation ||
|
1577
|
+
state.running ||
|
1578
|
+
(state.last && !state.last.isClassBased);
|
1579
|
+
}
|
1580
|
+
while (parentElement = parentElement.parent());
|
1581
|
+
|
1582
|
+
return !hasParent || (!allowChildAnimations && parentRunningAnimation);
|
1583
|
+
}
|
1584
|
+
}]);
|
1585
|
+
|
1586
|
+
$animateProvider.register('', ['$window', '$sniffer', '$timeout', '$$animateReflow',
|
1587
|
+
function($window, $sniffer, $timeout, $$animateReflow) {
|
1588
|
+
// Detect proper transitionend/animationend event names.
|
1589
|
+
var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;
|
1590
|
+
|
1591
|
+
// If unprefixed events are not supported but webkit-prefixed are, use the latter.
|
1592
|
+
// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
|
1593
|
+
// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
|
1594
|
+
// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
|
1595
|
+
// Register both events in case `window.onanimationend` is not supported because of that,
|
1596
|
+
// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
|
1597
|
+
// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
|
1598
|
+
// therefore there is no reason to test anymore for other vendor prefixes: http://caniuse.com/#search=transition
|
1599
|
+
if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {
|
1600
|
+
CSS_PREFIX = '-webkit-';
|
1601
|
+
TRANSITION_PROP = 'WebkitTransition';
|
1602
|
+
TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';
|
1603
|
+
} else {
|
1604
|
+
TRANSITION_PROP = 'transition';
|
1605
|
+
TRANSITIONEND_EVENT = 'transitionend';
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {
|
1609
|
+
CSS_PREFIX = '-webkit-';
|
1610
|
+
ANIMATION_PROP = 'WebkitAnimation';
|
1611
|
+
ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';
|
1612
|
+
} else {
|
1613
|
+
ANIMATION_PROP = 'animation';
|
1614
|
+
ANIMATIONEND_EVENT = 'animationend';
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
var DURATION_KEY = 'Duration';
|
1618
|
+
var PROPERTY_KEY = 'Property';
|
1619
|
+
var DELAY_KEY = 'Delay';
|
1620
|
+
var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';
|
1621
|
+
var ANIMATION_PLAYSTATE_KEY = 'PlayState';
|
1622
|
+
var NG_ANIMATE_PARENT_KEY = '$$ngAnimateKey';
|
1623
|
+
var NG_ANIMATE_CSS_DATA_KEY = '$$ngAnimateCSS3Data';
|
1624
|
+
var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
|
1625
|
+
var CLOSING_TIME_BUFFER = 1.5;
|
1626
|
+
var ONE_SECOND = 1000;
|
1627
|
+
|
1628
|
+
var lookupCache = {};
|
1629
|
+
var parentCounter = 0;
|
1630
|
+
var animationReflowQueue = [];
|
1631
|
+
var cancelAnimationReflow;
|
1632
|
+
function clearCacheAfterReflow() {
|
1633
|
+
if (!cancelAnimationReflow) {
|
1634
|
+
cancelAnimationReflow = $$animateReflow(function() {
|
1635
|
+
animationReflowQueue = [];
|
1636
|
+
cancelAnimationReflow = null;
|
1637
|
+
lookupCache = {};
|
1638
|
+
});
|
1639
|
+
}
|
1640
|
+
}
|
1641
|
+
|
1642
|
+
function afterReflow(element, callback) {
|
1643
|
+
if (cancelAnimationReflow) {
|
1644
|
+
cancelAnimationReflow();
|
1645
|
+
}
|
1646
|
+
animationReflowQueue.push(callback);
|
1647
|
+
cancelAnimationReflow = $$animateReflow(function() {
|
1648
|
+
forEach(animationReflowQueue, function(fn) {
|
1649
|
+
fn();
|
1650
|
+
});
|
1651
|
+
|
1652
|
+
animationReflowQueue = [];
|
1653
|
+
cancelAnimationReflow = null;
|
1654
|
+
lookupCache = {};
|
1655
|
+
});
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
var closingTimer = null;
|
1659
|
+
var closingTimestamp = 0;
|
1660
|
+
var animationElementQueue = [];
|
1661
|
+
function animationCloseHandler(element, totalTime) {
|
1662
|
+
var node = extractElementNode(element);
|
1663
|
+
element = angular.element(node);
|
1664
|
+
|
1665
|
+
//this item will be garbage collected by the closing
|
1666
|
+
//animation timeout
|
1667
|
+
animationElementQueue.push(element);
|
1668
|
+
|
1669
|
+
//but it may not need to cancel out the existing timeout
|
1670
|
+
//if the timestamp is less than the previous one
|
1671
|
+
var futureTimestamp = Date.now() + totalTime;
|
1672
|
+
if (futureTimestamp <= closingTimestamp) {
|
1673
|
+
return;
|
1674
|
+
}
|
1675
|
+
|
1676
|
+
$timeout.cancel(closingTimer);
|
1677
|
+
|
1678
|
+
closingTimestamp = futureTimestamp;
|
1679
|
+
closingTimer = $timeout(function() {
|
1680
|
+
closeAllAnimations(animationElementQueue);
|
1681
|
+
animationElementQueue = [];
|
1682
|
+
}, totalTime, false);
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
function closeAllAnimations(elements) {
|
1686
|
+
forEach(elements, function(element) {
|
1687
|
+
var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);
|
1688
|
+
if (elementData) {
|
1689
|
+
forEach(elementData.closeAnimationFns, function(fn) {
|
1690
|
+
fn();
|
1691
|
+
});
|
1692
|
+
}
|
1693
|
+
});
|
1694
|
+
}
|
1695
|
+
|
1696
|
+
function getElementAnimationDetails(element, cacheKey) {
|
1697
|
+
var data = cacheKey ? lookupCache[cacheKey] : null;
|
1698
|
+
if (!data) {
|
1699
|
+
var transitionDuration = 0;
|
1700
|
+
var transitionDelay = 0;
|
1701
|
+
var animationDuration = 0;
|
1702
|
+
var animationDelay = 0;
|
1703
|
+
|
1704
|
+
//we want all the styles defined before and after
|
1705
|
+
forEach(element, function(element) {
|
1706
|
+
if (element.nodeType == ELEMENT_NODE) {
|
1707
|
+
var elementStyles = $window.getComputedStyle(element) || {};
|
1708
|
+
|
1709
|
+
var transitionDurationStyle = elementStyles[TRANSITION_PROP + DURATION_KEY];
|
1710
|
+
transitionDuration = Math.max(parseMaxTime(transitionDurationStyle), transitionDuration);
|
1711
|
+
|
1712
|
+
var transitionDelayStyle = elementStyles[TRANSITION_PROP + DELAY_KEY];
|
1713
|
+
transitionDelay = Math.max(parseMaxTime(transitionDelayStyle), transitionDelay);
|
1714
|
+
|
1715
|
+
var animationDelayStyle = elementStyles[ANIMATION_PROP + DELAY_KEY];
|
1716
|
+
animationDelay = Math.max(parseMaxTime(elementStyles[ANIMATION_PROP + DELAY_KEY]), animationDelay);
|
1717
|
+
|
1718
|
+
var aDuration = parseMaxTime(elementStyles[ANIMATION_PROP + DURATION_KEY]);
|
1719
|
+
|
1720
|
+
if (aDuration > 0) {
|
1721
|
+
aDuration *= parseInt(elementStyles[ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY], 10) || 1;
|
1722
|
+
}
|
1723
|
+
animationDuration = Math.max(aDuration, animationDuration);
|
1724
|
+
}
|
1725
|
+
});
|
1726
|
+
data = {
|
1727
|
+
total: 0,
|
1728
|
+
transitionDelay: transitionDelay,
|
1729
|
+
transitionDuration: transitionDuration,
|
1730
|
+
animationDelay: animationDelay,
|
1731
|
+
animationDuration: animationDuration
|
1732
|
+
};
|
1733
|
+
if (cacheKey) {
|
1734
|
+
lookupCache[cacheKey] = data;
|
1735
|
+
}
|
1736
|
+
}
|
1737
|
+
return data;
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
function parseMaxTime(str) {
|
1741
|
+
var maxValue = 0;
|
1742
|
+
var values = isString(str) ?
|
1743
|
+
str.split(/\s*,\s*/) :
|
1744
|
+
[];
|
1745
|
+
forEach(values, function(value) {
|
1746
|
+
maxValue = Math.max(parseFloat(value) || 0, maxValue);
|
1747
|
+
});
|
1748
|
+
return maxValue;
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
function getCacheKey(element) {
|
1752
|
+
var parentElement = element.parent();
|
1753
|
+
var parentID = parentElement.data(NG_ANIMATE_PARENT_KEY);
|
1754
|
+
if (!parentID) {
|
1755
|
+
parentElement.data(NG_ANIMATE_PARENT_KEY, ++parentCounter);
|
1756
|
+
parentID = parentCounter;
|
1757
|
+
}
|
1758
|
+
return parentID + '-' + extractElementNode(element).getAttribute('class');
|
1759
|
+
}
|
1760
|
+
|
1761
|
+
function animateSetup(animationEvent, element, className, styles) {
|
1762
|
+
var structural = ['ng-enter','ng-leave','ng-move'].indexOf(className) >= 0;
|
1763
|
+
|
1764
|
+
var cacheKey = getCacheKey(element);
|
1765
|
+
var eventCacheKey = cacheKey + ' ' + className;
|
1766
|
+
var itemIndex = lookupCache[eventCacheKey] ? ++lookupCache[eventCacheKey].total : 0;
|
1767
|
+
|
1768
|
+
var stagger = {};
|
1769
|
+
if (itemIndex > 0) {
|
1770
|
+
var staggerClassName = className + '-stagger';
|
1771
|
+
var staggerCacheKey = cacheKey + ' ' + staggerClassName;
|
1772
|
+
var applyClasses = !lookupCache[staggerCacheKey];
|
1773
|
+
|
1774
|
+
applyClasses && $$jqLite.addClass(element, staggerClassName);
|
1775
|
+
|
1776
|
+
stagger = getElementAnimationDetails(element, staggerCacheKey);
|
1777
|
+
|
1778
|
+
applyClasses && $$jqLite.removeClass(element, staggerClassName);
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
$$jqLite.addClass(element, className);
|
1782
|
+
|
1783
|
+
var formerData = element.data(NG_ANIMATE_CSS_DATA_KEY) || {};
|
1784
|
+
var timings = getElementAnimationDetails(element, eventCacheKey);
|
1785
|
+
var transitionDuration = timings.transitionDuration;
|
1786
|
+
var animationDuration = timings.animationDuration;
|
1787
|
+
|
1788
|
+
if (structural && transitionDuration === 0 && animationDuration === 0) {
|
1789
|
+
$$jqLite.removeClass(element, className);
|
1790
|
+
return false;
|
1791
|
+
}
|
1792
|
+
|
1793
|
+
var blockTransition = styles || (structural && transitionDuration > 0);
|
1794
|
+
var blockAnimation = animationDuration > 0 &&
|
1795
|
+
stagger.animationDelay > 0 &&
|
1796
|
+
stagger.animationDuration === 0;
|
1797
|
+
|
1798
|
+
var closeAnimationFns = formerData.closeAnimationFns || [];
|
1799
|
+
element.data(NG_ANIMATE_CSS_DATA_KEY, {
|
1800
|
+
stagger: stagger,
|
1801
|
+
cacheKey: eventCacheKey,
|
1802
|
+
running: formerData.running || 0,
|
1803
|
+
itemIndex: itemIndex,
|
1804
|
+
blockTransition: blockTransition,
|
1805
|
+
closeAnimationFns: closeAnimationFns
|
1806
|
+
});
|
1807
|
+
|
1808
|
+
var node = extractElementNode(element);
|
1809
|
+
|
1810
|
+
if (blockTransition) {
|
1811
|
+
blockTransitions(node, true);
|
1812
|
+
if (styles) {
|
1813
|
+
element.css(styles);
|
1814
|
+
}
|
1815
|
+
}
|
1816
|
+
|
1817
|
+
if (blockAnimation) {
|
1818
|
+
blockAnimations(node, true);
|
1819
|
+
}
|
1820
|
+
|
1821
|
+
return true;
|
1822
|
+
}
|
1823
|
+
|
1824
|
+
function animateRun(animationEvent, element, className, activeAnimationComplete, styles) {
|
1825
|
+
var node = extractElementNode(element);
|
1826
|
+
var elementData = element.data(NG_ANIMATE_CSS_DATA_KEY);
|
1827
|
+
if (node.getAttribute('class').indexOf(className) == -1 || !elementData) {
|
1828
|
+
activeAnimationComplete();
|
1829
|
+
return;
|
1830
|
+
}
|
1831
|
+
|
1832
|
+
var activeClassName = '';
|
1833
|
+
var pendingClassName = '';
|
1834
|
+
forEach(className.split(' '), function(klass, i) {
|
1835
|
+
var prefix = (i > 0 ? ' ' : '') + klass;
|
1836
|
+
activeClassName += prefix + '-active';
|
1837
|
+
pendingClassName += prefix + '-pending';
|
1838
|
+
});
|
1839
|
+
|
1840
|
+
var style = '';
|
1841
|
+
var appliedStyles = [];
|
1842
|
+
var itemIndex = elementData.itemIndex;
|
1843
|
+
var stagger = elementData.stagger;
|
1844
|
+
var staggerTime = 0;
|
1845
|
+
if (itemIndex > 0) {
|
1846
|
+
var transitionStaggerDelay = 0;
|
1847
|
+
if (stagger.transitionDelay > 0 && stagger.transitionDuration === 0) {
|
1848
|
+
transitionStaggerDelay = stagger.transitionDelay * itemIndex;
|
1849
|
+
}
|
1850
|
+
|
1851
|
+
var animationStaggerDelay = 0;
|
1852
|
+
if (stagger.animationDelay > 0 && stagger.animationDuration === 0) {
|
1853
|
+
animationStaggerDelay = stagger.animationDelay * itemIndex;
|
1854
|
+
appliedStyles.push(CSS_PREFIX + 'animation-play-state');
|
1855
|
+
}
|
1856
|
+
|
1857
|
+
staggerTime = Math.round(Math.max(transitionStaggerDelay, animationStaggerDelay) * 100) / 100;
|
1858
|
+
}
|
1859
|
+
|
1860
|
+
if (!staggerTime) {
|
1861
|
+
$$jqLite.addClass(element, activeClassName);
|
1862
|
+
if (elementData.blockTransition) {
|
1863
|
+
blockTransitions(node, false);
|
1864
|
+
}
|
1865
|
+
}
|
1866
|
+
|
1867
|
+
var eventCacheKey = elementData.cacheKey + ' ' + activeClassName;
|
1868
|
+
var timings = getElementAnimationDetails(element, eventCacheKey);
|
1869
|
+
var maxDuration = Math.max(timings.transitionDuration, timings.animationDuration);
|
1870
|
+
if (maxDuration === 0) {
|
1871
|
+
$$jqLite.removeClass(element, activeClassName);
|
1872
|
+
animateClose(element, className);
|
1873
|
+
activeAnimationComplete();
|
1874
|
+
return;
|
1875
|
+
}
|
1876
|
+
|
1877
|
+
if (!staggerTime && styles && Object.keys(styles).length > 0) {
|
1878
|
+
if (!timings.transitionDuration) {
|
1879
|
+
element.css('transition', timings.animationDuration + 's linear all');
|
1880
|
+
appliedStyles.push('transition');
|
1881
|
+
}
|
1882
|
+
element.css(styles);
|
1883
|
+
}
|
1884
|
+
|
1885
|
+
var maxDelay = Math.max(timings.transitionDelay, timings.animationDelay);
|
1886
|
+
var maxDelayTime = maxDelay * ONE_SECOND;
|
1887
|
+
|
1888
|
+
if (appliedStyles.length > 0) {
|
1889
|
+
//the element being animated may sometimes contain comment nodes in
|
1890
|
+
//the jqLite object, so we're safe to use a single variable to house
|
1891
|
+
//the styles since there is always only one element being animated
|
1892
|
+
var oldStyle = node.getAttribute('style') || '';
|
1893
|
+
if (oldStyle.charAt(oldStyle.length - 1) !== ';') {
|
1894
|
+
oldStyle += ';';
|
1895
|
+
}
|
1896
|
+
node.setAttribute('style', oldStyle + ' ' + style);
|
1897
|
+
}
|
1898
|
+
|
1899
|
+
var startTime = Date.now();
|
1900
|
+
var css3AnimationEvents = ANIMATIONEND_EVENT + ' ' + TRANSITIONEND_EVENT;
|
1901
|
+
var animationTime = (maxDelay + maxDuration) * CLOSING_TIME_BUFFER;
|
1902
|
+
var totalTime = (staggerTime + animationTime) * ONE_SECOND;
|
1903
|
+
|
1904
|
+
var staggerTimeout;
|
1905
|
+
if (staggerTime > 0) {
|
1906
|
+
$$jqLite.addClass(element, pendingClassName);
|
1907
|
+
staggerTimeout = $timeout(function() {
|
1908
|
+
staggerTimeout = null;
|
1909
|
+
|
1910
|
+
if (timings.transitionDuration > 0) {
|
1911
|
+
blockTransitions(node, false);
|
1912
|
+
}
|
1913
|
+
if (timings.animationDuration > 0) {
|
1914
|
+
blockAnimations(node, false);
|
1915
|
+
}
|
1916
|
+
|
1917
|
+
$$jqLite.addClass(element, activeClassName);
|
1918
|
+
$$jqLite.removeClass(element, pendingClassName);
|
1919
|
+
|
1920
|
+
if (styles) {
|
1921
|
+
if (timings.transitionDuration === 0) {
|
1922
|
+
element.css('transition', timings.animationDuration + 's linear all');
|
1923
|
+
}
|
1924
|
+
element.css(styles);
|
1925
|
+
appliedStyles.push('transition');
|
1926
|
+
}
|
1927
|
+
}, staggerTime * ONE_SECOND, false);
|
1928
|
+
}
|
1929
|
+
|
1930
|
+
element.on(css3AnimationEvents, onAnimationProgress);
|
1931
|
+
elementData.closeAnimationFns.push(function() {
|
1932
|
+
onEnd();
|
1933
|
+
activeAnimationComplete();
|
1934
|
+
});
|
1935
|
+
|
1936
|
+
elementData.running++;
|
1937
|
+
animationCloseHandler(element, totalTime);
|
1938
|
+
return onEnd;
|
1939
|
+
|
1940
|
+
// This will automatically be called by $animate so
|
1941
|
+
// there is no need to attach this internally to the
|
1942
|
+
// timeout done method.
|
1943
|
+
function onEnd() {
|
1944
|
+
element.off(css3AnimationEvents, onAnimationProgress);
|
1945
|
+
$$jqLite.removeClass(element, activeClassName);
|
1946
|
+
$$jqLite.removeClass(element, pendingClassName);
|
1947
|
+
if (staggerTimeout) {
|
1948
|
+
$timeout.cancel(staggerTimeout);
|
1949
|
+
}
|
1950
|
+
animateClose(element, className);
|
1951
|
+
var node = extractElementNode(element);
|
1952
|
+
for (var i in appliedStyles) {
|
1953
|
+
node.style.removeProperty(appliedStyles[i]);
|
1954
|
+
}
|
1955
|
+
}
|
1956
|
+
|
1957
|
+
function onAnimationProgress(event) {
|
1958
|
+
event.stopPropagation();
|
1959
|
+
var ev = event.originalEvent || event;
|
1960
|
+
var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();
|
1961
|
+
|
1962
|
+
/* Firefox (or possibly just Gecko) likes to not round values up
|
1963
|
+
* when a ms measurement is used for the animation */
|
1964
|
+
var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
|
1965
|
+
|
1966
|
+
/* $manualTimeStamp is a mocked timeStamp value which is set
|
1967
|
+
* within browserTrigger(). This is only here so that tests can
|
1968
|
+
* mock animations properly. Real events fallback to event.timeStamp,
|
1969
|
+
* or, if they don't, then a timeStamp is automatically created for them.
|
1970
|
+
* We're checking to see if the timeStamp surpasses the expected delay,
|
1971
|
+
* but we're using elapsedTime instead of the timeStamp on the 2nd
|
1972
|
+
* pre-condition since animations sometimes close off early */
|
1973
|
+
if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
|
1974
|
+
activeAnimationComplete();
|
1975
|
+
}
|
1976
|
+
}
|
1977
|
+
}
|
1978
|
+
|
1979
|
+
function blockTransitions(node, bool) {
|
1980
|
+
node.style[TRANSITION_PROP + PROPERTY_KEY] = bool ? 'none' : '';
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
function blockAnimations(node, bool) {
|
1984
|
+
node.style[ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY] = bool ? 'paused' : '';
|
1985
|
+
}
|
1986
|
+
|
1987
|
+
function animateBefore(animationEvent, element, className, styles) {
|
1988
|
+
if (animateSetup(animationEvent, element, className, styles)) {
|
1989
|
+
return function(cancelled) {
|
1990
|
+
cancelled && animateClose(element, className);
|
1991
|
+
};
|
1992
|
+
}
|
1993
|
+
}
|
1994
|
+
|
1995
|
+
function animateAfter(animationEvent, element, className, afterAnimationComplete, styles) {
|
1996
|
+
if (element.data(NG_ANIMATE_CSS_DATA_KEY)) {
|
1997
|
+
return animateRun(animationEvent, element, className, afterAnimationComplete, styles);
|
1998
|
+
} else {
|
1999
|
+
animateClose(element, className);
|
2000
|
+
afterAnimationComplete();
|
2001
|
+
}
|
2002
|
+
}
|
2003
|
+
|
2004
|
+
function animate(animationEvent, element, className, animationComplete, options) {
|
2005
|
+
//If the animateSetup function doesn't bother returning a
|
2006
|
+
//cancellation function then it means that there is no animation
|
2007
|
+
//to perform at all
|
2008
|
+
var preReflowCancellation = animateBefore(animationEvent, element, className, options.from);
|
2009
|
+
if (!preReflowCancellation) {
|
2010
|
+
clearCacheAfterReflow();
|
2011
|
+
animationComplete();
|
2012
|
+
return;
|
2013
|
+
}
|
2014
|
+
|
2015
|
+
//There are two cancellation functions: one is before the first
|
2016
|
+
//reflow animation and the second is during the active state
|
2017
|
+
//animation. The first function will take care of removing the
|
2018
|
+
//data from the element which will not make the 2nd animation
|
2019
|
+
//happen in the first place
|
2020
|
+
var cancel = preReflowCancellation;
|
2021
|
+
afterReflow(element, function() {
|
2022
|
+
//once the reflow is complete then we point cancel to
|
2023
|
+
//the new cancellation function which will remove all of the
|
2024
|
+
//animation properties from the active animation
|
2025
|
+
cancel = animateAfter(animationEvent, element, className, animationComplete, options.to);
|
2026
|
+
});
|
2027
|
+
|
2028
|
+
return function(cancelled) {
|
2029
|
+
(cancel || noop)(cancelled);
|
2030
|
+
};
|
2031
|
+
}
|
2032
|
+
|
2033
|
+
function animateClose(element, className) {
|
2034
|
+
$$jqLite.removeClass(element, className);
|
2035
|
+
var data = element.data(NG_ANIMATE_CSS_DATA_KEY);
|
2036
|
+
if (data) {
|
2037
|
+
if (data.running) {
|
2038
|
+
data.running--;
|
2039
|
+
}
|
2040
|
+
if (!data.running || data.running === 0) {
|
2041
|
+
element.removeData(NG_ANIMATE_CSS_DATA_KEY);
|
2042
|
+
}
|
2043
|
+
}
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
return {
|
2047
|
+
animate: function(element, className, from, to, animationCompleted, options) {
|
2048
|
+
options = options || {};
|
2049
|
+
options.from = from;
|
2050
|
+
options.to = to;
|
2051
|
+
return animate('animate', element, className, animationCompleted, options);
|
2052
|
+
},
|
2053
|
+
|
2054
|
+
enter: function(element, animationCompleted, options) {
|
2055
|
+
options = options || {};
|
2056
|
+
return animate('enter', element, 'ng-enter', animationCompleted, options);
|
2057
|
+
},
|
2058
|
+
|
2059
|
+
leave: function(element, animationCompleted, options) {
|
2060
|
+
options = options || {};
|
2061
|
+
return animate('leave', element, 'ng-leave', animationCompleted, options);
|
2062
|
+
},
|
2063
|
+
|
2064
|
+
move: function(element, animationCompleted, options) {
|
2065
|
+
options = options || {};
|
2066
|
+
return animate('move', element, 'ng-move', animationCompleted, options);
|
2067
|
+
},
|
2068
|
+
|
2069
|
+
beforeSetClass: function(element, add, remove, animationCompleted, options) {
|
2070
|
+
options = options || {};
|
2071
|
+
var className = suffixClasses(remove, '-remove') + ' ' +
|
2072
|
+
suffixClasses(add, '-add');
|
2073
|
+
var cancellationMethod = animateBefore('setClass', element, className, options.from);
|
2074
|
+
if (cancellationMethod) {
|
2075
|
+
afterReflow(element, animationCompleted);
|
2076
|
+
return cancellationMethod;
|
2077
|
+
}
|
2078
|
+
clearCacheAfterReflow();
|
2079
|
+
animationCompleted();
|
2080
|
+
},
|
2081
|
+
|
2082
|
+
beforeAddClass: function(element, className, animationCompleted, options) {
|
2083
|
+
options = options || {};
|
2084
|
+
var cancellationMethod = animateBefore('addClass', element, suffixClasses(className, '-add'), options.from);
|
2085
|
+
if (cancellationMethod) {
|
2086
|
+
afterReflow(element, animationCompleted);
|
2087
|
+
return cancellationMethod;
|
2088
|
+
}
|
2089
|
+
clearCacheAfterReflow();
|
2090
|
+
animationCompleted();
|
2091
|
+
},
|
2092
|
+
|
2093
|
+
beforeRemoveClass: function(element, className, animationCompleted, options) {
|
2094
|
+
options = options || {};
|
2095
|
+
var cancellationMethod = animateBefore('removeClass', element, suffixClasses(className, '-remove'), options.from);
|
2096
|
+
if (cancellationMethod) {
|
2097
|
+
afterReflow(element, animationCompleted);
|
2098
|
+
return cancellationMethod;
|
2099
|
+
}
|
2100
|
+
clearCacheAfterReflow();
|
2101
|
+
animationCompleted();
|
2102
|
+
},
|
2103
|
+
|
2104
|
+
setClass: function(element, add, remove, animationCompleted, options) {
|
2105
|
+
options = options || {};
|
2106
|
+
remove = suffixClasses(remove, '-remove');
|
2107
|
+
add = suffixClasses(add, '-add');
|
2108
|
+
var className = remove + ' ' + add;
|
2109
|
+
return animateAfter('setClass', element, className, animationCompleted, options.to);
|
2110
|
+
},
|
2111
|
+
|
2112
|
+
addClass: function(element, className, animationCompleted, options) {
|
2113
|
+
options = options || {};
|
2114
|
+
return animateAfter('addClass', element, suffixClasses(className, '-add'), animationCompleted, options.to);
|
2115
|
+
},
|
2116
|
+
|
2117
|
+
removeClass: function(element, className, animationCompleted, options) {
|
2118
|
+
options = options || {};
|
2119
|
+
return animateAfter('removeClass', element, suffixClasses(className, '-remove'), animationCompleted, options.to);
|
2120
|
+
}
|
2121
|
+
};
|
2122
|
+
|
2123
|
+
function suffixClasses(classes, suffix) {
|
2124
|
+
var className = '';
|
2125
|
+
classes = isArray(classes) ? classes : classes.split(/\s+/);
|
2126
|
+
forEach(classes, function(klass, i) {
|
2127
|
+
if (klass && klass.length > 0) {
|
2128
|
+
className += (i > 0 ? ' ' : '') + klass + suffix;
|
2129
|
+
}
|
2130
|
+
});
|
2131
|
+
return className;
|
2132
|
+
}
|
2133
|
+
}]);
|
2134
|
+
}]);
|
2135
|
+
|
2136
|
+
|
2137
|
+
})(window, window.angular);
|