UNPKG

@wordpress/block-editor

Version:
8 lines (7 loc) 1.48 kB
{ "version": 3, "sources": ["../../../src/components/inspector-controls/block-support-slot-container.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalToolsPanelContext as ToolsPanelContext } from '@wordpress/components';\nimport { useContext, useMemo } from '@wordpress/element';\n\nexport default function BlockSupportSlotContainer( {\n\tSlot,\n\tfillProps,\n\t...props\n} ) {\n\t// Add the toolspanel context provider and value to existing fill props\n\tconst toolsPanelContext = useContext( ToolsPanelContext );\n\tconst computedFillProps = useMemo(\n\t\t() => ( {\n\t\t\t...( fillProps ?? {} ),\n\t\t\tforwardedContext: [\n\t\t\t\t...( fillProps?.forwardedContext ?? [] ),\n\t\t\t\t[ ToolsPanelContext.Provider, { value: toolsPanelContext } ],\n\t\t\t],\n\t\t} ),\n\t\t[ toolsPanelContext, fillProps ]\n\t);\n\n\treturn (\n\t\t<Slot { ...props } fillProps={ computedFillProps } bubblesVirtually />\n\t);\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqE;AACrE,qBAAoC;AAqBlC;AAnBa,SAAR,0BAA4C;AAAA,EAClD;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAI;AAEH,QAAM,wBAAoB,2BAAY,kBAAAA,+BAAkB;AACxD,QAAM,wBAAoB;AAAA,IACzB,OAAQ;AAAA,MACP,GAAK,aAAa,CAAC;AAAA,MACnB,kBAAkB;AAAA,QACjB,GAAK,WAAW,oBAAoB,CAAC;AAAA,QACrC,CAAE,kBAAAA,gCAAkB,UAAU,EAAE,OAAO,kBAAkB,CAAE;AAAA,MAC5D;AAAA,IACD;AAAA,IACA,CAAE,mBAAmB,SAAU;AAAA,EAChC;AAEA,SACC,4CAAC,QAAO,GAAG,OAAQ,WAAY,mBAAoB,kBAAgB,MAAC;AAEtE;", "names": ["ToolsPanelContext"] }