irie 0.0.8__py3-none-any.whl → 0.0.10__py3-none-any.whl
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.
- irie/apps/inventory/migrations/0002_alter_asset_bridge_sensors_and_more.py +24 -0
- irie/apps/inventory/models.py +2 -2
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-base.js +1069 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-base.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-lite.js +1378 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-lite.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper.js +1927 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/createPopper.js +258 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/contains.js +23 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getBoundingClientRect.js +28 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getClippingRect.js +70 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getCompositeRect.js +57 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getComputedStyle.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getDocumentElement.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getDocumentRect.js +29 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getHTMLElementScroll.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getLayoutRect.js +25 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getNodeName.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getNodeScroll.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getOffsetParent.js +64 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getParentNode.js +19 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getScrollParent.js +16 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getViewportRect.js +40 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindow.js +12 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindowScroll.js +10 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindowScrollBarX.js +13 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/instanceOf.js +23 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/isScrollParent.js +10 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/isTableElement.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/listScrollParents.js +26 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/enums.js +31 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/index.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/applyStyles.js +84 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/arrow.js +101 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/computeStyles.js +155 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/eventListeners.js +49 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/flip.js +147 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/hide.js +61 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/index.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/offset.js +53 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/popperOffsets.js +25 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/preventOverflow.js +123 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper-base.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper-lite.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper.js +20 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/types.js +0 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/computeAutoPlacement.js +47 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/computeOffsets.js +70 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/debounce.js +15 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/detectOverflow.js +64 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/expandToHashMap.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/format.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getAltAxis.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getAltLen.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getBasePlacement.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getFreshSideObject.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getMainAxisFromPlacement.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getOppositePlacement.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getOppositeVariationPlacement.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getVariation.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/math.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/mergeByName.js +14 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/mergePaddingObject.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/orderModifiers.js +44 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/rectToClientRect.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/uniqueBy.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/validateModifiers.js +76 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/within.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-base.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-base.min.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-lite.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-lite.min.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper.min.js.flow +3 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-reboot.min.css +7 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +7 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.esm.min.js +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.min.js +6 -0
- irie/apps/static/assets/vendor/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.css +34 -0
- irie/apps/static/assets/vendor/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.min.js +7 -0
- irie/apps/static/assets/vendor/notyf/notyf.es.js +441 -0
- irie/apps/static/assets/vendor/notyf/notyf.min.css +1 -0
- irie/apps/static/assets/vendor/notyf/notyf.min.js +1 -0
- irie/apps/static/assets/vendor/notyf/notyf.umd.js +449 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.css +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.js +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.mjs +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.mjs +2238 -0
- irie/apps/static/assets/vendor/onscreen/dist/index.js +21 -0
- irie/apps/static/assets/vendor/onscreen/dist/on-screen.es6.js +404 -0
- irie/apps/static/assets/vendor/onscreen/dist/on-screen.umd.min.js +1 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar-core.esm.js +889 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.esm.js +994 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.min.css +1 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.min.js +10 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.umd.js +127 -0
- irie/apps/static/assets/vendor/smooth-scroll/dist/smooth-scroll.min.js +2 -0
- irie/apps/static/assets/vendor/smooth-scroll/dist/smooth-scroll.polyfills.min.js +2 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.all.min.js +2 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.min.css +1 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.min.js +1 -0
- irie/apps/static/assets/vendor/waypoints/lib/jquery.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/noframework.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/infinite.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/inview.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/sticky.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/waypoints.debug.js +46 -0
- irie/apps/static/assets/vendor/waypoints/lib/zepto.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/licenses.txt +23 -0
- irie/apps/static/assets/vendor/waypoints/testem.json +24 -0
- irie/core/settings.py +4 -2
- irie/init/hayward.zip +0 -0
- {irie-0.0.8.dist-info → irie-0.0.10.dist-info}/METADATA +1 -1
- {irie-0.0.8.dist-info → irie-0.0.10.dist-info}/RECORD +125 -7
- {irie-0.0.8.dist-info → irie-0.0.10.dist-info}/WHEEL +0 -0
- {irie-0.0.8.dist-info → irie-0.0.10.dist-info}/entry_points.txt +0 -0
- {irie-0.0.8.dist-info → irie-0.0.10.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.chartist-tooltip {
|
|
2
|
+
position: absolute;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
opacity: 0;
|
|
5
|
+
min-width: 5em;
|
|
6
|
+
padding: .5em;
|
|
7
|
+
background: #F4C63D;
|
|
8
|
+
color: #453D3F;
|
|
9
|
+
font-family: Oxygen,Helvetica,Arial,sans-serif;
|
|
10
|
+
font-weight: 700;
|
|
11
|
+
text-align: center;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
-webkit-transition: opacity .2s linear;
|
|
15
|
+
-moz-transition: opacity .2s linear;
|
|
16
|
+
-o-transition: opacity .2s linear;
|
|
17
|
+
transition: opacity .2s linear; }
|
|
18
|
+
.chartist-tooltip:before {
|
|
19
|
+
content: "";
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 100%;
|
|
22
|
+
left: 50%;
|
|
23
|
+
width: 0;
|
|
24
|
+
height: 0;
|
|
25
|
+
margin-left: -15px;
|
|
26
|
+
border: 15px solid transparent;
|
|
27
|
+
border-top-color: #F4C63D; }
|
|
28
|
+
.chartist-tooltip.tooltip-show {
|
|
29
|
+
opacity: 1; }
|
|
30
|
+
|
|
31
|
+
.ct-area, .ct-line {
|
|
32
|
+
pointer-events: none; }
|
|
33
|
+
|
|
34
|
+
/*# sourceMappingURL=chartist-plugin-tooltip.css.map */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* chartist-plugin-tooltip 0.0.17
|
|
2
|
+
* Copyright © 2016 Markus Padourek
|
|
3
|
+
* Free to use under the WTFPL license.
|
|
4
|
+
* http://www.wtfpl.net/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
!function(a,b){"function"==typeof define&&define.amd?define(["chartist"],function(c){return a.returnExportsGlobal=b(c)}):"object"==typeof exports?module.exports=b(require("chartist")):a["Chartist.plugins.tooltips"]=b(Chartist)}(this,function(a){return function(a,b,c){"use strict";function d(a){f(a,"tooltip-show")||(a.className=a.className+" tooltip-show")}function e(a){var b=new RegExp("tooltip-show\\s*","gi");a.className=a.className.replace(b,"").trim()}function f(a,b){return(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")>-1}function g(a,b){do a=a.nextSibling;while(a&&!f(a,b));return a}function h(a){return a.innerText||a.textContent}var i={currency:void 0,currencyFormatCallback:void 0,tooltipOffset:{x:0,y:-20},anchorToPoint:!1,appendToBody:!1,class:void 0,pointClass:"ct-point"};c.plugins=c.plugins||{},c.plugins.tooltip=function(j){return j=c.extend({},i,j),function(i){function k(a,b,c){n.addEventListener(a,function(a){b&&!f(a.target,b)||c(a)})}function l(b){p=p||o.offsetHeight,q=q||o.offsetWidth;var c,d,e=-q/2+j.tooltipOffset.x,f=-p+j.tooltipOffset.y;if(j.appendToBody)o.style.top=b.pageY+f+"px",o.style.left=b.pageX+e+"px";else{var g=n.getBoundingClientRect(),h=b.pageX-g.left-a.pageXOffset,i=b.pageY-g.top-a.pageYOffset;!0===j.anchorToPoint&&b.target.x2&&b.target.y2&&(c=parseInt(b.target.x2.baseVal.value),d=parseInt(b.target.y2.baseVal.value)),o.style.top=(d||i)+f+"px",o.style.left=(c||h)+e+"px"}}var m=j.pointClass;i instanceof c.Bar?m="ct-bar":i instanceof c.Pie&&(m=i.options.donut?"ct-slice-donut":"ct-slice-pie");var n=i.container,o=n.querySelector(".chartist-tooltip");o||(o=b.createElement("div"),o.className=j.class?"chartist-tooltip "+j.class:"chartist-tooltip",j.appendToBody?b.body.appendChild(o):n.appendChild(o));var p=o.offsetHeight,q=o.offsetWidth;e(o),k("mouseover",m,function(a){var e=a.target,f="",k=i instanceof c.Pie?e:e.parentNode,m=k?e.parentNode.getAttribute("ct:meta")||e.parentNode.getAttribute("ct:series-name"):"",n=e.getAttribute("ct:meta")||m||"",r=!!n,s=e.getAttribute("ct:value");if(j.transformTooltipTextFnc&&"function"==typeof j.transformTooltipTextFnc&&(s=j.transformTooltipTextFnc(s)),j.tooltipFnc&&"function"==typeof j.tooltipFnc)f=j.tooltipFnc(n,s);else{if(j.metaIsHTML){var t=b.createElement("textarea");t.innerHTML=n,n=t.value}if(n='<span class="chartist-tooltip-meta">'+n+"</span>",r)f+=n+"<br>";else if(i instanceof c.Pie){var u=g(e,"ct-label");u&&(f+=h(u)+"<br>")}s&&(j.currency&&(s=void 0!=j.currencyFormatCallback?j.currencyFormatCallback(s,j):j.currency+s.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g,"$1,")),s='<span class="chartist-tooltip-value">'+s+"</span>",f+=s)}f&&(o.innerHTML=f,l(a),d(o),p=o.offsetHeight,q=o.offsetWidth)}),k("mouseout",m,function(){e(o)}),k("mousemove",null,function(a){!1===j.anchorToPoint&&l(a)})}}}(window,document,a),a.plugins.tooltips});
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
var __assign = function() {
|
|
17
|
+
__assign = Object.assign || function __assign(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var NotyfNotification = /** @class */ (function () {
|
|
28
|
+
function NotyfNotification(options) {
|
|
29
|
+
this.options = options;
|
|
30
|
+
this.listeners = {};
|
|
31
|
+
}
|
|
32
|
+
NotyfNotification.prototype.on = function (eventType, cb) {
|
|
33
|
+
var callbacks = this.listeners[eventType] || [];
|
|
34
|
+
this.listeners[eventType] = callbacks.concat([cb]);
|
|
35
|
+
};
|
|
36
|
+
NotyfNotification.prototype.triggerEvent = function (eventType, event) {
|
|
37
|
+
var _this = this;
|
|
38
|
+
var callbacks = this.listeners[eventType] || [];
|
|
39
|
+
callbacks.forEach(function (cb) { return cb({ target: _this, event: event }); });
|
|
40
|
+
};
|
|
41
|
+
return NotyfNotification;
|
|
42
|
+
}());
|
|
43
|
+
var NotyfArrayEvent;
|
|
44
|
+
(function (NotyfArrayEvent) {
|
|
45
|
+
NotyfArrayEvent[NotyfArrayEvent["Add"] = 0] = "Add";
|
|
46
|
+
NotyfArrayEvent[NotyfArrayEvent["Remove"] = 1] = "Remove";
|
|
47
|
+
})(NotyfArrayEvent || (NotyfArrayEvent = {}));
|
|
48
|
+
var NotyfArray = /** @class */ (function () {
|
|
49
|
+
function NotyfArray() {
|
|
50
|
+
this.notifications = [];
|
|
51
|
+
}
|
|
52
|
+
NotyfArray.prototype.push = function (elem) {
|
|
53
|
+
this.notifications.push(elem);
|
|
54
|
+
this.updateFn(elem, NotyfArrayEvent.Add, this.notifications);
|
|
55
|
+
};
|
|
56
|
+
NotyfArray.prototype.splice = function (index, num) {
|
|
57
|
+
var elem = this.notifications.splice(index, num)[0];
|
|
58
|
+
this.updateFn(elem, NotyfArrayEvent.Remove, this.notifications);
|
|
59
|
+
return elem;
|
|
60
|
+
};
|
|
61
|
+
NotyfArray.prototype.indexOf = function (elem) {
|
|
62
|
+
return this.notifications.indexOf(elem);
|
|
63
|
+
};
|
|
64
|
+
NotyfArray.prototype.onUpdate = function (fn) {
|
|
65
|
+
this.updateFn = fn;
|
|
66
|
+
};
|
|
67
|
+
return NotyfArray;
|
|
68
|
+
}());
|
|
69
|
+
|
|
70
|
+
var NotyfEvent;
|
|
71
|
+
(function (NotyfEvent) {
|
|
72
|
+
NotyfEvent["Dismiss"] = "dismiss";
|
|
73
|
+
NotyfEvent["Click"] = "click";
|
|
74
|
+
})(NotyfEvent || (NotyfEvent = {}));
|
|
75
|
+
var DEFAULT_OPTIONS = {
|
|
76
|
+
types: [
|
|
77
|
+
{
|
|
78
|
+
type: 'success',
|
|
79
|
+
className: 'notyf__toast--success',
|
|
80
|
+
backgroundColor: '#3dc763',
|
|
81
|
+
icon: {
|
|
82
|
+
className: 'notyf__icon--success',
|
|
83
|
+
tagName: 'i',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: 'error',
|
|
88
|
+
className: 'notyf__toast--error',
|
|
89
|
+
backgroundColor: '#ed3d3d',
|
|
90
|
+
icon: {
|
|
91
|
+
className: 'notyf__icon--error',
|
|
92
|
+
tagName: 'i',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
duration: 2000,
|
|
97
|
+
ripple: true,
|
|
98
|
+
position: {
|
|
99
|
+
x: 'right',
|
|
100
|
+
y: 'bottom',
|
|
101
|
+
},
|
|
102
|
+
dismissible: false,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
var NotyfView = /** @class */ (function () {
|
|
106
|
+
function NotyfView() {
|
|
107
|
+
this.notifications = [];
|
|
108
|
+
this.events = {};
|
|
109
|
+
this.X_POSITION_FLEX_MAP = {
|
|
110
|
+
left: 'flex-start',
|
|
111
|
+
center: 'center',
|
|
112
|
+
right: 'flex-end',
|
|
113
|
+
};
|
|
114
|
+
this.Y_POSITION_FLEX_MAP = {
|
|
115
|
+
top: 'flex-start',
|
|
116
|
+
center: 'center',
|
|
117
|
+
bottom: 'flex-end',
|
|
118
|
+
};
|
|
119
|
+
// Creates the main notifications container
|
|
120
|
+
var docFrag = document.createDocumentFragment();
|
|
121
|
+
var notyfContainer = this._createHTMLElement({ tagName: 'div', className: 'notyf' });
|
|
122
|
+
docFrag.appendChild(notyfContainer);
|
|
123
|
+
document.body.appendChild(docFrag);
|
|
124
|
+
this.container = notyfContainer;
|
|
125
|
+
// Identifies the main animation end event
|
|
126
|
+
this.animationEndEventName = this._getAnimationEndEventName();
|
|
127
|
+
this._createA11yContainer();
|
|
128
|
+
}
|
|
129
|
+
NotyfView.prototype.on = function (event, cb) {
|
|
130
|
+
var _a;
|
|
131
|
+
this.events = __assign(__assign({}, this.events), (_a = {}, _a[event] = cb, _a));
|
|
132
|
+
};
|
|
133
|
+
NotyfView.prototype.update = function (notification, type) {
|
|
134
|
+
if (type === NotyfArrayEvent.Add) {
|
|
135
|
+
this.addNotification(notification);
|
|
136
|
+
}
|
|
137
|
+
else if (type === NotyfArrayEvent.Remove) {
|
|
138
|
+
this.removeNotification(notification);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
NotyfView.prototype.removeNotification = function (notification) {
|
|
142
|
+
var _this = this;
|
|
143
|
+
var renderedNotification = this._popRenderedNotification(notification);
|
|
144
|
+
var node;
|
|
145
|
+
if (!renderedNotification) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
node = renderedNotification.node;
|
|
149
|
+
node.classList.add('notyf__toast--disappear');
|
|
150
|
+
var handleEvent;
|
|
151
|
+
node.addEventListener(this.animationEndEventName, (handleEvent = function (event) {
|
|
152
|
+
if (event.target === node) {
|
|
153
|
+
node.removeEventListener(_this.animationEndEventName, handleEvent);
|
|
154
|
+
_this.container.removeChild(node);
|
|
155
|
+
}
|
|
156
|
+
}));
|
|
157
|
+
};
|
|
158
|
+
NotyfView.prototype.addNotification = function (notification) {
|
|
159
|
+
var node = this._renderNotification(notification);
|
|
160
|
+
this.notifications.push({ notification: notification, node: node });
|
|
161
|
+
// For a11y purposes, we still want to announce that there's a notification in the screen
|
|
162
|
+
// even if it comes with no message.
|
|
163
|
+
this._announce(notification.options.message || 'Notification');
|
|
164
|
+
};
|
|
165
|
+
NotyfView.prototype._renderNotification = function (notification) {
|
|
166
|
+
var _a;
|
|
167
|
+
var card = this._buildNotificationCard(notification);
|
|
168
|
+
var className = notification.options.className;
|
|
169
|
+
if (className) {
|
|
170
|
+
(_a = card.classList).add.apply(_a, className.split(' '));
|
|
171
|
+
}
|
|
172
|
+
this.container.appendChild(card);
|
|
173
|
+
return card;
|
|
174
|
+
};
|
|
175
|
+
NotyfView.prototype._popRenderedNotification = function (notification) {
|
|
176
|
+
var idx = -1;
|
|
177
|
+
for (var i = 0; i < this.notifications.length && idx < 0; i++) {
|
|
178
|
+
if (this.notifications[i].notification === notification) {
|
|
179
|
+
idx = i;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (idx !== -1) {
|
|
183
|
+
return this.notifications.splice(idx, 1)[0];
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
};
|
|
187
|
+
NotyfView.prototype.getXPosition = function (options) {
|
|
188
|
+
var _a;
|
|
189
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.position) === null || _a === void 0 ? void 0 : _a.x) || 'right';
|
|
190
|
+
};
|
|
191
|
+
NotyfView.prototype.getYPosition = function (options) {
|
|
192
|
+
var _a;
|
|
193
|
+
return ((_a = options === null || options === void 0 ? void 0 : options.position) === null || _a === void 0 ? void 0 : _a.y) || 'bottom';
|
|
194
|
+
};
|
|
195
|
+
NotyfView.prototype.adjustContainerAlignment = function (options) {
|
|
196
|
+
var align = this.X_POSITION_FLEX_MAP[this.getXPosition(options)];
|
|
197
|
+
var justify = this.Y_POSITION_FLEX_MAP[this.getYPosition(options)];
|
|
198
|
+
var style = this.container.style;
|
|
199
|
+
style.setProperty('justify-content', justify);
|
|
200
|
+
style.setProperty('align-items', align);
|
|
201
|
+
};
|
|
202
|
+
NotyfView.prototype._buildNotificationCard = function (notification) {
|
|
203
|
+
var _this = this;
|
|
204
|
+
var options = notification.options;
|
|
205
|
+
var iconOpts = options.icon;
|
|
206
|
+
// Adjust container according to position (e.g. top-left, bottom-center, etc)
|
|
207
|
+
this.adjustContainerAlignment(options);
|
|
208
|
+
// Create elements
|
|
209
|
+
var notificationElem = this._createHTMLElement({ tagName: 'div', className: 'notyf__toast' });
|
|
210
|
+
var ripple = this._createHTMLElement({ tagName: 'div', className: 'notyf__ripple' });
|
|
211
|
+
var wrapper = this._createHTMLElement({ tagName: 'div', className: 'notyf__wrapper' });
|
|
212
|
+
var message = this._createHTMLElement({ tagName: 'div', className: 'notyf__message' });
|
|
213
|
+
message.innerHTML = options.message || '';
|
|
214
|
+
var mainColor = options.background || options.backgroundColor;
|
|
215
|
+
// Build the icon and append it to the card
|
|
216
|
+
if (iconOpts) {
|
|
217
|
+
var iconContainer = this._createHTMLElement({ tagName: 'div', className: 'notyf__icon' });
|
|
218
|
+
if (typeof iconOpts === 'string' || iconOpts instanceof String)
|
|
219
|
+
iconContainer.innerHTML = new String(iconOpts).valueOf();
|
|
220
|
+
if (typeof iconOpts === 'object') {
|
|
221
|
+
var _a = iconOpts.tagName, tagName = _a === void 0 ? 'i' : _a, className_1 = iconOpts.className, text = iconOpts.text, _b = iconOpts.color, color = _b === void 0 ? mainColor : _b;
|
|
222
|
+
var iconElement = this._createHTMLElement({ tagName: tagName, className: className_1, text: text });
|
|
223
|
+
if (color)
|
|
224
|
+
iconElement.style.color = color;
|
|
225
|
+
iconContainer.appendChild(iconElement);
|
|
226
|
+
}
|
|
227
|
+
wrapper.appendChild(iconContainer);
|
|
228
|
+
}
|
|
229
|
+
wrapper.appendChild(message);
|
|
230
|
+
notificationElem.appendChild(wrapper);
|
|
231
|
+
// Add ripple if applicable, else just paint the full toast
|
|
232
|
+
if (mainColor) {
|
|
233
|
+
if (options.ripple) {
|
|
234
|
+
ripple.style.background = mainColor;
|
|
235
|
+
notificationElem.appendChild(ripple);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
notificationElem.style.background = mainColor;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Add dismiss button
|
|
242
|
+
if (options.dismissible) {
|
|
243
|
+
var dismissWrapper = this._createHTMLElement({ tagName: 'div', className: 'notyf__dismiss' });
|
|
244
|
+
var dismissButton = this._createHTMLElement({
|
|
245
|
+
tagName: 'button',
|
|
246
|
+
className: 'notyf__dismiss-btn',
|
|
247
|
+
});
|
|
248
|
+
dismissWrapper.appendChild(dismissButton);
|
|
249
|
+
wrapper.appendChild(dismissWrapper);
|
|
250
|
+
notificationElem.classList.add("notyf__toast--dismissible");
|
|
251
|
+
dismissButton.addEventListener('click', function (event) {
|
|
252
|
+
var _a, _b;
|
|
253
|
+
(_b = (_a = _this.events)[NotyfEvent.Dismiss]) === null || _b === void 0 ? void 0 : _b.call(_a, { target: notification, event: event });
|
|
254
|
+
event.stopPropagation();
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
notificationElem.addEventListener('click', function (event) { var _a, _b; return (_b = (_a = _this.events)[NotyfEvent.Click]) === null || _b === void 0 ? void 0 : _b.call(_a, { target: notification, event: event }); });
|
|
258
|
+
// Adjust margins depending on whether its an upper or lower notification
|
|
259
|
+
var className = this.getYPosition(options) === 'top' ? 'upper' : 'lower';
|
|
260
|
+
notificationElem.classList.add("notyf__toast--" + className);
|
|
261
|
+
return notificationElem;
|
|
262
|
+
};
|
|
263
|
+
NotyfView.prototype._createHTMLElement = function (_a) {
|
|
264
|
+
var tagName = _a.tagName, className = _a.className, text = _a.text;
|
|
265
|
+
var elem = document.createElement(tagName);
|
|
266
|
+
if (className) {
|
|
267
|
+
elem.className = className;
|
|
268
|
+
}
|
|
269
|
+
elem.textContent = text || null;
|
|
270
|
+
return elem;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Creates an invisible container which will announce the notyfs to
|
|
274
|
+
* screen readers
|
|
275
|
+
*/
|
|
276
|
+
NotyfView.prototype._createA11yContainer = function () {
|
|
277
|
+
var a11yContainer = this._createHTMLElement({ tagName: 'div', className: 'notyf-announcer' });
|
|
278
|
+
a11yContainer.setAttribute('aria-atomic', 'true');
|
|
279
|
+
a11yContainer.setAttribute('aria-live', 'polite');
|
|
280
|
+
// Set the a11y container to be visible hidden. Can't use display: none as
|
|
281
|
+
// screen readers won't read it.
|
|
282
|
+
a11yContainer.style.border = '0';
|
|
283
|
+
a11yContainer.style.clip = 'rect(0 0 0 0)';
|
|
284
|
+
a11yContainer.style.height = '1px';
|
|
285
|
+
a11yContainer.style.margin = '-1px';
|
|
286
|
+
a11yContainer.style.overflow = 'hidden';
|
|
287
|
+
a11yContainer.style.padding = '0';
|
|
288
|
+
a11yContainer.style.position = 'absolute';
|
|
289
|
+
a11yContainer.style.width = '1px';
|
|
290
|
+
a11yContainer.style.outline = '0';
|
|
291
|
+
document.body.appendChild(a11yContainer);
|
|
292
|
+
this.a11yContainer = a11yContainer;
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Announces a message to screenreaders.
|
|
296
|
+
*/
|
|
297
|
+
NotyfView.prototype._announce = function (message) {
|
|
298
|
+
var _this = this;
|
|
299
|
+
this.a11yContainer.textContent = '';
|
|
300
|
+
// This 100ms timeout is necessary for some browser + screen-reader combinations:
|
|
301
|
+
// - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout.
|
|
302
|
+
// - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a
|
|
303
|
+
// second time without clearing and then using a non-zero delay.
|
|
304
|
+
// (using JAWS 17 at time of this writing).
|
|
305
|
+
// https://github.com/angular/material2/blob/master/src/cdk/a11y/live-announcer/live-announcer.ts
|
|
306
|
+
setTimeout(function () {
|
|
307
|
+
_this.a11yContainer.textContent = message;
|
|
308
|
+
}, 100);
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Determine which animationend event is supported
|
|
312
|
+
*/
|
|
313
|
+
NotyfView.prototype._getAnimationEndEventName = function () {
|
|
314
|
+
var el = document.createElement('_fake');
|
|
315
|
+
var transitions = {
|
|
316
|
+
MozTransition: 'animationend',
|
|
317
|
+
OTransition: 'oAnimationEnd',
|
|
318
|
+
WebkitTransition: 'webkitAnimationEnd',
|
|
319
|
+
transition: 'animationend',
|
|
320
|
+
};
|
|
321
|
+
var t;
|
|
322
|
+
for (t in transitions) {
|
|
323
|
+
if (el.style[t] !== undefined) {
|
|
324
|
+
return transitions[t];
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// No supported animation end event. Using "animationend" as a fallback
|
|
328
|
+
return 'animationend';
|
|
329
|
+
};
|
|
330
|
+
return NotyfView;
|
|
331
|
+
}());
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Main controller class. Defines the main Notyf API.
|
|
335
|
+
*/
|
|
336
|
+
var Notyf = /** @class */ (function () {
|
|
337
|
+
function Notyf(opts) {
|
|
338
|
+
var _this = this;
|
|
339
|
+
this.dismiss = this._removeNotification;
|
|
340
|
+
this.notifications = new NotyfArray();
|
|
341
|
+
this.view = new NotyfView();
|
|
342
|
+
var types = this.registerTypes(opts);
|
|
343
|
+
this.options = __assign(__assign({}, DEFAULT_OPTIONS), opts);
|
|
344
|
+
this.options.types = types;
|
|
345
|
+
this.notifications.onUpdate(function (elem, type) { return _this.view.update(elem, type); });
|
|
346
|
+
this.view.on(NotyfEvent.Dismiss, function (_a) {
|
|
347
|
+
var target = _a.target, event = _a.event;
|
|
348
|
+
_this._removeNotification(target);
|
|
349
|
+
// tslint:disable-next-line: no-string-literal
|
|
350
|
+
target['triggerEvent'](NotyfEvent.Dismiss, event);
|
|
351
|
+
});
|
|
352
|
+
// tslint:disable-next-line: no-string-literal
|
|
353
|
+
this.view.on(NotyfEvent.Click, function (_a) {
|
|
354
|
+
var target = _a.target, event = _a.event;
|
|
355
|
+
return target['triggerEvent'](NotyfEvent.Click, event);
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
Notyf.prototype.error = function (payload) {
|
|
359
|
+
var options = this.normalizeOptions('error', payload);
|
|
360
|
+
return this.open(options);
|
|
361
|
+
};
|
|
362
|
+
Notyf.prototype.success = function (payload) {
|
|
363
|
+
var options = this.normalizeOptions('success', payload);
|
|
364
|
+
return this.open(options);
|
|
365
|
+
};
|
|
366
|
+
Notyf.prototype.open = function (options) {
|
|
367
|
+
var defaultOpts = this.options.types.find(function (_a) {
|
|
368
|
+
var type = _a.type;
|
|
369
|
+
return type === options.type;
|
|
370
|
+
}) || {};
|
|
371
|
+
var config = __assign(__assign({}, defaultOpts), options);
|
|
372
|
+
this.assignProps(['ripple', 'position', 'dismissible'], config);
|
|
373
|
+
var notification = new NotyfNotification(config);
|
|
374
|
+
this._pushNotification(notification);
|
|
375
|
+
return notification;
|
|
376
|
+
};
|
|
377
|
+
Notyf.prototype.dismissAll = function () {
|
|
378
|
+
while (this.notifications.splice(0, 1))
|
|
379
|
+
;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Assigns properties to a config object based on two rules:
|
|
383
|
+
* 1. If the config object already sets that prop, leave it as so
|
|
384
|
+
* 2. Otherwise, use the default prop from the global options
|
|
385
|
+
*
|
|
386
|
+
* It's intended to build the final config object to open a notification. e.g. if
|
|
387
|
+
* 'dismissible' is not set, then use the value from the global config.
|
|
388
|
+
*
|
|
389
|
+
* @param props - properties to be assigned to the config object
|
|
390
|
+
* @param config - object whose properties need to be set
|
|
391
|
+
*/
|
|
392
|
+
Notyf.prototype.assignProps = function (props, config) {
|
|
393
|
+
var _this = this;
|
|
394
|
+
props.forEach(function (prop) {
|
|
395
|
+
// intentional double equality to check for both null and undefined
|
|
396
|
+
config[prop] = config[prop] == null ? _this.options[prop] : config[prop];
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
Notyf.prototype._pushNotification = function (notification) {
|
|
400
|
+
var _this = this;
|
|
401
|
+
this.notifications.push(notification);
|
|
402
|
+
var duration = notification.options.duration !== undefined ? notification.options.duration : this.options.duration;
|
|
403
|
+
if (duration) {
|
|
404
|
+
setTimeout(function () { return _this._removeNotification(notification); }, duration);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
Notyf.prototype._removeNotification = function (notification) {
|
|
408
|
+
var index = this.notifications.indexOf(notification);
|
|
409
|
+
if (index !== -1) {
|
|
410
|
+
this.notifications.splice(index, 1);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
Notyf.prototype.normalizeOptions = function (type, payload) {
|
|
414
|
+
var options = { type: type };
|
|
415
|
+
if (typeof payload === 'string') {
|
|
416
|
+
options.message = payload;
|
|
417
|
+
}
|
|
418
|
+
else if (typeof payload === 'object') {
|
|
419
|
+
options = __assign(__assign({}, options), payload);
|
|
420
|
+
}
|
|
421
|
+
return options;
|
|
422
|
+
};
|
|
423
|
+
Notyf.prototype.registerTypes = function (opts) {
|
|
424
|
+
var incomingTypes = ((opts && opts.types) || []).slice();
|
|
425
|
+
var finalDefaultTypes = DEFAULT_OPTIONS.types.map(function (defaultType) {
|
|
426
|
+
// find if there's a default type within the user input's types, if so, it means the user
|
|
427
|
+
// wants to change some of the default settings
|
|
428
|
+
var userTypeIdx = -1;
|
|
429
|
+
incomingTypes.forEach(function (t, idx) {
|
|
430
|
+
if (t.type === defaultType.type)
|
|
431
|
+
userTypeIdx = idx;
|
|
432
|
+
});
|
|
433
|
+
var userType = userTypeIdx !== -1 ? incomingTypes.splice(userTypeIdx, 1)[0] : {};
|
|
434
|
+
return __assign(__assign({}, defaultType), userType);
|
|
435
|
+
});
|
|
436
|
+
return finalDefaultTypes.concat(incomingTypes);
|
|
437
|
+
};
|
|
438
|
+
return Notyf;
|
|
439
|
+
}());
|
|
440
|
+
|
|
441
|
+
export { DEFAULT_OPTIONS, Notyf, NotyfArray, NotyfArrayEvent, NotyfEvent, NotyfNotification, NotyfView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@-webkit-keyframes notyf-fadeinup{0%{opacity:0;transform:translateY(25%)}to{opacity:1;transform:translateY(0)}}@keyframes notyf-fadeinup{0%{opacity:0;transform:translateY(25%)}to{opacity:1;transform:translateY(0)}}@-webkit-keyframes notyf-fadeinleft{0%{opacity:0;transform:translateX(25%)}to{opacity:1;transform:translateX(0)}}@keyframes notyf-fadeinleft{0%{opacity:0;transform:translateX(25%)}to{opacity:1;transform:translateX(0)}}@-webkit-keyframes notyf-fadeoutright{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(25%)}}@keyframes notyf-fadeoutright{0%{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(25%)}}@-webkit-keyframes notyf-fadeoutdown{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(25%)}}@keyframes notyf-fadeoutdown{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(25%)}}@-webkit-keyframes ripple{0%{transform:scale(0) translateY(-45%) translateX(13%)}to{transform:scale(1) translateY(-45%) translateX(13%)}}@keyframes ripple{0%{transform:scale(0) translateY(-45%) translateX(13%)}to{transform:scale(1) translateY(-45%) translateX(13%)}}.notyf{position:fixed;top:0;left:0;height:100%;width:100%;color:#fff;z-index:9999;display:flex;flex-direction:column;align-items:flex-end;justify-content:flex-end;pointer-events:none;box-sizing:border-box;padding:20px}.notyf__icon--error,.notyf__icon--success{height:21px;width:21px;background:#fff;border-radius:50%;display:block;margin:0 auto;position:relative}.notyf__icon--error:after,.notyf__icon--error:before{content:"";background:currentColor;display:block;position:absolute;width:3px;border-radius:3px;left:9px;height:12px;top:5px}.notyf__icon--error:after{transform:rotate(-45deg)}.notyf__icon--error:before{transform:rotate(45deg)}.notyf__icon--success:after,.notyf__icon--success:before{content:"";background:currentColor;display:block;position:absolute;width:3px;border-radius:3px}.notyf__icon--success:after{height:6px;transform:rotate(-45deg);top:9px;left:6px}.notyf__icon--success:before{height:11px;transform:rotate(45deg);top:5px;left:10px}.notyf__toast{display:block;overflow:hidden;pointer-events:auto;-webkit-animation:notyf-fadeinup .3s ease-in forwards;animation:notyf-fadeinup .3s ease-in forwards;box-shadow:0 3px 7px 0 rgba(0,0,0,.25);position:relative;padding:0 15px;border-radius:2px;max-width:300px;transform:translateY(25%);box-sizing:border-box;flex-shrink:0}.notyf__toast--disappear{transform:translateY(0);-webkit-animation:notyf-fadeoutdown .3s forwards;animation:notyf-fadeoutdown .3s forwards;-webkit-animation-delay:.25s;animation-delay:.25s}.notyf__toast--disappear .notyf__icon,.notyf__toast--disappear .notyf__message{-webkit-animation:notyf-fadeoutdown .3s forwards;animation:notyf-fadeoutdown .3s forwards;opacity:1;transform:translateY(0)}.notyf__toast--disappear .notyf__dismiss{-webkit-animation:notyf-fadeoutright .3s forwards;animation:notyf-fadeoutright .3s forwards;opacity:1;transform:translateX(0)}.notyf__toast--disappear .notyf__message{-webkit-animation-delay:.05s;animation-delay:.05s}.notyf__toast--upper{margin-bottom:20px}.notyf__toast--lower{margin-top:20px}.notyf__toast--dismissible .notyf__wrapper{padding-right:30px}.notyf__ripple{height:400px;width:400px;position:absolute;transform-origin:bottom right;right:0;top:0;border-radius:50%;transform:scale(0) translateY(-51%) translateX(13%);z-index:5;-webkit-animation:ripple .4s ease-out forwards;animation:ripple .4s ease-out forwards}.notyf__wrapper{display:flex;align-items:center;padding-top:17px;padding-bottom:17px;padding-right:15px;border-radius:3px;position:relative;z-index:10}.notyf__icon{width:22px;text-align:center;font-size:1.3em;opacity:0;-webkit-animation:notyf-fadeinup .3s forwards;animation:notyf-fadeinup .3s forwards;-webkit-animation-delay:.3s;animation-delay:.3s;margin-right:13px}.notyf__dismiss{position:absolute;top:0;right:0;height:100%;width:26px;margin-right:-15px;-webkit-animation:notyf-fadeinleft .3s forwards;animation:notyf-fadeinleft .3s forwards;-webkit-animation-delay:.35s;animation-delay:.35s;opacity:0}.notyf__dismiss-btn{background-color:rgba(0,0,0,.25);border:none;cursor:pointer;transition:opacity .2s ease,background-color .2s ease;outline:none;opacity:.35;height:100%;width:100%}.notyf__dismiss-btn:after,.notyf__dismiss-btn:before{content:"";background:#fff;height:12px;width:2px;border-radius:3px;position:absolute;left:calc(50% - 1px);top:calc(50% - 5px)}.notyf__dismiss-btn:after{transform:rotate(-45deg)}.notyf__dismiss-btn:before{transform:rotate(45deg)}.notyf__dismiss-btn:hover{opacity:.7;background-color:rgba(0,0,0,.15)}.notyf__dismiss-btn:active{opacity:.8}.notyf__message{vertical-align:middle;position:relative;opacity:0;-webkit-animation:notyf-fadeinup .3s forwards;animation:notyf-fadeinup .3s forwards;-webkit-animation-delay:.25s;animation-delay:.25s;line-height:1.5em}@media only screen and (max-width:480px){.notyf{padding:0}.notyf__ripple{height:600px;width:600px;-webkit-animation-duration:.5s;animation-duration:.5s}.notyf__toast{max-width:none;border-radius:0;box-shadow:0 -2px 7px 0 rgba(0,0,0,.13);width:100%}.notyf__dismiss{width:56px}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Notyf=function(){"use strict";var e,o=function(){return(o=Object.assign||function(t){for(var i,e=1,n=arguments.length;e<n;e++)for(var o in i=arguments[e])Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o]);return t}).apply(this,arguments)},n=(t.prototype.on=function(t,i){var e=this.listeners[t]||[];this.listeners[t]=e.concat([i])},t.prototype.triggerEvent=function(t,i){var e=this;(this.listeners[t]||[]).forEach(function(t){return t({target:e,event:i})})},t);function t(t){this.options=t,this.listeners={}}(i=e=e||{})[i.Add=0]="Add",i[i.Remove=1]="Remove";var f,i,s=(a.prototype.push=function(t){this.notifications.push(t),this.updateFn(t,e.Add,this.notifications)},a.prototype.splice=function(t,i){i=this.notifications.splice(t,i)[0];return this.updateFn(i,e.Remove,this.notifications),i},a.prototype.indexOf=function(t){return this.notifications.indexOf(t)},a.prototype.onUpdate=function(t){this.updateFn=t},a);function a(){this.notifications=[]}(i=f=f||{}).Dismiss="dismiss";var r={types:[{type:"success",className:"notyf__toast--success",backgroundColor:"#3dc763",icon:{className:"notyf__icon--success",tagName:"i"}},{type:"error",className:"notyf__toast--error",backgroundColor:"#ed3d3d",icon:{className:"notyf__icon--error",tagName:"i"}}],duration:2e3,ripple:!0,position:{x:"right",y:"bottom"},dismissible:!(i.Click="click")},c=(p.prototype.on=function(t,i){var e;this.events=o(o({},this.events),((e={})[t]=i,e))},p.prototype.update=function(t,i){i===e.Add?this.addNotification(t):i===e.Remove&&this.removeNotification(t)},p.prototype.removeNotification=function(t){var i,e,n=this,t=this._popRenderedNotification(t);t&&((e=t.node).classList.add("notyf__toast--disappear"),e.addEventListener(this.animationEndEventName,i=function(t){t.target===e&&(e.removeEventListener(n.animationEndEventName,i),n.container.removeChild(e))}))},p.prototype.addNotification=function(t){var i=this._renderNotification(t);this.notifications.push({notification:t,node:i}),this._announce(t.options.message||"Notification")},p.prototype._renderNotification=function(t){var i=this._buildNotificationCard(t),e=t.options.className;return e&&(t=i.classList).add.apply(t,e.split(" ")),this.container.appendChild(i),i},p.prototype._popRenderedNotification=function(t){for(var i=-1,e=0;e<this.notifications.length&&i<0;e++)this.notifications[e].notification===t&&(i=e);if(-1!==i)return this.notifications.splice(i,1)[0]},p.prototype.getXPosition=function(t){return(null===(t=null==t?void 0:t.position)||void 0===t?void 0:t.x)||"right"},p.prototype.getYPosition=function(t){return(null===(t=null==t?void 0:t.position)||void 0===t?void 0:t.y)||"bottom"},p.prototype.adjustContainerAlignment=function(t){var i=this.X_POSITION_FLEX_MAP[this.getXPosition(t)],e=this.Y_POSITION_FLEX_MAP[this.getYPosition(t)],t=this.container.style;t.setProperty("justify-content",e),t.setProperty("align-items",i)},p.prototype._buildNotificationCard=function(n){var o=this,t=n.options,i=t.icon;this.adjustContainerAlignment(t);var e=this._createHTMLElement({tagName:"div",className:"notyf__toast"}),s=this._createHTMLElement({tagName:"div",className:"notyf__ripple"}),a=this._createHTMLElement({tagName:"div",className:"notyf__wrapper"}),r=this._createHTMLElement({tagName:"div",className:"notyf__message"});r.innerHTML=t.message||"";var c,p,d,l,u=t.background||t.backgroundColor;i&&(c=this._createHTMLElement({tagName:"div",className:"notyf__icon"}),("string"==typeof i||i instanceof String)&&(c.innerHTML=new String(i).valueOf()),"object"==typeof i&&(p=i.tagName,d=i.className,l=i.text,i=void 0===(i=i.color)?u:i,l=this._createHTMLElement({tagName:void 0===p?"i":p,className:d,text:l}),i&&(l.style.color=i),c.appendChild(l)),a.appendChild(c)),a.appendChild(r),e.appendChild(a),u&&(t.ripple?(s.style.background=u,e.appendChild(s)):e.style.background=u),t.dismissible&&(s=this._createHTMLElement({tagName:"div",className:"notyf__dismiss"}),u=this._createHTMLElement({tagName:"button",className:"notyf__dismiss-btn"}),s.appendChild(u),a.appendChild(s),e.classList.add("notyf__toast--dismissible"),u.addEventListener("click",function(t){var i,e;null!==(e=(i=o.events)[f.Dismiss])&&void 0!==e&&e.call(i,{target:n,event:t}),t.stopPropagation()})),e.addEventListener("click",function(t){var i,e;return null===(e=(i=o.events)[f.Click])||void 0===e?void 0:e.call(i,{target:n,event:t})});t="top"===this.getYPosition(t)?"upper":"lower";return e.classList.add("notyf__toast--"+t),e},p.prototype._createHTMLElement=function(t){var i=t.tagName,e=t.className,t=t.text,i=document.createElement(i);return e&&(i.className=e),i.textContent=t||null,i},p.prototype._createA11yContainer=function(){var t=this._createHTMLElement({tagName:"div",className:"notyf-announcer"});t.setAttribute("aria-atomic","true"),t.setAttribute("aria-live","polite"),t.style.border="0",t.style.clip="rect(0 0 0 0)",t.style.height="1px",t.style.margin="-1px",t.style.overflow="hidden",t.style.padding="0",t.style.position="absolute",t.style.width="1px",t.style.outline="0",document.body.appendChild(t),this.a11yContainer=t},p.prototype._announce=function(t){var i=this;this.a11yContainer.textContent="",setTimeout(function(){i.a11yContainer.textContent=t},100)},p.prototype._getAnimationEndEventName=function(){var t,i=document.createElement("_fake"),e={MozTransition:"animationend",OTransition:"oAnimationEnd",WebkitTransition:"webkitAnimationEnd",transition:"animationend"};for(t in e)if(void 0!==i.style[t])return e[t];return"animationend"},p);function p(){this.notifications=[],this.events={},this.X_POSITION_FLEX_MAP={left:"flex-start",center:"center",right:"flex-end"},this.Y_POSITION_FLEX_MAP={top:"flex-start",center:"center",bottom:"flex-end"};var t=document.createDocumentFragment(),i=this._createHTMLElement({tagName:"div",className:"notyf"});t.appendChild(i),document.body.appendChild(t),this.container=i,this.animationEndEventName=this._getAnimationEndEventName(),this._createA11yContainer()}function d(t){var e=this;this.dismiss=this._removeNotification,this.notifications=new s,this.view=new c;var i=this.registerTypes(t);this.options=o(o({},r),t),this.options.types=i,this.notifications.onUpdate(function(t,i){return e.view.update(t,i)}),this.view.on(f.Dismiss,function(t){var i=t.target,t=t.event;e._removeNotification(i),i.triggerEvent(f.Dismiss,t)}),this.view.on(f.Click,function(t){var i=t.target,t=t.event;return i.triggerEvent(f.Click,t)})}return d.prototype.error=function(t){t=this.normalizeOptions("error",t);return this.open(t)},d.prototype.success=function(t){t=this.normalizeOptions("success",t);return this.open(t)},d.prototype.open=function(i){var t=this.options.types.find(function(t){return t.type===i.type})||{},t=o(o({},t),i);this.assignProps(["ripple","position","dismissible"],t);t=new n(t);return this._pushNotification(t),t},d.prototype.dismissAll=function(){for(;this.notifications.splice(0,1););},d.prototype.assignProps=function(t,i){var e=this;t.forEach(function(t){i[t]=(null==i[t]?e.options:i)[t]})},d.prototype._pushNotification=function(t){var i=this;this.notifications.push(t);var e=(void 0!==t.options.duration?t:this).options.duration;e&&setTimeout(function(){return i._removeNotification(t)},e)},d.prototype._removeNotification=function(t){t=this.notifications.indexOf(t);-1!==t&&this.notifications.splice(t,1)},d.prototype.normalizeOptions=function(t,i){t={type:t};return"string"==typeof i?t.message=i:"object"==typeof i&&(t=o(o({},t),i)),t},d.prototype.registerTypes=function(t){var i=(t&&t.types||[]).slice();return r.types.map(function(e){var n=-1;i.forEach(function(t,i){t.type===e.type&&(n=i)});var t=-1!==n?i.splice(n,1)[0]:{};return o(o({},e),t)}).concat(i)},d}();
|