You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
700 lines
23 KiB
700 lines
23 KiB
(function (global, factory) {
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PNotifyDesktop = {}));
|
|
}(this, (function (exports) { 'use strict';
|
|
|
|
function _typeof(obj) {
|
|
"@babel/helpers - typeof";
|
|
|
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
_typeof = function (obj) {
|
|
return typeof obj;
|
|
};
|
|
} else {
|
|
_typeof = function (obj) {
|
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
};
|
|
}
|
|
|
|
return _typeof(obj);
|
|
}
|
|
|
|
function _classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) {
|
|
throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
}
|
|
|
|
function _defineProperties(target, props) {
|
|
for (var i = 0; i < props.length; i++) {
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
descriptor.configurable = true;
|
|
if ("value" in descriptor) descriptor.writable = true;
|
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
}
|
|
}
|
|
|
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
return Constructor;
|
|
}
|
|
|
|
function _inherits(subClass, superClass) {
|
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
throw new TypeError("Super expression must either be null or a function");
|
|
}
|
|
|
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
constructor: {
|
|
value: subClass,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
}
|
|
|
|
function _getPrototypeOf(o) {
|
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
};
|
|
return _getPrototypeOf(o);
|
|
}
|
|
|
|
function _setPrototypeOf(o, p) {
|
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
o.__proto__ = p;
|
|
return o;
|
|
};
|
|
|
|
return _setPrototypeOf(o, p);
|
|
}
|
|
|
|
function _isNativeReflectConstruct() {
|
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
if (Reflect.construct.sham) return false;
|
|
if (typeof Proxy === "function") return true;
|
|
|
|
try {
|
|
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function _assertThisInitialized(self) {
|
|
if (self === void 0) {
|
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
function _possibleConstructorReturn(self, call) {
|
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
return call;
|
|
}
|
|
|
|
return _assertThisInitialized(self);
|
|
}
|
|
|
|
function _createSuper(Derived) {
|
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
|
|
return function _createSuperInternal() {
|
|
var Super = _getPrototypeOf(Derived),
|
|
result;
|
|
|
|
if (hasNativeReflectConstruct) {
|
|
var NewTarget = _getPrototypeOf(this).constructor;
|
|
|
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
} else {
|
|
result = Super.apply(this, arguments);
|
|
}
|
|
|
|
return _possibleConstructorReturn(this, result);
|
|
};
|
|
}
|
|
|
|
function _toConsumableArray(arr) {
|
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
}
|
|
|
|
function _arrayWithoutHoles(arr) {
|
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
}
|
|
|
|
function _iterableToArray(iter) {
|
|
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
}
|
|
|
|
function _unsupportedIterableToArray(o, minLen) {
|
|
if (!o) return;
|
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
}
|
|
|
|
function _arrayLikeToArray(arr, len) {
|
|
if (len == null || len > arr.length) len = arr.length;
|
|
|
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
|
|
return arr2;
|
|
}
|
|
|
|
function _nonIterableSpread() {
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
|
|
function noop() {}
|
|
|
|
function run(fn) {
|
|
return fn();
|
|
}
|
|
|
|
function blank_object() {
|
|
return Object.create(null);
|
|
}
|
|
|
|
function run_all(fns) {
|
|
fns.forEach(run);
|
|
}
|
|
|
|
function is_function(thing) {
|
|
return typeof thing === 'function';
|
|
}
|
|
|
|
function safe_not_equal(a, b) {
|
|
return a != a ? b == b : a !== b || a && _typeof(a) === 'object' || typeof a === 'function';
|
|
}
|
|
|
|
function is_empty(obj) {
|
|
return Object.keys(obj).length === 0;
|
|
}
|
|
|
|
function detach(node) {
|
|
node.parentNode.removeChild(node);
|
|
}
|
|
|
|
function children(element) {
|
|
return Array.from(element.childNodes);
|
|
}
|
|
|
|
var current_component;
|
|
|
|
function set_current_component(component) {
|
|
current_component = component;
|
|
}
|
|
|
|
var dirty_components = [];
|
|
var binding_callbacks = [];
|
|
var render_callbacks = [];
|
|
var flush_callbacks = [];
|
|
var resolved_promise = Promise.resolve();
|
|
var update_scheduled = false;
|
|
|
|
function schedule_update() {
|
|
if (!update_scheduled) {
|
|
update_scheduled = true;
|
|
resolved_promise.then(flush);
|
|
}
|
|
}
|
|
|
|
function add_render_callback(fn) {
|
|
render_callbacks.push(fn);
|
|
}
|
|
|
|
var flushing = false;
|
|
var seen_callbacks = new Set();
|
|
|
|
function flush() {
|
|
if (flushing) return;
|
|
flushing = true;
|
|
|
|
do {
|
|
// first, call beforeUpdate functions
|
|
// and update components
|
|
for (var i = 0; i < dirty_components.length; i += 1) {
|
|
var component = dirty_components[i];
|
|
set_current_component(component);
|
|
update(component.$$);
|
|
}
|
|
|
|
set_current_component(null);
|
|
dirty_components.length = 0;
|
|
|
|
while (binding_callbacks.length) {
|
|
binding_callbacks.pop()();
|
|
} // then, once components are updated, call
|
|
// afterUpdate functions. This may cause
|
|
// subsequent updates...
|
|
|
|
|
|
for (var _i = 0; _i < render_callbacks.length; _i += 1) {
|
|
var callback = render_callbacks[_i];
|
|
|
|
if (!seen_callbacks.has(callback)) {
|
|
// ...so guard against infinite loops
|
|
seen_callbacks.add(callback);
|
|
callback();
|
|
}
|
|
}
|
|
|
|
render_callbacks.length = 0;
|
|
} while (dirty_components.length);
|
|
|
|
while (flush_callbacks.length) {
|
|
flush_callbacks.pop()();
|
|
}
|
|
|
|
update_scheduled = false;
|
|
flushing = false;
|
|
seen_callbacks.clear();
|
|
}
|
|
|
|
function update($$) {
|
|
if ($$.fragment !== null) {
|
|
$$.update();
|
|
run_all($$.before_update);
|
|
var dirty = $$.dirty;
|
|
$$.dirty = [-1];
|
|
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
|
$$.after_update.forEach(add_render_callback);
|
|
}
|
|
}
|
|
|
|
var outroing = new Set();
|
|
|
|
function transition_in(block, local) {
|
|
if (block && block.i) {
|
|
outroing["delete"](block);
|
|
block.i(local);
|
|
}
|
|
}
|
|
|
|
function mount_component(component, target, anchor) {
|
|
var _component$$$ = component.$$,
|
|
fragment = _component$$$.fragment,
|
|
on_mount = _component$$$.on_mount,
|
|
on_destroy = _component$$$.on_destroy,
|
|
after_update = _component$$$.after_update;
|
|
fragment && fragment.m(target, anchor); // onMount happens before the initial afterUpdate
|
|
|
|
add_render_callback(function () {
|
|
var new_on_destroy = on_mount.map(run).filter(is_function);
|
|
|
|
if (on_destroy) {
|
|
on_destroy.push.apply(on_destroy, _toConsumableArray(new_on_destroy));
|
|
} else {
|
|
// Edge case - component was destroyed immediately,
|
|
// most likely as a result of a binding initialising
|
|
run_all(new_on_destroy);
|
|
}
|
|
|
|
component.$$.on_mount = [];
|
|
});
|
|
after_update.forEach(add_render_callback);
|
|
}
|
|
|
|
function destroy_component(component, detaching) {
|
|
var $$ = component.$$;
|
|
|
|
if ($$.fragment !== null) {
|
|
run_all($$.on_destroy);
|
|
$$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to
|
|
// preserve final state?)
|
|
|
|
$$.on_destroy = $$.fragment = null;
|
|
$$.ctx = [];
|
|
}
|
|
}
|
|
|
|
function make_dirty(component, i) {
|
|
if (component.$$.dirty[0] === -1) {
|
|
dirty_components.push(component);
|
|
schedule_update();
|
|
component.$$.dirty.fill(0);
|
|
}
|
|
|
|
component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
|
|
}
|
|
|
|
function init(component, options, instance, create_fragment, not_equal, props) {
|
|
var dirty = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [-1];
|
|
var parent_component = current_component;
|
|
set_current_component(component);
|
|
var prop_values = options.props || {};
|
|
var $$ = component.$$ = {
|
|
fragment: null,
|
|
ctx: null,
|
|
// state
|
|
props: props,
|
|
update: noop,
|
|
not_equal: not_equal,
|
|
bound: blank_object(),
|
|
// lifecycle
|
|
on_mount: [],
|
|
on_destroy: [],
|
|
before_update: [],
|
|
after_update: [],
|
|
context: new Map(parent_component ? parent_component.$$.context : []),
|
|
// everything else
|
|
callbacks: blank_object(),
|
|
dirty: dirty,
|
|
skip_bound: false
|
|
};
|
|
var ready = false;
|
|
$$.ctx = instance ? instance(component, prop_values, function (i, ret) {
|
|
var value = (arguments.length <= 2 ? 0 : arguments.length - 2) ? arguments.length <= 2 ? undefined : arguments[2] : ret;
|
|
|
|
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
|
|
if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
|
|
if (ready) make_dirty(component, i);
|
|
}
|
|
|
|
return ret;
|
|
}) : [];
|
|
$$.update();
|
|
ready = true;
|
|
run_all($$.before_update); // `false` as a special case of no DOM component
|
|
|
|
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
|
|
|
|
if (options.target) {
|
|
if (options.hydrate) {
|
|
var nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
|
$$.fragment && $$.fragment.l(nodes);
|
|
nodes.forEach(detach);
|
|
} else {
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
$$.fragment && $$.fragment.c();
|
|
}
|
|
|
|
if (options.intro) transition_in(component.$$.fragment);
|
|
mount_component(component, options.target, options.anchor);
|
|
flush();
|
|
}
|
|
|
|
set_current_component(parent_component);
|
|
}
|
|
|
|
var SvelteComponent = /*#__PURE__*/function () {
|
|
function SvelteComponent() {
|
|
_classCallCheck(this, SvelteComponent);
|
|
}
|
|
|
|
_createClass(SvelteComponent, [{
|
|
key: "$destroy",
|
|
value: function $destroy() {
|
|
destroy_component(this, 1);
|
|
this.$destroy = noop;
|
|
}
|
|
}, {
|
|
key: "$on",
|
|
value: function $on(type, callback) {
|
|
var callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
|
|
callbacks.push(callback);
|
|
return function () {
|
|
var index = callbacks.indexOf(callback);
|
|
if (index !== -1) callbacks.splice(index, 1);
|
|
};
|
|
}
|
|
}, {
|
|
key: "$set",
|
|
value: function $set($$props) {
|
|
if (this.$$set && !is_empty($$props)) {
|
|
this.$$.skip_bound = true;
|
|
this.$$set($$props);
|
|
this.$$.skip_bound = false;
|
|
}
|
|
}
|
|
}]);
|
|
|
|
return SvelteComponent;
|
|
}();
|
|
|
|
var position = "PrependContainer";
|
|
var defaults = {
|
|
fallback: true,
|
|
icon: null,
|
|
tag: null,
|
|
title: null,
|
|
text: null,
|
|
options: {}
|
|
};
|
|
|
|
function requestPermission() {
|
|
if (typeof Notification !== "undefined" && "requestPermission" in Notification) {
|
|
Notification.requestPermission();
|
|
} else if ("webkitNotifications" in window) {
|
|
window.webkitNotifications.requestPermission();
|
|
}
|
|
}
|
|
|
|
var Notification = window.Notification;
|
|
|
|
var _notify = function notify(title, options, onclick, onclose) {
|
|
// Memoize based on feature detection.
|
|
if ("Notification" in window) {
|
|
_notify = function notify(title, options, onclick, onclose) {
|
|
var notice = new Notification(title, options);
|
|
|
|
if ("NotificationEvent" in window) {
|
|
notice.addEventListener("notificationclick", onclick);
|
|
notice.addEventListener("close", onclose);
|
|
} else if ("addEventListener" in notice) {
|
|
notice.addEventListener("click", onclick);
|
|
notice.addEventListener("close", onclose);
|
|
} else {
|
|
notice.onclick = onclick;
|
|
notice.onclose = onclose;
|
|
}
|
|
|
|
return notice;
|
|
};
|
|
} else if ("mozNotification" in navigator) {
|
|
_notify = function notify(title, options, onclick, onclose) {
|
|
// Gecko < 22
|
|
var notice = navigator.mozNotification.createNotification(title, options.body, options.icon).show();
|
|
notice.onclick = onclick;
|
|
notice.onclose = onclose;
|
|
return notice;
|
|
};
|
|
} else if ("webkitNotifications" in window) {
|
|
_notify = function notify(title, options, onclick, onclose) {
|
|
var notice = window.webkitNotifications.createNotification(options.icon, title, options.body);
|
|
notice.onclick = onclick;
|
|
notice.onclose = onclose;
|
|
return notice;
|
|
};
|
|
} else {
|
|
_notify = function notify(title, options, onclick, onclose) {
|
|
return null;
|
|
};
|
|
}
|
|
|
|
return _notify(title, options, onclick, onclose);
|
|
};
|
|
|
|
function checkPermission() {
|
|
if (typeof Notification !== "undefined" && "permission" in Notification) {
|
|
return Notification.permission === "granted";
|
|
} else if ("webkitNotifications" in window) {
|
|
return window.webkitNotifications.checkPermission() == 0;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
var _permission = checkPermission();
|
|
|
|
function instance($$self, $$props, $$invalidate) {
|
|
var _$$props$self = $$props.self,
|
|
self = _$$props$self === void 0 ? null : _$$props$self;
|
|
var _$$props$fallback = $$props.fallback,
|
|
fallback = _$$props$fallback === void 0 ? defaults.fallback : _$$props$fallback;
|
|
var _$$props$icon = $$props.icon,
|
|
icon = _$$props$icon === void 0 ? defaults.icon : _$$props$icon;
|
|
var _$$props$tag = $$props.tag,
|
|
tag = _$$props$tag === void 0 ? defaults.tag : _$$props$tag;
|
|
var _$$props$title = $$props.title,
|
|
title = _$$props$title === void 0 ? defaults.title : _$$props$title;
|
|
var _$$props$text = $$props.text,
|
|
text = _$$props$text === void 0 ? defaults.text : _$$props$text;
|
|
var _$$props$options = $$props.options,
|
|
options = _$$props$options === void 0 ? defaults.options : _$$props$options;
|
|
|
|
var _desktop; // Animation should always be 'none' for desktop notices, but remember
|
|
// the old animation so it can be recovered.
|
|
|
|
|
|
var _oldAnimation = "none";
|
|
|
|
var _icon;
|
|
|
|
var _tag;
|
|
|
|
self.on("pnotify:beforeOpen", function () {
|
|
if (!_permission) {
|
|
requestPermission();
|
|
return;
|
|
}
|
|
|
|
if (_desktop && "show" in _desktop) {
|
|
self.setModuleOpen(true);
|
|
|
|
_desktop.show();
|
|
}
|
|
});
|
|
self.on("pnotify:beforeClose", function () {
|
|
if (!_permission) {
|
|
return;
|
|
}
|
|
|
|
if (_desktop && "close" in _desktop) {
|
|
_desktop.close();
|
|
|
|
self.setModuleOpen(false);
|
|
}
|
|
});
|
|
_permission = checkPermission();
|
|
|
|
if (_permission) {
|
|
self.addModuleClass("elem", "pnotify-desktop-hide");
|
|
self.animation = "none";
|
|
genNotice();
|
|
} else if (!fallback) {
|
|
// Keep the notice from opening if fallback is false.
|
|
self.autoOpen = false;
|
|
}
|
|
|
|
function genNotice() {
|
|
if (icon === null) {
|
|
switch (self.type) {
|
|
case "error":
|
|
_icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQg7e6HvQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABr0lEQVRYw8WXu0oDQRSGv7hRSFYrLTTWKihaqUgUJO+gphBLL1jYpPSCVcAggpWthYhC7Ows9An0IbSPkMRCw8ZmFuI6yczs9cAPuzNz5v92brtrESxGARtokkCcAg2hk7jNl4G2R/m4zFPAiwTgWdRFHnmJuaulOAAaPQDqUZvv9DB3tR0lwIcGwHtU5uca5q4qYZvngJbHpAZ8CtU8dS1gLEyAisegBGTFKWiL65KnzVlY5uOSId6VtNuTtMupOu/TAHiQlNmSskHNXCOAGWBeUp7VhFoApoMAXAOWJoCszBJ9+ALY6vL0JiPgjsKmKUAaOOoBZwIAcNxlJLsCrAOTIQJMAWu62y4LOIqT7lGS96TIcYCMDkBZ46h1gB+PHI28ssq8X/G6DaqG8Piz2DrjVjGXbtSBy46F5QAHwJAizwZugKKscs7gSaqS/KpB/qxsFxwafhf6Odb/eblJi8BGwJdW26BtURxQpMU83hmaDQsNiPtvYMSwj3tgAqDgYzU7wJdHjo9+CgBvEW47lV5Tgj5DMtG0xIfESkIAF+522gdWxTzGEX3i9+6KpOMXF5UBt0NKJCAAAAAASUVORK5CYII=";
|
|
break;
|
|
|
|
case "success":
|
|
_icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQPRj+65AAAAdBJREFUWMPtlzsvRFEQx3+7HmEjoiYKolVJJDRqnS8ggvVIVEQhCIUsEYJGCEH2E4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LpgTMVbqC24B54Bi4twV9E6cnDcw6PFj+RSo/l6rlSlldhx4AAAAASUVORK5CYII=";
|
|
break;
|
|
}
|
|
} else if (icon === false) {
|
|
_icon = null;
|
|
} else {
|
|
_icon = icon;
|
|
}
|
|
|
|
if (!_tag || tag !== null) {
|
|
_tag = tag === null ? "PNotify-".concat(Math.round(Math.random() * 1000000)) : tag;
|
|
}
|
|
|
|
var desktopOptions = {
|
|
body: text || self.text,
|
|
tag: _tag
|
|
};
|
|
|
|
if (!self.hide) {
|
|
desktopOptions.requireInteraction = true;
|
|
}
|
|
|
|
if (_icon !== null) {
|
|
desktopOptions.icon = _icon;
|
|
}
|
|
|
|
Object.apply(desktopOptions, options);
|
|
_desktop = _notify(title || self.title, desktopOptions, function () {
|
|
self.fire && self.fire("click", {
|
|
target: _desktop
|
|
});
|
|
}, function () {
|
|
self.close && self.close();
|
|
});
|
|
|
|
if (!("close" in _desktop) && "cancel" in _desktop) {
|
|
_desktop.close = function () {
|
|
_desktop.cancel();
|
|
};
|
|
}
|
|
}
|
|
|
|
$$self.$$set = function ($$props) {
|
|
if ("self" in $$props) $$invalidate(0, self = $$props.self);
|
|
if ("fallback" in $$props) $$invalidate(1, fallback = $$props.fallback);
|
|
if ("icon" in $$props) $$invalidate(2, icon = $$props.icon);
|
|
if ("tag" in $$props) $$invalidate(3, tag = $$props.tag);
|
|
if ("title" in $$props) $$invalidate(4, title = $$props.title);
|
|
if ("text" in $$props) $$invalidate(5, text = $$props.text);
|
|
if ("options" in $$props) $$invalidate(6, options = $$props.options);
|
|
};
|
|
|
|
$$self.$$.update = function () {
|
|
if ($$self.$$.dirty &
|
|
/*self, _permission, _oldAnimation*/
|
|
257) {
|
|
{
|
|
if (self.animation !== "none") {
|
|
$$invalidate(8, _oldAnimation = self.animation);
|
|
} // This is necessary so desktop notices don't cause spacing problems
|
|
// when positioning.
|
|
|
|
|
|
if (self.getAnimatingClass() !== "" && _permission) {
|
|
self.setAnimatingClass("");
|
|
}
|
|
|
|
if (!_permission && self.hasModuleClass("elem", "pnotify-desktop-hide")) {
|
|
self.removeModuleClass("elem", "pnotify-desktop-hide");
|
|
$$invalidate(0, self.animation = _oldAnimation, self);
|
|
} else if (_permission && !self.hasModuleClass("elem", "pnotify-desktop-hide")) {
|
|
self.addModuleClass("elem", "pnotify-desktop-hide");
|
|
$$invalidate(0, self.animation = "none", self);
|
|
genNotice();
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($$self.$$.dirty &
|
|
/*self, _permission*/
|
|
1) {
|
|
{
|
|
self.setModuleHandled(_permission);
|
|
}
|
|
}
|
|
};
|
|
|
|
return [self, fallback, icon, tag, title, text, options];
|
|
}
|
|
|
|
var Desktop = /*#__PURE__*/function (_SvelteComponent) {
|
|
_inherits(Desktop, _SvelteComponent);
|
|
|
|
var _super = _createSuper(Desktop);
|
|
|
|
function Desktop(options) {
|
|
var _this;
|
|
|
|
_classCallCheck(this, Desktop);
|
|
|
|
_this = _super.call(this);
|
|
init(_assertThisInitialized(_this), options, instance, null, safe_not_equal, {
|
|
self: 0,
|
|
fallback: 1,
|
|
icon: 2,
|
|
tag: 3,
|
|
title: 4,
|
|
text: 5,
|
|
options: 6
|
|
});
|
|
return _this;
|
|
}
|
|
|
|
return Desktop;
|
|
}(SvelteComponent);
|
|
|
|
exports.default = Desktop;
|
|
exports.defaults = defaults;
|
|
exports.permission = requestPermission;
|
|
exports.position = position;
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
})));
|