fomantic-ui 2.9.1-beta.3 → 2.9.1-beta.30

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 (540) hide show
  1. package/.eslint/eqeqeq-rule.js +18 -0
  2. package/.eslint/index.js +26 -0
  3. package/.eslint/no-extra-parens-rule.js +17 -0
  4. package/.eslint/package.json +11 -0
  5. package/.eslintrc.js +124 -0
  6. package/.github/workflows/ci.yml +37 -4
  7. package/.github/workflows/nightly.yml +1 -1
  8. package/.github/workflows/release.yml +1 -1
  9. package/.prettierrc.js +12 -0
  10. package/.stylelintrc.js +48 -0
  11. package/README.md +1 -1
  12. package/dist/components/accordion.css +35 -53
  13. package/dist/components/accordion.js +568 -595
  14. package/dist/components/accordion.min.css +2 -2
  15. package/dist/components/accordion.min.js +2 -2
  16. package/dist/components/ad.css +34 -45
  17. package/dist/components/ad.min.css +2 -2
  18. package/dist/components/api.js +1157 -1179
  19. package/dist/components/api.min.js +2 -2
  20. package/dist/components/breadcrumb.css +5 -5
  21. package/dist/components/breadcrumb.min.css +2 -2
  22. package/dist/components/button.css +709 -1121
  23. package/dist/components/button.min.css +2 -2
  24. package/dist/components/calendar.css +24 -27
  25. package/dist/components/calendar.js +1934 -1809
  26. package/dist/components/calendar.min.css +2 -2
  27. package/dist/components/calendar.min.js +2 -2
  28. package/dist/components/card.css +219 -365
  29. package/dist/components/card.min.css +2 -2
  30. package/dist/components/checkbox.css +119 -187
  31. package/dist/components/checkbox.js +842 -841
  32. package/dist/components/checkbox.min.css +2 -2
  33. package/dist/components/checkbox.min.js +2 -2
  34. package/dist/components/comment.css +41 -59
  35. package/dist/components/comment.min.css +2 -2
  36. package/dist/components/container.css +7 -6
  37. package/dist/components/container.min.css +2 -2
  38. package/dist/components/dimmer.css +53 -172
  39. package/dist/components/dimmer.js +706 -737
  40. package/dist/components/dimmer.min.css +2 -2
  41. package/dist/components/dimmer.min.js +2 -2
  42. package/dist/components/divider.css +43 -61
  43. package/dist/components/divider.min.css +2 -2
  44. package/dist/components/dropdown.css +252 -386
  45. package/dist/components/dropdown.js +4179 -4236
  46. package/dist/components/dropdown.min.css +2 -2
  47. package/dist/components/dropdown.min.js +2 -2
  48. package/dist/components/embed.css +18 -29
  49. package/dist/components/embed.js +645 -675
  50. package/dist/components/embed.min.css +2 -2
  51. package/dist/components/embed.min.js +2 -2
  52. package/dist/components/emoji.css +9 -9
  53. package/dist/components/emoji.min.css +1 -1
  54. package/dist/components/feed.css +35 -57
  55. package/dist/components/feed.min.css +2 -2
  56. package/dist/components/flag.css +6 -4
  57. package/dist/components/flag.min.css +2 -2
  58. package/dist/components/flyout.css +86 -141
  59. package/dist/components/flyout.js +1457 -1465
  60. package/dist/components/flyout.min.css +2 -2
  61. package/dist/components/flyout.min.js +2 -2
  62. package/dist/components/form.css +244 -339
  63. package/dist/components/form.js +2020 -2004
  64. package/dist/components/form.min.css +2 -2
  65. package/dist/components/form.min.js +2 -2
  66. package/dist/components/grid.css +172 -319
  67. package/dist/components/grid.min.css +2 -2
  68. package/dist/components/header.css +118 -142
  69. package/dist/components/header.min.css +2 -2
  70. package/dist/components/icon.css +660 -718
  71. package/dist/components/icon.min.css +2 -2
  72. package/dist/components/image.css +39 -63
  73. package/dist/components/image.min.css +2 -2
  74. package/dist/components/input.css +356 -274
  75. package/dist/components/input.min.css +2 -2
  76. package/dist/components/item.css +84 -131
  77. package/dist/components/item.min.css +2 -2
  78. package/dist/components/label.css +359 -410
  79. package/dist/components/label.min.css +2 -2
  80. package/dist/components/list.css +49 -70
  81. package/dist/components/list.min.css +2 -2
  82. package/dist/components/loader.css +67 -155
  83. package/dist/components/loader.min.css +2 -2
  84. package/dist/components/menu.css +269 -431
  85. package/dist/components/menu.min.css +1 -1
  86. package/dist/components/message.css +125 -197
  87. package/dist/components/message.min.css +2 -2
  88. package/dist/components/modal.css +119 -154
  89. package/dist/components/modal.js +1488 -1486
  90. package/dist/components/modal.min.css +2 -2
  91. package/dist/components/modal.min.js +2 -2
  92. package/dist/components/nag.css +53 -63
  93. package/dist/components/nag.js +520 -526
  94. package/dist/components/nag.min.css +2 -2
  95. package/dist/components/nag.min.js +2 -2
  96. package/dist/components/placeholder.css +22 -42
  97. package/dist/components/placeholder.min.css +2 -2
  98. package/dist/components/popup.css +423 -201
  99. package/dist/components/popup.js +1454 -1456
  100. package/dist/components/popup.min.css +2 -2
  101. package/dist/components/popup.min.js +2 -2
  102. package/dist/components/progress.css +106 -211
  103. package/dist/components/progress.js +969 -997
  104. package/dist/components/progress.min.css +2 -2
  105. package/dist/components/progress.min.js +2 -2
  106. package/dist/components/rail.css +15 -20
  107. package/dist/components/rail.min.css +1 -1
  108. package/dist/components/rating.css +80 -121
  109. package/dist/components/rating.js +505 -523
  110. package/dist/components/rating.min.css +2 -2
  111. package/dist/components/rating.min.js +2 -2
  112. package/dist/components/reset.css +8 -13
  113. package/dist/components/reset.min.css +2 -2
  114. package/dist/components/reveal.css +44 -83
  115. package/dist/components/reveal.min.css +2 -2
  116. package/dist/components/search.css +69 -98
  117. package/dist/components/search.js +1493 -1534
  118. package/dist/components/search.min.css +2 -2
  119. package/dist/components/search.min.js +2 -2
  120. package/dist/components/segment.css +148 -224
  121. package/dist/components/segment.min.css +2 -2
  122. package/dist/components/shape.css +14 -30
  123. package/dist/components/shape.js +781 -810
  124. package/dist/components/shape.min.css +2 -2
  125. package/dist/components/shape.min.js +2 -2
  126. package/dist/components/sidebar.css +103 -206
  127. package/dist/components/sidebar.js +1061 -1099
  128. package/dist/components/sidebar.min.css +2 -2
  129. package/dist/components/sidebar.min.js +2 -2
  130. package/dist/components/site.css +28 -41
  131. package/dist/components/site.js +436 -476
  132. package/dist/components/site.min.css +2 -2
  133. package/dist/components/site.min.js +2 -2
  134. package/dist/components/slider.css +93 -121
  135. package/dist/components/slider.js +1310 -1311
  136. package/dist/components/slider.min.css +1 -1
  137. package/dist/components/slider.min.js +2 -2
  138. package/dist/components/state.js +639 -657
  139. package/dist/components/state.min.js +2 -2
  140. package/dist/components/statistic.css +75 -116
  141. package/dist/components/statistic.min.css +2 -2
  142. package/dist/components/step.css +77 -150
  143. package/dist/components/step.min.css +2 -2
  144. package/dist/components/sticky.css +1 -5
  145. package/dist/components/sticky.js +848 -901
  146. package/dist/components/sticky.min.css +2 -2
  147. package/dist/components/sticky.min.js +2 -2
  148. package/dist/components/tab.css +10 -14
  149. package/dist/components/tab.js +922 -965
  150. package/dist/components/tab.min.css +2 -2
  151. package/dist/components/tab.min.js +2 -2
  152. package/dist/components/table.css +547 -774
  153. package/dist/components/table.min.css +2 -2
  154. package/dist/components/text.css +32 -32
  155. package/dist/components/text.min.css +1 -1
  156. package/dist/components/toast.css +69 -147
  157. package/dist/components/toast.js +910 -884
  158. package/dist/components/toast.min.css +2 -2
  159. package/dist/components/toast.min.js +2 -2
  160. package/dist/components/transition.css +369 -1280
  161. package/dist/components/transition.js +1047 -1077
  162. package/dist/components/transition.min.css +2 -2
  163. package/dist/components/transition.min.js +2 -2
  164. package/dist/components/visibility.js +1213 -1245
  165. package/dist/components/visibility.min.js +2 -2
  166. package/dist/semantic.css +5637 -8398
  167. package/dist/semantic.js +29021 -29405
  168. package/dist/semantic.min.css +2 -2
  169. package/dist/semantic.min.js +2 -2
  170. package/dist/themes/basic/assets/fonts/icons.woff2 +0 -0
  171. package/dist/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  172. package/dist/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  173. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  174. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  175. package/dist/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  176. package/dist/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  177. package/dist/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  178. package/dist/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  179. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  180. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  181. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  182. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  183. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  184. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  185. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  186. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  187. package/dist/themes/github/assets/fonts/octicons.woff2 +0 -0
  188. package/examples/.eslintrc.js +6 -0
  189. package/examples/assets/show-examples.js +13 -13
  190. package/examples/components/sticky-context.html +1 -1
  191. package/examples/fixed.html +2 -2
  192. package/examples/grid.html +4 -4
  193. package/examples/login.html +1 -1
  194. package/examples/responsive.html +1 -1
  195. package/examples/sticky.html +3 -3
  196. package/gulpfile.js +10 -11
  197. package/package.json +18 -11
  198. package/scripts/nightly-version.js +83 -75
  199. package/src/_site/collections/menu.overrides +1 -1
  200. package/src/_site/elements/flag.variables +2 -2
  201. package/src/_site/globals/site.variables +1 -1
  202. package/src/_site/modules/embed.variables +3 -0
  203. package/src/definitions/behaviors/api.js +1158 -1180
  204. package/src/definitions/behaviors/form.js +2019 -2003
  205. package/src/definitions/behaviors/state.js +645 -663
  206. package/src/definitions/behaviors/visibility.js +1212 -1244
  207. package/src/definitions/collections/breadcrumb.less +43 -47
  208. package/src/definitions/collections/form.less +866 -884
  209. package/src/definitions/collections/grid.less +1680 -1699
  210. package/src/definitions/collections/menu.less +1521 -1544
  211. package/src/definitions/collections/message.less +294 -298
  212. package/src/definitions/collections/table.less +1657 -1661
  213. package/src/definitions/elements/button.less +1714 -1756
  214. package/src/definitions/elements/container.less +211 -211
  215. package/src/definitions/elements/divider.less +198 -211
  216. package/src/definitions/elements/emoji.less +41 -48
  217. package/src/definitions/elements/flag.less +46 -48
  218. package/src/definitions/elements/header.less +351 -359
  219. package/src/definitions/elements/icon.less +541 -484
  220. package/src/definitions/elements/image.less +216 -227
  221. package/src/definitions/elements/input.less +692 -698
  222. package/src/definitions/elements/label.less +784 -806
  223. package/src/definitions/elements/list.less +810 -814
  224. package/src/definitions/elements/loader.less +273 -268
  225. package/src/definitions/elements/placeholder.less +173 -170
  226. package/src/definitions/elements/rail.less +93 -93
  227. package/src/definitions/elements/reveal.less +192 -198
  228. package/src/definitions/elements/segment.less +742 -749
  229. package/src/definitions/elements/step.less +423 -437
  230. package/src/definitions/elements/text.less +34 -36
  231. package/src/definitions/globals/reset.less +11 -8
  232. package/src/definitions/globals/site.js +435 -475
  233. package/src/definitions/globals/site.less +108 -110
  234. package/src/definitions/modules/accordion.js +567 -594
  235. package/src/definitions/modules/accordion.less +244 -248
  236. package/src/definitions/modules/calendar.js +1933 -1808
  237. package/src/definitions/modules/calendar.less +100 -97
  238. package/src/definitions/modules/checkbox.js +841 -840
  239. package/src/definitions/modules/checkbox.less +531 -552
  240. package/src/definitions/modules/dimmer.js +705 -736
  241. package/src/definitions/modules/dimmer.less +294 -305
  242. package/src/definitions/modules/dropdown.js +4178 -4235
  243. package/src/definitions/modules/dropdown.less +1568 -1598
  244. package/src/definitions/modules/embed.js +644 -674
  245. package/src/definitions/modules/embed.less +82 -84
  246. package/src/definitions/modules/flyout.js +1456 -1464
  247. package/src/definitions/modules/flyout.less +445 -456
  248. package/src/definitions/modules/modal.js +1487 -1485
  249. package/src/definitions/modules/modal.less +458 -467
  250. package/src/definitions/modules/nag.js +519 -525
  251. package/src/definitions/modules/nag.less +136 -149
  252. package/src/definitions/modules/popup.js +1453 -1455
  253. package/src/definitions/modules/popup.less +737 -692
  254. package/src/definitions/modules/progress.js +968 -996
  255. package/src/definitions/modules/progress.less +523 -499
  256. package/src/definitions/modules/rating.js +504 -522
  257. package/src/definitions/modules/rating.less +98 -103
  258. package/src/definitions/modules/search.js +1492 -1533
  259. package/src/definitions/modules/search.less +374 -394
  260. package/src/definitions/modules/shape.js +780 -809
  261. package/src/definitions/modules/shape.less +70 -79
  262. package/src/definitions/modules/sidebar.js +1060 -1098
  263. package/src/definitions/modules/sidebar.less +463 -476
  264. package/src/definitions/modules/slider.js +1309 -1310
  265. package/src/definitions/modules/slider.less +309 -310
  266. package/src/definitions/modules/sticky.js +864 -917
  267. package/src/definitions/modules/sticky.less +17 -25
  268. package/src/definitions/modules/tab.js +921 -964
  269. package/src/definitions/modules/tab.less +48 -54
  270. package/src/definitions/modules/toast.js +909 -883
  271. package/src/definitions/modules/toast.less +589 -589
  272. package/src/definitions/modules/transition.js +1046 -1076
  273. package/src/definitions/modules/transition.less +65 -31
  274. package/src/definitions/views/ad.less +207 -208
  275. package/src/definitions/views/card.less +955 -973
  276. package/src/definitions/views/comment.less +192 -200
  277. package/src/definitions/views/feed.less +222 -226
  278. package/src/definitions/views/item.less +437 -448
  279. package/src/definitions/views/statistic.less +273 -279
  280. package/src/semantic.less +8 -6
  281. package/src/theme.config.example +53 -53
  282. package/src/theme.less +30 -33
  283. package/src/themes/amazon/elements/button.overrides +23 -24
  284. package/src/themes/amazon/elements/button.variables +18 -23
  285. package/src/themes/amazon/globals/site.variables +16 -17
  286. package/src/themes/basic/assets/fonts/icons.woff2 +0 -0
  287. package/src/themes/basic/collections/table.overrides +0 -1
  288. package/src/themes/basic/collections/table.variables +3 -3
  289. package/src/themes/basic/elements/button.overrides +0 -1
  290. package/src/themes/basic/elements/button.variables +9 -9
  291. package/src/themes/basic/elements/icon.overrides +9 -169
  292. package/src/themes/basic/elements/icon.variables +161 -18
  293. package/src/themes/basic/elements/step.overrides +2 -2
  294. package/src/themes/basic/elements/step.variables +2 -2
  295. package/src/themes/basic/globals/reset.overrides +1 -1
  296. package/src/themes/basic/globals/reset.variables +1 -1
  297. package/src/themes/basic/modules/progress.variables +2 -2
  298. package/src/themes/basic/views/card.overrides +0 -1
  299. package/src/themes/basic/views/card.variables +6 -6
  300. package/src/themes/bookish/elements/header.overrides +4 -4
  301. package/src/themes/bookish/elements/header.variables +5 -5
  302. package/src/themes/bootstrap3/elements/button.overrides +3 -0
  303. package/src/themes/bootstrap3/elements/button.variables +20 -25
  304. package/src/themes/chubby/collections/form.overrides +9 -9
  305. package/src/themes/chubby/collections/form.variables +3 -3
  306. package/src/themes/chubby/collections/menu.overrides +3 -0
  307. package/src/themes/chubby/collections/menu.variables +3 -3
  308. package/src/themes/chubby/elements/button.overrides +8 -10
  309. package/src/themes/chubby/elements/button.variables +10 -10
  310. package/src/themes/chubby/elements/header.overrides +1 -1
  311. package/src/themes/chubby/elements/header.variables +4 -4
  312. package/src/themes/chubby/modules/accordion.overrides +2 -2
  313. package/src/themes/chubby/modules/accordion.variables +4 -4
  314. package/src/themes/chubby/views/comment.overrides +5 -5
  315. package/src/themes/chubby/views/comment.variables +11 -11
  316. package/src/themes/classic/collections/table.variables +3 -3
  317. package/src/themes/classic/elements/button.variables +36 -43
  318. package/src/themes/classic/elements/header.variables +4 -4
  319. package/src/themes/classic/modules/progress.variables +3 -3
  320. package/src/themes/classic/views/card.overrides +25 -27
  321. package/src/themes/classic/views/card.variables +7 -7
  322. package/src/themes/colored/modules/checkbox.overrides +3 -0
  323. package/src/themes/colored/modules/checkbox.variables +1 -3
  324. package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  325. package/src/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  326. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  327. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  328. package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  329. package/src/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  330. package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  331. package/src/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  332. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  333. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  334. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  335. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  336. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  337. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  338. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  339. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  340. package/src/themes/default/collections/breadcrumb.variables +4 -4
  341. package/src/themes/default/collections/form.variables +15 -16
  342. package/src/themes/default/collections/grid.overrides +0 -1
  343. package/src/themes/default/collections/grid.variables +14 -16
  344. package/src/themes/default/collections/menu.variables +31 -45
  345. package/src/themes/default/collections/message.variables +84 -123
  346. package/src/themes/default/collections/table.overrides +3 -0
  347. package/src/themes/default/collections/table.variables +30 -34
  348. package/src/themes/default/elements/button.variables +45 -52
  349. package/src/themes/default/elements/container.variables +8 -16
  350. package/src/themes/default/elements/divider.overrides +8 -9
  351. package/src/themes/default/elements/divider.variables +5 -6
  352. package/src/themes/default/elements/emoji.overrides +0 -1
  353. package/src/themes/default/elements/emoji.variables +3555 -3555
  354. package/src/themes/default/elements/flag.variables +1594 -1594
  355. package/src/themes/default/elements/header.overrides +0 -1
  356. package/src/themes/default/elements/header.variables +21 -21
  357. package/src/themes/default/elements/icon.variables +2023 -2009
  358. package/src/themes/default/elements/image.variables +6 -7
  359. package/src/themes/default/elements/input.variables +11 -12
  360. package/src/themes/default/elements/label.variables +25 -26
  361. package/src/themes/default/elements/list.variables +17 -21
  362. package/src/themes/default/elements/loader.variables +16 -17
  363. package/src/themes/default/elements/placeholder.variables +12 -9
  364. package/src/themes/default/elements/rail.variables +4 -5
  365. package/src/themes/default/elements/reveal.variables +1 -1
  366. package/src/themes/default/elements/segment.variables +24 -36
  367. package/src/themes/default/elements/step.overrides +4 -4
  368. package/src/themes/default/elements/step.variables +19 -22
  369. package/src/themes/default/elements/text.variables +2 -3
  370. package/src/themes/default/globals/colors.less +588 -588
  371. package/src/themes/default/globals/reset.overrides +63 -59
  372. package/src/themes/default/globals/reset.variables +1 -1
  373. package/src/themes/default/globals/site.variables +1075 -1123
  374. package/src/themes/default/globals/variation.variables +13 -4
  375. package/src/themes/default/modules/accordion.overrides +11 -11
  376. package/src/themes/default/modules/accordion.variables +15 -20
  377. package/src/themes/default/modules/calendar.variables +2 -0
  378. package/src/themes/default/modules/chatroom.variables +1 -1
  379. package/src/themes/default/modules/checkbox.overrides +8 -9
  380. package/src/themes/default/modules/checkbox.variables +24 -33
  381. package/src/themes/default/modules/dimmer.variables +14 -17
  382. package/src/themes/default/modules/dropdown.overrides +17 -17
  383. package/src/themes/default/modules/dropdown.variables +29 -31
  384. package/src/themes/default/modules/embed.variables +9 -13
  385. package/src/themes/default/modules/flyout.variables +8 -8
  386. package/src/themes/default/modules/modal.variables +64 -67
  387. package/src/themes/default/modules/nag.variables +11 -14
  388. package/src/themes/default/modules/popup.variables +14 -13
  389. package/src/themes/default/modules/progress.variables +17 -19
  390. package/src/themes/default/modules/rating.variables +10 -12
  391. package/src/themes/default/modules/search.variables +12 -17
  392. package/src/themes/default/modules/shape.variables +7 -8
  393. package/src/themes/default/modules/sidebar.variables +4 -4
  394. package/src/themes/default/modules/slider.variables +55 -54
  395. package/src/themes/default/modules/sticky.variables +1 -1
  396. package/src/themes/default/modules/toast.variables +8 -8
  397. package/src/themes/default/modules/transition.overrides +936 -915
  398. package/src/themes/default/modules/transition.variables +8 -1
  399. package/src/themes/default/views/ad.variables +1 -1
  400. package/src/themes/default/views/card.variables +33 -45
  401. package/src/themes/default/views/comment.variables +7 -9
  402. package/src/themes/default/views/feed.variables +10 -10
  403. package/src/themes/default/views/item.variables +20 -23
  404. package/src/themes/default/views/statistic.variables +8 -8
  405. package/src/themes/duo/elements/loader.variables +1 -1
  406. package/src/themes/famfamfam/elements/flag.overrides +263 -268
  407. package/src/themes/famfamfam/elements/flag.variables +4 -4
  408. package/src/themes/fixed-width/collections/grid.variables +4 -4
  409. package/src/themes/fixed-width/modules/modal.variables +11 -13
  410. package/src/themes/flat/collections/form.overrides +9 -9
  411. package/src/themes/flat/collections/form.variables +16 -17
  412. package/src/themes/flat/globals/site.variables +69 -74
  413. package/src/themes/github/assets/fonts/octicons.woff2 +0 -0
  414. package/src/themes/github/collections/breadcrumb.variables +0 -1
  415. package/src/themes/github/collections/form.overrides +7 -8
  416. package/src/themes/github/collections/form.variables +16 -18
  417. package/src/themes/github/collections/grid.variables +1 -2
  418. package/src/themes/github/collections/menu.overrides +2 -2
  419. package/src/themes/github/collections/menu.variables +24 -26
  420. package/src/themes/github/collections/message.overrides +3 -3
  421. package/src/themes/github/collections/message.variables +12 -14
  422. package/src/themes/github/collections/table.variables +2 -2
  423. package/src/themes/github/elements/button.overrides +0 -1
  424. package/src/themes/github/elements/button.variables +26 -30
  425. package/src/themes/github/elements/header.variables +2 -2
  426. package/src/themes/github/elements/icon.overrides +3 -208
  427. package/src/themes/github/elements/icon.variables +234 -19
  428. package/src/themes/github/elements/image.variables +1 -1
  429. package/src/themes/github/elements/input.overrides +16 -16
  430. package/src/themes/github/elements/input.variables +4 -5
  431. package/src/themes/github/elements/label.overrides +3 -3
  432. package/src/themes/github/elements/label.variables +0 -1
  433. package/src/themes/github/elements/segment.variables +9 -10
  434. package/src/themes/github/elements/step.overrides +13 -13
  435. package/src/themes/github/elements/step.variables +6 -6
  436. package/src/themes/github/globals/site.variables +16 -16
  437. package/src/themes/github/modules/dropdown.overrides +18 -19
  438. package/src/themes/github/modules/dropdown.variables +8 -10
  439. package/src/themes/github/modules/popup.variables +0 -2
  440. package/src/themes/gmail/collections/message.overrides +3 -0
  441. package/src/themes/gmail/collections/message.variables +4 -4
  442. package/src/themes/instagram/views/card.overrides +4 -5
  443. package/src/themes/instagram/views/card.variables +7 -8
  444. package/src/themes/joypixels/elements/emoji.overrides +0 -2
  445. package/src/themes/joypixels/elements/emoji.variables +3554 -3554
  446. package/src/themes/material/collections/menu.overrides +1 -1
  447. package/src/themes/material/collections/menu.variables +4 -4
  448. package/src/themes/material/elements/button.overrides +7 -9
  449. package/src/themes/material/elements/button.variables +44 -46
  450. package/src/themes/material/elements/header.overrides +3 -3
  451. package/src/themes/material/elements/header.variables +8 -10
  452. package/src/themes/material/elements/icon.overrides +3 -934
  453. package/src/themes/material/elements/icon.variables +958 -18
  454. package/src/themes/material/globals/site.overrides +3 -0
  455. package/src/themes/material/globals/site.variables +83 -84
  456. package/src/themes/material/modules/dropdown.overrides +2 -2
  457. package/src/themes/material/modules/dropdown.variables +5 -5
  458. package/src/themes/material/modules/modal.overrides +3 -3
  459. package/src/themes/material/modules/modal.variables +4 -5
  460. package/src/themes/pulsar/elements/loader.overrides +23 -61
  461. package/src/themes/raised/elements/button.variables +8 -9
  462. package/src/themes/resetcss/globals/reset.overrides +115 -33
  463. package/src/themes/resetcss/globals/reset.variables +1 -1
  464. package/src/themes/round/elements/button.overrides +3 -0
  465. package/src/themes/round/elements/button.variables +33 -38
  466. package/src/themes/rtl/globals/site.overrides +1 -1
  467. package/src/themes/rtl/globals/site.variables +5 -6
  468. package/src/themes/striped/modules/progress.overrides +20 -16
  469. package/src/themes/systemfont/globals/reset.overrides +1 -1
  470. package/src/themes/systemfont/globals/site.variables +6 -6
  471. package/src/themes/timeline/views/feed.overrides +12 -12
  472. package/src/themes/timeline/views/feed.variables +8 -8
  473. package/src/themes/twitter/elements/button.overrides +4 -5
  474. package/src/themes/twitter/elements/button.variables +17 -18
  475. package/src/themes/twitter/elements/emoji.variables +3555 -3555
  476. package/tasks/.eslintrc.js +9 -0
  477. package/tasks/README.md +2 -4
  478. package/tasks/admin/components/create.js +268 -277
  479. package/tasks/admin/components/init.js +123 -130
  480. package/tasks/admin/components/update.js +151 -159
  481. package/tasks/admin/distributions/create.js +183 -189
  482. package/tasks/admin/distributions/init.js +125 -132
  483. package/tasks/admin/distributions/update.js +147 -154
  484. package/tasks/admin/publish.js +5 -9
  485. package/tasks/admin/register.js +37 -39
  486. package/tasks/admin/release.js +8 -12
  487. package/tasks/build/assets.js +43 -40
  488. package/tasks/build/css.js +230 -217
  489. package/tasks/build/javascript.js +120 -114
  490. package/tasks/build.js +11 -11
  491. package/tasks/check-install.js +15 -17
  492. package/tasks/clean.js +6 -6
  493. package/tasks/collections/README.md +3 -5
  494. package/tasks/collections/admin.js +34 -36
  495. package/tasks/collections/build.js +18 -20
  496. package/tasks/collections/docs.js +10 -12
  497. package/tasks/collections/install.js +10 -12
  498. package/tasks/collections/rtl.js +9 -11
  499. package/tasks/collections/various.js +9 -11
  500. package/tasks/config/admin/github.js +17 -19
  501. package/tasks/config/admin/oauth.example.js +4 -4
  502. package/tasks/config/admin/release.js +98 -98
  503. package/tasks/config/admin/templates/README.md +8 -8
  504. package/tasks/config/admin/templates/bower.json +3 -2
  505. package/tasks/config/admin/templates/component-package.js +9 -10
  506. package/tasks/config/admin/templates/css-package.js +19 -21
  507. package/tasks/config/admin/templates/less-package.js +12 -14
  508. package/tasks/config/admin/templates/package.json +5 -5
  509. package/tasks/config/defaults.js +116 -116
  510. package/tasks/config/docs.js +23 -23
  511. package/tasks/config/npm/gulpfile.js +13 -14
  512. package/tasks/config/project/config.js +124 -136
  513. package/tasks/config/project/install.js +722 -719
  514. package/tasks/config/project/release.js +34 -41
  515. package/tasks/config/tasks.js +168 -167
  516. package/tasks/config/user.js +28 -29
  517. package/tasks/docs/build.js +100 -96
  518. package/tasks/docs/metadata.js +91 -98
  519. package/tasks/docs/serve.js +84 -82
  520. package/tasks/install.js +373 -382
  521. package/tasks/rtl/build.js +2 -4
  522. package/tasks/rtl/watch.js +2 -4
  523. package/tasks/version.js +4 -6
  524. package/tasks/watch.js +29 -31
  525. package/test/.eslintrc.js +23 -0
  526. package/test/meteor/assets.js +11 -14
  527. package/test/meteor/fonts.js +12 -13
  528. package/test/modules/accordion.spec.js +6 -8
  529. package/test/modules/checkbox.spec.js +5 -7
  530. package/test/modules/dropdown.spec.js +5 -7
  531. package/test/modules/modal.spec.js +6 -8
  532. package/test/modules/module.spec.js +158 -178
  533. package/test/modules/popup.spec.js +5 -7
  534. package/test/modules/search.spec.js +5 -7
  535. package/test/modules/shape.spec.js +5 -7
  536. package/test/modules/sidebar.spec.js +5 -7
  537. package/test/modules/tab.spec.js +6 -8
  538. package/test/modules/transition.spec.js +5 -7
  539. package/test/modules/video.spec.js +5 -7
  540. package/.github/workflows/codeql.yml +0 -68
