mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
style: compile assets
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
+1
-69
@@ -1,69 +1 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@flasher/flasher'), require('toastr')) :
|
||||
typeof define === 'function' && define.amd ? define(['@flasher/flasher', 'toastr'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.toastr = factory(global.flasher, global.toastr));
|
||||
})(this, (function (flasher, toastr$1) { 'use strict';
|
||||
|
||||
class AbstractPlugin {
|
||||
success(message, title, options) {
|
||||
this.flash('success', message, title, options);
|
||||
}
|
||||
error(message, title, options) {
|
||||
this.flash('error', message, title, options);
|
||||
}
|
||||
info(message, title, options) {
|
||||
this.flash('info', message, title, options);
|
||||
}
|
||||
warning(message, title, options) {
|
||||
this.flash('warning', message, title, options);
|
||||
}
|
||||
flash(type, message, title, options) {
|
||||
if (typeof type === 'object') {
|
||||
options = type;
|
||||
type = options.type;
|
||||
message = options.message;
|
||||
title = options.title;
|
||||
} else if (typeof message === 'object') {
|
||||
options = message;
|
||||
message = options.message;
|
||||
title = options.title;
|
||||
} else if (typeof title === 'object') {
|
||||
options = title;
|
||||
title = options.title;
|
||||
}
|
||||
if (undefined === message) {
|
||||
throw new Error('message option is required');
|
||||
}
|
||||
const envelope = {
|
||||
type,
|
||||
message,
|
||||
title: title || type,
|
||||
options: options || {},
|
||||
metadata: {
|
||||
plugin: ''
|
||||
}
|
||||
};
|
||||
this.renderOptions(options || {});
|
||||
this.renderEnvelopes([envelope]);
|
||||
}
|
||||
}
|
||||
|
||||
class ToastrPlugin extends AbstractPlugin {
|
||||
renderEnvelopes(envelopes) {
|
||||
envelopes.forEach((envelope) => {
|
||||
const { message, title, type, options } = envelope;
|
||||
const instance = toastr$1[type](message, title, options);
|
||||
instance && instance.parent().attr('data-turbo-temporary', '');
|
||||
});
|
||||
}
|
||||
renderOptions(options) {
|
||||
toastr$1.options = Object.assign({ timeOut: (options.timeOut || 5000), progressBar: (options.progressBar || true) }, options);
|
||||
}
|
||||
}
|
||||
|
||||
const toastr = new ToastrPlugin();
|
||||
flasher.addPlugin('toastr', toastr);
|
||||
|
||||
return toastr;
|
||||
|
||||
}));
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("toastr")):"function"==typeof define&&define.amd?define(["@flasher/flasher","toastr"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).toastr=t(e.flasher,e.toastr)}(this,(function(e,t){"use strict";class s{success(e,t,s){this.flash("success",e,t,s)}error(e,t,s){this.flash("error",e,t,s)}info(e,t,s){this.flash("info",e,t,s)}warning(e,t,s){this.flash("warning",e,t,s)}flash(e,t,s,r){if("object"==typeof e?(e=(r=e).type,t=r.message,s=r.title):"object"==typeof t?(t=(r=t).message,s=r.title):"object"==typeof s&&(s=(r=s).title),void 0===t)throw new Error("message option is required");const o={type:e,message:t,title:s||e,options:r||{},metadata:{plugin:""}};this.renderOptions(r||{}),this.renderEnvelopes([o])}}const r=new class extends s{renderEnvelopes(e){e.forEach((e=>{const{message:s,title:r,type:o,options:i}=e,n=t[o](s,r,i);n&&n.parent().attr("data-turbo-temporary","")}))}renderOptions(e){t.options=Object.assign({timeOut:e.timeOut||5e3,progressBar:e.progressBar||!0},e)}};return e.addPlugin("toastr",r),r}));
|
||||
|
||||
+1
-69
@@ -1,69 +1 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@flasher/flasher'), require('toastr')) :
|
||||
typeof define === 'function' && define.amd ? define(['@flasher/flasher', 'toastr'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.toastr = factory(global.flasher, global.toastr));
|
||||
})(this, (function (flasher, toastr$1) { 'use strict';
|
||||
|
||||
class AbstractPlugin {
|
||||
success(message, title, options) {
|
||||
this.flash('success', message, title, options);
|
||||
}
|
||||
error(message, title, options) {
|
||||
this.flash('error', message, title, options);
|
||||
}
|
||||
info(message, title, options) {
|
||||
this.flash('info', message, title, options);
|
||||
}
|
||||
warning(message, title, options) {
|
||||
this.flash('warning', message, title, options);
|
||||
}
|
||||
flash(type, message, title, options) {
|
||||
if (typeof type === 'object') {
|
||||
options = type;
|
||||
type = options.type;
|
||||
message = options.message;
|
||||
title = options.title;
|
||||
} else if (typeof message === 'object') {
|
||||
options = message;
|
||||
message = options.message;
|
||||
title = options.title;
|
||||
} else if (typeof title === 'object') {
|
||||
options = title;
|
||||
title = options.title;
|
||||
}
|
||||
if (undefined === message) {
|
||||
throw new Error('message option is required');
|
||||
}
|
||||
const envelope = {
|
||||
type,
|
||||
message,
|
||||
title: title || type,
|
||||
options: options || {},
|
||||
metadata: {
|
||||
plugin: ''
|
||||
}
|
||||
};
|
||||
this.renderOptions(options || {});
|
||||
this.renderEnvelopes([envelope]);
|
||||
}
|
||||
}
|
||||
|
||||
class ToastrPlugin extends AbstractPlugin {
|
||||
renderEnvelopes(envelopes) {
|
||||
envelopes.forEach((envelope) => {
|
||||
const { message, title, type, options } = envelope;
|
||||
const instance = toastr$1[type](message, title, options);
|
||||
instance && instance.parent().attr('data-turbo-temporary', '');
|
||||
});
|
||||
}
|
||||
renderOptions(options) {
|
||||
toastr$1.options = Object.assign({ timeOut: (options.timeOut || 5000), progressBar: (options.progressBar || true) }, options);
|
||||
}
|
||||
}
|
||||
|
||||
const toastr = new ToastrPlugin();
|
||||
flasher.addPlugin('toastr', toastr);
|
||||
|
||||
return toastr;
|
||||
|
||||
}));
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("toastr")):"function"==typeof define&&define.amd?define(["@flasher/flasher","toastr"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).toastr=t(e.flasher,e.toastr)}(this,(function(e,t){"use strict";class s{success(e,t,s){this.flash("success",e,t,s)}error(e,t,s){this.flash("error",e,t,s)}info(e,t,s){this.flash("info",e,t,s)}warning(e,t,s){this.flash("warning",e,t,s)}flash(e,t,s,r){if("object"==typeof e?(e=(r=e).type,t=r.message,s=r.title):"object"==typeof t?(t=(r=t).message,s=r.title):"object"==typeof s&&(s=(r=s).title),void 0===t)throw new Error("message option is required");const o={type:e,message:t,title:s||e,options:r||{},metadata:{plugin:""}};this.renderOptions(r||{}),this.renderEnvelopes([o])}}const r=new class extends s{renderEnvelopes(e){e.forEach((e=>{const{message:s,title:r,type:o,options:i}=e,n=t[o](s,r,i);n&&n.parent().attr("data-turbo-temporary","")}))}renderOptions(e){t.options=Object.assign({timeOut:e.timeOut||5e3,progressBar:e.progressBar||!0},e)}};return e.addPlugin("toastr",r),r}));
|
||||
|
||||
Reference in New Issue
Block a user