From 8614d148870f9d7b790545b545d58b0ee7647a14 Mon Sep 17 00:00:00 2001 From: atimmer Date: Thu, 13 Dec 2018 15:26:42 +0000 Subject: [PATCH] Build tools: Build @wordpress packages with webpack. We decided to split the media webpack config into it's own file. The main webpack config then combines this file with the packages config. Include vendor scripts by copying them. We copy the minified files if they are available. If they aren't available we minify the original files ourselves. Props omarreiss, herregroen, gziolo, youknowriad, netweb, adamsilverstein. Merges [43719] to trunk. See #45065. Built from https://develop.svn.wordpress.org/trunk@44112 git-svn-id: http://core.svn.wordpress.org/trunk@43942 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- js/dist/a11y.js | 268 + js/dist/a11y.js.map | 1 + js/dist/api-fetch.js | 695 + js/dist/api-fetch.js.map | 1 + js/dist/autop.js | 577 + js/dist/autop.js.map | 1 + js/dist/blob.js | 153 + js/dist/blob.js.map | 1 + js/dist/block-library.js | 14708 ++++++ js/dist/block-library.js.map | 1 + js/dist/block-serialization-default-parser.js | 444 + .../block-serialization-default-parser.js.map | 1 + js/dist/blocks.js | 13371 ++++++ js/dist/blocks.js.map | 1 + js/dist/components.js | 38747 +++++++++++++++ js/dist/components.js.map | 1 + js/dist/compose.js | 1198 + js/dist/compose.js.map | 1 + js/dist/core-data.js | 3617 ++ js/dist/core-data.js.map | 1 + js/dist/data.js | 3890 ++ js/dist/data.js.map | 1 + js/dist/date.js | 1493 + js/dist/date.js.map | 1 + js/dist/deprecated.js | 179 + js/dist/deprecated.js.map | 1 + js/dist/dom-ready.js | 123 + js/dist/dom-ready.js.map | 1 + js/dist/dom.js | 1080 + js/dist/dom.js.map | 1 + js/dist/edit-post.js | 6644 +++ js/dist/edit-post.js.map | 1 + js/dist/editor.js | 39060 ++++++++++++++++ js/dist/editor.js.map | 1 + js/dist/element.js | 1176 + js/dist/element.js.map | 1 + js/dist/escape-html.js | 205 + js/dist/escape-html.js.map | 1 + js/dist/hooks.js | 740 + js/dist/hooks.js.map | 1 + js/dist/html-entities.js | 127 + js/dist/html-entities.js.map | 1 + js/dist/i18n.js | 1445 + js/dist/i18n.js.map | 1 + js/dist/is-shallow-equal.js | 231 + js/dist/is-shallow-equal.js.map | 1 + js/dist/keycodes.js | 468 + js/dist/keycodes.js.map | 1 + js/dist/list-reusable-blocks.js | 1011 + js/dist/list-reusable-blocks.js.map | 1 + js/dist/nux.js | 1138 + js/dist/nux.js.map | 1 + js/dist/plugins.js | 778 + js/dist/plugins.js.map | 1 + js/dist/redux-routine.js | 1035 + js/dist/redux-routine.js.map | 1 + js/dist/rich-text.js | 2240 + js/dist/rich-text.js.map | 1 + js/dist/shortcode.js | 598 + js/dist/shortcode.js.map | 1 + js/dist/token-list.js | 381 + js/dist/token-list.js.map | 1 + js/dist/url.js | 1005 + js/dist/url.js.map | 1 + js/dist/vendor/lodash.js | 17107 +++++++ js/dist/vendor/moment.js | 4506 ++ js/dist/vendor/react-dom.js | 18382 ++++++++ js/dist/vendor/react.js | 2703 ++ js/dist/vendor/wp-polyfill-element-closest.js | 33 + js/dist/vendor/wp-polyfill-fetch.js | 531 + js/dist/vendor/wp-polyfill-formdata.js | 390 + js/dist/vendor/wp-polyfill-node-contains.js | 30 + js/dist/vendor/wp-polyfill.js | 6568 +++ js/dist/viewport.js | 540 + js/dist/viewport.js.map | 1 + js/dist/wordcount.js | 539 + js/dist/wordcount.js.map | 1 + styles/dist/block-library/editor-rtl.css | 857 + styles/dist/block-library/editor.css | 858 + styles/dist/block-library/style-rtl.css | 831 + styles/dist/block-library/style.css | 831 + styles/dist/block-library/theme-rtl.css | 108 + styles/dist/block-library/theme.css | 108 + styles/dist/components/style-rtl.css | 2589 + styles/dist/components/style.css | 2603 + styles/dist/edit-post/style-rtl.css | 1436 + styles/dist/edit-post/style.css | 1436 + styles/dist/editor/editor-styles-rtl.css | 83 + styles/dist/editor/editor-styles.css | 83 + styles/dist/editor/style-rtl.css | 2529 + styles/dist/editor/style.css | 2537 + .../dist/list-reusable-blocks/style-rtl.css | 73 + styles/dist/list-reusable-blocks/style.css | 73 + styles/dist/nux/style-rtl.css | 121 + styles/dist/nux/style.css | 121 + wp-includes/version.php | 2 +- 96 files changed, 207466 insertions(+), 1 deletion(-) create mode 100644 js/dist/a11y.js create mode 100644 js/dist/a11y.js.map create mode 100644 js/dist/api-fetch.js create mode 100644 js/dist/api-fetch.js.map create mode 100644 js/dist/autop.js create mode 100644 js/dist/autop.js.map create mode 100644 js/dist/blob.js create mode 100644 js/dist/blob.js.map create mode 100644 js/dist/block-library.js create mode 100644 js/dist/block-library.js.map create mode 100644 js/dist/block-serialization-default-parser.js create mode 100644 js/dist/block-serialization-default-parser.js.map create mode 100644 js/dist/blocks.js create mode 100644 js/dist/blocks.js.map create mode 100644 js/dist/components.js create mode 100644 js/dist/components.js.map create mode 100644 js/dist/compose.js create mode 100644 js/dist/compose.js.map create mode 100644 js/dist/core-data.js create mode 100644 js/dist/core-data.js.map create mode 100644 js/dist/data.js create mode 100644 js/dist/data.js.map create mode 100644 js/dist/date.js create mode 100644 js/dist/date.js.map create mode 100644 js/dist/deprecated.js create mode 100644 js/dist/deprecated.js.map create mode 100644 js/dist/dom-ready.js create mode 100644 js/dist/dom-ready.js.map create mode 100644 js/dist/dom.js create mode 100644 js/dist/dom.js.map create mode 100644 js/dist/edit-post.js create mode 100644 js/dist/edit-post.js.map create mode 100644 js/dist/editor.js create mode 100644 js/dist/editor.js.map create mode 100644 js/dist/element.js create mode 100644 js/dist/element.js.map create mode 100644 js/dist/escape-html.js create mode 100644 js/dist/escape-html.js.map create mode 100644 js/dist/hooks.js create mode 100644 js/dist/hooks.js.map create mode 100644 js/dist/html-entities.js create mode 100644 js/dist/html-entities.js.map create mode 100644 js/dist/i18n.js create mode 100644 js/dist/i18n.js.map create mode 100644 js/dist/is-shallow-equal.js create mode 100644 js/dist/is-shallow-equal.js.map create mode 100644 js/dist/keycodes.js create mode 100644 js/dist/keycodes.js.map create mode 100644 js/dist/list-reusable-blocks.js create mode 100644 js/dist/list-reusable-blocks.js.map create mode 100644 js/dist/nux.js create mode 100644 js/dist/nux.js.map create mode 100644 js/dist/plugins.js create mode 100644 js/dist/plugins.js.map create mode 100644 js/dist/redux-routine.js create mode 100644 js/dist/redux-routine.js.map create mode 100644 js/dist/rich-text.js create mode 100644 js/dist/rich-text.js.map create mode 100644 js/dist/shortcode.js create mode 100644 js/dist/shortcode.js.map create mode 100644 js/dist/token-list.js create mode 100644 js/dist/token-list.js.map create mode 100644 js/dist/url.js create mode 100644 js/dist/url.js.map create mode 100644 js/dist/vendor/lodash.js create mode 100644 js/dist/vendor/moment.js create mode 100644 js/dist/vendor/react-dom.js create mode 100644 js/dist/vendor/react.js create mode 100644 js/dist/vendor/wp-polyfill-element-closest.js create mode 100644 js/dist/vendor/wp-polyfill-fetch.js create mode 100644 js/dist/vendor/wp-polyfill-formdata.js create mode 100644 js/dist/vendor/wp-polyfill-node-contains.js create mode 100644 js/dist/vendor/wp-polyfill.js create mode 100644 js/dist/viewport.js create mode 100644 js/dist/viewport.js.map create mode 100644 js/dist/wordcount.js create mode 100644 js/dist/wordcount.js.map create mode 100644 styles/dist/block-library/editor-rtl.css create mode 100644 styles/dist/block-library/editor.css create mode 100644 styles/dist/block-library/style-rtl.css create mode 100644 styles/dist/block-library/style.css create mode 100644 styles/dist/block-library/theme-rtl.css create mode 100644 styles/dist/block-library/theme.css create mode 100644 styles/dist/components/style-rtl.css create mode 100644 styles/dist/components/style.css create mode 100644 styles/dist/edit-post/style-rtl.css create mode 100644 styles/dist/edit-post/style.css create mode 100644 styles/dist/editor/editor-styles-rtl.css create mode 100644 styles/dist/editor/editor-styles.css create mode 100644 styles/dist/editor/style-rtl.css create mode 100644 styles/dist/editor/style.css create mode 100644 styles/dist/list-reusable-blocks/style-rtl.css create mode 100644 styles/dist/list-reusable-blocks/style.css create mode 100644 styles/dist/nux/style-rtl.css create mode 100644 styles/dist/nux/style.css diff --git a/js/dist/a11y.js b/js/dist/a11y.js new file mode 100644 index 0000000000..ec2c6fc17b --- /dev/null +++ b/js/dist/a11y.js @@ -0,0 +1,268 @@ +this["wp"] = this["wp"] || {}; this["wp"]["a11y"] = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/a11y/build-module/index.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./node_modules/@wordpress/a11y/build-module/addContainer.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@wordpress/a11y/build-module/addContainer.js ***! + \*******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/** + * Build the live regions markup. + * + * @param {string} ariaLive Optional. Value for the 'aria-live' attribute, default 'polite'. + * + * @return {Object} $container The ARIA live region jQuery object. + */ +var addContainer = function addContainer(ariaLive) { + ariaLive = ariaLive || 'polite'; + var container = document.createElement('div'); + container.id = 'a11y-speak-' + ariaLive; + container.className = 'a11y-speak-region'; + container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); + container.setAttribute('aria-live', ariaLive); + container.setAttribute('aria-relevant', 'additions text'); + container.setAttribute('aria-atomic', 'true'); + document.querySelector('body').appendChild(container); + return container; +}; + +/* harmony default export */ __webpack_exports__["default"] = (addContainer); + + +/***/ }), + +/***/ "./node_modules/@wordpress/a11y/build-module/clear.js": +/*!************************************************************!*\ + !*** ./node_modules/@wordpress/a11y/build-module/clear.js ***! + \************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/** + * Clear the a11y-speak-region elements. + */ +var clear = function clear() { + var regions = document.querySelectorAll('.a11y-speak-region'); + + for (var i = 0; i < regions.length; i++) { + regions[i].textContent = ''; + } +}; + +/* harmony default export */ __webpack_exports__["default"] = (clear); + + +/***/ }), + +/***/ "./node_modules/@wordpress/a11y/build-module/filterMessage.js": +/*!********************************************************************!*\ + !*** ./node_modules/@wordpress/a11y/build-module/filterMessage.js ***! + \********************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +var previousMessage = ''; +/** + * Filter the message to be announced to the screenreader. + * + * @param {string} message The message to be announced. + * + * @return {string} The filtered message. + */ + +var filterMessage = function filterMessage(message) { + /* + * Strip HTML tags (if any) from the message string. Ideally, messages should + * be simple strings, carefully crafted for specific use with A11ySpeak. + * When re-using already existing strings this will ensure simple HTML to be + * stripped out and replaced with a space. Browsers will collapse multiple + * spaces natively. + */ + message = message.replace(/<[^<>]+>/g, ' '); + + if (previousMessage === message) { + message += "\xA0"; + } + + previousMessage = message; + return message; +}; + +/* harmony default export */ __webpack_exports__["default"] = (filterMessage); + + +/***/ }), + +/***/ "./node_modules/@wordpress/a11y/build-module/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@wordpress/a11y/build-module/index.js ***! + \************************************************************/ +/*! exports provided: setup, speak */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setup", function() { return setup; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "speak", function() { return speak; }); +/* harmony import */ var _addContainer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addContainer */ "./node_modules/@wordpress/a11y/build-module/addContainer.js"); +/* harmony import */ var _clear__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./clear */ "./node_modules/@wordpress/a11y/build-module/clear.js"); +/* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/dom-ready */ "@wordpress/dom-ready"); +/* harmony import */ var _wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _filterMessage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./filterMessage */ "./node_modules/@wordpress/a11y/build-module/filterMessage.js"); + + + + +/** + * Create the live regions. + */ + +var setup = function setup() { + var containerPolite = document.getElementById('a11y-speak-polite'); + var containerAssertive = document.getElementById('a11y-speak-assertive'); + + if (containerPolite === null) { + containerPolite = Object(_addContainer__WEBPACK_IMPORTED_MODULE_0__["default"])('polite'); + } + + if (containerAssertive === null) { + containerAssertive = Object(_addContainer__WEBPACK_IMPORTED_MODULE_0__["default"])('assertive'); + } +}; +/** + * Run setup on domReady. + */ + +_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_2___default()(setup); +/** + * Update the ARIA live notification area text node. + * + * @param {string} message The message to be announced by Assistive Technologies. + * @param {string} ariaLive Optional. The politeness level for aria-live. Possible values: + * polite or assertive. Default polite. + */ + +var speak = function speak(message, ariaLive) { + // Clear previous messages to allow repeated strings being read out. + Object(_clear__WEBPACK_IMPORTED_MODULE_1__["default"])(); + message = Object(_filterMessage__WEBPACK_IMPORTED_MODULE_3__["default"])(message); + var containerPolite = document.getElementById('a11y-speak-polite'); + var containerAssertive = document.getElementById('a11y-speak-assertive'); + + if (containerAssertive && 'assertive' === ariaLive) { + containerAssertive.textContent = message; + } else if (containerPolite) { + containerPolite.textContent = message; + } +}; + + +/***/ }), + +/***/ "@wordpress/dom-ready": +/*!*******************************************!*\ + !*** external {"this":["wp","domReady"]} ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["domReady"]; }()); + +/***/ }) + +/******/ }); +//# sourceMappingURL=a11y.js.map \ No newline at end of file diff --git a/js/dist/a11y.js.map b/js/dist/a11y.js.map new file mode 100644 index 0000000000..ce406a96fa --- /dev/null +++ b/js/dist/a11y.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://wp.[name]/webpack/bootstrap","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/a11y/src/addContainer.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/a11y/src/clear.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/a11y/src/filterMessage.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/a11y/src/index.js","webpack://wp.[name]/external {\"this\":[\"wp\",\"domReady\"]}"],"names":["addContainer","ariaLive","container","document","createElement","id","className","setAttribute","querySelector","appendChild","clear","regions","querySelectorAll","i","length","textContent","previousMessage","filterMessage","message","replace","setup","containerPolite","getElementById","containerAssertive","domReady","speak"],"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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AAiCG,OAAjC;AACA,GAFD,MAEO,IAAKG,eAAL,EAAuB;AAC7BA,mBAAe,CAACN,WAAhB,GAA8BG,OAA9B;AACA;AACD,CAdM;;;;;;;;;;;;AChCP,aAAa,yCAAyC,EAAE,I","file":"a11y.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/a11y/build-module/index.js\");\n","/**\n * Build the live regions markup.\n *\n * @param {string} ariaLive Optional. Value for the 'aria-live' attribute, default 'polite'.\n *\n * @return {Object} $container The ARIA live region jQuery object.\n */\nconst addContainer = function( ariaLive ) {\n\tariaLive = ariaLive || 'polite';\n\n\tconst container = document.createElement( 'div' );\n\tcontainer.id = 'a11y-speak-' + ariaLive;\n\tcontainer.className = 'a11y-speak-region';\n\n\tcontainer.setAttribute( 'style', (\n\t\t'position: absolute;' +\n\t\t'margin: -1px;' +\n\t\t'padding: 0;' +\n\t\t'height: 1px;' +\n\t\t'width: 1px;' +\n\t\t'overflow: hidden;' +\n\t\t'clip: rect(1px, 1px, 1px, 1px);' +\n\t\t'-webkit-clip-path: inset(50%);' +\n\t\t'clip-path: inset(50%);' +\n\t\t'border: 0;' +\n\t\t'word-wrap: normal !important;'\n\t) );\n\tcontainer.setAttribute( 'aria-live', ariaLive );\n\tcontainer.setAttribute( 'aria-relevant', 'additions text' );\n\tcontainer.setAttribute( 'aria-atomic', 'true' );\n\n\tdocument.querySelector( 'body' ).appendChild( container );\n\treturn container;\n};\n\nexport default addContainer;\n","/**\n * Clear the a11y-speak-region elements.\n */\nconst clear = function() {\n\tconst regions = document.querySelectorAll( '.a11y-speak-region' );\n\tfor ( let i = 0; i < regions.length; i++ ) {\n\t\tregions[ i ].textContent = '';\n\t}\n};\n\nexport default clear;\n","let previousMessage = '';\n\n/**\n * Filter the message to be announced to the screenreader.\n *\n * @param {string} message The message to be announced.\n *\n * @return {string} The filtered message.\n */\nconst filterMessage = function( message ) {\n\t/*\n\t * Strip HTML tags (if any) from the message string. Ideally, messages should\n\t * be simple strings, carefully crafted for specific use with A11ySpeak.\n\t * When re-using already existing strings this will ensure simple HTML to be\n\t * stripped out and replaced with a space. Browsers will collapse multiple\n\t * spaces natively.\n\t */\n\tmessage = message.replace( /<[^<>]+>/g, ' ' );\n\n\tif ( previousMessage === message ) {\n\t\tmessage += '\\u00A0';\n\t}\n\n\tpreviousMessage = message;\n\n\treturn message;\n};\n\nexport default filterMessage;\n","import addContainer from './addContainer';\nimport clear from './clear';\nimport domReady from '@wordpress/dom-ready';\nimport filterMessage from './filterMessage';\n\n/**\n * Create the live regions.\n */\nexport const setup = function() {\n\tlet containerPolite = document.getElementById( 'a11y-speak-polite' );\n\tlet containerAssertive = document.getElementById( 'a11y-speak-assertive' );\n\n\tif ( containerPolite === null ) {\n\t\tcontainerPolite = addContainer( 'polite' );\n\t}\n\tif ( containerAssertive === null ) {\n\t\tcontainerAssertive = addContainer( 'assertive' );\n\t}\n};\n\n/**\n * Run setup on domReady.\n */\ndomReady( setup );\n\n/**\n * Update the ARIA live notification area text node.\n *\n * @param {string} message The message to be announced by Assistive Technologies.\n * @param {string} ariaLive Optional. The politeness level for aria-live. Possible values:\n * polite or assertive. Default polite.\n */\nexport const speak = function( message, ariaLive ) {\n\t// Clear previous messages to allow repeated strings being read out.\n\tclear();\n\n\tmessage = filterMessage( message );\n\n\tconst containerPolite = document.getElementById( 'a11y-speak-polite' );\n\tconst containerAssertive = document.getElementById( 'a11y-speak-assertive' );\n\n\tif ( containerAssertive && 'assertive' === ariaLive ) {\n\t\tcontainerAssertive.textContent = message;\n\t} else if ( containerPolite ) {\n\t\tcontainerPolite.textContent = message;\n\t}\n};\n","(function() { module.exports = this[\"wp\"][\"domReady\"]; }());"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/api-fetch.js b/js/dist/api-fetch.js new file mode 100644 index 0000000000..c7dc332eaa --- /dev/null +++ b/js/dist/api-fetch.js @@ -0,0 +1,695 @@ +this["wp"] = this["wp"] || {}; this["wp"]["apiFetch"] = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/api-fetch/build-module/index.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js ***! + \*********************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _asyncToGenerator; }); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } +} + +function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + + _next(undefined); + }); + }; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***! + \*******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _defineProperty; }); +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/objectSpread.js ***! + \*****************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectSpread; }); +/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); + +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(target, key, source[key]); + }); + } + + return target; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js ***! + \****************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectWithoutProperties; }); +/* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js"); + +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(source, excluded); + var key, i; + + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + + return target; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***! + \*********************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectWithoutPropertiesLoose; }); +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +/***/ }), + +/***/ "./node_modules/@wordpress/api-fetch/build-module/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@wordpress/api-fetch/build-module/index.js ***! + \*****************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"); +/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js"); +/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _middlewares_nonce__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares/nonce */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js"); +/* harmony import */ var _middlewares_root_url__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./middlewares/root-url */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js"); +/* harmony import */ var _middlewares_preloading__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./middlewares/preloading */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js"); +/* harmony import */ var _middlewares_namespace_endpoint__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./middlewares/namespace-endpoint */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js"); +/* harmony import */ var _middlewares_http_v1__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./middlewares/http-v1 */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js"); + + + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + + + + +var middlewares = []; + +function registerMiddleware(middleware) { + middlewares.push(middleware); +} + +function checkCloudflareError(error) { + if (typeof error === 'string' && error.indexOf('Cloudflare Ray ID') >= 0) { + throw { + code: 'cloudflare_error' + }; + } +} + +function apiFetch(options) { + var raw = function raw(nextOptions) { + var url = nextOptions.url, + path = nextOptions.path, + body = nextOptions.body, + data = nextOptions.data, + _nextOptions$parse = nextOptions.parse, + parse = _nextOptions$parse === void 0 ? true : _nextOptions$parse, + remainingOptions = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__["default"])(nextOptions, ["url", "path", "body", "data", "parse"]); + + var headers = remainingOptions.headers || {}; + + if (!headers['Content-Type'] && data) { + headers['Content-Type'] = 'application/json'; + } + + var responsePromise = window.fetch(url || path, Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_1__["default"])({}, remainingOptions, { + credentials: 'include', + body: body || JSON.stringify(data), + headers: headers + })); + + var checkStatus = function checkStatus(response) { + if (response.status >= 200 && response.status < 300) { + return response; + } + + throw response; + }; + + var parseResponse = function parseResponse(response) { + if (parse) { + return response.json ? response.json() : Promise.reject(response); + } + + return response; + }; + + return responsePromise.then(checkStatus).then(parseResponse).catch(function (response) { + if (!parse) { + throw response; + } + + var invalidJsonError = { + code: 'invalid_json', + message: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('The response is not a valid JSON response.') + }; + + if (!response || !response.json) { + throw invalidJsonError; + } + /* + * Response data is a stream, which will be consumed by the .json() call. + * If we need to re-use this data to send to the Cloudflare error handler, + * we need a clone of the original response, so the stream can be consumed + * in the .text() call, instead. + */ + + + var responseClone = response.clone(); + return response.json().catch( + /*#__PURE__*/ + Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])( + /*#__PURE__*/ + regeneratorRuntime.mark(function _callee() { + var text; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return responseClone.text(); + + case 2: + text = _context.sent; + checkCloudflareError(text); + throw invalidJsonError; + + case 5: + case "end": + return _context.stop(); + } + } + }, _callee, this); + }))).then(function (error) { + var unknownError = { + code: 'unknown_error', + message: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('An unknown error occurred.') + }; + checkCloudflareError(error); + throw error || unknownError; + }); + }); + }; + + var steps = [raw, _middlewares_http_v1__WEBPACK_IMPORTED_MODULE_8__["default"], _middlewares_namespace_endpoint__WEBPACK_IMPORTED_MODULE_7__["default"]].concat(middlewares); + + var next = function next(nextOptions) { + var nextMiddleware = steps.pop(); + return nextMiddleware(nextOptions, next); + }; + + return next(options); +} + +apiFetch.use = registerMiddleware; +apiFetch.createNonceMiddleware = _middlewares_nonce__WEBPACK_IMPORTED_MODULE_4__["default"]; +apiFetch.createPreloadingMiddleware = _middlewares_preloading__WEBPACK_IMPORTED_MODULE_6__["default"]; +apiFetch.createRootURLMiddleware = _middlewares_root_url__WEBPACK_IMPORTED_MODULE_5__["default"]; +/* harmony default export */ __webpack_exports__["default"] = (apiFetch); + + +/***/ }), + +/***/ "./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js ***! + \*******************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js"); + + +function httpV1Middleware(options, next) { + var newOptions = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, options); + + if (newOptions.method) { + if (['PATCH', 'PUT', 'DELETE'].indexOf(newOptions.method.toUpperCase()) >= 0) { + if (!newOptions.headers) { + newOptions.headers = {}; + } + + newOptions.headers['X-HTTP-Method-Override'] = newOptions.method; + newOptions.headers['Content-Type'] = 'application/json'; + newOptions.method = 'POST'; + } + } + + return next(newOptions, next); +} + +/* harmony default export */ __webpack_exports__["default"] = (httpV1Middleware); + + +/***/ }), + +/***/ "./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js": +/*!******************************************************************************************!*\ + !*** ./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js ***! + \******************************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js"); + + +var namespaceAndEndpointMiddleware = function namespaceAndEndpointMiddleware(options, next) { + var path = options.path; + var namespaceTrimmed, endpointTrimmed; + + if (typeof options.namespace === 'string' && typeof options.endpoint === 'string') { + namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, ''); + endpointTrimmed = options.endpoint.replace(/^\//, ''); + + if (endpointTrimmed) { + path = namespaceTrimmed + '/' + endpointTrimmed; + } else { + path = namespaceTrimmed; + } + } + + delete options.namespace; + delete options.endpoint; + return next(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, options, { + path: path + })); +}; + +/* harmony default export */ __webpack_exports__["default"] = (namespaceAndEndpointMiddleware); + + +/***/ }), + +/***/ "./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js ***! + \*****************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js"); +/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks"); +/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * External dependencies + */ + + +var createNonceMiddleware = function createNonceMiddleware(nonce) { + return function (options, next) { + var usedNonce = nonce; + /** + * This is not ideal but it's fine for now. + * + * Configure heartbeat to refresh the wp-api nonce, keeping the editor + * authorization intact. + */ + + Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_1__["addAction"])('heartbeat.tick', 'core/api-fetch/create-nonce-middleware', function (response) { + if (response['rest-nonce']) { + usedNonce = response['rest-nonce']; + } + }); + var headers = options.headers || {}; // If an 'X-WP-Nonce' header (or any case-insensitive variation + // thereof) was specified, no need to add a nonce header. + + var addNonceHeader = true; + + for (var headerName in headers) { + if (headers.hasOwnProperty(headerName)) { + if (headerName.toLowerCase() === 'x-wp-nonce') { + addNonceHeader = false; + break; + } + } + } + + if (addNonceHeader) { + // Do not mutate the original headers object, if any. + headers = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, headers, { + 'X-WP-Nonce': usedNonce + }); + } + + return next(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, options, { + headers: headers + })); + }; +}; + +/* harmony default export */ __webpack_exports__["default"] = (createNonceMiddleware); + + +/***/ }), + +/***/ "./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js ***! + \**********************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +var createPreloadingMiddleware = function createPreloadingMiddleware(preloadedData) { + return function (options, next) { + function getStablePath(path) { + var splitted = path.split('?'); + var query = splitted[1]; + var base = splitted[0]; + + if (!query) { + return base; + } // 'b=1&c=2&a=5' + + + return base + '?' + query // [ 'b=1', 'c=2', 'a=5' ] + .split('&') // [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ] + .map(function (entry) { + return entry.split('='); + }) // [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ] + .sort(function (a, b) { + return a[0].localeCompare(b[0]); + }) // [ 'a=5', 'b=1', 'c=2' ] + .map(function (pair) { + return pair.join('='); + }) // 'a=5&b=1&c=2' + .join('&'); + } + + var _options$parse = options.parse, + parse = _options$parse === void 0 ? true : _options$parse; + + if (typeof options.path === 'string' && parse) { + var method = options.method || 'GET'; + var path = getStablePath(options.path); + + if ('GET' === method && preloadedData[path]) { + return Promise.resolve(preloadedData[path].body); + } + } + + return next(options); + }; +}; + +/* harmony default export */ __webpack_exports__["default"] = (createPreloadingMiddleware); + + +/***/ }), + +/***/ "./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js ***! + \********************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js"); +/* harmony import */ var _namespace_endpoint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./namespace-endpoint */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js"); + + +/** + * Internal dependencies + */ + + +var createRootURLMiddleware = function createRootURLMiddleware(rootURL) { + return function (options, next) { + return Object(_namespace_endpoint__WEBPACK_IMPORTED_MODULE_1__["default"])(options, function (optionsWithPath) { + var url = optionsWithPath.url; + var path = optionsWithPath.path; + var apiRoot; + + if (typeof path === 'string') { + apiRoot = rootURL; + + if (-1 !== rootURL.indexOf('?')) { + path = path.replace('?', '&'); + } + + path = path.replace(/^\//, ''); // API root may already include query parameter prefix if site is + // configured to use plain permalinks. + + if ('string' === typeof apiRoot && -1 !== apiRoot.indexOf('?')) { + path = path.replace('?', '&'); + } + + url = apiRoot + path; + } + + return next(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, optionsWithPath, { + url: url + })); + }); + }; +}; + +/* harmony default export */ __webpack_exports__["default"] = (createRootURLMiddleware); + + +/***/ }), + +/***/ "@wordpress/hooks": +/*!****************************************!*\ + !*** external {"this":["wp","hooks"]} ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["hooks"]; }()); + +/***/ }), + +/***/ "@wordpress/i18n": +/*!***************************************!*\ + !*** external {"this":["wp","i18n"]} ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["i18n"]; }()); + +/***/ }) + +/******/ })["default"]; +//# sourceMappingURL=api-fetch.js.map \ No newline at end of file diff --git a/js/dist/api-fetch.js.map b/js/dist/api-fetch.js.map new file mode 100644 index 0000000000..e9dd1e4944 --- /dev/null +++ b/js/dist/api-fetch.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://wp.[name]/webpack/bootstrap","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/objectSpread.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","webpack://wp.[name]/./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/api-fetch/src/index.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/api-fetch/src/middlewares/http-v1.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/api-fetch/src/middlewares/namespace-endpoint.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/api-fetch/src/middlewares/nonce.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/api-fetch/src/middlewares/preloading.js","webpack://wp.[name]//Users/gziolo/PhpstormProjects/gutenberg/packages/api-fetch/src/middlewares/root-url.js","webpack://wp.[name]/external {\"this\":[\"wp\",\"hooks\"]}","webpack://wp.[name]/external {\"this\":[\"wp\",\"i18n\"]}"],"names":["middlewares","registerMiddleware","middleware","push","checkCloudflareError","error","indexOf","code","apiFetch","options","raw","nextOptions","url","path","body","data","parse","remainingOptions","headers","responsePromise","window","fetch","credentials","JSON","stringify","checkStatus","response","status","parseResponse","json","Promise","reject","then","catch","invalidJsonError","message","__","responseClone","clone","text","unknownError","steps","httpV1Middleware","namespaceEndpointMiddleware","next","nextMiddleware","pop","use","createNonceMiddleware","createPreloadingMiddleware","createRootURLMiddleware","newOptions","method","toUpperCase","namespaceAndEndpointMiddleware","namespaceTrimmed","endpointTrimmed","namespace","endpoint","replace","nonce","usedNonce","addAction","addNonceHeader","headerName","hasOwnProperty","toLowerCase","preloadedData","getStablePath","splitted","split","query","base","map","entry","sort","a","b","localeCompare","pair","join","resolve","rootURL","optionsWithPath","apiRoot"],"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;AAAA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA,C;;;;;;;;;;;;AClCA;AAAA;AAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA,C;;;;;;;;;;;;ACbA;AAAA;AAAA;AAA8C;AAC/B;AACf,iBAAiB,sBAAsB;AACvC;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,MAAM,+DAAc;AACpB,KAAK;AACL;;AAEA;AACA,C;;;;;;;;;;;;AClBA;AAAA;AAAA;AAA0E;AAC3D;AACf;AACA,eAAe,6EAA4B;AAC3C;;AAEA;AACA;;AAEA,eAAe,6BAA6B;AAC5C;AACA;AACA;AACA;AACA;AACA;;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,GAAGsE,eAAe,CAACtE,IAA3B;AACA,UAAIuE,OAAJ;;AAEA,UAAK,OAAOvE,IAAP,KAAgB,QAArB,EAAgC;AAC/BuE,eAAO,GAAGF,OAAV;;AAEA,YAAK,CAAC,CAAD,KAAOA,OAAO,CAAC5E,OAAR,CAAiB,GAAjB,CAAZ,EAAqC;AACpCO,cAAI,GAAGA,IAAI,CAAC8C,OAAL,CAAc,GAAd,EAAmB,GAAnB,CAAP;AACA;;AAED9C,YAAI,GAAGA,IAAI,CAAC8C,OAAL,CAAc,KAAd,EAAqB,EAArB,CAAP,CAP+B,CAS/B;AACA;;AACA,YAAK,aAAa,OAAOyB,OAApB,IAA+B,CAAC,CAAD,KAAOA,OAAO,CAAC9E,OAAR,CAAiB,GAAjB,CAA3C,EAAoE;AACnEO,cAAI,GAAGA,IAAI,CAAC8C,OAAL,CAAc,GAAd,EAAmB,GAAnB,CAAP;AACA;;AAED/C,WAAG,GAAGwE,OAAO,GAAGvE,IAAhB;AACA;;AAED,aAAO+B,IAAI,CAAC,4FACRuC,eADO;AAEVvE,WAAG,EAAHA;AAFU,SAAX;AAIA,KA3BoC,CAArC;AA4BA,GA7B+B;AAAA,CAAhC;;AA+BesC,sFAAf;;;;;;;;;;;;ACpCA,aAAa,sCAAsC,EAAE,I;;;;;;;;;;;ACArD,aAAa,qCAAqC,EAAE,I","file":"api-fetch.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/api-fetch/build-module/index.js\");\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\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}","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 objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport createNonceMiddleware from './middlewares/nonce';\nimport createRootURLMiddleware from './middlewares/root-url';\nimport createPreloadingMiddleware from './middlewares/preloading';\nimport namespaceEndpointMiddleware from './middlewares/namespace-endpoint';\nimport httpV1Middleware from './middlewares/http-v1';\n\nconst middlewares = [];\n\nfunction registerMiddleware( middleware ) {\n\tmiddlewares.push( middleware );\n}\n\nfunction checkCloudflareError( error ) {\n\tif ( typeof error === 'string' && error.indexOf( 'Cloudflare Ray ID' ) >= 0 ) {\n\t\tthrow {\n\t\t\tcode: 'cloudflare_error',\n\t\t};\n\t}\n}\n\nfunction apiFetch( options ) {\n\tconst raw = ( nextOptions ) => {\n\t\tconst { url, path, body, data, parse = true, ...remainingOptions } = nextOptions;\n\t\tconst headers = remainingOptions.headers || {};\n\t\tif ( ! headers[ 'Content-Type' ] && data ) {\n\t\t\theaders[ 'Content-Type' ] = 'application/json';\n\t\t}\n\n\t\tconst responsePromise = window.fetch(\n\t\t\turl || path,\n\t\t\t{\n\t\t\t\t...remainingOptions,\n\t\t\t\tcredentials: 'include',\n\t\t\t\tbody: body || JSON.stringify( data ),\n\t\t\t\theaders,\n\t\t\t}\n\t\t);\n\t\tconst checkStatus = ( response ) => {\n\t\t\tif ( response.status >= 200 && response.status < 300 ) {\n\t\t\t\treturn response;\n\t\t\t}\n\n\t\t\tthrow response;\n\t\t};\n\n\t\tconst parseResponse = ( response ) => {\n\t\t\tif ( parse ) {\n\t\t\t\treturn response.json ? response.json() : Promise.reject( response );\n\t\t\t}\n\n\t\t\treturn response;\n\t\t};\n\n\t\treturn responsePromise\n\t\t\t.then( checkStatus )\n\t\t\t.then( parseResponse )\n\t\t\t.catch( ( response ) => {\n\t\t\t\tif ( ! parse ) {\n\t\t\t\t\tthrow response;\n\t\t\t\t}\n\n\t\t\t\tconst invalidJsonError = {\n\t\t\t\t\tcode: 'invalid_json',\n\t\t\t\t\tmessage: __( 'The response is not a valid JSON response.' ),\n\t\t\t\t};\n\n\t\t\t\tif ( ! response || ! response.json ) {\n\t\t\t\t\tthrow invalidJsonError;\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * Response data is a stream, which will be consumed by the .json() call.\n\t\t\t\t * If we need to re-use this data to send to the Cloudflare error handler,\n\t\t\t\t * we need a clone of the original response, so the stream can be consumed\n\t\t\t\t * in the .text() call, instead.\n\t\t\t\t */\n\t\t\t\tconst responseClone = response.clone();\n\n\t\t\t\treturn response.json()\n\t\t\t\t\t.catch( async () => {\n\t\t\t\t\t\tconst text = await responseClone.text();\n\t\t\t\t\t\tcheckCloudflareError( text );\n\t\t\t\t\t\tthrow invalidJsonError;\n\t\t\t\t\t} )\n\t\t\t\t\t.then( ( error ) => {\n\t\t\t\t\t\tconst unknownError = {\n\t\t\t\t\t\t\tcode: 'unknown_error',\n\t\t\t\t\t\t\tmessage: __( 'An unknown error occurred.' ),\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tcheckCloudflareError( error );\n\n\t\t\t\t\t\tthrow error || unknownError;\n\t\t\t\t\t} );\n\t\t\t} );\n\t};\n\n\tconst steps = [\n\t\traw,\n\t\thttpV1Middleware,\n\t\tnamespaceEndpointMiddleware,\n\t\t...middlewares,\n\t];\n\tconst next = ( nextOptions ) => {\n\t\tconst nextMiddleware = steps.pop();\n\t\treturn nextMiddleware( nextOptions, next );\n\t};\n\n\treturn next( options );\n}\n\napiFetch.use = registerMiddleware;\n\napiFetch.createNonceMiddleware = createNonceMiddleware;\napiFetch.createPreloadingMiddleware = createPreloadingMiddleware;\napiFetch.createRootURLMiddleware = createRootURLMiddleware;\n\nexport default apiFetch;\n","function httpV1Middleware( options, next ) {\n\tconst newOptions = { ...options };\n\tif ( newOptions.method ) {\n\t\tif ( [ 'PATCH', 'PUT', 'DELETE' ].indexOf( newOptions.method.toUpperCase() ) >= 0 ) {\n\t\t\tif ( ! newOptions.headers ) {\n\t\t\t\tnewOptions.headers = {};\n\t\t\t}\n\t\t\tnewOptions.headers[ 'X-HTTP-Method-Override' ] = newOptions.method;\n\t\t\tnewOptions.headers[ 'Content-Type' ] = 'application/json';\n\t\t\tnewOptions.method = 'POST';\n\t\t}\n\t}\n\n\treturn next( newOptions, next );\n}\n\nexport default httpV1Middleware;\n","const namespaceAndEndpointMiddleware = ( options, next ) => {\n\tlet path = options.path;\n\tlet namespaceTrimmed, endpointTrimmed;\n\n\tif (\n\t\ttypeof options.namespace === 'string' &&\n\t\t\ttypeof options.endpoint === 'string'\n\t) {\n\t\tnamespaceTrimmed = options.namespace.replace( /^\\/|\\/$/g, '' );\n\t\tendpointTrimmed = options.endpoint.replace( /^\\//, '' );\n\t\tif ( endpointTrimmed ) {\n\t\t\tpath = namespaceTrimmed + '/' + endpointTrimmed;\n\t\t} else {\n\t\t\tpath = namespaceTrimmed;\n\t\t}\n\t}\n\n\tdelete options.namespace;\n\tdelete options.endpoint;\n\n\treturn next( {\n\t\t...options,\n\t\tpath,\n\t} );\n};\n\nexport default namespaceAndEndpointMiddleware;\n","/**\n * External dependencies\n */\nimport { addAction } from '@wordpress/hooks';\n\nconst createNonceMiddleware = ( nonce ) => ( options, next ) => {\n\tlet usedNonce = nonce;\n\t/**\n\t * This is not ideal but it's fine for now.\n\t *\n\t * Configure heartbeat to refresh the wp-api nonce, keeping the editor\n\t * authorization intact.\n\t */\n\taddAction( 'heartbeat.tick', 'core/api-fetch/create-nonce-middleware', ( response ) => {\n\t\tif ( response[ 'rest-nonce' ] ) {\n\t\t\tusedNonce = response[ 'rest-nonce' ];\n\t\t}\n\t} );\n\n\tlet headers = options.headers || {};\n\t// If an 'X-WP-Nonce' header (or any case-insensitive variation\n\t// thereof) was specified, no need to add a nonce header.\n\tlet addNonceHeader = true;\n\tfor ( const headerName in headers ) {\n\t\tif ( headers.hasOwnProperty( headerName ) ) {\n\t\t\tif ( headerName.toLowerCase() === 'x-wp-nonce' ) {\n\t\t\t\taddNonceHeader = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( addNonceHeader ) {\n\t// Do not mutate the original headers object, if any.\n\t\theaders = {\n\t\t\t...headers,\n\t\t\t'X-WP-Nonce': usedNonce,\n\t\t};\n\t}\n\n\treturn next( {\n\t\t...options,\n\t\theaders,\n\t} );\n};\n\nexport default createNonceMiddleware;\n","const createPreloadingMiddleware = ( preloadedData ) => ( options, next ) => {\n\tfunction getStablePath( path ) {\n\t\tconst splitted = path.split( '?' );\n\t\tconst query = splitted[ 1 ];\n\t\tconst base = splitted[ 0 ];\n\t\tif ( ! query ) {\n\t\t\treturn base;\n\t\t}\n\n\t\t// 'b=1&c=2&a=5'\n\t\treturn base + '?' + query\n\t\t\t// [ 'b=1', 'c=2', 'a=5' ]\n\t\t\t.split( '&' )\n\t\t\t// [ [ 'b, '1' ], [ 'c', '2' ], [ 'a', '5' ] ]\n\t\t\t.map( function( entry ) {\n\t\t\t\treturn entry.split( '=' );\n\t\t\t} )\n\t\t\t// [ [ 'a', '5' ], [ 'b, '1' ], [ 'c', '2' ] ]\n\t\t\t.sort( function( a, b ) {\n\t\t\t\treturn a[ 0 ].localeCompare( b[ 0 ] );\n\t\t\t} )\n\t\t\t// [ 'a=5', 'b=1', 'c=2' ]\n\t\t\t.map( function( pair ) {\n\t\t\t\treturn pair.join( '=' );\n\t\t\t} )\n\t\t\t// 'a=5&b=1&c=2'\n\t\t\t.join( '&' );\n\t}\n\n\tconst { parse = true } = options;\n\tif ( typeof options.path === 'string' && parse ) {\n\t\tconst method = options.method || 'GET';\n\t\tconst path = getStablePath( options.path );\n\n\t\tif ( 'GET' === method && preloadedData[ path ] ) {\n\t\t\treturn Promise.resolve( preloadedData[ path ].body );\n\t\t}\n\t}\n\n\treturn next( options );\n};\n\nexport default createPreloadingMiddleware;\n","/**\n * Internal dependencies\n */\nimport namespaceAndEndpointMiddleware from './namespace-endpoint';\n\nconst createRootURLMiddleware = ( rootURL ) => ( options, next ) => {\n\treturn namespaceAndEndpointMiddleware( options, ( optionsWithPath ) => {\n\t\tlet url = optionsWithPath.url;\n\t\tlet path = optionsWithPath.path;\n\t\tlet apiRoot;\n\n\t\tif ( typeof path === 'string' ) {\n\t\t\tapiRoot = rootURL;\n\n\t\t\tif ( -1 !== rootURL.indexOf( '?' ) ) {\n\t\t\t\tpath = path.replace( '?', '&' );\n\t\t\t}\n\n\t\t\tpath = path.replace( /^\\//, '' );\n\n\t\t\t// API root may already include query parameter prefix if site is\n\t\t\t// configured to use plain permalinks.\n\t\t\tif ( 'string' === typeof apiRoot && -1 !== apiRoot.indexOf( '?' ) ) {\n\t\t\t\tpath = path.replace( '?', '&' );\n\t\t\t}\n\n\t\t\turl = apiRoot + path;\n\t\t}\n\n\t\treturn next( {\n\t\t\t...optionsWithPath,\n\t\t\turl,\n\t\t} );\n\t} );\n};\n\nexport default createRootURLMiddleware;\n","(function() { module.exports = this[\"wp\"][\"hooks\"]; }());","(function() { module.exports = this[\"wp\"][\"i18n\"]; }());"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/autop.js b/js/dist/autop.js new file mode 100644 index 0000000000..38e2e5f09d --- /dev/null +++ b/js/dist/autop.js @@ -0,0 +1,577 @@ +this["wp"] = this["wp"] || {}; this["wp"]["autop"] = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/autop/build-module/index.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js ***! + \*******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _arrayWithHoles; }); +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js ***! + \*************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _iterableToArrayLimit; }); +function _iterableToArrayLimit(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js": +/*!********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js ***! + \********************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _nonIterableRest; }); +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js ***! + \******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _slicedToArray; }); +/* harmony import */ var _arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js"); +/* harmony import */ var _iterableToArrayLimit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js"); +/* harmony import */ var _nonIterableRest__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js"); + + + +function _slicedToArray(arr, i) { + return Object(_arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__["default"])(arr) || Object(_iterableToArrayLimit__WEBPACK_IMPORTED_MODULE_1__["default"])(arr, i) || Object(_nonIterableRest__WEBPACK_IMPORTED_MODULE_2__["default"])(); +} + +/***/ }), + +/***/ "./node_modules/@wordpress/autop/build-module/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@wordpress/autop/build-module/index.js ***! + \*************************************************************/ +/*! exports provided: autop, removep */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autop", function() { return autop; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removep", function() { return removep; }); +/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); + + +/** + * The regular expression for an HTML element. + * + * @type {String} + */ +var htmlSplitRegex = function () { + /* eslint-disable no-multi-spaces */ + var comments = '!' + // Start of comment, after the <. + '(?:' + // Unroll the loop: Consume everything until --> is found. + '-(?!->)' + // Dash not followed by end of comment. + '[^\\-]*' + // Consume non-dashes. + ')*' + // Loop possessively. + '(?:-->)?'; // End of comment. If not found, match all input. + + var cdata = '!\\[CDATA\\[' + // Start of comment, after the <. + '[^\\]]*' + // Consume non-]. + '(?:' + // Unroll the loop: Consume everything until ]]> is found. + '](?!]>)' + // One ] not followed by end of comment. + '[^\\]]*' + // Consume non-]. + ')*?' + // Loop possessively. + '(?:]]>)?'; // End of comment. If not found, match all input. + + var escaped = '(?=' + // Is the element escaped? + '!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' + // If yes, which type? + comments + '|' + cdata + ')'; + var regex = '(' + // Capture the entire match. + '<' + // Find start of element. + '(' + // Conditional expression follows. + escaped + // Find end of escaped element. + '|' + // ... else ... + '[^>]*>?' + // Find end of normal element. + ')' + ')'; + return new RegExp(regex); + /* eslint-enable no-multi-spaces */ +}(); +/** + * Separate HTML elements and comments from the text. + * + * @param {string} input The text which has to be formatted. + * @return {Array} The formatted text. + */ + + +function htmlSplit(input) { + var parts = []; + var workingInput = input; + var match; + + while (match = workingInput.match(htmlSplitRegex)) { + parts.push(workingInput.slice(0, match.index)); + parts.push(match[0]); + workingInput = workingInput.slice(match.index + match[0].length); + } + + if (workingInput.length) { + parts.push(workingInput); + } + + return parts; +} +/** + * Replace characters or phrases within HTML elements only. + * + * @param {string} haystack The text which has to be formatted. + * @param {Object} replacePairs In the form {from: 'to', ...}. + * @return {string} The formatted text. + */ + + +function replaceInHtmlTags(haystack, replacePairs) { + // Find all elements. + var textArr = htmlSplit(haystack); + var changed = false; // Extract all needles. + + var needles = Object.keys(replacePairs); // Loop through delimiters (elements) only. + + for (var i = 1; i < textArr.length; i += 2) { + for (var j = 0; j < needles.length; j++) { + var needle = needles[j]; + + if (-1 !== textArr[i].indexOf(needle)) { + textArr[i] = textArr[i].replace(new RegExp(needle, 'g'), replacePairs[needle]); + changed = true; // After one strtr() break out of the foreach loop and look at next element. + + break; + } + } + } + + if (changed) { + haystack = textArr.join(''); + } + + return haystack; +} +/** + * Replaces double line-breaks with paragraph elements. + * + * A group of regex replaces used to identify text formatted with newlines and + * replace double line-breaks with HTML paragraph tags. The remaining line- + * breaks after conversion become <
> tags, unless br is set to 'false'. + * + * @param {string} text The text which has to be formatted. + * @param {boolean} br Optional. If set, will convert all remaining line- + * breaks after paragraphing. Default true. + * @return {string} Text which has been converted into paragraph tags. + */ + + +function autop(text) { + var br = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var preTags = []; + + if (text.trim() === '') { + return ''; + } // Just to make things a little easier, pad the end. + + + text = text + '\n'; + /* + * Pre tags shouldn't be touched by autop. + * Replace pre tags with placeholders and bring them back after autop. + */ + + if (text.indexOf(''); + var lastText = textParts.pop(); + text = ''; + + for (var i = 0; i < textParts.length; i++) { + var textPart = textParts[i]; + var start = textPart.indexOf(''; + preTags.push([name, textPart.substr(start) + '']); + text += textPart.substr(0, start) + name; + } + + text += lastText; + } // Change multiple
s into two line breaks, which will turn into paragraphs. + + + text = text.replace(/\s*/g, '\n\n'); + var allBlocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; // Add a double line break above block-level opening tags. + + text = text.replace(new RegExp('(<' + allBlocks + '[\s\/>])', 'g'), '\n\n$1'); // Add a double line break below block-level closing tags. + + text = text.replace(new RegExp('(<\/' + allBlocks + '>)', 'g'), '$1\n\n'); // Standardize newline characters to "\n". + + text = text.replace(/\r\n|\r/g, '\n'); // Find newlines in all elements and add placeholders. + + text = replaceInHtmlTags(text, { + '\n': ' ' + }); // Collapse line breaks before and after '); + } + /* + * Collapse line breaks inside elements, before and elements + * so they don't get autop'd. + */ + + + if (text.indexOf('') !== -1) { + text = text.replace(/(]*>)\s*/g, '$1'); + text = text.replace(/\s*<\/object>/g, ''); + text = text.replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g, '$1'); + } + /* + * Collapse line breaks inside