fomantic-ui 2.10.0-beta.8 → 2.10.0-beta.80

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 (345) hide show
  1. package/.eslintrc.js +6 -23
  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 +8 -4
  9. package/changelog-setup.js +32 -10
  10. package/changelog-template.hbs +256 -251
  11. package/dist/components/accordion.css +1 -1
  12. package/dist/components/accordion.js +62 -73
  13. package/dist/components/accordion.min.css +1 -1
  14. package/dist/components/accordion.min.js +3 -3
  15. package/dist/components/ad.css +1 -1
  16. package/dist/components/ad.min.css +1 -1
  17. package/dist/components/api.js +101 -161
  18. package/dist/components/api.min.js +3 -3
  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 +283 -332
  25. package/dist/components/calendar.min.css +2 -2
  26. package/dist/components/calendar.min.js +3 -3
  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 +58 -79
  31. package/dist/components/checkbox.min.css +1 -1
  32. package/dist/components/checkbox.min.js +3 -3
  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 +39 -52
  39. package/dist/components/dimmer.min.css +2 -2
  40. package/dist/components/dimmer.min.js +3 -3
  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 +435 -531
  45. package/dist/components/dropdown.min.css +2 -2
  46. package/dist/components/dropdown.min.js +3 -3
  47. package/dist/components/embed.css +1 -1
  48. package/dist/components/embed.js +55 -68
  49. package/dist/components/embed.min.css +1 -1
  50. package/dist/components/embed.min.js +3 -3
  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 +149 -168
  59. package/dist/components/flyout.min.css +1 -1
  60. package/dist/components/flyout.min.js +3 -3
  61. package/dist/components/form.css +3 -5
  62. package/dist/components/form.js +244 -269
  63. package/dist/components/form.min.css +2 -2
  64. package/dist/components/form.min.js +3 -3
  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 +161 -170
  89. package/dist/components/modal.min.css +2 -2
  90. package/dist/components/modal.min.js +3 -3
  91. package/dist/components/nag.css +1 -1
  92. package/dist/components/nag.js +74 -88
  93. package/dist/components/nag.min.css +1 -1
  94. package/dist/components/nag.min.js +3 -3
  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 +105 -138
  99. package/dist/components/popup.min.css +2 -2
  100. package/dist/components/popup.min.js +3 -3
  101. package/dist/components/progress.css +4 -13
  102. package/dist/components/progress.js +75 -97
  103. package/dist/components/progress.min.css +2 -2
  104. package/dist/components/progress.min.js +3 -3
  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 +49 -61
  109. package/dist/components/rating.min.css +1 -1
  110. package/dist/components/rating.min.js +3 -3
  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 +178 -198
  117. package/dist/components/search.min.css +2 -2
  118. package/dist/components/search.min.js +3 -3
  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 +59 -69
  123. package/dist/components/shape.min.css +1 -1
  124. package/dist/components/shape.min.js +3 -3
  125. package/dist/components/sidebar.css +1 -1
  126. package/dist/components/sidebar.js +81 -101
  127. package/dist/components/sidebar.min.css +1 -1
  128. package/dist/components/sidebar.min.js +3 -3
  129. package/dist/components/site.css +1 -1
  130. package/dist/components/site.js +37 -58
  131. package/dist/components/site.min.css +1 -1
  132. package/dist/components/site.min.js +3 -3
  133. package/dist/components/slider.css +1 -1
  134. package/dist/components/slider.js +169 -183
  135. package/dist/components/slider.min.css +1 -1
  136. package/dist/components/slider.min.js +3 -3
  137. package/dist/components/state.js +45 -59
  138. package/dist/components/state.min.js +3 -3
  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 +95 -117
  145. package/dist/components/sticky.min.css +1 -1
  146. package/dist/components/sticky.min.js +3 -3
  147. package/dist/components/tab.css +1 -1
  148. package/dist/components/tab.js +83 -115
  149. package/dist/components/tab.min.css +1 -1
  150. package/dist/components/tab.min.js +3 -3
  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 +64 -74
  157. package/dist/components/toast.min.css +1 -1
  158. package/dist/components/toast.min.js +3 -3
  159. package/dist/components/transition.css +1 -1
  160. package/dist/components/transition.js +61 -85
  161. package/dist/components/transition.min.css +1 -1
  162. package/dist/components/transition.min.js +3 -3
  163. package/dist/components/visibility.js +120 -140
  164. package/dist/components/visibility.min.js +3 -3
  165. package/dist/semantic.css +4480 -8222
  166. package/dist/semantic.js +2881 -3485
  167. package/dist/semantic.min.css +3 -3
  168. package/dist/semantic.min.js +3 -3
  169. package/examples/attached.html +1 -1
  170. package/examples/components/menu.html +1 -1
  171. package/package.json +8 -5
  172. package/scripts/nightly-version.js +4 -4
  173. package/src/definitions/behaviors/api.js +100 -160
  174. package/src/definitions/behaviors/form.js +243 -268
  175. package/src/definitions/behaviors/state.js +44 -58
  176. package/src/definitions/behaviors/visibility.js +119 -139
  177. package/src/definitions/collections/breadcrumb.less +0 -1
  178. package/src/definitions/collections/form.less +3 -9
  179. package/src/definitions/collections/grid.less +1 -2
  180. package/src/definitions/collections/menu.less +106 -117
  181. package/src/definitions/collections/message.less +1 -2
  182. package/src/definitions/collections/table.less +7 -8
  183. package/src/definitions/elements/button.less +4 -6
  184. package/src/definitions/elements/container.less +0 -1
  185. package/src/definitions/elements/divider.less +1 -2
  186. package/src/definitions/elements/emoji.less +1 -1
  187. package/src/definitions/elements/flag.less +1 -1
  188. package/src/definitions/elements/header.less +4 -5
  189. package/src/definitions/elements/icon.less +10 -37
  190. package/src/definitions/elements/image.less +0 -1
  191. package/src/definitions/elements/input.less +4 -7
  192. package/src/definitions/elements/label.less +5 -14
  193. package/src/definitions/elements/list.less +2 -3
  194. package/src/definitions/elements/loader.less +10 -11
  195. package/src/definitions/elements/placeholder.less +1 -2
  196. package/src/definitions/elements/rail.less +0 -1
  197. package/src/definitions/elements/reveal.less +1 -5
  198. package/src/definitions/elements/segment.less +5 -6
  199. package/src/definitions/elements/step.less +3 -4
  200. package/src/definitions/elements/text.less +0 -1
  201. package/src/definitions/globals/reset.less +0 -1
  202. package/src/definitions/globals/site.js +36 -57
  203. package/src/definitions/globals/site.less +0 -1
  204. package/src/definitions/modules/accordion.js +61 -72
  205. package/src/definitions/modules/accordion.less +0 -1
  206. package/src/definitions/modules/calendar.js +282 -331
  207. package/src/definitions/modules/calendar.less +2 -3
  208. package/src/definitions/modules/checkbox.js +57 -78
  209. package/src/definitions/modules/checkbox.less +0 -1
  210. package/src/definitions/modules/dimmer.js +38 -51
  211. package/src/definitions/modules/dimmer.less +1 -2
  212. package/src/definitions/modules/dropdown.js +434 -530
  213. package/src/definitions/modules/dropdown.less +27 -38
  214. package/src/definitions/modules/embed.js +54 -67
  215. package/src/definitions/modules/embed.less +0 -1
  216. package/src/definitions/modules/flyout.js +148 -167
  217. package/src/definitions/modules/flyout.less +0 -1
  218. package/src/definitions/modules/modal.js +160 -169
  219. package/src/definitions/modules/modal.less +3 -4
  220. package/src/definitions/modules/nag.js +73 -87
  221. package/src/definitions/modules/nag.less +0 -1
  222. package/src/definitions/modules/popup.js +104 -137
  223. package/src/definitions/modules/popup.less +18 -73
  224. package/src/definitions/modules/progress.js +74 -96
  225. package/src/definitions/modules/progress.less +3 -13
  226. package/src/definitions/modules/rating.js +48 -60
  227. package/src/definitions/modules/rating.less +0 -1
  228. package/src/definitions/modules/search.js +177 -197
  229. package/src/definitions/modules/search.less +2 -4
  230. package/src/definitions/modules/shape.js +58 -68
  231. package/src/definitions/modules/shape.less +0 -1
  232. package/src/definitions/modules/sidebar.js +80 -100
  233. package/src/definitions/modules/sidebar.less +0 -1
  234. package/src/definitions/modules/slider.js +168 -182
  235. package/src/definitions/modules/slider.less +0 -1
  236. package/src/definitions/modules/sticky.js +94 -116
  237. package/src/definitions/modules/sticky.less +0 -1
  238. package/src/definitions/modules/tab.js +82 -114
  239. package/src/definitions/modules/tab.less +0 -1
  240. package/src/definitions/modules/toast.js +63 -73
  241. package/src/definitions/modules/toast.less +0 -1
  242. package/src/definitions/modules/transition.js +60 -84
  243. package/src/definitions/modules/transition.less +1 -2
  244. package/src/definitions/views/ad.less +0 -1
  245. package/src/definitions/views/card.less +0 -1
  246. package/src/definitions/views/comment.less +0 -1
  247. package/src/definitions/views/feed.less +0 -1
  248. package/src/definitions/views/item.less +0 -1
  249. package/src/definitions/views/statistic.less +0 -1
  250. package/src/semantic.less +1 -1
  251. package/src/themes/amazon/elements/button.overrides +1 -1
  252. package/src/themes/amazon/elements/button.variables +5 -6
  253. package/src/themes/amazon/globals/site.variables +2 -3
  254. package/src/themes/bookish/elements/header.variables +2 -2
  255. package/src/themes/bootstrap3/elements/button.variables +4 -5
  256. package/src/themes/chubby/collections/menu.variables +1 -1
  257. package/src/themes/chubby/elements/button.overrides +4 -4
  258. package/src/themes/chubby/modules/accordion.overrides +1 -1
  259. package/src/themes/chubby/views/comment.overrides +2 -2
  260. package/src/themes/chubby/views/comment.variables +2 -2
  261. package/src/themes/classic/collections/table.variables +2 -2
  262. package/src/themes/classic/elements/button.variables +11 -11
  263. package/src/themes/classic/modules/progress.variables +2 -2
  264. package/src/themes/classic/views/card.variables +2 -2
  265. package/src/themes/default/collections/form.variables +2 -3
  266. package/src/themes/default/collections/menu.variables +28 -28
  267. package/src/themes/default/collections/message.variables +1 -1
  268. package/src/themes/default/collections/table.variables +4 -4
  269. package/src/themes/default/elements/button.variables +9 -10
  270. package/src/themes/default/elements/divider.variables +1 -1
  271. package/src/themes/default/elements/icon.variables +2 -2
  272. package/src/themes/default/elements/image.variables +1 -1
  273. package/src/themes/default/elements/input.variables +2 -2
  274. package/src/themes/default/elements/label.variables +4 -4
  275. package/src/themes/default/elements/list.variables +1 -1
  276. package/src/themes/default/elements/placeholder.variables +6 -6
  277. package/src/themes/default/elements/segment.variables +8 -8
  278. package/src/themes/default/globals/reset.overrides +45 -201
  279. package/src/themes/default/globals/site.variables +50 -50
  280. package/src/themes/default/globals/variation.variables +3 -2
  281. package/src/themes/default/modules/accordion.variables +0 -1
  282. package/src/themes/default/modules/checkbox.variables +1 -1
  283. package/src/themes/default/modules/dimmer.variables +12 -12
  284. package/src/themes/default/modules/dropdown.variables +17 -16
  285. package/src/themes/default/modules/embed.variables +2 -2
  286. package/src/themes/default/modules/flyout.variables +3 -3
  287. package/src/themes/default/modules/modal.variables +14 -14
  288. package/src/themes/default/modules/nag.variables +1 -1
  289. package/src/themes/default/modules/rating.variables +1 -1
  290. package/src/themes/default/modules/search.variables +1 -1
  291. package/src/themes/default/modules/shape.variables +1 -1
  292. package/src/themes/default/modules/sidebar.variables +2 -2
  293. package/src/themes/default/modules/toast.variables +4 -4
  294. package/src/themes/default/views/card.variables +6 -7
  295. package/src/themes/default/views/feed.variables +4 -4
  296. package/src/themes/default/views/item.variables +2 -3
  297. package/src/themes/flat/collections/form.variables +1 -1
  298. package/src/themes/flat/globals/site.variables +9 -9
  299. package/src/themes/github/collections/form.overrides +3 -3
  300. package/src/themes/github/collections/form.variables +3 -3
  301. package/src/themes/github/collections/menu.overrides +1 -1
  302. package/src/themes/github/collections/menu.variables +10 -10
  303. package/src/themes/github/collections/message.variables +6 -6
  304. package/src/themes/github/elements/button.variables +17 -17
  305. package/src/themes/github/elements/input.variables +3 -3
  306. package/src/themes/github/elements/segment.variables +2 -2
  307. package/src/themes/github/elements/step.overrides +4 -4
  308. package/src/themes/github/elements/step.variables +3 -3
  309. package/src/themes/github/globals/site.variables +2 -2
  310. package/src/themes/github/modules/dropdown.variables +1 -3
  311. package/src/themes/gmail/collections/message.variables +2 -2
  312. package/src/themes/material/collections/menu.variables +1 -1
  313. package/src/themes/material/elements/button.overrides +4 -4
  314. package/src/themes/material/elements/button.variables +5 -5
  315. package/src/themes/material/modules/dropdown.variables +1 -1
  316. package/src/themes/material/modules/modal.variables +1 -1
  317. package/src/themes/raised/elements/button.variables +1 -1
  318. package/src/themes/round/elements/button.variables +12 -12
  319. package/src/themes/striped/modules/progress.overrides +3 -3
  320. package/src/themes/timeline/views/feed.variables +2 -2
  321. package/src/themes/twitter/elements/button.overrides +1 -1
  322. package/src/themes/twitter/elements/button.variables +4 -5
  323. package/tasks/admin/components/create.js +12 -15
  324. package/tasks/admin/components/init.js +11 -12
  325. package/tasks/admin/components/update.js +19 -20
  326. package/tasks/admin/distributions/create.js +30 -51
  327. package/tasks/admin/distributions/init.js +11 -12
  328. package/tasks/admin/distributions/update.js +18 -19
  329. package/tasks/admin/register.js +7 -7
  330. package/tasks/build/assets.js +1 -1
  331. package/tasks/build/css.js +5 -5
  332. package/tasks/build/javascript.js +1 -1
  333. package/tasks/config/admin/github.js +1 -1
  334. package/tasks/config/admin/templates/css-package.js +1 -1
  335. package/tasks/config/admin/templates/less-package.js +1 -1
  336. package/tasks/config/project/config.js +10 -10
  337. package/tasks/config/project/install.js +12 -12
  338. package/tasks/config/project/release.js +6 -12
  339. package/tasks/config/tasks.js +15 -11
  340. package/tasks/config/user.js +1 -4
  341. package/tasks/docs/metadata.js +18 -20
  342. package/tasks/install.js +14 -12
  343. package/test/meteor/assets.js +4 -4
  344. package/test/meteor/fonts.js +10 -11
  345. package/test/modules/module.spec.js +18 -18
