wp/wp-includes/js/dist/data-controls.js
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     1 /******/ (function() { // webpackBootstrap
     1 /******/ (() => { // webpackBootstrap
     2 /******/ 	"use strict";
     2 /******/ 	"use strict";
     3 /******/ 	// The require scope
     3 /******/ 	// The require scope
     4 /******/ 	var __webpack_require__ = {};
     4 /******/ 	var __webpack_require__ = {};
     5 /******/ 	
     5 /******/ 	
     6 /************************************************************************/
     6 /************************************************************************/
     7 /******/ 	/* webpack/runtime/compat get default export */
     7 /******/ 	/* webpack/runtime/compat get default export */
     8 /******/ 	!function() {
     8 /******/ 	(() => {
     9 /******/ 		// getDefaultExport function for compatibility with non-harmony modules
     9 /******/ 		// getDefaultExport function for compatibility with non-harmony modules
    10 /******/ 		__webpack_require__.n = function(module) {
    10 /******/ 		__webpack_require__.n = (module) => {
    11 /******/ 			var getter = module && module.__esModule ?
    11 /******/ 			var getter = module && module.__esModule ?
    12 /******/ 				function() { return module['default']; } :
    12 /******/ 				() => (module['default']) :
    13 /******/ 				function() { return module; };
    13 /******/ 				() => (module);
    14 /******/ 			__webpack_require__.d(getter, { a: getter });
    14 /******/ 			__webpack_require__.d(getter, { a: getter });
    15 /******/ 			return getter;
    15 /******/ 			return getter;
    16 /******/ 		};
    16 /******/ 		};
    17 /******/ 	}();
    17 /******/ 	})();
    18 /******/ 	
    18 /******/ 	
    19 /******/ 	/* webpack/runtime/define property getters */
    19 /******/ 	/* webpack/runtime/define property getters */
    20 /******/ 	!function() {
    20 /******/ 	(() => {
    21 /******/ 		// define getter functions for harmony exports
    21 /******/ 		// define getter functions for harmony exports
    22 /******/ 		__webpack_require__.d = function(exports, definition) {
    22 /******/ 		__webpack_require__.d = (exports, definition) => {
    23 /******/ 			for(var key in definition) {
    23 /******/ 			for(var key in definition) {
    24 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    24 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    25 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    25 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    26 /******/ 				}
    26 /******/ 				}
    27 /******/ 			}
    27 /******/ 			}
    28 /******/ 		};
    28 /******/ 		};
    29 /******/ 	}();
    29 /******/ 	})();
    30 /******/ 	
    30 /******/ 	
    31 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    31 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    32 /******/ 	!function() {
    32 /******/ 	(() => {
    33 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
    33 /******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
    34 /******/ 	}();
    34 /******/ 	})();
    35 /******/ 	
    35 /******/ 	
    36 /******/ 	/* webpack/runtime/make namespace object */
    36 /******/ 	/* webpack/runtime/make namespace object */
    37 /******/ 	!function() {
    37 /******/ 	(() => {
    38 /******/ 		// define __esModule on exports
    38 /******/ 		// define __esModule on exports
    39 /******/ 		__webpack_require__.r = function(exports) {
    39 /******/ 		__webpack_require__.r = (exports) => {
    40 /******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    40 /******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    41 /******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    41 /******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    42 /******/ 			}
    42 /******/ 			}
    43 /******/ 			Object.defineProperty(exports, '__esModule', { value: true });
    43 /******/ 			Object.defineProperty(exports, '__esModule', { value: true });
    44 /******/ 		};
    44 /******/ 		};
    45 /******/ 	}();
    45 /******/ 	})();
    46 /******/ 	
    46 /******/ 	
    47 /************************************************************************/
    47 /************************************************************************/
    48 var __webpack_exports__ = {};
    48 var __webpack_exports__ = {};
    49 // ESM COMPAT FLAG
    49 // ESM COMPAT FLAG
    50 __webpack_require__.r(__webpack_exports__);
    50 __webpack_require__.r(__webpack_exports__);
    51 
    51 
    52 // EXPORTS
    52 // EXPORTS
    53 __webpack_require__.d(__webpack_exports__, {
    53 __webpack_require__.d(__webpack_exports__, {
    54   "__unstableAwaitPromise": function() { return /* binding */ __unstableAwaitPromise; },
    54   __unstableAwaitPromise: () => (/* binding */ __unstableAwaitPromise),
    55   "apiFetch": function() { return /* binding */ apiFetch; },
    55   apiFetch: () => (/* binding */ apiFetch),
    56   "controls": function() { return /* binding */ controls; },
    56   controls: () => (/* binding */ controls),
    57   "dispatch": function() { return /* binding */ dispatch; },
    57   dispatch: () => (/* binding */ dispatch),
    58   "select": function() { return /* binding */ build_module_select; },
    58   select: () => (/* binding */ build_module_select),
    59   "syncSelect": function() { return /* binding */ syncSelect; }
    59   syncSelect: () => (/* binding */ syncSelect)
    60 });
    60 });
    61 
    61 
    62 ;// CONCATENATED MODULE: external ["wp","apiFetch"]
    62 ;// CONCATENATED MODULE: external ["wp","apiFetch"]
    63 var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
    63 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
    64 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
    64 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
    65 ;// CONCATENATED MODULE: external ["wp","data"]
    65 ;// CONCATENATED MODULE: external ["wp","data"]
    66 var external_wp_data_namespaceObject = window["wp"]["data"];
    66 const external_wp_data_namespaceObject = window["wp"]["data"];
    67 ;// CONCATENATED MODULE: external ["wp","deprecated"]
    67 ;// CONCATENATED MODULE: external ["wp","deprecated"]
    68 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
    68 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
    69 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
    69 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
    70 ;// CONCATENATED MODULE: ./node_modules/@wordpress/data-controls/build-module/index.js
    70 ;// CONCATENATED MODULE: ./node_modules/@wordpress/data-controls/build-module/index.js
    71 /**
    71 /**
    72  * WordPress dependencies
    72  * WordPress dependencies
    73  */
    73  */
    91  * }
    91  * }
    92  * ```
    92  * ```
    93  *
    93  *
    94  * @return {Object} The control descriptor.
    94  * @return {Object} The control descriptor.
    95  */
    95  */
    96 
       
    97 function apiFetch(request) {
    96 function apiFetch(request) {
    98   return {
    97   return {
    99     type: 'API_FETCH',
    98     type: 'API_FETCH',
   100     request
    99     request
   101   };
   100   };
   102 }
   101 }
       
   102 
   103 /**
   103 /**
   104  * Control for resolving a selector in a registered data store.
   104  * Control for resolving a selector in a registered data store.
   105  * Alias for the `resolveSelect` built-in control in the `@wordpress/data` package.
   105  * Alias for the `resolveSelect` built-in control in the `@wordpress/data` package.
   106  *
   106  *
   107  * @param {Array} args Arguments passed without change to the `@wordpress/data` control.
   107  * @param storeNameOrDescriptor The store object or identifier.
   108  */
   108  * @param selectorName          The selector name.
   109 
   109  * @param args                  Arguments passed without change to the `@wordpress/data` control.
   110 function build_module_select() {
   110  */
       
   111 function build_module_select(storeNameOrDescriptor, selectorName, ...args) {
   111   external_wp_deprecated_default()('`select` control in `@wordpress/data-controls`', {
   112   external_wp_deprecated_default()('`select` control in `@wordpress/data-controls`', {
   112     since: '5.7',
   113     since: '5.7',
   113     alternative: 'built-in `resolveSelect` control in `@wordpress/data`'
   114     alternative: 'built-in `resolveSelect` control in `@wordpress/data`'
   114   });
   115   });
   115   return external_wp_data_namespaceObject.controls.resolveSelect(...arguments);
   116   return external_wp_data_namespaceObject.controls.resolveSelect(storeNameOrDescriptor, selectorName, ...args);
   116 }
   117 }
       
   118 
   117 /**
   119 /**
   118  * Control for calling a selector in a registered data store.
   120  * Control for calling a selector in a registered data store.
   119  * Alias for the `select` built-in control in the `@wordpress/data` package.
   121  * Alias for the `select` built-in control in the `@wordpress/data` package.
   120  *
   122  *
   121  * @param {Array} args Arguments passed without change to the `@wordpress/data` control.
   123  * @param storeNameOrDescriptor The store object or identifier.
   122  */
   124  * @param selectorName          The selector name.
   123 
   125  * @param args                  Arguments passed without change to the `@wordpress/data` control.
   124 function syncSelect() {
   126  */
       
   127 function syncSelect(storeNameOrDescriptor, selectorName, ...args) {
   125   external_wp_deprecated_default()('`syncSelect` control in `@wordpress/data-controls`', {
   128   external_wp_deprecated_default()('`syncSelect` control in `@wordpress/data-controls`', {
   126     since: '5.7',
   129     since: '5.7',
   127     alternative: 'built-in `select` control in `@wordpress/data`'
   130     alternative: 'built-in `select` control in `@wordpress/data`'
   128   });
   131   });
   129   return external_wp_data_namespaceObject.controls.select(...arguments);
   132   return external_wp_data_namespaceObject.controls.select(storeNameOrDescriptor, selectorName, ...args);
   130 }
   133 }
       
   134 
   131 /**
   135 /**
   132  * Control for dispatching an action in a registered data store.
   136  * Control for dispatching an action in a registered data store.
   133  * Alias for the `dispatch` control in the `@wordpress/data` package.
   137  * Alias for the `dispatch` control in the `@wordpress/data` package.
   134  *
   138  *
   135  * @param {Array} args Arguments passed without change to the `@wordpress/data` control.
   139  * @param storeNameOrDescriptor The store object or identifier.
   136  */
   140  * @param actionName            The action name.
   137 
   141  * @param args                  Arguments passed without change to the `@wordpress/data` control.
   138 function dispatch() {
   142  */
       
   143 function dispatch(storeNameOrDescriptor, actionName, ...args) {
   139   external_wp_deprecated_default()('`dispatch` control in `@wordpress/data-controls`', {
   144   external_wp_deprecated_default()('`dispatch` control in `@wordpress/data-controls`', {
   140     since: '5.7',
   145     since: '5.7',
   141     alternative: 'built-in `dispatch` control in `@wordpress/data`'
   146     alternative: 'built-in `dispatch` control in `@wordpress/data`'
   142   });
   147   });
   143   return external_wp_data_namespaceObject.controls.dispatch(...arguments);
   148   return external_wp_data_namespaceObject.controls.dispatch(storeNameOrDescriptor, actionName, ...args);
   144 }
   149 }
       
   150 
   145 /**
   151 /**
   146  * Dispatches a control action for awaiting on a promise to be resolved.
   152  * Dispatches a control action for awaiting on a promise to be resolved.
   147  *
   153  *
   148  * @param {Object} promise Promise to wait for.
   154  * @param {Object} promise Promise to wait for.
   149  *
   155  *
   159  * }
   165  * }
   160  * ```
   166  * ```
   161  *
   167  *
   162  * @return {Object} The control descriptor.
   168  * @return {Object} The control descriptor.
   163  */
   169  */
   164 
       
   165 const __unstableAwaitPromise = function (promise) {
   170 const __unstableAwaitPromise = function (promise) {
   166   return {
   171   return {
   167     type: 'AWAIT_PROMISE',
   172     type: 'AWAIT_PROMISE',
   168     promise
   173     promise
   169   };
   174   };
   170 };
   175 };
       
   176 
   171 /**
   177 /**
   172  * The default export is what you use to register the controls with your custom
   178  * The default export is what you use to register the controls with your custom
   173  * store.
   179  * store.
   174  *
   180  *
   175  * @example
   181  * @example
   193  * } );
   199  * } );
   194  * ```
   200  * ```
   195  * @return {Object} An object for registering the default controls with the
   201  * @return {Object} An object for registering the default controls with the
   196  * store.
   202  * store.
   197  */
   203  */
   198 
       
   199 const controls = {
   204 const controls = {
   200   AWAIT_PROMISE: _ref => {
   205   AWAIT_PROMISE: ({
   201     let {
   206     promise
   202       promise
   207   }) => promise,
   203     } = _ref;
   208   API_FETCH({
   204     return promise;
   209     request
   205   },
   210   }) {
   206 
       
   207   API_FETCH(_ref2) {
       
   208     let {
       
   209       request
       
   210     } = _ref2;
       
   211     return external_wp_apiFetch_default()(request);
   211     return external_wp_apiFetch_default()(request);
   212   }
   212   }
   213 
       
   214 };
   213 };
   215 
   214 
   216 (window.wp = window.wp || {}).dataControls = __webpack_exports__;
   215 (window.wp = window.wp || {}).dataControls = __webpack_exports__;
   217 /******/ })()
   216 /******/ })()
   218 ;
   217 ;