fomantic-ui 2.10.0-beta.7 → 2.10.0-beta.70

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 (362) hide show
  1. package/.eslintrc.js +6 -33
  2. package/.github/workflows/ci.yml +9 -9
  3. package/.github/workflows/depsreview.yml +1 -1
  4. package/.github/workflows/nightly.yml +7 -5
  5. package/.github/workflows/release.yml +2 -2
  6. package/.stylelintrc.js +1 -15
  7. package/CHANGELOG.md +5289 -2325
  8. package/README.md +11 -8
  9. package/changelog-setup.js +88 -72
  10. package/changelog-template.hbs +256 -251
  11. package/dist/components/accordion.css +1 -1
  12. package/dist/components/accordion.js +116 -164
  13. package/dist/components/accordion.min.css +1 -1
  14. package/dist/components/accordion.min.js +2 -2
  15. package/dist/components/ad.css +1 -1
  16. package/dist/components/ad.min.css +1 -1
  17. package/dist/components/api.js +190 -303
  18. package/dist/components/api.min.js +2 -2
  19. package/dist/components/breadcrumb.css +1 -1
  20. package/dist/components/breadcrumb.min.css +1 -1
  21. package/dist/components/button.css +5 -6
  22. package/dist/components/button.min.css +2 -2
  23. package/dist/components/calendar.css +3 -3
  24. package/dist/components/calendar.js +397 -482
  25. package/dist/components/calendar.min.css +2 -2
  26. package/dist/components/calendar.min.js +2 -2
  27. package/dist/components/card.css +1 -1
  28. package/dist/components/card.min.css +1 -1
  29. package/dist/components/checkbox.css +1 -1
  30. package/dist/components/checkbox.js +105 -166
  31. package/dist/components/checkbox.min.css +1 -1
  32. package/dist/components/checkbox.min.js +2 -2
  33. package/dist/components/comment.css +1 -1
  34. package/dist/components/comment.min.css +1 -1
  35. package/dist/components/container.css +1 -1
  36. package/dist/components/container.min.css +1 -1
  37. package/dist/components/dimmer.css +2 -2
  38. package/dist/components/dimmer.js +75 -121
  39. package/dist/components/dimmer.min.css +2 -2
  40. package/dist/components/dimmer.min.js +2 -2
  41. package/dist/components/divider.css +1 -1
  42. package/dist/components/divider.min.css +1 -1
  43. package/dist/components/dropdown.css +21 -35
  44. package/dist/components/dropdown.js +775 -1161
  45. package/dist/components/dropdown.min.css +2 -2
  46. package/dist/components/dropdown.min.js +2 -2
  47. package/dist/components/embed.css +1 -1
  48. package/dist/components/embed.js +95 -146
  49. package/dist/components/embed.min.css +1 -1
  50. package/dist/components/embed.min.js +2 -2
  51. package/dist/components/emoji.css +3809 -7617
  52. package/dist/components/emoji.min.css +2 -2
  53. package/dist/components/feed.css +1 -1
  54. package/dist/components/feed.min.css +1 -1
  55. package/dist/components/flag.css +1 -1
  56. package/dist/components/flag.min.css +1 -1
  57. package/dist/components/flyout.css +1 -1
  58. package/dist/components/flyout.js +242 -336
  59. package/dist/components/flyout.min.css +1 -1
  60. package/dist/components/flyout.min.js +2 -2
  61. package/dist/components/form.css +3 -5
  62. package/dist/components/form.js +425 -554
  63. package/dist/components/form.min.css +2 -2
  64. package/dist/components/form.min.js +2 -2
  65. package/dist/components/grid.css +2 -2
  66. package/dist/components/grid.min.css +2 -2
  67. package/dist/components/header.css +6 -6
  68. package/dist/components/header.min.css +2 -2
  69. package/dist/components/icon.css +10 -37
  70. package/dist/components/icon.min.css +2 -2
  71. package/dist/components/image.css +1 -1
  72. package/dist/components/image.min.css +1 -1
  73. package/dist/components/input.css +284 -12
  74. package/dist/components/input.min.css +2 -2
  75. package/dist/components/item.css +1 -1
  76. package/dist/components/item.min.css +1 -1
  77. package/dist/components/label.css +6 -14
  78. package/dist/components/label.min.css +2 -2
  79. package/dist/components/list.css +3 -3
  80. package/dist/components/list.min.css +2 -2
  81. package/dist/components/loader.css +53 -53
  82. package/dist/components/loader.min.css +2 -2
  83. package/dist/components/menu.css +45 -60
  84. package/dist/components/menu.min.css +2 -2
  85. package/dist/components/message.css +2 -2
  86. package/dist/components/message.min.css +2 -2
  87. package/dist/components/modal.css +5 -5
  88. package/dist/components/modal.js +274 -369
  89. package/dist/components/modal.min.css +2 -2
  90. package/dist/components/modal.min.js +2 -2
  91. package/dist/components/nag.css +1 -1
  92. package/dist/components/nag.js +109 -153
  93. package/dist/components/nag.min.css +1 -1
  94. package/dist/components/nag.min.js +2 -2
  95. package/dist/components/placeholder.css +2 -2
  96. package/dist/components/placeholder.min.css +2 -2
  97. package/dist/components/popup.css +19 -73
  98. package/dist/components/popup.js +210 -303
  99. package/dist/components/popup.min.css +2 -2
  100. package/dist/components/popup.min.js +2 -2
  101. package/dist/components/progress.css +4 -13
  102. package/dist/components/progress.js +128 -185
  103. package/dist/components/progress.min.css +2 -2
  104. package/dist/components/progress.min.js +2 -2
  105. package/dist/components/rail.css +1 -1
  106. package/dist/components/rail.min.css +1 -1
  107. package/dist/components/rating.css +1 -1
  108. package/dist/components/rating.js +92 -145
  109. package/dist/components/rating.min.css +1 -1
  110. package/dist/components/rating.min.js +2 -2
  111. package/dist/components/reset.css +48 -208
  112. package/dist/components/reset.min.css +2 -2
  113. package/dist/components/reveal.css +2 -5
  114. package/dist/components/reveal.min.css +2 -2
  115. package/dist/components/search.css +2 -3
  116. package/dist/components/search.js +311 -425
  117. package/dist/components/search.min.css +2 -2
  118. package/dist/components/search.min.js +2 -2
  119. package/dist/components/segment.css +6 -6
  120. package/dist/components/segment.min.css +2 -2
  121. package/dist/components/shape.css +1 -1
  122. package/dist/components/shape.js +173 -249
  123. package/dist/components/shape.min.css +1 -1
  124. package/dist/components/shape.min.js +2 -2
  125. package/dist/components/sidebar.css +1 -1
  126. package/dist/components/sidebar.js +138 -199
  127. package/dist/components/sidebar.min.css +1 -1
  128. package/dist/components/sidebar.min.js +2 -2
  129. package/dist/components/site.css +1 -1
  130. package/dist/components/site.js +59 -99
  131. package/dist/components/site.min.css +1 -1
  132. package/dist/components/site.min.js +2 -2
  133. package/dist/components/slider.css +1 -1
  134. package/dist/components/slider.js +267 -364
  135. package/dist/components/slider.min.css +1 -1
  136. package/dist/components/slider.min.js +2 -2
  137. package/dist/components/state.js +88 -132
  138. package/dist/components/state.min.js +2 -2
  139. package/dist/components/statistic.css +1 -1
  140. package/dist/components/statistic.min.css +1 -1
  141. package/dist/components/step.css +4 -4
  142. package/dist/components/step.min.css +2 -2
  143. package/dist/components/sticky.css +1 -1
  144. package/dist/components/sticky.js +163 -228
  145. package/dist/components/sticky.min.css +1 -1
  146. package/dist/components/sticky.min.js +2 -2
  147. package/dist/components/tab.css +1 -1
  148. package/dist/components/tab.js +192 -287
  149. package/dist/components/tab.min.css +1 -1
  150. package/dist/components/tab.min.js +2 -2
  151. package/dist/components/table.css +8 -8
  152. package/dist/components/table.min.css +2 -2
  153. package/dist/components/text.css +1 -1
  154. package/dist/components/text.min.css +1 -1
  155. package/dist/components/toast.css +1 -1
  156. package/dist/components/toast.js +118 -155
  157. package/dist/components/toast.min.css +1 -1
  158. package/dist/components/toast.min.js +2 -2
  159. package/dist/components/transition.css +1 -1
  160. package/dist/components/transition.js +114 -193
  161. package/dist/components/transition.min.css +1 -1
  162. package/dist/components/transition.min.js +2 -2
  163. package/dist/components/visibility.js +175 -271
  164. package/dist/components/visibility.min.js +2 -2
  165. package/dist/semantic.css +4479 -8221
  166. package/dist/semantic.js +5023 -7182
  167. package/dist/semantic.min.css +2 -2
  168. package/dist/semantic.min.js +2 -2
  169. package/examples/assets/show-examples.js +2 -4
  170. package/examples/attached.html +1 -1
  171. package/examples/components/menu.html +1 -1
  172. package/gulpfile.js +5 -7
  173. package/package.json +4 -5
  174. package/scripts/nightly-version.js +11 -14
  175. package/src/definitions/behaviors/api.js +189 -302
  176. package/src/definitions/behaviors/form.js +426 -555
  177. package/src/definitions/behaviors/state.js +87 -131
  178. package/src/definitions/behaviors/visibility.js +174 -270
  179. package/src/definitions/collections/breadcrumb.less +0 -1
  180. package/src/definitions/collections/form.less +3 -9
  181. package/src/definitions/collections/grid.less +1 -2
  182. package/src/definitions/collections/menu.less +106 -117
  183. package/src/definitions/collections/message.less +1 -2
  184. package/src/definitions/collections/table.less +7 -8
  185. package/src/definitions/elements/button.less +4 -6
  186. package/src/definitions/elements/container.less +0 -1
  187. package/src/definitions/elements/divider.less +1 -2
  188. package/src/definitions/elements/emoji.less +1 -1
  189. package/src/definitions/elements/flag.less +1 -1
  190. package/src/definitions/elements/header.less +4 -5
  191. package/src/definitions/elements/icon.less +10 -37
  192. package/src/definitions/elements/image.less +0 -1
  193. package/src/definitions/elements/input.less +4 -7
  194. package/src/definitions/elements/label.less +5 -14
  195. package/src/definitions/elements/list.less +2 -3
  196. package/src/definitions/elements/loader.less +10 -11
  197. package/src/definitions/elements/placeholder.less +1 -2
  198. package/src/definitions/elements/rail.less +0 -1
  199. package/src/definitions/elements/reveal.less +1 -5
  200. package/src/definitions/elements/segment.less +5 -6
  201. package/src/definitions/elements/step.less +3 -4
  202. package/src/definitions/elements/text.less +0 -1
  203. package/src/definitions/globals/reset.less +0 -1
  204. package/src/definitions/globals/site.js +58 -98
  205. package/src/definitions/globals/site.less +0 -1
  206. package/src/definitions/modules/accordion.js +115 -163
  207. package/src/definitions/modules/accordion.less +0 -1
  208. package/src/definitions/modules/calendar.js +396 -481
  209. package/src/definitions/modules/calendar.less +2 -3
  210. package/src/definitions/modules/checkbox.js +104 -165
  211. package/src/definitions/modules/checkbox.less +0 -1
  212. package/src/definitions/modules/dimmer.js +74 -120
  213. package/src/definitions/modules/dimmer.less +1 -2
  214. package/src/definitions/modules/dropdown.js +774 -1160
  215. package/src/definitions/modules/dropdown.less +27 -38
  216. package/src/definitions/modules/embed.js +94 -145
  217. package/src/definitions/modules/embed.less +0 -1
  218. package/src/definitions/modules/flyout.js +241 -335
  219. package/src/definitions/modules/flyout.less +0 -1
  220. package/src/definitions/modules/modal.js +273 -368
  221. package/src/definitions/modules/modal.less +3 -4
  222. package/src/definitions/modules/nag.js +108 -152
  223. package/src/definitions/modules/nag.less +0 -1
  224. package/src/definitions/modules/popup.js +209 -302
  225. package/src/definitions/modules/popup.less +18 -73
  226. package/src/definitions/modules/progress.js +127 -184
  227. package/src/definitions/modules/progress.less +3 -13
  228. package/src/definitions/modules/rating.js +93 -146
  229. package/src/definitions/modules/rating.less +0 -1
  230. package/src/definitions/modules/search.js +312 -426
  231. package/src/definitions/modules/search.less +2 -4
  232. package/src/definitions/modules/shape.js +172 -248
  233. package/src/definitions/modules/shape.less +0 -1
  234. package/src/definitions/modules/sidebar.js +137 -198
  235. package/src/definitions/modules/sidebar.less +0 -1
  236. package/src/definitions/modules/slider.js +266 -363
  237. package/src/definitions/modules/slider.less +0 -1
  238. package/src/definitions/modules/sticky.js +162 -227
  239. package/src/definitions/modules/sticky.less +0 -1
  240. package/src/definitions/modules/tab.js +191 -286
  241. package/src/definitions/modules/tab.less +0 -1
  242. package/src/definitions/modules/toast.js +117 -154
  243. package/src/definitions/modules/toast.less +0 -1
  244. package/src/definitions/modules/transition.js +113 -192
  245. package/src/definitions/modules/transition.less +1 -2
  246. package/src/definitions/views/ad.less +0 -1
  247. package/src/definitions/views/card.less +0 -1
  248. package/src/definitions/views/comment.less +0 -1
  249. package/src/definitions/views/feed.less +0 -1
  250. package/src/definitions/views/item.less +0 -1
  251. package/src/definitions/views/statistic.less +0 -1
  252. package/src/semantic.less +1 -1
  253. package/src/themes/amazon/elements/button.overrides +1 -1
  254. package/src/themes/amazon/elements/button.variables +5 -6
  255. package/src/themes/amazon/globals/site.variables +2 -3
  256. package/src/themes/bookish/elements/header.variables +2 -2
  257. package/src/themes/bootstrap3/elements/button.variables +4 -5
  258. package/src/themes/chubby/collections/menu.variables +1 -1
  259. package/src/themes/chubby/elements/button.overrides +4 -4
  260. package/src/themes/chubby/modules/accordion.overrides +1 -1
  261. package/src/themes/chubby/views/comment.overrides +2 -2
  262. package/src/themes/chubby/views/comment.variables +2 -2
  263. package/src/themes/classic/collections/table.variables +2 -2
  264. package/src/themes/classic/elements/button.variables +11 -11
  265. package/src/themes/classic/modules/progress.variables +2 -2
  266. package/src/themes/classic/views/card.variables +2 -2
  267. package/src/themes/default/collections/form.variables +2 -3
  268. package/src/themes/default/collections/menu.variables +28 -28
  269. package/src/themes/default/collections/message.variables +1 -1
  270. package/src/themes/default/collections/table.variables +4 -4
  271. package/src/themes/default/elements/button.variables +9 -10
  272. package/src/themes/default/elements/divider.variables +1 -1
  273. package/src/themes/default/elements/icon.variables +2 -2
  274. package/src/themes/default/elements/image.variables +1 -1
  275. package/src/themes/default/elements/input.variables +2 -2
  276. package/src/themes/default/elements/label.variables +4 -4
  277. package/src/themes/default/elements/list.variables +1 -1
  278. package/src/themes/default/elements/placeholder.variables +6 -6
  279. package/src/themes/default/elements/segment.variables +8 -8
  280. package/src/themes/default/globals/reset.overrides +45 -201
  281. package/src/themes/default/globals/site.variables +50 -50
  282. package/src/themes/default/globals/variation.variables +3 -2
  283. package/src/themes/default/modules/accordion.variables +0 -1
  284. package/src/themes/default/modules/checkbox.variables +1 -1
  285. package/src/themes/default/modules/dimmer.variables +12 -12
  286. package/src/themes/default/modules/dropdown.variables +17 -16
  287. package/src/themes/default/modules/embed.variables +2 -2
  288. package/src/themes/default/modules/flyout.variables +3 -3
  289. package/src/themes/default/modules/modal.variables +14 -14
  290. package/src/themes/default/modules/nag.variables +1 -1
  291. package/src/themes/default/modules/rating.variables +1 -1
  292. package/src/themes/default/modules/search.variables +1 -1
  293. package/src/themes/default/modules/shape.variables +1 -1
  294. package/src/themes/default/modules/sidebar.variables +2 -2
  295. package/src/themes/default/modules/toast.variables +4 -4
  296. package/src/themes/default/views/card.variables +6 -7
  297. package/src/themes/default/views/feed.variables +4 -4
  298. package/src/themes/default/views/item.variables +2 -3
  299. package/src/themes/flat/collections/form.variables +1 -1
  300. package/src/themes/flat/globals/site.variables +9 -9
  301. package/src/themes/github/collections/form.overrides +3 -3
  302. package/src/themes/github/collections/form.variables +3 -3
  303. package/src/themes/github/collections/menu.overrides +1 -1
  304. package/src/themes/github/collections/menu.variables +10 -10
  305. package/src/themes/github/collections/message.variables +6 -6
  306. package/src/themes/github/elements/button.variables +17 -17
  307. package/src/themes/github/elements/input.variables +3 -3
  308. package/src/themes/github/elements/segment.variables +2 -2
  309. package/src/themes/github/elements/step.overrides +4 -4
  310. package/src/themes/github/elements/step.variables +3 -3
  311. package/src/themes/github/globals/site.variables +2 -2
  312. package/src/themes/github/modules/dropdown.variables +1 -3
  313. package/src/themes/gmail/collections/message.variables +2 -2
  314. package/src/themes/material/collections/menu.variables +1 -1
  315. package/src/themes/material/elements/button.overrides +4 -4
  316. package/src/themes/material/elements/button.variables +5 -5
  317. package/src/themes/material/modules/dropdown.variables +1 -1
  318. package/src/themes/material/modules/modal.variables +1 -1
  319. package/src/themes/raised/elements/button.variables +1 -1
  320. package/src/themes/round/elements/button.variables +12 -12
  321. package/src/themes/striped/modules/progress.overrides +3 -3
  322. package/src/themes/timeline/views/feed.variables +2 -2
  323. package/src/themes/twitter/elements/button.overrides +1 -1
  324. package/src/themes/twitter/elements/button.variables +4 -5
  325. package/tasks/admin/components/create.js +87 -110
  326. package/tasks/admin/components/init.js +26 -33
  327. package/tasks/admin/components/update.js +46 -54
  328. package/tasks/admin/distributions/create.js +74 -125
  329. package/tasks/admin/distributions/init.js +27 -34
  330. package/tasks/admin/distributions/update.js +45 -53
  331. package/tasks/admin/register.js +11 -15
  332. package/tasks/build/assets.js +14 -18
  333. package/tasks/build/css.js +59 -68
  334. package/tasks/build/javascript.js +46 -54
  335. package/tasks/build.js +4 -6
  336. package/tasks/check-install.js +5 -7
  337. package/tasks/clean.js +2 -4
  338. package/tasks/collections/admin.js +13 -15
  339. package/tasks/collections/build.js +6 -8
  340. package/tasks/collections/docs.js +2 -4
  341. package/tasks/collections/install.js +2 -4
  342. package/tasks/collections/rtl.js +2 -4
  343. package/tasks/collections/various.js +2 -4
  344. package/tasks/config/admin/github.js +8 -10
  345. package/tasks/config/admin/templates/css-package.js +1 -3
  346. package/tasks/config/admin/templates/less-package.js +1 -3
  347. package/tasks/config/npm/gulpfile.js +4 -6
  348. package/tasks/config/project/config.js +26 -34
  349. package/tasks/config/project/install.js +58 -72
  350. package/tasks/config/project/release.js +7 -15
  351. package/tasks/config/tasks.js +23 -24
  352. package/tasks/config/user.js +9 -16
  353. package/tasks/docs/build.js +26 -31
  354. package/tasks/docs/metadata.js +35 -43
  355. package/tasks/docs/serve.js +20 -26
  356. package/tasks/install.js +77 -102
  357. package/tasks/rtl/build.js +2 -4
  358. package/tasks/rtl/watch.js +2 -4
  359. package/tasks/watch.js +9 -11
  360. package/test/meteor/assets.js +4 -4
  361. package/test/meteor/fonts.js +11 -13
  362. package/test/modules/module.spec.js +25 -27
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.10.0-beta.7+13b1bae - Flyout
2
+ * # Fomantic-UI 2.10.0-beta.70+88a499a - Flyout
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -19,85 +19,80 @@
19
19
  ? window