@@ -19,21 +19,23 @@
19
19
  ? window
20
20
  : globalThis;
21
21
 
22
- $.fn.modal = function (parameters) {
23
- let $allModules = $(this);
24
- let $window = $(window);
25
- let $document = $(document);
26
- let $body = $('body');
22
+ $.fn.modal = function (...args) {
23
+ const $window = $(window);
24
+ const $document = $(document);
25
+ const $body = $('body');
26
+ const $allModules = isFunction(this)
27
+ ? $body
28
+ : $(this);
27
29
 
28
30
  let time = Date.now();
29
31
  let performance = [];
30
32
 
31
- let query = arguments[0];
32
- let methodInvoked = typeof query === 'string';
33
- let queryArguments = [].slice.call(arguments, 1);
34
- let contextCheck = function (context, win) {
33
+ const parameters = args[0];
34
+ const methodInvoked = typeof parameters === 'string';
35
+ const queryArguments = args.slice(1);
36
+ const contextCheck = function (context, win) {
35
37
  let $context;
36
- if ([window, document].indexOf(context) >= 0) {
38
+ if ([window, document].includes(context)) {
37
39
  $context = $body;
38
40
  } else {
39
41
  $context = $(win.document).find(context);
@@ -51,18 +53,18 @@
51
53
  ? $.extend(true, {}, $.fn.modal.settings, parameters)
52
54
  : $.extend({}, $.fn.modal.settings);
53
55
 
54
- let selector = settings.selector;
56
+ const selector = settings.selector;
55
57
  let className = settings.className;
56
58
  let namespace = settings.namespace;
57
59
  let fields = settings.fields;
58
60
  let error = settings.error;
59
61
 
60
- let eventNamespace = '.' + namespace;
61
- let moduleNamespace = 'module-' + namespace;
62
+ const eventNamespace = '.' + namespace;
63
+ const moduleNamespace = 'module-' + namespace;
62
64
 
63
65
  let $module = $(this);
64
- let $context = contextCheck(settings.context, window);
65
- let isBody = $context[0] === $body[0];
66
+ const $context = contextCheck(settings.context, window);
67
+ const isBody = $context[0] === $body[0];
66
68
  let $closeIcon = $module.find(selector.closeIcon);
67
69
  let $inputs;
68
70
 
@@ -72,7 +74,7 @@
72
74
  let $dimmable;
73
75
  let $dimmer;
74
76
 
75
- let isModalComponent = $module.hasClass('modal');
77
+ const isModalComponent = $module.hasClass('modal');
76
78
 
77
79
  let element = this;
78
80
  let instance = isModalComponent ? $module.data(moduleNamespace) : undefined;
@@ -82,7 +84,8 @@
82
84
  let initialMouseDownInModal;
83
85
  let initialMouseDownInScrollbar;
84
86
  let initialBodyMargin = '';
85
- let tempBodyMargin = '';
87
+ let initialBodyMarginInt = 0;
88
+ let tempBodyMargin = 0;
86
89
  let keepScrollingClass = false;
87
90
  let hadScrollbar = false;
88
91
  let windowRefocused = false;
@@ -91,8 +94,7 @@
91
94
  let id;
92
95
  let observer;
93
96
  let observeAttributes = false;
94
- let module;
95
- module = {
97
+ const module = {
96
98
 
97
99
  initialize: function () {
98
100
  module.create.id();
@@ -119,30 +121,32 @@
119
121
  } else {
120
122
  $actions.empty();
121
123
  }
122
- settings.actions.forEach(function (el) {
123
- let icon = el[fields.icon]
124
+ for (const el of settings.actions) {
125
+ const icon = el[fields.icon]
124
126
  ? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
125
127
  : '';
126
- let text = module.helpers.escape(el[fields.text] || '', settings);
127
- let cls = module.helpers.escape(el[fields.class] || '');
128
- let click = el[fields.click] && isFunction(el[fields.click])
128
+ const text = module.helpers.escape(el[fields.text] || '', settings);
129
+ const cls = module.helpers.escape(el[fields.class] || '');
130
+ const click = el[fields.click] && isFunction(el[fields.click])
129
131
  ? el[fields.click]
130
132
  : function () {};
133
+ const elementRef = element;
134
+ const $moduleRef = $module;
131
135
  $actions.append($('<button/>', {
132
136
  html: icon + text,
133
137
  'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
134
138
  class: className.button + ' ' + cls,
135
139
  on: {
136
140
  click: function () {
137
- let button = $(this);
138
- if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
141
+ const button = $(this);
142
+ if (button.is(selector.approve) || button.is(selector.deny) || click.call(elementRef, $moduleRef) === false) {
139
143
  return;
140
144
  }
141
145
  module.hide();
142
146
  },
143
147
  },
144
148
  }));
145
- });
149
+ }
146
150
  }
147
151
  module.cache = {};
148
152
  module.verbose('Initializing dimmer', $context);
@@ -184,12 +188,12 @@
184
188
  $module.append($closeIcon);
185
189
  }
186
190
  if (settings.title !== '') {
187
- let titleId = '_' + module.get.id() + 'title';
191
+ const titleId = '_' + module.get.id() + 'title';
188
192
  $module.attr('aria-labelledby', titleId);
189
193
  $('<div/>', { class: className.title, id: titleId }).appendTo($module);
190
194
  }
191
195
  if (settings.content !== '') {
192
- let descId = '_' + module.get.id() + 'desc';
196
+ const descId = '_' + module.get.id() + 'desc';
193
197
  $module.attr('aria-describedby', descId);
194
198
  $('<div/>', { class: className.content, id: descId }).appendTo($module);
195
199
  }
@@ -200,11 +204,11 @@
200
204
  element = $module[0];
201
205
  },
202
206
  dimmer: function () {
203
- let defaultSettings = {
207
+ const defaultSettings = {
204
208
  debug: settings.debug,
205
209
  dimmerName: 'modals',
206
210
  };
207
- let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
211
+ const dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
208
212
  if ($.fn.dimmer === undefined) {
209
213
  module.error(error.dimmer);
210
214
 
@@ -252,58 +256,55 @@
252
256
  },
253
257
 
254
258
  observeChanges: function () {
255
- if ('MutationObserver' in window) {
256
- observer = new MutationObserver(function (mutations) {
257
- let collectNodes = function (parent) {
258
- let nodes = [];
259
- for (let c = 0, cl = parent.length; c < cl; c++) {
260
- Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
261
- nodes.push(parent[c]);
262
- }
259
+ observer = new MutationObserver(function (mutations) {
260
+ const collectNodes = function (parent) {
261
+ const nodes = [];
262
+ for (const c of parent) {
263
+ nodes.push(...collectNodes(c.childNodes), c);
264
+ }
263
265
 
264
- return nodes;
265
- };
266
- let shouldRefresh = false;
267
- let shouldRefreshInputs = false;
268
- let ignoreAutofocus = true;
269
- mutations.every(function (mutation) {
270
- if (mutation.type === 'attributes') {
271
- if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
272
- shouldRefreshInputs = true;
273
- }
274
- } else {
275
- shouldRefresh = true;
276
- // mutationobserver only provides the parent nodes,
277
- // so let's collect all childs as well to find nested inputs
278
- let $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
279
- let $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
280
- if ($addedInputs.length > 0 || $removedInputs.length > 0) {
281
- shouldRefreshInputs = true;
282
- if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
283
- ignoreAutofocus = false;
284
- }
266
+ return nodes;
267
+ };
268
+ let shouldRefresh = false;
269
+ let shouldRefreshInputs = false;
270
+ let ignoreAutofocus = true;
271
+ mutations.every(function (mutation) {
272
+ if (mutation.type === 'attributes') {
273
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
274
+ shouldRefreshInputs = true;
275
+ }
276
+ } else {
277
+ shouldRefresh = true;
278
+ // mutationobserver only provides the parent nodes,
279
+ // so let's collect all childs as well to find nested inputs
280
+ const $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
281
+ const $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
282
+ if ($addedInputs.length > 0 || $removedInputs.length > 0) {
283
+ shouldRefreshInputs = true;
284
+ if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
285
+ ignoreAutofocus = false;
285
286
  }
286
287
  }
287
-
288
- return !shouldRefreshInputs;
289
- });
290
-
291
- if (shouldRefresh && settings.observeChanges) {
292
- module.debug('DOM tree modified, refreshing');
293
- module.refresh();
294
288
  }
295
- if (shouldRefreshInputs) {
296
- module.refreshInputs(ignoreAutofocus);
297
- }
298
- });
299
- observer.observe(element, {
300
- attributeFilter: ['class', 'disabled'],
301
- attributes: true,
302
- childList: true,
303
- subtree: true,
289
+
290
+ return !shouldRefreshInputs;
304
291
  });
305
- module.debug('Setting up mutation observer', observer);
306
- }
292
+
293
+ if (shouldRefresh && settings.observeChanges) {
294
+ module.debug('DOM tree modified, refreshing');
295
+ module.refresh();
296
+ }
297
+ if (shouldRefreshInputs) {
298
+ module.refreshInputs(ignoreAutofocus);
299
+ }
300
+ });
301
+ observer.observe(element, {
302
+ attributeFilter: ['class', 'disabled'],
303
+ attributes: true,
304
+ childList: true,
305
+ subtree: true,
306
+ });
307
+ module.debug('Setting up mutation observer', observer);
307
308
  },
308
309
 
309
310
  refresh: function () {
@@ -345,7 +346,7 @@
345
346
  },
346
347
 
347
348
  attachEvents: function (selector, event) {
348
- let $toggle = $(selector);
349
+ const $toggle = $(selector);
349
350
  event = isFunction(module[event])
350
351
  ? module[event]
351
352
  : module.toggle;
@@ -411,7 +412,7 @@
411
412
  });
412
413
  },
413
414
  preventScroll: function (event) {
414
- if (event.target.className.indexOf('dimmer') !== -1) {
415
+ if (event.target.className.includes('dimmer')) {
415
416
  event.preventDefault();
416
417
  }
417
418
  },
@@ -430,21 +431,21 @@
430
431
  module.hide();
431
432
  },
432
433
  closeKeyUp: function (event) {
433
- let keyCode = event.which;
434
+ const keyCode = event.which;
434
435
  if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
435
436
  module.hide();
436
437
  }
437
438
  },
438
439
  inputKeyDown: {
439
440
  first: function (event) {
440
- let keyCode = event.which;
441
+ const keyCode = event.which;
441
442
  if (keyCode === settings.keys.tab && event.shiftKey) {
442
443
  $inputs.last().trigger('focus');
443
444
  event.preventDefault();
444
445
  }
445
446
  },
446
447
  last: function (event) {
447
- let keyCode = event.which;
448
+ const keyCode = event.which;
448
449
  if (keyCode === settings.keys.tab && !event.shiftKey) {
449
450
  $inputs.first().trigger('focus');
450
451
  event.preventDefault();
@@ -452,8 +453,8 @@
452
453
  },
453
454
  },
454
455
  mousedown: function (event) {
455
- let $target = $(event.target);
456
- let isRtl = module.is.rtl();
456
+ const $target = $(event.target);
457
+ const isRtl = module.is.rtl();
457
458
  initialMouseDownInModal = $target.closest(selector.modal).length > 0;
458
459
  if (initialMouseDownInModal) {
459
460
  module.verbose('Mouse down event registered inside the modal');
@@ -479,9 +480,9 @@
479
480
 
480
481
  return;
481
482
  }
482
- let $target = $(event.target);
483
- let isInModal = $target.closest(selector.modal).length > 0;
484
- let isInDOM = $.contains(document.documentElement, event.target);
483
+ const $target = $(event.target);
484
+ const isInModal = $target.closest(selector.modal).length > 0;
485
+ const isInDOM = document.documentElement.contains(event.target);
485
486
  if (!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front)) {
486
487
  module.debug('Dimmer clicked, hiding all modals');
487
488
  if (settings.allowMultiple) {
@@ -501,7 +502,7 @@
501
502
  }, delay);
502
503
  },
503
504
  keyboard: function (event) {
504
- let keyCode = event.which;
505
+ const keyCode = event.which;
505
506
  if (keyCode === settings.keys.escape) {
506
507
  if (settings.closable) {
507
508
  module.debug('Escape key pressed hiding modal');
@@ -611,7 +612,7 @@
611
612
  duration: settings.transition.showDuration || settings.duration,
612
613
  useFailSafe: true,
613
614
  onComplete: function () {
614
- settings.onVisible.apply(element);
615
+ settings.onVisible.call(element);
615
616
  if (settings.keyboardShortcuts) {
616
617
  module.add.keyboardShortcuts();
617
618
  }
@@ -632,7 +633,7 @@
632
633
  },
633
634
 
634
635
  hideModal: function (callback, keepDimmed, hideOthersToo) {
635
- let $previousModal = $otherModals.filter('.' + className.active).last();
636
+ const $previousModal = $otherModals.filter('.' + className.active).last();
636
637
  callback = isFunction(callback)
637
638
  ? callback
638
639
  : function () {};
@@ -721,7 +722,7 @@
721
722
  },
722
723
 
723
724
  hideAll: function (callback) {
724
- let $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating);
725
+ const $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating);
725
726
  callback = isFunction(callback)
726
727
  ? callback
727
728
  : function () {};
@@ -743,7 +744,7 @@
743
744
  },
744
745
 
745
746
  hideOthers: function (callback) {
746
- let $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating);
747
+ const $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating);
747
748
  callback = isFunction(callback)
748
749
  ? callback
749
750
  : function () {};
@@ -773,17 +774,17 @@
773
774
 
774
775
  save: {
775
776
  focus: function () {
776
- let $activeElement = $(document.activeElement);
777
- let inCurrentModal = $activeElement.closest($module).length > 0;
777
+ const $activeElement = $(document.activeElement);
778
+ const inCurrentModal = $activeElement.closest($module).length > 0;
778
779
  if (!inCurrentModal) {
779
780
  $focusedElement = $(document.activeElement).trigger('blur');
780
781
  }
781
782
  },
782
783
  bodyMargin: function () {
783
784
  initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
784
- let bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
785
- let bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
786
- tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
785
+ initialBodyMarginInt = Number.parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
786
+ const bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
787
+ tempBodyMargin = initialBodyMarginInt + bodyScrollbarWidth;
787
788
  },
788
789
  },
789
790
 
@@ -794,11 +795,11 @@
794
795
  }
795
796
  },
796
797
  bodyMargin: function () {
797
- let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
798
- $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
798
+ const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
799
+ $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMarginInt === 0 ? '' : initialBodyMargin);
799
800
  $context.find(selector.bodyFixed.replace('right', position)).each(function () {
800
- let el = $(this);
801
- let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
801
+ const el = $(this);
802
+ const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
802
803
  el.css(attribute, '');
803
804
  });
804
805
  },
@@ -852,9 +853,9 @@
852
853
 
853
854
  cacheSizes: function () {
854
855
  $module.addClass(className.loading);
855
- let scrollHeight = $module.prop('scrollHeight');
856
- let modalWidth = $module.outerWidth();
857
- let modalHeight = $module.outerHeight();
856
+ const scrollHeight = $module.prop('scrollHeight');
857
+ const modalWidth = $module.outerWidth();
858
+ const modalHeight = $module.outerHeight();
858
859
  if (module.cache.pageHeight === undefined || modalHeight !== 0) {
859
860
  $.extend(module.cache, {
860
861
  pageHeight: $document.outerHeight(),
@@ -876,8 +877,7 @@
876
877
  return string;
877
878
  }
878
879
 
879
- const badChars = /["'<>]|&(?![\d#A-Za-z]{1,12};)/g;
880
- const escape = {
880
+ const escapeMap = {
881
881
  '"': '&quot;',
882
882
  '&': '&amp;',
883
883
  "'": '&apos;',
@@ -885,7 +885,7 @@
885
885
  '>': '&gt;',
886
886
  };
887
887
 
888
- return string.replace(badChars, (chr) => escape[chr]);
888
+ return String(string).replace(/["&'<>]/g, (chr) => escapeMap[chr]);
889
889
  },
890
890
  },
891
891
  can: {
@@ -907,13 +907,13 @@
907
907
  return settings.useFlex;
908
908
  },
909
909
  fit: function () {
910
- let contextHeight = module.cache.contextHeight;
911
- let verticalCenter = module.cache.contextHeight / 2;
912
- let topOffset = module.cache.topOffset;
913
- let scrollHeight = module.cache.scrollHeight;
914
- let height = module.cache.height;
915
- let paddingHeight = settings.padding;
916
- let startPosition = verticalCenter + topOffset;
910
+ const contextHeight = module.cache.contextHeight;
911
+ const verticalCenter = module.cache.contextHeight / 2;
912
+ const topOffset = module.cache.topOffset;
913
+ const scrollHeight = module.cache.scrollHeight;
914
+ const height = module.cache.height;
915
+ const paddingHeight = settings.padding;
916
+ const startPosition = verticalCenter + topOffset;
917
917
 
918
918
  return scrollHeight > height
919
919
  ? startPosition + scrollHeight + paddingHeight < contextHeight
@@ -960,7 +960,7 @@
960
960
  return module.cache.isFirefox;
961
961
  },
962
962
  iframe: function () {
963
- return !(self === top);
963
+ return !(window.self === window.top);
964
964
  },
965
965
  },
966
966
 
@@ -969,9 +969,9 @@
969
969
  observeAttributes = state !== false;
970
970
  },
971
971
  autofocus: function () {
972
- let $autofocus = $inputs.filter('[autofocus]');
973
- let $rawInputs = $inputs.filter(':input');
974
- let $input = ($autofocus.length > 0
972
+ const $autofocus = $inputs.filter('[autofocus]');
973
+ const $rawInputs = $inputs.filter(':input');
974
+ const $input = ($autofocus.length > 0
975
975
  ? $autofocus
976
976
  : ($rawInputs.length > 0
977
977
  ? $rawInputs
@@ -980,13 +980,13 @@
980
980
  $input.trigger('focus');
981
981
  },
982
982
  bodyMargin: function () {
983
- let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
983
+ const position = module.can.leftBodyScrollbar() ? 'left' : 'right';
984
984
  if (settings.detachable || module.can.fit()) {
985
985
  $context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
986
986
  }
987
987
  $context.find(selector.bodyFixed.replace('right', position)).each(function () {
988
- let el = $(this);
989
- let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
988
+ const el = $(this);
989
+ const attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
990
990
  el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
991
991
  });
992
992
  },
@@ -1006,7 +1006,7 @@
1006
1006
 
1007
1007
  return;
1008
1008
  }
1009
- let defaultSettings = {
1009
+ const defaultSettings = {
1010
1010
  debug: settings.debug,
1011
1011
  dimmerName: 'modals',
1012
1012
  closable: 'auto',
@@ -1016,7 +1016,7 @@
1016
1016
  hide: settings.transition.hideDuration || settings.duration,
1017
1017
  },
1018
1018
  };
1019
- let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
1019
+ const dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
1020
1020
  if (settings.inverted) {
1021
1021
  dimmerSettings.variation = dimmerSettings.variation !== undefined
1022
1022
  ? dimmerSettings.variation + ' inverted'
@@ -1038,7 +1038,7 @@
1038
1038
  },
1039
1039
  modalOffset: function () {
1040
1040
  if (!settings.detachable) {
1041
- let canFit = module.can.fit();
1041
+ const canFit = module.can.fit();
1042
1042
  $module
1043
1043
  .css({
1044
1044
  top: !$module.hasClass('aligned') && canFit
@@ -1122,30 +1122,30 @@
1122
1122
  return module[name];
1123
1123
  }
1124
1124
  },
1125
- debug: function () {
1125
+ debug: function (...args) {
1126
1126
  if (!settings.silent && settings.debug) {
1127
1127
  if (settings.performance) {
1128
- module.performance.log(arguments);
1128
+ module.performance.log(args);
1129
1129
  } else {
1130
1130
  module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1131
- module.debug.apply(console, arguments);
1131
+ module.debug.apply(console, args);
1132
1132
  }
1133
1133
  }
1134
1134
  },
1135
- verbose: function () {
1135
+ verbose: function (...args) {
1136
1136
  if (!settings.silent && settings.verbose && settings.debug) {
1137
1137
  if (settings.performance) {
1138
- module.performance.log(arguments);
1138
+ module.performance.log(args);
1139
1139
  } else {
1140
1140
  module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1141
- module.verbose.apply(console, arguments);
1141
+ module.verbose.apply(console, args);
1142
1142
  }
1143
1143
  }
1144
1144
  },
1145
- error: function () {
1145
+ error: function (...args) {
1146
1146
  if (!settings.silent) {
1147
1147
  module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1148
- module.error.apply(console, arguments);
1148
+ module.error.apply(console, args);
1149
1149
  }
1150
1150
  },
1151
1151
  performance: {
@@ -1160,7 +1160,7 @@
1160
1160
  time = currentTime;
1161
1161
  performance.push({
1162
1162
  Name: message[0],
1163
- Arguments: [].slice.call(message, 1) || '',
1163
+ Arguments: message.slice(1),
1164
1164
  Element: element,
1165
1165
  'Execution Time': executionTime,
1166
1166
  });
@@ -1181,30 +1181,22 @@
1181
1181
  title += ' ' + totalTime + 'ms';
1182
1182
  if (performance.length > 0) {
1183
1183
  console.groupCollapsed(title);
1184
- if (console.table) {
1185
- console.table(performance);
1186
- } else {
1187
- $.each(performance, function (index, data) {
1188
- console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
1189
- });
1190
- }
1184
+ console.table(performance);
1191
1185
  console.groupEnd();
1192
1186
  }
1193
1187
  performance = [];
1194
1188
  },
1195
1189
  },
1196
- invoke: function (query, passedArguments, context) {
1190
+ invoke: function (query, passedArguments = queryArguments, context = element) {
1197
1191
  let object = instance;
1198
1192
  let maxDepth;
1199
1193
  let found;
1200
1194
  let response;
1201
- passedArguments = passedArguments || queryArguments;
1202
- context = context || element;
1203
1195
  if (typeof query === 'string' && object !== undefined) {
1204
1196
  query = query.split(/[ .]/);
1205
1197
  maxDepth = query.length - 1;
1206
1198
  $.each(query, function (depth, value) {
1207
- let camelCaseValue = depth !== maxDepth
1199
+ const camelCaseValue = depth !== maxDepth
1208
1200
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1209
1201
  : query;
1210
1202
  if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
@@ -1245,10 +1237,10 @@
1245
1237
 
1246
1238
  if (methodInvoked) {
1247
1239
  if (instance === undefined) {
1248
- if (isFunction(settings.templates[query])) {
1240
+ if (isFunction(settings.templates[parameters])) {
1249
1241
  settings.autoShow = true;
1250
1242
  settings.className.modal = settings.className.template;
1251
- settings = $.extend(true, {}, settings, settings.templates[query].apply(module, queryArguments));
1243
+ settings = $.extend(true, {}, settings, settings.templates[parameters].apply(module, queryArguments));
1252
1244
 
1253
1245
  // reassign shortcuts
1254
1246
  className = settings.className;
@@ -1258,8 +1250,8 @@
1258
1250
  }
1259
1251
  module.initialize();
1260
1252
  }
1261
- if (!isFunction(settings.templates[query])) {
1262
- module.invoke(query);
1253
+ if (!isFunction(settings.templates[parameters])) {
1254
+ module.invoke(parameters);
1263
1255
  }
1264
1256
  } else {
1265
1257
  if (instance !== undefined) {
@@ -1418,8 +1410,7 @@
1418
1410
  };
1419
1411
 
1420
1412
  $.fn.modal.settings.templates = {
1421
- getArguments: function (args) {
1422
- let queryArguments = [].slice.call(args);
1413
+ getArguments: function (queryArguments) {
1423
1414
  if ($.isPlainObject(queryArguments[0])) {
1424
1415
  return $.extend({
1425
1416
  handler: function () {},
@@ -1437,10 +1428,10 @@
1437
1428
  title: queryArguments.pop() || '',
1438
1429
  };
1439
1430
  },
1440
- alert: function () {
1441
- let settings = this.get.settings();
1442
- let args = settings.templates.getArguments(arguments);
1443
- let approveFn = args.handler;
1431
+ alert: function (...args) {
1432
+ const settings = this.get.settings();
1433
+ args = settings.templates.getArguments(args);
1434
+ const approveFn = args.handler;
1444
1435
 
1445
1436
  return {
1446
1437
  title: args.title,
@@ -1453,13 +1444,13 @@
1453
1444
  }],
1454
1445
  };
1455
1446
  },
1456
- confirm: function () {
1457
- let settings = this.get.settings();
1458
- let args = settings.templates.getArguments(arguments);
1459
- let approveFn = function () {
1447
+ confirm: function (...args) {
1448
+ const settings = this.get.settings();
1449
+ args = settings.templates.getArguments(args);
1450
+ const approveFn = function () {
1460
1451
  args.handler(true);
1461
1452
  };
1462
- let denyFn = function () {
1453
+ const denyFn = function () {
1463
1454
  args.handler(false);
1464
1455
  };
1465
1456
 
@@ -1479,17 +1470,17 @@
1479
1470
  }],
1480
1471
  };
1481
1472
  },
1482
- prompt: function () {
1483
- let $this = this;
1484
- let settings = this.get.settings();
1485
- let args = settings.templates.getArguments(arguments);
1486
- let input = $($.parseHTML(args.content)).filter('.ui.input');
1487
- let approveFn = function () {
1488
- let settings = $this.get.settings();
1489
- let inputField = $this.get.element().find(settings.selector.prompt)[0];
1473
+ prompt: function (...args) {
1474
+ const $this = this;
1475
+ const settings = this.get.settings();
1476
+ args = settings.templates.getArguments(args);
1477
+ const input = $($.parseHTML(args.content)).filter('.ui.input');
1478
+ const approveFn = function () {
1479
+ const settings = $this.get.settings();
1480
+ const inputField = $this.get.element().find(settings.selector.prompt)[0];
1490
1481
  args.handler($(inputField).val());
1491
1482
  };
1492
- let denyFn = function () {
1483
+ const denyFn = function () {
1493
1484
  args.handler(null);
1494
1485
  };
1495
1486
  if (input.length === 0) {