fomantic-ui 2.10.0-beta.2 → 2.10.0-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 (293) hide show
  1. package/.all-contributorsrc +9 -0
  2. package/.eslintrc.js +0 -10
  3. package/CHANGELOG.md +5289 -2325
  4. package/CONTRIBUTING.md +4 -1
  5. package/CONTRIBUTORS.md +1 -0
  6. package/FAQ.md +7 -2
  7. package/README.md +5 -9
  8. package/ROADMAP.md +4 -4
  9. package/SECURITY.md +8 -7
  10. package/changelog-setup.js +85 -69
  11. package/changelog-template.hbs +256 -251
  12. package/dist/components/accordion.css +1 -1
  13. package/dist/components/accordion.js +103 -142
  14. package/dist/components/accordion.min.css +1 -1
  15. package/dist/components/accordion.min.js +2 -2
  16. package/dist/components/ad.css +1 -1
  17. package/dist/components/ad.min.css +1 -1
  18. package/dist/components/api.js +157 -210
  19. package/dist/components/api.min.js +2 -2
  20. package/dist/components/breadcrumb.css +1 -1
  21. package/dist/components/breadcrumb.min.css +1 -1
  22. package/dist/components/button.css +1 -2
  23. package/dist/components/button.min.css +2 -2
  24. package/dist/components/calendar.css +1 -2
  25. package/dist/components/calendar.js +314 -352
  26. package/dist/components/calendar.min.css +2 -2
  27. package/dist/components/calendar.min.js +2 -2
  28. package/dist/components/card.css +1 -1
  29. package/dist/components/card.min.css +1 -1
  30. package/dist/components/checkbox.css +1 -2
  31. package/dist/components/checkbox.js +85 -135
  32. package/dist/components/checkbox.min.css +2 -2
  33. package/dist/components/checkbox.min.js +2 -2
  34. package/dist/components/comment.css +1 -1
  35. package/dist/components/comment.min.css +1 -1
  36. package/dist/components/container.css +2 -4
  37. package/dist/components/container.min.css +2 -2
  38. package/dist/components/dimmer.css +1 -11
  39. package/dist/components/dimmer.js +61 -94
  40. package/dist/components/dimmer.min.css +2 -2
  41. package/dist/components/dimmer.min.js +2 -2
  42. package/dist/components/divider.css +1 -2
  43. package/dist/components/divider.min.css +2 -2
  44. package/dist/components/dropdown.css +30 -51
  45. package/dist/components/dropdown.js +754 -1096
  46. package/dist/components/dropdown.min.css +2 -2
  47. package/dist/components/dropdown.min.js +2 -2
  48. package/dist/components/embed.css +1 -1
  49. package/dist/components/embed.js +84 -114
  50. package/dist/components/embed.min.css +1 -1
  51. package/dist/components/embed.min.js +2 -2
  52. package/dist/components/emoji.css +3809 -7617
  53. package/dist/components/emoji.min.css +2 -2
  54. package/dist/components/feed.css +1 -1
  55. package/dist/components/feed.min.css +1 -1
  56. package/dist/components/flag.css +1 -1
  57. package/dist/components/flag.min.css +1 -1
  58. package/dist/components/flyout.css +2 -3
  59. package/dist/components/flyout.js +225 -355
  60. package/dist/components/flyout.min.css +2 -2
  61. package/dist/components/flyout.min.js +2 -2
  62. package/dist/components/form.css +5 -95
  63. package/dist/components/form.js +335 -444
  64. package/dist/components/form.min.css +2 -2
  65. package/dist/components/form.min.js +2 -2
  66. package/dist/components/grid.css +2 -58
  67. package/dist/components/grid.min.css +2 -2
  68. package/dist/components/header.css +1 -1
  69. package/dist/components/header.min.css +1 -1
  70. package/dist/components/icon.css +4 -4
  71. package/dist/components/icon.min.css +2 -2
  72. package/dist/components/image.css +1 -1
  73. package/dist/components/image.min.css +1 -1
  74. package/dist/components/input.css +1 -536
  75. package/dist/components/input.min.css +2 -2
  76. package/dist/components/item.css +1 -1
  77. package/dist/components/item.min.css +1 -1
  78. package/dist/components/label.css +1 -1
  79. package/dist/components/label.min.css +1 -1
  80. package/dist/components/list.css +1 -3
  81. package/dist/components/list.min.css +2 -2
  82. package/dist/components/loader.css +1 -1
  83. package/dist/components/loader.min.css +1 -1
  84. package/dist/components/menu.css +40 -48
  85. package/dist/components/menu.min.css +2 -2
  86. package/dist/components/message.css +1 -1
  87. package/dist/components/message.min.css +1 -1
  88. package/dist/components/modal.css +5 -9
  89. package/dist/components/modal.js +260 -384
  90. package/dist/components/modal.min.css +2 -2
  91. package/dist/components/modal.min.js +2 -2
  92. package/dist/components/nag.css +1 -1
  93. package/dist/components/nag.js +68 -98
  94. package/dist/components/nag.min.css +1 -1
  95. package/dist/components/nag.min.js +2 -2
  96. package/dist/components/placeholder.css +1 -1
  97. package/dist/components/placeholder.min.css +1 -1
  98. package/dist/components/popup.css +1 -2
  99. package/dist/components/popup.js +197 -271
  100. package/dist/components/popup.min.css +2 -2
  101. package/dist/components/popup.min.js +2 -2
  102. package/dist/components/progress.css +1 -1
  103. package/dist/components/progress.js +109 -144
  104. package/dist/components/progress.min.css +1 -1
  105. package/dist/components/progress.min.js +2 -2
  106. package/dist/components/rail.css +1 -1
  107. package/dist/components/rail.min.css +1 -1
  108. package/dist/components/rating.css +1 -1
  109. package/dist/components/rating.js +90 -123
  110. package/dist/components/rating.min.css +1 -1
  111. package/dist/components/rating.min.js +2 -2
  112. package/dist/components/reset.css +1 -1
  113. package/dist/components/reset.min.css +1 -1
  114. package/dist/components/reveal.css +1 -1
  115. package/dist/components/reveal.min.css +1 -1
  116. package/dist/components/search.css +2 -9
  117. package/dist/components/search.js +276 -379
  118. package/dist/components/search.min.css +2 -2
  119. package/dist/components/search.min.js +2 -2
  120. package/dist/components/segment.css +2 -7
  121. package/dist/components/segment.min.css +2 -2
  122. package/dist/components/shape.css +1 -2
  123. package/dist/components/shape.js +158 -224
  124. package/dist/components/shape.min.css +2 -2
  125. package/dist/components/shape.min.js +2 -2
  126. package/dist/components/sidebar.css +2 -3
  127. package/dist/components/sidebar.js +124 -206
  128. package/dist/components/sidebar.min.css +2 -2
  129. package/dist/components/sidebar.min.js +2 -2
  130. package/dist/components/site.css +9 -25
  131. package/dist/components/site.js +38 -57
  132. package/dist/components/site.min.css +2 -2
  133. package/dist/components/site.min.js +2 -2
  134. package/dist/components/slider.css +1 -1
  135. package/dist/components/slider.js +246 -329
  136. package/dist/components/slider.min.css +1 -1
  137. package/dist/components/slider.min.js +2 -2
  138. package/dist/components/state.js +70 -100
  139. package/dist/components/state.min.js +2 -2
  140. package/dist/components/statistic.css +1 -1
  141. package/dist/components/statistic.min.css +1 -1
  142. package/dist/components/step.css +1 -1
  143. package/dist/components/step.min.css +1 -1
  144. package/dist/components/sticky.css +1 -1
  145. package/dist/components/sticky.js +135 -180
  146. package/dist/components/sticky.min.css +1 -1
  147. package/dist/components/sticky.min.js +2 -2
  148. package/dist/components/tab.css +1 -1
  149. package/dist/components/tab.js +176 -241
  150. package/dist/components/tab.min.css +1 -1
  151. package/dist/components/tab.min.js +2 -2
  152. package/dist/components/table.css +3 -37
  153. package/dist/components/table.min.css +2 -2
  154. package/dist/components/text.css +1 -1
  155. package/dist/components/text.min.css +1 -1
  156. package/dist/components/toast.css +1 -3
  157. package/dist/components/toast.js +108 -147
  158. package/dist/components/toast.min.css +1 -1
  159. package/dist/components/toast.min.js +2 -2
  160. package/dist/components/transition.css +1 -1
  161. package/dist/components/transition.js +91 -146
  162. package/dist/components/transition.min.css +1 -1
  163. package/dist/components/transition.min.js +2 -2
  164. package/dist/components/visibility.js +146 -224
  165. package/dist/components/visibility.min.js +2 -2
  166. package/dist/semantic.css +3945 -8759
  167. package/dist/semantic.js +4408 -6193
  168. package/dist/semantic.min.css +2 -2
  169. package/dist/semantic.min.js +2 -2
  170. package/examples/assets/show-examples.js +2 -4
  171. package/examples/attached.html +1 -1
  172. package/examples/components/menu.html +1 -1
  173. package/gulpfile.js +5 -7
  174. package/package.json +3 -6
  175. package/scripts/nightly-version.js +7 -10
  176. package/src/README.md +3 -3
  177. package/src/definitions/behaviors/api.js +156 -209
  178. package/src/definitions/behaviors/form.js +334 -443
  179. package/src/definitions/behaviors/state.js +69 -99
  180. package/src/definitions/behaviors/visibility.js +145 -223
  181. package/src/definitions/collections/form.less +1 -13
  182. package/src/definitions/collections/grid.less +1 -61
  183. package/src/definitions/collections/menu.less +101 -107
  184. package/src/definitions/collections/table.less +1 -35
  185. package/src/definitions/elements/input.less +1 -61
  186. package/src/definitions/elements/segment.less +0 -6
  187. package/src/definitions/globals/site.js +37 -56
  188. package/src/definitions/globals/site.less +2 -18
  189. package/src/definitions/modules/accordion.js +102 -141
  190. package/src/definitions/modules/calendar.js +313 -351
  191. package/src/definitions/modules/checkbox.js +84 -134
  192. package/src/definitions/modules/dimmer.js +60 -93
  193. package/src/definitions/modules/dimmer.less +0 -9
  194. package/src/definitions/modules/dropdown.js +753 -1095
  195. package/src/definitions/modules/dropdown.less +31 -47
  196. package/src/definitions/modules/embed.js +83 -113
  197. package/src/definitions/modules/flyout.js +224 -354
  198. package/src/definitions/modules/modal.js +259 -383
  199. package/src/definitions/modules/modal.less +1 -1
  200. package/src/definitions/modules/nag.js +67 -97
  201. package/src/definitions/modules/popup.js +196 -270
  202. package/src/definitions/modules/progress.js +108 -143
  203. package/src/definitions/modules/rating.js +89 -122
  204. package/src/definitions/modules/search.js +275 -378
  205. package/src/definitions/modules/search.less +0 -3
  206. package/src/definitions/modules/shape.js +157 -223
  207. package/src/definitions/modules/sidebar.js +123 -205
  208. package/src/definitions/modules/slider.js +245 -328
  209. package/src/definitions/modules/slider.less +1 -1
  210. package/src/definitions/modules/sticky.js +134 -179
  211. package/src/definitions/modules/tab.js +175 -240
  212. package/src/definitions/modules/toast.js +107 -146
  213. package/src/definitions/modules/toast.less +1 -1
  214. package/src/definitions/modules/transition.js +90 -145
  215. package/src/theme.less +0 -13
  216. package/src/themes/basic/elements/icon.variables +1 -1
  217. package/src/themes/chubby/collections/menu.variables +1 -1
  218. package/src/themes/default/collections/grid.variables +0 -30
  219. package/src/themes/default/collections/menu.variables +23 -23
  220. package/src/themes/default/collections/table.variables +1 -5
  221. package/src/themes/default/elements/icon.variables +3 -3
  222. package/src/themes/default/globals/site.variables +8 -15
  223. package/src/themes/default/globals/variation.variables +3 -3
  224. package/src/themes/default/modules/dropdown.variables +1 -0
  225. package/src/themes/default/modules/slider.variables +1 -1
  226. package/src/themes/github/elements/icon.variables +1 -1
  227. package/src/themes/material/elements/icon.variables +1 -1
  228. package/tasks/README.md +1 -1
  229. package/tasks/admin/components/create.js +89 -122
  230. package/tasks/admin/components/init.js +34 -65
  231. package/tasks/admin/components/update.js +50 -61
  232. package/tasks/admin/distributions/create.js +71 -111
  233. package/tasks/admin/distributions/init.js +32 -63
  234. package/tasks/admin/distributions/update.js +49 -57
  235. package/tasks/admin/publish.js +1 -1
  236. package/tasks/admin/register.js +14 -19
  237. package/tasks/admin/release.js +2 -2
  238. package/tasks/build/assets.js +14 -18
  239. package/tasks/build/css.js +59 -68
  240. package/tasks/build/javascript.js +48 -56
  241. package/tasks/build.js +4 -6
  242. package/tasks/check-install.js +5 -8
  243. package/tasks/clean.js +5 -7
  244. package/tasks/collections/admin.js +14 -16
  245. package/tasks/collections/build.js +6 -8
  246. package/tasks/collections/docs.js +4 -6
  247. package/tasks/collections/install.js +2 -4
  248. package/tasks/collections/rtl.js +2 -4
  249. package/tasks/collections/various.js +2 -4
  250. package/tasks/config/admin/github.js +9 -19
  251. package/tasks/config/admin/templates/README.md +2 -2
  252. package/tasks/config/admin/templates/bower.json +2 -4
  253. package/tasks/config/admin/templates/composer.json +1 -1
  254. package/tasks/config/admin/templates/css-package.js +1 -4
  255. package/tasks/config/admin/templates/less-package.js +1 -3
  256. package/tasks/config/defaults.js +0 -1
  257. package/tasks/config/npm/gulpfile.js +4 -6
  258. package/tasks/config/project/config.js +27 -35
  259. package/tasks/config/project/install.js +64 -82
  260. package/tasks/config/project/release.js +7 -9
  261. package/tasks/config/tasks.js +10 -21
  262. package/tasks/config/user.js +14 -20
  263. package/tasks/docs/build.js +26 -31
  264. package/tasks/docs/metadata.js +30 -39
  265. package/tasks/docs/serve.js +23 -27
  266. package/tasks/install.js +94 -128
  267. package/tasks/rtl/build.js +2 -4
  268. package/tasks/rtl/watch.js +3 -5
  269. package/tasks/watch.js +13 -13
  270. package/test/meteor/fonts.js +1 -2
  271. package/test/modules/module.spec.js +16 -18
  272. package/types/fomantic-ui-calendar.d.ts +1 -1
  273. package/types/fomantic-ui-dropdown.d.ts +45 -1
  274. package/types/fomantic-ui-embed.d.ts +1 -1
  275. package/types/fomantic-ui-flyout.d.ts +1 -1
  276. package/types/fomantic-ui-form.d.ts +0 -7
  277. package/types/fomantic-ui-modal.d.ts +1 -1
  278. package/types/fomantic-ui-search.d.ts +12 -6
  279. package/types/fomantic-ui-toast.d.ts +1 -1
  280. package/src/themes/basic/assets/fonts/icons.woff +0 -0
  281. package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  282. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  283. package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  284. package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  285. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  286. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  287. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  288. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  289. package/src/themes/default/assets/fonts/brand-icons.woff +0 -0
  290. package/src/themes/default/assets/fonts/icons.woff +0 -0
  291. package/src/themes/default/assets/fonts/outline-icons.woff +0 -0
  292. package/src/themes/github/assets/fonts/octicons.woff +0 -0
  293. package/src/themes/material/assets/fonts/icons.woff +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.10.0-beta.2+d30ebd7 - Tab
