WordPress/wp-includes/js/dist/plugins.js.map

1 line
20 KiB
Plaintext

{"version":3,"sources":["webpack://wp.[name]/webpack/bootstrap","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/classCallCheck.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/createClass.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/inherits.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/objectSpread.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://wp.[name]//Users/riad/Workspace/a8c/gutenberg/packages/plugins/src/api/index.js","webpack://wp.[name]//Users/riad/Workspace/a8c/gutenberg/packages/plugins/src/components/index.js","webpack://wp.[name]//Users/riad/Workspace/a8c/gutenberg/packages/plugins/src/components/plugin-area/index.js","webpack://wp.[name]//Users/riad/Workspace/a8c/gutenberg/packages/plugins/src/components/plugin-context/index.js","webpack://wp.[name]//Users/riad/Workspace/a8c/gutenberg/packages/plugins/src/index.js","webpack://wp.[name]/external {\"this\":[\"wp\",\"compose\"]}","webpack://wp.[name]/external {\"this\":[\"wp\",\"element\"]}","webpack://wp.[name]/external {\"this\":[\"wp\",\"hooks\"]}","webpack://wp.[name]/external \"lodash\""],"names":["plugins","registerPlugin","name","settings","console","error","test","applyFilters","isFunction","render","icon","doAction","unregisterPlugin","oldPlugin","getPlugin","getPlugins","Object","values","PluginArea","arguments","setPlugins","bind","state","getCurrentPluginsState","map","Plugin","context","addAction","removeAction","setState","display","Component","createContext","Consumer","Provider","withPluginContext","mapContextToProps","createHigherOrderComponent","OriginalComponent","props"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAe;AACf;AACA;AACA;;AAEA;AACA,C;;;;;;;;;;;;ACNA;AAAA;AAAe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;ACJA;AAAA;AAAA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEe;AACf;AACA;AACA;AACA,C;;;;;;;;;;;;ACdA;AAAA;AAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA,C;;;;;;;;;;;;ACbA;AAAA;AAAe;AACf;AACA,mBAAmB,sBAAsB;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,C;;;;;;;;;;;;AChBA;AAAA;AAAe;AACf;AACA;AACA;AACA;AACA,C;;;;;;;;;;;;ACLA;AAAA;AAAA;AAA8C;AAC/B;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,kBAAkB,+DAAc;AAChC,C;;;;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,Q;;AAKlB;AAEA;;;;;;;;;;;AAUO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAAEC,iBAAF;AAAA,SAAyBC,qFAA0B,CAAE,UAAEC,iBAAF,EAAyB;AAC9G,WAAO,UAAEC,KAAF;AAAA,aACN,yEAAC,QAAD,QACG,UAAEb,OAAF;AAAA,eACD,yEAAC,iBAAD,yFACMa,KADN,EAEMH,iBAAiB,CAAEV,OAAF,EAAWa,KAAX,CAFvB,EADC;AAAA,OADH,CADM;AAAA,KAAP;AAUA,GAXmF,EAWjF,mBAXiF,CAAnD;AAAA,CAA1B;;;;;;;;;;;;;ACvBP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;;;;;;;;;;;;ACDA,aAAa,wCAAwC,EAAE,I;;;;;;;;;;;ACAvD,aAAa,wCAAwC,EAAE,I;;;;;;;;;;;ACAvD,aAAa,sCAAsC,EAAE,I;;;;;;;;;;;ACArD,aAAa,iCAAiC,EAAE,I","file":"plugins.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./node_modules/@wordpress/plugins/build-module/index.js\");\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import defineProperty from \"./defineProperty\";\nexport default function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nexport default function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}","/* eslint no-console: [ 'error', { allow: [ 'error' ] } ] */\n\n/**\n * WordPress dependencies\n */\nimport { applyFilters, doAction } from '@wordpress/hooks';\n\n/**\n * External dependencies\n */\nimport { isFunction } from 'lodash';\n\n/**\n * Plugin definitions keyed by plugin name.\n *\n * @type {Object.<string,WPPlugin>}\n */\nconst plugins = {};\n\n/**\n * Registers a plugin to the editor.\n *\n * @param {string} name The name of the plugin.\n * @param {Object} settings The settings for this plugin.\n * @param {Function} settings.render The function that renders the plugin.\n * @param {string|WPElement|Function} settings.icon An icon to be shown in the UI.\n *\n * @return {Object} The final plugin settings object.\n */\nexport function registerPlugin( name, settings ) {\n\tif ( typeof settings !== 'object' ) {\n\t\tconsole.error(\n\t\t\t'No settings object provided!'\n\t\t);\n\t\treturn null;\n\t}\n\tif ( typeof name !== 'string' ) {\n\t\tconsole.error(\n\t\t\t'Plugin names must be strings.'\n\t\t);\n\t\treturn null;\n\t}\n\tif ( ! /^[a-z][a-z0-9-]*$/.test( name ) ) {\n\t\tconsole.error(\n\t\t\t'Plugin names must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: \"my-plugin\".'\n\t\t);\n\t\treturn null;\n\t}\n\tif ( plugins[ name ] ) {\n\t\tconsole.error(\n\t\t\t`Plugin \"${ name }\" is already registered.`\n\t\t);\n\t}\n\n\tsettings = applyFilters( 'plugins.registerPlugin', settings, name );\n\n\tif ( ! isFunction( settings.render ) ) {\n\t\tconsole.error(\n\t\t\t'The \"render\" property must be specified and must be a valid function.'\n\t\t);\n\t\treturn null;\n\t}\n\n\tplugins[ name ] = {\n\t\tname,\n\t\ticon: 'admin-plugins',\n\t\t...settings,\n\t};\n\n\tdoAction( 'plugins.pluginRegistered', settings, name );\n\n\treturn settings;\n}\n\n/**\n * Unregisters a plugin by name.\n *\n * @param {string} name Plugin name.\n *\n * @return {?WPPlugin} The previous plugin settings object, if it has been\n * successfully unregistered; otherwise `undefined`.\n */\nexport function unregisterPlugin( name ) {\n\tif ( ! plugins[ name ] ) {\n\t\tconsole.error(\n\t\t\t'Plugin \"' + name + '\" is not registered.'\n\t\t);\n\t\treturn;\n\t}\n\tconst oldPlugin = plugins[ name ];\n\tdelete plugins[ name ];\n\n\tdoAction( 'plugins.pluginUnregistered', oldPlugin, name );\n\n\treturn oldPlugin;\n}\n\n/**\n * Returns a registered plugin settings.\n *\n * @param {string} name Plugin name.\n *\n * @return {?Object} Plugin setting.\n */\nexport function getPlugin( name ) {\n\treturn plugins[ name ];\n}\n\n/**\n * Returns all registered plugins.\n *\n * @return {Array} Plugin settings.\n */\nexport function getPlugins() {\n\treturn Object.values( plugins );\n}\n","export { default as PluginArea } from './plugin-area';\nexport { withPluginContext } from './plugin-context';\n","/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { PluginContextProvider } from '../plugin-context';\nimport { getPlugins } from '../../api';\n\n/**\n * A component that renders all plugin fills in a hidden div.\n *\n * @return {WPElement} Plugin area.\n */\nclass PluginArea extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.setPlugins = this.setPlugins.bind( this );\n\t\tthis.state = this.getCurrentPluginsState();\n\t}\n\n\tgetCurrentPluginsState() {\n\t\treturn {\n\t\t\tplugins: map( getPlugins(), ( { icon, name, render } ) => {\n\t\t\t\treturn {\n\t\t\t\t\tPlugin: render,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\tname,\n\t\t\t\t\t\ticon,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} ),\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\taddAction( 'plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered', this.setPlugins );\n\t\taddAction( 'plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered', this.setPlugins );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tremoveAction( 'plugins.pluginRegistered', 'core/plugins/plugin-area/plugins-registered' );\n\t\tremoveAction( 'plugins.pluginUnregistered', 'core/plugins/plugin-area/plugins-unregistered' );\n\t}\n\n\tsetPlugins() {\n\t\tthis.setState( this.getCurrentPluginsState );\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<div style={ { display: 'none' } }>\n\t\t\t\t{ map( this.state.plugins, ( { context, Plugin } ) => (\n\t\t\t\t\t<PluginContextProvider\n\t\t\t\t\t\tkey={ context.name }\n\t\t\t\t\t\tvalue={ context }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Plugin />\n\t\t\t\t\t</PluginContextProvider>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default PluginArea;\n","/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\nconst { Consumer, Provider } = createContext( {\n\tname: null,\n\ticon: null,\n} );\n\nexport { Provider as PluginContextProvider };\n\n/**\n * A Higher Order Component used to inject Plugin context to the\n * wrapped component.\n *\n * @param {Function} mapContextToProps Function called on every context change,\n * expected to return object of props to\n * merge with the component's own props.\n *\n * @return {Component} Enhanced component with injected context as props.\n */\nexport const withPluginContext = ( mapContextToProps ) => createHigherOrderComponent( ( OriginalComponent ) => {\n\treturn ( props ) => (\n\t\t<Consumer>\n\t\t\t{ ( context ) => (\n\t\t\t\t<OriginalComponent\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t{ ...mapContextToProps( context, props ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Consumer>\n\t);\n}, 'withPluginContext' );\n","export * from './components';\nexport * from './api';\n","(function() { module.exports = this[\"wp\"][\"compose\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());","(function() { module.exports = this[\"wp\"][\"hooks\"]; }());","(function() { module.exports = this[\"lodash\"]; }());"],"sourceRoot":""}