// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand. import { defineComponent, h, onMounted, onBeforeUnmount } from 'vue'; import { Gallery } from '@42/core/gallery'; import { useC42 } from '../useC42'; /** * Image lightbox with navigation and keyboard control * * Vue wrapper for the `Gallery` controller (`@42/core/gallery`). 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: 'Gallery', props: { "loop": { type: Boolean, required: false }, // boolean "closeOnEscape": { type: Boolean, required: false }, // boolean "lockScroll": { type: Boolean, required: false }, // boolean }, emits: ["gallery:open", "gallery:close", "gallery:change"], setup(props, { slots, emit }) { const options = () => { const out: Record = {}; for (const key of ["loop", "closeOnEscape", "lockScroll"] as const) { const value = (props as Record)[key]; if (value !== undefined) out[key] = value; } return out as Partial>; }; const el = useC42(Gallery, options); const listeners: Array<[string, (event: Event) => void]> = [ ["gallery:open", (event: Event) => emit("gallery:open", (event as CustomEvent).detail)], ["gallery:close", (event: Event) => emit("gallery:close", (event as CustomEvent).detail)], ["gallery:change", (event: Event) => emit("gallery:change", (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: gallery