@wordpress/components
Version:
UI components for WordPress.
1 lines • 807 B
Source Map (JSON)
{"version":3,"file":"use-slot.mjs","names":[],"sources":["../../../src/slot-fill/bubbles-virtually/use-slot.ts"],"sourcesContent":["import { useContext } from '@wordpress/element';\nimport { useObservableValue } from '@wordpress/compose';\nimport SlotFillContext from '../context';\nimport type { SlotKey, SlotRef } from '../types';\n\nexport default function useSlot( name: SlotKey ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useObservableValue( registry.slots, name );\n\tlet ref: SlotRef | undefined;\n\tif ( slot && slot.type === 'portal' ) {\n\t\tref = slot.ref;\n\t}\n\treturn { ref };\n}\n"],"mappings":";;;;AAKA,SAAwB,QAAS,MAAgB;CAChD,MAAM,WAAW,WAAY,eAAgB;CAC7C,MAAM,OAAO,mBAAoB,SAAS,OAAO,IAAK;CACtD,IAAI;CACJ,IAAK,QAAQ,KAAK,SAAS,UAC1B,MAAM,KAAK;CAEZ,OAAO,EAAE,IAAI;AACd"}