fomantic-ui 2.9.1-beta.2 → 2.9.1-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/.eslintrc.js +110 -0
  2. package/.github/workflows/ci.yml +14 -4
  3. package/.stylelintrc.js +46 -0
  4. package/dist/components/accordion.css +19 -26
  5. package/dist/components/accordion.js +568 -595
  6. package/dist/components/accordion.min.css +1 -1
  7. package/dist/components/accordion.min.js +2 -2
  8. package/dist/components/ad.css +31 -41
  9. package/dist/components/ad.min.css +1 -1
  10. package/dist/components/api.js +1161 -1179
  11. package/dist/components/api.min.js +2 -2
  12. package/dist/components/breadcrumb.css +1 -1
  13. package/dist/components/breadcrumb.min.css +1 -1
  14. package/dist/components/button.css +71 -106
  15. package/dist/components/button.min.css +1 -1
  16. package/dist/components/calendar.css +18 -16
  17. package/dist/components/calendar.js +1895 -1809
  18. package/dist/components/calendar.min.css +2 -2
  19. package/dist/components/calendar.min.js +2 -2
  20. package/dist/components/card.css +83 -115
  21. package/dist/components/card.min.css +1 -1
  22. package/dist/components/checkbox.css +47 -64
  23. package/dist/components/checkbox.js +842 -841
  24. package/dist/components/checkbox.min.css +1 -1
  25. package/dist/components/checkbox.min.js +2 -2
  26. package/dist/components/comment.css +37 -51
  27. package/dist/components/comment.min.css +1 -1
  28. package/dist/components/container.css +6 -5
  29. package/dist/components/container.min.css +2 -2
  30. package/dist/components/dimmer.css +31 -41
  31. package/dist/components/dimmer.js +708 -737
  32. package/dist/components/dimmer.min.css +1 -1
  33. package/dist/components/dimmer.min.js +2 -2
  34. package/dist/components/divider.css +32 -44
  35. package/dist/components/divider.min.css +1 -1
  36. package/dist/components/dropdown.css +129 -166
  37. package/dist/components/dropdown.js +4161 -4234
  38. package/dist/components/dropdown.min.css +2 -2
  39. package/dist/components/dropdown.min.js +2 -2
  40. package/dist/components/embed.css +13 -19
  41. package/dist/components/embed.js +651 -675
  42. package/dist/components/embed.min.css +1 -1
  43. package/dist/components/embed.min.js +2 -2
  44. package/dist/components/emoji.css +7 -6
  45. package/dist/components/feed.css +24 -32
  46. package/dist/components/feed.min.css +1 -1
  47. package/dist/components/flag.css +5 -3
  48. package/dist/components/flag.min.css +1 -1
  49. package/dist/components/flyout.css +44 -58
  50. package/dist/components/flyout.js +1464 -1465
  51. package/dist/components/flyout.min.css +2 -2
  52. package/dist/components/flyout.min.js +2 -2
  53. package/dist/components/form.css +85 -111
  54. package/dist/components/form.js +1979 -2004
  55. package/dist/components/form.min.css +1 -1
  56. package/dist/components/form.min.js +2 -2
  57. package/dist/components/grid.css +70 -96
  58. package/dist/components/grid.min.css +1 -1
  59. package/dist/components/header.css +47 -65
  60. package/dist/components/header.min.css +1 -1
  61. package/dist/components/icon.css +45 -66
  62. package/dist/components/icon.min.css +2 -2
  63. package/dist/components/image.css +32 -42
  64. package/dist/components/image.min.css +1 -1
  65. package/dist/components/input.css +182 -65
  66. package/dist/components/input.min.css +2 -2
  67. package/dist/components/item.css +55 -77
  68. package/dist/components/item.min.css +1 -1
  69. package/dist/components/label.css +68 -91
  70. package/dist/components/label.min.css +2 -2
  71. package/dist/components/list.css +44 -59
  72. package/dist/components/list.min.css +1 -1
  73. package/dist/components/loader.css +16 -22
  74. package/dist/components/loader.min.css +1 -1
  75. package/dist/components/menu.css +126 -186
  76. package/dist/components/message.css +25 -35
  77. package/dist/components/message.min.css +1 -1
  78. package/dist/components/modal.css +39 -40
  79. package/dist/components/modal.js +1491 -1485
  80. package/dist/components/modal.min.css +2 -2
  81. package/dist/components/modal.min.js +2 -2
  82. package/dist/components/nag.css +21 -28
  83. package/dist/components/nag.js +518 -526
  84. package/dist/components/nag.min.css +2 -2
  85. package/dist/components/nag.min.js +2 -2
  86. package/dist/components/placeholder.css +10 -12
  87. package/dist/components/placeholder.min.css +1 -1
  88. package/dist/components/popup.css +352 -59
  89. package/dist/components/popup.js +1437 -1456
  90. package/dist/components/popup.min.css +2 -2
  91. package/dist/components/popup.min.js +2 -2
  92. package/dist/components/progress.css +29 -39
  93. package/dist/components/progress.js +969 -997
  94. package/dist/components/progress.min.css +1 -1
  95. package/dist/components/progress.min.js +2 -2
  96. package/dist/components/rail.css +15 -20
  97. package/dist/components/rail.min.css +1 -1
  98. package/dist/components/rating.css +9 -13
  99. package/dist/components/rating.js +505 -523
  100. package/dist/components/rating.min.css +1 -1
  101. package/dist/components/rating.min.js +2 -2
  102. package/dist/components/reset.css +1 -1
  103. package/dist/components/reset.min.css +1 -1
  104. package/dist/components/reveal.css +19 -26
  105. package/dist/components/reveal.min.css +1 -1
  106. package/dist/components/search.css +43 -58
  107. package/dist/components/search.js +1498 -1534
  108. package/dist/components/search.min.css +2 -2
  109. package/dist/components/search.min.js +2 -2
  110. package/dist/components/segment.css +64 -83
  111. package/dist/components/segment.min.css +2 -2
  112. package/dist/components/shape.css +10 -14
  113. package/dist/components/shape.js +792 -809
  114. package/dist/components/shape.min.css +1 -1
  115. package/dist/components/shape.min.js +2 -2
  116. package/dist/components/sidebar.css +43 -58
  117. package/dist/components/sidebar.js +1071 -1098
  118. package/dist/components/sidebar.min.css +2 -2
  119. package/dist/components/sidebar.min.js +2 -2
  120. package/dist/components/site.css +5 -5
  121. package/dist/components/site.js +462 -476
  122. package/dist/components/site.min.css +1 -1
  123. package/dist/components/site.min.js +2 -2
  124. package/dist/components/slider.css +27 -37
  125. package/dist/components/slider.js +1287 -1306
  126. package/dist/components/slider.min.js +2 -2
  127. package/dist/components/state.js +639 -657
  128. package/dist/components/state.min.js +2 -2
  129. package/dist/components/statistic.css +32 -41
  130. package/dist/components/statistic.min.css +2 -2
  131. package/dist/components/step.css +26 -35
  132. package/dist/components/step.min.css +1 -1
  133. package/dist/components/sticky.css +1 -1
  134. package/dist/components/sticky.js +857 -902
  135. package/dist/components/sticky.min.css +1 -1
  136. package/dist/components/sticky.min.js +2 -2
  137. package/dist/components/tab.css +6 -8
  138. package/dist/components/tab.js +922 -963
  139. package/dist/components/tab.min.css +1 -1
  140. package/dist/components/tab.min.js +2 -2
  141. package/dist/components/table.css +93 -119
  142. package/dist/components/table.min.css +2 -2
  143. package/dist/components/text.css +1 -1
  144. package/dist/components/text.min.css +1 -1
  145. package/dist/components/toast.css +4 -6
  146. package/dist/components/toast.js +886 -887
  147. package/dist/components/toast.min.css +1 -1
  148. package/dist/components/toast.min.js +2 -2
  149. package/dist/components/transition.css +150 -3
  150. package/dist/components/transition.js +1041 -1077
  151. package/dist/components/transition.min.css +2 -2
  152. package/dist/components/transition.min.js +2 -2
  153. package/dist/components/visibility.js +1220 -1244
  154. package/dist/components/visibility.min.js +2 -2
  155. package/dist/semantic.css +2529 -1778
  156. package/dist/semantic.js +28928 -29383
  157. package/dist/semantic.min.css +2 -2
  158. package/dist/semantic.min.js +2 -2
  159. package/dist/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  160. package/dist/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  161. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  162. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  163. package/dist/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  164. package/dist/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  165. package/dist/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  166. package/dist/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  167. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  168. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  169. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  170. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  171. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  172. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  173. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  174. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  175. package/examples/assets/show-examples.js +13 -13
  176. package/gulpfile.js +9 -10
  177. package/package.json +13 -8
  178. package/scripts/nightly-version.js +81 -75
  179. package/src/definitions/behaviors/api.js +1162 -1180
  180. package/src/definitions/behaviors/form.js +1978 -2003
  181. package/src/definitions/behaviors/state.js +645 -663
  182. package/src/definitions/behaviors/visibility.js +1219 -1243
  183. package/src/definitions/collections/breadcrumb.less +41 -44
  184. package/src/definitions/collections/form.less +869 -879
  185. package/src/definitions/collections/grid.less +1690 -1695
  186. package/src/definitions/collections/menu.less +1493 -1503
  187. package/src/definitions/collections/message.less +292 -295
  188. package/src/definitions/collections/table.less +1616 -1620
  189. package/src/definitions/elements/button.less +1721 -1743
  190. package/src/definitions/elements/container.less +209 -209
  191. package/src/definitions/elements/divider.less +205 -206
  192. package/src/definitions/elements/emoji.less +38 -44
  193. package/src/definitions/elements/flag.less +44 -46
  194. package/src/definitions/elements/header.less +337 -345
  195. package/src/definitions/elements/icon.less +516 -443
  196. package/src/definitions/elements/image.less +221 -225
  197. package/src/definitions/elements/input.less +663 -659
  198. package/src/definitions/elements/label.less +803 -793
  199. package/src/definitions/elements/list.less +809 -809
  200. package/src/definitions/elements/loader.less +272 -266
  201. package/src/definitions/elements/placeholder.less +171 -168
  202. package/src/definitions/elements/rail.less +91 -91
  203. package/src/definitions/elements/reveal.less +192 -196
  204. package/src/definitions/elements/segment.less +743 -746
  205. package/src/definitions/elements/step.less +425 -433
  206. package/src/definitions/elements/text.less +32 -34
  207. package/src/definitions/globals/reset.less +9 -6
  208. package/src/definitions/globals/site.js +461 -475
  209. package/src/definitions/globals/site.less +106 -108
  210. package/src/definitions/modules/accordion.js +567 -594
  211. package/src/definitions/modules/accordion.less +242 -246
  212. package/src/definitions/modules/calendar.js +1894 -1808
  213. package/src/definitions/modules/calendar.less +98 -95
  214. package/src/definitions/modules/checkbox.js +841 -840
  215. package/src/definitions/modules/checkbox.less +536 -542
  216. package/src/definitions/modules/dimmer.js +707 -736
  217. package/src/definitions/modules/dimmer.less +300 -297
  218. package/src/definitions/modules/dropdown.js +4160 -4233
  219. package/src/definitions/modules/dropdown.less +1577 -1589
  220. package/src/definitions/modules/embed.js +650 -674
  221. package/src/definitions/modules/embed.less +81 -82
  222. package/src/definitions/modules/flyout.js +1463 -1464
  223. package/src/definitions/modules/flyout.less +445 -451
  224. package/src/definitions/modules/modal.js +1490 -1484
  225. package/src/definitions/modules/modal.less +459 -459
  226. package/src/definitions/modules/nag.js +517 -525
  227. package/src/definitions/modules/nag.less +134 -138
  228. package/src/definitions/modules/popup.js +1436 -1455
  229. package/src/definitions/modules/popup.less +742 -687
  230. package/src/definitions/modules/progress.js +968 -996
  231. package/src/definitions/modules/progress.less +521 -494
  232. package/src/definitions/modules/rating.js +504 -522
  233. package/src/definitions/modules/rating.less +94 -101
  234. package/src/definitions/modules/search.js +1497 -1533
  235. package/src/definitions/modules/search.less +375 -382
  236. package/src/definitions/modules/shape.js +791 -808
  237. package/src/definitions/modules/shape.less +71 -76
  238. package/src/definitions/modules/sidebar.js +1070 -1097
  239. package/src/definitions/modules/sidebar.less +463 -472
  240. package/src/definitions/modules/slider.js +1286 -1305
  241. package/src/definitions/modules/slider.less +307 -308
  242. package/src/definitions/modules/sticky.js +873 -918
  243. package/src/definitions/modules/sticky.less +21 -23
  244. package/src/definitions/modules/tab.js +921 -962
  245. package/src/definitions/modules/tab.less +51 -52
  246. package/src/definitions/modules/toast.js +885 -886
  247. package/src/definitions/modules/toast.less +584 -586
  248. package/src/definitions/modules/transition.js +1040 -1076
  249. package/src/definitions/modules/transition.less +62 -28
  250. package/src/definitions/views/ad.less +206 -206
  251. package/src/definitions/views/card.less +968 -970
  252. package/src/definitions/views/comment.less +190 -198
  253. package/src/definitions/views/feed.less +220 -224
  254. package/src/definitions/views/item.less +436 -446
  255. package/src/definitions/views/statistic.less +271 -277
  256. package/src/theme.less +29 -32
  257. package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  258. package/src/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  259. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  260. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  261. package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  262. package/src/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  263. package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  264. package/src/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  265. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  266. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  267. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  268. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  269. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  270. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  271. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  272. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  273. package/src/themes/default/elements/container.variables +0 -7
  274. package/src/themes/default/elements/icon.variables +18 -0
  275. package/src/themes/default/elements/segment.variables +0 -7
  276. package/src/themes/default/globals/colors.less +589 -589
  277. package/src/themes/default/globals/site.variables +8 -0
  278. package/src/themes/default/globals/variation.variables +13 -1
  279. package/src/themes/default/modules/calendar.variables +2 -0
  280. package/src/themes/default/modules/nag.variables +1 -1
  281. package/src/themes/default/modules/popup.variables +2 -0
  282. package/src/themes/default/modules/transition.variables +8 -1
  283. package/tasks/admin/components/create.js +274 -276
  284. package/tasks/admin/components/init.js +123 -130
  285. package/tasks/admin/components/update.js +149 -157
  286. package/tasks/admin/distributions/create.js +184 -187
  287. package/tasks/admin/distributions/init.js +123 -130
  288. package/tasks/admin/distributions/update.js +145 -152
  289. package/tasks/admin/publish.js +5 -7
  290. package/tasks/admin/register.js +36 -38
  291. package/tasks/admin/release.js +8 -10
  292. package/tasks/build/assets.js +42 -39
  293. package/tasks/build/css.js +225 -216
  294. package/tasks/build/javascript.js +118 -113
  295. package/tasks/build.js +10 -10
  296. package/tasks/check-install.js +14 -16
  297. package/tasks/clean.js +5 -5
  298. package/tasks/collections/admin.js +34 -36
  299. package/tasks/collections/build.js +18 -20
  300. package/tasks/collections/docs.js +9 -11
  301. package/tasks/collections/install.js +9 -11
  302. package/tasks/collections/rtl.js +9 -11
  303. package/tasks/collections/various.js +8 -10
  304. package/tasks/config/admin/github.js +17 -17
  305. package/tasks/config/admin/oauth.example.js +4 -4
  306. package/tasks/config/admin/release.js +98 -98
  307. package/tasks/config/admin/templates/component-package.js +9 -10
  308. package/tasks/config/admin/templates/css-package.js +18 -20
  309. package/tasks/config/admin/templates/less-package.js +11 -13
  310. package/tasks/config/defaults.js +116 -114
  311. package/tasks/config/docs.js +23 -23
  312. package/tasks/config/npm/gulpfile.js +8 -9
  313. package/tasks/config/project/config.js +127 -134
  314. package/tasks/config/project/install.js +715 -713
  315. package/tasks/config/project/release.js +32 -38
  316. package/tasks/config/tasks.js +165 -156
  317. package/tasks/config/user.js +23 -26
  318. package/tasks/docs/build.js +97 -95
  319. package/tasks/docs/metadata.js +90 -96
  320. package/tasks/docs/serve.js +80 -81
  321. package/tasks/install.js +370 -378
  322. package/tasks/rtl/build.js +2 -2
  323. package/tasks/rtl/watch.js +2 -2
  324. package/tasks/version.js +4 -4
  325. package/tasks/watch.js +28 -30
  326. package/test/meteor/assets.js +10 -13
  327. package/test/meteor/fonts.js +12 -13
  328. package/test/modules/accordion.spec.js +6 -8
  329. package/test/modules/checkbox.spec.js +5 -7
  330. package/test/modules/dropdown.spec.js +5 -7
  331. package/test/modules/modal.spec.js +6 -8
  332. package/test/modules/module.spec.js +158 -178
  333. package/test/modules/popup.spec.js +5 -7
  334. package/test/modules/search.spec.js +5 -7
  335. package/test/modules/shape.spec.js +5 -7
  336. package/test/modules/sidebar.spec.js +5 -7
  337. package/test/modules/tab.spec.js +6 -8
  338. package/test/modules/transition.spec.js +5 -7
  339. package/test/modules/video.spec.js +5 -7
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.2+f5a64f3 - Transition
2
+ * # Fomantic-UI 2.9.1-beta.20+d4987bf - Transition
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -8,1107 +8,1071 @@
8
8
  *
