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
@@ -8,961 +8,916 @@
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.sticky = function(parameters) {
27
- var
28
- $allModules = $(this),
29
- moduleSelector = $allModules.selector || '',
30
-
31
- time = new Date().getTime(),
32
- performance = [],
33
-
34
- query = arguments[0],
35
- methodInvoked = (typeof query == 'string'),
36
- queryArguments = [].slice.call(arguments, 1),
37
- returnedValue
38
- ;
39
-
40
- $allModules
41
- .each(function() {
42
- var
43
- settings = ( $.isPlainObject(parameters) )
44
- ? $.extend(true, {}, $.fn.sticky.settings, parameters)
45
- : $.extend({}, $.fn.sticky.settings),
46
-
47
- className = settings.className,
48
- namespace = settings.namespace,
49
- error = settings.error,
50
-
51
- eventNamespace = '.' + namespace,
52
- moduleNamespace = 'module-' + namespace,
53
-
54
- $module = $(this),
55
- $window = $(window),
56
- $scroll = [window,document].indexOf(settings.scrollContext) < 0 ? $(document).find(settings.scrollContext) : $(settings.scrollContext),
57
- $container,
58
- $context,
59
-
60
- instance = $module.data(moduleNamespace),
61
-
62
- requestAnimationFrame = window.requestAnimationFrame
63
- || window.mozRequestAnimationFrame
64
- || window.webkitRequestAnimationFrame
65
- || window.msRequestAnimationFrame
66
- || function(callback) { setTimeout(callback, 0); },
67
-
68
- element = this,
69
-
70
- documentObserver,
71
- observer,
72
- module
73
- ;
74
-
75
- module = {
76
-
77
- initialize: function() {
78
-
79
- module.determineContainer();
80
- module.determineContext();
81
- module.verbose('Initializing sticky', settings, $container);
82
-
83
- module.save.positions();
84
- module.checkErrors();
85
- module.bind.events();
86
-
87
- if(settings.observeChanges) {
88
- module.observeChanges();
89
- }
90
- module.instantiate();
91
- },
11
+ (function ($, window, document, undefined) {
12
+ 'use strict';
92
13
 
93
- instantiate: function() {
94
- module.verbose('Storing instance of module', module);
95
- instance = module;
96
- $module
97
- .data(moduleNamespace, module)
98
- ;
99
- },
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
100
17
 
101
- destroy: function() {
102
- module.verbose('Destroying previous instance');
103
- module.reset();
104
- if(documentObserver) {
105
- documentObserver.disconnect();
106
- }
107
- if(observer) {
108
- observer.disconnect();
109
- }
110
- $window
111
- .off('load' + eventNamespace, module.event.load)
112
- .off('resize' + eventNamespace, module.event.resize)
113
- ;
114
- $scroll
115
- .off('scrollchange' + eventNamespace, module.event.scrollchange)
116
- ;
117
- $module.removeData(moduleNamespace);
118
- },
18
+ window = (typeof window != 'undefined' && window.Math == Math)
19
+ ? window
20
+ : globalThis;
119
21
 
120
- observeChanges: function() {
121
- if('MutationObserver' in window) {
122
- documentObserver = new MutationObserver(module.event.documentChanged);
123
- observer = new MutationObserver(module.event.changed);
124
- documentObserver.observe(document, {
125
- childList : true,
126
- subtree : true
127
- });
128
- observer.observe(element, {
129
- childList : true,
130
- subtree : true
131
- });
132
- observer.observe($context[0], {
133
- childList : true,
134
- subtree : true
135
- });
136
- module.debug('Setting up mutation observer', observer);
137
- }
138
- },
22
+ $.fn.sticky = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $document = $(document),
26
+ moduleSelector = $allModules.selector || '',
139
27
 
140
- determineContainer: function() {
141
- if(settings.container) {
142
- $container = [window,document].indexOf(settings.container) < 0 ? $(document).find(settings.container) : $(settings.container);
143
- }
144
- else {
145
- $container = $module.offsetParent();
146
- }
147
- },
28
+ time = new Date().getTime(),
29
+ performance = [],
148
30
 
149
- determineContext: function() {
150
- if(settings.context) {
151
- $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context);
152
- }
153
- else {
154
- $context = $container;
155
- }
156
- if($context.length === 0) {
157
- module.error(error.invalidContext, settings.context, $module);
158
- }
159
- },
160
-
161
- checkErrors: function() {
162
- if( module.is.hidden() ) {
163
- module.error(error.visible, $module);
164
- }
165
- if(module.cache.element.height > module.cache.context.height) {
166
- module.reset();
167
- module.error(error.elementSize, $module);
168
- }
169
- },
31
+ query = arguments[0],
32
+ methodInvoked = (typeof query == 'string'),
33
+ queryArguments = [].slice.call(arguments, 1),
34
+ returnedValue
35
+ ;
170
36
 
171
- bind: {
172
- events: function() {
173
- $window
174
- .on('load' + eventNamespace, module.event.load)
175
- .on('resize' + eventNamespace, module.event.resize)
176
- ;
177
- // pub/sub pattern
178
- $scroll
179
- .off('scroll' + eventNamespace)
180
- .on('scroll' + eventNamespace, module.event.scroll)
181
- .on('scrollchange' + eventNamespace, module.event.scrollchange)
37
+ $allModules.each(function () {
38
+ var
39
+ settings = ($.isPlainObject(parameters))
40
+ ? $.extend(true, {}, $.fn.sticky.settings, parameters)
41
+ : $.extend({}, $.fn.sticky.settings),
42
+
43
+ className = settings.className,
44
+ namespace = settings.namespace,
45
+ error = settings.error,
46
+
47
+ eventNamespace = '.' + namespace,
48
+ moduleNamespace = 'module-' + namespace,
49
+
50
+ $module = $(this),
51
+ $window = $(window),
52
+ $scroll = [window, document].indexOf(settings.scrollContext) < 0 ? $document.find(settings.scrollContext) : $(settings.scrollContext),
53
+ $container,
54
+ $context,
55
+
56
+ instance = $module.data(moduleNamespace),
57
+
58
+ requestAnimationFrame = window.requestAnimationFrame
59
+ || window.mozRequestAnimationFrame
60
+ || window.webkitRequestAnimationFrame
61
+ || window.msRequestAnimationFrame
62
+ || function (callback) {
63
+ setTimeout(callback, 0);
64
+ },
65
+
66
+ element = this,
67
+
68
+ documentObserver,
69
+ observer,
70
+ module
182
71
  ;
183
- }
184
- },
185
72
 
186
- event: {
187
- changed: function(mutations) {
188
- clearTimeout(module.timer);
189
- module.timer = setTimeout(function() {
190
- module.verbose('DOM tree modified, updating sticky menu', mutations);
191
- module.refresh();
192
- }, 100);
193
- },
194
- documentChanged: function(mutations) {
195
- [].forEach.call(mutations, function(mutation) {
196
- if(mutation.removedNodes) {
197
- [].forEach.call(mutation.removedNodes, function(node) {
198
- if(node == element || $(node).find(element).length > 0) {
199
- module.debug('Element removed from DOM, tearing down events');
200
- module.destroy();
201
- }
202
- });
203
- }
204
- });
205
- },
206
- load: function() {
207
- module.verbose('Page contents finished loading');
208
- requestAnimationFrame(module.refresh);
209
- },
210
- resize: function() {
211
- module.verbose('Window resized');
212
- requestAnimationFrame(module.refresh);
213
- },
214
- scroll: function() {
215
- requestAnimationFrame(function() {
216
- $scroll.triggerHandler('scrollchange' + eventNamespace, $scroll.scrollTop() );
217
- });
218
- },
219
- scrollchange: function(event, scrollPosition) {
220
- module.stick(scrollPosition);
221
- settings.onScroll.call(element);
222
- }
223
- },
73
+ module = {
224
74
 
225
- refresh: function(hardRefresh) {
226
- module.reset();
227
- if(!settings.context) {
228
- module.determineContext();
229
- }
230
- if(hardRefresh) {
231
- module.determineContainer();
232
- }
233
- module.save.positions();
234
- module.stick();
235
- settings.onReposition.call(element);
236
- },
75
+ initialize: function () {
76
+ module.determineContainer();
77
+ module.determineContext();
78
+ module.verbose('Initializing sticky', settings, $container);
237
79
 
238
- supports: {
239
- sticky: function() {
240
- var
241
- $element = $('<div/>')
242
- ;
243
- $element.addClass(className.supported);
244
- return($element.css('position').match('sticky'));
245
- }
246
- },
80
+ module.save.positions();
81
+ module.checkErrors();
82
+ module.bind.events();
247
83
 
248
- save: {
249
- lastScroll: function(scroll) {
250
- module.lastScroll = scroll;
251
- },
252
- elementScroll: function(scroll) {
253
- module.elementScroll = scroll;
254
- },
255
- positions: function() {
256
- var
257
- scrollContext = {
258
- height : $scroll.height()
259
- },
260
- element = {
261
- margin: {
262
- top : parseInt($module.css('margin-top'), 10),
263
- bottom : parseInt($module.css('margin-bottom'), 10),
264
- },
265
- offset : $module.offset(),
266
- width : $module.outerWidth(),
267
- height : $module.outerHeight()
268
- },
269
- context = {
270
- offset : $context.offset(),
271
- height : $context.outerHeight()
272
- }
273
- ;
274
- if( !module.is.standardScroll() ) {
275
- module.debug('Non-standard scroll. Removing scroll offset from element offset');
84
+ if (settings.observeChanges) {
85
+ module.observeChanges();
86
+ }
87
+ module.instantiate();
88
+ },
276
89
 
277
- scrollContext.top = $scroll.scrollTop();
278
- scrollContext.left = $scroll.scrollLeft();
90
+ instantiate: function () {
91
+ module.verbose('Storing instance of module', module);
92
+ instance = module;
93
+ $module
94
+ .data(moduleNamespace, module)
95
+ ;
96
+ },
279
97
 
280
- element.offset.top += scrollContext.top;
281
- context.offset.top += scrollContext.top;
282
- element.offset.left += scrollContext.left;
283
- context.offset.left += scrollContext.left;
284
- }
285
- module.cache = {
286
- fits : ( (element.height + settings.offset) <= scrollContext.height),
287
- sameHeight : (element.height == context.height),
288
- scrollContext : {
289
- height : scrollContext.height
290
- },
291
- element: {
292
- margin : element.margin,
293
- top : element.offset.top - element.margin.top,
294
- left : element.offset.left,
295
- width : element.width,
296
- height : element.height,
297
- bottom : element.offset.top + element.height
298
- },
299
- context: {
300
- top : context.offset.top,
301
- height : context.height,
302
- bottom : context.offset.top + context.height
303
- }
304
- };
305
- module.set.containerSize();
98
+ destroy: function () {
99
+ module.verbose('Destroying previous instance');
100
+ module.reset();
101
+ if (documentObserver) {
102
+ documentObserver.disconnect();
103
+ }
104
+ if (observer) {
105
+ observer.disconnect();
106
+ }
107
+ $window
108
+ .off('load' + eventNamespace, module.event.load)
109
+ .off('resize' + eventNamespace, module.event.resize)
110
+ ;
111
+ $scroll
112
+ .off('scrollchange' + eventNamespace, module.event.scrollchange)
113
+ ;
114
+ $module.removeData(moduleNamespace);
115
+ },
306
116
 
307
- module.stick();
308
- module.debug('Caching element positions', module.cache);
309
- }
310
- },
117
+ observeChanges: function () {
118
+ if ('MutationObserver' in window) {
119
+ documentObserver = new MutationObserver(module.event.documentChanged);
120
+ observer = new MutationObserver(module.event.changed);
121
+ documentObserver.observe(document, {
122
+ childList: true,
123
+ subtree: true,
124
+ });
125
+ observer.observe(element, {
126
+ childList: true,
127
+ subtree: true,
128
+ });
129
+ observer.observe($context[0], {
130
+ childList: true,
131
+ subtree: true,
132
+ });
133
+ module.debug('Setting up mutation observer', observer);
134
+ }
135
+ },
311
136
 
312
- get: {
313
- direction: function(scroll) {
314
- var
315
- direction = 'down'
316
- ;
317
- scroll = scroll || $scroll.scrollTop();
318
- if(module.lastScroll && module.lastScroll > scroll) {
319
- direction = 'up';
320
- }
321
- return direction;
322
- },
323
- scrollChange: function(scroll) {
324
- scroll = scroll || $scroll.scrollTop();
325
- return (module.lastScroll)
326
- ? (scroll - module.lastScroll)
327
- : 0
328
- ;
329
- },
330
- currentElementScroll: function() {
331
- if(module.elementScroll) {
332
- return module.elementScroll;
333
- }
334
- return ( module.is.top() )
335
- ? Math.abs(parseInt($module.css('top'), 10)) || 0
336
- : Math.abs(parseInt($module.css('bottom'), 10)) || 0
337
- ;
338
- },
137
+ determineContainer: function () {
138
+ if (settings.container) {
139
+ $container = [window, document].indexOf(settings.container) < 0 ? $document.find(settings.container) : $(settings.container);
140
+ } else {
141
+ $container = $module.offsetParent();
142
+ }
143
+ },
339
144
 
340
- elementScroll: function(scroll) {
341
- scroll = scroll || $scroll.scrollTop();
342
- var
343
- element = module.cache.element,
344
- scrollContext = module.cache.scrollContext,
345
- delta = module.get.scrollChange(scroll),
346
- maxScroll = (element.height - scrollContext.height + settings.offset),
347
- elementScroll = module.get.currentElementScroll(),
348
- possibleScroll = (elementScroll + delta)
349
- ;
350
- if(module.cache.fits || possibleScroll < 0) {
351
- elementScroll = 0;
352
- }
353
- else if(possibleScroll > maxScroll ) {
354
- elementScroll = maxScroll;
355
- }
356
- else {
357
- elementScroll = possibleScroll;
358
- }
359
- return elementScroll;
360
- }
361
- },
145
+ determineContext: function () {
146
+ if (settings.context) {
147
+ $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
148
+ } else {
149
+ $context = $container;
150
+ }
151
+ if ($context.length === 0) {
152
+ module.error(error.invalidContext, settings.context, $module);
153
+ }
154
+ },
362
155
 
363
- remove: {
364
- lastScroll: function() {
365
- delete module.lastScroll;
366
- },
367
- elementScroll: function() {
368
- delete module.elementScroll;
369
- },
370
- minimumSize: function() {
371
- $container
372
- .css('min-height', '')
373
- ;
374
- },
375
- offset: function() {
376
- $module.css('margin-top', '');
377
- }
378
- },
156
+ checkErrors: function () {
157
+ if (module.is.hidden()) {
158
+ module.error(error.visible, $module);
159
+ }
160
+ if (module.cache.element.height > module.cache.context.height) {
161
+ module.reset();
162
+ module.error(error.elementSize, $module);
163
+ }
164
+ },
379
165
 
380
- set: {
381
- offset: function() {
382
- module.verbose('Setting offset on element', settings.offset);
383
- $module
384
- .css('margin-top', settings.offset)
385
- ;
386
- },
387
- containerSize: function() {
388
- var
389
- tagName = $container[0].tagName
390
- ;
391
- if(tagName === 'HTML' || tagName === 'body') {
392
- // this can trigger for too many reasons
393
- //module.error(error.container, tagName, $module);
394
- module.determineContainer();
395
- }
396
- else {
397
- var tallestHeight = Math.max(module.cache.context.height, module.cache.element.height);
398
- if(tallestHeight - $container.outerHeight() > settings.jitter) {
399
- module.debug('Context is taller than container. Specifying exact height for container', module.cache.context.height);
400
- $container.css({
401
- height: tallestHeight,
402
- });
403
- }
404
- else {
405
- $container.css({
406
- height: '',
407
- });
408
- }
409
- if( Math.abs($container.outerHeight() - module.cache.context.height) > settings.jitter) {
410
- module.debug('Context has padding, specifying exact height for container', module.cache.context.height);
411
- $container.css({
412
- height: module.cache.context.height
413
- });
414
- }
415
- }
416
- },
417
- minimumSize: function() {
418
- var
419
- element = module.cache.element
420
- ;
421
- $container
422
- .css('min-height', element.height)
423
- ;
424
- },
425
- scroll: function(scroll) {
426
- module.debug('Setting scroll on element', scroll);
427
- if(module.elementScroll == scroll) {
428
- return;
429
- }
430
- if( module.is.top() ) {
431
- $module
432
- .css('bottom', '')
433
- .css('top', -scroll)
434
- ;
435
- }
436
- if( module.is.bottom() ) {
437
- $module
438
- .css('top', '')
439
- .css('bottom', scroll)
440
- ;
441
- }
442
- },
443
- size: function() {
444
- if(module.cache.element.height !== 0 && module.cache.element.width !== 0) {
445
- element.style.setProperty('width', module.cache.element.width + 'px', 'important');
446
- element.style.setProperty('height', module.cache.element.height + 'px', 'important');
447
- }
448
- }
449
- },
166
+ bind: {
167
+ events: function () {
168
+ $window
169
+ .on('load' + eventNamespace, module.event.load)
170
+ .on('resize' + eventNamespace, module.event.resize)
171
+ ;
172
+ // pub/sub pattern
173
+ $scroll
174
+ .off('scroll' + eventNamespace)
175
+ .on('scroll' + eventNamespace, module.event.scroll)
176
+ .on('scrollchange' + eventNamespace, module.event.scrollchange)
177
+ ;
178
+ },
179
+ },
450
180
 
451
- is: {
452
- standardScroll: function() {
453
- return ($scroll[0] == window);
454
- },
455
- top: function() {
456
- return $module.hasClass(className.top);
457
- },
458
- bottom: function() {
459
- return $module.hasClass(className.bottom);
460
- },
461
- initialPosition: function() {
462
- return (!module.is.fixed() && !module.is.bound());
463
- },
464
- hidden: function() {
465
- return (!$module.is(':visible'));
466
- },
467
- bound: function() {
468
- return $module.hasClass(className.bound);
469
- },
470
- fixed: function() {
471
- return $module.hasClass(className.fixed);
472
- }
473
- },
181
+ event: {
182
+ changed: function (mutations) {
183
+ clearTimeout(module.timer);
184
+ module.timer = setTimeout(function () {
185
+ module.verbose('DOM tree modified, updating sticky menu', mutations);
186
+ module.refresh();
187
+ }, 100);
188
+ },
189
+ documentChanged: function (mutations) {
190
+ [].forEach.call(mutations, function (mutation) {
191
+ if (mutation.removedNodes) {
192
+ [].forEach.call(mutation.removedNodes, function (node) {
193
+ if (node == element || $(node).find(element).length > 0) {
194
+ module.debug('Element removed from DOM, tearing down events');
195
+ module.destroy();
196
+ }
197
+ });
198
+ }
199
+ });
200
+ },
201
+ load: function () {
202
+ module.verbose('Page contents finished loading');
203
+ requestAnimationFrame(module.refresh);
204
+ },
205
+ resize: function () {
206
+ module.verbose('Window resized');
207
+ requestAnimationFrame(module.refresh);
208
+ },
209
+ scroll: function () {
210
+ requestAnimationFrame(function () {
211
+ $scroll.triggerHandler('scrollchange' + eventNamespace, $scroll.scrollTop());
212
+ });
213
+ },
214
+ scrollchange: function (event, scrollPosition) {
215
+ module.stick(scrollPosition);
216
+ settings.onScroll.call(element);
217
+ },
218
+ },
474
219
 
475
- stick: function(scrollPosition) {
476
- var
477
- cachedPosition = scrollPosition || $scroll.scrollTop(),
478
- cache = module.cache,
479
- fits = cache.fits,
480
- sameHeight = cache.sameHeight,
481
- element = cache.element,
482
- scrollContext = cache.scrollContext,
483
- context = cache.context,
484
- offset = (module.is.bottom() && settings.pushing)
485
- ? settings.bottomOffset
486
- : settings.offset,
487
- scroll = {
488
- top : cachedPosition + offset,
489
- bottom : cachedPosition + offset + scrollContext.height
490
- },
491
- elementScroll = (fits)
492
- ? 0
493
- : module.get.elementScroll(scroll.top),
494
-
495
- // shorthand
496
- doesntFit = !fits,
497
- elementVisible = (element.height !== 0)
498
- ;
499
- if(elementVisible && !sameHeight) {
500
-
501
- if( module.is.initialPosition() ) {
502
- if(scroll.top >= context.bottom) {
503
- module.debug('Initial element position is bottom of container');
504
- module.bindBottom();
505
- }
506
- else if(scroll.top > element.top) {
507
- if( (element.height + scroll.top - elementScroll) >= context.bottom && element.height < context.height) {
508
- module.debug('Initial element position is bottom of container');
509
- module.bindBottom();
510
- }
511
- else {
512
- module.debug('Initial element position is fixed');
513
- module.fixTop();
514
- }
515
- }
220
+ refresh: function (hardRefresh) {
221
+ module.reset();
222
+ if (!settings.context) {
223
+ module.determineContext();
224
+ }
225
+ if (hardRefresh) {
226
+ module.determineContainer();
227
+ }
228
+ module.save.positions();
229
+ module.stick();
230
+ settings.onReposition.call(element);
231
+ },
516
232
 
517
- }
518
- else if( module.is.fixed() ) {
233
+ supports: {
234
+ sticky: function () {
235
+ var
236
+ $element = $('<div/>')
237
+ ;
238
+ $element.addClass(className.supported);
519
239
 
520
- // currently fixed top
521
- if( module.is.top() ) {
522
- if( scroll.top <= element.top ) {
523
- module.debug('Fixed element reached top of container');
524
- module.setInitialPosition();
525
- }
526
- else if( (element.height + scroll.top - elementScroll) >= context.bottom ) {
527
- module.debug('Fixed element reached bottom of container');
528
- module.bindBottom();
529
- }
530
- // scroll element if larger than screen
531
- else if(doesntFit) {
532
- module.set.scroll(elementScroll);
533
- module.save.lastScroll(scroll.top);
534
- module.save.elementScroll(elementScroll);
535
- }
536
- }
240
+ return ($element.css('position').match('sticky'));
241
+ },
242
+ },
537
243
 
538
- // currently fixed bottom
539
- else if(module.is.bottom() ) {
244
+ save: {
245
+ lastScroll: function (scroll) {
246
+ module.lastScroll = scroll;
247
+ },
248
+ elementScroll: function (scroll) {
249
+ module.elementScroll = scroll;
250
+ },
251
+ positions: function () {
252
+ var
253
+ scrollContext = {
254
+ height: $scroll.height(),
255
+ },
256
+ element = {
257
+ margin: {
258
+ top: parseInt($module.css('margin-top'), 10),
259
+ bottom: parseInt($module.css('margin-bottom'), 10),
260
+ },
261
+ offset: $module.offset(),
262
+ width: $module.outerWidth(),
263
+ height: $module.outerHeight(),
264
+ },
265
+ context = {
266
+ offset: $context.offset(),
267
+ height: $context.outerHeight(),
268
+ }
269
+ ;
270
+ if (!module.is.standardScroll()) {
271
+ module.debug('Non-standard scroll. Removing scroll offset from element offset');
272
+
273
+ scrollContext.top = $scroll.scrollTop();
274
+ scrollContext.left = $scroll.scrollLeft();
275
+
276
+ element.offset.top += scrollContext.top;
277
+ context.offset.top += scrollContext.top;
278
+ element.offset.left += scrollContext.left;
279
+ context.offset.left += scrollContext.left;
280
+ }
281
+ module.cache = {
282
+ fits: ((element.height + settings.offset) <= scrollContext.height),
283
+ sameHeight: (element.height == context.height),
284
+ scrollContext: {
285
+ height: scrollContext.height,
286
+ },
287
+ element: {
288
+ margin: element.margin,
289
+ top: element.offset.top - element.margin.top,
290
+ left: element.offset.left,
291
+ width: element.width,
292
+ height: element.height,
293
+ bottom: element.offset.top + element.height,
294
+ },
295
+ context: {
296
+ top: context.offset.top,
297
+ height: context.height,
298
+ bottom: context.offset.top + context.height,
299
+ },
300
+ };
301
+ module.set.containerSize();
302
+
303
+ module.stick();
304
+ module.debug('Caching element positions', module.cache);
305
+ },
306
+ },
540
307
 
541
- // top edge
542
- if( (scroll.bottom - element.height) <= element.top) {
543
- module.debug('Bottom fixed rail has reached top of container');
544
- module.setInitialPosition();
545
- }
546
- // bottom edge
547
- else if(scroll.bottom >= context.bottom) {
548
- module.debug('Bottom fixed rail has reached bottom of container');
549
- module.bindBottom();
550
- }
551
- // scroll element if larger than screen
552
- else if(doesntFit) {
553
- module.set.scroll(elementScroll);
554
- module.save.lastScroll(scroll.top);
555
- module.save.elementScroll(elementScroll);
556
- }
308
+ get: {
309
+ direction: function (scroll) {
310
+ var
311
+ direction = 'down'
312
+ ;
313
+ scroll = scroll || $scroll.scrollTop();
314
+ if (module.lastScroll && module.lastScroll > scroll) {
315
+ direction = 'up';
316
+ }
317
+
318
+ return direction;
319
+ },
320
+ scrollChange: function (scroll) {
321
+ scroll = scroll || $scroll.scrollTop();
322
+
323
+ return (module.lastScroll)
324
+ ? (scroll - module.lastScroll)
325
+ : 0;
326
+ },
327
+ currentElementScroll: function () {
328
+ if (module.elementScroll) {
329
+ return module.elementScroll;
330
+ }
331
+
332
+ return (module.is.top())
333
+ ? Math.abs(parseInt($module.css('top'), 10)) || 0
334
+ : Math.abs(parseInt($module.css('bottom'), 10)) || 0;
335
+ },
336
+
337
+ elementScroll: function (scroll) {
338
+ scroll = scroll || $scroll.scrollTop();
339
+ var
340
+ element = module.cache.element,
341
+ scrollContext = module.cache.scrollContext,
342
+ delta = module.get.scrollChange(scroll),
343
+ maxScroll = (element.height - scrollContext.height + settings.offset),
344
+ elementScroll = module.get.currentElementScroll(),
345
+ possibleScroll = (elementScroll + delta)
346
+ ;
347
+ if (module.cache.fits || possibleScroll < 0) {
348
+ elementScroll = 0;
349
+ } else if (possibleScroll > maxScroll) {
350
+ elementScroll = maxScroll;
351
+ } else {
352
+ elementScroll = possibleScroll;
353
+ }
354
+
355
+ return elementScroll;
356
+ },
357
+ },
557
358
 
558
- }
559
- }
560
- else if( module.is.bottom() ) {
561
- if( scroll.top <= element.top ) {
562
- module.debug('Jumped from bottom fixed to top fixed, most likely used home/end button');
563
- module.setInitialPosition();
564
- }
565
- else {
566
- if(settings.pushing) {
567
- if(module.is.bound() && scroll.bottom <= context.bottom ) {
568
- module.debug('Fixing bottom attached element to bottom of browser.');
569
- module.fixBottom();
570
- }
359
+ remove: {
360
+ lastScroll: function () {
361
+ delete module.lastScroll;
362
+ },
363
+ elementScroll: function () {
364
+ delete module.elementScroll;
365
+ },
366
+ minimumSize: function () {
367
+ $container
368
+ .css('min-height', '')
369
+ ;
370
+ },
371
+ offset: function () {
372
+ $module.css('margin-top', '');
373
+ },
374
+ },
375
+
376
+ set: {
377
+ offset: function () {
378
+ module.verbose('Setting offset on element', settings.offset);
379
+ $module
380
+ .css('margin-top', settings.offset)
381
+ ;
382
+ },
383
+ containerSize: function () {
384
+ var
385
+ tagName = $container[0].tagName
386
+ ;
387
+ if (tagName === 'HTML' || tagName === 'body') {
388
+ // this can trigger for too many reasons
389
+ // module.error(error.container, tagName, $module);
390
+ module.determineContainer();
391
+ } else {
392
+ var tallestHeight = Math.max(module.cache.context.height, module.cache.element.height);
393
+ if (tallestHeight - $container.outerHeight() > settings.jitter) {
394
+ module.debug('Context is taller than container. Specifying exact height for container', module.cache.context.height);
395
+ $container.css({
396
+ height: tallestHeight,
397
+ });
398
+ } else {
399
+ $container.css({
400
+ height: '',
401
+ });
402
+ }
403
+ if (Math.abs($container.outerHeight() - module.cache.context.height) > settings.jitter) {
404
+ module.debug('Context has padding, specifying exact height for container', module.cache.context.height);
405
+ $container.css({
406
+ height: module.cache.context.height,
407
+ });
408
+ }
409
+ }
410
+ },
411
+ minimumSize: function () {
412
+ var
413
+ element = module.cache.element
414
+ ;
415
+ $container
416
+ .css('min-height', element.height)
417
+ ;
418
+ },
419
+ scroll: function (scroll) {
420
+ module.debug('Setting scroll on element', scroll);
421
+ if (module.elementScroll == scroll) {
422
+ return;
423
+ }
424
+ if (module.is.top()) {
425
+ $module
426
+ .css('bottom', '')
427
+ .css('top', (-scroll) + 'px')
428
+ ;
429
+ }
430
+ if (module.is.bottom()) {
431
+ $module
432
+ .css('top', '')
433
+ .css('bottom', scroll + 'px')
434
+ ;
435
+ }
436
+ },
437
+ size: function () {
438
+ if (module.cache.element.height !== 0 && module.cache.element.width !== 0) {
439
+ element.style.setProperty('width', module.cache.element.width + 'px', 'important');
440
+ element.style.setProperty('height', module.cache.element.height + 'px', 'important');
441
+ }
442
+ },
443
+ },
444
+
445
+ is: {
446
+ standardScroll: function () {
447
+ return ($scroll[0] == window);
448
+ },
449
+ top: function () {
450
+ return $module.hasClass(className.top);
451
+ },
452
+ bottom: function () {
453
+ return $module.hasClass(className.bottom);
454
+ },
455
+ initialPosition: function () {
456
+ return (!module.is.fixed() && !module.is.bound());
457
+ },
458
+ hidden: function () {
459
+ return (!$module.is(':visible'));
460
+ },
461
+ bound: function () {
462
+ return $module.hasClass(className.bound);
463
+ },
464
+ fixed: function () {
465
+ return $module.hasClass(className.fixed);
466
+ },
467
+ },
468
+
469
+ stick: function (scrollPosition) {
470
+ var
471
+ cachedPosition = scrollPosition || $scroll.scrollTop(),
472
+ cache = module.cache,
473
+ fits = cache.fits,
474
+ sameHeight = cache.sameHeight,
475
+ element = cache.element,
476
+ scrollContext = cache.scrollContext,
477
+ context = cache.context,
478
+ offset = (module.is.bottom() && settings.pushing)
479
+ ? settings.bottomOffset
480
+ : settings.offset,
481
+ scroll = {
482
+ top: cachedPosition + offset,
483
+ bottom: cachedPosition + offset + scrollContext.height,
484
+ },
485
+ elementScroll = (fits)
486
+ ? 0
487
+ : module.get.elementScroll(scroll.top),
488
+
489
+ // shorthand
490
+ doesntFit = !fits,
491
+ elementVisible = (element.height !== 0)
492
+ ;
493
+ if (elementVisible && !sameHeight) {
494
+ if (module.is.initialPosition()) {
495
+ if (scroll.top >= context.bottom) {
496
+ module.debug('Initial element position is bottom of container');
497
+ module.bindBottom();
498
+ } else if (scroll.top > element.top) {
499
+ if ((element.height + scroll.top - elementScroll) >= context.bottom && element.height < context.height) {
500
+ module.debug('Initial element position is bottom of container');
501
+ module.bindBottom();
502
+ } else {
503
+ module.debug('Initial element position is fixed');
504
+ module.fixTop();
505
+ }
506
+ }
507
+ } else if (module.is.fixed()) {
508
+ if (module.is.top()) {
509
+ if (scroll.top <= element.top) {
510
+ module.debug('Fixed element reached top of container');
511
+ module.setInitialPosition();
512
+ } else if ((element.height + scroll.top - elementScroll) >= context.bottom) {
513
+ module.debug('Fixed element reached bottom of container');
514
+ module.bindBottom();
515
+ } else if (doesntFit) { // scroll element if larger than screen
516
+ module.set.scroll(elementScroll);
517
+ module.save.lastScroll(scroll.top);
518
+ module.save.elementScroll(elementScroll);
519
+ }
520
+ } else if (module.is.bottom()) {
521
+ if ((scroll.bottom - element.height) <= element.top) { // top edge
522
+ module.debug('Bottom fixed rail has reached top of container');
523
+ module.setInitialPosition();
524
+ } else if (scroll.bottom >= context.bottom) { // bottom edge
525
+ module.debug('Bottom fixed rail has reached bottom of container');
526
+ module.bindBottom();
527
+ } else if (doesntFit) { // scroll element if larger than screen
528
+ module.set.scroll(elementScroll);
529
+ module.save.lastScroll(scroll.top);
530
+ module.save.elementScroll(elementScroll);
531
+ }
532
+ }
533
+ } else if (module.is.bottom()) {
534
+ if (scroll.top <= element.top) {
535
+ module.debug('Jumped from bottom fixed to top fixed, most likely used home/end button');
536
+ module.setInitialPosition();
537
+ } else {
538
+ if (settings.pushing) {
539
+ if (module.is.bound() && scroll.bottom <= context.bottom) {
540
+ module.debug('Fixing bottom attached element to bottom of browser.');
541
+ module.fixBottom();
542
+ }
543
+ } else {
544
+ if (module.is.bound() && (scroll.top <= context.bottom - element.height)) {
545
+ module.debug('Fixing bottom attached element to top of browser.');
546
+ module.fixTop();
547
+ }
548
+ }
549
+ }
550
+ }
551
+ }
552
+ },
553
+
554
+ bindTop: function () {
555
+ module.debug('Binding element to top of parent container');
556
+ module.remove.offset();
557
+ if (settings.setSize) {
558
+ module.set.size();
559
+ }
560
+ $module
561
+ .css({
562
+ left: '',
563
+ top: '',
564
+ marginBottom: '',
565
+ })
566
+ .removeClass(className.fixed)
567
+ .removeClass(className.bottom)
568
+ .addClass(className.bound)
569
+ .addClass(className.top)
570
+ ;
571
+ settings.onTop.call(element);
572
+ settings.onUnstick.call(element);
573
+ },
574
+ bindBottom: function () {
575
+ module.debug('Binding element to bottom of parent container');
576
+ module.remove.offset();
577
+ if (settings.setSize) {
578
+ module.set.size();
579
+ }
580
+ $module
581
+ .css({
582
+ left: '',
583
+ top: '',
584
+ })
585
+ .removeClass(className.fixed)
586
+ .removeClass(className.top)
587
+ .addClass(className.bound)
588
+ .addClass(className.bottom)
589
+ ;
590
+ settings.onBottom.call(element);
591
+ settings.onUnstick.call(element);
592
+ },
593
+
594
+ setInitialPosition: function () {
595
+ module.debug('Returning to initial position');
596
+ module.unfix();
597
+ module.unbind();
598
+ },
599
+
600
+ fixTop: function () {
601
+ module.debug('Fixing element to top of page');
602
+ if (settings.setSize) {
603
+ module.set.size();
604
+ }
605
+ module.set.minimumSize();
606
+ module.set.offset();
607
+ $module
608
+ .css({
609
+ left: module.cache.element.left,
610
+ bottom: '',
611
+ marginBottom: '',
612
+ })
613
+ .removeClass(className.bound)
614
+ .removeClass(className.bottom)
615
+ .addClass(className.fixed)
616
+ .addClass(className.top)
617
+ ;
618
+ settings.onStick.call(element);
619
+ },
620
+
621
+ fixBottom: function () {
622
+ module.debug('Sticking element to bottom of page');
623
+ if (settings.setSize) {
624
+ module.set.size();
625
+ }
626
+ module.set.minimumSize();
627
+ module.set.offset();
628
+ $module
629
+ .css({
630
+ left: module.cache.element.left,
631
+ bottom: '',
632
+ marginBottom: '',
633
+ })
634
+ .removeClass(className.bound)
635
+ .removeClass(className.top)
636
+ .addClass(className.fixed)
637
+ .addClass(className.bottom)
638
+ ;
639
+ settings.onStick.call(element);
640
+ },
641
+
642
+ unbind: function () {
643
+ if (module.is.bound()) {
644
+ module.debug('Removing container bound position on element');
645
+ module.remove.offset();
646
+ $module
647
+ .removeClass(className.bound)
648
+ .removeClass(className.top)
649
+ .removeClass(className.bottom)
650
+ ;
651
+ }
652
+ },
653
+
654
+ unfix: function () {
655
+ if (module.is.fixed()) {
656
+ module.debug('Removing fixed position on element');
657
+ module.remove.minimumSize();
658
+ module.remove.offset();
659
+ $module
660
+ .removeClass(className.fixed)
661
+ .removeClass(className.top)
662
+ .removeClass(className.bottom)
663
+ ;
664
+ settings.onUnstick.call(element);
665
+ }
666
+ },
667
+
668
+ reset: function () {
669
+ module.debug('Resetting elements position');
670
+ module.unbind();
671
+ module.unfix();
672
+ module.resetCSS();
673
+ module.remove.offset();
674
+ module.remove.lastScroll();
675
+ },
676
+
677
+ resetCSS: function () {
678
+ $module
679
+ .css({
680
+ width: '',
681
+ height: '',
682
+ })
683
+ ;
684
+ $container
685
+ .css({
686
+ height: '',
687
+ })
688
+ ;
689
+ },
690
+
691
+ setting: function (name, value) {
692
+ if ($.isPlainObject(name)) {
693
+ $.extend(true, settings, name);
694
+ } else if (value !== undefined) {
695
+ settings[name] = value;
696
+ } else {
697
+ return settings[name];
698
+ }
699
+ },
700
+ internal: function (name, value) {
701
+ if ($.isPlainObject(name)) {
702
+ $.extend(true, module, name);
703
+ } else if (value !== undefined) {
704
+ module[name] = value;
705
+ } else {
706
+ return module[name];
707
+ }
708
+ },
709
+ debug: function () {
710
+ if (!settings.silent && settings.debug) {
711
+ if (settings.performance) {
712
+ module.performance.log(arguments);
713
+ } else {
714
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
715
+ module.debug.apply(console, arguments);
716
+ }
717
+ }
718
+ },
719
+ verbose: function () {
720
+ if (!settings.silent && settings.verbose && settings.debug) {
721
+ if (settings.performance) {
722
+ module.performance.log(arguments);
723
+ } else {
724
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
725
+ module.verbose.apply(console, arguments);
726
+ }
727
+ }
728
+ },
729
+ error: function () {
730
+ if (!settings.silent) {
731
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
732
+ module.error.apply(console, arguments);
733
+ }
734
+ },
735
+ performance: {
736
+ log: function (message) {
737
+ var
738
+ currentTime,
739
+ executionTime,
740
+ previousTime
741
+ ;
742
+ if (settings.performance) {
743
+ currentTime = new Date().getTime();
744
+ previousTime = time || currentTime;
745
+ executionTime = currentTime - previousTime;
746
+ time = currentTime;
747
+ performance.push({
748
+ Name: message[0],
749
+ Arguments: [].slice.call(message, 1) || '',
750
+ Element: element,
751
+ 'Execution Time': executionTime,
752
+ });
753
+ }
754
+ clearTimeout(module.performance.timer);
755
+ module.performance.timer = setTimeout(module.performance.display, 0);
756
+ },
757
+ display: function () {
758
+ var
759
+ title = settings.name + ':',
760
+ totalTime = 0
761
+ ;
762
+ time = false;
763
+ clearTimeout(module.performance.timer);
764
+ $.each(performance, function (index, data) {
765
+ totalTime += data['Execution Time'];
766
+ });
767
+ title += ' ' + totalTime + 'ms';
768
+ if (moduleSelector) {
769
+ title += ' \'' + moduleSelector + '\'';
770
+ }
771
+ if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
772
+ console.groupCollapsed(title);
773
+ if (console.table) {
774
+ console.table(performance);
775
+ } else {
776
+ $.each(performance, function (index, data) {
777
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
778
+ });
779
+ }
780
+ console.groupEnd();
781
+ }
782
+ performance = [];
783
+ },
784
+ },
785
+ invoke: function (query, passedArguments, context) {
786
+ var
787
+ object = instance,
788
+ maxDepth,
789
+ found,
790
+ response
791
+ ;
792
+ passedArguments = passedArguments || queryArguments;
793
+ context = context || element;
794
+ if (typeof query == 'string' && object !== undefined) {
795
+ query = query.split(/[\. ]/);
796
+ maxDepth = query.length - 1;
797
+ $.each(query, function (depth, value) {
798
+ var camelCaseValue = (depth != maxDepth)
799
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
800
+ : query
801
+ ;
802
+ if ($.isPlainObject(object[camelCaseValue]) && (depth != maxDepth)) {
803
+ object = object[camelCaseValue];
804
+ } else if (object[camelCaseValue] !== undefined) {
805
+ found = object[camelCaseValue];
806
+
807
+ return false;
808
+ } else if ($.isPlainObject(object[value]) && (depth != maxDepth)) {
809
+ object = object[value];
810
+ } else if (object[value] !== undefined) {
811
+ found = object[value];
812
+
813
+ return false;
814
+ } else {
815
+ return false;
816
+ }
817
+ });
818
+ }
819
+ if (isFunction(found)) {
820
+ response = found.apply(context, passedArguments);
821
+ } else if (found !== undefined) {
822
+ response = found;
823
+ }
824
+ if (Array.isArray(returnedValue)) {
825
+ returnedValue.push(response);
826
+ } else if (returnedValue !== undefined) {
827
+ returnedValue = [returnedValue, response];
828
+ } else if (response !== undefined) {
829
+ returnedValue = response;
830
+ }
831
+
832
+ return found;
833
+ },
834
+ };
835
+
836
+ if (methodInvoked) {
837
+ if (instance === undefined) {
838
+ module.initialize();
571
839
  }
572
- else {
573
- if(module.is.bound() && (scroll.top <= context.bottom - element.height) ) {
574
- module.debug('Fixing bottom attached element to top of browser.');
575
- module.fixTop();
576
- }
840
+ module.invoke(query);
841
+ } else {
842
+ if (instance !== undefined) {
843
+ instance.invoke('destroy');
577
844
  }
578
- }
845
+ module.initialize();
579
846
  }
580
- }
581
- },
847
+ });
582
848
 
583
- bindTop: function() {
584
- module.debug('Binding element to top of parent container');
585
- module.remove.offset();
586
- if(settings.setSize) {
587
- module.set.size();
588
- }
589
- $module
590
- .css({
591
- left : '',
592
- top : '',
593
- marginBottom : ''
594
- })
595
- .removeClass(className.fixed)
596
- .removeClass(className.bottom)
597
- .addClass(className.bound)
598
- .addClass(className.top)
599
- ;
600
- settings.onTop.call(element);
601
- settings.onUnstick.call(element);
602
- },
603
- bindBottom: function() {
604
- module.debug('Binding element to bottom of parent container');
605
- module.remove.offset();
606
- if(settings.setSize) {
607
- module.set.size();
608
- }
609
- $module
610
- .css({
611
- left : '',
612
- top : ''
613
- })
614
- .removeClass(className.fixed)
615
- .removeClass(className.top)
616
- .addClass(className.bound)
617
- .addClass(className.bottom)
618
- ;
619
- settings.onBottom.call(element);
620
- settings.onUnstick.call(element);
621
- },
849
+ return (returnedValue !== undefined)
850
+ ? returnedValue
851
+ : this;
852
+ };
622
853
 
623
- setInitialPosition: function() {
624
- module.debug('Returning to initial position');
625
- module.unfix();
626
- module.unbind();
627
- },
854
+ $.fn.sticky.settings = {
628
855
 
856
+ name: 'Sticky',
857
+ namespace: 'sticky',
629
858
 
630
- fixTop: function() {
631
- module.debug('Fixing element to top of page');
632
- if(settings.setSize) {
633
- module.set.size();
634
- }
635
- module.set.minimumSize();
636
- module.set.offset();
637
- $module
638
- .css({
639
- left : module.cache.element.left,
640
- bottom : '',
641
- marginBottom : ''
642
- })
643
- .removeClass(className.bound)
644
- .removeClass(className.bottom)
645
- .addClass(className.fixed)
646
- .addClass(className.top)
647
- ;
648
- settings.onStick.call(element);
649
- },
859
+ silent: false,
860
+ debug: false,
861
+ verbose: true,
862
+ performance: true,
650
863
 
651
- fixBottom: function() {
652
- module.debug('Sticking element to bottom of page');
653
- if(settings.setSize) {
654
- module.set.size();
655
- }
656
- module.set.minimumSize();
657
- module.set.offset();
658
- $module
659
- .css({
660
- left : module.cache.element.left,
661
- bottom : '',
662
- marginBottom : ''
663
- })
664
- .removeClass(className.bound)
665
- .removeClass(className.top)
666
- .addClass(className.fixed)
667
- .addClass(className.bottom)
668
- ;
669
- settings.onStick.call(element);
670
- },
864
+ // whether to stick in the opposite direction on scroll up
865
+ pushing: false,
671
866
 
672
- unbind: function() {
673
- if( module.is.bound() ) {
674
- module.debug('Removing container bound position on element');
675
- module.remove.offset();
676
- $module
677
- .removeClass(className.bound)
678
- .removeClass(className.top)
679
- .removeClass(className.bottom)
680
- ;
681
- }
682
- },
867
+ context: false,
868
+ container: false,
683
869
 
684
- unfix: function() {
685
- if( module.is.fixed() ) {
686
- module.debug('Removing fixed position on element');
687
- module.remove.minimumSize();
688
- module.remove.offset();
689
- $module
690
- .removeClass(className.fixed)
691
- .removeClass(className.top)
692
- .removeClass(className.bottom)
693
- ;
694
- settings.onUnstick.call(element);
695
- }
696
- },
870
+ // Context to watch scroll events
871
+ scrollContext: window,
697
872
 
698
- reset: function() {
699
- module.debug('Resetting elements position');
700
- module.unbind();
701
- module.unfix();
702
- module.resetCSS();
703
- module.remove.offset();
704
- module.remove.lastScroll();
705
- },
873
+ // Offset to adjust scroll
874
+ offset: 0,
706
875
 
707
- resetCSS: function() {
708
- $module
709
- .css({
710
- width : '',
711
- height : ''
712
- })
713
- ;
714
- $container
715
- .css({
716
- height: ''
717
- })
718
- ;
719
- },
876
+ // Offset to adjust scroll when attached to bottom of screen
877
+ bottomOffset: 0,
720
878
 
721
- setting: function(name, value) {
722
- if( $.isPlainObject(name) ) {
723
- $.extend(true, settings, name);
724
- }
725
- else if(value !== undefined) {
726
- settings[name] = value;
727
- }
728
- else {
729
- return settings[name];
730
- }
731
- },
732
- internal: function(name, value) {
733
- if( $.isPlainObject(name) ) {
734
- $.extend(true, module, name);
735
- }
736
- else if(value !== undefined) {
737
- module[name] = value;
738
- }
739
- else {
740
- return module[name];
741
- }
742
- },
743
- debug: function() {
744
- if(!settings.silent && settings.debug) {
745
- if(settings.performance) {
746
- module.performance.log(arguments);
747
- }
748
- else {
749
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
750
- module.debug.apply(console, arguments);
751
- }
752
- }
753
- },
754
- verbose: function() {
755
- if(!settings.silent && settings.verbose && settings.debug) {
756
- if(settings.performance) {
757
- module.performance.log(arguments);
758
- }
759
- else {
760
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
761
- module.verbose.apply(console, arguments);
762
- }
763
- }
764
- },
765
- error: function() {
766
- if(!settings.silent) {
767
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
768
- module.error.apply(console, arguments);
769
- }
879
+ // will only set container height if difference between context and container is larger than this number
880
+ jitter: 5,
881
+
882
+ // set width of sticky element when it is fixed to page (used to make sure 100% width is maintained if no fixed size set)
883
+ setSize: true,
884
+
885
+ // Whether to automatically observe changes with Mutation Observers
886
+ observeChanges: false,
887
+
888
+ // Called when position is recalculated
889
+ onReposition: function () {},
890
+
891
+ // Called on each scroll
892
+ onScroll: function () {},
893
+
894
+ // Called when element is stuck to viewport
895
+ onStick: function () {},
896
+
897
+ // Called when element is unstuck from viewport
898
+ onUnstick: function () {},
899
+
900
+ // Called when element reaches top of context
901
+ onTop: function () {},
902
+
903
+ // Called when element reaches bottom of context
904
+ onBottom: function () {},
905
+
906
+ error: {
907
+ container: 'Sticky element must be inside a relative container',
908
+ visible: 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to suppress this warning in production.',
909
+ method: 'The method you called is not defined.',
910
+ invalidContext: 'Context specified does not exist',
911
+ elementSize: 'Sticky element is larger than its container, cannot create sticky.',
770
912
  },
771
- performance: {
772
- log: function(message) {
773
- var
774
- currentTime,
775
- executionTime,
776
- previousTime
777
- ;
778
- if(settings.performance) {
779
- currentTime = new Date().getTime();
780
- previousTime = time || currentTime;
781
- executionTime = currentTime - previousTime;
782
- time = currentTime;
783
- performance.push({
784
- 'Name' : message[0],
785
- 'Arguments' : [].slice.call(message, 1) || '',
786
- 'Element' : element,
787
- 'Execution Time' : executionTime
788
- });
789
- }
790
- clearTimeout(module.performance.timer);
791
- module.performance.timer = setTimeout(module.performance.display, 0);
792
- },
793
- display: function() {
794
- var
795
- title = settings.name + ':',
796
- totalTime = 0
797
- ;
798
- time = false;
799
- clearTimeout(module.performance.timer);
800
- $.each(performance, function(index, data) {
801
- totalTime += data['Execution Time'];
802
- });
803
- title += ' ' + totalTime + 'ms';
804
- if(moduleSelector) {
805
- title += ' \'' + moduleSelector + '\'';
806
- }
807
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
808
- console.groupCollapsed(title);
809
- if(console.table) {
810
- console.table(performance);
811
- }
812
- else {
813
- $.each(performance, function(index, data) {
814
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
815
- });
816
- }
817
- console.groupEnd();
818
- }
819
- performance = [];
820
- }
913
+
914
+ className: {
915
+ bound: 'bound',
916
+ fixed: 'fixed',
917
+ supported: 'native',
918
+ top: 'top',
919
+ bottom: 'bottom',
821
920
  },
822
- invoke: function(query, passedArguments, context) {
823
- var
824
- object = instance,
825
- maxDepth,
826
- found,
827
- response
828
- ;
829
- passedArguments = passedArguments || queryArguments;
830
- context = context || element;
831
- if(typeof query == 'string' && object !== undefined) {
832
- query = query.split(/[\. ]/);
833
- maxDepth = query.length - 1;
834
- $.each(query, function(depth, value) {
835
- var camelCaseValue = (depth != maxDepth)
836
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
837
- : query
838
- ;
839
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
840
- object = object[camelCaseValue];
841
- }
842
- else if( object[camelCaseValue] !== undefined ) {
843
- found = object[camelCaseValue];
844
- return false;
845
- }
846
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
847
- object = object[value];
848
- }
849
- else if( object[value] !== undefined ) {
850
- found = object[value];
851
- return false;
852
- }
853
- else {
854
- return false;
855
- }
856
- });
857
- }
858
- if ( $.isFunction( found ) ) {
859
- response = found.apply(context, passedArguments);
860
- }
861
- else if(found !== undefined) {
862
- response = found;
863
- }
864
- if(Array.isArray(returnedValue)) {
865
- returnedValue.push(response);
866
- }
867
- else if(returnedValue !== undefined) {
868
- returnedValue = [returnedValue, response];
869
- }
870
- else if(response !== undefined) {
871
- returnedValue = response;
872
- }
873
- return found;
874
- }
875
- };
876
-
877
- if(methodInvoked) {
878
- if(instance === undefined) {
879
- module.initialize();
880
- }
881
- module.invoke(query);
882
- }
883
- else {
884
- if(instance !== undefined) {
885
- instance.invoke('destroy');
886
- }
887
- module.initialize();
888
- }
889
- })
890
- ;
891
-
892
- return (returnedValue !== undefined)
893
- ? returnedValue
894
- : this
895
- ;
896
- };
897
-
898
- $.fn.sticky.settings = {
899
-
900
- name : 'Sticky',
901
- namespace : 'sticky',
902
-
903
- silent : false,
904
- debug : false,
905
- verbose : true,
906
- performance : true,
907
-
908
- // whether to stick in the opposite direction on scroll up
909
- pushing : false,
910
-
911
- context : false,
912
- container : false,
913
-
914
- // Context to watch scroll events
915
- scrollContext : window,
916
-
917
- // Offset to adjust scroll
918
- offset : 0,
919
-
920
- // Offset to adjust scroll when attached to bottom of screen
921
- bottomOffset : 0,
922
-
923
- // will only set container height if difference between context and container is larger than this number
924
- jitter : 5,
925
-
926
- // set width of sticky element when it is fixed to page (used to make sure 100% width is maintained if no fixed size set)
927
- setSize : true,
928
-
929
- // Whether to automatically observe changes with Mutation Observers
930
- observeChanges : false,
931
-
932
- // Called when position is recalculated
933
- onReposition : function(){},
934
-
935
- // Called on each scroll
936
- onScroll : function(){},
937
-
938
- // Called when element is stuck to viewport
939
- onStick : function(){},
940
-
941
- // Called when element is unstuck from viewport
942
- onUnstick : function(){},
943
-
944
- // Called when element reaches top of context
945
- onTop : function(){},
946
-
947
- // Called when element reaches bottom of context
948
- onBottom : function(){},
949
-
950
- error : {
951
- container : 'Sticky element must be inside a relative container',
952
- visible : 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to suppress this warning in production.',
953
- method : 'The method you called is not defined.',
954
- invalidContext : 'Context specified does not exist',
955
- elementSize : 'Sticky element is larger than its container, cannot create sticky.'
956
- },
957
-
958
- className : {
959
- bound : 'bound',
960
- fixed : 'fixed',
961
- supported : 'native',
962
- top : 'top',
963
- bottom : 'bottom'
964
- }
965
-
966
- };
967
-
968
- })( jQuery, window, document );
921
+
922
+ };
923
+ })(jQuery, window, document);