20
20
  : globalThis;
21
21
 
22
- $.fn.flyout = function (parameters) {
23
- var
24
- $allModules = $(this),
25
- $window = $(window),
26
- $document = $(document),
27
- $html = $('html'),
28
- $head = $('head'),
29
- $body = $('body'),
30
-
31
- time = Date.now(),
32
- performance = [],
33
-
34
- query = arguments[0],
35
- methodInvoked = typeof query === 'string',
36
- queryArguments = [].slice.call(arguments, 1),
37
- contextCheck = function (context, win) {
38
- var $context;
39
- if ([window, document].indexOf(context) >= 0) {
40
- $context = $body;
41
- } else {
42
- $context = $(win.document).find(context);
43
- if ($context.length === 0) {
44
- $context = win.frameElement ? contextCheck(context, win.parent) : $body;
45
- }
22
+ $.fn.flyout = function (...args) {
23
+ const $allModules = $(this);
24
+ const $window = $(window);
25
+ const $document = $(document);
26
+ const $html = $('html');
27
+ const $head = $('head');
28
+ const $body = $('body');
29
+
30
+ let time = Date.now();
31
+ let performance = [];
32
+
33
+ const parameters = args[0];
34
+ const methodInvoked = typeof parameters === 'string';
35
+ const queryArguments = args.slice(1);
36
+ const contextCheck = function (context, win) {
37
+ let $context;
38
+ if ([window, document].includes(context)) {
39
+ $context = $body;
40
+ } else {
41
+ $context = $(win.document).find(context);
42
+ if ($context.length === 0) {
43
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
46
44
  }
45
+ }
47
46
 
48
- return $context;
49
- },
50
- returnedValue
51
- ;
47
+ return $context;
48
+ };
49
+ let returnedValue;
52
50
 
53
51
  $allModules.each(function () {
54
- var
55
- settings = $.isPlainObject(parameters)
56
- ? $.extend(true, {}, $.fn.flyout.settings, parameters)
57
- : $.extend({}, $.fn.flyout.settings),
58
-
59
- selector = settings.selector,
60
- className = settings.className,
61
- namespace = settings.namespace,
62
- fields = settings.fields,
63
- regExp = settings.regExp,
64
- error = settings.error,
65
-
66
- eventNamespace = '.' + namespace,
67
- moduleNamespace = 'module-' + namespace,
68
-
69
- $module = $(this),
70
- $context = contextCheck(settings.context, window),
71
- $closeIcon = $module.find(selector.close),
72
- $inputs,
73
- $focusedElement,
74
-
75
- $flyouts = $module.children(selector.flyout),
76
- $pusher = $context.children(selector.pusher),
77
- $style,
78
-
79
- isFlyoutComponent = $module.hasClass('flyout'),
80
-
81
- element = this,
82
- instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined,
83
-
84
- ignoreRepeatedEvents = false,
85
- isBody = $context[0] === $body[0],
86
- initialBodyMargin = '',
87
- tempBodyMargin = '',
88
- hadScrollbar = false,
89
- windowRefocused = false,
90
-
91
- elementNamespace,
92
- id,
93
- observer,
94
- observeAttributes = false,
95
- currentScroll,
96
-
97
- module
98
- ;
99
-
100
- module = {
52
+ let settings = $.isPlainObject(parameters)
53
+ ? $.extend(true, {}, $.fn.flyout.settings, parameters)
54
+ : $.extend({}, $.fn.flyout.settings);
55
+
56
+ const selector = settings.selector;
57
+ let className = settings.className;
58
+ let namespace = settings.namespace;
59
+ let fields = settings.fields;
60
+ const regExp = settings.regExp;
61
+ let error = settings.error;
62
+
63
+ const eventNamespace = '.' + namespace;
64
+ const moduleNamespace = 'module-' + namespace;
65
+
66
+ let $module = $(this);
67
+ let $context = contextCheck(settings.context, window);
68
+ let $closeIcon = $module.find(selector.close);
69
+ let $inputs;
70
+ let $focusedElement;
71
+
72
+ let $flyouts = $module.children(selector.flyout);
73
+ let $pusher = $context.children(selector.pusher);
74
+ let $style;
75
+
76
+ const isFlyoutComponent = $module.hasClass('flyout');
77
+
78
+ let element = this;
79
+ let instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined;
80
+
81
+ let ignoreRepeatedEvents = false;
82
+ const isBody = $context[0] === $body[0];
83
+ let initialBodyMargin = '';
84
+ let initialBodyMarginInt = 0;
85
+ let tempBodyMargin = 0;
86
+ let hadScrollbar = false;
87
+ let windowRefocused = false;
88
+
89
+ let elementNamespace;
90
+ let id;
91
+ let observer;
92
+ let observeAttributes = false;
93
+ let currentScroll;
94
+
95
+ const module = {
101
96
 
102
97
  initialize: function () {
103
98
  module.debug('Initializing flyout', parameters);
@@ -123,37 +118,37 @@
123
118
  $module.find(selector.content).html(module.helpers.escape(settings.content, settings)).addClass(settings.classContent);
124
119
  }
125
120
  if (module.has.configActions()) {
126
- var $actions = $module.find(selector.actions).addClass(settings.classActions);
121
+ let $actions = $module.find(selector.actions).addClass(settings.classActions);
127
122
  if ($actions.length === 0) {
128
123
  $actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
129
124
  } else {
130
125
  $actions.empty();
131
126
  }
132
- settings.actions.forEach(function (el) {
133
- var
134
- icon = el[fields.icon]
135
- ? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
136
- : '',
137
- text = module.helpers.escape(el[fields.text] || '', settings),
138
- cls = module.helpers.escape(el[fields.class] || ''),
139
- click = el[fields.click] && isFunction(el[fields.click])
140
- ? el[fields.click]
141
- : function () {}
142
- ;
127
+ for (const el of settings.actions) {
128
+ const icon = el[fields.icon]
129
+ ? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
130
+ : '';
131
+ const text = module.helpers.escape(el[fields.text] || '', settings);
132
+ const cls = module.helpers.escape(el[fields.class] || '');
133
+ const click = el[fields.click] && isFunction(el[fields.click])
134
+ ? el[fields.click]
135
+ : function () {};
136
+ const elementRef = element;
137
+ const $moduleRef = $module;
143
138
  $actions.append($('<button/>', {
144
139
  html: icon + text,
145
140
  'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
146
141
  class: className.button + ' ' + cls,
147
142
  on: {
148
143
  click: function () {
149
- if (click.call(element, $module) === false) {
144
+ if (click.call(elementRef, $moduleRef) === false) {
150
145
  return;
151
146
  }
152
147
  module.hide();
153
148
  },
154
149
  },
155
150
  }));
156
- });
151
+ }
157
152
  }
158
153
 
159
154
  // avoids locking rendering if initialized in onReady
@@ -184,8 +179,7 @@
184
179
  module.verbose('Storing instance of module', module);
185
180
  instance = module;
186
181
  $module
187
- .data(moduleNamespace, instance)
188
- ;
182
+ .data(moduleNamespace, instance);
189
183
  },
190
184
 
191
185
  create: {
@@ -202,12 +196,12 @@
202
196
  $module.append($closeIcon);
203
197
  }
204
198
  if (settings.title !== '') {
205
- var titleId = '_' + module.get.id() + 'title';
199
+ const titleId = '_' + module.get.id() + 'title';
206
200
  $module.attr('aria-labelledby', titleId);
207
201
  $('<div/>', { class: className.header, id: titleId }).appendTo($module);
208
202
  }
209
203
  if (settings.content !== '') {
210
- var descId = '_' + module.get.id() + 'desc';
204
+ const descId = '_' + module.get.id() + 'desc';
211
205
  $module.attr('aria-describedby', descId);
212
206
  $('<div/>', { class: className.content, id: descId }).appendTo($module);
213
207
  }
@@ -231,8 +225,7 @@
231
225
  module.verbose('Destroying previous module for', $module);
232
226
  $module
233
227
  .off(eventNamespace)
234
- .removeData(moduleNamespace)
235
- ;
228
+ .removeData(moduleNamespace);
236
229
  $closeIcon.off(elementNamespace);
237
230
  if ($inputs) {
238
231
  $inputs.off(elementNamespace);
@@ -245,9 +238,7 @@
245
238
 
246
239
  event: {
247
240
  keyboard: function (event) {
248
- var
249
- keyCode = event.which
250
- ;
241
+ const keyCode = event.which;
251
242
  if (keyCode === settings.keys.escape) {
252
243
  if (settings.closable) {
253
244
  module.debug('Escape key pressed hiding flyout');
@@ -272,10 +263,8 @@
272
263
  },
273
264
  clickaway: function (event) {
274
265
  if (settings.closable) {
275
- var
276
- clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target),
277
- clickedContext = $context.is(event.target)
278
- ;
266
+ const clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target);
267
+ const clickedContext = $context.is(event.target);
279
268
  if (clickedInPusher) {
280
269
  module.verbose('User clicked on dimmed page');
281
270
  module.hide();
@@ -290,27 +279,21 @@
290
279
  module.hide();
291
280
  },
292
281
  closeKeyUp: function (event) {
293
- var
294
- keyCode = event.which
295
- ;
282
+ const keyCode = event.which;
296
283
  if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
297
284
  module.hide();
298
285
  }
299
286
  },
300
287
  inputKeyDown: {
301
288
  first: function (event) {
302
- var
303
- keyCode = event.which
304
- ;
289
+ const keyCode = event.which;
305
290
  if (keyCode === settings.keys.tab && event.shiftKey) {
306
291
  $inputs.last().trigger('focus');
307
292
  event.preventDefault();
308
293
  }
309
294
  },
310
295
  last: function (event) {
311
- var
312
- keyCode = event.which
313
- ;
296
+ const keyCode = event.which;
314
297
  if (keyCode === settings.keys.tab && !event.shiftKey) {
315
298
  $inputs.first().trigger('focus');
316
299
  event.preventDefault();
@@ -367,24 +350,19 @@
367
350
  $module
368
351
  .on('click' + eventNamespace, selector.close, module.event.close)
369
352
  .on('click' + eventNamespace, selector.approve, module.event.approve)
370
- .on('click' + eventNamespace, selector.deny, module.event.deny)
371
- ;
353
+ .on('click' + eventNamespace, selector.deny, module.event.deny);
372
354
  $closeIcon
373
- .on('keyup' + elementNamespace, module.event.closeKeyUp)
374
- ;
355
+ .on('keyup' + elementNamespace, module.event.closeKeyUp);
375
356
  $window
376
- .on('focus' + elementNamespace, module.event.focus)
377
- ;
357
+ .on('focus' + elementNamespace, module.event.focus);
378
358
  $context
379
- .on('click' + elementNamespace, module.event.click)
380
- ;
359
+ .on('click' + elementNamespace, module.event.click);
381
360
  },
382
361
  clickaway: function () {
383
362
  module.verbose('Adding clickaway events to context', $context);
384
363
  $context
385
364
  .on('click' + elementNamespace, module.event.clickaway)
386
- .on('touchend' + elementNamespace, module.event.clickaway)
387
- ;
365
+ .on('touchend' + elementNamespace, module.event.clickaway);
388
366
  },
389
367
  scrollLock: function () {
390
368
  if (settings.scrollLock) {
@@ -398,11 +376,9 @@
398
376
  }
399
377
  module.verbose('Adding events to contain flyout scroll');
400
378
  $document
401
- .on('touchmove' + elementNamespace, module.event.touch)
402
- ;
379
+ .on('touchmove' + elementNamespace, module.event.touch);
403
380
  $module
404
- .on('scroll' + eventNamespace, module.event.containScroll)
405
- ;
381
+ .on('scroll' + eventNamespace, module.event.containScroll);
406
382
  },
407
383
  },
408
384
  unbind: {
@@ -423,19 +399,17 @@
423
399
 
424
400
  add: {
425
401
  inlineCSS: function () {
426
- var
427
- width = module.cache.width || $module.outerWidth(),
428
- height = module.cache.height || $module.outerHeight(),
429
- isRTL = module.is.rtl(),
430
- direction = module.get.direction(),
431
- distance = {
432
- left: width,
433
- right: -width,
434
- top: height,
435
- bottom: -height,
436
- },
437
- style
438
- ;
402
+ const width = module.cache.width || $module.outerWidth();
403
+ const height = module.cache.height || $module.outerHeight();
404
+ const isRTL = module.is.rtl();
405
+ const direction = module.get.direction();
406
+ const distance = {
407
+ left: width,
408
+ right: -width,
409
+ top: height,
410
+ bottom: -height,
411
+ };
412
+ let style;
439
413
 
440
414
  if (isRTL) {
441
415
  module.verbose('RTL detected, flipping widths');
@@ -462,65 +436,59 @@
462
436
 
463
437
  style += '</style>';
464
438
  $style = $(style)
465
- .appendTo($head)
466
- ;
439
+ .appendTo($head);
467
440
  module.debug('Adding sizing css to head', $style);
468
441
  },
469
442
  keyboardShortcuts: function () {
470
443
  module.verbose('Adding keyboard shortcuts');
471
444
  $document
472
- .on('keydown' + eventNamespace, module.event.keyboard)
473
- ;
445
+ .on('keydown' + eventNamespace, module.event.keyboard);
474
446
  },
475
447
  },
476
448
  observeChanges: function () {
477
- if ('MutationObserver' in window) {
478
- observer = new MutationObserver(function (mutations) {
479
- var collectNodes = function (parent) {
480
- var nodes = [];
481
- for (var c = 0, cl = parent.length; c < cl; c++) {
482
- Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
483
- nodes.push(parent[c]);
484
- }
449
+ observer = new MutationObserver(function (mutations) {
450
+ const collectNodes = function (parent) {
451
+ const nodes = [];
452
+ for (const c of parent) {
453
+ nodes.push(...collectNodes(c.childNodes), c);
454
+ }
485
455
 
486
- return nodes;
487
- },
488
- shouldRefreshInputs = false,
489
- ignoreAutofocus = true
490
- ;
491
- mutations.every(function (mutation) {
492
- if (mutation.type === 'attributes') {
493
- if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
494
- shouldRefreshInputs = true;
495
- }
496
- } else {
497
- // mutationobserver only provides the parent nodes,
498
- // so let's collect all childs as well to find nested inputs
499
- var $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible'),
500
- $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
501
- if ($addedInputs.length > 0 || $removedInputs.length > 0) {
502
- shouldRefreshInputs = true;
503
- if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
504
- ignoreAutofocus = false;
505
- }
456
+ return nodes;
457
+ };
458
+ let shouldRefreshInputs = false;
459
+ let ignoreAutofocus = true;
460
+ mutations.every(function (mutation) {
461
+ if (mutation.type === 'attributes') {
462
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
463
+ shouldRefreshInputs = true;
464
+ }
465
+ } else {
466
+ // mutationobserver only provides the parent nodes,
467
+ // so let's collect all childs as well to find nested inputs
468
+ const $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
469
+ const $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
470
+ if ($addedInputs.length > 0 || $removedInputs.length > 0) {
471
+ shouldRefreshInputs = true;
472
+ if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
473
+ ignoreAutofocus = false;
506
474
  }
507
475
  }
508
-
509
- return !shouldRefreshInputs;
510
- });
511
-
512
- if (shouldRefreshInputs) {
513
- module.refreshInputs(ignoreAutofocus);
514
476
  }
477
+
478
+ return !shouldRefreshInputs;
515
479
  });
516
- observer.observe(element, {
517
- attributeFilter: ['class', 'disabled'],
518
- attributes: true,
519
- childList: true,
520
- subtree: true,
521
- });
522
- module.debug('Setting up mutation observer', observer);
523
- }
480
+
481
+ if (shouldRefreshInputs) {
482
+ module.refreshInputs(ignoreAutofocus);
483
+ }
484
+ });
485
+ observer.observe(element, {
486
+ attributeFilter: ['class', 'disabled'],
487
+ attributes: true,
488
+ childList: true,
489
+ subtree: true,
490
+ });
491
+ module.debug('Setting up mutation observer', observer);
524
492
  },
525
493
  refresh: function () {
526
494
  module.verbose('Refreshing selector cache');
@@ -538,8 +506,7 @@
538
506
  refreshInputs: function (ignoreAutofocus) {
539
507
  if ($inputs) {
540
508
  $inputs
541
- .off('keydown' + elementNamespace)
542
- ;
509
+ .off('keydown' + elementNamespace);
543
510
  }
544
511
  if (!settings.dimPage) {
545
512
  return;
@@ -554,11 +521,9 @@
554
521
  $module.removeAttr('tabindex');
555
522
  }
556
523
  $inputs.first()
557
- .on('keydown' + elementNamespace, module.event.inputKeyDown.first)
558
- ;
524
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.first);
559
525
  $inputs.last()
560
- .on('keydown' + elementNamespace, module.event.inputKeyDown.last)
561
- ;
526
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.last);
562
527
  if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
563
528
  module.set.autofocus();
564
529
  }
@@ -580,8 +545,7 @@
580
545
  .children()
581
546
  .not(selector.omitted)
582
547
  .not($flyouts)
583
- .wrapAll($pusher)
584
- ;
548
+ .wrapAll($pusher);
585
549
  module.refresh();
586
550
  }
587
551
  if ($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
@@ -599,12 +563,10 @@
599
563
  },
600
564
  heights: function () {
601
565
  module.debug('Setting up heights', $module);
602
- var
603
- $header = $module.children(selector.header),
604
- $content = $module.children(selector.content),
605
- $actions = $module.children(selector.actions),
606
- newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0)
607
- ;
566
+ const $header = $module.children(selector.header);
567
+ const $content = $module.children(selector.content);
568
+ const $actions = $module.children(selector.actions);
569
+ const newContentHeight = ($context.height() || 0) - ($header.outerHeight() || 0) - ($actions.outerHeight() || 0);
608
570
  if (newContentHeight > 0) {
609
571
  $content.css('min-height', String(newContentHeight) + 'px');
610
572
  }
@@ -612,17 +574,14 @@
612
574
  },
613
575
 
614
576
  attachEvents: function (selector, event) {
615
- var
616
- $toggle = $(selector)
617
- ;
577
+ const $toggle = $(selector);
618
578
  event = isFunction(module[event])
619
579
  ? module[event]
620
580
  : module.toggle;
621
581
  if ($toggle.length > 0) {
622
582
  module.debug('Attaching flyout events to element', selector, event);
623
583
  $toggle
624
- .on('click' + eventNamespace, event)
625
- ;
584
+ .on('click' + eventNamespace, event);
626
585
  } else {
627
586
  module.error(error.notFound, selector);
628
587
  }
@@ -700,21 +659,17 @@
700
659
  return module.othersVisible() || module.othersAnimating();
701
660
  },
702
661
 
703
- hideOthers: function (callback) {
704
- var
705
- $otherFlyouts = $flyouts.not($module).filter('.' + className.visible),
706
- flyoutCount = $otherFlyouts.length,
707
- callbackCount = 0
708
- ;
709
- callback = callback || function () {};
662
+ hideOthers: function (callback = function () {}) {
663
+ const $otherFlyouts = $flyouts.not($module).filter('.' + className.visible);
664
+ const flyoutCount = $otherFlyouts.length;
665
+ let callbackCount = 0;
710
666
  $otherFlyouts
711
667
  .flyout('hide', function () {
712
668
  callbackCount++;
713
- if (callbackCount === flyoutCount) {
669
+ if (callbackCount === flyoutCount && isFunction(callback)) {
714
670
  callback();
715
671
  }
716
- })
717
- ;
672
+ });
718
673
  },
719
674
 
720
675
  toggle: function () {
@@ -727,11 +682,6 @@
727
682
  },
728
683
 
729
684
  pushPage: function (callback) {
730
- var
731
- animate,
732
- dim,
733
- transitionEnd
734
- ;
735
685
  callback = isFunction(callback)
736
686
  ? callback
737
687
  : function () {};
@@ -740,16 +690,16 @@
740
690
  currentScroll = (isBody ? $window : $context).scrollTop();
741
691
  }
742
692
  module.bind.scrollLock();
743
- animate = function () {
693
+ const animate = function () {
744
694
  module.bind.clickaway();
745
695
  module.add.inlineCSS();
746
696
  module.set.animating();
747
697
  module.set.visible();
748
698
  };
749
- dim = function () {
699
+ const dim = function () {
750
700
  module.set.dimmed();
751
701
  };
752
- transitionEnd = function (event) {
702
+ const transitionEnd = function (event) {
753
703
  if (event.target === $module[0]) {
754
704
  $module.off('transitionend' + elementNamespace, transitionEnd);
755
705
  module.remove.animating();
@@ -765,10 +715,6 @@
765
715
  },
766
716
 
767
717
  pullPage: function (callback) {
768
- var
769
- animate,
770
- transitionEnd
771
- ;
772
718
  callback = isFunction(callback)
773
719
  ? callback
774
720
  : function () {};
@@ -782,7 +728,7 @@
782
728
  }
783
729
  }
784
730
 
785
- animate = function () {
731
+ const animate = function () {
786
732
  module.set.overlay();
787
733
  module.set.animating();
788
734
  if (settings.dimPage && !module.othersVisible()) {
@@ -790,7 +736,7 @@
790
736
  }
791
737
  module.remove.visible();
792
738
  };
793
- transitionEnd = function (event) {
739
+ const transitionEnd = function (event) {
794
740
  if (event.target === $module[0]) {
795
741
  $module.off('transitionend' + elementNamespace, transitionEnd);
796
742
  module.remove.animating();
@@ -834,16 +780,14 @@
834
780
  observeAttributes = state !== false;
835
781
  },
836
782
  autofocus: function () {
837
- var
838
- $autofocus = $inputs.filter('[autofocus]'),
839
- $rawInputs = $inputs.filter(':input'),
840
- $input = ($autofocus.length > 0
841
- ? $autofocus
842
- : ($rawInputs.length > 0
843
- ? $rawInputs
844
- : $module)
845
- ).first()
846
- ;
783
+ const $autofocus = $inputs.filter('[autofocus]');
784
+ const $rawInputs = $inputs.filter(':input');
785
+ const $input = ($autofocus.length > 0
786
+ ? $autofocus
787
+ : ($rawInputs.length > 0
788
+ ? $rawInputs
789
+ : $module)
790
+ ).first();
847
791
  $input.trigger('focus');
848
792
  },
849
793
  dimmerStyles: function () {
@@ -854,13 +798,11 @@
854
798
  }
855
799
  },
856
800
  bodyMargin: function () {
857
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
801
+ const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
858
802
  $context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
859
803
  $context.find(selector.bodyFixed.replace('right', position)).each(function () {
860
- var
861
- el = $(this),
862
- attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
863
- ;
804
+ const el = $(this);
805
+ const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
864
806
  el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
865
807
  });
866
808
  },
@@ -888,8 +830,7 @@
888
830
  closing: function () {
889
831
  $pusher.addClass(className.closing);
890
832
  },
891
- direction: function (direction) {
892
- direction = direction || module.get.direction();
833
+ direction: function (direction = module.get.direction()) {
893
834
  $module.addClass(className[direction]);
894
835
  },
895
836
  visible: function () {
@@ -910,8 +851,7 @@
910
851
  keyboardShortcuts: function () {
911
852
  module.verbose('Removing keyboard shortcuts');
912
853
  $document
913
- .off('keydown' + eventNamespace)
914
- ;
854
+ .off('keydown' + eventNamespace);
915
855
  },
916
856
 
917
857
  // context
@@ -932,8 +872,7 @@
932
872
  closing: function () {
933
873
  $pusher.removeClass(className.closing);
934
874
  },
935
- direction: function (direction) {
936
- direction = direction || module.get.direction();
875
+ direction: function (direction = module.get.direction()) {
937
876
  $module.removeClass(className[direction]);
938
877
  },
939
878
  visible: function () {
@@ -981,21 +920,17 @@
981
920
 
982
921
  save: {
983
922
  focus: function () {
984
- var
985
- $activeElement = $(document.activeElement),
986
- inCurrentFlyout = $activeElement.closest($module).length > 0
987
- ;
923
+ const $activeElement = $(document.activeElement);
924
+ const inCurrentFlyout = $activeElement.closest($module).length > 0;
988
925
  if (!inCurrentFlyout) {
989
926
  $focusedElement = $(document.activeElement).trigger('blur');
990
927
  }
991
928
  },
992
929
  bodyMargin: function () {
993
930
  initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
994
- var
995
- bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
996
- bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
997
- ;
998
- tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
931
+ initialBodyMarginInt = Number.parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
932
+ const bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
933
+ tempBodyMargin = initialBodyMarginInt + bodyScrollbarWidth;
999
934
  },
1000
935
  },
1001
936
 
@@ -1015,13 +950,11 @@
1015
950
  return module.cache.isFirefox;
1016
951
  },
1017
952
  iframe: function () {
1018
- return !(self === top);
953
+ return !(window.self === window.top);
1019
954
  },
1020
955
  mobile: function () {
1021
- var
1022
- userAgent = navigator.userAgent,
1023
- isMobile = userAgent.match(regExp.mobile)
1024
- ;
956
+ const userAgent = navigator.userAgent;
957
+ const isMobile = userAgent.match(regExp.mobile);
1025
958
  if (isMobile) {
1026
959
  module.verbose('Browser was found to be mobile', userAgent);
1027
960
 
@@ -1066,13 +999,11 @@
1066
999
  }
1067
1000
  },
1068
1001
  bodyMargin: function () {
1069
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
1070
- $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
1002
+ const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
1003
+ $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMarginInt === 0 ? '' : initialBodyMargin);
1071
1004
  $context.find(selector.bodyFixed.replace('right', position)).each(function () {
1072
- var
1073
- el = $(this),
1074
- attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
1075
- ;
1005
+ const el = $(this);
1006
+ const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
1076
1007
  el.css(attribute, '');
1077
1008
  });
1078
1009
  },
@@ -1084,8 +1015,7 @@
1084
1015
  return string;
1085
1016
  }
1086
1017
 
1087
- const badChars = /["'<>]|&(?![\d#A-Za-z]{1,12};)/g;
1088
- const escape = {
1018
+ const escapeMap = {
1089
1019
  '"': '&quot;',
1090
1020
  '&': '&amp;',
1091
1021
  "'": '&apos;',
@@ -1093,7 +1023,7 @@
1093
1023
  '>': '&gt;',
1094
1024
  };
1095
1025
 
1096
- return string.replace(badChars, (chr) => escape[chr]);
1026
+ return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
1097
1027
  },
1098
1028
  },
1099
1029
 
@@ -1120,39 +1050,37 @@
1120
1050
  return module[name];
1121
1051
  }
1122
1052
  },
1123
- debug: function () {
1053
+ debug: function (...args) {
1124
1054
  if (!settings.silent && settings.debug) {
1125
1055
  if (settings.performance) {
1126
- module.performance.log(arguments);
1056
+ module.performance.log(args);
1127
1057
  } else {
1128
1058
  module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1129
- module.debug.apply(console, arguments);
1059
+ module.debug.apply(console, args);
1130
1060
  }
1131
1061
  }
1132
1062
  },
1133
- verbose: function () {
1063
+ verbose: function (...args) {
1134
1064
  if (!settings.silent && settings.verbose && settings.debug) {
1135
1065
  if (settings.performance) {
1136
- module.performance.log(arguments);
1066
+ module.performance.log(args);
1137
1067
  } else {
1138
1068
  module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1139
- module.verbose.apply(console, arguments);
1069
+ module.verbose.apply(console, args);
1140
1070
  }
1141
1071
  }
1142
1072
  },
1143
- error: function () {
1073
+ error: function (...args) {
1144
1074
  if (!settings.silent) {
1145
1075
  module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1146
- module.error.apply(console, arguments);
1076
+ module.error.apply(console, args);
1147
1077
  }
1148
1078
  },
1149
1079
  performance: {
1150
1080
  log: function (message) {
1151
- var
1152
- currentTime,
1153
- executionTime,
1154
- previousTime
1155
- ;
1081
+ let currentTime;
1082
+ let executionTime;
1083
+ let previousTime;
1156
1084
  if (settings.performance) {
1157
1085
  currentTime = Date.now();
1158
1086
  previousTime = time || currentTime;
@@ -1160,7 +1088,7 @@
1160
1088
  time = currentTime;
1161
1089
  performance.push({
1162
1090
  Name: message[0],
1163
- Arguments: [].slice.call(message, 1) || '',
1091
+ Arguments: message.slice(1),
1164
1092
  Element: element,
1165
1093
  'Execution Time': executionTime,
1166
1094
  });
@@ -1171,10 +1099,8 @@
1171
1099
  }, 500);
1172
1100
  },
1173
1101
  display: function () {
1174
- var
1175
- title = settings.name + ':',
1176
- totalTime = 0
1177
- ;
1102
+ let title = settings.name + ':';
1103
+ let totalTime = 0;
1178
1104
  time = false;
1179
1105
  clearTimeout(module.performance.timer);
1180
1106
  $.each(performance, function (index, data) {
@@ -1183,35 +1109,24 @@
1183
1109
  title += ' ' + totalTime + 'ms';
1184
1110
  if (performance.length > 0) {
1185
1111
  console.groupCollapsed(title);
1186
- if (console.table) {
1187
- console.table(performance);
1188
- } else {
1189
- $.each(performance, function (index, data) {
1190
- console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
1191
- });
1192
- }
1112
+ console.table(performance);
1193
1113
  console.groupEnd();
1194
1114
  }
1195
1115
  performance = [];
1196
1116
  },
1197
1117
  },
1198
- invoke: function (query, passedArguments, context) {
1199
- var
1200
- object = instance,
1201
- maxDepth,
1202
- found,
1203
- response
1204
- ;
1205
- passedArguments = passedArguments || queryArguments;
1206
- context = element || context;
1118
+ invoke: function (query, passedArguments = queryArguments, context = element) {
1119
+ let object = instance;
1120
+ let maxDepth;
1121
+ let found;
1122
+ let response;
1207
1123
  if (typeof query === 'string' && object !== undefined) {
1208
1124
  query = query.split(/[ .]/);
1209
1125
  maxDepth = query.length - 1;
1210
1126
  $.each(query, function (depth, value) {
1211
- var camelCaseValue = depth !== maxDepth
1127
+ const camelCaseValue = depth !== maxDepth
1212
1128
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1213
- : query
1214
- ;
1129
+ : query;
1215
1130
  if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
1216
1131
  object = object[camelCaseValue];
1217
1132
  } else if (object[camelCaseValue] !== undefined) {
@@ -1250,10 +1165,10 @@
1250
1165
 
1251
1166
  if (methodInvoked) {
1252
1167
  if (instance === undefined) {
1253
- if (isFunction(settings.templates[query])) {
1168
+ if (isFunction(settings.templates[parameters])) {
1254
1169
  settings.autoShow = true;
1255
1170
  settings.className.flyout = settings.className.template;
1256
- settings = $.extend(true, {}, settings, settings.templates[query].apply(module, queryArguments));
1171
+ settings = $.extend(true, {}, settings, settings.templates[parameters].apply(module, queryArguments));
1257
1172
 
1258
1173
  // reassign shortcuts
1259
1174
  className = settings.className;
@@ -1263,8 +1178,8 @@
1263
1178
  }
1264
1179
  module.initialize();
1265
1180
  }
1266
- if (!isFunction(settings.templates[query])) {
1267
- module.invoke(query);
1181
+ if (!isFunction(settings.templates[parameters])) {
1182
+ module.invoke(parameters);
1268
1183
  }
1269
1184
  } else {
1270
1185
  if (instance !== undefined) {
@@ -1402,8 +1317,7 @@
1402
1317
  };
1403
1318
 
1404
1319
  $.fn.flyout.settings.templates = {
1405
- getArguments: function (args) {
1406
- var queryArguments = [].slice.call(args);
1320
+ getArguments: function (queryArguments) {
1407
1321
  if ($.isPlainObject(queryArguments[0])) {
1408
1322
  return $.extend({
1409
1323
  handler: function () {},
@@ -1421,11 +1335,9 @@
1421
1335
  title: queryArguments.pop() || '',
1422
1336
  };
1423
1337
  },
1424
- alert: function () {
1425
- var
1426
- settings = this.get.settings(),
1427
- args = settings.templates.getArguments(arguments)
1428
- ;
1338
+ alert: function (...args) {
1339
+ const settings = this.get.settings();
1340
+ args = settings.templates.getArguments(args);
1429
1341
 
1430
1342
  return {
1431
1343
  title: args.title,
@@ -1437,11 +1349,9 @@
1437
1349
  }],
1438
1350
  };
1439
1351
  },
1440
- confirm: function () {
1441
- var
1442
- settings = this.get.settings(),
1443
- args = settings.templates.getArguments(arguments)
1444
- ;
1352
+ confirm: function (...args) {
1353
+ const settings = this.get.settings();
1354
+ args = settings.templates.getArguments(args);
1445
1355
 
1446
1356
  return {
1447
1357
  title: args.title,
@@ -1461,13 +1371,11 @@
1461
1371
  }],
1462
1372
  };
1463
1373
  },
1464
- prompt: function () {
1465
- var
1466
- $this = this,
1467
- settings = this.get.settings(),
1468
- args = settings.templates.getArguments(arguments),
1469
- input = $($.parseHTML(args.content)).filter('.ui.input')
1470
- ;
1374
+ prompt: function (...args) {
1375
+ const $this = this;
1376
+ const settings = this.get.settings();
1377
+ args = settings.templates.getArguments(args);
1378
+ const input = $($.parseHTML(args.content)).filter('.ui.input');
1471
1379
  if (input.length === 0) {
1472
1380
  args.content += '<p><div class="' + settings.className.prompt + '"><input placeholder="' + this.helpers.escape(args.placeholder || '') + '" type="text" value="' + this.helpers.escape(args.defaultValue || '') + '"></div></p>';
1473
1381
  }
@@ -1479,10 +1387,8 @@
1479
1387
  text: settings.text.ok,
1480
1388
  class: settings.className.ok,
1481
1389
  click: function () {
1482
- var
1483
- settings = $this.get.settings(),
1484
- inputField = $this.get.element().find(settings.selector.prompt)[0]
1485
- ;
1390
+ const settings = $this.get.settings();
1391
+ const inputField = $this.get.element().find(settings.selector.prompt)[0];
1486
1392
  args.handler($(inputField).val());
1487
1393
  },
1488
1394
  }, {