@wordpress/components
Version:
UI components for WordPress.
1 lines • 1.38 kB
Source Map (JSON)
{"version":3,"file":"context.cjs","names":["observableMap","createContext"],"sources":["../../src/slot-fill/context.ts"],"sourcesContent":["import { observableMap } from '@wordpress/compose';\nimport { createContext } from '@wordpress/element';\nimport warning from '@wordpress/warning';\nimport type { SlotFillRegistry } from './types';\n\nconst initialValue: SlotFillRegistry = {\n\tslots: observableMap(),\n\tfills: observableMap(),\n\tregisterSlot: () => {\n\t\twarning(\n\t\t\t'Components must be wrapped within `SlotFillProvider`. ' +\n\t\t\t\t'See https://developer.wordpress.org/block-editor/components/slot-fill/'\n\t\t);\n\t},\n\tunregisterSlot: () => {},\n\tupdateSlot: () => {},\n\tregisterFill: () => {},\n\tunregisterFill: () => {},\n\tupdateFill: () => {},\n\n\t// This helps the provider know if it's using the default context value or not.\n\tisDefault: true,\n};\n\nconst SlotFillContext = createContext( initialValue );\nSlotFillContext.displayName = 'SlotFillContext';\n\nexport default SlotFillContext;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,eAAiC;CACtC,QAAA,GAAOA,mBAAAA,cAAAA,CAAc;CACrB,QAAA,GAAOA,mBAAAA,cAAAA,CAAc;CACrB,oBAAoB;EACnB,CAAA,GAAA,mBAAA,QAAA,CACC,8HAED;CACD;CACA,sBAAsB,CAAC;CACvB,kBAAkB,CAAC;CACnB,oBAAoB,CAAC;CACrB,sBAAsB,CAAC;CACvB,kBAAkB,CAAC;CAGnB,WAAW;AACZ;AAEA,MAAM,mBAAA,GAAkBC,mBAAAA,cAAAA,CAAe,YAAa;AACpD,gBAAgB,cAAc"}