mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"dist/main.css": "/dist/main.28df35f9.css",
|
||||
"dist/main.js": "/dist/main.3be5bc06.js",
|
||||
"dist/main.css": "/dist/main.fdaa6615.css",
|
||||
"dist/main.js": "/dist/main.70b93173.js",
|
||||
"dist/455.3a7b4474.css": "/dist/455.3a7b4474.css",
|
||||
"dist/455.095e6545.js": "/dist/455.095e6545.js",
|
||||
"dist/411.29cd993e.css": "/dist/411.29cd993e.css",
|
||||
|
||||
+12
-4
@@ -49,6 +49,7 @@
|
||||
Add elegant notifications to your Laravel or Symfony applications with just <span class="bg-indigo-50 text-indigo-700 px-2 py-1 rounded">one line of code</span>. Perfect for developers of all skill levels.
|
||||
</p>
|
||||
|
||||
<!--
|
||||
<div class="flex flex-wrap gap-3 justify-center mb-8">
|
||||
<a href="#quick-start" class="px-5 py-3 bg-indigo-600 hover:bg-indigo-700 text-white font-medium rounded-lg transition-colors duration-200 shadow-md hover:shadow-lg flex items-center">
|
||||
<i class="fa-solid fa-rocket mr-2"></i> Get Started
|
||||
@@ -57,6 +58,7 @@
|
||||
<i class="fa-brands fa-github mr-2"></i> View on GitHub
|
||||
</a>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="flex flex-wrap justify-center gap-3">
|
||||
<a href="https://www.linkedin.com/in/younes--ennaji/" class="text-slate-500 hover:text-indigo-700 transition-colors duration-200">
|
||||
@@ -454,7 +456,7 @@
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-10">
|
||||
<a href="/libraries/" class="inline-flex items-center px-6 py-3 bg-white border border-slate-200 hover:bg-slate-50 text-slate-700 rounded-lg font-medium transition-colors duration-200 shadow-sm">
|
||||
<a href="/library/toastr/" class="inline-flex items-center px-6 py-3 bg-white border border-slate-200 hover:bg-slate-50 text-slate-700 rounded-lg font-medium transition-colors duration-200 shadow-sm">
|
||||
<i class="fa-solid fa-th-large mr-2"></i> Compare all libraries
|
||||
</a>
|
||||
</div>
|
||||
@@ -482,9 +484,9 @@
|
||||
<div>
|
||||
<pre class="bg-slate-50 rounded-lg p-4 text-sm overflow-x-auto"><code class="language-php">namespace App\Http\Controllers;
|
||||
|
||||
class ProfileController extends Controller
|
||||
class ProfileController
|
||||
{
|
||||
public function update(Request $request)
|
||||
public function update()
|
||||
{
|
||||
// Update user profile logic
|
||||
|
||||
@@ -494,6 +496,12 @@ class ProfileController extends Controller
|
||||
// Or add a title
|
||||
flash()->success('Your changes have been saved.', 'Profile Updated');
|
||||
|
||||
// Or add a title and options
|
||||
flash()
|
||||
->option('timeout', 5000)
|
||||
->option('position', 'top-right')
|
||||
->success('Changes saved with custom settings');
|
||||
|
||||
// Change notification options
|
||||
flash()->options([
|
||||
'timeout' => 5000,
|
||||
@@ -657,7 +665,7 @@ document.getElementById('contact-form').addEventListener('submit', async functio
|
||||
</a>
|
||||
|
||||
<!-- Documentation -->
|
||||
<a href="/docs/" class="group bg-white rounded-xl shadow-md hover:shadow-lg transition-all duration-300 border border-slate-100 p-8 flex flex-col items-center text-center transform hover:-translate-y-1">
|
||||
<a href="/laravel" class="group bg-white rounded-xl shadow-md hover:shadow-lg transition-all duration-300 border border-slate-100 p-8 flex flex-col items-center text-center transform hover:-translate-y-1">
|
||||
<div class="w-16 h-16 bg-amber-50 rounded-full flex items-center justify-center mb-5 group-hover:bg-amber-100 transition-colors">
|
||||
<i class="fa-solid fa-book-open text-amber-600 text-3xl"></i>
|
||||
</div>
|
||||
|
||||
@@ -340,21 +340,21 @@ class ContactForm extends Component
|
||||
<label for="name" class="block text-sm font-medium text-gray-700">Name</label>
|
||||
<input type="text" id="name" wire:model="name"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
|
||||
@error('name') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
|
||||
@error('name') <span class="text-red-500 text-xs">{% raw %}{{ $message }}{% endraw %}</span> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
|
||||
<input type="email" id="email" wire:model="email"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
|
||||
@error('email') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
|
||||
@error('email') <span class="text-red-500 text-xs">{% raw %}{{ $message }}{% endraw %}</span> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="message" class="block text-sm font-medium text-gray-700">Message</label>
|
||||
<textarea id="message" wire:model="message" rows="4"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm"></textarea>
|
||||
@error('message') <span class="text-red-500 text-xs">{{ $message }}</span> @enderror
|
||||
@error('message') <span class="text-red-500 text-xs">{% raw %}{{ $message }}{% endraw %}</span> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -684,7 +684,7 @@ class TasksComponent extends Component
|
||||
<div class="text-white opacity-80 text-xs font-medium">nav-link.blade.php</div>
|
||||
</div>
|
||||
<div>
|
||||
<pre class="bg-slate-50 rounded-lg p-4 text-sm overflow-x-auto"><code class="language-html"><a href="{{ route('dashboard') }}" wire:navigate>Dashboard</a>
|
||||
<pre class="bg-slate-50 rounded-lg p-4 text-sm overflow-x-auto"><code class="language-html"><a href="{% raw %}{{ route('dashboard') }}{% endraw %}" wire:navigate>Dashboard</a>
|
||||
|
||||
<!-- In your component -->
|
||||
<script>
|
||||
@@ -827,7 +827,7 @@ class PublishArticle extends Component
|
||||
<pre class="bg-slate-50 rounded-lg p-3 text-xs overflow-x-auto"><code class="language-php">@if (session('status'))
|
||||
<script>
|
||||
document.addEventListener('livewire:initialized', () => {
|
||||
flasher.success('{{ session('status') }}');
|
||||
flasher.success('{% raw %}{{ session('status') }}{% endraw %}');
|
||||
});
|
||||
</script>
|
||||
@endif</code></pre>
|
||||
|
||||
Vendored
+2
-2
@@ -2,10 +2,10 @@
|
||||
"entrypoints": {
|
||||
"main": {
|
||||
"css": [
|
||||
"/dist/main.28df35f9.css"
|
||||
"/dist/main.fdaa6615.css"
|
||||
],
|
||||
"js": [
|
||||
"/dist/main.3be5bc06.js"
|
||||
"/dist/main.70b93173.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
-2
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
+21
-21
@@ -16,10 +16,10 @@
|
||||
"@flasher/flasher-toastr": "file:../src/Toastr/Prime/Resources",
|
||||
"@hotwired/stimulus": "^3.2.2",
|
||||
"@symfony/stimulus-bridge": "^3.2.3",
|
||||
"@symfony/webpack-encore": "^5.0.1",
|
||||
"@symfony/webpack-encore": "^5.1.0",
|
||||
"noty": "^3.2.0-beta-deprecated",
|
||||
"notyf": "^3.10.0",
|
||||
"prismjs": "^1.29.0",
|
||||
"prismjs": "^1.30.0",
|
||||
"sweetalert2": "^11.6.13",
|
||||
"toastr": "^2.1.4"
|
||||
},
|
||||
@@ -432,14 +432,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helpers": {
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz",
|
||||
"integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==",
|
||||
"version": "7.26.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz",
|
||||
"integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.26.9",
|
||||
"@babel/types": "^7.26.9"
|
||||
"@babel/types": "^7.26.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -1544,9 +1544,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz",
|
||||
"integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==",
|
||||
"version": "7.26.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz",
|
||||
"integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
@@ -1591,9 +1591,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz",
|
||||
"integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==",
|
||||
"version": "7.26.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz",
|
||||
"integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
@@ -2661,9 +2661,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.7.9",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
|
||||
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
|
||||
"version": "1.8.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz",
|
||||
"integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -6327,9 +6327,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prismjs": {
|
||||
"version": "1.29.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
|
||||
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
|
||||
"version": "1.30.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz",
|
||||
"integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
@@ -7119,9 +7119,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/sweetalert2": {
|
||||
"version": "11.17.2",
|
||||
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.17.2.tgz",
|
||||
"integrity": "sha512-HKxDr1IyV3Lxr3W6sb61qm/p2epFIEdr5EKwteRFHnIg6f8nHFl2kX++DBVz16Mac+fFiU3hMpjq1L6yE2Ge5w==",
|
||||
"version": "11.6.13",
|
||||
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.6.13.tgz",
|
||||
"integrity": "sha512-n5yVF0FNx1lm4XzpPyb1HIaiptzODfVyeCzmB809tpK+1bPdoKoevKOxYjrtId75DV7xuIp4r6cjn8xUAB8dPQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
|
||||
+2
-2
@@ -20,10 +20,10 @@
|
||||
"@flasher/flasher-toastr": "file:../src/Toastr/Prime/Resources",
|
||||
"@hotwired/stimulus": "^3.2.2",
|
||||
"@symfony/stimulus-bridge": "^3.2.3",
|
||||
"@symfony/webpack-encore": "^5.0.1",
|
||||
"@symfony/webpack-encore": "^5.1.0",
|
||||
"noty": "^3.2.0-beta-deprecated",
|
||||
"notyf": "^3.10.0",
|
||||
"prismjs": "^1.29.0",
|
||||
"prismjs": "^1.30.0",
|
||||
"sweetalert2": "^11.6.13",
|
||||
"toastr": "^2.1.4"
|
||||
},
|
||||
|
||||
Generated
+4
-4
@@ -26,7 +26,7 @@
|
||||
"@rollup/plugin-strip": "^3.0.4",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@types/node": "^22.13.10",
|
||||
"@types/node": "^22.13.11",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"all-contributors-cli": "^6.26.1",
|
||||
@@ -3859,9 +3859,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.13.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz",
|
||||
"integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==",
|
||||
"version": "22.13.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.11.tgz",
|
||||
"integrity": "sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@
|
||||
"@rollup/plugin-strip": "^3.0.4",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@types/node": "^22.13.10",
|
||||
"@types/node": "^22.13.11",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"all-contributors-cli": "^6.26.1",
|
||||
|
||||
+20
-7
@@ -39,17 +39,27 @@ class AbstractPlugin {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -57,10 +67,13 @@ class AbstractPlugin {
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
+20
-7
@@ -42,17 +42,27 @@
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -60,10 +70,13 @@
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("noty")):"function"==typeof define&&define.amd?define(["@flasher/flasher","noty"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Noty=t(e.flasher,e.Noty)}(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,o){let i,n,r,a={};if("object"==typeof e?(a=Object.assign({},e),i=a.type,n=a.message,r=a.title,delete a.type,delete a.message,delete a.title):"object"==typeof t?(a=Object.assign({},t),i=e,n=a.message,r=a.title,delete a.message,delete a.title):"object"==typeof s?(a=Object.assign({},s),i=e,n=t,r=a.title,delete a.title):(i=e,n=t,r=s,a=o||{}),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");const l={type:i,message:n,title:r||i,options:a,metadata:{plugin:""}};this.renderOptions(a),this.renderEnvelopes([l])}}const o=new class extends s{constructor(){super(...arguments),this.defaultOptions={timeout:1e4}}renderEnvelopes(e){(null==e?void 0:e.length)&&e.forEach((e=>{try{const s=Object.assign({text:e.message,type:e.type},this.defaultOptions);e.options&&Object.assign(s,e.options);const o=new t(s);o.show();const i=o.layoutDom;i&&"object"==typeof i.dataset&&(i.dataset.turboTemporary="")}catch(t){console.error("PHPFlasher Noty: Error rendering notification",t,e)}}))}renderOptions(e){e&&(Object.assign(this.defaultOptions,e),t.overrideDefaults(this.defaultOptions))}};return e.addPlugin("noty",o),o}));
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("noty")):"function"==typeof define&&define.amd?define(["@flasher/flasher","noty"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Noty=t(e.flasher,e.Noty)}(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,o){let i,n,r,l={};if("object"==typeof e?(l=Object.assign({},e),i=l.type,n=l.message,r=l.title,delete l.type,delete l.message,delete l.title):"object"==typeof t?(l=Object.assign({},t),i=e,n=l.message,r=l.title,delete l.message,delete l.title):(i=e,n=t,null==s?(r=void 0,l=o||{}):"string"==typeof s?(r=s,l=o||{}):"object"==typeof s&&(l=Object.assign({},s),"title"in l?(r=l.title,delete l.title):r=void 0,o&&"object"==typeof o&&(l=Object.assign(Object.assign({},l),o)))),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");null==r&&(r=i.charAt(0).toUpperCase()+i.slice(1));const a={type:i,message:n,title:r,options:l,metadata:{plugin:""}};this.renderOptions(l),this.renderEnvelopes([a])}}const o=new class extends s{constructor(){super(...arguments),this.defaultOptions={timeout:1e4}}renderEnvelopes(e){(null==e?void 0:e.length)&&e.forEach((e=>{try{const s=Object.assign({text:e.message,type:e.type},this.defaultOptions);e.options&&Object.assign(s,e.options);const o=new t(s);o.show();const i=o.layoutDom;i&&"object"==typeof i.dataset&&(i.dataset.turboTemporary="")}catch(t){console.error("PHPFlasher Noty: Error rendering notification",t,e)}}))}renderOptions(e){e&&(Object.assign(this.defaultOptions,e),t.overrideDefaults(this.defaultOptions))}};return e.addPlugin("noty",o),o}));
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("noty")):"function"==typeof define&&define.amd?define(["@flasher/flasher","noty"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Noty=t(e.flasher,e.Noty)}(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,o){let i,n,r,a={};if("object"==typeof e?(a=Object.assign({},e),i=a.type,n=a.message,r=a.title,delete a.type,delete a.message,delete a.title):"object"==typeof t?(a=Object.assign({},t),i=e,n=a.message,r=a.title,delete a.message,delete a.title):"object"==typeof s?(a=Object.assign({},s),i=e,n=t,r=a.title,delete a.title):(i=e,n=t,r=s,a=o||{}),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");const l={type:i,message:n,title:r||i,options:a,metadata:{plugin:""}};this.renderOptions(a),this.renderEnvelopes([l])}}const o=new class extends s{constructor(){super(...arguments),this.defaultOptions={timeout:1e4}}renderEnvelopes(e){(null==e?void 0:e.length)&&e.forEach((e=>{try{const s=Object.assign({text:e.message,type:e.type},this.defaultOptions);e.options&&Object.assign(s,e.options);const o=new t(s);o.show();const i=o.layoutDom;i&&"object"==typeof i.dataset&&(i.dataset.turboTemporary="")}catch(t){console.error("PHPFlasher Noty: Error rendering notification",t,e)}}))}renderOptions(e){e&&(Object.assign(this.defaultOptions,e),t.overrideDefaults(this.defaultOptions))}};return e.addPlugin("noty",o),o}));
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("noty")):"function"==typeof define&&define.amd?define(["@flasher/flasher","noty"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Noty=t(e.flasher,e.Noty)}(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,o){let i,n,r,l={};if("object"==typeof e?(l=Object.assign({},e),i=l.type,n=l.message,r=l.title,delete l.type,delete l.message,delete l.title):"object"==typeof t?(l=Object.assign({},t),i=e,n=l.message,r=l.title,delete l.message,delete l.title):(i=e,n=t,null==s?(r=void 0,l=o||{}):"string"==typeof s?(r=s,l=o||{}):"object"==typeof s&&(l=Object.assign({},s),"title"in l?(r=l.title,delete l.title):r=void 0,o&&"object"==typeof o&&(l=Object.assign(Object.assign({},l),o)))),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");null==r&&(r=i.charAt(0).toUpperCase()+i.slice(1));const a={type:i,message:n,title:r,options:l,metadata:{plugin:""}};this.renderOptions(l),this.renderEnvelopes([a])}}const o=new class extends s{constructor(){super(...arguments),this.defaultOptions={timeout:1e4}}renderEnvelopes(e){(null==e?void 0:e.length)&&e.forEach((e=>{try{const s=Object.assign({text:e.message,type:e.type},this.defaultOptions);e.options&&Object.assign(s,e.options);const o=new t(s);o.show();const i=o.layoutDom;i&&"object"==typeof i.dataset&&(i.dataset.turboTemporary="")}catch(t){console.error("PHPFlasher Noty: Error rendering notification",t,e)}}))}renderOptions(e){e&&(Object.assign(this.defaultOptions,e),t.overrideDefaults(this.defaultOptions))}};return e.addPlugin("noty",o),o}));
|
||||
|
||||
+20
-7
@@ -38,17 +38,27 @@ class AbstractPlugin {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -56,10 +66,13 @@ class AbstractPlugin {
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
+20
-7
@@ -42,17 +42,27 @@
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -60,10 +70,13 @@
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
+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
@@ -101,7 +101,7 @@ export abstract class AbstractPlugin implements PluginInterface {
|
||||
*
|
||||
* This method handles different parameter formats to provide a flexible API:
|
||||
* - flash(type, message, title, options)
|
||||
* - flash(type, message, options) - title in options
|
||||
* - flash(type, message, options) - title in options or just options
|
||||
* - flash(type, options) - message and title in options
|
||||
* - flash(options) - type, message, and title in options
|
||||
*
|
||||
@@ -141,21 +141,37 @@ export abstract class AbstractPlugin implements PluginInterface {
|
||||
delete normalizedOptions.message
|
||||
delete normalizedOptions.title
|
||||
}
|
||||
// Case: flash(type, message, {title, ...options})
|
||||
else if (typeof title === 'object') {
|
||||
normalizedOptions = { ...title }
|
||||
normalizedType = type
|
||||
normalizedMessage = message
|
||||
normalizedTitle = normalizedOptions.title as string
|
||||
|
||||
delete normalizedOptions.title
|
||||
}
|
||||
// Case: flash(type, message, title, options)
|
||||
// Case: flash(type, message, title|options, options?)
|
||||
else {
|
||||
normalizedType = type
|
||||
normalizedMessage = message
|
||||
normalizedMessage = message as string
|
||||
|
||||
// Determine if the third parameter is a title string or options object
|
||||
if (title === undefined || title === null) {
|
||||
// No third parameter
|
||||
normalizedTitle = undefined
|
||||
normalizedOptions = options || {}
|
||||
} else if (typeof title === 'string') {
|
||||
// Third parameter is a title string
|
||||
normalizedTitle = title
|
||||
normalizedOptions = options || {}
|
||||
} else if (typeof title === 'object') {
|
||||
// Third parameter is an options object
|
||||
normalizedOptions = { ...title }
|
||||
|
||||
// If options has a title property, use it and remove from options
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title as string
|
||||
delete normalizedOptions.title
|
||||
} else {
|
||||
normalizedTitle = undefined
|
||||
}
|
||||
|
||||
// Merge with any options provided in the fourth parameter
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = { ...normalizedOptions, ...options }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate required parameters
|
||||
@@ -167,11 +183,16 @@ export abstract class AbstractPlugin implements PluginInterface {
|
||||
throw new Error('Message is required for notifications')
|
||||
}
|
||||
|
||||
// Set title to type if not provided
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1)
|
||||
}
|
||||
|
||||
// Create standardized envelope
|
||||
const envelope: Envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: '',
|
||||
|
||||
+22
-7
@@ -70,18 +70,30 @@ class AbstractPlugin {
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
}
|
||||
else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
}
|
||||
else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
}
|
||||
else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
}
|
||||
else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -89,10 +101,13 @@ class AbstractPlugin {
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: '',
|
||||
|
||||
Vendored
+22
-7
@@ -76,18 +76,30 @@
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
}
|
||||
else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
}
|
||||
else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
}
|
||||
else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
}
|
||||
else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -95,10 +107,13 @@
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: '',
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+22
-7
@@ -38,18 +38,30 @@ class AbstractPlugin {
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
}
|
||||
else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
}
|
||||
else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
}
|
||||
else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
}
|
||||
else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -57,10 +69,13 @@ class AbstractPlugin {
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: '',
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -71,17 +71,27 @@ class AbstractPlugin {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -89,10 +99,13 @@ class AbstractPlugin {
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
+20
-7
@@ -74,17 +74,27 @@
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -92,10 +102,13 @@
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
@@ -1 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("sweetalert2")):"function"==typeof define&&define.amd?define(["@flasher/flasher","sweetalert2"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).sweetalert=t(e.flasher,e.Swal)}(this,(function(e,t){"use strict";function r(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{a(s.next(e))}catch(e){n(e)}}function l(e){try{a(s.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,l)}a((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s{success(e,t,r){this.flash("success",e,t,r)}error(e,t,r){this.flash("error",e,t,r)}info(e,t,r){this.flash("info",e,t,r)}warning(e,t,r){this.flash("warning",e,t,r)}flash(e,t,r,s){let i,n,o,l={};if("object"==typeof e?(l=Object.assign({},e),i=l.type,n=l.message,o=l.title,delete l.type,delete l.message,delete l.title):"object"==typeof t?(l=Object.assign({},t),i=e,n=l.message,o=l.title,delete l.message,delete l.title):"object"==typeof r?(l=Object.assign({},r),i=e,n=t,o=l.title,delete l.title):(i=e,n=t,o=r,l=s||{}),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");const a={type:i,message:n,title:o||i,options:l,metadata:{plugin:""}};this.renderOptions(l),this.renderEnvelopes([a])}}const i=new class extends s{renderEnvelopes(e){return r(this,void 0,void 0,(function*(){this.sweetalert||this.initializeSweetAlert();try{for(const t of e)yield this.renderEnvelope(t)}catch(e){console.error("PHPFlasher SweetAlert: Error rendering envelopes",e)}}))}renderOptions(e){try{this.sweetalert=this.sweetalert||t.mixin(Object.assign({timer:e.timer||1e4,timerProgressBar:e.timerProgressBar||!0},e)),this.setupTurboCompatibility()}catch(e){console.error("PHPFlasher SweetAlert: Error applying options",e)}}renderEnvelope(e){return r(this,void 0,void 0,(function*(){var t;try{let{options:r}=e;r=Object.assign(Object.assign({},r),{icon:(null==r?void 0:r.icon)||e.type,text:(null==r?void 0:r.text)||e.message});const s=yield null===(t=this.sweetalert)||void 0===t?void 0:t.fire(r);this.dispatchResultEvent(s,e)}catch(t){console.error("PHPFlasher SweetAlert: Error rendering envelope",t,e)}}))}initializeSweetAlert(){this.sweetalert||this.renderOptions({timer:1e4,timerProgressBar:!0})}setupTurboCompatibility(){document.addEventListener("turbo:before-cache",(()=>{if(t.isVisible()){const e=t.getPopup();e&&e.style.setProperty("animation-duration","0ms"),t.close()}}))}dispatchResultEvent(e,t){e&&window.dispatchEvent(new CustomEvent("flasher:sweetalert:promise",{detail:{promise:e,envelope:t}}))}};return e.addPlugin("sweetalert",i),i}));
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("sweetalert2")):"function"==typeof define&&define.amd?define(["@flasher/flasher","sweetalert2"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).sweetalert=t(e.flasher,e.Swal)}(this,(function(e,t){"use strict";function r(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{a(s.next(e))}catch(e){n(e)}}function l(e){try{a(s.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,l)}a((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s{success(e,t,r){this.flash("success",e,t,r)}error(e,t,r){this.flash("error",e,t,r)}info(e,t,r){this.flash("info",e,t,r)}warning(e,t,r){this.flash("warning",e,t,r)}flash(e,t,r,s){let i,n,o,l={};if("object"==typeof e?(l=Object.assign({},e),i=l.type,n=l.message,o=l.title,delete l.type,delete l.message,delete l.title):"object"==typeof t?(l=Object.assign({},t),i=e,n=l.message,o=l.title,delete l.message,delete l.title):(i=e,n=t,null==r?(o=void 0,l=s||{}):"string"==typeof r?(o=r,l=s||{}):"object"==typeof r&&(l=Object.assign({},r),"title"in l?(o=l.title,delete l.title):o=void 0,s&&"object"==typeof s&&(l=Object.assign(Object.assign({},l),s)))),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");null==o&&(o=i.charAt(0).toUpperCase()+i.slice(1));const a={type:i,message:n,title:o,options:l,metadata:{plugin:""}};this.renderOptions(l),this.renderEnvelopes([a])}}const i=new class extends s{renderEnvelopes(e){return r(this,void 0,void 0,(function*(){this.sweetalert||this.initializeSweetAlert();try{for(const t of e)yield this.renderEnvelope(t)}catch(e){console.error("PHPFlasher SweetAlert: Error rendering envelopes",e)}}))}renderOptions(e){try{this.sweetalert=this.sweetalert||t.mixin(Object.assign({timer:e.timer||1e4,timerProgressBar:e.timerProgressBar||!0},e)),this.setupTurboCompatibility()}catch(e){console.error("PHPFlasher SweetAlert: Error applying options",e)}}renderEnvelope(e){return r(this,void 0,void 0,(function*(){var t;try{let{options:r}=e;r=Object.assign(Object.assign({},r),{icon:(null==r?void 0:r.icon)||e.type,text:(null==r?void 0:r.text)||e.message});const s=yield null===(t=this.sweetalert)||void 0===t?void 0:t.fire(r);this.dispatchResultEvent(s,e)}catch(t){console.error("PHPFlasher SweetAlert: Error rendering envelope",t,e)}}))}initializeSweetAlert(){this.sweetalert||this.renderOptions({timer:1e4,timerProgressBar:!0})}setupTurboCompatibility(){document.addEventListener("turbo:before-cache",(()=>{if(t.isVisible()){const e=t.getPopup();e&&e.style.setProperty("animation-duration","0ms"),t.close()}}))}dispatchResultEvent(e,t){e&&window.dispatchEvent(new CustomEvent("flasher:sweetalert:promise",{detail:{promise:e,envelope:t}}))}};return e.addPlugin("sweetalert",i),i}));
|
||||
|
||||
@@ -1 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("sweetalert2")):"function"==typeof define&&define.amd?define(["@flasher/flasher","sweetalert2"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).sweetalert=t(e.flasher,e.Swal)}(this,(function(e,t){"use strict";function r(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{a(s.next(e))}catch(e){n(e)}}function l(e){try{a(s.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,l)}a((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s{success(e,t,r){this.flash("success",e,t,r)}error(e,t,r){this.flash("error",e,t,r)}info(e,t,r){this.flash("info",e,t,r)}warning(e,t,r){this.flash("warning",e,t,r)}flash(e,t,r,s){let i,n,o,l={};if("object"==typeof e?(l=Object.assign({},e),i=l.type,n=l.message,o=l.title,delete l.type,delete l.message,delete l.title):"object"==typeof t?(l=Object.assign({},t),i=e,n=l.message,o=l.title,delete l.message,delete l.title):"object"==typeof r?(l=Object.assign({},r),i=e,n=t,o=l.title,delete l.title):(i=e,n=t,o=r,l=s||{}),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");const a={type:i,message:n,title:o||i,options:l,metadata:{plugin:""}};this.renderOptions(l),this.renderEnvelopes([a])}}const i=new class extends s{renderEnvelopes(e){return r(this,void 0,void 0,(function*(){this.sweetalert||this.initializeSweetAlert();try{for(const t of e)yield this.renderEnvelope(t)}catch(e){console.error("PHPFlasher SweetAlert: Error rendering envelopes",e)}}))}renderOptions(e){try{this.sweetalert=this.sweetalert||t.mixin(Object.assign({timer:e.timer||1e4,timerProgressBar:e.timerProgressBar||!0},e)),this.setupTurboCompatibility()}catch(e){console.error("PHPFlasher SweetAlert: Error applying options",e)}}renderEnvelope(e){return r(this,void 0,void 0,(function*(){var t;try{let{options:r}=e;r=Object.assign(Object.assign({},r),{icon:(null==r?void 0:r.icon)||e.type,text:(null==r?void 0:r.text)||e.message});const s=yield null===(t=this.sweetalert)||void 0===t?void 0:t.fire(r);this.dispatchResultEvent(s,e)}catch(t){console.error("PHPFlasher SweetAlert: Error rendering envelope",t,e)}}))}initializeSweetAlert(){this.sweetalert||this.renderOptions({timer:1e4,timerProgressBar:!0})}setupTurboCompatibility(){document.addEventListener("turbo:before-cache",(()=>{if(t.isVisible()){const e=t.getPopup();e&&e.style.setProperty("animation-duration","0ms"),t.close()}}))}dispatchResultEvent(e,t){e&&window.dispatchEvent(new CustomEvent("flasher:sweetalert:promise",{detail:{promise:e,envelope:t}}))}};return e.addPlugin("sweetalert",i),i}));
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("sweetalert2")):"function"==typeof define&&define.amd?define(["@flasher/flasher","sweetalert2"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).sweetalert=t(e.flasher,e.Swal)}(this,(function(e,t){"use strict";function r(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{a(s.next(e))}catch(e){n(e)}}function l(e){try{a(s.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,l)}a((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class s{success(e,t,r){this.flash("success",e,t,r)}error(e,t,r){this.flash("error",e,t,r)}info(e,t,r){this.flash("info",e,t,r)}warning(e,t,r){this.flash("warning",e,t,r)}flash(e,t,r,s){let i,n,o,l={};if("object"==typeof e?(l=Object.assign({},e),i=l.type,n=l.message,o=l.title,delete l.type,delete l.message,delete l.title):"object"==typeof t?(l=Object.assign({},t),i=e,n=l.message,o=l.title,delete l.message,delete l.title):(i=e,n=t,null==r?(o=void 0,l=s||{}):"string"==typeof r?(o=r,l=s||{}):"object"==typeof r&&(l=Object.assign({},r),"title"in l?(o=l.title,delete l.title):o=void 0,s&&"object"==typeof s&&(l=Object.assign(Object.assign({},l),s)))),!i)throw new Error("Type is required for notifications");if(null==n)throw new Error("Message is required for notifications");null==o&&(o=i.charAt(0).toUpperCase()+i.slice(1));const a={type:i,message:n,title:o,options:l,metadata:{plugin:""}};this.renderOptions(l),this.renderEnvelopes([a])}}const i=new class extends s{renderEnvelopes(e){return r(this,void 0,void 0,(function*(){this.sweetalert||this.initializeSweetAlert();try{for(const t of e)yield this.renderEnvelope(t)}catch(e){console.error("PHPFlasher SweetAlert: Error rendering envelopes",e)}}))}renderOptions(e){try{this.sweetalert=this.sweetalert||t.mixin(Object.assign({timer:e.timer||1e4,timerProgressBar:e.timerProgressBar||!0},e)),this.setupTurboCompatibility()}catch(e){console.error("PHPFlasher SweetAlert: Error applying options",e)}}renderEnvelope(e){return r(this,void 0,void 0,(function*(){var t;try{let{options:r}=e;r=Object.assign(Object.assign({},r),{icon:(null==r?void 0:r.icon)||e.type,text:(null==r?void 0:r.text)||e.message});const s=yield null===(t=this.sweetalert)||void 0===t?void 0:t.fire(r);this.dispatchResultEvent(s,e)}catch(t){console.error("PHPFlasher SweetAlert: Error rendering envelope",t,e)}}))}initializeSweetAlert(){this.sweetalert||this.renderOptions({timer:1e4,timerProgressBar:!0})}setupTurboCompatibility(){document.addEventListener("turbo:before-cache",(()=>{if(t.isVisible()){const e=t.getPopup();e&&e.style.setProperty("animation-duration","0ms"),t.close()}}))}dispatchResultEvent(e,t){e&&window.dispatchEvent(new CustomEvent("flasher:sweetalert:promise",{detail:{promise:e,envelope:t}}))}};return e.addPlugin("sweetalert",i),i}));
|
||||
|
||||
+20
-7
@@ -39,17 +39,27 @@ class AbstractPlugin {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -57,10 +67,13 @@ class AbstractPlugin {
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
+20
-7
@@ -42,17 +42,27 @@
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.message;
|
||||
delete normalizedOptions.title;
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedType = type;
|
||||
normalizedMessage = message;
|
||||
if (title === undefined || title === null) {
|
||||
normalizedTitle = undefined;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'string') {
|
||||
normalizedTitle = title;
|
||||
normalizedOptions = options || {};
|
||||
} else if (typeof title === 'object') {
|
||||
normalizedOptions = Object.assign({}, title);
|
||||
if ('title' in normalizedOptions) {
|
||||
normalizedTitle = normalizedOptions.title;
|
||||
delete normalizedOptions.title;
|
||||
} else {
|
||||
normalizedTitle = undefined;
|
||||
}
|
||||
if (options && typeof options === 'object') {
|
||||
normalizedOptions = Object.assign(Object.assign({}, normalizedOptions), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!normalizedType) {
|
||||
throw new Error('Type is required for notifications');
|
||||
@@ -60,10 +70,13 @@
|
||||
if (normalizedMessage === undefined || normalizedMessage === null) {
|
||||
throw new Error('Message is required for notifications');
|
||||
}
|
||||
if (normalizedTitle === undefined || normalizedTitle === null) {
|
||||
normalizedTitle = normalizedType.charAt(0).toUpperCase() + normalizedType.slice(1);
|
||||
}
|
||||
const envelope = {
|
||||
type: normalizedType,
|
||||
message: normalizedMessage,
|
||||
title: normalizedTitle || normalizedType,
|
||||
title: normalizedTitle,
|
||||
options: normalizedOptions,
|
||||
metadata: {
|
||||
plugin: ''
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
!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 r{success(e,t,r){this.flash("success",e,t,r)}error(e,t,r){this.flash("error",e,t,r)}info(e,t,r){this.flash("info",e,t,r)}warning(e,t,r){this.flash("warning",e,t,r)}flash(e,t,r,s){let o,i,n,a={};if("object"==typeof e?(a=Object.assign({},e),o=a.type,i=a.message,n=a.title,delete a.type,delete a.message,delete a.title):"object"==typeof t?(a=Object.assign({},t),o=e,i=a.message,n=a.title,delete a.message,delete a.title):"object"==typeof r?(a=Object.assign({},r),o=e,i=t,n=a.title,delete a.title):(o=e,i=t,n=r,a=s||{}),!o)throw new Error("Type is required for notifications");if(null==i)throw new Error("Message is required for notifications");const l={type:o,message:i,title:n||o,options:a,metadata:{plugin:""}};this.renderOptions(a),this.renderEnvelopes([l])}}const s=new class extends r{renderEnvelopes(e){(null==e?void 0:e.length)&&this.isDependencyAvailable()&&e.forEach((e=>{try{const{message:r,title:s,type:o,options:i}=e,n=t[o](r,s,i);if(n&&n.parent)try{const e=n.parent();e&&"function"==typeof e.attr&&e.attr("data-turbo-temporary","")}catch(e){console.error("PHPFlasher Toastr: Error setting Turbo compatibility",e)}}catch(t){console.error("PHPFlasher Toastr: Error rendering notification",t,e)}}))}renderOptions(e){if(this.isDependencyAvailable())try{t.options=Object.assign({timeOut:e.timeOut||1e4,progressBar:e.progressBar||!0},e)}catch(e){console.error("PHPFlasher Toastr: Error applying options",e)}}isDependencyAvailable(){return!(!window.jQuery&&!window.$)||(console.error("PHPFlasher Toastr: jQuery is required but not loaded. Make sure jQuery is loaded before using Toastr."),!1)}};return e.addPlugin("toastr",s),s}));
|
||||
!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){let o,i,n,a={};if("object"==typeof e?(a=Object.assign({},e),o=a.type,i=a.message,n=a.title,delete a.type,delete a.message,delete a.title):"object"==typeof t?(a=Object.assign({},t),o=e,i=a.message,n=a.title,delete a.message,delete a.title):(o=e,i=t,null==s?(n=void 0,a=r||{}):"string"==typeof s?(n=s,a=r||{}):"object"==typeof s&&(a=Object.assign({},s),"title"in a?(n=a.title,delete a.title):n=void 0,r&&"object"==typeof r&&(a=Object.assign(Object.assign({},a),r)))),!o)throw new Error("Type is required for notifications");if(null==i)throw new Error("Message is required for notifications");null==n&&(n=o.charAt(0).toUpperCase()+o.slice(1));const l={type:o,message:i,title:n,options:a,metadata:{plugin:""}};this.renderOptions(a),this.renderEnvelopes([l])}}const r=new class extends s{renderEnvelopes(e){(null==e?void 0:e.length)&&this.isDependencyAvailable()&&e.forEach((e=>{try{const{message:s,title:r,type:o,options:i}=e,n=t[o](s,r,i);if(n&&n.parent)try{const e=n.parent();e&&"function"==typeof e.attr&&e.attr("data-turbo-temporary","")}catch(e){console.error("PHPFlasher Toastr: Error setting Turbo compatibility",e)}}catch(t){console.error("PHPFlasher Toastr: Error rendering notification",t,e)}}))}renderOptions(e){if(this.isDependencyAvailable())try{t.options=Object.assign({timeOut:e.timeOut||1e4,progressBar:e.progressBar||!0},e)}catch(e){console.error("PHPFlasher Toastr: Error applying options",e)}}isDependencyAvailable(){return!(!window.jQuery&&!window.$)||(console.error("PHPFlasher Toastr: jQuery is required but not loaded. Make sure jQuery is loaded before using Toastr."),!1)}};return e.addPlugin("toastr",r),r}));
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
!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 r{success(e,t,r){this.flash("success",e,t,r)}error(e,t,r){this.flash("error",e,t,r)}info(e,t,r){this.flash("info",e,t,r)}warning(e,t,r){this.flash("warning",e,t,r)}flash(e,t,r,s){let o,i,n,a={};if("object"==typeof e?(a=Object.assign({},e),o=a.type,i=a.message,n=a.title,delete a.type,delete a.message,delete a.title):"object"==typeof t?(a=Object.assign({},t),o=e,i=a.message,n=a.title,delete a.message,delete a.title):"object"==typeof r?(a=Object.assign({},r),o=e,i=t,n=a.title,delete a.title):(o=e,i=t,n=r,a=s||{}),!o)throw new Error("Type is required for notifications");if(null==i)throw new Error("Message is required for notifications");const l={type:o,message:i,title:n||o,options:a,metadata:{plugin:""}};this.renderOptions(a),this.renderEnvelopes([l])}}const s=new class extends r{renderEnvelopes(e){(null==e?void 0:e.length)&&this.isDependencyAvailable()&&e.forEach((e=>{try{const{message:r,title:s,type:o,options:i}=e,n=t[o](r,s,i);if(n&&n.parent)try{const e=n.parent();e&&"function"==typeof e.attr&&e.attr("data-turbo-temporary","")}catch(e){console.error("PHPFlasher Toastr: Error setting Turbo compatibility",e)}}catch(t){console.error("PHPFlasher Toastr: Error rendering notification",t,e)}}))}renderOptions(e){if(this.isDependencyAvailable())try{t.options=Object.assign({timeOut:e.timeOut||1e4,progressBar:e.progressBar||!0},e)}catch(e){console.error("PHPFlasher Toastr: Error applying options",e)}}isDependencyAvailable(){return!(!window.jQuery&&!window.$)||(console.error("PHPFlasher Toastr: jQuery is required but not loaded. Make sure jQuery is loaded before using Toastr."),!1)}};return e.addPlugin("toastr",s),s}));
|
||||
!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){let o,i,n,a={};if("object"==typeof e?(a=Object.assign({},e),o=a.type,i=a.message,n=a.title,delete a.type,delete a.message,delete a.title):"object"==typeof t?(a=Object.assign({},t),o=e,i=a.message,n=a.title,delete a.message,delete a.title):(o=e,i=t,null==s?(n=void 0,a=r||{}):"string"==typeof s?(n=s,a=r||{}):"object"==typeof s&&(a=Object.assign({},s),"title"in a?(n=a.title,delete a.title):n=void 0,r&&"object"==typeof r&&(a=Object.assign(Object.assign({},a),r)))),!o)throw new Error("Type is required for notifications");if(null==i)throw new Error("Message is required for notifications");null==n&&(n=o.charAt(0).toUpperCase()+o.slice(1));const l={type:o,message:i,title:n,options:a,metadata:{plugin:""}};this.renderOptions(a),this.renderEnvelopes([l])}}const r=new class extends s{renderEnvelopes(e){(null==e?void 0:e.length)&&this.isDependencyAvailable()&&e.forEach((e=>{try{const{message:s,title:r,type:o,options:i}=e,n=t[o](s,r,i);if(n&&n.parent)try{const e=n.parent();e&&"function"==typeof e.attr&&e.attr("data-turbo-temporary","")}catch(e){console.error("PHPFlasher Toastr: Error setting Turbo compatibility",e)}}catch(t){console.error("PHPFlasher Toastr: Error rendering notification",t,e)}}))}renderOptions(e){if(this.isDependencyAvailable())try{t.options=Object.assign({timeOut:e.timeOut||1e4,progressBar:e.progressBar||!0},e)}catch(e){console.error("PHPFlasher Toastr: Error applying options",e)}}isDependencyAvailable(){return!(!window.jQuery&&!window.$)||(console.error("PHPFlasher Toastr: jQuery is required but not loaded. Make sure jQuery is loaded before using Toastr."),!1)}};return e.addPlugin("toastr",r),r}));
|
||||
|
||||
Reference in New Issue
Block a user