2
+ * # Fomantic-UI 2.10.0-beta.21+d6168a0 - Tab
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -24,66 +24,62 @@
24
24
  : globalThis;
25
25
 
26
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
- time = Date.now(),
34
- performance = [],
35
-
36
- query = arguments[0],
37
- methodInvoked = typeof query === 'string',
38
- queryArguments = [].slice.call(arguments, 1),
39
- contextCheck = function (context, win) {
40
- var $context;
41
- if ([window, document].indexOf(context) >= 0) {
42
- $context = $(context);
43
- } else {
44
- $context = $(win.document).find(context);
45
- if ($context.length === 0) {
46
- $context = win.frameElement ? contextCheck(context, win.parent) : window;
47
- }
27
+ // use window context if none specified
28
+ let $allModules = isFunction(this)
29
+ ? $(window)
30
+ : $(this);
31
+ let $document = $(document);
32
+ let time = Date.now();
33
+ let performance = [];
34
+
35
+ let query = arguments[0];
36
+ let methodInvoked = typeof query === 'string';
37
+ let queryArguments = [].slice.call(arguments, 1);
38
+ let contextCheck = function (context, win) {
39
+ let $context;
40
+ if ([window, document].indexOf(context) >= 0) {
41
+ $context = $(context);
42
+ } else {
43
+ $context = $(win.document).find(context);
44
+ if ($context.length === 0) {
45
+ $context = win.frameElement ? contextCheck(context, win.parent) : window;
48
46
  }
47
+ }
49
48
 
50
- return $context;
51
- },
52
- initializedHistory = false,
53
- returnedValue
54
- ;
49
+ return $context;
50
+ };
51
+ let initializedHistory = false;
52
+ let returnedValue;
55
53
 
56
54
  $allModules.each(function () {
57
- var
58
- settings = $.isPlainObject(parameters)
59
- ? $.extend(true, {}, $.fn.tab.settings, parameters)
60
- : $.extend({}, $.fn.tab.settings),
55
+ let settings = $.isPlainObject(parameters)
56
+ ? $.extend(true, {}, $.fn.tab.settings, parameters)
57
+ : $.extend({}, $.fn.tab.settings);
61
58
 
62
- className = settings.className,
63
- metadata = settings.metadata,
64
- selector = settings.selector,
65
- error = settings.error,
66
- regExp = settings.regExp,
59
+ let className = settings.className;
60
+ let metadata = settings.metadata;
61
+ let selector = settings.selector;
62
+ let error = settings.error;
63
+ let regExp = settings.regExp;
67
64
 
68
- eventNamespace = '.' + settings.namespace,
69
- moduleNamespace = 'module-' + settings.namespace,
65
+ let eventNamespace = '.' + settings.namespace;
66
+ let moduleNamespace = 'module-' + settings.namespace;
70
67
 
71
- $module = $(this),
72
- $context,
73
- $tabs,
68
+ let $module = $(this);
69
+ let $context;
70
+ let $tabs;
74
71
 
75
- cache = {},
76
- firstLoad = true,
77
- recursionDepth = 0,
78
- element = this,
79
- instance = $module.data(moduleNamespace),
72
+ let cache = {};
73
+ let firstLoad = true;
74
+ let recursionDepth = 0;
75
+ let element = this;
76
+ let instance = $module.data(moduleNamespace);
80
77
 
81
- activeTabPath,
82
- parameterArray,
83
- module,
78
+ let activeTabPath;
79
+ let parameterArray;
80
+ let module;
84
81
 
85
- historyEvent
86
- ;
82
+ let historyEvent;
87
83
 
88
84
  module = {
89
85
 
@@ -103,14 +99,14 @@
103
99
  initializedHistory = true;
104
100
  }
105
101
 
106
- var activeTab = module.determine.activeTab();
102
+ let activeTab = module.determine.activeTab();
107
103
  if (settings.autoTabActivation && instance === undefined && activeTab === null) {
108
104
  activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
109
105
  module.debug('No active tab detected, setting tab active', activeTab);
110
106
  module.changeTab(activeTab);
111
107
  }
112
108
  if (activeTab !== null && settings.history && settings.historyType === 'state') {
113
- var autoUpdate = $.address.autoUpdate();
109
+ let autoUpdate = $.address.autoUpdate();
114
110
  $.address.autoUpdate(false);
115
111
  $.address.value(activeTab);
116
112
  $.address.autoUpdate(autoUpdate);
@@ -123,16 +119,14 @@
123
119
  module.verbose('Storing instance of module', module);
124
120
  instance = module;
125
121
  $module
126
- .data(moduleNamespace, module)
127
- ;
122
+ .data(moduleNamespace, module);
128
123
  },
129
124
 
130
125
  destroy: function () {
131
126
  module.debug('Destroying tabs', $module);
132
127
  $module
133
128
  .removeData(moduleNamespace)
134
- .off(eventNamespace)
135
- ;
129
+ .off(eventNamespace);
136
130
  },
137
131
 
138
132
  bind: {
@@ -141,16 +135,13 @@
141
135
  if (!isWindow(element)) {
142
136
  module.debug('Attaching tab activation events to element', $module);
143
137
  $module
144
- .on('click' + eventNamespace, module.event.click)
145
- ;
138
+ .on('click' + eventNamespace, module.event.click);
146
139
  }
147
140
  },
148
141
  },
149
142
 
150
143
  determineTabs: function () {
151
- var
152
- $reference
153
- ;
144
+ let $reference;
154
145
 
155
146
  // determine tab context
156
147
  if (settings.context === 'parent') {
@@ -190,8 +181,7 @@
190
181
  if (settings.path !== false) {
191
182
  $.address
192
183
  .history(true)
193
- .state(settings.path)
194
- ;
184
+ .state(settings.path);
195
185
  $(window).trigger('popstate');
196
186
  } else {
197
187
  module.error(error.path);
@@ -200,17 +190,14 @@
200
190
  }
201
191
  }
202
192
  $.address
203
- .bind('change', module.event.history.change)
204
- ;
193
+ .bind('change', module.event.history.change);
205
194
 
206
195
  return true;
207
196
  },
208
197
 
209
198
  event: {
210
199
  click: function (event) {
211
- var
212
- tabPath = $(this).data(metadata.tab)
213
- ;
200
+ let tabPath = $(this).data(metadata.tab);
214
201
  if (tabPath !== undefined) {
215
202
  if (settings.history) {
216
203
  module.verbose('Updating page state', event);
@@ -226,10 +213,8 @@
226
213
  },
227
214
  history: {
228
215
  change: function (event) {
229
- var
230
- tabPath = event.pathNames.join('/') || module.get.initialPath(),
231
- pageTitle = settings.templates.determineTitle(tabPath) || false
232
- ;
216
+ let tabPath = event.pathNames.join('/') || module.get.initialPath();
217
+ let pageTitle = settings.templates.determineTitle(tabPath) || false;
233
218
  module.performance.display();
234
219
  module.debug('History change event', tabPath, event);
235
220
  historyEvent = event;
@@ -269,21 +254,11 @@
269
254
  },
270
255
  },
271
256
 
272
- escape: {
273
- string: function (text) {
274
- text = String(text);
275
-
276
- return text.replace(regExp.escape, '\\$&');
277
- },
278
- },
279
-
280
257
  set: {
281
258
  auto: function () {
282
- var
283
- url = typeof settings.path === 'string'
284
- ? settings.path.replace(/\/$/, '') + '/{$tab}'
285
- : '/{$tab}'
286
- ;
259
+ let url = typeof settings.path === 'string'
260
+ ? settings.path.replace(/\/$/, '') + '/{$tab}'
261
+ : '/{$tab}';
287
262
  module.verbose('Setting up automatic tab retrieval from server', url);
288
263
  if ($.isPlainObject(settings.apiSettings)) {
289
264
  settings.apiSettings.url = url;
@@ -294,17 +269,14 @@
294
269
  }
295
270
  },
296
271
  loading: function (tabPath) {
297
- var
298
- $tab = module.get.tabElement(tabPath),
299
- isLoading = $tab.hasClass(className.loading)
300
- ;
272
+ let $tab = module.get.tabElement(tabPath);
273
+ let isLoading = $tab.hasClass(className.loading);
301
274
  if (!isLoading) {
302
275
  module.verbose('Setting loading state for', $tab);
303
276
  $tab
304
277
  .addClass(className.loading)
305
278
  .siblings($tabs)
306
- .removeClass(className.active + ' ' + className.loading)
307
- ;
279
+ .removeClass(className.active + ' ' + className.loading);
308
280
  if ($tab.length > 0) {
309
281
  settings.onRequest.call($tab[0], tabPath);
310
282
  }
@@ -316,30 +288,26 @@
316
288
  },
317
289
 
318
290
  changeTab: function (tabPath) {
319
- var
320
- pushStateAvailable = window.history && window.history.pushState,
321
- shouldIgnoreLoad = pushStateAvailable && settings.ignoreFirstLoad && firstLoad,
322
- remoteContent = settings.auto || $.isPlainObject(settings.apiSettings),
323
- // only add default path if not remote content
324
- pathArray = remoteContent && !shouldIgnoreLoad
325
- ? module.utilities.pathToArray(tabPath)
326
- : module.get.defaultPathArray(tabPath)
327
- ;
291
+ let pushStateAvailable = window.history && window.history.pushState;
292
+ let shouldIgnoreLoad = pushStateAvailable && settings.ignoreFirstLoad && firstLoad;
293
+ let remoteContent = settings.auto || $.isPlainObject(settings.apiSettings);
294
+ // only add the default path if not remote content
295
+ let pathArray = remoteContent && !shouldIgnoreLoad
296
+ ? module.utilities.pathToArray(tabPath)
297
+ : module.get.defaultPathArray(tabPath);
328
298
  tabPath = module.utilities.arrayToPath(pathArray);
329
299
  $.each(pathArray, function (index, tab) {
330
- var
331
- currentPathArray = pathArray.slice(0, index + 1),
332
- currentPath = module.utilities.arrayToPath(currentPathArray),
333
-
334
- isTab = module.is.tab(currentPath),
335
- isLastIndex = index + 1 === pathArray.length,
336
-
337
- $tab = module.get.tabElement(currentPath),
338
- $anchor,
339
- nextPathArray,
340
- nextPath,
341
- isLastTab
342
- ;
300
+ let currentPathArray = pathArray.slice(0, index + 1);
301
+ let currentPath = module.utilities.arrayToPath(currentPathArray);
302
+
303
+ let isTab = module.is.tab(currentPath);
304
+ let isLastIndex = index + 1 === pathArray.length;
305
+
306
+ let $tab = module.get.tabElement(currentPath);
307
+ let $anchor;
308
+ let nextPathArray;
309
+ let nextPath;
310
+ let isLastTab;
343
311
  module.verbose('Looking for tab', tab);
344
312
  if (isTab) {
345
313
  module.verbose('Tab was found', tab);
@@ -388,11 +356,10 @@
388
356
  settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
389
357
  } else if (tabPath.search('/') === -1 && tabPath !== '') {
390
358
  // look for in page anchor
391
- tabPath = module.escape.string(tabPath);
392
- $anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]');
359
+ $anchor = $('#' + CSS.escape(tabPath) + ', a[name="' + CSS.escape(tabPath) + '"]');
393
360
  currentPath = $anchor.closest('[data-tab]').data(metadata.tab);
394
361
  $tab = module.get.tabElement(currentPath);
395
- // if anchor exists use parent tab
362
+ // if anchor exists, use parent tab
396
363
  if ($anchor && $anchor.length > 0 && currentPath) {
397
364
  module.debug('Anchor link used, opening parent tab', $tab, $anchor);
398
365
  if (settings.onBeforeChange.call(element, currentPath) === false) {
@@ -424,11 +391,9 @@
424
391
  },
425
392
 
426
393
  scrollTo: function ($element) {
427
- var
428
- scrollOffset = $element && $element.length > 0
429
- ? $element.offset().top
430
- : false
431
- ;
394
+ let scrollOffset = $element && $element.length > 0
395
+ ? $element.offset().top
396
+ : false;
432
397
  if (scrollOffset !== false) {
433
398
  module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
434
399
  $document.scrollTop(scrollOffset);
@@ -437,18 +402,15 @@
437
402
 
438
403
  update: {
439
404
  content: function (tabPath, html, evaluateScripts) {
440
- var
441
- $tab = module.get.tabElement(tabPath),
442
- tab = $tab[0]
443
- ;
405
+ let $tab = module.get.tabElement(tabPath);
406
+ let tab = $tab[0];
444
407
  evaluateScripts = evaluateScripts !== undefined
445
408
  ? evaluateScripts
446
409
  : settings.evaluateScripts;
447
410
  if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && typeof html !== 'string') {
448
411
  $tab
449
412
  .empty()
450
- .append($(html).clone(true))
451
- ;
413
+ .append($(html).clone(true));
452
414
  } else {
453
415
  if (evaluateScripts) {
454
416
  module.debug('Updating HTML and evaluating inline scripts', tabPath, html);
@@ -464,50 +426,46 @@
464
426
  fetch: {
465
427
 
466
428
  content: function (tabPath, fullTabPath) {
467
- var
468
- $tab = module.get.tabElement(tabPath),
469
- apiSettings = {
470
- dataType: 'html',
471
- encodeParameters: false,
472
- on: 'now',
473
- cache: settings.alwaysRefresh,
474
- onSuccess: function (response) {
475
- if (settings.cacheType === 'response') {
476
- module.cache.add(fullTabPath, response);
477
- }
478
- module.update.content(tabPath, response);
479
- if (tabPath == activeTabPath) {
480
- module.debug('Content loaded', tabPath);
481
- module.activate.tab(tabPath);
482
- } else {
483
- module.debug('Content loaded in background', tabPath);
484
- }
485
- settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
486
- settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
487
-
488
- if (settings.loadOnce) {
489
- module.cache.add(fullTabPath, true);
490
- } else if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && $tab.children().length > 0) {
491
- setTimeout(function () {
492
- var
493
- $clone = $tab.children().clone(true)
494
- ;
495
- $clone = $clone.not('script');
496
- module.cache.add(fullTabPath, $clone);
497
- }, 0);
498
- } else {
499
- module.cache.add(fullTabPath, $tab.html());
500
- }
501
- },
502
- urlData: {
503
- tab: fullTabPath,
504
- },
429
+ let $tab = module.get.tabElement(tabPath);
430
+ let apiSettings = {
431
+ dataType: 'html',
432
+ encodeParameters: false,
433
+ on: 'now',
434
+ cache: settings.alwaysRefresh,
435
+ onSuccess: function (response) {
436
+ if (settings.cacheType === 'response') {
437
+ module.cache.add(fullTabPath, response);
438
+ }
439
+ module.update.content(tabPath, response);
440
+ if (tabPath == activeTabPath) {
441
+ module.debug('Content loaded', tabPath);
442
+ module.activate.tab(tabPath);
443
+ } else {
444
+ module.debug('Content loaded in background', tabPath);
445
+ }
446
+ settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
447
+ settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
448
+
449
+ if (settings.loadOnce) {
450
+ module.cache.add(fullTabPath, true);
451
+ } else if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && $tab.children().length > 0) {
452
+ setTimeout(function () {
453
+ let $clone = $tab.children().clone(true);
454
+ $clone = $clone.not('script');
455
+ module.cache.add(fullTabPath, $clone);
456
+ }, 0);
457
+ } else {
458
+ module.cache.add(fullTabPath, $tab.html());
459
+ }
460
+ },
461
+ urlData: {
462
+ tab: fullTabPath,
505
463
  },
506
- request = $tab.api('get request') || false,
507
- existingRequest = request && request.state() === 'pending',
508
- requestSettings,
509
- cachedContent
510
- ;
464
+ };
465
+ let request = $tab.api('get request') || false;
466
+ let existingRequest = request && request.state() === 'pending';
467
+ let requestSettings;
468
+ let cachedContent;
511
469
 
512
470
  fullTabPath = fullTabPath || tabPath;
513
471
  cachedContent = module.cache.read(fullTabPath);
@@ -543,42 +501,34 @@
543
501
  module.activate.navigation(tabPath);
544
502
  },
545
503
  tab: function (tabPath) {
546
- var
547
- $tab = module.get.tabElement(tabPath),
548
- $deactiveTabs = settings.deactivate === 'siblings'
549
- ? $tab.siblings($tabs)
550
- : $tabs.not($tab),
551
- isActive = $tab.hasClass(className.active)
552
- ;
504
+ let $tab = module.get.tabElement(tabPath);
505
+ let $deactiveTabs = settings.deactivate === 'siblings'
506
+ ? $tab.siblings($tabs)
507
+ : $tabs.not($tab);
508
+ let isActive = $tab.hasClass(className.active);
553
509
  module.verbose('Showing tab content for', $tab);
554
510
  if (!isActive) {
555
511
  $tab
556
- .addClass(className.active)
557
- ;
512
+ .addClass(className.active);
558
513
  $deactiveTabs
559
- .removeClass(className.active + ' ' + className.loading)
560
- ;
514
+ .removeClass(className.active + ' ' + className.loading);
561
515
  if ($tab.length > 0) {
562
516
  settings.onVisible.call($tab[0], tabPath);
563
517
  }
564
518
  }
565
519
  },
566
520
  navigation: function (tabPath) {
567
- var
568
- $navigation = module.get.navElement(tabPath),
569
- $deactiveNavigation = settings.deactivate === 'siblings'
570
- ? $navigation.siblings($allModules)
571
- : $allModules.not($navigation),
572
- isActive = $navigation.hasClass(className.active)
573
- ;
521
+ let $navigation = module.get.navElement(tabPath);
522
+ let $deactiveNavigation = settings.deactivate === 'siblings'
523
+ ? $navigation.siblings($allModules)
524
+ : $allModules.not($navigation);
525
+ let isActive = $navigation.hasClass(className.active);
574
526
  module.verbose('Activating tab navigation for', $navigation, tabPath);
575
527
  if (!isActive) {
576
528
  $navigation
577
- .addClass(className.active)
578
- ;
529
+ .addClass(className.active);
579
530
  $deactiveNavigation
580
- .removeClass(className.active + ' ' + className.loading)
581
- ;
531
+ .removeClass(className.active + ' ' + className.loading);
582
532
  }
583
533
  },
584
534
  },
@@ -590,13 +540,11 @@
590
540
  },
591
541
  navigation: function () {
592
542
  $allModules
593
- .removeClass(className.active)
594
- ;
543
+ .removeClass(className.active);
595
544
  },
596
545
  tabs: function () {
597
546
  $tabs
598
- .removeClass(className.active + ' ' + className.loading)
599
- ;
547
+ .removeClass(className.active + ' ' + className.loading);
600
548
  },
601
549
  },
602
550
 
@@ -615,15 +563,13 @@
615
563
  path: function () {
616
564
  return $.address.value();
617
565
  },
618
- // adds default tabs to tab path
566
+ // adds default tabs to the tab path
619
567
  defaultPathArray: function (tabPath) {
620
568
  return module.utilities.pathToArray(module.get.defaultPath(tabPath));
621
569
  },
622
570
  defaultPath: function (tabPath) {
623
- var
624
- $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + module.escape.string(tabPath) + '/"]').eq(0),
625
- defaultTab = $defaultNav.data(metadata.tab) || false
626
- ;
571
+ let $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + CSS.escape(tabPath) + '/"]').eq(0);
572
+ let defaultTab = $defaultNav.data(metadata.tab) || false;
627
573
  if (defaultTab) {
628
574
  module.debug('Found default tab', defaultTab);
629
575
  if (recursionDepth < settings.maxDepth) {
@@ -642,20 +588,18 @@
642
588
  navElement: function (tabPath) {
643
589
  tabPath = tabPath || activeTabPath;
644
590
 
645
- return $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
591
+ return $allModules.filter('[data-' + metadata.tab + '="' + CSS.escape(tabPath) + '"]');
646
592
  },
647
593
  tabElement: function (tabPath) {
648
- var
649
- $fullPathTab,
650
- $simplePathTab,
651
- tabPathArray,
652
- lastTab
653
- ;
594
+ let $fullPathTab;
595
+ let $simplePathTab;
596
+ let tabPathArray;
597
+ let lastTab;
654
598
  tabPath = tabPath || activeTabPath;
655
599
  tabPathArray = module.utilities.pathToArray(tabPath);
656
600
  lastTab = module.utilities.last(tabPathArray);
657
- $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]');
658
- $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + module.escape.string(lastTab) + '"]');
601
+ $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + CSS.escape(tabPath) + '"]');
602
+ $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + CSS.escape(lastTab) + '"]');
659
603
 
660
604
  return $fullPathTab.length > 0
661
605
  ? $fullPathTab
@@ -668,16 +612,14 @@
668
612
 
669
613
  determine: {
670
614
  activeTab: function () {
671
- var activeTab = null;
615
+ let activeTab = null;
672
616
 
673
617
  $tabs.each(function (_index, tab) {
674
- var $tab = $(tab);
618
+ let $tab = $(tab);
675
619
 
676
620
  if ($tab.hasClass(className.active)) {
677
- var
678
- tabPath = $(this).data(metadata.tab),
679
- $anchor = $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]')
680
- ;
621
+ let tabPath = $(this).data(metadata.tab);
622
+ let $anchor = $allModules.filter('[data-' + metadata.tab + '="' + CSS.escape(tabPath) + '"]');
681
623
 
682
624
  if ($anchor.hasClass(className.active)) {
683
625
  activeTab = tabPath;
@@ -767,11 +709,9 @@
767
709
  },
768
710
  performance: {
769
711
  log: function (message) {
770
- var
771
- currentTime,
772
- executionTime,
773
- previousTime
774
- ;
712
+ let currentTime;
713
+ let executionTime;
714
+ let previousTime;
775
715
  if (settings.performance) {
776
716
  currentTime = Date.now();
777
717
  previousTime = time || currentTime;
@@ -790,10 +730,8 @@
790
730
  }, 500);
791
731
  },
792
732
  display: function () {
793
- var
794
- title = settings.name + ':',
795
- totalTime = 0
796
- ;
733
+ let title = settings.name + ':';
734
+ let totalTime = 0;
797
735
  time = false;
798
736
  clearTimeout(module.performance.timer);
799
737
  $.each(performance, function (index, data) {
@@ -815,22 +753,19 @@
815
753
  },
816
754
  },
817
755
  invoke: function (query, passedArguments, context) {
818
- var
819
- object = instance,
820
- maxDepth,
821
- found,
822
- response
823
- ;
756
+ let object = instance;
757
+ let maxDepth;
758
+ let found;
759
+ let response;
824
760
  passedArguments = passedArguments || queryArguments;
825
761
  context = context || element;
826
762
  if (typeof query === 'string' && object !== undefined) {
827
763
  query = query.split(/[ .]/);
828
764
  maxDepth = query.length - 1;
829
765
  $.each(query, function (depth, value) {
830
- var camelCaseValue = depth !== maxDepth
766
+ let camelCaseValue = depth !== maxDepth
831
767
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
832
- : query
833
- ;
768
+ : query;
834
769
  if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
835
770
  object = object[camelCaseValue];
836
771
  } else if (object[camelCaseValue] !== undefined) {
@@ -899,7 +834,7 @@
899
834
  verbose: false,
900
835
  performance: true,
901
836
 
902
- auto: false, // uses pjax style endpoints fetching content from same url with remote-content headers
837
+ auto: false, // uses pjax style endpoints fetching content from the same url with remote-content headers
903
838
  history: false, // use browser history
904
839
  historyType: 'hash', // #/ or html5 state
905
840
  path: false, // base path of url
@@ -913,21 +848,21 @@
913
848
  alwaysRefresh: false, // load tab content new every tab click
914
849
  cache: true, // cache the content requests to pull locally
915
850
  loadOnce: false, // Whether tab data should only be loaded once when using remote content
916
- cacheType: 'response', // Whether to cache exact response, or to html cache contents after scripts execute
917
- ignoreFirstLoad: false, // don't load remote content on first load
851
+ cacheType: 'response', // Whether to cache exact response, or to HTML cache contents after scripts execute
852
+ ignoreFirstLoad: false, // don't load remote content on the first load
918
853
 
919
854
  apiSettings: false, // settings for api call
920
855
  evaluateScripts: 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
921
- autoTabActivation: true, // whether a non existing active tab will auto activate the first available tab
856
+ autoTabActivation: true, // whether a non-existing active tab will auto activate the first available tab
922
857
 
923
858
  onFirstLoad: function (tabPath, parameterArray, historyEvent) {}, // called first time loaded
924
859
  onLoad: function (tabPath, parameterArray, historyEvent) {}, // called on every load
925
860
  onVisible: function (tabPath, parameterArray, historyEvent) {}, // called every time tab visible
926
- onRequest: function (tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
861
+ onRequest: function (tabPath, parameterArray, historyEvent) {}, // called every time a tab beings loading remote content
927
862
  onBeforeChange: function (tabPath) {}, // called before a tab is about to be changed. Returning false will cancel the tab change
928
863
 
929
864
  templates: {
930
- determineTitle: function (tabArray) {}, // returns page title for path
865
+ determineTitle: function (tabArray) {}, // returns page title for the path
931
866
  },
932
867
 
933
868
  error: {