fomantic-ui 2.10.0-beta.62 → 2.10.0-beta.64
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.
- package/.eslintrc.js +0 -1
- package/changelog-setup.js +10 -10
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +40 -41
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +57 -61
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +186 -187
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +29 -30
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +22 -23
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +293 -337
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +33 -35
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +74 -81
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +141 -146
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +80 -81
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +27 -28
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +62 -72
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +51 -55
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +33 -34
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +96 -109
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +44 -45
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +56 -64
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +16 -17
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +143 -148
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +24 -25
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +42 -43
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +57 -66
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +32 -33
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +38 -45
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +76 -77
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +1753 -1884
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/scripts/nightly-version.js +3 -3
- package/src/definitions/behaviors/api.js +56 -60
- package/src/definitions/behaviors/form.js +140 -145
- package/src/definitions/behaviors/state.js +23 -24
- package/src/definitions/behaviors/visibility.js +75 -76
- package/src/definitions/globals/site.js +15 -16
- package/src/definitions/modules/accordion.js +39 -40
- package/src/definitions/modules/calendar.js +185 -186
- package/src/definitions/modules/checkbox.js +28 -29
- package/src/definitions/modules/dimmer.js +21 -22
- package/src/definitions/modules/dropdown.js +292 -336
- package/src/definitions/modules/embed.js +32 -34
- package/src/definitions/modules/flyout.js +73 -80
- package/src/definitions/modules/modal.js +79 -80
- package/src/definitions/modules/nag.js +26 -27
- package/src/definitions/modules/popup.js +61 -71
- package/src/definitions/modules/progress.js +50 -54
- package/src/definitions/modules/rating.js +32 -33
- package/src/definitions/modules/search.js +95 -108
- package/src/definitions/modules/shape.js +43 -44
- package/src/definitions/modules/sidebar.js +55 -63
- package/src/definitions/modules/slider.js +142 -147
- package/src/definitions/modules/sticky.js +41 -42
- package/src/definitions/modules/tab.js +56 -65
- package/src/definitions/modules/toast.js +31 -32
- package/src/definitions/modules/transition.js +37 -44
- package/tasks/admin/components/create.js +11 -11
- package/tasks/admin/components/init.js +11 -12
- package/tasks/admin/components/update.js +19 -20
- package/tasks/admin/distributions/create.js +24 -36
- package/tasks/admin/distributions/init.js +11 -12
- package/tasks/admin/distributions/update.js +18 -19
- package/tasks/admin/register.js +7 -7
- package/tasks/build/assets.js +1 -1
- package/tasks/build/css.js +1 -1
- package/tasks/build/javascript.js +1 -1
- package/tasks/config/admin/github.js +1 -1
- package/tasks/config/admin/templates/css-package.js +1 -1
- package/tasks/config/admin/templates/less-package.js +1 -1
- package/tasks/config/project/config.js +6 -6
- package/tasks/config/project/install.js +12 -12
- package/tasks/config/project/release.js +5 -11
- package/tasks/config/tasks.js +5 -5
- package/tasks/config/user.js +1 -4
- package/tasks/docs/metadata.js +11 -12
- package/tasks/install.js +9 -9
- package/test/meteor/assets.js +1 -1
- package/test/modules/module.spec.js +18 -18
package/dist/components/nag.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - Nag
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.nag = function (...args) {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $body = $('body');
|
|
25
25
|
|
|
26
26
|
let time = Date.now();
|
|
27
27
|
let performance = [];
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const parameters = args[0];
|
|
30
|
+
const methodInvoked = typeof parameters === 'string';
|
|
31
|
+
const queryArguments = args.slice(1);
|
|
32
|
+
const contextCheck = function (context, win) {
|
|
33
33
|
let $context;
|
|
34
34
|
if ([window, document].includes(context)) {
|
|
35
35
|
$context = $(context);
|
|
@@ -44,26 +44,25 @@
|
|
|
44
44
|
};
|
|
45
45
|
let returnedValue;
|
|
46
46
|
$allModules.each(function () {
|
|
47
|
-
|
|
47
|
+
const settings = $.isPlainObject(parameters)
|
|
48
48
|
? $.extend(true, {}, $.fn.nag.settings, parameters)
|
|
49
49
|
: $.extend({}, $.fn.nag.settings);
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const selector = settings.selector;
|
|
52
|
+
const error = settings.error;
|
|
53
|
+
const namespace = settings.namespace;
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const eventNamespace = '.' + namespace;
|
|
56
|
+
const moduleNamespace = namespace + '-module';
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
const $module = $(this);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
const $context = settings.context ? contextCheck(settings.context, window) : $body;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const element = this;
|
|
63
|
+
const instance = $module.data(moduleNamespace);
|
|
64
64
|
let storage;
|
|
65
|
-
|
|
66
|
-
module = {
|
|
65
|
+
const module = {
|
|
67
66
|
|
|
68
67
|
initialize: function () {
|
|
69
68
|
module.verbose('Initializing element');
|
|
@@ -193,7 +192,7 @@
|
|
|
193
192
|
.replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g, decodeURIComponent);
|
|
194
193
|
|
|
195
194
|
let cookieOptions = '';
|
|
196
|
-
for (
|
|
195
|
+
for (const option in options) {
|
|
197
196
|
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
|
198
197
|
cookieOptions += '; ' + option;
|
|
199
198
|
if (typeof options[option] === 'string') {
|
|
@@ -204,10 +203,10 @@
|
|
|
204
203
|
document.cookie = key + '=' + value + cookieOptions;
|
|
205
204
|
},
|
|
206
205
|
getItem: function (key) {
|
|
207
|
-
|
|
206
|
+
const cookies = document.cookie.split('; ');
|
|
208
207
|
for (const c of cookies) {
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
const parts = c.split('=');
|
|
209
|
+
const foundKey = parts[0].replace(/(%[\da-f]{2})+/gi, decodeURIComponent);
|
|
211
210
|
if (key === foundKey) {
|
|
212
211
|
return parts[1] || '';
|
|
213
212
|
}
|
|
@@ -219,7 +218,7 @@
|
|
|
219
218
|
};
|
|
220
219
|
},
|
|
221
220
|
storageOptions: function () {
|
|
222
|
-
|
|
221
|
+
const options = {};
|
|
223
222
|
if (settings.expires) {
|
|
224
223
|
options.expires = module.get.expirationDate(settings.expires);
|
|
225
224
|
}
|
|
@@ -246,7 +245,7 @@
|
|
|
246
245
|
|
|
247
246
|
storage: {
|
|
248
247
|
set: function (key, value) {
|
|
249
|
-
|
|
248
|
+
const options = module.get.storageOptions();
|
|
250
249
|
if (storage === window.localStorage && options.expires) {
|
|
251
250
|
module.debug('Storing expiration value in localStorage', key, options.expires);
|
|
252
251
|
storage.setItem(key + settings.expirationKey, options.expires);
|
|
@@ -262,7 +261,7 @@
|
|
|
262
261
|
let storedValue;
|
|
263
262
|
storedValue = storage.getItem(key);
|
|
264
263
|
if (storage === window.localStorage) {
|
|
265
|
-
|
|
264
|
+
const expiration = storage.getItem(key + settings.expirationKey);
|
|
266
265
|
if (expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
|
|
267
266
|
module.debug('Value in localStorage has expired. Deleting key', key);
|
|
268
267
|
module.storage.remove(key);
|
|
@@ -276,7 +275,7 @@
|
|
|
276
275
|
return storedValue;
|
|
277
276
|
},
|
|
278
277
|
remove: function (key) {
|
|
279
|
-
|
|
278
|
+
const options = module.get.storageOptions();
|
|
280
279
|
options.expires = module.get.expirationDate(-1);
|
|
281
280
|
if (storage === window.localStorage) {
|
|
282
281
|
storage.removeItem(key + settings.expirationKey);
|
|
@@ -382,7 +381,7 @@
|
|
|
382
381
|
query = query.split(/[ .]/);
|
|
383
382
|
maxDepth = query.length - 1;
|
|
384
383
|
$.each(query, function (depth, value) {
|
|
385
|
-
|
|
384
|
+
const camelCaseValue = depth !== maxDepth
|
|
386
385
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
387
386
|
: query;
|
|
388
387
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.64+bcb9c73
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
|
4
4
|
* https://fomantic-ui.com/
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
!function(x,w,D){"use strict";w=void 0!==w&&w.Math===Math?w:globalThis,x.fn.nag=function(...e){
|
|
11
|
+
!function(x,w,D){"use strict";w=void 0!==w&&w.Math===Math?w:globalThis,x.fn.nag=function(...e){const n=x(this),g=x("body");let p=Date.now(),m=[];const f=e[0],h="string"==typeof f,b=e.slice(1),v=function(e,n){let t;return[w,D].includes(e)?t=x(e):0===(t=x(n.document).find(e)).length&&(t=n.frameElement?v(e,n.parent):g),t};let y;return n.each(function(){const o=x.isPlainObject(f)?x.extend(!0,{},x.fn.nag.settings,f):x.extend({},x.fn.nag.settings),e=o.selector,c=o.error;var n=o.namespace;const t="."+n,i=n+"-module",a=x(this),r=o.context?v(o.context,w):g,l=this,d=a.data(i);let s;const u={initialize:function(){u.verbose("Initializing element"),"string"!=typeof o.value&&(o.value=JSON.stringify(o.value)),s=u.get.storage(),a.on("click"+t,e.close,u.dismiss).data(i,u),o.detachable&&a.parent()[0]!==r[0]&&a.detach().prependTo(r),0<o.displayTime&&setTimeout(function(){u.hide()},o.displayTime),u.show()},destroy:function(){u.verbose("Destroying instance"),a.removeData(i).off(t)},show:function(){if(u.should.show()&&!a.is(":visible")){if(!1===o.onShow.call(l))return u.debug("onShow callback returned false, cancelling nag animation"),!1;u.debug("Showing nag",o.animation.show),"fade"===o.animation.show?a.fadeIn(o.duration,o.easing,o.onVisible):a.slideDown(o.duration,o.easing,o.onVisible)}},hide:function(){if(!1===o.onHide.call(l))return u.debug("onHide callback returned false, cancelling nag animation"),!1;u.debug("Hiding nag",o.animation.hide),"fade"===o.animation.hide?a.fadeOut(o.duration,o.easing,o.onHidden):a.slideUp(o.duration,o.easing,o.onHidden)},dismiss:function(e){!1!==u.hide()&&o.storageMethod&&(u.debug("Dismissing nag",o.storageMethod,o.key,o.value,o.expires),u.storage.set(o.key,o.value)),e&&(e.stopImmediatePropagation(),e.preventDefault())},should:{show:function(){return o.persist?(u.debug("Persistent nag is set, can show nag"),!0):u.storage.get(o.key)!=o.value.toString()?(u.debug("Stored value is not set, can show nag",u.storage.get(o.key)),!0):(u.debug("Stored value is set, cannot show nag",u.storage.get(o.key)),!1)}},get:{expirationDate:function(e){if((e="number"==typeof e?new Date(Date.now()+864e5*e):e)instanceof Date&&e.getTime())return e.toUTCString();u.error(c.expiresFormat)},storage:function(){return"localstorage"===o.storageMethod?(u.debug("Using local storage"),w.localStorage):"sessionstorage"===o.storageMethod?(u.debug("Using session storage"),w.sessionStorage):(u.debug("Using cookie"),{setItem:function(e,n,t){e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=encodeURIComponent(n).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g,decodeURIComponent);let o="";for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(o+="; "+i,"string"==typeof t[i]&&(o+="="+t[i].split(";")[0]));D.cookie=e+"="+n+o},getItem:function(e){for(const n of D.cookie.split("; ")){const t=n.split("=");if(e===t[0].replace(/(%[\da-f]{2})+/gi,decodeURIComponent))return t[1]||""}},removeItem:function(e,n){s.setItem(e,"",n)}})},storageOptions:function(){const e={};return o.expires&&(e.expires=u.get.expirationDate(o.expires)),o.domain&&(e.domain=o.domain),o.path&&(e.path=o.path),o.secure&&(e.secure=o.secure),o.samesite&&(e.samesite=o.samesite),e}},clear:function(){u.storage.remove(o.key)},storage:{set:function(e,n){var t=u.get.storageOptions();s===w.localStorage&&t.expires&&(u.debug("Storing expiration value in localStorage",e,t.expires),s.setItem(e+o.expirationKey,t.expires)),u.debug("Value stored",e,n);try{s.setItem(e,n,t)}catch(e){u.error(c.setItem,e)}},get:function(e){let n;var t;return n=s.getItem(e),s===w.localStorage&&null!=(t=s.getItem(e+o.expirationKey))&&new Date(t)<new Date&&(u.debug("Value in localStorage has expired. Deleting key",e),u.storage.remove(e),n=null),n="undefined"!==n&&"null"!==n&&void 0!==n&&null!==n?n:void 0},remove:function(e){const n=u.get.storageOptions();n.expires=u.get.expirationDate(-1),s===w.localStorage&&s.removeItem(e+o.expirationKey),s.removeItem(e,n)}},setting:function(e,n){if(u.debug("Changing setting",e,n),x.isPlainObject(e))x.extend(!0,o,e);else{if(void 0===n)return o[e];x.isPlainObject(o[e])?x.extend(!0,o[e],n):o[e]=n}},internal:function(e,n){if(x.isPlainObject(e))x.extend(!0,u,e);else{if(void 0===n)return u[e];u[e]=n}},debug:function(...e){!o.silent&&o.debug&&(o.performance?u.performance.log(e):(u.debug=Function.prototype.bind.call(console.info,console,o.name+":"),u.debug.apply(console,e)))},verbose:function(...e){!o.silent&&o.verbose&&o.debug&&(o.performance?u.performance.log(e):(u.verbose=Function.prototype.bind.call(console.info,console,o.name+":"),u.verbose.apply(console,e)))},error:function(...e){o.silent||(u.error=Function.prototype.bind.call(console.error,console,o.name+":"),u.error.apply(console,e))},performance:{log:function(e){var n,t;o.performance&&(t=(n=Date.now())-(p||n),p=n,m.push({Name:e[0],Arguments:e.slice(1),Element:l,"Execution Time":t})),clearTimeout(u.performance.timer),u.performance.timer=setTimeout(function(){u.performance.display()},500)},display:function(){var e=o.name+":";let t=0;p=!1,clearTimeout(u.performance.timer),x.each(m,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",0<m.length&&(console.groupCollapsed(e),console.table(m),console.groupEnd()),m=[]}},invoke:function(o,e=b,n=l){let i=d,a,r,t;var s;return"string"==typeof o&&void 0!==i&&(o=o.split(/[ .]/),a=o.length-1,x.each(o,function(e,n){var t=e!==a?n+o[e+1].charAt(0).toUpperCase()+o[e+1].slice(1):o;if(x.isPlainObject(i[t])&&e!==a)i=i[t];else{if(void 0!==i[t])return r=i[t],!1;{if(!x.isPlainObject(i[n])||e===a)return void 0!==i[n]?r=i[n]:u.error(c.method,o),!1;i=i[n]}}})),"function"==typeof(s=r)&&"number"!=typeof s.nodeType?t=r.apply(n,e):void 0!==r&&(t=r),Array.isArray(y)?y.push(t):void 0!==y?y=[y,t]:void 0!==t&&(y=t),r}};h?(void 0===d&&u.initialize(),u.invoke(f)):(void 0!==d&&d.invoke("destroy"),u.initialize())}),void 0!==y?y:this},x.fn.nag.settings={name:"Nag",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"Nag",persist:!1,displayTime:0,animation:{show:"slide",hide:"slide"},context:!1,detachable:!1,expires:30,domain:!1,path:"/",secure:!1,samesite:!1,storageMethod:"cookie",key:"nag",value:"dismiss",expirationKey:"ExpirationDate",error:{method:"The method you called is not defined.",setItem:"Unexpected error while setting value",expiresFormat:'"expires" must be a number of days or a Date Object'},className:{bottom:"bottom",fixed:"fixed"},selector:{close:"> .close.icon"},duration:500,easing:"easeOutQuad",onShow:function(){},onVisible:function(){},onHide:function(){},onHidden:function(){}},x.extend(x.easing,{easeOutQuad:function(e){return 1-(1-e)*(1-e)}})}(jQuery,window,document);
|
package/dist/components/popup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - Popup
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.popup = function (...args) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $document = $(document);
|
|
25
|
+
const $window = $(window);
|
|
26
|
+
const $body = $('body');
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const clickEvent = 'ontouchstart' in document.documentElement
|
|
29
29
|
? 'touchstart'
|
|
30
30
|
: 'click';
|
|
31
31
|
|
|
32
32
|
let time = Date.now();
|
|
33
33
|
let performance = [];
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const parameters = args[0];
|
|
36
|
+
const methodInvoked = typeof parameters === 'string';
|
|
37
|
+
const queryArguments = args.slice(1);
|
|
38
|
+
const contextCheck = function (context, win) {
|
|
39
39
|
let $context;
|
|
40
40
|
if ([window, document].includes(context)) {
|
|
41
41
|
$context = $(context);
|
|
@@ -51,24 +51,24 @@
|
|
|
51
51
|
|
|
52
52
|
let returnedValue;
|
|
53
53
|
$allModules.each(function () {
|
|
54
|
-
|
|
54
|
+
const settings = $.isPlainObject(parameters)
|
|
55
55
|
? $.extend(true, {}, $.fn.popup.settings, parameters)
|
|
56
56
|
: $.extend({}, $.fn.popup.settings);
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
const selector = settings.selector;
|
|
59
|
+
const className = settings.className;
|
|
60
|
+
const error = settings.error;
|
|
61
|
+
const metadata = settings.metadata;
|
|
62
|
+
const namespace = settings.namespace;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const eventNamespace = '.' + settings.namespace;
|
|
65
|
+
const moduleNamespace = 'module-' + namespace;
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
const $module = $(this);
|
|
68
|
+
const $context = contextCheck(settings.context, window);
|
|
69
|
+
const $scrollContext = contextCheck(settings.scrollContext, window);
|
|
70
|
+
const $boundary = contextCheck(settings.boundary, window);
|
|
71
|
+
const $target = settings.target ? contextCheck(settings.target, window) : $module;
|
|
72
72
|
|
|
73
73
|
let $popup;
|
|
74
74
|
let $offsetParent;
|
|
@@ -77,15 +77,14 @@
|
|
|
77
77
|
let triedPositions = false;
|
|
78
78
|
let openedWithTouch = false;
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
const element = this;
|
|
81
81
|
let instance = $module.data(moduleNamespace);
|
|
82
82
|
|
|
83
83
|
let documentObserver;
|
|
84
84
|
let elementNamespace;
|
|
85
85
|
let id;
|
|
86
|
-
let module;
|
|
87
86
|
|
|
88
|
-
module = {
|
|
87
|
+
const module = {
|
|
89
88
|
|
|
90
89
|
// binds events
|
|
91
90
|
initialize: function () {
|
|
@@ -176,7 +175,7 @@
|
|
|
176
175
|
|
|
177
176
|
event: {
|
|
178
177
|
start: function (event) {
|
|
179
|
-
|
|
178
|
+
const delay = $.isPlainObject(settings.delay)
|
|
180
179
|
? settings.delay.show
|
|
181
180
|
: settings.delay;
|
|
182
181
|
clearTimeout(module.hideTimer);
|
|
@@ -187,7 +186,7 @@
|
|
|
187
186
|
}
|
|
188
187
|
},
|
|
189
188
|
end: function () {
|
|
190
|
-
|
|
189
|
+
const delay = $.isPlainObject(settings.delay)
|
|
191
190
|
? settings.delay.hide
|
|
192
191
|
: settings.delay;
|
|
193
192
|
clearTimeout(module.showTimer);
|
|
@@ -219,9 +218,9 @@
|
|
|
219
218
|
});
|
|
220
219
|
},
|
|
221
220
|
hideGracefully: function (event) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
const $target = $(event.target);
|
|
222
|
+
const isInDOM = document.documentElement.contains(event.target);
|
|
223
|
+
const inPopup = $target.closest(selector.popup).length > 0;
|
|
225
224
|
// don't close on clicks inside popup
|
|
226
225
|
if (event && !inPopup && isInDOM) {
|
|
227
226
|
module.debug('Click occurred outside popup hiding popup');
|
|
@@ -234,11 +233,11 @@
|
|
|
234
233
|
|
|
235
234
|
// generates popup html from metadata
|
|
236
235
|
create: function () {
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
const targetSibling = $target.next(selector.popup);
|
|
237
|
+
const contentFallback = !settings.popup && targetSibling.length === 0 ? $module.attr('title') : false;
|
|
239
238
|
let html = module.get.html();
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
const title = module.get.title();
|
|
240
|
+
const content = module.get.content(contentFallback);
|
|
242
241
|
|
|
243
242
|
if (html || content || title) {
|
|
244
243
|
module.debug('Creating pop-up html');
|
|
@@ -479,22 +478,20 @@
|
|
|
479
478
|
return $popup.offset();
|
|
480
479
|
},
|
|
481
480
|
calculations: function () {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
481
|
+
const $popupOffsetParent = module.get.offsetParent($popup);
|
|
482
|
+
const targetElement = $target[0];
|
|
483
|
+
const isWindowEl = $boundary[0] === window;
|
|
484
|
+
const targetOffset = $target.offset();
|
|
485
|
+
const parentOffset = settings.inline || (settings.popup && settings.movePopup)
|
|
487
486
|
? $target.offsetParent().offset()
|
|
488
487
|
: { top: 0, left: 0 };
|
|
489
|
-
|
|
488
|
+
const screenPosition = isWindowEl
|
|
490
489
|
? { top: 0, left: 0 }
|
|
491
490
|
: $boundary.offset();
|
|
492
|
-
|
|
493
|
-
let scroll = isWindowEl
|
|
491
|
+
const scroll = isWindowEl
|
|
494
492
|
? { top: $window.scrollTop(), left: $window.scrollLeft() }
|
|
495
493
|
: { top: 0, left: 0 };
|
|
496
|
-
|
|
497
|
-
calculations = {
|
|
494
|
+
const calculations = {
|
|
498
495
|
// element which is launching popup
|
|
499
496
|
target: {
|
|
500
497
|
element: $target[0],
|
|
@@ -529,7 +526,7 @@
|
|
|
529
526
|
|
|
530
527
|
// if popup offset context is different from target, then adjust calculations
|
|
531
528
|
if ($popupOffsetParent[0] !== $offsetParent[0]) {
|
|
532
|
-
|
|
529
|
+
const popupOffset = $popupOffsetParent.offset();
|
|
533
530
|
calculations.target.top -= popupOffset.top;
|
|
534
531
|
calculations.target.left -= popupOffset.left;
|
|
535
532
|
calculations.parent.width = $popupOffsetParent.outerWidth();
|
|
@@ -554,7 +551,7 @@
|
|
|
554
551
|
: parseInt(window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10))
|
|
555
552
|
: 0;
|
|
556
553
|
// calculate screen boundaries
|
|
557
|
-
screen = calculations.screen;
|
|
554
|
+
const screen = calculations.screen;
|
|
558
555
|
calculations.boundary = {
|
|
559
556
|
top: screen.top + screen.scroll.top,
|
|
560
557
|
bottom: screen.top + screen.scroll.top + screen.height,
|
|
@@ -592,12 +589,10 @@
|
|
|
592
589
|
},
|
|
593
590
|
distanceFromBoundary: function (offset, calculations = module.get.calculations()) {
|
|
594
591
|
let distanceFromBoundary = {};
|
|
595
|
-
let popup;
|
|
596
|
-
let boundary;
|
|
597
592
|
|
|
598
593
|
// shorthand
|
|
599
|
-
popup = calculations.popup;
|
|
600
|
-
boundary = calculations.boundary;
|
|
594
|
+
const popup = calculations.popup;
|
|
595
|
+
const boundary = calculations.boundary;
|
|
601
596
|
|
|
602
597
|
if (offset) {
|
|
603
598
|
distanceFromBoundary = {
|
|
@@ -612,7 +607,7 @@
|
|
|
612
607
|
return distanceFromBoundary;
|
|
613
608
|
},
|
|
614
609
|
offsetParent: function ($element) {
|
|
615
|
-
|
|
610
|
+
const element = $element !== undefined
|
|
616
611
|
? $element[0]
|
|
617
612
|
: $target[0];
|
|
618
613
|
let parentNode = element.parentNode;
|
|
@@ -647,21 +642,21 @@
|
|
|
647
642
|
};
|
|
648
643
|
},
|
|
649
644
|
nextPosition: function (position) {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
645
|
+
const positions = position.split(' ');
|
|
646
|
+
const verticalPosition = positions[0];
|
|
647
|
+
const horizontalPosition = positions[1];
|
|
648
|
+
const opposite = {
|
|
654
649
|
top: 'bottom',
|
|
655
650
|
bottom: 'top',
|
|
656
651
|
left: 'right',
|
|
657
652
|
right: 'left',
|
|
658
653
|
};
|
|
659
|
-
|
|
654
|
+
const adjacent = {
|
|
660
655
|
left: 'center',
|
|
661
656
|
center: 'right',
|
|
662
657
|
right: 'left',
|
|
663
658
|
};
|
|
664
|
-
|
|
659
|
+
const backup = {
|
|
665
660
|
'top left': 'top center',
|
|
666
661
|
'top center': 'top right',
|
|
667
662
|
'top right': 'right center',
|
|
@@ -671,7 +666,7 @@
|
|
|
671
666
|
'bottom left': 'left center',
|
|
672
667
|
'left center': 'top left',
|
|
673
668
|
};
|
|
674
|
-
|
|
669
|
+
const adjacentsAvailable = verticalPosition === 'top' || verticalPosition === 'bottom';
|
|
675
670
|
let oppositeTried = false;
|
|
676
671
|
let adjacentTried = false;
|
|
677
672
|
let nextPosition = false;
|
|
@@ -714,20 +709,15 @@
|
|
|
714
709
|
}
|
|
715
710
|
let offset;
|
|
716
711
|
let distanceAway;
|
|
717
|
-
let target;
|
|
718
|
-
let popup;
|
|
719
|
-
let parent;
|
|
720
712
|
let positioning;
|
|
721
|
-
let popupOffset;
|
|
722
|
-
let distanceFromBoundary;
|
|
723
713
|
|
|
724
714
|
offset = $module.data(metadata.offset) || settings.offset;
|
|
725
715
|
distanceAway = settings.distanceAway;
|
|
726
716
|
|
|
727
717
|
// shorthand
|
|
728
|
-
target = calculations.target;
|
|
729
|
-
popup = calculations.popup;
|
|
730
|
-
parent = calculations.parent;
|
|
718
|
+
const target = calculations.target;
|
|
719
|
+
const popup = calculations.popup;
|
|
720
|
+
const parent = calculations.parent;
|
|
731
721
|
|
|
732
722
|
if (module.should.centerArrow(calculations)) {
|
|
733
723
|
module.verbose('Adjusting offset to center arrow on small target element');
|
|
@@ -873,10 +863,10 @@
|
|
|
873
863
|
.addClass(position);
|
|
874
864
|
module.set.invisible();
|
|
875
865
|
|
|
876
|
-
popupOffset = module.get.popupOffset();
|
|
866
|
+
const popupOffset = module.get.popupOffset();
|
|
877
867
|
|
|
878
868
|
// see if any boundaries are surpassed with this tentative position
|
|
879
|
-
distanceFromBoundary = module.get.distanceFromBoundary(popupOffset, calculations);
|
|
869
|
+
const distanceFromBoundary = module.get.distanceFromBoundary(popupOffset, calculations);
|
|
880
870
|
|
|
881
871
|
if (!settings.forcePosition && module.is.offstage(distanceFromBoundary, position)) {
|
|
882
872
|
module.debug('Position is outside viewport', position);
|
|
@@ -1069,7 +1059,7 @@
|
|
|
1069
1059
|
return settings.closable;
|
|
1070
1060
|
},
|
|
1071
1061
|
offstage: function (distanceFromBoundary, position) {
|
|
1072
|
-
|
|
1062
|
+
const offstage = [];
|
|
1073
1063
|
// return boundaries that have been surpassed
|
|
1074
1064
|
$.each(distanceFromBoundary, function (direction, distance) {
|
|
1075
1065
|
if (distance < -settings.jitter) {
|
|
@@ -1213,7 +1203,7 @@
|
|
|
1213
1203
|
query = query.split(/[ .]/);
|
|
1214
1204
|
maxDepth = query.length - 1;
|
|
1215
1205
|
$.each(query, function (depth, value) {
|
|
1216
|
-
|
|
1206
|
+
const camelCaseValue = depth !== maxDepth
|
|
1217
1207
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
1218
1208
|
: query;
|
|
1219
1209
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -1449,7 +1439,7 @@
|
|
|
1449
1439
|
},
|
|
1450
1440
|
popup: function (text) {
|
|
1451
1441
|
let html = '';
|
|
1452
|
-
|
|
1442
|
+
const escape = $.fn.popup.settings.templates.escape;
|
|
1453
1443
|
if (text !== undefined) {
|
|
1454
1444
|
if (text.title) {
|
|
1455
1445
|
text.title = escape(text.title);
|