adrema/resources/livewire-js/app.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-10-14 20:25:11 +02:00
import {Livewire, Alpine} from '../../vendor/livewire/livewire/dist/livewire.esm';
import Tooltip from '@ryangjchandler/alpine-tooltip';
2024-10-13 21:00:47 +02:00
import '../css/app.css';
2024-10-14 20:25:11 +02:00
import 'tippy.js/dist/tippy.css';
import 'tippy.js/animations/shift-toward.css';
import '../css/tooltip.css';
import {error, success} from './toastify.js';
2024-10-28 23:14:33 +01:00
import tippy from 'tippy.js';
2024-10-14 20:25:11 +02:00
2024-10-28 23:14:33 +01:00
const defaultTippy = {
theme: 'primary',
animation: 'shift-toward',
};
Alpine.plugin(Tooltip.defaultProps(defaultTippy));
2024-10-14 20:25:11 +02:00
window.addEventListener('success', (event) => success(event.detail[0]));
2024-10-28 23:14:33 +01:00
document.addEventListener('alpine:init', () => {
Alpine.directive('error', function (el, {value, modifiers, expression}, {Alpine, effect, cleanup, evaluateLater}) {
let getThingToLog = evaluateLater(expression);
// el._x_custom_tippy = new tippy(el, {
// ...defaultTippy,
// content: '',
// });
effect(() => {
getThingToLog((thingToLog) => {
console.log(thingToLog);
});
});
});
});
window.tippy = tippy;
2024-10-14 20:25:11 +02:00
Livewire.start();