9
9
  */
10
10
 
11
- ;(function ($, window, document, undefined) {
12
-
13
- 'use strict';
14
-
15
- $.isFunction = $.isFunction || function(obj) {
16
- return typeof obj === "function" && typeof obj.nodeType !== "number";
17
- };
18
-
19
- window = (typeof window != 'undefined' && window.Math == Math)
20
- ? window
21
- : (typeof self != 'undefined' && self.Math == Math)
22
- ? self
23
- : Function('return this')()
24
- ;
25
-
26
- $.fn.transition = function() {
27
- var
28
- $allModules = $(this),
29
- moduleSelector = $allModules.selector || '',
30
-
31
- time = new Date().getTime(),
32
- performance = [],
33
-
34
- moduleArguments = arguments,
35
- query = moduleArguments[0],
36
- queryArguments = [].slice.call(arguments, 1),
37
- methodInvoked = (typeof query === 'string'),
38
-
39
- returnedValue
40
- ;
41
- $allModules
42
- .each(function(index) {
43
- var
44
- $module = $(this),
45
- element = this,
46
-
47
- // set at run time
48
- settings,
49
- instance,
50
-
51
- error,
52
- className,
53
- metadata,
54
- animationEnd,
55
-
56
- moduleNamespace,
57
- eventNamespace,
58
- module
59
- ;
60
-
61
- module = {
62
-
63
- initialize: function() {
64
-
65
- // get full settings
66
- settings = module.get.settings.apply(element, moduleArguments);
67
-
68
- // shorthand
69
- className = settings.className;
70
- error = settings.error;
71
- metadata = settings.metadata;
72
-
73
- // define namespace
74
- eventNamespace = '.' + settings.namespace;
75
- moduleNamespace = 'module-' + settings.namespace;
76
- instance = $module.data(moduleNamespace) || module;
77
-
78
- // get vendor specific events
79
- animationEnd = module.get.animationEndEvent();
80
-
81
- if(methodInvoked) {
82
- methodInvoked = module.invoke(query);
83
- }
84
-
85
- // method not invoked, lets run an animation
86
- if(methodInvoked === false) {
87
- module.verbose('Converted arguments into settings object', settings);
88
- if(settings.interval) {
89
- module.delay(settings.interval);
90
- }
91
- else {
92
- module.animate();
93
- }
94
- module.instantiate();
95
- }
96
- },
97
-
98
- instantiate: function() {
99
- module.verbose('Storing instance of module', module);
100
- instance = module;
101
- $module
102
- .data(moduleNamespace, instance)
103
- ;
104
- },
105
-
106
- destroy: function() {
107
- module.verbose('Destroying previous module for', element);
108
- $module
109
- .removeData(moduleNamespace)
110
- ;
111
- },
112
-
113
- refresh: function() {
114
- module.verbose('Refreshing display type on next animation');
115
- delete module.displayType;
116
- },
117
-
118
- forceRepaint: function() {
119
- module.verbose('Forcing element repaint');
120
- var
121
- $parentElement = $module.parent(),
122
- $nextElement = $module.next()
123
- ;
124
- if($nextElement.length === 0) {
125
- $module.detach().appendTo($parentElement);
126
- }
127
- else {
128
- $module.detach().insertBefore($nextElement);
129
- }
130
- },
131
-
132
- repaint: function() {
133
- module.verbose('Repainting element');
134
- var
135
- fakeAssignment = element.offsetWidth
136
- ;
137
- },
11
+ (function ($, window, document, undefined) {
12
+ 'use strict';
138
13
 
139
- delay: function(interval) {
140
- var
141
- direction = module.get.animationDirection(),
142
- shouldReverse,
143
- delay
144
- ;
145
- if(!direction) {
146
- direction = module.can.transition()
147
- ? module.get.direction()
148
- : 'static'
149
- ;
150
- }
151
- interval = (interval !== undefined)
152
- ? interval
153
- : settings.interval
154
- ;
155
- shouldReverse = (settings.reverse == 'auto' && direction == className.outward);
156
- delay = (shouldReverse || settings.reverse === true)
157
- ? ($allModules.length - index) * interval
158
- : index * interval
159
- ;
160
- module.debug('Delaying animation by', delay);
161
- setTimeout(module.animate, delay);
162
- },
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
163
17
 
164
- animate: function(overrideSettings) {
165
- settings = overrideSettings || settings;
166
- if(!module.is.supported()) {
167
- module.error(error.support);
168
- return false;
169
- }
170
- module.debug('Preparing animation', settings.animation);
171
- if(module.is.animating()) {
172
- if(settings.queue) {
173
- if(!settings.allowRepeats && module.has.direction() && module.is.occurring() && module.queuing !== true) {
174
- module.debug('Animation is currently occurring, preventing queueing same animation', settings.animation);
175
- }
176
- else {
177
- module.queue(settings.animation);
178
- }
179
- return false;
180
- }
181
- else if(!settings.allowRepeats && module.is.occurring()) {
182
- module.debug('Animation is already occurring, will not execute repeated animation', settings.animation);
183
- return false;
184
- }
185
- else {
186
- module.debug('New animation started, completing previous early', settings.animation);
187
- instance.complete();
188
- }
189
- }
190
- if( module.can.animate() ) {
191
- module.set.animating(settings.animation);
192
- }
193
- else {
194
- module.error(error.noAnimation, settings.animation, element);
195
- }
196
- },
18
+ window = (typeof window != 'undefined' && window.Math == Math)
19
+ ? window
20
+ : globalThis;
197
21
 
198
- reset: function() {
199
- module.debug('Resetting animation to beginning conditions');
200
- module.remove.animationCallbacks();
201
- module.restore.conditions();
202
- module.remove.animating();
203
- },
22
+ $.fn.transition = function () {
23
+ var
24
+ $allModules = $(this),
25
+ moduleSelector = $allModules.selector || '',
204
26
 
205
- queue: function(animation) {
206
- module.debug('Queueing animation of', animation);
207
- module.queuing = true;
208
- $module
209
- .one(animationEnd + '.queue' + eventNamespace, function() {
210
- module.queuing = false;
211
- module.repaint();
212
- module.animate.apply(this, settings);
213
- })
214
- ;
215
- },
27
+ time = new Date().getTime(),
28
+ performance = [],
216
29
 
217
- complete: function (event) {
218
- if(event && event.target === element) {
219
- event.stopPropagation();
220
- }
221
- module.debug('Animation complete', settings.animation);
222
- module.remove.completeCallback();
223
- module.remove.failSafe();
224
- if(!module.is.looping()) {
225
- if( module.is.outward() ) {
226
- module.verbose('Animation is outward, hiding element');
227
- module.restore.conditions();
228
- module.hide();
229
- }
230
- else if( module.is.inward() ) {
231
- module.verbose('Animation is outward, showing element');
232
- module.restore.conditions();
233
- module.show();
234
- }
235
- else {
236
- module.verbose('Static animation completed');
237
- module.restore.conditions();
238
- settings.onComplete.call(element);
239
- }
240
- }
241
- },
30
+ moduleArguments = arguments,
31
+ query = moduleArguments[0],
32
+ queryArguments = [].slice.call(arguments, 1),
33
+ methodInvoked = (typeof query === 'string'),
242
34
 
243
- force: {
244
- visible: function() {
35
+ returnedValue
36
+ ;
37
+ $allModules.each(function (index) {
245
38
  var
246
- style = $module.attr('style'),
247
- userStyle = module.get.userStyle(style),
248
- displayType = module.get.displayType(),
249
- overrideStyle = userStyle + 'display: ' + displayType + ' !important;',
250
- inlineDisplay = $module[0].style.display,
251
- mustStayHidden = !displayType || (inlineDisplay === 'none' && settings.skipInlineHidden) || $module[0].tagName.match(/(script|link|style)/i)
252
- ;
253
- if (mustStayHidden){
254
- module.remove.transition();
255
- return false;
256
- }
257
- module.verbose('Overriding default display to show element', displayType);
258
- $module
259
- .attr('style', overrideStyle)
260
- ;
261
- return true;
262
- },
263
- hidden: function() {
264
- var
265
- style = $module.attr('style'),
266
- currentDisplay = $module.css('display'),
267
- emptyStyle = (style === undefined || style === '')
268
- ;
269
- if(currentDisplay !== 'none' && !module.is.hidden()) {
270
- module.verbose('Overriding default display to hide element');
271
- $module
272
- .css('display', 'none')
273
- ;
274
- }
275
- else if(emptyStyle) {
276
- $module
277
- .removeAttr('style')
278
- ;
279
- }
280
- }
281
- },
39
+ $module = $(this),
40
+ element = this,
282
41
 
283
- has: {
284
- direction: function(animation) {
285
- var
286
- hasDirection = false
287
- ;
288
- animation = animation || settings.animation;
289
- if(typeof animation === 'string') {
290
- animation = animation.split(' ');
291
- $.each(animation, function(index, word){
292
- if(word === className.inward || word === className.outward) {
293
- hasDirection = true;
294
- }
295
- });
296
- }
297
- return hasDirection;
298
- },
299
- inlineDisplay: function() {
300
- var
301
- style = $module.attr('style') || ''
302
- ;
303
- return Array.isArray(style.match(/display.*?;/, ''));
304
- }
305
- },
42
+ // set at run time
43
+ settings,
44
+ instance,
306
45
 
307
- set: {
308
- animating: function(animation) {
309
- // remove previous callbacks
310
- module.remove.completeCallback();
311
-
312
- // determine exact animation
313
- animation = animation || settings.animation;
314
- var animationClass = module.get.animationClass(animation);
315
-
316
- // save animation class in cache to restore class names
317
- module.save.animation(animationClass);
318
-
319
- if(module.force.visible()) {
320
- module.remove.hidden();
321
- module.remove.direction();
322
-
323
- module.start.animation(animationClass);
324
- }
325
- },
326
- duration: function(animationName, duration) {
327
- duration = duration || settings.duration;
328
- duration = (typeof duration == 'number')
329
- ? duration + 'ms'
330
- : duration
331
- ;
332
- if(duration || duration === 0) {
333
- module.verbose('Setting animation duration', duration);
334
- $module
335
- .css({
336
- 'animation-duration': duration
337
- })
338
- ;
339
- }
340
- },
341
- direction: function(direction) {
342
- direction = direction || module.get.direction();
343
- if(direction == className.inward) {
344
- module.set.inward();
345
- }
346
- else {
347
- module.set.outward();
348
- }
349
- },
350
- looping: function() {
351
- module.debug('Transition set to loop');
352
- $module
353
- .addClass(className.looping)
354
- ;
355
- },
356
- hidden: function() {
357
- $module
358
- .addClass(className.transition)
359
- .addClass(className.hidden)
360
- ;
361
- },
362
- inward: function() {
363
- module.debug('Setting direction to inward');
364
- $module
365
- .removeClass(className.outward)
366
- .addClass(className.inward)
367
- ;
368
- },
369
- outward: function() {
370
- module.debug('Setting direction to outward');
371
- $module
372
- .removeClass(className.inward)
373
- .addClass(className.outward)
374
- ;
375
- },
376
- visible: function() {
377
- $module
378
- .addClass(className.transition)
379
- .addClass(className.visible)
380
- ;
381
- }
382
- },
46
+ error,
47
+ className,
48
+ metadata,
49
+ animationEnd,
383
50
 
384
- start: {
385
- animation: function(animationClass) {
386
- animationClass = animationClass || module.get.animationClass();
387
- module.debug('Starting tween', animationClass);
388
- $module
389
- .addClass(animationClass)
390
- .one(animationEnd + '.complete' + eventNamespace, module.complete)
51
+ moduleNamespace,
52
+ eventNamespace,
53
+ module
391
54
  ;
392
- if(settings.useFailSafe) {
393
- module.add.failSafe();
394
- }
395
- module.set.duration(settings.duration);
396
- settings.onStart.call(element);
397
- }
398
- },
399
55
 
400
- save: {
401
- animation: function(animation) {
402
- if(!module.cache) {
403
- module.cache = {};
404
- }
405
- module.cache.animation = animation;
406
- },
407
- displayType: function(displayType) {
408
- if(displayType !== 'none') {
409
- $module.data(metadata.displayType, displayType);
410
- }
411
- },
412
- transitionExists: function(animation, exists) {
413
- $.fn.transition.exists[animation] = exists;
414
- module.verbose('Saving existence of transition', animation, exists);
415
- }
56
+ module = {
57
+
58
+ initialize: function () {
59
+ // get full settings
60
+ settings = module.get.settings.apply(element, moduleArguments);
61
+
62
+ // shorthand
63
+ className = settings.className;
64
+ error = settings.error;
65
+ metadata = settings.metadata;
66
+
67
+ // define namespace
68
+ eventNamespace = '.' + settings.namespace;
69
+ moduleNamespace = 'module-' + settings.namespace;
70
+ instance = $module.data(moduleNamespace) || module;
71
+
72
+ // get vendor specific events
73
+ animationEnd = module.get.animationEndEvent();
74
+
75
+ if (methodInvoked) {
76
+ methodInvoked = module.invoke(query);
77
+ }
78
+
79
+ // method not invoked, lets run an animation
80
+ if (methodInvoked === false) {
81
+ module.verbose('Converted arguments into settings object', settings);
82
+ if (settings.interval) {
83
+ module.delay(settings.interval);
84
+ } else {
85
+ module.animate();
86
+ }
87
+ module.instantiate();
88
+ }
89
+ },
90
+
91
+ instantiate: function () {
92
+ module.verbose('Storing instance of module', module);
93
+ instance = module;
94
+ $module
95
+ .data(moduleNamespace, instance)
96
+ ;
97
+ },
98
+
99
+ destroy: function () {
100
+ module.verbose('Destroying previous module for', element);
101
+ $module
102
+ .removeData(moduleNamespace)
103
+ ;
104
+ },
105
+
106
+ refresh: function () {
107
+ module.verbose('Refreshing display type on next animation');
108
+ delete module.displayType;
109
+ },
110
+
111
+ forceRepaint: function () {
112
+ module.verbose('Forcing element repaint');
113
+ var
114
+ $parentElement = $module.parent(),
115
+ $nextElement = $module.next()
116
+ ;
117
+ if ($nextElement.length === 0) {
118
+ $module.detach().appendTo($parentElement);
119
+ } else {
120
+ $module.detach().insertBefore($nextElement);
121
+ }
122
+ },
123
+
124
+ repaint: function () {
125
+ module.verbose('Repainting element');
126
+ var
127
+ fakeAssignment = element.offsetWidth
128
+ ;
129
+ },
130
+
131
+ delay: function (interval) {
132
+ var
133
+ direction = module.get.animationDirection(),
134
+ shouldReverse,
135
+ delay
136
+ ;
137
+ if (!direction) {
138
+ direction = module.can.transition()
139
+ ? module.get.direction()
140
+ : 'static';
141
+ }
142
+ interval = (interval !== undefined)
143
+ ? interval
144
+ : settings.interval;
145
+ shouldReverse = (settings.reverse == 'auto' && direction == className.outward);
146
+ delay = (shouldReverse || settings.reverse === true)
147
+ ? ($allModules.length - index) * interval
148
+ : index * interval;
149
+ module.debug('Delaying animation by', delay);
150
+ setTimeout(module.animate, delay);
151
+ },
152
+
153
+ animate: function (overrideSettings) {
154
+ settings = overrideSettings || settings;
155
+ if (!module.is.supported()) {
156
+ module.error(error.support);
157
+
158
+ return false;
159
+ }
160
+ module.debug('Preparing animation', settings.animation);
161
+ if (module.is.animating()) {
162
+ if (settings.queue) {
163
+ if (!settings.allowRepeats && module.has.direction() && module.is.occurring() && module.queuing !== true) {
164
+ module.debug('Animation is currently occurring, preventing queueing same animation', settings.animation);
165
+ } else {
166
+ module.queue(settings.animation);
167
+ }
168
+
169
+ return false;
170
+ } else if (!settings.allowRepeats && module.is.occurring()) {
171
+ module.debug('Animation is already occurring, will not execute repeated animation', settings.animation);
172
+
173
+ return false;
174
+ } else {
175
+ module.debug('New animation started, completing previous early', settings.animation);
176
+ instance.complete();
177
+ }
178
+ }
179
+ if (module.can.animate()) {
180
+ module.set.animating(settings.animation);
181
+ } else {
182
+ module.error(error.noAnimation, settings.animation, element);
183
+ }
184
+ },
185
+
186
+ reset: function () {
187
+ module.debug('Resetting animation to beginning conditions');
188
+ module.remove.animationCallbacks();
189
+ module.restore.conditions();
190
+ module.remove.animating();
191
+ },
192
+
193
+ queue: function (animation) {
194
+ module.debug('Queueing animation of', animation);
195
+ module.queuing = true;
196
+ $module
197
+ .one(animationEnd + '.queue' + eventNamespace, function () {
198
+ module.queuing = false;
199
+ module.repaint();
200
+ module.animate.apply(this, settings);
201
+ })
202
+ ;
203
+ },
204
+
205
+ complete: function (event) {
206
+ if (event && event.target === element) {
207
+ event.stopPropagation();
208
+ }
209
+ module.debug('Animation complete', settings.animation);
210
+ module.remove.completeCallback();
211
+ module.remove.failSafe();
212
+ if (!module.is.looping()) {
213
+ if (module.is.outward()) {
214
+ module.verbose('Animation is outward, hiding element');
215
+ module.restore.conditions();
216
+ module.hide();
217
+ } else if (module.is.inward()) {
218
+ module.verbose('Animation is outward, showing element');
219
+ module.restore.conditions();
220
+ module.show();
221
+ } else {
222
+ module.verbose('Static animation completed');
223
+ module.restore.conditions();
224
+ settings.onComplete.call(element);
225
+ }
226
+ }
227
+ },
228
+
229
+ force: {
230
+ visible: function () {
231
+ var
232
+ style = $module.attr('style'),
233
+ userStyle = module.get.userStyle(style),
234
+ displayType = module.get.displayType(),
235
+ overrideStyle = userStyle + 'display: ' + displayType + ' !important;',
236
+ inlineDisplay = $module[0].style.display,
237
+ mustStayHidden = !displayType || (inlineDisplay === 'none' && settings.skipInlineHidden) || $module[0].tagName.match(/(script|link|style)/i)
238
+ ;
239
+ if (mustStayHidden) {
240
+ module.remove.transition();
241
+
242
+ return false;
243
+ }
244
+ module.verbose('Overriding default display to show element', displayType);
245
+ $module
246
+ .attr('style', overrideStyle)
247
+ ;
248
+
249
+ return true;
250
+ },
251
+ hidden: function () {
252
+ var
253
+ style = $module.attr('style'),
254
+ currentDisplay = $module.css('display'),
255
+ emptyStyle = (style === undefined || style === '')
256
+ ;
257
+ if (currentDisplay !== 'none' && !module.is.hidden()) {
258
+ module.verbose('Overriding default display to hide element');
259
+ $module
260
+ .css('display', 'none')
261
+ ;
262
+ } else if (emptyStyle) {
263
+ $module
264
+ .removeAttr('style')
265
+ ;
266
+ }
267
+ },
268
+ },
269
+
270
+ has: {
271
+ direction: function (animation) {
272
+ var
273
+ hasDirection = false
274
+ ;
275
+ animation = animation || settings.animation;
276
+ if (typeof animation === 'string') {
277
+ animation = animation.split(' ');
278
+ $.each(animation, function (index, word) {
279
+ if (word === className.inward || word === className.outward) {
280
+ hasDirection = true;
281
+ }
282
+ });
283
+ }
284
+
285
+ return hasDirection;
286
+ },
287
+ inlineDisplay: function () {
288
+ var
289
+ style = $module.attr('style') || ''
290
+ ;
291
+
292
+ return Array.isArray(style.match(/display.*?;/, ''));
293
+ },
294
+ },
295
+
296
+ set: {
297
+ animating: function (animation) {
298
+ // remove previous callbacks
299
+ module.remove.completeCallback();
300
+
301
+ // determine exact animation
302
+ animation = animation || settings.animation;
303
+ var animationClass = module.get.animationClass(animation);
304
+
305
+ // save animation class in cache to restore class names
306
+ module.save.animation(animationClass);
307
+
308
+ if (module.force.visible()) {
309
+ module.remove.hidden();
310
+ module.remove.direction();
311
+
312
+ module.start.animation(animationClass);
313
+ }
314
+ },
315
+ duration: function (animationName, duration) {
316
+ duration = duration || settings.duration;
317
+ duration = (typeof duration == 'number')
318
+ ? duration + 'ms'
319
+ : duration;
320
+ if (duration || duration === 0) {
321
+ module.verbose('Setting animation duration', duration);
322
+ $module
323
+ .css({
324
+ 'animation-duration': duration,
325
+ })
326
+ ;
327
+ }
328
+ },
329
+ direction: function (direction) {
330
+ direction = direction || module.get.direction();
331
+ if (direction == className.inward) {
332
+ module.set.inward();
333
+ } else {
334
+ module.set.outward();
335
+ }
336
+ },
337
+ looping: function () {
338
+ module.debug('Transition set to loop');
339
+ $module
340
+ .addClass(className.looping)
341
+ ;
342
+ },
343
+ hidden: function () {
344
+ $module
345
+ .addClass(className.transition)
346
+ .addClass(className.hidden)
347
+ ;
348
+ },
349
+ inward: function () {
350
+ module.debug('Setting direction to inward');
351
+ $module
352
+ .removeClass(className.outward)
353
+ .addClass(className.inward)
354
+ ;
355
+ },
356
+ outward: function () {
357
+ module.debug('Setting direction to outward');
358
+ $module
359
+ .removeClass(className.inward)
360
+ .addClass(className.outward)
361
+ ;
362
+ },
363
+ visible: function () {
364
+ $module
365
+ .addClass(className.transition)
366
+ .addClass(className.visible)
367
+ ;
368
+ },
369
+ },
370
+
371
+ start: {
372
+ animation: function (animationClass) {
373
+ animationClass = animationClass || module.get.animationClass();
374
+ module.debug('Starting tween', animationClass);
375
+ $module
376
+ .addClass(animationClass)
377
+ .one(animationEnd + '.complete' + eventNamespace, module.complete)
378
+ ;
379
+ if (settings.useFailSafe) {
380
+ module.add.failSafe();
381
+ }
382
+ module.set.duration(settings.duration);
383
+ settings.onStart.call(element);
384
+ },
385
+ },
386
+
387
+ save: {
388
+ animation: function (animation) {
389
+ if (!module.cache) {
390
+ module.cache = {};
391
+ }
392
+ module.cache.animation = animation;
393
+ },
394
+ displayType: function (displayType) {
395
+ if (displayType !== 'none') {
396
+ $module.data(metadata.displayType, displayType);
397
+ }
398
+ },
399
+ transitionExists: function (animation, exists) {
400
+ $.fn.transition.exists[animation] = exists;
401
+ module.verbose('Saving existence of transition', animation, exists);
402
+ },
403
+ },
404
+
405
+ restore: {
406
+ conditions: function () {
407
+ var
408
+ animation = module.get.currentAnimation()
409
+ ;
410
+ if (animation) {
411
+ $module
412
+ .removeClass(animation)
413
+ ;
414
+ module.verbose('Removing animation class', module.cache);
415
+ }
416
+ module.remove.duration();
417
+ },
418
+ },
419
+
420
+ add: {
421
+ failSafe: function () {
422
+ var
423
+ duration = module.get.duration()
424
+ ;
425
+ module.timer = setTimeout(function () {
426
+ $module.triggerHandler(animationEnd);
427
+ }, duration + settings.failSafeDelay);
428
+ module.verbose('Adding fail safe timer', module.timer);
429
+ },
430
+ },
431
+
432
+ remove: {
433
+ animating: function () {
434
+ $module.removeClass(className.animating);
435
+ },
436
+ animationCallbacks: function () {
437
+ module.remove.queueCallback();
438
+ module.remove.completeCallback();
439
+ },
440
+ queueCallback: function () {
441
+ $module.off('.queue' + eventNamespace);
442
+ },
443
+ completeCallback: function () {
444
+ $module.off('.complete' + eventNamespace);
445
+ },
446
+ display: function () {
447
+ $module.css('display', '');
448
+ },
449
+ direction: function () {
450
+ $module
451
+ .removeClass(className.inward)
452
+ .removeClass(className.outward)
453
+ ;
454
+ },
455
+ duration: function () {
456
+ $module
457
+ .css('animation-duration', '')
458
+ ;
459
+ },
460
+ failSafe: function () {
461
+ module.verbose('Removing fail safe timer', module.timer);
462
+ if (module.timer) {
463
+ clearTimeout(module.timer);
464
+ }
465
+ },
466
+ hidden: function () {
467
+ $module.removeClass(className.hidden);
468
+ },
469
+ visible: function () {
470
+ $module.removeClass(className.visible);
471
+ },
472
+ looping: function () {
473
+ module.debug('Transitions are no longer looping');
474
+ if (module.is.looping()) {
475
+ module.reset();
476
+ $module
477
+ .removeClass(className.looping)
478
+ ;
479
+ }
480
+ },
481
+ transition: function () {
482
+ $module
483
+ .removeClass(className.transition)
484
+ .removeClass(className.visible)
485
+ .removeClass(className.hidden)
486
+ ;
487
+ },
488
+ },
489
+ get: {
490
+ settings: function (animation, duration, onComplete) {
491
+ if (typeof animation == 'object') { // single settings object
492
+ return $.extend(true, {}, $.fn.transition.settings, animation);
493
+ } else if (typeof onComplete == 'function') { // all arguments provided
494
+ return $.extend({}, $.fn.transition.settings, {
495
+ animation: animation,
496
+ onComplete: onComplete,
497
+ duration: duration,
498
+ });
499
+ } else if (typeof duration == 'string' || typeof duration == 'number') { // only duration provided
500
+ return $.extend({}, $.fn.transition.settings, {
501
+ animation: animation,
502
+ duration: duration,
503
+ });
504
+ } else if (typeof duration == 'object') { // duration is actually settings object
505
+ return $.extend({}, $.fn.transition.settings, duration, {
506
+ animation: animation,
507
+ });
508
+ } else if (typeof duration == 'function') { // duration is actually callback
509
+ return $.extend({}, $.fn.transition.settings, {
510
+ animation: animation,
511
+ onComplete: duration,
512
+ });
513
+ } else { // only animation provided
514
+ return $.extend({}, $.fn.transition.settings, {
515
+ animation: animation,
516
+ });
517
+ }
518
+ },
519
+ animationClass: function (animation) {
520
+ var
521
+ animationClass = animation || settings.animation,
522
+ directionClass = (module.can.transition() && !module.has.direction())
523
+ ? module.get.direction() + ' '
524
+ : ''
525
+ ;
526
+
527
+ return className.animating + ' '
528
+ + className.transition + ' '
529
+ + directionClass
530
+ + animationClass;
531
+ },
532
+ currentAnimation: function () {
533
+ return (module.cache && module.cache.animation !== undefined)
534
+ ? module.cache.animation
535
+ : false;
536
+ },
537
+ currentDirection: function () {
538
+ return module.is.inward()
539
+ ? className.inward
540
+ : className.outward;
541
+ },
542
+ direction: function () {
543
+ return module.is.hidden() || !module.is.visible()
544
+ ? className.inward
545
+ : className.outward;
546
+ },
547
+ animationDirection: function (animation) {
548
+ var
549
+ direction
550
+ ;
551
+ animation = animation || settings.animation;
552
+ if (typeof animation === 'string') {
553
+ animation = animation.split(' ');
554
+ // search animation name for out/in class
555
+ $.each(animation, function (index, word) {
556
+ if (word === className.inward) {
557
+ direction = className.inward;
558
+ } else if (word === className.outward) {
559
+ direction = className.outward;
560
+ }
561
+ });
562
+ }
563
+ // return found direction
564
+ if (direction) {
565
+ return direction;
566
+ }
567
+
568
+ return false;
569
+ },
570
+ duration: function (duration) {
571
+ duration = duration || settings.duration;
572
+ if (duration === false) {
573
+ duration = $module.css('animation-duration') || 0;
574
+ }
575
+
576
+ return (typeof duration === 'string')
577
+ ? (duration.indexOf('ms') > -1)
578
+ ? parseFloat(duration)
579
+ : parseFloat(duration) * 1000
580
+ : duration;
581
+ },
582
+ displayType: function (shouldDetermine) {
583
+ shouldDetermine = (shouldDetermine !== undefined)
584
+ ? shouldDetermine
585
+ : true;
586
+ if (settings.displayType) {
587
+ return settings.displayType;
588
+ }
589
+ if (shouldDetermine && $module.data(metadata.displayType) === undefined) {
590
+ var currentDisplay = $module.css('display');
591
+ if (currentDisplay === '' || currentDisplay === 'none') {
592
+ // create fake element to determine display state
593
+ module.can.transition(true);
594
+ } else {
595
+ module.save.displayType(currentDisplay);
596
+ }
597
+ }
598
+
599
+ return $module.data(metadata.displayType);
600
+ },
601
+ userStyle: function (style) {
602
+ style = style || $module.attr('style') || '';
603
+
604
+ return style.replace(/display.*?;/, '');
605
+ },
606
+ transitionExists: function (animation) {
607
+ return $.fn.transition.exists[animation];
608
+ },
609
+ animationStartEvent: function () {
610
+ var
611
+ element = document.createElement('div'),
612
+ animations = {
613
+ animation: 'animationstart',
614
+ OAnimation: 'oAnimationStart',
615
+ MozAnimation: 'mozAnimationStart',
616
+ WebkitAnimation: 'webkitAnimationStart',
617
+ },
618
+ animation
619
+ ;
620
+ for (animation in animations) {
621
+ if (element.style[animation] !== undefined) {
622
+ return animations[animation];
623
+ }
624
+ }
625
+
626
+ return false;
627
+ },
628
+ animationEndEvent: function () {
629
+ var
630
+ element = document.createElement('div'),
631
+ animations = {
632
+ animation: 'animationend',
633
+ OAnimation: 'oAnimationEnd',
634
+ MozAnimation: 'mozAnimationEnd',
635
+ WebkitAnimation: 'webkitAnimationEnd',
636
+ },
637
+ animation
638
+ ;
639
+ for (animation in animations) {
640
+ if (element.style[animation] !== undefined) {
641
+ return animations[animation];
642
+ }
643
+ }
644
+
645
+ return false;
646
+ },
647
+
648
+ },
649
+
650
+ can: {
651
+ transition: function (forced) {
652
+ var
653
+ animation = settings.animation,
654
+ transitionExists = module.get.transitionExists(animation),
655
+ displayType = module.get.displayType(false),
656
+ elementClass,
657
+ tagName,
658
+ $clone,
659
+ currentAnimation,
660
+ inAnimation,
661
+ directionExists
662
+ ;
663
+ if (transitionExists === undefined || forced) {
664
+ module.verbose('Determining whether animation exists');
665
+ elementClass = $module.attr('class');
666
+ tagName = $module.prop('tagName');
667
+
668
+ $clone = $('<' + tagName + ' />').addClass(elementClass).insertAfter($module);
669
+ currentAnimation = $clone
670
+ .addClass(animation)
671
+ .removeClass(className.inward)
672
+ .removeClass(className.outward)
673
+ .addClass(className.animating)
674
+ .addClass(className.transition)
675
+ .css('animationName')
676
+ ;
677
+ $clone.detach().insertAfter($module);
678
+ inAnimation = $clone
679
+ .addClass(className.inward)
680
+ .css('animationName')
681
+ ;
682
+ if (!displayType) {
683
+ $clone.detach().insertAfter($module);
684
+ displayType = $clone
685
+ .attr('class', elementClass)
686
+ .removeAttr('style')
687
+ .removeClass(className.hidden)
688
+ .removeClass(className.visible)
689
+ .show()
690
+ .css('display')
691
+ ;
692
+ module.verbose('Determining final display state', displayType);
693
+ module.save.displayType(displayType);
694
+ }
695
+
696
+ $clone.remove();
697
+ if (currentAnimation != inAnimation) {
698
+ module.debug('Direction exists for animation', animation);
699
+ directionExists = true;
700
+ } else if (currentAnimation == 'none' || !currentAnimation) {
701
+ module.debug('No animation defined in css', animation);
702
+
703
+ return;
704
+ } else {
705
+ module.debug('Static animation found', animation, displayType);
706
+ directionExists = false;
707
+ }
708
+ module.save.transitionExists(animation, directionExists);
709
+ }
710
+
711
+ return (transitionExists !== undefined)
712
+ ? transitionExists
713
+ : directionExists;
714
+ },
715
+ animate: function () {
716
+ // can transition does not return a value if animation does not exist
717
+ return (module.can.transition() !== undefined);
718
+ },
719
+ },
720
+
721
+ is: {
722
+ animating: function () {
723
+ return $module.hasClass(className.animating);
724
+ },
725
+ inward: function () {
726
+ return $module.hasClass(className.inward);
727
+ },
728
+ outward: function () {
729
+ return $module.hasClass(className.outward);
730
+ },
731
+ looping: function () {
732
+ return $module.hasClass(className.looping);
733
+ },
734
+ occurring: function (animation) {
735
+ animation = animation || settings.animation;
736
+ animation = '.' + animation.replace(' ', '.');
737
+
738
+ return ($module.filter(animation).length > 0);
739
+ },
740
+ visible: function () {
741
+ return $module.is(':visible');
742
+ },
743
+ hidden: function () {
744
+ return $module.css('visibility') === 'hidden';
745
+ },
746
+ supported: function () {
747
+ return (animationEnd !== false);
748
+ },
749
+ },
750
+
751
+ hide: function () {
752
+ if (settings.onHide.call(element) === false) {
753
+ module.verbose('Hide callback returned false cancelling hide');
754
+
755
+ return false;
756
+ }
757
+ module.verbose('Hiding element');
758
+ if (module.is.animating()) {
759
+ module.reset();
760
+ }
761
+ element.blur(); // IE will trigger focus change if element is not blurred before hiding
762
+ module.remove.display();
763
+ module.remove.visible();
764
+ settings.onBeforeHide.call(element, module.hideNow);
765
+ },
766
+
767
+ hideNow: function () {
768
+ module.set.hidden();
769
+ module.force.hidden();
770
+ settings.onHidden.call(element);
771
+ settings.onComplete.call(element);
772
+ },
773
+
774
+ show: function (display) {
775
+ if (module.force.visible() && settings.onShow.call(element) !== false) {
776
+ module.verbose('Showing element', display);
777
+ module.remove.hidden();
778
+ settings.onBeforeShow.call(element, module.showNow);
779
+ }
780
+ },
781
+
782
+ showNow: function () {
783
+ module.set.visible();
784
+ settings.onVisible.call(element);
785
+ settings.onComplete.call(element);
786
+ },
787
+
788
+ toggle: function () {
789
+ if (module.is.visible()) {
790
+ module.hide();
791
+ } else {
792
+ module.show();
793
+ }
794
+ },
795
+
796
+ stop: function () {
797
+ module.debug('Stopping current animation');
798
+ $module.triggerHandler(animationEnd);
799
+ },
800
+
801
+ stopAll: function () {
802
+ module.debug('Stopping all animation');
803
+ module.remove.queueCallback();
804
+ $module.triggerHandler(animationEnd);
805
+ },
806
+
807
+ clear: {
808
+ queue: function () {
809
+ module.debug('Clearing animation queue');
810
+ module.remove.queueCallback();
811
+ },
812
+ },
813
+
814
+ enable: function () {
815
+ module.verbose('Starting animation');
816
+ $module.removeClass(className.disabled);
817
+ },
818
+
819
+ disable: function () {
820
+ module.debug('Stopping animation');
821
+ $module.addClass(className.disabled);
822
+ },
823
+
824
+ setting: function (name, value) {
825
+ module.debug('Changing setting', name, value);
826
+ if ($.isPlainObject(name)) {
827
+ $.extend(true, settings, name);
828
+ } else if (value !== undefined) {
829
+ if ($.isPlainObject(settings[name])) {
830
+ $.extend(true, settings[name], value);
831
+ } else {
832
+ settings[name] = value;
833
+ }
834
+ } else {
835
+ return settings[name];
836
+ }
837
+ },
838
+ internal: function (name, value) {
839
+ if ($.isPlainObject(name)) {
840
+ $.extend(true, module, name);
841
+ } else if (value !== undefined) {
842
+ module[name] = value;
843
+ } else {
844
+ return module[name];
845
+ }
846
+ },
847
+ debug: function () {
848
+ if (!settings.silent && settings.debug) {
849
+ if (settings.performance) {
850
+ module.performance.log(arguments);
851
+ } else {
852
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
853
+ module.debug.apply(console, arguments);
854
+ }
855
+ }
856
+ },
857
+ verbose: function () {
858
+ if (!settings.silent && settings.verbose && settings.debug) {
859
+ if (settings.performance) {
860
+ module.performance.log(arguments);
861
+ } else {
862
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
863
+ module.verbose.apply(console, arguments);
864
+ }
865
+ }
866
+ },
867
+ error: function () {
868
+ if (!settings.silent) {
869
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
870
+ module.error.apply(console, arguments);
871
+ }
872
+ },
873
+ performance: {
874
+ log: function (message) {
875
+ var
876
+ currentTime,
877
+ executionTime,
878
+ previousTime
879
+ ;
880
+ if (settings.performance) {
881
+ currentTime = new Date().getTime();
882
+ previousTime = time || currentTime;
883
+ executionTime = currentTime - previousTime;
884
+ time = currentTime;
885
+ performance.push({
886
+ Name: message[0],
887
+ Arguments: [].slice.call(message, 1) || '',
888
+ Element: element,
889
+ 'Execution Time': executionTime,
890
+ });
891
+ }
892
+ clearTimeout(module.performance.timer);
893
+ module.performance.timer = setTimeout(module.performance.display, 500);
894
+ },
895
+ display: function () {
896
+ var
897
+ title = settings.name + ':',
898
+ totalTime = 0
899
+ ;
900
+ time = false;
901
+ clearTimeout(module.performance.timer);
902
+ $.each(performance, function (index, data) {
903
+ totalTime += data['Execution Time'];
904
+ });
905
+ title += ' ' + totalTime + 'ms';
906
+ if (moduleSelector) {
907
+ title += ' \'' + moduleSelector + '\'';
908
+ }
909
+ if ($allModules.length > 1) {
910
+ title += ' ' + '(' + $allModules.length + ')';
911
+ }
912
+ if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
913
+ console.groupCollapsed(title);
914
+ if (console.table) {
915
+ console.table(performance);
916
+ } else {
917
+ $.each(performance, function (index, data) {
918
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
919
+ });
920
+ }
921
+ console.groupEnd();
922
+ }
923
+ performance = [];
924
+ },
925
+ },
926
+ // modified for transition to return invoke success
927
+ invoke: function (query, passedArguments, context) {
928
+ var
929
+ object = instance,
930
+ maxDepth,
931
+ found,
932
+ response
933
+ ;
934
+ passedArguments = passedArguments || queryArguments;
935
+ context = context || element;
936
+ if (typeof query == 'string' && object !== undefined) {
937
+ query = query.split(/[\. ]/);
938
+ maxDepth = query.length - 1;
939
+ $.each(query, function (depth, value) {
940
+ var camelCaseValue = (depth != maxDepth)
941
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
942
+ : query
943
+ ;
944
+ if ($.isPlainObject(object[camelCaseValue]) && (depth != maxDepth)) {
945
+ object = object[camelCaseValue];
946
+ } else if (object[camelCaseValue] !== undefined) {
947
+ found = object[camelCaseValue];
948
+
949
+ return false;
950
+ } else if ($.isPlainObject(object[value]) && (depth != maxDepth)) {
951
+ object = object[value];
952
+ } else if (object[value] !== undefined) {
953
+ found = object[value];
954
+
955
+ return false;
956
+ } else {
957
+ return false;
958
+ }
959
+ });
960
+ }
961
+ if (isFunction(found)) {
962
+ response = found.apply(context, passedArguments);
963
+ } else if (found !== undefined) {
964
+ response = found;
965
+ }
966
+
967
+ if (Array.isArray(returnedValue)) {
968
+ returnedValue.push(response);
969
+ } else if (returnedValue !== undefined) {
970
+ returnedValue = [returnedValue, response];
971
+ } else if (response !== undefined) {
972
+ returnedValue = response;
973
+ }
974
+
975
+ return (found !== undefined)
976
+ ? found
977
+ : false;
978
+ },
979
+ };
980
+ module.initialize();
981
+ });
982
+
983
+ return (returnedValue !== undefined)
984
+ ? returnedValue
985
+ : this;
986
+ };
987
+
988
+ // Records if CSS transition is available
989
+ $.fn.transition.exists = {};
990
+
991
+ $.fn.transition.settings = {
992
+
993
+ // module info
994
+ name: 'Transition',
995
+
996
+ // hide all output from this component regardless of other settings
997
+ silent: false,
998
+
999
+ // debug content outputted to console
1000
+ debug: false,
1001
+
1002
+ // verbose debug output
1003
+ verbose: false,
1004
+
1005
+ // performance data output
1006
+ performance: true,
1007
+
1008
+ // event namespace
1009
+ namespace: 'transition',
1010
+
1011
+ // delay between animations in group
1012
+ interval: 0,
1013
+
1014
+ // whether group animations should be reversed
1015
+ reverse: 'auto',
1016
+
1017
+ // animation callback event
1018
+ onStart: function () {},
1019
+ onComplete: function () {},
1020
+ onShow: function () {},
1021
+ onBeforeShow: function (callback) {
1022
+ callback.call(this);
416
1023
  },
417
-
418
- restore: {
419
- conditions: function() {
420
- var
421
- animation = module.get.currentAnimation()
422
- ;
423
- if(animation) {
424
- $module
425
- .removeClass(animation)
426
- ;
427
- module.verbose('Removing animation class', module.cache);
428
- }
429
- module.remove.duration();
430
- }
1024
+ onVisible: function () {},
1025
+ onHide: function () {},
1026
+ onHidden: function () {},
1027
+ onBeforeHide: function (callback) {
1028
+ callback.call(this);
431
1029
  },
432
1030
 
433
- add: {
434
- failSafe: function() {
435
- var
436
- duration = module.get.duration()
437
- ;
438
- module.timer = setTimeout(function() {
439
- $module.triggerHandler(animationEnd);
440
- }, duration + settings.failSafeDelay);
441
- module.verbose('Adding fail safe timer', module.timer);
442
- }
443
- },
1031
+ // whether timeout should be used to ensure callback fires in cases animationend does not
1032
+ useFailSafe: true,
444
1033
 
445
- remove: {
446
- animating: function() {
447
- $module.removeClass(className.animating);
448
- },
449
- animationCallbacks: function() {
450
- module.remove.queueCallback();
451
- module.remove.completeCallback();
452
- },
453
- queueCallback: function() {
454
- $module.off('.queue' + eventNamespace);
455
- },
456
- completeCallback: function() {
457
- $module.off('.complete' + eventNamespace);
458
- },
459
- display: function() {
460
- $module.css('display', '');
461
- },
462
- direction: function() {
463
- $module
464
- .removeClass(className.inward)
465
- .removeClass(className.outward)
466
- ;
467
- },
468
- duration: function() {
469
- $module
470
- .css('animation-duration', '')
471
- ;
472
- },
473
- failSafe: function() {
474
- module.verbose('Removing fail safe timer', module.timer);
475
- if(module.timer) {
476
- clearTimeout(module.timer);
477
- }
478
- },
479
- hidden: function() {
480
- $module.removeClass(className.hidden);
481
- },
482
- visible: function() {
483
- $module.removeClass(className.visible);
484
- },
485
- looping: function() {
486
- module.debug('Transitions are no longer looping');
487
- if( module.is.looping() ) {
488
- module.reset();
489
- $module
490
- .removeClass(className.looping)
491
- ;
492
- }
493
- },
494
- transition: function() {
495
- $module
496
- .removeClass(className.transition)
497
- .removeClass(className.visible)
498
- .removeClass(className.hidden)
499
- ;
500
- }
501
- },
502
- get: {
503
- settings: function(animation, duration, onComplete) {
504
- // single settings object
505
- if(typeof animation == 'object') {
506
- return $.extend(true, {}, $.fn.transition.settings, animation);
507
- }
508
- // all arguments provided
509
- else if(typeof onComplete == 'function') {
510
- return $.extend({}, $.fn.transition.settings, {
511
- animation : animation,
512
- onComplete : onComplete,
513
- duration : duration
514
- });
515
- }
516
- // only duration provided
517
- else if(typeof duration == 'string' || typeof duration == 'number') {
518
- return $.extend({}, $.fn.transition.settings, {
519
- animation : animation,
520
- duration : duration
521
- });
522
- }
523
- // duration is actually settings object
524
- else if(typeof duration == 'object') {
525
- return $.extend({}, $.fn.transition.settings, duration, {
526
- animation : animation
527
- });
528
- }
529
- // duration is actually callback
530
- else if(typeof duration == 'function') {
531
- return $.extend({}, $.fn.transition.settings, {
532
- animation : animation,
533
- onComplete : duration
534
- });
535
- }
536
- // only animation provided
537
- else {
538
- return $.extend({}, $.fn.transition.settings, {
539
- animation : animation
540
- });
541
- }
542
- },
543
- animationClass: function(animation) {
544
- var
545
- animationClass = animation || settings.animation,
546
- directionClass = (module.can.transition() && !module.has.direction())
547
- ? module.get.direction() + ' '
548
- : ''
549
- ;
550
- return className.animating + ' '
551
- + className.transition + ' '
552
- + directionClass
553
- + animationClass
554
- ;
555
- },
556
- currentAnimation: function() {
557
- return (module.cache && module.cache.animation !== undefined)
558
- ? module.cache.animation
559
- : false
560
- ;
561
- },
562
- currentDirection: function() {
563
- return module.is.inward()
564
- ? className.inward
565
- : className.outward
566
- ;
567
- },
568
- direction: function() {
569
- return module.is.hidden() || !module.is.visible()
570
- ? className.inward
571
- : className.outward
572
- ;
573
- },
574
- animationDirection: function(animation) {
575
- var
576
- direction
577
- ;
578
- animation = animation || settings.animation;
579
- if(typeof animation === 'string') {
580
- animation = animation.split(' ');
581
- // search animation name for out/in class
582
- $.each(animation, function(index, word){
583
- if(word === className.inward) {
584
- direction = className.inward;
585
- }
586
- else if(word === className.outward) {
587
- direction = className.outward;
588
- }
589
- });
590
- }
591
- // return found direction
592
- if(direction) {
593
- return direction;
594
- }
595
- return false;
596
- },
597
- duration: function(duration) {
598
- duration = duration || settings.duration;
599
- if(duration === false) {
600
- duration = $module.css('animation-duration') || 0;
601
- }
602
- return (typeof duration === 'string')
603
- ? (duration.indexOf('ms') > -1)
604
- ? parseFloat(duration)
605
- : parseFloat(duration) * 1000
606
- : duration
607
- ;
608
- },
609
- displayType: function(shouldDetermine) {
610
- shouldDetermine = (shouldDetermine !== undefined)
611
- ? shouldDetermine
612
- : true
613
- ;
614
- if(settings.displayType) {
615
- return settings.displayType;
616
- }
617
- if(shouldDetermine && $module.data(metadata.displayType) === undefined) {
618
- var currentDisplay = $module.css('display');
619
- if(currentDisplay === '' || currentDisplay === 'none'){
620
- // create fake element to determine display state
621
- module.can.transition(true);
622
- } else {
623
- module.save.displayType(currentDisplay);
624
- }
625
- }
626
- return $module.data(metadata.displayType);
627
- },
628
- userStyle: function(style) {
629
- style = style || $module.attr('style') || '';
630
- return style.replace(/display.*?;/, '');
631
- },
632
- transitionExists: function(animation) {
633
- return $.fn.transition.exists[animation];
634
- },
635
- animationStartEvent: function() {
636
- var
637
- element = document.createElement('div'),
638
- animations = {
639
- 'animation' :'animationstart',
640
- 'OAnimation' :'oAnimationStart',
641
- 'MozAnimation' :'mozAnimationStart',
642
- 'WebkitAnimation' :'webkitAnimationStart'
643
- },
644
- animation
645
- ;
646
- for(animation in animations){
647
- if( element.style[animation] !== undefined ){
648
- return animations[animation];
649
- }
650
- }
651
- return false;
652
- },
653
- animationEndEvent: function() {
654
- var
655
- element = document.createElement('div'),
656
- animations = {
657
- 'animation' :'animationend',
658
- 'OAnimation' :'oAnimationEnd',
659
- 'MozAnimation' :'mozAnimationEnd',
660
- 'WebkitAnimation' :'webkitAnimationEnd'
661
- },
662
- animation
663
- ;
664
- for(animation in animations){
665
- if( element.style[animation] !== undefined ){
666
- return animations[animation];
667
- }
668
- }
669
- return false;
670
- }
1034
+ // delay in ms for fail safe
1035
+ failSafeDelay: 100,
671
1036
 
672
- },
1037
+ // whether EXACT animation can occur twice in a row
1038
+ allowRepeats: false,
673
1039
 
674
- can: {
675
- transition: function(forced) {
676
- var
677
- animation = settings.animation,
678
- transitionExists = module.get.transitionExists(animation),
679
- displayType = module.get.displayType(false),
680
- elementClass,
681
- tagName,
682
- $clone,
683
- currentAnimation,
684
- inAnimation,
685
- directionExists
686
- ;
687
- if( transitionExists === undefined || forced) {
688
- module.verbose('Determining whether animation exists');
689
- elementClass = $module.attr('class');
690
- tagName = $module.prop('tagName');
691
-
692
- $clone = $('<' + tagName + ' />').addClass( elementClass ).insertAfter($module);
693
- currentAnimation = $clone
694
- .addClass(animation)
695
- .removeClass(className.inward)
696
- .removeClass(className.outward)
697
- .addClass(className.animating)
698
- .addClass(className.transition)
699
- .css('animationName')
700
- ;
701
- $clone.detach().insertAfter($module);
702
- inAnimation = $clone
703
- .addClass(className.inward)
704
- .css('animationName')
705
- ;
706
- if(!displayType) {
707
- $clone.detach().insertAfter($module);
708
- displayType = $clone
709
- .attr('class', elementClass)
710
- .removeAttr('style')
711
- .removeClass(className.hidden)
712
- .removeClass(className.visible)
713
- .show()
714
- .css('display')
715
- ;
716
- module.verbose('Determining final display state', displayType);
717
- module.save.displayType(displayType);
718
- }
719
-
720
- $clone.remove();
721
- if(currentAnimation != inAnimation) {
722
- module.debug('Direction exists for animation', animation);
723
- directionExists = true;
724
- }
725
- else if(currentAnimation == 'none' || !currentAnimation) {
726
- module.debug('No animation defined in css', animation);
727
- return;
728
- }
729
- else {
730
- module.debug('Static animation found', animation, displayType);
731
- directionExists = false;
732
- }
733
- module.save.transitionExists(animation, directionExists);
734
- }
735
- return (transitionExists !== undefined)
736
- ? transitionExists
737
- : directionExists
738
- ;
739
- },
740
- animate: function() {
741
- // can transition does not return a value if animation does not exist
742
- return (module.can.transition() !== undefined);
743
- }
744
- },
1040
+ // Override final display type on visible
1041
+ displayType: false,
745
1042
 
746
- is: {
747
- animating: function() {
748
- return $module.hasClass(className.animating);
749
- },
750
- inward: function() {
751
- return $module.hasClass(className.inward);
752
- },
753
- outward: function() {
754
- return $module.hasClass(className.outward);
755
- },
756
- looping: function() {
757
- return $module.hasClass(className.looping);
758
- },
759
- occurring: function(animation) {
760
- animation = animation || settings.animation;
761
- animation = '.' + animation.replace(' ', '.');
762
- return ( $module.filter(animation).length > 0 );
763
- },
764
- visible: function() {
765
- return $module.is(':visible');
766
- },
767
- hidden: function() {
768
- return $module.css('visibility') === 'hidden';
769
- },
770
- supported: function() {
771
- return(animationEnd !== false);
772
- }
773
- },
1043
+ // animation duration
1044
+ animation: 'fade',
1045
+ duration: false,
774
1046
 
775
- hide: function() {
776
- if(settings.onHide.call(element) === false) {
777
- module.verbose('Hide callback returned false cancelling hide');
778
- return false;
779
- }
780
- module.verbose('Hiding element');
781
- if( module.is.animating() ) {
782
- module.reset();
783
- }
784
- element.blur(); // IE will trigger focus change if element is not blurred before hiding
785
- module.remove.display();
786
- module.remove.visible();
787
- settings.onBeforeHide.call(element, module.hideNow);
788
- },
1047
+ // new animations will occur after previous ones
1048
+ queue: true,
789
1049
 
790
- hideNow: function() {
791
- module.set.hidden();
792
- module.force.hidden();
793
- settings.onHidden.call(element);
794
- settings.onComplete.call(element);
795
- },
796
-
797
- show: function(display) {
798
- if(module.force.visible() && settings.onShow.call(element) !== false) {
799
- module.verbose('Showing element', display);
800
- module.remove.hidden();
801
- settings.onBeforeShow.call(element, module.showNow);
802
- }
803
- },
804
-
805
- showNow: function(){
806
- module.set.visible();
807
- settings.onVisible.call(element);
808
- settings.onComplete.call(element);
809
- },
810
-
811
- toggle: function() {
812
- if( module.is.visible() ) {
813
- module.hide();
814
- }
815
- else {
816
- module.show();
817
- }
818
- },
819
-
820
- stop: function() {
821
- module.debug('Stopping current animation');
822
- $module.triggerHandler(animationEnd);
823
- },
824
-
825
- stopAll: function() {
826
- module.debug('Stopping all animation');
827
- module.remove.queueCallback();
828
- $module.triggerHandler(animationEnd);
829
- },
1050
+ // whether initially inline hidden objects should be skipped for transition
1051
+ skipInlineHidden: false,
830
1052
 
831
- clear: {
832
- queue: function() {
833
- module.debug('Clearing animation queue');
834
- module.remove.queueCallback();
835
- }
1053
+ metadata: {
1054
+ displayType: 'display',
836
1055
  },
837
1056
 
838
- enable: function() {
839
- module.verbose('Starting animation');
840
- $module.removeClass(className.disabled);
1057
+ className: {
1058
+ animating: 'animating',
1059
+ disabled: 'disabled',
1060
+ hidden: 'hidden',
1061
+ inward: 'in',
1062
+ loading: 'loading',
1063
+ looping: 'looping',
1064
+ outward: 'out',
1065
+ transition: 'transition',
1066
+ visible: 'visible',
841
1067
  },
842
1068
 
843
- disable: function() {
844
- module.debug('Stopping animation');
845
- $module.addClass(className.disabled);
1069
+ // possible errors
1070
+ error: {
1071
+ noAnimation: 'Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production.',
1072
+ repeated: 'That animation is already occurring, cancelling repeated animation',
1073
+ method: 'The method you called is not defined',
1074
+ support: 'This browser does not support CSS animations',
846
1075
  },
847
1076
 
848
- setting: function(name, value) {
849
- module.debug('Changing setting', name, value);
850
- if( $.isPlainObject(name) ) {
851
- $.extend(true, settings, name);
852
- }
853
- else if(value !== undefined) {
854
- if($.isPlainObject(settings[name])) {
855
- $.extend(true, settings[name], value);
856
- }
857
- else {
858
- settings[name] = value;
859
- }
860
- }
861
- else {
862
- return settings[name];
863
- }
864
- },
865
- internal: function(name, value) {
866
- if( $.isPlainObject(name) ) {
867
- $.extend(true, module, name);
868
- }
869
- else if(value !== undefined) {
870
- module[name] = value;
871
- }
872
- else {
873
- return module[name];
874
- }
875
- },
876
- debug: function() {
877
- if(!settings.silent && settings.debug) {
878
- if(settings.performance) {
879
- module.performance.log(arguments);
880
- }
881
- else {
882
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
883
- module.debug.apply(console, arguments);
884
- }
885
- }
886
- },
887
- verbose: function() {
888
- if(!settings.silent && settings.verbose && settings.debug) {
889
- if(settings.performance) {
890
- module.performance.log(arguments);
891
- }
892
- else {
893
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
894
- module.verbose.apply(console, arguments);
895
- }
896
- }
897
- },
898
- error: function() {
899
- if(!settings.silent) {
900
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
901
- module.error.apply(console, arguments);
902
- }
903
- },
904
- performance: {
905
- log: function(message) {
906
- var
907
- currentTime,
908
- executionTime,
909
- previousTime
910
- ;
911
- if(settings.performance) {
912
- currentTime = new Date().getTime();
913
- previousTime = time || currentTime;
914
- executionTime = currentTime - previousTime;
915
- time = currentTime;
916
- performance.push({
917
- 'Name' : message[0],
918
- 'Arguments' : [].slice.call(message, 1) || '',
919
- 'Element' : element,
920
- 'Execution Time' : executionTime
921
- });
922
- }
923
- clearTimeout(module.performance.timer);
924
- module.performance.timer = setTimeout(module.performance.display, 500);
925
- },
926
- display: function() {
927
- var
928
- title = settings.name + ':',
929
- totalTime = 0
930
- ;
931
- time = false;
932
- clearTimeout(module.performance.timer);
933
- $.each(performance, function(index, data) {
934
- totalTime += data['Execution Time'];
935
- });
936
- title += ' ' + totalTime + 'ms';
937
- if(moduleSelector) {
938
- title += ' \'' + moduleSelector + '\'';
939
- }
940
- if($allModules.length > 1) {
941
- title += ' ' + '(' + $allModules.length + ')';
942
- }
943
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
944
- console.groupCollapsed(title);
945
- if(console.table) {
946
- console.table(performance);
947
- }
948
- else {
949
- $.each(performance, function(index, data) {
950
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
951
- });
952
- }
953
- console.groupEnd();
954
- }
955
- performance = [];
956
- }
957
- },
958
- // modified for transition to return invoke success
959
- invoke: function(query, passedArguments, context) {
960
- var
961
- object = instance,
962
- maxDepth,
963
- found,
964
- response
965
- ;
966
- passedArguments = passedArguments || queryArguments;
967
- context = context || element;
968
- if(typeof query == 'string' && object !== undefined) {
969
- query = query.split(/[\. ]/);
970
- maxDepth = query.length - 1;
971
- $.each(query, function(depth, value) {
972
- var camelCaseValue = (depth != maxDepth)
973
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
974
- : query
975
- ;
976
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
977
- object = object[camelCaseValue];
978
- }
979
- else if( object[camelCaseValue] !== undefined ) {
980
- found = object[camelCaseValue];
981
- return false;
982
- }
983
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
984
- object = object[value];
985
- }
986
- else if( object[value] !== undefined ) {
987
- found = object[value];
988
- return false;
989
- }
990
- else {
991
- return false;
992
- }
993
- });
994
- }
995
- if ( $.isFunction( found ) ) {
996
- response = found.apply(context, passedArguments);
997
- }
998
- else if(found !== undefined) {
999
- response = found;
1000
- }
1001
-
1002
- if(Array.isArray(returnedValue)) {
1003
- returnedValue.push(response);
1004
- }
1005
- else if(returnedValue !== undefined) {
1006
- returnedValue = [returnedValue, response];
1007
- }
1008
- else if(response !== undefined) {
1009
- returnedValue = response;
1010
- }
1011
- return (found !== undefined)
1012
- ? found
1013
- : false
1014
- ;
1015
- }
1016
- };
1017
- module.initialize();
1018
- })
1019
- ;
1020
- return (returnedValue !== undefined)
1021
- ? returnedValue
1022
- : this
1023
- ;
1024
- };
1025
-
1026
- // Records if CSS transition is available
1027
- $.fn.transition.exists = {};
1028
-
1029
- $.fn.transition.settings = {
1030
-
1031
- // module info
1032
- name : 'Transition',
1033
-
1034
- // hide all output from this component regardless of other settings
1035
- silent : false,
1036
-
1037
- // debug content outputted to console
1038
- debug : false,
1039
-
1040
- // verbose debug output
1041
- verbose : false,
1042
-
1043
- // performance data output
1044
- performance : true,
1045
-
1046
- // event namespace
1047
- namespace : 'transition',
1048
-
1049
- // delay between animations in group
1050
- interval : 0,
1051
-
1052
- // whether group animations should be reversed
1053
- reverse : 'auto',
1054
-
1055
- // animation callback event
1056
- onStart : function() {},
1057
- onComplete : function() {},
1058
- onShow : function() {},
1059
- onBeforeShow : function(callback) {callback.call(this)},
1060
- onVisible : function() {},
1061
- onHide : function() {},
1062
- onHidden : function() {},
1063
- onBeforeHide : function(callback) {callback.call(this)},
1064
-
1065
- // whether timeout should be used to ensure callback fires in cases animationend does not
1066
- useFailSafe : true,
1067
-
1068
- // delay in ms for fail safe
1069
- failSafeDelay : 100,
1070
-
1071
- // whether EXACT animation can occur twice in a row
1072
- allowRepeats : false,
1073
-
1074
- // Override final display type on visible
1075
- displayType : false,
1076
-
1077
- // animation duration
1078
- animation : 'fade',
1079
- duration : false,
1080
-
1081
- // new animations will occur after previous ones
1082
- queue : true,
1083
-
1084
- // whether initially inline hidden objects should be skipped for transition
1085
- skipInlineHidden: false,
1086
-
1087
- metadata : {
1088
- displayType: 'display'
1089
- },
1090
-
1091
- className : {
1092
- animating : 'animating',
1093
- disabled : 'disabled',
1094
- hidden : 'hidden',
1095
- inward : 'in',
1096
- loading : 'loading',
1097
- looping : 'looping',
1098
- outward : 'out',
1099
- transition : 'transition',
1100
- visible : 'visible'
1101
- },
1102
-
1103
- // possible errors
1104
- error: {
1105
- noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production.',
1106
- repeated : 'That animation is already occurring, cancelling repeated animation',
1107
- method : 'The method you called is not defined',
1108
- support : 'This browser does not support CSS animations'
1109
- }
1110
-
1111
- };
1112
-
1113
-
1114
- })( jQuery, window, document );
1077
+ };
1078
+ })(jQuery, window, document);