UNPKG

@wordpress/blocks

Version:
8 lines (7 loc) 2.88 kB
{ "version": 3, "sources": ["../../src/store/private-actions.js"], "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { processBlockType } from './process-block-type';\n\n/** @typedef {import('../api/registration').WPBlockType} WPBlockType */\n\n/**\n * Add bootstrapped block type metadata to the store. These metadata usually come from\n * the `block.json` file and are either statically bootstrapped from the server, or\n * passed as the `metadata` parameter to the `registerBlockType` function.\n *\n * @param {string} name Block name.\n * @param {WPBlockType} blockType Block type metadata.\n */\nexport function addBootstrappedBlockType( name, blockType ) {\n\treturn {\n\t\ttype: 'ADD_BOOTSTRAPPED_BLOCK_TYPE',\n\t\tname,\n\t\tblockType,\n\t};\n}\n\n/**\n * Add unprocessed block type settings to the store. These data are passed as the\n * `settings` parameter to the client-side `registerBlockType` function.\n *\n * @param {string} name Block name.\n * @param {WPBlockType} blockType Unprocessed block type settings.\n */\nexport function addUnprocessedBlockType( name, blockType ) {\n\treturn ( { dispatch } ) => {\n\t\tdispatch( { type: 'ADD_UNPROCESSED_BLOCK_TYPE', name, blockType } );\n\t\tconst processedBlockType = dispatch(\n\t\t\tprocessBlockType( name, blockType )\n\t\t);\n\t\tif ( ! processedBlockType ) {\n\t\t\treturn;\n\t\t}\n\t\tdispatch.addBlockTypes( processedBlockType );\n\t};\n}\n\n/**\n * Adds new block bindings source.\n *\n * @param {string} source Name of the source to register.\n */\nexport function addBlockBindingsSource( source ) {\n\treturn {\n\t\ttype: 'ADD_BLOCK_BINDINGS_SOURCE',\n\t\tname: source.name,\n\t\tlabel: source.label,\n\t\tusesContext: source.usesContext,\n\t\tgetValues: source.getValues,\n\t\tsetValues: source.setValues,\n\t\tcanUserEditValue: source.canUserEditValue,\n\t\tgetFieldsList: source.getFieldsList,\n\t};\n}\n\n/**\n * Removes existing block bindings source.\n *\n * @param {string} name Name of the source to remove.\n */\nexport function removeBlockBindingsSource( name ) {\n\treturn {\n\t\ttype: 'REMOVE_BLOCK_BINDINGS_SOURCE',\n\t\tname,\n\t};\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAAiC;AAY1B,SAAS,yBAA0B,MAAM,WAAY;AAC3D,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AASO,SAAS,wBAAyB,MAAM,WAAY;AAC1D,SAAO,CAAE,EAAE,SAAS,MAAO;AAC1B,aAAU,EAAE,MAAM,8BAA8B,MAAM,UAAU,CAAE;AAClE,UAAM,qBAAqB;AAAA,UAC1B,4CAAkB,MAAM,SAAU;AAAA,IACnC;AACA,QAAK,CAAE,oBAAqB;AAC3B;AAAA,IACD;AACA,aAAS,cAAe,kBAAmB;AAAA,EAC5C;AACD;AAOO,SAAS,uBAAwB,QAAS;AAChD,SAAO;AAAA,IACN,MAAM;AAAA,IACN,MAAM,OAAO;AAAA,IACb,OAAO,OAAO;AAAA,IACd,aAAa,OAAO;AAAA,IACpB,WAAW,OAAO;AAAA,IAClB,WAAW,OAAO;AAAA,IAClB,kBAAkB,OAAO;AAAA,IACzB,eAAe,OAAO;AAAA,EACvB;AACD;AAOO,SAAS,0BAA2B,MAAO;AACjD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;", "names": [] }