// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand. import { defineComponent, h, onMounted, onBeforeUnmount } from 'vue'; import { Toaster } from '@42/core/toast'; import { useC42 } from '../useC42'; /** * Floating notification manager with auto-dismiss * * Vue wrapper for the `Toaster` controller (`@42/core/toast`). Props mirror * the controller options; events are re-emitted with the CustomEvent detail. * Place the controller markup in the default slot. */ export default defineComponent({ name: 'Toaster', props: { "position": { required: false }, // ToastPosition "duration": { type: Number, required: false }, // number "max": { type: Number, required: false }, // number }, emits: ["toast:show", "toast:dismiss"], setup(props, { slots, emit }) { const options = () => { const out: Record = {}; for (const key of ["position", "duration", "max"] as const) { const value = (props as Record)[key]; if (value !== undefined) out[key] = value; } return out as Partial>; }; const el = useC42(Toaster, options); const listeners: Array<[string, (event: Event) => void]> = [ ["toast:show", (event: Event) => emit("toast:show", (event as CustomEvent).detail)], ["toast:dismiss", (event: Event) => emit("toast:dismiss", (event as CustomEvent).detail)], ]; onMounted(() => { const node = el.value; if (!node) return; for (const [name, handler] of listeners) node.addEventListener(name, handler); }); onBeforeUnmount(() => { const node = el.value; if (!node) return; for (const [name, handler] of listeners) node.removeEventListener(name, handler); }); return () => h('div', { ref: el }, slots.default ? slots.default() : undefined); }, }); // Component id in @42/core manifest: toast