UNPKG

@wordpress/data

Version:
8 lines (7 loc) 1.08 kB
{ "version": 3, "sources": ["../../../src/components/with-registry/index.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { RegistryConsumer } from '../registry-provider';\n\n/**\n * Higher-order component which renders the original component with the current\n * registry context passed as its `registry` prop.\n *\n * @param {Component} OriginalComponent Original component.\n *\n * @return {Component} Enhanced component.\n */\nconst withRegistry = createHigherOrderComponent(\n\t( OriginalComponent ) => ( props ) => (\n\t\t<RegistryConsumer>\n\t\t\t{ ( registry ) => (\n\t\t\t\t<OriginalComponent { ...props } registry={ registry } />\n\t\t\t) }\n\t\t</RegistryConsumer>\n\t),\n\t'withRegistry'\n);\n\nexport default withRegistry;\n"], "mappings": ";AAGA,SAAS,kCAAkC;AAK3C,SAAS,wBAAwB;AAc7B;AAJJ,IAAM,eAAe;AAAA,EACpB,CAAE,sBAAuB,CAAE,UAC1B,oBAAC,oBACE,WAAE,aACH,oBAAC,qBAAoB,GAAG,OAAQ,UAAsB,GAExD;AAAA,EAED;AACD;AAEA,IAAO,wBAAQ;", "names": [] }