[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 /******/ (function() { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ // The require scope 4 /******/ var __webpack_require__ = {}; 5 /******/ 6 /************************************************************************/ 7 /******/ /* webpack/runtime/define property getters */ 8 /******/ !function() { 9 /******/ // define getter functions for harmony exports 10 /******/ __webpack_require__.d = function(exports, definition) { 11 /******/ for(var key in definition) { 12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 14 /******/ } 15 /******/ } 16 /******/ }; 17 /******/ }(); 18 /******/ 19 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 20 /******/ !function() { 21 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 22 /******/ }(); 23 /******/ 24 /******/ /* webpack/runtime/make namespace object */ 25 /******/ !function() { 26 /******/ // define __esModule on exports 27 /******/ __webpack_require__.r = function(exports) { 28 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 29 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 30 /******/ } 31 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 32 /******/ }; 33 /******/ }(); 34 /******/ 35 /************************************************************************/ 36 var __webpack_exports__ = {}; 37 // ESM COMPAT FLAG 38 __webpack_require__.r(__webpack_exports__); 39 40 // EXPORTS 41 __webpack_require__.d(__webpack_exports__, { 42 "store": function() { return /* reexport */ store; } 43 }); 44 45 // NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/actions.js 46 var actions_namespaceObject = {}; 47 __webpack_require__.r(actions_namespaceObject); 48 __webpack_require__.d(actions_namespaceObject, { 49 "createErrorNotice": function() { return createErrorNotice; }, 50 "createInfoNotice": function() { return createInfoNotice; }, 51 "createNotice": function() { return createNotice; }, 52 "createSuccessNotice": function() { return createSuccessNotice; }, 53 "createWarningNotice": function() { return createWarningNotice; }, 54 "removeNotice": function() { return removeNotice; } 55 }); 56 57 // NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/selectors.js 58 var selectors_namespaceObject = {}; 59 __webpack_require__.r(selectors_namespaceObject); 60 __webpack_require__.d(selectors_namespaceObject, { 61 "getNotices": function() { return getNotices; } 62 }); 63 64 ;// CONCATENATED MODULE: external ["wp","data"] 65 var external_wp_data_namespaceObject = window["wp"]["data"]; 66 ;// CONCATENATED MODULE: external "lodash" 67 var external_lodash_namespaceObject = window["lodash"]; 68 ;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/utils/on-sub-key.js 69 /** 70 * Higher-order reducer creator which creates a combined reducer object, keyed 71 * by a property on the action object. 72 * 73 * @param {string} actionProperty Action property by which to key object. 74 * 75 * @return {Function} Higher-order reducer. 76 */ 77 const onSubKey = actionProperty => reducer => function () { 78 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 79 let action = arguments.length > 1 ? arguments[1] : undefined; 80 // Retrieve subkey from action. Do not track if undefined; useful for cases 81 // where reducer is scoped by action shape. 82 const key = action[actionProperty]; 83 84 if (key === undefined) { 85 return state; 86 } // Avoid updating state if unchanged. Note that this also accounts for a 87 // reducer which returns undefined on a key which is not yet tracked. 88 89 90 const nextKeyState = reducer(state[key], action); 91 92 if (nextKeyState === state[key]) { 93 return state; 94 } 95 96 return { ...state, 97 [key]: nextKeyState 98 }; 99 }; 100 /* harmony default export */ var on_sub_key = (onSubKey); 101 102 ;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/reducer.js 103 /** 104 * External dependencies 105 */ 106 107 /** 108 * Internal dependencies 109 */ 110 111 112 /** 113 * Reducer returning the next notices state. The notices state is an object 114 * where each key is a context, its value an array of notice objects. 115 * 116 * @param {Object} state Current state. 117 * @param {Object} action Dispatched action. 118 * 119 * @return {Object} Updated state. 120 */ 121 122 const notices = on_sub_key('context')(function () { 123 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 124 let action = arguments.length > 1 ? arguments[1] : undefined; 125 126 switch (action.type) { 127 case 'CREATE_NOTICE': 128 // Avoid duplicates on ID. 129 return [...(0,external_lodash_namespaceObject.reject)(state, { 130 id: action.notice.id 131 }), action.notice]; 132 133 case 'REMOVE_NOTICE': 134 return (0,external_lodash_namespaceObject.reject)(state, { 135 id: action.id 136 }); 137 } 138 139 return state; 140 }); 141 /* harmony default export */ var reducer = (notices); 142 143 ;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/constants.js 144 /** 145 * Default context to use for notice grouping when not otherwise specified. Its 146 * specific value doesn't hold much meaning, but it must be reasonably unique 147 * and, more importantly, referenced consistently in the store implementation. 148 * 149 * @type {string} 150 */ 151 const DEFAULT_CONTEXT = 'global'; 152 /** 153 * Default notice status. 154 * 155 * @type {string} 156 */ 157 158 const DEFAULT_STATUS = 'info'; 159 160 ;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/actions.js 161 /** 162 * External dependencies 163 */ 164 165 /** 166 * Internal dependencies 167 */ 168 169 170 /** 171 * @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice. 172 * 173 * @property {string} label Message to use as action label. 174 * @property {?string} url Optional URL of resource if action incurs 175 * browser navigation. 176 * @property {?Function} onClick Optional function to invoke when action is 177 * triggered by user. 178 * 179 */ 180 181 /** 182 * Returns an action object used in signalling that a notice is to be created. 183 * 184 * @param {string} [status='info'] Notice status. 185 * @param {string} content Notice message. 186 * @param {Object} [options] Notice options. 187 * @param {string} [options.context='global'] Context under which to 188 * group notice. 189 * @param {string} [options.id] Identifier for notice. 190 * Automatically assigned 191 * if not specified. 192 * @param {boolean} [options.isDismissible=true] Whether the notice can 193 * be dismissed by user. 194 * @param {string} [options.type='default'] Type of notice, one of 195 * `default`, or `snackbar`. 196 * @param {boolean} [options.speak=true] Whether the notice 197 * content should be 198 * announced to screen 199 * readers. 200 * @param {Array<WPNoticeAction>} [options.actions] User actions to be 201 * presented with notice. 202 * @param {Object} [options.icon] An icon displayed with the notice. 203 * @param {boolean} [options.explicitDismiss] Whether the notice includes 204 * an explict dismiss button and 205 * can't be dismissed by clicking 206 * the body of the notice. 207 * @param {Function} [options.onDismiss] Called when the notice is dismissed. 208 * 209 * @return {Object} Action object. 210 */ 211 212 function createNotice() { 213 let status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_STATUS; 214 let content = arguments.length > 1 ? arguments[1] : undefined; 215 let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 216 const { 217 speak = true, 218 isDismissible = true, 219 context = DEFAULT_CONTEXT, 220 id = (0,external_lodash_namespaceObject.uniqueId)(context), 221 actions = [], 222 type = 'default', 223 __unstableHTML, 224 icon = null, 225 explicitDismiss = false, 226 onDismiss 227 } = options; // The supported value shape of content is currently limited to plain text 228 // strings. To avoid setting expectation that e.g. a WPElement could be 229 // supported, cast to a string. 230 231 content = String(content); 232 return { 233 type: 'CREATE_NOTICE', 234 context, 235 notice: { 236 id, 237 status, 238 content, 239 spokenMessage: speak ? content : null, 240 __unstableHTML, 241 isDismissible, 242 actions, 243 type, 244 icon, 245 explicitDismiss, 246 onDismiss 247 } 248 }; 249 } 250 /** 251 * Returns an action object used in signalling that a success notice is to be 252 * created. Refer to `createNotice` for options documentation. 253 * 254 * @see createNotice 255 * 256 * @param {string} content Notice message. 257 * @param {Object} [options] Optional notice options. 258 * 259 * @return {Object} Action object. 260 */ 261 262 function createSuccessNotice(content, options) { 263 return createNotice('success', content, options); 264 } 265 /** 266 * Returns an action object used in signalling that an info notice is to be 267 * created. Refer to `createNotice` for options documentation. 268 * 269 * @see createNotice 270 * 271 * @param {string} content Notice message. 272 * @param {Object} [options] Optional notice options. 273 * 274 * @return {Object} Action object. 275 */ 276 277 function createInfoNotice(content, options) { 278 return createNotice('info', content, options); 279 } 280 /** 281 * Returns an action object used in signalling that an error notice is to be 282 * created. Refer to `createNotice` for options documentation. 283 * 284 * @see createNotice 285 * 286 * @param {string} content Notice message. 287 * @param {Object} [options] Optional notice options. 288 * 289 * @return {Object} Action object. 290 */ 291 292 function createErrorNotice(content, options) { 293 return createNotice('error', content, options); 294 } 295 /** 296 * Returns an action object used in signalling that a warning notice is to be 297 * created. Refer to `createNotice` for options documentation. 298 * 299 * @see createNotice 300 * 301 * @param {string} content Notice message. 302 * @param {Object} [options] Optional notice options. 303 * 304 * @return {Object} Action object. 305 */ 306 307 function createWarningNotice(content, options) { 308 return createNotice('warning', content, options); 309 } 310 /** 311 * Returns an action object used in signalling that a notice is to be removed. 312 * 313 * @param {string} id Notice unique identifier. 314 * @param {string} [context='global'] Optional context (grouping) in which the notice is 315 * intended to appear. Defaults to default context. 316 * 317 * @return {Object} Action object. 318 */ 319 320 function removeNotice(id) { 321 let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT; 322 return { 323 type: 'REMOVE_NOTICE', 324 id, 325 context 326 }; 327 } 328 329 ;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/selectors.js 330 /** 331 * Internal dependencies 332 */ 333 334 /** @typedef {import('./actions').WPNoticeAction} WPNoticeAction */ 335 336 /** 337 * The default empty set of notices to return when there are no notices 338 * assigned for a given notices context. This can occur if the getNotices 339 * selector is called without a notice ever having been created for the 340 * context. A shared value is used to ensure referential equality between 341 * sequential selector calls, since otherwise `[] !== []`. 342 * 343 * @type {Array} 344 */ 345 346 const DEFAULT_NOTICES = []; 347 /** 348 * @typedef {Object} WPNotice Notice object. 349 * 350 * @property {string} id Unique identifier of notice. 351 * @property {string} status Status of notice, one of `success`, 352 * `info`, `error`, or `warning`. Defaults 353 * to `info`. 354 * @property {string} content Notice message. 355 * @property {string} spokenMessage Audibly announced message text used by 356 * assistive technologies. 357 * @property {string} __unstableHTML Notice message as raw HTML. Intended to 358 * serve primarily for compatibility of 359 * server-rendered notices, and SHOULD NOT 360 * be used for notices. It is subject to 361 * removal without notice. 362 * @property {boolean} isDismissible Whether the notice can be dismissed by 363 * user. Defaults to `true`. 364 * @property {string} type Type of notice, one of `default`, 365 * or `snackbar`. Defaults to `default`. 366 * @property {boolean} speak Whether the notice content should be 367 * announced to screen readers. Defaults to 368 * `true`. 369 * @property {WPNoticeAction[]} actions User actions to present with notice. 370 * 371 */ 372 373 /** 374 * Returns all notices as an array, optionally for a given context. Defaults to 375 * the global context. 376 * 377 * @param {Object} state Notices state. 378 * @param {?string} context Optional grouping context. 379 * 380 * @return {WPNotice[]} Array of notices. 381 */ 382 383 function getNotices(state) { 384 let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_CONTEXT; 385 return state[context] || DEFAULT_NOTICES; 386 } 387 388 ;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/index.js 389 /** 390 * WordPress dependencies 391 */ 392 393 /** 394 * Internal dependencies 395 */ 396 397 398 399 400 /** 401 * Store definition for the notices namespace. 402 * 403 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 404 * 405 * @type {Object} 406 */ 407 408 const store = (0,external_wp_data_namespaceObject.createReduxStore)('core/notices', { 409 reducer: reducer, 410 actions: actions_namespaceObject, 411 selectors: selectors_namespaceObject 412 }); 413 (0,external_wp_data_namespaceObject.register)(store); 414 415 ;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/index.js 416 417 418 (window.wp = window.wp || {}).notices = __webpack_exports__; 419 /******/ })() 420 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |