{"version":3,"file":"useSlot.mjs","sources":["../../../../src/lib/vdom/hooks/useSlot.ts"],"sourcesContent":["/**\n * @file Slot Hooks\n * @description Hooks for working with module slots\n */\n\nimport { useEffect, type ReactNode } from 'react';\nimport { useModuleContext, useOptionalModuleContext } from '../ModuleBoundary';\n\n/**\n * Hook to fill a slot with content.\n * Automatically clears the slot on unmount.\n * @param name - Slot name\n * @param content - Content to fill the slot with\n */\nexport function useFillSlot(name: string, content: ReactNode): void {\n  const context = useModuleContext();\n\n  useEffect(() => {\n    context.setSlot(name, content);\n\n    return () => {\n      // Clear slot on unmount\n      context.setSlot(name, null);\n    };\n  }, [context, name, content]);\n}\n\n/**\n * Hook to get slot content.\n * @param name - Slot name\n * @returns Slot content or null\n */\nexport function useSlotContent(name: string): ReactNode | null {\n  const context = useOptionalModuleContext();\n  return context?.getSlot(name) ?? null;\n}\n\n/**\n * Hook to check if a slot is filled.\n * @param name - Slot name\n * @returns Whether slot is filled\n */\nexport function useIsSlotFilled(name: string): boolean {\n  const content = useSlotContent(name);\n  return content !== null && content !== undefined;\n}\n"],"names":["useFillSlot","name","content","context","useModuleContext","useEffect","useSlotContent","useOptionalModuleContext","useIsSlotFilled"],"mappings":";;AAcO,SAASA,EAAYC,GAAcC,GAA0B;AAClE,QAAMC,IAAUC,EAAA;AAEhB,EAAAC,EAAU,OACRF,EAAQ,QAAQF,GAAMC,CAAO,GAEtB,MAAM;AAEX,IAAAC,EAAQ,QAAQF,GAAM,IAAI;AAAA,EAC5B,IACC,CAACE,GAASF,GAAMC,CAAO,CAAC;AAC7B;AAOO,SAASI,EAAeL,GAAgC;AAE7D,SADgBM,EAAA,GACA,QAAQN,CAAI,KAAK;AACnC;AAOO,SAASO,EAAgBP,GAAuB;AACrD,QAAMC,IAAUI,EAAeL,CAAI;AACnC,SAAOC,KAAY;AACrB;"}