UNPKG

@wordpress/editor

Version:
8 lines (7 loc) 3.54 kB
{ "version": 3, "sources": ["../../src/dataviews/api.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { store as editorStore } from '../store';\n\n/**\n * @typedef {import('@wordpress/dataviews').Action} Action\n * @typedef {import('@wordpress/dataviews').Field} Field\n */\n\n/**\n * Registers a new DataViews action.\n *\n * This is an experimental API and is subject to change.\n * it's only available in the Gutenberg plugin for now.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {Action} config Action configuration.\n */\n\nexport function registerEntityAction( kind, name, config ) {\n\tconst { registerEntityAction: _registerEntityAction } = unlock(\n\t\tdispatch( editorStore )\n\t);\n\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t_registerEntityAction( kind, name, config );\n\t}\n}\n\n/**\n * Unregisters a DataViews action.\n *\n * This is an experimental API and is subject to change.\n * it's only available in the Gutenberg plugin for now.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} actionId Action ID.\n */\nexport function unregisterEntityAction( kind, name, actionId ) {\n\tconst { unregisterEntityAction: _unregisterEntityAction } = unlock(\n\t\tdispatch( editorStore )\n\t);\n\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t_unregisterEntityAction( kind, name, actionId );\n\t}\n}\n\n/**\n * Registers a new DataViews field.\n *\n * This is an experimental API and is subject to change.\n * it's only available in the Gutenberg plugin for now.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {Field} config Field configuration.\n */\nexport function registerEntityField( kind, name, config ) {\n\tconst { registerEntityField: _registerEntityField } = unlock(\n\t\tdispatch( editorStore )\n\t);\n\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t_registerEntityField( kind, name, config );\n\t}\n}\n\n/**\n * Unregisters a DataViews field.\n *\n * This is an experimental API and is subject to change.\n * it's only available in the Gutenberg plugin for now.\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} fieldId Field ID.\n */\nexport function unregisterEntityField( kind, name, fieldId ) {\n\tconst { unregisterEntityField: _unregisterEntityField } = unlock(\n\t\tdispatch( editorStore )\n\t);\n\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t_unregisterEntityField( kind, name, fieldId );\n\t}\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyB;AAKzB,yBAAuB;AACvB,mBAAqC;AAkB9B,SAAS,qBAAsB,MAAM,MAAM,QAAS;AAC1D,QAAM,EAAE,sBAAsB,sBAAsB,QAAI;AAAA,QACvD,sBAAU,aAAAA,KAAY;AAAA,EACvB;AAEA,MAAK,WAAW,qBAAsB;AACrC,0BAAuB,MAAM,MAAM,MAAO;AAAA,EAC3C;AACD;AAYO,SAAS,uBAAwB,MAAM,MAAM,UAAW;AAC9D,QAAM,EAAE,wBAAwB,wBAAwB,QAAI;AAAA,QAC3D,sBAAU,aAAAA,KAAY;AAAA,EACvB;AAEA,MAAK,WAAW,qBAAsB;AACrC,4BAAyB,MAAM,MAAM,QAAS;AAAA,EAC/C;AACD;AAYO,SAAS,oBAAqB,MAAM,MAAM,QAAS;AACzD,QAAM,EAAE,qBAAqB,qBAAqB,QAAI;AAAA,QACrD,sBAAU,aAAAA,KAAY;AAAA,EACvB;AAEA,MAAK,WAAW,qBAAsB;AACrC,yBAAsB,MAAM,MAAM,MAAO;AAAA,EAC1C;AACD;AAYO,SAAS,sBAAuB,MAAM,MAAM,SAAU;AAC5D,QAAM,EAAE,uBAAuB,uBAAuB,QAAI;AAAA,QACzD,sBAAU,aAAAA,KAAY;AAAA,EACvB;AAEA,MAAK,WAAW,qBAAsB;AACrC,2BAAwB,MAAM,MAAM,OAAQ;AAAA,EAC7C;AACD;", "names": ["editorStore"] }