@@ -8,1012 +8,969 @@
8
8
  *
9
9
  */
10
10
 
11
- ;(function ($, window, document, undefined) {
12
-
13
- 'use strict';
14
-
15
- $.isWindow = $.isWindow || function(obj) {
16
- return obj != null && obj === obj.window;
17
- };
18
- $.isFunction = $.isFunction || function(obj) {
19
- return typeof obj === "function" && typeof obj.nodeType !== "number";
20
- };
21
-
22
- window = (typeof window != 'undefined' && window.Math == Math)
23
- ? window
24
- : (typeof self != 'undefined' && self.Math == Math)
25
- ? self
26
- : Function('return this')()
27
- ;
28
-
29
- $.fn.tab = function(parameters) {
30
-
31
- var
32
- // use window context if none specified
33
- $allModules = $.isFunction(this)
34
- ? $(window)
35
- : $(this),
36
-
37
- moduleSelector = $allModules.selector || '',
38
- time = new Date().getTime(),
39
- performance = [],
40
-
41
- query = arguments[0],
42
- methodInvoked = (typeof query == 'string'),
43
- queryArguments = [].slice.call(arguments, 1),
44
-
45
- initializedHistory = false,
46
- returnedValue
47
- ;
48
-
49
- $allModules
50
- .each(function() {
51
- var
52
-
53
- settings = ( $.isPlainObject(parameters) )
54
- ? $.extend(true, {}, $.fn.tab.settings, parameters)
55
- : $.extend({}, $.fn.tab.settings),
56
-
57
- className = settings.className,
58
- metadata = settings.metadata,
59
- selector = settings.selector,
60
- error = settings.error,
61
- regExp = settings.regExp,
62
-
63
- eventNamespace = '.' + settings.namespace,
64
- moduleNamespace = 'module-' + settings.namespace,
65
-
66
- $module = $(this),
67
- $context,
68
- $tabs,
69
-
70
- cache = {},
71
- firstLoad = true,
72
- recursionDepth = 0,
73
- element = this,
74
- instance = $module.data(moduleNamespace),
75
-
76
- activeTabPath,
77
- parameterArray,
78
- module,
79
-
80
- historyEvent
81
-
82
- ;
83
-
84
- module = {
85
-
86
- initialize: function() {
87
- module.debug('Initializing tab menu item', $module);
88
- module.fix.callbacks();
89
- module.determineTabs();
90
-
91
- module.debug('Determining tabs', settings.context, $tabs);
92
- // set up automatic routing
93
- if(settings.auto) {
94
- module.set.auto();
95
- }
96
- module.bind.events();
97
-
98
- if(settings.history && !initializedHistory) {
99
- module.initializeHistory();
100
- initializedHistory = true;
101
- }
102
-
103
- var activeTab = module.determine.activeTab();
104
- if(settings.autoTabActivation && instance === undefined && activeTab == null) {
105
- activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
106
- module.debug('No active tab detected, setting tab active', activeTab);
107
- module.changeTab(activeTab);
108
- }
109
- if(activeTab != null && settings.history) {
110
- var autoUpdate = $.address.autoUpdate();
111
- $.address.autoUpdate(false);
112
- $.address.value(activeTab);
113
- $.address.autoUpdate(autoUpdate);
114
- }
115
-
116
- module.instantiate();
117
- },
118
-
119
- instantiate: function () {
120
- module.verbose('Storing instance of module', module);
121
- instance = module;
122
- $module
123
- .data(moduleNamespace, module)
124
- ;
125
- },
11
+ (function ($, window, document) {
12
+ 'use strict';
13
+
14
+ function isWindow(obj) {
15
+ return obj !== null && obj === obj.window;
16
+ }
17
+
18
+ function isFunction(obj) {
19
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
20
+ }
21
+
22
+ window = window !== undefined && window.Math === Math
23
+ ? window
24
+ : globalThis;
25
+
26
+ $.fn.tab = function (parameters) {
27
+ var
28
+ // use window context if none specified
29
+ $allModules = isFunction(this)
30
+ ? $(window)
31
+ : $(this),
32
+ $document = $(document),
33
+ moduleSelector = $allModules.selector || '',
34
+ time = Date.now(),
35
+ performance = [],
36
+
37
+ query = arguments[0],
38
+ methodInvoked = typeof query === 'string',
39
+ queryArguments = [].slice.call(arguments, 1),
40
+
41
+ initializedHistory = false,
42
+ returnedValue
43
+ ;
44
+
45
+ $allModules.each(function () {
46
+ var
47
+ settings = $.isPlainObject(parameters)
48
+ ? $.extend(true, {}, $.fn.tab.settings, parameters)
49
+ : $.extend({}, $.fn.tab.settings),
50
+
51
+ className = settings.className,
52
+ metadata = settings.metadata,
53
+ selector = settings.selector,
54
+ error = settings.error,
55
+ regExp = settings.regExp,
56
+
57
+ eventNamespace = '.' + settings.namespace,
58
+ moduleNamespace = 'module-' + settings.namespace,
59
+
60
+ $module = $(this),
61
+ $context,
62
+ $tabs,
63
+
64
+ cache = {},
65
+ firstLoad = true,
66
+ recursionDepth = 0,
67
+ element = this,
68
+ instance = $module.data(moduleNamespace),
69
+
70
+ activeTabPath,
71
+ parameterArray,
72
+ module,
73
+
74
+ historyEvent
75
+ ;
126
76
 
127
- destroy: function() {
128
- module.debug('Destroying tabs', $module);
129
- $module
130
- .removeData(moduleNamespace)
131
- .off(eventNamespace)
132
- ;
133
- },
77
+ module = {
78
+
79
+ initialize: function () {
80
+ module.debug('Initializing tab menu item', $module);
81
+ module.fix.callbacks();
82
+ module.determineTabs();
83
+
84
+ module.debug('Determining tabs', settings.context, $tabs);
85
+ // set up automatic routing
86
+ if (settings.auto) {
87
+ module.set.auto();
88
+ }
89
+ module.bind.events();
90
+
91
+ if (settings.history && !initializedHistory) {
92
+ module.initializeHistory();
93
+ initializedHistory = true;
94
+ }
95
+
96
+ var activeTab = module.determine.activeTab();
97
+ if (settings.autoTabActivation && instance === undefined && activeTab === null) {
98
+ activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
99
+ module.debug('No active tab detected, setting tab active', activeTab);
100
+ module.changeTab(activeTab);
101
+ }
102
+ if (activeTab !== null && settings.history) {
103
+ var autoUpdate = $.address.autoUpdate();
104
+ $.address.autoUpdate(false);
105
+ $.address.value(activeTab);
106
+ $.address.autoUpdate(autoUpdate);
107
+ }
108
+
109
+ module.instantiate();
110
+ },
134
111
 
135
- bind: {
136
- events: function() {
137
- // if using $.tab don't add events
138
- if( !$.isWindow( element ) ) {
139
- module.debug('Attaching tab activation events to element', $module);
140
- $module
141
- .on('click' + eventNamespace, module.event.click)
142
- ;
143
- }
144
- }
145
- },
112
+ instantiate: function () {
113
+ module.verbose('Storing instance of module', module);
114
+ instance = module;
115
+ $module
116
+ .data(moduleNamespace, module)
117
+ ;
118
+ },
146
119
 
147
- determineTabs: function() {
148
- var
149
- $reference
150
- ;
120
+ destroy: function () {
121
+ module.debug('Destroying tabs', $module);
122
+ $module
123
+ .removeData(moduleNamespace)
124
+ .off(eventNamespace)
125
+ ;
126
+ },
151
127
 
152
- // determine tab context
153
- if(settings.context === 'parent') {
154
- if($module.closest(selector.ui).length > 0) {
155
- $reference = $module.closest(selector.ui);
156
- module.verbose('Using closest UI element as parent', $reference);
157
- }
158
- else {
159
- $reference = $module;
160
- }
161
- $context = $reference.parent();
162
- module.verbose('Determined parent element for creating context', $context);
163
- }
164
- else if(settings.context) {
165
- $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context);
166
- module.verbose('Using selector for tab context', settings.context, $context);
167
- }
168
- else {
169
- $context = $('body');
170
- }
171
- // find tabs
172
- if(settings.childrenOnly) {
173
- $tabs = $context.children(selector.tabs);
174
- module.debug('Searching tab context children for tabs', $context, $tabs);
175
- }
176
- else {
177
- $tabs = $context.find(selector.tabs);
178
- module.debug('Searching tab context for tabs', $context, $tabs);
179
- }
180
- },
128
+ bind: {
129
+ events: function () {
130
+ // if using $.tab don't add events
131
+ if (!isWindow(element)) {
132
+ module.debug('Attaching tab activation events to element', $module);
133
+ $module
134
+ .on('click' + eventNamespace, module.event.click)
135
+ ;
136
+ }
137
+ },
138
+ },
181
139
 
182
- fix: {
183
- callbacks: function() {
184
- if( $.isPlainObject(parameters) && (parameters.onTabLoad || parameters.onTabInit) ) {
185
- if(parameters.onTabLoad) {
186
- parameters.onLoad = parameters.onTabLoad;
187
- delete parameters.onTabLoad;
188
- module.error(error.legacyLoad, parameters.onLoad);
189
- }
190
- if(parameters.onTabInit) {
191
- parameters.onFirstLoad = parameters.onTabInit;
192
- delete parameters.onTabInit;
193
- module.error(error.legacyInit, parameters.onFirstLoad);
194
- }
195
- settings = $.extend(true, {}, $.fn.tab.settings, parameters);
196
- }
197
- }
198
- },
140
+ determineTabs: function () {
141
+ var
142
+ $reference
143
+ ;
144
+
145
+ // determine tab context
146
+ if (settings.context === 'parent') {
147
+ if ($module.closest(selector.ui).length > 0) {
148
+ $reference = $module.closest(selector.ui);
149
+ module.verbose('Using closest UI element as parent', $reference);
150
+ } else {
151
+ $reference = $module;
152
+ }
153
+ $context = $reference.parent();
154
+ module.verbose('Determined parent element for creating context', $context);
155
+ } else if (settings.context) {
156
+ $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
157
+ module.verbose('Using selector for tab context', settings.context, $context);
158
+ } else {
159
+ $context = $('body');
160
+ }
161
+ // find tabs
162
+ if (settings.childrenOnly) {
163
+ $tabs = $context.children(selector.tabs);
164
+ module.debug('Searching tab context children for tabs', $context, $tabs);
165
+ } else {
166
+ $tabs = $context.find(selector.tabs);
167
+ module.debug('Searching tab context for tabs', $context, $tabs);
168
+ }
169
+ },
199
170
 
200
- initializeHistory: function() {
201
- module.debug('Initializing page state');
202
- if( $.address === undefined ) {
203
- module.error(error.state);
204
- return false;
205
- }
206
- else {
207
- if(settings.historyType == 'state') {
208
- module.debug('Using HTML5 to manage state');
209
- if(settings.path !== false) {
210
- $.address
211
- .history(true)
212
- .state(settings.path)
213
- ;
214
- $(window).trigger('popstate');
215
- }
216
- else {
217
- module.error(error.path);
218
- return false;
219
- }
220
- }
221
- $.address
222
- .bind('change', module.event.history.change)
223
- ;
224
- }
225
- },
171
+ fix: {
172
+ callbacks: function () {
173
+ if ($.isPlainObject(parameters) && (parameters.onTabLoad || parameters.onTabInit)) {
174
+ if (parameters.onTabLoad) {
175
+ parameters.onLoad = parameters.onTabLoad;
176
+ delete parameters.onTabLoad;
177
+ module.error(error.legacyLoad, parameters.onLoad);
178
+ }
179
+ if (parameters.onTabInit) {
180
+ parameters.onFirstLoad = parameters.onTabInit;
181
+ delete parameters.onTabInit;
182
+ module.error(error.legacyInit, parameters.onFirstLoad);
183
+ }
184
+ settings = $.extend(true, {}, $.fn.tab.settings, parameters);
185
+ }
186
+ },
187
+ },
226
188
 
227
- event: {
228
- click: function(event) {
229
- var
230
- tabPath = $(this).data(metadata.tab)
231
- ;
232
- if(tabPath !== undefined) {
233
- if(settings.history) {
234
- module.verbose('Updating page state', event);
235
- $.address.value(tabPath);
236
- }
237
- else {
238
- module.verbose('Changing tab', event);
239
- module.changeTab(tabPath);
240
- }
241
- event.preventDefault();
242
- }
243
- else {
244
- module.debug('No tab specified');
245
- }
246
- },
247
- history: {
248
- change: function(event) {
249
- var
250
- tabPath = event.pathNames.join('/') || module.get.initialPath(),
251
- pageTitle = settings.templates.determineTitle(tabPath) || false
252
- ;
253
- module.performance.display();
254
- module.debug('History change event', tabPath, event);
255
- historyEvent = event;
256
- if(tabPath !== undefined) {
257
- module.changeTab(tabPath);
258
- }
259
- if(pageTitle) {
260
- $.address.title(pageTitle);
261
- }
262
- }
263
- }
264
- },
189
+ initializeHistory: function () {
190
+ module.debug('Initializing page state');
191
+ if ($.address === undefined) {
192
+ module.error(error.state);
193
+
194
+ return false;
195
+ }
196
+ if (settings.historyType === 'state') {
197
+ module.debug('Using HTML5 to manage state');
198
+ if (settings.path !== false) {
199
+ $.address
200
+ .history(true)
201
+ .state(settings.path)
202
+ ;
203
+ $(window).trigger('popstate');
204
+ } else {
205
+ module.error(error.path);
206
+
207
+ return false;
208
+ }
209
+ }
210
+ $.address
211
+ .bind('change', module.event.history.change)
212
+ ;
213
+ },
265
214
 
266
- refresh: function() {
267
- if(activeTabPath) {
268
- module.debug('Refreshing tab', activeTabPath);
269
- module.changeTab(activeTabPath);
270
- }
271
- },
215
+ event: {
216
+ click: function (event) {
217
+ var
218
+ tabPath = $(this).data(metadata.tab)
219
+ ;
220
+ if (tabPath !== undefined) {
221
+ if (settings.history) {
222
+ module.verbose('Updating page state', event);
223
+ $.address.value(tabPath);
224
+ } else {
225
+ module.verbose('Changing tab', event);
226
+ module.changeTab(tabPath);
227
+ }
228
+ event.preventDefault();
229
+ } else {
230
+ module.debug('No tab specified');
231
+ }
232
+ },
233
+ history: {
234
+ change: function (event) {
235
+ var
236
+ tabPath = event.pathNames.join('/') || module.get.initialPath(),
237
+ pageTitle = settings.templates.determineTitle(tabPath) || false
238
+ ;
239
+ module.performance.display();
240
+ module.debug('History change event', tabPath, event);
241
+ historyEvent = event;
242
+ if (tabPath !== undefined) {
243
+ module.changeTab(tabPath);
244
+ }
245
+ if (pageTitle) {
246
+ $.address.title(pageTitle);
247
+ }
248
+ },
249
+ },
250
+ },
272
251
 
273
- cache: {
252
+ refresh: function () {
253
+ if (activeTabPath) {
254
+ module.debug('Refreshing tab', activeTabPath);
255
+ module.changeTab(activeTabPath);
256
+ }
257
+ },
274
258
 
275
- read: function(cacheKey) {
276
- return (cacheKey !== undefined)
277
- ? cache[cacheKey]
278
- : false
279
- ;
280
- },
281
- add: function(cacheKey, content) {
282
- cacheKey = cacheKey || activeTabPath;
283
- module.debug('Adding cached content for', cacheKey);
284
- cache[cacheKey] = content;
285
- },
286
- remove: function(cacheKey) {
287
- cacheKey = cacheKey || activeTabPath;
288
- module.debug('Removing cached content for', cacheKey);
289
- delete cache[cacheKey];
290
- }
291
- },
259
+ cache: {
260
+
261
+ read: function (cacheKey) {
262
+ return cacheKey !== undefined
263
+ ? cache[cacheKey]
264
+ : false;
265
+ },
266
+ add: function (cacheKey, content) {
267
+ cacheKey = cacheKey || activeTabPath;
268
+ module.debug('Adding cached content for', cacheKey);
269
+ cache[cacheKey] = content;
270
+ },
271
+ remove: function (cacheKey) {
272
+ cacheKey = cacheKey || activeTabPath;
273
+ module.debug('Removing cached content for', cacheKey);
274
+ delete cache[cacheKey];
275
+ },
276
+ },
292
277
 
293
- escape: {
294
- string: function(text) {
295
- text = String(text);
296
- return text.replace(regExp.escape, '\\$&');
297
- }
298
- },
278
+ escape: {
279
+ string: function (text) {
280
+ text = String(text);
299
281
 
300
- set: {
301
- auto: function() {
302
- var
303
- url = (typeof settings.path == 'string')
304
- ? settings.path.replace(/\/$/, '') + '/{$tab}'
305
- : '/{$tab}'
306
- ;
307
- module.verbose('Setting up automatic tab retrieval from server', url);
308
- if($.isPlainObject(settings.apiSettings)) {
309
- settings.apiSettings.url = url;
310
- }
311
- else {
312
- settings.apiSettings = {
313
- url: url
314
- };
315
- }
316
- },
317
- loading: function(tabPath) {
318
- var
319
- $tab = module.get.tabElement(tabPath),
320
- isLoading = $tab.hasClass(className.loading)
321
- ;
322
- if(!isLoading) {
323
- module.verbose('Setting loading state for', $tab);
324
- $tab
325
- .addClass(className.loading)
326
- .siblings($tabs)
327
- .removeClass(className.active + ' ' + className.loading)
328
- ;
329
- if($tab.length > 0) {
330
- settings.onRequest.call($tab[0], tabPath);
331
- }
332
- }
333
- },
334
- state: function(state) {
335
- $.address.value(state);
336
- }
337
- },
282
+ return text.replace(regExp.escape, '\\$&');
283
+ },
284
+ },
338
285
 
339
- changeTab: function(tabPath) {
340
- var
341
- pushStateAvailable = (window.history && window.history.pushState),
342
- shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
343
- remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
344
- // only add default path if not remote content
345
- pathArray = (remoteContent && !shouldIgnoreLoad)
346
- ? module.utilities.pathToArray(tabPath)
347
- : module.get.defaultPathArray(tabPath)
348
- ;
349
- tabPath = module.utilities.arrayToPath(pathArray);
350
- $.each(pathArray, function(index, tab) {
351
- var
352
- currentPathArray = pathArray.slice(0, index + 1),
353
- currentPath = module.utilities.arrayToPath(currentPathArray),
286
+ set: {
287
+ auto: function () {
288
+ var
289
+ url = typeof settings.path === 'string'
290
+ ? settings.path.replace(/\/$/, '') + '/{$tab}'
291
+ : '/{$tab}'
292
+ ;
293
+ module.verbose('Setting up automatic tab retrieval from server', url);
294
+ if ($.isPlainObject(settings.apiSettings)) {
295
+ settings.apiSettings.url = url;
296
+ } else {
297
+ settings.apiSettings = {
298
+ url: url,
299
+ };
300
+ }
301
+ },
302
+ loading: function (tabPath) {
303
+ var
304
+ $tab = module.get.tabElement(tabPath),
305
+ isLoading = $tab.hasClass(className.loading)
306
+ ;
307
+ if (!isLoading) {
308
+ module.verbose('Setting loading state for', $tab);
309
+ $tab
310
+ .addClass(className.loading)
311
+ .siblings($tabs)
312
+ .removeClass(className.active + ' ' + className.loading)
313
+ ;
314
+ if ($tab.length > 0) {
315
+ settings.onRequest.call($tab[0], tabPath);
316
+ }
317
+ }
318
+ },
319
+ state: function (state) {
320
+ $.address.value(state);
321
+ },
322
+ },
354
323
 
355
- isTab = module.is.tab(currentPath),
356
- isLastIndex = (index + 1 == pathArray.length),
324
+ changeTab: function (tabPath) {
325
+ var
326
+ pushStateAvailable = window.history && window.history.pushState,
327
+ shouldIgnoreLoad = pushStateAvailable && settings.ignoreFirstLoad && firstLoad,
328
+ remoteContent = settings.auto || $.isPlainObject(settings.apiSettings),
329
+ // only add default path if not remote content
330
+ pathArray = remoteContent && !shouldIgnoreLoad
331
+ ? module.utilities.pathToArray(tabPath)
332
+ : module.get.defaultPathArray(tabPath)
333
+ ;
334
+ tabPath = module.utilities.arrayToPath(pathArray);
335
+ $.each(pathArray, function (index, tab) {
336
+ var
337
+ currentPathArray = pathArray.slice(0, index + 1),
338
+ currentPath = module.utilities.arrayToPath(currentPathArray),
339
+
340
+ isTab = module.is.tab(currentPath),
341
+ isLastIndex = index + 1 === pathArray.length,
342
+
343
+ $tab = module.get.tabElement(currentPath),
344
+ $anchor,
345
+ nextPathArray,
346
+ nextPath,
347
+ isLastTab
348
+ ;
349
+ module.verbose('Looking for tab', tab);
350
+ if (isTab) {
351
+ module.verbose('Tab was found', tab);
352
+ // scope up
353
+ activeTabPath = currentPath;
354
+ parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
355
+
356
+ if (isLastIndex) {
357
+ isLastTab = true;
358
+ } else {
359
+ nextPathArray = pathArray.slice(0, index + 2);
360
+ nextPath = module.utilities.arrayToPath(nextPathArray);
361
+ isLastTab = !module.is.tab(nextPath);
362
+ if (isLastTab) {
363
+ module.verbose('Tab parameters found', nextPathArray);
364
+ }
365
+ }
366
+ if (settings.onBeforeChange.call(element, currentPath) === false) {
367
+ module.debug('onBeforeChange returned false, cancelling tab change', $tab);
368
+
369
+ return false;
370
+ }
371
+ if (isLastTab && remoteContent) {
372
+ if (!shouldIgnoreLoad) {
373
+ module.activate.navigation(currentPath);
374
+ module.fetch.content(currentPath, tabPath);
375
+ } else {
376
+ module.debug('Ignoring remote content on first tab load', currentPath);
377
+ firstLoad = false;
378
+ module.cache.add(tabPath, $tab.html());
379
+ module.activate.all(currentPath);
380
+ settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
381
+ settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
382
+ }
383
+
384
+ return false;
385
+ }
386
+
387
+ module.debug('Opened local tab', currentPath);
388
+ module.activate.all(currentPath);
389
+ if (!module.cache.read(currentPath)) {
390
+ module.cache.add(currentPath, true);
391
+ module.debug('First time tab loaded calling tab init');
392
+ settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
393
+ }
394
+ settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
395
+ } else if (tabPath.search('/') === -1 && tabPath !== '') {
396
+ // look for in page anchor
397
+ tabPath = module.escape.string(tabPath);
398
+ $anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]');
399
+ currentPath = $anchor.closest('[data-tab]').data(metadata.tab);
400
+ $tab = module.get.tabElement(currentPath);
401
+ // if anchor exists use parent tab
402
+ if ($anchor && $anchor.length > 0 && currentPath) {
403
+ module.debug('Anchor link used, opening parent tab', $tab, $anchor);
404
+ if (settings.onBeforeChange.call(element, currentPath) === false) {
405
+ module.debug('onBeforeChange returned false, cancelling tab change', $tab);
406
+
407
+ return false;
408
+ }
409
+ if (!$tab.hasClass(className.active)) {
410
+ setTimeout(function () {
411
+ module.scrollTo($anchor);
412
+ }, 0);
413
+ }
414
+ module.activate.all(currentPath);
415
+ if (!module.cache.read(currentPath)) {
416
+ module.cache.add(currentPath, true);
417
+ module.debug('First time tab loaded calling tab init');
418
+ settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
419
+ }
420
+ settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
421
+
422
+ return false;
423
+ }
424
+ } else {
425
+ module.error(error.missingTab, $module, $context, currentPath);
426
+
427
+ return false;
428
+ }
429
+ });
430
+ },
357
431
 
358
- $tab = module.get.tabElement(currentPath),
359
- $anchor,
360
- nextPathArray,
361
- nextPath,
362
- isLastTab
363
- ;
364
- module.verbose('Looking for tab', tab);
365
- if(isTab) {
366
- module.verbose('Tab was found', tab);
367
- // scope up
368
- activeTabPath = currentPath;
369
- parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
370
-
371
- if(isLastIndex) {
372
- isLastTab = true;
373
- }
374
- else {
375
- nextPathArray = pathArray.slice(0, index + 2);
376
- nextPath = module.utilities.arrayToPath(nextPathArray);
377
- isLastTab = ( !module.is.tab(nextPath) );
378
- if(isLastTab) {
379
- module.verbose('Tab parameters found', nextPathArray);
380
- }
381
- }
382
- if (settings.onBeforeChange.call(element, currentPath) === false) {
383
- module.debug('onBeforeChange returned false, cancelling tab change', $tab);
384
- return false;
385
- }
386
- if(isLastTab && remoteContent) {
387
- if(!shouldIgnoreLoad) {
388
- module.activate.navigation(currentPath);
389
- module.fetch.content(currentPath, tabPath);
390
- }
391
- else {
392
- module.debug('Ignoring remote content on first tab load', currentPath);
393
- firstLoad = false;
394
- module.cache.add(tabPath, $tab.html());
395
- module.activate.all(currentPath);
396
- settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
397
- settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
398
- }
399
- return false;
400
- }
401
- else {
402
- module.debug('Opened local tab', currentPath);
403
- module.activate.all(currentPath);
404
- if( !module.cache.read(currentPath) ) {
405
- module.cache.add(currentPath, true);
406
- module.debug('First time tab loaded calling tab init');
407
- settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
408
- }
409
- settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
410
- }
432
+ scrollTo: function ($element) {
433
+ var
434
+ scrollOffset = $element && $element.length > 0
435
+ ? $element.offset().top
436
+ : false
437
+ ;
438
+ if (scrollOffset !== false) {
439
+ module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
440
+ $document.scrollTop(scrollOffset);
441
+ }
442
+ },
411
443
 
412
- }
413
- else if(tabPath.search('/') == -1 && tabPath !== '') {
414
- // look for in page anchor
415
- tabPath = module.escape.string(tabPath);
416
- $anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]');
417
- currentPath = $anchor.closest('[data-tab]').data(metadata.tab);
418
- $tab = module.get.tabElement(currentPath);
419
- // if anchor exists use parent tab
420
- if($anchor && $anchor.length > 0 && currentPath) {
421
- module.debug('Anchor link used, opening parent tab', $tab, $anchor);
422
- if (settings.onBeforeChange.call(element, currentPath) === false) {
423
- module.debug('onBeforeChange returned false, cancelling tab change', $tab);
424
- return false;
425
- }
426
- if( !$tab.hasClass(className.active) ) {
427
- setTimeout(function() {
428
- module.scrollTo($anchor);
429
- }, 0);
430
- }
431
- module.activate.all(currentPath);
432
- if( !module.cache.read(currentPath) ) {
433
- module.cache.add(currentPath, true);
434
- module.debug('First time tab loaded calling tab init');
435
- settings.onFirstLoad.call($tab[0], currentPath, parameterArray, historyEvent);
436
- }
437
- settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
438
- return false;
439
- }
440
- }
441
- else {
442
- module.error(error.missingTab, $module, $context, currentPath);
443
- return false;
444
- }
445
- });
446
- },
444
+ update: {
445
+ content: function (tabPath, html, evaluateScripts) {
446
+ var
447
+ $tab = module.get.tabElement(tabPath),
448
+ tab = $tab[0]
449
+ ;
450
+ evaluateScripts = evaluateScripts !== undefined
451
+ ? evaluateScripts
452
+ : settings.evaluateScripts;
453
+ if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && typeof html !== 'string') {
454
+ $tab
455
+ .empty()
456
+ .append($(html).clone(true))
457
+ ;
458
+ } else {
459
+ if (evaluateScripts) {
460
+ module.debug('Updating HTML and evaluating inline scripts', tabPath, html);
461
+ $tab.html(html);
462
+ } else {
463
+ module.debug('Updating HTML', tabPath, html);
464
+ tab.innerHTML = html;
465
+ }
466
+ }
467
+ },
468
+ },
447
469
 
448
- scrollTo: function($element) {
449
- var
450
- scrollOffset = ($element && $element.length > 0)
451
- ? $element.offset().top
452
- : false
453
- ;
454
- if(scrollOffset !== false) {
455
- module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
456
- $(document).scrollTop(scrollOffset);
457
- }
458
- },
470
+ fetch: {
471
+
472
+ content: function (tabPath, fullTabPath) {
473
+ var
474
+ $tab = module.get.tabElement(tabPath),
475
+ apiSettings = {
476
+ dataType: 'html',
477
+ encodeParameters: false,
478
+ on: 'now',
479
+ cache: settings.alwaysRefresh,
480
+ headers: {
481
+ 'X-Remote': true,
482
+ },
483
+ onSuccess: function (response) {
484
+ if (settings.cacheType === 'response') {
485
+ module.cache.add(fullTabPath, response);
486
+ }
487
+ module.update.content(tabPath, response);
488
+ if (tabPath == activeTabPath) {
489
+ module.debug('Content loaded', tabPath);
490
+ module.activate.tab(tabPath);
491
+ } else {
492
+ module.debug('Content loaded in background', tabPath);
493
+ }
494
+ settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
495
+ settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
496
+
497
+ if (settings.loadOnce) {
498
+ module.cache.add(fullTabPath, true);
499
+ } else if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && $tab.children().length > 0) {
500
+ setTimeout(function () {
501
+ var
502
+ $clone = $tab.children().clone(true)
503
+ ;
504
+ $clone = $clone.not('script');
505
+ module.cache.add(fullTabPath, $clone);
506
+ }, 0);
507
+ } else {
508
+ module.cache.add(fullTabPath, $tab.html());
509
+ }
510
+ },
511
+ urlData: {
512
+ tab: fullTabPath,
513
+ },
514
+ },
515
+ request = $tab.api('get request') || false,
516
+ existingRequest = request && request.state() === 'pending',
517
+ requestSettings,
518
+ cachedContent
519
+ ;
520
+
521
+ fullTabPath = fullTabPath || tabPath;
522
+ cachedContent = module.cache.read(fullTabPath);
523
+
524
+ if (settings.cache && cachedContent) {
525
+ module.activate.tab(tabPath);
526
+ module.debug('Adding cached content', fullTabPath);
527
+ if (!settings.loadOnce) {
528
+ if (settings.evaluateScripts === 'once') {
529
+ module.update.content(tabPath, cachedContent, false);
530
+ } else {
531
+ module.update.content(tabPath, cachedContent);
532
+ }
533
+ }
534
+ settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
535
+ } else if (existingRequest) {
536
+ module.set.loading(tabPath);
537
+ module.debug('Content is already loading', fullTabPath);
538
+ } else if ($.api !== undefined) {
539
+ requestSettings = $.extend(true, {}, settings.apiSettings, apiSettings);
540
+ module.debug('Retrieving remote content', fullTabPath, requestSettings);
541
+ module.set.loading(tabPath);
542
+ $tab.api(requestSettings);
543
+ } else {
544
+ module.error(error.api);
545
+ }
546
+ },
547
+ },
459
548
 
460
- update: {
461
- content: function(tabPath, html, evaluateScripts) {
462
- var
463
- $tab = module.get.tabElement(tabPath),
464
- tab = $tab[0]
465
- ;
466
- evaluateScripts = (evaluateScripts !== undefined)
467
- ? evaluateScripts
468
- : settings.evaluateScripts
469
- ;
470
- if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && typeof html !== 'string') {
471
- $tab
472
- .empty()
473
- .append($(html).clone(true))
474
- ;
475
- }
476
- else {
477
- if(evaluateScripts) {
478
- module.debug('Updating HTML and evaluating inline scripts', tabPath, html);
479
- $tab.html(html);
480
- }
481
- else {
482
- module.debug('Updating HTML', tabPath, html);
483
- tab.innerHTML = html;
484
- }
485
- }
486
- }
487
- },
549
+ activate: {
550
+ all: function (tabPath) {
551
+ module.activate.tab(tabPath);
552
+ module.activate.navigation(tabPath);
553
+ },
554
+ tab: function (tabPath) {
555
+ var
556
+ $tab = module.get.tabElement(tabPath),
557
+ $deactiveTabs = settings.deactivate === 'siblings'
558
+ ? $tab.siblings($tabs)
559
+ : $tabs.not($tab),
560
+ isActive = $tab.hasClass(className.active)
561
+ ;
562
+ module.verbose('Showing tab content for', $tab);
563
+ if (!isActive) {
564
+ $tab
565
+ .addClass(className.active)
566
+ ;
567
+ $deactiveTabs
568
+ .removeClass(className.active + ' ' + className.loading)
569
+ ;
570
+ if ($tab.length > 0) {
571
+ settings.onVisible.call($tab[0], tabPath);
572
+ }
573
+ }
574
+ },
575
+ navigation: function (tabPath) {
576
+ var
577
+ $navigation = module.get.navElement(tabPath),
578
+ $deactiveNavigation = settings.deactivate === 'siblings'
579
+ ? $navigation.siblings($allModules)
580
+ : $allModules.not($navigation),
581
+ isActive = $navigation.hasClass(className.active)
582
+ ;
583
+ module.verbose('Activating tab navigation for', $navigation, tabPath);
584
+ if (!isActive) {
585
+ $navigation
586
+ .addClass(className.active)
587
+ ;
588
+ $deactiveNavigation
589
+ .removeClass(className.active + ' ' + className.loading)
590
+ ;
591
+ }
592
+ },
593
+ },
488
594
 
489
- fetch: {
595
+ deactivate: {
596
+ all: function () {
597
+ module.deactivate.navigation();
598
+ module.deactivate.tabs();
599
+ },
600
+ navigation: function () {
601
+ $allModules
602
+ .removeClass(className.active)
603
+ ;
604
+ },
605
+ tabs: function () {
606
+ $tabs
607
+ .removeClass(className.active + ' ' + className.loading)
608
+ ;
609
+ },
610
+ },
490
611
 
491
- content: function(tabPath, fullTabPath) {
492
- var
493
- $tab = module.get.tabElement(tabPath),
494
- apiSettings = {
495
- dataType : 'html',
496
- encodeParameters : false,
497
- on : 'now',
498
- cache : settings.alwaysRefresh,
499
- headers : {
500
- 'X-Remote': true
612
+ is: {
613
+ tab: function (tabName) {
614
+ return tabName !== undefined
615
+ ? module.get.tabElement(tabName).length > 0
616
+ : false;
617
+ },
501
618
  },
502
- onSuccess : function(response) {
503
- if(settings.cacheType == 'response') {
504
- module.cache.add(fullTabPath, response);
505
- }
506
- module.update.content(tabPath, response);
507
- if(tabPath == activeTabPath) {
508
- module.debug('Content loaded', tabPath);
509
- module.activate.tab(tabPath);
510
- }
511
- else {
512
- module.debug('Content loaded in background', tabPath);
513
- }
514
- settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
515
- settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
516
-
517
- if(settings.loadOnce) {
518
- module.cache.add(fullTabPath, true);
519
- }
520
- else if(typeof settings.cacheType == 'string' && settings.cacheType.toLowerCase() == 'dom' && $tab.children().length > 0) {
521
- setTimeout(function() {
522
- var
523
- $clone = $tab.children().clone(true)
524
- ;
525
- $clone = $clone.not('script');
526
- module.cache.add(fullTabPath, $clone);
527
- }, 0);
528
- }
529
- else {
530
- module.cache.add(fullTabPath, $tab.html());
531
- }
619
+
620
+ get: {
621
+ initialPath: function () {
622
+ return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
623
+ },
624
+ path: function () {
625
+ return $.address.value();
626
+ },
627
+ // adds default tabs to tab path
628
+ defaultPathArray: function (tabPath) {
629
+ return module.utilities.pathToArray(module.get.defaultPath(tabPath));
630
+ },
631
+ defaultPath: function (tabPath) {
632
+ var
633
+ $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + module.escape.string(tabPath) + '/"]').eq(0),
634
+ defaultTab = $defaultNav.data(metadata.tab) || false
635
+ ;
636
+ if (defaultTab) {
637
+ module.debug('Found default tab', defaultTab);
638
+ if (recursionDepth < settings.maxDepth) {
639
+ recursionDepth++;
640
+
641
+ return module.get.defaultPath(defaultTab);
642
+ }
643
+ module.error(error.recursion);
644
+ } else {
645
+ module.debug('No default tabs found for', tabPath, $tabs);
646
+ }
647
+ recursionDepth = 0;
648
+
649
+ return tabPath;
650
+ },
651
+ navElement: function (tabPath) {
652
+ tabPath = tabPath || activeTabPath;
653
+
654
+ return $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
655
+ },
656
+ tabElement: function (tabPath) {
657
+ var
658
+ $fullPathTab,
659
+ $simplePathTab,
660
+ tabPathArray,
661
+ lastTab
662
+ ;
663
+ tabPath = tabPath || activeTabPath;
664
+ tabPathArray = module.utilities.pathToArray(tabPath);
665
+ lastTab = module.utilities.last(tabPathArray);
666
+ $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
667
+ $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(lastTab) + '"]');
668
+
669
+ return $fullPathTab.length > 0
670
+ ? $fullPathTab
671
+ : $simplePathTab;
672
+ },
673
+ tab: function () {
674
+ return activeTabPath;
675
+ },
532
676
  },
533
- urlData: {
534
- tab: fullTabPath
535
- }
536
- },
537
- request = $tab.api('get request') || false,
538
- existingRequest = ( request && request.state() === 'pending' ),
539
- requestSettings,
540
- cachedContent
541
- ;
542
677
 
543
- fullTabPath = fullTabPath || tabPath;
544
- cachedContent = module.cache.read(fullTabPath);
678
+ determine: {
679
+ activeTab: function () {
680
+ var activeTab = null;
681
+
682
+ $tabs.each(function (_index, tab) {
683
+ var $tab = $(tab);
684
+
685
+ if ($tab.hasClass(className.active)) {
686
+ var
687
+ tabPath = $(this).data(metadata.tab),
688
+ $anchor = $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]')
689
+ ;
690
+
691
+ if ($anchor.hasClass(className.active)) {
692
+ activeTab = tabPath;
693
+ }
694
+ }
695
+ });
545
696
 
697
+ return activeTab;
698
+ },
699
+ },
700
+
701
+ utilities: {
702
+ filterArray: function (keepArray, removeArray) {
703
+ return $.grep(keepArray, function (keepValue) {
704
+ return $.inArray(keepValue, removeArray) === -1;
705
+ });
706
+ },
707
+ last: function (array) {
708
+ return Array.isArray(array)
709
+ ? array[array.length - 1]
710
+ : false;
711
+ },
712
+ pathToArray: function (pathName) {
713
+ if (pathName === undefined) {
714
+ pathName = activeTabPath;
715
+ }
716
+
717
+ return typeof pathName === 'string'
718
+ ? pathName.split('/')
719
+ : [pathName];
720
+ },
721
+ arrayToPath: function (pathArray) {
722
+ return Array.isArray(pathArray)
723
+ ? pathArray.join('/')
724
+ : false;
725
+ },
726
+ },
546
727
 
547
- if(settings.cache && cachedContent) {
548
- module.activate.tab(tabPath);
549
- module.debug('Adding cached content', fullTabPath);
550
- if(!settings.loadOnce) {
551
- if(settings.evaluateScripts == 'once') {
552
- module.update.content(tabPath, cachedContent, false);
728
+ setting: function (name, value) {
729
+ module.debug('Changing setting', name, value);
730
+ if ($.isPlainObject(name)) {
731
+ $.extend(true, settings, name);
732
+ } else if (value !== undefined) {
733
+ if ($.isPlainObject(settings[name])) {
734
+ $.extend(true, settings[name], value);
735
+ } else {
736
+ settings[name] = value;
737
+ }
738
+ } else {
739
+ return settings[name];
740
+ }
741
+ },
742
+ internal: function (name, value) {
743
+ if ($.isPlainObject(name)) {
744
+ $.extend(true, module, name);
745
+ } else if (value !== undefined) {
746
+ module[name] = value;
747
+ } else {
748
+ return module[name];
749
+ }
750
+ },
751
+ debug: function () {
752
+ if (!settings.silent && settings.debug) {
753
+ if (settings.performance) {
754
+ module.performance.log(arguments);
755
+ } else {
756
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
757
+ module.debug.apply(console, arguments);
758
+ }
759
+ }
760
+ },
761
+ verbose: function () {
762
+ if (!settings.silent && settings.verbose && settings.debug) {
763
+ if (settings.performance) {
764
+ module.performance.log(arguments);
765
+ } else {
766
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
767
+ module.verbose.apply(console, arguments);
768
+ }
769
+ }
770
+ },
771
+ error: function () {
772
+ if (!settings.silent) {
773
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
774
+ module.error.apply(console, arguments);
775
+ }
776
+ },
777
+ performance: {
778
+ log: function (message) {
779
+ var
780
+ currentTime,
781
+ executionTime,
782
+ previousTime
783
+ ;
784
+ if (settings.performance) {
785
+ currentTime = Date.now();
786
+ previousTime = time || currentTime;
787
+ executionTime = currentTime - previousTime;
788
+ time = currentTime;
789
+ performance.push({
790
+ Name: message[0],
791
+ Arguments: [].slice.call(message, 1) || '',
792
+ Element: element,
793
+ 'Execution Time': executionTime,
794
+ });
795
+ }
796
+ clearTimeout(module.performance.timer);
797
+ module.performance.timer = setTimeout(module.performance.display, 500);
798
+ },
799
+ display: function () {
800
+ var
801
+ title = settings.name + ':',
802
+ totalTime = 0
803
+ ;
804
+ time = false;
805
+ clearTimeout(module.performance.timer);
806
+ $.each(performance, function (index, data) {
807
+ totalTime += data['Execution Time'];
808
+ });
809
+ title += ' ' + totalTime + 'ms';
810
+ if (moduleSelector) {
811
+ title += ' \'' + moduleSelector + '\'';
812
+ }
813
+ if (performance.length > 0) {
814
+ console.groupCollapsed(title);
815
+ if (console.table) {
816
+ console.table(performance);
817
+ } else {
818
+ $.each(performance, function (index, data) {
819
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
820
+ });
821
+ }
822
+ console.groupEnd();
823
+ }
824
+ performance = [];
825
+ },
826
+ },
827
+ invoke: function (query, passedArguments, context) {
828
+ var
829
+ object = instance,
830
+ maxDepth,
831
+ found,
832
+ response
833
+ ;
834
+ passedArguments = passedArguments || queryArguments;
835
+ context = context || element;
836
+ if (typeof query === 'string' && object !== undefined) {
837
+ query = query.split(/[ .]/);
838
+ maxDepth = query.length - 1;
839
+ $.each(query, function (depth, value) {
840
+ var camelCaseValue = depth !== maxDepth
841
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
842
+ : query
843
+ ;
844
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
845
+ object = object[camelCaseValue];
846
+ } else if (object[camelCaseValue] !== undefined) {
847
+ found = object[camelCaseValue];
848
+
849
+ return false;
850
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
851
+ object = object[value];
852
+ } else if (object[value] !== undefined) {
853
+ found = object[value];
854
+
855
+ return false;
856
+ } else {
857
+ module.error(error.method, query);
858
+
859
+ return false;
860
+ }
861
+ });
862
+ }
863
+ if (isFunction(found)) {
864
+ response = found.apply(context, passedArguments);
865
+ } else if (found !== undefined) {
866
+ response = found;
867
+ }
868
+ if (Array.isArray(returnedValue)) {
869
+ returnedValue.push(response);
870
+ } else if (returnedValue !== undefined) {
871
+ returnedValue = [returnedValue, response];
872
+ } else if (response !== undefined) {
873
+ returnedValue = response;
874
+ }
875
+
876
+ return found;
877
+ },
878
+ };
879
+ if (methodInvoked) {
880
+ if (instance === undefined) {
881
+ module.initialize();
553
882
  }
554
- else {
555
- module.update.content(tabPath, cachedContent);
883
+ module.invoke(query);
884
+ } else {
885
+ if (instance !== undefined) {
886
+ instance.invoke('destroy');
556
887
  }
557
- }
558
- settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
559
- }
560
- else if(existingRequest) {
561
- module.set.loading(tabPath);
562
- module.debug('Content is already loading', fullTabPath);
563
- }
564
- else if($.api !== undefined) {
565
- requestSettings = $.extend(true, {}, settings.apiSettings, apiSettings);
566
- module.debug('Retrieving remote content', fullTabPath, requestSettings);
567
- module.set.loading(tabPath);
568
- $tab.api(requestSettings);
888
+ module.initialize();
569
889
  }
570
- else {
571
- module.error(error.api);
572
- }
573
- }
574
- },
890
+ });
575
891
 
576
- activate: {
577
- all: function(tabPath) {
578
- module.activate.tab(tabPath);
579
- module.activate.navigation(tabPath);
580
- },
581
- tab: function(tabPath) {
582
- var
583
- $tab = module.get.tabElement(tabPath),
584
- $deactiveTabs = (settings.deactivate == 'siblings')
585
- ? $tab.siblings($tabs)
586
- : $tabs.not($tab),
587
- isActive = $tab.hasClass(className.active)
588
- ;
589
- module.verbose('Showing tab content for', $tab);
590
- if(!isActive) {
591
- $tab
592
- .addClass(className.active)
593
- ;
594
- $deactiveTabs
595
- .removeClass(className.active + ' ' + className.loading)
596
- ;
597
- if($tab.length > 0) {
598
- settings.onVisible.call($tab[0], tabPath);
599
- }
600
- }
601
- },
602
- navigation: function(tabPath) {
603
- var
604
- $navigation = module.get.navElement(tabPath),
605
- $deactiveNavigation = (settings.deactivate == 'siblings')
606
- ? $navigation.siblings($allModules)
607
- : $allModules.not($navigation),
608
- isActive = $navigation.hasClass(className.active)
609
- ;
610
- module.verbose('Activating tab navigation for', $navigation, tabPath);
611
- if(!isActive) {
612
- $navigation
613
- .addClass(className.active)
614
- ;
615
- $deactiveNavigation
616
- .removeClass(className.active + ' ' + className.loading)
617
- ;
618
- }
619
- }
620
- },
892
+ return returnedValue !== undefined
893
+ ? returnedValue
894
+ : this;
895
+ };
621
896
 
622
- deactivate: {
623
- all: function() {
624
- module.deactivate.navigation();
625
- module.deactivate.tabs();
626
- },
627
- navigation: function() {
628
- $allModules
629
- .removeClass(className.active)
630
- ;
631
- },
632
- tabs: function() {
633
- $tabs
634
- .removeClass(className.active + ' ' + className.loading)
635
- ;
636
- }
637
- },
897
+ // shortcut for tabbed content with no defined navigation
898
+ $.tab = function () {
899
+ $(window).tab.apply(this, arguments);
900
+ };
638
901
 
639
- is: {
640
- tab: function(tabName) {
641
- return (tabName !== undefined)
642
- ? ( module.get.tabElement(tabName).length > 0 )
643
- : false
644
- ;
645
- }
646
- },
902
+ $.fn.tab.settings = {
647
903
 
648
- get: {
649
- initialPath: function() {
650
- return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
651
- },
652
- path: function() {
653
- return $.address.value();
654
- },
655
- // adds default tabs to tab path
656
- defaultPathArray: function(tabPath) {
657
- return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
658
- },
659
- defaultPath: function(tabPath) {
660
- var
661
- $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + module.escape.string(tabPath) + '/"]').eq(0),
662
- defaultTab = $defaultNav.data(metadata.tab) || false
663
- ;
664
- if( defaultTab ) {
665
- module.debug('Found default tab', defaultTab);
666
- if(recursionDepth < settings.maxDepth) {
667
- recursionDepth++;
668
- return module.get.defaultPath(defaultTab);
669
- }
670
- module.error(error.recursion);
671
- }
672
- else {
673
- module.debug('No default tabs found for', tabPath, $tabs);
674
- }
675
- recursionDepth = 0;
676
- return tabPath;
677
- },
678
- navElement: function(tabPath) {
679
- tabPath = tabPath || activeTabPath;
680
- return $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
681
- },
682
- tabElement: function(tabPath) {
683
- var
684
- $fullPathTab,
685
- $simplePathTab,
686
- tabPathArray,
687
- lastTab
688
- ;
689
- tabPath = tabPath || activeTabPath;
690
- tabPathArray = module.utilities.pathToArray(tabPath);
691
- lastTab = module.utilities.last(tabPathArray);
692
- $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
693
- $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(lastTab) + '"]');
694
- return ($fullPathTab.length > 0)
695
- ? $fullPathTab
696
- : $simplePathTab
697
- ;
698
- },
699
- tab: function() {
700
- return activeTabPath;
701
- }
702
- },
904
+ name: 'Tab',
905
+ namespace: 'tab',
703
906
 
704
- determine: {
705
- activeTab: function() {
706
- var activeTab = null;
907
+ silent: false,
908
+ debug: false,
909
+ verbose: false,
910
+ performance: true,
707
911
 
708
- $tabs.each(function(_index, tab) {
709
- var $tab = $(tab);
912
+ auto: false, // uses pjax style endpoints fetching content from same url with remote-content headers
913
+ history: false, // use browser history
914
+ historyType: 'hash', // #/ or html5 state
915
+ path: false, // base path of url
710
916
 
711
- if( $tab.hasClass(className.active) ) {
712
- var
713
- tabPath = $(this).data(metadata.tab),
714
- $anchor = $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]')
715
- ;
917
+ context: false, // specify a context that tabs must appear inside
918
+ childrenOnly: false, // use only tabs that are children of context
919
+ maxDepth: 25, // max depth a tab can be nested
716
920
 
717
- if( $anchor.hasClass(className.active) ) {
718
- activeTab = tabPath;
719
- }
720
- }
721
- });
921
+ deactivate: 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together
722
922
 
723
- return activeTab;
724
- }
725
- },
923
+ alwaysRefresh: false, // load tab content new every tab click
924
+ cache: true, // cache the content requests to pull locally
925
+ loadOnce: false, // Whether tab data should only be loaded once when using remote content
926
+ cacheType: 'response', // Whether to cache exact response, or to html cache contents after scripts execute
927
+ ignoreFirstLoad: false, // don't load remote content on first load
726
928
 
727
- utilities: {
728
- filterArray: function(keepArray, removeArray) {
729
- return $.grep(keepArray, function(keepValue) {
730
- return ( $.inArray(keepValue, removeArray) == -1);
731
- });
732
- },
733
- last: function(array) {
734
- return Array.isArray(array)
735
- ? array[ array.length - 1]
736
- : false
737
- ;
738
- },
739
- pathToArray: function(pathName) {
740
- if(pathName === undefined) {
741
- pathName = activeTabPath;
742
- }
743
- return typeof pathName == 'string'
744
- ? pathName.split('/')
745
- : [pathName]
746
- ;
747
- },
748
- arrayToPath: function(pathArray) {
749
- return Array.isArray(pathArray)
750
- ? pathArray.join('/')
751
- : false
752
- ;
753
- }
754
- },
929
+ apiSettings: false, // settings for api call
930
+ evaluateScripts: 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
931
+ autoTabActivation: true, // whether a non existing active tab will auto activate the first available tab
755
932
 
756
- setting: function(name, value) {
757
- module.debug('Changing setting', name, value);
758
- if( $.isPlainObject(name) ) {
759
- $.extend(true, settings, name);
760
- }
761
- else if(value !== undefined) {
762
- if($.isPlainObject(settings[name])) {
763
- $.extend(true, settings[name], value);
764
- }
765
- else {
766
- settings[name] = value;
767
- }
768
- }
769
- else {
770
- return settings[name];
771
- }
933
+ onFirstLoad: function (tabPath, parameterArray, historyEvent) {}, // called first time loaded
934
+ onLoad: function (tabPath, parameterArray, historyEvent) {}, // called on every load
935
+ onVisible: function (tabPath, parameterArray, historyEvent) {}, // called every time tab visible
936
+ onRequest: function (tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
937
+ onBeforeChange: function (tabPath) {}, // called before a tab is about to be changed. Returning false will cancel the tab change
938
+
939
+ templates: {
940
+ determineTitle: function (tabArray) {}, // returns page title for path
772
941
  },
773
- internal: function(name, value) {
774
- if( $.isPlainObject(name) ) {
775
- $.extend(true, module, name);
776
- }
777
- else if(value !== undefined) {
778
- module[name] = value;
779
- }
780
- else {
781
- return module[name];
782
- }
942
+
943
+ error: {
944
+ api: 'You attempted to load content without API module',
945
+ method: 'The method you called is not defined',
946
+ missingTab: 'Activated tab cannot be found. Tabs are case-sensitive.',
947
+ noContent: 'The tab you specified is missing a content url.',
948
+ path: 'History enabled, but no path was specified',
949
+ recursion: 'Max recursive depth reached',
950
+ legacyInit: 'onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.',
951
+ legacyLoad: 'onTabLoad has been renamed to onLoad in 2.0. Please adjust your code',
952
+ state: 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>',
783
953
  },
784
- debug: function() {
785
- if(!settings.silent && settings.debug) {
786
- if(settings.performance) {
787
- module.performance.log(arguments);
788
- }
789
- else {
790
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
791
- module.debug.apply(console, arguments);
792
- }
793
- }
954
+
955
+ regExp: {
956
+ escape: /[\s#$()*+,.:=?@[\\\]^{|}-]/g,
794
957
  },
795
- verbose: function() {
796
- if(!settings.silent && settings.verbose && settings.debug) {
797
- if(settings.performance) {
798
- module.performance.log(arguments);
799
- }
800
- else {
801
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
802
- module.verbose.apply(console, arguments);
803
- }
804
- }
958
+
959
+ metadata: {
960
+ tab: 'tab',
961
+ loaded: 'loaded',
962
+ promise: 'promise',
805
963
  },
806
- error: function() {
807
- if(!settings.silent) {
808
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
809
- module.error.apply(console, arguments);
810
- }
964
+
965
+ className: {
966
+ loading: 'loading',
967
+ active: 'active',
811
968
  },
812
- performance: {
813
- log: function(message) {
814
- var
815
- currentTime,
816
- executionTime,
817
- previousTime
818
- ;
819
- if(settings.performance) {
820
- currentTime = new Date().getTime();
821
- previousTime = time || currentTime;
822
- executionTime = currentTime - previousTime;
823
- time = currentTime;
824
- performance.push({
825
- 'Name' : message[0],
826
- 'Arguments' : [].slice.call(message, 1) || '',
827
- 'Element' : element,
828
- 'Execution Time' : executionTime
829
- });
830
- }
831
- clearTimeout(module.performance.timer);
832
- module.performance.timer = setTimeout(module.performance.display, 500);
833
- },
834
- display: function() {
835
- var
836
- title = settings.name + ':',
837
- totalTime = 0
838
- ;
839
- time = false;
840
- clearTimeout(module.performance.timer);
841
- $.each(performance, function(index, data) {
842
- totalTime += data['Execution Time'];
843
- });
844
- title += ' ' + totalTime + 'ms';
845
- if(moduleSelector) {
846
- title += ' \'' + moduleSelector + '\'';
847
- }
848
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
849
- console.groupCollapsed(title);
850
- if(console.table) {
851
- console.table(performance);
852
- }
853
- else {
854
- $.each(performance, function(index, data) {
855
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
856
- });
857
- }
858
- console.groupEnd();
859
- }
860
- performance = [];
861
- }
969
+
970
+ selector: {
971
+ tabs: '.ui.tab',
972
+ ui: '.ui',
862
973
  },
863
- invoke: function(query, passedArguments, context) {
864
- var
865
- object = instance,
866
- maxDepth,
867
- found,
868
- response
869
- ;
870
- passedArguments = passedArguments || queryArguments;
871
- context = context || element;
872
- if(typeof query == 'string' && object !== undefined) {
873
- query = query.split(/[\. ]/);
874
- maxDepth = query.length - 1;
875
- $.each(query, function(depth, value) {
876
- var camelCaseValue = (depth != maxDepth)
877
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
878
- : query
879
- ;
880
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
881
- object = object[camelCaseValue];
882
- }
883
- else if( object[camelCaseValue] !== undefined ) {
884
- found = object[camelCaseValue];
885
- return false;
886
- }
887
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
888
- object = object[value];
889
- }
890
- else if( object[value] !== undefined ) {
891
- found = object[value];
892
- return false;
893
- }
894
- else {
895
- module.error(error.method, query);
896
- return false;
897
- }
898
- });
899
- }
900
- if ( $.isFunction( found ) ) {
901
- response = found.apply(context, passedArguments);
902
- }
903
- else if(found !== undefined) {
904
- response = found;
905
- }
906
- if(Array.isArray(returnedValue)) {
907
- returnedValue.push(response);
908
- }
909
- else if(returnedValue !== undefined) {
910
- returnedValue = [returnedValue, response];
911
- }
912
- else if(response !== undefined) {
913
- returnedValue = response;
914
- }
915
- return found;
916
- }
917
- };
918
- if(methodInvoked) {
919
- if(instance === undefined) {
920
- module.initialize();
921
- }
922
- module.invoke(query);
923
- }
924
- else {
925
- if(instance !== undefined) {
926
- instance.invoke('destroy');
927
- }
928
- module.initialize();
929
- }
930
- })
931
- ;
932
- return (returnedValue !== undefined)
933
- ? returnedValue
934
- : this
935
- ;
936
-
937
- };
938
-
939
- // shortcut for tabbed content with no defined navigation
940
- $.tab = function() {
941
- $(window).tab.apply(this, arguments);
942
- };
943
-
944
- $.fn.tab.settings = {
945
-
946
- name : 'Tab',
947
- namespace : 'tab',
948
-
949
- silent : false,
950
- debug : false,
951
- verbose : false,
952
- performance : true,
953
-
954
- auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
955
- history : false, // use browser history
956
- historyType : 'hash', // #/ or html5 state
957
- path : false, // base path of url
958
-
959
- context : false, // specify a context that tabs must appear inside
960
- childrenOnly : false, // use only tabs that are children of context
961
- maxDepth : 25, // max depth a tab can be nested
962
-
963
- deactivate : 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together
964
-
965
- alwaysRefresh : false, // load tab content new every tab click
966
- cache : true, // cache the content requests to pull locally
967
- loadOnce : false, // Whether tab data should only be loaded once when using remote content
968
- cacheType : 'response', // Whether to cache exact response, or to html cache contents after scripts execute
969
- ignoreFirstLoad : false, // don't load remote content on first load
970
-
971
- apiSettings : false, // settings for api call
972
- evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
973
- autoTabActivation: true, // whether a non existing active tab will auto activate the first available tab
974
-
975
- onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
976
- onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
977
- onVisible : function(tabPath, parameterArray, historyEvent) {}, // called every time tab visible
978
- onRequest : function(tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
979
- onBeforeChange: function(tabPath) {}, // called before a tab is about to be changed. Returning false will cancel the tab change
980
-
981
- templates : {
982
- determineTitle: function(tabArray) {} // returns page title for path
983
- },
984
-
985
- error: {
986
- api : 'You attempted to load content without API module',
987
- method : 'The method you called is not defined',
988
- missingTab : 'Activated tab cannot be found. Tabs are case-sensitive.',
989
- noContent : 'The tab you specified is missing a content url.',
990
- path : 'History enabled, but no path was specified',
991
- recursion : 'Max recursive depth reached',
992
- legacyInit : 'onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.',
993
- legacyLoad : 'onTabLoad has been renamed to onLoad in 2.0. Please adjust your code',
994
- state : 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>'
995
- },
996
-
997
- regExp : {
998
- escape : /[-[\]{}()*+?.,\\^$|#\s:=@]/g
999
- },
1000
-
1001
- metadata : {
1002
- tab : 'tab',
1003
- loaded : 'loaded',
1004
- promise: 'promise'
1005
- },
1006
-
1007
- className : {
1008
- loading : 'loading',
1009
- active : 'active'
1010
- },
1011
-
1012
- selector : {
1013
- tabs : '.ui.tab',
1014
- ui : '.ui'
1015
- }
1016
-
1017
- };
1018
-
1019
- })( jQuery, window, document );
974
+
975
+ };
976
+ })(jQuery, window, document);