| @@ -1,218 +1 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ "use strict"; | |
| 3 | -/******/ // The require scope | |
| 4 | -/******/ var __webpack_require__ = {}; | |
| 5 | -/******/ | |
| 6 | -/************************************************************************/ | |
| 7 | -/******/ /* webpack/runtime/compat get default export */ | |
| 8 | -/******/ !function() { | |
| 9 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 10 | -/******/ __webpack_require__.n = function(module) { | |
| 11 | -/******/ var getter = module && module.__esModule ? | |
| 12 | -/******/ function() { return module['default']; } : | |
| 13 | -/******/ function() { return module; }; | |
| 14 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 15 | -/******/ return getter; | |
| 16 | -/******/ }; | |
| 17 | -/******/ }(); | |
| 18 | -/******/ | |
| 19 | -/******/ /* webpack/runtime/define property getters */ | |
| 20 | -/******/ !function() { | |
| 21 | -/******/ // define getter functions for harmony exports | |
| 22 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 23 | -/******/ for(var key in definition) { | |
| 24 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 25 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 26 | -/******/ } | |
| 27 | -/******/ } | |
| 28 | -/******/ }; | |
| 29 | -/******/ }(); | |
| 30 | -/******/ | |
| 31 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 32 | -/******/ !function() { | |
| 33 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 34 | -/******/ }(); | |
| 35 | -/******/ | |
| 36 | -/******/ /* webpack/runtime/make namespace object */ | |
| 37 | -/******/ !function() { | |
| 38 | -/******/ // define __esModule on exports | |
| 39 | -/******/ __webpack_require__.r = function(exports) { | |
| 40 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 41 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 42 | -/******/ } | |
| 43 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 44 | -/******/ }; | |
| 45 | -/******/ }(); | |
| 46 | -/******/ | |
| 47 | -/************************************************************************/ | |
| 48 | -var __webpack_exports__ = {}; | |
| 49 | -// ESM COMPAT FLAG | |
| 50 | -__webpack_require__.r(__webpack_exports__); | |
| 51 | - | |
| 52 | -// EXPORTS | |
| 53 | -__webpack_require__.d(__webpack_exports__, { | |
| 54 | - "__unstableAwaitPromise": function() { return /* binding */ __unstableAwaitPromise; }, | |
| 55 | - "apiFetch": function() { return /* binding */ apiFetch; }, | |
| 56 | - "controls": function() { return /* binding */ controls; }, | |
| 57 | - "dispatch": function() { return /* binding */ dispatch; }, | |
| 58 | - "select": function() { return /* binding */ build_module_select; }, | |
| 59 | - "syncSelect": function() { return /* binding */ syncSelect; } | |
| 60 | -}); | |
| 61 | - | |
| 62 | -;// CONCATENATED MODULE: external ["wp","apiFetch"] | |
| 63 | -var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; | |
| 64 | -var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); | |
| 65 | -;// CONCATENATED MODULE: external ["wp","data"] | |
| 66 | -var external_wp_data_namespaceObject = window["wp"]["data"]; | |
| 67 | -;// CONCATENATED MODULE: external ["wp","deprecated"] | |
| 68 | -var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; | |
| 69 | -var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); | |
| 70 | -;// CONCATENATED MODULE: ./packages/data-controls/build-module/index.js | |
| 71 | -/** | |
| 72 | - * WordPress dependencies | |
| 73 | - */ | |
| 74 | - | |
| 75 | - | |
| 76 | - | |
| 77 | -/** | |
| 78 | - * Dispatches a control action for triggering an api fetch call. | |
| 79 | - * | |
| 80 | - * @param {Object} request Arguments for the fetch request. | |
| 81 | - * | |
| 82 | - * @example | |
| 83 | - * ```js | |
| 84 | - * import { apiFetch } from '@wordpress/data-controls'; | |
| 85 | - * | |
| 86 | - * // Action generator using apiFetch | |
| 87 | - * export function* myAction() { | |
| 88 | - * const path = '/v2/my-api/items'; | |
| 89 | - * const items = yield apiFetch( { path } ); | |
| 90 | - * // do something with the items. | |
| 91 | - * } | |
| 92 | - * ``` | |
| 93 | - * | |
| 94 | - * @return {Object} The control descriptor. | |
| 95 | - */ | |
| 96 | - | |
| 97 | -function apiFetch(request) { | |
| 98 | - return { | |
| 99 | - type: 'API_FETCH', | |
| 100 | - request | |
| 101 | - }; | |
| 102 | -} | |
| 103 | -/** | |
| 104 | - * Control for resolving a selector in a registered data store. | |
| 105 | - * Alias for the `resolveSelect` built-in control in the `@wordpress/data` package. | |
| 106 | - * | |
| 107 | - * @param {Array} args Arguments passed without change to the `@wordpress/data` control. | |
| 108 | - */ | |
| 109 | - | |
| 110 | -function build_module_select() { | |
| 111 | - external_wp_deprecated_default()('`select` control in `@wordpress/data-controls`', { | |
| 112 | - since: '5.7', | |
| 113 | - alternative: 'built-in `resolveSelect` control in `@wordpress/data`' | |
| 114 | - }); | |
| 115 | - return external_wp_data_namespaceObject.controls.resolveSelect(...arguments); | |
| 116 | -} | |
| 117 | -/** | |
| 118 | - * Control for calling a selector in a registered data store. | |
| 119 | - * Alias for the `select` built-in control in the `@wordpress/data` package. | |
| 120 | - * | |
| 121 | - * @param {Array} args Arguments passed without change to the `@wordpress/data` control. | |
| 122 | - */ | |
| 123 | - | |
| 124 | -function syncSelect() { | |
| 125 | - external_wp_deprecated_default()('`syncSelect` control in `@wordpress/data-controls`', { | |
| 126 | - since: '5.7', | |
| 127 | - alternative: 'built-in `select` control in `@wordpress/data`' | |
| 128 | - }); | |
| 129 | - return external_wp_data_namespaceObject.controls.select(...arguments); | |
| 130 | -} | |
| 131 | -/** | |
| 132 | - * Control for dispatching an action in a registered data store. | |
| 133 | - * Alias for the `dispatch` control in the `@wordpress/data` package. | |
| 134 | - * | |
| 135 | - * @param {Array} args Arguments passed without change to the `@wordpress/data` control. | |
| 136 | - */ | |
| 137 | - | |
| 138 | -function dispatch() { | |
| 139 | - external_wp_deprecated_default()('`dispatch` control in `@wordpress/data-controls`', { | |
| 140 | - since: '5.7', | |
| 141 | - alternative: 'built-in `dispatch` control in `@wordpress/data`' | |
| 142 | - }); | |
| 143 | - return external_wp_data_namespaceObject.controls.dispatch(...arguments); | |
| 144 | -} | |
| 145 | -/** | |
| 146 | - * Dispatches a control action for awaiting on a promise to be resolved. | |
| 147 | - * | |
| 148 | - * @param {Object} promise Promise to wait for. | |
| 149 | - * | |
| 150 | - * @example | |
| 151 | - * ```js | |
| 152 | - * import { __unstableAwaitPromise } from '@wordpress/data-controls'; | |
| 153 | - * | |
| 154 | - * // Action generator using apiFetch | |
| 155 | - * export function* myAction() { | |
| 156 | - * const promise = getItemsAsync(); | |
| 157 | - * const items = yield __unstableAwaitPromise( promise ); | |
| 158 | - * // do something with the items. | |
| 159 | - * } | |
| 160 | - * ``` | |
| 161 | - * | |
| 162 | - * @return {Object} The control descriptor. | |
| 163 | - */ | |
| 164 | - | |
| 165 | -const __unstableAwaitPromise = function (promise) { | |
| 166 | - return { | |
| 167 | - type: 'AWAIT_PROMISE', | |
| 168 | - promise | |
| 169 | - }; | |
| 170 | -}; | |
| 171 | -/** | |
| 172 | - * The default export is what you use to register the controls with your custom | |
| 173 | - * store. | |
| 174 | - * | |
| 175 | - * @example | |
| 176 | - * ```js | |
| 177 | - * // WordPress dependencies | |
| 178 | - * import { controls } from '@wordpress/data-controls'; | |
| 179 | - * import { registerStore } from '@wordpress/data'; | |
| 180 | - * | |
| 181 | - * // Internal dependencies | |
| 182 | - * import reducer from './reducer'; | |
| 183 | - * import * as selectors from './selectors'; | |
| 184 | - * import * as actions from './actions'; | |
| 185 | - * import * as resolvers from './resolvers'; | |
| 186 | - * | |
| 187 | - * registerStore( 'my-custom-store', { | |
| 188 | - * reducer, | |
| 189 | - * controls, | |
| 190 | - * actions, | |
| 191 | - * selectors, | |
| 192 | - * resolvers, | |
| 193 | - * } ); | |
| 194 | - * ``` | |
| 195 | - * @return {Object} An object for registering the default controls with the | |
| 196 | - * store. | |
| 197 | - */ | |
| 198 | - | |
| 199 | -const controls = { | |
| 200 | - AWAIT_PROMISE: _ref => { | |
| 201 | - let { | |
| 202 | - promise | |
| 203 | - } = _ref; | |
| 204 | - return promise; | |
| 205 | - }, | |
| 206 | - | |
| 207 | - API_FETCH(_ref2) { | |
| 208 | - let { | |
| 209 | - request | |
| 210 | - } = _ref2; | |
| 211 | - return external_wp_apiFetch_default()(request); | |
| 212 | - } | |
| 213 | - | |
| 214 | -}; | |
| 215 | -//# sourceMappingURL=index.js.map | |
| 216 | -(window.wp = window.wp || {}).dataControls = __webpack_exports__; | |
| 217 | -/******/ })() | |
| 218 | -; | |
| 1 | +this.wp=this.wp||{},this.wp.dataControls=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=354)}({16:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(27);var o=r(35),u=r(29);function c(t){return function(t){if(Array.isArray(t))return Object(n.a)(t)}(t)||Object(o.a)(t)||Object(u.a)(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},27:function(t,e,r){"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}r.d(e,"a",(function(){return n}))},29:function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r(27);function o(t,e){if(t){if("string"==typeof t)return Object(n.a)(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(t,e):void 0}}},35:function(t,e,r){"use strict";function n(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}r.d(e,"a",(function(){return n}))},354:function(t,e,r){"use strict";r.r(e),r.d(e,"apiFetch",(function(){return a})),r.d(e,"select",(function(){return i})),r.d(e,"__unstableSyncSelect",(function(){return f})),r.d(e,"dispatch",(function(){return s})),r.d(e,"controls",(function(){return l}));var n=r(16),o=r(38),u=r.n(o),c=r(4),a=function(t){return{type:"API_FETCH",request:t}};function i(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];return{type:"SELECT",storeKey:t,selectorName:e,args:n}}function f(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];return{type:"SYNC_SELECT",storeKey:t,selectorName:e,args:n}}function s(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];return{type:"DISPATCH",storeKey:t,actionName:e,args:n}}var l={API_FETCH:function(t){var e=t.request;return u()(e)},SELECT:Object(c.createRegistryControl)((function(t){return function(e){var r,o=e.storeKey,u=e.selectorName,c=e.args;return(r=t[t.select(o)[u].hasResolver?"__experimentalResolveSelect":"select"](o))[u].apply(r,Object(n.a)(c))}})),SYNC_SELECT:Object(c.createRegistryControl)((function(t){return function(e){var r,o=e.storeKey,u=e.selectorName,c=e.args;return(r=t.select(o))[u].apply(r,Object(n.a)(c))}})),DISPATCH:Object(c.createRegistryControl)((function(t){return function(e){var r,o=e.storeKey,u=e.actionName,c=e.args;return(r=t.dispatch(o))[u].apply(r,Object(n.a)(c))}}))}},38:function(t,e){!function(){t.exports=this.wp.apiFetch}()},4:function(t,e){!function(){t.exports=this.wp.data}()}}); | |