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

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 (493) hide show
  1. package/.eslintrc.js +111 -0
  2. package/.github/workflows/ci.yml +14 -4
  3. package/.stylelintrc.js +59 -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 +1156 -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 +1902 -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 +179 -42
  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 +2558 -1807
  156. package/dist/semantic.js +28960 -29413
  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/_site/collections/menu.overrides +1 -1
  180. package/src/_site/elements/flag.variables +2 -2
  181. package/src/_site/globals/site.variables +1 -1
  182. package/src/definitions/behaviors/api.js +1157 -1180
  183. package/src/definitions/behaviors/form.js +1978 -2003
  184. package/src/definitions/behaviors/state.js +645 -663
  185. package/src/definitions/behaviors/visibility.js +1219 -1243
  186. package/src/definitions/collections/breadcrumb.less +41 -45
  187. package/src/definitions/collections/form.less +864 -882
  188. package/src/definitions/collections/grid.less +1689 -1697
  189. package/src/definitions/collections/menu.less +1490 -1508
  190. package/src/definitions/collections/message.less +292 -295
  191. package/src/definitions/collections/table.less +1616 -1620
  192. package/src/definitions/elements/button.less +1710 -1754
  193. package/src/definitions/elements/container.less +209 -209
  194. package/src/definitions/elements/divider.less +200 -209
  195. package/src/definitions/elements/emoji.less +38 -45
  196. package/src/definitions/elements/flag.less +44 -46
  197. package/src/definitions/elements/header.less +337 -345
  198. package/src/definitions/elements/icon.less +516 -451
  199. package/src/definitions/elements/image.less +219 -225
  200. package/src/definitions/elements/input.less +657 -663
  201. package/src/definitions/elements/label.less +783 -804
  202. package/src/definitions/elements/list.less +808 -812
  203. package/src/definitions/elements/loader.less +269 -266
  204. package/src/definitions/elements/placeholder.less +171 -168
  205. package/src/definitions/elements/rail.less +91 -91
  206. package/src/definitions/elements/reveal.less +190 -196
  207. package/src/definitions/elements/segment.less +738 -747
  208. package/src/definitions/elements/step.less +424 -435
  209. package/src/definitions/elements/text.less +32 -34
  210. package/src/definitions/globals/reset.less +9 -6
  211. package/src/definitions/globals/site.js +461 -475
  212. package/src/definitions/globals/site.less +106 -108
  213. package/src/definitions/modules/accordion.js +567 -594
  214. package/src/definitions/modules/accordion.less +242 -246
  215. package/src/definitions/modules/calendar.js +1901 -1808
  216. package/src/definitions/modules/calendar.less +98 -95
  217. package/src/definitions/modules/checkbox.js +841 -840
  218. package/src/definitions/modules/checkbox.less +524 -545
  219. package/src/definitions/modules/dimmer.js +707 -736
  220. package/src/definitions/modules/dimmer.less +300 -303
  221. package/src/definitions/modules/dropdown.js +4160 -4233
  222. package/src/definitions/modules/dropdown.less +1570 -1596
  223. package/src/definitions/modules/embed.js +650 -674
  224. package/src/definitions/modules/embed.less +80 -82
  225. package/src/definitions/modules/flyout.js +1463 -1464
  226. package/src/definitions/modules/flyout.less +444 -454
  227. package/src/definitions/modules/modal.js +1490 -1484
  228. package/src/definitions/modules/modal.less +459 -465
  229. package/src/definitions/modules/nag.js +517 -525
  230. package/src/definitions/modules/nag.less +134 -147
  231. package/src/definitions/modules/popup.js +1436 -1455
  232. package/src/definitions/modules/popup.less +733 -690
  233. package/src/definitions/modules/progress.js +968 -996
  234. package/src/definitions/modules/progress.less +521 -497
  235. package/src/definitions/modules/rating.js +504 -522
  236. package/src/definitions/modules/rating.less +94 -101
  237. package/src/definitions/modules/search.js +1497 -1533
  238. package/src/definitions/modules/search.less +373 -392
  239. package/src/definitions/modules/shape.js +791 -808
  240. package/src/definitions/modules/shape.less +68 -77
  241. package/src/definitions/modules/sidebar.js +1070 -1097
  242. package/src/definitions/modules/sidebar.less +462 -474
  243. package/src/definitions/modules/slider.js +1286 -1305
  244. package/src/definitions/modules/slider.less +307 -308
  245. package/src/definitions/modules/sticky.js +873 -918
  246. package/src/definitions/modules/sticky.less +22 -23
  247. package/src/definitions/modules/tab.js +921 -962
  248. package/src/definitions/modules/tab.less +46 -52
  249. package/src/definitions/modules/toast.js +885 -886
  250. package/src/definitions/modules/toast.less +584 -586
  251. package/src/definitions/modules/transition.js +1040 -1076
  252. package/src/definitions/modules/transition.less +62 -28
  253. package/src/definitions/views/ad.less +205 -206
  254. package/src/definitions/views/card.less +963 -969
  255. package/src/definitions/views/comment.less +190 -198
  256. package/src/definitions/views/feed.less +220 -224
  257. package/src/definitions/views/item.less +435 -446
  258. package/src/definitions/views/statistic.less +271 -277
  259. package/src/theme.less +29 -32
  260. package/src/themes/amazon/elements/button.overrides +23 -24
  261. package/src/themes/amazon/elements/button.variables +11 -11
  262. package/src/themes/amazon/globals/site.variables +2 -3
  263. package/src/themes/basic/collections/table.overrides +0 -1
  264. package/src/themes/basic/collections/table.variables +3 -3
  265. package/src/themes/basic/elements/button.overrides +0 -1
  266. package/src/themes/basic/elements/button.variables +2 -2
  267. package/src/themes/basic/elements/icon.overrides +12 -13
  268. package/src/themes/basic/elements/icon.variables +13 -13
  269. package/src/themes/basic/elements/step.overrides +2 -2
  270. package/src/themes/basic/elements/step.variables +2 -2
  271. package/src/themes/basic/globals/reset.overrides +1 -1
  272. package/src/themes/basic/globals/reset.variables +1 -1
  273. package/src/themes/basic/views/card.overrides +0 -1
  274. package/src/themes/basic/views/card.variables +3 -3
  275. package/src/themes/bookish/elements/header.overrides +3 -3
  276. package/src/themes/bookish/elements/header.variables +2 -2
  277. package/src/themes/bootstrap3/elements/button.variables +7 -8
  278. package/src/themes/chubby/collections/form.overrides +9 -9
  279. package/src/themes/chubby/collections/form.variables +3 -3
  280. package/src/themes/chubby/collections/menu.variables +1 -1
  281. package/src/themes/chubby/elements/button.overrides +7 -9
  282. package/src/themes/chubby/elements/button.variables +2 -2
  283. package/src/themes/chubby/elements/header.variables +3 -3
  284. package/src/themes/chubby/modules/accordion.overrides +2 -2
  285. package/src/themes/chubby/modules/accordion.variables +3 -3
  286. package/src/themes/chubby/views/comment.overrides +5 -5
  287. package/src/themes/chubby/views/comment.variables +4 -4
  288. package/src/themes/classic/collections/table.variables +2 -2
  289. package/src/themes/classic/elements/button.variables +20 -21
  290. package/src/themes/classic/elements/header.variables +3 -3
  291. package/src/themes/classic/modules/progress.variables +1 -1
  292. package/src/themes/classic/views/card.overrides +14 -14
  293. package/src/themes/classic/views/card.variables +4 -4
  294. package/src/themes/colored/modules/checkbox.variables +1 -1
  295. package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  296. package/src/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  297. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  298. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  299. package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  300. package/src/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  301. package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  302. package/src/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  303. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  304. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  305. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  306. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  307. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  308. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  309. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  310. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  311. package/src/themes/default/collections/breadcrumb.variables +4 -4
  312. package/src/themes/default/collections/form.variables +12 -12
  313. package/src/themes/default/collections/grid.overrides +0 -1
  314. package/src/themes/default/collections/grid.variables +14 -16
  315. package/src/themes/default/collections/menu.variables +19 -31
  316. package/src/themes/default/collections/message.variables +83 -84
  317. package/src/themes/default/collections/table.variables +16 -18
  318. package/src/themes/default/elements/button.variables +30 -31
  319. package/src/themes/default/elements/container.variables +4 -12
  320. package/src/themes/default/elements/divider.overrides +8 -9
  321. package/src/themes/default/elements/divider.variables +4 -5
  322. package/src/themes/default/elements/emoji.overrides +0 -1
  323. package/src/themes/default/elements/emoji.variables +3555 -3555
  324. package/src/themes/default/elements/flag.variables +1594 -1594
  325. package/src/themes/default/elements/header.overrides +0 -1
  326. package/src/themes/default/elements/header.variables +16 -16
  327. package/src/themes/default/elements/icon.variables +2017 -2001
  328. package/src/themes/default/elements/image.variables +6 -7
  329. package/src/themes/default/elements/input.variables +10 -10
  330. package/src/themes/default/elements/label.variables +19 -20
  331. package/src/themes/default/elements/list.variables +16 -16
  332. package/src/themes/default/elements/loader.variables +15 -16
  333. package/src/themes/default/elements/placeholder.variables +6 -7
  334. package/src/themes/default/elements/rail.variables +4 -5
  335. package/src/themes/default/elements/segment.variables +18 -29
  336. package/src/themes/default/elements/step.overrides +4 -4
  337. package/src/themes/default/elements/step.variables +14 -16
  338. package/src/themes/default/elements/text.variables +2 -3
  339. package/src/themes/default/globals/colors.less +588 -588
  340. package/src/themes/default/globals/reset.overrides +57 -57
  341. package/src/themes/default/globals/reset.variables +1 -1
  342. package/src/themes/default/globals/site.variables +869 -875
  343. package/src/themes/default/globals/variation.variables +13 -4
  344. package/src/themes/default/modules/accordion.overrides +11 -11
  345. package/src/themes/default/modules/accordion.variables +14 -15
  346. package/src/themes/default/modules/calendar.variables +2 -0
  347. package/src/themes/default/modules/chatroom.variables +1 -1
  348. package/src/themes/default/modules/checkbox.overrides +6 -7
  349. package/src/themes/default/modules/checkbox.variables +17 -22
  350. package/src/themes/default/modules/dimmer.variables +7 -8
  351. package/src/themes/default/modules/dropdown.overrides +17 -17
  352. package/src/themes/default/modules/dropdown.variables +20 -21
  353. package/src/themes/default/modules/embed.variables +9 -10
  354. package/src/themes/default/modules/flyout.variables +6 -6
  355. package/src/themes/default/modules/modal.variables +18 -18
  356. package/src/themes/default/modules/nag.variables +11 -14
  357. package/src/themes/default/modules/popup.variables +14 -13
  358. package/src/themes/default/modules/progress.variables +10 -11
  359. package/src/themes/default/modules/rating.variables +10 -11
  360. package/src/themes/default/modules/search.variables +9 -11
  361. package/src/themes/default/modules/shape.variables +6 -6
  362. package/src/themes/default/modules/sidebar.variables +4 -4
  363. package/src/themes/default/modules/slider.variables +48 -49
  364. package/src/themes/default/modules/sticky.variables +1 -1
  365. package/src/themes/default/modules/toast.variables +1 -1
  366. package/src/themes/default/modules/transition.overrides +936 -915
  367. package/src/themes/default/modules/transition.variables +8 -1
  368. package/src/themes/default/views/card.variables +20 -22
  369. package/src/themes/default/views/comment.variables +6 -8
  370. package/src/themes/default/views/feed.variables +6 -6
  371. package/src/themes/default/views/item.variables +6 -9
  372. package/src/themes/default/views/statistic.variables +8 -8
  373. package/src/themes/duo/elements/loader.variables +1 -1
  374. package/src/themes/famfamfam/elements/flag.overrides +263 -268
  375. package/src/themes/famfamfam/elements/flag.variables +3 -3
  376. package/src/themes/fixed-width/collections/grid.variables +1 -1
  377. package/src/themes/fixed-width/modules/modal.variables +3 -5
  378. package/src/themes/flat/collections/form.overrides +9 -9
  379. package/src/themes/flat/collections/form.variables +4 -5
  380. package/src/themes/flat/globals/site.variables +61 -66
  381. package/src/themes/github/collections/breadcrumb.variables +0 -1
  382. package/src/themes/github/collections/form.overrides +7 -8
  383. package/src/themes/github/collections/form.variables +12 -13
  384. package/src/themes/github/collections/grid.variables +1 -2
  385. package/src/themes/github/collections/menu.overrides +2 -2
  386. package/src/themes/github/collections/menu.variables +11 -12
  387. package/src/themes/github/collections/message.overrides +3 -3
  388. package/src/themes/github/collections/message.variables +5 -5
  389. package/src/themes/github/collections/table.variables +1 -1
  390. package/src/themes/github/elements/button.overrides +0 -1
  391. package/src/themes/github/elements/button.variables +14 -14
  392. package/src/themes/github/elements/header.variables +2 -2
  393. package/src/themes/github/elements/icon.overrides +179 -179
  394. package/src/themes/github/elements/icon.variables +10 -10
  395. package/src/themes/github/elements/image.variables +1 -1
  396. package/src/themes/github/elements/input.overrides +16 -16
  397. package/src/themes/github/elements/input.variables +3 -3
  398. package/src/themes/github/elements/label.overrides +3 -3
  399. package/src/themes/github/elements/label.variables +0 -1
  400. package/src/themes/github/elements/segment.variables +2 -3
  401. package/src/themes/github/elements/step.overrides +13 -13
  402. package/src/themes/github/elements/step.variables +2 -2
  403. package/src/themes/github/globals/site.variables +2 -2
  404. package/src/themes/github/modules/dropdown.overrides +18 -19
  405. package/src/themes/github/modules/dropdown.variables +1 -1
  406. package/src/themes/github/modules/popup.variables +0 -2
  407. package/src/themes/instagram/views/card.overrides +3 -4
  408. package/src/themes/instagram/views/card.variables +3 -4
  409. package/src/themes/joypixels/elements/emoji.overrides +0 -2
  410. package/src/themes/joypixels/elements/emoji.variables +3554 -3554
  411. package/src/themes/material/collections/menu.variables +1 -1
  412. package/src/themes/material/elements/button.overrides +6 -8
  413. package/src/themes/material/elements/button.variables +28 -28
  414. package/src/themes/material/elements/header.overrides +2 -2
  415. package/src/themes/material/elements/header.variables +2 -4
  416. package/src/themes/material/elements/icon.overrides +932 -932
  417. package/src/themes/material/elements/icon.variables +11 -11
  418. package/src/themes/material/globals/site.variables +78 -79
  419. package/src/themes/material/modules/dropdown.overrides +1 -1
  420. package/src/themes/material/modules/dropdown.variables +1 -1
  421. package/src/themes/material/modules/modal.overrides +2 -2
  422. package/src/themes/material/modules/modal.variables +1 -2
  423. package/src/themes/pulsar/elements/loader.overrides +58 -58
  424. package/src/themes/raised/elements/button.variables +8 -8
  425. package/src/themes/resetcss/globals/reset.overrides +115 -33
  426. package/src/themes/resetcss/globals/reset.variables +1 -1
  427. package/src/themes/round/elements/button.variables +11 -14
  428. package/src/themes/rtl/globals/site.variables +5 -6
  429. package/src/themes/striped/modules/progress.overrides +20 -16
  430. package/src/themes/systemfont/globals/reset.overrides +1 -1
  431. package/src/themes/systemfont/globals/site.variables +5 -5
  432. package/src/themes/timeline/views/feed.overrides +12 -12
  433. package/src/themes/timeline/views/feed.variables +4 -4
  434. package/src/themes/twitter/elements/button.overrides +4 -5
  435. package/src/themes/twitter/elements/button.variables +6 -7
  436. package/src/themes/twitter/elements/emoji.variables +3555 -3555
  437. package/tasks/admin/components/create.js +274 -276
  438. package/tasks/admin/components/init.js +123 -130
  439. package/tasks/admin/components/update.js +149 -157
  440. package/tasks/admin/distributions/create.js +184 -187
  441. package/tasks/admin/distributions/init.js +123 -130
  442. package/tasks/admin/distributions/update.js +145 -152
  443. package/tasks/admin/publish.js +5 -7
  444. package/tasks/admin/register.js +36 -38
  445. package/tasks/admin/release.js +8 -10
  446. package/tasks/build/assets.js +42 -39
  447. package/tasks/build/css.js +225 -216
  448. package/tasks/build/javascript.js +118 -113
  449. package/tasks/build.js +10 -10
  450. package/tasks/check-install.js +14 -16
  451. package/tasks/clean.js +5 -5
  452. package/tasks/collections/admin.js +34 -36
  453. package/tasks/collections/build.js +18 -20
  454. package/tasks/collections/docs.js +9 -11
  455. package/tasks/collections/install.js +9 -11
  456. package/tasks/collections/rtl.js +9 -11
  457. package/tasks/collections/various.js +8 -10
  458. package/tasks/config/admin/github.js +17 -17
  459. package/tasks/config/admin/oauth.example.js +4 -4
  460. package/tasks/config/admin/release.js +98 -98
  461. package/tasks/config/admin/templates/component-package.js +9 -10
  462. package/tasks/config/admin/templates/css-package.js +18 -20
  463. package/tasks/config/admin/templates/less-package.js +11 -13
  464. package/tasks/config/defaults.js +116 -114
  465. package/tasks/config/docs.js +23 -23
  466. package/tasks/config/npm/gulpfile.js +8 -9
  467. package/tasks/config/project/config.js +127 -134
  468. package/tasks/config/project/install.js +715 -713
  469. package/tasks/config/project/release.js +32 -38
  470. package/tasks/config/tasks.js +165 -156
  471. package/tasks/config/user.js +23 -26
  472. package/tasks/docs/build.js +97 -95
  473. package/tasks/docs/metadata.js +90 -96
  474. package/tasks/docs/serve.js +80 -81
  475. package/tasks/install.js +370 -378
  476. package/tasks/rtl/build.js +2 -2
  477. package/tasks/rtl/watch.js +2 -2
  478. package/tasks/version.js +4 -4
  479. package/tasks/watch.js +28 -30
  480. package/test/meteor/assets.js +10 -13
  481. package/test/meteor/fonts.js +12 -13
  482. package/test/modules/accordion.spec.js +6 -8
  483. package/test/modules/checkbox.spec.js +5 -7
  484. package/test/modules/dropdown.spec.js +5 -7
  485. package/test/modules/modal.spec.js +6 -8
  486. package/test/modules/module.spec.js +158 -178
  487. package/test/modules/popup.spec.js +5 -7
  488. package/test/modules/search.spec.js +5 -7
  489. package/test/modules/shape.spec.js +5 -7
  490. package/test/modules/sidebar.spec.js +5 -7
  491. package/test/modules/tab.spec.js +6 -8
  492. package/test/modules/transition.spec.js +5 -7
  493. package/test/modules/video.spec.js +5 -7
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.2+f5a64f3 - Progress
2
+ * # Fomantic-UI 2.9.1-beta.21+2722e1b - Progress
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -8,1029 +8,1001 @@
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.progress = function(parameters) {
27
- var
28
- $allModules = $(this),
29
-
30
- moduleSelector = $allModules.selector || '',
31
-
32
- time = new Date().getTime(),
33
- performance = [],
34
-
35
- query = arguments[0],
36
- methodInvoked = (typeof query == 'string'),
37
- queryArguments = [].slice.call(arguments, 1),
38
-
39
- returnedValue
40
- ;
41
-
42
- $allModules
43
- .each(function() {
44
- var
45
- settings = ( $.isPlainObject(parameters) )
46
- ? $.extend(true, {}, $.fn.progress.settings, parameters)
47
- : $.extend({}, $.fn.progress.settings),
48
-
49
- className = settings.className,
50
- metadata = settings.metadata,
51
- namespace = settings.namespace,
52
- selector = settings.selector,
53
- error = settings.error,
54
-
55
- eventNamespace = '.' + namespace,
56
- moduleNamespace = 'module-' + namespace,
57
-
58
- $module = $(this),
59
- $bars = $(this).find(selector.bar),
60
- $progresses = $(this).find(selector.progress),
61
- $label = $(this).find(selector.label),
62
-
63
- element = this,
64
- instance = $module.data(moduleNamespace),
65
-
66
- animating = false,
67
- transitionEnd,
68
- module
69
- ;
70
- module = {
71
- helper: {
72
- sum: function (nums) {
73
- return Array.isArray(nums) ? nums.reduce(function (left, right) {
74
- return left + Number(right);
75
- }, 0) : 0;
76
- },
77
- /**
78
- * Derive precision for multiple progress with total and values.
79
- *
80
- * This helper dervices a precision that is sufficiently large to show minimum value of multiple progress.
81
- *
82
- * Example1
83
- * - total: 1122
84
- * - values: [325, 111, 74, 612]
85
- * - min ratio: 74/1122 = 0.0659...
86
- * - required precision: 100
87
- *
88
- * Example2
89
- * - total: 10541
90
- * - values: [3235, 1111, 74, 6121]
91
- * - min ratio: 74/10541 = 0.0070...
92
- * - required precision: 1000
93
- *
94
- * @param min A minimum value within multiple values
95
- * @param total A total amount of multiple values
96
- * @returns {number} A precision. Could be 1, 10, 100, ... 1e+10.
97
- */
98
- derivePrecision: function(min, total) {
99
- var precisionPower = 0
100
- var precision = 1;
101
- var ratio = min / total;
102
- while (precisionPower < 10) {
103
- ratio = ratio * precision;
104
- if (ratio > 1) {
105
- break;
106
- }
107
- precision = Math.pow(10, precisionPower++);
108
- }
109
- return precision;
110
- },
111
- forceArray: function (element) {
112
- return Array.isArray(element)
113
- ? element
114
- : !isNaN(element)
115
- ? [element]
116
- : typeof element == 'string'
117
- ? element.split(',')
118
- : []
119
- ;
120
- }
121
- },
11
+ (function ($, window, document, undefined) {
12
+ 'use strict';
122
13
 
123
- initialize: function() {
124
- module.set.duration();
125
- module.set.transitionEvent();
126
- module.debug(element);
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
127
17
 
128
- module.read.metadata();
129
- module.read.settings();
18
+ window = (typeof window != 'undefined' && window.Math == Math)
19
+ ? window
20
+ : globalThis;
130
21
 
131
- module.instantiate();
132
- },
22
+ $.fn.progress = function (parameters) {
23
+ var
24
+ $allModules = $(this),
133
25
 
134
- instantiate: function() {
135
- module.verbose('Storing instance of progress', module);
136
- instance = module;
137
- $module
138
- .data(moduleNamespace, module)
139
- ;
140
- },
141
- destroy: function() {
142
- module.verbose('Destroying previous progress for', $module);
143
- clearInterval(instance.interval);
144
- module.remove.state();
145
- $module.removeData(moduleNamespace);
146
- instance = undefined;
147
- },
26
+ moduleSelector = $allModules.selector || '',
148
27
 
149
- reset: function() {
150
- module.remove.nextValue();
151
- module.update.progress(0);
152
- },
28
+ time = new Date().getTime(),
29
+ performance = [],
153
30
 
154
- complete: function(keepState) {
155
- if(module.percent === undefined || module.percent < 100) {
156
- module.remove.progressPoll();
157
- if(keepState !== true){
158
- module.set.percent(100);
159
- }
160
- }
161
- },
31
+ query = arguments[0],
32
+ methodInvoked = (typeof query == 'string'),
33
+ queryArguments = [].slice.call(arguments, 1),
34
+
35
+ returnedValue
36
+ ;
162
37
 
163
- read: {
164
- metadata: function() {
38
+ $allModules.each(function () {
165
39
  var
166
- data = {
167
- percent : module.helper.forceArray($module.data(metadata.percent)),
168
- total : $module.data(metadata.total),
169
- value : module.helper.forceArray($module.data(metadata.value))
170
- }
40
+ settings = ($.isPlainObject(parameters))
41
+ ? $.extend(true, {}, $.fn.progress.settings, parameters)
42
+ : $.extend({}, $.fn.progress.settings),
43
+
44
+ className = settings.className,
45
+ metadata = settings.metadata,
46
+ namespace = settings.namespace,
47
+ selector = settings.selector,
48
+ error = settings.error,
49
+
50
+ eventNamespace = '.' + namespace,
51
+ moduleNamespace = 'module-' + namespace,
52
+
53
+ $module = $(this),
54
+ $bars = $(this).find(selector.bar),
55
+ $progresses = $(this).find(selector.progress),
56
+ $label = $(this).find(selector.label),
57
+
58
+ element = this,
59
+ instance = $module.data(moduleNamespace),
60
+
61
+ animating = false,
62
+ transitionEnd,
63
+ module
171
64
  ;
172
- if(data.total !== undefined) {
173
- module.debug('Total value set from metadata', data.total);
174
- module.set.total(data.total);
175
- }
176
- if(data.value.length > 0) {
177
- module.debug('Current value set from metadata', data.value);
178
- module.set.value(data.value);
179
- module.set.progress(data.value);
180
- }
181
- if(data.percent.length > 0) {
182
- module.debug('Current percent value set from metadata', data.percent);
183
- module.set.percent(data.percent);
184
- }
185
- },
186
- settings: function() {
187
- if(settings.total !== false) {
188
- module.debug('Current total set in settings', settings.total);
189
- module.set.total(settings.total);
190
- }
191
- if(settings.value !== false) {
192
- module.debug('Current value set in settings', settings.value);
193
- module.set.value(settings.value);
194
- module.set.progress(module.value);
195
- }
196
- if(settings.percent !== false) {
197
- module.debug('Current percent set in settings', settings.percent);
198
- module.set.percent(settings.percent);
65
+ module = {
66
+ helper: {
67
+ sum: function (nums) {
68
+ return Array.isArray(nums) ? nums.reduce(function (left, right) {
69
+ return left + Number(right);
70
+ }, 0) : 0;
71
+ },
72
+ /**
73
+ * Derive precision for multiple progress with total and values.
74
+ *
75
+ * This helper dervices a precision that is sufficiently large to show minimum value of multiple progress.
76
+ *
77
+ * Example1
78
+ * - total: 1122
79
+ * - values: [325, 111, 74, 612]
80
+ * - min ratio: 74/1122 = 0.0659...
81
+ * - required precision: 100
82
+ *
83
+ * Example2
84
+ * - total: 10541
85
+ * - values: [3235, 1111, 74, 6121]
86
+ * - min ratio: 74/10541 = 0.0070...
87
+ * - required precision: 1000
88
+ *
89
+ * @param min A minimum value within multiple values
90
+ * @param total A total amount of multiple values
91
+ * @returns {number} A precision. Could be 1, 10, 100, ... 1e+10.
92
+ */
93
+ derivePrecision: function (min, total) {
94
+ var precisionPower = 0;
95
+ var precision = 1;
96
+ var ratio = min / total;
97
+ while (precisionPower < 10) {
98
+ ratio = ratio * precision;
99
+ if (ratio > 1) {
100
+ break;
101
+ }
102
+ precision = Math.pow(10, precisionPower++);
103
+ }
104
+
105
+ return precision;
106
+ },
107
+ forceArray: function (element) {
108
+ return Array.isArray(element)
109
+ ? element
110
+ : !isNaN(element)
111
+ ? [element]
112
+ : typeof element == 'string'
113
+ ? element.split(',')
114
+ : [];
115
+ },
116
+ },
117
+
118
+ initialize: function () {
119
+ module.set.duration();
120
+ module.set.transitionEvent();
121
+ module.debug(element);
122
+
123
+ module.read.metadata();
124
+ module.read.settings();
125
+
126
+ module.instantiate();
127
+ },
128
+
129
+ instantiate: function () {
130
+ module.verbose('Storing instance of progress', module);
131
+ instance = module;
132
+ $module
133
+ .data(moduleNamespace, module)
134
+ ;
135
+ },
136
+ destroy: function () {
137
+ module.verbose('Destroying previous progress for', $module);
138
+ clearInterval(instance.interval);
139
+ module.remove.state();
140
+ $module.removeData(moduleNamespace);
141
+ instance = undefined;
142
+ },
143
+
144
+ reset: function () {
145
+ module.remove.nextValue();
146
+ module.update.progress(0);
147
+ },
148
+
149
+ complete: function (keepState) {
150
+ if (module.percent === undefined || module.percent < 100) {
151
+ module.remove.progressPoll();
152
+ if (keepState !== true) {
153
+ module.set.percent(100);
154
+ }
155
+ }
156
+ },
157
+
158
+ read: {
159
+ metadata: function () {
160
+ var
161
+ data = {
162
+ percent: module.helper.forceArray($module.data(metadata.percent)),
163
+ total: $module.data(metadata.total),
164
+ value: module.helper.forceArray($module.data(metadata.value)),
165
+ }
166
+ ;
167
+ if (data.total !== undefined) {
168
+ module.debug('Total value set from metadata', data.total);
169
+ module.set.total(data.total);
170
+ }
171
+ if (data.value.length > 0) {
172
+ module.debug('Current value set from metadata', data.value);
173
+ module.set.value(data.value);
174
+ module.set.progress(data.value);
175
+ }
176
+ if (data.percent.length > 0) {
177
+ module.debug('Current percent value set from metadata', data.percent);
178
+ module.set.percent(data.percent);
179
+ }
180
+ },
181
+ settings: function () {
182
+ if (settings.total !== false) {
183
+ module.debug('Current total set in settings', settings.total);
184
+ module.set.total(settings.total);
185
+ }
186
+ if (settings.value !== false) {
187
+ module.debug('Current value set in settings', settings.value);
188
+ module.set.value(settings.value);
189
+ module.set.progress(module.value);
190
+ }
191
+ if (settings.percent !== false) {
192
+ module.debug('Current percent set in settings', settings.percent);
193
+ module.set.percent(settings.percent);
194
+ }
195
+ },
196
+ },
197
+
198
+ bind: {
199
+ transitionEnd: function (callback) {
200
+ var
201
+ transitionEnd = module.get.transitionEnd()
202
+ ;
203
+ $bars
204
+ .one(transitionEnd + eventNamespace, function (event) {
205
+ clearTimeout(module.failSafeTimer);
206
+ callback.call(this, event);
207
+ })
208
+ ;
209
+ module.failSafeTimer = setTimeout(function () {
210
+ $bars.triggerHandler(transitionEnd);
211
+ }, settings.duration + settings.failSafeDelay);
212
+ module.verbose('Adding fail safe timer', module.timer);
213
+ },
214
+ },
215
+
216
+ increment: function (incrementValue) {
217
+ var
218
+ startValue,
219
+ newValue
220
+ ;
221
+ if (module.has.total()) {
222
+ startValue = module.get.value();
223
+ incrementValue = incrementValue || 1;
224
+ } else {
225
+ startValue = module.get.percent();
226
+ incrementValue = incrementValue || module.get.randomValue();
227
+ }
228
+ newValue = startValue + incrementValue;
229
+ module.debug('Incrementing percentage by', startValue, newValue, incrementValue);
230
+ newValue = module.get.normalizedValue(newValue);
231
+ module.set.progress(newValue);
232
+ },
233
+ decrement: function (decrementValue) {
234
+ var
235
+ total = module.get.total(),
236
+ startValue,
237
+ newValue
238
+ ;
239
+ if (total) {
240
+ startValue = module.get.value();
241
+ decrementValue = decrementValue || 1;
242
+ newValue = startValue - decrementValue;
243
+ module.debug('Decrementing value by', decrementValue, startValue);
244
+ } else {
245
+ startValue = module.get.percent();
246
+ decrementValue = decrementValue || module.get.randomValue();
247
+ newValue = startValue - decrementValue;
248
+ module.debug('Decrementing percentage by', decrementValue, startValue);
249
+ }
250
+ newValue = module.get.normalizedValue(newValue);
251
+ module.set.progress(newValue);
252
+ },
253
+
254
+ has: {
255
+ progressPoll: function () {
256
+ return module.progressPoll;
257
+ },
258
+ total: function () {
259
+ return (module.get.total() !== false);
260
+ },
261
+ },
262
+
263
+ get: {
264
+ text: function (templateText, index) {
265
+ var
266
+ index_ = index || 0,
267
+ value = module.get.value(index_),
268
+ total = module.get.total(),
269
+ percent = (animating)
270
+ ? module.get.displayPercent(index_)
271
+ : module.get.percent(index_),
272
+ left = (total !== false)
273
+ ? Math.max(0, total - value)
274
+ : (100 - percent)
275
+ ;
276
+ templateText = templateText || '';
277
+ templateText = templateText
278
+ .replace('{value}', value)
279
+ .replace('{total}', total || 0)
280
+ .replace('{left}', left)
281
+ .replace('{percent}', percent)
282
+ .replace('{bar}', settings.text.bars[index_] || '')
283
+ ;
284
+ module.verbose('Adding variables to progress bar text', templateText);
285
+
286
+ return templateText;
287
+ },
288
+
289
+ normalizedValue: function (value) {
290
+ if (value < 0) {
291
+ module.debug('Value cannot decrement below 0');
292
+
293
+ return 0;
294
+ }
295
+ if (module.has.total()) {
296
+ if (value > module.total) {
297
+ module.debug('Value cannot increment above total', module.total);
298
+
299
+ return module.total;
300
+ }
301
+ } else if (value > 100) {
302
+ module.debug('Value cannot increment above 100 percent');
303
+
304
+ return 100;
305
+ }
306
+
307
+ return value;
308
+ },
309
+
310
+ updateInterval: function () {
311
+ if (settings.updateInterval == 'auto') {
312
+ return settings.duration;
313
+ }
314
+
315
+ return settings.updateInterval;
316
+ },
317
+
318
+ randomValue: function () {
319
+ module.debug('Generating random increment percentage');
320
+
321
+ return Math.floor((Math.random() * settings.random.max) + settings.random.min);
322
+ },
323
+
324
+ numericValue: function (value) {
325
+ return (typeof value === 'string')
326
+ ? (value.replace(/[^\d.]/g, '') !== '')
327
+ ? +(value.replace(/[^\d.]/g, ''))
328
+ : false
329
+ : value;
330
+ },
331
+
332
+ transitionEnd: function () {
333
+ var
334
+ element = document.createElement('element'),
335
+ transitions = {
336
+ transition: 'transitionend',
337
+ OTransition: 'oTransitionEnd',
338
+ MozTransition: 'transitionend',
339
+ WebkitTransition: 'webkitTransitionEnd',
340
+ },
341
+ transition
342
+ ;
343
+ for (transition in transitions) {
344
+ if (element.style[transition] !== undefined) {
345
+ return transitions[transition];
346
+ }
347
+ }
348
+ },
349
+
350
+ // gets current displayed percentage (if animating values this is the intermediary value)
351
+ displayPercent: function (index) {
352
+ var
353
+ $bar = $($bars[index]),
354
+ barWidth = $bar.width(),
355
+ totalWidth = $module.width(),
356
+ minDisplay = parseInt($bar.css('min-width'), 10),
357
+ displayPercent = (barWidth > minDisplay)
358
+ ? (barWidth / totalWidth * 100)
359
+ : module.percent
360
+ ;
361
+
362
+ return (settings.precision > 0)
363
+ ? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
364
+ : Math.round(displayPercent);
365
+ },
366
+
367
+ percent: function (index) {
368
+ return module.percent && module.percent[index || 0] || 0;
369
+ },
370
+ value: function (index) {
371
+ return module.nextValue || module.value && module.value[index || 0] || 0;
372
+ },
373
+ total: function () {
374
+ return module.total !== undefined ? module.total : false;
375
+ },
376
+ },
377
+
378
+ create: {
379
+ progressPoll: function () {
380
+ module.progressPoll = setTimeout(function () {
381
+ module.update.toNextValue();
382
+ module.remove.progressPoll();
383
+ }, module.get.updateInterval());
384
+ },
385
+ },
386
+
387
+ is: {
388
+ complete: function () {
389
+ return module.is.success() || module.is.warning() || module.is.error();
390
+ },
391
+ success: function () {
392
+ return $module.hasClass(className.success);
393
+ },
394
+ warning: function () {
395
+ return $module.hasClass(className.warning);
396
+ },
397
+ error: function () {
398
+ return $module.hasClass(className.error);
399
+ },
400
+ active: function () {
401
+ return $module.hasClass(className.active);
402
+ },
403
+ visible: function () {
404
+ return $module.is(':visible');
405
+ },
406
+ },
407
+
408
+ remove: {
409
+ progressPoll: function () {
410
+ module.verbose('Removing progress poll timer');
411
+ if (module.progressPoll) {
412
+ clearTimeout(module.progressPoll);
413
+ delete module.progressPoll;
414
+ }
415
+ },
416
+ nextValue: function () {
417
+ module.verbose('Removing progress value stored for next update');
418
+ delete module.nextValue;
419
+ },
420
+ state: function () {
421
+ module.verbose('Removing stored state');
422
+ delete module.total;
423
+ delete module.percent;
424
+ delete module.value;
425
+ },
426
+ active: function () {
427
+ module.verbose('Removing active state');
428
+ $module.removeClass(className.active);
429
+ },
430
+ success: function () {
431
+ module.verbose('Removing success state');
432
+ $module.removeClass(className.success);
433
+ },
434
+ warning: function () {
435
+ module.verbose('Removing warning state');
436
+ $module.removeClass(className.warning);
437
+ },
438
+ error: function () {
439
+ module.verbose('Removing error state');
440
+ $module.removeClass(className.error);
441
+ },
442
+ },
443
+
444
+ set: {
445
+ barWidth: function (values) {
446
+ module.debug('set bar width with ', values);
447
+ values = module.helper.forceArray(values);
448
+ var firstNonZeroIndex = -1;
449
+ var lastNonZeroIndex = -1;
450
+ var valuesSum = module.helper.sum(values);
451
+ var barCounts = $bars.length;
452
+ var isMultiple = barCounts > 1;
453
+ var percents = values.map(function (value, index) {
454
+ var allZero = (index === barCounts - 1 && valuesSum === 0);
455
+ var $bar = $($bars[index]);
456
+ if (value === 0 && isMultiple && !allZero) {
457
+ $bar.css('display', 'none');
458
+ } else {
459
+ if (isMultiple && allZero) {
460
+ $bar.css('background', 'transparent');
461
+ }
462
+ if (firstNonZeroIndex == -1) {
463
+ firstNonZeroIndex = index;
464
+ }
465
+ lastNonZeroIndex = index;
466
+ $bar.css({
467
+ display: 'block',
468
+ width: value + '%',
469
+ });
470
+ }
471
+
472
+ return parseFloat(value);
473
+ });
474
+ values.forEach(function (_, index) {
475
+ var $bar = $($bars[index]);
476
+ $bar.css({
477
+ borderTopLeftRadius: index == firstNonZeroIndex ? '' : '0',
478
+ borderBottomLeftRadius: index == firstNonZeroIndex ? '' : '0',
479
+ borderTopRightRadius: index == lastNonZeroIndex ? '' : '0',
480
+ borderBottomRightRadius: index == lastNonZeroIndex ? '' : '0',
481
+ });
482
+ });
483
+ $module
484
+ .attr('data-percent', percents)
485
+ ;
486
+ },
487
+ duration: function (duration) {
488
+ duration = duration || settings.duration;
489
+ duration = (typeof duration == 'number')
490
+ ? duration + 'ms'
491
+ : duration;
492
+ module.verbose('Setting progress bar transition duration', duration);
493
+ $bars
494
+ .css({
495
+ 'transition-duration': duration,
496
+ })
497
+ ;
498
+ },
499
+ percent: function (percents) {
500
+ percents = module.helper.forceArray(percents).map(function (percent) {
501
+ percent = (typeof percent == 'string')
502
+ ? +(percent.replace('%', ''))
503
+ : percent;
504
+
505
+ return (settings.limitValues)
506
+ ? Math.max(0, Math.min(100, percent))
507
+ : percent;
508
+ });
509
+ var hasTotal = module.has.total();
510
+ var totalPercent = module.helper.sum(percents);
511
+ var isMultipleValues = percents.length > 1 && hasTotal;
512
+ var sumTotal = module.helper.sum(module.helper.forceArray(module.value));
513
+ if (isMultipleValues && sumTotal > module.total) {
514
+ // Sum values instead of pecents to avoid precision issues when summing floats
515
+ module.error(error.sumExceedsTotal, sumTotal, module.total);
516
+ } else if (!isMultipleValues && totalPercent > 100) {
517
+ // Sum before rounding since sum of rounded may have error though sum of actual is fine
518
+ module.error(error.tooHigh, totalPercent);
519
+ } else if (totalPercent < 0) {
520
+ module.error(error.tooLow, totalPercent);
521
+ } else {
522
+ var autoPrecision = settings.precision > 0
523
+ ? settings.precision
524
+ : isMultipleValues
525
+ ? module.helper.derivePrecision(Math.min.apply(null, module.value), module.total)
526
+ : 0;
527
+
528
+ // round display percentage
529
+ var roundedPercents = percents.map(function (percent) {
530
+ return (autoPrecision > 0)
531
+ ? Math.round(percent * (10 * autoPrecision)) / (10 * autoPrecision)
532
+ : Math.round(percent)
533
+ ;
534
+ });
535
+ module.percent = roundedPercents;
536
+ if (hasTotal) {
537
+ module.value = percents.map(function (percent) {
538
+ return (autoPrecision > 0)
539
+ ? Math.round((percent / 100) * module.total * (10 * autoPrecision)) / (10 * autoPrecision)
540
+ : Math.round((percent / 100) * module.total * 10) / 10;
541
+ });
542
+ }
543
+ module.set.barWidth(percents);
544
+ module.set.labelInterval();
545
+ }
546
+ settings.onChange.call(element, percents, module.value, module.total);
547
+ },
548
+ labelInterval: function () {
549
+ var
550
+ animationCallback = function () {
551
+ module.verbose('Bar finished animating, removing continuous label updates');
552
+ clearInterval(module.interval);
553
+ animating = false;
554
+ module.set.labels();
555
+ }
556
+ ;
557
+ clearInterval(module.interval);
558
+ module.bind.transitionEnd(animationCallback);
559
+ animating = true;
560
+ module.interval = setInterval(function () {
561
+ var
562
+ isInDOM = $.contains(document.documentElement, element)
563
+ ;
564
+ if (!isInDOM) {
565
+ clearInterval(module.interval);
566
+ animating = false;
567
+ }
568
+ module.set.labels();
569
+ }, settings.framerate);
570
+ },
571
+ labels: function () {
572
+ module.verbose('Setting both bar progress and outer label text');
573
+ module.set.barLabel();
574
+ module.set.state();
575
+ },
576
+ label: function (text) {
577
+ text = text || '';
578
+ if (text) {
579
+ text = module.get.text(text);
580
+ module.verbose('Setting label to text', text);
581
+ $label.text(text);
582
+ }
583
+ },
584
+ state: function (percent) {
585
+ percent = (percent !== undefined)
586
+ ? percent
587
+ : module.helper.sum(module.percent);
588
+ if (percent === 100) {
589
+ if (settings.autoSuccess && $bars.length === 1 && !(module.is.warning() || module.is.error() || module.is.success())) {
590
+ module.set.success();
591
+ module.debug('Automatically triggering success at 100%');
592
+ } else {
593
+ module.verbose('Reached 100% removing active state');
594
+ module.remove.active();
595
+ module.remove.progressPoll();
596
+ }
597
+ } else if (percent > 0) {
598
+ module.verbose('Adjusting active progress bar label', percent);
599
+ module.set.active();
600
+ } else {
601
+ module.remove.active();
602
+ module.remove.warning();
603
+ module.remove.error();
604
+ module.remove.success();
605
+ module.set.label(settings.text.active);
606
+ }
607
+ },
608
+ barLabel: function (text) {
609
+ $progresses.each(function (index, element) {
610
+ var $progress = $(element);
611
+ if (text !== undefined) {
612
+ $progress.text(module.get.text(text, index));
613
+ } else if (settings.label == 'ratio' && module.has.total()) {
614
+ module.verbose('Adding ratio to bar label');
615
+ $progress.text(module.get.text(settings.text.ratio, index));
616
+ } else if (settings.label == 'percent') {
617
+ module.verbose('Adding percentage to bar label');
618
+ $progress.text(module.get.text(settings.text.percent, index));
619
+ }
620
+ });
621
+ },
622
+ active: function (text) {
623
+ text = text || settings.text.active;
624
+ module.debug('Setting active state');
625
+ if (settings.showActivity && !module.is.active()) {
626
+ $module.addClass(className.active);
627
+ }
628
+ module.remove.warning();
629
+ module.remove.error();
630
+ module.remove.success();
631
+ text = settings.onLabelUpdate('active', text, module.value, module.total);
632
+ if (text) {
633
+ module.set.label(text);
634
+ }
635
+ module.bind.transitionEnd(function () {
636
+ settings.onActive.call(element, module.value, module.total);
637
+ });
638
+ },
639
+ success: function (text, keepState) {
640
+ text = text || settings.text.success || settings.text.active;
641
+ module.debug('Setting success state');
642
+ $module.addClass(className.success);
643
+ module.remove.active();
644
+ module.remove.warning();
645
+ module.remove.error();
646
+ module.complete(keepState);
647
+ if (settings.text.success) {
648
+ text = settings.onLabelUpdate('success', text, module.value, module.total);
649
+ module.set.label(text);
650
+ } else {
651
+ text = settings.onLabelUpdate('active', text, module.value, module.total);
652
+ module.set.label(text);
653
+ }
654
+ module.bind.transitionEnd(function () {
655
+ settings.onSuccess.call(element, module.total);
656
+ });
657
+ },
658
+ warning: function (text, keepState) {
659
+ text = text || settings.text.warning;
660
+ module.debug('Setting warning state');
661
+ $module.addClass(className.warning);
662
+ module.remove.active();
663
+ module.remove.success();
664
+ module.remove.error();
665
+ module.complete(keepState);
666
+ text = settings.onLabelUpdate('warning', text, module.value, module.total);
667
+ if (text) {
668
+ module.set.label(text);
669
+ }
670
+ module.bind.transitionEnd(function () {
671
+ settings.onWarning.call(element, module.value, module.total);
672
+ });
673
+ },
674
+ error: function (text, keepState) {
675
+ text = text || settings.text.error;
676
+ module.debug('Setting error state');
677
+ $module.addClass(className.error);
678
+ module.remove.active();
679
+ module.remove.success();
680
+ module.remove.warning();
681
+ module.complete(keepState);
682
+ text = settings.onLabelUpdate('error', text, module.value, module.total);
683
+ if (text) {
684
+ module.set.label(text);
685
+ }
686
+ module.bind.transitionEnd(function () {
687
+ settings.onError.call(element, module.value, module.total);
688
+ });
689
+ },
690
+ transitionEvent: function () {
691
+ transitionEnd = module.get.transitionEnd();
692
+ },
693
+ total: function (totalValue) {
694
+ module.total = totalValue;
695
+ },
696
+ value: function (value) {
697
+ module.value = module.helper.forceArray(value);
698
+ },
699
+ progress: function (value) {
700
+ if (!module.has.progressPoll()) {
701
+ module.debug('First update in progress update interval, immediately updating', value);
702
+ module.update.progress(value);
703
+ module.create.progressPoll();
704
+ } else {
705
+ module.debug('Updated within interval, setting next update to use new value', value);
706
+ module.set.nextValue(value);
707
+ }
708
+ },
709
+ nextValue: function (value) {
710
+ module.nextValue = value;
711
+ },
712
+ },
713
+
714
+ update: {
715
+ toNextValue: function () {
716
+ var
717
+ nextValue = module.nextValue
718
+ ;
719
+ if (nextValue) {
720
+ module.debug('Update interval complete using last updated value', nextValue);
721
+ module.update.progress(nextValue);
722
+ module.remove.nextValue();
723
+ }
724
+ },
725
+ progress: function (values) {
726
+ var hasTotal = module.has.total();
727
+ if (hasTotal) {
728
+ module.set.value(values);
729
+ }
730
+ var percentCompletes = module.helper.forceArray(values).map(function (value) {
731
+ var
732
+ percentComplete
733
+ ;
734
+ value = module.get.numericValue(value);
735
+ if (value === false) {
736
+ module.error(error.nonNumeric, value);
737
+ }
738
+ value = module.get.normalizedValue(value);
739
+ if (hasTotal) {
740
+ percentComplete = module.total > 0 ? (value / module.total) * 100 : 100;
741
+ module.debug('Calculating percent complete from total', percentComplete);
742
+ } else {
743
+ percentComplete = value;
744
+ module.debug('Setting value to exact percentage value', percentComplete);
745
+ }
746
+
747
+ return percentComplete;
748
+ });
749
+ module.set.percent(percentCompletes);
750
+ },
751
+ },
752
+
753
+ setting: function (name, value) {
754
+ module.debug('Changing setting', name, value);
755
+ if ($.isPlainObject(name)) {
756
+ $.extend(true, settings, name);
757
+ } else if (value !== undefined) {
758
+ if ($.isPlainObject(settings[name])) {
759
+ $.extend(true, settings[name], value);
760
+ } else {
761
+ settings[name] = value;
762
+ }
763
+ } else {
764
+ return settings[name];
765
+ }
766
+ },
767
+ internal: function (name, value) {
768
+ if ($.isPlainObject(name)) {
769
+ $.extend(true, module, name);
770
+ } else if (value !== undefined) {
771
+ module[name] = value;
772
+ } else {
773
+ return module[name];
774
+ }
775
+ },
776
+ debug: function () {
777
+ if (!settings.silent && settings.debug) {
778
+ if (settings.performance) {
779
+ module.performance.log(arguments);
780
+ } else {
781
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
782
+ module.debug.apply(console, arguments);
783
+ }
784
+ }
785
+ },
786
+ verbose: function () {
787
+ if (!settings.silent && settings.verbose && settings.debug) {
788
+ if (settings.performance) {
789
+ module.performance.log(arguments);
790
+ } else {
791
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
792
+ module.verbose.apply(console, arguments);
793
+ }
794
+ }
795
+ },
796
+ error: function () {
797
+ if (!settings.silent) {
798
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
799
+ module.error.apply(console, arguments);
800
+ }
801
+ },
802
+ performance: {
803
+ log: function (message) {
804
+ var
805
+ currentTime,
806
+ executionTime,
807
+ previousTime
808
+ ;
809
+ if (settings.performance) {
810
+ currentTime = new Date().getTime();
811
+ previousTime = time || currentTime;
812
+ executionTime = currentTime - previousTime;
813
+ time = currentTime;
814
+ performance.push({
815
+ Name: message[0],
816
+ Arguments: [].slice.call(message, 1) || '',
817
+ Element: element,
818
+ 'Execution Time': executionTime,
819
+ });
820
+ }
821
+ clearTimeout(module.performance.timer);
822
+ module.performance.timer = setTimeout(module.performance.display, 500);
823
+ },
824
+ display: function () {
825
+ var
826
+ title = settings.name + ':',
827
+ totalTime = 0
828
+ ;
829
+ time = false;
830
+ clearTimeout(module.performance.timer);
831
+ $.each(performance, function (index, data) {
832
+ totalTime += data['Execution Time'];
833
+ });
834
+ title += ' ' + totalTime + 'ms';
835
+ if (moduleSelector) {
836
+ title += ' \'' + moduleSelector + '\'';
837
+ }
838
+ if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
839
+ console.groupCollapsed(title);
840
+ if (console.table) {
841
+ console.table(performance);
842
+ } else {
843
+ $.each(performance, function (index, data) {
844
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
845
+ });
846
+ }
847
+ console.groupEnd();
848
+ }
849
+ performance = [];
850
+ },
851
+ },
852
+ invoke: function (query, passedArguments, context) {
853
+ var
854
+ object = instance,
855
+ maxDepth,
856
+ found,
857
+ response
858
+ ;
859
+ passedArguments = passedArguments || queryArguments;
860
+ context = context || element;
861
+ if (typeof query == 'string' && object !== undefined) {
862
+ query = query.split(/[\. ]/);
863
+ maxDepth = query.length - 1;
864
+ $.each(query, function (depth, value) {
865
+ var camelCaseValue = (depth != maxDepth)
866
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
867
+ : query
868
+ ;
869
+ if ($.isPlainObject(object[camelCaseValue]) && (depth != maxDepth)) {
870
+ object = object[camelCaseValue];
871
+ } else if (object[camelCaseValue] !== undefined) {
872
+ found = object[camelCaseValue];
873
+
874
+ return false;
875
+ } else if ($.isPlainObject(object[value]) && (depth != maxDepth)) {
876
+ object = object[value];
877
+ } else if (object[value] !== undefined) {
878
+ found = object[value];
879
+
880
+ return false;
881
+ } else {
882
+ module.error(error.method, query);
883
+
884
+ return false;
885
+ }
886
+ });
887
+ }
888
+ if (isFunction(found)) {
889
+ response = found.apply(context, passedArguments);
890
+ } else if (found !== undefined) {
891
+ response = found;
892
+ }
893
+ if (Array.isArray(returnedValue)) {
894
+ returnedValue.push(response);
895
+ } else if (returnedValue !== undefined) {
896
+ returnedValue = [returnedValue, response];
897
+ } else if (response !== undefined) {
898
+ returnedValue = response;
899
+ }
900
+
901
+ return found;
902
+ },
903
+ };
904
+
905
+ if (methodInvoked) {
906
+ if (instance === undefined) {
907
+ module.initialize();
908
+ }
909
+ module.invoke(query);
910
+ } else {
911
+ if (instance !== undefined) {
912
+ instance.invoke('destroy');
913
+ }
914
+ module.initialize();
199
915
  }
200
- }
201
- },
916
+ });
202
917
 
203
- bind: {
204
- transitionEnd: function(callback) {
205
- var
206
- transitionEnd = module.get.transitionEnd()
207
- ;
208
- $bars
209
- .one(transitionEnd + eventNamespace, function(event) {
210
- clearTimeout(module.failSafeTimer);
211
- callback.call(this, event);
212
- })
213
- ;
214
- module.failSafeTimer = setTimeout(function() {
215
- $bars.triggerHandler(transitionEnd);
216
- }, settings.duration + settings.failSafeDelay);
217
- module.verbose('Adding fail safe timer', module.timer);
218
- }
219
- },
918
+ return (returnedValue !== undefined)
919
+ ? returnedValue
920
+ : this;
921
+ };
220
922
 
221
- increment: function(incrementValue) {
222
- var
223
- startValue,
224
- newValue
225
- ;
226
- if( module.has.total() ) {
227
- startValue = module.get.value();
228
- incrementValue = incrementValue || 1;
229
- }
230
- else {
231
- startValue = module.get.percent();
232
- incrementValue = incrementValue || module.get.randomValue();
233
- }
234
- newValue = startValue + incrementValue;
235
- module.debug('Incrementing percentage by', startValue, newValue, incrementValue);
236
- newValue = module.get.normalizedValue(newValue);
237
- module.set.progress(newValue);
238
- },
239
- decrement: function(decrementValue) {
240
- var
241
- total = module.get.total(),
242
- startValue,
243
- newValue
244
- ;
245
- if(total) {
246
- startValue = module.get.value();
247
- decrementValue = decrementValue || 1;
248
- newValue = startValue - decrementValue;
249
- module.debug('Decrementing value by', decrementValue, startValue);
250
- }
251
- else {
252
- startValue = module.get.percent();
253
- decrementValue = decrementValue || module.get.randomValue();
254
- newValue = startValue - decrementValue;
255
- module.debug('Decrementing percentage by', decrementValue, startValue);
256
- }
257
- newValue = module.get.normalizedValue(newValue);
258
- module.set.progress(newValue);
259
- },
923
+ $.fn.progress.settings = {
924
+
925
+ name: 'Progress',
926
+ namespace: 'progress',
927
+
928
+ silent: false,
929
+ debug: false,
930
+ verbose: false,
931
+ performance: true,
260
932
 
261
- has: {
262
- progressPoll: function() {
263
- return module.progressPoll;
264
- },
265
- total: function() {
266
- return (module.get.total() !== false);
267
- }
933
+ random: {
934
+ min: 2,
935
+ max: 5,
268
936
  },
269
937
 
270
- get: {
271
- text: function(templateText, index) {
272
- var
273
- index_ = index || 0,
274
- value = module.get.value(index_),
275
- total = module.get.total(),
276
- percent = (animating)
277
- ? module.get.displayPercent(index_)
278
- : module.get.percent(index_),
279
- left = (total !== false)
280
- ? Math.max(0,total - value)
281
- : (100 - percent)
282
- ;
283
- templateText = templateText || '';
284
- templateText = templateText
285
- .replace('{value}', value)
286
- .replace('{total}', total || 0)
287
- .replace('{left}', left)
288
- .replace('{percent}', percent)
289
- .replace('{bar}', settings.text.bars[index_] || '')
290
- ;
291
- module.verbose('Adding variables to progress bar text', templateText);
292
- return templateText;
293
- },
294
-
295
- normalizedValue: function(value) {
296
- if(value < 0) {
297
- module.debug('Value cannot decrement below 0');
298
- return 0;
299
- }
300
- if(module.has.total()) {
301
- if(value > module.total) {
302
- module.debug('Value cannot increment above total', module.total);
303
- return module.total;
304
- }
305
- }
306
- else if(value > 100 ) {
307
- module.debug('Value cannot increment above 100 percent');
308
- return 100;
309
- }
310
- return value;
311
- },
938
+ duration: 300,
312
939
 
313
- updateInterval: function() {
314
- if(settings.updateInterval == 'auto') {
315
- return settings.duration;
316
- }
317
- return settings.updateInterval;
318
- },
319
-
320
- randomValue: function() {
321
- module.debug('Generating random increment percentage');
322
- return Math.floor((Math.random() * settings.random.max) + settings.random.min);
323
- },
324
-
325
- numericValue: function(value) {
326
- return (typeof value === 'string')
327
- ? (value.replace(/[^\d.]/g, '') !== '')
328
- ? +(value.replace(/[^\d.]/g, ''))
329
- : false
330
- : value
331
- ;
332
- },
940
+ updateInterval: 'auto',
333
941
 
334
- transitionEnd: function() {
335
- var
336
- element = document.createElement('element'),
337
- transitions = {
338
- 'transition' :'transitionend',
339
- 'OTransition' :'oTransitionEnd',
340
- 'MozTransition' :'transitionend',
341
- 'WebkitTransition' :'webkitTransitionEnd'
342
- },
343
- transition
344
- ;
345
- for(transition in transitions){
346
- if( element.style[transition] !== undefined ){
347
- return transitions[transition];
348
- }
349
- }
350
- },
942
+ autoSuccess: true,
943
+ showActivity: true,
944
+ limitValues: true,
351
945
 
352
- // gets current displayed percentage (if animating values this is the intermediary value)
353
- displayPercent: function(index) {
354
- var
355
- $bar = $($bars[index]),
356
- barWidth = $bar.width(),
357
- totalWidth = $module.width(),
358
- minDisplay = parseInt($bar.css('min-width'), 10),
359
- displayPercent = (barWidth > minDisplay)
360
- ? (barWidth / totalWidth * 100)
361
- : module.percent
362
- ;
363
- return (settings.precision > 0)
364
- ? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
365
- : Math.round(displayPercent)
366
- ;
367
- },
368
-
369
- percent: function(index) {
370
- return module.percent && module.percent[index || 0] || 0;
371
- },
372
- value: function(index) {
373
- return module.nextValue || module.value && module.value[index || 0] || 0;
374
- },
375
- total: function() {
376
- return module.total !== undefined ? module.total : false;
377
- }
378
- },
946
+ label: 'percent',
947
+ precision: 0,
948
+ framerate: (1000 / 30), /// 30 fps
379
949
 
380
- create: {
381
- progressPoll: function() {
382
- module.progressPoll = setTimeout(function() {
383
- module.update.toNextValue();
384
- module.remove.progressPoll();
385
- }, module.get.updateInterval());
386
- },
387
- },
950
+ percent: false,
951
+ total: false,
952
+ value: false,
388
953
 
389
- is: {
390
- complete: function() {
391
- return module.is.success() || module.is.warning() || module.is.error();
392
- },
393
- success: function() {
394
- return $module.hasClass(className.success);
395
- },
396
- warning: function() {
397
- return $module.hasClass(className.warning);
398
- },
399
- error: function() {
400
- return $module.hasClass(className.error);
401
- },
402
- active: function() {
403
- return $module.hasClass(className.active);
404
- },
405
- visible: function() {
406
- return $module.is(':visible');
407
- }
408
- },
954
+ // delay in ms for fail safe animation callback
955
+ failSafeDelay: 100,
409
956
 
410
- remove: {
411
- progressPoll: function() {
412
- module.verbose('Removing progress poll timer');
413
- if(module.progressPoll) {
414
- clearTimeout(module.progressPoll);
415
- delete module.progressPoll;
416
- }
417
- },
418
- nextValue: function() {
419
- module.verbose('Removing progress value stored for next update');
420
- delete module.nextValue;
421
- },
422
- state: function() {
423
- module.verbose('Removing stored state');
424
- delete module.total;
425
- delete module.percent;
426
- delete module.value;
427
- },
428
- active: function() {
429
- module.verbose('Removing active state');
430
- $module.removeClass(className.active);
431
- },
432
- success: function() {
433
- module.verbose('Removing success state');
434
- $module.removeClass(className.success);
435
- },
436
- warning: function() {
437
- module.verbose('Removing warning state');
438
- $module.removeClass(className.warning);
439
- },
440
- error: function() {
441
- module.verbose('Removing error state');
442
- $module.removeClass(className.error);
443
- }
957
+ onLabelUpdate: function (state, text, value, total) {
958
+ return text;
444
959
  },
445
-
446
- set: {
447
- barWidth: function(values) {
448
- module.debug("set bar width with ", values);
449
- values = module.helper.forceArray(values);
450
- var firstNonZeroIndex = -1;
451
- var lastNonZeroIndex = -1;
452
- var valuesSum = module.helper.sum(values);
453
- var barCounts = $bars.length;
454
- var isMultiple = barCounts > 1;
455
- var percents = values.map(function(value, index) {
456
- var allZero = (index === barCounts - 1 && valuesSum === 0);
457
- var $bar = $($bars[index]);
458
- if (value === 0 && isMultiple && !allZero) {
459
- $bar.css('display', 'none');
460
- } else {
461
- if (isMultiple && allZero) {
462
- $bar.css('background', 'transparent');
463
- }
464
- if (firstNonZeroIndex == -1) {
465
- firstNonZeroIndex = index;
466
- }
467
- lastNonZeroIndex = index;
468
- $bar.css({
469
- display: 'block',
470
- width: value + '%'
471
- });
472
- }
473
- return parseFloat(value);
474
- });
475
- values.forEach(function(_, index) {
476
- var $bar = $($bars[index]);
477
- $bar.css({
478
- borderTopLeftRadius: index == firstNonZeroIndex ? '' : 0,
479
- borderBottomLeftRadius: index == firstNonZeroIndex ? '' : 0,
480
- borderTopRightRadius: index == lastNonZeroIndex ? '' : 0,
481
- borderBottomRightRadius: index == lastNonZeroIndex ? '' : 0
482
- });
483
- });
484
- $module
485
- .attr('data-percent', percents)
486
- ;
487
- },
488
- duration: function(duration) {
489
- duration = duration || settings.duration;
490
- duration = (typeof duration == 'number')
491
- ? duration + 'ms'
492
- : duration
493
- ;
494
- module.verbose('Setting progress bar transition duration', duration);
495
- $bars
496
- .css({
497
- 'transition-duration': duration
498
- })
499
- ;
500
- },
501
- percent: function(percents) {
502
- percents = module.helper.forceArray(percents).map(function(percent) {
503
- percent = (typeof percent == 'string')
504
- ? +(percent.replace('%', ''))
505
- : percent
506
- ;
507
- return (settings.limitValues)
508
- ? Math.max(0, Math.min(100, percent))
509
- : percent
510
- ;
511
- });
512
- var hasTotal = module.has.total();
513
- var totalPercent = module.helper.sum(percents);
514
- var isMultipleValues = percents.length > 1 && hasTotal;
515
- var sumTotal = module.helper.sum(module.helper.forceArray(module.value));
516
- if (isMultipleValues && sumTotal > module.total) {
517
- // Sum values instead of pecents to avoid precision issues when summing floats
518
- module.error(error.sumExceedsTotal, sumTotal, module.total);
519
- } else if (!isMultipleValues && totalPercent > 100) {
520
- // Sum before rounding since sum of rounded may have error though sum of actual is fine
521
- module.error(error.tooHigh, totalPercent);
522
- } else if (totalPercent < 0) {
523
- module.error(error.tooLow, totalPercent);
524
- } else {
525
- var autoPrecision = settings.precision > 0
526
- ? settings.precision
527
- : isMultipleValues
528
- ? module.helper.derivePrecision(Math.min.apply(null, module.value), module.total)
529
- : 0;
530
-
531
- // round display percentage
532
- var roundedPercents = percents.map(function (percent) {
533
- return (autoPrecision > 0)
534
- ? Math.round(percent * (10 * autoPrecision)) / (10 * autoPrecision)
535
- : Math.round(percent)
536
- ;
537
- });
538
- module.percent = roundedPercents;
539
- if (hasTotal) {
540
- module.value = percents.map(function (percent) {
541
- return (autoPrecision > 0)
542
- ? Math.round((percent / 100) * module.total * (10 * autoPrecision)) / (10 * autoPrecision)
543
- : Math.round((percent / 100) * module.total * 10) / 10
544
- ;
545
- });
546
- }
547
- module.set.barWidth(percents);
548
- module.set.labelInterval();
549
- }
550
- settings.onChange.call(element, percents, module.value, module.total);
551
- },
552
- labelInterval: function() {
553
- var
554
- animationCallback = function() {
555
- module.verbose('Bar finished animating, removing continuous label updates');
556
- clearInterval(module.interval);
557
- animating = false;
558
- module.set.labels();
559
- }
560
- ;
561
- clearInterval(module.interval);
562
- module.bind.transitionEnd(animationCallback);
563
- animating = true;
564
- module.interval = setInterval(function() {
565
- var
566
- isInDOM = $.contains(document.documentElement, element)
567
- ;
568
- if(!isInDOM) {
569
- clearInterval(module.interval);
570
- animating = false;
571
- }
572
- module.set.labels();
573
- }, settings.framerate);
574
- },
575
- labels: function() {
576
- module.verbose('Setting both bar progress and outer label text');
577
- module.set.barLabel();
578
- module.set.state();
579
- },
580
- label: function(text) {
581
- text = text || '';
582
- if(text) {
583
- text = module.get.text(text);
584
- module.verbose('Setting label to text', text);
585
- $label.text(text);
586
- }
587
- },
588
- state: function(percent) {
589
- percent = (percent !== undefined)
590
- ? percent
591
- : module.helper.sum(module.percent)
592
- ;
593
- if(percent === 100) {
594
- if(settings.autoSuccess && $bars.length === 1 && !(module.is.warning() || module.is.error() || module.is.success())) {
595
- module.set.success();
596
- module.debug('Automatically triggering success at 100%');
597
- }
598
- else {
599
- module.verbose('Reached 100% removing active state');
600
- module.remove.active();
601
- module.remove.progressPoll();
602
- }
603
- }
604
- else if(percent > 0) {
605
- module.verbose('Adjusting active progress bar label', percent);
606
- module.set.active();
607
- }
608
- else {
609
- module.remove.active();
610
- module.remove.warning();
611
- module.remove.error();
612
- module.remove.success();
613
- module.set.label(settings.text.active);
614
- }
615
- },
616
- barLabel: function(text) {
617
- $progresses.map(function(index, element){
618
- var $progress = $(element);
619
- if (text !== undefined) {
620
- $progress.text( module.get.text(text, index) );
621
- }
622
- else if (settings.label == 'ratio' && module.has.total()) {
623
- module.verbose('Adding ratio to bar label');
624
- $progress.text( module.get.text(settings.text.ratio, index) );
625
- }
626
- else if (settings.label == 'percent') {
627
- module.verbose('Adding percentage to bar label');
628
- $progress.text( module.get.text(settings.text.percent, index) );
629
- }
630
- });
631
- },
632
- active: function(text) {
633
- text = text || settings.text.active;
634
- module.debug('Setting active state');
635
- if(settings.showActivity && !module.is.active() ) {
636
- $module.addClass(className.active);
637
- }
638
- module.remove.warning();
639
- module.remove.error();
640
- module.remove.success();
641
- text = settings.onLabelUpdate('active', text, module.value, module.total);
642
- if(text) {
643
- module.set.label(text);
644
- }
645
- module.bind.transitionEnd(function() {
646
- settings.onActive.call(element, module.value, module.total);
647
- });
648
- },
649
- success : function(text, keepState) {
650
- text = text || settings.text.success || settings.text.active;
651
- module.debug('Setting success state');
652
- $module.addClass(className.success);
653
- module.remove.active();
654
- module.remove.warning();
655
- module.remove.error();
656
- module.complete(keepState);
657
- if(settings.text.success) {
658
- text = settings.onLabelUpdate('success', text, module.value, module.total);
659
- module.set.label(text);
660
- }
661
- else {
662
- text = settings.onLabelUpdate('active', text, module.value, module.total);
663
- module.set.label(text);
664
- }
665
- module.bind.transitionEnd(function() {
666
- settings.onSuccess.call(element, module.total);
667
- });
668
- },
669
- warning : function(text, keepState) {
670
- text = text || settings.text.warning;
671
- module.debug('Setting warning state');
672
- $module.addClass(className.warning);
673
- module.remove.active();
674
- module.remove.success();
675
- module.remove.error();
676
- module.complete(keepState);
677
- text = settings.onLabelUpdate('warning', text, module.value, module.total);
678
- if(text) {
679
- module.set.label(text);
680
- }
681
- module.bind.transitionEnd(function() {
682
- settings.onWarning.call(element, module.value, module.total);
683
- });
684
- },
685
- error : function(text, keepState) {
686
- text = text || settings.text.error;
687
- module.debug('Setting error state');
688
- $module.addClass(className.error);
689
- module.remove.active();
690
- module.remove.success();
691
- module.remove.warning();
692
- module.complete(keepState);
693
- text = settings.onLabelUpdate('error', text, module.value, module.total);
694
- if(text) {
695
- module.set.label(text);
696
- }
697
- module.bind.transitionEnd(function() {
698
- settings.onError.call(element, module.value, module.total);
699
- });
700
- },
701
- transitionEvent: function() {
702
- transitionEnd = module.get.transitionEnd();
703
- },
704
- total: function(totalValue) {
705
- module.total = totalValue;
706
- },
707
- value: function(value) {
708
- module.value = module.helper.forceArray(value);
709
- },
710
- progress: function(value) {
711
- if(!module.has.progressPoll()) {
712
- module.debug('First update in progress update interval, immediately updating', value);
713
- module.update.progress(value);
714
- module.create.progressPoll();
715
- }
716
- else {
717
- module.debug('Updated within interval, setting next update to use new value', value);
718
- module.set.nextValue(value);
719
- }
720
- },
721
- nextValue: function(value) {
722
- module.nextValue = value;
723
- }
960
+ onChange: function (percent, value, total) {},
961
+ onSuccess: function (total) {},
962
+ onActive: function (value, total) {},
963
+ onError: function (value, total) {},
964
+ onWarning: function (value, total) {},
965
+
966
+ error: {
967
+ method: 'The method you called is not defined.',
968
+ nonNumeric: 'Progress value is non numeric',
969
+ tooHigh: 'Value specified is above 100%',
970
+ tooLow: 'Value specified is below 0%',
971
+ sumExceedsTotal: 'Sum of multiple values exceed total',
724
972
  },
725
973
 
726
- update: {
727
- toNextValue: function() {
728
- var
729
- nextValue = module.nextValue
730
- ;
731
- if(nextValue) {
732
- module.debug('Update interval complete using last updated value', nextValue);
733
- module.update.progress(nextValue);
734
- module.remove.nextValue();
735
- }
736
- },
737
- progress: function(values) {
738
- var hasTotal = module.has.total();
739
- if (hasTotal) {
740
- module.set.value(values);
741
- }
742
- var percentCompletes = module.helper.forceArray(values).map(function(value) {
743
- var
744
- percentComplete
745
- ;
746
- value = module.get.numericValue(value);
747
- if (value === false) {
748
- module.error(error.nonNumeric, value);
749
- }
750
- value = module.get.normalizedValue(value);
751
- if (hasTotal) {
752
- percentComplete = module.total > 0 ? (value / module.total) * 100 : 100;
753
- module.debug('Calculating percent complete from total', percentComplete);
754
- }
755
- else {
756
- percentComplete = value;
757
- module.debug('Setting value to exact percentage value', percentComplete);
758
- }
759
- return percentComplete;
760
- });
761
- module.set.percent( percentCompletes );
762
- }
974
+ regExp: {
975
+ variable: /\{\$*[a-z0-9]+\}/gi,
763
976
  },
764
977
 
765
- setting: function(name, value) {
766
- module.debug('Changing setting', name, value);
767
- if( $.isPlainObject(name) ) {
768
- $.extend(true, settings, name);
769
- }
770
- else if(value !== undefined) {
771
- if($.isPlainObject(settings[name])) {
772
- $.extend(true, settings[name], value);
773
- }
774
- else {
775
- settings[name] = value;
776
- }
777
- }
778
- else {
779
- return settings[name];
780
- }
978
+ metadata: {
979
+ percent: 'percent',
980
+ total: 'total',
981
+ value: 'value',
781
982
  },
782
- internal: function(name, value) {
783
- if( $.isPlainObject(name) ) {
784
- $.extend(true, module, name);
785
- }
786
- else if(value !== undefined) {
787
- module[name] = value;
788
- }
789
- else {
790
- return module[name];
791
- }
792
- },
793
- debug: function() {
794
- if(!settings.silent && settings.debug) {
795
- if(settings.performance) {
796
- module.performance.log(arguments);
797
- }
798
- else {
799
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
800
- module.debug.apply(console, arguments);
801
- }
802
- }
803
- },
804
- verbose: function() {
805
- if(!settings.silent && settings.verbose && settings.debug) {
806
- if(settings.performance) {
807
- module.performance.log(arguments);
808
- }
809
- else {
810
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
811
- module.verbose.apply(console, arguments);
812
- }
813
- }
983
+
984
+ selector: {
985
+ bar: '> .bar',
986
+ label: '> .label',
987
+ progress: '.bar > .progress',
814
988
  },
815
- error: function() {
816
- if(!settings.silent) {
817
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
818
- module.error.apply(console, arguments);
819
- }
989
+
990
+ text: {
991
+ active: false,
992
+ error: false,
993
+ success: false,
994
+ warning: false,
995
+ percent: '{percent}%',
996
+ ratio: '{value} of {total}',
997
+ bars: [''],
820
998
  },
821
- performance: {
822
- log: function(message) {
823
- var
824
- currentTime,
825
- executionTime,
826
- previousTime
827
- ;
828
- if(settings.performance) {
829
- currentTime = new Date().getTime();
830
- previousTime = time || currentTime;
831
- executionTime = currentTime - previousTime;
832
- time = currentTime;
833
- performance.push({
834
- 'Name' : message[0],
835
- 'Arguments' : [].slice.call(message, 1) || '',
836
- 'Element' : element,
837
- 'Execution Time' : executionTime
838
- });
839
- }
840
- clearTimeout(module.performance.timer);
841
- module.performance.timer = setTimeout(module.performance.display, 500);
842
- },
843
- display: function() {
844
- var
845
- title = settings.name + ':',
846
- totalTime = 0
847
- ;
848
- time = false;
849
- clearTimeout(module.performance.timer);
850
- $.each(performance, function(index, data) {
851
- totalTime += data['Execution Time'];
852
- });
853
- title += ' ' + totalTime + 'ms';
854
- if(moduleSelector) {
855
- title += ' \'' + moduleSelector + '\'';
856
- }
857
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
858
- console.groupCollapsed(title);
859
- if(console.table) {
860
- console.table(performance);
861
- }
862
- else {
863
- $.each(performance, function(index, data) {
864
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
865
- });
866
- }
867
- console.groupEnd();
868
- }
869
- performance = [];
870
- }
999
+
1000
+ className: {
1001
+ active: 'active',
1002
+ error: 'error',
1003
+ success: 'success',
1004
+ warning: 'warning',
871
1005
  },
872
- invoke: function(query, passedArguments, context) {
873
- var
874
- object = instance,
875
- maxDepth,
876
- found,
877
- response
878
- ;
879
- passedArguments = passedArguments || queryArguments;
880
- context = context || element;
881
- if(typeof query == 'string' && object !== undefined) {
882
- query = query.split(/[\. ]/);
883
- maxDepth = query.length - 1;
884
- $.each(query, function(depth, value) {
885
- var camelCaseValue = (depth != maxDepth)
886
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
887
- : query
888
- ;
889
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
890
- object = object[camelCaseValue];
891
- }
892
- else if( object[camelCaseValue] !== undefined ) {
893
- found = object[camelCaseValue];
894
- return false;
895
- }
896
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
897
- object = object[value];
898
- }
899
- else if( object[value] !== undefined ) {
900
- found = object[value];
901
- return false;
902
- }
903
- else {
904
- module.error(error.method, query);
905
- return false;
906
- }
907
- });
908
- }
909
- if ( $.isFunction( found ) ) {
910
- response = found.apply(context, passedArguments);
911
- }
912
- else if(found !== undefined) {
913
- response = found;
914
- }
915
- if(Array.isArray(returnedValue)) {
916
- returnedValue.push(response);
917
- }
918
- else if(returnedValue !== undefined) {
919
- returnedValue = [returnedValue, response];
920
- }
921
- else if(response !== undefined) {
922
- returnedValue = response;
923
- }
924
- return found;
925
- }
926
- };
927
-
928
- if(methodInvoked) {
929
- if(instance === undefined) {
930
- module.initialize();
931
- }
932
- module.invoke(query);
933
- }
934
- else {
935
- if(instance !== undefined) {
936
- instance.invoke('destroy');
937
- }
938
- module.initialize();
939
- }
940
- })
941
- ;
942
-
943
- return (returnedValue !== undefined)
944
- ? returnedValue
945
- : this
946
- ;
947
- };
948
-
949
- $.fn.progress.settings = {
950
-
951
- name : 'Progress',
952
- namespace : 'progress',
953
-
954
- silent : false,
955
- debug : false,
956
- verbose : false,
957
- performance : true,
958
-
959
- random : {
960
- min : 2,
961
- max : 5
962
- },
963
-
964
- duration : 300,
965
-
966
- updateInterval : 'auto',
967
-
968
- autoSuccess : true,
969
- showActivity : true,
970
- limitValues : true,
971
-
972
- label : 'percent',
973
- precision : 0,
974
- framerate : (1000 / 30), /// 30 fps
975
-
976
- percent : false,
977
- total : false,
978
- value : false,
979
-
980
- // delay in ms for fail safe animation callback
981
- failSafeDelay : 100,
982
-
983
- onLabelUpdate : function(state, text, value, total){
984
- return text;
985
- },
986
- onChange : function(percent, value, total){},
987
- onSuccess : function(total){},
988
- onActive : function(value, total){},
989
- onError : function(value, total){},
990
- onWarning : function(value, total){},
991
-
992
- error : {
993
- method : 'The method you called is not defined.',
994
- nonNumeric : 'Progress value is non numeric',
995
- tooHigh : 'Value specified is above 100%',
996
- tooLow : 'Value specified is below 0%',
997
- sumExceedsTotal : 'Sum of multiple values exceed total',
998
- },
999
-
1000
- regExp: {
1001
- variable: /\{\$*[a-z0-9]+\}/gi
1002
- },
1003
-
1004
- metadata: {
1005
- percent : 'percent',
1006
- total : 'total',
1007
- value : 'value'
1008
- },
1009
-
1010
- selector : {
1011
- bar : '> .bar',
1012
- label : '> .label',
1013
- progress : '.bar > .progress'
1014
- },
1015
-
1016
- text : {
1017
- active : false,
1018
- error : false,
1019
- success : false,
1020
- warning : false,
1021
- percent : '{percent}%',
1022
- ratio : '{value} of {total}',
1023
- bars : ['']
1024
- },
1025
-
1026
- className : {
1027
- active : 'active',
1028
- error : 'error',
1029
- success : 'success',
1030
- warning : 'warning'
1031
- }
1032
-
1033
- };
1034
-
1035
-
1036
- })( jQuery, window, document );
1006
+
1007
+ };
1008
+ })(jQuery, window, document);