// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand. import { defineComponent, h, onMounted, onBeforeUnmount } from 'vue'; import { CommandPalette } from '@42/core/command-palette'; import { useC42 } from '../useC42'; /** * Cmd/Ctrl+K searchable, grouped command panel * * Vue wrapper for the `CommandPalette` controller (`@42/core/command-palette`). 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: 'CommandPalette', props: { "defaultOpen": { type: Boolean, required: false }, // boolean "hotkey": { required: false }, // string | null "closeOnOverlayClick": { type: Boolean, required: false }, // boolean "closeOnEscape": { type: Boolean, required: false }, // boolean "clearOnClose": { type: Boolean, required: false }, // boolean "filter": { type: Function, required: false }, // (query: string, text: string) => boolean }, emits: ["commandpalette:open", "commandpalette:close", "commandpalette:select", "commandpalette:filter"], setup(props, { slots, emit }) { const options = () => { const out: Record = {}; for (const key of ["defaultOpen", "hotkey", "closeOnOverlayClick", "closeOnEscape", "clearOnClose", "filter"] as const) { const value = (props as Record)[key]; if (value !== undefined) out[key] = value; } return out as Partial>; }; const el = useC42(CommandPalette, options); const listeners: Array<[string, (event: Event) => void]> = [ ["commandpalette:open", (event: Event) => emit("commandpalette:open", (event as CustomEvent).detail)], ["commandpalette:close", (event: Event) => emit("commandpalette:close", (event as CustomEvent).detail)], ["commandpalette:select", (event: Event) => emit("commandpalette:select", (event as CustomEvent).detail)], ["commandpalette:filter", (event: Event) => emit("commandpalette:filter", (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: command-palette